{"version":3,"file":"AvoidLayoutJumping_Prod.C4jcXBLZ.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/h8ioHyt4BUxuvVCE1Q10/lSxCCQSg9Z004fOqQjUU/AvoidLayoutJumping_Prod.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useReducedMotion}from\"framer-motion\";import{useEffect,useRef}from\"react\";/**\n * Placement contract: this instance is an absolute, hidden utility inside the\n * frame whose height or width animates. Measure that frame (the grandparent)\n * and copy its border box onto the grandparent's parent so in-flow siblings\n * ease instead of jumping. Never write position, inset, or transform.\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n * @framerDisableUnlink\n */export default function AvoidLayoutJumping({direction=\"vertical\",style,className}){const isStatic=useIsStaticRenderer();const reducedMotion=useReducedMotion()??false;const rootRef=useRef(null);const rafId=useRef(null);useEffect(()=>{if(isStatic)return;const root=rootRef.current;const target=root?.parentElement?.parentElement;const container=target?.parentElement;if(!root||!target||!container)return;const vertical=direction===\"vertical\"||direction===\"both\";const horizontal=direction===\"horizontal\"||direction===\"both\";let disposed=false;let inView=true;let pageVisible=document.visibilityState===\"visible\";let decided=false;let skipOutOfFlow=false;let lastWidth=\"\";let lastHeight=\"\";const cancelFrame=()=>{if(rafId.current!=null)cancelAnimationFrame(rafId.current);rafId.current=null;};const clearSizes=()=>{if(horizontal)container.style.width=\"\";if(vertical)container.style.height=\"\";};const rememberFlow=()=>{if(decided)return;const position=getComputedStyle(container).position;// Absolute and fixed containers do not push siblings. Writing a\n// pixel size onto them fights their insets.\nskipOutOfFlow=position===\"absolute\"||position===\"fixed\";decided=true;};const commit=(width,height)=>{if(skipOutOfFlow||!target.isConnected)return;if(width===0&&height===0&&target.offsetParent===null){return;}if(horizontal){const next=px(width);if(next!==lastWidth){container.style.width=next;lastWidth=next;}}if(vertical){const next=px(height);if(next!==lastHeight){container.style.height=next;lastHeight=next;}}};const active=()=>!disposed&&inView&&pageVisible;// Reduced motion still copies the snapped size so surrounding layout\n// does not stay stuck. It does not schedule frames.\nif(reducedMotion){const applyNow=()=>{if(!active())return;rememberFlow();const rect=target.getBoundingClientRect();commit(rect.width,rect.height);};const resizeObserver=new ResizeObserver(()=>applyNow());const intersectionObserver=new IntersectionObserver(entries=>{inView=entries.some(entry=>entry.isIntersecting);if(active())applyNow();});const onVisibility=()=>{pageVisible=document.visibilityState===\"visible\";if(active())applyNow();};resizeObserver.observe(target);intersectionObserver.observe(target);document.addEventListener(\"visibilitychange\",onVisibility);applyNow();return()=>{disposed=true;resizeObserver.disconnect();intersectionObserver.disconnect();document.removeEventListener(\"visibilitychange\",onVisibility);clearSizes();};}let following=false;let stableFrames=0;const readFrame=()=>{rafId.current=null;if(!active()){following=false;return;}rememberFlow();if(skipOutOfFlow){following=false;return;}const rect=target.getBoundingClientRect();const nextWidth=horizontal?px(rect.width):lastWidth;const nextHeight=vertical?px(rect.height):lastHeight;const changed=nextWidth!==lastWidth||nextHeight!==lastHeight;if(changed){// Commit before paint. A second frame would leave the parent\n// one spring step behind the transformed frame.\nstableFrames=0;commit(rect.width,rect.height);}else{stableFrames+=1;}// Framer eases size with transforms ResizeObserver does not see.\n// Keep sampling only while the box is still changing, then stop.\nif(stableFrames<12){rafId.current=requestAnimationFrame(readFrame);return;}following=false;};const armFollow=()=>{if(!active()||following)return;following=true;stableFrames=0;rafId.current=requestAnimationFrame(readFrame);};const resizeObserver=new ResizeObserver(()=>armFollow());const intersectionObserver=new IntersectionObserver(entries=>{inView=entries.some(entry=>entry.isIntersecting);if(active())armFollow();else{following=false;cancelFrame();}});const onVisibility=()=>{pageVisible=document.visibilityState===\"visible\";if(active())armFollow();else{following=false;cancelFrame();}};const onPointer=event=>{const node=event.target;if(node instanceof Node&&target.contains(node))armFollow();};resizeObserver.observe(target);intersectionObserver.observe(target);document.addEventListener(\"visibilitychange\",onVisibility);document.addEventListener(\"pointerdown\",onPointer,true);armFollow();return()=>{disposed=true;following=false;cancelFrame();resizeObserver.disconnect();intersectionObserver.disconnect();document.removeEventListener(\"visibilitychange\",onVisibility);document.removeEventListener(\"pointerdown\",onPointer,true);clearSizes();};},[direction,isStatic,reducedMotion]);return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,\"data-build\":\"layout-jump-preventer-prod-20260926-01\",className:className,\"aria-hidden\":\"true\",\"data-layout-jump-preventer\":\"\",style:{position:\"relative\",pointerEvents:\"none\",...style}});}function px(value){const rounded=Math.round(value*100)/100;return`${rounded}px`;}AvoidLayoutJumping.displayName=\"Layout Jump Preventer\";addPropertyControls(AvoidLayoutJumping,{direction:{type:ControlType.Enum,title:\"Direction\",defaultValue:\"vertical\",options:[\"vertical\",\"horizontal\",\"both\"],optionTitles:[\"Vertical\",\"Horizontal\",\"Both\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\",// @ts-ignore Framer ships optionIcons; the installed enum type omits them.\noptionIcons:[\"direction-vertical\",\"direction-horizontal\",\"direction-all\"],description:\"More components at [Framer University](https://frameruni.link/cc).\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AvoidLayoutJumping\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AvoidLayoutJumping_Prod.map"],"mappings":"0OASG,SAAwB,EAAmB,CAAC,YAAU,WAAW,QAAM,aAAW,CAAC,IAAM,EAAS,EAAoB,EAAQ,EAAc,EAAiB,GAAG,GAAY,EAAQA,EAAO,IAAI,EAAQ,EAAMA,EAAO,IAAI,EAQs8B,OARp8B,MAAc,CAAC,GAAG,EAAS,OAAO,IAAM,EAAK,EAAQ,QAAc,EAAO,GAAM,eAAe,cAAoB,EAAU,GAAQ,cAAc,GAAG,CAAC,GAAM,CAAC,GAA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