{"version":3,"file":"Recaptcha.BIlfOyn8.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/PcvbN0gSggjO82kLt2Zu/B6RLUIsbxwV6eQYZqKcF/Recaptcha.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef,useState}from\"react\";/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function RecaptchaInput(props){const siteKey=props.siteKey;const theme=props.theme||\"light\"// \"light\" | \"dark\"\n;const name=\"recaptcha\"// fixed field name\n;const[verified,setVerified]=useState(false);const[showError,setShowError]=useState(false);const rootRef=useRef(null);// ✅ Reset state whenever the site key changes\nuseEffect(()=>{setVerified(false);setShowError(false);},[siteKey]);// Prevent form submission until reCAPTCHA is verified\nuseEffect(()=>{if(!siteKey)return;const root=rootRef.current;if(!root)return;const form=root.closest(\"form\");if(!form)return;const handleSubmit=event=>{if(!verified){event.preventDefault();event.stopPropagation();setShowError(true);}else{setShowError(false);}};form.addEventListener(\"submit\",handleSubmit);return()=>form.removeEventListener(\"submit\",handleSubmit);},[verified,siteKey]);return /*#__PURE__*/_jsxs(\"div\",{ref:rootRef,style:{...props.style},children:[siteKey?/*#__PURE__*/_jsx(RecaptchaContainer,{siteKey:siteKey,theme:theme,onVerifiedChange:value=>{setVerified(value);if(value)setShowError(false);}},`${theme}-${siteKey}`):/*#__PURE__*/_jsx(InvalidSetupMessage,{}),/*#__PURE__*/_jsx(\"input\",{type:\"hidden\",name:name,value:verified?\"Yes\":\"\"}),showError&&siteKey&&/*#__PURE__*/_jsx(\"div\",{style:{marginTop:\"6px\",color:\"#d11a1a\",fontSize:\"14px\",fontWeight:500},children:\"Please complete the reCAPTCHA before submitting.\"})]});}RecaptchaInput.displayName=\"reCAPTCHA Input\";// Component controls in the Framer side panel\naddPropertyControls(RecaptchaInput,{siteKey:{type:ControlType.String,title:\"Site Key\",defaultValue:\"\",placeholder:\"Paste your reCAPTCHA v2 site key here\",description:\"reCAPTCHA will load on the published site.\"},theme:{type:ControlType.Enum,title:\"Theme\",options:[\"light\",\"dark\"],optionTitles:[\"Light\",\"Dark\"],defaultValue:\"light\",description:\"Light/Dark theme is visible only after publishing.\"}});// =====================\n// reCAPTCHA v2 Container\n// =====================\nfunction RecaptchaContainer(props){const captchaContainerRef=useRef(null);// Load Google reCAPTCHA script only once\nuseEffect(()=>{if(typeof window===\"undefined\")return;if(!document.getElementById(\"recaptcha-script\")){const script=document.createElement(\"script\");script.id=\"recaptcha-script\";script.src=\"https://www.google.com/recaptcha/api.js?render=explicit\";script.async=true;script.defer=true;document.body.appendChild(script);}},[]);// Render the reCAPTCHA widget after the script loads\nuseEffect(()=>{if(!props.siteKey)return;if(typeof window===\"undefined\")return;const interval=setInterval(()=>{const grecaptcha=window.grecaptcha;const container=captchaContainerRef.current;if(!container)return;if(!grecaptcha||!grecaptcha.render)return;grecaptcha.render(container,{sitekey:props.siteKey,theme:props.theme,callback:()=>props.onVerifiedChange(true),\"expired-callback\":()=>props.onVerifiedChange(false)});clearInterval(interval);},500);return()=>clearInterval(interval);},[props.siteKey,props.theme]);return /*#__PURE__*/_jsx(\"div\",{ref:captchaContainerRef});}// =====================\n// Invalid Setup Message\n// =====================\nfunction InvalidSetupMessage(){return /*#__PURE__*/_jsx(\"div\",{style:{padding:\"12px\",background:\"#f5f5f5\",color:\"#888\",borderRadius:\"6px\",fontSize:\"14px\",textAlign:\"center\"},children:\"Enter your reCAPTCHA v2 site key in the properties panel.\"});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RecaptchaInput\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Recaptcha.map"],"mappings":"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