{"version":3,"file":"SmoothScroll_Prod.BuAP_wbl.mjs","names":["useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/Yppqt3Cs3Y8TZqvASnXl/5hCj5aqz259Cc22vd8sH/SmoothScroll_Prod.js"],"sourcesContent":["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import Lenis from\"lenis\";// import Lenis from \"@studio-freight/lenis\"\nimport{useEffect,useRef}from\"react\";/**\n * @framerDisableUnlink\n */export default function SmoothScroll(props){const{intensity}=props;const lenis=useRef(null);useEffect(()=>{if(lenis.current)lenis.current.scrollTo(0,{immediate:true});},[lenis]);useEffect(()=>{const overlayElement=document.getElementById(\"overlay\");if(overlayElement){const handleMutation=(mutationsList,observer)=>{for(const mutation of mutationsList){if(mutation.type===\"childList\"){const hasChildren=overlayElement.children.length>0;if(hasChildren){// Check if the html tag has the style \"overflow: hidden;\"\nconst htmlElement=document.documentElement;const computedStyle=window.getComputedStyle(htmlElement);const isOverflowHidden=computedStyle.getPropertyValue(\"overflow\")===\"hidden\";if(isOverflowHidden){overlayElement.setAttribute(\"data-lenis-prevent\",\"true\");}}}}};const observer=new MutationObserver(handleMutation);const config={childList:true};observer.observe(overlayElement,config);return()=>observer.disconnect();}},[]);useEffect(()=>{const allElements=document.getElementsByTagName(\"*\");for(let i=0;i<allElements.length;i++){const element=allElements[i];const computedStyle=window.getComputedStyle(element);if(computedStyle.getPropertyValue(\"overflow\")===\"auto\"){element.setAttribute(\"data-lenis-prevent\",\"true\");}}},[]);useEffect(()=>{lenis.current=new Lenis({duration:intensity/10});const raf=time=>{if(lenis.current){lenis.current.raf(time);requestAnimationFrame(raf);}};requestAnimationFrame(raf);return()=>{if(lenis.current){lenis.current.destroy();lenis.current=null;}};},[]);useEffect(()=>{const styleElement=document.createElement(\"style\");styleElement.textContent=`\nhtml.lenis {\nheight: auto;\n}\n.lenis.lenis-smooth {\n\nscroll-behavior: auto !important;\n}\n.lenis.lenis-smooth [data-lenis-prevent] {\n\noverscroll-behavior: contain;\n}\n.lenis.lenis-stopped {\n\noverflow: hidden;\n}\n.lenis.lenis-scrolling iframe {\n\npointer-events: none;\n}\n`;document.head.appendChild(styleElement);return()=>{document.head.removeChild(styleElement);};},[]);// Fix the Anchor link\nuseEffect(()=>{const anchorLinks=[...document.querySelectorAll(\"a[href]\")];const handleClick=(e,href)=>{e.preventDefault();lenis.current.scrollTo(href);};anchorLinks.filter(a=>a.href.includes(\"#\")).forEach(a=>{const href=`#${a.href.split(\"#\").pop()}`;a.addEventListener(\"click\",e=>handleClick(e,href));});return()=>{anchorLinks.filter(a=>a.href.includes(\"#\")).forEach(a=>{a.removeEventListener(\"click\",handleClick);});};},[lenis]);return /*#__PURE__*/_jsx(_Fragment,{});}SmoothScroll.displayName=\"Smooth Scroll\";addPropertyControls(SmoothScroll,{intensity:{title:\"Intensity\",type:ControlType.Number,defaultValue:10,description:\"More components at [Framer University](https://framer.university?utm_source=component).\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothScroll\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SmoothScroll_Prod.map"],"mappings":"4OAGG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,aAAW,EAAY,EAAMA,EAAO,IAAI,EAsBkV,OAtBhV,MAAc,CAAI,EAAM,SAAQ,EAAM,QAAQ,SAAS,EAAE,CAAC,UAAU,EAAI,CAAC,CAAE,EAAE,CAAC,CAAK,CAAC,EAAE,MAAc,CAAC,IAAM,EAAe,SAAS,eAAe,SAAS,EAAE,GAAG,EAAe,CACT,IAAM,EAAS,IAAI,kBADa,EAAc,IAAW,CAAC,IAAI,IAAM,KAAY,EAAe,GAAG,EAAS,OAAO,aAA+B,EAAe,SAAS,OAAO,EAAiB,CACtc,IAAM,EAAY,SAAS,gBA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