!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);n(1);const{createElement:r,render:a,useState:i,useEffect:o,Fragment:l}=wp.element,s=e=>{const[t,n]=i({latitude:"",longitude:""}),[a,l]=i({});return o(()=>{if(e.settings.api){let e=localStorage.getItem("weather");e&&(e=JSON.parse(e)),e&&(new Date).getTime()-e.timestamp<144e5?n({latitude:e.latitude,longitude:e.longitude}):navigator.geolocation&&navigator.geolocation.getCurrentPosition(e=>{n({latitude:e.coords.latitude,longitude:e.coords.longitude}),localStorage.setItem("weather",JSON.stringify({latitude:e.coords.latitude,longitude:e.coords.longitude,timestamp:(new Date).getTime()}))})}},[e]),o(()=>{t.latitude&&e.settings.api&&fetch(`https://api.openweathermap.org/data/2.5/weather?lat=${t.latitude}&lon=${t.longitude}&appid=${e.settings.api}`).then(e=>e.json()).then(e=>{e&&l(e)})},[t]),r("div",{className:"wplms_weather_widget"},e.settings.title?r("h3",{className:"widget_title"},e.settings.title):"",a.hasOwnProperty("weather")?a.weather[0].id>=200&&a.weather[0].id<300?r("span",{dangerouslySetInnerHTML:{__html:window.wplms_weather.icons.rain}}):a.weather[0].id>=300&&a.weather[0].id<400?r("span",{dangerouslySetInnerHTML:{__html:window.wplms_weather.icons.drizzle}}):a.weather[0].id>=500&&a.weather[0].id<600?r("span",{dangerouslySetInnerHTML:{__html:window.wplms_weather.icons.rain}}):a.weather[0].id>=600&&a.weather[0].id<700?r("span",{dangerouslySetInnerHTML:{__html:window.wplms_weather.icons.snow}}):a.weather[0].id>=700&&a.weather[0].id<800?r("span",{dangerouslySetInnerHTML:{__html:window.wplms_weather.icons.haze}}):800==a.weather[0].id?r("span",{dangerouslySetInnerHTML:{__html:window.wplms_weather.icons.clear}}):a.weather[0].id>800?r("span",{dangerouslySetInnerHTML:{__html:window.wplms_weather.icons.clouds}}):"":"",a.hasOwnProperty("weather")?r("div",{className:"weather_details"},r("strong",null,a.weather[0].main),r("span",null,r("span",null,a.main.temp," ℉"),r("span",null,a.name))):"")};document.addEventListener("wplms_weather",e=>{setTimeout(()=>{document.querySelector(".wplms_dash_weather")&&a(r(s,{settings:e.detail.widget.options}),document.querySelector(".wplms_dash_weather"))},1500)})},function(e,t,n){}]);