{"version":3,"file":"CountdownTimer.BGLMJ_MR.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/67qha6KfrqH7WNaiegGW/tlQBRFb7qYoNE7GRKBPY/CountdownTimer.js"],"sourcesContent":["// Countdown timer that resets at midnight every night, displayed in Inter Display font\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function CountdownTimer(props){const{textColor,font,background}=props;const[timeLeft,setTimeLeft]=useState({days:0,hours:0,minutes:0,seconds:0});useEffect(()=>{if(typeof window===\"undefined\"){return;}const calculateTimeLeft=()=>{const now=new Date;const friday=new Date;// Get the current day of the week (0 = Sunday, 5 = Friday)\nconst currentDay=now.getDay();const daysUntilFriday=(5-currentDay+7)%7;// If today is Friday and we haven't passed midnight, use today\n// Otherwise, use next Friday\nif(daysUntilFriday===0&&now.getHours()===0&&now.getMinutes()===0&&now.getSeconds()===0){friday.setDate(now.getDate()+7);}else if(daysUntilFriday===0){// It's Friday but past midnight, so target is today at end of day\nfriday.setDate(now.getDate());}else{friday.setDate(now.getDate()+daysUntilFriday);}friday.setHours(23,59,59,999);const difference=friday.getTime()-now.getTime();const days=Math.floor(difference/(1e3*60*60*24));const hours=Math.floor(difference%(1e3*60*60*24)/(1e3*60*60));const minutes=Math.floor(difference%(1e3*60*60)/(1e3*60));const seconds=Math.floor(difference%(1e3*60)/1e3);return{days,hours,minutes,seconds};};const updateTimer=()=>{startTransition(()=>{setTimeLeft(calculateTimeLeft());});};updateTimer();const interval=setInterval(updateTimer,1e3);return()=>clearInterval(interval);},[]);const formatNumber=num=>String(num).padStart(2,\"0\");return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:2,width:\"max-content\",background:background,padding:\"4px 8px\",borderRadius:8},role:\"timer\",\"aria-live\":\"polite\",\"aria-atomic\":\"true\",\"aria-label\":`Time until Friday: ${formatNumber(timeLeft.days)} days, ${formatNumber(timeLeft.hours)} hours, ${formatNumber(timeLeft.minutes)} minutes, ${formatNumber(timeLeft.seconds)} seconds`,children:[/*#__PURE__*/_jsx(\"link\",{href:\"https://fonts.googleapis.com/css2?family=Inter+Display:wght@400;500;600;700&display=swap\",rel:\"stylesheet\"}),/*#__PURE__*/_jsx(\"span\",{style:{...font,fontFamily:\"Inter Display, sans-serif\",color:textColor},\"aria-label\":`${formatNumber(timeLeft.days)} days`,children:formatNumber(timeLeft.days)}),/*#__PURE__*/_jsx(\"span\",{style:{...font,fontFamily:\"Inter Display, sans-serif\",color:textColor},\"aria-hidden\":\"true\",children:\":\"}),/*#__PURE__*/_jsx(\"span\",{style:{...font,fontFamily:\"Inter Display, sans-serif\",color:textColor},\"aria-label\":`${formatNumber(timeLeft.hours)} hours`,children:formatNumber(timeLeft.hours)}),/*#__PURE__*/_jsx(\"span\",{style:{...font,fontFamily:\"Inter Display, sans-serif\",color:textColor},\"aria-hidden\":\"true\",children:\":\"}),/*#__PURE__*/_jsx(\"span\",{style:{...font,fontFamily:\"Inter Display, sans-serif\",color:textColor},\"aria-label\":`${formatNumber(timeLeft.minutes)} minutes`,children:formatNumber(timeLeft.minutes)}),/*#__PURE__*/_jsx(\"span\",{style:{...font,fontFamily:\"Inter Display, sans-serif\",color:textColor},\"aria-hidden\":\"true\",children:\":\"}),/*#__PURE__*/_jsx(\"span\",{style:{...font,fontFamily:\"Inter Display, sans-serif\",color:textColor},\"aria-label\":`${formatNumber(timeLeft.seconds)} seconds`,children:formatNumber(timeLeft.seconds)})]});}addPropertyControls(CountdownTimer,{background:{type:ControlType.String,title:\"Background\",defaultValue:\"linear-gradient(135deg, #FF7F22 0%, #9D49E0 100%)\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountdownTimer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountdownTimer.map"],"mappings":"6MAIG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,YAAU,OAAK,cAAY,EAAW,CAAC,EAAS,GAAaA,EAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAc,CAAC,GAAU,IAAS,OAAa,OAAQ,IAAM,MAAsB,CAAC,IAAM,EAAI,IAAI,KAAW,EAAO,IAAI,KACvP,GAAiB,EAApC,EAAI,QAAQ,CAAqC,GAAG,EAElE,IAAkB,GAAG,EAAI,UAAU,GAAG,GAAG,EAAI,YAAY,GAAG,GAAG,EAAI,YAAY,GAAG,EAAG,EAAO,QAAQ,EAAI,SAAS,CAAC,EAAE,CAAU,IAAkB,EACnJ,EAAO,QAAQ,EAAI,SAAS,CAAC,CAAO,EAAO,QAAQ,EAAI,SAAS,CAAC,EAAgB,CAAE,EAAO,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,IAAM,EAAW,EAAO,SAAS,CAAC,EAAI,SAAS,CAA4N,MAAM,CAAC,KAAvN,KAAK,MAAM,GAAY,IAAI,GAAG,GAAG,IAAI,CAAuL,MAA1K,KAAK,MAAM,GAAY,IAAI,GAAG,GAAG,KAAK,IAAI,GAAG,IAAI,CAA+H,QAAhH,KAAK,MAAM,GAAY,IAAI,GAAG,KAAK,IAAI,IAAI,CAA6E,QAA9D,KAAK,MAAM,GAAY,IAAI,IAAI,IAAI,CAAmC,EAAS,MAAgB,CAAC,MAAoB,CAAC,EAAY,GAAmB,CAAC,EAAG,E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