{"version":3,"file":"HidePastEvents.CwQDsDaU.mjs","names":["useRef","useState","__esmMin","le","_e","c","init_jsx_runtime","init_npm_react_18_3_1","de","hidePastEvents","ref","past","setPast","text","end","today","Component","props","init_HidePastEvents"],"sources":["https:/framerusercontent.com/modules/A9Kl4VbVge8PFQdbgqnj/OHqABc5Kp5qVUErRsznq/HidePastEvents.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useLayoutEffect,useRef,useState}from\"react\";// Hides a CMS event card or row once its event has ended.\n// The repeated item must contain a text layer named \"End date\" bound to the End date field.\nexport function hidePastEvents(Component){return props=>{const ref=useRef(null);const[past,setPast]=useState(false);useLayoutEffect(()=>{const el=ref.current?.querySelector('[data-framer-name=\"End date\"]');const text=el?.textContent?.trim();if(!text)return;const end=new Date(text);if(isNaN(end.getTime()))return;const today=new Date;today.setHours(0,0,0,0);if(end<today)setPast(true);},[]);if(past)return null;return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{display:\"contents\"},children:/*#__PURE__*/_jsx(Component,{...props})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"hidePastEvents\":{\"type\":\"reactHoc\",\"name\":\"hidePastEvents\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HidePastEvents.map"],"mappings":"A,gIAEA,SAAgBS,EAAe,EAAU,CAAC,MAAO,IAAO,CAAC,IAAMC,EAAIV,EAAO,IAAI,EAAO,CAACW,EAAKC,GAASX,EAAS,EAAK,EAAyS,OAAvSE,MAAoB,CAAsE,IAAMU,GAAlEH,EAAI,SAAS,cAAc,+BAA+B,EAAA,EAAiB,aAAa,KAAK,EAAE,GAAG,CAACG,EAAK,OAAO,IAAMC,EAAI,IAAI,KAAKD,CAAI,EAAE,GAAG,MAAMC,EAAI,QAAQ,CAAC,EAAE,OAAO,IAAMC,kBAAM,IAAI,KAAKA,EAAM,SAAS,EAAE,EAAE,EAAE,CAAC,EAAKD,EAAIC,GAAMH,EAAQ,EAAI,CAAE,EAAE,CAAC,CAAC,EAAKD,EAAY,KAAyB,gBAAK,MAAM,CAAK,MAAI,MAAM,CAAC,QAAQ,UAAU,EAAE,SAAsB,gBAAKK,EAAU,CAAC,GAAGC,CAAK,CAAC,CAAC,CAAC,CAAE,CAAE,C"}