>>0,l.setUint32(h,m,t),({s0:g,s1:y,s2:w,s3:b}=T(e,u[0],u[1],u[2],u[3]));const v=s*Math.floor(d.length/4);if(v16)throw new Error(`aes/pcks5: wrong padding byte: ${r}`);const i=e.subarray(0,-r);for(let t=0;tn(e,t),decrypt:(e,t)=>n(e,t)}})),n.ecb=(0,r.wrapCipher)({blockSize:16},(function(e,t={}){(0,o.bytes)(e);const n=!t.disablePadding;return{encrypt:(t,r)=>{(0,o.bytes)(t);const{b:i,o:s,out:a}=j(t,n,r),c=b(e);let u=0;for(;u+4<=i.length;){const{s0:e,s1:t,s2:n,s3:r}=T(c,i[u+0],i[u+1],i[u+2],i[u+3]);s[u++]=e,s[u++]=t,s[u++]=n,s[u++]=r}if(n){const e=_(t.subarray(4*u)),{s0:n,s1:r,s2:i,s3:o}=T(c,e[0],e[1],e[2],e[3]);s[u++]=n,s[u++]=r,s[u++]=i,s[u++]=o}return c.fill(0),a},decrypt:(t,i)=>{C(t);const o=v(e),s=S(t.length,i),a=(0,r.u32)(t),c=(0,r.u32)(s);for(let e=0;e+4<=a.length;){const{s0:t,s1:n,s2:r,s3:i}=x(o,a[e+0],a[e+1],a[e+2],a[e+3]);c[e++]=t,c[e++]=n,c[e++]=r,c[e++]=i}return o.fill(0),P(s,n)}}})),n.cbc=(0,r.wrapCipher)({blockSize:16,nonceLength:16},(function(e,t,n={}){(0,o.bytes)(e),(0,o.bytes)(t,16);const i=!n.disablePadding;return{encrypt:(n,o)=>{const s=b(e),{b:a,o:c,out:u}=j(n,i,o),l=(0,r.u32)(t);let d=l[0],f=l[1],h=l[2],p=l[3],m=0;for(;m+4<=a.length;)d^=a[m+0],f^=a[m+1],h^=a[m+2],p^=a[m+3],({s0:d,s1:f,s2:h,s3:p}=T(s,d,f,h,p)),c[m++]=d,c[m++]=f,c[m++]=h,c[m++]=p;if(i){const e=_(n.subarray(4*m));d^=e[0],f^=e[1],h^=e[2],p^=e[3],({s0:d,s1:f,s2:h,s3:p}=T(s,d,f,h,p)),c[m++]=d,c[m++]=f,c[m++]=h,c[m++]=p}return s.fill(0),u},decrypt:(n,o)=>{C(n);const s=v(e),a=(0,r.u32)(t),c=S(n.length,o),u=(0,r.u32)(n),l=(0,r.u32)(c);let d=a[0],f=a[1],h=a[2],p=a[3];for(let e=0;e+4<=u.length;){const t=d,n=f,r=h,i=p;d=u[e+0],f=u[e+1],h=u[e+2],p=u[e+3];const{s0:o,s1:a,s2:c,s3:m}=x(s,d,f,h,p);l[e++]=o^t,l[e++]=a^n,l[e++]=c^r,l[e++]=m^i}return s.fill(0),P(c,i)}}})),n.cfb=(0,r.wrapCipher)({blockSize:16,nonceLength:16},(function(e,t){function n(n,i,o){const a=b(e),c=n.length;o=S(c,o);const u=(0,r.u32)(n),l=(0,r.u32)(o),d=i?l:u,f=(0,r.u32)(t);let h=f[0],p=f[1],m=f[2],g=f[3];for(let e=0;e+4<=u.length;){const{s0:t,s1:n,s2:r,s3:i}=T(a,h,p,m,g);l[e+0]=u[e+0]^t,l[e+1]=u[e+1]^n,l[e+2]=u[e+2]^r,l[e+3]=u[e+3]^i,h=d[e++],p=d[e++],m=d[e++],g=d[e++]}const y=s*Math.floor(u.length/4);if(yn(e,!0,t),decrypt:(e,t)=>n(e,!1,t)}})),n.gcm=(0,r.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},(function(e,t,n){if((0,o.bytes)(t),0===t.length)throw new Error("aes/gcm: empty nonce");const s=16;function c(e,t,r){const o=O(i.ghash,!1,e,r,n);for(let e=0;e{(0,o.bytes)(e);const{xk:t,authKey:n,counter:r,tagMask:i}=u(),a=new Uint8Array(e.length+s);I(t,!1,r,e,a);const l=c(n,i,a.subarray(0,a.length-s));return a.set(l,e.length),t.fill(0),a},decrypt:e=>{if((0,o.bytes)(e),e.lengthr=>{if(!Number.isSafeInteger(r)||t>r||r>n)throw new Error(`${e}: invalid value=${r}, must be [${t}..${n}]`)};function R(e){return null!=e&&"object"==typeof e&&(e instanceof Uint32Array||"Uint32Array"===e.constructor.name)}n.siv=(0,r.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},(function(e,t,n){const s=B("AAD",0,2**36),a=B("plaintext",0,2**36),c=B("nonce",12,12),u=B("ciphertext",16,2**36+16);function l(){const n=e.length;if(16!==n&&24!==n&&32!==n)throw new Error(`key length must be 16, 24 or 32 bytes, got: ${n} bytes`);const i=b(e),o=new Uint8Array(n),s=new Uint8Array(16),a=(0,r.u32)(t);let c=0,u=a[0],l=a[1],d=a[2],f=0;for(const e of[s,o].map(r.u32)){const t=(0,r.u32)(e);for(let e=0;e{(0,o.bytes)(e),a(e.length);const{encKey:t,authKey:n}=l(),r=d(t,n,e),i=new Uint8Array(e.length+16);return i.set(r,e.length),i.set(f(t,r,e)),t.fill(0),n.fill(0),i},decrypt:e=>{(0,o.bytes)(e),u(e.length);const t=e.subarray(-16),{encKey:n,authKey:i}=l(),s=f(n,t,e.subarray(0,-16)),a=d(n,i,s);if(n.fill(0),i.fill(0),!(0,r.equalBytes)(t,a))throw new Error("invalid polyval tag");return s}}})),n.unsafe={expandKeyLE:b,expandKeyDecLE:v,encrypt:T,decrypt:x,encryptBlock:function(e,t){if((0,o.bytes)(t,16),!R(e))throw new Error("_encryptBlock accepts result of expandKeyLE");const n=(0,r.u32)(t);let{s0:i,s1:s,s2:a,s3:c}=T(e,n[0],n[1],n[2],n[3]);return n[0]=i,n[1]=s,n[2]=a,n[3]=c,t},decryptBlock:function(e,t){if((0,o.bytes)(t,16),!R(e))throw new Error("_decryptBlock accepts result of expandKeyLE");const n=(0,r.u32)(t);let{s0:i,s1:s,s2:a,s3:c}=x(e,n[0],n[1],n[2],n[3]);return n[0]=i,n[1]=s,n[2]=a,n[3]=c,t},ctrCounter:k,ctr32:I}}}},{package:"@metamask/profile-sync-controller>@noble/ciphers",file:"node_modules/@noble/ciphers/aes.js"}],[2979,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getWebcryptoSubtle=n.randomBytes=void 0;const r="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:undefined;n.randomBytes=function(e=32){if(r&&"function"==typeof r.getRandomValues)return r.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")},n.getWebcryptoSubtle=function(){if(r&&"object"==typeof r.subtle&&null!=r.subtle)return r.subtle;throw new Error("crypto.subtle must be defined")}}}},{package:"@metamask/profile-sync-controller>@noble/ciphers",file:"node_modules/@noble/ciphers/crypto.js"}],[2980,{"./_assert.js":2976},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.u64Lengths=n.setBigUint64=n.wrapCipher=n.Hash=n.equalBytes=n.checkOpts=n.concatBytes=n.toBytes=n.bytesToUtf8=n.utf8ToBytes=n.asyncLoop=n.nextTick=n.numberToBytesBE=n.bytesToNumberBE=n.hexToNumber=n.hexToBytes=n.bytesToHex=n.isLE=n.createView=n.u32=n.u16=n.u8=void 0;
/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
const r=e("./_assert.js");n.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);n.u16=e=>new Uint16Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/2));n.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));if(n.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),n.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!n.isLE)throw new Error("Non little-endian hardware is not supported");const i=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function o(e){(0,r.bytes)(e);let t="";for(let n=0;n=s._0&&e<=s._9?e-s._0:e>=s._A&&e<=s._F?e-(s._A-10):e>=s._a&&e<=s._f?e-(s._a-10):void 0}function c(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let t=0,i=0;t{},n.asyncLoop=async function(e,t,r){let i=Date.now();for(let o=0;o=0&&e>i&o),a=Number(n&o),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,a,r)}n.wrapCipher=(e,t)=>(Object.assign(t,e),t),n.setBigUint64=d,n.u64Lengths=function(e,t){const r=new Uint8Array(16),i=(0,n.createView)(r);return d(i,0,BigInt(t?t.length:0),!0),d(i,8,BigInt(e.length),!0),r}}}},{package:"@metamask/profile-sync-controller>@noble/ciphers",file:"node_modules/@noble/ciphers/utils.js"}],[2981,{"./_assert.js":2976,"./utils.js":2980,"@noble/ciphers/crypto":2979},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.gcm=n.ctr=n.cbc=n.utils=n.managedNonce=n.getWebcryptoSubtle=n.randomBytes=void 0;const r=e("@noble/ciphers/crypto");Object.defineProperty(n,"randomBytes",{enumerable:!0,get:function(){return r.randomBytes}}),Object.defineProperty(n,"getWebcryptoSubtle",{enumerable:!0,get:function(){return r.getWebcryptoSubtle}});const i=e("./utils.js"),o=e("./_assert.js");n.managedNonce=function(e){return(0,o.number)(e.nonceLength),(t,...n)=>({encrypt:(o,...s)=>{const{nonceLength:a}=e,c=(0,r.randomBytes)(a),u=e(t,c,...n).encrypt(o,...s),l=(0,i.concatBytes)(c,u);return u.fill(0),l},decrypt:(r,...i)=>{const{nonceLength:o}=e,s=r.subarray(0,o),a=r.subarray(o);return e(t,s,...n).decrypt(a,...i)}})},n.utils={async encrypt(e,t,n,i){const o=(0,r.getWebcryptoSubtle)(),s=await o.importKey("raw",e,t,!0,["encrypt"]),a=await o.encrypt(n,s,i);return new Uint8Array(a)},async decrypt(e,t,n,i){const o=(0,r.getWebcryptoSubtle)(),s=await o.importKey("raw",e,t,!0,["decrypt"]),a=await o.decrypt(n,s,i);return new Uint8Array(a)}};const s={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function a(e){return(t,r,i)=>{(0,o.bytes)(t),(0,o.bytes)(r);const a={name:e,length:8*t.length},c=function(e,t,n){if(e===s.CBC)return{name:s.CBC,iv:t};if(e===s.CTR)return{name:s.CTR,counter:t,length:64};if(e===s.GCM)return n?{name:s.GCM,iv:t,additionalData:n}:{name:s.GCM,iv:t};throw new Error("unknown aes block mode")}(e,r,i);return{encrypt:e=>((0,o.bytes)(e),n.utils.encrypt(t,a,c,e)),decrypt:e=>((0,o.bytes)(e),n.utils.decrypt(t,a,c,e))}}}n.cbc=a(s.CBC),n.ctr=a(s.CTR),n.gcm=a(s.GCM)}}},{package:"@metamask/profile-sync-controller>@noble/ciphers",file:"node_modules/@noble/ciphers/webcrypto.js"}],[2982,{"./abstract/weierstrass.js":2989,"@noble/hashes/hmac":2996,"@noble/hashes/utils":3003},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getHash=s,n.createCurve=function(e,t){const n=t=>(0,o.weierstrass)({...e,...s(t)});return{...n(t),create:n}};
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
const r=e("@noble/hashes/hmac"),i=e("@noble/hashes/utils"),o=e("./abstract/weierstrass.js");function s(e){return{hash:e,hmac:(t,...n)=>(0,r.hmac)(e,t,(0,i.concatBytes)(...n)),randomBytes:i.randomBytes}}}}},{package:"viem>webauthn-p256>@noble/curves",file:"node_modules/@noble/curves/_shortw_utils.js"}],[2983,{"./modular.js":2986,"./utils.js":2988},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.wNAF=function(e,t){return{constTimeNegate:a,hasPrecomputes:e=>1!==p(e),unsafeLadder(t,n,r=e.ZERO){let i=t;for(;n>o;)n&s&&(r=r.add(i)),i=i.double(),n>>=s;return r},precomputeWindow(e,n){const{windows:r,windowSize:i}=u(n,t),o=[];let s=e,a=s;for(let e=0;e>=p,n>c&&(n-=h,i+=s);const o=t,u=t+Math.abs(n)-1,m=e%2!=0,g=n<0;0===n?d=d.add(a(m,r[o])):l=l.add(a(g,r[u]))}return{p:l,f:d}},wNAFUnsafe(n,r,i,a=e.ZERO){const{windows:c,windowSize:l}=u(n,t),d=BigInt(2**n-1),f=2**n,h=BigInt(n);for(let e=0;e>=h,n>l&&(n-=f,i+=s),0===n)continue;let c=r[t+Math.abs(n)-1];n<0&&(c=c.negate()),a=a.add(c)}return a},getPrecomputes(e,t,n){let r=f.get(t);return r||(r=this.precomputeWindow(t,e),1!==e&&f.set(t,n(r))),r},wNAFCached(e,t,n){const r=p(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)},wNAFCachedUnsafe(e,t,n,r){const i=p(e);return 1===i?this.unsafeLadder(e,t,r):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),t,r)},setWindowSize(e,n){c(n,t),h.set(e,n),f.delete(e)}}},n.pippenger=function(e,t,n,r){if(l(n,e),d(r,t),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,s=(0,i.bitLen)(BigInt(n.length)),a=s>12?s-3:s>4?s-2:s?2:1,c=(1<=0;e-=a){u.fill(o);for(let t=0;t>BigInt(e)&BigInt(c));u[o]=u[o].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(h=h.add(t),0!==e)for(let e=0;e{const t=[];for(let n=0,r=e;n{if(d(e,t),e.length>n.length)throw new Error("array of scalars must be smaller than array of points");let o=i;for(let t=0;t>n&a);i&&(o=o.add(u[t][i-1]))}}return o}},n.validateBasic=function(e){return(0,r.validateField)(e.Fp),(0,i.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,r.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})};
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
const r=e("./modular.js"),i=e("./utils.js"),o=BigInt(0),s=BigInt(1);function a(e,t){const n=t.negate();return e?n:t}function c(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function u(e,t){c(e,t);return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}function l(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach(((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)}))}function d(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach(((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)}))}const f=new WeakMap,h=new WeakMap;function p(e){return h.get(e)||1}}}},{package:"viem>webauthn-p256>@noble/curves",file:"node_modules/@noble/curves/abstract/curve.js"}],[2984,{"./curve.js":2983,"./modular.js":2986,"./utils.js":2988},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.twistedEdwards=function(e){const t=function(e){const t=(0,r.validateBasic)(e);return o.validateObject(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:n,n:f,prehash:h,hash:p,randomBytes:m,nByteLength:g,h:y}=t,w=u<{try{return{isValid:!0,value:n.sqrt(e*n.inv(t))}}catch(e){return{isValid:!1,value:a}}}),A=t.adjustScalarBytes||(e=>e),T=t.domain||((e,t,n)=>{if((0,s.abool)("phflag",n),t.length||n)throw new Error("Contexts/pre-hash are not supported");return e});function x(e,t){o.aInRange("coordinate "+e,t,a,w)}function S(e){if(!(e instanceof C))throw new Error("ExtendedPoint expected")}const k=(0,s.memoized)(((e,t)=>{const{ex:r,ey:i,ez:o}=e,s=e.is0();null==t&&(t=s?l:n.inv(o));const u=b(r*t),d=b(i*t),f=b(o*t);if(s)return{x:a,y:c};if(f!==c)throw new Error("invZ was invalid");return{x:u,y:d}})),I=(0,s.memoized)((e=>{const{a:n,d:r}=t;if(e.is0())throw new Error("bad point: ZERO");const{ex:i,ey:o,ez:s,et:a}=e,c=b(i*i),u=b(o*o),l=b(s*s),d=b(l*l),f=b(c*n);if(b(l*b(f+u))!==b(d+b(r*b(c*u))))throw new Error("bad point: equation left != right (1)");if(b(i*o)!==b(s*a))throw new Error("bad point: equation left != right (2)");return!0}));class C{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r,x("x",e),x("y",t),x("z",n),x("t",r),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof C)throw new Error("extended point not allowed");const{x:t,y:n}=e||{};return x("x",t),x("y",n),new C(t,n,c,b(t*n))}static normalizeZ(e){const t=n.invertBatch(e.map((e=>e.ez)));return e.map(((e,n)=>e.toAffine(t[n]))).map(C.fromAffine)}static msm(e,t){return(0,r.pippenger)(C,v,e,t)}_setWindowSize(e){_.setWindowSize(this,e)}assertValidity(){I(this)}equals(e){S(e);const{ex:t,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=e,a=b(t*s),c=b(i*r),u=b(n*s),l=b(o*r);return a===c&&u===l}is0(){return this.equals(C.ZERO)}negate(){return new C(b(-this.ex),this.ey,this.ez,b(-this.et))}double(){const{a:e}=t,{ex:n,ey:r,ez:i}=this,o=b(n*n),s=b(r*r),a=b(u*b(i*i)),c=b(e*o),l=n+r,d=b(b(l*l)-o-s),f=c+s,h=f-a,p=c-s,m=b(d*h),g=b(f*p),y=b(d*p),w=b(h*f);return new C(m,g,w,y)}add(e){S(e);const{a:n,d:r}=t,{ex:i,ey:o,ez:s,et:c}=this,{ex:l,ey:d,ez:f,et:h}=e;if(n===BigInt(-1)){const e=b((o-i)*(d+l)),t=b((o+i)*(d-l)),n=b(t-e);if(n===a)return this.double();const r=b(s*u*h),p=b(c*u*f),m=p+r,g=t+e,y=p-r,w=b(m*n),v=b(g*y),E=b(m*y),A=b(n*g);return new C(w,v,A,E)}const p=b(i*l),m=b(o*d),g=b(c*r*h),y=b(s*f),w=b((i+o)*(l+d)-p-m),v=y-g,E=y+g,A=b(m-n*p),T=b(w*v),x=b(E*A),k=b(w*A),I=b(v*E);return new C(T,x,I,k)}subtract(e){return this.add(e.negate())}wNAF(e){return _.wNAFCached(this,e,C.normalizeZ)}multiply(e){const t=e;o.aInRange("scalar",t,c,f);const{p:n,f:r}=this.wNAF(t);return C.normalizeZ([n,r])[0]}multiplyUnsafe(e,t=C.ZERO){const n=e;return o.aInRange("scalar",n,a,f),n===a?P:this.is0()||n===c?this:_.wNAFCachedUnsafe(this,n,C.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(y).is0()}isTorsionFree(){return _.unsafeLadder(this,f).is0()}toAffine(e){return k(this,e)}clearCofactor(){const{h:e}=t;return e===c?this:this.multiplyUnsafe(e)}static fromHex(e,r=!1){const{d:i,a:u}=t,l=n.BYTES;e=(0,s.ensureBytes)("pointHex",e,l),(0,s.abool)("zip215",r);const d=e.slice(),f=e[l-1];d[l-1]=-129&f;const h=o.bytesToNumberLE(d),p=r?w:n.ORDER;o.aInRange("pointHex.y",h,a,p);const m=b(h*h),g=b(m-c),y=b(i*m-u);let{isValid:v,value:A}=E(g,y);if(!v)throw new Error("Point.fromHex: invalid y coordinate");const T=(A&c)===c,x=!!(128&f);if(!r&&A===a&&x)throw new Error("Point.fromHex: x=0 and x_0=1");return x!==T&&(A=b(-A)),C.fromAffine({x:A,y:h})}static fromPrivateKey(e){return R(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),r=o.numberToBytesLE(t,n.BYTES);return r[r.length-1]|=e&c?128:0,r}toHex(){return o.bytesToHex(this.toRawBytes())}}C.BASE=new C(t.Gx,t.Gy,c,b(t.Gx*t.Gy)),C.ZERO=new C(a,c,c,a);const{BASE:j,ZERO:P}=C,_=(0,r.wNAF)(C,8*g);function O(e){return(0,i.mod)(e,f)}function B(e){return O(o.bytesToNumberLE(e))}function R(e){const t=n.BYTES;e=(0,s.ensureBytes)("private key",e,t);const r=(0,s.ensureBytes)("hashed private key",p(e),2*t),i=A(r.slice(0,t)),o=r.slice(t,2*t),a=B(i),c=j.multiply(a),u=c.toRawBytes();return{head:i,prefix:o,scalar:a,point:c,pointBytes:u}}function N(e=new Uint8Array,...t){const n=o.concatBytes(...t);return B(p(T(n,(0,s.ensureBytes)("context",e),!!h)))}const L=d;j._setWindowSize(8);return{CURVE:t,getPublicKey:function(e){return R(e).pointBytes},sign:function(e,t,r={}){e=(0,s.ensureBytes)("message",e),h&&(e=h(e));const{prefix:i,scalar:c,pointBytes:u}=R(t),l=N(r.context,i,e),d=j.multiply(l).toRawBytes(),p=O(l+N(r.context,d,u,e)*c);o.aInRange("signature.s",p,a,f);const m=o.concatBytes(d,o.numberToBytesLE(p,n.BYTES));return(0,s.ensureBytes)("result",m,2*n.BYTES)},verify:function(e,t,r,i=L){const{context:a,zip215:c}=i,u=n.BYTES;e=(0,s.ensureBytes)("signature",e,2*u),t=(0,s.ensureBytes)("message",t),r=(0,s.ensureBytes)("publicKey",r,u),c!==undefined&&(0,s.abool)("zip215",c),h&&(t=h(t));const l=o.bytesToNumberLE(e.slice(u,2*u));let d,f,p;try{d=C.fromHex(r,c),f=C.fromHex(e.slice(0,u),c),p=j.multiplyUnsafe(l)}catch(e){return!1}if(!c&&d.isSmallOrder())return!1;const m=N(a,f.toRawBytes(),d.toRawBytes(),t);return f.add(d.multiplyUnsafe(m)).subtract(p).clearCofactor().equals(C.ZERO)},ExtendedPoint:C,utils:{getExtendedPublicKey:R,randomPrivateKey:()=>m(n.BYTES),precompute:(e=8,t=C.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}};
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
const r=e("./curve.js"),i=e("./modular.js"),o=e("./utils.js"),s=e("./utils.js"),a=BigInt(0),c=BigInt(1),u=BigInt(2),l=BigInt(8),d={zip215:!0}}}},{package:"viem>webauthn-p256>@noble/curves",file:"node_modules/@noble/curves/abstract/edwards.js"}],[2985,{"./modular.js":2986,"./utils.js":2988},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.expand_message_xmd=u,n.expand_message_xof=l,n.hash_to_field=d,n.isogenyMap=function(e,t){const n=t.map((e=>Array.from(e).reverse()));return(t,r)=>{const[i,o,s,a]=n.map((n=>n.reduce(((n,r)=>e.add(e.mul(n,t),r)))));return t=e.div(i,o),r=e.mul(r,e.div(s,a)),{x:t,y:r}}},n.createHasher=function(e,t,n){if("function"!=typeof t)throw new Error("mapToCurve() must be defined");return{hashToCurve(r,i){const o=d(r,2,{...n,DST:n.DST,...i}),s=e.fromAffine(t(o[0])),a=e.fromAffine(t(o[1])),c=s.add(a).clearCofactor();return c.assertValidity(),c},encodeToCurve(r,i){const o=d(r,1,{...n,DST:n.encodeDST,...i}),s=e.fromAffine(t(o[0])).clearCofactor();return s.assertValidity(),s},mapToCurve(n){if(!Array.isArray(n))throw new Error("mapToCurve: expected array of bigints");for(const e of n)if("bigint"!=typeof e)throw new Error("mapToCurve: expected array of bigints");const r=e.fromAffine(t(n)).clearCofactor();return r.assertValidity(),r}}};const r=e("./modular.js"),i=e("./utils.js"),o=i.bytesToNumberBE;function s(e,t){if(c(e),c(t),e<0||e>=1<<8*t)throw new Error("invalid I2OSP input: "+e);const n=Array.from({length:t}).fill(0);for(let r=t-1;r>=0;r--)n[r]=255&e,e>>>=8;return new Uint8Array(n)}function a(e,t){const n=new Uint8Array(e.length);for(let r=0;r255&&(t=r((0,i.concatBytes)((0,i.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));const{outputLen:o,blockLen:u}=r,l=Math.ceil(n/o);if(n>65535||l>255)throw new Error("expand_message_xmd: invalid lenInBytes");const d=(0,i.concatBytes)(t,s(t.length,1)),f=s(0,u),h=s(n,2),p=new Array(l),m=r((0,i.concatBytes)(f,e,h,s(0,1),d));p[0]=r((0,i.concatBytes)(m,s(1,1),d));for(let e=1;e<=l;e++){const t=[a(m,p[e-1]),s(e+1,1),d];p[e]=r((0,i.concatBytes)(...t))}return(0,i.concatBytes)(...p).slice(0,n)}function l(e,t,n,r,o){if((0,i.abytes)(e),(0,i.abytes)(t),c(n),t.length>255){const e=Math.ceil(2*r/8);t=o.create({dkLen:e}).update((0,i.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(n>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return o.create({dkLen:n}).update(e).update(s(n,2)).update(t).update(s(t.length,1)).digest()}function d(e,t,n){(0,i.validateObject)(n,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:s,k:a,m:d,hash:f,expand:h,DST:p}=n;(0,i.abytes)(e),c(t);const m="string"==typeof p?(0,i.utf8ToBytes)(p):p,g=s.toString(2).length,y=Math.ceil((g+a)/8),w=t*d*y;let b;if("xmd"===h)b=u(e,m,w,f);else if("xof"===h)b=l(e,m,w,a,f);else{if("_internal_pass"!==h)throw new Error('expand must be "xmd" or "xof"');b=e}const v=new Array(t);for(let e=0;ewebauthn-p256>@noble/curves",file:"node_modules/@noble/curves/abstract/hash-to-curve.js"}],[2986,{"./utils.js":2988},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isNegativeLE=void 0,n.mod=d,n.pow=f,n.pow2=function(e,t,n){let r=e;for(;t-- >i;)r*=r,r%=n;return r},n.invert=h,n.tonelliShanks=p,n.FpSqrt=m,n.validateField=function(e){const t=g.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,r.validateObject)(e,t)},n.FpPow=y,n.FpInvertBatch=w,n.FpDiv=function(e,t,n){return e.mul(t,"bigint"==typeof n?h(n,e.ORDER):e.inv(n))},n.FpLegendre=b,n.FpIsSquare=function(e){const t=b(e.ORDER);return n=>{const r=t(e,n);return e.eql(r,e.ZERO)||e.eql(r,e.ONE)}},n.nLength=v,n.Field=function(e,t,n=!1,s={}){if(e<=i)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:a,nByteLength:c}=v(e,t);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let u;const l=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:c,MASK:(0,r.bitMask)(a),ZERO:i,ONE:o,create:t=>d(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return i<=t&&te===i,isOdd:e=>(e&o)===o,neg:t=>d(-t,e),eql:(e,t)=>e===t,sqr:t=>d(t*t,e),add:(t,n)=>d(t+n,e),sub:(t,n)=>d(t-n,e),mul:(t,n)=>d(t*n,e),pow:(e,t)=>y(l,e,t),div:(t,n)=>d(t*h(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>h(t,e),sqrt:s.sqrt||(t=>(u||(u=m(e)),u(l,t))),invertBatch:e=>w(l,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?(0,r.numberToBytesLE)(e,c):(0,r.numberToBytesBE)(e,c),fromBytes:e=>{if(e.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+e.length);return n?(0,r.bytesToNumberLE)(e):(0,r.bytesToNumberBE)(e)}});return Object.freeze(l)},n.FpSqrtOdd=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?n:e.neg(n)},n.FpSqrtEven=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?e.neg(n):n},n.hashToPrivateScalar=function(e,t,n=!1){const i=(e=(0,r.ensureBytes)("privateHash",e)).length,s=v(t).nByteLength+8;if(s<24||i1024)throw new Error("hashToPrivateScalar: expected "+s+"-1024 bytes of input, got "+i);return d(n?(0,r.bytesToNumberLE)(e):(0,r.bytesToNumberBE)(e),t-o)+o},n.getFieldBytesLength=E,n.getMinHashLength=A,n.mapHashToField=function(e,t,n=!1){const i=e.length,s=E(t),a=A(t);if(i<16||i1024)throw new Error("expected "+a+"-1024 bytes of input, got "+i);const c=d(n?(0,r.bytesToNumberLE)(e):(0,r.bytesToNumberBE)(e),t-o)+o;return n?(0,r.numberToBytesLE)(c,s):(0,r.numberToBytesBE)(c,s)};
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
const r=e("./utils.js"),i=BigInt(0),o=BigInt(1),s=BigInt(2),a=BigInt(3),c=BigInt(4),u=BigInt(5),l=BigInt(8);function d(e,t){const n=e%t;return n>=i?n:t+n}function f(e,t,n){if(ti;)t&o&&(r=r*e%n),e=e*e%n,t>>=o;return r}function h(e,t){if(e===i)throw new Error("invert: expected non-zero number");if(t<=i)throw new Error("invert: expected positive modulus, got "+t);let n=d(e,t),r=t,s=i,a=o,c=o,u=i;for(;n!==i;){const e=r/n,t=r%n,i=s-c*e,o=a-u*e;r=n,n=t,s=c,a=u,c=i,u=o}if(r!==o)throw new Error("invert: does not exist");return d(s,t)}function p(e){const t=(e-o)/s;let n,r,a;for(n=e-o,r=0;n%s===i;n/=s,r++);for(a=s;a1e3)throw new Error("Cannot find square root: likely non-prime P");if(1===r){const t=(e+o)/c;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}const u=(n+o)/s;return function(e,i){if(e.pow(i,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let s=r,c=e.pow(e.mul(e.ONE,a),n),l=e.pow(i,u),d=e.pow(i,n);for(;!e.eql(d,e.ONE);){if(e.eql(d,e.ZERO))return e.ZERO;let t=1;for(let n=e.sqr(d);t(d(e,t)&o)===o;const g=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function y(e,t,n){if(ni;)n&o&&(r=e.mul(r,s)),s=e.sqr(s),n>>=o;return r}function w(e,t){const n=new Array(t.length),r=t.reduce(((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r))),e.ONE),i=e.inv(r);return t.reduceRight(((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r))),i),n}function b(e){const t=(e-o)/s;return(e,n)=>e.pow(n,t)}function v(e,t){const n=t!==undefined?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function E(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function A(e){const t=E(e);return t+Math.ceil(t/2)}}}},{package:"viem>webauthn-p256>@noble/curves",file:"node_modules/@noble/curves/abstract/modular.js"}],[2987,{"./modular.js":2986,"./utils.js":2988},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.montgomery=function(e){const t=(h=e,(0,i.validateObject)(h,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...h})),{P:n}=t,a=e=>(0,r.mod)(e,n),c=t.montgomeryBits,u=Math.ceil(c/8),l=t.nByteLength,d=t.adjustScalarBytes||(e=>e),f=t.powPminus2||(e=>(0,r.pow)(e,n-BigInt(2),n));var h;function p(e,t,n){const r=a(e*(t-n));return[t=a(t-r),n=a(n+r)]}const m=(t.a-BigInt(2))/BigInt(4);function g(e){return(0,i.numberToBytesLE)(a(e),u)}function y(e,t){const r=function(e){const t=(0,i.ensureBytes)("u coordinate",e,u);return 32===l&&(t[31]&=127),(0,i.bytesToNumberLE)(t)}(t),h=function(e,t){(0,i.aInRange)("u",e,o,n),(0,i.aInRange)("scalar",t,o,n);const r=t,u=e;let l,d=s,h=o,g=e,y=s,w=o;for(let e=BigInt(c-1);e>=o;e--){const t=r>>e&s;w^=t,l=p(w,d,g),d=l[0],g=l[1],l=p(w,h,y),h=l[0],y=l[1],w=t;const n=d+h,i=a(n*n),o=d-h,c=a(o*o),f=i-c,b=g+y,v=a((g-y)*n),E=a(b*o),A=v+E,T=v-E;g=a(A*A),y=a(u*a(T*T)),d=a(i*c),h=a(f*(i+a(m*f)))}l=p(w,d,g),d=l[0],g=l[1],l=p(w,h,y),h=l[0],y=l[1];const b=f(h);return a(d*b)}(r,function(e){const t=(0,i.ensureBytes)("scalar",e),n=t.length;if(n!==u&&n!==l)throw new Error("invalid scalar, expected "+u+" or "+l+" bytes, got "+n);return(0,i.bytesToNumberLE)(d(t))}(e));if(h===o)throw new Error("invalid private or public key received");return g(h)}const w=g(t.Gu);function b(e){return y(e,w)}return{scalarMult:y,scalarMultBase:b,getSharedSecret:(e,t)=>y(e,t),getPublicKey:e=>b(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:w}};
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
const r=e("./modular.js"),i=e("./utils.js"),o=BigInt(0),s=BigInt(1)}}},{package:"viem>webauthn-p256>@noble/curves",file:"node_modules/@noble/curves/abstract/montgomery.js"}],[2988,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
Object.defineProperty(n,"__esModule",{value:!0}),n.notImplemented=n.bitMask=void 0,n.isBytes=s,n.abytes=a,n.abool=function(e,t){if("boolean"!=typeof t)throw new Error(e+" boolean expected, got "+t)},n.bytesToHex=u,n.numberToHexUnpadded=l,n.hexToNumber=d,n.hexToBytes=p,n.bytesToNumberBE=function(e){return d(u(e))},n.bytesToNumberLE=function(e){return a(e),d(u(Uint8Array.from(e).reverse()))},n.numberToBytesBE=m,n.numberToBytesLE=function(e,t){return m(e,t).reverse()},n.numberToVarBytesBE=function(e){return p(l(e))},n.ensureBytes=function(e,t,n){let r;if("string"==typeof t)try{r=p(t)}catch(t){throw new Error(e+" must be hex string or Uint8Array, cause: "+t)}else{if(!s(t))throw new Error(e+" must be hex string or Uint8Array");r=Uint8Array.from(t)}const i=r.length;if("number"==typeof n&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return r},n.concatBytes=g,n.equalBytes=function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r