{"version":3,"file":"InitLazyInView.BWWJ8Bit.mjs","names":[],"sources":["https:/framerusercontent.com/modules/M2opOn7gt91ToP7PtPbY/1jDbfma8wWHqlgdR0LG9/InitLazyInView.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef,useEffect,useState}from\"react\";import{useInView}from\"framer-motion\";import{useIsOnFramerCanvas}from\"framer\";export function withLazyOnMount(Component){return props=>{const[render,setRender]=useState(false);useEffect(()=>{setRender(true);},[]);return render?/*#__PURE__*/_jsx(Component,{...props}):null;};}/**\n * This component ensures the expensive particles are only initialized once they come close to the viewport.\n * On canvas, we unload them once they're out of viewport again (for perf reasons) on the site we don't (as it would mean the particles are regenerated, which is odd from UX perspective).\n */export function withInitOnlyInView(Component){return props=>{const ref=useRef();const isOnCanvas=useIsOnFramerCanvas();const inView=useInView(ref,{once:!isOnCanvas,margin:\"0px 0px 500px 0px\"});return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"contents\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",width:\"1px\",height:\"1px\",zIndex:\"0\"},ref:ref}),inView?/*#__PURE__*/_jsx(Component,{...props}):null]});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withInitOnlyInView\":{\"type\":\"reactHoc\",\"name\":\"withInitOnlyInView\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLazyOnMount\":{\"type\":\"reactHoc\",\"name\":\"withLazyOnMount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./InitLazyInView.map"],"mappings":"8RAGU,SAAS,EAAmB,EAAU,CAAC,MAAO,CAAA,GAAO,CAA2D,IAApD,EAAI,GAAQ,CAAO,EAAW,GAAqB,CAAO,EAAO,EAAU,EAAI,CAAC,MAAM,EAAW,OAAO,mBAAoB,EAAC,CAAC,MAAoB,GAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,UAAW,EAAC,SAAS,CAAc,EAAK,MAAM,CAAC,MAAM,CAAC,SAAS,WAAW,MAAM,MAAM,OAAO,MAAM,OAAO,GAAI,EAAK,KAAI,EAAC,CAAC,EAAoB,EAAK,EAAU,CAAC,GAAG,CAAM,EAAC,CAAC,IAAK,CAAC,EAAC,AAAE,CAAE,cAHva,GAAyD,IAA6C,IAAqC,IAAwC"}