{"version":3,"file":"Timer.Cb3Fqle7.mjs","names":["useState","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/uKD6T22Imjfu3UGqHwHh/HSwZFG1v89OoRGCnGt2Y/Timer.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";/**\n * Formats the given hours and minutes into a \"(HH:MM)\" string.\n * Ensures both hours and minutes are represented with two digits, padding with a leading zero if necessary.\n *\n * @param {number} hours - The hour value (0-23).\n * @param {number} minutes - The minute value (0-59).\n * @returns {string} The formatted time string in \"(HH:MM)\" format. e.g., \"(03:05)\".\n */const formatTime=(hours,minutes)=>{const formattedHours=String(hours).padStart(2,\"0\")// Ensures hour is 2 digits (e.g., 3 -> 03)\n;const formattedMinutes=String(minutes).padStart(2,\"0\")// Ensures minute is 2 digits (e.g., 5 -> 05)\n;return`(${formattedHours}:${formattedMinutes})`// Returns time enclosed in parentheses\n;};/**\n * A Framer code override that updates the text content of the layer it's applied to\n * with a timer that starts at \"(03:42)\" and increments every second indefinitely.\n * The time is displayed in the \"(HH:MM)\" format.\n *\n * @returns {Override} An override object containing the updated text property.\n */export function Timer(){// State hook to store the current time, initialised to \"(03:42)\"\nconst[time,setTime]=useState(\"(03:42)\")// Initial value includes parentheses\n;// Effect hook that runs once when the component mounts\nuseEffect(()=>{// Sets up an interval that runs every 1000 milliseconds (1 second)\nconst intervalId=setInterval(()=>{// The setTime function receives the current time and calculates the next time\nsetTime(currentTime=>{// Remove parentheses and split the current time string by \":\" to get hours and minutes\nconst[currentHours,currentMinutes]=currentTime.slice(1,-1).split(\":\").map(Number)// Remove parentheses before splitting\n;let nextMinutes=currentMinutes+1// Increment the minute\n;let nextHours=currentHours// Keep the hour the same initially\n;// If minutes reach 60 or more\nif(nextMinutes>=60){nextMinutes=0// Reset minutes to 0\n;nextHours+=1// Increment the hour\n;}// If hours reach 24 or more (day cycle)\nif(nextHours>=24){nextHours=0// Reset hours to 0\n;}// Return the newly calculated time, formatted\nreturn formatTime(nextHours,nextMinutes);});},1e3)// Interval duration: 1000 milliseconds = 1 second (kept for testing)\n;// Cleanup function: Clears the interval when the component unmounts (prevents memory leaks)\nreturn()=>clearInterval(intervalId);},[])// Empty dependency array ensures the effect runs only on mount and unmount\n;// The property to override: Sets the 'text' property of the layer to the current time state\nreturn{text:time};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withTimer(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...Timer(props)});};}withTimer.displayName=\"Timer\";\nexport const __FramerMetadata__ = {\"exports\":{\"Timer\":{\"type\":\"override\",\"name\":\"Timer\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTimer\":{\"type\":\"reactHoc\",\"name\":\"withTimer\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Timer.map"],"mappings":"kLAgBG,SAAgB,GAAO,CAC1B,GAAK,CAAC,EAAK,GAASA,EAAS,UAAU,CAkBvC,OAhBA,MAAc,CACd,IAAM,EAAW,gBAAgB,CACjC,EAAQ,GAAa,CACrB,GAAK,CAAC,EAAa,GAAgB,EAAY,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,OAAO,CAC5E,EAAY,EAAe,EAC3B,EAAU,EAOf,OALG,GAAa,KAAI,EAAY,EAC/B,GAAW,GAET,GAAW,KAAI,EAAU,GAErB,EAAW,EAAU,EAAY,EAAG,EAAG,IAAI,CAElD,UAAU,cAAc,EAAW,EAAG,EAAE,CAAC,CAEnC,CAAC,KAAK,EAAK,CAAqJ,SAAgB,EAAU,EAAE,CAAC,MAAO,KAAQ,EAA+BC,EAAwC,CAAQC,EAAK,EAAE,CAAC,GAAG,EAAM,GAAG,EAAM,EAAM,CAAC,CAAC,qBAnCxR,IAAsC,IAmCqF,CA5B7J,GAAY,EAAM,IAEpB,IAFoD,OAAO,EAAM,CAAC,SAAS,EAAE,IAAI,CAE9D,GADF,OAAO,EAAQ,CAAC,SAAS,EAAE,IAAI,CACT,GA0ByR,EAAU,YAAY"}