{"version":3,"file":"Shutter.gOoa3Sti.mjs","names":["React.useRef","React.useCallback"],"sources":["https:/framerusercontent.com/modules/WH0NZ7eObAtkhFzgiiw2/XSXCt29Or5wJ8tIXwViJ/Shutter.js"],"sourcesContent":["// PetCare+ — image shutter\n// A cover panel (a layer named \"Shutter\") sits over a photo in the colour of its surroundings and folds up to its\n// top edge the first time the photo scrolls into view, wiping the image in from the bottom. On the canvas the\n// panel is folded away (rotateX 90° from the top) so the photo stays visible while designing; the override starts\n// it closed on the live site and opens it once.\n// • withShutter      photos anywhere on a page\n// • withShutterLate  photos that sit inside an entrance animation (the Home hero collage)\nimport{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{animate,useMotionValue}from\"framer-motion\";const SHUTTER_EASE=[.76,0,.24,1];const SHUTTER_DURATION=1.25;const SHUTTER_DELAY=.1;const SHUTTER_DELAY_LATE=.8;function useMergedRef(forwarded){const local=React.useRef(null);const setRef=React.useCallback(el=>{local.current=el;if(typeof forwarded===\"function\")forwarded(el);else if(forwarded)forwarded.current=el;},[forwarded]);return[local,setRef];}/** Starts closed (0°) and folds to 90° once, the first time the element is 20% in view. */function useShutter(local,delay){const rotateX=useMotionValue(0);React.useEffect(()=>{const el=local.current;if(!el)return;let controls;const io=new IntersectionObserver(entries=>{if(!entries[0]?.isIntersecting)return;io.disconnect();controls=animate(rotateX,90,{duration:SHUTTER_DURATION,ease:SHUTTER_EASE,delay});},{threshold:.2});io.observe(el);return()=>{io.disconnect();controls?.stop();};},[]);return rotateX;}export function withShutter(Component){const Wrapped=/*#__PURE__*/React.forwardRef((props,forwarded)=>{const[local,setRef]=useMergedRef(forwarded);const rotateX=useShutter(local,SHUTTER_DELAY);return /*#__PURE__*/_jsx(Component,{ref:setRef,...props,style:{...props.style,rotateX,transformOrigin:\"50% 0%\"}});});Wrapped.displayName=\"Shutter\";return Wrapped;}export function withShutterLate(Component){const Wrapped=/*#__PURE__*/React.forwardRef((props,forwarded)=>{const[local,setRef]=useMergedRef(forwarded);const rotateX=useShutter(local,SHUTTER_DELAY_LATE);return /*#__PURE__*/_jsx(Component,{ref:setRef,...props,style:{...props.style,rotateX,transformOrigin:\"50% 0%\"}});});Wrapped.displayName=\"ShutterLate\";return Wrapped;}\nexport const __FramerMetadata__ = {\"exports\":{\"withShutter\":{\"type\":\"reactHoc\",\"name\":\"withShutter\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShutterLate\":{\"type\":\"reactHoc\",\"name\":\"withShutterLate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Shutter.map"],"mappings":"+LAOyO,SAAS,EAAa,EAAU,CAAC,IAAM,EAAMA,EAAa,IAAI,EAA4J,MAAM,CAAC,EAApJC,EAAkB,GAAI,CAAC,EAAM,QAAQ,EAAM,OAAO,GAAY,WAAW,EAAU,CAAE,EAAU,IAAU,EAAU,QAAQ,EAAG,EAAE,CAAC,CAAS,CAAqB,CAAC,CAAE,CAA4F,SAAS,EAAW,EAAM,EAAM,CAAC,IAAM,EAAQ,EAAe,CAAC,EAAiV,OAA/U,MAAoB,CAAC,IAAM,EAAG,EAAM,QAAQ,GAAG,CAAC,EAAG,OAAO,IAAI,EAAe,EAAG,IAAI,qBAAqB,GAAS,CAAK,EAAQ,EAAE,EAAE,iBAAsB,EAAG,WAAW,EAAE,EAAS,EAAQ,EAAQ,GAAG,CAAC,SAAS,EAAiB,KAAK,EAAa,OAAK,CAAC,EAAE,EAAE,CAAC,UAAU,EAAE,CAAC,EAAiB,OAAf,EAAG,QAAQ,CAAE,MAAY,CAAC,EAAG,WAAW,EAAE,GAAU,KAAK,CAAE,CAAE,EAAE,CAAC,CAAC,EAAS,CAAQ,CAAC,SAAgB,EAAY,EAAU,CAAC,IAAM,EAAqB,GAAkB,EAAM,IAAY,CAAC,GAAK,CAAC,EAAM,GAAQ,EAAa,CAAS,EAAQ,EAAQ,EAAW,EAAM,CAAa,EAAE,OAAoB,EAA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