{"version":3,"file":"RedirectOnView.pu7SLOAa.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/X2YkUpyBlWqBYvZmESyH/FGF5PrrvXW1CSb0efhPo/RedirectOnView.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function AutoDownloadOnView(props){const{targetUrl,style}=props;const ref=useRef(null);useEffect(()=>{if(typeof window===\"undefined\"||!ref.current)return;let triggered=false;const observer=new window.IntersectionObserver(entries=>{// Ensure we have a URL and it hasn't fired yet\nif(!triggered&&entries[0].isIntersecting&&targetUrl){triggered=true;// The Fix: Force HTTPS if the user forgot it\nconst secureUrl=targetUrl.replace(\"http://\",\"https://\");const link=document.createElement(\"a\");link.href=secureUrl;link.target=\"_blank\";link.rel=\"noopener noreferrer\";// For modern browsers, we add the download attribute\n// though it may be ignored cross-origin, target=\"_blank\" handles the rest\nlink.setAttribute(\"download\",\"\");document.body.appendChild(link);link.click();document.body.removeChild(link);}},{threshold:.1}// Fires when 10% of the component is visible\n);observer.observe(ref.current);return()=>observer.disconnect();},[targetUrl]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{...style,width:\"100%\",height:\"10px\",backgroundColor:\"transparent\"}});}addPropertyControls(AutoDownloadOnView,{targetUrl:{type:ControlType.String,title:\"ZIP URL\",defaultValue:\"https://\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AutoDownloadOnView\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RedirectOnView.map"],"mappings":"gMAAmI,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,YAAU,SAAO,EAAY,EAAIA,EAAO,KAAK,CAKzJ,OAL0J,MAAc,CAAC,GAAU,IAAS,QAAa,CAAC,EAAI,QAAQ,OAAO,IAAI,EAAU,GAAY,EAAS,IAAI,EAAO,qBAAqB,GAAS,CACxX,GAAG,CAAC,GAAW,EAAQ,GAAG,gBAAgB,EAAU,CAAC,EAAU,GAC/D,IAAM,EAAU,EAAU,QAAQ,UAAU,WAAW,CAAO,EAAK,SAAS,cAAc,IAAI,CAAC,EAAK,KAAK,EAAU,EAAK,OAAO,SAAS,EAAK,IAAI,sBAEjJ,EAAK,aAAa,WAAW,GAAG,CAAC,SAAS,KAAK,YAAY,EAAK,CAAC,EAAK,OAAO,CAAC,SAAS,KAAK,YAAY,EAAK,GAAI,CAAC,UAAU,GAAG,CAC9H,CAA+B,OAA9B,EAAS,QAAQ,EAAI,QAAQ,KAAW,EAAS,YAAY,EAAG,CAAC,EAAU,CAAC,CAAqB,EAAK,MAAM,CAAK,MAAI,MAAM,CAAC,GAAG,EAAM,MAAM,OAAO,OAAO,OAAO,gBAAgB,cAAc,CAAC,CAAC,sBALvJ,IAAoC,IAAoD,CAKiE,EAAoB,EAAmB,CAAC,UAAU,CAAC,KAAK,EAAY,OAAO,MAAM,UAAU,aAAa,WAAW,CAAC,CAAC"}