{"version":3,"file":"EqualHeights.DM4OR-2I.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx","React.useRef","React.useState"],"sources":["https:/framerusercontent.com/modules/5dGPJV4U0dTj8G8lk5tc/NR483mrjoy1AtGkIvy03/EqualHeights.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";export const EqualHeightChildren=props=>{const containerRef=React.useRef(null);const[maxHeight,setMaxHeight]=React.useState(0);var currentW=0;React.useEffect(()=>{const calculateMaxHeight=()=>{if(currentW!=window.innerWidth){console.log(1);if(!containerRef.current)return;const children=containerRef.current.children;if(children.length===0)return;// Reset heights to get natural heights\nArray.from(children).forEach(child=>{child.style.height=\"auto\";});// Find the tallest child\nlet tallest=0;Array.from(children).forEach(child=>{const height=child.offsetHeight;if(height>tallest){tallest=height;}});console.log(`Setting equal height to: ${tallest}px`);setMaxHeight(tallest);// Apply the max height to all children\nArray.from(children).forEach(child=>{child.style.height=`${tallest}px`;});currentW=window.innerWidth;}};// Calculate on mount and when content changes\ncalculateMaxHeight();// Recalculate on window resize\nwindow.addEventListener(\"resize\",calculateMaxHeight);// Use MutationObserver to detect DOM changes\nconst observer=new MutationObserver(calculateMaxHeight);if(containerRef.current){observer.observe(containerRef.current,{childList:true,subtree:true,attributes:true,characterData:true});}return()=>{window.removeEventListener(\"resize\",calculateMaxHeight);observer.disconnect();};},[]);return{...props,ref:containerRef,style:{...props.style,// Ensure container doesn't interfere with height calculations\ndisplay:props.style?.display||\"flex\",alignItems:\"stretch\"}};};// Alternative version that works with specific child selector\nexport const EqualHeightBySelector=props=>{const containerRef=React.useRef(null);const[maxHeight,setMaxHeight]=React.useState(0);// You can customize this selector to target specific children\nconst childSelector=\"[data-framer-name]\"// Targets all Framer components\n;React.useEffect(()=>{const calculateMaxHeight=()=>{if(!containerRef.current)return;const children=containerRef.current.querySelectorAll(childSelector);if(children.length===0)return;// Reset heights\nchildren.forEach(child=>{child.style.height=\"auto\";});// Find tallest\nlet tallest=0;children.forEach(child=>{const height=child.offsetHeight;if(height>tallest){tallest=height;}});console.log(`Setting equal height to: ${tallest}px for ${children.length} children`);setMaxHeight(tallest);// Apply max height\nchildren.forEach(child=>{child.style.height=`${tallest}px`;child.style.boxSizing=\"border-box\"// Ensure padding/borders are included\n;});};// Delay calculation to ensure DOM is ready\nconst timeoutId=setTimeout(calculateMaxHeight,100);window.addEventListener(\"resize\",calculateMaxHeight);const observer=new MutationObserver(()=>{// Debounce the calculation\nclearTimeout(timeoutId);setTimeout(calculateMaxHeight,50);});if(containerRef.current){observer.observe(containerRef.current,{childList:true,subtree:true,attributes:true,characterData:true});}return()=>{clearTimeout(timeoutId);window.removeEventListener(\"resize\",calculateMaxHeight);observer.disconnect();};},[]);return{...props,ref:containerRef};};// Version with custom configuration\nexport function createEqualHeightOverride(options={}){const{selector=null,minHeight=0,debounceMs=50}=options;return props=>{const containerRef=React.useRef(null);const[maxHeight,setMaxHeight]=React.useState(minHeight);React.useEffect(()=>{let timeoutId;const calculateMaxHeight=()=>{if(!containerRef.current)return;const children=selector?containerRef.current.querySelectorAll(selector):containerRef.current.children;if(children.length===0)return;// Reset heights\nArray.from(children).forEach(child=>{child.style.height=\"auto\";});// Find tallest\nlet tallest=minHeight;Array.from(children).forEach(child=>{const height=child.offsetHeight;if(height>tallest){tallest=height;}});console.log(`Equal height override: ${tallest}px for ${children.length} children`);setMaxHeight(tallest);// Apply max height\nArray.from(children).forEach(child=>{child.style.height=`${tallest}px`;child.style.boxSizing=\"border-box\";});};const debouncedCalculate=()=>{clearTimeout(timeoutId);timeoutId=setTimeout(calculateMaxHeight,debounceMs);};// Initial calculation\ndebouncedCalculate();window.addEventListener(\"resize\",debouncedCalculate);const observer=new MutationObserver(debouncedCalculate);if(containerRef.current){observer.observe(containerRef.current,{childList:true,subtree:true,attributes:true,characterData:true});}return()=>{clearTimeout(timeoutId);window.removeEventListener(\"resize\",debouncedCalculate);observer.disconnect();};},[]);return{...props,ref:containerRef};};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withEqualHeightChildren(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...EqualHeightChildren(props)});};}withEqualHeightChildren.displayName=\"EqualHeightChildren\";export function withEqualHeightBySelector(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...EqualHeightBySelector(props)});};}withEqualHeightBySelector.displayName=\"EqualHeightBySelector\";\nexport const __FramerMetadata__ = {\"exports\":{\"EqualHeightChildren\":{\"type\":\"override\",\"name\":\"EqualHeightChildren\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withEqualHeightBySelector\":{\"type\":\"reactHoc\",\"name\":\"withEqualHeightBySelector\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withEqualHeightChildren\":{\"type\":\"reactHoc\",\"name\":\"withEqualHeightChildren\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"EqualHeightBySelector\":{\"type\":\"override\",\"name\":\"EqualHeightBySelector\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"createEqualHeightOverride\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./EqualHeights.map"],"mappings":"sMAqBqjB,SAAgB,EAAwB,EAAE,CAAC,MAAO,KAAQ,EAA+BA,EAAwC,CAAQC,EAAK,EAAE,CAAC,GAAG,EAAM,GAAG,EAAoB,EAAM,CAAC,CAAC,EAA8D,SAAgB,EAA0B,EAAE,CAAC,MAAO,KAAQ,EAA+BD,EAAwC,CAAQC,EAAK,EAAE,CAAC,GAAG,EAAM,GAAG,EAAsB,EAAM,CAAC,CAAC,2BArB97B,IAA4B,IAqB8e,CArBje,EAAoB,GAAO,CAAC,IAAM,EAAaC,EAAa,KAAK,CAAM,CAAC,EAAU,GAAcC,EAAe,EAAE,CAAC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