{"version":3,"file":"ScrollEffect.BoqeiVt5.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/uiR3IXvOWswsgvtwSq5B/begpPjKoeU5HjHmAbkOQ/ScrollEffect.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{useScroll,useVelocity}from\"framer-motion\";export function withSlideOutOnScrollUp(Component){const slideDistance=25 // if we are sliding out a nav bar at the top of the screen, this will be it's height\n;const threshold=250 // only slide it back when scrolling back at velocity above this positive (or zero) value\n;return props=>{const{scrollY}=useScroll();const scrollVelocity=useVelocity(scrollY);var background=\"transparent\";var borderBottomWidth=0;var borderColor=\"rgba(0, 0, 0, 0)\";var opacity=1;var y=25;const[isScrollingBack,setIsScrollingBack]=useState(false);const[isAtTop,setIsAtTop]=useState(true) // true if the page is not scrolled or fully scrolled back\n;const[isInView,setIsInView]=useState(true);useEffect(()=>scrollVelocity.onChange(latest=>{if(latest>0){setIsScrollingBack(false);return;}if(latest<-threshold){setIsScrollingBack(true);return;}}),[]);useEffect(()=>scrollY.onChange(latest=>setIsAtTop(latest<=0)),[]);useEffect(()=>setIsInView(isScrollingBack||isAtTop),[isScrollingBack,isAtTop]);if(window){if(isScrollingBack){background=\"rgba(255, 255, 255, 1)\",borderColor=\"rgba(0, 0, 0, 0.1)\",borderBottomWidth=1,opacity=1,y=0;}else{opacity=0,y=-90;}if(isAtTop){background=\"rgba(255, 255, 255, 0)\",borderColor=\"rgba(0, 0, 0, 0)\",borderBottomWidth=0,opacity=1,y=0;}// only if menu is not open\nif(!document.querySelector(\"[data-framer-name='Phone Open']\")){return /*#__PURE__*/ _jsx(Component,{...props,animate:{backgroundColor:background,borderStyle:\"solid\",borderColor:borderColor,borderTopWidth:0,borderRightWidth:0,borderBottomWidth:borderBottomWidth,borderLeftWidth:0,opacity:opacity,y:y},transition:{duration:.35,delay:0,ease:\"easeInOut\"}});}else{return /*#__PURE__*/ _jsx(Component,{...props,animate:{backgroundColor:\"rgba(255,255,255,1)\",opacity:1}});}}};}\nexport const __FramerMetadata__ = {\"exports\":{\"withSlideOutOnScrollUp\":{\"type\":\"reactHoc\",\"name\":\"withSlideOutOnScrollUp\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollEffect.map"],"mappings":"+LAAkI,SAAgB,EAAuB,EAAU,CAElL,MAAO,IAAO,CAAC,GAAK,CAAC,WAAS,GAAW,CAAO,EAAe,EAAY,EAAQ,CAAC,IAAI,EAAW,cAAkB,EAAkB,EAAM,EAAY,mBAAuB,EAAQ,EAAM,EAAE,GAAG,GAAK,CAAC,EAAgB,GAAoBA,EAAS,GAAM,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAK,CAChS,CAAC,EAAS,GAAaA,EAAS,GAAK,CAA8S,GAA7S,MAAc,EAAe,SAAS,GAAQ,CAAC,GAAG,EAAO,EAAE,CAAC,EAAmB,GAAM,CAAC,OAAQ,GAAG,EAAO,KAAW,CAAC,EAAmB,GAAK,CAAC,SAAU,CAAC,EAAE,CAAC,CAAC,MAAc,EAAQ,SAAS,GAAQ,EAAW,GAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,MAAc,EAAY,GAAiB,EAAQ,CAAC,CAAC,EAAgB,EAAQ,CAAC,CAAI,EAC7R,OADwS,GAAiB,EAAW,yBAAyB,EAAY,qBAAqB,EAAkB,EAAE,EAAQ,EAAE,EAAE,IAAQ,EAAQ,EAAE,EAAE,KAAQ,IAAS,EAAW,yBAAyB,EAAY,mBAAmB,EAAkB,EAAE,EAAQ,EAAE,EAAE,GACjmB,SAAS,cAAc,kCAAkC,CAA+T,EAAK,EAAU,CAAC,GAAG,EAAM,QAAQ,CAAC,gBAAgB,sBAAsB,QAAQ,EAAE,CAAC,CAAC,CAA5X,EAAK,EAAU,CAAC,GAAG,EAAM,QAAQ,CAAC,gBAAgB,EAAW,YAAY,QAAoB,cAAY,eAAe,EAAE,iBAAiB,EAAoB,oBAAkB,gBAAgB,EAAU,UAAU,IAAE,CAAC,WAAW,CAAC,SAAS,IAAI,MAAM,EAAE,KAAK,YAAY,CAAC,CAAC,uBAJrT,IAAsC,IAAiD"}