From 19f78126d69462229468216a25e34d22261871cd Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Thu, 25 Sep 2025 10:47:22 +0200 Subject: [PATCH] Auto enable price fetch when region is changed (#1009) --- lib/SvelteUi/app/dist/index.js | 12 ++++++------ lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte | 6 +++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index 2137b42a..3dd9eb6b 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,7 +1,7 @@ -var Iu=Object.defineProperty;var Ru=(t,e,l)=>e in t?Iu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[e]=l;var _i=(t,e,l)=>(Ru(t,typeof e!="symbol"?e+"":e,l),l);(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 s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=l(i);fetch(i.href,s)}})();function Ye(){}function hl(t,e){for(const l in e)t[l]=e[l];return t}function jf(t){return t()}function ns(){return Object.create(null)}function jt(t){t.forEach(jf)}function ji(t){return typeof t=="function"}function Nt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Zn;function ii(t,e){return t===e?!0:(Zn||(Zn=document.createElement("a")),Zn.href=e,t===Zn.href)}function Fu(t){return Object.keys(t).length===0}function Hi(t,...e){if(t==null){for(const n of e)n(void 0);return Ye}const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function cn(t){let e;return Hi(t,l=>e=l)(),e}function Pl(t,e,l){t.$$.on_destroy.push(Hi(e,l))}function yi(t,e,l,n){if(t){const i=Hf(t,e,l,n);return t[0](i)}}function Hf(t,e,l,n){return t[1]&&n?hl(l.ctx.slice(),t[1](n(e))):l.ctx}function zi(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 s=[],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 pn(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)}const Bu=["width","height"];function Cn(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&&Bu.indexOf(n)===-1?t[n]=e[n]:u(t,n,e[n])}function ye(t){return t===""?null:+t}function ju(t){return Array.from(t.childNodes)}function E(t,e){e=""+e,t.data!==e&&(t.data=e)}function Hu(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function yu(t,e,l){~Uu.indexOf(l)?Hu(t,e):E(t,e)}function H(t,e){t.value=e??""}function nn(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Ke(t,e,l){for(let n=0;n{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{s=ce(n.contentWindow,"resize",e),e()}),o(t,n),()=>{(i||s&&n.contentWindow)&&s(),N(n)}}function Wu(t,e,{bubbles:l=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:l,cancelable:n})}function is(t,e){return new t(e)}let yn;function Bn(t){yn=t}function Kn(){if(!yn)throw new Error("Function called outside component initialization");return yn}function yf(t){Kn().$$.on_mount.push(t)}function Gu(t){Kn().$$.on_destroy.push(t)}function Vu(){const t=Kn();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const s=Wu(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,s)}),!s.defaultPrevented}return!0}}function jn(t,e){return Kn().$$.context.set(t,e),e}function on(t){return Kn().$$.context.get(t)}const bn=[],ai=[];let wn=[];const ss=[],zf=Promise.resolve();let wi=!1;function Wf(){wi||(wi=!0,zf.then(Gf))}function Ku(){return Wf(),zf}function At(t){wn.push(t)}const mi=new Set;let hn=0;function Gf(){if(hn!==0)return;const t=yn;do{try{for(;hnt.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),wn=e}const li=new Set;let fn;function vt(){fn={r:0,c:[],p:fn}}function bt(){fn.r||jt(fn.c),fn=fn.p}function Z(t,e){t&&t.i&&(li.delete(t),t.i(e))}function ie(t,e,l,n){if(t&&t.o){if(li.has(t))return;li.add(t),fn.c.push(()=>{li.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function rt(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function Ci(t,e){const l={},n={},i={$$scope:1};let s=t.length;for(;s--;){const a=t[s],r=e[s];if(r){for(const f in a)f in r||(n[f]=1);for(const f in r)i[f]||(l[f]=r[f],i[f]=1);t[s]=r}else for(const f in a)i[f]=1}for(const a in n)a in l||(l[a]=void 0);return l}function $n(t){return typeof t=="object"&&t!==null?t:{}}function Ne(t){t&&t.c()}function Se(t,e,l){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,l),At(()=>{const s=t.$$.on_mount.map(jf).filter(ji);t.$$.on_destroy?t.$$.on_destroy.push(...s):jt(s),t.$$.on_mount=[]}),i.forEach(At)}function Me(t,e){const l=t.$$;l.fragment!==null&&(Qu(l.after_update),jt(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function Xu(t,e){t.$$.dirty[0]===-1&&(bn.push(t),Wf(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const b=h.length?h[0]:d;return c.ctx&&i(c.ctx[_],c.ctx[_]=b)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](b),m&&Xu(t,_)),d}):[],c.update(),m=!0,jt(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=ju(e.target);c.fragment&&c.fragment.l(_),_.forEach(N)}else c.fragment&&c.fragment.c();e.intro&&Z(t.$$.fragment),Se(t,e.target,e.anchor),Gf()}Bn(f)}class Tt{constructor(){_i(this,"$$");_i(this,"$$set")}$destroy(){Me(this,1),this.$destroy=Ye}$on(e,l){if(!ji(l))return Ye;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&&!Fu(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Zu="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Zu);const os=t=>typeof t>"u",Vf=t=>typeof t=="function",Kf=t=>typeof t=="number";function Ju(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Yf(){let t=0;return()=>t++}function $u(){return Math.random().toString(36).substring(2)}const Al=typeof window>"u";function Qf(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Xf=(t,e)=>t?{}:{style:e},Si=t=>({"aria-hidden":"true",...Xf(t,"display:none;")}),vn=[];function Zf(t,e){return{subscribe:ol(t,e).subscribe}}function ol(t,e=Ye){let l;const n=new Set;function i(r){if(Nt(t,r)&&(t=r,l)){const f=!vn.length;for(const c of n)c[1](),vn.push(c,t);if(f){for(let c=0;c{n.delete(c),n.size===0&&l&&(l(),l=null)}}return{set:i,update:s,subscribe:a}}function xu(t,e,l){const n=!Array.isArray(t),i=n?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=e.length<2;return Zf(l,(a,r)=>{let f=!1;const c=[];let m=0,_=Ye;const d=()=>{if(m)return;_();const b=e(n?c[0]:c,a,r);s?a(b):_=ji(b)?b:Ye},h=i.map((b,g)=>Hi(b,w=>{c[g]=w,m&=~(1<{m|=1<`@@svnav-ctx__${t}`,Mi=Yn("LOCATION"),Sn=Yn("ROUTER"),Jf=Yn("ROUTE"),er=Yn("ROUTE_PARAMS"),tr=Yn("FOCUS_ELEM"),$f=/^:(.+)/,Rn=(t,e,l)=>t.substr(e,l),Ni=(t,e)=>Rn(t,0,e.length)===e,lr=t=>t==="",nr=t=>$f.test(t),xf=t=>t[0]==="*",ir=t=>t.replace(/\*.*$/,""),eu=t=>t.replace(/(^\/+|\/+$)/g,"");function Tl(t,e=!1){const l=eu(t).split("/");return e?l.filter(Boolean):l}const pi=(t,e)=>t+(e?`?${e}`:""),Ki=t=>`/${eu(t)}`;function Qn(...t){const e=n=>Tl(n,!0).join("/"),l=t.map(e).join("/");return Ki(l)}const Yi=1,ri=2,mn=3,sr=4,tu=5,or=6,lu=7,ar=8,fr=9,nu=10,iu=11,ur={[Yi]:"Link",[ri]:"Route",[mn]:"Router",[sr]:"useFocus",[tu]:"useLocation",[or]:"useMatch",[lu]:"useNavigate",[ar]:"useParams",[fr]:"useResolvable",[nu]:"useResolve",[iu]:"navigate"},Qi=t=>ur[t];function rr(t,e){let l;return t===ri?l=e.path?`path="${e.path}"`:"default":t===Yi?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${Qi(t)} ${l||""} />`}function cr(t,e,l,n){const i=l&&rr(n||t,l),s=i?` +var Iu=Object.defineProperty;var Ru=(t,e,l)=>e in t?Iu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[e]=l;var _i=(t,e,l)=>(Ru(t,typeof e!="symbol"?e+"":e,l),l);(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 s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=l(i);fetch(i.href,s)}})();function Ye(){}function vl(t,e){for(const l in e)t[l]=e[l];return t}function jf(t){return t()}function ns(){return Object.create(null)}function Bt(t){t.forEach(jf)}function ji(t){return typeof t=="function"}function Mt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Zn;function ii(t,e){return t===e?!0:(Zn||(Zn=document.createElement("a")),Zn.href=e,t===Zn.href)}function Fu(t){return Object.keys(t).length===0}function Hi(t,...e){if(t==null){for(const n of e)n(void 0);return Ye}const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function cn(t){let e;return Hi(t,l=>e=l)(),e}function Pl(t,e,l){t.$$.on_destroy.push(Hi(e,l))}function yi(t,e,l,n){if(t){const i=Hf(t,e,l,n);return t[0](i)}}function Hf(t,e,l,n){return t[1]&&n?vl(l.ctx.slice(),t[1](n(e))):l.ctx}function zi(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 s=[],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 pn(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)}const Bu=["width","height"];function Cn(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&&Bu.indexOf(n)===-1?t[n]=e[n]:u(t,n,e[n])}function ye(t){return t===""?null:+t}function ju(t){return Array.from(t.childNodes)}function E(t,e){e=""+e,t.data!==e&&(t.data=e)}function Hu(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function yu(t,e,l){~Uu.indexOf(l)?Hu(t,e):E(t,e)}function H(t,e){t.value=e??""}function nn(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Ke(t,e,l){for(let n=0;n{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{s=ce(n.contentWindow,"resize",e),e()}),o(t,n),()=>{(i||s&&n.contentWindow)&&s(),N(n)}}function Wu(t,e,{bubbles:l=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:l,cancelable:n})}function is(t,e){return new t(e)}let yn;function Bn(t){yn=t}function Kn(){if(!yn)throw new Error("Function called outside component initialization");return yn}function yf(t){Kn().$$.on_mount.push(t)}function Gu(t){Kn().$$.on_destroy.push(t)}function Vu(){const t=Kn();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const s=Wu(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,s)}),!s.defaultPrevented}return!0}}function jn(t,e){return Kn().$$.context.set(t,e),e}function on(t){return Kn().$$.context.get(t)}const bn=[],ai=[];let wn=[];const ss=[],zf=Promise.resolve();let wi=!1;function Wf(){wi||(wi=!0,zf.then(Gf))}function Ku(){return Wf(),zf}function Dt(t){wn.push(t)}const mi=new Set;let hn=0;function Gf(){if(hn!==0)return;const t=yn;do{try{for(;hnt.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),wn=e}const li=new Set;let fn;function ht(){fn={r:0,c:[],p:fn}}function vt(){fn.r||Bt(fn.c),fn=fn.p}function Z(t,e){t&&t.i&&(li.delete(t),t.i(e))}function ie(t,e,l,n){if(t&&t.o){if(li.has(t))return;li.add(t),fn.c.push(()=>{li.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function rt(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function Ci(t,e){const l={},n={},i={$$scope:1};let s=t.length;for(;s--;){const a=t[s],r=e[s];if(r){for(const f in a)f in r||(n[f]=1);for(const f in r)i[f]||(l[f]=r[f],i[f]=1);t[s]=r}else for(const f in a)i[f]=1}for(const a in n)a in l||(l[a]=void 0);return l}function $n(t){return typeof t=="object"&&t!==null?t:{}}function Pe(t){t&&t.c()}function Me(t,e,l){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,l),Dt(()=>{const s=t.$$.on_mount.map(jf).filter(ji);t.$$.on_destroy?t.$$.on_destroy.push(...s):Bt(s),t.$$.on_mount=[]}),i.forEach(Dt)}function Ne(t,e){const l=t.$$;l.fragment!==null&&(Qu(l.after_update),Bt(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function Xu(t,e){t.$$.dirty[0]===-1&&(bn.push(t),Wf(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const b=h.length?h[0]:d;return c.ctx&&i(c.ctx[_],c.ctx[_]=b)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](b),m&&Xu(t,_)),d}):[],c.update(),m=!0,Bt(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=ju(e.target);c.fragment&&c.fragment.l(_),_.forEach(N)}else c.fragment&&c.fragment.c();e.intro&&Z(t.$$.fragment),Me(t,e.target,e.anchor),Gf()}Bn(f)}class Pt{constructor(){_i(this,"$$");_i(this,"$$set")}$destroy(){Ne(this,1),this.$destroy=Ye}$on(e,l){if(!ji(l))return Ye;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&&!Fu(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Zu="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Zu);const os=t=>typeof t>"u",Vf=t=>typeof t=="function",Kf=t=>typeof t=="number";function Ju(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Yf(){let t=0;return()=>t++}function $u(){return Math.random().toString(36).substring(2)}const Al=typeof window>"u";function Qf(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Xf=(t,e)=>t?{}:{style:e},Si=t=>({"aria-hidden":"true",...Xf(t,"display:none;")}),vn=[];function Zf(t,e){return{subscribe:ol(t,e).subscribe}}function ol(t,e=Ye){let l;const n=new Set;function i(r){if(Mt(t,r)&&(t=r,l)){const f=!vn.length;for(const c of n)c[1](),vn.push(c,t);if(f){for(let c=0;c{n.delete(c),n.size===0&&l&&(l(),l=null)}}return{set:i,update:s,subscribe:a}}function xu(t,e,l){const n=!Array.isArray(t),i=n?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=e.length<2;return Zf(l,(a,r)=>{let f=!1;const c=[];let m=0,_=Ye;const d=()=>{if(m)return;_();const b=e(n?c[0]:c,a,r);s?a(b):_=ji(b)?b:Ye},h=i.map((b,g)=>Hi(b,w=>{c[g]=w,m&=~(1<{m|=1<`@@svnav-ctx__${t}`,Mi=Yn("LOCATION"),Sn=Yn("ROUTER"),Jf=Yn("ROUTE"),er=Yn("ROUTE_PARAMS"),tr=Yn("FOCUS_ELEM"),$f=/^:(.+)/,Rn=(t,e,l)=>t.substr(e,l),Ni=(t,e)=>Rn(t,0,e.length)===e,lr=t=>t==="",nr=t=>$f.test(t),xf=t=>t[0]==="*",ir=t=>t.replace(/\*.*$/,""),eu=t=>t.replace(/(^\/+|\/+$)/g,"");function Tl(t,e=!1){const l=eu(t).split("/");return e?l.filter(Boolean):l}const pi=(t,e)=>t+(e?`?${e}`:""),Ki=t=>`/${eu(t)}`;function Qn(...t){const e=n=>Tl(n,!0).join("/"),l=t.map(e).join("/");return Ki(l)}const Yi=1,ri=2,mn=3,sr=4,tu=5,or=6,lu=7,ar=8,fr=9,nu=10,iu=11,ur={[Yi]:"Link",[ri]:"Route",[mn]:"Router",[sr]:"useFocus",[tu]:"useLocation",[or]:"useMatch",[lu]:"useNavigate",[ar]:"useParams",[fr]:"useResolvable",[nu]:"useResolve",[iu]:"navigate"},Qi=t=>ur[t];function rr(t,e){let l;return t===ri?l=e.path?`path="${e.path}"`:"default":t===Yi?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${Qi(t)} ${l||""} />`}function cr(t,e,l,n){const i=l&&rr(n||t,l),s=i?` -Occurred in: ${i}`:"",a=Qi(t),r=Vf(e)?e(a):e;return`<${a}> ${r}${s}`}const su=t=>(...e)=>t(cr(...e)),ou=su(t=>{throw new Error(t)}),fi=su(console.warn),as=4,_r=3,mr=2,pr=1,dr=1;function hr(t,e){const l=t.default?0:Tl(t.fullPath).reduce((n,i)=>{let s=n;return s+=as,lr(i)?s+=dr:nr(i)?s+=mr:xf(i)?s-=as+pr:s+=_r,s},0);return{route:t,score:l,index:e}}function vr(t){return t.map(hr).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function au(t,e){let l,n;const[i]=e.split("?"),s=Tl(i),a=s[0]==="",r=vr(t);for(let f=0,c=r.length;f({...m,params:d,uri:k});if(m.default){n=h(e);continue}const b=Tl(m.fullPath),g=Math.max(s.length,b.length);let w=0;for(;w{c===".."?f.pop():c!=="."&&f.push(c)}),pi(`/${f.join("/")}`,n)}function fs(t,e){const{pathname:l,hash:n="",search:i="",state:s}=t,a=Tl(e,!0),r=Tl(l,!0);for(;a.length;)a[0]!==r[0]&&ou(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),r.shift();return{pathname:Qn(...r),hash:n,search:i,state:s}}const us=t=>t.length===1?"":t,Xi=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,s=i?us(Rn(t,l)):"",a=i?Rn(t,0,l):t,r=n?us(Rn(a,e)):"";return{pathname:(n?Rn(a,0,e):a)||"/",search:r,hash:s}},gr=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function kr(t,e,l){return Qn(l,br(t,e))}function wr(t,e){const l=Ki(ir(t)),n=Tl(l,!0),i=Tl(e,!0).slice(0,n.length),s=fu({fullPath:l},Qn(...i));return s&&s.uri}const di="POP",Cr="PUSH",Sr="REPLACE";function hi(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function Mr(t){let e=[],l=hi(t),n=di;const i=(s=e)=>s.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(s){e.push(s);const a=()=>{l=hi(t),n=di,i([s])};i([s]);const r=Qf(t,"popstate",a);return()=>{r(),e=e.filter(f=>f!==s)}},navigate(s,a){const{state:r={},replace:f=!1}=a||{};if(n=f?Sr:Cr,Kf(s))a&&fi(iu,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=di,t.history.go(s);else{const c={...r,_key:$u()};try{t.history[f?"replaceState":"pushState"](c,"",s)}catch{t.location[f?"replace":"assign"](s)}}l=hi(t),i()}}}function vi(t,e){return{...Xi(e),state:t}}function Nr(t="/"){let e=0,l=[vi(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,s){e++,l=l.slice(0,e),l.push(vi(n,s))},replaceState(n,i,s){l[e]=vi(n,s)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const Pr=!!(!Al&&window.document&&window.document.createElement),Tr=!Al&&window.location.origin==="null",uu=Mr(Pr&&!Tr?window:Nr()),{navigate:sn}=uu;let ql=null,ru=!0;function qr(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nql.level||t.level===ql.level&&qr(t.routerId,ql.routerId))&&(ql=t)}function Dr(){ql=null}function Ar(){ru=!1}function rs(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Qf(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function Or(t,e){return Number(t.dataset.svnavRouteEnd)===e}function Lr(t){return/^H[1-6]$/i.test(t.tagName)}function cs(t,e=document){return e.querySelector(t)}function Ir(t){let l=cs(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!Or(l,t);){if(Lr(l))return l;const n=cs("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function Rr(t){Promise.resolve(cn(t.focusElement)).then(e=>{const l=e||Ir(t.id);l||fi(mn,`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,ri),!rs(l)&&rs(document.documentElement)})}const Fr=(t,e,l)=>(n,i)=>Ku().then(()=>{if(!ql||ru){Ar();return}if(n&&Rr(ql.route),t.announcements&&i){const{path:s,fullPath:a,meta:r,params:f,uri:c}=ql.route,m=t.createAnnouncement({path:s,fullPath:a,meta:r,params:f,uri:c},cn(l));Promise.resolve(m).then(_=>{e.set(_)})}Dr()}),Ur="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 Br(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Xf(t[6],Ur)],i={};for(let s=0;s`Navigated to ${Q.uri}`,announcements:!0,...b},k=m,R=Ki(m),I=on(Mi),F=on(Sn),M=!I,A=Hr(),O=h&&!(F&&!F.manageFocus),j=ol("");Pl(t,j,Q=>l(0,r=Q));const Y=F?F.disableInlineStyles:g,W=ol([]);Pl(t,W,Q=>l(20,a=Q));const T=ol(null);Pl(t,T,Q=>l(18,i=Q));let B=!1;const X=M?0:F.level+1,K=M?ol((()=>fs(Al?Xi(_):d.location,R))()):I;Pl(t,K,Q=>l(17,n=Q));const V=ol(n);Pl(t,V,Q=>l(19,s=Q));const U=Fr(w,j,K),G=Q=>ae=>ae.filter(re=>re.id!==Q);function se(Q){if(Al){if(B)return;const ae=fu(Q,n.pathname);if(ae)return B=!0,ae}else W.update(ae=>{const re=G(Q.id)(ae);return re.push(Q),re})}function le(Q){W.update(G(Q))}return!M&&m!==_s&&fi(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:m}),M&&(yf(()=>d.listen(ae=>{const re=fs(ae.location,R);V.set(n),K.set(re)})),jn(Mi,K)),jn(Sn,{activeRoute:T,registerRoute:se,unregisterRoute:le,manageFocus:O,level:X,id:A,history:M?d:F.history,basepath:M?R:F.basepath,disableInlineStyles:Y}),t.$$set=Q=>{"basepath"in Q&&l(11,m=Q.basepath),"url"in Q&&l(12,_=Q.url),"history"in Q&&l(13,d=Q.history),"primary"in Q&&l(14,h=Q.primary),"a11y"in Q&&l(15,b=Q.a11y),"disableInlineStyles"in Q&&l(16,g=Q.disableInlineStyles),"$$scope"in Q&&l(21,c=Q.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&m!==k&&fi(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const Q=au(a,n.pathname);T.set(Q)}if(t.$$.dirty[0]&655360&&M){const Q=!!n.hash,ae=!Q&&O,re=!Q||n.pathname!==s.pathname;U(ae,re)}t.$$.dirty[0]&262144&&O&&i&&i.primary&&Er({level:X,routerId:A,route:i})},[r,w,M,A,O,j,Y,W,T,K,V,m,_,d,h,b,g,n,i,s,a,c,f]}class zr extends Tt{constructor(e){super(),Pt(this,e,yr,jr,Nt,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const cu=zr;function Xn(t,e,l=Sn,n=mn){on(l)||ou(t,s=>`You cannot use ${s} outside of a ${Qi(n)}.`,e)}const Wr=t=>{const{subscribe:e}=on(t);return{subscribe:e}};function _u(){return Xn(tu),Wr(Mi)}function mu(){const{history:t}=on(Sn);return t}function pu(){const t=on(Jf);return t?xu(t,e=>e.base):ol("/")}function du(){Xn(nu);const t=pu(),{basepath:e}=on(Sn);return n=>kr(n,cn(t),e)}function Gr(){Xn(lu);const t=du(),{navigate:e}=mu();return(n,i)=>{const s=Kf(n)?n:t(n);return e(s,i)}}const Vr=t=>({params:t&16,location:t&8}),ms=t=>({params:Al?cn(t[10]):t[4],location:t[3],navigate:t[11]});function ps(t){let e,l;return e=new cu({props:{primary:t[1],$$slots:{default:[Qr]},$$scope:{ctx:t}}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&2&&(s.primary=n[1]),i&528409&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function Kr(t){let e;const l=t[18].default,n=yi(l,t,t[19],ms);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&524312)&&Wi(n,l,i,i[19],e?zi(l,i[19],s,Vr):Gi(i[19]),ms)},i(i){e||(Z(n,i),e=!0)},o(i){ie(n,i),e=!1},d(i){n&&n.d(i)}}}function Yr(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Al?cn(t[10]):t[4],t[12]];var s=t[0];function a(r,f){let c={};for(let m=0;m{Me(c,1)}),bt()}s?(e=is(s,a(r,f)),Ne(e.$$.fragment),Z(e.$$.fragment,1),Se(e,l.parentNode,l)):e=null}else if(s){const c=f&7192?Ci(i,[f&8&&{location:r[3]},f&2048&&{navigate:r[11]},f&1040&&$n(Al?cn(r[10]):r[4]),f&4096&&$n(r[12])]):{};e.$set(c)}},i(r){n||(e&&Z(e.$$.fragment,r),n=!0)},o(r){e&&ie(e.$$.fragment,r),n=!1},d(r){r&&N(l),e&&Me(e,r)}}}function Qr(t){let e,l,n,i;const s=[Yr,Kr],a=[];function r(f,c){return f[0]!==null?0:1}return e=r(t),l=a[e]=s[e](t),{c(){l.c(),n=yt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(vt(),ie(a[m],1,1,()=>{a[m]=null}),bt(),l=a[e],l?l.p(f,c):(l=a[e]=s[e](f),l.c()),Z(l,1),l.m(n.parentNode,n))},i(f){i||(Z(l),i=!0)},o(f){ie(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function Xr(t){let e,l,n,i,s,a=[Si(t[7]),{"data-svnav-route-start":t[5]}],r={};for(let _=0;_{f=null}),bt())},i(_){s||(Z(f),s=!0)},o(_){ie(f),s=!1},d(_){_&&(N(e),N(l),N(n),N(i)),f&&f.d(_)}}}const Zr=Yf();function Jr(t,e,l){let n;const i=["path","component","meta","primary"];let s=oi(e,i),a,r,f,c,{$$slots:m={},$$scope:_}=e,{path:d=""}=e,{component:h=null}=e,{meta:b={}}=e,{primary:g=!0}=e;Xn(ri,e);const w=Zr(),{registerRoute:k,unregisterRoute:R,activeRoute:I,disableInlineStyles:F}=on(Sn);Pl(t,I,B=>l(16,a=B));const M=pu();Pl(t,M,B=>l(17,f=B));const A=_u();Pl(t,A,B=>l(3,r=B));const O=ol(null);let j;const Y=ol(),W=ol({});Pl(t,W,B=>l(4,c=B)),jn(Jf,Y),jn(er,W),jn(tr,O);const T=Gr();return Al||Gu(()=>R(w)),t.$$set=B=>{l(24,e=hl(hl({},e),si(B))),l(12,s=oi(e,i)),"path"in B&&l(13,d=B.path),"component"in B&&l(0,h=B.component),"meta"in B&&l(14,b=B.meta),"primary"in B&&l(1,g=B.primary),"$$scope"in B&&l(19,_=B.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const B=d==="",X=Qn(f,d),y={id:w,path:d,meta:b,default:B,fullPath:B?"":X,base:B?f:wr(X,r.pathname),primary:g,focusElement:O};Y.set(y),l(15,j=k(y))}if(t.$$.dirty&98304&&l(2,n=!!(j||a&&a.id===w)),t.$$.dirty&98308&&n){const{params:B}=j||a;W.set(B)}},e=si(e),[h,g,n,r,c,w,I,F,M,A,W,T,s,d,b,j,a,f,m,_]}class $r extends Tt{constructor(e){super(),Pt(this,e,Jr,Xr,Nt,{path:13,component:0,meta:14,primary:1})}}const dl=$r;function xr(t){let e,l,n,i;const s=t[13].default,a=yi(s,t,t[12],null);let r=[{href:t[0]},t[2],t[1]],f={};for(let c=0;cl(11,_=O));const I=Vu(),F=du(),{navigate:M}=mu();function A(O){I("click",O),Ju(O)&&(O.preventDefault(),M(n,{state:w,replace:a||g}))}return t.$$set=O=>{l(19,e=hl(hl({},e),si(O))),l(18,m=oi(e,c)),"to"in O&&l(5,b=O.to),"replace"in O&&l(6,g=O.replace),"state"in O&&l(7,w=O.state),"getProps"in O&&l(8,k=O.getProps),"$$scope"in O&&l(12,h=O.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=F(b,_)),t.$$.dirty&2049&&l(10,i=Ni(_.pathname,n)),t.$$.dirty&2049&&l(9,s=n===_.pathname),t.$$.dirty&2049&&(a=Xi(n)===gr(_)),t.$$.dirty&512&&l(2,r=s?{"aria-current":"page"}:{}),l(1,f=(()=>{if(Vf(k)){const O=k({location:_,href:n,isPartiallyCurrent:i,isCurrent:s});return{...m,...O}}return m})())},e=si(e),[n,f,r,R,A,b,g,w,k,s,i,_,h,d]}class t1 extends Tt{constructor(e){super(),Pt(this,e,e1,xr,Nt,{to:5,replace:6,state:7,getProps:8})}}const pl=t1;function ln(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function l1(t,e){return t>218&&t<242?"#23ac05":t>212&&t<248?"#b1d900":t>208&&t<252?"#a3b200":"#b20000"}function Zi(t,e){let l;return t>90?l="#b20000":t>85?l="#b19601":t>80?l="#a3b200":t>75?l="#569f12":l="#23ac05",l}function zn(t){return t>75?"#23ac05":t>50?"#77d900":t>25?"#94d900":"#569f12"}function ui(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"Unknown"}}function St(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function Je(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 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 245:return"wESP32";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"µHAN 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";case 80:return"Generic ESP32-S3"}return"Unknown"}function Hn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Qt(t,e){return t==1||t==2&&e}function _l(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function Kt(t,e){return t==null||isNaN(t)?"-":(isNaN(e)&&(e=t<1?2:t<10?1:0),t.toFixed(e))}function Ol(t,e){return t.setTime(t.getTime()+e*36e5),t}function n1(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function i1(t){return t=="EOE"?"https://transparency.entsoe.eu/":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}let xn=0;function Wn(t,e){var l="";xn++;var n=function(){setTimeout(Wn,1e3,t,e)};if(t.net.ip&&xn%3==0){if(!t.net.ip){n();return}l="http://"+t.net.ip}else t.hostname&&xn%3==1?l="http://"+t.hostname:t.hostname&&xn%3==2?l="http://"+t.hostname+".local":l="";console&&console.log("Trying url "+l),e&&e(l);var i=new XMLHttpRequest;i.timeout=5e3,i.addEventListener("abort",n),i.addEventListener("error",n),i.addEventListener("timeout",n),i.addEventListener("load",function(s){window.location.href=l||"/"}),i.open("GET",l+"/is-alive",!0),i.send()}function xt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ds(t){return t.startsWith("esp32")?"esp32":t}function ul(t,e){let l=[t,e];return typeof t>"u"?(l[0]="-",l[1]=e):t>=1e9?(l[0]=(t/1e6).toFixed(t>1e10?0:1),l[1]="M"+e):t>1e4?(l[0]=(t/1e3).toFixed(t>1e6?0:t>1e5?1:2),l[1]="k"+e):(l[0]=t.toFixed(0),l[1]=e),l}function Gn(t,e){let l=[Kt(t,2),e];if(typeof t>"u")l[0]="-",l[1]=e;else if(Math.abs(t*100)<100){switch(l[0]=Kt(t*100,2),e){case"NOK":case"DKK":e="øre";break;case"SEK":e="öre";break;case"EUR":e="cent";break;case"CHF":e="rp.";break;default:e=e+"/100"}l[1]=e}return l}let _n="((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}",Ll="[\\x20-\\x7E]+",Mn="[\\x20-\\xFF]+",Vn="[A-Za-z0-9_\\-]+",hu="[0-9A-Fa-f]+",In="[0-9]+",ni={},Pi=[];async function s1(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),s=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),s}let bi;async function vu(){if(Pi.length){let t=Pi.shift();delete ni[t.resource];try{let e=await s1(t.resource,t.options);for(let l in t.callbacks)t.callbacks[l](e.clone())}catch(e){console.error("Error calling "+t.resource,e);for(let l in t.callbacks)t.callbacks[l]()}}bi&&clearTimeout(bi),bi=setTimeout(vu,100)}vu();async function vl(t,e={}){let l;return ni[t]?l=ni[t]:(l={resource:t,options:e,callbacks:[]},ni[t]=l,Pi.push(l)),new Promise(i=>l.callbacks.push(i))}let Nl={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null,if:{eth:!1}};async function ci(){Nl=await(await vl("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),cl.set(Nl)}const cl=ol(Nl,t=>(ci(),function(){}));function o1(t){cl.update(e=>(e.trying=t,e))}let ei=0,hs=-127,vs=null,a1={};const f1=Zf(a1,t=>{let e,l;async function n(){vl("data.json").then(i=>i.json()).then(i=>{t(i),hs!=i.t&&(hs=i.t,setTimeout(u1,2e3)),vs==null&&i.pe&&i.p!=null&&(vs=i.p,gu()),(!Nl||!Nl.chip||Nl.booting||ei>1&&!Hn(Nl.board))&&(ci(),El&&clearTimeout(El),El=setTimeout(Ei,2e3),Dl&&clearTimeout(Dl),Dl=setTimeout(Ai,3e3)),i.u,El||(El=Ei()),Dl||(Dl=Ai());let s=5e3;if(Hn(Nl.board)&&i.v>2.5){let a=3.3-Math.min(3.3,i.v);a>0&&(s=Math.max(a,.1)*10*5e3)}s>5e3&&console.log("Next in "+s+"ms"),e&&clearTimeout(e),e=setTimeout(n,s),ei=0}).catch(i=>{ei++,ei>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(n,15e3),l||(l=setTimeout(Wn,5e3,Nl,o1))):e=setTimeout(n,Hn(Nl.board)?1e4:5e3)})}return n(),function(){clearTimeout(e)}});let Ti={},Fn;const Ji=ol(Ti);async function bu(){let t=!1;Ji.update(e=>{for(var l=0;l<36;l++){if(e[St(l)]==null){t=l<12;break}e[St(l)]=e[St(l+1)]}return e}),t?gu():Fn=setTimeout(bu,(60-new Date().getMinutes())*6e4)}async function gu(){Fn&&(clearTimeout(Fn),Fn=0),Ti=await(await vl("energyprice.json")).json(),Ji.set(Ti),Fn=setTimeout(bu,(60-new Date().getMinutes())*6e4)}let qi={},El;async function Ei(){El&&(clearTimeout(El),El=0),qi=await(await vl("dayplot.json")).json(),ku.set(qi),El=setTimeout(Ei,(60-new Date().getMinutes())*6e4+20)}const ku=ol(qi,t=>function(){});let Di={},Dl;async function Ai(){Dl&&(clearTimeout(Dl),Dl=0),Di=await(await vl("monthplot.json")).json(),wu.set(Di),Dl=setTimeout(Ai,(24-new Date().getHours())*36e5+40)}const wu=ol(Di,t=>function(){});let Oi={};async function u1(){Oi=await(await vl("temperature.json")).json(),Cu.set(Oi)}const Cu=ol(Oi,t=>function(){});let Li={},ti;async function Su(){ti&&(clearTimeout(ti),ti=0),Li=await(await vl("tariff.json")).json(),Mu.set(Li),ti=setTimeout(Su,(60-new Date().getMinutes())*6e4+30)}const Mu=ol(Li,t=>function(){});let gn={c:-1,n:[]};async function r1(){let e=await(await vl("wifiscan.json",{timeout:3e4})).json(),l=[];gn.c=0,gn.n=[];for(let n=0;n(r1(),function(){}));let Ii=!1;const bl=ol(Ii);async function Nu(t){Ii=await(await vl("translations.json"+(t?"?lang="+t:""))).json(),bl.set(Ii)}Nu();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 Pu(t){return await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function gs(t){var f;let e=(((f=t[1].header)==null?void 0:f.uptime)??"Up")+"",l,n,i;function s(c,m){return c[2]>1?v1:c[2]>0?h1:c[3]>1?d1:c[3]>0?p1:c[4]>1?m1:c[4]>0?_1:c1}let a=s(t),r=a(t);return{c(){l=C(e),n=v(),r.c(),i=yt()},m(c,m){P(c,l,m),P(c,n,m),r.m(c,m),P(c,i,m)},p(c,m){var _;m&2&&e!==(e=(((_=c[1].header)==null?void 0:_.uptime)??"Up")+"")&&E(l,e),a===(a=s(c))&&r?r.p(c,m):(r.d(1),r=a(c),r&&(r.c(),r.m(i.parentNode,i)))},d(c){c&&(N(l),N(n),N(i)),r.d(c)}}}function c1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.seconds)??"s")+"",i;return{c(){e=C(t[0]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&1&&E(e,a[0]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.seconds)??"s")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function _1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.minute)??"m")+"",i;return{c(){e=C(t[4]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&16&&E(e,a[4]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minute)??"m")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function m1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.minutes)??"m")+"",i;return{c(){e=C(t[4]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&16&&E(e,a[4]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minutes)??"m")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function p1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.hour)??"h")+"",i;return{c(){e=C(t[3]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&8&&E(e,a[3]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hour)??"h")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function d1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.hours)??"h")+"",i;return{c(){e=C(t[3]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&8&&E(e,a[3]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hours)??"h")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function h1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.day)??"d")+"",i;return{c(){e=C(t[2]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&4&&E(e,a[2]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.day)??"d")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function v1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.days)??"d")+"",i;return{c(){e=C(t[2]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&4&&E(e,a[2]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.days)??"d")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function b1(t){let e,l=t[0]&&gs(t);return{c(){l&&l.c(),e=yt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=gs(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:Ye,o:Ye,d(n){n&&N(e),l&&l.d(n)}}}function g1(t,e,l){let{epoch:n}=e,i={};bl.subscribe(f=>{l(1,i=f)});let s=0,a=0,r=0;return t.$$set=f=>{"epoch"in f&&l(0,n=f.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(2,s=Math.floor(n/86400)),l(3,a=Math.floor(n/3600)),l(4,r=Math.floor(n/60)))},[n,i,s,a,r]}class k1 extends Tt{constructor(e){super(),Pt(this,e,g1,b1,Nt,{epoch:0})}}function w1(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,s){P(i,e,s),o(e,l)},p(i,[s]){s&4&&E(l,i[2]),s&2&&u(e,"title",i[1]),s&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:Ye,o:Ye,d(i){i&&N(e)}}}function C1(t,e,l){let{color:n}=e,{title:i}=e,{text:s}=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,s=a.text)},[n,i,s]}class un extends Tt{constructor(e){super(),Pt(this,e,C1,w1,Nt,{color:0,title:1,text:2})}}function S1(t){let e,l=`${St(t[0].getDate())}.${St(t[0].getMonth()+1)}.${t[0].getFullYear()} ${St(t[0].getHours())}:${St(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=C(l),u(e,"class",t[1])},m(i,s){P(i,e,s),o(e,n)},p(i,s){s&1&&l!==(l=`${St(i[0].getDate())}.${St(i[0].getMonth()+1)}.${i[0].getFullYear()} ${St(i[0].getHours())}:${St(i[0].getMinutes())}`)&&E(n,l),s&2&&u(e,"class",i[1])},d(i){i&&N(e)}}}function M1(t){var n;let e=`${St(t[0].getDate())}. ${t[2].months?(n=t[2].months)==null?void 0:n[t[0].getMonth()]:St(t[0].getMonth()+1)} ${St(t[0].getHours())}:${St(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(i,s){P(i,l,s)},p(i,s){var a;s&5&&e!==(e=`${St(i[0].getDate())}. ${i[2].months?(a=i[2].months)==null?void 0:a[i[0].getMonth()]:St(i[0].getMonth()+1)} ${St(i[0].getHours())}:${St(i[0].getMinutes())}`)&&E(l,e)},d(i){i&&N(l)}}}function N1(t){let e;function l(s,a){return s[3]?M1:S1}let n=l(t),i=n(t);return{c(){i.c(),e=yt()},m(s,a){i.m(s,a),P(s,e,a)},p(s,[a]){n===(n=l(s))&&i?i.p(s,a):(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},i:Ye,o:Ye,d(s){s&&N(e),i.d(s)}}}function P1(t,e,l){let n={};bl.subscribe(f=>{l(2,n=f)});let{timestamp:i}=e,{fullTimeColor:s}=e,{offset:a}=e,r;return t.$$set=f=>{"timestamp"in f&&l(0,i=f.timestamp),"fullTimeColor"in f&&l(1,s=f.fullTimeColor),"offset"in f&&l(4,a=f.offset)},t.$$.update=()=>{t.$$.dirty&17&&(l(3,r=Math.abs(new Date().getTime()-i.getTime())<3e5),isNaN(a)||Ol(i,a-(24+i.getHours()-i.getUTCHours())%24))},[i,s,n,r,a]}class Tu extends Tt{constructor(e){super(),Pt(this,e,P1,N1,Nt,{timestamp:0,fullTimeColor:1,offset:4})}}function T1(t){let e,l,n;return{c(){e=Ot("svg"),l=Ot("path"),n=Ot("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,s){P(i,e,s),o(e,l),o(e,n)},p:Ye,i:Ye,o:Ye,d(i){i&&N(e)}}}class q1 extends Tt{constructor(e){super(),Pt(this,e,null,T1,Nt,{})}}function E1(t){let e,l;return{c(){e=Ot("svg"),l=Ot("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){P(n,e,i),o(e,l)},p:Ye,i:Ye,o:Ye,d(n){n&&N(e)}}}class D1 extends Tt{constructor(e){super(),Pt(this,e,null,E1,Nt,{})}}function A1(t){let e,l;return{c(){e=Ot("svg"),l=Ot("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){P(n,e,i),o(e,l)},p:Ye,i:Ye,o:Ye,d(n){n&&N(e)}}}class O1 extends Tt{constructor(e){super(),Pt(this,e,null,A1,Nt,{})}}function L1(t){let e,l,n=t[2].version+"",i;return{c(){e=C("AMS reader "),l=p("span"),i=C(n)},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&4&&n!==(n=s[2].version+"")&&E(i,n)},d(s){s&&(N(e),N(l))}}}function ks(t){let e,l=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=C(l),i=C("°C"),u(e,"class","flex-none my-auto")},m(s,a){P(s,e,a),o(e,n),o(e,i)},p(s,a){a&2&&l!==(l=(s[1].t>-50?s[1].t.toFixed(1):"-")+"")&&E(n,l)},d(s){s&&N(e)}}}function ws(t){var i,s,a;let e,l=(((i=t[4].header)==null?void 0:i.han)??"HAN")+": "+(((a=(s=t[4].errors)==null?void 0:s.han)==null?void 0:a[t[1].he])??t[1].he),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),o(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.han)??"HAN")+": "+(((_=(m=r[4].errors)==null?void 0:m.han)==null?void 0:_[r[1].he])??r[1].he))&&E(n,l)},d(r){r&&N(e)}}}function Cs(t){var i,s,a;let e,l=(((i=t[4].header)==null?void 0:i.mqtt)??"MQTT")+": "+(((a=(s=t[4].errors)==null?void 0:s.mqtt)==null?void 0:a[t[1].me])??t[1].me),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),o(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.mqtt)??"MQTT")+": "+(((_=(m=r[4].errors)==null?void 0:m.mqtt)==null?void 0:_[r[1].me])??r[1].me))&&E(n,l)},d(r){r&&N(e)}}}function Ss(t){var i,s,a;let e,l=(((i=t[4].header)==null?void 0:i.price)??"PS")+": "+(((a=(s=t[4].errors)==null?void 0:s.price)==null?void 0:a[t[1].ee])??t[1].ee),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),o(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.price)??"PS")+": "+(((_=(m=r[4].errors)==null?void 0:m.price)==null?void 0:_[r[1].ee])??r[1].ee))&&E(n,l)},d(r){r&&N(e)}}}function Ms(t){let e,l,n,i,s,a,r,f;return l=new pl({props:{to:"/configuration",$$slots:{default:[I1]},$$scope:{ctx:t}}}),a=new pl({props:{to:"/status",$$slots:{default:[R1]},$$scope:{ctx:t}}}),{c(){var c,m;e=p("div"),Ne(l.$$.fragment),i=v(),s=p("div"),Ne(a.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title",n=((c=t[4].header)==null?void 0:c.config)??""),u(s,"class","flex-none px-1 mt-1"),u(s,"title",r=((m=t[4].header)==null?void 0:m.status)??"")},m(c,m){P(c,e,m),Se(l,e,null),P(c,i,m),P(c,s,m),Se(a,s,null),f=!0},p(c,m){var h,b;const _={};m&64&&(_.$$scope={dirty:m,ctx:c}),l.$set(_),(!f||m&16&&n!==(n=((h=c[4].header)==null?void 0:h.config)??""))&&u(e,"title",n);const d={};m&64&&(d.$$scope={dirty:m,ctx:c}),a.$set(d),(!f||m&16&&r!==(r=((b=c[4].header)==null?void 0:b.status)??""))&&u(s,"title",r)},i(c){f||(Z(l.$$.fragment,c),Z(a.$$.fragment,c),f=!0)},o(c){ie(l.$$.fragment,c),ie(a.$$.fragment,c),f=!1},d(c){c&&(N(e),N(i),N(s)),Me(l),Me(a)}}}function I1(t){let e,l;return e=new q1({}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function R1(t){let e,l;return e=new D1({}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function F1(t){let e,l;function n(a,r){return a[2].security==0||a[1].a?j1:B1}let i=n(t),s=i(t);return{c(){var a;e=p("div"),s.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",l=(((a=t[4].header)==null?void 0:a.new_version)??"New version")+": "+t[2].upgrade.n)},m(a,r){P(a,e,r),s.m(e,null)},p(a,r){var f;i===(i=n(a))&&s?s.p(a,r):(s.d(1),s=i(a),s&&(s.c(),s.m(e,null))),r&20&&l!==(l=(((f=a[4].header)==null?void 0:f.new_version)??"New version")+": "+a[2].upgrade.n)&&u(e,"title",l)},d(a){a&&N(e),s.d()}}}function U1(t){let e,l,n=t[2].upgrade.t+"",i,s,a=t[3].toFixed(1)+"",r,f;return{c(){e=p("div"),l=C("Upgrading to "),i=C(n),s=C(", "),r=C(a),f=C("%"),u(e,"class","flex-none mr-3 mt-1 text-yellow-300")},m(c,m){P(c,e,m),o(e,l),o(e,i),o(e,s),o(e,r),o(e,f)},p(c,m){m&4&&n!==(n=c[2].upgrade.t+"")&&E(i,n),m&8&&a!==(a=c[3].toFixed(1)+"")&&E(r,a)},d(c){c&&N(e)}}}function B1(t){var r;let e,l=(((r=t[4].header)==null?void 0:r.new_version)??"New version")+"",n,i,s=t[2].upgrade.n+"",a;return{c(){e=p("span"),n=C(l),i=C(": "),a=C(s)},m(f,c){P(f,e,c),o(e,n),o(e,i),o(e,a)},p(f,c){var m;c&16&&l!==(l=(((m=f[4].header)==null?void 0:m.new_version)??"New version")+"")&&E(n,l),c&4&&s!==(s=f[2].upgrade.n+"")&&E(a,s)},d(f){f&&N(e)}}}function j1(t){var m;let e,l,n=(((m=t[4].header)==null?void 0:m.new_version)??"New version")+"",i,s,a=t[2].upgrade.n+"",r,f,c;return{c(){e=p("button"),l=p("span"),i=C(n),s=C(": "),r=C(a),u(l,"class","mt-1"),u(e,"class","flex")},m(_,d){P(_,e,d),o(e,l),o(l,i),o(l,s),o(l,r),f||(c=ce(e,"click",t[5]),f=!0)},p(_,d){var h;d&16&&n!==(n=(((h=_[4].header)==null?void 0:h.new_version)??"New version")+"")&&E(i,n),d&4&&a!==(a=_[2].upgrade.n+"")&&E(r,a)},d(_){_&&N(e),f=!1,c()}}}function H1(t){var _e,de;let e,l,n,i,s,a,r,f,c,m,_,d=(((_e=t[4].header)==null?void 0:_e.mem)??"Free")+"",h,b,g=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",w,k,R,I,F,M,A,O,j,Y,W,T,B,X,y,K,V,U,G,se,le,Q,ae,re,ue,ne,pe,oe,J,$,ke;i=new pl({props:{to:"/",$$slots:{default:[L1]},$$scope:{ctx:t}}}),f=new k1({props:{epoch:t[1].u}});let Ce=t[1].t>-50&&ks(t);F=new un({props:{title:"ESP",text:t[2].booting?((de=t[4].header)==null?void 0:de.booting)??"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":"ESP",color:ln(t[2].booting?2:t[1].em)}}),A=new un({props:{title:"HAN",text:"HAN",color:ln(t[2].booting?9:t[1].hm)}}),j=new un({props:{title:"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":"WiFi",color:ln(t[2].booting?9:t[1].wm)}}),W=new un({props:{title:"MQTT",text:"MQTT",color:ln(t[2].booting?9:t[1].mm)}});let D=(t[1].he<0||t[1].he>0)&&ws(t),S=t[1].me<0&&Cs(t),L=(t[1].ee>0||t[1].ee<0)&&Ss(t);ae=new Tu({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let q=t[2].vndcfg&&t[2].usrcfg&&Ms(t);oe=new O1({});function z(x,he){if(x[2].upgrading)return U1;if(x[2].fwconsent===1&&x[2].upgrade.n)return F1}let ee=z(t),fe=ee&&ee(t);return{c(){var x;e=p("nav"),l=p("div"),n=p("div"),Ne(i.$$.fragment),s=v(),a=p("div"),r=p("div"),Ne(f.$$.fragment),c=v(),Ce&&Ce.c(),m=v(),_=p("div"),h=C(d),b=C(": "),w=C(g),k=C("kb"),R=v(),I=p("div"),Ne(F.$$.fragment),M=v(),Ne(A.$$.fragment),O=v(),Ne(j.$$.fragment),Y=v(),Ne(W.$$.fragment),T=v(),D&&D.c(),B=v(),S&&S.c(),X=v(),L&&L.c(),y=v(),K=p("div"),V=p("div"),U=p("a"),G=p("img"),le=v(),Q=p("div"),Ne(ae.$$.fragment),re=v(),q&&q.c(),ue=v(),ne=p("div"),pe=p("a"),Ne(oe.$$.fragment),$=v(),fe&&fe.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(I,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(G,"class","logo"),ii(G.src,se=(t[0]+"/logo.svg").replace("//","/"))||u(G,"src",se),u(G,"alt","GitHub repo"),u(U,"class","float-right"),u(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(U,"target","_blank"),u(U,"rel","noreferrer"),u(U,"aria-label","GitHub"),u(V,"class","flex-none"),u(Q,"class","flex-none my-auto px-2"),u(pe,"href",_l("")),u(pe,"target","_blank"),u(pe,"rel","noreferrer"),u(ne,"class","flex-none px-1 mt-1"),u(ne,"title",J=((x=t[4].header)==null?void 0:x.doc)??""),u(K,"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","hdr")},m(x,he){P(x,e,he),o(e,l),o(l,n),Se(i,n,null),o(l,s),o(l,a),o(a,r),Se(f,r,null),o(a,c),Ce&&Ce.m(a,null),o(a,m),o(a,_),o(_,h),o(_,b),o(_,w),o(_,k),o(l,R),o(l,I),Se(F,I,null),o(I,M),Se(A,I,null),o(I,O),Se(j,I,null),o(I,Y),Se(W,I,null),o(l,T),D&&D.m(l,null),o(l,B),S&&S.m(l,null),o(l,X),L&&L.m(l,null),o(l,y),o(l,K),o(K,V),o(V,U),o(U,G),o(K,le),o(K,Q),Se(ae,Q,null),o(K,re),q&&q.m(K,null),o(K,ue),o(K,ne),o(ne,pe),Se(oe,pe,null),o(K,$),fe&&fe.m(K,null),ke=!0},p(x,[he]){var xe,Ct,tt;const be={};he&68&&(be.$$scope={dirty:he,ctx:x}),i.$set(be);const Ae={};he&2&&(Ae.epoch=x[1].u),f.$set(Ae),x[1].t>-50?Ce?Ce.p(x,he):(Ce=ks(x),Ce.c(),Ce.m(a,m)):Ce&&(Ce.d(1),Ce=null),(!ke||he&16)&&d!==(d=(((xe=x[4].header)==null?void 0:xe.mem)??"Free")+"")&&E(h,d),(!ke||he&2)&&g!==(g=(x[1].m?(x[1].m/1e3).toFixed(1):"-")+"")&&E(w,g);const Pe={};he&22&&(Pe.text=x[2].booting?((Ct=x[4].header)==null?void 0:Ct.booting)??"Booting":x[1].v>2?x[1].v.toFixed(2)+"V":"ESP"),he&6&&(Pe.color=ln(x[2].booting?2:x[1].em)),F.$set(Pe);const Oe={};he&6&&(Oe.color=ln(x[2].booting?9:x[1].hm)),A.$set(Oe);const Le={};he&2&&(Le.text=x[1].r?x[1].r.toFixed(0)+"dBm":"WiFi"),he&6&&(Le.color=ln(x[2].booting?9:x[1].wm)),j.$set(Le);const De={};he&6&&(De.color=ln(x[2].booting?9:x[1].mm)),W.$set(De),x[1].he<0||x[1].he>0?D?D.p(x,he):(D=ws(x),D.c(),D.m(l,B)):D&&(D.d(1),D=null),x[1].me<0?S?S.p(x,he):(S=Cs(x),S.c(),S.m(l,X)):S&&(S.d(1),S=null),x[1].ee>0||x[1].ee<0?L?L.p(x,he):(L=Ss(x),L.c(),L.m(l,y)):L&&(L.d(1),L=null),(!ke||he&1&&!ii(G.src,se=(x[0]+"/logo.svg").replace("//","/")))&&u(G,"src",se);const Ue={};he&2&&(Ue.timestamp=x[1].c?new Date(x[1].c*1e3):new Date(0)),he&4&&(Ue.offset=x[2].clock_offset),ae.$set(Ue),x[2].vndcfg&&x[2].usrcfg?q?(q.p(x,he),he&4&&Z(q,1)):(q=Ms(x),q.c(),Z(q,1),q.m(K,ue)):q&&(vt(),ie(q,1,1,()=>{q=null}),bt()),(!ke||he&16&&J!==(J=((tt=x[4].header)==null?void 0:tt.doc)??""))&&u(ne,"title",J),ee===(ee=z(x))&&fe?fe.p(x,he):(fe&&fe.d(1),fe=ee&&ee(x),fe&&(fe.c(),fe.m(K,null)))},i(x){ke||(Z(i.$$.fragment,x),Z(f.$$.fragment,x),Z(F.$$.fragment,x),Z(A.$$.fragment,x),Z(j.$$.fragment,x),Z(W.$$.fragment,x),Z(ae.$$.fragment,x),Z(q),Z(oe.$$.fragment,x),ke=!0)},o(x){ie(i.$$.fragment,x),ie(f.$$.fragment,x),ie(F.$$.fragment,x),ie(A.$$.fragment,x),ie(j.$$.fragment,x),ie(W.$$.fragment,x),ie(ae.$$.fragment,x),ie(q),ie(oe.$$.fragment,x),ke=!1},d(x){x&&N(e),Me(i),Me(f),Ce&&Ce.d(),Me(F),Me(A),Me(j),Me(W),D&&D.d(),S&&S.d(),L&&L.d(),Me(ae),q&&q.d(),Me(oe),fe&&fe.d()}}}function y1(t,e,l){let{basepath:n="/"}=e,{data:i={}}=e,s={};function a(){var c;confirm((((c=f.header)==null?void 0:c.upgrade)??"Upgrade to {0}?").replace("{0}",s.upgrade.n))&&(Pu(s.upgrade.n),cl.update(m=>(m.upgrade.t=s.upgrade.n,m.upgrade.p=0,m.upgrading=!0,m)))}let r;cl.subscribe(c=>{l(2,s=c)});let f={};return bl.subscribe(c=>{l(4,f=c)}),t.$$set=c=>{"basepath"in c&&l(0,n=c.basepath),"data"in c&&l(1,i=c.data)},t.$$.update=()=>{t.$$.dirty&4&&l(3,r=Math.max(0,s.upgrade.p))},[n,i,s,r,f,a]}class z1 extends Tt{constructor(e){super(),Pt(this,e,y1,H1,Nt,{basepath:0,data:1})}}function W1(t){let e,l,n,i;return{c(){e=Ot("svg"),l=Ot("path"),n=Ot("path"),u(l,"d",gi(150,150,115,210,510)),u(l,"stroke","rgba(128, 128, 128, 0.15)"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=gi(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(s,a){P(s,e,a),o(e,l),o(e,n)},p(s,[a]){a&1&&i!==(i=gi(150,150,115,210,210+300*s[0]/100))&&u(n,"d",i),a&2&&u(n,"stroke",s[1])},i:Ye,o:Ye,d(s){s&&N(e)}}}function Ns(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 gi(t,e,l,n,i){var s=Ns(t,e,l,i),a=Ns(t,e,l,n),r=i-n<=180?"0":"1",f=["M",s.x,s.y,"A",l,l,0,r,0,a.x,a.y].join(" ");return f}function G1(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=s=>{"pct"in s&&l(0,n=s.pct),"color"in s&&l(1,i=s.color)},[n,i]}class V1 extends Tt{constructor(e){super(),Pt(this,e,G1,W1,Nt,{pct:0,color:1})}}function Ps(t){let e,l,n,i=t[1][0]+"",s,a,r,f=t[1][1]+"",c,m;return{c(){e=p("br"),l=v(),n=p("span"),s=C(i),a=v(),r=p("span"),c=C(f),m=C("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(_,d){P(_,e,d),P(_,l,d),P(_,n,d),o(n,s),P(_,a,d),P(_,r,d),o(r,c),o(r,m)},p(_,d){d&2&&i!==(i=_[1][0]+"")&&E(s,i),d&2&&f!==(f=_[1][1]+"")&&E(c,f)},d(_){_&&(N(e),N(l),N(n),N(a),N(r))}}}function K1(t){let e,l,n,i,s,a,r,f,c,m,_=t[3][0]+"",d,h,b,g=t[3][1]+"",w,k,R;l=new V1({props:{pct:t[4],color:t[2](t[4],document.documentElement.classList.contains("dark"))}});let I=t[1]&&Ps(t);return{c(){e=p("div"),Ne(l.$$.fragment),n=v(),i=p("span"),s=p("span"),a=C(t[0]),r=v(),f=p("br"),c=v(),m=p("span"),d=C(_),h=v(),b=p("span"),w=C(g),k=v(),I&&I.c(),u(s,"class","pl-lab"),u(m,"class","pl-val"),u(b,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(F,M){P(F,e,M),Se(l,e,null),o(e,n),o(e,i),o(i,s),o(s,a),o(i,r),o(i,f),o(i,c),o(i,m),o(m,d),o(i,h),o(i,b),o(b,w),o(i,k),I&&I.m(i,null),R=!0},p(F,[M]){const A={};M&16&&(A.pct=F[4]),M&20&&(A.color=F[2](F[4],document.documentElement.classList.contains("dark"))),l.$set(A),(!R||M&1)&&E(a,F[0]),(!R||M&8)&&_!==(_=F[3][0]+"")&&E(d,_),(!R||M&8)&&g!==(g=F[3][1]+"")&&E(w,g),F[1]?I?I.p(F,M):(I=Ps(F),I.c(),I.m(i,null)):I&&(I.d(1),I=null)},i(F){R||(Z(l.$$.fragment,F),R=!0)},o(F){ie(l.$$.fragment,F),R=!1},d(F){F&&N(e),Me(l),I&&I.d()}}}function Y1(t,e,l){let{val:n}=e,{max:i}=e,{unit:s}=e,{label:a}=e,{sub:r=["",""]}=e,{colorFn:f}=e,c,m=0;return t.$$set=_=>{"val"in _&&l(5,n=_.val),"max"in _&&l(6,i=_.max),"unit"in _&&l(7,s=_.unit),"label"in _&&l(0,a=_.label),"sub"in _&&l(1,r=_.sub),"colorFn"in _&&l(2,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&224&&(l(3,c=ul(n,s)),l(4,m=Math.min(n,i)/i*100))},[a,r,f,c,m,n,i,s]}class qu extends Tt{constructor(e){super(),Pt(this,e,Y1,K1,Nt,{val:5,max:6,unit:7,label:0,sub:1,colorFn:2})}}function Ts(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function qs(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Es(t,e,l){const n=t.slice();return n[15]=e[l],n}function Ds(t){let e,l,n,i,s,a,r,f=(t[0].title||t[0].link)&&As(t),c=rt(t[0].y.ticks),m=[];for(let g=0;g{f=null}),bt()),w&129){c=rt(g[0].y.ticks);let k;for(k=0;k{s=null}),bt())},i(a){n||(Z(s),n=!0)},o(a){ie(s),n=!1},d(a){a&&N(e),i&&i.d(),s&&s.d()}}}function Os(t){let e,l=t[0].title+"",n,i;return{c(){e=p("div"),n=C(l),u(e,"class","text-sm font-bold"),At(()=>t[9].call(e))},m(s,a){P(s,e,a),o(e,n),i=Vi(e,t[9].bind(e))},p(s,a){a&1&&l!==(l=s[0].title+"")&&E(n,l)},d(s){s&&N(e),i()}}}function Ls(t){let e,l,n,i;const s=[X1,Q1],a=[];function r(f,c){return f[0].link.route?0:1}return l=r(t),n=a[l]=s[l](t),{c(){e=p("div"),n.c(),u(e,"class","text-xs text-right")},m(f,c){P(f,e,c),a[l].m(e,null),i=!0},p(f,c){let m=l;l=r(f),l===m?a[l].p(f,c):(vt(),ie(a[m],1,1,()=>{a[m]=null}),bt(),n=a[l],n?n.p(f,c):(n=a[l]=s[l](f),n.c()),Z(n,1),n.m(e,null))},i(f){i||(Z(n),i=!0)},o(f){ie(n),i=!1},d(f){f&&N(e),a[l].d()}}}function Q1(t){let e,l=t[0].link.text+"",n,i,s;return{c(){e=p("a"),n=C(l),u(e,"href",i=t[0].link.url),u(e,"target",s=t[0].link.target)},m(a,r){P(a,e,r),o(e,n)},p(a,r){r&1&&l!==(l=a[0].link.text+"")&&E(n,l),r&1&&i!==(i=a[0].link.url)&&u(e,"href",i),r&1&&s!==(s=a[0].link.target)&&u(e,"target",s)},i:Ye,o:Ye,d(a){a&&N(e)}}}function X1(t){let e,l;return e=new pl({props:{to:t[0].link.url,$$slots:{default:[Z1]},$$scope:{ctx:t}}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.to=n[0].link.url),i&262145&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function Z1(t){let e=t[0].link.text+"",l;return{c(){l=C(e)},m(n,i){P(n,l,i)},p(n,i){i&1&&e!==(e=n[0].link.text+"")&&E(l,e)},d(n){n&&N(l)}}}function Is(t){let e,l,n,i=t[15].label+"",s,a,r,f;return{c(){e=Ot("g"),l=Ot("line"),n=Ot("text"),s=C(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",a=t[15].align=="right"?"85%":""),u(e,"class",r="tick tick-"+t[15].value+" tick-"+t[15].color),u(e,"transform",f="translate(0, "+t[7](t[15].value)+")")},m(c,m){P(c,e,m),o(e,l),o(e,n),o(n,s)},p(c,m){m&1&&i!==(i=c[15].label+"")&&E(s,i),m&1&&a!==(a=c[15].align=="right"?"85%":"")&&u(n,"x",a),m&1&&r!==(r="tick tick-"+c[15].value+" tick-"+c[15].color)&&u(e,"class",r),m&129&&f!==(f="translate(0, "+c[7](c[15].value)+")")&&u(e,"transform",f)},d(c){c&&N(e)}}}function Rs(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&Is(t);return{c(){n&&n.c(),l=yt()},m(i,s){n&&n.m(i,s),P(i,l,s)},p(i,s){s&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,s):(n=Is(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&N(l),n&&n.d(i)}}}function Fs(t){let e,l,n=(t[3]>20||t[13]%2==0)&&Us(t);return{c(){e=Ot("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,s){P(i,e,s),n&&n.m(e,null)},p(i,s){i[3]>20||i[13]%2==0?n?n.p(i,s):(n=Us(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),s&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&N(e),n&&n.d()}}}function Us(t){let e,l=t[11].label+"",n,i;return{c(){e=Ot("text"),n=C(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(s,a){P(s,e,a),o(e,n)},p(s,a){a&1&&l!==(l=s[11].label+"")&&E(n,l),a&8&&i!==(i=s[3]/2)&&u(e,"x",i)},d(s){s&&N(e)}}}function Bs(t){let e=!isNaN(t[6](t[13])),l,n=e&&Fs(t);return{c(){n&&n.c(),l=yt()},m(i,s){n&&n.m(i,s),P(i,l,s)},p(i,s){s&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,s):(n=Fs(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&N(l),n&&n.d(i)}}}function js(t){let e,l,n=t[11].value!==void 0&&Hs(t),i=t[11].value2>1e-4&&Ws(t);return{c(){e=Ot("g"),n&&n.c(),l=Ot("g"),i&&i.c()},m(s,a){P(s,e,a),n&&n.m(e,null),P(s,l,a),i&&i.m(l,null)},p(s,a){s[11].value!==void 0?n?n.p(s,a):(n=Hs(s),n.c(),n.m(e,null)):n&&(n.d(1),n=null),s[11].value2>1e-4?i?i.p(s,a):(i=Ws(s),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(s){s&&(N(e),N(l)),n&&n.d(),i&&i.d()}}}function Hs(t){let e,l,n,i,s,a,r,f=t[3]>15&&ys(t);return{c(){e=Ot("rect"),f&&f.c(),r=yt(),u(e,"x",l=t[6](t[13])+2),u(e,"y",n=t[7](t[11].value)),u(e,"width",i=t[3]-4),u(e,"height",s=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),u(e,"fill",a=t[11].color)},m(c,m){P(c,e,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&u(e,"x",l),m&129&&n!==(n=c[7](c[11].value))&&u(e,"y",n),m&8&&i!==(i=c[3]-4)&&u(e,"width",i),m&129&&s!==(s=c[7](c[0].y.min)-c[7](Math.min(c[0].y.min,0)+c[11].value))&&u(e,"height",s),m&1&&a!==(a=c[11].color)&&u(e,"fill",a),c[3]>15?f?f.p(c,m):(f=ys(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(r)),f&&f.d(c)}}}function ys(t){let e,l=t[11].label+"",n,i,s,a,r,f,c=t[11].title&&zs(t);return{c(){e=Ot("text"),n=C(l),c&&c.c(),f=yt(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",s=t[3]t[7](0)-t[8]&&!t[0].dark?t[11].color:"white"),u(e,"transform",r="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[11].labelAngle?t[11].labelAngle:t[3]m[7](0)-m[8]&&!m[0].dark?m[11].color:"white")&&u(e,"fill",a),_&457&&r!==(r="translate("+(m[6](m[13])+m[3]/2)+" "+(m[7](m[11].value)>m[7](0)-m[8]?m[7](m[11].value)-m[8]:m[7](m[11].value)+10)+") rotate("+(m[11].labelAngle?m[11].labelAngle:m[3]15&&Gs(t);return{c(){e=Ot("rect"),f&&f.c(),r=yt(),u(e,"x",l=t[6](t[13])+2),u(e,"y",n=t[7](0)),u(e,"width",i=t[3]-4),u(e,"height",s=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),u(e,"fill",a=t[11].color2?t[11].color2:t[11].color)},m(c,m){P(c,e,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&u(e,"x",l),m&128&&n!==(n=c[7](0))&&u(e,"y",n),m&8&&i!==(i=c[3]-4)&&u(e,"width",i),m&129&&s!==(s=c[7](c[0].y.min)-c[7](c[0].y.min+c[11].value2))&&u(e,"height",s),m&1&&a!==(a=c[11].color2?c[11].color2:c[11].color)&&u(e,"fill",a),c[3]>15?f?f.p(c,m):(f=Gs(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(r)),f&&f.d(c)}}}function Gs(t){let e,l=t[11].label2+"",n,i,s,a,r,f=t[11].title2&&Vs(t);return{c(){e=Ot("text"),n=C(l),f&&f.c(),r=yt(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor","middle"),u(e,"fill",s=t[7](-t[11].value2)t[10].call(e))},m(s,a){P(s,e,a),i&&i.m(e,null),l=Vi(e,t[10].bind(e)),n=!0},p(s,[a]){s[0].x.ticks&&s[0].points&&s[4]?i?(i.p(s,a),a&17&&Z(i,1)):(i=Ds(s),i.c(),Z(i,1),i.m(e,null)):i&&(vt(),ie(i,1,1,()=>{i=null}),bt())},i(s){n||(Z(i),n=!0)},o(s){ie(i),n=!1},d(s){s&&N(e),i&&i.d(),l()}}}let rn=30;function $1(t,e,l){let{config:n}=e,i,s,a,r,f,c,m,_=0;function d(){_=this.clientHeight,l(5,_)}function h(){i=this.clientWidth,s=this.clientHeight,l(1,i),l(2,s)}return t.$$set=b=>{"config"in b&&l(0,n=b.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,c=s-_);let b=i-(n.padding.left+n.padding.right);l(3,a=b/n.points.length),l(8,m=an.y.max?k=n.padding.bottom:wc||k<0?0:k})}},[n,i,s,a,c,_,r,f,m,d,h]}class dn extends Tt{constructor(e){super(),Pt(this,e,$1,J1,Nt,{config:0})}}function x1(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function e0(t,e,l){let{title:n}=e,{u1:i}=e,{u2:s}=e,{u3:a}=e,{ds:r}=e,f={};function c(m){return{label:Kt(m)+"V",title:m.toFixed(1)+" V",value:isNaN(m)?0:m,color:l1(m||0,document.documentElement.classList.contains("dark"))}}return t.$$set=m=>{"title"in m&&l(1,n=m.title),"u1"in m&&l(2,i=m.u1),"u2"in m&&l(3,s=m.u2),"u3"in m&&l(4,a=m.u3),"ds"in m&&l(5,r=m.ds)},t.$$.update=()=>{if(t.$$.dirty&62){let m=[],_=[];i>0&&(m.push({label:r===1?"L1-L2":"L1"}),_.push(c(i))),s>0&&(m.push({label:r===1?"L1-L3":"L2"}),_.push(c(s))),a>0&&(m.push({label:r===1?"L2-L3":"L3"}),_.push(c(a))),l(0,f={title:n,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:m},points:_})}},[f,n,i,s,a,r]}class t0 extends Tt{constructor(e){super(),Pt(this,e,e0,x1,Nt,{title:1,u1:2,u2:3,u3:4,ds:5})}}function l0(t){var q,z,ee,fe,_e;let e,l,n=(((q=t[0].reactive)==null?void 0:q.title)??"Reactive")+"",i,s,a,r,f=(((z=t[0].reactive)==null?void 0:z.instant_in)??"Instant in")+"",c,m,_,d=t[1][0]+"",h,b,g=t[1][1]+"",w,k,R,I=(((ee=t[0].reactive)==null?void 0:ee.instant_out)??"Instant out")+"",F,M,A,O=t[2][0]+"",j,Y,W=t[2][1]+"",T,B,X,y,K=(((fe=t[0].reactive)==null?void 0:fe.total_in)??"Total in")+"",V,U,G,se=t[3][0]+"",le,Q,ae=t[3][1]+"",re,ue,ne,pe=(((_e=t[0].reactive)==null?void 0:_e.total_out)??"Total out")+"",oe,J,$,ke=t[4][0]+"",Ce,D,S=t[4][1]+"",L;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),r=p("div"),c=C(f),m=v(),_=p("div"),h=C(d),b=v(),w=C(g),k=v(),R=p("div"),F=C(I),M=v(),A=p("div"),j=C(O),Y=v(),T=C(W),B=v(),X=p("div"),y=p("div"),V=C(K),U=v(),G=p("div"),le=C(se),Q=v(),re=C(ae),ue=v(),ne=p("div"),oe=C(pe),J=v(),$=p("div"),Ce=C(ke),D=v(),L=C(S),u(_,"class","text-right"),u(A,"class","text-right"),u(a,"class","grid grid-cols-2 mt-4"),u(G,"class","text-right"),u($,"class","text-right"),u(X,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(de,x){P(de,e,x),o(e,l),o(l,i),o(e,s),o(e,a),o(a,r),o(r,c),o(a,m),o(a,_),o(_,h),o(_,b),o(_,w),o(a,k),o(a,R),o(R,F),o(a,M),o(a,A),o(A,j),o(A,Y),o(A,T),o(e,B),o(e,X),o(X,y),o(y,V),o(X,U),o(X,G),o(G,le),o(G,Q),o(G,re),o(X,ue),o(X,ne),o(ne,oe),o(X,J),o(X,$),o($,Ce),o($,D),o($,L)},p(de,[x]){var he,be,Ae,Pe,Oe;x&1&&n!==(n=(((he=de[0].reactive)==null?void 0:he.title)??"Reactive")+"")&&E(i,n),x&1&&f!==(f=(((be=de[0].reactive)==null?void 0:be.instant_in)??"Instant in")+"")&&E(c,f),x&2&&d!==(d=de[1][0]+"")&&E(h,d),x&2&&g!==(g=de[1][1]+"")&&E(w,g),x&1&&I!==(I=(((Ae=de[0].reactive)==null?void 0:Ae.instant_out)??"Instant out")+"")&&E(F,I),x&4&&O!==(O=de[2][0]+"")&&E(j,O),x&4&&W!==(W=de[2][1]+"")&&E(T,W),x&1&&K!==(K=(((Pe=de[0].reactive)==null?void 0:Pe.total_in)??"Total in")+"")&&E(V,K),x&8&&se!==(se=de[3][0]+"")&&E(le,se),x&8&&ae!==(ae=de[3][1]+"")&&E(re,ae),x&1&&pe!==(pe=(((Oe=de[0].reactive)==null?void 0:Oe.total_out)??"Total out")+"")&&E(oe,pe),x&16&&ke!==(ke=de[4][0]+"")&&E(Ce,ke),x&16&&S!==(S=de[4][1]+"")&&E(L,S)},i:Ye,o:Ye,d(de){de&&N(e)}}}function n0(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:s}=e,{exportTotal:a}=e,{translations:r={}}=e,f,c,m,_;return t.$$set=d=>{"importInstant"in d&&l(5,n=d.importInstant),"exportInstant"in d&&l(6,i=d.exportInstant),"importTotal"in d&&l(7,s=d.importTotal),"exportTotal"in d&&l(8,a=d.exportTotal),"translations"in d&&l(0,r=d.translations)},t.$$.update=()=>{t.$$.dirty&480&&(l(1,f=ul(n,"VAr")),l(2,c=ul(i,"VAr")),l(3,m=ul(s*1e3,"VArh")),l(4,_=ul(a*1e3,"VArh")))},[r,f,c,m,_,n,i,s,a]}class i0 extends Tt{constructor(e){super(),Pt(this,e,n0,l0,Nt,{importInstant:5,exportInstant:6,importTotal:7,exportTotal:8,translations:0})}}function Ys(t){let e;function l(s,a){return s[3]?o0:s0}let n=l(t),i=n(t);return{c(){i.c(),e=yt()},m(s,a){i.m(s,a),P(s,e,a)},p(s,a){n===(n=l(s))&&i?i.p(s,a):(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},d(s){s&&N(e),i.d(s)}}}function s0(t){var z,ee,fe,_e,de;let e,l=(((z=t[4].realtime)==null?void 0:z.consumption)??"Consumption")+"",n,i,s,a,r=xt(((ee=t[4].common)==null?void 0:ee.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",d,h,b=t[6][1]+"",g,w,k,R=xt(((fe=t[4].common)==null?void 0:fe.day)??"Day")+"",I,F,M,A=t[7][0]+"",O,j,Y=t[7][1]+"",W,T,B,X=xt(((_e=t[4].common)==null?void 0:_e.month)??"Month")+"",y,K,V,U=t[8][0]+"",G,se,le=t[8][1]+"",Q,ae,re,ue=(((de=t[4].realtime)==null?void 0:de.last_month)??"Last month")+"",ne,pe,oe,J=t[9][0]+"",$,ke,Ce=t[9][1]+"",D,S,L,q=t[5]&&Qs(t);return{c(){e=p("strong"),n=C(l),i=v(),s=p("div"),a=p("div"),f=C(r),c=v(),m=p("div"),d=C(_),h=v(),g=C(b),w=v(),k=p("div"),I=C(R),F=v(),M=p("div"),O=C(A),j=v(),W=C(Y),T=v(),B=p("div"),y=C(X),K=v(),V=p("div"),G=C(U),se=v(),Q=C(le),ae=v(),re=p("div"),ne=C(ue),pe=v(),oe=p("div"),$=C(J),ke=v(),D=C(Ce),S=v(),q&&q.c(),L=yt(),u(m,"class","text-right"),u(M,"class","text-right"),u(V,"class","text-right"),u(oe,"class","text-right"),u(s,"class","grid grid-cols-2 mb-3")},m(x,he){P(x,e,he),o(e,n),P(x,i,he),P(x,s,he),o(s,a),o(a,f),o(s,c),o(s,m),o(m,d),o(m,h),o(m,g),o(s,w),o(s,k),o(k,I),o(s,F),o(s,M),o(M,O),o(M,j),o(M,W),o(s,T),o(s,B),o(B,y),o(s,K),o(s,V),o(V,G),o(V,se),o(V,Q),o(s,ae),o(s,re),o(re,ne),o(s,pe),o(s,oe),o(oe,$),o(oe,ke),o(oe,D),P(x,S,he),q&&q.m(x,he),P(x,L,he)},p(x,he){var be,Ae,Pe,Oe,Le;he&16&&l!==(l=(((be=x[4].realtime)==null?void 0:be.consumption)??"Consumption")+"")&&E(n,l),he&16&&r!==(r=xt(((Ae=x[4].common)==null?void 0:Ae.hour)??"Hour")+"")&&E(f,r),he&64&&_!==(_=x[6][0]+"")&&E(d,_),he&64&&b!==(b=x[6][1]+"")&&E(g,b),he&16&&R!==(R=xt(((Pe=x[4].common)==null?void 0:Pe.day)??"Day")+"")&&E(I,R),he&128&&A!==(A=x[7][0]+"")&&E(O,A),he&128&&Y!==(Y=x[7][1]+"")&&E(W,Y),he&16&&X!==(X=xt(((Oe=x[4].common)==null?void 0:Oe.month)??"Month")+"")&&E(y,X),he&256&&U!==(U=x[8][0]+"")&&E(G,U),he&256&&le!==(le=x[8][1]+"")&&E(Q,le),he&16&&ue!==(ue=(((Le=x[4].realtime)==null?void 0:Le.last_month)??"Last month")+"")&&E(ne,ue),he&512&&J!==(J=x[9][0]+"")&&E($,J),he&512&&Ce!==(Ce=x[9][1]+"")&&E(D,Ce),x[5]?q?q.p(x,he):(q=Qs(x),q.c(),q.m(L.parentNode,L)):q&&(q.d(1),q=null)},d(x){x&&(N(e),N(i),N(s),N(S),N(L)),q&&q.d(x)}}}function o0(t){var nt,ze,el,tl,ll,nl,il,sl,Ze,dt;let e,l=(((nt=t[4].common)==null?void 0:nt.import)??"Import")+"",n,i,s,a,r=xt(((ze=t[4].common)==null?void 0:ze.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",d,h,b=t[6][1]+"",g,w,k,R,I=xt(((el=t[4].common)==null?void 0:el.day)??"Day")+"",F,M,A,O=t[7][0]+"",j,Y,W=t[7][1]+"",T,B,X,y,K=xt(((tl=t[4].common)==null?void 0:tl.month)??"Month")+"",V,U,G,se=t[8][0]+"",le,Q,ae=t[8][1]+"",re,ue,ne,pe,oe=(((ll=t[4].realtime)==null?void 0:ll.last_mo)??"Last mo.")+"",J,$,ke,Ce=t[9][0]+"",D,S,L=t[9][1]+"",q,z,ee,fe,_e,de=(((nl=t[4].common)==null?void 0:nl.export)??"Export")+"",x,he,be,Ae,Pe=xt(((il=t[4].common)==null?void 0:il.hour)??"Hour")+"",Oe,Le,De,Ue=t[10][0]+"",xe,Ct,tt=t[10][1]+"",ot,Mt,ht,at,it=xt(((sl=t[4].common)==null?void 0:sl.day)??"Day")+"",ft,Lt,We,Re=t[11][0]+"",He,lt,ve=t[11][1]+"",Ee,Qe,me,we,ut=xt(((Ze=t[4].common)==null?void 0:Ze.month)??"Month")+"",Ge,Ft,gt,Be=t[12][0]+"",kt,ct,mt=t[12][1]+"",et,qt,Wt,wt,_t=(((dt=t[4].realtime)==null?void 0:dt.last_mo)??"Last mo.")+"",zt,Xt,Ut,Ht=t[13][0]+"",Yt,$t,Gt=t[13][1]+"",It,Fe,Xe,je=t[5]&&Xs(t),Dt=t[5]&&Zs(t),Bt=t[5]&&Js(t),$e=t[5]&&$s(t),st=t[5]&&xs(t),Et=t[5]&&eo(t),pt=t[5]&&to(t),ge=t[5]&&lo(t);return{c(){e=p("strong"),n=C(l),i=v(),s=p("div"),a=p("div"),f=C(r),c=v(),m=p("div"),d=C(_),h=v(),g=C(b),w=v(),je&&je.c(),k=v(),R=p("div"),F=C(I),M=v(),A=p("div"),j=C(O),Y=v(),T=C(W),B=v(),Dt&&Dt.c(),X=v(),y=p("div"),V=C(K),U=v(),G=p("div"),le=C(se),Q=v(),re=C(ae),ue=v(),Bt&&Bt.c(),ne=v(),pe=p("div"),J=C(oe),$=v(),ke=p("div"),D=C(Ce),S=v(),q=C(L),z=v(),$e&&$e.c(),fe=v(),_e=p("strong"),x=C(de),he=v(),be=p("div"),Ae=p("div"),Oe=C(Pe),Le=v(),De=p("div"),xe=C(Ue),Ct=v(),ot=C(tt),Mt=v(),st&&st.c(),ht=v(),at=p("div"),ft=C(it),Lt=v(),We=p("div"),He=C(Re),lt=v(),Ee=C(ve),Qe=v(),Et&&Et.c(),me=v(),we=p("div"),Ge=C(ut),Ft=v(),gt=p("div"),kt=C(Be),ct=v(),et=C(mt),qt=v(),pt&&pt.c(),Wt=v(),wt=p("div"),zt=C(_t),Xt=v(),Ut=p("div"),Yt=C(Ht),$t=v(),It=C(Gt),Fe=v(),ge&&ge.c(),u(m,"class","text-right"),u(A,"class","text-right"),u(G,"class","text-right"),u(ke,"class","text-right"),u(s,"class",ee="grid grid-cols-"+t[14]+" mb-3"),u(De,"class","text-right"),u(We,"class","text-right"),u(gt,"class","text-right"),u(Ut,"class","text-right"),u(be,"class",Xe="grid grid-cols-"+t[14])},m(Te,te){P(Te,e,te),o(e,n),P(Te,i,te),P(Te,s,te),o(s,a),o(a,f),o(s,c),o(s,m),o(m,d),o(m,h),o(m,g),o(s,w),je&&je.m(s,null),o(s,k),o(s,R),o(R,F),o(s,M),o(s,A),o(A,j),o(A,Y),o(A,T),o(s,B),Dt&&Dt.m(s,null),o(s,X),o(s,y),o(y,V),o(s,U),o(s,G),o(G,le),o(G,Q),o(G,re),o(s,ue),Bt&&Bt.m(s,null),o(s,ne),o(s,pe),o(pe,J),o(s,$),o(s,ke),o(ke,D),o(ke,S),o(ke,q),o(s,z),$e&&$e.m(s,null),P(Te,fe,te),P(Te,_e,te),o(_e,x),P(Te,he,te),P(Te,be,te),o(be,Ae),o(Ae,Oe),o(be,Le),o(be,De),o(De,xe),o(De,Ct),o(De,ot),o(be,Mt),st&&st.m(be,null),o(be,ht),o(be,at),o(at,ft),o(be,Lt),o(be,We),o(We,He),o(We,lt),o(We,Ee),o(be,Qe),Et&&Et.m(be,null),o(be,me),o(be,we),o(we,Ge),o(be,Ft),o(be,gt),o(gt,kt),o(gt,ct),o(gt,et),o(be,qt),pt&&pt.m(be,null),o(be,Wt),o(be,wt),o(wt,zt),o(be,Xt),o(be,Ut),o(Ut,Yt),o(Ut,$t),o(Ut,It),o(be,Fe),ge&&ge.m(be,null)},p(Te,te){var Ie,Zt,fl,ml,gl,kl,wl,Cl,Sl,Ml;te&16&&l!==(l=(((Ie=Te[4].common)==null?void 0:Ie.import)??"Import")+"")&&E(n,l),te&16&&r!==(r=xt(((Zt=Te[4].common)==null?void 0:Zt.hour)??"Hour")+"")&&E(f,r),te&64&&_!==(_=Te[6][0]+"")&&E(d,_),te&64&&b!==(b=Te[6][1]+"")&&E(g,b),Te[5]?je?je.p(Te,te):(je=Xs(Te),je.c(),je.m(s,k)):je&&(je.d(1),je=null),te&16&&I!==(I=xt(((fl=Te[4].common)==null?void 0:fl.day)??"Day")+"")&&E(F,I),te&128&&O!==(O=Te[7][0]+"")&&E(j,O),te&128&&W!==(W=Te[7][1]+"")&&E(T,W),Te[5]?Dt?Dt.p(Te,te):(Dt=Zs(Te),Dt.c(),Dt.m(s,X)):Dt&&(Dt.d(1),Dt=null),te&16&&K!==(K=xt(((ml=Te[4].common)==null?void 0:ml.month)??"Month")+"")&&E(V,K),te&256&&se!==(se=Te[8][0]+"")&&E(le,se),te&256&&ae!==(ae=Te[8][1]+"")&&E(re,ae),Te[5]?Bt?Bt.p(Te,te):(Bt=Js(Te),Bt.c(),Bt.m(s,ne)):Bt&&(Bt.d(1),Bt=null),te&16&&oe!==(oe=(((gl=Te[4].realtime)==null?void 0:gl.last_mo)??"Last mo.")+"")&&E(J,oe),te&512&&Ce!==(Ce=Te[9][0]+"")&&E(D,Ce),te&512&&L!==(L=Te[9][1]+"")&&E(q,L),Te[5]?$e?$e.p(Te,te):($e=$s(Te),$e.c(),$e.m(s,null)):$e&&($e.d(1),$e=null),te&16384&&ee!==(ee="grid grid-cols-"+Te[14]+" mb-3")&&u(s,"class",ee),te&16&&de!==(de=(((kl=Te[4].common)==null?void 0:kl.export)??"Export")+"")&&E(x,de),te&16&&Pe!==(Pe=xt(((wl=Te[4].common)==null?void 0:wl.hour)??"Hour")+"")&&E(Oe,Pe),te&1024&&Ue!==(Ue=Te[10][0]+"")&&E(xe,Ue),te&1024&&tt!==(tt=Te[10][1]+"")&&E(ot,tt),Te[5]?st?st.p(Te,te):(st=xs(Te),st.c(),st.m(be,ht)):st&&(st.d(1),st=null),te&16&&it!==(it=xt(((Cl=Te[4].common)==null?void 0:Cl.day)??"Day")+"")&&E(ft,it),te&2048&&Re!==(Re=Te[11][0]+"")&&E(He,Re),te&2048&&ve!==(ve=Te[11][1]+"")&&E(Ee,ve),Te[5]?Et?Et.p(Te,te):(Et=eo(Te),Et.c(),Et.m(be,me)):Et&&(Et.d(1),Et=null),te&16&&ut!==(ut=xt(((Sl=Te[4].common)==null?void 0:Sl.month)??"Month")+"")&&E(Ge,ut),te&4096&&Be!==(Be=Te[12][0]+"")&&E(kt,Be),te&4096&&mt!==(mt=Te[12][1]+"")&&E(et,mt),Te[5]?pt?pt.p(Te,te):(pt=to(Te),pt.c(),pt.m(be,Wt)):pt&&(pt.d(1),pt=null),te&16&&_t!==(_t=(((Ml=Te[4].realtime)==null?void 0:Ml.last_mo)??"Last mo.")+"")&&E(zt,_t),te&8192&&Ht!==(Ht=Te[13][0]+"")&&E(Yt,Ht),te&8192&&Gt!==(Gt=Te[13][1]+"")&&E(It,Gt),Te[5]?ge?ge.p(Te,te):(ge=lo(Te),ge.c(),ge.m(be,null)):ge&&(ge.d(1),ge=null),te&16384&&Xe!==(Xe="grid grid-cols-"+Te[14])&&u(be,"class",Xe)},d(Te){Te&&(N(e),N(i),N(s),N(fe),N(_e),N(he),N(be)),je&&je.d(),Dt&&Dt.d(),Bt&&Bt.d(),$e&&$e.d(),st&&st.d(),Et&&Et.d(),pt&&pt.d(),ge&&ge.d()}}}function Qs(t){var $,ke,Ce,D,S,L;let e,l=((($=t[4].realtime)==null?void 0:$.cost)??"Cost")+"",n,i,s,a,r=xt(((ke=t[4].common)==null?void 0:ke.hour)??"Hour")+"",f,c,m,_=Kt(t[1].h.c,2)+"",d,h,b,g,w,k=xt(((Ce=t[4].common)==null?void 0:Ce.day)??"Day")+"",R,I,F,M=Kt(t[1].d.c,1)+"",A,O,j,Y,W,T=xt(((D=t[4].common)==null?void 0:D.month)??"Month")+"",B,X,y,K=Kt(t[1].m.c)+"",V,U,G,se,le,Q=(((S=t[4].realtime)==null?void 0:S.last_month)??"Last month")+"",ae,re,ue,ne=Kt((L=t[0].last_month)==null?void 0:L.c)+"",pe,oe,J;return{c(){e=p("strong"),n=C(l),i=v(),s=p("div"),a=p("div"),f=C(r),c=v(),m=p("div"),d=C(_),h=v(),b=C(t[2]),g=v(),w=p("div"),R=C(k),I=v(),F=p("div"),A=C(M),O=v(),j=C(t[2]),Y=v(),W=p("div"),B=C(T),X=v(),y=p("div"),V=C(K),U=v(),G=C(t[2]),se=v(),le=p("div"),ae=C(Q),re=v(),ue=p("div"),pe=C(ne),oe=v(),J=C(t[2]),u(m,"class","text-right"),u(F,"class","text-right"),u(y,"class","text-right"),u(ue,"class","text-right"),u(s,"class","grid grid-cols-2")},m(q,z){P(q,e,z),o(e,n),P(q,i,z),P(q,s,z),o(s,a),o(a,f),o(s,c),o(s,m),o(m,d),o(m,h),o(m,b),o(s,g),o(s,w),o(w,R),o(s,I),o(s,F),o(F,A),o(F,O),o(F,j),o(s,Y),o(s,W),o(W,B),o(s,X),o(s,y),o(y,V),o(y,U),o(y,G),o(s,se),o(s,le),o(le,ae),o(s,re),o(s,ue),o(ue,pe),o(ue,oe),o(ue,J)},p(q,z){var ee,fe,_e,de,x,he;z&16&&l!==(l=(((ee=q[4].realtime)==null?void 0:ee.cost)??"Cost")+"")&&E(n,l),z&16&&r!==(r=xt(((fe=q[4].common)==null?void 0:fe.hour)??"Hour")+"")&&E(f,r),z&2&&_!==(_=Kt(q[1].h.c,2)+"")&&E(d,_),z&4&&E(b,q[2]),z&16&&k!==(k=xt(((_e=q[4].common)==null?void 0:_e.day)??"Day")+"")&&E(R,k),z&2&&M!==(M=Kt(q[1].d.c,1)+"")&&E(A,M),z&4&&E(j,q[2]),z&16&&T!==(T=xt(((de=q[4].common)==null?void 0:de.month)??"Month")+"")&&E(B,T),z&2&&K!==(K=Kt(q[1].m.c)+"")&&E(V,K),z&4&&E(G,q[2]),z&16&&Q!==(Q=(((x=q[4].realtime)==null?void 0:x.last_month)??"Last month")+"")&&E(ae,Q),z&1&&ne!==(ne=Kt((he=q[0].last_month)==null?void 0:he.c)+"")&&E(pe,ne),z&4&&E(J,q[2])},d(q){q&&(N(e),N(i),N(s))}}}function Xs(t){let e,l=Kt(t[1].h.c,2)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Kt(a[1].h.c,2)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&N(e)}}}function Zs(t){let e,l=Kt(t[1].d.c,1)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Kt(a[1].d.c,1)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&N(e)}}}function Js(t){let e,l=Kt(t[1].m.c)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Kt(a[1].m.c)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&N(e)}}}function $s(t){var a;let e,l=Kt((a=t[0].last_month)==null?void 0:a.c)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(r,f){P(r,e,f),o(e,n),o(e,i),o(e,s)},p(r,f){var c;f&1&&l!==(l=Kt((c=r[0].last_month)==null?void 0:c.c)+"")&&E(n,l),f&4&&E(s,r[2])},d(r){r&&N(e)}}}function xs(t){let e,l=Kt(t[1].h.i,2)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Kt(a[1].h.i,2)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&N(e)}}}function eo(t){let e,l=Kt(t[1].d.i,1)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Kt(a[1].d.i,1)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&N(e)}}}function to(t){let e,l=Kt(t[1].m.i)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Kt(a[1].m.i)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&N(e)}}}function lo(t){var a;let e,l=Kt((a=t[0].last_month)==null?void 0:a.i)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(r,f){P(r,e,f),o(e,n),o(e,i),o(e,s)},p(r,f){var c;f&1&&l!==(l=Kt((c=r[0].last_month)==null?void 0:c.i)+"")&&E(n,l),f&4&&E(s,r[2])},d(r){r&&N(e)}}}function a0(t){var m;let e,l,n=(((m=t[4].realtime)==null?void 0:m.title)??"Real time calculations")+"",i,s,a,r,f,c=t[1]&&Ys(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("br"),r=p("br"),f=v(),c&&c.c(),u(e,"class","mx-2 text-sm")},m(_,d){P(_,e,d),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),c&&c.m(e,null)},p(_,[d]){var h;d&16&&n!==(n=(((h=_[4].realtime)==null?void 0:h.title)??"Real time calculations")+"")&&E(i,n),_[1]?c?c.p(_,d):(c=Ys(_),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:Ye,o:Ye,d(_){_&&N(e),c&&c.d()}}}function f0(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:s}=e,{hasExport:a}=e,{translations:r={}}=e,f,c,m,_,d,h,b,g,w=!1,k=3;return t.$$set=R=>{"sysinfo"in R&&l(0,n=R.sysinfo),"data"in R&&l(1,i=R.data),"currency"in R&&l(2,s=R.currency),"hasExport"in R&&l(3,a=R.hasExport),"translations"in R&&l(4,r=R.translations)},t.$$.update=()=>{var R,I,F,M,A,O,j,Y;t.$$.dirty&35&&(l(5,w=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(14,k=w?3:2),l(6,f=ul(((R=i==null?void 0:i.h)==null?void 0:R.u)*1e3,"Wh")),l(7,c=ul(((I=i==null?void 0:i.d)==null?void 0:I.u)*1e3,"Wh")),l(8,m=ul(((F=i==null?void 0:i.m)==null?void 0:F.u)*1e3,"Wh")),l(9,_=ul(((M=n==null?void 0:n.last_month)==null?void 0:M.u)*1e3,"Wh")),l(10,d=ul(((A=i==null?void 0:i.h)==null?void 0:A.p)*1e3,"Wh")),l(11,h=ul(((O=i==null?void 0:i.d)==null?void 0:O.p)*1e3,"Wh")),l(12,b=ul(((j=i==null?void 0:i.m)==null?void 0:j.p)*1e3,"Wh")),l(13,g=ul(((Y=n==null?void 0:n.last_month)==null?void 0:Y.p)*1e3,"Wh")))},[n,i,s,a,r,w,f,c,m,_,d,h,b,g,k]}class u0 extends Tt{constructor(e){super(),Pt(this,e,f0,a0,Nt,{sysinfo:0,data:1,currency:2,hasExport:3,translations:4})}}function r0(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function c0(t,e,l){let{title:n}=e,{json:i}=e,{sysinfo:s}=e,a={},r,f,c=document.documentElement.classList.contains("dark");return t.$$set=m=>{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,s=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=i.currency,_=new Date().getUTCHours(),d=0,h=0,b=0,g=[],w=[],k=[];l(5,f=l(4,r=0));let R=new Date;for(Ol(R,s.clock_offset-(24+R.getHours()-R.getUTCHours())%24),d=_;d<24&&(h=i[St(b++)],h!=null);d++)w.push({label:St(R.getHours())}),k.push(h*100),l(5,f=Math.min(f,h*100)),l(4,r=Math.max(r,h*100)),Ol(R,1);for(d=0;d<24&&(h=i[St(b++)],h!=null);d++)w.push({label:St(R.getHours())}),k.push(h*100),l(5,f=Math.min(f,h*100)),l(4,r=Math.max(r,h*100)),Ol(R,1);let I=Gn(Math.max(Math.abs(f)/100,Math.abs(r)/100),m);if(I&&I[1]&&I[1]!=m)for(m=I[1],l(5,f*=100),l(4,r*=100),d=0;d=0?j.toFixed(Y):"",title:j>=0?j.toFixed(2)+" "+m:"",value:h>=0?Math.abs(h):0,label2:j<0?j.toFixed(Y):"",title2:j<0?j.toFixed(2)+" "+m:"",value2:h<0?Math.abs(h):0,color:c?"#5c2da5":"#7c3aed"})}let M=Math.max(r,Math.abs(f));if(f<0){l(5,f=Math.min(M/4*-1,f));let j=Math.ceil(Math.abs(f)/M*4),Y=f/j;for(d=1;d{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,s=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],d=[],h=[];l(5,f=l(4,r=0));let b=new Date,g=new Date;g.setDate(0),g.setHours(12);let w=(g.getHours()-g.getUTCHours())%24-s.clock_offset,k=b.getUTCHours();for(Ol(b,-w-24),m=k;m<24;m++){let M=i["i"+St(m)],A=i["e"+St(m)];M===void 0&&(M=0),A===void 0&&(A=0),d.push({label:St(b.getHours())}),h.push({label:M.toFixed(1),title:M.toFixed(2)+" kWh",value:M*10,label2:A.toFixed(1),title2:A.toFixed(2)+" kWh",value2:A*10,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,A*10)),l(4,r=Math.max(r,M*10)),Ol(b,1)}for(m=0;m{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,s=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],d=[],h=[];l(5,f=l(4,r=0));let b=new Date,g=new Date;g.setDate(0),g.setHours(12);let w=(g.getHours()-g.getUTCHours())%24-s.clock_offset;for(Ol(b,-w),Ol(g,-w),m=b.getDate();m<=g.getDate();m++){let F=i["i"+St(m)],M=i["e"+St(m)];F===void 0&&(F=0),M===void 0&&(M=0),d.push({label:St(m)}),h.push({label:F.toFixed(F<10?1:0),title:F.toFixed(2)+" kWh",value:F,label2:M.toFixed(M<10?1:0),title2:M.toFixed(2)+" kWh",value2:M,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,M)),l(4,r=Math.max(r,F))}for(m=1;m{"title"in c&&l(1,n=c.title),"json"in c&&l(2,i=c.json)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,m=0,_=[],d=[],h=[];i.s&&i.s.forEach((w,k)=>{var R=w.n?w.n:w.a;m=w.v,m==-127&&(m=0),d.push({label:R.slice(-4)}),h.push({label:m.toFixed(1),value:m,color:s?"#5c2da5":"#7c3aed"}),l(4,f=Math.min(f,m)),l(3,r=Math.max(r,m))}),l(3,r=Math.ceil(r)),l(4,f=Math.floor(f));let b=r;f<0&&(b+=Math.abs(f));let g=b/4;for(c=0;c<5;c++)m=f+g*c,_.push({value:m,label:m.toFixed(1)});l(0,a={title:n+" (°C)",dark:document.documentElement.classList.contains("dark"),height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:f,max:r,ticks:_},x:{ticks:d},points:h})}},[a,n,i,r,f]}class w0 extends Tt{constructor(e){super(),Pt(this,e,k0,g0,Nt,{title:1,json:2})}}function C0(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}let S0=0;function M0(t,e,l){let{title:n}=e,{translations:i={}}=e,s=document.documentElement.classList.contains("dark"),a={},r=0,{tariffData:f}=e;return t.$$set=c=>{"title"in c&&l(1,n=c.title),"translations"in c&&l(2,i=c.translations),"tariffData"in c&&l(3,f=c.tariffData)},t.$$.update=()=>{var c;if(t.$$.dirty&30){let m=0,_=[],d=[],h=[];if(_.push({value:0,label:0}),f&&f.p)for(m=0;m0?St(b.d)+"."+(i.months?(c=i.months)==null?void 0:c[new Date().getMonth()]:St(new Date().getMonth()+1)):"-"}),l(4,r=Math.max(r,b.v))}if(f&&f.t){for(m=0;m=r)break;_.push({value:b,label:b})}_.push({label:f.m.toFixed(1),align:"right",color:"green",value:f.m})}f&&f.c&&(_.push({label:f.c.toFixed(0),color:"orange",value:f.c}),l(4,r=Math.max(r,f.c))),l(4,r=Math.ceil(r)),l(0,a={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:35,bottom:20,left:35},y:{min:S0,max:r,ticks:_},x:{ticks:d},points:h})}},[a,n,i,f,r]}class N0 extends Tt{constructor(e){super(),Pt(this,e,M0,C0,Nt,{title:1,translations:2,tariffData:3})}}let an=0,P0={data:[]};async function xi(){let e=await(await vl(an<0?"realtime.json":"realtime.json?offset="+an)).json();es.update(l=>{for(let n=0;n=0&&(an+=e.size,ankn||Ri-kn>300?(xi(),ki=0):es.update(t=>{if(t.lastUpdate)for(;kn>t.lastUpdate;)t.data.unshift(Eu),t.data=t.data.slice(0,t.size),t.lastUpdate+=10,ki++;else t.lastUpdate=kn;return t})}function E0(t){if(Eu=t.i-t.e,kn=t.u,!no){xi(),no=!0,Ri=kn;return}T0()&&q0()}function io(t,e,l){const n=t.slice();return n[18]=e[l],n[20]=l,n}function so(t,e,l){const n=t.slice();return n[21]=e[l],n}function D0(t){let e,l,n;return{c(){e=p("strong"),l=C(t[0]),n=C(" not available"),u(e,"class","text-sm")},m(i,s){P(i,e,s),o(e,l),o(e,n)},p(i,s){s&1&&E(l,i[0])},d(i){i&&N(e)}}}function A0(t){let e,l,n,i,s,a,r,f=t[8]&&oo(t);return{c(){e=p("strong"),l=C(t[0]),n=C(" ("),i=C(t[12]),s=C(")"),a=v(),f&&f.c(),r=yt(),u(e,"class","text-sm")},m(c,m){P(c,e,m),o(e,l),o(e,n),o(e,i),o(e,s),P(c,a,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&1&&E(l,c[0]),m&4096&&E(i,c[12]),c[8]?f?f.p(c,m):(f=oo(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(a),N(r)),f&&f.d(c)}}}function oo(t){let e,l,n,i,s,a=rt(t[8]),r=[];for(let m=0;mt[17].call(e))},m(a,r){P(a,e,r),s.m(e,null),l=Vi(e,t[17].bind(e))},p(a,[r]){i===(i=n(a))&&s?s.p(a,r):(s.d(1),s=i(a),s&&(s.c(),s.m(e,null)))},i:Ye,o:Ye,d(a){a&&N(e),s.d(),l()}}}function L0(t,e,l){let{title:n}=e,i=document.documentElement.classList.contains("dark"),s=null;es.subscribe(M=>{l(16,s=M)});let a=!1,r,f,c,m,_,d,h,b=function(M,A,O){return Math.ceil(_-(M-A)/(O-A)*_)-25},g=function(M){return 30+Math.ceil(M/s.size*(d-35))},w,k,R,I;function F(){c=this.clientWidth,m=this.clientHeight,l(3,c),l(4,m)}return t.$$set=M=>{"title"in M&&l(0,n=M.title)},t.$$.update=()=>{if(t.$$.dirty&67582)if(l(5,_=parseInt(m)-50),l(6,d=c-35),l(10,R=d/s.size),l(2,f=0),l(1,r=0),s.data&&_>10&&d>100&&R>.1){l(11,a=!0);for(let O in s.data){let j=s.data[O];isNaN(j)&&(j=0),l(1,r=Math.max(Math.ceil(j/1e3)*1e3,r)),l(2,f=Math.min(Math.floor(j/1e3)*1e3,f))}let M=r-f;l(12,I=r>2500?"kW":"W"),l(8,w=[]);for(let O=f;O2500?(O/1e3).toFixed(1):O}),!(w.length>6));O+=M/5);l(9,k=[]);for(let O=0;O12));O+=Math.round(s.size/Math.round(d/120)));let A=s.size;l(7,h=g(s.size)+","+b(0,f,r)+" "+g(1)+","+b(0,f,r));for(let O in s.data){if(A<0)break;let j=s.data[O];isNaN(j)&&(j=0),l(7,h=g(A--)+","+b(j,f,r)+" "+h)}}else l(11,a=!1)},[n,r,f,c,m,_,d,h,w,k,R,a,I,i,b,g,s,F]}class I0 extends Tt{constructor(e){super(),Pt(this,e,L0,O0,Nt,{title:0})}}function R0(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function F0(t,e,l){let{title:n}=e,{unit:i=""}=e,{l1:s=!1}=e,{l2:a=!1}=e,{l2x:r=!1}=e,{l3:f=!1}=e,{l1i:c=0}=e,{l2i:m=0}=e,{l3i:_=0}=e,{l1e:d=0}=e,{l2e:h=0}=e,{l3e:b=0}=e,{maxImport:g=0}=e,{maxExport:w=0}=e,{importColorFn:k}=e,{exportColorFn:R}=e,I={};function F(M,A){return{label:Kt(M>900?M/1e3:M)+(M>900?"k":"")+i,title:M.toFixed(2)+" "+i,value:isNaN(M)?0:M,color:k(M?M/g*100:0,document.documentElement.classList.contains("dark")),label2:Kt(A>900?A/1e3:A)+(A>900?"k":"")+i,title2:A.toFixed(2)+" "+i,value2:isNaN(A)?0:A,color2:R(A?A/w*100:0)}}return t.$$set=M=>{"title"in M&&l(1,n=M.title),"unit"in M&&l(2,i=M.unit),"l1"in M&&l(3,s=M.l1),"l2"in M&&l(4,a=M.l2),"l2x"in M&&l(5,r=M.l2x),"l3"in M&&l(6,f=M.l3),"l1i"in M&&l(7,c=M.l1i),"l2i"in M&&l(8,m=M.l2i),"l3i"in M&&l(9,_=M.l3i),"l1e"in M&&l(10,d=M.l1e),"l2e"in M&&l(11,h=M.l2e),"l3e"in M&&l(12,b=M.l3e),"maxImport"in M&&l(13,g=M.maxImport),"maxExport"in M&&l(14,w=M.maxExport),"importColorFn"in M&&l(15,k=M.importColorFn),"exportColorFn"in M&&l(16,R=M.exportColorFn)},t.$$.update=()=>{if(t.$$.dirty&32762){let M=[],A=[];s&&(M.push({label:"L1"}),A.push(F(c,d))),a&&(r?(M.push({label:"L2"}),A.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(M.push({label:"L2"}),A.push(F(m,h)))),f&&(M.push({label:"L3"}),A.push(F(_,b)));let O=[];if(w){let j=w>g?4:w*4/g;O.push({value:-w,label:"-100%"}),j>=4&&O.push({value:-w/4*3,label:"-75%"}),j>=2&&O.push({value:-w/2,label:"-50%"}),j>=4&&O.push({value:-w/4,label:"-25%"})}if(O.push({value:0,label:"0%"}),g){let j=g>w?4:g*4/w;O.push({value:g/4,label:"25%"}),j>=4&&O.push({value:g/2,label:"50%"}),j>=2&&O.push({value:g/4*3,label:"75%"}),j>=4&&O.push({value:g,label:"100%"})}l(0,I={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:15,bottom:20,left:35},y:{min:-w,max:g,ticks:O},x:{ticks:M},points:A})}},[I,n,i,s,a,r,f,c,m,_,d,h,b,g,w,k,R]}class ts extends Tt{constructor(e){super(),Pt(this,e,F0,R0,Nt,{title:1,unit:2,l1:3,l2:4,l2x:5,l3:6,l1i:7,l2i:8,l3i:9,l1e:10,l2e:11,l3e:12,maxImport:13,maxExport:14,importColorFn:15,exportColorFn:16})}}function co(t){var k;let e,l,n,i,s,a,r=(t[0].mt?ui(t[0].mt):"-")+"",f,c,m,_=t[11][0]+"",d,h,b=t[11][1]+"",g,w;return i=new qu({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:((k=t[6].common)==null?void 0:k.import)??"Import",sub:Gn(t[0].p,t[0].pc),colorFn:Zi}}),{c(){e=p("div"),l=p("div"),n=p("div"),Ne(i.$$.fragment),s=v(),a=p("div"),f=C(r),c=v(),m=p("div"),d=C(_),h=v(),g=C(b),u(n,"class","col-span-2"),u(m,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(R,I){P(R,e,I),o(e,l),o(l,n),Se(i,n,null),o(l,s),o(l,a),o(a,f),o(l,c),o(l,m),o(m,d),o(m,h),o(m,g),w=!0},p(R,I){var M;const F={};I&1&&(F.val=R[0].i?R[0].i:0),I&1&&(F.max=R[0].im?R[0].im:15e3),I&64&&(F.label=((M=R[6].common)==null?void 0:M.import)??"Import"),I&1&&(F.sub=Gn(R[0].p,R[0].pc)),i.$set(F),(!w||I&1)&&r!==(r=(R[0].mt?ui(R[0].mt):"-")+"")&&E(f,r),(!w||I&2048)&&_!==(_=R[11][0]+"")&&E(d,_),(!w||I&2048)&&b!==(b=R[11][1]+"")&&E(g,b)},i(R){w||(Z(i.$$.fragment,R),w=!0)},o(R){ie(i.$$.fragment,R),w=!1},d(R){R&&N(e),Me(i)}}}function _o(t){var g;let e,l,n,i,s,a,r,f,c=t[12][0]+"",m,_,d=t[12][1]+"",h,b;return i=new qu({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:((g=t[6].common)==null?void 0:g.export)??"Export",sub:Gn(t[0].px,t[0].pc),colorFn:zn}}),{c(){e=p("div"),l=p("div"),n=p("div"),Ne(i.$$.fragment),s=v(),a=p("div"),r=v(),f=p("div"),m=C(c),_=v(),h=C(d),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(w,k){P(w,e,k),o(e,l),o(l,n),Se(i,n,null),o(l,s),o(l,a),o(l,r),o(l,f),o(f,m),o(f,_),o(f,h),b=!0},p(w,k){var I;const R={};k&1&&(R.val=w[0].e?w[0].e:0),k&1&&(R.max=w[0].om?w[0].om*1e3:1e4),k&64&&(R.label=((I=w[6].common)==null?void 0:I.export)??"Export"),k&1&&(R.sub=Gn(w[0].px,w[0].pc)),i.$set(R),(!b||k&4096)&&c!==(c=w[12][0]+"")&&E(m,c),(!b||k&4096)&&d!==(d=w[12][1]+"")&&E(h,d)},i(w){b||(Z(i.$$.fragment,w),b=!0)},o(w){ie(i.$$.fragment,w),b=!1},d(w){w&&N(e),Me(i)}}}function mo(t){let e,l,n=t[0].l1&&po(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=po(i),n.c(),Z(n,1),n.m(e,null)):n&&(vt(),ie(n,1,1,()=>{n=null}),bt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function po(t){var n;let e,l;return e=new t0({props:{title:((n=t[6].common)==null?void 0:n.voltage)??"Volt",u1:t[0].l1.u,u2:t[0].l2.u,u3:t[0].l3.u,ds:t[0].ds}}),{c(){Ne(e.$$.fragment)},m(i,s){Se(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].common)==null?void 0:r.voltage)??"Volt"),s&1&&(a.u1=i[0].l1.u),s&1&&(a.u2=i[0].l2.u),s&1&&(a.u3=i[0].l3.u),s&1&&(a.ds=i[0].ds),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Me(e,i)}}}function ho(t){let e,l,n=t[0].l1&&vo(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=vo(i),n.c(),Z(n,1),n.m(e,null)):n&&(vt(),ie(n,1,1,()=>{n=null}),bt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function vo(t){var n;let e,l;return e=new ts({props:{title:((n=t[6].common)==null?void 0:n.amperage)??"Amp",unit:"A",importColorFn:Zi,exportColorFn:zn,maxImport:t[0].mf,l1:t[8],l2:t[9],l3:t[10],l2x:t[0].l2.e,l1i:Math.max(Math.abs(t[0].l1.i),0),l2i:Math.max(Math.abs(t[0].l2.i),0),l3i:Math.max(Math.abs(t[0].l3.i),0)}}),{c(){Ne(e.$$.fragment)},m(i,s){Se(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].common)==null?void 0:r.amperage)??"Amp"),s&1&&(a.maxImport=i[0].mf),s&256&&(a.l1=i[8]),s&512&&(a.l2=i[9]),s&1024&&(a.l3=i[10]),s&1&&(a.l2x=i[0].l2.e),s&1&&(a.l1i=Math.max(Math.abs(i[0].l1.i),0)),s&1&&(a.l2i=Math.max(Math.abs(i[0].l2.i),0)),s&1&&(a.l3i=Math.max(Math.abs(i[0].l3.i),0)),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Me(e,i)}}}function bo(t){let e,l,n=t[0].l1&&go(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=go(i),n.c(),Z(n,1),n.m(e,null)):n&&(vt(),ie(n,1,1,()=>{n=null}),bt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function go(t){var n;let e,l;return e=new ts({props:{title:((n=t[6].dashboard)==null?void 0:n.phase)??"Phase",unit:"W",importColorFn:Zi,exportColorFn:zn,maxImport:(t[0].mf?t[0].mf:32)*230,maxExport:t[0].om?t[13]?t[0].om*1e3/Math.sqrt(3):t[0].om*1e3:0,l1:t[8],l2:t[9],l3:t[10],l1i:t[0].l1.p,l2i:t[0].l2.p,l3i:t[0].l3.p,l1e:t[0].l1.q,l2e:t[0].l2.q,l3e:t[0].l3.q}}),{c(){Ne(e.$$.fragment)},m(i,s){Se(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].dashboard)==null?void 0:r.phase)??"Phase"),s&1&&(a.maxImport=(i[0].mf?i[0].mf:32)*230),s&8193&&(a.maxExport=i[0].om?i[13]?i[0].om*1e3/Math.sqrt(3):i[0].om*1e3:0),s&256&&(a.l1=i[8]),s&512&&(a.l2=i[9]),s&1024&&(a.l3=i[10]),s&1&&(a.l1i=i[0].l1.p),s&1&&(a.l2i=i[0].l2.p),s&1&&(a.l3i=i[0].l3.p),s&1&&(a.l1e=i[0].l1.q),s&1&&(a.l2e=i[0].l2.q),s&1&&(a.l3e=i[0].l3.q),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Me(e,i)}}}function ko(t){let e,l,n=t[0].l1&&wo(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=wo(i),n.c(),Z(n,1),n.m(e,null)):n&&(vt(),ie(n,1,1,()=>{n=null}),bt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function wo(t){var n;let e,l;return e=new ts({props:{title:((n=t[6].dashboard)==null?void 0:n.pf)??"Pf",importColorFn:zn,exportColorFn:zn,maxImport:1,l1:t[8],l2:t[9],l3:t[10],l1i:t[0].l1.f,l2i:t[0].l2.f,l3i:t[0].l3.f}}),{c(){Ne(e.$$.fragment)},m(i,s){Se(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].dashboard)==null?void 0:r.pf)??"Pf"),s&256&&(a.l1=i[8]),s&512&&(a.l2=i[9]),s&1024&&(a.l3=i[10]),s&1&&(a.l1i=i[0].l1.f),s&1&&(a.l2i=i[0].l2.f),s&1&&(a.l3i=i[0].l3.f),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Me(e,i)}}}function Co(t){let e,l,n;return l=new i0({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec,translations:t[6]}}),{c(){e=p("div"),Ne(l.$$.fragment),u(e,"class","cnt")},m(i,s){P(i,e,s),Se(l,e,null),n=!0},p(i,s){const a={};s&1&&(a.importInstant=i[0].ri),s&1&&(a.exportInstant=i[0].re),s&1&&(a.importTotal=i[0].ric),s&1&&(a.exportTotal=i[0].rec),s&64&&(a.translations=i[6]),l.$set(a)},i(i){n||(Z(l.$$.fragment,i),n=!0)},o(i){ie(l.$$.fragment,i),n=!1},d(i){i&&N(e),Me(l)}}}function So(t){let e,l,n;return l=new u0({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0,translations:t[6]}}),{c(){e=p("div"),Ne(l.$$.fragment),u(e,"class","cnt")},m(i,s){P(i,e,s),Se(l,e,null),n=!0},p(i,s){const a={};s&2&&(a.sysinfo=i[1]),s&1&&(a.data=i[0].ea),s&1&&(a.currency=i[0].pc),s&1&&(a.hasExport=i[0].om>0||i[0].e>0),s&64&&(a.translations=i[6]),l.$set(a)},i(i){n||(Z(l.$$.fragment,i),n=!0)},o(i){ie(l.$$.fragment,i),n=!1},d(i){i&&N(e),Me(l)}}}function Mo(t){var i;let e,l,n;return l=new N0({props:{title:((i=t[6].dashboard)==null?void 0:i.tariffpeak)??"Tariff peaks",tariffData:t[7],translations:t[6]}}),{c(){e=p("div"),Ne(l.$$.fragment),u(e,"class","cnt h-64")},m(s,a){P(s,e,a),Se(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.tariffpeak)??"Tariff peaks"),a&128&&(r.tariffData=s[7]),a&64&&(r.translations=s[6]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&N(e),Me(l)}}}function No(t){var i;let e,l,n;return l=new I0({props:{title:((i=t[6].dashboard)==null?void 0:i.realtime)??"Real time"}}),{c(){e=p("div"),Ne(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Se(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.realtime)??"Real time"),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&N(e),Me(l)}}}function Po(t){var i;let e,l,n;return l=new _0({props:{title:((i=t[6].dashboard)==null?void 0:i.price)??"Price",json:t[2],sysinfo:t[1]}}),{c(){e=p("div"),Ne(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Se(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.price)??"Price"),a&4&&(r.json=s[2]),a&2&&(r.sysinfo=s[1]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&N(e),Me(l)}}}function To(t){var i;let e,l,n;return l=new d0({props:{title:((i=t[6].dashboard)==null?void 0:i.day)??"24 hours",json:t[3],sysinfo:t[1]}}),{c(){e=p("div"),Ne(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Se(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.day)??"24 hours"),a&8&&(r.json=s[3]),a&2&&(r.sysinfo=s[1]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&N(e),Me(l)}}}function qo(t){var i;let e,l,n;return l=new b0({props:{title:((i=t[6].dashboard)==null?void 0:i.month)??"{0} days",json:t[4],sysinfo:t[1]}}),{c(){e=p("div"),Ne(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Se(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.month)??"{0} days"),a&16&&(r.json=s[4]),a&2&&(r.sysinfo=s[1]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&N(e),Me(l)}}}function Eo(t){var i;let e,l,n;return l=new w0({props:{title:((i=t[6].dashboard)==null?void 0:i.temperature)??"Temperature",json:t[5]}}),{c(){e=p("div"),Ne(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Se(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.temperature)??"Temperature"),a&32&&(r.json=s[5]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&N(e),Me(l)}}}function U0(t){let e,l=Qt(t[1].ui.i,t[0].i),n,i=Qt(t[1].ui.e,t[0].om||t[0].e>0),s,a=Qt(t[1].ui.v,t[0].l1&&(t[0].l1.u>100||t[0].l2.u>100||t[0].l3.u>100)),r,f=Qt(t[1].ui.a,t[0].l1&&(t[0].l1.i>.01||t[0].l2.i>.01||t[0].l3.i>.01)),c,m=Qt(t[1].ui.h,t[0].l1&&(t[0].l1.p>.01||t[0].l2.p>.01||t[0].l3.p>.01||t[0].l1.q>.01||t[0].l2.q>.01||t[0].l3.q>.01)),_,d=Qt(t[1].ui.f,t[0].l1&&(t[0].l1.f>.01||t[0].l2.f>.01||t[0].l3.f>.01)),h,b=Qt(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),g,w=Qt(t[1].ui.c,t[0].ea),k,R=Qt(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("NO")||t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),I,F=Qt(t[1].ui.l,t[0].hm==1),M,A=Qt(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),O,j=Qt(t[1].ui.d,t[3]),Y,W=Qt(t[1].ui.m,t[4]),T,B=Qt(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),X,y=l&&co(t),K=i&&_o(t),V=a&&mo(t),U=f&&ho(t),G=m&&bo(t),se=d&&ko(t),le=b&&Co(t),Q=w&&So(t),ae=R&&Mo(t),re=F&&No(t),ue=A&&Po(t),ne=j&&To(t),pe=W&&qo(t),oe=B&&Eo(t);return{c(){e=p("div"),y&&y.c(),n=v(),K&&K.c(),s=v(),V&&V.c(),r=v(),U&&U.c(),c=v(),G&&G.c(),_=v(),se&&se.c(),h=v(),le&&le.c(),g=v(),Q&&Q.c(),k=v(),ae&&ae.c(),I=v(),re&&re.c(),M=v(),ue&&ue.c(),O=v(),ne&&ne.c(),Y=v(),pe&&pe.c(),T=v(),oe&&oe.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,$){P(J,e,$),y&&y.m(e,null),o(e,n),K&&K.m(e,null),o(e,s),V&&V.m(e,null),o(e,r),U&&U.m(e,null),o(e,c),G&&G.m(e,null),o(e,_),se&&se.m(e,null),o(e,h),le&&le.m(e,null),o(e,g),Q&&Q.m(e,null),o(e,k),ae&&ae.m(e,null),o(e,I),re&&re.m(e,null),o(e,M),ue&&ue.m(e,null),o(e,O),ne&&ne.m(e,null),o(e,Y),pe&&pe.m(e,null),o(e,T),oe&&oe.m(e,null),X=!0},p(J,[$]){$&3&&(l=Qt(J[1].ui.i,J[0].i)),l?y?(y.p(J,$),$&3&&Z(y,1)):(y=co(J),y.c(),Z(y,1),y.m(e,n)):y&&(vt(),ie(y,1,1,()=>{y=null}),bt()),$&3&&(i=Qt(J[1].ui.e,J[0].om||J[0].e>0)),i?K?(K.p(J,$),$&3&&Z(K,1)):(K=_o(J),K.c(),Z(K,1),K.m(e,s)):K&&(vt(),ie(K,1,1,()=>{K=null}),bt()),$&3&&(a=Qt(J[1].ui.v,J[0].l1&&(J[0].l1.u>100||J[0].l2.u>100||J[0].l3.u>100))),a?V?(V.p(J,$),$&3&&Z(V,1)):(V=mo(J),V.c(),Z(V,1),V.m(e,r)):V&&(vt(),ie(V,1,1,()=>{V=null}),bt()),$&3&&(f=Qt(J[1].ui.a,J[0].l1&&(J[0].l1.i>.01||J[0].l2.i>.01||J[0].l3.i>.01))),f?U?(U.p(J,$),$&3&&Z(U,1)):(U=ho(J),U.c(),Z(U,1),U.m(e,c)):U&&(vt(),ie(U,1,1,()=>{U=null}),bt()),$&3&&(m=Qt(J[1].ui.h,J[0].l1&&(J[0].l1.p>.01||J[0].l2.p>.01||J[0].l3.p>.01||J[0].l1.q>.01||J[0].l2.q>.01||J[0].l3.q>.01))),m?G?(G.p(J,$),$&3&&Z(G,1)):(G=bo(J),G.c(),Z(G,1),G.m(e,_)):G&&(vt(),ie(G,1,1,()=>{G=null}),bt()),$&3&&(d=Qt(J[1].ui.f,J[0].l1&&(J[0].l1.f>.01||J[0].l2.f>.01||J[0].l3.f>.01))),d?se?(se.p(J,$),$&3&&Z(se,1)):(se=ko(J),se.c(),Z(se,1),se.m(e,h)):se&&(vt(),ie(se,1,1,()=>{se=null}),bt()),$&3&&(b=Qt(J[1].ui.r,J[0].ri>0||J[0].re>0||J[0].ric>0||J[0].rec>0)),b?le?(le.p(J,$),$&3&&Z(le,1)):(le=Co(J),le.c(),Z(le,1),le.m(e,g)):le&&(vt(),ie(le,1,1,()=>{le=null}),bt()),$&3&&(w=Qt(J[1].ui.c,J[0].ea)),w?Q?(Q.p(J,$),$&3&&Z(Q,1)):(Q=So(J),Q.c(),Z(Q,1),Q.m(e,k)):Q&&(vt(),ie(Q,1,1,()=>{Q=null}),bt()),$&3&&(R=Qt(J[1].ui.t,J[0].pr&&(J[0].pr.startsWith("NO")||J[0].pr.startsWith("10YNO")||J[0].pr.startsWith("10Y1001A1001A4")))),R?ae?(ae.p(J,$),$&3&&Z(ae,1)):(ae=Mo(J),ae.c(),Z(ae,1),ae.m(e,I)):ae&&(vt(),ie(ae,1,1,()=>{ae=null}),bt()),$&3&&(F=Qt(J[1].ui.l,J[0].hm==1)),F?re?(re.p(J,$),$&3&&Z(re,1)):(re=No(J),re.c(),Z(re,1),re.m(e,M)):re&&(vt(),ie(re,1,1,()=>{re=null}),bt()),$&3&&(A=Qt(J[1].ui.p,J[0].pe&&!Number.isNaN(J[0].p))),A?ue?(ue.p(J,$),$&3&&Z(ue,1)):(ue=Po(J),ue.c(),Z(ue,1),ue.m(e,O)):ue&&(vt(),ie(ue,1,1,()=>{ue=null}),bt()),$&10&&(j=Qt(J[1].ui.d,J[3])),j?ne?(ne.p(J,$),$&10&&Z(ne,1)):(ne=To(J),ne.c(),Z(ne,1),ne.m(e,Y)):ne&&(vt(),ie(ne,1,1,()=>{ne=null}),bt()),$&18&&(W=Qt(J[1].ui.m,J[4])),W?pe?(pe.p(J,$),$&18&&Z(pe,1)):(pe=qo(J),pe.c(),Z(pe,1),pe.m(e,T)):pe&&(vt(),ie(pe,1,1,()=>{pe=null}),bt()),$&35&&(B=Qt(J[1].ui.s,J[0].t&&J[0].t!=-127&&J[5].c>1)),B?oe?(oe.p(J,$),$&35&&Z(oe,1)):(oe=Eo(J),oe.c(),Z(oe,1),oe.m(e,null)):oe&&(vt(),ie(oe,1,1,()=>{oe=null}),bt())},i(J){X||(Z(y),Z(K),Z(V),Z(U),Z(G),Z(se),Z(le),Z(Q),Z(ae),Z(re),Z(ue),Z(ne),Z(pe),Z(oe),X=!0)},o(J){ie(y),ie(K),ie(V),ie(U),ie(G),ie(se),ie(le),ie(Q),ie(ae),ie(re),ie(ue),ie(ne),ie(pe),ie(oe),X=!1},d(J){J&&N(e),y&&y.d(),K&&K.d(),V&&V.d(),U&&U.d(),G&&G.d(),se&&se.d(),le&&le.d(),Q&&Q.d(),ae&&ae.d(),re&&re.d(),ue&&ue.d(),ne&&ne.d(),pe&&pe.d(),oe&&oe.d()}}}function B0(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,{prices:s={}}=e,{dayPlot:a={}}=e,{monthPlot:r={}}=e,{temperatures:f={}}=e,{translations:c={}}=e,{tariffData:m={}}=e,_,d,h,b,g,w;return t.$$set=k=>{"data"in k&&l(0,n=k.data),"sysinfo"in k&&l(1,i=k.sysinfo),"prices"in k&&l(2,s=k.prices),"dayPlot"in k&&l(3,a=k.dayPlot),"monthPlot"in k&&l(4,r=k.monthPlot),"temperatures"in k&&l(5,f=k.temperatures),"translations"in k&&l(6,c=k.translations),"tariffData"in k&&l(7,m=k.tariffData)},t.$$.update=()=>{var k,R,I,F,M,A,O,j,Y,W,T,B,X,y,K;t.$$.dirty&1793&&(l(11,_=ul((n==null?void 0:n.ic)*1e3,"Wh")),l(12,d=ul((n==null?void 0:n.ec)*1e3,"Wh")),((k=n==null?void 0:n.l1)==null?void 0:k.u)==0&&((R=n==null?void 0:n.l2)==null?void 0:R.u)==0&&((I=n==null?void 0:n.l3)==null?void 0:I.u)==0?l(8,b=l(9,g=l(10,w=l(13,h=!0)))):(l(8,b=((F=n==null?void 0:n.l1)==null?void 0:F.u)>0||((M=n==null?void 0:n.l1)==null?void 0:M.i)>0||((A=n==null?void 0:n.l1)==null?void 0:A.p)>0||((O=n==null?void 0:n.l1)==null?void 0:O.q)>0),l(9,g=((j=n==null?void 0:n.l2)==null?void 0:j.u)>0||((Y=n==null?void 0:n.l2)==null?void 0:Y.i)>0||((W=n==null?void 0:n.l2)==null?void 0:W.p)>0||((T=n==null?void 0:n.l2)==null?void 0:T.q)>0),l(10,w=((B=n==null?void 0:n.l3)==null?void 0:B.u)>0||((X=n==null?void 0:n.l3)==null?void 0:X.i)>0||((y=n==null?void 0:n.l3)==null?void 0:y.p)>0||((K=n==null?void 0:n.l3)==null?void 0:K.q)>0),l(13,h=b&&g&&w)))},[n,i,s,a,r,f,c,m,b,g,w,_,d,h]}class j0 extends Tt{constructor(e){super(),Pt(this,e,B0,U0,Nt,{data:0,sysinfo:1,prices:2,dayPlot:3,monthPlot:4,temperatures:5,translations:6,tariffData:7})}}let Fi={};const Un=ol(Fi);async function H0(){Fi=await(await fetch("configuration.json")).json(),Un.set(Fi)}let Ui={};const Du=ol(Ui);async function y0(){Ui=await(await fetch("priceconfig.json")).json(),Du.set(Ui)}function Do(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Ao(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART0",l=v(),n=p("option"),n.textContent="UART2",e.__value=3,H(e,e.__value),n.__value=113,H(n,n.__value)},m(i,s){P(i,e,s),P(i,l,s),P(i,n,s)},d(i){i&&(N(e),N(l),N(n))}}}function Oo(t){let e;return{c(){e=p("option"),e.textContent=`GPIO${t[4]}`,e.__value=t[4],H(e,e.__value)},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function Lo(t){let e,l=t[4]>1&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Oo(t);return{c(){l&&l.c(),e=yt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,i){n[4]>1&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Oo(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){n&&N(e),l&&l.d(n)}}}function z0(t){let e,l,n,i,s=t[0]=="esp8266"&&Ao(),a=rt({length:t[1]+1}),r=[];for(let f=0;f{"chip"in s&&l(0,n=s.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32s3":l(1,i=46);break;case"esp32c3":l(1,i=21);break}},[n,i]}class Bi extends Tt{constructor(e){super(),Pt(this,e,W0,z0,Nt,{chip:0})}}function Io(t){let e,l,n=t[1]&&Ro(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,s){P(i,e,s),o(e,l),n&&n.m(l,null)},p(i,s){i[1]?n?n.p(i,s):(n=Ro(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&N(e),n&&n.d()}}}function Ro(t){let e,l;return{c(){e=p("div"),l=C(t[1]),u(e,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(n,i){P(n,e,i),o(e,l)},p(n,i){i&2&&E(l,n[1])},d(n){n&&N(e)}}}function G0(t){let e,l=t[0]&&Io(t);return{c(){l&&l.c(),e=yt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Io(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:Ye,o:Ye,d(n){n&&N(e),l&&l.d(n)}}}function V0(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=s=>{"active"in s&&l(0,n=s.active),"message"in s&&l(1,i=s.message)},[n,i]}class rl extends Tt{constructor(e){super(),Pt(this,e,V0,G0,Nt,{active:0,message:1})}}function Fo(t,e,l){const n=t.slice();return n[1]=e[l],n}function Uo(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],H(e,e.__value)},m(s,a){P(s,e,a),o(e,l),o(e,i)},p:Ye,d(s){s&&N(e)}}}function K0(t){let e,l,n,i=rt(t[0]),s=[];for(let a=0;a>1&1,q=0;q0;S--)q[S]=q[S]?q[S-1]^M.EXPONENT[j._modN(M.LOG[q[S]]+D)]:q[S-1];q[0]=M.EXPONENT[j._modN(M.LOG[q[0]]+D)]}for(D=0;D<=L;D++)q[D]=M.LOG[q[D]]},_checkBadness:function(){var D,S,L,q,z,ee=0,fe=this._badness,_e=this.buffer,de=this.width;for(z=0;zde*de;)be-=de*de,he++;for(ee+=he*j.N4,q=0;q=fe-2&&(D=fe-2,z>9&&D--);var _e=D;if(z>9){for(ee[_e+2]=0,ee[_e+3]=0;_e--;)S=ee[_e],ee[_e+3]|=255&S<<4,ee[_e+2]=S>>4;ee[2]|=255&D<<4,ee[1]=D>>4,ee[0]=64|D>>12}else{for(ee[_e+1]=0,ee[_e+2]=0;_e--;)S=ee[_e],ee[_e+2]|=255&S<<4,ee[_e+1]=S>>4;ee[1]|=255&D<<4,ee[0]=64|D>>4}for(_e=D+3-(z<10);_e=5&&(L+=j.N1+q[S]-5);for(S=3;SD||q[S-3]*3>=q[S]*4||q[S+3]*3>=q[S]*4)&&(L+=j.N3);return L},_finish:function(){this._stringBuffer=this.buffer.slice();var D,S,L=0,q=3e4;for(S=0;S<8&&(this._applyMask(S),D=this._checkBadness(),D>=1)q&1&&(z[ee-1-S+ee*8]=1,S<6?z[8+ee*S]=1:z[8+ee*(S+1)]=1);for(S=0;S<7;S++,q>>=1)q&1&&(z[8+ee*(ee-7+S)]=1,S?z[6-S+ee*8]=1:z[7+ee*8]=1)},_interleaveBlocks:function(){var D,S,L=this._dataBlock,q=this._ecc,z=this._eccBlock,ee=0,fe=this._calculateMaxLength(),_e=this._neccBlock1,de=this._neccBlock2,x=this._stringBuffer;for(D=0;D1)for(D=k.BLOCK[q],L=z-7;;){for(S=z-7;S>D-3&&(this._addAlignment(S,L),!(S6)for(D=O.BLOCK[ee-7],S=17,L=0;L<6;L++)for(q=0;q<3;q++,S--)1&(S>11?ee>>S-12:D>>S)?(z[5-L+fe*(2-q+fe-11)]=1,z[2-q+fe-11+fe*(5-L)]=1):(this._setMask(5-L,2-q+fe-11),this._setMask(2-q+fe-11,5-L))},_isMasked:function(D,S){var L=j._getMaskBit(D,S);return this._mask[L]===1},_pack:function(){var D,S,L,q=1,z=1,ee=this.width,fe=ee-1,_e=ee-1,de=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(S=0;SS&&(L=D,D=S,S=L),L=S,L+=S*S,L>>=1,L+=D,L},_modN:function(D){for(;D>=255;)D-=255,D=(D>>8)+(D&255);return D},N1:3,N2:3,N3:40,N4:10}),Y=j,W=h.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var D=this.element;D.width=D.height=this.qrious.size}}),T=W,B=_.extend(function(D,S,L,q){this.name=D,this.modifiable=!!S,this.defaultValue=L,this._valueTransformer=q},{transform:function(D){var S=this._valueTransformer;return typeof S=="function"?S(D,this):D}}),X=B,y=_.extend(null,{abs:function(D){return D!=null?Math.abs(D):null},hasOwn:function(D,S){return Object.prototype.hasOwnProperty.call(D,S)},noop:function(){},toUpperCase:function(D){return D!=null?D.toUpperCase():null}}),K=y,V=_.extend(function(D){this.options={},D.forEach(function(S){this.options[S.name]=S},this)},{exists:function(D){return this.options[D]!=null},get:function(D,S){return V._get(this.options[D],S)},getAll:function(D){var S,L=this.options,q={};for(S in L)K.hasOwn(L,S)&&(q[S]=V._get(L[S],D));return q},init:function(D,S,L){typeof L!="function"&&(L=K.noop);var q,z;for(q in this.options)K.hasOwn(this.options,q)&&(z=this.options[q],V._set(z,z.defaultValue,S),V._createAccessor(z,S,L));this._setAll(D,S,!0)},set:function(D,S,L){return this._set(D,S,L)},setAll:function(D,S){return this._setAll(D,S)},_set:function(D,S,L,q){var z=this.options[D];if(!z)throw new Error("Invalid option: "+D);if(!z.modifiable&&!q)throw new Error("Option cannot be modified: "+D);return V._set(z,S,L)},_setAll:function(D,S,L){if(!D)return!1;var q,z=!1;for(q in D)K.hasOwn(D,q)&&this._set(q,D[q],S,L)&&(z=!0);return z}},{_createAccessor:function(D,S,L){var q={get:function(){return V._get(D,S)}};D.modifiable&&(q.set=function(z){V._set(D,z,S)&&L(z,D)}),Object.defineProperty(S,D.name,q)},_get:function(D,S){return S["_"+D.name]},_set:function(D,S,L){var q="_"+D.name,z=L[q],ee=D.transform(S??D.defaultValue);return L[q]=ee,ee!==z}}),U=V,G=_.extend(function(){this._services={}},{getService:function(D){var S=this._services[D];if(!S)throw new Error("Service is not being managed with name: "+D);return S},setService:function(D,S){if(this._services[D])throw new Error("Service is already managed with name: "+D);S&&(this._services[D]=S)}}),se=G,le=new U([new X("background",!0,"white"),new X("backgroundAlpha",!0,1,K.abs),new X("element"),new X("foreground",!0,"black"),new X("foregroundAlpha",!0,1,K.abs),new X("level",!0,"L",K.toUpperCase),new X("mime",!0,"image/png"),new X("padding",!0,null,K.abs),new X("size",!0,100,K.abs),new X("value",!0,"")]),Q=new se,ae=_.extend(function(D){le.init(D,this,this.update.bind(this));var S=le.get("element",this),L=Q.getService("element"),q=S&&L.isCanvas(S)?S:L.createCanvas(),z=S&&L.isImage(S)?S:L.createImage();this._canvasRenderer=new g(this,q,!0),this._imageRenderer=new T(this,z,z===S),this.update()},{get:function(){return le.getAll(this)},set:function(D){le.setAll(D,this)&&this.update()},toDataURL:function(D){return this.canvas.toDataURL(D||this.mime)},update:function(){var D=new Y({level:this.level,value:this.value});this._canvasRenderer.render(D),this._imageRenderer.render(D)}},{use:function(D){Q.setService(D.getName(),D)}});Object.defineProperties(ae.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var re=ae,ue=re,ne=_.extend({getName:function(){}}),pe=ne,oe=pe.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(D){},isImage:function(D){}}),J=oe,$=J.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(D){return D instanceof HTMLCanvasElement},isImage:function(D){return D instanceof HTMLImageElement}}),ke=$;ue.use(new ke);var Ce=ue;return Ce})})(Ou);var $0=Ou.exports;const x0=J0($0);function ec(t){let e,l;return{c(){e=p("img"),ii(e.src,l=t[2])||u(e,"src",l),u(e,"alt",t[0]),u(e,"class",t[1])},m(n,i){P(n,e,i)},p(n,[i]){i&4&&!ii(e.src,l=n[2])&&u(e,"src",l),i&1&&u(e,"alt",n[0]),i&2&&u(e,"class",n[1])},i:Ye,o:Ye,d(n){n&&N(e)}}}function tc(t,e,l){let{errorCorrection:n="L"}=e,{background:i="#fff"}=e,{color:s="#000"}=e,{size:a="200"}=e,{value:r=""}=e,{padding:f=0}=e,{className:c="qrcode"}=e,m="",_;function d(){_.set({background:i,foreground:s,level:n,padding:f,size:a,value:r}),l(2,m=_.toDataURL("image/jpeg"))}function h(){return m}return yf(()=>{l(9,_=new x0),r&&d()}),t.$$set=b=>{"errorCorrection"in b&&l(3,n=b.errorCorrection),"background"in b&&l(4,i=b.background),"color"in b&&l(5,s=b.color),"size"in b&&l(6,a=b.size),"value"in b&&l(0,r=b.value),"padding"in b&&l(7,f=b.padding),"className"in b&&l(1,c=b.className)},t.$$.update=()=>{t.$$.dirty&513&&r&&_&&d()},[r,c,m,n,i,s,a,f,h,_]}class lc extends Tt{constructor(e){super(),Pt(this,e,tc,ec,Nt,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1,getImage:8})}get getImage(){return this.$$.ctx[8]}}function Bo(t,e,l){const n=t.slice();return n[121]=e[l],n}function jo(t,e,l){const n=t.slice();return n[124]=e[l],n[125]=e,n[126]=l,n}function Ho(t,e,l){const n=t.slice();return n[127]=e[l],n[128]=e,n[129]=l,n}function yo(t,e,l){const n=t.slice();return n[130]=e[l],n}function nc(t,e,l){const n=t.slice();return n[133]=e[l],n}function ic(t,e,l){const n=t.slice();return n[136]=e[l],n}function zo(t){var nt,ze,el,tl,ll,nl,il,sl,Ze,dt,Te,te,Ie,Zt,fl,ml,gl,kl,wl,Cl,Sl,Ml,Il,Rl,Fl,Ve;let e,l,n=(((ze=(nt=t[2].conf)==null?void 0:nt.general)==null?void 0:ze.title)??"General")+"",i,s,a,r,f,c,m,_,d,h=(((tl=(el=t[2].conf)==null?void 0:el.general)==null?void 0:tl.hostname)??"Hostname")+"",b,g,w,k,R,I,F=(((nl=(ll=t[2].conf)==null?void 0:ll.general)==null?void 0:nl.timezone)??"Time zone")+"",M,A,O,j,Y,W,T,B,X,y,K,V=(((sl=(il=t[2].conf)==null?void 0:il.price)==null?void 0:sl.region)??"Price region")+"",U,G,se,le,Q,ae,re,ue,ne,pe,oe,J,$,ke,Ce,D,S,L,q,z,ee,fe,_e,de,x,he,be,Ae,Pe,Oe,Le,De,Ue,xe,Ct=(((dt=(Ze=t[2].conf)==null?void 0:Ze.price)==null?void 0:dt.currency)??"Currency")+"",tt,ot,Mt,ht,at,it,ft,Lt,We,Re,He,lt,ve=(((te=(Te=t[2].conf)==null?void 0:Te.price)==null?void 0:te.enabled)??"Enabled")+"",Ee,Qe,me,we,ut=(((fl=(Zt=(Ie=t[2].conf)==null?void 0:Ie.general)==null?void 0:Zt.security)==null?void 0:fl.title)??"Security")+"",Ge,Ft,gt,Be,kt,ct=(((kl=(gl=(ml=t[2].conf)==null?void 0:ml.general)==null?void 0:gl.security)==null?void 0:kl.none)??"None")+"",mt,et,qt=(((Sl=(Cl=(wl=t[2].conf)==null?void 0:wl.general)==null?void 0:Cl.security)==null?void 0:Sl.conf)??"Conf")+"",Wt,wt,_t=(((Rl=(Il=(Ml=t[2].conf)==null?void 0:Ml.general)==null?void 0:Il.security)==null?void 0:Rl.all)??"All")+"",zt,Xt,Ut,Ht,Yt=(((Ve=(Fl=t[2].conf)==null?void 0:Fl.general)==null?void 0:Ve.context)??"Context")+"",$t,Gt,It,Fe,Xe,je,Dt,Bt;Y=new Q0({});let $e=!t[6].p.t&&Wo(),st=rt(["NOK","SEK","DKK","EUR","CHF"]),Et=[];for(let qe=0;qe<5;qe+=1)Et[qe]=sc(ic(t,st,qe));ft=new pl({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[oc]},$$scope:{ctx:t}}});let pt=t[6].p.e&&t[0].chip!="esp8266"&&Go(t),ge=t[6].g.s>0&&Vo(t);return{c(){var qe,Rt;e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("div"),d=p("div"),b=C(h),g=p("br"),w=v(),k=p("input"),R=v(),I=p("div"),M=C(F),A=p("br"),O=v(),j=p("select"),Ne(Y.$$.fragment),W=v(),T=p("input"),B=v(),X=p("div"),y=p("div"),K=p("div"),U=C(V),G=p("br"),se=v(),le=p("select"),Q=p("optgroup"),$e&&$e.c(),ae=p("option"),ae.textContent="NO1",re=p("option"),re.textContent="NO2",ue=p("option"),ue.textContent="NO3",ne=p("option"),ne.textContent="NO4",pe=p("option"),pe.textContent="NO5",oe=p("optgroup"),J=p("option"),J.textContent="SE1",$=p("option"),$.textContent="SE2",ke=p("option"),ke.textContent="SE3",Ce=p("option"),Ce.textContent="SE4",D=p("optgroup"),S=p("option"),S.textContent="DK1",L=p("option"),L.textContent="DK2",q=p("option"),q.textContent="Austria",z=p("option"),z.textContent="Belgium",ee=p("option"),ee.textContent="Czech Republic",fe=p("option"),fe.textContent="Estonia",_e=p("option"),_e.textContent="Finland",de=p("option"),de.textContent="France",x=p("option"),x.textContent="Germany",he=p("option"),he.textContent="Great Britain",be=p("option"),be.textContent="Latvia",Ae=p("option"),Ae.textContent="Lithuania",Pe=p("option"),Pe.textContent="Netherland",Oe=p("option"),Oe.textContent="Poland",Le=p("option"),Le.textContent="Slovenia",De=p("option"),De.textContent="Switzerland",Ue=v(),xe=p("div"),tt=C(Ct),ot=p("br"),Mt=v(),ht=p("select");for(let al=0;al<5;al+=1)Et[al].c();at=v(),it=p("div"),Ne(ft.$$.fragment),Lt=v(),We=p("div"),Re=p("label"),He=p("input"),lt=v(),Ee=C(ve),Qe=v(),pt&&pt.c(),me=v(),we=p("div"),Ge=C(ut),Ft=p("br"),gt=v(),Be=p("select"),kt=p("option"),mt=C(ct),et=p("option"),Wt=C(qt),wt=p("option"),zt=C(_t),Xt=v(),ge&&ge.c(),Ut=v(),Ht=p("div"),$t=C(Yt),Gt=p("br"),It=v(),Fe=p("input"),u(l,"class","text-sm"),u(a,"href",_l("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",Vn),u(j,"name","gt"),u(j,"class","in-l w-full"),t[6].g.t===void 0&&At(()=>t[25].call(j)),u(_,"class","flex"),u(m,"class","my-1"),u(T,"type","hidden"),u(T,"name","p"),T.value="true",ae.__value="10YNO-1--------2",H(ae,ae.__value),re.__value="10YNO-2--------T",H(re,re.__value),ue.__value="10YNO-3--------J",H(ue,ue.__value),ne.__value="10YNO-4--------9",H(ne,ne.__value),pe.__value="10Y1001A1001A48H",H(pe,pe.__value),u(Q,"label","Norway"),J.__value="10Y1001A1001A44P",H(J,J.__value),$.__value="10Y1001A1001A45N",H($,$.__value),ke.__value="10Y1001A1001A46L",H(ke,ke.__value),Ce.__value="10Y1001A1001A47J",H(Ce,Ce.__value),u(oe,"label","Sweden"),S.__value="10YDK-1--------W",H(S,S.__value),L.__value="10YDK-2--------M",H(L,L.__value),u(D,"label","Denmark"),q.__value="10YAT-APG------L",H(q,q.__value),z.__value="10YBE----------2",H(z,z.__value),ee.__value="10YCZ-CEPS-----N",H(ee,ee.__value),fe.__value="10Y1001A1001A39I",H(fe,fe.__value),_e.__value="10YFI-1--------U",H(_e,_e.__value),de.__value="10YFR-RTE------C",H(de,de.__value),x.__value="10Y1001A1001A83F",H(x,x.__value),he.__value="10YGB----------A",H(he,he.__value),be.__value="10YLV-1001A00074",H(be,be.__value),Ae.__value="10YLT-1001A0008Q",H(Ae,Ae.__value),Pe.__value="10YNL----------L",H(Pe,Pe.__value),Oe.__value="10YPL-AREA-----S",H(Oe,Oe.__value),Le.__value="10YSI-ELES-----O",H(Le,Le.__value),De.__value="10YCH-SWISSGRIDZ",H(De,De.__value),u(le,"name","pr"),u(le,"class","in-f w-full"),t[6].p.r===void 0&&At(()=>t[26].call(le)),u(K,"class","w-full"),u(ht,"name","pc"),u(ht,"class","in-l"),t[6].p.c===void 0&&At(()=>t[27].call(ht)),u(y,"class","flex"),u(X,"class","my-1"),u(it,"class","my-1"),u(He,"type","checkbox"),u(He,"name","pe"),He.__value="true",H(He,He.__value),u(He,"class","rounded mb-1"),u(We,"class","my-1"),kt.__value=0,H(kt,kt.__value),et.__value=1,H(et,et.__value),wt.__value=2,H(wt,wt.__value),u(Be,"name","gs"),u(Be,"class","in-s"),t[6].g.s===void 0&&At(()=>t[30].call(Be)),u(we,"class","my-1"),u(Fe,"name","gc"),u(Fe,"type","text"),u(Fe,"pattern",Vn),u(Fe,"placeholder",Xe=((Rt=(qe=t[2].conf)==null?void 0:qe.general)==null?void 0:Rt.context_placeholder)??"/"),u(Fe,"class","in-s"),u(Fe,"maxlength","36"),u(Ht,"class","my-1"),u(e,"class","cnt")},m(qe,Rt){P(qe,e,Rt),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,d),o(d,b),o(d,g),o(d,w),o(d,k),H(k,t[6].g.h),o(_,R),o(_,I),o(I,M),o(I,A),o(I,O),o(I,j),Se(Y,j,null),Ke(j,t[6].g.t,!0),o(e,W),o(e,T),o(e,B),o(e,X),o(X,y),o(y,K),o(K,U),o(K,G),o(K,se),o(K,le),o(le,Q),$e&&$e.m(Q,null),o(Q,ae),o(Q,re),o(Q,ue),o(Q,ne),o(Q,pe),o(le,oe),o(oe,J),o(oe,$),o(oe,ke),o(oe,Ce),o(le,D),o(D,S),o(D,L),o(le,q),o(le,z),o(le,ee),o(le,fe),o(le,_e),o(le,de),o(le,x),o(le,he),o(le,be),o(le,Ae),o(le,Pe),o(le,Oe),o(le,Le),o(le,De),Ke(le,t[6].p.r,!0),o(y,Ue),o(y,xe),o(xe,tt),o(xe,ot),o(xe,Mt),o(xe,ht);for(let al=0;al<5;al+=1)Et[al]&&Et[al].m(ht,null);Ke(ht,t[6].p.c,!0),o(e,at),o(e,it),Se(ft,it,null),o(e,Lt),o(e,We),o(We,Re),o(Re,He),He.checked=t[6].p.e,o(Re,lt),o(Re,Ee),o(We,Qe),pt&&pt.m(We,null),o(e,me),o(e,we),o(we,Ge),o(we,Ft),o(we,gt),o(we,Be),o(Be,kt),o(kt,mt),o(Be,et),o(et,Wt),o(Be,wt),o(wt,zt),Ke(Be,t[6].g.s,!0),o(e,Xt),ge&&ge.m(e,null),o(e,Ut),o(e,Ht),o(Ht,$t),o(Ht,Gt),o(Ht,It),o(Ht,Fe),H(Fe,t[6].g.c),je=!0,Dt||(Bt=[ce(k,"input",t[24]),ce(j,"change",t[25]),ce(le,"change",t[26]),ce(ht,"change",t[27]),ce(He,"change",t[28]),ce(Be,"change",t[30]),ce(Fe,"input",t[33])],Dt=!0)},p(qe,Rt){var Ul,Bl,jl,Hl,yl,zl,Wl,Gl,Vl,Kl,Yl,Ql,Xl,Zl,Jl,$l,xl,en,tn,Nn,Pn,Tn,qn,En,Dn,An,On,Ln;(!je||Rt[0]&4)&&n!==(n=(((Bl=(Ul=qe[2].conf)==null?void 0:Ul.general)==null?void 0:Bl.title)??"General")+"")&&E(i,n),(!je||Rt[0]&4)&&h!==(h=(((Hl=(jl=qe[2].conf)==null?void 0:jl.general)==null?void 0:Hl.hostname)??"Hostname")+"")&&E(b,h),Rt[0]&64&&k.value!==qe[6].g.h&&H(k,qe[6].g.h),(!je||Rt[0]&4)&&F!==(F=(((zl=(yl=qe[2].conf)==null?void 0:yl.general)==null?void 0:zl.timezone)??"Time zone")+"")&&E(M,F),Rt[0]&64&&Ke(j,qe[6].g.t),(!je||Rt[0]&4)&&V!==(V=(((Gl=(Wl=qe[2].conf)==null?void 0:Wl.price)==null?void 0:Gl.region)??"Price region")+"")&&E(U,V),qe[6].p.t?$e&&($e.d(1),$e=null):$e||($e=Wo(),$e.c(),$e.m(Q,ae)),Rt[0]&64&&Ke(le,qe[6].p.r),(!je||Rt[0]&4)&&Ct!==(Ct=(((Kl=(Vl=qe[2].conf)==null?void 0:Vl.price)==null?void 0:Kl.currency)??"Currency")+"")&&E(tt,Ct),Rt[0]&64&&Ke(ht,qe[6].p.c);const al={};Rt[0]&4|Rt[4]&32768&&(al.$$scope={dirty:Rt,ctx:qe}),ft.$set(al),Rt[0]&64&&(He.checked=qe[6].p.e),(!je||Rt[0]&4)&&ve!==(ve=(((Ql=(Yl=qe[2].conf)==null?void 0:Yl.price)==null?void 0:Ql.enabled)??"Enabled")+"")&&E(Ee,ve),qe[6].p.e&&qe[0].chip!="esp8266"?pt?pt.p(qe,Rt):(pt=Go(qe),pt.c(),pt.m(We,null)):pt&&(pt.d(1),pt=null),(!je||Rt[0]&4)&&ut!==(ut=(((Jl=(Zl=(Xl=qe[2].conf)==null?void 0:Xl.general)==null?void 0:Zl.security)==null?void 0:Jl.title)??"Security")+"")&&E(Ge,ut),(!je||Rt[0]&4)&&ct!==(ct=(((en=(xl=($l=qe[2].conf)==null?void 0:$l.general)==null?void 0:xl.security)==null?void 0:en.none)??"None")+"")&&E(mt,ct),(!je||Rt[0]&4)&&qt!==(qt=(((Pn=(Nn=(tn=qe[2].conf)==null?void 0:tn.general)==null?void 0:Nn.security)==null?void 0:Pn.conf)??"Conf")+"")&&E(Wt,qt),(!je||Rt[0]&4)&&_t!==(_t=(((En=(qn=(Tn=qe[2].conf)==null?void 0:Tn.general)==null?void 0:qn.security)==null?void 0:En.all)??"All")+"")&&E(zt,_t),Rt[0]&64&&Ke(Be,qe[6].g.s),qe[6].g.s>0?ge?ge.p(qe,Rt):(ge=Vo(qe),ge.c(),ge.m(e,Ut)):ge&&(ge.d(1),ge=null),(!je||Rt[0]&4)&&Yt!==(Yt=(((An=(Dn=qe[2].conf)==null?void 0:Dn.general)==null?void 0:An.context)??"Context")+"")&&E($t,Yt),(!je||Rt[0]&4&&Xe!==(Xe=((Ln=(On=qe[2].conf)==null?void 0:On.general)==null?void 0:Ln.context_placeholder)??"/"))&&u(Fe,"placeholder",Xe),Rt[0]&64&&Fe.value!==qe[6].g.c&&H(Fe,qe[6].g.c)},i(qe){je||(Z(Y.$$.fragment,qe),Z(ft.$$.fragment,qe),je=!0)},o(qe){ie(Y.$$.fragment,qe),ie(ft.$$.fragment,qe),je=!1},d(qe){qe&&N(e),Me(Y),$e&&$e.d(),Jt(Et,qe),Me(ft),pt&&pt.d(),ge&&ge.d(),Dt=!1,jt(Bt)}}}function Wo(t){let e,l,n,i,s;return{c(){e=p("option"),e.textContent="NO1 with support",l=p("option"),l.textContent="NO2 with support",n=p("option"),n.textContent="NO3 with support",i=p("option"),i.textContent="NO4 with support",s=p("option"),s.textContent="NO5 with support",e.__value="NO1S",H(e,e.__value),l.__value="NO2S",H(l,l.__value),n.__value="NO3S",H(n,n.__value),i.__value="NO4S",H(i,i.__value),s.__value="NO5S",H(s,s.__value)},m(a,r){P(a,e,r),P(a,l,r),P(a,n,r),P(a,i,r),P(a,s,r)},d(a){a&&(N(e),N(l),N(n),N(i),N(s))}}}function sc(t){let e;return{c(){e=p("option"),e.textContent=`${t[136]}`,e.__value=t[136],H(e,e.__value)},m(l,n){P(l,e,n)},p:Ye,d(l){l&&N(e)}}}function oc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.price)==null?void 0:i.conf)??"Configure")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.price)==null?void 0:f.conf)??"Configure")+"")&&E(l,e)},d(s){s&&N(l)}}}function Go(t){let e,l,n,i,s;return{c(){var a,r;e=p("br"),l=p("input"),u(l,"name","pt"),u(l,"type","text"),u(l,"class","in-s"),u(l,"placeholder",n=((r=(a=t[2].conf)==null?void 0:a.price)==null?void 0:r.api_key_placeholder)??""),u(l,"pattern",Vn)},m(a,r){P(a,e,r),P(a,l,r),H(l,t[6].p.t),i||(s=ce(l,"input",t[29]),i=!0)},p(a,r){var f,c;r[0]&4&&n!==(n=((c=(f=a[2].conf)==null?void 0:f.price)==null?void 0:c.api_key_placeholder)??"")&&u(l,"placeholder",n),r[0]&64&&l.value!==a[6].p.t&&H(l,a[6].p.t)},d(a){a&&(N(e),N(l)),i=!1,s()}}}function Vo(t){var w,k,R,I,F,M;let e,l=(((R=(k=(w=t[2].conf)==null?void 0:w.general)==null?void 0:k.security)==null?void 0:R.username)??"Username")+"",n,i,s,a,r,f,c=(((M=(F=(I=t[2].conf)==null?void 0:I.general)==null?void 0:F.security)==null?void 0:M.password)??"Password")+"",m,_,d,h,b,g;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),r=v(),f=p("div"),m=C(c),_=p("br"),d=v(),h=p("input"),u(a,"name","gu"),u(a,"type","text"),u(a,"class","in-s"),u(a,"maxlength","36"),u(a,"pattern",Ll),u(e,"class","my-1"),u(h,"name","gp"),u(h,"type","password"),u(h,"class","in-s"),u(h,"maxlength","36"),u(h,"pattern",Ll),u(f,"class","my-1")},m(A,O){P(A,e,O),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].g.u),P(A,r,O),P(A,f,O),o(f,m),o(f,_),o(f,d),o(f,h),H(h,t[6].g.p),b||(g=[ce(a,"input",t[31]),ce(h,"input",t[32])],b=!0)},p(A,O){var j,Y,W,T,B,X;O[0]&4&&l!==(l=(((W=(Y=(j=A[2].conf)==null?void 0:j.general)==null?void 0:Y.security)==null?void 0:W.username)??"Username")+"")&&E(n,l),O[0]&64&&a.value!==A[6].g.u&&H(a,A[6].g.u),O[0]&4&&c!==(c=(((X=(B=(T=A[2].conf)==null?void 0:T.general)==null?void 0:B.security)==null?void 0:X.password)??"Password")+"")&&E(m,c),O[0]&64&&h.value!==A[6].g.p&&H(h,A[6].g.p)},d(A){A&&(N(e),N(r),N(f)),b=!1,jt(g)}}}function Ko(t){var me,we,ut,Ge,Ft,gt,Be,kt,ct,mt,et,qt,Wt,wt,_t,zt,Xt,Ut,Ht,Yt,$t,Gt,It;let e,l,n=(((we=(me=t[2].conf)==null?void 0:me.meter)==null?void 0:we.title)??"Meter")+"",i,s,a,r,f,c,m,_,d,h=(((Ft=(Ge=(ut=t[2].conf)==null?void 0:ut.meter)==null?void 0:Ge.comm)==null?void 0:Ft.title)??"Communication")+"",b,g,w,k,R,I=(((kt=(Be=(gt=t[2].conf)==null?void 0:gt.meter)==null?void 0:Be.comm)==null?void 0:kt.passive)??"Passive")+"",F,M,A=(((et=(mt=(ct=t[2].conf)==null?void 0:ct.meter)==null?void 0:mt.comm)==null?void 0:et.pulse)??"Pulse")+"",O,j=(Wt=(qt=t[0])==null?void 0:qt.features)==null?void 0:Wt.includes("kmp"),Y,W,T,B=(((wt=t[2].common)==null?void 0:wt.voltage)??"Voltage")+"",X,y,K,V,U,G,se,le,Q,ae=(((zt=(_t=t[2].conf)==null?void 0:_t.meter)==null?void 0:zt.fuse)??"Main fuse")+"",re,ue,ne,pe,oe,J,$,ke,Ce,D=(((Ut=(Xt=t[2].conf)==null?void 0:Xt.meter)==null?void 0:Ut.prod)??"Production")+"",S,L,q,z,ee,fe,_e,de,x,he,be,Ae,Pe,Oe,Le=(((Yt=(Ht=t[2].conf)==null?void 0:Ht.meter)==null?void 0:Yt.encrypted)??"Encrypted")+"",De,Ue,xe,Ct,tt,ot,Mt,ht=(((It=(Gt=($t=t[2].conf)==null?void 0:$t.meter)==null?void 0:Gt.multipliers)==null?void 0:It.title)??"Multipliers")+"",at,it,ft,Lt,We=j&&Yo();function Re(Fe,Xe){return Fe[6].m.a===2?fc:ac}let He=Re(t),lt=He(t),ve=t[6].m.e.e&&Qo(t),Ee=t[6].m.e.e&&Xo(t),Qe=t[6].m.m.e&&Zo(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("input"),_=v(),d=p("div"),b=C(h),g=p("br"),w=v(),k=p("select"),R=p("option"),F=C(I),M=p("option"),O=C(A),We&&We.c(),Y=v(),lt.c(),W=v(),T=p("div"),X=C(B),y=p("br"),K=v(),V=p("select"),U=p("option"),U.textContent="400V (TN)",G=p("option"),G.textContent="230V (IT/TT)",se=v(),le=p("div"),Q=p("div"),re=C(ae),ue=p("br"),ne=v(),pe=p("label"),oe=p("input"),J=v(),$=p("span"),$.textContent="A",ke=v(),Ce=p("div"),S=C(D),L=p("br"),q=v(),z=p("label"),ee=p("input"),fe=v(),_e=p("span"),_e.textContent="kWp",de=v(),x=p("div"),x.innerHTML="",he=v(),be=p("div"),Ae=p("label"),Pe=p("input"),Oe=v(),De=C(Le),Ue=v(),ve&&ve.c(),xe=v(),Ee&&Ee.c(),Ct=v(),tt=p("label"),ot=p("input"),Mt=v(),at=C(ht),it=v(),Qe&&Qe.c(),u(l,"class","text-sm"),u(a,"href",_l("Meter-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","m"),f.value="true",u(m,"type","hidden"),u(m,"name","mo"),m.value="1",R.__value=0,H(R,R.__value),M.__value=2,H(M,M.__value),u(k,"name","ma"),u(k,"class","in-s"),t[6].m.a===void 0&&At(()=>t[34].call(k)),u(d,"class","my-1"),U.__value=2,H(U,U.__value),G.__value=1,H(G,G.__value),u(V,"name","md"),u(V,"class","in-s"),t[6].m.d===void 0&&At(()=>t[40].call(V)),u(T,"class","my-1"),u(oe,"name","mf"),u(oe,"type","number"),u(oe,"min","5"),u(oe,"max","65535"),u(oe,"class","in-f tr w-full"),u($,"class","in-post"),u(pe,"class","flex"),u(Q,"class","mx-1"),u(ee,"name","mr"),u(ee,"type","number"),u(ee,"min","0"),u(ee,"max","65535"),u(ee,"class","in-f tr w-full"),u(_e,"class","in-post"),u(z,"class","flex"),u(Ce,"class","mx-1"),u(le,"class","my-1 flex"),u(x,"class","my-1"),u(Pe,"type","checkbox"),u(Pe,"name","me"),Pe.__value="true",H(Pe,Pe.__value),u(Pe,"class","rounded mb-1"),u(be,"class","my-1"),u(ot,"type","checkbox"),u(ot,"name","mm"),ot.__value="true",H(ot,ot.__value),u(ot,"class","rounded mb-1"),u(e,"class","cnt")},m(Fe,Xe){P(Fe,e,Xe),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(e,_),o(e,d),o(d,b),o(d,g),o(d,w),o(d,k),o(k,R),o(R,F),o(k,M),o(M,O),We&&We.m(k,null),Ke(k,t[6].m.a,!0),o(e,Y),lt.m(e,null),o(e,W),o(e,T),o(T,X),o(T,y),o(T,K),o(T,V),o(V,U),o(V,G),Ke(V,t[6].m.d,!0),o(e,se),o(e,le),o(le,Q),o(Q,re),o(Q,ue),o(Q,ne),o(Q,pe),o(pe,oe),H(oe,t[6].m.f),o(pe,J),o(pe,$),o(le,ke),o(le,Ce),o(Ce,S),o(Ce,L),o(Ce,q),o(Ce,z),o(z,ee),H(ee,t[6].m.r),o(z,fe),o(z,_e),o(e,de),o(e,x),o(e,he),o(e,be),o(be,Ae),o(Ae,Pe),Pe.checked=t[6].m.e.e,o(Ae,Oe),o(Ae,De),o(be,Ue),ve&&ve.m(be,null),o(e,xe),Ee&&Ee.m(e,null),o(e,Ct),o(e,tt),o(tt,ot),ot.checked=t[6].m.m.e,o(tt,Mt),o(tt,at),o(e,it),Qe&&Qe.m(e,null),ft||(Lt=[ce(k,"change",t[34]),ce(V,"change",t[40]),ce(oe,"input",t[41]),ce(ee,"input",t[42]),ce(Pe,"change",t[43]),ce(ot,"change",t[46])],ft=!0)},p(Fe,Xe){var je,Dt,Bt,$e,st,Et,pt,ge,nt,ze,el,tl,ll,nl,il,sl,Ze,dt,Te,te,Ie,Zt,fl;Xe[0]&4&&n!==(n=(((Dt=(je=Fe[2].conf)==null?void 0:je.meter)==null?void 0:Dt.title)??"Meter")+"")&&E(i,n),Xe[0]&4&&h!==(h=(((st=($e=(Bt=Fe[2].conf)==null?void 0:Bt.meter)==null?void 0:$e.comm)==null?void 0:st.title)??"Communication")+"")&&E(b,h),Xe[0]&4&&I!==(I=(((ge=(pt=(Et=Fe[2].conf)==null?void 0:Et.meter)==null?void 0:pt.comm)==null?void 0:ge.passive)??"Passive")+"")&&E(F,I),Xe[0]&4&&A!==(A=(((el=(ze=(nt=Fe[2].conf)==null?void 0:nt.meter)==null?void 0:ze.comm)==null?void 0:el.pulse)??"Pulse")+"")&&E(O,A),Xe[0]&1&&(j=(ll=(tl=Fe[0])==null?void 0:tl.features)==null?void 0:ll.includes("kmp")),j?We||(We=Yo(),We.c(),We.m(k,null)):We&&(We.d(1),We=null),Xe[0]&64&&Ke(k,Fe[6].m.a),He===(He=Re(Fe))&<?lt.p(Fe,Xe):(lt.d(1),lt=He(Fe),lt&&(lt.c(),lt.m(e,W))),Xe[0]&4&&B!==(B=(((nl=Fe[2].common)==null?void 0:nl.voltage)??"Voltage")+"")&&E(X,B),Xe[0]&64&&Ke(V,Fe[6].m.d),Xe[0]&4&&ae!==(ae=(((sl=(il=Fe[2].conf)==null?void 0:il.meter)==null?void 0:sl.fuse)??"Main fuse")+"")&&E(re,ae),Xe[0]&64&&ye(oe.value)!==Fe[6].m.f&&H(oe,Fe[6].m.f),Xe[0]&4&&D!==(D=(((dt=(Ze=Fe[2].conf)==null?void 0:Ze.meter)==null?void 0:dt.prod)??"Production")+"")&&E(S,D),Xe[0]&64&&ye(ee.value)!==Fe[6].m.r&&H(ee,Fe[6].m.r),Xe[0]&64&&(Pe.checked=Fe[6].m.e.e),Xe[0]&4&&Le!==(Le=(((te=(Te=Fe[2].conf)==null?void 0:Te.meter)==null?void 0:te.encrypted)??"Encrypted")+"")&&E(De,Le),Fe[6].m.e.e?ve?ve.p(Fe,Xe):(ve=Qo(Fe),ve.c(),ve.m(be,null)):ve&&(ve.d(1),ve=null),Fe[6].m.e.e?Ee?Ee.p(Fe,Xe):(Ee=Xo(Fe),Ee.c(),Ee.m(e,Ct)):Ee&&(Ee.d(1),Ee=null),Xe[0]&64&&(ot.checked=Fe[6].m.m.e),Xe[0]&4&&ht!==(ht=(((fl=(Zt=(Ie=Fe[2].conf)==null?void 0:Ie.meter)==null?void 0:Zt.multipliers)==null?void 0:fl.title)??"Multipliers")+"")&&E(at,ht),Fe[6].m.m.e?Qe?Qe.p(Fe,Xe):(Qe=Zo(Fe),Qe.c(),Qe.m(e,null)):Qe&&(Qe.d(1),Qe=null)},d(Fe){Fe&&N(e),We&&We.d(),lt.d(),ve&&ve.d(),Ee&&Ee.d(),Qe&&Qe.d(),ft=!1,jt(Lt)}}}function Yo(t){let e;return{c(){e=p("option"),e.textContent="KMP",e.__value=9,H(e,e.__value)},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function ac(t){var re,ue,ne,pe,oe,J;let e,l,n=(((ue=(re=t[2].conf)==null?void 0:re.meter)==null?void 0:ue.buffer)??"Buffer size")+"",i,s,a,r=(((pe=(ne=t[2].conf)==null?void 0:ne.meter)==null?void 0:pe.serial)??"Serial conf.")+"",f,c,m,_,d,h=(((J=(oe=t[2].conf)==null?void 0:oe.meter)==null?void 0:J.inverted)??"inverted")+"",b,g,w,k,R,I,F,M,A,O,j,Y,W,T,B,X,y,K,V,U,G,se,le,Q=rt([3,12,24,48,96,192,384,576,1152]),ae=[];for(let $=0;$<9;$+=1)ae[$]=uc(nc(t,Q,$));return{c(){e=p("div"),l=p("span"),i=C(n),s=v(),a=p("span"),f=C(r),c=v(),m=p("label"),_=p("input"),d=v(),b=C(h),g=v(),w=p("div"),k=p("select"),R=p("option"),I=C("Autodetect");for(let $=0;$<9;$+=1)ae[$].c();M=v(),A=p("select"),O=p("option"),j=C("-"),W=p("option"),W.textContent="7N1",T=p("option"),T.textContent="8N1",B=p("option"),B.textContent="8N2",X=p("option"),X.textContent="7E1",y=p("option"),y.textContent="8E1",V=v(),U=p("input"),u(l,"class","float-right"),u(_,"name","mi"),_.__value="true",H(_,_.__value),u(_,"type","checkbox"),u(_,"class","rounded mb-1"),u(m,"class","mt-2 ml-3 whitespace-nowrap"),R.__value=0,H(R,R.__value),R.disabled=F=t[6].m.b!=0,u(k,"name","mb"),u(k,"class","in-f tr w-1/2"),t[6].m.b===void 0&&At(()=>t[37].call(k)),O.__value=0,H(O,O.__value),O.disabled=Y=t[6].m.b!=0,W.__value=2,H(W,W.__value),T.__value=3,H(T,T.__value),B.__value=7,H(B,B.__value),X.__value=10,H(X,X.__value),y.__value=11,H(y,y.__value),u(A,"name","mp"),u(A,"class","in-m"),A.disabled=K=t[6].m.b==0,t[6].m.p===void 0&&At(()=>t[38].call(A)),u(U,"name","ms"),u(U,"type","number"),u(U,"min",64),u(U,"max",G=t[0].chip=="esp8266"?t[6].i.h.p==3||t[6].i.h.p==113?512:256:4096),u(U,"step",64),u(U,"class","in-l tr w-1/2"),u(w,"class","flex w-full"),u(e,"class","my-1")},m($,ke){P($,e,ke),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(e,c),o(e,m),o(m,_),_.checked=t[6].m.i,o(m,d),o(m,b),o(e,g),o(e,w),o(w,k),o(k,R),o(R,I);for(let Ce=0;Ce<9;Ce+=1)ae[Ce]&&ae[Ce].m(k,null);Ke(k,t[6].m.b,!0),o(w,M),o(w,A),o(A,O),o(O,j),o(A,W),o(A,T),o(A,B),o(A,X),o(A,y),Ke(A,t[6].m.p,!0),o(w,V),o(w,U),H(U,t[6].m.s),se||(le=[ce(_,"change",t[36]),ce(k,"change",t[37]),ce(A,"change",t[38]),ce(U,"input",t[39])],se=!0)},p($,ke){var Ce,D,S,L,q,z;ke[0]&4&&n!==(n=(((D=(Ce=$[2].conf)==null?void 0:Ce.meter)==null?void 0:D.buffer)??"Buffer size")+"")&&E(i,n),ke[0]&4&&r!==(r=(((L=(S=$[2].conf)==null?void 0:S.meter)==null?void 0:L.serial)??"Serial conf.")+"")&&E(f,r),ke[0]&64&&(_.checked=$[6].m.i),ke[0]&4&&h!==(h=(((z=(q=$[2].conf)==null?void 0:q.meter)==null?void 0:z.inverted)??"inverted")+"")&&E(b,h),ke[0]&64&&F!==(F=$[6].m.b!=0)&&(R.disabled=F),ke[0]&64&&Ke(k,$[6].m.b),ke[0]&64&&Y!==(Y=$[6].m.b!=0)&&(O.disabled=Y),ke[0]&64&&K!==(K=$[6].m.b==0)&&(A.disabled=K),ke[0]&64&&Ke(A,$[6].m.p),ke[0]&65&&G!==(G=$[0].chip=="esp8266"?$[6].i.h.p==3||$[6].i.h.p==113?512:256:4096)&&u(U,"max",G),ke[0]&64&&ye(U.value)!==$[6].m.s&&H(U,$[6].m.s)},d($){$&&N(e),Jt(ae,$),se=!1,jt(le)}}}function fc(t){var c,m;let e,l,n=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.pulses)??"Pulses per kWh")+"",i,s,a,r,f;return{c(){e=p("div"),l=p("span"),i=C(n),s=v(),a=p("input"),u(a,"name","mb"),u(a,"class","in-s tr"),u(a,"type","number"),u(a,"min",1),u(a,"max",3600),u(e,"class","my-1")},m(_,d){P(_,e,d),o(e,l),o(l,i),o(e,s),o(e,a),H(a,t[6].m.b),r||(f=ce(a,"input",t[35]),r=!0)},p(_,d){var h,b;d[0]&4&&n!==(n=(((b=(h=_[2].conf)==null?void 0:h.meter)==null?void 0:b.pulses)??"Pulses per kWh")+"")&&E(i,n),d[0]&64&&ye(a.value)!==_[6].m.b&&H(a,_[6].m.b)},d(_){_&&N(e),r=!1,f()}}}function uc(t){let e;return{c(){e=p("option"),e.textContent=`${t[133]*100}`,e.__value=t[133]*100,H(e,e.__value)},m(l,n){P(l,e,n)},p:Ye,d(l){l&&N(e)}}}function Qo(t){let e,l,n,i;return{c(){e=p("br"),l=p("input"),u(l,"name","mek"),u(l,"type","text"),u(l,"class","in-s"),u(l,"pattern",hu)},m(s,a){P(s,e,a),P(s,l,a),H(l,t[6].m.e.k),n||(i=ce(l,"input",t[44]),n=!0)},p(s,a){a[0]&64&&l.value!==s[6].m.e.k&&H(l,s[6].m.e.k)},d(s){s&&(N(e),N(l)),n=!1,i()}}}function Xo(t){var c,m;let e,l=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.authkey)??"Authentication key")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","mea"),u(a,"type","text"),u(a,"class","in-s"),u(a,"pattern",hu),u(e,"class","my-1")},m(_,d){P(_,e,d),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].m.e.a),r||(f=ce(a,"input",t[45]),r=!0)},p(_,d){var h,b;d[0]&4&&l!==(l=(((b=(h=_[2].conf)==null?void 0:h.meter)==null?void 0:b.authkey)??"Authentication key")+"")&&E(n,l),d[0]&64&&a.value!==_[6].m.e.a&&H(a,_[6].m.e.a)},d(_){_&&N(e),r=!1,f()}}}function Zo(t){var K,V,U,G,se,le,Q,ae,re,ue,ne,pe;let e,l,n=(((U=(V=(K=t[2].conf)==null?void 0:K.meter)==null?void 0:V.multipliers)==null?void 0:U.watt)??"Watt")+"",i,s,a,r,f,c,m=(((le=(se=(G=t[2].conf)==null?void 0:G.meter)==null?void 0:se.multipliers)==null?void 0:le.volt)??"Volt")+"",_,d,h,b,g,w,k=(((re=(ae=(Q=t[2].conf)==null?void 0:Q.meter)==null?void 0:ae.multipliers)==null?void 0:re.amp)??"Amp")+"",R,I,F,M,A,O,j=(((pe=(ne=(ue=t[2].conf)==null?void 0:ue.meter)==null?void 0:ne.multipliers)==null?void 0:pe.kwh)??"kWh")+"",Y,W,T,B,X,y;return{c(){e=p("div"),l=p("div"),i=C(n),s=p("br"),a=v(),r=p("input"),f=v(),c=p("div"),_=C(m),d=p("br"),h=v(),b=p("input"),g=v(),w=p("div"),R=C(k),I=p("br"),F=v(),M=p("input"),A=v(),O=p("div"),Y=C(j),W=p("br"),T=v(),B=p("input"),u(r,"name","mmw"),u(r,"type","number"),u(r,"min","0.00"),u(r,"max","1000"),u(r,"step","0.001"),u(r,"class","in-f tr w-full"),u(l,"class","w-1/4"),u(b,"name","mmv"),u(b,"type","number"),u(b,"min","0.00"),u(b,"max","1000"),u(b,"step","0.001"),u(b,"class","in-m tr w-full"),u(c,"class","w-1/4"),u(M,"name","mma"),u(M,"type","number"),u(M,"min","0.00"),u(M,"max","1000"),u(M,"step","0.001"),u(M,"class","in-m tr w-full"),u(w,"class","w-1/4"),u(B,"name","mmc"),u(B,"type","number"),u(B,"min","0.00"),u(B,"max","1000"),u(B,"step","0.001"),u(B,"class","in-l tr w-full"),u(O,"class","w-1/4"),u(e,"class","flex my-1")},m(oe,J){P(oe,e,J),o(e,l),o(l,i),o(l,s),o(l,a),o(l,r),H(r,t[6].m.m.w),o(e,f),o(e,c),o(c,_),o(c,d),o(c,h),o(c,b),H(b,t[6].m.m.v),o(e,g),o(e,w),o(w,R),o(w,I),o(w,F),o(w,M),H(M,t[6].m.m.a),o(e,A),o(e,O),o(O,Y),o(O,W),o(O,T),o(O,B),H(B,t[6].m.m.c),X||(y=[ce(r,"input",t[47]),ce(b,"input",t[48]),ce(M,"input",t[49]),ce(B,"input",t[50])],X=!0)},p(oe,J){var $,ke,Ce,D,S,L,q,z,ee,fe,_e,de;J[0]&4&&n!==(n=(((Ce=(ke=($=oe[2].conf)==null?void 0:$.meter)==null?void 0:ke.multipliers)==null?void 0:Ce.watt)??"Watt")+"")&&E(i,n),J[0]&64&&ye(r.value)!==oe[6].m.m.w&&H(r,oe[6].m.m.w),J[0]&4&&m!==(m=(((L=(S=(D=oe[2].conf)==null?void 0:D.meter)==null?void 0:S.multipliers)==null?void 0:L.volt)??"Volt")+"")&&E(_,m),J[0]&64&&ye(b.value)!==oe[6].m.m.v&&H(b,oe[6].m.m.v),J[0]&4&&k!==(k=(((ee=(z=(q=oe[2].conf)==null?void 0:q.meter)==null?void 0:z.multipliers)==null?void 0:ee.amp)??"Amp")+"")&&E(R,k),J[0]&64&&ye(M.value)!==oe[6].m.m.a&&H(M,oe[6].m.m.a),J[0]&4&&j!==(j=(((de=(_e=(fe=oe[2].conf)==null?void 0:fe.meter)==null?void 0:_e.multipliers)==null?void 0:de.kwh)??"kWh")+"")&&E(Y,j),J[0]&64&&ye(B.value)!==oe[6].m.m.c&&H(B,oe[6].m.m.c)},d(oe){oe&&N(e),X=!1,jt(y)}}}function Jo(t){var O,j,Y,W,T,B;let e,l,n=(((j=(O=t[2].conf)==null?void 0:O.connection)==null?void 0:j.title)??"Connection")+"",i,s,a,r,f,c,m,_,d,h=(((W=(Y=t[2].conf)==null?void 0:Y.connection)==null?void 0:W.wifi)??"WiFi")+"",b,g,w=(((B=(T=t[2].conf)==null?void 0:T.connection)==null?void 0:B.ap)??"AP")+"",k,R,I,F,M=t[0].if&&t[0].if.eth&&$o(t),A=(t[6].n.c==1||t[6].n.c==2)&&xo(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("select"),d=p("option"),b=C(h),g=p("option"),k=C(w),M&&M.c(),R=v(),A&&A.c(),u(l,"class","text-sm"),u(a,"href",_l("Network-connection")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","w"),f.value="true",d.__value=1,H(d,d.__value),g.__value=2,H(g,g.__value),u(_,"name","nc"),u(_,"class","in-s"),t[6].n.c===void 0&&At(()=>t[51].call(_)),u(m,"class","my-1"),u(e,"class","cnt")},m(X,y){P(X,e,y),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,d),o(d,b),o(_,g),o(g,k),M&&M.m(_,null),Ke(_,t[6].n.c,!0),o(e,R),A&&A.m(e,null),I||(F=ce(_,"change",t[51]),I=!0)},p(X,y){var K,V,U,G,se,le;y[0]&4&&n!==(n=(((V=(K=X[2].conf)==null?void 0:K.connection)==null?void 0:V.title)??"Connection")+"")&&E(i,n),y[0]&4&&h!==(h=(((G=(U=X[2].conf)==null?void 0:U.connection)==null?void 0:G.wifi)??"WiFi")+"")&&E(b,h),y[0]&4&&w!==(w=(((le=(se=X[2].conf)==null?void 0:se.connection)==null?void 0:le.ap)??"AP")+"")&&E(k,w),X[0].if&&X[0].if.eth?M?M.p(X,y):(M=$o(X),M.c(),M.m(_,null)):M&&(M.d(1),M=null),y[0]&64&&Ke(_,X[6].n.c),X[6].n.c==1||X[6].n.c==2?A?A.p(X,y):(A=xo(X),A.c(),A.m(e,null)):A&&(A.d(1),A=null)},d(X){X&&N(e),M&&M.d(),A&&A.d(),I=!1,F()}}}function $o(t){var i,s;let e,l=(((s=(i=t[2].conf)==null?void 0:i.connection)==null?void 0:s.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=C(l),e.__value=3,H(e,e.__value)},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&E(n,l)},d(a){a&&N(e)}}}function xo(t){var Ae,Pe,Oe,Le,De,Ue,xe,Ct,tt,ot,Mt,ht,at,it,ft,Lt,We,Re,He,lt,ve,Ee,Qe;let e,l=(((Pe=(Ae=t[2].conf)==null?void 0:Ae.connection)==null?void 0:Pe.ssid)??"SSID")+"",n,i,s,a,r,f,c,m,_,d,h=(((Le=(Oe=t[2].conf)==null?void 0:Oe.connection)==null?void 0:Le.psk)??"Password")+"",b,g,w,k,R,I,F,M=(((xe=(Ue=(De=t[2].conf)==null?void 0:De.connection)==null?void 0:Ue.ps)==null?void 0:xe.title)??"Power saving")+"",A,O,j,Y,W,T=(((ot=(tt=(Ct=t[2].conf)==null?void 0:Ct.connection)==null?void 0:tt.ps)==null?void 0:ot.default)??"Default")+"",B,X,y=(((at=(ht=(Mt=t[2].conf)==null?void 0:Mt.connection)==null?void 0:ht.ps)==null?void 0:at.off)??"Off")+"",K,V,U=(((Lt=(ft=(it=t[2].conf)==null?void 0:it.connection)==null?void 0:ft.ps)==null?void 0:Lt.min)??"Min")+"",G,se,le=(((He=(Re=(We=t[2].conf)==null?void 0:We.connection)==null?void 0:Re.ps)==null?void 0:He.max)??"Max")+"",Q,ae,re,ue=(((ve=(lt=t[2].conf)==null?void 0:lt.connection)==null?void 0:ve.pwr)??"Power")+"",ne,pe,oe,J,$,ke,Ce,D,S,L,q,z,ee=(((Qe=(Ee=t[2].conf)==null?void 0:Ee.connection)==null?void 0:Qe.tick_11b)??"802.11b")+"",fe,_e,de;function x(me,we){return me[8]?cc:rc}let he=x(t),be=he(t);return{c(){e=p("div"),n=C(l),i=v(),s=p("label"),a=p("input"),r=C(" manual"),f=v(),c=p("br"),m=v(),be.c(),_=v(),d=p("div"),b=C(h),g=p("br"),w=v(),k=p("input"),R=v(),I=p("div"),F=p("div"),A=C(M),O=p("br"),j=v(),Y=p("select"),W=p("option"),B=C(T),X=p("option"),K=C(y),V=p("option"),G=C(U),se=p("option"),Q=C(le),ae=v(),re=p("div"),ne=C(ue),pe=p("br"),oe=v(),J=p("div"),$=p("input"),ke=v(),Ce=p("span"),Ce.textContent="dBm",D=v(),S=p("div"),L=p("label"),q=p("input"),z=v(),fe=C(ee),u(a,"type","checkbox"),a.__value="true",H(a,a.__value),u(a,"class","rounded mb-1"),u(s,"class","float-right mr-3"),u(e,"class","my-1"),u(k,"name","wp"),u(k,"type","password"),u(k,"class","in-s"),u(k,"pattern",Mn),u(d,"class","my-1"),W.__value=255,H(W,W.__value),X.__value=0,H(X,X.__value),V.__value=1,H(V,V.__value),se.__value=2,H(se,se.__value),u(Y,"name","wz"),u(Y,"class","in-s"),t[6].w.z===void 0&&At(()=>t[56].call(Y)),u(F,"class","w-1/2"),u($,"name","ww"),u($,"type","number"),u($,"min","0"),u($,"max","20.5"),u($,"step","0.5"),u($,"class","in-f tr w-full"),u(Ce,"class","in-post"),u(J,"class","flex"),u(re,"class","ml-2 w-1/2"),u(I,"class","my-1 flex"),u(q,"type","checkbox"),u(q,"name","wb"),q.__value="true",H(q,q.__value),u(q,"class","rounded mb-1"),u(S,"class","my-3")},m(me,we){P(me,e,we),o(e,n),o(e,i),o(e,s),o(s,a),a.checked=t[8],o(s,r),o(e,f),o(e,c),o(e,m),be.m(e,null),P(me,_,we),P(me,d,we),o(d,b),o(d,g),o(d,w),o(d,k),H(k,t[6].w.p),P(me,R,we),P(me,I,we),o(I,F),o(F,A),o(F,O),o(F,j),o(F,Y),o(Y,W),o(W,B),o(Y,X),o(X,K),o(Y,V),o(V,G),o(Y,se),o(se,Q),Ke(Y,t[6].w.z,!0),o(I,ae),o(I,re),o(re,ne),o(re,pe),o(re,oe),o(re,J),o(J,$),H($,t[6].w.w),o(J,ke),o(J,Ce),P(me,D,we),P(me,S,we),o(S,L),o(L,q),q.checked=t[6].w.b,o(L,z),o(L,fe),_e||(de=[ce(a,"change",t[52]),ce(k,"input",t[55]),ce(Y,"change",t[56]),ce($,"input",t[57]),ce(q,"change",t[58])],_e=!0)},p(me,we){var ut,Ge,Ft,gt,Be,kt,ct,mt,et,qt,Wt,wt,_t,zt,Xt,Ut,Ht,Yt,$t,Gt,It,Fe,Xe;we[0]&4&&l!==(l=(((Ge=(ut=me[2].conf)==null?void 0:ut.connection)==null?void 0:Ge.ssid)??"SSID")+"")&&E(n,l),we[0]&256&&(a.checked=me[8]),he===(he=x(me))&&be?be.p(me,we):(be.d(1),be=he(me),be&&(be.c(),be.m(e,null))),we[0]&4&&h!==(h=(((gt=(Ft=me[2].conf)==null?void 0:Ft.connection)==null?void 0:gt.psk)??"Password")+"")&&E(b,h),we[0]&64&&k.value!==me[6].w.p&&H(k,me[6].w.p),we[0]&4&&M!==(M=(((ct=(kt=(Be=me[2].conf)==null?void 0:Be.connection)==null?void 0:kt.ps)==null?void 0:ct.title)??"Power saving")+"")&&E(A,M),we[0]&4&&T!==(T=(((qt=(et=(mt=me[2].conf)==null?void 0:mt.connection)==null?void 0:et.ps)==null?void 0:qt.default)??"Default")+"")&&E(B,T),we[0]&4&&y!==(y=(((_t=(wt=(Wt=me[2].conf)==null?void 0:Wt.connection)==null?void 0:wt.ps)==null?void 0:_t.off)??"Off")+"")&&E(K,y),we[0]&4&&U!==(U=(((Ut=(Xt=(zt=me[2].conf)==null?void 0:zt.connection)==null?void 0:Xt.ps)==null?void 0:Ut.min)??"Min")+"")&&E(G,U),we[0]&4&&le!==(le=((($t=(Yt=(Ht=me[2].conf)==null?void 0:Ht.connection)==null?void 0:Yt.ps)==null?void 0:$t.max)??"Max")+"")&&E(Q,le),we[0]&64&&Ke(Y,me[6].w.z),we[0]&4&&ue!==(ue=(((It=(Gt=me[2].conf)==null?void 0:Gt.connection)==null?void 0:It.pwr)??"Power")+"")&&E(ne,ue),we[0]&64&&ye($.value)!==me[6].w.w&&H($,me[6].w.w),we[0]&64&&(q.checked=me[6].w.b),we[0]&4&&ee!==(ee=(((Xe=(Fe=me[2].conf)==null?void 0:Fe.connection)==null?void 0:Xe.tick_11b)??"802.11b")+"")&&E(fe,ee)},d(me){me&&(N(e),N(_),N(d),N(R),N(I),N(D),N(S)),be.d(),_e=!1,jt(de)}}}function rc(t){var f,c;let e,l,n,i,s,a=((f=t[9])==null?void 0:f.c)==-1&&ea(),r=((c=t[9])==null?void 0:c.n)&&ta(t);return{c(){e=p("select"),a&&a.c(),l=yt(),r&&r.c(),u(e,"name","ws"),u(e,"class","in-s"),e.required=n=t[6].n.c==1||t[6].n.c==2,t[6].w.s===void 0&&At(()=>t[54].call(e))},m(m,_){P(m,e,_),a&&a.m(e,null),o(e,l),r&&r.m(e,null),Ke(e,t[6].w.s,!0),i||(s=ce(e,"change",t[54]),i=!0)},p(m,_){var d,h;((d=m[9])==null?void 0:d.c)==-1?a||(a=ea(),a.c(),a.m(e,l)):a&&(a.d(1),a=null),(h=m[9])!=null&&h.n?r?r.p(m,_):(r=ta(m),r.c(),r.m(e,null)):r&&(r.d(1),r=null),_[0]&64&&n!==(n=m[6].n.c==1||m[6].n.c==2)&&(e.required=n),_[0]&64&&Ke(e,m[6].w.s)},d(m){m&&N(e),a&&a.d(),r&&r.d(),i=!1,s()}}}function cc(t){let e,l,n,i;return{c(){e=p("input"),u(e,"name","ws"),u(e,"type","text"),u(e,"class","in-s"),u(e,"pattern",Mn),e.required=l=t[6].n.c==1||t[6].n.c==2},m(s,a){P(s,e,a),H(e,t[6].w.s),n||(i=ce(e,"input",t[53]),n=!0)},p(s,a){a[0]&64&&l!==(l=s[6].n.c==1||s[6].n.c==2)&&(e.required=l),a[0]&64&&e.value!==s[6].w.s&&H(e,s[6].w.s)},d(s){s&&N(e),n=!1,i()}}}function ea(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",H(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function ta(t){var i;let e,l=rt((i=t[9])==null?void 0:i.n),n=[];for(let s=0;st[59].call(b)),u(A,"name","ni"),u(A,"type","text"),u(A,"class","in-m w-full"),A.disabled=O=t[6].n.m=="dhcp",A.required=j=t[6].n.m=="static",u(A,"pattern",_n),u(W,"name","ns"),u(W,"class","in-l"),W.disabled=B=t[6].n.m=="dhcp",W.required=X=t[6].n.m=="static",t[6].n.s===void 0&&At(()=>t[61].call(W)),u(h,"class","flex"),u(f,"class","my-1"),u(G,"name","nx"),G.__value="true",H(G,G.__value),u(G,"type","checkbox"),u(G,"class","rounded mb-1"),u(V,"class","my-1"),u(re,"name","nd"),re.__value="true",H(re,re.__value),u(re,"type","checkbox"),u(re,"class","rounded mb-1"),u(Q,"class","my-1"),u(J,"type","hidden"),u(J,"name","ntp"),J.value="true",u(q,"name","ntpd"),q.__value="true",H(q,q.__value),u(q,"type","checkbox"),u(q,"class","rounded mb-1"),u(L,"class","ml-4"),u(he,"name","ntph"),u(he,"type","text"),u(he,"class","in-s"),u(he,"pattern",Ll),u(x,"class","flex"),u(ke,"class","my-1"),u(e,"class","cnt")},m(Re,He){P(Re,e,He),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(f,m),o(f,_),o(f,d),o(f,h),o(h,b),o(b,g),o(g,k),o(b,R),o(R,F),Ke(b,t[6].n.m,!0),o(h,M),o(h,A),H(A,t[6].n.i),o(h,Y),o(h,W),Se(T,W,null),Ke(W,t[6].n.s,!0),o(e,y),Oe&&Oe.m(e,null),o(e,K),o(e,V),o(V,U),o(U,G),G.checked=t[6].n.x,o(U,se),o(e,le),o(e,Q),o(Q,ae),o(ae,re),re.checked=t[6].n.d,o(ae,ue),o(ae,pe),o(e,oe),o(e,J),o(e,$),o(e,ke),o(ke,D),o(ke,S),o(ke,L),o(L,q),q.checked=t[6].n.h,o(L,z),o(L,fe),o(ke,_e),o(ke,de),o(ke,x),o(x,he),H(he,t[6].n.n1),be=!0,Ae||(Pe=[ce(b,"change",t[59]),ce(A,"input",t[60]),ce(W,"change",t[61]),ce(G,"change",t[65]),ce(re,"change",t[66]),ce(q,"change",t[67]),ce(he,"input",t[68])],Ae=!0)},p(Re,He){var lt,ve,Ee,Qe,me,we,ut,Ge,Ft,gt,Be,kt,ct,mt;(!be||He[0]&4)&&n!==(n=(((ve=(lt=Re[2].conf)==null?void 0:lt.network)==null?void 0:ve.title)??"Network")+"")&&E(i,n),(!be||He[0]&4)&&c!==(c=(((Qe=(Ee=Re[2].conf)==null?void 0:Ee.network)==null?void 0:Qe.ip)??"IP")+"")&&E(m,c),(!be||He[0]&4)&&w!==(w=(((we=(me=Re[2].conf)==null?void 0:me.network)==null?void 0:we.dhcp)??"DHCP")+"")&&E(k,w),(!be||He[0]&4)&&I!==(I=(((Ge=(ut=Re[2].conf)==null?void 0:ut.network)==null?void 0:Ge.static)??"Static")+"")&&E(F,I),He[0]&64&&Ke(b,Re[6].n.m),(!be||He[0]&64&&O!==(O=Re[6].n.m=="dhcp"))&&(A.disabled=O),(!be||He[0]&64&&j!==(j=Re[6].n.m=="static"))&&(A.required=j),He[0]&64&&A.value!==Re[6].n.i&&H(A,Re[6].n.i),(!be||He[0]&64&&B!==(B=Re[6].n.m=="dhcp"))&&(W.disabled=B),(!be||He[0]&64&&X!==(X=Re[6].n.m=="static"))&&(W.required=X),He[0]&64&&Ke(W,Re[6].n.s),Re[6].n.m=="static"?Oe?Oe.p(Re,He):(Oe=ia(Re),Oe.c(),Oe.m(e,K)):Oe&&(Oe.d(1),Oe=null),He[0]&64&&(G.checked=Re[6].n.x),He[0]&64&&(re.checked=Re[6].n.d),(!be||He[0]&4)&&ne!==(ne=(((gt=(Ft=Re[2].conf)==null?void 0:Ft.network)==null?void 0:gt.tick_mdns)??"mDNS")+"")&&E(pe,ne),(!be||He[0]&4)&&Ce!==(Ce=(((kt=(Be=Re[2].conf)==null?void 0:Be.network)==null?void 0:kt.ntp)??"NTP")+"")&&E(D,Ce),He[0]&64&&(q.checked=Re[6].n.h),(!be||He[0]&4)&&ee!==(ee=(((mt=(ct=Re[2].conf)==null?void 0:ct.network)==null?void 0:mt.tick_ntp_dhcp)??"from DHCP")+"")&&E(fe,ee),He[0]&64&&he.value!==Re[6].n.n1&&H(he,Re[6].n.n1)},i(Re){be||(Z(T.$$.fragment,Re),be=!0)},o(Re){ie(T.$$.fragment,Re),be=!1},d(Re){Re&&N(e),Me(T),Oe&&Oe.d(),Ae=!1,jt(Pe)}}}function ia(t){var I,F,M,A;let e,l=(((F=(I=t[2].conf)==null?void 0:I.network)==null?void 0:F.gw)??"Gateway")+"",n,i,s,a,r,f,c=(((A=(M=t[2].conf)==null?void 0:M.network)==null?void 0:A.dns)??"DNS")+"",m,_,d,h,b,g,w,k,R;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),r=v(),f=p("div"),m=C(c),_=p("br"),d=v(),h=p("div"),b=p("input"),g=v(),w=p("input"),u(a,"name","ng"),u(a,"type","text"),u(a,"class","in-s"),u(a,"pattern",_n),u(e,"class","my-1"),u(b,"name","nd1"),u(b,"type","text"),u(b,"class","in-f w-full"),u(b,"pattern",_n),u(w,"name","nd2"),u(w,"type","text"),u(w,"class","in-l w-full"),u(w,"pattern",_n),u(h,"class","flex"),u(f,"class","my-1")},m(O,j){P(O,e,j),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].n.g),P(O,r,j),P(O,f,j),o(f,m),o(f,_),o(f,d),o(f,h),o(h,b),H(b,t[6].n.d1),o(h,g),o(h,w),H(w,t[6].n.d2),k||(R=[ce(a,"input",t[62]),ce(b,"input",t[63]),ce(w,"input",t[64])],k=!0)},p(O,j){var Y,W,T,B;j[0]&4&&l!==(l=(((W=(Y=O[2].conf)==null?void 0:Y.network)==null?void 0:W.gw)??"Gateway")+"")&&E(n,l),j[0]&64&&a.value!==O[6].n.g&&H(a,O[6].n.g),j[0]&4&&c!==(c=(((B=(T=O[2].conf)==null?void 0:T.network)==null?void 0:B.dns)??"DNS")+"")&&E(m,c),j[0]&64&&b.value!==O[6].n.d1&&H(b,O[6].n.d1),j[0]&64&&w.value!==O[6].n.d2&&H(w,O[6].n.d2)},d(O){O&&(N(e),N(r),N(f)),k=!1,jt(R)}}}function sa(t){var Et,pt,ge,nt,ze,el,tl,ll,nl,il,sl,Ze,dt,Te,te,Ie,Zt,fl,ml,gl,kl,wl,Cl,Sl,Ml,Il,Rl,Fl;let e,l,n=(((pt=(Et=t[2].conf)==null?void 0:Et.mqtt)==null?void 0:pt.title)??"MQTT")+"",i,s,a,r,f,c,m,_=(((nt=(ge=t[2].conf)==null?void 0:ge.mqtt)==null?void 0:nt.server)??"Server")+"",d,h,b,g,w,k,R,I,F,M,A,O,j=(((el=(ze=t[2].conf)==null?void 0:ze.mqtt)==null?void 0:el.user)??"Username")+"",Y,W,T,B,X,y,K=(((ll=(tl=t[2].conf)==null?void 0:tl.mqtt)==null?void 0:ll.pass)??"Password")+"",V,U,G,se,le,Q,ae,re=(((il=(nl=t[2].conf)==null?void 0:nl.mqtt)==null?void 0:il.id)??"Client ID")+"",ue,ne,pe,oe,J,$,ke,Ce=(((Ze=(sl=t[2].conf)==null?void 0:sl.mqtt)==null?void 0:Ze.payload)??"Payload")+"",D,S,L,q,z,ee,fe,_e,de,x,he,be,Ae,Pe,Oe=(((Te=(dt=t[2].conf)==null?void 0:dt.mqtt)==null?void 0:Te.publish)??"Publish topic")+"",Le,De,Ue,xe,Ct,tt,ot=(((Ie=(te=t[2].conf)==null?void 0:te.mqtt)==null?void 0:Ie.subscribe)??"Subscribe topic")+"",Mt,ht,at,it,ft,Lt,We,Re=(((fl=(Zt=t[2].conf)==null?void 0:Zt.mqtt)==null?void 0:fl.update)??"Update method")+"",He,lt,ve,Ee=(((gl=(ml=t[2].conf)==null?void 0:ml.mqtt)==null?void 0:gl.interval)??"Interval")+"",Qe,me,we,ut,Ge,Ft=(((wl=(kl=t[2].conf)==null?void 0:kl.mqtt)==null?void 0:wl.realtime)??"Real time")+"",gt,Be,kt=(((Sl=(Cl=t[2].conf)==null?void 0:Cl.mqtt)==null?void 0:Sl.interval)??"Interval")+"",ct,mt,et,qt,Wt,wt,_t=(((Il=(Ml=t[2].conf)==null?void 0:Ml.mqtt)==null?void 0:Il.timeout)??"Timeout")+"",zt,Xt,Ut,Ht=(((Fl=(Rl=t[2].conf)==null?void 0:Rl.mqtt)==null?void 0:Fl.keepalive)??"Keep-alive")+"",Yt,$t,Gt,It,Fe,Xe,je,Dt,Bt,$e=t[0].chip!="esp8266"&&oa(t),st=t[6].q.s.e&&aa(t);return{c(){var Ve,qe;e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),d=C(_),h=v(),$e&&$e.c(),b=v(),g=p("br"),w=v(),k=p("div"),R=p("input"),I=v(),F=p("input"),M=v(),st&&st.c(),A=v(),O=p("div"),Y=C(j),W=p("br"),T=v(),B=p("input"),X=v(),y=p("div"),V=C(K),U=p("br"),G=v(),se=p("input"),le=v(),Q=p("div"),ae=p("div"),ue=C(re),ne=p("br"),pe=v(),oe=p("input"),$=v(),ke=p("div"),D=C(Ce),S=p("br"),L=v(),q=p("select"),z=p("option"),z.textContent="Raw (minimal)",ee=p("option"),ee.textContent="Raw (full)",fe=p("option"),fe.textContent="Domoticz",_e=p("option"),_e.textContent="Home-Assistant",de=p("option"),de.textContent="JSON (classic)",x=p("option"),x.textContent="JSON (multi topic)",he=p("option"),he.textContent="JSON (flat)",be=p("option"),be.textContent="HEX dump",Ae=v(),Pe=p("div"),Le=C(Oe),De=p("br"),Ue=v(),xe=p("input"),Ct=v(),tt=p("div"),Mt=C(ot),ht=p("br"),at=v(),it=p("input"),Lt=v(),We=p("div"),He=C(Re),lt=v(),ve=p("span"),Qe=C(Ee),me=v(),we=p("div"),ut=p("select"),Ge=p("option"),gt=C(Ft),Be=p("option"),ct=C(kt),mt=v(),et=p("input"),Wt=v(),wt=p("div"),zt=C(_t),Xt=v(),Ut=p("span"),Yt=C(Ht),$t=v(),Gt=p("div"),It=p("input"),Fe=v(),Xe=p("input"),u(l,"class","text-sm"),u(a,"href",_l("MQTT-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","q"),f.value="true",u(R,"name","qh"),u(R,"type","text"),u(R,"class","in-f w-2/3"),u(R,"pattern",Ll),u(F,"name","qp"),u(F,"type","number"),u(F,"min","1024"),u(F,"max","65535"),u(F,"class","in-l tr w-1/3"),u(k,"class","flex"),u(m,"class","my-1"),u(B,"name","qu"),u(B,"type","text"),u(B,"class","in-s"),u(B,"pattern",Mn),u(O,"class","my-1"),u(se,"name","qa"),u(se,"type","password"),u(se,"class","in-s"),u(se,"pattern",Mn),u(y,"class","my-1"),u(oe,"name","qc"),u(oe,"type","text"),u(oe,"class","in-f w-full"),oe.required=J=t[6].q.h,u(oe,"pattern",Vn),z.__value=1,H(z,z.__value),ee.__value=2,H(ee,ee.__value),fe.__value=3,H(fe,fe.__value),_e.__value=4,H(_e,_e.__value),de.__value=0,H(de,de.__value),x.__value=5,H(x,x.__value),he.__value=6,H(he,he.__value),be.__value=255,H(be,be.__value),u(q,"name","qm"),u(q,"class","in-l"),t[6].q.m===void 0&&At(()=>t[75].call(q)),u(Q,"class","my-1 flex"),u(xe,"name","qb"),u(xe,"type","text"),u(xe,"class","in-s"),u(xe,"pattern",Ll),u(Pe,"class","my-1"),u(it,"name","qr"),u(it,"type","text"),u(it,"class","in-s"),u(it,"pattern",Ll),u(it,"placeholder",ft=t[6].q.b+"/command"),u(tt,"class","my-1"),u(ve,"class","float-right"),Ge.__value=0,H(Ge,Ge.__value),Be.__value=1,H(Be,Be.__value),u(ut,"name","qt"),u(ut,"class","in-f w-1/2"),t[6].q.t===void 0&&At(()=>t[78].call(ut)),u(et,"name","qd"),u(et,"type","number"),u(et,"min","1"),u(et,"max","3600"),u(et,"class","in-l tr w-1/2"),et.disabled=qt=((qe=(Ve=t[6])==null?void 0:Ve.q)==null?void 0:qe.t)!=1,u(we,"class","flex"),u(We,"class","my-1"),u(Ut,"class","float-right"),u(It,"name","qi"),u(It,"type","number"),u(It,"min","500"),u(It,"max","10000"),u(It,"class","in-f tr w-1/2"),u(Xe,"name","qk"),u(Xe,"type","number"),u(Xe,"min","5"),u(Xe,"max","180"),u(Xe,"class","in-l tr w-1/2"),u(Gt,"class","flex"),u(wt,"class","my-1"),u(e,"class","cnt")},m(Ve,qe){P(Ve,e,qe),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,d),o(m,h),$e&&$e.m(m,null),o(m,b),o(m,g),o(m,w),o(m,k),o(k,R),H(R,t[6].q.h),o(k,I),o(k,F),H(F,t[6].q.p),o(e,M),st&&st.m(e,null),o(e,A),o(e,O),o(O,Y),o(O,W),o(O,T),o(O,B),H(B,t[6].q.u),o(e,X),o(e,y),o(y,V),o(y,U),o(y,G),o(y,se),H(se,t[6].q.a),o(e,le),o(e,Q),o(Q,ae),o(ae,ue),o(ae,ne),o(ae,pe),o(ae,oe),H(oe,t[6].q.c),o(Q,$),o(Q,ke),o(ke,D),o(ke,S),o(ke,L),o(ke,q),o(q,z),o(q,ee),o(q,fe),o(q,_e),o(q,de),o(q,x),o(q,he),o(q,be),Ke(q,t[6].q.m,!0),o(e,Ae),o(e,Pe),o(Pe,Le),o(Pe,De),o(Pe,Ue),o(Pe,xe),H(xe,t[6].q.b),o(e,Ct),o(e,tt),o(tt,Mt),o(tt,ht),o(tt,at),o(tt,it),H(it,t[6].q.r),o(e,Lt),o(e,We),o(We,He),o(We,lt),o(We,ve),o(ve,Qe),o(We,me),o(We,we),o(we,ut),o(ut,Ge),o(Ge,gt),o(ut,Be),o(Be,ct),Ke(ut,t[6].q.t,!0),o(we,mt),o(we,et),H(et,t[6].q.d),o(e,Wt),o(e,wt),o(wt,zt),o(wt,Xt),o(wt,Ut),o(Ut,Yt),o(wt,$t),o(wt,Gt),o(Gt,It),H(It,t[6].q.i),o(Gt,Fe),o(Gt,Xe),H(Xe,t[6].q.k),je=!0,Dt||(Bt=[ce(R,"input",t[70]),ce(F,"input",t[71]),ce(B,"input",t[72]),ce(se,"input",t[73]),ce(oe,"input",t[74]),ce(q,"change",t[75]),ce(xe,"input",t[76]),ce(it,"input",t[77]),ce(ut,"change",t[78]),ce(et,"input",t[79]),ce(It,"input",t[80]),ce(Xe,"input",t[81])],Dt=!0)},p(Ve,qe){var Rt,al,Ul,Bl,jl,Hl,yl,zl,Wl,Gl,Vl,Kl,Yl,Ql,Xl,Zl,Jl,$l,xl,en,tn,Nn,Pn,Tn,qn,En,Dn,An,On,Ln;(!je||qe[0]&4)&&n!==(n=(((al=(Rt=Ve[2].conf)==null?void 0:Rt.mqtt)==null?void 0:al.title)??"MQTT")+"")&&E(i,n),(!je||qe[0]&4)&&_!==(_=(((Bl=(Ul=Ve[2].conf)==null?void 0:Ul.mqtt)==null?void 0:Bl.server)??"Server")+"")&&E(d,_),Ve[0].chip!="esp8266"?$e?$e.p(Ve,qe):($e=oa(Ve),$e.c(),$e.m(m,b)):$e&&($e.d(1),$e=null),qe[0]&64&&R.value!==Ve[6].q.h&&H(R,Ve[6].q.h),qe[0]&64&&ye(F.value)!==Ve[6].q.p&&H(F,Ve[6].q.p),Ve[6].q.s.e?st?(st.p(Ve,qe),qe[0]&64&&Z(st,1)):(st=aa(Ve),st.c(),Z(st,1),st.m(e,A)):st&&(vt(),ie(st,1,1,()=>{st=null}),bt()),(!je||qe[0]&4)&&j!==(j=(((Hl=(jl=Ve[2].conf)==null?void 0:jl.mqtt)==null?void 0:Hl.user)??"Username")+"")&&E(Y,j),qe[0]&64&&B.value!==Ve[6].q.u&&H(B,Ve[6].q.u),(!je||qe[0]&4)&&K!==(K=(((zl=(yl=Ve[2].conf)==null?void 0:yl.mqtt)==null?void 0:zl.pass)??"Password")+"")&&E(V,K),qe[0]&64&&se.value!==Ve[6].q.a&&H(se,Ve[6].q.a),(!je||qe[0]&4)&&re!==(re=(((Gl=(Wl=Ve[2].conf)==null?void 0:Wl.mqtt)==null?void 0:Gl.id)??"Client ID")+"")&&E(ue,re),(!je||qe[0]&64&&J!==(J=Ve[6].q.h))&&(oe.required=J),qe[0]&64&&oe.value!==Ve[6].q.c&&H(oe,Ve[6].q.c),(!je||qe[0]&4)&&Ce!==(Ce=(((Kl=(Vl=Ve[2].conf)==null?void 0:Vl.mqtt)==null?void 0:Kl.payload)??"Payload")+"")&&E(D,Ce),qe[0]&64&&Ke(q,Ve[6].q.m),(!je||qe[0]&4)&&Oe!==(Oe=(((Ql=(Yl=Ve[2].conf)==null?void 0:Yl.mqtt)==null?void 0:Ql.publish)??"Publish topic")+"")&&E(Le,Oe),qe[0]&64&&xe.value!==Ve[6].q.b&&H(xe,Ve[6].q.b),(!je||qe[0]&4)&&ot!==(ot=(((Zl=(Xl=Ve[2].conf)==null?void 0:Xl.mqtt)==null?void 0:Zl.subscribe)??"Subscribe topic")+"")&&E(Mt,ot),(!je||qe[0]&64&&ft!==(ft=Ve[6].q.b+"/command"))&&u(it,"placeholder",ft),qe[0]&64&&it.value!==Ve[6].q.r&&H(it,Ve[6].q.r),(!je||qe[0]&4)&&Re!==(Re=((($l=(Jl=Ve[2].conf)==null?void 0:Jl.mqtt)==null?void 0:$l.update)??"Update method")+"")&&E(He,Re),(!je||qe[0]&4)&&Ee!==(Ee=(((en=(xl=Ve[2].conf)==null?void 0:xl.mqtt)==null?void 0:en.interval)??"Interval")+"")&&E(Qe,Ee),(!je||qe[0]&4)&&Ft!==(Ft=(((Nn=(tn=Ve[2].conf)==null?void 0:tn.mqtt)==null?void 0:Nn.realtime)??"Real time")+"")&&E(gt,Ft),(!je||qe[0]&4)&&kt!==(kt=(((Tn=(Pn=Ve[2].conf)==null?void 0:Pn.mqtt)==null?void 0:Tn.interval)??"Interval")+"")&&E(ct,kt),qe[0]&64&&Ke(ut,Ve[6].q.t),(!je||qe[0]&64&&qt!==(qt=((En=(qn=Ve[6])==null?void 0:qn.q)==null?void 0:En.t)!=1))&&(et.disabled=qt),qe[0]&64&&ye(et.value)!==Ve[6].q.d&&H(et,Ve[6].q.d),(!je||qe[0]&4)&&_t!==(_t=(((An=(Dn=Ve[2].conf)==null?void 0:Dn.mqtt)==null?void 0:An.timeout)??"Timeout")+"")&&E(zt,_t),(!je||qe[0]&4)&&Ht!==(Ht=(((Ln=(On=Ve[2].conf)==null?void 0:On.mqtt)==null?void 0:Ln.keepalive)??"Keep-alive")+"")&&E(Yt,Ht),qe[0]&64&&ye(It.value)!==Ve[6].q.i&&H(It,Ve[6].q.i),qe[0]&64&&ye(Xe.value)!==Ve[6].q.k&&H(Xe,Ve[6].q.k)},i(Ve){je||(Z(st),je=!0)},o(Ve){ie(st),je=!1},d(Ve){Ve&&N(e),$e&&$e.d(),st&&st.d(),Dt=!1,jt(Bt)}}}function oa(t){let e,l,n,i,s;return{c(){e=p("label"),l=p("input"),n=C(" SSL"),u(l,"type","checkbox"),u(l,"name","qs"),l.__value="true",H(l,l.__value),u(l,"class","rounded mb-1"),u(e,"class","float-right mr-3")},m(a,r){P(a,e,r),o(e,l),l.checked=t[6].q.s.e,o(e,n),i||(s=[ce(l,"change",t[69]),ce(l,"change",t[20])],i=!0)},p(a,r){r[0]&64&&(l.checked=a[6].q.s.e)},d(a){a&&N(e),i=!1,jt(s)}}}function aa(t){let e,l,n,i,s,a,r,f,c,m,_,d,h;const b=[mc,_c],g=[];function w(O,j){return O[6].q.s.c?0:1}n=w(t),i=g[n]=b[n](t);const k=[vc,hc],R=[];function I(O,j){return O[6].q.s.r?0:1}r=I(t),f=R[r]=k[r](t);const F=[wc,kc],M=[];function A(O,j){return O[6].q.s.k?0:1}return _=A(t),d=M[_]=F[_](t),{c(){e=p("div"),l=p("span"),i.c(),s=v(),a=p("span"),f.c(),c=v(),m=p("span"),d.c(),u(l,"class","flex pr-2"),u(a,"class","flex pr-2"),u(m,"class","flex pr-2"),u(e,"class","my-1 flex")},m(O,j){P(O,e,j),o(e,l),g[n].m(l,null),o(e,s),o(e,a),R[r].m(a,null),o(e,c),o(e,m),M[_].m(m,null),h=!0},p(O,j){let Y=n;n=w(O),n===Y?g[n].p(O,j):(vt(),ie(g[Y],1,1,()=>{g[Y]=null}),bt(),i=g[n],i?i.p(O,j):(i=g[n]=b[n](O),i.c()),Z(i,1),i.m(l,null));let W=r;r=I(O),r===W?R[r].p(O,j):(vt(),ie(R[W],1,1,()=>{R[W]=null}),bt(),f=R[r],f?f.p(O,j):(f=R[r]=k[r](O),f.c()),Z(f,1),f.m(a,null));let T=_;_=A(O),_===T?M[_].p(O,j):(vt(),ie(M[T],1,1,()=>{M[T]=null}),bt(),d=M[_],d?d.p(O,j):(d=M[_]=F[_](O),d.c()),Z(d,1),d.m(m,null))},i(O){h||(Z(i),Z(f),Z(d),h=!0)},o(O){ie(i),ie(f),ie(d),h=!1},d(O){O&&N(e),g[n].d(),R[r].d(),M[_].d()}}}function _c(t){let e,l;return e=new pl({props:{to:"/mqtt-ca",$$slots:{default:[pc]},$$scope:{ctx:t}}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i[0]&4|i[4]&32768&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function mc(t){let e,l,n,i,s,a,r;return l=new pl({props:{to:"/mqtt-ca",$$slots:{default:[dc]},$$scope:{ctx:t}}}),{c(){e=p("span"),Ne(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Se(l,e,null),P(f,n,c),P(f,i,c),s=!0,a||(r=[ce(i,"click",t[17]),ce(i,"keypress",t[17])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&32768&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){s||(Z(l.$$.fragment,f),s=!0)},o(f){ie(l.$$.fragment,f),s=!1},d(f){f&&(N(e),N(n),N(i)),Me(l),a=!1,jt(r)}}}function pc(t){var n,i,s,a;let e,l;return e=new un({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_ca_upload)??"Upload CA",title:((a=(s=t[2].conf)==null?void 0:s.mqtt)==null?void 0:a.title_ca)??""}}),{c(){Ne(e.$$.fragment)},m(r,f){Se(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_ca_upload)??"Upload CA"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_ca)??""),e.$set(c)},i(r){l||(Z(e.$$.fragment,r),l=!0)},o(r){ie(e.$$.fragment,r),l=!1},d(r){Me(e,r)}}}function dc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.ca_ok)??"CA OK")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.mqtt)==null?void 0:f.ca_ok)??"CA OK")+"")&&E(l,e)},d(s){s&&N(l)}}}function hc(t){let e,l;return e=new pl({props:{to:"/mqtt-cert",$$slots:{default:[bc]},$$scope:{ctx:t}}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i[0]&4|i[4]&32768&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function vc(t){let e,l,n,i,s,a,r;return l=new pl({props:{to:"/mqtt-cert",$$slots:{default:[gc]},$$scope:{ctx:t}}}),{c(){e=p("span"),Ne(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Se(l,e,null),P(f,n,c),P(f,i,c),s=!0,a||(r=[ce(i,"click",t[18]),ce(i,"keypress",t[18])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&32768&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){s||(Z(l.$$.fragment,f),s=!0)},o(f){ie(l.$$.fragment,f),s=!1},d(f){f&&(N(e),N(n),N(i)),Me(l),a=!1,jt(r)}}}function bc(t){var n,i,s,a;let e,l;return e=new un({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_crt_upload)??"Upload cert",title:((a=(s=t[2].conf)==null?void 0:s.mqtt)==null?void 0:a.title_crt)??""}}),{c(){Ne(e.$$.fragment)},m(r,f){Se(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_crt_upload)??"Upload cert"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_crt)??""),e.$set(c)},i(r){l||(Z(e.$$.fragment,r),l=!0)},o(r){ie(e.$$.fragment,r),l=!1},d(r){Me(e,r)}}}function gc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.crt_ok)??"Cert OK")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.mqtt)==null?void 0:f.crt_ok)??"Cert OK")+"")&&E(l,e)},d(s){s&&N(l)}}}function kc(t){let e,l;return e=new pl({props:{to:"/mqtt-key",$$slots:{default:[Cc]},$$scope:{ctx:t}}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i[0]&4|i[4]&32768&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function wc(t){let e,l,n,i,s,a,r;return l=new pl({props:{to:"/mqtt-key",$$slots:{default:[Sc]},$$scope:{ctx:t}}}),{c(){e=p("span"),Ne(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Se(l,e,null),P(f,n,c),P(f,i,c),s=!0,a||(r=[ce(i,"click",t[19]),ce(i,"keypress",t[19])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&32768&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){s||(Z(l.$$.fragment,f),s=!0)},o(f){ie(l.$$.fragment,f),s=!1},d(f){f&&(N(e),N(n),N(i)),Me(l),a=!1,jt(r)}}}function Cc(t){var n,i,s,a;let e,l;return e=new un({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_key_upload)??"Upload key",title:((a=(s=t[2].conf)==null?void 0:s.mqtt)==null?void 0:a.title_key)??""}}),{c(){Ne(e.$$.fragment)},m(r,f){Se(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_key_upload)??"Upload key"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_key)??""),e.$set(c)},i(r){l||(Z(e.$$.fragment,r),l=!0)},o(r){ie(e.$$.fragment,r),l=!1},d(r){Me(e,r)}}}function Sc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.key_ok)??"Key OK")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.mqtt)==null?void 0:f.key_ok)??"Key OK")+"")&&E(l,e)},d(s){s&&N(l)}}}function fa(t){var Q,ae,re,ue,ne,pe,oe,J,$,ke,Ce,D;let e,l,n=(((re=(ae=(Q=t[2].conf)==null?void 0:Q.mqtt)==null?void 0:ae.domoticz)==null?void 0:re.title)??"Domoticz")+"",i,s,a,r,f,c,m,_,d=(((pe=(ne=(ue=t[2].conf)==null?void 0:ue.mqtt)==null?void 0:ne.domoticz)==null?void 0:pe.eidx)??"Electricity IDX")+"",h,b,g,w,k,R,I=((($=(J=(oe=t[2].conf)==null?void 0:oe.mqtt)==null?void 0:J.domoticz)==null?void 0:$.cidx)??"Current IDX")+"",F,M,A,O,j,Y,W=(((D=(Ce=(ke=t[2].conf)==null?void 0:ke.mqtt)==null?void 0:Ce.domoticz)==null?void 0:D.vidx)??"Voltage IDX")+"",T,B,X,y,K,V,U,G,se,le;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("div"),h=C(d),b=p("br"),g=v(),w=p("input"),k=v(),R=p("div"),F=C(I),M=p("br"),A=v(),O=p("input"),j=v(),Y=p("div"),T=C(W),B=C(`: L1, L2 & L3 - `),X=p("div"),y=p("input"),K=v(),V=p("input"),U=v(),G=p("input"),u(l,"class","text-sm"),u(a,"href",_l("MQTT-configuration#domoticz")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","o"),f.value="true",u(w,"name","oe"),u(w,"type","text"),u(w,"class","in-f tr w-full"),u(w,"pattern",In),u(_,"class","w-1/2"),u(O,"name","oc"),u(O,"type","text"),u(O,"class","in-l tr w-full"),u(O,"pattern",In),u(R,"class","w-1/2"),u(m,"class","my-1 flex"),u(y,"name","ou1"),u(y,"type","text"),u(y,"class","in-f tr w-1/3"),u(y,"pattern",In),u(V,"name","ou2"),u(V,"type","text"),u(V,"class","in-m tr w-1/3"),u(V,"pattern",In),u(G,"name","ou3"),u(G,"type","text"),u(G,"class","in-l tr w-1/3"),u(G,"pattern",In),u(X,"class","flex"),u(Y,"class","my-1"),u(e,"class","cnt")},m(S,L){P(S,e,L),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,h),o(_,b),o(_,g),o(_,w),H(w,t[6].o.e),o(m,k),o(m,R),o(R,F),o(R,M),o(R,A),o(R,O),H(O,t[6].o.c),o(e,j),o(e,Y),o(Y,T),o(Y,B),o(Y,X),o(X,y),H(y,t[6].o.u1),o(X,K),o(X,V),H(V,t[6].o.u2),o(X,U),o(X,G),H(G,t[6].o.u3),se||(le=[ce(w,"input",t[82]),ce(O,"input",t[83]),ce(y,"input",t[84]),ce(V,"input",t[85]),ce(G,"input",t[86])],se=!0)},p(S,L){var q,z,ee,fe,_e,de,x,he,be,Ae,Pe,Oe;L[0]&4&&n!==(n=(((ee=(z=(q=S[2].conf)==null?void 0:q.mqtt)==null?void 0:z.domoticz)==null?void 0:ee.title)??"Domoticz")+"")&&E(i,n),L[0]&4&&d!==(d=(((de=(_e=(fe=S[2].conf)==null?void 0:fe.mqtt)==null?void 0:_e.domoticz)==null?void 0:de.eidx)??"Electricity IDX")+"")&&E(h,d),L[0]&64&&w.value!==S[6].o.e&&H(w,S[6].o.e),L[0]&4&&I!==(I=(((be=(he=(x=S[2].conf)==null?void 0:x.mqtt)==null?void 0:he.domoticz)==null?void 0:be.cidx)??"Current IDX")+"")&&E(F,I),L[0]&64&&O.value!==S[6].o.c&&H(O,S[6].o.c),L[0]&4&&W!==(W=(((Oe=(Pe=(Ae=S[2].conf)==null?void 0:Ae.mqtt)==null?void 0:Pe.domoticz)==null?void 0:Oe.vidx)??"Voltage IDX")+"")&&E(T,W),L[0]&64&&y.value!==S[6].o.u1&&H(y,S[6].o.u1),L[0]&64&&V.value!==S[6].o.u2&&H(V,S[6].o.u2),L[0]&64&&G.value!==S[6].o.u3&&H(G,S[6].o.u3)},d(S){S&&N(e),se=!1,jt(le)}}}function ua(t){var U,G,se,le,Q,ae,re,ue,ne,pe,oe,J;let e,l,n=(((se=(G=(U=t[2].conf)==null?void 0:U.mqtt)==null?void 0:G.ha)==null?void 0:se.title)??"Home-Assistant")+"",i,s,a,r,f,c,m,_=(((ae=(Q=(le=t[2].conf)==null?void 0:le.mqtt)==null?void 0:Q.ha)==null?void 0:ae.discovery)??"Discovery topic prefix")+"",d,h,b,g,w,k,R=(((ne=(ue=(re=t[2].conf)==null?void 0:re.mqtt)==null?void 0:ue.ha)==null?void 0:ne.hostname)??"Hostname for URL")+"",I,F,M,A,O,j,Y,W=(((J=(oe=(pe=t[2].conf)==null?void 0:pe.mqtt)==null?void 0:oe.ha)==null?void 0:J.tag)??"Name tag")+"",T,B,X,y,K,V;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),d=C(_),h=p("br"),b=v(),g=p("input"),w=v(),k=p("div"),I=C(R),F=p("br"),M=v(),A=p("input"),j=v(),Y=p("div"),T=C(W),B=p("br"),X=v(),y=p("input"),u(l,"class","text-sm"),u(a,"href",_l("MQTT-configuration#home-assistant")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","h"),f.value="true",u(g,"name","ht"),u(g,"type","text"),u(g,"class","in-s"),u(g,"placeholder","homeassistant"),u(g,"pattern",Ll),u(m,"class","my-1"),u(A,"name","hh"),u(A,"type","text"),u(A,"class","in-s"),u(A,"placeholder",O=t[6].g.h+".local"),u(A,"pattern",Ll),u(k,"class","my-1"),u(y,"name","hn"),u(y,"type","text"),u(y,"class","in-s"),u(y,"pattern",Ll),u(Y,"class","my-1"),u(e,"class","cnt")},m($,ke){P($,e,ke),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,d),o(m,h),o(m,b),o(m,g),H(g,t[6].h.t),o(e,w),o(e,k),o(k,I),o(k,F),o(k,M),o(k,A),H(A,t[6].h.h),o(e,j),o(e,Y),o(Y,T),o(Y,B),o(Y,X),o(Y,y),H(y,t[6].h.n),K||(V=[ce(g,"input",t[87]),ce(A,"input",t[88]),ce(y,"input",t[89])],K=!0)},p($,ke){var Ce,D,S,L,q,z,ee,fe,_e,de,x,he;ke[0]&4&&n!==(n=(((S=(D=(Ce=$[2].conf)==null?void 0:Ce.mqtt)==null?void 0:D.ha)==null?void 0:S.title)??"Home-Assistant")+"")&&E(i,n),ke[0]&4&&_!==(_=(((z=(q=(L=$[2].conf)==null?void 0:L.mqtt)==null?void 0:q.ha)==null?void 0:z.discovery)??"Discovery topic prefix")+"")&&E(d,_),ke[0]&64&&g.value!==$[6].h.t&&H(g,$[6].h.t),ke[0]&4&&R!==(R=(((_e=(fe=(ee=$[2].conf)==null?void 0:ee.mqtt)==null?void 0:fe.ha)==null?void 0:_e.hostname)??"Hostname for URL")+"")&&E(I,R),ke[0]&64&&O!==(O=$[6].g.h+".local")&&u(A,"placeholder",O),ke[0]&64&&A.value!==$[6].h.h&&H(A,$[6].h.h),ke[0]&4&&W!==(W=(((he=(x=(de=$[2].conf)==null?void 0:de.mqtt)==null?void 0:x.ha)==null?void 0:he.tag)??"Name tag")+"")&&E(T,W),ke[0]&64&&y.value!==$[6].h.n&&H(y,$[6].h.n)},d($){$&&N(e),K=!1,jt(V)}}}function ra(t){var j,Y,W,T,B,X,y,K;let e,l,n=(((Y=(j=t[2].conf)==null?void 0:j.cloud)==null?void 0:Y.title)??"Cloud connections")+"",i,s,a,r,f,c,m=(T=(W=t[0])==null?void 0:W.features)==null?void 0:T.includes("cloud"),_,d,h,b,g,w=(((X=(B=t[2].conf)==null?void 0:B.cloud)==null?void 0:X.es)??"Energy Speedometer")+"",k,R,I,F,M,A=m&&ca(t),O=((K=(y=t[6])==null?void 0:y.c)==null?void 0:K.es)&&da(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),A&&A.c(),_=v(),d=p("div"),h=p("label"),b=p("input"),g=v(),k=C(w),R=v(),O&&O.c(),u(l,"class","text-sm"),u(a,"href",_l("Cloud")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","c"),f.value="true",u(b,"type","checkbox"),u(b,"class","rounded mb-1"),u(b,"name","ces"),b.__value="true",H(b,b.__value),u(d,"class","my-1"),u(e,"class","cnt")},m(V,U){P(V,e,U),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),A&&A.m(e,null),o(e,_),o(e,d),o(d,h),o(h,b),b.checked=t[6].c.es,o(h,g),o(h,k),o(d,R),O&&O.m(d,null),I=!0,F||(M=ce(b,"change",t[92]),F=!0)},p(V,U){var G,se,le,Q,ae,re,ue,ne;(!I||U[0]&4)&&n!==(n=(((se=(G=V[2].conf)==null?void 0:G.cloud)==null?void 0:se.title)??"Cloud connections")+"")&&E(i,n),U[0]&1&&(m=(Q=(le=V[0])==null?void 0:le.features)==null?void 0:Q.includes("cloud")),m?A?A.p(V,U):(A=ca(V),A.c(),A.m(e,_)):A&&(A.d(1),A=null),U[0]&64&&(b.checked=V[6].c.es),(!I||U[0]&4)&&w!==(w=(((re=(ae=V[2].conf)==null?void 0:ae.cloud)==null?void 0:re.es)??"Energy Speedometer")+"")&&E(k,w),(ne=(ue=V[6])==null?void 0:ue.c)!=null&&ne.es?O?(O.p(V,U),U[0]&64&&Z(O,1)):(O=da(V),O.c(),Z(O,1),O.m(d,null)):O&&(vt(),ie(O,1,1,()=>{O=null}),bt())},i(V){I||(Z(O),I=!0)},o(V){ie(O),I=!1},d(V){V&&N(e),A&&A.d(),O&&O.d(),F=!1,M()}}}function ca(t){var _,d;let e,l,n,i,s=(((d=(_=t[2].conf)==null?void 0:_.cloud)==null?void 0:d.ams)??"AMS reader cloud")+"",a,r,f,c,m=t[6].c.e&&_a(t);return{c(){e=p("div"),l=p("label"),n=p("input"),i=v(),a=C(s),r=v(),m&&m.c(),u(n,"type","checkbox"),u(n,"name","ce"),n.__value="true",H(n,n.__value),u(n,"class","rounded mb-1"),u(e,"class","my-1")},m(h,b){P(h,e,b),o(e,l),o(l,n),n.checked=t[6].c.e,o(l,i),o(l,a),o(e,r),m&&m.m(e,null),f||(c=ce(n,"change",t[90]),f=!0)},p(h,b){var g,w;b[0]&64&&(n.checked=h[6].c.e),b[0]&4&&s!==(s=(((w=(g=h[2].conf)==null?void 0:g.cloud)==null?void 0:w.ams)??"AMS reader cloud")+"")&&E(a,s),h[6].c.e?m?m.p(h,b):(m=_a(h),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},d(h){h&&N(e),m&&m.d(),f=!1,c()}}}function _a(t){let e,l,n,i,s,a,r,f,c,m,_=t[6].c.p==0&&ma(),d=t[5]&&pa(t);return{c(){e=p("div"),l=p("label"),l.textContent="Protocol",n=v(),i=p("select"),_&&_.c(),s=p("option"),s.textContent="TCP",a=p("option"),a.textContent="HTTP",r=v(),d&&d.c(),f=yt(),u(l,"for","cp"),s.__value=1,H(s,s.__value),a.__value=2,H(a,a.__value),u(i,"name","cp"),u(i,"class","in-s"),t[6].c.p===void 0&&At(()=>t[91].call(i)),u(e,"class","ml-6")},m(h,b){P(h,e,b),o(e,l),o(e,n),o(e,i),_&&_.m(i,null),o(i,s),o(i,a),Ke(i,t[6].c.p,!0),P(h,r,b),d&&d.m(h,b),P(h,f,b),c||(m=ce(i,"change",t[91]),c=!0)},p(h,b){h[6].c.p==0?_||(_=ma(),_.c(),_.m(i,s)):_&&(_.d(1),_=null),b[0]&64&&Ke(i,h[6].c.p),h[5]?d?d.p(h,b):(d=pa(h),d.c(),d.m(f.parentNode,f)):d&&(d.d(1),d=null)},d(h){h&&(N(e),N(r),N(f)),_&&_.d(),d&&d.d(h),c=!1,m()}}}function ma(t){let e;return{c(){e=p("option"),e.textContent="UDP",e.__value=0,H(e,e.__value),u(e,"title","No longer recommended")},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function pa(t){let e,l,n;return{c(){e=p("button"),e.textContent="Connect device to my cloud account",u(e,"type","button"),u(e,"class","text-blue-500 ml-6")},m(i,s){P(i,e,s),l||(n=ce(e,"click",t[22]),l=!0)},p:Ye,d(i){i&&N(e),l=!1,n()}}}function da(t){let e,l,n=t[0].mac+"",i,s,a,r,f=(t[0].meter.id?t[0].meter.id:"missing, required")+"",c,m,_,d,h=t[0].mac&&t[0].meter.id&&ha(t);return{c(){e=p("div"),l=C("MAC: "),i=C(n),s=v(),a=p("div"),r=C("Meter ID: "),c=C(f),m=v(),h&&h.c(),_=yt(),u(e,"class","pl-5"),u(a,"class","pl-5")},m(b,g){P(b,e,g),o(e,l),o(e,i),P(b,s,g),P(b,a,g),o(a,r),o(a,c),P(b,m,g),h&&h.m(b,g),P(b,_,g),d=!0},p(b,g){(!d||g[0]&1)&&n!==(n=b[0].mac+"")&&E(i,n),(!d||g[0]&1)&&f!==(f=(b[0].meter.id?b[0].meter.id:"missing, required")+"")&&E(c,f),b[0].mac&&b[0].meter.id?h?(h.p(b,g),g[0]&1&&Z(h,1)):(h=ha(b),h.c(),Z(h,1),h.m(_.parentNode,_)):h&&(vt(),ie(h,1,1,()=>{h=null}),bt())},i(b){d||(Z(h),d=!0)},o(b){ie(h),d=!1},d(b){b&&(N(e),N(s),N(a),N(m),N(_)),h&&h.d(b)}}}function ha(t){let e,l,n;return l=new lc({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=p("div"),Ne(l.$$.fragment),u(e,"class","pl-2")},m(i,s){P(i,e,s),Se(l,e,null),n=!0},p(i,s){const a={};s[0]&1&&(a.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(a)},i(i){n||(Z(l.$$.fragment,i),n=!0)},o(i){ie(l.$$.fragment,i),n=!1},d(i){i&&N(e),Me(l)}}}function va(t){var W,T,B,X,y;let e,l,n=(((T=(W=t[2].conf)==null?void 0:W.thresholds)==null?void 0:T.title)??"Thresholds")+"",i,s,a,r,f,c,m,_,d,h,b=(((X=(B=t[2].conf)==null?void 0:B.thresholds)==null?void 0:X.avg)??"Average of")+"",g,w,k,R,I,F=(((y=t[2].common)==null?void 0:y.hours)??"hours")+"",M,A,O,j=rt({length:9}),Y=[];for(let K=0;Kt[96].call(w)),u(d,"class","w-1/2"),u(m,"class","flex flex-wrap"),u(e,"class","cnt")},m(T,B){P(T,e,B),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m);for(let X=0;X20&&Sa(t),d=((R=(k=(w=t[6])==null?void 0:w.i)==null?void 0:k.d)==null?void 0:R.d)>0&&Pa(t),h=t[0].chip=="esp8266"&&Ta(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),_&&_.c(),f=v(),d&&d.c(),c=v(),h&&h.c(),u(l,"class","text-sm"),u(a,"href",_l("GPIO-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(e,"class","cnt")},m(I,F){P(I,e,F),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),_&&_.m(e,null),o(e,f),d&&d.m(e,null),o(e,c),h&&h.m(e,null),m=!0},p(I,F){var M,A,O,j,Y;(!m||F[0]&4)&&n!==(n=(((A=(M=I[2].conf)==null?void 0:M.hw)==null?void 0:A.title)??"Hardware")+"")&&E(i,n),I[0].board>20?_?(_.p(I,F),F[0]&1&&Z(_,1)):(_=Sa(I),_.c(),Z(_,1),_.m(e,f)):_&&(vt(),ie(_,1,1,()=>{_=null}),bt()),((Y=(j=(O=I[6])==null?void 0:O.i)==null?void 0:j.d)==null?void 0:Y.d)>0?d?d.p(I,F):(d=Pa(I),d.c(),d.m(e,c)):d&&(d.d(1),d=null),I[0].chip=="esp8266"?h?h.p(I,F):(h=Ta(I),h.c(),h.m(e,null)):h&&(h.d(1),h=null)},i(I){m||(Z(_),m=!0)},o(I){ie(_),m=!1},d(I){I&&N(e),_&&_.d(),d&&d.d(),h&&h.d()}}}function Sa(t){var qt,Wt,wt,_t,zt,Xt,Ut,Ht,Yt,$t,Gt,It,Fe,Xe,je,Dt,Bt,$e,st,Et,pt,ge,nt,ze,el,tl,ll,nl,il,sl,Ze,dt,Te;let e,l,n,i,s=(((wt=(Wt=(qt=t[2].conf)==null?void 0:qt.hw)==null?void 0:Wt.han)==null?void 0:wt.rx)??"HAN RX")+"",a,r,f,c,m,_,d,h=(((Xt=(zt=(_t=t[2].conf)==null?void 0:_t.hw)==null?void 0:zt.han)==null?void 0:Xt.tx)??"HAN TX")+"",b,g,w,k,R,I,F,M,A,O,j=(((Yt=(Ht=(Ut=t[2].conf)==null?void 0:Ut.hw)==null?void 0:Ht.han)==null?void 0:Yt.pullup)??"pullup")+"",Y,W,T,B,X=(((Gt=($t=t[2].conf)==null?void 0:$t.hw)==null?void 0:Gt.ap_btn)??"AP button")+"",y,K,V,U,G,se,le=(((Xe=(Fe=(It=t[2].conf)==null?void 0:It.hw)==null?void 0:Fe.led)==null?void 0:Xe.title)??"LED")+"",Q,ae,re,ue,ne,pe,oe,J,$,ke,Ce=(((Bt=(Dt=(je=t[2].conf)==null?void 0:je.hw)==null?void 0:Dt.led)==null?void 0:Bt.inverted)??"inverted")+"",D,S,L,q=(((Et=(st=($e=t[2].conf)==null?void 0:$e.hw)==null?void 0:st.led)==null?void 0:Et.rgb)??"RGB")+"",z,ee,fe,_e,de=(((nt=(ge=(pt=t[2].conf)==null?void 0:pt.hw)==null?void 0:ge.led)==null?void 0:nt.inverted)??"inverted")+"",x,he,be,Ae,Pe,Oe,Le,De,Ue,xe,Ct,tt,ot=(((tl=(el=(ze=t[2].conf)==null?void 0:ze.hw)==null?void 0:el.led)==null?void 0:tl.disable)??"LED dis. GPIO")+"",Mt,ht,at,it,ft,Lt=(((nl=(ll=t[2].conf)==null?void 0:ll.hw)==null?void 0:nl.temp)??"Temperature")+"",We,Re,He,lt,ve,Ee,Qe=(((sl=(il=t[2].conf)==null?void 0:il.hw)==null?void 0:sl.temp_analog)??"Analog temp")+"",me,we,ut,Ge,Ft,gt,Be,kt,ct;m=new Bi({props:{chip:t[0].chip}}),R=new Bi({props:{chip:t[0].chip}});let mt=t[0].chip!="esp8266"&&Ma(t),et=((Te=(dt=(Ze=t[6])==null?void 0:Ze.i)==null?void 0:dt.v)==null?void 0:Te.p)>0&&Na(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=C(s),r=p("br"),f=v(),c=p("select"),Ne(m.$$.fragment),_=v(),d=p("div"),b=C(h),g=p("br"),w=v(),k=p("select"),Ne(R.$$.fragment),I=v(),F=p("div"),M=p("label"),A=p("input"),O=v(),Y=C(j),W=v(),T=p("div"),B=p("div"),y=C(X),K=p("br"),V=v(),U=p("input"),G=v(),se=p("div"),Q=C(le),ae=p("br"),re=v(),ue=p("div"),ne=p("input"),pe=v(),oe=p("div"),J=p("label"),$=p("input"),ke=v(),D=C(Ce),S=v(),L=p("div"),z=C(q),ee=p("label"),fe=p("input"),_e=v(),x=C(de),he=p("br"),be=v(),Ae=p("div"),Pe=p("input"),Oe=v(),Le=p("input"),De=v(),Ue=p("input"),xe=v(),Ct=p("div"),tt=p("div"),Mt=C(ot),ht=v(),at=p("input"),it=v(),ft=p("div"),We=C(Lt),Re=p("br"),He=v(),lt=p("input"),ve=v(),Ee=p("div"),me=C(Qe),we=p("br"),ut=v(),Ge=p("input"),Ft=v(),mt&&mt.c(),gt=v(),et&&et.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(c,"name","ihp"),u(c,"class","in-f w-full"),t[6].i.h.p===void 0&&At(()=>t[97].call(c)),u(i,"class","w-1/3"),u(k,"name","iht"),u(k,"class","in-l w-full"),t[6].i.h.t===void 0&&At(()=>t[98].call(k)),u(d,"class","w-1/3"),u(A,"name","ihu"),A.__value="true",H(A,A.__value),u(A,"type","checkbox"),u(A,"class","rounded mb-1"),u(M,"class","ml-2"),u(F,"class","w-1/3"),u(n,"class","flex flex-wrap"),u(U,"name","ia"),u(U,"type","number"),u(U,"min","0"),u(U,"max",t[12]),u(U,"class","in-f tr w-full"),u(B,"class","w-1/3"),u(ne,"name","ilp"),u(ne,"type","number"),u(ne,"min","0"),u(ne,"max",t[12]),u(ne,"class","in-l tr w-full"),u(ue,"class","flex"),u(se,"class","w-1/3"),u($,"name","ili"),$.__value="true",H($,$.__value),u($,"type","checkbox"),u($,"class","rounded mb-1"),u(J,"class","ml-4"),u(oe,"class","w-1/3"),u(fe,"name","iri"),fe.__value="true",H(fe,fe.__value),u(fe,"type","checkbox"),u(fe,"class","rounded mb-1"),u(ee,"class","ml-4"),u(Pe,"name","irr"),u(Pe,"type","number"),u(Pe,"min","0"),u(Pe,"max",t[12]),u(Pe,"class","in-f tr w-1/3"),u(Le,"name","irg"),u(Le,"type","number"),u(Le,"min","0"),u(Le,"max",t[12]),u(Le,"class","in-m tr w-1/3"),u(Ue,"name","irb"),u(Ue,"type","number"),u(Ue,"min","0"),u(Ue,"max",t[12]),u(Ue,"class","in-l tr w-1/3"),u(Ae,"class","flex"),u(L,"class","w-full"),u(at,"name","idd"),u(at,"type","number"),u(at,"min","0"),u(at,"max",t[12]),u(at,"class","in-s tr"),u(tt,"class","my-1 pr-1 w-1/3"),u(Ct,"class","w-full"),u(lt,"name","itd"),u(lt,"type","number"),u(lt,"min","0"),u(lt,"max",t[12]),u(lt,"class","in-f tr w-full"),u(ft,"class","my-1 w-1/3"),u(Ge,"name","ita"),u(Ge,"type","number"),u(Ge,"min","0"),u(Ge,"max",t[12]),u(Ge,"class","in-l tr w-full"),u(Ee,"class","my-1 pr-1 w-1/3"),u(T,"class","flex flex-wrap")},m(te,Ie){P(te,e,Ie),P(te,l,Ie),P(te,n,Ie),o(n,i),o(i,a),o(i,r),o(i,f),o(i,c),Se(m,c,null),Ke(c,t[6].i.h.p,!0),o(n,_),o(n,d),o(d,b),o(d,g),o(d,w),o(d,k),Se(R,k,null),Ke(k,t[6].i.h.t,!0),o(n,I),o(n,F),o(F,M),o(M,A),A.checked=t[6].i.h.u,o(M,O),o(M,Y),P(te,W,Ie),P(te,T,Ie),o(T,B),o(B,y),o(B,K),o(B,V),o(B,U),H(U,t[6].i.a),o(T,G),o(T,se),o(se,Q),o(se,ae),o(se,re),o(se,ue),o(ue,ne),H(ne,t[6].i.l.p),o(T,pe),o(T,oe),o(oe,J),o(J,$),$.checked=t[6].i.l.i,o(J,ke),o(J,D),o(T,S),o(T,L),o(L,z),o(L,ee),o(ee,fe),fe.checked=t[6].i.r.i,o(ee,_e),o(ee,x),o(L,he),o(L,be),o(L,Ae),o(Ae,Pe),H(Pe,t[6].i.r.r),o(Ae,Oe),o(Ae,Le),H(Le,t[6].i.r.g),o(Ae,De),o(Ae,Ue),H(Ue,t[6].i.r.b),o(T,xe),o(T,Ct),o(Ct,tt),o(tt,Mt),o(tt,ht),o(tt,at),H(at,t[6].i.d.d),o(T,it),o(T,ft),o(ft,We),o(ft,Re),o(ft,He),o(ft,lt),H(lt,t[6].i.t.d),o(T,ve),o(T,Ee),o(Ee,me),o(Ee,we),o(Ee,ut),o(Ee,Ge),H(Ge,t[6].i.t.a),o(T,Ft),mt&&mt.m(T,null),o(T,gt),et&&et.m(T,null),Be=!0,kt||(ct=[ce(c,"change",t[97]),ce(k,"change",t[98]),ce(A,"change",t[99]),ce(U,"input",t[100]),ce(ne,"input",t[101]),ce($,"change",t[102]),ce(fe,"change",t[103]),ce(Pe,"input",t[104]),ce(Le,"input",t[105]),ce(Ue,"input",t[106]),ce(at,"input",t[107]),ce(lt,"input",t[108]),ce(Ge,"input",t[109])],kt=!0)},p(te,Ie){var ml,gl,kl,wl,Cl,Sl,Ml,Il,Rl,Fl,Ve,qe,Rt,al,Ul,Bl,jl,Hl,yl,zl,Wl,Gl,Vl,Kl,Yl,Ql,Xl,Zl,Jl,$l,xl,en,tn;(!Be||Ie[0]&4)&&s!==(s=(((kl=(gl=(ml=te[2].conf)==null?void 0:ml.hw)==null?void 0:gl.han)==null?void 0:kl.rx)??"HAN RX")+"")&&E(a,s);const Zt={};Ie[0]&1&&(Zt.chip=te[0].chip),m.$set(Zt),Ie[0]&64&&Ke(c,te[6].i.h.p),(!Be||Ie[0]&4)&&h!==(h=(((Sl=(Cl=(wl=te[2].conf)==null?void 0:wl.hw)==null?void 0:Cl.han)==null?void 0:Sl.tx)??"HAN TX")+"")&&E(b,h);const fl={};Ie[0]&1&&(fl.chip=te[0].chip),R.$set(fl),Ie[0]&64&&Ke(k,te[6].i.h.t),Ie[0]&64&&(A.checked=te[6].i.h.u),(!Be||Ie[0]&4)&&j!==(j=(((Rl=(Il=(Ml=te[2].conf)==null?void 0:Ml.hw)==null?void 0:Il.han)==null?void 0:Rl.pullup)??"pullup")+"")&&E(Y,j),(!Be||Ie[0]&4)&&X!==(X=(((Ve=(Fl=te[2].conf)==null?void 0:Fl.hw)==null?void 0:Ve.ap_btn)??"AP button")+"")&&E(y,X),(!Be||Ie[0]&4096)&&u(U,"max",te[12]),Ie[0]&64&&ye(U.value)!==te[6].i.a&&H(U,te[6].i.a),(!Be||Ie[0]&4)&&le!==(le=(((al=(Rt=(qe=te[2].conf)==null?void 0:qe.hw)==null?void 0:Rt.led)==null?void 0:al.title)??"LED")+"")&&E(Q,le),(!Be||Ie[0]&4096)&&u(ne,"max",te[12]),Ie[0]&64&&ye(ne.value)!==te[6].i.l.p&&H(ne,te[6].i.l.p),Ie[0]&64&&($.checked=te[6].i.l.i),(!Be||Ie[0]&4)&&Ce!==(Ce=(((jl=(Bl=(Ul=te[2].conf)==null?void 0:Ul.hw)==null?void 0:Bl.led)==null?void 0:jl.inverted)??"inverted")+"")&&E(D,Ce),(!Be||Ie[0]&4)&&q!==(q=(((zl=(yl=(Hl=te[2].conf)==null?void 0:Hl.hw)==null?void 0:yl.led)==null?void 0:zl.rgb)??"RGB")+"")&&E(z,q),Ie[0]&64&&(fe.checked=te[6].i.r.i),(!Be||Ie[0]&4)&&de!==(de=(((Vl=(Gl=(Wl=te[2].conf)==null?void 0:Wl.hw)==null?void 0:Gl.led)==null?void 0:Vl.inverted)??"inverted")+"")&&E(x,de),(!Be||Ie[0]&4096)&&u(Pe,"max",te[12]),Ie[0]&64&&ye(Pe.value)!==te[6].i.r.r&&H(Pe,te[6].i.r.r),(!Be||Ie[0]&4096)&&u(Le,"max",te[12]),Ie[0]&64&&ye(Le.value)!==te[6].i.r.g&&H(Le,te[6].i.r.g),(!Be||Ie[0]&4096)&&u(Ue,"max",te[12]),Ie[0]&64&&ye(Ue.value)!==te[6].i.r.b&&H(Ue,te[6].i.r.b),(!Be||Ie[0]&4)&&ot!==(ot=(((Ql=(Yl=(Kl=te[2].conf)==null?void 0:Kl.hw)==null?void 0:Yl.led)==null?void 0:Ql.disable)??"LED dis. GPIO")+"")&&E(Mt,ot),(!Be||Ie[0]&4096)&&u(at,"max",te[12]),Ie[0]&64&&ye(at.value)!==te[6].i.d.d&&H(at,te[6].i.d.d),(!Be||Ie[0]&4)&&Lt!==(Lt=(((Zl=(Xl=te[2].conf)==null?void 0:Xl.hw)==null?void 0:Zl.temp)??"Temperature")+"")&&E(We,Lt),(!Be||Ie[0]&4096)&&u(lt,"max",te[12]),Ie[0]&64&&ye(lt.value)!==te[6].i.t.d&&H(lt,te[6].i.t.d),(!Be||Ie[0]&4)&&Qe!==(Qe=((($l=(Jl=te[2].conf)==null?void 0:Jl.hw)==null?void 0:$l.temp_analog)??"Analog temp")+"")&&E(me,Qe),(!Be||Ie[0]&4096)&&u(Ge,"max",te[12]),Ie[0]&64&&ye(Ge.value)!==te[6].i.t.a&&H(Ge,te[6].i.t.a),te[0].chip!="esp8266"?mt?mt.p(te,Ie):(mt=Ma(te),mt.c(),mt.m(T,gt)):mt&&(mt.d(1),mt=null),((tn=(en=(xl=te[6])==null?void 0:xl.i)==null?void 0:en.v)==null?void 0:tn.p)>0?et?et.p(te,Ie):(et=Na(te),et.c(),et.m(T,null)):et&&(et.d(1),et=null)},i(te){Be||(Z(m.$$.fragment,te),Z(R.$$.fragment,te),Be=!0)},o(te){ie(m.$$.fragment,te),ie(R.$$.fragment,te),Be=!1},d(te){te&&(N(e),N(l),N(n),N(W),N(T)),Me(m),Me(R),mt&&mt.d(),et&&et.d(),kt=!1,jt(ct)}}}function Ma(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.title)??"Vcc")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","ivp"),u(a,"type","number"),u(a,"min","0"),u(a,"max",t[12]),u(a,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(d,h){P(d,e,h),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].i.v.p),r||(f=ce(a,"input",t[110]),r=!0)},p(d,h){var b,g,w;h[0]&4&&l!==(l=(((w=(g=(b=d[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:w.title)??"Vcc")+"")&&E(n,l),h[0]&4096&&u(a,"max",d[12]),h[0]&64&&ye(a.value)!==d[6].i.v.p&&H(a,d[6].i.v.p)},d(d){d&&N(e),r=!1,f()}}}function Na(t){var b,g,w;let e,l=(((w=(g=(b=t[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:w.divider)??"Voltage divider")+"",n,i,s,a,r,f,c,m,_,d,h;return{c(){var k,R,I,F,M,A;e=p("div"),n=C(l),i=p("br"),s=v(),a=p("div"),r=p("input"),c=v(),m=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",f=((I=(R=(k=t[2].conf)==null?void 0:k.hw)==null?void 0:R.vcc)==null?void 0:I.div_vcc)??"VCC"),u(m,"name","ivdg"),u(m,"type","number"),u(m,"min","0"),u(m,"max","65535"),u(m,"class","in-l tr w-full"),u(m,"placeholder",_=((A=(M=(F=t[2].conf)==null?void 0:F.hw)==null?void 0:M.vcc)==null?void 0:A.div_gnd)??"GND"),u(a,"class","flex"),u(e,"class","my-1")},m(k,R){P(k,e,R),o(e,n),o(e,i),o(e,s),o(e,a),o(a,r),H(r,t[6].i.v.d.v),o(a,c),o(a,m),H(m,t[6].i.v.d.g),d||(h=[ce(r,"input",t[111]),ce(m,"input",t[112])],d=!0)},p(k,R){var I,F,M,A,O,j,Y,W,T;R[0]&4&&l!==(l=(((M=(F=(I=k[2].conf)==null?void 0:I.hw)==null?void 0:F.vcc)==null?void 0:M.divider)??"Voltage divider")+"")&&E(n,l),R[0]&4&&f!==(f=((j=(O=(A=k[2].conf)==null?void 0:A.hw)==null?void 0:O.vcc)==null?void 0:j.div_vcc)??"VCC")&&u(r,"placeholder",f),R[0]&64&&ye(r.value)!==k[6].i.v.d.v&&H(r,k[6].i.v.d.v),R[0]&4&&_!==(_=((T=(W=(Y=k[2].conf)==null?void 0:Y.hw)==null?void 0:W.vcc)==null?void 0:T.div_gnd)??"GND")&&u(m,"placeholder",_),R[0]&64&&ye(m.value)!==k[6].i.v.d.g&&H(m,k[6].i.v.d.g)},d(k){k&&N(e),d=!1,jt(h)}}}function Pa(t){var b,g,w,k,R,I,F,M,A,O,j,Y;let e,l=(((k=(w=(g=(b=t[2].conf)==null?void 0:b.hw)==null?void 0:g.led)==null?void 0:w.behaviour)==null?void 0:k.title)??"LED behaviour")+"",n,i,s,a,r=(((M=(F=(I=(R=t[2].conf)==null?void 0:R.hw)==null?void 0:I.led)==null?void 0:F.behaviour)==null?void 0:M.enabled)??"Enabled")+"",f,c,m=(((Y=(j=(O=(A=t[2].conf)==null?void 0:A.hw)==null?void 0:O.led)==null?void 0:j.behaviour)==null?void 0:Y.disabled)??"Disabled")+"",_,d,h;return{c(){e=p("div"),n=C(l),i=v(),s=p("select"),a=p("option"),f=C(r),c=p("option"),_=C(m),a.__value=0,H(a,a.__value),c.__value=1,H(c,c.__value),u(s,"name","idb"),u(s,"class","in-s"),t[6].i.d.b===void 0&&At(()=>t[113].call(s)),u(e,"class","my-1 w-full")},m(W,T){P(W,e,T),o(e,n),o(e,i),o(e,s),o(s,a),o(a,f),o(s,c),o(c,_),Ke(s,t[6].i.d.b,!0),d||(h=ce(s,"change",t[113]),d=!0)},p(W,T){var B,X,y,K,V,U,G,se,le,Q,ae,re;T[0]&4&&l!==(l=(((K=(y=(X=(B=W[2].conf)==null?void 0:B.hw)==null?void 0:X.led)==null?void 0:y.behaviour)==null?void 0:K.title)??"LED behaviour")+"")&&E(n,l),T[0]&4&&r!==(r=(((se=(G=(U=(V=W[2].conf)==null?void 0:V.hw)==null?void 0:U.led)==null?void 0:G.behaviour)==null?void 0:se.enabled)??"Enabled")+"")&&E(f,r),T[0]&4&&m!==(m=(((re=(ae=(Q=(le=W[2].conf)==null?void 0:le.hw)==null?void 0:Q.led)==null?void 0:ae.behaviour)==null?void 0:re.disabled)??"Disabled")+"")&&E(_,m),T[0]&64&&Ke(s,W[6].i.d.b)},d(W){W&&N(e),d=!1,h()}}}function Ta(t){var M,A,O,j,Y,W;let e,l,n,i,s=(((O=(A=(M=t[2].conf)==null?void 0:M.hw)==null?void 0:A.vcc)==null?void 0:O.offset)??"Vcc offset")+"",a,r,f,c,m,_,d=(((W=(Y=(j=t[2].conf)==null?void 0:j.hw)==null?void 0:Y.vcc)==null?void 0:W.multiplier)??"Multiplier")+"",h,b,g,w,k,R,I,F=(t[0].board==2||t[0].board==100)&&qa(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=C(s),r=p("br"),f=v(),c=p("input"),m=v(),_=p("div"),h=C(d),b=p("br"),g=v(),w=p("input"),k=v(),F&&F.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(w,"name","ivm"),u(w,"type","number"),u(w,"min","0.1"),u(w,"max","10"),u(w,"step","0.01"),u(w,"class","in-l tr w-full"),u(_,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(T,B){P(T,e,B),P(T,l,B),P(T,n,B),o(n,i),o(i,a),o(i,r),o(i,f),o(i,c),H(c,t[6].i.v.o),o(n,m),o(n,_),o(_,h),o(_,b),o(_,g),o(_,w),H(w,t[6].i.v.m),o(n,k),F&&F.m(n,null),R||(I=[ce(c,"input",t[114]),ce(w,"input",t[115])],R=!0)},p(T,B){var X,y,K,V,U,G;B[0]&4&&s!==(s=(((K=(y=(X=T[2].conf)==null?void 0:X.hw)==null?void 0:y.vcc)==null?void 0:K.offset)??"Vcc offset")+"")&&E(a,s),B[0]&64&&ye(c.value)!==T[6].i.v.o&&H(c,T[6].i.v.o),B[0]&4&&d!==(d=(((G=(U=(V=T[2].conf)==null?void 0:V.hw)==null?void 0:U.vcc)==null?void 0:G.multiplier)??"Multiplier")+"")&&E(h,d),B[0]&64&&ye(w.value)!==T[6].i.v.m&&H(w,T[6].i.v.m),T[0].board==2||T[0].board==100?F?F.p(T,B):(F=qa(T),F.c(),F.m(n,null)):F&&(F.d(1),F=null)},d(T){T&&(N(e),N(l),N(n)),F&&F.d(),R=!1,jt(I)}}}function qa(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.boot)??"Boot limit")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","ivb"),u(a,"type","number"),u(a,"min","2.5"),u(a,"max","3.5"),u(a,"step","0.1"),u(a,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(d,h){P(d,e,h),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].i.v.b),r||(f=ce(a,"input",t[116]),r=!0)},p(d,h){var b,g,w;h[0]&4&&l!==(l=(((w=(g=(b=d[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:w.boot)??"Boot limit")+"")&&E(n,l),h[0]&64&&ye(a.value)!==d[6].i.v.b&&H(a,d[6].i.v.b)},d(d){d&&N(e),r=!1,f()}}}function Ea(t){var F,M,A,O,j,Y;let e,l,n=(((M=(F=t[2].conf)==null?void 0:F.debug)==null?void 0:M.title)??"Debugging")+"",i,s,a,r,f,c,m,_,d,h,b=(((O=(A=t[2].conf)==null?void 0:A.debug)==null?void 0:O.enable)??"Enable debugging")+"",g,w,k,R,I=((Y=(j=t[6])==null?void 0:j.d)==null?void 0:Y.s)&&Da(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("label"),d=p("input"),h=v(),g=C(b),w=v(),I&&I.c(),u(l,"class","text-sm"),u(a,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","d"),f.value="true",u(d,"type","checkbox"),u(d,"name","ds"),d.__value="true",H(d,d.__value),u(d,"class","rounded mb-1"),u(m,"class","mt-3"),u(e,"class","cnt")},m(W,T){P(W,e,T),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,d),d.checked=t[6].d.s,o(_,h),o(_,g),o(e,w),I&&I.m(e,null),k||(R=ce(d,"change",t[117]),k=!0)},p(W,T){var B,X,y,K,V,U;T[0]&4&&n!==(n=(((X=(B=W[2].conf)==null?void 0:B.debug)==null?void 0:X.title)??"Debugging")+"")&&E(i,n),T[0]&64&&(d.checked=W[6].d.s),T[0]&4&&b!==(b=(((K=(y=W[2].conf)==null?void 0:y.debug)==null?void 0:K.enable)??"Enable debugging")+"")&&E(g,b),(U=(V=W[6])==null?void 0:V.d)!=null&&U.s?I?I.p(W,T):(I=Da(W),I.c(),I.m(e,null)):I&&(I.d(1),I=null)},d(W){W&&N(e),I&&I.d(),k=!1,R()}}}function Da(t){var A,O,j,Y;let e,l=(((O=(A=t[2].conf)==null?void 0:A.debug)==null?void 0:O.danger)??"Disable when done")+"",n,i,s,a,r,f,c=(((Y=(j=t[2].conf)==null?void 0:j.debug)==null?void 0:Y.telnet)??"Enable telnet")+"",m,_,d,h,b,g,w,k,R,I,F,M=t[6].d.t&&Aa(t);return{c(){e=p("div"),n=C(l),i=v(),s=p("div"),a=p("label"),r=p("input"),f=v(),m=C(c),_=v(),M&&M.c(),d=v(),h=p("div"),b=p("select"),g=p("option"),g.textContent="Verbose",w=p("option"),w.textContent="Debug",k=p("option"),k.textContent="Info",R=p("option"),R.textContent="Warning",u(e,"class","bd-red"),u(r,"type","checkbox"),u(r,"name","dt"),r.__value="true",H(r,r.__value),u(r,"class","rounded mb-1"),u(s,"class","my-1"),g.__value=1,H(g,g.__value),w.__value=2,H(w,w.__value),k.__value=3,H(k,k.__value),R.__value=4,H(R,R.__value),u(b,"name","dl"),u(b,"class","in-s"),t[6].d.l===void 0&&At(()=>t[119].call(b)),u(h,"class","my-1")},m(W,T){P(W,e,T),o(e,n),P(W,i,T),P(W,s,T),o(s,a),o(a,r),r.checked=t[6].d.t,o(a,f),o(a,m),P(W,_,T),M&&M.m(W,T),P(W,d,T),P(W,h,T),o(h,b),o(b,g),o(b,w),o(b,k),o(b,R),Ke(b,t[6].d.l,!0),I||(F=[ce(r,"change",t[118]),ce(b,"change",t[119])],I=!0)},p(W,T){var B,X,y,K;T[0]&4&&l!==(l=(((X=(B=W[2].conf)==null?void 0:B.debug)==null?void 0:X.danger)??"Disable when done")+"")&&E(n,l),T[0]&64&&(r.checked=W[6].d.t),T[0]&4&&c!==(c=(((K=(y=W[2].conf)==null?void 0:y.debug)==null?void 0:K.telnet)??"Enable telnet")+"")&&E(m,c),W[6].d.t?M?M.p(W,T):(M=Aa(W),M.c(),M.m(d.parentNode,d)):M&&(M.d(1),M=null),T[0]&64&&Ke(b,W[6].d.l)},d(W){W&&(N(e),N(i),N(s),N(_),N(d),N(h)),M&&M.d(W),I=!1,jt(F)}}}function Aa(t){var i,s;let e,l=(((s=(i=t[2].conf)==null?void 0:i.debug)==null?void 0:s.telnet_danger)??"Disable when done")+"",n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.debug)==null?void 0:c.telnet_danger)??"Disable when done")+"")&&E(n,l)},d(a){a&&N(e)}}}function Oa(t){var d,h;let e,l,n=(((d=t[2].conf)==null?void 0:d.btn_reset)??"Factory reset")+"",i,s,a,r,f=(((h=t[2].btn)==null?void 0:h.reboot)??"Reboot")+"",c,m,_;return{c(){e=p("div"),l=p("button"),i=C(n),s=v(),a=p("div"),r=p("button"),c=C(f),u(l,"type","button"),u(l,"class","btn-red"),u(r,"type","button"),u(r,"class","btn-yellow"),u(a,"class","text-center")},m(b,g){P(b,e,g),o(e,l),o(l,i),P(b,s,g),P(b,a,g),o(a,r),o(r,c),m||(_=[ce(l,"click",t[14]),ce(r,"click",t[16])],m=!0)},p(b,g){var w,k;g[0]&4&&n!==(n=(((w=b[2].conf)==null?void 0:w.btn_reset)??"Factory reset")+"")&&E(i,n),g[0]&4&&f!==(f=(((k=b[2].btn)==null?void 0:k.reboot)??"Reboot")+"")&&E(c,f)},d(b){b&&(N(e),N(s),N(a)),m=!1,jt(_)}}}function La(t){var s;let e,l,n=(((s=t[2].btn)==null?void 0:s.save)??"Save")+"",i;return{c(){e=p("div"),l=p("button"),i=C(n),u(l,"type","submit"),u(l,"class","btn-pri"),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,l),o(l,i)},p(a,r){var f;r[0]&4&&n!==(n=(((f=a[2].btn)==null?void 0:f.save)??"Save")+"")&&E(i,n)},d(a){a&&N(e)}}}function Mc(t){var J,$,ke,Ce,D,S,L,q,z,ee,fe,_e,de,x,he,be,Ae,Pe,Oe,Le,De,Ue,xe,Ct,tt,ot,Mt,ht,at,it,ft,Lt,We,Re,He,lt,ve,Ee,Qe;let e,l,n,i,s,a,r,f,c,m,_=((ke=($=(J=t[6])==null?void 0:J.p)==null?void 0:$.r)==null?void 0:ke.startsWith("NO"))||((S=(D=(Ce=t[6])==null?void 0:Ce.p)==null?void 0:D.r)==null?void 0:S.startsWith("10YNO"))||((z=(q=(L=t[6])==null?void 0:L.p)==null?void 0:q.r)==null?void 0:z.startsWith("10Y1001A1001A4")),d,h,b,g=((ee=t[6])==null?void 0:ee.d)&&((_e=(fe=t[0])==null?void 0:fe.features)==null?void 0:_e.includes("rdebug")),w,k,R,I,F,M,A,O,j,Y,W,T,B,X,y=((de=t[6])==null?void 0:de.g)&&zo(t),K=((x=t[6])==null?void 0:x.m)&&Ko(t),V=((he=t[6])==null?void 0:he.w)&&Jo(t),U=((be=t[6])==null?void 0:be.n)&&na(t),G=((Ae=t[6])==null?void 0:Ae.q)&&sa(t),se=((Oe=(Pe=t[6])==null?void 0:Pe.q)==null?void 0:Oe.m)==3&&fa(t),le=((De=(Le=t[6])==null?void 0:Le.q)==null?void 0:De.m)==4&&ua(t),Q=((Ue=t[6])==null?void 0:Ue.c)&&ra(t),ae=_&&va(t),re=((xe=t[6])==null?void 0:xe.u)&&ga(t),ue=((tt=(Ct=t[6])==null?void 0:Ct.i)==null?void 0:tt.h)&&(((ot=t[0])==null?void 0:ot.board)>20||((Mt=t[0])==null?void 0:Mt.chip)=="esp8266"||((it=(at=(ht=t[6])==null?void 0:ht.i)==null?void 0:at.d)==null?void 0:it.d)>0)&&Ca(t),ne=g&&Ea(t),pe=((ft=t[1])==null?void 0:ft.a)&&Oa(t),oe=t[6]&&La(t);return F=new rl({props:{active:t[3],message:((We=(Lt=t[2].conf)==null?void 0:Lt.mask)==null?void 0:We.loading)??"Loading"}}),A=new rl({props:{active:t[4],message:((He=(Re=t[2].conf)==null?void 0:Re.mask)==null?void 0:He.saving)??"Saving"}}),j=new rl({props:{active:t[10],message:((ve=(lt=t[2].conf)==null?void 0:lt.mask)==null?void 0:ve.reset)??"Factory reset"}}),W=new rl({props:{active:t[11],message:((Qe=(Ee=t[2].conf)==null?void 0:Ee.mask)==null?void 0:Qe.reset_done)??"Done"}}),{c(){e=p("form"),l=p("div"),y&&y.c(),n=v(),K&&K.c(),i=v(),V&&V.c(),s=v(),U&&U.c(),a=v(),G&&G.c(),r=v(),se&&se.c(),f=v(),le&&le.c(),c=v(),Q&&Q.c(),m=v(),ae&&ae.c(),d=v(),re&&re.c(),h=v(),ue&&ue.c(),b=v(),ne&&ne.c(),w=v(),k=p("div"),pe&&pe.c(),R=v(),oe&&oe.c(),I=v(),Ne(F.$$.fragment),M=v(),Ne(A.$$.fragment),O=v(),Ne(j.$$.fragment),Y=v(),Ne(W.$$.fragment),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(k,"class","grid grid-cols-3 mt-3"),u(e,"autocomplete","off")},m(me,we){P(me,e,we),o(e,l),y&&y.m(l,null),o(l,n),K&&K.m(l,null),o(l,i),V&&V.m(l,null),o(l,s),U&&U.m(l,null),o(l,a),G&&G.m(l,null),o(l,r),se&&se.m(l,null),o(l,f),le&&le.m(l,null),o(l,c),Q&&Q.m(l,null),o(l,m),ae&&ae.m(l,null),o(l,d),re&&re.m(l,null),o(l,h),ue&&ue.m(l,null),o(l,b),ne&&ne.m(l,null),o(e,w),o(e,k),pe&&pe.m(k,null),o(k,R),oe&&oe.m(k,null),P(me,I,we),Se(F,me,we),P(me,M,we),Se(A,me,we),P(me,O,we),Se(j,me,we),P(me,Y,we),Se(W,me,we),T=!0,B||(X=ce(e,"submit",pn(t[15])),B=!0)},p(me,we){var Be,kt,ct,mt,et,qt,Wt,wt,_t,zt,Xt,Ut,Ht,Yt,$t,Gt,It,Fe,Xe,je,Dt,Bt,$e,st,Et,pt,ge,nt,ze,el,tl,ll,nl,il,sl,Ze,dt,Te,te;(Be=me[6])!=null&&Be.g?y?(y.p(me,we),we[0]&64&&Z(y,1)):(y=zo(me),y.c(),Z(y,1),y.m(l,n)):y&&(vt(),ie(y,1,1,()=>{y=null}),bt()),(kt=me[6])!=null&&kt.m?K?K.p(me,we):(K=Ko(me),K.c(),K.m(l,i)):K&&(K.d(1),K=null),(ct=me[6])!=null&&ct.w?V?V.p(me,we):(V=Jo(me),V.c(),V.m(l,s)):V&&(V.d(1),V=null),(mt=me[6])!=null&&mt.n?U?(U.p(me,we),we[0]&64&&Z(U,1)):(U=na(me),U.c(),Z(U,1),U.m(l,a)):U&&(vt(),ie(U,1,1,()=>{U=null}),bt()),(et=me[6])!=null&&et.q?G?(G.p(me,we),we[0]&64&&Z(G,1)):(G=sa(me),G.c(),Z(G,1),G.m(l,r)):G&&(vt(),ie(G,1,1,()=>{G=null}),bt()),((Wt=(qt=me[6])==null?void 0:qt.q)==null?void 0:Wt.m)==3?se?se.p(me,we):(se=fa(me),se.c(),se.m(l,f)):se&&(se.d(1),se=null),((_t=(wt=me[6])==null?void 0:wt.q)==null?void 0:_t.m)==4?le?le.p(me,we):(le=ua(me),le.c(),le.m(l,c)):le&&(le.d(1),le=null),(zt=me[6])!=null&&zt.c?Q?(Q.p(me,we),we[0]&64&&Z(Q,1)):(Q=ra(me),Q.c(),Z(Q,1),Q.m(l,m)):Q&&(vt(),ie(Q,1,1,()=>{Q=null}),bt()),we[0]&64&&(_=((Ht=(Ut=(Xt=me[6])==null?void 0:Xt.p)==null?void 0:Ut.r)==null?void 0:Ht.startsWith("NO"))||((Gt=($t=(Yt=me[6])==null?void 0:Yt.p)==null?void 0:$t.r)==null?void 0:Gt.startsWith("10YNO"))||((Xe=(Fe=(It=me[6])==null?void 0:It.p)==null?void 0:Fe.r)==null?void 0:Xe.startsWith("10Y1001A1001A4"))),_?ae?ae.p(me,we):(ae=va(me),ae.c(),ae.m(l,d)):ae&&(ae.d(1),ae=null),(je=me[6])!=null&&je.u?re?re.p(me,we):(re=ga(me),re.c(),re.m(l,h)):re&&(re.d(1),re=null),(Bt=(Dt=me[6])==null?void 0:Dt.i)!=null&&Bt.h&&((($e=me[0])==null?void 0:$e.board)>20||((st=me[0])==null?void 0:st.chip)=="esp8266"||((ge=(pt=(Et=me[6])==null?void 0:Et.i)==null?void 0:pt.d)==null?void 0:ge.d)>0)?ue?(ue.p(me,we),we[0]&65&&Z(ue,1)):(ue=Ca(me),ue.c(),Z(ue,1),ue.m(l,b)):ue&&(vt(),ie(ue,1,1,()=>{ue=null}),bt()),we[0]&65&&(g=((nt=me[6])==null?void 0:nt.d)&&((el=(ze=me[0])==null?void 0:ze.features)==null?void 0:el.includes("rdebug"))),g?ne?ne.p(me,we):(ne=Ea(me),ne.c(),ne.m(l,null)):ne&&(ne.d(1),ne=null),(tl=me[1])!=null&&tl.a?pe?pe.p(me,we):(pe=Oa(me),pe.c(),pe.m(k,R)):pe&&(pe.d(1),pe=null),me[6]?oe?oe.p(me,we):(oe=La(me),oe.c(),oe.m(k,null)):oe&&(oe.d(1),oe=null);const ut={};we[0]&8&&(ut.active=me[3]),we[0]&4&&(ut.message=((nl=(ll=me[2].conf)==null?void 0:ll.mask)==null?void 0:nl.loading)??"Loading"),F.$set(ut);const Ge={};we[0]&16&&(Ge.active=me[4]),we[0]&4&&(Ge.message=((sl=(il=me[2].conf)==null?void 0:il.mask)==null?void 0:sl.saving)??"Saving"),A.$set(Ge);const Ft={};we[0]&1024&&(Ft.active=me[10]),we[0]&4&&(Ft.message=((dt=(Ze=me[2].conf)==null?void 0:Ze.mask)==null?void 0:dt.reset)??"Factory reset"),j.$set(Ft);const gt={};we[0]&2048&&(gt.active=me[11]),we[0]&4&&(gt.message=((te=(Te=me[2].conf)==null?void 0:Te.mask)==null?void 0:te.reset_done)??"Done"),W.$set(gt)},i(me){T||(Z(y),Z(U),Z(G),Z(Q),Z(ue),Z(F.$$.fragment,me),Z(A.$$.fragment,me),Z(j.$$.fragment,me),Z(W.$$.fragment,me),T=!0)},o(me){ie(y),ie(U),ie(G),ie(Q),ie(ue),ie(F.$$.fragment,me),ie(A.$$.fragment,me),ie(j.$$.fragment,me),ie(W.$$.fragment,me),T=!1},d(me){me&&(N(e),N(I),N(M),N(O),N(Y)),y&&y.d(),K&&K.d(),V&&V.d(),U&&U.d(),G&&G.d(),se&&se.d(),le&&le.d(),Q&&Q.d(),ae&&ae.d(),re&&re.d(),ue&&ue.d(),ne&&ne.d(),pe&&pe.d(),oe&&oe.d(),Me(F,me),Me(A,me),Me(j,me),Me(W,me),B=!1,X()}}}async function Nc(){await(await fetch("reboot",{method:"POST"})).json()}function Pc(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,{data:s}=e,a={};bl.subscribe(Ze=>{l(2,a=Ze)});let r=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Per phase",key:"h"},{name:"Power factor",key:"f"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],f=!0,c=!1,m=!1,_,d=[];Un.subscribe(Ze=>{var dt,Te,te;Ze.version&&(l(5,m=(dt=Ze==null?void 0:Ze.c)==null?void 0:dt.e),l(6,_=Ze),l(3,f=!1),l(7,d=[{code:"en",name:"English"}]),(Te=_==null?void 0:_.u)!=null&&Te.lang&&_.u.lang!="en"&&d.push({code:_.u.lang,name:((te=a.language)==null?void 0:te.name)??"Unknown"}),d.push({code:"hub",name:"Load from server"}))}),H0();let h=!0,b={};$i.subscribe(Ze=>{var dt;l(8,h=!0);for(let Te=0;Te(Zt.hostname=dt.get("gh"),Zt.usrcfg=Ie.success,Zt.booting=Ie.reboot,dt.get("nm")=="static"&&(Zt.net.ip=dt.get("ni"),Zt.net.mask=dt.get("nu"),Zt.net.gw=dt.get("ng"),Zt.net.dns1=dt.get("nd")),Zt.ui=_.u,Zt)),l(4,c=!1),sn(n)}const I=function(){confirm("Reboot?")&&(cl.update(Ze=>(Ze.booting=!0,Ze)),Nc())};async function F(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),Un.update(dt=>(dt.q.s.c=!1,dt)))}async function M(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),Un.update(dt=>(dt.q.s.r=!1,dt)))}async function A(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),Un.update(dt=>(dt.q.s.k=!1,dt)))}const O=function(){_.q.s.e?_.q.p==1883&&l(6,_.q.p=8883,_):_.q.p==8883&&l(6,_.q.p=1883,_)};async function j(){if(_.u.lang=="hub"){const Ze=await vl("http://hub.amsleser.no/hub/language/list.json");l(7,d=await Ze.json()),l(6,_.u.lang=a.language.code,_)}}let Y=44;async function W(){const Ze=await vl("cloudkey.json");if(Ze.status==200){let dt=await Ze.json();window.open("https://www.amsleser.cloud/device/"+dt.seed)}else alert("Not able to bind to cloud")}const T=window||global;T.bindToCloud=function(){console.log("BIND CALLED")};function B(){_.g.h=this.value,l(6,_)}function X(){_.g.t=Vt(this),l(6,_)}function y(){_.p.r=Vt(this),l(6,_)}function K(){_.p.c=Vt(this),l(6,_)}function V(){_.p.e=this.checked,l(6,_)}function U(){_.p.t=this.value,l(6,_)}function G(){_.g.s=Vt(this),l(6,_)}function se(){_.g.u=this.value,l(6,_)}function le(){_.g.p=this.value,l(6,_)}function Q(){_.g.c=this.value,l(6,_)}function ae(){_.m.a=Vt(this),l(6,_)}function re(){_.m.b=ye(this.value),l(6,_)}function ue(){_.m.i=this.checked,l(6,_)}function ne(){_.m.b=Vt(this),l(6,_)}function pe(){_.m.p=Vt(this),l(6,_)}function oe(){_.m.s=ye(this.value),l(6,_)}function J(){_.m.d=Vt(this),l(6,_)}function $(){_.m.f=ye(this.value),l(6,_)}function ke(){_.m.r=ye(this.value),l(6,_)}function Ce(){_.m.e.e=this.checked,l(6,_)}function D(){_.m.e.k=this.value,l(6,_)}function S(){_.m.e.a=this.value,l(6,_)}function L(){_.m.m.e=this.checked,l(6,_)}function q(){_.m.m.w=ye(this.value),l(6,_)}function z(){_.m.m.v=ye(this.value),l(6,_)}function ee(){_.m.m.a=ye(this.value),l(6,_)}function fe(){_.m.m.c=ye(this.value),l(6,_)}function _e(){_.n.c=Vt(this),l(6,_)}function de(){h=this.checked,l(8,h)}function x(){_.w.s=this.value,l(6,_)}function he(){_.w.s=Vt(this),l(6,_)}function be(){_.w.p=this.value,l(6,_)}function Ae(){_.w.z=Vt(this),l(6,_)}function Pe(){_.w.w=ye(this.value),l(6,_)}function Oe(){_.w.b=this.checked,l(6,_)}function Le(){_.n.m=Vt(this),l(6,_)}function De(){_.n.i=this.value,l(6,_)}function Ue(){_.n.s=Vt(this),l(6,_)}function xe(){_.n.g=this.value,l(6,_)}function Ct(){_.n.d1=this.value,l(6,_)}function tt(){_.n.d2=this.value,l(6,_)}function ot(){_.n.x=this.checked,l(6,_)}function Mt(){_.n.d=this.checked,l(6,_)}function ht(){_.n.h=this.checked,l(6,_)}function at(){_.n.n1=this.value,l(6,_)}function it(){_.q.s.e=this.checked,l(6,_)}function ft(){_.q.h=this.value,l(6,_)}function Lt(){_.q.p=ye(this.value),l(6,_)}function We(){_.q.u=this.value,l(6,_)}function Re(){_.q.a=this.value,l(6,_)}function He(){_.q.c=this.value,l(6,_)}function lt(){_.q.m=Vt(this),l(6,_)}function ve(){_.q.b=this.value,l(6,_)}function Ee(){_.q.r=this.value,l(6,_)}function Qe(){_.q.t=Vt(this),l(6,_)}function me(){_.q.d=ye(this.value),l(6,_)}function we(){_.q.i=ye(this.value),l(6,_)}function ut(){_.q.k=ye(this.value),l(6,_)}function Ge(){_.o.e=this.value,l(6,_)}function Ft(){_.o.c=this.value,l(6,_)}function gt(){_.o.u1=this.value,l(6,_)}function Be(){_.o.u2=this.value,l(6,_)}function kt(){_.o.u3=this.value,l(6,_)}function ct(){_.h.t=this.value,l(6,_)}function mt(){_.h.h=this.value,l(6,_)}function et(){_.h.n=this.value,l(6,_)}function qt(){_.c.e=this.checked,l(6,_)}function Wt(){_.c.p=Vt(this),l(6,_)}function wt(){_.c.es=this.checked,l(6,_)}function _t(Ze){_.t.t[Ze]=ye(this.value),l(6,_)}function zt(){_.t.h=ye(this.value),l(6,_)}function Xt(Ze){_.u[Ze.key]=Vt(this),l(6,_)}function Ut(){_.u.lang=Vt(this),l(6,_)}function Ht(){_.i.h.p=Vt(this),l(6,_)}function Yt(){_.i.h.t=Vt(this),l(6,_)}function $t(){_.i.h.u=this.checked,l(6,_)}function Gt(){_.i.a=ye(this.value),l(6,_)}function It(){_.i.l.p=ye(this.value),l(6,_)}function Fe(){_.i.l.i=this.checked,l(6,_)}function Xe(){_.i.r.i=this.checked,l(6,_)}function je(){_.i.r.r=ye(this.value),l(6,_)}function Dt(){_.i.r.g=ye(this.value),l(6,_)}function Bt(){_.i.r.b=ye(this.value),l(6,_)}function $e(){_.i.d.d=ye(this.value),l(6,_)}function st(){_.i.t.d=ye(this.value),l(6,_)}function Et(){_.i.t.a=ye(this.value),l(6,_)}function pt(){_.i.v.p=ye(this.value),l(6,_)}function ge(){_.i.v.d.v=ye(this.value),l(6,_)}function nt(){_.i.v.d.g=ye(this.value),l(6,_)}function ze(){_.i.d.b=Vt(this),l(6,_)}function el(){_.i.v.o=ye(this.value),l(6,_)}function tl(){_.i.v.m=ye(this.value),l(6,_)}function ll(){_.i.v.b=ye(this.value),l(6,_)}function nl(){_.d.s=this.checked,l(6,_)}function il(){_.d.t=this.checked,l(6,_)}function sl(){_.d.l=Vt(this),l(6,_)}return t.$$set=Ze=>{"basepath"in Ze&&l(23,n=Ze.basepath),"sysinfo"in Ze&&l(0,i=Ze.sysinfo),"data"in Ze&&l(1,s=Ze.data)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(12,Y=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,s,a,f,c,m,_,d,h,b,g,w,Y,r,k,R,I,F,M,A,O,j,W,n,B,X,y,K,V,U,G,se,le,Q,ae,re,ue,ne,pe,oe,J,$,ke,Ce,D,S,L,q,z,ee,fe,_e,de,x,he,be,Ae,Pe,Oe,Le,De,Ue,xe,Ct,tt,ot,Mt,ht,at,it,ft,Lt,We,Re,He,lt,ve,Ee,Qe,me,we,ut,Ge,Ft,gt,Be,kt,ct,mt,et,qt,Wt,wt,_t,zt,Xt,Ut,Ht,Yt,$t,Gt,It,Fe,Xe,je,Dt,Bt,$e,st,Et,pt,ge,nt,ze,el,tl,ll,nl,il,sl]}class Tc extends Tt{constructor(e){super(),Pt(this,e,Pc,Mc,Nt,{basepath:23,sysinfo:0,data:1},null,[-1,-1,-1,-1,-1])}}function Ia(t,e,l){const n=t.slice();return n[21]=e[l],n}function Ra(t){let e,l=t[1].cpu+"",n,i;return{c(){e=C("("),n=C(l),i=C("MHz)")},m(s,a){P(s,e,a),P(s,n,a),P(s,i,a)},p(s,a){a&2&&l!==(l=s[1].cpu+"")&&E(n,l)},d(s){s&&(N(e),N(n),N(i))}}}function qc(t){let e=Je(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){P(n,l,i)},p(n,i){i&2&&e!==(e=Je(n[1].chip,n[1].board)+"")&&E(l,e)},d(n){n&&N(l)}}}function Fa(t){var V,U,G,se,le,Q,ae,re;let e,l=(((U=(V=t[3].status)==null?void 0:V.device)==null?void 0:U.apmac)??"AP MAC")+"",n,i,s=t[1].apmac+"",a,r,f,c=(((se=(G=t[3].status)==null?void 0:G.device)==null?void 0:se.last_boot)??"Last boot")+"",m,_,d,h,b,g,w=(((Q=(le=t[3].status)==null?void 0:le.device)==null?void 0:Q.reason)??"Reason")+"",k,R,I=(((re=(ae=t[3][ds(t[1].chip)])==null?void 0:ae.reason)==null?void 0:re[t[1].boot_reason])??t[1].boot_reason)+"",F,M,A=t[1].boot_reason+"",O,j,Y=t[1].ex_cause+"",W,T,B;const X=[Dc,Ec],y=[];function K(ue,ne){return ue[0].u>0?0:1}return d=K(t),h=y[d]=X[d](t),{c(){e=p("div"),n=C(l),i=C(": "),a=C(s),r=v(),f=p("div"),m=C(c),_=C(`: - `),h.c(),b=v(),g=p("div"),k=C(w),R=C(": "),F=C(I),M=C(" ("),O=C(A),j=C("/"),W=C(Y),T=C(")"),u(e,"class","my-2"),u(f,"class","my-2"),u(g,"class","my-2")},m(ue,ne){P(ue,e,ne),o(e,n),o(e,i),o(e,a),P(ue,r,ne),P(ue,f,ne),o(f,m),o(f,_),y[d].m(f,null),P(ue,b,ne),P(ue,g,ne),o(g,k),o(g,R),o(g,F),o(g,M),o(g,O),o(g,j),o(g,W),o(g,T),B=!0},p(ue,ne){var oe,J,$,ke,Ce,D,S,L;(!B||ne&8)&&l!==(l=(((J=(oe=ue[3].status)==null?void 0:oe.device)==null?void 0:J.apmac)??"AP MAC")+"")&&E(n,l),(!B||ne&2)&&s!==(s=ue[1].apmac+"")&&E(a,s),(!B||ne&8)&&c!==(c=(((ke=($=ue[3].status)==null?void 0:$.device)==null?void 0:ke.last_boot)??"Last boot")+"")&&E(m,c);let pe=d;d=K(ue),d===pe?y[d].p(ue,ne):(vt(),ie(y[pe],1,1,()=>{y[pe]=null}),bt(),h=y[d],h?h.p(ue,ne):(h=y[d]=X[d](ue),h.c()),Z(h,1),h.m(f,null)),(!B||ne&8)&&w!==(w=(((D=(Ce=ue[3].status)==null?void 0:Ce.device)==null?void 0:D.reason)??"Reason")+"")&&E(k,w),(!B||ne&10)&&I!==(I=(((L=(S=ue[3][ds(ue[1].chip)])==null?void 0:S.reason)==null?void 0:L[ue[1].boot_reason])??ue[1].boot_reason)+"")&&E(F,I),(!B||ne&2)&&A!==(A=ue[1].boot_reason+"")&&E(O,A),(!B||ne&2)&&Y!==(Y=ue[1].ex_cause+"")&&E(W,Y)},i(ue){B||(Z(h),B=!0)},o(ue){ie(h),B=!1},d(ue){ue&&(N(e),N(r),N(f),N(b),N(g)),y[d].d()}}}function Ec(t){let e;return{c(){e=C("-")},m(l,n){P(l,e,n)},p:Ye,i:Ye,o:Ye,d(l){l&&N(e)}}}function Dc(t){let e,l;return e=new Tu({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:"",offset:t[1].clock_offset}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),i&2&&(s.offset=n[1].clock_offset),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function Ua(t){var m;let e,l,n,i,s=(((m=t[3].btn)==null?void 0:m.reboot)??"Reboot")+"",a,r,f,c;return l=new pl({props:{to:"/consent",$$slots:{default:[Ac]},$$scope:{ctx:t}}}),{c(){e=p("div"),Ne(l.$$.fragment),n=v(),i=p("button"),a=C(s),u(i,"class","btn-yellow-sm float-right"),u(e,"class","my-2")},m(_,d){P(_,e,d),Se(l,e,null),o(e,n),o(e,i),o(i,a),r=!0,f||(c=ce(i,"click",t[11]),f=!0)},p(_,d){var b;const h={};d&16777224&&(h.$$scope={dirty:d,ctx:_}),l.$set(h),(!r||d&8)&&s!==(s=(((b=_[3].btn)==null?void 0:b.reboot)??"Reboot")+"")&&E(a,s)},i(_){r||(Z(l.$$.fragment,_),r=!0)},o(_){ie(l.$$.fragment,_),r=!1},d(_){_&&N(e),Me(l),f=!1,c()}}}function Ac(t){var i,s;let e,l=(((s=(i=t[3].status)==null?void 0:i.device)==null?void 0:s.btn_consents)??"Consents")+"",n;return{c(){e=p("span"),n=C(l),u(e,"class","btn-pri-sm")},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r&8&&l!==(l=(((c=(f=a[3].status)==null?void 0:f.device)==null?void 0:c.btn_consents)??"Consents")+"")&&E(n,l)},d(a){a&&N(e)}}}function Ba(t){var W,T,B,X,y,K,V,U;let e,l,n=(((T=(W=t[3].status)==null?void 0:W.meter)==null?void 0:T.title)??"Meter")+"",i,s,a,r=(((X=(B=t[3].status)==null?void 0:B.meter)==null?void 0:X.manufacturer)??"Manufacturer")+"",f,c,m=ui(t[1].meter.mfg)+"",_,d,h,b=(((K=(y=t[3].status)==null?void 0:y.meter)==null?void 0:K.model)??"Model")+"",g,w,k=(t[1].meter.model?t[1].meter.model:"unknown")+"",R,I,F,M=(((U=(V=t[3].status)==null?void 0:V.meter)==null?void 0:U.id)??"ID")+"",A,O,j=(t[1].meter.id?t[1].meter.id:"unknown")+"",Y;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),f=C(r),c=C(": "),_=C(m),d=v(),h=p("div"),g=C(b),w=C(": "),R=C(k),I=v(),F=p("div"),A=C(M),O=C(": "),Y=C(j),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(F,"class","my-2"),u(e,"class","cnt")},m(G,se){P(G,e,se),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(a,c),o(a,_),o(e,d),o(e,h),o(h,g),o(h,w),o(h,R),o(e,I),o(e,F),o(F,A),o(F,O),o(F,Y)},p(G,se){var le,Q,ae,re,ue,ne,pe,oe;se&8&&n!==(n=(((Q=(le=G[3].status)==null?void 0:le.meter)==null?void 0:Q.title)??"Meter")+"")&&E(i,n),se&8&&r!==(r=(((re=(ae=G[3].status)==null?void 0:ae.meter)==null?void 0:re.manufacturer)??"Manufacturer")+"")&&E(f,r),se&2&&m!==(m=ui(G[1].meter.mfg)+"")&&E(_,m),se&8&&b!==(b=(((ne=(ue=G[3].status)==null?void 0:ue.meter)==null?void 0:ne.model)??"Model")+"")&&E(g,b),se&2&&k!==(k=(G[1].meter.model?G[1].meter.model:"unknown")+"")&&E(R,k),se&8&&M!==(M=(((oe=(pe=G[3].status)==null?void 0:pe.meter)==null?void 0:oe.id)??"ID")+"")&&E(A,M),se&2&&j!==(j=(G[1].meter.id?G[1].meter.id:"unknown")+"")&&E(Y,j)},d(G){G&&N(e)}}}function ja(t){var U,G,se,le,Q,ae,re,ue;let e,l,n=(((G=(U=t[3].status)==null?void 0:U.network)==null?void 0:G.title)??"Network")+"",i,s,a,r=(((le=(se=t[3].conf)==null?void 0:se.network)==null?void 0:le.ip)??"IP")+"",f,c,m=t[1].net.ip+"",_,d,h,b=(((ae=(Q=t[3].conf)==null?void 0:Q.network)==null?void 0:ae.mask)??"Mask")+"",g,w,k=t[1].net.mask+"",R,I,F,M=(((ue=(re=t[3].conf)==null?void 0:re.network)==null?void 0:ue.gw)??"Gateway")+"",A,O,j=t[1].net.gw+"",Y,W,T,B,X,y=t[1].net.dns1&&Ha(t),K=t[1].net.dns2&&ya(t),V=t[1].net.ipv6&&za(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),f=C(r),c=C(": "),_=C(m),d=v(),h=p("div"),g=C(b),w=C(": "),R=C(k),I=v(),F=p("div"),A=C(M),O=C(": "),Y=C(j),W=v(),T=p("div"),y&&y.c(),B=v(),K&&K.c(),X=v(),V&&V.c(),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(F,"class","my-2"),u(T,"class","my-2"),u(e,"class","cnt")},m(ne,pe){P(ne,e,pe),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(a,c),o(a,_),o(e,d),o(e,h),o(h,g),o(h,w),o(h,R),o(e,I),o(e,F),o(F,A),o(F,O),o(F,Y),o(e,W),o(e,T),y&&y.m(T,null),o(T,B),K&&K.m(T,null),o(e,X),V&&V.m(e,null)},p(ne,pe){var oe,J,$,ke,Ce,D,S,L;pe&8&&n!==(n=(((J=(oe=ne[3].status)==null?void 0:oe.network)==null?void 0:J.title)??"Network")+"")&&E(i,n),pe&8&&r!==(r=(((ke=($=ne[3].conf)==null?void 0:$.network)==null?void 0:ke.ip)??"IP")+"")&&E(f,r),pe&2&&m!==(m=ne[1].net.ip+"")&&E(_,m),pe&8&&b!==(b=(((D=(Ce=ne[3].conf)==null?void 0:Ce.network)==null?void 0:D.mask)??"Mask")+"")&&E(g,b),pe&2&&k!==(k=ne[1].net.mask+"")&&E(R,k),pe&8&&M!==(M=(((L=(S=ne[3].conf)==null?void 0:S.network)==null?void 0:L.gw)??"Gateway")+"")&&E(A,M),pe&2&&j!==(j=ne[1].net.gw+"")&&E(Y,j),ne[1].net.dns1?y?y.p(ne,pe):(y=Ha(ne),y.c(),y.m(T,B)):y&&(y.d(1),y=null),ne[1].net.dns2?K?K.p(ne,pe):(K=ya(ne),K.c(),K.m(T,null)):K&&(K.d(1),K=null),ne[1].net.ipv6?V?V.p(ne,pe):(V=za(ne),V.c(),V.m(e,null)):V&&(V.d(1),V=null)},d(ne){ne&&N(e),y&&y.d(),K&&K.d(),V&&V.d()}}}function Ha(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[1].net.dns1+"",s;return{c(){l=C(e),n=C(": "),s=C(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,s,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&E(l,e),c&2&&i!==(i=f[1].net.dns1+"")&&E(s,i)},d(f){f&&(N(l),N(n),N(s))}}}function ya(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[1].net.dns2+"",s;return{c(){l=C(e),n=C(": "),s=C(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,s,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&E(l,e),c&2&&i!==(i=f[1].net.dns2+"")&&E(s,i)},d(f){f&&(N(l),N(n),N(s))}}}function za(t){let e,l,n,i=t[1].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"",s,a,r,f,c=t[1].net.dns1v6&&Wa(t),m=t[1].net.dns2v6&&Ga(t);return{c(){e=p("div"),l=C("IPv6: "),n=p("span"),s=C(i),a=v(),r=p("div"),c&&c.c(),f=v(),m&&m.c(),nn(n,"font-size","14px"),u(e,"class","my-2"),u(r,"class","my-2")},m(_,d){P(_,e,d),o(e,l),o(e,n),o(n,s),P(_,a,d),P(_,r,d),c&&c.m(r,null),o(r,f),m&&m.m(r,null)},p(_,d){d&2&&i!==(i=_[1].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(s,i),_[1].net.dns1v6?c?c.p(_,d):(c=Wa(_),c.c(),c.m(r,f)):c&&(c.d(1),c=null),_[1].net.dns2v6?m?m.p(_,d):(m=Ga(_),m.c(),m.m(r,null)):m&&(m.d(1),m=null)},d(_){_&&(N(e),N(a),N(r)),c&&c.d(),m&&m.d()}}}function Wa(t){let e,l,n=t[1].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=C("DNSv6: "),l=p("span"),i=C(n),nn(l,"font-size","14px")},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&2&&n!==(n=s[1].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(i,n)},d(s){s&&(N(e),N(l))}}}function Ga(t){let e,l,n=t[1].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=C("DNSv6: "),l=p("span"),i=C(n),nn(l,"font-size","14px")},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&2&&n!==(n=s[1].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(i,n)},d(s){s&&(N(e),N(l))}}}function Va(t){var f,c,m,_;let e,l,n=(((c=(f=t[3].status)==null?void 0:f.firmware)==null?void 0:c.failed)??"Upgrade from {0} to {1} failed").replace("{0}",t[1].upgrade.f).replace("{1}",t[1].upgrade.t)+"",i,s,a=(((_=(m=t[3].errors)==null?void 0:m.upgrade)==null?void 0:_[t[1].upgrade.e])??t[1].upgrade.e)+"",r;return{c(){e=p("div"),l=p("div"),i=C(n),s=v(),r=C(a),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(d,h){P(d,e,h),o(e,l),o(l,i),o(l,s),o(l,r)},p(d,h){var b,g,w,k;h&10&&n!==(n=(((g=(b=d[3].status)==null?void 0:b.firmware)==null?void 0:g.failed)??"Upgrade from {0} to {1} failed").replace("{0}",d[1].upgrade.f).replace("{1}",d[1].upgrade.t)+"")&&E(i,n),h&10&&a!==(a=(((k=(w=d[3].errors)==null?void 0:w.upgrade)==null?void 0:k[d[1].upgrade.e])??d[1].upgrade.e)+"")&&E(r,a)},d(d){d&&N(e)}}}function Ka(t){var b,g;let e,l=(((g=(b=t[3].status)==null?void 0:b.firmware)==null?void 0:g.latest)??"Latest")+"",n,i,s,a=t[1].upgrade.n+"",r,f,c,m,_,d=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[1].upgrade.n&&t[1].upgrade.n!=t[1].version&&Ya(t),h=t[1].fwconsent===2&&Qa(t);return{c(){e=p("div"),n=C(l),i=C(`: - `),s=p("a"),r=C(a),c=v(),d&&d.c(),m=v(),h&&h.c(),_=yt(),u(s,"href",f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+t[1].upgrade.n),u(s,"class","ml-2 text-blue-600 hover:text-blue-800"),u(s,"target","_blank"),u(s,"rel","noreferrer"),u(e,"class","my-2 flex")},m(w,k){P(w,e,k),o(e,n),o(e,i),o(e,s),o(s,r),o(e,c),d&&d.m(e,null),P(w,m,k),h&&h.m(w,k),P(w,_,k)},p(w,k){var R,I;k&8&&l!==(l=(((I=(R=w[3].status)==null?void 0:R.firmware)==null?void 0:I.latest)??"Latest")+"")&&E(n,l),k&2&&a!==(a=w[1].upgrade.n+"")&&E(r,a),k&2&&f!==(f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+w[1].upgrade.n)&&u(s,"href",f),(w[1].security==0||w[0].a)&&w[1].fwconsent===1&&w[1].upgrade.n&&w[1].upgrade.n!=w[1].version?d?d.p(w,k):(d=Ya(w),d.c(),d.m(e,null)):d&&(d.d(1),d=null),w[1].fwconsent===2?h?h.p(w,k):(h=Qa(w),h.c(),h.m(_.parentNode,_)):h&&(h.d(1),h=null)},d(w){w&&(N(e),N(m),N(_)),d&&d.d(),h&&h.d(w)}}}function Ya(t){let e,l,n,i,s;return{c(){var a,r;e=p("div"),l=p("button"),l.textContent="⇓",u(e,"class","flex-none ml-2 text-green-500"),u(e,"title",n=((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.install)??"Install")},m(a,r){P(a,e,r),o(e,l),i||(s=ce(l,"click",t[10]),i=!0)},p(a,r){var f,c;r&8&&n!==(n=((c=(f=a[3].status)==null?void 0:f.firmware)==null?void 0:c.install)??"Install")&&u(e,"title",n)},d(a){a&&N(e),i=!1,s()}}}function Qa(t){var s,a;let e,l,n=(((a=(s=t[3].status)==null?void 0:s.firmware)==null?void 0:a.no_one_click)??"One-click upgrade disabled")+"",i;return{c(){e=p("div"),l=p("div"),i=C(n),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(r,f){P(r,e,f),o(e,l),o(l,i)},p(r,f){var c,m;f&8&&n!==(n=(((m=(c=r[3].status)==null?void 0:c.firmware)==null?void 0:m.no_one_click)??"One-click upgrade disabled")+"")&&E(i,n)},d(r){r&&N(e)}}}function Xa(t){let e,l=bs(Je(t[1].chip,t[1].board))+"",n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,s){P(i,e,s),o(e,n)},p(i,s){s&2&&l!==(l=bs(Je(i[1].chip,i[1].board))+"")&&E(n,l)},d(i){i&&N(e)}}}function Za(t){let e,l,n,i,s,a;function r(m,_){return m[5].length==0?Lc:Oc}let f=r(t),c=f(t);return{c(){e=p("div"),l=p("form"),n=p("input"),i=v(),c.c(),nn(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,_){P(m,e,_),o(e,l),o(l,n),t[13](n),o(l,i),c.m(l,null),s||(a=[ce(n,"change",t[14]),ce(l,"submit",t[16])],s=!0)},p(m,_){f===(f=r(m))&&c?c.p(m,_):(c.d(1),c=f(m),c&&(c.c(),c.m(l,null)))},d(m){m&&N(e),t[13](null),c.d(),s=!1,jt(a)}}}function Oc(t){var r;let e=t[5][0].name+"",l,n,i,s=(((r=t[3].btn)==null?void 0:r.upload)??"Upload")+"",a;return{c(){l=C(e),n=v(),i=p("button"),a=C(s),u(i,"type","submit"),u(i,"class","btn-pri-sm float-right ml-2")},m(f,c){P(f,l,c),P(f,n,c),P(f,i,c),o(i,a)},p(f,c){var m;c&32&&e!==(e=f[5][0].name+"")&&E(l,e),c&8&&s!==(s=(((m=f[3].btn)==null?void 0:m.upload)??"Upload")+"")&&E(a,s)},d(f){f&&(N(l),N(n),N(i))}}}function Lc(t){var a,r;let e,l=(((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.btn_select_file)??"Select file")+"",n,i,s;return{c(){e=p("button"),n=C(l),u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(f,c){P(f,e,c),o(e,n),i||(s=ce(e,"click",t[15]),i=!0)},p(f,c){var m,_;c&8&&l!==(l=(((_=(m=f[3].status)==null?void 0:m.firmware)==null?void 0:_.btn_select_file)??"Select file")+"")&&E(n,l)},d(f){f&&N(e),i=!1,s()}}}function Ja(t){var K,V,U,G,se,le;let e,l,n=(((V=(K=t[3].status)==null?void 0:K.backup)==null?void 0:V.title)??"Backup")+"",i,s,a,r,f,c,m,_,d=(((G=(U=t[3].status)==null?void 0:U.backup)==null?void 0:G.secrets)??"Include secrets")+"",h,b,g,w=(((le=(se=t[3].status)==null?void 0:se.backup)==null?void 0:le.secrets_desc)??"")+"",k,R,I,F,M,A,O,j,Y=rt(t[9]),W=[];for(let Q=0;Q{_e=null}),bt()),(mt=ve[0])!=null&&mt.a?de?(de.p(ve,Ee),Ee&1&&Z(de,1)):(de=Ua(ve),de.c(),Z(de,1),de.m(l,null)):de&&(vt(),ie(de,1,1,()=>{de=null}),bt()),ve[1].meter?x?x.p(ve,Ee):(x=Ba(ve),x.c(),x.m(e,y)):x&&(x.d(1),x=null),ve[1].net?he?he.p(ve,Ee):(he=ja(ve),he.c(),he.m(e,K)):he&&(he.d(1),he=null),(!ee||Ee&8)&&G!==(G=(((qt=(et=ve[3].status)==null?void 0:et.firmware)==null?void 0:qt.title)??"Firmware")+"")&&E(se,G),(!ee||Ee&8)&&ae!==(ae=(((wt=(Wt=ve[3].status)==null?void 0:Wt.firmware)==null?void 0:wt.installed)??"Installed")+"")&&E(re,ae),(!ee||Ee&2)&&ne!==(ne=ve[1].version+"")&&E(pe,ne),ve[1].upgrade.t&&ve[1].upgrade.t!=ve[1].version&&ve[1].upgrade.e!=0&&ve[1].upgrade.e!=123?be?be.p(ve,Ee):(be=Va(ve),be.c(),be.m(V,J)):be&&(be.d(1),be=null),ve[1].upgrade.n?Ae?Ae.p(ve,Ee):(Ae=Ka(ve),Ae.c(),Ae.m(V,$)):Ae&&(Ae.d(1),Ae=null),Ee&3&&(ke=(ve[1].security==0||ve[0].a)&&Hn(ve[1].board)),ke?Pe?Pe.p(ve,Ee):(Pe=Xa(ve),Pe.c(),Pe.m(V,Ce)):Pe&&(Pe.d(1),Pe=null),ve[1].security==0||ve[0].a?Oe?Oe.p(ve,Ee):(Oe=Za(ve),Oe.c(),Oe.m(V,null)):Oe&&(Oe.d(1),Oe=null),ve[1].security==0||ve[0].a?Le?Le.p(ve,Ee):(Le=Ja(ve),Le.c(),Le.m(e,null)):Le&&(Le.d(1),Le=null);const me={};Ee&64&&(me.active=ve[6]),Ee&8&&(me.message=((zt=(_t=ve[3].status)==null?void 0:_t.mask)==null?void 0:zt.firmware)??"Uploading"),L.$set(me);const we={};Ee&256&&(we.active=ve[8]),Ee&8&&(we.message=((Ut=(Xt=ve[3].status)==null?void 0:Xt.mask)==null?void 0:Ut.config)??"Uploading"),z.$set(we)},i(ve){ee||(Z(I.$$.fragment,ve),Z(_e),Z(de),Z(L.$$.fragment,ve),Z(z.$$.fragment,ve),ee=!0)},o(ve){ie(I.$$.fragment,ve),ie(_e),ie(de),ie(L.$$.fragment,ve),ie(z.$$.fragment,ve),ee=!1},d(ve){ve&&(N(e),N(S),N(q)),fe&&fe.d(),Me(I),_e&&_e.d(),de&&de.d(),x&&x.d(),he&&he.d(),be&&be.d(),Ae&&Ae.d(),Pe&&Pe.d(),Oe&&Oe.d(),Le&&Le.d(),Me(L,ve),Me(z,ve)}}}async function Uc(){await(await fetch("reboot",{method:"POST"})).json()}function Bc(t,e,l){let{data:n}=e,{sysinfo:i}=e,s=[{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",key:"is"}],a={};bl.subscribe(j=>{l(3,a=j)});function r(){var j;confirm((((j=a.header)==null?void 0:j.upgrade)??"Upgrade to {0}?").replace("{0}",i.upgrade.n))&&(Pu(i.upgrade.n),cl.update(Y=>(Y.upgrade.t=i.upgrade.n,Y.upgrade.p=0,Y.upgrading=!0,Y)))}const f=function(){var j;confirm(((j=a.device)==null?void 0:j.reboot_confirm)??"Reboot?")&&(cl.update(Y=>(Y.booting=!0,Y)),Uc())};let c,m=[],_=!1,d,h=[],b=!1;ci();let g={hostname:"",ip:""};function w(j){l(8,b=!0);const Y=new FormData;Y.append("file",h[0]),fetch("configfile",{method:"POST",body:Y}).then(W=>W.json()).then(W=>{cl.update(T=>(g&&g.hostname&&(T.hostname=g.hostname),T.booting=W.reboot,g&&g.ip&&(T.net.ip=g.ip),setTimeout(Wn,5e3,i),T))}).catch(W=>{console.error("Error:",W),setTimeout(Wn,5e3,i)})}function k(j){ai[j?"unshift":"push"](()=>{c=j,l(4,c)})}function R(){m=this.files,l(5,m)}const I=()=>{c.click()},F=()=>l(6,_=!0);function M(j){ai[j?"unshift":"push"](()=>{d=j,l(7,d)})}function A(){h=this.files,l(2,h)}const O=()=>{d.click()};return t.$$set=j=>{"data"in j&&l(0,n=j.data),"sysinfo"in j&&l(1,i=j.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&4&&h.length==1){let j=h[0],Y=new FileReader,W=T=>{let B=T.target.result.split(` -`);for(let X in B){let y=B[X];y.startsWith("hostname ")?g.hostname=y.split(" ")[1]:y.startsWith("ip ")&&(g.ip=y.split(" ")[1])}};Y.onload=W,Y.readAsText(j)}},[n,i,h,a,c,m,_,d,b,s,r,f,w,k,R,I,F,M,A,O]}class jc extends Tt{constructor(e){super(),Pt(this,e,Bc,Fc,Nt,{data:0,sysinfo:1})}}function ef(t){let e,l,n=Je(t[0],7)+"",i,s,a=Je(t[0],5)+"",r,f,c=Je(t[0],4)+"",m,_,d=Je(t[0],3)+"",h,b,g,w,k=Je(t[0],2)+"",R,I,F=Je(t[0],1)+"",M,A,O=Je(t[0],0)+"",j,Y,W,T,B=Je(t[0],101)+"",X,y,K=Je(t[0],100)+"",V;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=p("option"),h=C(d),b=v(),g=p("optgroup"),w=p("option"),R=C(k),I=p("option"),M=C(F),A=p("option"),j=C(O),Y=v(),W=p("optgroup"),T=p("option"),X=C(B),y=p("option"),V=C(K),l.__value=7,H(l,l.__value),s.__value=5,H(s,s.__value),f.__value=4,H(f,f.__value),_.__value=3,H(_,_.__value),u(e,"label","amsleser.no"),w.__value=2,H(w,w.__value),I.__value=1,H(I,I.__value),A.__value=0,H(A,A.__value),u(g,"label","Custom hardware"),T.__value=101,H(T,T.__value),y.__value=100,H(y,y.__value),u(W,"label","Generic hardware")},m(U,G){P(U,e,G),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),o(e,_),o(_,h),P(U,b,G),P(U,g,G),o(g,w),o(w,R),o(g,I),o(I,M),o(g,A),o(A,j),P(U,Y,G),P(U,W,G),o(W,T),o(T,X),o(W,y),o(y,V)},p(U,G){G&1&&n!==(n=Je(U[0],7)+"")&&E(i,n),G&1&&a!==(a=Je(U[0],5)+"")&&E(r,a),G&1&&c!==(c=Je(U[0],4)+"")&&E(m,c),G&1&&d!==(d=Je(U[0],3)+"")&&E(h,d),G&1&&k!==(k=Je(U[0],2)+"")&&E(R,k),G&1&&F!==(F=Je(U[0],1)+"")&&E(M,F),G&1&&O!==(O=Je(U[0],0)+"")&&E(j,O),G&1&&B!==(B=Je(U[0],101)+"")&&E(X,B),G&1&&K!==(K=Je(U[0],100)+"")&&E(V,K)},d(U){U&&(N(e),N(b),N(g),N(Y),N(W))}}}function tf(t){let e,l,n=Je(t[0],201)+"",i,s,a=Je(t[0],202)+"",r,f,c=Je(t[0],203)+"",m,_,d=Je(t[0],241)+"",h,b,g=Je(t[0],242)+"",w,k,R=Je(t[0],243)+"",I,F,M=Je(t[0],245)+"",A,O,j=Je(t[0],200)+"",Y;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=p("option"),h=C(d),b=p("option"),w=C(g),k=p("option"),I=C(R),F=p("option"),A=C(M),O=p("option"),Y=C(j),l.__value=201,H(l,l.__value),s.__value=202,H(s,s.__value),f.__value=203,H(f,f.__value),_.__value=241,H(_,_.__value),b.__value=242,H(b,b.__value),k.__value=243,H(k,k.__value),F.__value=245,H(F,F.__value),O.__value=200,H(O,O.__value),u(e,"label","Generic hardware")},m(W,T){P(W,e,T),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),o(e,_),o(_,h),o(e,b),o(b,w),o(e,k),o(k,I),o(e,F),o(F,A),o(e,O),o(O,Y)},p(W,T){T&1&&n!==(n=Je(W[0],201)+"")&&E(i,n),T&1&&a!==(a=Je(W[0],202)+"")&&E(r,a),T&1&&c!==(c=Je(W[0],203)+"")&&E(m,c),T&1&&d!==(d=Je(W[0],241)+"")&&E(h,d),T&1&&g!==(g=Je(W[0],242)+"")&&E(w,g),T&1&&R!==(R=Je(W[0],243)+"")&&E(I,R),T&1&&M!==(M=Je(W[0],245)+"")&&E(A,M),T&1&&j!==(j=Je(W[0],200)+"")&&E(Y,j)},d(W){W&&N(e)}}}function lf(t){let e,l,n=Je(t[0],7)+"",i,s,a=Je(t[0],6)+"",r,f,c=Je(t[0],5)+"",m,_,d,h,b=Je(t[0],51)+"",g,w,k=Je(t[0],50)+"",R;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=v(),d=p("optgroup"),h=p("option"),g=C(b),w=p("option"),R=C(k),l.__value=7,H(l,l.__value),s.__value=6,H(s,s.__value),f.__value=5,H(f,f.__value),u(e,"label","amsleser.no"),h.__value=51,H(h,h.__value),w.__value=50,H(w,w.__value),u(d,"label","Generic hardware")},m(I,F){P(I,e,F),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),P(I,_,F),P(I,d,F),o(d,h),o(h,g),o(d,w),o(w,R)},p(I,F){F&1&&n!==(n=Je(I[0],7)+"")&&E(i,n),F&1&&a!==(a=Je(I[0],6)+"")&&E(r,a),F&1&&c!==(c=Je(I[0],5)+"")&&E(m,c),F&1&&b!==(b=Je(I[0],51)+"")&&E(g,b),F&1&&k!==(k=Je(I[0],50)+"")&&E(R,k)},d(I){I&&(N(e),N(_),N(d))}}}function nf(t){let e,l,n=Je(t[0],8)+"",i,s,a,r,f=Je(t[0],71)+"",c,m,_=Je(t[0],70)+"",d;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=v(),a=p("optgroup"),r=p("option"),c=C(f),m=p("option"),d=C(_),l.__value=8,H(l,l.__value),u(e,"label","Custom hardware"),r.__value=71,H(r,r.__value),m.__value=70,H(m,m.__value),u(a,"label","Generic hardware")},m(h,b){P(h,e,b),o(e,l),o(l,i),P(h,s,b),P(h,a,b),o(a,r),o(r,c),o(a,m),o(m,d)},p(h,b){b&1&&n!==(n=Je(h[0],8)+"")&&E(i,n),b&1&&f!==(f=Je(h[0],71)+"")&&E(c,f),b&1&&_!==(_=Je(h[0],70)+"")&&E(d,_)},d(h){h&&(N(e),N(s),N(a))}}}function sf(t){let e,l,n=Je(t[0],200)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=200,H(l,l.__value),u(e,"label","Generic hardware")},m(s,a){P(s,e,a),o(e,l),o(l,i)},p(s,a){a&1&&n!==(n=Je(s[0],200)+"")&&E(i,n)},d(s){s&&N(e)}}}function of(t){let e,l,n=Je(t[0],80)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=80,H(l,l.__value),u(e,"label","Generic hardware")},m(s,a){P(s,e,a),o(e,l),o(l,i)},p(s,a){a&1&&n!==(n=Je(s[0],80)+"")&&E(i,n)},d(s){s&&N(e)}}}function Hc(t){let e,l,n,i,s,a,r,f,c=t[0]=="esp8266"&&ef(t),m=t[0]=="esp32"&&tf(t),_=t[0]=="esp32s2"&&lf(t),d=t[0]=="esp32c3"&&nf(t),h=t[0]=="esp32solo"&&sf(t),b=t[0]=="esp32s3"&&of(t);return{c(){e=p("option"),l=v(),c&&c.c(),n=v(),m&&m.c(),i=v(),_&&_.c(),s=v(),d&&d.c(),a=v(),h&&h.c(),r=v(),b&&b.c(),f=yt(),e.__value=-1,H(e,e.__value)},m(g,w){P(g,e,w),P(g,l,w),c&&c.m(g,w),P(g,n,w),m&&m.m(g,w),P(g,i,w),_&&_.m(g,w),P(g,s,w),d&&d.m(g,w),P(g,a,w),h&&h.m(g,w),P(g,r,w),b&&b.m(g,w),P(g,f,w)},p(g,[w]){g[0]=="esp8266"?c?c.p(g,w):(c=ef(g),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),g[0]=="esp32"?m?m.p(g,w):(m=tf(g),m.c(),m.m(i.parentNode,i)):m&&(m.d(1),m=null),g[0]=="esp32s2"?_?_.p(g,w):(_=lf(g),_.c(),_.m(s.parentNode,s)):_&&(_.d(1),_=null),g[0]=="esp32c3"?d?d.p(g,w):(d=nf(g),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null),g[0]=="esp32solo"?h?h.p(g,w):(h=sf(g),h.c(),h.m(r.parentNode,r)):h&&(h.d(1),h=null),g[0]=="esp32s3"?b?b.p(g,w):(b=of(g),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i:Ye,o:Ye,d(g){g&&(N(e),N(l),N(n),N(i),N(s),N(a),N(r),N(f)),c&&c.d(g),m&&m.d(g),_&&_.d(g),d&&d.d(g),h&&h.d(g),b&&b.d(g)}}}function yc(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class zc extends Tt{constructor(e){super(),Pt(this,e,yc,Hc,Nt,{chip:0})}}function af(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){P(l,e,n)},d(l){l&&N(e)}}}function ff(t){let e,l,n,i,s,a,r;return a=new Bi({props:{chip:t[0].chip}}),{c(){e=p("div"),l=C("HAN GPIO"),n=p("br"),i=v(),s=p("select"),Ne(a.$$.fragment),u(s,"name","vh"),u(s,"class","in-s"),u(e,"class","my-3")},m(f,c){P(f,e,c),o(e,l),o(e,n),o(e,i),o(e,s),Se(a,s,null),r=!0},p(f,c){const m={};c&1&&(m.chip=f[0].chip),a.$set(m)},i(f){r||(Z(a.$$.fragment,f),r=!0)},o(f){ie(a.$$.fragment,f),r=!1},d(f){f&&N(e),Me(a)}}}function Wc(t){let e,l,n,i,s,a,r,f,c,m,_,d,h,b,g,w,k,R,I,F,M,A,O,j,Y,W,T,B,X,y=t[0].usrcfg&&af();b=new zc({props:{chip:t[0].chip}});let K=t[0].board&&t[0].board>20&&ff(t);return W=new rl({props:{active:t[1],message:"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),s=v(),a=p("strong"),a.textContent="Initial configuration",r=v(),y&&y.c(),f=v(),c=p("div"),m=C("Board type"),_=p("br"),d=v(),h=p("select"),Ne(b.$$.fragment),g=v(),K&&K.c(),w=v(),k=p("div"),R=p("label"),I=p("input"),F=C(" Clear all other configuration"),M=v(),A=p("div"),A.innerHTML='',O=v(),j=p("span"),j.textContent=" ",Y=v(),Ne(W.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(a,"class","text-sm"),u(h,"name","vb"),u(h,"class","in-s"),t[0].board===void 0&&At(()=>t[5].call(h)),u(c,"class","my-3"),u(I,"type","checkbox"),u(I,"name","vr"),I.__value="true",H(I,I.__value),u(I,"class","rounded mb-1"),u(k,"class","my-3"),u(A,"class","my-3"),u(j,"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(V,U){P(V,e,U),o(e,l),o(l,n),o(n,i),o(n,s),o(n,a),o(n,r),y&&y.m(n,null),o(n,f),o(n,c),o(c,m),o(c,_),o(c,d),o(c,h),Se(b,h,null),Ke(h,t[0].board,!0),o(n,g),K&&K.m(n,null),o(n,w),o(n,k),o(k,R),o(R,I),I.checked=t[2],o(R,F),o(n,M),o(n,A),o(n,O),o(n,j),P(V,Y,U),Se(W,V,U),T=!0,B||(X=[ce(h,"change",t[5]),ce(I,"change",t[6]),ce(n,"submit",pn(t[3]))],B=!0)},p(V,[U]){V[0].usrcfg?y||(y=af(),y.c(),y.m(n,f)):y&&(y.d(1),y=null);const G={};U&1&&(G.chip=V[0].chip),b.$set(G),U&1&&Ke(h,V[0].board),V[0].board&&V[0].board>20?K?(K.p(V,U),U&1&&Z(K,1)):(K=ff(V),K.c(),Z(K,1),K.m(n,w)):K&&(vt(),ie(K,1,1,()=>{K=null}),bt()),U&4&&(I.checked=V[2]);const se={};U&2&&(se.active=V[1]),W.$set(se)},i(V){T||(Z(b.$$.fragment,V),Z(K),Z(W.$$.fragment,V),T=!0)},o(V){ie(b.$$.fragment,V),ie(K),ie(W.$$.fragment,V),T=!1},d(V){V&&(N(e),N(Y)),y&&y.d(),Me(b),K&&K.d(),Me(W,V),B=!1,jt(X)}}}function Gc(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,s=!1;async function a(m){l(1,s=!0);const _=new FormData(m.target),d=new URLSearchParams;for(let g of _){const[w,k]=g;d.append(w,k)}let b=await(await fetch("save",{method:"POST",body:d})).json();l(1,s=!1),cl.update(g=>(g.vndcfg=b.success,g.booting=b.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),sn(n+(i.usrcfg?"":"setup"))}let r=!0;cl.subscribe(m=>{l(0,i=m),m.fwconsent===1&&l(2,r=!i.usrcfg)});function f(){i.board=Vt(this),l(0,i)}function c(){r=this.checked,l(2,r)}return t.$$set=m=>{"basepath"in m&&l(4,n=m.basepath),"sysinfo"in m&&l(0,i=m.sysinfo)},[i,s,r,a,n,f,c]}class Vc extends Tt{constructor(e){super(),Pt(this,e,Gc,Wc,Nt,{basepath:4,sysinfo:0})}}function uf(t,e,l){const n=t.slice();return n[13]=e[l],n}function rf(t){var i,s;let e,l=(((s=(i=t[1].conf)==null?void 0:i.connection)==null?void 0:s.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=C(l),e.__value=3,H(e,e.__value)},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r&2&&l!==(l=(((c=(f=a[1].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&E(n,l)},d(a){a&&N(e)}}}function cf(t){var j,Y,W,T;let e,l=(((Y=(j=t[1].conf)==null?void 0:j.connection)==null?void 0:Y.ssid)??"SSID")+"",n,i,s,a,r,f,c,m,_,d,h=(((T=(W=t[1].conf)==null?void 0:W.connection)==null?void 0:T.psk)??"Password")+"",b,g,w,k,R,I,F;function M(B,X){return B[2]?Yc:Kc}let A=M(t),O=A(t);return{c(){e=p("div"),n=C(l),i=v(),s=p("label"),a=p("input"),r=C(" manual"),f=v(),c=p("br"),m=v(),O.c(),_=v(),d=p("div"),b=C(h),g=p("br"),w=v(),k=p("input"),u(a,"type","checkbox"),a.__value="true",H(a,a.__value),u(a,"class","rounded mb-1"),u(s,"class","float-right mr-3"),u(e,"class","my-3"),u(k,"name","sp"),u(k,"type","password"),u(k,"pattern",Mn),u(k,"class","in-s"),u(k,"autocomplete","off"),k.required=R=t[5]==2,u(d,"class","my-3")},m(B,X){P(B,e,X),o(e,n),o(e,i),o(e,s),o(s,a),a.checked=t[2],o(s,r),o(e,f),o(e,c),o(e,m),O.m(e,null),P(B,_,X),P(B,d,X),o(d,b),o(d,g),o(d,w),o(d,k),I||(F=ce(a,"change",t[9]),I=!0)},p(B,X){var y,K,V,U;X&2&&l!==(l=(((K=(y=B[1].conf)==null?void 0:y.connection)==null?void 0:K.ssid)??"SSID")+"")&&E(n,l),X&4&&(a.checked=B[2]),A===(A=M(B))&&O?O.p(B,X):(O.d(1),O=A(B),O&&(O.c(),O.m(e,null))),X&2&&h!==(h=(((U=(V=B[1].conf)==null?void 0:V.connection)==null?void 0:U.psk)??"Password")+"")&&E(b,h),X&32&&R!==(R=B[5]==2)&&(k.required=R)},d(B){B&&(N(e),N(_),N(d)),O.d(),I=!1,F()}}}function Kc(t){var a,r;let e,l,n,i=((a=t[3])==null?void 0:a.c)==-1&&_f(),s=((r=t[3])==null?void 0:r.n)&&mf(t);return{c(){e=p("select"),i&&i.c(),l=yt(),s&&s.c(),u(e,"name","ss"),u(e,"class","in-s"),e.required=n=t[5]==1||t[5]==2},m(f,c){P(f,e,c),i&&i.m(e,null),o(e,l),s&&s.m(e,null)},p(f,c){var m,_;((m=f[3])==null?void 0:m.c)==-1?i||(i=_f(),i.c(),i.m(e,l)):i&&(i.d(1),i=null),(_=f[3])!=null&&_.n?s?s.p(f,c):(s=mf(f),s.c(),s.m(e,null)):s&&(s.d(1),s=null),c&32&&n!==(n=f[5]==1||f[5]==2)&&(e.required=n)},d(f){f&&N(e),i&&i.d(),s&&s.d()}}}function Yc(t){let e,l;return{c(){e=p("input"),u(e,"name","ss"),u(e,"type","text"),u(e,"pattern",Mn),u(e,"class","in-s"),e.required=l=t[5]==1||t[5]==2},m(n,i){P(n,e,i)},p(n,i){i&32&&l!==(l=n[5]==1||n[5]==2)&&(e.required=l)},d(n){n&&N(e)}}}function _f(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",H(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function mf(t){var i;let e,l=rt((i=t[3])==null?void 0:i.n),n=[];for(let s=0;st[8].call(g)),u(m,"class","my-3"),u(B,"name","sh"),u(B,"type","text"),u(B,"class","in-s"),u(B,"maxlength","32"),u(B,"pattern",Vn),u(B,"placeholder","Optional, ex.: ams-reader"),u(B,"autocomplete","off"),u(V,"type","checkbox"),u(V,"name","sm"),V.__value="static",H(V,V.__value),u(V,"class","rounded mb-1"),u(y,"class","my-3"),u(ue,"type","submit"),u(ue,"class","btn-pri"),u(re,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(De,Ue){P(De,e,Ue),o(e,l),o(l,n),o(n,i),o(n,s),o(n,a),o(a,f),o(n,c),o(n,m),o(m,d),o(m,h),o(m,b),o(m,g),o(g,w),o(w,R),o(g,I),o(I,M),D&&D.m(g,null),Ke(g,t[5],!0),o(n,A),S&&S.m(n,null),o(n,O),o(n,j),o(j,W),o(j,T),o(j,B),H(B,t[0].hostname),o(n,X),o(n,y),o(y,K),o(K,V),V.checked=t[4],o(K,U),o(K,se),o(y,le),L&&L.m(y,null),o(n,Q),q&&q.m(n,null),o(n,ae),o(n,re),o(re,ue),o(ue,pe),P(De,oe,Ue),Se(J,De,Ue),$=!0,ke||(Ce=[ce(g,"change",t[8]),ce(B,"input",t[10]),ce(V,"change",t[11]),ce(n,"submit",pn(t[7]))],ke=!0)},p(De,[Ue]){var Ct,tt,ot,Mt,ht,at,it,ft,Lt,We,Re,He;(!$||Ue&2)&&r!==(r=(((Ct=De[1].setup)==null?void 0:Ct.title)??"Setup")+"")&&E(f,r),(!$||Ue&2)&&_!==(_=(((ot=(tt=De[1].conf)==null?void 0:tt.connection)==null?void 0:ot.title)??"Connection")+"")&&E(d,_),(!$||Ue&2)&&k!==(k=(((ht=(Mt=De[1].conf)==null?void 0:Mt.connection)==null?void 0:ht.wifi)??"Connect to WiFi")+"")&&E(R,k),(!$||Ue&2)&&F!==(F=(((it=(at=De[1].conf)==null?void 0:at.connection)==null?void 0:it.ap)??"Standalone access point")+"")&&E(M,F),De[0].if&&De[0].if.eth?D?D.p(De,Ue):(D=rf(De),D.c(),D.m(g,null)):D&&(D.d(1),D=null),Ue&32&&Ke(g,De[5]),De[5]==1||De[5]==2?S?S.p(De,Ue):(S=cf(De),S.c(),S.m(n,O)):S&&(S.d(1),S=null),(!$||Ue&2)&&Y!==(Y=(((Lt=(ft=De[1].conf)==null?void 0:ft.general)==null?void 0:Lt.hostname)??"Hostname")+"")&&E(W,Y),Ue&1&&B.value!==De[0].hostname&&H(B,De[0].hostname),Ue&16&&(V.checked=De[4]),(!$||Ue&2)&&G!==(G=(((We=De[1].setup)==null?void 0:We.static)??"Static IP")+"")&&E(se,G),De[4]?L?(L.p(De,Ue),Ue&16&&Z(L,1)):(L=df(De),L.c(),Z(L,1),L.m(y,null)):L&&(vt(),ie(L,1,1,()=>{L=null}),bt()),De[4]?q?q.p(De,Ue):(q=hf(De),q.c(),q.m(n,ae)):q&&(q.d(1),q=null),(!$||Ue&2)&&ne!==(ne=(((Re=De[1].btn)==null?void 0:Re.save)??"Save")+"")&&E(pe,ne);const xe={};Ue&64&&(xe.active=De[6]),Ue&2&&(xe.message=((He=De[1].setup)==null?void 0:He.mask)??"Saving"),J.$set(xe)},i(De){$||(Z(L),Z(J.$$.fragment,De),$=!0)},o(De){ie(L),ie(J.$$.fragment,De),$=!1},d(De){De&&(N(e),N(oe)),D&&D.d(),S&&S.d(),L&&L.d(),q&&q.d(),Me(J,De),ke=!1,jt(Ce)}}}function Xc(t,e,l){let n={};bl.subscribe(w=>{l(1,n=w)});let i=!1,s={};$i.subscribe(w=>{l(3,s=w)});let{sysinfo:a={}}=e,r=!1,f=1,c=!1;function m(w){cl.update(k=>(k.trying=w,k))}async function _(w){l(6,c=!0);const k=new FormData(w.target),R=new URLSearchParams;for(let M of k){const[A,O]=M;R.append(A,O)}let F=await(await fetch("save",{method:"POST",body:R})).json();l(6,c=!1),cl.update(M=>(M.hostname=k.get("sh"),M.usrcfg=F.success,M.booting=F.reboot,r&&(M.net.ip=k.get("si"),M.net.mask=k.get("su"),M.net.gw=k.get("sg"),M.net.dns1=k.get("sd")),F.reboot&&setTimeout(Wn,5e3,a,m),M))}function d(){f=Vt(this),l(5,f)}function h(){i=this.checked,l(2,i)}function b(){a.hostname=this.value,l(0,a)}function g(){r=this.checked,l(4,r)}return t.$$set=w=>{"sysinfo"in w&&l(0,a=w.sysinfo)},[a,n,i,s,r,f,c,_,d,h,b,g]}class Zc extends Tt{constructor(e){super(),Pt(this,e,Xc,Qc,Nt,{sysinfo:0})}}function Jc(t){var W,T,B,X;let e,l,n,i=(((W=t[2].upload)==null?void 0:W.title)??"Upload")+"",s,a,r,f,c,m=(((T=t[2].upload)==null?void 0:T.desc)??"")+"",_,d,h,b,g,w,k,R,I=(((B=t[2].btn)==null?void 0:B.upload)??"Upload")+"",F,M,A,O,j,Y;return A=new rl({props:{active:t[3],message:((X=t[2].upload)==null?void 0:X.mask)??"Uploading"}}),{c(){e=p("div"),l=p("div"),n=p("strong"),s=C(i),a=v(),r=C(t[1]),f=v(),c=p("p"),_=C(m),d=v(),h=p("form"),b=p("input"),g=v(),w=p("div"),k=p("button"),R=p("p"),F=C(I),M=v(),Ne(A.$$.fragment),u(c,"class","mb-4"),u(b,"name","file"),u(b,"type","file"),u(R,"class","mb-4"),u(k,"type","submit"),u(k,"class","btn-pri"),u(w,"class","w-full text-right mt-4"),u(h,"action",t[0]),u(h,"enctype","multipart/form-data"),u(h,"method","post"),u(h,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(y,K){P(y,e,K),o(e,l),o(l,n),o(n,s),o(n,a),o(n,r),o(l,f),o(l,c),o(c,_),o(l,d),o(l,h),o(h,b),o(h,g),o(h,w),o(w,k),o(k,R),o(R,F),P(y,M,K),Se(A,y,K),O=!0,j||(Y=ce(h,"submit",t[4]),j=!0)},p(y,[K]){var U,G,se,le;(!O||K&4)&&i!==(i=(((U=y[2].upload)==null?void 0:U.title)??"Upload")+"")&&E(s,i),(!O||K&2)&&E(r,y[1]),(!O||K&4)&&m!==(m=(((G=y[2].upload)==null?void 0:G.desc)??"")+"")&&E(_,m),(!O||K&4)&&I!==(I=(((se=y[2].btn)==null?void 0:se.upload)??"Upload")+"")&&E(F,I),(!O||K&1)&&u(h,"action",y[0]);const V={};K&8&&(V.active=y[3]),K&4&&(V.message=((le=y[2].upload)==null?void 0:le.mask)??"Uploading"),A.$set(V)},i(y){O||(Z(A.$$.fragment,y),O=!0)},o(y){ie(A.$$.fragment,y),O=!1},d(y){y&&(N(e),N(M)),Me(A,y),j=!1,Y()}}}function $c(t,e,l){let{action:n}=e,{title:i}=e,s={};bl.subscribe(f=>{l(2,s=f)});let a=!1;const r=()=>l(3,a=!0);return t.$$set=f=>{"action"in f&&l(0,n=f.action),"title"in f&&l(1,i=f.title)},[n,i,s,a,r]}class ls extends Tt{constructor(e){super(),Pt(this,e,$c,Jc,Nt,{action:0,title:1})}}function xc(t){var J,$,ke,Ce,D,S,L;let e,l,n,i,s=(((J=t[1].consent)==null?void 0:J.title)??"Consents")+"",a,r,f,c,m,_=((($=t[1].consent)==null?void 0:$.one_click)??"One-click")+"",d,h,b,g,w=(((ke=t[1].consent)==null?void 0:ke.read_more)??"Read more")+"",k,R,I,F,M,A,O,j=(((Ce=t[1].consent)==null?void 0:Ce.yes)??"Yes")+"",Y,W,T,B,X,y,K=(((D=t[1].consent)==null?void 0:D.no)??"No")+"",V,U,G,se,le,Q=(((S=t[1].btn)==null?void 0:S.save)??"Save")+"",ae,re,ue,ne,pe,oe;return ue=new rl({props:{active:t[2],message:((L=t[1].consent)==null?void 0:L.mask_saving)??"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("div"),a=C(s),r=v(),f=p("hr"),c=v(),m=p("div"),d=C(_),h=p("br"),b=v(),g=p("a"),k=C(w),R=p("br"),I=v(),F=p("label"),M=p("input"),O=v(),Y=C(j),W=v(),T=p("label"),B=p("input"),y=v(),V=C(K),U=p("br"),G=v(),se=p("div"),le=p("button"),ae=C(Q),re=v(),Ne(ue.$$.fragment),u(g,"href",_l("Data-collection-on-one-click-firmware-upgrade")),u(g,"target","_blank"),u(g,"class","text-blue-600 hover:text-blue-800"),u(M,"type","radio"),u(M,"name","sf"),M.value=1,M.checked=A=t[0].fwconsent===1,u(M,"class","rounded m-2"),M.required=!0,u(B,"type","radio"),u(B,"name","sf"),B.value=2,B.checked=X=t[0].fwconsent===2,u(B,"class","rounded m-2"),B.required=!0,u(m,"class","my-3"),u(le,"type","submit"),u(le,"class","btn-pri"),u(se,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(q,z){P(q,e,z),o(e,l),o(l,n),o(n,i),o(i,a),o(n,r),o(n,f),o(n,c),o(n,m),o(m,d),o(m,h),o(m,b),o(m,g),o(g,k),o(m,R),o(m,I),o(m,F),o(F,M),o(F,O),o(F,Y),o(m,W),o(m,T),o(T,B),o(T,y),o(T,V),o(m,U),o(n,G),o(n,se),o(se,le),o(le,ae),P(q,re,z),Se(ue,q,z),ne=!0,pe||(oe=ce(n,"submit",pn(t[3])),pe=!0)},p(q,[z]){var fe,_e,de,x,he,be,Ae;(!ne||z&2)&&s!==(s=(((fe=q[1].consent)==null?void 0:fe.title)??"Consents")+"")&&E(a,s),(!ne||z&2)&&_!==(_=(((_e=q[1].consent)==null?void 0:_e.one_click)??"One-click")+"")&&E(d,_),(!ne||z&2)&&w!==(w=(((de=q[1].consent)==null?void 0:de.read_more)??"Read more")+"")&&E(k,w),(!ne||z&1&&A!==(A=q[0].fwconsent===1))&&(M.checked=A),(!ne||z&2)&&j!==(j=(((x=q[1].consent)==null?void 0:x.yes)??"Yes")+"")&&E(Y,j),(!ne||z&1&&X!==(X=q[0].fwconsent===2))&&(B.checked=X),(!ne||z&2)&&K!==(K=(((he=q[1].consent)==null?void 0:he.no)??"No")+"")&&E(V,K),(!ne||z&2)&&Q!==(Q=(((be=q[1].btn)==null?void 0:be.save)??"Save")+"")&&E(ae,Q);const ee={};z&4&&(ee.active=q[2]),z&2&&(ee.message=((Ae=q[1].consent)==null?void 0:Ae.mask_saving)??"Saving"),ue.$set(ee)},i(q){ne||(Z(ue.$$.fragment,q),ne=!0)},o(q){ie(ue.$$.fragment,q),ne=!1},d(q){q&&(N(e),N(re)),Me(ue,q),pe=!1,oe()}}}function e_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,s={};bl.subscribe(f=>{l(1,s=f)});let a=!1;async function r(f){l(2,a=!0);const c=new FormData(f.target),m=new URLSearchParams;for(let h of c){const[b,g]=h;m.append(b,g)}let d=await(await fetch("save",{method:"POST",body:m})).json();l(2,a=!1),cl.update(h=>(h.fwconsent=c.sf===!0?1:c.sf===!1?2:0,h.booting=d.reboot,h)),sn(n)}return t.$$set=f=>{"basepath"in f&&l(4,n=f.basepath),"sysinfo"in f&&l(0,i=f.sysinfo)},[i,s,a,r,n]}class t_ extends Tt{constructor(e){super(),Pt(this,e,e_,xc,Nt,{basepath:4,sysinfo:0})}}function vf(t,e,l){const n=t.slice();return n[30]=e[l],n[31]=e,n[32]=l,n}function bf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function l_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function gf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function n_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function kf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function wf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Cf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Sf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Mf(t){let e,l=rt(t[1].o),n=[];for(let i=0;i0?"text-green-600":"text-gray-300"),u(xe,"class",tt=t[32]{l(0,i=U)});let s=["mo","tu","we","th","fr","sa","su"],a={},r=!0,f=!1;Du.subscribe(U=>{U.o&&(l(1,a=U),l(2,r=!1))}),y0();async function c(U){l(3,f=!0);const G=new URLSearchParams;G.append("r","true"),G.append("rc",a.o.length),a.o.forEach(function(le,Q){G.append("rt"+Q,le.t),G.append("rn"+Q,le.n),G.append("rd"+Q,le.d),G.append("ra"+Q,le.a),G.append("rh"+Q,le.h),G.append("rv"+Q,le.v),G.append("rsm"+Q,le.s.m),G.append("rsd"+Q,le.s.d),G.append("rem"+Q,le.e.m),G.append("red"+Q,le.e.d)}),await(await fetch("save",{method:"POST",body:G})).json(),l(3,f=!1),sn(n+"configuration")}let m=function(U,G){return U.includes(G)?U=U.filter(function(se){return se!==G}):U.push(G),U},_=function(){let U=a.o;U.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),l(1,a.o=U,a)},d=function(U){let G=a.o;G.splice(U,1),l(1,a.o=G,a)},h=function(U){if(U<=0)return;let G=a.o;var se=G[U];G[U]=G[U-1],G[U-1]=se,l(1,a.o=G,a)},b=function(U){let G=a.o;if(!(U>=G.length-1)){var se=G[U];G[U]=G[U+1],G[U+1]=se,l(1,a.o=G,a)}};function g(U,G){U[G].n=this.value,l(1,a)}function w(U,G){U[G].d=Vt(this),l(1,a)}function k(U,G){U[G].t=Vt(this),l(1,a)}function R(U,G){U[G].v=ye(this.value),l(1,a)}const I=(U,G,se,le)=>l(1,se[le].a=m(U.a,G),a),F=(U,G,se,le)=>l(1,se[le].h=m(U.h,G),a),M=(U,G,se,le)=>l(1,se[le].h=m(U.h,G+8),a),A=(U,G,se,le)=>l(1,se[le].h=m(U.h,G+16),a);function O(U,G){U[G].s.d=Vt(this),l(1,a)}function j(U,G){U[G].s.m=Vt(this),l(1,a)}function Y(U,G){U[G].e.d=Vt(this),l(1,a)}function W(U,G){U[G].e.m=Vt(this),l(1,a)}const T=U=>h(U),B=U=>h(U),X=U=>b(U),y=U=>b(U),K=U=>d(U),V=U=>d(U);return t.$$set=U=>{"basepath"in U&&l(11,n=U.basepath)},[i,a,r,f,s,c,m,_,d,h,b,n,g,w,k,R,I,F,M,A,O,j,Y,W,T,B,X,y,K,V]}class f_ extends Tt{constructor(e){super(),Pt(this,e,a_,o_,Nt,{basepath:11},null,[-1,-1])}}function Of(t,e,l){const n=t.slice();return n[13]=e[l],n[14]=e,n[15]=l,n}function Lf(t,e,l){const n=t.slice();return n[13]=e[l],n[16]=e,n[17]=l,n}function If(t){let e,l,n,i=rt(t[1]),s=[];for(let a=0;a{l(3,r=w)});let f=!1,c,m;async function _(){if(confirm("Clear all data?"))for(let w in i)(w.startsWith("i")||w.startsWith("e"))&&l(0,i[w]=0,i)}let d=!1;async function h(w){l(5,d=!0);const k=new FormData(w.target),R=new URLSearchParams;for(let F of k){const[M,A]=F;R.append(M,A)}await(await fetch(s,{method:"POST",body:R})).json(),l(5,d=!1),sn(a)}function b(w){i[w.key]=ye(this.value),l(0,i)}function g(w){i[w.key]=ye(this.value),l(0,i)}return t.$$set=w=>{"prefix"in w&&l(8,n=w.prefix),"data"in w&&l(0,i=w.data),"url"in w&&l(9,s=w.url),"basepath"in w&&l(10,a=w.basepath)},t.$$.update=()=>{if(t.$$.dirty&263){l(1,c=[]),l(2,m=[]);for(let w in i){let k=[];w.startsWith("i")?k=c:w.startsWith("e")&&(k=m,i[w]&&l(4,f=!0)),k.push({key:w,name:n+" "+w.substring(1),value:i[w]})}}},[i,c,m,r,f,d,_,h,n,s,a,b,g]}class Lu extends Tt{constructor(e){super(),Pt(this,e,r_,u_,Nt,{prefix:8,data:0,url:9,basepath:10})}}function c_(t){let e,l;return e=new j0({props:{data:t[6],sysinfo:t[7],prices:t[1],dayPlot:t[2],monthPlot:t[3],temperatures:t[4],translations:t[5],tariffData:t[8]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.data=n[6]),i&128&&(s.sysinfo=n[7]),i&2&&(s.prices=n[1]),i&4&&(s.dayPlot=n[2]),i&8&&(s.monthPlot=n[3]),i&16&&(s.temperatures=n[4]),i&32&&(s.translations=n[5]),i&256&&(s.tariffData=n[8]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function __(t){let e,l;return e=new Tc({props:{sysinfo:t[7],basepath:t[0],data:t[6]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&1&&(s.basepath=n[0]),i&64&&(s.data=n[6]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function m_(t){let e,l;return e=new f_({props:{basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function p_(t){let e,l;return e=new jc({props:{sysinfo:t[7],data:t[6]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&64&&(s.data=n[6]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function d_(t){let e,l;return e=new ls({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function h_(t){let e,l;return e=new ls({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function v_(t){let e,l;return e=new ls({props:{title:"private key",action:"/mqtt-key"}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function b_(t){let e,l;return e=new t_({props:{sysinfo:t[7],basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function g_(t){let e,l;return e=new Zc({props:{sysinfo:t[7]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function k_(t){let e,l;return e=new Vc({props:{sysinfo:t[7],basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function w_(t){let e,l;return e=new Lu({props:{prefix:"UTC Hour",data:t[2],url:"/dayplot",basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&4&&(s.data=n[2]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function C_(t){let e,l;return e=new Lu({props:{prefix:"Day",data:t[3],url:"/monthplot",basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&8&&(s.data=n[3]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function S_(t){let e,l,n,i,s,a,r,f,c,m,_,d,h,b,g,w,k,R,I,F,M,A,O,j,Y,W;return e=new z1({props:{data:t[6],basepath:t[0]}}),n=new dl({props:{path:"/",$$slots:{default:[c_]},$$scope:{ctx:t}}}),s=new dl({props:{path:"/configuration",$$slots:{default:[__]},$$scope:{ctx:t}}}),r=new dl({props:{path:"/priceconfig",$$slots:{default:[m_]},$$scope:{ctx:t}}}),c=new dl({props:{path:"/status",$$slots:{default:[p_]},$$scope:{ctx:t}}}),_=new dl({props:{path:"/mqtt-ca",$$slots:{default:[d_]},$$scope:{ctx:t}}}),h=new dl({props:{path:"/mqtt-cert",$$slots:{default:[h_]},$$scope:{ctx:t}}}),g=new dl({props:{path:"/mqtt-key",$$slots:{default:[v_]},$$scope:{ctx:t}}}),k=new dl({props:{path:"/consent",$$slots:{default:[b_]},$$scope:{ctx:t}}}),I=new dl({props:{path:"/setup",$$slots:{default:[g_]},$$scope:{ctx:t}}}),M=new dl({props:{path:"/vendor",$$slots:{default:[k_]},$$scope:{ctx:t}}}),O=new dl({props:{path:"/edit-day",$$slots:{default:[w_]},$$scope:{ctx:t}}}),Y=new dl({props:{path:"/edit-month",$$slots:{default:[C_]},$$scope:{ctx:t}}}),{c(){Ne(e.$$.fragment),l=v(),Ne(n.$$.fragment),i=v(),Ne(s.$$.fragment),a=v(),Ne(r.$$.fragment),f=v(),Ne(c.$$.fragment),m=v(),Ne(_.$$.fragment),d=v(),Ne(h.$$.fragment),b=v(),Ne(g.$$.fragment),w=v(),Ne(k.$$.fragment),R=v(),Ne(I.$$.fragment),F=v(),Ne(M.$$.fragment),A=v(),Ne(O.$$.fragment),j=v(),Ne(Y.$$.fragment)},m(T,B){Se(e,T,B),P(T,l,B),Se(n,T,B),P(T,i,B),Se(s,T,B),P(T,a,B),Se(r,T,B),P(T,f,B),Se(c,T,B),P(T,m,B),Se(_,T,B),P(T,d,B),Se(h,T,B),P(T,b,B),Se(g,T,B),P(T,w,B),Se(k,T,B),P(T,R,B),Se(I,T,B),P(T,F,B),Se(M,T,B),P(T,A,B),Se(O,T,B),P(T,j,B),Se(Y,T,B),W=!0},p(T,B){const X={};B&64&&(X.data=T[6]),B&1&&(X.basepath=T[0]),e.$set(X);const y={};B&2558&&(y.$$scope={dirty:B,ctx:T}),n.$set(y);const K={};B&2241&&(K.$$scope={dirty:B,ctx:T}),s.$set(K);const V={};B&2049&&(V.$$scope={dirty:B,ctx:T}),r.$set(V);const U={};B&2240&&(U.$$scope={dirty:B,ctx:T}),c.$set(U);const G={};B&2048&&(G.$$scope={dirty:B,ctx:T}),_.$set(G);const se={};B&2048&&(se.$$scope={dirty:B,ctx:T}),h.$set(se);const le={};B&2048&&(le.$$scope={dirty:B,ctx:T}),g.$set(le);const Q={};B&2177&&(Q.$$scope={dirty:B,ctx:T}),k.$set(Q);const ae={};B&2176&&(ae.$$scope={dirty:B,ctx:T}),I.$set(ae);const re={};B&2177&&(re.$$scope={dirty:B,ctx:T}),M.$set(re);const ue={};B&2053&&(ue.$$scope={dirty:B,ctx:T}),O.$set(ue);const ne={};B&2057&&(ne.$$scope={dirty:B,ctx:T}),Y.$set(ne)},i(T){W||(Z(e.$$.fragment,T),Z(n.$$.fragment,T),Z(s.$$.fragment,T),Z(r.$$.fragment,T),Z(c.$$.fragment,T),Z(_.$$.fragment,T),Z(h.$$.fragment,T),Z(g.$$.fragment,T),Z(k.$$.fragment,T),Z(I.$$.fragment,T),Z(M.$$.fragment,T),Z(O.$$.fragment,T),Z(Y.$$.fragment,T),W=!0)},o(T){ie(e.$$.fragment,T),ie(n.$$.fragment,T),ie(s.$$.fragment,T),ie(r.$$.fragment,T),ie(c.$$.fragment,T),ie(_.$$.fragment,T),ie(h.$$.fragment,T),ie(g.$$.fragment,T),ie(k.$$.fragment,T),ie(I.$$.fragment,T),ie(M.$$.fragment,T),ie(O.$$.fragment,T),ie(Y.$$.fragment,T),W=!1},d(T){T&&(N(l),N(i),N(a),N(f),N(m),N(d),N(b),N(w),N(R),N(F),N(A),N(j)),Me(e,T),Me(n,T),Me(s,T),Me(r,T),Me(c,T),Me(_,T),Me(h,T),Me(g,T),Me(k,T),Me(I,T),Me(M,T),Me(O,T),Me(Y,T)}}}function Bf(t){let e,l,n,i;const s=[N_,M_],a=[];function r(f,c){return f[7].trying?0:1}return e=r(t),l=a[e]=s[e](t),{c(){l.c(),n=yt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(vt(),ie(a[m],1,1,()=>{a[m]=null}),bt(),l=a[e],l?l.p(f,c):(l=a[e]=s[e](f),l.c()),Z(l,1),l.m(n.parentNode,n))},i(f){i||(Z(l),i=!0)},o(f){ie(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function M_(t){let e,l;return e=new rl({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function N_(t){let e,l;return e=new rl({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[7].trying}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.message="Device is booting, please wait. Trying to reach it on "+n[7].trying),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function P_(t){let e,l,n,i;l=new cu({props:{basepath:t[0],$$slots:{default:[S_]},$$scope:{ctx:t}}});let s=t[7].booting&&Bf(t);return{c(){e=p("div"),Ne(l.$$.fragment),n=v(),s&&s.c(),u(e,"class","container mx-auto m-3")},m(a,r){P(a,e,r),Se(l,e,null),o(e,n),s&&s.m(e,null),i=!0},p(a,[r]){const f={};r&1&&(f.basepath=a[0]),r&2559&&(f.$$scope={dirty:r,ctx:a}),l.$set(f),a[7].booting?s?(s.p(a,r),r&128&&Z(s,1)):(s=Bf(a),s.c(),Z(s,1),s.m(e,null)):s&&(vt(),ie(s,1,1,()=>{s=null}),bt())},i(a){i||(Z(l.$$.fragment,a),Z(s),i=!0)},o(a){ie(l.$$.fragment,a),ie(s),i=!1},d(a){a&&N(e),Me(l),s&&s.d()}}}function T_(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i;Ji.subscribe(b=>{l(1,i=b)});let s;ku.subscribe(b=>{l(2,s=b)});let a;wu.subscribe(b=>{l(3,a=b)});let r;Cu.subscribe(b=>{l(4,r=b)});let f={};bl.subscribe(b=>{l(5,f=b)});let c,m={},_={},d;cl.subscribe(b=>{var g;l(7,_=b),_.vndcfg===!1?sn(n+"vendor"):_.usrcfg===!1?sn(n+"setup"):_.fwconsent===0&&sn(n+"consent"),_.ui.k===1?document.documentElement.classList.add("dark"):_.ui.k===0?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),_.ui.lang&&_.ui.lang!=((g=f==null?void 0:f.language)==null?void 0:g.code)&&Nu(_.ui.lang),_.version&&d&&_.version!=d&&window.location.reload(),d=_.version,c&&clearTimeout(c),c=setTimeout(ci,!m||!m.u||m.u<30||_!=null&&_.upgrading?1e4:3e5)}),f1.subscribe(b=>{l(6,m=b),E0(b)});let h={};return Mu.subscribe(b=>{l(8,h=b)}),Su(),[n,i,s,a,r,f,m,_,h]}class q_ extends Tt{constructor(e){super(),Pt(this,e,T_,P_,Nt,{})}}new q_({target:document.getElementById("app")}); +Occurred in: ${i}`:"",a=Qi(t),r=Vf(e)?e(a):e;return`<${a}> ${r}${s}`}const su=t=>(...e)=>t(cr(...e)),ou=su(t=>{throw new Error(t)}),fi=su(console.warn),as=4,_r=3,mr=2,pr=1,dr=1;function hr(t,e){const l=t.default?0:Tl(t.fullPath).reduce((n,i)=>{let s=n;return s+=as,lr(i)?s+=dr:nr(i)?s+=mr:xf(i)?s-=as+pr:s+=_r,s},0);return{route:t,score:l,index:e}}function vr(t){return t.map(hr).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function au(t,e){let l,n;const[i]=e.split("?"),s=Tl(i),a=s[0]==="",r=vr(t);for(let f=0,c=r.length;f({...m,params:d,uri:k});if(m.default){n=h(e);continue}const b=Tl(m.fullPath),g=Math.max(s.length,b.length);let w=0;for(;w{c===".."?f.pop():c!=="."&&f.push(c)}),pi(`/${f.join("/")}`,n)}function fs(t,e){const{pathname:l,hash:n="",search:i="",state:s}=t,a=Tl(e,!0),r=Tl(l,!0);for(;a.length;)a[0]!==r[0]&&ou(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),r.shift();return{pathname:Qn(...r),hash:n,search:i,state:s}}const us=t=>t.length===1?"":t,Xi=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,s=i?us(Rn(t,l)):"",a=i?Rn(t,0,l):t,r=n?us(Rn(a,e)):"";return{pathname:(n?Rn(a,0,e):a)||"/",search:r,hash:s}},gr=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function kr(t,e,l){return Qn(l,br(t,e))}function wr(t,e){const l=Ki(ir(t)),n=Tl(l,!0),i=Tl(e,!0).slice(0,n.length),s=fu({fullPath:l},Qn(...i));return s&&s.uri}const di="POP",Cr="PUSH",Sr="REPLACE";function hi(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function Mr(t){let e=[],l=hi(t),n=di;const i=(s=e)=>s.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(s){e.push(s);const a=()=>{l=hi(t),n=di,i([s])};i([s]);const r=Qf(t,"popstate",a);return()=>{r(),e=e.filter(f=>f!==s)}},navigate(s,a){const{state:r={},replace:f=!1}=a||{};if(n=f?Sr:Cr,Kf(s))a&&fi(iu,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=di,t.history.go(s);else{const c={...r,_key:$u()};try{t.history[f?"replaceState":"pushState"](c,"",s)}catch{t.location[f?"replace":"assign"](s)}}l=hi(t),i()}}}function vi(t,e){return{...Xi(e),state:t}}function Nr(t="/"){let e=0,l=[vi(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,s){e++,l=l.slice(0,e),l.push(vi(n,s))},replaceState(n,i,s){l[e]=vi(n,s)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const Pr=!!(!Al&&window.document&&window.document.createElement),Tr=!Al&&window.location.origin==="null",uu=Mr(Pr&&!Tr?window:Nr()),{navigate:sn}=uu;let ql=null,ru=!0;function qr(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nql.level||t.level===ql.level&&qr(t.routerId,ql.routerId))&&(ql=t)}function Dr(){ql=null}function Ar(){ru=!1}function rs(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Qf(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function Or(t,e){return Number(t.dataset.svnavRouteEnd)===e}function Lr(t){return/^H[1-6]$/i.test(t.tagName)}function cs(t,e=document){return e.querySelector(t)}function Ir(t){let l=cs(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!Or(l,t);){if(Lr(l))return l;const n=cs("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function Rr(t){Promise.resolve(cn(t.focusElement)).then(e=>{const l=e||Ir(t.id);l||fi(mn,`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,ri),!rs(l)&&rs(document.documentElement)})}const Fr=(t,e,l)=>(n,i)=>Ku().then(()=>{if(!ql||ru){Ar();return}if(n&&Rr(ql.route),t.announcements&&i){const{path:s,fullPath:a,meta:r,params:f,uri:c}=ql.route,m=t.createAnnouncement({path:s,fullPath:a,meta:r,params:f,uri:c},cn(l));Promise.resolve(m).then(_=>{e.set(_)})}Dr()}),Ur="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 Br(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Xf(t[6],Ur)],i={};for(let s=0;s`Navigated to ${Q.uri}`,announcements:!0,...b},k=m,R=Ki(m),I=on(Mi),F=on(Sn),M=!I,A=Hr(),O=h&&!(F&&!F.manageFocus),j=ol("");Pl(t,j,Q=>l(0,r=Q));const Y=F?F.disableInlineStyles:g,z=ol([]);Pl(t,z,Q=>l(20,a=Q));const T=ol(null);Pl(t,T,Q=>l(18,i=Q));let B=!1;const X=M?0:F.level+1,K=M?ol((()=>fs(Al?Xi(_):d.location,R))()):I;Pl(t,K,Q=>l(17,n=Q));const V=ol(n);Pl(t,V,Q=>l(19,s=Q));const U=Fr(w,j,K),G=Q=>ae=>ae.filter(re=>re.id!==Q);function se(Q){if(Al){if(B)return;const ae=fu(Q,n.pathname);if(ae)return B=!0,ae}else z.update(ae=>{const re=G(Q.id)(ae);return re.push(Q),re})}function le(Q){z.update(G(Q))}return!M&&m!==_s&&fi(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:m}),M&&(yf(()=>d.listen(ae=>{const re=fs(ae.location,R);V.set(n),K.set(re)})),jn(Mi,K)),jn(Sn,{activeRoute:T,registerRoute:se,unregisterRoute:le,manageFocus:O,level:X,id:A,history:M?d:F.history,basepath:M?R:F.basepath,disableInlineStyles:Y}),t.$$set=Q=>{"basepath"in Q&&l(11,m=Q.basepath),"url"in Q&&l(12,_=Q.url),"history"in Q&&l(13,d=Q.history),"primary"in Q&&l(14,h=Q.primary),"a11y"in Q&&l(15,b=Q.a11y),"disableInlineStyles"in Q&&l(16,g=Q.disableInlineStyles),"$$scope"in Q&&l(21,c=Q.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&m!==k&&fi(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const Q=au(a,n.pathname);T.set(Q)}if(t.$$.dirty[0]&655360&&M){const Q=!!n.hash,ae=!Q&&O,re=!Q||n.pathname!==s.pathname;U(ae,re)}t.$$.dirty[0]&262144&&O&&i&&i.primary&&Er({level:X,routerId:A,route:i})},[r,w,M,A,O,j,Y,z,T,K,V,m,_,d,h,b,g,n,i,s,a,c,f]}class zr extends Pt{constructor(e){super(),Nt(this,e,yr,jr,Mt,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const cu=zr;function Xn(t,e,l=Sn,n=mn){on(l)||ou(t,s=>`You cannot use ${s} outside of a ${Qi(n)}.`,e)}const Wr=t=>{const{subscribe:e}=on(t);return{subscribe:e}};function _u(){return Xn(tu),Wr(Mi)}function mu(){const{history:t}=on(Sn);return t}function pu(){const t=on(Jf);return t?xu(t,e=>e.base):ol("/")}function du(){Xn(nu);const t=pu(),{basepath:e}=on(Sn);return n=>kr(n,cn(t),e)}function Gr(){Xn(lu);const t=du(),{navigate:e}=mu();return(n,i)=>{const s=Kf(n)?n:t(n);return e(s,i)}}const Vr=t=>({params:t&16,location:t&8}),ms=t=>({params:Al?cn(t[10]):t[4],location:t[3],navigate:t[11]});function ps(t){let e,l;return e=new cu({props:{primary:t[1],$$slots:{default:[Qr]},$$scope:{ctx:t}}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&2&&(s.primary=n[1]),i&528409&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Kr(t){let e;const l=t[18].default,n=yi(l,t,t[19],ms);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&524312)&&Wi(n,l,i,i[19],e?zi(l,i[19],s,Vr):Gi(i[19]),ms)},i(i){e||(Z(n,i),e=!0)},o(i){ie(n,i),e=!1},d(i){n&&n.d(i)}}}function Yr(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Al?cn(t[10]):t[4],t[12]];var s=t[0];function a(r,f){let c={};for(let m=0;m{Ne(c,1)}),vt()}s?(e=is(s,a(r,f)),Pe(e.$$.fragment),Z(e.$$.fragment,1),Me(e,l.parentNode,l)):e=null}else if(s){const c=f&7192?Ci(i,[f&8&&{location:r[3]},f&2048&&{navigate:r[11]},f&1040&&$n(Al?cn(r[10]):r[4]),f&4096&&$n(r[12])]):{};e.$set(c)}},i(r){n||(e&&Z(e.$$.fragment,r),n=!0)},o(r){e&&ie(e.$$.fragment,r),n=!1},d(r){r&&N(l),e&&Ne(e,r)}}}function Qr(t){let e,l,n,i;const s=[Yr,Kr],a=[];function r(f,c){return f[0]!==null?0:1}return e=r(t),l=a[e]=s[e](t),{c(){l.c(),n=Ht()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(ht(),ie(a[m],1,1,()=>{a[m]=null}),vt(),l=a[e],l?l.p(f,c):(l=a[e]=s[e](f),l.c()),Z(l,1),l.m(n.parentNode,n))},i(f){i||(Z(l),i=!0)},o(f){ie(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function Xr(t){let e,l,n,i,s,a=[Si(t[7]),{"data-svnav-route-start":t[5]}],r={};for(let _=0;_{f=null}),vt())},i(_){s||(Z(f),s=!0)},o(_){ie(f),s=!1},d(_){_&&(N(e),N(l),N(n),N(i)),f&&f.d(_)}}}const Zr=Yf();function Jr(t,e,l){let n;const i=["path","component","meta","primary"];let s=oi(e,i),a,r,f,c,{$$slots:m={},$$scope:_}=e,{path:d=""}=e,{component:h=null}=e,{meta:b={}}=e,{primary:g=!0}=e;Xn(ri,e);const w=Zr(),{registerRoute:k,unregisterRoute:R,activeRoute:I,disableInlineStyles:F}=on(Sn);Pl(t,I,B=>l(16,a=B));const M=pu();Pl(t,M,B=>l(17,f=B));const A=_u();Pl(t,A,B=>l(3,r=B));const O=ol(null);let j;const Y=ol(),z=ol({});Pl(t,z,B=>l(4,c=B)),jn(Jf,Y),jn(er,z),jn(tr,O);const T=Gr();return Al||Gu(()=>R(w)),t.$$set=B=>{l(24,e=vl(vl({},e),si(B))),l(12,s=oi(e,i)),"path"in B&&l(13,d=B.path),"component"in B&&l(0,h=B.component),"meta"in B&&l(14,b=B.meta),"primary"in B&&l(1,g=B.primary),"$$scope"in B&&l(19,_=B.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const B=d==="",X=Qn(f,d),y={id:w,path:d,meta:b,default:B,fullPath:B?"":X,base:B?f:wr(X,r.pathname),primary:g,focusElement:O};Y.set(y),l(15,j=k(y))}if(t.$$.dirty&98304&&l(2,n=!!(j||a&&a.id===w)),t.$$.dirty&98308&&n){const{params:B}=j||a;z.set(B)}},e=si(e),[h,g,n,r,c,w,I,F,M,A,z,T,s,d,b,j,a,f,m,_]}class $r extends Pt{constructor(e){super(),Nt(this,e,Jr,Xr,Mt,{path:13,component:0,meta:14,primary:1})}}const hl=$r;function xr(t){let e,l,n,i;const s=t[13].default,a=yi(s,t,t[12],null);let r=[{href:t[0]},t[2],t[1]],f={};for(let c=0;cl(11,_=O));const I=Vu(),F=du(),{navigate:M}=mu();function A(O){I("click",O),Ju(O)&&(O.preventDefault(),M(n,{state:w,replace:a||g}))}return t.$$set=O=>{l(19,e=vl(vl({},e),si(O))),l(18,m=oi(e,c)),"to"in O&&l(5,b=O.to),"replace"in O&&l(6,g=O.replace),"state"in O&&l(7,w=O.state),"getProps"in O&&l(8,k=O.getProps),"$$scope"in O&&l(12,h=O.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=F(b,_)),t.$$.dirty&2049&&l(10,i=Ni(_.pathname,n)),t.$$.dirty&2049&&l(9,s=n===_.pathname),t.$$.dirty&2049&&(a=Xi(n)===gr(_)),t.$$.dirty&512&&l(2,r=s?{"aria-current":"page"}:{}),l(1,f=(()=>{if(Vf(k)){const O=k({location:_,href:n,isPartiallyCurrent:i,isCurrent:s});return{...m,...O}}return m})())},e=si(e),[n,f,r,R,A,b,g,w,k,s,i,_,h,d]}class t1 extends Pt{constructor(e){super(),Nt(this,e,e1,xr,Mt,{to:5,replace:6,state:7,getProps:8})}}const dl=t1;function ln(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function l1(t,e){return t>218&&t<242?"#23ac05":t>212&&t<248?"#b1d900":t>208&&t<252?"#a3b200":"#b20000"}function Zi(t,e){let l;return t>90?l="#b20000":t>85?l="#b19601":t>80?l="#a3b200":t>75?l="#569f12":l="#23ac05",l}function zn(t){return t>75?"#23ac05":t>50?"#77d900":t>25?"#94d900":"#569f12"}function ui(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"Unknown"}}function Ct(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function Je(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 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 245:return"wESP32";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"µHAN 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";case 80:return"Generic ESP32-S3"}return"Unknown"}function Hn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Yt(t,e){return t==1||t==2&&e}function _l(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function Vt(t,e){return t==null||isNaN(t)?"-":(isNaN(e)&&(e=t<1?2:t<10?1:0),t.toFixed(e))}function Ol(t,e){return t.setTime(t.getTime()+e*36e5),t}function n1(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function i1(t){return t=="EOE"?"https://transparency.entsoe.eu/":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}let xn=0;function Wn(t,e){var l="";xn++;var n=function(){setTimeout(Wn,1e3,t,e)};if(t.net.ip&&xn%3==0){if(!t.net.ip){n();return}l="http://"+t.net.ip}else t.hostname&&xn%3==1?l="http://"+t.hostname:t.hostname&&xn%3==2?l="http://"+t.hostname+".local":l="";console&&console.log("Trying url "+l),e&&e(l);var i=new XMLHttpRequest;i.timeout=5e3,i.addEventListener("abort",n),i.addEventListener("error",n),i.addEventListener("timeout",n),i.addEventListener("load",function(s){window.location.href=l||"/"}),i.open("GET",l+"/is-alive",!0),i.send()}function $t(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ds(t){return t.startsWith("esp32")?"esp32":t}function ul(t,e){let l=[t,e];return typeof t>"u"?(l[0]="-",l[1]=e):t>=1e9?(l[0]=(t/1e6).toFixed(t>1e10?0:1),l[1]="M"+e):t>1e4?(l[0]=(t/1e3).toFixed(t>1e6?0:t>1e5?1:2),l[1]="k"+e):(l[0]=t.toFixed(0),l[1]=e),l}function Gn(t,e){let l=[Vt(t,2),e];if(typeof t>"u")l[0]="-",l[1]=e;else if(Math.abs(t*100)<100){switch(l[0]=Vt(t*100,2),e){case"NOK":case"DKK":e="øre";break;case"SEK":e="öre";break;case"EUR":e="cent";break;case"CHF":e="rp.";break;default:e=e+"/100"}l[1]=e}return l}let _n="((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}",Ll="[\\x20-\\x7E]+",Mn="[\\x20-\\xFF]+",Vn="[A-Za-z0-9_\\-]+",hu="[0-9A-Fa-f]+",In="[0-9]+",ni={},Pi=[];async function s1(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),s=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),s}let bi;async function vu(){if(Pi.length){let t=Pi.shift();delete ni[t.resource];try{let e=await s1(t.resource,t.options);for(let l in t.callbacks)t.callbacks[l](e.clone())}catch(e){console.error("Error calling "+t.resource,e);for(let l in t.callbacks)t.callbacks[l]()}}bi&&clearTimeout(bi),bi=setTimeout(vu,100)}vu();async function bl(t,e={}){let l;return ni[t]?l=ni[t]:(l={resource:t,options:e,callbacks:[]},ni[t]=l,Pi.push(l)),new Promise(i=>l.callbacks.push(i))}let Nl={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null,if:{eth:!1}};async function ci(){Nl=await(await bl("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),cl.set(Nl)}const cl=ol(Nl,t=>(ci(),function(){}));function o1(t){cl.update(e=>(e.trying=t,e))}let ei=0,hs=-127,vs=null,a1={};const f1=Zf(a1,t=>{let e,l;async function n(){bl("data.json").then(i=>i.json()).then(i=>{t(i),hs!=i.t&&(hs=i.t,setTimeout(u1,2e3)),vs==null&&i.pe&&i.p!=null&&(vs=i.p,gu()),(!Nl||!Nl.chip||Nl.booting||ei>1&&!Hn(Nl.board))&&(ci(),El&&clearTimeout(El),El=setTimeout(Ei,2e3),Dl&&clearTimeout(Dl),Dl=setTimeout(Ai,3e3)),i.u,El||(El=Ei()),Dl||(Dl=Ai());let s=5e3;if(Hn(Nl.board)&&i.v>2.5){let a=3.3-Math.min(3.3,i.v);a>0&&(s=Math.max(a,.1)*10*5e3)}s>5e3&&console.log("Next in "+s+"ms"),e&&clearTimeout(e),e=setTimeout(n,s),ei=0}).catch(i=>{ei++,ei>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(n,15e3),l||(l=setTimeout(Wn,5e3,Nl,o1))):e=setTimeout(n,Hn(Nl.board)?1e4:5e3)})}return n(),function(){clearTimeout(e)}});let Ti={},Fn;const Ji=ol(Ti);async function bu(){let t=!1;Ji.update(e=>{for(var l=0;l<36;l++){if(e[Ct(l)]==null){t=l<12;break}e[Ct(l)]=e[Ct(l+1)]}return e}),t?gu():Fn=setTimeout(bu,(60-new Date().getMinutes())*6e4)}async function gu(){Fn&&(clearTimeout(Fn),Fn=0),Ti=await(await bl("energyprice.json")).json(),Ji.set(Ti),Fn=setTimeout(bu,(60-new Date().getMinutes())*6e4)}let qi={},El;async function Ei(){El&&(clearTimeout(El),El=0),qi=await(await bl("dayplot.json")).json(),ku.set(qi),El=setTimeout(Ei,(60-new Date().getMinutes())*6e4+20)}const ku=ol(qi,t=>function(){});let Di={},Dl;async function Ai(){Dl&&(clearTimeout(Dl),Dl=0),Di=await(await bl("monthplot.json")).json(),wu.set(Di),Dl=setTimeout(Ai,(24-new Date().getHours())*36e5+40)}const wu=ol(Di,t=>function(){});let Oi={};async function u1(){Oi=await(await bl("temperature.json")).json(),Cu.set(Oi)}const Cu=ol(Oi,t=>function(){});let Li={},ti;async function Su(){ti&&(clearTimeout(ti),ti=0),Li=await(await bl("tariff.json")).json(),Mu.set(Li),ti=setTimeout(Su,(60-new Date().getMinutes())*6e4+30)}const Mu=ol(Li,t=>function(){});let gn={c:-1,n:[]};async function r1(){let e=await(await bl("wifiscan.json",{timeout:3e4})).json(),l=[];gn.c=0,gn.n=[];for(let n=0;n(r1(),function(){}));let Ii=!1;const gl=ol(Ii);async function Nu(t){Ii=await(await bl("translations.json"+(t?"?lang="+t:""))).json(),gl.set(Ii)}Nu();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 Pu(t){return await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function gs(t){var f;let e=(((f=t[1].header)==null?void 0:f.uptime)??"Up")+"",l,n,i;function s(c,m){return c[2]>1?v1:c[2]>0?h1:c[3]>1?d1:c[3]>0?p1:c[4]>1?m1:c[4]>0?_1:c1}let a=s(t),r=a(t);return{c(){l=C(e),n=v(),r.c(),i=Ht()},m(c,m){P(c,l,m),P(c,n,m),r.m(c,m),P(c,i,m)},p(c,m){var _;m&2&&e!==(e=(((_=c[1].header)==null?void 0:_.uptime)??"Up")+"")&&E(l,e),a===(a=s(c))&&r?r.p(c,m):(r.d(1),r=a(c),r&&(r.c(),r.m(i.parentNode,i)))},d(c){c&&(N(l),N(n),N(i)),r.d(c)}}}function c1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.seconds)??"s")+"",i;return{c(){e=C(t[0]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&1&&E(e,a[0]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.seconds)??"s")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function _1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.minute)??"m")+"",i;return{c(){e=C(t[4]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&16&&E(e,a[4]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minute)??"m")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function m1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.minutes)??"m")+"",i;return{c(){e=C(t[4]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&16&&E(e,a[4]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minutes)??"m")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function p1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.hour)??"h")+"",i;return{c(){e=C(t[3]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&8&&E(e,a[3]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hour)??"h")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function d1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.hours)??"h")+"",i;return{c(){e=C(t[3]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&8&&E(e,a[3]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hours)??"h")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function h1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.day)??"d")+"",i;return{c(){e=C(t[2]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&4&&E(e,a[2]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.day)??"d")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function v1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.days)??"d")+"",i;return{c(){e=C(t[2]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&4&&E(e,a[2]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.days)??"d")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function b1(t){let e,l=t[0]&&gs(t);return{c(){l&&l.c(),e=Ht()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=gs(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:Ye,o:Ye,d(n){n&&N(e),l&&l.d(n)}}}function g1(t,e,l){let{epoch:n}=e,i={};gl.subscribe(f=>{l(1,i=f)});let s=0,a=0,r=0;return t.$$set=f=>{"epoch"in f&&l(0,n=f.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(2,s=Math.floor(n/86400)),l(3,a=Math.floor(n/3600)),l(4,r=Math.floor(n/60)))},[n,i,s,a,r]}class k1 extends Pt{constructor(e){super(),Nt(this,e,g1,b1,Mt,{epoch:0})}}function w1(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,s){P(i,e,s),o(e,l)},p(i,[s]){s&4&&E(l,i[2]),s&2&&u(e,"title",i[1]),s&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:Ye,o:Ye,d(i){i&&N(e)}}}function C1(t,e,l){let{color:n}=e,{title:i}=e,{text:s}=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,s=a.text)},[n,i,s]}class un extends Pt{constructor(e){super(),Nt(this,e,C1,w1,Mt,{color:0,title:1,text:2})}}function S1(t){let e,l=`${Ct(t[0].getDate())}.${Ct(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ct(t[0].getHours())}:${Ct(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=C(l),u(e,"class",t[1])},m(i,s){P(i,e,s),o(e,n)},p(i,s){s&1&&l!==(l=`${Ct(i[0].getDate())}.${Ct(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ct(i[0].getHours())}:${Ct(i[0].getMinutes())}`)&&E(n,l),s&2&&u(e,"class",i[1])},d(i){i&&N(e)}}}function M1(t){var n;let e=`${Ct(t[0].getDate())}. ${t[2].months?(n=t[2].months)==null?void 0:n[t[0].getMonth()]:Ct(t[0].getMonth()+1)} ${Ct(t[0].getHours())}:${Ct(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(i,s){P(i,l,s)},p(i,s){var a;s&5&&e!==(e=`${Ct(i[0].getDate())}. ${i[2].months?(a=i[2].months)==null?void 0:a[i[0].getMonth()]:Ct(i[0].getMonth()+1)} ${Ct(i[0].getHours())}:${Ct(i[0].getMinutes())}`)&&E(l,e)},d(i){i&&N(l)}}}function N1(t){let e;function l(s,a){return s[3]?M1:S1}let n=l(t),i=n(t);return{c(){i.c(),e=Ht()},m(s,a){i.m(s,a),P(s,e,a)},p(s,[a]){n===(n=l(s))&&i?i.p(s,a):(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},i:Ye,o:Ye,d(s){s&&N(e),i.d(s)}}}function P1(t,e,l){let n={};gl.subscribe(f=>{l(2,n=f)});let{timestamp:i}=e,{fullTimeColor:s}=e,{offset:a}=e,r;return t.$$set=f=>{"timestamp"in f&&l(0,i=f.timestamp),"fullTimeColor"in f&&l(1,s=f.fullTimeColor),"offset"in f&&l(4,a=f.offset)},t.$$.update=()=>{t.$$.dirty&17&&(l(3,r=Math.abs(new Date().getTime()-i.getTime())<3e5),isNaN(a)||Ol(i,a-(24+i.getHours()-i.getUTCHours())%24))},[i,s,n,r,a]}class Tu extends Pt{constructor(e){super(),Nt(this,e,P1,N1,Mt,{timestamp:0,fullTimeColor:1,offset:4})}}function T1(t){let e,l,n;return{c(){e=At("svg"),l=At("path"),n=At("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,s){P(i,e,s),o(e,l),o(e,n)},p:Ye,i:Ye,o:Ye,d(i){i&&N(e)}}}class q1 extends Pt{constructor(e){super(),Nt(this,e,null,T1,Mt,{})}}function E1(t){let e,l;return{c(){e=At("svg"),l=At("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){P(n,e,i),o(e,l)},p:Ye,i:Ye,o:Ye,d(n){n&&N(e)}}}class D1 extends Pt{constructor(e){super(),Nt(this,e,null,E1,Mt,{})}}function A1(t){let e,l;return{c(){e=At("svg"),l=At("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){P(n,e,i),o(e,l)},p:Ye,i:Ye,o:Ye,d(n){n&&N(e)}}}class O1 extends Pt{constructor(e){super(),Nt(this,e,null,A1,Mt,{})}}function L1(t){let e,l,n=t[2].version+"",i;return{c(){e=C("AMS reader "),l=p("span"),i=C(n)},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&4&&n!==(n=s[2].version+"")&&E(i,n)},d(s){s&&(N(e),N(l))}}}function ks(t){let e,l=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=C(l),i=C("°C"),u(e,"class","flex-none my-auto")},m(s,a){P(s,e,a),o(e,n),o(e,i)},p(s,a){a&2&&l!==(l=(s[1].t>-50?s[1].t.toFixed(1):"-")+"")&&E(n,l)},d(s){s&&N(e)}}}function ws(t){var i,s,a;let e,l=(((i=t[4].header)==null?void 0:i.han)??"HAN")+": "+(((a=(s=t[4].errors)==null?void 0:s.han)==null?void 0:a[t[1].he])??t[1].he),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),o(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.han)??"HAN")+": "+(((_=(m=r[4].errors)==null?void 0:m.han)==null?void 0:_[r[1].he])??r[1].he))&&E(n,l)},d(r){r&&N(e)}}}function Cs(t){var i,s,a;let e,l=(((i=t[4].header)==null?void 0:i.mqtt)??"MQTT")+": "+(((a=(s=t[4].errors)==null?void 0:s.mqtt)==null?void 0:a[t[1].me])??t[1].me),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),o(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.mqtt)??"MQTT")+": "+(((_=(m=r[4].errors)==null?void 0:m.mqtt)==null?void 0:_[r[1].me])??r[1].me))&&E(n,l)},d(r){r&&N(e)}}}function Ss(t){var i,s,a;let e,l=(((i=t[4].header)==null?void 0:i.price)??"PS")+": "+(((a=(s=t[4].errors)==null?void 0:s.price)==null?void 0:a[t[1].ee])??t[1].ee),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),o(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.price)??"PS")+": "+(((_=(m=r[4].errors)==null?void 0:m.price)==null?void 0:_[r[1].ee])??r[1].ee))&&E(n,l)},d(r){r&&N(e)}}}function Ms(t){let e,l,n,i,s,a,r,f;return l=new dl({props:{to:"/configuration",$$slots:{default:[I1]},$$scope:{ctx:t}}}),a=new dl({props:{to:"/status",$$slots:{default:[R1]},$$scope:{ctx:t}}}),{c(){var c,m;e=p("div"),Pe(l.$$.fragment),i=v(),s=p("div"),Pe(a.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title",n=((c=t[4].header)==null?void 0:c.config)??""),u(s,"class","flex-none px-1 mt-1"),u(s,"title",r=((m=t[4].header)==null?void 0:m.status)??"")},m(c,m){P(c,e,m),Me(l,e,null),P(c,i,m),P(c,s,m),Me(a,s,null),f=!0},p(c,m){var h,b;const _={};m&64&&(_.$$scope={dirty:m,ctx:c}),l.$set(_),(!f||m&16&&n!==(n=((h=c[4].header)==null?void 0:h.config)??""))&&u(e,"title",n);const d={};m&64&&(d.$$scope={dirty:m,ctx:c}),a.$set(d),(!f||m&16&&r!==(r=((b=c[4].header)==null?void 0:b.status)??""))&&u(s,"title",r)},i(c){f||(Z(l.$$.fragment,c),Z(a.$$.fragment,c),f=!0)},o(c){ie(l.$$.fragment,c),ie(a.$$.fragment,c),f=!1},d(c){c&&(N(e),N(i),N(s)),Ne(l),Ne(a)}}}function I1(t){let e,l;return e=new q1({}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function R1(t){let e,l;return e=new D1({}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function F1(t){let e,l;function n(a,r){return a[2].security==0||a[1].a?j1:B1}let i=n(t),s=i(t);return{c(){var a;e=p("div"),s.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",l=(((a=t[4].header)==null?void 0:a.new_version)??"New version")+": "+t[2].upgrade.n)},m(a,r){P(a,e,r),s.m(e,null)},p(a,r){var f;i===(i=n(a))&&s?s.p(a,r):(s.d(1),s=i(a),s&&(s.c(),s.m(e,null))),r&20&&l!==(l=(((f=a[4].header)==null?void 0:f.new_version)??"New version")+": "+a[2].upgrade.n)&&u(e,"title",l)},d(a){a&&N(e),s.d()}}}function U1(t){let e,l,n=t[2].upgrade.t+"",i,s,a=t[3].toFixed(1)+"",r,f;return{c(){e=p("div"),l=C("Upgrading to "),i=C(n),s=C(", "),r=C(a),f=C("%"),u(e,"class","flex-none mr-3 mt-1 text-yellow-300")},m(c,m){P(c,e,m),o(e,l),o(e,i),o(e,s),o(e,r),o(e,f)},p(c,m){m&4&&n!==(n=c[2].upgrade.t+"")&&E(i,n),m&8&&a!==(a=c[3].toFixed(1)+"")&&E(r,a)},d(c){c&&N(e)}}}function B1(t){var r;let e,l=(((r=t[4].header)==null?void 0:r.new_version)??"New version")+"",n,i,s=t[2].upgrade.n+"",a;return{c(){e=p("span"),n=C(l),i=C(": "),a=C(s)},m(f,c){P(f,e,c),o(e,n),o(e,i),o(e,a)},p(f,c){var m;c&16&&l!==(l=(((m=f[4].header)==null?void 0:m.new_version)??"New version")+"")&&E(n,l),c&4&&s!==(s=f[2].upgrade.n+"")&&E(a,s)},d(f){f&&N(e)}}}function j1(t){var m;let e,l,n=(((m=t[4].header)==null?void 0:m.new_version)??"New version")+"",i,s,a=t[2].upgrade.n+"",r,f,c;return{c(){e=p("button"),l=p("span"),i=C(n),s=C(": "),r=C(a),u(l,"class","mt-1"),u(e,"class","flex")},m(_,d){P(_,e,d),o(e,l),o(l,i),o(l,s),o(l,r),f||(c=ce(e,"click",t[5]),f=!0)},p(_,d){var h;d&16&&n!==(n=(((h=_[4].header)==null?void 0:h.new_version)??"New version")+"")&&E(i,n),d&4&&a!==(a=_[2].upgrade.n+"")&&E(r,a)},d(_){_&&N(e),f=!1,c()}}}function H1(t){var _e,de;let e,l,n,i,s,a,r,f,c,m,_,d=(((_e=t[4].header)==null?void 0:_e.mem)??"Free")+"",h,b,g=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",w,k,R,I,F,M,A,O,j,Y,z,T,B,X,y,K,V,U,G,se,le,Q,ae,re,ue,ne,pe,oe,J,$,ke;i=new dl({props:{to:"/",$$slots:{default:[L1]},$$scope:{ctx:t}}}),f=new k1({props:{epoch:t[1].u}});let Ce=t[1].t>-50&&ks(t);F=new un({props:{title:"ESP",text:t[2].booting?((de=t[4].header)==null?void 0:de.booting)??"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":"ESP",color:ln(t[2].booting?2:t[1].em)}}),A=new un({props:{title:"HAN",text:"HAN",color:ln(t[2].booting?9:t[1].hm)}}),j=new un({props:{title:"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":"WiFi",color:ln(t[2].booting?9:t[1].wm)}}),z=new un({props:{title:"MQTT",text:"MQTT",color:ln(t[2].booting?9:t[1].mm)}});let D=(t[1].he<0||t[1].he>0)&&ws(t),S=t[1].me<0&&Cs(t),L=(t[1].ee>0||t[1].ee<0)&&Ss(t);ae=new Tu({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let q=t[2].vndcfg&&t[2].usrcfg&&Ms(t);oe=new O1({});function W(x,he){if(x[2].upgrading)return U1;if(x[2].fwconsent===1&&x[2].upgrade.n)return F1}let te=W(t),fe=te&&te(t);return{c(){var x;e=p("nav"),l=p("div"),n=p("div"),Pe(i.$$.fragment),s=v(),a=p("div"),r=p("div"),Pe(f.$$.fragment),c=v(),Ce&&Ce.c(),m=v(),_=p("div"),h=C(d),b=C(": "),w=C(g),k=C("kb"),R=v(),I=p("div"),Pe(F.$$.fragment),M=v(),Pe(A.$$.fragment),O=v(),Pe(j.$$.fragment),Y=v(),Pe(z.$$.fragment),T=v(),D&&D.c(),B=v(),S&&S.c(),X=v(),L&&L.c(),y=v(),K=p("div"),V=p("div"),U=p("a"),G=p("img"),le=v(),Q=p("div"),Pe(ae.$$.fragment),re=v(),q&&q.c(),ue=v(),ne=p("div"),pe=p("a"),Pe(oe.$$.fragment),$=v(),fe&&fe.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(I,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(G,"class","logo"),ii(G.src,se=(t[0]+"/logo.svg").replace("//","/"))||u(G,"src",se),u(G,"alt","GitHub repo"),u(U,"class","float-right"),u(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(U,"target","_blank"),u(U,"rel","noreferrer"),u(U,"aria-label","GitHub"),u(V,"class","flex-none"),u(Q,"class","flex-none my-auto px-2"),u(pe,"href",_l("")),u(pe,"target","_blank"),u(pe,"rel","noreferrer"),u(ne,"class","flex-none px-1 mt-1"),u(ne,"title",J=((x=t[4].header)==null?void 0:x.doc)??""),u(K,"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","hdr")},m(x,he){P(x,e,he),o(e,l),o(l,n),Me(i,n,null),o(l,s),o(l,a),o(a,r),Me(f,r,null),o(a,c),Ce&&Ce.m(a,null),o(a,m),o(a,_),o(_,h),o(_,b),o(_,w),o(_,k),o(l,R),o(l,I),Me(F,I,null),o(I,M),Me(A,I,null),o(I,O),Me(j,I,null),o(I,Y),Me(z,I,null),o(l,T),D&&D.m(l,null),o(l,B),S&&S.m(l,null),o(l,X),L&&L.m(l,null),o(l,y),o(l,K),o(K,V),o(V,U),o(U,G),o(K,le),o(K,Q),Me(ae,Q,null),o(K,re),q&&q.m(K,null),o(K,ue),o(K,ne),o(ne,pe),Me(oe,pe,null),o(K,$),fe&&fe.m(K,null),ke=!0},p(x,[he]){var xe,wt,tt;const be={};he&68&&(be.$$scope={dirty:he,ctx:x}),i.$set(be);const Ae={};he&2&&(Ae.epoch=x[1].u),f.$set(Ae),x[1].t>-50?Ce?Ce.p(x,he):(Ce=ks(x),Ce.c(),Ce.m(a,m)):Ce&&(Ce.d(1),Ce=null),(!ke||he&16)&&d!==(d=(((xe=x[4].header)==null?void 0:xe.mem)??"Free")+"")&&E(h,d),(!ke||he&2)&&g!==(g=(x[1].m?(x[1].m/1e3).toFixed(1):"-")+"")&&E(w,g);const Te={};he&22&&(Te.text=x[2].booting?((wt=x[4].header)==null?void 0:wt.booting)??"Booting":x[1].v>2?x[1].v.toFixed(2)+"V":"ESP"),he&6&&(Te.color=ln(x[2].booting?2:x[1].em)),F.$set(Te);const Oe={};he&6&&(Oe.color=ln(x[2].booting?9:x[1].hm)),A.$set(Oe);const Ie={};he&2&&(Ie.text=x[1].r?x[1].r.toFixed(0)+"dBm":"WiFi"),he&6&&(Ie.color=ln(x[2].booting?9:x[1].wm)),j.$set(Ie);const De={};he&6&&(De.color=ln(x[2].booting?9:x[1].mm)),z.$set(De),x[1].he<0||x[1].he>0?D?D.p(x,he):(D=ws(x),D.c(),D.m(l,B)):D&&(D.d(1),D=null),x[1].me<0?S?S.p(x,he):(S=Cs(x),S.c(),S.m(l,X)):S&&(S.d(1),S=null),x[1].ee>0||x[1].ee<0?L?L.p(x,he):(L=Ss(x),L.c(),L.m(l,y)):L&&(L.d(1),L=null),(!ke||he&1&&!ii(G.src,se=(x[0]+"/logo.svg").replace("//","/")))&&u(G,"src",se);const Ue={};he&2&&(Ue.timestamp=x[1].c?new Date(x[1].c*1e3):new Date(0)),he&4&&(Ue.offset=x[2].clock_offset),ae.$set(Ue),x[2].vndcfg&&x[2].usrcfg?q?(q.p(x,he),he&4&&Z(q,1)):(q=Ms(x),q.c(),Z(q,1),q.m(K,ue)):q&&(ht(),ie(q,1,1,()=>{q=null}),vt()),(!ke||he&16&&J!==(J=((tt=x[4].header)==null?void 0:tt.doc)??""))&&u(ne,"title",J),te===(te=W(x))&&fe?fe.p(x,he):(fe&&fe.d(1),fe=te&&te(x),fe&&(fe.c(),fe.m(K,null)))},i(x){ke||(Z(i.$$.fragment,x),Z(f.$$.fragment,x),Z(F.$$.fragment,x),Z(A.$$.fragment,x),Z(j.$$.fragment,x),Z(z.$$.fragment,x),Z(ae.$$.fragment,x),Z(q),Z(oe.$$.fragment,x),ke=!0)},o(x){ie(i.$$.fragment,x),ie(f.$$.fragment,x),ie(F.$$.fragment,x),ie(A.$$.fragment,x),ie(j.$$.fragment,x),ie(z.$$.fragment,x),ie(ae.$$.fragment,x),ie(q),ie(oe.$$.fragment,x),ke=!1},d(x){x&&N(e),Ne(i),Ne(f),Ce&&Ce.d(),Ne(F),Ne(A),Ne(j),Ne(z),D&&D.d(),S&&S.d(),L&&L.d(),Ne(ae),q&&q.d(),Ne(oe),fe&&fe.d()}}}function y1(t,e,l){let{basepath:n="/"}=e,{data:i={}}=e,s={};function a(){var c;confirm((((c=f.header)==null?void 0:c.upgrade)??"Upgrade to {0}?").replace("{0}",s.upgrade.n))&&(Pu(s.upgrade.n),cl.update(m=>(m.upgrade.t=s.upgrade.n,m.upgrade.p=0,m.upgrading=!0,m)))}let r;cl.subscribe(c=>{l(2,s=c)});let f={};return gl.subscribe(c=>{l(4,f=c)}),t.$$set=c=>{"basepath"in c&&l(0,n=c.basepath),"data"in c&&l(1,i=c.data)},t.$$.update=()=>{t.$$.dirty&4&&l(3,r=Math.max(0,s.upgrade.p))},[n,i,s,r,f,a]}class z1 extends Pt{constructor(e){super(),Nt(this,e,y1,H1,Mt,{basepath:0,data:1})}}function W1(t){let e,l,n,i;return{c(){e=At("svg"),l=At("path"),n=At("path"),u(l,"d",gi(150,150,115,210,510)),u(l,"stroke","rgba(128, 128, 128, 0.15)"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=gi(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(s,a){P(s,e,a),o(e,l),o(e,n)},p(s,[a]){a&1&&i!==(i=gi(150,150,115,210,210+300*s[0]/100))&&u(n,"d",i),a&2&&u(n,"stroke",s[1])},i:Ye,o:Ye,d(s){s&&N(e)}}}function Ns(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 gi(t,e,l,n,i){var s=Ns(t,e,l,i),a=Ns(t,e,l,n),r=i-n<=180?"0":"1",f=["M",s.x,s.y,"A",l,l,0,r,0,a.x,a.y].join(" ");return f}function G1(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=s=>{"pct"in s&&l(0,n=s.pct),"color"in s&&l(1,i=s.color)},[n,i]}class V1 extends Pt{constructor(e){super(),Nt(this,e,G1,W1,Mt,{pct:0,color:1})}}function Ps(t){let e,l,n,i=t[1][0]+"",s,a,r,f=t[1][1]+"",c,m;return{c(){e=p("br"),l=v(),n=p("span"),s=C(i),a=v(),r=p("span"),c=C(f),m=C("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(_,d){P(_,e,d),P(_,l,d),P(_,n,d),o(n,s),P(_,a,d),P(_,r,d),o(r,c),o(r,m)},p(_,d){d&2&&i!==(i=_[1][0]+"")&&E(s,i),d&2&&f!==(f=_[1][1]+"")&&E(c,f)},d(_){_&&(N(e),N(l),N(n),N(a),N(r))}}}function K1(t){let e,l,n,i,s,a,r,f,c,m,_=t[3][0]+"",d,h,b,g=t[3][1]+"",w,k,R;l=new V1({props:{pct:t[4],color:t[2](t[4],document.documentElement.classList.contains("dark"))}});let I=t[1]&&Ps(t);return{c(){e=p("div"),Pe(l.$$.fragment),n=v(),i=p("span"),s=p("span"),a=C(t[0]),r=v(),f=p("br"),c=v(),m=p("span"),d=C(_),h=v(),b=p("span"),w=C(g),k=v(),I&&I.c(),u(s,"class","pl-lab"),u(m,"class","pl-val"),u(b,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(F,M){P(F,e,M),Me(l,e,null),o(e,n),o(e,i),o(i,s),o(s,a),o(i,r),o(i,f),o(i,c),o(i,m),o(m,d),o(i,h),o(i,b),o(b,w),o(i,k),I&&I.m(i,null),R=!0},p(F,[M]){const A={};M&16&&(A.pct=F[4]),M&20&&(A.color=F[2](F[4],document.documentElement.classList.contains("dark"))),l.$set(A),(!R||M&1)&&E(a,F[0]),(!R||M&8)&&_!==(_=F[3][0]+"")&&E(d,_),(!R||M&8)&&g!==(g=F[3][1]+"")&&E(w,g),F[1]?I?I.p(F,M):(I=Ps(F),I.c(),I.m(i,null)):I&&(I.d(1),I=null)},i(F){R||(Z(l.$$.fragment,F),R=!0)},o(F){ie(l.$$.fragment,F),R=!1},d(F){F&&N(e),Ne(l),I&&I.d()}}}function Y1(t,e,l){let{val:n}=e,{max:i}=e,{unit:s}=e,{label:a}=e,{sub:r=["",""]}=e,{colorFn:f}=e,c,m=0;return t.$$set=_=>{"val"in _&&l(5,n=_.val),"max"in _&&l(6,i=_.max),"unit"in _&&l(7,s=_.unit),"label"in _&&l(0,a=_.label),"sub"in _&&l(1,r=_.sub),"colorFn"in _&&l(2,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&224&&(l(3,c=ul(n,s)),l(4,m=Math.min(n,i)/i*100))},[a,r,f,c,m,n,i,s]}class qu extends Pt{constructor(e){super(),Nt(this,e,Y1,K1,Mt,{val:5,max:6,unit:7,label:0,sub:1,colorFn:2})}}function Ts(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function qs(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Es(t,e,l){const n=t.slice();return n[15]=e[l],n}function Ds(t){let e,l,n,i,s,a,r,f=(t[0].title||t[0].link)&&As(t),c=rt(t[0].y.ticks),m=[];for(let g=0;g{f=null}),vt()),w&129){c=rt(g[0].y.ticks);let k;for(k=0;k{s=null}),vt())},i(a){n||(Z(s),n=!0)},o(a){ie(s),n=!1},d(a){a&&N(e),i&&i.d(),s&&s.d()}}}function Os(t){let e,l=t[0].title+"",n,i;return{c(){e=p("div"),n=C(l),u(e,"class","text-sm font-bold"),Dt(()=>t[9].call(e))},m(s,a){P(s,e,a),o(e,n),i=Vi(e,t[9].bind(e))},p(s,a){a&1&&l!==(l=s[0].title+"")&&E(n,l)},d(s){s&&N(e),i()}}}function Ls(t){let e,l,n,i;const s=[X1,Q1],a=[];function r(f,c){return f[0].link.route?0:1}return l=r(t),n=a[l]=s[l](t),{c(){e=p("div"),n.c(),u(e,"class","text-xs text-right")},m(f,c){P(f,e,c),a[l].m(e,null),i=!0},p(f,c){let m=l;l=r(f),l===m?a[l].p(f,c):(ht(),ie(a[m],1,1,()=>{a[m]=null}),vt(),n=a[l],n?n.p(f,c):(n=a[l]=s[l](f),n.c()),Z(n,1),n.m(e,null))},i(f){i||(Z(n),i=!0)},o(f){ie(n),i=!1},d(f){f&&N(e),a[l].d()}}}function Q1(t){let e,l=t[0].link.text+"",n,i,s;return{c(){e=p("a"),n=C(l),u(e,"href",i=t[0].link.url),u(e,"target",s=t[0].link.target)},m(a,r){P(a,e,r),o(e,n)},p(a,r){r&1&&l!==(l=a[0].link.text+"")&&E(n,l),r&1&&i!==(i=a[0].link.url)&&u(e,"href",i),r&1&&s!==(s=a[0].link.target)&&u(e,"target",s)},i:Ye,o:Ye,d(a){a&&N(e)}}}function X1(t){let e,l;return e=new dl({props:{to:t[0].link.url,$$slots:{default:[Z1]},$$scope:{ctx:t}}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.to=n[0].link.url),i&262145&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Z1(t){let e=t[0].link.text+"",l;return{c(){l=C(e)},m(n,i){P(n,l,i)},p(n,i){i&1&&e!==(e=n[0].link.text+"")&&E(l,e)},d(n){n&&N(l)}}}function Is(t){let e,l,n,i=t[15].label+"",s,a,r,f;return{c(){e=At("g"),l=At("line"),n=At("text"),s=C(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",a=t[15].align=="right"?"85%":""),u(e,"class",r="tick tick-"+t[15].value+" tick-"+t[15].color),u(e,"transform",f="translate(0, "+t[7](t[15].value)+")")},m(c,m){P(c,e,m),o(e,l),o(e,n),o(n,s)},p(c,m){m&1&&i!==(i=c[15].label+"")&&E(s,i),m&1&&a!==(a=c[15].align=="right"?"85%":"")&&u(n,"x",a),m&1&&r!==(r="tick tick-"+c[15].value+" tick-"+c[15].color)&&u(e,"class",r),m&129&&f!==(f="translate(0, "+c[7](c[15].value)+")")&&u(e,"transform",f)},d(c){c&&N(e)}}}function Rs(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&Is(t);return{c(){n&&n.c(),l=Ht()},m(i,s){n&&n.m(i,s),P(i,l,s)},p(i,s){s&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,s):(n=Is(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&N(l),n&&n.d(i)}}}function Fs(t){let e,l,n=(t[3]>20||t[13]%2==0)&&Us(t);return{c(){e=At("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,s){P(i,e,s),n&&n.m(e,null)},p(i,s){i[3]>20||i[13]%2==0?n?n.p(i,s):(n=Us(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),s&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&N(e),n&&n.d()}}}function Us(t){let e,l=t[11].label+"",n,i;return{c(){e=At("text"),n=C(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(s,a){P(s,e,a),o(e,n)},p(s,a){a&1&&l!==(l=s[11].label+"")&&E(n,l),a&8&&i!==(i=s[3]/2)&&u(e,"x",i)},d(s){s&&N(e)}}}function Bs(t){let e=!isNaN(t[6](t[13])),l,n=e&&Fs(t);return{c(){n&&n.c(),l=Ht()},m(i,s){n&&n.m(i,s),P(i,l,s)},p(i,s){s&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,s):(n=Fs(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&N(l),n&&n.d(i)}}}function js(t){let e,l,n=t[11].value!==void 0&&Hs(t),i=t[11].value2>1e-4&&Ws(t);return{c(){e=At("g"),n&&n.c(),l=At("g"),i&&i.c()},m(s,a){P(s,e,a),n&&n.m(e,null),P(s,l,a),i&&i.m(l,null)},p(s,a){s[11].value!==void 0?n?n.p(s,a):(n=Hs(s),n.c(),n.m(e,null)):n&&(n.d(1),n=null),s[11].value2>1e-4?i?i.p(s,a):(i=Ws(s),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(s){s&&(N(e),N(l)),n&&n.d(),i&&i.d()}}}function Hs(t){let e,l,n,i,s,a,r,f=t[3]>15&&ys(t);return{c(){e=At("rect"),f&&f.c(),r=Ht(),u(e,"x",l=t[6](t[13])+2),u(e,"y",n=t[7](t[11].value)),u(e,"width",i=t[3]-4),u(e,"height",s=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),u(e,"fill",a=t[11].color)},m(c,m){P(c,e,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&u(e,"x",l),m&129&&n!==(n=c[7](c[11].value))&&u(e,"y",n),m&8&&i!==(i=c[3]-4)&&u(e,"width",i),m&129&&s!==(s=c[7](c[0].y.min)-c[7](Math.min(c[0].y.min,0)+c[11].value))&&u(e,"height",s),m&1&&a!==(a=c[11].color)&&u(e,"fill",a),c[3]>15?f?f.p(c,m):(f=ys(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(r)),f&&f.d(c)}}}function ys(t){let e,l=t[11].label+"",n,i,s,a,r,f,c=t[11].title&&zs(t);return{c(){e=At("text"),n=C(l),c&&c.c(),f=Ht(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",s=t[3]t[7](0)-t[8]&&!t[0].dark?t[11].color:"white"),u(e,"transform",r="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[11].labelAngle?t[11].labelAngle:t[3]m[7](0)-m[8]&&!m[0].dark?m[11].color:"white")&&u(e,"fill",a),_&457&&r!==(r="translate("+(m[6](m[13])+m[3]/2)+" "+(m[7](m[11].value)>m[7](0)-m[8]?m[7](m[11].value)-m[8]:m[7](m[11].value)+10)+") rotate("+(m[11].labelAngle?m[11].labelAngle:m[3]15&&Gs(t);return{c(){e=At("rect"),f&&f.c(),r=Ht(),u(e,"x",l=t[6](t[13])+2),u(e,"y",n=t[7](0)),u(e,"width",i=t[3]-4),u(e,"height",s=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),u(e,"fill",a=t[11].color2?t[11].color2:t[11].color)},m(c,m){P(c,e,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&u(e,"x",l),m&128&&n!==(n=c[7](0))&&u(e,"y",n),m&8&&i!==(i=c[3]-4)&&u(e,"width",i),m&129&&s!==(s=c[7](c[0].y.min)-c[7](c[0].y.min+c[11].value2))&&u(e,"height",s),m&1&&a!==(a=c[11].color2?c[11].color2:c[11].color)&&u(e,"fill",a),c[3]>15?f?f.p(c,m):(f=Gs(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(r)),f&&f.d(c)}}}function Gs(t){let e,l=t[11].label2+"",n,i,s,a,r,f=t[11].title2&&Vs(t);return{c(){e=At("text"),n=C(l),f&&f.c(),r=Ht(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor","middle"),u(e,"fill",s=t[7](-t[11].value2)t[10].call(e))},m(s,a){P(s,e,a),i&&i.m(e,null),l=Vi(e,t[10].bind(e)),n=!0},p(s,[a]){s[0].x.ticks&&s[0].points&&s[4]?i?(i.p(s,a),a&17&&Z(i,1)):(i=Ds(s),i.c(),Z(i,1),i.m(e,null)):i&&(ht(),ie(i,1,1,()=>{i=null}),vt())},i(s){n||(Z(i),n=!0)},o(s){ie(i),n=!1},d(s){s&&N(e),i&&i.d(),l()}}}let rn=30;function $1(t,e,l){let{config:n}=e,i,s,a,r,f,c,m,_=0;function d(){_=this.clientHeight,l(5,_)}function h(){i=this.clientWidth,s=this.clientHeight,l(1,i),l(2,s)}return t.$$set=b=>{"config"in b&&l(0,n=b.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,c=s-_);let b=i-(n.padding.left+n.padding.right);l(3,a=b/n.points.length),l(8,m=an.y.max?k=n.padding.bottom:wc||k<0?0:k})}},[n,i,s,a,c,_,r,f,m,d,h]}class dn extends Pt{constructor(e){super(),Nt(this,e,$1,J1,Mt,{config:0})}}function x1(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function e0(t,e,l){let{title:n}=e,{u1:i}=e,{u2:s}=e,{u3:a}=e,{ds:r}=e,f={};function c(m){return{label:Vt(m)+"V",title:m.toFixed(1)+" V",value:isNaN(m)?0:m,color:l1(m||0,document.documentElement.classList.contains("dark"))}}return t.$$set=m=>{"title"in m&&l(1,n=m.title),"u1"in m&&l(2,i=m.u1),"u2"in m&&l(3,s=m.u2),"u3"in m&&l(4,a=m.u3),"ds"in m&&l(5,r=m.ds)},t.$$.update=()=>{if(t.$$.dirty&62){let m=[],_=[];i>0&&(m.push({label:r===1?"L1-L2":"L1"}),_.push(c(i))),s>0&&(m.push({label:r===1?"L1-L3":"L2"}),_.push(c(s))),a>0&&(m.push({label:r===1?"L2-L3":"L3"}),_.push(c(a))),l(0,f={title:n,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:m},points:_})}},[f,n,i,s,a,r]}class t0 extends Pt{constructor(e){super(),Nt(this,e,e0,x1,Mt,{title:1,u1:2,u2:3,u3:4,ds:5})}}function l0(t){var q,W,te,fe,_e;let e,l,n=(((q=t[0].reactive)==null?void 0:q.title)??"Reactive")+"",i,s,a,r,f=(((W=t[0].reactive)==null?void 0:W.instant_in)??"Instant in")+"",c,m,_,d=t[1][0]+"",h,b,g=t[1][1]+"",w,k,R,I=(((te=t[0].reactive)==null?void 0:te.instant_out)??"Instant out")+"",F,M,A,O=t[2][0]+"",j,Y,z=t[2][1]+"",T,B,X,y,K=(((fe=t[0].reactive)==null?void 0:fe.total_in)??"Total in")+"",V,U,G,se=t[3][0]+"",le,Q,ae=t[3][1]+"",re,ue,ne,pe=(((_e=t[0].reactive)==null?void 0:_e.total_out)??"Total out")+"",oe,J,$,ke=t[4][0]+"",Ce,D,S=t[4][1]+"",L;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),r=p("div"),c=C(f),m=v(),_=p("div"),h=C(d),b=v(),w=C(g),k=v(),R=p("div"),F=C(I),M=v(),A=p("div"),j=C(O),Y=v(),T=C(z),B=v(),X=p("div"),y=p("div"),V=C(K),U=v(),G=p("div"),le=C(se),Q=v(),re=C(ae),ue=v(),ne=p("div"),oe=C(pe),J=v(),$=p("div"),Ce=C(ke),D=v(),L=C(S),u(_,"class","text-right"),u(A,"class","text-right"),u(a,"class","grid grid-cols-2 mt-4"),u(G,"class","text-right"),u($,"class","text-right"),u(X,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(de,x){P(de,e,x),o(e,l),o(l,i),o(e,s),o(e,a),o(a,r),o(r,c),o(a,m),o(a,_),o(_,h),o(_,b),o(_,w),o(a,k),o(a,R),o(R,F),o(a,M),o(a,A),o(A,j),o(A,Y),o(A,T),o(e,B),o(e,X),o(X,y),o(y,V),o(X,U),o(X,G),o(G,le),o(G,Q),o(G,re),o(X,ue),o(X,ne),o(ne,oe),o(X,J),o(X,$),o($,Ce),o($,D),o($,L)},p(de,[x]){var he,be,Ae,Te,Oe;x&1&&n!==(n=(((he=de[0].reactive)==null?void 0:he.title)??"Reactive")+"")&&E(i,n),x&1&&f!==(f=(((be=de[0].reactive)==null?void 0:be.instant_in)??"Instant in")+"")&&E(c,f),x&2&&d!==(d=de[1][0]+"")&&E(h,d),x&2&&g!==(g=de[1][1]+"")&&E(w,g),x&1&&I!==(I=(((Ae=de[0].reactive)==null?void 0:Ae.instant_out)??"Instant out")+"")&&E(F,I),x&4&&O!==(O=de[2][0]+"")&&E(j,O),x&4&&z!==(z=de[2][1]+"")&&E(T,z),x&1&&K!==(K=(((Te=de[0].reactive)==null?void 0:Te.total_in)??"Total in")+"")&&E(V,K),x&8&&se!==(se=de[3][0]+"")&&E(le,se),x&8&&ae!==(ae=de[3][1]+"")&&E(re,ae),x&1&&pe!==(pe=(((Oe=de[0].reactive)==null?void 0:Oe.total_out)??"Total out")+"")&&E(oe,pe),x&16&&ke!==(ke=de[4][0]+"")&&E(Ce,ke),x&16&&S!==(S=de[4][1]+"")&&E(L,S)},i:Ye,o:Ye,d(de){de&&N(e)}}}function n0(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:s}=e,{exportTotal:a}=e,{translations:r={}}=e,f,c,m,_;return t.$$set=d=>{"importInstant"in d&&l(5,n=d.importInstant),"exportInstant"in d&&l(6,i=d.exportInstant),"importTotal"in d&&l(7,s=d.importTotal),"exportTotal"in d&&l(8,a=d.exportTotal),"translations"in d&&l(0,r=d.translations)},t.$$.update=()=>{t.$$.dirty&480&&(l(1,f=ul(n,"VAr")),l(2,c=ul(i,"VAr")),l(3,m=ul(s*1e3,"VArh")),l(4,_=ul(a*1e3,"VArh")))},[r,f,c,m,_,n,i,s,a]}class i0 extends Pt{constructor(e){super(),Nt(this,e,n0,l0,Mt,{importInstant:5,exportInstant:6,importTotal:7,exportTotal:8,translations:0})}}function Ys(t){let e;function l(s,a){return s[3]?o0:s0}let n=l(t),i=n(t);return{c(){i.c(),e=Ht()},m(s,a){i.m(s,a),P(s,e,a)},p(s,a){n===(n=l(s))&&i?i.p(s,a):(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},d(s){s&&N(e),i.d(s)}}}function s0(t){var W,te,fe,_e,de;let e,l=(((W=t[4].realtime)==null?void 0:W.consumption)??"Consumption")+"",n,i,s,a,r=$t(((te=t[4].common)==null?void 0:te.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",d,h,b=t[6][1]+"",g,w,k,R=$t(((fe=t[4].common)==null?void 0:fe.day)??"Day")+"",I,F,M,A=t[7][0]+"",O,j,Y=t[7][1]+"",z,T,B,X=$t(((_e=t[4].common)==null?void 0:_e.month)??"Month")+"",y,K,V,U=t[8][0]+"",G,se,le=t[8][1]+"",Q,ae,re,ue=(((de=t[4].realtime)==null?void 0:de.last_month)??"Last month")+"",ne,pe,oe,J=t[9][0]+"",$,ke,Ce=t[9][1]+"",D,S,L,q=t[5]&&Qs(t);return{c(){e=p("strong"),n=C(l),i=v(),s=p("div"),a=p("div"),f=C(r),c=v(),m=p("div"),d=C(_),h=v(),g=C(b),w=v(),k=p("div"),I=C(R),F=v(),M=p("div"),O=C(A),j=v(),z=C(Y),T=v(),B=p("div"),y=C(X),K=v(),V=p("div"),G=C(U),se=v(),Q=C(le),ae=v(),re=p("div"),ne=C(ue),pe=v(),oe=p("div"),$=C(J),ke=v(),D=C(Ce),S=v(),q&&q.c(),L=Ht(),u(m,"class","text-right"),u(M,"class","text-right"),u(V,"class","text-right"),u(oe,"class","text-right"),u(s,"class","grid grid-cols-2 mb-3")},m(x,he){P(x,e,he),o(e,n),P(x,i,he),P(x,s,he),o(s,a),o(a,f),o(s,c),o(s,m),o(m,d),o(m,h),o(m,g),o(s,w),o(s,k),o(k,I),o(s,F),o(s,M),o(M,O),o(M,j),o(M,z),o(s,T),o(s,B),o(B,y),o(s,K),o(s,V),o(V,G),o(V,se),o(V,Q),o(s,ae),o(s,re),o(re,ne),o(s,pe),o(s,oe),o(oe,$),o(oe,ke),o(oe,D),P(x,S,he),q&&q.m(x,he),P(x,L,he)},p(x,he){var be,Ae,Te,Oe,Ie;he&16&&l!==(l=(((be=x[4].realtime)==null?void 0:be.consumption)??"Consumption")+"")&&E(n,l),he&16&&r!==(r=$t(((Ae=x[4].common)==null?void 0:Ae.hour)??"Hour")+"")&&E(f,r),he&64&&_!==(_=x[6][0]+"")&&E(d,_),he&64&&b!==(b=x[6][1]+"")&&E(g,b),he&16&&R!==(R=$t(((Te=x[4].common)==null?void 0:Te.day)??"Day")+"")&&E(I,R),he&128&&A!==(A=x[7][0]+"")&&E(O,A),he&128&&Y!==(Y=x[7][1]+"")&&E(z,Y),he&16&&X!==(X=$t(((Oe=x[4].common)==null?void 0:Oe.month)??"Month")+"")&&E(y,X),he&256&&U!==(U=x[8][0]+"")&&E(G,U),he&256&&le!==(le=x[8][1]+"")&&E(Q,le),he&16&&ue!==(ue=(((Ie=x[4].realtime)==null?void 0:Ie.last_month)??"Last month")+"")&&E(ne,ue),he&512&&J!==(J=x[9][0]+"")&&E($,J),he&512&&Ce!==(Ce=x[9][1]+"")&&E(D,Ce),x[5]?q?q.p(x,he):(q=Qs(x),q.c(),q.m(L.parentNode,L)):q&&(q.d(1),q=null)},d(x){x&&(N(e),N(i),N(s),N(S),N(L)),q&&q.d(x)}}}function o0(t){var nt,ze,xt,el,tl,ll,nl,il,sl,Ze;let e,l=(((nt=t[4].common)==null?void 0:nt.import)??"Import")+"",n,i,s,a,r=$t(((ze=t[4].common)==null?void 0:ze.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",d,h,b=t[6][1]+"",g,w,k,R,I=$t(((xt=t[4].common)==null?void 0:xt.day)??"Day")+"",F,M,A,O=t[7][0]+"",j,Y,z=t[7][1]+"",T,B,X,y,K=$t(((el=t[4].common)==null?void 0:el.month)??"Month")+"",V,U,G,se=t[8][0]+"",le,Q,ae=t[8][1]+"",re,ue,ne,pe,oe=(((tl=t[4].realtime)==null?void 0:tl.last_mo)??"Last mo.")+"",J,$,ke,Ce=t[9][0]+"",D,S,L=t[9][1]+"",q,W,te,fe,_e,de=(((ll=t[4].common)==null?void 0:ll.export)??"Export")+"",x,he,be,Ae,Te=$t(((nl=t[4].common)==null?void 0:nl.hour)??"Hour")+"",Oe,Ie,De,Ue=t[10][0]+"",xe,wt,tt=t[10][1]+"",ot,St,dt,at,it=$t(((il=t[4].common)==null?void 0:il.day)??"Day")+"",ft,Ot,We,Re=t[11][0]+"",He,lt,ve=t[11][1]+"",Ee,Qe,me,we,ut=$t(((sl=t[4].common)==null?void 0:sl.month)??"Month")+"",Ge,Rt,bt,Be=t[12][0]+"",gt,ct,mt=t[12][1]+"",et,Tt,zt,kt,_t=(((Ze=t[4].realtime)==null?void 0:Ze.last_mo)??"Last mo.")+"",yt,Qt,Ft,jt=t[13][0]+"",Kt,Jt,Wt=t[13][1]+"",Lt,Fe,Xe,je=t[5]&&Xs(t),Et=t[5]&&Zs(t),Ut=t[5]&&Js(t),$e=t[5]&&$s(t),st=t[5]&&xs(t),qt=t[5]&&eo(t),pt=t[5]&&to(t),ge=t[5]&&lo(t);return{c(){e=p("strong"),n=C(l),i=v(),s=p("div"),a=p("div"),f=C(r),c=v(),m=p("div"),d=C(_),h=v(),g=C(b),w=v(),je&&je.c(),k=v(),R=p("div"),F=C(I),M=v(),A=p("div"),j=C(O),Y=v(),T=C(z),B=v(),Et&&Et.c(),X=v(),y=p("div"),V=C(K),U=v(),G=p("div"),le=C(se),Q=v(),re=C(ae),ue=v(),Ut&&Ut.c(),ne=v(),pe=p("div"),J=C(oe),$=v(),ke=p("div"),D=C(Ce),S=v(),q=C(L),W=v(),$e&&$e.c(),fe=v(),_e=p("strong"),x=C(de),he=v(),be=p("div"),Ae=p("div"),Oe=C(Te),Ie=v(),De=p("div"),xe=C(Ue),wt=v(),ot=C(tt),St=v(),st&&st.c(),dt=v(),at=p("div"),ft=C(it),Ot=v(),We=p("div"),He=C(Re),lt=v(),Ee=C(ve),Qe=v(),qt&&qt.c(),me=v(),we=p("div"),Ge=C(ut),Rt=v(),bt=p("div"),gt=C(Be),ct=v(),et=C(mt),Tt=v(),pt&&pt.c(),zt=v(),kt=p("div"),yt=C(_t),Qt=v(),Ft=p("div"),Kt=C(jt),Jt=v(),Lt=C(Wt),Fe=v(),ge&&ge.c(),u(m,"class","text-right"),u(A,"class","text-right"),u(G,"class","text-right"),u(ke,"class","text-right"),u(s,"class",te="grid grid-cols-"+t[14]+" mb-3"),u(De,"class","text-right"),u(We,"class","text-right"),u(bt,"class","text-right"),u(Ft,"class","text-right"),u(be,"class",Xe="grid grid-cols-"+t[14])},m(Se,ee){P(Se,e,ee),o(e,n),P(Se,i,ee),P(Se,s,ee),o(s,a),o(a,f),o(s,c),o(s,m),o(m,d),o(m,h),o(m,g),o(s,w),je&&je.m(s,null),o(s,k),o(s,R),o(R,F),o(s,M),o(s,A),o(A,j),o(A,Y),o(A,T),o(s,B),Et&&Et.m(s,null),o(s,X),o(s,y),o(y,V),o(s,U),o(s,G),o(G,le),o(G,Q),o(G,re),o(s,ue),Ut&&Ut.m(s,null),o(s,ne),o(s,pe),o(pe,J),o(s,$),o(s,ke),o(ke,D),o(ke,S),o(ke,q),o(s,W),$e&&$e.m(s,null),P(Se,fe,ee),P(Se,_e,ee),o(_e,x),P(Se,he,ee),P(Se,be,ee),o(be,Ae),o(Ae,Oe),o(be,Ie),o(be,De),o(De,xe),o(De,wt),o(De,ot),o(be,St),st&&st.m(be,null),o(be,dt),o(be,at),o(at,ft),o(be,Ot),o(be,We),o(We,He),o(We,lt),o(We,Ee),o(be,Qe),qt&&qt.m(be,null),o(be,me),o(be,we),o(we,Ge),o(be,Rt),o(be,bt),o(bt,gt),o(bt,ct),o(bt,et),o(be,Tt),pt&&pt.m(be,null),o(be,zt),o(be,kt),o(kt,yt),o(be,Qt),o(be,Ft),o(Ft,Kt),o(Ft,Jt),o(Ft,Lt),o(be,Fe),ge&&ge.m(be,null)},p(Se,ee){var Le,al,Xt,ml,pl,kl,wl,Cl,Sl,Ml;ee&16&&l!==(l=(((Le=Se[4].common)==null?void 0:Le.import)??"Import")+"")&&E(n,l),ee&16&&r!==(r=$t(((al=Se[4].common)==null?void 0:al.hour)??"Hour")+"")&&E(f,r),ee&64&&_!==(_=Se[6][0]+"")&&E(d,_),ee&64&&b!==(b=Se[6][1]+"")&&E(g,b),Se[5]?je?je.p(Se,ee):(je=Xs(Se),je.c(),je.m(s,k)):je&&(je.d(1),je=null),ee&16&&I!==(I=$t(((Xt=Se[4].common)==null?void 0:Xt.day)??"Day")+"")&&E(F,I),ee&128&&O!==(O=Se[7][0]+"")&&E(j,O),ee&128&&z!==(z=Se[7][1]+"")&&E(T,z),Se[5]?Et?Et.p(Se,ee):(Et=Zs(Se),Et.c(),Et.m(s,X)):Et&&(Et.d(1),Et=null),ee&16&&K!==(K=$t(((ml=Se[4].common)==null?void 0:ml.month)??"Month")+"")&&E(V,K),ee&256&&se!==(se=Se[8][0]+"")&&E(le,se),ee&256&&ae!==(ae=Se[8][1]+"")&&E(re,ae),Se[5]?Ut?Ut.p(Se,ee):(Ut=Js(Se),Ut.c(),Ut.m(s,ne)):Ut&&(Ut.d(1),Ut=null),ee&16&&oe!==(oe=(((pl=Se[4].realtime)==null?void 0:pl.last_mo)??"Last mo.")+"")&&E(J,oe),ee&512&&Ce!==(Ce=Se[9][0]+"")&&E(D,Ce),ee&512&&L!==(L=Se[9][1]+"")&&E(q,L),Se[5]?$e?$e.p(Se,ee):($e=$s(Se),$e.c(),$e.m(s,null)):$e&&($e.d(1),$e=null),ee&16384&&te!==(te="grid grid-cols-"+Se[14]+" mb-3")&&u(s,"class",te),ee&16&&de!==(de=(((kl=Se[4].common)==null?void 0:kl.export)??"Export")+"")&&E(x,de),ee&16&&Te!==(Te=$t(((wl=Se[4].common)==null?void 0:wl.hour)??"Hour")+"")&&E(Oe,Te),ee&1024&&Ue!==(Ue=Se[10][0]+"")&&E(xe,Ue),ee&1024&&tt!==(tt=Se[10][1]+"")&&E(ot,tt),Se[5]?st?st.p(Se,ee):(st=xs(Se),st.c(),st.m(be,dt)):st&&(st.d(1),st=null),ee&16&&it!==(it=$t(((Cl=Se[4].common)==null?void 0:Cl.day)??"Day")+"")&&E(ft,it),ee&2048&&Re!==(Re=Se[11][0]+"")&&E(He,Re),ee&2048&&ve!==(ve=Se[11][1]+"")&&E(Ee,ve),Se[5]?qt?qt.p(Se,ee):(qt=eo(Se),qt.c(),qt.m(be,me)):qt&&(qt.d(1),qt=null),ee&16&&ut!==(ut=$t(((Sl=Se[4].common)==null?void 0:Sl.month)??"Month")+"")&&E(Ge,ut),ee&4096&&Be!==(Be=Se[12][0]+"")&&E(gt,Be),ee&4096&&mt!==(mt=Se[12][1]+"")&&E(et,mt),Se[5]?pt?pt.p(Se,ee):(pt=to(Se),pt.c(),pt.m(be,zt)):pt&&(pt.d(1),pt=null),ee&16&&_t!==(_t=(((Ml=Se[4].realtime)==null?void 0:Ml.last_mo)??"Last mo.")+"")&&E(yt,_t),ee&8192&&jt!==(jt=Se[13][0]+"")&&E(Kt,jt),ee&8192&&Wt!==(Wt=Se[13][1]+"")&&E(Lt,Wt),Se[5]?ge?ge.p(Se,ee):(ge=lo(Se),ge.c(),ge.m(be,null)):ge&&(ge.d(1),ge=null),ee&16384&&Xe!==(Xe="grid grid-cols-"+Se[14])&&u(be,"class",Xe)},d(Se){Se&&(N(e),N(i),N(s),N(fe),N(_e),N(he),N(be)),je&&je.d(),Et&&Et.d(),Ut&&Ut.d(),$e&&$e.d(),st&&st.d(),qt&&qt.d(),pt&&pt.d(),ge&&ge.d()}}}function Qs(t){var $,ke,Ce,D,S,L;let e,l=((($=t[4].realtime)==null?void 0:$.cost)??"Cost")+"",n,i,s,a,r=$t(((ke=t[4].common)==null?void 0:ke.hour)??"Hour")+"",f,c,m,_=Vt(t[1].h.c,2)+"",d,h,b,g,w,k=$t(((Ce=t[4].common)==null?void 0:Ce.day)??"Day")+"",R,I,F,M=Vt(t[1].d.c,1)+"",A,O,j,Y,z,T=$t(((D=t[4].common)==null?void 0:D.month)??"Month")+"",B,X,y,K=Vt(t[1].m.c)+"",V,U,G,se,le,Q=(((S=t[4].realtime)==null?void 0:S.last_month)??"Last month")+"",ae,re,ue,ne=Vt((L=t[0].last_month)==null?void 0:L.c)+"",pe,oe,J;return{c(){e=p("strong"),n=C(l),i=v(),s=p("div"),a=p("div"),f=C(r),c=v(),m=p("div"),d=C(_),h=v(),b=C(t[2]),g=v(),w=p("div"),R=C(k),I=v(),F=p("div"),A=C(M),O=v(),j=C(t[2]),Y=v(),z=p("div"),B=C(T),X=v(),y=p("div"),V=C(K),U=v(),G=C(t[2]),se=v(),le=p("div"),ae=C(Q),re=v(),ue=p("div"),pe=C(ne),oe=v(),J=C(t[2]),u(m,"class","text-right"),u(F,"class","text-right"),u(y,"class","text-right"),u(ue,"class","text-right"),u(s,"class","grid grid-cols-2")},m(q,W){P(q,e,W),o(e,n),P(q,i,W),P(q,s,W),o(s,a),o(a,f),o(s,c),o(s,m),o(m,d),o(m,h),o(m,b),o(s,g),o(s,w),o(w,R),o(s,I),o(s,F),o(F,A),o(F,O),o(F,j),o(s,Y),o(s,z),o(z,B),o(s,X),o(s,y),o(y,V),o(y,U),o(y,G),o(s,se),o(s,le),o(le,ae),o(s,re),o(s,ue),o(ue,pe),o(ue,oe),o(ue,J)},p(q,W){var te,fe,_e,de,x,he;W&16&&l!==(l=(((te=q[4].realtime)==null?void 0:te.cost)??"Cost")+"")&&E(n,l),W&16&&r!==(r=$t(((fe=q[4].common)==null?void 0:fe.hour)??"Hour")+"")&&E(f,r),W&2&&_!==(_=Vt(q[1].h.c,2)+"")&&E(d,_),W&4&&E(b,q[2]),W&16&&k!==(k=$t(((_e=q[4].common)==null?void 0:_e.day)??"Day")+"")&&E(R,k),W&2&&M!==(M=Vt(q[1].d.c,1)+"")&&E(A,M),W&4&&E(j,q[2]),W&16&&T!==(T=$t(((de=q[4].common)==null?void 0:de.month)??"Month")+"")&&E(B,T),W&2&&K!==(K=Vt(q[1].m.c)+"")&&E(V,K),W&4&&E(G,q[2]),W&16&&Q!==(Q=(((x=q[4].realtime)==null?void 0:x.last_month)??"Last month")+"")&&E(ae,Q),W&1&&ne!==(ne=Vt((he=q[0].last_month)==null?void 0:he.c)+"")&&E(pe,ne),W&4&&E(J,q[2])},d(q){q&&(N(e),N(i),N(s))}}}function Xs(t){let e,l=Vt(t[1].h.c,2)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Vt(a[1].h.c,2)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&N(e)}}}function Zs(t){let e,l=Vt(t[1].d.c,1)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Vt(a[1].d.c,1)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&N(e)}}}function Js(t){let e,l=Vt(t[1].m.c)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Vt(a[1].m.c)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&N(e)}}}function $s(t){var a;let e,l=Vt((a=t[0].last_month)==null?void 0:a.c)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(r,f){P(r,e,f),o(e,n),o(e,i),o(e,s)},p(r,f){var c;f&1&&l!==(l=Vt((c=r[0].last_month)==null?void 0:c.c)+"")&&E(n,l),f&4&&E(s,r[2])},d(r){r&&N(e)}}}function xs(t){let e,l=Vt(t[1].h.i,2)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Vt(a[1].h.i,2)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&N(e)}}}function eo(t){let e,l=Vt(t[1].d.i,1)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Vt(a[1].d.i,1)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&N(e)}}}function to(t){let e,l=Vt(t[1].m.i)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Vt(a[1].m.i)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&N(e)}}}function lo(t){var a;let e,l=Vt((a=t[0].last_month)==null?void 0:a.i)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(r,f){P(r,e,f),o(e,n),o(e,i),o(e,s)},p(r,f){var c;f&1&&l!==(l=Vt((c=r[0].last_month)==null?void 0:c.i)+"")&&E(n,l),f&4&&E(s,r[2])},d(r){r&&N(e)}}}function a0(t){var m;let e,l,n=(((m=t[4].realtime)==null?void 0:m.title)??"Real time calculations")+"",i,s,a,r,f,c=t[1]&&Ys(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("br"),r=p("br"),f=v(),c&&c.c(),u(e,"class","mx-2 text-sm")},m(_,d){P(_,e,d),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),c&&c.m(e,null)},p(_,[d]){var h;d&16&&n!==(n=(((h=_[4].realtime)==null?void 0:h.title)??"Real time calculations")+"")&&E(i,n),_[1]?c?c.p(_,d):(c=Ys(_),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:Ye,o:Ye,d(_){_&&N(e),c&&c.d()}}}function f0(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:s}=e,{hasExport:a}=e,{translations:r={}}=e,f,c,m,_,d,h,b,g,w=!1,k=3;return t.$$set=R=>{"sysinfo"in R&&l(0,n=R.sysinfo),"data"in R&&l(1,i=R.data),"currency"in R&&l(2,s=R.currency),"hasExport"in R&&l(3,a=R.hasExport),"translations"in R&&l(4,r=R.translations)},t.$$.update=()=>{var R,I,F,M,A,O,j,Y;t.$$.dirty&35&&(l(5,w=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(14,k=w?3:2),l(6,f=ul(((R=i==null?void 0:i.h)==null?void 0:R.u)*1e3,"Wh")),l(7,c=ul(((I=i==null?void 0:i.d)==null?void 0:I.u)*1e3,"Wh")),l(8,m=ul(((F=i==null?void 0:i.m)==null?void 0:F.u)*1e3,"Wh")),l(9,_=ul(((M=n==null?void 0:n.last_month)==null?void 0:M.u)*1e3,"Wh")),l(10,d=ul(((A=i==null?void 0:i.h)==null?void 0:A.p)*1e3,"Wh")),l(11,h=ul(((O=i==null?void 0:i.d)==null?void 0:O.p)*1e3,"Wh")),l(12,b=ul(((j=i==null?void 0:i.m)==null?void 0:j.p)*1e3,"Wh")),l(13,g=ul(((Y=n==null?void 0:n.last_month)==null?void 0:Y.p)*1e3,"Wh")))},[n,i,s,a,r,w,f,c,m,_,d,h,b,g,k]}class u0 extends Pt{constructor(e){super(),Nt(this,e,f0,a0,Mt,{sysinfo:0,data:1,currency:2,hasExport:3,translations:4})}}function r0(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function c0(t,e,l){let{title:n}=e,{json:i}=e,{sysinfo:s}=e,a={},r,f,c=document.documentElement.classList.contains("dark");return t.$$set=m=>{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,s=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=i.currency,_=new Date().getUTCHours(),d=0,h=0,b=0,g=[],w=[],k=[];l(5,f=l(4,r=0));let R=new Date;for(Ol(R,s.clock_offset-(24+R.getHours()-R.getUTCHours())%24),d=_;d<24&&(h=i[Ct(b++)],h!=null);d++)w.push({label:Ct(R.getHours())}),k.push(h*100),l(5,f=Math.min(f,h*100)),l(4,r=Math.max(r,h*100)),Ol(R,1);for(d=0;d<24&&(h=i[Ct(b++)],h!=null);d++)w.push({label:Ct(R.getHours())}),k.push(h*100),l(5,f=Math.min(f,h*100)),l(4,r=Math.max(r,h*100)),Ol(R,1);let I=Gn(Math.max(Math.abs(f)/100,Math.abs(r)/100),m);if(I&&I[1]&&I[1]!=m)for(m=I[1],l(5,f*=100),l(4,r*=100),d=0;d=0?j.toFixed(Y):"",title:j>=0?j.toFixed(2)+" "+m:"",value:h>=0?Math.abs(h):0,label2:j<0?j.toFixed(Y):"",title2:j<0?j.toFixed(2)+" "+m:"",value2:h<0?Math.abs(h):0,color:c?"#5c2da5":"#7c3aed"})}let M=Math.max(r,Math.abs(f));if(f<0){l(5,f=Math.min(M/4*-1,f));let j=Math.ceil(Math.abs(f)/M*4),Y=f/j;for(d=1;d{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,s=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],d=[],h=[];l(5,f=l(4,r=0));let b=new Date,g=new Date;g.setDate(0),g.setHours(12);let w=(g.getHours()-g.getUTCHours())%24-s.clock_offset,k=b.getUTCHours();for(Ol(b,-w-24),m=k;m<24;m++){let M=i["i"+Ct(m)],A=i["e"+Ct(m)];M===void 0&&(M=0),A===void 0&&(A=0),d.push({label:Ct(b.getHours())}),h.push({label:M.toFixed(1),title:M.toFixed(2)+" kWh",value:M*10,label2:A.toFixed(1),title2:A.toFixed(2)+" kWh",value2:A*10,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,A*10)),l(4,r=Math.max(r,M*10)),Ol(b,1)}for(m=0;m{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,s=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],d=[],h=[];l(5,f=l(4,r=0));let b=new Date,g=new Date;g.setDate(0),g.setHours(12);let w=(g.getHours()-g.getUTCHours())%24-s.clock_offset;for(Ol(b,-w),Ol(g,-w),m=b.getDate();m<=g.getDate();m++){let F=i["i"+Ct(m)],M=i["e"+Ct(m)];F===void 0&&(F=0),M===void 0&&(M=0),d.push({label:Ct(m)}),h.push({label:F.toFixed(F<10?1:0),title:F.toFixed(2)+" kWh",value:F,label2:M.toFixed(M<10?1:0),title2:M.toFixed(2)+" kWh",value2:M,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,M)),l(4,r=Math.max(r,F))}for(m=1;m{"title"in c&&l(1,n=c.title),"json"in c&&l(2,i=c.json)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,m=0,_=[],d=[],h=[];i.s&&i.s.forEach((w,k)=>{var R=w.n?w.n:w.a;m=w.v,m==-127&&(m=0),d.push({label:R.slice(-4)}),h.push({label:m.toFixed(1),value:m,color:s?"#5c2da5":"#7c3aed"}),l(4,f=Math.min(f,m)),l(3,r=Math.max(r,m))}),l(3,r=Math.ceil(r)),l(4,f=Math.floor(f));let b=r;f<0&&(b+=Math.abs(f));let g=b/4;for(c=0;c<5;c++)m=f+g*c,_.push({value:m,label:m.toFixed(1)});l(0,a={title:n+" (°C)",dark:document.documentElement.classList.contains("dark"),height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:f,max:r,ticks:_},x:{ticks:d},points:h})}},[a,n,i,r,f]}class w0 extends Pt{constructor(e){super(),Nt(this,e,k0,g0,Mt,{title:1,json:2})}}function C0(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}let S0=0;function M0(t,e,l){let{title:n}=e,{translations:i={}}=e,s=document.documentElement.classList.contains("dark"),a={},r=0,{tariffData:f}=e;return t.$$set=c=>{"title"in c&&l(1,n=c.title),"translations"in c&&l(2,i=c.translations),"tariffData"in c&&l(3,f=c.tariffData)},t.$$.update=()=>{var c;if(t.$$.dirty&30){let m=0,_=[],d=[],h=[];if(_.push({value:0,label:0}),f&&f.p)for(m=0;m0?Ct(b.d)+"."+(i.months?(c=i.months)==null?void 0:c[new Date().getMonth()]:Ct(new Date().getMonth()+1)):"-"}),l(4,r=Math.max(r,b.v))}if(f&&f.t){for(m=0;m=r)break;_.push({value:b,label:b})}_.push({label:f.m.toFixed(1),align:"right",color:"green",value:f.m})}f&&f.c&&(_.push({label:f.c.toFixed(0),color:"orange",value:f.c}),l(4,r=Math.max(r,f.c))),l(4,r=Math.ceil(r)),l(0,a={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:35,bottom:20,left:35},y:{min:S0,max:r,ticks:_},x:{ticks:d},points:h})}},[a,n,i,f,r]}class N0 extends Pt{constructor(e){super(),Nt(this,e,M0,C0,Mt,{title:1,translations:2,tariffData:3})}}let an=0,P0={data:[]};async function xi(){let e=await(await bl(an<0?"realtime.json":"realtime.json?offset="+an)).json();es.update(l=>{for(let n=0;n=0&&(an+=e.size,ankn||Ri-kn>300?(xi(),ki=0):es.update(t=>{if(t.lastUpdate)for(;kn>t.lastUpdate;)t.data.unshift(Eu),t.data=t.data.slice(0,t.size),t.lastUpdate+=10,ki++;else t.lastUpdate=kn;return t})}function E0(t){if(Eu=t.i-t.e,kn=t.u,!no){xi(),no=!0,Ri=kn;return}T0()&&q0()}function io(t,e,l){const n=t.slice();return n[18]=e[l],n[20]=l,n}function so(t,e,l){const n=t.slice();return n[21]=e[l],n}function D0(t){let e,l,n;return{c(){e=p("strong"),l=C(t[0]),n=C(" not available"),u(e,"class","text-sm")},m(i,s){P(i,e,s),o(e,l),o(e,n)},p(i,s){s&1&&E(l,i[0])},d(i){i&&N(e)}}}function A0(t){let e,l,n,i,s,a,r,f=t[8]&&oo(t);return{c(){e=p("strong"),l=C(t[0]),n=C(" ("),i=C(t[12]),s=C(")"),a=v(),f&&f.c(),r=Ht(),u(e,"class","text-sm")},m(c,m){P(c,e,m),o(e,l),o(e,n),o(e,i),o(e,s),P(c,a,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&1&&E(l,c[0]),m&4096&&E(i,c[12]),c[8]?f?f.p(c,m):(f=oo(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(a),N(r)),f&&f.d(c)}}}function oo(t){let e,l,n,i,s,a=rt(t[8]),r=[];for(let m=0;mt[17].call(e))},m(a,r){P(a,e,r),s.m(e,null),l=Vi(e,t[17].bind(e))},p(a,[r]){i===(i=n(a))&&s?s.p(a,r):(s.d(1),s=i(a),s&&(s.c(),s.m(e,null)))},i:Ye,o:Ye,d(a){a&&N(e),s.d(),l()}}}function L0(t,e,l){let{title:n}=e,i=document.documentElement.classList.contains("dark"),s=null;es.subscribe(M=>{l(16,s=M)});let a=!1,r,f,c,m,_,d,h,b=function(M,A,O){return Math.ceil(_-(M-A)/(O-A)*_)-25},g=function(M){return 30+Math.ceil(M/s.size*(d-35))},w,k,R,I;function F(){c=this.clientWidth,m=this.clientHeight,l(3,c),l(4,m)}return t.$$set=M=>{"title"in M&&l(0,n=M.title)},t.$$.update=()=>{if(t.$$.dirty&67582)if(l(5,_=parseInt(m)-50),l(6,d=c-35),l(10,R=d/s.size),l(2,f=0),l(1,r=0),s.data&&_>10&&d>100&&R>.1){l(11,a=!0);for(let O in s.data){let j=s.data[O];isNaN(j)&&(j=0),l(1,r=Math.max(Math.ceil(j/1e3)*1e3,r)),l(2,f=Math.min(Math.floor(j/1e3)*1e3,f))}let M=r-f;l(12,I=r>2500?"kW":"W"),l(8,w=[]);for(let O=f;O2500?(O/1e3).toFixed(1):O}),!(w.length>6));O+=M/5);l(9,k=[]);for(let O=0;O12));O+=Math.round(s.size/Math.round(d/120)));let A=s.size;l(7,h=g(s.size)+","+b(0,f,r)+" "+g(1)+","+b(0,f,r));for(let O in s.data){if(A<0)break;let j=s.data[O];isNaN(j)&&(j=0),l(7,h=g(A--)+","+b(j,f,r)+" "+h)}}else l(11,a=!1)},[n,r,f,c,m,_,d,h,w,k,R,a,I,i,b,g,s,F]}class I0 extends Pt{constructor(e){super(),Nt(this,e,L0,O0,Mt,{title:0})}}function R0(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function F0(t,e,l){let{title:n}=e,{unit:i=""}=e,{l1:s=!1}=e,{l2:a=!1}=e,{l2x:r=!1}=e,{l3:f=!1}=e,{l1i:c=0}=e,{l2i:m=0}=e,{l3i:_=0}=e,{l1e:d=0}=e,{l2e:h=0}=e,{l3e:b=0}=e,{maxImport:g=0}=e,{maxExport:w=0}=e,{importColorFn:k}=e,{exportColorFn:R}=e,I={};function F(M,A){return{label:Vt(M>900?M/1e3:M)+(M>900?"k":"")+i,title:M.toFixed(2)+" "+i,value:isNaN(M)?0:M,color:k(M?M/g*100:0,document.documentElement.classList.contains("dark")),label2:Vt(A>900?A/1e3:A)+(A>900?"k":"")+i,title2:A.toFixed(2)+" "+i,value2:isNaN(A)?0:A,color2:R(A?A/w*100:0)}}return t.$$set=M=>{"title"in M&&l(1,n=M.title),"unit"in M&&l(2,i=M.unit),"l1"in M&&l(3,s=M.l1),"l2"in M&&l(4,a=M.l2),"l2x"in M&&l(5,r=M.l2x),"l3"in M&&l(6,f=M.l3),"l1i"in M&&l(7,c=M.l1i),"l2i"in M&&l(8,m=M.l2i),"l3i"in M&&l(9,_=M.l3i),"l1e"in M&&l(10,d=M.l1e),"l2e"in M&&l(11,h=M.l2e),"l3e"in M&&l(12,b=M.l3e),"maxImport"in M&&l(13,g=M.maxImport),"maxExport"in M&&l(14,w=M.maxExport),"importColorFn"in M&&l(15,k=M.importColorFn),"exportColorFn"in M&&l(16,R=M.exportColorFn)},t.$$.update=()=>{if(t.$$.dirty&32762){let M=[],A=[];s&&(M.push({label:"L1"}),A.push(F(c,d))),a&&(r?(M.push({label:"L2"}),A.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(M.push({label:"L2"}),A.push(F(m,h)))),f&&(M.push({label:"L3"}),A.push(F(_,b)));let O=[];if(w){let j=w>g?4:w*4/g;O.push({value:-w,label:"-100%"}),j>=4&&O.push({value:-w/4*3,label:"-75%"}),j>=2&&O.push({value:-w/2,label:"-50%"}),j>=4&&O.push({value:-w/4,label:"-25%"})}if(O.push({value:0,label:"0%"}),g){let j=g>w?4:g*4/w;O.push({value:g/4,label:"25%"}),j>=4&&O.push({value:g/2,label:"50%"}),j>=2&&O.push({value:g/4*3,label:"75%"}),j>=4&&O.push({value:g,label:"100%"})}l(0,I={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:15,bottom:20,left:35},y:{min:-w,max:g,ticks:O},x:{ticks:M},points:A})}},[I,n,i,s,a,r,f,c,m,_,d,h,b,g,w,k,R]}class ts extends Pt{constructor(e){super(),Nt(this,e,F0,R0,Mt,{title:1,unit:2,l1:3,l2:4,l2x:5,l3:6,l1i:7,l2i:8,l3i:9,l1e:10,l2e:11,l3e:12,maxImport:13,maxExport:14,importColorFn:15,exportColorFn:16})}}function co(t){var k;let e,l,n,i,s,a,r=(t[0].mt?ui(t[0].mt):"-")+"",f,c,m,_=t[11][0]+"",d,h,b=t[11][1]+"",g,w;return i=new qu({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:((k=t[6].common)==null?void 0:k.import)??"Import",sub:Gn(t[0].p,t[0].pc),colorFn:Zi}}),{c(){e=p("div"),l=p("div"),n=p("div"),Pe(i.$$.fragment),s=v(),a=p("div"),f=C(r),c=v(),m=p("div"),d=C(_),h=v(),g=C(b),u(n,"class","col-span-2"),u(m,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(R,I){P(R,e,I),o(e,l),o(l,n),Me(i,n,null),o(l,s),o(l,a),o(a,f),o(l,c),o(l,m),o(m,d),o(m,h),o(m,g),w=!0},p(R,I){var M;const F={};I&1&&(F.val=R[0].i?R[0].i:0),I&1&&(F.max=R[0].im?R[0].im:15e3),I&64&&(F.label=((M=R[6].common)==null?void 0:M.import)??"Import"),I&1&&(F.sub=Gn(R[0].p,R[0].pc)),i.$set(F),(!w||I&1)&&r!==(r=(R[0].mt?ui(R[0].mt):"-")+"")&&E(f,r),(!w||I&2048)&&_!==(_=R[11][0]+"")&&E(d,_),(!w||I&2048)&&b!==(b=R[11][1]+"")&&E(g,b)},i(R){w||(Z(i.$$.fragment,R),w=!0)},o(R){ie(i.$$.fragment,R),w=!1},d(R){R&&N(e),Ne(i)}}}function _o(t){var g;let e,l,n,i,s,a,r,f,c=t[12][0]+"",m,_,d=t[12][1]+"",h,b;return i=new qu({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:((g=t[6].common)==null?void 0:g.export)??"Export",sub:Gn(t[0].px,t[0].pc),colorFn:zn}}),{c(){e=p("div"),l=p("div"),n=p("div"),Pe(i.$$.fragment),s=v(),a=p("div"),r=v(),f=p("div"),m=C(c),_=v(),h=C(d),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(w,k){P(w,e,k),o(e,l),o(l,n),Me(i,n,null),o(l,s),o(l,a),o(l,r),o(l,f),o(f,m),o(f,_),o(f,h),b=!0},p(w,k){var I;const R={};k&1&&(R.val=w[0].e?w[0].e:0),k&1&&(R.max=w[0].om?w[0].om*1e3:1e4),k&64&&(R.label=((I=w[6].common)==null?void 0:I.export)??"Export"),k&1&&(R.sub=Gn(w[0].px,w[0].pc)),i.$set(R),(!b||k&4096)&&c!==(c=w[12][0]+"")&&E(m,c),(!b||k&4096)&&d!==(d=w[12][1]+"")&&E(h,d)},i(w){b||(Z(i.$$.fragment,w),b=!0)},o(w){ie(i.$$.fragment,w),b=!1},d(w){w&&N(e),Ne(i)}}}function mo(t){let e,l,n=t[0].l1&&po(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=po(i),n.c(),Z(n,1),n.m(e,null)):n&&(ht(),ie(n,1,1,()=>{n=null}),vt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function po(t){var n;let e,l;return e=new t0({props:{title:((n=t[6].common)==null?void 0:n.voltage)??"Volt",u1:t[0].l1.u,u2:t[0].l2.u,u3:t[0].l3.u,ds:t[0].ds}}),{c(){Pe(e.$$.fragment)},m(i,s){Me(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].common)==null?void 0:r.voltage)??"Volt"),s&1&&(a.u1=i[0].l1.u),s&1&&(a.u2=i[0].l2.u),s&1&&(a.u3=i[0].l3.u),s&1&&(a.ds=i[0].ds),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Ne(e,i)}}}function ho(t){let e,l,n=t[0].l1&&vo(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=vo(i),n.c(),Z(n,1),n.m(e,null)):n&&(ht(),ie(n,1,1,()=>{n=null}),vt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function vo(t){var n;let e,l;return e=new ts({props:{title:((n=t[6].common)==null?void 0:n.amperage)??"Amp",unit:"A",importColorFn:Zi,exportColorFn:zn,maxImport:t[0].mf,l1:t[8],l2:t[9],l3:t[10],l2x:t[0].l2.e,l1i:Math.max(Math.abs(t[0].l1.i),0),l2i:Math.max(Math.abs(t[0].l2.i),0),l3i:Math.max(Math.abs(t[0].l3.i),0)}}),{c(){Pe(e.$$.fragment)},m(i,s){Me(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].common)==null?void 0:r.amperage)??"Amp"),s&1&&(a.maxImport=i[0].mf),s&256&&(a.l1=i[8]),s&512&&(a.l2=i[9]),s&1024&&(a.l3=i[10]),s&1&&(a.l2x=i[0].l2.e),s&1&&(a.l1i=Math.max(Math.abs(i[0].l1.i),0)),s&1&&(a.l2i=Math.max(Math.abs(i[0].l2.i),0)),s&1&&(a.l3i=Math.max(Math.abs(i[0].l3.i),0)),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Ne(e,i)}}}function bo(t){let e,l,n=t[0].l1&&go(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=go(i),n.c(),Z(n,1),n.m(e,null)):n&&(ht(),ie(n,1,1,()=>{n=null}),vt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function go(t){var n;let e,l;return e=new ts({props:{title:((n=t[6].dashboard)==null?void 0:n.phase)??"Phase",unit:"W",importColorFn:Zi,exportColorFn:zn,maxImport:(t[0].mf?t[0].mf:32)*230,maxExport:t[0].om?t[13]?t[0].om*1e3/Math.sqrt(3):t[0].om*1e3:0,l1:t[8],l2:t[9],l3:t[10],l1i:t[0].l1.p,l2i:t[0].l2.p,l3i:t[0].l3.p,l1e:t[0].l1.q,l2e:t[0].l2.q,l3e:t[0].l3.q}}),{c(){Pe(e.$$.fragment)},m(i,s){Me(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].dashboard)==null?void 0:r.phase)??"Phase"),s&1&&(a.maxImport=(i[0].mf?i[0].mf:32)*230),s&8193&&(a.maxExport=i[0].om?i[13]?i[0].om*1e3/Math.sqrt(3):i[0].om*1e3:0),s&256&&(a.l1=i[8]),s&512&&(a.l2=i[9]),s&1024&&(a.l3=i[10]),s&1&&(a.l1i=i[0].l1.p),s&1&&(a.l2i=i[0].l2.p),s&1&&(a.l3i=i[0].l3.p),s&1&&(a.l1e=i[0].l1.q),s&1&&(a.l2e=i[0].l2.q),s&1&&(a.l3e=i[0].l3.q),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Ne(e,i)}}}function ko(t){let e,l,n=t[0].l1&&wo(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=wo(i),n.c(),Z(n,1),n.m(e,null)):n&&(ht(),ie(n,1,1,()=>{n=null}),vt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function wo(t){var n;let e,l;return e=new ts({props:{title:((n=t[6].dashboard)==null?void 0:n.pf)??"Pf",importColorFn:zn,exportColorFn:zn,maxImport:1,l1:t[8],l2:t[9],l3:t[10],l1i:t[0].l1.f,l2i:t[0].l2.f,l3i:t[0].l3.f}}),{c(){Pe(e.$$.fragment)},m(i,s){Me(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].dashboard)==null?void 0:r.pf)??"Pf"),s&256&&(a.l1=i[8]),s&512&&(a.l2=i[9]),s&1024&&(a.l3=i[10]),s&1&&(a.l1i=i[0].l1.f),s&1&&(a.l2i=i[0].l2.f),s&1&&(a.l3i=i[0].l3.f),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Ne(e,i)}}}function Co(t){let e,l,n;return l=new i0({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec,translations:t[6]}}),{c(){e=p("div"),Pe(l.$$.fragment),u(e,"class","cnt")},m(i,s){P(i,e,s),Me(l,e,null),n=!0},p(i,s){const a={};s&1&&(a.importInstant=i[0].ri),s&1&&(a.exportInstant=i[0].re),s&1&&(a.importTotal=i[0].ric),s&1&&(a.exportTotal=i[0].rec),s&64&&(a.translations=i[6]),l.$set(a)},i(i){n||(Z(l.$$.fragment,i),n=!0)},o(i){ie(l.$$.fragment,i),n=!1},d(i){i&&N(e),Ne(l)}}}function So(t){let e,l,n;return l=new u0({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0,translations:t[6]}}),{c(){e=p("div"),Pe(l.$$.fragment),u(e,"class","cnt")},m(i,s){P(i,e,s),Me(l,e,null),n=!0},p(i,s){const a={};s&2&&(a.sysinfo=i[1]),s&1&&(a.data=i[0].ea),s&1&&(a.currency=i[0].pc),s&1&&(a.hasExport=i[0].om>0||i[0].e>0),s&64&&(a.translations=i[6]),l.$set(a)},i(i){n||(Z(l.$$.fragment,i),n=!0)},o(i){ie(l.$$.fragment,i),n=!1},d(i){i&&N(e),Ne(l)}}}function Mo(t){var i;let e,l,n;return l=new N0({props:{title:((i=t[6].dashboard)==null?void 0:i.tariffpeak)??"Tariff peaks",tariffData:t[7],translations:t[6]}}),{c(){e=p("div"),Pe(l.$$.fragment),u(e,"class","cnt h-64")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.tariffpeak)??"Tariff peaks"),a&128&&(r.tariffData=s[7]),a&64&&(r.translations=s[6]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&N(e),Ne(l)}}}function No(t){var i;let e,l,n;return l=new I0({props:{title:((i=t[6].dashboard)==null?void 0:i.realtime)??"Real time"}}),{c(){e=p("div"),Pe(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.realtime)??"Real time"),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&N(e),Ne(l)}}}function Po(t){var i;let e,l,n;return l=new _0({props:{title:((i=t[6].dashboard)==null?void 0:i.price)??"Price",json:t[2],sysinfo:t[1]}}),{c(){e=p("div"),Pe(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.price)??"Price"),a&4&&(r.json=s[2]),a&2&&(r.sysinfo=s[1]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&N(e),Ne(l)}}}function To(t){var i;let e,l,n;return l=new d0({props:{title:((i=t[6].dashboard)==null?void 0:i.day)??"24 hours",json:t[3],sysinfo:t[1]}}),{c(){e=p("div"),Pe(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.day)??"24 hours"),a&8&&(r.json=s[3]),a&2&&(r.sysinfo=s[1]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&N(e),Ne(l)}}}function qo(t){var i;let e,l,n;return l=new b0({props:{title:((i=t[6].dashboard)==null?void 0:i.month)??"{0} days",json:t[4],sysinfo:t[1]}}),{c(){e=p("div"),Pe(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.month)??"{0} days"),a&16&&(r.json=s[4]),a&2&&(r.sysinfo=s[1]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&N(e),Ne(l)}}}function Eo(t){var i;let e,l,n;return l=new w0({props:{title:((i=t[6].dashboard)==null?void 0:i.temperature)??"Temperature",json:t[5]}}),{c(){e=p("div"),Pe(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.temperature)??"Temperature"),a&32&&(r.json=s[5]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&N(e),Ne(l)}}}function U0(t){let e,l=Yt(t[1].ui.i,t[0].i),n,i=Yt(t[1].ui.e,t[0].om||t[0].e>0),s,a=Yt(t[1].ui.v,t[0].l1&&(t[0].l1.u>100||t[0].l2.u>100||t[0].l3.u>100)),r,f=Yt(t[1].ui.a,t[0].l1&&(t[0].l1.i>.01||t[0].l2.i>.01||t[0].l3.i>.01)),c,m=Yt(t[1].ui.h,t[0].l1&&(t[0].l1.p>.01||t[0].l2.p>.01||t[0].l3.p>.01||t[0].l1.q>.01||t[0].l2.q>.01||t[0].l3.q>.01)),_,d=Yt(t[1].ui.f,t[0].l1&&(t[0].l1.f>.01||t[0].l2.f>.01||t[0].l3.f>.01)),h,b=Yt(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),g,w=Yt(t[1].ui.c,t[0].ea),k,R=Yt(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("NO")||t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),I,F=Yt(t[1].ui.l,t[0].hm==1),M,A=Yt(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),O,j=Yt(t[1].ui.d,t[3]),Y,z=Yt(t[1].ui.m,t[4]),T,B=Yt(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),X,y=l&&co(t),K=i&&_o(t),V=a&&mo(t),U=f&&ho(t),G=m&&bo(t),se=d&&ko(t),le=b&&Co(t),Q=w&&So(t),ae=R&&Mo(t),re=F&&No(t),ue=A&&Po(t),ne=j&&To(t),pe=z&&qo(t),oe=B&&Eo(t);return{c(){e=p("div"),y&&y.c(),n=v(),K&&K.c(),s=v(),V&&V.c(),r=v(),U&&U.c(),c=v(),G&&G.c(),_=v(),se&&se.c(),h=v(),le&&le.c(),g=v(),Q&&Q.c(),k=v(),ae&&ae.c(),I=v(),re&&re.c(),M=v(),ue&&ue.c(),O=v(),ne&&ne.c(),Y=v(),pe&&pe.c(),T=v(),oe&&oe.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,$){P(J,e,$),y&&y.m(e,null),o(e,n),K&&K.m(e,null),o(e,s),V&&V.m(e,null),o(e,r),U&&U.m(e,null),o(e,c),G&&G.m(e,null),o(e,_),se&&se.m(e,null),o(e,h),le&&le.m(e,null),o(e,g),Q&&Q.m(e,null),o(e,k),ae&&ae.m(e,null),o(e,I),re&&re.m(e,null),o(e,M),ue&&ue.m(e,null),o(e,O),ne&&ne.m(e,null),o(e,Y),pe&&pe.m(e,null),o(e,T),oe&&oe.m(e,null),X=!0},p(J,[$]){$&3&&(l=Yt(J[1].ui.i,J[0].i)),l?y?(y.p(J,$),$&3&&Z(y,1)):(y=co(J),y.c(),Z(y,1),y.m(e,n)):y&&(ht(),ie(y,1,1,()=>{y=null}),vt()),$&3&&(i=Yt(J[1].ui.e,J[0].om||J[0].e>0)),i?K?(K.p(J,$),$&3&&Z(K,1)):(K=_o(J),K.c(),Z(K,1),K.m(e,s)):K&&(ht(),ie(K,1,1,()=>{K=null}),vt()),$&3&&(a=Yt(J[1].ui.v,J[0].l1&&(J[0].l1.u>100||J[0].l2.u>100||J[0].l3.u>100))),a?V?(V.p(J,$),$&3&&Z(V,1)):(V=mo(J),V.c(),Z(V,1),V.m(e,r)):V&&(ht(),ie(V,1,1,()=>{V=null}),vt()),$&3&&(f=Yt(J[1].ui.a,J[0].l1&&(J[0].l1.i>.01||J[0].l2.i>.01||J[0].l3.i>.01))),f?U?(U.p(J,$),$&3&&Z(U,1)):(U=ho(J),U.c(),Z(U,1),U.m(e,c)):U&&(ht(),ie(U,1,1,()=>{U=null}),vt()),$&3&&(m=Yt(J[1].ui.h,J[0].l1&&(J[0].l1.p>.01||J[0].l2.p>.01||J[0].l3.p>.01||J[0].l1.q>.01||J[0].l2.q>.01||J[0].l3.q>.01))),m?G?(G.p(J,$),$&3&&Z(G,1)):(G=bo(J),G.c(),Z(G,1),G.m(e,_)):G&&(ht(),ie(G,1,1,()=>{G=null}),vt()),$&3&&(d=Yt(J[1].ui.f,J[0].l1&&(J[0].l1.f>.01||J[0].l2.f>.01||J[0].l3.f>.01))),d?se?(se.p(J,$),$&3&&Z(se,1)):(se=ko(J),se.c(),Z(se,1),se.m(e,h)):se&&(ht(),ie(se,1,1,()=>{se=null}),vt()),$&3&&(b=Yt(J[1].ui.r,J[0].ri>0||J[0].re>0||J[0].ric>0||J[0].rec>0)),b?le?(le.p(J,$),$&3&&Z(le,1)):(le=Co(J),le.c(),Z(le,1),le.m(e,g)):le&&(ht(),ie(le,1,1,()=>{le=null}),vt()),$&3&&(w=Yt(J[1].ui.c,J[0].ea)),w?Q?(Q.p(J,$),$&3&&Z(Q,1)):(Q=So(J),Q.c(),Z(Q,1),Q.m(e,k)):Q&&(ht(),ie(Q,1,1,()=>{Q=null}),vt()),$&3&&(R=Yt(J[1].ui.t,J[0].pr&&(J[0].pr.startsWith("NO")||J[0].pr.startsWith("10YNO")||J[0].pr.startsWith("10Y1001A1001A4")))),R?ae?(ae.p(J,$),$&3&&Z(ae,1)):(ae=Mo(J),ae.c(),Z(ae,1),ae.m(e,I)):ae&&(ht(),ie(ae,1,1,()=>{ae=null}),vt()),$&3&&(F=Yt(J[1].ui.l,J[0].hm==1)),F?re?(re.p(J,$),$&3&&Z(re,1)):(re=No(J),re.c(),Z(re,1),re.m(e,M)):re&&(ht(),ie(re,1,1,()=>{re=null}),vt()),$&3&&(A=Yt(J[1].ui.p,J[0].pe&&!Number.isNaN(J[0].p))),A?ue?(ue.p(J,$),$&3&&Z(ue,1)):(ue=Po(J),ue.c(),Z(ue,1),ue.m(e,O)):ue&&(ht(),ie(ue,1,1,()=>{ue=null}),vt()),$&10&&(j=Yt(J[1].ui.d,J[3])),j?ne?(ne.p(J,$),$&10&&Z(ne,1)):(ne=To(J),ne.c(),Z(ne,1),ne.m(e,Y)):ne&&(ht(),ie(ne,1,1,()=>{ne=null}),vt()),$&18&&(z=Yt(J[1].ui.m,J[4])),z?pe?(pe.p(J,$),$&18&&Z(pe,1)):(pe=qo(J),pe.c(),Z(pe,1),pe.m(e,T)):pe&&(ht(),ie(pe,1,1,()=>{pe=null}),vt()),$&35&&(B=Yt(J[1].ui.s,J[0].t&&J[0].t!=-127&&J[5].c>1)),B?oe?(oe.p(J,$),$&35&&Z(oe,1)):(oe=Eo(J),oe.c(),Z(oe,1),oe.m(e,null)):oe&&(ht(),ie(oe,1,1,()=>{oe=null}),vt())},i(J){X||(Z(y),Z(K),Z(V),Z(U),Z(G),Z(se),Z(le),Z(Q),Z(ae),Z(re),Z(ue),Z(ne),Z(pe),Z(oe),X=!0)},o(J){ie(y),ie(K),ie(V),ie(U),ie(G),ie(se),ie(le),ie(Q),ie(ae),ie(re),ie(ue),ie(ne),ie(pe),ie(oe),X=!1},d(J){J&&N(e),y&&y.d(),K&&K.d(),V&&V.d(),U&&U.d(),G&&G.d(),se&&se.d(),le&&le.d(),Q&&Q.d(),ae&&ae.d(),re&&re.d(),ue&&ue.d(),ne&&ne.d(),pe&&pe.d(),oe&&oe.d()}}}function B0(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,{prices:s={}}=e,{dayPlot:a={}}=e,{monthPlot:r={}}=e,{temperatures:f={}}=e,{translations:c={}}=e,{tariffData:m={}}=e,_,d,h,b,g,w;return t.$$set=k=>{"data"in k&&l(0,n=k.data),"sysinfo"in k&&l(1,i=k.sysinfo),"prices"in k&&l(2,s=k.prices),"dayPlot"in k&&l(3,a=k.dayPlot),"monthPlot"in k&&l(4,r=k.monthPlot),"temperatures"in k&&l(5,f=k.temperatures),"translations"in k&&l(6,c=k.translations),"tariffData"in k&&l(7,m=k.tariffData)},t.$$.update=()=>{var k,R,I,F,M,A,O,j,Y,z,T,B,X,y,K;t.$$.dirty&1793&&(l(11,_=ul((n==null?void 0:n.ic)*1e3,"Wh")),l(12,d=ul((n==null?void 0:n.ec)*1e3,"Wh")),((k=n==null?void 0:n.l1)==null?void 0:k.u)==0&&((R=n==null?void 0:n.l2)==null?void 0:R.u)==0&&((I=n==null?void 0:n.l3)==null?void 0:I.u)==0?l(8,b=l(9,g=l(10,w=l(13,h=!0)))):(l(8,b=((F=n==null?void 0:n.l1)==null?void 0:F.u)>0||((M=n==null?void 0:n.l1)==null?void 0:M.i)>0||((A=n==null?void 0:n.l1)==null?void 0:A.p)>0||((O=n==null?void 0:n.l1)==null?void 0:O.q)>0),l(9,g=((j=n==null?void 0:n.l2)==null?void 0:j.u)>0||((Y=n==null?void 0:n.l2)==null?void 0:Y.i)>0||((z=n==null?void 0:n.l2)==null?void 0:z.p)>0||((T=n==null?void 0:n.l2)==null?void 0:T.q)>0),l(10,w=((B=n==null?void 0:n.l3)==null?void 0:B.u)>0||((X=n==null?void 0:n.l3)==null?void 0:X.i)>0||((y=n==null?void 0:n.l3)==null?void 0:y.p)>0||((K=n==null?void 0:n.l3)==null?void 0:K.q)>0),l(13,h=b&&g&&w)))},[n,i,s,a,r,f,c,m,b,g,w,_,d,h]}class j0 extends Pt{constructor(e){super(),Nt(this,e,B0,U0,Mt,{data:0,sysinfo:1,prices:2,dayPlot:3,monthPlot:4,temperatures:5,translations:6,tariffData:7})}}let Fi={};const Un=ol(Fi);async function H0(){Fi=await(await fetch("configuration.json")).json(),Un.set(Fi)}let Ui={};const Du=ol(Ui);async function y0(){Ui=await(await fetch("priceconfig.json")).json(),Du.set(Ui)}function Do(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Ao(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART0",l=v(),n=p("option"),n.textContent="UART2",e.__value=3,H(e,e.__value),n.__value=113,H(n,n.__value)},m(i,s){P(i,e,s),P(i,l,s),P(i,n,s)},d(i){i&&(N(e),N(l),N(n))}}}function Oo(t){let e;return{c(){e=p("option"),e.textContent=`GPIO${t[4]}`,e.__value=t[4],H(e,e.__value)},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function Lo(t){let e,l=t[4]>1&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Oo(t);return{c(){l&&l.c(),e=Ht()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,i){n[4]>1&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Oo(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){n&&N(e),l&&l.d(n)}}}function z0(t){let e,l,n,i,s=t[0]=="esp8266"&&Ao(),a=rt({length:t[1]+1}),r=[];for(let f=0;f{"chip"in s&&l(0,n=s.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32s3":l(1,i=46);break;case"esp32c3":l(1,i=21);break}},[n,i]}class Bi extends Pt{constructor(e){super(),Nt(this,e,W0,z0,Mt,{chip:0})}}function Io(t){let e,l,n=t[1]&&Ro(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,s){P(i,e,s),o(e,l),n&&n.m(l,null)},p(i,s){i[1]?n?n.p(i,s):(n=Ro(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&N(e),n&&n.d()}}}function Ro(t){let e,l;return{c(){e=p("div"),l=C(t[1]),u(e,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(n,i){P(n,e,i),o(e,l)},p(n,i){i&2&&E(l,n[1])},d(n){n&&N(e)}}}function G0(t){let e,l=t[0]&&Io(t);return{c(){l&&l.c(),e=Ht()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Io(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:Ye,o:Ye,d(n){n&&N(e),l&&l.d(n)}}}function V0(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=s=>{"active"in s&&l(0,n=s.active),"message"in s&&l(1,i=s.message)},[n,i]}class rl extends Pt{constructor(e){super(),Nt(this,e,V0,G0,Mt,{active:0,message:1})}}function Fo(t,e,l){const n=t.slice();return n[1]=e[l],n}function Uo(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],H(e,e.__value)},m(s,a){P(s,e,a),o(e,l),o(e,i)},p:Ye,d(s){s&&N(e)}}}function K0(t){let e,l,n,i=rt(t[0]),s=[];for(let a=0;a>1&1,q=0;q0;S--)q[S]=q[S]?q[S-1]^M.EXPONENT[j._modN(M.LOG[q[S]]+D)]:q[S-1];q[0]=M.EXPONENT[j._modN(M.LOG[q[0]]+D)]}for(D=0;D<=L;D++)q[D]=M.LOG[q[D]]},_checkBadness:function(){var D,S,L,q,W,te=0,fe=this._badness,_e=this.buffer,de=this.width;for(W=0;Wde*de;)be-=de*de,he++;for(te+=he*j.N4,q=0;q=fe-2&&(D=fe-2,W>9&&D--);var _e=D;if(W>9){for(te[_e+2]=0,te[_e+3]=0;_e--;)S=te[_e],te[_e+3]|=255&S<<4,te[_e+2]=S>>4;te[2]|=255&D<<4,te[1]=D>>4,te[0]=64|D>>12}else{for(te[_e+1]=0,te[_e+2]=0;_e--;)S=te[_e],te[_e+2]|=255&S<<4,te[_e+1]=S>>4;te[1]|=255&D<<4,te[0]=64|D>>4}for(_e=D+3-(W<10);_e=5&&(L+=j.N1+q[S]-5);for(S=3;SD||q[S-3]*3>=q[S]*4||q[S+3]*3>=q[S]*4)&&(L+=j.N3);return L},_finish:function(){this._stringBuffer=this.buffer.slice();var D,S,L=0,q=3e4;for(S=0;S<8&&(this._applyMask(S),D=this._checkBadness(),D>=1)q&1&&(W[te-1-S+te*8]=1,S<6?W[8+te*S]=1:W[8+te*(S+1)]=1);for(S=0;S<7;S++,q>>=1)q&1&&(W[8+te*(te-7+S)]=1,S?W[6-S+te*8]=1:W[7+te*8]=1)},_interleaveBlocks:function(){var D,S,L=this._dataBlock,q=this._ecc,W=this._eccBlock,te=0,fe=this._calculateMaxLength(),_e=this._neccBlock1,de=this._neccBlock2,x=this._stringBuffer;for(D=0;D1)for(D=k.BLOCK[q],L=W-7;;){for(S=W-7;S>D-3&&(this._addAlignment(S,L),!(S6)for(D=O.BLOCK[te-7],S=17,L=0;L<6;L++)for(q=0;q<3;q++,S--)1&(S>11?te>>S-12:D>>S)?(W[5-L+fe*(2-q+fe-11)]=1,W[2-q+fe-11+fe*(5-L)]=1):(this._setMask(5-L,2-q+fe-11),this._setMask(2-q+fe-11,5-L))},_isMasked:function(D,S){var L=j._getMaskBit(D,S);return this._mask[L]===1},_pack:function(){var D,S,L,q=1,W=1,te=this.width,fe=te-1,_e=te-1,de=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(S=0;SS&&(L=D,D=S,S=L),L=S,L+=S*S,L>>=1,L+=D,L},_modN:function(D){for(;D>=255;)D-=255,D=(D>>8)+(D&255);return D},N1:3,N2:3,N3:40,N4:10}),Y=j,z=h.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var D=this.element;D.width=D.height=this.qrious.size}}),T=z,B=_.extend(function(D,S,L,q){this.name=D,this.modifiable=!!S,this.defaultValue=L,this._valueTransformer=q},{transform:function(D){var S=this._valueTransformer;return typeof S=="function"?S(D,this):D}}),X=B,y=_.extend(null,{abs:function(D){return D!=null?Math.abs(D):null},hasOwn:function(D,S){return Object.prototype.hasOwnProperty.call(D,S)},noop:function(){},toUpperCase:function(D){return D!=null?D.toUpperCase():null}}),K=y,V=_.extend(function(D){this.options={},D.forEach(function(S){this.options[S.name]=S},this)},{exists:function(D){return this.options[D]!=null},get:function(D,S){return V._get(this.options[D],S)},getAll:function(D){var S,L=this.options,q={};for(S in L)K.hasOwn(L,S)&&(q[S]=V._get(L[S],D));return q},init:function(D,S,L){typeof L!="function"&&(L=K.noop);var q,W;for(q in this.options)K.hasOwn(this.options,q)&&(W=this.options[q],V._set(W,W.defaultValue,S),V._createAccessor(W,S,L));this._setAll(D,S,!0)},set:function(D,S,L){return this._set(D,S,L)},setAll:function(D,S){return this._setAll(D,S)},_set:function(D,S,L,q){var W=this.options[D];if(!W)throw new Error("Invalid option: "+D);if(!W.modifiable&&!q)throw new Error("Option cannot be modified: "+D);return V._set(W,S,L)},_setAll:function(D,S,L){if(!D)return!1;var q,W=!1;for(q in D)K.hasOwn(D,q)&&this._set(q,D[q],S,L)&&(W=!0);return W}},{_createAccessor:function(D,S,L){var q={get:function(){return V._get(D,S)}};D.modifiable&&(q.set=function(W){V._set(D,W,S)&&L(W,D)}),Object.defineProperty(S,D.name,q)},_get:function(D,S){return S["_"+D.name]},_set:function(D,S,L){var q="_"+D.name,W=L[q],te=D.transform(S??D.defaultValue);return L[q]=te,te!==W}}),U=V,G=_.extend(function(){this._services={}},{getService:function(D){var S=this._services[D];if(!S)throw new Error("Service is not being managed with name: "+D);return S},setService:function(D,S){if(this._services[D])throw new Error("Service is already managed with name: "+D);S&&(this._services[D]=S)}}),se=G,le=new U([new X("background",!0,"white"),new X("backgroundAlpha",!0,1,K.abs),new X("element"),new X("foreground",!0,"black"),new X("foregroundAlpha",!0,1,K.abs),new X("level",!0,"L",K.toUpperCase),new X("mime",!0,"image/png"),new X("padding",!0,null,K.abs),new X("size",!0,100,K.abs),new X("value",!0,"")]),Q=new se,ae=_.extend(function(D){le.init(D,this,this.update.bind(this));var S=le.get("element",this),L=Q.getService("element"),q=S&&L.isCanvas(S)?S:L.createCanvas(),W=S&&L.isImage(S)?S:L.createImage();this._canvasRenderer=new g(this,q,!0),this._imageRenderer=new T(this,W,W===S),this.update()},{get:function(){return le.getAll(this)},set:function(D){le.setAll(D,this)&&this.update()},toDataURL:function(D){return this.canvas.toDataURL(D||this.mime)},update:function(){var D=new Y({level:this.level,value:this.value});this._canvasRenderer.render(D),this._imageRenderer.render(D)}},{use:function(D){Q.setService(D.getName(),D)}});Object.defineProperties(ae.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var re=ae,ue=re,ne=_.extend({getName:function(){}}),pe=ne,oe=pe.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(D){},isImage:function(D){}}),J=oe,$=J.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(D){return D instanceof HTMLCanvasElement},isImage:function(D){return D instanceof HTMLImageElement}}),ke=$;ue.use(new ke);var Ce=ue;return Ce})})(Ou);var $0=Ou.exports;const x0=J0($0);function ec(t){let e,l;return{c(){e=p("img"),ii(e.src,l=t[2])||u(e,"src",l),u(e,"alt",t[0]),u(e,"class",t[1])},m(n,i){P(n,e,i)},p(n,[i]){i&4&&!ii(e.src,l=n[2])&&u(e,"src",l),i&1&&u(e,"alt",n[0]),i&2&&u(e,"class",n[1])},i:Ye,o:Ye,d(n){n&&N(e)}}}function tc(t,e,l){let{errorCorrection:n="L"}=e,{background:i="#fff"}=e,{color:s="#000"}=e,{size:a="200"}=e,{value:r=""}=e,{padding:f=0}=e,{className:c="qrcode"}=e,m="",_;function d(){_.set({background:i,foreground:s,level:n,padding:f,size:a,value:r}),l(2,m=_.toDataURL("image/jpeg"))}function h(){return m}return yf(()=>{l(9,_=new x0),r&&d()}),t.$$set=b=>{"errorCorrection"in b&&l(3,n=b.errorCorrection),"background"in b&&l(4,i=b.background),"color"in b&&l(5,s=b.color),"size"in b&&l(6,a=b.size),"value"in b&&l(0,r=b.value),"padding"in b&&l(7,f=b.padding),"className"in b&&l(1,c=b.className)},t.$$.update=()=>{t.$$.dirty&513&&r&&_&&d()},[r,c,m,n,i,s,a,f,h,_]}class lc extends Pt{constructor(e){super(),Nt(this,e,tc,ec,Mt,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1,getImage:8})}get getImage(){return this.$$.ctx[8]}}function Bo(t,e,l){const n=t.slice();return n[122]=e[l],n}function jo(t,e,l){const n=t.slice();return n[125]=e[l],n[126]=e,n[127]=l,n}function Ho(t,e,l){const n=t.slice();return n[128]=e[l],n[129]=e,n[130]=l,n}function yo(t,e,l){const n=t.slice();return n[131]=e[l],n}function nc(t,e,l){const n=t.slice();return n[134]=e[l],n}function ic(t,e,l){const n=t.slice();return n[137]=e[l],n}function zo(t){var nt,ze,xt,el,tl,ll,nl,il,sl,Ze,Se,ee,Le,al,Xt,ml,pl,kl,wl,Cl,Sl,Ml,Il,Rl,Fl,Ve;let e,l,n=(((ze=(nt=t[2].conf)==null?void 0:nt.general)==null?void 0:ze.title)??"General")+"",i,s,a,r,f,c,m,_,d,h=(((el=(xt=t[2].conf)==null?void 0:xt.general)==null?void 0:el.hostname)??"Hostname")+"",b,g,w,k,R,I,F=(((ll=(tl=t[2].conf)==null?void 0:tl.general)==null?void 0:ll.timezone)??"Time zone")+"",M,A,O,j,Y,z,T,B,X,y,K,V=(((il=(nl=t[2].conf)==null?void 0:nl.price)==null?void 0:il.region)??"Price region")+"",U,G,se,le,Q,ae,re,ue,ne,pe,oe,J,$,ke,Ce,D,S,L,q,W,te,fe,_e,de,x,he,be,Ae,Te,Oe,Ie,De,Ue,xe,wt=(((Ze=(sl=t[2].conf)==null?void 0:sl.price)==null?void 0:Ze.currency)??"Currency")+"",tt,ot,St,dt,at,it,ft,Ot,We,Re,He,lt,ve=(((ee=(Se=t[2].conf)==null?void 0:Se.price)==null?void 0:ee.enabled)??"Enabled")+"",Ee,Qe,me,we,ut=(((Xt=(al=(Le=t[2].conf)==null?void 0:Le.general)==null?void 0:al.security)==null?void 0:Xt.title)??"Security")+"",Ge,Rt,bt,Be,gt,ct=(((kl=(pl=(ml=t[2].conf)==null?void 0:ml.general)==null?void 0:pl.security)==null?void 0:kl.none)??"None")+"",mt,et,Tt=(((Sl=(Cl=(wl=t[2].conf)==null?void 0:wl.general)==null?void 0:Cl.security)==null?void 0:Sl.conf)??"Conf")+"",zt,kt,_t=(((Rl=(Il=(Ml=t[2].conf)==null?void 0:Ml.general)==null?void 0:Il.security)==null?void 0:Rl.all)??"All")+"",yt,Qt,Ft,jt,Kt=(((Ve=(Fl=t[2].conf)==null?void 0:Fl.general)==null?void 0:Ve.context)??"Context")+"",Jt,Wt,Lt,Fe,Xe,je,Et,Ut;Y=new Q0({});let $e=!t[6].p.t&&Wo(),st=rt(["NOK","SEK","DKK","EUR","CHF"]),qt=[];for(let qe=0;qe<5;qe+=1)qt[qe]=sc(ic(t,st,qe));ft=new dl({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[oc]},$$scope:{ctx:t}}});let pt=t[6].p.e&&t[0].chip!="esp8266"&&Go(t),ge=t[6].g.s>0&&Vo(t);return{c(){var qe,It;e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("div"),d=p("div"),b=C(h),g=p("br"),w=v(),k=p("input"),R=v(),I=p("div"),M=C(F),A=p("br"),O=v(),j=p("select"),Pe(Y.$$.fragment),z=v(),T=p("input"),B=v(),X=p("div"),y=p("div"),K=p("div"),U=C(V),G=p("br"),se=v(),le=p("select"),Q=p("optgroup"),$e&&$e.c(),ae=p("option"),ae.textContent="NO1",re=p("option"),re.textContent="NO2",ue=p("option"),ue.textContent="NO3",ne=p("option"),ne.textContent="NO4",pe=p("option"),pe.textContent="NO5",oe=p("optgroup"),J=p("option"),J.textContent="SE1",$=p("option"),$.textContent="SE2",ke=p("option"),ke.textContent="SE3",Ce=p("option"),Ce.textContent="SE4",D=p("optgroup"),S=p("option"),S.textContent="DK1",L=p("option"),L.textContent="DK2",q=p("option"),q.textContent="Austria",W=p("option"),W.textContent="Belgium",te=p("option"),te.textContent="Czech Republic",fe=p("option"),fe.textContent="Estonia",_e=p("option"),_e.textContent="Finland",de=p("option"),de.textContent="France",x=p("option"),x.textContent="Germany",he=p("option"),he.textContent="Great Britain",be=p("option"),be.textContent="Latvia",Ae=p("option"),Ae.textContent="Lithuania",Te=p("option"),Te.textContent="Netherland",Oe=p("option"),Oe.textContent="Poland",Ie=p("option"),Ie.textContent="Slovenia",De=p("option"),De.textContent="Switzerland",Ue=v(),xe=p("div"),tt=C(wt),ot=p("br"),St=v(),dt=p("select");for(let fl=0;fl<5;fl+=1)qt[fl].c();at=v(),it=p("div"),Pe(ft.$$.fragment),Ot=v(),We=p("div"),Re=p("label"),He=p("input"),lt=v(),Ee=C(ve),Qe=v(),pt&&pt.c(),me=v(),we=p("div"),Ge=C(ut),Rt=p("br"),bt=v(),Be=p("select"),gt=p("option"),mt=C(ct),et=p("option"),zt=C(Tt),kt=p("option"),yt=C(_t),Qt=v(),ge&&ge.c(),Ft=v(),jt=p("div"),Jt=C(Kt),Wt=p("br"),Lt=v(),Fe=p("input"),u(l,"class","text-sm"),u(a,"href",_l("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",Vn),u(j,"name","gt"),u(j,"class","in-l w-full"),t[6].g.t===void 0&&Dt(()=>t[26].call(j)),u(_,"class","flex"),u(m,"class","my-1"),u(T,"type","hidden"),u(T,"name","p"),T.value="true",ae.__value="10YNO-1--------2",H(ae,ae.__value),re.__value="10YNO-2--------T",H(re,re.__value),ue.__value="10YNO-3--------J",H(ue,ue.__value),ne.__value="10YNO-4--------9",H(ne,ne.__value),pe.__value="10Y1001A1001A48H",H(pe,pe.__value),u(Q,"label","Norway"),J.__value="10Y1001A1001A44P",H(J,J.__value),$.__value="10Y1001A1001A45N",H($,$.__value),ke.__value="10Y1001A1001A46L",H(ke,ke.__value),Ce.__value="10Y1001A1001A47J",H(Ce,Ce.__value),u(oe,"label","Sweden"),S.__value="10YDK-1--------W",H(S,S.__value),L.__value="10YDK-2--------M",H(L,L.__value),u(D,"label","Denmark"),q.__value="10YAT-APG------L",H(q,q.__value),W.__value="10YBE----------2",H(W,W.__value),te.__value="10YCZ-CEPS-----N",H(te,te.__value),fe.__value="10Y1001A1001A39I",H(fe,fe.__value),_e.__value="10YFI-1--------U",H(_e,_e.__value),de.__value="10YFR-RTE------C",H(de,de.__value),x.__value="10Y1001A1001A83F",H(x,x.__value),he.__value="10YGB----------A",H(he,he.__value),be.__value="10YLV-1001A00074",H(be,be.__value),Ae.__value="10YLT-1001A0008Q",H(Ae,Ae.__value),Te.__value="10YNL----------L",H(Te,Te.__value),Oe.__value="10YPL-AREA-----S",H(Oe,Oe.__value),Ie.__value="10YSI-ELES-----O",H(Ie,Ie.__value),De.__value="10YCH-SWISSGRIDZ",H(De,De.__value),u(le,"name","pr"),u(le,"class","in-f w-full"),t[6].p.r===void 0&&Dt(()=>t[27].call(le)),u(K,"class","w-full"),u(dt,"name","pc"),u(dt,"class","in-l"),t[6].p.c===void 0&&Dt(()=>t[28].call(dt)),u(y,"class","flex"),u(X,"class","my-1"),u(it,"class","my-1"),u(He,"type","checkbox"),u(He,"name","pe"),He.__value="true",H(He,He.__value),u(He,"class","rounded mb-1"),u(We,"class","my-1"),gt.__value=0,H(gt,gt.__value),et.__value=1,H(et,et.__value),kt.__value=2,H(kt,kt.__value),u(Be,"name","gs"),u(Be,"class","in-s"),t[6].g.s===void 0&&Dt(()=>t[31].call(Be)),u(we,"class","my-1"),u(Fe,"name","gc"),u(Fe,"type","text"),u(Fe,"pattern",Vn),u(Fe,"placeholder",Xe=((It=(qe=t[2].conf)==null?void 0:qe.general)==null?void 0:It.context_placeholder)??"/"),u(Fe,"class","in-s"),u(Fe,"maxlength","36"),u(jt,"class","my-1"),u(e,"class","cnt")},m(qe,It){P(qe,e,It),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,d),o(d,b),o(d,g),o(d,w),o(d,k),H(k,t[6].g.h),o(_,R),o(_,I),o(I,M),o(I,A),o(I,O),o(I,j),Me(Y,j,null),Ke(j,t[6].g.t,!0),o(e,z),o(e,T),o(e,B),o(e,X),o(X,y),o(y,K),o(K,U),o(K,G),o(K,se),o(K,le),o(le,Q),$e&&$e.m(Q,null),o(Q,ae),o(Q,re),o(Q,ue),o(Q,ne),o(Q,pe),o(le,oe),o(oe,J),o(oe,$),o(oe,ke),o(oe,Ce),o(le,D),o(D,S),o(D,L),o(le,q),o(le,W),o(le,te),o(le,fe),o(le,_e),o(le,de),o(le,x),o(le,he),o(le,be),o(le,Ae),o(le,Te),o(le,Oe),o(le,Ie),o(le,De),Ke(le,t[6].p.r,!0),o(y,Ue),o(y,xe),o(xe,tt),o(xe,ot),o(xe,St),o(xe,dt);for(let fl=0;fl<5;fl+=1)qt[fl]&&qt[fl].m(dt,null);Ke(dt,t[6].p.c,!0),o(e,at),o(e,it),Me(ft,it,null),o(e,Ot),o(e,We),o(We,Re),o(Re,He),He.checked=t[6].p.e,o(Re,lt),o(Re,Ee),o(We,Qe),pt&&pt.m(We,null),o(e,me),o(e,we),o(we,Ge),o(we,Rt),o(we,bt),o(we,Be),o(Be,gt),o(gt,mt),o(Be,et),o(et,zt),o(Be,kt),o(kt,yt),Ke(Be,t[6].g.s,!0),o(e,Qt),ge&&ge.m(e,null),o(e,Ft),o(e,jt),o(jt,Jt),o(jt,Wt),o(jt,Lt),o(jt,Fe),H(Fe,t[6].g.c),je=!0,Et||(Ut=[ce(k,"input",t[25]),ce(j,"change",t[26]),ce(le,"change",t[27]),ce(le,"change",t[22]),ce(dt,"change",t[28]),ce(He,"change",t[29]),ce(Be,"change",t[31]),ce(Fe,"input",t[34])],Et=!0)},p(qe,It){var Ul,Bl,jl,Hl,yl,zl,Wl,Gl,Vl,Kl,Yl,Ql,Xl,Zl,Jl,$l,xl,en,tn,Nn,Pn,Tn,qn,En,Dn,An,On,Ln;(!je||It[0]&4)&&n!==(n=(((Bl=(Ul=qe[2].conf)==null?void 0:Ul.general)==null?void 0:Bl.title)??"General")+"")&&E(i,n),(!je||It[0]&4)&&h!==(h=(((Hl=(jl=qe[2].conf)==null?void 0:jl.general)==null?void 0:Hl.hostname)??"Hostname")+"")&&E(b,h),It[0]&64&&k.value!==qe[6].g.h&&H(k,qe[6].g.h),(!je||It[0]&4)&&F!==(F=(((zl=(yl=qe[2].conf)==null?void 0:yl.general)==null?void 0:zl.timezone)??"Time zone")+"")&&E(M,F),It[0]&64&&Ke(j,qe[6].g.t),(!je||It[0]&4)&&V!==(V=(((Gl=(Wl=qe[2].conf)==null?void 0:Wl.price)==null?void 0:Gl.region)??"Price region")+"")&&E(U,V),qe[6].p.t?$e&&($e.d(1),$e=null):$e||($e=Wo(),$e.c(),$e.m(Q,ae)),It[0]&64&&Ke(le,qe[6].p.r),(!je||It[0]&4)&&wt!==(wt=(((Kl=(Vl=qe[2].conf)==null?void 0:Vl.price)==null?void 0:Kl.currency)??"Currency")+"")&&E(tt,wt),It[0]&64&&Ke(dt,qe[6].p.c);const fl={};It[0]&4|It[4]&65536&&(fl.$$scope={dirty:It,ctx:qe}),ft.$set(fl),It[0]&64&&(He.checked=qe[6].p.e),(!je||It[0]&4)&&ve!==(ve=(((Ql=(Yl=qe[2].conf)==null?void 0:Yl.price)==null?void 0:Ql.enabled)??"Enabled")+"")&&E(Ee,ve),qe[6].p.e&&qe[0].chip!="esp8266"?pt?pt.p(qe,It):(pt=Go(qe),pt.c(),pt.m(We,null)):pt&&(pt.d(1),pt=null),(!je||It[0]&4)&&ut!==(ut=(((Jl=(Zl=(Xl=qe[2].conf)==null?void 0:Xl.general)==null?void 0:Zl.security)==null?void 0:Jl.title)??"Security")+"")&&E(Ge,ut),(!je||It[0]&4)&&ct!==(ct=(((en=(xl=($l=qe[2].conf)==null?void 0:$l.general)==null?void 0:xl.security)==null?void 0:en.none)??"None")+"")&&E(mt,ct),(!je||It[0]&4)&&Tt!==(Tt=(((Pn=(Nn=(tn=qe[2].conf)==null?void 0:tn.general)==null?void 0:Nn.security)==null?void 0:Pn.conf)??"Conf")+"")&&E(zt,Tt),(!je||It[0]&4)&&_t!==(_t=(((En=(qn=(Tn=qe[2].conf)==null?void 0:Tn.general)==null?void 0:qn.security)==null?void 0:En.all)??"All")+"")&&E(yt,_t),It[0]&64&&Ke(Be,qe[6].g.s),qe[6].g.s>0?ge?ge.p(qe,It):(ge=Vo(qe),ge.c(),ge.m(e,Ft)):ge&&(ge.d(1),ge=null),(!je||It[0]&4)&&Kt!==(Kt=(((An=(Dn=qe[2].conf)==null?void 0:Dn.general)==null?void 0:An.context)??"Context")+"")&&E(Jt,Kt),(!je||It[0]&4&&Xe!==(Xe=((Ln=(On=qe[2].conf)==null?void 0:On.general)==null?void 0:Ln.context_placeholder)??"/"))&&u(Fe,"placeholder",Xe),It[0]&64&&Fe.value!==qe[6].g.c&&H(Fe,qe[6].g.c)},i(qe){je||(Z(Y.$$.fragment,qe),Z(ft.$$.fragment,qe),je=!0)},o(qe){ie(Y.$$.fragment,qe),ie(ft.$$.fragment,qe),je=!1},d(qe){qe&&N(e),Ne(Y),$e&&$e.d(),Zt(qt,qe),Ne(ft),pt&&pt.d(),ge&&ge.d(),Et=!1,Bt(Ut)}}}function Wo(t){let e,l,n,i,s;return{c(){e=p("option"),e.textContent="NO1 with support",l=p("option"),l.textContent="NO2 with support",n=p("option"),n.textContent="NO3 with support",i=p("option"),i.textContent="NO4 with support",s=p("option"),s.textContent="NO5 with support",e.__value="NO1S",H(e,e.__value),l.__value="NO2S",H(l,l.__value),n.__value="NO3S",H(n,n.__value),i.__value="NO4S",H(i,i.__value),s.__value="NO5S",H(s,s.__value)},m(a,r){P(a,e,r),P(a,l,r),P(a,n,r),P(a,i,r),P(a,s,r)},d(a){a&&(N(e),N(l),N(n),N(i),N(s))}}}function sc(t){let e;return{c(){e=p("option"),e.textContent=`${t[137]}`,e.__value=t[137],H(e,e.__value)},m(l,n){P(l,e,n)},p:Ye,d(l){l&&N(e)}}}function oc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.price)==null?void 0:i.conf)??"Configure")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.price)==null?void 0:f.conf)??"Configure")+"")&&E(l,e)},d(s){s&&N(l)}}}function Go(t){let e,l,n,i,s;return{c(){var a,r;e=p("br"),l=p("input"),u(l,"name","pt"),u(l,"type","text"),u(l,"class","in-s"),u(l,"placeholder",n=((r=(a=t[2].conf)==null?void 0:a.price)==null?void 0:r.api_key_placeholder)??""),u(l,"pattern",Vn)},m(a,r){P(a,e,r),P(a,l,r),H(l,t[6].p.t),i||(s=ce(l,"input",t[30]),i=!0)},p(a,r){var f,c;r[0]&4&&n!==(n=((c=(f=a[2].conf)==null?void 0:f.price)==null?void 0:c.api_key_placeholder)??"")&&u(l,"placeholder",n),r[0]&64&&l.value!==a[6].p.t&&H(l,a[6].p.t)},d(a){a&&(N(e),N(l)),i=!1,s()}}}function Vo(t){var w,k,R,I,F,M;let e,l=(((R=(k=(w=t[2].conf)==null?void 0:w.general)==null?void 0:k.security)==null?void 0:R.username)??"Username")+"",n,i,s,a,r,f,c=(((M=(F=(I=t[2].conf)==null?void 0:I.general)==null?void 0:F.security)==null?void 0:M.password)??"Password")+"",m,_,d,h,b,g;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),r=v(),f=p("div"),m=C(c),_=p("br"),d=v(),h=p("input"),u(a,"name","gu"),u(a,"type","text"),u(a,"class","in-s"),u(a,"maxlength","36"),u(a,"pattern",Ll),u(e,"class","my-1"),u(h,"name","gp"),u(h,"type","password"),u(h,"class","in-s"),u(h,"maxlength","36"),u(h,"pattern",Ll),u(f,"class","my-1")},m(A,O){P(A,e,O),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].g.u),P(A,r,O),P(A,f,O),o(f,m),o(f,_),o(f,d),o(f,h),H(h,t[6].g.p),b||(g=[ce(a,"input",t[32]),ce(h,"input",t[33])],b=!0)},p(A,O){var j,Y,z,T,B,X;O[0]&4&&l!==(l=(((z=(Y=(j=A[2].conf)==null?void 0:j.general)==null?void 0:Y.security)==null?void 0:z.username)??"Username")+"")&&E(n,l),O[0]&64&&a.value!==A[6].g.u&&H(a,A[6].g.u),O[0]&4&&c!==(c=(((X=(B=(T=A[2].conf)==null?void 0:T.general)==null?void 0:B.security)==null?void 0:X.password)??"Password")+"")&&E(m,c),O[0]&64&&h.value!==A[6].g.p&&H(h,A[6].g.p)},d(A){A&&(N(e),N(r),N(f)),b=!1,Bt(g)}}}function Ko(t){var me,we,ut,Ge,Rt,bt,Be,gt,ct,mt,et,Tt,zt,kt,_t,yt,Qt,Ft,jt,Kt,Jt,Wt,Lt;let e,l,n=(((we=(me=t[2].conf)==null?void 0:me.meter)==null?void 0:we.title)??"Meter")+"",i,s,a,r,f,c,m,_,d,h=(((Rt=(Ge=(ut=t[2].conf)==null?void 0:ut.meter)==null?void 0:Ge.comm)==null?void 0:Rt.title)??"Communication")+"",b,g,w,k,R,I=(((gt=(Be=(bt=t[2].conf)==null?void 0:bt.meter)==null?void 0:Be.comm)==null?void 0:gt.passive)??"Passive")+"",F,M,A=(((et=(mt=(ct=t[2].conf)==null?void 0:ct.meter)==null?void 0:mt.comm)==null?void 0:et.pulse)??"Pulse")+"",O,j=(zt=(Tt=t[0])==null?void 0:Tt.features)==null?void 0:zt.includes("kmp"),Y,z,T,B=(((kt=t[2].common)==null?void 0:kt.voltage)??"Voltage")+"",X,y,K,V,U,G,se,le,Q,ae=(((yt=(_t=t[2].conf)==null?void 0:_t.meter)==null?void 0:yt.fuse)??"Main fuse")+"",re,ue,ne,pe,oe,J,$,ke,Ce,D=(((Ft=(Qt=t[2].conf)==null?void 0:Qt.meter)==null?void 0:Ft.prod)??"Production")+"",S,L,q,W,te,fe,_e,de,x,he,be,Ae,Te,Oe,Ie=(((Kt=(jt=t[2].conf)==null?void 0:jt.meter)==null?void 0:Kt.encrypted)??"Encrypted")+"",De,Ue,xe,wt,tt,ot,St,dt=(((Lt=(Wt=(Jt=t[2].conf)==null?void 0:Jt.meter)==null?void 0:Wt.multipliers)==null?void 0:Lt.title)??"Multipliers")+"",at,it,ft,Ot,We=j&&Yo();function Re(Fe,Xe){return Fe[6].m.a===2?fc:ac}let He=Re(t),lt=He(t),ve=t[6].m.e.e&&Qo(t),Ee=t[6].m.e.e&&Xo(t),Qe=t[6].m.m.e&&Zo(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("input"),_=v(),d=p("div"),b=C(h),g=p("br"),w=v(),k=p("select"),R=p("option"),F=C(I),M=p("option"),O=C(A),We&&We.c(),Y=v(),lt.c(),z=v(),T=p("div"),X=C(B),y=p("br"),K=v(),V=p("select"),U=p("option"),U.textContent="400V (TN)",G=p("option"),G.textContent="230V (IT/TT)",se=v(),le=p("div"),Q=p("div"),re=C(ae),ue=p("br"),ne=v(),pe=p("label"),oe=p("input"),J=v(),$=p("span"),$.textContent="A",ke=v(),Ce=p("div"),S=C(D),L=p("br"),q=v(),W=p("label"),te=p("input"),fe=v(),_e=p("span"),_e.textContent="kWp",de=v(),x=p("div"),x.innerHTML="",he=v(),be=p("div"),Ae=p("label"),Te=p("input"),Oe=v(),De=C(Ie),Ue=v(),ve&&ve.c(),xe=v(),Ee&&Ee.c(),wt=v(),tt=p("label"),ot=p("input"),St=v(),at=C(dt),it=v(),Qe&&Qe.c(),u(l,"class","text-sm"),u(a,"href",_l("Meter-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","m"),f.value="true",u(m,"type","hidden"),u(m,"name","mo"),m.value="1",R.__value=0,H(R,R.__value),M.__value=2,H(M,M.__value),u(k,"name","ma"),u(k,"class","in-s"),t[6].m.a===void 0&&Dt(()=>t[35].call(k)),u(d,"class","my-1"),U.__value=2,H(U,U.__value),G.__value=1,H(G,G.__value),u(V,"name","md"),u(V,"class","in-s"),t[6].m.d===void 0&&Dt(()=>t[41].call(V)),u(T,"class","my-1"),u(oe,"name","mf"),u(oe,"type","number"),u(oe,"min","5"),u(oe,"max","65535"),u(oe,"class","in-f tr w-full"),u($,"class","in-post"),u(pe,"class","flex"),u(Q,"class","mx-1"),u(te,"name","mr"),u(te,"type","number"),u(te,"min","0"),u(te,"max","65535"),u(te,"class","in-f tr w-full"),u(_e,"class","in-post"),u(W,"class","flex"),u(Ce,"class","mx-1"),u(le,"class","my-1 flex"),u(x,"class","my-1"),u(Te,"type","checkbox"),u(Te,"name","me"),Te.__value="true",H(Te,Te.__value),u(Te,"class","rounded mb-1"),u(be,"class","my-1"),u(ot,"type","checkbox"),u(ot,"name","mm"),ot.__value="true",H(ot,ot.__value),u(ot,"class","rounded mb-1"),u(e,"class","cnt")},m(Fe,Xe){P(Fe,e,Xe),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(e,_),o(e,d),o(d,b),o(d,g),o(d,w),o(d,k),o(k,R),o(R,F),o(k,M),o(M,O),We&&We.m(k,null),Ke(k,t[6].m.a,!0),o(e,Y),lt.m(e,null),o(e,z),o(e,T),o(T,X),o(T,y),o(T,K),o(T,V),o(V,U),o(V,G),Ke(V,t[6].m.d,!0),o(e,se),o(e,le),o(le,Q),o(Q,re),o(Q,ue),o(Q,ne),o(Q,pe),o(pe,oe),H(oe,t[6].m.f),o(pe,J),o(pe,$),o(le,ke),o(le,Ce),o(Ce,S),o(Ce,L),o(Ce,q),o(Ce,W),o(W,te),H(te,t[6].m.r),o(W,fe),o(W,_e),o(e,de),o(e,x),o(e,he),o(e,be),o(be,Ae),o(Ae,Te),Te.checked=t[6].m.e.e,o(Ae,Oe),o(Ae,De),o(be,Ue),ve&&ve.m(be,null),o(e,xe),Ee&&Ee.m(e,null),o(e,wt),o(e,tt),o(tt,ot),ot.checked=t[6].m.m.e,o(tt,St),o(tt,at),o(e,it),Qe&&Qe.m(e,null),ft||(Ot=[ce(k,"change",t[35]),ce(V,"change",t[41]),ce(oe,"input",t[42]),ce(te,"input",t[43]),ce(Te,"change",t[44]),ce(ot,"change",t[47])],ft=!0)},p(Fe,Xe){var je,Et,Ut,$e,st,qt,pt,ge,nt,ze,xt,el,tl,ll,nl,il,sl,Ze,Se,ee,Le,al,Xt;Xe[0]&4&&n!==(n=(((Et=(je=Fe[2].conf)==null?void 0:je.meter)==null?void 0:Et.title)??"Meter")+"")&&E(i,n),Xe[0]&4&&h!==(h=(((st=($e=(Ut=Fe[2].conf)==null?void 0:Ut.meter)==null?void 0:$e.comm)==null?void 0:st.title)??"Communication")+"")&&E(b,h),Xe[0]&4&&I!==(I=(((ge=(pt=(qt=Fe[2].conf)==null?void 0:qt.meter)==null?void 0:pt.comm)==null?void 0:ge.passive)??"Passive")+"")&&E(F,I),Xe[0]&4&&A!==(A=(((xt=(ze=(nt=Fe[2].conf)==null?void 0:nt.meter)==null?void 0:ze.comm)==null?void 0:xt.pulse)??"Pulse")+"")&&E(O,A),Xe[0]&1&&(j=(tl=(el=Fe[0])==null?void 0:el.features)==null?void 0:tl.includes("kmp")),j?We||(We=Yo(),We.c(),We.m(k,null)):We&&(We.d(1),We=null),Xe[0]&64&&Ke(k,Fe[6].m.a),He===(He=Re(Fe))&<?lt.p(Fe,Xe):(lt.d(1),lt=He(Fe),lt&&(lt.c(),lt.m(e,z))),Xe[0]&4&&B!==(B=(((ll=Fe[2].common)==null?void 0:ll.voltage)??"Voltage")+"")&&E(X,B),Xe[0]&64&&Ke(V,Fe[6].m.d),Xe[0]&4&&ae!==(ae=(((il=(nl=Fe[2].conf)==null?void 0:nl.meter)==null?void 0:il.fuse)??"Main fuse")+"")&&E(re,ae),Xe[0]&64&&ye(oe.value)!==Fe[6].m.f&&H(oe,Fe[6].m.f),Xe[0]&4&&D!==(D=(((Ze=(sl=Fe[2].conf)==null?void 0:sl.meter)==null?void 0:Ze.prod)??"Production")+"")&&E(S,D),Xe[0]&64&&ye(te.value)!==Fe[6].m.r&&H(te,Fe[6].m.r),Xe[0]&64&&(Te.checked=Fe[6].m.e.e),Xe[0]&4&&Ie!==(Ie=(((ee=(Se=Fe[2].conf)==null?void 0:Se.meter)==null?void 0:ee.encrypted)??"Encrypted")+"")&&E(De,Ie),Fe[6].m.e.e?ve?ve.p(Fe,Xe):(ve=Qo(Fe),ve.c(),ve.m(be,null)):ve&&(ve.d(1),ve=null),Fe[6].m.e.e?Ee?Ee.p(Fe,Xe):(Ee=Xo(Fe),Ee.c(),Ee.m(e,wt)):Ee&&(Ee.d(1),Ee=null),Xe[0]&64&&(ot.checked=Fe[6].m.m.e),Xe[0]&4&&dt!==(dt=(((Xt=(al=(Le=Fe[2].conf)==null?void 0:Le.meter)==null?void 0:al.multipliers)==null?void 0:Xt.title)??"Multipliers")+"")&&E(at,dt),Fe[6].m.m.e?Qe?Qe.p(Fe,Xe):(Qe=Zo(Fe),Qe.c(),Qe.m(e,null)):Qe&&(Qe.d(1),Qe=null)},d(Fe){Fe&&N(e),We&&We.d(),lt.d(),ve&&ve.d(),Ee&&Ee.d(),Qe&&Qe.d(),ft=!1,Bt(Ot)}}}function Yo(t){let e;return{c(){e=p("option"),e.textContent="KMP",e.__value=9,H(e,e.__value)},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function ac(t){var re,ue,ne,pe,oe,J;let e,l,n=(((ue=(re=t[2].conf)==null?void 0:re.meter)==null?void 0:ue.buffer)??"Buffer size")+"",i,s,a,r=(((pe=(ne=t[2].conf)==null?void 0:ne.meter)==null?void 0:pe.serial)??"Serial conf.")+"",f,c,m,_,d,h=(((J=(oe=t[2].conf)==null?void 0:oe.meter)==null?void 0:J.inverted)??"inverted")+"",b,g,w,k,R,I,F,M,A,O,j,Y,z,T,B,X,y,K,V,U,G,se,le,Q=rt([3,12,24,48,96,192,384,576,1152]),ae=[];for(let $=0;$<9;$+=1)ae[$]=uc(nc(t,Q,$));return{c(){e=p("div"),l=p("span"),i=C(n),s=v(),a=p("span"),f=C(r),c=v(),m=p("label"),_=p("input"),d=v(),b=C(h),g=v(),w=p("div"),k=p("select"),R=p("option"),I=C("Autodetect");for(let $=0;$<9;$+=1)ae[$].c();M=v(),A=p("select"),O=p("option"),j=C("-"),z=p("option"),z.textContent="7N1",T=p("option"),T.textContent="8N1",B=p("option"),B.textContent="8N2",X=p("option"),X.textContent="7E1",y=p("option"),y.textContent="8E1",V=v(),U=p("input"),u(l,"class","float-right"),u(_,"name","mi"),_.__value="true",H(_,_.__value),u(_,"type","checkbox"),u(_,"class","rounded mb-1"),u(m,"class","mt-2 ml-3 whitespace-nowrap"),R.__value=0,H(R,R.__value),R.disabled=F=t[6].m.b!=0,u(k,"name","mb"),u(k,"class","in-f tr w-1/2"),t[6].m.b===void 0&&Dt(()=>t[38].call(k)),O.__value=0,H(O,O.__value),O.disabled=Y=t[6].m.b!=0,z.__value=2,H(z,z.__value),T.__value=3,H(T,T.__value),B.__value=7,H(B,B.__value),X.__value=10,H(X,X.__value),y.__value=11,H(y,y.__value),u(A,"name","mp"),u(A,"class","in-m"),A.disabled=K=t[6].m.b==0,t[6].m.p===void 0&&Dt(()=>t[39].call(A)),u(U,"name","ms"),u(U,"type","number"),u(U,"min",64),u(U,"max",G=t[0].chip=="esp8266"?t[6].i.h.p==3||t[6].i.h.p==113?512:256:4096),u(U,"step",64),u(U,"class","in-l tr w-1/2"),u(w,"class","flex w-full"),u(e,"class","my-1")},m($,ke){P($,e,ke),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(e,c),o(e,m),o(m,_),_.checked=t[6].m.i,o(m,d),o(m,b),o(e,g),o(e,w),o(w,k),o(k,R),o(R,I);for(let Ce=0;Ce<9;Ce+=1)ae[Ce]&&ae[Ce].m(k,null);Ke(k,t[6].m.b,!0),o(w,M),o(w,A),o(A,O),o(O,j),o(A,z),o(A,T),o(A,B),o(A,X),o(A,y),Ke(A,t[6].m.p,!0),o(w,V),o(w,U),H(U,t[6].m.s),se||(le=[ce(_,"change",t[37]),ce(k,"change",t[38]),ce(A,"change",t[39]),ce(U,"input",t[40])],se=!0)},p($,ke){var Ce,D,S,L,q,W;ke[0]&4&&n!==(n=(((D=(Ce=$[2].conf)==null?void 0:Ce.meter)==null?void 0:D.buffer)??"Buffer size")+"")&&E(i,n),ke[0]&4&&r!==(r=(((L=(S=$[2].conf)==null?void 0:S.meter)==null?void 0:L.serial)??"Serial conf.")+"")&&E(f,r),ke[0]&64&&(_.checked=$[6].m.i),ke[0]&4&&h!==(h=(((W=(q=$[2].conf)==null?void 0:q.meter)==null?void 0:W.inverted)??"inverted")+"")&&E(b,h),ke[0]&64&&F!==(F=$[6].m.b!=0)&&(R.disabled=F),ke[0]&64&&Ke(k,$[6].m.b),ke[0]&64&&Y!==(Y=$[6].m.b!=0)&&(O.disabled=Y),ke[0]&64&&K!==(K=$[6].m.b==0)&&(A.disabled=K),ke[0]&64&&Ke(A,$[6].m.p),ke[0]&65&&G!==(G=$[0].chip=="esp8266"?$[6].i.h.p==3||$[6].i.h.p==113?512:256:4096)&&u(U,"max",G),ke[0]&64&&ye(U.value)!==$[6].m.s&&H(U,$[6].m.s)},d($){$&&N(e),Zt(ae,$),se=!1,Bt(le)}}}function fc(t){var c,m;let e,l,n=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.pulses)??"Pulses per kWh")+"",i,s,a,r,f;return{c(){e=p("div"),l=p("span"),i=C(n),s=v(),a=p("input"),u(a,"name","mb"),u(a,"class","in-s tr"),u(a,"type","number"),u(a,"min",1),u(a,"max",3600),u(e,"class","my-1")},m(_,d){P(_,e,d),o(e,l),o(l,i),o(e,s),o(e,a),H(a,t[6].m.b),r||(f=ce(a,"input",t[36]),r=!0)},p(_,d){var h,b;d[0]&4&&n!==(n=(((b=(h=_[2].conf)==null?void 0:h.meter)==null?void 0:b.pulses)??"Pulses per kWh")+"")&&E(i,n),d[0]&64&&ye(a.value)!==_[6].m.b&&H(a,_[6].m.b)},d(_){_&&N(e),r=!1,f()}}}function uc(t){let e;return{c(){e=p("option"),e.textContent=`${t[134]*100}`,e.__value=t[134]*100,H(e,e.__value)},m(l,n){P(l,e,n)},p:Ye,d(l){l&&N(e)}}}function Qo(t){let e,l,n,i;return{c(){e=p("br"),l=p("input"),u(l,"name","mek"),u(l,"type","text"),u(l,"class","in-s"),u(l,"pattern",hu)},m(s,a){P(s,e,a),P(s,l,a),H(l,t[6].m.e.k),n||(i=ce(l,"input",t[45]),n=!0)},p(s,a){a[0]&64&&l.value!==s[6].m.e.k&&H(l,s[6].m.e.k)},d(s){s&&(N(e),N(l)),n=!1,i()}}}function Xo(t){var c,m;let e,l=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.authkey)??"Authentication key")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","mea"),u(a,"type","text"),u(a,"class","in-s"),u(a,"pattern",hu),u(e,"class","my-1")},m(_,d){P(_,e,d),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].m.e.a),r||(f=ce(a,"input",t[46]),r=!0)},p(_,d){var h,b;d[0]&4&&l!==(l=(((b=(h=_[2].conf)==null?void 0:h.meter)==null?void 0:b.authkey)??"Authentication key")+"")&&E(n,l),d[0]&64&&a.value!==_[6].m.e.a&&H(a,_[6].m.e.a)},d(_){_&&N(e),r=!1,f()}}}function Zo(t){var K,V,U,G,se,le,Q,ae,re,ue,ne,pe;let e,l,n=(((U=(V=(K=t[2].conf)==null?void 0:K.meter)==null?void 0:V.multipliers)==null?void 0:U.watt)??"Watt")+"",i,s,a,r,f,c,m=(((le=(se=(G=t[2].conf)==null?void 0:G.meter)==null?void 0:se.multipliers)==null?void 0:le.volt)??"Volt")+"",_,d,h,b,g,w,k=(((re=(ae=(Q=t[2].conf)==null?void 0:Q.meter)==null?void 0:ae.multipliers)==null?void 0:re.amp)??"Amp")+"",R,I,F,M,A,O,j=(((pe=(ne=(ue=t[2].conf)==null?void 0:ue.meter)==null?void 0:ne.multipliers)==null?void 0:pe.kwh)??"kWh")+"",Y,z,T,B,X,y;return{c(){e=p("div"),l=p("div"),i=C(n),s=p("br"),a=v(),r=p("input"),f=v(),c=p("div"),_=C(m),d=p("br"),h=v(),b=p("input"),g=v(),w=p("div"),R=C(k),I=p("br"),F=v(),M=p("input"),A=v(),O=p("div"),Y=C(j),z=p("br"),T=v(),B=p("input"),u(r,"name","mmw"),u(r,"type","number"),u(r,"min","0.00"),u(r,"max","1000"),u(r,"step","0.001"),u(r,"class","in-f tr w-full"),u(l,"class","w-1/4"),u(b,"name","mmv"),u(b,"type","number"),u(b,"min","0.00"),u(b,"max","1000"),u(b,"step","0.001"),u(b,"class","in-m tr w-full"),u(c,"class","w-1/4"),u(M,"name","mma"),u(M,"type","number"),u(M,"min","0.00"),u(M,"max","1000"),u(M,"step","0.001"),u(M,"class","in-m tr w-full"),u(w,"class","w-1/4"),u(B,"name","mmc"),u(B,"type","number"),u(B,"min","0.00"),u(B,"max","1000"),u(B,"step","0.001"),u(B,"class","in-l tr w-full"),u(O,"class","w-1/4"),u(e,"class","flex my-1")},m(oe,J){P(oe,e,J),o(e,l),o(l,i),o(l,s),o(l,a),o(l,r),H(r,t[6].m.m.w),o(e,f),o(e,c),o(c,_),o(c,d),o(c,h),o(c,b),H(b,t[6].m.m.v),o(e,g),o(e,w),o(w,R),o(w,I),o(w,F),o(w,M),H(M,t[6].m.m.a),o(e,A),o(e,O),o(O,Y),o(O,z),o(O,T),o(O,B),H(B,t[6].m.m.c),X||(y=[ce(r,"input",t[48]),ce(b,"input",t[49]),ce(M,"input",t[50]),ce(B,"input",t[51])],X=!0)},p(oe,J){var $,ke,Ce,D,S,L,q,W,te,fe,_e,de;J[0]&4&&n!==(n=(((Ce=(ke=($=oe[2].conf)==null?void 0:$.meter)==null?void 0:ke.multipliers)==null?void 0:Ce.watt)??"Watt")+"")&&E(i,n),J[0]&64&&ye(r.value)!==oe[6].m.m.w&&H(r,oe[6].m.m.w),J[0]&4&&m!==(m=(((L=(S=(D=oe[2].conf)==null?void 0:D.meter)==null?void 0:S.multipliers)==null?void 0:L.volt)??"Volt")+"")&&E(_,m),J[0]&64&&ye(b.value)!==oe[6].m.m.v&&H(b,oe[6].m.m.v),J[0]&4&&k!==(k=(((te=(W=(q=oe[2].conf)==null?void 0:q.meter)==null?void 0:W.multipliers)==null?void 0:te.amp)??"Amp")+"")&&E(R,k),J[0]&64&&ye(M.value)!==oe[6].m.m.a&&H(M,oe[6].m.m.a),J[0]&4&&j!==(j=(((de=(_e=(fe=oe[2].conf)==null?void 0:fe.meter)==null?void 0:_e.multipliers)==null?void 0:de.kwh)??"kWh")+"")&&E(Y,j),J[0]&64&&ye(B.value)!==oe[6].m.m.c&&H(B,oe[6].m.m.c)},d(oe){oe&&N(e),X=!1,Bt(y)}}}function Jo(t){var O,j,Y,z,T,B;let e,l,n=(((j=(O=t[2].conf)==null?void 0:O.connection)==null?void 0:j.title)??"Connection")+"",i,s,a,r,f,c,m,_,d,h=(((z=(Y=t[2].conf)==null?void 0:Y.connection)==null?void 0:z.wifi)??"WiFi")+"",b,g,w=(((B=(T=t[2].conf)==null?void 0:T.connection)==null?void 0:B.ap)??"AP")+"",k,R,I,F,M=t[0].if&&t[0].if.eth&&$o(t),A=(t[6].n.c==1||t[6].n.c==2)&&xo(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("select"),d=p("option"),b=C(h),g=p("option"),k=C(w),M&&M.c(),R=v(),A&&A.c(),u(l,"class","text-sm"),u(a,"href",_l("Network-connection")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","w"),f.value="true",d.__value=1,H(d,d.__value),g.__value=2,H(g,g.__value),u(_,"name","nc"),u(_,"class","in-s"),t[6].n.c===void 0&&Dt(()=>t[52].call(_)),u(m,"class","my-1"),u(e,"class","cnt")},m(X,y){P(X,e,y),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,d),o(d,b),o(_,g),o(g,k),M&&M.m(_,null),Ke(_,t[6].n.c,!0),o(e,R),A&&A.m(e,null),I||(F=ce(_,"change",t[52]),I=!0)},p(X,y){var K,V,U,G,se,le;y[0]&4&&n!==(n=(((V=(K=X[2].conf)==null?void 0:K.connection)==null?void 0:V.title)??"Connection")+"")&&E(i,n),y[0]&4&&h!==(h=(((G=(U=X[2].conf)==null?void 0:U.connection)==null?void 0:G.wifi)??"WiFi")+"")&&E(b,h),y[0]&4&&w!==(w=(((le=(se=X[2].conf)==null?void 0:se.connection)==null?void 0:le.ap)??"AP")+"")&&E(k,w),X[0].if&&X[0].if.eth?M?M.p(X,y):(M=$o(X),M.c(),M.m(_,null)):M&&(M.d(1),M=null),y[0]&64&&Ke(_,X[6].n.c),X[6].n.c==1||X[6].n.c==2?A?A.p(X,y):(A=xo(X),A.c(),A.m(e,null)):A&&(A.d(1),A=null)},d(X){X&&N(e),M&&M.d(),A&&A.d(),I=!1,F()}}}function $o(t){var i,s;let e,l=(((s=(i=t[2].conf)==null?void 0:i.connection)==null?void 0:s.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=C(l),e.__value=3,H(e,e.__value)},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&E(n,l)},d(a){a&&N(e)}}}function xo(t){var Ae,Te,Oe,Ie,De,Ue,xe,wt,tt,ot,St,dt,at,it,ft,Ot,We,Re,He,lt,ve,Ee,Qe;let e,l=(((Te=(Ae=t[2].conf)==null?void 0:Ae.connection)==null?void 0:Te.ssid)??"SSID")+"",n,i,s,a,r,f,c,m,_,d,h=(((Ie=(Oe=t[2].conf)==null?void 0:Oe.connection)==null?void 0:Ie.psk)??"Password")+"",b,g,w,k,R,I,F,M=(((xe=(Ue=(De=t[2].conf)==null?void 0:De.connection)==null?void 0:Ue.ps)==null?void 0:xe.title)??"Power saving")+"",A,O,j,Y,z,T=(((ot=(tt=(wt=t[2].conf)==null?void 0:wt.connection)==null?void 0:tt.ps)==null?void 0:ot.default)??"Default")+"",B,X,y=(((at=(dt=(St=t[2].conf)==null?void 0:St.connection)==null?void 0:dt.ps)==null?void 0:at.off)??"Off")+"",K,V,U=(((Ot=(ft=(it=t[2].conf)==null?void 0:it.connection)==null?void 0:ft.ps)==null?void 0:Ot.min)??"Min")+"",G,se,le=(((He=(Re=(We=t[2].conf)==null?void 0:We.connection)==null?void 0:Re.ps)==null?void 0:He.max)??"Max")+"",Q,ae,re,ue=(((ve=(lt=t[2].conf)==null?void 0:lt.connection)==null?void 0:ve.pwr)??"Power")+"",ne,pe,oe,J,$,ke,Ce,D,S,L,q,W,te=(((Qe=(Ee=t[2].conf)==null?void 0:Ee.connection)==null?void 0:Qe.tick_11b)??"802.11b")+"",fe,_e,de;function x(me,we){return me[8]?cc:rc}let he=x(t),be=he(t);return{c(){e=p("div"),n=C(l),i=v(),s=p("label"),a=p("input"),r=C(" manual"),f=v(),c=p("br"),m=v(),be.c(),_=v(),d=p("div"),b=C(h),g=p("br"),w=v(),k=p("input"),R=v(),I=p("div"),F=p("div"),A=C(M),O=p("br"),j=v(),Y=p("select"),z=p("option"),B=C(T),X=p("option"),K=C(y),V=p("option"),G=C(U),se=p("option"),Q=C(le),ae=v(),re=p("div"),ne=C(ue),pe=p("br"),oe=v(),J=p("div"),$=p("input"),ke=v(),Ce=p("span"),Ce.textContent="dBm",D=v(),S=p("div"),L=p("label"),q=p("input"),W=v(),fe=C(te),u(a,"type","checkbox"),a.__value="true",H(a,a.__value),u(a,"class","rounded mb-1"),u(s,"class","float-right mr-3"),u(e,"class","my-1"),u(k,"name","wp"),u(k,"type","password"),u(k,"class","in-s"),u(k,"pattern",Mn),u(d,"class","my-1"),z.__value=255,H(z,z.__value),X.__value=0,H(X,X.__value),V.__value=1,H(V,V.__value),se.__value=2,H(se,se.__value),u(Y,"name","wz"),u(Y,"class","in-s"),t[6].w.z===void 0&&Dt(()=>t[57].call(Y)),u(F,"class","w-1/2"),u($,"name","ww"),u($,"type","number"),u($,"min","0"),u($,"max","20.5"),u($,"step","0.5"),u($,"class","in-f tr w-full"),u(Ce,"class","in-post"),u(J,"class","flex"),u(re,"class","ml-2 w-1/2"),u(I,"class","my-1 flex"),u(q,"type","checkbox"),u(q,"name","wb"),q.__value="true",H(q,q.__value),u(q,"class","rounded mb-1"),u(S,"class","my-3")},m(me,we){P(me,e,we),o(e,n),o(e,i),o(e,s),o(s,a),a.checked=t[8],o(s,r),o(e,f),o(e,c),o(e,m),be.m(e,null),P(me,_,we),P(me,d,we),o(d,b),o(d,g),o(d,w),o(d,k),H(k,t[6].w.p),P(me,R,we),P(me,I,we),o(I,F),o(F,A),o(F,O),o(F,j),o(F,Y),o(Y,z),o(z,B),o(Y,X),o(X,K),o(Y,V),o(V,G),o(Y,se),o(se,Q),Ke(Y,t[6].w.z,!0),o(I,ae),o(I,re),o(re,ne),o(re,pe),o(re,oe),o(re,J),o(J,$),H($,t[6].w.w),o(J,ke),o(J,Ce),P(me,D,we),P(me,S,we),o(S,L),o(L,q),q.checked=t[6].w.b,o(L,W),o(L,fe),_e||(de=[ce(a,"change",t[53]),ce(k,"input",t[56]),ce(Y,"change",t[57]),ce($,"input",t[58]),ce(q,"change",t[59])],_e=!0)},p(me,we){var ut,Ge,Rt,bt,Be,gt,ct,mt,et,Tt,zt,kt,_t,yt,Qt,Ft,jt,Kt,Jt,Wt,Lt,Fe,Xe;we[0]&4&&l!==(l=(((Ge=(ut=me[2].conf)==null?void 0:ut.connection)==null?void 0:Ge.ssid)??"SSID")+"")&&E(n,l),we[0]&256&&(a.checked=me[8]),he===(he=x(me))&&be?be.p(me,we):(be.d(1),be=he(me),be&&(be.c(),be.m(e,null))),we[0]&4&&h!==(h=(((bt=(Rt=me[2].conf)==null?void 0:Rt.connection)==null?void 0:bt.psk)??"Password")+"")&&E(b,h),we[0]&64&&k.value!==me[6].w.p&&H(k,me[6].w.p),we[0]&4&&M!==(M=(((ct=(gt=(Be=me[2].conf)==null?void 0:Be.connection)==null?void 0:gt.ps)==null?void 0:ct.title)??"Power saving")+"")&&E(A,M),we[0]&4&&T!==(T=(((Tt=(et=(mt=me[2].conf)==null?void 0:mt.connection)==null?void 0:et.ps)==null?void 0:Tt.default)??"Default")+"")&&E(B,T),we[0]&4&&y!==(y=(((_t=(kt=(zt=me[2].conf)==null?void 0:zt.connection)==null?void 0:kt.ps)==null?void 0:_t.off)??"Off")+"")&&E(K,y),we[0]&4&&U!==(U=(((Ft=(Qt=(yt=me[2].conf)==null?void 0:yt.connection)==null?void 0:Qt.ps)==null?void 0:Ft.min)??"Min")+"")&&E(G,U),we[0]&4&&le!==(le=(((Jt=(Kt=(jt=me[2].conf)==null?void 0:jt.connection)==null?void 0:Kt.ps)==null?void 0:Jt.max)??"Max")+"")&&E(Q,le),we[0]&64&&Ke(Y,me[6].w.z),we[0]&4&&ue!==(ue=(((Lt=(Wt=me[2].conf)==null?void 0:Wt.connection)==null?void 0:Lt.pwr)??"Power")+"")&&E(ne,ue),we[0]&64&&ye($.value)!==me[6].w.w&&H($,me[6].w.w),we[0]&64&&(q.checked=me[6].w.b),we[0]&4&&te!==(te=(((Xe=(Fe=me[2].conf)==null?void 0:Fe.connection)==null?void 0:Xe.tick_11b)??"802.11b")+"")&&E(fe,te)},d(me){me&&(N(e),N(_),N(d),N(R),N(I),N(D),N(S)),be.d(),_e=!1,Bt(de)}}}function rc(t){var f,c;let e,l,n,i,s,a=((f=t[9])==null?void 0:f.c)==-1&&ea(),r=((c=t[9])==null?void 0:c.n)&&ta(t);return{c(){e=p("select"),a&&a.c(),l=Ht(),r&&r.c(),u(e,"name","ws"),u(e,"class","in-s"),e.required=n=t[6].n.c==1||t[6].n.c==2,t[6].w.s===void 0&&Dt(()=>t[55].call(e))},m(m,_){P(m,e,_),a&&a.m(e,null),o(e,l),r&&r.m(e,null),Ke(e,t[6].w.s,!0),i||(s=ce(e,"change",t[55]),i=!0)},p(m,_){var d,h;((d=m[9])==null?void 0:d.c)==-1?a||(a=ea(),a.c(),a.m(e,l)):a&&(a.d(1),a=null),(h=m[9])!=null&&h.n?r?r.p(m,_):(r=ta(m),r.c(),r.m(e,null)):r&&(r.d(1),r=null),_[0]&64&&n!==(n=m[6].n.c==1||m[6].n.c==2)&&(e.required=n),_[0]&64&&Ke(e,m[6].w.s)},d(m){m&&N(e),a&&a.d(),r&&r.d(),i=!1,s()}}}function cc(t){let e,l,n,i;return{c(){e=p("input"),u(e,"name","ws"),u(e,"type","text"),u(e,"class","in-s"),u(e,"pattern",Mn),e.required=l=t[6].n.c==1||t[6].n.c==2},m(s,a){P(s,e,a),H(e,t[6].w.s),n||(i=ce(e,"input",t[54]),n=!0)},p(s,a){a[0]&64&&l!==(l=s[6].n.c==1||s[6].n.c==2)&&(e.required=l),a[0]&64&&e.value!==s[6].w.s&&H(e,s[6].w.s)},d(s){s&&N(e),n=!1,i()}}}function ea(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",H(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function ta(t){var i;let e,l=rt((i=t[9])==null?void 0:i.n),n=[];for(let s=0;st[60].call(b)),u(A,"name","ni"),u(A,"type","text"),u(A,"class","in-m w-full"),A.disabled=O=t[6].n.m=="dhcp",A.required=j=t[6].n.m=="static",u(A,"pattern",_n),u(z,"name","ns"),u(z,"class","in-l"),z.disabled=B=t[6].n.m=="dhcp",z.required=X=t[6].n.m=="static",t[6].n.s===void 0&&Dt(()=>t[62].call(z)),u(h,"class","flex"),u(f,"class","my-1"),u(G,"name","nx"),G.__value="true",H(G,G.__value),u(G,"type","checkbox"),u(G,"class","rounded mb-1"),u(V,"class","my-1"),u(re,"name","nd"),re.__value="true",H(re,re.__value),u(re,"type","checkbox"),u(re,"class","rounded mb-1"),u(Q,"class","my-1"),u(J,"type","hidden"),u(J,"name","ntp"),J.value="true",u(q,"name","ntpd"),q.__value="true",H(q,q.__value),u(q,"type","checkbox"),u(q,"class","rounded mb-1"),u(L,"class","ml-4"),u(he,"name","ntph"),u(he,"type","text"),u(he,"class","in-s"),u(he,"pattern",Ll),u(x,"class","flex"),u(ke,"class","my-1"),u(e,"class","cnt")},m(Re,He){P(Re,e,He),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(f,m),o(f,_),o(f,d),o(f,h),o(h,b),o(b,g),o(g,k),o(b,R),o(R,F),Ke(b,t[6].n.m,!0),o(h,M),o(h,A),H(A,t[6].n.i),o(h,Y),o(h,z),Me(T,z,null),Ke(z,t[6].n.s,!0),o(e,y),Oe&&Oe.m(e,null),o(e,K),o(e,V),o(V,U),o(U,G),G.checked=t[6].n.x,o(U,se),o(e,le),o(e,Q),o(Q,ae),o(ae,re),re.checked=t[6].n.d,o(ae,ue),o(ae,pe),o(e,oe),o(e,J),o(e,$),o(e,ke),o(ke,D),o(ke,S),o(ke,L),o(L,q),q.checked=t[6].n.h,o(L,W),o(L,fe),o(ke,_e),o(ke,de),o(ke,x),o(x,he),H(he,t[6].n.n1),be=!0,Ae||(Te=[ce(b,"change",t[60]),ce(A,"input",t[61]),ce(z,"change",t[62]),ce(G,"change",t[66]),ce(re,"change",t[67]),ce(q,"change",t[68]),ce(he,"input",t[69])],Ae=!0)},p(Re,He){var lt,ve,Ee,Qe,me,we,ut,Ge,Rt,bt,Be,gt,ct,mt;(!be||He[0]&4)&&n!==(n=(((ve=(lt=Re[2].conf)==null?void 0:lt.network)==null?void 0:ve.title)??"Network")+"")&&E(i,n),(!be||He[0]&4)&&c!==(c=(((Qe=(Ee=Re[2].conf)==null?void 0:Ee.network)==null?void 0:Qe.ip)??"IP")+"")&&E(m,c),(!be||He[0]&4)&&w!==(w=(((we=(me=Re[2].conf)==null?void 0:me.network)==null?void 0:we.dhcp)??"DHCP")+"")&&E(k,w),(!be||He[0]&4)&&I!==(I=(((Ge=(ut=Re[2].conf)==null?void 0:ut.network)==null?void 0:Ge.static)??"Static")+"")&&E(F,I),He[0]&64&&Ke(b,Re[6].n.m),(!be||He[0]&64&&O!==(O=Re[6].n.m=="dhcp"))&&(A.disabled=O),(!be||He[0]&64&&j!==(j=Re[6].n.m=="static"))&&(A.required=j),He[0]&64&&A.value!==Re[6].n.i&&H(A,Re[6].n.i),(!be||He[0]&64&&B!==(B=Re[6].n.m=="dhcp"))&&(z.disabled=B),(!be||He[0]&64&&X!==(X=Re[6].n.m=="static"))&&(z.required=X),He[0]&64&&Ke(z,Re[6].n.s),Re[6].n.m=="static"?Oe?Oe.p(Re,He):(Oe=ia(Re),Oe.c(),Oe.m(e,K)):Oe&&(Oe.d(1),Oe=null),He[0]&64&&(G.checked=Re[6].n.x),He[0]&64&&(re.checked=Re[6].n.d),(!be||He[0]&4)&&ne!==(ne=(((bt=(Rt=Re[2].conf)==null?void 0:Rt.network)==null?void 0:bt.tick_mdns)??"mDNS")+"")&&E(pe,ne),(!be||He[0]&4)&&Ce!==(Ce=(((gt=(Be=Re[2].conf)==null?void 0:Be.network)==null?void 0:gt.ntp)??"NTP")+"")&&E(D,Ce),He[0]&64&&(q.checked=Re[6].n.h),(!be||He[0]&4)&&te!==(te=(((mt=(ct=Re[2].conf)==null?void 0:ct.network)==null?void 0:mt.tick_ntp_dhcp)??"from DHCP")+"")&&E(fe,te),He[0]&64&&he.value!==Re[6].n.n1&&H(he,Re[6].n.n1)},i(Re){be||(Z(T.$$.fragment,Re),be=!0)},o(Re){ie(T.$$.fragment,Re),be=!1},d(Re){Re&&N(e),Ne(T),Oe&&Oe.d(),Ae=!1,Bt(Te)}}}function ia(t){var I,F,M,A;let e,l=(((F=(I=t[2].conf)==null?void 0:I.network)==null?void 0:F.gw)??"Gateway")+"",n,i,s,a,r,f,c=(((A=(M=t[2].conf)==null?void 0:M.network)==null?void 0:A.dns)??"DNS")+"",m,_,d,h,b,g,w,k,R;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),r=v(),f=p("div"),m=C(c),_=p("br"),d=v(),h=p("div"),b=p("input"),g=v(),w=p("input"),u(a,"name","ng"),u(a,"type","text"),u(a,"class","in-s"),u(a,"pattern",_n),u(e,"class","my-1"),u(b,"name","nd1"),u(b,"type","text"),u(b,"class","in-f w-full"),u(b,"pattern",_n),u(w,"name","nd2"),u(w,"type","text"),u(w,"class","in-l w-full"),u(w,"pattern",_n),u(h,"class","flex"),u(f,"class","my-1")},m(O,j){P(O,e,j),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].n.g),P(O,r,j),P(O,f,j),o(f,m),o(f,_),o(f,d),o(f,h),o(h,b),H(b,t[6].n.d1),o(h,g),o(h,w),H(w,t[6].n.d2),k||(R=[ce(a,"input",t[63]),ce(b,"input",t[64]),ce(w,"input",t[65])],k=!0)},p(O,j){var Y,z,T,B;j[0]&4&&l!==(l=(((z=(Y=O[2].conf)==null?void 0:Y.network)==null?void 0:z.gw)??"Gateway")+"")&&E(n,l),j[0]&64&&a.value!==O[6].n.g&&H(a,O[6].n.g),j[0]&4&&c!==(c=(((B=(T=O[2].conf)==null?void 0:T.network)==null?void 0:B.dns)??"DNS")+"")&&E(m,c),j[0]&64&&b.value!==O[6].n.d1&&H(b,O[6].n.d1),j[0]&64&&w.value!==O[6].n.d2&&H(w,O[6].n.d2)},d(O){O&&(N(e),N(r),N(f)),k=!1,Bt(R)}}}function sa(t){var qt,pt,ge,nt,ze,xt,el,tl,ll,nl,il,sl,Ze,Se,ee,Le,al,Xt,ml,pl,kl,wl,Cl,Sl,Ml,Il,Rl,Fl;let e,l,n=(((pt=(qt=t[2].conf)==null?void 0:qt.mqtt)==null?void 0:pt.title)??"MQTT")+"",i,s,a,r,f,c,m,_=(((nt=(ge=t[2].conf)==null?void 0:ge.mqtt)==null?void 0:nt.server)??"Server")+"",d,h,b,g,w,k,R,I,F,M,A,O,j=(((xt=(ze=t[2].conf)==null?void 0:ze.mqtt)==null?void 0:xt.user)??"Username")+"",Y,z,T,B,X,y,K=(((tl=(el=t[2].conf)==null?void 0:el.mqtt)==null?void 0:tl.pass)??"Password")+"",V,U,G,se,le,Q,ae,re=(((nl=(ll=t[2].conf)==null?void 0:ll.mqtt)==null?void 0:nl.id)??"Client ID")+"",ue,ne,pe,oe,J,$,ke,Ce=(((sl=(il=t[2].conf)==null?void 0:il.mqtt)==null?void 0:sl.payload)??"Payload")+"",D,S,L,q,W,te,fe,_e,de,x,he,be,Ae,Te,Oe=(((Se=(Ze=t[2].conf)==null?void 0:Ze.mqtt)==null?void 0:Se.publish)??"Publish topic")+"",Ie,De,Ue,xe,wt,tt,ot=(((Le=(ee=t[2].conf)==null?void 0:ee.mqtt)==null?void 0:Le.subscribe)??"Subscribe topic")+"",St,dt,at,it,ft,Ot,We,Re=(((Xt=(al=t[2].conf)==null?void 0:al.mqtt)==null?void 0:Xt.update)??"Update method")+"",He,lt,ve,Ee=(((pl=(ml=t[2].conf)==null?void 0:ml.mqtt)==null?void 0:pl.interval)??"Interval")+"",Qe,me,we,ut,Ge,Rt=(((wl=(kl=t[2].conf)==null?void 0:kl.mqtt)==null?void 0:wl.realtime)??"Real time")+"",bt,Be,gt=(((Sl=(Cl=t[2].conf)==null?void 0:Cl.mqtt)==null?void 0:Sl.interval)??"Interval")+"",ct,mt,et,Tt,zt,kt,_t=(((Il=(Ml=t[2].conf)==null?void 0:Ml.mqtt)==null?void 0:Il.timeout)??"Timeout")+"",yt,Qt,Ft,jt=(((Fl=(Rl=t[2].conf)==null?void 0:Rl.mqtt)==null?void 0:Fl.keepalive)??"Keep-alive")+"",Kt,Jt,Wt,Lt,Fe,Xe,je,Et,Ut,$e=t[0].chip!="esp8266"&&oa(t),st=t[6].q.s.e&&aa(t);return{c(){var Ve,qe;e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),d=C(_),h=v(),$e&&$e.c(),b=v(),g=p("br"),w=v(),k=p("div"),R=p("input"),I=v(),F=p("input"),M=v(),st&&st.c(),A=v(),O=p("div"),Y=C(j),z=p("br"),T=v(),B=p("input"),X=v(),y=p("div"),V=C(K),U=p("br"),G=v(),se=p("input"),le=v(),Q=p("div"),ae=p("div"),ue=C(re),ne=p("br"),pe=v(),oe=p("input"),$=v(),ke=p("div"),D=C(Ce),S=p("br"),L=v(),q=p("select"),W=p("option"),W.textContent="Raw (minimal)",te=p("option"),te.textContent="Raw (full)",fe=p("option"),fe.textContent="Domoticz",_e=p("option"),_e.textContent="Home-Assistant",de=p("option"),de.textContent="JSON (classic)",x=p("option"),x.textContent="JSON (multi topic)",he=p("option"),he.textContent="JSON (flat)",be=p("option"),be.textContent="HEX dump",Ae=v(),Te=p("div"),Ie=C(Oe),De=p("br"),Ue=v(),xe=p("input"),wt=v(),tt=p("div"),St=C(ot),dt=p("br"),at=v(),it=p("input"),Ot=v(),We=p("div"),He=C(Re),lt=v(),ve=p("span"),Qe=C(Ee),me=v(),we=p("div"),ut=p("select"),Ge=p("option"),bt=C(Rt),Be=p("option"),ct=C(gt),mt=v(),et=p("input"),zt=v(),kt=p("div"),yt=C(_t),Qt=v(),Ft=p("span"),Kt=C(jt),Jt=v(),Wt=p("div"),Lt=p("input"),Fe=v(),Xe=p("input"),u(l,"class","text-sm"),u(a,"href",_l("MQTT-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","q"),f.value="true",u(R,"name","qh"),u(R,"type","text"),u(R,"class","in-f w-2/3"),u(R,"pattern",Ll),u(F,"name","qp"),u(F,"type","number"),u(F,"min","1024"),u(F,"max","65535"),u(F,"class","in-l tr w-1/3"),u(k,"class","flex"),u(m,"class","my-1"),u(B,"name","qu"),u(B,"type","text"),u(B,"class","in-s"),u(B,"pattern",Mn),u(O,"class","my-1"),u(se,"name","qa"),u(se,"type","password"),u(se,"class","in-s"),u(se,"pattern",Mn),u(y,"class","my-1"),u(oe,"name","qc"),u(oe,"type","text"),u(oe,"class","in-f w-full"),oe.required=J=t[6].q.h,u(oe,"pattern",Vn),W.__value=1,H(W,W.__value),te.__value=2,H(te,te.__value),fe.__value=3,H(fe,fe.__value),_e.__value=4,H(_e,_e.__value),de.__value=0,H(de,de.__value),x.__value=5,H(x,x.__value),he.__value=6,H(he,he.__value),be.__value=255,H(be,be.__value),u(q,"name","qm"),u(q,"class","in-l"),t[6].q.m===void 0&&Dt(()=>t[76].call(q)),u(Q,"class","my-1 flex"),u(xe,"name","qb"),u(xe,"type","text"),u(xe,"class","in-s"),u(xe,"pattern",Ll),u(Te,"class","my-1"),u(it,"name","qr"),u(it,"type","text"),u(it,"class","in-s"),u(it,"pattern",Ll),u(it,"placeholder",ft=t[6].q.b+"/command"),u(tt,"class","my-1"),u(ve,"class","float-right"),Ge.__value=0,H(Ge,Ge.__value),Be.__value=1,H(Be,Be.__value),u(ut,"name","qt"),u(ut,"class","in-f w-1/2"),t[6].q.t===void 0&&Dt(()=>t[79].call(ut)),u(et,"name","qd"),u(et,"type","number"),u(et,"min","1"),u(et,"max","3600"),u(et,"class","in-l tr w-1/2"),et.disabled=Tt=((qe=(Ve=t[6])==null?void 0:Ve.q)==null?void 0:qe.t)!=1,u(we,"class","flex"),u(We,"class","my-1"),u(Ft,"class","float-right"),u(Lt,"name","qi"),u(Lt,"type","number"),u(Lt,"min","500"),u(Lt,"max","10000"),u(Lt,"class","in-f tr w-1/2"),u(Xe,"name","qk"),u(Xe,"type","number"),u(Xe,"min","5"),u(Xe,"max","180"),u(Xe,"class","in-l tr w-1/2"),u(Wt,"class","flex"),u(kt,"class","my-1"),u(e,"class","cnt")},m(Ve,qe){P(Ve,e,qe),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,d),o(m,h),$e&&$e.m(m,null),o(m,b),o(m,g),o(m,w),o(m,k),o(k,R),H(R,t[6].q.h),o(k,I),o(k,F),H(F,t[6].q.p),o(e,M),st&&st.m(e,null),o(e,A),o(e,O),o(O,Y),o(O,z),o(O,T),o(O,B),H(B,t[6].q.u),o(e,X),o(e,y),o(y,V),o(y,U),o(y,G),o(y,se),H(se,t[6].q.a),o(e,le),o(e,Q),o(Q,ae),o(ae,ue),o(ae,ne),o(ae,pe),o(ae,oe),H(oe,t[6].q.c),o(Q,$),o(Q,ke),o(ke,D),o(ke,S),o(ke,L),o(ke,q),o(q,W),o(q,te),o(q,fe),o(q,_e),o(q,de),o(q,x),o(q,he),o(q,be),Ke(q,t[6].q.m,!0),o(e,Ae),o(e,Te),o(Te,Ie),o(Te,De),o(Te,Ue),o(Te,xe),H(xe,t[6].q.b),o(e,wt),o(e,tt),o(tt,St),o(tt,dt),o(tt,at),o(tt,it),H(it,t[6].q.r),o(e,Ot),o(e,We),o(We,He),o(We,lt),o(We,ve),o(ve,Qe),o(We,me),o(We,we),o(we,ut),o(ut,Ge),o(Ge,bt),o(ut,Be),o(Be,ct),Ke(ut,t[6].q.t,!0),o(we,mt),o(we,et),H(et,t[6].q.d),o(e,zt),o(e,kt),o(kt,yt),o(kt,Qt),o(kt,Ft),o(Ft,Kt),o(kt,Jt),o(kt,Wt),o(Wt,Lt),H(Lt,t[6].q.i),o(Wt,Fe),o(Wt,Xe),H(Xe,t[6].q.k),je=!0,Et||(Ut=[ce(R,"input",t[71]),ce(F,"input",t[72]),ce(B,"input",t[73]),ce(se,"input",t[74]),ce(oe,"input",t[75]),ce(q,"change",t[76]),ce(xe,"input",t[77]),ce(it,"input",t[78]),ce(ut,"change",t[79]),ce(et,"input",t[80]),ce(Lt,"input",t[81]),ce(Xe,"input",t[82])],Et=!0)},p(Ve,qe){var It,fl,Ul,Bl,jl,Hl,yl,zl,Wl,Gl,Vl,Kl,Yl,Ql,Xl,Zl,Jl,$l,xl,en,tn,Nn,Pn,Tn,qn,En,Dn,An,On,Ln;(!je||qe[0]&4)&&n!==(n=(((fl=(It=Ve[2].conf)==null?void 0:It.mqtt)==null?void 0:fl.title)??"MQTT")+"")&&E(i,n),(!je||qe[0]&4)&&_!==(_=(((Bl=(Ul=Ve[2].conf)==null?void 0:Ul.mqtt)==null?void 0:Bl.server)??"Server")+"")&&E(d,_),Ve[0].chip!="esp8266"?$e?$e.p(Ve,qe):($e=oa(Ve),$e.c(),$e.m(m,b)):$e&&($e.d(1),$e=null),qe[0]&64&&R.value!==Ve[6].q.h&&H(R,Ve[6].q.h),qe[0]&64&&ye(F.value)!==Ve[6].q.p&&H(F,Ve[6].q.p),Ve[6].q.s.e?st?(st.p(Ve,qe),qe[0]&64&&Z(st,1)):(st=aa(Ve),st.c(),Z(st,1),st.m(e,A)):st&&(ht(),ie(st,1,1,()=>{st=null}),vt()),(!je||qe[0]&4)&&j!==(j=(((Hl=(jl=Ve[2].conf)==null?void 0:jl.mqtt)==null?void 0:Hl.user)??"Username")+"")&&E(Y,j),qe[0]&64&&B.value!==Ve[6].q.u&&H(B,Ve[6].q.u),(!je||qe[0]&4)&&K!==(K=(((zl=(yl=Ve[2].conf)==null?void 0:yl.mqtt)==null?void 0:zl.pass)??"Password")+"")&&E(V,K),qe[0]&64&&se.value!==Ve[6].q.a&&H(se,Ve[6].q.a),(!je||qe[0]&4)&&re!==(re=(((Gl=(Wl=Ve[2].conf)==null?void 0:Wl.mqtt)==null?void 0:Gl.id)??"Client ID")+"")&&E(ue,re),(!je||qe[0]&64&&J!==(J=Ve[6].q.h))&&(oe.required=J),qe[0]&64&&oe.value!==Ve[6].q.c&&H(oe,Ve[6].q.c),(!je||qe[0]&4)&&Ce!==(Ce=(((Kl=(Vl=Ve[2].conf)==null?void 0:Vl.mqtt)==null?void 0:Kl.payload)??"Payload")+"")&&E(D,Ce),qe[0]&64&&Ke(q,Ve[6].q.m),(!je||qe[0]&4)&&Oe!==(Oe=(((Ql=(Yl=Ve[2].conf)==null?void 0:Yl.mqtt)==null?void 0:Ql.publish)??"Publish topic")+"")&&E(Ie,Oe),qe[0]&64&&xe.value!==Ve[6].q.b&&H(xe,Ve[6].q.b),(!je||qe[0]&4)&&ot!==(ot=(((Zl=(Xl=Ve[2].conf)==null?void 0:Xl.mqtt)==null?void 0:Zl.subscribe)??"Subscribe topic")+"")&&E(St,ot),(!je||qe[0]&64&&ft!==(ft=Ve[6].q.b+"/command"))&&u(it,"placeholder",ft),qe[0]&64&&it.value!==Ve[6].q.r&&H(it,Ve[6].q.r),(!je||qe[0]&4)&&Re!==(Re=((($l=(Jl=Ve[2].conf)==null?void 0:Jl.mqtt)==null?void 0:$l.update)??"Update method")+"")&&E(He,Re),(!je||qe[0]&4)&&Ee!==(Ee=(((en=(xl=Ve[2].conf)==null?void 0:xl.mqtt)==null?void 0:en.interval)??"Interval")+"")&&E(Qe,Ee),(!je||qe[0]&4)&&Rt!==(Rt=(((Nn=(tn=Ve[2].conf)==null?void 0:tn.mqtt)==null?void 0:Nn.realtime)??"Real time")+"")&&E(bt,Rt),(!je||qe[0]&4)&>!==(gt=(((Tn=(Pn=Ve[2].conf)==null?void 0:Pn.mqtt)==null?void 0:Tn.interval)??"Interval")+"")&&E(ct,gt),qe[0]&64&&Ke(ut,Ve[6].q.t),(!je||qe[0]&64&&Tt!==(Tt=((En=(qn=Ve[6])==null?void 0:qn.q)==null?void 0:En.t)!=1))&&(et.disabled=Tt),qe[0]&64&&ye(et.value)!==Ve[6].q.d&&H(et,Ve[6].q.d),(!je||qe[0]&4)&&_t!==(_t=(((An=(Dn=Ve[2].conf)==null?void 0:Dn.mqtt)==null?void 0:An.timeout)??"Timeout")+"")&&E(yt,_t),(!je||qe[0]&4)&&jt!==(jt=(((Ln=(On=Ve[2].conf)==null?void 0:On.mqtt)==null?void 0:Ln.keepalive)??"Keep-alive")+"")&&E(Kt,jt),qe[0]&64&&ye(Lt.value)!==Ve[6].q.i&&H(Lt,Ve[6].q.i),qe[0]&64&&ye(Xe.value)!==Ve[6].q.k&&H(Xe,Ve[6].q.k)},i(Ve){je||(Z(st),je=!0)},o(Ve){ie(st),je=!1},d(Ve){Ve&&N(e),$e&&$e.d(),st&&st.d(),Et=!1,Bt(Ut)}}}function oa(t){let e,l,n,i,s;return{c(){e=p("label"),l=p("input"),n=C(" SSL"),u(l,"type","checkbox"),u(l,"name","qs"),l.__value="true",H(l,l.__value),u(l,"class","rounded mb-1"),u(e,"class","float-right mr-3")},m(a,r){P(a,e,r),o(e,l),l.checked=t[6].q.s.e,o(e,n),i||(s=[ce(l,"change",t[70]),ce(l,"change",t[20])],i=!0)},p(a,r){r[0]&64&&(l.checked=a[6].q.s.e)},d(a){a&&N(e),i=!1,Bt(s)}}}function aa(t){let e,l,n,i,s,a,r,f,c,m,_,d,h;const b=[mc,_c],g=[];function w(O,j){return O[6].q.s.c?0:1}n=w(t),i=g[n]=b[n](t);const k=[vc,hc],R=[];function I(O,j){return O[6].q.s.r?0:1}r=I(t),f=R[r]=k[r](t);const F=[wc,kc],M=[];function A(O,j){return O[6].q.s.k?0:1}return _=A(t),d=M[_]=F[_](t),{c(){e=p("div"),l=p("span"),i.c(),s=v(),a=p("span"),f.c(),c=v(),m=p("span"),d.c(),u(l,"class","flex pr-2"),u(a,"class","flex pr-2"),u(m,"class","flex pr-2"),u(e,"class","my-1 flex")},m(O,j){P(O,e,j),o(e,l),g[n].m(l,null),o(e,s),o(e,a),R[r].m(a,null),o(e,c),o(e,m),M[_].m(m,null),h=!0},p(O,j){let Y=n;n=w(O),n===Y?g[n].p(O,j):(ht(),ie(g[Y],1,1,()=>{g[Y]=null}),vt(),i=g[n],i?i.p(O,j):(i=g[n]=b[n](O),i.c()),Z(i,1),i.m(l,null));let z=r;r=I(O),r===z?R[r].p(O,j):(ht(),ie(R[z],1,1,()=>{R[z]=null}),vt(),f=R[r],f?f.p(O,j):(f=R[r]=k[r](O),f.c()),Z(f,1),f.m(a,null));let T=_;_=A(O),_===T?M[_].p(O,j):(ht(),ie(M[T],1,1,()=>{M[T]=null}),vt(),d=M[_],d?d.p(O,j):(d=M[_]=F[_](O),d.c()),Z(d,1),d.m(m,null))},i(O){h||(Z(i),Z(f),Z(d),h=!0)},o(O){ie(i),ie(f),ie(d),h=!1},d(O){O&&N(e),g[n].d(),R[r].d(),M[_].d()}}}function _c(t){let e,l;return e=new dl({props:{to:"/mqtt-ca",$$slots:{default:[pc]},$$scope:{ctx:t}}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i[0]&4|i[4]&65536&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function mc(t){let e,l,n,i,s,a,r;return l=new dl({props:{to:"/mqtt-ca",$$slots:{default:[dc]},$$scope:{ctx:t}}}),{c(){e=p("span"),Pe(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Me(l,e,null),P(f,n,c),P(f,i,c),s=!0,a||(r=[ce(i,"click",t[17]),ce(i,"keypress",t[17])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&65536&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){s||(Z(l.$$.fragment,f),s=!0)},o(f){ie(l.$$.fragment,f),s=!1},d(f){f&&(N(e),N(n),N(i)),Ne(l),a=!1,Bt(r)}}}function pc(t){var n,i,s,a;let e,l;return e=new un({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_ca_upload)??"Upload CA",title:((a=(s=t[2].conf)==null?void 0:s.mqtt)==null?void 0:a.title_ca)??""}}),{c(){Pe(e.$$.fragment)},m(r,f){Me(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_ca_upload)??"Upload CA"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_ca)??""),e.$set(c)},i(r){l||(Z(e.$$.fragment,r),l=!0)},o(r){ie(e.$$.fragment,r),l=!1},d(r){Ne(e,r)}}}function dc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.ca_ok)??"CA OK")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.mqtt)==null?void 0:f.ca_ok)??"CA OK")+"")&&E(l,e)},d(s){s&&N(l)}}}function hc(t){let e,l;return e=new dl({props:{to:"/mqtt-cert",$$slots:{default:[bc]},$$scope:{ctx:t}}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i[0]&4|i[4]&65536&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function vc(t){let e,l,n,i,s,a,r;return l=new dl({props:{to:"/mqtt-cert",$$slots:{default:[gc]},$$scope:{ctx:t}}}),{c(){e=p("span"),Pe(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Me(l,e,null),P(f,n,c),P(f,i,c),s=!0,a||(r=[ce(i,"click",t[18]),ce(i,"keypress",t[18])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&65536&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){s||(Z(l.$$.fragment,f),s=!0)},o(f){ie(l.$$.fragment,f),s=!1},d(f){f&&(N(e),N(n),N(i)),Ne(l),a=!1,Bt(r)}}}function bc(t){var n,i,s,a;let e,l;return e=new un({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_crt_upload)??"Upload cert",title:((a=(s=t[2].conf)==null?void 0:s.mqtt)==null?void 0:a.title_crt)??""}}),{c(){Pe(e.$$.fragment)},m(r,f){Me(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_crt_upload)??"Upload cert"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_crt)??""),e.$set(c)},i(r){l||(Z(e.$$.fragment,r),l=!0)},o(r){ie(e.$$.fragment,r),l=!1},d(r){Ne(e,r)}}}function gc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.crt_ok)??"Cert OK")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.mqtt)==null?void 0:f.crt_ok)??"Cert OK")+"")&&E(l,e)},d(s){s&&N(l)}}}function kc(t){let e,l;return e=new dl({props:{to:"/mqtt-key",$$slots:{default:[Cc]},$$scope:{ctx:t}}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i[0]&4|i[4]&65536&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function wc(t){let e,l,n,i,s,a,r;return l=new dl({props:{to:"/mqtt-key",$$slots:{default:[Sc]},$$scope:{ctx:t}}}),{c(){e=p("span"),Pe(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Me(l,e,null),P(f,n,c),P(f,i,c),s=!0,a||(r=[ce(i,"click",t[19]),ce(i,"keypress",t[19])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&65536&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){s||(Z(l.$$.fragment,f),s=!0)},o(f){ie(l.$$.fragment,f),s=!1},d(f){f&&(N(e),N(n),N(i)),Ne(l),a=!1,Bt(r)}}}function Cc(t){var n,i,s,a;let e,l;return e=new un({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_key_upload)??"Upload key",title:((a=(s=t[2].conf)==null?void 0:s.mqtt)==null?void 0:a.title_key)??""}}),{c(){Pe(e.$$.fragment)},m(r,f){Me(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_key_upload)??"Upload key"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_key)??""),e.$set(c)},i(r){l||(Z(e.$$.fragment,r),l=!0)},o(r){ie(e.$$.fragment,r),l=!1},d(r){Ne(e,r)}}}function Sc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.key_ok)??"Key OK")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.mqtt)==null?void 0:f.key_ok)??"Key OK")+"")&&E(l,e)},d(s){s&&N(l)}}}function fa(t){var Q,ae,re,ue,ne,pe,oe,J,$,ke,Ce,D;let e,l,n=(((re=(ae=(Q=t[2].conf)==null?void 0:Q.mqtt)==null?void 0:ae.domoticz)==null?void 0:re.title)??"Domoticz")+"",i,s,a,r,f,c,m,_,d=(((pe=(ne=(ue=t[2].conf)==null?void 0:ue.mqtt)==null?void 0:ne.domoticz)==null?void 0:pe.eidx)??"Electricity IDX")+"",h,b,g,w,k,R,I=((($=(J=(oe=t[2].conf)==null?void 0:oe.mqtt)==null?void 0:J.domoticz)==null?void 0:$.cidx)??"Current IDX")+"",F,M,A,O,j,Y,z=(((D=(Ce=(ke=t[2].conf)==null?void 0:ke.mqtt)==null?void 0:Ce.domoticz)==null?void 0:D.vidx)??"Voltage IDX")+"",T,B,X,y,K,V,U,G,se,le;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("div"),h=C(d),b=p("br"),g=v(),w=p("input"),k=v(),R=p("div"),F=C(I),M=p("br"),A=v(),O=p("input"),j=v(),Y=p("div"),T=C(z),B=C(`: L1, L2 & L3 + `),X=p("div"),y=p("input"),K=v(),V=p("input"),U=v(),G=p("input"),u(l,"class","text-sm"),u(a,"href",_l("MQTT-configuration#domoticz")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","o"),f.value="true",u(w,"name","oe"),u(w,"type","text"),u(w,"class","in-f tr w-full"),u(w,"pattern",In),u(_,"class","w-1/2"),u(O,"name","oc"),u(O,"type","text"),u(O,"class","in-l tr w-full"),u(O,"pattern",In),u(R,"class","w-1/2"),u(m,"class","my-1 flex"),u(y,"name","ou1"),u(y,"type","text"),u(y,"class","in-f tr w-1/3"),u(y,"pattern",In),u(V,"name","ou2"),u(V,"type","text"),u(V,"class","in-m tr w-1/3"),u(V,"pattern",In),u(G,"name","ou3"),u(G,"type","text"),u(G,"class","in-l tr w-1/3"),u(G,"pattern",In),u(X,"class","flex"),u(Y,"class","my-1"),u(e,"class","cnt")},m(S,L){P(S,e,L),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,h),o(_,b),o(_,g),o(_,w),H(w,t[6].o.e),o(m,k),o(m,R),o(R,F),o(R,M),o(R,A),o(R,O),H(O,t[6].o.c),o(e,j),o(e,Y),o(Y,T),o(Y,B),o(Y,X),o(X,y),H(y,t[6].o.u1),o(X,K),o(X,V),H(V,t[6].o.u2),o(X,U),o(X,G),H(G,t[6].o.u3),se||(le=[ce(w,"input",t[83]),ce(O,"input",t[84]),ce(y,"input",t[85]),ce(V,"input",t[86]),ce(G,"input",t[87])],se=!0)},p(S,L){var q,W,te,fe,_e,de,x,he,be,Ae,Te,Oe;L[0]&4&&n!==(n=(((te=(W=(q=S[2].conf)==null?void 0:q.mqtt)==null?void 0:W.domoticz)==null?void 0:te.title)??"Domoticz")+"")&&E(i,n),L[0]&4&&d!==(d=(((de=(_e=(fe=S[2].conf)==null?void 0:fe.mqtt)==null?void 0:_e.domoticz)==null?void 0:de.eidx)??"Electricity IDX")+"")&&E(h,d),L[0]&64&&w.value!==S[6].o.e&&H(w,S[6].o.e),L[0]&4&&I!==(I=(((be=(he=(x=S[2].conf)==null?void 0:x.mqtt)==null?void 0:he.domoticz)==null?void 0:be.cidx)??"Current IDX")+"")&&E(F,I),L[0]&64&&O.value!==S[6].o.c&&H(O,S[6].o.c),L[0]&4&&z!==(z=(((Oe=(Te=(Ae=S[2].conf)==null?void 0:Ae.mqtt)==null?void 0:Te.domoticz)==null?void 0:Oe.vidx)??"Voltage IDX")+"")&&E(T,z),L[0]&64&&y.value!==S[6].o.u1&&H(y,S[6].o.u1),L[0]&64&&V.value!==S[6].o.u2&&H(V,S[6].o.u2),L[0]&64&&G.value!==S[6].o.u3&&H(G,S[6].o.u3)},d(S){S&&N(e),se=!1,Bt(le)}}}function ua(t){var U,G,se,le,Q,ae,re,ue,ne,pe,oe,J;let e,l,n=(((se=(G=(U=t[2].conf)==null?void 0:U.mqtt)==null?void 0:G.ha)==null?void 0:se.title)??"Home-Assistant")+"",i,s,a,r,f,c,m,_=(((ae=(Q=(le=t[2].conf)==null?void 0:le.mqtt)==null?void 0:Q.ha)==null?void 0:ae.discovery)??"Discovery topic prefix")+"",d,h,b,g,w,k,R=(((ne=(ue=(re=t[2].conf)==null?void 0:re.mqtt)==null?void 0:ue.ha)==null?void 0:ne.hostname)??"Hostname for URL")+"",I,F,M,A,O,j,Y,z=(((J=(oe=(pe=t[2].conf)==null?void 0:pe.mqtt)==null?void 0:oe.ha)==null?void 0:J.tag)??"Name tag")+"",T,B,X,y,K,V;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),d=C(_),h=p("br"),b=v(),g=p("input"),w=v(),k=p("div"),I=C(R),F=p("br"),M=v(),A=p("input"),j=v(),Y=p("div"),T=C(z),B=p("br"),X=v(),y=p("input"),u(l,"class","text-sm"),u(a,"href",_l("MQTT-configuration#home-assistant")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","h"),f.value="true",u(g,"name","ht"),u(g,"type","text"),u(g,"class","in-s"),u(g,"placeholder","homeassistant"),u(g,"pattern",Ll),u(m,"class","my-1"),u(A,"name","hh"),u(A,"type","text"),u(A,"class","in-s"),u(A,"placeholder",O=t[6].g.h+".local"),u(A,"pattern",Ll),u(k,"class","my-1"),u(y,"name","hn"),u(y,"type","text"),u(y,"class","in-s"),u(y,"pattern",Ll),u(Y,"class","my-1"),u(e,"class","cnt")},m($,ke){P($,e,ke),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,d),o(m,h),o(m,b),o(m,g),H(g,t[6].h.t),o(e,w),o(e,k),o(k,I),o(k,F),o(k,M),o(k,A),H(A,t[6].h.h),o(e,j),o(e,Y),o(Y,T),o(Y,B),o(Y,X),o(Y,y),H(y,t[6].h.n),K||(V=[ce(g,"input",t[88]),ce(A,"input",t[89]),ce(y,"input",t[90])],K=!0)},p($,ke){var Ce,D,S,L,q,W,te,fe,_e,de,x,he;ke[0]&4&&n!==(n=(((S=(D=(Ce=$[2].conf)==null?void 0:Ce.mqtt)==null?void 0:D.ha)==null?void 0:S.title)??"Home-Assistant")+"")&&E(i,n),ke[0]&4&&_!==(_=(((W=(q=(L=$[2].conf)==null?void 0:L.mqtt)==null?void 0:q.ha)==null?void 0:W.discovery)??"Discovery topic prefix")+"")&&E(d,_),ke[0]&64&&g.value!==$[6].h.t&&H(g,$[6].h.t),ke[0]&4&&R!==(R=(((_e=(fe=(te=$[2].conf)==null?void 0:te.mqtt)==null?void 0:fe.ha)==null?void 0:_e.hostname)??"Hostname for URL")+"")&&E(I,R),ke[0]&64&&O!==(O=$[6].g.h+".local")&&u(A,"placeholder",O),ke[0]&64&&A.value!==$[6].h.h&&H(A,$[6].h.h),ke[0]&4&&z!==(z=(((he=(x=(de=$[2].conf)==null?void 0:de.mqtt)==null?void 0:x.ha)==null?void 0:he.tag)??"Name tag")+"")&&E(T,z),ke[0]&64&&y.value!==$[6].h.n&&H(y,$[6].h.n)},d($){$&&N(e),K=!1,Bt(V)}}}function ra(t){var j,Y,z,T,B,X,y,K;let e,l,n=(((Y=(j=t[2].conf)==null?void 0:j.cloud)==null?void 0:Y.title)??"Cloud connections")+"",i,s,a,r,f,c,m=(T=(z=t[0])==null?void 0:z.features)==null?void 0:T.includes("cloud"),_,d,h,b,g,w=(((X=(B=t[2].conf)==null?void 0:B.cloud)==null?void 0:X.es)??"Energy Speedometer")+"",k,R,I,F,M,A=m&&ca(t),O=((K=(y=t[6])==null?void 0:y.c)==null?void 0:K.es)&&da(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),A&&A.c(),_=v(),d=p("div"),h=p("label"),b=p("input"),g=v(),k=C(w),R=v(),O&&O.c(),u(l,"class","text-sm"),u(a,"href",_l("Cloud")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","c"),f.value="true",u(b,"type","checkbox"),u(b,"class","rounded mb-1"),u(b,"name","ces"),b.__value="true",H(b,b.__value),u(d,"class","my-1"),u(e,"class","cnt")},m(V,U){P(V,e,U),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),A&&A.m(e,null),o(e,_),o(e,d),o(d,h),o(h,b),b.checked=t[6].c.es,o(h,g),o(h,k),o(d,R),O&&O.m(d,null),I=!0,F||(M=ce(b,"change",t[93]),F=!0)},p(V,U){var G,se,le,Q,ae,re,ue,ne;(!I||U[0]&4)&&n!==(n=(((se=(G=V[2].conf)==null?void 0:G.cloud)==null?void 0:se.title)??"Cloud connections")+"")&&E(i,n),U[0]&1&&(m=(Q=(le=V[0])==null?void 0:le.features)==null?void 0:Q.includes("cloud")),m?A?A.p(V,U):(A=ca(V),A.c(),A.m(e,_)):A&&(A.d(1),A=null),U[0]&64&&(b.checked=V[6].c.es),(!I||U[0]&4)&&w!==(w=(((re=(ae=V[2].conf)==null?void 0:ae.cloud)==null?void 0:re.es)??"Energy Speedometer")+"")&&E(k,w),(ne=(ue=V[6])==null?void 0:ue.c)!=null&&ne.es?O?(O.p(V,U),U[0]&64&&Z(O,1)):(O=da(V),O.c(),Z(O,1),O.m(d,null)):O&&(ht(),ie(O,1,1,()=>{O=null}),vt())},i(V){I||(Z(O),I=!0)},o(V){ie(O),I=!1},d(V){V&&N(e),A&&A.d(),O&&O.d(),F=!1,M()}}}function ca(t){var _,d;let e,l,n,i,s=(((d=(_=t[2].conf)==null?void 0:_.cloud)==null?void 0:d.ams)??"AMS reader cloud")+"",a,r,f,c,m=t[6].c.e&&_a(t);return{c(){e=p("div"),l=p("label"),n=p("input"),i=v(),a=C(s),r=v(),m&&m.c(),u(n,"type","checkbox"),u(n,"name","ce"),n.__value="true",H(n,n.__value),u(n,"class","rounded mb-1"),u(e,"class","my-1")},m(h,b){P(h,e,b),o(e,l),o(l,n),n.checked=t[6].c.e,o(l,i),o(l,a),o(e,r),m&&m.m(e,null),f||(c=ce(n,"change",t[91]),f=!0)},p(h,b){var g,w;b[0]&64&&(n.checked=h[6].c.e),b[0]&4&&s!==(s=(((w=(g=h[2].conf)==null?void 0:g.cloud)==null?void 0:w.ams)??"AMS reader cloud")+"")&&E(a,s),h[6].c.e?m?m.p(h,b):(m=_a(h),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},d(h){h&&N(e),m&&m.d(),f=!1,c()}}}function _a(t){let e,l,n,i,s,a,r,f,c,m,_=t[6].c.p==0&&ma(),d=t[5]&&pa(t);return{c(){e=p("div"),l=p("label"),l.textContent="Protocol",n=v(),i=p("select"),_&&_.c(),s=p("option"),s.textContent="TCP",a=p("option"),a.textContent="HTTP",r=v(),d&&d.c(),f=Ht(),u(l,"for","cp"),s.__value=1,H(s,s.__value),a.__value=2,H(a,a.__value),u(i,"name","cp"),u(i,"class","in-s"),t[6].c.p===void 0&&Dt(()=>t[92].call(i)),u(e,"class","ml-6")},m(h,b){P(h,e,b),o(e,l),o(e,n),o(e,i),_&&_.m(i,null),o(i,s),o(i,a),Ke(i,t[6].c.p,!0),P(h,r,b),d&&d.m(h,b),P(h,f,b),c||(m=ce(i,"change",t[92]),c=!0)},p(h,b){h[6].c.p==0?_||(_=ma(),_.c(),_.m(i,s)):_&&(_.d(1),_=null),b[0]&64&&Ke(i,h[6].c.p),h[5]?d?d.p(h,b):(d=pa(h),d.c(),d.m(f.parentNode,f)):d&&(d.d(1),d=null)},d(h){h&&(N(e),N(r),N(f)),_&&_.d(),d&&d.d(h),c=!1,m()}}}function ma(t){let e;return{c(){e=p("option"),e.textContent="UDP",e.__value=0,H(e,e.__value),u(e,"title","No longer recommended")},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function pa(t){let e,l,n;return{c(){e=p("button"),e.textContent="Connect device to my cloud account",u(e,"type","button"),u(e,"class","text-blue-500 ml-6")},m(i,s){P(i,e,s),l||(n=ce(e,"click",t[23]),l=!0)},p:Ye,d(i){i&&N(e),l=!1,n()}}}function da(t){let e,l,n=t[0].mac+"",i,s,a,r,f=(t[0].meter.id?t[0].meter.id:"missing, required")+"",c,m,_,d,h=t[0].mac&&t[0].meter.id&&ha(t);return{c(){e=p("div"),l=C("MAC: "),i=C(n),s=v(),a=p("div"),r=C("Meter ID: "),c=C(f),m=v(),h&&h.c(),_=Ht(),u(e,"class","pl-5"),u(a,"class","pl-5")},m(b,g){P(b,e,g),o(e,l),o(e,i),P(b,s,g),P(b,a,g),o(a,r),o(a,c),P(b,m,g),h&&h.m(b,g),P(b,_,g),d=!0},p(b,g){(!d||g[0]&1)&&n!==(n=b[0].mac+"")&&E(i,n),(!d||g[0]&1)&&f!==(f=(b[0].meter.id?b[0].meter.id:"missing, required")+"")&&E(c,f),b[0].mac&&b[0].meter.id?h?(h.p(b,g),g[0]&1&&Z(h,1)):(h=ha(b),h.c(),Z(h,1),h.m(_.parentNode,_)):h&&(ht(),ie(h,1,1,()=>{h=null}),vt())},i(b){d||(Z(h),d=!0)},o(b){ie(h),d=!1},d(b){b&&(N(e),N(s),N(a),N(m),N(_)),h&&h.d(b)}}}function ha(t){let e,l,n;return l=new lc({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=p("div"),Pe(l.$$.fragment),u(e,"class","pl-2")},m(i,s){P(i,e,s),Me(l,e,null),n=!0},p(i,s){const a={};s[0]&1&&(a.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(a)},i(i){n||(Z(l.$$.fragment,i),n=!0)},o(i){ie(l.$$.fragment,i),n=!1},d(i){i&&N(e),Ne(l)}}}function va(t){var z,T,B,X,y;let e,l,n=(((T=(z=t[2].conf)==null?void 0:z.thresholds)==null?void 0:T.title)??"Thresholds")+"",i,s,a,r,f,c,m,_,d,h,b=(((X=(B=t[2].conf)==null?void 0:B.thresholds)==null?void 0:X.avg)??"Average of")+"",g,w,k,R,I,F=(((y=t[2].common)==null?void 0:y.hours)??"hours")+"",M,A,O,j=rt({length:9}),Y=[];for(let K=0;Kt[97].call(w)),u(d,"class","w-1/2"),u(m,"class","flex flex-wrap"),u(e,"class","cnt")},m(T,B){P(T,e,B),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m);for(let X=0;X20&&Sa(t),d=((R=(k=(w=t[6])==null?void 0:w.i)==null?void 0:k.d)==null?void 0:R.d)>0&&Pa(t),h=t[0].chip=="esp8266"&&Ta(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),_&&_.c(),f=v(),d&&d.c(),c=v(),h&&h.c(),u(l,"class","text-sm"),u(a,"href",_l("GPIO-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(e,"class","cnt")},m(I,F){P(I,e,F),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),_&&_.m(e,null),o(e,f),d&&d.m(e,null),o(e,c),h&&h.m(e,null),m=!0},p(I,F){var M,A,O,j,Y;(!m||F[0]&4)&&n!==(n=(((A=(M=I[2].conf)==null?void 0:M.hw)==null?void 0:A.title)??"Hardware")+"")&&E(i,n),I[0].board>20?_?(_.p(I,F),F[0]&1&&Z(_,1)):(_=Sa(I),_.c(),Z(_,1),_.m(e,f)):_&&(ht(),ie(_,1,1,()=>{_=null}),vt()),((Y=(j=(O=I[6])==null?void 0:O.i)==null?void 0:j.d)==null?void 0:Y.d)>0?d?d.p(I,F):(d=Pa(I),d.c(),d.m(e,c)):d&&(d.d(1),d=null),I[0].chip=="esp8266"?h?h.p(I,F):(h=Ta(I),h.c(),h.m(e,null)):h&&(h.d(1),h=null)},i(I){m||(Z(_),m=!0)},o(I){ie(_),m=!1},d(I){I&&N(e),_&&_.d(),d&&d.d(),h&&h.d()}}}function Sa(t){var Tt,zt,kt,_t,yt,Qt,Ft,jt,Kt,Jt,Wt,Lt,Fe,Xe,je,Et,Ut,$e,st,qt,pt,ge,nt,ze,xt,el,tl,ll,nl,il,sl,Ze,Se;let e,l,n,i,s=(((kt=(zt=(Tt=t[2].conf)==null?void 0:Tt.hw)==null?void 0:zt.han)==null?void 0:kt.rx)??"HAN RX")+"",a,r,f,c,m,_,d,h=(((Qt=(yt=(_t=t[2].conf)==null?void 0:_t.hw)==null?void 0:yt.han)==null?void 0:Qt.tx)??"HAN TX")+"",b,g,w,k,R,I,F,M,A,O,j=(((Kt=(jt=(Ft=t[2].conf)==null?void 0:Ft.hw)==null?void 0:jt.han)==null?void 0:Kt.pullup)??"pullup")+"",Y,z,T,B,X=(((Wt=(Jt=t[2].conf)==null?void 0:Jt.hw)==null?void 0:Wt.ap_btn)??"AP button")+"",y,K,V,U,G,se,le=(((Xe=(Fe=(Lt=t[2].conf)==null?void 0:Lt.hw)==null?void 0:Fe.led)==null?void 0:Xe.title)??"LED")+"",Q,ae,re,ue,ne,pe,oe,J,$,ke,Ce=(((Ut=(Et=(je=t[2].conf)==null?void 0:je.hw)==null?void 0:Et.led)==null?void 0:Ut.inverted)??"inverted")+"",D,S,L,q=(((qt=(st=($e=t[2].conf)==null?void 0:$e.hw)==null?void 0:st.led)==null?void 0:qt.rgb)??"RGB")+"",W,te,fe,_e,de=(((nt=(ge=(pt=t[2].conf)==null?void 0:pt.hw)==null?void 0:ge.led)==null?void 0:nt.inverted)??"inverted")+"",x,he,be,Ae,Te,Oe,Ie,De,Ue,xe,wt,tt,ot=(((el=(xt=(ze=t[2].conf)==null?void 0:ze.hw)==null?void 0:xt.led)==null?void 0:el.disable)??"LED dis. GPIO")+"",St,dt,at,it,ft,Ot=(((ll=(tl=t[2].conf)==null?void 0:tl.hw)==null?void 0:ll.temp)??"Temperature")+"",We,Re,He,lt,ve,Ee,Qe=(((il=(nl=t[2].conf)==null?void 0:nl.hw)==null?void 0:il.temp_analog)??"Analog temp")+"",me,we,ut,Ge,Rt,bt,Be,gt,ct;m=new Bi({props:{chip:t[0].chip}}),R=new Bi({props:{chip:t[0].chip}});let mt=t[0].chip!="esp8266"&&Ma(t),et=((Se=(Ze=(sl=t[6])==null?void 0:sl.i)==null?void 0:Ze.v)==null?void 0:Se.p)>0&&Na(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=C(s),r=p("br"),f=v(),c=p("select"),Pe(m.$$.fragment),_=v(),d=p("div"),b=C(h),g=p("br"),w=v(),k=p("select"),Pe(R.$$.fragment),I=v(),F=p("div"),M=p("label"),A=p("input"),O=v(),Y=C(j),z=v(),T=p("div"),B=p("div"),y=C(X),K=p("br"),V=v(),U=p("input"),G=v(),se=p("div"),Q=C(le),ae=p("br"),re=v(),ue=p("div"),ne=p("input"),pe=v(),oe=p("div"),J=p("label"),$=p("input"),ke=v(),D=C(Ce),S=v(),L=p("div"),W=C(q),te=p("label"),fe=p("input"),_e=v(),x=C(de),he=p("br"),be=v(),Ae=p("div"),Te=p("input"),Oe=v(),Ie=p("input"),De=v(),Ue=p("input"),xe=v(),wt=p("div"),tt=p("div"),St=C(ot),dt=v(),at=p("input"),it=v(),ft=p("div"),We=C(Ot),Re=p("br"),He=v(),lt=p("input"),ve=v(),Ee=p("div"),me=C(Qe),we=p("br"),ut=v(),Ge=p("input"),Rt=v(),mt&&mt.c(),bt=v(),et&&et.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(c,"name","ihp"),u(c,"class","in-f w-full"),t[6].i.h.p===void 0&&Dt(()=>t[98].call(c)),u(i,"class","w-1/3"),u(k,"name","iht"),u(k,"class","in-l w-full"),t[6].i.h.t===void 0&&Dt(()=>t[99].call(k)),u(d,"class","w-1/3"),u(A,"name","ihu"),A.__value="true",H(A,A.__value),u(A,"type","checkbox"),u(A,"class","rounded mb-1"),u(M,"class","ml-2"),u(F,"class","w-1/3"),u(n,"class","flex flex-wrap"),u(U,"name","ia"),u(U,"type","number"),u(U,"min","0"),u(U,"max",t[12]),u(U,"class","in-f tr w-full"),u(B,"class","w-1/3"),u(ne,"name","ilp"),u(ne,"type","number"),u(ne,"min","0"),u(ne,"max",t[12]),u(ne,"class","in-l tr w-full"),u(ue,"class","flex"),u(se,"class","w-1/3"),u($,"name","ili"),$.__value="true",H($,$.__value),u($,"type","checkbox"),u($,"class","rounded mb-1"),u(J,"class","ml-4"),u(oe,"class","w-1/3"),u(fe,"name","iri"),fe.__value="true",H(fe,fe.__value),u(fe,"type","checkbox"),u(fe,"class","rounded mb-1"),u(te,"class","ml-4"),u(Te,"name","irr"),u(Te,"type","number"),u(Te,"min","0"),u(Te,"max",t[12]),u(Te,"class","in-f tr w-1/3"),u(Ie,"name","irg"),u(Ie,"type","number"),u(Ie,"min","0"),u(Ie,"max",t[12]),u(Ie,"class","in-m tr w-1/3"),u(Ue,"name","irb"),u(Ue,"type","number"),u(Ue,"min","0"),u(Ue,"max",t[12]),u(Ue,"class","in-l tr w-1/3"),u(Ae,"class","flex"),u(L,"class","w-full"),u(at,"name","idd"),u(at,"type","number"),u(at,"min","0"),u(at,"max",t[12]),u(at,"class","in-s tr"),u(tt,"class","my-1 pr-1 w-1/3"),u(wt,"class","w-full"),u(lt,"name","itd"),u(lt,"type","number"),u(lt,"min","0"),u(lt,"max",t[12]),u(lt,"class","in-f tr w-full"),u(ft,"class","my-1 w-1/3"),u(Ge,"name","ita"),u(Ge,"type","number"),u(Ge,"min","0"),u(Ge,"max",t[12]),u(Ge,"class","in-l tr w-full"),u(Ee,"class","my-1 pr-1 w-1/3"),u(T,"class","flex flex-wrap")},m(ee,Le){P(ee,e,Le),P(ee,l,Le),P(ee,n,Le),o(n,i),o(i,a),o(i,r),o(i,f),o(i,c),Me(m,c,null),Ke(c,t[6].i.h.p,!0),o(n,_),o(n,d),o(d,b),o(d,g),o(d,w),o(d,k),Me(R,k,null),Ke(k,t[6].i.h.t,!0),o(n,I),o(n,F),o(F,M),o(M,A),A.checked=t[6].i.h.u,o(M,O),o(M,Y),P(ee,z,Le),P(ee,T,Le),o(T,B),o(B,y),o(B,K),o(B,V),o(B,U),H(U,t[6].i.a),o(T,G),o(T,se),o(se,Q),o(se,ae),o(se,re),o(se,ue),o(ue,ne),H(ne,t[6].i.l.p),o(T,pe),o(T,oe),o(oe,J),o(J,$),$.checked=t[6].i.l.i,o(J,ke),o(J,D),o(T,S),o(T,L),o(L,W),o(L,te),o(te,fe),fe.checked=t[6].i.r.i,o(te,_e),o(te,x),o(L,he),o(L,be),o(L,Ae),o(Ae,Te),H(Te,t[6].i.r.r),o(Ae,Oe),o(Ae,Ie),H(Ie,t[6].i.r.g),o(Ae,De),o(Ae,Ue),H(Ue,t[6].i.r.b),o(T,xe),o(T,wt),o(wt,tt),o(tt,St),o(tt,dt),o(tt,at),H(at,t[6].i.d.d),o(T,it),o(T,ft),o(ft,We),o(ft,Re),o(ft,He),o(ft,lt),H(lt,t[6].i.t.d),o(T,ve),o(T,Ee),o(Ee,me),o(Ee,we),o(Ee,ut),o(Ee,Ge),H(Ge,t[6].i.t.a),o(T,Rt),mt&&mt.m(T,null),o(T,bt),et&&et.m(T,null),Be=!0,gt||(ct=[ce(c,"change",t[98]),ce(k,"change",t[99]),ce(A,"change",t[100]),ce(U,"input",t[101]),ce(ne,"input",t[102]),ce($,"change",t[103]),ce(fe,"change",t[104]),ce(Te,"input",t[105]),ce(Ie,"input",t[106]),ce(Ue,"input",t[107]),ce(at,"input",t[108]),ce(lt,"input",t[109]),ce(Ge,"input",t[110])],gt=!0)},p(ee,Le){var ml,pl,kl,wl,Cl,Sl,Ml,Il,Rl,Fl,Ve,qe,It,fl,Ul,Bl,jl,Hl,yl,zl,Wl,Gl,Vl,Kl,Yl,Ql,Xl,Zl,Jl,$l,xl,en,tn;(!Be||Le[0]&4)&&s!==(s=(((kl=(pl=(ml=ee[2].conf)==null?void 0:ml.hw)==null?void 0:pl.han)==null?void 0:kl.rx)??"HAN RX")+"")&&E(a,s);const al={};Le[0]&1&&(al.chip=ee[0].chip),m.$set(al),Le[0]&64&&Ke(c,ee[6].i.h.p),(!Be||Le[0]&4)&&h!==(h=(((Sl=(Cl=(wl=ee[2].conf)==null?void 0:wl.hw)==null?void 0:Cl.han)==null?void 0:Sl.tx)??"HAN TX")+"")&&E(b,h);const Xt={};Le[0]&1&&(Xt.chip=ee[0].chip),R.$set(Xt),Le[0]&64&&Ke(k,ee[6].i.h.t),Le[0]&64&&(A.checked=ee[6].i.h.u),(!Be||Le[0]&4)&&j!==(j=(((Rl=(Il=(Ml=ee[2].conf)==null?void 0:Ml.hw)==null?void 0:Il.han)==null?void 0:Rl.pullup)??"pullup")+"")&&E(Y,j),(!Be||Le[0]&4)&&X!==(X=(((Ve=(Fl=ee[2].conf)==null?void 0:Fl.hw)==null?void 0:Ve.ap_btn)??"AP button")+"")&&E(y,X),(!Be||Le[0]&4096)&&u(U,"max",ee[12]),Le[0]&64&&ye(U.value)!==ee[6].i.a&&H(U,ee[6].i.a),(!Be||Le[0]&4)&&le!==(le=(((fl=(It=(qe=ee[2].conf)==null?void 0:qe.hw)==null?void 0:It.led)==null?void 0:fl.title)??"LED")+"")&&E(Q,le),(!Be||Le[0]&4096)&&u(ne,"max",ee[12]),Le[0]&64&&ye(ne.value)!==ee[6].i.l.p&&H(ne,ee[6].i.l.p),Le[0]&64&&($.checked=ee[6].i.l.i),(!Be||Le[0]&4)&&Ce!==(Ce=(((jl=(Bl=(Ul=ee[2].conf)==null?void 0:Ul.hw)==null?void 0:Bl.led)==null?void 0:jl.inverted)??"inverted")+"")&&E(D,Ce),(!Be||Le[0]&4)&&q!==(q=(((zl=(yl=(Hl=ee[2].conf)==null?void 0:Hl.hw)==null?void 0:yl.led)==null?void 0:zl.rgb)??"RGB")+"")&&E(W,q),Le[0]&64&&(fe.checked=ee[6].i.r.i),(!Be||Le[0]&4)&&de!==(de=(((Vl=(Gl=(Wl=ee[2].conf)==null?void 0:Wl.hw)==null?void 0:Gl.led)==null?void 0:Vl.inverted)??"inverted")+"")&&E(x,de),(!Be||Le[0]&4096)&&u(Te,"max",ee[12]),Le[0]&64&&ye(Te.value)!==ee[6].i.r.r&&H(Te,ee[6].i.r.r),(!Be||Le[0]&4096)&&u(Ie,"max",ee[12]),Le[0]&64&&ye(Ie.value)!==ee[6].i.r.g&&H(Ie,ee[6].i.r.g),(!Be||Le[0]&4096)&&u(Ue,"max",ee[12]),Le[0]&64&&ye(Ue.value)!==ee[6].i.r.b&&H(Ue,ee[6].i.r.b),(!Be||Le[0]&4)&&ot!==(ot=(((Ql=(Yl=(Kl=ee[2].conf)==null?void 0:Kl.hw)==null?void 0:Yl.led)==null?void 0:Ql.disable)??"LED dis. GPIO")+"")&&E(St,ot),(!Be||Le[0]&4096)&&u(at,"max",ee[12]),Le[0]&64&&ye(at.value)!==ee[6].i.d.d&&H(at,ee[6].i.d.d),(!Be||Le[0]&4)&&Ot!==(Ot=(((Zl=(Xl=ee[2].conf)==null?void 0:Xl.hw)==null?void 0:Zl.temp)??"Temperature")+"")&&E(We,Ot),(!Be||Le[0]&4096)&&u(lt,"max",ee[12]),Le[0]&64&&ye(lt.value)!==ee[6].i.t.d&&H(lt,ee[6].i.t.d),(!Be||Le[0]&4)&&Qe!==(Qe=((($l=(Jl=ee[2].conf)==null?void 0:Jl.hw)==null?void 0:$l.temp_analog)??"Analog temp")+"")&&E(me,Qe),(!Be||Le[0]&4096)&&u(Ge,"max",ee[12]),Le[0]&64&&ye(Ge.value)!==ee[6].i.t.a&&H(Ge,ee[6].i.t.a),ee[0].chip!="esp8266"?mt?mt.p(ee,Le):(mt=Ma(ee),mt.c(),mt.m(T,bt)):mt&&(mt.d(1),mt=null),((tn=(en=(xl=ee[6])==null?void 0:xl.i)==null?void 0:en.v)==null?void 0:tn.p)>0?et?et.p(ee,Le):(et=Na(ee),et.c(),et.m(T,null)):et&&(et.d(1),et=null)},i(ee){Be||(Z(m.$$.fragment,ee),Z(R.$$.fragment,ee),Be=!0)},o(ee){ie(m.$$.fragment,ee),ie(R.$$.fragment,ee),Be=!1},d(ee){ee&&(N(e),N(l),N(n),N(z),N(T)),Ne(m),Ne(R),mt&&mt.d(),et&&et.d(),gt=!1,Bt(ct)}}}function Ma(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.title)??"Vcc")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","ivp"),u(a,"type","number"),u(a,"min","0"),u(a,"max",t[12]),u(a,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(d,h){P(d,e,h),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].i.v.p),r||(f=ce(a,"input",t[111]),r=!0)},p(d,h){var b,g,w;h[0]&4&&l!==(l=(((w=(g=(b=d[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:w.title)??"Vcc")+"")&&E(n,l),h[0]&4096&&u(a,"max",d[12]),h[0]&64&&ye(a.value)!==d[6].i.v.p&&H(a,d[6].i.v.p)},d(d){d&&N(e),r=!1,f()}}}function Na(t){var b,g,w;let e,l=(((w=(g=(b=t[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:w.divider)??"Voltage divider")+"",n,i,s,a,r,f,c,m,_,d,h;return{c(){var k,R,I,F,M,A;e=p("div"),n=C(l),i=p("br"),s=v(),a=p("div"),r=p("input"),c=v(),m=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",f=((I=(R=(k=t[2].conf)==null?void 0:k.hw)==null?void 0:R.vcc)==null?void 0:I.div_vcc)??"VCC"),u(m,"name","ivdg"),u(m,"type","number"),u(m,"min","0"),u(m,"max","65535"),u(m,"class","in-l tr w-full"),u(m,"placeholder",_=((A=(M=(F=t[2].conf)==null?void 0:F.hw)==null?void 0:M.vcc)==null?void 0:A.div_gnd)??"GND"),u(a,"class","flex"),u(e,"class","my-1")},m(k,R){P(k,e,R),o(e,n),o(e,i),o(e,s),o(e,a),o(a,r),H(r,t[6].i.v.d.v),o(a,c),o(a,m),H(m,t[6].i.v.d.g),d||(h=[ce(r,"input",t[112]),ce(m,"input",t[113])],d=!0)},p(k,R){var I,F,M,A,O,j,Y,z,T;R[0]&4&&l!==(l=(((M=(F=(I=k[2].conf)==null?void 0:I.hw)==null?void 0:F.vcc)==null?void 0:M.divider)??"Voltage divider")+"")&&E(n,l),R[0]&4&&f!==(f=((j=(O=(A=k[2].conf)==null?void 0:A.hw)==null?void 0:O.vcc)==null?void 0:j.div_vcc)??"VCC")&&u(r,"placeholder",f),R[0]&64&&ye(r.value)!==k[6].i.v.d.v&&H(r,k[6].i.v.d.v),R[0]&4&&_!==(_=((T=(z=(Y=k[2].conf)==null?void 0:Y.hw)==null?void 0:z.vcc)==null?void 0:T.div_gnd)??"GND")&&u(m,"placeholder",_),R[0]&64&&ye(m.value)!==k[6].i.v.d.g&&H(m,k[6].i.v.d.g)},d(k){k&&N(e),d=!1,Bt(h)}}}function Pa(t){var b,g,w,k,R,I,F,M,A,O,j,Y;let e,l=(((k=(w=(g=(b=t[2].conf)==null?void 0:b.hw)==null?void 0:g.led)==null?void 0:w.behaviour)==null?void 0:k.title)??"LED behaviour")+"",n,i,s,a,r=(((M=(F=(I=(R=t[2].conf)==null?void 0:R.hw)==null?void 0:I.led)==null?void 0:F.behaviour)==null?void 0:M.enabled)??"Enabled")+"",f,c,m=(((Y=(j=(O=(A=t[2].conf)==null?void 0:A.hw)==null?void 0:O.led)==null?void 0:j.behaviour)==null?void 0:Y.disabled)??"Disabled")+"",_,d,h;return{c(){e=p("div"),n=C(l),i=v(),s=p("select"),a=p("option"),f=C(r),c=p("option"),_=C(m),a.__value=0,H(a,a.__value),c.__value=1,H(c,c.__value),u(s,"name","idb"),u(s,"class","in-s"),t[6].i.d.b===void 0&&Dt(()=>t[114].call(s)),u(e,"class","my-1 w-full")},m(z,T){P(z,e,T),o(e,n),o(e,i),o(e,s),o(s,a),o(a,f),o(s,c),o(c,_),Ke(s,t[6].i.d.b,!0),d||(h=ce(s,"change",t[114]),d=!0)},p(z,T){var B,X,y,K,V,U,G,se,le,Q,ae,re;T[0]&4&&l!==(l=(((K=(y=(X=(B=z[2].conf)==null?void 0:B.hw)==null?void 0:X.led)==null?void 0:y.behaviour)==null?void 0:K.title)??"LED behaviour")+"")&&E(n,l),T[0]&4&&r!==(r=(((se=(G=(U=(V=z[2].conf)==null?void 0:V.hw)==null?void 0:U.led)==null?void 0:G.behaviour)==null?void 0:se.enabled)??"Enabled")+"")&&E(f,r),T[0]&4&&m!==(m=(((re=(ae=(Q=(le=z[2].conf)==null?void 0:le.hw)==null?void 0:Q.led)==null?void 0:ae.behaviour)==null?void 0:re.disabled)??"Disabled")+"")&&E(_,m),T[0]&64&&Ke(s,z[6].i.d.b)},d(z){z&&N(e),d=!1,h()}}}function Ta(t){var M,A,O,j,Y,z;let e,l,n,i,s=(((O=(A=(M=t[2].conf)==null?void 0:M.hw)==null?void 0:A.vcc)==null?void 0:O.offset)??"Vcc offset")+"",a,r,f,c,m,_,d=(((z=(Y=(j=t[2].conf)==null?void 0:j.hw)==null?void 0:Y.vcc)==null?void 0:z.multiplier)??"Multiplier")+"",h,b,g,w,k,R,I,F=(t[0].board==2||t[0].board==100)&&qa(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=C(s),r=p("br"),f=v(),c=p("input"),m=v(),_=p("div"),h=C(d),b=p("br"),g=v(),w=p("input"),k=v(),F&&F.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(w,"name","ivm"),u(w,"type","number"),u(w,"min","0.1"),u(w,"max","10"),u(w,"step","0.01"),u(w,"class","in-l tr w-full"),u(_,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(T,B){P(T,e,B),P(T,l,B),P(T,n,B),o(n,i),o(i,a),o(i,r),o(i,f),o(i,c),H(c,t[6].i.v.o),o(n,m),o(n,_),o(_,h),o(_,b),o(_,g),o(_,w),H(w,t[6].i.v.m),o(n,k),F&&F.m(n,null),R||(I=[ce(c,"input",t[115]),ce(w,"input",t[116])],R=!0)},p(T,B){var X,y,K,V,U,G;B[0]&4&&s!==(s=(((K=(y=(X=T[2].conf)==null?void 0:X.hw)==null?void 0:y.vcc)==null?void 0:K.offset)??"Vcc offset")+"")&&E(a,s),B[0]&64&&ye(c.value)!==T[6].i.v.o&&H(c,T[6].i.v.o),B[0]&4&&d!==(d=(((G=(U=(V=T[2].conf)==null?void 0:V.hw)==null?void 0:U.vcc)==null?void 0:G.multiplier)??"Multiplier")+"")&&E(h,d),B[0]&64&&ye(w.value)!==T[6].i.v.m&&H(w,T[6].i.v.m),T[0].board==2||T[0].board==100?F?F.p(T,B):(F=qa(T),F.c(),F.m(n,null)):F&&(F.d(1),F=null)},d(T){T&&(N(e),N(l),N(n)),F&&F.d(),R=!1,Bt(I)}}}function qa(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.boot)??"Boot limit")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","ivb"),u(a,"type","number"),u(a,"min","2.5"),u(a,"max","3.5"),u(a,"step","0.1"),u(a,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(d,h){P(d,e,h),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].i.v.b),r||(f=ce(a,"input",t[117]),r=!0)},p(d,h){var b,g,w;h[0]&4&&l!==(l=(((w=(g=(b=d[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:w.boot)??"Boot limit")+"")&&E(n,l),h[0]&64&&ye(a.value)!==d[6].i.v.b&&H(a,d[6].i.v.b)},d(d){d&&N(e),r=!1,f()}}}function Ea(t){var F,M,A,O,j,Y;let e,l,n=(((M=(F=t[2].conf)==null?void 0:F.debug)==null?void 0:M.title)??"Debugging")+"",i,s,a,r,f,c,m,_,d,h,b=(((O=(A=t[2].conf)==null?void 0:A.debug)==null?void 0:O.enable)??"Enable debugging")+"",g,w,k,R,I=((Y=(j=t[6])==null?void 0:j.d)==null?void 0:Y.s)&&Da(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("label"),d=p("input"),h=v(),g=C(b),w=v(),I&&I.c(),u(l,"class","text-sm"),u(a,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","d"),f.value="true",u(d,"type","checkbox"),u(d,"name","ds"),d.__value="true",H(d,d.__value),u(d,"class","rounded mb-1"),u(m,"class","mt-3"),u(e,"class","cnt")},m(z,T){P(z,e,T),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,d),d.checked=t[6].d.s,o(_,h),o(_,g),o(e,w),I&&I.m(e,null),k||(R=ce(d,"change",t[118]),k=!0)},p(z,T){var B,X,y,K,V,U;T[0]&4&&n!==(n=(((X=(B=z[2].conf)==null?void 0:B.debug)==null?void 0:X.title)??"Debugging")+"")&&E(i,n),T[0]&64&&(d.checked=z[6].d.s),T[0]&4&&b!==(b=(((K=(y=z[2].conf)==null?void 0:y.debug)==null?void 0:K.enable)??"Enable debugging")+"")&&E(g,b),(U=(V=z[6])==null?void 0:V.d)!=null&&U.s?I?I.p(z,T):(I=Da(z),I.c(),I.m(e,null)):I&&(I.d(1),I=null)},d(z){z&&N(e),I&&I.d(),k=!1,R()}}}function Da(t){var A,O,j,Y;let e,l=(((O=(A=t[2].conf)==null?void 0:A.debug)==null?void 0:O.danger)??"Disable when done")+"",n,i,s,a,r,f,c=(((Y=(j=t[2].conf)==null?void 0:j.debug)==null?void 0:Y.telnet)??"Enable telnet")+"",m,_,d,h,b,g,w,k,R,I,F,M=t[6].d.t&&Aa(t);return{c(){e=p("div"),n=C(l),i=v(),s=p("div"),a=p("label"),r=p("input"),f=v(),m=C(c),_=v(),M&&M.c(),d=v(),h=p("div"),b=p("select"),g=p("option"),g.textContent="Verbose",w=p("option"),w.textContent="Debug",k=p("option"),k.textContent="Info",R=p("option"),R.textContent="Warning",u(e,"class","bd-red"),u(r,"type","checkbox"),u(r,"name","dt"),r.__value="true",H(r,r.__value),u(r,"class","rounded mb-1"),u(s,"class","my-1"),g.__value=1,H(g,g.__value),w.__value=2,H(w,w.__value),k.__value=3,H(k,k.__value),R.__value=4,H(R,R.__value),u(b,"name","dl"),u(b,"class","in-s"),t[6].d.l===void 0&&Dt(()=>t[120].call(b)),u(h,"class","my-1")},m(z,T){P(z,e,T),o(e,n),P(z,i,T),P(z,s,T),o(s,a),o(a,r),r.checked=t[6].d.t,o(a,f),o(a,m),P(z,_,T),M&&M.m(z,T),P(z,d,T),P(z,h,T),o(h,b),o(b,g),o(b,w),o(b,k),o(b,R),Ke(b,t[6].d.l,!0),I||(F=[ce(r,"change",t[119]),ce(b,"change",t[120])],I=!0)},p(z,T){var B,X,y,K;T[0]&4&&l!==(l=(((X=(B=z[2].conf)==null?void 0:B.debug)==null?void 0:X.danger)??"Disable when done")+"")&&E(n,l),T[0]&64&&(r.checked=z[6].d.t),T[0]&4&&c!==(c=(((K=(y=z[2].conf)==null?void 0:y.debug)==null?void 0:K.telnet)??"Enable telnet")+"")&&E(m,c),z[6].d.t?M?M.p(z,T):(M=Aa(z),M.c(),M.m(d.parentNode,d)):M&&(M.d(1),M=null),T[0]&64&&Ke(b,z[6].d.l)},d(z){z&&(N(e),N(i),N(s),N(_),N(d),N(h)),M&&M.d(z),I=!1,Bt(F)}}}function Aa(t){var i,s;let e,l=(((s=(i=t[2].conf)==null?void 0:i.debug)==null?void 0:s.telnet_danger)??"Disable when done")+"",n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.debug)==null?void 0:c.telnet_danger)??"Disable when done")+"")&&E(n,l)},d(a){a&&N(e)}}}function Oa(t){var d,h;let e,l,n=(((d=t[2].conf)==null?void 0:d.btn_reset)??"Factory reset")+"",i,s,a,r,f=(((h=t[2].btn)==null?void 0:h.reboot)??"Reboot")+"",c,m,_;return{c(){e=p("div"),l=p("button"),i=C(n),s=v(),a=p("div"),r=p("button"),c=C(f),u(l,"type","button"),u(l,"class","btn-red"),u(r,"type","button"),u(r,"class","btn-yellow"),u(a,"class","text-center")},m(b,g){P(b,e,g),o(e,l),o(l,i),P(b,s,g),P(b,a,g),o(a,r),o(r,c),m||(_=[ce(l,"click",t[14]),ce(r,"click",t[16])],m=!0)},p(b,g){var w,k;g[0]&4&&n!==(n=(((w=b[2].conf)==null?void 0:w.btn_reset)??"Factory reset")+"")&&E(i,n),g[0]&4&&f!==(f=(((k=b[2].btn)==null?void 0:k.reboot)??"Reboot")+"")&&E(c,f)},d(b){b&&(N(e),N(s),N(a)),m=!1,Bt(_)}}}function La(t){var s;let e,l,n=(((s=t[2].btn)==null?void 0:s.save)??"Save")+"",i;return{c(){e=p("div"),l=p("button"),i=C(n),u(l,"type","submit"),u(l,"class","btn-pri"),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,l),o(l,i)},p(a,r){var f;r[0]&4&&n!==(n=(((f=a[2].btn)==null?void 0:f.save)??"Save")+"")&&E(i,n)},d(a){a&&N(e)}}}function Mc(t){var J,$,ke,Ce,D,S,L,q,W,te,fe,_e,de,x,he,be,Ae,Te,Oe,Ie,De,Ue,xe,wt,tt,ot,St,dt,at,it,ft,Ot,We,Re,He,lt,ve,Ee,Qe;let e,l,n,i,s,a,r,f,c,m,_=((ke=($=(J=t[6])==null?void 0:J.p)==null?void 0:$.r)==null?void 0:ke.startsWith("NO"))||((S=(D=(Ce=t[6])==null?void 0:Ce.p)==null?void 0:D.r)==null?void 0:S.startsWith("10YNO"))||((W=(q=(L=t[6])==null?void 0:L.p)==null?void 0:q.r)==null?void 0:W.startsWith("10Y1001A1001A4")),d,h,b,g=((te=t[6])==null?void 0:te.d)&&((_e=(fe=t[0])==null?void 0:fe.features)==null?void 0:_e.includes("rdebug")),w,k,R,I,F,M,A,O,j,Y,z,T,B,X,y=((de=t[6])==null?void 0:de.g)&&zo(t),K=((x=t[6])==null?void 0:x.m)&&Ko(t),V=((he=t[6])==null?void 0:he.w)&&Jo(t),U=((be=t[6])==null?void 0:be.n)&&na(t),G=((Ae=t[6])==null?void 0:Ae.q)&&sa(t),se=((Oe=(Te=t[6])==null?void 0:Te.q)==null?void 0:Oe.m)==3&&fa(t),le=((De=(Ie=t[6])==null?void 0:Ie.q)==null?void 0:De.m)==4&&ua(t),Q=((Ue=t[6])==null?void 0:Ue.c)&&ra(t),ae=_&&va(t),re=((xe=t[6])==null?void 0:xe.u)&&ga(t),ue=((tt=(wt=t[6])==null?void 0:wt.i)==null?void 0:tt.h)&&(((ot=t[0])==null?void 0:ot.board)>20||((St=t[0])==null?void 0:St.chip)=="esp8266"||((it=(at=(dt=t[6])==null?void 0:dt.i)==null?void 0:at.d)==null?void 0:it.d)>0)&&Ca(t),ne=g&&Ea(t),pe=((ft=t[1])==null?void 0:ft.a)&&Oa(t),oe=t[6]&&La(t);return F=new rl({props:{active:t[3],message:((We=(Ot=t[2].conf)==null?void 0:Ot.mask)==null?void 0:We.loading)??"Loading"}}),A=new rl({props:{active:t[4],message:((He=(Re=t[2].conf)==null?void 0:Re.mask)==null?void 0:He.saving)??"Saving"}}),j=new rl({props:{active:t[10],message:((ve=(lt=t[2].conf)==null?void 0:lt.mask)==null?void 0:ve.reset)??"Factory reset"}}),z=new rl({props:{active:t[11],message:((Qe=(Ee=t[2].conf)==null?void 0:Ee.mask)==null?void 0:Qe.reset_done)??"Done"}}),{c(){e=p("form"),l=p("div"),y&&y.c(),n=v(),K&&K.c(),i=v(),V&&V.c(),s=v(),U&&U.c(),a=v(),G&&G.c(),r=v(),se&&se.c(),f=v(),le&&le.c(),c=v(),Q&&Q.c(),m=v(),ae&&ae.c(),d=v(),re&&re.c(),h=v(),ue&&ue.c(),b=v(),ne&&ne.c(),w=v(),k=p("div"),pe&&pe.c(),R=v(),oe&&oe.c(),I=v(),Pe(F.$$.fragment),M=v(),Pe(A.$$.fragment),O=v(),Pe(j.$$.fragment),Y=v(),Pe(z.$$.fragment),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(k,"class","grid grid-cols-3 mt-3"),u(e,"autocomplete","off")},m(me,we){P(me,e,we),o(e,l),y&&y.m(l,null),o(l,n),K&&K.m(l,null),o(l,i),V&&V.m(l,null),o(l,s),U&&U.m(l,null),o(l,a),G&&G.m(l,null),o(l,r),se&&se.m(l,null),o(l,f),le&&le.m(l,null),o(l,c),Q&&Q.m(l,null),o(l,m),ae&&ae.m(l,null),o(l,d),re&&re.m(l,null),o(l,h),ue&&ue.m(l,null),o(l,b),ne&&ne.m(l,null),o(e,w),o(e,k),pe&&pe.m(k,null),o(k,R),oe&&oe.m(k,null),P(me,I,we),Me(F,me,we),P(me,M,we),Me(A,me,we),P(me,O,we),Me(j,me,we),P(me,Y,we),Me(z,me,we),T=!0,B||(X=ce(e,"submit",pn(t[15])),B=!0)},p(me,we){var Be,gt,ct,mt,et,Tt,zt,kt,_t,yt,Qt,Ft,jt,Kt,Jt,Wt,Lt,Fe,Xe,je,Et,Ut,$e,st,qt,pt,ge,nt,ze,xt,el,tl,ll,nl,il,sl,Ze,Se,ee;(Be=me[6])!=null&&Be.g?y?(y.p(me,we),we[0]&64&&Z(y,1)):(y=zo(me),y.c(),Z(y,1),y.m(l,n)):y&&(ht(),ie(y,1,1,()=>{y=null}),vt()),(gt=me[6])!=null&>.m?K?K.p(me,we):(K=Ko(me),K.c(),K.m(l,i)):K&&(K.d(1),K=null),(ct=me[6])!=null&&ct.w?V?V.p(me,we):(V=Jo(me),V.c(),V.m(l,s)):V&&(V.d(1),V=null),(mt=me[6])!=null&&mt.n?U?(U.p(me,we),we[0]&64&&Z(U,1)):(U=na(me),U.c(),Z(U,1),U.m(l,a)):U&&(ht(),ie(U,1,1,()=>{U=null}),vt()),(et=me[6])!=null&&et.q?G?(G.p(me,we),we[0]&64&&Z(G,1)):(G=sa(me),G.c(),Z(G,1),G.m(l,r)):G&&(ht(),ie(G,1,1,()=>{G=null}),vt()),((zt=(Tt=me[6])==null?void 0:Tt.q)==null?void 0:zt.m)==3?se?se.p(me,we):(se=fa(me),se.c(),se.m(l,f)):se&&(se.d(1),se=null),((_t=(kt=me[6])==null?void 0:kt.q)==null?void 0:_t.m)==4?le?le.p(me,we):(le=ua(me),le.c(),le.m(l,c)):le&&(le.d(1),le=null),(yt=me[6])!=null&&yt.c?Q?(Q.p(me,we),we[0]&64&&Z(Q,1)):(Q=ra(me),Q.c(),Z(Q,1),Q.m(l,m)):Q&&(ht(),ie(Q,1,1,()=>{Q=null}),vt()),we[0]&64&&(_=((jt=(Ft=(Qt=me[6])==null?void 0:Qt.p)==null?void 0:Ft.r)==null?void 0:jt.startsWith("NO"))||((Wt=(Jt=(Kt=me[6])==null?void 0:Kt.p)==null?void 0:Jt.r)==null?void 0:Wt.startsWith("10YNO"))||((Xe=(Fe=(Lt=me[6])==null?void 0:Lt.p)==null?void 0:Fe.r)==null?void 0:Xe.startsWith("10Y1001A1001A4"))),_?ae?ae.p(me,we):(ae=va(me),ae.c(),ae.m(l,d)):ae&&(ae.d(1),ae=null),(je=me[6])!=null&&je.u?re?re.p(me,we):(re=ga(me),re.c(),re.m(l,h)):re&&(re.d(1),re=null),(Ut=(Et=me[6])==null?void 0:Et.i)!=null&&Ut.h&&((($e=me[0])==null?void 0:$e.board)>20||((st=me[0])==null?void 0:st.chip)=="esp8266"||((ge=(pt=(qt=me[6])==null?void 0:qt.i)==null?void 0:pt.d)==null?void 0:ge.d)>0)?ue?(ue.p(me,we),we[0]&65&&Z(ue,1)):(ue=Ca(me),ue.c(),Z(ue,1),ue.m(l,b)):ue&&(ht(),ie(ue,1,1,()=>{ue=null}),vt()),we[0]&65&&(g=((nt=me[6])==null?void 0:nt.d)&&((xt=(ze=me[0])==null?void 0:ze.features)==null?void 0:xt.includes("rdebug"))),g?ne?ne.p(me,we):(ne=Ea(me),ne.c(),ne.m(l,null)):ne&&(ne.d(1),ne=null),(el=me[1])!=null&&el.a?pe?pe.p(me,we):(pe=Oa(me),pe.c(),pe.m(k,R)):pe&&(pe.d(1),pe=null),me[6]?oe?oe.p(me,we):(oe=La(me),oe.c(),oe.m(k,null)):oe&&(oe.d(1),oe=null);const ut={};we[0]&8&&(ut.active=me[3]),we[0]&4&&(ut.message=((ll=(tl=me[2].conf)==null?void 0:tl.mask)==null?void 0:ll.loading)??"Loading"),F.$set(ut);const Ge={};we[0]&16&&(Ge.active=me[4]),we[0]&4&&(Ge.message=((il=(nl=me[2].conf)==null?void 0:nl.mask)==null?void 0:il.saving)??"Saving"),A.$set(Ge);const Rt={};we[0]&1024&&(Rt.active=me[10]),we[0]&4&&(Rt.message=((Ze=(sl=me[2].conf)==null?void 0:sl.mask)==null?void 0:Ze.reset)??"Factory reset"),j.$set(Rt);const bt={};we[0]&2048&&(bt.active=me[11]),we[0]&4&&(bt.message=((ee=(Se=me[2].conf)==null?void 0:Se.mask)==null?void 0:ee.reset_done)??"Done"),z.$set(bt)},i(me){T||(Z(y),Z(U),Z(G),Z(Q),Z(ue),Z(F.$$.fragment,me),Z(A.$$.fragment,me),Z(j.$$.fragment,me),Z(z.$$.fragment,me),T=!0)},o(me){ie(y),ie(U),ie(G),ie(Q),ie(ue),ie(F.$$.fragment,me),ie(A.$$.fragment,me),ie(j.$$.fragment,me),ie(z.$$.fragment,me),T=!1},d(me){me&&(N(e),N(I),N(M),N(O),N(Y)),y&&y.d(),K&&K.d(),V&&V.d(),U&&U.d(),G&&G.d(),se&&se.d(),le&&le.d(),Q&&Q.d(),ae&&ae.d(),re&&re.d(),ue&&ue.d(),ne&&ne.d(),pe&&pe.d(),oe&&oe.d(),Ne(F,me),Ne(A,me),Ne(j,me),Ne(z,me),B=!1,X()}}}async function Nc(){await(await fetch("reboot",{method:"POST"})).json()}function Pc(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,{data:s}=e,a={};gl.subscribe(Ze=>{l(2,a=Ze)});let r=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Per phase",key:"h"},{name:"Power factor",key:"f"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],f=!0,c=!1,m=!1,_,d=[];Un.subscribe(Ze=>{var Se,ee,Le;Ze.version&&(l(5,m=(Se=Ze==null?void 0:Ze.c)==null?void 0:Se.e),l(6,_=Ze),l(3,f=!1),l(7,d=[{code:"en",name:"English"}]),(ee=_==null?void 0:_.u)!=null&&ee.lang&&_.u.lang!="en"&&d.push({code:_.u.lang,name:((Le=a.language)==null?void 0:Le.name)??"Unknown"}),d.push({code:"hub",name:"Load from server"}))}),H0();let h=!0,b={};$i.subscribe(Ze=>{var Se;l(8,h=!0);for(let ee=0;ee(Xt.hostname=Se.get("gh"),Xt.usrcfg=al.success,Xt.booting=al.reboot,Se.get("nm")=="static"&&(Xt.net.ip=Se.get("ni"),Xt.net.mask=Se.get("nu"),Xt.net.gw=Se.get("ng"),Xt.net.dns1=Se.get("nd")),Xt.ui=_.u,Xt)),l(4,c=!1),sn(n)}const I=function(){confirm("Reboot?")&&(cl.update(Ze=>(Ze.booting=!0,Ze)),Nc())};async function F(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),Un.update(Se=>(Se.q.s.c=!1,Se)))}async function M(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),Un.update(Se=>(Se.q.s.r=!1,Se)))}async function A(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),Un.update(Se=>(Se.q.s.k=!1,Se)))}const O=function(){_.q.s.e?_.q.p==1883&&l(6,_.q.p=8883,_):_.q.p==8883&&l(6,_.q.p=1883,_)};async function j(){if(_.u.lang=="hub"){const Ze=await bl("http://hub.amsleser.no/hub/language/list.json");l(7,d=await Ze.json()),l(6,_.u.lang=a.language.code,_)}}async function Y(){l(6,_.p.e=!0,_)}let z=44;async function T(){const Ze=await bl("cloudkey.json");if(Ze.status==200){let Se=await Ze.json();window.open("https://www.amsleser.cloud/device/"+Se.seed)}else alert("Not able to bind to cloud")}const B=window||global;B.bindToCloud=function(){console.log("BIND CALLED")};function X(){_.g.h=this.value,l(6,_)}function y(){_.g.t=Gt(this),l(6,_)}function K(){_.p.r=Gt(this),l(6,_)}function V(){_.p.c=Gt(this),l(6,_)}function U(){_.p.e=this.checked,l(6,_)}function G(){_.p.t=this.value,l(6,_)}function se(){_.g.s=Gt(this),l(6,_)}function le(){_.g.u=this.value,l(6,_)}function Q(){_.g.p=this.value,l(6,_)}function ae(){_.g.c=this.value,l(6,_)}function re(){_.m.a=Gt(this),l(6,_)}function ue(){_.m.b=ye(this.value),l(6,_)}function ne(){_.m.i=this.checked,l(6,_)}function pe(){_.m.b=Gt(this),l(6,_)}function oe(){_.m.p=Gt(this),l(6,_)}function J(){_.m.s=ye(this.value),l(6,_)}function $(){_.m.d=Gt(this),l(6,_)}function ke(){_.m.f=ye(this.value),l(6,_)}function Ce(){_.m.r=ye(this.value),l(6,_)}function D(){_.m.e.e=this.checked,l(6,_)}function S(){_.m.e.k=this.value,l(6,_)}function L(){_.m.e.a=this.value,l(6,_)}function q(){_.m.m.e=this.checked,l(6,_)}function W(){_.m.m.w=ye(this.value),l(6,_)}function te(){_.m.m.v=ye(this.value),l(6,_)}function fe(){_.m.m.a=ye(this.value),l(6,_)}function _e(){_.m.m.c=ye(this.value),l(6,_)}function de(){_.n.c=Gt(this),l(6,_)}function x(){h=this.checked,l(8,h)}function he(){_.w.s=this.value,l(6,_)}function be(){_.w.s=Gt(this),l(6,_)}function Ae(){_.w.p=this.value,l(6,_)}function Te(){_.w.z=Gt(this),l(6,_)}function Oe(){_.w.w=ye(this.value),l(6,_)}function Ie(){_.w.b=this.checked,l(6,_)}function De(){_.n.m=Gt(this),l(6,_)}function Ue(){_.n.i=this.value,l(6,_)}function xe(){_.n.s=Gt(this),l(6,_)}function wt(){_.n.g=this.value,l(6,_)}function tt(){_.n.d1=this.value,l(6,_)}function ot(){_.n.d2=this.value,l(6,_)}function St(){_.n.x=this.checked,l(6,_)}function dt(){_.n.d=this.checked,l(6,_)}function at(){_.n.h=this.checked,l(6,_)}function it(){_.n.n1=this.value,l(6,_)}function ft(){_.q.s.e=this.checked,l(6,_)}function Ot(){_.q.h=this.value,l(6,_)}function We(){_.q.p=ye(this.value),l(6,_)}function Re(){_.q.u=this.value,l(6,_)}function He(){_.q.a=this.value,l(6,_)}function lt(){_.q.c=this.value,l(6,_)}function ve(){_.q.m=Gt(this),l(6,_)}function Ee(){_.q.b=this.value,l(6,_)}function Qe(){_.q.r=this.value,l(6,_)}function me(){_.q.t=Gt(this),l(6,_)}function we(){_.q.d=ye(this.value),l(6,_)}function ut(){_.q.i=ye(this.value),l(6,_)}function Ge(){_.q.k=ye(this.value),l(6,_)}function Rt(){_.o.e=this.value,l(6,_)}function bt(){_.o.c=this.value,l(6,_)}function Be(){_.o.u1=this.value,l(6,_)}function gt(){_.o.u2=this.value,l(6,_)}function ct(){_.o.u3=this.value,l(6,_)}function mt(){_.h.t=this.value,l(6,_)}function et(){_.h.h=this.value,l(6,_)}function Tt(){_.h.n=this.value,l(6,_)}function zt(){_.c.e=this.checked,l(6,_)}function kt(){_.c.p=Gt(this),l(6,_)}function _t(){_.c.es=this.checked,l(6,_)}function yt(Ze){_.t.t[Ze]=ye(this.value),l(6,_)}function Qt(){_.t.h=ye(this.value),l(6,_)}function Ft(Ze){_.u[Ze.key]=Gt(this),l(6,_)}function jt(){_.u.lang=Gt(this),l(6,_)}function Kt(){_.i.h.p=Gt(this),l(6,_)}function Jt(){_.i.h.t=Gt(this),l(6,_)}function Wt(){_.i.h.u=this.checked,l(6,_)}function Lt(){_.i.a=ye(this.value),l(6,_)}function Fe(){_.i.l.p=ye(this.value),l(6,_)}function Xe(){_.i.l.i=this.checked,l(6,_)}function je(){_.i.r.i=this.checked,l(6,_)}function Et(){_.i.r.r=ye(this.value),l(6,_)}function Ut(){_.i.r.g=ye(this.value),l(6,_)}function $e(){_.i.r.b=ye(this.value),l(6,_)}function st(){_.i.d.d=ye(this.value),l(6,_)}function qt(){_.i.t.d=ye(this.value),l(6,_)}function pt(){_.i.t.a=ye(this.value),l(6,_)}function ge(){_.i.v.p=ye(this.value),l(6,_)}function nt(){_.i.v.d.v=ye(this.value),l(6,_)}function ze(){_.i.v.d.g=ye(this.value),l(6,_)}function xt(){_.i.d.b=Gt(this),l(6,_)}function el(){_.i.v.o=ye(this.value),l(6,_)}function tl(){_.i.v.m=ye(this.value),l(6,_)}function ll(){_.i.v.b=ye(this.value),l(6,_)}function nl(){_.d.s=this.checked,l(6,_)}function il(){_.d.t=this.checked,l(6,_)}function sl(){_.d.l=Gt(this),l(6,_)}return t.$$set=Ze=>{"basepath"in Ze&&l(24,n=Ze.basepath),"sysinfo"in Ze&&l(0,i=Ze.sysinfo),"data"in Ze&&l(1,s=Ze.data)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(12,z=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,s,a,f,c,m,_,d,h,b,g,w,z,r,k,R,I,F,M,A,O,j,Y,T,n,X,y,K,V,U,G,se,le,Q,ae,re,ue,ne,pe,oe,J,$,ke,Ce,D,S,L,q,W,te,fe,_e,de,x,he,be,Ae,Te,Oe,Ie,De,Ue,xe,wt,tt,ot,St,dt,at,it,ft,Ot,We,Re,He,lt,ve,Ee,Qe,me,we,ut,Ge,Rt,bt,Be,gt,ct,mt,et,Tt,zt,kt,_t,yt,Qt,Ft,jt,Kt,Jt,Wt,Lt,Fe,Xe,je,Et,Ut,$e,st,qt,pt,ge,nt,ze,xt,el,tl,ll,nl,il,sl]}class Tc extends Pt{constructor(e){super(),Nt(this,e,Pc,Mc,Mt,{basepath:24,sysinfo:0,data:1},null,[-1,-1,-1,-1,-1])}}function Ia(t,e,l){const n=t.slice();return n[21]=e[l],n}function Ra(t){let e,l=t[1].cpu+"",n,i;return{c(){e=C("("),n=C(l),i=C("MHz)")},m(s,a){P(s,e,a),P(s,n,a),P(s,i,a)},p(s,a){a&2&&l!==(l=s[1].cpu+"")&&E(n,l)},d(s){s&&(N(e),N(n),N(i))}}}function qc(t){let e=Je(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){P(n,l,i)},p(n,i){i&2&&e!==(e=Je(n[1].chip,n[1].board)+"")&&E(l,e)},d(n){n&&N(l)}}}function Fa(t){var V,U,G,se,le,Q,ae,re;let e,l=(((U=(V=t[3].status)==null?void 0:V.device)==null?void 0:U.apmac)??"AP MAC")+"",n,i,s=t[1].apmac+"",a,r,f,c=(((se=(G=t[3].status)==null?void 0:G.device)==null?void 0:se.last_boot)??"Last boot")+"",m,_,d,h,b,g,w=(((Q=(le=t[3].status)==null?void 0:le.device)==null?void 0:Q.reason)??"Reason")+"",k,R,I=(((re=(ae=t[3][ds(t[1].chip)])==null?void 0:ae.reason)==null?void 0:re[t[1].boot_reason])??t[1].boot_reason)+"",F,M,A=t[1].boot_reason+"",O,j,Y=t[1].ex_cause+"",z,T,B;const X=[Dc,Ec],y=[];function K(ue,ne){return ue[0].u>0?0:1}return d=K(t),h=y[d]=X[d](t),{c(){e=p("div"),n=C(l),i=C(": "),a=C(s),r=v(),f=p("div"),m=C(c),_=C(`: + `),h.c(),b=v(),g=p("div"),k=C(w),R=C(": "),F=C(I),M=C(" ("),O=C(A),j=C("/"),z=C(Y),T=C(")"),u(e,"class","my-2"),u(f,"class","my-2"),u(g,"class","my-2")},m(ue,ne){P(ue,e,ne),o(e,n),o(e,i),o(e,a),P(ue,r,ne),P(ue,f,ne),o(f,m),o(f,_),y[d].m(f,null),P(ue,b,ne),P(ue,g,ne),o(g,k),o(g,R),o(g,F),o(g,M),o(g,O),o(g,j),o(g,z),o(g,T),B=!0},p(ue,ne){var oe,J,$,ke,Ce,D,S,L;(!B||ne&8)&&l!==(l=(((J=(oe=ue[3].status)==null?void 0:oe.device)==null?void 0:J.apmac)??"AP MAC")+"")&&E(n,l),(!B||ne&2)&&s!==(s=ue[1].apmac+"")&&E(a,s),(!B||ne&8)&&c!==(c=(((ke=($=ue[3].status)==null?void 0:$.device)==null?void 0:ke.last_boot)??"Last boot")+"")&&E(m,c);let pe=d;d=K(ue),d===pe?y[d].p(ue,ne):(ht(),ie(y[pe],1,1,()=>{y[pe]=null}),vt(),h=y[d],h?h.p(ue,ne):(h=y[d]=X[d](ue),h.c()),Z(h,1),h.m(f,null)),(!B||ne&8)&&w!==(w=(((D=(Ce=ue[3].status)==null?void 0:Ce.device)==null?void 0:D.reason)??"Reason")+"")&&E(k,w),(!B||ne&10)&&I!==(I=(((L=(S=ue[3][ds(ue[1].chip)])==null?void 0:S.reason)==null?void 0:L[ue[1].boot_reason])??ue[1].boot_reason)+"")&&E(F,I),(!B||ne&2)&&A!==(A=ue[1].boot_reason+"")&&E(O,A),(!B||ne&2)&&Y!==(Y=ue[1].ex_cause+"")&&E(z,Y)},i(ue){B||(Z(h),B=!0)},o(ue){ie(h),B=!1},d(ue){ue&&(N(e),N(r),N(f),N(b),N(g)),y[d].d()}}}function Ec(t){let e;return{c(){e=C("-")},m(l,n){P(l,e,n)},p:Ye,i:Ye,o:Ye,d(l){l&&N(e)}}}function Dc(t){let e,l;return e=new Tu({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:"",offset:t[1].clock_offset}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),i&2&&(s.offset=n[1].clock_offset),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Ua(t){var m;let e,l,n,i,s=(((m=t[3].btn)==null?void 0:m.reboot)??"Reboot")+"",a,r,f,c;return l=new dl({props:{to:"/consent",$$slots:{default:[Ac]},$$scope:{ctx:t}}}),{c(){e=p("div"),Pe(l.$$.fragment),n=v(),i=p("button"),a=C(s),u(i,"class","btn-yellow-sm float-right"),u(e,"class","my-2")},m(_,d){P(_,e,d),Me(l,e,null),o(e,n),o(e,i),o(i,a),r=!0,f||(c=ce(i,"click",t[11]),f=!0)},p(_,d){var b;const h={};d&16777224&&(h.$$scope={dirty:d,ctx:_}),l.$set(h),(!r||d&8)&&s!==(s=(((b=_[3].btn)==null?void 0:b.reboot)??"Reboot")+"")&&E(a,s)},i(_){r||(Z(l.$$.fragment,_),r=!0)},o(_){ie(l.$$.fragment,_),r=!1},d(_){_&&N(e),Ne(l),f=!1,c()}}}function Ac(t){var i,s;let e,l=(((s=(i=t[3].status)==null?void 0:i.device)==null?void 0:s.btn_consents)??"Consents")+"",n;return{c(){e=p("span"),n=C(l),u(e,"class","btn-pri-sm")},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r&8&&l!==(l=(((c=(f=a[3].status)==null?void 0:f.device)==null?void 0:c.btn_consents)??"Consents")+"")&&E(n,l)},d(a){a&&N(e)}}}function Ba(t){var z,T,B,X,y,K,V,U;let e,l,n=(((T=(z=t[3].status)==null?void 0:z.meter)==null?void 0:T.title)??"Meter")+"",i,s,a,r=(((X=(B=t[3].status)==null?void 0:B.meter)==null?void 0:X.manufacturer)??"Manufacturer")+"",f,c,m=ui(t[1].meter.mfg)+"",_,d,h,b=(((K=(y=t[3].status)==null?void 0:y.meter)==null?void 0:K.model)??"Model")+"",g,w,k=(t[1].meter.model?t[1].meter.model:"unknown")+"",R,I,F,M=(((U=(V=t[3].status)==null?void 0:V.meter)==null?void 0:U.id)??"ID")+"",A,O,j=(t[1].meter.id?t[1].meter.id:"unknown")+"",Y;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),f=C(r),c=C(": "),_=C(m),d=v(),h=p("div"),g=C(b),w=C(": "),R=C(k),I=v(),F=p("div"),A=C(M),O=C(": "),Y=C(j),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(F,"class","my-2"),u(e,"class","cnt")},m(G,se){P(G,e,se),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(a,c),o(a,_),o(e,d),o(e,h),o(h,g),o(h,w),o(h,R),o(e,I),o(e,F),o(F,A),o(F,O),o(F,Y)},p(G,se){var le,Q,ae,re,ue,ne,pe,oe;se&8&&n!==(n=(((Q=(le=G[3].status)==null?void 0:le.meter)==null?void 0:Q.title)??"Meter")+"")&&E(i,n),se&8&&r!==(r=(((re=(ae=G[3].status)==null?void 0:ae.meter)==null?void 0:re.manufacturer)??"Manufacturer")+"")&&E(f,r),se&2&&m!==(m=ui(G[1].meter.mfg)+"")&&E(_,m),se&8&&b!==(b=(((ne=(ue=G[3].status)==null?void 0:ue.meter)==null?void 0:ne.model)??"Model")+"")&&E(g,b),se&2&&k!==(k=(G[1].meter.model?G[1].meter.model:"unknown")+"")&&E(R,k),se&8&&M!==(M=(((oe=(pe=G[3].status)==null?void 0:pe.meter)==null?void 0:oe.id)??"ID")+"")&&E(A,M),se&2&&j!==(j=(G[1].meter.id?G[1].meter.id:"unknown")+"")&&E(Y,j)},d(G){G&&N(e)}}}function ja(t){var U,G,se,le,Q,ae,re,ue;let e,l,n=(((G=(U=t[3].status)==null?void 0:U.network)==null?void 0:G.title)??"Network")+"",i,s,a,r=(((le=(se=t[3].conf)==null?void 0:se.network)==null?void 0:le.ip)??"IP")+"",f,c,m=t[1].net.ip+"",_,d,h,b=(((ae=(Q=t[3].conf)==null?void 0:Q.network)==null?void 0:ae.mask)??"Mask")+"",g,w,k=t[1].net.mask+"",R,I,F,M=(((ue=(re=t[3].conf)==null?void 0:re.network)==null?void 0:ue.gw)??"Gateway")+"",A,O,j=t[1].net.gw+"",Y,z,T,B,X,y=t[1].net.dns1&&Ha(t),K=t[1].net.dns2&&ya(t),V=t[1].net.ipv6&&za(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),f=C(r),c=C(": "),_=C(m),d=v(),h=p("div"),g=C(b),w=C(": "),R=C(k),I=v(),F=p("div"),A=C(M),O=C(": "),Y=C(j),z=v(),T=p("div"),y&&y.c(),B=v(),K&&K.c(),X=v(),V&&V.c(),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(F,"class","my-2"),u(T,"class","my-2"),u(e,"class","cnt")},m(ne,pe){P(ne,e,pe),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(a,c),o(a,_),o(e,d),o(e,h),o(h,g),o(h,w),o(h,R),o(e,I),o(e,F),o(F,A),o(F,O),o(F,Y),o(e,z),o(e,T),y&&y.m(T,null),o(T,B),K&&K.m(T,null),o(e,X),V&&V.m(e,null)},p(ne,pe){var oe,J,$,ke,Ce,D,S,L;pe&8&&n!==(n=(((J=(oe=ne[3].status)==null?void 0:oe.network)==null?void 0:J.title)??"Network")+"")&&E(i,n),pe&8&&r!==(r=(((ke=($=ne[3].conf)==null?void 0:$.network)==null?void 0:ke.ip)??"IP")+"")&&E(f,r),pe&2&&m!==(m=ne[1].net.ip+"")&&E(_,m),pe&8&&b!==(b=(((D=(Ce=ne[3].conf)==null?void 0:Ce.network)==null?void 0:D.mask)??"Mask")+"")&&E(g,b),pe&2&&k!==(k=ne[1].net.mask+"")&&E(R,k),pe&8&&M!==(M=(((L=(S=ne[3].conf)==null?void 0:S.network)==null?void 0:L.gw)??"Gateway")+"")&&E(A,M),pe&2&&j!==(j=ne[1].net.gw+"")&&E(Y,j),ne[1].net.dns1?y?y.p(ne,pe):(y=Ha(ne),y.c(),y.m(T,B)):y&&(y.d(1),y=null),ne[1].net.dns2?K?K.p(ne,pe):(K=ya(ne),K.c(),K.m(T,null)):K&&(K.d(1),K=null),ne[1].net.ipv6?V?V.p(ne,pe):(V=za(ne),V.c(),V.m(e,null)):V&&(V.d(1),V=null)},d(ne){ne&&N(e),y&&y.d(),K&&K.d(),V&&V.d()}}}function Ha(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[1].net.dns1+"",s;return{c(){l=C(e),n=C(": "),s=C(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,s,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&E(l,e),c&2&&i!==(i=f[1].net.dns1+"")&&E(s,i)},d(f){f&&(N(l),N(n),N(s))}}}function ya(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[1].net.dns2+"",s;return{c(){l=C(e),n=C(": "),s=C(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,s,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&E(l,e),c&2&&i!==(i=f[1].net.dns2+"")&&E(s,i)},d(f){f&&(N(l),N(n),N(s))}}}function za(t){let e,l,n,i=t[1].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"",s,a,r,f,c=t[1].net.dns1v6&&Wa(t),m=t[1].net.dns2v6&&Ga(t);return{c(){e=p("div"),l=C("IPv6: "),n=p("span"),s=C(i),a=v(),r=p("div"),c&&c.c(),f=v(),m&&m.c(),nn(n,"font-size","14px"),u(e,"class","my-2"),u(r,"class","my-2")},m(_,d){P(_,e,d),o(e,l),o(e,n),o(n,s),P(_,a,d),P(_,r,d),c&&c.m(r,null),o(r,f),m&&m.m(r,null)},p(_,d){d&2&&i!==(i=_[1].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(s,i),_[1].net.dns1v6?c?c.p(_,d):(c=Wa(_),c.c(),c.m(r,f)):c&&(c.d(1),c=null),_[1].net.dns2v6?m?m.p(_,d):(m=Ga(_),m.c(),m.m(r,null)):m&&(m.d(1),m=null)},d(_){_&&(N(e),N(a),N(r)),c&&c.d(),m&&m.d()}}}function Wa(t){let e,l,n=t[1].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=C("DNSv6: "),l=p("span"),i=C(n),nn(l,"font-size","14px")},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&2&&n!==(n=s[1].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(i,n)},d(s){s&&(N(e),N(l))}}}function Ga(t){let e,l,n=t[1].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=C("DNSv6: "),l=p("span"),i=C(n),nn(l,"font-size","14px")},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&2&&n!==(n=s[1].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(i,n)},d(s){s&&(N(e),N(l))}}}function Va(t){var f,c,m,_;let e,l,n=(((c=(f=t[3].status)==null?void 0:f.firmware)==null?void 0:c.failed)??"Upgrade from {0} to {1} failed").replace("{0}",t[1].upgrade.f).replace("{1}",t[1].upgrade.t)+"",i,s,a=(((_=(m=t[3].errors)==null?void 0:m.upgrade)==null?void 0:_[t[1].upgrade.e])??t[1].upgrade.e)+"",r;return{c(){e=p("div"),l=p("div"),i=C(n),s=v(),r=C(a),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(d,h){P(d,e,h),o(e,l),o(l,i),o(l,s),o(l,r)},p(d,h){var b,g,w,k;h&10&&n!==(n=(((g=(b=d[3].status)==null?void 0:b.firmware)==null?void 0:g.failed)??"Upgrade from {0} to {1} failed").replace("{0}",d[1].upgrade.f).replace("{1}",d[1].upgrade.t)+"")&&E(i,n),h&10&&a!==(a=(((k=(w=d[3].errors)==null?void 0:w.upgrade)==null?void 0:k[d[1].upgrade.e])??d[1].upgrade.e)+"")&&E(r,a)},d(d){d&&N(e)}}}function Ka(t){var b,g;let e,l=(((g=(b=t[3].status)==null?void 0:b.firmware)==null?void 0:g.latest)??"Latest")+"",n,i,s,a=t[1].upgrade.n+"",r,f,c,m,_,d=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[1].upgrade.n&&t[1].upgrade.n!=t[1].version&&Ya(t),h=t[1].fwconsent===2&&Qa(t);return{c(){e=p("div"),n=C(l),i=C(`: + `),s=p("a"),r=C(a),c=v(),d&&d.c(),m=v(),h&&h.c(),_=Ht(),u(s,"href",f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+t[1].upgrade.n),u(s,"class","ml-2 text-blue-600 hover:text-blue-800"),u(s,"target","_blank"),u(s,"rel","noreferrer"),u(e,"class","my-2 flex")},m(w,k){P(w,e,k),o(e,n),o(e,i),o(e,s),o(s,r),o(e,c),d&&d.m(e,null),P(w,m,k),h&&h.m(w,k),P(w,_,k)},p(w,k){var R,I;k&8&&l!==(l=(((I=(R=w[3].status)==null?void 0:R.firmware)==null?void 0:I.latest)??"Latest")+"")&&E(n,l),k&2&&a!==(a=w[1].upgrade.n+"")&&E(r,a),k&2&&f!==(f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+w[1].upgrade.n)&&u(s,"href",f),(w[1].security==0||w[0].a)&&w[1].fwconsent===1&&w[1].upgrade.n&&w[1].upgrade.n!=w[1].version?d?d.p(w,k):(d=Ya(w),d.c(),d.m(e,null)):d&&(d.d(1),d=null),w[1].fwconsent===2?h?h.p(w,k):(h=Qa(w),h.c(),h.m(_.parentNode,_)):h&&(h.d(1),h=null)},d(w){w&&(N(e),N(m),N(_)),d&&d.d(),h&&h.d(w)}}}function Ya(t){let e,l,n,i,s;return{c(){var a,r;e=p("div"),l=p("button"),l.textContent="⇓",u(e,"class","flex-none ml-2 text-green-500"),u(e,"title",n=((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.install)??"Install")},m(a,r){P(a,e,r),o(e,l),i||(s=ce(l,"click",t[10]),i=!0)},p(a,r){var f,c;r&8&&n!==(n=((c=(f=a[3].status)==null?void 0:f.firmware)==null?void 0:c.install)??"Install")&&u(e,"title",n)},d(a){a&&N(e),i=!1,s()}}}function Qa(t){var s,a;let e,l,n=(((a=(s=t[3].status)==null?void 0:s.firmware)==null?void 0:a.no_one_click)??"One-click upgrade disabled")+"",i;return{c(){e=p("div"),l=p("div"),i=C(n),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(r,f){P(r,e,f),o(e,l),o(l,i)},p(r,f){var c,m;f&8&&n!==(n=(((m=(c=r[3].status)==null?void 0:c.firmware)==null?void 0:m.no_one_click)??"One-click upgrade disabled")+"")&&E(i,n)},d(r){r&&N(e)}}}function Xa(t){let e,l=bs(Je(t[1].chip,t[1].board))+"",n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,s){P(i,e,s),o(e,n)},p(i,s){s&2&&l!==(l=bs(Je(i[1].chip,i[1].board))+"")&&E(n,l)},d(i){i&&N(e)}}}function Za(t){let e,l,n,i,s,a;function r(m,_){return m[5].length==0?Lc:Oc}let f=r(t),c=f(t);return{c(){e=p("div"),l=p("form"),n=p("input"),i=v(),c.c(),nn(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,_){P(m,e,_),o(e,l),o(l,n),t[13](n),o(l,i),c.m(l,null),s||(a=[ce(n,"change",t[14]),ce(l,"submit",t[16])],s=!0)},p(m,_){f===(f=r(m))&&c?c.p(m,_):(c.d(1),c=f(m),c&&(c.c(),c.m(l,null)))},d(m){m&&N(e),t[13](null),c.d(),s=!1,Bt(a)}}}function Oc(t){var r;let e=t[5][0].name+"",l,n,i,s=(((r=t[3].btn)==null?void 0:r.upload)??"Upload")+"",a;return{c(){l=C(e),n=v(),i=p("button"),a=C(s),u(i,"type","submit"),u(i,"class","btn-pri-sm float-right ml-2")},m(f,c){P(f,l,c),P(f,n,c),P(f,i,c),o(i,a)},p(f,c){var m;c&32&&e!==(e=f[5][0].name+"")&&E(l,e),c&8&&s!==(s=(((m=f[3].btn)==null?void 0:m.upload)??"Upload")+"")&&E(a,s)},d(f){f&&(N(l),N(n),N(i))}}}function Lc(t){var a,r;let e,l=(((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.btn_select_file)??"Select file")+"",n,i,s;return{c(){e=p("button"),n=C(l),u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(f,c){P(f,e,c),o(e,n),i||(s=ce(e,"click",t[15]),i=!0)},p(f,c){var m,_;c&8&&l!==(l=(((_=(m=f[3].status)==null?void 0:m.firmware)==null?void 0:_.btn_select_file)??"Select file")+"")&&E(n,l)},d(f){f&&N(e),i=!1,s()}}}function Ja(t){var K,V,U,G,se,le;let e,l,n=(((V=(K=t[3].status)==null?void 0:K.backup)==null?void 0:V.title)??"Backup")+"",i,s,a,r,f,c,m,_,d=(((G=(U=t[3].status)==null?void 0:U.backup)==null?void 0:G.secrets)??"Include secrets")+"",h,b,g,w=(((le=(se=t[3].status)==null?void 0:se.backup)==null?void 0:le.secrets_desc)??"")+"",k,R,I,F,M,A,O,j,Y=rt(t[9]),z=[];for(let Q=0;Q{_e=null}),vt()),(mt=ve[0])!=null&&mt.a?de?(de.p(ve,Ee),Ee&1&&Z(de,1)):(de=Ua(ve),de.c(),Z(de,1),de.m(l,null)):de&&(ht(),ie(de,1,1,()=>{de=null}),vt()),ve[1].meter?x?x.p(ve,Ee):(x=Ba(ve),x.c(),x.m(e,y)):x&&(x.d(1),x=null),ve[1].net?he?he.p(ve,Ee):(he=ja(ve),he.c(),he.m(e,K)):he&&(he.d(1),he=null),(!te||Ee&8)&&G!==(G=(((Tt=(et=ve[3].status)==null?void 0:et.firmware)==null?void 0:Tt.title)??"Firmware")+"")&&E(se,G),(!te||Ee&8)&&ae!==(ae=(((kt=(zt=ve[3].status)==null?void 0:zt.firmware)==null?void 0:kt.installed)??"Installed")+"")&&E(re,ae),(!te||Ee&2)&&ne!==(ne=ve[1].version+"")&&E(pe,ne),ve[1].upgrade.t&&ve[1].upgrade.t!=ve[1].version&&ve[1].upgrade.e!=0&&ve[1].upgrade.e!=123?be?be.p(ve,Ee):(be=Va(ve),be.c(),be.m(V,J)):be&&(be.d(1),be=null),ve[1].upgrade.n?Ae?Ae.p(ve,Ee):(Ae=Ka(ve),Ae.c(),Ae.m(V,$)):Ae&&(Ae.d(1),Ae=null),Ee&3&&(ke=(ve[1].security==0||ve[0].a)&&Hn(ve[1].board)),ke?Te?Te.p(ve,Ee):(Te=Xa(ve),Te.c(),Te.m(V,Ce)):Te&&(Te.d(1),Te=null),ve[1].security==0||ve[0].a?Oe?Oe.p(ve,Ee):(Oe=Za(ve),Oe.c(),Oe.m(V,null)):Oe&&(Oe.d(1),Oe=null),ve[1].security==0||ve[0].a?Ie?Ie.p(ve,Ee):(Ie=Ja(ve),Ie.c(),Ie.m(e,null)):Ie&&(Ie.d(1),Ie=null);const me={};Ee&64&&(me.active=ve[6]),Ee&8&&(me.message=((yt=(_t=ve[3].status)==null?void 0:_t.mask)==null?void 0:yt.firmware)??"Uploading"),L.$set(me);const we={};Ee&256&&(we.active=ve[8]),Ee&8&&(we.message=((Ft=(Qt=ve[3].status)==null?void 0:Qt.mask)==null?void 0:Ft.config)??"Uploading"),W.$set(we)},i(ve){te||(Z(I.$$.fragment,ve),Z(_e),Z(de),Z(L.$$.fragment,ve),Z(W.$$.fragment,ve),te=!0)},o(ve){ie(I.$$.fragment,ve),ie(_e),ie(de),ie(L.$$.fragment,ve),ie(W.$$.fragment,ve),te=!1},d(ve){ve&&(N(e),N(S),N(q)),fe&&fe.d(),Ne(I),_e&&_e.d(),de&&de.d(),x&&x.d(),he&&he.d(),be&&be.d(),Ae&&Ae.d(),Te&&Te.d(),Oe&&Oe.d(),Ie&&Ie.d(),Ne(L,ve),Ne(W,ve)}}}async function Uc(){await(await fetch("reboot",{method:"POST"})).json()}function Bc(t,e,l){let{data:n}=e,{sysinfo:i}=e,s=[{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",key:"is"}],a={};gl.subscribe(j=>{l(3,a=j)});function r(){var j;confirm((((j=a.header)==null?void 0:j.upgrade)??"Upgrade to {0}?").replace("{0}",i.upgrade.n))&&(Pu(i.upgrade.n),cl.update(Y=>(Y.upgrade.t=i.upgrade.n,Y.upgrade.p=0,Y.upgrading=!0,Y)))}const f=function(){var j;confirm(((j=a.device)==null?void 0:j.reboot_confirm)??"Reboot?")&&(cl.update(Y=>(Y.booting=!0,Y)),Uc())};let c,m=[],_=!1,d,h=[],b=!1;ci();let g={hostname:"",ip:""};function w(j){l(8,b=!0);const Y=new FormData;Y.append("file",h[0]),fetch("configfile",{method:"POST",body:Y}).then(z=>z.json()).then(z=>{cl.update(T=>(g&&g.hostname&&(T.hostname=g.hostname),T.booting=z.reboot,g&&g.ip&&(T.net.ip=g.ip),setTimeout(Wn,5e3,i),T))}).catch(z=>{console.error("Error:",z),setTimeout(Wn,5e3,i)})}function k(j){ai[j?"unshift":"push"](()=>{c=j,l(4,c)})}function R(){m=this.files,l(5,m)}const I=()=>{c.click()},F=()=>l(6,_=!0);function M(j){ai[j?"unshift":"push"](()=>{d=j,l(7,d)})}function A(){h=this.files,l(2,h)}const O=()=>{d.click()};return t.$$set=j=>{"data"in j&&l(0,n=j.data),"sysinfo"in j&&l(1,i=j.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&4&&h.length==1){let j=h[0],Y=new FileReader,z=T=>{let B=T.target.result.split(` +`);for(let X in B){let y=B[X];y.startsWith("hostname ")?g.hostname=y.split(" ")[1]:y.startsWith("ip ")&&(g.ip=y.split(" ")[1])}};Y.onload=z,Y.readAsText(j)}},[n,i,h,a,c,m,_,d,b,s,r,f,w,k,R,I,F,M,A,O]}class jc extends Pt{constructor(e){super(),Nt(this,e,Bc,Fc,Mt,{data:0,sysinfo:1})}}function ef(t){let e,l,n=Je(t[0],7)+"",i,s,a=Je(t[0],5)+"",r,f,c=Je(t[0],4)+"",m,_,d=Je(t[0],3)+"",h,b,g,w,k=Je(t[0],2)+"",R,I,F=Je(t[0],1)+"",M,A,O=Je(t[0],0)+"",j,Y,z,T,B=Je(t[0],101)+"",X,y,K=Je(t[0],100)+"",V;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=p("option"),h=C(d),b=v(),g=p("optgroup"),w=p("option"),R=C(k),I=p("option"),M=C(F),A=p("option"),j=C(O),Y=v(),z=p("optgroup"),T=p("option"),X=C(B),y=p("option"),V=C(K),l.__value=7,H(l,l.__value),s.__value=5,H(s,s.__value),f.__value=4,H(f,f.__value),_.__value=3,H(_,_.__value),u(e,"label","amsleser.no"),w.__value=2,H(w,w.__value),I.__value=1,H(I,I.__value),A.__value=0,H(A,A.__value),u(g,"label","Custom hardware"),T.__value=101,H(T,T.__value),y.__value=100,H(y,y.__value),u(z,"label","Generic hardware")},m(U,G){P(U,e,G),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),o(e,_),o(_,h),P(U,b,G),P(U,g,G),o(g,w),o(w,R),o(g,I),o(I,M),o(g,A),o(A,j),P(U,Y,G),P(U,z,G),o(z,T),o(T,X),o(z,y),o(y,V)},p(U,G){G&1&&n!==(n=Je(U[0],7)+"")&&E(i,n),G&1&&a!==(a=Je(U[0],5)+"")&&E(r,a),G&1&&c!==(c=Je(U[0],4)+"")&&E(m,c),G&1&&d!==(d=Je(U[0],3)+"")&&E(h,d),G&1&&k!==(k=Je(U[0],2)+"")&&E(R,k),G&1&&F!==(F=Je(U[0],1)+"")&&E(M,F),G&1&&O!==(O=Je(U[0],0)+"")&&E(j,O),G&1&&B!==(B=Je(U[0],101)+"")&&E(X,B),G&1&&K!==(K=Je(U[0],100)+"")&&E(V,K)},d(U){U&&(N(e),N(b),N(g),N(Y),N(z))}}}function tf(t){let e,l,n=Je(t[0],201)+"",i,s,a=Je(t[0],202)+"",r,f,c=Je(t[0],203)+"",m,_,d=Je(t[0],241)+"",h,b,g=Je(t[0],242)+"",w,k,R=Je(t[0],243)+"",I,F,M=Je(t[0],245)+"",A,O,j=Je(t[0],200)+"",Y;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=p("option"),h=C(d),b=p("option"),w=C(g),k=p("option"),I=C(R),F=p("option"),A=C(M),O=p("option"),Y=C(j),l.__value=201,H(l,l.__value),s.__value=202,H(s,s.__value),f.__value=203,H(f,f.__value),_.__value=241,H(_,_.__value),b.__value=242,H(b,b.__value),k.__value=243,H(k,k.__value),F.__value=245,H(F,F.__value),O.__value=200,H(O,O.__value),u(e,"label","Generic hardware")},m(z,T){P(z,e,T),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),o(e,_),o(_,h),o(e,b),o(b,w),o(e,k),o(k,I),o(e,F),o(F,A),o(e,O),o(O,Y)},p(z,T){T&1&&n!==(n=Je(z[0],201)+"")&&E(i,n),T&1&&a!==(a=Je(z[0],202)+"")&&E(r,a),T&1&&c!==(c=Je(z[0],203)+"")&&E(m,c),T&1&&d!==(d=Je(z[0],241)+"")&&E(h,d),T&1&&g!==(g=Je(z[0],242)+"")&&E(w,g),T&1&&R!==(R=Je(z[0],243)+"")&&E(I,R),T&1&&M!==(M=Je(z[0],245)+"")&&E(A,M),T&1&&j!==(j=Je(z[0],200)+"")&&E(Y,j)},d(z){z&&N(e)}}}function lf(t){let e,l,n=Je(t[0],7)+"",i,s,a=Je(t[0],6)+"",r,f,c=Je(t[0],5)+"",m,_,d,h,b=Je(t[0],51)+"",g,w,k=Je(t[0],50)+"",R;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=v(),d=p("optgroup"),h=p("option"),g=C(b),w=p("option"),R=C(k),l.__value=7,H(l,l.__value),s.__value=6,H(s,s.__value),f.__value=5,H(f,f.__value),u(e,"label","amsleser.no"),h.__value=51,H(h,h.__value),w.__value=50,H(w,w.__value),u(d,"label","Generic hardware")},m(I,F){P(I,e,F),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),P(I,_,F),P(I,d,F),o(d,h),o(h,g),o(d,w),o(w,R)},p(I,F){F&1&&n!==(n=Je(I[0],7)+"")&&E(i,n),F&1&&a!==(a=Je(I[0],6)+"")&&E(r,a),F&1&&c!==(c=Je(I[0],5)+"")&&E(m,c),F&1&&b!==(b=Je(I[0],51)+"")&&E(g,b),F&1&&k!==(k=Je(I[0],50)+"")&&E(R,k)},d(I){I&&(N(e),N(_),N(d))}}}function nf(t){let e,l,n=Je(t[0],8)+"",i,s,a,r,f=Je(t[0],71)+"",c,m,_=Je(t[0],70)+"",d;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=v(),a=p("optgroup"),r=p("option"),c=C(f),m=p("option"),d=C(_),l.__value=8,H(l,l.__value),u(e,"label","Custom hardware"),r.__value=71,H(r,r.__value),m.__value=70,H(m,m.__value),u(a,"label","Generic hardware")},m(h,b){P(h,e,b),o(e,l),o(l,i),P(h,s,b),P(h,a,b),o(a,r),o(r,c),o(a,m),o(m,d)},p(h,b){b&1&&n!==(n=Je(h[0],8)+"")&&E(i,n),b&1&&f!==(f=Je(h[0],71)+"")&&E(c,f),b&1&&_!==(_=Je(h[0],70)+"")&&E(d,_)},d(h){h&&(N(e),N(s),N(a))}}}function sf(t){let e,l,n=Je(t[0],200)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=200,H(l,l.__value),u(e,"label","Generic hardware")},m(s,a){P(s,e,a),o(e,l),o(l,i)},p(s,a){a&1&&n!==(n=Je(s[0],200)+"")&&E(i,n)},d(s){s&&N(e)}}}function of(t){let e,l,n=Je(t[0],80)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=80,H(l,l.__value),u(e,"label","Generic hardware")},m(s,a){P(s,e,a),o(e,l),o(l,i)},p(s,a){a&1&&n!==(n=Je(s[0],80)+"")&&E(i,n)},d(s){s&&N(e)}}}function Hc(t){let e,l,n,i,s,a,r,f,c=t[0]=="esp8266"&&ef(t),m=t[0]=="esp32"&&tf(t),_=t[0]=="esp32s2"&&lf(t),d=t[0]=="esp32c3"&&nf(t),h=t[0]=="esp32solo"&&sf(t),b=t[0]=="esp32s3"&&of(t);return{c(){e=p("option"),l=v(),c&&c.c(),n=v(),m&&m.c(),i=v(),_&&_.c(),s=v(),d&&d.c(),a=v(),h&&h.c(),r=v(),b&&b.c(),f=Ht(),e.__value=-1,H(e,e.__value)},m(g,w){P(g,e,w),P(g,l,w),c&&c.m(g,w),P(g,n,w),m&&m.m(g,w),P(g,i,w),_&&_.m(g,w),P(g,s,w),d&&d.m(g,w),P(g,a,w),h&&h.m(g,w),P(g,r,w),b&&b.m(g,w),P(g,f,w)},p(g,[w]){g[0]=="esp8266"?c?c.p(g,w):(c=ef(g),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),g[0]=="esp32"?m?m.p(g,w):(m=tf(g),m.c(),m.m(i.parentNode,i)):m&&(m.d(1),m=null),g[0]=="esp32s2"?_?_.p(g,w):(_=lf(g),_.c(),_.m(s.parentNode,s)):_&&(_.d(1),_=null),g[0]=="esp32c3"?d?d.p(g,w):(d=nf(g),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null),g[0]=="esp32solo"?h?h.p(g,w):(h=sf(g),h.c(),h.m(r.parentNode,r)):h&&(h.d(1),h=null),g[0]=="esp32s3"?b?b.p(g,w):(b=of(g),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i:Ye,o:Ye,d(g){g&&(N(e),N(l),N(n),N(i),N(s),N(a),N(r),N(f)),c&&c.d(g),m&&m.d(g),_&&_.d(g),d&&d.d(g),h&&h.d(g),b&&b.d(g)}}}function yc(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class zc extends Pt{constructor(e){super(),Nt(this,e,yc,Hc,Mt,{chip:0})}}function af(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){P(l,e,n)},d(l){l&&N(e)}}}function ff(t){let e,l,n,i,s,a,r;return a=new Bi({props:{chip:t[0].chip}}),{c(){e=p("div"),l=C("HAN GPIO"),n=p("br"),i=v(),s=p("select"),Pe(a.$$.fragment),u(s,"name","vh"),u(s,"class","in-s"),u(e,"class","my-3")},m(f,c){P(f,e,c),o(e,l),o(e,n),o(e,i),o(e,s),Me(a,s,null),r=!0},p(f,c){const m={};c&1&&(m.chip=f[0].chip),a.$set(m)},i(f){r||(Z(a.$$.fragment,f),r=!0)},o(f){ie(a.$$.fragment,f),r=!1},d(f){f&&N(e),Ne(a)}}}function Wc(t){let e,l,n,i,s,a,r,f,c,m,_,d,h,b,g,w,k,R,I,F,M,A,O,j,Y,z,T,B,X,y=t[0].usrcfg&&af();b=new zc({props:{chip:t[0].chip}});let K=t[0].board&&t[0].board>20&&ff(t);return z=new rl({props:{active:t[1],message:"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),s=v(),a=p("strong"),a.textContent="Initial configuration",r=v(),y&&y.c(),f=v(),c=p("div"),m=C("Board type"),_=p("br"),d=v(),h=p("select"),Pe(b.$$.fragment),g=v(),K&&K.c(),w=v(),k=p("div"),R=p("label"),I=p("input"),F=C(" Clear all other configuration"),M=v(),A=p("div"),A.innerHTML='',O=v(),j=p("span"),j.textContent=" ",Y=v(),Pe(z.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(a,"class","text-sm"),u(h,"name","vb"),u(h,"class","in-s"),t[0].board===void 0&&Dt(()=>t[5].call(h)),u(c,"class","my-3"),u(I,"type","checkbox"),u(I,"name","vr"),I.__value="true",H(I,I.__value),u(I,"class","rounded mb-1"),u(k,"class","my-3"),u(A,"class","my-3"),u(j,"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(V,U){P(V,e,U),o(e,l),o(l,n),o(n,i),o(n,s),o(n,a),o(n,r),y&&y.m(n,null),o(n,f),o(n,c),o(c,m),o(c,_),o(c,d),o(c,h),Me(b,h,null),Ke(h,t[0].board,!0),o(n,g),K&&K.m(n,null),o(n,w),o(n,k),o(k,R),o(R,I),I.checked=t[2],o(R,F),o(n,M),o(n,A),o(n,O),o(n,j),P(V,Y,U),Me(z,V,U),T=!0,B||(X=[ce(h,"change",t[5]),ce(I,"change",t[6]),ce(n,"submit",pn(t[3]))],B=!0)},p(V,[U]){V[0].usrcfg?y||(y=af(),y.c(),y.m(n,f)):y&&(y.d(1),y=null);const G={};U&1&&(G.chip=V[0].chip),b.$set(G),U&1&&Ke(h,V[0].board),V[0].board&&V[0].board>20?K?(K.p(V,U),U&1&&Z(K,1)):(K=ff(V),K.c(),Z(K,1),K.m(n,w)):K&&(ht(),ie(K,1,1,()=>{K=null}),vt()),U&4&&(I.checked=V[2]);const se={};U&2&&(se.active=V[1]),z.$set(se)},i(V){T||(Z(b.$$.fragment,V),Z(K),Z(z.$$.fragment,V),T=!0)},o(V){ie(b.$$.fragment,V),ie(K),ie(z.$$.fragment,V),T=!1},d(V){V&&(N(e),N(Y)),y&&y.d(),Ne(b),K&&K.d(),Ne(z,V),B=!1,Bt(X)}}}function Gc(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,s=!1;async function a(m){l(1,s=!0);const _=new FormData(m.target),d=new URLSearchParams;for(let g of _){const[w,k]=g;d.append(w,k)}let b=await(await fetch("save",{method:"POST",body:d})).json();l(1,s=!1),cl.update(g=>(g.vndcfg=b.success,g.booting=b.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),sn(n+(i.usrcfg?"":"setup"))}let r=!0;cl.subscribe(m=>{l(0,i=m),m.fwconsent===1&&l(2,r=!i.usrcfg)});function f(){i.board=Gt(this),l(0,i)}function c(){r=this.checked,l(2,r)}return t.$$set=m=>{"basepath"in m&&l(4,n=m.basepath),"sysinfo"in m&&l(0,i=m.sysinfo)},[i,s,r,a,n,f,c]}class Vc extends Pt{constructor(e){super(),Nt(this,e,Gc,Wc,Mt,{basepath:4,sysinfo:0})}}function uf(t,e,l){const n=t.slice();return n[13]=e[l],n}function rf(t){var i,s;let e,l=(((s=(i=t[1].conf)==null?void 0:i.connection)==null?void 0:s.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=C(l),e.__value=3,H(e,e.__value)},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r&2&&l!==(l=(((c=(f=a[1].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&E(n,l)},d(a){a&&N(e)}}}function cf(t){var j,Y,z,T;let e,l=(((Y=(j=t[1].conf)==null?void 0:j.connection)==null?void 0:Y.ssid)??"SSID")+"",n,i,s,a,r,f,c,m,_,d,h=(((T=(z=t[1].conf)==null?void 0:z.connection)==null?void 0:T.psk)??"Password")+"",b,g,w,k,R,I,F;function M(B,X){return B[2]?Yc:Kc}let A=M(t),O=A(t);return{c(){e=p("div"),n=C(l),i=v(),s=p("label"),a=p("input"),r=C(" manual"),f=v(),c=p("br"),m=v(),O.c(),_=v(),d=p("div"),b=C(h),g=p("br"),w=v(),k=p("input"),u(a,"type","checkbox"),a.__value="true",H(a,a.__value),u(a,"class","rounded mb-1"),u(s,"class","float-right mr-3"),u(e,"class","my-3"),u(k,"name","sp"),u(k,"type","password"),u(k,"pattern",Mn),u(k,"class","in-s"),u(k,"autocomplete","off"),k.required=R=t[5]==2,u(d,"class","my-3")},m(B,X){P(B,e,X),o(e,n),o(e,i),o(e,s),o(s,a),a.checked=t[2],o(s,r),o(e,f),o(e,c),o(e,m),O.m(e,null),P(B,_,X),P(B,d,X),o(d,b),o(d,g),o(d,w),o(d,k),I||(F=ce(a,"change",t[9]),I=!0)},p(B,X){var y,K,V,U;X&2&&l!==(l=(((K=(y=B[1].conf)==null?void 0:y.connection)==null?void 0:K.ssid)??"SSID")+"")&&E(n,l),X&4&&(a.checked=B[2]),A===(A=M(B))&&O?O.p(B,X):(O.d(1),O=A(B),O&&(O.c(),O.m(e,null))),X&2&&h!==(h=(((U=(V=B[1].conf)==null?void 0:V.connection)==null?void 0:U.psk)??"Password")+"")&&E(b,h),X&32&&R!==(R=B[5]==2)&&(k.required=R)},d(B){B&&(N(e),N(_),N(d)),O.d(),I=!1,F()}}}function Kc(t){var a,r;let e,l,n,i=((a=t[3])==null?void 0:a.c)==-1&&_f(),s=((r=t[3])==null?void 0:r.n)&&mf(t);return{c(){e=p("select"),i&&i.c(),l=Ht(),s&&s.c(),u(e,"name","ss"),u(e,"class","in-s"),e.required=n=t[5]==1||t[5]==2},m(f,c){P(f,e,c),i&&i.m(e,null),o(e,l),s&&s.m(e,null)},p(f,c){var m,_;((m=f[3])==null?void 0:m.c)==-1?i||(i=_f(),i.c(),i.m(e,l)):i&&(i.d(1),i=null),(_=f[3])!=null&&_.n?s?s.p(f,c):(s=mf(f),s.c(),s.m(e,null)):s&&(s.d(1),s=null),c&32&&n!==(n=f[5]==1||f[5]==2)&&(e.required=n)},d(f){f&&N(e),i&&i.d(),s&&s.d()}}}function Yc(t){let e,l;return{c(){e=p("input"),u(e,"name","ss"),u(e,"type","text"),u(e,"pattern",Mn),u(e,"class","in-s"),e.required=l=t[5]==1||t[5]==2},m(n,i){P(n,e,i)},p(n,i){i&32&&l!==(l=n[5]==1||n[5]==2)&&(e.required=l)},d(n){n&&N(e)}}}function _f(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",H(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function mf(t){var i;let e,l=rt((i=t[3])==null?void 0:i.n),n=[];for(let s=0;st[8].call(g)),u(m,"class","my-3"),u(B,"name","sh"),u(B,"type","text"),u(B,"class","in-s"),u(B,"maxlength","32"),u(B,"pattern",Vn),u(B,"placeholder","Optional, ex.: ams-reader"),u(B,"autocomplete","off"),u(V,"type","checkbox"),u(V,"name","sm"),V.__value="static",H(V,V.__value),u(V,"class","rounded mb-1"),u(y,"class","my-3"),u(ue,"type","submit"),u(ue,"class","btn-pri"),u(re,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(De,Ue){P(De,e,Ue),o(e,l),o(l,n),o(n,i),o(n,s),o(n,a),o(a,f),o(n,c),o(n,m),o(m,d),o(m,h),o(m,b),o(m,g),o(g,w),o(w,R),o(g,I),o(I,M),D&&D.m(g,null),Ke(g,t[5],!0),o(n,A),S&&S.m(n,null),o(n,O),o(n,j),o(j,z),o(j,T),o(j,B),H(B,t[0].hostname),o(n,X),o(n,y),o(y,K),o(K,V),V.checked=t[4],o(K,U),o(K,se),o(y,le),L&&L.m(y,null),o(n,Q),q&&q.m(n,null),o(n,ae),o(n,re),o(re,ue),o(ue,pe),P(De,oe,Ue),Me(J,De,Ue),$=!0,ke||(Ce=[ce(g,"change",t[8]),ce(B,"input",t[10]),ce(V,"change",t[11]),ce(n,"submit",pn(t[7]))],ke=!0)},p(De,[Ue]){var wt,tt,ot,St,dt,at,it,ft,Ot,We,Re,He;(!$||Ue&2)&&r!==(r=(((wt=De[1].setup)==null?void 0:wt.title)??"Setup")+"")&&E(f,r),(!$||Ue&2)&&_!==(_=(((ot=(tt=De[1].conf)==null?void 0:tt.connection)==null?void 0:ot.title)??"Connection")+"")&&E(d,_),(!$||Ue&2)&&k!==(k=(((dt=(St=De[1].conf)==null?void 0:St.connection)==null?void 0:dt.wifi)??"Connect to WiFi")+"")&&E(R,k),(!$||Ue&2)&&F!==(F=(((it=(at=De[1].conf)==null?void 0:at.connection)==null?void 0:it.ap)??"Standalone access point")+"")&&E(M,F),De[0].if&&De[0].if.eth?D?D.p(De,Ue):(D=rf(De),D.c(),D.m(g,null)):D&&(D.d(1),D=null),Ue&32&&Ke(g,De[5]),De[5]==1||De[5]==2?S?S.p(De,Ue):(S=cf(De),S.c(),S.m(n,O)):S&&(S.d(1),S=null),(!$||Ue&2)&&Y!==(Y=(((Ot=(ft=De[1].conf)==null?void 0:ft.general)==null?void 0:Ot.hostname)??"Hostname")+"")&&E(z,Y),Ue&1&&B.value!==De[0].hostname&&H(B,De[0].hostname),Ue&16&&(V.checked=De[4]),(!$||Ue&2)&&G!==(G=(((We=De[1].setup)==null?void 0:We.static)??"Static IP")+"")&&E(se,G),De[4]?L?(L.p(De,Ue),Ue&16&&Z(L,1)):(L=df(De),L.c(),Z(L,1),L.m(y,null)):L&&(ht(),ie(L,1,1,()=>{L=null}),vt()),De[4]?q?q.p(De,Ue):(q=hf(De),q.c(),q.m(n,ae)):q&&(q.d(1),q=null),(!$||Ue&2)&&ne!==(ne=(((Re=De[1].btn)==null?void 0:Re.save)??"Save")+"")&&E(pe,ne);const xe={};Ue&64&&(xe.active=De[6]),Ue&2&&(xe.message=((He=De[1].setup)==null?void 0:He.mask)??"Saving"),J.$set(xe)},i(De){$||(Z(L),Z(J.$$.fragment,De),$=!0)},o(De){ie(L),ie(J.$$.fragment,De),$=!1},d(De){De&&(N(e),N(oe)),D&&D.d(),S&&S.d(),L&&L.d(),q&&q.d(),Ne(J,De),ke=!1,Bt(Ce)}}}function Xc(t,e,l){let n={};gl.subscribe(w=>{l(1,n=w)});let i=!1,s={};$i.subscribe(w=>{l(3,s=w)});let{sysinfo:a={}}=e,r=!1,f=1,c=!1;function m(w){cl.update(k=>(k.trying=w,k))}async function _(w){l(6,c=!0);const k=new FormData(w.target),R=new URLSearchParams;for(let M of k){const[A,O]=M;R.append(A,O)}let F=await(await fetch("save",{method:"POST",body:R})).json();l(6,c=!1),cl.update(M=>(M.hostname=k.get("sh"),M.usrcfg=F.success,M.booting=F.reboot,r&&(M.net.ip=k.get("si"),M.net.mask=k.get("su"),M.net.gw=k.get("sg"),M.net.dns1=k.get("sd")),F.reboot&&setTimeout(Wn,5e3,a,m),M))}function d(){f=Gt(this),l(5,f)}function h(){i=this.checked,l(2,i)}function b(){a.hostname=this.value,l(0,a)}function g(){r=this.checked,l(4,r)}return t.$$set=w=>{"sysinfo"in w&&l(0,a=w.sysinfo)},[a,n,i,s,r,f,c,_,d,h,b,g]}class Zc extends Pt{constructor(e){super(),Nt(this,e,Xc,Qc,Mt,{sysinfo:0})}}function Jc(t){var z,T,B,X;let e,l,n,i=(((z=t[2].upload)==null?void 0:z.title)??"Upload")+"",s,a,r,f,c,m=(((T=t[2].upload)==null?void 0:T.desc)??"")+"",_,d,h,b,g,w,k,R,I=(((B=t[2].btn)==null?void 0:B.upload)??"Upload")+"",F,M,A,O,j,Y;return A=new rl({props:{active:t[3],message:((X=t[2].upload)==null?void 0:X.mask)??"Uploading"}}),{c(){e=p("div"),l=p("div"),n=p("strong"),s=C(i),a=v(),r=C(t[1]),f=v(),c=p("p"),_=C(m),d=v(),h=p("form"),b=p("input"),g=v(),w=p("div"),k=p("button"),R=p("p"),F=C(I),M=v(),Pe(A.$$.fragment),u(c,"class","mb-4"),u(b,"name","file"),u(b,"type","file"),u(R,"class","mb-4"),u(k,"type","submit"),u(k,"class","btn-pri"),u(w,"class","w-full text-right mt-4"),u(h,"action",t[0]),u(h,"enctype","multipart/form-data"),u(h,"method","post"),u(h,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(y,K){P(y,e,K),o(e,l),o(l,n),o(n,s),o(n,a),o(n,r),o(l,f),o(l,c),o(c,_),o(l,d),o(l,h),o(h,b),o(h,g),o(h,w),o(w,k),o(k,R),o(R,F),P(y,M,K),Me(A,y,K),O=!0,j||(Y=ce(h,"submit",t[4]),j=!0)},p(y,[K]){var U,G,se,le;(!O||K&4)&&i!==(i=(((U=y[2].upload)==null?void 0:U.title)??"Upload")+"")&&E(s,i),(!O||K&2)&&E(r,y[1]),(!O||K&4)&&m!==(m=(((G=y[2].upload)==null?void 0:G.desc)??"")+"")&&E(_,m),(!O||K&4)&&I!==(I=(((se=y[2].btn)==null?void 0:se.upload)??"Upload")+"")&&E(F,I),(!O||K&1)&&u(h,"action",y[0]);const V={};K&8&&(V.active=y[3]),K&4&&(V.message=((le=y[2].upload)==null?void 0:le.mask)??"Uploading"),A.$set(V)},i(y){O||(Z(A.$$.fragment,y),O=!0)},o(y){ie(A.$$.fragment,y),O=!1},d(y){y&&(N(e),N(M)),Ne(A,y),j=!1,Y()}}}function $c(t,e,l){let{action:n}=e,{title:i}=e,s={};gl.subscribe(f=>{l(2,s=f)});let a=!1;const r=()=>l(3,a=!0);return t.$$set=f=>{"action"in f&&l(0,n=f.action),"title"in f&&l(1,i=f.title)},[n,i,s,a,r]}class ls extends Pt{constructor(e){super(),Nt(this,e,$c,Jc,Mt,{action:0,title:1})}}function xc(t){var J,$,ke,Ce,D,S,L;let e,l,n,i,s=(((J=t[1].consent)==null?void 0:J.title)??"Consents")+"",a,r,f,c,m,_=((($=t[1].consent)==null?void 0:$.one_click)??"One-click")+"",d,h,b,g,w=(((ke=t[1].consent)==null?void 0:ke.read_more)??"Read more")+"",k,R,I,F,M,A,O,j=(((Ce=t[1].consent)==null?void 0:Ce.yes)??"Yes")+"",Y,z,T,B,X,y,K=(((D=t[1].consent)==null?void 0:D.no)??"No")+"",V,U,G,se,le,Q=(((S=t[1].btn)==null?void 0:S.save)??"Save")+"",ae,re,ue,ne,pe,oe;return ue=new rl({props:{active:t[2],message:((L=t[1].consent)==null?void 0:L.mask_saving)??"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("div"),a=C(s),r=v(),f=p("hr"),c=v(),m=p("div"),d=C(_),h=p("br"),b=v(),g=p("a"),k=C(w),R=p("br"),I=v(),F=p("label"),M=p("input"),O=v(),Y=C(j),z=v(),T=p("label"),B=p("input"),y=v(),V=C(K),U=p("br"),G=v(),se=p("div"),le=p("button"),ae=C(Q),re=v(),Pe(ue.$$.fragment),u(g,"href",_l("Data-collection-on-one-click-firmware-upgrade")),u(g,"target","_blank"),u(g,"class","text-blue-600 hover:text-blue-800"),u(M,"type","radio"),u(M,"name","sf"),M.value=1,M.checked=A=t[0].fwconsent===1,u(M,"class","rounded m-2"),M.required=!0,u(B,"type","radio"),u(B,"name","sf"),B.value=2,B.checked=X=t[0].fwconsent===2,u(B,"class","rounded m-2"),B.required=!0,u(m,"class","my-3"),u(le,"type","submit"),u(le,"class","btn-pri"),u(se,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(q,W){P(q,e,W),o(e,l),o(l,n),o(n,i),o(i,a),o(n,r),o(n,f),o(n,c),o(n,m),o(m,d),o(m,h),o(m,b),o(m,g),o(g,k),o(m,R),o(m,I),o(m,F),o(F,M),o(F,O),o(F,Y),o(m,z),o(m,T),o(T,B),o(T,y),o(T,V),o(m,U),o(n,G),o(n,se),o(se,le),o(le,ae),P(q,re,W),Me(ue,q,W),ne=!0,pe||(oe=ce(n,"submit",pn(t[3])),pe=!0)},p(q,[W]){var fe,_e,de,x,he,be,Ae;(!ne||W&2)&&s!==(s=(((fe=q[1].consent)==null?void 0:fe.title)??"Consents")+"")&&E(a,s),(!ne||W&2)&&_!==(_=(((_e=q[1].consent)==null?void 0:_e.one_click)??"One-click")+"")&&E(d,_),(!ne||W&2)&&w!==(w=(((de=q[1].consent)==null?void 0:de.read_more)??"Read more")+"")&&E(k,w),(!ne||W&1&&A!==(A=q[0].fwconsent===1))&&(M.checked=A),(!ne||W&2)&&j!==(j=(((x=q[1].consent)==null?void 0:x.yes)??"Yes")+"")&&E(Y,j),(!ne||W&1&&X!==(X=q[0].fwconsent===2))&&(B.checked=X),(!ne||W&2)&&K!==(K=(((he=q[1].consent)==null?void 0:he.no)??"No")+"")&&E(V,K),(!ne||W&2)&&Q!==(Q=(((be=q[1].btn)==null?void 0:be.save)??"Save")+"")&&E(ae,Q);const te={};W&4&&(te.active=q[2]),W&2&&(te.message=((Ae=q[1].consent)==null?void 0:Ae.mask_saving)??"Saving"),ue.$set(te)},i(q){ne||(Z(ue.$$.fragment,q),ne=!0)},o(q){ie(ue.$$.fragment,q),ne=!1},d(q){q&&(N(e),N(re)),Ne(ue,q),pe=!1,oe()}}}function e_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,s={};gl.subscribe(f=>{l(1,s=f)});let a=!1;async function r(f){l(2,a=!0);const c=new FormData(f.target),m=new URLSearchParams;for(let h of c){const[b,g]=h;m.append(b,g)}let d=await(await fetch("save",{method:"POST",body:m})).json();l(2,a=!1),cl.update(h=>(h.fwconsent=c.sf===!0?1:c.sf===!1?2:0,h.booting=d.reboot,h)),sn(n)}return t.$$set=f=>{"basepath"in f&&l(4,n=f.basepath),"sysinfo"in f&&l(0,i=f.sysinfo)},[i,s,a,r,n]}class t_ extends Pt{constructor(e){super(),Nt(this,e,e_,xc,Mt,{basepath:4,sysinfo:0})}}function vf(t,e,l){const n=t.slice();return n[30]=e[l],n[31]=e,n[32]=l,n}function bf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function l_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function gf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function n_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function kf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function wf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Cf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Sf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Mf(t){let e,l=rt(t[1].o),n=[];for(let i=0;i0?"text-green-600":"text-gray-300"),u(xe,"class",tt=t[32]{l(0,i=U)});let s=["mo","tu","we","th","fr","sa","su"],a={},r=!0,f=!1;Du.subscribe(U=>{U.o&&(l(1,a=U),l(2,r=!1))}),y0();async function c(U){l(3,f=!0);const G=new URLSearchParams;G.append("r","true"),G.append("rc",a.o.length),a.o.forEach(function(le,Q){G.append("rt"+Q,le.t),G.append("rn"+Q,le.n),G.append("rd"+Q,le.d),G.append("ra"+Q,le.a),G.append("rh"+Q,le.h),G.append("rv"+Q,le.v),G.append("rsm"+Q,le.s.m),G.append("rsd"+Q,le.s.d),G.append("rem"+Q,le.e.m),G.append("red"+Q,le.e.d)}),await(await fetch("save",{method:"POST",body:G})).json(),l(3,f=!1),sn(n+"configuration")}let m=function(U,G){return U.includes(G)?U=U.filter(function(se){return se!==G}):U.push(G),U},_=function(){let U=a.o;U.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),l(1,a.o=U,a)},d=function(U){let G=a.o;G.splice(U,1),l(1,a.o=G,a)},h=function(U){if(U<=0)return;let G=a.o;var se=G[U];G[U]=G[U-1],G[U-1]=se,l(1,a.o=G,a)},b=function(U){let G=a.o;if(!(U>=G.length-1)){var se=G[U];G[U]=G[U+1],G[U+1]=se,l(1,a.o=G,a)}};function g(U,G){U[G].n=this.value,l(1,a)}function w(U,G){U[G].d=Gt(this),l(1,a)}function k(U,G){U[G].t=Gt(this),l(1,a)}function R(U,G){U[G].v=ye(this.value),l(1,a)}const I=(U,G,se,le)=>l(1,se[le].a=m(U.a,G),a),F=(U,G,se,le)=>l(1,se[le].h=m(U.h,G),a),M=(U,G,se,le)=>l(1,se[le].h=m(U.h,G+8),a),A=(U,G,se,le)=>l(1,se[le].h=m(U.h,G+16),a);function O(U,G){U[G].s.d=Gt(this),l(1,a)}function j(U,G){U[G].s.m=Gt(this),l(1,a)}function Y(U,G){U[G].e.d=Gt(this),l(1,a)}function z(U,G){U[G].e.m=Gt(this),l(1,a)}const T=U=>h(U),B=U=>h(U),X=U=>b(U),y=U=>b(U),K=U=>d(U),V=U=>d(U);return t.$$set=U=>{"basepath"in U&&l(11,n=U.basepath)},[i,a,r,f,s,c,m,_,d,h,b,n,g,w,k,R,I,F,M,A,O,j,Y,z,T,B,X,y,K,V]}class f_ extends Pt{constructor(e){super(),Nt(this,e,a_,o_,Mt,{basepath:11},null,[-1,-1])}}function Of(t,e,l){const n=t.slice();return n[13]=e[l],n[14]=e,n[15]=l,n}function Lf(t,e,l){const n=t.slice();return n[13]=e[l],n[16]=e,n[17]=l,n}function If(t){let e,l,n,i=rt(t[1]),s=[];for(let a=0;a{l(3,r=w)});let f=!1,c,m;async function _(){if(confirm("Clear all data?"))for(let w in i)(w.startsWith("i")||w.startsWith("e"))&&l(0,i[w]=0,i)}let d=!1;async function h(w){l(5,d=!0);const k=new FormData(w.target),R=new URLSearchParams;for(let F of k){const[M,A]=F;R.append(M,A)}await(await fetch(s,{method:"POST",body:R})).json(),l(5,d=!1),sn(a)}function b(w){i[w.key]=ye(this.value),l(0,i)}function g(w){i[w.key]=ye(this.value),l(0,i)}return t.$$set=w=>{"prefix"in w&&l(8,n=w.prefix),"data"in w&&l(0,i=w.data),"url"in w&&l(9,s=w.url),"basepath"in w&&l(10,a=w.basepath)},t.$$.update=()=>{if(t.$$.dirty&263){l(1,c=[]),l(2,m=[]);for(let w in i){let k=[];w.startsWith("i")?k=c:w.startsWith("e")&&(k=m,i[w]&&l(4,f=!0)),k.push({key:w,name:n+" "+w.substring(1),value:i[w]})}}},[i,c,m,r,f,d,_,h,n,s,a,b,g]}class Lu extends Pt{constructor(e){super(),Nt(this,e,r_,u_,Mt,{prefix:8,data:0,url:9,basepath:10})}}function c_(t){let e,l;return e=new j0({props:{data:t[6],sysinfo:t[7],prices:t[1],dayPlot:t[2],monthPlot:t[3],temperatures:t[4],translations:t[5],tariffData:t[8]}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.data=n[6]),i&128&&(s.sysinfo=n[7]),i&2&&(s.prices=n[1]),i&4&&(s.dayPlot=n[2]),i&8&&(s.monthPlot=n[3]),i&16&&(s.temperatures=n[4]),i&32&&(s.translations=n[5]),i&256&&(s.tariffData=n[8]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function __(t){let e,l;return e=new Tc({props:{sysinfo:t[7],basepath:t[0],data:t[6]}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&1&&(s.basepath=n[0]),i&64&&(s.data=n[6]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function m_(t){let e,l;return e=new f_({props:{basepath:t[0]}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function p_(t){let e,l;return e=new jc({props:{sysinfo:t[7],data:t[6]}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&64&&(s.data=n[6]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function d_(t){let e,l;return e=new ls({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function h_(t){let e,l;return e=new ls({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function v_(t){let e,l;return e=new ls({props:{title:"private key",action:"/mqtt-key"}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function b_(t){let e,l;return e=new t_({props:{sysinfo:t[7],basepath:t[0]}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function g_(t){let e,l;return e=new Zc({props:{sysinfo:t[7]}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function k_(t){let e,l;return e=new Vc({props:{sysinfo:t[7],basepath:t[0]}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function w_(t){let e,l;return e=new Lu({props:{prefix:"UTC Hour",data:t[2],url:"/dayplot",basepath:t[0]}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&4&&(s.data=n[2]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function C_(t){let e,l;return e=new Lu({props:{prefix:"Day",data:t[3],url:"/monthplot",basepath:t[0]}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&8&&(s.data=n[3]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function S_(t){let e,l,n,i,s,a,r,f,c,m,_,d,h,b,g,w,k,R,I,F,M,A,O,j,Y,z;return e=new z1({props:{data:t[6],basepath:t[0]}}),n=new hl({props:{path:"/",$$slots:{default:[c_]},$$scope:{ctx:t}}}),s=new hl({props:{path:"/configuration",$$slots:{default:[__]},$$scope:{ctx:t}}}),r=new hl({props:{path:"/priceconfig",$$slots:{default:[m_]},$$scope:{ctx:t}}}),c=new hl({props:{path:"/status",$$slots:{default:[p_]},$$scope:{ctx:t}}}),_=new hl({props:{path:"/mqtt-ca",$$slots:{default:[d_]},$$scope:{ctx:t}}}),h=new hl({props:{path:"/mqtt-cert",$$slots:{default:[h_]},$$scope:{ctx:t}}}),g=new hl({props:{path:"/mqtt-key",$$slots:{default:[v_]},$$scope:{ctx:t}}}),k=new hl({props:{path:"/consent",$$slots:{default:[b_]},$$scope:{ctx:t}}}),I=new hl({props:{path:"/setup",$$slots:{default:[g_]},$$scope:{ctx:t}}}),M=new hl({props:{path:"/vendor",$$slots:{default:[k_]},$$scope:{ctx:t}}}),O=new hl({props:{path:"/edit-day",$$slots:{default:[w_]},$$scope:{ctx:t}}}),Y=new hl({props:{path:"/edit-month",$$slots:{default:[C_]},$$scope:{ctx:t}}}),{c(){Pe(e.$$.fragment),l=v(),Pe(n.$$.fragment),i=v(),Pe(s.$$.fragment),a=v(),Pe(r.$$.fragment),f=v(),Pe(c.$$.fragment),m=v(),Pe(_.$$.fragment),d=v(),Pe(h.$$.fragment),b=v(),Pe(g.$$.fragment),w=v(),Pe(k.$$.fragment),R=v(),Pe(I.$$.fragment),F=v(),Pe(M.$$.fragment),A=v(),Pe(O.$$.fragment),j=v(),Pe(Y.$$.fragment)},m(T,B){Me(e,T,B),P(T,l,B),Me(n,T,B),P(T,i,B),Me(s,T,B),P(T,a,B),Me(r,T,B),P(T,f,B),Me(c,T,B),P(T,m,B),Me(_,T,B),P(T,d,B),Me(h,T,B),P(T,b,B),Me(g,T,B),P(T,w,B),Me(k,T,B),P(T,R,B),Me(I,T,B),P(T,F,B),Me(M,T,B),P(T,A,B),Me(O,T,B),P(T,j,B),Me(Y,T,B),z=!0},p(T,B){const X={};B&64&&(X.data=T[6]),B&1&&(X.basepath=T[0]),e.$set(X);const y={};B&2558&&(y.$$scope={dirty:B,ctx:T}),n.$set(y);const K={};B&2241&&(K.$$scope={dirty:B,ctx:T}),s.$set(K);const V={};B&2049&&(V.$$scope={dirty:B,ctx:T}),r.$set(V);const U={};B&2240&&(U.$$scope={dirty:B,ctx:T}),c.$set(U);const G={};B&2048&&(G.$$scope={dirty:B,ctx:T}),_.$set(G);const se={};B&2048&&(se.$$scope={dirty:B,ctx:T}),h.$set(se);const le={};B&2048&&(le.$$scope={dirty:B,ctx:T}),g.$set(le);const Q={};B&2177&&(Q.$$scope={dirty:B,ctx:T}),k.$set(Q);const ae={};B&2176&&(ae.$$scope={dirty:B,ctx:T}),I.$set(ae);const re={};B&2177&&(re.$$scope={dirty:B,ctx:T}),M.$set(re);const ue={};B&2053&&(ue.$$scope={dirty:B,ctx:T}),O.$set(ue);const ne={};B&2057&&(ne.$$scope={dirty:B,ctx:T}),Y.$set(ne)},i(T){z||(Z(e.$$.fragment,T),Z(n.$$.fragment,T),Z(s.$$.fragment,T),Z(r.$$.fragment,T),Z(c.$$.fragment,T),Z(_.$$.fragment,T),Z(h.$$.fragment,T),Z(g.$$.fragment,T),Z(k.$$.fragment,T),Z(I.$$.fragment,T),Z(M.$$.fragment,T),Z(O.$$.fragment,T),Z(Y.$$.fragment,T),z=!0)},o(T){ie(e.$$.fragment,T),ie(n.$$.fragment,T),ie(s.$$.fragment,T),ie(r.$$.fragment,T),ie(c.$$.fragment,T),ie(_.$$.fragment,T),ie(h.$$.fragment,T),ie(g.$$.fragment,T),ie(k.$$.fragment,T),ie(I.$$.fragment,T),ie(M.$$.fragment,T),ie(O.$$.fragment,T),ie(Y.$$.fragment,T),z=!1},d(T){T&&(N(l),N(i),N(a),N(f),N(m),N(d),N(b),N(w),N(R),N(F),N(A),N(j)),Ne(e,T),Ne(n,T),Ne(s,T),Ne(r,T),Ne(c,T),Ne(_,T),Ne(h,T),Ne(g,T),Ne(k,T),Ne(I,T),Ne(M,T),Ne(O,T),Ne(Y,T)}}}function Bf(t){let e,l,n,i;const s=[N_,M_],a=[];function r(f,c){return f[7].trying?0:1}return e=r(t),l=a[e]=s[e](t),{c(){l.c(),n=Ht()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(ht(),ie(a[m],1,1,()=>{a[m]=null}),vt(),l=a[e],l?l.p(f,c):(l=a[e]=s[e](f),l.c()),Z(l,1),l.m(n.parentNode,n))},i(f){i||(Z(l),i=!0)},o(f){ie(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function M_(t){let e,l;return e=new rl({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function N_(t){let e,l;return e=new rl({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[7].trying}}),{c(){Pe(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.message="Device is booting, please wait. Trying to reach it on "+n[7].trying),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function P_(t){let e,l,n,i;l=new cu({props:{basepath:t[0],$$slots:{default:[S_]},$$scope:{ctx:t}}});let s=t[7].booting&&Bf(t);return{c(){e=p("div"),Pe(l.$$.fragment),n=v(),s&&s.c(),u(e,"class","container mx-auto m-3")},m(a,r){P(a,e,r),Me(l,e,null),o(e,n),s&&s.m(e,null),i=!0},p(a,[r]){const f={};r&1&&(f.basepath=a[0]),r&2559&&(f.$$scope={dirty:r,ctx:a}),l.$set(f),a[7].booting?s?(s.p(a,r),r&128&&Z(s,1)):(s=Bf(a),s.c(),Z(s,1),s.m(e,null)):s&&(ht(),ie(s,1,1,()=>{s=null}),vt())},i(a){i||(Z(l.$$.fragment,a),Z(s),i=!0)},o(a){ie(l.$$.fragment,a),ie(s),i=!1},d(a){a&&N(e),Ne(l),s&&s.d()}}}function T_(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i;Ji.subscribe(b=>{l(1,i=b)});let s;ku.subscribe(b=>{l(2,s=b)});let a;wu.subscribe(b=>{l(3,a=b)});let r;Cu.subscribe(b=>{l(4,r=b)});let f={};gl.subscribe(b=>{l(5,f=b)});let c,m={},_={},d;cl.subscribe(b=>{var g;l(7,_=b),_.vndcfg===!1?sn(n+"vendor"):_.usrcfg===!1?sn(n+"setup"):_.fwconsent===0&&sn(n+"consent"),_.ui.k===1?document.documentElement.classList.add("dark"):_.ui.k===0?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),_.ui.lang&&_.ui.lang!=((g=f==null?void 0:f.language)==null?void 0:g.code)&&Nu(_.ui.lang),_.version&&d&&_.version!=d&&window.location.reload(),d=_.version,c&&clearTimeout(c),c=setTimeout(ci,!m||!m.u||m.u<30||_!=null&&_.upgrading?1e4:3e5)}),f1.subscribe(b=>{l(6,m=b),E0(b)});let h={};return Mu.subscribe(b=>{l(8,h=b)}),Su(),[n,i,s,a,r,f,m,_,h]}class q_ extends Pt{constructor(e){super(),Nt(this,e,T_,P_,Mt,{})}}new q_({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte index a741e82c..094f0af4 100644 --- a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte +++ b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte @@ -225,6 +225,10 @@ } } + async function enablePriceFetch() { + configuration.p.e = true; + } + let gpioMax = 44; $: { gpioMax = sysinfo.chip == 'esp8266' ? 16 : sysinfo.chip == 'esp32s2' ? 44 : 39; @@ -272,7 +276,7 @@
{translations.conf?.price?.region ?? "Price region"}
- {#if !configuration.p.t}