{"version":3,"file":"RecapchaInput.pKskNLCa.mjs","names":["useState","useRef","__esmMin","window","init_npm_react_18_3_1","init_ssg_sandbox_shims","_e","de","init_jsx_runtime","p","ce","addPropertyControls","init_framer_BkYB2Gqq","ControlType","init_FramerFormsShared","HiddenInput","init_FramerFormsShared_XPyb","RecaptchaInput","verified","setVerified","props","RepatchaContainer","InvalideSetupMessage","init_RecapchaInput","captchaContainerRef","script","container","stripTokenName","textarea","observer","interval"],"sources":["https:/framer.com/m/FramerFormsShared-XPyb.js@hMz2wp3CWZkNwPJFGPgQ","https:/framerusercontent.com/modules/J0pYruOPdrrqmASXNd0m/gHDAvAB0LfLb5GUD1EKK/RecapchaInput.js"],"sourcesContent":["/*\n * FramerFormsShared\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/DwWOdDzQZGCuvkNlbUjZ/hMz2wp3CWZkNwPJFGPgQ/FramerFormsShared.js\"\n","import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef,useState}from\"react\";import{HiddenInput}from\"https://framer.com/m/FramerFormsShared-XPyb.js@hMz2wp3CWZkNwPJFGPgQ\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function RecaptchaInput(props){const[verified,setVerified]=useState(false);if(!props.siteKey){return /*#__PURE__*/_jsx(\"div\",{style:{...props.style},children:/*#__PURE__*/_jsx(InvalideSetupMessage,{})});}return /*#__PURE__*/_jsxs(\"div\",{style:{...props.style},children:[/*#__PURE__*/_jsx(RepatchaContainer,{siteKey:props.siteKey,onVerifiedChange:setVerified}),/*#__PURE__*/_jsx(HiddenInput,{name:\"recaptcha\",required:true,value:verified?\"Yes\":\"\"})]});}RecaptchaInput.displayName=\"reCAPTCHA Input\";addPropertyControls(RecaptchaInput,{siteKey:{type:ControlType.String,title:\"Site Key\",defaultValue:\"\",placeholder:\"Paste your site key here\"}});const RepatchaContainer=props=>{const captchaContainerRef=useRef(null);useEffect(()=>{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);}},[]);useEffect(()=>{if(!props.siteKey)return;const container=captchaContainerRef.current;if(!container)return;const stripTokenName=()=>{const textarea=container.querySelector('textarea[name=\"g-recaptcha-response\"]');if(textarea){textarea.removeAttribute(\"name\");return true;}return false;};const observer=new MutationObserver(()=>{stripTokenName();});observer.observe(container,{childList:true,subtree:true});const interval=setInterval(()=>{const reCaptchaInitialized=!!window.grecaptcha&&window.grecaptcha.render;if(!reCaptchaInitialized)return;window.grecaptcha.render(container,{sitekey:props.siteKey,callback:()=>{props.onVerifiedChange(true);stripTokenName();},\"expired-callback\":()=>props.onVerifiedChange(false)});clearInterval(interval);},500);return()=>{clearInterval(interval);observer.disconnect();};},[props.siteKey]);return /*#__PURE__*/_jsx(\"div\",{ref:captchaContainerRef});};const InvalideSetupMessage=()=>{return /*#__PURE__*/_jsx(\"div\",{style:{padding:\"12px\",background:\"#f5f5f5\",color:\"#888\",borderRadius:\"6px\",fontSize:\"14px\",textAlign:\"center\"},children:\"Enter your reCAPTCHA site key in the properties panel\"});};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RecaptchaInput\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RecapchaInput.map"],"mappings":"A,oSCGG,SAAwBiB,EAAe,EAAM,CAAC,GAAK,CAACC,EAASC,GAAanB,EAAS,EAAK,EAAmI,OAA7HoB,EAAM,QAA2I,gBAAM,MAAM,CAAC,MAAM,CAAC,GAAGA,EAAM,KAAK,EAAE,SAAS,CAAc,gBAAKC,EAAkB,CAAC,QAAQ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