{"version":3,"file":"DownloadAndRedirect.BaZwJ_B7.mjs","names":["__esmMin","init_ssg_sandbox_shims","c","J","init_jsx_runtime","ce","init_npm_react_18_3_1","window","RenderTarget","init_framer_BisrWwwE","startDownload","blob","PDF_URL","url","a","PDF_NAME","withAutoDownload","t","Component","props","withRedirectOnSuccess","REDIRECT_TO","init_DownloadAndRedirect"],"sources":["https:/framerusercontent.com/modules/FEhRBI9uq9dPPIfSmRok/86Wc0LsDEWChvs9sRjI6/DownloadAndRedirect.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect}from\"react\";import{RenderTarget}from\"framer\";// Paste your PDF file URL here (Site Settings → Files, or any public link)\nconst PDF_URL=\"https://framerusercontent.com/assets/helI05b9VdfPxzX4vCIueQNoo.pdf\";const PDF_NAME=\"LOIS_WHITEPAPER_VOLUME01.pdf\";const REDIRECT_TO=\"/authenticity-whitepaper-thank-you\";async function startDownload(){try{const res=await fetch(PDF_URL);const blob=await res.blob();const url=URL.createObjectURL(blob);const a=document.createElement(\"a\");a.href=url;a.download=PDF_NAME;document.body.appendChild(a);a.click();a.remove();setTimeout(()=>URL.revokeObjectURL(url),1e4);}catch{window.open(PDF_URL,\"_blank\");}}export function withDownloadAndRedirect(Component){return /*#__PURE__*/forwardRef(function DownloadAndRedirect(props,ref){const{style,onClick,...rest}=props;const handleClick=event=>{onClick?.(event);// Only download when the form is filled in correctly; let the form submit as usual\nconst form=event?.currentTarget?.closest?.(\"form\");if(form&&!form.checkValidity())return;startDownload();};return /*#__PURE__*/_jsx(Component,{...rest,ref:ref,style:{...style,cursor:\"pointer\"},onClick:handleClick});});}export function withAutoDownload(Component){return /*#__PURE__*/forwardRef(function AutoDownload(props,ref){useEffect(()=>{if(typeof window===\"undefined\")return;const t=setTimeout(()=>{startDownload();},600);return()=>clearTimeout(t);},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});});}// Shown only in the button's Success state: redirects once the form has been sent\nexport function withRedirectOnSuccess(Component){return /*#__PURE__*/forwardRef(function RedirectOnSuccess(props,ref){useEffect(()=>{if(typeof window===\"undefined\")return;if(RenderTarget.current()===RenderTarget.canvas)return;const t=setTimeout(()=>{window.location.href=REDIRECT_TO;},400);return()=>clearTimeout(t);},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withAutoDownload\":{\"type\":\"reactHoc\",\"name\":\"withAutoDownload\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRedirectOnSuccess\":{\"type\":\"reactHoc\",\"name\":\"withRedirectOnSuccess\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withDownloadAndRedirect\":{\"type\":\"reactHoc\",\"name\":\"withDownloadAndRedirect\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DownloadAndRedirect.map"],"mappings":"A,yLACwL,eAAeU,GAAe,CAAC,GAAG,CAAgC,IAAMC,EAAK,MAAM,MAAhC,MAAMC,CAAO,EAAA,CAAuB,KAAK,EAAQC,EAAI,IAAI,gBAAgBF,CAAI,EAAQG,EAAE,SAAS,cAAc,GAAG,EAAE,EAAE,KAAKD,EAAI,EAAE,SAASE,EAAS,SAAS,KAAK,YAAYD,CAAC,EAAEA,EAAE,MAAM,EAAEA,EAAE,OAAO,EAAE,eAAe,IAAI,gBAAgBD,CAAG,EAAE,GAAG,CAAE,MAAM,CAACN,EAAO,KAAKK,EAAQ,QAAQ,CAAE,CAAC,CACvS,SAAgBI,EAAiB,EAAU,CAAC,MAAoB,gBAAW,SAAsB,EAAM,EAAI,CAAqI,OAApIX,MAAc,CAAC,GAAUE,IAAS,OAAY,OAAO,IAAMU,EAAE,eAAe,CAACP,EAAc,CAAE,EAAE,GAAG,EAAE,UAAU,aAAaO,CAAC,CAAE,EAAE,CAAC,CAAC,EAAsB,gBAAKC,EAAU,CAAC,GAAGC,EAAU,KAAG,CAAC,CAAE,CAAC,CAAE,CACrgB,SAAgBC,EAAsB,EAAU,CAAC,MAAoB,gBAAW,SAA2B,EAAM,EAAI,CAA6M,OAA5Mf,MAAc,CAAuC,GAA5BE,IAAS,QAAsBC,EAAa,QAAQ,IAAIA,EAAa,OAAO,OAAO,IAAMS,EAAE,eAAe,CAAC,EAAO,SAAS,KAAKI,CAAY,EAAE,GAAG,EAAE,UAAU,aAAaJ,CAAC,CAAE,EAAE,CAAC,CAAC,EAAsB,gBAAKC,EAAU,CAAC,GAAGC,EAAU,KAAG,CAAC,CAAE,CAAC,CAAE,C,wDAFtX,EAAQ,qEAA2E,EAAS,+BAAqC,EAAY,oC"}