From 8ee8eee6c41c6bfec953860a02470dbab29e0abe Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Mon, 10 Apr 2023 14:14:20 +0200 Subject: [PATCH] Fixed laout error on realtime data --- lib/SvelteUi/app/dist/index.js | 18 +++++++++--------- lib/SvelteUi/app/src/lib/AccountingData.svelte | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index 2dd9c366..b61e307f 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 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 qs=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 Z(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 X(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(){X(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",Of=t=>typeof t=="number";function Lc(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function qf(){let t=0;return()=>t++}function Oc(){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:Ze(t,e).subscribe}}function Ze(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 qc(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 Xt(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=>Xt(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 Xc(t,e,l,n){const i=l&&Qc(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 r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).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=[],r=Math.max(e.dirty.length,i.length);for(let a=0;a32){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{r.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(r=>{r.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 qs=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 r=t[o],a=e[o];if(a){for(const c in r)c in a||(n[c]=1);for(const c in a)i[c]||(l[c]=a[c],i[c]=1);t[o]=a}else for(const c in r)i[c]=1}for(const r in n)r in l||(l[r]=void 0);return l}function Tr(t){return typeof t=="object"&&t!==null?t:{}}function Z(t){t&&t.c()}function Q(t,e,l,n){const{fragment:i,on_mount:o,on_destroy:r,after_update:a}=t.$$;i&&i.m(e,l),n||Ye(()=>{const c=o.map(Af).filter(Df);r?r.push(...c):Be(c),t.$$.on_mount=[]}),a.forEach(Ye)}function X(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(){X(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",Of=t=>typeof t=="number";function Lc(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function qf(){let t=0;return()=>t++}function Oc(){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:Ze(t,e).subscribe}}function Ze(t,e=ie){let l;const n=new Set;function i(a){if(ye(t,a)&&(t=a,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:r}}function qc(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return Hf(l,r=>{let a=!1;const c=[];let f=0,m=ie;const _=()=>{if(f)return;m();const b=e(n?c[0]:c,r);o?r(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 Xt(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=>Xt(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 Xc(t,e,l,n){const i=l&&Qc(n||t,l),o=i?` -Occurred in: ${i}`:"",a=ao(t),r=Lf(e)?e(a):e;return`<${a}> ${r}${o}`}const Qf=t=>(...e)=>t(Xc(...e)),Xf=Qf(t=>{throw new Error(t)}),vs=Qf(console.warn),Pr=4,Zc=3,Jc=2,xc=1,e1=1;function t1(t,e){const l=t.default?0:Xt(t.fullPath).reduce((n,i)=>{let o=n;return o+=Pr,jc(i)?o+=e1:Wc(i)?o+=Jc:Gf(i)?o-=Pr+xc:o+=Zc,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 Zf(t,e){let l,n;const[i]=e.split("?"),o=Xt(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=Xt(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=Xt(e,!0),r=Xt(l,!0);for(;a.length;)a[0]!==r[0]&&Xf(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=Xt(l,!0),i=Xt(e,!0).slice(0,n.length),o=Jf({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,Of(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:Oc()};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=Ze("");zt(t,R,le=>l(0,r=le));const W=E?E.disableInlineStyles:g,q=Ze([]);zt(t,q,le=>l(20,a=le));const F=Ze(null);zt(t,F,le=>l(18,i=le));let L=!1;const j=S?0:E.level+1,O=S?Ze((()=>Mr($l?fo(_):h.location,T))()):P;zt(t,O,le=>l(17,n=le));const G=Ze(n);zt(t,G,le=>l(19,o=le));const H=w1($,R,O),V=le=>_e=>_e.filter(Te=>Te.id!==le);function J(le){if($l){if(L)return;const _e=Jf(le,n.pathname);if(_e)return L=!0,_e}else q.update(_e=>{const Te=V(le.id)(_e);return Te.push(le),Te})}function ne(le){q.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),O.set(Te)})),ui(zs,O)),ui(Kn,{activeRoute:F,registerRoute:J,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=Zf(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,q,F,O,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)||Xf(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?qc(t,e=>e.base):Ze("/")}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=Of(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(){Z(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){X(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{X(m,1)}),Me()}o?(e=new o(a()),Z(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&&X(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=qf();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=Ze(null);let R;const W=Ze(),q=Ze({});zt(t,q,L=>l(4,f=L)),ui(jf,W),ui(Uc,q),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;q.set(L)}},e=ms(e),[b,g,n,r,f,$,P,E,S,N,q,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 O1(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 q1(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 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Or(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 qr(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=Ze(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=Ze(Qs);async function j1(){Qs=await(await Cl("/energyprice.json")).json(),uc.set(Qs)}let Xs={},Bl;async function po(){Bl&&(clearTimeout(Bl),Bl=0),Xs=await(await Cl("/dayplot.json")).json(),rc.set(Xs);let e=new Date;Bl=setTimeout(po,(60-e.getMinutes())*6e4+20)}const rc=Ze(Xs,t=>(po(),function(){}));let Zs={},Yl;async function mo(){Yl&&(clearTimeout(Yl),Yl=0),Zs=await(await Cl("/monthplot.json")).json(),ac.set(Zs);let e=new Date;Yl=setTimeout(mo,(24-e.getHours())*36e5+40)}const ac=Ze(Zs,t=>(mo(),function(){}));let Js={};async function fc(){Js=await(await Cl("/temperature.json")).json(),cc.set(Js)}const cc=Ze(Js,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=Ze(xs,t=>function(){});let eo=[];const _o=Ze(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?X1: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 X1(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 Z1(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 J1(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,J1,Z1,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()+1)}.${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()+1)}.${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: "+Or(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: "+Or(i[0].me))&&B(n,l)},d(i){i&&w(e)}}}function zr(t){let e,l="PriceAPI: "+qr(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: "+qr(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"),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),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),X(l),r&&w(n),r&&w(i),X(o)}}}function mp(t){let e,l;return e=new up({}),{c(){Z(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){X(e,n)}}}function _p(t){let e,l;return e=new ap({}),{c(){Z(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){X(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(),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),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),X(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,q,F,L,j,U,O,G,H,V,J,ne,le,_e,Te,ve,Oe,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);Oe=new $t({});let re=t[1].fwconsent===1&&t[2]&&Kr(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(),he&&he.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(),q=v(),pe&&pe.c(),F=v(),me&&me.c(),L=v(),j=p("div"),U=p("div"),O=p("a"),G=p("img"),V=v(),J=p("div"),Z(ne.$$.fragment),le=v(),se&&se.c(),_e=v(),Te=p("div"),ve=p("a"),Z(Oe.$$.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(O,"class","float-right"),u(O,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(O,"target","_blank"),u(O,"rel","noreferrer"),u(O,"aria-label","GitHub"),u(U,"class","flex-none"),u(J,"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,q),pe&&pe.m(l,null),s(l,F),me&&me.m(l,null),s(l,L),s(l,j),s(j,U),s(U,O),s(O,G),s(j,V),s(j,J),Q(ne,J,null),s(j,le),se&&se.m(j,null),s(j,_e),s(j,Te),s(Te,ve),Q(Oe,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,q)):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(Oe.$$.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(Oe.$$.fragment,K),I(re),Ee=!1},d(K){K&&w(e),X(i),X(c),he&&he.d(),X(T),X(E),X(N),X(R),Ne&&Ne.d(),pe&&pe.d(),me&&me.d(),X(ne),se&&se.d(),X(Oe),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 Xr(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]&&Xr(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),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=Xr(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),X(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 Zr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}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[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(){Z(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){X(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:O1(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(){Z(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){X(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,q,F,L,j,U=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",O,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"),q=v(),F=p("div"),F.textContent="Total out",L=v(),j=p("div"),O=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,q),s(P,F),s(P,L),s(P,j),s(j,O),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(O,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]?Op: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,q=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(),q&&q.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),q&&q.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]?q?q.p(F,L):(q=aa(F),q.c(),q.m(W.parentNode,W)):q&&(q.d(1),q=null)},d(F){F&&w(e),F&&w(l),F&&w(n),F&&w(R),q&&q.d(F),F&&w(W)}}}function Op(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,q,F,L,j,U,O,G,H,V,J=we(t[0].h.p,2)+"",ne,le,_e,Te,ve,Oe,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),qe=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"),q=v(),De&&De.c(),L=v(),j=p("strong"),j.textContent="Export",U=v(),O=p("div"),G=p("div"),G.textContent="Hour",H=v(),V=p("div"),ne=C(J),le=C(" kWh"),_e=v(),qe&&qe.c(),Te=v(),ve=p("div"),ve.textContent="Day",Oe=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(O,"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,q),De&&De.m(n,null),y(x,L,oe),y(x,j,oe),y(x,U,oe),y(x,O,oe),s(O,G),s(O,H),s(O,V),s(V,ne),s(V,le),s(O,_e),qe&&qe.m(O,null),s(O,Te),s(O,ve),s(O,Oe),s(O,be),s(be,he),s(be,Ne),s(O,pe),ge&&ge.m(O,null),s(O,me),s(O,se),s(O,re),s(O,K),s(K,Ae),s(K,te),s(O,ue),ke&&ke.m(O,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&&J!==(J=we(x[0].h.p,2)+"")&&B(ne,J),x[3]?qe?qe.p(x,oe):(qe=ma(x),qe.c(),qe.m(O,Te)):qe&&(qe.d(1),qe=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(O,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(O,null)):ke&&(ke.d(1),ke=null),oe&16&&He!==(He="grid grid-cols-"+x[4])&&u(O,"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(O),qe&&qe.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,q;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(),q=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,q)},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(q,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 qp(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,qp,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(),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),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),X(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(){Z(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){X(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 Xp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){Z(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){X(e,n)}}}function Zp(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 Jp extends Ce{constructor(e){super(),$e(this,e,Zp,Xp,ye,{json:1})}}function xp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){Z(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){X(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"),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),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),X(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:q1}}),{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),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),X(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"),Z(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),X(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"),Z(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),X(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"),Z(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),X(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"),Z(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),X(l)}}}function ya(t){let e,l,n;return l=new lm({}),{c(){e=p("div"),Z(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),X(l)}}}function $a(t){let e,l,n;return l=new Gp({props:{json:t[2]}}),{c(){e=p("div"),Z(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),X(l)}}}function Ca(t){let e,l,n;return l=new zp({props:{json:t[3]}}),{c(){e=p("div"),Z(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),X(l)}}}function Ta(t){let e,l,n;return l=new Qp({props:{json:t[4]}}),{c(){e=p("div"),Z(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),X(l)}}}function Sa(t){let e,l,n;return l=new Jp({props:{json:t[5]}}),{c(){e=p("div"),Z(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),X(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),q=a&&ba(t),F=c&&ga(t),L=m&&ka(t),j=h&&wa(t),U=d&&ya(),O=$&&$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(),q&&q.c(),r=v(),F&&F.c(),f=v(),L&&L.c(),_=v(),j&&j.c(),b=v(),U&&U.c(),g=v(),O&&O.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(J,ne){y(J,e,ne),R&&R.m(e,null),s(e,n),W&&W.m(e,null),s(e,o),q&&q.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),O&&O.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(J,[ne]){ne&3&&(l=je(J[1].ui.i,J[0].i)),l?R?(R.p(J,ne),ne&3&&M(R,1)):(R=va(J),R.c(),M(R,1),R.m(e,n)):R&&(Pe(),I(R,1,1,()=>{R=null}),Me()),ne&3&&(i=je(J[1].ui.e,J[0].om||J[0].e>0)),i?W?(W.p(J,ne),ne&3&&M(W,1)):(W=ha(J),W.c(),M(W,1),W.m(e,o)):W&&(Pe(),I(W,1,1,()=>{W=null}),Me()),ne&3&&(a=je(J[1].ui.v,J[0].u1>100||J[0].u2>100||J[0].u3>100)),a?q?(q.p(J,ne),ne&3&&M(q,1)):(q=ba(J),q.c(),M(q,1),q.m(e,r)):q&&(Pe(),I(q,1,1,()=>{q=null}),Me()),ne&3&&(c=je(J[1].ui.a,J[0].i1>.01||J[0].i2>.01||J[0].i3>.01)),c?F?(F.p(J,ne),ne&3&&M(F,1)):(F=ga(J),F.c(),M(F,1),F.m(e,f)):F&&(Pe(),I(F,1,1,()=>{F=null}),Me()),ne&3&&(m=je(J[1].ui.r,J[0].ri>0||J[0].re>0||J[0].ric>0||J[0].rec>0)),m?L?(L.p(J,ne),ne&3&&M(L,1)):(L=ka(J),L.c(),M(L,1),L.m(e,_)):L&&(Pe(),I(L,1,1,()=>{L=null}),Me()),ne&3&&(h=je(J[1].ui.c,J[0].ea)),h?j?(j.p(J,ne),ne&3&&M(j,1)):(j=wa(J),j.c(),M(j,1),j.m(e,b)):j&&(Pe(),I(j,1,1,()=>{j=null}),Me()),ne&3&&(d=je(J[1].ui.t,J[0].pr&&(J[0].pr.startsWith("10YNO")||J[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(J[1].ui.p,J[0].pe&&!Number.isNaN(J[0].p))),$?O?(O.p(J,ne),ne&3&&M(O,1)):(O=$a(J),O.c(),M(O,1),O.m(e,k)):O&&(Pe(),I(O,1,1,()=>{O=null}),Me()),ne&10&&(T=je(J[1].ui.d,J[3])),T?G?(G.p(J,ne),ne&10&&M(G,1)):(G=Ca(J),G.c(),M(G,1),G.m(e,P)):G&&(Pe(),I(G,1,1,()=>{G=null}),Me()),ne&18&&(E=je(J[1].ui.m,J[4])),E?H?(H.p(J,ne),ne&18&&M(H,1)):(H=Ta(J),H.c(),M(H,1),H.m(e,S)):H&&(Pe(),I(H,1,1,()=>{H=null}),Me()),ne&35&&(N=je(J[1].ui.s,J[0].t&&J[0].t!=-127&&J[5].c>1)),N?V?(V.p(J,ne),ne&35&&M(V,1)):(V=Sa(J),V.c(),M(V,1),V.m(e,null)):V&&(Pe(),I(V,1,1,()=>{V=null}),Me())},i(J){D||(M(R),M(W),M(q),M(F),M(L),M(j),M(U),M(O),M(G),M(H),M(V),D=!0)},o(J){I(R),I(W),I(q),I(F),I(L),I(j),I(U),I(O),I(G),I(H),I(V),D=!1},d(J){J&&w(e),R&&R.d(),W&&W.d(),q&&q.d(),F&&F.d(),L&&L.d(),j&&j.d(),U&&U.d(),O&&O.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=Ze(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(){Z(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){X(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(){Z(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){X(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(){Z(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){X(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(){Z(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){X(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,q,F,L,j,U,O,G;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"),q=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,q),s(R,F),Y(F,t[3].o.u2),s(R,L),s(R,j),Y(j,t[3].o.u3),U=!0,O||(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])],O=!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),X(o),O=!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,q,F,L,j;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(),q=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(q,"name","hn"),u(q,"type","text"),u(q,"class","in-s"),u(N,"class","my-1"),u(e,"class","cnt")},m(U,O){y(U,e,O),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,q),Y(q,t[3].h.n),F=!0,L||(j=[z(b,"input",t[64]),z(P,"input",t[65]),z(q,"input",t[66])],L=!0)},p(U,O){O[0]&8&&b.value!==U[3].h.t&&Y(b,U[3].h.t),(!F||O[0]&8&&E!==(E=U[3].g.h+".local"))&&u(P,"placeholder",E),O[0]&8&&P.value!==U[3].h.h&&Y(P,U[3].h.h),O[0]&8&&q.value!==U[3].h.n&&Y(q,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),X(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"),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),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),X(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,q,F,L,j,U,O,G,H,V,J,ne,le,_e,Te,ve,Oe,be,Ee,he,Ne,pe,me,se,re,K,ae,Ae,te,ue,He,Se,de,De,qe;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"),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"),q=v(),F=p("div"),L=p("input"),j=v(),U=p("div"),O=C("RGB"),G=p("label"),H=p("input"),V=C(" inverted"),J=p("br"),ne=v(),le=p("div"),_e=p("input"),Te=v(),ve=p("input"),Oe=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,q),s(E,F),s(F,L),Y(L,t[3].i.l.p),s(n,j),s(n,U),s(U,O),s(U,G),s(G,H),H.checked=t[3].i.r.i,s(G,V),s(U,J),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,Oe),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||(qe=[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),X(h),ge&&ge.d(),ke&&ke.d(),De=!1,Be(qe)}}}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,q,F,L,j,U,O,G,H,V,J,ne,le,_e,Te,ve,Oe,be,Ee,he,Ne,pe,me,se,re,K,ae,Ae,te,ue,He,Se,de,De,qe,ge,ke,x,oe,Tl,_i,di,St,vi,Kl,pl,Zt,hi,bi,gi,lt,ki,Jt,wi,yi,$i,nt,Ci,xt,Ql,dt,Ti,Si,Pi,el,Mi,Ai,Di,Fe,tl,Pt,Sl,Ni,ml,Le,Xl,ho,Zl,Jl,bo,Qn,go,xl,ws,ko,_l,Ht,dl,wo,Ii,yo,et,vl,$o,Ei,en,tn,ln,nn,Ri,Co,Xn,Mt,To,So,Pl,Po,Mo,Ao,jt,sn,on,Do,un,Ml,No,Io,Eo,rn,At,Ro,Fi,Fo,Al,Lo,Oo,qo,an,Dt,Uo,Li,Ho,ys,jo,Dl,Oi,Nt,Wo,Go,Bo,$s,qi,It,Yo,zo,Vo,xe,Ui,Ko,fn,cn,Qo,Zn,Xo,Nl,Zo,Jo,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,Je,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,Jn,Su,bl,Pu,xn,Ft,Mu,Au,Du,Xi,il,Nu,Ge,Zi,Iu,$n,Cn,Eu,ei,Ru,Gt,Fu,Ts,Lu,Ou,Tn,sl,qu,Lt,Uu,Ss,Ll,Hu,ju,Wu,ol,Gu,Ol,Bu,Yu,zu,ul,Vu,Sn,Pn,Ku,Qu,Xu,rl,Zu,Mn,Ju,xu,er,it,An,Dn,Nn,In,En,Rn,tr,ql,lr,nr,ir,al,sr,Ps,Ms,As=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Ds,Bt,Ji,or,Fn,Ln,ur,ti,rr,li,ar,Ns,bt,xi,fr,On,qn,cr,ni,pr,es,ts,Ot,mr,_r,dr,gl,Is,Un,vr,ls,Hn,hr,ns,Es,Ul,Rs,Hl,Fs,jl,Ls,Wl,qt,Os,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);Jl=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")&&Ja(t);qn=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"),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(),q=p("input"),F=v(),L=p("div"),j=p("div"),U=p("div"),O=C("Price region"),G=p("br"),H=v(),V=p("select"),J=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",Oe=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",qe=p("option"),qe.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"),Zt=p("div"),hi=C("Fixed price"),bi=p("br"),gi=v(),lt=p("input"),ki=v(),Jt=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"),Xl=p("strong"),Xl.textContent="Meter",ho=v(),Zl=p("a"),Z(Jl.$$.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(),Xn=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"),Oo=p("br"),qo=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"),Oi=p("label"),Nt=p("input"),Wo=C(" Meter is encrypted"),Go=v(),ut&&ut.c(),Bo=v(),rt&&rt.c(),$s=v(),qi=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"),Z(cn.$$.fragment),Qo=v(),Zn=p("input"),Xo=v(),Nl=p("div"),Zo=C("SSID"),Jo=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(),Je=p("div"),Gi=p("strong"),Gi.textContent="Network",vu=v(),bn=p("a"),Z(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"),Z(yn.$$.fragment),$u=v(),ft&&ft.c(),Cs=v(),Ki=p("div"),Qi=p("label"),Rt=p("input"),Cu=C(" enable mDNS"),Tu=v(),Jn=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(),Xi=p("div"),il=p("input"),Nu=v(),Ge=p("div"),Zi=p("strong"),Zi.textContent="MQTT",Iu=v(),$n=p("a"),Z(Cn.$$.fragment),Eu=v(),ei=p("input"),Ru=v(),Gt=p("div"),Fu=C(`Server - `),ct&&ct.c(),Ts=v(),Lu=p("br"),Ou=v(),Tn=p("div"),sl=p("input"),qu=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(),Ol=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"),Xu=v(),rl=p("input"),Zu=v(),Mn=p("div"),Ju=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(),ql=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"),Ji=p("strong"),Ji.textContent="User interface",or=v(),Fn=p("a"),Z(Ln.$$.fragment),ur=v(),ti=p("input"),rr=v(),li=p("div");for(let A=0;ASave',Es=v(),Z(Ul.$$.fragment),Rs=v(),Z(Hl.$$.fragment),Fs=v(),Z(jl.$$.fragment),Ls=v(),Z(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(q,"type","hidden"),u(q,"name","p"),q.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(J,"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(Oe,"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,qe.__value="10YNL----------L",qe.value=qe.__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(Zt,"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(Jt,"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(Xl,"class","text-sm"),u(Zl,"href",Ct("Meter-configuration")),u(Zl,"target","_blank"),u(Zl,"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(Xn,"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(Zn,"type","hidden"),u(Zn,"name","w"),Zn.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(Jn,"type","hidden"),u(Jn,"name","ntp"),Jn.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(Xi,"class","flex"),u(bl,"class","my-1"),u(Je,"class","cnt"),u(Zi,"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(Ol,"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(ql,"class","my-1"),u(Ge,"class","cnt"),u(Ji,"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(On,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(On,"target","_blank"),u(On,"class","float-right"),u(ni,"type","hidden"),u(ni,"name","d"),ni.value="true",u(Ot,"type","checkbox"),u(Ot,"name","ds"),Ot.__value="true",Ot.value=Ot.__value,u(Ot,"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,q),s(n,F),s(n,L),s(L,j),s(j,U),s(U,O),s(U,G),s(U,H),s(U,V),s(V,J),s(J,ne),s(J,le),s(J,_e),s(J,Te),s(J,ve),s(V,Oe),s(Oe,be),s(Oe,Ee),s(Oe,he),s(Oe,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,qe),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,Zt),s(Zt,hi),s(Zt,bi),s(Zt,gi),s(Zt,lt),Y(lt,t[3].p.f),s(pl,ki),s(pl,Jt),s(Jt,wi),s(Jt,yi),s(Jt,$i),s(Jt,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,Xl),s(Le,ho),s(Le,Zl),Q(Jl,Zl,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,Xn),s(Xn,Mt),Mt.checked=t[3].m.i,s(Xn,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,Oo),s(Al,qo),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,Oi),s(Oi,Nt),Nt.checked=t[3].m.e.e,s(Oi,Wo),s(Dl,Go),ut&&ut.m(Dl,null),s(Le,Bo),rt&&rt.m(Le,null),s(Le,$s),s(Le,qi),s(qi,It),It.checked=t[3].m.m.e,s(qi,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,Zn),s(xe,Xo),s(xe,Nl),s(Nl,Zo),s(Nl,Jo),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,Je),s(Je,Gi),s(Je,vu),s(Je,bn),Q(gn,bn,null),s(Je,hu),s(Je,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(Je,$u),ft&&ft.m(Je,null),s(Je,Cs),s(Je,Ki),s(Ki,Qi),s(Qi,Rt),Rt.checked=t[3].n.d,s(Qi,Cu),s(Je,Tu),s(Je,Jn),s(Je,Su),s(Je,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,Xi),s(Xi,il),Y(il,t[3].n.n1),s(l,Nu),s(l,Ge),s(Ge,Zi),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,Ou),s(Gt,Tn),s(Tn,sl),Y(sl,t[3].q.h),s(Tn,qu),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,Ol),s(Ol,Bu),s(Ol,Yu),s(Ol,zu),s(Ol,ul),Y(ul,t[3].q.a),s(Ge,Vu),s(Ge,Sn),s(Sn,Pn),s(Pn,Ku),s(Pn,Qu),s(Pn,Xu),s(Pn,rl),Y(rl,t[3].q.c),s(Sn,Zu),s(Sn,Mn),s(Mn,Ju),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,ql),s(ql,lr),s(ql,nr),s(ql,ir),s(ql,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,Ji),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),(!qt||ee[0]&8&&Ii!==(Ii=A[3].m.b!=0))&&(dl.disabled=Ii),ee[0]&8&&Re(Ht,A[3].m.b),(!qt||ee[0]&8&&Ei!==(Ei=A[3].m.b!=0))&&(vl.disabled=Ei),(!qt||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),(!qt||ee[0]&8&&Bi!==(Bi=A[3].n.m=="dhcp"))&&(vt.disabled=Bi),(!qt||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),(!qt||ee[0]&8&&zi!==(zi=A[3].n.m=="dhcp"))&&(ht.disabled=zi),(!qt||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(Je,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"?Xe?(Xe.p(A,ee),ee[0]&1&&M(Xe,1)):(Xe=Ja(A),Xe.c(),M(Xe,1),Xe.m(l,Ns)):Xe&&(Pe(),I(Xe,1,1,()=>{Xe=null}),Me()),ee[0]&8&&(Ot.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){qt||(M(r.$$.fragment,A),M(R.$$.fragment,A),M(Jl.$$.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(Xe),M(qn.$$.fragment,A),M(Ul.$$.fragment,A),M(Hl.$$.fragment,A),M(jl.$$.fragment,A),M(Wl.$$.fragment,A),qt=!0)},o(A){I(r.$$.fragment,A),I(R.$$.fragment,A),I(Jl.$$.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(Xe),I(qn.$$.fragment,A),I(Ul.$$.fragment,A),I(Hl.$$.fragment,A),I(jl.$$.fragment,A),I(Wl.$$.fragment,A),qt=!1},d(A){A&&w(e),X(r),X(R),Qt(is,A),st&&st.d(),ot&&ot.d(),X(Jl),Qt(ss,A),ut&&ut.d(),rt&&rt.d(),at&&at.d(),X(cn),X(gn),X(yn),ft&&ft.d(),X(Cn),ct&&ct.d(),ze&&ze.d(),Ve&&Ve.d(),Ke&&Ke.d(),Qe&&Qe.d(),X(Ln),Qt(pt,A),Xe&&Xe.d(),X(qn),mt&&mt.d(),A&&w(Es),X(Ul,A),A&&w(Rs),X(Hl,A),A&&w(Fs),X(jl,A),A&&w(Ls),X(Wl,A),Os=!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,Xl]=ml;Pt.append(Le,Xl)}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 q(){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 O(){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 J(){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 Oe(){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 qe(){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 Zt(){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 Jt(){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,q,F,L,j,U,O,G,H,V,J,ne,le,_e,Te,ve,Oe,be,Ee,he,Ne,pe,me,se,re,K,ae,Ae,te,ue,He,Se,de,De,qe,ge,ke,x,oe,Tl,_i,di,St,vi,Kl,pl,Zt,hi,bi,gi,lt,ki,Jt,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(){Z(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){X(e,n)}}}function Om(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,q){y(W,e,q),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,q){q&2&&a!==(a=W[1].net.ip+"")&&B(r,a),q&2&&_!==(_=W[1].net.mask+"")&&B(h,_),q&2&&$!==($=W[1].net.gw+"")&&B(k,$),q&2&&S!==(S=W[1].net.dns1+"")&&B(N,S),W[1].net.dns2?R?R.p(W,q):(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"),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),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),X(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:qm}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 qm(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,q)):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,J)):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),X(h),pe&&pe.d(),X(S),me&&me.d(),se&&se.d(),re&&re.d(),K&&K.d(),ae&&ae.d(),Ae&&Ae.d(),te&&w(Te),X(ve,te),te&&w(Oe),X(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,q,F,L=ce(t[0],101)+"",j,U,O=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(),q=p("optgroup"),F=p("option"),j=C(L),U=p("option"),G=C(O),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(q,"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,q,V),s(q,F),s(F,j),s(q,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&&O!==(O=ce(H[0],100)+"")&&B(G,O)},d(H){H&&w(e),H&&w(d),H&&w(g),H&&w(W),H&&w(q)}}}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"),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),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),X(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,q,F,L,j,U=t[0].usrcfg&&Tf();d=new Km({props:{chip:t[0].chip}});let O=t[0].board&&t[0].board>20&&Sf(t);return q=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"),Z(d.$$.fragment),g=v(),O&&O.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(q.$$.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),O&&O.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(q,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?O?(O.p(G,H),H&1&&M(O,1)):(O=Sf(G),O.c(),M(O,1),O.m(n,$)):O&&(Pe(),I(O,1,1,()=>{O=null}),Me()),H&4&&(P.checked=G[2]);const J={};H&2&&(J.active=G[1]),q.$set(J)},i(G){F||(M(d.$$.fragment,G),M(O),M(q.$$.fragment,G),F=!0)},o(G){I(d.$$.fragment,G),I(O),I(q.$$.fragment,G),F=!1},d(G){G&&w(e),U&&U.d(),X(d),O&&O.d(),G&&w(W),X(q,G),L=!1,Be(j)}}}function Xm(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 Zm extends Ce{constructor(e){super(),$e(this,e,Xm,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"),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),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),X(r)}}}function Mf(t){let e;return{c(){e=p("div"),e.innerHTML=`
Gateway
+Occurred in: ${i}`:"",r=ao(t),a=Lf(e)?e(r):e;return`<${r}> ${a}${o}`}const Qf=t=>(...e)=>t(Xc(...e)),Xf=Qf(t=>{throw new Error(t)}),vs=Qf(console.warn),Pr=4,Zc=3,Jc=2,xc=1,e1=1;function t1(t,e){const l=t.default?0:Xt(t.fullPath).reduce((n,i)=>{let o=n;return o+=Pr,jc(i)?o+=e1:Wc(i)?o+=Jc:Gf(i)?o-=Pr+xc:o+=Zc,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 Zf(t,e){let l,n;const[i]=e.split("?"),o=Xt(i),r=o[0]==="",a=l1(t);for(let c=0,f=a.length;c({...m,params:h,uri:k});if(m.default){n=b(e);continue}const d=Xt(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,r=Xt(e,!0),a=Xt(l,!0);for(;r.length;)r[0]!==a[0]&&Xf(zl,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),r.shift(),a.shift();return{pathname:pi(...a),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)):"",r=i?si(t,0,l):t,a=n?Ar(si(r,e)):"";return{pathname:(n?si(r,0,e):r)||"/",search:a,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=Xt(l,!0),i=Xt(e,!0).slice(0,n.length),o=Jf({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(r=>r({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const r=()=>{l=js(t),n=Hs,i([o])};i([o]);const a=Uf(t,"popstate",r);return()=>{a(),e=e.filter(c=>c!==o)}},navigate(o,r){const{state:a={},replace:c=!1}=r||{};if(n=c?r1:u1,Of(o))r&&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={...a,_key:Oc()};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:r,meta:a,params:c,uri:f}=cl.route,m=t.createAnnouncement({path:o,fullPath:r,meta:a,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=Ze("");zt(t,R,le=>l(0,a=le));const W=E?E.disableInlineStyles:g,q=Ze([]);zt(t,q,le=>l(20,r=le));const F=Ze(null);zt(t,F,le=>l(18,i=le));let L=!1;const j=S?0:E.level+1,O=S?Ze((()=>Mr($l?fo(_):h.location,T))()):P;zt(t,O,le=>l(17,n=le));const G=Ze(n);zt(t,G,le=>l(19,o=le));const H=w1($,R,O),V=le=>_e=>_e.filter(Te=>Te.id!==le);function J(le){if($l){if(L)return;const _e=Jf(le,n.pathname);if(_e)return L=!0,_e}else q.update(_e=>{const Te=V(le.id)(_e);return Te.push(le),Te})}function ne(le){q.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),O.set(Te)})),ui(zs,O)),ui(Kn,{activeRoute:F,registerRoute:J,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=Zf(r,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})},[a,$,S,N,D,R,W,q,F,O,G,m,_,h,b,d,g,n,i,o,r,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)||Xf(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?qc(t,e=>e.base):Ze("/")}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=Of(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(){Z(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){X(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 r(a){let c={};for(let f=0;f{X(m,1)}),Me()}o?(e=new o(r()),Z(e.$$.fragment),M(e.$$.fragment,1),Q(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(a){n||(e&&M(e.$$.fragment,a),n=!0)},o(a){e&&I(e.$$.fragment,a),n=!1},d(a){a&&w(l),e&&X(e,a)}}}function N1(t){let e,l,n,i;const o=[D1,A1],r=[];function a(c,f){return c[0]!==null?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){r[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=a(c),e===m?r[e].p(c,f):(Pe(),I(r[m],1,1,()=>{r[m]=null}),Me(),l=r[e],l?l.p(c,f):(l=r[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){r[e].d(c),c&&w(n)}}}function I1(t){let e,l,n,i,o,r=[Gn(t[7]),{"data-svnav-route-start":t[5]}],a={};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=qf();function R1(t,e,l){let n;const i=["path","component","meta","primary"];let o=_s(e,i),r,a,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,r=L));const S=ic();zt(t,S,L=>l(17,c=L));const N=lc();zt(t,N,L=>l(3,a=L));const D=Ze(null);let R;const W=Ze(),q=Ze({});zt(t,q,L=>l(4,f=L)),ui(jf,W),ui(Uc,q),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,a.pathname),primary:g,focusElement:D};W.set(U),l(15,R=k(U))}if(t.$$.dirty&98304&&l(2,n=!!(R||r&&r.id===$)),t.$$.dirty&98308&&n){const{params:L}=R||r;q.set(L)}},e=ms(e),[b,g,n,a,f,$,P,E,S,N,q,F,o,h,d,R,r,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,r=no(o,t,t[12],null);let a=[{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:r||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&&(r=fo(n)===i1(_)),t.$$.dirty&512&&l(2,a=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,a,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 O1(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 q1(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 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Or(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 qr(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=Ze(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=Ze(Qs);async function j1(){Qs=await(await Cl("/energyprice.json")).json(),uc.set(Qs)}let Xs={},Bl;async function po(){Bl&&(clearTimeout(Bl),Bl=0),Xs=await(await Cl("/dayplot.json")).json(),rc.set(Xs);let e=new Date;Bl=setTimeout(po,(60-e.getMinutes())*6e4+20)}const rc=Ze(Xs,t=>(po(),function(){}));let Zs={},Yl;async function mo(){Yl&&(clearTimeout(Yl),Yl=0),Zs=await(await Cl("/monthplot.json")).json(),ac.set(Zs);let e=new Date;Yl=setTimeout(mo,(24-e.getHours())*36e5+40)}const ac=Ze(Zs,t=>(mo(),function(){}));let Js={};async function fc(){Js=await(await Cl("/temperature.json")).json(),cc.set(Js)}const cc=Ze(Js,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=Ze(xs,t=>function(){});let eo=[];const _o=Ze(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]),r=[...e];r.reverse();let a,c,f;for(let m=0;mo&&(a=_):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||a||!1}else return e[0]}const G1="/github.svg";function Wr(t){let e,l;function n(r,a){return r[1]>1?X1:r[1]>0?Q1:r[2]>1?K1:r[2]>0?V1:r[3]>1?z1:r[3]>0?Y1:B1}let i=n(t),o=i(t);return{c(){e=C(`Up + `),o.c(),l=We()},m(r,a){y(r,e,a),o.m(r,a),y(r,l,a)},p(r,a){i===(i=n(r))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},d(r){r&&w(e),o.d(r),r&&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 X1(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 Z1(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 J1(t,e,l){let{epoch:n}=e,i=0,o=0,r=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,r=Math.floor(n/60)))},[n,i,o,r]}class x1 extends Ce{constructor(e){super(),$e(this,e,J1,Z1,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=r=>{"color"in r&&l(0,n=r.color),"title"in r&&l(1,i=r.title),"text"in r&&l(2,o=r.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()+1)}.${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()+1)}.${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(r,a){return a&1&&(e=null),e==null&&(e=Math.abs(new Date().getTime()-r[0].getTime())<3e5),e?np:lp}let i=n(t,-1),o=i(t);return{c(){o.c(),l=We()},m(r,a){o.m(r,a),y(r,l,a)},p(r,[a]){i===(i=n(r,a))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},i:ie,o:ie,d(r){o.d(r),r&&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,r){y(o,e,r),y(o,l,r),s(l,i)},p(o,r){r&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,r){y(o,e,r),s(e,n),s(e,i)},p(o,r){r&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: "+Or(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: "+Or(i[0].me))&&B(n,l)},d(i){i&&w(e)}}}function zr(t){let e,l="PriceAPI: "+qr(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: "+qr(i[0].ee))&&B(n,l)},d(i){i&&w(e)}}}function Vr(t){let e,l,n,i,o,r;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"),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(a,c){y(a,e,c),Q(l,e,null),y(a,n,c),y(a,i,c),Q(o,i,null),r=!0},i(a){r||(M(l.$$.fragment,a),M(o.$$.fragment,a),r=!0)},o(a){I(l.$$.fragment,a),I(o.$$.fragment,a),r=!1},d(a){a&&w(e),X(l),a&&w(n),a&&w(i),X(o)}}}function mp(t){let e,l;return e=new up({}),{c(){Z(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){X(e,n)}}}function _p(t){let e,l;return e=new ap({}),{c(){Z(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){X(e,n)}}}function Kr(t){let e,l,n,i,o;const r=[vp,dp],a=[];function c(f,m){return f[1].security==0||f[0].a?0:1}return l=c(t),n=a[l]=r[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),a[l].m(e,null),o=!0},p(f,m){let _=l;l=c(f),l===_?a[l].p(f,m):(Pe(),I(a[_],1,1,()=>{a[_]=null}),Me(),n=a[l],n?n.p(f,m):(n=a[l]=r[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),a[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,r){y(o,e,r),s(e,l),s(e,i)},p(o,r){r&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,r,a,c,f,m;return a=new hc({}),{c(){e=p("button"),l=p("span"),n=C("New version: "),o=C(i),r=v(),Z(a.$$.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,r),Q(a,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(a.$$.fragment,_),c=!0)},o(_){I(a.$$.fragment,_),c=!1},d(_){_&&w(e),X(a),f=!1,m()}}}function hp(t){let e,l,n,i,o,r,a,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,q,F,L,j,U,O,G,H,V,J,ne,le,_e,Te,ve,Oe,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);Oe=new $t({});let re=t[1].fwconsent===1&&t[2]&&Kr(t);return{c(){e=p("nav"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=v(),r=p("div"),a=p("div"),Z(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"),Z(T.$$.fragment),P=v(),Z(E.$$.fragment),S=v(),Z(N.$$.fragment),D=v(),Z(R.$$.fragment),W=v(),Ne&&Ne.c(),q=v(),pe&&pe.c(),F=v(),me&&me.c(),L=v(),j=p("div"),U=p("div"),O=p("a"),G=p("img"),V=v(),J=p("div"),Z(ne.$$.fragment),le=v(),se&&se.c(),_e=v(),Te=p("div"),ve=p("a"),Z(Oe.$$.fragment),be=v(),re&&re.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(a,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(r,"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(O,"class","float-right"),u(O,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(O,"target","_blank"),u(O,"rel","noreferrer"),u(O,"aria-label","GitHub"),u(U,"class","flex-none"),u(J,"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,r),s(r,a),Q(c,a,null),s(r,f),he&&he.m(r,null),s(r,m),s(r,_),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,q),pe&&pe.m(l,null),s(l,F),me&&me.m(l,null),s(l,L),s(l,j),s(j,U),s(U,O),s(O,G),s(j,V),s(j,J),Q(ne,J,null),s(j,le),se&&se.m(j,null),s(j,_e),s(j,Te),s(Te,ve),Q(Oe,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(r,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,q)):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(Oe.$$.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(Oe.$$.fragment,K),I(re),Ee=!1},d(K){K&&w(e),X(i),X(c),he&&he.d(),X(T),X(E),X(N),X(R),Ne&&Ne.d(),pe&&pe.d(),me&&me.d(),X(ne),se&&se.d(),X(Oe),re&&re.d()}}}function bp(t,e,l){let{data:n={}}=e,i={},o={};function r(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!Yn(i.board)||confirm(bs(ce(i.chip,i.board))))&&(Tt.update(a=>(a.upgrading=!0,a)),_c())}return Tt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&W1()}),_o.subscribe(a=>{l(2,o=dc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,r]}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,r){y(o,e,r),s(e,l),s(e,n)},p(o,[r]){r&1&&i!==(i=Gs(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),r&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),r=Qr(t,e,l,n),a=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,a,0,r.x,r.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 Xr(t){let e,l,n,i,o,r,a,c;return{c(){e=p("br"),l=v(),n=p("span"),i=C(t[3]),o=v(),r=p("span"),a=C(t[4]),c=C("/kWh"),u(n,"class","pl-sub"),u(r,"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,r,m),s(r,a),s(r,c)},p(f,m){m&8&&B(i,f[3]),m&16&&B(a,f[4])},d(f){f&&w(e),f&&w(l),f&&w(n),f&&w(o),f&&w(r)}}}function $p(t){let e,l,n,i,o,r,a,c,f,m,_,h,b,d,g,$;l=new yp({props:{pct:t[6],color:t[5](t[6])}});let k=t[3]&&Xr(t);return{c(){e=p("div"),Z(l.$$.fragment),n=v(),i=p("span"),o=p("span"),r=C(t[2]),a=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,r),s(i,a),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(r,T[2]),(!$||P&1)&&B(_,T[0]),(!$||P&2)&&B(d,T[1]),T[3]?k?k.p(T,P):(k=Xr(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),X(l),k&&k.d()}}}function Cp(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:r}=e,{sub:a=""}=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,r=_.label),"sub"in _&&l(3,a=_.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,r,a,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 Zr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}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[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,r,a,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",r=t[13].align=="right"?"85%":""),u(e,"class",a="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&&r!==(r=f[13].align=="right"?"85%":"")&&u(n,"x",r),m&1&&a!==(a="tick tick-"+f[13].value+" tick-"+f[13].color)&&u(e,"class",a),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,r;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",r="translate("+t[5](t[11])+","+t[4]+")")},m(a,c){y(a,e,c),s(e,l),s(l,i)},p(a,c){c&1&&n!==(n=a[9].label+"")&&B(i,n),c&8&&o!==(o=a[3]/2)&&u(l,"x",o),c&48&&r!==(r="translate("+a[5](a[11])+","+a[4]+")")&&u(e,"transform",r)},d(a){a&&w(e)}}}function na(t){let e,l,n,i,o,r,a,c=t[3]>15&&ia(t);return{c(){e=Ue("rect"),c&&c.c(),a=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",r=t[9].color)},m(f,m){y(f,e,m),c&&c.m(f,m),y(f,a,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&&r!==(r=f[9].color)&&u(e,"fill",r),f[3]>15?c?c.p(f,m):(c=ia(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(a)}}}function ia(t){let e,l=t[9].label+"",n,i,o,r,a,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",r=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",a=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&&r!==(r=m[3]-4)&&u(e,"width",r),_&8&&a!==(a=m[3]<25?"left":"middle")&&u(e,"text-anchor",a),_&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,r,a,c=t[3]>15&&oa(t);return{c(){e=Ue("rect"),c&&c.c(),a=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",r=t[9].color)},m(f,m){y(f,e,m),c&&c.m(f,m),y(f,a,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&&r!==(r=f[9].color)&&u(e,"fill",r),f[3]>15?c?c.p(f,m):(c=oa(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(a)}}}function oa(t){let e,l=t[9].label2+"",n,i,o,r,a,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,r){n&&n.m(o,r),y(o,e,r),i&&i.m(o,r),y(o,l,r)},p(o,r){o[9].value!==void 0?n?n.p(o,r):(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,r):(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,r,a,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,r=h/n.points.length),l(7,m=r<25?28:17);let b=(f-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,a=function(d){return d*r+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,r,f,a,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(){Z(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){X(e,n)}}}function Mp(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:r}=e,a={};function c(f){return{label:we(f)+"V",value:isNaN(f)?0:f,color:O1(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,r=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],m=[];n>0&&(f.push({label:r===1?"L1-L2":"L1"}),m.push(c(n))),i>0&&(f.push({label:r===1?"L1-L3":"L2"}),m.push(c(i))),o>0&&(f.push({label:r===1?"L2-L3":"L3"}),m.push(c(o))),l(0,a={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})}},[a,n,i,o,r]}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(){Z(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){X(e,n)}}}function Np(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:r}=e,{i2:a}=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,r=h.i1),"i2"in h&&l(5,a=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(_(r))),i>0&&(h.push({label:"L2"}),b.push(_(a))),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,r,a,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,r,a,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,q,F,L,j,U=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",O,G;return{c(){e=p("div"),l=p("strong"),l.textContent="Reactive",n=v(),i=p("div"),o=p("div"),o.textContent="Instant in",r=v(),a=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"),q=v(),F=p("div"),F.textContent="Total out",L=v(),j=p("div"),O=C(U),G=C(" kVArh"),u(a,"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,r),s(i,a),s(a,f),s(a,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,q),s(P,F),s(P,L),s(P,j),s(j,O),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(O,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:r}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,r=a.exportTotal)},[n,i,o,r]}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,r){return o[2]?Op:Lp}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,r){i.m(o,r),y(o,e,r)},p(o,r){n===(n=l(o))&&i?i.p(o,r):(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,r,a=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,q=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(),r=p("div"),c=C(a),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(),q&&q.c(),W=We(),u(r,"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,r),s(r,c),s(r,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),q&&q.m(F,L),y(F,W,L)},p(F,L){L&1&&a!==(a=we(F[0].h.u,2)+"")&&B(c,a),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]?q?q.p(F,L):(q=aa(F),q.c(),q.m(W.parentNode,W)):q&&(q.d(1),q=null)},d(F){F&&w(e),F&&w(l),F&&w(n),F&&w(R),q&&q.d(F),F&&w(W)}}}function Op(t){let e,l,n,i,o,r,a=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,q,F,L,j,U,O,G,H,V,J=we(t[0].h.p,2)+"",ne,le,_e,Te,ve,Oe,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),qe=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(),r=p("div"),c=C(a),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"),q=v(),De&&De.c(),L=v(),j=p("strong"),j.textContent="Export",U=v(),O=p("div"),G=p("div"),G.textContent="Hour",H=v(),V=p("div"),ne=C(J),le=C(" kWh"),_e=v(),qe&&qe.c(),Te=v(),ve=p("div"),ve.textContent="Day",Oe=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(r,"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(O,"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,r),s(r,c),s(r,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,q),De&&De.m(n,null),y(x,L,oe),y(x,j,oe),y(x,U,oe),y(x,O,oe),s(O,G),s(O,H),s(O,V),s(V,ne),s(V,le),s(O,_e),qe&&qe.m(O,null),s(O,Te),s(O,ve),s(O,Oe),s(O,be),s(be,he),s(be,Ne),s(O,pe),ge&&ge.m(O,null),s(O,me),s(O,se),s(O,re),s(O,K),s(K,Ae),s(K,te),s(O,ue),ke&&ke.m(O,null)},p(x,oe){oe&1&&a!==(a=we(x[0].h.u,2)+"")&&B(c,a),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&&J!==(J=we(x[0].h.p,2)+"")&&B(ne,J),x[3]?qe?qe.p(x,oe):(qe=ma(x),qe.c(),qe.m(O,Te)):qe&&(qe.d(1),qe=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(O,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(O,null)):ke&&(ke.d(1),ke=null),oe&16&&He!==(He="grid grid-cols-"+x[4])&&u(O,"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(O),qe&&qe.d(),ge&&ge.d(),ke&&ke.d()}}}function aa(t){let e,l,n,i,o,r,a=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,q;return{c(){e=p("strong"),e.textContent="Cost",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),r=p("div"),c=C(a),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(),q=C(t[1]),u(r,"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,r),s(r,c),s(r,f),s(r,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,q)},p(F,L){L&1&&a!==(a=we(F[0].h.c,2)+"")&&B(c,a),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(q,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(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=we(r[0].h.c,2)+"")&&B(n,l),a&2&&B(o,r[1])},d(r){r&&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(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=we(r[0].d.c,1)+"")&&B(n,l),a&2&&B(o,r[1])},d(r){r&&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(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=we(r[0].m.c)+"")&&B(n,l),a&2&&B(o,r[1])},d(r){r&&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(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=we(r[0].h.i,2)+"")&&B(n,l),a&2&&B(o,r[1])},d(r){r&&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(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=we(r[0].d.i,1)+"")&&B(n,l),a&2&&B(o,r[1])},d(r){r&&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(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=we(r[0].m.i)+"")&&B(n,l),a&2&&B(o,r[1])},d(r){r&&w(e)}}}function qp(t){let e,l,n,i,o,r,a=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"),r=v(),a&&a.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,r),a&&a.m(e,null)},p(c,[f]){c[0]?a?a.p(c,f):(a=ra(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:ie,o:ie,d(c){c&&w(e),a&&a.d()}}}function Up(t,e,l){let{data:n}=e,{currency:i}=e,{hasExport:o}=e,r=!1,a=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&9&&(l(3,r=n&&n.h&&(n.h.c||n.d.c||n.m.c||n.h.i||n.d.i||n.m.i)),l(4,a=r?3:2))},[n,i,o,r,a]}class Hp extends Ce{constructor(e){super(),$e(this,e,Up,qp,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(),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,r){y(o,e,r),y(o,l,r),Q(n,o,r),i=!0},p(o,[r]){const a={};r&1&&(a.config=o[0]),n.$set(a)},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),X(n,o)}}}function Wp(t,e,l){let{json:n}=e,i={},o=0,r=0;return t.$$set=a=>{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=new Date().getUTCHours(),c=0,f=0,m=0,_=n[20]==null?2:1,h=[],b=[],d=[],g=new Date;for(c=a;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,r=Math.min(r,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,r=Math.min(r,f*100)),l(2,o=Math.max(o,f*100)),ri(g,1);if(l(2,o=Math.ceil(o)),l(3,r=Math.floor(r)),r<0){let k=r/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:r,max:o,ticks:h},x:{ticks:b},points:d})}},[i,n,o,r]}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(){Z(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){X(e,n)}}}function Yp(t,e,l){let{json:n}=e,i={},o=0,r=0;return t.$$set=a=>{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=[],f=[],m=[],_=ri(new Date,-24),h=new Date().getUTCHours();for(a=h;a<24;a++){let g=n["i"+Ie(a)],$=n["e"+Ie(a)];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,r=Math.max(r,$*10)),l(2,o=Math.max(o,g*10)),ri(_,1)}for(a=0;a{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=[],f=[],m=[],_=new Date,h=new Date;for(h.setDate(0),a=_.getDate();a<=h.getDate();a++){let g=n["i"+Ie(a)],$=n["e"+Ie(a)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(a)}),m.push({label:g.toFixed(0),value:g,label2:$.toFixed(0),value2:$,color:"#7c3aed"}),l(3,r=Math.max(r,$)),l(2,o=Math.max(o,g))}for(a=1;a<_.getDate();a++){let g=n["i"+Ie(a)],$=n["e"+Ie(a)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(a)}),m.push({label:g.toFixed(0),value:g,label2:$.toFixed(0),value2:$,color:"#7c3aed"}),l(3,r=Math.max(r,$)),l(2,o=Math.max(o,g))}let b=Math.ceil(Math.max(r,o)/10)*10;if(l(2,o=b),l(3,r=r==0?0:b*-1),r<0){let g=r/4;for(a=0;a<5;a++){let $=g*a;c.push({value:$,label:$.toFixed(0)})}}let d=o/4;for(a=0;a<5;a++){let g=d*a;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:r,max:o,ticks:c},x:{ticks:f},points:m})}},[i,n,o,r]}class Qp extends Ce{constructor(e){super(),$e(this,e,Kp,Vp,ye,{json:1})}}function Xp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){Z(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){X(e,n)}}}function Zp(t,e,l){let{json:n}=e,i={},o=0,r=0;return t.$$set=a=>{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=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,r=Math.min(r,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,r=Math.floor(r));let h=o;r<0&&(h+=Math.abs(r));let b=h/4;for(a=0;a<5;a++)c=r+b*a,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:r,max:o,ticks:f},x:{ticks:m},points:_})}},[i,n,o,r]}class Jp extends Ce{constructor(e){super(),$e(this,e,Zp,Xp,ye,{json:1})}}function xp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){Z(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){X(e,n)}}}let em=0;function tm(t,e,l){let n={},i=0,o;return mc.subscribe(r=>{l(2,o=r)}),pc(),t.$$.update=()=>{if(t.$$.dirty&6){let r=0,a=[],c=[],f=[];if(a.push({value:0,label:0}),o&&o.p)for(r=0;r0?Ie(m.d)+"."+Ks[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,m.v))}if(o&&o.t){for(r=0;r=i)break;a.push({value:m,label:m})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.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:a},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,r,a=(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"),Z(i.$$.fragment),o=v(),r=p("div"),c=C(a),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,r),s(r,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)&&a!==(a=(g[0].mt?hs(g[0].mt):"-")+"")&&B(c,a),(!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),X(i)}}}function ha(t){let e,l,n,i,o,r,a,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:q1}}),{c(){e=p("div"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=v(),r=p("div"),a=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,r),s(l,a),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),X(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"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.ds=i[0].ds),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),X(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"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.i1=i[0].i1),o&1&&(r.i2=i[0].i2),o&1&&(r.i3=i[0].i3),o&1&&(r.max=i[0].mf?i[0].mf:32),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),X(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"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.importInstant=i[0].ri),o&1&&(r.exportInstant=i[0].re),o&1&&(r.importTotal=i[0].ric),o&1&&(r.exportTotal=i[0].rec),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),X(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"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.data=i[0].ea),o&1&&(r.currency=i[0].pc),o&1&&(r.hasExport=i[0].om>0||i[0].e>0),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),X(l)}}}function ya(t){let e,l,n;return l=new lm({}),{c(){e=p("div"),Z(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),X(l)}}}function $a(t){let e,l,n;return l=new Gp({props:{json:t[2]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&4&&(r.json=i[2]),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),X(l)}}}function Ca(t){let e,l,n;return l=new zp({props:{json:t[3]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&8&&(r.json=i[3]),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),X(l)}}}function Ta(t){let e,l,n;return l=new Qp({props:{json:t[4]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&16&&(r.json=i[4]),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),X(l)}}}function Sa(t){let e,l,n;return l=new Jp({props:{json:t[5]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&32&&(r.json=i[5]),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),X(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,r=je(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,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),q=r&&ba(t),F=c&&ga(t),L=m&&ka(t),j=h&&wa(t),U=d&&ya(),O=$&&$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(),q&&q.c(),a=v(),F&&F.c(),f=v(),L&&L.c(),_=v(),j&&j.c(),b=v(),U&&U.c(),g=v(),O&&O.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(J,ne){y(J,e,ne),R&&R.m(e,null),s(e,n),W&&W.m(e,null),s(e,o),q&&q.m(e,null),s(e,a),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),O&&O.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(J,[ne]){ne&3&&(l=je(J[1].ui.i,J[0].i)),l?R?(R.p(J,ne),ne&3&&M(R,1)):(R=va(J),R.c(),M(R,1),R.m(e,n)):R&&(Pe(),I(R,1,1,()=>{R=null}),Me()),ne&3&&(i=je(J[1].ui.e,J[0].om||J[0].e>0)),i?W?(W.p(J,ne),ne&3&&M(W,1)):(W=ha(J),W.c(),M(W,1),W.m(e,o)):W&&(Pe(),I(W,1,1,()=>{W=null}),Me()),ne&3&&(r=je(J[1].ui.v,J[0].u1>100||J[0].u2>100||J[0].u3>100)),r?q?(q.p(J,ne),ne&3&&M(q,1)):(q=ba(J),q.c(),M(q,1),q.m(e,a)):q&&(Pe(),I(q,1,1,()=>{q=null}),Me()),ne&3&&(c=je(J[1].ui.a,J[0].i1>.01||J[0].i2>.01||J[0].i3>.01)),c?F?(F.p(J,ne),ne&3&&M(F,1)):(F=ga(J),F.c(),M(F,1),F.m(e,f)):F&&(Pe(),I(F,1,1,()=>{F=null}),Me()),ne&3&&(m=je(J[1].ui.r,J[0].ri>0||J[0].re>0||J[0].ric>0||J[0].rec>0)),m?L?(L.p(J,ne),ne&3&&M(L,1)):(L=ka(J),L.c(),M(L,1),L.m(e,_)):L&&(Pe(),I(L,1,1,()=>{L=null}),Me()),ne&3&&(h=je(J[1].ui.c,J[0].ea)),h?j?(j.p(J,ne),ne&3&&M(j,1)):(j=wa(J),j.c(),M(j,1),j.m(e,b)):j&&(Pe(),I(j,1,1,()=>{j=null}),Me()),ne&3&&(d=je(J[1].ui.t,J[0].pr&&(J[0].pr.startsWith("10YNO")||J[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(J[1].ui.p,J[0].pe&&!Number.isNaN(J[0].p))),$?O?(O.p(J,ne),ne&3&&M(O,1)):(O=$a(J),O.c(),M(O,1),O.m(e,k)):O&&(Pe(),I(O,1,1,()=>{O=null}),Me()),ne&10&&(T=je(J[1].ui.d,J[3])),T?G?(G.p(J,ne),ne&10&&M(G,1)):(G=Ca(J),G.c(),M(G,1),G.m(e,P)):G&&(Pe(),I(G,1,1,()=>{G=null}),Me()),ne&18&&(E=je(J[1].ui.m,J[4])),E?H?(H.p(J,ne),ne&18&&M(H,1)):(H=Ta(J),H.c(),M(H,1),H.m(e,S)):H&&(Pe(),I(H,1,1,()=>{H=null}),Me()),ne&35&&(N=je(J[1].ui.s,J[0].t&&J[0].t!=-127&&J[5].c>1)),N?V?(V.p(J,ne),ne&35&&M(V,1)):(V=Sa(J),V.c(),M(V,1),V.m(e,null)):V&&(Pe(),I(V,1,1,()=>{V=null}),Me())},i(J){D||(M(R),M(W),M(q),M(F),M(L),M(j),M(U),M(O),M(G),M(H),M(V),D=!0)},o(J){I(R),I(W),I(q),I(F),I(L),I(j),I(U),I(O),I(G),I(H),I(V),D=!1},d(J){J&&w(e),R&&R.d(),W&&W.d(),q&&q.d(),F&&F.d(),L&&L.d(),j&&j.d(),U&&U.d(),O&&O.d(),G&&G.d(),H&&H.d(),V&&V.d()}}}function im(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},r={},a={},c={};return uc.subscribe(f=>{l(2,o=f)}),rc.subscribe(f=>{l(3,r=f)}),ac.subscribe(f=>{l(4,a=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,r,a,c]}class sm extends Ce{constructor(e){super(),$e(this,e,im,nm,ye,{data:0,sysinfo:1})}}let to={};const gc=Ze(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 r(d,g){return d[0]=="esp32c3"?rm:um}let a=r(t),c=a(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,r){y(o,e,r),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 r=0;r{r[m]=null}),Me(),l=r[e],l||(l=r[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){r[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(){Z(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){X(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(){Z(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){X(e,n)}}}function Sm(t){let e,l,n,i;const o=[Tm,Cm],r=[];function a(c,f){return c[3].q.s.r?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){r[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=a(c),e!==m&&(Pe(),I(r[m],1,1,()=>{r[m]=null}),Me(),l=r[e],l||(l=r[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){r[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(){Z(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){X(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(){Z(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){X(e,n)}}}function Am(t){let e,l,n,i;const o=[Mm,Pm],r=[];function a(c,f){return c[3].q.s.k?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){r[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=a(c),e!==m&&(Pe(),I(r[m],1,1,()=>{r[m]=null}),Me(),l=r[e],l||(l=r[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){r[e].d(c),c&&w(n)}}}function Va(t){let e,l,n,i,o,r,a,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,q,F,L,j,U,O,G;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Domoticz",n=v(),i=p("a"),Z(o.$$.fragment),r=v(),a=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"),q=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(a,"type","hidden"),u(a,"name","o"),a.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,r),s(e,a),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,q),s(R,F),Y(F,t[3].o.u2),s(R,L),s(R,j),Y(j,t[3].o.u3),U=!0,O||(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])],O=!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),X(o),O=!1,Be(G)}}}function Ka(t){let e,l,n,i,o,r,a,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,q,F,L,j;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Home-Assistant",n=v(),i=p("a"),Z(o.$$.fragment),r=v(),a=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(),q=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(a,"type","hidden"),u(a,"name","h"),a.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(q,"name","hn"),u(q,"type","text"),u(q,"class","in-s"),u(N,"class","my-1"),u(e,"class","cnt")},m(U,O){y(U,e,O),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,r),s(e,a),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,q),Y(q,t[3].h.n),F=!0,L||(j=[z(b,"input",t[64]),z(P,"input",t[65]),z(q,"input",t[66])],L=!0)},p(U,O){O[0]&8&&b.value!==U[3].h.t&&Y(b,U[3].h.t),(!F||O[0]&8&&E!==(E=U[3].g.h+".local"))&&u(P,"placeholder",E),O[0]&8&&P.value!==U[3].h.h&&Y(P,U[3].h.h),O[0]&8&&q.value!==U[3].h.n&&Y(q,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),X(o),L=!1,Be(j)}}}function Qa(t){let e,l,n,i,o,r,a,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"),Z(o.$$.fragment),r=v(),f&&f.c(),a=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,r),f&&f.m(e,null),s(e,a),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,a)):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),X(o),f&&f.d(),m&&m.d()}}}function xa(t){let e,l,n,i,o,r,a,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,q,F,L,j,U,O,G,H,V,J,ne,le,_e,Te,ve,Oe,be,Ee,he,Ne,pe,me,se,re,K,ae,Ae,te,ue,He,Se,de,De,qe;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"),r=p("label"),a=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"),q=v(),F=p("div"),L=p("input"),j=v(),U=p("div"),O=C("RGB"),G=p("label"),H=p("input"),V=C(" inverted"),J=p("br"),ne=v(),le=p("div"),_e=p("input"),Te=v(),ve=p("input"),Oe=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(a,"name","ihu"),a.__value="true",a.value=a.__value,u(a,"type","checkbox"),u(a,"class","rounded mb-1"),u(r,"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,r),s(r,a),a.checked=t[3].i.h.u,s(r,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,q),s(E,F),s(F,L),Y(L,t[3].i.l.p),s(n,j),s(n,U),s(U,O),s(U,G),s(G,H),H.checked=t[3].i.r.i,s(G,V),s(U,J),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,Oe),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||(qe=[z(a,"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&&(a.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),X(h),ge&&ge.d(),ke&&ke.d(),De=!1,Be(qe)}}}function ef(t){let e,l,n,i,o,r,a;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),r||(a=z(o,"input",t[81]),r=!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),r=!1,a()}}}function tf(t){let e,l,n,i,o,r,a,c,f,m;return{c(){e=p("div"),l=C("Voltage divider"),n=p("br"),i=v(),o=p("div"),r=p("input"),a=v(),c=p("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"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,r),Y(r,t[3].i.v.d.v),s(o,a),s(o,c),Y(c,t[3].i.v.d.g),f||(m=[z(r,"input",t[82]),z(c,"input",t[83])],f=!0)},p(_,h){h[0]&8&&fe(r.value)!==_[3].i.v.d.v&&Y(r,_[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,r,a,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"),r=p("br"),a=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,r),s(i,a),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,r,a;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),r||(a=z(o,"input",t[86]),r=!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),r=!1,a()}}}function sf(t){let e,l,n,i,o,r,a,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"),r=C(" Enable telnet"),a=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,r),y(T,a,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(a),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,r,a,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,q,F,L,j,U,O,G,H,V,J,ne,le,_e,Te,ve,Oe,be,Ee,he,Ne,pe,me,se,re,K,ae,Ae,te,ue,He,Se,de,De,qe,ge,ke,x,oe,Tl,_i,di,St,vi,Kl,pl,Zt,hi,bi,gi,lt,ki,Jt,wi,yi,$i,nt,Ci,xt,Ql,dt,Ti,Si,Pi,el,Mi,Ai,Di,Fe,tl,Pt,Sl,Ni,ml,Le,Xl,ho,Zl,Jl,bo,Qn,go,xl,ws,ko,_l,Ht,dl,wo,Ii,yo,et,vl,$o,Ei,en,tn,ln,nn,Ri,Co,Xn,Mt,To,So,Pl,Po,Mo,Ao,jt,sn,on,Do,un,Ml,No,Io,Eo,rn,At,Ro,Fi,Fo,Al,Lo,Oo,qo,an,Dt,Uo,Li,Ho,ys,jo,Dl,Oi,Nt,Wo,Go,Bo,$s,qi,It,Yo,zo,Vo,xe,Ui,Ko,fn,cn,Qo,Zn,Xo,Nl,Zo,Jo,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,Je,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,Jn,Su,bl,Pu,xn,Ft,Mu,Au,Du,Xi,il,Nu,Ge,Zi,Iu,$n,Cn,Eu,ei,Ru,Gt,Fu,Ts,Lu,Ou,Tn,sl,qu,Lt,Uu,Ss,Ll,Hu,ju,Wu,ol,Gu,Ol,Bu,Yu,zu,ul,Vu,Sn,Pn,Ku,Qu,Xu,rl,Zu,Mn,Ju,xu,er,it,An,Dn,Nn,In,En,Rn,tr,ql,lr,nr,ir,al,sr,Ps,Ms,As=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Ds,Bt,Ji,or,Fn,Ln,ur,ti,rr,li,ar,Ns,bt,xi,fr,On,qn,cr,ni,pr,es,ts,Ot,mr,_r,dr,gl,Is,Un,vr,ls,Hn,hr,ns,Es,Ul,Rs,Hl,Fs,jl,Ls,Wl,qt,Os,br;a=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);Jl=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")&&Ja(t);qn=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(),r=p("a"),Z(a.$$.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(),q=p("input"),F=v(),L=p("div"),j=p("div"),U=p("div"),O=C("Price region"),G=p("br"),H=v(),V=p("select"),J=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",Oe=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",qe=p("option"),qe.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"),Zt=p("div"),hi=C("Fixed price"),bi=p("br"),gi=v(),lt=p("input"),ki=v(),Jt=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"),Xl=p("strong"),Xl.textContent="Meter",ho=v(),Zl=p("a"),Z(Jl.$$.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(),Xn=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"),Oo=p("br"),qo=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"),Oi=p("label"),Nt=p("input"),Wo=C(" Meter is encrypted"),Go=v(),ut&&ut.c(),Bo=v(),rt&&rt.c(),$s=v(),qi=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"),Z(cn.$$.fragment),Qo=v(),Zn=p("input"),Xo=v(),Nl=p("div"),Zo=C("SSID"),Jo=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(),Je=p("div"),Gi=p("strong"),Gi.textContent="Network",vu=v(),bn=p("a"),Z(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"),Z(yn.$$.fragment),$u=v(),ft&&ft.c(),Cs=v(),Ki=p("div"),Qi=p("label"),Rt=p("input"),Cu=C(" enable mDNS"),Tu=v(),Jn=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(),Xi=p("div"),il=p("input"),Nu=v(),Ge=p("div"),Zi=p("strong"),Zi.textContent="MQTT",Iu=v(),$n=p("a"),Z(Cn.$$.fragment),Eu=v(),ei=p("input"),Ru=v(),Gt=p("div"),Fu=C(`Server + `),ct&&ct.c(),Ts=v(),Lu=p("br"),Ou=v(),Tn=p("div"),sl=p("input"),qu=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(),Ol=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"),Xu=v(),rl=p("input"),Zu=v(),Mn=p("div"),Ju=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(),ql=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"),Ji=p("strong"),Ji.textContent="User interface",or=v(),Fn=p("a"),Z(Ln.$$.fragment),ur=v(),ti=p("input"),rr=v(),li=p("div");for(let A=0;ASave',Es=v(),Z(Ul.$$.fragment),Rs=v(),Z(Hl.$$.fragment),Fs=v(),Z(jl.$$.fragment),Ls=v(),Z(Wl.$$.fragment),u(i,"class","text-sm"),u(r,"href",Ct("General-configuration")),u(r,"target","_blank"),u(r,"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(q,"type","hidden"),u(q,"name","p"),q.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(J,"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(Oe,"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,qe.__value="10YNL----------L",qe.value=qe.__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(Zt,"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(Jt,"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(Xl,"class","text-sm"),u(Zl,"href",Ct("Meter-configuration")),u(Zl,"target","_blank"),u(Zl,"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(Xn,"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(Zn,"type","hidden"),u(Zn,"name","w"),Zn.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(Jn,"type","hidden"),u(Jn,"name","ntp"),Jn.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(Xi,"class","flex"),u(bl,"class","my-1"),u(Je,"class","cnt"),u(Zi,"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(Ol,"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(ql,"class","my-1"),u(Ge,"class","cnt"),u(Ji,"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(On,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(On,"target","_blank"),u(On,"class","float-right"),u(ni,"type","hidden"),u(ni,"name","d"),ni.value="true",u(Ot,"type","checkbox"),u(Ot,"name","ds"),Ot.__value="true",Ot.value=Ot.__value,u(Ot,"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,r),Q(a,r,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,q),s(n,F),s(n,L),s(L,j),s(j,U),s(U,O),s(U,G),s(U,H),s(U,V),s(V,J),s(J,ne),s(J,le),s(J,_e),s(J,Te),s(J,ve),s(V,Oe),s(Oe,be),s(Oe,Ee),s(Oe,he),s(Oe,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,qe),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,Zt),s(Zt,hi),s(Zt,bi),s(Zt,gi),s(Zt,lt),Y(lt,t[3].p.f),s(pl,ki),s(pl,Jt),s(Jt,wi),s(Jt,yi),s(Jt,$i),s(Jt,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,Xl),s(Le,ho),s(Le,Zl),Q(Jl,Zl,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,Xn),s(Xn,Mt),Mt.checked=t[3].m.i,s(Xn,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,Oo),s(Al,qo),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,Oi),s(Oi,Nt),Nt.checked=t[3].m.e.e,s(Oi,Wo),s(Dl,Go),ut&&ut.m(Dl,null),s(Le,Bo),rt&&rt.m(Le,null),s(Le,$s),s(Le,qi),s(qi,It),It.checked=t[3].m.m.e,s(qi,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,Zn),s(xe,Xo),s(xe,Nl),s(Nl,Zo),s(Nl,Jo),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,Je),s(Je,Gi),s(Je,vu),s(Je,bn),Q(gn,bn,null),s(Je,hu),s(Je,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(Je,$u),ft&&ft.m(Je,null),s(Je,Cs),s(Je,Ki),s(Ki,Qi),s(Qi,Rt),Rt.checked=t[3].n.d,s(Qi,Cu),s(Je,Tu),s(Je,Jn),s(Je,Su),s(Je,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,Xi),s(Xi,il),Y(il,t[3].n.n1),s(l,Nu),s(l,Ge),s(Ge,Zi),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,Ou),s(Gt,Tn),s(Tn,sl),Y(sl,t[3].q.h),s(Tn,qu),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,Ol),s(Ol,Bu),s(Ol,Yu),s(Ol,zu),s(Ol,ul),Y(ul,t[3].q.a),s(Ge,Vu),s(Ge,Sn),s(Sn,Pn),s(Pn,Ku),s(Pn,Qu),s(Pn,Xu),s(Pn,rl),Y(rl,t[3].q.c),s(Sn,Zu),s(Sn,Mn),s(Mn,Ju),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,ql),s(ql,lr),s(ql,nr),s(ql,ir),s(ql,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,Ji),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),(!qt||ee[0]&8&&Ii!==(Ii=A[3].m.b!=0))&&(dl.disabled=Ii),ee[0]&8&&Re(Ht,A[3].m.b),(!qt||ee[0]&8&&Ei!==(Ei=A[3].m.b!=0))&&(vl.disabled=Ei),(!qt||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),(!qt||ee[0]&8&&Bi!==(Bi=A[3].n.m=="dhcp"))&&(vt.disabled=Bi),(!qt||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),(!qt||ee[0]&8&&zi!==(zi=A[3].n.m=="dhcp"))&&(ht.disabled=zi),(!qt||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(Je,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"?Xe?(Xe.p(A,ee),ee[0]&1&&M(Xe,1)):(Xe=Ja(A),Xe.c(),M(Xe,1),Xe.m(l,Ns)):Xe&&(Pe(),I(Xe,1,1,()=>{Xe=null}),Me()),ee[0]&8&&(Ot.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){qt||(M(a.$$.fragment,A),M(R.$$.fragment,A),M(Jl.$$.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(Xe),M(qn.$$.fragment,A),M(Ul.$$.fragment,A),M(Hl.$$.fragment,A),M(jl.$$.fragment,A),M(Wl.$$.fragment,A),qt=!0)},o(A){I(a.$$.fragment,A),I(R.$$.fragment,A),I(Jl.$$.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(Xe),I(qn.$$.fragment,A),I(Ul.$$.fragment,A),I(Hl.$$.fragment,A),I(jl.$$.fragment,A),I(Wl.$$.fragment,A),qt=!1},d(A){A&&w(e),X(a),X(R),Qt(is,A),st&&st.d(),ot&&ot.d(),X(Jl),Qt(ss,A),ut&&ut.d(),rt&&rt.d(),at&&at.d(),X(cn),X(gn),X(yn),ft&&ft.d(),X(Cn),ct&&ct.d(),ze&&ze.d(),Ve&&Ve.d(),Ke&&Ke.d(),Qe&&Qe.d(),X(Ln),Qt(pt,A),Xe&&Xe.d(),X(qn),mt&&mt.d(),A&&w(Es),X(Ul,A),A&&w(Rs),X(Hl,A),A&&w(Fs),X(jl,A),A&&w(Ls),X(Wl,A),Os=!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,r=!1,a={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,a=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,r=!0);const tl=new FormData(Fe.target),Pt=new URLSearchParams;for(let ml of tl){const[Le,Xl]=ml;Pt.append(Le,Xl)}let Ni=await(await fetch("/save",{method:"POST",body:Pt})).json();Tt.update(ml=>(ml.booting=Ni.reboot,ml.ui=a.u,ml)),l(2,r=!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(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let d=44;function g(){a.g.h=this.value,l(3,a)}function $(){a.g.t=tt(this),l(3,a)}function k(){a.p.r=tt(this),l(3,a)}function T(){a.p.c=tt(this),l(3,a)}function P(){a.p.f=fe(this.value),l(3,a)}function E(){a.p.m=fe(this.value),l(3,a)}function S(){a.p.e=this.checked,l(3,a)}function N(){a.p.t=this.value,l(3,a)}function D(){a.g.s=tt(this),l(3,a)}function R(){a.g.u=this.value,l(3,a)}function W(){a.g.p=this.value,l(3,a)}function q(){a.m.b=tt(this),l(3,a)}function F(){a.m.p=tt(this),l(3,a)}function L(){a.m.i=this.checked,l(3,a)}function j(){a.m.d=tt(this),l(3,a)}function U(){a.m.f=fe(this.value),l(3,a)}function O(){a.m.r=fe(this.value),l(3,a)}function G(){a.m.e.e=this.checked,l(3,a)}function H(){a.m.e.k=this.value,l(3,a)}function V(){a.m.e.a=this.value,l(3,a)}function J(){a.m.m.e=this.checked,l(3,a)}function ne(){a.m.m.w=fe(this.value),l(3,a)}function le(){a.m.m.v=fe(this.value),l(3,a)}function _e(){a.m.m.a=fe(this.value),l(3,a)}function Te(){a.m.m.c=fe(this.value),l(3,a)}function ve(){a.w.s=this.value,l(3,a)}function Oe(){a.w.p=this.value,l(3,a)}function be(){a.w.z=tt(this),l(3,a)}function Ee(){a.w.w=fe(this.value),l(3,a)}function he(){a.w.a=this.checked,l(3,a)}function Ne(){a.n.m=tt(this),l(3,a)}function pe(){a.n.i=this.value,l(3,a)}function me(){a.n.s=tt(this),l(3,a)}function se(){a.n.g=this.value,l(3,a)}function re(){a.n.d1=this.value,l(3,a)}function K(){a.n.d2=this.value,l(3,a)}function ae(){a.n.d=this.checked,l(3,a)}function Ae(){a.n.h=this.checked,l(3,a)}function te(){a.n.n1=this.value,l(3,a)}function ue(){a.q.s.e=this.checked,l(3,a)}function He(){a.q.h=this.value,l(3,a)}function Se(){a.q.p=fe(this.value),l(3,a)}function de(){a.q.u=this.value,l(3,a)}function De(){a.q.a=this.value,l(3,a)}function qe(){a.q.c=this.value,l(3,a)}function ge(){a.q.m=tt(this),l(3,a)}function ke(){a.q.b=this.value,l(3,a)}function x(){a.o.e=this.value,l(3,a)}function oe(){a.o.c=this.value,l(3,a)}function Tl(){a.o.u1=this.value,l(3,a)}function _i(){a.o.u2=this.value,l(3,a)}function di(){a.o.u3=this.value,l(3,a)}function St(){a.h.t=this.value,l(3,a)}function vi(){a.h.h=this.value,l(3,a)}function Kl(){a.h.n=this.value,l(3,a)}function pl(Fe){a.t.t[Fe]=fe(this.value),l(3,a)}function Zt(){a.t.h=fe(this.value),l(3,a)}function hi(Fe){a.u[Fe.key]=tt(this),l(3,a)}function bi(){a.i.h.u=this.checked,l(3,a)}function gi(){a.i.h.p=tt(this),l(3,a)}function lt(){a.i.a=fe(this.value),l(3,a)}function ki(){a.i.l.i=this.checked,l(3,a)}function Jt(){a.i.l.p=fe(this.value),l(3,a)}function wi(){a.i.r.i=this.checked,l(3,a)}function yi(){a.i.r.r=fe(this.value),l(3,a)}function $i(){a.i.r.g=fe(this.value),l(3,a)}function nt(){a.i.r.b=fe(this.value),l(3,a)}function Ci(){a.i.t.d=fe(this.value),l(3,a)}function xt(){a.i.t.a=fe(this.value),l(3,a)}function Ql(){a.i.v.p=fe(this.value),l(3,a)}function dt(){a.i.v.d.v=fe(this.value),l(3,a)}function Ti(){a.i.v.d.g=fe(this.value),l(3,a)}function Si(){a.i.v.o=fe(this.value),l(3,a)}function Pi(){a.i.v.m=fe(this.value),l(3,a)}function el(){a.i.v.b=fe(this.value),l(3,a)}function Mi(){a.d.s=this.checked,l(3,a)}function Ai(){a.d.t=this.checked,l(3,a)}function Di(){a.d.l=tt(this),l(3,a)}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,r,a,c,f,d,i,m,_,h,b,g,$,k,T,P,E,S,N,D,R,W,q,F,L,j,U,O,G,H,V,J,ne,le,_e,Te,ve,Oe,be,Ee,he,Ne,pe,me,se,re,K,ae,Ae,te,ue,He,Se,de,De,qe,ge,ke,x,oe,Tl,_i,di,St,vi,Kl,pl,Zt,hi,bi,gi,lt,ki,Jt,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,r,a,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(),r=p("div"),a=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(r,"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,r,R),s(r,a),S[c].m(r,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(r,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(r),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(){Z(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){X(e,n)}}}function Om(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,r=hs(t[1].meter.mfg)+"",a,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: "),a=C(r),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,a),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&&r!==(r=hs(T[1].meter.mfg)+"")&&B(a,r),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,r=t[1].net.ip+"",a,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: "),a=C(r),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,q){y(W,e,q),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),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,q){q&2&&r!==(r=W[1].net.ip+"")&&B(a,r),q&2&&_!==(_=W[1].net.mask+"")&&B(h,_),q&2&&$!==($=W[1].net.gw+"")&&B(k,$),q&2&&S!==(S=W[1].net.dns1+"")&&B(N,S),W[1].net.dns2?R?R.p(W,q):(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,r,a,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),a=v(),_&&_.c(),c=v(),h&&h.c(),f=We(),u(n,"href",r=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,a),_&&_.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&&r!==(r=b[2].html_url))&&u(n,"href",r),(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,r;return n=new hc({}),{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(a,c){y(a,e,c),s(e,l),Q(n,l,null),i=!0,o||(r=z(l,"click",t[10]),o=!0)},p:ie,i(a){i||(M(n.$$.fragment,a),i=!0)},o(a){I(n.$$.fragment,a),i=!1},d(a){a&&w(e),X(n),o=!1,r()}}}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,r;function a(m,_){return m[4].length==0?Um:qm}let c=a(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||(r=[z(n,"change",t[13]),z(l,"submit",t[15])],o=!0)},p(m,_){c===(c=a(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(r)}}}function qm(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,r){y(o,l,r),y(o,n,r),y(o,i,r)},p(o,r){r&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,r,a,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(a,"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,r),s(o,a),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,q)):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,J)):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),X(h),pe&&pe.d(),X(S),me&&me.d(),se&&se.d(),re&&re.d(),K&&K.d(),ae&&ae.d(),Ae&&Ae.d(),te&&w(Te),X(ve,te),te&&w(Oe),X(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"}],r={};_o.subscribe(D=>{l(2,r=dc(i.version,D)),r||l(2,r=D[0])});function a(){confirm("Do you want to upgrade this device to "+r.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,r,f,m,_,h,b,d,o,a,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,r=ce(t[0],5)+"",a,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,q,F,L=ce(t[0],101)+"",j,U,O=ce(t[0],100)+"",G;return{c(){e=p("optgroup"),l=p("option"),i=C(n),o=p("option"),a=C(r),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(),q=p("optgroup"),F=p("option"),j=C(L),U=p("option"),G=C(O),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(q,"label","Generic hardware")},m(H,V){y(H,e,V),s(e,l),s(l,i),s(e,o),s(o,a),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,q,V),s(q,F),s(F,j),s(q,U),s(U,G)},p(H,V){V&1&&n!==(n=ce(H[0],7)+"")&&B(i,n),V&1&&r!==(r=ce(H[0],5)+"")&&B(a,r),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&&O!==(O=ce(H[0],100)+"")&&B(G,O)},d(H){H&&w(e),H&&w(d),H&&w(g),H&&w(W),H&&w(q)}}}function wf(t){let e,l,n=ce(t[0],201)+"",i,o,r=ce(t[0],202)+"",a,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"),a=C(r),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,a),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&&r!==(r=ce(d[0],202)+"")&&B(a,r),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,r=ce(t[0],6)+"",a,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"),a=C(r),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,a),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&&r!==(r=ce(P[0],6)+"")&&B(a,r),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,r,a,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(),r=p("optgroup"),a=p("option"),f=C(c),m=p("option"),h=C(_),l.__value=8,l.value=l.__value,u(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,m.__value=70,m.value=m.__value,u(r,"label","Generic hardware")},m(b,d){y(b,e,d),s(e,l),s(l,i),y(b,o,d),y(b,r,d),s(r,a),s(a,f),s(r,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(r)}}}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,r){y(o,e,r),s(e,l),s(l,i)},p(o,r){r&1&&n!==(n=ce(o[0],200)+"")&&B(i,n)},d(o){o&&w(e)}}}function zm(t){let e,l,n,i,o,r,a,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(),r=v(),h&&h.c(),a=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,r,d),h&&h.m(b,d),y(b,a,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(r.parentNode,r)):_&&(_.d(1),_=null),b[0]=="esp32solo"?h?h.p(b,d):(h=Cf(b),h.c(),h.m(a.parentNode,a)):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(r),h&&h.d(b),b&&w(a)}}}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,r,a;return r=new kc({props:{chip:t[0].chip}}),{c(){e=p("div"),l=C("HAN GPIO"),n=p("br"),i=v(),o=p("select"),Z(r.$$.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(r,o,null),a=!0},p(c,f){const m={};f&1&&(m.chip=c[0].chip),r.$set(m)},i(c){a||(M(r.$$.fragment,c),a=!0)},o(c){I(r.$$.fragment,c),a=!1},d(c){c&&w(e),X(r)}}}function Qm(t){let e,l,n,i,o,r,a,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,q,F,L,j,U=t[0].usrcfg&&Tf();d=new Km({props:{chip:t[0].chip}});let O=t[0].board&&t[0].board>20&&Sf(t);return q=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(),r=p("strong"),r.textContent="Initial configuration",a=v(),U&&U.c(),c=v(),f=p("div"),m=C("Board type"),_=p("br"),h=v(),b=p("select"),Z(d.$$.fragment),g=v(),O&&O.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(q.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(r,"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,r),s(n,a),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),O&&O.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(q,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?O?(O.p(G,H),H&1&&M(O,1)):(O=Sf(G),O.c(),M(O,1),O.m(n,$)):O&&(Pe(),I(O,1,1,()=>{O=null}),Me()),H&4&&(P.checked=G[2]);const J={};H&2&&(J.active=G[1]),q.$set(J)},i(G){F||(M(d.$$.fragment,G),M(O),M(q.$$.fragment,G),F=!0)},o(G){I(d.$$.fragment,G),I(O),I(q.$$.fragment,G),F=!1},d(G){G&&w(e),U&&U.d(),X(d),O&&O.d(),G&&w(W),X(q,G),L=!1,Be(j)}}}function Xm(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 r=!1;function a(){n.board=tt(this),l(0,n)}function c(){r=this.checked,l(2,r),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,r=!n.usrcfg)},[n,i,r,o,a,c]}class Zm extends Ce{constructor(e){super(),$e(this,e,Xm,Qm,ye,{sysinfo:0})}}function Pf(t){let e,l,n,i,o,r,a,c;return a=new wc({}),{c(){e=p("br"),l=v(),n=p("div"),i=p("input"),o=v(),r=p("select"),Z(a.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=t[1],u(r,"name","su"),u(r,"class","in-l"),r.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,r),Q(a,r,null),c=!0},p(f,m){(!c||m&2)&&(i.required=f[1]),(!c||m&2)&&(r.required=f[1])},i(f){c||(M(a.$$.fragment,f),c=!0)},o(f){I(a.$$.fragment,f),c=!1},d(f){f&&w(e),f&&w(l),f&&w(n),X(a)}}}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 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,q,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
+
`,u(e,"class","my-3 flex")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Jm(t){let e,l,n,i,o,r,a,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,q,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(),r=p("strong"),r.textContent="Setup",a=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(),j&&j.c(),S=v(),U&&U.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(O,G){y(O,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(O,R,G),Q(W,O,G),q=!0,F||(L=[z(d,"input",t[4]),z(T,"change",t[5]),z(n,"submit",gs(t[3]))],F=!0)},p(O,[G]){G&1&&d.value!==O[0].hostname&&Y(d,O[0].hostname),G&2&&(T.checked=O[1]),O[1]?j?(j.p(O,G),G&2&&M(j,1)):(j=Pf(O),j.c(),M(j,1),j.m($,null)):j&&(Pe(),I(j,1,1,()=>{j=null}),Me()),O[1]?U||(U=Mf(),U.c(),U.m(n,N)):U&&(U.d(1),U=null);const H={};G&4&&(H.active=O[2]),W.$set(H)},i(O){q||(M(j),M(W.$$.fragment,O),q=!0)},o(O){I(j),I(W.$$.fragment,O),q=!1},d(O){O&&w(e),j&&j.d(),U&&U.d(),O&&w(R),X(W,O),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,Jm,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(),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),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),X(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,q,F,L,j,U,O;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(),q=p("div"),q.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(q,"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,q),y(G,F,H),Q(L,G,H),j=!0,U||(O=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),X(L,G),U=!1,O()}}}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(){Z(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){X(e,n)}}}function u0(t){let e,l;return e=new Em({props:{sysinfo:t[0]}}),{c(){Z(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){X(e,n)}}}function r0(t){let e,l;return e=new Ym({props:{sysinfo:t[0],data:t[1]}}),{c(){Z(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){X(e,n)}}}function a0(t){let e,l;return e=new vo({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Z(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){X(e,n)}}}function f0(t){let e,l;return e=new vo({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Z(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){X(e,n)}}}function c0(t){let e,l;return e=new vo({props:{title:"private key",action:"/mqtt-key"}}),{c(){Z(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){X(e,n)}}}function p0(t){let e,l;return e=new s0({props:{sysinfo:t[0]}}),{c(){Z(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){X(e,n)}}}function m0(t){let e,l;return e=new e0({props:{sysinfo:t[0]}}),{c(){Z(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){X(e,n)}}}function _0(t){let e,l;return e=new Zm({props:{sysinfo:t[0]}}),{c(){Z(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){X(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(){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){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 q={};N&7&&(q.$$scope={dirty:N,ctx:S}),r.$set(q);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 O={};N&5&&(O.$$scope={dirty:N,ctx:S}),k.$set(O);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){X(e,S),S&&w(l),X(n,S),S&&w(i),X(o,S),S&&w(a),X(r,S),S&&w(c),X(f,S),S&&w(m),X(_,S),S&&w(h),X(b,S),S&&w(d),X(g,S),S&&w($),X(k,S),S&&w(T),X(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(){Z(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){X(e,n)}}}function b0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Z(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){X(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(){Z(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){X(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"),Z(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),X(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")}); + `),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(),Z(W.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(r,"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(O,G){y(O,e,G),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),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(O,R,G),Q(W,O,G),q=!0,F||(L=[z(d,"input",t[4]),z(T,"change",t[5]),z(n,"submit",gs(t[3]))],F=!0)},p(O,[G]){G&1&&d.value!==O[0].hostname&&Y(d,O[0].hostname),G&2&&(T.checked=O[1]),O[1]?j?(j.p(O,G),G&2&&M(j,1)):(j=Pf(O),j.c(),M(j,1),j.m($,null)):j&&(Pe(),I(j,1,1,()=>{j=null}),Me()),O[1]?U||(U=Mf(),U.c(),U.m(n,N)):U&&(U.d(1),U=null);const H={};G&4&&(H.active=O[2]),W.$set(H)},i(O){q||(M(j),M(W.$$.fragment,O),q=!0)},o(O){I(j),I(W.$$.fragment,O),q=!1},d(O){O&&w(e),j&&j.d(),U&&U.d(),O&&w(R),X(W,O),F=!1,Be(L)}}}function xm(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,r=0;function a(){var _="";r++;var h=function(){setTimeout(a,1e3)};if(n.net.ip&&r%3==0){if(!n.net.ip){h();return}_="http://"+n.net.ip}else n.hostname&&r%3==1?_="http://"+n.hostname:n.hostname&&r%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(a,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,Jm,ye,{sysinfo:0})}}function t0(t){let e,l,n,i,o,r,a,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]),r=v(),a=p("p"),a.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(a,"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,r),s(l,a),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),X(d,T),$=!1,k()}}}function l0(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const r=()=>l(2,o=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,o,r]}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,r,a,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,q,F,L,j,U,O;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(),r=p("hr"),a=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(),q=p("div"),q.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(q,"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,r),s(n,a),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,q),y(G,F,H),Q(L,G,H),j=!0,U||(O=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),X(L,G),U=!1,O()}}}function i0(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(r){l(1,i=!0);const a=new FormData(r.target),c=new URLSearchParams;for(let _ of a){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=a.sf===!0?1:a.sf===!1?2:0,_.booting=m.reboot,_)),Bn("/")}return t.$$set=r=>{"sysinfo"in r&&l(0,n=r.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(){Z(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){X(e,n)}}}function u0(t){let e,l;return e=new Em({props:{sysinfo:t[0]}}),{c(){Z(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){X(e,n)}}}function r0(t){let e,l;return e=new Ym({props:{sysinfo:t[0],data:t[1]}}),{c(){Z(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){X(e,n)}}}function a0(t){let e,l;return e=new vo({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Z(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){X(e,n)}}}function f0(t){let e,l;return e=new vo({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Z(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){X(e,n)}}}function c0(t){let e,l;return e=new vo({props:{title:"private key",action:"/mqtt-key"}}),{c(){Z(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){X(e,n)}}}function p0(t){let e,l;return e=new s0({props:{sysinfo:t[0]}}),{c(){Z(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){X(e,n)}}}function m0(t){let e,l;return e=new e0({props:{sysinfo:t[0]}}),{c(){Z(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){X(e,n)}}}function _0(t){let e,l;return e=new Zm({props:{sysinfo:t[0]}}),{c(){Z(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){X(e,n)}}}function d0(t){let e,l,n,i,o,r,a,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}}}),a=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(){Z(e.$$.fragment),l=v(),Z(n.$$.fragment),i=v(),Z(o.$$.fragment),r=v(),Z(a.$$.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){Q(e,S,N),y(S,l,N),Q(n,S,N),y(S,i,N),Q(o,S,N),y(S,r,N),Q(a,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 q={};N&7&&(q.$$scope={dirty:N,ctx:S}),a.$set(q);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 O={};N&5&&(O.$$scope={dirty:N,ctx:S}),k.$set(O);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(a.$$.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(a.$$.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){X(e,S),S&&w(l),X(n,S),S&&w(i),X(o,S),S&&w(r),X(a,S),S&&w(c),X(f,S),S&&w(m),X(_,S),S&&w(h),X(b,S),S&&w(d),X(g,S),S&&w($),X(k,S),S&&w(T),X(P,S)}}}function v0(t){let e,l,n,i;const o=[g0,b0],r=[];function a(c,f){return c[0].trying?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){r[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=a(c),e===m?r[e].p(c,f):(Pe(),I(r[m],1,1,()=>{r[m]=null}),Me(),l=r[e],l?l.p(c,f):(l=r[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){r[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(){Z(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){X(e,n)}}}function b0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Z(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){X(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(){Z(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){X(e,n)}}}function k0(t){let e,l,n,i,o,r;l=new tc({props:{$$slots:{default:[d0]},$$scope:{ctx:t}}});const a=[h0,v0],c=[];function f(m,_){return m[0].upgrading?0:m[0].booting?1:-1}return~(i=f(t))&&(o=c[i]=a[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,_),Q(l,e,null),s(e,n),~i&&c[i].m(e,null),r=!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]=a[i](m),o.c()),M(o,1),o.m(e,null)):o=null)},i(m){r||(M(l.$$.fragment,m),M(o),r=!0)},o(m){I(l.$$.fragment,m),I(o),r=!1},d(m){m&&w(e),X(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 4c8303f1..874736b6 100644 --- a/lib/SvelteUi/app/src/lib/AccountingData.svelte +++ b/lib/SvelteUi/app/src/lib/AccountingData.svelte @@ -9,8 +9,8 @@ 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); + cols = hasCost ? 3 : 2; }