summaryrefslogtreecommitdiff
path: root/client/index.0db72640.js
diff options
context:
space:
mode:
authorjakobst1n <undefined>2022-04-28 14:03:34 +0200
committerjakobst1n <undefined>2022-04-28 14:03:34 +0200
commitbd63e45d2d03af7dd55c48450915f9b63567c3d4 (patch)
treeb9a88f33ae6af2a1b607fb65e5f8b67d6eba7b45 /client/index.0db72640.js
parentfeff040c09bef987ccbf9575feb33b0d2e2bdf51 (diff)
downloadAurora-data-bd63e45d2d03af7dd55c48450915f9b63567c3d4.tar.gz
Aurora-data-bd63e45d2d03af7dd55c48450915f9b63567c3d4.zip
Updates
Diffstat (limited to 'client/index.0db72640.js')
-rw-r--r--client/index.0db72640.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/client/index.0db72640.js b/client/index.0db72640.js
new file mode 100644
index 0000000..c507dd4
--- /dev/null
+++ b/client/index.0db72640.js
@@ -0,0 +1 @@
+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,t as f,j as p,k as m,l as v,m as g,o as _,p as k,q as $,r as b,u as w,v as E,x as D,y,z as j,A as I,B as V,C as O,D as q,E as T,F as x,G as M,H as P,I as S,J as N}from"./client.0760ad6c.js";function C(e){let t,a,d,h,f,p,m,v,g;return{c(){t=s("div"),a=s("div"),d=s("div"),h=s("div"),f=s("div"),p=s("div"),m=s("div"),v=s("div"),g=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),v=l(s,"DIV",{class:!0}),n(v).forEach(r),g=l(s,"DIV",{class:!0}),n(g).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(v,"class","svelte-7k6qu0"),c(g,"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,v),o(t,g)},p:u,i:u,o:u,d(e){e&&r(t)}}}class A extends e{constructor(e){super(),t(this,e,null,C,a,{})}}const B={updated:!1,updating:!0},H=d(Object.assign(Object.assign({},B),{available:!1,longitude:null,latitude:null,city:null})),J=d(Object.assign(Object.assign({},B),{available:!1})),K=d(Object.assign({},B));function z(e,t=!1){let a=t?{}:{updated:new Date};e.update((e=>Object.assign(Object.assign(Object.assign({},e),a),{updating:t})))}function F(e){let t,a,u,d,g=e[0].city+"";return{c(){t=s("i"),a=h(),u=s("h1"),d=f(g),this.h()},l(e){t=l(e,"I",{class:!0}),n(t).forEach(r),a=p(e),u=l(e,"H1",{class:!0});var s=n(u);d=m(s,g),s.forEach(r),this.h()},h(){c(t,"class","symbol fas fa-map-marker-alt svelte-9kdo4s"),c(u,"class","svelte-9kdo4s")},m(e,s){i(e,t,s),i(e,a,s),i(e,u,s),o(u,d)},p(e,t){1&t&&g!==(g=e[0].city+"")&&v(d,g)},d(e){e&&r(t),e&&r(a),e&&r(u)}}}function L(e){let t,a;function s(e,a){return 6&a&&(t=null),null==t&&(t=!!(Math.abs(e[1].updated-e[2].updated)>6e5)),t?Z:U}let l=s(e,-1),n=l(e);return{c(){n.c(),a=g()},l(e){n.l(e),a=g()},m(e,t){n.m(e,t),i(e,a,t)},p(e,t){l===(l=s(e,t))&&n?n.p(e,t):(n.d(1),n=l(e),n&&(n.c(),n.m(a.parentNode,a)))},d(e){n.d(e),e&&r(a)}}}function U(e){let t,a,c=e[1].updated.toLocaleString("no-NO",{dateStyle:"medium",timeStyle:"short"})+"";return{c(){t=s("p"),a=f(c)},l(e){t=l(e,"P",{});var s=n(t);a=m(s,c),s.forEach(r)},m(e,s){i(e,t,s),o(t,a)},p(e,t){2&t&&c!==(c=e[1].updated.toLocaleString("no-NO",{dateStyle:"medium",timeStyle:"short"})+"")&&v(a,c)},d(e){e&&r(t)}}}function Z(e){let t,a;return{c(){t=s("p"),a=f("There is more than 10 minutes difference between data updates")},l(e){t=l(e,"P",{});var s=n(t);a=m(s,"There is more than 10 minutes difference between data updates"),s.forEach(r)},m(e,s){i(e,t,s),o(t,a)},p:u,d(e){e&&r(t)}}}function G(e){let t,a,d,g,_,k,$,b,w,E,D,y,j=e[2].now.kp+"",I=e[2].now.kp_max+"",V=e[2].now.kp_min+"";return{c(){t=s("h2"),a=f("KP "),d=f(j),g=h(),_=s("p"),k=s("span"),$=f("↑ KP "),b=f(I),w=h(),E=s("span"),D=f("↓ KP "),y=f(V),this.h()},l(e){t=l(e,"H2",{class:!0});var s=n(t);a=m(s,"KP "),d=m(s,j),s.forEach(r),g=p(e),_=l(e,"P",{});var c=n(_);k=l(c,"SPAN",{classname:!0});var i=n(k);$=m(i,"↑ KP "),b=m(i,I),i.forEach(r),w=p(c),E=l(c,"SPAN",{classname:!0});var o=n(E);D=m(o,"↓ KP "),y=m(o,V),o.forEach(r),c.forEach(r),this.h()},h(){c(t,"class","svelte-9kdo4s"),c(k,"classname","pr-2"),c(E,"classname","pl-2")},m(e,s){i(e,t,s),o(t,a),o(t,d),i(e,g,s),i(e,_,s),o(_,k),o(k,$),o(k,b),o(_,w),o(_,E),o(E,D),o(E,y)},p(e,t){4&t&&j!==(j=e[2].now.kp+"")&&v(d,j),4&t&&I!==(I=e[2].now.kp_max+"")&&v(b,I),4&t&&V!==(V=e[2].now.kp_min+"")&&v(y,V)},i:u,o:u,d(e){e&&r(t),e&&r(g),e&&r(_)}}}function Q(e){let t,a;return t=new A({}),{c(){E(t.$$.fragment)},l(e){D(t.$$.fragment,e)},m(e,s){y(t,e,s),a=!0},p:u,i(e){a||(b(t.$$.fragment,e),a=!0)},o(e){k(t.$$.fragment,e),a=!1},d(e){j(t,e)}}}function R(e){let t,a,u,d,_,k,$,b,w,E,D,y,j,I,V,O=e[2].now.bz+"",q=e[2].now.bt+"",T=e[1].available&&W(e);return{c(){t=s("div"),a=s("p"),u=f("BZ"),d=h(),_=s("p"),k=f(O),$=h(),b=s("div"),w=s("p"),E=f("BT"),D=h(),y=s("p"),j=f(q),I=h(),T&&T.c(),V=g(),this.h()},l(e){t=l(e,"DIV",{});var s=n(t);a=l(s,"P",{class:!0});var c=n(a);u=m(c,"BZ"),c.forEach(r),d=p(s),_=l(s,"P",{class:!0});var i=n(_);k=m(i,O),i.forEach(r),s.forEach(r),$=p(e),b=l(e,"DIV",{});var o=n(b);w=l(o,"P",{class:!0});var h=n(w);E=m(h,"BT"),h.forEach(r),D=p(o),y=l(o,"P",{class:!0});var f=n(y);j=m(f,q),f.forEach(r),o.forEach(r),I=p(e),T&&T.l(e),V=g(),this.h()},h(){c(a,"class","svelte-9kdo4s"),c(_,"class","svelte-9kdo4s"),c(w,"class","svelte-9kdo4s"),c(y,"class","svelte-9kdo4s")},m(e,s){i(e,t,s),o(t,a),o(a,u),o(t,d),o(t,_),o(_,k),i(e,$,s),i(e,b,s),o(b,w),o(w,E),o(b,D),o(b,y),o(y,j),i(e,I,s),T&&T.m(e,s),i(e,V,s)},p(e,t){4&t&&O!==(O=e[2].now.bz+"")&&v(k,O),4&t&&q!==(q=e[2].now.bt+"")&&v(j,q),e[1].available?T?T.p(e,t):(T=W(e),T.c(),T.m(V.parentNode,V)):T&&(T.d(1),T=null)},d(e){e&&r(t),e&&r($),e&&r(b),e&&r(I),T&&T.d(e),e&&r(V)}}}function W(e){let t,a,u,d,g,_,k,$,b,w,E,D,y,j,I,V=e[1].now.temp+"",O=e[1].now.clouds+"";return{c(){t=s("div"),a=s("p"),u=f("Temp"),d=h(),g=s("p"),_=f(V),k=f("°C"),$=h(),b=s("div"),w=s("p"),E=f("Clouds"),D=h(),y=s("p"),j=f(O),I=f("%"),this.h()},l(e){t=l(e,"DIV",{});var s=n(t);a=l(s,"P",{class:!0});var c=n(a);u=m(c,"Temp"),c.forEach(r),d=p(s),g=l(s,"P",{class:!0});var i=n(g);_=m(i,V),k=m(i,"°C"),i.forEach(r),s.forEach(r),$=p(e),b=l(e,"DIV",{});var o=n(b);w=l(o,"P",{class:!0});var h=n(w);E=m(h,"Clouds"),h.forEach(r),D=p(o),y=l(o,"P",{class:!0});var f=n(y);j=m(f,O),I=m(f,"%"),f.forEach(r),o.forEach(r),this.h()},h(){c(a,"class","svelte-9kdo4s"),c(g,"class","svelte-9kdo4s"),c(w,"class","svelte-9kdo4s"),c(y,"class","svelte-9kdo4s")},m(e,s){i(e,t,s),o(t,a),o(a,u),o(t,d),o(t,g),o(g,_),o(g,k),i(e,$,s),i(e,b,s),o(b,w),o(w,E),o(b,D),o(b,y),o(y,j),o(y,I)},p(e,t){2&t&&V!==(V=e[1].now.temp+"")&&v(_,V),2&t&&O!==(O=e[1].now.clouds+"")&&v(j,O)},d(e){e&&r(t),e&&r($),e&&r(b)}}}function X(e){let t,a,u,d,f,m,v,g,w,E,D,y,j=!e[0].updating&&e[0].available&&!e[1].updating&&!e[2].updating&&F(e),I=!e[1].updating&&!e[2].updating&&L(e);const V=[Q,G],O=[];function q(e,t){return e[2].updating||e[1].updating?0:1}g=q(e),w=O[g]=V[g](e);let T=!e[2].updating&&!e[1].updating&&R(e);return{c(){t=s("div"),a=s("div"),u=s("div"),j&&j.c(),d=h(),f=s("div"),I&&I.c(),m=h(),v=s("div"),w.c(),E=h(),D=s("div"),T&&T.c(),this.h()},l(e){t=l(e,"DIV",{class:!0});var s=n(t);a=l(s,"DIV",{class:!0});var c=n(a);u=l(c,"DIV",{class:!0});var i=n(u);j&&j.l(i),i.forEach(r),d=p(c),f=l(c,"DIV",{class:!0});var o=n(f);I&&I.l(o),o.forEach(r),m=p(c),v=l(c,"DIV",{class:!0});var h=n(v);w.l(h),h.forEach(r),E=p(c),D=l(c,"DIV",{class:!0});var g=n(D);T&&T.l(g),g.forEach(r),c.forEach(r),s.forEach(r),this.h()},h(){c(u,"class","weatherCurrent-data-location svelte-9kdo4s"),c(f,"class","weatherCurrent-data-date"),c(v,"class","weatherCurrent-data-kp svelte-9kdo4s"),c(D,"class","current-details svelte-9kdo4s"),c(a,"class","weatherCurrent-data svelte-9kdo4s"),c(t,"class","weatherCurrent-wrapper svelte-9kdo4s")},m(e,s){i(e,t,s),o(t,a),o(a,u),j&&j.m(u,null),o(a,d),o(a,f),I&&I.m(f,null),o(a,m),o(a,v),O[g].m(v,null),o(a,E),o(a,D),T&&T.m(D,null),y=!0},p(e,[t]){e[0].updating||!e[0].available||e[1].updating||e[2].updating?j&&(j.d(1),j=null):j?j.p(e,t):(j=F(e),j.c(),j.m(u,null)),e[1].updating||e[2].updating?I&&(I.d(1),I=null):I?I.p(e,t):(I=L(e),I.c(),I.m(f,null));let a=g;g=q(e),g===a?O[g].p(e,t):(_(),k(O[a],1,1,(()=>{O[a]=null})),$(),w=O[g],w?w.p(e,t):(w=O[g]=V[g](e),w.c()),b(w,1),w.m(v,null)),e[2].updating||e[1].updating?T&&(T.d(1),T=null):T?T.p(e,t):(T=R(e),T.c(),T.m(D,null))},i(e){y||(b(w),y=!0)},o(e){k(w),y=!1},d(e){e&&r(t),j&&j.d(),I&&I.d(),O[g].d(),T&&T.d()}}}function Y(e,t,a){let s,l,n;return w(e,H,(e=>a(0,s=e))),w(e,J,(e=>a(1,l=e))),w(e,K,(e=>a(2,n=e))),[s,l,n]}!async function(){if("undefined"==typeof window)return;let e;z(H,!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),H.update((e=>Object.assign(Object.assign({},e),{available:!1,city:null,longitude:null,latitude:null}))),void z(H,!1)}let t=await fetch(`https://geocode.xyz/${e.latitude},${e.longitude}?geoit=json`),a=await t.json();H.update((t=>Object.assign(Object.assign(Object.assign({},t),{available:!0,city:a.city}),e))),z(H,!1)}(),H.subscribe((async function(e=null){if("undefined"==typeof window)return;if(null===e)return;if(e.updating)return;if(!e.available)return J.update((e=>Object.assign(Object.assign({},e),{available:!1}))),void z(J,!1);z(J,!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:new Date(e.time)})))}catch(e){}J.update((e=>Object.assign(Object.assign({},e),{yr_data_raw:a,now:s,available:!0}))),z(J,!1)})),async function(){if("undefined"==typeof window)return;z(K,!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=new Date(t.usnoaa_data_raw.solar_wind_mag_field.TimeStamp+" UTC"),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:new Date(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(/^(?<time>\d{4}\s.{3}\s\d{2})\s+(?<flux107>\d+)\s+(?<aindex>\d+)\s+(?<kindex>\d+)$/gm)],e=e.map((e=>Object.assign(Object.assign({},e.groups),{time:new Date(e.groups.time+" UTC")}))),t.usnoaa_data_raw.outlook_27_day=e,a=await fetch("https://services.swpc.noaa.gov/products/noaa-planetary-k-index-forecast.json"),t.usnoaa_data_raw.noaa_planetary_k_index_forecast=await a.json(),t.usnoaa_data_raw.noaa_planetary_k_index_forecast.shift();let s=new Date,l=new Date(0,0,0),n=1e3,r=0;return t.usnoaa_data_raw.noaa_planetary_k_index_forecast.forEach(((e,a)=>{e[1]>r&&(r=e[1]),e[1]<n&&(n=e[1]);let c=new Date(e[0]+" UTC");Math.abs(c.getTime()-s.getTime())<Math.abs(l.getTime()-s.getTime())&&(l=c,t.now.kp=e[1]),t.usnoaa_data_raw.noaa_planetary_k_index_forecast[a]={time:c,kp:e[1],observed:e[2]}})),t.now.kp_min=n.toString(),t.now.kp_max=r.toString(),console.log(t),t}();K.update((t=>Object.assign(Object.assign({},t),e))),z(K,!1)}();class ee extends e{constructor(e){super(),t(this,e,Y,X,a,{})}}function te(e){let t,a;const o=e[1].default,u=I(o,e,e[0],null);return{c(){t=s("div"),u&&u.c(),this.h()},l(e){t=l(e,"DIV",{class:!0});var a=n(t);u&&u.l(a),a.forEach(r),this.h()},h(){c(t,"class","chip svelte-1jb0ny7")},m(e,s){i(e,t,s),u&&u.m(t,null),a=!0},p(e,[t]){u&&u.p&&(!a||1&t)&&V(u,o,e,e[0],a?q(o,e[0],t,null):O(e[0]),null)},i(e){a||(b(u,e),a=!0)},o(e){k(u,e),a=!1},d(e){e&&r(t),u&&u.d(e)}}}function ae(e,t,a){let{$$slots:s={},$$scope:l}=t;return e.$$set=e=>{"$$scope"in e&&a(0,l=e.$$scope)},[l,s]}class se extends e{constructor(e){super(),t(this,e,ae,te,a,{})}}function le(e){let t,a,d,g,_,k;return{c(){t=s("div"),a=s("div"),d=s("div"),g=h(),_=s("span"),k=f(e[1]),this.h()},l(s){t=l(s,"DIV",{class:!0,style:!0});var c=n(t);a=l(c,"DIV",{class:!0});var i=n(a);d=l(i,"DIV",{class:!0}),n(d).forEach(r),i.forEach(r),g=p(c),_=l(c,"SPAN",{class:!0});var o=n(_);k=m(o,e[1]),o.forEach(r),c.forEach(r),this.h()},h(){c(d,"class","bar svelte-1mo8cjf"),c(a,"class","bar-wrapper svelte-1mo8cjf"),c(_,"class","value svelte-1mo8cjf"),c(t,"class","wrapper svelte-1mo8cjf"),T(t,"--progress",100*e[0]+"%")},m(e,s){i(e,t,s),o(t,a),o(a,d),o(t,g),o(t,_),o(_,k)},p(e,[a]){2&a&&v(k,e[1]),1&a&&T(t,"--progress",100*e[0]+"%")},i:u,o:u,d(e){e&&r(t)}}}function ne(e,t,a){let{percentage:s}=t,{value:l}=t;return e.$$set=e=>{"percentage"in e&&a(0,s=e.percentage),"value"in e&&a(1,l=e.value)},[s,l]}class re extends e{constructor(e){super(),t(this,e,ne,le,a,{percentage:0,value:1})}}function ce(e){let t,a,d,v,g,_,$,w,I,V,O,q,T;V=new re({props:{percentage:e[0]/9,value:e[0]}});let x=e[5]&&function(e){let t,a,d,v,g,_,k,$,b,w,E,D,y=Math.round(e[3])+"",j=Math.round(e[4])+"";return{c(){t=s("div"),a=s("p"),d=s("i"),v=h(),g=f(y),_=f("°C"),k=h(),$=s("p"),b=s("i"),w=h(),E=f(j),D=f("%"),this.h()},l(e){t=l(e,"DIV",{class:!0});var s=n(t);a=l(s,"P",{class:!0});var c=n(a);d=l(c,"I",{class:!0}),n(d).forEach(r),v=p(c),g=m(c,y),_=m(c,"°C"),c.forEach(r),k=p(s),$=l(s,"P",{class:!0});var i=n($);b=l(i,"I",{class:!0}),n(b).forEach(r),w=p(i),E=m(i,j),D=m(i,"%"),i.forEach(r),s.forEach(r),this.h()},h(){c(d,"class","fas fa-thermometer-half svelte-m9qkku"),c(a,"class","svelte-m9qkku"),c(b,"class","fas fa-cloud svelte-m9qkku"),c($,"class","svelte-m9qkku"),c(t,"class","svelte-m9qkku")},m(e,s){i(e,t,s),o(t,a),o(a,d),o(a,v),o(a,g),o(a,_),o(t,k),o(t,$),o($,b),o($,w),o($,E),o($,D)},p:u,d(e){e&&r(t)}}}(e);return{c(){t=s("div"),a=s("div"),d=s("h3"),v=f(e[2]),g=h(),_=s("p"),$=f(e[1]),w=h(),I=s("div"),E(V.$$.fragment),O=h(),q=s("div"),x&&x.c(),this.h()},l(s){t=l(s,"DIV",{class:!0});var c=n(t);a=l(c,"DIV",{class:!0});var i=n(a);d=l(i,"H3",{class:!0});var o=n(d);v=m(o,e[2]),o.forEach(r),g=p(i),_=l(i,"P",{class:!0});var u=n(_);$=m(u,e[1]),u.forEach(r),i.forEach(r),w=p(c),I=l(c,"DIV",{class:!0});var h=n(I);D(V.$$.fragment,h),h.forEach(r),O=p(c),q=l(c,"DIV",{class:!0});var f=n(q);x&&x.l(f),f.forEach(r),c.forEach(r),this.h()},h(){c(d,"class","svelte-m9qkku"),c(_,"class","svelte-m9qkku"),c(a,"class","svelte-m9qkku"),c(I,"class","KP svelte-m9qkku"),c(q,"class","data svelte-m9qkku"),c(t,"class","prediction-details svelte-m9qkku")},m(e,s){i(e,t,s),o(t,a),o(a,d),o(d,v),o(a,g),o(a,_),o(_,$),o(t,w),o(t,I),y(V,I,null),o(t,O),o(t,q),x&&x.m(q,null),T=!0},p(e,[t]){e[5]&&x.p(e,t)},i(e){T||(b(V.$$.fragment,e),T=!0)},o(e){k(V.$$.fragment,e),T=!1},d(e){e&&r(t),j(V),x&&x.d()}}}function ie(e,t=2){let a=e;for(let s=0;s<t-e.length;s++)a="0"+a;return a}function oe(e,t,a){let{prediction:s}=t;let l=s.kp,n=s.time.getDate()+". "+["January","February","March","April","May","June","July","August","September","October","November","December"][s.time.getMonth()],r=ie(s.time.getHours().toString())+":"+ie(s.time.getMinutes().toString()),c=s.temp,i=s.clouds,o=s.hasNOMETData;return e.$$set=e=>{"prediction"in e&&a(6,s=e.prediction)},[l,n,r,c,i,o,s]}class ue extends e{constructor(e){super(),t(this,e,oe,ce,a,{prediction:6})}}function de(e,t,a){const s=e.slice();return s[5]=t[a],s[7]=a,s}function he(e){let t,a;return t=new ue({props:{prediction:e[5]}}),{c(){E(t.$$.fragment)},l(e){D(t.$$.fragment,e)},m(e,s){y(t,e,s),a=!0},p(e,a){const s={};1&a&&(s.prediction=e[5]),t.$set(s)},i(e){a||(b(t.$$.fragment,e),a=!0)},o(e){k(t.$$.fragment,e),a=!1},d(e){j(t,e)}}}function fe(e){let t,a,o=e[0],u=[];for(let t=0;t<o.length;t+=1)u[t]=he(de(e,o,t));const d=e=>k(u[e],1,1,(()=>{u[e]=null}));return{c(){t=s("div");for(let e=0;e<u.length;e+=1)u[e].c();this.h()},l(e){t=l(e,"DIV",{class:!0});var a=n(t);for(let e=0;e<u.length;e+=1)u[e].l(a);a.forEach(r),this.h()},h(){c(t,"class","prediction-table svelte-1uc0m3l")},m(e,s){i(e,t,s);for(let e=0;e<u.length;e+=1)u[e].m(t,null);a=!0},p(e,[a]){if(1&a){let s;for(o=e[0],s=0;s<o.length;s+=1){const l=de(e,o,s);u[s]?(u[s].p(l,a),b(u[s],1)):(u[s]=he(l),u[s].c(),b(u[s],1),u[s].m(t,null))}for(_(),s=o.length;s<u.length;s+=1)d(s);$()}},i(e){if(!a){for(let e=0;e<o.length;e+=1)b(u[e]);a=!0}},o(e){u=u.filter(Boolean);for(let e=0;e<u.length;e+=1)k(u[e]);a=!1},d(e){e&&r(t),x(u,e)}}}function pe(e,t,a){let s,l,n;async function r(){if(l.updating||s.updating)return void a(0,n=null);let e=l.usnoaa_data_raw.geospace_pred_est_kp_1_hour.filter((e=>e.model_prediction_time>=new Date));a(0,n=e.map((e=>({time:e.model_prediction_time,kp:Math.round(e.k),temp:null,clouds:null,hasNOMETData:s.available})))),s.available&&n.forEach(((e,t)=>{let l,r,c=new Date(0,0,0),i=!0;s.yr_data_raw.properties.timeseries.forEach(((t,a)=>{let s=new Date(t.time);if(Math.abs(s.getTime()-e.time.getTime())<Math.abs(c.getTime()-e.time.getTime())){if(Math.abs(s.getTime()-e.time.getTime())>18e6)return void(i=!1);c=s,l=t.data.instant.details.air_temperature,r=t.data.instant.details.cloud_area_fraction}})),a(0,n[t]=Object.assign(Object.assign({},n[t]),{temp:l,clouds:r,hasNOMETData:i}),n)}))}return w(e,J,(e=>a(1,s=e))),w(e,K,(e=>a(2,l=e))),K.subscribe(r),J.subscribe(r),[n]}class me extends e{constructor(e){super(),t(this,e,pe,fe,a,{})}}function ve(e){let t,a,o;return a=new se({props:{$$slots:{default:[ge]},$$scope:{ctx:e}}}),{c(){t=s("div"),E(a.$$.fragment),this.h()},l(e){t=l(e,"DIV",{class:!0});var s=n(t);D(a.$$.fragment,s),s.forEach(r),this.h()},h(){c(t,"class","svelte-m9qkku")},m(e,s){i(e,t,s),y(a,t,null),o=!0},p(e,t){const s={};257&t&&(s.$$scope={dirty:t,ctx:e}),a.$set(s)},i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){k(a.$$.fragment,e),o=!1},d(e){e&&r(t),j(a)}}}function ge(e){let t,a=e[0].observed+"";return{c(){t=f(a)},l(e){t=m(e,a)},m(e,a){i(e,t,a)},p(e,s){1&s&&a!==(a=e[0].observed+"")&&v(t,a)},d(e){e&&r(t)}}}function _e(e){let t,a,d,v,g,w,I,V,O,q,T,x,M,P,S="predicted"!=e[0].observed&&ve(e);T=new re({props:{percentage:e[1]/9,value:e[1]}});let N=e[6]&&function(e){let t,a,d,v,g,_,k,$,b,w,E,D,y=Math.round(e[4])+"",j=Math.round(e[5])+"";return{c(){t=s("div"),a=s("p"),d=s("i"),v=h(),g=f(y),_=f("°C"),k=h(),$=s("p"),b=s("i"),w=h(),E=f(j),D=f("%"),this.h()},l(e){t=l(e,"DIV",{class:!0});var s=n(t);a=l(s,"P",{class:!0});var c=n(a);d=l(c,"I",{class:!0}),n(d).forEach(r),v=p(c),g=m(c,y),_=m(c,"°C"),c.forEach(r),k=p(s),$=l(s,"P",{class:!0});var i=n($);b=l(i,"I",{class:!0}),n(b).forEach(r),w=p(i),E=m(i,j),D=m(i,"%"),i.forEach(r),s.forEach(r),this.h()},h(){c(d,"class","fas fa-thermometer-half svelte-m9qkku"),c(a,"class","svelte-m9qkku"),c(b,"class","fas fa-cloud svelte-m9qkku"),c($,"class","svelte-m9qkku"),c(t,"class","svelte-m9qkku")},m(e,s){i(e,t,s),o(t,a),o(a,d),o(a,v),o(a,g),o(a,_),o(t,k),o(t,$),o($,b),o($,w),o($,E),o($,D)},p:u,d(e){e&&r(t)}}}(e);return{c(){t=s("div"),a=s("div"),d=s("h3"),v=f(e[3]),g=h(),w=s("p"),I=f(e[2]),V=h(),S&&S.c(),O=h(),q=s("div"),E(T.$$.fragment),x=h(),M=s("div"),N&&N.c(),this.h()},l(s){t=l(s,"DIV",{class:!0});var c=n(t);a=l(c,"DIV",{class:!0});var i=n(a);d=l(i,"H3",{class:!0});var o=n(d);v=m(o,e[3]),o.forEach(r),g=p(i),w=l(i,"P",{class:!0});var u=n(w);I=m(u,e[2]),u.forEach(r),i.forEach(r),V=p(c),S&&S.l(c),O=p(c),q=l(c,"DIV",{class:!0});var h=n(q);D(T.$$.fragment,h),h.forEach(r),x=p(c),M=l(c,"DIV",{class:!0});var f=n(M);N&&N.l(f),f.forEach(r),c.forEach(r),this.h()},h(){c(d,"class","svelte-m9qkku"),c(w,"class","svelte-m9qkku"),c(a,"class","svelte-m9qkku"),c(q,"class","KP svelte-m9qkku"),c(M,"class","data svelte-m9qkku"),c(t,"class","prediction-details svelte-m9qkku")},m(e,s){i(e,t,s),o(t,a),o(a,d),o(d,v),o(a,g),o(a,w),o(w,I),o(t,V),S&&S.m(t,null),o(t,O),o(t,q),y(T,q,null),o(t,x),o(t,M),N&&N.m(M,null),P=!0},p(e,[a]){"predicted"!=e[0].observed?S?(S.p(e,a),1&a&&b(S,1)):(S=ve(e),S.c(),b(S,1),S.m(t,O)):S&&(_(),k(S,1,1,(()=>{S=null})),$()),e[6]&&N.p(e,a)},i(e){P||(b(S),b(T.$$.fragment,e),P=!0)},o(e){k(S),k(T.$$.fragment,e),P=!1},d(e){e&&r(t),S&&S.d(),j(T),N&&N.d()}}}function ke(e,t=2){let a=e;for(let s=0;s<t-e.length;s++)a="0"+a;return a}function $e(e,t,a){let{prediction:s}=t;let l=s.kp,n=s.time.getDate()+". "+["January","February","March","April","May","June","July","August","September","October","November","December"][s.time.getMonth()],r=ke(s.time.getHours().toString())+":"+ke(s.time.getMinutes().toString()),c=s.temp,i=s.clouds,o=s.hasNOMETData;return e.$$set=e=>{"prediction"in e&&a(0,s=e.prediction)},[s,l,n,r,c,i,o]}class be extends e{constructor(e){super(),t(this,e,$e,_e,a,{prediction:0})}}function we(e,t,a){const s=e.slice();return s[5]=t[a],s[7]=a,s}function Ee(e){let t,a;return t=new be({props:{prediction:e[5]}}),{c(){E(t.$$.fragment)},l(e){D(t.$$.fragment,e)},m(e,s){y(t,e,s),a=!0},p(e,a){const s={};1&a&&(s.prediction=e[5]),t.$set(s)},i(e){a||(b(t.$$.fragment,e),a=!0)},o(e){k(t.$$.fragment,e),a=!1},d(e){j(t,e)}}}function De(e){let t,a,o=e[0],u=[];for(let t=0;t<o.length;t+=1)u[t]=Ee(we(e,o,t));const d=e=>k(u[e],1,1,(()=>{u[e]=null}));return{c(){t=s("div");for(let e=0;e<u.length;e+=1)u[e].c();this.h()},l(e){t=l(e,"DIV",{class:!0});var a=n(t);for(let e=0;e<u.length;e+=1)u[e].l(a);a.forEach(r),this.h()},h(){c(t,"class","prediction-table svelte-1uc0m3l")},m(e,s){i(e,t,s);for(let e=0;e<u.length;e+=1)u[e].m(t,null);a=!0},p(e,[a]){if(1&a){let s;for(o=e[0],s=0;s<o.length;s+=1){const l=we(e,o,s);u[s]?(u[s].p(l,a),b(u[s],1)):(u[s]=Ee(l),u[s].c(),b(u[s],1),u[s].m(t,null))}for(_(),s=o.length;s<u.length;s+=1)d(s);$()}},i(e){if(!a){for(let e=0;e<o.length;e+=1)b(u[e]);a=!0}},o(e){u=u.filter(Boolean);for(let e=0;e<u.length;e+=1)k(u[e]);a=!1},d(e){e&&r(t),x(u,e)}}}function ye(e,t,a){let s,l,n;async function r(){if(l.updating||s.updating)return void a(0,n=null);let e=l.usnoaa_data_raw.noaa_planetary_k_index_forecast.filter((e=>"observed"!==e.observed));a(0,n=e.map((e=>({time:e.time,kp:e.kp,observed:e.observed,temp:null,clouds:null,hasNOMETData:s.available})))),s.available&&n.forEach(((e,t)=>{let l,r,c=new Date(0,0,0);s.yr_data_raw.properties.timeseries.forEach(((t,a)=>{let s=new Date(t.time);Math.abs(s.getTime()-e.time.getTime())<Math.abs(c.getTime()-e.time.getTime())&&(c=s,l=t.data.instant.details.air_temperature,r=t.data.instant.details.cloud_area_fraction)})),a(0,n[t]=Object.assign(Object.assign({},n[t]),{temp:l,clouds:r}),n)}))}return w(e,J,(e=>a(1,s=e))),w(e,K,(e=>a(2,l=e))),K.subscribe(r),J.subscribe(r),[n]}class je extends e{constructor(e){super(),t(this,e,ye,De,a,{})}}function Ie(e){let t,a,u,d,v,g,_,$,w,I;return _=new re({props:{percentage:e[0]/9,value:e[0]}}),{c(){t=s("div"),a=s("div"),u=s("h3"),d=f(e[1]),v=h(),g=s("div"),E(_.$$.fragment),$=h(),w=s("div"),this.h()},l(s){t=l(s,"DIV",{class:!0});var c=n(t);a=l(c,"DIV",{class:!0});var i=n(a);u=l(i,"H3",{class:!0});var o=n(u);d=m(o,e[1]),o.forEach(r),i.forEach(r),v=p(c),g=l(c,"DIV",{class:!0});var h=n(g);D(_.$$.fragment,h),h.forEach(r),$=p(c),w=l(c,"DIV",{class:!0}),n(w).forEach(r),c.forEach(r),this.h()},h(){c(u,"class","svelte-m9qkku"),c(a,"class","svelte-m9qkku"),c(g,"class","KP svelte-m9qkku"),c(w,"class","data svelte-m9qkku"),c(t,"class","prediction-details svelte-m9qkku")},m(e,s){i(e,t,s),o(t,a),o(a,u),o(u,d),o(t,v),o(t,g),y(_,g,null),o(t,$),o(t,w),I=!0},p(e,[t]){},i(e){I||(b(_.$$.fragment,e),I=!0)},o(e){k(_.$$.fragment,e),I=!1},d(e){e&&r(t),j(_)}}}function Ve(e,t=2){let a=e;for(let s=0;s<t-e.length;s++)a="0"+a;return a}function Oe(e,t,a){let{prediction:s}=t;let l=s.kp,n=s.time.getDate()+". "+["January","February","March","April","May","June","July","August","September","October","November","December"][s.time.getMonth()];Ve(s.time.getHours().toString()),Ve(s.time.getMinutes().toString());let r=s.temp,c=s.clouds;return e.$$set=e=>{"prediction"in e&&a(4,s=e.prediction)},[l,n,r,c,s]}class qe extends e{constructor(e){super(),t(this,e,Oe,Ie,a,{prediction:4})}}function Te(e,t,a){const s=e.slice();return s[5]=t[a],s[7]=a,s}function xe(e){let t,a;return t=new qe({props:{prediction:e[5]}}),{c(){E(t.$$.fragment)},l(e){D(t.$$.fragment,e)},m(e,s){y(t,e,s),a=!0},p(e,a){const s={};1&a&&(s.prediction=e[5]),t.$set(s)},i(e){a||(b(t.$$.fragment,e),a=!0)},o(e){k(t.$$.fragment,e),a=!1},d(e){j(t,e)}}}function Me(e){let t,a,o=e[0],u=[];for(let t=0;t<o.length;t+=1)u[t]=xe(Te(e,o,t));const d=e=>k(u[e],1,1,(()=>{u[e]=null}));return{c(){t=s("div");for(let e=0;e<u.length;e+=1)u[e].c();this.h()},l(e){t=l(e,"DIV",{class:!0});var a=n(t);for(let e=0;e<u.length;e+=1)u[e].l(a);a.forEach(r),this.h()},h(){c(t,"class","prediction-table svelte-1uc0m3l")},m(e,s){i(e,t,s);for(let e=0;e<u.length;e+=1)u[e].m(t,null);a=!0},p(e,[a]){if(1&a){let s;for(o=e[0],s=0;s<o.length;s+=1){const l=Te(e,o,s);u[s]?(u[s].p(l,a),b(u[s],1)):(u[s]=xe(l),u[s].c(),b(u[s],1),u[s].m(t,null))}for(_(),s=o.length;s<u.length;s+=1)d(s);$()}},i(e){if(!a){for(let e=0;e<o.length;e+=1)b(u[e]);a=!0}},o(e){u=u.filter(Boolean);for(let e=0;e<u.length;e+=1)k(u[e]);a=!1},d(e){e&&r(t),x(u,e)}}}function Pe(e,t,a){let s,l,n;async function r(){if(l.updating||s.updating)return void a(0,n=null);let e=l.usnoaa_data_raw.outlook_27_day.filter((e=>e.time>=new Date));a(0,n=e.map((e=>({time:e.time,kp:e.kindex,temp:null,clouds:null,hasNOMETData:s.available})))),s.available&&n.forEach(((e,t)=>{let l,r,c=new Date(0,0,0),i=!0;s.yr_data_raw.properties.timeseries.forEach(((t,a)=>{let s=new Date(t.time);if(Math.abs(s.getTime()-e.time.getTime())<Math.abs(c.getTime()-e.time.getTime())){if(Math.abs(s.getTime()-e.time.getTime())>864e5)return void(i=!1);c=s,l=t.data.instant.details.air_temperature,r=t.data.instant.details.cloud_area_fraction}})),a(0,n[t]=Object.assign(Object.assign({},n[t]),{temp:l,clouds:r,hasNOMETData:i}),n)}))}return w(e,J,(e=>a(1,s=e))),w(e,K,(e=>a(2,l=e))),K.subscribe(r),J.subscribe(r),[n]}class Se extends e{constructor(e){super(),t(this,e,Pe,Me,a,{})}}function Ne(e){let t,a,d,v,g;return{c(){t=s("div"),a=s("i"),d=h(),v=s("p"),g=f("No prediction data"),this.h()},l(e){t=l(e,"DIV",{class:!0});var s=n(t);a=l(s,"I",{class:!0}),n(a).forEach(r),d=p(s),v=l(s,"P",{});var c=n(v);g=m(c,"No prediction data"),c.forEach(r),s.forEach(r),this.h()},h(){c(a,"class","fas fa-7x fa-exclamation-triangle"),c(t,"class","no-data svelte-5bytj")},m(e,s){i(e,t,s),o(t,a),o(t,d),o(t,v),o(v,g)},p:u,i:u,o:u,d(e){e&&r(t)}}}function Ce(e){let t,a,u,d,v,w,I,V,O,q,T,x,N,C,A,B,H,J,K;var z=e[0];return z&&(A=new z({})),{c(){t=s("div"),a=s("h2"),u=f("Forecast"),d=h(),v=s("div"),w=s("div"),I=f("hour"),V=h(),O=s("div"),q=f("3 day"),T=h(),x=s("div"),N=f("Long time"),C=h(),A&&E(A.$$.fragment),B=g(),this.h()},l(e){t=l(e,"DIV",{class:!0});var s=n(t);a=l(s,"H2",{class:!0});var c=n(a);u=m(c,"Forecast"),c.forEach(r),d=p(s),v=l(s,"DIV",{class:!0});var i=n(v);w=l(i,"DIV",{class:!0});var o=n(w);I=m(o,"hour"),o.forEach(r),V=p(i),O=l(i,"DIV",{class:!0});var h=n(O);q=m(h,"3 day"),h.forEach(r),T=p(i),x=l(i,"DIV",{class:!0});var f=n(x);N=m(f,"Long time"),f.forEach(r),i.forEach(r),s.forEach(r),C=p(e),A&&D(A.$$.fragment,e),B=g(),this.h()},h(){c(a,"class","svelte-5bytj"),c(w,"class","svelte-5bytj"),M(w,"selected",e[0]==me),c(O,"class","svelte-5bytj"),M(O,"selected",e[0]==je),c(x,"class","svelte-5bytj"),M(x,"selected",e[0]==Se),c(v,"class","version-picker svelte-5bytj"),c(t,"class","header svelte-5bytj")},m(s,l){i(s,t,l),o(t,a),o(a,u),o(t,d),o(t,v),o(v,w),o(w,I),o(v,V),o(v,O),o(O,q),o(v,T),o(v,x),o(x,N),i(s,C,l),A&&y(A,s,l),i(s,B,l),H=!0,J||(K=[P(w,"click",e[3]),P(O,"click",e[4]),P(x,"click",e[5])],J=!0)},p(e,t){if(1&t&&M(w,"selected",e[0]==me),1&t&&M(O,"selected",e[0]==je),1&t&&M(x,"selected",e[0]==Se),z!==(z=e[0])){if(A){_();const e=A;k(e.$$.fragment,1,0,(()=>{j(e,1)})),$()}z?(A=new z({}),E(A.$$.fragment),b(A.$$.fragment,1),y(A,B.parentNode,B)):A=null}},i(e){H||(A&&b(A.$$.fragment,e),H=!0)},o(e){A&&k(A.$$.fragment,e),H=!1},d(e){e&&r(t),e&&r(C),e&&r(B),A&&j(A,e),J=!1,S(K)}}}function Ae(e){let t,a,o,u;const d=[Ce,Ne],h=[];function f(e,t){return e[1].updating||e[2].updating?1:0}return a=f(e),o=h[a]=d[a](e),{c(){t=s("div"),o.c(),this.h()},l(e){t=l(e,"DIV",{class:!0});var a=n(t);o.l(a),a.forEach(r),this.h()},h(){c(t,"class","drawer svelte-5bytj")},m(e,s){i(e,t,s),h[a].m(t,null),u=!0},p(e,[s]){let l=a;a=f(e),a===l?h[a].p(e,s):(_(),k(h[l],1,1,(()=>{h[l]=null})),$(),o=h[a],o?o.p(e,s):(o=h[a]=d[a](e),o.c()),b(o,1),o.m(t,null))},i(e){u||(b(o),u=!0)},o(e){k(o),u=!1},d(e){e&&r(t),h[a].d()}}}function Be(e,t,a){let s,l;w(e,J,(e=>a(1,s=e))),w(e,K,(e=>a(2,l=e)));let n=je;return[n,s,l,()=>a(0,n=me),()=>a(0,n=je),()=>a(0,n=Se)]}class He extends e{constructor(e){super(),t(this,e,Be,Ae,a,{})}}function Je(e){let t,a,d,f,m,v;return d=new ee({}),m=new He({}),{c(){t=h(),a=s("div"),E(d.$$.fragment),f=h(),E(m.$$.fragment),this.h()},l(e){N('[data-svelte="svelte-1q3846k"]',document.head).forEach(r),t=p(e),a=l(e,"DIV",{class:!0});var s=n(a);D(d.$$.fragment,s),f=p(s),D(m.$$.fragment,s),s.forEach(r),this.h()},h(){document.title="Aurora data",c(a,"class","homescreen svelte-pf4p6y")},m(e,s){i(e,t,s),i(e,a,s),y(d,a,null),o(a,f),y(m,a,null),v=!0},p:u,i(e){v||(b(d.$$.fragment,e),b(m.$$.fragment,e),v=!0)},o(e){k(d.$$.fragment,e),k(m.$$.fragment,e),v=!1},d(e){e&&r(t),e&&r(a),j(d),j(m)}}}class Ke extends e{constructor(e){super(),t(this,e,null,Je,a,{})}}export{Ke as default};