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