@libp2p/circuit-relay-v2 3.1.3-0862522fe → 3.1.3-4a85eb033

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/dist/index.min.js +2 -2
  2. package/package.json +10 -10
package/dist/index.min.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PCircuitRelayV2 = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PCircuitRelayV2=(()=>{var Nf=Object.create;var Bn=Object.defineProperty;var Rf=Object.getOwnPropertyDescriptor;var Lf=Object.getOwnPropertyNames;var Uf=Object.getPrototypeOf,Df=Object.prototype.hasOwnProperty;var Di=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ke=(r,e)=>{for(var t in e)Bn(r,t,{get:e[t],enumerable:!0})},ec=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Lf(e))!Df.call(r,s)&&s!==t&&Bn(r,s,{get:()=>e[s],enumerable:!(n=Rf(e,s))||n.enumerable});return r};var tc=(r,e,t)=>(t=r!=null?Nf(Uf(r)):{},ec(e||!r||!r.__esModule?Bn(t,"default",{value:r,enumerable:!0}):t,r)),Of=r=>ec(Bn({},"__esModule",{value:!0}),r);var ol=Di(vr=>{"use strict";var ip="[object ArrayBuffer]",wt=class r{static isArrayBuffer(e){return Object.prototype.toString.call(e)===ip}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=r.toUint8Array(e),s=r.toUint8Array(t);if(n.length!==s.byteLength)return!1;for(let i=0;i<n.length;i++)if(n[i]!==s[i])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let n=0;for(let o of t)n+=o.byteLength;let s=new Uint8Array(n),i=0;for(let o of t){let a=this.toUint8Array(o);s.set(a,i),i+=a.length}return e[e.length-1]instanceof Function?this.toView(s,e[e.length-1]):s.buffer}},$o="string",op=/^[0-9a-f]+$/i,ap=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,cp=/^[a-zA-Z0-9-_]+$/,Gn=class{static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n.buffer}static toString(e){let t=wt.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return decodeURIComponent(escape(n))}},Ge=class{static toString(e,t=!1){let n=wt.toArrayBuffer(e),s=new DataView(n),i="";for(let o=0;o<n.byteLength;o+=2){let a=s.getUint16(o,t);i+=String.fromCharCode(a)}return i}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),s=new DataView(n);for(let i=0;i<e.length;i++)s.setUint16(i*2,e.charCodeAt(i),t);return n}},Wn=class r{static isHex(e){return typeof e===$o&&op.test(e)}static isBase64(e){return typeof e===$o&&ap.test(e)}static isBase64Url(e){return typeof e===$o&&cp.test(e)}static ToString(e,t="utf8"){let n=wt.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return Ge.toString(n,!0);case"utf16":case"utf16be":return Ge.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return Ge.fromString(e,!0);case"utf16":case"utf16be":return Ge.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=wt.toUint8Array(e);if(typeof btoa<"u"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return Gn.fromString(e);case"utf16":case"utf16be":return Ge.fromString(e);case"utf16le":case"usc2":return Ge.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return Gn.toString(e);case"utf16":case"utf16be":return Ge.toString(e);case"utf16le":case"usc2":return Ge.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);return n.buffer}static ToBinary(e){let t=wt.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return n}static ToHex(e){let t=wt.toUint8Array(e),n="",s=t.length;for(let i=0;i<s;i++){let o=t[i];o<16&&(n+="0"),n+=o.toString(16)}return n}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let s=0;s<t.length;s=s+2){let i=t.slice(s,s+2);n[s/2]=parseInt(i,16)}return n.buffer}static ToUtf16String(e,t=!1){return Ge.toString(e,t)}static FromUtf16String(e,t=!1){return Ge.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return e?.replace(/[\n\r\t ]/g,"")||""}};Wn.DEFAULT_UTF8_ENCODING="utf8";function lp(r,...e){let t=arguments[0];for(let n=1;n<arguments.length;n++){let s=arguments[n];for(let i in s)t[i]=s[i]}return t}function up(...r){let e=r.map(s=>s.byteLength).reduce((s,i)=>s+i),t=new Uint8Array(e),n=0;return r.map(s=>new Uint8Array(s)).forEach(s=>{for(let i of s)t[n++]=i}),t.buffer}function fp(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<r.byteLength;s++)if(t[s]!==n[s])return!1;return!0}vr.BufferSourceConverter=wt;vr.Convert=Wn;vr.assign=lp;vr.combine=up;vr.isEqual=fp});var tf=Di((En,xi)=>{(function(r,e){"use strict";var t={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(l){if(!Array.isArray(l)&&!ArrayBuffer.isView(l))return!1;for(var d=0;d<l.length;d++)if(!Number.isInteger(l[d])||l[d]<0||l[d]>255)return!1;return!0}function s(l,d){return(l&65535)*d+(((l>>>16)*d&65535)<<16)}function i(l,d){return l<<d|l>>>32-d}function o(l){return l^=l>>>16,l=s(l,2246822507),l^=l>>>13,l=s(l,3266489909),l^=l>>>16,l}function a(l,d){l=[l[0]>>>16,l[0]&65535,l[1]>>>16,l[1]&65535],d=[d[0]>>>16,d[0]&65535,d[1]>>>16,d[1]&65535];var p=[0,0,0,0];return p[3]+=l[3]+d[3],p[2]+=p[3]>>>16,p[3]&=65535,p[2]+=l[2]+d[2],p[1]+=p[2]>>>16,p[2]&=65535,p[1]+=l[1]+d[1],p[0]+=p[1]>>>16,p[1]&=65535,p[0]+=l[0]+d[0],p[0]&=65535,[p[0]<<16|p[1],p[2]<<16|p[3]]}function c(l,d){l=[l[0]>>>16,l[0]&65535,l[1]>>>16,l[1]&65535],d=[d[0]>>>16,d[0]&65535,d[1]>>>16,d[1]&65535];var p=[0,0,0,0];return p[3]+=l[3]*d[3],p[2]+=p[3]>>>16,p[3]&=65535,p[2]+=l[2]*d[3],p[1]+=p[2]>>>16,p[2]&=65535,p[2]+=l[3]*d[2],p[1]+=p[2]>>>16,p[2]&=65535,p[1]+=l[1]*d[3],p[0]+=p[1]>>>16,p[1]&=65535,p[1]+=l[2]*d[2],p[0]+=p[1]>>>16,p[1]&=65535,p[1]+=l[3]*d[1],p[0]+=p[1]>>>16,p[1]&=65535,p[0]+=l[0]*d[3]+l[1]*d[2]+l[2]*d[1]+l[3]*d[0],p[0]&=65535,[p[0]<<16|p[1],p[2]<<16|p[3]]}function h(l,d){return d%=64,d===32?[l[1],l[0]]:d<32?[l[0]<<d|l[1]>>>32-d,l[1]<<d|l[0]>>>32-d]:(d-=32,[l[1]<<d|l[0]>>>32-d,l[0]<<d|l[1]>>>32-d])}function f(l,d){return d%=64,d===0?l:d<32?[l[0]<<d|l[1]>>>32-d,l[1]<<d]:[l[1]<<d-32,0]}function u(l,d){return[l[0]^d[0],l[1]^d[1]]}function g(l){return l=u(l,[0,l[0]>>>1]),l=c(l,[4283543511,3981806797]),l=u(l,[0,l[0]>>>1]),l=c(l,[3301882366,444984403]),l=u(l,[0,l[0]>>>1]),l}t.x86.hash32=function(l,d){if(t.inputValidation&&!n(l))return e;d=d||0;for(var p=l.length%4,y=l.length-p,b=d,w=0,m=3432918353,v=461845907,A=0;A<y;A=A+4)w=l[A]|l[A+1]<<8|l[A+2]<<16|l[A+3]<<24,w=s(w,m),w=i(w,15),w=s(w,v),b^=w,b=i(b,13),b=s(b,5)+3864292196;switch(w=0,p){case 3:w^=l[A+2]<<16;case 2:w^=l[A+1]<<8;case 1:w^=l[A],w=s(w,m),w=i(w,15),w=s(w,v),b^=w}return b^=l.length,b=o(b),b>>>0},t.x86.hash128=function(l,d){if(t.inputValidation&&!n(l))return e;d=d||0;for(var p=l.length%16,y=l.length-p,b=d,w=d,m=d,v=d,A=0,_=0,x=0,B=0,C=597399067,ne=2869860233,P=951274213,M=2716044179,L=0;L<y;L=L+16)A=l[L]|l[L+1]<<8|l[L+2]<<16|l[L+3]<<24,_=l[L+4]|l[L+5]<<8|l[L+6]<<16|l[L+7]<<24,x=l[L+8]|l[L+9]<<8|l[L+10]<<16|l[L+11]<<24,B=l[L+12]|l[L+13]<<8|l[L+14]<<16|l[L+15]<<24,A=s(A,C),A=i(A,15),A=s(A,ne),b^=A,b=i(b,19),b+=w,b=s(b,5)+1444728091,_=s(_,ne),_=i(_,16),_=s(_,P),w^=_,w=i(w,17),w+=m,w=s(w,5)+197830471,x=s(x,P),x=i(x,17),x=s(x,M),m^=x,m=i(m,15),m+=v,m=s(m,5)+2530024501,B=s(B,M),B=i(B,18),B=s(B,C),v^=B,v=i(v,13),v+=b,v=s(v,5)+850148119;switch(A=0,_=0,x=0,B=0,p){case 15:B^=l[L+14]<<16;case 14:B^=l[L+13]<<8;case 13:B^=l[L+12],B=s(B,M),B=i(B,18),B=s(B,C),v^=B;case 12:x^=l[L+11]<<24;case 11:x^=l[L+10]<<16;case 10:x^=l[L+9]<<8;case 9:x^=l[L+8],x=s(x,P),x=i(x,17),x=s(x,M),m^=x;case 8:_^=l[L+7]<<24;case 7:_^=l[L+6]<<16;case 6:_^=l[L+5]<<8;case 5:_^=l[L+4],_=s(_,ne),_=i(_,16),_=s(_,P),w^=_;case 4:A^=l[L+3]<<24;case 3:A^=l[L+2]<<16;case 2:A^=l[L+1]<<8;case 1:A^=l[L],A=s(A,C),A=i(A,15),A=s(A,ne),b^=A}return b^=l.length,w^=l.length,m^=l.length,v^=l.length,b+=w,b+=m,b+=v,w+=b,m+=b,v+=b,b=o(b),w=o(w),m=o(m),v=o(v),b+=w,b+=m,b+=v,w+=b,m+=b,v+=b,("00000000"+(b>>>0).toString(16)).slice(-8)+("00000000"+(w>>>0).toString(16)).slice(-8)+("00000000"+(m>>>0).toString(16)).slice(-8)+("00000000"+(v>>>0).toString(16)).slice(-8)},t.x64.hash128=function(l,d){if(t.inputValidation&&!n(l))return e;d=d||0;for(var p=l.length%16,y=l.length-p,b=[0,d],w=[0,d],m=[0,0],v=[0,0],A=[2277735313,289559509],_=[1291169091,658871167],x=0;x<y;x=x+16)m=[l[x+4]|l[x+5]<<8|l[x+6]<<16|l[x+7]<<24,l[x]|l[x+1]<<8|l[x+2]<<16|l[x+3]<<24],v=[l[x+12]|l[x+13]<<8|l[x+14]<<16|l[x+15]<<24,l[x+8]|l[x+9]<<8|l[x+10]<<16|l[x+11]<<24],m=c(m,A),m=h(m,31),m=c(m,_),b=u(b,m),b=h(b,27),b=a(b,w),b=a(c(b,[0,5]),[0,1390208809]),v=c(v,_),v=h(v,33),v=c(v,A),w=u(w,v),w=h(w,31),w=a(w,b),w=a(c(w,[0,5]),[0,944331445]);switch(m=[0,0],v=[0,0],p){case 15:v=u(v,f([0,l[x+14]],48));case 14:v=u(v,f([0,l[x+13]],40));case 13:v=u(v,f([0,l[x+12]],32));case 12:v=u(v,f([0,l[x+11]],24));case 11:v=u(v,f([0,l[x+10]],16));case 10:v=u(v,f([0,l[x+9]],8));case 9:v=u(v,[0,l[x+8]]),v=c(v,_),v=h(v,33),v=c(v,A),w=u(w,v);case 8:m=u(m,f([0,l[x+7]],56));case 7:m=u(m,f([0,l[x+6]],48));case 6:m=u(m,f([0,l[x+5]],40));case 5:m=u(m,f([0,l[x+4]],32));case 4:m=u(m,f([0,l[x+3]],24));case 3:m=u(m,f([0,l[x+2]],16));case 2:m=u(m,f([0,l[x+1]],8));case 1:m=u(m,[0,l[x]]),m=c(m,A),m=h(m,31),m=c(m,_),b=u(b,m)}return b=u(b,[0,l.length]),w=u(w,[0,l.length]),b=a(b,w),w=a(w,b),b=g(b),w=g(w),b=a(b,w),w=a(w,b),("00000000"+(b[0]>>>0).toString(16)).slice(-8)+("00000000"+(b[1]>>>0).toString(16)).slice(-8)+("00000000"+(w[0]>>>0).toString(16)).slice(-8)+("00000000"+(w[1]>>>0).toString(16)).slice(-8)},typeof En<"u"?(typeof xi<"u"&&xi.exports&&(En=xi.exports=t),En.murmurHash3=t):typeof define=="function"&&define.amd?define([],function(){return t}):(t._murmurHash3=r.murmurHash3,t.noConflict=function(){return r.murmurHash3=t._murmurHash3,t._murmurHash3=e,t.noConflict=e,t},r.murmurHash3=t)})(En)});var nf=Di((mv,rf)=>{rf.exports=tf()});var _0={};ke(_0,{RELAY_V2_HOP_CODEC:()=>We,RELAY_V2_STOP_CODEC:()=>nr,circuitRelayServer:()=>uf,circuitRelayTransport:()=>Ef});var Oi=Symbol.for("@libp2p/peer-id");var Mi="keep-alive";var nc=Symbol.for("@libp2p/transport");var rc;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(rc||(rc={}));var ut=class extends Error{static name="AbortError";constructor(e="The operation was aborted"){super(e),this.name="AbortError"}};var Ee=class extends Error{static name="InvalidParametersError";constructor(e="Invalid parameters"){super(e),this.name="InvalidParametersError"}},ar=class extends Error{static name="InvalidPublicKeyError";constructor(e="Invalid public key"){super(e),this.name="InvalidPublicKeyError"}};var _n=class extends Error{static name="InvalidMultihashError";constructor(e="Invalid Multihash"){super(e),this.name="InvalidMultihashError"}};var In=class extends Error{static name="InvalidMessageError";constructor(e="Invalid message"){super(e),this.name="InvalidMessageError"}};var Vr=class extends Error{static name="DialError";constructor(e="Dial error"){super(e),this.name="DialError"}},$t=class extends Error{static name="ListenError";constructor(e="Listen error"){super(e),this.name="ListenError"}};var cr=class extends Error{static name="UnsupportedKeyTypeError";constructor(e="Unsupported key type"){super(e),this.name="UnsupportedKeyTypeError"}};var Re=(r,...e)=>{try{[...e]}catch{}};var qe=class extends EventTarget{#e=new Map;constructor(){super(),Re(1/0,this)}listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let s=this.#e.get(e);s==null&&(s=[],this.#e.set(e,s)),s.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let s=this.#e.get(e);s!=null&&(s=s.filter(({callback:i})=>i!==t),this.#e.set(e,s))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:s})=>!s),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t={}){return this.dispatchEvent(new CustomEvent(e,t))}};function sc(r){return r!=null&&typeof r.start=="function"&&typeof r.stop=="function"}async function ic(...r){let e=[];for(let t of r)sc(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStart!=null&&await t.beforeStart()})),await Promise.all(e.map(async t=>{await t.start()})),await Promise.all(e.map(async t=>{t.afterStart!=null&&await t.afterStart()}))}async function oc(...r){let e=[];for(let t of r)sc(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStop!=null&&await t.beforeStop()})),await Promise.all(e.map(async t=>{await t.stop()})),await Promise.all(e.map(async t=>{t.afterStop!=null&&await t.afterStop()}))}var ac=Symbol.for("@libp2p/service-capabilities"),cc=Symbol.for("@libp2p/service-dependencies");var Ki={};ke(Ki,{base58btc:()=>Q,base58flickr:()=>Kf});var im=new Uint8Array(0);function lc(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function ft(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 uc(r){return new TextEncoder().encode(r)}function fc(r){return new TextDecoder().decode(r)}function Mf(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var s=0;s<r.length;s++){var i=r.charAt(s),o=i.charCodeAt(0);if(t[o]!==255)throw new TypeError(i+" is ambiguous");t[o]=s}var a=r.length,c=r.charAt(0),h=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function u(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var p=0,y=0,b=0,w=d.length;b!==w&&d[b]===0;)b++,p++;for(var m=(w-b)*f+1>>>0,v=new Uint8Array(m);b!==w;){for(var A=d[b],_=0,x=m-1;(A!==0||_<y)&&x!==-1;x--,_++)A+=256*v[x]>>>0,v[x]=A%a>>>0,A=A/a>>>0;if(A!==0)throw new Error("Non-zero carry");y=_,b++}for(var B=m-y;B!==m&&v[B]===0;)B++;for(var C=c.repeat(p);B<m;++B)C+=r.charAt(v[B]);return C}function g(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var p=0;if(d[p]!==" "){for(var y=0,b=0;d[p]===c;)y++,p++;for(var w=(d.length-p)*h+1>>>0,m=new Uint8Array(w);d[p];){var v=t[d.charCodeAt(p)];if(v===255)return;for(var A=0,_=w-1;(v!==0||A<b)&&_!==-1;_--,A++)v+=a*m[_]>>>0,m[_]=v%256>>>0,v=v/256>>>0;if(v!==0)throw new Error("Non-zero carry");b=A,p++}if(d[p]!==" "){for(var x=w-b;x!==w&&m[x]===0;)x++;for(var B=new Uint8Array(y+(w-x)),C=y;x!==w;)B[C++]=m[x++];return B}}}function l(d){var p=g(d);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:g,decode:l}}var Pf=Mf,Vf=Pf,dc=Vf;var Pi=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Vi=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let s=t.codePointAt(0);if(s===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=s,this.baseDecode=n}decode(e){if(typeof e=="string"){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))}else throw Error("Can only multibase decode strings")}or(e){return pc(this,e)}},Hi=class{decoders;constructor(e){this.decoders=e}or(e){return pc(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function pc(r,e){return new Hi({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var Fi=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,s){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=s,this.encoder=new Pi(e,t,n),this.decoder=new Vi(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function lr({name:r,prefix:e,encode:t,decode:n}){return new Fi(r,e,t,n)}function Tt({name:r,prefix:e,alphabet:t}){let{encode:n,decode:s}=dc(t,r);return lr({prefix:e,name:r,encode:n,decode:i=>ft(s(i))})}function Hf(r,e,t,n){let s={};for(let f=0;f<e.length;++f)s[e[f]]=f;let i=r.length;for(;r[i-1]==="=";)--i;let o=new Uint8Array(i*t/8|0),a=0,c=0,h=0;for(let f=0;f<i;++f){let u=s[r[f]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<t|u,a+=t,a>=8&&(a-=8,o[h++]=255&c>>a)}if(a>=t||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o}function Ff(r,e,t){let n=e[e.length-1]==="=",s=(1<<t)-1,i="",o=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],o+=8;o>t;)o-=t,i+=e[s&a>>o];if(o!==0&&(i+=e[s&a<<t-o]),n)for(;i.length*t&7;)i+="=";return i}function ae({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return lr({prefix:e,name:r,encode(s){return Ff(s,n,t)},decode(s){return Hf(s,n,t,r)}})}var Q=Tt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Kf=Tt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var qi={};ke(qi,{base32:()=>ht,base32hex:()=>Gf,base32hexpad:()=>Zf,base32hexpadupper:()=>jf,base32hexupper:()=>Wf,base32pad:()=>zf,base32padupper:()=>$f,base32upper:()=>qf,base32z:()=>Yf});var ht=ae({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),qf=ae({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),zf=ae({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),$f=ae({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Gf=ae({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Wf=ae({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Zf=ae({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),jf=ae({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Yf=ae({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var zi={};ke(zi,{base36:()=>Hr,base36upper:()=>Xf});var Hr=Tt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Xf=Tt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Jf=yc,mc=128,Qf=127,eh=~Qf,th=Math.pow(2,31);function yc(r,e,t){e=e||[],t=t||0;for(var n=t;r>=th;)e[t++]=r&255|mc,r/=128;for(;r&eh;)e[t++]=r&255|mc,r>>>=7;return e[t]=r|0,yc.bytes=t-n+1,e}var rh=$i,nh=128,gc=127;function $i(r,n){var t=0,n=n||0,s=0,i=n,o,a=r.length;do{if(i>=a)throw $i.bytes=0,new RangeError("Could not decode varint");o=r[i++],t+=s<28?(o&gc)<<s:(o&gc)*Math.pow(2,s),s+=7}while(o>=nh);return $i.bytes=i-n,t}var sh=Math.pow(2,7),ih=Math.pow(2,14),oh=Math.pow(2,21),ah=Math.pow(2,28),ch=Math.pow(2,35),lh=Math.pow(2,42),uh=Math.pow(2,49),fh=Math.pow(2,56),hh=Math.pow(2,63),dh=function(r){return r<sh?1:r<ih?2:r<oh?3:r<ah?4:r<ch?5:r<lh?6:r<uh?7:r<fh?8:r<hh?9:10},ph={encode:Jf,decode:rh,encodingLength:dh},mh=ph,Fr=mh;function Kr(r,e=0){return[Fr.decode(r,e),Fr.decode.bytes]}function ur(r,e,t=0){return Fr.encode(r,e,t),e}function fr(r){return Fr.encodingLength(r)}function Ze(r,e){let t=e.byteLength,n=fr(r),s=n+fr(t),i=new Uint8Array(s+t);return ur(r,i,0),ur(t,i,n),i.set(e,s),new hr(r,t,e,i)}function ze(r){let e=ft(r),[t,n]=Kr(e),[s,i]=Kr(e.subarray(n)),o=e.subarray(n+i);if(o.byteLength!==s)throw new Error("Incorrect length");return new hr(t,s,o,e)}function bc(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&lc(r.bytes,t.bytes)}}var hr=class{code;size;digest;bytes;constructor(e,t,n,s){this.code=e,this.size=t,this.digest=n,this.bytes=s}};function wc(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return yh(t,Gi(r),e??Q.encoder);default:return bh(t,Gi(r),e??ht.encoder)}}var xc=new WeakMap;function Gi(r){let e=xc.get(r);if(e==null){let t=new Map;return xc.set(r,t),t}return e}var me=class r{code;version;multihash;bytes;"/";constructor(e,t,n,s){this.code=t,this.version=e,this.multihash=n,this.bytes=s,this["/"]=s}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:e,multihash:t}=this;if(e!==qr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==wh)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}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:e,digest:t}=this.multihash,n=Ze(e,t);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(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&bc(e.multihash,n.multihash)}toString(e){return wc(this,e)}toJSON(){return{"/":wc(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:s,multihash:i,bytes:o}=t;return new r(n,s,i,o??vc(n,s,i.bytes))}else if(t[xh]===!0){let{version:n,multihash:s,code:i}=t,o=ze(s);return r.create(n,i,o)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==qr)throw new Error(`Version 0 CID must use dag-pb (code: ${qr}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let s=vc(e,t,n.bytes);return new r(e,t,n,s)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,qr,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,s=ft(e.subarray(n,n+t.multihashSize));if(s.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=s.subarray(t.multihashSize-t.digestSize),o=new hr(t.multihashCode,t.digestSize,i,s);return[t.version===0?r.createV0(o):r.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[u,g]=Kr(e.subarray(t));return t+=g,u},s=n(),i=qr;if(s===18?(s=0,t=0):i=n(),s!==0&&s!==1)throw new RangeError(`Invalid CID version ${s}`);let o=t,a=n(),c=n(),h=t+c,f=h-o;return{version:s,codec:i,multihashCode:a,digestSize:c,multihashSize:f,size:h}}static parse(e,t){let[n,s]=gh(e,t),i=r.decode(s);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Gi(i).set(n,e),i}};function gh(r,e){switch(r[0]){case"Q":{let t=e??Q;return[Q.prefix,t.decode(`${Q.prefix}${r}`)]}case Q.prefix:{let t=e??Q;return[Q.prefix,t.decode(r)]}case ht.prefix:{let t=e??ht;return[ht.prefix,t.decode(r)]}case Hr.prefix:{let t=e??Hr;return[Hr.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function yh(r,e,t){let{prefix:n}=t;if(n!==Q.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let s=e.get(n);if(s==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return s}function bh(r,e,t){let{prefix:n}=t,s=e.get(n);if(s==null){let i=t.encode(r);return e.set(n,i),i}else return s}var qr=112,wh=18;function vc(r,e,t){let n=fr(r),s=n+fr(e),i=new Uint8Array(s+t.byteLength);return ur(r,i,0),ur(e,i,n),i.set(t,s),i}var xh=Symbol.for("@ipld/js-cid/CID");var Wi={};ke(Wi,{identity:()=>dt});var Ec=0,vh="identity",Sc=ft;function Eh(r){return Ze(Ec,Sc(r))}var dt={code:Ec,name:vh,encode:Sc,digest:Eh};function ge(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function Ac(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function Sh(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function dr(r,...e){if(!Sh(r))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(r.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${r.length}`)}function Bc(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ac(r.outputLen),Ac(r.blockLen)}function pr(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function _c(r,e){dr(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var Gt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var kn=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),je=(r,e)=>r<<32-e|r>>>e;var Tm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ic(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function zr(r){return typeof r=="string"&&(r=Ic(r)),dr(r),r}function Zi(...r){let e=0;for(let n=0;n<r.length;n++){let s=r[n];dr(s),e+=s.length}let t=new Uint8Array(e);for(let n=0,s=0;n<r.length;n++){let i=r[n];t.set(i,s),s+=i.length}return t}var mr=class{clone(){return this._cloneInto()}},km={}.toString;function Cn(r){let e=n=>r().update(zr(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function Nn(r=32){if(Gt&&typeof Gt.getRandomValues=="function")return Gt.getRandomValues(new Uint8Array(r));if(Gt&&typeof Gt.randomBytes=="function")return Gt.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function Ah(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let s=BigInt(32),i=BigInt(4294967295),o=Number(t>>s&i),a=Number(t&i),c=n?4:0,h=n?0:4;r.setUint32(e+c,o,n),r.setUint32(e+h,a,n)}var Tc=(r,e,t)=>r&e^~r&t,kc=(r,e,t)=>r&e^r&t^e&t,gr=class extends mr{constructor(e,t,n,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=kn(this.buffer)}update(e){pr(this);let{view:t,buffer:n,blockLen:s}=this;e=zr(e);let i=e.length;for(let o=0;o<i;){let a=Math.min(s-this.pos,i-o);if(a===s){let c=kn(e);for(;s<=i-o;o+=s)this.process(c,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){pr(this),_c(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:s,isLE:i}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(n,0),o=0);for(let u=o;u<s;u++)t[u]=0;Ah(n,s-8,BigInt(this.length*8),i),this.process(n,0);let a=kn(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let h=c/4,f=this.get();if(h>f.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<h;u++)a.setUint32(4*u,f[u],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:s,finished:i,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=o,s%t&&e.buffer.set(n),e}};var Rn=BigInt(4294967295),ji=BigInt(32);function Cc(r,e=!1){return e?{h:Number(r&Rn),l:Number(r>>ji&Rn)}:{h:Number(r>>ji&Rn)|0,l:Number(r&Rn)|0}}function Bh(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;s<r.length;s++){let{h:i,l:o}=Cc(r[s],e);[t[s],n[s]]=[i,o]}return[t,n]}var _h=(r,e)=>BigInt(r>>>0)<<ji|BigInt(e>>>0),Ih=(r,e,t)=>r>>>t,Th=(r,e,t)=>r<<32-t|e>>>t,kh=(r,e,t)=>r>>>t|e<<32-t,Ch=(r,e,t)=>r<<32-t|e>>>t,Nh=(r,e,t)=>r<<64-t|e>>>t-32,Rh=(r,e,t)=>r>>>t-32|e<<64-t,Lh=(r,e)=>e,Uh=(r,e)=>r,Dh=(r,e,t)=>r<<t|e>>>32-t,Oh=(r,e,t)=>e<<t|r>>>32-t,Mh=(r,e,t)=>e<<t-32|r>>>64-t,Ph=(r,e,t)=>r<<t-32|e>>>64-t;function Vh(r,e,t,n){let s=(e>>>0)+(n>>>0);return{h:r+t+(s/2**32|0)|0,l:s|0}}var Hh=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),Fh=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,Kh=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),qh=(r,e,t,n,s)=>e+t+n+s+(r/2**32|0)|0,zh=(r,e,t,n,s)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(s>>>0),$h=(r,e,t,n,s,i)=>e+t+n+s+i+(r/2**32|0)|0;var Gh={fromBig:Cc,split:Bh,toBig:_h,shrSH:Ih,shrSL:Th,rotrSH:kh,rotrSL:Ch,rotrBH:Nh,rotrBL:Rh,rotr32H:Lh,rotr32L:Uh,rotlSH:Dh,rotlSL:Oh,rotlBH:Mh,rotlBL:Ph,add:Vh,add3L:Hh,add3H:Fh,add4L:Kh,add4H:qh,add5H:$h,add5L:zh},O=Gh;var[Wh,Zh]=O.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(r=>BigInt(r))),kt=new Uint32Array(80),Ct=new Uint32Array(80),Yi=class extends gr{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(){let{Ah:e,Al:t,Bh:n,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:h,El:f,Fh:u,Fl:g,Gh:l,Gl:d,Hh:p,Hl:y}=this;return[e,t,n,s,i,o,a,c,h,f,u,g,l,d,p,y]}set(e,t,n,s,i,o,a,c,h,f,u,g,l,d,p,y){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=h|0,this.El=f|0,this.Fh=u|0,this.Fl=g|0,this.Gh=l|0,this.Gl=d|0,this.Hh=p|0,this.Hl=y|0}process(e,t){for(let m=0;m<16;m++,t+=4)kt[m]=e.getUint32(t),Ct[m]=e.getUint32(t+=4);for(let m=16;m<80;m++){let v=kt[m-15]|0,A=Ct[m-15]|0,_=O.rotrSH(v,A,1)^O.rotrSH(v,A,8)^O.shrSH(v,A,7),x=O.rotrSL(v,A,1)^O.rotrSL(v,A,8)^O.shrSL(v,A,7),B=kt[m-2]|0,C=Ct[m-2]|0,ne=O.rotrSH(B,C,19)^O.rotrBH(B,C,61)^O.shrSH(B,C,6),P=O.rotrSL(B,C,19)^O.rotrBL(B,C,61)^O.shrSL(B,C,6),M=O.add4L(x,P,Ct[m-7],Ct[m-16]),L=O.add4H(M,_,ne,kt[m-7],kt[m-16]);kt[m]=L|0,Ct[m]=M|0}let{Ah:n,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:h,Dl:f,Eh:u,El:g,Fh:l,Fl:d,Gh:p,Gl:y,Hh:b,Hl:w}=this;for(let m=0;m<80;m++){let v=O.rotrSH(u,g,14)^O.rotrSH(u,g,18)^O.rotrBH(u,g,41),A=O.rotrSL(u,g,14)^O.rotrSL(u,g,18)^O.rotrBL(u,g,41),_=u&l^~u&p,x=g&d^~g&y,B=O.add5L(w,A,x,Zh[m],Ct[m]),C=O.add5H(B,b,v,_,Wh[m],kt[m]),ne=B|0,P=O.rotrSH(n,s,28)^O.rotrBH(n,s,34)^O.rotrBH(n,s,39),M=O.rotrSL(n,s,28)^O.rotrBL(n,s,34)^O.rotrBL(n,s,39),L=n&i^n&a^i&a,T=s&o^s&c^o&c;b=p|0,w=y|0,p=l|0,y=d|0,l=u|0,d=g|0,{h:u,l:g}=O.add(h|0,f|0,C|0,ne|0),h=a|0,f=c|0,a=i|0,c=o|0,i=n|0,o=s|0;let N=O.add3L(ne,M,T);n=O.add3H(N,C,P,L),s=N|0}({h:n,l:s}=O.add(this.Ah|0,this.Al|0,n|0,s|0)),{h:i,l:o}=O.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l:c}=O.add(this.Ch|0,this.Cl|0,a|0,c|0),{h,l:f}=O.add(this.Dh|0,this.Dl|0,h|0,f|0),{h:u,l:g}=O.add(this.Eh|0,this.El|0,u|0,g|0),{h:l,l:d}=O.add(this.Fh|0,this.Fl|0,l|0,d|0),{h:p,l:y}=O.add(this.Gh|0,this.Gl|0,p|0,y|0),{h:b,l:w}=O.add(this.Hh|0,this.Hl|0,b|0,w|0),this.set(n,s,i,o,a,c,h,f,u,g,l,d,p,y,b,w)}roundClean(){kt.fill(0),Ct.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)}};var Nc=Cn(()=>new Yi);var Un={};ke(Un,{aInRange:()=>Le,abool:()=>Ye,abytes:()=>yr,bitGet:()=>ed,bitLen:()=>to,bitMask:()=>Gr,bitSet:()=>td,bytesToHex:()=>mt,bytesToNumberBE:()=>gt,bytesToNumberLE:()=>Rt,concatBytes:()=>yt,createHmacDrbg:()=>ro,ensureBytes:()=>ce,equalBytes:()=>Jh,hexToBytes:()=>Zt,hexToNumber:()=>eo,inRange:()=>$r,isBytes:()=>Nt,memoized:()=>Yt,notImplemented:()=>nd,numberToBytesBE:()=>Lt,numberToBytesLE:()=>jt,numberToHexUnpadded:()=>Wt,numberToVarBytesBE:()=>Xh,utf8ToBytes:()=>Qh,validateObject:()=>st});var Qi=BigInt(0),Ln=BigInt(1),jh=BigInt(2);function Nt(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function yr(r){if(!Nt(r))throw new Error("Uint8Array expected")}function Ye(r,e){if(typeof e!="boolean")throw new Error(`${r} must be valid boolean, got "${e}".`)}var Yh=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function mt(r){yr(r);let e="";for(let t=0;t<r.length;t++)e+=Yh[r[t]];return e}function Wt(r){let e=r.toString(16);return e.length&1?`0${e}`:e}function eo(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}var pt={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Rc(r){if(r>=pt._0&&r<=pt._9)return r-pt._0;if(r>=pt._A&&r<=pt._F)return r-(pt._A-10);if(r>=pt._a&&r<=pt._f)return r-(pt._a-10)}function Zt(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let e=r.length,t=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(t);for(let s=0,i=0;s<t;s++,i+=2){let o=Rc(r.charCodeAt(i)),a=Rc(r.charCodeAt(i+1));if(o===void 0||a===void 0){let c=r[i]+r[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[s]=o*16+a}return n}function gt(r){return eo(mt(r))}function Rt(r){return yr(r),eo(mt(Uint8Array.from(r).reverse()))}function Lt(r,e){return Zt(r.toString(16).padStart(e*2,"0"))}function jt(r,e){return Lt(r,e).reverse()}function Xh(r){return Zt(Wt(r))}function ce(r,e,t){let n;if(typeof e=="string")try{n=Zt(e)}catch(i){throw new Error(`${r} must be valid hex string, got "${e}". Cause: ${i}`)}else if(Nt(e))n=Uint8Array.from(e);else throw new Error(`${r} must be hex string or Uint8Array`);let s=n.length;if(typeof t=="number"&&s!==t)throw new Error(`${r} expected ${t} bytes, got ${s}`);return n}function yt(...r){let e=0;for(let n=0;n<r.length;n++){let s=r[n];yr(s),e+=s.length}let t=new Uint8Array(e);for(let n=0,s=0;n<r.length;n++){let i=r[n];t.set(i,s),s+=i.length}return t}function Jh(r,e){if(r.length!==e.length)return!1;let t=0;for(let n=0;n<r.length;n++)t|=r[n]^e[n];return t===0}function Qh(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}var Xi=r=>typeof r=="bigint"&&Qi<=r;function $r(r,e,t){return Xi(r)&&Xi(e)&&Xi(t)&&e<=r&&r<t}function Le(r,e,t,n){if(!$r(e,t,n))throw new Error(`expected valid ${r}: ${t} <= n < ${n}, got ${typeof e} ${e}`)}function to(r){let e;for(e=0;r>Qi;r>>=Ln,e+=1);return e}function ed(r,e){return r>>BigInt(e)&Ln}function td(r,e,t){return r|(t?Ln:Qi)<<BigInt(e)}var Gr=r=>(jh<<BigInt(r-1))-Ln,Ji=r=>new Uint8Array(r),Lc=r=>Uint8Array.from(r);function ro(r,e,t){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=Ji(r),s=Ji(r),i=0,o=()=>{n.fill(1),s.fill(0),i=0},a=(...u)=>t(s,n,...u),c=(u=Ji())=>{s=a(Lc([0]),u),n=a(),u.length!==0&&(s=a(Lc([1]),u),n=a())},h=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let u=0,g=[];for(;u<e;){n=a();let l=n.slice();g.push(l),u+=n.length}return yt(...g)};return(u,g)=>{o(),c(u);let l;for(;!(l=g(h()));)c();return o(),l}}var rd={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||Nt(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function st(r,e,t={}){let n=(s,i,o)=>{let a=rd[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);let c=r[s];if(!(o&&c===void 0)&&!a(c,r))throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${i}`)};for(let[s,i]of Object.entries(e))n(s,i,!1);for(let[s,i]of Object.entries(t))n(s,i,!0);return r}var nd=()=>{throw new Error("not implemented")};function Yt(r){let e=new WeakMap;return(t,...n)=>{let s=e.get(t);if(s!==void 0)return s;let i=r(t,...n);return e.set(t,i),i}}var fe=BigInt(0),se=BigInt(1),Xt=BigInt(2),sd=BigInt(3),no=BigInt(4),Uc=BigInt(5),Dc=BigInt(8),id=BigInt(9),od=BigInt(16);function X(r,e){let t=r%e;return t>=fe?t:e+t}function ad(r,e,t){if(t<=fe||e<fe)throw new Error("Expected power/modulo > 0");if(t===se)return fe;let n=se;for(;e>fe;)e&se&&(n=n*r%t),r=r*r%t,e>>=se;return n}function ie(r,e,t){let n=r;for(;e-- >fe;)n*=n,n%=t;return n}function Dn(r,e){if(r===fe||e<=fe)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=X(r,e),n=e,s=fe,i=se,o=se,a=fe;for(;t!==fe;){let h=n/t,f=n%t,u=s-o*h,g=i-a*h;n=t,t=f,s=o,i=a,o=u,a=g}if(n!==se)throw new Error("invert: does not exist");return X(s,e)}function cd(r){let e=(r-se)/Xt,t,n,s;for(t=r-se,n=0;t%Xt===fe;t/=Xt,n++);for(s=Xt;s<r&&ad(s,e,r)!==r-se;s++);if(n===1){let o=(r+se)/no;return function(c,h){let f=c.pow(h,o);if(!c.eql(c.sqr(f),h))throw new Error("Cannot find square root");return f}}let i=(t+se)/Xt;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let h=n,f=a.pow(a.mul(a.ONE,s),t),u=a.pow(c,i),g=a.pow(c,t);for(;!a.eql(g,a.ONE);){if(a.eql(g,a.ZERO))return a.ZERO;let l=1;for(let p=a.sqr(g);l<h&&!a.eql(p,a.ONE);l++)p=a.sqr(p);let d=a.pow(f,se<<BigInt(h-l-1));f=a.sqr(d),u=a.mul(u,d),g=a.mul(g,f),h=l}return u}}function ld(r){if(r%no===sd){let e=(r+se)/no;return function(n,s){let i=n.pow(s,e);if(!n.eql(n.sqr(i),s))throw new Error("Cannot find square root");return i}}if(r%Dc===Uc){let e=(r-Uc)/Dc;return function(n,s){let i=n.mul(s,Xt),o=n.pow(i,e),a=n.mul(s,o),c=n.mul(n.mul(a,Xt),o),h=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(h),s))throw new Error("Cannot find square root");return h}}return r%od,cd(r)}var Oc=(r,e)=>(X(r,e)&se)===se,ud=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function so(r){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=ud.reduce((n,s)=>(n[s]="function",n),e);return st(r,t)}function fd(r,e,t){if(t<fe)throw new Error("Expected power > 0");if(t===fe)return r.ONE;if(t===se)return e;let n=r.ONE,s=e;for(;t>fe;)t&se&&(n=r.mul(n,s)),s=r.sqr(s),t>>=se;return n}function hd(r,e){let t=new Array(e.length),n=e.reduce((i,o,a)=>r.is0(o)?i:(t[a]=i,r.mul(i,o)),r.ONE),s=r.inv(n);return e.reduceRight((i,o,a)=>r.is0(o)?i:(t[a]=r.mul(i,t[a]),r.mul(i,o)),s),t}function io(r,e){let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function Ut(r,e,t=!1,n={}){if(r<=fe)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:s,nByteLength:i}=io(r,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");let o=ld(r),a=Object.freeze({ORDER:r,BITS:s,BYTES:i,MASK:Gr(s),ZERO:fe,ONE:se,create:c=>X(c,r),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return fe<=c&&c<r},is0:c=>c===fe,isOdd:c=>(c&se)===se,neg:c=>X(-c,r),eql:(c,h)=>c===h,sqr:c=>X(c*c,r),add:(c,h)=>X(c+h,r),sub:(c,h)=>X(c-h,r),mul:(c,h)=>X(c*h,r),pow:(c,h)=>fd(a,c,h),div:(c,h)=>X(c*Dn(h,r),r),sqrN:c=>c*c,addN:(c,h)=>c+h,subN:(c,h)=>c-h,mulN:(c,h)=>c*h,inv:c=>Dn(c,r),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>hd(a,c),cmov:(c,h,f)=>f?h:c,toBytes:c=>t?jt(c,i):Lt(c,i),fromBytes:c=>{if(c.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${c.length}`);return t?Rt(c):gt(c)}});return Object.freeze(a)}function Mc(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let e=r.toString(2).length;return Math.ceil(e/8)}function oo(r){let e=Mc(r);return e+Math.ceil(e/2)}function Pc(r,e,t=!1){let n=r.length,s=Mc(e),i=oo(e);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);let o=t?gt(r):Rt(r),a=X(o,e-se)+se;return t?jt(a,s):Lt(a,s)}var pd=BigInt(0),ao=BigInt(1),co=new WeakMap,Vc=new WeakMap;function On(r,e){let t=(i,o)=>{let a=o.negate();return i?a:o},n=i=>{if(!Number.isSafeInteger(i)||i<=0||i>e)throw new Error(`Wrong window size=${i}, should be [1..${e}]`)},s=i=>{n(i);let o=Math.ceil(e/i)+1,a=2**(i-1);return{windows:o,windowSize:a}};return{constTimeNegate:t,unsafeLadder(i,o){let a=r.ZERO,c=i;for(;o>pd;)o&ao&&(a=a.add(c)),c=c.double(),o>>=ao;return a},precomputeWindow(i,o){let{windows:a,windowSize:c}=s(o),h=[],f=i,u=f;for(let g=0;g<a;g++){u=f,h.push(u);for(let l=1;l<c;l++)u=u.add(f),h.push(u);f=u.double()}return h},wNAF(i,o,a){let{windows:c,windowSize:h}=s(i),f=r.ZERO,u=r.BASE,g=BigInt(2**i-1),l=2**i,d=BigInt(i);for(let p=0;p<c;p++){let y=p*h,b=Number(a&g);a>>=d,b>h&&(b-=l,a+=ao);let w=y,m=y+Math.abs(b)-1,v=p%2!==0,A=b<0;b===0?u=u.add(t(v,o[w])):f=f.add(t(A,o[m]))}return{p:f,f:u}},wNAFCached(i,o,a){let c=Vc.get(i)||1,h=co.get(i);return h||(h=this.precomputeWindow(i,c),c!==1&&co.set(i,a(h))),this.wNAF(c,h,o)},setWindowSize(i,o){n(o),Vc.set(i,o),co.delete(i)}}}function Mn(r,e,t,n){if(!Array.isArray(t)||!Array.isArray(n)||n.length!==t.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((f,u)=>{if(!e.isValid(f))throw new Error(`wrong scalar at index ${u}`)}),t.forEach((f,u)=>{if(!(f instanceof r))throw new Error(`wrong point at index ${u}`)});let s=to(BigInt(t.length)),i=s>12?s-3:s>4?s-2:s?2:1,o=(1<<i)-1,a=new Array(o+1).fill(r.ZERO),c=Math.floor((e.BITS-1)/i)*i,h=r.ZERO;for(let f=c;f>=0;f-=i){a.fill(r.ZERO);for(let g=0;g<n.length;g++){let l=n[g],d=Number(l>>BigInt(f)&BigInt(o));a[d]=a[d].add(t[g])}let u=r.ZERO;for(let g=a.length-1,l=r.ZERO;g>0;g--)l=l.add(a[g]),u=u.add(l);if(h=h.add(u),f!==0)for(let g=0;g<i;g++)h=h.double()}return h}function Wr(r){return so(r.Fp),st(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...io(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var Xe=BigInt(0),Ue=BigInt(1),Pn=BigInt(2),md=BigInt(8),gd={zip215:!0};function yd(r){let e=Wr(r);return st(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function Hc(r){let e=yd(r),{Fp:t,n,prehash:s,hash:i,randomBytes:o,nByteLength:a,h:c}=e,h=Pn<<BigInt(a*8)-Ue,f=t.create,u=Ut(e.n,e.nBitLength),g=e.uvRatio||((S,E)=>{try{return{isValid:!0,value:t.sqrt(S*t.inv(E))}}catch{return{isValid:!1,value:Xe}}}),l=e.adjustScalarBytes||(S=>S),d=e.domain||((S,E,I)=>{if(Ye("phflag",I),E.length||I)throw new Error("Contexts/pre-hash are not supported");return S});function p(S,E){Le("coordinate "+S,E,Xe,h)}function y(S){if(!(S instanceof m))throw new Error("ExtendedPoint expected")}let b=Yt((S,E)=>{let{ex:I,ey:R,ez:U}=S,D=S.is0();E==null&&(E=D?md:t.inv(U));let K=f(I*E),$=f(R*E),q=f(U*E);if(D)return{x:Xe,y:Ue};if(q!==Ue)throw new Error("invZ was invalid");return{x:K,y:$}}),w=Yt(S=>{let{a:E,d:I}=e;if(S.is0())throw new Error("bad point: ZERO");let{ex:R,ey:U,ez:D,et:K}=S,$=f(R*R),q=f(U*U),Y=f(D*D),te=f(Y*Y),de=f($*E),pe=f(Y*f(de+q)),be=f(te+f(I*f($*q)));if(pe!==be)throw new Error("bad point: equation left != right (1)");let Te=f(R*U),ue=f(D*K);if(Te!==ue)throw new Error("bad point: equation left != right (2)");return!0});class m{constructor(E,I,R,U){this.ex=E,this.ey=I,this.ez=R,this.et=U,p("x",E),p("y",I),p("z",R),p("t",U),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");let{x:I,y:R}=E||{};return p("x",I),p("y",R),new m(I,R,Ue,f(I*R))}static normalizeZ(E){let I=t.invertBatch(E.map(R=>R.ez));return E.map((R,U)=>R.toAffine(I[U])).map(m.fromAffine)}static msm(E,I){return Mn(m,u,E,I)}_setWindowSize(E){_.setWindowSize(this,E)}assertValidity(){w(this)}equals(E){y(E);let{ex:I,ey:R,ez:U}=this,{ex:D,ey:K,ez:$}=E,q=f(I*$),Y=f(D*U),te=f(R*$),de=f(K*U);return q===Y&&te===de}is0(){return this.equals(m.ZERO)}negate(){return new m(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:E}=e,{ex:I,ey:R,ez:U}=this,D=f(I*I),K=f(R*R),$=f(Pn*f(U*U)),q=f(E*D),Y=I+R,te=f(f(Y*Y)-D-K),de=q+K,pe=de-$,be=q-K,Te=f(te*pe),ue=f(de*be),Ne=f(te*be),lt=f(pe*de);return new m(Te,ue,lt,Ne)}add(E){y(E);let{a:I,d:R}=e,{ex:U,ey:D,ez:K,et:$}=this,{ex:q,ey:Y,ez:te,et:de}=E;if(I===BigInt(-1)){let Wa=f((D-U)*(Y+q)),Za=f((D+U)*(Y-q)),Ui=f(Za-Wa);if(Ui===Xe)return this.double();let ja=f(K*Pn*de),Ya=f($*Pn*te),Xa=Ya+ja,Ja=Za+Wa,Qa=Ya-ja,If=f(Xa*Ui),Tf=f(Ja*Qa),kf=f(Xa*Qa),Cf=f(Ui*Ja);return new m(If,Tf,Cf,kf)}let pe=f(U*q),be=f(D*Y),Te=f($*R*de),ue=f(K*te),Ne=f((U+D)*(q+Y)-pe-be),lt=ue-Te,Mr=ue+Te,Pr=f(be-I*pe),Sf=f(Ne*lt),Af=f(Mr*Pr),Bf=f(Ne*Pr),_f=f(lt*Mr);return new m(Sf,Af,_f,Bf)}subtract(E){return this.add(E.negate())}wNAF(E){return _.wNAFCached(this,E,m.normalizeZ)}multiply(E){let I=E;Le("scalar",I,Ue,n);let{p:R,f:U}=this.wNAF(I);return m.normalizeZ([R,U])[0]}multiplyUnsafe(E){let I=E;return Le("scalar",I,Xe,n),I===Xe?A:this.equals(A)||I===Ue?this:this.equals(v)?this.wNAF(I).p:_.unsafeLadder(this,I)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return _.unsafeLadder(this,n).is0()}toAffine(E){return b(this,E)}clearCofactor(){let{h:E}=e;return E===Ue?this:this.multiplyUnsafe(E)}static fromHex(E,I=!1){let{d:R,a:U}=e,D=t.BYTES;E=ce("pointHex",E,D),Ye("zip215",I);let K=E.slice(),$=E[D-1];K[D-1]=$&-129;let q=Rt(K),Y=I?h:t.ORDER;Le("pointHex.y",q,Xe,Y);let te=f(q*q),de=f(te-Ue),pe=f(R*te-U),{isValid:be,value:Te}=g(de,pe);if(!be)throw new Error("Point.fromHex: invalid y coordinate");let ue=(Te&Ue)===Ue,Ne=($&128)!==0;if(!I&&Te===Xe&&Ne)throw new Error("Point.fromHex: x=0 and x_0=1");return Ne!==ue&&(Te=f(-Te)),m.fromAffine({x:Te,y:q})}static fromPrivateKey(E){return C(E).point}toRawBytes(){let{x:E,y:I}=this.toAffine(),R=jt(I,t.BYTES);return R[R.length-1]|=E&Ue?128:0,R}toHex(){return mt(this.toRawBytes())}}m.BASE=new m(e.Gx,e.Gy,Ue,f(e.Gx*e.Gy)),m.ZERO=new m(Xe,Ue,Ue,Xe);let{BASE:v,ZERO:A}=m,_=On(m,a*8);function x(S){return X(S,n)}function B(S){return x(Rt(S))}function C(S){let E=a;S=ce("private key",S,E);let I=ce("hashed private key",i(S),2*E),R=l(I.slice(0,E)),U=I.slice(E,2*E),D=B(R),K=v.multiply(D),$=K.toRawBytes();return{head:R,prefix:U,scalar:D,point:K,pointBytes:$}}function ne(S){return C(S).pointBytes}function P(S=new Uint8Array,...E){let I=yt(...E);return B(i(d(I,ce("context",S),!!s)))}function M(S,E,I={}){S=ce("message",S),s&&(S=s(S));let{prefix:R,scalar:U,pointBytes:D}=C(E),K=P(I.context,R,S),$=v.multiply(K).toRawBytes(),q=P(I.context,$,D,S),Y=x(K+q*U);Le("signature.s",Y,Xe,n);let te=yt($,jt(Y,t.BYTES));return ce("result",te,a*2)}let L=gd;function T(S,E,I,R=L){let{context:U,zip215:D}=R,K=t.BYTES;S=ce("signature",S,2*K),E=ce("message",E),D!==void 0&&Ye("zip215",D),s&&(E=s(E));let $=Rt(S.slice(K,2*K)),q,Y,te;try{q=m.fromHex(I,D),Y=m.fromHex(S.slice(0,K),D),te=v.multiplyUnsafe($)}catch{return!1}if(!D&&q.isSmallOrder())return!1;let de=P(U,Y.toRawBytes(),q.toRawBytes(),E);return Y.add(q.multiplyUnsafe(de)).subtract(te).clearCofactor().equals(m.ZERO)}return v._setWindowSize(8),{CURVE:e,getPublicKey:ne,sign:M,verify:T,ExtendedPoint:m,utils:{getExtendedPublicKey:C,randomPrivateKey:()=>o(t.BYTES),precompute(S=8,E=m.BASE){return E._setWindowSize(S),E.multiply(BigInt(3)),E}}}}var lo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Fc=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Jm=BigInt(0),bd=BigInt(1),Kc=BigInt(2),Qm=BigInt(3),wd=BigInt(5),xd=BigInt(8);function vd(r){let e=BigInt(10),t=BigInt(20),n=BigInt(40),s=BigInt(80),i=lo,a=r*r%i*r%i,c=ie(a,Kc,i)*a%i,h=ie(c,bd,i)*r%i,f=ie(h,wd,i)*h%i,u=ie(f,e,i)*f%i,g=ie(u,t,i)*u%i,l=ie(g,n,i)*g%i,d=ie(l,s,i)*l%i,p=ie(d,s,i)*l%i,y=ie(p,e,i)*f%i;return{pow_p_5_8:ie(y,Kc,i)*r%i,b2:a}}function Ed(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function Sd(r,e){let t=lo,n=X(e*e*e,t),s=X(n*n*e,t),i=vd(r*s).pow_p_5_8,o=X(r*n*i,t),a=X(e*o*o,t),c=o,h=X(o*Fc,t),f=a===r,u=a===X(-r,t),g=a===X(-r*Fc,t);return f&&(o=c),(u||g)&&(o=h),Oc(o,t)&&(o=X(-o,t)),{isValid:f||u,value:o}}var Ad=Ut(lo,void 0,!0),Bd={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ad,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:xd,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Nc,randomBytes:Nn,adjustScalarBytes:Ed,uvRatio:Sd},qc=Hc(Bd);var Vn=32;function zc(r,e,t){return qc.verify(e,t instanceof Uint8Array?t:t.subarray(),r)}var Hn=class{type="Ed25519";raw;constructor(e){this.raw=uo(e,Vn)}toMultihash(){return dt.digest(Dt(this))}toCID(){return me.createV1(114,this.toMultihash())}toString(){return Q.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:ge(this.raw,e.raw)}verify(e,t){return zc(this.raw,t,e)}};function fo(r){return r=uo(r,Vn),new Hn(r)}function uo(r,e){if(r=Uint8Array.from(r??[]),r.length!==e)throw new Ee(`Key must be a Uint8Array of length ${e}, got ${r.length}`);return r}function oe(r=0){return new Uint8Array(r)}function De(r=0){return new Uint8Array(r)}var Id=Math.pow(2,7),Td=Math.pow(2,14),kd=Math.pow(2,21),ho=Math.pow(2,28),po=Math.pow(2,35),mo=Math.pow(2,42),go=Math.pow(2,49),Z=128,Se=127;function Ae(r){if(r<Id)return 1;if(r<Td)return 2;if(r<kd)return 3;if(r<ho)return 4;if(r<po)return 5;if(r<mo)return 6;if(r<go)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function yo(r,e,t=0){switch(Ae(r)){case 8:e[t++]=r&255|Z,r/=128;case 7:e[t++]=r&255|Z,r/=128;case 6:e[t++]=r&255|Z,r/=128;case 5:e[t++]=r&255|Z,r/=128;case 4:e[t++]=r&255|Z,r>>>=7;case 3:e[t++]=r&255|Z,r>>>=7;case 2:e[t++]=r&255|Z,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function Cd(r,e,t=0){switch(Ae(r)){case 8:e.set(t++,r&255|Z),r/=128;case 7:e.set(t++,r&255|Z),r/=128;case 6:e.set(t++,r&255|Z),r/=128;case 5:e.set(t++,r&255|Z),r/=128;case 4:e.set(t++,r&255|Z),r>>>=7;case 3:e.set(t++,r&255|Z),r>>>=7;case 2:e.set(t++,r&255|Z),r>>>=7;case 1:{e.set(t++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function bo(r,e){let t=r[e],n=0;if(n+=t&Se,t<Z||(t=r[e+1],n+=(t&Se)<<7,t<Z)||(t=r[e+2],n+=(t&Se)<<14,t<Z)||(t=r[e+3],n+=(t&Se)<<21,t<Z)||(t=r[e+4],n+=(t&Se)*ho,t<Z)||(t=r[e+5],n+=(t&Se)*po,t<Z)||(t=r[e+6],n+=(t&Se)*mo,t<Z)||(t=r[e+7],n+=(t&Se)*go,t<Z))return n;throw new RangeError("Could not decode varint")}function Nd(r,e){let t=r.get(e),n=0;if(n+=t&Se,t<Z||(t=r.get(e+1),n+=(t&Se)<<7,t<Z)||(t=r.get(e+2),n+=(t&Se)<<14,t<Z)||(t=r.get(e+3),n+=(t&Se)<<21,t<Z)||(t=r.get(e+4),n+=(t&Se)*ho,t<Z)||(t=r.get(e+5),n+=(t&Se)*po,t<Z)||(t=r.get(e+6),n+=(t&Se)*mo,t<Z)||(t=r.get(e+7),n+=(t&Se)*go,t<Z))return n;throw new RangeError("Could not decode varint")}function $e(r,e,t=0){return e==null&&(e=De(Ae(r))),e instanceof Uint8Array?yo(r,e,t):Cd(r,e,t)}function bt(r,e=0){return r instanceof Uint8Array?bo(r,e):Nd(r,e)}var wo=new Float32Array([-0]),Ot=new Uint8Array(wo.buffer);function Gc(r,e,t){wo[0]=r,e[t]=Ot[0],e[t+1]=Ot[1],e[t+2]=Ot[2],e[t+3]=Ot[3]}function Wc(r,e){return Ot[0]=r[e],Ot[1]=r[e+1],Ot[2]=r[e+2],Ot[3]=r[e+3],wo[0]}var xo=new Float64Array([-0]),Be=new Uint8Array(xo.buffer);function Zc(r,e,t){xo[0]=r,e[t]=Be[0],e[t+1]=Be[1],e[t+2]=Be[2],e[t+3]=Be[3],e[t+4]=Be[4],e[t+5]=Be[5],e[t+6]=Be[6],e[t+7]=Be[7]}function jc(r,e){return Be[0]=r[e],Be[1]=r[e+1],Be[2]=r[e+2],Be[3]=r[e+3],Be[4]=r[e+4],Be[5]=r[e+5],Be[6]=r[e+6],Be[7]=r[e+7],xo[0]}var Rd=BigInt(Number.MAX_SAFE_INTEGER),Ld=BigInt(Number.MIN_SAFE_INTEGER),He=class r{lo;hi;constructor(e,t){this.lo=e|0,this.hi=t|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(BigInt(t)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return Jt;if(e<Rd&&e>Ld)return this.fromNumber(Number(e));let t=e<0n;t&&(e=-e);let n=e>>32n,s=e-(n<<32n);return t&&(n=~n|0n,s=~s|0n,++s>Yc&&(s=0n,++n>Yc&&(n=0n))),new r(Number(s),Number(n))}static fromNumber(e){if(e===0)return Jt;let t=e<0;t&&(e=-e);let n=e>>>0,s=(e-n)/4294967296>>>0;return t&&(s=~s>>>0,n=~n>>>0,++n>4294967295&&(n=0,++s>4294967295&&(s=0))),new r(n,s)}static from(e){return typeof e=="number"?r.fromNumber(e):typeof e=="bigint"?r.fromBigInt(e):typeof e=="string"?r.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new r(e.low>>>0,e.high>>>0):Jt}},Jt=new He(0,0);Jt.toBigInt=function(){return 0n};Jt.zzEncode=Jt.zzDecode=function(){return this};Jt.length=function(){return 1};var Yc=4294967296n;function Xc(r){let e=0,t=0;for(let n=0;n<r.length;++n)t=r.charCodeAt(n),t<128?e+=1:t<2048?e+=2:(t&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function Jc(r,e,t){if(t-e<1)return"";let s,i=[],o=0,a;for(;e<t;)a=r[e++],a<128?i[o++]=a:a>191&&a<224?i[o++]=(a&31)<<6|r[e++]&63:a>239&&a<365?(a=((a&7)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,i[o++]=55296+(a>>10),i[o++]=56320+(a&1023)):i[o++]=(a&15)<<12|(r[e++]&63)<<6|r[e++]&63,o>8191&&((s??(s=[])).push(String.fromCharCode.apply(String,i)),o=0);return s!=null?(o>0&&s.push(String.fromCharCode.apply(String,i.slice(0,o))),s.join("")):String.fromCharCode.apply(String,i.slice(0,o))}function vo(r,e,t){let n=t,s,i;for(let o=0;o<r.length;++o)s=r.charCodeAt(o),s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&((i=r.charCodeAt(o+1))&64512)===56320?(s=65536+((s&1023)<<10)+(i&1023),++o,e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128);return t-n}function Je(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function Kn(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}var Eo=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Je(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw Je(this,4);return Kn(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw Je(this,4);return Kn(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw Je(this,4);let e=Wc(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw Je(this,4);let e=jc(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw Je(this,e);return this.pos+=e,t===n?new Uint8Array(0):this.buf.subarray(t,n)}string(){let e=this.bytes();return Jc(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Je(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Je(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new He(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Je(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw Je(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw Je(this,8);let e=Kn(this.buf,this.pos+=4),t=Kn(this.buf,this.pos+=4);return new He(e,t)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=bo(this.buf,this.pos);return this.pos+=Ae(e),e}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 So(r){return new Eo(r instanceof Uint8Array?r:r.subarray())}function Oe(r,e,t){let n=So(r);return e.decode(n,void 0,t)}var Ao={};ke(Ao,{base10:()=>Ud});var Ud=Tt({prefix:"9",name:"base10",alphabet:"0123456789"});var Bo={};ke(Bo,{base16:()=>Dd,base16upper:()=>Od});var Dd=ae({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Od=ae({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var _o={};ke(_o,{base2:()=>Md});var Md=ae({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Io={};ke(Io,{base256emoji:()=>Kd});var el=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}"),Pd=el.reduce((r,e,t)=>(r[t]=e,r),[]),Vd=el.reduce((r,e,t)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return r[n]=t,r},[]);function Hd(r){return r.reduce((e,t)=>(e+=Pd[t],e),"")}function Fd(r){let e=[];for(let t of r){let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);let s=Vd[n];if(s==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(s)}return new Uint8Array(e)}var Kd=lr({prefix:"\u{1F680}",name:"base256emoji",encode:Hd,decode:Fd});var ko={};ke(ko,{base64:()=>qd,base64pad:()=>zd,base64url:()=>To,base64urlpad:()=>$d});var qd=ae({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zd=ae({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),To=ae({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),$d=ae({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Co={};ke(Co,{base8:()=>Gd});var Gd=ae({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var No={};ke(No,{identity:()=>Wd});var Wd=lr({prefix:"\0",name:"identity",encode:r=>fc(r),decode:r=>uc(r)});var Dg=new TextEncoder,Og=new TextDecoder;var Uo={};ke(Uo,{sha256:()=>br,sha512:()=>Yd});function Lo({name:r,code:e,encode:t}){return new Ro(r,e,t)}var Ro=class{name;code;encode;constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Ze(this.code,t):t.then(n=>Ze(this.code,n))}else throw Error("Unknown type, must be binary type")}};function rl(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var br=Lo({name:"sha2-256",code:18,encode:rl("SHA-256")}),Yd=Lo({name:"sha2-512",code:19,encode:rl("SHA-512")});var Zr={...No,..._o,...Co,...Ao,...Bo,...qi,...zi,...Ki,...ko,...Io},Zg={...Uo,...Wi};function sl(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var nl=sl("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Do=sl("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=De(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Xd={utf8:nl,"utf-8":nl,hex:Zr.base16,latin1:Do,ascii:Do,binary:Do,...Zr},qn=Xd;function G(r,e="utf8"){let t=qn[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function Oo(r){let e=r??8192,t=e>>>1,n,s=e;return function(o){if(o<1||o>t)return De(o);s+o>e&&(n=De(e),s=0);let a=n.subarray(s,s+=o);return s&7&&(s=(s|7)+1),a}}var Qt=class{fn;len;next;val;constructor(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}};function Mo(){}var Vo=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Jd=Oo();function Qd(r){return globalThis.Buffer!=null?De(r):Jd(r)}var Yr=class{len;head;tail;states;constructor(){this.len=0,this.head=new Qt(Mo,0,0),this.tail=this.head,this.states=null}_push(e,t,n){return this.tail=this.tail.next=new Qt(e,t,n),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new Ho((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(zn,10,He.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=He.fromBigInt(e);return this._push(zn,t.length(),t)}uint64Number(e){return this._push(yo,Ae(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let t=He.fromBigInt(e).zzEncode();return this._push(zn,t.length(),t)}sint64Number(e){let t=He.fromNumber(e).zzEncode();return this._push(zn,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(Po,1,e?1:0)}fixed32(e){return this._push(jr,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=He.fromBigInt(e);return this._push(jr,4,t.lo)._push(jr,4,t.hi)}fixed64Number(e){let t=He.fromNumber(e);return this._push(jr,4,t.lo)._push(jr,4,t.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(Gc,4,e)}double(e){return this._push(Zc,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(Po,1,0):this.uint32(t)._push(tp,t,e)}string(e){let t=Xc(e);return t!==0?this.uint32(t)._push(vo,t,e):this._push(Po,1,0)}fork(){return this.states=new Vo(this),this.head=this.tail=new Qt(Mo,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 Qt(Mo,0,0),this.len=0),this}ldelim(){let e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=t,this.len+=n),this}finish(){let e=this.head.next,t=Qd(this.len),n=0;for(;e!=null;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t}};function Po(r,e,t){e[t]=r&255}function ep(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}var Ho=class extends Qt{next;constructor(e,t){super(ep,e,t),this.next=void 0}};function zn(r,e,t){for(;r.hi!==0;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}function jr(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function tp(r,e,t){e.set(r,t)}globalThis.Buffer!=null&&(Yr.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(rp,e,r),this},Yr.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(np,e,r),this});function rp(r,e,t){e.set(r,t)}function np(r,e,t){r.length<40?vo(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(G(r),t)}function Fo(){return new Yr}function Me(r,e){let t=Fo();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var wr;(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"})(wr||(wr={}));function $n(r,e,t,n){return{name:r,type:e,encode:t,decode:n}}function er(r){function e(s){if(r[s.toString()]==null)throw new Error("Invalid enum value");return r[s]}let t=function(i,o){let a=e(i);o.int32(a)},n=function(i){let o=i.int32();return e(o)};return $n("enum",wr.VARINT,t,n)}function Pe(r,e){return $n("message",wr.LENGTH_DELIMITED,r,e)}var Xr=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"};var he;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1"})(he||(he={}));var Ko;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1"})(Ko||(Ko={}));(function(r){r.codec=()=>er(Ko)})(he||(he={}));var it;(function(r){let e;r.codec=()=>(e==null&&(e=Pe((t,n,s={})=>{s.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),he.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),s.lengthDelimited!==!1&&n.ldelim()},(t,n,s={})=>{let i={},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{i.Type=he.codec().decode(t);break}case 2:{i.Data=t.bytes();break}default:{t.skipType(a&7);break}}}return i})),e),r.encode=t=>Me(t,r.codec()),r.decode=(t,n)=>Oe(t,r.codec(),n)})(it||(it={}));var qo;(function(r){let e;r.codec=()=>(e==null&&(e=Pe((t,n,s={})=>{s.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),he.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),s.lengthDelimited!==!1&&n.ldelim()},(t,n,s={})=>{let i={},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{i.Type=he.codec().decode(t);break}case 2:{i.Data=t.bytes();break}default:{t.skipType(a&7);break}}}return i})),e),r.encode=t=>Me(t,r.codec()),r.decode=(t,n)=>Oe(t,r.codec(),n)})(qo||(qo={}));var cn={};ke(cn,{MAX_RSA_KEY_SIZE:()=>Os,generateRSAKeyPair:()=>tu,jwkToJWKKeyPair:()=>ru,jwkToPkcs1:()=>wp,jwkToPkix:()=>Jo,jwkToRSAPrivateKey:()=>eu,pkcs1ToJwk:()=>Xl,pkcs1ToRSAPrivateKey:()=>Ql,pkixToJwk:()=>Jl,pkixToRSAPublicKey:()=>Qo});var sp=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]),Mt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Pt=new Uint32Array(64),zo=class extends gr{constructor(){super(64,32,8,!1),this.A=Mt[0]|0,this.B=Mt[1]|0,this.C=Mt[2]|0,this.D=Mt[3]|0,this.E=Mt[4]|0,this.F=Mt[5]|0,this.G=Mt[6]|0,this.H=Mt[7]|0}get(){let{A:e,B:t,C:n,D:s,E:i,F:o,G:a,H:c}=this;return[e,t,n,s,i,o,a,c]}set(e,t,n,s,i,o,a,c){this.A=e|0,this.B=t|0,this.C=n|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,t){for(let u=0;u<16;u++,t+=4)Pt[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){let g=Pt[u-15],l=Pt[u-2],d=je(g,7)^je(g,18)^g>>>3,p=je(l,17)^je(l,19)^l>>>10;Pt[u]=p+Pt[u-7]+d+Pt[u-16]|0}let{A:n,B:s,C:i,D:o,E:a,F:c,G:h,H:f}=this;for(let u=0;u<64;u++){let g=je(a,6)^je(a,11)^je(a,25),l=f+g+Tc(a,c,h)+sp[u]+Pt[u]|0,p=(je(n,2)^je(n,13)^je(n,22))+kc(n,s,i)|0;f=h,h=c,c=a,a=o+l|0,o=i,i=s,s=n,n=l+p|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(n,s,i,o,a,c,h,f)}roundClean(){Pt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var xr=Cn(()=>new zo);var z=tc(ol());function tr(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}function Vt(r,e,t=-1){let n=t,s=r,i=0,o=Math.pow(2,e);for(let a=1;a<8;a++){if(r<o){let c;if(n<0)c=new ArrayBuffer(a),i=a;else{if(n<a)return new ArrayBuffer(0);c=new ArrayBuffer(n),i=n}let h=new Uint8Array(c);for(let f=a-1;f>=0;f--){let u=Math.pow(2,f*e);h[i-f-1]=Math.floor(s/u),s-=h[i-f-1]*u}return c}o*=Math.pow(2,e)}return new ArrayBuffer(0)}function Zn(...r){let e=0,t=0;for(let i of r)e+=i.length;let n=new ArrayBuffer(e),s=new Uint8Array(n);for(let i of r)s.set(i,t),t+=i.length;return s}function Go(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let a=r[0]===255&&r[1]&128,c=r[0]===0&&(r[1]&128)===0;(a||c)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let a=0;a<this.valueHex.byteLength;a++)t[a]=0;t[0]=r[0]&128;let n=tr(t,8),s=new ArrayBuffer(this.valueHex.byteLength),i=new Uint8Array(s);for(let a=0;a<this.valueHex.byteLength;a++)i[a]=r[a];return i[0]&=127,tr(i,8)-n}function al(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let o=t-e,a=Vt(o,8,n),c=new Uint8Array(a);return c[0]|=128,a}let s=Vt(e,8,n),i=new Uint8Array(s);if(i[0]&128){let o=s.slice(0),a=new Uint8Array(o);s=new ArrayBuffer(s.byteLength+1),i=new Uint8Array(s);for(let c=0;c<o.byteLength;c++)i[c+1]=a[c];i[0]=0}return s}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function cl(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<t.length;s++)if(t[s]!==n[s])return!1;return!0}function Ve(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,s=new Array(n);for(let o=0;o<n;o++)s[o]="0";return s.join("").concat(t)}var ky=Math.log(2);function jn(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Wo(r){let e=0,t=0;for(let s=0;s<r.length;s++){let i=r[s];e+=i.byteLength}let n=new Uint8Array(e);for(let s=0;s<r.length;s++){let i=r[s];n.set(new Uint8Array(i),t),t+=i.byteLength}return n.buffer}function St(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}var Qr=class{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Wo(this.items)}},Jr=[new Uint8Array([1])],ll="0123456789";var Br="",Qe=new ArrayBuffer(0),Zo=new Uint8Array(0),en="EndOfContent",fl="OCTET STRING",hl="BIT STRING";function At(r){var e;return e=class extends r{constructor(...n){var s;super(...n);let i=n[0]||{};this.isHexOnly=(s=i.isHexOnly)!==null&&s!==void 0?s:!1,this.valueHexView=i.valueHex?z.BufferSourceConverter.toUint8Array(i.valueHex):Zo}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,s,i){let o=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!St(this,o,s,i))return-1;let a=s+i;return this.valueHexView=o.subarray(s,a),this.valueHexView.length?(this.blockLength=i,a):(this.warnings.push("Zero buffer length"),s)}toBER(n=!1){return this.isHexOnly?n?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",Qe)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:z.Convert.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}var xt=class{constructor({blockLength:e=0,error:t=Br,warnings:n=[],valueBeforeDecode:s=Zo}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=z.BufferSourceConverter.toUint8Array(s)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:z.Convert.ToHex(this.valueBeforeDecodeView)}}};xt.NAME="baseBlock";var _e=class extends xt{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};_e.NAME="valueBlock";var Yn=class extends At(xt){constructor({idBlock:e={}}={}){var t,n,s,i;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?z.BufferSourceConverter.toUint8Array(e.valueHex):Zo,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(s=e.tagNumber)!==null&&s!==void 0?s:-1,this.isConstructed=(i=e.isConstructed)!==null&&i!==void 0?i:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",Qe}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let s=new Uint8Array(1);if(!e){let i=this.tagNumber;i&=31,t|=i,s[0]=t}return s.buffer}if(!this.isHexOnly){let s=Vt(this.tagNumber,7),i=new Uint8Array(s),o=s.byteLength,a=new Uint8Array(o+1);if(a[0]=t|31,!e){for(let c=0;c<o-1;c++)a[c+1]=i[c]|128;a[o]=i[o-1]}return a.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let s=this.valueHexView;for(let i=0;i<s.length-1;i++)n[i+1]=s[i]|128;n[this.valueHexView.byteLength]=s[s.length-1]}return n.buffer}fromBER(e,t,n){let s=z.BufferSourceConverter.toUint8Array(e);if(!St(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;switch(i[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(i[0]&32)===32,this.isHexOnly=!1;let a=i[0]&31;if(a!==31)this.tagNumber=a,this.blockLength=1;else{let c=1,h=this.valueHexView=new Uint8Array(255),f=255;for(;i[c]&128;){if(h[c-1]=i[c]&127,c++,c>=i.length)return this.error="End of input reached before message was fully decoded",-1;if(c===f){f+=255;let g=new Uint8Array(f);for(let l=0;l<h.length;l++)g[l]=h[l];h=this.valueHexView=new Uint8Array(f)}}this.blockLength=c+1,h[c-1]=i[c]&127;let u=new Uint8Array(c);for(let g=0;g<c;g++)u[g]=h[g];h=this.valueHexView=new Uint8Array(c),h.set(u),this.blockLength<=9?this.tagNumber=tr(h,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};Yn.NAME="identificationBlock";var Xn=class extends xt{constructor({lenBlock:e={}}={}){var t,n,s;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(s=e.length)!==null&&s!==void 0?s:0}fromBER(e,t,n){let s=z.BufferSourceConverter.toUint8Array(e);if(!St(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;if(i[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=i[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(i[0]&128),this.longFormUsed===!1)return this.length=i[0],this.blockLength=1,t+this.blockLength;let o=i[0]&127;if(o>8)return this.error="Too big integer",-1;if(o+1>i.length)return this.error="End of input reached before message was fully decoded",-1;let a=t+1,c=s.subarray(a,a+o);return c[o-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=tr(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let s=Vt(this.length,8);if(s.byteLength>127)return this.error="Too big length",Qe;if(t=new ArrayBuffer(s.byteLength+1),e)return t;let i=new Uint8Array(s);n=new Uint8Array(t),n[0]=s.byteLength|128;for(let o=0;o<s.byteLength;o++)n[o+1]=i[o];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};Xn.NAME="lengthBlock";var k={},we=class extends xt{constructor({name:e=Br,optional:t=!1,primitiveSchema:n,...s}={},i){super(s),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new Yn(s),this.lenBlock=new Xn(s),this.valueBlock=i?new i(s):new _e(s)}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}toBER(e,t){let n=t||new Qr;t||dl(this);let s=this.idBlock.toBER(e);if(n.write(s),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let i=this.valueBlock.toBER(e);this.lenBlock.length=i.byteLength;let o=this.lenBlock.toBER(e);n.write(o),n.write(i)}return t?Qe:n.final()}toJSON(){let e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():z.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${z.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return cl(t,n)}};we.NAME="BaseBlock";function dl(r){if(r instanceof k.Constructed)for(let e of r.valueBlock.value)dl(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}var Jn=class extends we{constructor({value:e=Br,...t}={},n){super(t,n),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};Jn.NAME="BaseStringBlock";var Qn=class extends At(_e){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}};Qn.NAME="PrimitiveValueBlock";var pl,es=class extends we{constructor(e={}){super(e,Qn),this.idBlock.isConstructed=!1}};pl=es;k.Primitive=pl;es.NAME="PRIMITIVE";function dp(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}function Us(r,e=0,t=r.length){let n=e,s=new we({},_e),i=new xt;if(!St(i,r,e,t))return s.error=i.error,{offset:-1,result:s};if(!r.subarray(e,e+t).length)return s.error="Zero buffer length",{offset:-1,result:s};let a=s.idBlock.fromBER(r,e,t);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),a===-1)return s.error=s.idBlock.error,{offset:-1,result:s};if(e=a,t-=s.idBlock.blockLength,a=s.lenBlock.fromBER(r,e,t),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),a===-1)return s.error=s.lenBlock.error,{offset:-1,result:s};if(e=a,t-=s.lenBlock.blockLength,!s.idBlock.isConstructed&&s.lenBlock.isIndefiniteForm)return s.error="Indefinite length form used for primitive encoding form",{offset:-1,result:s};let c=we;switch(s.idBlock.tagClass){case 1:if(s.idBlock.tagNumber>=37&&s.idBlock.isHexOnly===!1)return s.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:s};switch(s.idBlock.tagNumber){case 0:if(s.idBlock.isConstructed&&s.lenBlock.length>0)return s.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:s};c=k.EndOfContent;break;case 1:c=k.Boolean;break;case 2:c=k.Integer;break;case 3:c=k.BitString;break;case 4:c=k.OctetString;break;case 5:c=k.Null;break;case 6:c=k.ObjectIdentifier;break;case 10:c=k.Enumerated;break;case 12:c=k.Utf8String;break;case 13:c=k.RelativeObjectIdentifier;break;case 14:c=k.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:c=k.Sequence;break;case 17:c=k.Set;break;case 18:c=k.NumericString;break;case 19:c=k.PrintableString;break;case 20:c=k.TeletexString;break;case 21:c=k.VideotexString;break;case 22:c=k.IA5String;break;case 23:c=k.UTCTime;break;case 24:c=k.GeneralizedTime;break;case 25:c=k.GraphicString;break;case 26:c=k.VisibleString;break;case 27:c=k.GeneralString;break;case 28:c=k.UniversalString;break;case 29:c=k.CharacterString;break;case 30:c=k.BmpString;break;case 31:c=k.DATE;break;case 32:c=k.TimeOfDay;break;case 33:c=k.DateTime;break;case 34:c=k.Duration;break;default:{let h=s.idBlock.isConstructed?new k.Constructed:new k.Primitive;h.idBlock=s.idBlock,h.lenBlock=s.lenBlock,h.warnings=s.warnings,s=h}}break;case 2:case 3:case 4:default:c=s.idBlock.isConstructed?k.Constructed:k.Primitive}return s=dp(s,c),a=s.fromBER(r,e,s.lenBlock.isIndefiniteForm?t:s.lenBlock.length),s.valueBeforeDecodeView=r.subarray(n,n+s.blockLength),{offset:a,result:s}}function jo(r){if(!r.byteLength){let e=new we({},_e);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Us(z.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}function pp(r,e){return r?1:e}var ot=class extends _e{constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let s=z.BufferSourceConverter.toUint8Array(e);if(!St(this,s,t,n))return-1;if(this.valueBeforeDecodeView=s.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let i=t;for(;pp(this.isIndefiniteForm,n)>0;){let o=Us(s,i,n);if(o.offset===-1)return this.error=o.result.error,this.warnings.concat(o.result.warnings),-1;if(i=o.offset,this.blockLength+=o.result.blockLength,n-=o.result.blockLength,this.value.push(o.result),this.isIndefiniteForm&&o.result.constructor.NAME===en)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===en?this.value.pop():this.warnings.push("No EndOfContent block encoded")),i}toBER(e,t){let n=t||new Qr;for(let s=0;s<this.value.length;s++)this.value[s].toBER(e,n);return t?Qe:n.final()}toJSON(){let e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let t of this.value)e.value.push(t.toJSON());return e}};ot.NAME="ConstructedValueBlock";var ml,Ht=class extends we{constructor(e={}){super(e,ot),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
2
+ "use strict";var Libp2PCircuitRelayV2=(()=>{var Nf=Object.create;var Bn=Object.defineProperty;var Rf=Object.getOwnPropertyDescriptor;var Lf=Object.getOwnPropertyNames;var Uf=Object.getPrototypeOf,Df=Object.prototype.hasOwnProperty;var Di=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ke=(r,e)=>{for(var t in e)Bn(r,t,{get:e[t],enumerable:!0})},ec=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Lf(e))!Df.call(r,s)&&s!==t&&Bn(r,s,{get:()=>e[s],enumerable:!(n=Rf(e,s))||n.enumerable});return r};var tc=(r,e,t)=>(t=r!=null?Nf(Uf(r)):{},ec(e||!r||!r.__esModule?Bn(t,"default",{value:r,enumerable:!0}):t,r)),Of=r=>ec(Bn({},"__esModule",{value:!0}),r);var ol=Di(vr=>{"use strict";var ip="[object ArrayBuffer]",wt=class r{static isArrayBuffer(e){return Object.prototype.toString.call(e)===ip}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=r.toUint8Array(e),s=r.toUint8Array(t);if(n.length!==s.byteLength)return!1;for(let i=0;i<n.length;i++)if(n[i]!==s[i])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let n=0;for(let o of t)n+=o.byteLength;let s=new Uint8Array(n),i=0;for(let o of t){let a=this.toUint8Array(o);s.set(a,i),i+=a.length}return e[e.length-1]instanceof Function?this.toView(s,e[e.length-1]):s.buffer}},$o="string",op=/^[0-9a-f\s]+$/i,ap=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,cp=/^[a-zA-Z0-9-_]+$/,Gn=class{static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n.buffer}static toString(e){let t=wt.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return decodeURIComponent(escape(n))}},Ge=class{static toString(e,t=!1){let n=wt.toArrayBuffer(e),s=new DataView(n),i="";for(let o=0;o<n.byteLength;o+=2){let a=s.getUint16(o,t);i+=String.fromCharCode(a)}return i}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),s=new DataView(n);for(let i=0;i<e.length;i++)s.setUint16(i*2,e.charCodeAt(i),t);return n}},Wn=class r{static isHex(e){return typeof e===$o&&op.test(e)}static isBase64(e){return typeof e===$o&&ap.test(e)}static isBase64Url(e){return typeof e===$o&&cp.test(e)}static ToString(e,t="utf8"){let n=wt.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return Ge.toString(n,!0);case"utf16":case"utf16be":return Ge.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return Ge.fromString(e,!0);case"utf16":case"utf16be":return Ge.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=wt.toUint8Array(e);if(typeof btoa<"u"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return Gn.fromString(e);case"utf16":case"utf16be":return Ge.fromString(e);case"utf16le":case"usc2":return Ge.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return Gn.toString(e);case"utf16":case"utf16be":return Ge.toString(e);case"utf16le":case"usc2":return Ge.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);return n.buffer}static ToBinary(e){let t=wt.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return n}static ToHex(e){let t=wt.toUint8Array(e),n="",s=t.length;for(let i=0;i<s;i++){let o=t[i];o<16&&(n+="0"),n+=o.toString(16)}return n}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let s=0;s<t.length;s=s+2){let i=t.slice(s,s+2);n[s/2]=parseInt(i,16)}return n.buffer}static ToUtf16String(e,t=!1){return Ge.toString(e,t)}static FromUtf16String(e,t=!1){return Ge.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return e?.replace(/[\n\r\t ]/g,"")||""}};Wn.DEFAULT_UTF8_ENCODING="utf8";function lp(r,...e){let t=arguments[0];for(let n=1;n<arguments.length;n++){let s=arguments[n];for(let i in s)t[i]=s[i]}return t}function up(...r){let e=r.map(s=>s.byteLength).reduce((s,i)=>s+i),t=new Uint8Array(e),n=0;return r.map(s=>new Uint8Array(s)).forEach(s=>{for(let i of s)t[n++]=i}),t.buffer}function fp(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<r.byteLength;s++)if(t[s]!==n[s])return!1;return!0}vr.BufferSourceConverter=wt;vr.Convert=Wn;vr.assign=lp;vr.combine=up;vr.isEqual=fp});var tf=Di((En,xi)=>{(function(r,e){"use strict";var t={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(l){if(!Array.isArray(l)&&!ArrayBuffer.isView(l))return!1;for(var d=0;d<l.length;d++)if(!Number.isInteger(l[d])||l[d]<0||l[d]>255)return!1;return!0}function s(l,d){return(l&65535)*d+(((l>>>16)*d&65535)<<16)}function i(l,d){return l<<d|l>>>32-d}function o(l){return l^=l>>>16,l=s(l,2246822507),l^=l>>>13,l=s(l,3266489909),l^=l>>>16,l}function a(l,d){l=[l[0]>>>16,l[0]&65535,l[1]>>>16,l[1]&65535],d=[d[0]>>>16,d[0]&65535,d[1]>>>16,d[1]&65535];var p=[0,0,0,0];return p[3]+=l[3]+d[3],p[2]+=p[3]>>>16,p[3]&=65535,p[2]+=l[2]+d[2],p[1]+=p[2]>>>16,p[2]&=65535,p[1]+=l[1]+d[1],p[0]+=p[1]>>>16,p[1]&=65535,p[0]+=l[0]+d[0],p[0]&=65535,[p[0]<<16|p[1],p[2]<<16|p[3]]}function c(l,d){l=[l[0]>>>16,l[0]&65535,l[1]>>>16,l[1]&65535],d=[d[0]>>>16,d[0]&65535,d[1]>>>16,d[1]&65535];var p=[0,0,0,0];return p[3]+=l[3]*d[3],p[2]+=p[3]>>>16,p[3]&=65535,p[2]+=l[2]*d[3],p[1]+=p[2]>>>16,p[2]&=65535,p[2]+=l[3]*d[2],p[1]+=p[2]>>>16,p[2]&=65535,p[1]+=l[1]*d[3],p[0]+=p[1]>>>16,p[1]&=65535,p[1]+=l[2]*d[2],p[0]+=p[1]>>>16,p[1]&=65535,p[1]+=l[3]*d[1],p[0]+=p[1]>>>16,p[1]&=65535,p[0]+=l[0]*d[3]+l[1]*d[2]+l[2]*d[1]+l[3]*d[0],p[0]&=65535,[p[0]<<16|p[1],p[2]<<16|p[3]]}function h(l,d){return d%=64,d===32?[l[1],l[0]]:d<32?[l[0]<<d|l[1]>>>32-d,l[1]<<d|l[0]>>>32-d]:(d-=32,[l[1]<<d|l[0]>>>32-d,l[0]<<d|l[1]>>>32-d])}function f(l,d){return d%=64,d===0?l:d<32?[l[0]<<d|l[1]>>>32-d,l[1]<<d]:[l[1]<<d-32,0]}function u(l,d){return[l[0]^d[0],l[1]^d[1]]}function g(l){return l=u(l,[0,l[0]>>>1]),l=c(l,[4283543511,3981806797]),l=u(l,[0,l[0]>>>1]),l=c(l,[3301882366,444984403]),l=u(l,[0,l[0]>>>1]),l}t.x86.hash32=function(l,d){if(t.inputValidation&&!n(l))return e;d=d||0;for(var p=l.length%4,y=l.length-p,b=d,w=0,m=3432918353,v=461845907,A=0;A<y;A=A+4)w=l[A]|l[A+1]<<8|l[A+2]<<16|l[A+3]<<24,w=s(w,m),w=i(w,15),w=s(w,v),b^=w,b=i(b,13),b=s(b,5)+3864292196;switch(w=0,p){case 3:w^=l[A+2]<<16;case 2:w^=l[A+1]<<8;case 1:w^=l[A],w=s(w,m),w=i(w,15),w=s(w,v),b^=w}return b^=l.length,b=o(b),b>>>0},t.x86.hash128=function(l,d){if(t.inputValidation&&!n(l))return e;d=d||0;for(var p=l.length%16,y=l.length-p,b=d,w=d,m=d,v=d,A=0,_=0,x=0,B=0,C=597399067,ne=2869860233,P=951274213,M=2716044179,L=0;L<y;L=L+16)A=l[L]|l[L+1]<<8|l[L+2]<<16|l[L+3]<<24,_=l[L+4]|l[L+5]<<8|l[L+6]<<16|l[L+7]<<24,x=l[L+8]|l[L+9]<<8|l[L+10]<<16|l[L+11]<<24,B=l[L+12]|l[L+13]<<8|l[L+14]<<16|l[L+15]<<24,A=s(A,C),A=i(A,15),A=s(A,ne),b^=A,b=i(b,19),b+=w,b=s(b,5)+1444728091,_=s(_,ne),_=i(_,16),_=s(_,P),w^=_,w=i(w,17),w+=m,w=s(w,5)+197830471,x=s(x,P),x=i(x,17),x=s(x,M),m^=x,m=i(m,15),m+=v,m=s(m,5)+2530024501,B=s(B,M),B=i(B,18),B=s(B,C),v^=B,v=i(v,13),v+=b,v=s(v,5)+850148119;switch(A=0,_=0,x=0,B=0,p){case 15:B^=l[L+14]<<16;case 14:B^=l[L+13]<<8;case 13:B^=l[L+12],B=s(B,M),B=i(B,18),B=s(B,C),v^=B;case 12:x^=l[L+11]<<24;case 11:x^=l[L+10]<<16;case 10:x^=l[L+9]<<8;case 9:x^=l[L+8],x=s(x,P),x=i(x,17),x=s(x,M),m^=x;case 8:_^=l[L+7]<<24;case 7:_^=l[L+6]<<16;case 6:_^=l[L+5]<<8;case 5:_^=l[L+4],_=s(_,ne),_=i(_,16),_=s(_,P),w^=_;case 4:A^=l[L+3]<<24;case 3:A^=l[L+2]<<16;case 2:A^=l[L+1]<<8;case 1:A^=l[L],A=s(A,C),A=i(A,15),A=s(A,ne),b^=A}return b^=l.length,w^=l.length,m^=l.length,v^=l.length,b+=w,b+=m,b+=v,w+=b,m+=b,v+=b,b=o(b),w=o(w),m=o(m),v=o(v),b+=w,b+=m,b+=v,w+=b,m+=b,v+=b,("00000000"+(b>>>0).toString(16)).slice(-8)+("00000000"+(w>>>0).toString(16)).slice(-8)+("00000000"+(m>>>0).toString(16)).slice(-8)+("00000000"+(v>>>0).toString(16)).slice(-8)},t.x64.hash128=function(l,d){if(t.inputValidation&&!n(l))return e;d=d||0;for(var p=l.length%16,y=l.length-p,b=[0,d],w=[0,d],m=[0,0],v=[0,0],A=[2277735313,289559509],_=[1291169091,658871167],x=0;x<y;x=x+16)m=[l[x+4]|l[x+5]<<8|l[x+6]<<16|l[x+7]<<24,l[x]|l[x+1]<<8|l[x+2]<<16|l[x+3]<<24],v=[l[x+12]|l[x+13]<<8|l[x+14]<<16|l[x+15]<<24,l[x+8]|l[x+9]<<8|l[x+10]<<16|l[x+11]<<24],m=c(m,A),m=h(m,31),m=c(m,_),b=u(b,m),b=h(b,27),b=a(b,w),b=a(c(b,[0,5]),[0,1390208809]),v=c(v,_),v=h(v,33),v=c(v,A),w=u(w,v),w=h(w,31),w=a(w,b),w=a(c(w,[0,5]),[0,944331445]);switch(m=[0,0],v=[0,0],p){case 15:v=u(v,f([0,l[x+14]],48));case 14:v=u(v,f([0,l[x+13]],40));case 13:v=u(v,f([0,l[x+12]],32));case 12:v=u(v,f([0,l[x+11]],24));case 11:v=u(v,f([0,l[x+10]],16));case 10:v=u(v,f([0,l[x+9]],8));case 9:v=u(v,[0,l[x+8]]),v=c(v,_),v=h(v,33),v=c(v,A),w=u(w,v);case 8:m=u(m,f([0,l[x+7]],56));case 7:m=u(m,f([0,l[x+6]],48));case 6:m=u(m,f([0,l[x+5]],40));case 5:m=u(m,f([0,l[x+4]],32));case 4:m=u(m,f([0,l[x+3]],24));case 3:m=u(m,f([0,l[x+2]],16));case 2:m=u(m,f([0,l[x+1]],8));case 1:m=u(m,[0,l[x]]),m=c(m,A),m=h(m,31),m=c(m,_),b=u(b,m)}return b=u(b,[0,l.length]),w=u(w,[0,l.length]),b=a(b,w),w=a(w,b),b=g(b),w=g(w),b=a(b,w),w=a(w,b),("00000000"+(b[0]>>>0).toString(16)).slice(-8)+("00000000"+(b[1]>>>0).toString(16)).slice(-8)+("00000000"+(w[0]>>>0).toString(16)).slice(-8)+("00000000"+(w[1]>>>0).toString(16)).slice(-8)},typeof En<"u"?(typeof xi<"u"&&xi.exports&&(En=xi.exports=t),En.murmurHash3=t):typeof define=="function"&&define.amd?define([],function(){return t}):(t._murmurHash3=r.murmurHash3,t.noConflict=function(){return r.murmurHash3=t._murmurHash3,t._murmurHash3=e,t.noConflict=e,t},r.murmurHash3=t)})(En)});var nf=Di((mv,rf)=>{rf.exports=tf()});var _0={};ke(_0,{RELAY_V2_HOP_CODEC:()=>We,RELAY_V2_STOP_CODEC:()=>nr,circuitRelayServer:()=>uf,circuitRelayTransport:()=>Ef});var Oi=Symbol.for("@libp2p/peer-id");var Mi="keep-alive";var nc=Symbol.for("@libp2p/transport");var rc;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(rc||(rc={}));var ut=class extends Error{static name="AbortError";constructor(e="The operation was aborted"){super(e),this.name="AbortError"}};var Ee=class extends Error{static name="InvalidParametersError";constructor(e="Invalid parameters"){super(e),this.name="InvalidParametersError"}},ar=class extends Error{static name="InvalidPublicKeyError";constructor(e="Invalid public key"){super(e),this.name="InvalidPublicKeyError"}};var _n=class extends Error{static name="InvalidMultihashError";constructor(e="Invalid Multihash"){super(e),this.name="InvalidMultihashError"}};var In=class extends Error{static name="InvalidMessageError";constructor(e="Invalid message"){super(e),this.name="InvalidMessageError"}};var Vr=class extends Error{static name="DialError";constructor(e="Dial error"){super(e),this.name="DialError"}},$t=class extends Error{static name="ListenError";constructor(e="Listen error"){super(e),this.name="ListenError"}};var cr=class extends Error{static name="UnsupportedKeyTypeError";constructor(e="Unsupported key type"){super(e),this.name="UnsupportedKeyTypeError"}};var Re=(r,...e)=>{try{[...e]}catch{}};var qe=class extends EventTarget{#e=new Map;constructor(){super(),Re(1/0,this)}listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let s=this.#e.get(e);s==null&&(s=[],this.#e.set(e,s)),s.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let s=this.#e.get(e);s!=null&&(s=s.filter(({callback:i})=>i!==t),this.#e.set(e,s))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:s})=>!s),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t={}){return this.dispatchEvent(new CustomEvent(e,t))}};function sc(r){return r!=null&&typeof r.start=="function"&&typeof r.stop=="function"}async function ic(...r){let e=[];for(let t of r)sc(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStart!=null&&await t.beforeStart()})),await Promise.all(e.map(async t=>{await t.start()})),await Promise.all(e.map(async t=>{t.afterStart!=null&&await t.afterStart()}))}async function oc(...r){let e=[];for(let t of r)sc(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStop!=null&&await t.beforeStop()})),await Promise.all(e.map(async t=>{await t.stop()})),await Promise.all(e.map(async t=>{t.afterStop!=null&&await t.afterStop()}))}var ac=Symbol.for("@libp2p/service-capabilities"),cc=Symbol.for("@libp2p/service-dependencies");var Ki={};ke(Ki,{base58btc:()=>Q,base58flickr:()=>Kf});var im=new Uint8Array(0);function lc(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function ft(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 uc(r){return new TextEncoder().encode(r)}function fc(r){return new TextDecoder().decode(r)}function Mf(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var s=0;s<r.length;s++){var i=r.charAt(s),o=i.charCodeAt(0);if(t[o]!==255)throw new TypeError(i+" is ambiguous");t[o]=s}var a=r.length,c=r.charAt(0),h=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function u(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var p=0,y=0,b=0,w=d.length;b!==w&&d[b]===0;)b++,p++;for(var m=(w-b)*f+1>>>0,v=new Uint8Array(m);b!==w;){for(var A=d[b],_=0,x=m-1;(A!==0||_<y)&&x!==-1;x--,_++)A+=256*v[x]>>>0,v[x]=A%a>>>0,A=A/a>>>0;if(A!==0)throw new Error("Non-zero carry");y=_,b++}for(var B=m-y;B!==m&&v[B]===0;)B++;for(var C=c.repeat(p);B<m;++B)C+=r.charAt(v[B]);return C}function g(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var p=0;if(d[p]!==" "){for(var y=0,b=0;d[p]===c;)y++,p++;for(var w=(d.length-p)*h+1>>>0,m=new Uint8Array(w);d[p];){var v=t[d.charCodeAt(p)];if(v===255)return;for(var A=0,_=w-1;(v!==0||A<b)&&_!==-1;_--,A++)v+=a*m[_]>>>0,m[_]=v%256>>>0,v=v/256>>>0;if(v!==0)throw new Error("Non-zero carry");b=A,p++}if(d[p]!==" "){for(var x=w-b;x!==w&&m[x]===0;)x++;for(var B=new Uint8Array(y+(w-x)),C=y;x!==w;)B[C++]=m[x++];return B}}}function l(d){var p=g(d);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:g,decode:l}}var Pf=Mf,Vf=Pf,dc=Vf;var Pi=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Vi=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let s=t.codePointAt(0);if(s===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=s,this.baseDecode=n}decode(e){if(typeof e=="string"){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))}else throw Error("Can only multibase decode strings")}or(e){return pc(this,e)}},Hi=class{decoders;constructor(e){this.decoders=e}or(e){return pc(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function pc(r,e){return new Hi({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var Fi=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,s){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=s,this.encoder=new Pi(e,t,n),this.decoder=new Vi(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function lr({name:r,prefix:e,encode:t,decode:n}){return new Fi(r,e,t,n)}function Tt({name:r,prefix:e,alphabet:t}){let{encode:n,decode:s}=dc(t,r);return lr({prefix:e,name:r,encode:n,decode:i=>ft(s(i))})}function Hf(r,e,t,n){let s={};for(let f=0;f<e.length;++f)s[e[f]]=f;let i=r.length;for(;r[i-1]==="=";)--i;let o=new Uint8Array(i*t/8|0),a=0,c=0,h=0;for(let f=0;f<i;++f){let u=s[r[f]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<t|u,a+=t,a>=8&&(a-=8,o[h++]=255&c>>a)}if(a>=t||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o}function Ff(r,e,t){let n=e[e.length-1]==="=",s=(1<<t)-1,i="",o=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],o+=8;o>t;)o-=t,i+=e[s&a>>o];if(o!==0&&(i+=e[s&a<<t-o]),n)for(;i.length*t&7;)i+="=";return i}function ae({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return lr({prefix:e,name:r,encode(s){return Ff(s,n,t)},decode(s){return Hf(s,n,t,r)}})}var Q=Tt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Kf=Tt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var qi={};ke(qi,{base32:()=>ht,base32hex:()=>Gf,base32hexpad:()=>Zf,base32hexpadupper:()=>jf,base32hexupper:()=>Wf,base32pad:()=>zf,base32padupper:()=>$f,base32upper:()=>qf,base32z:()=>Yf});var ht=ae({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),qf=ae({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),zf=ae({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),$f=ae({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Gf=ae({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Wf=ae({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Zf=ae({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),jf=ae({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Yf=ae({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var zi={};ke(zi,{base36:()=>Hr,base36upper:()=>Xf});var Hr=Tt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Xf=Tt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Jf=yc,mc=128,Qf=127,eh=~Qf,th=Math.pow(2,31);function yc(r,e,t){e=e||[],t=t||0;for(var n=t;r>=th;)e[t++]=r&255|mc,r/=128;for(;r&eh;)e[t++]=r&255|mc,r>>>=7;return e[t]=r|0,yc.bytes=t-n+1,e}var rh=$i,nh=128,gc=127;function $i(r,n){var t=0,n=n||0,s=0,i=n,o,a=r.length;do{if(i>=a)throw $i.bytes=0,new RangeError("Could not decode varint");o=r[i++],t+=s<28?(o&gc)<<s:(o&gc)*Math.pow(2,s),s+=7}while(o>=nh);return $i.bytes=i-n,t}var sh=Math.pow(2,7),ih=Math.pow(2,14),oh=Math.pow(2,21),ah=Math.pow(2,28),ch=Math.pow(2,35),lh=Math.pow(2,42),uh=Math.pow(2,49),fh=Math.pow(2,56),hh=Math.pow(2,63),dh=function(r){return r<sh?1:r<ih?2:r<oh?3:r<ah?4:r<ch?5:r<lh?6:r<uh?7:r<fh?8:r<hh?9:10},ph={encode:Jf,decode:rh,encodingLength:dh},mh=ph,Fr=mh;function Kr(r,e=0){return[Fr.decode(r,e),Fr.decode.bytes]}function ur(r,e,t=0){return Fr.encode(r,e,t),e}function fr(r){return Fr.encodingLength(r)}function Ze(r,e){let t=e.byteLength,n=fr(r),s=n+fr(t),i=new Uint8Array(s+t);return ur(r,i,0),ur(t,i,n),i.set(e,s),new hr(r,t,e,i)}function ze(r){let e=ft(r),[t,n]=Kr(e),[s,i]=Kr(e.subarray(n)),o=e.subarray(n+i);if(o.byteLength!==s)throw new Error("Incorrect length");return new hr(t,s,o,e)}function bc(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&lc(r.bytes,t.bytes)}}var hr=class{code;size;digest;bytes;constructor(e,t,n,s){this.code=e,this.size=t,this.digest=n,this.bytes=s}};function wc(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return yh(t,Gi(r),e??Q.encoder);default:return bh(t,Gi(r),e??ht.encoder)}}var xc=new WeakMap;function Gi(r){let e=xc.get(r);if(e==null){let t=new Map;return xc.set(r,t),t}return e}var me=class r{code;version;multihash;bytes;"/";constructor(e,t,n,s){this.code=t,this.version=e,this.multihash=n,this.bytes=s,this["/"]=s}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:e,multihash:t}=this;if(e!==qr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==wh)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}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:e,digest:t}=this.multihash,n=Ze(e,t);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(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&bc(e.multihash,n.multihash)}toString(e){return wc(this,e)}toJSON(){return{"/":wc(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:s,multihash:i,bytes:o}=t;return new r(n,s,i,o??vc(n,s,i.bytes))}else if(t[xh]===!0){let{version:n,multihash:s,code:i}=t,o=ze(s);return r.create(n,i,o)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==qr)throw new Error(`Version 0 CID must use dag-pb (code: ${qr}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let s=vc(e,t,n.bytes);return new r(e,t,n,s)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,qr,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,s=ft(e.subarray(n,n+t.multihashSize));if(s.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=s.subarray(t.multihashSize-t.digestSize),o=new hr(t.multihashCode,t.digestSize,i,s);return[t.version===0?r.createV0(o):r.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[u,g]=Kr(e.subarray(t));return t+=g,u},s=n(),i=qr;if(s===18?(s=0,t=0):i=n(),s!==0&&s!==1)throw new RangeError(`Invalid CID version ${s}`);let o=t,a=n(),c=n(),h=t+c,f=h-o;return{version:s,codec:i,multihashCode:a,digestSize:c,multihashSize:f,size:h}}static parse(e,t){let[n,s]=gh(e,t),i=r.decode(s);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Gi(i).set(n,e),i}};function gh(r,e){switch(r[0]){case"Q":{let t=e??Q;return[Q.prefix,t.decode(`${Q.prefix}${r}`)]}case Q.prefix:{let t=e??Q;return[Q.prefix,t.decode(r)]}case ht.prefix:{let t=e??ht;return[ht.prefix,t.decode(r)]}case Hr.prefix:{let t=e??Hr;return[Hr.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function yh(r,e,t){let{prefix:n}=t;if(n!==Q.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let s=e.get(n);if(s==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return s}function bh(r,e,t){let{prefix:n}=t,s=e.get(n);if(s==null){let i=t.encode(r);return e.set(n,i),i}else return s}var qr=112,wh=18;function vc(r,e,t){let n=fr(r),s=n+fr(e),i=new Uint8Array(s+t.byteLength);return ur(r,i,0),ur(e,i,n),i.set(t,s),i}var xh=Symbol.for("@ipld/js-cid/CID");var Wi={};ke(Wi,{identity:()=>dt});var Ec=0,vh="identity",Sc=ft;function Eh(r){return Ze(Ec,Sc(r))}var dt={code:Ec,name:vh,encode:Sc,digest:Eh};function ge(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function Ac(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function Sh(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function dr(r,...e){if(!Sh(r))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(r.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${r.length}`)}function Bc(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ac(r.outputLen),Ac(r.blockLen)}function pr(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function _c(r,e){dr(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var Gt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var kn=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),je=(r,e)=>r<<32-e|r>>>e;var Tm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ic(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function zr(r){return typeof r=="string"&&(r=Ic(r)),dr(r),r}function Zi(...r){let e=0;for(let n=0;n<r.length;n++){let s=r[n];dr(s),e+=s.length}let t=new Uint8Array(e);for(let n=0,s=0;n<r.length;n++){let i=r[n];t.set(i,s),s+=i.length}return t}var mr=class{clone(){return this._cloneInto()}},km={}.toString;function Cn(r){let e=n=>r().update(zr(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function Nn(r=32){if(Gt&&typeof Gt.getRandomValues=="function")return Gt.getRandomValues(new Uint8Array(r));if(Gt&&typeof Gt.randomBytes=="function")return Gt.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function Ah(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let s=BigInt(32),i=BigInt(4294967295),o=Number(t>>s&i),a=Number(t&i),c=n?4:0,h=n?0:4;r.setUint32(e+c,o,n),r.setUint32(e+h,a,n)}var Tc=(r,e,t)=>r&e^~r&t,kc=(r,e,t)=>r&e^r&t^e&t,gr=class extends mr{constructor(e,t,n,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=kn(this.buffer)}update(e){pr(this);let{view:t,buffer:n,blockLen:s}=this;e=zr(e);let i=e.length;for(let o=0;o<i;){let a=Math.min(s-this.pos,i-o);if(a===s){let c=kn(e);for(;s<=i-o;o+=s)this.process(c,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){pr(this),_c(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:s,isLE:i}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(n,0),o=0);for(let u=o;u<s;u++)t[u]=0;Ah(n,s-8,BigInt(this.length*8),i),this.process(n,0);let a=kn(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let h=c/4,f=this.get();if(h>f.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<h;u++)a.setUint32(4*u,f[u],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:s,finished:i,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=o,s%t&&e.buffer.set(n),e}};var Rn=BigInt(4294967295),ji=BigInt(32);function Cc(r,e=!1){return e?{h:Number(r&Rn),l:Number(r>>ji&Rn)}:{h:Number(r>>ji&Rn)|0,l:Number(r&Rn)|0}}function Bh(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;s<r.length;s++){let{h:i,l:o}=Cc(r[s],e);[t[s],n[s]]=[i,o]}return[t,n]}var _h=(r,e)=>BigInt(r>>>0)<<ji|BigInt(e>>>0),Ih=(r,e,t)=>r>>>t,Th=(r,e,t)=>r<<32-t|e>>>t,kh=(r,e,t)=>r>>>t|e<<32-t,Ch=(r,e,t)=>r<<32-t|e>>>t,Nh=(r,e,t)=>r<<64-t|e>>>t-32,Rh=(r,e,t)=>r>>>t-32|e<<64-t,Lh=(r,e)=>e,Uh=(r,e)=>r,Dh=(r,e,t)=>r<<t|e>>>32-t,Oh=(r,e,t)=>e<<t|r>>>32-t,Mh=(r,e,t)=>e<<t-32|r>>>64-t,Ph=(r,e,t)=>r<<t-32|e>>>64-t;function Vh(r,e,t,n){let s=(e>>>0)+(n>>>0);return{h:r+t+(s/2**32|0)|0,l:s|0}}var Hh=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),Fh=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,Kh=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),qh=(r,e,t,n,s)=>e+t+n+s+(r/2**32|0)|0,zh=(r,e,t,n,s)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(s>>>0),$h=(r,e,t,n,s,i)=>e+t+n+s+i+(r/2**32|0)|0;var Gh={fromBig:Cc,split:Bh,toBig:_h,shrSH:Ih,shrSL:Th,rotrSH:kh,rotrSL:Ch,rotrBH:Nh,rotrBL:Rh,rotr32H:Lh,rotr32L:Uh,rotlSH:Dh,rotlSL:Oh,rotlBH:Mh,rotlBL:Ph,add:Vh,add3L:Hh,add3H:Fh,add4L:Kh,add4H:qh,add5H:$h,add5L:zh},O=Gh;var[Wh,Zh]=O.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(r=>BigInt(r))),kt=new Uint32Array(80),Ct=new Uint32Array(80),Yi=class extends gr{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(){let{Ah:e,Al:t,Bh:n,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:h,El:f,Fh:u,Fl:g,Gh:l,Gl:d,Hh:p,Hl:y}=this;return[e,t,n,s,i,o,a,c,h,f,u,g,l,d,p,y]}set(e,t,n,s,i,o,a,c,h,f,u,g,l,d,p,y){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=h|0,this.El=f|0,this.Fh=u|0,this.Fl=g|0,this.Gh=l|0,this.Gl=d|0,this.Hh=p|0,this.Hl=y|0}process(e,t){for(let m=0;m<16;m++,t+=4)kt[m]=e.getUint32(t),Ct[m]=e.getUint32(t+=4);for(let m=16;m<80;m++){let v=kt[m-15]|0,A=Ct[m-15]|0,_=O.rotrSH(v,A,1)^O.rotrSH(v,A,8)^O.shrSH(v,A,7),x=O.rotrSL(v,A,1)^O.rotrSL(v,A,8)^O.shrSL(v,A,7),B=kt[m-2]|0,C=Ct[m-2]|0,ne=O.rotrSH(B,C,19)^O.rotrBH(B,C,61)^O.shrSH(B,C,6),P=O.rotrSL(B,C,19)^O.rotrBL(B,C,61)^O.shrSL(B,C,6),M=O.add4L(x,P,Ct[m-7],Ct[m-16]),L=O.add4H(M,_,ne,kt[m-7],kt[m-16]);kt[m]=L|0,Ct[m]=M|0}let{Ah:n,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:h,Dl:f,Eh:u,El:g,Fh:l,Fl:d,Gh:p,Gl:y,Hh:b,Hl:w}=this;for(let m=0;m<80;m++){let v=O.rotrSH(u,g,14)^O.rotrSH(u,g,18)^O.rotrBH(u,g,41),A=O.rotrSL(u,g,14)^O.rotrSL(u,g,18)^O.rotrBL(u,g,41),_=u&l^~u&p,x=g&d^~g&y,B=O.add5L(w,A,x,Zh[m],Ct[m]),C=O.add5H(B,b,v,_,Wh[m],kt[m]),ne=B|0,P=O.rotrSH(n,s,28)^O.rotrBH(n,s,34)^O.rotrBH(n,s,39),M=O.rotrSL(n,s,28)^O.rotrBL(n,s,34)^O.rotrBL(n,s,39),L=n&i^n&a^i&a,T=s&o^s&c^o&c;b=p|0,w=y|0,p=l|0,y=d|0,l=u|0,d=g|0,{h:u,l:g}=O.add(h|0,f|0,C|0,ne|0),h=a|0,f=c|0,a=i|0,c=o|0,i=n|0,o=s|0;let N=O.add3L(ne,M,T);n=O.add3H(N,C,P,L),s=N|0}({h:n,l:s}=O.add(this.Ah|0,this.Al|0,n|0,s|0)),{h:i,l:o}=O.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l:c}=O.add(this.Ch|0,this.Cl|0,a|0,c|0),{h,l:f}=O.add(this.Dh|0,this.Dl|0,h|0,f|0),{h:u,l:g}=O.add(this.Eh|0,this.El|0,u|0,g|0),{h:l,l:d}=O.add(this.Fh|0,this.Fl|0,l|0,d|0),{h:p,l:y}=O.add(this.Gh|0,this.Gl|0,p|0,y|0),{h:b,l:w}=O.add(this.Hh|0,this.Hl|0,b|0,w|0),this.set(n,s,i,o,a,c,h,f,u,g,l,d,p,y,b,w)}roundClean(){kt.fill(0),Ct.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)}};var Nc=Cn(()=>new Yi);var Un={};ke(Un,{aInRange:()=>Le,abool:()=>Ye,abytes:()=>yr,bitGet:()=>ed,bitLen:()=>to,bitMask:()=>Gr,bitSet:()=>td,bytesToHex:()=>mt,bytesToNumberBE:()=>gt,bytesToNumberLE:()=>Rt,concatBytes:()=>yt,createHmacDrbg:()=>ro,ensureBytes:()=>ce,equalBytes:()=>Jh,hexToBytes:()=>Zt,hexToNumber:()=>eo,inRange:()=>$r,isBytes:()=>Nt,memoized:()=>Yt,notImplemented:()=>nd,numberToBytesBE:()=>Lt,numberToBytesLE:()=>jt,numberToHexUnpadded:()=>Wt,numberToVarBytesBE:()=>Xh,utf8ToBytes:()=>Qh,validateObject:()=>st});var Qi=BigInt(0),Ln=BigInt(1),jh=BigInt(2);function Nt(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function yr(r){if(!Nt(r))throw new Error("Uint8Array expected")}function Ye(r,e){if(typeof e!="boolean")throw new Error(`${r} must be valid boolean, got "${e}".`)}var Yh=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function mt(r){yr(r);let e="";for(let t=0;t<r.length;t++)e+=Yh[r[t]];return e}function Wt(r){let e=r.toString(16);return e.length&1?`0${e}`:e}function eo(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}var pt={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Rc(r){if(r>=pt._0&&r<=pt._9)return r-pt._0;if(r>=pt._A&&r<=pt._F)return r-(pt._A-10);if(r>=pt._a&&r<=pt._f)return r-(pt._a-10)}function Zt(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let e=r.length,t=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(t);for(let s=0,i=0;s<t;s++,i+=2){let o=Rc(r.charCodeAt(i)),a=Rc(r.charCodeAt(i+1));if(o===void 0||a===void 0){let c=r[i]+r[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[s]=o*16+a}return n}function gt(r){return eo(mt(r))}function Rt(r){return yr(r),eo(mt(Uint8Array.from(r).reverse()))}function Lt(r,e){return Zt(r.toString(16).padStart(e*2,"0"))}function jt(r,e){return Lt(r,e).reverse()}function Xh(r){return Zt(Wt(r))}function ce(r,e,t){let n;if(typeof e=="string")try{n=Zt(e)}catch(i){throw new Error(`${r} must be valid hex string, got "${e}". Cause: ${i}`)}else if(Nt(e))n=Uint8Array.from(e);else throw new Error(`${r} must be hex string or Uint8Array`);let s=n.length;if(typeof t=="number"&&s!==t)throw new Error(`${r} expected ${t} bytes, got ${s}`);return n}function yt(...r){let e=0;for(let n=0;n<r.length;n++){let s=r[n];yr(s),e+=s.length}let t=new Uint8Array(e);for(let n=0,s=0;n<r.length;n++){let i=r[n];t.set(i,s),s+=i.length}return t}function Jh(r,e){if(r.length!==e.length)return!1;let t=0;for(let n=0;n<r.length;n++)t|=r[n]^e[n];return t===0}function Qh(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}var Xi=r=>typeof r=="bigint"&&Qi<=r;function $r(r,e,t){return Xi(r)&&Xi(e)&&Xi(t)&&e<=r&&r<t}function Le(r,e,t,n){if(!$r(e,t,n))throw new Error(`expected valid ${r}: ${t} <= n < ${n}, got ${typeof e} ${e}`)}function to(r){let e;for(e=0;r>Qi;r>>=Ln,e+=1);return e}function ed(r,e){return r>>BigInt(e)&Ln}function td(r,e,t){return r|(t?Ln:Qi)<<BigInt(e)}var Gr=r=>(jh<<BigInt(r-1))-Ln,Ji=r=>new Uint8Array(r),Lc=r=>Uint8Array.from(r);function ro(r,e,t){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=Ji(r),s=Ji(r),i=0,o=()=>{n.fill(1),s.fill(0),i=0},a=(...u)=>t(s,n,...u),c=(u=Ji())=>{s=a(Lc([0]),u),n=a(),u.length!==0&&(s=a(Lc([1]),u),n=a())},h=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let u=0,g=[];for(;u<e;){n=a();let l=n.slice();g.push(l),u+=n.length}return yt(...g)};return(u,g)=>{o(),c(u);let l;for(;!(l=g(h()));)c();return o(),l}}var rd={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||Nt(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function st(r,e,t={}){let n=(s,i,o)=>{let a=rd[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);let c=r[s];if(!(o&&c===void 0)&&!a(c,r))throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${i}`)};for(let[s,i]of Object.entries(e))n(s,i,!1);for(let[s,i]of Object.entries(t))n(s,i,!0);return r}var nd=()=>{throw new Error("not implemented")};function Yt(r){let e=new WeakMap;return(t,...n)=>{let s=e.get(t);if(s!==void 0)return s;let i=r(t,...n);return e.set(t,i),i}}var fe=BigInt(0),se=BigInt(1),Xt=BigInt(2),sd=BigInt(3),no=BigInt(4),Uc=BigInt(5),Dc=BigInt(8),id=BigInt(9),od=BigInt(16);function X(r,e){let t=r%e;return t>=fe?t:e+t}function ad(r,e,t){if(t<=fe||e<fe)throw new Error("Expected power/modulo > 0");if(t===se)return fe;let n=se;for(;e>fe;)e&se&&(n=n*r%t),r=r*r%t,e>>=se;return n}function ie(r,e,t){let n=r;for(;e-- >fe;)n*=n,n%=t;return n}function Dn(r,e){if(r===fe||e<=fe)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=X(r,e),n=e,s=fe,i=se,o=se,a=fe;for(;t!==fe;){let h=n/t,f=n%t,u=s-o*h,g=i-a*h;n=t,t=f,s=o,i=a,o=u,a=g}if(n!==se)throw new Error("invert: does not exist");return X(s,e)}function cd(r){let e=(r-se)/Xt,t,n,s;for(t=r-se,n=0;t%Xt===fe;t/=Xt,n++);for(s=Xt;s<r&&ad(s,e,r)!==r-se;s++);if(n===1){let o=(r+se)/no;return function(c,h){let f=c.pow(h,o);if(!c.eql(c.sqr(f),h))throw new Error("Cannot find square root");return f}}let i=(t+se)/Xt;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let h=n,f=a.pow(a.mul(a.ONE,s),t),u=a.pow(c,i),g=a.pow(c,t);for(;!a.eql(g,a.ONE);){if(a.eql(g,a.ZERO))return a.ZERO;let l=1;for(let p=a.sqr(g);l<h&&!a.eql(p,a.ONE);l++)p=a.sqr(p);let d=a.pow(f,se<<BigInt(h-l-1));f=a.sqr(d),u=a.mul(u,d),g=a.mul(g,f),h=l}return u}}function ld(r){if(r%no===sd){let e=(r+se)/no;return function(n,s){let i=n.pow(s,e);if(!n.eql(n.sqr(i),s))throw new Error("Cannot find square root");return i}}if(r%Dc===Uc){let e=(r-Uc)/Dc;return function(n,s){let i=n.mul(s,Xt),o=n.pow(i,e),a=n.mul(s,o),c=n.mul(n.mul(a,Xt),o),h=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(h),s))throw new Error("Cannot find square root");return h}}return r%od,cd(r)}var Oc=(r,e)=>(X(r,e)&se)===se,ud=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function so(r){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=ud.reduce((n,s)=>(n[s]="function",n),e);return st(r,t)}function fd(r,e,t){if(t<fe)throw new Error("Expected power > 0");if(t===fe)return r.ONE;if(t===se)return e;let n=r.ONE,s=e;for(;t>fe;)t&se&&(n=r.mul(n,s)),s=r.sqr(s),t>>=se;return n}function hd(r,e){let t=new Array(e.length),n=e.reduce((i,o,a)=>r.is0(o)?i:(t[a]=i,r.mul(i,o)),r.ONE),s=r.inv(n);return e.reduceRight((i,o,a)=>r.is0(o)?i:(t[a]=r.mul(i,t[a]),r.mul(i,o)),s),t}function io(r,e){let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function Ut(r,e,t=!1,n={}){if(r<=fe)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:s,nByteLength:i}=io(r,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");let o=ld(r),a=Object.freeze({ORDER:r,BITS:s,BYTES:i,MASK:Gr(s),ZERO:fe,ONE:se,create:c=>X(c,r),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return fe<=c&&c<r},is0:c=>c===fe,isOdd:c=>(c&se)===se,neg:c=>X(-c,r),eql:(c,h)=>c===h,sqr:c=>X(c*c,r),add:(c,h)=>X(c+h,r),sub:(c,h)=>X(c-h,r),mul:(c,h)=>X(c*h,r),pow:(c,h)=>fd(a,c,h),div:(c,h)=>X(c*Dn(h,r),r),sqrN:c=>c*c,addN:(c,h)=>c+h,subN:(c,h)=>c-h,mulN:(c,h)=>c*h,inv:c=>Dn(c,r),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>hd(a,c),cmov:(c,h,f)=>f?h:c,toBytes:c=>t?jt(c,i):Lt(c,i),fromBytes:c=>{if(c.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${c.length}`);return t?Rt(c):gt(c)}});return Object.freeze(a)}function Mc(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let e=r.toString(2).length;return Math.ceil(e/8)}function oo(r){let e=Mc(r);return e+Math.ceil(e/2)}function Pc(r,e,t=!1){let n=r.length,s=Mc(e),i=oo(e);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);let o=t?gt(r):Rt(r),a=X(o,e-se)+se;return t?jt(a,s):Lt(a,s)}var pd=BigInt(0),ao=BigInt(1),co=new WeakMap,Vc=new WeakMap;function On(r,e){let t=(i,o)=>{let a=o.negate();return i?a:o},n=i=>{if(!Number.isSafeInteger(i)||i<=0||i>e)throw new Error(`Wrong window size=${i}, should be [1..${e}]`)},s=i=>{n(i);let o=Math.ceil(e/i)+1,a=2**(i-1);return{windows:o,windowSize:a}};return{constTimeNegate:t,unsafeLadder(i,o){let a=r.ZERO,c=i;for(;o>pd;)o&ao&&(a=a.add(c)),c=c.double(),o>>=ao;return a},precomputeWindow(i,o){let{windows:a,windowSize:c}=s(o),h=[],f=i,u=f;for(let g=0;g<a;g++){u=f,h.push(u);for(let l=1;l<c;l++)u=u.add(f),h.push(u);f=u.double()}return h},wNAF(i,o,a){let{windows:c,windowSize:h}=s(i),f=r.ZERO,u=r.BASE,g=BigInt(2**i-1),l=2**i,d=BigInt(i);for(let p=0;p<c;p++){let y=p*h,b=Number(a&g);a>>=d,b>h&&(b-=l,a+=ao);let w=y,m=y+Math.abs(b)-1,v=p%2!==0,A=b<0;b===0?u=u.add(t(v,o[w])):f=f.add(t(A,o[m]))}return{p:f,f:u}},wNAFCached(i,o,a){let c=Vc.get(i)||1,h=co.get(i);return h||(h=this.precomputeWindow(i,c),c!==1&&co.set(i,a(h))),this.wNAF(c,h,o)},setWindowSize(i,o){n(o),Vc.set(i,o),co.delete(i)}}}function Mn(r,e,t,n){if(!Array.isArray(t)||!Array.isArray(n)||n.length!==t.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((f,u)=>{if(!e.isValid(f))throw new Error(`wrong scalar at index ${u}`)}),t.forEach((f,u)=>{if(!(f instanceof r))throw new Error(`wrong point at index ${u}`)});let s=to(BigInt(t.length)),i=s>12?s-3:s>4?s-2:s?2:1,o=(1<<i)-1,a=new Array(o+1).fill(r.ZERO),c=Math.floor((e.BITS-1)/i)*i,h=r.ZERO;for(let f=c;f>=0;f-=i){a.fill(r.ZERO);for(let g=0;g<n.length;g++){let l=n[g],d=Number(l>>BigInt(f)&BigInt(o));a[d]=a[d].add(t[g])}let u=r.ZERO;for(let g=a.length-1,l=r.ZERO;g>0;g--)l=l.add(a[g]),u=u.add(l);if(h=h.add(u),f!==0)for(let g=0;g<i;g++)h=h.double()}return h}function Wr(r){return so(r.Fp),st(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...io(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var Xe=BigInt(0),Ue=BigInt(1),Pn=BigInt(2),md=BigInt(8),gd={zip215:!0};function yd(r){let e=Wr(r);return st(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function Hc(r){let e=yd(r),{Fp:t,n,prehash:s,hash:i,randomBytes:o,nByteLength:a,h:c}=e,h=Pn<<BigInt(a*8)-Ue,f=t.create,u=Ut(e.n,e.nBitLength),g=e.uvRatio||((S,E)=>{try{return{isValid:!0,value:t.sqrt(S*t.inv(E))}}catch{return{isValid:!1,value:Xe}}}),l=e.adjustScalarBytes||(S=>S),d=e.domain||((S,E,I)=>{if(Ye("phflag",I),E.length||I)throw new Error("Contexts/pre-hash are not supported");return S});function p(S,E){Le("coordinate "+S,E,Xe,h)}function y(S){if(!(S instanceof m))throw new Error("ExtendedPoint expected")}let b=Yt((S,E)=>{let{ex:I,ey:R,ez:U}=S,D=S.is0();E==null&&(E=D?md:t.inv(U));let K=f(I*E),$=f(R*E),q=f(U*E);if(D)return{x:Xe,y:Ue};if(q!==Ue)throw new Error("invZ was invalid");return{x:K,y:$}}),w=Yt(S=>{let{a:E,d:I}=e;if(S.is0())throw new Error("bad point: ZERO");let{ex:R,ey:U,ez:D,et:K}=S,$=f(R*R),q=f(U*U),Y=f(D*D),te=f(Y*Y),de=f($*E),pe=f(Y*f(de+q)),be=f(te+f(I*f($*q)));if(pe!==be)throw new Error("bad point: equation left != right (1)");let Te=f(R*U),ue=f(D*K);if(Te!==ue)throw new Error("bad point: equation left != right (2)");return!0});class m{constructor(E,I,R,U){this.ex=E,this.ey=I,this.ez=R,this.et=U,p("x",E),p("y",I),p("z",R),p("t",U),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");let{x:I,y:R}=E||{};return p("x",I),p("y",R),new m(I,R,Ue,f(I*R))}static normalizeZ(E){let I=t.invertBatch(E.map(R=>R.ez));return E.map((R,U)=>R.toAffine(I[U])).map(m.fromAffine)}static msm(E,I){return Mn(m,u,E,I)}_setWindowSize(E){_.setWindowSize(this,E)}assertValidity(){w(this)}equals(E){y(E);let{ex:I,ey:R,ez:U}=this,{ex:D,ey:K,ez:$}=E,q=f(I*$),Y=f(D*U),te=f(R*$),de=f(K*U);return q===Y&&te===de}is0(){return this.equals(m.ZERO)}negate(){return new m(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:E}=e,{ex:I,ey:R,ez:U}=this,D=f(I*I),K=f(R*R),$=f(Pn*f(U*U)),q=f(E*D),Y=I+R,te=f(f(Y*Y)-D-K),de=q+K,pe=de-$,be=q-K,Te=f(te*pe),ue=f(de*be),Ne=f(te*be),lt=f(pe*de);return new m(Te,ue,lt,Ne)}add(E){y(E);let{a:I,d:R}=e,{ex:U,ey:D,ez:K,et:$}=this,{ex:q,ey:Y,ez:te,et:de}=E;if(I===BigInt(-1)){let Wa=f((D-U)*(Y+q)),Za=f((D+U)*(Y-q)),Ui=f(Za-Wa);if(Ui===Xe)return this.double();let ja=f(K*Pn*de),Ya=f($*Pn*te),Xa=Ya+ja,Ja=Za+Wa,Qa=Ya-ja,If=f(Xa*Ui),Tf=f(Ja*Qa),kf=f(Xa*Qa),Cf=f(Ui*Ja);return new m(If,Tf,Cf,kf)}let pe=f(U*q),be=f(D*Y),Te=f($*R*de),ue=f(K*te),Ne=f((U+D)*(q+Y)-pe-be),lt=ue-Te,Mr=ue+Te,Pr=f(be-I*pe),Sf=f(Ne*lt),Af=f(Mr*Pr),Bf=f(Ne*Pr),_f=f(lt*Mr);return new m(Sf,Af,_f,Bf)}subtract(E){return this.add(E.negate())}wNAF(E){return _.wNAFCached(this,E,m.normalizeZ)}multiply(E){let I=E;Le("scalar",I,Ue,n);let{p:R,f:U}=this.wNAF(I);return m.normalizeZ([R,U])[0]}multiplyUnsafe(E){let I=E;return Le("scalar",I,Xe,n),I===Xe?A:this.equals(A)||I===Ue?this:this.equals(v)?this.wNAF(I).p:_.unsafeLadder(this,I)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return _.unsafeLadder(this,n).is0()}toAffine(E){return b(this,E)}clearCofactor(){let{h:E}=e;return E===Ue?this:this.multiplyUnsafe(E)}static fromHex(E,I=!1){let{d:R,a:U}=e,D=t.BYTES;E=ce("pointHex",E,D),Ye("zip215",I);let K=E.slice(),$=E[D-1];K[D-1]=$&-129;let q=Rt(K),Y=I?h:t.ORDER;Le("pointHex.y",q,Xe,Y);let te=f(q*q),de=f(te-Ue),pe=f(R*te-U),{isValid:be,value:Te}=g(de,pe);if(!be)throw new Error("Point.fromHex: invalid y coordinate");let ue=(Te&Ue)===Ue,Ne=($&128)!==0;if(!I&&Te===Xe&&Ne)throw new Error("Point.fromHex: x=0 and x_0=1");return Ne!==ue&&(Te=f(-Te)),m.fromAffine({x:Te,y:q})}static fromPrivateKey(E){return C(E).point}toRawBytes(){let{x:E,y:I}=this.toAffine(),R=jt(I,t.BYTES);return R[R.length-1]|=E&Ue?128:0,R}toHex(){return mt(this.toRawBytes())}}m.BASE=new m(e.Gx,e.Gy,Ue,f(e.Gx*e.Gy)),m.ZERO=new m(Xe,Ue,Ue,Xe);let{BASE:v,ZERO:A}=m,_=On(m,a*8);function x(S){return X(S,n)}function B(S){return x(Rt(S))}function C(S){let E=a;S=ce("private key",S,E);let I=ce("hashed private key",i(S),2*E),R=l(I.slice(0,E)),U=I.slice(E,2*E),D=B(R),K=v.multiply(D),$=K.toRawBytes();return{head:R,prefix:U,scalar:D,point:K,pointBytes:$}}function ne(S){return C(S).pointBytes}function P(S=new Uint8Array,...E){let I=yt(...E);return B(i(d(I,ce("context",S),!!s)))}function M(S,E,I={}){S=ce("message",S),s&&(S=s(S));let{prefix:R,scalar:U,pointBytes:D}=C(E),K=P(I.context,R,S),$=v.multiply(K).toRawBytes(),q=P(I.context,$,D,S),Y=x(K+q*U);Le("signature.s",Y,Xe,n);let te=yt($,jt(Y,t.BYTES));return ce("result",te,a*2)}let L=gd;function T(S,E,I,R=L){let{context:U,zip215:D}=R,K=t.BYTES;S=ce("signature",S,2*K),E=ce("message",E),D!==void 0&&Ye("zip215",D),s&&(E=s(E));let $=Rt(S.slice(K,2*K)),q,Y,te;try{q=m.fromHex(I,D),Y=m.fromHex(S.slice(0,K),D),te=v.multiplyUnsafe($)}catch{return!1}if(!D&&q.isSmallOrder())return!1;let de=P(U,Y.toRawBytes(),q.toRawBytes(),E);return Y.add(q.multiplyUnsafe(de)).subtract(te).clearCofactor().equals(m.ZERO)}return v._setWindowSize(8),{CURVE:e,getPublicKey:ne,sign:M,verify:T,ExtendedPoint:m,utils:{getExtendedPublicKey:C,randomPrivateKey:()=>o(t.BYTES),precompute(S=8,E=m.BASE){return E._setWindowSize(S),E.multiply(BigInt(3)),E}}}}var lo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Fc=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Jm=BigInt(0),bd=BigInt(1),Kc=BigInt(2),Qm=BigInt(3),wd=BigInt(5),xd=BigInt(8);function vd(r){let e=BigInt(10),t=BigInt(20),n=BigInt(40),s=BigInt(80),i=lo,a=r*r%i*r%i,c=ie(a,Kc,i)*a%i,h=ie(c,bd,i)*r%i,f=ie(h,wd,i)*h%i,u=ie(f,e,i)*f%i,g=ie(u,t,i)*u%i,l=ie(g,n,i)*g%i,d=ie(l,s,i)*l%i,p=ie(d,s,i)*l%i,y=ie(p,e,i)*f%i;return{pow_p_5_8:ie(y,Kc,i)*r%i,b2:a}}function Ed(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function Sd(r,e){let t=lo,n=X(e*e*e,t),s=X(n*n*e,t),i=vd(r*s).pow_p_5_8,o=X(r*n*i,t),a=X(e*o*o,t),c=o,h=X(o*Fc,t),f=a===r,u=a===X(-r,t),g=a===X(-r*Fc,t);return f&&(o=c),(u||g)&&(o=h),Oc(o,t)&&(o=X(-o,t)),{isValid:f||u,value:o}}var Ad=Ut(lo,void 0,!0),Bd={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ad,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:xd,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Nc,randomBytes:Nn,adjustScalarBytes:Ed,uvRatio:Sd},qc=Hc(Bd);var Vn=32;function zc(r,e,t){return qc.verify(e,t instanceof Uint8Array?t:t.subarray(),r)}var Hn=class{type="Ed25519";raw;constructor(e){this.raw=uo(e,Vn)}toMultihash(){return dt.digest(Dt(this))}toCID(){return me.createV1(114,this.toMultihash())}toString(){return Q.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:ge(this.raw,e.raw)}verify(e,t){return zc(this.raw,t,e)}};function fo(r){return r=uo(r,Vn),new Hn(r)}function uo(r,e){if(r=Uint8Array.from(r??[]),r.length!==e)throw new Ee(`Key must be a Uint8Array of length ${e}, got ${r.length}`);return r}function oe(r=0){return new Uint8Array(r)}function De(r=0){return new Uint8Array(r)}var Id=Math.pow(2,7),Td=Math.pow(2,14),kd=Math.pow(2,21),ho=Math.pow(2,28),po=Math.pow(2,35),mo=Math.pow(2,42),go=Math.pow(2,49),Z=128,Se=127;function Ae(r){if(r<Id)return 1;if(r<Td)return 2;if(r<kd)return 3;if(r<ho)return 4;if(r<po)return 5;if(r<mo)return 6;if(r<go)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function yo(r,e,t=0){switch(Ae(r)){case 8:e[t++]=r&255|Z,r/=128;case 7:e[t++]=r&255|Z,r/=128;case 6:e[t++]=r&255|Z,r/=128;case 5:e[t++]=r&255|Z,r/=128;case 4:e[t++]=r&255|Z,r>>>=7;case 3:e[t++]=r&255|Z,r>>>=7;case 2:e[t++]=r&255|Z,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function Cd(r,e,t=0){switch(Ae(r)){case 8:e.set(t++,r&255|Z),r/=128;case 7:e.set(t++,r&255|Z),r/=128;case 6:e.set(t++,r&255|Z),r/=128;case 5:e.set(t++,r&255|Z),r/=128;case 4:e.set(t++,r&255|Z),r>>>=7;case 3:e.set(t++,r&255|Z),r>>>=7;case 2:e.set(t++,r&255|Z),r>>>=7;case 1:{e.set(t++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function bo(r,e){let t=r[e],n=0;if(n+=t&Se,t<Z||(t=r[e+1],n+=(t&Se)<<7,t<Z)||(t=r[e+2],n+=(t&Se)<<14,t<Z)||(t=r[e+3],n+=(t&Se)<<21,t<Z)||(t=r[e+4],n+=(t&Se)*ho,t<Z)||(t=r[e+5],n+=(t&Se)*po,t<Z)||(t=r[e+6],n+=(t&Se)*mo,t<Z)||(t=r[e+7],n+=(t&Se)*go,t<Z))return n;throw new RangeError("Could not decode varint")}function Nd(r,e){let t=r.get(e),n=0;if(n+=t&Se,t<Z||(t=r.get(e+1),n+=(t&Se)<<7,t<Z)||(t=r.get(e+2),n+=(t&Se)<<14,t<Z)||(t=r.get(e+3),n+=(t&Se)<<21,t<Z)||(t=r.get(e+4),n+=(t&Se)*ho,t<Z)||(t=r.get(e+5),n+=(t&Se)*po,t<Z)||(t=r.get(e+6),n+=(t&Se)*mo,t<Z)||(t=r.get(e+7),n+=(t&Se)*go,t<Z))return n;throw new RangeError("Could not decode varint")}function $e(r,e,t=0){return e==null&&(e=De(Ae(r))),e instanceof Uint8Array?yo(r,e,t):Cd(r,e,t)}function bt(r,e=0){return r instanceof Uint8Array?bo(r,e):Nd(r,e)}var wo=new Float32Array([-0]),Ot=new Uint8Array(wo.buffer);function Gc(r,e,t){wo[0]=r,e[t]=Ot[0],e[t+1]=Ot[1],e[t+2]=Ot[2],e[t+3]=Ot[3]}function Wc(r,e){return Ot[0]=r[e],Ot[1]=r[e+1],Ot[2]=r[e+2],Ot[3]=r[e+3],wo[0]}var xo=new Float64Array([-0]),Be=new Uint8Array(xo.buffer);function Zc(r,e,t){xo[0]=r,e[t]=Be[0],e[t+1]=Be[1],e[t+2]=Be[2],e[t+3]=Be[3],e[t+4]=Be[4],e[t+5]=Be[5],e[t+6]=Be[6],e[t+7]=Be[7]}function jc(r,e){return Be[0]=r[e],Be[1]=r[e+1],Be[2]=r[e+2],Be[3]=r[e+3],Be[4]=r[e+4],Be[5]=r[e+5],Be[6]=r[e+6],Be[7]=r[e+7],xo[0]}var Rd=BigInt(Number.MAX_SAFE_INTEGER),Ld=BigInt(Number.MIN_SAFE_INTEGER),He=class r{lo;hi;constructor(e,t){this.lo=e|0,this.hi=t|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(BigInt(t)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return Jt;if(e<Rd&&e>Ld)return this.fromNumber(Number(e));let t=e<0n;t&&(e=-e);let n=e>>32n,s=e-(n<<32n);return t&&(n=~n|0n,s=~s|0n,++s>Yc&&(s=0n,++n>Yc&&(n=0n))),new r(Number(s),Number(n))}static fromNumber(e){if(e===0)return Jt;let t=e<0;t&&(e=-e);let n=e>>>0,s=(e-n)/4294967296>>>0;return t&&(s=~s>>>0,n=~n>>>0,++n>4294967295&&(n=0,++s>4294967295&&(s=0))),new r(n,s)}static from(e){return typeof e=="number"?r.fromNumber(e):typeof e=="bigint"?r.fromBigInt(e):typeof e=="string"?r.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new r(e.low>>>0,e.high>>>0):Jt}},Jt=new He(0,0);Jt.toBigInt=function(){return 0n};Jt.zzEncode=Jt.zzDecode=function(){return this};Jt.length=function(){return 1};var Yc=4294967296n;function Xc(r){let e=0,t=0;for(let n=0;n<r.length;++n)t=r.charCodeAt(n),t<128?e+=1:t<2048?e+=2:(t&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function Jc(r,e,t){if(t-e<1)return"";let s,i=[],o=0,a;for(;e<t;)a=r[e++],a<128?i[o++]=a:a>191&&a<224?i[o++]=(a&31)<<6|r[e++]&63:a>239&&a<365?(a=((a&7)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,i[o++]=55296+(a>>10),i[o++]=56320+(a&1023)):i[o++]=(a&15)<<12|(r[e++]&63)<<6|r[e++]&63,o>8191&&((s??(s=[])).push(String.fromCharCode.apply(String,i)),o=0);return s!=null?(o>0&&s.push(String.fromCharCode.apply(String,i.slice(0,o))),s.join("")):String.fromCharCode.apply(String,i.slice(0,o))}function vo(r,e,t){let n=t,s,i;for(let o=0;o<r.length;++o)s=r.charCodeAt(o),s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&((i=r.charCodeAt(o+1))&64512)===56320?(s=65536+((s&1023)<<10)+(i&1023),++o,e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128);return t-n}function Je(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function Kn(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}var Eo=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Je(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw Je(this,4);return Kn(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw Je(this,4);return Kn(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw Je(this,4);let e=Wc(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw Je(this,4);let e=jc(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw Je(this,e);return this.pos+=e,t===n?new Uint8Array(0):this.buf.subarray(t,n)}string(){let e=this.bytes();return Jc(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Je(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Je(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new He(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Je(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw Je(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw Je(this,8);let e=Kn(this.buf,this.pos+=4),t=Kn(this.buf,this.pos+=4);return new He(e,t)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=bo(this.buf,this.pos);return this.pos+=Ae(e),e}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 So(r){return new Eo(r instanceof Uint8Array?r:r.subarray())}function Oe(r,e,t){let n=So(r);return e.decode(n,void 0,t)}var Ao={};ke(Ao,{base10:()=>Ud});var Ud=Tt({prefix:"9",name:"base10",alphabet:"0123456789"});var Bo={};ke(Bo,{base16:()=>Dd,base16upper:()=>Od});var Dd=ae({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Od=ae({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var _o={};ke(_o,{base2:()=>Md});var Md=ae({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Io={};ke(Io,{base256emoji:()=>Kd});var el=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}"),Pd=el.reduce((r,e,t)=>(r[t]=e,r),[]),Vd=el.reduce((r,e,t)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return r[n]=t,r},[]);function Hd(r){return r.reduce((e,t)=>(e+=Pd[t],e),"")}function Fd(r){let e=[];for(let t of r){let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);let s=Vd[n];if(s==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(s)}return new Uint8Array(e)}var Kd=lr({prefix:"\u{1F680}",name:"base256emoji",encode:Hd,decode:Fd});var ko={};ke(ko,{base64:()=>qd,base64pad:()=>zd,base64url:()=>To,base64urlpad:()=>$d});var qd=ae({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zd=ae({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),To=ae({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),$d=ae({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Co={};ke(Co,{base8:()=>Gd});var Gd=ae({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var No={};ke(No,{identity:()=>Wd});var Wd=lr({prefix:"\0",name:"identity",encode:r=>fc(r),decode:r=>uc(r)});var Dg=new TextEncoder,Og=new TextDecoder;var Uo={};ke(Uo,{sha256:()=>br,sha512:()=>Yd});function Lo({name:r,code:e,encode:t}){return new Ro(r,e,t)}var Ro=class{name;code;encode;constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Ze(this.code,t):t.then(n=>Ze(this.code,n))}else throw Error("Unknown type, must be binary type")}};function rl(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var br=Lo({name:"sha2-256",code:18,encode:rl("SHA-256")}),Yd=Lo({name:"sha2-512",code:19,encode:rl("SHA-512")});var Zr={...No,..._o,...Co,...Ao,...Bo,...qi,...zi,...Ki,...ko,...Io},Zg={...Uo,...Wi};function sl(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var nl=sl("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Do=sl("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=De(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Xd={utf8:nl,"utf-8":nl,hex:Zr.base16,latin1:Do,ascii:Do,binary:Do,...Zr},qn=Xd;function G(r,e="utf8"){let t=qn[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function Oo(r){let e=r??8192,t=e>>>1,n,s=e;return function(o){if(o<1||o>t)return De(o);s+o>e&&(n=De(e),s=0);let a=n.subarray(s,s+=o);return s&7&&(s=(s|7)+1),a}}var Qt=class{fn;len;next;val;constructor(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}};function Mo(){}var Vo=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Jd=Oo();function Qd(r){return globalThis.Buffer!=null?De(r):Jd(r)}var Yr=class{len;head;tail;states;constructor(){this.len=0,this.head=new Qt(Mo,0,0),this.tail=this.head,this.states=null}_push(e,t,n){return this.tail=this.tail.next=new Qt(e,t,n),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new Ho((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(zn,10,He.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=He.fromBigInt(e);return this._push(zn,t.length(),t)}uint64Number(e){return this._push(yo,Ae(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let t=He.fromBigInt(e).zzEncode();return this._push(zn,t.length(),t)}sint64Number(e){let t=He.fromNumber(e).zzEncode();return this._push(zn,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(Po,1,e?1:0)}fixed32(e){return this._push(jr,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=He.fromBigInt(e);return this._push(jr,4,t.lo)._push(jr,4,t.hi)}fixed64Number(e){let t=He.fromNumber(e);return this._push(jr,4,t.lo)._push(jr,4,t.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(Gc,4,e)}double(e){return this._push(Zc,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(Po,1,0):this.uint32(t)._push(tp,t,e)}string(e){let t=Xc(e);return t!==0?this.uint32(t)._push(vo,t,e):this._push(Po,1,0)}fork(){return this.states=new Vo(this),this.head=this.tail=new Qt(Mo,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 Qt(Mo,0,0),this.len=0),this}ldelim(){let e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=t,this.len+=n),this}finish(){let e=this.head.next,t=Qd(this.len),n=0;for(;e!=null;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t}};function Po(r,e,t){e[t]=r&255}function ep(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}var Ho=class extends Qt{next;constructor(e,t){super(ep,e,t),this.next=void 0}};function zn(r,e,t){for(;r.hi!==0;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}function jr(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function tp(r,e,t){e.set(r,t)}globalThis.Buffer!=null&&(Yr.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(rp,e,r),this},Yr.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(np,e,r),this});function rp(r,e,t){e.set(r,t)}function np(r,e,t){r.length<40?vo(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(G(r),t)}function Fo(){return new Yr}function Me(r,e){let t=Fo();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var wr;(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"})(wr||(wr={}));function $n(r,e,t,n){return{name:r,type:e,encode:t,decode:n}}function er(r){function e(s){if(r[s.toString()]==null)throw new Error("Invalid enum value");return r[s]}let t=function(i,o){let a=e(i);o.int32(a)},n=function(i){let o=i.int32();return e(o)};return $n("enum",wr.VARINT,t,n)}function Pe(r,e){return $n("message",wr.LENGTH_DELIMITED,r,e)}var Xr=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"};var he;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1"})(he||(he={}));var Ko;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1"})(Ko||(Ko={}));(function(r){r.codec=()=>er(Ko)})(he||(he={}));var it;(function(r){let e;r.codec=()=>(e==null&&(e=Pe((t,n,s={})=>{s.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),he.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),s.lengthDelimited!==!1&&n.ldelim()},(t,n,s={})=>{let i={},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{i.Type=he.codec().decode(t);break}case 2:{i.Data=t.bytes();break}default:{t.skipType(a&7);break}}}return i})),e),r.encode=t=>Me(t,r.codec()),r.decode=(t,n)=>Oe(t,r.codec(),n)})(it||(it={}));var qo;(function(r){let e;r.codec=()=>(e==null&&(e=Pe((t,n,s={})=>{s.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),he.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),s.lengthDelimited!==!1&&n.ldelim()},(t,n,s={})=>{let i={},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{i.Type=he.codec().decode(t);break}case 2:{i.Data=t.bytes();break}default:{t.skipType(a&7);break}}}return i})),e),r.encode=t=>Me(t,r.codec()),r.decode=(t,n)=>Oe(t,r.codec(),n)})(qo||(qo={}));var cn={};ke(cn,{MAX_RSA_KEY_SIZE:()=>Os,generateRSAKeyPair:()=>tu,jwkToJWKKeyPair:()=>ru,jwkToPkcs1:()=>wp,jwkToPkix:()=>Jo,jwkToRSAPrivateKey:()=>eu,pkcs1ToJwk:()=>Xl,pkcs1ToRSAPrivateKey:()=>Ql,pkixToJwk:()=>Jl,pkixToRSAPublicKey:()=>Qo});var sp=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]),Mt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Pt=new Uint32Array(64),zo=class extends gr{constructor(){super(64,32,8,!1),this.A=Mt[0]|0,this.B=Mt[1]|0,this.C=Mt[2]|0,this.D=Mt[3]|0,this.E=Mt[4]|0,this.F=Mt[5]|0,this.G=Mt[6]|0,this.H=Mt[7]|0}get(){let{A:e,B:t,C:n,D:s,E:i,F:o,G:a,H:c}=this;return[e,t,n,s,i,o,a,c]}set(e,t,n,s,i,o,a,c){this.A=e|0,this.B=t|0,this.C=n|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,t){for(let u=0;u<16;u++,t+=4)Pt[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){let g=Pt[u-15],l=Pt[u-2],d=je(g,7)^je(g,18)^g>>>3,p=je(l,17)^je(l,19)^l>>>10;Pt[u]=p+Pt[u-7]+d+Pt[u-16]|0}let{A:n,B:s,C:i,D:o,E:a,F:c,G:h,H:f}=this;for(let u=0;u<64;u++){let g=je(a,6)^je(a,11)^je(a,25),l=f+g+Tc(a,c,h)+sp[u]+Pt[u]|0,p=(je(n,2)^je(n,13)^je(n,22))+kc(n,s,i)|0;f=h,h=c,c=a,a=o+l|0,o=i,i=s,s=n,n=l+p|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(n,s,i,o,a,c,h,f)}roundClean(){Pt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var xr=Cn(()=>new zo);var z=tc(ol());function tr(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}function Vt(r,e,t=-1){let n=t,s=r,i=0,o=Math.pow(2,e);for(let a=1;a<8;a++){if(r<o){let c;if(n<0)c=new ArrayBuffer(a),i=a;else{if(n<a)return new ArrayBuffer(0);c=new ArrayBuffer(n),i=n}let h=new Uint8Array(c);for(let f=a-1;f>=0;f--){let u=Math.pow(2,f*e);h[i-f-1]=Math.floor(s/u),s-=h[i-f-1]*u}return c}o*=Math.pow(2,e)}return new ArrayBuffer(0)}function Zn(...r){let e=0,t=0;for(let i of r)e+=i.length;let n=new ArrayBuffer(e),s=new Uint8Array(n);for(let i of r)s.set(i,t),t+=i.length;return s}function Go(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let a=r[0]===255&&r[1]&128,c=r[0]===0&&(r[1]&128)===0;(a||c)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let a=0;a<this.valueHex.byteLength;a++)t[a]=0;t[0]=r[0]&128;let n=tr(t,8),s=new ArrayBuffer(this.valueHex.byteLength),i=new Uint8Array(s);for(let a=0;a<this.valueHex.byteLength;a++)i[a]=r[a];return i[0]&=127,tr(i,8)-n}function al(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let o=t-e,a=Vt(o,8,n),c=new Uint8Array(a);return c[0]|=128,a}let s=Vt(e,8,n),i=new Uint8Array(s);if(i[0]&128){let o=s.slice(0),a=new Uint8Array(o);s=new ArrayBuffer(s.byteLength+1),i=new Uint8Array(s);for(let c=0;c<o.byteLength;c++)i[c+1]=a[c];i[0]=0}return s}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function cl(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<t.length;s++)if(t[s]!==n[s])return!1;return!0}function Ve(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,s=new Array(n);for(let o=0;o<n;o++)s[o]="0";return s.join("").concat(t)}var ky=Math.log(2);function jn(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Wo(r){let e=0,t=0;for(let s=0;s<r.length;s++){let i=r[s];e+=i.byteLength}let n=new Uint8Array(e);for(let s=0;s<r.length;s++){let i=r[s];n.set(new Uint8Array(i),t),t+=i.byteLength}return n.buffer}function St(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}var Qr=class{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Wo(this.items)}},Jr=[new Uint8Array([1])],ll="0123456789";var Br="",Qe=new ArrayBuffer(0),Zo=new Uint8Array(0),en="EndOfContent",fl="OCTET STRING",hl="BIT STRING";function At(r){var e;return e=class extends r{constructor(...n){var s;super(...n);let i=n[0]||{};this.isHexOnly=(s=i.isHexOnly)!==null&&s!==void 0?s:!1,this.valueHexView=i.valueHex?z.BufferSourceConverter.toUint8Array(i.valueHex):Zo}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,s,i){let o=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!St(this,o,s,i))return-1;let a=s+i;return this.valueHexView=o.subarray(s,a),this.valueHexView.length?(this.blockLength=i,a):(this.warnings.push("Zero buffer length"),s)}toBER(n=!1){return this.isHexOnly?n?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",Qe)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:z.Convert.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}var xt=class{constructor({blockLength:e=0,error:t=Br,warnings:n=[],valueBeforeDecode:s=Zo}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=z.BufferSourceConverter.toUint8Array(s)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:z.Convert.ToHex(this.valueBeforeDecodeView)}}};xt.NAME="baseBlock";var _e=class extends xt{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};_e.NAME="valueBlock";var Yn=class extends At(xt){constructor({idBlock:e={}}={}){var t,n,s,i;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?z.BufferSourceConverter.toUint8Array(e.valueHex):Zo,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(s=e.tagNumber)!==null&&s!==void 0?s:-1,this.isConstructed=(i=e.isConstructed)!==null&&i!==void 0?i:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",Qe}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let s=new Uint8Array(1);if(!e){let i=this.tagNumber;i&=31,t|=i,s[0]=t}return s.buffer}if(!this.isHexOnly){let s=Vt(this.tagNumber,7),i=new Uint8Array(s),o=s.byteLength,a=new Uint8Array(o+1);if(a[0]=t|31,!e){for(let c=0;c<o-1;c++)a[c+1]=i[c]|128;a[o]=i[o-1]}return a.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let s=this.valueHexView;for(let i=0;i<s.length-1;i++)n[i+1]=s[i]|128;n[this.valueHexView.byteLength]=s[s.length-1]}return n.buffer}fromBER(e,t,n){let s=z.BufferSourceConverter.toUint8Array(e);if(!St(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;switch(i[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(i[0]&32)===32,this.isHexOnly=!1;let a=i[0]&31;if(a!==31)this.tagNumber=a,this.blockLength=1;else{let c=1,h=this.valueHexView=new Uint8Array(255),f=255;for(;i[c]&128;){if(h[c-1]=i[c]&127,c++,c>=i.length)return this.error="End of input reached before message was fully decoded",-1;if(c===f){f+=255;let g=new Uint8Array(f);for(let l=0;l<h.length;l++)g[l]=h[l];h=this.valueHexView=new Uint8Array(f)}}this.blockLength=c+1,h[c-1]=i[c]&127;let u=new Uint8Array(c);for(let g=0;g<c;g++)u[g]=h[g];h=this.valueHexView=new Uint8Array(c),h.set(u),this.blockLength<=9?this.tagNumber=tr(h,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};Yn.NAME="identificationBlock";var Xn=class extends xt{constructor({lenBlock:e={}}={}){var t,n,s;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(s=e.length)!==null&&s!==void 0?s:0}fromBER(e,t,n){let s=z.BufferSourceConverter.toUint8Array(e);if(!St(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;if(i[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=i[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(i[0]&128),this.longFormUsed===!1)return this.length=i[0],this.blockLength=1,t+this.blockLength;let o=i[0]&127;if(o>8)return this.error="Too big integer",-1;if(o+1>i.length)return this.error="End of input reached before message was fully decoded",-1;let a=t+1,c=s.subarray(a,a+o);return c[o-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=tr(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let s=Vt(this.length,8);if(s.byteLength>127)return this.error="Too big length",Qe;if(t=new ArrayBuffer(s.byteLength+1),e)return t;let i=new Uint8Array(s);n=new Uint8Array(t),n[0]=s.byteLength|128;for(let o=0;o<s.byteLength;o++)n[o+1]=i[o];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};Xn.NAME="lengthBlock";var k={},we=class extends xt{constructor({name:e=Br,optional:t=!1,primitiveSchema:n,...s}={},i){super(s),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new Yn(s),this.lenBlock=new Xn(s),this.valueBlock=i?new i(s):new _e(s)}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}toBER(e,t){let n=t||new Qr;t||dl(this);let s=this.idBlock.toBER(e);if(n.write(s),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let i=this.valueBlock.toBER(e);this.lenBlock.length=i.byteLength;let o=this.lenBlock.toBER(e);n.write(o),n.write(i)}return t?Qe:n.final()}toJSON(){let e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():z.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${z.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return cl(t,n)}};we.NAME="BaseBlock";function dl(r){if(r instanceof k.Constructed)for(let e of r.valueBlock.value)dl(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}var Jn=class extends we{constructor({value:e=Br,...t}={},n){super(t,n),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};Jn.NAME="BaseStringBlock";var Qn=class extends At(_e){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}};Qn.NAME="PrimitiveValueBlock";var pl,es=class extends we{constructor(e={}){super(e,Qn),this.idBlock.isConstructed=!1}};pl=es;k.Primitive=pl;es.NAME="PRIMITIVE";function dp(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}function Us(r,e=0,t=r.length){let n=e,s=new we({},_e),i=new xt;if(!St(i,r,e,t))return s.error=i.error,{offset:-1,result:s};if(!r.subarray(e,e+t).length)return s.error="Zero buffer length",{offset:-1,result:s};let a=s.idBlock.fromBER(r,e,t);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),a===-1)return s.error=s.idBlock.error,{offset:-1,result:s};if(e=a,t-=s.idBlock.blockLength,a=s.lenBlock.fromBER(r,e,t),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),a===-1)return s.error=s.lenBlock.error,{offset:-1,result:s};if(e=a,t-=s.lenBlock.blockLength,!s.idBlock.isConstructed&&s.lenBlock.isIndefiniteForm)return s.error="Indefinite length form used for primitive encoding form",{offset:-1,result:s};let c=we;switch(s.idBlock.tagClass){case 1:if(s.idBlock.tagNumber>=37&&s.idBlock.isHexOnly===!1)return s.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:s};switch(s.idBlock.tagNumber){case 0:if(s.idBlock.isConstructed&&s.lenBlock.length>0)return s.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:s};c=k.EndOfContent;break;case 1:c=k.Boolean;break;case 2:c=k.Integer;break;case 3:c=k.BitString;break;case 4:c=k.OctetString;break;case 5:c=k.Null;break;case 6:c=k.ObjectIdentifier;break;case 10:c=k.Enumerated;break;case 12:c=k.Utf8String;break;case 13:c=k.RelativeObjectIdentifier;break;case 14:c=k.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:c=k.Sequence;break;case 17:c=k.Set;break;case 18:c=k.NumericString;break;case 19:c=k.PrintableString;break;case 20:c=k.TeletexString;break;case 21:c=k.VideotexString;break;case 22:c=k.IA5String;break;case 23:c=k.UTCTime;break;case 24:c=k.GeneralizedTime;break;case 25:c=k.GraphicString;break;case 26:c=k.VisibleString;break;case 27:c=k.GeneralString;break;case 28:c=k.UniversalString;break;case 29:c=k.CharacterString;break;case 30:c=k.BmpString;break;case 31:c=k.DATE;break;case 32:c=k.TimeOfDay;break;case 33:c=k.DateTime;break;case 34:c=k.Duration;break;default:{let h=s.idBlock.isConstructed?new k.Constructed:new k.Primitive;h.idBlock=s.idBlock,h.lenBlock=s.lenBlock,h.warnings=s.warnings,s=h}}break;case 2:case 3:case 4:default:c=s.idBlock.isConstructed?k.Constructed:k.Primitive}return s=dp(s,c),a=s.fromBER(r,e,s.lenBlock.isIndefiniteForm?t:s.lenBlock.length),s.valueBeforeDecodeView=r.subarray(n,n+s.blockLength),{offset:a,result:s}}function jo(r){if(!r.byteLength){let e=new we({},_e);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Us(z.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}function pp(r,e){return r?1:e}var ot=class extends _e{constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let s=z.BufferSourceConverter.toUint8Array(e);if(!St(this,s,t,n))return-1;if(this.valueBeforeDecodeView=s.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let i=t;for(;pp(this.isIndefiniteForm,n)>0;){let o=Us(s,i,n);if(o.offset===-1)return this.error=o.result.error,this.warnings.concat(o.result.warnings),-1;if(i=o.offset,this.blockLength+=o.result.blockLength,n-=o.result.blockLength,this.value.push(o.result),this.isIndefiniteForm&&o.result.constructor.NAME===en)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===en?this.value.pop():this.warnings.push("No EndOfContent block encoded")),i}toBER(e,t){let n=t||new Qr;for(let s=0;s<this.value.length;s++)this.value[s].toBER(e,n);return t?Qe:n.final()}toJSON(){let e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let t of this.value)e.value.push(t.toJSON());return e}};ot.NAME="ConstructedValueBlock";var ml,Ht=class extends we{constructor(e={}){super(e,ot),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
3
3
  `).map(s=>` ${s}`).join(`
4
4
  `));let t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
5
5
  ${e.join(`
@@ -10,7 +10,7 @@ pvtsutils/build/index.js:
10
10
  (*!
11
11
  * MIT License
12
12
  *
13
- * Copyright (c) 2017-2022 Peculiar Ventures, LLC
13
+ * Copyright (c) 2017-2024 Peculiar Ventures, LLC
14
14
  *
15
15
  * Permission is hereby granted, free of charge, to any person obtaining a copy
16
16
  * of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/circuit-relay-v2",
3
- "version": "3.1.3-0862522fe",
3
+ "version": "3.1.3-4a85eb033",
4
4
  "description": "Implementation of Circuit Relay v2",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/transport-circuit-relay-v2#readme",
@@ -52,13 +52,13 @@
52
52
  "doc-check": "aegir doc-check"
53
53
  },
54
54
  "dependencies": {
55
- "@libp2p/crypto": "5.0.7-0862522fe",
56
- "@libp2p/interface": "2.2.1-0862522fe",
57
- "@libp2p/interface-internal": "2.1.1-0862522fe",
58
- "@libp2p/peer-collections": "6.0.12-0862522fe",
59
- "@libp2p/peer-id": "5.0.8-0862522fe",
60
- "@libp2p/peer-record": "8.0.12-0862522fe",
61
- "@libp2p/utils": "6.2.1-0862522fe",
55
+ "@libp2p/crypto": "5.0.7-4a85eb033",
56
+ "@libp2p/interface": "2.2.1-4a85eb033",
57
+ "@libp2p/interface-internal": "2.1.1-4a85eb033",
58
+ "@libp2p/peer-collections": "6.0.12-4a85eb033",
59
+ "@libp2p/peer-id": "5.0.8-4a85eb033",
60
+ "@libp2p/peer-record": "8.0.12-4a85eb033",
61
+ "@libp2p/utils": "6.2.1-4a85eb033",
62
62
  "@multiformats/multiaddr": "^12.2.3",
63
63
  "@multiformats/multiaddr-matcher": "^1.3.0",
64
64
  "any-signal": "^4.1.1",
@@ -73,8 +73,8 @@
73
73
  "uint8arrays": "^5.1.0"
74
74
  },
75
75
  "devDependencies": {
76
- "@libp2p/interface-compliance-tests": "6.1.11-0862522fe",
77
- "@libp2p/logger": "5.1.4-0862522fe",
76
+ "@libp2p/interface-compliance-tests": "6.1.11-4a85eb033",
77
+ "@libp2p/logger": "5.1.4-4a85eb033",
78
78
  "aegir": "^44.0.1",
79
79
  "delay": "^6.0.0",
80
80
  "it-drain": "^3.0.7",