import{Bi as a,zi as i}from"./shared-0-C4kdVF7Y.js";import{ki as e}from"./vendor-frame-CwiylG4Y.js";import{xc as s}from"./shared-1-3-6x7RKF.js";import{nn as l,rn as t}from"./vendor-all-2-BJdkbLSj.js";import{t as n}from"./c9c09e9df-CXzG9keh.js";var o=e();function d(e,{selfEmail:s,existingEmails:l,emailDomains:t,isDuplicate:n}){return 0===e.trim().length?"valid":a(e)?null===t||void 0!==t&&0===t.length?"no_domain":void 0===t||i(e,t)?void 0!==s&&e.trim().toLowerCase()===s.trim().toLowerCase()?"self":n||void 0!==l&&l.some(a=>a.trim()===e.trim())?"duplicate":"valid":"invalid_domain":"invalid_email"}function r({validity:a,emailDomains:i,emailValue:e}){const d=t();if("string"==typeof i&&(i=[i]),"valid"===a||void 0===i)return null;let r;return r="invalid_email"===a&&1===i.length?(0,o.jsx)(l,{defaultMessage:"{email} is not a valid email.",id:"GiTfXA56lr",values:{email:e}}):"duplicate"===a?(0,o.jsx)(l,{defaultMessage:"{email} is already added.",id:"2bAYZHfe4T",values:{email:e}}):"self"===a?(0,o.jsx)(l,{defaultMessage:"You cannot invite yourself.",id:"T7CkYTVkuJ"}):"no_domain"===a?(0,o.jsx)(l,{defaultMessage:"Your organization is misconfigured, please <link>contact support</link>.",id:"Mp3f+CyqUr",values:{link:a=>(0,o.jsx)(s,{href:"https://support.anthropic.com/",children:a})}}):i.length>1?(0,o.jsx)(l,{defaultMessage:"Members must have an {domains} email address.",id:"/8fG7YnSUb",values:{domains:new Intl.ListFormat(d.locale,{style:"long",type:"disjunction"}).format(i.map(a=>"@"+a))}}):(0,o.jsx)(l,{defaultMessage:"Members must have an @{domain} email address.",id:"m0RKVlqMMA",values:{domain:i[0]}}),(0,o.jsx)(n,{children:r})}export{d as n,r as t};