{"version":3,"file":"GoogleRecaptcha.DATQSblV.mjs","names":["useRef","useState"],"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":"gNAOG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,UAAQ,GAAG,QAAM,SAAS,EAAY,EAAS,EAAa,SAAS,GAAG,EAAa,OAAa,EAAaA,EAAO,KAAK,CAAO,EAAaA,EAAO,KAAK,CAAO,EAAmBA,EAAO,KAAK,CAAO,EAAYA,EAAO,KAAK,CAAO,EAAcA,EAAO,GAAM,CAAM,CAAC,EAAW,GAAeC,EAAS,GAAM,CAAM,CAAC,EAAM,GAAUA,EAAS,KAAK,CAAO,EAAa,GAAK,CAAC,EAAc,QAAQ,EAAI,EAAc,EAAI,CAAI,GAAI,EAAS,KAAK,EAI3e,MAAc,CAAC,IAAM,EAAM,EAA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