{"version":3,"file":"SmoothSCROLL.DfKAfcJT.mjs","names":["__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","c","init_jsx_runtime","ce","init_framer_B6PCHH0A","RenderTarget","ControlType","addPropertyControls","CustomSmoothScroll","editorStyle","currentY","targetY","isAnimating","lerp","start","end","factor","animate","props","handleWheel","node","isInsideScrollable","style","maxScroll","handleNativeScroll","init_SmoothSCROLL"],"sources":["https:/framerusercontent.com/modules/Rq4ya4JVJCRSRbXSajKG/IlB0GEogFRrL8rlqJbY9/SmoothSCROLL.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const editorStyle={width:\"100%\",height:\"100%\",minHeight:\"50px\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",backgroundColor:\"rgba(0, 153, 255, 0.1)\",color:\"#0099FF\",fontSize:\"12px\",fontWeight:\"bold\",border:\"1px dashed #0099FF\",borderRadius:\"8px\",padding:\"10px\"};export default function CustomSmoothScroll(props){if(RenderTarget.current()===RenderTarget.canvas){return /*#__PURE__*/_jsx(\"div\",{style:editorStyle,children:\"Custom Smooth Scroll 🌊\"});}React.useEffect(()=>{let currentY=window.scrollY;let targetY=window.scrollY;let isAnimating=false;// Linear interpolation for buttery momentum\nconst lerp=(start,end,factor)=>start+(end-start)*factor;const animate=()=>{currentY=lerp(currentY,targetY,props.smoothness);// Stop animation when we are basically at the destination\nif(Math.abs(targetY-currentY)<.5){currentY=targetY;window.scrollTo(0,currentY);isAnimating=false;}else{window.scrollTo(0,currentY);requestAnimationFrame(animate);}};const handleWheel=e=>{// 1. THE BYPASS CHECK: Are we hovering over a scrollable component?\nlet node=e.target;let isInsideScrollable=false;while(node&&node!==document.body&&node!==document.documentElement){const style=window.getComputedStyle(node);if(style.overflowY===\"auto\"||style.overflowY===\"scroll\"){if(node.scrollHeight>node.clientHeight){isInsideScrollable=true;break;}}node=node.parentElement;}// If inside the chat box or a scrollable div, let it scroll natively!\nif(isInsideScrollable){targetY=window.scrollY;currentY=window.scrollY;return;}// 2. NORMAL SMOOTH PAGE SCROLL\ne.preventDefault();const maxScroll=document.documentElement.scrollHeight-window.innerHeight;targetY+=e.deltaY;targetY=Math.max(0,Math.min(targetY,maxScroll));if(!isAnimating){isAnimating=true;requestAnimationFrame(animate);}};// Keep variables synced if the user grabs the physical scrollbar\nconst handleNativeScroll=()=>{if(!isAnimating){targetY=window.scrollY;currentY=window.scrollY;}};window.addEventListener(\"wheel\",handleWheel,{passive:false});window.addEventListener(\"scroll\",handleNativeScroll,{passive:true});return()=>{window.removeEventListener(\"wheel\",handleWheel);window.removeEventListener(\"scroll\",handleNativeScroll);};},[props.smoothness]);return null;}addPropertyControls(CustomSmoothScroll,{smoothness:{type:ControlType.Number,title:\"Smoothness\",defaultValue:.08,min:.01,max:.3,step:.01,displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CustomSmoothScroll\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SmoothSCROLL.map"],"mappings":"A,gMAA4Z,SAAwBW,EAAmB,EAAM,CAMhG,OANoGH,EAAa,QAAQ,IAAIA,EAAa,OAA4B,gBAAK,MAAM,CAAC,MAAMI,EAAY,SAAS,yBAAyB,CAAC,GAAGN,MAAoB,CAAC,IAAIO,EAASV,EAAO,QAAYW,EAAQX,EAAO,QAAYY,EAAY,GAC7qBC,GAAM,EAAM,EAAI,IAASC,GAAOC,EAAID,GAAOE,EAAaC,MAAY,CAAC,EAASJ,EAAKH,EAASC,EAAQO,EAAM,UAAU,EACvH,KAAK,IAAIP,EAAQD,CAAQ,EAAE,IAAI,EAASC,EAAQX,EAAO,SAAS,EAAEU,CAAQ,EAAE,EAAY,KAAYV,EAAO,SAAS,EAAEU,CAAQ,EAAE,sBAAsBO,CAAO,EAAG,EAAQE,EAAY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