import{k as e,n as a,H as r,u as s,r as t,J as i,K as o}from"./c6eedc03a-C8LSdtro.js";import{D as n}from"./vendor-luxon-Y8l99kBI.js";import{o as u,b as l,n as g}from"./vendor-zod-1gcJXWab.js";import{r as d}from"./vendor-react-AXa6hZO5.js";const c=u({minimumAge:g().int().positive(),useBirthdatePicker:l().optional()}),m=()=>{const r=e("onboarding_age_verification",{minimumAge:18},c),s=a("use_birthday_for_age_verification");return{minimumAge:r.minimumAge,useBirthdatePicker:r.useBirthdatePicker||s}},p=(e,a)=>n.now().diff(n.fromJSDate(e),"years").years>=a,f=["AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GR","HR","HU","IE","IT","LT","LU","LV","MT","NL","PL","PT","RO","SE","SI","SK"],_=e=>(e=>f.includes(e.toUpperCase()))(e)||"GB"===e.toUpperCase();function b(e,a){if(!a)return null;switch(a){case"public_email_blocked":return e.formatMessage({defaultMessage:"A work email address is required to create an Enterprise account.",id:"eb5ALYniwM"});case"no_new_orgs_for_parent":return e.formatMessage({defaultMessage:"Your organization has restricted new account creation. Contact your IT administrator for help.",id:"SZH2w5IbZk"});case"billing_disabled":return e.formatMessage({defaultMessage:"Billing is not available for this account.",id:"RHu2MvpiHR"});case"domain_conflict":return e.formatMessage({defaultMessage:"Your email domain is already associated with an existing organization. Contact that organization's admin or reach out to support for help.",id:"tahc71t2e1"});case"upgrade_not_available":return e.formatMessage({defaultMessage:"Enterprise upgrades are not available yet.",id:"vUetK+GnrW"});case"not_team_org":return e.formatMessage({defaultMessage:"Only Team plan organizations can upgrade to Enterprise.",id:"4/dTKH1wD0"});case"nonprofit_org":return e.formatMessage({defaultMessage:"Nonprofit teams cannot upgrade to Enterprise.",id:"7cN+gwiodb"});case"not_self_serve":return e.formatMessage({defaultMessage:"Only self-serve Team subscriptions can upgrade to Enterprise.",id:"VgEZNKPws2"});case"upgrade_in_progress":return e.formatMessage({defaultMessage:"An Enterprise upgrade is already in progress.",id:"3W8QD5xZrw"});case"no_active_subscription":return e.formatMessage({defaultMessage:"An active Team subscription is required to upgrade to Enterprise.",id:"LQnjHjjv+n"});case"non_usd_currency":return e.formatMessage({defaultMessage:"Enterprise upgrades are currently only available for USD subscriptions.",id:"qmddgBpc8u"});case"ie_entity_not_supported":return e.formatMessage({defaultMessage:"Enterprise upgrade isn't available in your billing region yet \u2014 contact sales to upgrade.",id:"l1Uo1IhLRN"});case"team_trial_active":return e.formatMessage({defaultMessage:"Enterprise upgrade is available after your free trial ends.",id:"3A/xmbUl2X"});case"promo_ineligible":return e.formatMessage({defaultMessage:"Your organization isn't eligible for this plan right now. Contact sales for help.",id:"LfZUb1sDVr"});default:return e.formatMessage({defaultMessage:"Enterprise is not available for this account.",id:"DF/SGEhhkB"})}}function M(e){return e instanceof r&&"promo_ineligible"===e.errorCode}const v=()=>o("/api/team-signup/eligibility","POST",{meta:{noToast:!0},onError:e=>i(e,{source:"team_signup_eligibility"})}),h=()=>{const{account:e}=s(),{data:a,isLoading:r,error:o}=t("/api/team-signup/voucher-eligible",{queryKey:["voucher_eligible",e?.uuid],enabled:!!e,staleTime:6e5,meta:{noToast:!0}});return d.useEffect(()=>{o&&i(o,{source:"team_trial_voucher_eligible"})},[o]),{eligible:a?.eligible??!1,isLoading:r}},E=()=>o("/api/team-signup/trial-voucher","POST",{meta:{noToast:!0},onError:e=>i(e,{source:"team_trial_voucher_grant"})});export{h as a,E as b,v as c,_ as d,b as g,M as i,p as m,m as u};
