diff options
author | jakobst1n <undefined> | 2022-05-02 23:07:42 +0200 |
---|---|---|
committer | jakobst1n <undefined> | 2022-05-02 23:07:42 +0200 |
commit | dc6f9f735a8d8fb5d68f35686b96174af3653d85 (patch) | |
tree | 329c5c201bf907e5f79a14e250ef2ba534a8e872 /client/index.1b1af70b.js | |
parent | a5ea1c2dfa550be03f7ce5e5a86467a3ddbe8d90 (diff) | |
download | Aurora-data-dc6f9f735a8d8fb5d68f35686b96174af3653d85.tar.gz Aurora-data-dc6f9f735a8d8fb5d68f35686b96174af3653d85.zip |
Updates
Diffstat (limited to 'client/index.1b1af70b.js')
-rw-r--r-- | client/index.1b1af70b.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/client/index.1b1af70b.js b/client/index.1b1af70b.js new file mode 100644 index 0000000..30c9fc8 --- /dev/null +++ b/client/index.1b1af70b.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,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(/^(?<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:H(e.groups.time)}))),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=H(e[0]);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}();L.update((t=>Object.assign(Object.assign({},t),e))),R(L,!1)}();const G=(e,t)=>{"undefined"!=typeof window&&localStorage.setItem(e,JSON.stringify(t))};function R(e,t=!1){let a=t?{}:{updated:new Date};e.update((e=>Object.assign(Object.assign(Object.assign({},e),a),{updating:t})))}function Q(e){let t,a,o;function u(e,t){return void 0!==e[0].city?W:U}let d=u(e),h=d(e);return{c(){t=s("i"),a=f(),h.c(),o=p(),this.h()},l(e){t=l(e,"I",{class:!0}),n(t).forEach(r),a=m(e),h.l(e),o=p(),this.h()},h(){c(t,"class","symbol fas fa-map-marker-alt svelte-9kdo4s")},m(e,s){i(e,t,s),i(e,a,s),h.m(e,s),i(e,o,s)},p(e,t){d===(d=u(e))&&h?h.p(e,t):(h.d(1),h=d(e),h&&(h.c(),h.m(o.parentNode,o)))},d(e){e&&r(t),e&&r(a),h.d(e),e&&r(o)}}}function U(e){let t,a,u,d,h,f,p=e[0].longitude+"",m=e[0].latitude+"";return{c(){t=s("h1"),a=g("long: "),u=g(p),d=s("br"),h=g("lat: "),f=g(m),this.h()},l(e){t=l(e,"H1",{class:!0});var s=n(t);a=v(s,"long: "),u=v(s,p),d=l(s,"BR",{}),h=v(s,"lat: "),f=v(s,m),s.forEach(r),this.h()},h(){c(t,"class","svelte-9kdo4s")},m(e,s){i(e,t,s),o(t,a),o(t,u),o(t,d),o(t,h),o(t,f)},p(e,t){1&t&&p!==(p=e[0].longitude+"")&&_(u,p),1&t&&m!==(m=e[0].latitude+"")&&_(f,m)},d(e){e&&r(t)}}}function W(e){let t,a,u=e[0].city+"";return{c(){t=s("h1"),a=g(u),this.h()},l(e){t=l(e,"H1",{class:!0});var s=n(t);a=v(s,u),s.forEach(r),this.h()},h(){c(t,"class","svelte-9kdo4s")},m(e,s){i(e,t,s),o(t,a)},p(e,t){1&t&&u!==(u=e[0].city+"")&&_(a,u)},d(e){e&&r(t)}}}function X(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?ee:Y}let l=s(e,-1),n=l(e);return{c(){n.c(),a=p()},l(e){n.l(e),a=p()},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 Y(e){let t,a,c=e[1].updated.toLocaleString("no-NO",{dateStyle:"medium",timeStyle:"short"})+"";return{c(){t=s("p"),a=g(c)},l(e){t=l(e,"P",{});var s=n(t);a=v(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"})+"")&&_(a,c)},d(e){e&&r(t)}}}function ee(e){let t,a;return{c(){t=s("p"),a=g("There is more than 10 minutes difference between data updates")},l(e){t=l(e,"P",{});var s=n(t);a=v(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 te(e){let t,a,d,h,p,k,b,$,w,E,D,y,I=e[2].now.kp+"",V=e[2].now.kp_max+"",j=e[2].now.kp_min+"";return{c(){t=s("h2"),a=g("KP "),d=g(I),h=f(),p=s("p"),k=s("span"),b=g("↑ KP "),$=g(V),w=f(),E=s("span"),D=g("↓ KP "),y=g(j),this.h()},l(e){t=l(e,"H2",{class:!0});var s=n(t);a=v(s,"KP "),d=v(s,I),s.forEach(r),h=m(e),p=l(e,"P",{});var c=n(p);k=l(c,"SPAN",{classname:!0});var i=n(k);b=v(i,"↑ KP "),$=v(i,V),i.forEach(r),w=m(c),E=l(c,"SPAN",{classname:!0});var o=n(E);D=v(o,"↓ KP "),y=v(o,j),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,h,s),i(e,p,s),o(p,k),o(k,b),o(k,$),o(p,w),o(p,E),o(E,D),o(E,y)},p(e,t){4&t&&I!==(I=e[2].now.kp+"")&&_(d,I),4&t&&V!==(V=e[2].now.kp_max+"")&&_($,V),4&t&&j!==(j=e[2].now.kp_min+"")&&_(y,j)},i:u,o:u,d(e){e&&r(t),e&&r(h),e&&r(p)}}}function ae(e){let t,a;return t=new J({}),{c(){D(t.$$.fragment)},l(e){y(t.$$.fragment,e)},m(e,s){I(t,e,s),a=!0},p:u,i(e){a||(w(t.$$.fragment,e),a=!0)},o(e){b(t.$$.fragment,e),a=!1},d(e){V(t,e)}}}function se(e){let t,a,u,d,h,k,b,$,w,E,D,y,I,V,j,O=e[2].now.bz+"",q=e[2].now.bt+"",T=e[1].available&&le(e);return{c(){t=s("div"),a=s("p"),u=g("BZ"),d=f(),h=s("p"),k=g(O),b=f(),$=s("div"),w=s("p"),E=g("BT"),D=f(),y=s("p"),I=g(q),V=f(),T&&T.c(),j=p(),this.h()},l(e){t=l(e,"DIV",{});var s=n(t);a=l(s,"P",{class:!0});var c=n(a);u=v(c,"BZ"),c.forEach(r),d=m(s),h=l(s,"P",{class:!0});var i=n(h);k=v(i,O),i.forEach(r),s.forEach(r),b=m(e),$=l(e,"DIV",{});var o=n($);w=l(o,"P",{class:!0});var f=n(w);E=v(f,"BT"),f.forEach(r),D=m(o),y=l(o,"P",{class:!0});var g=n(y);I=v(g,q),g.forEach(r),o.forEach(r),V=m(e),T&&T.l(e),j=p(),this.h()},h(){c(a,"class","svelte-9kdo4s"),c(h,"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,h),o(h,k),i(e,b,s),i(e,$,s),o($,w),o(w,E),o($,D),o($,y),o(y,I),i(e,V,s),T&&T.m(e,s),i(e,j,s)},p(e,t){4&t&&O!==(O=e[2].now.bz+"")&&_(k,O),4&t&&q!==(q=e[2].now.bt+"")&&_(I,q),e[1].available?T?T.p(e,t):(T=le(e),T.c(),T.m(j.parentNode,j)):T&&(T.d(1),T=null)},d(e){e&&r(t),e&&r(b),e&&r($),e&&r(V),T&&T.d(e),e&&r(j)}}}function le(e){let t,a,u,d,h,p,k,b,$,w,E,D,y,I,V,j=e[1].now.temp+"",O=e[1].now.clouds+"";return{c(){t=s("div"),a=s("p"),u=g("Temp"),d=f(),h=s("p"),p=g(j),k=g("°C"),b=f(),$=s("div"),w=s("p"),E=g("Clouds"),D=f(),y=s("p"),I=g(O),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=v(c,"Temp"),c.forEach(r),d=m(s),h=l(s,"P",{class:!0});var i=n(h);p=v(i,j),k=v(i,"°C"),i.forEach(r),s.forEach(r),b=m(e),$=l(e,"DIV",{});var o=n($);w=l(o,"P",{class:!0});var f=n(w);E=v(f,"Clouds"),f.forEach(r),D=m(o),y=l(o,"P",{class:!0});var g=n(y);I=v(g,O),V=v(g,"%"),g.forEach(r),o.forEach(r),this.h()},h(){c(a,"class","svelte-9kdo4s"),c(h,"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,h),o(h,p),o(h,k),i(e,b,s),i(e,$,s),o($,w),o(w,E),o($,D),o($,y),o(y,I),o(y,V)},p(e,t){2&t&&j!==(j=e[1].now.temp+"")&&_(p,j),2&t&&O!==(O=e[1].now.clouds+"")&&_(I,O)},d(e){e&&r(t),e&&r(b),e&&r($)}}}function ne(e){let t,a,u,d,h,p,g,v,_,E,D,y,I=!e[0].updating&&e[0].available&&!e[1].updating&&!e[2].updating&&Q(e),V=!e[1].updating&&!e[2].updating&&X(e);const j=[ae,te],O=[];function q(e,t){return e[2].updating||e[1].updating?0:1}v=q(e),_=O[v]=j[v](e);let T=!e[2].updating&&!e[1].updating&&se(e);return{c(){t=s("div"),a=s("div"),u=s("div"),I&&I.c(),d=f(),h=s("div"),V&&V.c(),p=f(),g=s("div"),_.c(),E=f(),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);I&&I.l(i),i.forEach(r),d=m(c),h=l(c,"DIV",{class:!0});var o=n(h);V&&V.l(o),o.forEach(r),p=m(c),g=l(c,"DIV",{class:!0});var f=n(g);_.l(f),f.forEach(r),E=m(c),D=l(c,"DIV",{class:!0});var v=n(D);T&&T.l(v),v.forEach(r),c.forEach(r),s.forEach(r),this.h()},h(){c(u,"class","weatherCurrent-data-location svelte-9kdo4s"),c(h,"class","weatherCurrent-data-date"),c(g,"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),I&&I.m(u,null),o(a,d),o(a,h),V&&V.m(h,null),o(a,p),o(a,g),O[v].m(g,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?I&&(I.d(1),I=null):I?I.p(e,t):(I=Q(e),I.c(),I.m(u,null)),e[1].updating||e[2].updating?V&&(V.d(1),V=null):V?V.p(e,t):(V=X(e),V.c(),V.m(h,null));let a=v;v=q(e),v===a?O[v].p(e,t):(k(),b(O[a],1,1,(()=>{O[a]=null})),$(),_=O[v],_?_.p(e,t):(_=O[v]=j[v](e),_.c()),w(_,1),_.m(g,null)),e[2].updating||e[1].updating?T&&(T.d(1),T=null):T?T.p(e,t):(T=se(e),T.c(),T.m(D,null))},i(e){y||(w(_),y=!0)},o(e){b(_),y=!1},d(e){e&&r(t),I&&I.d(),V&&V.d(),O[v].d(),T&&T.d()}}}function re(e,t,a){let s,l,n;return E(e,F,(e=>a(0,s=e))),E(e,Z,(e=>a(1,l=e))),E(e,L,(e=>a(2,n=e))),[s,l,n]}F.subscribe((e=>G("navigator_location",e))),Z.subscribe((e=>G("earth_weather",e))),L.subscribe((e=>G("space_weather",e)));class ce extends e{constructor(e){super(),t(this,e,re,ne,a,{})}}function ie(e){let t,a;const o=e[1].default,u=j(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)&&O(u,o,e,e[0],a?T(o,e[0],t,null):q(e[0]),null)},i(e){a||(w(u,e),a=!0)},o(e){b(u,e),a=!1},d(e){e&&r(t),u&&u.d(e)}}}function oe(e,t,a){let{$$slots:s={},$$scope:l}=t;return e.$$set=e=>{"$$scope"in e&&a(0,l=e.$$scope)},[l,s]}class ue extends e{constructor(e){super(),t(this,e,oe,ie,a,{})}}function de(e){let t,a,d,h,p,k;return{c(){t=s("div"),a=s("div"),d=s("div"),h=f(),p=s("span"),k=g(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),h=m(c),p=l(c,"SPAN",{class:!0});var o=n(p);k=v(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(p,"class","value svelte-1mo8cjf"),c(t,"class","wrapper svelte-1mo8cjf"),M(t,"--progress",100*e[0]+"%")},m(e,s){i(e,t,s),o(t,a),o(a,d),o(t,h),o(t,p),o(p,k)},p(e,[a]){2&a&&_(k,e[1]),1&a&&M(t,"--progress",100*e[0]+"%")},i:u,o:u,d(e){e&&r(t)}}}function he(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 fe extends e{constructor(e){super(),t(this,e,he,de,a,{percentage:0,value:1})}}function pe(e){let t,a,d,h,p,_,k,$,E,j,O,q,T;j=new fe({props:{percentage:e[0]/9,value:e[0]}});let M=e[5]&&function(e){let t,a,d,h,p,_,k,b,$,w,E,D,y=Math.round(e[3])+"",I=Math.round(e[4])+"";return{c(){t=s("div"),a=s("p"),d=s("i"),h=f(),p=g(y),_=g("°C"),k=f(),b=s("p"),$=s("i"),w=f(),E=g(I),D=g("%"),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),h=m(c),p=v(c,y),_=v(c,"°C"),c.forEach(r),k=m(s),b=l(s,"P",{class:!0});var i=n(b);$=l(i,"I",{class:!0}),n($).forEach(r),w=m(i),E=v(i,I),D=v(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($,"class","fas fa-cloud svelte-m9qkku"),c(b,"class","svelte-m9qkku"),c(t,"class","svelte-m9qkku")},m(e,s){i(e,t,s),o(t,a),o(a,d),o(a,h),o(a,p),o(a,_),o(t,k),o(t,b),o(b,$),o(b,w),o(b,E),o(b,D)},p:u,d(e){e&&r(t)}}}(e);return{c(){t=s("div"),a=s("div"),d=s("h3"),h=g(e[2]),p=f(),_=s("p"),k=g(e[1]),$=f(),E=s("div"),D(j.$$.fragment),O=f(),q=s("div"),M&&M.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);h=v(o,e[2]),o.forEach(r),p=m(i),_=l(i,"P",{class:!0});var u=n(_);k=v(u,e[1]),u.forEach(r),i.forEach(r),$=m(c),E=l(c,"DIV",{class:!0});var f=n(E);y(j.$$.fragment,f),f.forEach(r),O=m(c),q=l(c,"DIV",{class:!0});var g=n(q);M&&M.l(g),g.forEach(r),c.forEach(r),this.h()},h(){c(d,"class","svelte-m9qkku"),c(_,"class","svelte-m9qkku"),c(a,"class","svelte-m9qkku"),c(E,"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,h),o(a,p),o(a,_),o(_,k),o(t,$),o(t,E),I(j,E,null),o(t,O),o(t,q),M&&M.m(q,null),T=!0},p(e,[t]){e[5]&&M.p(e,t)},i(e){T||(w(j.$$.fragment,e),T=!0)},o(e){b(j.$$.fragment,e),T=!1},d(e){e&&r(t),V(j),M&&M.d()}}}function me(e,t=2){let a=e;for(let s=0;s<t-e.length;s++)a="0"+a;return a}function ge(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=me(s.time.getHours().toString())+":"+me(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 ve extends e{constructor(e){super(),t(this,e,ge,pe,a,{prediction:6})}}function _e(e,t,a){const s=e.slice();return s[5]=t[a],s[7]=a,s}function ke(e){let t,a;return t=new ve({props:{prediction:e[5]}}),{c(){D(t.$$.fragment)},l(e){y(t.$$.fragment,e)},m(e,s){I(t,e,s),a=!0},p(e,a){const s={};1&a&&(s.prediction=e[5]),t.$set(s)},i(e){a||(w(t.$$.fragment,e),a=!0)},o(e){b(t.$$.fragment,e),a=!1},d(e){V(t,e)}}}function be(e){let t,a,o=e[0],u=[];for(let t=0;t<o.length;t+=1)u[t]=ke(_e(e,o,t));const d=e=>b(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=_e(e,o,s);u[s]?(u[s].p(l,a),w(u[s],1)):(u[s]=ke(l),u[s].c(),w(u[s],1),u[s].m(t,null))}for(k(),s=o.length;s<u.length;s+=1)d(s);$()}},i(e){if(!a){for(let e=0;e<o.length;e+=1)w(u[e]);a=!0}},o(e){u=u.filter(Boolean);for(let e=0;e<u.length;e+=1)b(u[e]);a=!1},d(e){e&&r(t),x(u,e)}}}function $e(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 E(e,Z,(e=>a(1,s=e))),E(e,L,(e=>a(2,l=e))),L.subscribe(r),Z.subscribe(r),[n]}class we extends e{constructor(e){super(),t(this,e,$e,be,a,{})}}function Ee(e){let t,a,o;return a=new ue({props:{$$slots:{default:[De]},$$scope:{ctx:e}}}),{c(){t=s("div"),D(a.$$.fragment),this.h()},l(e){t=l(e,"DIV",{class:!0});var s=n(t);y(a.$$.fragment,s),s.forEach(r),this.h()},h(){c(t,"class","svelte-m9qkku")},m(e,s){i(e,t,s),I(a,t,null),o=!0},p(e,t){const s={};257&t&&(s.$$scope={dirty:t,ctx:e}),a.$set(s)},i(e){o||(w(a.$$.fragment,e),o=!0)},o(e){b(a.$$.fragment,e),o=!1},d(e){e&&r(t),V(a)}}}function De(e){let t,a=e[0].observed+"";return{c(){t=g(a)},l(e){t=v(e,a)},m(e,a){i(e,t,a)},p(e,s){1&s&&a!==(a=e[0].observed+"")&&_(t,a)},d(e){e&&r(t)}}}function ye(e){let t,a,d,h,p,_,E,j,O,q,T,M,x,P,S="predicted"!=e[0].observed&&Ee(e);T=new fe({props:{percentage:e[1]/9,value:e[1]}});let N=e[6]&&function(e){let t,a,d,h,p,_,k,b,$,w,E,D,y=Math.round(e[4])+"",I=Math.round(e[5])+"";return{c(){t=s("div"),a=s("p"),d=s("i"),h=f(),p=g(y),_=g("°C"),k=f(),b=s("p"),$=s("i"),w=f(),E=g(I),D=g("%"),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),h=m(c),p=v(c,y),_=v(c,"°C"),c.forEach(r),k=m(s),b=l(s,"P",{class:!0});var i=n(b);$=l(i,"I",{class:!0}),n($).forEach(r),w=m(i),E=v(i,I),D=v(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($,"class","fas fa-cloud svelte-m9qkku"),c(b,"class","svelte-m9qkku"),c(t,"class","svelte-m9qkku")},m(e,s){i(e,t,s),o(t,a),o(a,d),o(a,h),o(a,p),o(a,_),o(t,k),o(t,b),o(b,$),o(b,w),o(b,E),o(b,D)},p:u,d(e){e&&r(t)}}}(e);return{c(){t=s("div"),a=s("div"),d=s("h3"),h=g(e[3]),p=f(),_=s("p"),E=g(e[2]),j=f(),S&&S.c(),O=f(),q=s("div"),D(T.$$.fragment),M=f(),x=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);h=v(o,e[3]),o.forEach(r),p=m(i),_=l(i,"P",{class:!0});var u=n(_);E=v(u,e[2]),u.forEach(r),i.forEach(r),j=m(c),S&&S.l(c),O=m(c),q=l(c,"DIV",{class:!0});var f=n(q);y(T.$$.fragment,f),f.forEach(r),M=m(c),x=l(c,"DIV",{class:!0});var g=n(x);N&&N.l(g),g.forEach(r),c.forEach(r),this.h()},h(){c(d,"class","svelte-m9qkku"),c(_,"class","svelte-m9qkku"),c(a,"class","svelte-m9qkku"),c(q,"class","KP svelte-m9qkku"),c(x,"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,h),o(a,p),o(a,_),o(_,E),o(t,j),S&&S.m(t,null),o(t,O),o(t,q),I(T,q,null),o(t,M),o(t,x),N&&N.m(x,null),P=!0},p(e,[a]){"predicted"!=e[0].observed?S?(S.p(e,a),1&a&&w(S,1)):(S=Ee(e),S.c(),w(S,1),S.m(t,O)):S&&(k(),b(S,1,1,(()=>{S=null})),$()),e[6]&&N.p(e,a)},i(e){P||(w(S),w(T.$$.fragment,e),P=!0)},o(e){b(S),b(T.$$.fragment,e),P=!1},d(e){e&&r(t),S&&S.d(),V(T),N&&N.d()}}}function Ie(e,t=2){let a=e;for(let s=0;s<t-e.length;s++)a="0"+a;return a}function Ve(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(0,s=e.prediction)},[s,l,n,r,c,i,o]}class je extends e{constructor(e){super(),t(this,e,Ve,ye,a,{prediction:0})}}function Oe(e,t,a){const s=e.slice();return s[5]=t[a],s[7]=a,s}function qe(e){let t,a;return t=new je({props:{prediction:e[5]}}),{c(){D(t.$$.fragment)},l(e){y(t.$$.fragment,e)},m(e,s){I(t,e,s),a=!0},p(e,a){const s={};1&a&&(s.prediction=e[5]),t.$set(s)},i(e){a||(w(t.$$.fragment,e),a=!0)},o(e){b(t.$$.fragment,e),a=!1},d(e){V(t,e)}}}function Te(e){let t,a,o=e[0],u=[];for(let t=0;t<o.length;t+=1)u[t]=qe(Oe(e,o,t));const d=e=>b(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=Oe(e,o,s);u[s]?(u[s].p(l,a),w(u[s],1)):(u[s]=qe(l),u[s].c(),w(u[s],1),u[s].m(t,null))}for(k(),s=o.length;s<u.length;s+=1)d(s);$()}},i(e){if(!a){for(let e=0;e<o.length;e+=1)w(u[e]);a=!0}},o(e){u=u.filter(Boolean);for(let e=0;e<u.length;e+=1)b(u[e]);a=!1},d(e){e&&r(t),x(u,e)}}}function Me(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 E(e,Z,(e=>a(1,s=e))),E(e,L,(e=>a(2,l=e))),L.subscribe(r),Z.subscribe(r),[n]}class xe extends e{constructor(e){super(),t(this,e,Me,Te,a,{})}}function Pe(e){let t,a,u,d,h,p,_,k,$,E;return _=new fe({props:{percentage:e[0]/9,value:e[0]}}),{c(){t=s("div"),a=s("div"),u=s("h3"),d=g(e[1]),h=f(),p=s("div"),D(_.$$.fragment),k=f(),$=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=v(o,e[1]),o.forEach(r),i.forEach(r),h=m(c),p=l(c,"DIV",{class:!0});var f=n(p);y(_.$$.fragment,f),f.forEach(r),k=m(c),$=l(c,"DIV",{class:!0}),n($).forEach(r),c.forEach(r),this.h()},h(){c(u,"class","svelte-m9qkku"),c(a,"class","svelte-m9qkku"),c(p,"class","KP svelte-m9qkku"),c($,"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,h),o(t,p),I(_,p,null),o(t,k),o(t,$),E=!0},p(e,[t]){},i(e){E||(w(_.$$.fragment,e),E=!0)},o(e){b(_.$$.fragment,e),E=!1},d(e){e&&r(t),V(_)}}}function Se(e,t=2){let a=e;for(let s=0;s<t-e.length;s++)a="0"+a;return a}function Ne(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()];Se(s.time.getHours().toString()),Se(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 Ae extends e{constructor(e){super(),t(this,e,Ne,Pe,a,{prediction:4})}}function Ce(e,t,a){const s=e.slice();return s[5]=t[a],s[7]=a,s}function Je(e){let t,a;return t=new Ae({props:{prediction:e[5]}}),{c(){D(t.$$.fragment)},l(e){y(t.$$.fragment,e)},m(e,s){I(t,e,s),a=!0},p(e,a){const s={};1&a&&(s.prediction=e[5]),t.$set(s)},i(e){a||(w(t.$$.fragment,e),a=!0)},o(e){b(t.$$.fragment,e),a=!1},d(e){V(t,e)}}}function Be(e){let t,a,o=e[0],u=[];for(let t=0;t<o.length;t+=1)u[t]=Je(Ce(e,o,t));const d=e=>b(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=Ce(e,o,s);u[s]?(u[s].p(l,a),w(u[s],1)):(u[s]=Je(l),u[s].c(),w(u[s],1),u[s].m(t,null))}for(k(),s=o.length;s<u.length;s+=1)d(s);$()}},i(e){if(!a){for(let e=0;e<o.length;e+=1)w(u[e]);a=!0}},o(e){u=u.filter(Boolean);for(let e=0;e<u.length;e+=1)b(u[e]);a=!1},d(e){e&&r(t),x(u,e)}}}function He(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 E(e,Z,(e=>a(1,s=e))),E(e,L,(e=>a(2,l=e))),L.subscribe(r),Z.subscribe(r),[n]}class Ke extends e{constructor(e){super(),t(this,e,He,Be,a,{})}}function ze(e){let t,a,d,h,p;return{c(){t=s("div"),a=s("i"),d=f(),h=s("p"),p=g("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=m(s),h=l(s,"P",{});var c=n(h);p=v(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-11gsg4a")},m(e,s){i(e,t,s),o(t,a),o(t,d),o(t,h),o(h,p)},p:u,i:u,o:u,d(e){e&&r(t)}}}function Fe(e){let t,a,u,d,h,_,E,j,O,q,T,M,x,A,C,J,B,H,K;var z=e[0];return z&&(C=new z({})),{c(){t=s("div"),a=s("h2"),u=g("Forecast"),d=f(),h=s("div"),_=s("div"),E=g("hour"),j=f(),O=s("div"),q=g("3 day"),T=f(),M=s("div"),x=g("Longterm"),A=f(),C&&D(C.$$.fragment),J=p(),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=v(c,"Forecast"),c.forEach(r),d=m(s),h=l(s,"DIV",{class:!0});var i=n(h);_=l(i,"DIV",{class:!0});var o=n(_);E=v(o,"hour"),o.forEach(r),j=m(i),O=l(i,"DIV",{class:!0});var f=n(O);q=v(f,"3 day"),f.forEach(r),T=m(i),M=l(i,"DIV",{class:!0});var g=n(M);x=v(g,"Longterm"),g.forEach(r),i.forEach(r),s.forEach(r),A=m(e),C&&y(C.$$.fragment,e),J=p(),this.h()},h(){c(a,"class","svelte-11gsg4a"),c(_,"class","svelte-11gsg4a"),P(_,"selected",e[0]==we),c(O,"class","svelte-11gsg4a"),P(O,"selected",e[0]==xe),c(M,"class","svelte-11gsg4a"),P(M,"selected",e[0]==Ke),c(h,"class","version-picker svelte-11gsg4a"),c(t,"class","header svelte-11gsg4a")},m(s,l){i(s,t,l),o(t,a),o(a,u),o(t,d),o(t,h),o(h,_),o(_,E),o(h,j),o(h,O),o(O,q),o(h,T),o(h,M),o(M,x),i(s,A,l),C&&I(C,s,l),i(s,J,l),B=!0,H||(K=[S(_,"click",e[3]),S(O,"click",e[4]),S(M,"click",e[5])],H=!0)},p(e,t){if(1&t&&P(_,"selected",e[0]==we),1&t&&P(O,"selected",e[0]==xe),1&t&&P(M,"selected",e[0]==Ke),z!==(z=e[0])){if(C){k();const e=C;b(e.$$.fragment,1,0,(()=>{V(e,1)})),$()}z?(C=new z({}),D(C.$$.fragment),w(C.$$.fragment,1),I(C,J.parentNode,J)):C=null}},i(e){B||(C&&w(C.$$.fragment,e),B=!0)},o(e){C&&b(C.$$.fragment,e),B=!1},d(e){e&&r(t),e&&r(A),e&&r(J),C&&V(C,e),H=!1,N(K)}}}function Ze(e){let t,a,o,u;const d=[Fe,ze],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-11gsg4a")},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(),b(h[l],1,1,(()=>{h[l]=null})),$(),o=h[a],o?o.p(e,s):(o=h[a]=d[a](e),o.c()),w(o,1),o.m(t,null))},i(e){u||(w(o),u=!0)},o(e){b(o),u=!1},d(e){e&&r(t),h[a].d()}}}function Le(e,t,a){let s,l;E(e,Z,(e=>a(1,s=e))),E(e,L,(e=>a(2,l=e)));let n=xe;return[n,s,l,()=>a(0,n=we),()=>a(0,n=xe),()=>a(0,n=Ke)]}class Ge extends e{constructor(e){super(),t(this,e,Le,Ze,a,{})}}function Re(e){let t,a,d,h,p,g;return d=new ce({}),p=new Ge({}),{c(){t=f(),a=s("div"),D(d.$$.fragment),h=f(),D(p.$$.fragment),this.h()},l(e){A('[data-svelte="svelte-1q3846k"]',document.head).forEach(r),t=m(e),a=l(e,"DIV",{class:!0});var s=n(a);y(d.$$.fragment,s),h=m(s),y(p.$$.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),I(d,a,null),o(a,h),I(p,a,null),g=!0},p:u,i(e){g||(w(d.$$.fragment,e),w(p.$$.fragment,e),g=!0)},o(e){b(d.$$.fragment,e),b(p.$$.fragment,e),g=!1},d(e){e&&r(t),e&&r(a),V(d),V(p)}}}class Qe extends e{constructor(e){super(),t(this,e,null,Re,a,{})}}export{Qe as default}; |