{"version":3,"file":"SmoothScroll.CsiVLR6H.mjs","names":[],"sources":["https:/framerusercontent.com/modules/2wRkHYDFlnfYWImqzCgZ/H7vwaWh9GKf1hG7HnQ6f/SmoothScroll.js"],"sourcesContent":["// SmoothScroll — adds inertia-style smooth scrolling to the whole page.\n// Drop one instance on each page (any size, it renders nothing visible).\n// It works only on the published site and in preview. It is disabled on the canvas,\n// on touch devices and for visitors who prefer reduced motion.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";function isInsideScrollable(el){while(el&&el!==document.body&&el!==document.documentElement){const s=window.getComputedStyle(el);const oy=s.overflowY;if((oy===\"auto\"||oy===\"scroll\")&&el.scrollHeight>el.clientHeight)return true;el=el.parentElement;}return false;}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function SmoothScroll(props){const{smoothness,wheelMultiplier,enabled,style}=props;const isStatic=useIsStaticRenderer();React.useEffect(()=>{if(typeof window===\"undefined\"||isStatic||!enabled)return;if(window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches)return;if(window.matchMedia(\"(pointer: coarse)\").matches)return;// lerp factor: smoothness 0 → 0.35 (snappy), 1 → 0.04 (very soft)\nconst ease=.35-Math.min(Math.max(smoothness,0),1)*.31;let target=window.scrollY;let current=window.scrollY;let raf=0;let animating=false;const maxScroll=()=>Math.max(0,document.documentElement.scrollHeight-window.innerHeight);const tick=()=>{current+=(target-current)*ease;if(Math.abs(target-current)<.5){current=target;animating=false;}window.scrollTo(0,current);if(animating)raf=window.requestAnimationFrame(tick);};const onWheel=e=>{if(e.ctrlKey||e.defaultPrevented)return;if(isInsideScrollable(e.target))return;e.preventDefault();const unit=e.deltaMode===1?16:e.deltaMode===2?window.innerHeight:1;if(!animating){current=window.scrollY;target=current;}target=Math.min(Math.max(target+e.deltaY*unit*wheelMultiplier,0),maxScroll());if(!animating){animating=true;raf=window.requestAnimationFrame(tick);}};// keep in sync with keyboard, scrollbar drags and anchor links\nconst onScroll=()=>{if(!animating){current=window.scrollY;target=current;}};window.addEventListener(\"wheel\",onWheel,{passive:false});window.addEventListener(\"scroll\",onScroll,{passive:true});return()=>{window.removeEventListener(\"wheel\",onWheel);window.removeEventListener(\"scroll\",onScroll);window.cancelAnimationFrame(raf);};},[isStatic,enabled,smoothness,wheelMultiplier]);return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",pointerEvents:\"none\",...style},\"aria-hidden\":\"true\"});}SmoothScroll.defaultProps={smoothness:.7,wheelMultiplier:1,enabled:true};addPropertyControls(SmoothScroll,{enabled:{type:ControlType.Boolean,title:\"Enabled\",defaultValue:true},smoothness:{type:ControlType.Number,title:\"Smoothness\",min:0,max:1,step:.05,defaultValue:.7},wheelMultiplier:{type:ControlType.Number,title:\"Speed\",min:.3,max:3,step:.1,defaultValue:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothScroll\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SmoothScroll.map"],"mappings":"gMAI+I,SAAS,EAAmB,EAAG,CAAC,KAAM,GAAI,IAAK,SAAS,MAAM,IAAK,SAAS,iBAAgB,CAAqC,IAAM,EAAlC,EAAO,iBAAiB,CAAa,CAAC,CAAC,UAAU,IAAI,IAAK,QAAQ,IAAK,WAAW,EAAG,aAAa,EAAG,aAAa,MAAO,GAAK,EAAG,EAAG,aAAc,CAAC,MAAO,EAAM,CAGjZ,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,aAAW,kBAAgB,UAAQ,SAAO,EAAY,EAAS,EAAoB,EAEgP,OAF9O,MAAoB,CAAmI,GAAxH,IAAS,QAAa,GAAU,CAAC,GAAkB,EAAO,WAAW,kCAAkC,CAAC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