require("./authhero.cjs");var e=[`passkey`,`webauthn-roaming`,`webauthn-platform`],t=30;async function n(n,r,i,a){if(!a)return{show:!1};let{connections:o}=await n.env.data.connections.list(r,{page:0,per_page:100,include_totals:!1}),s=o.find(e=>e.name===a)??o.find(e=>e.name.toLowerCase()===a.toLowerCase());if(!s?.options||!s.options.passkey_options?.progressive_enrollment_enabled||!s.options.authentication_methods?.passkey?.enabled||(await n.env.data.authenticationMethods.list(r,i)).some(t=>t.confirmed&&e.includes(t.type)))return{show:!1};let c=await n.env.data.users.get(r,i);if(!c)return{show:!1};let l=c.app_metadata||{};if(l.passkey_enrollment_opted_out===!0)return{show:!1};if(typeof l.passkey_enrollment_snoozed_at==`string`){let e=new Date(l.passkey_enrollment_snoozed_at),n=new Date(e.getTime()+t*24*60*60*1e3);if(new Date<n)return{show:!1}}return{show:!0}}exports.checkPasskeyNudgeRequired=n;