import{o as e}from"./rolldown-runtime-iuO8RvI4.js";import{$h as a,Ll as r,Tb as t,Vm as s,zm as i}from"./shared-0-C4kdVF7Y.js";import{Mi as n}from"./vendor-frame-CwiylG4Y.js";function o(e,a,r){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 r?.parentOrganizationName?e.formatMessage({defaultMessage:"New workspace creation has been restricted by {parentOrganizationName}. Contact your IT administrator.",id:"IFqAPuUXI2"},{parentOrganizationName:r.parentOrganizationName}):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\u2019s admin or reach out to support for help.",id:"e08C9eeYs8"});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\u2019t available in your billing region yet \u2014 contact sales to upgrade.",id:"KRjnPSSYwY"});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\u2019t eligible for this plan right now. Contact sales for help.",id:"kTAyGkfSGp"});default:return e.formatMessage({defaultMessage:"Enterprise is not available for this account.",id:"DF/SGEhhkB"})}}function u(e){return e instanceof t&&"promo_ineligible"===e.errorCode}var l=e(n()),g=()=>i("/api/team-signup/eligibility","POST",{meta:{noToast:!0},onError:e=>a(e,{source:"team_signup_eligibility"})}),d=()=>{const{account:e}=r(),{data:t,isLoading:i,error:n}=s("/api/team-signup/voucher-eligible",{queryKey:["voucher_eligible",e?.uuid],enabled:!!e,staleTime:6e5,meta:{noToast:!0}});return(0,l.useEffect)(()=>{n&&a(n,{source:"team_trial_voucher_eligible"})},[n]),{eligible:t?.eligible??!1,isLoading:i}},c=()=>i("/api/team-signup/trial-voucher","POST",{meta:{noToast:!0},onError:e=>a(e,{source:"team_trial_voucher_grant"})});export{u as a,o as i,c as n,d as r,g as t};