diff --git a/lib/AmsConfiguration/include/AmsConfiguration.h b/lib/AmsConfiguration/include/AmsConfiguration.h index 6af438e2..e606b623 100644 --- a/lib/AmsConfiguration/include/AmsConfiguration.h +++ b/lib/AmsConfiguration/include/AmsConfiguration.h @@ -180,7 +180,8 @@ struct EntsoeConfig { char currency[4]; uint32_t multiplier; bool enabled; -}; // 62 + uint16_t fixedPrice; +}; // 64 struct EnergyAccountingConfig { uint16_t thresholds[10]; diff --git a/lib/AmsConfiguration/src/AmsConfiguration.cpp b/lib/AmsConfiguration/src/AmsConfiguration.cpp index 07eb0be4..dcf5db20 100644 --- a/lib/AmsConfiguration/src/AmsConfiguration.cpp +++ b/lib/AmsConfiguration/src/AmsConfiguration.cpp @@ -551,6 +551,7 @@ bool AmsConfiguration::setEntsoeConfig(EntsoeConfig& config) { entsoeChanged |= strcmp(config.currency, existing.currency) != 0; entsoeChanged |= config.multiplier != existing.multiplier; entsoeChanged |= config.enabled != existing.enabled; + entsoeChanged |= config.fixedPrice != existing.fixedPrice; } else { entsoeChanged = true; } @@ -1037,6 +1038,11 @@ bool AmsConfiguration::relocateConfig102() { clearHomeAssistantConfig(haconf); EEPROM.put(CONFIG_HA_START, haconf); + EntsoeConfig entsoe; + EEPROM.get(CONFIG_ENTSOE_START, entsoe); + entsoe.fixedPrice = 0; + EEPROM.put(CONFIG_ENTSOE_START, entsoe); + EEPROM.put(EEPROM_CONFIG_ADDRESS, 103); bool ret = EEPROM.commit(); EEPROM.end(); diff --git a/lib/EnergyAccounting/include/EnergyAccounting.h b/lib/EnergyAccounting/include/EnergyAccounting.h index 5531ce84..dad26b02 100644 --- a/lib/EnergyAccounting/include/EnergyAccounting.h +++ b/lib/EnergyAccounting/include/EnergyAccounting.h @@ -81,6 +81,9 @@ public: EnergyAccountingData getData(); void setData(EnergyAccountingData&); + void setFixedPrice(double price); + double getPriceForHour(uint8_t h); + private: RemoteDebug* debugger = NULL; unsigned long lastUpdateMillis = 0; @@ -93,6 +96,7 @@ private: double use = 0, costHour = 0, costDay = 0; double produce = 0, incomeHour = 0, incomeDay = 0; EnergyAccountingData data = { 0, 0, 0, 0, 0, 0 }; + double fixedPrice = 0; void calcDayCost(); bool updateMax(uint16_t val, uint8_t day); diff --git a/lib/EnergyAccounting/src/EnergyAccounting.cpp b/lib/EnergyAccounting/src/EnergyAccounting.cpp index 8662c49e..84d51dfe 100644 --- a/lib/EnergyAccounting/src/EnergyAccounting.cpp +++ b/lib/EnergyAccounting/src/EnergyAccounting.cpp @@ -68,7 +68,7 @@ bool EnergyAccounting::update(AmsData* amsData) { init = true; } - if(!initPrice && eapi != NULL && eapi->getValueForHour(0) != ENTSOE_NO_VALUE) { + if(!initPrice && eapi != NULL && getPriceForHour(0) != ENTSOE_NO_VALUE) { if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf("(EnergyAccounting) Initializing prices at %lu\n", (int32_t) now); calcDayCost(); } @@ -129,8 +129,8 @@ bool EnergyAccounting::update(AmsData* amsData) { if(kwhi > 0) { if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("(EnergyAccounting) Adding %.4f kWh import\n", kwhi); use += kwhi; - if(eapi != NULL && eapi->getValueForHour(0) != ENTSOE_NO_VALUE) { - float price = eapi->getValueForHour(0); + if(getPriceForHour(0) != ENTSOE_NO_VALUE) { + float price = getPriceForHour(0); float cost = price * kwhi; if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("(EnergyAccounting) and %.4f %s\n", cost / 100.0, eapi->getCurrency()); costHour += cost; @@ -140,8 +140,8 @@ bool EnergyAccounting::update(AmsData* amsData) { if(kwhe > 0) { if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("(EnergyAccounting) Adding %.4f kWh export\n", kwhe); produce += kwhe; - if(eapi != NULL && eapi->getValueForHour(0) != ENTSOE_NO_VALUE) { - float price = eapi->getValueForHour(0); + if(getPriceForHour(0) != ENTSOE_NO_VALUE) { + float price = getPriceForHour(0); float income = price * kwhe; if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("(EnergyAccounting) and %.4f %s\n", income / 100.0, eapi->getCurrency()); incomeHour += income; @@ -163,13 +163,13 @@ void EnergyAccounting::calcDayCost() { tmElements_t local, utc; breakTime(tz->toLocal(now), local); - if(eapi != NULL && eapi->getValueForHour(0) != ENTSOE_NO_VALUE) { + if(eapi != NULL && getPriceForHour(0) != ENTSOE_NO_VALUE) { if(initPrice) { costDay = 0; incomeDay = 0; } for(int i = 0; i < currentHour; i++) { - float price = eapi->getValueForHour(i - local.Hour); + float price = getPriceForHour(i - local.Hour); if(price == ENTSOE_NO_VALUE) break; breakTime(now - ((local.Hour - i) * 3600), utc); int16_t wh = ds->getHourImport(utc.Hour); @@ -502,4 +502,14 @@ bool EnergyAccounting::updateMax(uint16_t val, uint8_t day) { return true; } return false; +} + +void EnergyAccounting::setFixedPrice(double price) { + this->fixedPrice = price; +} + +double EnergyAccounting::getPriceForHour(uint8_t h) { + if(fixedPrice > 0.0) return fixedPrice; + if(eapi == NULL) return ENTSOE_NO_VALUE; + return eapi->getValueForHour(h); } \ No newline at end of file diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index ea1fa0c6..bafcba99 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,14 +1,14 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function ie(){}function Ht(t,e){for(const l in e)t[l]=e[l];return t}function wf(t){return t()}function dr(){return Object.create(null)}function Be(t){t.forEach(wf)}function yf(t){return typeof t=="function"}function ke(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ts;function vc(t,e){return ts||(ts=document.createElement("a")),ts.href=e,t===ts.href}function hc(t){return Object.keys(t).length===0}function Js(t,...e){if(t==null)return ie;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function Wn(t){let e;return Js(t,l=>e=l)(),e}function Vt(t,e,l){t.$$.on_destroy.push(Js(e,l))}function Xs(t,e,l,n){if(t){const i=$f(t,e,l,n);return t[0](i)}}function $f(t,e,l,n){return t[1]&&n?Ht(l.ctx.slice(),t[1](n(e))):l.ctx}function xs(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(e.dirty.length,i.length);for(let r=0;r32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function _s(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}function Kt(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set?t[n]=e[n]:u(t,n,e[n])}function pe(t){return t===""?null:+t}function bc(t){return Array.from(t.childNodes)}function B(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Y(t,e){t.value=e==null?"":e}function Cf(t,e,l,n){l===null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Re(t,e){for(let l=0;l{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=z(n.contentWindow,"resize",e)}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),w(n)}}function wc(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}let si;function li(t){si=t}function oi(){if(!si)throw new Error("Function called outside component initialization");return si}function yc(t){oi().$$.on_mount.push(t)}function $c(t){oi().$$.on_destroy.push(t)}function Cc(){const t=oi();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=wc(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,o)}),!o.defaultPrevented}return!0}}function ni(t,e){return oi().$$.context.set(t,e),e}function $l(t){return oi().$$.context.get(t)}const ei=[],fs=[],os=[],vr=[],Tf=Promise.resolve();let Us=!1;function Sf(){Us||(Us=!0,Tf.then(Pf))}function Tc(){return Sf(),Tf}function Ye(t){os.push(t)}const Es=new Set;let ns=0;function Pf(){const t=si;do{for(;ns{us.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function Gn(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],r=e[o];if(r){for(const c in a)c in r||(n[c]=1);for(const c in r)i[c]||(l[c]=r[c],i[c]=1);t[o]=r}else for(const c in a)i[c]=1}for(const a in n)a in l||(l[a]=void 0);return l}function hr(t){return typeof t=="object"&&t!==null?t:{}}function Z(t){t&&t.c()}function K(t,e,l,n){const{fragment:i,on_mount:o,on_destroy:a,after_update:r}=t.$$;i&&i.m(e,l),n||Ye(()=>{const c=o.map(wf).filter(yf);a?a.push(...c):Be(c),t.$$.on_mount=[]}),r.forEach(Ye)}function Q(t,e){const l=t.$$;l.fragment!==null&&(Be(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function Pc(t,e){t.$$.dirty[0]===-1&&(ei.push(t),Sf(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=b.length?b[0]:h;return f.ctx&&i(f.ctx[_],f.ctx[_]=d)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](d),m&&Pc(t,_)),h}):[],f.update(),m=!0,Be(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const _=bc(e.target);f.fragment&&f.fragment.l(_),_.forEach(w)}else f.fragment&&f.fragment.c();e.intro&&M(t.$$.fragment),K(t,e.target,e.anchor,e.customElement),Pf()}li(c)}class $e{$destroy(){Q(this,1),this.$destroy=ie}$on(e,l){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!hc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const br=t=>typeof t>"u",Mf=t=>typeof t=="function",Af=t=>typeof t=="number";function Mc(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Df(){let t=0;return()=>t++}function Ac(){return Math.random().toString(36).substring(2)}const Cl=typeof window>"u";function Nf(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Hs=(t,e)=>t?{}:{style:e},Un=t=>({"aria-hidden":"true",...Hs(t,"display:none;")}),On=[];function If(t,e){return{subscribe:Je(t,e).subscribe}}function Je(t,e=ie){let l;const n=new Set;function i(r){if(ke(t,r)&&(t=r,l)){const c=!On.length;for(const f of n)f[1](),On.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&(l(),l=null)}}return{set:i,update:o,subscribe:a}}function Dc(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return If(l,a=>{let r=!1;const c=[];let f=0,m=ie;const _=()=>{if(f)return;m();const b=e(n?c[0]:c,a);o?a(b):m=yf(b)?b:ie},h=i.map((b,d)=>Js(b,g=>{c[d]=g,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,js=ui("LOCATION"),Bn=ui("ROUTER"),Ef=ui("ROUTE"),Nc=ui("ROUTE_PARAMS"),Ic=ui("FOCUS_ELEM"),Rf=/^:(.+)/,ti=(t,e,l)=>t.substr(e,l),Ws=(t,e)=>ti(t,0,e.length)===e,Ec=t=>t==="",Rc=t=>Rf.test(t),Ff=t=>t[0]==="*",Fc=t=>t.replace(/\*.*$/,""),Lf=t=>t.replace(/(^\/+|\/+$)/g,"");function Jt(t,e=!1){const l=Lf(t).split("/");return e?l.filter(Boolean):l}const Rs=(t,e)=>t+(e?`?${e}`:""),lo=t=>`/${Lf(t)}`;function ri(...t){const e=n=>Jt(n,!0).join("/"),l=t.map(e).join("/");return lo(l)}const no=1,ds=2,Vl=3,Lc=4,qf=5,qc=6,Of=7,Oc=8,Uc=9,Uf=10,Hf=11,Hc={[no]:"Link",[ds]:"Route",[Vl]:"Router",[Lc]:"useFocus",[qf]:"useLocation",[qc]:"useMatch",[Of]:"useNavigate",[Oc]:"useParams",[Uc]:"useResolvable",[Uf]:"useResolve",[Hf]:"navigate"},io=t=>Hc[t];function jc(t,e){let l;return t===ds?l=e.path?`path="${e.path}"`:"default":t===no?l=`to="${e.to}"`:t===Vl&&(l=`basepath="${e.basepath||""}"`),`<${io(t)} ${l||""} />`}function Wc(t,e,l,n){const i=l&&jc(n||t,l),o=i?` +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function ie(){}function Ut(t,e){for(const l in e)t[l]=e[l];return t}function Af(t){return t()}function $r(){return Object.create(null)}function Be(t){t.forEach(Af)}function Df(t){return typeof t=="function"}function ye(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let os;function Cc(t,e){return os||(os=document.createElement("a")),os.href=e,t===os.href}function Tc(t){return Object.keys(t).length===0}function lo(t,...e){if(t==null)return ie;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function zn(t){let e;return lo(t,l=>e=l)(),e}function zt(t,e,l){t.$$.on_destroy.push(lo(e,l))}function no(t,e,l,n){if(t){const i=Nf(t,e,l,n);return t[0](i)}}function Nf(t,e,l,n){return t[1]&&n?Ut(l.ctx.slice(),t[1](n(e))):l.ctx}function io(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(e.dirty.length,i.length);for(let r=0;r32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function gs(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}function Vt(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set?t[n]=e[n]:u(t,n,e[n])}function fe(t){return t===""?null:+t}function Sc(t){return Array.from(t.childNodes)}function B(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Y(t,e){t.value=e==null?"":e}function If(t,e,l,n){l===null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Re(t,e){for(let l=0;l{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=z(n.contentWindow,"resize",e)}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),w(n)}}function Ac(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}let ai;function oi(t){ai=t}function fi(){if(!ai)throw new Error("Function called outside component initialization");return ai}function Dc(t){fi().$$.on_mount.push(t)}function Nc(t){fi().$$.on_destroy.push(t)}function Ic(){const t=fi();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=Ac(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,o)}),!o.defaultPrevented}return!0}}function ui(t,e){return fi().$$.context.set(t,e),e}function yl(t){return fi().$$.context.get(t)}const ii=[],ds=[],cs=[],Cr=[],Ef=Promise.resolve();let Bs=!1;function Rf(){Bs||(Bs=!0,Ef.then(Ff))}function Ec(){return Rf(),Ef}function Ye(t){cs.push(t)}const Os=new Set;let rs=0;function Ff(){const t=ai;do{for(;rs{ps.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function Vn(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],r=e[o];if(r){for(const c in a)c in r||(n[c]=1);for(const c in r)i[c]||(l[c]=r[c],i[c]=1);t[o]=r}else for(const c in a)i[c]=1}for(const a in n)a in l||(l[a]=void 0);return l}function Tr(t){return typeof t=="object"&&t!==null?t:{}}function J(t){t&&t.c()}function Q(t,e,l,n){const{fragment:i,on_mount:o,on_destroy:a,after_update:r}=t.$$;i&&i.m(e,l),n||Ye(()=>{const c=o.map(Af).filter(Df);a?a.push(...c):Be(c),t.$$.on_mount=[]}),r.forEach(Ye)}function Z(t,e){const l=t.$$;l.fragment!==null&&(Be(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function Fc(t,e){t.$$.dirty[0]===-1&&(ii.push(t),Rf(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=b.length?b[0]:h;return f.ctx&&i(f.ctx[_],f.ctx[_]=d)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](d),m&&Fc(t,_)),h}):[],f.update(),m=!0,Be(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const _=Sc(e.target);f.fragment&&f.fragment.l(_),_.forEach(w)}else f.fragment&&f.fragment.c();e.intro&&M(t.$$.fragment),Q(t,e.target,e.anchor,e.customElement),Ff()}oi(c)}class Ce{$destroy(){Z(this,1),this.$destroy=ie}$on(e,l){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!Tc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Sr=t=>typeof t>"u",Lf=t=>typeof t=="function",qf=t=>typeof t=="number";function Lc(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Of(){let t=0;return()=>t++}function qc(){return Math.random().toString(36).substring(2)}const $l=typeof window>"u";function Uf(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Ys=(t,e)=>t?{}:{style:e},Gn=t=>({"aria-hidden":"true",...Ys(t,"display:none;")}),Wn=[];function Hf(t,e){return{subscribe:Je(t,e).subscribe}}function Je(t,e=ie){let l;const n=new Set;function i(r){if(ye(t,r)&&(t=r,l)){const c=!Wn.length;for(const f of n)f[1](),Wn.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&(l(),l=null)}}return{set:i,update:o,subscribe:a}}function Oc(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return Hf(l,a=>{let r=!1;const c=[];let f=0,m=ie;const _=()=>{if(f)return;m();const b=e(n?c[0]:c,a);o?a(b):m=Df(b)?b:ie},h=i.map((b,d)=>lo(b,g=>{c[d]=g,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,zs=ci("LOCATION"),Kn=ci("ROUTER"),jf=ci("ROUTE"),Uc=ci("ROUTE_PARAMS"),Hc=ci("FOCUS_ELEM"),Wf=/^:(.+)/,si=(t,e,l)=>t.substr(e,l),Vs=(t,e)=>si(t,0,e.length)===e,jc=t=>t==="",Wc=t=>Wf.test(t),Gf=t=>t[0]==="*",Gc=t=>t.replace(/\*.*$/,""),Bf=t=>t.replace(/(^\/+|\/+$)/g,"");function Zt(t,e=!1){const l=Bf(t).split("/");return e?l.filter(Boolean):l}const Us=(t,e)=>t+(e?`?${e}`:""),uo=t=>`/${Bf(t)}`;function pi(...t){const e=n=>Zt(n,!0).join("/"),l=t.map(e).join("/");return uo(l)}const ro=1,ks=2,zl=3,Bc=4,Yf=5,Yc=6,zf=7,zc=8,Vc=9,Vf=10,Kf=11,Kc={[ro]:"Link",[ks]:"Route",[zl]:"Router",[Bc]:"useFocus",[Yf]:"useLocation",[Yc]:"useMatch",[zf]:"useNavigate",[zc]:"useParams",[Vc]:"useResolvable",[Vf]:"useResolve",[Kf]:"navigate"},ao=t=>Kc[t];function Qc(t,e){let l;return t===ks?l=e.path?`path="${e.path}"`:"default":t===ro?l=`to="${e.to}"`:t===zl&&(l=`basepath="${e.basepath||""}"`),`<${ao(t)} ${l||""} />`}function Zc(t,e,l,n){const i=l&&Qc(n||t,l),o=i?` -Occurred in: ${i}`:"",a=io(t),r=Mf(e)?e(a):e;return`<${a}> ${r}${o}`}const jf=t=>(...e)=>t(Wc(...e)),Wf=jf(t=>{throw new Error(t)}),cs=jf(console.warn),gr=4,Gc=3,Bc=2,Yc=1,zc=1;function Vc(t,e){const l=t.default?0:Jt(t.fullPath).reduce((n,i)=>{let o=n;return o+=gr,Ec(i)?o+=zc:Rc(i)?o+=Bc:Ff(i)?o-=gr+Yc:o+=Gc,o},0);return{route:t,score:l,index:e}}function Kc(t){return t.map(Vc).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Gf(t,e){let l,n;const[i]=e.split("?"),o=Jt(i),a=o[0]==="",r=Kc(t);for(let c=0,f=r.length;c({...m,params:h,uri:k});if(m.default){n=b(e);continue}const d=Jt(m.fullPath),g=Math.max(o.length,d.length);let $=0;for(;${f===".."?c.pop():f!=="."&&c.push(f)}),Rs(`/${c.join("/")}`,n)}function kr(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=Jt(e,!0),r=Jt(l,!0);for(;a.length;)a[0]!==r[0]&&Wf(Vl,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),r.shift();return{pathname:ri(...r),hash:n,search:i,state:o}}const wr=t=>t.length===1?"":t,so=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?wr(ti(t,l)):"",a=i?ti(t,0,l):t,r=n?wr(ti(a,e)):"";return{pathname:(n?ti(a,0,e):a)||"/",search:r,hash:o}},Zc=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function Jc(t,e,l){return ri(l,Qc(t,e))}function Xc(t,e){const l=lo(Fc(t)),n=Jt(l,!0),i=Jt(e,!0).slice(0,n.length),o=Bf({fullPath:l},ri(...i));return o&&o.uri}const Fs="POP",xc="PUSH",e1="REPLACE";function Ls(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function t1(t){let e=[],l=Ls(t),n=Fs;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=Ls(t),n=Fs,i([o])};i([o]);const r=Nf(t,"popstate",a);return()=>{r(),e=e.filter(c=>c!==o)}},navigate(o,a){const{state:r={},replace:c=!1}=a||{};if(n=c?e1:xc,Af(o))a&&cs(Hf,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Fs,t.history.go(o);else{const f={...r,_key:Ac()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Ls(t),i()}}}function qs(t,e){return{...so(e),state:t}}function l1(t="/"){let e=0,l=[qs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(qs(n,o))},replaceState(n,i,o){l[e]=qs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const n1=!!(!Cl&&window.document&&window.document.createElement),i1=!Cl&&window.location.origin==="null",Yf=t1(n1&&!i1?window:l1()),{navigate:Hn}=Yf;let fl=null,zf=!0;function s1(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nfl.level||t.level===fl.level&&s1(t.routerId,fl.routerId))&&(fl=t)}function u1(){fl=null}function r1(){zf=!1}function yr(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Nf(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function a1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function f1(t){return/^H[1-6]$/i.test(t.tagName)}function $r(t,e=document){return e.querySelector(t)}function c1(t){let l=$r(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!a1(l,t);){if(f1(l))return l;const n=$r("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function p1(t){Promise.resolve(Wn(t.focusElement)).then(e=>{const l=e||c1(t.id);l||cs(Vl,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,ds),!yr(l)&&yr(document.documentElement)})}const m1=(t,e,l)=>(n,i)=>Tc().then(()=>{if(!fl||zf){r1();return}if(n&&p1(fl.route),t.announcements&&i){const{path:o,fullPath:a,meta:r,params:c,uri:f}=fl.route,m=t.createAnnouncement({path:o,fullPath:a,meta:r,params:c,uri:f},Wn(l));Promise.resolve(m).then(_=>{e.set(_)})}u1()}),Cr="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function _1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Hs(t[6],Cr)],i={};for(let o=0;o`Navigated to ${le.uri}`,announcements:!0,...d},k=m,T=lo(m),P=$l(js),E=$l(Bn),S=!P,N=v1(),D=b&&!(E&&!E.manageFocus),R=Je("");Vt(t,R,le=>l(0,r=le));const W=E?E.disableInlineStyles:g,H=Je([]);Vt(t,H,le=>l(20,a=le));const F=Je(null);Vt(t,F,le=>l(18,i=le));let L=!1;const G=S?0:E.level+1,q=S?Je((()=>kr(Cl?so(_):h.location,T))()):P;Vt(t,q,le=>l(17,n=le));const O=Je(n);Vt(t,O,le=>l(19,o=le));const U=m1($,R,q),x=le=>_e=>_e.filter(Ce=>Ce.id!==le);function X(le){if(Cl){if(L)return;const _e=Bf(le,n.pathname);if(_e)return L=!0,_e}else H.update(_e=>{const Ce=x(le.id)(_e);return Ce.push(le),Ce})}function ne(le){H.update(x(le))}return!S&&m!==Tr&&cs(Vl,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:m}),S&&(yc(()=>h.listen(_e=>{const Ce=kr(_e.location,T);O.set(n),q.set(Ce)})),ni(js,q)),ni(Bn,{activeRoute:F,registerRoute:X,unregisterRoute:ne,manageFocus:D,level:G,id:N,history:S?h:E.history,basepath:S?T:E.basepath,disableInlineStyles:W}),t.$$set=le=>{"basepath"in le&&l(11,m=le.basepath),"url"in le&&l(12,_=le.url),"history"in le&&l(13,h=le.history),"primary"in le&&l(14,b=le.primary),"a11y"in le&&l(15,d=le.a11y),"disableInlineStyles"in le&&l(16,g=le.disableInlineStyles),"$$scope"in le&&l(21,f=le.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&m!==k&&cs(Vl,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const le=Gf(a,n.pathname);F.set(le)}if(t.$$.dirty[0]&655360&&S){const le=!!n.hash,_e=!le&&D,Ce=!le||n.pathname!==o.pathname;U(_e,Ce)}t.$$.dirty[0]&262144&&D&&i&&i.primary&&o1({level:G,routerId:N,route:i})},[r,$,S,N,D,R,W,H,F,q,O,m,_,h,b,d,g,n,i,o,a,f,c]}class Vf extends $e{constructor(e){super(),ye(this,e,h1,d1,ke,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}function ai(t,e,l=Bn,n=Vl){$l(l)||Wf(t,o=>`You cannot use ${o} outside of a ${io(n)}.`,e)}const b1=t=>{const{subscribe:e}=$l(t);return{subscribe:e}};function Kf(){return ai(qf),b1(js)}function Qf(){const{history:t}=$l(Bn);return t}function Zf(){const t=$l(Ef);return t?Dc(t,e=>e.base):Je("/")}function Jf(){ai(Uf);const t=Zf(),{basepath:e}=$l(Bn);return n=>Jc(n,Wn(t),e)}function g1(){ai(Of);const t=Jf(),{navigate:e}=Qf();return(n,i)=>{const o=Af(n)?n:t(n);return e(o,i)}}const k1=t=>({params:t&16,location:t&8}),Sr=t=>({params:Cl?Wn(t[10]):t[4],location:t[3],navigate:t[11]});function Pr(t){let e,l;return e=new Vf({props:{primary:t[1],$$slots:{default:[$1]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function w1(t){let e;const l=t[18].default,n=Xs(l,t,t[19],Sr);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&eo(n,l,i,i[19],e?xs(l,i[19],o,k1):to(i[19]),Sr)},i(i){e||(M(n,i),e=!0)},o(i){I(n,i),e=!1},d(i){n&&n.d(i)}}}function y1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Cl?Wn(t[10]):t[4],t[12]];var o=t[0];function a(r){let c={};for(let f=0;f{Q(m,1)}),Me()}o?(e=new o(a()),Z(e.$$.fragment),M(e.$$.fragment,1),K(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(r){n||(e&&M(e.$$.fragment,r),n=!0)},o(r){e&&I(e.$$.fragment,r),n=!1},d(r){r&&w(l),e&&Q(e,r)}}}function $1(t){let e,l,n,i;const o=[y1,w1],a=[];function r(c,f){return c[0]!==null?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e===m?a[e].p(c,f):(Pe(),I(a[m],1,1,()=>{a[m]=null}),Me(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function C1(t){let e,l,n,i,o,a=[Un(t[7]),{"data-svnav-route-start":t[5]}],r={};for(let _=0;_{c=null}),Me()),Kt(i,m=Gn(f,[Un(_[7]),{"data-svnav-route-end":_[5]}]))},i(_){o||(M(c),o=!0)},o(_){I(c),o=!1},d(_){_&&w(e),_&&w(l),c&&c.d(_),_&&w(n),_&&w(i)}}}const T1=Df();function S1(t,e,l){let n;const i=["path","component","meta","primary"];let o=as(e,i),a,r,c,f,{$$slots:m={},$$scope:_}=e,{path:h=""}=e,{component:b=null}=e,{meta:d={}}=e,{primary:g=!0}=e;ai(ds,e);const $=T1(),{registerRoute:k,unregisterRoute:T,activeRoute:P,disableInlineStyles:E}=$l(Bn);Vt(t,P,L=>l(16,a=L));const S=Zf();Vt(t,S,L=>l(17,c=L));const N=Kf();Vt(t,N,L=>l(3,r=L));const D=Je(null);let R;const W=Je(),H=Je({});Vt(t,H,L=>l(4,f=L)),ni(Ef,W),ni(Nc,H),ni(Ic,D);const F=g1();return Cl||$c(()=>T($)),t.$$set=L=>{l(24,e=Ht(Ht({},e),rs(L))),l(12,o=as(e,i)),"path"in L&&l(13,h=L.path),"component"in L&&l(0,b=L.component),"meta"in L&&l(14,d=L.meta),"primary"in L&&l(1,g=L.primary),"$$scope"in L&&l(19,_=L.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const L=h==="",G=ri(c,h),j={id:$,path:h,meta:d,default:L,fullPath:L?"":G,base:L?c:Xc(G,r.pathname),primary:g,focusElement:D};W.set(j),l(15,R=k(j))}if(t.$$.dirty&98304&&l(2,n=!!(R||a&&a.id===$)),t.$$.dirty&98308&&n){const{params:L}=R||a;H.set(L)}},e=rs(e),[b,g,n,r,f,$,P,E,S,N,H,F,o,h,d,R,a,c,m,_]}class al extends $e{constructor(e){super(),ye(this,e,S1,C1,ke,{path:13,component:0,meta:14,primary:1})}}function P1(t){let e,l,n,i;const o=t[13].default,a=Xs(o,t,t[12],null);let r=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,_=D));const P=Cc(),E=Jf(),{navigate:S}=Qf();function N(D){P("click",D),Mc(D)&&(D.preventDefault(),S(n,{state:$,replace:a||g}))}return t.$$set=D=>{l(19,e=Ht(Ht({},e),rs(D))),l(18,m=as(e,f)),"to"in D&&l(5,d=D.to),"replace"in D&&l(6,g=D.replace),"state"in D&&l(7,$=D.state),"getProps"in D&&l(8,k=D.getProps),"$$scope"in D&&l(12,b=D.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=E(d,_)),t.$$.dirty&2049&&l(10,i=Ws(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(a=so(n)===Zc(_)),t.$$.dirty&512&&l(2,r=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(Mf(k)){const D=k({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...m,...D}}return m})())},e=rs(e),[n,c,r,T,N,d,g,$,k,o,i,_,b,h]}class yl extends $e{constructor(e){super(),ye(this,e,M1,P1,ke,{to:5,replace:6,state:7,getProps:8})}}let Gs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function wl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function A1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Xf(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function D1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function ps(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return""}}function Ie(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function fe(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Mr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received last 30s";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Ar(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Dr(t){switch(t){case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function jn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function je(t,e){return t==1||t==2&&e}function Ct(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function ii(t,e){return t.setTime(t.getTime()+e*36e5),t}function Nr(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}async function Tl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let zt={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,trying:null};const Tt=Je(zt);async function oo(){zt=await(await Tl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Tt.set(zt)}let is=0,Ir=-127,Er=null,N1={};const I1=If(N1,t=>{let e;async function l(){Tl("/data.json").then(n=>n.json()).then(n=>{t(n),Ir!=n.t&&(Ir=n.t,setTimeout(lc,2e3)),Er!=n.p&&(Er=n.p,setTimeout(E1,4e3)),zt.upgrading?window.location.reload():(!zt||!zt.chip||zt.booting||is>1&&!jn(zt.board))&&(oo(),Yl&&clearTimeout(Yl),Yl=setTimeout(uo,2e3),zl&&clearTimeout(zl),zl=setTimeout(ro,3e3));let i=5e3;if(jn(zt.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),is=0}).catch(n=>{is++,is>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,jn(zt.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Bs={};const xf=Je(Bs);async function E1(){Bs=await(await Tl("/energyprice.json")).json(),xf.set(Bs)}let Ys={},Yl;async function uo(){Yl&&(clearTimeout(Yl),Yl=0),Ys=await(await Tl("/dayplot.json")).json(),ec.set(Ys);let e=new Date;Yl=setTimeout(uo,(60-e.getMinutes())*6e4+20)}const ec=Je(Ys,t=>(uo(),function(){}));let zs={},zl;async function ro(){zl&&(clearTimeout(zl),zl=0),zs=await(await Tl("/monthplot.json")).json(),tc.set(zs);let e=new Date;zl=setTimeout(ro,(24-e.getHours())*36e5+40)}const tc=Je(zs,t=>(ro(),function(){}));let Vs={};async function lc(){Vs=await(await Tl("/temperature.json")).json(),nc.set(Vs)}const nc=Je(Vs,t=>(lc(),function(){}));let Ks={},ss;async function ic(){ss&&(clearTimeout(ss),ss=0),Ks=await(await Tl("/tariff.json")).json(),sc.set(Ks);let e=new Date;ss=setTimeout(ic,(60-e.getMinutes())*6e4+30)}const sc=Je(Ks,t=>function(){});let Qs=[];const ao=Je(Qs);async function R1(){Qs=await(await Tl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),ao.set(Qs)}function ms(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function oc(){await(await fetch("/upgrade",{method:"POST"})).json()}function uc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),a=[...e];a.reverse();let r,c,f;for(let m=0;mo&&(r=_):g==i+1&&(c=_);else if(d==n+1)if(f){let k=f.tag_name.substring(1).split(".");parseInt(k[0]);let T=parseInt(k[1]);parseInt(k[2]),g==T&&(f=_)}else f=_}return c||f||r||!1}else return e[0]}const F1="/github.svg";function Rr(t){let e,l;function n(a,r){return a[1]>1?W1:a[1]>0?j1:a[2]>1?H1:a[2]>0?U1:a[3]>1?O1:a[3]>0?q1:L1}let i=n(t),o=i(t);return{c(){e=C(`Up - `),o.c(),l=We()},m(a,r){y(a,e,r),o.m(a,r),y(a,l,r)},p(a,r){i===(i=n(a))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},d(a){a&&w(e),o.d(a),a&&w(l)}}}function L1(t){let e,l;return{c(){e=C(t[0]),l=C(" seconds")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&1&&B(e,n[0])},d(n){n&&w(e),n&&w(l)}}}function q1(t){let e,l;return{c(){e=C(t[3]),l=C(" minute")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function O1(t){let e,l;return{c(){e=C(t[3]),l=C(" minutes")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function U1(t){let e,l;return{c(){e=C(t[2]),l=C(" hour")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function H1(t){let e,l;return{c(){e=C(t[2]),l=C(" hours")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function j1(t){let e,l;return{c(){e=C(t[1]),l=C(" day")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function W1(t){let e,l;return{c(){e=C(t[1]),l=C(" days")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function G1(t){let e,l=t[0]&&Rr(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Rr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&w(e)}}}function B1(t,e,l){let{epoch:n}=e,i=0,o=0,a=0;return t.$$set=r=>{"epoch"in r&&l(0,n=r.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,a=Math.floor(n/60)))},[n,i,o,a]}class Y1 extends $e{constructor(e){super(),ye(this,e,B1,G1,ke,{epoch:0})}}function z1(t){let e,l,n;return{c(){e=p("span"),l=C(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){y(i,e,o),s(e,l)},p(i,[o]){o&4&&B(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ie,o:ie,d(i){i&&w(e)}}}function V1(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class Qt extends $e{constructor(e){super(),ye(this,e,V1,z1,ke,{color:0,title:1,text:2})}}function K1(t){let e,l=`${Ie(t[0].getDate())}.${Ie(t[0].getMonth())}.${t[0].getFullYear()} ${Ie(t[0].getHours())}:${Ie(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=C(l),u(e,"class",t[1])},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ie(i[0].getDate())}.${Ie(i[0].getMonth())}.${i[0].getFullYear()} ${Ie(i[0].getHours())}:${Ie(i[0].getMinutes())}`)&&B(n,l),o&2&&u(e,"class",i[1])},d(i){i&&w(e)}}}function Q1(t){let e=`${Ie(t[0].getDate())}. ${Gs[t[0].getMonth()]} ${Ie(t[0].getHours())}:${Ie(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&1&&e!==(e=`${Ie(n[0].getDate())}. ${Gs[n[0].getMonth()]} ${Ie(n[0].getHours())}:${Ie(n[0].getMinutes())}`)&&B(l,e)},d(n){n&&w(l)}}}function Z1(t){let e,l;function n(a,r){return r&1&&(e=null),e==null&&(e=Math.abs(new Date().getTime()-a[0].getTime())<3e5),e?Q1:K1}let i=n(t,-1),o=i(t);return{c(){o.c(),l=We()},m(a,r){o.m(a,r),y(a,l,r)},p(a,[r]){i===(i=n(a,r))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},i:ie,o:ie,d(a){o.d(a),a&&w(l)}}}function J1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e;return t.$$set=o=>{"timestamp"in o&&l(0,n=o.timestamp),"fullTimeColor"in o&&l(1,i=o.fullTimeColor)},[n,i]}class rc extends $e{constructor(e){super(),ye(this,e,J1,Z1,ke,{timestamp:0,fullTimeColor:1})}}function X1(t){let e,l,n;return{c(){e=Oe("svg"),l=Oe("path"),n=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){y(i,e,o),s(e,l),s(e,n)},p:ie,i:ie,o:ie,d(i){i&&w(e)}}}class x1 extends $e{constructor(e){super(),ye(this,e,null,X1,ke,{})}}function ep(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&w(e)}}}class tp extends $e{constructor(e){super(),ye(this,e,null,ep,ke,{})}}function lp(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&w(e)}}}class $t extends $e{constructor(e){super(),ye(this,e,null,lp,ke,{})}}function np(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&w(e)}}}class ac extends $e{constructor(e){super(),ye(this,e,null,np,ke,{})}}function ip(t){let e,l,n=t[1].version+"",i;return{c(){e=C("AMS reader "),l=p("span"),i=C(n)},m(o,a){y(o,e,a),y(o,l,a),s(l,i)},p(o,a){a&2&&n!==(n=o[1].version+"")&&B(i,n)},d(o){o&&w(e),o&&w(l)}}}function Fr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=C(l),i=C("\xB0C"),u(e,"class","flex-none my-auto")},m(o,a){y(o,e,a),s(e,n),s(e,i)},p(o,a){a&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&B(n,l)},d(o){o&&w(e)}}}function Lr(t){let e,l="HAN: "+Mr(t[0].he),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Mr(i[0].he))&&B(n,l)},d(i){i&&w(e)}}}function qr(t){let e,l="MQTT: "+Ar(t[0].me),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Ar(i[0].me))&&B(n,l)},d(i){i&&w(e)}}}function Or(t){let e,l="PriceAPI: "+Dr(t[0].ee),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Dr(i[0].ee))&&B(n,l)},d(i){i&&w(e)}}}function Ur(t){let e,l,n,i,o,a;return l=new yl({props:{to:"/configuration",$$slots:{default:[sp]},$$scope:{ctx:t}}}),o=new yl({props:{to:"/status",$$slots:{default:[op]},$$scope:{ctx:t}}}),{c(){e=p("div"),Z(l.$$.fragment),n=v(),i=p("div"),Z(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(r,c){y(r,e,c),K(l,e,null),y(r,n,c),y(r,i,c),K(o,i,null),a=!0},i(r){a||(M(l.$$.fragment,r),M(o.$$.fragment,r),a=!0)},o(r){I(l.$$.fragment,r),I(o.$$.fragment,r),a=!1},d(r){r&&w(e),Q(l),r&&w(n),r&&w(i),Q(o)}}}function sp(t){let e,l;return e=new x1({}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function op(t){let e,l;return e=new tp({}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function Hr(t){let e,l,n,i,o;const a=[rp,up],r=[];function c(f,m){return f[1].security==0||f[0].a?0:1}return l=c(t),n=r[l]=a[l](t),{c(){e=p("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(f,m){y(f,e,m),r[l].m(e,null),o=!0},p(f,m){let _=l;l=c(f),l===_?r[l].p(f,m):(Pe(),I(r[_],1,1,()=>{r[_]=null}),Me(),n=r[l],n?n.p(f,m):(n=r[l]=a[l](f),n.c()),M(n,1),n.m(e,null)),(!o||m&4&&i!==(i="New version: "+f[2].tag_name))&&u(e,"title",i)},i(f){o||(M(n),o=!0)},o(f){I(n),o=!1},d(f){f&&w(e),r[l].d()}}}function up(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=p("span"),l=C("New version: "),i=C(n)},m(o,a){y(o,e,a),s(e,l),s(e,i)},p(o,a){a&4&&n!==(n=o[2].tag_name+"")&&B(i,n)},i:ie,o:ie,d(o){o&&w(e)}}}function rp(t){let e,l,n,i=t[2].tag_name+"",o,a,r,c,f,m;return r=new ac({}),{c(){e=p("button"),l=p("span"),n=C("New version: "),o=C(i),a=v(),Z(r.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(_,h){y(_,e,h),s(e,l),s(l,n),s(l,o),s(e,a),K(r,e,null),c=!0,f||(m=z(e,"click",t[3]),f=!0)},p(_,h){(!c||h&4)&&i!==(i=_[2].tag_name+"")&&B(o,i)},i(_){c||(M(r.$$.fragment,_),c=!0)},o(_){I(r.$$.fragment,_),c=!1},d(_){_&&w(e),Q(r),f=!1,m()}}}function ap(t){let e,l,n,i,o,a,r,c,f,m,_,h,b=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,g,$,k,T,P,E,S,N,D,R,W,H,F,L,G,j,q,O,U,x,X,ne,le,_e,Ce,ve,qe,he,Ee;i=new yl({props:{to:"/",$$slots:{default:[ip]},$$scope:{ctx:t}}}),c=new Y1({props:{epoch:t[0].u}});let be=t[0].t>-50&&Fr(t);T=new Qt({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:wl(t[1].booting?2:t[0].em)}}),E=new Qt({props:{title:"HAN",text:"HAN",color:wl(t[1].booting?9:t[0].hm)}}),N=new Qt({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:wl(t[1].booting?9:t[0].wm)}}),R=new Qt({props:{title:"MQTT",text:"MQTT",color:wl(t[1].booting?9:t[0].mm)}});let Ne=(t[0].he<0||t[0].he>0)&&Lr(t),ce=t[0].me<0&&qr(t),me=(t[0].ee>0||t[0].ee<0)&&Or(t);ne=new rc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),fullTimeColor:"text-red-500"}});let se=t[1].vndcfg&&t[1].usrcfg&&Ur(t);qe=new $t({});let re=t[1].fwconsent===1&&t[2]&&Hr(t);return{c(){e=p("nav"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=v(),a=p("div"),r=p("div"),Z(c.$$.fragment),f=v(),be&&be.c(),m=v(),_=p("div"),h=C("Free mem: "),d=C(b),g=C("kb"),$=v(),k=p("div"),Z(T.$$.fragment),P=v(),Z(E.$$.fragment),S=v(),Z(N.$$.fragment),D=v(),Z(R.$$.fragment),W=v(),Ne&&Ne.c(),H=v(),ce&&ce.c(),F=v(),me&&me.c(),L=v(),G=p("div"),j=p("div"),q=p("a"),O=p("img"),x=v(),X=p("div"),Z(ne.$$.fragment),le=v(),se&&se.c(),_e=v(),Ce=p("div"),ve=p("a"),Z(qe.$$.fragment),he=v(),re&&re.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(r,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(a,"class","flex-none my-auto p-2 flex space-x-4"),u(k,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(O,"class","gh-logo"),vc(O.src,U=F1)||u(O,"src",U),u(O,"alt","GitHub repo"),u(q,"class","float-right"),u(q,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(q,"target","_blank"),u(q,"rel","noreferrer"),u(q,"aria-label","GitHub"),u(j,"class","flex-none"),u(X,"class","flex-none my-auto px-2"),u(ve,"href",Ct("")),u(ve,"target","_blank"),u(ve,"rel","noreferrer"),u(Ce,"class","flex-none px-1 mt-1"),u(Ce,"title","Documentation"),u(G,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(V,ae){y(V,e,ae),s(e,l),s(l,n),K(i,n,null),s(l,o),s(l,a),s(a,r),K(c,r,null),s(a,f),be&&be.m(a,null),s(a,m),s(a,_),s(_,h),s(_,d),s(_,g),s(l,$),s(l,k),K(T,k,null),s(k,P),K(E,k,null),s(k,S),K(N,k,null),s(k,D),K(R,k,null),s(l,W),Ne&&Ne.m(l,null),s(l,H),ce&&ce.m(l,null),s(l,F),me&&me.m(l,null),s(l,L),s(l,G),s(G,j),s(j,q),s(q,O),s(G,x),s(G,X),K(ne,X,null),s(G,le),se&&se.m(G,null),s(G,_e),s(G,Ce),s(Ce,ve),K(qe,ve,null),s(G,he),re&&re.m(G,null),Ee=!0},p(V,[ae]){const Ae={};ae&18&&(Ae.$$scope={dirty:ae,ctx:V}),i.$set(Ae);const te={};ae&1&&(te.epoch=V[0].u),c.$set(te),V[0].t>-50?be?be.p(V,ae):(be=Fr(V),be.c(),be.m(a,m)):be&&(be.d(1),be=null),(!Ee||ae&1)&&b!==(b=(V[0].m?(V[0].m/1e3).toFixed(1):"-")+"")&&B(d,b);const ue={};ae&3&&(ue.text=V[1].booting?"Booting":V[0].v>2?V[0].v.toFixed(2)+"V":"ESP"),ae&3&&(ue.color=wl(V[1].booting?2:V[0].em)),T.$set(ue);const Ue={};ae&3&&(Ue.color=wl(V[1].booting?9:V[0].hm)),E.$set(Ue);const Te={};ae&1&&(Te.text=V[0].r?V[0].r.toFixed(0)+"dBm":"WiFi"),ae&3&&(Te.color=wl(V[1].booting?9:V[0].wm)),N.$set(Te);const de={};ae&3&&(de.color=wl(V[1].booting?9:V[0].mm)),R.$set(de),V[0].he<0||V[0].he>0?Ne?Ne.p(V,ae):(Ne=Lr(V),Ne.c(),Ne.m(l,H)):Ne&&(Ne.d(1),Ne=null),V[0].me<0?ce?ce.p(V,ae):(ce=qr(V),ce.c(),ce.m(l,F)):ce&&(ce.d(1),ce=null),V[0].ee>0||V[0].ee<0?me?me.p(V,ae):(me=Or(V),me.c(),me.m(l,L)):me&&(me.d(1),me=null);const De={};ae&1&&(De.timestamp=V[0].c?new Date(V[0].c*1e3):new Date(0)),ne.$set(De),V[1].vndcfg&&V[1].usrcfg?se?ae&2&&M(se,1):(se=Ur(V),se.c(),M(se,1),se.m(G,_e)):se&&(Pe(),I(se,1,1,()=>{se=null}),Me()),V[1].fwconsent===1&&V[2]?re?(re.p(V,ae),ae&6&&M(re,1)):(re=Hr(V),re.c(),M(re,1),re.m(G,null)):re&&(Pe(),I(re,1,1,()=>{re=null}),Me())},i(V){Ee||(M(i.$$.fragment,V),M(c.$$.fragment,V),M(T.$$.fragment,V),M(E.$$.fragment,V),M(N.$$.fragment,V),M(R.$$.fragment,V),M(ne.$$.fragment,V),M(se),M(qe.$$.fragment,V),M(re),Ee=!0)},o(V){I(i.$$.fragment,V),I(c.$$.fragment,V),I(T.$$.fragment,V),I(E.$$.fragment,V),I(N.$$.fragment,V),I(R.$$.fragment,V),I(ne.$$.fragment,V),I(se),I(qe.$$.fragment,V),I(re),Ee=!1},d(V){V&&w(e),Q(i),Q(c),be&&be.d(),Q(T),Q(E),Q(N),Q(R),Ne&&Ne.d(),ce&&ce.d(),me&&me.d(),Q(ne),se&&se.d(),Q(qe),re&&re.d()}}}function fp(t,e,l){let{data:n={}}=e,i={},o={};function a(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!jn(i.board)||confirm(ms(fe(i.chip,i.board))))&&(Tt.update(r=>(r.upgrading=!0,r)),oc())}return Tt.subscribe(r=>{l(1,i=r),r.fwconsent===1&&R1()}),ao.subscribe(r=>{l(2,o=uc(i.version,r))}),t.$$set=r=>{"data"in r&&l(0,n=r.data)},[n,i,o,a]}class cp extends $e{constructor(e){super(),ye(this,e,fp,ap,ke,{data:0})}}function pp(t){let e,l,n,i;return{c(){e=Oe("svg"),l=Oe("path"),n=Oe("path"),u(l,"d",Os(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Os(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,a){y(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=Os(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),a&2&&u(n,"stroke",o[1])},i:ie,o:ie,d(o){o&&w(e)}}}function jr(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Os(t,e,l,n,i){var o=jr(t,e,l,i),a=jr(t,e,l,n),r=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,r,0,a.x,a.y].join(" ");return c}function mp(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class _p extends $e{constructor(e){super(),ye(this,e,mp,pp,ke,{pct:0,color:1})}}function Wr(t){let e,l,n,i,o,a,r,c;return{c(){e=p("br"),l=v(),n=p("span"),i=C(t[3]),o=v(),a=p("span"),r=C(t[4]),c=C("/kWh"),u(n,"class","pl-sub"),u(a,"class","pl-snt")},m(f,m){y(f,e,m),y(f,l,m),y(f,n,m),s(n,i),y(f,o,m),y(f,a,m),s(a,r),s(a,c)},p(f,m){m&8&&B(i,f[3]),m&16&&B(r,f[4])},d(f){f&&w(e),f&&w(l),f&&w(n),f&&w(o),f&&w(a)}}}function dp(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$;l=new _p({props:{pct:t[6],color:t[5](t[6])}});let k=t[3]&&Wr(t);return{c(){e=p("div"),Z(l.$$.fragment),n=v(),i=p("span"),o=p("span"),a=C(t[2]),r=v(),c=p("br"),f=v(),m=p("span"),_=C(t[0]),h=v(),b=p("span"),d=C(t[1]),g=v(),k&&k.c(),u(o,"class","pl-lab"),u(m,"class","pl-val"),u(b,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(T,P){y(T,e,P),K(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,r),s(i,c),s(i,f),s(i,m),s(m,_),s(i,h),s(i,b),s(b,d),s(i,g),k&&k.m(i,null),$=!0},p(T,[P]){const E={};P&64&&(E.pct=T[6]),P&96&&(E.color=T[5](T[6])),l.$set(E),(!$||P&4)&&B(a,T[2]),(!$||P&1)&&B(_,T[0]),(!$||P&2)&&B(d,T[1]),T[3]?k?k.p(T,P):(k=Wr(T),k.c(),k.m(i,null)):k&&(k.d(1),k=null)},i(T){$||(M(l.$$.fragment,T),$=!0)},o(T){I(l.$$.fragment,T),$=!1},d(T){T&&w(e),Q(l),k&&k.d()}}}function vp(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:r=""}=e,{subunit:c=""}=e,{colorFn:f}=e,m=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,a=_.label),"sub"in _&&l(3,r=_.sub),"subunit"in _&&l(4,c=_.subunit),"colorFn"in _&&l(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,m=Math.min(n,i)/i*100)},[n,o,a,r,c,f,m,i]}class fc extends $e{constructor(e){super(),ye(this,e,vp,dp,ke,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Gr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Br(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Yr(t,e,l){const n=t.slice();return n[13]=e[l],n}function zr(t){let e,l=t[0].title+"",n;return{c(){e=p("strong"),n=C(l),u(e,"class","text-sm")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[0].title+"")&&B(n,l)},d(i){i&&w(e)}}}function Vr(t){let e,l,n,i=t[13].label+"",o,a,r,c;return{c(){e=Oe("g"),l=Oe("line"),n=Oe("text"),o=C(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",a=t[13].align=="right"?"85%":""),u(e,"class",r="tick tick-"+t[13].value+" tick-"+t[13].color),u(e,"transform",c="translate(0, "+t[6](t[13].value)+")")},m(f,m){y(f,e,m),s(e,l),s(e,n),s(n,o)},p(f,m){m&1&&i!==(i=f[13].label+"")&&B(o,i),m&1&&a!==(a=f[13].align=="right"?"85%":"")&&u(n,"x",a),m&1&&r!==(r="tick tick-"+f[13].value+" tick-"+f[13].color)&&u(e,"class",r),m&65&&c!==(c="translate(0, "+f[6](f[13].value)+")")&&u(e,"transform",c)},d(f){f&&w(e)}}}function Kr(t){let e,l,n=t[9].label+"",i,o,a;return{c(){e=Oe("g"),l=Oe("text"),i=C(n),u(l,"x",o=t[3]/2),u(l,"y","-4"),u(e,"class","tick"),u(e,"transform",a="translate("+t[5](t[11])+","+t[4]+")")},m(r,c){y(r,e,c),s(e,l),s(l,i)},p(r,c){c&1&&n!==(n=r[9].label+"")&&B(i,n),c&8&&o!==(o=r[3]/2)&&u(l,"x",o),c&48&&a!==(a="translate("+r[5](r[11])+","+r[4]+")")&&u(e,"transform",a)},d(r){r&&w(e)}}}function Qr(t){let e,l,n,i,o,a,r,c=t[3]>15&&Zr(t);return{c(){e=Oe("rect"),c&&c.c(),r=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](t[9].value)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),u(e,"fill",a=t[9].color)},m(f,m){y(f,e,m),c&&c.m(f,m),y(f,r,m)},p(f,m){m&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),m&65&&n!==(n=f[6](f[9].value))&&u(e,"y",n),m&8&&i!==(i=f[3]-4)&&u(e,"width",i),m&65&&o!==(o=f[6](f[0].y.min)-f[6](Math.min(f[0].y.min,0)+f[9].value))&&u(e,"height",o),m&1&&a!==(a=f[9].color)&&u(e,"fill",a),f[3]>15?c?c.p(f,m):(c=Zr(f),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(r)}}}function Zr(t){let e,l=t[9].label+"",n,i,o,a,r,c,f;return{c(){e=Oe("text"),n=C(l),u(e,"y",i=t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10),u(e,"x",o=t[5](t[11])+t[3]/2),u(e,"width",a=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",r=t[3]<25?"left":"middle"),u(e,"fill",c=t[6](t[9].value)>t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",f="rotate("+(t[3]<25?90:0)+", "+(t[5](t[11])+t[3]/2)+", "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+9)+")")},m(m,_){y(m,e,_),s(e,n)},p(m,_){_&1&&l!==(l=m[9].label+"")&&B(n,l),_&193&&i!==(i=m[6](m[9].value)>m[6](0)-m[7]?m[6](m[9].value)-m[7]:m[6](m[9].value)+10)&&u(e,"y",i),_&40&&o!==(o=m[5](m[11])+m[3]/2)&&u(e,"x",o),_&8&&a!==(a=m[3]-4)&&u(e,"width",a),_&8&&r!==(r=m[3]<25?"left":"middle")&&u(e,"text-anchor",r),_&193&&c!==(c=m[6](m[9].value)>m[6](0)-m[7]?m[9].color:"white")&&u(e,"fill",c),_&233&&f!==(f="rotate("+(m[3]<25?90:0)+", "+(m[5](m[11])+m[3]/2)+", "+(m[6](m[9].value)>m[6](0)-m[7]?m[6](m[9].value)-m[7]:m[6](m[9].value)+9)+")")&&u(e,"transform",f)},d(m){m&&w(e)}}}function Jr(t){let e,l,n,i,o,a,r,c=t[3]>15&&Xr(t);return{c(){e=Oe("rect"),c&&c.c(),r=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](0)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),u(e,"fill",a=t[9].color)},m(f,m){y(f,e,m),c&&c.m(f,m),y(f,r,m)},p(f,m){m&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),m&64&&n!==(n=f[6](0))&&u(e,"y",n),m&8&&i!==(i=f[3]-4)&&u(e,"width",i),m&65&&o!==(o=f[6](f[0].y.min)-f[6](f[0].y.min+f[9].value2))&&u(e,"height",o),m&1&&a!==(a=f[9].color)&&u(e,"fill",a),f[3]>15?c?c.p(f,m):(c=Xr(f),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(r)}}}function Xr(t){let e,l=t[9].label2+"",n,i,o,a,r,c,f;return{c(){e=Oe("text"),n=C(l),u(e,"y",i=t[6](-t[9].value2)t[6](0)-12?t[6](t[9].value2-t[0].y.min)-12:t[6](t[9].value2-t[0].y.min)+9)+")")},m(m,_){y(m,e,_),s(e,n)},p(m,_){_&1&&l!==(l=m[9].label2+"")&&B(n,l),_&65&&i!==(i=m[6](-m[9].value2)m[6](0)-12?m[6](m[9].value2-m[0].y.min)-12:m[6](m[9].value2-m[0].y.min)+9)+")")&&u(e,"transform",f)},d(m){m&&w(e)}}}function xr(t){let e,l,n=t[9].value!==void 0&&Qr(t),i=t[9].value2>1e-4&&Jr(t);return{c(){n&&n.c(),e=We(),i&&i.c(),l=We()},m(o,a){n&&n.m(o,a),y(o,e,a),i&&i.m(o,a),y(o,l,a)},p(o,a){o[9].value!==void 0?n?n.p(o,a):(n=Qr(o),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,a):(i=Jr(o),i.c(),i.m(l.parentNode,l)):i&&(i.d(1),i=null)},d(o){n&&n.d(o),o&&w(e),i&&i.d(o),o&&w(l)}}}function hp(t){let e,l,n,i,o,a,r,c=t[0].title&&zr(t),f=t[0].y.ticks,m=[];for(let g=0;gt[8].call(e))},m(g,$){y(g,e,$),c&&c.m(e,null),s(e,l),s(e,n),s(n,i);for(let k=0;k{"config"in h&&l(0,n=h.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,f=o-(n.title?20:0));let h=i-(n.padding.left+n.padding.right);l(3,a=h/n.points.length),l(7,m=a<25?28:17);let b=(f-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,r=function(d){return d*a+n.padding.left}),l(6,c=function(d){let g=0;return d>n.y.max?g=n.padding.bottom:df||g<0?0:g})}},[n,i,o,a,f,r,c,m,_]}class Kl extends $e{constructor(e){super(),ye(this,e,bp,hp,ke,{config:0})}}function gp(t){let e,l;return e=new Kl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function kp(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:a}=e,r={};function c(f){return{label:ge(f)+"V",value:isNaN(f)?0:f,color:A1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,a=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],m=[];n>0&&(f.push({label:a===1?"L1-L2":"L1"}),m.push(c(n))),i>0&&(f.push({label:a===1?"L1-L3":"L2"}),m.push(c(i))),o>0&&(f.push({label:a===1?"L2-L3":"L3"}),m.push(c(o))),l(0,r={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:m})}},[r,n,i,o,a]}class wp extends $e{constructor(e){super(),ye(this,e,kp,gp,ke,{u1:1,u2:2,u3:3,ds:4})}}function yp(t){let e,l;return e=new Kl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function $p(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:a}=e,{i2:r}=e,{i3:c}=e,{max:f}=e,m={};function _(h){return{label:ge(h)+"A",value:isNaN(h)?0:h,color:Xf(h?h/f*100:0)}}return t.$$set=h=>{"u1"in h&&l(1,n=h.u1),"u2"in h&&l(2,i=h.u2),"u3"in h&&l(3,o=h.u3),"i1"in h&&l(4,a=h.i1),"i2"in h&&l(5,r=h.i2),"i3"in h&&l(6,c=h.i3),"max"in h&&l(7,f=h.max)},t.$$.update=()=>{if(t.$$.dirty&254){let h=[],b=[];n>0&&(h.push({label:"L1"}),b.push(_(a))),i>0&&(h.push({label:"L2"}),b.push(_(r))),o>0&&(h.push({label:"L3"}),b.push(_(c))),l(0,m={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:f,ticks:[{value:0,label:"0%"},{value:f/4,label:"25%"},{value:f/2,label:"50%"},{value:f/4*3,label:"75%"},{value:f,label:"100%"}]},x:{ticks:h},points:b})}},[m,n,i,o,a,r,c,f]}class Cp extends $e{constructor(e){super(),ye(this,e,$p,yp,ke,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function Tp(t){let e,l,n,i,o,a,r,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,m,_,h,b,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",$,k,T,P,E,S,N,D=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",R,W,H,F,L,G,j=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",q,O;return{c(){e=p("div"),l=p("strong"),l.textContent="Reactive",n=v(),i=p("div"),o=p("div"),o.textContent="Instant in",a=v(),r=p("div"),f=C(c),m=C(" VAr"),_=v(),h=p("div"),h.textContent="Instant out",b=v(),d=p("div"),$=C(g),k=C(" VAr"),T=v(),P=p("div"),E=p("div"),E.textContent="Total in",S=v(),N=p("div"),R=C(D),W=C(" kVArh"),H=v(),F=p("div"),F.textContent="Total out",L=v(),G=p("div"),q=C(j),O=C(" kVArh"),u(r,"class","text-right"),u(d,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(N,"class","text-right"),u(G,"class","text-right"),u(P,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(U,x){y(U,e,x),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(i,r),s(r,f),s(r,m),s(i,_),s(i,h),s(i,b),s(i,d),s(d,$),s(d,k),s(e,T),s(e,P),s(P,E),s(P,S),s(P,N),s(N,R),s(N,W),s(P,H),s(P,F),s(P,L),s(P,G),s(G,q),s(G,O)},p(U,[x]){x&1&&c!==(c=(typeof U[0]<"u"?U[0].toFixed(0):"-")+"")&&B(f,c),x&2&&g!==(g=(typeof U[1]<"u"?U[1].toFixed(0):"-")+"")&&B($,g),x&4&&D!==(D=(typeof U[2]<"u"?U[2].toFixed(1):"-")+"")&&B(R,D),x&8&&j!==(j=(typeof U[3]<"u"?U[3].toFixed(1):"-")+"")&&B(q,j)},i:ie,o:ie,d(U){U&&w(e)}}}function Sp(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e;return t.$$set=r=>{"importInstant"in r&&l(0,n=r.importInstant),"exportInstant"in r&&l(1,i=r.exportInstant),"importTotal"in r&&l(2,o=r.importTotal),"exportTotal"in r&&l(3,a=r.exportTotal)},[n,i,o,a]}class Pp extends $e{constructor(e){super(),ye(this,e,Sp,Tp,ke,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function ea(t){let e;function l(o,a){return o[2]?Ap:Mp}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,a){i.m(o,a),y(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&w(e)}}}function Mp(t){let e,l,n,i,o,a,r=ge(t[0].h.u,2)+"",c,f,m,_,h,b,d=ge(t[0].d.u,1)+"",g,$,k,T,P,E,S=ge(t[0].m.u)+"",N,D,R,W,H=t[1]&&ta(t);return{c(){e=p("strong"),e.textContent="Consumption",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=C(" kWh"),m=v(),_=p("div"),_.textContent="Day",h=v(),b=p("div"),g=C(d),$=C(" kWh"),k=v(),T=p("div"),T.textContent="Month",P=v(),E=p("div"),N=C(S),D=C(" kWh"),R=v(),H&&H.c(),W=We(),u(a,"class","text-right"),u(b,"class","text-right"),u(E,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(F,L){y(F,e,L),y(F,l,L),y(F,n,L),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,m),s(n,_),s(n,h),s(n,b),s(b,g),s(b,$),s(n,k),s(n,T),s(n,P),s(n,E),s(E,N),s(E,D),y(F,R,L),H&&H.m(F,L),y(F,W,L)},p(F,L){L&1&&r!==(r=ge(F[0].h.u,2)+"")&&B(c,r),L&1&&d!==(d=ge(F[0].d.u,1)+"")&&B(g,d),L&1&&S!==(S=ge(F[0].m.u)+"")&&B(N,S),F[1]?H?H.p(F,L):(H=ta(F),H.c(),H.m(W.parentNode,W)):H&&(H.d(1),H=null)},d(F){F&&w(e),F&&w(l),F&&w(n),F&&w(R),H&&H.d(F),F&&w(W)}}}function Ap(t){let e,l,n,i,o,a,r=ge(t[0].h.u,2)+"",c,f,m,_,h,b,d,g=ge(t[0].d.u,1)+"",$,k,T,P,E,S,N,D=ge(t[0].m.u)+"",R,W,H,F,L,G,j,q,O,U,x,X=ge(t[0].h.p,2)+"",ne,le,_e,Ce,ve,qe,he,Ee=ge(t[0].d.p,1)+"",be,Ne,ce,me,se,re,V,ae=ge(t[0].m.p)+"",Ae,te,ue,Ue,Te=t[1]&&la(t),de=t[1]&&na(t),De=t[1]&&ia(t),Le=t[1]&&sa(t),Se=t[1]&&oa(t),we=t[1]&&ua(t);return{c(){e=p("strong"),e.textContent="Import",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=C(" kWh"),m=v(),Te&&Te.c(),_=v(),h=p("div"),h.textContent="Day",b=v(),d=p("div"),$=C(g),k=C(" kWh"),T=v(),de&&de.c(),P=v(),E=p("div"),E.textContent="Month",S=v(),N=p("div"),R=C(D),W=C(" kWh"),H=v(),De&&De.c(),L=v(),G=p("strong"),G.textContent="Export",j=v(),q=p("div"),O=p("div"),O.textContent="Hour",U=v(),x=p("div"),ne=C(X),le=C(" kWh"),_e=v(),Le&&Le.c(),Ce=v(),ve=p("div"),ve.textContent="Day",qe=v(),he=p("div"),be=C(Ee),Ne=C(" kWh"),ce=v(),Se&&Se.c(),me=v(),se=p("div"),se.textContent="Month",re=v(),V=p("div"),Ae=C(ae),te=C(" kWh"),ue=v(),we&&we.c(),u(a,"class","text-right"),u(d,"class","text-right"),u(N,"class","text-right"),u(n,"class",F="grid grid-cols-"+t[3]+" mb-3"),u(x,"class","text-right"),u(he,"class","text-right"),u(V,"class","text-right"),u(q,"class",Ue="grid grid-cols-"+t[3])},m(J,oe){y(J,e,oe),y(J,l,oe),y(J,n,oe),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,m),Te&&Te.m(n,null),s(n,_),s(n,h),s(n,b),s(n,d),s(d,$),s(d,k),s(n,T),de&&de.m(n,null),s(n,P),s(n,E),s(n,S),s(n,N),s(N,R),s(N,W),s(n,H),De&&De.m(n,null),y(J,L,oe),y(J,G,oe),y(J,j,oe),y(J,q,oe),s(q,O),s(q,U),s(q,x),s(x,ne),s(x,le),s(q,_e),Le&&Le.m(q,null),s(q,Ce),s(q,ve),s(q,qe),s(q,he),s(he,be),s(he,Ne),s(q,ce),Se&&Se.m(q,null),s(q,me),s(q,se),s(q,re),s(q,V),s(V,Ae),s(V,te),s(q,ue),we&&we.m(q,null)},p(J,oe){oe&1&&r!==(r=ge(J[0].h.u,2)+"")&&B(c,r),J[1]?Te?Te.p(J,oe):(Te=la(J),Te.c(),Te.m(n,_)):Te&&(Te.d(1),Te=null),oe&1&&g!==(g=ge(J[0].d.u,1)+"")&&B($,g),J[1]?de?de.p(J,oe):(de=na(J),de.c(),de.m(n,P)):de&&(de.d(1),de=null),oe&1&&D!==(D=ge(J[0].m.u)+"")&&B(R,D),J[1]?De?De.p(J,oe):(De=ia(J),De.c(),De.m(n,null)):De&&(De.d(1),De=null),oe&8&&F!==(F="grid grid-cols-"+J[3]+" mb-3")&&u(n,"class",F),oe&1&&X!==(X=ge(J[0].h.p,2)+"")&&B(ne,X),J[1]?Le?Le.p(J,oe):(Le=sa(J),Le.c(),Le.m(q,Ce)):Le&&(Le.d(1),Le=null),oe&1&&Ee!==(Ee=ge(J[0].d.p,1)+"")&&B(be,Ee),J[1]?Se?Se.p(J,oe):(Se=oa(J),Se.c(),Se.m(q,me)):Se&&(Se.d(1),Se=null),oe&1&&ae!==(ae=ge(J[0].m.p)+"")&&B(Ae,ae),J[1]?we?we.p(J,oe):(we=ua(J),we.c(),we.m(q,null)):we&&(we.d(1),we=null),oe&8&&Ue!==(Ue="grid grid-cols-"+J[3])&&u(q,"class",Ue)},d(J){J&&w(e),J&&w(l),J&&w(n),Te&&Te.d(),de&&de.d(),De&&De.d(),J&&w(L),J&&w(G),J&&w(j),J&&w(q),Le&&Le.d(),Se&&Se.d(),we&&we.d()}}}function ta(t){let e,l,n,i,o,a,r=ge(t[0].h.c,2)+"",c,f,m,_,h,b,d,g=ge(t[0].d.c,1)+"",$,k,T,P,E,S,N,D=ge(t[0].m.c)+"",R,W,H;return{c(){e=p("strong"),e.textContent="Cost",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=v(),m=C(t[1]),_=v(),h=p("div"),h.textContent="Day",b=v(),d=p("div"),$=C(g),k=v(),T=C(t[1]),P=v(),E=p("div"),E.textContent="Month",S=v(),N=p("div"),R=C(D),W=v(),H=C(t[1]),u(a,"class","text-right"),u(d,"class","text-right"),u(N,"class","text-right"),u(n,"class","grid grid-cols-2")},m(F,L){y(F,e,L),y(F,l,L),y(F,n,L),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(a,m),s(n,_),s(n,h),s(n,b),s(n,d),s(d,$),s(d,k),s(d,T),s(n,P),s(n,E),s(n,S),s(n,N),s(N,R),s(N,W),s(N,H)},p(F,L){L&1&&r!==(r=ge(F[0].h.c,2)+"")&&B(c,r),L&2&&B(m,F[1]),L&1&&g!==(g=ge(F[0].d.c,1)+"")&&B($,g),L&2&&B(T,F[1]),L&1&&D!==(D=ge(F[0].m.c)+"")&&B(R,D),L&2&&B(H,F[1])},d(F){F&&w(e),F&&w(l),F&&w(n)}}}function la(t){let e,l=ge(t[0].h.c,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=ge(a[0].h.c,2)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function na(t){let e,l=ge(t[0].d.c,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=ge(a[0].d.c,1)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function ia(t){let e,l=ge(t[0].m.c)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=ge(a[0].m.c)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function sa(t){let e,l=ge(t[0].h.i,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=ge(a[0].h.i,2)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function oa(t){let e,l=ge(t[0].d.i,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=ge(a[0].d.i,1)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function ua(t){let e,l=ge(t[0].m.i)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=ge(a[0].m.i)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function Dp(t){let e,l,n,i,o,a,r=t[0]&&ea(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Real time calculation",n=v(),i=p("br"),o=p("br"),a=v(),r&&r.c(),u(e,"class","mx-2 text-sm")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),r&&r.m(e,null)},p(c,[f]){c[0]?r?r.p(c,f):(r=ea(c),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},i:ie,o:ie,d(c){c&&w(e),r&&r.d()}}}function Np(t,e,l){let{data:n}=e,{currency:i}=e,{hasExport:o}=e,a=3;return t.$$set=r=>{"data"in r&&l(0,n=r.data),"currency"in r&&l(1,i=r.currency),"hasExport"in r&&l(2,o=r.hasExport)},t.$$.update=()=>{t.$$.dirty&2&&l(3,a=i?3:2)},[n,i,o,a]}class Ip extends $e{constructor(e){super(),ye(this,e,Np,Dp,ke,{data:0,currency:1,hasExport:2})}}function Ep(t){let e,l,n,i;return n=new Kl({props:{config:t[0]}}),{c(){e=p("a"),e.textContent="Provided by ENTSO-E",l=v(),Z(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,a){y(o,e,a),y(o,l,a),K(n,o,a),i=!0},p(o,[a]){const r={};a&1&&(r.config=o[0]),n.$set(r)},i(o){i||(M(n.$$.fragment,o),i=!0)},o(o){I(n.$$.fragment,o),i=!1},d(o){o&&w(e),o&&w(l),Q(n,o)}}}function Rp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=new Date().getUTCHours(),c=0,f=0,m=0,_=n[20]==null?2:1,h=[],b=[],d=[],g=new Date;for(c=r;c<24&&(f=n[Ie(m++)],f!=null);c++)b.push({label:Ie(g.getHours())}),d.push({label:f>0?f.toFixed(_):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(_):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,a=Math.min(a,f*100)),l(2,o=Math.max(o,f*100)),ii(g,1);for(c=0;c<24&&(f=n[Ie(m++)],f!=null);c++)b.push({label:Ie(g.getHours())}),d.push({label:f>0?f.toFixed(_):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(_):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,a=Math.min(a,f*100)),l(2,o=Math.max(o,f*100)),ii(g,1);if(l(2,o=Math.ceil(o)),l(3,a=Math.floor(a)),a<0){let k=a/4;for(c=1;c<5;c++){let T=k*c;h.push({value:T,label:(T/100).toFixed(2)})}}let $=o/4;for(c=0;c<5;c++){let k=$*c;h.push({value:k,label:(k/100).toFixed(2)})}l(0,i={title:"Future energy price ("+n.currency+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:h},x:{ticks:b},points:d})}},[i,n,o,a]}class Fp extends $e{constructor(e){super(),ye(this,e,Rp,Ep,ke,{json:1})}}function Lp(t){let e,l;return e=new Kl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function qp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=[],f=[],m=[],_=ii(new Date,-24),h=new Date().getUTCHours();for(r=h;r<24;r++){let g=n["i"+Ie(r)],$=n["e"+Ie(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(_.getHours())}),m.push({label:g.toFixed(1),value:g*10,label2:$.toFixed(1),value2:$*10,color:"#7c3aed"}),l(3,a=Math.max(a,$*10)),l(2,o=Math.max(o,g*10)),ii(_,1)}for(r=0;r{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=[],f=[],m=[],_=new Date,h=new Date;for(h.setDate(0),r=_.getDate();r<=h.getDate();r++){let g=n["i"+Ie(r)],$=n["e"+Ie(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(r)}),m.push({label:g.toFixed(0),value:g,label2:$.toFixed(0),value2:$,color:"#7c3aed"}),l(3,a=Math.max(a,$)),l(2,o=Math.max(o,g))}for(r=1;r<_.getDate();r++){let g=n["i"+Ie(r)],$=n["e"+Ie(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(r)}),m.push({label:g.toFixed(0),value:g,label2:$.toFixed(0),value2:$,color:"#7c3aed"}),l(3,a=Math.max(a,$)),l(2,o=Math.max(o,g))}let b=Math.ceil(Math.max(a,o)/10)*10;if(l(2,o=b),l(3,a=a==0?0:b*-1),a<0){let g=a/4;for(r=0;r<5;r++){let $=g*r;c.push({value:$,label:$.toFixed(0)})}}let d=o/4;for(r=0;r<5;r++){let g=d*r;c.push({value:g,label:g.toFixed(0)})}l(0,i={title:"Energy use last month (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:c},x:{ticks:f},points:m})}},[i,n,o,a]}class jp extends $e{constructor(e){super(),ye(this,e,Hp,Up,ke,{json:1})}}function Wp(t){let e,l;return e=new Kl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function Gp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=0,f=[],m=[],_=[];n.s&&n.s.forEach((d,g)=>{var $=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),m.push({label:$.slice(-4)}),_.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,a=Math.min(a,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,a=Math.floor(a));let h=o;a<0&&(h+=Math.abs(a));let b=h/4;for(r=0;r<5;r++)c=a+b*r,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:f},x:{ticks:m},points:_})}},[i,n,o,a]}class Bp extends $e{constructor(e){super(),ye(this,e,Gp,Wp,ke,{json:1})}}function Yp(t){let e,l;return e=new Kl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}let zp=0;function Vp(t,e,l){let n={},i=0,o;return sc.subscribe(a=>{l(2,o=a)}),ic(),t.$$.update=()=>{if(t.$$.dirty&6){let a=0,r=[],c=[],f=[];if(r.push({value:0,label:0}),o&&o.p)for(a=0;a0?Ie(m.d)+"."+Gs[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,m.v))}if(o&&o.t){for(a=0;a=i)break;r.push({value:m,label:m})}r.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(r.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:zp,max:i,ticks:r},x:{ticks:c},points:f})}},[n,i,o]}class Kp extends $e{constructor(e){super(),ye(this,e,Vp,Yp,ke,{})}}function ra(t){let e,l,n,i,o,a,r=(t[0].mt?ps(t[0].mt):"-")+"",c,f,m,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",h,b,d;return i=new fc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[2].currency,colorFn:Xf}}),{c(){e=p("div"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=v(),a=p("div"),c=C(r),f=v(),m=p("div"),h=C(_),b=C(" kWh"),u(n,"class","col-span-2"),u(m,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,$){y(g,e,$),s(e,l),s(l,n),K(i,n,null),s(l,o),s(l,a),s(a,c),s(l,f),s(l,m),s(m,h),s(m,b),d=!0},p(g,$){const k={};$&1&&(k.val=g[0].i?g[0].i:0),$&1&&(k.max=g[0].im?g[0].im:15e3),$&1&&(k.sub=g[0].p),$&4&&(k.subunit=g[2].currency),i.$set(k),(!d||$&1)&&r!==(r=(g[0].mt?ps(g[0].mt):"-")+"")&&B(c,r),(!d||$&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&B(h,_)},i(g){d||(M(i.$$.fragment,g),d=!0)},o(g){I(i.$$.fragment,g),d=!1},d(g){g&&w(e),Q(i)}}}function aa(t){let e,l,n,i,o,a,r,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",m,_,h;return i=new fc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:D1}}),{c(){e=p("div"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=v(),a=p("div"),r=v(),c=p("div"),m=C(f),_=C(" kWh"),u(n,"class","col-span-2"),u(c,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(b,d){y(b,e,d),s(e,l),s(l,n),K(i,n,null),s(l,o),s(l,a),s(l,r),s(l,c),s(c,m),s(c,_),h=!0},p(b,d){const g={};d&1&&(g.val=b[0].e?b[0].e:0),d&1&&(g.max=b[0].om?b[0].om*1e3:1e4),i.$set(g),(!h||d&1)&&f!==(f=(b[0].ec?b[0].ec.toFixed(1):"-")+"")&&B(m,f)},i(b){h||(M(i.$$.fragment,b),h=!0)},o(b){I(i.$$.fragment,b),h=!1},d(b){b&&w(e),Q(i)}}}function fa(t){let e,l,n;return l=new wp({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),K(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.ds=i[0].ds),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Q(l)}}}function ca(t){let e,l,n;return l=new Cp({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),K(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.i1=i[0].i1),o&1&&(a.i2=i[0].i2),o&1&&(a.i3=i[0].i3),o&1&&(a.max=i[0].mf?i[0].mf:32),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Q(l)}}}function pa(t){let e,l,n;return l=new Pp({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),K(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Q(l)}}}function ma(t){let e,l,n;return l=new Ip({props:{data:t[0].ea,currency:t[2].currency,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),K(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.data=i[0].ea),o&4&&(a.currency=i[2].currency),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Q(l)}}}function _a(t){let e,l,n;return l=new Kp({}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){y(i,e,o),K(l,e,null),n=!0},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Q(l)}}}function da(t){let e,l,n;return l=new Fp({props:{json:t[2]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),K(l,e,null),n=!0},p(i,o){const a={};o&4&&(a.json=i[2]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Q(l)}}}function va(t){let e,l,n;return l=new Op({props:{json:t[3]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),K(l,e,null),n=!0},p(i,o){const a={};o&8&&(a.json=i[3]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Q(l)}}}function ha(t){let e,l,n;return l=new jp({props:{json:t[4]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),K(l,e,null),n=!0},p(i,o){const a={};o&16&&(a.json=i[4]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Q(l)}}}function ba(t){let e,l,n;return l=new Bp({props:{json:t[5]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),K(l,e,null),n=!0},p(i,o){const a={};o&32&&(a.json=i[5]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Q(l)}}}function Qp(t){let e,l=je(t[1].ui.i,t[0].i),n,i=je(t[1].ui.e,t[0].om||t[0].e>0),o,a=je(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),r,c=je(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,m=je(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,h=je(t[1].ui.c,t[0].ea),b,d=je(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,$=je(t[1].ui.p,typeof t[0].p=="number"&&!Number.isNaN(t[0].p)),k,T=je(t[1].ui.d,t[3]),P,E=je(t[1].ui.m,t[4]),S,N=je(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),D,R=l&&ra(t),W=i&&aa(t),H=a&&fa(t),F=c&&ca(t),L=m&&pa(t),G=h&&ma(t),j=d&&_a(),q=$&&da(t),O=T&&va(t),U=E&&ha(t),x=N&&ba(t);return{c(){e=p("div"),R&&R.c(),n=v(),W&&W.c(),o=v(),H&&H.c(),r=v(),F&&F.c(),f=v(),L&&L.c(),_=v(),G&&G.c(),b=v(),j&&j.c(),g=v(),q&&q.c(),k=v(),O&&O.c(),P=v(),U&&U.c(),S=v(),x&&x.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(X,ne){y(X,e,ne),R&&R.m(e,null),s(e,n),W&&W.m(e,null),s(e,o),H&&H.m(e,null),s(e,r),F&&F.m(e,null),s(e,f),L&&L.m(e,null),s(e,_),G&&G.m(e,null),s(e,b),j&&j.m(e,null),s(e,g),q&&q.m(e,null),s(e,k),O&&O.m(e,null),s(e,P),U&&U.m(e,null),s(e,S),x&&x.m(e,null),D=!0},p(X,[ne]){ne&3&&(l=je(X[1].ui.i,X[0].i)),l?R?(R.p(X,ne),ne&3&&M(R,1)):(R=ra(X),R.c(),M(R,1),R.m(e,n)):R&&(Pe(),I(R,1,1,()=>{R=null}),Me()),ne&3&&(i=je(X[1].ui.e,X[0].om||X[0].e>0)),i?W?(W.p(X,ne),ne&3&&M(W,1)):(W=aa(X),W.c(),M(W,1),W.m(e,o)):W&&(Pe(),I(W,1,1,()=>{W=null}),Me()),ne&3&&(a=je(X[1].ui.v,X[0].u1>100||X[0].u2>100||X[0].u3>100)),a?H?(H.p(X,ne),ne&3&&M(H,1)):(H=fa(X),H.c(),M(H,1),H.m(e,r)):H&&(Pe(),I(H,1,1,()=>{H=null}),Me()),ne&3&&(c=je(X[1].ui.a,X[0].i1>.01||X[0].i2>.01||X[0].i3>.01)),c?F?(F.p(X,ne),ne&3&&M(F,1)):(F=ca(X),F.c(),M(F,1),F.m(e,f)):F&&(Pe(),I(F,1,1,()=>{F=null}),Me()),ne&3&&(m=je(X[1].ui.r,X[0].ri>0||X[0].re>0||X[0].ric>0||X[0].rec>0)),m?L?(L.p(X,ne),ne&3&&M(L,1)):(L=pa(X),L.c(),M(L,1),L.m(e,_)):L&&(Pe(),I(L,1,1,()=>{L=null}),Me()),ne&3&&(h=je(X[1].ui.c,X[0].ea)),h?G?(G.p(X,ne),ne&3&&M(G,1)):(G=ma(X),G.c(),M(G,1),G.m(e,b)):G&&(Pe(),I(G,1,1,()=>{G=null}),Me()),ne&3&&(d=je(X[1].ui.t,X[0].pr&&(X[0].pr.startsWith("10YNO")||X[0].pr=="10Y1001A1001A48H"))),d?j?ne&3&&M(j,1):(j=_a(),j.c(),M(j,1),j.m(e,g)):j&&(Pe(),I(j,1,1,()=>{j=null}),Me()),ne&3&&($=je(X[1].ui.p,typeof X[0].p=="number"&&!Number.isNaN(X[0].p))),$?q?(q.p(X,ne),ne&3&&M(q,1)):(q=da(X),q.c(),M(q,1),q.m(e,k)):q&&(Pe(),I(q,1,1,()=>{q=null}),Me()),ne&10&&(T=je(X[1].ui.d,X[3])),T?O?(O.p(X,ne),ne&10&&M(O,1)):(O=va(X),O.c(),M(O,1),O.m(e,P)):O&&(Pe(),I(O,1,1,()=>{O=null}),Me()),ne&18&&(E=je(X[1].ui.m,X[4])),E?U?(U.p(X,ne),ne&18&&M(U,1)):(U=ha(X),U.c(),M(U,1),U.m(e,S)):U&&(Pe(),I(U,1,1,()=>{U=null}),Me()),ne&35&&(N=je(X[1].ui.s,X[0].t&&X[0].t!=-127&&X[5].c>1)),N?x?(x.p(X,ne),ne&35&&M(x,1)):(x=ba(X),x.c(),M(x,1),x.m(e,null)):x&&(Pe(),I(x,1,1,()=>{x=null}),Me())},i(X){D||(M(R),M(W),M(H),M(F),M(L),M(G),M(j),M(q),M(O),M(U),M(x),D=!0)},o(X){I(R),I(W),I(H),I(F),I(L),I(G),I(j),I(q),I(O),I(U),I(x),D=!1},d(X){X&&w(e),R&&R.d(),W&&W.d(),H&&H.d(),F&&F.d(),L&&L.d(),G&&G.d(),j&&j.d(),q&&q.d(),O&&O.d(),U&&U.d(),x&&x.d()}}}function Zp(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},a={},r={},c={};return xf.subscribe(f=>{l(2,o=f)}),ec.subscribe(f=>{l(3,a=f)}),tc.subscribe(f=>{l(4,r=f)}),nc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,a,r,c]}class Jp extends $e{constructor(e){super(),ye(this,e,Zp,Qp,ke,{data:0,sysinfo:1})}}let Zs={};const cc=Je(Zs);async function Xp(){Zs=await(await fetch("/configuration.json")).json(),cc.set(Zs)}function ga(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function xp(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function em(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function ka(t){let e;return{c(){e=p("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function wa(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART1",l=v(),n=p("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){y(i,e,o),y(i,l,o),y(i,n,o)},d(i){i&&w(e),i&&w(l),i&&w(n)}}}function ya(t){let e;return{c(){e=p("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function $a(t){let e,l,n;return{c(){e=p("option"),l=C("GPIO"),n=C(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){y(i,e,o),s(e,l),s(e,n)},d(i){i&&w(e)}}}function Ca(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&$a(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=$a(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&w(e)}}}function tm(t){let e,l,n,i,o;function a(d,g){return d[0]=="esp32c3"?em:xp}let r=a(t),c=r(t),f=t[0]=="esp8266"&&ka(),m=(t[0]=="esp32"||t[0]=="esp32solo")&&wa(),_=t[0]=="esp32s2"&&ya(),h={length:t[1]+1},b=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class pc extends $e{constructor(e){super(),ye(this,e,lm,tm,ke,{chip:0})}}function Ta(t){let e,l,n=t[1]&&Sa(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){y(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Sa(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&w(e),n&&n.d()}}}function Sa(t){let e,l;return{c(){e=p("div"),l=C(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){y(n,e,i),s(e,l)},p(n,i){i&2&&B(l,n[1])},d(n){n&&w(e)}}}function nm(t){let e,l=t[0]&&Ta(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ta(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&w(e)}}}function im(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class gt extends $e{constructor(e){super(),ye(this,e,im,nm,ke,{active:0,message:1})}}function Pa(t,e,l){const n=t.slice();return n[1]=e[l],n}function Ma(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,a){y(o,e,a),s(e,l),s(e,i)},p:ie,d(o){o&&w(e)}}}function sm(t){let e,l,n,i=t[0],o=[];for(let a=0;a{a[m]=null}),Me(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function vm(t){let e,l;return e=new Qt({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function hm(t){let e,l;return e=new Qt({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function bm(t){let e,l,n,i;const o=[hm,vm],a=[];function r(c,f){return c[3].q.s.r?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e!==m&&(Pe(),I(a[m],1,1,()=>{a[m]=null}),Me(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function gm(t){let e,l;return e=new Qt({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function km(t){let e,l;return e=new Qt({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function wm(t){let e,l,n,i;const o=[km,gm],a=[];function r(c,f){return c[3].q.s.k?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e!==m&&(Pe(),I(a[m],1,1,()=>{a[m]=null}),Me(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function Ua(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,H,F,L,G,j,q,O;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Domoticz",n=v(),i=p("a"),Z(o.$$.fragment),a=v(),r=p("input"),c=v(),f=p("div"),m=p("div"),_=C("Electricity IDX"),h=p("br"),b=v(),d=p("input"),g=v(),$=p("div"),k=C("Current IDX"),T=p("br"),P=v(),E=p("input"),S=v(),N=p("div"),D=C(`Voltage IDX: L1, L2 & L3 - `),R=p("div"),W=p("input"),H=v(),F=p("input"),L=v(),G=p("input"),u(l,"class","text-sm"),u(i,"href",Ct("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(r,"type","hidden"),u(r,"name","o"),r.value="true",u(d,"name","oe"),u(d,"type","text"),u(d,"class","in-f tr w-full"),u(m,"class","w-1/2"),u(E,"name","oc"),u(E,"type","text"),u(E,"class","in-l tr w-full"),u($,"class","w-1/2"),u(f,"class","my-1 flex"),u(W,"name","ou1"),u(W,"type","text"),u(W,"class","in-f tr w-1/3"),u(F,"name","ou2"),u(F,"type","text"),u(F,"class","in-m tr w-1/3"),u(G,"name","ou3"),u(G,"type","text"),u(G,"class","in-l tr w-1/3"),u(R,"class","flex"),u(N,"class","my-1"),u(e,"class","cnt")},m(U,x){y(U,e,x),s(e,l),s(e,n),s(e,i),K(o,i,null),s(e,a),s(e,r),s(e,c),s(e,f),s(f,m),s(m,_),s(m,h),s(m,b),s(m,d),Y(d,t[3].o.e),s(f,g),s(f,$),s($,k),s($,T),s($,P),s($,E),Y(E,t[3].o.c),s(e,S),s(e,N),s(N,D),s(N,R),s(R,W),Y(W,t[3].o.u1),s(R,H),s(R,F),Y(F,t[3].o.u2),s(R,L),s(R,G),Y(G,t[3].o.u3),j=!0,q||(O=[z(d,"input",t[58]),z(E,"input",t[59]),z(W,"input",t[60]),z(F,"input",t[61]),z(G,"input",t[62])],q=!0)},p(U,x){x[0]&8&&d.value!==U[3].o.e&&Y(d,U[3].o.e),x[0]&8&&E.value!==U[3].o.c&&Y(E,U[3].o.c),x[0]&8&&W.value!==U[3].o.u1&&Y(W,U[3].o.u1),x[0]&8&&F.value!==U[3].o.u2&&Y(F,U[3].o.u2),x[0]&8&&G.value!==U[3].o.u3&&Y(G,U[3].o.u3)},i(U){j||(M(o.$$.fragment,U),j=!0)},o(U){I(o.$$.fragment,U),j=!1},d(U){U&&w(e),Q(o),q=!1,Be(O)}}}function Ha(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,H,F,L,G;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Home-Assistant",n=v(),i=p("a"),Z(o.$$.fragment),a=v(),r=p("input"),c=v(),f=p("div"),m=C("Discovery topic prefix"),_=p("br"),h=v(),b=p("input"),d=v(),g=p("div"),$=C("Hostname for URL"),k=p("br"),T=v(),P=p("input"),S=v(),N=p("div"),D=C("Name tag"),R=p("br"),W=v(),H=p("input"),u(l,"class","text-sm"),u(i,"href",Ct("MQTT-configuration#home-assistant")),u(i,"target","_blank"),u(i,"class","float-right"),u(r,"type","hidden"),u(r,"name","h"),r.value="true",u(b,"name","ht"),u(b,"type","text"),u(b,"class","in-s"),u(b,"placeholder","homeassistant"),u(f,"class","my-1"),u(P,"name","hh"),u(P,"type","text"),u(P,"class","in-s"),u(P,"placeholder",E=t[3].g.h+".local"),u(g,"class","my-1"),u(H,"name","hn"),u(H,"type","text"),u(H,"class","in-s"),u(N,"class","my-1"),u(e,"class","cnt")},m(j,q){y(j,e,q),s(e,l),s(e,n),s(e,i),K(o,i,null),s(e,a),s(e,r),s(e,c),s(e,f),s(f,m),s(f,_),s(f,h),s(f,b),Y(b,t[3].h.t),s(e,d),s(e,g),s(g,$),s(g,k),s(g,T),s(g,P),Y(P,t[3].h.h),s(e,S),s(e,N),s(N,D),s(N,R),s(N,W),s(N,H),Y(H,t[3].h.n),F=!0,L||(G=[z(b,"input",t[63]),z(P,"input",t[64]),z(H,"input",t[65])],L=!0)},p(j,q){q[0]&8&&b.value!==j[3].h.t&&Y(b,j[3].h.t),(!F||q[0]&8&&E!==(E=j[3].g.h+".local"))&&u(P,"placeholder",E),q[0]&8&&P.value!==j[3].h.h&&Y(P,j[3].h.h),q[0]&8&&H.value!==j[3].h.n&&Y(H,j[3].h.n)},i(j){F||(M(o.$$.fragment,j),F=!0)},o(j){I(o.$$.fragment,j),F=!1},d(j){j&&w(e),Q(o),L=!1,Be(G)}}}function ja(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P;o=new $t({});let E={length:9},S=[];for(let N=0;N20&&Ya(t),m=t[0].chip=="esp8266"&&Ka(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Hardware",n=v(),i=p("a"),Z(o.$$.fragment),a=v(),f&&f.c(),r=v(),m&&m.c(),u(l,"class","text-sm"),u(i,"href",Ct("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(_,h){y(_,e,h),s(e,l),s(e,n),s(e,i),K(o,i,null),s(e,a),f&&f.m(e,null),s(e,r),m&&m.m(e,null),c=!0},p(_,h){_[0].board>20?f?(f.p(_,h),h[0]&1&&M(f,1)):(f=Ya(_),f.c(),M(f,1),f.m(e,r)):f&&(Pe(),I(f,1,1,()=>{f=null}),Me()),_[0].chip=="esp8266"?m?m.p(_,h):(m=Ka(_),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},i(_){c||(M(o.$$.fragment,_),M(f),c=!0)},o(_){I(o.$$.fragment,_),I(f),c=!1},d(_){_&&w(e),Q(o),f&&f.d(),m&&m.d()}}}function Ya(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,H,F,L,G,j,q,O,U,x,X,ne,le,_e,Ce,ve,qe,he,Ee,be,Ne,ce,me,se,re,V,ae,Ae,te,ue,Ue,Te,de,De,Le;h=new pc({props:{chip:t[0].chip}});let Se=t[0].chip!="esp8266"&&za(t),we=t[3].i.v.p>0&&Va(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),o=C("HAN"),a=p("label"),r=p("input"),c=C(" pullup"),f=p("br"),m=v(),_=p("select"),Z(h.$$.fragment),b=v(),d=p("div"),g=C("AP button"),$=p("br"),k=v(),T=p("input"),P=v(),E=p("div"),S=C("LED"),N=p("label"),D=p("input"),R=C(" inv"),W=p("br"),H=v(),F=p("div"),L=p("input"),G=v(),j=p("div"),q=C("RGB"),O=p("label"),U=p("input"),x=C(" inverted"),X=p("br"),ne=v(),le=p("div"),_e=p("input"),Ce=v(),ve=p("input"),qe=v(),he=p("input"),Ee=v(),be=p("div"),Ne=C("Temperature"),ce=p("br"),me=v(),se=p("input"),re=v(),V=p("div"),ae=C("Analog temp"),Ae=p("br"),te=v(),ue=p("input"),Ue=v(),Se&&Se.c(),Te=v(),we&&we.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(r,"name","ihu"),r.__value="true",r.value=r.__value,u(r,"type","checkbox"),u(r,"class","rounded mb-1"),u(a,"class","ml-2"),u(_,"name","ihp"),u(_,"class","in-f w-full"),t[3].i.h.p===void 0&&Ye(()=>t[70].call(_)),u(i,"class","w-1/3"),u(T,"name","ia"),u(T,"type","number"),u(T,"min","0"),u(T,"max",t[6]),u(T,"class","in-m tr w-full"),u(d,"class","w-1/3"),u(D,"name","ili"),D.__value="true",D.value=D.__value,u(D,"type","checkbox"),u(D,"class","rounded mb-1"),u(N,"class","ml-4"),u(L,"name","ilp"),u(L,"type","number"),u(L,"min","0"),u(L,"max",t[6]),u(L,"class","in-l tr w-full"),u(F,"class","flex"),u(E,"class","w-1/3"),u(U,"name","iri"),U.__value="true",U.value=U.__value,u(U,"type","checkbox"),u(U,"class","rounded mb-1"),u(O,"class","ml-4"),u(_e,"name","irr"),u(_e,"type","number"),u(_e,"min","0"),u(_e,"max",t[6]),u(_e,"class","in-f tr w-1/3"),u(ve,"name","irg"),u(ve,"type","number"),u(ve,"min","0"),u(ve,"max",t[6]),u(ve,"class","in-m tr w-1/3"),u(he,"name","irb"),u(he,"type","number"),u(he,"min","0"),u(he,"max",t[6]),u(he,"class","in-l tr w-1/3"),u(le,"class","flex"),u(j,"class","w-full"),u(se,"name","itd"),u(se,"type","number"),u(se,"min","0"),u(se,"max",t[6]),u(se,"class","in-f tr w-full"),u(be,"class","my-1 w-1/3"),u(ue,"name","ita"),u(ue,"type","number"),u(ue,"min","0"),u(ue,"max",t[6]),u(ue,"class","in-l tr w-full"),u(V,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(J,oe){y(J,e,oe),y(J,l,oe),y(J,n,oe),s(n,i),s(i,o),s(i,a),s(a,r),r.checked=t[3].i.h.u,s(a,c),s(i,f),s(i,m),s(i,_),K(h,_,null),Re(_,t[3].i.h.p),s(n,b),s(n,d),s(d,g),s(d,$),s(d,k),s(d,T),Y(T,t[3].i.a),s(n,P),s(n,E),s(E,S),s(E,N),s(N,D),D.checked=t[3].i.l.i,s(N,R),s(E,W),s(E,H),s(E,F),s(F,L),Y(L,t[3].i.l.p),s(n,G),s(n,j),s(j,q),s(j,O),s(O,U),U.checked=t[3].i.r.i,s(O,x),s(j,X),s(j,ne),s(j,le),s(le,_e),Y(_e,t[3].i.r.r),s(le,Ce),s(le,ve),Y(ve,t[3].i.r.g),s(le,qe),s(le,he),Y(he,t[3].i.r.b),s(n,Ee),s(n,be),s(be,Ne),s(be,ce),s(be,me),s(be,se),Y(se,t[3].i.t.d),s(n,re),s(n,V),s(V,ae),s(V,Ae),s(V,te),s(V,ue),Y(ue,t[3].i.t.a),s(n,Ue),Se&&Se.m(n,null),s(n,Te),we&&we.m(n,null),de=!0,De||(Le=[z(r,"change",t[69]),z(_,"change",t[70]),z(T,"input",t[71]),z(D,"change",t[72]),z(L,"input",t[73]),z(U,"change",t[74]),z(_e,"input",t[75]),z(ve,"input",t[76]),z(he,"input",t[77]),z(se,"input",t[78]),z(ue,"input",t[79])],De=!0)},p(J,oe){oe[0]&8&&(r.checked=J[3].i.h.u);const Sl={};oe[0]&1&&(Sl.chip=J[0].chip),h.$set(Sl),oe[0]&8&&Re(_,J[3].i.h.p),(!de||oe[0]&64)&&u(T,"max",J[6]),oe[0]&8&&pe(T.value)!==J[3].i.a&&Y(T,J[3].i.a),oe[0]&8&&(D.checked=J[3].i.l.i),(!de||oe[0]&64)&&u(L,"max",J[6]),oe[0]&8&&pe(L.value)!==J[3].i.l.p&&Y(L,J[3].i.l.p),oe[0]&8&&(U.checked=J[3].i.r.i),(!de||oe[0]&64)&&u(_e,"max",J[6]),oe[0]&8&&pe(_e.value)!==J[3].i.r.r&&Y(_e,J[3].i.r.r),(!de||oe[0]&64)&&u(ve,"max",J[6]),oe[0]&8&&pe(ve.value)!==J[3].i.r.g&&Y(ve,J[3].i.r.g),(!de||oe[0]&64)&&u(he,"max",J[6]),oe[0]&8&&pe(he.value)!==J[3].i.r.b&&Y(he,J[3].i.r.b),(!de||oe[0]&64)&&u(se,"max",J[6]),oe[0]&8&&pe(se.value)!==J[3].i.t.d&&Y(se,J[3].i.t.d),(!de||oe[0]&64)&&u(ue,"max",J[6]),oe[0]&8&&pe(ue.value)!==J[3].i.t.a&&Y(ue,J[3].i.t.a),J[0].chip!="esp8266"?Se?Se.p(J,oe):(Se=za(J),Se.c(),Se.m(n,Te)):Se&&(Se.d(1),Se=null),J[3].i.v.p>0?we?we.p(J,oe):(we=Va(J),we.c(),we.m(n,null)):we&&(we.d(1),we=null)},i(J){de||(M(h.$$.fragment,J),de=!0)},o(J){I(h.$$.fragment,J),de=!1},d(J){J&&w(e),J&&w(l),J&&w(n),Q(h),Se&&Se.d(),we&&we.d(),De=!1,Be(Le)}}}function za(t){let e,l,n,i,o,a,r;return{c(){e=p("div"),l=C("Vcc"),n=p("br"),i=v(),o=p("input"),u(o,"name","ivp"),u(o,"type","number"),u(o,"min","0"),u(o,"max",t[6]),u(o,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Y(o,t[3].i.v.p),a||(r=z(o,"input",t[80]),a=!0)},p(c,f){f[0]&64&&u(o,"max",c[6]),f[0]&8&&pe(o.value)!==c[3].i.v.p&&Y(o,c[3].i.v.p)},d(c){c&&w(e),a=!1,r()}}}function Va(t){let e,l,n,i,o,a,r,c,f,m;return{c(){e=p("div"),l=C("Voltage divider"),n=p("br"),i=v(),o=p("div"),a=p("input"),r=v(),c=p("input"),u(a,"name","ivdv"),u(a,"type","number"),u(a,"min","0"),u(a,"max","65535"),u(a,"class","in-f tr w-full"),u(a,"placeholder","VCC"),u(c,"name","ivdg"),u(c,"type","number"),u(c,"min","0"),u(c,"max","65535"),u(c,"class","in-l tr w-full"),u(c,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(_,h){y(_,e,h),s(e,l),s(e,n),s(e,i),s(e,o),s(o,a),Y(a,t[3].i.v.d.v),s(o,r),s(o,c),Y(c,t[3].i.v.d.g),f||(m=[z(a,"input",t[81]),z(c,"input",t[82])],f=!0)},p(_,h){h[0]&8&&pe(a.value)!==_[3].i.v.d.v&&Y(a,_[3].i.v.d.v),h[0]&8&&pe(c.value)!==_[3].i.v.d.g&&Y(c,_[3].i.v.d.g)},d(_){_&&w(e),f=!1,Be(m)}}}function Ka(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T=(t[0].board==2||t[0].board==100)&&Qa(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),o=C("Vcc offset"),a=p("br"),r=v(),c=p("input"),f=v(),m=p("div"),_=C("Multiplier"),h=p("br"),b=v(),d=p("input"),g=v(),T&&T.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(c,"name","ivo"),u(c,"type","number"),u(c,"min","0.0"),u(c,"max","3.5"),u(c,"step","0.01"),u(c,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(d,"name","ivm"),u(d,"type","number"),u(d,"min","0.1"),u(d,"max","10"),u(d,"step","0.01"),u(d,"class","in-l tr w-full"),u(m,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(P,E){y(P,e,E),y(P,l,E),y(P,n,E),s(n,i),s(i,o),s(i,a),s(i,r),s(i,c),Y(c,t[3].i.v.o),s(n,f),s(n,m),s(m,_),s(m,h),s(m,b),s(m,d),Y(d,t[3].i.v.m),s(n,g),T&&T.m(n,null),$||(k=[z(c,"input",t[83]),z(d,"input",t[84])],$=!0)},p(P,E){E[0]&8&&pe(c.value)!==P[3].i.v.o&&Y(c,P[3].i.v.o),E[0]&8&&pe(d.value)!==P[3].i.v.m&&Y(d,P[3].i.v.m),P[0].board==2||P[0].board==100?T?T.p(P,E):(T=Qa(P),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(P){P&&w(e),P&&w(l),P&&w(n),T&&T.d(),$=!1,Be(k)}}}function Qa(t){let e,l,n,i,o,a,r;return{c(){e=p("div"),l=C("Boot limit"),n=p("br"),i=v(),o=p("input"),u(o,"name","ivb"),u(o,"type","number"),u(o,"min","2.5"),u(o,"max","3.5"),u(o,"step","0.1"),u(o,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Y(o,t[3].i.v.b),a||(r=z(o,"input",t[85]),a=!0)},p(c,f){f[0]&8&&pe(o.value)!==c[3].i.v.b&&Y(o,c[3].i.v.b)},d(c){c&&w(e),a=!1,r()}}}function Za(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k=t[3].d.t&&Ja();return{c(){e=p("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=v(),n=p("div"),i=p("label"),o=p("input"),a=C(" Enable telnet"),r=v(),k&&k.c(),c=v(),f=p("div"),m=p("select"),_=p("option"),_.textContent="Verbose",h=p("option"),h.textContent="Debug",b=p("option"),b.textContent="Info",d=p("option"),d.textContent="Warning",u(e,"class","bd-red"),u(o,"type","checkbox"),u(o,"name","dt"),o.__value="true",o.value=o.__value,u(o,"class","rounded mb-1"),u(n,"class","my-1"),_.__value=1,_.value=_.__value,h.__value=2,h.value=h.__value,b.__value=3,b.value=b.__value,d.__value=4,d.value=d.__value,u(m,"name","dl"),u(m,"class","in-s"),t[3].d.l===void 0&&Ye(()=>t[88].call(m)),u(f,"class","my-1")},m(T,P){y(T,e,P),y(T,l,P),y(T,n,P),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,a),y(T,r,P),k&&k.m(T,P),y(T,c,P),y(T,f,P),s(f,m),s(m,_),s(m,h),s(m,b),s(m,d),Re(m,t[3].d.l),g||($=[z(o,"change",t[87]),z(m,"change",t[88])],g=!0)},p(T,P){P[0]&8&&(o.checked=T[3].d.t),T[3].d.t?k||(k=Ja(),k.c(),k.m(c.parentNode,c)):k&&(k.d(1),k=null),P[0]&8&&Re(m,T[3].d.l)},d(T){T&&w(e),T&&w(l),T&&w(n),T&&w(r),k&&k.d(T),T&&w(c),T&&w(f),g=!1,Be($)}}}function Ja(t){let e;return{c(){e=p("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function ym(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,H,F,L,G,j,q,O,U,x,X,ne,le,_e,Ce,ve,qe,he,Ee,be,Ne,ce,me,se,re,V,ae,Ae,te,ue,Ue,Te,de,De,Le,Se,we,J,oe,Sl,fi,ci,St,pi,Xt,mi,_i,di,lt,vi,xt,Ql,_t,hi,bi,gi,el,ki,wi,yi,dt,cl,pl,ml,$i,Ci,Fe,He,Yn,Pt,Pl,Ti,Mt,Si,_l,vs,co,dl,jt,vl,po,Pi,mo,et,hl,_o,Mi,Zl,Jl,Xl,xl,Ai,vo,zn,At,ho,bo,Ml,go,ko,wo,Wt,en,tn,yo,ln,Al,$o,Co,To,nn,Dt,So,Di,Po,Dl,Mo,Ao,Do,sn,Nt,No,Ni,Io,hs,Eo,Nl,Ii,It,Ro,Fo,Lo,bs,Ei,Et,qo,Oo,Uo,xe,Ri,Ho,on,un,jo,Vn,Wo,Il,Go,Bo,Yo,tl,zo,El,Vo,Ko,Qo,ll,Zo,rn,Rl,Jo,Xo,xo,kt,an,fn,cn,pn,eu,Fl,tu,lu,nu,mn,wt,iu,Fi,su,Li,qi,Rt,ou,uu,Xe,Oi,ru,_n,dn,au,Ll,fu,cu,pu,bl,Gt,vn,hn,mu,vt,Ui,Hi,_u,ht,bn,ji,Wi,du,gs,Gi,Bi,Ft,vu,hu,Kn,bu,gl,gu,Qn,Lt,ku,wu,yu,Yi,nl,$u,Ge,zi,Cu,gn,kn,Tu,Zn,Su,Bt,Pu,ks,Mu,Au,wn,il,Du,qt,Nu,ws,ql,Iu,Eu,Ru,sl,Fu,Ol,Lu,qu,Ou,ol,Uu,yn,$n,Hu,ju,Wu,ul,Gu,Cn,Bu,Yu,zu,nt,Tn,Sn,Pn,Mn,An,Dn,Vu,Ul,Ku,Qu,Zu,rl,Ju,ys,$s,Cs=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Ts,Yt,Vi,Xu,Nn,In,xu,Jn,er,Xn,tr,Ss,bt,Ki,lr,En,Rn,nr,xn,ir,Qi,Zi,Ot,sr,or,ur,kl,Ps,Fn,rr,Ji,Ln,ar,Xi,Ms,Hl,As,jl,Ds,Wl,Ns,Gl,Ut,Is,fr;r=new $t({}),R=new um({});let _c=["NOK","SEK","DKK","EUR"],xi=[];for(let A=0;A<4;A+=1)xi[A]=cm(fm(t,_c,A));let it=t[3].p.e&&t[0].chip!="esp8266"&&Na(t),st=t[3].g.s>0&&Ia(t);Pl=new $t({});let dc=[24,48,96,192,384,576,1152],es=[];for(let A=0;A<7;A+=1)es[A]=pm(am(t,dc,A));let ot=t[3].m.e.e&&Ea(t),ut=t[3].m.e.e&&Ra(t),rt=t[3].m.m.e&&Fa(t);un=new $t({}),dn=new $t({}),bn=new mc({});let at=t[3].n.m=="static"&&La(t);kn=new $t({});let ft=t[0].chip!="esp8266"&&qa(t),ze=t[3].q.s.e&&Oa(t),Ve=t[3].q.m==3&&Ua(t),Ke=t[3].q.m==4&&Ha(t),Qe=Cs&&ja(t);In=new $t({});let qn=t[7],ct=[];for(let A=0;A20||t[0].chip=="esp8266")&&Ba(t);Rn=new $t({});let pt=t[3].d.s&&Za(t);return Hl=new gt({props:{active:t[1],message:"Loading configuration"}}),jl=new gt({props:{active:t[2],message:"Saving configuration"}}),Wl=new gt({props:{active:t[4],message:"Performing factory reset"}}),Gl=new gt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=p("form"),l=p("div"),n=p("div"),i=p("strong"),i.textContent="General",o=v(),a=p("a"),Z(r.$$.fragment),c=v(),f=p("input"),m=v(),_=p("div"),h=p("div"),b=p("div"),d=C("Hostname"),g=p("br"),$=v(),k=p("input"),T=v(),P=p("div"),E=C("Time zone"),S=p("br"),N=v(),D=p("select"),Z(R.$$.fragment),W=v(),H=p("input"),F=v(),L=p("div"),G=C("Price region"),j=p("br"),q=v(),O=p("select"),U=p("optgroup"),x=p("option"),x.textContent="NO1",X=p("option"),X.textContent="NO2",ne=p("option"),ne.textContent="NO3",le=p("option"),le.textContent="NO4",_e=p("option"),_e.textContent="NO5",Ce=p("optgroup"),ve=p("option"),ve.textContent="SE1",qe=p("option"),qe.textContent="SE2",he=p("option"),he.textContent="SE3",Ee=p("option"),Ee.textContent="SE4",be=p("optgroup"),Ne=p("option"),Ne.textContent="DK1",ce=p("option"),ce.textContent="DK2",me=p("option"),me.textContent="Austria",se=p("option"),se.textContent="Belgium",re=p("option"),re.textContent="Czech Republic",V=p("option"),V.textContent="Estonia",ae=p("option"),ae.textContent="Finland",Ae=p("option"),Ae.textContent="France",te=p("option"),te.textContent="Germany",ue=p("option"),ue.textContent="Great Britain",Ue=p("option"),Ue.textContent="Latvia",Te=p("option"),Te.textContent="Lithuania",de=p("option"),de.textContent="Netherland",De=p("option"),De.textContent="Poland",Le=p("option"),Le.textContent="Switzerland",Se=v(),we=p("div"),J=p("div"),oe=p("div"),Sl=C("Currency"),fi=p("br"),ci=v(),St=p("select");for(let A=0;A<4;A+=1)xi[A].c();pi=v(),Xt=p("div"),mi=C("Multiplier"),_i=p("br"),di=v(),lt=p("input"),vi=v(),xt=p("div"),Ql=p("label"),_t=p("input"),hi=C(" Enable price fetch from remote server"),bi=v(),it&&it.c(),gi=v(),el=p("div"),ki=C("Security"),wi=p("br"),yi=v(),dt=p("select"),cl=p("option"),cl.textContent="None",pl=p("option"),pl.textContent="Only configuration",ml=p("option"),ml.textContent="Everything",$i=v(),st&&st.c(),Ci=v(),Fe=p("div"),He=p("strong"),He.textContent="Meter",Yn=v(),Pt=p("a"),Z(Pl.$$.fragment),Ti=v(),Mt=p("input"),Si=v(),_l=p("div"),vs=p("span"),vs.textContent="Serial configuration",co=v(),dl=p("div"),jt=p("select"),vl=p("option"),po=C("Autodetect");for(let A=0;A<7;A+=1)es[A].c();mo=v(),et=p("select"),hl=p("option"),_o=C("-"),Zl=p("option"),Zl.textContent="7N1",Jl=p("option"),Jl.textContent="8N1",Xl=p("option"),Xl.textContent="7E1",xl=p("option"),xl.textContent="8E1",vo=v(),zn=p("label"),At=p("input"),ho=C(" inverted"),bo=v(),Ml=p("div"),go=C("Voltage"),ko=p("br"),wo=v(),Wt=p("select"),en=p("option"),en.textContent="400V (TN)",tn=p("option"),tn.textContent="230V (IT/TT)",yo=v(),ln=p("div"),Al=p("div"),$o=C("Main fuse"),Co=p("br"),To=v(),nn=p("label"),Dt=p("input"),So=v(),Di=p("span"),Di.textContent="A",Po=v(),Dl=p("div"),Mo=C("Production"),Ao=p("br"),Do=v(),sn=p("label"),Nt=p("input"),No=v(),Ni=p("span"),Ni.textContent="kWp",Io=v(),hs=p("div"),Eo=v(),Nl=p("div"),Ii=p("label"),It=p("input"),Ro=C(" Meter is encrypted"),Fo=v(),ot&&ot.c(),Lo=v(),ut&&ut.c(),bs=v(),Ei=p("label"),Et=p("input"),qo=C(" Multipliers"),Oo=v(),rt&&rt.c(),Uo=v(),xe=p("div"),Ri=p("strong"),Ri.textContent="WiFi",Ho=v(),on=p("a"),Z(un.$$.fragment),jo=v(),Vn=p("input"),Wo=v(),Il=p("div"),Go=C("SSID"),Bo=p("br"),Yo=v(),tl=p("input"),zo=v(),El=p("div"),Vo=C("Password"),Ko=p("br"),Qo=v(),ll=p("input"),Zo=v(),rn=p("div"),Rl=p("div"),Jo=C("Power saving"),Xo=p("br"),xo=v(),kt=p("select"),an=p("option"),an.textContent="Default",fn=p("option"),fn.textContent="Off",cn=p("option"),cn.textContent="Minimum",pn=p("option"),pn.textContent="Maximum",eu=v(),Fl=p("div"),tu=C("Power"),lu=p("br"),nu=v(),mn=p("div"),wt=p("input"),iu=v(),Fi=p("span"),Fi.textContent="dBm",su=v(),Li=p("div"),qi=p("label"),Rt=p("input"),ou=C(" Auto reboot on connection problem"),uu=v(),Xe=p("div"),Oi=p("strong"),Oi.textContent="Network",ru=v(),_n=p("a"),Z(dn.$$.fragment),au=v(),Ll=p("div"),fu=C("IP"),cu=p("br"),pu=v(),bl=p("div"),Gt=p("select"),vn=p("option"),vn.textContent="DHCP",hn=p("option"),hn.textContent="Static",mu=v(),vt=p("input"),_u=v(),ht=p("select"),Z(bn.$$.fragment),du=v(),at&&at.c(),gs=v(),Gi=p("div"),Bi=p("label"),Ft=p("input"),vu=C(" enable mDNS"),hu=v(),Kn=p("input"),bu=v(),gl=p("div"),gu=C("NTP "),Qn=p("label"),Lt=p("input"),ku=C(" obtain from DHCP"),wu=p("br"),yu=v(),Yi=p("div"),nl=p("input"),$u=v(),Ge=p("div"),zi=p("strong"),zi.textContent="MQTT",Cu=v(),gn=p("a"),Z(kn.$$.fragment),Tu=v(),Zn=p("input"),Su=v(),Bt=p("div"),Pu=C(`Server - `),ft&&ft.c(),ks=v(),Mu=p("br"),Au=v(),wn=p("div"),il=p("input"),Du=v(),qt=p("input"),Nu=v(),ze&&ze.c(),ws=v(),ql=p("div"),Iu=C("Username"),Eu=p("br"),Ru=v(),sl=p("input"),Fu=v(),Ol=p("div"),Lu=C("Password"),qu=p("br"),Ou=v(),ol=p("input"),Uu=v(),yn=p("div"),$n=p("div"),Hu=C("Client ID"),ju=p("br"),Wu=v(),ul=p("input"),Gu=v(),Cn=p("div"),Bu=C("Payload"),Yu=p("br"),zu=v(),nt=p("select"),Tn=p("option"),Tn.textContent="JSON",Sn=p("option"),Sn.textContent="Raw (minimal)",Pn=p("option"),Pn.textContent="Raw (full)",Mn=p("option"),Mn.textContent="Domoticz",An=p("option"),An.textContent="HomeAssistant",Dn=p("option"),Dn.textContent="HEX dump",Vu=v(),Ul=p("div"),Ku=C("Publish topic"),Qu=p("br"),Zu=v(),rl=p("input"),Ju=v(),Ve&&Ve.c(),ys=v(),Ke&&Ke.c(),$s=v(),Qe&&Qe.c(),Ts=v(),Yt=p("div"),Vi=p("strong"),Vi.textContent="User interface",Xu=v(),Nn=p("a"),Z(In.$$.fragment),xu=v(),Jn=p("input"),er=v(),Xn=p("div");for(let A=0;ASave',Ms=v(),Z(Hl.$$.fragment),As=v(),Z(jl.$$.fragment),Ds=v(),Z(Wl.$$.fragment),Ns=v(),Z(Gl.$$.fragment),u(i,"class","text-sm"),u(a,"href",Ct("General-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","g"),f.value="true",u(k,"name","gh"),u(k,"type","text"),u(k,"class","in-f w-full"),u(k,"pattern","[A-Za-z0-9-]+"),u(D,"name","gt"),u(D,"class","in-l w-full"),t[3].g.t===void 0&&Ye(()=>t[13].call(D)),u(h,"class","flex"),u(_,"class","my-1"),u(H,"type","hidden"),u(H,"name","p"),H.value="true",x.__value="10YNO-1--------2",x.value=x.__value,X.__value="10YNO-2--------T",X.value=X.__value,ne.__value="10YNO-3--------J",ne.value=ne.__value,le.__value="10YNO-4--------9",le.value=le.__value,_e.__value="10Y1001A1001A48H",_e.value=_e.__value,u(U,"label","Norway"),ve.__value="10Y1001A1001A44P",ve.value=ve.__value,qe.__value="10Y1001A1001A45N",qe.value=qe.__value,he.__value="10Y1001A1001A46L",he.value=he.__value,Ee.__value="10Y1001A1001A47J",Ee.value=Ee.__value,u(Ce,"label","Sweden"),Ne.__value="10YDK-1--------W",Ne.value=Ne.__value,ce.__value="10YDK-2--------M",ce.value=ce.__value,u(be,"label","Denmark"),me.__value="10YAT-APG------L",me.value=me.__value,se.__value="10YBE----------2",se.value=se.__value,re.__value="10YCZ-CEPS-----N",re.value=re.__value,V.__value="10Y1001A1001A39I",V.value=V.__value,ae.__value="10YFI-1--------U",ae.value=ae.__value,Ae.__value="10YFR-RTE------C",Ae.value=Ae.__value,te.__value="10Y1001A1001A83F",te.value=te.__value,ue.__value="10YGB----------A",ue.value=ue.__value,Ue.__value="10YLV-1001A00074",Ue.value=Ue.__value,Te.__value="10YLT-1001A0008Q",Te.value=Te.__value,de.__value="10YNL----------L",de.value=de.__value,De.__value="10YPL-AREA-----S",De.value=De.__value,Le.__value="10YCH-SWISSGRIDZ",Le.value=Le.__value,u(O,"name","pr"),u(O,"class","in-s"),t[3].p.r===void 0&&Ye(()=>t[14].call(O)),u(L,"class","my-1"),u(St,"name","pc"),u(St,"class","in-f w-full"),t[3].p.c===void 0&&Ye(()=>t[15].call(St)),u(oe,"class","w-1/2"),u(lt,"name","pm"),u(lt,"type","number"),u(lt,"min","0.001"),u(lt,"max","1000"),u(lt,"step","0.001"),u(lt,"class","in-l tr w-full"),u(Xt,"class","w-1/2"),u(J,"class","flex"),u(we,"class","my-1"),u(_t,"type","checkbox"),u(_t,"name","pe"),_t.__value="true",_t.value=_t.__value,u(_t,"class","rounded mb-1"),u(xt,"class","my-1"),cl.__value=0,cl.value=cl.__value,pl.__value=1,pl.value=pl.__value,ml.__value=2,ml.value=ml.__value,u(dt,"name","gs"),u(dt,"class","in-s"),t[3].g.s===void 0&&Ye(()=>t[19].call(dt)),u(el,"class","my-1"),u(n,"class","cnt"),u(He,"class","text-sm"),u(Pt,"href",Ct("Meter-configuration")),u(Pt,"target","_blank"),u(Pt,"class","float-right"),u(Mt,"type","hidden"),u(Mt,"name","m"),Mt.value="true",vl.__value=0,vl.value=vl.__value,vl.disabled=Pi=t[3].m.b!=0,u(jt,"name","mb"),u(jt,"class","in-f"),t[3].m.b===void 0&&Ye(()=>t[22].call(jt)),hl.__value=0,hl.value=hl.__value,hl.disabled=Mi=t[3].m.b!=0,Zl.__value=2,Zl.value=Zl.__value,Jl.__value=3,Jl.value=Jl.__value,Xl.__value=10,Xl.value=Xl.__value,xl.__value=11,xl.value=xl.__value,u(et,"name","mp"),u(et,"class","in-l"),et.disabled=Ai=t[3].m.b==0,t[3].m.p===void 0&&Ye(()=>t[23].call(et)),u(At,"name","mi"),At.__value="true",At.value=At.__value,u(At,"type","checkbox"),u(At,"class","rounded mb-1"),u(zn,"class","mt-2 ml-3 whitespace-nowrap"),u(dl,"class","flex"),u(_l,"class","my-1"),en.__value=2,en.value=en.__value,tn.__value=1,tn.value=tn.__value,u(Wt,"name","md"),u(Wt,"class","in-s"),t[3].m.d===void 0&&Ye(()=>t[25].call(Wt)),u(Ml,"class","my-1"),u(Dt,"name","mf"),u(Dt,"type","number"),u(Dt,"min","5"),u(Dt,"max","65535"),u(Dt,"class","in-f tr w-full"),u(Di,"class","in-post"),u(nn,"class","flex"),u(Al,"class","mx-1"),u(Nt,"name","mr"),u(Nt,"type","number"),u(Nt,"min","0"),u(Nt,"max","65535"),u(Nt,"class","in-f tr w-full"),u(Ni,"class","in-post"),u(sn,"class","flex"),u(Dl,"class","mx-1"),u(ln,"class","my-1 flex"),u(hs,"class","my-1"),u(It,"type","checkbox"),u(It,"name","me"),It.__value="true",It.value=It.__value,u(It,"class","rounded mb-1"),u(Nl,"class","my-1"),u(Et,"type","checkbox"),u(Et,"name","mm"),Et.__value="true",Et.value=Et.__value,u(Et,"class","rounded mb-1"),u(Fe,"class","cnt"),u(Ri,"class","text-sm"),u(on,"href",Ct("WiFi-configuration")),u(on,"target","_blank"),u(on,"class","float-right"),u(Vn,"type","hidden"),u(Vn,"name","w"),Vn.value="true",u(tl,"name","ws"),u(tl,"type","text"),u(tl,"class","in-s"),u(Il,"class","my-1"),u(ll,"name","wp"),u(ll,"type","password"),u(ll,"class","in-s"),u(El,"class","my-1"),an.__value=255,an.value=an.__value,fn.__value=0,fn.value=fn.__value,cn.__value=1,cn.value=cn.__value,pn.__value=2,pn.value=pn.__value,u(kt,"name","wz"),u(kt,"class","in-s"),t[3].w.z===void 0&&Ye(()=>t[38].call(kt)),u(Rl,"class","w-1/2"),u(wt,"name","ww"),u(wt,"type","number"),u(wt,"min","0"),u(wt,"max","20.5"),u(wt,"step","0.5"),u(wt,"class","in-f tr w-full"),u(Fi,"class","in-post"),u(mn,"class","flex"),u(Fl,"class","ml-2 w-1/2"),u(rn,"class","my-1 flex"),u(Rt,"type","checkbox"),u(Rt,"name","wa"),Rt.__value="true",Rt.value=Rt.__value,u(Rt,"class","rounded mb-1"),u(Li,"class","my-3"),u(xe,"class","cnt"),u(Oi,"class","text-sm"),u(_n,"href",Ct("Network-configuration")),u(_n,"target","_blank"),u(_n,"class","float-right"),vn.__value="dhcp",vn.value=vn.__value,hn.__value="static",hn.value=hn.__value,u(Gt,"name","nm"),u(Gt,"class","in-f"),t[3].n.m===void 0&&Ye(()=>t[41].call(Gt)),u(vt,"name","ni"),u(vt,"type","text"),u(vt,"class","in-m w-full"),vt.disabled=Ui=t[3].n.m=="dhcp",vt.required=Hi=t[3].n.m=="static",u(ht,"name","ns"),u(ht,"class","in-l"),ht.disabled=ji=t[3].n.m=="dhcp",ht.required=Wi=t[3].n.m=="static",t[3].n.s===void 0&&Ye(()=>t[43].call(ht)),u(bl,"class","flex"),u(Ll,"class","my-1"),u(Ft,"name","nd"),Ft.__value="true",Ft.value=Ft.__value,u(Ft,"type","checkbox"),u(Ft,"class","rounded mb-1"),u(Gi,"class","my-1"),u(Kn,"type","hidden"),u(Kn,"name","ntp"),Kn.value="true",u(Lt,"name","ntpd"),Lt.__value="true",Lt.value=Lt.__value,u(Lt,"type","checkbox"),u(Lt,"class","rounded mb-1"),u(Qn,"class","ml-4"),u(nl,"name","ntph"),u(nl,"type","text"),u(nl,"class","in-s"),u(Yi,"class","flex"),u(gl,"class","my-1"),u(Xe,"class","cnt"),u(zi,"class","text-sm"),u(gn,"href",Ct("MQTT-configuration")),u(gn,"target","_blank"),u(gn,"class","float-right"),u(Zn,"type","hidden"),u(Zn,"name","q"),Zn.value="true",u(il,"name","qh"),u(il,"type","text"),u(il,"class","in-f w-3/4"),u(qt,"name","qp"),u(qt,"type","number"),u(qt,"min","1024"),u(qt,"max","65535"),u(qt,"class","in-l tr w-1/4"),u(wn,"class","flex"),u(Bt,"class","my-1"),u(sl,"name","qu"),u(sl,"type","text"),u(sl,"class","in-s"),u(ql,"class","my-1"),u(ol,"name","qa"),u(ol,"type","password"),u(ol,"class","in-s"),u(Ol,"class","my-1"),u(ul,"name","qc"),u(ul,"type","text"),u(ul,"class","in-f w-full"),Tn.__value=0,Tn.value=Tn.__value,Sn.__value=1,Sn.value=Sn.__value,Pn.__value=2,Pn.value=Pn.__value,Mn.__value=3,Mn.value=Mn.__value,An.__value=4,An.value=An.__value,Dn.__value=255,Dn.value=Dn.__value,u(nt,"name","qm"),u(nt,"class","in-l"),t[3].q.m===void 0&&Ye(()=>t[56].call(nt)),u(yn,"class","my-1 flex"),u(rl,"name","qb"),u(rl,"type","text"),u(rl,"class","in-s"),u(Ul,"class","my-1"),u(Ge,"class","cnt"),u(Vi,"class","text-sm"),u(Nn,"href",Ct("User-interface")),u(Nn,"target","_blank"),u(Nn,"class","float-right"),u(Jn,"type","hidden"),u(Jn,"name","u"),Jn.value="true",u(Xn,"class","flex flex-wrap"),u(Yt,"class","cnt"),u(Ki,"class","text-sm"),u(En,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(En,"target","_blank"),u(En,"class","float-right"),u(xn,"type","hidden"),u(xn,"name","d"),xn.value="true",u(Ot,"type","checkbox"),u(Ot,"name","ds"),Ot.__value="true",Ot.value=Ot.__value,u(Ot,"class","rounded mb-1"),u(Qi,"class","mt-3"),u(bt,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(Fn,"type","button"),u(Fn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),u(Ln,"type","button"),u(Ln,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(Ji,"class","text-center"),u(Xi,"class","text-right"),u(kl,"class","grid grid-cols-3"),u(e,"autocomplete","off")},m(A,ee){y(A,e,ee),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),K(r,a,null),s(n,c),s(n,f),s(n,m),s(n,_),s(_,h),s(h,b),s(b,d),s(b,g),s(b,$),s(b,k),Y(k,t[3].g.h),s(h,T),s(h,P),s(P,E),s(P,S),s(P,N),s(P,D),K(R,D,null),Re(D,t[3].g.t),s(n,W),s(n,H),s(n,F),s(n,L),s(L,G),s(L,j),s(L,q),s(L,O),s(O,U),s(U,x),s(U,X),s(U,ne),s(U,le),s(U,_e),s(O,Ce),s(Ce,ve),s(Ce,qe),s(Ce,he),s(Ce,Ee),s(O,be),s(be,Ne),s(be,ce),s(O,me),s(O,se),s(O,re),s(O,V),s(O,ae),s(O,Ae),s(O,te),s(O,ue),s(O,Ue),s(O,Te),s(O,de),s(O,De),s(O,Le),Re(O,t[3].p.r),s(n,Se),s(n,we),s(we,J),s(J,oe),s(oe,Sl),s(oe,fi),s(oe,ci),s(oe,St);for(let mt=0;mt<4;mt+=1)xi[mt].m(St,null);Re(St,t[3].p.c),s(J,pi),s(J,Xt),s(Xt,mi),s(Xt,_i),s(Xt,di),s(Xt,lt),Y(lt,t[3].p.m),s(n,vi),s(n,xt),s(xt,Ql),s(Ql,_t),_t.checked=t[3].p.e,s(Ql,hi),s(xt,bi),it&&it.m(xt,null),s(n,gi),s(n,el),s(el,ki),s(el,wi),s(el,yi),s(el,dt),s(dt,cl),s(dt,pl),s(dt,ml),Re(dt,t[3].g.s),s(n,$i),st&&st.m(n,null),s(l,Ci),s(l,Fe),s(Fe,He),s(Fe,Yn),s(Fe,Pt),K(Pl,Pt,null),s(Fe,Ti),s(Fe,Mt),s(Fe,Si),s(Fe,_l),s(_l,vs),s(_l,co),s(_l,dl),s(dl,jt),s(jt,vl),s(vl,po);for(let mt=0;mt<7;mt+=1)es[mt].m(jt,null);Re(jt,t[3].m.b),s(dl,mo),s(dl,et),s(et,hl),s(hl,_o),s(et,Zl),s(et,Jl),s(et,Xl),s(et,xl),Re(et,t[3].m.p),s(dl,vo),s(dl,zn),s(zn,At),At.checked=t[3].m.i,s(zn,ho),s(Fe,bo),s(Fe,Ml),s(Ml,go),s(Ml,ko),s(Ml,wo),s(Ml,Wt),s(Wt,en),s(Wt,tn),Re(Wt,t[3].m.d),s(Fe,yo),s(Fe,ln),s(ln,Al),s(Al,$o),s(Al,Co),s(Al,To),s(Al,nn),s(nn,Dt),Y(Dt,t[3].m.f),s(nn,So),s(nn,Di),s(ln,Po),s(ln,Dl),s(Dl,Mo),s(Dl,Ao),s(Dl,Do),s(Dl,sn),s(sn,Nt),Y(Nt,t[3].m.r),s(sn,No),s(sn,Ni),s(Fe,Io),s(Fe,hs),s(Fe,Eo),s(Fe,Nl),s(Nl,Ii),s(Ii,It),It.checked=t[3].m.e.e,s(Ii,Ro),s(Nl,Fo),ot&&ot.m(Nl,null),s(Fe,Lo),ut&&ut.m(Fe,null),s(Fe,bs),s(Fe,Ei),s(Ei,Et),Et.checked=t[3].m.m.e,s(Ei,qo),s(Fe,Oo),rt&&rt.m(Fe,null),s(l,Uo),s(l,xe),s(xe,Ri),s(xe,Ho),s(xe,on),K(un,on,null),s(xe,jo),s(xe,Vn),s(xe,Wo),s(xe,Il),s(Il,Go),s(Il,Bo),s(Il,Yo),s(Il,tl),Y(tl,t[3].w.s),s(xe,zo),s(xe,El),s(El,Vo),s(El,Ko),s(El,Qo),s(El,ll),Y(ll,t[3].w.p),s(xe,Zo),s(xe,rn),s(rn,Rl),s(Rl,Jo),s(Rl,Xo),s(Rl,xo),s(Rl,kt),s(kt,an),s(kt,fn),s(kt,cn),s(kt,pn),Re(kt,t[3].w.z),s(rn,eu),s(rn,Fl),s(Fl,tu),s(Fl,lu),s(Fl,nu),s(Fl,mn),s(mn,wt),Y(wt,t[3].w.w),s(mn,iu),s(mn,Fi),s(xe,su),s(xe,Li),s(Li,qi),s(qi,Rt),Rt.checked=t[3].w.a,s(qi,ou),s(l,uu),s(l,Xe),s(Xe,Oi),s(Xe,ru),s(Xe,_n),K(dn,_n,null),s(Xe,au),s(Xe,Ll),s(Ll,fu),s(Ll,cu),s(Ll,pu),s(Ll,bl),s(bl,Gt),s(Gt,vn),s(Gt,hn),Re(Gt,t[3].n.m),s(bl,mu),s(bl,vt),Y(vt,t[3].n.i),s(bl,_u),s(bl,ht),K(bn,ht,null),Re(ht,t[3].n.s),s(Xe,du),at&&at.m(Xe,null),s(Xe,gs),s(Xe,Gi),s(Gi,Bi),s(Bi,Ft),Ft.checked=t[3].n.d,s(Bi,vu),s(Xe,hu),s(Xe,Kn),s(Xe,bu),s(Xe,gl),s(gl,gu),s(gl,Qn),s(Qn,Lt),Lt.checked=t[3].n.h,s(Qn,ku),s(gl,wu),s(gl,yu),s(gl,Yi),s(Yi,nl),Y(nl,t[3].n.n1),s(l,$u),s(l,Ge),s(Ge,zi),s(Ge,Cu),s(Ge,gn),K(kn,gn,null),s(Ge,Tu),s(Ge,Zn),s(Ge,Su),s(Ge,Bt),s(Bt,Pu),ft&&ft.m(Bt,null),s(Bt,ks),s(Bt,Mu),s(Bt,Au),s(Bt,wn),s(wn,il),Y(il,t[3].q.h),s(wn,Du),s(wn,qt),Y(qt,t[3].q.p),s(Ge,Nu),ze&&ze.m(Ge,null),s(Ge,ws),s(Ge,ql),s(ql,Iu),s(ql,Eu),s(ql,Ru),s(ql,sl),Y(sl,t[3].q.u),s(Ge,Fu),s(Ge,Ol),s(Ol,Lu),s(Ol,qu),s(Ol,Ou),s(Ol,ol),Y(ol,t[3].q.a),s(Ge,Uu),s(Ge,yn),s(yn,$n),s($n,Hu),s($n,ju),s($n,Wu),s($n,ul),Y(ul,t[3].q.c),s(yn,Gu),s(yn,Cn),s(Cn,Bu),s(Cn,Yu),s(Cn,zu),s(Cn,nt),s(nt,Tn),s(nt,Sn),s(nt,Pn),s(nt,Mn),s(nt,An),s(nt,Dn),Re(nt,t[3].q.m),s(Ge,Vu),s(Ge,Ul),s(Ul,Ku),s(Ul,Qu),s(Ul,Zu),s(Ul,rl),Y(rl,t[3].q.b),s(l,Ju),Ve&&Ve.m(l,null),s(l,ys),Ke&&Ke.m(l,null),s(l,$s),Qe&&Qe.m(l,null),s(l,Ts),s(l,Yt),s(Yt,Vi),s(Yt,Xu),s(Yt,Nn),K(In,Nn,null),s(Yt,xu),s(Yt,Jn),s(Yt,er),s(Yt,Xn);for(let mt=0;mt0?st?st.p(A,ee):(st=Ia(A),st.c(),st.m(n,null)):st&&(st.d(1),st=null),(!Ut||ee[0]&8&&Pi!==(Pi=A[3].m.b!=0))&&(vl.disabled=Pi),ee[0]&8&&Re(jt,A[3].m.b),(!Ut||ee[0]&8&&Mi!==(Mi=A[3].m.b!=0))&&(hl.disabled=Mi),(!Ut||ee[0]&8&&Ai!==(Ai=A[3].m.b==0))&&(et.disabled=Ai),ee[0]&8&&Re(et,A[3].m.p),ee[0]&8&&(At.checked=A[3].m.i),ee[0]&8&&Re(Wt,A[3].m.d),ee[0]&8&&pe(Dt.value)!==A[3].m.f&&Y(Dt,A[3].m.f),ee[0]&8&&pe(Nt.value)!==A[3].m.r&&Y(Nt,A[3].m.r),ee[0]&8&&(It.checked=A[3].m.e.e),A[3].m.e.e?ot?ot.p(A,ee):(ot=Ea(A),ot.c(),ot.m(Nl,null)):ot&&(ot.d(1),ot=null),A[3].m.e.e?ut?ut.p(A,ee):(ut=Ra(A),ut.c(),ut.m(Fe,bs)):ut&&(ut.d(1),ut=null),ee[0]&8&&(Et.checked=A[3].m.m.e),A[3].m.m.e?rt?rt.p(A,ee):(rt=Fa(A),rt.c(),rt.m(Fe,null)):rt&&(rt.d(1),rt=null),ee[0]&8&&tl.value!==A[3].w.s&&Y(tl,A[3].w.s),ee[0]&8&&ll.value!==A[3].w.p&&Y(ll,A[3].w.p),ee[0]&8&&Re(kt,A[3].w.z),ee[0]&8&&pe(wt.value)!==A[3].w.w&&Y(wt,A[3].w.w),ee[0]&8&&(Rt.checked=A[3].w.a),ee[0]&8&&Re(Gt,A[3].n.m),(!Ut||ee[0]&8&&Ui!==(Ui=A[3].n.m=="dhcp"))&&(vt.disabled=Ui),(!Ut||ee[0]&8&&Hi!==(Hi=A[3].n.m=="static"))&&(vt.required=Hi),ee[0]&8&&vt.value!==A[3].n.i&&Y(vt,A[3].n.i),(!Ut||ee[0]&8&&ji!==(ji=A[3].n.m=="dhcp"))&&(ht.disabled=ji),(!Ut||ee[0]&8&&Wi!==(Wi=A[3].n.m=="static"))&&(ht.required=Wi),ee[0]&8&&Re(ht,A[3].n.s),A[3].n.m=="static"?at?at.p(A,ee):(at=La(A),at.c(),at.m(Xe,gs)):at&&(at.d(1),at=null),ee[0]&8&&(Ft.checked=A[3].n.d),ee[0]&8&&(Lt.checked=A[3].n.h),ee[0]&8&&nl.value!==A[3].n.n1&&Y(nl,A[3].n.n1),A[0].chip!="esp8266"?ft?ft.p(A,ee):(ft=qa(A),ft.c(),ft.m(Bt,ks)):ft&&(ft.d(1),ft=null),ee[0]&8&&il.value!==A[3].q.h&&Y(il,A[3].q.h),ee[0]&8&&pe(qt.value)!==A[3].q.p&&Y(qt,A[3].q.p),A[3].q.s.e?ze?(ze.p(A,ee),ee[0]&8&&M(ze,1)):(ze=Oa(A),ze.c(),M(ze,1),ze.m(Ge,ws)):ze&&(Pe(),I(ze,1,1,()=>{ze=null}),Me()),ee[0]&8&&sl.value!==A[3].q.u&&Y(sl,A[3].q.u),ee[0]&8&&ol.value!==A[3].q.a&&Y(ol,A[3].q.a),ee[0]&8&&ul.value!==A[3].q.c&&Y(ul,A[3].q.c),ee[0]&8&&Re(nt,A[3].q.m),ee[0]&8&&rl.value!==A[3].q.b&&Y(rl,A[3].q.b),A[3].q.m==3?Ve?(Ve.p(A,ee),ee[0]&8&&M(Ve,1)):(Ve=Ua(A),Ve.c(),M(Ve,1),Ve.m(l,ys)):Ve&&(Pe(),I(Ve,1,1,()=>{Ve=null}),Me()),A[3].q.m==4?Ke?(Ke.p(A,ee),ee[0]&8&&M(Ke,1)):(Ke=Ha(A),Ke.c(),M(Ke,1),Ke.m(l,$s)):Ke&&(Pe(),I(Ke,1,1,()=>{Ke=null}),Me()),ee[0]&8&&(Cs=A[3].p.r.startsWith("10YNO")||A[3].p.r=="10Y1001A1001A48H"),Cs?Qe?(Qe.p(A,ee),ee[0]&8&&M(Qe,1)):(Qe=ja(A),Qe.c(),M(Qe,1),Qe.m(l,Ts)):Qe&&(Pe(),I(Qe,1,1,()=>{Qe=null}),Me()),ee[0]&136){qn=A[7];let yt;for(yt=0;yt20||A[0].chip=="esp8266"?Ze?(Ze.p(A,ee),ee[0]&1&&M(Ze,1)):(Ze=Ba(A),Ze.c(),M(Ze,1),Ze.m(l,Ss)):Ze&&(Pe(),I(Ze,1,1,()=>{Ze=null}),Me()),ee[0]&8&&(Ot.checked=A[3].d.s),A[3].d.s?pt?pt.p(A,ee):(pt=Za(A),pt.c(),pt.m(bt,null)):pt&&(pt.d(1),pt=null);const mt={};ee[0]&2&&(mt.active=A[1]),Hl.$set(mt);const cr={};ee[0]&4&&(cr.active=A[2]),jl.$set(cr);const pr={};ee[0]&16&&(pr.active=A[4]),Wl.$set(pr);const mr={};ee[0]&32&&(mr.active=A[5]),Gl.$set(mr)},i(A){Ut||(M(r.$$.fragment,A),M(R.$$.fragment,A),M(Pl.$$.fragment,A),M(un.$$.fragment,A),M(dn.$$.fragment,A),M(bn.$$.fragment,A),M(kn.$$.fragment,A),M(ze),M(Ve),M(Ke),M(Qe),M(In.$$.fragment,A),M(Ze),M(Rn.$$.fragment,A),M(Hl.$$.fragment,A),M(jl.$$.fragment,A),M(Wl.$$.fragment,A),M(Gl.$$.fragment,A),Ut=!0)},o(A){I(r.$$.fragment,A),I(R.$$.fragment,A),I(Pl.$$.fragment,A),I(un.$$.fragment,A),I(dn.$$.fragment,A),I(bn.$$.fragment,A),I(kn.$$.fragment,A),I(ze),I(Ve),I(Ke),I(Qe),I(In.$$.fragment,A),I(Ze),I(Rn.$$.fragment,A),I(Hl.$$.fragment,A),I(jl.$$.fragment,A),I(Wl.$$.fragment,A),I(Gl.$$.fragment,A),Ut=!1},d(A){A&&w(e),Q(r),Q(R),Zt(xi,A),it&&it.d(),st&&st.d(),Q(Pl),Zt(es,A),ot&&ot.d(),ut&&ut.d(),rt&&rt.d(),Q(un),Q(dn),Q(bn),at&&at.d(),Q(kn),ft&&ft.d(),ze&&ze.d(),Ve&&Ve.d(),Ke&&Ke.d(),Qe&&Qe.d(),Q(In),Zt(ct,A),Ze&&Ze.d(),Q(Rn),pt&&pt.d(),A&&w(Ms),Q(Hl,A),A&&w(As),Q(jl,A),A&&w(Ds),Q(Wl,A),A&&w(Ns),Q(Gl,A),Is=!1,Be(fr)}}}async function $m(){await(await fetch("/reboot",{method:"POST"})).json()}function Cm(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,a=!1,r={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""}};cc.subscribe(He=>{He.version&&(l(3,r=He),l(1,o=!1))}),Xp();let c=!1,f=!1;async function m(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const He=new URLSearchParams;He.append("perform","true");let Pt=await(await fetch("/reset",{method:"POST",body:He})).json();l(4,c=!1),l(5,f=Pt.success)}}async function _(He){l(2,a=!0);const Yn=new FormData(He.target),Pt=new URLSearchParams;for(let Mt of Yn){const[Si,_l]=Mt;Pt.append(Si,_l)}let Ti=await(await fetch("/save",{method:"POST",body:Pt})).json();Tt.update(Mt=>(Mt.booting=Ti.reboot,Mt.ui=r.u,Mt)),l(2,a=!1),Hn("/")}const h=function(){confirm("Are you sure you want to reboot the device?")&&(Tt.update(He=>(He.booting=!0,He)),$m())},b=function(){r.q.s.e?r.q.p==1883&&l(3,r.q.p=8883,r):r.q.p==8883&&l(3,r.q.p=1883,r)};let d=44;function g(){r.g.h=this.value,l(3,r)}function $(){r.g.t=tt(this),l(3,r)}function k(){r.p.r=tt(this),l(3,r)}function T(){r.p.c=tt(this),l(3,r)}function P(){r.p.m=pe(this.value),l(3,r)}function E(){r.p.e=this.checked,l(3,r)}function S(){r.p.t=this.value,l(3,r)}function N(){r.g.s=tt(this),l(3,r)}function D(){r.g.u=this.value,l(3,r)}function R(){r.g.p=this.value,l(3,r)}function W(){r.m.b=tt(this),l(3,r)}function H(){r.m.p=tt(this),l(3,r)}function F(){r.m.i=this.checked,l(3,r)}function L(){r.m.d=tt(this),l(3,r)}function G(){r.m.f=pe(this.value),l(3,r)}function j(){r.m.r=pe(this.value),l(3,r)}function q(){r.m.e.e=this.checked,l(3,r)}function O(){r.m.e.k=this.value,l(3,r)}function U(){r.m.e.a=this.value,l(3,r)}function x(){r.m.m.e=this.checked,l(3,r)}function X(){r.m.m.w=pe(this.value),l(3,r)}function ne(){r.m.m.v=pe(this.value),l(3,r)}function le(){r.m.m.a=pe(this.value),l(3,r)}function _e(){r.m.m.c=pe(this.value),l(3,r)}function Ce(){r.w.s=this.value,l(3,r)}function ve(){r.w.p=this.value,l(3,r)}function qe(){r.w.z=tt(this),l(3,r)}function he(){r.w.w=pe(this.value),l(3,r)}function Ee(){r.w.a=this.checked,l(3,r)}function be(){r.n.m=tt(this),l(3,r)}function Ne(){r.n.i=this.value,l(3,r)}function ce(){r.n.s=tt(this),l(3,r)}function me(){r.n.g=this.value,l(3,r)}function se(){r.n.d1=this.value,l(3,r)}function re(){r.n.d2=this.value,l(3,r)}function V(){r.n.d=this.checked,l(3,r)}function ae(){r.n.h=this.checked,l(3,r)}function Ae(){r.n.n1=this.value,l(3,r)}function te(){r.q.s.e=this.checked,l(3,r)}function ue(){r.q.h=this.value,l(3,r)}function Ue(){r.q.p=pe(this.value),l(3,r)}function Te(){r.q.u=this.value,l(3,r)}function de(){r.q.a=this.value,l(3,r)}function De(){r.q.c=this.value,l(3,r)}function Le(){r.q.m=tt(this),l(3,r)}function Se(){r.q.b=this.value,l(3,r)}function we(){r.o.e=this.value,l(3,r)}function J(){r.o.c=this.value,l(3,r)}function oe(){r.o.u1=this.value,l(3,r)}function Sl(){r.o.u2=this.value,l(3,r)}function fi(){r.o.u3=this.value,l(3,r)}function ci(){r.h.t=this.value,l(3,r)}function St(){r.h.h=this.value,l(3,r)}function pi(){r.h.n=this.value,l(3,r)}function Xt(He){r.t.t[He]=pe(this.value),l(3,r)}function mi(){r.t.h=pe(this.value),l(3,r)}function _i(He){r.u[He.key]=tt(this),l(3,r)}function di(){r.i.h.u=this.checked,l(3,r)}function lt(){r.i.h.p=tt(this),l(3,r)}function vi(){r.i.a=pe(this.value),l(3,r)}function xt(){r.i.l.i=this.checked,l(3,r)}function Ql(){r.i.l.p=pe(this.value),l(3,r)}function _t(){r.i.r.i=this.checked,l(3,r)}function hi(){r.i.r.r=pe(this.value),l(3,r)}function bi(){r.i.r.g=pe(this.value),l(3,r)}function gi(){r.i.r.b=pe(this.value),l(3,r)}function el(){r.i.t.d=pe(this.value),l(3,r)}function ki(){r.i.t.a=pe(this.value),l(3,r)}function wi(){r.i.v.p=pe(this.value),l(3,r)}function yi(){r.i.v.d.v=pe(this.value),l(3,r)}function dt(){r.i.v.d.g=pe(this.value),l(3,r)}function cl(){r.i.v.o=pe(this.value),l(3,r)}function pl(){r.i.v.m=pe(this.value),l(3,r)}function ml(){r.i.v.b=pe(this.value),l(3,r)}function $i(){r.d.s=this.checked,l(3,r)}function Ci(){r.d.t=this.checked,l(3,r)}function Fe(){r.d.l=tt(this),l(3,r)}return t.$$set=He=>{"sysinfo"in He&&l(0,n=He.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,d=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,a,r,c,f,d,i,m,_,h,b,g,$,k,T,P,E,S,N,D,R,W,H,F,L,G,j,q,O,U,x,X,ne,le,_e,Ce,ve,qe,he,Ee,be,Ne,ce,me,se,re,V,ae,Ae,te,ue,Ue,Te,de,De,Le,Se,we,J,oe,Sl,fi,ci,St,pi,Xt,mi,_i,di,lt,vi,xt,Ql,_t,hi,bi,gi,el,ki,wi,yi,dt,cl,pl,ml,$i,Ci,Fe]}class Tm extends $e{constructor(e){super(),ye(this,e,Cm,ym,ke,{sysinfo:0},null,[-1,-1,-1,-1])}}function Xa(t,e,l){const n=t.slice();return n[20]=e[l],n}function Sm(t){let e=fe(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&2&&e!==(e=fe(n[1].chip,n[1].board)+"")&&B(l,e)},d(n){n&&w(l)}}}function xa(t){let e,l,n=t[1].apmac+"",i,o,a,r,c,f,m,_,h,b=Nr(t[1])+"",d,g,$=t[1].boot_reason+"",k,T,P;const E=[Mm,Pm],S=[];function N(D,R){return D[0].u>0?0:1}return c=N(t),f=S[c]=E[c](t),{c(){e=p("div"),l=C("AP MAC: "),i=C(n),o=v(),a=p("div"),r=C(`Last boot: - `),f.c(),m=v(),_=p("div"),h=C("Reason: "),d=C(b),g=C(" ("),k=C($),T=C(")"),u(e,"class","my-2"),u(a,"class","my-2"),u(_,"class","my-2")},m(D,R){y(D,e,R),s(e,l),s(e,i),y(D,o,R),y(D,a,R),s(a,r),S[c].m(a,null),y(D,m,R),y(D,_,R),s(_,h),s(_,d),s(_,g),s(_,k),s(_,T),P=!0},p(D,R){(!P||R&2)&&n!==(n=D[1].apmac+"")&&B(i,n);let W=c;c=N(D),c===W?S[c].p(D,R):(Pe(),I(S[W],1,1,()=>{S[W]=null}),Me(),f=S[c],f?f.p(D,R):(f=S[c]=E[c](D),f.c()),M(f,1),f.m(a,null)),(!P||R&2)&&b!==(b=Nr(D[1])+"")&&B(d,b),(!P||R&2)&&$!==($=D[1].boot_reason+"")&&B(k,$)},i(D){P||(M(f),P=!0)},o(D){I(f),P=!1},d(D){D&&w(e),D&&w(o),D&&w(a),S[c].d(),D&&w(m),D&&w(_)}}}function Pm(t){let e;return{c(){e=C("-")},m(l,n){y(l,e,n)},p:ie,i:ie,o:ie,d(l){l&&w(e)}}}function Mm(t){let e,l;return e=new rc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function Am(t){let e;return{c(){e=p("span"),e.textContent="Update consents",u(e,"class","btn-pri-sm")},m(l,n){y(l,e,n)},p:ie,d(l){l&&w(e)}}}function ef(t){let e,l,n,i,o,a=ps(t[1].meter.mfg)+"",r,c,f,m,_=t[1].meter.model+"",h,b,d,g,$=t[1].meter.id+"",k;return{c(){e=p("div"),l=p("strong"),l.textContent="Meter",n=v(),i=p("div"),o=C("Manufacturer: "),r=C(a),c=v(),f=p("div"),m=C("Model: "),h=C(_),b=v(),d=p("div"),g=C("ID: "),k=C($),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(d,"class","my-2"),u(e,"class","cnt")},m(T,P){y(T,e,P),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(e,c),s(e,f),s(f,m),s(f,h),s(e,b),s(e,d),s(d,g),s(d,k)},p(T,P){P&2&&a!==(a=ps(T[1].meter.mfg)+"")&&B(r,a),P&2&&_!==(_=T[1].meter.model+"")&&B(h,_),P&2&&$!==($=T[1].meter.id+"")&&B(k,$)},d(T){T&&w(e)}}}function tf(t){let e,l,n,i,o,a=t[1].net.ip+"",r,c,f,m,_=t[1].net.mask+"",h,b,d,g,$=t[1].net.gw+"",k,T,P,E,S=t[1].net.dns1+"",N,D,R=t[1].net.dns2&&lf(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Network",n=v(),i=p("div"),o=C("IP: "),r=C(a),c=v(),f=p("div"),m=C("Mask: "),h=C(_),b=v(),d=p("div"),g=C("Gateway: "),k=C($),T=v(),P=p("div"),E=C("DNS: "),N=C(S),D=v(),R&&R.c(),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(d,"class","my-2"),u(P,"class","my-2"),u(e,"class","cnt")},m(W,H){y(W,e,H),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(e,c),s(e,f),s(f,m),s(f,h),s(e,b),s(e,d),s(d,g),s(d,k),s(e,T),s(e,P),s(P,E),s(P,N),s(P,D),R&&R.m(P,null)},p(W,H){H&2&&a!==(a=W[1].net.ip+"")&&B(r,a),H&2&&_!==(_=W[1].net.mask+"")&&B(h,_),H&2&&$!==($=W[1].net.gw+"")&&B(k,$),H&2&&S!==(S=W[1].net.dns1+"")&&B(N,S),W[1].net.dns2?R?R.p(W,H):(R=lf(W),R.c(),R.m(P,null)):R&&(R.d(1),R=null)},d(W){W&&w(e),R&&R.d()}}}function lf(t){let e,l=t[1].net.dns2+"",n;return{c(){e=C("/ "),n=C(l)},m(i,o){y(i,e,o),y(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&B(n,l)},d(i){i&&w(e),i&&w(n)}}}function nf(t){let e,l,n,i=t[2].tag_name+"",o,a,r,c,f,m,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name&&sf(t),h=t[1].fwconsent===2&&of();return{c(){e=p("div"),l=C(`Latest version: - `),n=p("a"),o=C(i),r=v(),_&&_.c(),c=v(),h&&h.c(),f=We(),u(n,"href",a=t[2].html_url),u(n,"class","ml-2 text-blue-600 hover:text-blue-800"),u(n,"target","_blank"),u(n,"rel","noreferrer"),u(e,"class","my-2 flex")},m(b,d){y(b,e,d),s(e,l),s(e,n),s(n,o),s(e,r),_&&_.m(e,null),y(b,c,d),h&&h.m(b,d),y(b,f,d),m=!0},p(b,d){(!m||d&4)&&i!==(i=b[2].tag_name+"")&&B(o,i),(!m||d&4&&a!==(a=b[2].html_url))&&u(n,"href",a),(b[1].security==0||b[0].a)&&b[1].fwconsent===1&&b[2]&&b[2].tag_name?_?(_.p(b,d),d&7&&M(_,1)):(_=sf(b),_.c(),M(_,1),_.m(e,null)):_&&(Pe(),I(_,1,1,()=>{_=null}),Me()),b[1].fwconsent===2?h||(h=of(),h.c(),h.m(f.parentNode,f)):h&&(h.d(1),h=null)},i(b){m||(M(_),m=!0)},o(b){I(_),m=!1},d(b){b&&w(e),_&&_.d(),b&&w(c),h&&h.d(b),b&&w(f)}}}function sf(t){let e,l,n,i,o,a;return n=new ac({}),{c(){e=p("div"),l=p("button"),Z(n.$$.fragment),u(e,"class","flex-none ml-2 text-green-500"),u(e,"title","Install this version")},m(r,c){y(r,e,c),s(e,l),K(n,l,null),i=!0,o||(a=z(l,"click",t[10]),o=!0)},p:ie,i(r){i||(M(n.$$.fragment,r),i=!0)},o(r){I(n.$$.fragment,r),i=!1},d(r){r&&w(e),Q(n),o=!1,a()}}}function of(t){let e;return{c(){e=p("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',u(e,"class","my-2")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function uf(t){let e,l=ms(fe(t[1].chip,t[1].board))+"",n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=ms(fe(i[1].chip,i[1].board))+"")&&B(n,l)},d(i){i&&w(e)}}}function rf(t){let e,l,n,i,o,a;function r(m,_){return m[4].length==0?Nm:Dm}let c=r(t),f=c(t);return{c(){e=p("div"),l=p("form"),n=p("input"),i=v(),f.c(),Cf(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","/firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(e,"class","my-2 flex")},m(m,_){y(m,e,_),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(a=[z(n,"change",t[13]),z(l,"submit",t[15])],o=!0)},p(m,_){c===(c=r(m))&&f?f.p(m,_):(f.d(1),f=c(m),f&&(f.c(),f.m(l,null)))},d(m){m&&w(e),t[12](null),f.d(),o=!1,Be(a)}}}function Dm(t){let e=t[4][0].name+"",l,n,i;return{c(){l=C(e),n=v(),i=p("button"),i.textContent="Upload",u(i,"type","submit"),u(i,"class","btn-pri-sm float-right")},m(o,a){y(o,l,a),y(o,n,a),y(o,i,a)},p(o,a){a&16&&e!==(e=o[4][0].name+"")&&B(l,e)},d(o){o&&w(l),o&&w(n),o&&w(i)}}}function Nm(t){let e,l,n;return{c(){e=p("button"),e.textContent="Select firmware file for upgrade",u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(i,o){y(i,e,o),l||(n=z(e,"click",t[14]),l=!0)},p:ie,d(i){i&&w(e),l=!1,n()}}}function af(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g=t[9],$=[];for(let S=0;S Include Secrets
(SSID, PSK, passwords and tokens)',c=v(),k&&k.c(),f=v(),m=p("form"),_=p("input"),h=v(),E.c(),u(l,"class","text-sm"),u(r,"class","my-1 mx-3 col-span-2"),u(o,"class","grid grid-cols-2"),u(i,"method","get"),u(i,"action","/configfile.cfg"),u(i,"autocomplete","off"),Cf(_,"display","none"),u(_,"name","file"),u(_,"type","file"),u(_,"accept",".cfg"),u(m,"action","/configfile"),u(m,"enctype","multipart/form-data"),u(m,"method","post"),u(m,"autocomplete","off"),u(e,"class","cnt")},m(S,N){y(S,e,N),s(e,l),s(e,n),s(e,i),s(i,o);for(let D=0;D<$.length;D+=1)$[D].m(o,null);s(o,a),s(o,r),s(i,c),k&&k.m(i,null),s(e,f),s(e,m),s(m,_),t[16](_),s(m,h),E.m(m,null),b||(d=[z(_,"change",t[17]),z(m,"submit",t[19])],b=!0)},p(S,N){if(N&512){g=S[9];let D;for(D=0;D{ce=null}),Me());const Te={};ue&8388608&&(Te.$$scope={dirty:ue,ctx:te}),S.$set(Te),te[1].meter?me?me.p(te,ue):(me=ef(te),me.c(),me.m(e,W)):me&&(me.d(1),me=null),te[1].net?se?se.p(te,ue):(se=tf(te),se.c(),se.m(e,H)):se&&(se.d(1),se=null),(!Ee||ue&2)&&O!==(O=te[1].version+"")&&B(U,O),te[2]?re?(re.p(te,ue),ue&4&&M(re,1)):(re=nf(te),re.c(),M(re,1),re.m(F,X)):re&&(Pe(),I(re,1,1,()=>{re=null}),Me()),ue&3&&(ne=(te[1].security==0||te[0].a)&&jn(te[1].board)),ne?V?V.p(te,ue):(V=uf(te),V.c(),V.m(F,le)):V&&(V.d(1),V=null),te[1].security==0||te[0].a?ae?ae.p(te,ue):(ae=rf(te),ae.c(),ae.m(F,null)):ae&&(ae.d(1),ae=null),te[1].security==0||te[0].a?Ae?Ae.p(te,ue):(Ae=af(te),Ae.c(),Ae.m(e,null)):Ae&&(Ae.d(1),Ae=null);const de={};ue&32&&(de.active=te[5]),ve.$set(de);const De={};ue&256&&(De.active=te[8]),he.$set(De)},i(te){Ee||(M(h.$$.fragment,te),M(ce),M(S.$$.fragment,te),M(re),M(ve.$$.fragment,te),M(he.$$.fragment,te),Ee=!0)},o(te){I(h.$$.fragment,te),I(ce),I(S.$$.fragment,te),I(re),I(ve.$$.fragment,te),I(he.$$.fragment,te),Ee=!1},d(te){te&&w(e),Q(h),ce&&ce.d(),Q(S),me&&me.d(),se&&se.d(),re&&re.d(),V&&V.d(),ae&&ae.d(),Ae&&Ae.d(),te&&w(Ce),Q(ve,te),te&&w(qe),Q(he,te),be=!1,Ne()}}}async function Fm(){await(await fetch("/reboot",{method:"POST"})).json()}function Lm(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],a={};ao.subscribe(D=>{l(2,a=uc(i.version,D)),a||l(2,a=D[0])});function r(){confirm("Do you want to upgrade this device to "+a.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(ms(fe(i.chip,i.board))))&&(Tt.update(D=>(D.upgrading=!0,D)),oc())}const c=function(){confirm("Are you sure you want to reboot the device?")&&(Tt.update(D=>(D.booting=!0,D)),Fm())};let f,m=[],_=!1,h,b=[],d=!1;oo();function g(D){fs[D?"unshift":"push"](()=>{f=D,l(3,f)})}function $(){m=this.files,l(4,m)}const k=()=>{f.click()},T=()=>l(5,_=!0);function P(D){fs[D?"unshift":"push"](()=>{h=D,l(6,h)})}function E(){b=this.files,l(7,b)}const S=()=>{h.click()},N=()=>l(8,d=!0);return t.$$set=D=>{"data"in D&&l(0,n=D.data),"sysinfo"in D&&l(1,i=D.sysinfo)},[n,i,a,f,m,_,h,b,d,o,r,c,g,$,k,T,P,E,S,N]}class qm extends $e{constructor(e){super(),ye(this,e,Lm,Rm,ke,{data:0,sysinfo:1})}}function pf(t){let e,l,n=fe(t[0],7)+"",i,o,a=fe(t[0],5)+"",r,c,f=fe(t[0],4)+"",m,_,h=fe(t[0],3)+"",b,d,g,$,k=fe(t[0],2)+"",T,P,E=fe(t[0],1)+"",S,N,D=fe(t[0],0)+"",R,W,H,F,L=fe(t[0],101)+"",G,j,q=fe(t[0],100)+"",O;return{c(){e=p("optgroup"),l=p("option"),i=C(n),o=p("option"),r=C(a),c=p("option"),m=C(f),_=p("option"),b=C(h),d=v(),g=p("optgroup"),$=p("option"),T=C(k),P=p("option"),S=C(E),N=p("option"),R=C(D),W=v(),H=p("optgroup"),F=p("option"),G=C(L),j=p("option"),O=C(q),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,_.__value=3,_.value=_.__value,u(e,"label","amsleser.no"),$.__value=2,$.value=$.__value,P.__value=1,P.value=P.__value,N.__value=0,N.value=N.__value,u(g,"label","Custom hardware"),F.__value=101,F.value=F.__value,j.__value=100,j.value=j.__value,u(H,"label","Generic hardware")},m(U,x){y(U,e,x),s(e,l),s(l,i),s(e,o),s(o,r),s(e,c),s(c,m),s(e,_),s(_,b),y(U,d,x),y(U,g,x),s(g,$),s($,T),s(g,P),s(P,S),s(g,N),s(N,R),y(U,W,x),y(U,H,x),s(H,F),s(F,G),s(H,j),s(j,O)},p(U,x){x&1&&n!==(n=fe(U[0],7)+"")&&B(i,n),x&1&&a!==(a=fe(U[0],5)+"")&&B(r,a),x&1&&f!==(f=fe(U[0],4)+"")&&B(m,f),x&1&&h!==(h=fe(U[0],3)+"")&&B(b,h),x&1&&k!==(k=fe(U[0],2)+"")&&B(T,k),x&1&&E!==(E=fe(U[0],1)+"")&&B(S,E),x&1&&D!==(D=fe(U[0],0)+"")&&B(R,D),x&1&&L!==(L=fe(U[0],101)+"")&&B(G,L),x&1&&q!==(q=fe(U[0],100)+"")&&B(O,q)},d(U){U&&w(e),U&&w(d),U&&w(g),U&&w(W),U&&w(H)}}}function mf(t){let e,l,n=fe(t[0],201)+"",i,o,a=fe(t[0],202)+"",r,c,f=fe(t[0],203)+"",m,_,h=fe(t[0],200)+"",b;return{c(){e=p("optgroup"),l=p("option"),i=C(n),o=p("option"),r=C(a),c=p("option"),m=C(f),_=p("option"),b=C(h),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,_.__value=200,_.value=_.__value,u(e,"label","Generic hardware")},m(d,g){y(d,e,g),s(e,l),s(l,i),s(e,o),s(o,r),s(e,c),s(c,m),s(e,_),s(_,b)},p(d,g){g&1&&n!==(n=fe(d[0],201)+"")&&B(i,n),g&1&&a!==(a=fe(d[0],202)+"")&&B(r,a),g&1&&f!==(f=fe(d[0],203)+"")&&B(m,f),g&1&&h!==(h=fe(d[0],200)+"")&&B(b,h)},d(d){d&&w(e)}}}function _f(t){let e,l,n=fe(t[0],7)+"",i,o,a=fe(t[0],6)+"",r,c,f=fe(t[0],5)+"",m,_,h,b,d=fe(t[0],51)+"",g,$,k=fe(t[0],50)+"",T;return{c(){e=p("optgroup"),l=p("option"),i=C(n),o=p("option"),r=C(a),c=p("option"),m=C(f),_=v(),h=p("optgroup"),b=p("option"),g=C(d),$=p("option"),T=C(k),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,u(e,"label","amsleser.no"),b.__value=51,b.value=b.__value,$.__value=50,$.value=$.__value,u(h,"label","Generic hardware")},m(P,E){y(P,e,E),s(e,l),s(l,i),s(e,o),s(o,r),s(e,c),s(c,m),y(P,_,E),y(P,h,E),s(h,b),s(b,g),s(h,$),s($,T)},p(P,E){E&1&&n!==(n=fe(P[0],7)+"")&&B(i,n),E&1&&a!==(a=fe(P[0],6)+"")&&B(r,a),E&1&&f!==(f=fe(P[0],5)+"")&&B(m,f),E&1&&d!==(d=fe(P[0],51)+"")&&B(g,d),E&1&&k!==(k=fe(P[0],50)+"")&&B(T,k)},d(P){P&&w(e),P&&w(_),P&&w(h)}}}function df(t){let e,l,n=fe(t[0],8)+"",i,o,a,r,c=fe(t[0],71)+"",f,m,_=fe(t[0],70)+"",h;return{c(){e=p("optgroup"),l=p("option"),i=C(n),o=v(),a=p("optgroup"),r=p("option"),f=C(c),m=p("option"),h=C(_),l.__value=8,l.value=l.__value,u(e,"label","Custom hardware"),r.__value=71,r.value=r.__value,m.__value=70,m.value=m.__value,u(a,"label","Generic hardware")},m(b,d){y(b,e,d),s(e,l),s(l,i),y(b,o,d),y(b,a,d),s(a,r),s(r,f),s(a,m),s(m,h)},p(b,d){d&1&&n!==(n=fe(b[0],8)+"")&&B(i,n),d&1&&c!==(c=fe(b[0],71)+"")&&B(f,c),d&1&&_!==(_=fe(b[0],70)+"")&&B(h,_)},d(b){b&&w(e),b&&w(o),b&&w(a)}}}function vf(t){let e,l,n=fe(t[0],200)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=200,l.value=l.__value,u(e,"label","Generic hardware")},m(o,a){y(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=fe(o[0],200)+"")&&B(i,n)},d(o){o&&w(e)}}}function Om(t){let e,l,n,i,o,a,r,c=t[0]=="esp8266"&&pf(t),f=t[0]=="esp32"&&mf(t),m=t[0]=="esp32s2"&&_f(t),_=t[0]=="esp32c3"&&df(t),h=t[0]=="esp32solo"&&vf(t);return{c(){e=p("option"),l=v(),c&&c.c(),n=v(),f&&f.c(),i=v(),m&&m.c(),o=v(),_&&_.c(),a=v(),h&&h.c(),r=We(),e.__value=-1,e.value=e.__value},m(b,d){y(b,e,d),y(b,l,d),c&&c.m(b,d),y(b,n,d),f&&f.m(b,d),y(b,i,d),m&&m.m(b,d),y(b,o,d),_&&_.m(b,d),y(b,a,d),h&&h.m(b,d),y(b,r,d)},p(b,[d]){b[0]=="esp8266"?c?c.p(b,d):(c=pf(b),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),b[0]=="esp32"?f?f.p(b,d):(f=mf(b),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),b[0]=="esp32s2"?m?m.p(b,d):(m=_f(b),m.c(),m.m(o.parentNode,o)):m&&(m.d(1),m=null),b[0]=="esp32c3"?_?_.p(b,d):(_=df(b),_.c(),_.m(a.parentNode,a)):_&&(_.d(1),_=null),b[0]=="esp32solo"?h?h.p(b,d):(h=vf(b),h.c(),h.m(r.parentNode,r)):h&&(h.d(1),h=null)},i:ie,o:ie,d(b){b&&w(e),b&&w(l),c&&c.d(b),b&&w(n),f&&f.d(b),b&&w(i),m&&m.d(b),b&&w(o),_&&_.d(b),b&&w(a),h&&h.d(b),b&&w(r)}}}function Um(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Hm extends $e{constructor(e){super(),ye(this,e,Um,Om,ke,{chip:0})}}function hf(t){let e;return{c(){e=p("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function bf(t){let e,l,n,i,o,a,r;return a=new pc({props:{chip:t[0].chip}}),{c(){e=p("div"),l=C("HAN GPIO"),n=p("br"),i=v(),o=p("select"),Z(a.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(e,"class","my-3")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),K(a,o,null),r=!0},p(c,f){const m={};f&1&&(m.chip=c[0].chip),a.$set(m)},i(c){r||(M(a.$$.fragment,c),r=!0)},o(c){I(a.$$.fragment,c),r=!1},d(c){c&&w(e),Q(a)}}}function jm(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,H,F,L,G,j=t[0].usrcfg&&hf();d=new Hm({props:{chip:t[0].chip}});let q=t[0].board&&t[0].board>20&&bf(t);return H=new gt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),o=v(),a=p("strong"),a.textContent="Initial configuration",r=v(),j&&j.c(),c=v(),f=p("div"),m=C("Board type"),_=p("br"),h=v(),b=p("select"),Z(d.$$.fragment),g=v(),q&&q.c(),$=v(),k=p("div"),T=p("label"),P=p("input"),E=C(" Clear all other configuration"),S=v(),N=p("div"),N.innerHTML='',D=v(),R=p("span"),R.textContent="\xA0",W=v(),Z(H.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(a,"class","text-sm"),u(b,"name","vb"),u(b,"class","in-s"),t[0].board===void 0&&Ye(()=>t[4].call(b)),u(f,"class","my-3"),u(P,"type","checkbox"),u(P,"name","vr"),P.__value="true",P.value=P.__value,u(P,"class","rounded mb-1"),u(k,"class","my-3"),u(N,"class","my-3"),u(R,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(O,U){y(O,e,U),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),j&&j.m(n,null),s(n,c),s(n,f),s(f,m),s(f,_),s(f,h),s(f,b),K(d,b,null),Re(b,t[0].board),s(n,g),q&&q.m(n,null),s(n,$),s(n,k),s(k,T),s(T,P),P.checked=t[2],s(T,E),s(n,S),s(n,N),s(n,D),s(n,R),y(O,W,U),K(H,O,U),F=!0,L||(G=[z(b,"change",t[4]),z(P,"change",t[5]),z(n,"submit",_s(t[3]))],L=!0)},p(O,[U]){O[0].usrcfg?j||(j=hf(),j.c(),j.m(n,c)):j&&(j.d(1),j=null);const x={};U&1&&(x.chip=O[0].chip),d.$set(x),U&1&&Re(b,O[0].board),O[0].board&&O[0].board>20?q?(q.p(O,U),U&1&&M(q,1)):(q=bf(O),q.c(),M(q,1),q.m(n,$)):q&&(Pe(),I(q,1,1,()=>{q=null}),Me()),U&4&&(P.checked=O[2]);const X={};U&2&&(X.active=O[1]),H.$set(X)},i(O){F||(M(d.$$.fragment,O),M(q),M(H.$$.fragment,O),F=!0)},o(O){I(d.$$.fragment,O),I(q),I(H.$$.fragment,O),F=!1},d(O){O&&w(e),j&&j.d(),Q(d),q&&q.d(),O&&w(W),Q(H,O),L=!1,Be(G)}}}function Wm(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(f){l(1,i=!0);const m=new FormData(f.target),_=new URLSearchParams;for(let d of m){const[g,$]=d;_.append(g,$)}let b=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),Tt.update(d=>(d.vndcfg=b.success,d.booting=b.reboot,d)),Hn(n.usrcfg?"/":"/setup")}let a=!1;function r(){n.board=tt(this),l(0,n)}function c(){a=this.checked,l(2,a),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,a=!n.usrcfg)},[n,i,a,o,r,c]}class Gm extends $e{constructor(e){super(),ye(this,e,Wm,jm,ke,{sysinfo:0})}}function gf(t){let e,l,n,i,o,a,r,c;return r=new mc({}),{c(){e=p("br"),l=v(),n=p("div"),i=p("input"),o=v(),a=p("select"),Z(r.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=t[1],u(a,"name","su"),u(a,"class","in-l"),a.required=t[1],u(n,"class","flex")},m(f,m){y(f,e,m),y(f,l,m),y(f,n,m),s(n,i),s(n,o),s(n,a),K(r,a,null),c=!0},p(f,m){(!c||m&2)&&(i.required=f[1]),(!c||m&2)&&(a.required=f[1])},i(f){c||(M(r.$$.fragment,f),c=!0)},o(f){I(r.$$.fragment,f),c=!1},d(f){f&&w(e),f&&w(l),f&&w(n),Q(r)}}}function kf(t){let e;return{c(){e=p("div"),e.innerHTML=`
Gateway
+Occurred in: ${i}`:"",a=ao(t),r=Lf(e)?e(a):e;return`<${a}> ${r}${o}`}const Qf=t=>(...e)=>t(Zc(...e)),Zf=Qf(t=>{throw new Error(t)}),vs=Qf(console.warn),Pr=4,Jc=3,Xc=2,xc=1,e1=1;function t1(t,e){const l=t.default?0:Zt(t.fullPath).reduce((n,i)=>{let o=n;return o+=Pr,jc(i)?o+=e1:Wc(i)?o+=Xc:Gf(i)?o-=Pr+xc:o+=Jc,o},0);return{route:t,score:l,index:e}}function l1(t){return t.map(t1).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Jf(t,e){let l,n;const[i]=e.split("?"),o=Zt(i),a=o[0]==="",r=l1(t);for(let c=0,f=r.length;c({...m,params:h,uri:k});if(m.default){n=b(e);continue}const d=Zt(m.fullPath),g=Math.max(o.length,d.length);let $=0;for(;${f===".."?c.pop():f!=="."&&c.push(f)}),Us(`/${c.join("/")}`,n)}function Mr(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=Zt(e,!0),r=Zt(l,!0);for(;a.length;)a[0]!==r[0]&&Zf(zl,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),r.shift();return{pathname:pi(...r),hash:n,search:i,state:o}}const Ar=t=>t.length===1?"":t,fo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Ar(si(t,l)):"",a=i?si(t,0,l):t,r=n?Ar(si(a,e)):"";return{pathname:(n?si(a,0,e):a)||"/",search:r,hash:o}},i1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function s1(t,e,l){return pi(l,n1(t,e))}function o1(t,e){const l=uo(Gc(t)),n=Zt(l,!0),i=Zt(e,!0).slice(0,n.length),o=Xf({fullPath:l},pi(...i));return o&&o.uri}const Hs="POP",u1="PUSH",r1="REPLACE";function js(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function a1(t){let e=[],l=js(t),n=Hs;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=js(t),n=Hs,i([o])};i([o]);const r=Uf(t,"popstate",a);return()=>{r(),e=e.filter(c=>c!==o)}},navigate(o,a){const{state:r={},replace:c=!1}=a||{};if(n=c?r1:u1,qf(o))a&&vs(Kf,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Hs,t.history.go(o);else{const f={...r,_key:qc()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=js(t),i()}}}function Ws(t,e){return{...fo(e),state:t}}function f1(t="/"){let e=0,l=[Ws(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Ws(n,o))},replaceState(n,i,o){l[e]=Ws(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const c1=!!(!$l&&window.document&&window.document.createElement),p1=!$l&&window.location.origin==="null",xf=a1(c1&&!p1?window:f1()),{navigate:Bn}=xf;let cl=null,ec=!0;function m1(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;ncl.level||t.level===cl.level&&m1(t.routerId,cl.routerId))&&(cl=t)}function d1(){cl=null}function v1(){ec=!1}function Dr(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Uf(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function h1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function b1(t){return/^H[1-6]$/i.test(t.tagName)}function Nr(t,e=document){return e.querySelector(t)}function g1(t){let l=Nr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!h1(l,t);){if(b1(l))return l;const n=Nr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function k1(t){Promise.resolve(zn(t.focusElement)).then(e=>{const l=e||g1(t.id);l||vs(zl,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,ks),!Dr(l)&&Dr(document.documentElement)})}const w1=(t,e,l)=>(n,i)=>Ec().then(()=>{if(!cl||ec){v1();return}if(n&&k1(cl.route),t.announcements&&i){const{path:o,fullPath:a,meta:r,params:c,uri:f}=cl.route,m=t.createAnnouncement({path:o,fullPath:a,meta:r,params:c,uri:f},zn(l));Promise.resolve(m).then(_=>{e.set(_)})}d1()}),Ir="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function y1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Ys(t[6],Ir)],i={};for(let o=0;o`Navigated to ${le.uri}`,announcements:!0,...d},k=m,T=uo(m),P=yl(zs),E=yl(Kn),S=!P,N=C1(),D=b&&!(E&&!E.manageFocus),R=Je("");zt(t,R,le=>l(0,r=le));const W=E?E.disableInlineStyles:g,O=Je([]);zt(t,O,le=>l(20,a=le));const F=Je(null);zt(t,F,le=>l(18,i=le));let L=!1;const j=S?0:E.level+1,q=S?Je((()=>Mr($l?fo(_):h.location,T))()):P;zt(t,q,le=>l(17,n=le));const G=Je(n);zt(t,G,le=>l(19,o=le));const H=w1($,R,q),V=le=>_e=>_e.filter(Te=>Te.id!==le);function X(le){if($l){if(L)return;const _e=Xf(le,n.pathname);if(_e)return L=!0,_e}else O.update(_e=>{const Te=V(le.id)(_e);return Te.push(le),Te})}function ne(le){O.update(V(le))}return!S&&m!==Er&&vs(zl,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:m}),S&&(Dc(()=>h.listen(_e=>{const Te=Mr(_e.location,T);G.set(n),q.set(Te)})),ui(zs,q)),ui(Kn,{activeRoute:F,registerRoute:X,unregisterRoute:ne,manageFocus:D,level:j,id:N,history:S?h:E.history,basepath:S?T:E.basepath,disableInlineStyles:W}),t.$$set=le=>{"basepath"in le&&l(11,m=le.basepath),"url"in le&&l(12,_=le.url),"history"in le&&l(13,h=le.history),"primary"in le&&l(14,b=le.primary),"a11y"in le&&l(15,d=le.a11y),"disableInlineStyles"in le&&l(16,g=le.disableInlineStyles),"$$scope"in le&&l(21,f=le.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&m!==k&&vs(zl,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const le=Jf(a,n.pathname);F.set(le)}if(t.$$.dirty[0]&655360&&S){const le=!!n.hash,_e=!le&&D,Te=!le||n.pathname!==o.pathname;H(_e,Te)}t.$$.dirty[0]&262144&&D&&i&&i.primary&&_1({level:j,routerId:N,route:i})},[r,$,S,N,D,R,W,O,F,q,G,m,_,h,b,d,g,n,i,o,a,f,c]}class tc extends Ce{constructor(e){super(),$e(this,e,T1,$1,ye,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}function mi(t,e,l=Kn,n=zl){yl(l)||Zf(t,o=>`You cannot use ${o} outside of a ${ao(n)}.`,e)}const S1=t=>{const{subscribe:e}=yl(t);return{subscribe:e}};function lc(){return mi(Yf),S1(zs)}function nc(){const{history:t}=yl(Kn);return t}function ic(){const t=yl(jf);return t?Oc(t,e=>e.base):Je("/")}function sc(){mi(Vf);const t=ic(),{basepath:e}=yl(Kn);return n=>s1(n,zn(t),e)}function P1(){mi(zf);const t=sc(),{navigate:e}=nc();return(n,i)=>{const o=qf(n)?n:t(n);return e(o,i)}}const M1=t=>({params:t&16,location:t&8}),Rr=t=>({params:$l?zn(t[10]):t[4],location:t[3],navigate:t[11]});function Fr(t){let e,l;return e=new tc({props:{primary:t[1],$$slots:{default:[N1]},$$scope:{ctx:t}}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function A1(t){let e;const l=t[18].default,n=no(l,t,t[19],Rr);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&so(n,l,i,i[19],e?io(l,i[19],o,M1):oo(i[19]),Rr)},i(i){e||(M(n,i),e=!0)},o(i){I(n,i),e=!1},d(i){n&&n.d(i)}}}function D1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},$l?zn(t[10]):t[4],t[12]];var o=t[0];function a(r){let c={};for(let f=0;f{Z(m,1)}),Me()}o?(e=new o(a()),J(e.$$.fragment),M(e.$$.fragment,1),Q(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(r){n||(e&&M(e.$$.fragment,r),n=!0)},o(r){e&&I(e.$$.fragment,r),n=!1},d(r){r&&w(l),e&&Z(e,r)}}}function N1(t){let e,l,n,i;const o=[D1,A1],a=[];function r(c,f){return c[0]!==null?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e===m?a[e].p(c,f):(Pe(),I(a[m],1,1,()=>{a[m]=null}),Me(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function I1(t){let e,l,n,i,o,a=[Gn(t[7]),{"data-svnav-route-start":t[5]}],r={};for(let _=0;_{c=null}),Me()),Vt(i,m=Vn(f,[Gn(_[7]),{"data-svnav-route-end":_[5]}]))},i(_){o||(M(c),o=!0)},o(_){I(c),o=!1},d(_){_&&w(e),_&&w(l),c&&c.d(_),_&&w(n),_&&w(i)}}}const E1=Of();function R1(t,e,l){let n;const i=["path","component","meta","primary"];let o=_s(e,i),a,r,c,f,{$$slots:m={},$$scope:_}=e,{path:h=""}=e,{component:b=null}=e,{meta:d={}}=e,{primary:g=!0}=e;mi(ks,e);const $=E1(),{registerRoute:k,unregisterRoute:T,activeRoute:P,disableInlineStyles:E}=yl(Kn);zt(t,P,L=>l(16,a=L));const S=ic();zt(t,S,L=>l(17,c=L));const N=lc();zt(t,N,L=>l(3,r=L));const D=Je(null);let R;const W=Je(),O=Je({});zt(t,O,L=>l(4,f=L)),ui(jf,W),ui(Uc,O),ui(Hc,D);const F=P1();return $l||Nc(()=>T($)),t.$$set=L=>{l(24,e=Ut(Ut({},e),ms(L))),l(12,o=_s(e,i)),"path"in L&&l(13,h=L.path),"component"in L&&l(0,b=L.component),"meta"in L&&l(14,d=L.meta),"primary"in L&&l(1,g=L.primary),"$$scope"in L&&l(19,_=L.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const L=h==="",j=pi(c,h),U={id:$,path:h,meta:d,default:L,fullPath:L?"":j,base:L?c:o1(j,r.pathname),primary:g,focusElement:D};W.set(U),l(15,R=k(U))}if(t.$$.dirty&98304&&l(2,n=!!(R||a&&a.id===$)),t.$$.dirty&98308&&n){const{params:L}=R||a;O.set(L)}},e=ms(e),[b,g,n,r,f,$,P,E,S,N,O,F,o,h,d,R,a,c,m,_]}class fl extends Ce{constructor(e){super(),$e(this,e,R1,I1,ye,{path:13,component:0,meta:14,primary:1})}}function F1(t){let e,l,n,i;const o=t[13].default,a=no(o,t,t[12],null);let r=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,_=D));const P=Ic(),E=sc(),{navigate:S}=nc();function N(D){P("click",D),Lc(D)&&(D.preventDefault(),S(n,{state:$,replace:a||g}))}return t.$$set=D=>{l(19,e=Ut(Ut({},e),ms(D))),l(18,m=_s(e,f)),"to"in D&&l(5,d=D.to),"replace"in D&&l(6,g=D.replace),"state"in D&&l(7,$=D.state),"getProps"in D&&l(8,k=D.getProps),"$$scope"in D&&l(12,b=D.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=E(d,_)),t.$$.dirty&2049&&l(10,i=Vs(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(a=fo(n)===i1(_)),t.$$.dirty&512&&l(2,r=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(Lf(k)){const D=k({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...m,...D}}return m})())},e=ms(e),[n,c,r,T,N,d,g,$,k,o,i,_,b,h]}class wl extends Ce{constructor(e){super(),$e(this,e,L1,F1,ye,{to:5,replace:6,state:7,getProps:8})}}let Ks=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function kl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function q1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function oc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function O1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function hs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return""}}function Ie(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function ce(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Lr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received last 30s";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function qr(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Or(t){switch(t){case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Yn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function je(t,e){return t==1||t==2&&e}function Ct(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function we(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function ri(t,e){return t.setTime(t.getTime()+e*36e5),t}function Ur(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}async function Cl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let Yt={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,trying:null};const Tt=Je(Yt);async function co(){Yt=await(await Cl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Tt.set(Yt)}let as=0,Hr=-127,jr=null,U1={};const H1=Hf(U1,t=>{let e;async function l(){Cl("/data.json").then(n=>n.json()).then(n=>{t(n),Hr!=n.t&&(Hr=n.t,setTimeout(fc,2e3)),jr!=n.p&&n.pe&&(jr=n.p,setTimeout(j1,4e3)),Yt.upgrading?window.location.reload():(!Yt||!Yt.chip||Yt.booting||as>1&&!Yn(Yt.board))&&(co(),Bl&&clearTimeout(Bl),Bl=setTimeout(po,2e3),Yl&&clearTimeout(Yl),Yl=setTimeout(mo,3e3));let i=5e3;if(Yn(Yt.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),as=0}).catch(n=>{as++,as>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,Yn(Yt.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Qs={};const uc=Je(Qs);async function j1(){Qs=await(await Cl("/energyprice.json")).json(),uc.set(Qs)}let Zs={},Bl;async function po(){Bl&&(clearTimeout(Bl),Bl=0),Zs=await(await Cl("/dayplot.json")).json(),rc.set(Zs);let e=new Date;Bl=setTimeout(po,(60-e.getMinutes())*6e4+20)}const rc=Je(Zs,t=>(po(),function(){}));let Js={},Yl;async function mo(){Yl&&(clearTimeout(Yl),Yl=0),Js=await(await Cl("/monthplot.json")).json(),ac.set(Js);let e=new Date;Yl=setTimeout(mo,(24-e.getHours())*36e5+40)}const ac=Je(Js,t=>(mo(),function(){}));let Xs={};async function fc(){Xs=await(await Cl("/temperature.json")).json(),cc.set(Xs)}const cc=Je(Xs,t=>(fc(),function(){}));let xs={},fs;async function pc(){fs&&(clearTimeout(fs),fs=0),xs=await(await Cl("/tariff.json")).json(),mc.set(xs);let e=new Date;fs=setTimeout(pc,(60-e.getMinutes())*6e4+30)}const mc=Je(xs,t=>function(){});let eo=[];const _o=Je(eo);async function W1(){eo=await(await Cl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),_o.set(eo)}function bs(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function _c(){await(await fetch("/upgrade",{method:"POST"})).json()}function dc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),a=[...e];a.reverse();let r,c,f;for(let m=0;mo&&(r=_):g==i+1&&(c=_);else if(d==n+1)if(f){let k=f.tag_name.substring(1).split(".");parseInt(k[0]);let T=parseInt(k[1]);parseInt(k[2]),g==T&&(f=_)}else f=_}return c||f||r||!1}else return e[0]}const G1="/github.svg";function Wr(t){let e,l;function n(a,r){return a[1]>1?Z1:a[1]>0?Q1:a[2]>1?K1:a[2]>0?V1:a[3]>1?z1:a[3]>0?Y1:B1}let i=n(t),o=i(t);return{c(){e=C(`Up + `),o.c(),l=We()},m(a,r){y(a,e,r),o.m(a,r),y(a,l,r)},p(a,r){i===(i=n(a))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},d(a){a&&w(e),o.d(a),a&&w(l)}}}function B1(t){let e,l;return{c(){e=C(t[0]),l=C(" seconds")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&1&&B(e,n[0])},d(n){n&&w(e),n&&w(l)}}}function Y1(t){let e,l;return{c(){e=C(t[3]),l=C(" minute")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function z1(t){let e,l;return{c(){e=C(t[3]),l=C(" minutes")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function V1(t){let e,l;return{c(){e=C(t[2]),l=C(" hour")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function K1(t){let e,l;return{c(){e=C(t[2]),l=C(" hours")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function Q1(t){let e,l;return{c(){e=C(t[1]),l=C(" day")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function Z1(t){let e,l;return{c(){e=C(t[1]),l=C(" days")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function J1(t){let e,l=t[0]&&Wr(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Wr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&w(e)}}}function X1(t,e,l){let{epoch:n}=e,i=0,o=0,a=0;return t.$$set=r=>{"epoch"in r&&l(0,n=r.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,a=Math.floor(n/60)))},[n,i,o,a]}class x1 extends Ce{constructor(e){super(),$e(this,e,X1,J1,ye,{epoch:0})}}function ep(t){let e,l,n;return{c(){e=p("span"),l=C(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){y(i,e,o),s(e,l)},p(i,[o]){o&4&&B(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ie,o:ie,d(i){i&&w(e)}}}function tp(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class Kt extends Ce{constructor(e){super(),$e(this,e,tp,ep,ye,{color:0,title:1,text:2})}}function lp(t){let e,l=`${Ie(t[0].getDate())}.${Ie(t[0].getMonth())}.${t[0].getFullYear()} ${Ie(t[0].getHours())}:${Ie(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=C(l),u(e,"class",t[1])},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ie(i[0].getDate())}.${Ie(i[0].getMonth())}.${i[0].getFullYear()} ${Ie(i[0].getHours())}:${Ie(i[0].getMinutes())}`)&&B(n,l),o&2&&u(e,"class",i[1])},d(i){i&&w(e)}}}function np(t){let e=`${Ie(t[0].getDate())}. ${Ks[t[0].getMonth()]} ${Ie(t[0].getHours())}:${Ie(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&1&&e!==(e=`${Ie(n[0].getDate())}. ${Ks[n[0].getMonth()]} ${Ie(n[0].getHours())}:${Ie(n[0].getMinutes())}`)&&B(l,e)},d(n){n&&w(l)}}}function ip(t){let e,l;function n(a,r){return r&1&&(e=null),e==null&&(e=Math.abs(new Date().getTime()-a[0].getTime())<3e5),e?np:lp}let i=n(t,-1),o=i(t);return{c(){o.c(),l=We()},m(a,r){o.m(a,r),y(a,l,r)},p(a,[r]){i===(i=n(a,r))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},i:ie,o:ie,d(a){o.d(a),a&&w(l)}}}function sp(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e;return t.$$set=o=>{"timestamp"in o&&l(0,n=o.timestamp),"fullTimeColor"in o&&l(1,i=o.fullTimeColor)},[n,i]}class vc extends Ce{constructor(e){super(),$e(this,e,sp,ip,ye,{timestamp:0,fullTimeColor:1})}}function op(t){let e,l,n;return{c(){e=Ue("svg"),l=Ue("path"),n=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){y(i,e,o),s(e,l),s(e,n)},p:ie,i:ie,o:ie,d(i){i&&w(e)}}}class up extends Ce{constructor(e){super(),$e(this,e,null,op,ye,{})}}function rp(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&w(e)}}}class ap extends Ce{constructor(e){super(),$e(this,e,null,rp,ye,{})}}function fp(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&w(e)}}}class $t extends Ce{constructor(e){super(),$e(this,e,null,fp,ye,{})}}function cp(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&w(e)}}}class hc extends Ce{constructor(e){super(),$e(this,e,null,cp,ye,{})}}function pp(t){let e,l,n=t[1].version+"",i;return{c(){e=C("AMS reader "),l=p("span"),i=C(n)},m(o,a){y(o,e,a),y(o,l,a),s(l,i)},p(o,a){a&2&&n!==(n=o[1].version+"")&&B(i,n)},d(o){o&&w(e),o&&w(l)}}}function Gr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=C(l),i=C("\xB0C"),u(e,"class","flex-none my-auto")},m(o,a){y(o,e,a),s(e,n),s(e,i)},p(o,a){a&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&B(n,l)},d(o){o&&w(e)}}}function Br(t){let e,l="HAN: "+Lr(t[0].he),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Lr(i[0].he))&&B(n,l)},d(i){i&&w(e)}}}function Yr(t){let e,l="MQTT: "+qr(t[0].me),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+qr(i[0].me))&&B(n,l)},d(i){i&&w(e)}}}function zr(t){let e,l="PriceAPI: "+Or(t[0].ee),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Or(i[0].ee))&&B(n,l)},d(i){i&&w(e)}}}function Vr(t){let e,l,n,i,o,a;return l=new wl({props:{to:"/configuration",$$slots:{default:[mp]},$$scope:{ctx:t}}}),o=new wl({props:{to:"/status",$$slots:{default:[_p]},$$scope:{ctx:t}}}),{c(){e=p("div"),J(l.$$.fragment),n=v(),i=p("div"),J(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(r,c){y(r,e,c),Q(l,e,null),y(r,n,c),y(r,i,c),Q(o,i,null),a=!0},i(r){a||(M(l.$$.fragment,r),M(o.$$.fragment,r),a=!0)},o(r){I(l.$$.fragment,r),I(o.$$.fragment,r),a=!1},d(r){r&&w(e),Z(l),r&&w(n),r&&w(i),Z(o)}}}function mp(t){let e,l;return e=new up({}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function _p(t){let e,l;return e=new ap({}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Kr(t){let e,l,n,i,o;const a=[vp,dp],r=[];function c(f,m){return f[1].security==0||f[0].a?0:1}return l=c(t),n=r[l]=a[l](t),{c(){e=p("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(f,m){y(f,e,m),r[l].m(e,null),o=!0},p(f,m){let _=l;l=c(f),l===_?r[l].p(f,m):(Pe(),I(r[_],1,1,()=>{r[_]=null}),Me(),n=r[l],n?n.p(f,m):(n=r[l]=a[l](f),n.c()),M(n,1),n.m(e,null)),(!o||m&4&&i!==(i="New version: "+f[2].tag_name))&&u(e,"title",i)},i(f){o||(M(n),o=!0)},o(f){I(n),o=!1},d(f){f&&w(e),r[l].d()}}}function dp(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=p("span"),l=C("New version: "),i=C(n)},m(o,a){y(o,e,a),s(e,l),s(e,i)},p(o,a){a&4&&n!==(n=o[2].tag_name+"")&&B(i,n)},i:ie,o:ie,d(o){o&&w(e)}}}function vp(t){let e,l,n,i=t[2].tag_name+"",o,a,r,c,f,m;return r=new hc({}),{c(){e=p("button"),l=p("span"),n=C("New version: "),o=C(i),a=v(),J(r.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(_,h){y(_,e,h),s(e,l),s(l,n),s(l,o),s(e,a),Q(r,e,null),c=!0,f||(m=z(e,"click",t[3]),f=!0)},p(_,h){(!c||h&4)&&i!==(i=_[2].tag_name+"")&&B(o,i)},i(_){c||(M(r.$$.fragment,_),c=!0)},o(_){I(r.$$.fragment,_),c=!1},d(_){_&&w(e),Z(r),f=!1,m()}}}function hp(t){let e,l,n,i,o,a,r,c,f,m,_,h,b=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U,q,G,H,V,X,ne,le,_e,Te,ve,qe,be,Ee;i=new wl({props:{to:"/",$$slots:{default:[pp]},$$scope:{ctx:t}}}),c=new x1({props:{epoch:t[0].u}});let he=t[0].t>-50&&Gr(t);T=new Kt({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:kl(t[1].booting?2:t[0].em)}}),E=new Kt({props:{title:"HAN",text:"HAN",color:kl(t[1].booting?9:t[0].hm)}}),N=new Kt({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:kl(t[1].booting?9:t[0].wm)}}),R=new Kt({props:{title:"MQTT",text:"MQTT",color:kl(t[1].booting?9:t[0].mm)}});let Ne=(t[0].he<0||t[0].he>0)&&Br(t),pe=t[0].me<0&&Yr(t),me=(t[0].ee>0||t[0].ee<0)&&zr(t);ne=new vc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),fullTimeColor:"text-red-500"}});let se=t[1].vndcfg&&t[1].usrcfg&&Vr(t);qe=new $t({});let re=t[1].fwconsent===1&&t[2]&&Kr(t);return{c(){e=p("nav"),l=p("div"),n=p("div"),J(i.$$.fragment),o=v(),a=p("div"),r=p("div"),J(c.$$.fragment),f=v(),he&&he.c(),m=v(),_=p("div"),h=C("Free mem: "),d=C(b),g=C("kb"),$=v(),k=p("div"),J(T.$$.fragment),P=v(),J(E.$$.fragment),S=v(),J(N.$$.fragment),D=v(),J(R.$$.fragment),W=v(),Ne&&Ne.c(),O=v(),pe&&pe.c(),F=v(),me&&me.c(),L=v(),j=p("div"),U=p("div"),q=p("a"),G=p("img"),V=v(),X=p("div"),J(ne.$$.fragment),le=v(),se&&se.c(),_e=v(),Te=p("div"),ve=p("a"),J(qe.$$.fragment),be=v(),re&&re.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(r,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(a,"class","flex-none my-auto p-2 flex space-x-4"),u(k,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(G,"class","gh-logo"),Cc(G.src,H=G1)||u(G,"src",H),u(G,"alt","GitHub repo"),u(q,"class","float-right"),u(q,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(q,"target","_blank"),u(q,"rel","noreferrer"),u(q,"aria-label","GitHub"),u(U,"class","flex-none"),u(X,"class","flex-none my-auto px-2"),u(ve,"href",Ct("")),u(ve,"target","_blank"),u(ve,"rel","noreferrer"),u(Te,"class","flex-none px-1 mt-1"),u(Te,"title","Documentation"),u(j,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(K,ae){y(K,e,ae),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,a),s(a,r),Q(c,r,null),s(a,f),he&&he.m(a,null),s(a,m),s(a,_),s(_,h),s(_,d),s(_,g),s(l,$),s(l,k),Q(T,k,null),s(k,P),Q(E,k,null),s(k,S),Q(N,k,null),s(k,D),Q(R,k,null),s(l,W),Ne&&Ne.m(l,null),s(l,O),pe&&pe.m(l,null),s(l,F),me&&me.m(l,null),s(l,L),s(l,j),s(j,U),s(U,q),s(q,G),s(j,V),s(j,X),Q(ne,X,null),s(j,le),se&&se.m(j,null),s(j,_e),s(j,Te),s(Te,ve),Q(qe,ve,null),s(j,be),re&&re.m(j,null),Ee=!0},p(K,[ae]){const Ae={};ae&18&&(Ae.$$scope={dirty:ae,ctx:K}),i.$set(Ae);const te={};ae&1&&(te.epoch=K[0].u),c.$set(te),K[0].t>-50?he?he.p(K,ae):(he=Gr(K),he.c(),he.m(a,m)):he&&(he.d(1),he=null),(!Ee||ae&1)&&b!==(b=(K[0].m?(K[0].m/1e3).toFixed(1):"-")+"")&&B(d,b);const ue={};ae&3&&(ue.text=K[1].booting?"Booting":K[0].v>2?K[0].v.toFixed(2)+"V":"ESP"),ae&3&&(ue.color=kl(K[1].booting?2:K[0].em)),T.$set(ue);const He={};ae&3&&(He.color=kl(K[1].booting?9:K[0].hm)),E.$set(He);const Se={};ae&1&&(Se.text=K[0].r?K[0].r.toFixed(0)+"dBm":"WiFi"),ae&3&&(Se.color=kl(K[1].booting?9:K[0].wm)),N.$set(Se);const de={};ae&3&&(de.color=kl(K[1].booting?9:K[0].mm)),R.$set(de),K[0].he<0||K[0].he>0?Ne?Ne.p(K,ae):(Ne=Br(K),Ne.c(),Ne.m(l,O)):Ne&&(Ne.d(1),Ne=null),K[0].me<0?pe?pe.p(K,ae):(pe=Yr(K),pe.c(),pe.m(l,F)):pe&&(pe.d(1),pe=null),K[0].ee>0||K[0].ee<0?me?me.p(K,ae):(me=zr(K),me.c(),me.m(l,L)):me&&(me.d(1),me=null);const De={};ae&1&&(De.timestamp=K[0].c?new Date(K[0].c*1e3):new Date(0)),ne.$set(De),K[1].vndcfg&&K[1].usrcfg?se?ae&2&&M(se,1):(se=Vr(K),se.c(),M(se,1),se.m(j,_e)):se&&(Pe(),I(se,1,1,()=>{se=null}),Me()),K[1].fwconsent===1&&K[2]?re?(re.p(K,ae),ae&6&&M(re,1)):(re=Kr(K),re.c(),M(re,1),re.m(j,null)):re&&(Pe(),I(re,1,1,()=>{re=null}),Me())},i(K){Ee||(M(i.$$.fragment,K),M(c.$$.fragment,K),M(T.$$.fragment,K),M(E.$$.fragment,K),M(N.$$.fragment,K),M(R.$$.fragment,K),M(ne.$$.fragment,K),M(se),M(qe.$$.fragment,K),M(re),Ee=!0)},o(K){I(i.$$.fragment,K),I(c.$$.fragment,K),I(T.$$.fragment,K),I(E.$$.fragment,K),I(N.$$.fragment,K),I(R.$$.fragment,K),I(ne.$$.fragment,K),I(se),I(qe.$$.fragment,K),I(re),Ee=!1},d(K){K&&w(e),Z(i),Z(c),he&&he.d(),Z(T),Z(E),Z(N),Z(R),Ne&&Ne.d(),pe&&pe.d(),me&&me.d(),Z(ne),se&&se.d(),Z(qe),re&&re.d()}}}function bp(t,e,l){let{data:n={}}=e,i={},o={};function a(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!Yn(i.board)||confirm(bs(ce(i.chip,i.board))))&&(Tt.update(r=>(r.upgrading=!0,r)),_c())}return Tt.subscribe(r=>{l(1,i=r),r.fwconsent===1&&W1()}),_o.subscribe(r=>{l(2,o=dc(i.version,r))}),t.$$set=r=>{"data"in r&&l(0,n=r.data)},[n,i,o,a]}class gp extends Ce{constructor(e){super(),$e(this,e,bp,hp,ye,{data:0})}}function kp(t){let e,l,n,i;return{c(){e=Ue("svg"),l=Ue("path"),n=Ue("path"),u(l,"d",Gs(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Gs(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,a){y(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=Gs(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),a&2&&u(n,"stroke",o[1])},i:ie,o:ie,d(o){o&&w(e)}}}function Qr(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Gs(t,e,l,n,i){var o=Qr(t,e,l,i),a=Qr(t,e,l,n),r=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,r,0,a.x,a.y].join(" ");return c}function wp(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class yp extends Ce{constructor(e){super(),$e(this,e,wp,kp,ye,{pct:0,color:1})}}function Zr(t){let e,l,n,i,o,a,r,c;return{c(){e=p("br"),l=v(),n=p("span"),i=C(t[3]),o=v(),a=p("span"),r=C(t[4]),c=C("/kWh"),u(n,"class","pl-sub"),u(a,"class","pl-snt")},m(f,m){y(f,e,m),y(f,l,m),y(f,n,m),s(n,i),y(f,o,m),y(f,a,m),s(a,r),s(a,c)},p(f,m){m&8&&B(i,f[3]),m&16&&B(r,f[4])},d(f){f&&w(e),f&&w(l),f&&w(n),f&&w(o),f&&w(a)}}}function $p(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$;l=new yp({props:{pct:t[6],color:t[5](t[6])}});let k=t[3]&&Zr(t);return{c(){e=p("div"),J(l.$$.fragment),n=v(),i=p("span"),o=p("span"),a=C(t[2]),r=v(),c=p("br"),f=v(),m=p("span"),_=C(t[0]),h=v(),b=p("span"),d=C(t[1]),g=v(),k&&k.c(),u(o,"class","pl-lab"),u(m,"class","pl-val"),u(b,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(T,P){y(T,e,P),Q(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,r),s(i,c),s(i,f),s(i,m),s(m,_),s(i,h),s(i,b),s(b,d),s(i,g),k&&k.m(i,null),$=!0},p(T,[P]){const E={};P&64&&(E.pct=T[6]),P&96&&(E.color=T[5](T[6])),l.$set(E),(!$||P&4)&&B(a,T[2]),(!$||P&1)&&B(_,T[0]),(!$||P&2)&&B(d,T[1]),T[3]?k?k.p(T,P):(k=Zr(T),k.c(),k.m(i,null)):k&&(k.d(1),k=null)},i(T){$||(M(l.$$.fragment,T),$=!0)},o(T){I(l.$$.fragment,T),$=!1},d(T){T&&w(e),Z(l),k&&k.d()}}}function Cp(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:r=""}=e,{subunit:c=""}=e,{colorFn:f}=e,m=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,a=_.label),"sub"in _&&l(3,r=_.sub),"subunit"in _&&l(4,c=_.subunit),"colorFn"in _&&l(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,m=Math.min(n,i)/i*100)},[n,o,a,r,c,f,m,i]}class bc extends Ce{constructor(e){super(),$e(this,e,Cp,$p,ye,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Jr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Xr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function xr(t,e,l){const n=t.slice();return n[13]=e[l],n}function ea(t){let e,l=t[0].title+"",n;return{c(){e=p("strong"),n=C(l),u(e,"class","text-sm")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[0].title+"")&&B(n,l)},d(i){i&&w(e)}}}function ta(t){let e,l,n,i=t[13].label+"",o,a,r,c;return{c(){e=Ue("g"),l=Ue("line"),n=Ue("text"),o=C(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",a=t[13].align=="right"?"85%":""),u(e,"class",r="tick tick-"+t[13].value+" tick-"+t[13].color),u(e,"transform",c="translate(0, "+t[6](t[13].value)+")")},m(f,m){y(f,e,m),s(e,l),s(e,n),s(n,o)},p(f,m){m&1&&i!==(i=f[13].label+"")&&B(o,i),m&1&&a!==(a=f[13].align=="right"?"85%":"")&&u(n,"x",a),m&1&&r!==(r="tick tick-"+f[13].value+" tick-"+f[13].color)&&u(e,"class",r),m&65&&c!==(c="translate(0, "+f[6](f[13].value)+")")&&u(e,"transform",c)},d(f){f&&w(e)}}}function la(t){let e,l,n=t[9].label+"",i,o,a;return{c(){e=Ue("g"),l=Ue("text"),i=C(n),u(l,"x",o=t[3]/2),u(l,"y","-4"),u(e,"class","tick"),u(e,"transform",a="translate("+t[5](t[11])+","+t[4]+")")},m(r,c){y(r,e,c),s(e,l),s(l,i)},p(r,c){c&1&&n!==(n=r[9].label+"")&&B(i,n),c&8&&o!==(o=r[3]/2)&&u(l,"x",o),c&48&&a!==(a="translate("+r[5](r[11])+","+r[4]+")")&&u(e,"transform",a)},d(r){r&&w(e)}}}function na(t){let e,l,n,i,o,a,r,c=t[3]>15&&ia(t);return{c(){e=Ue("rect"),c&&c.c(),r=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](t[9].value)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),u(e,"fill",a=t[9].color)},m(f,m){y(f,e,m),c&&c.m(f,m),y(f,r,m)},p(f,m){m&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),m&65&&n!==(n=f[6](f[9].value))&&u(e,"y",n),m&8&&i!==(i=f[3]-4)&&u(e,"width",i),m&65&&o!==(o=f[6](f[0].y.min)-f[6](Math.min(f[0].y.min,0)+f[9].value))&&u(e,"height",o),m&1&&a!==(a=f[9].color)&&u(e,"fill",a),f[3]>15?c?c.p(f,m):(c=ia(f),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(r)}}}function ia(t){let e,l=t[9].label+"",n,i,o,a,r,c,f;return{c(){e=Ue("text"),n=C(l),u(e,"y",i=t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10),u(e,"x",o=t[5](t[11])+t[3]/2),u(e,"width",a=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",r=t[3]<25?"left":"middle"),u(e,"fill",c=t[6](t[9].value)>t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",f="rotate("+(t[3]<25?90:0)+", "+(t[5](t[11])+t[3]/2)+", "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+9)+")")},m(m,_){y(m,e,_),s(e,n)},p(m,_){_&1&&l!==(l=m[9].label+"")&&B(n,l),_&193&&i!==(i=m[6](m[9].value)>m[6](0)-m[7]?m[6](m[9].value)-m[7]:m[6](m[9].value)+10)&&u(e,"y",i),_&40&&o!==(o=m[5](m[11])+m[3]/2)&&u(e,"x",o),_&8&&a!==(a=m[3]-4)&&u(e,"width",a),_&8&&r!==(r=m[3]<25?"left":"middle")&&u(e,"text-anchor",r),_&193&&c!==(c=m[6](m[9].value)>m[6](0)-m[7]?m[9].color:"white")&&u(e,"fill",c),_&233&&f!==(f="rotate("+(m[3]<25?90:0)+", "+(m[5](m[11])+m[3]/2)+", "+(m[6](m[9].value)>m[6](0)-m[7]?m[6](m[9].value)-m[7]:m[6](m[9].value)+9)+")")&&u(e,"transform",f)},d(m){m&&w(e)}}}function sa(t){let e,l,n,i,o,a,r,c=t[3]>15&&oa(t);return{c(){e=Ue("rect"),c&&c.c(),r=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](0)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),u(e,"fill",a=t[9].color)},m(f,m){y(f,e,m),c&&c.m(f,m),y(f,r,m)},p(f,m){m&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),m&64&&n!==(n=f[6](0))&&u(e,"y",n),m&8&&i!==(i=f[3]-4)&&u(e,"width",i),m&65&&o!==(o=f[6](f[0].y.min)-f[6](f[0].y.min+f[9].value2))&&u(e,"height",o),m&1&&a!==(a=f[9].color)&&u(e,"fill",a),f[3]>15?c?c.p(f,m):(c=oa(f),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(r)}}}function oa(t){let e,l=t[9].label2+"",n,i,o,a,r,c,f;return{c(){e=Ue("text"),n=C(l),u(e,"y",i=t[6](-t[9].value2)t[6](0)-12?t[6](t[9].value2-t[0].y.min)-12:t[6](t[9].value2-t[0].y.min)+9)+")")},m(m,_){y(m,e,_),s(e,n)},p(m,_){_&1&&l!==(l=m[9].label2+"")&&B(n,l),_&65&&i!==(i=m[6](-m[9].value2)m[6](0)-12?m[6](m[9].value2-m[0].y.min)-12:m[6](m[9].value2-m[0].y.min)+9)+")")&&u(e,"transform",f)},d(m){m&&w(e)}}}function ua(t){let e,l,n=t[9].value!==void 0&&na(t),i=t[9].value2>1e-4&&sa(t);return{c(){n&&n.c(),e=We(),i&&i.c(),l=We()},m(o,a){n&&n.m(o,a),y(o,e,a),i&&i.m(o,a),y(o,l,a)},p(o,a){o[9].value!==void 0?n?n.p(o,a):(n=na(o),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,a):(i=sa(o),i.c(),i.m(l.parentNode,l)):i&&(i.d(1),i=null)},d(o){n&&n.d(o),o&&w(e),i&&i.d(o),o&&w(l)}}}function Tp(t){let e,l,n,i,o,a,r,c=t[0].title&&ea(t),f=t[0].y.ticks,m=[];for(let g=0;gt[8].call(e))},m(g,$){y(g,e,$),c&&c.m(e,null),s(e,l),s(e,n),s(n,i);for(let k=0;k{"config"in h&&l(0,n=h.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,f=o-(n.title?20:0));let h=i-(n.padding.left+n.padding.right);l(3,a=h/n.points.length),l(7,m=a<25?28:17);let b=(f-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,r=function(d){return d*a+n.padding.left}),l(6,c=function(d){let g=0;return d>n.y.max?g=n.padding.bottom:df||g<0?0:g})}},[n,i,o,a,f,r,c,m,_]}class Vl extends Ce{constructor(e){super(),$e(this,e,Sp,Tp,ye,{config:0})}}function Pp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Mp(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:a}=e,r={};function c(f){return{label:we(f)+"V",value:isNaN(f)?0:f,color:q1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,a=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],m=[];n>0&&(f.push({label:a===1?"L1-L2":"L1"}),m.push(c(n))),i>0&&(f.push({label:a===1?"L1-L3":"L2"}),m.push(c(i))),o>0&&(f.push({label:a===1?"L2-L3":"L3"}),m.push(c(o))),l(0,r={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:m})}},[r,n,i,o,a]}class Ap extends Ce{constructor(e){super(),$e(this,e,Mp,Pp,ye,{u1:1,u2:2,u3:3,ds:4})}}function Dp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Np(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:a}=e,{i2:r}=e,{i3:c}=e,{max:f}=e,m={};function _(h){return{label:we(h)+"A",value:isNaN(h)?0:h,color:oc(h?h/f*100:0)}}return t.$$set=h=>{"u1"in h&&l(1,n=h.u1),"u2"in h&&l(2,i=h.u2),"u3"in h&&l(3,o=h.u3),"i1"in h&&l(4,a=h.i1),"i2"in h&&l(5,r=h.i2),"i3"in h&&l(6,c=h.i3),"max"in h&&l(7,f=h.max)},t.$$.update=()=>{if(t.$$.dirty&254){let h=[],b=[];n>0&&(h.push({label:"L1"}),b.push(_(a))),i>0&&(h.push({label:"L2"}),b.push(_(r))),o>0&&(h.push({label:"L3"}),b.push(_(c))),l(0,m={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:f,ticks:[{value:0,label:"0%"},{value:f/4,label:"25%"},{value:f/2,label:"50%"},{value:f/4*3,label:"75%"},{value:f,label:"100%"}]},x:{ticks:h},points:b})}},[m,n,i,o,a,r,c,f]}class Ip extends Ce{constructor(e){super(),$e(this,e,Np,Dp,ye,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function Ep(t){let e,l,n,i,o,a,r,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,m,_,h,b,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",$,k,T,P,E,S,N,D=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",R,W,O,F,L,j,U=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",q,G;return{c(){e=p("div"),l=p("strong"),l.textContent="Reactive",n=v(),i=p("div"),o=p("div"),o.textContent="Instant in",a=v(),r=p("div"),f=C(c),m=C(" VAr"),_=v(),h=p("div"),h.textContent="Instant out",b=v(),d=p("div"),$=C(g),k=C(" VAr"),T=v(),P=p("div"),E=p("div"),E.textContent="Total in",S=v(),N=p("div"),R=C(D),W=C(" kVArh"),O=v(),F=p("div"),F.textContent="Total out",L=v(),j=p("div"),q=C(U),G=C(" kVArh"),u(r,"class","text-right"),u(d,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(N,"class","text-right"),u(j,"class","text-right"),u(P,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(H,V){y(H,e,V),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(i,r),s(r,f),s(r,m),s(i,_),s(i,h),s(i,b),s(i,d),s(d,$),s(d,k),s(e,T),s(e,P),s(P,E),s(P,S),s(P,N),s(N,R),s(N,W),s(P,O),s(P,F),s(P,L),s(P,j),s(j,q),s(j,G)},p(H,[V]){V&1&&c!==(c=(typeof H[0]<"u"?H[0].toFixed(0):"-")+"")&&B(f,c),V&2&&g!==(g=(typeof H[1]<"u"?H[1].toFixed(0):"-")+"")&&B($,g),V&4&&D!==(D=(typeof H[2]<"u"?H[2].toFixed(1):"-")+"")&&B(R,D),V&8&&U!==(U=(typeof H[3]<"u"?H[3].toFixed(1):"-")+"")&&B(q,U)},i:ie,o:ie,d(H){H&&w(e)}}}function Rp(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e;return t.$$set=r=>{"importInstant"in r&&l(0,n=r.importInstant),"exportInstant"in r&&l(1,i=r.exportInstant),"importTotal"in r&&l(2,o=r.importTotal),"exportTotal"in r&&l(3,a=r.exportTotal)},[n,i,o,a]}class Fp extends Ce{constructor(e){super(),$e(this,e,Rp,Ep,ye,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function ra(t){let e;function l(o,a){return o[2]?qp:Lp}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,a){i.m(o,a),y(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&w(e)}}}function Lp(t){let e,l,n,i,o,a,r=we(t[0].h.u,2)+"",c,f,m,_,h,b,d=we(t[0].d.u,1)+"",g,$,k,T,P,E,S=we(t[0].m.u)+"",N,D,R,W,O=t[3]&&aa(t);return{c(){e=p("strong"),e.textContent="Consumption",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=C(" kWh"),m=v(),_=p("div"),_.textContent="Day",h=v(),b=p("div"),g=C(d),$=C(" kWh"),k=v(),T=p("div"),T.textContent="Month",P=v(),E=p("div"),N=C(S),D=C(" kWh"),R=v(),O&&O.c(),W=We(),u(a,"class","text-right"),u(b,"class","text-right"),u(E,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(F,L){y(F,e,L),y(F,l,L),y(F,n,L),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,m),s(n,_),s(n,h),s(n,b),s(b,g),s(b,$),s(n,k),s(n,T),s(n,P),s(n,E),s(E,N),s(E,D),y(F,R,L),O&&O.m(F,L),y(F,W,L)},p(F,L){L&1&&r!==(r=we(F[0].h.u,2)+"")&&B(c,r),L&1&&d!==(d=we(F[0].d.u,1)+"")&&B(g,d),L&1&&S!==(S=we(F[0].m.u)+"")&&B(N,S),F[3]?O?O.p(F,L):(O=aa(F),O.c(),O.m(W.parentNode,W)):O&&(O.d(1),O=null)},d(F){F&&w(e),F&&w(l),F&&w(n),F&&w(R),O&&O.d(F),F&&w(W)}}}function qp(t){let e,l,n,i,o,a,r=we(t[0].h.u,2)+"",c,f,m,_,h,b,d,g=we(t[0].d.u,1)+"",$,k,T,P,E,S,N,D=we(t[0].m.u)+"",R,W,O,F,L,j,U,q,G,H,V,X=we(t[0].h.p,2)+"",ne,le,_e,Te,ve,qe,be,Ee=we(t[0].d.p,1)+"",he,Ne,pe,me,se,re,K,ae=we(t[0].m.p)+"",Ae,te,ue,He,Se=t[3]&&fa(t),de=t[3]&&ca(t),De=t[3]&&pa(t),Oe=t[3]&&ma(t),ge=t[3]&&_a(t),ke=t[3]&&da(t);return{c(){e=p("strong"),e.textContent="Import",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=C(" kWh"),m=v(),Se&&Se.c(),_=v(),h=p("div"),h.textContent="Day",b=v(),d=p("div"),$=C(g),k=C(" kWh"),T=v(),de&&de.c(),P=v(),E=p("div"),E.textContent="Month",S=v(),N=p("div"),R=C(D),W=C(" kWh"),O=v(),De&&De.c(),L=v(),j=p("strong"),j.textContent="Export",U=v(),q=p("div"),G=p("div"),G.textContent="Hour",H=v(),V=p("div"),ne=C(X),le=C(" kWh"),_e=v(),Oe&&Oe.c(),Te=v(),ve=p("div"),ve.textContent="Day",qe=v(),be=p("div"),he=C(Ee),Ne=C(" kWh"),pe=v(),ge&&ge.c(),me=v(),se=p("div"),se.textContent="Month",re=v(),K=p("div"),Ae=C(ae),te=C(" kWh"),ue=v(),ke&&ke.c(),u(a,"class","text-right"),u(d,"class","text-right"),u(N,"class","text-right"),u(n,"class",F="grid grid-cols-"+t[4]+" mb-3"),u(V,"class","text-right"),u(be,"class","text-right"),u(K,"class","text-right"),u(q,"class",He="grid grid-cols-"+t[4])},m(x,oe){y(x,e,oe),y(x,l,oe),y(x,n,oe),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,m),Se&&Se.m(n,null),s(n,_),s(n,h),s(n,b),s(n,d),s(d,$),s(d,k),s(n,T),de&&de.m(n,null),s(n,P),s(n,E),s(n,S),s(n,N),s(N,R),s(N,W),s(n,O),De&&De.m(n,null),y(x,L,oe),y(x,j,oe),y(x,U,oe),y(x,q,oe),s(q,G),s(q,H),s(q,V),s(V,ne),s(V,le),s(q,_e),Oe&&Oe.m(q,null),s(q,Te),s(q,ve),s(q,qe),s(q,be),s(be,he),s(be,Ne),s(q,pe),ge&&ge.m(q,null),s(q,me),s(q,se),s(q,re),s(q,K),s(K,Ae),s(K,te),s(q,ue),ke&&ke.m(q,null)},p(x,oe){oe&1&&r!==(r=we(x[0].h.u,2)+"")&&B(c,r),x[3]?Se?Se.p(x,oe):(Se=fa(x),Se.c(),Se.m(n,_)):Se&&(Se.d(1),Se=null),oe&1&&g!==(g=we(x[0].d.u,1)+"")&&B($,g),x[3]?de?de.p(x,oe):(de=ca(x),de.c(),de.m(n,P)):de&&(de.d(1),de=null),oe&1&&D!==(D=we(x[0].m.u)+"")&&B(R,D),x[3]?De?De.p(x,oe):(De=pa(x),De.c(),De.m(n,null)):De&&(De.d(1),De=null),oe&16&&F!==(F="grid grid-cols-"+x[4]+" mb-3")&&u(n,"class",F),oe&1&&X!==(X=we(x[0].h.p,2)+"")&&B(ne,X),x[3]?Oe?Oe.p(x,oe):(Oe=ma(x),Oe.c(),Oe.m(q,Te)):Oe&&(Oe.d(1),Oe=null),oe&1&&Ee!==(Ee=we(x[0].d.p,1)+"")&&B(he,Ee),x[3]?ge?ge.p(x,oe):(ge=_a(x),ge.c(),ge.m(q,me)):ge&&(ge.d(1),ge=null),oe&1&&ae!==(ae=we(x[0].m.p)+"")&&B(Ae,ae),x[3]?ke?ke.p(x,oe):(ke=da(x),ke.c(),ke.m(q,null)):ke&&(ke.d(1),ke=null),oe&16&&He!==(He="grid grid-cols-"+x[4])&&u(q,"class",He)},d(x){x&&w(e),x&&w(l),x&&w(n),Se&&Se.d(),de&&de.d(),De&&De.d(),x&&w(L),x&&w(j),x&&w(U),x&&w(q),Oe&&Oe.d(),ge&&ge.d(),ke&&ke.d()}}}function aa(t){let e,l,n,i,o,a,r=we(t[0].h.c,2)+"",c,f,m,_,h,b,d,g=we(t[0].d.c,1)+"",$,k,T,P,E,S,N,D=we(t[0].m.c)+"",R,W,O;return{c(){e=p("strong"),e.textContent="Cost",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=v(),m=C(t[1]),_=v(),h=p("div"),h.textContent="Day",b=v(),d=p("div"),$=C(g),k=v(),T=C(t[1]),P=v(),E=p("div"),E.textContent="Month",S=v(),N=p("div"),R=C(D),W=v(),O=C(t[1]),u(a,"class","text-right"),u(d,"class","text-right"),u(N,"class","text-right"),u(n,"class","grid grid-cols-2")},m(F,L){y(F,e,L),y(F,l,L),y(F,n,L),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(a,m),s(n,_),s(n,h),s(n,b),s(n,d),s(d,$),s(d,k),s(d,T),s(n,P),s(n,E),s(n,S),s(n,N),s(N,R),s(N,W),s(N,O)},p(F,L){L&1&&r!==(r=we(F[0].h.c,2)+"")&&B(c,r),L&2&&B(m,F[1]),L&1&&g!==(g=we(F[0].d.c,1)+"")&&B($,g),L&2&&B(T,F[1]),L&1&&D!==(D=we(F[0].m.c)+"")&&B(R,D),L&2&&B(O,F[1])},d(F){F&&w(e),F&&w(l),F&&w(n)}}}function fa(t){let e,l=we(t[0].h.c,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].h.c,2)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function ca(t){let e,l=we(t[0].d.c,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].d.c,1)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function pa(t){let e,l=we(t[0].m.c)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].m.c)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function ma(t){let e,l=we(t[0].h.i,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].h.i,2)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function _a(t){let e,l=we(t[0].d.i,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].d.i,1)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function da(t){let e,l=we(t[0].m.i)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].m.i)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function Op(t){let e,l,n,i,o,a,r=t[0]&&ra(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Real time calculation",n=v(),i=p("br"),o=p("br"),a=v(),r&&r.c(),u(e,"class","mx-2 text-sm")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),r&&r.m(e,null)},p(c,[f]){c[0]?r?r.p(c,f):(r=ra(c),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},i:ie,o:ie,d(c){c&&w(e),r&&r.d()}}}function Up(t,e,l){let{data:n}=e,{currency:i}=e,{hasExport:o}=e,a=!1,r=3;return t.$$set=c=>{"data"in c&&l(0,n=c.data),"currency"in c&&l(1,i=c.currency),"hasExport"in c&&l(2,o=c.hasExport)},t.$$.update=()=>{t.$$.dirty&3&&(l(4,r=i?3:2),l(3,a=n&&n.h&&(n.h.c||n.d.c||n.m.c||n.h.i||n.d.i||n.m.i)))},[n,i,o,a,r]}class Hp extends Ce{constructor(e){super(),$e(this,e,Up,Op,ye,{data:0,currency:1,hasExport:2})}}function jp(t){let e,l,n,i;return n=new Vl({props:{config:t[0]}}),{c(){e=p("a"),e.textContent="Provided by ENTSO-E",l=v(),J(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,a){y(o,e,a),y(o,l,a),Q(n,o,a),i=!0},p(o,[a]){const r={};a&1&&(r.config=o[0]),n.$set(r)},i(o){i||(M(n.$$.fragment,o),i=!0)},o(o){I(n.$$.fragment,o),i=!1},d(o){o&&w(e),o&&w(l),Z(n,o)}}}function Wp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=new Date().getUTCHours(),c=0,f=0,m=0,_=n[20]==null?2:1,h=[],b=[],d=[],g=new Date;for(c=r;c<24&&(f=n[Ie(m++)],f!=null);c++)b.push({label:Ie(g.getHours())}),d.push({label:f>0?f.toFixed(_):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(_):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,a=Math.min(a,f*100)),l(2,o=Math.max(o,f*100)),ri(g,1);for(c=0;c<24&&(f=n[Ie(m++)],f!=null);c++)b.push({label:Ie(g.getHours())}),d.push({label:f>0?f.toFixed(_):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(_):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,a=Math.min(a,f*100)),l(2,o=Math.max(o,f*100)),ri(g,1);if(l(2,o=Math.ceil(o)),l(3,a=Math.floor(a)),a<0){let k=a/4;for(c=1;c<5;c++){let T=k*c;h.push({value:T,label:(T/100).toFixed(2)})}}let $=o/4;for(c=0;c<5;c++){let k=$*c;h.push({value:k,label:(k/100).toFixed(2)})}l(0,i={title:"Future energy price ("+n.currency+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:h},x:{ticks:b},points:d})}},[i,n,o,a]}class Gp extends Ce{constructor(e){super(),$e(this,e,Wp,jp,ye,{json:1})}}function Bp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Yp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=[],f=[],m=[],_=ri(new Date,-24),h=new Date().getUTCHours();for(r=h;r<24;r++){let g=n["i"+Ie(r)],$=n["e"+Ie(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(_.getHours())}),m.push({label:g.toFixed(1),value:g*10,label2:$.toFixed(1),value2:$*10,color:"#7c3aed"}),l(3,a=Math.max(a,$*10)),l(2,o=Math.max(o,g*10)),ri(_,1)}for(r=0;r{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=[],f=[],m=[],_=new Date,h=new Date;for(h.setDate(0),r=_.getDate();r<=h.getDate();r++){let g=n["i"+Ie(r)],$=n["e"+Ie(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(r)}),m.push({label:g.toFixed(0),value:g,label2:$.toFixed(0),value2:$,color:"#7c3aed"}),l(3,a=Math.max(a,$)),l(2,o=Math.max(o,g))}for(r=1;r<_.getDate();r++){let g=n["i"+Ie(r)],$=n["e"+Ie(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(r)}),m.push({label:g.toFixed(0),value:g,label2:$.toFixed(0),value2:$,color:"#7c3aed"}),l(3,a=Math.max(a,$)),l(2,o=Math.max(o,g))}let b=Math.ceil(Math.max(a,o)/10)*10;if(l(2,o=b),l(3,a=a==0?0:b*-1),a<0){let g=a/4;for(r=0;r<5;r++){let $=g*r;c.push({value:$,label:$.toFixed(0)})}}let d=o/4;for(r=0;r<5;r++){let g=d*r;c.push({value:g,label:g.toFixed(0)})}l(0,i={title:"Energy use last month (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:c},x:{ticks:f},points:m})}},[i,n,o,a]}class Qp extends Ce{constructor(e){super(),$e(this,e,Kp,Vp,ye,{json:1})}}function Zp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Jp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=0,f=[],m=[],_=[];n.s&&n.s.forEach((d,g)=>{var $=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),m.push({label:$.slice(-4)}),_.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,a=Math.min(a,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,a=Math.floor(a));let h=o;a<0&&(h+=Math.abs(a));let b=h/4;for(r=0;r<5;r++)c=a+b*r,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:f},x:{ticks:m},points:_})}},[i,n,o,a]}class Xp extends Ce{constructor(e){super(),$e(this,e,Jp,Zp,ye,{json:1})}}function xp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}let em=0;function tm(t,e,l){let n={},i=0,o;return mc.subscribe(a=>{l(2,o=a)}),pc(),t.$$.update=()=>{if(t.$$.dirty&6){let a=0,r=[],c=[],f=[];if(r.push({value:0,label:0}),o&&o.p)for(a=0;a0?Ie(m.d)+"."+Ks[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,m.v))}if(o&&o.t){for(a=0;a=i)break;r.push({value:m,label:m})}r.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(r.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:em,max:i,ticks:r},x:{ticks:c},points:f})}},[n,i,o]}class lm extends Ce{constructor(e){super(),$e(this,e,tm,xp,ye,{})}}function va(t){let e,l,n,i,o,a,r=(t[0].mt?hs(t[0].mt):"-")+"",c,f,m,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",h,b,d;return i=new bc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:oc}}),{c(){e=p("div"),l=p("div"),n=p("div"),J(i.$$.fragment),o=v(),a=p("div"),c=C(r),f=v(),m=p("div"),h=C(_),b=C(" kWh"),u(n,"class","col-span-2"),u(m,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,$){y(g,e,$),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,a),s(a,c),s(l,f),s(l,m),s(m,h),s(m,b),d=!0},p(g,$){const k={};$&1&&(k.val=g[0].i?g[0].i:0),$&1&&(k.max=g[0].im?g[0].im:15e3),$&1&&(k.sub=g[0].p),$&1&&(k.subunit=g[0].pc),i.$set(k),(!d||$&1)&&r!==(r=(g[0].mt?hs(g[0].mt):"-")+"")&&B(c,r),(!d||$&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&B(h,_)},i(g){d||(M(i.$$.fragment,g),d=!0)},o(g){I(i.$$.fragment,g),d=!1},d(g){g&&w(e),Z(i)}}}function ha(t){let e,l,n,i,o,a,r,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",m,_,h;return i=new bc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:O1}}),{c(){e=p("div"),l=p("div"),n=p("div"),J(i.$$.fragment),o=v(),a=p("div"),r=v(),c=p("div"),m=C(f),_=C(" kWh"),u(n,"class","col-span-2"),u(c,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(b,d){y(b,e,d),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,a),s(l,r),s(l,c),s(c,m),s(c,_),h=!0},p(b,d){const g={};d&1&&(g.val=b[0].e?b[0].e:0),d&1&&(g.max=b[0].om?b[0].om*1e3:1e4),i.$set(g),(!h||d&1)&&f!==(f=(b[0].ec?b[0].ec.toFixed(1):"-")+"")&&B(m,f)},i(b){h||(M(i.$$.fragment,b),h=!0)},o(b){I(i.$$.fragment,b),h=!1},d(b){b&&w(e),Z(i)}}}function ba(t){let e,l,n;return l=new Ap({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.ds=i[0].ds),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function ga(t){let e,l,n;return l=new Ip({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.i1=i[0].i1),o&1&&(a.i2=i[0].i2),o&1&&(a.i3=i[0].i3),o&1&&(a.max=i[0].mf?i[0].mf:32),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function ka(t){let e,l,n;return l=new Fp({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function wa(t){let e,l,n;return l=new Hp({props:{data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.data=i[0].ea),o&1&&(a.currency=i[0].pc),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function ya(t){let e,l,n;return l=new lm({}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function $a(t){let e,l,n;return l=new Gp({props:{json:t[2]}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&4&&(a.json=i[2]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ca(t){let e,l,n;return l=new zp({props:{json:t[3]}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&8&&(a.json=i[3]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ta(t){let e,l,n;return l=new Qp({props:{json:t[4]}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&16&&(a.json=i[4]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Sa(t){let e,l,n;return l=new Xp({props:{json:t[5]}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&32&&(a.json=i[5]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function nm(t){let e,l=je(t[1].ui.i,t[0].i),n,i=je(t[1].ui.e,t[0].om||t[0].e>0),o,a=je(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),r,c=je(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,m=je(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,h=je(t[1].ui.c,t[0].ea),b,d=je(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,$=je(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),k,T=je(t[1].ui.d,t[3]),P,E=je(t[1].ui.m,t[4]),S,N=je(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),D,R=l&&va(t),W=i&&ha(t),O=a&&ba(t),F=c&&ga(t),L=m&&ka(t),j=h&&wa(t),U=d&&ya(),q=$&&$a(t),G=T&&Ca(t),H=E&&Ta(t),V=N&&Sa(t);return{c(){e=p("div"),R&&R.c(),n=v(),W&&W.c(),o=v(),O&&O.c(),r=v(),F&&F.c(),f=v(),L&&L.c(),_=v(),j&&j.c(),b=v(),U&&U.c(),g=v(),q&&q.c(),k=v(),G&&G.c(),P=v(),H&&H.c(),S=v(),V&&V.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(X,ne){y(X,e,ne),R&&R.m(e,null),s(e,n),W&&W.m(e,null),s(e,o),O&&O.m(e,null),s(e,r),F&&F.m(e,null),s(e,f),L&&L.m(e,null),s(e,_),j&&j.m(e,null),s(e,b),U&&U.m(e,null),s(e,g),q&&q.m(e,null),s(e,k),G&&G.m(e,null),s(e,P),H&&H.m(e,null),s(e,S),V&&V.m(e,null),D=!0},p(X,[ne]){ne&3&&(l=je(X[1].ui.i,X[0].i)),l?R?(R.p(X,ne),ne&3&&M(R,1)):(R=va(X),R.c(),M(R,1),R.m(e,n)):R&&(Pe(),I(R,1,1,()=>{R=null}),Me()),ne&3&&(i=je(X[1].ui.e,X[0].om||X[0].e>0)),i?W?(W.p(X,ne),ne&3&&M(W,1)):(W=ha(X),W.c(),M(W,1),W.m(e,o)):W&&(Pe(),I(W,1,1,()=>{W=null}),Me()),ne&3&&(a=je(X[1].ui.v,X[0].u1>100||X[0].u2>100||X[0].u3>100)),a?O?(O.p(X,ne),ne&3&&M(O,1)):(O=ba(X),O.c(),M(O,1),O.m(e,r)):O&&(Pe(),I(O,1,1,()=>{O=null}),Me()),ne&3&&(c=je(X[1].ui.a,X[0].i1>.01||X[0].i2>.01||X[0].i3>.01)),c?F?(F.p(X,ne),ne&3&&M(F,1)):(F=ga(X),F.c(),M(F,1),F.m(e,f)):F&&(Pe(),I(F,1,1,()=>{F=null}),Me()),ne&3&&(m=je(X[1].ui.r,X[0].ri>0||X[0].re>0||X[0].ric>0||X[0].rec>0)),m?L?(L.p(X,ne),ne&3&&M(L,1)):(L=ka(X),L.c(),M(L,1),L.m(e,_)):L&&(Pe(),I(L,1,1,()=>{L=null}),Me()),ne&3&&(h=je(X[1].ui.c,X[0].ea)),h?j?(j.p(X,ne),ne&3&&M(j,1)):(j=wa(X),j.c(),M(j,1),j.m(e,b)):j&&(Pe(),I(j,1,1,()=>{j=null}),Me()),ne&3&&(d=je(X[1].ui.t,X[0].pr&&(X[0].pr.startsWith("10YNO")||X[0].pr=="10Y1001A1001A48H"))),d?U?ne&3&&M(U,1):(U=ya(),U.c(),M(U,1),U.m(e,g)):U&&(Pe(),I(U,1,1,()=>{U=null}),Me()),ne&3&&($=je(X[1].ui.p,X[0].pe&&!Number.isNaN(X[0].p))),$?q?(q.p(X,ne),ne&3&&M(q,1)):(q=$a(X),q.c(),M(q,1),q.m(e,k)):q&&(Pe(),I(q,1,1,()=>{q=null}),Me()),ne&10&&(T=je(X[1].ui.d,X[3])),T?G?(G.p(X,ne),ne&10&&M(G,1)):(G=Ca(X),G.c(),M(G,1),G.m(e,P)):G&&(Pe(),I(G,1,1,()=>{G=null}),Me()),ne&18&&(E=je(X[1].ui.m,X[4])),E?H?(H.p(X,ne),ne&18&&M(H,1)):(H=Ta(X),H.c(),M(H,1),H.m(e,S)):H&&(Pe(),I(H,1,1,()=>{H=null}),Me()),ne&35&&(N=je(X[1].ui.s,X[0].t&&X[0].t!=-127&&X[5].c>1)),N?V?(V.p(X,ne),ne&35&&M(V,1)):(V=Sa(X),V.c(),M(V,1),V.m(e,null)):V&&(Pe(),I(V,1,1,()=>{V=null}),Me())},i(X){D||(M(R),M(W),M(O),M(F),M(L),M(j),M(U),M(q),M(G),M(H),M(V),D=!0)},o(X){I(R),I(W),I(O),I(F),I(L),I(j),I(U),I(q),I(G),I(H),I(V),D=!1},d(X){X&&w(e),R&&R.d(),W&&W.d(),O&&O.d(),F&&F.d(),L&&L.d(),j&&j.d(),U&&U.d(),q&&q.d(),G&&G.d(),H&&H.d(),V&&V.d()}}}function im(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},a={},r={},c={};return uc.subscribe(f=>{l(2,o=f)}),rc.subscribe(f=>{l(3,a=f)}),ac.subscribe(f=>{l(4,r=f)}),cc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,a,r,c]}class sm extends Ce{constructor(e){super(),$e(this,e,im,nm,ye,{data:0,sysinfo:1})}}let to={};const gc=Je(to);async function om(){to=await(await fetch("/configuration.json")).json(),gc.set(to)}function Pa(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function um(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function rm(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Ma(t){let e;return{c(){e=p("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Aa(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART1",l=v(),n=p("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){y(i,e,o),y(i,l,o),y(i,n,o)},d(i){i&&w(e),i&&w(l),i&&w(n)}}}function Da(t){let e;return{c(){e=p("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Na(t){let e,l,n;return{c(){e=p("option"),l=C("GPIO"),n=C(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){y(i,e,o),s(e,l),s(e,n)},d(i){i&&w(e)}}}function Ia(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Na(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Na(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&w(e)}}}function am(t){let e,l,n,i,o;function a(d,g){return d[0]=="esp32c3"?rm:um}let r=a(t),c=r(t),f=t[0]=="esp8266"&&Ma(),m=(t[0]=="esp32"||t[0]=="esp32solo")&&Aa(),_=t[0]=="esp32s2"&&Da(),h={length:t[1]+1},b=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class kc extends Ce{constructor(e){super(),$e(this,e,fm,am,ye,{chip:0})}}function Ea(t){let e,l,n=t[1]&&Ra(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){y(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Ra(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&w(e),n&&n.d()}}}function Ra(t){let e,l;return{c(){e=p("div"),l=C(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){y(n,e,i),s(e,l)},p(n,i){i&2&&B(l,n[1])},d(n){n&&w(e)}}}function cm(t){let e,l=t[0]&&Ea(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ea(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&w(e)}}}function pm(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class gt extends Ce{constructor(e){super(),$e(this,e,pm,cm,ye,{active:0,message:1})}}function Fa(t,e,l){const n=t.slice();return n[1]=e[l],n}function La(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,a){y(o,e,a),s(e,l),s(e,i)},p:ie,d(o){o&&w(e)}}}function mm(t){let e,l,n,i=t[0],o=[];for(let a=0;a{a[m]=null}),Me(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function Cm(t){let e,l;return e=new Kt({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Tm(t){let e,l;return e=new Kt({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Sm(t){let e,l,n,i;const o=[Tm,Cm],a=[];function r(c,f){return c[3].q.s.r?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e!==m&&(Pe(),I(a[m],1,1,()=>{a[m]=null}),Me(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function Pm(t){let e,l;return e=new Kt({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Mm(t){let e,l;return e=new Kt({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Am(t){let e,l,n,i;const o=[Mm,Pm],a=[];function r(c,f){return c[3].q.s.k?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e!==m&&(Pe(),I(a[m],1,1,()=>{a[m]=null}),Me(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function Va(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U,q,G;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Domoticz",n=v(),i=p("a"),J(o.$$.fragment),a=v(),r=p("input"),c=v(),f=p("div"),m=p("div"),_=C("Electricity IDX"),h=p("br"),b=v(),d=p("input"),g=v(),$=p("div"),k=C("Current IDX"),T=p("br"),P=v(),E=p("input"),S=v(),N=p("div"),D=C(`Voltage IDX: L1, L2 & L3 + `),R=p("div"),W=p("input"),O=v(),F=p("input"),L=v(),j=p("input"),u(l,"class","text-sm"),u(i,"href",Ct("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(r,"type","hidden"),u(r,"name","o"),r.value="true",u(d,"name","oe"),u(d,"type","text"),u(d,"class","in-f tr w-full"),u(m,"class","w-1/2"),u(E,"name","oc"),u(E,"type","text"),u(E,"class","in-l tr w-full"),u($,"class","w-1/2"),u(f,"class","my-1 flex"),u(W,"name","ou1"),u(W,"type","text"),u(W,"class","in-f tr w-1/3"),u(F,"name","ou2"),u(F,"type","text"),u(F,"class","in-m tr w-1/3"),u(j,"name","ou3"),u(j,"type","text"),u(j,"class","in-l tr w-1/3"),u(R,"class","flex"),u(N,"class","my-1"),u(e,"class","cnt")},m(H,V){y(H,e,V),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,a),s(e,r),s(e,c),s(e,f),s(f,m),s(m,_),s(m,h),s(m,b),s(m,d),Y(d,t[3].o.e),s(f,g),s(f,$),s($,k),s($,T),s($,P),s($,E),Y(E,t[3].o.c),s(e,S),s(e,N),s(N,D),s(N,R),s(R,W),Y(W,t[3].o.u1),s(R,O),s(R,F),Y(F,t[3].o.u2),s(R,L),s(R,j),Y(j,t[3].o.u3),U=!0,q||(G=[z(d,"input",t[59]),z(E,"input",t[60]),z(W,"input",t[61]),z(F,"input",t[62]),z(j,"input",t[63])],q=!0)},p(H,V){V[0]&8&&d.value!==H[3].o.e&&Y(d,H[3].o.e),V[0]&8&&E.value!==H[3].o.c&&Y(E,H[3].o.c),V[0]&8&&W.value!==H[3].o.u1&&Y(W,H[3].o.u1),V[0]&8&&F.value!==H[3].o.u2&&Y(F,H[3].o.u2),V[0]&8&&j.value!==H[3].o.u3&&Y(j,H[3].o.u3)},i(H){U||(M(o.$$.fragment,H),U=!0)},o(H){I(o.$$.fragment,H),U=!1},d(H){H&&w(e),Z(o),q=!1,Be(G)}}}function Ka(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Home-Assistant",n=v(),i=p("a"),J(o.$$.fragment),a=v(),r=p("input"),c=v(),f=p("div"),m=C("Discovery topic prefix"),_=p("br"),h=v(),b=p("input"),d=v(),g=p("div"),$=C("Hostname for URL"),k=p("br"),T=v(),P=p("input"),S=v(),N=p("div"),D=C("Name tag"),R=p("br"),W=v(),O=p("input"),u(l,"class","text-sm"),u(i,"href",Ct("MQTT-configuration#home-assistant")),u(i,"target","_blank"),u(i,"class","float-right"),u(r,"type","hidden"),u(r,"name","h"),r.value="true",u(b,"name","ht"),u(b,"type","text"),u(b,"class","in-s"),u(b,"placeholder","homeassistant"),u(f,"class","my-1"),u(P,"name","hh"),u(P,"type","text"),u(P,"class","in-s"),u(P,"placeholder",E=t[3].g.h+".local"),u(g,"class","my-1"),u(O,"name","hn"),u(O,"type","text"),u(O,"class","in-s"),u(N,"class","my-1"),u(e,"class","cnt")},m(U,q){y(U,e,q),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,a),s(e,r),s(e,c),s(e,f),s(f,m),s(f,_),s(f,h),s(f,b),Y(b,t[3].h.t),s(e,d),s(e,g),s(g,$),s(g,k),s(g,T),s(g,P),Y(P,t[3].h.h),s(e,S),s(e,N),s(N,D),s(N,R),s(N,W),s(N,O),Y(O,t[3].h.n),F=!0,L||(j=[z(b,"input",t[64]),z(P,"input",t[65]),z(O,"input",t[66])],L=!0)},p(U,q){q[0]&8&&b.value!==U[3].h.t&&Y(b,U[3].h.t),(!F||q[0]&8&&E!==(E=U[3].g.h+".local"))&&u(P,"placeholder",E),q[0]&8&&P.value!==U[3].h.h&&Y(P,U[3].h.h),q[0]&8&&O.value!==U[3].h.n&&Y(O,U[3].h.n)},i(U){F||(M(o.$$.fragment,U),F=!0)},o(U){I(o.$$.fragment,U),F=!1},d(U){U&&w(e),Z(o),L=!1,Be(j)}}}function Qa(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P;o=new $t({});let E={length:9},S=[];for(let N=0;N20&&xa(t),m=t[0].chip=="esp8266"&&lf(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Hardware",n=v(),i=p("a"),J(o.$$.fragment),a=v(),f&&f.c(),r=v(),m&&m.c(),u(l,"class","text-sm"),u(i,"href",Ct("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(_,h){y(_,e,h),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,a),f&&f.m(e,null),s(e,r),m&&m.m(e,null),c=!0},p(_,h){_[0].board>20?f?(f.p(_,h),h[0]&1&&M(f,1)):(f=xa(_),f.c(),M(f,1),f.m(e,r)):f&&(Pe(),I(f,1,1,()=>{f=null}),Me()),_[0].chip=="esp8266"?m?m.p(_,h):(m=lf(_),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},i(_){c||(M(o.$$.fragment,_),M(f),c=!0)},o(_){I(o.$$.fragment,_),I(f),c=!1},d(_){_&&w(e),Z(o),f&&f.d(),m&&m.d()}}}function xa(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U,q,G,H,V,X,ne,le,_e,Te,ve,qe,be,Ee,he,Ne,pe,me,se,re,K,ae,Ae,te,ue,He,Se,de,De,Oe;h=new kc({props:{chip:t[0].chip}});let ge=t[0].chip!="esp8266"&&ef(t),ke=t[3].i.v.p>0&&tf(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),o=C("HAN"),a=p("label"),r=p("input"),c=C(" pullup"),f=p("br"),m=v(),_=p("select"),J(h.$$.fragment),b=v(),d=p("div"),g=C("AP button"),$=p("br"),k=v(),T=p("input"),P=v(),E=p("div"),S=C("LED"),N=p("label"),D=p("input"),R=C(" inv"),W=p("br"),O=v(),F=p("div"),L=p("input"),j=v(),U=p("div"),q=C("RGB"),G=p("label"),H=p("input"),V=C(" inverted"),X=p("br"),ne=v(),le=p("div"),_e=p("input"),Te=v(),ve=p("input"),qe=v(),be=p("input"),Ee=v(),he=p("div"),Ne=C("Temperature"),pe=p("br"),me=v(),se=p("input"),re=v(),K=p("div"),ae=C("Analog temp"),Ae=p("br"),te=v(),ue=p("input"),He=v(),ge&&ge.c(),Se=v(),ke&&ke.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(r,"name","ihu"),r.__value="true",r.value=r.__value,u(r,"type","checkbox"),u(r,"class","rounded mb-1"),u(a,"class","ml-2"),u(_,"name","ihp"),u(_,"class","in-f w-full"),t[3].i.h.p===void 0&&Ye(()=>t[71].call(_)),u(i,"class","w-1/3"),u(T,"name","ia"),u(T,"type","number"),u(T,"min","0"),u(T,"max",t[6]),u(T,"class","in-m tr w-full"),u(d,"class","w-1/3"),u(D,"name","ili"),D.__value="true",D.value=D.__value,u(D,"type","checkbox"),u(D,"class","rounded mb-1"),u(N,"class","ml-4"),u(L,"name","ilp"),u(L,"type","number"),u(L,"min","0"),u(L,"max",t[6]),u(L,"class","in-l tr w-full"),u(F,"class","flex"),u(E,"class","w-1/3"),u(H,"name","iri"),H.__value="true",H.value=H.__value,u(H,"type","checkbox"),u(H,"class","rounded mb-1"),u(G,"class","ml-4"),u(_e,"name","irr"),u(_e,"type","number"),u(_e,"min","0"),u(_e,"max",t[6]),u(_e,"class","in-f tr w-1/3"),u(ve,"name","irg"),u(ve,"type","number"),u(ve,"min","0"),u(ve,"max",t[6]),u(ve,"class","in-m tr w-1/3"),u(be,"name","irb"),u(be,"type","number"),u(be,"min","0"),u(be,"max",t[6]),u(be,"class","in-l tr w-1/3"),u(le,"class","flex"),u(U,"class","w-full"),u(se,"name","itd"),u(se,"type","number"),u(se,"min","0"),u(se,"max",t[6]),u(se,"class","in-f tr w-full"),u(he,"class","my-1 w-1/3"),u(ue,"name","ita"),u(ue,"type","number"),u(ue,"min","0"),u(ue,"max",t[6]),u(ue,"class","in-l tr w-full"),u(K,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(x,oe){y(x,e,oe),y(x,l,oe),y(x,n,oe),s(n,i),s(i,o),s(i,a),s(a,r),r.checked=t[3].i.h.u,s(a,c),s(i,f),s(i,m),s(i,_),Q(h,_,null),Re(_,t[3].i.h.p),s(n,b),s(n,d),s(d,g),s(d,$),s(d,k),s(d,T),Y(T,t[3].i.a),s(n,P),s(n,E),s(E,S),s(E,N),s(N,D),D.checked=t[3].i.l.i,s(N,R),s(E,W),s(E,O),s(E,F),s(F,L),Y(L,t[3].i.l.p),s(n,j),s(n,U),s(U,q),s(U,G),s(G,H),H.checked=t[3].i.r.i,s(G,V),s(U,X),s(U,ne),s(U,le),s(le,_e),Y(_e,t[3].i.r.r),s(le,Te),s(le,ve),Y(ve,t[3].i.r.g),s(le,qe),s(le,be),Y(be,t[3].i.r.b),s(n,Ee),s(n,he),s(he,Ne),s(he,pe),s(he,me),s(he,se),Y(se,t[3].i.t.d),s(n,re),s(n,K),s(K,ae),s(K,Ae),s(K,te),s(K,ue),Y(ue,t[3].i.t.a),s(n,He),ge&&ge.m(n,null),s(n,Se),ke&&ke.m(n,null),de=!0,De||(Oe=[z(r,"change",t[70]),z(_,"change",t[71]),z(T,"input",t[72]),z(D,"change",t[73]),z(L,"input",t[74]),z(H,"change",t[75]),z(_e,"input",t[76]),z(ve,"input",t[77]),z(be,"input",t[78]),z(se,"input",t[79]),z(ue,"input",t[80])],De=!0)},p(x,oe){oe[0]&8&&(r.checked=x[3].i.h.u);const Tl={};oe[0]&1&&(Tl.chip=x[0].chip),h.$set(Tl),oe[0]&8&&Re(_,x[3].i.h.p),(!de||oe[0]&64)&&u(T,"max",x[6]),oe[0]&8&&fe(T.value)!==x[3].i.a&&Y(T,x[3].i.a),oe[0]&8&&(D.checked=x[3].i.l.i),(!de||oe[0]&64)&&u(L,"max",x[6]),oe[0]&8&&fe(L.value)!==x[3].i.l.p&&Y(L,x[3].i.l.p),oe[0]&8&&(H.checked=x[3].i.r.i),(!de||oe[0]&64)&&u(_e,"max",x[6]),oe[0]&8&&fe(_e.value)!==x[3].i.r.r&&Y(_e,x[3].i.r.r),(!de||oe[0]&64)&&u(ve,"max",x[6]),oe[0]&8&&fe(ve.value)!==x[3].i.r.g&&Y(ve,x[3].i.r.g),(!de||oe[0]&64)&&u(be,"max",x[6]),oe[0]&8&&fe(be.value)!==x[3].i.r.b&&Y(be,x[3].i.r.b),(!de||oe[0]&64)&&u(se,"max",x[6]),oe[0]&8&&fe(se.value)!==x[3].i.t.d&&Y(se,x[3].i.t.d),(!de||oe[0]&64)&&u(ue,"max",x[6]),oe[0]&8&&fe(ue.value)!==x[3].i.t.a&&Y(ue,x[3].i.t.a),x[0].chip!="esp8266"?ge?ge.p(x,oe):(ge=ef(x),ge.c(),ge.m(n,Se)):ge&&(ge.d(1),ge=null),x[3].i.v.p>0?ke?ke.p(x,oe):(ke=tf(x),ke.c(),ke.m(n,null)):ke&&(ke.d(1),ke=null)},i(x){de||(M(h.$$.fragment,x),de=!0)},o(x){I(h.$$.fragment,x),de=!1},d(x){x&&w(e),x&&w(l),x&&w(n),Z(h),ge&&ge.d(),ke&&ke.d(),De=!1,Be(Oe)}}}function ef(t){let e,l,n,i,o,a,r;return{c(){e=p("div"),l=C("Vcc"),n=p("br"),i=v(),o=p("input"),u(o,"name","ivp"),u(o,"type","number"),u(o,"min","0"),u(o,"max",t[6]),u(o,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Y(o,t[3].i.v.p),a||(r=z(o,"input",t[81]),a=!0)},p(c,f){f[0]&64&&u(o,"max",c[6]),f[0]&8&&fe(o.value)!==c[3].i.v.p&&Y(o,c[3].i.v.p)},d(c){c&&w(e),a=!1,r()}}}function tf(t){let e,l,n,i,o,a,r,c,f,m;return{c(){e=p("div"),l=C("Voltage divider"),n=p("br"),i=v(),o=p("div"),a=p("input"),r=v(),c=p("input"),u(a,"name","ivdv"),u(a,"type","number"),u(a,"min","0"),u(a,"max","65535"),u(a,"class","in-f tr w-full"),u(a,"placeholder","VCC"),u(c,"name","ivdg"),u(c,"type","number"),u(c,"min","0"),u(c,"max","65535"),u(c,"class","in-l tr w-full"),u(c,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(_,h){y(_,e,h),s(e,l),s(e,n),s(e,i),s(e,o),s(o,a),Y(a,t[3].i.v.d.v),s(o,r),s(o,c),Y(c,t[3].i.v.d.g),f||(m=[z(a,"input",t[82]),z(c,"input",t[83])],f=!0)},p(_,h){h[0]&8&&fe(a.value)!==_[3].i.v.d.v&&Y(a,_[3].i.v.d.v),h[0]&8&&fe(c.value)!==_[3].i.v.d.g&&Y(c,_[3].i.v.d.g)},d(_){_&&w(e),f=!1,Be(m)}}}function lf(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T=(t[0].board==2||t[0].board==100)&&nf(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),o=C("Vcc offset"),a=p("br"),r=v(),c=p("input"),f=v(),m=p("div"),_=C("Multiplier"),h=p("br"),b=v(),d=p("input"),g=v(),T&&T.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(c,"name","ivo"),u(c,"type","number"),u(c,"min","0.0"),u(c,"max","3.5"),u(c,"step","0.01"),u(c,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(d,"name","ivm"),u(d,"type","number"),u(d,"min","0.1"),u(d,"max","10"),u(d,"step","0.01"),u(d,"class","in-l tr w-full"),u(m,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(P,E){y(P,e,E),y(P,l,E),y(P,n,E),s(n,i),s(i,o),s(i,a),s(i,r),s(i,c),Y(c,t[3].i.v.o),s(n,f),s(n,m),s(m,_),s(m,h),s(m,b),s(m,d),Y(d,t[3].i.v.m),s(n,g),T&&T.m(n,null),$||(k=[z(c,"input",t[84]),z(d,"input",t[85])],$=!0)},p(P,E){E[0]&8&&fe(c.value)!==P[3].i.v.o&&Y(c,P[3].i.v.o),E[0]&8&&fe(d.value)!==P[3].i.v.m&&Y(d,P[3].i.v.m),P[0].board==2||P[0].board==100?T?T.p(P,E):(T=nf(P),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(P){P&&w(e),P&&w(l),P&&w(n),T&&T.d(),$=!1,Be(k)}}}function nf(t){let e,l,n,i,o,a,r;return{c(){e=p("div"),l=C("Boot limit"),n=p("br"),i=v(),o=p("input"),u(o,"name","ivb"),u(o,"type","number"),u(o,"min","2.5"),u(o,"max","3.5"),u(o,"step","0.1"),u(o,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Y(o,t[3].i.v.b),a||(r=z(o,"input",t[86]),a=!0)},p(c,f){f[0]&8&&fe(o.value)!==c[3].i.v.b&&Y(o,c[3].i.v.b)},d(c){c&&w(e),a=!1,r()}}}function sf(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k=t[3].d.t&&of();return{c(){e=p("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=v(),n=p("div"),i=p("label"),o=p("input"),a=C(" Enable telnet"),r=v(),k&&k.c(),c=v(),f=p("div"),m=p("select"),_=p("option"),_.textContent="Verbose",h=p("option"),h.textContent="Debug",b=p("option"),b.textContent="Info",d=p("option"),d.textContent="Warning",u(e,"class","bd-red"),u(o,"type","checkbox"),u(o,"name","dt"),o.__value="true",o.value=o.__value,u(o,"class","rounded mb-1"),u(n,"class","my-1"),_.__value=1,_.value=_.__value,h.__value=2,h.value=h.__value,b.__value=3,b.value=b.__value,d.__value=4,d.value=d.__value,u(m,"name","dl"),u(m,"class","in-s"),t[3].d.l===void 0&&Ye(()=>t[89].call(m)),u(f,"class","my-1")},m(T,P){y(T,e,P),y(T,l,P),y(T,n,P),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,a),y(T,r,P),k&&k.m(T,P),y(T,c,P),y(T,f,P),s(f,m),s(m,_),s(m,h),s(m,b),s(m,d),Re(m,t[3].d.l),g||($=[z(o,"change",t[88]),z(m,"change",t[89])],g=!0)},p(T,P){P[0]&8&&(o.checked=T[3].d.t),T[3].d.t?k||(k=of(),k.c(),k.m(c.parentNode,c)):k&&(k.d(1),k=null),P[0]&8&&Re(m,T[3].d.l)},d(T){T&&w(e),T&&w(l),T&&w(n),T&&w(r),k&&k.d(T),T&&w(c),T&&w(f),g=!1,Be($)}}}function of(t){let e;return{c(){e=p("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Dm(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U,q,G,H,V,X,ne,le,_e,Te,ve,qe,be,Ee,he,Ne,pe,me,se,re,K,ae,Ae,te,ue,He,Se,de,De,Oe,ge,ke,x,oe,Tl,_i,di,St,vi,Kl,pl,Jt,hi,bi,gi,lt,ki,Xt,wi,yi,$i,nt,Ci,xt,Ql,dt,Ti,Si,Pi,el,Mi,Ai,Di,Fe,tl,Pt,Sl,Ni,ml,Le,Zl,ho,Jl,Xl,bo,Qn,go,xl,ws,ko,_l,Ht,dl,wo,Ii,yo,et,vl,$o,Ei,en,tn,ln,nn,Ri,Co,Zn,Mt,To,So,Pl,Po,Mo,Ao,jt,sn,on,Do,un,Ml,No,Io,Eo,rn,At,Ro,Fi,Fo,Al,Lo,qo,Oo,an,Dt,Uo,Li,Ho,ys,jo,Dl,qi,Nt,Wo,Go,Bo,$s,Oi,It,Yo,zo,Vo,xe,Ui,Ko,fn,cn,Qo,Jn,Zo,Nl,Jo,Xo,xo,ll,eu,Il,tu,lu,nu,nl,iu,pn,El,su,ou,uu,kt,mn,_n,dn,vn,ru,Rl,au,fu,cu,hn,wt,pu,Hi,mu,ji,Wi,Et,_u,du,Xe,Gi,vu,bn,gn,hu,Fl,bu,gu,ku,hl,Wt,kn,wn,wu,vt,Bi,Yi,yu,ht,yn,zi,Vi,$u,Cs,Ki,Qi,Rt,Cu,Tu,Xn,Su,bl,Pu,xn,Ft,Mu,Au,Du,Zi,il,Nu,Ge,Ji,Iu,$n,Cn,Eu,ei,Ru,Gt,Fu,Ts,Lu,qu,Tn,sl,Ou,Lt,Uu,Ss,Ll,Hu,ju,Wu,ol,Gu,ql,Bu,Yu,zu,ul,Vu,Sn,Pn,Ku,Qu,Zu,rl,Ju,Mn,Xu,xu,er,it,An,Dn,Nn,In,En,Rn,tr,Ol,lr,nr,ir,al,sr,Ps,Ms,As=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Ds,Bt,Xi,or,Fn,Ln,ur,ti,rr,li,ar,Ns,bt,xi,fr,qn,On,cr,ni,pr,es,ts,qt,mr,_r,dr,gl,Is,Un,vr,ls,Hn,hr,ns,Es,Ul,Rs,Hl,Fs,jl,Ls,Wl,Ot,qs,br;r=new $t({}),R=new dm({});let yc=["NOK","SEK","DKK","EUR"],is=[];for(let A=0;A<4;A+=1)is[A]=gm(bm(t,yc,A));let st=t[3].p.e&&t[0].chip!="esp8266"&&Ua(t),ot=t[3].g.s>0&&Ha(t);Xl=new $t({});let $c=[24,48,96,192,384,576,1152],ss=[];for(let A=0;A<7;A+=1)ss[A]=km(hm(t,$c,A));let ut=t[3].m.e.e&&ja(t),rt=t[3].m.e.e&&Wa(t),at=t[3].m.m.e&&Ga(t);cn=new $t({}),gn=new $t({}),yn=new wc({});let ft=t[3].n.m=="static"&&Ba(t);Cn=new $t({});let ct=t[0].chip!="esp8266"&&Ya(t),ze=t[3].q.s.e&&za(t),Ve=t[3].q.m==3&&Va(t),Ke=t[3].q.m==4&&Ka(t),Qe=As&&Qa(t);Ln=new $t({});let jn=t[7],pt=[];for(let A=0;A20||t[0].chip=="esp8266")&&Xa(t);On=new $t({});let mt=t[3].d.s&&sf(t);return Ul=new gt({props:{active:t[1],message:"Loading configuration"}}),Hl=new gt({props:{active:t[2],message:"Saving configuration"}}),jl=new gt({props:{active:t[4],message:"Performing factory reset"}}),Wl=new gt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=p("form"),l=p("div"),n=p("div"),i=p("strong"),i.textContent="General",o=v(),a=p("a"),J(r.$$.fragment),c=v(),f=p("input"),m=v(),_=p("div"),h=p("div"),b=p("div"),d=C("Hostname"),g=p("br"),$=v(),k=p("input"),T=v(),P=p("div"),E=C("Time zone"),S=p("br"),N=v(),D=p("select"),J(R.$$.fragment),W=v(),O=p("input"),F=v(),L=p("div"),j=p("div"),U=p("div"),q=C("Price region"),G=p("br"),H=v(),V=p("select"),X=p("optgroup"),ne=p("option"),ne.textContent="NO1",le=p("option"),le.textContent="NO2",_e=p("option"),_e.textContent="NO3",Te=p("option"),Te.textContent="NO4",ve=p("option"),ve.textContent="NO5",qe=p("optgroup"),be=p("option"),be.textContent="SE1",Ee=p("option"),Ee.textContent="SE2",he=p("option"),he.textContent="SE3",Ne=p("option"),Ne.textContent="SE4",pe=p("optgroup"),me=p("option"),me.textContent="DK1",se=p("option"),se.textContent="DK2",re=p("option"),re.textContent="Austria",K=p("option"),K.textContent="Belgium",ae=p("option"),ae.textContent="Czech Republic",Ae=p("option"),Ae.textContent="Estonia",te=p("option"),te.textContent="Finland",ue=p("option"),ue.textContent="France",He=p("option"),He.textContent="Germany",Se=p("option"),Se.textContent="Great Britain",de=p("option"),de.textContent="Latvia",De=p("option"),De.textContent="Lithuania",Oe=p("option"),Oe.textContent="Netherland",ge=p("option"),ge.textContent="Poland",ke=p("option"),ke.textContent="Switzerland",x=v(),oe=p("div"),Tl=C("Currency"),_i=p("br"),di=v(),St=p("select");for(let A=0;A<4;A+=1)is[A].c();vi=v(),Kl=p("div"),pl=p("div"),Jt=p("div"),hi=C("Fixed price"),bi=p("br"),gi=v(),lt=p("input"),ki=v(),Xt=p("div"),wi=C("Multiplier"),yi=p("br"),$i=v(),nt=p("input"),Ci=v(),xt=p("div"),Ql=p("label"),dt=p("input"),Ti=C(" Enable price fetch from remote server"),Si=v(),st&&st.c(),Pi=v(),el=p("div"),Mi=C("Security"),Ai=p("br"),Di=v(),Fe=p("select"),tl=p("option"),tl.textContent="None",Pt=p("option"),Pt.textContent="Only configuration",Sl=p("option"),Sl.textContent="Everything",Ni=v(),ot&&ot.c(),ml=v(),Le=p("div"),Zl=p("strong"),Zl.textContent="Meter",ho=v(),Jl=p("a"),J(Xl.$$.fragment),bo=v(),Qn=p("input"),go=v(),xl=p("div"),ws=p("span"),ws.textContent="Serial configuration",ko=v(),_l=p("div"),Ht=p("select"),dl=p("option"),wo=C("Autodetect");for(let A=0;A<7;A+=1)ss[A].c();yo=v(),et=p("select"),vl=p("option"),$o=C("-"),en=p("option"),en.textContent="7N1",tn=p("option"),tn.textContent="8N1",ln=p("option"),ln.textContent="7E1",nn=p("option"),nn.textContent="8E1",Co=v(),Zn=p("label"),Mt=p("input"),To=C(" inverted"),So=v(),Pl=p("div"),Po=C("Voltage"),Mo=p("br"),Ao=v(),jt=p("select"),sn=p("option"),sn.textContent="400V (TN)",on=p("option"),on.textContent="230V (IT/TT)",Do=v(),un=p("div"),Ml=p("div"),No=C("Main fuse"),Io=p("br"),Eo=v(),rn=p("label"),At=p("input"),Ro=v(),Fi=p("span"),Fi.textContent="A",Fo=v(),Al=p("div"),Lo=C("Production"),qo=p("br"),Oo=v(),an=p("label"),Dt=p("input"),Uo=v(),Li=p("span"),Li.textContent="kWp",Ho=v(),ys=p("div"),jo=v(),Dl=p("div"),qi=p("label"),Nt=p("input"),Wo=C(" Meter is encrypted"),Go=v(),ut&&ut.c(),Bo=v(),rt&&rt.c(),$s=v(),Oi=p("label"),It=p("input"),Yo=C(" Multipliers"),zo=v(),at&&at.c(),Vo=v(),xe=p("div"),Ui=p("strong"),Ui.textContent="WiFi",Ko=v(),fn=p("a"),J(cn.$$.fragment),Qo=v(),Jn=p("input"),Zo=v(),Nl=p("div"),Jo=C("SSID"),Xo=p("br"),xo=v(),ll=p("input"),eu=v(),Il=p("div"),tu=C("Password"),lu=p("br"),nu=v(),nl=p("input"),iu=v(),pn=p("div"),El=p("div"),su=C("Power saving"),ou=p("br"),uu=v(),kt=p("select"),mn=p("option"),mn.textContent="Default",_n=p("option"),_n.textContent="Off",dn=p("option"),dn.textContent="Minimum",vn=p("option"),vn.textContent="Maximum",ru=v(),Rl=p("div"),au=C("Power"),fu=p("br"),cu=v(),hn=p("div"),wt=p("input"),pu=v(),Hi=p("span"),Hi.textContent="dBm",mu=v(),ji=p("div"),Wi=p("label"),Et=p("input"),_u=C(" Auto reboot on connection problem"),du=v(),Xe=p("div"),Gi=p("strong"),Gi.textContent="Network",vu=v(),bn=p("a"),J(gn.$$.fragment),hu=v(),Fl=p("div"),bu=C("IP"),gu=p("br"),ku=v(),hl=p("div"),Wt=p("select"),kn=p("option"),kn.textContent="DHCP",wn=p("option"),wn.textContent="Static",wu=v(),vt=p("input"),yu=v(),ht=p("select"),J(yn.$$.fragment),$u=v(),ft&&ft.c(),Cs=v(),Ki=p("div"),Qi=p("label"),Rt=p("input"),Cu=C(" enable mDNS"),Tu=v(),Xn=p("input"),Su=v(),bl=p("div"),Pu=C("NTP "),xn=p("label"),Ft=p("input"),Mu=C(" obtain from DHCP"),Au=p("br"),Du=v(),Zi=p("div"),il=p("input"),Nu=v(),Ge=p("div"),Ji=p("strong"),Ji.textContent="MQTT",Iu=v(),$n=p("a"),J(Cn.$$.fragment),Eu=v(),ei=p("input"),Ru=v(),Gt=p("div"),Fu=C(`Server + `),ct&&ct.c(),Ts=v(),Lu=p("br"),qu=v(),Tn=p("div"),sl=p("input"),Ou=v(),Lt=p("input"),Uu=v(),ze&&ze.c(),Ss=v(),Ll=p("div"),Hu=C("Username"),ju=p("br"),Wu=v(),ol=p("input"),Gu=v(),ql=p("div"),Bu=C("Password"),Yu=p("br"),zu=v(),ul=p("input"),Vu=v(),Sn=p("div"),Pn=p("div"),Ku=C("Client ID"),Qu=p("br"),Zu=v(),rl=p("input"),Ju=v(),Mn=p("div"),Xu=C("Payload"),xu=p("br"),er=v(),it=p("select"),An=p("option"),An.textContent="JSON",Dn=p("option"),Dn.textContent="Raw (minimal)",Nn=p("option"),Nn.textContent="Raw (full)",In=p("option"),In.textContent="Domoticz",En=p("option"),En.textContent="HomeAssistant",Rn=p("option"),Rn.textContent="HEX dump",tr=v(),Ol=p("div"),lr=C("Publish topic"),nr=p("br"),ir=v(),al=p("input"),sr=v(),Ve&&Ve.c(),Ps=v(),Ke&&Ke.c(),Ms=v(),Qe&&Qe.c(),Ds=v(),Bt=p("div"),Xi=p("strong"),Xi.textContent="User interface",or=v(),Fn=p("a"),J(Ln.$$.fragment),ur=v(),ti=p("input"),rr=v(),li=p("div");for(let A=0;ASave',Es=v(),J(Ul.$$.fragment),Rs=v(),J(Hl.$$.fragment),Fs=v(),J(jl.$$.fragment),Ls=v(),J(Wl.$$.fragment),u(i,"class","text-sm"),u(a,"href",Ct("General-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","g"),f.value="true",u(k,"name","gh"),u(k,"type","text"),u(k,"class","in-f w-full"),u(k,"pattern","[A-Za-z0-9-]+"),u(D,"name","gt"),u(D,"class","in-l w-full"),t[3].g.t===void 0&&Ye(()=>t[13].call(D)),u(h,"class","flex"),u(_,"class","my-1"),u(O,"type","hidden"),u(O,"name","p"),O.value="true",ne.__value="10YNO-1--------2",ne.value=ne.__value,le.__value="10YNO-2--------T",le.value=le.__value,_e.__value="10YNO-3--------J",_e.value=_e.__value,Te.__value="10YNO-4--------9",Te.value=Te.__value,ve.__value="10Y1001A1001A48H",ve.value=ve.__value,u(X,"label","Norway"),be.__value="10Y1001A1001A44P",be.value=be.__value,Ee.__value="10Y1001A1001A45N",Ee.value=Ee.__value,he.__value="10Y1001A1001A46L",he.value=he.__value,Ne.__value="10Y1001A1001A47J",Ne.value=Ne.__value,u(qe,"label","Sweden"),me.__value="10YDK-1--------W",me.value=me.__value,se.__value="10YDK-2--------M",se.value=se.__value,u(pe,"label","Denmark"),re.__value="10YAT-APG------L",re.value=re.__value,K.__value="10YBE----------2",K.value=K.__value,ae.__value="10YCZ-CEPS-----N",ae.value=ae.__value,Ae.__value="10Y1001A1001A39I",Ae.value=Ae.__value,te.__value="10YFI-1--------U",te.value=te.__value,ue.__value="10YFR-RTE------C",ue.value=ue.__value,He.__value="10Y1001A1001A83F",He.value=He.__value,Se.__value="10YGB----------A",Se.value=Se.__value,de.__value="10YLV-1001A00074",de.value=de.__value,De.__value="10YLT-1001A0008Q",De.value=De.__value,Oe.__value="10YNL----------L",Oe.value=Oe.__value,ge.__value="10YPL-AREA-----S",ge.value=ge.__value,ke.__value="10YCH-SWISSGRIDZ",ke.value=ke.__value,u(V,"name","pr"),u(V,"class","in-f w-full"),t[3].p.r===void 0&&Ye(()=>t[14].call(V)),u(U,"class","w-full"),u(St,"name","pc"),u(St,"class","in-l"),t[3].p.c===void 0&&Ye(()=>t[15].call(St)),u(j,"class","flex"),u(L,"class","my-1"),u(lt,"name","pf"),u(lt,"type","number"),u(lt,"min","0.001"),u(lt,"max","65"),u(lt,"step","0.001"),u(lt,"class","in-f tr w-full"),u(Jt,"class","w-1/2"),u(nt,"name","pm"),u(nt,"type","number"),u(nt,"min","0.001"),u(nt,"max","1000"),u(nt,"step","0.001"),u(nt,"class","in-l tr w-full"),u(Xt,"class","w-1/2"),u(pl,"class","flex"),u(Kl,"class","my-1"),u(dt,"type","checkbox"),u(dt,"name","pe"),dt.__value="true",dt.value=dt.__value,u(dt,"class","rounded mb-1"),u(xt,"class","my-1"),tl.__value=0,tl.value=tl.__value,Pt.__value=1,Pt.value=Pt.__value,Sl.__value=2,Sl.value=Sl.__value,u(Fe,"name","gs"),u(Fe,"class","in-s"),t[3].g.s===void 0&&Ye(()=>t[20].call(Fe)),u(el,"class","my-1"),u(n,"class","cnt"),u(Zl,"class","text-sm"),u(Jl,"href",Ct("Meter-configuration")),u(Jl,"target","_blank"),u(Jl,"class","float-right"),u(Qn,"type","hidden"),u(Qn,"name","m"),Qn.value="true",dl.__value=0,dl.value=dl.__value,dl.disabled=Ii=t[3].m.b!=0,u(Ht,"name","mb"),u(Ht,"class","in-f"),t[3].m.b===void 0&&Ye(()=>t[23].call(Ht)),vl.__value=0,vl.value=vl.__value,vl.disabled=Ei=t[3].m.b!=0,en.__value=2,en.value=en.__value,tn.__value=3,tn.value=tn.__value,ln.__value=10,ln.value=ln.__value,nn.__value=11,nn.value=nn.__value,u(et,"name","mp"),u(et,"class","in-l"),et.disabled=Ri=t[3].m.b==0,t[3].m.p===void 0&&Ye(()=>t[24].call(et)),u(Mt,"name","mi"),Mt.__value="true",Mt.value=Mt.__value,u(Mt,"type","checkbox"),u(Mt,"class","rounded mb-1"),u(Zn,"class","mt-2 ml-3 whitespace-nowrap"),u(_l,"class","flex"),u(xl,"class","my-1"),sn.__value=2,sn.value=sn.__value,on.__value=1,on.value=on.__value,u(jt,"name","md"),u(jt,"class","in-s"),t[3].m.d===void 0&&Ye(()=>t[26].call(jt)),u(Pl,"class","my-1"),u(At,"name","mf"),u(At,"type","number"),u(At,"min","5"),u(At,"max","65535"),u(At,"class","in-f tr w-full"),u(Fi,"class","in-post"),u(rn,"class","flex"),u(Ml,"class","mx-1"),u(Dt,"name","mr"),u(Dt,"type","number"),u(Dt,"min","0"),u(Dt,"max","65535"),u(Dt,"class","in-f tr w-full"),u(Li,"class","in-post"),u(an,"class","flex"),u(Al,"class","mx-1"),u(un,"class","my-1 flex"),u(ys,"class","my-1"),u(Nt,"type","checkbox"),u(Nt,"name","me"),Nt.__value="true",Nt.value=Nt.__value,u(Nt,"class","rounded mb-1"),u(Dl,"class","my-1"),u(It,"type","checkbox"),u(It,"name","mm"),It.__value="true",It.value=It.__value,u(It,"class","rounded mb-1"),u(Le,"class","cnt"),u(Ui,"class","text-sm"),u(fn,"href",Ct("WiFi-configuration")),u(fn,"target","_blank"),u(fn,"class","float-right"),u(Jn,"type","hidden"),u(Jn,"name","w"),Jn.value="true",u(ll,"name","ws"),u(ll,"type","text"),u(ll,"class","in-s"),u(Nl,"class","my-1"),u(nl,"name","wp"),u(nl,"type","password"),u(nl,"class","in-s"),u(Il,"class","my-1"),mn.__value=255,mn.value=mn.__value,_n.__value=0,_n.value=_n.__value,dn.__value=1,dn.value=dn.__value,vn.__value=2,vn.value=vn.__value,u(kt,"name","wz"),u(kt,"class","in-s"),t[3].w.z===void 0&&Ye(()=>t[39].call(kt)),u(El,"class","w-1/2"),u(wt,"name","ww"),u(wt,"type","number"),u(wt,"min","0"),u(wt,"max","20.5"),u(wt,"step","0.5"),u(wt,"class","in-f tr w-full"),u(Hi,"class","in-post"),u(hn,"class","flex"),u(Rl,"class","ml-2 w-1/2"),u(pn,"class","my-1 flex"),u(Et,"type","checkbox"),u(Et,"name","wa"),Et.__value="true",Et.value=Et.__value,u(Et,"class","rounded mb-1"),u(ji,"class","my-3"),u(xe,"class","cnt"),u(Gi,"class","text-sm"),u(bn,"href",Ct("Network-configuration")),u(bn,"target","_blank"),u(bn,"class","float-right"),kn.__value="dhcp",kn.value=kn.__value,wn.__value="static",wn.value=wn.__value,u(Wt,"name","nm"),u(Wt,"class","in-f"),t[3].n.m===void 0&&Ye(()=>t[42].call(Wt)),u(vt,"name","ni"),u(vt,"type","text"),u(vt,"class","in-m w-full"),vt.disabled=Bi=t[3].n.m=="dhcp",vt.required=Yi=t[3].n.m=="static",u(ht,"name","ns"),u(ht,"class","in-l"),ht.disabled=zi=t[3].n.m=="dhcp",ht.required=Vi=t[3].n.m=="static",t[3].n.s===void 0&&Ye(()=>t[44].call(ht)),u(hl,"class","flex"),u(Fl,"class","my-1"),u(Rt,"name","nd"),Rt.__value="true",Rt.value=Rt.__value,u(Rt,"type","checkbox"),u(Rt,"class","rounded mb-1"),u(Ki,"class","my-1"),u(Xn,"type","hidden"),u(Xn,"name","ntp"),Xn.value="true",u(Ft,"name","ntpd"),Ft.__value="true",Ft.value=Ft.__value,u(Ft,"type","checkbox"),u(Ft,"class","rounded mb-1"),u(xn,"class","ml-4"),u(il,"name","ntph"),u(il,"type","text"),u(il,"class","in-s"),u(Zi,"class","flex"),u(bl,"class","my-1"),u(Xe,"class","cnt"),u(Ji,"class","text-sm"),u($n,"href",Ct("MQTT-configuration")),u($n,"target","_blank"),u($n,"class","float-right"),u(ei,"type","hidden"),u(ei,"name","q"),ei.value="true",u(sl,"name","qh"),u(sl,"type","text"),u(sl,"class","in-f w-3/4"),u(Lt,"name","qp"),u(Lt,"type","number"),u(Lt,"min","1024"),u(Lt,"max","65535"),u(Lt,"class","in-l tr w-1/4"),u(Tn,"class","flex"),u(Gt,"class","my-1"),u(ol,"name","qu"),u(ol,"type","text"),u(ol,"class","in-s"),u(Ll,"class","my-1"),u(ul,"name","qa"),u(ul,"type","password"),u(ul,"class","in-s"),u(ql,"class","my-1"),u(rl,"name","qc"),u(rl,"type","text"),u(rl,"class","in-f w-full"),An.__value=0,An.value=An.__value,Dn.__value=1,Dn.value=Dn.__value,Nn.__value=2,Nn.value=Nn.__value,In.__value=3,In.value=In.__value,En.__value=4,En.value=En.__value,Rn.__value=255,Rn.value=Rn.__value,u(it,"name","qm"),u(it,"class","in-l"),t[3].q.m===void 0&&Ye(()=>t[57].call(it)),u(Sn,"class","my-1 flex"),u(al,"name","qb"),u(al,"type","text"),u(al,"class","in-s"),u(Ol,"class","my-1"),u(Ge,"class","cnt"),u(Xi,"class","text-sm"),u(Fn,"href",Ct("User-interface")),u(Fn,"target","_blank"),u(Fn,"class","float-right"),u(ti,"type","hidden"),u(ti,"name","u"),ti.value="true",u(li,"class","flex flex-wrap"),u(Bt,"class","cnt"),u(xi,"class","text-sm"),u(qn,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(qn,"target","_blank"),u(qn,"class","float-right"),u(ni,"type","hidden"),u(ni,"name","d"),ni.value="true",u(qt,"type","checkbox"),u(qt,"name","ds"),qt.__value="true",qt.value=qt.__value,u(qt,"class","rounded mb-1"),u(es,"class","mt-3"),u(bt,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(Un,"type","button"),u(Un,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),u(Hn,"type","button"),u(Hn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(ls,"class","text-center"),u(ns,"class","text-right"),u(gl,"class","grid grid-cols-3"),u(e,"autocomplete","off")},m(A,ee){y(A,e,ee),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),Q(r,a,null),s(n,c),s(n,f),s(n,m),s(n,_),s(_,h),s(h,b),s(b,d),s(b,g),s(b,$),s(b,k),Y(k,t[3].g.h),s(h,T),s(h,P),s(P,E),s(P,S),s(P,N),s(P,D),Q(R,D,null),Re(D,t[3].g.t),s(n,W),s(n,O),s(n,F),s(n,L),s(L,j),s(j,U),s(U,q),s(U,G),s(U,H),s(U,V),s(V,X),s(X,ne),s(X,le),s(X,_e),s(X,Te),s(X,ve),s(V,qe),s(qe,be),s(qe,Ee),s(qe,he),s(qe,Ne),s(V,pe),s(pe,me),s(pe,se),s(V,re),s(V,K),s(V,ae),s(V,Ae),s(V,te),s(V,ue),s(V,He),s(V,Se),s(V,de),s(V,De),s(V,Oe),s(V,ge),s(V,ke),Re(V,t[3].p.r),s(j,x),s(j,oe),s(oe,Tl),s(oe,_i),s(oe,di),s(oe,St);for(let _t=0;_t<4;_t+=1)is[_t].m(St,null);Re(St,t[3].p.c),s(n,vi),s(n,Kl),s(Kl,pl),s(pl,Jt),s(Jt,hi),s(Jt,bi),s(Jt,gi),s(Jt,lt),Y(lt,t[3].p.f),s(pl,ki),s(pl,Xt),s(Xt,wi),s(Xt,yi),s(Xt,$i),s(Xt,nt),Y(nt,t[3].p.m),s(n,Ci),s(n,xt),s(xt,Ql),s(Ql,dt),dt.checked=t[3].p.e,s(Ql,Ti),s(xt,Si),st&&st.m(xt,null),s(n,Pi),s(n,el),s(el,Mi),s(el,Ai),s(el,Di),s(el,Fe),s(Fe,tl),s(Fe,Pt),s(Fe,Sl),Re(Fe,t[3].g.s),s(n,Ni),ot&&ot.m(n,null),s(l,ml),s(l,Le),s(Le,Zl),s(Le,ho),s(Le,Jl),Q(Xl,Jl,null),s(Le,bo),s(Le,Qn),s(Le,go),s(Le,xl),s(xl,ws),s(xl,ko),s(xl,_l),s(_l,Ht),s(Ht,dl),s(dl,wo);for(let _t=0;_t<7;_t+=1)ss[_t].m(Ht,null);Re(Ht,t[3].m.b),s(_l,yo),s(_l,et),s(et,vl),s(vl,$o),s(et,en),s(et,tn),s(et,ln),s(et,nn),Re(et,t[3].m.p),s(_l,Co),s(_l,Zn),s(Zn,Mt),Mt.checked=t[3].m.i,s(Zn,To),s(Le,So),s(Le,Pl),s(Pl,Po),s(Pl,Mo),s(Pl,Ao),s(Pl,jt),s(jt,sn),s(jt,on),Re(jt,t[3].m.d),s(Le,Do),s(Le,un),s(un,Ml),s(Ml,No),s(Ml,Io),s(Ml,Eo),s(Ml,rn),s(rn,At),Y(At,t[3].m.f),s(rn,Ro),s(rn,Fi),s(un,Fo),s(un,Al),s(Al,Lo),s(Al,qo),s(Al,Oo),s(Al,an),s(an,Dt),Y(Dt,t[3].m.r),s(an,Uo),s(an,Li),s(Le,Ho),s(Le,ys),s(Le,jo),s(Le,Dl),s(Dl,qi),s(qi,Nt),Nt.checked=t[3].m.e.e,s(qi,Wo),s(Dl,Go),ut&&ut.m(Dl,null),s(Le,Bo),rt&&rt.m(Le,null),s(Le,$s),s(Le,Oi),s(Oi,It),It.checked=t[3].m.m.e,s(Oi,Yo),s(Le,zo),at&&at.m(Le,null),s(l,Vo),s(l,xe),s(xe,Ui),s(xe,Ko),s(xe,fn),Q(cn,fn,null),s(xe,Qo),s(xe,Jn),s(xe,Zo),s(xe,Nl),s(Nl,Jo),s(Nl,Xo),s(Nl,xo),s(Nl,ll),Y(ll,t[3].w.s),s(xe,eu),s(xe,Il),s(Il,tu),s(Il,lu),s(Il,nu),s(Il,nl),Y(nl,t[3].w.p),s(xe,iu),s(xe,pn),s(pn,El),s(El,su),s(El,ou),s(El,uu),s(El,kt),s(kt,mn),s(kt,_n),s(kt,dn),s(kt,vn),Re(kt,t[3].w.z),s(pn,ru),s(pn,Rl),s(Rl,au),s(Rl,fu),s(Rl,cu),s(Rl,hn),s(hn,wt),Y(wt,t[3].w.w),s(hn,pu),s(hn,Hi),s(xe,mu),s(xe,ji),s(ji,Wi),s(Wi,Et),Et.checked=t[3].w.a,s(Wi,_u),s(l,du),s(l,Xe),s(Xe,Gi),s(Xe,vu),s(Xe,bn),Q(gn,bn,null),s(Xe,hu),s(Xe,Fl),s(Fl,bu),s(Fl,gu),s(Fl,ku),s(Fl,hl),s(hl,Wt),s(Wt,kn),s(Wt,wn),Re(Wt,t[3].n.m),s(hl,wu),s(hl,vt),Y(vt,t[3].n.i),s(hl,yu),s(hl,ht),Q(yn,ht,null),Re(ht,t[3].n.s),s(Xe,$u),ft&&ft.m(Xe,null),s(Xe,Cs),s(Xe,Ki),s(Ki,Qi),s(Qi,Rt),Rt.checked=t[3].n.d,s(Qi,Cu),s(Xe,Tu),s(Xe,Xn),s(Xe,Su),s(Xe,bl),s(bl,Pu),s(bl,xn),s(xn,Ft),Ft.checked=t[3].n.h,s(xn,Mu),s(bl,Au),s(bl,Du),s(bl,Zi),s(Zi,il),Y(il,t[3].n.n1),s(l,Nu),s(l,Ge),s(Ge,Ji),s(Ge,Iu),s(Ge,$n),Q(Cn,$n,null),s(Ge,Eu),s(Ge,ei),s(Ge,Ru),s(Ge,Gt),s(Gt,Fu),ct&&ct.m(Gt,null),s(Gt,Ts),s(Gt,Lu),s(Gt,qu),s(Gt,Tn),s(Tn,sl),Y(sl,t[3].q.h),s(Tn,Ou),s(Tn,Lt),Y(Lt,t[3].q.p),s(Ge,Uu),ze&&ze.m(Ge,null),s(Ge,Ss),s(Ge,Ll),s(Ll,Hu),s(Ll,ju),s(Ll,Wu),s(Ll,ol),Y(ol,t[3].q.u),s(Ge,Gu),s(Ge,ql),s(ql,Bu),s(ql,Yu),s(ql,zu),s(ql,ul),Y(ul,t[3].q.a),s(Ge,Vu),s(Ge,Sn),s(Sn,Pn),s(Pn,Ku),s(Pn,Qu),s(Pn,Zu),s(Pn,rl),Y(rl,t[3].q.c),s(Sn,Ju),s(Sn,Mn),s(Mn,Xu),s(Mn,xu),s(Mn,er),s(Mn,it),s(it,An),s(it,Dn),s(it,Nn),s(it,In),s(it,En),s(it,Rn),Re(it,t[3].q.m),s(Ge,tr),s(Ge,Ol),s(Ol,lr),s(Ol,nr),s(Ol,ir),s(Ol,al),Y(al,t[3].q.b),s(l,sr),Ve&&Ve.m(l,null),s(l,Ps),Ke&&Ke.m(l,null),s(l,Ms),Qe&&Qe.m(l,null),s(l,Ds),s(l,Bt),s(Bt,Xi),s(Bt,or),s(Bt,Fn),Q(Ln,Fn,null),s(Bt,ur),s(Bt,ti),s(Bt,rr),s(Bt,li);for(let _t=0;_t0?ot?ot.p(A,ee):(ot=Ha(A),ot.c(),ot.m(n,null)):ot&&(ot.d(1),ot=null),(!Ot||ee[0]&8&&Ii!==(Ii=A[3].m.b!=0))&&(dl.disabled=Ii),ee[0]&8&&Re(Ht,A[3].m.b),(!Ot||ee[0]&8&&Ei!==(Ei=A[3].m.b!=0))&&(vl.disabled=Ei),(!Ot||ee[0]&8&&Ri!==(Ri=A[3].m.b==0))&&(et.disabled=Ri),ee[0]&8&&Re(et,A[3].m.p),ee[0]&8&&(Mt.checked=A[3].m.i),ee[0]&8&&Re(jt,A[3].m.d),ee[0]&8&&fe(At.value)!==A[3].m.f&&Y(At,A[3].m.f),ee[0]&8&&fe(Dt.value)!==A[3].m.r&&Y(Dt,A[3].m.r),ee[0]&8&&(Nt.checked=A[3].m.e.e),A[3].m.e.e?ut?ut.p(A,ee):(ut=ja(A),ut.c(),ut.m(Dl,null)):ut&&(ut.d(1),ut=null),A[3].m.e.e?rt?rt.p(A,ee):(rt=Wa(A),rt.c(),rt.m(Le,$s)):rt&&(rt.d(1),rt=null),ee[0]&8&&(It.checked=A[3].m.m.e),A[3].m.m.e?at?at.p(A,ee):(at=Ga(A),at.c(),at.m(Le,null)):at&&(at.d(1),at=null),ee[0]&8&&ll.value!==A[3].w.s&&Y(ll,A[3].w.s),ee[0]&8&&nl.value!==A[3].w.p&&Y(nl,A[3].w.p),ee[0]&8&&Re(kt,A[3].w.z),ee[0]&8&&fe(wt.value)!==A[3].w.w&&Y(wt,A[3].w.w),ee[0]&8&&(Et.checked=A[3].w.a),ee[0]&8&&Re(Wt,A[3].n.m),(!Ot||ee[0]&8&&Bi!==(Bi=A[3].n.m=="dhcp"))&&(vt.disabled=Bi),(!Ot||ee[0]&8&&Yi!==(Yi=A[3].n.m=="static"))&&(vt.required=Yi),ee[0]&8&&vt.value!==A[3].n.i&&Y(vt,A[3].n.i),(!Ot||ee[0]&8&&zi!==(zi=A[3].n.m=="dhcp"))&&(ht.disabled=zi),(!Ot||ee[0]&8&&Vi!==(Vi=A[3].n.m=="static"))&&(ht.required=Vi),ee[0]&8&&Re(ht,A[3].n.s),A[3].n.m=="static"?ft?ft.p(A,ee):(ft=Ba(A),ft.c(),ft.m(Xe,Cs)):ft&&(ft.d(1),ft=null),ee[0]&8&&(Rt.checked=A[3].n.d),ee[0]&8&&(Ft.checked=A[3].n.h),ee[0]&8&&il.value!==A[3].n.n1&&Y(il,A[3].n.n1),A[0].chip!="esp8266"?ct?ct.p(A,ee):(ct=Ya(A),ct.c(),ct.m(Gt,Ts)):ct&&(ct.d(1),ct=null),ee[0]&8&&sl.value!==A[3].q.h&&Y(sl,A[3].q.h),ee[0]&8&&fe(Lt.value)!==A[3].q.p&&Y(Lt,A[3].q.p),A[3].q.s.e?ze?(ze.p(A,ee),ee[0]&8&&M(ze,1)):(ze=za(A),ze.c(),M(ze,1),ze.m(Ge,Ss)):ze&&(Pe(),I(ze,1,1,()=>{ze=null}),Me()),ee[0]&8&&ol.value!==A[3].q.u&&Y(ol,A[3].q.u),ee[0]&8&&ul.value!==A[3].q.a&&Y(ul,A[3].q.a),ee[0]&8&&rl.value!==A[3].q.c&&Y(rl,A[3].q.c),ee[0]&8&&Re(it,A[3].q.m),ee[0]&8&&al.value!==A[3].q.b&&Y(al,A[3].q.b),A[3].q.m==3?Ve?(Ve.p(A,ee),ee[0]&8&&M(Ve,1)):(Ve=Va(A),Ve.c(),M(Ve,1),Ve.m(l,Ps)):Ve&&(Pe(),I(Ve,1,1,()=>{Ve=null}),Me()),A[3].q.m==4?Ke?(Ke.p(A,ee),ee[0]&8&&M(Ke,1)):(Ke=Ka(A),Ke.c(),M(Ke,1),Ke.m(l,Ms)):Ke&&(Pe(),I(Ke,1,1,()=>{Ke=null}),Me()),ee[0]&8&&(As=A[3].p.r.startsWith("10YNO")||A[3].p.r=="10Y1001A1001A48H"),As?Qe?(Qe.p(A,ee),ee[0]&8&&M(Qe,1)):(Qe=Qa(A),Qe.c(),M(Qe,1),Qe.m(l,Ds)):Qe&&(Pe(),I(Qe,1,1,()=>{Qe=null}),Me()),ee[0]&136){jn=A[7];let yt;for(yt=0;yt20||A[0].chip=="esp8266"?Ze?(Ze.p(A,ee),ee[0]&1&&M(Ze,1)):(Ze=Xa(A),Ze.c(),M(Ze,1),Ze.m(l,Ns)):Ze&&(Pe(),I(Ze,1,1,()=>{Ze=null}),Me()),ee[0]&8&&(qt.checked=A[3].d.s),A[3].d.s?mt?mt.p(A,ee):(mt=sf(A),mt.c(),mt.m(bt,null)):mt&&(mt.d(1),mt=null);const _t={};ee[0]&2&&(_t.active=A[1]),Ul.$set(_t);const gr={};ee[0]&4&&(gr.active=A[2]),Hl.$set(gr);const kr={};ee[0]&16&&(kr.active=A[4]),jl.$set(kr);const wr={};ee[0]&32&&(wr.active=A[5]),Wl.$set(wr)},i(A){Ot||(M(r.$$.fragment,A),M(R.$$.fragment,A),M(Xl.$$.fragment,A),M(cn.$$.fragment,A),M(gn.$$.fragment,A),M(yn.$$.fragment,A),M(Cn.$$.fragment,A),M(ze),M(Ve),M(Ke),M(Qe),M(Ln.$$.fragment,A),M(Ze),M(On.$$.fragment,A),M(Ul.$$.fragment,A),M(Hl.$$.fragment,A),M(jl.$$.fragment,A),M(Wl.$$.fragment,A),Ot=!0)},o(A){I(r.$$.fragment,A),I(R.$$.fragment,A),I(Xl.$$.fragment,A),I(cn.$$.fragment,A),I(gn.$$.fragment,A),I(yn.$$.fragment,A),I(Cn.$$.fragment,A),I(ze),I(Ve),I(Ke),I(Qe),I(Ln.$$.fragment,A),I(Ze),I(On.$$.fragment,A),I(Ul.$$.fragment,A),I(Hl.$$.fragment,A),I(jl.$$.fragment,A),I(Wl.$$.fragment,A),Ot=!1},d(A){A&&w(e),Z(r),Z(R),Qt(is,A),st&&st.d(),ot&&ot.d(),Z(Xl),Qt(ss,A),ut&&ut.d(),rt&&rt.d(),at&&at.d(),Z(cn),Z(gn),Z(yn),ft&&ft.d(),Z(Cn),ct&&ct.d(),ze&&ze.d(),Ve&&Ve.d(),Ke&&Ke.d(),Qe&&Qe.d(),Z(Ln),Qt(pt,A),Ze&&Ze.d(),Z(On),mt&&mt.d(),A&&w(Es),Z(Ul,A),A&&w(Rs),Z(Hl,A),A&&w(Fs),Z(jl,A),A&&w(Ls),Z(Wl,A),qs=!1,Be(br)}}}async function Nm(){await(await fetch("/reboot",{method:"POST"})).json()}function Im(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,a=!1,r={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""}};gc.subscribe(Fe=>{Fe.version&&(l(3,r=Fe),l(1,o=!1))}),om();let c=!1,f=!1;async function m(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Fe=new URLSearchParams;Fe.append("perform","true");let Pt=await(await fetch("/reset",{method:"POST",body:Fe})).json();l(4,c=!1),l(5,f=Pt.success)}}async function _(Fe){l(2,a=!0);const tl=new FormData(Fe.target),Pt=new URLSearchParams;for(let ml of tl){const[Le,Zl]=ml;Pt.append(Le,Zl)}let Ni=await(await fetch("/save",{method:"POST",body:Pt})).json();Tt.update(ml=>(ml.booting=Ni.reboot,ml.ui=r.u,ml)),l(2,a=!1),Bn("/")}const h=function(){confirm("Are you sure you want to reboot the device?")&&(Tt.update(Fe=>(Fe.booting=!0,Fe)),Nm())},b=function(){r.q.s.e?r.q.p==1883&&l(3,r.q.p=8883,r):r.q.p==8883&&l(3,r.q.p=1883,r)};let d=44;function g(){r.g.h=this.value,l(3,r)}function $(){r.g.t=tt(this),l(3,r)}function k(){r.p.r=tt(this),l(3,r)}function T(){r.p.c=tt(this),l(3,r)}function P(){r.p.f=fe(this.value),l(3,r)}function E(){r.p.m=fe(this.value),l(3,r)}function S(){r.p.e=this.checked,l(3,r)}function N(){r.p.t=this.value,l(3,r)}function D(){r.g.s=tt(this),l(3,r)}function R(){r.g.u=this.value,l(3,r)}function W(){r.g.p=this.value,l(3,r)}function O(){r.m.b=tt(this),l(3,r)}function F(){r.m.p=tt(this),l(3,r)}function L(){r.m.i=this.checked,l(3,r)}function j(){r.m.d=tt(this),l(3,r)}function U(){r.m.f=fe(this.value),l(3,r)}function q(){r.m.r=fe(this.value),l(3,r)}function G(){r.m.e.e=this.checked,l(3,r)}function H(){r.m.e.k=this.value,l(3,r)}function V(){r.m.e.a=this.value,l(3,r)}function X(){r.m.m.e=this.checked,l(3,r)}function ne(){r.m.m.w=fe(this.value),l(3,r)}function le(){r.m.m.v=fe(this.value),l(3,r)}function _e(){r.m.m.a=fe(this.value),l(3,r)}function Te(){r.m.m.c=fe(this.value),l(3,r)}function ve(){r.w.s=this.value,l(3,r)}function qe(){r.w.p=this.value,l(3,r)}function be(){r.w.z=tt(this),l(3,r)}function Ee(){r.w.w=fe(this.value),l(3,r)}function he(){r.w.a=this.checked,l(3,r)}function Ne(){r.n.m=tt(this),l(3,r)}function pe(){r.n.i=this.value,l(3,r)}function me(){r.n.s=tt(this),l(3,r)}function se(){r.n.g=this.value,l(3,r)}function re(){r.n.d1=this.value,l(3,r)}function K(){r.n.d2=this.value,l(3,r)}function ae(){r.n.d=this.checked,l(3,r)}function Ae(){r.n.h=this.checked,l(3,r)}function te(){r.n.n1=this.value,l(3,r)}function ue(){r.q.s.e=this.checked,l(3,r)}function He(){r.q.h=this.value,l(3,r)}function Se(){r.q.p=fe(this.value),l(3,r)}function de(){r.q.u=this.value,l(3,r)}function De(){r.q.a=this.value,l(3,r)}function Oe(){r.q.c=this.value,l(3,r)}function ge(){r.q.m=tt(this),l(3,r)}function ke(){r.q.b=this.value,l(3,r)}function x(){r.o.e=this.value,l(3,r)}function oe(){r.o.c=this.value,l(3,r)}function Tl(){r.o.u1=this.value,l(3,r)}function _i(){r.o.u2=this.value,l(3,r)}function di(){r.o.u3=this.value,l(3,r)}function St(){r.h.t=this.value,l(3,r)}function vi(){r.h.h=this.value,l(3,r)}function Kl(){r.h.n=this.value,l(3,r)}function pl(Fe){r.t.t[Fe]=fe(this.value),l(3,r)}function Jt(){r.t.h=fe(this.value),l(3,r)}function hi(Fe){r.u[Fe.key]=tt(this),l(3,r)}function bi(){r.i.h.u=this.checked,l(3,r)}function gi(){r.i.h.p=tt(this),l(3,r)}function lt(){r.i.a=fe(this.value),l(3,r)}function ki(){r.i.l.i=this.checked,l(3,r)}function Xt(){r.i.l.p=fe(this.value),l(3,r)}function wi(){r.i.r.i=this.checked,l(3,r)}function yi(){r.i.r.r=fe(this.value),l(3,r)}function $i(){r.i.r.g=fe(this.value),l(3,r)}function nt(){r.i.r.b=fe(this.value),l(3,r)}function Ci(){r.i.t.d=fe(this.value),l(3,r)}function xt(){r.i.t.a=fe(this.value),l(3,r)}function Ql(){r.i.v.p=fe(this.value),l(3,r)}function dt(){r.i.v.d.v=fe(this.value),l(3,r)}function Ti(){r.i.v.d.g=fe(this.value),l(3,r)}function Si(){r.i.v.o=fe(this.value),l(3,r)}function Pi(){r.i.v.m=fe(this.value),l(3,r)}function el(){r.i.v.b=fe(this.value),l(3,r)}function Mi(){r.d.s=this.checked,l(3,r)}function Ai(){r.d.t=this.checked,l(3,r)}function Di(){r.d.l=tt(this),l(3,r)}return t.$$set=Fe=>{"sysinfo"in Fe&&l(0,n=Fe.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,d=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,a,r,c,f,d,i,m,_,h,b,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U,q,G,H,V,X,ne,le,_e,Te,ve,qe,be,Ee,he,Ne,pe,me,se,re,K,ae,Ae,te,ue,He,Se,de,De,Oe,ge,ke,x,oe,Tl,_i,di,St,vi,Kl,pl,Jt,hi,bi,gi,lt,ki,Xt,wi,yi,$i,nt,Ci,xt,Ql,dt,Ti,Si,Pi,el,Mi,Ai,Di]}class Em extends Ce{constructor(e){super(),$e(this,e,Im,Dm,ye,{sysinfo:0},null,[-1,-1,-1,-1])}}function uf(t,e,l){const n=t.slice();return n[20]=e[l],n}function Rm(t){let e=ce(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&2&&e!==(e=ce(n[1].chip,n[1].board)+"")&&B(l,e)},d(n){n&&w(l)}}}function rf(t){let e,l,n=t[1].apmac+"",i,o,a,r,c,f,m,_,h,b=Ur(t[1])+"",d,g,$=t[1].boot_reason+"",k,T,P;const E=[Lm,Fm],S=[];function N(D,R){return D[0].u>0?0:1}return c=N(t),f=S[c]=E[c](t),{c(){e=p("div"),l=C("AP MAC: "),i=C(n),o=v(),a=p("div"),r=C(`Last boot: + `),f.c(),m=v(),_=p("div"),h=C("Reason: "),d=C(b),g=C(" ("),k=C($),T=C(")"),u(e,"class","my-2"),u(a,"class","my-2"),u(_,"class","my-2")},m(D,R){y(D,e,R),s(e,l),s(e,i),y(D,o,R),y(D,a,R),s(a,r),S[c].m(a,null),y(D,m,R),y(D,_,R),s(_,h),s(_,d),s(_,g),s(_,k),s(_,T),P=!0},p(D,R){(!P||R&2)&&n!==(n=D[1].apmac+"")&&B(i,n);let W=c;c=N(D),c===W?S[c].p(D,R):(Pe(),I(S[W],1,1,()=>{S[W]=null}),Me(),f=S[c],f?f.p(D,R):(f=S[c]=E[c](D),f.c()),M(f,1),f.m(a,null)),(!P||R&2)&&b!==(b=Ur(D[1])+"")&&B(d,b),(!P||R&2)&&$!==($=D[1].boot_reason+"")&&B(k,$)},i(D){P||(M(f),P=!0)},o(D){I(f),P=!1},d(D){D&&w(e),D&&w(o),D&&w(a),S[c].d(),D&&w(m),D&&w(_)}}}function Fm(t){let e;return{c(){e=C("-")},m(l,n){y(l,e,n)},p:ie,i:ie,o:ie,d(l){l&&w(e)}}}function Lm(t){let e,l;return e=new vc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function qm(t){let e;return{c(){e=p("span"),e.textContent="Update consents",u(e,"class","btn-pri-sm")},m(l,n){y(l,e,n)},p:ie,d(l){l&&w(e)}}}function af(t){let e,l,n,i,o,a=hs(t[1].meter.mfg)+"",r,c,f,m,_=t[1].meter.model+"",h,b,d,g,$=t[1].meter.id+"",k;return{c(){e=p("div"),l=p("strong"),l.textContent="Meter",n=v(),i=p("div"),o=C("Manufacturer: "),r=C(a),c=v(),f=p("div"),m=C("Model: "),h=C(_),b=v(),d=p("div"),g=C("ID: "),k=C($),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(d,"class","my-2"),u(e,"class","cnt")},m(T,P){y(T,e,P),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(e,c),s(e,f),s(f,m),s(f,h),s(e,b),s(e,d),s(d,g),s(d,k)},p(T,P){P&2&&a!==(a=hs(T[1].meter.mfg)+"")&&B(r,a),P&2&&_!==(_=T[1].meter.model+"")&&B(h,_),P&2&&$!==($=T[1].meter.id+"")&&B(k,$)},d(T){T&&w(e)}}}function ff(t){let e,l,n,i,o,a=t[1].net.ip+"",r,c,f,m,_=t[1].net.mask+"",h,b,d,g,$=t[1].net.gw+"",k,T,P,E,S=t[1].net.dns1+"",N,D,R=t[1].net.dns2&&cf(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Network",n=v(),i=p("div"),o=C("IP: "),r=C(a),c=v(),f=p("div"),m=C("Mask: "),h=C(_),b=v(),d=p("div"),g=C("Gateway: "),k=C($),T=v(),P=p("div"),E=C("DNS: "),N=C(S),D=v(),R&&R.c(),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(d,"class","my-2"),u(P,"class","my-2"),u(e,"class","cnt")},m(W,O){y(W,e,O),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(e,c),s(e,f),s(f,m),s(f,h),s(e,b),s(e,d),s(d,g),s(d,k),s(e,T),s(e,P),s(P,E),s(P,N),s(P,D),R&&R.m(P,null)},p(W,O){O&2&&a!==(a=W[1].net.ip+"")&&B(r,a),O&2&&_!==(_=W[1].net.mask+"")&&B(h,_),O&2&&$!==($=W[1].net.gw+"")&&B(k,$),O&2&&S!==(S=W[1].net.dns1+"")&&B(N,S),W[1].net.dns2?R?R.p(W,O):(R=cf(W),R.c(),R.m(P,null)):R&&(R.d(1),R=null)},d(W){W&&w(e),R&&R.d()}}}function cf(t){let e,l=t[1].net.dns2+"",n;return{c(){e=C("/ "),n=C(l)},m(i,o){y(i,e,o),y(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&B(n,l)},d(i){i&&w(e),i&&w(n)}}}function pf(t){let e,l,n,i=t[2].tag_name+"",o,a,r,c,f,m,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name&&mf(t),h=t[1].fwconsent===2&&_f();return{c(){e=p("div"),l=C(`Latest version: + `),n=p("a"),o=C(i),r=v(),_&&_.c(),c=v(),h&&h.c(),f=We(),u(n,"href",a=t[2].html_url),u(n,"class","ml-2 text-blue-600 hover:text-blue-800"),u(n,"target","_blank"),u(n,"rel","noreferrer"),u(e,"class","my-2 flex")},m(b,d){y(b,e,d),s(e,l),s(e,n),s(n,o),s(e,r),_&&_.m(e,null),y(b,c,d),h&&h.m(b,d),y(b,f,d),m=!0},p(b,d){(!m||d&4)&&i!==(i=b[2].tag_name+"")&&B(o,i),(!m||d&4&&a!==(a=b[2].html_url))&&u(n,"href",a),(b[1].security==0||b[0].a)&&b[1].fwconsent===1&&b[2]&&b[2].tag_name?_?(_.p(b,d),d&7&&M(_,1)):(_=mf(b),_.c(),M(_,1),_.m(e,null)):_&&(Pe(),I(_,1,1,()=>{_=null}),Me()),b[1].fwconsent===2?h||(h=_f(),h.c(),h.m(f.parentNode,f)):h&&(h.d(1),h=null)},i(b){m||(M(_),m=!0)},o(b){I(_),m=!1},d(b){b&&w(e),_&&_.d(),b&&w(c),h&&h.d(b),b&&w(f)}}}function mf(t){let e,l,n,i,o,a;return n=new hc({}),{c(){e=p("div"),l=p("button"),J(n.$$.fragment),u(e,"class","flex-none ml-2 text-green-500"),u(e,"title","Install this version")},m(r,c){y(r,e,c),s(e,l),Q(n,l,null),i=!0,o||(a=z(l,"click",t[10]),o=!0)},p:ie,i(r){i||(M(n.$$.fragment,r),i=!0)},o(r){I(n.$$.fragment,r),i=!1},d(r){r&&w(e),Z(n),o=!1,a()}}}function _f(t){let e;return{c(){e=p("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',u(e,"class","my-2")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function df(t){let e,l=bs(ce(t[1].chip,t[1].board))+"",n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=bs(ce(i[1].chip,i[1].board))+"")&&B(n,l)},d(i){i&&w(e)}}}function vf(t){let e,l,n,i,o,a;function r(m,_){return m[4].length==0?Um:Om}let c=r(t),f=c(t);return{c(){e=p("div"),l=p("form"),n=p("input"),i=v(),f.c(),If(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","/firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(e,"class","my-2 flex")},m(m,_){y(m,e,_),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(a=[z(n,"change",t[13]),z(l,"submit",t[15])],o=!0)},p(m,_){c===(c=r(m))&&f?f.p(m,_):(f.d(1),f=c(m),f&&(f.c(),f.m(l,null)))},d(m){m&&w(e),t[12](null),f.d(),o=!1,Be(a)}}}function Om(t){let e=t[4][0].name+"",l,n,i;return{c(){l=C(e),n=v(),i=p("button"),i.textContent="Upload",u(i,"type","submit"),u(i,"class","btn-pri-sm float-right")},m(o,a){y(o,l,a),y(o,n,a),y(o,i,a)},p(o,a){a&16&&e!==(e=o[4][0].name+"")&&B(l,e)},d(o){o&&w(l),o&&w(n),o&&w(i)}}}function Um(t){let e,l,n;return{c(){e=p("button"),e.textContent="Select firmware file for upgrade",u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(i,o){y(i,e,o),l||(n=z(e,"click",t[14]),l=!0)},p:ie,d(i){i&&w(e),l=!1,n()}}}function hf(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g=t[9],$=[];for(let S=0;S Include Secrets
(SSID, PSK, passwords and tokens)',c=v(),k&&k.c(),f=v(),m=p("form"),_=p("input"),h=v(),E.c(),u(l,"class","text-sm"),u(r,"class","my-1 mx-3 col-span-2"),u(o,"class","grid grid-cols-2"),u(i,"method","get"),u(i,"action","/configfile.cfg"),u(i,"autocomplete","off"),If(_,"display","none"),u(_,"name","file"),u(_,"type","file"),u(_,"accept",".cfg"),u(m,"action","/configfile"),u(m,"enctype","multipart/form-data"),u(m,"method","post"),u(m,"autocomplete","off"),u(e,"class","cnt")},m(S,N){y(S,e,N),s(e,l),s(e,n),s(e,i),s(i,o);for(let D=0;D<$.length;D+=1)$[D].m(o,null);s(o,a),s(o,r),s(i,c),k&&k.m(i,null),s(e,f),s(e,m),s(m,_),t[16](_),s(m,h),E.m(m,null),b||(d=[z(_,"change",t[17]),z(m,"submit",t[19])],b=!0)},p(S,N){if(N&512){g=S[9];let D;for(D=0;D{pe=null}),Me());const Se={};ue&8388608&&(Se.$$scope={dirty:ue,ctx:te}),S.$set(Se),te[1].meter?me?me.p(te,ue):(me=af(te),me.c(),me.m(e,W)):me&&(me.d(1),me=null),te[1].net?se?se.p(te,ue):(se=ff(te),se.c(),se.m(e,O)):se&&(se.d(1),se=null),(!Ee||ue&2)&&G!==(G=te[1].version+"")&&B(H,G),te[2]?re?(re.p(te,ue),ue&4&&M(re,1)):(re=pf(te),re.c(),M(re,1),re.m(F,X)):re&&(Pe(),I(re,1,1,()=>{re=null}),Me()),ue&3&&(ne=(te[1].security==0||te[0].a)&&Yn(te[1].board)),ne?K?K.p(te,ue):(K=df(te),K.c(),K.m(F,le)):K&&(K.d(1),K=null),te[1].security==0||te[0].a?ae?ae.p(te,ue):(ae=vf(te),ae.c(),ae.m(F,null)):ae&&(ae.d(1),ae=null),te[1].security==0||te[0].a?Ae?Ae.p(te,ue):(Ae=hf(te),Ae.c(),Ae.m(e,null)):Ae&&(Ae.d(1),Ae=null);const de={};ue&32&&(de.active=te[5]),ve.$set(de);const De={};ue&256&&(De.active=te[8]),be.$set(De)},i(te){Ee||(M(h.$$.fragment,te),M(pe),M(S.$$.fragment,te),M(re),M(ve.$$.fragment,te),M(be.$$.fragment,te),Ee=!0)},o(te){I(h.$$.fragment,te),I(pe),I(S.$$.fragment,te),I(re),I(ve.$$.fragment,te),I(be.$$.fragment,te),Ee=!1},d(te){te&&w(e),Z(h),pe&&pe.d(),Z(S),me&&me.d(),se&&se.d(),re&&re.d(),K&&K.d(),ae&&ae.d(),Ae&&Ae.d(),te&&w(Te),Z(ve,te),te&&w(qe),Z(be,te),he=!1,Ne()}}}async function Gm(){await(await fetch("/reboot",{method:"POST"})).json()}function Bm(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],a={};_o.subscribe(D=>{l(2,a=dc(i.version,D)),a||l(2,a=D[0])});function r(){confirm("Do you want to upgrade this device to "+a.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(bs(ce(i.chip,i.board))))&&(Tt.update(D=>(D.upgrading=!0,D)),_c())}const c=function(){confirm("Are you sure you want to reboot the device?")&&(Tt.update(D=>(D.booting=!0,D)),Gm())};let f,m=[],_=!1,h,b=[],d=!1;co();function g(D){ds[D?"unshift":"push"](()=>{f=D,l(3,f)})}function $(){m=this.files,l(4,m)}const k=()=>{f.click()},T=()=>l(5,_=!0);function P(D){ds[D?"unshift":"push"](()=>{h=D,l(6,h)})}function E(){b=this.files,l(7,b)}const S=()=>{h.click()},N=()=>l(8,d=!0);return t.$$set=D=>{"data"in D&&l(0,n=D.data),"sysinfo"in D&&l(1,i=D.sysinfo)},[n,i,a,f,m,_,h,b,d,o,r,c,g,$,k,T,P,E,S,N]}class Ym extends Ce{constructor(e){super(),$e(this,e,Bm,Wm,ye,{data:0,sysinfo:1})}}function kf(t){let e,l,n=ce(t[0],7)+"",i,o,a=ce(t[0],5)+"",r,c,f=ce(t[0],4)+"",m,_,h=ce(t[0],3)+"",b,d,g,$,k=ce(t[0],2)+"",T,P,E=ce(t[0],1)+"",S,N,D=ce(t[0],0)+"",R,W,O,F,L=ce(t[0],101)+"",j,U,q=ce(t[0],100)+"",G;return{c(){e=p("optgroup"),l=p("option"),i=C(n),o=p("option"),r=C(a),c=p("option"),m=C(f),_=p("option"),b=C(h),d=v(),g=p("optgroup"),$=p("option"),T=C(k),P=p("option"),S=C(E),N=p("option"),R=C(D),W=v(),O=p("optgroup"),F=p("option"),j=C(L),U=p("option"),G=C(q),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,_.__value=3,_.value=_.__value,u(e,"label","amsleser.no"),$.__value=2,$.value=$.__value,P.__value=1,P.value=P.__value,N.__value=0,N.value=N.__value,u(g,"label","Custom hardware"),F.__value=101,F.value=F.__value,U.__value=100,U.value=U.__value,u(O,"label","Generic hardware")},m(H,V){y(H,e,V),s(e,l),s(l,i),s(e,o),s(o,r),s(e,c),s(c,m),s(e,_),s(_,b),y(H,d,V),y(H,g,V),s(g,$),s($,T),s(g,P),s(P,S),s(g,N),s(N,R),y(H,W,V),y(H,O,V),s(O,F),s(F,j),s(O,U),s(U,G)},p(H,V){V&1&&n!==(n=ce(H[0],7)+"")&&B(i,n),V&1&&a!==(a=ce(H[0],5)+"")&&B(r,a),V&1&&f!==(f=ce(H[0],4)+"")&&B(m,f),V&1&&h!==(h=ce(H[0],3)+"")&&B(b,h),V&1&&k!==(k=ce(H[0],2)+"")&&B(T,k),V&1&&E!==(E=ce(H[0],1)+"")&&B(S,E),V&1&&D!==(D=ce(H[0],0)+"")&&B(R,D),V&1&&L!==(L=ce(H[0],101)+"")&&B(j,L),V&1&&q!==(q=ce(H[0],100)+"")&&B(G,q)},d(H){H&&w(e),H&&w(d),H&&w(g),H&&w(W),H&&w(O)}}}function wf(t){let e,l,n=ce(t[0],201)+"",i,o,a=ce(t[0],202)+"",r,c,f=ce(t[0],203)+"",m,_,h=ce(t[0],200)+"",b;return{c(){e=p("optgroup"),l=p("option"),i=C(n),o=p("option"),r=C(a),c=p("option"),m=C(f),_=p("option"),b=C(h),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,_.__value=200,_.value=_.__value,u(e,"label","Generic hardware")},m(d,g){y(d,e,g),s(e,l),s(l,i),s(e,o),s(o,r),s(e,c),s(c,m),s(e,_),s(_,b)},p(d,g){g&1&&n!==(n=ce(d[0],201)+"")&&B(i,n),g&1&&a!==(a=ce(d[0],202)+"")&&B(r,a),g&1&&f!==(f=ce(d[0],203)+"")&&B(m,f),g&1&&h!==(h=ce(d[0],200)+"")&&B(b,h)},d(d){d&&w(e)}}}function yf(t){let e,l,n=ce(t[0],7)+"",i,o,a=ce(t[0],6)+"",r,c,f=ce(t[0],5)+"",m,_,h,b,d=ce(t[0],51)+"",g,$,k=ce(t[0],50)+"",T;return{c(){e=p("optgroup"),l=p("option"),i=C(n),o=p("option"),r=C(a),c=p("option"),m=C(f),_=v(),h=p("optgroup"),b=p("option"),g=C(d),$=p("option"),T=C(k),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,u(e,"label","amsleser.no"),b.__value=51,b.value=b.__value,$.__value=50,$.value=$.__value,u(h,"label","Generic hardware")},m(P,E){y(P,e,E),s(e,l),s(l,i),s(e,o),s(o,r),s(e,c),s(c,m),y(P,_,E),y(P,h,E),s(h,b),s(b,g),s(h,$),s($,T)},p(P,E){E&1&&n!==(n=ce(P[0],7)+"")&&B(i,n),E&1&&a!==(a=ce(P[0],6)+"")&&B(r,a),E&1&&f!==(f=ce(P[0],5)+"")&&B(m,f),E&1&&d!==(d=ce(P[0],51)+"")&&B(g,d),E&1&&k!==(k=ce(P[0],50)+"")&&B(T,k)},d(P){P&&w(e),P&&w(_),P&&w(h)}}}function $f(t){let e,l,n=ce(t[0],8)+"",i,o,a,r,c=ce(t[0],71)+"",f,m,_=ce(t[0],70)+"",h;return{c(){e=p("optgroup"),l=p("option"),i=C(n),o=v(),a=p("optgroup"),r=p("option"),f=C(c),m=p("option"),h=C(_),l.__value=8,l.value=l.__value,u(e,"label","Custom hardware"),r.__value=71,r.value=r.__value,m.__value=70,m.value=m.__value,u(a,"label","Generic hardware")},m(b,d){y(b,e,d),s(e,l),s(l,i),y(b,o,d),y(b,a,d),s(a,r),s(r,f),s(a,m),s(m,h)},p(b,d){d&1&&n!==(n=ce(b[0],8)+"")&&B(i,n),d&1&&c!==(c=ce(b[0],71)+"")&&B(f,c),d&1&&_!==(_=ce(b[0],70)+"")&&B(h,_)},d(b){b&&w(e),b&&w(o),b&&w(a)}}}function Cf(t){let e,l,n=ce(t[0],200)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=200,l.value=l.__value,u(e,"label","Generic hardware")},m(o,a){y(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=ce(o[0],200)+"")&&B(i,n)},d(o){o&&w(e)}}}function zm(t){let e,l,n,i,o,a,r,c=t[0]=="esp8266"&&kf(t),f=t[0]=="esp32"&&wf(t),m=t[0]=="esp32s2"&&yf(t),_=t[0]=="esp32c3"&&$f(t),h=t[0]=="esp32solo"&&Cf(t);return{c(){e=p("option"),l=v(),c&&c.c(),n=v(),f&&f.c(),i=v(),m&&m.c(),o=v(),_&&_.c(),a=v(),h&&h.c(),r=We(),e.__value=-1,e.value=e.__value},m(b,d){y(b,e,d),y(b,l,d),c&&c.m(b,d),y(b,n,d),f&&f.m(b,d),y(b,i,d),m&&m.m(b,d),y(b,o,d),_&&_.m(b,d),y(b,a,d),h&&h.m(b,d),y(b,r,d)},p(b,[d]){b[0]=="esp8266"?c?c.p(b,d):(c=kf(b),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),b[0]=="esp32"?f?f.p(b,d):(f=wf(b),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),b[0]=="esp32s2"?m?m.p(b,d):(m=yf(b),m.c(),m.m(o.parentNode,o)):m&&(m.d(1),m=null),b[0]=="esp32c3"?_?_.p(b,d):(_=$f(b),_.c(),_.m(a.parentNode,a)):_&&(_.d(1),_=null),b[0]=="esp32solo"?h?h.p(b,d):(h=Cf(b),h.c(),h.m(r.parentNode,r)):h&&(h.d(1),h=null)},i:ie,o:ie,d(b){b&&w(e),b&&w(l),c&&c.d(b),b&&w(n),f&&f.d(b),b&&w(i),m&&m.d(b),b&&w(o),_&&_.d(b),b&&w(a),h&&h.d(b),b&&w(r)}}}function Vm(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Km extends Ce{constructor(e){super(),$e(this,e,Vm,zm,ye,{chip:0})}}function Tf(t){let e;return{c(){e=p("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Sf(t){let e,l,n,i,o,a,r;return a=new kc({props:{chip:t[0].chip}}),{c(){e=p("div"),l=C("HAN GPIO"),n=p("br"),i=v(),o=p("select"),J(a.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(e,"class","my-3")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Q(a,o,null),r=!0},p(c,f){const m={};f&1&&(m.chip=c[0].chip),a.$set(m)},i(c){r||(M(a.$$.fragment,c),r=!0)},o(c){I(a.$$.fragment,c),r=!1},d(c){c&&w(e),Z(a)}}}function Qm(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U=t[0].usrcfg&&Tf();d=new Km({props:{chip:t[0].chip}});let q=t[0].board&&t[0].board>20&&Sf(t);return O=new gt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),o=v(),a=p("strong"),a.textContent="Initial configuration",r=v(),U&&U.c(),c=v(),f=p("div"),m=C("Board type"),_=p("br"),h=v(),b=p("select"),J(d.$$.fragment),g=v(),q&&q.c(),$=v(),k=p("div"),T=p("label"),P=p("input"),E=C(" Clear all other configuration"),S=v(),N=p("div"),N.innerHTML='',D=v(),R=p("span"),R.textContent="\xA0",W=v(),J(O.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(a,"class","text-sm"),u(b,"name","vb"),u(b,"class","in-s"),t[0].board===void 0&&Ye(()=>t[4].call(b)),u(f,"class","my-3"),u(P,"type","checkbox"),u(P,"name","vr"),P.__value="true",P.value=P.__value,u(P,"class","rounded mb-1"),u(k,"class","my-3"),u(N,"class","my-3"),u(R,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(G,H){y(G,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),U&&U.m(n,null),s(n,c),s(n,f),s(f,m),s(f,_),s(f,h),s(f,b),Q(d,b,null),Re(b,t[0].board),s(n,g),q&&q.m(n,null),s(n,$),s(n,k),s(k,T),s(T,P),P.checked=t[2],s(T,E),s(n,S),s(n,N),s(n,D),s(n,R),y(G,W,H),Q(O,G,H),F=!0,L||(j=[z(b,"change",t[4]),z(P,"change",t[5]),z(n,"submit",gs(t[3]))],L=!0)},p(G,[H]){G[0].usrcfg?U||(U=Tf(),U.c(),U.m(n,c)):U&&(U.d(1),U=null);const V={};H&1&&(V.chip=G[0].chip),d.$set(V),H&1&&Re(b,G[0].board),G[0].board&&G[0].board>20?q?(q.p(G,H),H&1&&M(q,1)):(q=Sf(G),q.c(),M(q,1),q.m(n,$)):q&&(Pe(),I(q,1,1,()=>{q=null}),Me()),H&4&&(P.checked=G[2]);const X={};H&2&&(X.active=G[1]),O.$set(X)},i(G){F||(M(d.$$.fragment,G),M(q),M(O.$$.fragment,G),F=!0)},o(G){I(d.$$.fragment,G),I(q),I(O.$$.fragment,G),F=!1},d(G){G&&w(e),U&&U.d(),Z(d),q&&q.d(),G&&w(W),Z(O,G),L=!1,Be(j)}}}function Zm(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(f){l(1,i=!0);const m=new FormData(f.target),_=new URLSearchParams;for(let d of m){const[g,$]=d;_.append(g,$)}let b=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),Tt.update(d=>(d.vndcfg=b.success,d.booting=b.reboot,d)),Bn(n.usrcfg?"/":"/setup")}let a=!1;function r(){n.board=tt(this),l(0,n)}function c(){a=this.checked,l(2,a),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,a=!n.usrcfg)},[n,i,a,o,r,c]}class Jm extends Ce{constructor(e){super(),$e(this,e,Zm,Qm,ye,{sysinfo:0})}}function Pf(t){let e,l,n,i,o,a,r,c;return r=new wc({}),{c(){e=p("br"),l=v(),n=p("div"),i=p("input"),o=v(),a=p("select"),J(r.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=t[1],u(a,"name","su"),u(a,"class","in-l"),a.required=t[1],u(n,"class","flex")},m(f,m){y(f,e,m),y(f,l,m),y(f,n,m),s(n,i),s(n,o),s(n,a),Q(r,a,null),c=!0},p(f,m){(!c||m&2)&&(i.required=f[1]),(!c||m&2)&&(a.required=f[1])},i(f){c||(M(r.$$.fragment,f),c=!0)},o(f){I(r.$$.fragment,f),c=!1},d(f){f&&w(e),f&&w(l),f&&w(n),Z(r)}}}function Mf(t){let e;return{c(){e=p("div"),e.innerHTML=`
Gateway
DNS
-
`,u(e,"class","my-3 flex")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Bm(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,H,F,L,G=t[1]&&gf(t),j=t[1]&&kf();return W=new gt({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),o=v(),a=p("strong"),a.textContent="Setup",r=v(),c=p("div"),c.innerHTML=`SSID
+
`,u(e,"class","my-3 flex")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Xm(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j=t[1]&&Pf(t),U=t[1]&&Mf();return W=new gt({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),o=v(),a=p("strong"),a.textContent="Setup",r=v(),c=p("div"),c.innerHTML=`SSID
`,f=v(),m=p("div"),m.innerHTML=`PSK
`,_=v(),h=p("div"),b=C(`Hostname - `),d=p("input"),g=v(),$=p("div"),k=p("label"),T=p("input"),P=C(" Static IP"),E=v(),G&&G.c(),S=v(),j&&j.c(),N=v(),D=p("div"),D.innerHTML='',R=v(),Z(W.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(a,"class","text-sm"),u(c,"class","my-3"),u(m,"class","my-3"),u(d,"name","sh"),u(d,"type","text"),u(d,"class","in-s"),u(d,"maxlength","32"),u(d,"pattern","[a-z0-9_-]+"),u(d,"placeholder","Optional, ex.: ams-reader"),u(d,"autocomplete","off"),u(T,"type","checkbox"),u(T,"name","sm"),T.__value="static",T.value=T.__value,u(T,"class","rounded mb-1"),u($,"class","my-3"),u(D,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(q,O){y(q,e,O),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),s(n,c),s(n,f),s(n,m),s(n,_),s(n,h),s(h,b),s(h,d),Y(d,t[0].hostname),s(n,g),s(n,$),s($,k),s(k,T),T.checked=t[1],s(k,P),s($,E),G&&G.m($,null),s(n,S),j&&j.m(n,null),s(n,N),s(n,D),y(q,R,O),K(W,q,O),H=!0,F||(L=[z(d,"input",t[4]),z(T,"change",t[5]),z(n,"submit",_s(t[3]))],F=!0)},p(q,[O]){O&1&&d.value!==q[0].hostname&&Y(d,q[0].hostname),O&2&&(T.checked=q[1]),q[1]?G?(G.p(q,O),O&2&&M(G,1)):(G=gf(q),G.c(),M(G,1),G.m($,null)):G&&(Pe(),I(G,1,1,()=>{G=null}),Me()),q[1]?j||(j=kf(),j.c(),j.m(n,N)):j&&(j.d(1),j=null);const U={};O&4&&(U.active=q[2]),W.$set(U)},i(q){H||(M(G),M(W.$$.fragment,q),H=!0)},o(q){I(G),I(W.$$.fragment,q),H=!1},d(q){q&&w(e),G&&G.d(),j&&j.d(),q&&w(R),Q(W,q),F=!1,Be(L)}}}function Ym(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,a=0;function r(){var _="";a++;var h=function(){setTimeout(r,1e3)};if(n.net.ip&&a%3==0){if(!n.net.ip){h();return}_="http://"+n.net.ip}else n.hostname&&a%3==1?_="http://"+n.hostname:n.hostname&&a%3==2?_="http://"+n.hostname+".local":_="";console&&console.log("Trying url "+_),Tt.update(d=>(d.trying=_,d));var b=new XMLHttpRequest;b.timeout=5e3,b.addEventListener("abort",h),b.addEventListener("error",h),b.addEventListener("timeout",h),b.addEventListener("load",function(d){window.location.href=_||"/"}),b.open("GET",_+"/is-alive",!0),b.send()}async function c(_){l(2,o=!0);const h=new FormData(_.target),b=new URLSearchParams;for(let $ of h){const[k,T]=$;b.append(k,T)}let g=await(await fetch("/save",{method:"POST",body:b})).json();l(2,o=!1),Tt.update($=>($.hostname=h.get("sh"),$.usrcfg=g.success,$.booting=g.reboot,i&&($.net.ip=h.get("si"),$.net.mask=h.get("su"),$.net.gw=h.get("sg"),$.net.dns1=h.get("sd")),setTimeout(r,5e3),$))}function f(){n.hostname=this.value,l(0,n)}function m(){i=this.checked,l(1,i)}return t.$$set=_=>{"sysinfo"in _&&l(0,n=_.sysinfo)},[n,i,o,c,f,m]}class zm extends $e{constructor(e){super(),ye(this,e,Ym,Bm,ke,{sysinfo:0})}}function Vm(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k;return d=new gt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=p("div"),l=p("div"),n=p("strong"),i=C("Upload "),o=C(t[1]),a=v(),r=p("p"),r.textContent="Select a suitable file and click upload",c=v(),f=p("form"),m=p("input"),_=v(),h=p("div"),h.innerHTML='',b=v(),Z(d.$$.fragment),u(r,"class","mb-4"),u(m,"name","file"),u(m,"type","file"),u(h,"class","w-full text-right mt-4"),u(f,"action",t[0]),u(f,"enctype","multipart/form-data"),u(f,"method","post"),u(f,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(T,P){y(T,e,P),s(e,l),s(l,n),s(n,i),s(n,o),s(l,a),s(l,r),s(l,c),s(l,f),s(f,m),s(f,_),s(f,h),y(T,b,P),K(d,T,P),g=!0,$||(k=z(f,"submit",t[3]),$=!0)},p(T,[P]){(!g||P&2)&&B(o,T[1]),(!g||P&1)&&u(f,"action",T[0]);const E={};P&4&&(E.active=T[2]),d.$set(E)},i(T){g||(M(d.$$.fragment,T),g=!0)},o(T){I(d.$$.fragment,T),g=!1},d(T){T&&w(e),T&&w(b),Q(d,T),$=!1,k()}}}function Km(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const a=()=>l(2,o=!0);return t.$$set=r=>{"action"in r&&l(0,n=r.action),"title"in r&&l(1,i=r.title)},[n,i,o,a]}class fo extends $e{constructor(e){super(),ye(this,e,Km,Vm,ke,{action:0,title:1})}}function Qm(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,H,F,L,G,j,q;return L=new gt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("div"),i.textContent="Various permissions we need to do stuff:",o=v(),a=p("hr"),r=v(),c=p("div"),f=C("Enable one-click upgrade? (implies data collection)"),m=p("br"),_=v(),h=p("a"),b=C("Read more"),d=p("br"),g=v(),$=p("label"),k=p("input"),P=C(" Yes"),E=p("label"),S=p("input"),D=C(" No"),R=p("br"),W=v(),H=p("div"),H.innerHTML='',F=v(),Z(L.$$.fragment),u(h,"href",Ct("Data-collection-on-one-click-firmware-upgrade")),u(h,"target","_blank"),u(h,"class","text-blue-600 hover:text-blue-800"),u(k,"type","radio"),u(k,"name","sf"),k.value=1,k.checked=T=t[0].fwconsent===1,u(k,"class","rounded m-2"),k.required=!0,u(S,"type","radio"),u(S,"name","sf"),S.value=2,S.checked=N=t[0].fwconsent===2,u(S,"class","rounded m-2"),S.required=!0,u(c,"class","my-3"),u(H,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(O,U){y(O,e,U),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),s(n,c),s(c,f),s(c,m),s(c,_),s(c,h),s(h,b),s(c,d),s(c,g),s(c,$),s($,k),s($,P),s(c,E),s(E,S),s(E,D),s(c,R),s(n,W),s(n,H),y(O,F,U),K(L,O,U),G=!0,j||(q=z(n,"submit",_s(t[2])),j=!0)},p(O,[U]){(!G||U&1&&T!==(T=O[0].fwconsent===1))&&(k.checked=T),(!G||U&1&&N!==(N=O[0].fwconsent===2))&&(S.checked=N);const x={};U&2&&(x.active=O[1]),L.$set(x)},i(O){G||(M(L.$$.fragment,O),G=!0)},o(O){I(L.$$.fragment,O),G=!1},d(O){O&&w(e),O&&w(F),Q(L,O),j=!1,q()}}}function Zm(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(a){l(1,i=!0);const r=new FormData(a.target),c=new URLSearchParams;for(let _ of r){const[h,b]=_;c.append(h,b)}let m=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),Tt.update(_=>(_.fwconsent=r.sf===!0?1:r.sf===!1?2:0,_.booting=m.reboot,_)),Hn("/")}return t.$$set=a=>{"sysinfo"in a&&l(0,n=a.sysinfo)},[n,i,o]}class Jm extends $e{constructor(e){super(),ye(this,e,Zm,Qm,ke,{sysinfo:0})}}function Xm(t){let e,l;return e=new Jp({props:{data:t[1],sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function xm(t){let e,l;return e=new Tm({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function e0(t){let e,l;return e=new qm({props:{sysinfo:t[0],data:t[1]}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function t0(t){let e,l;return e=new fo({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function l0(t){let e,l;return e=new fo({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function n0(t){let e,l;return e=new fo({props:{title:"private key",action:"/mqtt-key"}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function i0(t){let e,l;return e=new Jm({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function s0(t){let e,l;return e=new zm({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function o0(t){let e,l;return e=new Gm({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function u0(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E;return e=new cp({props:{data:t[1]}}),n=new al({props:{path:"/",$$slots:{default:[Xm]},$$scope:{ctx:t}}}),o=new al({props:{path:"/configuration",$$slots:{default:[xm]},$$scope:{ctx:t}}}),r=new al({props:{path:"/status",$$slots:{default:[e0]},$$scope:{ctx:t}}}),f=new al({props:{path:"/mqtt-ca",$$slots:{default:[t0]},$$scope:{ctx:t}}}),_=new al({props:{path:"/mqtt-cert",$$slots:{default:[l0]},$$scope:{ctx:t}}}),b=new al({props:{path:"/mqtt-key",$$slots:{default:[n0]},$$scope:{ctx:t}}}),g=new al({props:{path:"/consent",$$slots:{default:[i0]},$$scope:{ctx:t}}}),k=new al({props:{path:"/setup",$$slots:{default:[s0]},$$scope:{ctx:t}}}),P=new al({props:{path:"/vendor",$$slots:{default:[o0]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment),l=v(),Z(n.$$.fragment),i=v(),Z(o.$$.fragment),a=v(),Z(r.$$.fragment),c=v(),Z(f.$$.fragment),m=v(),Z(_.$$.fragment),h=v(),Z(b.$$.fragment),d=v(),Z(g.$$.fragment),$=v(),Z(k.$$.fragment),T=v(),Z(P.$$.fragment)},m(S,N){K(e,S,N),y(S,l,N),K(n,S,N),y(S,i,N),K(o,S,N),y(S,a,N),K(r,S,N),y(S,c,N),K(f,S,N),y(S,m,N),K(_,S,N),y(S,h,N),K(b,S,N),y(S,d,N),K(g,S,N),y(S,$,N),K(k,S,N),y(S,T,N),K(P,S,N),E=!0},p(S,N){const D={};N&2&&(D.data=S[1]),e.$set(D);const R={};N&7&&(R.$$scope={dirty:N,ctx:S}),n.$set(R);const W={};N&5&&(W.$$scope={dirty:N,ctx:S}),o.$set(W);const H={};N&7&&(H.$$scope={dirty:N,ctx:S}),r.$set(H);const F={};N&4&&(F.$$scope={dirty:N,ctx:S}),f.$set(F);const L={};N&4&&(L.$$scope={dirty:N,ctx:S}),_.$set(L);const G={};N&4&&(G.$$scope={dirty:N,ctx:S}),b.$set(G);const j={};N&5&&(j.$$scope={dirty:N,ctx:S}),g.$set(j);const q={};N&5&&(q.$$scope={dirty:N,ctx:S}),k.$set(q);const O={};N&5&&(O.$$scope={dirty:N,ctx:S}),P.$set(O)},i(S){E||(M(e.$$.fragment,S),M(n.$$.fragment,S),M(o.$$.fragment,S),M(r.$$.fragment,S),M(f.$$.fragment,S),M(_.$$.fragment,S),M(b.$$.fragment,S),M(g.$$.fragment,S),M(k.$$.fragment,S),M(P.$$.fragment,S),E=!0)},o(S){I(e.$$.fragment,S),I(n.$$.fragment,S),I(o.$$.fragment,S),I(r.$$.fragment,S),I(f.$$.fragment,S),I(_.$$.fragment,S),I(b.$$.fragment,S),I(g.$$.fragment,S),I(k.$$.fragment,S),I(P.$$.fragment,S),E=!1},d(S){Q(e,S),S&&w(l),Q(n,S),S&&w(i),Q(o,S),S&&w(a),Q(r,S),S&&w(c),Q(f,S),S&&w(m),Q(_,S),S&&w(h),Q(b,S),S&&w(d),Q(g,S),S&&w($),Q(k,S),S&&w(T),Q(P,S)}}}function r0(t){let e,l,n,i;const o=[c0,f0],a=[];function r(c,f){return c[0].trying?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e===m?a[e].p(c,f):(Pe(),I(a[m],1,1,()=>{a[m]=null}),Me(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function a0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function f0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function c0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){Z(e.$$.fragment)},m(n,i){K(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Q(e,n)}}}function p0(t){let e,l,n,i,o,a;l=new Vf({props:{$$slots:{default:[u0]},$$scope:{ctx:t}}});const r=[a0,r0],c=[];function f(m,_){return m[0].upgrading?0:m[0].booting?1:-1}return~(i=f(t))&&(o=c[i]=r[i](t)),{c(){e=p("div"),Z(l.$$.fragment),n=v(),o&&o.c(),u(e,"class","container mx-auto m-3")},m(m,_){y(m,e,_),K(l,e,null),s(e,n),~i&&c[i].m(e,null),a=!0},p(m,[_]){const h={};_&7&&(h.$$scope={dirty:_,ctx:m}),l.$set(h);let b=i;i=f(m),i===b?~i&&c[i].p(m,_):(o&&(Pe(),I(c[b],1,1,()=>{c[b]=null}),Me()),~i?(o=c[i],o?o.p(m,_):(o=c[i]=r[i](m),o.c()),M(o,1),o.m(e,null)):o=null)},i(m){a||(M(l.$$.fragment,m),M(o),a=!0)},o(m){I(l.$$.fragment,m),I(o),a=!1},d(m){m&&w(e),Q(l),~i&&c[i].d()}}}function m0(t,e,l){let n={};Tt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?Hn("/vendor"):n.usrcfg===!1?Hn("/setup"):n.fwconsent===0&&Hn("/consent")}),oo();let i={};return I1.subscribe(o=>{l(1,i=o)}),[n,i]}class _0 extends $e{constructor(e){super(),ye(this,e,m0,p0,ke,{})}}new _0({target:document.getElementById("app")}); + `),d=p("input"),g=v(),$=p("div"),k=p("label"),T=p("input"),P=C(" Static IP"),E=v(),j&&j.c(),S=v(),U&&U.c(),N=v(),D=p("div"),D.innerHTML='',R=v(),J(W.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(a,"class","text-sm"),u(c,"class","my-3"),u(m,"class","my-3"),u(d,"name","sh"),u(d,"type","text"),u(d,"class","in-s"),u(d,"maxlength","32"),u(d,"pattern","[a-z0-9_-]+"),u(d,"placeholder","Optional, ex.: ams-reader"),u(d,"autocomplete","off"),u(T,"type","checkbox"),u(T,"name","sm"),T.__value="static",T.value=T.__value,u(T,"class","rounded mb-1"),u($,"class","my-3"),u(D,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(q,G){y(q,e,G),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),s(n,c),s(n,f),s(n,m),s(n,_),s(n,h),s(h,b),s(h,d),Y(d,t[0].hostname),s(n,g),s(n,$),s($,k),s(k,T),T.checked=t[1],s(k,P),s($,E),j&&j.m($,null),s(n,S),U&&U.m(n,null),s(n,N),s(n,D),y(q,R,G),Q(W,q,G),O=!0,F||(L=[z(d,"input",t[4]),z(T,"change",t[5]),z(n,"submit",gs(t[3]))],F=!0)},p(q,[G]){G&1&&d.value!==q[0].hostname&&Y(d,q[0].hostname),G&2&&(T.checked=q[1]),q[1]?j?(j.p(q,G),G&2&&M(j,1)):(j=Pf(q),j.c(),M(j,1),j.m($,null)):j&&(Pe(),I(j,1,1,()=>{j=null}),Me()),q[1]?U||(U=Mf(),U.c(),U.m(n,N)):U&&(U.d(1),U=null);const H={};G&4&&(H.active=q[2]),W.$set(H)},i(q){O||(M(j),M(W.$$.fragment,q),O=!0)},o(q){I(j),I(W.$$.fragment,q),O=!1},d(q){q&&w(e),j&&j.d(),U&&U.d(),q&&w(R),Z(W,q),F=!1,Be(L)}}}function xm(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,a=0;function r(){var _="";a++;var h=function(){setTimeout(r,1e3)};if(n.net.ip&&a%3==0){if(!n.net.ip){h();return}_="http://"+n.net.ip}else n.hostname&&a%3==1?_="http://"+n.hostname:n.hostname&&a%3==2?_="http://"+n.hostname+".local":_="";console&&console.log("Trying url "+_),Tt.update(d=>(d.trying=_,d));var b=new XMLHttpRequest;b.timeout=5e3,b.addEventListener("abort",h),b.addEventListener("error",h),b.addEventListener("timeout",h),b.addEventListener("load",function(d){window.location.href=_||"/"}),b.open("GET",_+"/is-alive",!0),b.send()}async function c(_){l(2,o=!0);const h=new FormData(_.target),b=new URLSearchParams;for(let $ of h){const[k,T]=$;b.append(k,T)}let g=await(await fetch("/save",{method:"POST",body:b})).json();l(2,o=!1),Tt.update($=>($.hostname=h.get("sh"),$.usrcfg=g.success,$.booting=g.reboot,i&&($.net.ip=h.get("si"),$.net.mask=h.get("su"),$.net.gw=h.get("sg"),$.net.dns1=h.get("sd")),setTimeout(r,5e3),$))}function f(){n.hostname=this.value,l(0,n)}function m(){i=this.checked,l(1,i)}return t.$$set=_=>{"sysinfo"in _&&l(0,n=_.sysinfo)},[n,i,o,c,f,m]}class e0 extends Ce{constructor(e){super(),$e(this,e,xm,Xm,ye,{sysinfo:0})}}function t0(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k;return d=new gt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=p("div"),l=p("div"),n=p("strong"),i=C("Upload "),o=C(t[1]),a=v(),r=p("p"),r.textContent="Select a suitable file and click upload",c=v(),f=p("form"),m=p("input"),_=v(),h=p("div"),h.innerHTML='',b=v(),J(d.$$.fragment),u(r,"class","mb-4"),u(m,"name","file"),u(m,"type","file"),u(h,"class","w-full text-right mt-4"),u(f,"action",t[0]),u(f,"enctype","multipart/form-data"),u(f,"method","post"),u(f,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(T,P){y(T,e,P),s(e,l),s(l,n),s(n,i),s(n,o),s(l,a),s(l,r),s(l,c),s(l,f),s(f,m),s(f,_),s(f,h),y(T,b,P),Q(d,T,P),g=!0,$||(k=z(f,"submit",t[3]),$=!0)},p(T,[P]){(!g||P&2)&&B(o,T[1]),(!g||P&1)&&u(f,"action",T[0]);const E={};P&4&&(E.active=T[2]),d.$set(E)},i(T){g||(M(d.$$.fragment,T),g=!0)},o(T){I(d.$$.fragment,T),g=!1},d(T){T&&w(e),T&&w(b),Z(d,T),$=!1,k()}}}function l0(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const a=()=>l(2,o=!0);return t.$$set=r=>{"action"in r&&l(0,n=r.action),"title"in r&&l(1,i=r.title)},[n,i,o,a]}class vo extends Ce{constructor(e){super(),$e(this,e,l0,t0,ye,{action:0,title:1})}}function n0(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U,q;return L=new gt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("div"),i.textContent="Various permissions we need to do stuff:",o=v(),a=p("hr"),r=v(),c=p("div"),f=C("Enable one-click upgrade? (implies data collection)"),m=p("br"),_=v(),h=p("a"),b=C("Read more"),d=p("br"),g=v(),$=p("label"),k=p("input"),P=C(" Yes"),E=p("label"),S=p("input"),D=C(" No"),R=p("br"),W=v(),O=p("div"),O.innerHTML='',F=v(),J(L.$$.fragment),u(h,"href",Ct("Data-collection-on-one-click-firmware-upgrade")),u(h,"target","_blank"),u(h,"class","text-blue-600 hover:text-blue-800"),u(k,"type","radio"),u(k,"name","sf"),k.value=1,k.checked=T=t[0].fwconsent===1,u(k,"class","rounded m-2"),k.required=!0,u(S,"type","radio"),u(S,"name","sf"),S.value=2,S.checked=N=t[0].fwconsent===2,u(S,"class","rounded m-2"),S.required=!0,u(c,"class","my-3"),u(O,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(G,H){y(G,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),s(n,c),s(c,f),s(c,m),s(c,_),s(c,h),s(h,b),s(c,d),s(c,g),s(c,$),s($,k),s($,P),s(c,E),s(E,S),s(E,D),s(c,R),s(n,W),s(n,O),y(G,F,H),Q(L,G,H),j=!0,U||(q=z(n,"submit",gs(t[2])),U=!0)},p(G,[H]){(!j||H&1&&T!==(T=G[0].fwconsent===1))&&(k.checked=T),(!j||H&1&&N!==(N=G[0].fwconsent===2))&&(S.checked=N);const V={};H&2&&(V.active=G[1]),L.$set(V)},i(G){j||(M(L.$$.fragment,G),j=!0)},o(G){I(L.$$.fragment,G),j=!1},d(G){G&&w(e),G&&w(F),Z(L,G),U=!1,q()}}}function i0(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(a){l(1,i=!0);const r=new FormData(a.target),c=new URLSearchParams;for(let _ of r){const[h,b]=_;c.append(h,b)}let m=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),Tt.update(_=>(_.fwconsent=r.sf===!0?1:r.sf===!1?2:0,_.booting=m.reboot,_)),Bn("/")}return t.$$set=a=>{"sysinfo"in a&&l(0,n=a.sysinfo)},[n,i,o]}class s0 extends Ce{constructor(e){super(),$e(this,e,i0,n0,ye,{sysinfo:0})}}function o0(t){let e,l;return e=new sm({props:{data:t[1],sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function u0(t){let e,l;return e=new Em({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function r0(t){let e,l;return e=new Ym({props:{sysinfo:t[0],data:t[1]}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function a0(t){let e,l;return e=new vo({props:{title:"CA",action:"/mqtt-ca"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function f0(t){let e,l;return e=new vo({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function c0(t){let e,l;return e=new vo({props:{title:"private key",action:"/mqtt-key"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function p0(t){let e,l;return e=new s0({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function m0(t){let e,l;return e=new e0({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function _0(t){let e,l;return e=new Jm({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function d0(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E;return e=new gp({props:{data:t[1]}}),n=new fl({props:{path:"/",$$slots:{default:[o0]},$$scope:{ctx:t}}}),o=new fl({props:{path:"/configuration",$$slots:{default:[u0]},$$scope:{ctx:t}}}),r=new fl({props:{path:"/status",$$slots:{default:[r0]},$$scope:{ctx:t}}}),f=new fl({props:{path:"/mqtt-ca",$$slots:{default:[a0]},$$scope:{ctx:t}}}),_=new fl({props:{path:"/mqtt-cert",$$slots:{default:[f0]},$$scope:{ctx:t}}}),b=new fl({props:{path:"/mqtt-key",$$slots:{default:[c0]},$$scope:{ctx:t}}}),g=new fl({props:{path:"/consent",$$slots:{default:[p0]},$$scope:{ctx:t}}}),k=new fl({props:{path:"/setup",$$slots:{default:[m0]},$$scope:{ctx:t}}}),P=new fl({props:{path:"/vendor",$$slots:{default:[_0]},$$scope:{ctx:t}}}),{c(){J(e.$$.fragment),l=v(),J(n.$$.fragment),i=v(),J(o.$$.fragment),a=v(),J(r.$$.fragment),c=v(),J(f.$$.fragment),m=v(),J(_.$$.fragment),h=v(),J(b.$$.fragment),d=v(),J(g.$$.fragment),$=v(),J(k.$$.fragment),T=v(),J(P.$$.fragment)},m(S,N){Q(e,S,N),y(S,l,N),Q(n,S,N),y(S,i,N),Q(o,S,N),y(S,a,N),Q(r,S,N),y(S,c,N),Q(f,S,N),y(S,m,N),Q(_,S,N),y(S,h,N),Q(b,S,N),y(S,d,N),Q(g,S,N),y(S,$,N),Q(k,S,N),y(S,T,N),Q(P,S,N),E=!0},p(S,N){const D={};N&2&&(D.data=S[1]),e.$set(D);const R={};N&7&&(R.$$scope={dirty:N,ctx:S}),n.$set(R);const W={};N&5&&(W.$$scope={dirty:N,ctx:S}),o.$set(W);const O={};N&7&&(O.$$scope={dirty:N,ctx:S}),r.$set(O);const F={};N&4&&(F.$$scope={dirty:N,ctx:S}),f.$set(F);const L={};N&4&&(L.$$scope={dirty:N,ctx:S}),_.$set(L);const j={};N&4&&(j.$$scope={dirty:N,ctx:S}),b.$set(j);const U={};N&5&&(U.$$scope={dirty:N,ctx:S}),g.$set(U);const q={};N&5&&(q.$$scope={dirty:N,ctx:S}),k.$set(q);const G={};N&5&&(G.$$scope={dirty:N,ctx:S}),P.$set(G)},i(S){E||(M(e.$$.fragment,S),M(n.$$.fragment,S),M(o.$$.fragment,S),M(r.$$.fragment,S),M(f.$$.fragment,S),M(_.$$.fragment,S),M(b.$$.fragment,S),M(g.$$.fragment,S),M(k.$$.fragment,S),M(P.$$.fragment,S),E=!0)},o(S){I(e.$$.fragment,S),I(n.$$.fragment,S),I(o.$$.fragment,S),I(r.$$.fragment,S),I(f.$$.fragment,S),I(_.$$.fragment,S),I(b.$$.fragment,S),I(g.$$.fragment,S),I(k.$$.fragment,S),I(P.$$.fragment,S),E=!1},d(S){Z(e,S),S&&w(l),Z(n,S),S&&w(i),Z(o,S),S&&w(a),Z(r,S),S&&w(c),Z(f,S),S&&w(m),Z(_,S),S&&w(h),Z(b,S),S&&w(d),Z(g,S),S&&w($),Z(k,S),S&&w(T),Z(P,S)}}}function v0(t){let e,l,n,i;const o=[g0,b0],a=[];function r(c,f){return c[0].trying?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e===m?a[e].p(c,f):(Pe(),I(a[m],1,1,()=>{a[m]=null}),Me(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function h0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function b0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function g0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function k0(t){let e,l,n,i,o,a;l=new tc({props:{$$slots:{default:[d0]},$$scope:{ctx:t}}});const r=[h0,v0],c=[];function f(m,_){return m[0].upgrading?0:m[0].booting?1:-1}return~(i=f(t))&&(o=c[i]=r[i](t)),{c(){e=p("div"),J(l.$$.fragment),n=v(),o&&o.c(),u(e,"class","container mx-auto m-3")},m(m,_){y(m,e,_),Q(l,e,null),s(e,n),~i&&c[i].m(e,null),a=!0},p(m,[_]){const h={};_&7&&(h.$$scope={dirty:_,ctx:m}),l.$set(h);let b=i;i=f(m),i===b?~i&&c[i].p(m,_):(o&&(Pe(),I(c[b],1,1,()=>{c[b]=null}),Me()),~i?(o=c[i],o?o.p(m,_):(o=c[i]=r[i](m),o.c()),M(o,1),o.m(e,null)):o=null)},i(m){a||(M(l.$$.fragment,m),M(o),a=!0)},o(m){I(l.$$.fragment,m),I(o),a=!1},d(m){m&&w(e),Z(l),~i&&c[i].d()}}}function w0(t,e,l){let n={};Tt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?Bn("/vendor"):n.usrcfg===!1?Bn("/setup"):n.fwconsent===0&&Bn("/consent")}),co();let i={};return H1.subscribe(o=>{l(1,i=o)}),[n,i]}class y0 extends Ce{constructor(e){super(),$e(this,e,w0,k0,ye,{})}}new y0({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/AccountingData.svelte b/lib/SvelteUi/app/src/lib/AccountingData.svelte index 20afd3e0..4c8303f1 100644 --- a/lib/SvelteUi/app/src/lib/AccountingData.svelte +++ b/lib/SvelteUi/app/src/lib/AccountingData.svelte @@ -6,9 +6,11 @@ export let currency; export let hasExport; + let hasCost = false; let cols = 3 $: { cols = currency ? 3 : 2; + hasCost = data && data.h && (data.h.c || data.d.c || data.m.c || data.h.i || data.d.i || data.m.i); } @@ -22,25 +24,25 @@
Hour
{fmtnum(data.h.u,2)} kWh
- {#if currency}
{fmtnum(data.h.c,2)} {currency}
{/if} + {#if hasCost}
{fmtnum(data.h.c,2)} {currency}
{/if}
Day
{fmtnum(data.d.u,1)} kWh
- {#if currency}
{fmtnum(data.d.c,1)} {currency}
{/if} + {#if hasCost}
{fmtnum(data.d.c,1)} {currency}
{/if}
Month
{fmtnum(data.m.u)} kWh
- {#if currency}
{fmtnum(data.m.c)} {currency}
{/if} + {#if hasCost}
{fmtnum(data.m.c)} {currency}
{/if}
Export
Hour
{fmtnum(data.h.p,2)} kWh
- {#if currency}
{fmtnum(data.h.i,2)} {currency}
{/if} + {#if hasCost}
{fmtnum(data.h.i,2)} {currency}
{/if}
Day
{fmtnum(data.d.p,1)} kWh
- {#if currency}
{fmtnum(data.d.i,1)} {currency}
{/if} + {#if hasCost}
{fmtnum(data.d.i,1)} {currency}
{/if}
Month
{fmtnum(data.m.p)} kWh
- {#if currency}
{fmtnum(data.m.i)} {currency}
{/if} + {#if hasCost}
{fmtnum(data.m.i)} {currency}
{/if}
{:else} Consumption @@ -52,7 +54,7 @@
Month
{fmtnum(data.m.u)} kWh
- {#if currency} + {#if hasCost} Cost
Hour
diff --git a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte index eb209915..948be722 100644 --- a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte +++ b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte @@ -79,7 +79,7 @@ t: [0,0,0,0,0,0,0,0,0,0], h: 1 }, p: { - e: false, t: '', r: '', c: '', m: 1.0 + e: false, t: '', r: '', c: '', m: 1.0, f: null }, d: { s: false, t: false, l: 5 @@ -202,49 +202,57 @@
- Price region
- + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Currency
+ +
+
- Currency
- + Fixed price
+
Multiplier
diff --git a/lib/SvelteUi/app/src/lib/Dashboard.svelte b/lib/SvelteUi/app/src/lib/Dashboard.svelte index 649f089c..2cf1a637 100644 --- a/lib/SvelteUi/app/src/lib/Dashboard.svelte +++ b/lib/SvelteUi/app/src/lib/Dashboard.svelte @@ -37,7 +37,7 @@
- +
{data.mt ? metertype(data.mt) : '-'}
{data.ic ? data.ic.toFixed(1) : '-'} kWh
@@ -72,7 +72,7 @@ {/if} {#if uiVisibility(sysinfo.ui.c, data.ea)}
- 0 || data.e > 0}/> + 0 || data.e > 0}/>
{/if} {#if uiVisibility(sysinfo.ui.t, data.pr && (data.pr.startsWith("10YNO") || data.pr == '10Y1001A1001A48H'))} @@ -80,7 +80,7 @@
{/if} - {#if uiVisibility(sysinfo.ui.p, (typeof data.p == "number") && !Number.isNaN(data.p))} + {#if uiVisibility(sysinfo.ui.p, data.pe && !Number.isNaN(data.p))}
diff --git a/lib/SvelteUi/app/src/lib/DataStores.js b/lib/SvelteUi/app/src/lib/DataStores.js index 900f2ee3..b5895e0b 100644 --- a/lib/SvelteUi/app/src/lib/DataStores.js +++ b/lib/SvelteUi/app/src/lib/DataStores.js @@ -50,7 +50,7 @@ export const dataStore = readable(data, (set) => { lastTemp = data.t; setTimeout(getTemperatures, 2000); } - if(lastPrice != data.p) { + if(lastPrice != data.p && data.pe) { lastPrice = data.p; setTimeout(getPrices, 4000); } diff --git a/lib/SvelteUi/include/AmsWebServer.h b/lib/SvelteUi/include/AmsWebServer.h index bc576203..5053059e 100644 --- a/lib/SvelteUi/include/AmsWebServer.h +++ b/lib/SvelteUi/include/AmsWebServer.h @@ -38,7 +38,7 @@ public: void setTimezone(Timezone* tz); void setMqttEnabled(bool); void setEntsoeApi(EntsoeApi* eapi); - void setPriceRegion(String); + void setPriceSettings(String region, String currency); private: RemoteDebug* debugger; @@ -61,6 +61,7 @@ private: bool performUpgrade = false; bool rebootForUpgrade = false; String priceRegion = ""; + String priceCurrency = ""; #if defined(AMS2MQTT_FIRMWARE_URL) String customFirmwareUrl = AMS2MQTT_FIRMWARE_URL; #else diff --git a/lib/SvelteUi/json/conf_price.json b/lib/SvelteUi/json/conf_price.json index 124b4697..6fbfe63d 100644 --- a/lib/SvelteUi/json/conf_price.json +++ b/lib/SvelteUi/json/conf_price.json @@ -3,5 +3,6 @@ "t": "%s", "r": "%s", "c": "%s", - "m": %.3f + "m": %.3f, + "f": %s }, diff --git a/lib/SvelteUi/json/data.json b/lib/SvelteUi/json/data.json index 70e26461..9d167151 100644 --- a/lib/SvelteUi/json/data.json +++ b/lib/SvelteUi/json/data.json @@ -56,7 +56,9 @@ "i" : %.2f } }, + "pe" : %s, "pr" : "%s", + "pc" : "%s", "he" : %d, "ee" : %d, "c" : %lu, diff --git a/lib/SvelteUi/src/AmsWebServer.cpp b/lib/SvelteUi/src/AmsWebServer.cpp index 84636d52..87af55f8 100644 --- a/lib/SvelteUi/src/AmsWebServer.cpp +++ b/lib/SvelteUi/src/AmsWebServer.cpp @@ -413,9 +413,7 @@ void AmsWebServer::dataJson() { mqttStatus = 3; } - float price = ENTSOE_NO_VALUE; - if(eapi != NULL) - price = eapi->getValueForHour(0); + float price = ea->getPriceForHour(0); String peaks = ""; for(uint8_t i = 1; i <= ea->getConfig()->hours; i++) { @@ -475,7 +473,9 @@ void AmsWebServer::dataJson() { ea->getCostThisMonth(), ea->getProducedThisMonth(), ea->getIncomeThisMonth(), - eapi == NULL ? "" : priceRegion.c_str(), + eapi == NULL ? "false" : "true", + priceRegion.c_str(), + priceCurrency.c_str(), meterState->getLastError(), eapi == NULL ? 0 : eapi->getLastError(), (uint32_t) now, @@ -902,7 +902,8 @@ void AmsWebServer::configurationJson() { entsoe.token, entsoe.area, entsoe.currency, - entsoe.multiplier / 1000.0 + entsoe.multiplier / 1000.0, + entsoe.fixedPrice == 0 ? "null" : String(entsoe.fixedPrice / 1000.0, 10).c_str() ); server.sendContent(buf); snprintf_P(buf, BufferSize, CONF_DEBUG_JSON, @@ -1423,6 +1424,7 @@ void AmsWebServer::handleSave() { strcpy(entsoe.area, priceRegion.c_str()); strcpy(entsoe.currency, server.arg(F("pc")).c_str()); entsoe.multiplier = server.arg(F("pm")).toFloat() * 1000; + entsoe.fixedPrice = server.arg(F("pf")).toFloat() * 1000; config->setEntsoeConfig(entsoe); } @@ -1884,8 +1886,9 @@ void AmsWebServer::tariffJson() { server.send(200, MIME_JSON, buf); } -void AmsWebServer::setPriceRegion(String priceRegion) { - this->priceRegion = priceRegion; +void AmsWebServer::setPriceSettings(String region, String currency) { + this->priceRegion = region; + this->priceCurrency = currency; } void AmsWebServer::configFileDownload() { diff --git a/src/AmsToMqttBridge.ino b/src/AmsToMqttBridge.ino index 589293b9..4b0af920 100644 --- a/src/AmsToMqttBridge.ino +++ b/src/AmsToMqttBridge.ino @@ -172,7 +172,8 @@ void setup() { eapi->setup(entsoe); ws.setEntsoeApi(eapi); } - ws.setPriceRegion(entsoe.area); + ws.setPriceSettings(entsoe.area, entsoe.currency); + ea.setFixedPrice(entsoe.fixedPrice / 1000.0); bool shared = false; config.getMeterConfig(meterConfig); Serial.flush(); @@ -537,8 +538,9 @@ void loop() { eapi = NULL; ws.setEntsoeApi(NULL); } - ws.setPriceRegion(entsoe.area); + ws.setPriceSettings(entsoe.area, entsoe.currency); config.ackEntsoeChange(); + ea.setFixedPrice(entsoe.fixedPrice / 1000.0); } } catch(const std::exception& e) { debugE("Exception in ENTSO-E loop (%s)", e.what());