{"version":3,"file":"WatchNowOverrides.CBdatih_.mjs","names":["useRef","useCallback","__esmMin","init_npm_react_18_3_1","ne","init_ssg_sandbox_shims","window","c","J","ce","de","init_framer_DymZktPS","RenderTarget","useIsStaticRenderer","assignRef","ref","value","resolveScopedForm","byId","elementId","root","queryById","getRegistrationFields","affiliationSelect","form","otherAffiliationInput","syncOtherAffiliationValidation","isOtherSelected","changed","nextAriaRequired","emitEvents","withWatchFormSubmit","Override","rootRef","redirectedRef","isStatic","isCanvas","setRefs","node","forwardedRef","sync","onSuccess","args","props","Component","withQuestionFormSubmit","redirectRef","init_WatchNowOverrides","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/7IrZjOCyO54oSa9vV2TO/YAoofydwF129Vai1Hlgn/WatchNowOverrides.js"],"sourcesContent":["// Update WatchNowOverrides.tsx for native canvas form overrides:\n// - Keep gated-video override available.\n// - Change withWatchFormSubmit to prevent navigation, validate natively, submit FormData via fetch POST to\n//   https://formsubmit.co/ajax/Yntema@tallen-inc.com, append _subject=\"Webinar Access Registration\" and _template=\"table\",\n//   and navigate to /webinar-video only on successful response.\n// - Preserve entered values if request fails, prevent duplicate submissions while pending, and expose an accessible\n//   failure message or browser alert if delivery fails.\n// - Add withQuestionFormSubmit (display name: Question Form Submit) with same validated AJAX submission target,\n//   using subject \"Webinar Questions\", visible submit states, and a success-only /message-sent redirect.\n// - Keep SSR/canvas-safe behavior and proper cleanup. Overrides only, not components.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,startTransition,useCallback,useEffect,useRef,useState}from\"react\";import{RenderTarget,useIsStaticRenderer}from\"framer\";function assignRef(ref,value){if(typeof ref===\"function\"){ref(value);return;}if(ref&&typeof ref===\"object\"){ref.current=value;}}function getFormFromEvent(event){const target=event.target;if(!(target instanceof Element))return null;if(target instanceof HTMLFormElement)return target;return target.closest(\"form\");}function resolveScopedForm(root,elementId){if(typeof document===\"undefined\")return null;const byId=document.getElementById(elementId);if(byId instanceof HTMLFormElement){if(!root||root===byId||root.contains(byId)||byId.contains(root))return byId;}if(!root)return null;if(root instanceof HTMLFormElement&&root.id===elementId)return root;const queryById=root.querySelector(`form[id=\"${elementId}\"]`);if(queryById instanceof HTMLFormElement)return queryById;return null;}function getRegistrationFields(form){const affiliationSelect=form.querySelector('select[name=\"Affiliation Designation\"]');const otherAffiliationInput=form.querySelector('input[name=\"Other Affiliation\"]');return{affiliationSelect:affiliationSelect instanceof HTMLSelectElement?affiliationSelect:null,otherAffiliationInput:otherAffiliationInput instanceof HTMLInputElement?otherAffiliationInput:null};}function syncOtherAffiliationValidation(form,emitEvents){const{affiliationSelect,otherAffiliationInput}=getRegistrationFields(form);if(!affiliationSelect||!otherAffiliationInput)return;const isOtherSelected=affiliationSelect.value===\"Other\";let changed=false;if(otherAffiliationInput.required!==isOtherSelected){otherAffiliationInput.required=isOtherSelected;changed=true;}const nextAriaRequired=isOtherSelected?\"true\":\"false\";if(otherAffiliationInput.getAttribute(\"aria-required\")!==nextAriaRequired){otherAffiliationInput.setAttribute(\"aria-required\",nextAriaRequired);changed=true;}if(isOtherSelected&&otherAffiliationInput.value.trim().length===0){if(!otherAffiliationInput.validity.customError){otherAffiliationInput.setCustomValidity(\"Please enter your affiliation.\");changed=true;}}else if(otherAffiliationInput.validity.customError){otherAffiliationInput.setCustomValidity(\"\");changed=true;}if(changed&&emitEvents){otherAffiliationInput.dispatchEvent(new Event(\"input\",{bubbles:true}));otherAffiliationInput.dispatchEvent(new Event(\"change\",{bubbles:true}));}}const FORM_ENDPOINT=\"https://formsubmit.co/ajax/Yntema@tallen-inc.com\";const TEMPLATE_VALUE=\"table\";function setSubmitButtonsDisabled(form,disabled){const submitters=form.querySelectorAll('button[type=\"submit\"], input[type=\"submit\"]');submitters.forEach(node=>{if(node instanceof HTMLButtonElement||node instanceof HTMLInputElement){node.disabled=disabled;node.setAttribute(\"aria-disabled\",disabled?\"true\":\"false\");}});}async function submitNativeForm(form,subject){const formData=new FormData(form);formData.append(\"_subject\",subject);formData.append(\"_template\",TEMPLATE_VALUE);let response;try{response=await fetch(FORM_ENDPOINT,{method:\"POST\",body:formData,headers:{Accept:\"application/json\"}});}catch(_error){throw new Error(\"Network error while sending the form. Please check your connection and disable privacy/ad blockers for this site, then try again.\");}let payload=null;try{payload=await response.json();}catch(_error){throw new Error(`Submission failed: server returned an unreadable response (HTTP ${response.status}).`);}const payloadMessage=typeof payload===\"string\"?payload:payload&&typeof payload===\"object\"?typeof payload.message===\"string\"?payload.message:typeof payload.error===\"string\"?payload.error:typeof payload.errors===\"string\"?payload.errors:Array.isArray(payload.errors)?payload.errors.map(entry=>typeof entry===\"string\"?entry:entry&&typeof entry.message===\"string\"?entry.message:\"\").filter(Boolean).join(\", \"):\"\":\"\";if(!response.ok){throw new Error(payloadMessage||`Submission failed with HTTP ${response.status}.`);}if(!payload||typeof payload!==\"object\"){throw new Error(\"Submission failed: malformed response body.\");}if(!(payload.success===true||payload.success===\"true\")){throw new Error(payloadMessage||\"Submission was not accepted by the form service.\");}}export function withWatchFormSubmit(Component){const Override=/*#__PURE__*/forwardRef(function WatchFormSubmit(props,forwardedRef){const rootRef=useRef(null);const redirectedRef=useRef(false);const isStatic=useIsStaticRenderer();const isCanvas=RenderTarget.current()===RenderTarget.canvas;const setRefs=useCallback(node=>{rootRef.current=node;assignRef(forwardedRef,node);},[forwardedRef]);useEffect(()=>{if(isCanvas||isStatic)return;const form=resolveScopedForm(rootRef.current,\"watch-registration\");if(!form)return;const sync=()=>syncOtherAffiliationValidation(form,true);syncOtherAffiliationValidation(form,false);form.addEventListener(\"change\",sync);form.addEventListener(\"input\",sync);return()=>{form.removeEventListener(\"change\",sync);form.removeEventListener(\"input\",sync);};},[isCanvas,isStatic]);const onSuccess=useCallback((...args)=>{if(typeof props.onSuccess===\"function\")props.onSuccess(...args);if(isCanvas||isStatic||typeof window===\"undefined\"||redirectedRef.current)return;redirectedRef.current=true;window.location.assign(\"/webinar-video\");},[props.onSuccess,isCanvas,isStatic]);return /*#__PURE__*/_jsx(Component,{...props,ref:setRefs,onSuccess:onSuccess});});Override.displayName=\"Watch Form Submit\";return Override;}export function withQuestionFormSubmit(Component){const Override=/*#__PURE__*/forwardRef(function QuestionFormSubmit(props,forwardedRef){const redirectRef=useRef(null);const isStatic=useIsStaticRenderer();const isCanvas=RenderTarget.current()===RenderTarget.canvas;useEffect(()=>()=>{if(redirectRef.current)clearTimeout(redirectRef.current);},[]);const onSuccess=useCallback((...args)=>{if(typeof props.onSuccess===\"function\")props.onSuccess(...args);if(isCanvas||isStatic||typeof window===\"undefined\"||redirectRef.current)return;redirectRef.current=setTimeout(()=>window.location.assign(\"/message-sent\"),1e3);},[props.onSuccess,isCanvas,isStatic]);return /*#__PURE__*/_jsx(Component,{...props,ref:forwardedRef,onSuccess:onSuccess});});Override.displayName=\"Question Form Submit\";return Override;}// Legacy export retained for compatibility; native Framer form variants own button state.\nexport function withQuestionSubmitState(Component){return /*#__PURE__*/forwardRef(function QuestionSubmitState(props,ref){return /*#__PURE__*/_jsx(Component,{...props,ref:ref});});}export function withGatedVideoReveal(Component){const Override=/*#__PURE__*/forwardRef(function GatedVideoReveal(props,forwardedRef){const rootRef=useRef(null);const isStatic=useIsStaticRenderer();const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[isUnlocked,setIsUnlocked]=useState(isCanvas||isStatic);const setRefs=useCallback(node=>{rootRef.current=node;assignRef(forwardedRef,node);},[forwardedRef]);useEffect(()=>{if(isCanvas||isStatic||typeof window===\"undefined\")return;const onUnlock=()=>{startTransition(()=>setIsUnlocked(true));};window.addEventListener(\"watch-now-unlock\",onUnlock);return()=>{window.removeEventListener(\"watch-now-unlock\",onUnlock);};},[isCanvas,isStatic]);useEffect(()=>{if(!isUnlocked||isCanvas||isStatic||typeof window===\"undefined\")return;const node=rootRef.current;if(!node)return;const rafId=window.requestAnimationFrame(()=>{node.scrollIntoView({behavior:\"smooth\",block:\"start\",inline:\"nearest\"});});return()=>{window.cancelAnimationFrame(rafId);};},[isUnlocked,isCanvas,isStatic]);return /*#__PURE__*/_jsx(Component,{...props,ref:setRefs,style:{...props.style,...isUnlocked?{}:{display:\"none\"}}});});Override.displayName=\"Gated Video Reveal\";return Override;}\nexport const __FramerMetadata__ = {\"exports\":{\"withWatchFormSubmit\":{\"type\":\"reactHoc\",\"name\":\"withWatchFormSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withQuestionSubmitState\":{\"type\":\"reactHoc\",\"name\":\"withQuestionSubmitState\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withQuestionFormSubmit\":{\"type\":\"reactHoc\",\"name\":\"withQuestionFormSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withGatedVideoReveal\":{\"type\":\"reactHoc\",\"name\":\"withGatedVideoReveal\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WatchNowOverrides.map"],"mappings":"A,0MAUoL,SAASc,EAAU,EAAI,EAAM,CAAI,OAAOC,GAAM,WAAYA,EAAIC,CAAK,EAAaD,GAAK,OAAOA,GAAM,WAAU,EAAI,QAAQC,EAAO,CAA0L,SAASC,EAAkB,EAAK,EAAU,CAAC,GAAG,OAAO,SAAW,IAAY,OAAO,KAAK,IAAMC,EAAK,SAAS,eAAeC,CAAS,EAAE,GAAGD,aAAgB,kBAAoB,CAACE,GAAMA,IAAOF,GAAME,EAAK,SAASF,CAAI,GAAGA,EAAK,SAASE,CAAI,GAAE,OAAOF,EAAM,GAAG,CAACE,EAAK,OAAO,KAAK,GAAGA,aAAgB,iBAAiBA,EAAK,KAAKD,EAAU,OAAOC,EAAK,IAAMC,EAAUD,EAAK,cAAc,YAAYD,EAAU,GAAG,EAA2D,OAAtDE,aAAqB,gBAAuBA,EAAiB,IAAK,CAAC,SAASC,EAAsB,EAAK,CAAC,IAAMC,EAAkBC,EAAK,cAAc,wCAAwC,EAAQC,EAAsBD,EAAK,cAAc,iCAAiC,EAAE,MAAM,CAAC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