{"version":3,"file":"Counter.DW7Mir97.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/tK8HNcJZfGCfHjIqkTUk/hxvQS7hKIKbqPE1wdmEU/Counter.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{motion}from\"framer-motion\";/**\n * @framerIntrinsicWidth 500\n * @framerIntrinsicHeight 138\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */function Countdown({targetDate=\"12/31/2024\",targetTime=\"23:59:59\",counterFont,counterStyles,labelFont,labelStyles,alignment,spacingBetweenLabelsAndCounters=8,timeDisplay:{displayDays=true,displayHours=true,displayMinutes=true,displaySeconds=true},timeUpMessage=\"Time's Up!\"}){const parseTargetDateTime=()=>{try{const[hours,minutes,seconds]=targetTime.split(\":\").map(Number);const target=new Date(targetDate);target.setHours(hours||0,minutes||0,seconds||0);return target;}catch{return new Date(\"12/31/2024 23:59:59\");}};const calculateDateTimeLeft=()=>{const now=new Date;const target=parseTargetDateTime();const difference=target-now;if(difference<=0){return null;}return{days:String(Math.floor(difference/(1e3*60*60*24))).padStart(2,\"0\"),hours:String(Math.floor(difference/(1e3*60*60)%24)).padStart(2,\"0\"),minutes:String(Math.floor(difference/(1e3*60)%60)).padStart(2,\"0\"),seconds:String(Math.floor(difference/1e3%60)).padStart(2,\"0\")};};const[timeLeft,setTimeLeft]=useState(calculateDateTimeLeft());useEffect(()=>{const timer=setInterval(()=>{setTimeLeft(calculateDateTimeLeft());},1e3);return()=>clearInterval(timer);},[targetDate,targetTime]);const filteredTime=timeLeft?Object.entries(timeLeft).filter(([unit])=>{if(unit===\"days\")return displayDays;if(unit===\"hours\")return displayHours;if(unit===\"minutes\")return displayMinutes;if(unit===\"seconds\")return displaySeconds;return false;}):null;return /*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",gap:\"20px\",justifyContent:alignment||\"center\",alignItems:\"center\",height:\"100%\",textAlign:\"center\"},children:filteredTime?filteredTime.map(([unit,value])=>/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",alignItems:\"center\"},children:[/*#__PURE__*/_jsx(motion.div,{style:{display:\"flex\",justifyContent:\"center\",alignItems:\"center\",width:`${counterStyles.width||100}px`,height:`${counterStyles.height||100}px`,backgroundColor:counterStyles.backgroundColor||\"#FFFFFF\",border:`${counterStyles.borderWidth||0}px solid ${counterStyles.borderColor||\"transparent\"}`,borderRadius:`${counterStyles.borderRadius||12}px`,color:counterFont?.color||\"#47008A\",fontFamily:counterFont?.font?.fontFamily||\"Arial\",fontSize:`${counterFont?.fontSize||36}px`,fontWeight:\"bold\"},children:value}),/*#__PURE__*/_jsx(\"div\",{style:{width:`${labelStyles.width||100}px`,height:`${labelStyles.height||30}px`,textAlign:\"center\",fontSize:`${labelFont?.fontSize||14}px`,fontFamily:labelFont?.font?.fontFamily||\"Arial\",color:labelFont?.color||\"#47008A\",backgroundColor:labelStyles.backgroundColor||\"#CAA7FF\",border:`${labelStyles.borderWidth||0}px solid ${labelStyles.borderColor||\"transparent\"}`,borderRadius:`${labelStyles.borderRadius||12}px`,marginTop:`${spacingBetweenLabelsAndCounters}px`,display:\"flex\",justifyContent:\"center\",alignItems:\"center\"},children:unit.charAt(0).toUpperCase()+unit.slice(1)})]},unit)):/*#__PURE__*/_jsx(\"div\",{style:{fontSize:\"24px\",color:\"red\",fontWeight:\"bold\",textAlign:\"center\"},children:timeUpMessage})});}export default Countdown;import{addPropertyControls,ControlType}from\"framer\";addPropertyControls(Countdown,{targetDate:{type:ControlType.String,title:\"Target Date\",defaultValue:\"12/31/2025\",placeholder:\"MM/DD/YYYY\"},targetTime:{type:ControlType.String,title:\"Target Time\",defaultValue:\"23:59:59\",placeholder:\"HH:MM:SS\"},timeDisplay:{type:ControlType.Object,title:\"Time Display\",controls:{displayDays:{type:ControlType.Boolean,title:\"Show Days\",defaultValue:true},displayHours:{type:ControlType.Boolean,title:\"Show Hours\",defaultValue:true},displayMinutes:{type:ControlType.Boolean,title:\"Show Minutes\",defaultValue:true},displaySeconds:{type:ControlType.Boolean,title:\"Show Seconds\",defaultValue:true}}},counterFont:{type:ControlType.Object,title:\"Counter Font\",controls:{font:{type:\"font\",title:\"Font Family\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:36,min:8,max:100},color:{type:ControlType.Color,title:\"Font Color\",defaultValue:\"#47008A\"}}},counterStyles:{type:ControlType.Object,title:\"Counter Styles\",controls:{width:{type:ControlType.Number,title:\"Width\",defaultValue:100},height:{type:ControlType.Number,title:\"Height\",defaultValue:100},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#FFFFFF\",enableReset:true},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"transparent\",enableReset:true},borderWidth:{type:ControlType.Number,title:\"Border Width\",defaultValue:0},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:12}}},labelFont:{type:ControlType.Object,title:\"Label Font\",controls:{font:{type:\"font\",title:\"Font Family\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:14,min:8,max:50},color:{type:ControlType.Color,title:\"Font Color\",defaultValue:\"#47008A\"}}},labelStyles:{type:ControlType.Object,title:\"Label Styles\",controls:{width:{type:ControlType.Number,title:\"Width\",defaultValue:100},height:{type:ControlType.Number,title:\"Height\",defaultValue:30},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#CAA7FF\",enableReset:true},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"transparent\",enableReset:true},borderWidth:{type:ControlType.Number,title:\"Border Width\",defaultValue:0},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:12}}},alignment:{type:ControlType.Enum,title:\"Alignment\",options:[\"center\",\"flex-start\",\"flex-end\"],optionTitles:[\"Center\",\"Left\",\"Right\"],defaultValue:\"center\"},spacingBetweenLabelsAndCounters:{type:ControlType.Number,title:\"Label Spacing\",defaultValue:8,min:0,max:50},timeUpMessage:{type:ControlType.String,title:\"Time-Up Message\",defaultValue:\"Time's Up!\",description:\"[Mr. Framer](https://mrframer.com), Get Free High Quality Framer Resources.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Countdown\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth any-prefer-fixed\",\"framerIntrinsicHeight\":\"138\",\"framerIntrinsicWidth\":\"500\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter.map"],"mappings":"iWAMG,SAAS,EAAU,CAAC,aAAW,aAAa,aAAW,WAAW,cAAY,gBAAc,YAAU,cAAY,YAAU,kCAAgC,EAAE,YAAY,CAAC,cAAY,GAAK,eAAa,GAAK,iBAAe,GAAK,iBAAe,IAAM,gBAAc,cAAc,CAAC,IAAM,MAAwB,CAAC,GAAG,CAAC,GAAK,CAAC,EAAM,EAAQ,GAAS,EAAW,MAAM,IAAI,CAAC,IAAI,OAAO,CAAO,EAAO,IAAI,KAAK,EAAW,CAAiD,OAAhD,EAAO,SAAS,GAAO,EAAE,GAAS,EAAE,GAAS,EAAE,CAAQ,OAAa,CAAC,OAAO,IAAI,KAAK,sBAAsB,GAAU,MAA0B,CAAC,IAAM,EAAI,IAAI,KAA8C,EAA5B,GAAqB,CAAyB,EAAmC,OAA5B,GAAY,EAAU,KAAY,CAAC,KAAK,OAAO,KAAK,MAAM,GAAY,IAAI,GAAG,GAAG,IAAI,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,OAAO,KAAK,MAAM,GAAY,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,OAAO,KAAK,MAAM,GAAY,IAAI,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,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