{"version":3,"file":"GoogleRecaptcha.BNeGIHjO.mjs","names":["useRef","useState","__esmMin","init_ssg_sandbox_shims","_e","de","init_jsx_runtime","c","p","init_npm_react_18_3_1","ce","window","init_framer_BCdLsbZT","addPropertyControls","ControlType","RenderTarget","GoogleRecaptcha","props","isCanvas","recaptchaRef","containerRef","validationInputRef","widgetIdRef","isVerifiedRef","isVerified","setIsVerified","error","setError","markVerified","val","input","nativeSetter","value","siteKey","tryRender","renderV2","script","theme","err","init_GoogleRecaptcha"],"sources":["https:/framerusercontent.com/modules/8EnFQef28R40G8iexJ7R/2Ss3M8TIma3vBObyNE4H/GoogleRecaptcha.js"],"sourcesContent":["// @ts-nocheck\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth fixed\n * @framerIntrinsicWidth 304\n * @framerSupportedLayoutHeight auto\n */export default function GoogleRecaptcha(props){const{siteKey=\"\",theme=\"light\"}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const recaptchaRef=useRef(null);const containerRef=useRef(null);const validationInputRef=useRef(null);const widgetIdRef=useRef(null);const isVerifiedRef=useRef(false);const[isVerified,setIsVerified]=useState(false);const[error,setError]=useState(null);const markVerified=val=>{isVerifiedRef.current=val;setIsVerified(val);if(val)setError(null);};// Sync value into the validation input via native setter.\n// Must use native setter — React-controlled value won't trigger constraint validation.\n// CRITICAL: No `readOnly` on the input. Per HTML spec, `required` is NOT enforced\n// on readonly inputs — they always pass validation regardless of value.\nuseEffect(()=>{const input=validationInputRef.current;if(!input)return;const nativeSetter=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,\"value\")?.set;const value=isVerified?\"Yes\":\"\";nativeSetter?.call(input,value);input.setCustomValidity(isVerified?\"\":\"Please complete the captcha\");input.dispatchEvent(new Event(\"input\",{bubbles:true}));},[isVerified]);// Load reCAPTCHA script\nuseEffect(()=>{if(isCanvas||!siteKey)return;const tryRender=()=>{if(!window.grecaptcha||!recaptchaRef.current||widgetIdRef.current!==null)return;if(typeof window.grecaptcha.ready===\"function\"){window.grecaptcha.ready(()=>renderV2());}else{renderV2();}};if(window.grecaptcha){tryRender();return;}const existing=document.querySelector('script[src*=\"recaptcha/api.js\"]');if(existing){const t=setInterval(()=>{if(window.grecaptcha){clearInterval(t);tryRender();}},100);setTimeout(()=>clearInterval(t),1e4);return;}const script=document.createElement(\"script\");script.src=\"https://www.google.com/recaptcha/api.js?render=explicit\";script.async=true;script.defer=true;script.onload=()=>setTimeout(tryRender,100);script.onerror=()=>setError(\"Failed to load reCAPTCHA script\");document.head.appendChild(script);return()=>{widgetIdRef.current=null;};},[siteKey,theme,isCanvas]);const renderV2=()=>{if(!window.grecaptcha||!recaptchaRef.current||widgetIdRef.current!==null)return;if(typeof window.grecaptcha.render!==\"function\"){setError(\"reCAPTCHA render not available. Check site key, version (v2), and domain.\");return;}try{widgetIdRef.current=window.grecaptcha.render(recaptchaRef.current,{sitekey:siteKey,theme,size:\"normal\",callback:()=>markVerified(true),\"expired-callback\":()=>markVerified(false),\"error-callback\":()=>{markVerified(false);setError(\"reCAPTCHA error. Check site key (v2), domain registration, and that you're on your published domain.\");}});}catch(err){setError(`reCAPTCHA failed: ${err?.message||err}`);}};if(isCanvas){const url=theme===\"dark\"?\"https://nlbllifiywwihhynrcgn.supabase.co/storage/v1/object/public/SegmentUIAssets/captcha01.png\":\"https://nlbllifiywwihhynrcgn.supabase.co/storage/v1/object/public/SegmentUIAssets/captcha02.png\";return /*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",justifyContent:\"center\",width:\"100%\"},children:/*#__PURE__*/_jsx(\"img\",{src:url,alt:\"reCAPTCHA preview\",style:{width:304,height:\"auto\"}})});}return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{display:\"flex\",flexDirection:\"column\",alignItems:\"center\",width:\"100%\",position:\"relative\"},children:[/*#__PURE__*/_jsx(\"input\",{ref:validationInputRef,type:\"text\",required:true,defaultValue:\"\",tabIndex:-1,\"aria-hidden\":\"true\",style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"1px\",opacity:0,pointerEvents:\"none\",border:\"none\",padding:0,margin:0,zIndex:-1,fontSize:0}}),/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",justifyContent:\"center\",width:\"100%\"},children:/*#__PURE__*/_jsx(\"div\",{ref:recaptchaRef,style:{display:\"flex\",justifyContent:\"center\"}})}),error&&!isVerified&&/*#__PURE__*/_jsx(\"div\",{style:{marginTop:8,padding:8,background:\"#FFEBEE\",color:\"#C62828\",borderRadius:4,fontSize:12,width:\"100%\",textAlign:\"left\",whiteSpace:\"pre-line\"},children:error})]});}addPropertyControls(GoogleRecaptcha,{siteKey:{type:ControlType.String,title:\"Site Key\",defaultValue:\"\",placeholder:\"Enter your reCAPTCHA v2 site key\",description:\"Get your site key from [Google reCAPTCHA Admin](https://www.google.com/recaptcha/admin). Select reCAPTCHA v2.\"},theme:{type:ControlType.Enum,title:\"Theme\",options:[\"light\",\"dark\"],optionTitles:[\"Light\",\"Dark\"],defaultValue:\"light\",description:\"v1.3 \\n[via SegmentUI](https://www.segmentUI.com)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GoogleRecaptcha\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"304\",\"framerDisableUnlink\":\"*\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GoogleRecaptcha.map"],"mappings":"A,qNAOG,SAAwBgB,EAAgB,EAAM,CAAC,GAAK,CAAC,UAAQ,GAAG,QAAM,SAASC,EAAYC,EAASH,EAAa,QAAQ,IAAIA,EAAa,OAAaI,EAAanB,EAAO,IAAI,EAAQoB,EAAapB,EA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