var Flux=function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=3)}([function(t,e,r){"use strict";function n(t){return"0123456789ABCDEF".indexOf(t)}function o(t){"#"===t.charAt(0)&&(t=t.substr(1)),t=t.toUpperCase();for(var e=[],r=0;r<6;r++)if(e[r]=n(t.charAt(r)),-1===e[r])return null;return{red:16*e[0]+e[1],green:16*e[2]+e[3],blue:16*e[4]+e[5],alpha:1}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=o},function(t,e,r){"use strict";function n(t,e,r){t.toString().includes("%");if("string"==typeof t){var n=t.match(/(0?\.?\d{1,3})%?\b/g).map(Number),u=i(n,3);t=u[0],e=u[1],r=u[2]}else if(Array.isArray(t)){var a=t,l=i(a,3);t=l[0],e=l[1],r=l[2]}else if("object"===(void 0===t?"undefined":o(t)))if(void 0!==t.red){var s=t;t=s.red,e=s.green,r=s.blue}else{var f=t;t=f.r,e=f.g,r=f.b}if("number"!=typeof t||"number"!=typeof e||"number"!=typeof r||t>255||e>255||r>255)throw new TypeError("Expected three numbers below 256");return(r|e<<8|t<<16|1<<24).toString(16).slice(1)}Object.defineProperty(e,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(n=(u=a.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&a.return&&a.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.default=n},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!y[e])return!0;var r=y[e];return r.validate(t[r.prop])}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r0}},borderLeftColor:{prop:"borderLeftWidth",validate:function(t){return parseInt(t,10)>0}},borderRightColor:{prop:"borderRightWidth",validate:function(t){return parseInt(t,10)>0}},borderBottomColor:{prop:"borderBottomWidth",validate:function(t){return parseInt(t,10)>0}}},p={localStorageKey:"fluxjs-location",styleKey:"fluxjs-",nightTemperature:4400,dayTemperature:6500,colorMixAmount:.8,brightness:127,interval:6e4,location:null,date:null,el:null},b=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,t),Object.assign(this,{},p,e),this.location&&this._saveUserLocation(this.location)}return u(t,[{key:"_saveUserLocation",value:function(t){localStorage.setItem(this.localStorageKey,JSON.stringify(t))}},{key:"_initSolarCalc",value:function(t,e){return new f.default(e,t.latitude,t.longitude)}},{key:"_getDOMNodes",value:function(t){var e=t;if(t.nodeName)e=t;else{if("string"!=typeof e)throw new Error("FluxJS: Given element could not be found on the page.");var r=document.querySelector(r);if(!r)throw new Error("FluxJS: Failed to find element with selector "+r+".");e=r}var n=[];return function t(e){do{1===e.nodeType&&n.push(e),e.hasChildNodes()&&t(e.firstChild)}while(e=e.nextSibling)}(e),n}},{key:"_normalizeStyle",value:function(t){return"transparent"===t?"rgba(0,0,0,0)":t}},{key:"_fixBodyBackground",value:function(t){if("BODY"===t.nodeName){var e=window.getComputedStyle(t);0===this._normalizeStyle(e.backgroundColor).match(/(0?\.?\d{1,3})%?\b/g).map(Number)[3]&&(t.style.backgroundColor="rgb(255,255,255)")}}},{key:"_changeNodesColor",value:function(t,e){var r=this,n=this.brightness,o=this.colorMixAmount,i=(0,h.default)(e);this._fixBodyBackground(t[0]),t.forEach(function(t){r._changeNodeColor(t,e,o,n,i)})}},{key:"_changeNodeColor",value:function(t,e,r,n,o){var u=this,a=window.getComputedStyle(t);v.forEach(function(l){if(!i(a,l))return!1;var s=u.styleKey+l;if(e===u.dayTemperature&&void 0!==t[s])t.style[l]=t[s],delete t[s];else if(e!==u.dayTemperature&&void 0===t[s]){var f=u._normalizeStyle(t[s]||a[l]);t[s]=t.style[l]||null;var c=f.match(/(0?\.?\d{1,3})%?\b/g).map(Number);(c[0]>n||c[1]>n||c[2]>n)&&(t.style[l]=(0,g.default)(o,c,r))}})}},{key:"setNodeTemperature",value:function(t,e){var r=this._getDOMNodes(t);return this._changeNodesColor(r,e),this}},{key:"setPageTemperature",value:function(t){return this.setNodeTemperature(document.body,t),this}},{key:"requestUserLocation",value:function(t){return navigator.geolocation&&navigator.geolocation.getCurrentPosition?navigator.geolocation.getCurrentPosition(function(e){var r={latitude:e.coords.latitude,longitude:e.coords.longitude};t(r)},function(e){throw t(null),new Error("FluxJS: Error fetching user location.",e)}):t(null),this}},{key:"updateUserLocation",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.requestUserLocation(function(r){r?(t.location=r,t._saveUserLocation(r),e&&e(r)):e&&e(null)})}},{key:"getUserLocation",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.location)return t&&t(this.location),this;var e=localStorage.getItem(this.localStorageKey);if(e){var r=JSON.parse(e);if(r.latitude&&r.longitude)return this.location=r,t(r),this}return this.updateUserLocation(t),this}},{key:"adjustTemperature",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.getUserLocation(function(r){if(r){var n=t.getTemperature();e?t.setNodeTemperature(e,n):t.setPageTemperature(n)}}),this}},{key:"disable",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t?this.setNodeTemperature(t,this.dayTemperature):this.setPageTemperature(this.dayTemperature),this}},{key:"getTemperature",value:function(){return this.isDark()?this.nightTemperature:this.dayTemperature}},{key:"setDate",value:function(t){return this.date=t,this}},{key:"isDark",value:function(){if(this.location){var t=this.date||new Date,e=this._initSolarCalc(this.location,t),r=e.sunriseEnd;return t>e.sunsetStart||t2&&void 0!==arguments[2]?arguments[2]:1;t=o(t),e=o(e);var n=Math.round(t.red+r*(e.red-t.red)),i=Math.round(t.green+r*(e.green-t.green)),u=Math.round(t.blue+r*(e.blue-t.blue));return"#"+(0,s.default)(n)+(0,s.default)(i)+(0,s.default)(u)}Object.defineProperty(e,"__esModule",{value:!0});var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(n=(u=a.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&a.return&&a.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.default=i;var l=r(8),s=n(l),f=r(1),c=(n(f),r(0)),h=n(c)},function(t,e,r){"use strict";function n(t){var e=void 0,r=void 0,n=void 0,o=t/100;return o<=66?e=255:(e=o-60,e=329.698727446*Math.pow(e,-.1332047592),e<0&&(e=0),e>255&&(e=255)),o<=66?(r=o,r=99.4708025861*Math.log(r)-161.1195681661,r<0&&(r=0),r>255&&(r=255)):(r=o-60,r=288.1221695283*Math.pow(r,-.0755148492),r<0&&(r=0),r>255&&(r=255)),o>=66?n=255:o<=19?n=0:(n=o-10,n=138.5177312231*Math.log(n)-305.0447927307,n<0&&(n=0),n>255&&(n=255)),{red:Math.round(e),green:Math.round(r),blue:Math.round(n)}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=n},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var r=0;r=2299161){var o=Math.floor((e-1867216.25)/36524.25);n=e+1+o-Math.floor(o/4)}var i=n+1524,a=Math.floor((i-122.1)/365.25),l=Math.floor(365.25*a),s=Math.floor((i-l)/30.6001),f=i-l-Math.floor(30.6001*s)+r,c=s<14?s-1:s-13,h=c>2?a-4716:a-4715,d=u(h)?1:2;return Math.floor(275*c/9)-d*Math.floor((c+9)/12)+f-30}function l(t){return 180*t/Math.PI}function s(t){return Math.PI*t/180}function f(t){for(var e=280.46646+t*(36000.76983+3032e-7*t);e>360;)e-=360;for(;e<0;)e+=360;return e}function c(t){return 357.52911+t*(35999.05029-1537e-7*t)}function h(t){return.016708634-t*(42037e-9+1.267e-7*t)}function d(t){var e=c(t),r=s(e);return Math.sin(r)*(1.914602-t*(.004817+14e-6*t))+Math.sin(r+r)*(.019993-101e-6*t)+289e-6*Math.sin(r+r+r)}function g(t){return f(t)+d(t)}function v(t){var e=g(t),r=125.04-1934.136*t;return e-.00569-.00478*Math.sin(s(r))}function y(t){return 23+(26+(21.448-t*(46.815+t*(59e-5-.001813*t)))/60)/60}function p(t){var e=y(t),r=125.04-1934.136*t;return e+.00256*Math.cos(s(r))}function b(t){var e=p(t),r=v(t),n=Math.sin(s(e))*Math.sin(s(r));return l(Math.asin(n))}function m(t){var e=p(t),r=f(t),n=h(t),o=c(t),i=Math.pow(Math.tan(s(e)/2),2),u=Math.sin(2*s(r)),a=Math.sin(s(o));return 4*l(i*u-2*n*a+4*n*i*a*Math.cos(2*s(r))-.5*i*i*Math.sin(4*s(r))-1.25*n*n*Math.sin(2*s(o)))}function M(t,e,r){var n=s(e),o=s(r),i=Math.cos(s(90+t))/(Math.cos(n)*Math.cos(o))-Math.tan(n)*Math.tan(o);return Math.acos(i)}function k(t){for(var e=!1,r=""+t,n=0;n"9")return!1}else e=!0}return!0}function w(t){var e=t.getFullYear(),r=t.getMonth()+1,n=t.getDate(),o=Math.floor(e/100),i=2-o+Math.floor(o/4);return Math.floor(365.25*(e+4716))+Math.floor(30.6001*(r+1))+n+i-1524.5}function A(t,e,r){var n=i(t-e/360),u=m(n);u=m(i(t+(720-4*e-u)/1440));for(var a=720-4*e-u;a<0;)a+=1440;for(;a>=1440;)a-=1440;return o(r,a)}function _(t){if(t<9e5||t>2817e3)return"error";var e=Math.floor(t+.5),r=t+.5-e,n=void 0;if(e<2299161)n=e;else{var o=Math.floor((e-1867216.25)/36524.25);n=e+1+o-Math.floor(o/4)}var i=n+1524,u=Math.floor((i-122.1)/365.25),a=Math.floor(365.25*u),l=Math.floor((i-a)/30.6001),s=i-a-Math.floor(30.6001*l)+r,f=l<14?l-1:l-13,c=f>2?u-4716:u-4715;return new Date(Date.UTC(c,f-1,s,0,0,0))}function S(t,e,r,n,o){var u=i(r),a=m(u),s=b(u),f=M(e,n,s);return t||(f=-f),720-4*(o+l(f))-a}function T(t,e,r,n,i,u){var l=S(t,e,r,i,u),s=S(t,e,r+l/1440,i,u);if(k(s))return o(n,s);var f=a(r);if(i>66.4&&f>79&&f<267||i<-66.4&&(f<83||f>263)){return _(C(!t,t,e,r,i,u))}return _(C(t,t,e,r,i,u))}function C(t,e,r,n,o,i){for(var u=n,a=t?1:-1,l=S(e,r,u,o,i);!k(l);)u+=a,l=S(e,r,u,o,i);return u}Object.defineProperty(e,"__esModule",{value:!0});var D=function(){function t(t,e){for(var r=0;r