{"version":3,"file":"SmoothScroll.Ck_2xi6B.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/DUrSNCPe2bTdGtvijWtr/LOosJbeehSMqFrU3qgcH/SmoothScroll.js"],"sourcesContent":["function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Smooth Scroll: local, dependency-free copy of the external \"Smooth Scroll\"\n * component (Framer University, built on Lenis). Same behaviour:\n *  - mouse-wheel / trackpad scrolling eases to its target over\n *    `intensity / 10` seconds with Lenis' default expo-out curve\n *  - touch scrolling stays native\n *  - pauses while the page is locked (html overflow: hidden, or any\n *    [data-frameruni-stop-scroll] element), e.g. when a menu is open\n *  - elements with overflow: auto keep their own scrolling (data-lenis-prevent)\n *  - same-page anchor links scroll smoothly and respect scroll-margin-top\n */const LINE_HEIGHT=100/6;const easeOutExpo=t=>Math.min(1,1.001-Math.pow(2,-10*t));const clamp=(min,v,max)=>Math.max(min,Math.min(v,max));const CSS=`html.lenis { height: auto; }\n.lenis.lenis-smooth { scroll-behavior: auto !important; }\n.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }\n.lenis.lenis-stopped { overflow: hidden; }\n.lenis.lenis-scrolling iframe { pointer-events: none; }`;class Smoother{get limit(){const el=document.documentElement;return el.scrollHeight-el.clientHeight;}setClass(name,on){document.documentElement.classList.toggle(name,on);}scrollTo(y){this.target=clamp(0,y,this.limit);this.from=this.animated;this.to=this.target;this.elapsed=0;this.running=true;this.setClass(\"lenis-smooth\",true);this.setClass(\"lenis-scrolling\",true);}stop(){if(this.stopped)return;this.stopped=true;this.running=false;this.setClass(\"lenis-stopped\",true);}start(){if(!this.stopped)return;this.stopped=false;this.animated=this.target=window.scrollY;this.setClass(\"lenis-stopped\",false);}destroy(){cancelAnimationFrame(this.raf);window.removeEventListener(\"wheel\",this.onWheel);window.removeEventListener(\"scroll\",this.onScroll);const html=document.documentElement;html.classList.remove(\"lenis\",\"lenis-smooth\",\"lenis-scrolling\",\"lenis-stopped\");}constructor(duration){_define_property(this,\"duration\",void 0);_define_property(this,\"animated\",0);_define_property(this,\"target\",0);_define_property(this,\"from\",0);_define_property(this,\"to\",0);_define_property(this,\"elapsed\",0);_define_property(this,\"running\",false);_define_property(this,\"stopped\",false);_define_property(this,\"lastTime\",0);_define_property(this,\"raf\",0);_define_property(this,\"ignoreNextScroll\",false);_define_property(this,\"onWheel\",e=>{if(this.stopped||e.ctrlKey)return;const path=e.composedPath?.()??[];if(path.some(n=>n instanceof Element&&n.hasAttribute(\"data-lenis-prevent\")))return;e.preventDefault();const mult=e.deltaMode===1?LINE_HEIGHT:e.deltaMode===2?window.innerHeight:1;this.scrollTo(this.target+e.deltaY*mult);});// Keep in sync with scrolls we didn't cause (keyboard, scrollbar, touch)\n_define_property(this,\"onScroll\",()=>{if(this.ignoreNextScroll){this.ignoreNextScroll=false;return;}if(!this.running)this.animated=this.target=window.scrollY;});_define_property(this,\"tick\",time=>{const dt=this.lastTime?(time-this.lastTime)/1e3:0;this.lastTime=time;if(this.running){this.elapsed+=dt;const p=clamp(0,this.elapsed/this.duration,1);this.animated=this.from+(this.to-this.from)*easeOutExpo(p);this.ignoreNextScroll=true;window.scrollTo(0,this.animated);if(p>=1){this.running=false;this.setClass(\"lenis-smooth\",false);this.setClass(\"lenis-scrolling\",false);}}this.raf=requestAnimationFrame(this.tick);});this.duration=duration;this.animated=this.target=window.scrollY;window.addEventListener(\"wheel\",this.onWheel,{passive:false});window.addEventListener(\"scroll\",this.onScroll,{passive:true});document.documentElement.classList.add(\"lenis\");this.raf=requestAnimationFrame(this.tick);}}/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function SmoothScroll(props){const{intensity}=props;const ref=useRef(null);// Create the smoother (duration = intensity / 10 seconds, like the original)\nuseEffect(()=>{if(typeof window===\"undefined\"||RenderTarget.current()===RenderTarget.canvas)return;ref.current=new Smoother((intensity||10)/10);return()=>{ref.current?.destroy();ref.current=null;};},[intensity]);// Pause while the page is locked (menus, modals)\nuseEffect(()=>{if(typeof document===\"undefined\")return;const check=()=>{const s=ref.current;if(!s)return;const flagged=document.querySelector(\"[data-frameruni-stop-scroll]\");const locked=document.documentElement.style.overflow===\"hidden\";flagged||locked?s.stop():s.start();};check();const a=new MutationObserver(check);const b=new MutationObserver(check);a.observe(document.documentElement,{childList:true,subtree:true,attributes:true,attributeFilter:[\"data-frameruni-stop-scroll\"]});b.observe(document.documentElement,{attributes:true,attributeFilter:[\"style\"]});return()=>{a.disconnect();b.disconnect();};},[]);// Let inner scroll areas scroll natively\nuseEffect(()=>{if(typeof document===\"undefined\")return;document.querySelectorAll(\"*\").forEach(el=>{if(getComputedStyle(el).getPropertyValue(\"overflow\")===\"auto\"){el.setAttribute(\"data-lenis-prevent\",\"true\");}});},[]);// Smooth same-page anchor links, honouring scroll-margin-top\nuseEffect(()=>{if(typeof document===\"undefined\")return;const links=Array.from(document.querySelectorAll(\"a[href]\")).filter(a=>(a.href.startsWith(window.location.origin)||a.getAttribute(\"href\").startsWith(\"./\")||a.getAttribute(\"href\").startsWith(\"/\"))&&a.href.includes(\"#\"));const handlers=links.map(a=>{const hash=decodeURIComponent(`#${a.href.split(\"#\").pop()}`);return e=>{const target=document.querySelector(hash);const s=ref.current;if(!target||!s)return;e.preventDefault();const margin=parseInt(getComputedStyle(target).scrollMarginTop)||0;s.scrollTo(target.getBoundingClientRect().top+window.scrollY-margin);};});links.forEach((a,i)=>a.addEventListener(\"click\",handlers[i]));return()=>links.forEach((a,i)=>a.removeEventListener(\"click\",handlers[i]));},[]);return /*#__PURE__*/_jsx(\"div\",{style:props.style,children:/*#__PURE__*/_jsx(\"style\",{children:CSS})});}SmoothScroll.displayName=\"Smooth Scroll\";SmoothScroll.defaultProps={intensity:10};addPropertyControls(SmoothScroll,{intensity:{title:\"Intensity\",type:ControlType.Number,defaultValue:10,min:0,description:\"Wheel scrolls ease over intensity \\xf7 10 seconds.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothScroll\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SmoothScroll.map"],"mappings":"sMAAA,SAAS,EAAiB,EAAI,EAAI,EAAM,CAAmI,OAA/H,KAAO,EAAK,OAAO,eAAe,EAAI,EAAI,CAAO,QAAM,WAAW,GAAK,aAAa,GAAK,SAAS,EAAI,CAAC,EAAQ,EAAI,GAAK,EAAc,CAAI,CAkBnL,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,aAAW,EAAY,EAAIA,EAAO,IAAI,EAI+pB,OAH1vB,MAAc,CAAI,KAAO,IAAS,QAAa,EAAa,QAAQ,IAAI,EAAa,QAA2D,MAA7C,GAAI,QAAQ,IAAI,GAAU,GAAW,IAAI,EAAE,MAAY,CAAC,EAAI,SAAS,QAAQ,EAAE,EAAI,QAAQ,IAAK,CAAE,EAAE,CAAC,CAAS,CAAC,EAClN,MAAc,CAAC,GAAG,OAAO,SAAW,IAAY,OAAO,IAAM,MAAU,CAAC,IAAM,EAAE,EAAI,QAAQ,GAAG,CAAC,EAAE,OAAO,IAAM,EAAQ,SAAS,cAAc,8BAA8B,EAAQ,EAAO,SAAS,gBAAgB,MAAM,WAAW,SAAS,GAAS,EAAO,EAAE,KAAK,EAAE,EAAE,MAAM,CAAE,EAAE,EAAM,EAAE,IAAM,EAAE,IAAI,iBAAiB,CAAK,EAAQ,EAAE,IAAI,iBAAiB,CAAK,EAAmN,OAAjN,EAAE,QAAQ,SAAS,gBAAgB,CAAC,UAAU,GAAK,QAAQ,GAAK,WAAW,GAAK,gBAAgB,CAAC,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