{"version":3,"file":"Smooth_Scroll.DdWq3R_f.mjs","names":["useRef","_Fragment","__esmMin","de","init_ssg_sandbox_shims","ce","window","l","init_npm_react_18_3_1","c","init_jsx_runtime","init_framer_DxfB3JJo","addPropertyControls","ControlType","init_lenis","Lenis","SmoothScroll","props","lenis","overlayElement","observer","mutation","mutationsList","htmlElement","intensity","raf","time","init_Smooth_Scroll"],"sources":["https:/framerusercontent.com/modules/Yppqt3Cs3Y8TZqvASnXl/ALzPzo9ZL7qsyNt6jnNi/Smooth_Scroll.js"],"sourcesContent":["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import Lenis from\"@studio-freight/lenis\";import{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){lenis.current.stop();}else{lenis.current.start();}}else{lenis.current.start();}}}};const observer=new MutationObserver(handleMutation);const config={childList:true};observer.observe(overlayElement,config);return()=>observer.disconnect();}},[]);useEffect(()=>{lenis.current=new Lenis({duration:intensity/10});const raf=time=>{lenis.current.raf(time);requestAnimationFrame(raf);};requestAnimationFrame(raf);return()=>{lenis.current.destroy();lenis.current=null;};},[]);return /*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsx(\"style\",{children:`\n      html.lenis {\n        height: auto;\n      }\n\n      .lenis.lenis-smooth {\n        scroll-behavior: auto !important;\n      }\n\n      .lenis.lenis-smooth [data-lenis-prevent] {\n        overscroll-behavior: contain;\n      }\n\n      .lenis.lenis-stopped {\n        overflow: hidden;\n      }\n\n      .lenis.lenis-scrolling iframe {\n        pointer-events: none;\n      }\n    `})});}SmoothScroll.displayName=\"Smooth Scroll\";addPropertyControls(SmoothScroll,{intensity:{title:\"Intensity\",type:ControlType.Number,defaultValue:10}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothScroll\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Smooth_Scroll.map"],"mappings":"A,8PAEG,SAAwBgB,EAAa,EAAM,CAAC,GAAK,CAAC,aAAWC,EAAYC,EAAMlB,EAAO,IAAI,EAC4jB,OAD1jBK,MAAc,CAAIa,EAAM,SAAQA,EAAM,QAAQ,SAAS,EAAE,CAAC,UAAU,EAAI,CAAC,CAAE,EAAE,CAACA,CAAK,CAAC,EAAEb,MAAc,CAAC,IAAMc,EAAe,SAAS,eAAe,SAAS,EAAE,GAAGA,EAAe,CACW,IAAMC,EAAS,IAAI,kBADP,EAAc,IAAW,CAAC,IAAI,IAAMC,KAAYC,EAAe,GAAGD,EAAS,OAAO,YAAY,CAAoD,GAAjCF,EAAe,SAAS,OAAO,EAAiB,CACtc,IAAMI,EAAY,SAAS,gBAAoCjB,EAAO,iBAAiBiB,CAAgD,CAAC,CAAC,iBAAiB,UAAU,IAAI,SAA8BL,EAAM,QAAQ,KAAK,EAAQA,EAAM,QAAQ,MAAM,CAAG,MAAMA,EAAM,QAAQ,MAAM,CAAG,CAAE,CAAoD,EAAwE,OAAxCE,EAAS,QAAQD,EAAe,CAAhD,UAAU,EAA2C,CAAC,MAAYC,EAAS,WAAW,CAAE,CAAC,EAAE,CAAC,CAAC,EAAEf,MAAc,CAAC,EAAM,QAAQ,IAAIU,EAAM,CAAC,SAASS,EAAU,EAAE,CAAC,E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