function e(e){const t="==".slice(0,(4-e.length%4)%4),n=e.replace(/-/g,"+").replace(/_/g,"/")+t,r=atob(n),a=new ArrayBuffer(r.length),i=new Uint8Array(a);for(let s=0;s<r.length;s++)i[s]=r.charCodeAt(s);return a}function t(e){const t=new Uint8Array(e);let n="";for(const r of t)n+=String.fromCharCode(r);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function n(e,t,r){if(t===d)return r;if(t===p)return e(r);if(t instanceof Array)return r.map(r=>n(e,t[0],r));if(t instanceof Object){const a={};for(const[i,s]of Object.entries(t)){if(s.derive){const e=s.derive(r);void 0!==e&&(r[i]=e)}if(i in r)null!=r[i]?a[i]=n(e,s.schema,r[i]):a[i]=null;else if(s.required)throw new Error(`Missing key: ${i}`)}return a}}function r(e,t){return{required:!0,schema:e,derive:t}}function a(e){return{required:!0,schema:e}}function i(e){return{required:!1,schema:e}}function s(t){return n(e,y,t)}function o(t){return n(e,v,t)}function c(){return!!(navigator.credentials&&navigator.credentials.create&&navigator.credentials.get&&window.PublicKeyCredential)}async function l(e){const r=await navigator.credentials.create(e);return r.toJSON=()=>n(t,m,r),r}async function u(e){const r=await navigator.credentials.get(e);return r.toJSON=()=>n(t,w,r),r}var d="copy",p="convert",f={type:a(d),id:a(p),transports:i(d)},g={appid:i(d),appidExclude:i(d),credProps:i(d)},h={appid:i(d),appidExclude:i(d),credProps:i(d)},y={publicKey:a({rp:a(d),user:a({id:a(p),name:a(d),displayName:a(d)}),challenge:a(p),pubKeyCredParams:a(d),timeout:i(d),excludeCredentials:i([f]),authenticatorSelection:i(d),attestation:i(d),extensions:i(g)}),signal:i(d)},m={type:a(d),id:a(d),rawId:a(p),authenticatorAttachment:i(d),response:a({clientDataJSON:a(p),attestationObject:a(p),transports:r(d,e=>{var t;return(null==(t=e.getTransports)?void 0:t.call(e))||[]})}),clientExtensionResults:r(h,e=>e.getClientExtensionResults())},v={mediation:i(d),publicKey:a({challenge:a(p),timeout:i(d),rpId:i(d),allowCredentials:i([f]),userVerification:i(d),extensions:i(g)}),signal:i(d)},w={type:a(d),id:a(d),rawId:a(p),authenticatorAttachment:i(d),response:a({clientDataJSON:a(p),authenticatorData:a(p),signature:a(p),userHandle:a(p)}),clientExtensionResults:r(h,e=>e.getClientExtensionResults())};export{u as a,l as b,s as c,o as g,c as s};
