{"version":3,"file":"Smooth_Scrol.Bb2V00aC.mjs","names":["useRef","Lenis","intensity"],"sources":["https:/framerusercontent.com/modules/JJyJUNrgRIv71UTgolWA/pjWOuo2y5dqOZy8LKzcK/Smooth_Scrol.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import Lenis from\"@studio-freight/lenis\";export default function SmoothScroll({intensity=10}){const lenisRef=useRef(null);useEffect(()=>{if(RenderTarget.current()===RenderTarget.thumbnail)return;const isScrollable=element=>{const style=window.getComputedStyle(element);return[\"auto\",\"scroll\"].includes(style.overflowY)&&element.scrollHeight>element.clientHeight;};const addPreventAttribute=()=>{document.querySelectorAll(\"*\").forEach(el=>{if(isScrollable(el)){el.setAttribute(\"data-lenis-prevent\",\"\");}});};addPreventAttribute();const observer=new MutationObserver(mutations=>{mutations.forEach(mutation=>{if(mutation.type===\"childList\"){mutation.addedNodes.forEach(node=>{if(node.nodeType===1){if(isScrollable(node)){node.setAttribute(\"data-lenis-prevent\",\"\");}node.querySelectorAll(\"*\").forEach(el=>{if(isScrollable(el)){el.setAttribute(\"data-lenis-prevent\",\"\");}});}});}});});observer.observe(document.body,{childList:true,subtree:true});lenisRef.current=new Lenis({duration:1.2,easing:t=>Math.min(1,1.001-Math.pow(2,-10*t)),direction:\"vertical\",gestureDirection:\"vertical\",smooth:true,smoothTouch:false,touchMultiplier:2});function raf(time){var _lenisRef_current;(_lenisRef_current=lenisRef.current)===null||_lenisRef_current===void 0?void 0:_lenisRef_current.raf(time);requestAnimationFrame(raf);}requestAnimationFrame(raf);return()=>{var _lenisRef_current;(_lenisRef_current=lenisRef.current)===null||_lenisRef_current===void 0?void 0:_lenisRef_current.destroy();observer.disconnect();};},[]);useEffect(()=>{if(lenisRef.current){// New conversion function for improved smoothness\nconst convertIntensityToLenisSmooth=intensity=>{// Map 1-100 to a smoothness range of 0.95 (almost no smoothing) to 0.05 (very smooth)\nreturn .95-(intensity-1)*(.9/99);};const lenisSmooth=convertIntensityToLenisSmooth(intensity);lenisRef.current.options.lerp=lenisSmooth;}},[intensity]);if(RenderTarget.current()===RenderTarget.thumbnail){return null;}return /*#__PURE__*/_jsx(\"slot\",{});}addPropertyControls(SmoothScroll,{intensity:{type:ControlType.Number,title:\"Intensity\",defaultValue:10,min:1,max:100,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothScroll\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Smooth_Scrol.map"],"mappings":"yPAAyL,SAAwB,EAAa,CAAC,YAAU,IAAI,CAAC,IAAM,EAASA,EAAO,KAAK,CAEhD,OAFiD,MAAc,CAAC,GAAG,EAAa,SAAS,GAAG,EAAa,UAAU,OAAO,IAAM,EAAa,GAAS,CAAC,IAAM,EAAM,EAAO,iBAAiB,EAAQ,CAAC,MAAM,CAAC,OAAO,SAAS,CAAC,SAAS,EAAM,UAAU,EAAE,EAAQ,aAAa,EAAQ,cAA8C,SAAS,iBAAiB,IAAI,CAAC,QAAQ,GAAI,CAAI,EAAa,EAAG,EAAE,EAAG,aAAa,qBAAqB,GAAG,EAAI,CAAyB,IAAM,EAAS,IAAI,iBAAiB,GAAW,CAAC,EAAU,QAAQ,GAAU,CAAI,EAAS,OAAO,aAAa,EAAS,WAAW,QAAQ,GAAM,CAAI,EAAK,WAAW,IAAM,EAAa,EAAK,EAAE,EAAK,aAAa,qBAAqB,GAAG,CAAE,EAAK,iBAAiB,IAAI,CAAC,QAAQ,GAAI,CAAI,EAAa,EAAG,EAAE,EAAG,aAAa,qBAAqB,GAAG,EAAI,GAAI,EAAI,EAAG,CAAC,EAAS,QAAQ,SAAS,KAAK,CAAC,UAAU,GAAK,QAAQ,GAAK,CAAC,CAAC,EAAS,QAAQ,IAAIC,EAAM,CAAC,SAAS,IAAI,OAAO,G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