import{S as e,i as t,s as a,e as s,c as l,a as n,d as r,b as c,f as i,g as o,n as u,w as d,h,j as f,k as p,l as m,t as g,m as v,o as _,p as k,q as b,r as $,u as w,v as E,x as D,y,z as I,A as V,B as j,C as O,D as q,E as T,F as M,G as x,H as P,I as S,J as N,K as A}from"./client.c340c0cb.js";function C(e){let t,a,d,h,f,p,m,g,v;return{c(){t=s("div"),a=s("div"),d=s("div"),h=s("div"),f=s("div"),p=s("div"),m=s("div"),g=s("div"),v=s("div"),this.h()},l(e){t=l(e,"DIV",{class:!0});var s=n(t);a=l(s,"DIV",{class:!0}),n(a).forEach(r),d=l(s,"DIV",{class:!0}),n(d).forEach(r),h=l(s,"DIV",{class:!0}),n(h).forEach(r),f=l(s,"DIV",{class:!0}),n(f).forEach(r),p=l(s,"DIV",{class:!0}),n(p).forEach(r),m=l(s,"DIV",{class:!0}),n(m).forEach(r),g=l(s,"DIV",{class:!0}),n(g).forEach(r),v=l(s,"DIV",{class:!0}),n(v).forEach(r),s.forEach(r),this.h()},h(){c(a,"class","svelte-7k6qu0"),c(d,"class","svelte-7k6qu0"),c(h,"class","svelte-7k6qu0"),c(f,"class","svelte-7k6qu0"),c(p,"class","svelte-7k6qu0"),c(m,"class","svelte-7k6qu0"),c(g,"class","svelte-7k6qu0"),c(v,"class","svelte-7k6qu0"),c(t,"class","lds-roller svelte-7k6qu0")},m(e,s){i(e,t,s),o(t,a),o(t,d),o(t,h),o(t,f),o(t,p),o(t,m),o(t,g),o(t,v)},p:u,i:u,o:u,d(e){e&&r(t)}}}class J extends e{constructor(e){super(),t(this,e,null,C,a,{})}}const B={January:1,Feb:2,March:3,April:4,May:5,June:6,July:7,August:8,September:9,October:10,November:11,December:12};function H(e){return e=function(e){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e))return e;if(/^\d{4}\s[a-z,A-Z]+\s\d{2}$/.test(e)){let t=e.split(" ");return`${t[0]}-${function(e,t=2){let a=e.toString();for(;t-a.length>0;)a="0"+a;return a}(B[t[1]])}-${t[2]}T00:00:00Z`}return/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}/.test(e)?e.replace(" ","T")+"Z":/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}.\d{4}/.test(e)?e.replace(" ","T").split(".")[0]+"Z":(console.warn(e),e)}(e),new Date(e)}const K=d("light");setInterval((function(){if("undefined"==typeof window)return;let e=window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light";e!=h(K)&&K.set(e)}),1e3),K.subscribe((e=>{"undefined"!=typeof window&&("dark"==e?window.document.body.classList.add("dark"):window.document.body.classList.remove("dark"))}));const z={updated:!1,updating:!0},F=d(Object.assign(Object.assign({},z),{available:!1,longitude:null,latitude:null,city:null})),Z=d(Object.assign(Object.assign({},z),{available:!1})),L=d(Object.assign({},z));!async function(){if("undefined"==typeof window)return;let e;R(F,!0);try{e=await async function(){return new Promise(((e,t)=>{"undefined"!=typeof navigator?navigator.geolocation.getCurrentPosition((t=>{e({longitude:t.coords.longitude,latitude:t.coords.latitude})}),(e=>{t(e)})):t(Error())}))}()}catch(e){return console.log(e),F.update((e=>Object.assign(Object.assign({},e),{available:!1,city:null,longitude:null,latitude:null}))),void R(F,!1)}let t=await fetch(`https://geocode.xyz/${e.latitude},${e.longitude}?geoit=json`),a=await t.json();F.update((t=>Object.assign(Object.assign(Object.assign({},t),{available:!0,city:a.city}),e))),R(F,!1)}(),F.subscribe((async function(e=null){if("undefined"==typeof window)return;if(null===e)return;if(e.updating)return;if(!e.available)return Z.update((e=>Object.assign(Object.assign({},e),{available:!1}))),void R(Z,!1);R(Z,!0);let t=await fetch(`https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=${e.latitude}&lon=${e.longitude}`),a=await t.json(),s={clouds:null,temp:null};try{s.clouds=a.properties.timeseries[0].data.instant.details.cloud_area_fraction,s.temp=a.properties.timeseries[0].data.instant.details.air_temperature,a.properties.timeseries=a.properties.timeseries.map((e=>Object.assign(Object.assign({},e),{time:H(e.time)})))}catch(e){}Z.update((e=>Object.assign(Object.assign({},e),{yr_data_raw:a,now:s,available:!0}))),R(Z,!1)})),async function(){if("undefined"==typeof window)return;R(L,!0);let e=await async function(){let e,t={now:{bz:"-",bt:"-",kp:"-",kp_min:"-",kp_max:"-"},usnoaa_data_raw:{solar_wind_mag_field:!1,noaa_planetary_k_index_forecast:!1,geospace_pred_est_kp_1_hour:!1,outlook_27_day:!1}},a=await fetch("https://services.swpc.noaa.gov/products/summary/solar-wind-mag-field.json");t.usnoaa_data_raw.solar_wind_mag_field=await a.json(),t.usnoaa_data_raw.solar_wind_mag_field.TimeStamp=H(t.usnoaa_data_raw.solar_wind_mag_field.TimeStamp),t.now.bz=t.usnoaa_data_raw.solar_wind_mag_field.Bz,t.now.bt=t.usnoaa_data_raw.solar_wind_mag_field.Bt,a=await fetch("https://services.swpc.noaa.gov/json/geospace/geospace_pred_est_kp_1_hour.json"),e=await a.json(),e=e.map((e=>Object.assign(Object.assign({},e),{model_prediction_time:H(e.model_prediction_time)}))),t.usnoaa_data_raw.geospace_pred_est_kp_1_hour=e,a=await fetch("https://services.swpc.noaa.gov/text/27-day-outlook.txt"),e=await a.text(),e=[...e.matchAll(/^(?