From 60c7cea724bfb50c7467ce47299889d43265f4d7 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Wed, 3 May 2023 07:51:11 +0200 Subject: [PATCH] Extended range for multipliers --- lib/SvelteUi/app/dist/index.js | 2 +- lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index 6c227c5d..692e03da 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,7 +1,7 @@ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function ie(){}function Ut(t,e){for(const l in e)t[l]=e[l];return t}function If(t){return t()}function yr(){return Object.create(null)}function Be(t){t.forEach(If)}function eo(t){return typeof t=="function"}function ke(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let os;function Mc(t,e){return os||(os=document.createElement("a")),os.href=e,t===os.href}function Ac(t){return Object.keys(t).length===0}function to(t,...e){if(t==null)return ie;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function Vn(t){let e;return to(t,l=>e=l)(),e}function zt(t,e,l){t.$$.on_destroy.push(to(e,l))}function lo(t,e,l,n){if(t){const i=Ef(t,e,l,n);return t[0](i)}}function Ef(t,e,l,n){return t[1]&&n?Ut(l.ctx.slice(),t[1](n(e))):l.ctx}function no(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],r=Math.max(e.dirty.length,i.length);for(let a=0;a32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function hs(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}function Kn(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set?t[n]=e[n]:u(t,n,e[n])}function ae(t){return t===""?null:+t}function Nc(t){return Array.from(t.childNodes)}function W(t,e){e=""+e,t.data!==e&&(t.data=e)}function Ic(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Ec(t,e,l){~Dc.indexOf(l)?Ic(t,e):W(t,e)}function Y(t,e){t.value=e??""}function Ff(t,e,l,n){l===null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Le(t,e,l){for(let n=0;n{r.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=z(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),y(n)}}function Lc(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function $r(t,e){return new t(e)}let ci;function ri(t){ci=t}function pi(){if(!ci)throw new Error("Function called outside component initialization");return ci}function Oc(t){pi().$$.on_mount.push(t)}function qc(t){pi().$$.on_destroy.push(t)}function Uc(){const t=pi();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=Lc(e,l,{cancelable:n});return i.slice().forEach(r=>{r.call(t,o)}),!o.defaultPrevented}return!0}}function ai(t,e){return pi().$$.context.set(t,e),e}function wl(t){return pi().$$.context.get(t)}const Gn=[],ms=[];let Bn=[];const Cr=[],Rf=Promise.resolve();let Ws=!1;function Lf(){Ws||(Ws=!0,Rf.then(Of))}function Hc(){return Lf(),Rf}function Ye(t){Bn.push(t)}const Ls=new Set;let jn=0;function Of(){if(jn!==0)return;const t=ci;do{try{for(;jnt.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),Bn=e}const fs=new Set;let Wl;function Te(){Wl={r:0,c:[],p:Wl}}function Se(){Wl.r||Be(Wl.c),Wl=Wl.p}function M(t,e){t&&t.i&&(fs.delete(t),t.i(e))}function I(t,e,l,n){if(t&&t.o){if(fs.has(t))return;fs.add(t),Wl.c.push(()=>{fs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function qf(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const r=t[o],a=e[o];if(a){for(const c in r)c in a||(n[c]=1);for(const c in a)i[c]||(l[c]=a[c],i[c]=1);t[o]=a}else for(const c in r)i[c]=1}for(const r in n)r in l||(l[r]=void 0);return l}function Tr(t){return typeof t=="object"&&t!==null?t:{}}function Z(t){t&&t.c()}function Q(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||Ye(()=>{const r=t.$$.on_mount.map(If).filter(eo);t.$$.on_destroy?t.$$.on_destroy.push(...r):Be(r),t.$$.on_mount=[]}),o.forEach(Ye)}function X(t,e){const l=t.$$;l.fragment!==null&&(Wc(l.after_update),Be(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function Gc(t,e){t.$$.dirty[0]===-1&&(Gn.push(t),Lf(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const v=h.length?h[0]:d;return f.ctx&&i(f.ctx[m],f.ctx[m]=v)&&(!f.skip_bound&&f.bound[m]&&f.bound[m](v),_&&Gc(t,m)),d}):[],f.update(),_=!0,Be(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const m=Nc(e.target);f.fragment&&f.fragment.l(m),m.forEach(y)}else f.fragment&&f.fragment.c();e.intro&&M(t.$$.fragment),Q(t,e.target,e.anchor,e.customElement),Of()}ri(c)}class $e{$destroy(){X(this,1),this.$destroy=ie}$on(e,l){if(!eo(l))return ie;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&&!Ac(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Sr=t=>typeof t>"u",Uf=t=>typeof t=="function",Hf=t=>typeof t=="number";function Bc(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function jf(){let t=0;return()=>t++}function Yc(){return Math.random().toString(36).substring(2)}const yl=typeof window>"u";function Wf(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Gf=(t,e)=>t?{}:{style:e},Gs=t=>({"aria-hidden":"true",...Gf(t,"display:none;")}),Wn=[];function Bf(t,e){return{subscribe:Ze(t,e).subscribe}}function Ze(t,e=ie){let l;const n=new Set;function i(a){if(ke(t,a)&&(t=a,l)){const c=!Wn.length;for(const f of n)f[1](),Wn.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:r}}function zc(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return Bf(l,r=>{let a=!1;const c=[];let f=0,_=ie;const m=()=>{if(f)return;_();const h=e(n?c[0]:c,r);o?r(h):_=eo(h)?h:ie},d=i.map((h,v)=>to(h,g=>{c[v]=g,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,Bs=mi("LOCATION"),Qn=mi("ROUTER"),Yf=mi("ROUTE"),Vc=mi("ROUTE_PARAMS"),Kc=mi("FOCUS_ELEM"),zf=/^:(.+)/,ui=(t,e,l)=>t.substr(e,l),Ys=(t,e)=>ui(t,0,e.length)===e,Qc=t=>t==="",Xc=t=>zf.test(t),Vf=t=>t[0]==="*",Zc=t=>t.replace(/\*.*$/,""),Kf=t=>t.replace(/(^\/+|\/+$)/g,"");function Qt(t,e=!1){const l=Kf(t).split("/");return e?l.filter(Boolean):l}const Os=(t,e)=>t+(e?`?${e}`:""),oo=t=>`/${Kf(t)}`;function _i(...t){const e=n=>Qt(n,!0).join("/"),l=t.map(e).join("/");return oo(l)}const uo=1,bs=2,Yl=3,Jc=4,Qf=5,xc=6,Xf=7,e1=8,t1=9,Zf=10,Jf=11,l1={[uo]:"Link",[bs]:"Route",[Yl]:"Router",[Jc]:"useFocus",[Qf]:"useLocation",[xc]:"useMatch",[Xf]:"useNavigate",[e1]:"useParams",[t1]:"useResolvable",[Zf]:"useResolve",[Jf]:"navigate"},ro=t=>l1[t];function n1(t,e){let l;return t===bs?l=e.path?`path="${e.path}"`:"default":t===uo?l=`to="${e.to}"`:t===Yl&&(l=`basepath="${e.basepath||""}"`),`<${ro(t)} ${l||""} />`}function i1(t,e,l,n){const i=l&&n1(n||t,l),o=i?` Occurred in: ${i}`:"",r=ro(t),a=Uf(e)?e(r):e;return`<${r}> ${a}${o}`}const xf=t=>(...e)=>t(i1(...e)),ec=xf(t=>{throw new Error(t)}),_s=xf(console.warn),Pr=4,s1=3,o1=2,u1=1,r1=1;function a1(t,e){const l=t.default?0:Qt(t.fullPath).reduce((n,i)=>{let o=n;return o+=Pr,Qc(i)?o+=r1:Xc(i)?o+=o1:Vf(i)?o-=Pr+u1:o+=s1,o},0);return{route:t,score:l,index:e}}function f1(t){return t.map(a1).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function tc(t,e){let l,n;const[i]=e.split("?"),o=Qt(i),r=o[0]==="",a=f1(t);for(let c=0,f=a.length;c({..._,params:d,uri:k});if(_.default){n=h(e);continue}const v=Qt(_.fullPath),g=Math.max(o.length,v.length);let w=0;for(;w{f===".."?c.pop():f!=="."&&c.push(f)}),Os(`/${c.join("/")}`,n)}function Mr(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,r=Qt(e,!0),a=Qt(l,!0);for(;r.length;)r[0]!==a[0]&&ec(Yl,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),r.shift(),a.shift();return{pathname:_i(...a),hash:n,search:i,state:o}}const Ar=t=>t.length===1?"":t,ao=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Ar(ui(t,l)):"",r=i?ui(t,0,l):t,a=n?Ar(ui(r,e)):"";return{pathname:(n?ui(r,0,e):r)||"/",search:a,hash:o}},p1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function m1(t,e,l){return _i(l,c1(t,e))}function _1(t,e){const l=oo(Zc(t)),n=Qt(l,!0),i=Qt(e,!0).slice(0,n.length),o=lc({fullPath:l},_i(...i));return o&&o.uri}const qs="POP",d1="PUSH",v1="REPLACE";function Us(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function h1(t){let e=[],l=Us(t),n=qs;const i=(o=e)=>o.forEach(r=>r({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const r=()=>{l=Us(t),n=qs,i([o])};i([o]);const a=Wf(t,"popstate",r);return()=>{a(),e=e.filter(c=>c!==o)}},navigate(o,r){const{state:a={},replace:c=!1}=r||{};if(n=c?v1:d1,Hf(o))r&&_s(Jf,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=qs,t.history.go(o);else{const f={...a,_key:Yc()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Us(t),i()}}}function Hs(t,e){return{...ao(e),state:t}}function b1(t="/"){let e=0,l=[Hs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Hs(n,o))},replaceState(n,i,o){l[e]=Hs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const g1=!!(!yl&&window.document&&window.document.createElement),k1=!yl&&window.location.origin==="null",nc=h1(g1&&!k1?window:b1()),{navigate:Yn}=nc;let fl=null,ic=!0;function w1(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nfl.level||t.level===fl.level&&w1(t.routerId,fl.routerId))&&(fl=t)}function $1(){fl=null}function C1(){ic=!1}function Dr(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Wf(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function T1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function S1(t){return/^H[1-6]$/i.test(t.tagName)}function Nr(t,e=document){return e.querySelector(t)}function P1(t){let l=Nr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!T1(l,t);){if(S1(l))return l;const n=Nr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function M1(t){Promise.resolve(Vn(t.focusElement)).then(e=>{const l=e||P1(t.id);l||_s(Yl,`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,bs),!Dr(l)&&Dr(document.documentElement)})}const A1=(t,e,l)=>(n,i)=>Hc().then(()=>{if(!fl||ic){C1();return}if(n&&M1(fl.route),t.announcements&&i){const{path:o,fullPath:r,meta:a,params:c,uri:f}=fl.route,_=t.createAnnouncement({path:o,fullPath:r,meta:a,params:c,uri:f},Vn(l));Promise.resolve(_).then(m=>{e.set(m)})}$1()}),D1="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 N1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Gf(t[6],D1)],i={};for(let o=0;o`Navigated to ${le.uri}`,announcements:!0,...v},k=_,T=oo(_),P=wl(Bs),E=wl(Qn),S=!P,D=E1(),F=h&&!(E&&!E.manageFocus),R=Ze("");zt(t,R,le=>l(0,a=le));const B=E?E.disableInlineStyles:g,L=Ze([]);zt(t,L,le=>l(20,r=le));const N=Ze(null);zt(t,N,le=>l(18,i=le));let O=!1;const j=S?0:E.level+1,q=S?Ze((()=>Mr(yl?ao(m):d.location,T))()):P;zt(t,q,le=>l(17,n=le));const G=Ze(n);zt(t,G,le=>l(19,o=le));const H=A1(w,R,q),V=le=>me=>me.filter(Pe=>Pe.id!==le);function J(le){if(yl){if(O)return;const me=lc(le,n.pathname);if(me)return O=!0,me}else L.update(me=>{const Pe=V(le.id)(me);return Pe.push(le),Pe})}function ne(le){L.update(V(le))}return!S&&_!==Ir&&_s(Yl,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),S&&(Oc(()=>d.listen(me=>{const Pe=Mr(me.location,T);G.set(n),q.set(Pe)})),ai(Bs,q)),ai(Qn,{activeRoute:N,registerRoute:J,unregisterRoute:ne,manageFocus:F,level:j,id:D,history:S?d:E.history,basepath:S?T:E.basepath,disableInlineStyles:B}),t.$$set=le=>{"basepath"in le&&l(11,_=le.basepath),"url"in le&&l(12,m=le.url),"history"in le&&l(13,d=le.history),"primary"in le&&l(14,h=le.primary),"a11y"in le&&l(15,v=le.a11y),"disableInlineStyles"in le&&l(16,g=le.disableInlineStyles),"$$scope"in le&&l(21,f=le.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==k&&_s(Yl,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const le=tc(r,n.pathname);N.set(le)}if(t.$$.dirty[0]&655360&&S){const le=!!n.hash,me=!le&&F,Pe=!le||n.pathname!==o.pathname;H(me,Pe)}t.$$.dirty[0]&262144&&F&&i&&i.primary&&y1({level:j,routerId:D,route:i})},[a,w,S,D,F,R,B,L,N,q,G,_,m,d,h,v,g,n,i,o,r,f,c]}class R1 extends $e{constructor(e){super(),ye(this,e,F1,I1,ke,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const sc=R1;function di(t,e,l=Qn,n=Yl){wl(l)||ec(t,o=>`You cannot use ${o} outside of a ${ro(n)}.`,e)}const L1=t=>{const{subscribe:e}=wl(t);return{subscribe:e}};function oc(){return di(Qf),L1(Bs)}function uc(){const{history:t}=wl(Qn);return t}function rc(){const t=wl(Yf);return t?zc(t,e=>e.base):Ze("/")}function ac(){di(Zf);const t=rc(),{basepath:e}=wl(Qn);return n=>m1(n,Vn(t),e)}function O1(){di(Xf);const t=ac(),{navigate:e}=uc();return(n,i)=>{const o=Hf(n)?n:t(n);return e(o,i)}}const q1=t=>({params:t&16,location:t&8}),Er=t=>({params:yl?Vn(t[10]):t[4],location:t[3],navigate:t[11]});function Fr(t){let e,l;return e=new sc({props:{primary:t[1],$$slots:{default:[j1]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function U1(t){let e;const l=t[18].default,n=lo(l,t,t[19],Er);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&io(n,l,i,i[19],e?no(l,i[19],o,q1):so(i[19]),Er)},i(i){e||(M(n,i),e=!0)},o(i){I(n,i),e=!1},d(i){n&&n.d(i)}}}function H1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},yl?Vn(t[10]):t[4],t[12]];var o=t[0];function r(a){let c={};for(let f=0;f{X(_,1)}),Se()}o?(e=$r(o,r()),Z(e.$$.fragment),M(e.$$.fragment,1),Q(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(a){n||(e&&M(e.$$.fragment,a),n=!0)},o(a){e&&I(e.$$.fragment,a),n=!1},d(a){a&&y(l),e&&X(e,a)}}}function j1(t){let e,l,n,i;const o=[H1,U1],r=[];function a(c,f){return c[0]!==null?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){r[e].m(c,f),$(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?r[e].p(c,f):(Te(),I(r[_],1,1,()=>{r[_]=null}),Se(),l=r[e],l?l.p(c,f):(l=r[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){r[e].d(c),c&&y(n)}}}function W1(t){let e,l,n,i,o,r=[Gs(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let m=0;m{c=null}),Se())},i(m){o||(M(c),o=!0)},o(m){I(c),o=!1},d(m){m&&y(e),m&&y(l),c&&c.d(m),m&&y(n),m&&y(i)}}}const G1=jf();function B1(t,e,l){let n;const i=["path","component","meta","primary"];let o=ps(e,i),r,a,c,f,{$$slots:_={},$$scope:m}=e,{path:d=""}=e,{component:h=null}=e,{meta:v={}}=e,{primary:g=!0}=e;di(bs,e);const w=G1(),{registerRoute:k,unregisterRoute:T,activeRoute:P,disableInlineStyles:E}=wl(Qn);zt(t,P,O=>l(16,r=O));const S=rc();zt(t,S,O=>l(17,c=O));const D=oc();zt(t,D,O=>l(3,a=O));const F=Ze(null);let R;const B=Ze(),L=Ze({});zt(t,L,O=>l(4,f=O)),ai(Yf,B),ai(Vc,L),ai(Kc,F);const N=O1();return yl||qc(()=>T(w)),t.$$set=O=>{l(24,e=Ut(Ut({},e),cs(O))),l(12,o=ps(e,i)),"path"in O&&l(13,d=O.path),"component"in O&&l(0,h=O.component),"meta"in O&&l(14,v=O.meta),"primary"in O&&l(1,g=O.primary),"$$scope"in O&&l(19,m=O.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const O=d==="",j=_i(c,d),U={id:w,path:d,meta:v,default:O,fullPath:O?"":j,base:O?c:_1(j,a.pathname),primary:g,focusElement:F};B.set(U),l(15,R=k(U))}if(t.$$.dirty&98304&&l(2,n=!!(R||r&&r.id===w)),t.$$.dirty&98308&&n){const{params:O}=R||r;L.set(O)}},e=cs(e),[h,g,n,a,f,w,P,E,S,D,L,N,o,d,v,R,r,c,_,m]}class Y1 extends $e{constructor(e){super(),ye(this,e,B1,W1,ke,{path:13,component:0,meta:14,primary:1})}}const al=Y1;function z1(t){let e,l,n,i;const o=t[13].default,r=lo(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,m=F));const P=Uc(),E=ac(),{navigate:S}=uc();function D(F){P("click",F),Bc(F)&&(F.preventDefault(),S(n,{state:w,replace:r||g}))}return t.$$set=F=>{l(19,e=Ut(Ut({},e),cs(F))),l(18,_=ps(e,f)),"to"in F&&l(5,v=F.to),"replace"in F&&l(6,g=F.replace),"state"in F&&l(7,w=F.state),"getProps"in F&&l(8,k=F.getProps),"$$scope"in F&&l(12,h=F.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=E(v,m)),t.$$.dirty&2049&&l(10,i=Ys(m.pathname,n)),t.$$.dirty&2049&&l(9,o=n===m.pathname),t.$$.dirty&2049&&(r=ao(n)===p1(m)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(Uf(k)){const F=k({location:m,href:n,isPartiallyCurrent:i,isCurrent:o});return{..._,...F}}return _})())},e=cs(e),[n,c,a,T,D,v,g,w,k,o,i,m,h,d]}class K1 extends $e{constructor(e){super(),ye(this,e,V1,z1,ke,{to:5,replace:6,state:7,getProps:8})}}const kl=K1;let zs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function gl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function Q1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function fc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function X1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function ds(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return""}}function Ee(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function fe(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"µ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"}}function Rr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Lr(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Or(t){switch(t){case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function zn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function je(t,e){return t==1||t==2&&e}function Ct(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function fi(t,e){return t.setTime(t.getTime()+e*36e5),t}function qr(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}async function $l(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let Yt={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const Tt=Ze(Yt);async function fo(){Yt=await(await $l("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Tt.set(Yt)}let rs=0,Ur=-127,Hr=null,Z1={};const J1=Bf(Z1,t=>{let e;async function l(){$l("/data.json").then(n=>n.json()).then(n=>{t(n),Ur!=n.t&&(Ur=n.t,setTimeout(_c,2e3)),Hr!=n.p&&n.pe&&(Hr=n.p,setTimeout(x1,4e3)),Yt.upgrading?window.location.reload():(!Yt||!Yt.chip||Yt.booting||rs>1&&!zn(Yt.board))&&(fo(),Gl&&clearTimeout(Gl),Gl=setTimeout(co,2e3),Bl&&clearTimeout(Bl),Bl=setTimeout(po,3e3));let i=5e3;if(zn(Yt.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),rs=0}).catch(n=>{rs++,rs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,zn(Yt.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Vs={};const cc=Ze(Vs);async function x1(){Vs=await(await $l("/energyprice.json")).json(),cc.set(Vs)}let Ks={},Gl;async function co(){Gl&&(clearTimeout(Gl),Gl=0),Ks=await(await $l("/dayplot.json")).json(),pc.set(Ks),Gl=setTimeout(co,(60-new Date().getMinutes())*6e4+20)}const pc=Ze(Ks,t=>(co(),function(){}));let Qs={},Bl;async function po(){Bl&&(clearTimeout(Bl),Bl=0),Qs=await(await $l("/monthplot.json")).json(),mc.set(Qs),Bl=setTimeout(po,(24-new Date().getHours())*36e5+40)}const mc=Ze(Qs,t=>(po(),function(){}));let Xs={};async function _c(){Xs=await(await $l("/temperature.json")).json(),dc.set(Xs)}const dc=Ze(Xs,t=>(_c(),function(){}));let Zs={},as;async function vc(){as&&(clearTimeout(as),as=0),Zs=await(await $l("/tariff.json")).json(),hc.set(Zs),as=setTimeout(vc,(60-new Date().getMinutes())*6e4+30)}const hc=Ze(Zs,t=>function(){});let Js=[];const mo=Ze(Js);async function ep(){Js=await(await $l("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),mo.set(Js)}function vs(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 bc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function gc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),r=[...e];r.reverse();let a,c,f;for(let _=0;_o&&(a=m):g==i+1&&(c=m);else if(v==n+1)if(f){let k=f.tag_name.substring(1).split(".");parseInt(k[0]);let T=parseInt(k[1]);parseInt(k[2]),g==T&&(f=m)}else f=m}return c||f||a||!1}else return e[0]}const tp="/github.svg";function jr(t){let e,l;function n(r,a){return r[1]>1?rp:r[1]>0?up:r[2]>1?op:r[2]>0?sp:r[3]>1?ip:r[3]>0?np:lp}let i=n(t),o=i(t);return{c(){e=C(`Up - `),o.c(),l=We()},m(r,a){$(r,e,a),o.m(r,a),$(r,l,a)},p(r,a){i===(i=n(r))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},d(r){r&&y(e),o.d(r),r&&y(l)}}}function lp(t){let e,l;return{c(){e=C(t[0]),l=C(" seconds")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&1&&W(e,n[0])},d(n){n&&y(e),n&&y(l)}}}function np(t){let e,l;return{c(){e=C(t[3]),l=C(" minute")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&8&&W(e,n[3])},d(n){n&&y(e),n&&y(l)}}}function ip(t){let e,l;return{c(){e=C(t[3]),l=C(" minutes")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&8&&W(e,n[3])},d(n){n&&y(e),n&&y(l)}}}function sp(t){let e,l;return{c(){e=C(t[2]),l=C(" hour")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&4&&W(e,n[2])},d(n){n&&y(e),n&&y(l)}}}function op(t){let e,l;return{c(){e=C(t[2]),l=C(" hours")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&4&&W(e,n[2])},d(n){n&&y(e),n&&y(l)}}}function up(t){let e,l;return{c(){e=C(t[1]),l=C(" day")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&2&&W(e,n[1])},d(n){n&&y(e),n&&y(l)}}}function rp(t){let e,l;return{c(){e=C(t[1]),l=C(" days")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&2&&W(e,n[1])},d(n){n&&y(e),n&&y(l)}}}function ap(t){let e,l=t[0]&&jr(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=jr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&y(e)}}}function fp(t,e,l){let{epoch:n}=e,i=0,o=0,r=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,r=Math.floor(n/60)))},[n,i,o,r]}class cp extends $e{constructor(e){super(),ye(this,e,fp,ap,ke,{epoch:0})}}function pp(t){let e,l,n;return{c(){e=p("span"),l=C(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){$(i,e,o),s(e,l)},p(i,[o]){o&4&&W(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ie,o:ie,d(i){i&&y(e)}}}function mp(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=r=>{"color"in r&&l(0,n=r.color),"title"in r&&l(1,i=r.title),"text"in r&&l(2,o=r.text)},[n,i,o]}class Vt extends $e{constructor(e){super(),ye(this,e,mp,pp,ke,{color:0,title:1,text:2})}}function _p(t){let e,l=`${Ee(t[0].getDate())}.${Ee(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ee(t[0].getHours())}:${Ee(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=C(l),u(e,"class",t[1])},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ee(i[0].getDate())}.${Ee(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ee(i[0].getHours())}:${Ee(i[0].getMinutes())}`)&&W(n,l),o&2&&u(e,"class",i[1])},d(i){i&&y(e)}}}function dp(t){let e=`${Ee(t[0].getDate())}. ${zs[t[0].getMonth()]} ${Ee(t[0].getHours())}:${Ee(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(n,i){$(n,l,i)},p(n,i){i&1&&e!==(e=`${Ee(n[0].getDate())}. ${zs[n[0].getMonth()]} ${Ee(n[0].getHours())}:${Ee(n[0].getMinutes())}`)&&W(l,e)},d(n){n&&y(l)}}}function vp(t){let e,l;function n(r,a){return a&1&&(e=null),e==null&&(e=Math.abs(new Date().getTime()-r[0].getTime())<3e5),e?dp:_p}let i=n(t,-1),o=i(t);return{c(){o.c(),l=We()},m(r,a){o.m(r,a),$(r,l,a)},p(r,[a]){i===(i=n(r,a))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},i:ie,o:ie,d(r){o.d(r),r&&y(l)}}}function hp(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e;return t.$$set=o=>{"timestamp"in o&&l(0,n=o.timestamp),"fullTimeColor"in o&&l(1,i=o.fullTimeColor)},[n,i]}class kc extends $e{constructor(e){super(),ye(this,e,hp,vp,ke,{timestamp:0,fullTimeColor:1})}}function bp(t){let e,l,n;return{c(){e=Ue("svg"),l=Ue("path"),n=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){$(i,e,o),s(e,l),s(e,n)},p:ie,i:ie,o:ie,d(i){i&&y(e)}}}class gp extends $e{constructor(e){super(),ye(this,e,null,bp,ke,{})}}function kp(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&y(e)}}}class wp extends $e{constructor(e){super(),ye(this,e,null,kp,ke,{})}}function yp(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&y(e)}}}class $t extends $e{constructor(e){super(),ye(this,e,null,yp,ke,{})}}function $p(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&y(e)}}}class wc extends $e{constructor(e){super(),ye(this,e,null,$p,ke,{})}}function Cp(t){let e,l,n=t[1].version+"",i;return{c(){e=C("AMS reader "),l=p("span"),i=C(n)},m(o,r){$(o,e,r),$(o,l,r),s(l,i)},p(o,r){r&2&&n!==(n=o[1].version+"")&&W(i,n)},d(o){o&&y(e),o&&y(l)}}}function Wr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=C(l),i=C("°C"),u(e,"class","flex-none my-auto")},m(o,r){$(o,e,r),s(e,n),s(e,i)},p(o,r){r&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&W(n,l)},d(o){o&&y(e)}}}function Gr(t){let e,l="HAN: "+Rr(t[0].he),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Rr(i[0].he))&&W(n,l)},d(i){i&&y(e)}}}function Br(t){let e,l="MQTT: "+Lr(t[0].me),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Lr(i[0].me))&&W(n,l)},d(i){i&&y(e)}}}function Yr(t){let e,l="PriceAPI: "+Or(t[0].ee),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Or(i[0].ee))&&W(n,l)},d(i){i&&y(e)}}}function zr(t){let e,l,n,i,o,r;return l=new kl({props:{to:"/configuration",$$slots:{default:[Tp]},$$scope:{ctx:t}}}),o=new kl({props:{to:"/status",$$slots:{default:[Sp]},$$scope:{ctx:t}}}),{c(){e=p("div"),Z(l.$$.fragment),n=b(),i=p("div"),Z(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(a,c){$(a,e,c),Q(l,e,null),$(a,n,c),$(a,i,c),Q(o,i,null),r=!0},i(a){r||(M(l.$$.fragment,a),M(o.$$.fragment,a),r=!0)},o(a){I(l.$$.fragment,a),I(o.$$.fragment,a),r=!1},d(a){a&&y(e),X(l),a&&y(n),a&&y(i),X(o)}}}function Tp(t){let e,l;return e=new gp({}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Sp(t){let e,l;return e=new wp({}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Vr(t){let e,l,n,i,o;const r=[Mp,Pp],a=[];function c(f,_){return f[1].security==0||f[0].a?0:1}return l=c(t),n=a[l]=r[l](t),{c(){e=p("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(f,_){$(f,e,_),a[l].m(e,null),o=!0},p(f,_){let m=l;l=c(f),l===m?a[l].p(f,_):(Te(),I(a[m],1,1,()=>{a[m]=null}),Se(),n=a[l],n?n.p(f,_):(n=a[l]=r[l](f),n.c()),M(n,1),n.m(e,null)),(!o||_&4&&i!==(i="New version: "+f[2].tag_name))&&u(e,"title",i)},i(f){o||(M(n),o=!0)},o(f){I(n),o=!1},d(f){f&&y(e),a[l].d()}}}function Pp(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=p("span"),l=C("New version: "),i=C(n)},m(o,r){$(o,e,r),s(e,l),s(e,i)},p(o,r){r&4&&n!==(n=o[2].tag_name+"")&&W(i,n)},i:ie,o:ie,d(o){o&&y(e)}}}function Mp(t){let e,l,n,i=t[2].tag_name+"",o,r,a,c,f,_;return a=new wc({}),{c(){e=p("button"),l=p("span"),n=C("New version: "),o=C(i),r=b(),Z(a.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(m,d){$(m,e,d),s(e,l),s(l,n),s(l,o),s(e,r),Q(a,e,null),c=!0,f||(_=z(e,"click",t[3]),f=!0)},p(m,d){(!c||d&4)&&i!==(i=m[2].tag_name+"")&&W(o,i)},i(m){c||(M(a.$$.fragment,m),c=!0)},o(m){I(a.$$.fragment,m),c=!1},d(m){m&&y(e),X(a),f=!1,_()}}}function Ap(t){let e,l,n,i,o,r,a,c,f,_,m,d,h=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",v,g,w,k,T,P,E,S,D,F,R,B,L,N,O,j,U,q,G,H,V,J,ne,le,me,Pe,we,Fe,Ce,Re;i=new kl({props:{to:"/",$$slots:{default:[Cp]},$$scope:{ctx:t}}}),c=new cp({props:{epoch:t[0].u}});let _e=t[0].t>-50&&Wr(t);T=new Vt({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:gl(t[1].booting?2:t[0].em)}}),E=new Vt({props:{title:"HAN",text:"HAN",color:gl(t[1].booting?9:t[0].hm)}}),D=new Vt({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:gl(t[1].booting?9:t[0].wm)}}),R=new Vt({props:{title:"MQTT",text:"MQTT",color:gl(t[1].booting?9:t[0].mm)}});let Me=(t[0].he<0||t[0].he>0)&&Gr(t),Ie=t[0].me<0&&Br(t),ce=(t[0].ee>0||t[0].ee<0)&&Yr(t);ne=new kc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),fullTimeColor:"text-red-500"}});let se=t[1].vndcfg&&t[1].usrcfg&&zr(t);Fe=new $t({});let pe=t[1].fwconsent===1&&t[2]&&Vr(t);return{c(){e=p("nav"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=b(),r=p("div"),a=p("div"),Z(c.$$.fragment),f=b(),_e&&_e.c(),_=b(),m=p("div"),d=C("Free mem: "),v=C(h),g=C("kb"),w=b(),k=p("div"),Z(T.$$.fragment),P=b(),Z(E.$$.fragment),S=b(),Z(D.$$.fragment),F=b(),Z(R.$$.fragment),B=b(),Me&&Me.c(),L=b(),Ie&&Ie.c(),N=b(),ce&&ce.c(),O=b(),j=p("div"),U=p("div"),q=p("a"),G=p("img"),V=b(),J=p("div"),Z(ne.$$.fragment),le=b(),se&&se.c(),me=b(),Pe=p("div"),we=p("a"),Z(Fe.$$.fragment),Ce=b(),pe&&pe.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(a,"class","flex-none my-auto"),u(m,"class","flex-none my-auto"),u(r,"class","flex-none my-auto p-2 flex space-x-4"),u(k,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(G,"class","gh-logo"),Mc(G.src,H=tp)||u(G,"src",H),u(G,"alt","GitHub repo"),u(q,"class","float-right"),u(q,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(q,"target","_blank"),u(q,"rel","noreferrer"),u(q,"aria-label","GitHub"),u(U,"class","flex-none"),u(J,"class","flex-none my-auto px-2"),u(we,"href",Ct("")),u(we,"target","_blank"),u(we,"rel","noreferrer"),u(Pe,"class","flex-none px-1 mt-1"),u(Pe,"title","Documentation"),u(j,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(K,re){$(K,e,re),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,r),s(r,a),Q(c,a,null),s(r,f),_e&&_e.m(r,null),s(r,_),s(r,m),s(m,d),s(m,v),s(m,g),s(l,w),s(l,k),Q(T,k,null),s(k,P),Q(E,k,null),s(k,S),Q(D,k,null),s(k,F),Q(R,k,null),s(l,B),Me&&Me.m(l,null),s(l,L),Ie&&Ie.m(l,null),s(l,N),ce&&ce.m(l,null),s(l,O),s(l,j),s(j,U),s(U,q),s(q,G),s(j,V),s(j,J),Q(ne,J,null),s(j,le),se&&se.m(j,null),s(j,me),s(j,Pe),s(Pe,we),Q(Fe,we,null),s(j,Ce),pe&&pe.m(j,null),Re=!0},p(K,[re]){const Ae={};re&18&&(Ae.$$scope={dirty:re,ctx:K}),i.$set(Ae);const Ne={};re&1&&(Ne.epoch=K[0].u),c.$set(Ne),K[0].t>-50?_e?_e.p(K,re):(_e=Wr(K),_e.c(),_e.m(r,_)):_e&&(_e.d(1),_e=null),(!Re||re&1)&&h!==(h=(K[0].m?(K[0].m/1e3).toFixed(1):"-")+"")&&W(v,h);const de={};re&3&&(de.text=K[1].booting?"Booting":K[0].v>2?K[0].v.toFixed(2)+"V":"ESP"),re&3&&(de.color=gl(K[1].booting?2:K[0].em)),T.$set(de);const ee={};re&3&&(ee.color=gl(K[1].booting?9:K[0].hm)),E.$set(ee);const oe={};re&1&&(oe.text=K[0].r?K[0].r.toFixed(0)+"dBm":"WiFi"),re&3&&(oe.color=gl(K[1].booting?9:K[0].wm)),D.$set(oe);const ve={};re&3&&(ve.color=gl(K[1].booting?9:K[0].mm)),R.$set(ve),K[0].he<0||K[0].he>0?Me?Me.p(K,re):(Me=Gr(K),Me.c(),Me.m(l,L)):Me&&(Me.d(1),Me=null),K[0].me<0?Ie?Ie.p(K,re):(Ie=Br(K),Ie.c(),Ie.m(l,N)):Ie&&(Ie.d(1),Ie=null),K[0].ee>0||K[0].ee<0?ce?ce.p(K,re):(ce=Yr(K),ce.c(),ce.m(l,O)):ce&&(ce.d(1),ce=null);const De={};re&1&&(De.timestamp=K[0].c?new Date(K[0].c*1e3):new Date(0)),ne.$set(De),K[1].vndcfg&&K[1].usrcfg?se?re&2&&M(se,1):(se=zr(K),se.c(),M(se,1),se.m(j,me)):se&&(Te(),I(se,1,1,()=>{se=null}),Se()),K[1].fwconsent===1&&K[2]?pe?(pe.p(K,re),re&6&&M(pe,1)):(pe=Vr(K),pe.c(),M(pe,1),pe.m(j,null)):pe&&(Te(),I(pe,1,1,()=>{pe=null}),Se())},i(K){Re||(M(i.$$.fragment,K),M(c.$$.fragment,K),M(T.$$.fragment,K),M(E.$$.fragment,K),M(D.$$.fragment,K),M(R.$$.fragment,K),M(ne.$$.fragment,K),M(se),M(Fe.$$.fragment,K),M(pe),Re=!0)},o(K){I(i.$$.fragment,K),I(c.$$.fragment,K),I(T.$$.fragment,K),I(E.$$.fragment,K),I(D.$$.fragment,K),I(R.$$.fragment,K),I(ne.$$.fragment,K),I(se),I(Fe.$$.fragment,K),I(pe),Re=!1},d(K){K&&y(e),X(i),X(c),_e&&_e.d(),X(T),X(E),X(D),X(R),Me&&Me.d(),Ie&&Ie.d(),ce&&ce.d(),X(ne),se&&se.d(),X(Fe),pe&&pe.d()}}}function Dp(t,e,l){let{data:n={}}=e,i={},o={};function r(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!zn(i.board)||confirm(vs(fe(i.chip,i.board))))&&(Tt.update(a=>(a.upgrading=!0,a)),bc(o.tag_name))}return Tt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&ep()}),mo.subscribe(a=>{l(2,o=gc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,r]}class Np extends $e{constructor(e){super(),ye(this,e,Dp,Ap,ke,{data:0})}}function Ip(t){let e,l,n,i;return{c(){e=Ue("svg"),l=Ue("path"),n=Ue("path"),u(l,"d",js(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=js(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,r){$(o,e,r),s(e,l),s(e,n)},p(o,[r]){r&1&&i!==(i=js(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),r&2&&u(n,"stroke",o[1])},i:ie,o:ie,d(o){o&&y(e)}}}function Kr(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 js(t,e,l,n,i){var o=Kr(t,e,l,i),r=Kr(t,e,l,n),a=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,a,0,r.x,r.y].join(" ");return c}function Ep(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class Fp extends $e{constructor(e){super(),ye(this,e,Ep,Ip,ke,{pct:0,color:1})}}function Qr(t){let e,l,n,i,o,r,a,c;return{c(){e=p("br"),l=b(),n=p("span"),i=C(t[3]),o=b(),r=p("span"),a=C(t[4]),c=C("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(f,_){$(f,e,_),$(f,l,_),$(f,n,_),s(n,i),$(f,o,_),$(f,r,_),s(r,a),s(r,c)},p(f,_){_&8&&W(i,f[3]),_&16&&W(a,f[4])},d(f){f&&y(e),f&&y(l),f&&y(n),f&&y(o),f&&y(r)}}}function Rp(t){let e,l,n,i,o,r,a,c,f,_,m,d,h,v,g,w;l=new Fp({props:{pct:t[6],color:t[5](t[6])}});let k=t[3]&&Qr(t);return{c(){e=p("div"),Z(l.$$.fragment),n=b(),i=p("span"),o=p("span"),r=C(t[2]),a=b(),c=p("br"),f=b(),_=p("span"),m=C(t[0]),d=b(),h=p("span"),v=C(t[1]),g=b(),k&&k.c(),u(o,"class","pl-lab"),u(_,"class","pl-val"),u(h,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(T,P){$(T,e,P),Q(l,e,null),s(e,n),s(e,i),s(i,o),s(o,r),s(i,a),s(i,c),s(i,f),s(i,_),s(_,m),s(i,d),s(i,h),s(h,v),s(i,g),k&&k.m(i,null),w=!0},p(T,[P]){const E={};P&64&&(E.pct=T[6]),P&96&&(E.color=T[5](T[6])),l.$set(E),(!w||P&4)&&W(r,T[2]),(!w||P&1)&&W(m,T[0]),(!w||P&2)&&W(v,T[1]),T[3]?k?k.p(T,P):(k=Qr(T),k.c(),k.m(i,null)):k&&(k.d(1),k=null)},i(T){w||(M(l.$$.fragment,T),w=!0)},o(T){I(l.$$.fragment,T),w=!1},d(T){T&&y(e),X(l),k&&k.d()}}}function Lp(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:r}=e,{sub:a=""}=e,{subunit:c=""}=e,{colorFn:f}=e,_=0;return t.$$set=m=>{"val"in m&&l(0,n=m.val),"max"in m&&l(7,i=m.max),"unit"in m&&l(1,o=m.unit),"label"in m&&l(2,r=m.label),"sub"in m&&l(3,a=m.sub),"subunit"in m&&l(4,c=m.subunit),"colorFn"in m&&l(5,f=m.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,o,r,a,c,f,_,i]}class yc extends $e{constructor(e){super(),ye(this,e,Lp,Rp,ke,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Xr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Zr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Jr(t,e,l){const n=t.slice();return n[13]=e[l],n}function xr(t){let e,l=t[0].title+"",n;return{c(){e=p("strong"),n=C(l),u(e,"class","text-sm")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[0].title+"")&&W(n,l)},d(i){i&&y(e)}}}function ea(t){let e,l,n,i=t[13].label+"",o,r,a,c;return{c(){e=Ue("g"),l=Ue("line"),n=Ue("text"),o=C(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",r=t[13].align=="right"?"85%":""),u(e,"class",a="tick tick-"+t[13].value+" tick-"+t[13].color),u(e,"transform",c="translate(0, "+t[6](t[13].value)+")")},m(f,_){$(f,e,_),s(e,l),s(e,n),s(n,o)},p(f,_){_&1&&i!==(i=f[13].label+"")&&W(o,i),_&1&&r!==(r=f[13].align=="right"?"85%":"")&&u(n,"x",r),_&1&&a!==(a="tick tick-"+f[13].value+" tick-"+f[13].color)&&u(e,"class",a),_&65&&c!==(c="translate(0, "+f[6](f[13].value)+")")&&u(e,"transform",c)},d(f){f&&y(e)}}}function ta(t){let e,l=t[9].label+"",n,i;return{c(){e=Ue("text"),n=C(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(o,r){$(o,e,r),s(e,n)},p(o,r){r&1&&l!==(l=o[9].label+"")&&W(n,l),r&8&&i!==(i=o[3]/2)&&u(e,"x",i)},d(o){o&&y(e)}}}function la(t){let e,l,n=(t[3]>20||t[11]%2==0)&&ta(t);return{c(){e=Ue("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[5](t[11])+","+t[4]+")")},m(i,o){$(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[11]%2==0?n?n.p(i,o):(n=ta(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[11])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&y(e),n&&n.d()}}}function na(t){let e,l,n,i,o,r,a,c=t[3]>15&&ia(t);return{c(){e=Ue("rect"),c&&c.c(),a=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](t[9].value)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),u(e,"fill",r=t[9].color)},m(f,_){$(f,e,_),c&&c.m(f,_),$(f,a,_)},p(f,_){_&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),_&65&&n!==(n=f[6](f[9].value))&&u(e,"y",n),_&8&&i!==(i=f[3]-4)&&u(e,"width",i),_&65&&o!==(o=f[6](f[0].y.min)-f[6](Math.min(f[0].y.min,0)+f[9].value))&&u(e,"height",o),_&1&&r!==(r=f[9].color)&&u(e,"fill",r),f[3]>15?c?c.p(f,_):(c=ia(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&y(e),c&&c.d(f),f&&y(a)}}}function ia(t){let e,l=t[9].label+"",n,i,o,r,a,c,f,_,m=t[9].title&&sa(t);return{c(){e=Ue("text"),n=C(l),m&&m.c(),_=We(),u(e,"y",i=t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10),u(e,"x",o=t[5](t[11])+t[3]/2),u(e,"width",r=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",a=t[3]<25?"left":"middle"),u(e,"fill",c=t[6](t[9].value)>t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",f="rotate("+(t[3]<25?90:0)+", "+(t[5](t[11])+t[3]/2)+", "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+9)+")")},m(d,h){$(d,e,h),s(e,n),m&&m.m(d,h),$(d,_,h)},p(d,h){h&1&&l!==(l=d[9].label+"")&&W(n,l),h&193&&i!==(i=d[6](d[9].value)>d[6](0)-d[7]?d[6](d[9].value)-d[7]:d[6](d[9].value)+10)&&u(e,"y",i),h&40&&o!==(o=d[5](d[11])+d[3]/2)&&u(e,"x",o),h&8&&r!==(r=d[3]-4)&&u(e,"width",r),h&8&&a!==(a=d[3]<25?"left":"middle")&&u(e,"text-anchor",a),h&193&&c!==(c=d[6](d[9].value)>d[6](0)-d[7]?d[9].color:"white")&&u(e,"fill",c),h&233&&f!==(f="rotate("+(d[3]<25?90:0)+", "+(d[5](d[11])+d[3]/2)+", "+(d[6](d[9].value)>d[6](0)-d[7]?d[6](d[9].value)-d[7]:d[6](d[9].value)+9)+")")&&u(e,"transform",f),d[9].title?m?m.p(d,h):(m=sa(d),m.c(),m.m(_.parentNode,_)):m&&(m.d(1),m=null)},d(d){d&&y(e),m&&m.d(d),d&&y(_)}}}function sa(t){let e,l=t[9].title+"",n;return{c(){e=Ue("title"),n=C(l)},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[9].title+"")&&W(n,l)},d(i){i&&y(e)}}}function oa(t){let e,l,n,i,o,r,a,c=t[3]>15&&ua(t);return{c(){e=Ue("rect"),c&&c.c(),a=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](0)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),u(e,"fill",r=t[9].color)},m(f,_){$(f,e,_),c&&c.m(f,_),$(f,a,_)},p(f,_){_&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),_&64&&n!==(n=f[6](0))&&u(e,"y",n),_&8&&i!==(i=f[3]-4)&&u(e,"width",i),_&65&&o!==(o=f[6](f[0].y.min)-f[6](f[0].y.min+f[9].value2))&&u(e,"height",o),_&1&&r!==(r=f[9].color)&&u(e,"fill",r),f[3]>15?c?c.p(f,_):(c=ua(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&y(e),c&&c.d(f),f&&y(a)}}}function ua(t){let e,l=t[9].label2+"",n,i,o,r,a,c,f,_,m=t[9].title2&&ra(t);return{c(){e=Ue("text"),n=C(l),m&&m.c(),_=We(),u(e,"y",i=t[6](-t[9].value2)t[6](0)-12?t[6](t[9].value2-t[0].y.min)-12:t[6](t[9].value2-t[0].y.min)+9)+")")},m(d,h){$(d,e,h),s(e,n),m&&m.m(d,h),$(d,_,h)},p(d,h){h&1&&l!==(l=d[9].label2+"")&&W(n,l),h&65&&i!==(i=d[6](-d[9].value2)d[6](0)-12?d[6](d[9].value2-d[0].y.min)-12:d[6](d[9].value2-d[0].y.min)+9)+")")&&u(e,"transform",f),d[9].title2?m?m.p(d,h):(m=ra(d),m.c(),m.m(_.parentNode,_)):m&&(m.d(1),m=null)},d(d){d&&y(e),m&&m.d(d),d&&y(_)}}}function ra(t){let e,l=t[9].title2+"",n;return{c(){e=Ue("title"),n=C(l)},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[9].title2+"")&&W(n,l)},d(i){i&&y(e)}}}function aa(t){let e,l,n=t[9].value!==void 0&&na(t),i=t[9].value2>1e-4&&oa(t);return{c(){e=Ue("g"),n&&n.c(),l=Ue("g"),i&&i.c()},m(o,r){$(o,e,r),n&&n.m(e,null),$(o,l,r),i&&i.m(l,null)},p(o,r){o[9].value!==void 0?n?n.p(o,r):(n=na(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,r):(i=oa(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&y(e),n&&n.d(),o&&y(l),i&&i.d()}}}function Op(t){let e,l,n,i,o,r,a,c=t[0].title&&xr(t),f=t[0].y.ticks,_=[];for(let g=0;gt[8].call(e))},m(g,w){$(g,e,w),c&&c.m(e,null),s(e,l),s(e,n),s(n,i);for(let k=0;k<_.length;k+=1)_[k]&&_[k].m(i,null);s(n,o);for(let k=0;k{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,f=o-(n.title?20:0));let d=i-(n.padding.left+n.padding.right);l(3,r=d/n.points.length),l(7,_=r<25?28:17);let h=(f-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,a=function(v){return v*r+n.padding.left}),l(6,c=function(v){let g=0;return v>n.y.max?g=n.padding.bottom:vf||g<0?0:g})}},[n,i,o,r,f,a,c,_,m]}class zl extends $e{constructor(e){super(),ye(this,e,qp,Op,ke,{config:0})}}function Up(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Hp(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:r}=e,a={};function c(f){return{label:ge(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:Q1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,r=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],_=[];n>0&&(f.push({label:r===1?"L1-L2":"L1"}),_.push(c(n))),i>0&&(f.push({label:r===1?"L1-L3":"L2"}),_.push(c(i))),o>0&&(f.push({label:r===1?"L2-L3":"L3"}),_.push(c(o))),l(0,a={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:_})}},[a,n,i,o,r]}class jp extends $e{constructor(e){super(),ye(this,e,Hp,Up,ke,{u1:1,u2:2,u3:3,ds:4})}}function Wp(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Gp(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:r}=e,{i2:a}=e,{i3:c}=e,{max:f}=e,_={};function m(d){return{label:ge(d)+"A",title:d.toFixed(1)+" A",value:isNaN(d)?0:d,color:fc(d?d/f*100:0)}}return t.$$set=d=>{"u1"in d&&l(1,n=d.u1),"u2"in d&&l(2,i=d.u2),"u3"in d&&l(3,o=d.u3),"i1"in d&&l(4,r=d.i1),"i2"in d&&l(5,a=d.i2),"i3"in d&&l(6,c=d.i3),"max"in d&&l(7,f=d.max)},t.$$.update=()=>{if(t.$$.dirty&254){let d=[],h=[];n>0&&(d.push({label:"L1"}),h.push(m(r))),i>0&&(d.push({label:"L2"}),h.push(m(a))),o>0&&(d.push({label:"L3"}),h.push(m(c))),l(0,_={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:f,ticks:[{value:0,label:"0%"},{value:f/4,label:"25%"},{value:f/2,label:"50%"},{value:f/4*3,label:"75%"},{value:f,label:"100%"}]},x:{ticks:d},points:h})}},[_,n,i,o,r,a,c,f]}class Bp extends $e{constructor(e){super(),ye(this,e,Gp,Wp,ke,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function Yp(t){let e,l,n,i,o,r,a,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,_,m,d,h,v,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",w,k,T,P,E,S,D,F=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",R,B,L,N,O,j,U=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",q,G;return{c(){e=p("div"),l=p("strong"),l.textContent="Reactive",n=b(),i=p("div"),o=p("div"),o.textContent="Instant in",r=b(),a=p("div"),f=C(c),_=C(" VAr"),m=b(),d=p("div"),d.textContent="Instant out",h=b(),v=p("div"),w=C(g),k=C(" VAr"),T=b(),P=p("div"),E=p("div"),E.textContent="Total in",S=b(),D=p("div"),R=C(F),B=C(" kVArh"),L=b(),N=p("div"),N.textContent="Total out",O=b(),j=p("div"),q=C(U),G=C(" kVArh"),u(a,"class","text-right"),u(v,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(D,"class","text-right"),u(j,"class","text-right"),u(P,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(H,V){$(H,e,V),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(i,a),s(a,f),s(a,_),s(i,m),s(i,d),s(i,h),s(i,v),s(v,w),s(v,k),s(e,T),s(e,P),s(P,E),s(P,S),s(P,D),s(D,R),s(D,B),s(P,L),s(P,N),s(P,O),s(P,j),s(j,q),s(j,G)},p(H,[V]){V&1&&c!==(c=(typeof H[0]<"u"?H[0].toFixed(0):"-")+"")&&W(f,c),V&2&&g!==(g=(typeof H[1]<"u"?H[1].toFixed(0):"-")+"")&&W(w,g),V&4&&F!==(F=(typeof H[2]<"u"?H[2].toFixed(1):"-")+"")&&W(R,F),V&8&&U!==(U=(typeof H[3]<"u"?H[3].toFixed(1):"-")+"")&&W(q,U)},i:ie,o:ie,d(H){H&&y(e)}}}function zp(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:r}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,r=a.exportTotal)},[n,i,o,r]}class Vp extends $e{constructor(e){super(),ye(this,e,zp,Yp,ke,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function fa(t){let e;function l(o,r){return o[2]?Qp:Kp}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,r){i.m(o,r),$(o,e,r)},p(o,r){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&y(e)}}}function Kp(t){let e,l,n,i,o,r,a=ge(t[0].h.u,2)+"",c,f,_,m,d,h,v=ge(t[0].d.u,1)+"",g,w,k,T,P,E,S=ge(t[0].m.u)+"",D,F,R,B,L=t[3]&&ca(t);return{c(){e=p("strong"),e.textContent="Consumption",l=b(),n=p("div"),i=p("div"),i.textContent="Hour",o=b(),r=p("div"),c=C(a),f=C(" kWh"),_=b(),m=p("div"),m.textContent="Day",d=b(),h=p("div"),g=C(v),w=C(" kWh"),k=b(),T=p("div"),T.textContent="Month",P=b(),E=p("div"),D=C(S),F=C(" kWh"),R=b(),L&&L.c(),B=We(),u(r,"class","text-right"),u(h,"class","text-right"),u(E,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(N,O){$(N,e,O),$(N,l,O),$(N,n,O),s(n,i),s(n,o),s(n,r),s(r,c),s(r,f),s(n,_),s(n,m),s(n,d),s(n,h),s(h,g),s(h,w),s(n,k),s(n,T),s(n,P),s(n,E),s(E,D),s(E,F),$(N,R,O),L&&L.m(N,O),$(N,B,O)},p(N,O){O&1&&a!==(a=ge(N[0].h.u,2)+"")&&W(c,a),O&1&&v!==(v=ge(N[0].d.u,1)+"")&&W(g,v),O&1&&S!==(S=ge(N[0].m.u)+"")&&W(D,S),N[3]?L?L.p(N,O):(L=ca(N),L.c(),L.m(B.parentNode,B)):L&&(L.d(1),L=null)},d(N){N&&y(e),N&&y(l),N&&y(n),N&&y(R),L&&L.d(N),N&&y(B)}}}function Qp(t){let e,l,n,i,o,r,a=ge(t[0].h.u,2)+"",c,f,_,m,d,h,v,g=ge(t[0].d.u,1)+"",w,k,T,P,E,S,D,F=ge(t[0].m.u)+"",R,B,L,N,O,j,U,q,G,H,V,J=ge(t[0].h.p,2)+"",ne,le,me,Pe,we,Fe,Ce,Re=ge(t[0].d.p,1)+"",_e,Me,Ie,ce,se,pe,K,re=ge(t[0].m.p)+"",Ae,Ne,de,ee,oe=t[3]&&pa(t),ve=t[3]&&ma(t),De=t[3]&&_a(t),Oe=t[3]&&da(t),he=t[3]&&va(t),be=t[3]&&ha(t);return{c(){e=p("strong"),e.textContent="Import",l=b(),n=p("div"),i=p("div"),i.textContent="Hour",o=b(),r=p("div"),c=C(a),f=C(" kWh"),_=b(),oe&&oe.c(),m=b(),d=p("div"),d.textContent="Day",h=b(),v=p("div"),w=C(g),k=C(" kWh"),T=b(),ve&&ve.c(),P=b(),E=p("div"),E.textContent="Month",S=b(),D=p("div"),R=C(F),B=C(" kWh"),L=b(),De&&De.c(),O=b(),j=p("strong"),j.textContent="Export",U=b(),q=p("div"),G=p("div"),G.textContent="Hour",H=b(),V=p("div"),ne=C(J),le=C(" kWh"),me=b(),Oe&&Oe.c(),Pe=b(),we=p("div"),we.textContent="Day",Fe=b(),Ce=p("div"),_e=C(Re),Me=C(" kWh"),Ie=b(),he&&he.c(),ce=b(),se=p("div"),se.textContent="Month",pe=b(),K=p("div"),Ae=C(re),Ne=C(" kWh"),de=b(),be&&be.c(),u(r,"class","text-right"),u(v,"class","text-right"),u(D,"class","text-right"),u(n,"class",N="grid grid-cols-"+t[4]+" mb-3"),u(V,"class","text-right"),u(Ce,"class","text-right"),u(K,"class","text-right"),u(q,"class",ee="grid grid-cols-"+t[4])},m(x,ue){$(x,e,ue),$(x,l,ue),$(x,n,ue),s(n,i),s(n,o),s(n,r),s(r,c),s(r,f),s(n,_),oe&&oe.m(n,null),s(n,m),s(n,d),s(n,h),s(n,v),s(v,w),s(v,k),s(n,T),ve&&ve.m(n,null),s(n,P),s(n,E),s(n,S),s(n,D),s(D,R),s(D,B),s(n,L),De&&De.m(n,null),$(x,O,ue),$(x,j,ue),$(x,U,ue),$(x,q,ue),s(q,G),s(q,H),s(q,V),s(V,ne),s(V,le),s(q,me),Oe&&Oe.m(q,null),s(q,Pe),s(q,we),s(q,Fe),s(q,Ce),s(Ce,_e),s(Ce,Me),s(q,Ie),he&&he.m(q,null),s(q,ce),s(q,se),s(q,pe),s(q,K),s(K,Ae),s(K,Ne),s(q,de),be&&be.m(q,null)},p(x,ue){ue&1&&a!==(a=ge(x[0].h.u,2)+"")&&W(c,a),x[3]?oe?oe.p(x,ue):(oe=pa(x),oe.c(),oe.m(n,m)):oe&&(oe.d(1),oe=null),ue&1&&g!==(g=ge(x[0].d.u,1)+"")&&W(w,g),x[3]?ve?ve.p(x,ue):(ve=ma(x),ve.c(),ve.m(n,P)):ve&&(ve.d(1),ve=null),ue&1&&F!==(F=ge(x[0].m.u)+"")&&W(R,F),x[3]?De?De.p(x,ue):(De=_a(x),De.c(),De.m(n,null)):De&&(De.d(1),De=null),ue&16&&N!==(N="grid grid-cols-"+x[4]+" mb-3")&&u(n,"class",N),ue&1&&J!==(J=ge(x[0].h.p,2)+"")&&W(ne,J),x[3]?Oe?Oe.p(x,ue):(Oe=da(x),Oe.c(),Oe.m(q,Pe)):Oe&&(Oe.d(1),Oe=null),ue&1&&Re!==(Re=ge(x[0].d.p,1)+"")&&W(_e,Re),x[3]?he?he.p(x,ue):(he=va(x),he.c(),he.m(q,ce)):he&&(he.d(1),he=null),ue&1&&re!==(re=ge(x[0].m.p)+"")&&W(Ae,re),x[3]?be?be.p(x,ue):(be=ha(x),be.c(),be.m(q,null)):be&&(be.d(1),be=null),ue&16&&ee!==(ee="grid grid-cols-"+x[4])&&u(q,"class",ee)},d(x){x&&y(e),x&&y(l),x&&y(n),oe&&oe.d(),ve&&ve.d(),De&&De.d(),x&&y(O),x&&y(j),x&&y(U),x&&y(q),Oe&&Oe.d(),he&&he.d(),be&&be.d()}}}function ca(t){let e,l,n,i,o,r,a=ge(t[0].h.c,2)+"",c,f,_,m,d,h,v,g=ge(t[0].d.c,1)+"",w,k,T,P,E,S,D,F=ge(t[0].m.c)+"",R,B,L;return{c(){e=p("strong"),e.textContent="Cost",l=b(),n=p("div"),i=p("div"),i.textContent="Hour",o=b(),r=p("div"),c=C(a),f=b(),_=C(t[1]),m=b(),d=p("div"),d.textContent="Day",h=b(),v=p("div"),w=C(g),k=b(),T=C(t[1]),P=b(),E=p("div"),E.textContent="Month",S=b(),D=p("div"),R=C(F),B=b(),L=C(t[1]),u(r,"class","text-right"),u(v,"class","text-right"),u(D,"class","text-right"),u(n,"class","grid grid-cols-2")},m(N,O){$(N,e,O),$(N,l,O),$(N,n,O),s(n,i),s(n,o),s(n,r),s(r,c),s(r,f),s(r,_),s(n,m),s(n,d),s(n,h),s(n,v),s(v,w),s(v,k),s(v,T),s(n,P),s(n,E),s(n,S),s(n,D),s(D,R),s(D,B),s(D,L)},p(N,O){O&1&&a!==(a=ge(N[0].h.c,2)+"")&&W(c,a),O&2&&W(_,N[1]),O&1&&g!==(g=ge(N[0].d.c,1)+"")&&W(w,g),O&2&&W(T,N[1]),O&1&&F!==(F=ge(N[0].m.c)+"")&&W(R,F),O&2&&W(L,N[1])},d(N){N&&y(e),N&&y(l),N&&y(n)}}}function pa(t){let e,l=ge(t[0].h.c,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=b(),o=C(t[1]),u(e,"class","text-right")},m(r,a){$(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ge(r[0].h.c,2)+"")&&W(n,l),a&2&&W(o,r[1])},d(r){r&&y(e)}}}function ma(t){let e,l=ge(t[0].d.c,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=b(),o=C(t[1]),u(e,"class","text-right")},m(r,a){$(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ge(r[0].d.c,1)+"")&&W(n,l),a&2&&W(o,r[1])},d(r){r&&y(e)}}}function _a(t){let e,l=ge(t[0].m.c)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=b(),o=C(t[1]),u(e,"class","text-right")},m(r,a){$(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ge(r[0].m.c)+"")&&W(n,l),a&2&&W(o,r[1])},d(r){r&&y(e)}}}function da(t){let e,l=ge(t[0].h.i,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=b(),o=C(t[1]),u(e,"class","text-right")},m(r,a){$(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ge(r[0].h.i,2)+"")&&W(n,l),a&2&&W(o,r[1])},d(r){r&&y(e)}}}function va(t){let e,l=ge(t[0].d.i,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=b(),o=C(t[1]),u(e,"class","text-right")},m(r,a){$(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ge(r[0].d.i,1)+"")&&W(n,l),a&2&&W(o,r[1])},d(r){r&&y(e)}}}function ha(t){let e,l=ge(t[0].m.i)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=b(),o=C(t[1]),u(e,"class","text-right")},m(r,a){$(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ge(r[0].m.i)+"")&&W(n,l),a&2&&W(o,r[1])},d(r){r&&y(e)}}}function Xp(t){let e,l,n,i,o,r,a=t[0]&&fa(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Real time calculation",n=b(),i=p("br"),o=p("br"),r=b(),a&&a.c(),u(e,"class","mx-2 text-sm")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,r),a&&a.m(e,null)},p(c,[f]){c[0]?a?a.p(c,f):(a=fa(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:ie,o:ie,d(c){c&&y(e),a&&a.d()}}}function Zp(t,e,l){let{data:n}=e,{currency:i}=e,{hasExport:o}=e,r=!1,a=3;return t.$$set=c=>{"data"in c&&l(0,n=c.data),"currency"in c&&l(1,i=c.currency),"hasExport"in c&&l(2,o=c.hasExport)},t.$$.update=()=>{t.$$.dirty&9&&(l(3,r=n&&n.h&&(n.h.c||n.d.c||n.m.c||n.h.i||n.d.i||n.m.i)),l(4,a=r?3:2))},[n,i,o,r,a]}class Jp extends $e{constructor(e){super(),ye(this,e,Zp,Xp,ke,{data:0,currency:1,hasExport:2})}}function xp(t){let e,l,n,i;return n=new zl({props:{config:t[0]}}),{c(){e=p("a"),e.textContent="Provided by ENTSO-E",l=b(),Z(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,r){$(o,e,r),$(o,l,r),Q(n,o,r),i=!0},p(o,[r]){const a={};r&1&&(a.config=o[0]),n.$set(a)},i(o){i||(M(n.$$.fragment,o),i=!0)},o(o){I(n.$$.fragment,o),i=!1},d(o){o&&y(e),o&&y(l),X(n,o)}}}function em(t,e,l){let{json:n}=e,i={},o=0,r=0;return t.$$set=a=>{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=new Date().getUTCHours(),c=0,f=0,_=0,m=n[20]==null?2:1,d=[],h=[],v=[],g=new Date;for(c=a;c<24&&(f=n[Ee(_++)],f!=null);c++)h.push({label:Ee(g.getHours())}),v.push({label:f>0?f.toFixed(m):"",title:f>0?f.toFixed(2)+" "+n.currency:"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(m):"",title2:f<0?f.toFixed(2)+" "+n.currency:"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,r=Math.min(r,f*100)),l(2,o=Math.max(o,f*100)),fi(g,1);for(c=0;c<24&&(f=n[Ee(_++)],f!=null);c++)h.push({label:Ee(g.getHours())}),v.push({label:f>0?f.toFixed(m):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(m):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,r=Math.min(r,f*100)),l(2,o=Math.max(o,f*100)),fi(g,1);if(l(2,o=Math.ceil(o)),l(3,r=Math.floor(r)),r<0){let k=r/4;for(c=1;c<5;c++){let T=k*c;d.push({value:T,label:(T/100).toFixed(2)})}}let w=o/4;for(c=0;c<5;c++){let k=w*c;d.push({value:k,label:(k/100).toFixed(2)})}l(0,i={title:"Future energy price ("+n.currency+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:r,max:o,ticks:d},x:{ticks:h},points:v})}},[i,n,o,r]}class tm extends $e{constructor(e){super(),ye(this,e,em,xp,ke,{json:1})}}function lm(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function nm(t,e,l){let{json:n}=e,i={},o=0,r=0;return t.$$set=a=>{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=[],f=[],_=[],m=fi(new Date,-24),d=new Date().getUTCHours();for(a=d;a<24;a++){let g=n["i"+Ee(a)],w=n["e"+Ee(a)];g===void 0&&(g=0),w===void 0&&(w=0),f.push({label:Ee(m.getHours())}),_.push({label:g.toFixed(1),title:g.toFixed(2)+" kWh",value:g*10,label2:w.toFixed(1),title2:w.toFixed(2)+" kWh",value2:w*10,color:"#7c3aed"}),l(3,r=Math.max(r,w*10)),l(2,o=Math.max(o,g*10)),fi(m,1)}for(a=0;a{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=[],f=[],_=[],m=new Date,d=new Date;for(d.setDate(0),a=m.getDate();a<=d.getDate();a++){let g=n["i"+Ee(a)],w=n["e"+Ee(a)];g===void 0&&(g=0),w===void 0&&(w=0),f.push({label:Ee(a)}),_.push({label:g.toFixed(g<10?1:0),title:g.toFixed(2)+" kWh",value:g,label2:w.toFixed(w<10?1:0),title2:w.toFixed(2)+" kWh",value2:w,color:"#7c3aed"}),l(3,r=Math.max(r,w)),l(2,o=Math.max(o,g))}for(a=1;a{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=0,f=[],_=[],m=[];n.s&&n.s.forEach((v,g)=>{var w=v.n?v.n:v.a;c=v.v,c==-127&&(c=0),_.push({label:w.slice(-4)}),m.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,r=Math.min(r,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,r=Math.floor(r));let d=o;r<0&&(d+=Math.abs(r));let h=d/4;for(a=0;a<5;a++)c=r+h*a,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (°C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:r,max:o,ticks:f},x:{ticks:_},points:m})}},[i,n,o,r]}class fm extends $e{constructor(e){super(),ye(this,e,am,rm,ke,{json:1})}}function cm(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}let pm=0;function mm(t,e,l){let n={},i=0,o;return hc.subscribe(r=>{l(2,o=r)}),vc(),t.$$.update=()=>{if(t.$$.dirty&6){let r=0,a=[],c=[],f=[];if(a.push({value:0,label:0}),o&&o.p)for(r=0;r0?Ee(_.d)+"."+zs[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,_.v))}if(o&&o.t){for(r=0;r=i)break;a.push({value:_,label:_})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:pm,max:i,ticks:a},x:{ticks:c},points:f})}},[n,i,o]}class _m extends $e{constructor(e){super(),ye(this,e,mm,cm,ke,{})}}function ba(t){let e,l,n,i,o,r,a=(t[0].mt?ds(t[0].mt):"-")+"",c,f,_,m=(t[0].ic?t[0].ic.toFixed(1):"-")+"",d,h,v;return i=new yc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:fc}}),{c(){e=p("div"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=b(),r=p("div"),c=C(a),f=b(),_=p("div"),d=C(m),h=C(" kWh"),u(n,"class","col-span-2"),u(_,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,w){$(g,e,w),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,r),s(r,c),s(l,f),s(l,_),s(_,d),s(_,h),v=!0},p(g,w){const k={};w&1&&(k.val=g[0].i?g[0].i:0),w&1&&(k.max=g[0].im?g[0].im:15e3),w&1&&(k.sub=g[0].p),w&1&&(k.subunit=g[0].pc),i.$set(k),(!v||w&1)&&a!==(a=(g[0].mt?ds(g[0].mt):"-")+"")&&W(c,a),(!v||w&1)&&m!==(m=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&W(d,m)},i(g){v||(M(i.$$.fragment,g),v=!0)},o(g){I(i.$$.fragment,g),v=!1},d(g){g&&y(e),X(i)}}}function ga(t){let e,l,n,i,o,r,a,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,m,d;return i=new yc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:X1}}),{c(){e=p("div"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=b(),r=p("div"),a=b(),c=p("div"),_=C(f),m=C(" kWh"),u(n,"class","col-span-2"),u(c,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(h,v){$(h,e,v),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,r),s(l,a),s(l,c),s(c,_),s(c,m),d=!0},p(h,v){const g={};v&1&&(g.val=h[0].e?h[0].e:0),v&1&&(g.max=h[0].om?h[0].om*1e3:1e4),i.$set(g),(!d||v&1)&&f!==(f=(h[0].ec?h[0].ec.toFixed(1):"-")+"")&&W(_,f)},i(h){d||(M(i.$$.fragment,h),d=!0)},o(h){I(i.$$.fragment,h),d=!1},d(h){h&&y(e),X(i)}}}function ka(t){let e,l,n;return l=new jp({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.ds=i[0].ds),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function wa(t){let e,l,n;return l=new Bp({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.i1=i[0].i1),o&1&&(r.i2=i[0].i2),o&1&&(r.i3=i[0].i3),o&1&&(r.max=i[0].mf?i[0].mf:32),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function ya(t){let e,l,n;return l=new Vp({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.importInstant=i[0].ri),o&1&&(r.exportInstant=i[0].re),o&1&&(r.importTotal=i[0].ric),o&1&&(r.exportTotal=i[0].rec),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function $a(t){let e,l,n;return l=new Jp({props:{data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.data=i[0].ea),o&1&&(r.currency=i[0].pc),o&1&&(r.hasExport=i[0].om>0||i[0].e>0),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function Ca(t){let e,l,n;return l=new _m({}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function Ta(t){let e,l,n;return l=new tm({props:{json:t[2]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&4&&(r.json=i[2]),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function Sa(t){let e,l,n;return l=new im({props:{json:t[3]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&8&&(r.json=i[3]),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function Pa(t){let e,l,n;return l=new um({props:{json:t[4]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&16&&(r.json=i[4]),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function Ma(t){let e,l,n;return l=new fm({props:{json:t[5]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&32&&(r.json=i[5]),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function dm(t){let e,l=je(t[1].ui.i,t[0].i),n,i=je(t[1].ui.e,t[0].om||t[0].e>0),o,r=je(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,c=je(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,_=je(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),m,d=je(t[1].ui.c,t[0].ea),h,v=je(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,w=je(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),k,T=je(t[1].ui.d,t[3]),P,E=je(t[1].ui.m,t[4]),S,D=je(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),F,R=l&&ba(t),B=i&&ga(t),L=r&&ka(t),N=c&&wa(t),O=_&&ya(t),j=d&&$a(t),U=v&&Ca(),q=w&&Ta(t),G=T&&Sa(t),H=E&&Pa(t),V=D&&Ma(t);return{c(){e=p("div"),R&&R.c(),n=b(),B&&B.c(),o=b(),L&&L.c(),a=b(),N&&N.c(),f=b(),O&&O.c(),m=b(),j&&j.c(),h=b(),U&&U.c(),g=b(),q&&q.c(),k=b(),G&&G.c(),P=b(),H&&H.c(),S=b(),V&&V.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(J,ne){$(J,e,ne),R&&R.m(e,null),s(e,n),B&&B.m(e,null),s(e,o),L&&L.m(e,null),s(e,a),N&&N.m(e,null),s(e,f),O&&O.m(e,null),s(e,m),j&&j.m(e,null),s(e,h),U&&U.m(e,null),s(e,g),q&&q.m(e,null),s(e,k),G&&G.m(e,null),s(e,P),H&&H.m(e,null),s(e,S),V&&V.m(e,null),F=!0},p(J,[ne]){ne&3&&(l=je(J[1].ui.i,J[0].i)),l?R?(R.p(J,ne),ne&3&&M(R,1)):(R=ba(J),R.c(),M(R,1),R.m(e,n)):R&&(Te(),I(R,1,1,()=>{R=null}),Se()),ne&3&&(i=je(J[1].ui.e,J[0].om||J[0].e>0)),i?B?(B.p(J,ne),ne&3&&M(B,1)):(B=ga(J),B.c(),M(B,1),B.m(e,o)):B&&(Te(),I(B,1,1,()=>{B=null}),Se()),ne&3&&(r=je(J[1].ui.v,J[0].u1>100||J[0].u2>100||J[0].u3>100)),r?L?(L.p(J,ne),ne&3&&M(L,1)):(L=ka(J),L.c(),M(L,1),L.m(e,a)):L&&(Te(),I(L,1,1,()=>{L=null}),Se()),ne&3&&(c=je(J[1].ui.a,J[0].i1>.01||J[0].i2>.01||J[0].i3>.01)),c?N?(N.p(J,ne),ne&3&&M(N,1)):(N=wa(J),N.c(),M(N,1),N.m(e,f)):N&&(Te(),I(N,1,1,()=>{N=null}),Se()),ne&3&&(_=je(J[1].ui.r,J[0].ri>0||J[0].re>0||J[0].ric>0||J[0].rec>0)),_?O?(O.p(J,ne),ne&3&&M(O,1)):(O=ya(J),O.c(),M(O,1),O.m(e,m)):O&&(Te(),I(O,1,1,()=>{O=null}),Se()),ne&3&&(d=je(J[1].ui.c,J[0].ea)),d?j?(j.p(J,ne),ne&3&&M(j,1)):(j=$a(J),j.c(),M(j,1),j.m(e,h)):j&&(Te(),I(j,1,1,()=>{j=null}),Se()),ne&3&&(v=je(J[1].ui.t,J[0].pr&&(J[0].pr.startsWith("10YNO")||J[0].pr=="10Y1001A1001A48H"))),v?U?ne&3&&M(U,1):(U=Ca(),U.c(),M(U,1),U.m(e,g)):U&&(Te(),I(U,1,1,()=>{U=null}),Se()),ne&3&&(w=je(J[1].ui.p,J[0].pe&&!Number.isNaN(J[0].p))),w?q?(q.p(J,ne),ne&3&&M(q,1)):(q=Ta(J),q.c(),M(q,1),q.m(e,k)):q&&(Te(),I(q,1,1,()=>{q=null}),Se()),ne&10&&(T=je(J[1].ui.d,J[3])),T?G?(G.p(J,ne),ne&10&&M(G,1)):(G=Sa(J),G.c(),M(G,1),G.m(e,P)):G&&(Te(),I(G,1,1,()=>{G=null}),Se()),ne&18&&(E=je(J[1].ui.m,J[4])),E?H?(H.p(J,ne),ne&18&&M(H,1)):(H=Pa(J),H.c(),M(H,1),H.m(e,S)):H&&(Te(),I(H,1,1,()=>{H=null}),Se()),ne&35&&(D=je(J[1].ui.s,J[0].t&&J[0].t!=-127&&J[5].c>1)),D?V?(V.p(J,ne),ne&35&&M(V,1)):(V=Ma(J),V.c(),M(V,1),V.m(e,null)):V&&(Te(),I(V,1,1,()=>{V=null}),Se())},i(J){F||(M(R),M(B),M(L),M(N),M(O),M(j),M(U),M(q),M(G),M(H),M(V),F=!0)},o(J){I(R),I(B),I(L),I(N),I(O),I(j),I(U),I(q),I(G),I(H),I(V),F=!1},d(J){J&&y(e),R&&R.d(),B&&B.d(),L&&L.d(),N&&N.d(),O&&O.d(),j&&j.d(),U&&U.d(),q&&q.d(),G&&G.d(),H&&H.d(),V&&V.d()}}}function vm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},r={},a={},c={};return cc.subscribe(f=>{l(2,o=f)}),pc.subscribe(f=>{l(3,r=f)}),mc.subscribe(f=>{l(4,a=f)}),dc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,r,a,c]}class hm extends $e{constructor(e){super(),ye(this,e,vm,dm,ke,{data:0,sysinfo:1})}}let xs={};const $c=Ze(xs);async function bm(){xs=await(await fetch("/configuration.json")).json(),$c.set(xs)}function Aa(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function gm(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function km(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function Da(t){let e;return{c(){e=p("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function Na(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART1",l=b(),n=p("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){$(i,e,o),$(i,l,o),$(i,n,o)},d(i){i&&y(e),i&&y(l),i&&y(n)}}}function Ia(t){let e;return{c(){e=p("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function Ea(t){let e,l,n;return{c(){e=p("option"),l=C("GPIO"),n=C(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){$(i,e,o),s(e,l),s(e,n)},d(i){i&&y(e)}}}function Fa(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Ea(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Ea(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&y(e)}}}function wm(t){let e,l,n,i,o;function r(v,g){return v[0]=="esp32c3"?km:gm}let a=r(t),c=a(t),f=t[0]=="esp8266"&&Da(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&Na(),m=t[0]=="esp32s2"&&Ia(),d={length:t[1]+1},h=[];for(let v=0;v{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Cc extends $e{constructor(e){super(),ye(this,e,ym,wm,ke,{chip:0})}}function Ra(t){let e,l,n=t[1]&&La(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){$(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=La(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&y(e),n&&n.d()}}}function La(t){let e,l;return{c(){e=p("div"),l=C(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){$(n,e,i),s(e,l)},p(n,i){i&2&&W(l,n[1])},d(n){n&&y(e)}}}function $m(t){let e,l=t[0]&&Ra(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ra(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&y(e)}}}function Cm(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class gt extends $e{constructor(e){super(),ye(this,e,Cm,$m,ke,{active:0,message:1})}}function Oa(t,e,l){const n=t.slice();return n[1]=e[l],n}function qa(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,r){$(o,e,r),s(e,l),s(e,i)},p:ie,d(o){o&&y(e)}}}function Tm(t){let e,l,n,i=t[0],o=[];for(let r=0;r{r[_]=null}),Se(),l=r[e],l||(l=r[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){r[e].d(c),c&&y(n)}}}function Lm(t){let e,l;return e=new Vt({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Om(t){let e,l;return e=new Vt({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function qm(t){let e,l,n,i;const o=[Om,Lm],r=[];function a(c,f){return c[3].q.s.r?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){r[e].m(c,f),$(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e!==_&&(Te(),I(r[_],1,1,()=>{r[_]=null}),Se(),l=r[e],l||(l=r[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){r[e].d(c),c&&y(n)}}}function Um(t){let e,l;return e=new Vt({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Hm(t){let e,l;return e=new Vt({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function jm(t){let e,l,n,i;const o=[Hm,Um],r=[];function a(c,f){return c[3].q.s.k?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){r[e].m(c,f),$(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e!==_&&(Te(),I(r[_],1,1,()=>{r[_]=null}),Se(),l=r[e],l||(l=r[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){r[e].d(c),c&&y(n)}}}function Qa(t){let e,l,n,i,o,r,a,c,f,_,m,d,h,v,g,w,k,T,P,E,S,D,F,R,B,L,N,O,j,U,q,G;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Domoticz",n=b(),i=p("a"),Z(o.$$.fragment),r=b(),a=p("input"),c=b(),f=p("div"),_=p("div"),m=C("Electricity IDX"),d=p("br"),h=b(),v=p("input"),g=b(),w=p("div"),k=C("Current IDX"),T=p("br"),P=b(),E=p("input"),S=b(),D=p("div"),F=C(`Voltage IDX: L1, L2 & L3 + `),o.c(),l=We()},m(r,a){$(r,e,a),o.m(r,a),$(r,l,a)},p(r,a){i===(i=n(r))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},d(r){r&&y(e),o.d(r),r&&y(l)}}}function lp(t){let e,l;return{c(){e=C(t[0]),l=C(" seconds")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&1&&W(e,n[0])},d(n){n&&y(e),n&&y(l)}}}function np(t){let e,l;return{c(){e=C(t[3]),l=C(" minute")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&8&&W(e,n[3])},d(n){n&&y(e),n&&y(l)}}}function ip(t){let e,l;return{c(){e=C(t[3]),l=C(" minutes")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&8&&W(e,n[3])},d(n){n&&y(e),n&&y(l)}}}function sp(t){let e,l;return{c(){e=C(t[2]),l=C(" hour")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&4&&W(e,n[2])},d(n){n&&y(e),n&&y(l)}}}function op(t){let e,l;return{c(){e=C(t[2]),l=C(" hours")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&4&&W(e,n[2])},d(n){n&&y(e),n&&y(l)}}}function up(t){let e,l;return{c(){e=C(t[1]),l=C(" day")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&2&&W(e,n[1])},d(n){n&&y(e),n&&y(l)}}}function rp(t){let e,l;return{c(){e=C(t[1]),l=C(" days")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&2&&W(e,n[1])},d(n){n&&y(e),n&&y(l)}}}function ap(t){let e,l=t[0]&&jr(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=jr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&y(e)}}}function fp(t,e,l){let{epoch:n}=e,i=0,o=0,r=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,r=Math.floor(n/60)))},[n,i,o,r]}class cp extends $e{constructor(e){super(),ye(this,e,fp,ap,ke,{epoch:0})}}function pp(t){let e,l,n;return{c(){e=p("span"),l=C(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){$(i,e,o),s(e,l)},p(i,[o]){o&4&&W(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ie,o:ie,d(i){i&&y(e)}}}function mp(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=r=>{"color"in r&&l(0,n=r.color),"title"in r&&l(1,i=r.title),"text"in r&&l(2,o=r.text)},[n,i,o]}class Vt extends $e{constructor(e){super(),ye(this,e,mp,pp,ke,{color:0,title:1,text:2})}}function _p(t){let e,l=`${Ee(t[0].getDate())}.${Ee(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ee(t[0].getHours())}:${Ee(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=C(l),u(e,"class",t[1])},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ee(i[0].getDate())}.${Ee(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ee(i[0].getHours())}:${Ee(i[0].getMinutes())}`)&&W(n,l),o&2&&u(e,"class",i[1])},d(i){i&&y(e)}}}function dp(t){let e=`${Ee(t[0].getDate())}. ${zs[t[0].getMonth()]} ${Ee(t[0].getHours())}:${Ee(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(n,i){$(n,l,i)},p(n,i){i&1&&e!==(e=`${Ee(n[0].getDate())}. ${zs[n[0].getMonth()]} ${Ee(n[0].getHours())}:${Ee(n[0].getMinutes())}`)&&W(l,e)},d(n){n&&y(l)}}}function vp(t){let e,l;function n(r,a){return a&1&&(e=null),e==null&&(e=Math.abs(new Date().getTime()-r[0].getTime())<3e5),e?dp:_p}let i=n(t,-1),o=i(t);return{c(){o.c(),l=We()},m(r,a){o.m(r,a),$(r,l,a)},p(r,[a]){i===(i=n(r,a))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},i:ie,o:ie,d(r){o.d(r),r&&y(l)}}}function hp(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e;return t.$$set=o=>{"timestamp"in o&&l(0,n=o.timestamp),"fullTimeColor"in o&&l(1,i=o.fullTimeColor)},[n,i]}class kc extends $e{constructor(e){super(),ye(this,e,hp,vp,ke,{timestamp:0,fullTimeColor:1})}}function bp(t){let e,l,n;return{c(){e=Ue("svg"),l=Ue("path"),n=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){$(i,e,o),s(e,l),s(e,n)},p:ie,i:ie,o:ie,d(i){i&&y(e)}}}class gp extends $e{constructor(e){super(),ye(this,e,null,bp,ke,{})}}function kp(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&y(e)}}}class wp extends $e{constructor(e){super(),ye(this,e,null,kp,ke,{})}}function yp(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&y(e)}}}class $t extends $e{constructor(e){super(),ye(this,e,null,yp,ke,{})}}function $p(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&y(e)}}}class wc extends $e{constructor(e){super(),ye(this,e,null,$p,ke,{})}}function Cp(t){let e,l,n=t[1].version+"",i;return{c(){e=C("AMS reader "),l=p("span"),i=C(n)},m(o,r){$(o,e,r),$(o,l,r),s(l,i)},p(o,r){r&2&&n!==(n=o[1].version+"")&&W(i,n)},d(o){o&&y(e),o&&y(l)}}}function Wr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=C(l),i=C("°C"),u(e,"class","flex-none my-auto")},m(o,r){$(o,e,r),s(e,n),s(e,i)},p(o,r){r&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&W(n,l)},d(o){o&&y(e)}}}function Gr(t){let e,l="HAN: "+Rr(t[0].he),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Rr(i[0].he))&&W(n,l)},d(i){i&&y(e)}}}function Br(t){let e,l="MQTT: "+Lr(t[0].me),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Lr(i[0].me))&&W(n,l)},d(i){i&&y(e)}}}function Yr(t){let e,l="PriceAPI: "+Or(t[0].ee),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Or(i[0].ee))&&W(n,l)},d(i){i&&y(e)}}}function zr(t){let e,l,n,i,o,r;return l=new kl({props:{to:"/configuration",$$slots:{default:[Tp]},$$scope:{ctx:t}}}),o=new kl({props:{to:"/status",$$slots:{default:[Sp]},$$scope:{ctx:t}}}),{c(){e=p("div"),Z(l.$$.fragment),n=b(),i=p("div"),Z(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(a,c){$(a,e,c),Q(l,e,null),$(a,n,c),$(a,i,c),Q(o,i,null),r=!0},i(a){r||(M(l.$$.fragment,a),M(o.$$.fragment,a),r=!0)},o(a){I(l.$$.fragment,a),I(o.$$.fragment,a),r=!1},d(a){a&&y(e),X(l),a&&y(n),a&&y(i),X(o)}}}function Tp(t){let e,l;return e=new gp({}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Sp(t){let e,l;return e=new wp({}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Vr(t){let e,l,n,i,o;const r=[Mp,Pp],a=[];function c(f,_){return f[1].security==0||f[0].a?0:1}return l=c(t),n=a[l]=r[l](t),{c(){e=p("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(f,_){$(f,e,_),a[l].m(e,null),o=!0},p(f,_){let m=l;l=c(f),l===m?a[l].p(f,_):(Te(),I(a[m],1,1,()=>{a[m]=null}),Se(),n=a[l],n?n.p(f,_):(n=a[l]=r[l](f),n.c()),M(n,1),n.m(e,null)),(!o||_&4&&i!==(i="New version: "+f[2].tag_name))&&u(e,"title",i)},i(f){o||(M(n),o=!0)},o(f){I(n),o=!1},d(f){f&&y(e),a[l].d()}}}function Pp(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=p("span"),l=C("New version: "),i=C(n)},m(o,r){$(o,e,r),s(e,l),s(e,i)},p(o,r){r&4&&n!==(n=o[2].tag_name+"")&&W(i,n)},i:ie,o:ie,d(o){o&&y(e)}}}function Mp(t){let e,l,n,i=t[2].tag_name+"",o,r,a,c,f,_;return a=new wc({}),{c(){e=p("button"),l=p("span"),n=C("New version: "),o=C(i),r=b(),Z(a.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(m,d){$(m,e,d),s(e,l),s(l,n),s(l,o),s(e,r),Q(a,e,null),c=!0,f||(_=z(e,"click",t[3]),f=!0)},p(m,d){(!c||d&4)&&i!==(i=m[2].tag_name+"")&&W(o,i)},i(m){c||(M(a.$$.fragment,m),c=!0)},o(m){I(a.$$.fragment,m),c=!1},d(m){m&&y(e),X(a),f=!1,_()}}}function Ap(t){let e,l,n,i,o,r,a,c,f,_,m,d,h=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",v,g,w,k,T,P,E,S,D,F,R,B,L,N,O,j,U,q,G,H,V,J,ne,le,me,Pe,we,Fe,Ce,Re;i=new kl({props:{to:"/",$$slots:{default:[Cp]},$$scope:{ctx:t}}}),c=new cp({props:{epoch:t[0].u}});let _e=t[0].t>-50&&Wr(t);T=new Vt({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:gl(t[1].booting?2:t[0].em)}}),E=new Vt({props:{title:"HAN",text:"HAN",color:gl(t[1].booting?9:t[0].hm)}}),D=new Vt({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:gl(t[1].booting?9:t[0].wm)}}),R=new Vt({props:{title:"MQTT",text:"MQTT",color:gl(t[1].booting?9:t[0].mm)}});let Me=(t[0].he<0||t[0].he>0)&&Gr(t),Ie=t[0].me<0&&Br(t),ce=(t[0].ee>0||t[0].ee<0)&&Yr(t);ne=new kc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),fullTimeColor:"text-red-500"}});let se=t[1].vndcfg&&t[1].usrcfg&&zr(t);Fe=new $t({});let pe=t[1].fwconsent===1&&t[2]&&Vr(t);return{c(){e=p("nav"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=b(),r=p("div"),a=p("div"),Z(c.$$.fragment),f=b(),_e&&_e.c(),_=b(),m=p("div"),d=C("Free mem: "),v=C(h),g=C("kb"),w=b(),k=p("div"),Z(T.$$.fragment),P=b(),Z(E.$$.fragment),S=b(),Z(D.$$.fragment),F=b(),Z(R.$$.fragment),B=b(),Me&&Me.c(),L=b(),Ie&&Ie.c(),N=b(),ce&&ce.c(),O=b(),j=p("div"),U=p("div"),q=p("a"),G=p("img"),V=b(),J=p("div"),Z(ne.$$.fragment),le=b(),se&&se.c(),me=b(),Pe=p("div"),we=p("a"),Z(Fe.$$.fragment),Ce=b(),pe&&pe.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(a,"class","flex-none my-auto"),u(m,"class","flex-none my-auto"),u(r,"class","flex-none my-auto p-2 flex space-x-4"),u(k,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(G,"class","gh-logo"),Mc(G.src,H=tp)||u(G,"src",H),u(G,"alt","GitHub repo"),u(q,"class","float-right"),u(q,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(q,"target","_blank"),u(q,"rel","noreferrer"),u(q,"aria-label","GitHub"),u(U,"class","flex-none"),u(J,"class","flex-none my-auto px-2"),u(we,"href",Ct("")),u(we,"target","_blank"),u(we,"rel","noreferrer"),u(Pe,"class","flex-none px-1 mt-1"),u(Pe,"title","Documentation"),u(j,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(K,re){$(K,e,re),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,r),s(r,a),Q(c,a,null),s(r,f),_e&&_e.m(r,null),s(r,_),s(r,m),s(m,d),s(m,v),s(m,g),s(l,w),s(l,k),Q(T,k,null),s(k,P),Q(E,k,null),s(k,S),Q(D,k,null),s(k,F),Q(R,k,null),s(l,B),Me&&Me.m(l,null),s(l,L),Ie&&Ie.m(l,null),s(l,N),ce&&ce.m(l,null),s(l,O),s(l,j),s(j,U),s(U,q),s(q,G),s(j,V),s(j,J),Q(ne,J,null),s(j,le),se&&se.m(j,null),s(j,me),s(j,Pe),s(Pe,we),Q(Fe,we,null),s(j,Ce),pe&&pe.m(j,null),Re=!0},p(K,[re]){const Ae={};re&18&&(Ae.$$scope={dirty:re,ctx:K}),i.$set(Ae);const Ne={};re&1&&(Ne.epoch=K[0].u),c.$set(Ne),K[0].t>-50?_e?_e.p(K,re):(_e=Wr(K),_e.c(),_e.m(r,_)):_e&&(_e.d(1),_e=null),(!Re||re&1)&&h!==(h=(K[0].m?(K[0].m/1e3).toFixed(1):"-")+"")&&W(v,h);const de={};re&3&&(de.text=K[1].booting?"Booting":K[0].v>2?K[0].v.toFixed(2)+"V":"ESP"),re&3&&(de.color=gl(K[1].booting?2:K[0].em)),T.$set(de);const ee={};re&3&&(ee.color=gl(K[1].booting?9:K[0].hm)),E.$set(ee);const oe={};re&1&&(oe.text=K[0].r?K[0].r.toFixed(0)+"dBm":"WiFi"),re&3&&(oe.color=gl(K[1].booting?9:K[0].wm)),D.$set(oe);const ve={};re&3&&(ve.color=gl(K[1].booting?9:K[0].mm)),R.$set(ve),K[0].he<0||K[0].he>0?Me?Me.p(K,re):(Me=Gr(K),Me.c(),Me.m(l,L)):Me&&(Me.d(1),Me=null),K[0].me<0?Ie?Ie.p(K,re):(Ie=Br(K),Ie.c(),Ie.m(l,N)):Ie&&(Ie.d(1),Ie=null),K[0].ee>0||K[0].ee<0?ce?ce.p(K,re):(ce=Yr(K),ce.c(),ce.m(l,O)):ce&&(ce.d(1),ce=null);const De={};re&1&&(De.timestamp=K[0].c?new Date(K[0].c*1e3):new Date(0)),ne.$set(De),K[1].vndcfg&&K[1].usrcfg?se?re&2&&M(se,1):(se=zr(K),se.c(),M(se,1),se.m(j,me)):se&&(Te(),I(se,1,1,()=>{se=null}),Se()),K[1].fwconsent===1&&K[2]?pe?(pe.p(K,re),re&6&&M(pe,1)):(pe=Vr(K),pe.c(),M(pe,1),pe.m(j,null)):pe&&(Te(),I(pe,1,1,()=>{pe=null}),Se())},i(K){Re||(M(i.$$.fragment,K),M(c.$$.fragment,K),M(T.$$.fragment,K),M(E.$$.fragment,K),M(D.$$.fragment,K),M(R.$$.fragment,K),M(ne.$$.fragment,K),M(se),M(Fe.$$.fragment,K),M(pe),Re=!0)},o(K){I(i.$$.fragment,K),I(c.$$.fragment,K),I(T.$$.fragment,K),I(E.$$.fragment,K),I(D.$$.fragment,K),I(R.$$.fragment,K),I(ne.$$.fragment,K),I(se),I(Fe.$$.fragment,K),I(pe),Re=!1},d(K){K&&y(e),X(i),X(c),_e&&_e.d(),X(T),X(E),X(D),X(R),Me&&Me.d(),Ie&&Ie.d(),ce&&ce.d(),X(ne),se&&se.d(),X(Fe),pe&&pe.d()}}}function Dp(t,e,l){let{data:n={}}=e,i={},o={};function r(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!zn(i.board)||confirm(vs(fe(i.chip,i.board))))&&(Tt.update(a=>(a.upgrading=!0,a)),bc(o.tag_name))}return Tt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&ep()}),mo.subscribe(a=>{l(2,o=gc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,r]}class Np extends $e{constructor(e){super(),ye(this,e,Dp,Ap,ke,{data:0})}}function Ip(t){let e,l,n,i;return{c(){e=Ue("svg"),l=Ue("path"),n=Ue("path"),u(l,"d",js(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=js(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,r){$(o,e,r),s(e,l),s(e,n)},p(o,[r]){r&1&&i!==(i=js(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),r&2&&u(n,"stroke",o[1])},i:ie,o:ie,d(o){o&&y(e)}}}function Kr(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 js(t,e,l,n,i){var o=Kr(t,e,l,i),r=Kr(t,e,l,n),a=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,a,0,r.x,r.y].join(" ");return c}function Ep(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class Fp extends $e{constructor(e){super(),ye(this,e,Ep,Ip,ke,{pct:0,color:1})}}function Qr(t){let e,l,n,i,o,r,a,c;return{c(){e=p("br"),l=b(),n=p("span"),i=C(t[3]),o=b(),r=p("span"),a=C(t[4]),c=C("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(f,_){$(f,e,_),$(f,l,_),$(f,n,_),s(n,i),$(f,o,_),$(f,r,_),s(r,a),s(r,c)},p(f,_){_&8&&W(i,f[3]),_&16&&W(a,f[4])},d(f){f&&y(e),f&&y(l),f&&y(n),f&&y(o),f&&y(r)}}}function Rp(t){let e,l,n,i,o,r,a,c,f,_,m,d,h,v,g,w;l=new Fp({props:{pct:t[6],color:t[5](t[6])}});let k=t[3]&&Qr(t);return{c(){e=p("div"),Z(l.$$.fragment),n=b(),i=p("span"),o=p("span"),r=C(t[2]),a=b(),c=p("br"),f=b(),_=p("span"),m=C(t[0]),d=b(),h=p("span"),v=C(t[1]),g=b(),k&&k.c(),u(o,"class","pl-lab"),u(_,"class","pl-val"),u(h,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(T,P){$(T,e,P),Q(l,e,null),s(e,n),s(e,i),s(i,o),s(o,r),s(i,a),s(i,c),s(i,f),s(i,_),s(_,m),s(i,d),s(i,h),s(h,v),s(i,g),k&&k.m(i,null),w=!0},p(T,[P]){const E={};P&64&&(E.pct=T[6]),P&96&&(E.color=T[5](T[6])),l.$set(E),(!w||P&4)&&W(r,T[2]),(!w||P&1)&&W(m,T[0]),(!w||P&2)&&W(v,T[1]),T[3]?k?k.p(T,P):(k=Qr(T),k.c(),k.m(i,null)):k&&(k.d(1),k=null)},i(T){w||(M(l.$$.fragment,T),w=!0)},o(T){I(l.$$.fragment,T),w=!1},d(T){T&&y(e),X(l),k&&k.d()}}}function Lp(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:r}=e,{sub:a=""}=e,{subunit:c=""}=e,{colorFn:f}=e,_=0;return t.$$set=m=>{"val"in m&&l(0,n=m.val),"max"in m&&l(7,i=m.max),"unit"in m&&l(1,o=m.unit),"label"in m&&l(2,r=m.label),"sub"in m&&l(3,a=m.sub),"subunit"in m&&l(4,c=m.subunit),"colorFn"in m&&l(5,f=m.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,o,r,a,c,f,_,i]}class yc extends $e{constructor(e){super(),ye(this,e,Lp,Rp,ke,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Xr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Zr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Jr(t,e,l){const n=t.slice();return n[13]=e[l],n}function xr(t){let e,l=t[0].title+"",n;return{c(){e=p("strong"),n=C(l),u(e,"class","text-sm")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[0].title+"")&&W(n,l)},d(i){i&&y(e)}}}function ea(t){let e,l,n,i=t[13].label+"",o,r,a,c;return{c(){e=Ue("g"),l=Ue("line"),n=Ue("text"),o=C(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",r=t[13].align=="right"?"85%":""),u(e,"class",a="tick tick-"+t[13].value+" tick-"+t[13].color),u(e,"transform",c="translate(0, "+t[6](t[13].value)+")")},m(f,_){$(f,e,_),s(e,l),s(e,n),s(n,o)},p(f,_){_&1&&i!==(i=f[13].label+"")&&W(o,i),_&1&&r!==(r=f[13].align=="right"?"85%":"")&&u(n,"x",r),_&1&&a!==(a="tick tick-"+f[13].value+" tick-"+f[13].color)&&u(e,"class",a),_&65&&c!==(c="translate(0, "+f[6](f[13].value)+")")&&u(e,"transform",c)},d(f){f&&y(e)}}}function ta(t){let e,l=t[9].label+"",n,i;return{c(){e=Ue("text"),n=C(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(o,r){$(o,e,r),s(e,n)},p(o,r){r&1&&l!==(l=o[9].label+"")&&W(n,l),r&8&&i!==(i=o[3]/2)&&u(e,"x",i)},d(o){o&&y(e)}}}function la(t){let e,l,n=(t[3]>20||t[11]%2==0)&&ta(t);return{c(){e=Ue("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[5](t[11])+","+t[4]+")")},m(i,o){$(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[11]%2==0?n?n.p(i,o):(n=ta(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[11])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&y(e),n&&n.d()}}}function na(t){let e,l,n,i,o,r,a,c=t[3]>15&&ia(t);return{c(){e=Ue("rect"),c&&c.c(),a=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](t[9].value)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),u(e,"fill",r=t[9].color)},m(f,_){$(f,e,_),c&&c.m(f,_),$(f,a,_)},p(f,_){_&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),_&65&&n!==(n=f[6](f[9].value))&&u(e,"y",n),_&8&&i!==(i=f[3]-4)&&u(e,"width",i),_&65&&o!==(o=f[6](f[0].y.min)-f[6](Math.min(f[0].y.min,0)+f[9].value))&&u(e,"height",o),_&1&&r!==(r=f[9].color)&&u(e,"fill",r),f[3]>15?c?c.p(f,_):(c=ia(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&y(e),c&&c.d(f),f&&y(a)}}}function ia(t){let e,l=t[9].label+"",n,i,o,r,a,c,f,_,m=t[9].title&&sa(t);return{c(){e=Ue("text"),n=C(l),m&&m.c(),_=We(),u(e,"y",i=t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10),u(e,"x",o=t[5](t[11])+t[3]/2),u(e,"width",r=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",a=t[3]<25?"left":"middle"),u(e,"fill",c=t[6](t[9].value)>t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",f="rotate("+(t[3]<25?90:0)+", "+(t[5](t[11])+t[3]/2)+", "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+9)+")")},m(d,h){$(d,e,h),s(e,n),m&&m.m(d,h),$(d,_,h)},p(d,h){h&1&&l!==(l=d[9].label+"")&&W(n,l),h&193&&i!==(i=d[6](d[9].value)>d[6](0)-d[7]?d[6](d[9].value)-d[7]:d[6](d[9].value)+10)&&u(e,"y",i),h&40&&o!==(o=d[5](d[11])+d[3]/2)&&u(e,"x",o),h&8&&r!==(r=d[3]-4)&&u(e,"width",r),h&8&&a!==(a=d[3]<25?"left":"middle")&&u(e,"text-anchor",a),h&193&&c!==(c=d[6](d[9].value)>d[6](0)-d[7]?d[9].color:"white")&&u(e,"fill",c),h&233&&f!==(f="rotate("+(d[3]<25?90:0)+", "+(d[5](d[11])+d[3]/2)+", "+(d[6](d[9].value)>d[6](0)-d[7]?d[6](d[9].value)-d[7]:d[6](d[9].value)+9)+")")&&u(e,"transform",f),d[9].title?m?m.p(d,h):(m=sa(d),m.c(),m.m(_.parentNode,_)):m&&(m.d(1),m=null)},d(d){d&&y(e),m&&m.d(d),d&&y(_)}}}function sa(t){let e,l=t[9].title+"",n;return{c(){e=Ue("title"),n=C(l)},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[9].title+"")&&W(n,l)},d(i){i&&y(e)}}}function oa(t){let e,l,n,i,o,r,a,c=t[3]>15&&ua(t);return{c(){e=Ue("rect"),c&&c.c(),a=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](0)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),u(e,"fill",r=t[9].color)},m(f,_){$(f,e,_),c&&c.m(f,_),$(f,a,_)},p(f,_){_&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),_&64&&n!==(n=f[6](0))&&u(e,"y",n),_&8&&i!==(i=f[3]-4)&&u(e,"width",i),_&65&&o!==(o=f[6](f[0].y.min)-f[6](f[0].y.min+f[9].value2))&&u(e,"height",o),_&1&&r!==(r=f[9].color)&&u(e,"fill",r),f[3]>15?c?c.p(f,_):(c=ua(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&y(e),c&&c.d(f),f&&y(a)}}}function ua(t){let e,l=t[9].label2+"",n,i,o,r,a,c,f,_,m=t[9].title2&&ra(t);return{c(){e=Ue("text"),n=C(l),m&&m.c(),_=We(),u(e,"y",i=t[6](-t[9].value2)t[6](0)-12?t[6](t[9].value2-t[0].y.min)-12:t[6](t[9].value2-t[0].y.min)+9)+")")},m(d,h){$(d,e,h),s(e,n),m&&m.m(d,h),$(d,_,h)},p(d,h){h&1&&l!==(l=d[9].label2+"")&&W(n,l),h&65&&i!==(i=d[6](-d[9].value2)d[6](0)-12?d[6](d[9].value2-d[0].y.min)-12:d[6](d[9].value2-d[0].y.min)+9)+")")&&u(e,"transform",f),d[9].title2?m?m.p(d,h):(m=ra(d),m.c(),m.m(_.parentNode,_)):m&&(m.d(1),m=null)},d(d){d&&y(e),m&&m.d(d),d&&y(_)}}}function ra(t){let e,l=t[9].title2+"",n;return{c(){e=Ue("title"),n=C(l)},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[9].title2+"")&&W(n,l)},d(i){i&&y(e)}}}function aa(t){let e,l,n=t[9].value!==void 0&&na(t),i=t[9].value2>1e-4&&oa(t);return{c(){e=Ue("g"),n&&n.c(),l=Ue("g"),i&&i.c()},m(o,r){$(o,e,r),n&&n.m(e,null),$(o,l,r),i&&i.m(l,null)},p(o,r){o[9].value!==void 0?n?n.p(o,r):(n=na(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,r):(i=oa(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&y(e),n&&n.d(),o&&y(l),i&&i.d()}}}function Op(t){let e,l,n,i,o,r,a,c=t[0].title&&xr(t),f=t[0].y.ticks,_=[];for(let g=0;gt[8].call(e))},m(g,w){$(g,e,w),c&&c.m(e,null),s(e,l),s(e,n),s(n,i);for(let k=0;k<_.length;k+=1)_[k]&&_[k].m(i,null);s(n,o);for(let k=0;k{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,f=o-(n.title?20:0));let d=i-(n.padding.left+n.padding.right);l(3,r=d/n.points.length),l(7,_=r<25?28:17);let h=(f-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,a=function(v){return v*r+n.padding.left}),l(6,c=function(v){let g=0;return v>n.y.max?g=n.padding.bottom:vf||g<0?0:g})}},[n,i,o,r,f,a,c,_,m]}class zl extends $e{constructor(e){super(),ye(this,e,qp,Op,ke,{config:0})}}function Up(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Hp(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:r}=e,a={};function c(f){return{label:ge(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:Q1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,r=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],_=[];n>0&&(f.push({label:r===1?"L1-L2":"L1"}),_.push(c(n))),i>0&&(f.push({label:r===1?"L1-L3":"L2"}),_.push(c(i))),o>0&&(f.push({label:r===1?"L2-L3":"L3"}),_.push(c(o))),l(0,a={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:_})}},[a,n,i,o,r]}class jp extends $e{constructor(e){super(),ye(this,e,Hp,Up,ke,{u1:1,u2:2,u3:3,ds:4})}}function Wp(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Gp(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:r}=e,{i2:a}=e,{i3:c}=e,{max:f}=e,_={};function m(d){return{label:ge(d)+"A",title:d.toFixed(1)+" A",value:isNaN(d)?0:d,color:fc(d?d/f*100:0)}}return t.$$set=d=>{"u1"in d&&l(1,n=d.u1),"u2"in d&&l(2,i=d.u2),"u3"in d&&l(3,o=d.u3),"i1"in d&&l(4,r=d.i1),"i2"in d&&l(5,a=d.i2),"i3"in d&&l(6,c=d.i3),"max"in d&&l(7,f=d.max)},t.$$.update=()=>{if(t.$$.dirty&254){let d=[],h=[];n>0&&(d.push({label:"L1"}),h.push(m(r))),i>0&&(d.push({label:"L2"}),h.push(m(a))),o>0&&(d.push({label:"L3"}),h.push(m(c))),l(0,_={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:f,ticks:[{value:0,label:"0%"},{value:f/4,label:"25%"},{value:f/2,label:"50%"},{value:f/4*3,label:"75%"},{value:f,label:"100%"}]},x:{ticks:d},points:h})}},[_,n,i,o,r,a,c,f]}class Bp extends $e{constructor(e){super(),ye(this,e,Gp,Wp,ke,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function Yp(t){let e,l,n,i,o,r,a,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,_,m,d,h,v,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",w,k,T,P,E,S,D,F=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",R,B,L,N,O,j,U=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",q,G;return{c(){e=p("div"),l=p("strong"),l.textContent="Reactive",n=b(),i=p("div"),o=p("div"),o.textContent="Instant in",r=b(),a=p("div"),f=C(c),_=C(" VAr"),m=b(),d=p("div"),d.textContent="Instant out",h=b(),v=p("div"),w=C(g),k=C(" VAr"),T=b(),P=p("div"),E=p("div"),E.textContent="Total in",S=b(),D=p("div"),R=C(F),B=C(" kVArh"),L=b(),N=p("div"),N.textContent="Total out",O=b(),j=p("div"),q=C(U),G=C(" kVArh"),u(a,"class","text-right"),u(v,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(D,"class","text-right"),u(j,"class","text-right"),u(P,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(H,V){$(H,e,V),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(i,a),s(a,f),s(a,_),s(i,m),s(i,d),s(i,h),s(i,v),s(v,w),s(v,k),s(e,T),s(e,P),s(P,E),s(P,S),s(P,D),s(D,R),s(D,B),s(P,L),s(P,N),s(P,O),s(P,j),s(j,q),s(j,G)},p(H,[V]){V&1&&c!==(c=(typeof H[0]<"u"?H[0].toFixed(0):"-")+"")&&W(f,c),V&2&&g!==(g=(typeof H[1]<"u"?H[1].toFixed(0):"-")+"")&&W(w,g),V&4&&F!==(F=(typeof H[2]<"u"?H[2].toFixed(1):"-")+"")&&W(R,F),V&8&&U!==(U=(typeof H[3]<"u"?H[3].toFixed(1):"-")+"")&&W(q,U)},i:ie,o:ie,d(H){H&&y(e)}}}function zp(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:r}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,r=a.exportTotal)},[n,i,o,r]}class Vp extends $e{constructor(e){super(),ye(this,e,zp,Yp,ke,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function fa(t){let e;function l(o,r){return o[2]?Qp:Kp}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,r){i.m(o,r),$(o,e,r)},p(o,r){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&y(e)}}}function Kp(t){let e,l,n,i,o,r,a=ge(t[0].h.u,2)+"",c,f,_,m,d,h,v=ge(t[0].d.u,1)+"",g,w,k,T,P,E,S=ge(t[0].m.u)+"",D,F,R,B,L=t[3]&&ca(t);return{c(){e=p("strong"),e.textContent="Consumption",l=b(),n=p("div"),i=p("div"),i.textContent="Hour",o=b(),r=p("div"),c=C(a),f=C(" kWh"),_=b(),m=p("div"),m.textContent="Day",d=b(),h=p("div"),g=C(v),w=C(" kWh"),k=b(),T=p("div"),T.textContent="Month",P=b(),E=p("div"),D=C(S),F=C(" kWh"),R=b(),L&&L.c(),B=We(),u(r,"class","text-right"),u(h,"class","text-right"),u(E,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(N,O){$(N,e,O),$(N,l,O),$(N,n,O),s(n,i),s(n,o),s(n,r),s(r,c),s(r,f),s(n,_),s(n,m),s(n,d),s(n,h),s(h,g),s(h,w),s(n,k),s(n,T),s(n,P),s(n,E),s(E,D),s(E,F),$(N,R,O),L&&L.m(N,O),$(N,B,O)},p(N,O){O&1&&a!==(a=ge(N[0].h.u,2)+"")&&W(c,a),O&1&&v!==(v=ge(N[0].d.u,1)+"")&&W(g,v),O&1&&S!==(S=ge(N[0].m.u)+"")&&W(D,S),N[3]?L?L.p(N,O):(L=ca(N),L.c(),L.m(B.parentNode,B)):L&&(L.d(1),L=null)},d(N){N&&y(e),N&&y(l),N&&y(n),N&&y(R),L&&L.d(N),N&&y(B)}}}function Qp(t){let e,l,n,i,o,r,a=ge(t[0].h.u,2)+"",c,f,_,m,d,h,v,g=ge(t[0].d.u,1)+"",w,k,T,P,E,S,D,F=ge(t[0].m.u)+"",R,B,L,N,O,j,U,q,G,H,V,J=ge(t[0].h.p,2)+"",ne,le,me,Pe,we,Fe,Ce,Re=ge(t[0].d.p,1)+"",_e,Me,Ie,ce,se,pe,K,re=ge(t[0].m.p)+"",Ae,Ne,de,ee,oe=t[3]&&pa(t),ve=t[3]&&ma(t),De=t[3]&&_a(t),Oe=t[3]&&da(t),he=t[3]&&va(t),be=t[3]&&ha(t);return{c(){e=p("strong"),e.textContent="Import",l=b(),n=p("div"),i=p("div"),i.textContent="Hour",o=b(),r=p("div"),c=C(a),f=C(" kWh"),_=b(),oe&&oe.c(),m=b(),d=p("div"),d.textContent="Day",h=b(),v=p("div"),w=C(g),k=C(" kWh"),T=b(),ve&&ve.c(),P=b(),E=p("div"),E.textContent="Month",S=b(),D=p("div"),R=C(F),B=C(" kWh"),L=b(),De&&De.c(),O=b(),j=p("strong"),j.textContent="Export",U=b(),q=p("div"),G=p("div"),G.textContent="Hour",H=b(),V=p("div"),ne=C(J),le=C(" kWh"),me=b(),Oe&&Oe.c(),Pe=b(),we=p("div"),we.textContent="Day",Fe=b(),Ce=p("div"),_e=C(Re),Me=C(" kWh"),Ie=b(),he&&he.c(),ce=b(),se=p("div"),se.textContent="Month",pe=b(),K=p("div"),Ae=C(re),Ne=C(" kWh"),de=b(),be&&be.c(),u(r,"class","text-right"),u(v,"class","text-right"),u(D,"class","text-right"),u(n,"class",N="grid grid-cols-"+t[4]+" mb-3"),u(V,"class","text-right"),u(Ce,"class","text-right"),u(K,"class","text-right"),u(q,"class",ee="grid grid-cols-"+t[4])},m(x,ue){$(x,e,ue),$(x,l,ue),$(x,n,ue),s(n,i),s(n,o),s(n,r),s(r,c),s(r,f),s(n,_),oe&&oe.m(n,null),s(n,m),s(n,d),s(n,h),s(n,v),s(v,w),s(v,k),s(n,T),ve&&ve.m(n,null),s(n,P),s(n,E),s(n,S),s(n,D),s(D,R),s(D,B),s(n,L),De&&De.m(n,null),$(x,O,ue),$(x,j,ue),$(x,U,ue),$(x,q,ue),s(q,G),s(q,H),s(q,V),s(V,ne),s(V,le),s(q,me),Oe&&Oe.m(q,null),s(q,Pe),s(q,we),s(q,Fe),s(q,Ce),s(Ce,_e),s(Ce,Me),s(q,Ie),he&&he.m(q,null),s(q,ce),s(q,se),s(q,pe),s(q,K),s(K,Ae),s(K,Ne),s(q,de),be&&be.m(q,null)},p(x,ue){ue&1&&a!==(a=ge(x[0].h.u,2)+"")&&W(c,a),x[3]?oe?oe.p(x,ue):(oe=pa(x),oe.c(),oe.m(n,m)):oe&&(oe.d(1),oe=null),ue&1&&g!==(g=ge(x[0].d.u,1)+"")&&W(w,g),x[3]?ve?ve.p(x,ue):(ve=ma(x),ve.c(),ve.m(n,P)):ve&&(ve.d(1),ve=null),ue&1&&F!==(F=ge(x[0].m.u)+"")&&W(R,F),x[3]?De?De.p(x,ue):(De=_a(x),De.c(),De.m(n,null)):De&&(De.d(1),De=null),ue&16&&N!==(N="grid grid-cols-"+x[4]+" mb-3")&&u(n,"class",N),ue&1&&J!==(J=ge(x[0].h.p,2)+"")&&W(ne,J),x[3]?Oe?Oe.p(x,ue):(Oe=da(x),Oe.c(),Oe.m(q,Pe)):Oe&&(Oe.d(1),Oe=null),ue&1&&Re!==(Re=ge(x[0].d.p,1)+"")&&W(_e,Re),x[3]?he?he.p(x,ue):(he=va(x),he.c(),he.m(q,ce)):he&&(he.d(1),he=null),ue&1&&re!==(re=ge(x[0].m.p)+"")&&W(Ae,re),x[3]?be?be.p(x,ue):(be=ha(x),be.c(),be.m(q,null)):be&&(be.d(1),be=null),ue&16&&ee!==(ee="grid grid-cols-"+x[4])&&u(q,"class",ee)},d(x){x&&y(e),x&&y(l),x&&y(n),oe&&oe.d(),ve&&ve.d(),De&&De.d(),x&&y(O),x&&y(j),x&&y(U),x&&y(q),Oe&&Oe.d(),he&&he.d(),be&&be.d()}}}function ca(t){let e,l,n,i,o,r,a=ge(t[0].h.c,2)+"",c,f,_,m,d,h,v,g=ge(t[0].d.c,1)+"",w,k,T,P,E,S,D,F=ge(t[0].m.c)+"",R,B,L;return{c(){e=p("strong"),e.textContent="Cost",l=b(),n=p("div"),i=p("div"),i.textContent="Hour",o=b(),r=p("div"),c=C(a),f=b(),_=C(t[1]),m=b(),d=p("div"),d.textContent="Day",h=b(),v=p("div"),w=C(g),k=b(),T=C(t[1]),P=b(),E=p("div"),E.textContent="Month",S=b(),D=p("div"),R=C(F),B=b(),L=C(t[1]),u(r,"class","text-right"),u(v,"class","text-right"),u(D,"class","text-right"),u(n,"class","grid grid-cols-2")},m(N,O){$(N,e,O),$(N,l,O),$(N,n,O),s(n,i),s(n,o),s(n,r),s(r,c),s(r,f),s(r,_),s(n,m),s(n,d),s(n,h),s(n,v),s(v,w),s(v,k),s(v,T),s(n,P),s(n,E),s(n,S),s(n,D),s(D,R),s(D,B),s(D,L)},p(N,O){O&1&&a!==(a=ge(N[0].h.c,2)+"")&&W(c,a),O&2&&W(_,N[1]),O&1&&g!==(g=ge(N[0].d.c,1)+"")&&W(w,g),O&2&&W(T,N[1]),O&1&&F!==(F=ge(N[0].m.c)+"")&&W(R,F),O&2&&W(L,N[1])},d(N){N&&y(e),N&&y(l),N&&y(n)}}}function pa(t){let e,l=ge(t[0].h.c,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=b(),o=C(t[1]),u(e,"class","text-right")},m(r,a){$(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ge(r[0].h.c,2)+"")&&W(n,l),a&2&&W(o,r[1])},d(r){r&&y(e)}}}function ma(t){let e,l=ge(t[0].d.c,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=b(),o=C(t[1]),u(e,"class","text-right")},m(r,a){$(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ge(r[0].d.c,1)+"")&&W(n,l),a&2&&W(o,r[1])},d(r){r&&y(e)}}}function _a(t){let e,l=ge(t[0].m.c)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=b(),o=C(t[1]),u(e,"class","text-right")},m(r,a){$(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ge(r[0].m.c)+"")&&W(n,l),a&2&&W(o,r[1])},d(r){r&&y(e)}}}function da(t){let e,l=ge(t[0].h.i,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=b(),o=C(t[1]),u(e,"class","text-right")},m(r,a){$(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ge(r[0].h.i,2)+"")&&W(n,l),a&2&&W(o,r[1])},d(r){r&&y(e)}}}function va(t){let e,l=ge(t[0].d.i,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=b(),o=C(t[1]),u(e,"class","text-right")},m(r,a){$(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ge(r[0].d.i,1)+"")&&W(n,l),a&2&&W(o,r[1])},d(r){r&&y(e)}}}function ha(t){let e,l=ge(t[0].m.i)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=b(),o=C(t[1]),u(e,"class","text-right")},m(r,a){$(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ge(r[0].m.i)+"")&&W(n,l),a&2&&W(o,r[1])},d(r){r&&y(e)}}}function Xp(t){let e,l,n,i,o,r,a=t[0]&&fa(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Real time calculation",n=b(),i=p("br"),o=p("br"),r=b(),a&&a.c(),u(e,"class","mx-2 text-sm")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,r),a&&a.m(e,null)},p(c,[f]){c[0]?a?a.p(c,f):(a=fa(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:ie,o:ie,d(c){c&&y(e),a&&a.d()}}}function Zp(t,e,l){let{data:n}=e,{currency:i}=e,{hasExport:o}=e,r=!1,a=3;return t.$$set=c=>{"data"in c&&l(0,n=c.data),"currency"in c&&l(1,i=c.currency),"hasExport"in c&&l(2,o=c.hasExport)},t.$$.update=()=>{t.$$.dirty&9&&(l(3,r=n&&n.h&&(n.h.c||n.d.c||n.m.c||n.h.i||n.d.i||n.m.i)),l(4,a=r?3:2))},[n,i,o,r,a]}class Jp extends $e{constructor(e){super(),ye(this,e,Zp,Xp,ke,{data:0,currency:1,hasExport:2})}}function xp(t){let e,l,n,i;return n=new zl({props:{config:t[0]}}),{c(){e=p("a"),e.textContent="Provided by ENTSO-E",l=b(),Z(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,r){$(o,e,r),$(o,l,r),Q(n,o,r),i=!0},p(o,[r]){const a={};r&1&&(a.config=o[0]),n.$set(a)},i(o){i||(M(n.$$.fragment,o),i=!0)},o(o){I(n.$$.fragment,o),i=!1},d(o){o&&y(e),o&&y(l),X(n,o)}}}function em(t,e,l){let{json:n}=e,i={},o=0,r=0;return t.$$set=a=>{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=new Date().getUTCHours(),c=0,f=0,_=0,m=n[20]==null?2:1,d=[],h=[],v=[],g=new Date;for(c=a;c<24&&(f=n[Ee(_++)],f!=null);c++)h.push({label:Ee(g.getHours())}),v.push({label:f>0?f.toFixed(m):"",title:f>0?f.toFixed(2)+" "+n.currency:"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(m):"",title2:f<0?f.toFixed(2)+" "+n.currency:"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,r=Math.min(r,f*100)),l(2,o=Math.max(o,f*100)),fi(g,1);for(c=0;c<24&&(f=n[Ee(_++)],f!=null);c++)h.push({label:Ee(g.getHours())}),v.push({label:f>0?f.toFixed(m):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(m):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,r=Math.min(r,f*100)),l(2,o=Math.max(o,f*100)),fi(g,1);if(l(2,o=Math.ceil(o)),l(3,r=Math.floor(r)),r<0){let k=r/4;for(c=1;c<5;c++){let T=k*c;d.push({value:T,label:(T/100).toFixed(2)})}}let w=o/4;for(c=0;c<5;c++){let k=w*c;d.push({value:k,label:(k/100).toFixed(2)})}l(0,i={title:"Future energy price ("+n.currency+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:r,max:o,ticks:d},x:{ticks:h},points:v})}},[i,n,o,r]}class tm extends $e{constructor(e){super(),ye(this,e,em,xp,ke,{json:1})}}function lm(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function nm(t,e,l){let{json:n}=e,i={},o=0,r=0;return t.$$set=a=>{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=[],f=[],_=[],m=fi(new Date,-24),d=new Date().getUTCHours();for(a=d;a<24;a++){let g=n["i"+Ee(a)],w=n["e"+Ee(a)];g===void 0&&(g=0),w===void 0&&(w=0),f.push({label:Ee(m.getHours())}),_.push({label:g.toFixed(1),title:g.toFixed(2)+" kWh",value:g*10,label2:w.toFixed(1),title2:w.toFixed(2)+" kWh",value2:w*10,color:"#7c3aed"}),l(3,r=Math.max(r,w*10)),l(2,o=Math.max(o,g*10)),fi(m,1)}for(a=0;a{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=[],f=[],_=[],m=new Date,d=new Date;for(d.setDate(0),a=m.getDate();a<=d.getDate();a++){let g=n["i"+Ee(a)],w=n["e"+Ee(a)];g===void 0&&(g=0),w===void 0&&(w=0),f.push({label:Ee(a)}),_.push({label:g.toFixed(g<10?1:0),title:g.toFixed(2)+" kWh",value:g,label2:w.toFixed(w<10?1:0),title2:w.toFixed(2)+" kWh",value2:w,color:"#7c3aed"}),l(3,r=Math.max(r,w)),l(2,o=Math.max(o,g))}for(a=1;a{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=0,f=[],_=[],m=[];n.s&&n.s.forEach((v,g)=>{var w=v.n?v.n:v.a;c=v.v,c==-127&&(c=0),_.push({label:w.slice(-4)}),m.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,r=Math.min(r,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,r=Math.floor(r));let d=o;r<0&&(d+=Math.abs(r));let h=d/4;for(a=0;a<5;a++)c=r+h*a,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (°C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:r,max:o,ticks:f},x:{ticks:_},points:m})}},[i,n,o,r]}class fm extends $e{constructor(e){super(),ye(this,e,am,rm,ke,{json:1})}}function cm(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}let pm=0;function mm(t,e,l){let n={},i=0,o;return hc.subscribe(r=>{l(2,o=r)}),vc(),t.$$.update=()=>{if(t.$$.dirty&6){let r=0,a=[],c=[],f=[];if(a.push({value:0,label:0}),o&&o.p)for(r=0;r0?Ee(_.d)+"."+zs[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,_.v))}if(o&&o.t){for(r=0;r=i)break;a.push({value:_,label:_})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:pm,max:i,ticks:a},x:{ticks:c},points:f})}},[n,i,o]}class _m extends $e{constructor(e){super(),ye(this,e,mm,cm,ke,{})}}function ba(t){let e,l,n,i,o,r,a=(t[0].mt?ds(t[0].mt):"-")+"",c,f,_,m=(t[0].ic?t[0].ic.toFixed(1):"-")+"",d,h,v;return i=new yc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:fc}}),{c(){e=p("div"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=b(),r=p("div"),c=C(a),f=b(),_=p("div"),d=C(m),h=C(" kWh"),u(n,"class","col-span-2"),u(_,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,w){$(g,e,w),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,r),s(r,c),s(l,f),s(l,_),s(_,d),s(_,h),v=!0},p(g,w){const k={};w&1&&(k.val=g[0].i?g[0].i:0),w&1&&(k.max=g[0].im?g[0].im:15e3),w&1&&(k.sub=g[0].p),w&1&&(k.subunit=g[0].pc),i.$set(k),(!v||w&1)&&a!==(a=(g[0].mt?ds(g[0].mt):"-")+"")&&W(c,a),(!v||w&1)&&m!==(m=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&W(d,m)},i(g){v||(M(i.$$.fragment,g),v=!0)},o(g){I(i.$$.fragment,g),v=!1},d(g){g&&y(e),X(i)}}}function ga(t){let e,l,n,i,o,r,a,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,m,d;return i=new yc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:X1}}),{c(){e=p("div"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=b(),r=p("div"),a=b(),c=p("div"),_=C(f),m=C(" kWh"),u(n,"class","col-span-2"),u(c,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(h,v){$(h,e,v),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,r),s(l,a),s(l,c),s(c,_),s(c,m),d=!0},p(h,v){const g={};v&1&&(g.val=h[0].e?h[0].e:0),v&1&&(g.max=h[0].om?h[0].om*1e3:1e4),i.$set(g),(!d||v&1)&&f!==(f=(h[0].ec?h[0].ec.toFixed(1):"-")+"")&&W(_,f)},i(h){d||(M(i.$$.fragment,h),d=!0)},o(h){I(i.$$.fragment,h),d=!1},d(h){h&&y(e),X(i)}}}function ka(t){let e,l,n;return l=new jp({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.ds=i[0].ds),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function wa(t){let e,l,n;return l=new Bp({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.i1=i[0].i1),o&1&&(r.i2=i[0].i2),o&1&&(r.i3=i[0].i3),o&1&&(r.max=i[0].mf?i[0].mf:32),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function ya(t){let e,l,n;return l=new Vp({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.importInstant=i[0].ri),o&1&&(r.exportInstant=i[0].re),o&1&&(r.importTotal=i[0].ric),o&1&&(r.exportTotal=i[0].rec),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function $a(t){let e,l,n;return l=new Jp({props:{data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.data=i[0].ea),o&1&&(r.currency=i[0].pc),o&1&&(r.hasExport=i[0].om>0||i[0].e>0),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function Ca(t){let e,l,n;return l=new _m({}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function Ta(t){let e,l,n;return l=new tm({props:{json:t[2]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&4&&(r.json=i[2]),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function Sa(t){let e,l,n;return l=new im({props:{json:t[3]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&8&&(r.json=i[3]),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function Pa(t){let e,l,n;return l=new um({props:{json:t[4]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&16&&(r.json=i[4]),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function Ma(t){let e,l,n;return l=new fm({props:{json:t[5]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&32&&(r.json=i[5]),l.$set(r)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function dm(t){let e,l=je(t[1].ui.i,t[0].i),n,i=je(t[1].ui.e,t[0].om||t[0].e>0),o,r=je(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,c=je(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,_=je(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),m,d=je(t[1].ui.c,t[0].ea),h,v=je(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,w=je(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),k,T=je(t[1].ui.d,t[3]),P,E=je(t[1].ui.m,t[4]),S,D=je(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),F,R=l&&ba(t),B=i&&ga(t),L=r&&ka(t),N=c&&wa(t),O=_&&ya(t),j=d&&$a(t),U=v&&Ca(),q=w&&Ta(t),G=T&&Sa(t),H=E&&Pa(t),V=D&&Ma(t);return{c(){e=p("div"),R&&R.c(),n=b(),B&&B.c(),o=b(),L&&L.c(),a=b(),N&&N.c(),f=b(),O&&O.c(),m=b(),j&&j.c(),h=b(),U&&U.c(),g=b(),q&&q.c(),k=b(),G&&G.c(),P=b(),H&&H.c(),S=b(),V&&V.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(J,ne){$(J,e,ne),R&&R.m(e,null),s(e,n),B&&B.m(e,null),s(e,o),L&&L.m(e,null),s(e,a),N&&N.m(e,null),s(e,f),O&&O.m(e,null),s(e,m),j&&j.m(e,null),s(e,h),U&&U.m(e,null),s(e,g),q&&q.m(e,null),s(e,k),G&&G.m(e,null),s(e,P),H&&H.m(e,null),s(e,S),V&&V.m(e,null),F=!0},p(J,[ne]){ne&3&&(l=je(J[1].ui.i,J[0].i)),l?R?(R.p(J,ne),ne&3&&M(R,1)):(R=ba(J),R.c(),M(R,1),R.m(e,n)):R&&(Te(),I(R,1,1,()=>{R=null}),Se()),ne&3&&(i=je(J[1].ui.e,J[0].om||J[0].e>0)),i?B?(B.p(J,ne),ne&3&&M(B,1)):(B=ga(J),B.c(),M(B,1),B.m(e,o)):B&&(Te(),I(B,1,1,()=>{B=null}),Se()),ne&3&&(r=je(J[1].ui.v,J[0].u1>100||J[0].u2>100||J[0].u3>100)),r?L?(L.p(J,ne),ne&3&&M(L,1)):(L=ka(J),L.c(),M(L,1),L.m(e,a)):L&&(Te(),I(L,1,1,()=>{L=null}),Se()),ne&3&&(c=je(J[1].ui.a,J[0].i1>.01||J[0].i2>.01||J[0].i3>.01)),c?N?(N.p(J,ne),ne&3&&M(N,1)):(N=wa(J),N.c(),M(N,1),N.m(e,f)):N&&(Te(),I(N,1,1,()=>{N=null}),Se()),ne&3&&(_=je(J[1].ui.r,J[0].ri>0||J[0].re>0||J[0].ric>0||J[0].rec>0)),_?O?(O.p(J,ne),ne&3&&M(O,1)):(O=ya(J),O.c(),M(O,1),O.m(e,m)):O&&(Te(),I(O,1,1,()=>{O=null}),Se()),ne&3&&(d=je(J[1].ui.c,J[0].ea)),d?j?(j.p(J,ne),ne&3&&M(j,1)):(j=$a(J),j.c(),M(j,1),j.m(e,h)):j&&(Te(),I(j,1,1,()=>{j=null}),Se()),ne&3&&(v=je(J[1].ui.t,J[0].pr&&(J[0].pr.startsWith("10YNO")||J[0].pr=="10Y1001A1001A48H"))),v?U?ne&3&&M(U,1):(U=Ca(),U.c(),M(U,1),U.m(e,g)):U&&(Te(),I(U,1,1,()=>{U=null}),Se()),ne&3&&(w=je(J[1].ui.p,J[0].pe&&!Number.isNaN(J[0].p))),w?q?(q.p(J,ne),ne&3&&M(q,1)):(q=Ta(J),q.c(),M(q,1),q.m(e,k)):q&&(Te(),I(q,1,1,()=>{q=null}),Se()),ne&10&&(T=je(J[1].ui.d,J[3])),T?G?(G.p(J,ne),ne&10&&M(G,1)):(G=Sa(J),G.c(),M(G,1),G.m(e,P)):G&&(Te(),I(G,1,1,()=>{G=null}),Se()),ne&18&&(E=je(J[1].ui.m,J[4])),E?H?(H.p(J,ne),ne&18&&M(H,1)):(H=Pa(J),H.c(),M(H,1),H.m(e,S)):H&&(Te(),I(H,1,1,()=>{H=null}),Se()),ne&35&&(D=je(J[1].ui.s,J[0].t&&J[0].t!=-127&&J[5].c>1)),D?V?(V.p(J,ne),ne&35&&M(V,1)):(V=Ma(J),V.c(),M(V,1),V.m(e,null)):V&&(Te(),I(V,1,1,()=>{V=null}),Se())},i(J){F||(M(R),M(B),M(L),M(N),M(O),M(j),M(U),M(q),M(G),M(H),M(V),F=!0)},o(J){I(R),I(B),I(L),I(N),I(O),I(j),I(U),I(q),I(G),I(H),I(V),F=!1},d(J){J&&y(e),R&&R.d(),B&&B.d(),L&&L.d(),N&&N.d(),O&&O.d(),j&&j.d(),U&&U.d(),q&&q.d(),G&&G.d(),H&&H.d(),V&&V.d()}}}function vm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},r={},a={},c={};return cc.subscribe(f=>{l(2,o=f)}),pc.subscribe(f=>{l(3,r=f)}),mc.subscribe(f=>{l(4,a=f)}),dc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,r,a,c]}class hm extends $e{constructor(e){super(),ye(this,e,vm,dm,ke,{data:0,sysinfo:1})}}let xs={};const $c=Ze(xs);async function bm(){xs=await(await fetch("/configuration.json")).json(),$c.set(xs)}function Aa(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function gm(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function km(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function Da(t){let e;return{c(){e=p("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function Na(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART1",l=b(),n=p("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){$(i,e,o),$(i,l,o),$(i,n,o)},d(i){i&&y(e),i&&y(l),i&&y(n)}}}function Ia(t){let e;return{c(){e=p("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function Ea(t){let e,l,n;return{c(){e=p("option"),l=C("GPIO"),n=C(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){$(i,e,o),s(e,l),s(e,n)},d(i){i&&y(e)}}}function Fa(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Ea(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Ea(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&y(e)}}}function wm(t){let e,l,n,i,o;function r(v,g){return v[0]=="esp32c3"?km:gm}let a=r(t),c=a(t),f=t[0]=="esp8266"&&Da(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&Na(),m=t[0]=="esp32s2"&&Ia(),d={length:t[1]+1},h=[];for(let v=0;v{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Cc extends $e{constructor(e){super(),ye(this,e,ym,wm,ke,{chip:0})}}function Ra(t){let e,l,n=t[1]&&La(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){$(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=La(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&y(e),n&&n.d()}}}function La(t){let e,l;return{c(){e=p("div"),l=C(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){$(n,e,i),s(e,l)},p(n,i){i&2&&W(l,n[1])},d(n){n&&y(e)}}}function $m(t){let e,l=t[0]&&Ra(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ra(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&y(e)}}}function Cm(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class gt extends $e{constructor(e){super(),ye(this,e,Cm,$m,ke,{active:0,message:1})}}function Oa(t,e,l){const n=t.slice();return n[1]=e[l],n}function qa(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,r){$(o,e,r),s(e,l),s(e,i)},p:ie,d(o){o&&y(e)}}}function Tm(t){let e,l,n,i=t[0],o=[];for(let r=0;r{r[_]=null}),Se(),l=r[e],l||(l=r[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){r[e].d(c),c&&y(n)}}}function Lm(t){let e,l;return e=new Vt({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Om(t){let e,l;return e=new Vt({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function qm(t){let e,l,n,i;const o=[Om,Lm],r=[];function a(c,f){return c[3].q.s.r?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){r[e].m(c,f),$(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e!==_&&(Te(),I(r[_],1,1,()=>{r[_]=null}),Se(),l=r[e],l||(l=r[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){r[e].d(c),c&&y(n)}}}function Um(t){let e,l;return e=new Vt({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Hm(t){let e,l;return e=new Vt({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function jm(t){let e,l,n,i;const o=[Hm,Um],r=[];function a(c,f){return c[3].q.s.k?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){r[e].m(c,f),$(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e!==_&&(Te(),I(r[_],1,1,()=>{r[_]=null}),Se(),l=r[e],l||(l=r[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){r[e].d(c),c&&y(n)}}}function Qa(t){let e,l,n,i,o,r,a,c,f,_,m,d,h,v,g,w,k,T,P,E,S,D,F,R,B,L,N,O,j,U,q,G;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Domoticz",n=b(),i=p("a"),Z(o.$$.fragment),r=b(),a=p("input"),c=b(),f=p("div"),_=p("div"),m=C("Electricity IDX"),d=p("br"),h=b(),v=p("input"),g=b(),w=p("div"),k=C("Current IDX"),T=p("br"),P=b(),E=p("input"),S=b(),D=p("div"),F=C(`Voltage IDX: L1, L2 & L3 `),R=p("div"),B=p("input"),L=b(),N=p("input"),O=b(),j=p("input"),u(l,"class","text-sm"),u(i,"href",Ct("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","o"),a.value="true",u(v,"name","oe"),u(v,"type","text"),u(v,"class","in-f tr w-full"),u(_,"class","w-1/2"),u(E,"name","oc"),u(E,"type","text"),u(E,"class","in-l tr w-full"),u(w,"class","w-1/2"),u(f,"class","my-1 flex"),u(B,"name","ou1"),u(B,"type","text"),u(B,"class","in-f tr w-1/3"),u(N,"name","ou2"),u(N,"type","text"),u(N,"class","in-m tr w-1/3"),u(j,"name","ou3"),u(j,"type","text"),u(j,"class","in-l tr w-1/3"),u(R,"class","flex"),u(D,"class","my-1"),u(e,"class","cnt")},m(H,V){$(H,e,V),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,r),s(e,a),s(e,c),s(e,f),s(f,_),s(_,m),s(_,d),s(_,h),s(_,v),Y(v,t[3].o.e),s(f,g),s(f,w),s(w,k),s(w,T),s(w,P),s(w,E),Y(E,t[3].o.c),s(e,S),s(e,D),s(D,F),s(D,R),s(R,B),Y(B,t[3].o.u1),s(R,L),s(R,N),Y(N,t[3].o.u2),s(R,O),s(R,j),Y(j,t[3].o.u3),U=!0,q||(G=[z(v,"input",t[59]),z(E,"input",t[60]),z(B,"input",t[61]),z(N,"input",t[62]),z(j,"input",t[63])],q=!0)},p(H,V){V[0]&8&&v.value!==H[3].o.e&&Y(v,H[3].o.e),V[0]&8&&E.value!==H[3].o.c&&Y(E,H[3].o.c),V[0]&8&&B.value!==H[3].o.u1&&Y(B,H[3].o.u1),V[0]&8&&N.value!==H[3].o.u2&&Y(N,H[3].o.u2),V[0]&8&&j.value!==H[3].o.u3&&Y(j,H[3].o.u3)},i(H){U||(M(o.$$.fragment,H),U=!0)},o(H){I(o.$$.fragment,H),U=!1},d(H){H&&y(e),X(o),q=!1,Be(G)}}}function Xa(t){let e,l,n,i,o,r,a,c,f,_,m,d,h,v,g,w,k,T,P,E,S,D,F,R,B,L,N,O,j;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Home-Assistant",n=b(),i=p("a"),Z(o.$$.fragment),r=b(),a=p("input"),c=b(),f=p("div"),_=C("Discovery topic prefix"),m=p("br"),d=b(),h=p("input"),v=b(),g=p("div"),w=C("Hostname for URL"),k=p("br"),T=b(),P=p("input"),S=b(),D=p("div"),F=C("Name tag"),R=p("br"),B=b(),L=p("input"),u(l,"class","text-sm"),u(i,"href",Ct("MQTT-configuration#home-assistant")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","h"),a.value="true",u(h,"name","ht"),u(h,"type","text"),u(h,"class","in-s"),u(h,"placeholder","homeassistant"),u(f,"class","my-1"),u(P,"name","hh"),u(P,"type","text"),u(P,"class","in-s"),u(P,"placeholder",E=t[3].g.h+".local"),u(g,"class","my-1"),u(L,"name","hn"),u(L,"type","text"),u(L,"class","in-s"),u(D,"class","my-1"),u(e,"class","cnt")},m(U,q){$(U,e,q),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,r),s(e,a),s(e,c),s(e,f),s(f,_),s(f,m),s(f,d),s(f,h),Y(h,t[3].h.t),s(e,v),s(e,g),s(g,w),s(g,k),s(g,T),s(g,P),Y(P,t[3].h.h),s(e,S),s(e,D),s(D,F),s(D,R),s(D,B),s(D,L),Y(L,t[3].h.n),N=!0,O||(j=[z(h,"input",t[64]),z(P,"input",t[65]),z(L,"input",t[66])],O=!0)},p(U,q){q[0]&8&&h.value!==U[3].h.t&&Y(h,U[3].h.t),(!N||q[0]&8&&E!==(E=U[3].g.h+".local"))&&u(P,"placeholder",E),q[0]&8&&P.value!==U[3].h.h&&Y(P,U[3].h.h),q[0]&8&&L.value!==U[3].h.n&&Y(L,U[3].h.n)},i(U){N||(M(o.$$.fragment,U),N=!0)},o(U){I(o.$$.fragment,U),N=!1},d(U){U&&y(e),X(o),O=!1,Be(j)}}}function Za(t){let e,l,n,i,o,r,a,c,f,_,m,d,h,v,g,w,k,T,P;o=new $t({});let E={length:9},S=[];for(let D=0;D20&&tf(t),_=t[0].chip=="esp8266"&&sf(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Hardware",n=b(),i=p("a"),Z(o.$$.fragment),r=b(),f&&f.c(),a=b(),_&&_.c(),u(l,"class","text-sm"),u(i,"href",Ct("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(m,d){$(m,e,d),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,r),f&&f.m(e,null),s(e,a),_&&_.m(e,null),c=!0},p(m,d){m[0].board>20?f?(f.p(m,d),d[0]&1&&M(f,1)):(f=tf(m),f.c(),M(f,1),f.m(e,a)):f&&(Te(),I(f,1,1,()=>{f=null}),Se()),m[0].chip=="esp8266"?_?_.p(m,d):(_=sf(m),_.c(),_.m(e,null)):_&&(_.d(1),_=null)},i(m){c||(M(o.$$.fragment,m),M(f),c=!0)},o(m){I(o.$$.fragment,m),I(f),c=!1},d(m){m&&y(e),X(o),f&&f.d(),_&&_.d()}}}function tf(t){let e,l,n,i,o,r,a,c,f,_,m,d,h,v,g,w,k,T,P,E,S,D,F,R,B,L,N,O,j,U,q,G,H,V,J,ne,le,me,Pe,we,Fe,Ce,Re,_e,Me,Ie,ce,se,pe,K,re,Ae,Ne,de,ee,oe,ve,De,Oe;d=new Cc({props:{chip:t[0].chip}});let he=t[0].chip!="esp8266"&&lf(t),be=t[3].i.v.p>0&&nf(t);return{c(){e=p("input"),l=b(),n=p("div"),i=p("div"),o=C("HAN"),r=p("label"),a=p("input"),c=C(" pullup"),f=p("br"),_=b(),m=p("select"),Z(d.$$.fragment),h=b(),v=p("div"),g=C("AP button"),w=p("br"),k=b(),T=p("input"),P=b(),E=p("div"),S=C("LED"),D=p("label"),F=p("input"),R=C(" inv"),B=p("br"),L=b(),N=p("div"),O=p("input"),j=b(),U=p("div"),q=C("RGB"),G=p("label"),H=p("input"),V=C(" inverted"),J=p("br"),ne=b(),le=p("div"),me=p("input"),Pe=b(),we=p("input"),Fe=b(),Ce=p("input"),Re=b(),_e=p("div"),Me=C("Temperature"),Ie=p("br"),ce=b(),se=p("input"),pe=b(),K=p("div"),re=C("Analog temp"),Ae=p("br"),Ne=b(),de=p("input"),ee=b(),he&&he.c(),oe=b(),be&&be.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(a,"name","ihu"),a.__value="true",a.value=a.__value,u(a,"type","checkbox"),u(a,"class","rounded mb-1"),u(r,"class","ml-2"),u(m,"name","ihp"),u(m,"class","in-f w-full"),t[3].i.h.p===void 0&&Ye(()=>t[71].call(m)),u(i,"class","w-1/3"),u(T,"name","ia"),u(T,"type","number"),u(T,"min","0"),u(T,"max",t[6]),u(T,"class","in-m tr w-full"),u(v,"class","w-1/3"),u(F,"name","ili"),F.__value="true",F.value=F.__value,u(F,"type","checkbox"),u(F,"class","rounded mb-1"),u(D,"class","ml-4"),u(O,"name","ilp"),u(O,"type","number"),u(O,"min","0"),u(O,"max",t[6]),u(O,"class","in-l tr w-full"),u(N,"class","flex"),u(E,"class","w-1/3"),u(H,"name","iri"),H.__value="true",H.value=H.__value,u(H,"type","checkbox"),u(H,"class","rounded mb-1"),u(G,"class","ml-4"),u(me,"name","irr"),u(me,"type","number"),u(me,"min","0"),u(me,"max",t[6]),u(me,"class","in-f tr w-1/3"),u(we,"name","irg"),u(we,"type","number"),u(we,"min","0"),u(we,"max",t[6]),u(we,"class","in-m tr w-1/3"),u(Ce,"name","irb"),u(Ce,"type","number"),u(Ce,"min","0"),u(Ce,"max",t[6]),u(Ce,"class","in-l tr w-1/3"),u(le,"class","flex"),u(U,"class","w-full"),u(se,"name","itd"),u(se,"type","number"),u(se,"min","0"),u(se,"max",t[6]),u(se,"class","in-f tr w-full"),u(_e,"class","my-1 w-1/3"),u(de,"name","ita"),u(de,"type","number"),u(de,"min","0"),u(de,"max",t[6]),u(de,"class","in-l tr w-full"),u(K,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(x,ue){$(x,e,ue),$(x,l,ue),$(x,n,ue),s(n,i),s(i,o),s(i,r),s(r,a),a.checked=t[3].i.h.u,s(r,c),s(i,f),s(i,_),s(i,m),Q(d,m,null),Le(m,t[3].i.h.p,!0),s(n,h),s(n,v),s(v,g),s(v,w),s(v,k),s(v,T),Y(T,t[3].i.a),s(n,P),s(n,E),s(E,S),s(E,D),s(D,F),F.checked=t[3].i.l.i,s(D,R),s(E,B),s(E,L),s(E,N),s(N,O),Y(O,t[3].i.l.p),s(n,j),s(n,U),s(U,q),s(U,G),s(G,H),H.checked=t[3].i.r.i,s(G,V),s(U,J),s(U,ne),s(U,le),s(le,me),Y(me,t[3].i.r.r),s(le,Pe),s(le,we),Y(we,t[3].i.r.g),s(le,Fe),s(le,Ce),Y(Ce,t[3].i.r.b),s(n,Re),s(n,_e),s(_e,Me),s(_e,Ie),s(_e,ce),s(_e,se),Y(se,t[3].i.t.d),s(n,pe),s(n,K),s(K,re),s(K,Ae),s(K,Ne),s(K,de),Y(de,t[3].i.t.a),s(n,ee),he&&he.m(n,null),s(n,oe),be&&be.m(n,null),ve=!0,De||(Oe=[z(a,"change",t[70]),z(m,"change",t[71]),z(T,"input",t[72]),z(F,"change",t[73]),z(O,"input",t[74]),z(H,"change",t[75]),z(me,"input",t[76]),z(we,"input",t[77]),z(Ce,"input",t[78]),z(se,"input",t[79]),z(de,"input",t[80])],De=!0)},p(x,ue){ue[0]&8&&(a.checked=x[3].i.h.u);const Cl={};ue[0]&1&&(Cl.chip=x[0].chip),d.$set(Cl),ue[0]&8&&Le(m,x[3].i.h.p),(!ve||ue[0]&64)&&u(T,"max",x[6]),ue[0]&8&&ae(T.value)!==x[3].i.a&&Y(T,x[3].i.a),ue[0]&8&&(F.checked=x[3].i.l.i),(!ve||ue[0]&64)&&u(O,"max",x[6]),ue[0]&8&&ae(O.value)!==x[3].i.l.p&&Y(O,x[3].i.l.p),ue[0]&8&&(H.checked=x[3].i.r.i),(!ve||ue[0]&64)&&u(me,"max",x[6]),ue[0]&8&&ae(me.value)!==x[3].i.r.r&&Y(me,x[3].i.r.r),(!ve||ue[0]&64)&&u(we,"max",x[6]),ue[0]&8&&ae(we.value)!==x[3].i.r.g&&Y(we,x[3].i.r.g),(!ve||ue[0]&64)&&u(Ce,"max",x[6]),ue[0]&8&&ae(Ce.value)!==x[3].i.r.b&&Y(Ce,x[3].i.r.b),(!ve||ue[0]&64)&&u(se,"max",x[6]),ue[0]&8&&ae(se.value)!==x[3].i.t.d&&Y(se,x[3].i.t.d),(!ve||ue[0]&64)&&u(de,"max",x[6]),ue[0]&8&&ae(de.value)!==x[3].i.t.a&&Y(de,x[3].i.t.a),x[0].chip!="esp8266"?he?he.p(x,ue):(he=lf(x),he.c(),he.m(n,oe)):he&&(he.d(1),he=null),x[3].i.v.p>0?be?be.p(x,ue):(be=nf(x),be.c(),be.m(n,null)):be&&(be.d(1),be=null)},i(x){ve||(M(d.$$.fragment,x),ve=!0)},o(x){I(d.$$.fragment,x),ve=!1},d(x){x&&y(e),x&&y(l),x&&y(n),X(d),he&&he.d(),be&&be.d(),De=!1,Be(Oe)}}}function lf(t){let e,l,n,i,o,r,a;return{c(){e=p("div"),l=C("Vcc"),n=p("br"),i=b(),o=p("input"),u(o,"name","ivp"),u(o,"type","number"),u(o,"min","0"),u(o,"max",t[6]),u(o,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Y(o,t[3].i.v.p),r||(a=z(o,"input",t[81]),r=!0)},p(c,f){f[0]&64&&u(o,"max",c[6]),f[0]&8&&ae(o.value)!==c[3].i.v.p&&Y(o,c[3].i.v.p)},d(c){c&&y(e),r=!1,a()}}}function nf(t){let e,l,n,i,o,r,a,c,f,_;return{c(){e=p("div"),l=C("Voltage divider"),n=p("br"),i=b(),o=p("div"),r=p("input"),a=b(),c=p("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"placeholder","VCC"),u(c,"name","ivdg"),u(c,"type","number"),u(c,"min","0"),u(c,"max","65535"),u(c,"class","in-l tr w-full"),u(c,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(m,d){$(m,e,d),s(e,l),s(e,n),s(e,i),s(e,o),s(o,r),Y(r,t[3].i.v.d.v),s(o,a),s(o,c),Y(c,t[3].i.v.d.g),f||(_=[z(r,"input",t[82]),z(c,"input",t[83])],f=!0)},p(m,d){d[0]&8&&ae(r.value)!==m[3].i.v.d.v&&Y(r,m[3].i.v.d.v),d[0]&8&&ae(c.value)!==m[3].i.v.d.g&&Y(c,m[3].i.v.d.g)},d(m){m&&y(e),f=!1,Be(_)}}}function sf(t){let e,l,n,i,o,r,a,c,f,_,m,d,h,v,g,w,k,T=(t[0].board==2||t[0].board==100)&&of(t);return{c(){e=p("input"),l=b(),n=p("div"),i=p("div"),o=C("Vcc offset"),r=p("br"),a=b(),c=p("input"),f=b(),_=p("div"),m=C("Multiplier"),d=p("br"),h=b(),v=p("input"),g=b(),T&&T.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(c,"name","ivo"),u(c,"type","number"),u(c,"min","0.0"),u(c,"max","3.5"),u(c,"step","0.01"),u(c,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(v,"name","ivm"),u(v,"type","number"),u(v,"min","0.1"),u(v,"max","10"),u(v,"step","0.01"),u(v,"class","in-l tr w-full"),u(_,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(P,E){$(P,e,E),$(P,l,E),$(P,n,E),s(n,i),s(i,o),s(i,r),s(i,a),s(i,c),Y(c,t[3].i.v.o),s(n,f),s(n,_),s(_,m),s(_,d),s(_,h),s(_,v),Y(v,t[3].i.v.m),s(n,g),T&&T.m(n,null),w||(k=[z(c,"input",t[84]),z(v,"input",t[85])],w=!0)},p(P,E){E[0]&8&&ae(c.value)!==P[3].i.v.o&&Y(c,P[3].i.v.o),E[0]&8&&ae(v.value)!==P[3].i.v.m&&Y(v,P[3].i.v.m),P[0].board==2||P[0].board==100?T?T.p(P,E):(T=of(P),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(P){P&&y(e),P&&y(l),P&&y(n),T&&T.d(),w=!1,Be(k)}}}function of(t){let e,l,n,i,o,r,a;return{c(){e=p("div"),l=C("Boot limit"),n=p("br"),i=b(),o=p("input"),u(o,"name","ivb"),u(o,"type","number"),u(o,"min","2.5"),u(o,"max","3.5"),u(o,"step","0.1"),u(o,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Y(o,t[3].i.v.b),r||(a=z(o,"input",t[86]),r=!0)},p(c,f){f[0]&8&&ae(o.value)!==c[3].i.v.b&&Y(o,c[3].i.v.b)},d(c){c&&y(e),r=!1,a()}}}function uf(t){let e,l,n,i,o,r,a,c,f,_,m,d,h,v,g,w,k=t[3].d.t&&rf();return{c(){e=p("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=b(),n=p("div"),i=p("label"),o=p("input"),r=C(" Enable telnet"),a=b(),k&&k.c(),c=b(),f=p("div"),_=p("select"),m=p("option"),m.textContent="Verbose",d=p("option"),d.textContent="Debug",h=p("option"),h.textContent="Info",v=p("option"),v.textContent="Warning",u(e,"class","bd-red"),u(o,"type","checkbox"),u(o,"name","dt"),o.__value="true",o.value=o.__value,u(o,"class","rounded mb-1"),u(n,"class","my-1"),m.__value=1,m.value=m.__value,d.__value=2,d.value=d.__value,h.__value=3,h.value=h.__value,v.__value=4,v.value=v.__value,u(_,"name","dl"),u(_,"class","in-s"),t[3].d.l===void 0&&Ye(()=>t[89].call(_)),u(f,"class","my-1")},m(T,P){$(T,e,P),$(T,l,P),$(T,n,P),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,r),$(T,a,P),k&&k.m(T,P),$(T,c,P),$(T,f,P),s(f,_),s(_,m),s(_,d),s(_,h),s(_,v),Le(_,t[3].d.l,!0),g||(w=[z(o,"change",t[88]),z(_,"change",t[89])],g=!0)},p(T,P){P[0]&8&&(o.checked=T[3].d.t),T[3].d.t?k||(k=rf(),k.c(),k.m(c.parentNode,c)):k&&(k.d(1),k=null),P[0]&8&&Le(_,T[3].d.l)},d(T){T&&y(e),T&&y(l),T&&y(n),T&&y(a),k&&k.d(T),T&&y(c),T&&y(f),g=!1,Be(w)}}}function rf(t){let e;return{c(){e=p("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function Wm(t){let e,l,n,i,o,r,a,c,f,_,m,d,h,v,g,w,k,T,P,E,S,D,F,R,B,L,N,O,j,U,q,G,H,V,J,ne,le,me,Pe,we,Fe,Ce,Re,_e,Me,Ie,ce,se,pe,K,re,Ae,Ne,de,ee,oe,ve,De,Oe,he,be,x,ue,Cl,vi,hi,St,bi,Vl,cl,Xt,gi,ki,wi,it,yi,Zt,$i,Ci,Ti,st,Si,Jt,Kl,dt,Pi,Mi,Ai,xt,Di,Ni,Ii,qe,el,Pt,Tl,Ei,pl,He,Ql,vo,Xl,Zl,ho,Xn,bo,Jl,gs,go,ml,Ht,_l,ko,Fi,wo,tt,dl,yo,Ri,xl,en,tn,ln,Li,$o,Zn,Mt,Co,To,Sl,So,Po,Mo,jt,nn,sn,Ao,on,Pl,Do,No,Io,un,At,Eo,Oi,Fo,Ml,Ro,Lo,Oo,rn,Dt,qo,qi,Uo,ks,Ho,Al,Ui,Nt,jo,Wo,Go,ws,Hi,It,Bo,Yo,zo,et,ji,Vo,an,fn,Ko,Jn,Qo,Dl,Xo,Zo,Jo,tl,xo,Nl,eu,tu,lu,ll,nu,cn,Il,iu,su,ou,kt,pn,mn,_n,dn,uu,El,ru,au,fu,vn,wt,cu,Wi,pu,Gi,Bi,Et,mu,_u,Je,Yi,du,hn,bn,vu,Fl,hu,bu,gu,vl,Wt,gn,kn,ku,vt,zi,Vi,wu,ht,wn,Ki,Qi,yu,ys,Xi,Zi,Ft,$u,Cu,xn,Tu,hl,Su,ei,Rt,Pu,Mu,Au,Ji,nl,Du,Ge,xi,Nu,yn,$n,Iu,ti,Eu,Gt,Fu,$s,Ru,Lu,Cn,il,Ou,Lt,qu,Cs,Rl,Uu,Hu,ju,sl,Wu,Ll,Gu,Bu,Yu,ol,zu,Tn,Sn,Vu,Ku,Qu,ul,Xu,Pn,Zu,Ju,xu,ot,Mn,An,Dn,Nn,In,En,er,Ol,tr,lr,nr,rl,ir,Ts,Ss,Ps=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Ms,Bt,es,sr,Fn,Rn,or,li,ur,ni,rr,As,bt,ts,ar,Ln,On,fr,ii,cr,ls,ns,Ot,pr,mr,_r,bl,Ds,qn,dr,is,Un,vr,ss,Ns,ql,Is,Ul,Es,Hl,Fs,jl,qt,Rs,hr;a=new $t({}),R=new Pm({});let Sc=["NOK","SEK","DKK","EUR"],si=[];for(let A=0;A<4;A+=1)si[A]=Nm(Dm(t,Sc,A));let ut=t[3].p.e&&t[0].chip!="esp8266"&&ja(t),rt=t[3].g.s>0&&Wa(t);Zl=new $t({});let Pc=[24,48,96,192,384,576,1152],oi=[];for(let A=0;A<7;A+=1)oi[A]=Im(Am(t,Pc,A));let at=t[3].m.e.e&&Ga(t),ft=t[3].m.e.e&&Ba(t),ct=t[3].m.m.e&&Ya(t);fn=new $t({}),bn=new $t({}),wn=new Tc({});let pt=t[3].n.m=="static"&&za(t);$n=new $t({});let mt=t[0].chip!="esp8266"&&Va(t),ze=t[3].q.s.e&&Ka(t),Ve=t[3].q.m==3&&Qa(t),Ke=t[3].q.m==4&&Xa(t),Qe=Ps&&Za(t);Rn=new $t({});let Hn=t[7],lt=[];for(let A=0;A20||t[0].chip=="esp8266")&&ef(t);On=new $t({});let _t=t[3].d.s&&uf(t);return ql=new gt({props:{active:t[1],message:"Loading configuration"}}),Ul=new gt({props:{active:t[2],message:"Saving configuration"}}),Hl=new gt({props:{active:t[4],message:"Performing factory reset"}}),jl=new gt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=p("form"),l=p("div"),n=p("div"),i=p("strong"),i.textContent="General",o=b(),r=p("a"),Z(a.$$.fragment),c=b(),f=p("input"),_=b(),m=p("div"),d=p("div"),h=p("div"),v=C("Hostname"),g=p("br"),w=b(),k=p("input"),T=b(),P=p("div"),E=C("Time zone"),S=p("br"),D=b(),F=p("select"),Z(R.$$.fragment),B=b(),L=p("input"),N=b(),O=p("div"),j=p("div"),U=p("div"),q=C("Price region"),G=p("br"),H=b(),V=p("select"),J=p("optgroup"),ne=p("option"),ne.textContent="NO1",le=p("option"),le.textContent="NO2",me=p("option"),me.textContent="NO3",Pe=p("option"),Pe.textContent="NO4",we=p("option"),we.textContent="NO5",Fe=p("optgroup"),Ce=p("option"),Ce.textContent="SE1",Re=p("option"),Re.textContent="SE2",_e=p("option"),_e.textContent="SE3",Me=p("option"),Me.textContent="SE4",Ie=p("optgroup"),ce=p("option"),ce.textContent="DK1",se=p("option"),se.textContent="DK2",pe=p("option"),pe.textContent="Austria",K=p("option"),K.textContent="Belgium",re=p("option"),re.textContent="Czech Republic",Ae=p("option"),Ae.textContent="Estonia",Ne=p("option"),Ne.textContent="Finland",de=p("option"),de.textContent="France",ee=p("option"),ee.textContent="Germany",oe=p("option"),oe.textContent="Great Britain",ve=p("option"),ve.textContent="Latvia",De=p("option"),De.textContent="Lithuania",Oe=p("option"),Oe.textContent="Netherland",he=p("option"),he.textContent="Poland",be=p("option"),be.textContent="Switzerland",x=b(),ue=p("div"),Cl=C("Currency"),vi=p("br"),hi=b(),St=p("select");for(let A=0;A<4;A+=1)si[A].c();bi=b(),Vl=p("div"),cl=p("div"),Xt=p("div"),gi=C("Fixed price"),ki=p("br"),wi=b(),it=p("input"),yi=b(),Zt=p("div"),$i=C("Multiplier"),Ci=p("br"),Ti=b(),st=p("input"),Si=b(),Jt=p("div"),Kl=p("label"),dt=p("input"),Pi=C(" Enable price fetch from remote server"),Mi=b(),ut&&ut.c(),Ai=b(),xt=p("div"),Di=C("Security"),Ni=p("br"),Ii=b(),qe=p("select"),el=p("option"),el.textContent="None",Pt=p("option"),Pt.textContent="Only configuration",Tl=p("option"),Tl.textContent="Everything",Ei=b(),rt&&rt.c(),pl=b(),He=p("div"),Ql=p("strong"),Ql.textContent="Meter",vo=b(),Xl=p("a"),Z(Zl.$$.fragment),ho=b(),Xn=p("input"),bo=b(),Jl=p("div"),gs=p("span"),gs.textContent="Serial configuration",go=b(),ml=p("div"),Ht=p("select"),_l=p("option"),ko=C("Autodetect");for(let A=0;A<7;A+=1)oi[A].c();wo=b(),tt=p("select"),dl=p("option"),yo=C("-"),xl=p("option"),xl.textContent="7N1",en=p("option"),en.textContent="8N1",tn=p("option"),tn.textContent="7E1",ln=p("option"),ln.textContent="8E1",$o=b(),Zn=p("label"),Mt=p("input"),Co=C(" inverted"),To=b(),Sl=p("div"),So=C("Voltage"),Po=p("br"),Mo=b(),jt=p("select"),nn=p("option"),nn.textContent="400V (TN)",sn=p("option"),sn.textContent="230V (IT/TT)",Ao=b(),on=p("div"),Pl=p("div"),Do=C("Main fuse"),No=p("br"),Io=b(),un=p("label"),At=p("input"),Eo=b(),Oi=p("span"),Oi.textContent="A",Fo=b(),Ml=p("div"),Ro=C("Production"),Lo=p("br"),Oo=b(),rn=p("label"),Dt=p("input"),qo=b(),qi=p("span"),qi.textContent="kWp",Uo=b(),ks=p("div"),Ho=b(),Al=p("div"),Ui=p("label"),Nt=p("input"),jo=C(" Meter is encrypted"),Wo=b(),at&&at.c(),Go=b(),ft&&ft.c(),ws=b(),Hi=p("label"),It=p("input"),Bo=C(" Multipliers"),Yo=b(),ct&&ct.c(),zo=b(),et=p("div"),ji=p("strong"),ji.textContent="WiFi",Vo=b(),an=p("a"),Z(fn.$$.fragment),Ko=b(),Jn=p("input"),Qo=b(),Dl=p("div"),Xo=C("SSID"),Zo=p("br"),Jo=b(),tl=p("input"),xo=b(),Nl=p("div"),eu=C("Password"),tu=p("br"),lu=b(),ll=p("input"),nu=b(),cn=p("div"),Il=p("div"),iu=C("Power saving"),su=p("br"),ou=b(),kt=p("select"),pn=p("option"),pn.textContent="Default",mn=p("option"),mn.textContent="Off",_n=p("option"),_n.textContent="Minimum",dn=p("option"),dn.textContent="Maximum",uu=b(),El=p("div"),ru=C("Power"),au=p("br"),fu=b(),vn=p("div"),wt=p("input"),cu=b(),Wi=p("span"),Wi.textContent="dBm",pu=b(),Gi=p("div"),Bi=p("label"),Et=p("input"),mu=C(" Auto reboot on connection problem"),_u=b(),Je=p("div"),Yi=p("strong"),Yi.textContent="Network",du=b(),hn=p("a"),Z(bn.$$.fragment),vu=b(),Fl=p("div"),hu=C("IP"),bu=p("br"),gu=b(),vl=p("div"),Wt=p("select"),gn=p("option"),gn.textContent="DHCP",kn=p("option"),kn.textContent="Static",ku=b(),vt=p("input"),wu=b(),ht=p("select"),Z(wn.$$.fragment),yu=b(),pt&&pt.c(),ys=b(),Xi=p("div"),Zi=p("label"),Ft=p("input"),$u=C(" enable mDNS"),Cu=b(),xn=p("input"),Tu=b(),hl=p("div"),Su=C("NTP "),ei=p("label"),Rt=p("input"),Pu=C(" obtain from DHCP"),Mu=p("br"),Au=b(),Ji=p("div"),nl=p("input"),Du=b(),Ge=p("div"),xi=p("strong"),xi.textContent="MQTT",Nu=b(),yn=p("a"),Z($n.$$.fragment),Iu=b(),ti=p("input"),Eu=b(),Gt=p("div"),Fu=C(`Server `),mt&&mt.c(),$s=b(),Ru=p("br"),Lu=b(),Cn=p("div"),il=p("input"),Ou=b(),Lt=p("input"),qu=b(),ze&&ze.c(),Cs=b(),Rl=p("div"),Uu=C("Username"),Hu=p("br"),ju=b(),sl=p("input"),Wu=b(),Ll=p("div"),Gu=C("Password"),Bu=p("br"),Yu=b(),ol=p("input"),zu=b(),Tn=p("div"),Sn=p("div"),Vu=C("Client ID"),Ku=p("br"),Qu=b(),ul=p("input"),Xu=b(),Pn=p("div"),Zu=C("Payload"),Ju=p("br"),xu=b(),ot=p("select"),Mn=p("option"),Mn.textContent="JSON",An=p("option"),An.textContent="Raw (minimal)",Dn=p("option"),Dn.textContent="Raw (full)",Nn=p("option"),Nn.textContent="Domoticz",In=p("option"),In.textContent="HomeAssistant",En=p("option"),En.textContent="HEX dump",er=b(),Ol=p("div"),tr=C("Publish topic"),lr=p("br"),nr=b(),rl=p("input"),ir=b(),Ve&&Ve.c(),Ts=b(),Ke&&Ke.c(),Ss=b(),Qe&&Qe.c(),Ms=b(),Bt=p("div"),es=p("strong"),es.textContent="User interface",sr=b(),Fn=p("a"),Z(Rn.$$.fragment),or=b(),li=p("input"),ur=b(),ni=p("div");for(let A=0;ASave',Ns=b(),Z(ql.$$.fragment),Is=b(),Z(Ul.$$.fragment),Es=b(),Z(Hl.$$.fragment),Fs=b(),Z(jl.$$.fragment),u(i,"class","text-sm"),u(r,"href",Ct("General-configuration")),u(r,"target","_blank"),u(r,"class","float-right"),u(f,"type","hidden"),u(f,"name","g"),f.value="true",u(k,"name","gh"),u(k,"type","text"),u(k,"class","in-f w-full"),u(k,"pattern","[A-Za-z0-9-]+"),u(F,"name","gt"),u(F,"class","in-l w-full"),t[3].g.t===void 0&&Ye(()=>t[13].call(F)),u(d,"class","flex"),u(m,"class","my-1"),u(L,"type","hidden"),u(L,"name","p"),L.value="true",ne.__value="10YNO-1--------2",ne.value=ne.__value,le.__value="10YNO-2--------T",le.value=le.__value,me.__value="10YNO-3--------J",me.value=me.__value,Pe.__value="10YNO-4--------9",Pe.value=Pe.__value,we.__value="10Y1001A1001A48H",we.value=we.__value,u(J,"label","Norway"),Ce.__value="10Y1001A1001A44P",Ce.value=Ce.__value,Re.__value="10Y1001A1001A45N",Re.value=Re.__value,_e.__value="10Y1001A1001A46L",_e.value=_e.__value,Me.__value="10Y1001A1001A47J",Me.value=Me.__value,u(Fe,"label","Sweden"),ce.__value="10YDK-1--------W",ce.value=ce.__value,se.__value="10YDK-2--------M",se.value=se.__value,u(Ie,"label","Denmark"),pe.__value="10YAT-APG------L",pe.value=pe.__value,K.__value="10YBE----------2",K.value=K.__value,re.__value="10YCZ-CEPS-----N",re.value=re.__value,Ae.__value="10Y1001A1001A39I",Ae.value=Ae.__value,Ne.__value="10YFI-1--------U",Ne.value=Ne.__value,de.__value="10YFR-RTE------C",de.value=de.__value,ee.__value="10Y1001A1001A83F",ee.value=ee.__value,oe.__value="10YGB----------A",oe.value=oe.__value,ve.__value="10YLV-1001A00074",ve.value=ve.__value,De.__value="10YLT-1001A0008Q",De.value=De.__value,Oe.__value="10YNL----------L",Oe.value=Oe.__value,he.__value="10YPL-AREA-----S",he.value=he.__value,be.__value="10YCH-SWISSGRIDZ",be.value=be.__value,u(V,"name","pr"),u(V,"class","in-f w-full"),t[3].p.r===void 0&&Ye(()=>t[14].call(V)),u(U,"class","w-full"),u(St,"name","pc"),u(St,"class","in-l"),t[3].p.c===void 0&&Ye(()=>t[15].call(St)),u(j,"class","flex"),u(O,"class","my-1"),u(it,"name","pf"),u(it,"type","number"),u(it,"min","0.001"),u(it,"max","65"),u(it,"step","0.001"),u(it,"class","in-f tr w-full"),u(Xt,"class","w-1/2"),u(st,"name","pm"),u(st,"type","number"),u(st,"min","0.001"),u(st,"max","1000"),u(st,"step","0.001"),u(st,"class","in-l tr w-full"),u(Zt,"class","w-1/2"),u(cl,"class","flex"),u(Vl,"class","my-1"),u(dt,"type","checkbox"),u(dt,"name","pe"),dt.__value="true",dt.value=dt.__value,u(dt,"class","rounded mb-1"),u(Jt,"class","my-1"),el.__value=0,el.value=el.__value,Pt.__value=1,Pt.value=Pt.__value,Tl.__value=2,Tl.value=Tl.__value,u(qe,"name","gs"),u(qe,"class","in-s"),t[3].g.s===void 0&&Ye(()=>t[20].call(qe)),u(xt,"class","my-1"),u(n,"class","cnt"),u(Ql,"class","text-sm"),u(Xl,"href",Ct("Meter-configuration")),u(Xl,"target","_blank"),u(Xl,"class","float-right"),u(Xn,"type","hidden"),u(Xn,"name","m"),Xn.value="true",_l.__value=0,_l.value=_l.__value,_l.disabled=Fi=t[3].m.b!=0,u(Ht,"name","mb"),u(Ht,"class","in-f"),t[3].m.b===void 0&&Ye(()=>t[23].call(Ht)),dl.__value=0,dl.value=dl.__value,dl.disabled=Ri=t[3].m.b!=0,xl.__value=2,xl.value=xl.__value,en.__value=3,en.value=en.__value,tn.__value=10,tn.value=tn.__value,ln.__value=11,ln.value=ln.__value,u(tt,"name","mp"),u(tt,"class","in-l"),tt.disabled=Li=t[3].m.b==0,t[3].m.p===void 0&&Ye(()=>t[24].call(tt)),u(Mt,"name","mi"),Mt.__value="true",Mt.value=Mt.__value,u(Mt,"type","checkbox"),u(Mt,"class","rounded mb-1"),u(Zn,"class","mt-2 ml-3 whitespace-nowrap"),u(ml,"class","flex"),u(Jl,"class","my-1"),nn.__value=2,nn.value=nn.__value,sn.__value=1,sn.value=sn.__value,u(jt,"name","md"),u(jt,"class","in-s"),t[3].m.d===void 0&&Ye(()=>t[26].call(jt)),u(Sl,"class","my-1"),u(At,"name","mf"),u(At,"type","number"),u(At,"min","5"),u(At,"max","65535"),u(At,"class","in-f tr w-full"),u(Oi,"class","in-post"),u(un,"class","flex"),u(Pl,"class","mx-1"),u(Dt,"name","mr"),u(Dt,"type","number"),u(Dt,"min","0"),u(Dt,"max","65535"),u(Dt,"class","in-f tr w-full"),u(qi,"class","in-post"),u(rn,"class","flex"),u(Ml,"class","mx-1"),u(on,"class","my-1 flex"),u(ks,"class","my-1"),u(Nt,"type","checkbox"),u(Nt,"name","me"),Nt.__value="true",Nt.value=Nt.__value,u(Nt,"class","rounded mb-1"),u(Al,"class","my-1"),u(It,"type","checkbox"),u(It,"name","mm"),It.__value="true",It.value=It.__value,u(It,"class","rounded mb-1"),u(He,"class","cnt"),u(ji,"class","text-sm"),u(an,"href",Ct("WiFi-configuration")),u(an,"target","_blank"),u(an,"class","float-right"),u(Jn,"type","hidden"),u(Jn,"name","w"),Jn.value="true",u(tl,"name","ws"),u(tl,"type","text"),u(tl,"class","in-s"),u(Dl,"class","my-1"),u(ll,"name","wp"),u(ll,"type","password"),u(ll,"class","in-s"),u(Nl,"class","my-1"),pn.__value=255,pn.value=pn.__value,mn.__value=0,mn.value=mn.__value,_n.__value=1,_n.value=_n.__value,dn.__value=2,dn.value=dn.__value,u(kt,"name","wz"),u(kt,"class","in-s"),t[3].w.z===void 0&&Ye(()=>t[39].call(kt)),u(Il,"class","w-1/2"),u(wt,"name","ww"),u(wt,"type","number"),u(wt,"min","0"),u(wt,"max","20.5"),u(wt,"step","0.5"),u(wt,"class","in-f tr w-full"),u(Wi,"class","in-post"),u(vn,"class","flex"),u(El,"class","ml-2 w-1/2"),u(cn,"class","my-1 flex"),u(Et,"type","checkbox"),u(Et,"name","wa"),Et.__value="true",Et.value=Et.__value,u(Et,"class","rounded mb-1"),u(Gi,"class","my-3"),u(et,"class","cnt"),u(Yi,"class","text-sm"),u(hn,"href",Ct("Network-configuration")),u(hn,"target","_blank"),u(hn,"class","float-right"),gn.__value="dhcp",gn.value=gn.__value,kn.__value="static",kn.value=kn.__value,u(Wt,"name","nm"),u(Wt,"class","in-f"),t[3].n.m===void 0&&Ye(()=>t[42].call(Wt)),u(vt,"name","ni"),u(vt,"type","text"),u(vt,"class","in-m w-full"),vt.disabled=zi=t[3].n.m=="dhcp",vt.required=Vi=t[3].n.m=="static",u(ht,"name","ns"),u(ht,"class","in-l"),ht.disabled=Ki=t[3].n.m=="dhcp",ht.required=Qi=t[3].n.m=="static",t[3].n.s===void 0&&Ye(()=>t[44].call(ht)),u(vl,"class","flex"),u(Fl,"class","my-1"),u(Ft,"name","nd"),Ft.__value="true",Ft.value=Ft.__value,u(Ft,"type","checkbox"),u(Ft,"class","rounded mb-1"),u(Xi,"class","my-1"),u(xn,"type","hidden"),u(xn,"name","ntp"),xn.value="true",u(Rt,"name","ntpd"),Rt.__value="true",Rt.value=Rt.__value,u(Rt,"type","checkbox"),u(Rt,"class","rounded mb-1"),u(ei,"class","ml-4"),u(nl,"name","ntph"),u(nl,"type","text"),u(nl,"class","in-s"),u(Ji,"class","flex"),u(hl,"class","my-1"),u(Je,"class","cnt"),u(xi,"class","text-sm"),u(yn,"href",Ct("MQTT-configuration")),u(yn,"target","_blank"),u(yn,"class","float-right"),u(ti,"type","hidden"),u(ti,"name","q"),ti.value="true",u(il,"name","qh"),u(il,"type","text"),u(il,"class","in-f w-3/4"),u(Lt,"name","qp"),u(Lt,"type","number"),u(Lt,"min","1024"),u(Lt,"max","65535"),u(Lt,"class","in-l tr w-1/4"),u(Cn,"class","flex"),u(Gt,"class","my-1"),u(sl,"name","qu"),u(sl,"type","text"),u(sl,"class","in-s"),u(Rl,"class","my-1"),u(ol,"name","qa"),u(ol,"type","password"),u(ol,"class","in-s"),u(Ll,"class","my-1"),u(ul,"name","qc"),u(ul,"type","text"),u(ul,"class","in-f w-full"),Mn.__value=0,Mn.value=Mn.__value,An.__value=1,An.value=An.__value,Dn.__value=2,Dn.value=Dn.__value,Nn.__value=3,Nn.value=Nn.__value,In.__value=4,In.value=In.__value,En.__value=255,En.value=En.__value,u(ot,"name","qm"),u(ot,"class","in-l"),t[3].q.m===void 0&&Ye(()=>t[57].call(ot)),u(Tn,"class","my-1 flex"),u(rl,"name","qb"),u(rl,"type","text"),u(rl,"class","in-s"),u(Ol,"class","my-1"),u(Ge,"class","cnt"),u(es,"class","text-sm"),u(Fn,"href",Ct("User-interface")),u(Fn,"target","_blank"),u(Fn,"class","float-right"),u(li,"type","hidden"),u(li,"name","u"),li.value="true",u(ni,"class","flex flex-wrap"),u(Bt,"class","cnt"),u(ts,"class","text-sm"),u(Ln,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(Ln,"target","_blank"),u(Ln,"class","float-right"),u(ii,"type","hidden"),u(ii,"name","d"),ii.value="true",u(Ot,"type","checkbox"),u(Ot,"name","ds"),Ot.__value="true",Ot.value=Ot.__value,u(Ot,"class","rounded mb-1"),u(ls,"class","mt-3"),u(bt,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(qn,"type","button"),u(qn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),u(Un,"type","button"),u(Un,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(is,"class","text-center"),u(ss,"class","text-right"),u(bl,"class","grid grid-cols-3"),u(e,"autocomplete","off")},m(A,te){$(A,e,te),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),Q(a,r,null),s(n,c),s(n,f),s(n,_),s(n,m),s(m,d),s(d,h),s(h,v),s(h,g),s(h,w),s(h,k),Y(k,t[3].g.h),s(d,T),s(d,P),s(P,E),s(P,S),s(P,D),s(P,F),Q(R,F,null),Le(F,t[3].g.t,!0),s(n,B),s(n,L),s(n,N),s(n,O),s(O,j),s(j,U),s(U,q),s(U,G),s(U,H),s(U,V),s(V,J),s(J,ne),s(J,le),s(J,me),s(J,Pe),s(J,we),s(V,Fe),s(Fe,Ce),s(Fe,Re),s(Fe,_e),s(Fe,Me),s(V,Ie),s(Ie,ce),s(Ie,se),s(V,pe),s(V,K),s(V,re),s(V,Ae),s(V,Ne),s(V,de),s(V,ee),s(V,oe),s(V,ve),s(V,De),s(V,Oe),s(V,he),s(V,be),Le(V,t[3].p.r,!0),s(j,x),s(j,ue),s(ue,Cl),s(ue,vi),s(ue,hi),s(ue,St);for(let xe=0;xe<4;xe+=1)si[xe]&&si[xe].m(St,null);Le(St,t[3].p.c,!0),s(n,bi),s(n,Vl),s(Vl,cl),s(cl,Xt),s(Xt,gi),s(Xt,ki),s(Xt,wi),s(Xt,it),Y(it,t[3].p.f),s(cl,yi),s(cl,Zt),s(Zt,$i),s(Zt,Ci),s(Zt,Ti),s(Zt,st),Y(st,t[3].p.m),s(n,Si),s(n,Jt),s(Jt,Kl),s(Kl,dt),dt.checked=t[3].p.e,s(Kl,Pi),s(Jt,Mi),ut&&ut.m(Jt,null),s(n,Ai),s(n,xt),s(xt,Di),s(xt,Ni),s(xt,Ii),s(xt,qe),s(qe,el),s(qe,Pt),s(qe,Tl),Le(qe,t[3].g.s,!0),s(n,Ei),rt&&rt.m(n,null),s(l,pl),s(l,He),s(He,Ql),s(He,vo),s(He,Xl),Q(Zl,Xl,null),s(He,ho),s(He,Xn),s(He,bo),s(He,Jl),s(Jl,gs),s(Jl,go),s(Jl,ml),s(ml,Ht),s(Ht,_l),s(_l,ko);for(let xe=0;xe<7;xe+=1)oi[xe]&&oi[xe].m(Ht,null);Le(Ht,t[3].m.b,!0),s(ml,wo),s(ml,tt),s(tt,dl),s(dl,yo),s(tt,xl),s(tt,en),s(tt,tn),s(tt,ln),Le(tt,t[3].m.p,!0),s(ml,$o),s(ml,Zn),s(Zn,Mt),Mt.checked=t[3].m.i,s(Zn,Co),s(He,To),s(He,Sl),s(Sl,So),s(Sl,Po),s(Sl,Mo),s(Sl,jt),s(jt,nn),s(jt,sn),Le(jt,t[3].m.d,!0),s(He,Ao),s(He,on),s(on,Pl),s(Pl,Do),s(Pl,No),s(Pl,Io),s(Pl,un),s(un,At),Y(At,t[3].m.f),s(un,Eo),s(un,Oi),s(on,Fo),s(on,Ml),s(Ml,Ro),s(Ml,Lo),s(Ml,Oo),s(Ml,rn),s(rn,Dt),Y(Dt,t[3].m.r),s(rn,qo),s(rn,qi),s(He,Uo),s(He,ks),s(He,Ho),s(He,Al),s(Al,Ui),s(Ui,Nt),Nt.checked=t[3].m.e.e,s(Ui,jo),s(Al,Wo),at&&at.m(Al,null),s(He,Go),ft&&ft.m(He,null),s(He,ws),s(He,Hi),s(Hi,It),It.checked=t[3].m.m.e,s(Hi,Bo),s(He,Yo),ct&&ct.m(He,null),s(l,zo),s(l,et),s(et,ji),s(et,Vo),s(et,an),Q(fn,an,null),s(et,Ko),s(et,Jn),s(et,Qo),s(et,Dl),s(Dl,Xo),s(Dl,Zo),s(Dl,Jo),s(Dl,tl),Y(tl,t[3].w.s),s(et,xo),s(et,Nl),s(Nl,eu),s(Nl,tu),s(Nl,lu),s(Nl,ll),Y(ll,t[3].w.p),s(et,nu),s(et,cn),s(cn,Il),s(Il,iu),s(Il,su),s(Il,ou),s(Il,kt),s(kt,pn),s(kt,mn),s(kt,_n),s(kt,dn),Le(kt,t[3].w.z,!0),s(cn,uu),s(cn,El),s(El,ru),s(El,au),s(El,fu),s(El,vn),s(vn,wt),Y(wt,t[3].w.w),s(vn,cu),s(vn,Wi),s(et,pu),s(et,Gi),s(Gi,Bi),s(Bi,Et),Et.checked=t[3].w.a,s(Bi,mu),s(l,_u),s(l,Je),s(Je,Yi),s(Je,du),s(Je,hn),Q(bn,hn,null),s(Je,vu),s(Je,Fl),s(Fl,hu),s(Fl,bu),s(Fl,gu),s(Fl,vl),s(vl,Wt),s(Wt,gn),s(Wt,kn),Le(Wt,t[3].n.m,!0),s(vl,ku),s(vl,vt),Y(vt,t[3].n.i),s(vl,wu),s(vl,ht),Q(wn,ht,null),Le(ht,t[3].n.s,!0),s(Je,yu),pt&&pt.m(Je,null),s(Je,ys),s(Je,Xi),s(Xi,Zi),s(Zi,Ft),Ft.checked=t[3].n.d,s(Zi,$u),s(Je,Cu),s(Je,xn),s(Je,Tu),s(Je,hl),s(hl,Su),s(hl,ei),s(ei,Rt),Rt.checked=t[3].n.h,s(ei,Pu),s(hl,Mu),s(hl,Au),s(hl,Ji),s(Ji,nl),Y(nl,t[3].n.n1),s(l,Du),s(l,Ge),s(Ge,xi),s(Ge,Nu),s(Ge,yn),Q($n,yn,null),s(Ge,Iu),s(Ge,ti),s(Ge,Eu),s(Ge,Gt),s(Gt,Fu),mt&&mt.m(Gt,null),s(Gt,$s),s(Gt,Ru),s(Gt,Lu),s(Gt,Cn),s(Cn,il),Y(il,t[3].q.h),s(Cn,Ou),s(Cn,Lt),Y(Lt,t[3].q.p),s(Ge,qu),ze&&ze.m(Ge,null),s(Ge,Cs),s(Ge,Rl),s(Rl,Uu),s(Rl,Hu),s(Rl,ju),s(Rl,sl),Y(sl,t[3].q.u),s(Ge,Wu),s(Ge,Ll),s(Ll,Gu),s(Ll,Bu),s(Ll,Yu),s(Ll,ol),Y(ol,t[3].q.a),s(Ge,zu),s(Ge,Tn),s(Tn,Sn),s(Sn,Vu),s(Sn,Ku),s(Sn,Qu),s(Sn,ul),Y(ul,t[3].q.c),s(Tn,Xu),s(Tn,Pn),s(Pn,Zu),s(Pn,Ju),s(Pn,xu),s(Pn,ot),s(ot,Mn),s(ot,An),s(ot,Dn),s(ot,Nn),s(ot,In),s(ot,En),Le(ot,t[3].q.m,!0),s(Ge,er),s(Ge,Ol),s(Ol,tr),s(Ol,lr),s(Ol,nr),s(Ol,rl),Y(rl,t[3].q.b),s(l,ir),Ve&&Ve.m(l,null),s(l,Ts),Ke&&Ke.m(l,null),s(l,Ss),Qe&&Qe.m(l,null),s(l,Ms),s(l,Bt),s(Bt,es),s(Bt,sr),s(Bt,Fn),Q(Rn,Fn,null),s(Bt,or),s(Bt,li),s(Bt,ur),s(Bt,ni);for(let xe=0;xe0?rt?rt.p(A,te):(rt=Wa(A),rt.c(),rt.m(n,null)):rt&&(rt.d(1),rt=null),(!qt||te[0]&8&&Fi!==(Fi=A[3].m.b!=0))&&(_l.disabled=Fi),te[0]&8&&Le(Ht,A[3].m.b),(!qt||te[0]&8&&Ri!==(Ri=A[3].m.b!=0))&&(dl.disabled=Ri),(!qt||te[0]&8&&Li!==(Li=A[3].m.b==0))&&(tt.disabled=Li),te[0]&8&&Le(tt,A[3].m.p),te[0]&8&&(Mt.checked=A[3].m.i),te[0]&8&&Le(jt,A[3].m.d),te[0]&8&&ae(At.value)!==A[3].m.f&&Y(At,A[3].m.f),te[0]&8&&ae(Dt.value)!==A[3].m.r&&Y(Dt,A[3].m.r),te[0]&8&&(Nt.checked=A[3].m.e.e),A[3].m.e.e?at?at.p(A,te):(at=Ga(A),at.c(),at.m(Al,null)):at&&(at.d(1),at=null),A[3].m.e.e?ft?ft.p(A,te):(ft=Ba(A),ft.c(),ft.m(He,ws)):ft&&(ft.d(1),ft=null),te[0]&8&&(It.checked=A[3].m.m.e),A[3].m.m.e?ct?ct.p(A,te):(ct=Ya(A),ct.c(),ct.m(He,null)):ct&&(ct.d(1),ct=null),te[0]&8&&tl.value!==A[3].w.s&&Y(tl,A[3].w.s),te[0]&8&&ll.value!==A[3].w.p&&Y(ll,A[3].w.p),te[0]&8&&Le(kt,A[3].w.z),te[0]&8&&ae(wt.value)!==A[3].w.w&&Y(wt,A[3].w.w),te[0]&8&&(Et.checked=A[3].w.a),te[0]&8&&Le(Wt,A[3].n.m),(!qt||te[0]&8&&zi!==(zi=A[3].n.m=="dhcp"))&&(vt.disabled=zi),(!qt||te[0]&8&&Vi!==(Vi=A[3].n.m=="static"))&&(vt.required=Vi),te[0]&8&&vt.value!==A[3].n.i&&Y(vt,A[3].n.i),(!qt||te[0]&8&&Ki!==(Ki=A[3].n.m=="dhcp"))&&(ht.disabled=Ki),(!qt||te[0]&8&&Qi!==(Qi=A[3].n.m=="static"))&&(ht.required=Qi),te[0]&8&&Le(ht,A[3].n.s),A[3].n.m=="static"?pt?pt.p(A,te):(pt=za(A),pt.c(),pt.m(Je,ys)):pt&&(pt.d(1),pt=null),te[0]&8&&(Ft.checked=A[3].n.d),te[0]&8&&(Rt.checked=A[3].n.h),te[0]&8&&nl.value!==A[3].n.n1&&Y(nl,A[3].n.n1),A[0].chip!="esp8266"?mt?mt.p(A,te):(mt=Va(A),mt.c(),mt.m(Gt,$s)):mt&&(mt.d(1),mt=null),te[0]&8&&il.value!==A[3].q.h&&Y(il,A[3].q.h),te[0]&8&&ae(Lt.value)!==A[3].q.p&&Y(Lt,A[3].q.p),A[3].q.s.e?ze?(ze.p(A,te),te[0]&8&&M(ze,1)):(ze=Ka(A),ze.c(),M(ze,1),ze.m(Ge,Cs)):ze&&(Te(),I(ze,1,1,()=>{ze=null}),Se()),te[0]&8&&sl.value!==A[3].q.u&&Y(sl,A[3].q.u),te[0]&8&&ol.value!==A[3].q.a&&Y(ol,A[3].q.a),te[0]&8&&ul.value!==A[3].q.c&&Y(ul,A[3].q.c),te[0]&8&&Le(ot,A[3].q.m),te[0]&8&&rl.value!==A[3].q.b&&Y(rl,A[3].q.b),A[3].q.m==3?Ve?(Ve.p(A,te),te[0]&8&&M(Ve,1)):(Ve=Qa(A),Ve.c(),M(Ve,1),Ve.m(l,Ts)):Ve&&(Te(),I(Ve,1,1,()=>{Ve=null}),Se()),A[3].q.m==4?Ke?(Ke.p(A,te),te[0]&8&&M(Ke,1)):(Ke=Xa(A),Ke.c(),M(Ke,1),Ke.m(l,Ss)):Ke&&(Te(),I(Ke,1,1,()=>{Ke=null}),Se()),te[0]&8&&(Ps=A[3].p.r.startsWith("10YNO")||A[3].p.r=="10Y1001A1001A48H"),Ps?Qe?(Qe.p(A,te),te[0]&8&&M(Qe,1)):(Qe=Za(A),Qe.c(),M(Qe,1),Qe.m(l,Ms)):Qe&&(Te(),I(Qe,1,1,()=>{Qe=null}),Se()),te[0]&136){Hn=A[7];let yt;for(yt=0;yt20||A[0].chip=="esp8266"?Xe?(Xe.p(A,te),te[0]&1&&M(Xe,1)):(Xe=ef(A),Xe.c(),M(Xe,1),Xe.m(l,As)):Xe&&(Te(),I(Xe,1,1,()=>{Xe=null}),Se()),te[0]&8&&(Ot.checked=A[3].d.s),A[3].d.s?_t?_t.p(A,te):(_t=uf(A),_t.c(),_t.m(bt,null)):_t&&(_t.d(1),_t=null);const xe={};te[0]&2&&(xe.active=A[1]),ql.$set(xe);const br={};te[0]&4&&(br.active=A[2]),Ul.$set(br);const gr={};te[0]&16&&(gr.active=A[4]),Hl.$set(gr);const kr={};te[0]&32&&(kr.active=A[5]),jl.$set(kr)},i(A){qt||(M(a.$$.fragment,A),M(R.$$.fragment,A),M(Zl.$$.fragment,A),M(fn.$$.fragment,A),M(bn.$$.fragment,A),M(wn.$$.fragment,A),M($n.$$.fragment,A),M(ze),M(Ve),M(Ke),M(Qe),M(Rn.$$.fragment,A),M(Xe),M(On.$$.fragment,A),M(ql.$$.fragment,A),M(Ul.$$.fragment,A),M(Hl.$$.fragment,A),M(jl.$$.fragment,A),qt=!0)},o(A){I(a.$$.fragment,A),I(R.$$.fragment,A),I(Zl.$$.fragment,A),I(fn.$$.fragment,A),I(bn.$$.fragment,A),I(wn.$$.fragment,A),I($n.$$.fragment,A),I(ze),I(Ve),I(Ke),I(Qe),I(Rn.$$.fragment,A),I(Xe),I(On.$$.fragment,A),I(ql.$$.fragment,A),I(Ul.$$.fragment,A),I(Hl.$$.fragment,A),I(jl.$$.fragment,A),qt=!1},d(A){A&&y(e),X(a),X(R),Kt(si,A),ut&&ut.d(),rt&&rt.d(),X(Zl),Kt(oi,A),at&&at.d(),ft&&ft.d(),ct&&ct.d(),X(fn),X(bn),X(wn),pt&&pt.d(),X($n),mt&&mt.d(),ze&&ze.d(),Ve&&Ve.d(),Ke&&Ke.d(),Qe&&Qe.d(),X(Rn),Kt(lt,A),Xe&&Xe.d(),X(On),_t&&_t.d(),A&&y(Ns),X(ql,A),A&&y(Is),X(Ul,A),A&&y(Es),X(Hl,A),A&&y(Fs),X(jl,A),Rs=!1,Be(hr)}}}async function Gm(){await(await fetch("/reboot",{method:"POST"})).json()}function Bm(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,r=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""}};$c.subscribe(qe=>{qe.version&&(l(3,a=qe),l(1,o=!1))}),bm();let c=!1,f=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const qe=new URLSearchParams;qe.append("perform","true");let Pt=await(await fetch("/reset",{method:"POST",body:qe})).json();l(4,c=!1),l(5,f=Pt.success)}}async function m(qe){l(2,r=!0);const el=new FormData(qe.target),Pt=new URLSearchParams;for(let pl of el){const[He,Ql]=pl;Pt.append(He,Ql)}let Ei=await(await fetch("/save",{method:"POST",body:Pt})).json();Tt.update(pl=>(pl.booting=Ei.reboot,pl.ui=a.u,pl)),l(2,r=!1),Yn("/")}const d=function(){confirm("Are you sure you want to reboot the device?")&&(Tt.update(qe=>(qe.booting=!0,qe)),Gm())},h=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let v=44;function g(){a.g.h=this.value,l(3,a)}function w(){a.g.t=nt(this),l(3,a)}function k(){a.p.r=nt(this),l(3,a)}function T(){a.p.c=nt(this),l(3,a)}function P(){a.p.f=ae(this.value),l(3,a)}function E(){a.p.m=ae(this.value),l(3,a)}function S(){a.p.e=this.checked,l(3,a)}function D(){a.p.t=this.value,l(3,a)}function F(){a.g.s=nt(this),l(3,a)}function R(){a.g.u=this.value,l(3,a)}function B(){a.g.p=this.value,l(3,a)}function L(){a.m.b=nt(this),l(3,a)}function N(){a.m.p=nt(this),l(3,a)}function O(){a.m.i=this.checked,l(3,a)}function j(){a.m.d=nt(this),l(3,a)}function U(){a.m.f=ae(this.value),l(3,a)}function q(){a.m.r=ae(this.value),l(3,a)}function G(){a.m.e.e=this.checked,l(3,a)}function H(){a.m.e.k=this.value,l(3,a)}function V(){a.m.e.a=this.value,l(3,a)}function J(){a.m.m.e=this.checked,l(3,a)}function ne(){a.m.m.w=ae(this.value),l(3,a)}function le(){a.m.m.v=ae(this.value),l(3,a)}function me(){a.m.m.a=ae(this.value),l(3,a)}function Pe(){a.m.m.c=ae(this.value),l(3,a)}function we(){a.w.s=this.value,l(3,a)}function Fe(){a.w.p=this.value,l(3,a)}function Ce(){a.w.z=nt(this),l(3,a)}function Re(){a.w.w=ae(this.value),l(3,a)}function _e(){a.w.a=this.checked,l(3,a)}function Me(){a.n.m=nt(this),l(3,a)}function Ie(){a.n.i=this.value,l(3,a)}function ce(){a.n.s=nt(this),l(3,a)}function se(){a.n.g=this.value,l(3,a)}function pe(){a.n.d1=this.value,l(3,a)}function K(){a.n.d2=this.value,l(3,a)}function re(){a.n.d=this.checked,l(3,a)}function Ae(){a.n.h=this.checked,l(3,a)}function Ne(){a.n.n1=this.value,l(3,a)}function de(){a.q.s.e=this.checked,l(3,a)}function ee(){a.q.h=this.value,l(3,a)}function oe(){a.q.p=ae(this.value),l(3,a)}function ve(){a.q.u=this.value,l(3,a)}function De(){a.q.a=this.value,l(3,a)}function Oe(){a.q.c=this.value,l(3,a)}function he(){a.q.m=nt(this),l(3,a)}function be(){a.q.b=this.value,l(3,a)}function x(){a.o.e=this.value,l(3,a)}function ue(){a.o.c=this.value,l(3,a)}function Cl(){a.o.u1=this.value,l(3,a)}function vi(){a.o.u2=this.value,l(3,a)}function hi(){a.o.u3=this.value,l(3,a)}function St(){a.h.t=this.value,l(3,a)}function bi(){a.h.h=this.value,l(3,a)}function Vl(){a.h.n=this.value,l(3,a)}function cl(qe){a.t.t[qe]=ae(this.value),l(3,a)}function Xt(){a.t.h=ae(this.value),l(3,a)}function gi(qe){a.u[qe.key]=nt(this),l(3,a)}function ki(){a.i.h.u=this.checked,l(3,a)}function wi(){a.i.h.p=nt(this),l(3,a)}function it(){a.i.a=ae(this.value),l(3,a)}function yi(){a.i.l.i=this.checked,l(3,a)}function Zt(){a.i.l.p=ae(this.value),l(3,a)}function $i(){a.i.r.i=this.checked,l(3,a)}function Ci(){a.i.r.r=ae(this.value),l(3,a)}function Ti(){a.i.r.g=ae(this.value),l(3,a)}function st(){a.i.r.b=ae(this.value),l(3,a)}function Si(){a.i.t.d=ae(this.value),l(3,a)}function Jt(){a.i.t.a=ae(this.value),l(3,a)}function Kl(){a.i.v.p=ae(this.value),l(3,a)}function dt(){a.i.v.d.v=ae(this.value),l(3,a)}function Pi(){a.i.v.d.g=ae(this.value),l(3,a)}function Mi(){a.i.v.o=ae(this.value),l(3,a)}function Ai(){a.i.v.m=ae(this.value),l(3,a)}function xt(){a.i.v.b=ae(this.value),l(3,a)}function Di(){a.d.s=this.checked,l(3,a)}function Ni(){a.d.t=this.checked,l(3,a)}function Ii(){a.d.l=nt(this),l(3,a)}return t.$$set=qe=>{"sysinfo"in qe&&l(0,n=qe.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,v=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,r,a,c,f,v,i,_,m,d,h,g,w,k,T,P,E,S,D,F,R,B,L,N,O,j,U,q,G,H,V,J,ne,le,me,Pe,we,Fe,Ce,Re,_e,Me,Ie,ce,se,pe,K,re,Ae,Ne,de,ee,oe,ve,De,Oe,he,be,x,ue,Cl,vi,hi,St,bi,Vl,cl,Xt,gi,ki,wi,it,yi,Zt,$i,Ci,Ti,st,Si,Jt,Kl,dt,Pi,Mi,Ai,xt,Di,Ni,Ii]}class Ym extends $e{constructor(e){super(),ye(this,e,Bm,Wm,ke,{sysinfo:0},null,[-1,-1,-1,-1])}}function af(t,e,l){const n=t.slice();return n[20]=e[l],n}function zm(t){let e=fe(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){$(n,l,i)},p(n,i){i&2&&e!==(e=fe(n[1].chip,n[1].board)+"")&&W(l,e)},d(n){n&&y(l)}}}function ff(t){let e,l,n=t[1].apmac+"",i,o,r,a,c,f,_,m,d,h=qr(t[1])+"",v,g,w=t[1].boot_reason+"",k,T,P=t[1].ex_cause+"",E,S,D;const F=[Km,Vm],R=[];function B(L,N){return L[0].u>0?0:1}return c=B(t),f=R[c]=F[c](t),{c(){e=p("div"),l=C("AP MAC: "),i=C(n),o=b(),r=p("div"),a=C(`Last boot: `),f.c(),_=b(),m=p("div"),d=C("Reason: "),v=C(h),g=C(" ("),k=C(w),T=C("/"),E=C(P),S=C(")"),u(e,"class","my-2"),u(r,"class","my-2"),u(m,"class","my-2")},m(L,N){$(L,e,N),s(e,l),s(e,i),$(L,o,N),$(L,r,N),s(r,a),R[c].m(r,null),$(L,_,N),$(L,m,N),s(m,d),s(m,v),s(m,g),s(m,k),s(m,T),s(m,E),s(m,S),D=!0},p(L,N){(!D||N&2)&&n!==(n=L[1].apmac+"")&&W(i,n);let O=c;c=B(L),c===O?R[c].p(L,N):(Te(),I(R[O],1,1,()=>{R[O]=null}),Se(),f=R[c],f?f.p(L,N):(f=R[c]=F[c](L),f.c()),M(f,1),f.m(r,null)),(!D||N&2)&&h!==(h=qr(L[1])+"")&&W(v,h),(!D||N&2)&&w!==(w=L[1].boot_reason+"")&&W(k,w),(!D||N&2)&&P!==(P=L[1].ex_cause+"")&&W(E,P)},i(L){D||(M(f),D=!0)},o(L){I(f),D=!1},d(L){L&&y(e),L&&y(o),L&&y(r),R[c].d(),L&&y(_),L&&y(m)}}}function Vm(t){let e;return{c(){e=C("-")},m(l,n){$(l,e,n)},p:ie,i:ie,o:ie,d(l){l&&y(e)}}}function Km(t){let e,l;return e=new kc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Qm(t){let e;return{c(){e=p("span"),e.textContent="Update consents",u(e,"class","btn-pri-sm")},m(l,n){$(l,e,n)},p:ie,d(l){l&&y(e)}}}function cf(t){let e,l,n,i,o,r=ds(t[1].meter.mfg)+"",a,c,f,_,m=t[1].meter.model+"",d,h,v,g,w=t[1].meter.id+"",k;return{c(){e=p("div"),l=p("strong"),l.textContent="Meter",n=b(),i=p("div"),o=C("Manufacturer: "),a=C(r),c=b(),f=p("div"),_=C("Model: "),d=C(m),h=b(),v=p("div"),g=C("ID: "),k=C(w),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(v,"class","my-2"),u(e,"class","cnt")},m(T,P){$(T,e,P),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,c),s(e,f),s(f,_),s(f,d),s(e,h),s(e,v),s(v,g),s(v,k)},p(T,P){P&2&&r!==(r=ds(T[1].meter.mfg)+"")&&W(a,r),P&2&&m!==(m=T[1].meter.model+"")&&W(d,m),P&2&&w!==(w=T[1].meter.id+"")&&W(k,w)},d(T){T&&y(e)}}}function pf(t){let e,l,n,i,o,r=t[1].net.ip+"",a,c,f,_,m=t[1].net.mask+"",d,h,v,g,w=t[1].net.gw+"",k,T,P,E,S=t[1].net.dns1+"",D,F,R=t[1].net.dns2&&mf(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Network",n=b(),i=p("div"),o=C("IP: "),a=C(r),c=b(),f=p("div"),_=C("Mask: "),d=C(m),h=b(),v=p("div"),g=C("Gateway: "),k=C(w),T=b(),P=p("div"),E=C("DNS: "),D=C(S),F=b(),R&&R.c(),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(v,"class","my-2"),u(P,"class","my-2"),u(e,"class","cnt")},m(B,L){$(B,e,L),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,c),s(e,f),s(f,_),s(f,d),s(e,h),s(e,v),s(v,g),s(v,k),s(e,T),s(e,P),s(P,E),s(P,D),s(P,F),R&&R.m(P,null)},p(B,L){L&2&&r!==(r=B[1].net.ip+"")&&W(a,r),L&2&&m!==(m=B[1].net.mask+"")&&W(d,m),L&2&&w!==(w=B[1].net.gw+"")&&W(k,w),L&2&&S!==(S=B[1].net.dns1+"")&&W(D,S),B[1].net.dns2?R?R.p(B,L):(R=mf(B),R.c(),R.m(P,null)):R&&(R.d(1),R=null)},d(B){B&&y(e),R&&R.d()}}}function mf(t){let e,l=t[1].net.dns2+"",n;return{c(){e=C("/ "),n=C(l)},m(i,o){$(i,e,o),$(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&W(n,l)},d(i){i&&y(e),i&&y(n)}}}function _f(t){let e,l,n,i=t[1].upgrade.t+"",o,r,a=t[1].version+"",c,f,_=t[1].upgrade.x+"",m,d,h=t[1].upgrade.e+"",v,g;return{c(){e=p("div"),l=p("div"),n=C("Previous upgrade attempt ("),o=C(i),r=C(") does not match current version ("),c=C(a),f=C(") ["),m=C(_),d=C("/"),v=C(h),g=C("]"),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(w,k){$(w,e,k),s(e,l),s(l,n),s(l,o),s(l,r),s(l,c),s(l,f),s(l,m),s(l,d),s(l,v),s(l,g)},p(w,k){k&2&&i!==(i=w[1].upgrade.t+"")&&W(o,i),k&2&&a!==(a=w[1].version+"")&&W(c,a),k&2&&_!==(_=w[1].upgrade.x+"")&&W(m,_),k&2&&h!==(h=w[1].upgrade.e+"")&&W(v,h)},d(w){w&&y(e)}}}function df(t){let e,l,n,i=t[2].tag_name+"",o,r,a,c,f,_,m=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&vf(t),d=t[1].fwconsent===2&&hf();return{c(){e=p("div"),l=C(`Latest version: diff --git a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte index 948be722..89ccc1ea 100644 --- a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte +++ b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte @@ -353,19 +353,19 @@
Watt
- +
Volt
- +
Amp
- +
kWh
- +
{/if}