{"version":3,"file":"LocalTimeClock.Cs6-8Vqf.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/3wsnRmuUBPRzGe9XcCoc/jknAmwIw9I8gy4BRwWtJ/LocalTimeClock.js"],"sourcesContent":["// Local time clock component where users can choose time from their local time\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function LocalTimeClock(props){const{format=\"12\",showSeconds=true,showDate=true,showTimeZone=false,useCustomTimeZone=false,timeZone=\"local\",customTimeZone=\"\",backgroundColor=\"#FFFFFF\",textColor=\"#000000\",timeFont,dateFont,borderRadius=8,padding=20}=props;const[currentTime,setCurrentTime]=useState(new Date);useEffect(()=>{if(typeof window===\"undefined\")return;const timer=setInterval(()=>{startTransition(()=>{setCurrentTime(new Date);});},1e3);return()=>clearInterval(timer);},[]);const parseUTCOffset=offset=>{// Handle formats like +5:30, -12:00, +05.30, -12.30, +5, -8\nconst match=offset.match(/^([+-])(\\d{1,2})(?:[:.:](\\d{2}))?$/);if(!match)return null;const sign=match[1]===\"+\"?1:-1;const hours=parseInt(match[2],10);const minutes=match[3]?parseInt(match[3],10):0;return sign*(hours*60+minutes);};const getTimeInTimeZone=()=>{const effectiveTimeZone=useCustomTimeZone?customTimeZone:timeZone;if(effectiveTimeZone===\"local\"||!effectiveTimeZone){return currentTime;}// Check if it's a UTC offset format\nif(effectiveTimeZone.match(/^[+-]\\d/)){const offsetMinutes=parseUTCOffset(effectiveTimeZone);if(offsetMinutes!==null){const utcTime=new Date(currentTime.getTime()+currentTime.getTimezoneOffset()*6e4);return new Date(utcTime.getTime()+offsetMinutes*6e4);}}// Try as timezone identifier (city name or IANA timezone)\ntry{return new Date(currentTime.toLocaleString(\"en-US\",{timeZone:effectiveTimeZone}));}catch{return currentTime;}};const formatTime=date=>{const timeInZone=getTimeInTimeZone();const hours=timeInZone.getHours();const minutes=timeInZone.getMinutes();const seconds=timeInZone.getSeconds();if(format===\"24\"){const timeString=`${hours.toString().padStart(2,\"0\")}:${minutes.toString().padStart(2,\"0\")}`;return showSeconds?`${timeString}:${seconds.toString().padStart(2,\"0\")}`:timeString;}else{const hours12=hours%12||12;const ampm=hours>=12?\"PM\":\"AM\";const timeString=`${hours12}:${minutes.toString().padStart(2,\"0\")}`;const timeWithSeconds=showSeconds?`${timeString}:${seconds.toString().padStart(2,\"0\")}`:timeString;return`${timeWithSeconds} ${ampm}`;}};const formatDate=date=>{const timeInZone=getTimeInTimeZone();return timeInZone.toLocaleDateString(undefined,{weekday:\"long\",year:\"numeric\",month:\"long\",day:\"numeric\"});};const getTimeZoneOffset=()=>{const effectiveTimeZone=useCustomTimeZone?customTimeZone:timeZone;if(effectiveTimeZone===\"local\"||!effectiveTimeZone){const offset=currentTime.getTimezoneOffset();const hours=Math.floor(Math.abs(offset)/60);const minutes=Math.abs(offset)%60;const sign=offset<=0?\"+\":\"-\";return`${sign}${hours.toString().padStart(2,\"0\")}.${minutes.toString().padStart(2,\"0\")}`;}// Check if it's a UTC offset format\nif(effectiveTimeZone.match(/^[+-]\\d/)){const offsetMinutes=parseUTCOffset(effectiveTimeZone);if(offsetMinutes!==null){const hours=Math.floor(Math.abs(offsetMinutes)/60);const minutes=Math.abs(offsetMinutes)%60;const sign=offsetMinutes>=0?\"+\":\"-\";return`${sign}${hours.toString().padStart(2,\"0\")}.${minutes.toString().padStart(2,\"0\")}`;}}try{const timeInZone=new Date(currentTime.toLocaleString(\"en-US\",{timeZone:effectiveTimeZone}));const utcTime=new Date(currentTime.getTime()+currentTime.getTimezoneOffset()*6e4);const offset=(timeInZone.getTime()-utcTime.getTime())/(1e3*60);const hours=Math.floor(Math.abs(offset)/60);const minutes=Math.abs(offset)%60;const sign=offset>=0?\"+\":\"-\";return`${sign}${hours.toString().padStart(2,\"0\")}.${minutes.toString().padStart(2,\"0\")}`;}catch{return\"+00.00\";}};const isFixedWidth=props?.style&&props.style.width===\"100%\";return /*#__PURE__*/_jsxs(\"div\",{style:{...props.style,...isFixedWidth?{}:{width:\"max-content\"},backgroundColor,borderRadius,padding,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",gap:showDate||showTimeZone?8:0,boxShadow:\"0 2px 8px rgba(0,0,0,0.08)\"},children:[/*#__PURE__*/_jsxs(\"div\",{style:{color:textColor,...timeFont,fontVariantNumeric:\"tabular-nums\"},children:[formatTime(currentTime),showTimeZone&&/*#__PURE__*/_jsx(\"span\",{style:{fontSize:\"0.6em\",opacity:.7,marginLeft:8},children:getTimeZoneOffset()})]}),showDate&&/*#__PURE__*/_jsx(\"div\",{style:{color:textColor,opacity:.7,...dateFont},children:formatDate(currentTime)})]});}addPropertyControls(LocalTimeClock,{useCustomTimeZone:{type:ControlType.Boolean,title:\"Custom Time Zone\",defaultValue:false,enabledTitle:\"Custom\",disabledTitle:\"Preset\"},timeZone:{type:ControlType.Enum,title:\"Time Zone\",options:[\"local\",\"America/New_York\",\"America/Chicago\",\"America/Denver\",\"America/Los_Angeles\",\"Europe/London\",\"Europe/Paris\",\"Europe/Berlin\",\"Europe/Rome\",\"Asia/Tokyo\",\"Asia/Shanghai\",\"Asia/Kolkata\",\"Asia/Dubai\",\"Australia/Sydney\",\"Pacific/Auckland\"],optionTitles:[\"Local Time\",\"New York (EST/EDT)\",\"Chicago (CST/CDT)\",\"Denver (MST/MDT)\",\"Los Angeles (PST/PDT)\",\"London (GMT/BST)\",\"Paris (CET/CEST)\",\"Berlin (CET/CEST)\",\"Rome (CET/CEST)\",\"Tokyo (JST)\",\"Shanghai (CST)\",\"Mumbai (IST)\",\"Dubai (GST)\",\"Sydney (AEST/AEDT)\",\"Auckland (NZST/NZDT)\"],defaultValue:\"local\",hidden:({useCustomTimeZone})=>useCustomTimeZone},customTimeZone:{type:ControlType.String,title:\"Custom Time Zone\",placeholder:\"e.g. +05.30, -12.00, or Asia/Kolkata\",defaultValue:\"\",hidden:({useCustomTimeZone})=>!useCustomTimeZone},format:{type:ControlType.Enum,title:\"Time Format\",options:[\"12\",\"24\"],optionTitles:[\"12 Hour\",\"24 Hour\"],defaultValue:\"12\",displaySegmentedControl:true},showSeconds:{type:ControlType.Boolean,title:\"Show Seconds\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},showDate:{type:ControlType.Boolean,title:\"Show Date\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},showTimeZone:{type:ControlType.Boolean,title:\"Show Time Zone\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},timeFont:{type:ControlType.Font,title:\"Time Font\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},dateFont:{type:ControlType.Font,title:\"Date Font\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"},controls:\"extended\",defaultFontType:\"sans-serif\",hidden:({showDate})=>!showDate},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:20,min:0,max:50,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LocalTimeClock\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LocalTimeClock.map"],"mappings":"6MAIG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,SAAO,KAAK,cAAY,GAAK,WAAS,GAAK,eAAa,GAAM,oBAAkB,GA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