{"version":3,"file":"SmoothSCROLL.BZ0pzjWW.mjs","names":[],"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":"+LAA4Z,SAAwB,EAAmB,EAAM,CAMhG,OANoG,EAAa,QAAQ,IAAI,EAAa,OAA4B,EAAK,MAAM,CAAC,MAAM,EAAY,SAAS,yBAAyB,CAAC,GAAG,MAAoB,CAAC,IAAI,EAAS,EAAO,QAAY,EAAQ,EAAO,QAAY,EAAY,GAC7qB,GAAM,EAAM,EAAI,IAAS,GAAO,EAAI,GAAO,EAAa,MAAY,CAAC,EAAS,EAAK,EAAS,EAAQ,EAAM,UAAU,EACvH,KAAK,IAAI,EAAQ,CAAQ,EAAE,IAAI,EAAS,EAAQ,EAAO,SAAS,EAAE,CAAQ,EAAE,EAAY,KAAY,EAAO,SAAS,EAAE,CAAQ,EAAE,sBAAsB,CAAO,EAAG,EAAQ,EAAY,GAAG,CAC1L,IAAI,EAAK,EAAE,OAAW,EAAmB,GAAM,KAAM,GAAM,IAAO,SAAS,MAAM,IAAO,SAAS,iBAAgB,CAAC,IAAM,EAAM,EAAO,iBAAiB,CAAI,EAAE,IAAG,EAAM,YAAY,QAAQ,EAAM,YAAY,WAAa,EAAK,aAAa,EAAK,aAAa,CAAC,EAAmB,GAAK,KAAM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