{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/Yppqt3Cs3Y8TZqvASnXl/s8KoqWSd7OOFVFWjfSWd/SmoothScroll_Prod.js"],
  "sourcesContent": ["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import Lenis from\"lenis\";// import Lenis from \"@studio-freight/lenis\"\nimport{useEffect,useRef}from\"react\";/**\n * @framerDisableUnlink\n */export default function SmoothScroll(props){const{intensity}=props;const lenis=useRef(null);useEffect(()=>{if(lenis.current)lenis.current.scrollTo(0,{immediate:true});},[lenis]);// Check Overlay overflow\nuseEffect(()=>{const overlayElement=document.getElementById(\"overlay\");if(overlayElement){const checkOverflow=()=>{const htmlStyle=window.getComputedStyle(document.documentElement);const isOverflowHidden=htmlStyle.overflow===\"hidden\";if(isOverflowHidden){overlayElement.setAttribute(\"data-lenis-prevent\",\"true\");}};// Set up MutationObserver for the html element\nconst htmlObserver=new MutationObserver(mutations=>{for(const mutation of mutations){if(mutation.type===\"attributes\"&&mutation.attributeName===\"style\"){checkOverflow();}}});// Observe the html element for style changes\nhtmlObserver.observe(document.documentElement,{attributes:true,attributeFilter:[\"style\"]});// Initial check\ncheckOverflow();return()=>{htmlObserver.disconnect();};}},[]);// useEffect(() => {\n//     const overlayElement = document.getElementById(\"overlay\")\n//     if (overlayElement) {\n//         const handleMutation = (mutationsList, observer) => {\n//             for (const mutation of mutationsList) {\n//                 if (\n//                     mutation.type === \"childList\" &&\n//                     overlayElement.children.length > 0\n//                 ) {\n//                     // Check if the html tag has the style \"overflow: hidden;\"\n//                     const htmlElement = document.documentElement\n//                     console.log(htmlElement, \"htmlElement\")\n//                     const computedStyle =\n//                         window.getComputedStyle(htmlElement)\n//                     console.log(\"computedStyle\", computedStyle)\n//                     const isOverflowHidden =\n//                         computedStyle.overflow === \"hidden\"\n//                     console.log(\"isOverflowHidden\", isOverflowHidden)\n//                     if (isOverflowHidden) {\n//                         overlayElement.setAttribute(\n//                             \"data-lenis-prevent\",\n//                             \"true\"\n//                         )\n//                     }\n//                 }\n//             }\n//         }\n//         const observer = new MutationObserver(handleMutation)\n//         observer.observe(overlayElement, {\n//             childList: true,\n//             attributes: true,\n//             subtree: true,\n//         })\n//         return () => observer.disconnect()\n//     }\n// }, [])\nuseEffect(()=>{const allElements=document.getElementsByTagName(\"*\");for(let i=0;i<allElements.length;i++){const element=allElements[i];const computedStyle=window.getComputedStyle(element);if(computedStyle.getPropertyValue(\"overflow\")===\"auto\"){element.setAttribute(\"data-lenis-prevent\",\"true\");}}},[]);useEffect(()=>{lenis.current=new Lenis({duration:intensity/10});const raf=time=>{if(lenis.current){lenis.current.raf(time);requestAnimationFrame(raf);}};requestAnimationFrame(raf);return()=>{if(lenis.current){lenis.current.destroy();lenis.current=null;}};},[]);useEffect(()=>{const styleElement=document.createElement(\"style\");styleElement.textContent=`\nhtml.lenis {\nheight: auto;\n}\n.lenis.lenis-smooth {\n\nscroll-behavior: auto !important;\n}\n.lenis.lenis-smooth [data-lenis-prevent] {\n\noverscroll-behavior: contain;\n}\n.lenis.lenis-stopped {\n\noverflow: hidden;\n}\n.lenis.lenis-scrolling iframe {\n\npointer-events: none;\n}\n`;document.head.appendChild(styleElement);return()=>{document.head.removeChild(styleElement);};},[]);useEffect(()=>{const anchorLinks=[...document.querySelectorAll(\"a[href]\")];const handleClick=(e,href)=>{e.preventDefault();const decodedHref=decodeURIComponent(href);lenis.current.scrollTo(decodedHref);};anchorLinks.filter(a=>a.href.includes(\"#\")).forEach(a=>{const href=`#${a.href.split(\"#\").pop()}`;a.addEventListener(\"click\",e=>handleClick(e,href));});return()=>{anchorLinks.filter(a=>a.href.includes(\"#\")).forEach(a=>{const href=`#${a.href.split(\"#\").pop()}`;a.removeEventListener(\"click\",e=>handleClick(e,href));});};},[lenis]);return /*#__PURE__*/_jsx(_Fragment,{});}SmoothScroll.displayName=\"Smooth Scroll\";addPropertyControls(SmoothScroll,{intensity:{title:\"Intensity\",type:ControlType.Number,defaultValue:10,description:\"More components at [Framer University](https://frameruni.link/cc).\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothScroll\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SmoothScroll_Prod.map"],
  "mappings": "gMAGkB,SAARA,EAA8BC,EAAM,CAAC,GAAK,CAAC,UAAAC,CAAS,EAAED,EAAYE,EAAMC,EAAO,IAAI,EAAE,OAAAC,EAAU,IAAI,CAAIF,EAAM,SAAQA,EAAM,QAAQ,SAAS,EAAE,CAAC,UAAU,EAAI,CAAC,CAAE,EAAE,CAACA,CAAK,CAAC,EACnLE,EAAU,IAAI,CAAC,IAAMC,EAAe,SAAS,eAAe,SAAS,EAAE,GAAGA,EAAe,CAAC,IAAMC,EAAc,IAAI,CAAiBC,EAAO,iBAAiB,SAAS,eAAe,EAAmC,WAAW,UAA8BF,EAAe,aAAa,qBAAqB,MAAM,CAAG,EACnTG,EAAa,IAAI,iBAAiBC,GAAW,CAAC,QAAUC,KAAYD,EAAcC,EAAS,OAAO,cAAcA,EAAS,gBAAgB,SAASJ,EAAc,CAAI,CAAC,EAC3K,OAAAE,EAAa,QAAQ,SAAS,gBAAgB,CAAC,WAAW,GAAK,gBAAgB,CAAC,OAAO,CAAC,CAAC,EACzFF,EAAc,EAAQ,IAAI,CAACE,EAAa,WAAW,CAAE,CAAE,CAAC,EAAE,CAAC,CAAC,EAoC5DJ,EAAU,IAAI,CAAC,IAAMO,EAAY,SAAS,qBAAqB,GAAG,EAAE,QAAQC,EAAE,EAAEA,EAAED,EAAY,OAAOC,IAAI,CAAC,IAAMC,EAAQF,EAAYC,CAAC,EAAsBL,EAAO,iBAAiBM,CAAO,EAAmB,iBAAiB,UAAU,IAAI,QAAQA,EAAQ,aAAa,qBAAqB,MAAM,CAAG,CAAC,EAAE,CAAC,CAA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C,GAAGJ,EAAYI,EAAEH,CAAI,CAAC,CAAE,CAAC,CAAE,CAAE,EAAE,CAAClB,CAAK,CAAC,EAAsBsB,EAAKC,EAAU,CAAC,CAAC,CAAE,CAAC1B,EAAa,YAAY,gBAAgB2B,EAAoB3B,EAAa,CAAC,UAAU,CAAC,MAAM,YAAY,KAAK4B,EAAY,OAAO,aAAa,GAAG,YAAY,oEAAoE,CAAC,CAAC",
  "names": ["SmoothScroll", "props", "intensity", "lenis", "pe", "ue", "overlayElement", "checkOverflow", "window", "htmlObserver", "mutations", "mutation", "allElements", "i", "element", "Lenis", "raf", "time", "styleElement", "anchorLinks", "handleClick", "href", "decodedHref", "a", "e", "p", "l", "addPropertyControls", "ControlType"]
}
