{"version":3,"file":"CountdownBase-7570.Pdmvb3An.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/nJTYtyYcCrxo9sYukZ9F/zDZbtw57jOuso50mN2pg/propertyControls.js","https:/framerusercontent.com/modules/FwKBhwcm4w8zJ91CPsur/L7PymFMCLEBTaVQv45cJ/CountdownBase.js","https:/framer.com/m/CountdownBase-7570.js"],"sourcesContent":["import{ControlType}from\"framer\";/** Mirrors `Props`: Framer panel fields for the default CountdownBase instance. */export const countdownBasePropertyControls={date:{type:ControlType.Date},hour:{type:ControlType.Number,defaultValue:0,min:0,max:23,step:1,displayStepper:true},minute:{type:ControlType.Number,defaultValue:0,min:0,max:59,step:1,displayStepper:true},// Same 0–59 range as clock seconds; fed into `getPolishDate` for sub-minute precision.\nsecond:{type:ControlType.Number,title:\"Second\",defaultValue:0,min:0,max:59,step:1,displayStepper:true}};\nexport const __FramerMetadata__ = {\"exports\":{\"countdownBasePropertyControls\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./propertyControls.map","import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls}from\"framer\";import{countdownBasePropertyControls}from\"https://framerusercontent.com/modules/nJTYtyYcCrxo9sYukZ9F/zDZbtw57jOuso50mN2pg/propertyControls.js\";const classList={countdown:\"tz-countdown-base\"};/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/components/auto-sizing\n *\n * @framerSupportedLayoutWidth any-prefer-auto\n * @framerSupportedLayoutHeight any-prefer-auto\n *//**\n * Live countdown to a target instant (Polish local date + time, CET/CEST handled in `getPolishDate`).\n * Recomputes every second. Pass `padTime: true` to get zero-padded string segments.\n */export function useCountdown(options){const pad=options.padTime??false;// Normalize once so the effect dependency list matches the values we actually count down to.\nconst hour=options.hour??0;const minute=options.minute??0;const second=options.second??0;const[timeLeft,setTimeLeft]=useState(calculateTimeLeft(options.date,hour,minute,second));useEffect(()=>{const interval=setInterval(()=>{setTimeLeft(calculateTimeLeft(options.date,hour,minute,second));},1e3);return()=>clearInterval(interval);},[options.date,hour,minute,second,options.padTime]);const result={days:formatValue(timeLeft.days,pad),hours:formatValue(timeLeft.hours,pad),minutes:formatValue(timeLeft.minutes,pad),seconds:formatValue(timeLeft.seconds,pad)};return result;}/**\n * Calculates the day of the week for a given date using Sakamoto's algorithm.\n * Returns 0 for Sunday, 1 for Monday, etc.\n * @param year - full year (e.g., 2025)\n * @param month - month (1-12)\n * @param day - day of the month\n */function dayOfWeek(year,month,day){const t=[0,3,2,5,0,3,5,1,4,6,2,4];if(month<3)year-=1;return(year+Math.floor(year/4)-Math.floor(year/100)+Math.floor(year/400)+t[month-1]+day)%7;}/**\n * Returns the day of the month for the last Sunday in a given month for a specific year.\n * @param year - full year (e.g., 2025)\n * @param month - month (1-12); for March use 3, for October use 10.\n */function getLastSunday(year,month){let day=31// Last possible day in March or October.\n;const dow=dayOfWeek(year,month,day);return day-dow// Subtract the day-of-week to get the last Sunday.\n;}/**\n * Creates a target `Date` in UTC from a calendar day (`YYYY-MM-DD`) and a wall-clock time in Poland.\n * Does not use `Intl` / tz database: DST rules are applied explicitly for EU Poland\n * (CEST UTC+2 vs CET UTC+1).\n *\n * DST: starts last Sunday of March at 02:00 local, ends last Sunday of October at 03:00 local.\n * We compare seconds-since-midnight at those boundaries so sub-minute times stay consistent.\n */export function getPolishDate(date=\"2025-01-01\",hour,minute,second=0){// Split the date string into year, month, and day (day may include a time suffix; take first two chars).\nconst[yearStr,monthStr,rawDayStr]=date.split(\"-\");const dayStr=rawDayStr.slice(0,2);const year=Number(yearStr);const month=Number(monthStr)// 1-indexed (1 = January)\n;const day=Number(dayStr);const s=Math.min(59,Math.max(0,Math.trunc(second)));// EU Poland: DST begins last Sunday in March 02:00, ends last Sunday in October 03:00.\nconst lastSundayMarch=getLastSunday(year,3);const lastSundayOctober=getLastSunday(year,10);// Seconds since local midnight — needed at transition instants (02:00 / 03:00), not only full hours.\nconst targetSecondsFromMidnight=hour*3600+minute*60+s;let isDST=false;if(month>3&&month<10){isDST=true;}else if(month===3){if(day>lastSundayMarch){isDST=true;}else if(day===lastSundayMarch&&targetSecondsFromMidnight>=2*3600){isDST=true;}}else if(month===10){if(day<lastSundayOctober){isDST=true;}else if(day===lastSundayOctober&&targetSecondsFromMidnight<3*3600){isDST=true;}}const offset=isDST?2:1;// Polish local = UTC + offset, so subtract offset from the local clock to express the instant in UTC.\nconst utcTimestamp=Date.UTC(year,month-1,day,hour-offset,minute,s);return new Date(utcTimestamp);}/**\n * Milliseconds remaining until the target Polish local instant. Non-positive → all zeros.\n */function calculateTimeLeft(date,hour,minute,second=0){const target=getPolishDate(date,hour,minute,second).getTime();const now=Date.now();const difference=target-now;if(difference<=0){return{days:0,hours:0,minutes:0,seconds:0};}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 formatValue=(value,padTime)=>padTime?value<10?\"0\"+value:String(value):value;/**\n * Default on-canvas preview: simple readout. Production UIs typically consume `useCountdown` instead.\n */export default function CountdownBase({date,hour,minute,second=0,...props}){// CountdownBase Component not finished ---------------------------------------------------\n// ----------------------------------------------------------------------------------------\nconst[timeLeft,setTimeLeft]=useState(calculateTimeLeft(date,hour,minute,second));// Re-bind when any part of the target changes (not only `date` — Framer controls can change H/M/S).\nuseEffect(()=>{const interval=setInterval(()=>{setTimeLeft(calculateTimeLeft(date,hour,minute,second));},1e3);return()=>clearInterval(interval);},[date,hour,minute,second]);return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsxs(\"div\",{...props,className:classList.countdown,children:[/*#__PURE__*/_jsxs(\"div\",{children:[timeLeft.days,\" dni\"]}),/*#__PURE__*/_jsxs(\"div\",{children:[timeLeft.hours,\" godzin\"]}),/*#__PURE__*/_jsxs(\"div\",{children:[timeLeft.minutes,\" minut\"]}),/*#__PURE__*/_jsxs(\"div\",{children:[timeLeft.seconds,\" sekund\"]})]}),/*#__PURE__*/_jsx(\"style\",{children:`\n                .${classList.countdown} {\n\n                }\n\n            `})]});}addPropertyControls(CountdownBase,countdownBasePropertyControls);\nexport const __FramerMetadata__ = {\"exports\":{\"getPolishDate\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useCountdown\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"CountdownBase\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","/*\n * CountdownBase\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/FwKBhwcm4w8zJ91CPsur/L7PymFMCLEBTaVQv45cJ/CountdownBase.js\"\nexport { default } from \"https://framerusercontent.com/modules/FwKBhwcm4w8zJ91CPsur/L7PymFMCLEBTaVQv45cJ/CountdownBase.js\"\n"],"mappings":"kNAAgC,CAAgG,EAA8B,CAAC,KAAK,CAAC,KAAK,EAAY,KAAK,CAAC,KAAK,CAAC,KAAK,EAAY,OAAO,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,KAAK,EAAE,eAAe,GAAK,CAAC,OAAO,CAAC,KAAK,EAAY,OAAO,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,KAAK,EAAE,eAAe,GAAK,CACzW,OAAO,CAAC,KAAK,EAAY,OAAO,MAAM,SAAS,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,KAAK,EAAE,eAAe,GAAK,CAAC,ICQpG,SAAgB,EAAa,EAAQ,CAAC,IAAM,EAAI,EAAQ,SAAS,GAC9D,EAAK,EAAQ,MAAM,EAAQ,EAAO,EAAQ,QAAQ,EAAQ,EAA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