{"version":3,"file":"CurrentWeather.BowBeRxi.mjs","names":["useState","useState","error"],"sources":["https:/framerusercontent.com/modules/BIHaw55VACfRKwSgwtj7/G7JGvVhzHUbk6jZsTk1B/Clock.js","https:/framerusercontent.com/modules/rbaIm3r9Wyr18rs1rV98/aQ7F3P6NP6B5GGHMqmKI/CurrentWeather.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Component made by Eleveight Supply, All rights reserved.\n/**\n\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth 100%\n * @framerSupportedLayoutHeight 100%\n */export default function Clock({timezone,is24HourFormat,showSeconds,font,fontSize,textColor,dateSettings:{showDate,dateFormat,datePosition,monthFormat},prefixSuffixSettings:{usePrefixSuffix,text:psText}}){const[currentDateTime,setCurrentDateTime]=useState(\"\");const[isValidTimezone,setIsValidTimezone]=useState(true);useEffect(()=>{function updateDateTime(){try{const now=new Date;const timeOptions={hour:\"2-digit\",minute:\"2-digit\",second:showSeconds?\"2-digit\":undefined,timeZone:timezone,hour12:!is24HourFormat};const dateOptions={year:dateFormat.includes(\"Y\")?\"numeric\":undefined,month:dateFormat.includes(\"M\")?monthFormat===\"text\"?\"long\":\"2-digit\":undefined,day:dateFormat.includes(\"D\")?\"2-digit\":undefined};const timeFormatter=new Intl.DateTimeFormat(\"en-US\",timeOptions);const dateFormatter=new Intl.DateTimeFormat(\"en-US\",dateOptions);const timeString=timeFormatter.format(now);const dateString=showDate?dateFormatter.format(now):\"\";let combinedString=dateString?`${dateString} - ${timeString}`:timeString;if(usePrefixSuffix===\"prefix\"&&psText){combinedString=`${psText} ${combinedString}`;}else if(usePrefixSuffix===\"suffix\"&&psText){combinedString=`${combinedString} ${psText}`;}setCurrentDateTime(combinedString);setIsValidTimezone(true);}catch(error){console.error(\"Error with timezone: \",error);setIsValidTimezone(false);}}updateDateTime();const intervalId=setInterval(updateDateTime,1e3);return()=>clearInterval(intervalId);},[timezone,is24HourFormat,showSeconds,showDate,dateFormat,datePosition,monthFormat,textColor,font,fontSize,usePrefixSuffix,psText]);const dynamicStyle={fontSize:`${fontSize}px`,fontFeatureSettings:\"'tnum'\",fontVariantNumeric:\"lining-nums\",color:textColor,...font};return /*#__PURE__*/_jsx(\"div\",{style:dynamicStyle,children:currentDateTime});}Clock.defaultProps={timezone:\"America/New_York\",is24HourFormat:true,showSeconds:false,dateSettings:{showDate:false,dateFormat:\"DMY\",datePosition:\"prefix\",monthFormat:\"number\"},prefixSuffixSettings:{usePrefixSuffix:\"none\",text:\"\",fontSize:16},textColor:\"#999999\",fontSize:24};addPropertyControls(Clock,{timezone:{type:ControlType.String,title:\"Timezone\",defaultValue:\"America/New_York\",description:\"Use a timezone identifier ie: 'America/Los_Angeles' [Full list here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:\"Inter\",controls:\"extended\"},textColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#999999\"},is24HourFormat:{type:ControlType.Boolean,title:\"Format\",defaultValue:true,enabledTitle:\"24h\",disabledTitle:\"12h\"},showSeconds:{type:ControlType.Boolean,title:\"Seconds\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},prefixSuffixSettings:{type:ControlType.Object,title:\"Prefix/Suffix\",controls:{usePrefixSuffix:{type:ControlType.SegmentedEnum,title:\"Use\",options:[\"none\",\"prefix\",\"suffix\"],optionTitles:[\"None\",\"Pref.\",\"Suff.\"],defaultValue:\"none\"},text:{type:ControlType.String,title:\"Text\",defaultValue:\"\",description:\"include your divider directly here, ie: - , :\"}}},dateSettings:{type:ControlType.Object,title:\"Date\",controls:{showDate:{type:ControlType.Boolean,title:\"Show Date\"},dateFormat:{type:ControlType.Enum,title:\"Format\",options:[\"D\",\"M\",\"DM\",\"DMY\"],optionTitles:[\"Only Day\",\"Only Month\",\"Day and Month\",\"Day, Month and Year\"]},datePosition:{type:ControlType.SegmentedEnum,title:\"Position\",options:[\"prefix\",\"suffix\"],optionTitles:[\"Front\",\"End\"]},monthFormat:{type:ControlType.SegmentedEnum,title:\"Month Format\",options:[\"number\",\"text\"],optionTitles:[\"Numeric\",\"Text\"]}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Clock\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"100%\",\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutHeight\":\"100%\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Clock.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const apiKey=\"d245617337db4565819225609241301\"// Your WeatherAPI.com API key\n;/**\n\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth 100%\n * @framerSupportedLayoutHeight 100%\n */export default function CurrentWeather({location:{country,city},showLocation,showTemperature,showCondition,prefixText,countryFirst,temperatureUnit,font,textColor,fontSize,style}){const[weatherCondition,setWeatherCondition]=useState(\"\");const[temperature,setTemperature]=useState(\"\");const[error,setError]=useState(\"\");useEffect(()=>{const fetchWeather=async()=>{try{const query=country?`${city}, ${country}`:city;const url=`https://api.weatherapi.com/v1/current.json?key=${apiKey}&q=${query}&aqi=no`;const response=await fetch(url);if(!response.ok){throw new Error(`Error: ${response.status} - ${response.statusText}`);}const data=await response.json();setWeatherCondition(showCondition?data.current.condition.text:\"\");const temp=temperatureUnit===\"C\"?data.current.temp_c:data.current.temp_f;setTemperature(showTemperature?`${temp}\\xb0${temperatureUnit}`:\"\");}catch(error){console.error(\"Error fetching weather data: \",error);setError(\"Failed to load weather data.\");}};fetchWeather();},[country,city,showCondition,showTemperature,temperatureUnit]);const locationText=(()=>{if(showLocation===\"none\")return\"\";const location=countryFirst?`${country}, ${city}`:`${city}, ${country}`;return showLocation===\"both\"?location:showLocation===\"country\"?country:city;})();const displayText=`${prefixText} ${locationText?`${locationText}: `:\"\"}${weatherCondition}${showTemperature&&showCondition?\", \":\" \"} ${temperature}`;const textStyle={fontSize:`${fontSize}px`,color:textColor,...font};return /*#__PURE__*/_jsx(\"div\",{style:{...style,...textStyle,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",height:\"100%\",width:\"100%\",padding:0,margin:0},children:error?/*#__PURE__*/_jsx(\"p\",{style:{margin:0},children:error}):/*#__PURE__*/_jsx(\"p\",{style:{margin:0},children:displayText.trim()})});}CurrentWeather.defaultProps={location:{country:\"USA\",city:\"New York\"},showLocation:\"both\",showTemperature:true,showCondition:true,countryFirst:false,temperatureUnit:\"C\",font:{},textColor:\"#999999\",fontSize:20};addPropertyControls(CurrentWeather,{location:{type:ControlType.Object,title:\"Location\",controls:{country:{type:ControlType.String,title:\"Country\",defaultValue:CurrentWeather.defaultProps.location.country},city:{type:ControlType.String,title:\"City\",defaultValue:CurrentWeather.defaultProps.location.city}}},font:{type:ControlType.Font,title:\"Font\",defaultValue:\"Inter\",controls:\"extended\"},textColor:{type:ControlType.Color,title:\"Font Color\",defaultValue:\"#999999\"},showLocation:{type:ControlType.Enum,title:\"Location\",options:[\"country\",\"city\",\"both\",\"none\"],optionTitles:[\"Country\",\"City\",\"Both\",\"None\"],defaultValue:\"both\"},showTemperature:{type:ControlType.Boolean,title:\"Temperature\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},showCondition:{type:ControlType.Boolean,title:\"Condition\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},prefixText:{type:ControlType.String,title:\"Prefix\",placeholder:\"For none, leave empty\"},countryFirst:{type:ControlType.Boolean,title:\"Country First\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},temperatureUnit:{type:ControlType.SegmentedEnum,title:\"Unit\",options:[\"C\",\"F\"],optionTitles:[\"\\xb0C\",\"\\xb0F\"],defaultValue:\"C\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CurrentWeather\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutHeight\":\"100%\",\"framerSupportedLayoutWidth\":\"100%\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CurrentWeather.map"],"mappings":"iLAOG,SAAwB,EAAM,CAAC,WAAS,iBAAe,cAAY,OAAK,WAAS,YAAU,aAAa,CAAC,WAAS,aAAW,eAAa,eAAa,qBAAqB,CAAC,kBAAgB,KAAK,IAAS,CAAC,GAAK,CAAC,EAAgB,GAAoBA,EAAS,GAAG,CAAM,CAAC,EAAgB,GAAoBA,EAAS,GAAK,CAAy2C,OAAx2C,MAAc,CAAC,SAAS,GAAgB,CAAC,GAAG,CAAC,IAAM,EAAI,IAAI,KAAW,EAAY,CAAC,KAAK,UAAU,OAAO,UAAU,OAAO,EAAY,UAAU,IAAA,GAAU,SAAS,EAAS,OAAO,CAAC,EAAe,CAAO,EAAY,CAAC,KAAK,EAAW,SAAS,IAAI,CAAC,UAAU,IAAA,GAAU,MAAM,EAAW,SAAS,IAAI,CAAC,IAAc,OAAO,OAAO,UAAU,IAAA,GAAU,IAAI,EAAW,SAAS,IAAI,CAAC,UAAU,IAAA,GAAU,CAAO,EAAc,IAAI,KAAK,eAAe,QAAQ,EAAY,CAAO,EAAc,IAAI,KAAK,eAAe,QAAQ,EAAY,CAAO,EAAW,EAAc,OAAO,EAAI,CAAO,EAAW,EAAS,EAAc,OAAO,EAAI,CAAC,GAAO,EAAe,EAAW,GAAG,EAAW,KAAK,IAAa,EAAc,IAAkB,UAAU,EAAQ,EAAe,GAAG,EAAO,GAAG,IAA0B,IAAkB,UAAU,IAAQ,EAAe,GAAG,EAAe,GAAG,KAAU,EAAmB,EAAe,CAAC,EAAmB,GAAK,OAAQ,EAAM,CAAC,QAAQ,MAAM,wBAAwB,EAAM,CAAC,EAAmB,GAAM,EAAG,GAAgB,CAA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