{"version":3,"file":"SmoothScroll.BkbLPEsO.mjs","names":[],"sources":["https:/framerusercontent.com/modules/uxDSxrBsFnYlYgMTTZ1z/GBKm3wvKHNKvKJ4uUtYX/SmoothScroll.js"],"sourcesContent":["// SmoothScroll.tsx\n// Premium inertia/smooth-scroll using Lenis.\n// Drop this component once at the root of a page. It auto-disables on touch\n// devices and respects `prefers-reduced-motion`. Renders nothing visible.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function SmoothScroll(props){const{duration,wheelMultiplier,touchMultiplier,enableOnTouch,smoothScrollAnchors}=props;useEffect(()=>{// Bail-out conditions\nif(typeof window===\"undefined\")return;// Respect reduced motion preference for accessibility.\nconst prefersReduced=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;if(prefersReduced)return;// Touch detection.\nconst isTouch=\"ontouchstart\"in window||typeof navigator!==\"undefined\"&&navigator.maxTouchPoints>0;if(isTouch&&!enableOnTouch)return;let lenis=null;let rafId=null;let anchorHandler=null;(async()=>{try{const LenisModule=await import(\"https://cdn.jsdelivr.net/npm/lenis@1.1.20/+esm\");const Lenis=LenisModule.default||LenisModule;lenis=new Lenis({duration,easing:t=>Math.min(1,1.001-Math.pow(2,-10*t)),wheelMultiplier,touchMultiplier,smoothWheel:true,// Lenis's touch-smoothing option is `syncTouch` (the older\n// `smoothTouch` key from pre-1.0 versions was removed and is\n// silently ignored by 1.1.x, which made this toggle a no-op).\nsyncTouch:enableOnTouch});const raf=time=>{lenis.raf(time);rafId=requestAnimationFrame(raf);};rafId=requestAnimationFrame(raf);// Intercept in-page anchor clicks so they animate smoothly.\nif(smoothScrollAnchors){anchorHandler=e=>{const target=e.target;if(!target)return;const anchor=target.closest('a[href^=\"#\"], a[href*=\"/#\"]');if(!anchor)return;const href=anchor.getAttribute(\"href\")||\"\";const hashIndex=href.indexOf(\"#\");if(hashIndex===-1)return;const id=href.slice(hashIndex+1);if(!id)return;const el=document.getElementById(id);if(!el)return;e.preventDefault();lenis.scrollTo(el,{offset:0});};document.addEventListener(\"click\",anchorHandler,{capture:true});}}catch(err){// If the CDN fails for any reason, silently fall back to\n// native scroll. Don't break the page.\n// eslint-disable-next-line no-console\nconsole.warn(\"[SmoothScroll] Lenis failed to load:\",err);}})();return()=>{if(rafId!==null)cancelAnimationFrame(rafId);if(anchorHandler)document.removeEventListener(\"click\",anchorHandler,{capture:true});if(lenis&&typeof lenis.destroy===\"function\"){lenis.destroy();}};},[duration,wheelMultiplier,touchMultiplier,enableOnTouch,smoothScrollAnchors]);return /*#__PURE__*/_jsx(\"div\",{style:{width:1,height:1,pointerEvents:\"none\",opacity:0,position:\"absolute\"},\"aria-hidden\":\"true\"});}SmoothScroll.defaultProps={duration:1.2,wheelMultiplier:1,touchMultiplier:1.5,enableOnTouch:false,smoothScrollAnchors:true};addPropertyControls(SmoothScroll,{duration:{type:ControlType.Number,title:\"Duration\",defaultValue:1.2,min:.4,max:2.5,step:.1,description:\"Glide time after scroll stops. Higher = more inertia. 0.8–1.4 is the sweet spot.\"},wheelMultiplier:{type:ControlType.Number,title:\"Wheel Speed\",defaultValue:1,min:.5,max:2,step:.1,description:\"Scroll-wheel sensitivity. 1 = native.\"},touchMultiplier:{type:ControlType.Number,title:\"Touch Speed\",defaultValue:1.5,min:.5,max:3,step:.1,description:\"Touch-drag sensitivity. Only used if Touch is enabled.\"},enableOnTouch:{type:ControlType.Boolean,title:\"Touch Devices\",defaultValue:false,enabledTitle:\"Smooth\",disabledTitle:\"Native\",description:\"Off (recommended) lets mobile use native momentum scroll, which already has its own inertia. On makes Lenis take over touch-drag too (its syncTouch mode) — most sites leave this off since it can add a slight finger-lag feel versus native, and Lenis itself flags it as unstable on iOS <16.\"},smoothScrollAnchors:{type:ControlType.Boolean,title:\"Anchor Links\",defaultValue:true,enabledTitle:\"Smooth\",disabledTitle:\"Instant\",description:\"Animate in-page anchor jumps (e.g. /#work-grid).\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothScroll\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SmoothScroll.map"],"mappings":"+LAI4H,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,WAAS,kBAAgB,kBAAgB,gBAAc,uBAAqB,EAUgG,OAV1F,MAAc,CAG5K,GAFxF,IAAS,QACE,EAAO,WAAW,kCAAkC,CAAC,CAAC,UAC7D,iBAAiB,GAAe,IAAY,QAAa,EAAU,eAAe,IAAc,CAAC,EAAc,OAAO,IAAI,EAAM,KAAS,EAAM,KAAS,EAAc,KAOrH,OAP2H,SAAS,CAAC,GAAG,CAAC,IAAM,EAAY,MAAM,OAAO,uBAA+F,EAAM,IAAvC,EAAY,SAAS,GAA4B,CAAC,WAAS,OAAO,GAAG,KAAK,IAAI,EAAE,MAAe,IAAE,IAAI,EAAE,EAAE,kBAAgB,kBAAgB,YAAY,GAG1b,UAAU,CAAa,CAAC,EAAE,IAAM,EAAI,GAAM,CAAC,EAAM,IAAI,CAAI,EAAE,EAAM,sBAAsB,CAAG,CAAE,EAAE,EAAM,sBAAsB,CAAG,EAC1H,IAAqB,EAAc,GAAG,CAAC,IAAM,EAAO,EAAE,OAAO,GAAG,CAAC,EAAO,OAAO,IAAM,EAAO,EAAO,QAAQ,6BAA6B,EAAE,GAAG,CAAC,EAAO,OAAO,IAAM,EAAK,EAAO,aAAa,MAAM,GAAG,GAAS,EAAU,EAAK,QAAQ,GAAG,EAAE,GAAG,IAAY,GAAG,OAAO,IAAM,EAAG,EAAK,MAAM,EAAU,CAAC,EAAE,GAAG,CAAC,EAAG,OAAO,IAAM,EAAG,SAAS,eAAe,CAAE,EAAM,IAAU,EAAE,eAAe,EAAE,EAAM,SAAS,EAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,SAAS,iBAAiB,QAAQ,EAAc,CAAC,QAAQ,EAAI,CAAC,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