{"version":3,"file":"InitLazyInView.B_Py9MLj.mjs","names":["useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/M2opOn7gt91ToP7PtPbY/hpWU6eyQe4UED5QMuSaL/InitLazyInView.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useRef,useEffect,useState,forwardRef,startTransition}from\"react\";import{useInView}from\"framer-motion\";import{useIsOnFramerCanvas}from\"framer\";export function withLazyOnMount(Component){return props=>{const[render,setRender]=useState(false);useEffect(()=>{startTransition(()=>setRender(true));},[]);return render?/*#__PURE__*/_jsx(Component,{...props}):null;};}// Unmounts any expensive components once they're out of the viewport\nexport function withUnmountOutOfView(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const sentinelRef=useRef();const inView=useInView(sentinelRef);return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"span\",{style:{height:\"1px\",width:\"1px\",position:\"absolute\"},ref:sentinelRef}),inView?/*#__PURE__*/_jsx(Component,{...props,ref:ref}):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\":{\"withLazyOnMount\":{\"type\":\"reactHoc\",\"name\":\"withLazyOnMount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withInitOnlyInView\":{\"type\":\"reactHoc\",\"name\":\"withInitOnlyInView\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withUnmountOutOfView\":{\"type\":\"reactHoc\",\"name\":\"withUnmountOutOfView\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./InitLazyInView.map"],"mappings":"2OACA,SAAgB,EAAqB,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,IAAM,EAAYA,GAAQ,CAAO,EAAO,EAAU,EAAY,CAAC,OAAoB,EAAMC,EAAU,CAAC,SAAS,CAAc,EAAK,OAAO,CAAC,MAAM,CAAC,OAAO,MAAM,MAAM,MAAM,SAAS,WAAW,CAAC,IAAI,EAAY,CAAC,CAAC,EAAoB,EAAK,EAAU,CAAC,GAAG,EAAU,MAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAG,CAG1W,SAAgB,EAAmB,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAID,GAAQ,CAA8C,EAAO,EAAU,EAAI,CAAC,KAAK,CAAvD,GAAqB,CAA8C,OAAO,oBAAoB,CAAC,CAAC,OAAoB,EAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,WAAW,CAAC,SAAS,CAAc,EAAK,MAAM,CAAC,MAAM,CAAC,SAAS,WAAW,MAAM,MAAM,OAAO,MAAM,OAAO,IAAI,CAAK,MAAI,CAAC,CAAC,EAAoB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,CAAC,KAAK,CAAC,CAAC,mBAJpV,IAAwE,IAAqC,IAAwC"}