diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index 37f8648b..e45a677b 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 ne(){}function Xt(t,e){for(const l in e)t[l]=e[l];return t}function Of(t){return t()}function yr(){return Object.create(null)}function Ve(t){t.forEach(Of)}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 Fc(t,e){return os||(os=document.createElement("a")),os.href=e,t===os.href}function Rc(t){return Object.keys(t).length===0}function to(t,...e){if(t==null)return ne;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ii(t){let e;return to(t,l=>e=l)(),e}function il(t,e,l){t.$$.on_destroy.push(to(e,l))}function lo(t,e,l,n){if(t){const i=qf(t,e,l,n);return t[0](i)}}function qf(t,e,l,n){return t[1]&&n?Xt(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 si(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 Uc(t){return Array.from(t.childNodes)}function B(t,e){e=""+e,t.data!==e&&(t.data=e)}function Oc(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function qc(t,e,l){~Lc.indexOf(l)?Oc(t,e):B(t,e)}function V(t,e){t.value=e??""}function Hf(t,e,l,n){l===null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Re(t,e,l){for(let n=0;n{r.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=K(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),w(n)}}function Wc(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function $r(t,e){return new t(e)}let wi;function gi(t){wi=t}function yi(){if(!wi)throw new Error("Function called outside component initialization");return wi}function Gc(t){yi().$$.on_mount.push(t)}function Bc(t){yi().$$.on_destroy.push(t)}function Yc(){const t=yi();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=Wc(e,l,{cancelable:n});return i.slice().forEach(r=>{r.call(t,o)}),!o.defaultPrevented}return!0}}function ki(t,e){return yi().$$.context.set(t,e),e}function El(t){return yi().$$.context.get(t)}const ei=[],ps=[];let ti=[];const Cr=[],jf=Promise.resolve();let Ws=!1;function Wf(){Ws||(Ws=!0,jf.then(Gf))}function zc(){return Wf(),jf}function tt(t){ti.push(t)}const Ls=new Set;let Jn=0;function Gf(){if(Jn!==0)return;const t=wi;do{try{for(;Jnt.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),ti=e}const fs=new Set;let en;function Te(){en={r:0,c:[],p:en}}function Se(){en.r||Ve(en.c),en=en.p}function N(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),en.c.push(()=>{fs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function Bf(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 f in r)f in a||(n[f]=1);for(const f in a)i[f]||(l[f]=a[f],i[f]=1);t[o]=a}else for(const f in r)i[f]=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 J(t){t&&t.c()}function X(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||tt(()=>{const r=t.$$.on_mount.map(Of).filter(eo);t.$$.on_destroy?t.$$.on_destroy.push(...r):Ve(r),t.$$.on_mount=[]}),o.forEach(tt)}function Z(t,e){const l=t.$$;l.fragment!==null&&(Kc(l.after_update),Ve(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function Qc(t,e){t.$$.dirty[0]===-1&&(ei.push(t),Wf(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const h=v.length?v[0]:d;return c.ctx&&i(c.ctx[p],c.ctx[p]=h)&&(!c.skip_bound&&c.bound[p]&&c.bound[p](h),_&&Qc(t,p)),d}):[],c.update(),_=!0,Ve(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const p=Uc(e.target);c.fragment&&c.fragment.l(p),p.forEach(w)}else c.fragment&&c.fragment.c();e.intro&&N(t.$$.fragment),X(t,e.target,e.anchor,e.customElement),Gf()}gi(f)}class $e{$destroy(){Z(this,1),this.$destroy=ne}$on(e,l){if(!eo(l))return ne;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&&!Rc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Sr=t=>typeof t>"u",Yf=t=>typeof t=="function",zf=t=>typeof t=="number";function Xc(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Vf(){let t=0;return()=>t++}function Zc(){return Math.random().toString(36).substring(2)}const Fl=typeof window>"u";function Kf(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Qf=(t,e)=>t?{}:{style:e},Gs=t=>({"aria-hidden":"true",...Qf(t,"display:none;")}),xn=[];function Xf(t,e){return{subscribe:ut(t,e).subscribe}}function ut(t,e=ne){let l;const n=new Set;function i(a){if(ke(t,a)&&(t=a,l)){const f=!xn.length;for(const c of n)c[1](),xn.push(c,t);if(f){for(let c=0;c{n.delete(c),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:r}}function Jc(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return Xf(l,r=>{let a=!1;const f=[];let c=0,_=ne;const p=()=>{if(c)return;_();const v=e(n?f[0]:f,r);o?r(v):_=eo(v)?v:ne},d=i.map((v,h)=>to(v,g=>{f[h]=g,c&=~(1<{c|=1<`@@svnav-ctx__${t}`,Bs=$i("LOCATION"),oi=$i("ROUTER"),Zf=$i("ROUTE"),xc=$i("ROUTE_PARAMS"),e1=$i("FOCUS_ELEM"),Jf=/^:(.+)/,bi=(t,e,l)=>t.substr(e,l),Ys=(t,e)=>bi(t,0,e.length)===e,t1=t=>t==="",l1=t=>Jf.test(t),xf=t=>t[0]==="*",n1=t=>t.replace(/\*.*$/,""),ec=t=>t.replace(/(^\/+|\/+$)/g,"");function rl(t,e=!1){const l=ec(t).split("/");return e?l.filter(Boolean):l}const Us=(t,e)=>t+(e?`?${e}`:""),oo=t=>`/${ec(t)}`;function Ci(...t){const e=n=>rl(n,!0).join("/"),l=t.map(e).join("/");return oo(l)}const uo=1,bs=2,nn=3,i1=4,tc=5,s1=6,lc=7,o1=8,u1=9,nc=10,ic=11,r1={[uo]:"Link",[bs]:"Route",[nn]:"Router",[i1]:"useFocus",[tc]:"useLocation",[s1]:"useMatch",[lc]:"useNavigate",[o1]:"useParams",[u1]:"useResolvable",[nc]:"useResolve",[ic]:"navigate"},ro=t=>r1[t];function a1(t,e){let l;return t===bs?l=e.path?`path="${e.path}"`:"default":t===uo?l=`to="${e.to}"`:t===nn&&(l=`basepath="${e.basepath||""}"`),`<${ro(t)} ${l||""} />`}function f1(t,e,l,n){const i=l&&a1(n||t,l),o=i?` Occurred in: ${i}`:"",r=ro(t),a=Yf(e)?e(r):e;return`<${r}> ${a}${o}`}const sc=t=>(...e)=>t(f1(...e)),oc=sc(t=>{throw new Error(t)}),_s=sc(console.warn),Pr=4,c1=3,m1=2,p1=1,_1=1;function d1(t,e){const l=t.default?0:rl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Pr,t1(i)?o+=_1:l1(i)?o+=m1:xf(i)?o-=Pr+p1:o+=c1,o},0);return{route:t,score:l,index:e}}function v1(t){return t.map(d1).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function uc(t,e){let l,n;const[i]=e.split("?"),o=rl(i),r=o[0]==="",a=v1(t);for(let f=0,c=a.length;f({..._,params:d,uri:C});if(_.default){n=v(e);continue}const h=rl(_.fullPath),g=Math.max(o.length,h.length);let k=0;for(;k{c===".."?f.pop():c!=="."&&f.push(c)}),Us(`/${f.join("/")}`,n)}function Nr(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,r=rl(e,!0),a=rl(l,!0);for(;r.length;)r[0]!==a[0]&&oc(nn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),r.shift(),a.shift();return{pathname:Ci(...a),hash:n,search:i,state:o}}const Mr=t=>t.length===1?"":t,ao=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Mr(bi(t,l)):"",r=i?bi(t,0,l):t,a=n?Mr(bi(r,e)):"";return{pathname:(n?bi(r,0,e):r)||"/",search:a,hash:o}},b1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function g1(t,e,l){return Ci(l,h1(t,e))}function k1(t,e){const l=oo(n1(t)),n=rl(l,!0),i=rl(e,!0).slice(0,n.length),o=rc({fullPath:l},Ci(...i));return o&&o.uri}const Os="POP",w1="PUSH",y1="REPLACE";function qs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function $1(t){let e=[],l=qs(t),n=Os;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=qs(t),n=Os,i([o])};i([o]);const a=Kf(t,"popstate",r);return()=>{a(),e=e.filter(f=>f!==o)}},navigate(o,r){const{state:a={},replace:f=!1}=r||{};if(n=f?y1:w1,zf(o))r&&_s(ic,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Os,t.history.go(o);else{const c={...a,_key:Zc()};try{t.history[f?"replaceState":"pushState"](c,"",o)}catch{t.location[f?"replace":"assign"](o)}}l=qs(t),i()}}}function Hs(t,e){return{...ao(e),state:t}}function C1(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 T1=!!(!Fl&&window.document&&window.document.createElement),S1=!Fl&&window.location.origin==="null",ac=$1(T1&&!S1?window:C1()),{navigate:li}=ac;let yl=null,fc=!0;function P1(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nyl.level||t.level===yl.level&&P1(t.routerId,yl.routerId))&&(yl=t)}function M1(){yl=null}function A1(){fc=!1}function Ar(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Kf(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function D1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function I1(t){return/^H[1-6]$/i.test(t.tagName)}function Dr(t,e=document){return e.querySelector(t)}function E1(t){let l=Dr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!D1(l,t);){if(I1(l))return l;const n=Dr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function F1(t){Promise.resolve(ii(t.focusElement)).then(e=>{const l=e||E1(t.id);l||_s(nn,`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),!Ar(l)&&Ar(document.documentElement)})}const R1=(t,e,l)=>(n,i)=>zc().then(()=>{if(!yl||fc){A1();return}if(n&&F1(yl.route),t.announcements&&i){const{path:o,fullPath:r,meta:a,params:f,uri:c}=yl.route,_=t.createAnnouncement({path:o,fullPath:r,meta:a,params:f,uri:c},ii(l));Promise.resolve(_).then(p=>{e.set(p)})}M1()}),L1="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 U1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Qf(t[6],L1)],i={};for(let o=0;o`Navigated to ${le.uri}`,announcements:!0,...h},C=_,T=oo(_),P=El(Bs),D=El(oi),S=!P,A=q1(),E=v&&!(D&&!D.manageFocus),F=ut("");il(t,F,le=>l(0,a=le));const z=D?D.disableInlineStyles:g,U=ut([]);il(t,U,le=>l(20,r=le));const R=ut(null);il(t,R,le=>l(18,i=le));let q=!1;const Y=S?0:D.level+1,H=S?ut((()=>Nr(Fl?ao(p):d.location,T))()):P;il(t,H,le=>l(17,n=le));const G=ut(n);il(t,G,le=>l(19,o=le));const L=R1(k,F,H),W=le=>de=>de.filter(ie=>ie.id!==le);function j(le){if(Fl){if(q)return;const de=rc(le,n.pathname);if(de)return q=!0,de}else U.update(de=>{const ie=W(le.id)(de);return ie.push(le),ie})}function ee(le){U.update(W(le))}return!S&&_!==Ir&&_s(nn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),S&&(Gc(()=>d.listen(de=>{const ie=Nr(de.location,T);G.set(n),H.set(ie)})),ki(Bs,H)),ki(oi,{activeRoute:R,registerRoute:j,unregisterRoute:ee,manageFocus:E,level:Y,id:A,history:S?d:D.history,basepath:S?T:D.basepath,disableInlineStyles:z}),t.$$set=le=>{"basepath"in le&&l(11,_=le.basepath),"url"in le&&l(12,p=le.url),"history"in le&&l(13,d=le.history),"primary"in le&&l(14,v=le.primary),"a11y"in le&&l(15,h=le.a11y),"disableInlineStyles"in le&&l(16,g=le.disableInlineStyles),"$$scope"in le&&l(21,c=le.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==C&&_s(nn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const le=uc(r,n.pathname);R.set(le)}if(t.$$.dirty[0]&655360&&S){const le=!!n.hash,de=!le&&E,ie=!le||n.pathname!==o.pathname;L(de,ie)}t.$$.dirty[0]&262144&&E&&i&&i.primary&&N1({level:Y,routerId:A,route:i})},[a,k,S,A,E,F,z,U,R,H,G,_,p,d,v,h,g,n,i,o,r,c,f]}class j1 extends $e{constructor(e){super(),ye(this,e,H1,O1,ke,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const cc=j1;function Ti(t,e,l=oi,n=nn){El(l)||oc(t,o=>`You cannot use ${o} outside of a ${ro(n)}.`,e)}const W1=t=>{const{subscribe:e}=El(t);return{subscribe:e}};function mc(){return Ti(tc),W1(Bs)}function pc(){const{history:t}=El(oi);return t}function _c(){const t=El(Zf);return t?Jc(t,e=>e.base):ut("/")}function dc(){Ti(nc);const t=_c(),{basepath:e}=El(oi);return n=>g1(n,ii(t),e)}function G1(){Ti(lc);const t=dc(),{navigate:e}=pc();return(n,i)=>{const o=zf(n)?n:t(n);return e(o,i)}}const B1=t=>({params:t&16,location:t&8}),Er=t=>({params:Fl?ii(t[10]):t[4],location:t[3],navigate:t[11]});function Fr(t){let e,l;return e=new cc({props:{primary:t[1],$$slots:{default:[V1]},$$scope:{ctx:t}}}),{c(){J(e.$$.fragment)},m(n,i){X(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||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Y1(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,B1):so(i[19]),Er)},i(i){e||(N(n,i),e=!0)},o(i){I(n,i),e=!1},d(i){n&&n.d(i)}}}function z1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Fl?ii(t[10]):t[4],t[12]];var o=t[0];function r(a){let f={};for(let c=0;c{Z(_,1)}),Se()}o?(e=$r(o,r()),J(e.$$.fragment),N(e.$$.fragment,1),X(e,l.parentNode,l)):e=null}else o&&e.$set(c)},i(a){n||(e&&N(e.$$.fragment,a),n=!0)},o(a){e&&I(e.$$.fragment,a),n=!1},d(a){a&&w(l),e&&Z(e,a)}}}function V1(t){let e,l,n,i;const o=[z1,Y1],r=[];function a(f,c){return f[0]!==null?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let _=e;e=a(f),e===_?r[e].p(f,c):(Te(),I(r[_],1,1,()=>{r[_]=null}),Se(),l=r[e],l?l.p(f,c):(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){I(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function K1(t){let e,l,n,i,o,r=[Gs(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let p=0;p{f=null}),Se())},i(p){o||(N(f),o=!0)},o(p){I(f),o=!1},d(p){p&&w(e),p&&w(l),f&&f.d(p),p&&w(n),p&&w(i)}}}const Q1=Vf();function X1(t,e,l){let n;const i=["path","component","meta","primary"];let o=ms(e,i),r,a,f,c,{$$slots:_={},$$scope:p}=e,{path:d=""}=e,{component:v=null}=e,{meta:h={}}=e,{primary:g=!0}=e;Ti(bs,e);const k=Q1(),{registerRoute:C,unregisterRoute:T,activeRoute:P,disableInlineStyles:D}=El(oi);il(t,P,q=>l(16,r=q));const S=_c();il(t,S,q=>l(17,f=q));const A=mc();il(t,A,q=>l(3,a=q));const E=ut(null);let F;const z=ut(),U=ut({});il(t,U,q=>l(4,c=q)),ki(Zf,z),ki(xc,U),ki(e1,E);const R=G1();return Fl||Bc(()=>T(k)),t.$$set=q=>{l(24,e=Xt(Xt({},e),cs(q))),l(12,o=ms(e,i)),"path"in q&&l(13,d=q.path),"component"in q&&l(0,v=q.component),"meta"in q&&l(14,h=q.meta),"primary"in q&&l(1,g=q.primary),"$$scope"in q&&l(19,p=q.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const q=d==="",Y=Ci(f,d),O={id:k,path:d,meta:h,default:q,fullPath:q?"":Y,base:q?f:k1(Y,a.pathname),primary:g,focusElement:E};z.set(O),l(15,F=C(O))}if(t.$$.dirty&98304&&l(2,n=!!(F||r&&r.id===k)),t.$$.dirty&98308&&n){const{params:q}=F||r;U.set(q)}},e=cs(e),[v,g,n,a,c,k,P,D,S,A,U,R,o,d,h,F,r,f,_,p]}class Z1 extends $e{constructor(e){super(),ye(this,e,X1,K1,ke,{path:13,component:0,meta:14,primary:1})}}const wl=Z1;function J1(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]],f={};for(let c=0;cl(11,p=E));const P=Yc(),D=dc(),{navigate:S}=pc();function A(E){P("click",E),Xc(E)&&(E.preventDefault(),S(n,{state:k,replace:r||g}))}return t.$$set=E=>{l(19,e=Xt(Xt({},e),cs(E))),l(18,_=ms(e,c)),"to"in E&&l(5,h=E.to),"replace"in E&&l(6,g=E.replace),"state"in E&&l(7,k=E.state),"getProps"in E&&l(8,C=E.getProps),"$$scope"in E&&l(12,v=E.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=D(h,p)),t.$$.dirty&2049&&l(10,i=Ys(p.pathname,n)),t.$$.dirty&2049&&l(9,o=n===p.pathname),t.$$.dirty&2049&&(r=ao(n)===b1(p)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,f=(()=>{if(Yf(C)){const E=C({location:p,href:n,isPartiallyCurrent:i,isCurrent:o});return{..._,...E}}return _})())},e=cs(e),[n,f,a,T,A,h,g,k,C,o,i,p,v,d]}class em extends $e{constructor(e){super(),ye(this,e,x1,J1,ke,{to:5,replace:6,state:7,getProps:8})}}const Il=em;let zs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Dl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function tm(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function vc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function lm(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 De(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 Ur(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 ni(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ye(t,e){return t==1||t==2&&e}function Ft(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ce(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function sl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Or(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 Rl(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 nl={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const Rt=ut(nl);async function fo(){nl=await(await Rl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Rt.set(nl)}let rs=0,qr=-127,Hr=null,nm={};const im=Xf(nm,t=>{let e;async function l(){Rl("/data.json").then(n=>n.json()).then(n=>{t(n),qr!=n.t&&(qr=n.t,setTimeout(kc,2e3)),Hr!=n.p&&n.pe&&(Hr=n.p,setTimeout(sm,1e3)),nl.upgrading?window.location.reload():(!nl||!nl.chip||nl.booting||rs>1&&!ni(nl.board))&&(fo(),tn&&clearTimeout(tn),tn=setTimeout(co,2e3),ln&&clearTimeout(ln),ln=setTimeout(mo,3e3));let i=5e3;if(ni(nl.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,ni(nl.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Vs={};const hc=ut(Vs);async function sm(){Vs=await(await Rl("/energyprice.json")).json(),hc.set(Vs)}let Ks={},tn;async function co(){tn&&(clearTimeout(tn),tn=0),Ks=await(await Rl("/dayplot.json")).json(),bc.set(Ks),tn=setTimeout(co,(60-new Date().getMinutes())*6e4+20)}const bc=ut(Ks,t=>(co(),function(){}));let Qs={},ln;async function mo(){ln&&(clearTimeout(ln),ln=0),Qs=await(await Rl("/monthplot.json")).json(),gc.set(Qs),ln=setTimeout(mo,(24-new Date().getHours())*36e5+40)}const gc=ut(Qs,t=>(mo(),function(){}));let Xs={};async function kc(){Xs=await(await Rl("/temperature.json")).json(),wc.set(Xs)}const wc=ut(Xs,t=>(kc(),function(){}));let Zs={},as;async function yc(){as&&(clearTimeout(as),as=0),Zs=await(await Rl("/tariff.json")).json(),$c.set(Zs),as=setTimeout(yc,(60-new Date().getMinutes())*6e4+30)}const $c=ut(Zs,t=>function(){});let Js=[];const po=ut(Js);async function om(){Js=await(await Rl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),po.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 Cc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Tc(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,f,c;for(let _=0;_o&&(a=p):g==i+1&&(f=p);else if(h==n+1)if(c){let C=c.tag_name.substring(1).split(".");parseInt(C[0]);let T=parseInt(C[1]);parseInt(C[2]),g==T&&(c=p)}else c=p}return f||c||a||!1}else return e[0]}const um="/github.svg";function jr(t){let e,l;function n(r,a){return r[1]>1?_m:r[1]>0?pm:r[2]>1?mm:r[2]>0?cm:r[3]>1?fm:r[3]>0?am:rm}let i=n(t),o=i(t);return{c(){e=$(`Up - `),o.c(),l=Ge()},m(r,a){y(r,e,a),o.m(r,a),y(r,l,a)},p(r,a){i===(i=n(r))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},d(r){r&&w(e),o.d(r),r&&w(l)}}}function rm(t){let e,l;return{c(){e=$(t[0]),l=$(" seconds")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&1&&B(e,n[0])},d(n){n&&w(e),n&&w(l)}}}function am(t){let e,l;return{c(){e=$(t[3]),l=$(" minute")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function fm(t){let e,l;return{c(){e=$(t[3]),l=$(" minutes")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function cm(t){let e,l;return{c(){e=$(t[2]),l=$(" hour")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function mm(t){let e,l;return{c(){e=$(t[2]),l=$(" hours")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function pm(t){let e,l;return{c(){e=$(t[1]),l=$(" day")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function _m(t){let e,l;return{c(){e=$(t[1]),l=$(" days")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function dm(t){let e,l=t[0]&&jr(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),y(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:ne,o:ne,d(n){l&&l.d(n),n&&w(e)}}}function vm(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 hm extends $e{constructor(e){super(),ye(this,e,vm,dm,ke,{epoch:0})}}function bm(t){let e,l,n;return{c(){e=m("span"),l=$(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){y(i,e,o),s(e,l)},p(i,[o]){o&4&&B(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ne,o:ne,d(i){i&&w(e)}}}function gm(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 ol extends $e{constructor(e){super(),ye(this,e,gm,bm,ke,{color:0,title:1,text:2})}}function km(t){let e,l=`${De(t[0].getDate())}.${De(t[0].getMonth()+1)}.${t[0].getFullYear()} ${De(t[0].getUTCHours())}:${De(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=$(l),u(e,"class",t[1])},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${De(i[0].getDate())}.${De(i[0].getMonth()+1)}.${i[0].getFullYear()} ${De(i[0].getUTCHours())}:${De(i[0].getMinutes())}`)&&B(n,l),o&2&&u(e,"class",i[1])},d(i){i&&w(e)}}}function wm(t){let e=`${De(t[0].getDate())}. ${zs[t[0].getMonth()]} ${De(t[0].getUTCHours())}:${De(t[0].getMinutes())}`,l;return{c(){l=$(e)},m(n,i){y(n,l,i)},p(n,i){i&1&&e!==(e=`${De(n[0].getDate())}. ${zs[n[0].getMonth()]} ${De(n[0].getUTCHours())}:${De(n[0].getMinutes())}`)&&B(l,e)},d(n){n&&w(l)}}}function ym(t){let e;function l(o,r){return o[2]?wm:km}let n=l(t),i=n(t);return{c(){i.c(),e=Ge()},m(o,r){i.m(o,r),y(o,e,r)},p(o,[r]){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:ne,o:ne,d(o){i.d(o),o&&w(e)}}}function $m(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,r;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,o=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,r=Math.abs(new Date().getTime()-n.getTime())<3e5),sl(n,o))},[n,i,r,o]}class Sc extends $e{constructor(e){super(),ye(this,e,$m,ym,ke,{timestamp:0,fullTimeColor:1,offset:3})}}function Cm(t){let e,l,n;return{c(){e=qe("svg"),l=qe("path"),n=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){y(i,e,o),s(e,l),s(e,n)},p:ne,i:ne,o:ne,d(i){i&&w(e)}}}class Tm extends $e{constructor(e){super(),ye(this,e,null,Cm,ke,{})}}function Sm(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Pm extends $e{constructor(e){super(),ye(this,e,null,Sm,ke,{})}}function Nm(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Et extends $e{constructor(e){super(),ye(this,e,null,Nm,ke,{})}}function Mm(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Pc extends $e{constructor(e){super(),ye(this,e,null,Mm,ke,{})}}function Am(t){let e,l,n=t[1].version+"",i;return{c(){e=$("AMS reader "),l=m("span"),i=$(n)},m(o,r){y(o,e,r),y(o,l,r),s(l,i)},p(o,r){r&2&&n!==(n=o[1].version+"")&&B(i,n)},d(o){o&&w(e),o&&w(l)}}}function Wr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=$(l),i=$("°C"),u(e,"class","flex-none my-auto")},m(o,r){y(o,e,r),s(e,n),s(e,i)},p(o,r){r&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&B(n,l)},d(o){o&&w(e)}}}function Gr(t){let e,l="HAN: "+Rr(t[0].he),n;return{c(){e=m("div"),n=$(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Rr(i[0].he))&&B(n,l)},d(i){i&&w(e)}}}function Br(t){let e,l="MQTT: "+Lr(t[0].me),n;return{c(){e=m("div"),n=$(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Lr(i[0].me))&&B(n,l)},d(i){i&&w(e)}}}function Yr(t){let e,l="PriceAPI: "+Ur(t[0].ee),n;return{c(){e=m("div"),n=$(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Ur(i[0].ee))&&B(n,l)},d(i){i&&w(e)}}}function zr(t){let e,l,n,i,o,r;return l=new Il({props:{to:"/configuration",$$slots:{default:[Dm]},$$scope:{ctx:t}}}),o=new Il({props:{to:"/status",$$slots:{default:[Im]},$$scope:{ctx:t}}}),{c(){e=m("div"),J(l.$$.fragment),n=b(),i=m("div"),J(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(a,f){y(a,e,f),X(l,e,null),y(a,n,f),y(a,i,f),X(o,i,null),r=!0},i(a){r||(N(l.$$.fragment,a),N(o.$$.fragment,a),r=!0)},o(a){I(l.$$.fragment,a),I(o.$$.fragment,a),r=!1},d(a){a&&w(e),Z(l),a&&w(n),a&&w(i),Z(o)}}}function Dm(t){let e,l;return e=new Tm({}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Im(t){let e,l;return e=new Pm({}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Vr(t){let e,l,n,i,o;const r=[Fm,Em],a=[];function f(c,_){return c[1].security==0||c[0].a?0:1}return l=f(t),n=a[l]=r[l](t),{c(){e=m("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(c,_){y(c,e,_),a[l].m(e,null),o=!0},p(c,_){let p=l;l=f(c),l===p?a[l].p(c,_):(Te(),I(a[p],1,1,()=>{a[p]=null}),Se(),n=a[l],n?n.p(c,_):(n=a[l]=r[l](c),n.c()),N(n,1),n.m(e,null)),(!o||_&4&&i!==(i="New version: "+c[2].tag_name))&&u(e,"title",i)},i(c){o||(N(n),o=!0)},o(c){I(n),o=!1},d(c){c&&w(e),a[l].d()}}}function Em(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=$("New version: "),i=$(n)},m(o,r){y(o,e,r),s(e,l),s(e,i)},p(o,r){r&4&&n!==(n=o[2].tag_name+"")&&B(i,n)},i:ne,o:ne,d(o){o&&w(e)}}}function Fm(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,_;return a=new Pc({}),{c(){e=m("button"),l=m("span"),n=$("New version: "),o=$(i),r=b(),J(a.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(p,d){y(p,e,d),s(e,l),s(l,n),s(l,o),s(e,r),X(a,e,null),f=!0,c||(_=K(e,"click",t[3]),c=!0)},p(p,d){(!f||d&4)&&i!==(i=p[2].tag_name+"")&&B(o,i)},i(p){f||(N(a.$$.fragment,p),f=!0)},o(p){I(a.$$.fragment,p),f=!1},d(p){p&&w(e),Z(a),c=!1,_()}}}function Rm(t){let e,l,n,i,o,r,a,f,c,_,p,d,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",h,g,k,C,T,P,D,S,A,E,F,z,U,R,q,Y,O,H,G,L,W,j,ee,le,de,ie,we,Ie,Ce,Ee;i=new Il({props:{to:"/",$$slots:{default:[Am]},$$scope:{ctx:t}}}),f=new hm({props:{epoch:t[0].u}});let ve=t[0].t>-50&&Wr(t);T=new ol({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:Dl(t[1].booting?2:t[0].em)}}),D=new ol({props:{title:"HAN",text:"HAN",color:Dl(t[1].booting?9:t[0].hm)}}),A=new ol({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:Dl(t[1].booting?9:t[0].wm)}}),F=new ol({props:{title:"MQTT",text:"MQTT",color:Dl(t[1].booting?9:t[0].mm)}});let Pe=(t[0].he<0||t[0].he>0)&&Gr(t),Ae=t[0].me<0&&Br(t),me=(t[0].ee>0||t[0].ee<0)&&Yr(t);ee=new Sc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let se=t[1].vndcfg&&t[1].usrcfg&&zr(t);Ie=new Et({});let pe=t[1].fwconsent===1&&t[2]&&Vr(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),J(i.$$.fragment),o=b(),r=m("div"),a=m("div"),J(f.$$.fragment),c=b(),ve&&ve.c(),_=b(),p=m("div"),d=$("Free mem: "),h=$(v),g=$("kb"),k=b(),C=m("div"),J(T.$$.fragment),P=b(),J(D.$$.fragment),S=b(),J(A.$$.fragment),E=b(),J(F.$$.fragment),z=b(),Pe&&Pe.c(),U=b(),Ae&&Ae.c(),R=b(),me&&me.c(),q=b(),Y=m("div"),O=m("div"),H=m("a"),G=m("img"),W=b(),j=m("div"),J(ee.$$.fragment),le=b(),se&&se.c(),de=b(),ie=m("div"),we=m("a"),J(Ie.$$.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(p,"class","flex-none my-auto"),u(r,"class","flex-none my-auto p-2 flex space-x-4"),u(C,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(G,"class","gh-logo"),Fc(G.src,L=um)||u(G,"src",L),u(G,"alt","GitHub repo"),u(H,"class","float-right"),u(H,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(H,"target","_blank"),u(H,"rel","noreferrer"),u(H,"aria-label","GitHub"),u(O,"class","flex-none"),u(j,"class","flex-none my-auto px-2"),u(we,"href",Ft("")),u(we,"target","_blank"),u(we,"rel","noreferrer"),u(ie,"class","flex-none px-1 mt-1"),u(ie,"title","Documentation"),u(Y,"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(Q,oe){y(Q,e,oe),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(r,a),X(f,a,null),s(r,c),ve&&ve.m(r,null),s(r,_),s(r,p),s(p,d),s(p,h),s(p,g),s(l,k),s(l,C),X(T,C,null),s(C,P),X(D,C,null),s(C,S),X(A,C,null),s(C,E),X(F,C,null),s(l,z),Pe&&Pe.m(l,null),s(l,U),Ae&&Ae.m(l,null),s(l,R),me&&me.m(l,null),s(l,q),s(l,Y),s(Y,O),s(O,H),s(H,G),s(Y,W),s(Y,j),X(ee,j,null),s(Y,le),se&&se.m(Y,null),s(Y,de),s(Y,ie),s(ie,we),X(Ie,we,null),s(Y,Ce),pe&&pe.m(Y,null),Ee=!0},p(Q,[oe]){const Ne={};oe&18&&(Ne.$$scope={dirty:oe,ctx:Q}),i.$set(Ne);const Me={};oe&1&&(Me.epoch=Q[0].u),f.$set(Me),Q[0].t>-50?ve?ve.p(Q,oe):(ve=Wr(Q),ve.c(),ve.m(r,_)):ve&&(ve.d(1),ve=null),(!Ee||oe&1)&&v!==(v=(Q[0].m?(Q[0].m/1e3).toFixed(1):"-")+"")&&B(h,v);const he={};oe&3&&(he.text=Q[1].booting?"Booting":Q[0].v>2?Q[0].v.toFixed(2)+"V":"ESP"),oe&3&&(he.color=Dl(Q[1].booting?2:Q[0].em)),T.$set(he);const x={};oe&3&&(x.color=Dl(Q[1].booting?9:Q[0].hm)),D.$set(x);const _e={};oe&1&&(_e.text=Q[0].r?Q[0].r.toFixed(0)+"dBm":"WiFi"),oe&3&&(_e.color=Dl(Q[1].booting?9:Q[0].wm)),A.$set(_e);const Le={};oe&3&&(Le.color=Dl(Q[1].booting?9:Q[0].mm)),F.$set(Le),Q[0].he<0||Q[0].he>0?Pe?Pe.p(Q,oe):(Pe=Gr(Q),Pe.c(),Pe.m(l,U)):Pe&&(Pe.d(1),Pe=null),Q[0].me<0?Ae?Ae.p(Q,oe):(Ae=Br(Q),Ae.c(),Ae.m(l,R)):Ae&&(Ae.d(1),Ae=null),Q[0].ee>0||Q[0].ee<0?me?me.p(Q,oe):(me=Yr(Q),me.c(),me.m(l,q)):me&&(me.d(1),me=null);const We={};oe&1&&(We.timestamp=Q[0].c?new Date(Q[0].c*1e3):new Date(0)),oe&2&&(We.offset=Q[1].clock_offset),ee.$set(We),Q[1].vndcfg&&Q[1].usrcfg?se?oe&2&&N(se,1):(se=zr(Q),se.c(),N(se,1),se.m(Y,de)):se&&(Te(),I(se,1,1,()=>{se=null}),Se()),Q[1].fwconsent===1&&Q[2]?pe?(pe.p(Q,oe),oe&6&&N(pe,1)):(pe=Vr(Q),pe.c(),N(pe,1),pe.m(Y,null)):pe&&(Te(),I(pe,1,1,()=>{pe=null}),Se())},i(Q){Ee||(N(i.$$.fragment,Q),N(f.$$.fragment,Q),N(T.$$.fragment,Q),N(D.$$.fragment,Q),N(A.$$.fragment,Q),N(F.$$.fragment,Q),N(ee.$$.fragment,Q),N(se),N(Ie.$$.fragment,Q),N(pe),Ee=!0)},o(Q){I(i.$$.fragment,Q),I(f.$$.fragment,Q),I(T.$$.fragment,Q),I(D.$$.fragment,Q),I(A.$$.fragment,Q),I(F.$$.fragment,Q),I(ee.$$.fragment,Q),I(se),I(Ie.$$.fragment,Q),I(pe),Ee=!1},d(Q){Q&&w(e),Z(i),Z(f),ve&&ve.d(),Z(T),Z(D),Z(A),Z(F),Pe&&Pe.d(),Ae&&Ae.d(),me&&me.d(),Z(ee),se&&se.d(),Z(Ie),pe&&pe.d()}}}function Lm(t,e,l){let{data:n={}}=e,i={},o={};function r(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!ni(i.board)||confirm(vs(fe(i.chip,i.board))))&&(Rt.update(a=>(a.upgrading=!0,a)),Cc(o.tag_name))}return Rt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&om()}),po.subscribe(a=>{l(2,o=Tc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,r]}class Um extends $e{constructor(e){super(),ye(this,e,Lm,Rm,ke,{data:0})}}function Om(t){let e,l,n,i;return{c(){e=qe("svg"),l=qe("path"),n=qe("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){y(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:ne,o:ne,d(o){o&&w(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",f=["M",o.x,o.y,"A",l,l,0,a,0,r.x,r.y].join(" ");return f}function qm(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 Hm extends $e{constructor(e){super(),ye(this,e,qm,Om,ke,{pct:0,color:1})}}function Qr(t){let e,l,n,i,o,r,a,f;return{c(){e=m("br"),l=b(),n=m("span"),i=$(t[3]),o=b(),r=m("span"),a=$(t[4]),f=$("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(c,_){y(c,e,_),y(c,l,_),y(c,n,_),s(n,i),y(c,o,_),y(c,r,_),s(r,a),s(r,f)},p(c,_){_&8&&B(i,c[3]),_&16&&B(a,c[4])},d(c){c&&w(e),c&&w(l),c&&w(n),c&&w(o),c&&w(r)}}}function jm(t){let e,l,n,i,o,r,a,f,c,_,p,d,v,h,g,k;l=new Hm({props:{pct:t[6],color:t[5](t[6])}});let C=t[3]&&Qr(t);return{c(){e=m("div"),J(l.$$.fragment),n=b(),i=m("span"),o=m("span"),r=$(t[2]),a=b(),f=m("br"),c=b(),_=m("span"),p=$(t[0]),d=b(),v=m("span"),h=$(t[1]),g=b(),C&&C.c(),u(o,"class","pl-lab"),u(_,"class","pl-val"),u(v,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(T,P){y(T,e,P),X(l,e,null),s(e,n),s(e,i),s(i,o),s(o,r),s(i,a),s(i,f),s(i,c),s(i,_),s(_,p),s(i,d),s(i,v),s(v,h),s(i,g),C&&C.m(i,null),k=!0},p(T,[P]){const D={};P&64&&(D.pct=T[6]),P&96&&(D.color=T[5](T[6])),l.$set(D),(!k||P&4)&&B(r,T[2]),(!k||P&1)&&B(p,T[0]),(!k||P&2)&&B(h,T[1]),T[3]?C?C.p(T,P):(C=Qr(T),C.c(),C.m(i,null)):C&&(C.d(1),C=null)},i(T){k||(N(l.$$.fragment,T),k=!0)},o(T){I(l.$$.fragment,T),k=!1},d(T){T&&w(e),Z(l),C&&C.d()}}}function Wm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:r}=e,{sub:a=""}=e,{subunit:f=""}=e,{colorFn:c}=e,_=0;return t.$$set=p=>{"val"in p&&l(0,n=p.val),"max"in p&&l(7,i=p.max),"unit"in p&&l(1,o=p.unit),"label"in p&&l(2,r=p.label),"sub"in p&&l(3,a=p.sub),"subunit"in p&&l(4,f=p.subunit),"colorFn"in p&&l(5,c=p.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,o,r,a,f,c,_,i]}class Nc extends $e{constructor(e){super(),ye(this,e,Wm,jm,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[10]=e[l],n[12]=l,n}function Zr(t,e,l){const n=t.slice();return n[10]=e[l],n[12]=l,n}function Jr(t,e,l){const n=t.slice();return n[14]=e[l],n}function xr(t){let e,l,n,i,o,r=t[0].title&&ea(t),a=t[0].y.ticks,f=[];for(let v=0;v20||t[12]%2==0)&&ia(t);return{c(){e=qe("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[5](t[12])+","+t[4]+")")},m(i,o){y(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[12]%2==0?n?n.p(i,o):(n=ia(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[12])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&w(e),n&&n.d()}}}function ia(t){let e,l=t[10].label+"",n,i;return{c(){e=qe("text"),n=$(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(o,r){y(o,e,r),s(e,n)},p(o,r){r&1&&l!==(l=o[10].label+"")&&B(n,l),r&8&&i!==(i=o[3]/2)&&u(e,"x",i)},d(o){o&&w(e)}}}function sa(t){let e=!isNaN(t[5](t[12])),l,n=e&&na(t);return{c(){n&&n.c(),l=Ge()},m(i,o){n&&n.m(i,o),y(i,l,o)},p(i,o){o&32&&(e=!isNaN(i[5](i[12]))),e?n?n.p(i,o):(n=na(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&w(l)}}}function oa(t){let e,l,n=t[10].value!==void 0&&ua(t),i=t[10].value2>1e-4&&fa(t);return{c(){e=qe("g"),n&&n.c(),l=qe("g"),i&&i.c()},m(o,r){y(o,e,r),n&&n.m(e,null),y(o,l,r),i&&i.m(l,null)},p(o,r){o[10].value!==void 0?n?n.p(o,r):(n=ua(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[10].value2>1e-4?i?i.p(o,r):(i=fa(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&w(e),n&&n.d(),o&&w(l),i&&i.d()}}}function ua(t){let e,l,n,i,o,r,a,f=t[3]>15&&ra(t);return{c(){e=qe("rect"),f&&f.c(),a=Ge(),u(e,"x",l=t[5](t[12])+2),u(e,"y",n=t[6](t[10].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[10].value)),u(e,"fill",r=t[10].color)},m(c,_){y(c,e,_),f&&f.m(c,_),y(c,a,_)},p(c,_){_&32&&l!==(l=c[5](c[12])+2)&&u(e,"x",l),_&65&&n!==(n=c[6](c[10].value))&&u(e,"y",n),_&8&&i!==(i=c[3]-4)&&u(e,"width",i),_&65&&o!==(o=c[6](c[0].y.min)-c[6](Math.min(c[0].y.min,0)+c[10].value))&&u(e,"height",o),_&1&&r!==(r=c[10].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,_):(f=ra(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&w(e),f&&f.d(c),c&&w(a)}}}function ra(t){let e,l=t[10].label+"",n,i,o,r,a,f,c,_,p=t[10].title&&aa(t);return{c(){e=qe("text"),n=$(l),p&&p.c(),_=Ge(),u(e,"y",i=t[6](t[10].value)>t[6](0)-t[7]?t[6](t[10].value)-t[7]:t[6](t[10].value)+10),u(e,"x",o=t[5](t[12])+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",f=t[6](t[10].value)>t[6](0)-t[7]?t[10].color:"white"),u(e,"transform",c="rotate("+(t[3]<25?90:0)+", "+(t[5](t[12])+t[3]/2)+", "+(t[6](t[10].value)>t[6](0)-t[7]?t[6](t[10].value)-t[7]:t[6](t[10].value)+9)+")")},m(d,v){y(d,e,v),s(e,n),p&&p.m(d,v),y(d,_,v)},p(d,v){v&1&&l!==(l=d[10].label+"")&&B(n,l),v&193&&i!==(i=d[6](d[10].value)>d[6](0)-d[7]?d[6](d[10].value)-d[7]:d[6](d[10].value)+10)&&u(e,"y",i),v&40&&o!==(o=d[5](d[12])+d[3]/2)&&u(e,"x",o),v&8&&r!==(r=d[3]-4)&&u(e,"width",r),v&8&&a!==(a=d[3]<25?"left":"middle")&&u(e,"text-anchor",a),v&193&&f!==(f=d[6](d[10].value)>d[6](0)-d[7]?d[10].color:"white")&&u(e,"fill",f),v&233&&c!==(c="rotate("+(d[3]<25?90:0)+", "+(d[5](d[12])+d[3]/2)+", "+(d[6](d[10].value)>d[6](0)-d[7]?d[6](d[10].value)-d[7]:d[6](d[10].value)+9)+")")&&u(e,"transform",c),d[10].title?p?p.p(d,v):(p=aa(d),p.c(),p.m(_.parentNode,_)):p&&(p.d(1),p=null)},d(d){d&&w(e),p&&p.d(d),d&&w(_)}}}function aa(t){let e,l=t[10].title+"",n;return{c(){e=qe("title"),n=$(l)},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[10].title+"")&&B(n,l)},d(i){i&&w(e)}}}function fa(t){let e,l,n,i,o,r,a,f=t[3]>15&&ca(t);return{c(){e=qe("rect"),f&&f.c(),a=Ge(),u(e,"x",l=t[5](t[12])+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[10].value2)),u(e,"fill",r=t[10].color)},m(c,_){y(c,e,_),f&&f.m(c,_),y(c,a,_)},p(c,_){_&32&&l!==(l=c[5](c[12])+2)&&u(e,"x",l),_&64&&n!==(n=c[6](0))&&u(e,"y",n),_&8&&i!==(i=c[3]-4)&&u(e,"width",i),_&65&&o!==(o=c[6](c[0].y.min)-c[6](c[0].y.min+c[10].value2))&&u(e,"height",o),_&1&&r!==(r=c[10].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,_):(f=ca(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&w(e),f&&f.d(c),c&&w(a)}}}function ca(t){let e,l=t[10].label2+"",n,i,o,r,a,f,c,_=t[10].title2&&ma(t);return{c(){e=qe("text"),n=$(l),_&&_.c(),c=Ge(),u(e,"y",i=t[6](-t[10].value2)t[9].call(e))},m(i,o){y(i,e,o),n&&n.m(e,null),l=jc(e,t[9].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=xr(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:ne,o:ne,d(i){i&&w(e),n&&n.d(),l()}}}function Bm(t,e,l){let{config:n}=e,i,o,r,a,f,c,_,p;function d(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=v=>{"config"in v&&l(0,n=v.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,c=o-(n.title?20:0));let v=i-(n.padding.left+n.padding.right);l(3,r=v/n.points.length),l(7,_=r<25?28:17),l(8,p=r<25?10:100);let h=(c-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,a=function(g){return g*r+n.padding.left}),l(6,f=function(g){let k=0;return g>n.y.max?k=n.padding.bottom:gc||k<0?0:k})}},[n,i,o,r,c,a,f,_,p,d]}class sn extends $e{constructor(e){super(),ye(this,e,Bm,Gm,ke,{config:0})}}function Ym(t){let e,l;return e=new sn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function zm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:r}=e,a={};function f(c){return{label:ce(c)+"V",title:c.toFixed(1)+" V",value:isNaN(c)?0:c,color:tm(c||0)}}return t.$$set=c=>{"u1"in c&&l(1,n=c.u1),"u2"in c&&l(2,i=c.u2),"u3"in c&&l(3,o=c.u3),"ds"in c&&l(4,r=c.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let c=[],_=[];n>0&&(c.push({label:r===1?"L1-L2":"L1"}),_.push(f(n))),i>0&&(c.push({label:r===1?"L1-L3":"L2"}),_.push(f(i))),o>0&&(c.push({label:r===1?"L2-L3":"L3"}),_.push(f(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:c},points:_})}},[a,n,i,o,r]}class Vm extends $e{constructor(e){super(),ye(this,e,zm,Ym,ke,{u1:1,u2:2,u3:3,ds:4})}}function Km(t){let e,l;return e=new sn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Qm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:r}=e,{i2:a}=e,{i3:f}=e,{max:c}=e,_={};function p(d){return{label:ce(d)+"A",title:d.toFixed(1)+" A",value:isNaN(d)?0:d,color:vc(d?d/c*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,f=d.i3),"max"in d&&l(7,c=d.max)},t.$$.update=()=>{if(t.$$.dirty&254){let d=[],v=[];n>0&&(d.push({label:"L1"}),v.push(p(r))),i>0&&(d.push({label:"L2"}),v.push(p(a))),o>0&&(d.push({label:"L3"}),v.push(p(f))),l(0,_={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:c,ticks:[{value:0,label:"0%"},{value:c/4,label:"25%"},{value:c/2,label:"50%"},{value:c/4*3,label:"75%"},{value:c,label:"100%"}]},x:{ticks:d},points:v})}},[_,n,i,o,r,a,f,c]}class Xm extends $e{constructor(e){super(),ye(this,e,Qm,Km,ke,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function Zm(t){let e,l,n,i,o,r,a,f=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",c,_,p,d,v,h,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",k,C,T,P,D,S,A,E=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,z,U,R,q,Y,O=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",H,G;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=b(),i=m("div"),o=m("div"),o.textContent="Instant in",r=b(),a=m("div"),c=$(f),_=$(" VAr"),p=b(),d=m("div"),d.textContent="Instant out",v=b(),h=m("div"),k=$(g),C=$(" VAr"),T=b(),P=m("div"),D=m("div"),D.textContent="Total in",S=b(),A=m("div"),F=$(E),z=$(" kVArh"),U=b(),R=m("div"),R.textContent="Total out",q=b(),Y=m("div"),H=$(O),G=$(" kVArh"),u(a,"class","text-right"),u(h,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(A,"class","text-right"),u(Y,"class","text-right"),u(P,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(L,W){y(L,e,W),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(i,a),s(a,c),s(a,_),s(i,p),s(i,d),s(i,v),s(i,h),s(h,k),s(h,C),s(e,T),s(e,P),s(P,D),s(P,S),s(P,A),s(A,F),s(A,z),s(P,U),s(P,R),s(P,q),s(P,Y),s(Y,H),s(Y,G)},p(L,[W]){W&1&&f!==(f=(typeof L[0]<"u"?L[0].toFixed(0):"-")+"")&&B(c,f),W&2&&g!==(g=(typeof L[1]<"u"?L[1].toFixed(0):"-")+"")&&B(k,g),W&4&&E!==(E=(typeof L[2]<"u"?L[2].toFixed(1):"-")+"")&&B(F,E),W&8&&O!==(O=(typeof L[3]<"u"?L[3].toFixed(1):"-")+"")&&B(H,O)},i:ne,o:ne,d(L){L&&w(e)}}}function Jm(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 xm extends $e{constructor(e){super(),ye(this,e,Jm,Zm,ke,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function _a(t){let e;function l(o,r){return o[3]?tp:ep}let n=l(t),i=n(t);return{c(){i.c(),e=Ge()},m(o,r){i.m(o,r),y(o,e,r)},p(o,r){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&w(e)}}}function ep(t){let e,l,n,i,o,r,a=ce(t[1].h.u,2)+"",f,c,_,p,d,v,h=ce(t[1].d.u,1)+"",g,k,C,T,P,D,S=ce(t[1].m.u)+"",A,E,F,z,U,R,q=ce(t[0].last_month.u)+"",Y,O,H,G,L=t[4]&&da(t);return{c(){e=m("strong"),e.textContent="Consumption",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),r=m("div"),f=$(a),c=$(" kWh"),_=b(),p=m("div"),p.textContent="Day",d=b(),v=m("div"),g=$(h),k=$(" kWh"),C=b(),T=m("div"),T.textContent="Month",P=b(),D=m("div"),A=$(S),E=$(" kWh"),F=b(),z=m("div"),z.textContent="Last month",U=b(),R=m("div"),Y=$(q),O=$(" kWh"),H=b(),L&&L.c(),G=Ge(),u(r,"class","text-right"),u(v,"class","text-right"),u(D,"class","text-right"),u(R,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(W,j){y(W,e,j),y(W,l,j),y(W,n,j),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,_),s(n,p),s(n,d),s(n,v),s(v,g),s(v,k),s(n,C),s(n,T),s(n,P),s(n,D),s(D,A),s(D,E),s(n,F),s(n,z),s(n,U),s(n,R),s(R,Y),s(R,O),y(W,H,j),L&&L.m(W,j),y(W,G,j)},p(W,j){j&2&&a!==(a=ce(W[1].h.u,2)+"")&&B(f,a),j&2&&h!==(h=ce(W[1].d.u,1)+"")&&B(g,h),j&2&&S!==(S=ce(W[1].m.u)+"")&&B(A,S),j&1&&q!==(q=ce(W[0].last_month.u)+"")&&B(Y,q),W[4]?L?L.p(W,j):(L=da(W),L.c(),L.m(G.parentNode,G)):L&&(L.d(1),L=null)},d(W){W&&w(e),W&&w(l),W&&w(n),W&&w(H),L&&L.d(W),W&&w(G)}}}function tp(t){let e,l,n,i,o,r,a=ce(t[1].h.u,2)+"",f,c,_,p,d,v,h,g=ce(t[1].d.u,1)+"",k,C,T,P,D,S,A,E=ce(t[1].m.u)+"",F,z,U,R,q,Y,O,H=ce(t[0].last_month.u)+"",G,L,W,j,ee,le,de,ie,we,Ie,Ce,Ee=ce(t[1].h.p,2)+"",ve,Pe,Ae,me,se,pe,Q,oe=ce(t[1].d.p,1)+"",Ne,Me,he,x,_e,Le,We,Ke=ce(t[1].m.p)+"",Fe,je,re,ge,Lt,Ll,Zt,ft=ce(t[0].last_month.p)+"",$l,al,Ut,dt,Qe=t[4]&&va(t),Xe=t[4]&&ha(t),Ze=t[4]&&ba(t),Ue=t[4]&&ga(t),Je=t[4]&&ka(t),Be=t[4]&&wa(t),xe=t[4]&&ya(t),et=t[4]&&$a(t);return{c(){e=m("strong"),e.textContent="Import",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),r=m("div"),f=$(a),c=$(" kWh"),_=b(),Qe&&Qe.c(),p=b(),d=m("div"),d.textContent="Day",v=b(),h=m("div"),k=$(g),C=$(" kWh"),T=b(),Xe&&Xe.c(),P=b(),D=m("div"),D.textContent="Month",S=b(),A=m("div"),F=$(E),z=$(" kWh"),U=b(),Ze&&Ze.c(),R=b(),q=m("div"),q.textContent="Last mo.",Y=b(),O=m("div"),G=$(H),L=$(" kWh"),W=b(),Ue&&Ue.c(),ee=b(),le=m("strong"),le.textContent="Export",de=b(),ie=m("div"),we=m("div"),we.textContent="Hour",Ie=b(),Ce=m("div"),ve=$(Ee),Pe=$(" kWh"),Ae=b(),Je&&Je.c(),me=b(),se=m("div"),se.textContent="Day",pe=b(),Q=m("div"),Ne=$(oe),Me=$(" kWh"),he=b(),Be&&Be.c(),x=b(),_e=m("div"),_e.textContent="Month",Le=b(),We=m("div"),Fe=$(Ke),je=$(" kWh"),re=b(),xe&&xe.c(),ge=b(),Lt=m("div"),Lt.textContent="Last mo.",Ll=b(),Zt=m("div"),$l=$(ft),al=$(" kWh"),Ut=b(),et&&et.c(),u(r,"class","text-right"),u(h,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class",j="grid grid-cols-"+t[5]+" mb-3"),u(Ce,"class","text-right"),u(Q,"class","text-right"),u(We,"class","text-right"),u(Zt,"class","text-right"),u(ie,"class",dt="grid grid-cols-"+t[5])},m(ue,be){y(ue,e,be),y(ue,l,be),y(ue,n,be),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,_),Qe&&Qe.m(n,null),s(n,p),s(n,d),s(n,v),s(n,h),s(h,k),s(h,C),s(n,T),Xe&&Xe.m(n,null),s(n,P),s(n,D),s(n,S),s(n,A),s(A,F),s(A,z),s(n,U),Ze&&Ze.m(n,null),s(n,R),s(n,q),s(n,Y),s(n,O),s(O,G),s(O,L),s(n,W),Ue&&Ue.m(n,null),y(ue,ee,be),y(ue,le,be),y(ue,de,be),y(ue,ie,be),s(ie,we),s(ie,Ie),s(ie,Ce),s(Ce,ve),s(Ce,Pe),s(ie,Ae),Je&&Je.m(ie,null),s(ie,me),s(ie,se),s(ie,pe),s(ie,Q),s(Q,Ne),s(Q,Me),s(ie,he),Be&&Be.m(ie,null),s(ie,x),s(ie,_e),s(ie,Le),s(ie,We),s(We,Fe),s(We,je),s(ie,re),xe&&xe.m(ie,null),s(ie,ge),s(ie,Lt),s(ie,Ll),s(ie,Zt),s(Zt,$l),s(Zt,al),s(ie,Ut),et&&et.m(ie,null)},p(ue,be){be&2&&a!==(a=ce(ue[1].h.u,2)+"")&&B(f,a),ue[4]?Qe?Qe.p(ue,be):(Qe=va(ue),Qe.c(),Qe.m(n,p)):Qe&&(Qe.d(1),Qe=null),be&2&&g!==(g=ce(ue[1].d.u,1)+"")&&B(k,g),ue[4]?Xe?Xe.p(ue,be):(Xe=ha(ue),Xe.c(),Xe.m(n,P)):Xe&&(Xe.d(1),Xe=null),be&2&&E!==(E=ce(ue[1].m.u)+"")&&B(F,E),ue[4]?Ze?Ze.p(ue,be):(Ze=ba(ue),Ze.c(),Ze.m(n,R)):Ze&&(Ze.d(1),Ze=null),be&1&&H!==(H=ce(ue[0].last_month.u)+"")&&B(G,H),ue[4]?Ue?Ue.p(ue,be):(Ue=ga(ue),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),be&32&&j!==(j="grid grid-cols-"+ue[5]+" mb-3")&&u(n,"class",j),be&2&&Ee!==(Ee=ce(ue[1].h.p,2)+"")&&B(ve,Ee),ue[4]?Je?Je.p(ue,be):(Je=ka(ue),Je.c(),Je.m(ie,me)):Je&&(Je.d(1),Je=null),be&2&&oe!==(oe=ce(ue[1].d.p,1)+"")&&B(Ne,oe),ue[4]?Be?Be.p(ue,be):(Be=wa(ue),Be.c(),Be.m(ie,x)):Be&&(Be.d(1),Be=null),be&2&&Ke!==(Ke=ce(ue[1].m.p)+"")&&B(Fe,Ke),ue[4]?xe?xe.p(ue,be):(xe=ya(ue),xe.c(),xe.m(ie,ge)):xe&&(xe.d(1),xe=null),be&1&&ft!==(ft=ce(ue[0].last_month.p)+"")&&B($l,ft),ue[4]?et?et.p(ue,be):(et=$a(ue),et.c(),et.m(ie,null)):et&&(et.d(1),et=null),be&32&&dt!==(dt="grid grid-cols-"+ue[5])&&u(ie,"class",dt)},d(ue){ue&&w(e),ue&&w(l),ue&&w(n),Qe&&Qe.d(),Xe&&Xe.d(),Ze&&Ze.d(),Ue&&Ue.d(),ue&&w(ee),ue&&w(le),ue&&w(de),ue&&w(ie),Je&&Je.d(),Be&&Be.d(),xe&&xe.d(),et&&et.d()}}}function da(t){let e,l,n,i,o,r,a=ce(t[1].h.c,2)+"",f,c,_,p,d,v,h,g=ce(t[1].d.c,1)+"",k,C,T,P,D,S,A,E=ce(t[1].m.c)+"",F,z,U,R,q,Y,O,H=ce(t[0].last_month.c)+"",G,L,W;return{c(){e=m("strong"),e.textContent="Cost",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),r=m("div"),f=$(a),c=b(),_=$(t[2]),p=b(),d=m("div"),d.textContent="Day",v=b(),h=m("div"),k=$(g),C=b(),T=$(t[2]),P=b(),D=m("div"),D.textContent="Month",S=b(),A=m("div"),F=$(E),z=b(),U=$(t[2]),R=b(),q=m("div"),q.textContent="Last month",Y=b(),O=m("div"),G=$(H),L=b(),W=$(t[2]),u(r,"class","text-right"),u(h,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class","grid grid-cols-2")},m(j,ee){y(j,e,ee),y(j,l,ee),y(j,n,ee),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(r,_),s(n,p),s(n,d),s(n,v),s(n,h),s(h,k),s(h,C),s(h,T),s(n,P),s(n,D),s(n,S),s(n,A),s(A,F),s(A,z),s(A,U),s(n,R),s(n,q),s(n,Y),s(n,O),s(O,G),s(O,L),s(O,W)},p(j,ee){ee&2&&a!==(a=ce(j[1].h.c,2)+"")&&B(f,a),ee&4&&B(_,j[2]),ee&2&&g!==(g=ce(j[1].d.c,1)+"")&&B(k,g),ee&4&&B(T,j[2]),ee&2&&E!==(E=ce(j[1].m.c)+"")&&B(F,E),ee&4&&B(U,j[2]),ee&1&&H!==(H=ce(j[0].last_month.c)+"")&&B(G,H),ee&4&&B(W,j[2])},d(j){j&&w(e),j&&w(l),j&&w(n)}}}function va(t){let e,l=ce(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].h.c,2)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function ha(t){let e,l=ce(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].d.c,1)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function ba(t){let e,l=ce(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].m.c)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function ga(t){let e,l=ce(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ce(r[0].last_month.c)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function ka(t){let e,l=ce(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].h.i,2)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function wa(t){let e,l=ce(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].d.i,1)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function ya(t){let e,l=ce(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].m.i)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function $a(t){let e,l=ce(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ce(r[0].last_month.i)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function lp(t){let e,l,n,i,o,r,a=t[1]&&_a(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=b(),i=m("br"),o=m("br"),r=b(),a&&a.c(),u(e,"class","mx-2 text-sm")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),s(e,r),a&&a.m(e,null)},p(f,[c]){f[1]?a?a.p(f,c):(a=_a(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:ne,o:ne,d(f){f&&w(e),a&&a.d()}}}function np(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:r}=e,a=!1,f=3;return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo),"data"in c&&l(1,i=c.data),"currency"in c&&l(2,o=c.currency),"hasExport"in c&&l(3,r=c.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(i.h.c>.01||i.d.c>.01||i.m.c>.01||i.h.i>.01||i.d.i>.01||i.m.i>.01)),l(5,f=a?3:2))},[n,i,o,r,a,f]}class ip extends $e{constructor(e){super(),ye(this,e,np,lp,ke,{sysinfo:0,data:1,currency:2,hasExport:3})}}function sp(t){let e,l,n,i;return n=new sn({props:{config:t[0]}}),{c(){e=m("a"),e.textContent="Provided by ENTSO-E",l=b(),J(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,r){y(o,e,r),y(o,l,r),X(n,o,r),i=!0},p(o,[r]){const a={};r&1&&(a.config=o[0]),n.$set(a)},i(o){i||(N(n.$$.fragment,o),i=!0)},o(o){I(n.$$.fragment,o),i=!1},d(o){o&&w(e),o&&w(l),Z(n,o)}}}function op(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},r=0,a=0;return t.$$set=f=>{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=new Date().getUTCHours(),c=0,_=0,p=0,d=n[20]==null?2:1,v=[],h=[],g=[],k=new Date;for(sl(k,i.clock_offset),c=f;c<24&&(_=n[De(p++)],_!=null);c++)h.push({label:De(k.getUTCHours())}),g.push({label:_>=0?_.toFixed(d):"",title:_>=0?_.toFixed(2)+" "+n.currency:"",value:_>=0?Math.abs(_*100):0,label2:_<0?_.toFixed(d):"",title2:_<0?_.toFixed(2)+" "+n.currency:"",value2:_<0?Math.abs(_*100):0,color:"#7c3aed"}),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),sl(k,1);for(c=0;c<24&&(_=n[De(p++)],_!=null);c++)h.push({label:De(k.getUTCHours())}),g.push({label:_>=0?_.toFixed(d):"",value:_>=0?Math.abs(_*100):0,label2:_<0?_.toFixed(d):"",value2:_<0?Math.abs(_*100):0,color:"#7c3aed"}),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),sl(k,1);let C=Math.max(r,Math.abs(a));if(a<0){l(4,a=Math.min(C/4*-1,a));let D=Math.ceil(Math.abs(a)/C*4),S=a/D;for(c=1;c{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],_=[],p=[],d=sl(new Date,-24),v=new Date().getUTCHours();for(sl(d,i.clock_offset),f=v;f<24;f++){let k=n["i"+De(f)],C=n["e"+De(f)];k===void 0&&(k=0),C===void 0&&(C=0),_.push({label:De(d.getUTCHours())}),p.push({label:k.toFixed(1),title:k.toFixed(2)+" kWh",value:k*10,label2:C.toFixed(1),title2:C.toFixed(2)+" kWh",value2:C*10,color:"#7c3aed"}),l(4,a=Math.max(a,C*10)),l(3,r=Math.max(r,k*10)),sl(d,1)}for(f=0;f{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],_=[],p=[],d=new Date,v=new Date;for(sl(d,i.clock_offset),sl(v,i.clock_offset),v.setDate(0),f=d.getDate();f<=v.getDate();f++){let k=n["i"+De(f)],C=n["e"+De(f)];k===void 0&&(k=0),C===void 0&&(C=0),_.push({label:De(f)}),p.push({label:k.toFixed(k<10?1:0),title:k.toFixed(2)+" kWh",value:k,label2:C.toFixed(C<10?1:0),title2:C.toFixed(2)+" kWh",value2:C,color:"#7c3aed"}),l(4,a=Math.max(a,C)),l(3,r=Math.max(r,k))}for(f=1;f{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,f=0,c=[],_=[],p=[];n.s&&n.s.forEach((h,g)=>{var k=h.n?h.n:h.a;f=h.v,f==-127&&(f=0),_.push({label:k.slice(-4)}),p.push({label:f.toFixed(1),value:f,color:"#7c3aed"}),l(3,r=Math.min(r,f)),l(2,o=Math.max(o,f))}),l(2,o=Math.ceil(o)),l(3,r=Math.floor(r));let d=o;r<0&&(d+=Math.abs(r));let v=d/4;for(a=0;a<5;a++)f=r+v*a,c.push({value:f,label:f.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:c},x:{ticks:_},points:p})}},[i,n,o,r]}class vp extends $e{constructor(e){super(),ye(this,e,dp,_p,ke,{json:1})}}function hp(t){let e,l;return e=new sn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}let bp=0;function gp(t,e,l){let n={},i=0,o;return $c.subscribe(r=>{l(2,o=r)}),yc(),t.$$.update=()=>{if(t.$$.dirty&6){let r=0,a=[],f=[],c=[];if(a.push({value:0,label:0}),o&&o.p)for(r=0;r0?De(_.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:bp,max:i,ticks:a},x:{ticks:f},points:c})}},[n,i,o]}class kp extends $e{constructor(e){super(),ye(this,e,gp,hp,ke,{})}}function Ca(t){let e,l,n,i,o,r,a=(t[0].mt?ds(t[0].mt):"-")+"",f,c,_,p=(t[0].ic?t[0].ic.toFixed(1):"-")+"",d,v,h;return i=new Nc({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:vc}}),{c(){e=m("div"),l=m("div"),n=m("div"),J(i.$$.fragment),o=b(),r=m("div"),f=$(a),c=b(),_=m("div"),d=$(p),v=$(" kWh"),u(n,"class","col-span-2"),u(_,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,k){y(g,e,k),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(r,f),s(l,c),s(l,_),s(_,d),s(_,v),h=!0},p(g,k){const C={};k&1&&(C.val=g[0].i?g[0].i:0),k&1&&(C.max=g[0].im?g[0].im:15e3),k&1&&(C.sub=g[0].p),k&1&&(C.subunit=g[0].pc),i.$set(C),(!h||k&1)&&a!==(a=(g[0].mt?ds(g[0].mt):"-")+"")&&B(f,a),(!h||k&1)&&p!==(p=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&B(d,p)},i(g){h||(N(i.$$.fragment,g),h=!0)},o(g){I(i.$$.fragment,g),h=!1},d(g){g&&w(e),Z(i)}}}function Ta(t){let e,l,n,i,o,r,a,f,c=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,p,d;return i=new Nc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:lm}}),{c(){e=m("div"),l=m("div"),n=m("div"),J(i.$$.fragment),o=b(),r=m("div"),a=b(),f=m("div"),_=$(c),p=$(" kWh"),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(v,h){y(v,e,h),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(l,a),s(l,f),s(f,_),s(f,p),d=!0},p(v,h){const g={};h&1&&(g.val=v[0].e?v[0].e:0),h&1&&(g.max=v[0].om?v[0].om*1e3:1e4),i.$set(g),(!d||h&1)&&c!==(c=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&B(_,c)},i(v){d||(N(i.$$.fragment,v),d=!0)},o(v){I(i.$$.fragment,v),d=!1},d(v){v&&w(e),Z(i)}}}function Sa(t){let e,l,n;return l=new Vm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(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||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Pa(t){let e,l,n;return l=new Xm({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=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(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||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Na(t){let e,l,n;return l=new xm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(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||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ma(t){let e,l,n;return l=new ip({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&2&&(r.sysinfo=i[1]),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||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Aa(t){let e,l,n;return l=new kp({}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){y(i,e,o),X(l,e,null),n=!0},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Da(t){let e,l,n;return l=new up({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&4&&(r.json=i[2]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ia(t){let e,l,n;return l=new fp({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&8&&(r.json=i[3]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ea(t){let e,l,n;return l=new pp({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&16&&(r.json=i[4]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Fa(t){let e,l,n;return l=new vp({props:{json:t[5]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&32&&(r.json=i[5]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function wp(t){let e,l=Ye(t[1].ui.i,t[0].i),n,i=Ye(t[1].ui.e,t[0].om||t[0].e>0),o,r=Ye(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,f=Ye(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),c,_=Ye(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),p,d=Ye(t[1].ui.c,t[0].ea),v,h=Ye(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,k=Ye(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),C,T=Ye(t[1].ui.d,t[3]),P,D=Ye(t[1].ui.m,t[4]),S,A=Ye(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),E,F=l&&Ca(t),z=i&&Ta(t),U=r&&Sa(t),R=f&&Pa(t),q=_&&Na(t),Y=d&&Ma(t),O=h&&Aa(),H=k&&Da(t),G=T&&Ia(t),L=D&&Ea(t),W=A&&Fa(t);return{c(){e=m("div"),F&&F.c(),n=b(),z&&z.c(),o=b(),U&&U.c(),a=b(),R&&R.c(),c=b(),q&&q.c(),p=b(),Y&&Y.c(),v=b(),O&&O.c(),g=b(),H&&H.c(),C=b(),G&&G.c(),P=b(),L&&L.c(),S=b(),W&&W.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,ee){y(j,e,ee),F&&F.m(e,null),s(e,n),z&&z.m(e,null),s(e,o),U&&U.m(e,null),s(e,a),R&&R.m(e,null),s(e,c),q&&q.m(e,null),s(e,p),Y&&Y.m(e,null),s(e,v),O&&O.m(e,null),s(e,g),H&&H.m(e,null),s(e,C),G&&G.m(e,null),s(e,P),L&&L.m(e,null),s(e,S),W&&W.m(e,null),E=!0},p(j,[ee]){ee&3&&(l=Ye(j[1].ui.i,j[0].i)),l?F?(F.p(j,ee),ee&3&&N(F,1)):(F=Ca(j),F.c(),N(F,1),F.m(e,n)):F&&(Te(),I(F,1,1,()=>{F=null}),Se()),ee&3&&(i=Ye(j[1].ui.e,j[0].om||j[0].e>0)),i?z?(z.p(j,ee),ee&3&&N(z,1)):(z=Ta(j),z.c(),N(z,1),z.m(e,o)):z&&(Te(),I(z,1,1,()=>{z=null}),Se()),ee&3&&(r=Ye(j[1].ui.v,j[0].u1>100||j[0].u2>100||j[0].u3>100)),r?U?(U.p(j,ee),ee&3&&N(U,1)):(U=Sa(j),U.c(),N(U,1),U.m(e,a)):U&&(Te(),I(U,1,1,()=>{U=null}),Se()),ee&3&&(f=Ye(j[1].ui.a,j[0].i1>.01||j[0].i2>.01||j[0].i3>.01)),f?R?(R.p(j,ee),ee&3&&N(R,1)):(R=Pa(j),R.c(),N(R,1),R.m(e,c)):R&&(Te(),I(R,1,1,()=>{R=null}),Se()),ee&3&&(_=Ye(j[1].ui.r,j[0].ri>0||j[0].re>0||j[0].ric>0||j[0].rec>0)),_?q?(q.p(j,ee),ee&3&&N(q,1)):(q=Na(j),q.c(),N(q,1),q.m(e,p)):q&&(Te(),I(q,1,1,()=>{q=null}),Se()),ee&3&&(d=Ye(j[1].ui.c,j[0].ea)),d?Y?(Y.p(j,ee),ee&3&&N(Y,1)):(Y=Ma(j),Y.c(),N(Y,1),Y.m(e,v)):Y&&(Te(),I(Y,1,1,()=>{Y=null}),Se()),ee&3&&(h=Ye(j[1].ui.t,j[0].pr&&(j[0].pr.startsWith("10YNO")||j[0].pr=="10Y1001A1001A48H"))),h?O?ee&3&&N(O,1):(O=Aa(),O.c(),N(O,1),O.m(e,g)):O&&(Te(),I(O,1,1,()=>{O=null}),Se()),ee&3&&(k=Ye(j[1].ui.p,j[0].pe&&!Number.isNaN(j[0].p))),k?H?(H.p(j,ee),ee&3&&N(H,1)):(H=Da(j),H.c(),N(H,1),H.m(e,C)):H&&(Te(),I(H,1,1,()=>{H=null}),Se()),ee&10&&(T=Ye(j[1].ui.d,j[3])),T?G?(G.p(j,ee),ee&10&&N(G,1)):(G=Ia(j),G.c(),N(G,1),G.m(e,P)):G&&(Te(),I(G,1,1,()=>{G=null}),Se()),ee&18&&(D=Ye(j[1].ui.m,j[4])),D?L?(L.p(j,ee),ee&18&&N(L,1)):(L=Ea(j),L.c(),N(L,1),L.m(e,S)):L&&(Te(),I(L,1,1,()=>{L=null}),Se()),ee&35&&(A=Ye(j[1].ui.s,j[0].t&&j[0].t!=-127&&j[5].c>1)),A?W?(W.p(j,ee),ee&35&&N(W,1)):(W=Fa(j),W.c(),N(W,1),W.m(e,null)):W&&(Te(),I(W,1,1,()=>{W=null}),Se())},i(j){E||(N(F),N(z),N(U),N(R),N(q),N(Y),N(O),N(H),N(G),N(L),N(W),E=!0)},o(j){I(F),I(z),I(U),I(R),I(q),I(Y),I(O),I(H),I(G),I(L),I(W),E=!1},d(j){j&&w(e),F&&F.d(),z&&z.d(),U&&U.d(),R&&R.d(),q&&q.d(),Y&&Y.d(),O&&O.d(),H&&H.d(),G&&G.d(),L&&L.d(),W&&W.d()}}}function yp(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},r={},a={},f={};return hc.subscribe(c=>{l(2,o=c)}),bc.subscribe(c=>{l(3,r=c)}),gc.subscribe(c=>{l(4,a=c)}),wc.subscribe(c=>{l(5,f=c)}),t.$$set=c=>{"data"in c&&l(0,n=c.data),"sysinfo"in c&&l(1,i=c.sysinfo)},[n,i,o,r,a,f]}class $p extends $e{constructor(e){super(),ye(this,e,yp,wp,ke,{data:0,sysinfo:1})}}let xs={};const Mc=ut(xs);async function Cp(){xs=await(await fetch("/configuration.json")).json(),Mc.set(xs)}function Ra(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Tp(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Sp(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function La(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Ua(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=b(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){y(i,e,o),y(i,l,o),y(i,n,o)},d(i){i&&w(e),i&&w(l),i&&w(n)}}}function Oa(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function qa(t){let e,l,n;return{c(){e=m("option"),l=$("GPIO"),n=$(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){y(i,e,o),s(e,l),s(e,n)},d(i){i&&w(e)}}}function Ha(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))&&qa(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=qa(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&w(e)}}}function Pp(t){let e,l,n,i,o;function r(h,g){return h[0]=="esp32c3"?Sp:Tp}let a=r(t),f=a(t),c=t[0]=="esp8266"&&La(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&Ua(),p=t[0]=="esp32s2"&&Oa(),d={length:t[1]+1},v=[];for(let h=0;h{"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 Ac extends $e{constructor(e){super(),ye(this,e,Np,Pp,ke,{chip:0})}}function ja(t){let e,l,n=t[1]&&Wa(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){y(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Wa(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&w(e),n&&n.d()}}}function Wa(t){let e,l;return{c(){e=m("div"),l=$(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){y(n,e,i),s(e,l)},p(n,i){i&2&&B(l,n[1])},d(n){n&&w(e)}}}function Mp(t){let e,l=t[0]&&ja(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=ja(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ne,o:ne,d(n){l&&l.d(n),n&&w(e)}}}function Ap(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 Mt extends $e{constructor(e){super(),ye(this,e,Ap,Mp,ke,{active:0,message:1})}}function Ga(t,e,l){const n=t.slice();return n[1]=e[l],n}function Ba(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=$("Europe/"),i=$(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,r){y(o,e,r),s(e,l),s(e,i)},p:ne,d(o){o&&w(e)}}}function Dp(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](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){I(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function Wp(t){let e,l;return e=new ol({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Gp(t){let e,l;return e=new ol({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Bp(t){let e,l,n,i;const o=[Gp,Wp],r=[];function a(f,c){return f[3].q.s.r?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let _=e;e=a(f),e!==_&&(Te(),I(r[_],1,1,()=>{r[_]=null}),Se(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){I(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function Yp(t){let e,l;return e=new ol({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function zp(t){let e,l;return e=new ol({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Vp(t){let e,l,n,i;const o=[zp,Yp],r=[];function a(f,c){return f[3].q.s.k?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let _=e;e=a(f),e!==_&&(Te(),I(r[_],1,1,()=>{r[_]=null}),Se(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){I(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function tf(t){let e,l,n,i,o,r,a,f,c,_,p,d,v,h,g,k,C,T,P,D,S,A,E,F,z,U,R,q,Y,O,H,G;return o=new Et({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=b(),i=m("a"),J(o.$$.fragment),r=b(),a=m("input"),f=b(),c=m("div"),_=m("div"),p=$("Electricity IDX"),d=m("br"),v=b(),h=m("input"),g=b(),k=m("div"),C=$("Current IDX"),T=m("br"),P=b(),D=m("input"),S=b(),A=m("div"),E=$(`Voltage IDX: L1, L2 & L3 + `),o.c(),l=Ge()},m(r,a){y(r,e,a),o.m(r,a),y(r,l,a)},p(r,a){i===(i=n(r))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},d(r){r&&w(e),o.d(r),r&&w(l)}}}function rm(t){let e,l;return{c(){e=$(t[0]),l=$(" seconds")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&1&&B(e,n[0])},d(n){n&&w(e),n&&w(l)}}}function am(t){let e,l;return{c(){e=$(t[3]),l=$(" minute")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function fm(t){let e,l;return{c(){e=$(t[3]),l=$(" minutes")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function cm(t){let e,l;return{c(){e=$(t[2]),l=$(" hour")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function mm(t){let e,l;return{c(){e=$(t[2]),l=$(" hours")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function pm(t){let e,l;return{c(){e=$(t[1]),l=$(" day")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function _m(t){let e,l;return{c(){e=$(t[1]),l=$(" days")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function dm(t){let e,l=t[0]&&jr(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),y(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:ne,o:ne,d(n){l&&l.d(n),n&&w(e)}}}function vm(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 hm extends $e{constructor(e){super(),ye(this,e,vm,dm,ke,{epoch:0})}}function bm(t){let e,l,n;return{c(){e=m("span"),l=$(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){y(i,e,o),s(e,l)},p(i,[o]){o&4&&B(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ne,o:ne,d(i){i&&w(e)}}}function gm(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 ol extends $e{constructor(e){super(),ye(this,e,gm,bm,ke,{color:0,title:1,text:2})}}function km(t){let e,l=`${De(t[0].getDate())}.${De(t[0].getMonth()+1)}.${t[0].getFullYear()} ${De(t[0].getUTCHours())}:${De(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=$(l),u(e,"class",t[1])},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${De(i[0].getDate())}.${De(i[0].getMonth()+1)}.${i[0].getFullYear()} ${De(i[0].getUTCHours())}:${De(i[0].getMinutes())}`)&&B(n,l),o&2&&u(e,"class",i[1])},d(i){i&&w(e)}}}function wm(t){let e=`${De(t[0].getDate())}. ${zs[t[0].getMonth()]} ${De(t[0].getUTCHours())}:${De(t[0].getMinutes())}`,l;return{c(){l=$(e)},m(n,i){y(n,l,i)},p(n,i){i&1&&e!==(e=`${De(n[0].getDate())}. ${zs[n[0].getMonth()]} ${De(n[0].getUTCHours())}:${De(n[0].getMinutes())}`)&&B(l,e)},d(n){n&&w(l)}}}function ym(t){let e;function l(o,r){return o[2]?wm:km}let n=l(t),i=n(t);return{c(){i.c(),e=Ge()},m(o,r){i.m(o,r),y(o,e,r)},p(o,[r]){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:ne,o:ne,d(o){i.d(o),o&&w(e)}}}function $m(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,r;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,o=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,r=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||sl(n,o))},[n,i,r,o]}class Sc extends $e{constructor(e){super(),ye(this,e,$m,ym,ke,{timestamp:0,fullTimeColor:1,offset:3})}}function Cm(t){let e,l,n;return{c(){e=qe("svg"),l=qe("path"),n=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){y(i,e,o),s(e,l),s(e,n)},p:ne,i:ne,o:ne,d(i){i&&w(e)}}}class Tm extends $e{constructor(e){super(),ye(this,e,null,Cm,ke,{})}}function Sm(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Pm extends $e{constructor(e){super(),ye(this,e,null,Sm,ke,{})}}function Nm(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Et extends $e{constructor(e){super(),ye(this,e,null,Nm,ke,{})}}function Mm(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Pc extends $e{constructor(e){super(),ye(this,e,null,Mm,ke,{})}}function Am(t){let e,l,n=t[1].version+"",i;return{c(){e=$("AMS reader "),l=m("span"),i=$(n)},m(o,r){y(o,e,r),y(o,l,r),s(l,i)},p(o,r){r&2&&n!==(n=o[1].version+"")&&B(i,n)},d(o){o&&w(e),o&&w(l)}}}function Wr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=$(l),i=$("°C"),u(e,"class","flex-none my-auto")},m(o,r){y(o,e,r),s(e,n),s(e,i)},p(o,r){r&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&B(n,l)},d(o){o&&w(e)}}}function Gr(t){let e,l="HAN: "+Rr(t[0].he),n;return{c(){e=m("div"),n=$(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Rr(i[0].he))&&B(n,l)},d(i){i&&w(e)}}}function Br(t){let e,l="MQTT: "+Lr(t[0].me),n;return{c(){e=m("div"),n=$(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Lr(i[0].me))&&B(n,l)},d(i){i&&w(e)}}}function Yr(t){let e,l="PriceAPI: "+Ur(t[0].ee),n;return{c(){e=m("div"),n=$(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Ur(i[0].ee))&&B(n,l)},d(i){i&&w(e)}}}function zr(t){let e,l,n,i,o,r;return l=new Il({props:{to:"/configuration",$$slots:{default:[Dm]},$$scope:{ctx:t}}}),o=new Il({props:{to:"/status",$$slots:{default:[Im]},$$scope:{ctx:t}}}),{c(){e=m("div"),J(l.$$.fragment),n=b(),i=m("div"),J(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(a,f){y(a,e,f),X(l,e,null),y(a,n,f),y(a,i,f),X(o,i,null),r=!0},i(a){r||(N(l.$$.fragment,a),N(o.$$.fragment,a),r=!0)},o(a){I(l.$$.fragment,a),I(o.$$.fragment,a),r=!1},d(a){a&&w(e),Z(l),a&&w(n),a&&w(i),Z(o)}}}function Dm(t){let e,l;return e=new Tm({}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Im(t){let e,l;return e=new Pm({}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Vr(t){let e,l,n,i,o;const r=[Fm,Em],a=[];function f(c,_){return c[1].security==0||c[0].a?0:1}return l=f(t),n=a[l]=r[l](t),{c(){e=m("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(c,_){y(c,e,_),a[l].m(e,null),o=!0},p(c,_){let p=l;l=f(c),l===p?a[l].p(c,_):(Te(),I(a[p],1,1,()=>{a[p]=null}),Se(),n=a[l],n?n.p(c,_):(n=a[l]=r[l](c),n.c()),N(n,1),n.m(e,null)),(!o||_&4&&i!==(i="New version: "+c[2].tag_name))&&u(e,"title",i)},i(c){o||(N(n),o=!0)},o(c){I(n),o=!1},d(c){c&&w(e),a[l].d()}}}function Em(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=$("New version: "),i=$(n)},m(o,r){y(o,e,r),s(e,l),s(e,i)},p(o,r){r&4&&n!==(n=o[2].tag_name+"")&&B(i,n)},i:ne,o:ne,d(o){o&&w(e)}}}function Fm(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,_;return a=new Pc({}),{c(){e=m("button"),l=m("span"),n=$("New version: "),o=$(i),r=b(),J(a.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(p,d){y(p,e,d),s(e,l),s(l,n),s(l,o),s(e,r),X(a,e,null),f=!0,c||(_=K(e,"click",t[3]),c=!0)},p(p,d){(!f||d&4)&&i!==(i=p[2].tag_name+"")&&B(o,i)},i(p){f||(N(a.$$.fragment,p),f=!0)},o(p){I(a.$$.fragment,p),f=!1},d(p){p&&w(e),Z(a),c=!1,_()}}}function Rm(t){let e,l,n,i,o,r,a,f,c,_,p,d,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",h,g,k,C,T,P,D,S,A,E,F,z,U,R,q,Y,O,H,G,L,W,j,ee,le,de,ie,we,Ie,Ce,Ee;i=new Il({props:{to:"/",$$slots:{default:[Am]},$$scope:{ctx:t}}}),f=new hm({props:{epoch:t[0].u}});let ve=t[0].t>-50&&Wr(t);T=new ol({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:Dl(t[1].booting?2:t[0].em)}}),D=new ol({props:{title:"HAN",text:"HAN",color:Dl(t[1].booting?9:t[0].hm)}}),A=new ol({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:Dl(t[1].booting?9:t[0].wm)}}),F=new ol({props:{title:"MQTT",text:"MQTT",color:Dl(t[1].booting?9:t[0].mm)}});let Pe=(t[0].he<0||t[0].he>0)&&Gr(t),Ae=t[0].me<0&&Br(t),me=(t[0].ee>0||t[0].ee<0)&&Yr(t);ee=new Sc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let se=t[1].vndcfg&&t[1].usrcfg&&zr(t);Ie=new Et({});let pe=t[1].fwconsent===1&&t[2]&&Vr(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),J(i.$$.fragment),o=b(),r=m("div"),a=m("div"),J(f.$$.fragment),c=b(),ve&&ve.c(),_=b(),p=m("div"),d=$("Free mem: "),h=$(v),g=$("kb"),k=b(),C=m("div"),J(T.$$.fragment),P=b(),J(D.$$.fragment),S=b(),J(A.$$.fragment),E=b(),J(F.$$.fragment),z=b(),Pe&&Pe.c(),U=b(),Ae&&Ae.c(),R=b(),me&&me.c(),q=b(),Y=m("div"),O=m("div"),H=m("a"),G=m("img"),W=b(),j=m("div"),J(ee.$$.fragment),le=b(),se&&se.c(),de=b(),ie=m("div"),we=m("a"),J(Ie.$$.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(p,"class","flex-none my-auto"),u(r,"class","flex-none my-auto p-2 flex space-x-4"),u(C,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(G,"class","gh-logo"),Fc(G.src,L=um)||u(G,"src",L),u(G,"alt","GitHub repo"),u(H,"class","float-right"),u(H,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(H,"target","_blank"),u(H,"rel","noreferrer"),u(H,"aria-label","GitHub"),u(O,"class","flex-none"),u(j,"class","flex-none my-auto px-2"),u(we,"href",Ft("")),u(we,"target","_blank"),u(we,"rel","noreferrer"),u(ie,"class","flex-none px-1 mt-1"),u(ie,"title","Documentation"),u(Y,"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(Q,oe){y(Q,e,oe),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(r,a),X(f,a,null),s(r,c),ve&&ve.m(r,null),s(r,_),s(r,p),s(p,d),s(p,h),s(p,g),s(l,k),s(l,C),X(T,C,null),s(C,P),X(D,C,null),s(C,S),X(A,C,null),s(C,E),X(F,C,null),s(l,z),Pe&&Pe.m(l,null),s(l,U),Ae&&Ae.m(l,null),s(l,R),me&&me.m(l,null),s(l,q),s(l,Y),s(Y,O),s(O,H),s(H,G),s(Y,W),s(Y,j),X(ee,j,null),s(Y,le),se&&se.m(Y,null),s(Y,de),s(Y,ie),s(ie,we),X(Ie,we,null),s(Y,Ce),pe&&pe.m(Y,null),Ee=!0},p(Q,[oe]){const Ne={};oe&18&&(Ne.$$scope={dirty:oe,ctx:Q}),i.$set(Ne);const Me={};oe&1&&(Me.epoch=Q[0].u),f.$set(Me),Q[0].t>-50?ve?ve.p(Q,oe):(ve=Wr(Q),ve.c(),ve.m(r,_)):ve&&(ve.d(1),ve=null),(!Ee||oe&1)&&v!==(v=(Q[0].m?(Q[0].m/1e3).toFixed(1):"-")+"")&&B(h,v);const he={};oe&3&&(he.text=Q[1].booting?"Booting":Q[0].v>2?Q[0].v.toFixed(2)+"V":"ESP"),oe&3&&(he.color=Dl(Q[1].booting?2:Q[0].em)),T.$set(he);const x={};oe&3&&(x.color=Dl(Q[1].booting?9:Q[0].hm)),D.$set(x);const _e={};oe&1&&(_e.text=Q[0].r?Q[0].r.toFixed(0)+"dBm":"WiFi"),oe&3&&(_e.color=Dl(Q[1].booting?9:Q[0].wm)),A.$set(_e);const Le={};oe&3&&(Le.color=Dl(Q[1].booting?9:Q[0].mm)),F.$set(Le),Q[0].he<0||Q[0].he>0?Pe?Pe.p(Q,oe):(Pe=Gr(Q),Pe.c(),Pe.m(l,U)):Pe&&(Pe.d(1),Pe=null),Q[0].me<0?Ae?Ae.p(Q,oe):(Ae=Br(Q),Ae.c(),Ae.m(l,R)):Ae&&(Ae.d(1),Ae=null),Q[0].ee>0||Q[0].ee<0?me?me.p(Q,oe):(me=Yr(Q),me.c(),me.m(l,q)):me&&(me.d(1),me=null);const We={};oe&1&&(We.timestamp=Q[0].c?new Date(Q[0].c*1e3):new Date(0)),oe&2&&(We.offset=Q[1].clock_offset),ee.$set(We),Q[1].vndcfg&&Q[1].usrcfg?se?oe&2&&N(se,1):(se=zr(Q),se.c(),N(se,1),se.m(Y,de)):se&&(Te(),I(se,1,1,()=>{se=null}),Se()),Q[1].fwconsent===1&&Q[2]?pe?(pe.p(Q,oe),oe&6&&N(pe,1)):(pe=Vr(Q),pe.c(),N(pe,1),pe.m(Y,null)):pe&&(Te(),I(pe,1,1,()=>{pe=null}),Se())},i(Q){Ee||(N(i.$$.fragment,Q),N(f.$$.fragment,Q),N(T.$$.fragment,Q),N(D.$$.fragment,Q),N(A.$$.fragment,Q),N(F.$$.fragment,Q),N(ee.$$.fragment,Q),N(se),N(Ie.$$.fragment,Q),N(pe),Ee=!0)},o(Q){I(i.$$.fragment,Q),I(f.$$.fragment,Q),I(T.$$.fragment,Q),I(D.$$.fragment,Q),I(A.$$.fragment,Q),I(F.$$.fragment,Q),I(ee.$$.fragment,Q),I(se),I(Ie.$$.fragment,Q),I(pe),Ee=!1},d(Q){Q&&w(e),Z(i),Z(f),ve&&ve.d(),Z(T),Z(D),Z(A),Z(F),Pe&&Pe.d(),Ae&&Ae.d(),me&&me.d(),Z(ee),se&&se.d(),Z(Ie),pe&&pe.d()}}}function Lm(t,e,l){let{data:n={}}=e,i={},o={};function r(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!ni(i.board)||confirm(vs(fe(i.chip,i.board))))&&(Rt.update(a=>(a.upgrading=!0,a)),Cc(o.tag_name))}return Rt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&om()}),po.subscribe(a=>{l(2,o=Tc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,r]}class Um extends $e{constructor(e){super(),ye(this,e,Lm,Rm,ke,{data:0})}}function Om(t){let e,l,n,i;return{c(){e=qe("svg"),l=qe("path"),n=qe("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){y(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:ne,o:ne,d(o){o&&w(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",f=["M",o.x,o.y,"A",l,l,0,a,0,r.x,r.y].join(" ");return f}function qm(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 Hm extends $e{constructor(e){super(),ye(this,e,qm,Om,ke,{pct:0,color:1})}}function Qr(t){let e,l,n,i,o,r,a,f;return{c(){e=m("br"),l=b(),n=m("span"),i=$(t[3]),o=b(),r=m("span"),a=$(t[4]),f=$("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(c,_){y(c,e,_),y(c,l,_),y(c,n,_),s(n,i),y(c,o,_),y(c,r,_),s(r,a),s(r,f)},p(c,_){_&8&&B(i,c[3]),_&16&&B(a,c[4])},d(c){c&&w(e),c&&w(l),c&&w(n),c&&w(o),c&&w(r)}}}function jm(t){let e,l,n,i,o,r,a,f,c,_,p,d,v,h,g,k;l=new Hm({props:{pct:t[6],color:t[5](t[6])}});let C=t[3]&&Qr(t);return{c(){e=m("div"),J(l.$$.fragment),n=b(),i=m("span"),o=m("span"),r=$(t[2]),a=b(),f=m("br"),c=b(),_=m("span"),p=$(t[0]),d=b(),v=m("span"),h=$(t[1]),g=b(),C&&C.c(),u(o,"class","pl-lab"),u(_,"class","pl-val"),u(v,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(T,P){y(T,e,P),X(l,e,null),s(e,n),s(e,i),s(i,o),s(o,r),s(i,a),s(i,f),s(i,c),s(i,_),s(_,p),s(i,d),s(i,v),s(v,h),s(i,g),C&&C.m(i,null),k=!0},p(T,[P]){const D={};P&64&&(D.pct=T[6]),P&96&&(D.color=T[5](T[6])),l.$set(D),(!k||P&4)&&B(r,T[2]),(!k||P&1)&&B(p,T[0]),(!k||P&2)&&B(h,T[1]),T[3]?C?C.p(T,P):(C=Qr(T),C.c(),C.m(i,null)):C&&(C.d(1),C=null)},i(T){k||(N(l.$$.fragment,T),k=!0)},o(T){I(l.$$.fragment,T),k=!1},d(T){T&&w(e),Z(l),C&&C.d()}}}function Wm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:r}=e,{sub:a=""}=e,{subunit:f=""}=e,{colorFn:c}=e,_=0;return t.$$set=p=>{"val"in p&&l(0,n=p.val),"max"in p&&l(7,i=p.max),"unit"in p&&l(1,o=p.unit),"label"in p&&l(2,r=p.label),"sub"in p&&l(3,a=p.sub),"subunit"in p&&l(4,f=p.subunit),"colorFn"in p&&l(5,c=p.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,o,r,a,f,c,_,i]}class Nc extends $e{constructor(e){super(),ye(this,e,Wm,jm,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[10]=e[l],n[12]=l,n}function Zr(t,e,l){const n=t.slice();return n[10]=e[l],n[12]=l,n}function Jr(t,e,l){const n=t.slice();return n[14]=e[l],n}function xr(t){let e,l,n,i,o,r=t[0].title&&ea(t),a=t[0].y.ticks,f=[];for(let v=0;v20||t[12]%2==0)&&ia(t);return{c(){e=qe("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[5](t[12])+","+t[4]+")")},m(i,o){y(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[12]%2==0?n?n.p(i,o):(n=ia(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[12])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&w(e),n&&n.d()}}}function ia(t){let e,l=t[10].label+"",n,i;return{c(){e=qe("text"),n=$(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(o,r){y(o,e,r),s(e,n)},p(o,r){r&1&&l!==(l=o[10].label+"")&&B(n,l),r&8&&i!==(i=o[3]/2)&&u(e,"x",i)},d(o){o&&w(e)}}}function sa(t){let e=!isNaN(t[5](t[12])),l,n=e&&na(t);return{c(){n&&n.c(),l=Ge()},m(i,o){n&&n.m(i,o),y(i,l,o)},p(i,o){o&32&&(e=!isNaN(i[5](i[12]))),e?n?n.p(i,o):(n=na(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&w(l)}}}function oa(t){let e,l,n=t[10].value!==void 0&&ua(t),i=t[10].value2>1e-4&&fa(t);return{c(){e=qe("g"),n&&n.c(),l=qe("g"),i&&i.c()},m(o,r){y(o,e,r),n&&n.m(e,null),y(o,l,r),i&&i.m(l,null)},p(o,r){o[10].value!==void 0?n?n.p(o,r):(n=ua(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[10].value2>1e-4?i?i.p(o,r):(i=fa(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&w(e),n&&n.d(),o&&w(l),i&&i.d()}}}function ua(t){let e,l,n,i,o,r,a,f=t[3]>15&&ra(t);return{c(){e=qe("rect"),f&&f.c(),a=Ge(),u(e,"x",l=t[5](t[12])+2),u(e,"y",n=t[6](t[10].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[10].value)),u(e,"fill",r=t[10].color)},m(c,_){y(c,e,_),f&&f.m(c,_),y(c,a,_)},p(c,_){_&32&&l!==(l=c[5](c[12])+2)&&u(e,"x",l),_&65&&n!==(n=c[6](c[10].value))&&u(e,"y",n),_&8&&i!==(i=c[3]-4)&&u(e,"width",i),_&65&&o!==(o=c[6](c[0].y.min)-c[6](Math.min(c[0].y.min,0)+c[10].value))&&u(e,"height",o),_&1&&r!==(r=c[10].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,_):(f=ra(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&w(e),f&&f.d(c),c&&w(a)}}}function ra(t){let e,l=t[10].label+"",n,i,o,r,a,f,c,_,p=t[10].title&&aa(t);return{c(){e=qe("text"),n=$(l),p&&p.c(),_=Ge(),u(e,"y",i=t[6](t[10].value)>t[6](0)-t[7]?t[6](t[10].value)-t[7]:t[6](t[10].value)+10),u(e,"x",o=t[5](t[12])+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",f=t[6](t[10].value)>t[6](0)-t[7]?t[10].color:"white"),u(e,"transform",c="rotate("+(t[3]<25?90:0)+", "+(t[5](t[12])+t[3]/2)+", "+(t[6](t[10].value)>t[6](0)-t[7]?t[6](t[10].value)-t[7]:t[6](t[10].value)+9)+")")},m(d,v){y(d,e,v),s(e,n),p&&p.m(d,v),y(d,_,v)},p(d,v){v&1&&l!==(l=d[10].label+"")&&B(n,l),v&193&&i!==(i=d[6](d[10].value)>d[6](0)-d[7]?d[6](d[10].value)-d[7]:d[6](d[10].value)+10)&&u(e,"y",i),v&40&&o!==(o=d[5](d[12])+d[3]/2)&&u(e,"x",o),v&8&&r!==(r=d[3]-4)&&u(e,"width",r),v&8&&a!==(a=d[3]<25?"left":"middle")&&u(e,"text-anchor",a),v&193&&f!==(f=d[6](d[10].value)>d[6](0)-d[7]?d[10].color:"white")&&u(e,"fill",f),v&233&&c!==(c="rotate("+(d[3]<25?90:0)+", "+(d[5](d[12])+d[3]/2)+", "+(d[6](d[10].value)>d[6](0)-d[7]?d[6](d[10].value)-d[7]:d[6](d[10].value)+9)+")")&&u(e,"transform",c),d[10].title?p?p.p(d,v):(p=aa(d),p.c(),p.m(_.parentNode,_)):p&&(p.d(1),p=null)},d(d){d&&w(e),p&&p.d(d),d&&w(_)}}}function aa(t){let e,l=t[10].title+"",n;return{c(){e=qe("title"),n=$(l)},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[10].title+"")&&B(n,l)},d(i){i&&w(e)}}}function fa(t){let e,l,n,i,o,r,a,f=t[3]>15&&ca(t);return{c(){e=qe("rect"),f&&f.c(),a=Ge(),u(e,"x",l=t[5](t[12])+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[10].value2)),u(e,"fill",r=t[10].color)},m(c,_){y(c,e,_),f&&f.m(c,_),y(c,a,_)},p(c,_){_&32&&l!==(l=c[5](c[12])+2)&&u(e,"x",l),_&64&&n!==(n=c[6](0))&&u(e,"y",n),_&8&&i!==(i=c[3]-4)&&u(e,"width",i),_&65&&o!==(o=c[6](c[0].y.min)-c[6](c[0].y.min+c[10].value2))&&u(e,"height",o),_&1&&r!==(r=c[10].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,_):(f=ca(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&w(e),f&&f.d(c),c&&w(a)}}}function ca(t){let e,l=t[10].label2+"",n,i,o,r,a,f,c,_=t[10].title2&&ma(t);return{c(){e=qe("text"),n=$(l),_&&_.c(),c=Ge(),u(e,"y",i=t[6](-t[10].value2)t[9].call(e))},m(i,o){y(i,e,o),n&&n.m(e,null),l=jc(e,t[9].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=xr(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:ne,o:ne,d(i){i&&w(e),n&&n.d(),l()}}}function Bm(t,e,l){let{config:n}=e,i,o,r,a,f,c,_,p;function d(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=v=>{"config"in v&&l(0,n=v.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,c=o-(n.title?20:0));let v=i-(n.padding.left+n.padding.right);l(3,r=v/n.points.length),l(7,_=r<25?28:17),l(8,p=r<25?10:100);let h=(c-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,a=function(g){return g*r+n.padding.left}),l(6,f=function(g){let k=0;return g>n.y.max?k=n.padding.bottom:gc||k<0?0:k})}},[n,i,o,r,c,a,f,_,p,d]}class sn extends $e{constructor(e){super(),ye(this,e,Bm,Gm,ke,{config:0})}}function Ym(t){let e,l;return e=new sn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function zm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:r}=e,a={};function f(c){return{label:ce(c)+"V",title:c.toFixed(1)+" V",value:isNaN(c)?0:c,color:tm(c||0)}}return t.$$set=c=>{"u1"in c&&l(1,n=c.u1),"u2"in c&&l(2,i=c.u2),"u3"in c&&l(3,o=c.u3),"ds"in c&&l(4,r=c.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let c=[],_=[];n>0&&(c.push({label:r===1?"L1-L2":"L1"}),_.push(f(n))),i>0&&(c.push({label:r===1?"L1-L3":"L2"}),_.push(f(i))),o>0&&(c.push({label:r===1?"L2-L3":"L3"}),_.push(f(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:c},points:_})}},[a,n,i,o,r]}class Vm extends $e{constructor(e){super(),ye(this,e,zm,Ym,ke,{u1:1,u2:2,u3:3,ds:4})}}function Km(t){let e,l;return e=new sn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Qm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:r}=e,{i2:a}=e,{i3:f}=e,{max:c}=e,_={};function p(d){return{label:ce(d)+"A",title:d.toFixed(1)+" A",value:isNaN(d)?0:d,color:vc(d?d/c*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,f=d.i3),"max"in d&&l(7,c=d.max)},t.$$.update=()=>{if(t.$$.dirty&254){let d=[],v=[];n>0&&(d.push({label:"L1"}),v.push(p(r))),i>0&&(d.push({label:"L2"}),v.push(p(a))),o>0&&(d.push({label:"L3"}),v.push(p(f))),l(0,_={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:c,ticks:[{value:0,label:"0%"},{value:c/4,label:"25%"},{value:c/2,label:"50%"},{value:c/4*3,label:"75%"},{value:c,label:"100%"}]},x:{ticks:d},points:v})}},[_,n,i,o,r,a,f,c]}class Xm extends $e{constructor(e){super(),ye(this,e,Qm,Km,ke,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function Zm(t){let e,l,n,i,o,r,a,f=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",c,_,p,d,v,h,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",k,C,T,P,D,S,A,E=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,z,U,R,q,Y,O=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",H,G;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=b(),i=m("div"),o=m("div"),o.textContent="Instant in",r=b(),a=m("div"),c=$(f),_=$(" VAr"),p=b(),d=m("div"),d.textContent="Instant out",v=b(),h=m("div"),k=$(g),C=$(" VAr"),T=b(),P=m("div"),D=m("div"),D.textContent="Total in",S=b(),A=m("div"),F=$(E),z=$(" kVArh"),U=b(),R=m("div"),R.textContent="Total out",q=b(),Y=m("div"),H=$(O),G=$(" kVArh"),u(a,"class","text-right"),u(h,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(A,"class","text-right"),u(Y,"class","text-right"),u(P,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(L,W){y(L,e,W),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(i,a),s(a,c),s(a,_),s(i,p),s(i,d),s(i,v),s(i,h),s(h,k),s(h,C),s(e,T),s(e,P),s(P,D),s(P,S),s(P,A),s(A,F),s(A,z),s(P,U),s(P,R),s(P,q),s(P,Y),s(Y,H),s(Y,G)},p(L,[W]){W&1&&f!==(f=(typeof L[0]<"u"?L[0].toFixed(0):"-")+"")&&B(c,f),W&2&&g!==(g=(typeof L[1]<"u"?L[1].toFixed(0):"-")+"")&&B(k,g),W&4&&E!==(E=(typeof L[2]<"u"?L[2].toFixed(1):"-")+"")&&B(F,E),W&8&&O!==(O=(typeof L[3]<"u"?L[3].toFixed(1):"-")+"")&&B(H,O)},i:ne,o:ne,d(L){L&&w(e)}}}function Jm(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 xm extends $e{constructor(e){super(),ye(this,e,Jm,Zm,ke,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function _a(t){let e;function l(o,r){return o[3]?tp:ep}let n=l(t),i=n(t);return{c(){i.c(),e=Ge()},m(o,r){i.m(o,r),y(o,e,r)},p(o,r){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&w(e)}}}function ep(t){let e,l,n,i,o,r,a=ce(t[1].h.u,2)+"",f,c,_,p,d,v,h=ce(t[1].d.u,1)+"",g,k,C,T,P,D,S=ce(t[1].m.u)+"",A,E,F,z,U,R,q=ce(t[0].last_month.u)+"",Y,O,H,G,L=t[4]&&da(t);return{c(){e=m("strong"),e.textContent="Consumption",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),r=m("div"),f=$(a),c=$(" kWh"),_=b(),p=m("div"),p.textContent="Day",d=b(),v=m("div"),g=$(h),k=$(" kWh"),C=b(),T=m("div"),T.textContent="Month",P=b(),D=m("div"),A=$(S),E=$(" kWh"),F=b(),z=m("div"),z.textContent="Last month",U=b(),R=m("div"),Y=$(q),O=$(" kWh"),H=b(),L&&L.c(),G=Ge(),u(r,"class","text-right"),u(v,"class","text-right"),u(D,"class","text-right"),u(R,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(W,j){y(W,e,j),y(W,l,j),y(W,n,j),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,_),s(n,p),s(n,d),s(n,v),s(v,g),s(v,k),s(n,C),s(n,T),s(n,P),s(n,D),s(D,A),s(D,E),s(n,F),s(n,z),s(n,U),s(n,R),s(R,Y),s(R,O),y(W,H,j),L&&L.m(W,j),y(W,G,j)},p(W,j){j&2&&a!==(a=ce(W[1].h.u,2)+"")&&B(f,a),j&2&&h!==(h=ce(W[1].d.u,1)+"")&&B(g,h),j&2&&S!==(S=ce(W[1].m.u)+"")&&B(A,S),j&1&&q!==(q=ce(W[0].last_month.u)+"")&&B(Y,q),W[4]?L?L.p(W,j):(L=da(W),L.c(),L.m(G.parentNode,G)):L&&(L.d(1),L=null)},d(W){W&&w(e),W&&w(l),W&&w(n),W&&w(H),L&&L.d(W),W&&w(G)}}}function tp(t){let e,l,n,i,o,r,a=ce(t[1].h.u,2)+"",f,c,_,p,d,v,h,g=ce(t[1].d.u,1)+"",k,C,T,P,D,S,A,E=ce(t[1].m.u)+"",F,z,U,R,q,Y,O,H=ce(t[0].last_month.u)+"",G,L,W,j,ee,le,de,ie,we,Ie,Ce,Ee=ce(t[1].h.p,2)+"",ve,Pe,Ae,me,se,pe,Q,oe=ce(t[1].d.p,1)+"",Ne,Me,he,x,_e,Le,We,Ke=ce(t[1].m.p)+"",Fe,je,re,ge,Lt,Ll,Zt,ft=ce(t[0].last_month.p)+"",$l,al,Ut,dt,Qe=t[4]&&va(t),Xe=t[4]&&ha(t),Ze=t[4]&&ba(t),Ue=t[4]&&ga(t),Je=t[4]&&ka(t),Be=t[4]&&wa(t),xe=t[4]&&ya(t),et=t[4]&&$a(t);return{c(){e=m("strong"),e.textContent="Import",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),r=m("div"),f=$(a),c=$(" kWh"),_=b(),Qe&&Qe.c(),p=b(),d=m("div"),d.textContent="Day",v=b(),h=m("div"),k=$(g),C=$(" kWh"),T=b(),Xe&&Xe.c(),P=b(),D=m("div"),D.textContent="Month",S=b(),A=m("div"),F=$(E),z=$(" kWh"),U=b(),Ze&&Ze.c(),R=b(),q=m("div"),q.textContent="Last mo.",Y=b(),O=m("div"),G=$(H),L=$(" kWh"),W=b(),Ue&&Ue.c(),ee=b(),le=m("strong"),le.textContent="Export",de=b(),ie=m("div"),we=m("div"),we.textContent="Hour",Ie=b(),Ce=m("div"),ve=$(Ee),Pe=$(" kWh"),Ae=b(),Je&&Je.c(),me=b(),se=m("div"),se.textContent="Day",pe=b(),Q=m("div"),Ne=$(oe),Me=$(" kWh"),he=b(),Be&&Be.c(),x=b(),_e=m("div"),_e.textContent="Month",Le=b(),We=m("div"),Fe=$(Ke),je=$(" kWh"),re=b(),xe&&xe.c(),ge=b(),Lt=m("div"),Lt.textContent="Last mo.",Ll=b(),Zt=m("div"),$l=$(ft),al=$(" kWh"),Ut=b(),et&&et.c(),u(r,"class","text-right"),u(h,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class",j="grid grid-cols-"+t[5]+" mb-3"),u(Ce,"class","text-right"),u(Q,"class","text-right"),u(We,"class","text-right"),u(Zt,"class","text-right"),u(ie,"class",dt="grid grid-cols-"+t[5])},m(ue,be){y(ue,e,be),y(ue,l,be),y(ue,n,be),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,_),Qe&&Qe.m(n,null),s(n,p),s(n,d),s(n,v),s(n,h),s(h,k),s(h,C),s(n,T),Xe&&Xe.m(n,null),s(n,P),s(n,D),s(n,S),s(n,A),s(A,F),s(A,z),s(n,U),Ze&&Ze.m(n,null),s(n,R),s(n,q),s(n,Y),s(n,O),s(O,G),s(O,L),s(n,W),Ue&&Ue.m(n,null),y(ue,ee,be),y(ue,le,be),y(ue,de,be),y(ue,ie,be),s(ie,we),s(ie,Ie),s(ie,Ce),s(Ce,ve),s(Ce,Pe),s(ie,Ae),Je&&Je.m(ie,null),s(ie,me),s(ie,se),s(ie,pe),s(ie,Q),s(Q,Ne),s(Q,Me),s(ie,he),Be&&Be.m(ie,null),s(ie,x),s(ie,_e),s(ie,Le),s(ie,We),s(We,Fe),s(We,je),s(ie,re),xe&&xe.m(ie,null),s(ie,ge),s(ie,Lt),s(ie,Ll),s(ie,Zt),s(Zt,$l),s(Zt,al),s(ie,Ut),et&&et.m(ie,null)},p(ue,be){be&2&&a!==(a=ce(ue[1].h.u,2)+"")&&B(f,a),ue[4]?Qe?Qe.p(ue,be):(Qe=va(ue),Qe.c(),Qe.m(n,p)):Qe&&(Qe.d(1),Qe=null),be&2&&g!==(g=ce(ue[1].d.u,1)+"")&&B(k,g),ue[4]?Xe?Xe.p(ue,be):(Xe=ha(ue),Xe.c(),Xe.m(n,P)):Xe&&(Xe.d(1),Xe=null),be&2&&E!==(E=ce(ue[1].m.u)+"")&&B(F,E),ue[4]?Ze?Ze.p(ue,be):(Ze=ba(ue),Ze.c(),Ze.m(n,R)):Ze&&(Ze.d(1),Ze=null),be&1&&H!==(H=ce(ue[0].last_month.u)+"")&&B(G,H),ue[4]?Ue?Ue.p(ue,be):(Ue=ga(ue),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),be&32&&j!==(j="grid grid-cols-"+ue[5]+" mb-3")&&u(n,"class",j),be&2&&Ee!==(Ee=ce(ue[1].h.p,2)+"")&&B(ve,Ee),ue[4]?Je?Je.p(ue,be):(Je=ka(ue),Je.c(),Je.m(ie,me)):Je&&(Je.d(1),Je=null),be&2&&oe!==(oe=ce(ue[1].d.p,1)+"")&&B(Ne,oe),ue[4]?Be?Be.p(ue,be):(Be=wa(ue),Be.c(),Be.m(ie,x)):Be&&(Be.d(1),Be=null),be&2&&Ke!==(Ke=ce(ue[1].m.p)+"")&&B(Fe,Ke),ue[4]?xe?xe.p(ue,be):(xe=ya(ue),xe.c(),xe.m(ie,ge)):xe&&(xe.d(1),xe=null),be&1&&ft!==(ft=ce(ue[0].last_month.p)+"")&&B($l,ft),ue[4]?et?et.p(ue,be):(et=$a(ue),et.c(),et.m(ie,null)):et&&(et.d(1),et=null),be&32&&dt!==(dt="grid grid-cols-"+ue[5])&&u(ie,"class",dt)},d(ue){ue&&w(e),ue&&w(l),ue&&w(n),Qe&&Qe.d(),Xe&&Xe.d(),Ze&&Ze.d(),Ue&&Ue.d(),ue&&w(ee),ue&&w(le),ue&&w(de),ue&&w(ie),Je&&Je.d(),Be&&Be.d(),xe&&xe.d(),et&&et.d()}}}function da(t){let e,l,n,i,o,r,a=ce(t[1].h.c,2)+"",f,c,_,p,d,v,h,g=ce(t[1].d.c,1)+"",k,C,T,P,D,S,A,E=ce(t[1].m.c)+"",F,z,U,R,q,Y,O,H=ce(t[0].last_month.c)+"",G,L,W;return{c(){e=m("strong"),e.textContent="Cost",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),r=m("div"),f=$(a),c=b(),_=$(t[2]),p=b(),d=m("div"),d.textContent="Day",v=b(),h=m("div"),k=$(g),C=b(),T=$(t[2]),P=b(),D=m("div"),D.textContent="Month",S=b(),A=m("div"),F=$(E),z=b(),U=$(t[2]),R=b(),q=m("div"),q.textContent="Last month",Y=b(),O=m("div"),G=$(H),L=b(),W=$(t[2]),u(r,"class","text-right"),u(h,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class","grid grid-cols-2")},m(j,ee){y(j,e,ee),y(j,l,ee),y(j,n,ee),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(r,_),s(n,p),s(n,d),s(n,v),s(n,h),s(h,k),s(h,C),s(h,T),s(n,P),s(n,D),s(n,S),s(n,A),s(A,F),s(A,z),s(A,U),s(n,R),s(n,q),s(n,Y),s(n,O),s(O,G),s(O,L),s(O,W)},p(j,ee){ee&2&&a!==(a=ce(j[1].h.c,2)+"")&&B(f,a),ee&4&&B(_,j[2]),ee&2&&g!==(g=ce(j[1].d.c,1)+"")&&B(k,g),ee&4&&B(T,j[2]),ee&2&&E!==(E=ce(j[1].m.c)+"")&&B(F,E),ee&4&&B(U,j[2]),ee&1&&H!==(H=ce(j[0].last_month.c)+"")&&B(G,H),ee&4&&B(W,j[2])},d(j){j&&w(e),j&&w(l),j&&w(n)}}}function va(t){let e,l=ce(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].h.c,2)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function ha(t){let e,l=ce(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].d.c,1)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function ba(t){let e,l=ce(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].m.c)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function ga(t){let e,l=ce(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ce(r[0].last_month.c)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function ka(t){let e,l=ce(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].h.i,2)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function wa(t){let e,l=ce(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].d.i,1)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function ya(t){let e,l=ce(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].m.i)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function $a(t){let e,l=ce(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=b(),o=$(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ce(r[0].last_month.i)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function lp(t){let e,l,n,i,o,r,a=t[1]&&_a(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=b(),i=m("br"),o=m("br"),r=b(),a&&a.c(),u(e,"class","mx-2 text-sm")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),s(e,r),a&&a.m(e,null)},p(f,[c]){f[1]?a?a.p(f,c):(a=_a(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:ne,o:ne,d(f){f&&w(e),a&&a.d()}}}function np(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:r}=e,a=!1,f=3;return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo),"data"in c&&l(1,i=c.data),"currency"in c&&l(2,o=c.currency),"hasExport"in c&&l(3,r=c.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(i.h.c>.01||i.d.c>.01||i.m.c>.01||i.h.i>.01||i.d.i>.01||i.m.i>.01)),l(5,f=a?3:2))},[n,i,o,r,a,f]}class ip extends $e{constructor(e){super(),ye(this,e,np,lp,ke,{sysinfo:0,data:1,currency:2,hasExport:3})}}function sp(t){let e,l,n,i;return n=new sn({props:{config:t[0]}}),{c(){e=m("a"),e.textContent="Provided by ENTSO-E",l=b(),J(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,r){y(o,e,r),y(o,l,r),X(n,o,r),i=!0},p(o,[r]){const a={};r&1&&(a.config=o[0]),n.$set(a)},i(o){i||(N(n.$$.fragment,o),i=!0)},o(o){I(n.$$.fragment,o),i=!1},d(o){o&&w(e),o&&w(l),Z(n,o)}}}function op(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},r=0,a=0;return t.$$set=f=>{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=new Date().getUTCHours(),c=0,_=0,p=0,d=n[20]==null?2:1,v=[],h=[],g=[],k=new Date;for(sl(k,i.clock_offset),c=f;c<24&&(_=n[De(p++)],_!=null);c++)h.push({label:De(k.getUTCHours())}),g.push({label:_>=0?_.toFixed(d):"",title:_>=0?_.toFixed(2)+" "+n.currency:"",value:_>=0?Math.abs(_*100):0,label2:_<0?_.toFixed(d):"",title2:_<0?_.toFixed(2)+" "+n.currency:"",value2:_<0?Math.abs(_*100):0,color:"#7c3aed"}),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),sl(k,1);for(c=0;c<24&&(_=n[De(p++)],_!=null);c++)h.push({label:De(k.getUTCHours())}),g.push({label:_>=0?_.toFixed(d):"",value:_>=0?Math.abs(_*100):0,label2:_<0?_.toFixed(d):"",value2:_<0?Math.abs(_*100):0,color:"#7c3aed"}),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),sl(k,1);let C=Math.max(r,Math.abs(a));if(a<0){l(4,a=Math.min(C/4*-1,a));let D=Math.ceil(Math.abs(a)/C*4),S=a/D;for(c=1;c{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],_=[],p=[],d=sl(new Date,-24),v=new Date().getUTCHours();for(sl(d,i.clock_offset),f=v;f<24;f++){let k=n["i"+De(f)],C=n["e"+De(f)];k===void 0&&(k=0),C===void 0&&(C=0),_.push({label:De(d.getUTCHours())}),p.push({label:k.toFixed(1),title:k.toFixed(2)+" kWh",value:k*10,label2:C.toFixed(1),title2:C.toFixed(2)+" kWh",value2:C*10,color:"#7c3aed"}),l(4,a=Math.max(a,C*10)),l(3,r=Math.max(r,k*10)),sl(d,1)}for(f=0;f{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],_=[],p=[],d=new Date,v=new Date;for(sl(d,i.clock_offset),sl(v,i.clock_offset),v.setDate(0),f=d.getDate();f<=v.getDate();f++){let k=n["i"+De(f)],C=n["e"+De(f)];k===void 0&&(k=0),C===void 0&&(C=0),_.push({label:De(f)}),p.push({label:k.toFixed(k<10?1:0),title:k.toFixed(2)+" kWh",value:k,label2:C.toFixed(C<10?1:0),title2:C.toFixed(2)+" kWh",value2:C,color:"#7c3aed"}),l(4,a=Math.max(a,C)),l(3,r=Math.max(r,k))}for(f=1;f{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,f=0,c=[],_=[],p=[];n.s&&n.s.forEach((h,g)=>{var k=h.n?h.n:h.a;f=h.v,f==-127&&(f=0),_.push({label:k.slice(-4)}),p.push({label:f.toFixed(1),value:f,color:"#7c3aed"}),l(3,r=Math.min(r,f)),l(2,o=Math.max(o,f))}),l(2,o=Math.ceil(o)),l(3,r=Math.floor(r));let d=o;r<0&&(d+=Math.abs(r));let v=d/4;for(a=0;a<5;a++)f=r+v*a,c.push({value:f,label:f.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:c},x:{ticks:_},points:p})}},[i,n,o,r]}class vp extends $e{constructor(e){super(),ye(this,e,dp,_p,ke,{json:1})}}function hp(t){let e,l;return e=new sn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}let bp=0;function gp(t,e,l){let n={},i=0,o;return $c.subscribe(r=>{l(2,o=r)}),yc(),t.$$.update=()=>{if(t.$$.dirty&6){let r=0,a=[],f=[],c=[];if(a.push({value:0,label:0}),o&&o.p)for(r=0;r0?De(_.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:bp,max:i,ticks:a},x:{ticks:f},points:c})}},[n,i,o]}class kp extends $e{constructor(e){super(),ye(this,e,gp,hp,ke,{})}}function Ca(t){let e,l,n,i,o,r,a=(t[0].mt?ds(t[0].mt):"-")+"",f,c,_,p=(t[0].ic?t[0].ic.toFixed(1):"-")+"",d,v,h;return i=new Nc({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:vc}}),{c(){e=m("div"),l=m("div"),n=m("div"),J(i.$$.fragment),o=b(),r=m("div"),f=$(a),c=b(),_=m("div"),d=$(p),v=$(" kWh"),u(n,"class","col-span-2"),u(_,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,k){y(g,e,k),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(r,f),s(l,c),s(l,_),s(_,d),s(_,v),h=!0},p(g,k){const C={};k&1&&(C.val=g[0].i?g[0].i:0),k&1&&(C.max=g[0].im?g[0].im:15e3),k&1&&(C.sub=g[0].p),k&1&&(C.subunit=g[0].pc),i.$set(C),(!h||k&1)&&a!==(a=(g[0].mt?ds(g[0].mt):"-")+"")&&B(f,a),(!h||k&1)&&p!==(p=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&B(d,p)},i(g){h||(N(i.$$.fragment,g),h=!0)},o(g){I(i.$$.fragment,g),h=!1},d(g){g&&w(e),Z(i)}}}function Ta(t){let e,l,n,i,o,r,a,f,c=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,p,d;return i=new Nc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:lm}}),{c(){e=m("div"),l=m("div"),n=m("div"),J(i.$$.fragment),o=b(),r=m("div"),a=b(),f=m("div"),_=$(c),p=$(" kWh"),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(v,h){y(v,e,h),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(l,a),s(l,f),s(f,_),s(f,p),d=!0},p(v,h){const g={};h&1&&(g.val=v[0].e?v[0].e:0),h&1&&(g.max=v[0].om?v[0].om*1e3:1e4),i.$set(g),(!d||h&1)&&c!==(c=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&B(_,c)},i(v){d||(N(i.$$.fragment,v),d=!0)},o(v){I(i.$$.fragment,v),d=!1},d(v){v&&w(e),Z(i)}}}function Sa(t){let e,l,n;return l=new Vm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(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||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Pa(t){let e,l,n;return l=new Xm({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=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(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||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Na(t){let e,l,n;return l=new xm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(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||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ma(t){let e,l,n;return l=new ip({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&2&&(r.sysinfo=i[1]),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||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Aa(t){let e,l,n;return l=new kp({}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){y(i,e,o),X(l,e,null),n=!0},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Da(t){let e,l,n;return l=new up({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&4&&(r.json=i[2]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ia(t){let e,l,n;return l=new fp({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&8&&(r.json=i[3]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ea(t){let e,l,n;return l=new pp({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&16&&(r.json=i[4]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Fa(t){let e,l,n;return l=new vp({props:{json:t[5]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&32&&(r.json=i[5]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function wp(t){let e,l=Ye(t[1].ui.i,t[0].i),n,i=Ye(t[1].ui.e,t[0].om||t[0].e>0),o,r=Ye(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,f=Ye(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),c,_=Ye(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),p,d=Ye(t[1].ui.c,t[0].ea),v,h=Ye(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,k=Ye(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),C,T=Ye(t[1].ui.d,t[3]),P,D=Ye(t[1].ui.m,t[4]),S,A=Ye(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),E,F=l&&Ca(t),z=i&&Ta(t),U=r&&Sa(t),R=f&&Pa(t),q=_&&Na(t),Y=d&&Ma(t),O=h&&Aa(),H=k&&Da(t),G=T&&Ia(t),L=D&&Ea(t),W=A&&Fa(t);return{c(){e=m("div"),F&&F.c(),n=b(),z&&z.c(),o=b(),U&&U.c(),a=b(),R&&R.c(),c=b(),q&&q.c(),p=b(),Y&&Y.c(),v=b(),O&&O.c(),g=b(),H&&H.c(),C=b(),G&&G.c(),P=b(),L&&L.c(),S=b(),W&&W.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,ee){y(j,e,ee),F&&F.m(e,null),s(e,n),z&&z.m(e,null),s(e,o),U&&U.m(e,null),s(e,a),R&&R.m(e,null),s(e,c),q&&q.m(e,null),s(e,p),Y&&Y.m(e,null),s(e,v),O&&O.m(e,null),s(e,g),H&&H.m(e,null),s(e,C),G&&G.m(e,null),s(e,P),L&&L.m(e,null),s(e,S),W&&W.m(e,null),E=!0},p(j,[ee]){ee&3&&(l=Ye(j[1].ui.i,j[0].i)),l?F?(F.p(j,ee),ee&3&&N(F,1)):(F=Ca(j),F.c(),N(F,1),F.m(e,n)):F&&(Te(),I(F,1,1,()=>{F=null}),Se()),ee&3&&(i=Ye(j[1].ui.e,j[0].om||j[0].e>0)),i?z?(z.p(j,ee),ee&3&&N(z,1)):(z=Ta(j),z.c(),N(z,1),z.m(e,o)):z&&(Te(),I(z,1,1,()=>{z=null}),Se()),ee&3&&(r=Ye(j[1].ui.v,j[0].u1>100||j[0].u2>100||j[0].u3>100)),r?U?(U.p(j,ee),ee&3&&N(U,1)):(U=Sa(j),U.c(),N(U,1),U.m(e,a)):U&&(Te(),I(U,1,1,()=>{U=null}),Se()),ee&3&&(f=Ye(j[1].ui.a,j[0].i1>.01||j[0].i2>.01||j[0].i3>.01)),f?R?(R.p(j,ee),ee&3&&N(R,1)):(R=Pa(j),R.c(),N(R,1),R.m(e,c)):R&&(Te(),I(R,1,1,()=>{R=null}),Se()),ee&3&&(_=Ye(j[1].ui.r,j[0].ri>0||j[0].re>0||j[0].ric>0||j[0].rec>0)),_?q?(q.p(j,ee),ee&3&&N(q,1)):(q=Na(j),q.c(),N(q,1),q.m(e,p)):q&&(Te(),I(q,1,1,()=>{q=null}),Se()),ee&3&&(d=Ye(j[1].ui.c,j[0].ea)),d?Y?(Y.p(j,ee),ee&3&&N(Y,1)):(Y=Ma(j),Y.c(),N(Y,1),Y.m(e,v)):Y&&(Te(),I(Y,1,1,()=>{Y=null}),Se()),ee&3&&(h=Ye(j[1].ui.t,j[0].pr&&(j[0].pr.startsWith("10YNO")||j[0].pr=="10Y1001A1001A48H"))),h?O?ee&3&&N(O,1):(O=Aa(),O.c(),N(O,1),O.m(e,g)):O&&(Te(),I(O,1,1,()=>{O=null}),Se()),ee&3&&(k=Ye(j[1].ui.p,j[0].pe&&!Number.isNaN(j[0].p))),k?H?(H.p(j,ee),ee&3&&N(H,1)):(H=Da(j),H.c(),N(H,1),H.m(e,C)):H&&(Te(),I(H,1,1,()=>{H=null}),Se()),ee&10&&(T=Ye(j[1].ui.d,j[3])),T?G?(G.p(j,ee),ee&10&&N(G,1)):(G=Ia(j),G.c(),N(G,1),G.m(e,P)):G&&(Te(),I(G,1,1,()=>{G=null}),Se()),ee&18&&(D=Ye(j[1].ui.m,j[4])),D?L?(L.p(j,ee),ee&18&&N(L,1)):(L=Ea(j),L.c(),N(L,1),L.m(e,S)):L&&(Te(),I(L,1,1,()=>{L=null}),Se()),ee&35&&(A=Ye(j[1].ui.s,j[0].t&&j[0].t!=-127&&j[5].c>1)),A?W?(W.p(j,ee),ee&35&&N(W,1)):(W=Fa(j),W.c(),N(W,1),W.m(e,null)):W&&(Te(),I(W,1,1,()=>{W=null}),Se())},i(j){E||(N(F),N(z),N(U),N(R),N(q),N(Y),N(O),N(H),N(G),N(L),N(W),E=!0)},o(j){I(F),I(z),I(U),I(R),I(q),I(Y),I(O),I(H),I(G),I(L),I(W),E=!1},d(j){j&&w(e),F&&F.d(),z&&z.d(),U&&U.d(),R&&R.d(),q&&q.d(),Y&&Y.d(),O&&O.d(),H&&H.d(),G&&G.d(),L&&L.d(),W&&W.d()}}}function yp(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},r={},a={},f={};return hc.subscribe(c=>{l(2,o=c)}),bc.subscribe(c=>{l(3,r=c)}),gc.subscribe(c=>{l(4,a=c)}),wc.subscribe(c=>{l(5,f=c)}),t.$$set=c=>{"data"in c&&l(0,n=c.data),"sysinfo"in c&&l(1,i=c.sysinfo)},[n,i,o,r,a,f]}class $p extends $e{constructor(e){super(),ye(this,e,yp,wp,ke,{data:0,sysinfo:1})}}let xs={};const Mc=ut(xs);async function Cp(){xs=await(await fetch("/configuration.json")).json(),Mc.set(xs)}function Ra(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Tp(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Sp(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function La(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Ua(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=b(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){y(i,e,o),y(i,l,o),y(i,n,o)},d(i){i&&w(e),i&&w(l),i&&w(n)}}}function Oa(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function qa(t){let e,l,n;return{c(){e=m("option"),l=$("GPIO"),n=$(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){y(i,e,o),s(e,l),s(e,n)},d(i){i&&w(e)}}}function Ha(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))&&qa(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=qa(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&w(e)}}}function Pp(t){let e,l,n,i,o;function r(h,g){return h[0]=="esp32c3"?Sp:Tp}let a=r(t),f=a(t),c=t[0]=="esp8266"&&La(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&Ua(),p=t[0]=="esp32s2"&&Oa(),d={length:t[1]+1},v=[];for(let h=0;h{"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 Ac extends $e{constructor(e){super(),ye(this,e,Np,Pp,ke,{chip:0})}}function ja(t){let e,l,n=t[1]&&Wa(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){y(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Wa(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&w(e),n&&n.d()}}}function Wa(t){let e,l;return{c(){e=m("div"),l=$(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){y(n,e,i),s(e,l)},p(n,i){i&2&&B(l,n[1])},d(n){n&&w(e)}}}function Mp(t){let e,l=t[0]&&ja(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=ja(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ne,o:ne,d(n){l&&l.d(n),n&&w(e)}}}function Ap(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 Mt extends $e{constructor(e){super(),ye(this,e,Ap,Mp,ke,{active:0,message:1})}}function Ga(t,e,l){const n=t.slice();return n[1]=e[l],n}function Ba(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=$("Europe/"),i=$(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,r){y(o,e,r),s(e,l),s(e,i)},p:ne,d(o){o&&w(e)}}}function Dp(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](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){I(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function Wp(t){let e,l;return e=new ol({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Gp(t){let e,l;return e=new ol({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Bp(t){let e,l,n,i;const o=[Gp,Wp],r=[];function a(f,c){return f[3].q.s.r?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let _=e;e=a(f),e!==_&&(Te(),I(r[_],1,1,()=>{r[_]=null}),Se(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){I(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function Yp(t){let e,l;return e=new ol({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function zp(t){let e,l;return e=new ol({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Vp(t){let e,l,n,i;const o=[zp,Yp],r=[];function a(f,c){return f[3].q.s.k?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let _=e;e=a(f),e!==_&&(Te(),I(r[_],1,1,()=>{r[_]=null}),Se(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){I(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function tf(t){let e,l,n,i,o,r,a,f,c,_,p,d,v,h,g,k,C,T,P,D,S,A,E,F,z,U,R,q,Y,O,H,G;return o=new Et({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=b(),i=m("a"),J(o.$$.fragment),r=b(),a=m("input"),f=b(),c=m("div"),_=m("div"),p=$("Electricity IDX"),d=m("br"),v=b(),h=m("input"),g=b(),k=m("div"),C=$("Current IDX"),T=m("br"),P=b(),D=m("input"),S=b(),A=m("div"),E=$(`Voltage IDX: L1, L2 & L3 `),F=m("div"),z=m("input"),U=b(),R=m("input"),q=b(),Y=m("input"),u(l,"class","text-sm"),u(i,"href",Ft("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","o"),a.value="true",u(h,"name","oe"),u(h,"type","text"),u(h,"class","in-f tr w-full"),u(_,"class","w-1/2"),u(D,"name","oc"),u(D,"type","text"),u(D,"class","in-l tr w-full"),u(k,"class","w-1/2"),u(c,"class","my-1 flex"),u(z,"name","ou1"),u(z,"type","text"),u(z,"class","in-f tr w-1/3"),u(R,"name","ou2"),u(R,"type","text"),u(R,"class","in-m tr w-1/3"),u(Y,"name","ou3"),u(Y,"type","text"),u(Y,"class","in-l tr w-1/3"),u(F,"class","flex"),u(A,"class","my-1"),u(e,"class","cnt")},m(L,W){y(L,e,W),s(e,l),s(e,n),s(e,i),X(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c),s(c,_),s(_,p),s(_,d),s(_,v),s(_,h),V(h,t[3].o.e),s(c,g),s(c,k),s(k,C),s(k,T),s(k,P),s(k,D),V(D,t[3].o.c),s(e,S),s(e,A),s(A,E),s(A,F),s(F,z),V(z,t[3].o.u1),s(F,U),s(F,R),V(R,t[3].o.u2),s(F,q),s(F,Y),V(Y,t[3].o.u3),O=!0,H||(G=[K(h,"input",t[59]),K(D,"input",t[60]),K(z,"input",t[61]),K(R,"input",t[62]),K(Y,"input",t[63])],H=!0)},p(L,W){W[0]&8&&h.value!==L[3].o.e&&V(h,L[3].o.e),W[0]&8&&D.value!==L[3].o.c&&V(D,L[3].o.c),W[0]&8&&z.value!==L[3].o.u1&&V(z,L[3].o.u1),W[0]&8&&R.value!==L[3].o.u2&&V(R,L[3].o.u2),W[0]&8&&Y.value!==L[3].o.u3&&V(Y,L[3].o.u3)},i(L){O||(N(o.$$.fragment,L),O=!0)},o(L){I(o.$$.fragment,L),O=!1},d(L){L&&w(e),Z(o),H=!1,Ve(G)}}}function lf(t){let e,l,n,i,o,r,a,f,c,_,p,d,v,h,g,k,C,T,P,D,S,A,E,F,z,U,R,q,Y;return o=new Et({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=b(),i=m("a"),J(o.$$.fragment),r=b(),a=m("input"),f=b(),c=m("div"),_=$("Discovery topic prefix"),p=m("br"),d=b(),v=m("input"),h=b(),g=m("div"),k=$("Hostname for URL"),C=m("br"),T=b(),P=m("input"),S=b(),A=m("div"),E=$("Name tag"),F=m("br"),z=b(),U=m("input"),u(l,"class","text-sm"),u(i,"href",Ft("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(v,"name","ht"),u(v,"type","text"),u(v,"class","in-s"),u(v,"placeholder","homeassistant"),u(c,"class","my-1"),u(P,"name","hh"),u(P,"type","text"),u(P,"class","in-s"),u(P,"placeholder",D=t[3].g.h+".local"),u(g,"class","my-1"),u(U,"name","hn"),u(U,"type","text"),u(U,"class","in-s"),u(A,"class","my-1"),u(e,"class","cnt")},m(O,H){y(O,e,H),s(e,l),s(e,n),s(e,i),X(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c),s(c,_),s(c,p),s(c,d),s(c,v),V(v,t[3].h.t),s(e,h),s(e,g),s(g,k),s(g,C),s(g,T),s(g,P),V(P,t[3].h.h),s(e,S),s(e,A),s(A,E),s(A,F),s(A,z),s(A,U),V(U,t[3].h.n),R=!0,q||(Y=[K(v,"input",t[64]),K(P,"input",t[65]),K(U,"input",t[66])],q=!0)},p(O,H){H[0]&8&&v.value!==O[3].h.t&&V(v,O[3].h.t),(!R||H[0]&8&&D!==(D=O[3].g.h+".local"))&&u(P,"placeholder",D),H[0]&8&&P.value!==O[3].h.h&&V(P,O[3].h.h),H[0]&8&&U.value!==O[3].h.n&&V(U,O[3].h.n)},i(O){R||(N(o.$$.fragment,O),R=!0)},o(O){I(o.$$.fragment,O),R=!1},d(O){O&&w(e),Z(o),q=!1,Ve(Y)}}}function nf(t){let e,l,n,i,o,r,a,f,c,_,p,d,v,h,g,k,C,T,P;o=new Et({});let D={length:9},S=[];for(let A=0;A20&&rf(t),_=t[0].chip=="esp8266"&&cf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=b(),i=m("a"),J(o.$$.fragment),r=b(),c&&c.c(),a=b(),_&&_.c(),u(l,"class","text-sm"),u(i,"href",Ft("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(p,d){y(p,e,d),s(e,l),s(e,n),s(e,i),X(o,i,null),s(e,r),c&&c.m(e,null),s(e,a),_&&_.m(e,null),f=!0},p(p,d){p[0].board>20?c?(c.p(p,d),d[0]&1&&N(c,1)):(c=rf(p),c.c(),N(c,1),c.m(e,a)):c&&(Te(),I(c,1,1,()=>{c=null}),Se()),p[0].chip=="esp8266"?_?_.p(p,d):(_=cf(p),_.c(),_.m(e,null)):_&&(_.d(1),_=null)},i(p){f||(N(o.$$.fragment,p),N(c),f=!0)},o(p){I(o.$$.fragment,p),I(c),f=!1},d(p){p&&w(e),Z(o),c&&c.d(),_&&_.d()}}}function rf(t){let e,l,n,i,o,r,a,f,c,_,p,d,v,h,g,k,C,T,P,D,S,A,E,F,z,U,R,q,Y,O,H,G,L,W,j,ee,le,de,ie,we,Ie,Ce,Ee,ve,Pe,Ae,me,se,pe,Q,oe,Ne,Me,he,x,_e,Le,We,Ke;d=new Ac({props:{chip:t[0].chip}});let Fe=t[0].chip!="esp8266"&&af(t),je=t[3].i.v.p>0&&ff(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=$("HAN"),r=m("label"),a=m("input"),f=$(" pullup"),c=m("br"),_=b(),p=m("select"),J(d.$$.fragment),v=b(),h=m("div"),g=$("AP button"),k=m("br"),C=b(),T=m("input"),P=b(),D=m("div"),S=$("LED"),A=m("label"),E=m("input"),F=$(" inv"),z=m("br"),U=b(),R=m("div"),q=m("input"),Y=b(),O=m("div"),H=$("RGB"),G=m("label"),L=m("input"),W=$(" inverted"),j=m("br"),ee=b(),le=m("div"),de=m("input"),ie=b(),we=m("input"),Ie=b(),Ce=m("input"),Ee=b(),ve=m("div"),Pe=$("Temperature"),Ae=m("br"),me=b(),se=m("input"),pe=b(),Q=m("div"),oe=$("Analog temp"),Ne=m("br"),Me=b(),he=m("input"),x=b(),Fe&&Fe.c(),_e=b(),je&&je.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(p,"name","ihp"),u(p,"class","in-f w-full"),t[3].i.h.p===void 0&&tt(()=>t[71].call(p)),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(h,"class","w-1/3"),u(E,"name","ili"),E.__value="true",E.value=E.__value,u(E,"type","checkbox"),u(E,"class","rounded mb-1"),u(A,"class","ml-4"),u(q,"name","ilp"),u(q,"type","number"),u(q,"min","0"),u(q,"max",t[6]),u(q,"class","in-l tr w-full"),u(R,"class","flex"),u(D,"class","w-1/3"),u(L,"name","iri"),L.__value="true",L.value=L.__value,u(L,"type","checkbox"),u(L,"class","rounded mb-1"),u(G,"class","ml-4"),u(de,"name","irr"),u(de,"type","number"),u(de,"min","0"),u(de,"max",t[6]),u(de,"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(O,"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(ve,"class","my-1 w-1/3"),u(he,"name","ita"),u(he,"type","number"),u(he,"min","0"),u(he,"max",t[6]),u(he,"class","in-l tr w-full"),u(Q,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(re,ge){y(re,e,ge),y(re,l,ge),y(re,n,ge),s(n,i),s(i,o),s(i,r),s(r,a),a.checked=t[3].i.h.u,s(r,f),s(i,c),s(i,_),s(i,p),X(d,p,null),Re(p,t[3].i.h.p,!0),s(n,v),s(n,h),s(h,g),s(h,k),s(h,C),s(h,T),V(T,t[3].i.a),s(n,P),s(n,D),s(D,S),s(D,A),s(A,E),E.checked=t[3].i.l.i,s(A,F),s(D,z),s(D,U),s(D,R),s(R,q),V(q,t[3].i.l.p),s(n,Y),s(n,O),s(O,H),s(O,G),s(G,L),L.checked=t[3].i.r.i,s(G,W),s(O,j),s(O,ee),s(O,le),s(le,de),V(de,t[3].i.r.r),s(le,ie),s(le,we),V(we,t[3].i.r.g),s(le,Ie),s(le,Ce),V(Ce,t[3].i.r.b),s(n,Ee),s(n,ve),s(ve,Pe),s(ve,Ae),s(ve,me),s(ve,se),V(se,t[3].i.t.d),s(n,pe),s(n,Q),s(Q,oe),s(Q,Ne),s(Q,Me),s(Q,he),V(he,t[3].i.t.a),s(n,x),Fe&&Fe.m(n,null),s(n,_e),je&&je.m(n,null),Le=!0,We||(Ke=[K(a,"change",t[70]),K(p,"change",t[71]),K(T,"input",t[72]),K(E,"change",t[73]),K(q,"input",t[74]),K(L,"change",t[75]),K(de,"input",t[76]),K(we,"input",t[77]),K(Ce,"input",t[78]),K(se,"input",t[79]),K(he,"input",t[80])],We=!0)},p(re,ge){ge[0]&8&&(a.checked=re[3].i.h.u);const Lt={};ge[0]&1&&(Lt.chip=re[0].chip),d.$set(Lt),ge[0]&8&&Re(p,re[3].i.h.p),(!Le||ge[0]&64)&&u(T,"max",re[6]),ge[0]&8&&ae(T.value)!==re[3].i.a&&V(T,re[3].i.a),ge[0]&8&&(E.checked=re[3].i.l.i),(!Le||ge[0]&64)&&u(q,"max",re[6]),ge[0]&8&&ae(q.value)!==re[3].i.l.p&&V(q,re[3].i.l.p),ge[0]&8&&(L.checked=re[3].i.r.i),(!Le||ge[0]&64)&&u(de,"max",re[6]),ge[0]&8&&ae(de.value)!==re[3].i.r.r&&V(de,re[3].i.r.r),(!Le||ge[0]&64)&&u(we,"max",re[6]),ge[0]&8&&ae(we.value)!==re[3].i.r.g&&V(we,re[3].i.r.g),(!Le||ge[0]&64)&&u(Ce,"max",re[6]),ge[0]&8&&ae(Ce.value)!==re[3].i.r.b&&V(Ce,re[3].i.r.b),(!Le||ge[0]&64)&&u(se,"max",re[6]),ge[0]&8&&ae(se.value)!==re[3].i.t.d&&V(se,re[3].i.t.d),(!Le||ge[0]&64)&&u(he,"max",re[6]),ge[0]&8&&ae(he.value)!==re[3].i.t.a&&V(he,re[3].i.t.a),re[0].chip!="esp8266"?Fe?Fe.p(re,ge):(Fe=af(re),Fe.c(),Fe.m(n,_e)):Fe&&(Fe.d(1),Fe=null),re[3].i.v.p>0?je?je.p(re,ge):(je=ff(re),je.c(),je.m(n,null)):je&&(je.d(1),je=null)},i(re){Le||(N(d.$$.fragment,re),Le=!0)},o(re){I(d.$$.fragment,re),Le=!1},d(re){re&&w(e),re&&w(l),re&&w(n),Z(d),Fe&&Fe.d(),je&&je.d(),We=!1,Ve(Ke)}}}function af(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=$("Vcc"),n=m("br"),i=b(),o=m("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(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].i.v.p),r||(a=K(o,"input",t[81]),r=!0)},p(f,c){c[0]&64&&u(o,"max",f[6]),c[0]&8&&ae(o.value)!==f[3].i.v.p&&V(o,f[3].i.v.p)},d(f){f&&w(e),r=!1,a()}}}function ff(t){let e,l,n,i,o,r,a,f,c,_;return{c(){e=m("div"),l=$("Voltage divider"),n=m("br"),i=b(),o=m("div"),r=m("input"),a=b(),f=m("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(f,"name","ivdg"),u(f,"type","number"),u(f,"min","0"),u(f,"max","65535"),u(f,"class","in-l tr w-full"),u(f,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(p,d){y(p,e,d),s(e,l),s(e,n),s(e,i),s(e,o),s(o,r),V(r,t[3].i.v.d.v),s(o,a),s(o,f),V(f,t[3].i.v.d.g),c||(_=[K(r,"input",t[82]),K(f,"input",t[83])],c=!0)},p(p,d){d[0]&8&&ae(r.value)!==p[3].i.v.d.v&&V(r,p[3].i.v.d.v),d[0]&8&&ae(f.value)!==p[3].i.v.d.g&&V(f,p[3].i.v.d.g)},d(p){p&&w(e),c=!1,Ve(_)}}}function cf(t){let e,l,n,i,o,r,a,f,c,_,p,d,v,h,g,k,C,T=(t[0].board==2||t[0].board==100)&&mf(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=$("Vcc offset"),r=m("br"),a=b(),f=m("input"),c=b(),_=m("div"),p=$("Multiplier"),d=m("br"),v=b(),h=m("input"),g=b(),T&&T.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(f,"name","ivo"),u(f,"type","number"),u(f,"min","0.0"),u(f,"max","3.5"),u(f,"step","0.01"),u(f,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(h,"name","ivm"),u(h,"type","number"),u(h,"min","0.1"),u(h,"max","10"),u(h,"step","0.01"),u(h,"class","in-l tr w-full"),u(_,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(P,D){y(P,e,D),y(P,l,D),y(P,n,D),s(n,i),s(i,o),s(i,r),s(i,a),s(i,f),V(f,t[3].i.v.o),s(n,c),s(n,_),s(_,p),s(_,d),s(_,v),s(_,h),V(h,t[3].i.v.m),s(n,g),T&&T.m(n,null),k||(C=[K(f,"input",t[84]),K(h,"input",t[85])],k=!0)},p(P,D){D[0]&8&&ae(f.value)!==P[3].i.v.o&&V(f,P[3].i.v.o),D[0]&8&&ae(h.value)!==P[3].i.v.m&&V(h,P[3].i.v.m),P[0].board==2||P[0].board==100?T?T.p(P,D):(T=mf(P),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(P){P&&w(e),P&&w(l),P&&w(n),T&&T.d(),k=!1,Ve(C)}}}function mf(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=$("Boot limit"),n=m("br"),i=b(),o=m("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(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].i.v.b),r||(a=K(o,"input",t[86]),r=!0)},p(f,c){c[0]&8&&ae(o.value)!==f[3].i.v.b&&V(o,f[3].i.v.b)},d(f){f&&w(e),r=!1,a()}}}function pf(t){let e,l,n,i,o,r,a,f,c,_,p,d,v,h,g,k,C=t[3].d.t&&_f();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=b(),n=m("div"),i=m("label"),o=m("input"),r=$(" Enable telnet"),a=b(),C&&C.c(),f=b(),c=m("div"),_=m("select"),p=m("option"),p.textContent="Verbose",d=m("option"),d.textContent="Debug",v=m("option"),v.textContent="Info",h=m("option"),h.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"),p.__value=1,p.value=p.__value,d.__value=2,d.value=d.__value,v.__value=3,v.value=v.__value,h.__value=4,h.value=h.__value,u(_,"name","dl"),u(_,"class","in-s"),t[3].d.l===void 0&&tt(()=>t[89].call(_)),u(c,"class","my-1")},m(T,P){y(T,e,P),y(T,l,P),y(T,n,P),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,r),y(T,a,P),C&&C.m(T,P),y(T,f,P),y(T,c,P),s(c,_),s(_,p),s(_,d),s(_,v),s(_,h),Re(_,t[3].d.l,!0),g||(k=[K(o,"change",t[88]),K(_,"change",t[89])],g=!0)},p(T,P){P[0]&8&&(o.checked=T[3].d.t),T[3].d.t?C||(C=_f(),C.c(),C.m(f.parentNode,f)):C&&(C.d(1),C=null),P[0]&8&&Re(_,T[3].d.l)},d(T){T&&w(e),T&&w(l),T&&w(n),T&&w(a),C&&C.d(T),T&&w(f),T&&w(c),g=!1,Ve(k)}}}function _f(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Kp(t){let e,l,n,i,o,r,a,f,c,_,p,d,v,h,g,k,C,T,P,D,S,A,E,F,z,U,R,q,Y,O,H,G,L,W,j,ee,le,de,ie,we,Ie,Ce,Ee,ve,Pe,Ae,me,se,pe,Q,oe,Ne,Me,he,x,_e,Le,We,Ke,Fe,je,re,ge,Lt,Ll,Zt,ft,$l,al,Ut,dt,Qe,Xe,Ze,Ue,Je,Be,xe,et,ue,be,Si,fl,on,Tt,Pi,Ni,Mi,cl,Ai,Di,Ii,Oe,ml,Ot,Ul,Ei,Cl,He,un,vo,rn,an,ho,ui,bo,fn,gs,go,Tl,Jt,Sl,ko,Fi,wo,mt,Pl,yo,Ri,cn,mn,pn,_n,Li,$o,ri,qt,Co,To,Ol,So,Po,No,xt,dn,vn,Mo,hn,ql,Ao,Do,Io,bn,Ht,Eo,Ui,Fo,Hl,Ro,Lo,Uo,gn,jt,Oo,Oi,qo,ks,Ho,jl,qi,Wt,jo,Wo,Go,ws,Hi,Gt,Bo,Yo,zo,ct,ji,Vo,kn,wn,Ko,ai,Qo,Wl,Xo,Zo,Jo,pl,xo,Gl,eu,tu,lu,_l,nu,yn,Bl,iu,su,ou,At,$n,Cn,Tn,Sn,uu,Yl,ru,au,fu,Pn,Dt,cu,Wi,mu,Gi,Bi,Bt,pu,_u,rt,Yi,du,Nn,Mn,vu,zl,hu,bu,gu,Nl,el,An,Dn,ku,St,zi,Vi,wu,Pt,In,Ki,Qi,yu,ys,Xi,Zi,Yt,$u,Cu,fi,Tu,Ml,Su,ci,zt,Pu,Nu,Mu,Ji,dl,Au,ze,xi,Du,En,Fn,Iu,mi,Eu,tl,Fu,$s,Ru,Lu,Rn,vl,Uu,Vt,Ou,Cs,Vl,qu,Hu,ju,hl,Wu,Kl,Gu,Bu,Yu,bl,zu,Ln,Un,Vu,Ku,Qu,gl,Xu,On,Zu,Ju,xu,vt,qn,Hn,jn,Wn,Gn,Bn,er,Ql,tr,lr,nr,kl,ir,Ts,Ss,Ps=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Ns,ll,es,sr,Yn,zn,or,pi,ur,_i,rr,Ms,Nt,ts,ar,Vn,Kn,fr,di,cr,ls,ns,Kt,mr,pr,_r,Al,As,Qn,dr,is,Xn,vr,ss,Ds,Xl,Is,Zl,Es,Jl,Fs,xl,Qt,Rs,hr;a=new Et({}),F=new Ep({});let Ic=["NOK","SEK","DKK","EUR"],vi=[];for(let M=0;M<4;M+=1)vi[M]=Up(Lp(t,Ic,M));let ht=t[3].p.e&&t[0].chip!="esp8266"&&Va(t),bt=t[3].g.s>0&&Ka(t);an=new Et({});let Ec=[24,48,96,192,384,576,1152],hi=[];for(let M=0;M<7;M+=1)hi[M]=Op(Rp(t,Ec,M));let gt=t[3].m.e.e&&Qa(t),kt=t[3].m.e.e&&Xa(t),wt=t[3].m.m.e&&Za(t);wn=new Et({}),Mn=new Et({}),In=new Dc({});let yt=t[3].n.m=="static"&&Ja(t);Fn=new Et({});let $t=t[0].chip!="esp8266"&&xa(t),lt=t[3].q.s.e&&ef(t),nt=t[3].q.m==3&&tf(t),it=t[3].q.m==4&&lf(t),st=Ps&&nf(t);zn=new Et({});let Zn=t[7],pt=[];for(let M=0;M20||t[0].chip=="esp8266")&&uf(t);Kn=new Et({});let Ct=t[3].d.s&&pf(t);return Xl=new Mt({props:{active:t[1],message:"Loading configuration"}}),Zl=new Mt({props:{active:t[2],message:"Saving configuration"}}),Jl=new Mt({props:{active:t[4],message:"Performing factory reset"}}),xl=new Mt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=b(),r=m("a"),J(a.$$.fragment),f=b(),c=m("input"),_=b(),p=m("div"),d=m("div"),v=m("div"),h=$("Hostname"),g=m("br"),k=b(),C=m("input"),T=b(),P=m("div"),D=$("Time zone"),S=m("br"),A=b(),E=m("select"),J(F.$$.fragment),z=b(),U=m("input"),R=b(),q=m("div"),Y=m("div"),O=m("div"),H=$("Price region"),G=m("br"),L=b(),W=m("select"),j=m("optgroup"),ee=m("option"),ee.textContent="NO1",le=m("option"),le.textContent="NO2",de=m("option"),de.textContent="NO3",ie=m("option"),ie.textContent="NO4",we=m("option"),we.textContent="NO5",Ie=m("optgroup"),Ce=m("option"),Ce.textContent="SE1",Ee=m("option"),Ee.textContent="SE2",ve=m("option"),ve.textContent="SE3",Pe=m("option"),Pe.textContent="SE4",Ae=m("optgroup"),me=m("option"),me.textContent="DK1",se=m("option"),se.textContent="DK2",pe=m("option"),pe.textContent="Austria",Q=m("option"),Q.textContent="Belgium",oe=m("option"),oe.textContent="Czech Republic",Ne=m("option"),Ne.textContent="Estonia",Me=m("option"),Me.textContent="Finland",he=m("option"),he.textContent="France",x=m("option"),x.textContent="Germany",_e=m("option"),_e.textContent="Great Britain",Le=m("option"),Le.textContent="Latvia",We=m("option"),We.textContent="Lithuania",Ke=m("option"),Ke.textContent="Netherland",Fe=m("option"),Fe.textContent="Poland",je=m("option"),je.textContent="Switzerland",re=b(),ge=m("div"),Lt=$("Currency"),Ll=m("br"),Zt=b(),ft=m("select");for(let M=0;M<4;M+=1)vi[M].c();$l=b(),al=m("div"),Ut=m("div"),dt=m("div"),Qe=$("Fixed price"),Xe=m("br"),Ze=b(),Ue=m("input"),Je=b(),Be=m("div"),xe=$("Multiplier"),et=m("br"),ue=b(),be=m("input"),Si=b(),fl=m("div"),on=m("label"),Tt=m("input"),Pi=$(" Enable price fetch from remote server"),Ni=b(),ht&&ht.c(),Mi=b(),cl=m("div"),Ai=$("Security"),Di=m("br"),Ii=b(),Oe=m("select"),ml=m("option"),ml.textContent="None",Ot=m("option"),Ot.textContent="Only configuration",Ul=m("option"),Ul.textContent="Everything",Ei=b(),bt&&bt.c(),Cl=b(),He=m("div"),un=m("strong"),un.textContent="Meter",vo=b(),rn=m("a"),J(an.$$.fragment),ho=b(),ui=m("input"),bo=b(),fn=m("div"),gs=m("span"),gs.textContent="Serial configuration",go=b(),Tl=m("div"),Jt=m("select"),Sl=m("option"),ko=$("Autodetect");for(let M=0;M<7;M+=1)hi[M].c();wo=b(),mt=m("select"),Pl=m("option"),yo=$("-"),cn=m("option"),cn.textContent="7N1",mn=m("option"),mn.textContent="8N1",pn=m("option"),pn.textContent="7E1",_n=m("option"),_n.textContent="8E1",$o=b(),ri=m("label"),qt=m("input"),Co=$(" inverted"),To=b(),Ol=m("div"),So=$("Voltage"),Po=m("br"),No=b(),xt=m("select"),dn=m("option"),dn.textContent="400V (TN)",vn=m("option"),vn.textContent="230V (IT/TT)",Mo=b(),hn=m("div"),ql=m("div"),Ao=$("Main fuse"),Do=m("br"),Io=b(),bn=m("label"),Ht=m("input"),Eo=b(),Ui=m("span"),Ui.textContent="A",Fo=b(),Hl=m("div"),Ro=$("Production"),Lo=m("br"),Uo=b(),gn=m("label"),jt=m("input"),Oo=b(),Oi=m("span"),Oi.textContent="kWp",qo=b(),ks=m("div"),Ho=b(),jl=m("div"),qi=m("label"),Wt=m("input"),jo=$(" Meter is encrypted"),Wo=b(),gt&>.c(),Go=b(),kt&&kt.c(),ws=b(),Hi=m("label"),Gt=m("input"),Bo=$(" Multipliers"),Yo=b(),wt&&wt.c(),zo=b(),ct=m("div"),ji=m("strong"),ji.textContent="WiFi",Vo=b(),kn=m("a"),J(wn.$$.fragment),Ko=b(),ai=m("input"),Qo=b(),Wl=m("div"),Xo=$("SSID"),Zo=m("br"),Jo=b(),pl=m("input"),xo=b(),Gl=m("div"),eu=$("Password"),tu=m("br"),lu=b(),_l=m("input"),nu=b(),yn=m("div"),Bl=m("div"),iu=$("Power saving"),su=m("br"),ou=b(),At=m("select"),$n=m("option"),$n.textContent="Default",Cn=m("option"),Cn.textContent="Off",Tn=m("option"),Tn.textContent="Minimum",Sn=m("option"),Sn.textContent="Maximum",uu=b(),Yl=m("div"),ru=$("Power"),au=m("br"),fu=b(),Pn=m("div"),Dt=m("input"),cu=b(),Wi=m("span"),Wi.textContent="dBm",mu=b(),Gi=m("div"),Bi=m("label"),Bt=m("input"),pu=$(" Auto reboot on connection problem"),_u=b(),rt=m("div"),Yi=m("strong"),Yi.textContent="Network",du=b(),Nn=m("a"),J(Mn.$$.fragment),vu=b(),zl=m("div"),hu=$("IP"),bu=m("br"),gu=b(),Nl=m("div"),el=m("select"),An=m("option"),An.textContent="DHCP",Dn=m("option"),Dn.textContent="Static",ku=b(),St=m("input"),wu=b(),Pt=m("select"),J(In.$$.fragment),yu=b(),yt&&yt.c(),ys=b(),Xi=m("div"),Zi=m("label"),Yt=m("input"),$u=$(" enable mDNS"),Cu=b(),fi=m("input"),Tu=b(),Ml=m("div"),Su=$("NTP "),ci=m("label"),zt=m("input"),Pu=$(" obtain from DHCP"),Nu=m("br"),Mu=b(),Ji=m("div"),dl=m("input"),Au=b(),ze=m("div"),xi=m("strong"),xi.textContent="MQTT",Du=b(),En=m("a"),J(Fn.$$.fragment),Iu=b(),mi=m("input"),Eu=b(),tl=m("div"),Fu=$(`Server `),$t&&$t.c(),$s=b(),Ru=m("br"),Lu=b(),Rn=m("div"),vl=m("input"),Uu=b(),Vt=m("input"),Ou=b(),lt&<.c(),Cs=b(),Vl=m("div"),qu=$("Username"),Hu=m("br"),ju=b(),hl=m("input"),Wu=b(),Kl=m("div"),Gu=$("Password"),Bu=m("br"),Yu=b(),bl=m("input"),zu=b(),Ln=m("div"),Un=m("div"),Vu=$("Client ID"),Ku=m("br"),Qu=b(),gl=m("input"),Xu=b(),On=m("div"),Zu=$("Payload"),Ju=m("br"),xu=b(),vt=m("select"),qn=m("option"),qn.textContent="JSON",Hn=m("option"),Hn.textContent="Raw (minimal)",jn=m("option"),jn.textContent="Raw (full)",Wn=m("option"),Wn.textContent="Domoticz",Gn=m("option"),Gn.textContent="HomeAssistant",Bn=m("option"),Bn.textContent="HEX dump",er=b(),Ql=m("div"),tr=$("Publish topic"),lr=m("br"),nr=b(),kl=m("input"),ir=b(),nt&&nt.c(),Ts=b(),it&&it.c(),Ss=b(),st&&st.c(),Ns=b(),ll=m("div"),es=m("strong"),es.textContent="User interface",sr=b(),Yn=m("a"),J(zn.$$.fragment),or=b(),pi=m("input"),ur=b(),_i=m("div");for(let M=0;MSave',Ds=b(),J(Xl.$$.fragment),Is=b(),J(Zl.$$.fragment),Es=b(),J(Jl.$$.fragment),Fs=b(),J(xl.$$.fragment),u(i,"class","text-sm"),u(r,"href",Ft("General-configuration")),u(r,"target","_blank"),u(r,"class","float-right"),u(c,"type","hidden"),u(c,"name","g"),c.value="true",u(C,"name","gh"),u(C,"type","text"),u(C,"class","in-f w-full"),u(C,"pattern","[A-Za-z0-9-]+"),u(E,"name","gt"),u(E,"class","in-l w-full"),t[3].g.t===void 0&&tt(()=>t[13].call(E)),u(d,"class","flex"),u(p,"class","my-1"),u(U,"type","hidden"),u(U,"name","p"),U.value="true",ee.__value="10YNO-1--------2",ee.value=ee.__value,le.__value="10YNO-2--------T",le.value=le.__value,de.__value="10YNO-3--------J",de.value=de.__value,ie.__value="10YNO-4--------9",ie.value=ie.__value,we.__value="10Y1001A1001A48H",we.value=we.__value,u(j,"label","Norway"),Ce.__value="10Y1001A1001A44P",Ce.value=Ce.__value,Ee.__value="10Y1001A1001A45N",Ee.value=Ee.__value,ve.__value="10Y1001A1001A46L",ve.value=ve.__value,Pe.__value="10Y1001A1001A47J",Pe.value=Pe.__value,u(Ie,"label","Sweden"),me.__value="10YDK-1--------W",me.value=me.__value,se.__value="10YDK-2--------M",se.value=se.__value,u(Ae,"label","Denmark"),pe.__value="10YAT-APG------L",pe.value=pe.__value,Q.__value="10YBE----------2",Q.value=Q.__value,oe.__value="10YCZ-CEPS-----N",oe.value=oe.__value,Ne.__value="10Y1001A1001A39I",Ne.value=Ne.__value,Me.__value="10YFI-1--------U",Me.value=Me.__value,he.__value="10YFR-RTE------C",he.value=he.__value,x.__value="10Y1001A1001A83F",x.value=x.__value,_e.__value="10YGB----------A",_e.value=_e.__value,Le.__value="10YLV-1001A00074",Le.value=Le.__value,We.__value="10YLT-1001A0008Q",We.value=We.__value,Ke.__value="10YNL----------L",Ke.value=Ke.__value,Fe.__value="10YPL-AREA-----S",Fe.value=Fe.__value,je.__value="10YCH-SWISSGRIDZ",je.value=je.__value,u(W,"name","pr"),u(W,"class","in-f w-full"),t[3].p.r===void 0&&tt(()=>t[14].call(W)),u(O,"class","w-full"),u(ft,"name","pc"),u(ft,"class","in-l"),t[3].p.c===void 0&&tt(()=>t[15].call(ft)),u(Y,"class","flex"),u(q,"class","my-1"),u(Ue,"name","pf"),u(Ue,"type","number"),u(Ue,"min","0.001"),u(Ue,"max","65"),u(Ue,"step","0.001"),u(Ue,"class","in-f tr w-full"),u(dt,"class","w-1/2"),u(be,"name","pm"),u(be,"type","number"),u(be,"min","0.001"),u(be,"max","1000"),u(be,"step","0.001"),u(be,"class","in-l tr w-full"),u(Be,"class","w-1/2"),u(Ut,"class","flex"),u(al,"class","my-1"),u(Tt,"type","checkbox"),u(Tt,"name","pe"),Tt.__value="true",Tt.value=Tt.__value,u(Tt,"class","rounded mb-1"),u(fl,"class","my-1"),ml.__value=0,ml.value=ml.__value,Ot.__value=1,Ot.value=Ot.__value,Ul.__value=2,Ul.value=Ul.__value,u(Oe,"name","gs"),u(Oe,"class","in-s"),t[3].g.s===void 0&&tt(()=>t[20].call(Oe)),u(cl,"class","my-1"),u(n,"class","cnt"),u(un,"class","text-sm"),u(rn,"href",Ft("Meter-configuration")),u(rn,"target","_blank"),u(rn,"class","float-right"),u(ui,"type","hidden"),u(ui,"name","m"),ui.value="true",Sl.__value=0,Sl.value=Sl.__value,Sl.disabled=Fi=t[3].m.b!=0,u(Jt,"name","mb"),u(Jt,"class","in-f"),t[3].m.b===void 0&&tt(()=>t[23].call(Jt)),Pl.__value=0,Pl.value=Pl.__value,Pl.disabled=Ri=t[3].m.b!=0,cn.__value=2,cn.value=cn.__value,mn.__value=3,mn.value=mn.__value,pn.__value=10,pn.value=pn.__value,_n.__value=11,_n.value=_n.__value,u(mt,"name","mp"),u(mt,"class","in-l"),mt.disabled=Li=t[3].m.b==0,t[3].m.p===void 0&&tt(()=>t[24].call(mt)),u(qt,"name","mi"),qt.__value="true",qt.value=qt.__value,u(qt,"type","checkbox"),u(qt,"class","rounded mb-1"),u(ri,"class","mt-2 ml-3 whitespace-nowrap"),u(Tl,"class","flex"),u(fn,"class","my-1"),dn.__value=2,dn.value=dn.__value,vn.__value=1,vn.value=vn.__value,u(xt,"name","md"),u(xt,"class","in-s"),t[3].m.d===void 0&&tt(()=>t[26].call(xt)),u(Ol,"class","my-1"),u(Ht,"name","mf"),u(Ht,"type","number"),u(Ht,"min","5"),u(Ht,"max","65535"),u(Ht,"class","in-f tr w-full"),u(Ui,"class","in-post"),u(bn,"class","flex"),u(ql,"class","mx-1"),u(jt,"name","mr"),u(jt,"type","number"),u(jt,"min","0"),u(jt,"max","65535"),u(jt,"class","in-f tr w-full"),u(Oi,"class","in-post"),u(gn,"class","flex"),u(Hl,"class","mx-1"),u(hn,"class","my-1 flex"),u(ks,"class","my-1"),u(Wt,"type","checkbox"),u(Wt,"name","me"),Wt.__value="true",Wt.value=Wt.__value,u(Wt,"class","rounded mb-1"),u(jl,"class","my-1"),u(Gt,"type","checkbox"),u(Gt,"name","mm"),Gt.__value="true",Gt.value=Gt.__value,u(Gt,"class","rounded mb-1"),u(He,"class","cnt"),u(ji,"class","text-sm"),u(kn,"href",Ft("WiFi-configuration")),u(kn,"target","_blank"),u(kn,"class","float-right"),u(ai,"type","hidden"),u(ai,"name","w"),ai.value="true",u(pl,"name","ws"),u(pl,"type","text"),u(pl,"class","in-s"),u(Wl,"class","my-1"),u(_l,"name","wp"),u(_l,"type","password"),u(_l,"class","in-s"),u(Gl,"class","my-1"),$n.__value=255,$n.value=$n.__value,Cn.__value=0,Cn.value=Cn.__value,Tn.__value=1,Tn.value=Tn.__value,Sn.__value=2,Sn.value=Sn.__value,u(At,"name","wz"),u(At,"class","in-s"),t[3].w.z===void 0&&tt(()=>t[39].call(At)),u(Bl,"class","w-1/2"),u(Dt,"name","ww"),u(Dt,"type","number"),u(Dt,"min","0"),u(Dt,"max","20.5"),u(Dt,"step","0.5"),u(Dt,"class","in-f tr w-full"),u(Wi,"class","in-post"),u(Pn,"class","flex"),u(Yl,"class","ml-2 w-1/2"),u(yn,"class","my-1 flex"),u(Bt,"type","checkbox"),u(Bt,"name","wa"),Bt.__value="true",Bt.value=Bt.__value,u(Bt,"class","rounded mb-1"),u(Gi,"class","my-3"),u(ct,"class","cnt"),u(Yi,"class","text-sm"),u(Nn,"href",Ft("Network-configuration")),u(Nn,"target","_blank"),u(Nn,"class","float-right"),An.__value="dhcp",An.value=An.__value,Dn.__value="static",Dn.value=Dn.__value,u(el,"name","nm"),u(el,"class","in-f"),t[3].n.m===void 0&&tt(()=>t[42].call(el)),u(St,"name","ni"),u(St,"type","text"),u(St,"class","in-m w-full"),St.disabled=zi=t[3].n.m=="dhcp",St.required=Vi=t[3].n.m=="static",u(Pt,"name","ns"),u(Pt,"class","in-l"),Pt.disabled=Ki=t[3].n.m=="dhcp",Pt.required=Qi=t[3].n.m=="static",t[3].n.s===void 0&&tt(()=>t[44].call(Pt)),u(Nl,"class","flex"),u(zl,"class","my-1"),u(Yt,"name","nd"),Yt.__value="true",Yt.value=Yt.__value,u(Yt,"type","checkbox"),u(Yt,"class","rounded mb-1"),u(Xi,"class","my-1"),u(fi,"type","hidden"),u(fi,"name","ntp"),fi.value="true",u(zt,"name","ntpd"),zt.__value="true",zt.value=zt.__value,u(zt,"type","checkbox"),u(zt,"class","rounded mb-1"),u(ci,"class","ml-4"),u(dl,"name","ntph"),u(dl,"type","text"),u(dl,"class","in-s"),u(Ji,"class","flex"),u(Ml,"class","my-1"),u(rt,"class","cnt"),u(xi,"class","text-sm"),u(En,"href",Ft("MQTT-configuration")),u(En,"target","_blank"),u(En,"class","float-right"),u(mi,"type","hidden"),u(mi,"name","q"),mi.value="true",u(vl,"name","qh"),u(vl,"type","text"),u(vl,"class","in-f w-3/4"),u(Vt,"name","qp"),u(Vt,"type","number"),u(Vt,"min","1024"),u(Vt,"max","65535"),u(Vt,"class","in-l tr w-1/4"),u(Rn,"class","flex"),u(tl,"class","my-1"),u(hl,"name","qu"),u(hl,"type","text"),u(hl,"class","in-s"),u(Vl,"class","my-1"),u(bl,"name","qa"),u(bl,"type","password"),u(bl,"class","in-s"),u(Kl,"class","my-1"),u(gl,"name","qc"),u(gl,"type","text"),u(gl,"class","in-f w-full"),qn.__value=0,qn.value=qn.__value,Hn.__value=1,Hn.value=Hn.__value,jn.__value=2,jn.value=jn.__value,Wn.__value=3,Wn.value=Wn.__value,Gn.__value=4,Gn.value=Gn.__value,Bn.__value=255,Bn.value=Bn.__value,u(vt,"name","qm"),u(vt,"class","in-l"),t[3].q.m===void 0&&tt(()=>t[57].call(vt)),u(Ln,"class","my-1 flex"),u(kl,"name","qb"),u(kl,"type","text"),u(kl,"class","in-s"),u(Ql,"class","my-1"),u(ze,"class","cnt"),u(es,"class","text-sm"),u(Yn,"href",Ft("User-interface")),u(Yn,"target","_blank"),u(Yn,"class","float-right"),u(pi,"type","hidden"),u(pi,"name","u"),pi.value="true",u(_i,"class","flex flex-wrap"),u(ll,"class","cnt"),u(ts,"class","text-sm"),u(Vn,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(Vn,"target","_blank"),u(Vn,"class","float-right"),u(di,"type","hidden"),u(di,"name","d"),di.value="true",u(Kt,"type","checkbox"),u(Kt,"name","ds"),Kt.__value="true",Kt.value=Kt.__value,u(Kt,"class","rounded mb-1"),u(ls,"class","mt-3"),u(Nt,"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(Xn,"type","button"),u(Xn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(is,"class","text-center"),u(ss,"class","text-right"),u(Al,"class","grid grid-cols-3"),u(e,"autocomplete","off")},m(M,te){y(M,e,te),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),X(a,r,null),s(n,f),s(n,c),s(n,_),s(n,p),s(p,d),s(d,v),s(v,h),s(v,g),s(v,k),s(v,C),V(C,t[3].g.h),s(d,T),s(d,P),s(P,D),s(P,S),s(P,A),s(P,E),X(F,E,null),Re(E,t[3].g.t,!0),s(n,z),s(n,U),s(n,R),s(n,q),s(q,Y),s(Y,O),s(O,H),s(O,G),s(O,L),s(O,W),s(W,j),s(j,ee),s(j,le),s(j,de),s(j,ie),s(j,we),s(W,Ie),s(Ie,Ce),s(Ie,Ee),s(Ie,ve),s(Ie,Pe),s(W,Ae),s(Ae,me),s(Ae,se),s(W,pe),s(W,Q),s(W,oe),s(W,Ne),s(W,Me),s(W,he),s(W,x),s(W,_e),s(W,Le),s(W,We),s(W,Ke),s(W,Fe),s(W,je),Re(W,t[3].p.r,!0),s(Y,re),s(Y,ge),s(ge,Lt),s(ge,Ll),s(ge,Zt),s(ge,ft);for(let at=0;at<4;at+=1)vi[at]&&vi[at].m(ft,null);Re(ft,t[3].p.c,!0),s(n,$l),s(n,al),s(al,Ut),s(Ut,dt),s(dt,Qe),s(dt,Xe),s(dt,Ze),s(dt,Ue),V(Ue,t[3].p.f),s(Ut,Je),s(Ut,Be),s(Be,xe),s(Be,et),s(Be,ue),s(Be,be),V(be,t[3].p.m),s(n,Si),s(n,fl),s(fl,on),s(on,Tt),Tt.checked=t[3].p.e,s(on,Pi),s(fl,Ni),ht&&ht.m(fl,null),s(n,Mi),s(n,cl),s(cl,Ai),s(cl,Di),s(cl,Ii),s(cl,Oe),s(Oe,ml),s(Oe,Ot),s(Oe,Ul),Re(Oe,t[3].g.s,!0),s(n,Ei),bt&&bt.m(n,null),s(l,Cl),s(l,He),s(He,un),s(He,vo),s(He,rn),X(an,rn,null),s(He,ho),s(He,ui),s(He,bo),s(He,fn),s(fn,gs),s(fn,go),s(fn,Tl),s(Tl,Jt),s(Jt,Sl),s(Sl,ko);for(let at=0;at<7;at+=1)hi[at]&&hi[at].m(Jt,null);Re(Jt,t[3].m.b,!0),s(Tl,wo),s(Tl,mt),s(mt,Pl),s(Pl,yo),s(mt,cn),s(mt,mn),s(mt,pn),s(mt,_n),Re(mt,t[3].m.p,!0),s(Tl,$o),s(Tl,ri),s(ri,qt),qt.checked=t[3].m.i,s(ri,Co),s(He,To),s(He,Ol),s(Ol,So),s(Ol,Po),s(Ol,No),s(Ol,xt),s(xt,dn),s(xt,vn),Re(xt,t[3].m.d,!0),s(He,Mo),s(He,hn),s(hn,ql),s(ql,Ao),s(ql,Do),s(ql,Io),s(ql,bn),s(bn,Ht),V(Ht,t[3].m.f),s(bn,Eo),s(bn,Ui),s(hn,Fo),s(hn,Hl),s(Hl,Ro),s(Hl,Lo),s(Hl,Uo),s(Hl,gn),s(gn,jt),V(jt,t[3].m.r),s(gn,Oo),s(gn,Oi),s(He,qo),s(He,ks),s(He,Ho),s(He,jl),s(jl,qi),s(qi,Wt),Wt.checked=t[3].m.e.e,s(qi,jo),s(jl,Wo),gt&>.m(jl,null),s(He,Go),kt&&kt.m(He,null),s(He,ws),s(He,Hi),s(Hi,Gt),Gt.checked=t[3].m.m.e,s(Hi,Bo),s(He,Yo),wt&&wt.m(He,null),s(l,zo),s(l,ct),s(ct,ji),s(ct,Vo),s(ct,kn),X(wn,kn,null),s(ct,Ko),s(ct,ai),s(ct,Qo),s(ct,Wl),s(Wl,Xo),s(Wl,Zo),s(Wl,Jo),s(Wl,pl),V(pl,t[3].w.s),s(ct,xo),s(ct,Gl),s(Gl,eu),s(Gl,tu),s(Gl,lu),s(Gl,_l),V(_l,t[3].w.p),s(ct,nu),s(ct,yn),s(yn,Bl),s(Bl,iu),s(Bl,su),s(Bl,ou),s(Bl,At),s(At,$n),s(At,Cn),s(At,Tn),s(At,Sn),Re(At,t[3].w.z,!0),s(yn,uu),s(yn,Yl),s(Yl,ru),s(Yl,au),s(Yl,fu),s(Yl,Pn),s(Pn,Dt),V(Dt,t[3].w.w),s(Pn,cu),s(Pn,Wi),s(ct,mu),s(ct,Gi),s(Gi,Bi),s(Bi,Bt),Bt.checked=t[3].w.a,s(Bi,pu),s(l,_u),s(l,rt),s(rt,Yi),s(rt,du),s(rt,Nn),X(Mn,Nn,null),s(rt,vu),s(rt,zl),s(zl,hu),s(zl,bu),s(zl,gu),s(zl,Nl),s(Nl,el),s(el,An),s(el,Dn),Re(el,t[3].n.m,!0),s(Nl,ku),s(Nl,St),V(St,t[3].n.i),s(Nl,wu),s(Nl,Pt),X(In,Pt,null),Re(Pt,t[3].n.s,!0),s(rt,yu),yt&&yt.m(rt,null),s(rt,ys),s(rt,Xi),s(Xi,Zi),s(Zi,Yt),Yt.checked=t[3].n.d,s(Zi,$u),s(rt,Cu),s(rt,fi),s(rt,Tu),s(rt,Ml),s(Ml,Su),s(Ml,ci),s(ci,zt),zt.checked=t[3].n.h,s(ci,Pu),s(Ml,Nu),s(Ml,Mu),s(Ml,Ji),s(Ji,dl),V(dl,t[3].n.n1),s(l,Au),s(l,ze),s(ze,xi),s(ze,Du),s(ze,En),X(Fn,En,null),s(ze,Iu),s(ze,mi),s(ze,Eu),s(ze,tl),s(tl,Fu),$t&&$t.m(tl,null),s(tl,$s),s(tl,Ru),s(tl,Lu),s(tl,Rn),s(Rn,vl),V(vl,t[3].q.h),s(Rn,Uu),s(Rn,Vt),V(Vt,t[3].q.p),s(ze,Ou),lt&<.m(ze,null),s(ze,Cs),s(ze,Vl),s(Vl,qu),s(Vl,Hu),s(Vl,ju),s(Vl,hl),V(hl,t[3].q.u),s(ze,Wu),s(ze,Kl),s(Kl,Gu),s(Kl,Bu),s(Kl,Yu),s(Kl,bl),V(bl,t[3].q.a),s(ze,zu),s(ze,Ln),s(Ln,Un),s(Un,Vu),s(Un,Ku),s(Un,Qu),s(Un,gl),V(gl,t[3].q.c),s(Ln,Xu),s(Ln,On),s(On,Zu),s(On,Ju),s(On,xu),s(On,vt),s(vt,qn),s(vt,Hn),s(vt,jn),s(vt,Wn),s(vt,Gn),s(vt,Bn),Re(vt,t[3].q.m,!0),s(ze,er),s(ze,Ql),s(Ql,tr),s(Ql,lr),s(Ql,nr),s(Ql,kl),V(kl,t[3].q.b),s(l,ir),nt&&nt.m(l,null),s(l,Ts),it&&it.m(l,null),s(l,Ss),st&&st.m(l,null),s(l,Ns),s(l,ll),s(ll,es),s(ll,sr),s(ll,Yn),X(zn,Yn,null),s(ll,or),s(ll,pi),s(ll,ur),s(ll,_i);for(let at=0;at0?bt?bt.p(M,te):(bt=Ka(M),bt.c(),bt.m(n,null)):bt&&(bt.d(1),bt=null),(!Qt||te[0]&8&&Fi!==(Fi=M[3].m.b!=0))&&(Sl.disabled=Fi),te[0]&8&&Re(Jt,M[3].m.b),(!Qt||te[0]&8&&Ri!==(Ri=M[3].m.b!=0))&&(Pl.disabled=Ri),(!Qt||te[0]&8&&Li!==(Li=M[3].m.b==0))&&(mt.disabled=Li),te[0]&8&&Re(mt,M[3].m.p),te[0]&8&&(qt.checked=M[3].m.i),te[0]&8&&Re(xt,M[3].m.d),te[0]&8&&ae(Ht.value)!==M[3].m.f&&V(Ht,M[3].m.f),te[0]&8&&ae(jt.value)!==M[3].m.r&&V(jt,M[3].m.r),te[0]&8&&(Wt.checked=M[3].m.e.e),M[3].m.e.e?gt?gt.p(M,te):(gt=Qa(M),gt.c(),gt.m(jl,null)):gt&&(gt.d(1),gt=null),M[3].m.e.e?kt?kt.p(M,te):(kt=Xa(M),kt.c(),kt.m(He,ws)):kt&&(kt.d(1),kt=null),te[0]&8&&(Gt.checked=M[3].m.m.e),M[3].m.m.e?wt?wt.p(M,te):(wt=Za(M),wt.c(),wt.m(He,null)):wt&&(wt.d(1),wt=null),te[0]&8&&pl.value!==M[3].w.s&&V(pl,M[3].w.s),te[0]&8&&_l.value!==M[3].w.p&&V(_l,M[3].w.p),te[0]&8&&Re(At,M[3].w.z),te[0]&8&&ae(Dt.value)!==M[3].w.w&&V(Dt,M[3].w.w),te[0]&8&&(Bt.checked=M[3].w.a),te[0]&8&&Re(el,M[3].n.m),(!Qt||te[0]&8&&zi!==(zi=M[3].n.m=="dhcp"))&&(St.disabled=zi),(!Qt||te[0]&8&&Vi!==(Vi=M[3].n.m=="static"))&&(St.required=Vi),te[0]&8&&St.value!==M[3].n.i&&V(St,M[3].n.i),(!Qt||te[0]&8&&Ki!==(Ki=M[3].n.m=="dhcp"))&&(Pt.disabled=Ki),(!Qt||te[0]&8&&Qi!==(Qi=M[3].n.m=="static"))&&(Pt.required=Qi),te[0]&8&&Re(Pt,M[3].n.s),M[3].n.m=="static"?yt?yt.p(M,te):(yt=Ja(M),yt.c(),yt.m(rt,ys)):yt&&(yt.d(1),yt=null),te[0]&8&&(Yt.checked=M[3].n.d),te[0]&8&&(zt.checked=M[3].n.h),te[0]&8&&dl.value!==M[3].n.n1&&V(dl,M[3].n.n1),M[0].chip!="esp8266"?$t?$t.p(M,te):($t=xa(M),$t.c(),$t.m(tl,$s)):$t&&($t.d(1),$t=null),te[0]&8&&vl.value!==M[3].q.h&&V(vl,M[3].q.h),te[0]&8&&ae(Vt.value)!==M[3].q.p&&V(Vt,M[3].q.p),M[3].q.s.e?lt?(lt.p(M,te),te[0]&8&&N(lt,1)):(lt=ef(M),lt.c(),N(lt,1),lt.m(ze,Cs)):lt&&(Te(),I(lt,1,1,()=>{lt=null}),Se()),te[0]&8&&hl.value!==M[3].q.u&&V(hl,M[3].q.u),te[0]&8&&bl.value!==M[3].q.a&&V(bl,M[3].q.a),te[0]&8&&gl.value!==M[3].q.c&&V(gl,M[3].q.c),te[0]&8&&Re(vt,M[3].q.m),te[0]&8&&kl.value!==M[3].q.b&&V(kl,M[3].q.b),M[3].q.m==3?nt?(nt.p(M,te),te[0]&8&&N(nt,1)):(nt=tf(M),nt.c(),N(nt,1),nt.m(l,Ts)):nt&&(Te(),I(nt,1,1,()=>{nt=null}),Se()),M[3].q.m==4?it?(it.p(M,te),te[0]&8&&N(it,1)):(it=lf(M),it.c(),N(it,1),it.m(l,Ss)):it&&(Te(),I(it,1,1,()=>{it=null}),Se()),te[0]&8&&(Ps=M[3].p.r.startsWith("10YNO")||M[3].p.r=="10Y1001A1001A48H"),Ps?st?(st.p(M,te),te[0]&8&&N(st,1)):(st=nf(M),st.c(),N(st,1),st.m(l,Ns)):st&&(Te(),I(st,1,1,()=>{st=null}),Se()),te[0]&136){Zn=M[7];let It;for(It=0;It20||M[0].chip=="esp8266"?ot?(ot.p(M,te),te[0]&1&&N(ot,1)):(ot=uf(M),ot.c(),N(ot,1),ot.m(l,Ms)):ot&&(Te(),I(ot,1,1,()=>{ot=null}),Se()),te[0]&8&&(Kt.checked=M[3].d.s),M[3].d.s?Ct?Ct.p(M,te):(Ct=pf(M),Ct.c(),Ct.m(Nt,null)):Ct&&(Ct.d(1),Ct=null);const at={};te[0]&2&&(at.active=M[1]),Xl.$set(at);const br={};te[0]&4&&(br.active=M[2]),Zl.$set(br);const gr={};te[0]&16&&(gr.active=M[4]),Jl.$set(gr);const kr={};te[0]&32&&(kr.active=M[5]),xl.$set(kr)},i(M){Qt||(N(a.$$.fragment,M),N(F.$$.fragment,M),N(an.$$.fragment,M),N(wn.$$.fragment,M),N(Mn.$$.fragment,M),N(In.$$.fragment,M),N(Fn.$$.fragment,M),N(lt),N(nt),N(it),N(st),N(zn.$$.fragment,M),N(ot),N(Kn.$$.fragment,M),N(Xl.$$.fragment,M),N(Zl.$$.fragment,M),N(Jl.$$.fragment,M),N(xl.$$.fragment,M),Qt=!0)},o(M){I(a.$$.fragment,M),I(F.$$.fragment,M),I(an.$$.fragment,M),I(wn.$$.fragment,M),I(Mn.$$.fragment,M),I(In.$$.fragment,M),I(Fn.$$.fragment,M),I(lt),I(nt),I(it),I(st),I(zn.$$.fragment,M),I(ot),I(Kn.$$.fragment,M),I(Xl.$$.fragment,M),I(Zl.$$.fragment,M),I(Jl.$$.fragment,M),I(xl.$$.fragment,M),Qt=!1},d(M){M&&w(e),Z(a),Z(F),ul(vi,M),ht&&ht.d(),bt&&bt.d(),Z(an),ul(hi,M),gt&>.d(),kt&&kt.d(),wt&&wt.d(),Z(wn),Z(Mn),Z(In),yt&&yt.d(),Z(Fn),$t&&$t.d(),lt&<.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),Z(zn),ul(pt,M),ot&&ot.d(),Z(Kn),Ct&&Ct.d(),M&&w(Ds),Z(Xl,M),M&&w(Is),Z(Zl,M),M&&w(Es),Z(Jl,M),M&&w(Fs),Z(xl,M),Rs=!1,Ve(hr)}}}async function Qp(){await(await fetch("/reboot",{method:"POST"})).json()}function Xp(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:""}};Mc.subscribe(Oe=>{Oe.version&&(l(3,a=Oe),l(1,o=!1))}),Cp();let f=!1,c=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,f=!0);const Oe=new URLSearchParams;Oe.append("perform","true");let Ot=await(await fetch("/reset",{method:"POST",body:Oe})).json();l(4,f=!1),l(5,c=Ot.success)}}async function p(Oe){l(2,r=!0);const ml=new FormData(Oe.target),Ot=new URLSearchParams;for(let Cl of ml){const[He,un]=Cl;Ot.append(He,un)}let Ei=await(await fetch("/save",{method:"POST",body:Ot})).json();Rt.update(Cl=>(Cl.booting=Ei.reboot,Cl.ui=a.u,Cl)),l(2,r=!1),li("/")}const d=function(){confirm("Are you sure you want to reboot the device?")&&(Rt.update(Oe=>(Oe.booting=!0,Oe)),Qp())},v=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 h=44;function g(){a.g.h=this.value,l(3,a)}function k(){a.g.t=_t(this),l(3,a)}function C(){a.p.r=_t(this),l(3,a)}function T(){a.p.c=_t(this),l(3,a)}function P(){a.p.f=ae(this.value),l(3,a)}function D(){a.p.m=ae(this.value),l(3,a)}function S(){a.p.e=this.checked,l(3,a)}function A(){a.p.t=this.value,l(3,a)}function E(){a.g.s=_t(this),l(3,a)}function F(){a.g.u=this.value,l(3,a)}function z(){a.g.p=this.value,l(3,a)}function U(){a.m.b=_t(this),l(3,a)}function R(){a.m.p=_t(this),l(3,a)}function q(){a.m.i=this.checked,l(3,a)}function Y(){a.m.d=_t(this),l(3,a)}function O(){a.m.f=ae(this.value),l(3,a)}function H(){a.m.r=ae(this.value),l(3,a)}function G(){a.m.e.e=this.checked,l(3,a)}function L(){a.m.e.k=this.value,l(3,a)}function W(){a.m.e.a=this.value,l(3,a)}function j(){a.m.m.e=this.checked,l(3,a)}function ee(){a.m.m.w=ae(this.value),l(3,a)}function le(){a.m.m.v=ae(this.value),l(3,a)}function de(){a.m.m.a=ae(this.value),l(3,a)}function ie(){a.m.m.c=ae(this.value),l(3,a)}function we(){a.w.s=this.value,l(3,a)}function Ie(){a.w.p=this.value,l(3,a)}function Ce(){a.w.z=_t(this),l(3,a)}function Ee(){a.w.w=ae(this.value),l(3,a)}function ve(){a.w.a=this.checked,l(3,a)}function Pe(){a.n.m=_t(this),l(3,a)}function Ae(){a.n.i=this.value,l(3,a)}function me(){a.n.s=_t(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 Q(){a.n.d2=this.value,l(3,a)}function oe(){a.n.d=this.checked,l(3,a)}function Ne(){a.n.h=this.checked,l(3,a)}function Me(){a.n.n1=this.value,l(3,a)}function he(){a.q.s.e=this.checked,l(3,a)}function x(){a.q.h=this.value,l(3,a)}function _e(){a.q.p=ae(this.value),l(3,a)}function Le(){a.q.u=this.value,l(3,a)}function We(){a.q.a=this.value,l(3,a)}function Ke(){a.q.c=this.value,l(3,a)}function Fe(){a.q.m=_t(this),l(3,a)}function je(){a.q.b=this.value,l(3,a)}function re(){a.o.e=this.value,l(3,a)}function ge(){a.o.c=this.value,l(3,a)}function Lt(){a.o.u1=this.value,l(3,a)}function Ll(){a.o.u2=this.value,l(3,a)}function Zt(){a.o.u3=this.value,l(3,a)}function ft(){a.h.t=this.value,l(3,a)}function $l(){a.h.h=this.value,l(3,a)}function al(){a.h.n=this.value,l(3,a)}function Ut(Oe){a.t.t[Oe]=ae(this.value),l(3,a)}function dt(){a.t.h=ae(this.value),l(3,a)}function Qe(Oe){a.u[Oe.key]=_t(this),l(3,a)}function Xe(){a.i.h.u=this.checked,l(3,a)}function Ze(){a.i.h.p=_t(this),l(3,a)}function Ue(){a.i.a=ae(this.value),l(3,a)}function Je(){a.i.l.i=this.checked,l(3,a)}function Be(){a.i.l.p=ae(this.value),l(3,a)}function xe(){a.i.r.i=this.checked,l(3,a)}function et(){a.i.r.r=ae(this.value),l(3,a)}function ue(){a.i.r.g=ae(this.value),l(3,a)}function be(){a.i.r.b=ae(this.value),l(3,a)}function Si(){a.i.t.d=ae(this.value),l(3,a)}function fl(){a.i.t.a=ae(this.value),l(3,a)}function on(){a.i.v.p=ae(this.value),l(3,a)}function Tt(){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 Ni(){a.i.v.o=ae(this.value),l(3,a)}function Mi(){a.i.v.m=ae(this.value),l(3,a)}function cl(){a.i.v.b=ae(this.value),l(3,a)}function Ai(){a.d.s=this.checked,l(3,a)}function Di(){a.d.t=this.checked,l(3,a)}function Ii(){a.d.l=_t(this),l(3,a)}return t.$$set=Oe=>{"sysinfo"in Oe&&l(0,n=Oe.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,h=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,r,a,f,c,h,i,_,p,d,v,g,k,C,T,P,D,S,A,E,F,z,U,R,q,Y,O,H,G,L,W,j,ee,le,de,ie,we,Ie,Ce,Ee,ve,Pe,Ae,me,se,pe,Q,oe,Ne,Me,he,x,_e,Le,We,Ke,Fe,je,re,ge,Lt,Ll,Zt,ft,$l,al,Ut,dt,Qe,Xe,Ze,Ue,Je,Be,xe,et,ue,be,Si,fl,on,Tt,Pi,Ni,Mi,cl,Ai,Di,Ii]}class Zp extends $e{constructor(e){super(),ye(this,e,Xp,Kp,ke,{sysinfo:0},null,[-1,-1,-1,-1])}}function df(t,e,l){const n=t.slice();return n[20]=e[l],n}function Jp(t){let e=fe(t[1].chip,t[1].board)+"",l;return{c(){l=$(e)},m(n,i){y(n,l,i)},p(n,i){i&2&&e!==(e=fe(n[1].chip,n[1].board)+"")&&B(l,e)},d(n){n&&w(l)}}}function vf(t){let e,l,n=t[1].apmac+"",i,o,r,a,f,c,_,p,d,v=Or(t[1])+"",h,g,k=t[1].boot_reason+"",C,T,P=t[1].ex_cause+"",D,S,A;const E=[e0,xp],F=[];function z(U,R){return U[0].u>0?0:1}return f=z(t),c=F[f]=E[f](t),{c(){e=m("div"),l=$("AP MAC: "),i=$(n),o=b(),r=m("div"),a=$(`Last boot: `),c.c(),_=b(),p=m("div"),d=$("Reason: "),h=$(v),g=$(" ("),C=$(k),T=$("/"),D=$(P),S=$(")"),u(e,"class","my-2"),u(r,"class","my-2"),u(p,"class","my-2")},m(U,R){y(U,e,R),s(e,l),s(e,i),y(U,o,R),y(U,r,R),s(r,a),F[f].m(r,null),y(U,_,R),y(U,p,R),s(p,d),s(p,h),s(p,g),s(p,C),s(p,T),s(p,D),s(p,S),A=!0},p(U,R){(!A||R&2)&&n!==(n=U[1].apmac+"")&&B(i,n);let q=f;f=z(U),f===q?F[f].p(U,R):(Te(),I(F[q],1,1,()=>{F[q]=null}),Se(),c=F[f],c?c.p(U,R):(c=F[f]=E[f](U),c.c()),N(c,1),c.m(r,null)),(!A||R&2)&&v!==(v=Or(U[1])+"")&&B(h,v),(!A||R&2)&&k!==(k=U[1].boot_reason+"")&&B(C,k),(!A||R&2)&&P!==(P=U[1].ex_cause+"")&&B(D,P)},i(U){A||(N(c),A=!0)},o(U){I(c),A=!1},d(U){U&&w(e),U&&w(o),U&&w(r),F[f].d(),U&&w(_),U&&w(p)}}}function xp(t){let e;return{c(){e=$("-")},m(l,n){y(l,e,n)},p:ne,i:ne,o:ne,d(l){l&&w(e)}}}function e0(t){let e,l;return e=new Sc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){J(e.$$.fragment)},m(n,i){X(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||(N(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function t0(t){let e;return{c(){e=m("span"),e.textContent="Update consents",u(e,"class","btn-pri-sm")},m(l,n){y(l,e,n)},p:ne,d(l){l&&w(e)}}}function hf(t){let e,l,n,i,o,r=ds(t[1].meter.mfg)+"",a,f,c,_,p=t[1].meter.model+"",d,v,h,g,k=t[1].meter.id+"",C;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=b(),i=m("div"),o=$("Manufacturer: "),a=$(r),f=b(),c=m("div"),_=$("Model: "),d=$(p),v=b(),h=m("div"),g=$("ID: "),C=$(k),u(l,"class","text-sm"),u(i,"class","my-2"),u(c,"class","my-2"),u(h,"class","my-2"),u(e,"class","cnt")},m(T,P){y(T,e,P),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,_),s(c,d),s(e,v),s(e,h),s(h,g),s(h,C)},p(T,P){P&2&&r!==(r=ds(T[1].meter.mfg)+"")&&B(a,r),P&2&&p!==(p=T[1].meter.model+"")&&B(d,p),P&2&&k!==(k=T[1].meter.id+"")&&B(C,k)},d(T){T&&w(e)}}}function bf(t){let e,l,n,i,o,r=t[1].net.ip+"",a,f,c,_,p=t[1].net.mask+"",d,v,h,g,k=t[1].net.gw+"",C,T,P,D,S=t[1].net.dns1+"",A,E,F=t[1].net.dns2&&gf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=b(),i=m("div"),o=$("IP: "),a=$(r),f=b(),c=m("div"),_=$("Mask: "),d=$(p),v=b(),h=m("div"),g=$("Gateway: "),C=$(k),T=b(),P=m("div"),D=$("DNS: "),A=$(S),E=b(),F&&F.c(),u(l,"class","text-sm"),u(i,"class","my-2"),u(c,"class","my-2"),u(h,"class","my-2"),u(P,"class","my-2"),u(e,"class","cnt")},m(z,U){y(z,e,U),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,_),s(c,d),s(e,v),s(e,h),s(h,g),s(h,C),s(e,T),s(e,P),s(P,D),s(P,A),s(P,E),F&&F.m(P,null)},p(z,U){U&2&&r!==(r=z[1].net.ip+"")&&B(a,r),U&2&&p!==(p=z[1].net.mask+"")&&B(d,p),U&2&&k!==(k=z[1].net.gw+"")&&B(C,k),U&2&&S!==(S=z[1].net.dns1+"")&&B(A,S),z[1].net.dns2?F?F.p(z,U):(F=gf(z),F.c(),F.m(P,null)):F&&(F.d(1),F=null)},d(z){z&&w(e),F&&F.d()}}}function gf(t){let e,l=t[1].net.dns2+"",n;return{c(){e=$("/ "),n=$(l)},m(i,o){y(i,e,o),y(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&B(n,l)},d(i){i&&w(e),i&&w(n)}}}function kf(t){let e,l,n,i=t[1].upgrade.t+"",o,r,a=t[1].version+"",f,c,_=t[1].upgrade.x+"",p,d,v=t[1].upgrade.e+"",h,g;return{c(){e=m("div"),l=m("div"),n=$("Previous upgrade attempt ("),o=$(i),r=$(") does not match current version ("),f=$(a),c=$(") ["),p=$(_),d=$("/"),h=$(v),g=$("]"),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(k,C){y(k,e,C),s(e,l),s(l,n),s(l,o),s(l,r),s(l,f),s(l,c),s(l,p),s(l,d),s(l,h),s(l,g)},p(k,C){C&2&&i!==(i=k[1].upgrade.t+"")&&B(o,i),C&2&&a!==(a=k[1].version+"")&&B(f,a),C&2&&_!==(_=k[1].upgrade.x+"")&&B(p,_),C&2&&v!==(v=k[1].upgrade.e+"")&&B(h,v)},d(k){k&&w(e)}}}function wf(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,_,p=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&yf(t),d=t[1].fwconsent===2&&$f();return{c(){e=m("div"),l=$(`Latest version: diff --git a/lib/SvelteUi/app/src/lib/Clock.svelte b/lib/SvelteUi/app/src/lib/Clock.svelte index d3ac9c19..e49c6cfe 100644 --- a/lib/SvelteUi/app/src/lib/Clock.svelte +++ b/lib/SvelteUi/app/src/lib/Clock.svelte @@ -6,10 +6,10 @@ export let offset; let showFull; - let adjusteTimestamp; $:{ showFull = Math.abs(new Date().getTime()-timestamp.getTime()) < 300000; - addHours(timestamp, offset); + if(!isNaN(offset)) + addHours(timestamp, offset); }