{"version":3,"file":"GateEmail.CKrhkcP3.mjs","names":[],"sources":["https:/framerusercontent.com/modules/RWBaq9wYKDltK97moxGP/LbbA4Xay8CC4IW4raYY0/GateEmail.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef}from\"react\";const DEFAULT_BLOCKED=[\"gmail.com\",\"googlemail.com\",\"yahoo.com\",\"outlook.com\",\"hotmail.com\",\"icloud.com\",\"aol.com\",\"proton.me\",\"protonmail.com\"];function getDomain(email){const at=email.lastIndexOf(\"@\");if(at===-1)return\"\";return email.slice(at+1).trim().toLowerCase();}function findInput(el){if(!el)return null;// If the layer *is* the input\nif(el.tagName===\"INPUT\")return el;// Otherwise search inside\nreturn el.querySelector(\"input\");}export function withGateEmail(Component,options={}){const blocked=new Set((options.blockedDomains??DEFAULT_BLOCKED).map(d=>d.toLowerCase()));const message=options.message??\"Please use your work email address.\";const reportOnBlur=options.reportOnBlur??true;return /*#__PURE__*/forwardRef(function GateEmail(props,ref){const handleInput=e=>{// Best-case: handler is attached to the actual input\nconst target=e?.currentTarget||e?.target;const value=String(target?.value??\"\").trim();const domain=getDomain(value);// If we can access the real input, enforce custom validity\nif(target&&typeof target.setCustomValidity===\"function\"){if(value&&domain&&blocked.has(domain)){target.setCustomValidity(message);}else{target.setCustomValidity(\"\");}}// Preserve any existing behavior Framer already had\nprops?.onInput?.(e);props?.onChange?.(e);};const handleBlur=e=>{props?.onBlur?.(e);if(!reportOnBlur)return;const target=e?.currentTarget||e?.target;if(target&&typeof target.reportValidity===\"function\"){target.reportValidity();return;}// Fallback: find nested input and report validity\nconst host=(e?.currentTarget)??null;const input=findInput(host);input?.reportValidity?.();};return /*#__PURE__*/_jsx(Component,{...props,ref:ref,// Use both — different Framer input layers sometimes fire one or the other\nonInput:handleInput,onChange:handleInput,onBlur:handleBlur});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withGateEmail\":{\"type\":\"reactHoc\",\"name\":\"withGateEmail\",\"annotations\":{\"framerContractVers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