-
Notifications
You must be signed in to change notification settings - Fork 13
/
bundle.js
2 lines (2 loc) · 19.1 KB
/
bundle.js
1
2
!function(){"use strict";var e=new Date,t=new Date;function n(r,o,a,u){function c(e){return r(e=0===arguments.length?new Date:new Date(+e)),e}return c.floor=function(e){return r(e=new Date(+e)),e},c.ceil=function(e){return r(e=new Date(e-1)),o(e,1),r(e),e},c.round=function(e){var t=c(e),n=c.ceil(e);return e-t<n-e?t:n},c.offset=function(e,t){return o(e=new Date(+e),null==t?1:Math.floor(t)),e},c.range=function(e,t,n){var a,u=[];if(e=c.ceil(e),n=null==n?1:Math.floor(n),!(e<t&&n>0))return u;do{u.push(a=new Date(+e)),o(e,n),r(e)}while(a<e&&e<t);return u},c.filter=function(e){return n((function(t){if(t>=t)for(;r(t),!e(t);)t.setTime(t-1)}),(function(t,n){if(t>=t)if(n<0)for(;++n<=0;)for(;o(t,-1),!e(t););else for(;--n>=0;)for(;o(t,1),!e(t););}))},a&&(c.count=function(n,o){return e.setTime(+n),t.setTime(+o),r(e),r(t),Math.floor(a(e,t))},c.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?c.filter(u?function(t){return u(t)%e==0}:function(t){return c.count(0,t)%e==0}):c:null}),c}const r=6e4,o=864e5,a=6048e5;var u=n((e=>e.setHours(0,0,0,0)),((e,t)=>e.setDate(e.getDate()+t)),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*r)/o),(e=>e.getDate()-1)),c=u;function i(e){return n((function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+7*t)}),(function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*r)/a}))}u.range;var s=i(0),l=i(1),g=i(2),f=i(3),d=i(4),m=i(5),h=i(6);s.range,l.range,g.range,f.range,d.range,m.range,h.range;var w=n((function(e){e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e,t){return t.getFullYear()-e.getFullYear()}),(function(e){return e.getFullYear()}));w.every=function(e){return isFinite(e=Math.floor(e))&&e>0?n((function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n*e)})):null};var y=w;w.range;var v=n((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/o}),(function(e){return e.getUTCDate()-1})),T=v;function p(e){return n((function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+7*t)}),(function(e,t){return(t-e)/a}))}v.range;var C=p(0),D=p(1),U=p(2),M=p(3),b=p(4),S=p(5),I=p(6);C.range,D.range,U.range,M.range,b.range,S.range,I.range;var x=n((function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()}));x.every=function(e){return isFinite(e=Math.floor(e))&&e>0?n((function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null};var E=x;function L(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function F(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Y(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}x.range;var _,A,H,$={"-":"",_:" ",0:"0"},O=/^\s*\d+/,k=/^%/,G=/[\\^$*+?|[\]().{}]/g;function B(e,t,n){var r=e<0?"-":"",o=(r?-e:e)+"",a=o.length;return r+(a<n?new Array(n-a+1).join(t)+o:o)}function j(e){return e.replace(G,"\\$&")}function N(e){return new RegExp("^(?:"+e.map(j).join("|")+")","i")}function R(e){return new Map(e.map(((e,t)=>[e.toLowerCase(),t])))}function Z(e,t,n){var r=O.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function P(e,t,n){var r=O.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function W(e,t,n){var r=O.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function V(e,t,n){var r=O.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function q(e,t,n){var r=O.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function J(e,t,n){var r=O.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Q(e,t,n){var r=O.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function X(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function z(e,t,n){var r=O.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function K(e,t,n){var r=O.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function ee(e,t,n){var r=O.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function te(e,t,n){var r=O.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function ne(e,t,n){var r=O.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function re(e,t,n){var r=O.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function oe(e,t,n){var r=O.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function ae(e,t,n){var r=O.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function ue(e,t,n){var r=O.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function ce(e,t,n){var r=k.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function ie(e,t,n){var r=O.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function se(e,t,n){var r=O.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function le(e,t){return B(e.getDate(),t,2)}function ge(e,t){return B(e.getHours(),t,2)}function fe(e,t){return B(e.getHours()%12||12,t,2)}function de(e,t){return B(1+c.count(y(e),e),t,3)}function me(e,t){return B(e.getMilliseconds(),t,3)}function he(e,t){return me(e,t)+"000"}function we(e,t){return B(e.getMonth()+1,t,2)}function ye(e,t){return B(e.getMinutes(),t,2)}function ve(e,t){return B(e.getSeconds(),t,2)}function Te(e){var t=e.getDay();return 0===t?7:t}function pe(e,t){return B(s.count(y(e)-1,e),t,2)}function Ce(e){var t=e.getDay();return t>=4||0===t?d(e):d.ceil(e)}function De(e,t){return e=Ce(e),B(d.count(y(e),e)+(4===y(e).getDay()),t,2)}function Ue(e){return e.getDay()}function Me(e,t){return B(l.count(y(e)-1,e),t,2)}function be(e,t){return B(e.getFullYear()%100,t,2)}function Se(e,t){return B((e=Ce(e)).getFullYear()%100,t,2)}function Ie(e,t){return B(e.getFullYear()%1e4,t,4)}function xe(e,t){var n=e.getDay();return B((e=n>=4||0===n?d(e):d.ceil(e)).getFullYear()%1e4,t,4)}function Ee(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+B(t/60|0,"0",2)+B(t%60,"0",2)}function Le(e,t){return B(e.getUTCDate(),t,2)}function Fe(e,t){return B(e.getUTCHours(),t,2)}function Ye(e,t){return B(e.getUTCHours()%12||12,t,2)}function _e(e,t){return B(1+T.count(E(e),e),t,3)}function Ae(e,t){return B(e.getUTCMilliseconds(),t,3)}function He(e,t){return Ae(e,t)+"000"}function $e(e,t){return B(e.getUTCMonth()+1,t,2)}function Oe(e,t){return B(e.getUTCMinutes(),t,2)}function ke(e,t){return B(e.getUTCSeconds(),t,2)}function Ge(e){var t=e.getUTCDay();return 0===t?7:t}function Be(e,t){return B(C.count(E(e)-1,e),t,2)}function je(e){var t=e.getUTCDay();return t>=4||0===t?b(e):b.ceil(e)}function Ne(e,t){return e=je(e),B(b.count(E(e),e)+(4===E(e).getUTCDay()),t,2)}function Re(e){return e.getUTCDay()}function Ze(e,t){return B(D.count(E(e)-1,e),t,2)}function Pe(e,t){return B(e.getUTCFullYear()%100,t,2)}function We(e,t){return B((e=je(e)).getUTCFullYear()%100,t,2)}function Ve(e,t){return B(e.getUTCFullYear()%1e4,t,4)}function qe(e,t){var n=e.getUTCDay();return B((e=n>=4||0===n?b(e):b.ceil(e)).getUTCFullYear()%1e4,t,4)}function Je(){return"+0000"}function Qe(){return"%"}function Xe(e){return+e}function ze(e){return Math.floor(+e/1e3)}_=function(e){var t=e.dateTime,n=e.date,r=e.time,o=e.periods,a=e.days,u=e.shortDays,i=e.months,s=e.shortMonths,g=N(o),f=R(o),d=N(a),m=R(a),h=N(u),w=R(u),y=N(i),v=R(i),p=N(s),C=R(s),U={a:function(e){return u[e.getDay()]},A:function(e){return a[e.getDay()]},b:function(e){return s[e.getMonth()]},B:function(e){return i[e.getMonth()]},c:null,d:le,e:le,f:he,g:Se,G:xe,H:ge,I:fe,j:de,L:me,m:we,M:ye,p:function(e){return o[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:Xe,s:ze,S:ve,u:Te,U:pe,V:De,w:Ue,W:Me,x:null,X:null,y:be,Y:Ie,Z:Ee,"%":Qe},M={a:function(e){return u[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return s[e.getUTCMonth()]},B:function(e){return i[e.getUTCMonth()]},c:null,d:Le,e:Le,f:He,g:We,G:qe,H:Fe,I:Ye,j:_e,L:Ae,m:$e,M:Oe,p:function(e){return o[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:Xe,s:ze,S:ke,u:Ge,U:Be,V:Ne,w:Re,W:Ze,x:null,X:null,y:Pe,Y:Ve,Z:Je,"%":Qe},b={a:function(e,t,n){var r=h.exec(t.slice(n));return r?(e.w=w.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=p.exec(t.slice(n));return r?(e.m=C.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=y.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,n,r){return x(e,t,n,r)},d:ee,e:ee,f:ue,g:Q,G:J,H:ne,I:ne,j:te,L:ae,m:K,M:re,p:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.p=f.get(r[0].toLowerCase()),n+r[0].length):-1},q:z,Q:ie,s:se,S:oe,u:P,U:W,V:V,w:Z,W:q,x:function(e,t,r){return x(e,n,t,r)},X:function(e,t,n){return x(e,r,t,n)},y:Q,Y:J,Z:X,"%":ce};function S(e,t){return function(n){var r,o,a,u=[],c=-1,i=0,s=e.length;for(n instanceof Date||(n=new Date(+n));++c<s;)37===e.charCodeAt(c)&&(u.push(e.slice(i,c)),null!=(o=$[r=e.charAt(++c)])?r=e.charAt(++c):o="e"===r?" ":"0",(a=t[r])&&(r=a(n,o)),u.push(r),i=c+1);return u.push(e.slice(i,c)),u.join("")}}function I(e,t){return function(n){var r,o,a=Y(1900,void 0,1);if(x(a,e,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(t&&!("Z"in a)&&(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(o=(r=F(Y(a.y,0,1))).getUTCDay(),r=o>4||0===o?D.ceil(r):D(r),r=T.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(o=(r=L(Y(a.y,0,1))).getDay(),r=o>4||0===o?l.ceil(r):l(r),r=c.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),o="Z"in a?F(Y(a.y,0,1)).getUTCDay():L(Y(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(o+5)%7:a.w+7*a.U-(o+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,F(a)):L(a)}}function x(e,t,n,r){for(var o,a,u=0,c=t.length,i=n.length;u<c;){if(r>=i)return-1;if(37===(o=t.charCodeAt(u++))){if(o=t.charAt(u++),!(a=b[o in $?t.charAt(u++):o])||(r=a(e,n,r))<0)return-1}else if(o!=n.charCodeAt(r++))return-1}return r}return U.x=S(n,U),U.X=S(r,U),U.c=S(t,U),M.x=S(n,M),M.X=S(r,M),M.c=S(t,M),{format:function(e){var t=S(e+="",U);return t.toString=function(){return e},t},parse:function(e){var t=I(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+="",M);return t.toString=function(){return e},t},utcParse:function(e){var t=I(e+="",!0);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),_.format,_.parse,A=_.utcFormat,H=_.utcParse;const Ke="https://epic.gsfc.nasa.gov/",et="https://rammb-slider.cira.colostate.edu/data/",tt="https://epic.gsfc.nasa.gov",nt=tt+"/enhanced",rt="INFRARED_FULL",ot="D531106",at="EPIC",ut="EPIC_ENHANCED",ct="GOES_16",it="GOES_16_NATURAL",st="GOES_17",lt="GOES_17_NATURAL",gt="METEOSAT",ft="METEOSAT_IODC",dt=550,mt=[1,4,8,16,20],ht=678,wt=[1,2,4,8,16],yt=2048,vt="imageData",Tt="cachedDate",pt="cachedImageType",Ct=window.browser&&!!browser.storage,Dt={animated:!1,imageType:ot};function Ut(e,t=432e3){return Ct?e:`https://images1-focus-opensocial.googleusercontent.com/gadgets/proxy?url=${e}&container=focus&refresh=${t}`}function Mt(e,t){let n=e+"";for(;n.length<t;)n="0"+n;return n}async function bt(e){const t=await fetch("https://himawari-8.appspot.com/latest"+(e===rt?"?infrared=true":"")),n=(await t.json()).date;return H("%Y-%m-%d %H:%M:%S")(n)}function St(e,t){const n=document.getElementById("output").clientHeight*window.devicePixelRatio/e;for(let e=0;e<t.length;e++){const r=t[e];if(r>n)return{blocks:r,level:e}}const r=t.length-1;return{blocks:t[r],level:r}}let It=null,xt=null;function Et(e){document.getElementById("time").innerHTML=null===e?"":`<abbr title="${e}">${function(e){const t=Math.floor(((new Date).getTime()-e.getTime())/1e3);let n=Math.floor(t/31536e3);return n>1?n+" years":(n=Math.floor(t/2592e3),n>1?n+" months":(n=Math.floor(t/86400),n>1?n+" days":(n=Math.floor(t/3600),n>1?n+" hours":(n=Math.floor(t/60),n>1?n+" minutes":Math.floor(t)+" seconds"))))}(e)}</abbr> ago`}function Lt(e,t){Et(e),It=e,function(e){switch(document.body.classList.remove("himawari"),document.body.classList.remove("dscovr"),document.body.classList.remove("goes"),document.body.classList.remove("goes16"),document.body.classList.remove("meteosat"),e){case rt:case ot:document.body.classList.add("himawari");break;case at:case ut:document.body.classList.add("dscovr");break;case ct:case it:case st:case lt:document.body.classList.add("goes");break;case gt:case ft:document.body.classList.add("meteosat");break;default:console.warn("Unknown image type",e)}}(t),xt=t}function Ft(e,t,n=.95){const r=document.getElementById("output").toDataURL("image/jpeg",n);try{localStorage.setItem(vt,r)}catch{if(n>.5)return n-=.05,console.warn(`Couldn't store image. Trying again with lower image quality of ${n}`),Ft(e,t,n)}localStorage.setItem(Tt,e.toString()),localStorage.setItem(pt,t)}function Yt(e,t){if(It&&e.getTime()===It.getTime()&&xt===t)return;const n=!localStorage.getItem(Tt);n&&Lt(e,t);const r=function(e){const t="https://himawari8-dl.nict.go.jp/himawari8/img/"+(e.type||ot),n=e.date,r=e.blocks,o=`${t}/${r}d/550/${A("%Y/%m/%d/%H%M%S")(n)}`,a=[];for(let e=0;e<r;e++)for(let t=0;t<r;t++){const n=`${o}_${t}_${e}.png`;a.push({url:Ut(n),x:t,y:e})}return{blocks:r,date:n,tiles:a}}({blocks:St(dt,mt).blocks,date:e,type:t}),o=r.blocks*dt,a=n?document.getElementById("output"):document.createElement("canvas"),u=a.getContext("2d");u.canvas.width=o,u.canvas.height=o,Promise.all(r.tiles.map((e=>function(e){return new Promise((t=>{const n=new Image;n.setAttribute("crossOrigin","anonymous"),n.onload=()=>{u.drawImage(n,e.x*dt,e.y*dt,dt,dt),t()},n.src=e.url}))}(e)))).catch((e=>{throw e})).then((()=>{if(!n){const e=document.getElementById("output").getContext("2d");e.canvas.width=o,e.canvas.height=o,e.drawImage(a,0,0)}Lt(e,t),Ft(e,t)}))}function _t(e,t){if(It&&e.getTime()===It.getTime()&&xt===t)return;const n=!localStorage.getItem(Tt);n&&Lt(e,t);const r=function(e){const t=e.date,n=e.blocks,r=e.level,o={GOES_16:"geocolor",GOES_16_NATURAL:"natural_color",GOES_17:"geocolor",GOES_17_NATURAL:"natural_color"}[e.type],a={GOES_16:16,GOES_16_NATURAL:16,GOES_17:17,GOES_17_NATURAL:17}[e.type],u=A("%Y/%m/%d")(e.date),c=A("%Y%m%d%H%M%S")(e.date),i=`${et}imagery/${u}/goes-${a}---full_disk/${o}/${c}/`,s=[];for(let e=0;e<n;e++)for(let t=0;t<n;t++){const n=`${i}${Mt(r,2)}/${Mt(e,3)}_${Mt(t,3)}.png`;s.push({url:Ut(n),x:t,y:e})}return{blocks:n,date:t,tiles:s}}({date:e,type:t,...St(ht,wt)}),o=r.blocks*ht,a=n?document.getElementById("output"):document.createElement("canvas"),u=a.getContext("2d");u.canvas.width=o,u.canvas.height=o,Promise.all(r.tiles.map((e=>function(e){return new Promise((t=>{const n=new Image;n.setAttribute("crossOrigin","anonymous"),n.onload=()=>{u.drawImage(n,e.x*ht,e.y*ht,ht,ht),t()},n.src=e.url}))}(e)))).catch((e=>{throw e})).then((()=>{if(!n){const e=document.getElementById("output").getContext("2d");e.canvas.width=o,e.canvas.height=o,e.drawImage(a,0,0)}Lt(e,t),Ft(e,t)}))}async function At(){if(navigator.onLine)if(Ct){document.title="New Tab";const{imageType:e}=await browser.storage.sync.get(Dt);switch(e){case at:case ut:!function(e,t){if(It&&e.date.getTime()===It.getTime()&&xt===t)return;const n=!localStorage.getItem(Tt);n&&Lt(e.date,t);const r=n?document.getElementById("output"):document.createElement("canvas"),o=r.getContext("2d");o.canvas.width=yt,o.canvas.height=yt;const a=new Image;a.setAttribute("crossOrigin","anonymous"),a.onload=()=>{if(o.drawImage(a,0,0),!n){const e=document.getElementById("output").getContext("2d");e.canvas.width=yt,e.canvas.height=yt,e.drawImage(r,0,0)}Lt(e.date,t),Ft(e.date,t)};const u=t===ut?"enhanced":"natural",c=Mt(e.date.getMonth()+1,2),i=Mt(e.date.getDate(),2);a.src=Ut(`${Ke}archive/${u}/${e.date.getFullYear()}/${c}/${i}/png/${e.image}.png`)}(await async function(e){const t=await fetch(`${Ke}api/${e===ut?"enhanced":"natural"}`),n=await t.json();if(0===n.length)return null;const r=n[n.length-1];return{date:H("%Y-%m-%d %H:%M:%S")(r.date),image:r.image}}(e),e);break;case ct:case it:case st:case lt:_t(await async function(e){const t={GOES_16:16,GOES_16_NATURAL:16,GOES_17:17,GOES_17_NATURAL:17}[e],n=await fetch(`${et}json/goes-${t}/full_disk/geocolor/latest_times.json`),r=await n.json();return H("%Y%m%d%H%M%S")(r.timestamps_int[0])}(e),e);break;case gt:case ft:!function(e,t){if(It&&e.date.getTime()===It.getTime()&&xt===t)return;const n=!localStorage.getItem(Tt);n&&Lt(e.date,t);const r=n?document.getElementById("output"):document.createElement("canvas"),o=r.getContext("2d");o.canvas.width=3712,o.canvas.height=3630;const a=new Image;a.setAttribute("crossOrigin","anonymous"),a.onload=()=>{if(o.drawImage(a,0,0),!n){const e=document.getElementById("output").getContext("2d");e.canvas.width=3712,e.canvas.height=3630,e.drawImage(r,0,0)}Lt(e.date,t),Ft(e.date,t)},a.src=Ut(e.image)}(await async function(e){const t=await fetch("https://meteosat-url.appspot.com/msg"+(e===ft?"iodc":"")),n=await t.json();return{date:H("%Y-%m-%d %H:%M:%S")(n.date),image:n.url}}(e),e);break;default:Yt(await bt(e),e)}}else Yt(await bt(ot),ot)}function Ht(){localStorage.getItem(Tt)&&function(){const e=document.getElementById("output").getContext("2d"),t=new Date(localStorage.getItem(Tt)),n=new Image;n.onload=()=>{e.canvas.width=n.width,e.canvas.height=n.height,e.drawImage(n,0,0),Lt(t,localStorage.getItem(pt))},n.src=localStorage.getItem(vt)}(),At()}window.setInterval(At,6e4),window.addEventListener("online",At),Ct?browser.storage.sync.get(Dt).then((e=>{e.animated?document.body.classList.add("animated"):document.body.classList.remove("animated"),Ht()})):Ht(),window.setInterval((()=>{It&&Et(It)}),1e4),Ct&&(browser.storage.onChanged.addListener(At),document.body.classList.add("extension"),document.getElementById("go-to-options").addEventListener("click",(()=>{browser.runtime.openOptionsPage()}))),document.getElementById("explore").addEventListener("click",(()=>{switch(xt){case at:window.open(tt,"_self");break;case ut:window.open(nt,"_self");break;case ct:case it:case st:case lt:window.open("https://rammb-slider.cira.colostate.edu/","_self");break;case rt:case ot:window.open("https://himawari8.nict.go.jp/himawari8-image.htm?sI=D531106","_self");break;case gt:case ft:window.open("https://eumetview.eumetsat.int/static-images/","_self");break;default:window.alert("No explorer found.")}}))}();
//# sourceMappingURL=bundle.js.map