{"version":3,"file":"SmoothLayout.sA7PsHvH.mjs","names":["useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/fquU7omRJ32tnKBqKVhY/iHS6Mh76hEowpJxxntlb/SmoothLayout.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useLayoutEffect,useRef}from\"react\";import{animate}from\"framer-motion\";export function smoothSection(Component){return /*#__PURE__*/forwardRef((props,forwardedRef)=>{const localRef=useRef(null);useLayoutEffect(()=>{const element=localRef.current;if(!element)return;let offset=0;let frame=null;let animation=null;const originalTranslate=element.style.translate;const reducedMotion=window.matchMedia(\"(prefers-reduced-motion: reduce)\");const getLayoutTop=()=>element.getBoundingClientRect().top+window.scrollY-offset;let previousTop=getLayoutTop();const update=()=>{frame=null;const nextTop=getLayoutTop();const difference=previousTop-nextTop;previousTop=nextTop;if(reducedMotion.matches){animation?.stop();offset=0;element.style.translate=originalTranslate;return;}if(Math.abs(difference)<.5)return;animation?.stop();// Eine laufende Verschiebung nahtlos fortsetzen.\noffset+=difference;element.style.translate=`0px ${offset}px`;animation=animate(offset,0,{type:\"spring\",duration:1,bounce:.1,delay:0,onUpdate:value=>{offset=value;element.style.translate=`0px ${value}px`;},onComplete:()=>{offset=0;element.style.translate=originalTranslate;}});};const scheduleUpdate=()=>{if(frame===null){frame=requestAnimationFrame(update);}};const observer=new ResizeObserver(()=>{if(frame!==null){cancelAnimationFrame(frame);frame=null;}update();});// Sektion, Vorfahren und davor liegende Geschwister beobachten.\nconst targets=new Set;let current=element;while(current){targets.add(current);let sibling=current.previousElementSibling;while(sibling){targets.add(sibling);sibling=sibling.previousElementSibling;}current=current.parentElement;}targets.forEach(target=>observer.observe(target));window.addEventListener(\"resize\",scheduleUpdate);return()=>{observer.disconnect();window.removeEventListener(\"resize\",scheduleUpdate);if(frame!==null)cancelAnimationFrame(frame);animation?.stop();element.style.translate=originalTranslate;};},[]);const setRef=useCallback(node=>{localRef.current=node;if(typeof forwardedRef===\"function\"){forwardedRef(node);}else if(forwardedRef){forwardedRef.current=node;}},[forwardedRef]);return /*#__PURE__*/_jsx(Component,{...props,ref:setRef});});}\nexport const __FramerMetadata__ = {\"exports\":{\"smoothSection\":{\"type\":\"reactHoc\",\"name\":\"smoothSection\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SmoothLayout.map"],"mappings":"iMAA+I,SAAgB,EAAc,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAe,CAAC,IAAM,EAASA,EAAO,IAAI,EAAE,MAAoB,CAAC,IAAM,EAAQ,EAAS,QAAQ,GAAG,CAAC,EAAQ,OAAO,IAAI,EAAO,EAAM,EAAM,KAAS,EAAU,KAAW,EAAkB,EAAQ,MAAM,UAAgB,EAAc,EAAO,WAAW,kCAAkC,EAAQ,MAAiB,EAAQ,sBAAsB,CAAC,CAAC,IAAI,EAAO,QAAQ,EAAW,EAAY,EAAa,EAAQ,MAAW,CAAC,EAAM,KAAK,IAAM,EAAQ,EAAa,EAAQ,EAAW,EAAY,EAA4B,GAApB,EAAY,EAAW,EAAc,QAAQ,CAAC,GAAW,KAAK,EAAE,EAAO,EAAE,EAAQ,MAAM,UAAU,EAAkB,MAAO,CAAI,KAAK,IAAI,CAAU,EAAE,KAAU,GAAW,KAAK,EACt3B,GAAQ,EAAW,EAAQ,MAAM,UAAU,OAAO,EAAO,IAAI,EAAU,EAAQ,EAAO,EAAE,CAAC,KAAK,SAAS,SAAS,EAAE,OAAO,GAAG,MAAM,EAAE,SAAS,GAAO,CAAC,EAAO,EAAM,EAAQ,MAAM,UAAU,OAAO,EAAM,GAAI,EAAE,eAAe,CAAC,EAAO,EAAE,EAAQ,MAAM,UAAU,CAAkB,CAAC,CAAC,EAAE,EAAQ,MAAmB,CAAI,IAAQ,OAAM,EAAM,sBAAsB,CAAM,EAAG,EAAQ,EAAS,IAAI,mBAAmB,CAAI,IAAQ,OAAM,qBAAqB,CAAK,EAA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