{"version":3,"file":"CountdownTimer_1.DM2npjKJ.mjs","names":["useState","useMemo"],"sources":["https:/framerusercontent.com/modules/qSVfGGhZU01u2bxfl6Z6/PZKxhsoUMf5FJDM5BCQ9/CountdownTimer_1.js"],"sourcesContent":["// CountdownTimer timer in format: 2d 14h 36m 44s, fully customizable, end date/time, font size, color, and end date connectable to CMS\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,startTransition,useMemo}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * CountdownTimer Timer\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function CountdownTimer(props){const{endDate,font,color,timeZone,style}=props;const[now,setNow]=useState(Date.now());useEffect(()=>{const interval=setInterval(()=>{startTransition(()=>setNow(Date.now()));},1e3);return()=>clearInterval(interval);},[]);const timeLeft=useMemo(()=>{let end;if(timeZone&&typeof Intl!==\"undefined\"&&Intl.DateTimeFormat){try{// Parse endDate as ISO string, then convert to target time zone\nconst date=new Date(endDate);// Get the time in the target time zone\nconst locale=\"en-US\";const options={timeZone,hour12:false,year:\"numeric\",month:\"2-digit\",day:\"2-digit\",hour:\"2-digit\",minute:\"2-digit\",second:\"2-digit\"};const parts=new Intl.DateTimeFormat(locale,options).formatToParts(date);const get=type=>parts.find(p=>p.type===type)?.value;const y=get(\"year\");const m=get(\"month\");const d=get(\"day\");const h=get(\"hour\");const min=get(\"minute\");const s=get(\"second\");end=Date.UTC(Number(y),Number(m)-1,Number(d),Number(h),Number(min),Number(s));}catch{end=new Date(endDate).getTime();}}else{end=new Date(endDate).getTime();}let diff=Math.max(0,Math.floor((end-now)/1e3));const d=Math.floor(diff/86400);diff%=86400;const h=Math.floor(diff/3600);diff%=3600;const m=Math.floor(diff/60);const s=diff%60;return{d,h,m,s};},[endDate,now,timeZone]);return /*#__PURE__*/_jsx(\"div\",{style:{...style,color,...font,width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",fontVariantNumeric:\"tabular-nums\",letterSpacing:font?.letterSpacing??\"-0.01em\",background:\"transparent\"},children:/*#__PURE__*/_jsxs(\"span\",{style:{width:\"max-content\",minWidth:\"max-content\"},children:[timeLeft.d,\"d \",timeLeft.h,\"h \",timeLeft.m,\"m \",timeLeft.s,\"s\"]})});}addPropertyControls(CountdownTimer,{endDate:{type:ControlType.Date,title:\"End Date\",displayTime:true,defaultValue:new Date(Date.now()+864e5).toJSON(),description:\"Accepts date field or CMS variable (connectable)\"},timeZone:{type:ControlType.String,title:\"Time Zone\",placeholder:\"e.g. America/New_York\",description:\"IANA time zone (e.g. Europe/Berlin). Leave blank for local time.\",defaultValue:\"\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountdownTimer\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountdownTimer_1.map"],"mappings":"uMAMG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,UAAQ,OAAK,QAAM,WAAS,SAAO,EAAW,CAAC,EAAI,GAAQA,EAAS,KAAK,IAAI,CAAC,EAAE,MAAc,CAAC,IAAM,EAAS,gBAAgB,CAAC,MAAoB,EAAO,KAAK,IAAI,CAAC,CAAC,CAAE,EAAE,GAAG,EAAE,UAAU,cAAc,CAAQ,CAAE,EAAE,CAAC,CAAC,EAAE,IAAM,EAASC,MAAY,CAAC,IAAI,EAAI,GAAG,GAAU,OAAO,KAAO,KAAa,KAAK,eAAgB,GAA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