@prosopo/account 2.8.62 → 2.8.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,28 +1,19 @@
1
- const jsContent = '(function(){"use strict";function Dt(e){return e("return this")}const Fe=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:Dt(Function);function Mt(e,t){return typeof Fe[e]>"u"?t:Fe[e]}const Ot=Mt("TextEncoder",class{encode(t){const n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.charCodeAt(o);return r}});function $t(e){return e("return this")}const ne=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:$t(Function);function Zt(e,t){return typeof ne[e]>"u"?t:ne[e]}function Gt(e){return typeof e=="function"}function Ft(){return Number.NaN}const Ve=Zt("BigInt",Ft),Ee="0123456789abcdef",ue=new Uint8Array(256),Ye=new Uint8Array(256*256);for(let e=0,t=Ee.length;e<t;e++)ue[Ee[e].charCodeAt(0)|0]=e|0,e>9&&(ue[Ee[e].toUpperCase().charCodeAt(0)|0]=e|0);for(let e=0;e<256;e++){const t=e<<8;for(let n=0;n<256;n++)Ye[t|n]=ue[e]<<4|ue[n]}function Vt(e,t=-1){if(!e)return new Uint8Array;let n=e.startsWith("0x")?2:0;const r=Math.ceil((e.length-n)/2),o=Math.ceil(t===-1?r:t/8),s=new Uint8Array(o),a=o>r?o-r:0;for(let i=a;i<o;i++,n+=2)s[i]=Ye[e.charCodeAt(n)<<8|e.charCodeAt(n+1)];return s}const Yt=/^0x[\\da-fA-F]+$/;function Kt(e,t=-1,n){return typeof e=="string"&&(e==="0x"||Yt.test(e))&&(t===-1?n||e.length%2===0:e.length===2+Math.ceil(t/4))}typeof Ve=="function"&&Ve.asIntN;const Xt=typeof ne.Buffer=="function"&&typeof ne.Buffer.isBuffer=="function";ne.process;function Wt(e){return Xt&&!!e&&Gt(e.readDoubleLE)&&ne.Buffer.isBuffer(e)}function Pt(e){return(e&&e.constructor)===Uint8Array||e instanceof Uint8Array}const Qt=new Ot;function Ke(e){return e?Qt.encode(e.toString()):new Uint8Array}function de(e,t=!1){if(t&&e==null)throw new Error("u8aToU8a: Expected non-null, non-undefined value");return Pt(e)?Wt(e)?new Uint8Array(e):e:Kt(e)?Vt(e):Array.isArray(e)?new Uint8Array(e):Ke(e)}const re=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ke(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function oe(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function M(e,...t){if(!ke(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Xe(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");oe(e.outputLen),oe(e.blockLen)}function he(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Jt(e,t){M(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function J(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function pe(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function O(e,t){return e<<32-t|e>>>t}const We=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",en=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ge(e){if(M(e),We)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=en[e[n]];return t}const G={_0:48,_9:57,A:65,F:70,a:97,f:102};function Pe(e){if(e>=G._0&&e<=G._9)return e-G._0;if(e>=G.A&&e<=G.F)return e-(G.A-10);if(e>=G.a&&e<=G.f)return e-(G.a-10)}function Qe(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(We)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let o=0,s=0;o<n;o++,s+=2){const a=Pe(e.charCodeAt(s)),i=Pe(e.charCodeAt(s+1));if(a===void 0||i===void 0){const l=e[s]+e[s+1];throw new Error(\'hex string expected, got non-hex character "\'+l+\'" at index \'+s)}r[o]=a*16+i}return r}function Be(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ae(e){return typeof e=="string"&&(e=Be(e)),M(e),e}function Je(e){return typeof e=="string"&&(e=Be(e)),M(e),e}function Ie(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];M(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}function tn(e,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(e,t)}class et{}function tt(e){const t=r=>e().update(Ae(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function nn(e=32){if(re&&typeof re.getRandomValues=="function")return re.getRandomValues(new Uint8Array(e));if(re&&typeof re.randomBytes=="function")return Uint8Array.from(re.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}function rn(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),a=Number(n>>o&s),i=Number(n&s),l=r?4:0,d=r?0:4;e.setUint32(t+l,a,r),e.setUint32(t+d,i,r)}function on(e,t,n){return e&t^~e&n}function sn(e,t,n){return e&t^e&n^t&n}class nt extends et{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=pe(this.buffer)}update(t){he(this),t=Ae(t),M(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let a=0;a<s;){const i=Math.min(o-this.pos,s-a);if(i===o){const l=pe(t);for(;o<=s-a;a+=o)this.process(l,a);continue}r.set(t.subarray(a,a+i),this.pos),this.pos+=i,a+=i,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){he(this),Jt(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:a}=this;n[a++]=128,J(this.buffer.subarray(a)),this.padOffset>o-a&&(this.process(r,0),a=0);for(let f=a;f<o;f++)n[f]=0;rn(r,o-8,BigInt(this.length*8),s),this.process(r,0);const i=pe(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=l/4,c=this.get();if(d>c.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<d;f++)i.setUint32(4*f,c[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:a,pos:i}=this;return t.destroyed=a,t.finished=s,t.length=o,t.pos=i,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const Y=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),q=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),be=BigInt(2**32-1),rt=BigInt(32);function an(e,t=!1){return t?{h:Number(e&be),l:Number(e>>rt&be)}:{h:Number(e>>rt&be)|0,l:Number(e&be)|0}}function cn(e,t=!1){const n=e.length;let r=new Uint32Array(n),o=new Uint32Array(n);for(let s=0;s<n;s++){const{h:a,l:i}=an(e[s],t);[r[s],o[s]]=[a,i]}return[r,o]}const ot=(e,t,n)=>e>>>n,st=(e,t,n)=>e<<32-n|t>>>n,se=(e,t,n)=>e>>>n|t<<32-n,ie=(e,t,n)=>e<<32-n|t>>>n,me=(e,t,n)=>e<<64-n|t>>>n-32,ye=(e,t,n)=>e>>>n-32|t<<64-n;function F(e,t,n,r){const o=(t>>>0)+(r>>>0);return{h:e+n+(o/2**32|0)|0,l:o|0}}const ln=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),fn=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,un=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),dn=(e,t,n,r,o)=>t+n+r+o+(e/2**32|0)|0,hn=(e,t,n,r,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(o>>>0),pn=(e,t,n,r,o,s)=>t+n+r+o+s+(e/2**32|0)|0;function gn(e){return e("return this")}const bn=(typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:gn(Function)).crypto;function mn(e){return bn.getRandomValues(e)}function yn(e=32){return mn(new Uint8Array(e))}class it extends et{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Xe(t);const r=Ae(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let a=0;a<s.length;a++)s[a]^=54;this.iHash.update(s),this.oHash=t.create();for(let a=0;a<s.length;a++)s[a]^=106;this.oHash.update(s),J(s)}update(t){return he(this),this.iHash.update(t),this}digestInto(t){he(this),M(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:a,outputLen:i}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=a,t.outputLen=i,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const at=(e,t,n)=>new it(e,t).update(n).digest();at.create=(e,t)=>new it(e,t);function wn(e,t,n,r){Xe(e);const o=tn({dkLen:32,asyncTick:10},r),{c:s,dkLen:a,asyncTick:i}=o;if(oe(s),oe(a),oe(i),s<1)throw new Error("iterations (c) should be >= 1");const l=Je(t),d=Je(n),c=new Uint8Array(a),f=at.create(e,l),p=f._cloneInto().update(d);return{c:s,dkLen:a,asyncTick:i,DK:c,PRF:f,PRFSalt:p}}function xn(e,t,n,r,o){return e.destroy(),t.destroy(),r&&r.destroy(),J(o),n}function vn(e,t,n,r){const{c:o,dkLen:s,DK:a,PRF:i,PRFSalt:l}=wn(e,t,n,r);let d;const c=new Uint8Array(4),f=pe(c),p=new Uint8Array(i.outputLen);for(let h=1,w=0;w<s;h++,w+=i.outputLen){const g=a.subarray(w,w+i.outputLen);f.setInt32(0,h,!1),(d=l._cloneInto(d)).update(c).digestInto(p),g.set(p.subarray(0,g.length));for(let u=1;u<o;u++){i._cloneInto(d).update(p).digestInto(p);for(let b=0;b<g.length;b++)g[b]^=p[b]}}return xn(i,l,a,d,p)}const En=Uint32Array.from([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]),K=new Uint32Array(64);class kn extends nt{constructor(t=32){super(64,t,8,!1),this.A=Y[0]|0,this.B=Y[1]|0,this.C=Y[2]|0,this.D=Y[3]|0,this.E=Y[4]|0,this.F=Y[5]|0,this.G=Y[6]|0,this.H=Y[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:a,G:i,H:l}=this;return[t,n,r,o,s,a,i,l]}set(t,n,r,o,s,a,i,l){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=a|0,this.G=i|0,this.H=l|0}process(t,n){for(let f=0;f<16;f++,n+=4)K[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=K[f-15],h=K[f-2],w=O(p,7)^O(p,18)^p>>>3,g=O(h,17)^O(h,19)^h>>>10;K[f]=g+K[f-7]+w+K[f-16]|0}let{A:r,B:o,C:s,D:a,E:i,F:l,G:d,H:c}=this;for(let f=0;f<64;f++){const p=O(i,6)^O(i,11)^O(i,25),h=c+p+on(i,l,d)+En[f]+K[f]|0,g=(O(r,2)^O(r,13)^O(r,22))+sn(r,o,s)|0;c=d,d=l,l=i,i=a+h|0,a=s,s=o,o=r,r=h+g|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,a=a+this.D|0,i=i+this.E|0,l=l+this.F|0,d=d+this.G|0,c=c+this.H|0,this.set(r,o,s,a,i,l,d,c)}roundClean(){J(K)}destroy(){this.set(0,0,0,0,0,0,0,0),J(this.buffer)}}const ct=cn(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),Bn=ct[0],An=ct[1],X=new Uint32Array(80),W=new Uint32Array(80);class In extends nt{constructor(t=64){super(128,t,16,!1),this.Ah=q[0]|0,this.Al=q[1]|0,this.Bh=q[2]|0,this.Bl=q[3]|0,this.Ch=q[4]|0,this.Cl=q[5]|0,this.Dh=q[6]|0,this.Dl=q[7]|0,this.Eh=q[8]|0,this.El=q[9]|0,this.Fh=q[10]|0,this.Fl=q[11]|0,this.Gh=q[12]|0,this.Gl=q[13]|0,this.Hh=q[14]|0,this.Hl=q[15]|0}get(){const{Ah:t,Al:n,Bh:r,Bl:o,Ch:s,Cl:a,Dh:i,Dl:l,Eh:d,El:c,Fh:f,Fl:p,Gh:h,Gl:w,Hh:g,Hl:u}=this;return[t,n,r,o,s,a,i,l,d,c,f,p,h,w,g,u]}set(t,n,r,o,s,a,i,l,d,c,f,p,h,w,g,u){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=o|0,this.Ch=s|0,this.Cl=a|0,this.Dh=i|0,this.Dl=l|0,this.Eh=d|0,this.El=c|0,this.Fh=f|0,this.Fl=p|0,this.Gh=h|0,this.Gl=w|0,this.Hh=g|0,this.Hl=u|0}process(t,n){for(let y=0;y<16;y++,n+=4)X[y]=t.getUint32(n),W[y]=t.getUint32(n+=4);for(let y=16;y<80;y++){const B=X[y-15]|0,m=W[y-15]|0,v=se(B,m,1)^se(B,m,8)^ot(B,m,7),E=ie(B,m,1)^ie(B,m,8)^st(B,m,7),k=X[y-2]|0,A=W[y-2]|0,I=se(k,A,19)^me(k,A,61)^ot(k,A,6),_=ie(k,A,19)^ye(k,A,61)^st(k,A,6),U=un(E,_,W[y-7],W[y-16]),S=dn(U,v,I,X[y-7],X[y-16]);X[y]=S|0,W[y]=U|0}let{Ah:r,Al:o,Bh:s,Bl:a,Ch:i,Cl:l,Dh:d,Dl:c,Eh:f,El:p,Fh:h,Fl:w,Gh:g,Gl:u,Hh:b,Hl:x}=this;for(let y=0;y<80;y++){const B=se(f,p,14)^se(f,p,18)^me(f,p,41),m=ie(f,p,14)^ie(f,p,18)^ye(f,p,41),v=f&h^~f&g,E=p&w^~p&u,k=hn(x,m,E,An[y],W[y]),A=pn(k,b,B,v,Bn[y],X[y]),I=k|0,_=se(r,o,28)^me(r,o,34)^me(r,o,39),U=ie(r,o,28)^ye(r,o,34)^ye(r,o,39),S=r&s^r&i^s&i,N=o&a^o&l^a&l;b=g|0,x=u|0,g=h|0,u=w|0,h=f|0,w=p|0,{h:f,l:p}=F(d|0,c|0,A|0,I|0),d=i|0,c=l|0,i=s|0,l=a|0,s=r|0,a=o|0;const z=ln(I,U,N);r=fn(z,A,_,S),o=z|0}({h:r,l:o}=F(this.Ah|0,this.Al|0,r|0,o|0)),{h:s,l:a}=F(this.Bh|0,this.Bl|0,s|0,a|0),{h:i,l}=F(this.Ch|0,this.Cl|0,i|0,l|0),{h:d,l:c}=F(this.Dh|0,this.Dl|0,d|0,c|0),{h:f,l:p}=F(this.Eh|0,this.El|0,f|0,p|0),{h,l:w}=F(this.Fh|0,this.Fl|0,h|0,w|0),{h:g,l:u}=F(this.Gh|0,this.Gl|0,g|0,u|0),{h:b,l:x}=F(this.Hh|0,this.Hl|0,b|0,x|0),this.set(r,o,s,a,i,l,d,c,f,p,h,w,g,u,b,x)}roundClean(){J(X,W)}destroy(){J(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Sn=tt(()=>new kn),lt=tt(()=>new In);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Se=BigInt(0),_e=BigInt(1);function He(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function ft(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Se:BigInt("0x"+e)}function _n(e){return ft(ge(e))}function ee(e){return M(e),ft(ge(Uint8Array.from(e).reverse()))}function ut(e,t){return Qe(e.toString(16).padStart(t*2,"0"))}function ae(e,t){return ut(e,t).reverse()}function D(e,t,n){let r;if(typeof t=="string")try{r=Qe(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(ke(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(e+" of length "+n+" expected, got "+o);return r}function Hn(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}const Ue=e=>typeof e=="bigint"&&Se<=e;function Un(e,t,n){return Ue(e)&&Ue(t)&&Ue(n)&&t<=e&&e<n}function le(e,t,n,r){if(!Un(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Tn(e){let t;for(t=0;e>Se;e>>=_e,t+=1);return t}const we=e=>(_e<<BigInt(e))-_e;function Te(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(o,s,a){const i=e[o];if(a&&i===void 0)return;const l=typeof i;if(l!==s||i===null)throw new Error(`param "${o}" is invalid: expected ${s}, got ${l}`)}Object.entries(t).forEach(([o,s])=>r(o,s,!1)),Object.entries(n).forEach(([o,s])=>r(o,s,!0))}function dt(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(o!==void 0)return o;const s=e(n,...r);return t.set(n,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const R=BigInt(0),j=BigInt(1),te=BigInt(2),Nn=BigInt(3),ht=BigInt(4),pt=BigInt(5),gt=BigInt(8);function T(e,t){const n=e%t;return n>=R?n:t+n}function $(e,t,n){let r=e;for(;t-- >R;)r*=r,r%=n;return r}function bt(e,t){if(e===R)throw new Error("invert: expected non-zero number");if(t<=R)throw new Error("invert: expected positive modulus, got "+t);let n=T(e,t),r=t,o=R,s=j;for(;n!==R;){const i=r/n,l=r%n,d=o-s*i;r=n,n=l,o=s,s=d}if(r!==j)throw new Error("invert: does not exist");return T(o,t)}function mt(e,t){const n=(e.ORDER+j)/ht,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function qn(e,t){const n=(e.ORDER-pt)/gt,r=e.mul(t,te),o=e.pow(r,n),s=e.mul(t,o),a=e.mul(e.mul(s,te),o),i=e.mul(s,e.sub(a,e.ONE));if(!e.eql(e.sqr(i),t))throw new Error("Cannot find square root");return i}function zn(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-j,n=0;for(;t%te===R;)t/=te,n++;let r=te;const o=fe(e);for(;wt(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return mt;let s=o.pow(r,t);const a=(t+j)/te;return function(l,d){if(l.is0(d))return d;if(wt(l,d)!==1)throw new Error("Cannot find square root");let c=n,f=l.mul(l.ONE,s),p=l.pow(d,t),h=l.pow(d,a);for(;!l.eql(p,l.ONE);){if(l.is0(p))return l.ZERO;let w=1,g=l.sqr(p);for(;!l.eql(g,l.ONE);)if(w++,g=l.sqr(g),w===c)throw new Error("Cannot find square root");const u=j<<BigInt(c-w-1),b=l.pow(f,u);c=w,f=l.sqr(b),p=l.mul(p,f),h=l.mul(h,b)}return h}}function jn(e){return e%ht===Nn?mt:e%gt===pt?qn:zn(e)}const P=(e,t)=>(T(e,t)&j)===j,Ln=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Rn(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=Ln.reduce((r,o)=>(r[o]="function",r),t);return Te(e,n),e}function Cn(e,t,n){if(n<R)throw new Error("invalid exponent, negatives unsupported");if(n===R)return e.ONE;if(n===j)return t;let r=e.ONE,o=t;for(;n>R;)n&j&&(r=e.mul(r,o)),o=e.sqr(o),n>>=j;return r}function yt(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((a,i,l)=>e.is0(i)?a:(r[l]=a,e.mul(a,i)),e.ONE),s=e.inv(o);return t.reduceRight((a,i,l)=>e.is0(i)?a:(r[l]=e.mul(a,r[l]),e.mul(a,i)),s),r}function wt(e,t){const n=(e.ORDER-j)/te,r=e.pow(t,n),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),a=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!a)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function Dn(e,t){t!==void 0&&oe(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function fe(e,t,n=!1,r={}){if(e<=R)throw new Error("invalid field: expected ORDER > 0, got "+e);let o,s;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const c=t;c.BITS&&(o=c.BITS),c.sqrt&&(s=c.sqrt),typeof c.isLE=="boolean"&&(n=c.isLE)}else typeof t=="number"&&(o=t),r.sqrt&&(s=r.sqrt);const{nBitLength:a,nByteLength:i}=Dn(e,o);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const d=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:i,MASK:we(a),ZERO:R,ONE:j,create:c=>T(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return R<=c&&c<e},is0:c=>c===R,isValidNot0:c=>!d.is0(c)&&d.isValid(c),isOdd:c=>(c&j)===j,neg:c=>T(-c,e),eql:(c,f)=>c===f,sqr:c=>T(c*c,e),add:(c,f)=>T(c+f,e),sub:(c,f)=>T(c-f,e),mul:(c,f)=>T(c*f,e),pow:(c,f)=>Cn(d,c,f),div:(c,f)=>T(c*bt(f,e),e),sqrN:c=>c*c,addN:(c,f)=>c+f,subN:(c,f)=>c-f,mulN:(c,f)=>c*f,inv:c=>bt(c,e),sqrt:s||(c=>(l||(l=jn(e)),l(d,c))),toBytes:c=>n?ae(c,i):ut(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return n?ee(c):_n(c)},invertBatch:c=>yt(d,c),cmov:(c,f,p)=>p?f:c});return Object.freeze(d)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const xe=BigInt(0),Ne=BigInt(1);function qe(e,t){const n=t.negate();return e?n:t}function Mn(e,t,n){const r=a=>a.ez,o=yt(e.Fp,n.map(r));return n.map((a,i)=>a.toAffine(o[i])).map(e.fromAffine)}function xt(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function ze(e,t){xt(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=we(e),a=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:a}}function vt(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:a}=n;let i=Number(e&o),l=e>>a;i>r&&(i-=s,l+=Ne);const d=t*r,c=d+Math.abs(i)-1,f=i===0,p=i<0,h=t%2!==0;return{nextN:l,offset:c,isZero:f,isNeg:p,isNegF:h,offsetF:d}}function On(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function $n(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const je=new WeakMap,Et=new WeakMap;function Le(e){return Et.get(e)||1}function kt(e){if(e!==xe)throw new Error("invalid wNAF")}function Zn(e,t){return{constTimeNegate:qe,hasPrecomputes(n){return Le(n)!==1},unsafeLadder(n,r,o=e.ZERO){let s=n;for(;r>xe;)r&Ne&&(o=o.add(s)),s=s.double(),r>>=Ne;return o},precomputeWindow(n,r){const{windows:o,windowSize:s}=ze(r,t),a=[];let i=n,l=i;for(let d=0;d<o;d++){l=i,a.push(l);for(let c=1;c<s;c++)l=l.add(i),a.push(l);i=l.double()}return a},wNAF(n,r,o){let s=e.ZERO,a=e.BASE;const i=ze(n,t);for(let l=0;l<i.windows;l++){const{nextN:d,offset:c,isZero:f,isNeg:p,isNegF:h,offsetF:w}=vt(o,l,i);o=d,f?a=a.add(qe(h,r[w])):s=s.add(qe(p,r[c]))}return kt(o),{p:s,f:a}},wNAFUnsafe(n,r,o,s=e.ZERO){const a=ze(n,t);for(let i=0;i<a.windows&&o!==xe;i++){const{nextN:l,offset:d,isZero:c,isNeg:f}=vt(o,i,a);if(o=l,!c){const p=r[d];s=s.add(f?p.negate():p)}}return kt(o),s},getPrecomputes(n,r,o){let s=je.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&(typeof o=="function"&&(s=o(s)),je.set(r,s))),s},wNAFCached(n,r,o){const s=Le(n);return this.wNAF(s,this.getPrecomputes(s,n,o),r)},wNAFCachedUnsafe(n,r,o,s){const a=Le(n);return a===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(a,this.getPrecomputes(a,n,o),r,s)},setWindowSize(n,r){xt(r,t),Et.set(n,r),je.delete(n)}}}function Bt(e,t,n,r){On(n,e),$n(r,t);const o=n.length,s=r.length;if(o!==s)throw new Error("arrays of points and scalars must have equal length");const a=e.ZERO,i=Tn(BigInt(o));let l=1;i>12?l=i-3:i>4?l=i-2:i>0&&(l=2);const d=we(l),c=new Array(Number(d)+1).fill(a),f=Math.floor((t.BITS-1)/l)*l;let p=a;for(let h=f;h>=0;h-=l){c.fill(a);for(let g=0;g<s;g++){const u=r[g],b=Number(u>>BigInt(h)&d);c[b]=c[b].add(n[g])}let w=a;for(let g=c.length-1,u=a;g>0;g--)u=u.add(c[g]),w=w.add(u);if(p=p.add(w),h!==0)for(let g=0;g<l;g++)p=p.double()}return p}function At(e,t){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Rn(t),t}else return fe(e)}function Gn(e,t,n={}){if(!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const i of["p","n","h"]){const l=t[i];if(!(typeof l=="bigint"&&l>xe))throw new Error(`CURVE.${i} must be positive bigint`)}const r=At(t.p,n.Fp),o=At(t.n,n.Fn),a=["Gx","Gy","a","d"];for(const i of a)if(!r.isValid(t[i]))throw new Error(`CURVE.${i} must be valid field element of CURVE.Fp`);return{Fp:r,Fn:o}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Z=BigInt(0),L=BigInt(1),Re=BigInt(2),Fn=BigInt(8),Vn={zip215:!0};function Yn(e,t,n,r){const o=e.sqr(n),s=e.sqr(r),a=e.add(e.mul(t.a,o),s),i=e.add(e.ONE,e.mul(t.d,e.mul(o,s)));return e.eql(a,i)}function Kn(e,t={}){const{Fp:n,Fn:r}=Gn("edwards",e,t),{h:o,n:s}=e;Te(t,{},{uvRatio:"function"});const a=Re<<BigInt(r.BYTES*8)-L,i=g=>n.create(g),l=t.uvRatio||((g,u)=>{try{return{isValid:!0,value:n.sqrt(n.div(g,u))}}catch{return{isValid:!1,value:Z}}});if(!Yn(n,e,e.Gx,e.Gy))throw new Error("bad curve params: generator point");function d(g,u,b=!1){const x=b?L:Z;return le("coordinate "+g,u,x,a),u}function c(g){if(!(g instanceof h))throw new Error("ExtendedPoint expected")}const f=dt((g,u)=>{const{ex:b,ey:x,ez:y}=g,B=g.is0();u==null&&(u=B?Fn:n.inv(y));const m=i(b*u),v=i(x*u),E=i(y*u);if(B)return{x:Z,y:L};if(E!==L)throw new Error("invZ was invalid");return{x:m,y:v}}),p=dt(g=>{const{a:u,d:b}=e;if(g.is0())throw new Error("bad point: ZERO");const{ex:x,ey:y,ez:B,et:m}=g,v=i(x*x),E=i(y*y),k=i(B*B),A=i(k*k),I=i(v*u),_=i(k*i(I+E)),U=i(A+i(b*i(v*E)));if(_!==U)throw new Error("bad point: equation left != right (1)");const S=i(x*y),N=i(B*m);if(S!==N)throw new Error("bad point: equation left != right (2)");return!0});class h{constructor(u,b,x,y){this.ex=d("x",u),this.ey=d("y",b),this.ez=d("z",x,!0),this.et=d("t",y),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(u){if(u instanceof h)throw new Error("extended point not allowed");const{x:b,y:x}=u||{};return d("x",b),d("y",x),new h(b,x,L,i(b*x))}static normalizeZ(u){return Mn(h,"ez",u)}static msm(u,b){return Bt(h,r,u,b)}_setWindowSize(u){this.precompute(u)}precompute(u=8,b=!0){return w.setWindowSize(this,u),b||this.multiply(Re),this}assertValidity(){p(this)}equals(u){c(u);const{ex:b,ey:x,ez:y}=this,{ex:B,ey:m,ez:v}=u,E=i(b*v),k=i(B*y),A=i(x*v),I=i(m*y);return E===k&&A===I}is0(){return this.equals(h.ZERO)}negate(){return new h(i(-this.ex),this.ey,this.ez,i(-this.et))}double(){const{a:u}=e,{ex:b,ey:x,ez:y}=this,B=i(b*b),m=i(x*x),v=i(Re*i(y*y)),E=i(u*B),k=b+x,A=i(i(k*k)-B-m),I=E+m,_=I-v,U=E-m,S=i(A*_),N=i(I*U),z=i(A*U),Q=i(_*I);return new h(S,N,Q,z)}add(u){c(u);const{a:b,d:x}=e,{ex:y,ey:B,ez:m,et:v}=this,{ex:E,ey:k,ez:A,et:I}=u,_=i(y*E),U=i(B*k),S=i(v*x*I),N=i(m*A),z=i((y+B)*(E+k)-_-U),Q=N-S,Ze=N+S,Ge=i(U-b*_),Sr=i(z*Q),_r=i(Ze*Ge),Hr=i(z*Ge),Ur=i(Q*Ze);return new h(Sr,_r,Ur,Hr)}subtract(u){return this.add(u.negate())}multiply(u){const b=u;le("scalar",b,L,s);const{p:x,f:y}=w.wNAFCached(this,b,h.normalizeZ);return h.normalizeZ([x,y])[0]}multiplyUnsafe(u,b=h.ZERO){const x=u;return le("scalar",x,Z,s),x===Z?h.ZERO:this.is0()||x===L?this:w.wNAFCachedUnsafe(this,x,h.normalizeZ,b)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}isTorsionFree(){return w.wNAFCachedUnsafe(this,s).is0()}toAffine(u){return f(this,u)}clearCofactor(){return o===L?this:this.multiplyUnsafe(o)}static fromBytes(u,b=!1){return M(u),this.fromHex(u,b)}static fromHex(u,b=!1){const{d:x,a:y}=e,B=n.BYTES;u=D("pointHex",u,B),He("zip215",b);const m=u.slice(),v=u[B-1];m[B-1]=v&-129;const E=ee(m),k=b?a:n.ORDER;le("pointHex.y",E,Z,k);const A=i(E*E),I=i(A-L),_=i(x*A-y);let{isValid:U,value:S}=l(I,_);if(!U)throw new Error("Point.fromHex: invalid y coordinate");const N=(S&L)===L,z=(v&128)!==0;if(!b&&S===Z&&z)throw new Error("Point.fromHex: x=0 and x_0=1");return z!==N&&(S=i(-S)),h.fromAffine({x:S,y:E})}static fromPrivateScalar(u){return h.BASE.multiply(u)}toBytes(){const{x:u,y:b}=this.toAffine(),x=ae(b,n.BYTES);return x[x.length-1]|=u&L?128:0,x}toRawBytes(){return this.toBytes()}toHex(){return ge(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}h.BASE=new h(e.Gx,e.Gy,L,i(e.Gx*e.Gy)),h.ZERO=new h(Z,L,L,Z),h.Fp=n,h.Fn=r;const w=Zn(h,r.BYTES*8);return h}function Xn(e,t){Te(t,{hash:"function"},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:n,hash:r}=t,{BASE:o,Fp:s,Fn:a}=e,i=a.ORDER,l=t.randomBytes||nn,d=t.adjustScalarBytes||(m=>m),c=t.domain||((m,v,E)=>{if(He("phflag",E),v.length||E)throw new Error("Contexts/pre-hash are not supported");return m});function f(m){return a.create(m)}function p(m){return f(ee(m))}function h(m){const v=s.BYTES;m=D("private key",m,v);const E=D("hashed private key",r(m),2*v),k=d(E.slice(0,v)),A=E.slice(v,2*v),I=p(k);return{head:k,prefix:A,scalar:I}}function w(m){const{head:v,prefix:E,scalar:k}=h(m),A=o.multiply(k),I=A.toBytes();return{head:v,prefix:E,scalar:k,point:A,pointBytes:I}}function g(m){return w(m).pointBytes}function u(m=Uint8Array.of(),...v){const E=Ie(...v);return p(r(c(E,D("context",m),!!n)))}function b(m,v,E={}){m=D("message",m),n&&(m=n(m));const{prefix:k,scalar:A,pointBytes:I}=w(v),_=u(E.context,k,m),U=o.multiply(_).toBytes(),S=u(E.context,U,I,m),N=f(_+S*A);le("signature.s",N,Z,i);const z=s.BYTES,Q=Ie(U,ae(N,z));return D("result",Q,z*2)}const x=Vn;function y(m,v,E,k=x){const{context:A,zip215:I}=k,_=s.BYTES;m=D("signature",m,2*_),v=D("message",v),E=D("publicKey",E,_),I!==void 0&&He("zip215",I),n&&(v=n(v));const U=ee(m.slice(_,2*_));let S,N,z;try{S=e.fromHex(E,I),N=e.fromHex(m.slice(0,_),I),z=o.multiplyUnsafe(U)}catch{return!1}if(!I&&S.isSmallOrder())return!1;const Q=u(A,N.toBytes(),S.toBytes(),v);return N.add(S.multiplyUnsafe(Q)).subtract(z).clearCofactor().is0()}return o.precompute(8),{getPublicKey:g,sign:b,verify:y,utils:{getExtendedPublicKey:w,randomPrivateKey:()=>l(s.BYTES),precompute(m=8,v=e.BASE){return v.precompute(m,!1)}},Point:e}}function Wn(e){const t={a:e.a,d:e.d,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp,r=fe(t.n,e.nBitLength,!0),o={Fp:n,Fn:r,uvRatio:e.uvRatio},s={hash:e.hash,randomBytes:e.randomBytes,adjustScalarBytes:e.adjustScalarBytes,domain:e.domain,prehash:e.prehash,mapToCurve:e.mapToCurve};return{CURVE:t,curveOpts:o,eddsaOpts:s}}function Pn(e,t){return Object.assign({},t,{ExtendedPoint:t.Point,CURVE:e})}function Qn(e){const{CURVE:t,curveOpts:n,eddsaOpts:r}=Wn(e),o=Kn(t,n),s=Xn(o,r);return Pn(e,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Jn=BigInt(0),V=BigInt(1),It=BigInt(2);BigInt(3);const er=BigInt(5),tr=BigInt(8),ve={p:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:tr,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function nr(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),o=BigInt(80),s=ve.p,i=e*e%s*e%s,l=$(i,It,s)*i%s,d=$(l,V,s)*e%s,c=$(d,er,s)*d%s,f=$(c,t,s)*c%s,p=$(f,n,s)*f%s,h=$(p,r,s)*p%s,w=$(h,o,s)*h%s,g=$(w,o,s)*h%s,u=$(g,t,s)*c%s;return{pow_p_5_8:$(u,It,s)*e%s,b2:i}}function rr(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const Ce=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function De(e,t){const n=ve.p,r=T(t*t*t,n),o=T(r*r*t,n),s=nr(e*o).pow_p_5_8;let a=T(e*r*s,n);const i=T(t*a*a,n),l=a,d=T(a*Ce,n),c=i===e,f=i===T(-e,n),p=i===T(-e*Ce,n);return c&&(a=l),(f||p)&&(a=d),P(a,n)&&(a=T(-a,n)),{isValid:c||f,value:a}}const ce=fe(ve.p,void 0,!0),or={...ve,Fp:ce,hash:lt,adjustScalarBytes:rr,uvRatio:De},C=Qn(or);function Me(e){if(!(e instanceof H))throw new Error("RistrettoPoint expected")}const Oe=Ce,sr=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),ir=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),ar=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),cr=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),St=e=>De(V,e),lr=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),$e=e=>C.CURVE.Fp.create(ee(e)&lr);function _t(e){const{d:t}=C.CURVE,n=C.CURVE.Fp.ORDER,r=C.CURVE.Fp.create,o=r(Oe*e*e),s=r((o+V)*ar);let a=BigInt(-1);const i=r((a-t*o)*r(o+t));let{isValid:l,value:d}=De(s,i),c=r(d*e);P(c,n)||(c=r(-c)),l||(d=c),l||(a=o);const f=r(a*(o-V)*cr-i),p=d*d,h=r((d+d)*i),w=r(f*sr),g=r(V-p),u=r(V+p);return new C.Point(r(h*u),r(g*w),r(w*u),r(h*g))}class H{constructor(t){this.ep=t}static fromAffine(t){return new H(C.Point.fromAffine(t))}static hashToCurve(t){t=D("ristrettoHash",t,64);const n=$e(t.slice(0,32)),r=_t(n),o=$e(t.slice(32,64)),s=_t(o);return new H(r.add(s))}static fromBytes(t){return M(t),this.fromHex(t)}static fromHex(t){t=D("ristrettoHex",t,32);const{a:n,d:r}=C.CURVE,o=ce.ORDER,s=ce.create,a="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",i=$e(t);if(!Hn(ae(i,32),t)||P(i,o))throw new Error(a);const l=s(i*i),d=s(V+n*l),c=s(V-n*l),f=s(d*d),p=s(c*c),h=s(n*r*f-p),{isValid:w,value:g}=St(s(h*p)),u=s(g*c),b=s(g*u*h);let x=s((i+i)*u);P(x,o)&&(x=s(-x));const y=s(d*b),B=s(x*y);if(!w||P(B,o)||y===Jn)throw new Error(a);return new H(new C.Point(x,y,V,B))}static msm(t,n){const r=fe(C.CURVE.n,C.CURVE.nBitLength);return Bt(H,r,t,n)}toBytes(){let{ex:t,ey:n,ez:r,et:o}=this.ep;const s=ce.ORDER,a=ce.create,i=a(a(r+n)*a(r-n)),l=a(t*n),d=a(l*l),{value:c}=St(a(i*d)),f=a(c*i),p=a(c*l),h=a(f*p*o);let w;if(P(o*h,s)){let u=a(n*Oe),b=a(t*Oe);t=u,n=b,w=a(f*ir)}else w=p;P(t*h,s)&&(n=a(-n));let g=a((r-n)*w);return P(g,s)&&(g=a(-g)),ae(g,32)}toRawBytes(){return this.toBytes()}toHex(){return ge(this.toBytes())}toString(){return this.toHex()}equals(t){Me(t);const{ex:n,ey:r}=this.ep,{ex:o,ey:s}=t.ep,a=ce.create,i=a(n*s)===a(r*o),l=a(r*s)===a(n*o);return i||l}add(t){return Me(t),new H(this.ep.add(t.ep))}subtract(t){return Me(t),new H(this.ep.subtract(t.ep))}multiply(t){return new H(this.ep.multiply(t))}multiplyUnsafe(t){return new H(this.ep.multiplyUnsafe(t))}double(){return new H(this.ep.double())}negate(){return new H(this.ep.negate())}}const fr=(H.BASE||(H.BASE=new H(C.Point.BASE)),H.ZERO||(H.ZERO=new H(C.Point.ZERO)),H),Ht=lt;BigInt(0);const Ut=BigInt(3);function ur(e,t,...n){if(!ke(t))throw new Error(`${e}: Uint8Array expected`);if(n.length&&!n.includes(t.length))throw new Error(`${e}: Uint8Array expected of length ${n}, not of length=${t.length}`)}function dr(...e){for(const t of e)t.fill(0)}C.CURVE.n;const hr=we(256),pr=e=>ae(e<<Ut&hr,32),gr=e=>ee(e)>>Ut;function br(e){ur("seed",e,32);const t=Ht(e);t[0]&=248,t[31]&=63,t[31]|=64;const n=pr(gr(t.subarray(0,32))),r=t.subarray(32,64),o=Ie(n,r);return dr(n,r,t),o}Be("substrate");function mr(e,t=yn(),n=2048,r){const o=de(e),s=de(t);return{password:vn(Ht,o,s,{c:n,dkLen:64}),rounds:n,salt:t}}const yr={256:Sn}[256],Tt="abandon|ability|able|about|above|absent|absorb|abstract|absurd|abuse|access|accident|account|accuse|achieve|acid|acoustic|acquire|across|act|action|actor|actress|actual|adapt|add|addict|address|adjust|admit|adult|advance|advice|aerobic|affair|afford|afraid|again|age|agent|agree|ahead|aim|air|airport|aisle|alarm|album|alcohol|alert|alien|all|alley|allow|almost|alone|alpha|already|also|alter|always|amateur|amazing|among|amount|amused|analyst|anchor|ancient|anger|angle|angry|animal|ankle|announce|annual|another|answer|antenna|antique|anxiety|any|apart|apology|appear|apple|approve|april|arch|arctic|area|arena|argue|arm|armed|armor|army|around|arrange|arrest|arrive|arrow|art|artefact|artist|artwork|ask|aspect|assault|asset|assist|assume|asthma|athlete|atom|attack|attend|attitude|attract|auction|audit|august|aunt|author|auto|autumn|average|avocado|avoid|awake|aware|away|awesome|awful|awkward|axis|baby|bachelor|bacon|badge|bag|balance|balcony|ball|bamboo|banana|banner|bar|barely|bargain|barrel|base|basic|basket|battle|beach|bean|beauty|because|become|beef|before|begin|behave|behind|believe|below|belt|bench|benefit|best|betray|better|between|beyond|bicycle|bid|bike|bind|biology|bird|birth|bitter|black|blade|blame|blanket|blast|bleak|bless|blind|blood|blossom|blouse|blue|blur|blush|board|boat|body|boil|bomb|bone|bonus|book|boost|border|boring|borrow|boss|bottom|bounce|box|boy|bracket|brain|brand|brass|brave|bread|breeze|brick|bridge|brief|bright|bring|brisk|broccoli|broken|bronze|broom|brother|brown|brush|bubble|buddy|budget|buffalo|build|bulb|bulk|bullet|bundle|bunker|burden|burger|burst|bus|business|busy|butter|buyer|buzz|cabbage|cabin|cable|cactus|cage|cake|call|calm|camera|camp|can|canal|cancel|candy|cannon|canoe|canvas|canyon|capable|capital|captain|car|carbon|card|cargo|carpet|carry|cart|case|cash|casino|castle|casual|cat|catalog|catch|category|cattle|caught|cause|caution|cave|ceiling|celery|cement|census|century|cereal|certain|chair|chalk|champion|change|chaos|chapter|charge|chase|chat|cheap|check|cheese|chef|cherry|chest|chicken|chief|child|chimney|choice|choose|chronic|chuckle|chunk|churn|cigar|cinnamon|circle|citizen|city|civil|claim|clap|clarify|claw|clay|clean|clerk|clever|click|client|cliff|climb|clinic|clip|clock|clog|close|cloth|cloud|clown|club|clump|cluster|clutch|coach|coast|coconut|code|coffee|coil|coin|collect|color|column|combine|come|comfort|comic|common|company|concert|conduct|confirm|congress|connect|consider|control|convince|cook|cool|copper|copy|coral|core|corn|correct|cost|cotton|couch|country|couple|course|cousin|cover|coyote|crack|cradle|craft|cram|crane|crash|crater|crawl|crazy|cream|credit|creek|crew|cricket|crime|crisp|critic|crop|cross|crouch|crowd|crucial|cruel|cruise|crumble|crunch|crush|cry|crystal|cube|culture|cup|cupboard|curious|current|curtain|curve|cushion|custom|cute|cycle|dad|damage|damp|dance|danger|daring|dash|daughter|dawn|day|deal|debate|debris|decade|december|decide|decline|decorate|decrease|deer|defense|define|defy|degree|delay|deliver|demand|demise|denial|dentist|deny|depart|depend|deposit|depth|deputy|derive|describe|desert|design|desk|despair|destroy|detail|detect|develop|device|devote|diagram|dial|diamond|diary|dice|diesel|diet|differ|digital|dignity|dilemma|dinner|dinosaur|direct|dirt|disagree|discover|disease|dish|dismiss|disorder|display|distance|divert|divide|divorce|dizzy|doctor|document|dog|doll|dolphin|domain|donate|donkey|donor|door|dose|double|dove|draft|dragon|drama|drastic|draw|dream|dress|drift|drill|drink|drip|drive|drop|drum|dry|duck|dumb|dune|during|dust|dutch|duty|dwarf|dynamic|eager|eagle|early|earn|earth|easily|east|easy|echo|ecology|economy|edge|edit|educate|effort|egg|eight|either|elbow|elder|electric|elegant|element|elephant|elevator|elite|else|embark|embody|embrace|emerge|emotion|employ|empower|empty|enable|enact|end|endless|endorse|enemy|energy|enforce|engage|engine|enhance|enjoy|enlist|enough|enrich|enroll|ensure|enter|entire|entry|envelope|episode|equal|equip|era|erase|erode|erosion|error|erupt|escape|essay|essence|estate|eternal|ethics|evidence|evil|evoke|evolve|exact|example|excess|exchange|excite|exclude|excuse|execute|exercise|exhaust|exhibit|exile|exist|exit|exotic|expand|expect|expire|explain|expose|express|extend|extra|eye|eyebrow|fabric|face|faculty|fade|faint|faith|fall|false|fame|family|famous|fan|fancy|fantasy|farm|fashion|fat|fatal|father|fatigue|fault|favorite|feature|february|federal|fee|feed|feel|female|fence|festival|fetch|fever|few|fiber|fiction|field|figure|file|film|filter|final|find|fine|finger|finish|fire|firm|first|fiscal|fish|fit|fitness|fix|flag|flame|flash|flat|flavor|flee|flight|flip|float|flock|floor|flower|fluid|flush|fly|foam|focus|fog|foil|fold|follow|food|foot|force|forest|forget|fork|fortune|forum|forward|fossil|foster|found|fox|fragile|frame|frequent|fresh|friend|fringe|frog|front|frost|frown|frozen|fruit|fuel|fun|funny|furnace|fury|future|gadget|gain|galaxy|gallery|game|gap|garage|garbage|garden|garlic|garment|gas|gasp|gate|gather|gauge|gaze|general|genius|genre|gentle|genuine|gesture|ghost|giant|gift|giggle|ginger|giraffe|girl|give|glad|glance|glare|glass|glide|glimpse|globe|gloom|glory|glove|glow|glue|goat|goddess|gold|good|goose|gorilla|gospel|gossip|govern|gown|grab|grace|grain|grant|grape|grass|gravity|great|green|grid|grief|grit|grocery|group|grow|grunt|guard|guess|guide|guilt|guitar|gun|gym|habit|hair|half|hammer|hamster|hand|happy|harbor|hard|harsh|harvest|hat|have|hawk|hazard|head|health|heart|heavy|hedgehog|height|hello|helmet|help|hen|hero|hidden|high|hill|hint|hip|hire|history|hobby|hockey|hold|hole|holiday|hollow|home|honey|hood|hope|horn|horror|horse|hospital|host|hotel|hour|hover|hub|huge|human|humble|humor|hundred|hungry|hunt|hurdle|hurry|hurt|husband|hybrid|ice|icon|idea|identify|idle|ignore|ill|illegal|illness|image|imitate|immense|immune|impact|impose|improve|impulse|inch|include|income|increase|index|indicate|indoor|industry|infant|inflict|inform|inhale|inherit|initial|inject|injury|inmate|inner|innocent|input|inquiry|insane|insect|inside|inspire|install|intact|interest|into|invest|invite|involve|iron|island|isolate|issue|item|ivory|jacket|jaguar|jar|jazz|jealous|jeans|jelly|jewel|job|join|joke|journey|joy|judge|juice|jump|jungle|junior|junk|just|kangaroo|keen|keep|ketchup|key|kick|kid|kidney|kind|kingdom|kiss|kit|kitchen|kite|kitten|kiwi|knee|knife|knock|know|lab|label|labor|ladder|lady|lake|lamp|language|laptop|large|later|latin|laugh|laundry|lava|law|lawn|lawsuit|layer|lazy|leader|leaf|learn|leave|lecture|left|leg|legal|legend|leisure|lemon|lend|length|lens|leopard|lesson|letter|level|liar|liberty|library|license|life|lift|light|like|limb|limit|link|lion|liquid|list|little|live|lizard|load|loan|lobster|local|lock|logic|lonely|long|loop|lottery|loud|lounge|love|loyal|lucky|luggage|lumber|lunar|lunch|luxury|lyrics|machine|mad|magic|magnet|maid|mail|main|major|make|mammal|man|manage|mandate|mango|mansion|manual|maple|marble|march|margin|marine|market|marriage|mask|mass|master|match|material|math|matrix|matter|maximum|maze|meadow|mean|measure|meat|mechanic|medal|media|melody|melt|member|memory|mention|menu|mercy|merge|merit|merry|mesh|message|metal|method|middle|midnight|milk|million|mimic|mind|minimum|minor|minute|miracle|mirror|misery|miss|mistake|mix|mixed|mixture|mobile|model|modify|mom|moment|monitor|monkey|monster|month|moon|moral|more|morning|mosquito|mother|motion|motor|mountain|mouse|move|movie|much|muffin|mule|multiply|muscle|museum|mushroom|music|must|mutual|myself|mystery|myth|naive|name|napkin|narrow|nasty|nation|nature|near|neck|need|negative|neglect|neither|nephew|nerve|nest|net|network|neutral|never|news|next|nice|night|noble|noise|nominee|noodle|normal|north|nose|notable|note|nothing|notice|novel|now|nuclear|number|nurse|nut|oak|obey|object|oblige|obscure|observe|obtain|obvious|occur|ocean|october|odor|off|offer|office|often|oil|okay|old|olive|olympic|omit|once|one|onion|online|only|open|opera|opinion|oppose|option|orange|orbit|orchard|order|ordinary|organ|orient|original|orphan|ostrich|other|outdoor|outer|output|outside|oval|oven|over|own|owner|oxygen|oyster|ozone|pact|paddle|page|pair|palace|palm|panda|panel|panic|panther|paper|parade|parent|park|parrot|party|pass|patch|path|patient|patrol|pattern|pause|pave|payment|peace|peanut|pear|peasant|pelican|pen|penalty|pencil|people|pepper|perfect|permit|person|pet|phone|photo|phrase|physical|piano|picnic|picture|piece|pig|pigeon|pill|pilot|pink|pioneer|pipe|pistol|pitch|pizza|place|planet|plastic|plate|play|please|pledge|pluck|plug|plunge|poem|poet|point|polar|pole|police|pond|pony|pool|popular|portion|position|possible|post|potato|pottery|poverty|powder|power|practice|praise|predict|prefer|prepare|present|pretty|prevent|price|pride|primary|print|priority|prison|private|prize|problem|process|produce|profit|program|project|promote|proof|property|prosper|protect|proud|provide|public|pudding|pull|pulp|pulse|pumpkin|punch|pupil|puppy|purchase|purity|purpose|purse|push|put|puzzle|pyramid|quality|quantum|quarter|question|quick|quit|quiz|quote|rabbit|raccoon|race|rack|radar|radio|rail|rain|raise|rally|ramp|ranch|random|range|rapid|rare|rate|rather|raven|raw|razor|ready|real|reason|rebel|rebuild|recall|receive|recipe|record|recycle|reduce|reflect|reform|refuse|region|regret|regular|reject|relax|release|relief|rely|remain|remember|remind|remove|render|renew|rent|reopen|repair|repeat|replace|report|require|rescue|resemble|resist|resource|response|result|retire|retreat|return|reunion|reveal|review|reward|rhythm|rib|ribbon|rice|rich|ride|ridge|rifle|right|rigid|ring|riot|ripple|risk|ritual|rival|river|road|roast|robot|robust|rocket|romance|roof|rookie|room|rose|rotate|rough|round|route|royal|rubber|rude|rug|rule|run|runway|rural|sad|saddle|sadness|safe|sail|salad|salmon|salon|salt|salute|same|sample|sand|satisfy|satoshi|sauce|sausage|save|say|scale|scan|scare|scatter|scene|scheme|school|science|scissors|scorpion|scout|scrap|screen|script|scrub|sea|search|season|seat|second|secret|section|security|seed|seek|segment|select|sell|seminar|senior|sense|sentence|series|service|session|settle|setup|seven|shadow|shaft|shallow|share|shed|shell|sheriff|shield|shift|shine|ship|shiver|shock|shoe|shoot|shop|short|shoulder|shove|shrimp|shrug|shuffle|shy|sibling|sick|side|siege|sight|sign|silent|silk|silly|silver|similar|simple|since|sing|siren|sister|situate|six|size|skate|sketch|ski|skill|skin|skirt|skull|slab|slam|sleep|slender|slice|slide|slight|slim|slogan|slot|slow|slush|small|smart|smile|smoke|smooth|snack|snake|snap|sniff|snow|soap|soccer|social|sock|soda|soft|solar|soldier|solid|solution|solve|someone|song|soon|sorry|sort|soul|sound|soup|source|south|space|spare|spatial|spawn|speak|special|speed|spell|spend|sphere|spice|spider|spike|spin|spirit|split|spoil|sponsor|spoon|sport|spot|spray|spread|spring|spy|square|squeeze|squirrel|stable|stadium|staff|stage|stairs|stamp|stand|start|state|stay|steak|steel|stem|step|stereo|stick|still|sting|stock|stomach|stone|stool|story|stove|strategy|street|strike|strong|struggle|student|stuff|stumble|style|subject|submit|subway|success|such|sudden|suffer|sugar|suggest|suit|summer|sun|sunny|sunset|super|supply|supreme|sure|surface|surge|surprise|surround|survey|suspect|sustain|swallow|swamp|swap|swarm|swear|sweet|swift|swim|swing|switch|sword|symbol|symptom|syrup|system|table|tackle|tag|tail|talent|talk|tank|tape|target|task|taste|tattoo|taxi|teach|team|tell|ten|tenant|tennis|tent|term|test|text|thank|that|theme|then|theory|there|they|thing|this|thought|three|thrive|throw|thumb|thunder|ticket|tide|tiger|tilt|timber|time|tiny|tip|tired|tissue|title|toast|tobacco|today|toddler|toe|together|toilet|token|tomato|tomorrow|tone|tongue|tonight|tool|tooth|top|topic|topple|torch|tornado|tortoise|toss|total|tourist|toward|tower|town|toy|track|trade|traffic|tragic|train|transfer|trap|trash|travel|tray|treat|tree|trend|trial|tribe|trick|trigger|trim|trip|trophy|trouble|truck|true|truly|trumpet|trust|truth|try|tube|tuition|tumble|tuna|tunnel|turkey|turn|turtle|twelve|twenty|twice|twin|twist|two|type|typical|ugly|umbrella|unable|unaware|uncle|uncover|under|undo|unfair|unfold|unhappy|uniform|unique|unit|universe|unknown|unlock|until|unusual|unveil|update|upgrade|uphold|upon|upper|upset|urban|urge|usage|use|used|useful|useless|usual|utility|vacant|vacuum|vague|valid|valley|valve|van|vanish|vapor|various|vast|vault|vehicle|velvet|vendor|venture|venue|verb|verify|version|very|vessel|veteran|viable|vibrant|vicious|victory|video|view|village|vintage|violin|virtual|virus|visa|visit|visual|vital|vivid|vocal|voice|void|volcano|volume|vote|voyage|wage|wagon|wait|walk|wall|walnut|want|warfare|warm|warrior|wash|wasp|waste|water|wave|way|wealth|weapon|wear|weasel|weather|web|wedding|weekend|weird|welcome|west|wet|whale|what|wheat|wheel|when|where|whip|whisper|wide|width|wife|wild|will|win|window|wine|wing|wink|winner|winter|wire|wisdom|wise|wish|witness|wolf|woman|wonder|wood|wool|word|work|world|worry|worth|wrap|wreck|wrestle|wrist|write|wrong|yard|year|yellow|you|young|youth|zebra|zero|zone|zoo".split("|"),Nt="Invalid mnemonic",qt="Invalid entropy",wr="Invalid mnemonic checksum";function xr(e){return(e||"").normalize("NFKD")}function zt(e){return Number.parseInt(e,2)}function jt(e){return e.map(t=>t.toString(2).padStart(8,"0")).join("")}function Lt(e){return jt(Array.from(yr(e))).slice(0,e.length*8/32)}function Rt(e,t=Tt){const n=xr(e).split(" ");if(n.length%3!==0)throw new Error(Nt);const r=n.map(c=>{const f=t.indexOf(c);if(f===-1)throw new Error(Nt);return f.toString(2).padStart(11,"0")}).join(""),o=Math.floor(r.length/33)*32,s=r.slice(0,o),a=r.slice(o),l=s.match(/(.{1,8})/g)?.map(zt);if(!l||l.length%4!==0||l.length<16||l.length>32)throw new Error(qt);const d=de(l);if(Lt(d)!==a)throw new Error(wr);return d}function Ct(e,t=Tt){if(e.length%4!==0||e.length<16||e.length>32)throw new Error(qt);const r=`${jt(Array.from(e))}${Lt(e)}`.match(/(.{1,11})/g)?.map(o=>t[zt(o)]);if(!r||r.length<12)throw new Error("Unable to map entropy to mnemonic");return r.join(" ")}function vr(e,t){try{Rt(e,t)}catch{return!1}return!0}function Er(e,t,n){return Rt(e,t)}function kr(e,t){return vr(e,t)}function Br(e,t="",n,r){if(!kr(e,n))throw new Error("Invalid bip39 mnemonic specified");const o=Er(e,n),s=Ke(`mnemonic${t}`);return mr(o,s).password.slice(0,32)}function Ar(e){const t=de(e);if(t.length!==32)throw new Error(`Expected a seed of 32 bytes, found ${t.length}`);const n=br(t),r=ee(n.subarray(0,32))>>3n,o=fr.BASE.multiply(r).toRawBytes();return{publicKey:new Uint8Array(o),secretKey:new Uint8Array(n)}}self.addEventListener("message",async e=>{const{taskId:t,task:n,data:r}=e.data;try{let o;switch(n){case"test":o="ready";break;case"entropyToMnemonic":if(!r.entropy)throw new Error("Entropy data is required");o=Ct(r.entropy);break;case"entropyToKeypair":if(!r.entropy)throw new Error("Entropy data is required");o=Ir(r.entropy);break;default:throw new Error(`Unknown task: ${n}`)}const s={taskId:t,result:o};self.postMessage(s)}catch(o){const s={taskId:t,error:o instanceof Error?o.message:"Unknown error"};self.postMessage(s)}});function Ir(e){const t=Ct(e),n=Br(t),{publicKey:r,secretKey:o}=Ar(n);return{mnemonic:t,publicKey:r,secretKey:o}}})();\n';
2
- const blob = typeof self !== "undefined" && self.Blob && new Blob([jsContent], { type: "text/javascript;charset=utf-8" });
1
+ //#region src/workers/cryptoWorker.ts?worker&inline
2
+ var jsContent = "(function(){function e(e){return e(`return this`)}let t=typeof globalThis<`u`?globalThis:typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:e(Function);function n(e,n){return t[e]===void 0?n:t[e]}let r=n(`TextEncoder`,class{encode(e){let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=e.charCodeAt(r);return n}});function i(e){return e(`return this`)}let a=typeof globalThis<`u`?globalThis:typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:i(Function);function o(e,t){return a[e]===void 0?t:a[e]}function s(e){return typeof e==`function`}function c(){return NaN}let l=o(`BigInt`,c),u=`0123456789abcdef`,d=new Uint8Array(256),f=new Uint8Array(256*256);for(let e=0;e<16;e++)d[u[e].charCodeAt(0)|0]=e|0,e>9&&(d[u[e].toUpperCase().charCodeAt(0)|0]=e|0);for(let e=0;e<256;e++){let t=e<<8;for(let n=0;n<256;n++)f[t|n]=d[e]<<4|d[n]}function p(e,t=-1){if(!e)return new Uint8Array;let n=e.startsWith(`0x`)?2:0,r=Math.ceil((e.length-n)/2),i=Math.ceil(t===-1?r:t/8),a=new Uint8Array(i),o=i>r?i-r:0;for(let t=o;t<i;t++,n+=2)a[t]=f[e.charCodeAt(n)<<8|e.charCodeAt(n+1)];return a}let m=/^0x[\\da-fA-F]+$/;function h(e,t=-1,n){return typeof e==`string`&&(e===`0x`||m.test(e))&&(t===-1?n||e.length%2==0:e.length===2+Math.ceil(t/4))}typeof l==`function`&&l.asIntN;let g=typeof a.Buffer==`function`&&typeof a.Buffer.isBuffer==`function`;a.process;function _(e){return g&&!!e&&s(e.readDoubleLE)&&a.Buffer.isBuffer(e)}function v(e){return(e&&e.constructor)===Uint8Array||e instanceof Uint8Array}let y=new r;function b(e){return e?y.encode(e.toString()):new Uint8Array}function x(e,t=!1){if(t&&e==null)throw Error(`u8aToU8a: Expected non-null, non-undefined value`);return v(e)?_(e)?new Uint8Array(e):e:h(e)?p(e):Array.isArray(e)?new Uint8Array(e):b(e)}let S=typeof globalThis==`object`&&`crypto`in globalThis?globalThis.crypto:void 0;\n/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nfunction C(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function w(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function T(e,...t){if(!C(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function ee(e){if(typeof e!=`function`||typeof e.create!=`function`)throw Error(`Hash should be wrapped by utils.createHasher`);w(e.outputLen),w(e.blockLen)}function E(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function te(e,t){T(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function D(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ne(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function O(e,t){return e<<32-t|e>>>t}let re=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,ie=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function ae(e){if(T(e),re)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=ie[e[n]];return t}let k={_0:48,_9:57,A:65,F:70,a:97,f:102};function oe(e){if(e>=k._0&&e<=k._9)return e-k._0;if(e>=k.A&&e<=k.F)return e-(k.A-10);if(e>=k.a&&e<=k.f)return e-(k.a-10)}function se(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);if(re)return Uint8Array.fromHex(e);let t=e.length,n=t/2;if(t%2)throw Error(`hex string expected, got unpadded hex of length `+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=oe(e.charCodeAt(i)),a=oe(e.charCodeAt(i+1));if(n===void 0||a===void 0){let t=e[i]+e[i+1];throw Error(`hex string expected, got non-hex character \"`+t+`\" at index `+i)}r[t]=n*16+a}return r}function ce(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function le(e){return typeof e==`string`&&(e=ce(e)),T(e),e}function ue(e){return typeof e==`string`&&(e=ce(e)),T(e),e}function de(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];T(r),t+=r.length}let n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}function fe(e,t){if(t!==void 0&&{}.toString.call(t)!==`[object Object]`)throw Error(`options should be object or undefined`);return Object.assign(e,t)}var pe=class{};function me(e){let t=t=>e().update(le(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function he(e=32){if(S&&typeof S.getRandomValues==`function`)return S.getRandomValues(new Uint8Array(e));if(S&&typeof S.randomBytes==`function`)return Uint8Array.from(S.randomBytes(e));throw Error(`crypto.getRandomValues must be defined`)}function ge(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function _e(e,t,n){return e&t^~e&n}function ve(e,t,n){return e&t^e&n^t&n}var ye=class extends pe{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=ne(this.buffer)}update(e){E(this),e=le(e),T(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=ne(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){E(this),te(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,D(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;ge(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=ne(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}};let A=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),j=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),be=BigInt(2**32-1),xe=BigInt(32);function Se(e,t=!1){return t?{h:Number(e&be),l:Number(e>>xe&be)}:{h:Number(e>>xe&be)|0,l:Number(e&be)|0}}function Ce(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=Se(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}let we=(e,t,n)=>e>>>n,Te=(e,t,n)=>e<<32-n|t>>>n,M=(e,t,n)=>e>>>n|t<<32-n,N=(e,t,n)=>e<<32-n|t>>>n,Ee=(e,t,n)=>e<<64-n|t>>>n-32,De=(e,t,n)=>e>>>n-32|t<<64-n;function P(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}let Oe=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),ke=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,Ae=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),je=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,Me=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),Ne=(e,t,n,r,i,a)=>t+n+r+i+a+(e/2**32|0)|0;function Pe(e){return e(`return this`)}let Fe=(typeof globalThis<`u`?globalThis:typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:Pe(Function)).crypto;function Ie(e){return Fe.getRandomValues(e)}function Le(e=32){return Ie(new Uint8Array(e))}var Re=class extends pe{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ee(e);let n=le(t);if(this.iHash=e.create(),typeof this.iHash.update!=`function`)throw Error(`Expected instance of class which extends utils.Hash`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),D(i)}update(e){return E(this),this.iHash.update(e),this}digestInto(e){E(this),T(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};let ze=(e,t,n)=>new Re(e,t).update(n).digest();ze.create=(e,t)=>new Re(e,t);function Be(e,t,n,r){ee(e);let{c:i,dkLen:a,asyncTick:o}=fe({dkLen:32,asyncTick:10},r);if(w(i),w(a),w(o),i<1)throw Error(`iterations (c) should be >= 1`);let s=ue(t),c=ue(n),l=new Uint8Array(a),u=ze.create(e,s);return{c:i,dkLen:a,asyncTick:o,DK:l,PRF:u,PRFSalt:u._cloneInto().update(c)}}function Ve(e,t,n,r,i){return e.destroy(),t.destroy(),r&&r.destroy(),D(i),n}function He(e,t,n,r){let{c:i,dkLen:a,DK:o,PRF:s,PRFSalt:c}=Be(e,t,n,r),l,u=new Uint8Array(4),d=ne(u),f=new Uint8Array(s.outputLen);for(let e=1,t=0;t<a;e++,t+=s.outputLen){let n=o.subarray(t,t+s.outputLen);d.setInt32(0,e,!1),(l=c._cloneInto(l)).update(u).digestInto(f),n.set(f.subarray(0,n.length));for(let e=1;e<i;e++){s._cloneInto(l).update(f).digestInto(f);for(let e=0;e<n.length;e++)n[e]^=f[e]}}return Ve(s,c,o,l,f)}let Ue=Uint32Array.from([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]),F=new Uint32Array(64);var We=class extends ye{constructor(e=32){super(64,e,8,!1),this.A=A[0]|0,this.B=A[1]|0,this.C=A[2]|0,this.D=A[3]|0,this.E=A[4]|0,this.F=A[5]|0,this.G=A[6]|0,this.H=A[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)F[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=F[e-15],n=F[e-2],r=O(t,7)^O(t,18)^t>>>3,i=O(n,17)^O(n,19)^n>>>10;F[e]=i+F[e-7]+r+F[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=O(o,6)^O(o,11)^O(o,25),u=l+t+_e(o,s,c)+Ue[e]+F[e]|0,d=(O(n,2)^O(n,13)^O(n,22))+ve(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){D(F)}destroy(){this.set(0,0,0,0,0,0,0,0),D(this.buffer)}};let Ge=Ce(`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`.split(`.`).map(e=>BigInt(e))),Ke=Ge[0],qe=Ge[1],I=new Uint32Array(80),L=new Uint32Array(80);var Je=class extends ye{constructor(e=64){super(128,e,16,!1),this.Ah=j[0]|0,this.Al=j[1]|0,this.Bh=j[2]|0,this.Bl=j[3]|0,this.Ch=j[4]|0,this.Cl=j[5]|0,this.Dh=j[6]|0,this.Dl=j[7]|0,this.Eh=j[8]|0,this.El=j[9]|0,this.Fh=j[10]|0,this.Fl=j[11]|0,this.Gh=j[12]|0,this.Gl=j[13]|0,this.Hh=j[14]|0,this.Hl=j[15]|0}get(){let{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:a,Dh:o,Dl:s,Eh:c,El:l,Fh:u,Fl:d,Gh:f,Gl:p,Hh:m,Hl:h}=this;return[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=r|0,this.Ch=i|0,this.Cl=a|0,this.Dh=o|0,this.Dl=s|0,this.Eh=c|0,this.El=l|0,this.Fh=u|0,this.Fl=d|0,this.Gh=f|0,this.Gl=p|0,this.Hh=m|0,this.Hl=h|0}process(e,t){for(let n=0;n<16;n++,t+=4)I[n]=e.getUint32(t),L[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=I[e-15]|0,n=L[e-15]|0,r=M(t,n,1)^M(t,n,8)^we(t,n,7),i=N(t,n,1)^N(t,n,8)^Te(t,n,7),a=I[e-2]|0,o=L[e-2]|0,s=M(a,o,19)^Ee(a,o,61)^we(a,o,6),c=N(a,o,19)^De(a,o,61)^Te(a,o,6),l=Ae(i,c,L[e-7],L[e-16]),u=je(l,r,s,I[e-7],I[e-16]);I[e]=u|0,L[e]=l|0}let{Ah:n,Al:r,Bh:i,Bl:a,Ch:o,Cl:s,Dh:c,Dl:l,Eh:u,El:d,Fh:f,Fl:p,Gh:m,Gl:h,Hh:g,Hl:_}=this;for(let e=0;e<80;e++){let t=M(u,d,14)^M(u,d,18)^Ee(u,d,41),v=N(u,d,14)^N(u,d,18)^De(u,d,41),y=u&f^~u&m,b=d&p^~d&h,x=Me(_,v,b,qe[e],L[e]),S=Ne(x,g,t,y,Ke[e],I[e]),C=x|0,w=M(n,r,28)^Ee(n,r,34)^Ee(n,r,39),T=N(n,r,28)^De(n,r,34)^De(n,r,39),ee=n&i^n&o^i&o,E=r&a^r&s^a&s;g=m|0,_=h|0,m=f|0,h=p|0,f=u|0,p=d|0,{h:u,l:d}=P(c|0,l|0,S|0,C|0),c=o|0,l=s|0,o=i|0,s=a|0,i=n|0,a=r|0;let te=Oe(C,T,E);n=ke(te,S,w,ee),r=te|0}({h:n,l:r}=P(this.Ah|0,this.Al|0,n|0,r|0)),{h:i,l:a}=P(this.Bh|0,this.Bl|0,i|0,a|0),{h:o,l:s}=P(this.Ch|0,this.Cl|0,o|0,s|0),{h:c,l}=P(this.Dh|0,this.Dl|0,c|0,l|0),{h:u,l:d}=P(this.Eh|0,this.El|0,u|0,d|0),{h:f,l:p}=P(this.Fh|0,this.Fl|0,f|0,p|0),{h:m,l:h}=P(this.Gh|0,this.Gl|0,m|0,h|0),{h:g,l:_}=P(this.Hh|0,this.Hl|0,g|0,_|0),this.set(n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_)}roundClean(){D(I,L)}destroy(){D(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};let Ye=me(()=>new We),Xe=me(()=>new Je),Ze=BigInt(0),Qe=BigInt(1)\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n;function $e(e,t){if(typeof t!=`boolean`)throw Error(e+` boolean expected, got `+t)}function et(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);return e===``?Ze:BigInt(`0x`+e)}function tt(e){return et(ae(e))}function R(e){return T(e),et(ae(Uint8Array.from(e).reverse()))}function nt(e,t){return se(e.toString(16).padStart(t*2,`0`))}function z(e,t){return nt(e,t).reverse()}function B(e,t,n){let r;if(typeof t==`string`)try{r=se(t)}catch(t){throw Error(e+` must be hex string or Uint8Array, cause: `+t)}else if(C(t))r=Uint8Array.from(t);else throw Error(e+` must be hex string or Uint8Array`);let i=r.length;if(typeof n==`number`&&i!==n)throw Error(e+` of length `+n+` expected, got `+i);return r}function rt(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}let it=e=>typeof e==`bigint`&&Ze<=e;function at(e,t,n){return it(e)&&it(t)&&it(n)&&t<=e&&e<n}function V(e,t,n,r){if(!at(t,n,r))throw Error(`expected valid `+e+`: `+n+` <= n < `+r+`, got `+t)}function ot(e){let t;for(t=0;e>Ze;e>>=Qe,t+=1);return t}let st=e=>(Qe<<BigInt(e))-Qe;function ct(e,t,n={}){if(!e||typeof e!=`object`)throw Error(`expected valid options object`);function r(t,n,r){let i=e[t];if(r&&i===void 0)return;let a=typeof i;if(a!==n||i===null)throw Error(`param \"${t}\" is invalid: expected ${n}, got ${a}`)}Object.entries(t).forEach(([e,t])=>r(e,t,!1)),Object.entries(n).forEach(([e,t])=>r(e,t,!0))}function lt(e){let t=new WeakMap;return(n,...r)=>{let i=t.get(n);if(i!==void 0)return i;let a=e(n,...r);return t.set(n,a),a}}\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nlet H=BigInt(0),U=BigInt(1),W=BigInt(2),ut=BigInt(3),dt=BigInt(4),ft=BigInt(5),pt=BigInt(8);function G(e,t){let n=e%t;return n>=H?n:t+n}function K(e,t,n){let r=e;for(;t-->H;)r*=r,r%=n;return r}function mt(e,t){if(e===H)throw Error(`invert: expected non-zero number`);if(t<=H)throw Error(`invert: expected positive modulus, got `+t);let n=G(e,t),r=t,i=H,a=U,o=U,s=H;for(;n!==H;){let e=r/n,t=r%n,c=i-o*e,l=a-s*e;r=n,n=t,i=o,a=s,o=c,s=l}if(r!==U)throw Error(`invert: does not exist`);return G(i,t)}function ht(e,t){let n=(e.ORDER+U)/dt,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw Error(`Cannot find square root`);return r}function gt(e,t){let n=(e.ORDER-ft)/pt,r=e.mul(t,W),i=e.pow(r,n),a=e.mul(t,i),o=e.mul(e.mul(a,W),i),s=e.mul(a,e.sub(o,e.ONE));if(!e.eql(e.sqr(s),t))throw Error(`Cannot find square root`);return s}function _t(e){if(e<BigInt(3))throw Error(`sqrt is not defined for small field`);let t=e-U,n=0;for(;t%W===H;)t/=W,n++;let r=W,i=Tt(e);for(;Ct(i,r)===1;)if(r++>1e3)throw Error(`Cannot find square root: probably non-prime P`);if(n===1)return ht;let a=i.pow(r,t),o=(t+U)/W;return function(e,r){if(e.is0(r))return r;if(Ct(e,r)!==1)throw Error(`Cannot find square root`);let i=n,s=e.mul(e.ONE,a),c=e.pow(r,t),l=e.pow(r,o);for(;!e.eql(c,e.ONE);){if(e.is0(c))return e.ZERO;let t=1,n=e.sqr(c);for(;!e.eql(n,e.ONE);)if(t++,n=e.sqr(n),t===i)throw Error(`Cannot find square root`);let r=U<<BigInt(i-t-1),a=e.pow(s,r);i=t,s=e.sqr(a),c=e.mul(c,s),l=e.mul(l,a)}return l}}function vt(e){return e%dt===ut?ht:e%pt===ft?gt:_t(e)}let q=(e,t)=>(G(e,t)&U)===U,yt=[`create`,`isValid`,`is0`,`neg`,`inv`,`sqrt`,`sqr`,`eql`,`add`,`sub`,`mul`,`pow`,`div`,`addN`,`subN`,`mulN`,`sqrN`];function bt(e){return ct(e,yt.reduce((e,t)=>(e[t]=`function`,e),{ORDER:`bigint`,MASK:`bigint`,BYTES:`number`,BITS:`number`})),e}function xt(e,t,n){if(n<H)throw Error(`invalid exponent, negatives unsupported`);if(n===H)return e.ONE;if(n===U)return t;let r=e.ONE,i=t;for(;n>H;)n&U&&(r=e.mul(r,i)),i=e.sqr(i),n>>=U;return r}function St(e,t,n=!1){let r=Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n)),e.ONE),a=e.inv(i);return t.reduceRight((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n)),a),r}function Ct(e,t){let n=(e.ORDER-U)/W,r=e.pow(t,n),i=e.eql(r,e.ONE),a=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!i&&!a&&!o)throw Error(`invalid Legendre symbol result`);return i?1:a?0:-1}function wt(e,t){t!==void 0&&w(t);let n=t===void 0?e.toString(2).length:t;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function Tt(e,t,n=!1,r={}){if(e<=H)throw Error(`invalid field: expected ORDER > 0, got `+e);let i,a;if(typeof t==`object`&&t){if(r.sqrt||n)throw Error(`cannot specify opts in two arguments`);let e=t;e.BITS&&(i=e.BITS),e.sqrt&&(a=e.sqrt),typeof e.isLE==`boolean`&&(n=e.isLE)}else typeof t==`number`&&(i=t),r.sqrt&&(a=r.sqrt);let{nBitLength:o,nByteLength:s}=wt(e,i);if(s>2048)throw Error(`invalid field: expected ORDER of <= 2048 bytes`);let c,l=Object.freeze({ORDER:e,isLE:n,BITS:o,BYTES:s,MASK:st(o),ZERO:H,ONE:U,create:t=>G(t,e),isValid:t=>{if(typeof t!=`bigint`)throw Error(`invalid field element: expected bigint, got `+typeof t);return H<=t&&t<e},is0:e=>e===H,isValidNot0:e=>!l.is0(e)&&l.isValid(e),isOdd:e=>(e&U)===U,neg:t=>G(-t,e),eql:(e,t)=>e===t,sqr:t=>G(t*t,e),add:(t,n)=>G(t+n,e),sub:(t,n)=>G(t-n,e),mul:(t,n)=>G(t*n,e),pow:(e,t)=>xt(l,e,t),div:(t,n)=>G(t*mt(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>mt(t,e),sqrt:a||(t=>(c||=vt(e),c(l,t))),toBytes:e=>n?z(e,s):nt(e,s),fromBytes:e=>{if(e.length!==s)throw Error(`Field.fromBytes: expected `+s+` bytes, got `+e.length);return n?R(e):tt(e)},invertBatch:e=>St(l,e),cmov:(e,t,n)=>n?t:e});return Object.freeze(l)}\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nlet Et=BigInt(0),Dt=BigInt(1);function Ot(e,t){let n=t.negate();return e?n:t}function kt(e,t,n){let r=t===`pz`?e=>e.pz:e=>e.ez,i=St(e.Fp,n.map(r));return n.map((e,t)=>e.toAffine(i[t])).map(e.fromAffine)}function At(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error(`invalid window size, expected [1..`+t+`], got W=`+e)}function jt(e,t){At(e,t);let n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e;return{windows:n,windowSize:r,mask:st(e),maxNumber:i,shiftBy:BigInt(e)}}function Mt(e,t,n){let{windowSize:r,mask:i,maxNumber:a,shiftBy:o}=n,s=Number(e&i),c=e>>o;s>r&&(s-=a,c+=Dt);let l=t*r,u=l+Math.abs(s)-1,d=s===0,f=s<0,p=t%2!=0;return{nextN:c,offset:u,isZero:d,isNeg:f,isNegF:p,offsetF:l}}function Nt(e,t){if(!Array.isArray(e))throw Error(`array expected`);e.forEach((e,n)=>{if(!(e instanceof t))throw Error(`invalid point at index `+n)})}function Pt(e,t){if(!Array.isArray(e))throw Error(`array of scalars expected`);e.forEach((e,n)=>{if(!t.isValid(e))throw Error(`invalid scalar at index `+n)})}let Ft=new WeakMap,It=new WeakMap;function Lt(e){return It.get(e)||1}function Rt(e){if(e!==Et)throw Error(`invalid wNAF`)}function zt(e,t){return{constTimeNegate:Ot,hasPrecomputes(e){return Lt(e)!==1},unsafeLadder(t,n,r=e.ZERO){let i=t;for(;n>Et;)n&Dt&&(r=r.add(i)),i=i.double(),n>>=Dt;return r},precomputeWindow(e,n){let{windows:r,windowSize:i}=jt(n,t),a=[],o=e,s=o;for(let e=0;e<r;e++){s=o,a.push(s);for(let e=1;e<i;e++)s=s.add(o),a.push(s);o=s.double()}return a},wNAF(n,r,i){let a=e.ZERO,o=e.BASE,s=jt(n,t);for(let e=0;e<s.windows;e++){let{nextN:t,offset:n,isZero:c,isNeg:l,isNegF:u,offsetF:d}=Mt(i,e,s);i=t,c?o=o.add(Ot(u,r[d])):a=a.add(Ot(l,r[n]))}return Rt(i),{p:a,f:o}},wNAFUnsafe(n,r,i,a=e.ZERO){let o=jt(n,t);for(let e=0;e<o.windows&&i!==Et;e++){let{nextN:t,offset:n,isZero:s,isNeg:c}=Mt(i,e,o);if(i=t,!s){let e=r[n];a=a.add(c?e.negate():e)}}return Rt(i),a},getPrecomputes(e,t,n){let r=Ft.get(t);return r||(r=this.precomputeWindow(t,e),e!==1&&(typeof n==`function`&&(r=n(r)),Ft.set(t,r))),r},wNAFCached(e,t,n){let r=Lt(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)},wNAFCachedUnsafe(e,t,n,r){let i=Lt(e);return i===1?this.unsafeLadder(e,t,r):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),t,r)},setWindowSize(e,n){At(n,t),It.set(e,n),Ft.delete(e)}}}function Bt(e,t,n,r){Nt(n,e),Pt(r,t);let i=n.length,a=r.length;if(i!==a)throw Error(`arrays of points and scalars must have equal length`);let o=e.ZERO,s=ot(BigInt(i)),c=1;s>12?c=s-3:s>4?c=s-2:s>0&&(c=2);let l=st(c),u=Array(Number(l)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c,f=o;for(let e=d;e>=0;e-=c){u.fill(o);for(let t=0;t<a;t++){let i=r[t],a=Number(i>>BigInt(e)&l);u[a]=u[a].add(n[t])}let t=o;for(let e=u.length-1,n=o;e>0;e--)n=n.add(u[e]),t=t.add(n);if(f=f.add(t),e!==0)for(let e=0;e<c;e++)f=f.double()}return f}function Vt(e,t){if(t){if(t.ORDER!==e)throw Error(`Field.ORDER must match order: Fp == p, Fn == n`);return bt(t),t}else return Tt(e)}function Ht(e,t,n={}){if(!t||typeof t!=`object`)throw Error(`expected valid ${e} CURVE object`);for(let e of[`p`,`n`,`h`]){let n=t[e];if(!(typeof n==`bigint`&&n>Et))throw Error(`CURVE.${e} must be positive bigint`)}let r=Vt(t.p,n.Fp),i=Vt(t.n,n.Fn),a=[`Gx`,`Gy`,`a`,e===`weierstrass`?`b`:`d`];for(let e of a)if(!r.isValid(t[e]))throw Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return{Fp:r,Fn:i}}\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nlet J=BigInt(0),Y=BigInt(1),Ut=BigInt(2),Wt=BigInt(8),Gt={zip215:!0};function Kt(e,t,n,r){let i=e.sqr(n),a=e.sqr(r),o=e.add(e.mul(t.a,i),a),s=e.add(e.ONE,e.mul(t.d,e.mul(i,a)));return e.eql(o,s)}function qt(e,t={}){let{Fp:n,Fn:r}=Ht(`edwards`,e,t),{h:i,n:a}=e;ct(t,{},{uvRatio:`function`});let o=Ut<<BigInt(r.BYTES*8)-Y,s=e=>n.create(e),c=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(n.div(e,t))}}catch{return{isValid:!1,value:J}}});if(!Kt(n,e,e.Gx,e.Gy))throw Error(`bad curve params: generator point`);function l(e,t,n=!1){let r=n?Y:J;return V(`coordinate `+e,t,r,o),t}function u(e){if(!(e instanceof p))throw Error(`ExtendedPoint expected`)}let d=lt((e,t)=>{let{ex:r,ey:i,ez:a}=e,o=e.is0();t??=o?Wt:n.inv(a);let c=s(r*t),l=s(i*t),u=s(a*t);if(o)return{x:J,y:Y};if(u!==Y)throw Error(`invZ was invalid`);return{x:c,y:l}}),f=lt(t=>{let{a:n,d:r}=e;if(t.is0())throw Error(`bad point: ZERO`);let{ex:i,ey:a,ez:o,et:c}=t,l=s(i*i),u=s(a*a),d=s(o*o),f=s(d*d),p=s(l*n);if(s(d*s(p+u))!==s(f+s(r*s(l*u))))throw Error(`bad point: equation left != right (1)`);if(s(i*a)!==s(o*c))throw Error(`bad point: equation left != right (2)`);return!0});class p{constructor(e,t,n,r){this.ex=l(`x`,e),this.ey=l(`y`,t),this.ez=l(`z`,n,!0),this.et=l(`t`,r),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof p)throw Error(`extended point not allowed`);let{x:t,y:n}=e||{};return l(`x`,t),l(`y`,n),new p(t,n,Y,s(t*n))}static normalizeZ(e){return kt(p,`ez`,e)}static msm(e,t){return Bt(p,r,e,t)}_setWindowSize(e){this.precompute(e)}precompute(e=8,t=!0){return m.setWindowSize(this,e),t||this.multiply(Ut),this}assertValidity(){f(this)}equals(e){u(e);let{ex:t,ey:n,ez:r}=this,{ex:i,ey:a,ez:o}=e,c=s(t*o),l=s(i*r),d=s(n*o),f=s(a*r);return c===l&&d===f}is0(){return this.equals(p.ZERO)}negate(){return new p(s(-this.ex),this.ey,this.ez,s(-this.et))}double(){let{a:t}=e,{ex:n,ey:r,ez:i}=this,a=s(n*n),o=s(r*r),c=s(Ut*s(i*i)),l=s(t*a),u=n+r,d=s(s(u*u)-a-o),f=l+o,m=f-c,h=l-o,g=s(d*m),_=s(f*h),v=s(d*h),y=s(m*f);return new p(g,_,y,v)}add(t){u(t);let{a:n,d:r}=e,{ex:i,ey:a,ez:o,et:c}=this,{ex:l,ey:d,ez:f,et:m}=t,h=s(i*l),g=s(a*d),_=s(c*r*m),v=s(o*f),y=s((i+a)*(l+d)-h-g),b=v-_,x=v+_,S=s(g-n*h),C=s(y*b),w=s(x*S),T=s(y*S),ee=s(b*x);return new p(C,w,ee,T)}subtract(e){return this.add(e.negate())}multiply(e){let t=e;V(`scalar`,t,Y,a);let{p:n,f:r}=m.wNAFCached(this,t,p.normalizeZ);return p.normalizeZ([n,r])[0]}multiplyUnsafe(e,t=p.ZERO){let n=e;return V(`scalar`,n,J,a),n===J?p.ZERO:this.is0()||n===Y?this:m.wNAFCachedUnsafe(this,n,p.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}isTorsionFree(){return m.wNAFCachedUnsafe(this,a).is0()}toAffine(e){return d(this,e)}clearCofactor(){return i===Y?this:this.multiplyUnsafe(i)}static fromBytes(e,t=!1){return T(e),this.fromHex(e,t)}static fromHex(t,r=!1){let{d:i,a}=e,l=n.BYTES;t=B(`pointHex`,t,l),$e(`zip215`,r);let u=t.slice(),d=t[l-1];u[l-1]=d&-129;let f=R(u),m=r?o:n.ORDER;V(`pointHex.y`,f,J,m);let h=s(f*f),g=s(h-Y),_=s(i*h-a),{isValid:v,value:y}=c(g,_);if(!v)throw Error(`Point.fromHex: invalid y coordinate`);let b=(y&Y)===Y,x=(d&128)!=0;if(!r&&y===J&&x)throw Error(`Point.fromHex: x=0 and x_0=1`);return x!==b&&(y=s(-y)),p.fromAffine({x:y,y:f})}static fromPrivateScalar(e){return p.BASE.multiply(e)}toBytes(){let{x:e,y:t}=this.toAffine(),r=z(t,n.BYTES);return r[r.length-1]|=e&Y?128:0,r}toRawBytes(){return this.toBytes()}toHex(){return ae(this.toBytes())}toString(){return`<Point ${this.is0()?`ZERO`:this.toHex()}>`}}p.BASE=new p(e.Gx,e.Gy,Y,s(e.Gx*e.Gy)),p.ZERO=new p(J,Y,Y,J),p.Fp=n,p.Fn=r;let m=zt(p,r.BYTES*8);return p}function Jt(e,t){ct(t,{hash:`function`},{adjustScalarBytes:`function`,randomBytes:`function`,domain:`function`,prehash:`function`,mapToCurve:`function`});let{prehash:n,hash:r}=t,{BASE:i,Fp:a,Fn:o}=e,s=o.ORDER,c=t.randomBytes||he,l=t.adjustScalarBytes||(e=>e),u=t.domain||((e,t,n)=>{if($e(`phflag`,n),t.length||n)throw Error(`Contexts/pre-hash are not supported`);return e});function d(e){return o.create(e)}function f(e){return d(R(e))}function p(e){let t=a.BYTES;e=B(`private key`,e,t);let n=B(`hashed private key`,r(e),2*t),i=l(n.slice(0,t));return{head:i,prefix:n.slice(t,2*t),scalar:f(i)}}function m(e){let{head:t,prefix:n,scalar:r}=p(e),a=i.multiply(r);return{head:t,prefix:n,scalar:r,point:a,pointBytes:a.toBytes()}}function h(e){return m(e).pointBytes}function g(e=Uint8Array.of(),...t){let i=de(...t);return f(r(u(i,B(`context`,e),!!n)))}function _(e,t,r={}){e=B(`message`,e),n&&(e=n(e));let{prefix:o,scalar:c,pointBytes:l}=m(t),u=g(r.context,o,e),f=i.multiply(u).toBytes(),p=d(u+g(r.context,f,l,e)*c);V(`signature.s`,p,J,s);let h=a.BYTES;return B(`result`,de(f,z(p,h)),h*2)}let v=Gt;function y(t,r,o,s=v){let{context:c,zip215:l}=s,u=a.BYTES;t=B(`signature`,t,2*u),r=B(`message`,r),o=B(`publicKey`,o,u),l!==void 0&&$e(`zip215`,l),n&&(r=n(r));let d=R(t.slice(u,2*u)),f,p,m;try{f=e.fromHex(o,l),p=e.fromHex(t.slice(0,u),l),m=i.multiplyUnsafe(d)}catch{return!1}if(!l&&f.isSmallOrder())return!1;let h=g(c,p.toBytes(),f.toBytes(),r);return p.add(f.multiplyUnsafe(h)).subtract(m).clearCofactor().is0()}return i.precompute(8),{getPublicKey:h,sign:_,verify:y,utils:{getExtendedPublicKey:m,randomPrivateKey:()=>c(a.BYTES),precompute(t=8,n=e.BASE){return n.precompute(t,!1)}},Point:e}}function Yt(e){let t={a:e.a,d:e.d,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy};return{CURVE:t,curveOpts:{Fp:e.Fp,Fn:Tt(t.n,e.nBitLength,!0),uvRatio:e.uvRatio},eddsaOpts:{hash:e.hash,randomBytes:e.randomBytes,adjustScalarBytes:e.adjustScalarBytes,domain:e.domain,prehash:e.prehash,mapToCurve:e.mapToCurve}}}function Xt(e,t){return Object.assign({},t,{ExtendedPoint:t.Point,CURVE:e})}function Zt(e){let{CURVE:t,curveOpts:n,eddsaOpts:r}=Yt(e);return Xt(e,Jt(qt(t,n),r))}\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nlet Qt=BigInt(0),X=BigInt(1),$t=BigInt(2),en=BigInt(5),tn={p:BigInt(`0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed`),n:BigInt(`0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed`),h:BigInt(8),a:BigInt(`0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec`),d:BigInt(`0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3`),Gx:BigInt(`0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a`),Gy:BigInt(`0x6666666666666666666666666666666666666666666666666666666666666658`)};function nn(e){let t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),a=tn.p,o=e*e%a*e%a,s=K(K(o,$t,a)*o%a,X,a)*e%a,c=K(s,en,a)*s%a,l=K(c,t,a)*c%a,u=K(l,n,a)*l%a,d=K(u,r,a)*u%a;return{pow_p_5_8:K(K(K(K(d,i,a)*d%a,i,a)*d%a,t,a)*c%a,$t,a)*e%a,b2:o}}function rn(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}let an=BigInt(`19681161376707505956807079304988542015446066515923890162744021073123829784752`);function on(e,t){let n=tn.p,r=G(t*t*t,n),i=nn(e*G(r*r*t,n)).pow_p_5_8,a=G(e*r*i,n),o=G(t*a*a,n),s=a,c=G(a*an,n),l=o===e,u=o===G(-e,n),d=o===G(-e*an,n);return l&&(a=s),(u||d)&&(a=c),q(a,n)&&(a=G(-a,n)),{isValid:l||u,value:a}}let Z=Tt(tn.p,void 0,!0),Q=Zt({...tn,Fp:Z,hash:Xe,adjustScalarBytes:rn,uvRatio:on});function sn(e){if(!(e instanceof $))throw Error(`RistrettoPoint expected`)}let cn=an,ln=BigInt(`25063068953384623474111414158702152701244531502492656460079210482610430750235`),un=BigInt(`54469307008909316920995813868745141605393597292927456921205312896311721017578`),dn=BigInt(`1159843021668779879193775521855586647937357759715417654439879720876111806838`),fn=BigInt(`40440834346308536858101042469323190826248399146238708352240133220865137265952`),pn=e=>on(X,e),mn=BigInt(`0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`),hn=e=>Q.CURVE.Fp.create(R(e)&mn);function gn(e){let{d:t}=Q.CURVE,n=Q.CURVE.Fp.ORDER,r=Q.CURVE.Fp.create,i=r(cn*e*e),a=r((i+X)*dn),o=BigInt(-1),s=r((o-t*i)*r(i+t)),{isValid:c,value:l}=on(a,s),u=r(l*e);q(u,n)||(u=r(-u)),c||(l=u),c||(o=i);let d=r(o*(i-X)*fn-s),f=l*l,p=r((l+l)*s),m=r(d*ln),h=r(X-f),g=r(X+f);return new Q.Point(r(p*g),r(h*m),r(m*g),r(p*h))}var $=class e{constructor(e){this.ep=e}static fromAffine(t){return new e(Q.Point.fromAffine(t))}static hashToCurve(t){t=B(`ristrettoHash`,t,64);let n=gn(hn(t.slice(0,32))),r=gn(hn(t.slice(32,64)));return new e(n.add(r))}static fromBytes(e){return T(e),this.fromHex(e)}static fromHex(t){t=B(`ristrettoHex`,t,32);let{a:n,d:r}=Q.CURVE,i=Z.ORDER,a=Z.create,o=`RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint`,s=hn(t);if(!rt(z(s,32),t)||q(s,i))throw Error(o);let c=a(s*s),l=a(X+n*c),u=a(X-n*c),d=a(l*l),f=a(u*u),p=a(n*r*d-f),{isValid:m,value:h}=pn(a(p*f)),g=a(h*u),_=a(h*g*p),v=a((s+s)*g);q(v,i)&&(v=a(-v));let y=a(l*_),b=a(v*y);if(!m||q(b,i)||y===Qt)throw Error(o);return new e(new Q.Point(v,y,X,b))}static msm(t,n){let r=Tt(Q.CURVE.n,Q.CURVE.nBitLength);return Bt(e,r,t,n)}toBytes(){let{ex:e,ey:t,ez:n,et:r}=this.ep,i=Z.ORDER,a=Z.create,o=a(a(n+t)*a(n-t)),s=a(e*t),c=a(s*s),{value:l}=pn(a(o*c)),u=a(l*o),d=a(l*s),f=a(u*d*r),p;if(q(r*f,i)){let n=a(t*cn),r=a(e*cn);e=n,t=r,p=a(u*un)}else p=d;q(e*f,i)&&(t=a(-t));let m=a((n-t)*p);return q(m,i)&&(m=a(-m)),z(m,32)}toRawBytes(){return this.toBytes()}toHex(){return ae(this.toBytes())}toString(){return this.toHex()}equals(e){sn(e);let{ex:t,ey:n}=this.ep,{ex:r,ey:i}=e.ep,a=Z.create,o=a(t*i)===a(n*r),s=a(n*i)===a(t*r);return o||s}add(t){return sn(t),new e(this.ep.add(t.ep))}subtract(t){return sn(t),new e(this.ep.subtract(t.ep))}multiply(t){return new e(this.ep.multiply(t))}multiplyUnsafe(t){return new e(this.ep.multiplyUnsafe(t))}double(){return new e(this.ep.double())}negate(){return new e(this.ep.negate())}};let _n=($.BASE||=new $(Q.Point.BASE),$.ZERO||=new $(Q.Point.ZERO),$),vn=Xe,yn=BigInt(3);function bn(e,t,...n){if(!C(t))throw Error(`${e}: Uint8Array expected`);if(n.length&&!n.includes(t.length))throw Error(`${e}: Uint8Array expected of length ${n}, not of length=${t.length}`)}function xn(...e){for(let t of e)t.fill(0)}Q.CURVE.n;let Sn=st(256),Cn=e=>z(e<<yn&Sn,32),wn=e=>R(e)>>yn;function Tn(e){bn(`seed`,e,32);let t=vn(e);t[0]&=248,t[31]&=63,t[31]|=64;let n=Cn(wn(t.subarray(0,32))),r=t.subarray(32,64),i=de(n,r);return xn(n,r,t),i}ce(`substrate`);function En(e,t=Le(),n=2048,r){return{password:He(vn,x(e),x(t),{c:n,dkLen:64}),rounds:n,salt:t}}var Dn={256:Ye,512:vn},On=Dn[256];Dn[512];var kn=`abandon|ability|able|about|above|absent|absorb|abstract|absurd|abuse|access|accident|account|accuse|achieve|acid|acoustic|acquire|across|act|action|actor|actress|actual|adapt|add|addict|address|adjust|admit|adult|advance|advice|aerobic|affair|afford|afraid|again|age|agent|agree|ahead|aim|air|airport|aisle|alarm|album|alcohol|alert|alien|all|alley|allow|almost|alone|alpha|already|also|alter|always|amateur|amazing|among|amount|amused|analyst|anchor|ancient|anger|angle|angry|animal|ankle|announce|annual|another|answer|antenna|antique|anxiety|any|apart|apology|appear|apple|approve|april|arch|arctic|area|arena|argue|arm|armed|armor|army|around|arrange|arrest|arrive|arrow|art|artefact|artist|artwork|ask|aspect|assault|asset|assist|assume|asthma|athlete|atom|attack|attend|attitude|attract|auction|audit|august|aunt|author|auto|autumn|average|avocado|avoid|awake|aware|away|awesome|awful|awkward|axis|baby|bachelor|bacon|badge|bag|balance|balcony|ball|bamboo|banana|banner|bar|barely|bargain|barrel|base|basic|basket|battle|beach|bean|beauty|because|become|beef|before|begin|behave|behind|believe|below|belt|bench|benefit|best|betray|better|between|beyond|bicycle|bid|bike|bind|biology|bird|birth|bitter|black|blade|blame|blanket|blast|bleak|bless|blind|blood|blossom|blouse|blue|blur|blush|board|boat|body|boil|bomb|bone|bonus|book|boost|border|boring|borrow|boss|bottom|bounce|box|boy|bracket|brain|brand|brass|brave|bread|breeze|brick|bridge|brief|bright|bring|brisk|broccoli|broken|bronze|broom|brother|brown|brush|bubble|buddy|budget|buffalo|build|bulb|bulk|bullet|bundle|bunker|burden|burger|burst|bus|business|busy|butter|buyer|buzz|cabbage|cabin|cable|cactus|cage|cake|call|calm|camera|camp|can|canal|cancel|candy|cannon|canoe|canvas|canyon|capable|capital|captain|car|carbon|card|cargo|carpet|carry|cart|case|cash|casino|castle|casual|cat|catalog|catch|category|cattle|caught|cause|caution|cave|ceiling|celery|cement|census|century|cereal|certain|chair|chalk|champion|change|chaos|chapter|charge|chase|chat|cheap|check|cheese|chef|cherry|chest|chicken|chief|child|chimney|choice|choose|chronic|chuckle|chunk|churn|cigar|cinnamon|circle|citizen|city|civil|claim|clap|clarify|claw|clay|clean|clerk|clever|click|client|cliff|climb|clinic|clip|clock|clog|close|cloth|cloud|clown|club|clump|cluster|clutch|coach|coast|coconut|code|coffee|coil|coin|collect|color|column|combine|come|comfort|comic|common|company|concert|conduct|confirm|congress|connect|consider|control|convince|cook|cool|copper|copy|coral|core|corn|correct|cost|cotton|couch|country|couple|course|cousin|cover|coyote|crack|cradle|craft|cram|crane|crash|crater|crawl|crazy|cream|credit|creek|crew|cricket|crime|crisp|critic|crop|cross|crouch|crowd|crucial|cruel|cruise|crumble|crunch|crush|cry|crystal|cube|culture|cup|cupboard|curious|current|curtain|curve|cushion|custom|cute|cycle|dad|damage|damp|dance|danger|daring|dash|daughter|dawn|day|deal|debate|debris|decade|december|decide|decline|decorate|decrease|deer|defense|define|defy|degree|delay|deliver|demand|demise|denial|dentist|deny|depart|depend|deposit|depth|deputy|derive|describe|desert|design|desk|despair|destroy|detail|detect|develop|device|devote|diagram|dial|diamond|diary|dice|diesel|diet|differ|digital|dignity|dilemma|dinner|dinosaur|direct|dirt|disagree|discover|disease|dish|dismiss|disorder|display|distance|divert|divide|divorce|dizzy|doctor|document|dog|doll|dolphin|domain|donate|donkey|donor|door|dose|double|dove|draft|dragon|drama|drastic|draw|dream|dress|drift|drill|drink|drip|drive|drop|drum|dry|duck|dumb|dune|during|dust|dutch|duty|dwarf|dynamic|eager|eagle|early|earn|earth|easily|east|easy|echo|ecology|economy|edge|edit|educate|effort|egg|eight|either|elbow|elder|electric|elegant|element|elephant|elevator|elite|else|embark|embody|embrace|emerge|emotion|employ|empower|empty|enable|enact|end|endless|endorse|enemy|energy|enforce|engage|engine|enhance|enjoy|enlist|enough|enrich|enroll|ensure|enter|entire|entry|envelope|episode|equal|equip|era|erase|erode|erosion|error|erupt|escape|essay|essence|estate|eternal|ethics|evidence|evil|evoke|evolve|exact|example|excess|exchange|excite|exclude|excuse|execute|exercise|exhaust|exhibit|exile|exist|exit|exotic|expand|expect|expire|explain|expose|express|extend|extra|eye|eyebrow|fabric|face|faculty|fade|faint|faith|fall|false|fame|family|famous|fan|fancy|fantasy|farm|fashion|fat|fatal|father|fatigue|fault|favorite|feature|february|federal|fee|feed|feel|female|fence|festival|fetch|fever|few|fiber|fiction|field|figure|file|film|filter|final|find|fine|finger|finish|fire|firm|first|fiscal|fish|fit|fitness|fix|flag|flame|flash|flat|flavor|flee|flight|flip|float|flock|floor|flower|fluid|flush|fly|foam|focus|fog|foil|fold|follow|food|foot|force|forest|forget|fork|fortune|forum|forward|fossil|foster|found|fox|fragile|frame|frequent|fresh|friend|fringe|frog|front|frost|frown|frozen|fruit|fuel|fun|funny|furnace|fury|future|gadget|gain|galaxy|gallery|game|gap|garage|garbage|garden|garlic|garment|gas|gasp|gate|gather|gauge|gaze|general|genius|genre|gentle|genuine|gesture|ghost|giant|gift|giggle|ginger|giraffe|girl|give|glad|glance|glare|glass|glide|glimpse|globe|gloom|glory|glove|glow|glue|goat|goddess|gold|good|goose|gorilla|gospel|gossip|govern|gown|grab|grace|grain|grant|grape|grass|gravity|great|green|grid|grief|grit|grocery|group|grow|grunt|guard|guess|guide|guilt|guitar|gun|gym|habit|hair|half|hammer|hamster|hand|happy|harbor|hard|harsh|harvest|hat|have|hawk|hazard|head|health|heart|heavy|hedgehog|height|hello|helmet|help|hen|hero|hidden|high|hill|hint|hip|hire|history|hobby|hockey|hold|hole|holiday|hollow|home|honey|hood|hope|horn|horror|horse|hospital|host|hotel|hour|hover|hub|huge|human|humble|humor|hundred|hungry|hunt|hurdle|hurry|hurt|husband|hybrid|ice|icon|idea|identify|idle|ignore|ill|illegal|illness|image|imitate|immense|immune|impact|impose|improve|impulse|inch|include|income|increase|index|indicate|indoor|industry|infant|inflict|inform|inhale|inherit|initial|inject|injury|inmate|inner|innocent|input|inquiry|insane|insect|inside|inspire|install|intact|interest|into|invest|invite|involve|iron|island|isolate|issue|item|ivory|jacket|jaguar|jar|jazz|jealous|jeans|jelly|jewel|job|join|joke|journey|joy|judge|juice|jump|jungle|junior|junk|just|kangaroo|keen|keep|ketchup|key|kick|kid|kidney|kind|kingdom|kiss|kit|kitchen|kite|kitten|kiwi|knee|knife|knock|know|lab|label|labor|ladder|lady|lake|lamp|language|laptop|large|later|latin|laugh|laundry|lava|law|lawn|lawsuit|layer|lazy|leader|leaf|learn|leave|lecture|left|leg|legal|legend|leisure|lemon|lend|length|lens|leopard|lesson|letter|level|liar|liberty|library|license|life|lift|light|like|limb|limit|link|lion|liquid|list|little|live|lizard|load|loan|lobster|local|lock|logic|lonely|long|loop|lottery|loud|lounge|love|loyal|lucky|luggage|lumber|lunar|lunch|luxury|lyrics|machine|mad|magic|magnet|maid|mail|main|major|make|mammal|man|manage|mandate|mango|mansion|manual|maple|marble|march|margin|marine|market|marriage|mask|mass|master|match|material|math|matrix|matter|maximum|maze|meadow|mean|measure|meat|mechanic|medal|media|melody|melt|member|memory|mention|menu|mercy|merge|merit|merry|mesh|message|metal|method|middle|midnight|milk|million|mimic|mind|minimum|minor|minute|miracle|mirror|misery|miss|mistake|mix|mixed|mixture|mobile|model|modify|mom|moment|monitor|monkey|monster|month|moon|moral|more|morning|mosquito|mother|motion|motor|mountain|mouse|move|movie|much|muffin|mule|multiply|muscle|museum|mushroom|music|must|mutual|myself|mystery|myth|naive|name|napkin|narrow|nasty|nation|nature|near|neck|need|negative|neglect|neither|nephew|nerve|nest|net|network|neutral|never|news|next|nice|night|noble|noise|nominee|noodle|normal|north|nose|notable|note|nothing|notice|novel|now|nuclear|number|nurse|nut|oak|obey|object|oblige|obscure|observe|obtain|obvious|occur|ocean|october|odor|off|offer|office|often|oil|okay|old|olive|olympic|omit|once|one|onion|online|only|open|opera|opinion|oppose|option|orange|orbit|orchard|order|ordinary|organ|orient|original|orphan|ostrich|other|outdoor|outer|output|outside|oval|oven|over|own|owner|oxygen|oyster|ozone|pact|paddle|page|pair|palace|palm|panda|panel|panic|panther|paper|parade|parent|park|parrot|party|pass|patch|path|patient|patrol|pattern|pause|pave|payment|peace|peanut|pear|peasant|pelican|pen|penalty|pencil|people|pepper|perfect|permit|person|pet|phone|photo|phrase|physical|piano|picnic|picture|piece|pig|pigeon|pill|pilot|pink|pioneer|pipe|pistol|pitch|pizza|place|planet|plastic|plate|play|please|pledge|pluck|plug|plunge|poem|poet|point|polar|pole|police|pond|pony|pool|popular|portion|position|possible|post|potato|pottery|poverty|powder|power|practice|praise|predict|prefer|prepare|present|pretty|prevent|price|pride|primary|print|priority|prison|private|prize|problem|process|produce|profit|program|project|promote|proof|property|prosper|protect|proud|provide|public|pudding|pull|pulp|pulse|pumpkin|punch|pupil|puppy|purchase|purity|purpose|purse|push|put|puzzle|pyramid|quality|quantum|quarter|question|quick|quit|quiz|quote|rabbit|raccoon|race|rack|radar|radio|rail|rain|raise|rally|ramp|ranch|random|range|rapid|rare|rate|rather|raven|raw|razor|ready|real|reason|rebel|rebuild|recall|receive|recipe|record|recycle|reduce|reflect|reform|refuse|region|regret|regular|reject|relax|release|relief|rely|remain|remember|remind|remove|render|renew|rent|reopen|repair|repeat|replace|report|require|rescue|resemble|resist|resource|response|result|retire|retreat|return|reunion|reveal|review|reward|rhythm|rib|ribbon|rice|rich|ride|ridge|rifle|right|rigid|ring|riot|ripple|risk|ritual|rival|river|road|roast|robot|robust|rocket|romance|roof|rookie|room|rose|rotate|rough|round|route|royal|rubber|rude|rug|rule|run|runway|rural|sad|saddle|sadness|safe|sail|salad|salmon|salon|salt|salute|same|sample|sand|satisfy|satoshi|sauce|sausage|save|say|scale|scan|scare|scatter|scene|scheme|school|science|scissors|scorpion|scout|scrap|screen|script|scrub|sea|search|season|seat|second|secret|section|security|seed|seek|segment|select|sell|seminar|senior|sense|sentence|series|service|session|settle|setup|seven|shadow|shaft|shallow|share|shed|shell|sheriff|shield|shift|shine|ship|shiver|shock|shoe|shoot|shop|short|shoulder|shove|shrimp|shrug|shuffle|shy|sibling|sick|side|siege|sight|sign|silent|silk|silly|silver|similar|simple|since|sing|siren|sister|situate|six|size|skate|sketch|ski|skill|skin|skirt|skull|slab|slam|sleep|slender|slice|slide|slight|slim|slogan|slot|slow|slush|small|smart|smile|smoke|smooth|snack|snake|snap|sniff|snow|soap|soccer|social|sock|soda|soft|solar|soldier|solid|solution|solve|someone|song|soon|sorry|sort|soul|sound|soup|source|south|space|spare|spatial|spawn|speak|special|speed|spell|spend|sphere|spice|spider|spike|spin|spirit|split|spoil|sponsor|spoon|sport|spot|spray|spread|spring|spy|square|squeeze|squirrel|stable|stadium|staff|stage|stairs|stamp|stand|start|state|stay|steak|steel|stem|step|stereo|stick|still|sting|stock|stomach|stone|stool|story|stove|strategy|street|strike|strong|struggle|student|stuff|stumble|style|subject|submit|subway|success|such|sudden|suffer|sugar|suggest|suit|summer|sun|sunny|sunset|super|supply|supreme|sure|surface|surge|surprise|surround|survey|suspect|sustain|swallow|swamp|swap|swarm|swear|sweet|swift|swim|swing|switch|sword|symbol|symptom|syrup|system|table|tackle|tag|tail|talent|talk|tank|tape|target|task|taste|tattoo|taxi|teach|team|tell|ten|tenant|tennis|tent|term|test|text|thank|that|theme|then|theory|there|they|thing|this|thought|three|thrive|throw|thumb|thunder|ticket|tide|tiger|tilt|timber|time|tiny|tip|tired|tissue|title|toast|tobacco|today|toddler|toe|together|toilet|token|tomato|tomorrow|tone|tongue|tonight|tool|tooth|top|topic|topple|torch|tornado|tortoise|toss|total|tourist|toward|tower|town|toy|track|trade|traffic|tragic|train|transfer|trap|trash|travel|tray|treat|tree|trend|trial|tribe|trick|trigger|trim|trip|trophy|trouble|truck|true|truly|trumpet|trust|truth|try|tube|tuition|tumble|tuna|tunnel|turkey|turn|turtle|twelve|twenty|twice|twin|twist|two|type|typical|ugly|umbrella|unable|unaware|uncle|uncover|under|undo|unfair|unfold|unhappy|uniform|unique|unit|universe|unknown|unlock|until|unusual|unveil|update|upgrade|uphold|upon|upper|upset|urban|urge|usage|use|used|useful|useless|usual|utility|vacant|vacuum|vague|valid|valley|valve|van|vanish|vapor|various|vast|vault|vehicle|velvet|vendor|venture|venue|verb|verify|version|very|vessel|veteran|viable|vibrant|vicious|victory|video|view|village|vintage|violin|virtual|virus|visa|visit|visual|vital|vivid|vocal|voice|void|volcano|volume|vote|voyage|wage|wagon|wait|walk|wall|walnut|want|warfare|warm|warrior|wash|wasp|waste|water|wave|way|wealth|weapon|wear|weasel|weather|web|wedding|weekend|weird|welcome|west|wet|whale|what|wheat|wheel|when|where|whip|whisper|wide|width|wife|wild|will|win|window|wine|wing|wink|winner|winter|wire|wisdom|wise|wish|witness|wolf|woman|wonder|wood|wool|word|work|world|worry|worth|wrap|wreck|wrestle|wrist|write|wrong|yard|year|yellow|you|young|youth|zebra|zero|zone|zoo`.split(`|`),An=`Invalid mnemonic`,jn=`Invalid entropy`,Mn=`Invalid mnemonic checksum`;function Nn(e){return(e||``).normalize(`NFKD`)}function Pn(e){return Number.parseInt(e,2)}function Fn(e){return e.map(e=>e.toString(2).padStart(8,`0`)).join(``)}function In(e){return Fn(Array.from(On(e))).slice(0,e.length*8/32)}function Ln(e,t=kn){let n=Nn(e).split(` `);if(n.length%3!=0)throw Error(An);let r=n.map(e=>{let n=t.indexOf(e);if(n===-1)throw Error(An);return n.toString(2).padStart(11,`0`)}).join(``),i=Math.floor(r.length/33)*32,a=r.slice(0,i),o=r.slice(i),s=a.match(/(.{1,8})/g)?.map(Pn);if(!s||s.length%4!=0||s.length<16||s.length>32)throw Error(jn);let c=x(s);if(In(c)!==o)throw Error(Mn);return c}function Rn(e,t=kn){if(e.length%4!=0||e.length<16||e.length>32)throw Error(jn);let n=`${Fn(Array.from(e))}${In(e)}`.match(/(.{1,11})/g)?.map(e=>t[Pn(e)]);if(!n||n.length<12)throw Error(`Unable to map entropy to mnemonic`);return n.join(` `)}function zn(e,t){try{Ln(e,t)}catch{return!1}return!0}function Bn(e,t,n){return Ln(e,t)}function Vn(e,t){return zn(e,t)}function Hn(e,t=``,n,r){if(!Vn(e,n))throw Error(`Invalid bip39 mnemonic specified`);return En(Bn(e,n),b(`mnemonic${t}`)).password.slice(0,32)}function Un(e){let t=x(e);if(t.length!==32)throw Error(`Expected a seed of 32 bytes, found ${t.length}`);let n=Tn(t),r=R(n.subarray(0,32))>>3n,i=_n.BASE.multiply(r).toRawBytes();return{publicKey:new Uint8Array(i),secretKey:new Uint8Array(n)}}self.addEventListener(`message`,async e=>{let{taskId:t,task:n,data:r}=e.data;try{let e;switch(n){case`test`:e=`ready`;break;case`entropyToMnemonic`:if(!r.entropy)throw Error(`Entropy data is required`);e=Rn(r.entropy);break;case`entropyToKeypair`:if(!r.entropy)throw Error(`Entropy data is required`);e=Wn(r.entropy);break;default:throw Error(`Unknown task: ${n}`)}let i={taskId:t,result:e};self.postMessage(i)}catch(e){let n={taskId:t,error:e instanceof Error?e.message:`Unknown error`};self.postMessage(n)}});function Wn(e){let t=Rn(e),{publicKey:n,secretKey:r}=Un(Hn(t));return{mnemonic:t,publicKey:n,secretKey:r}}})();";
3
+ var blob = typeof self !== "undefined" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", jsContent], { type: "text/javascript;charset=utf-8" });
3
4
  function WorkerWrapper(options) {
4
- let objURL;
5
- try {
6
- objURL = blob && (self.URL || self.webkitURL).createObjectURL(blob);
7
- if (!objURL) throw "";
8
- const worker = new Worker(objURL, {
9
- name: options?.name
10
- });
11
- worker.addEventListener("error", () => {
12
- (self.URL || self.webkitURL).revokeObjectURL(objURL);
13
- });
14
- return worker;
15
- } catch (e) {
16
- return new Worker(
17
- "data:text/javascript;charset=utf-8," + encodeURIComponent(jsContent),
18
- {
19
- name: options?.name
20
- }
21
- );
22
- } finally {
23
- objURL && (self.URL || self.webkitURL).revokeObjectURL(objURL);
24
- }
5
+ let objURL;
6
+ try {
7
+ objURL = blob && (self.URL || self.webkitURL).createObjectURL(blob);
8
+ if (!objURL) throw "";
9
+ const worker = new Worker(objURL, { name: options?.name });
10
+ worker.addEventListener("error", () => {
11
+ (self.URL || self.webkitURL).revokeObjectURL(objURL);
12
+ });
13
+ return worker;
14
+ } catch (e) {
15
+ return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(jsContent), { name: options?.name });
16
+ }
25
17
  }
26
- export {
27
- WorkerWrapper as default
28
- };
18
+ //#endregion
19
+ export { WorkerWrapper as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/account",
3
- "version": "2.8.62",
3
+ "version": "2.8.64",
4
4
  "description": "Services and Utils for Prosopo account gen and management",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -52,17 +52,17 @@
52
52
  "@polkadot/extension-inject": "0.62.3",
53
53
  "@polkadot/util": "13.5.7",
54
54
  "@polkadot/util-crypto": "13.5.7",
55
- "@prosopo/common": "3.1.47",
56
- "@prosopo/fingerprint": "2.7.17",
57
- "@prosopo/keyring": "2.9.59",
58
- "@prosopo/types": "4.9.11",
59
- "@prosopo/util": "3.3.4",
55
+ "@prosopo/common": "3.1.48",
56
+ "@prosopo/fingerprint": "2.7.19",
57
+ "@prosopo/keyring": "2.9.61",
58
+ "@prosopo/types": "4.10.0",
59
+ "@prosopo/util": "3.3.5",
60
60
  "@prosopo/util-crypto": "13.5.30"
61
61
  },
62
62
  "devDependencies": {
63
- "@prosopo/config": "3.3.4",
63
+ "@prosopo/config": "3.3.5",
64
64
  "@types/node": "22.10.2",
65
- "@vitest/coverage-v8": "3.2.4",
65
+ "@vitest/coverage-v8": "4.1.10",
66
66
  "concurrently": "9.0.1",
67
67
  "del-cli": "6.0.0",
68
68
  "dotenv": "16.4.5",
@@ -70,8 +70,8 @@
70
70
  "tslib": "2.7.0",
71
71
  "tsx": "4.20.3",
72
72
  "typescript": "5.6.2",
73
- "vite": "6.4.1",
74
- "vitest": "3.2.4"
73
+ "vite": "8.1.5",
74
+ "vitest": "4.1.10"
75
75
  },
76
76
  "sideEffects": false
77
77
  }