From c43c07386aaccd1493e59b739479d31a2df9919b Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Sun, 10 Dec 2023 18:01:57 +0100 Subject: [PATCH] Fixed some minuor issues --- .../include/AmsConfiguration.h | 18 +++++++++--------- lib/SvelteUi/app/dist/index.js | 4 ++-- lib/SvelteUi/app/src/lib/DataStores.js | 5 ++++- lib/SvelteUi/app/src/lib/VendorPanel.svelte | 4 +++- lib/SvelteUi/src/AmsWebServer.cpp | 1 + 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/AmsConfiguration/include/AmsConfiguration.h b/lib/AmsConfiguration/include/AmsConfiguration.h index ae7cd4ec..2abdd6bf 100644 --- a/lib/AmsConfiguration/include/AmsConfiguration.h +++ b/lib/AmsConfiguration/include/AmsConfiguration.h @@ -21,15 +21,15 @@ #define CONFIG_METER_START 296 #define CONFIG_GPIO_START 368 #define CONFIG_PRICE_START 400 -#define CONFIG_ENERGYACCOUNTING_START 464 -#define CONFIG_WEB_START 488 -#define CONFIG_DEBUG_START 624 -#define CONFIG_NTP_START 632 -#define CONFIG_MQTT_START 760 -#define CONFIG_DOMOTICZ_START 1528 -#define CONFIG_HA_START 1544 -#define CONFIG_UI_START 1712 -#define CONFIG_CLOUD_START 1728 +#define CONFIG_ENERGYACCOUNTING_START 472 +#define CONFIG_WEB_START 496 +#define CONFIG_DEBUG_START 632 +#define CONFIG_NTP_START 640 +#define CONFIG_MQTT_START 768 +#define CONFIG_DOMOTICZ_START 1536 +#define CONFIG_HA_START 1552 +#define CONFIG_UI_START 1720 +#define CONFIG_CLOUD_START 1736 #define CONFIG_METER_START_103 32 #define CONFIG_UPGRADE_INFO_START_103 216 diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index 6217176f..7af52af9 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,13 +1,13 @@ (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 u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).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 _e(){}function sl(t,e){for(const l in e)t[l]=e[l];return t}function sc(t){return t()}function ya(){return Object.create(null)}function Ve(t){t.forEach(sc)}function co(t){return typeof t=="function"}function Ne(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ps;function Xs(t,e){return ps||(ps=document.createElement("a")),ps.href=e,t===ps.href}function i0(t){return Object.keys(t).length===0}function mo(t,...e){if(t==null)return _e;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ri(t){let e;return mo(t,l=>e=l)(),e}function _l(t,e,l){t.$$.on_destroy.push(mo(e,l))}function po(t,e,l,n){if(t){const i=oc(t,e,l,n);return t[0](i)}}function oc(t,e,l,n){return t[1]&&n?sl(l.ctx.slice(),t[1](n(e))):l.ctx}function _o(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=[],u=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 Ms(t){return function(e){return e.preventDefault(),t.call(this,e)}}function r(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const o0=["width","height"];function ai(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&&o0.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function he(t){return t===""?null:+t}function r0(t){return Array.from(t.childNodes)}function X(t,e){e=""+e,t.data!==e&&(t.data=e)}function a0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function u0(t,e,l){~s0.indexOf(l)?a0(t,e):X(t,e)}function ne(t,e){t.value=e==null?"":e}function rc(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Se(t,e,l){for(let n=0;n{u.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=le(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),y(n)}}function c0(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function Ca(t,e){return new t(e)}let Si;function Ci(t){Si=t}function Ti(){if(!Si)throw new Error("Function called outside component initialization");return Si}function ac(t){Ti().$$.on_mount.push(t)}function m0(t){Ti().$$.on_destroy.push(t)}function p0(){const t=Ti();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=c0(e,l,{cancelable:n});return i.slice().forEach(u=>{u.call(t,o)}),!o.defaultPrevented}return!0}}function Mi(t,e){return Ti().$$.context.set(t,e),e}function jl(t){return Ti().$$.context.get(t)}const ni=[],ks=[];let ii=[];const Ma=[],uc=Promise.resolve();let Zs=!1;function fc(){Zs||(Zs=!0,uc.then(cc))}function _0(){return fc(),uc}function Ge(t){ii.push(t)}const zs=new Set;let ti=0;function cc(){if(ti!==0)return;const t=Si;do{try{for(;tit.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),ii=e}const hs=new Set;let rn;function Ie(){rn={r:0,c:[],p:rn}}function Re(){rn.r||Ve(rn.c),rn=rn.p}function R(t,e){t&&t.i&&(hs.delete(t),t.i(e))}function B(t,e,l,n){if(t&&t.o){if(hs.has(t))return;hs.add(t),rn.c.push(()=>{hs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function mc(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const u=t[o],a=e[o];if(a){for(const c in u)c in a||(n[c]=1);for(const c in a)i[c]||(l[c]=a[c],i[c]=1);t[o]=a}else for(const c in u)i[c]=1}for(const u in n)u in l||(l[u]=void 0);return l}function Sa(t){return typeof t=="object"&&t!==null?t:{}}function re(t){t&&t.c()}function se(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||Ge(()=>{const u=t.$$.on_mount.map(sc).filter(co);t.$$.on_destroy?t.$$.on_destroy.push(...u):Ve(u),t.$$.on_mount=[]}),o.forEach(Ge)}function oe(t,e){const l=t.$$;l.fragment!==null&&(v0(l.after_update),Ve(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function h0(t,e){t.$$.dirty[0]===-1&&(ni.push(t),fc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=v.length?v[0]:b;return f.ctx&&i(f.ctx[_],f.ctx[_]=d)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](d),p&&h0(t,_)),b}):[],f.update(),p=!0,Ve(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const _=r0(e.target);f.fragment&&f.fragment.l(_),_.forEach(y)}else f.fragment&&f.fragment.c();e.intro&&R(t.$$.fragment),se(t,e.target,e.anchor,e.customElement),cc()}Ci(c)}class De{$destroy(){oe(this,1),this.$destroy=_e}$on(e,l){if(!co(l))return _e;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&&!i0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ta=t=>typeof t>"u",pc=t=>typeof t=="function",_c=t=>typeof t=="number";function b0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function dc(){let t=0;return()=>t++}function g0(){return Math.random().toString(36).substring(2)}const Wl=typeof window>"u";function vc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const hc=(t,e)=>t?{}:{style:e},Js=t=>({"aria-hidden":"true",...hc(t,"display:none;")}),li=[];function bc(t,e){return{subscribe:it(t,e).subscribe}}function it(t,e=_e){let l;const n=new Set;function i(a){if(Ne(t,a)&&(t=a,l)){const c=!li.length;for(const f of n)f[1](),li.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:u}}function k0(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return bc(l,u=>{let a=!1;const c=[];let f=0,p=_e;const _=()=>{if(f)return;p();const v=e(n?c[0]:c,u);o?u(v):p=co(v)?v:_e},b=i.map((v,d)=>mo(v,g=>{c[d]=g,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,xs=Ni("LOCATION"),ui=Ni("ROUTER"),gc=Ni("ROUTE"),w0=Ni("ROUTE_PARAMS"),y0=Ni("FOCUS_ELEM"),kc=/^:(.+)/,ki=(t,e,l)=>t.substr(e,l),eo=(t,e)=>ki(t,0,e.length)===e,C0=t=>t==="",M0=t=>kc.test(t),wc=t=>t[0]==="*",S0=t=>t.replace(/\*.*$/,""),yc=t=>t.replace(/(^\/+|\/+$)/g,"");function vl(t,e=!1){const l=yc(t).split("/");return e?l.filter(Boolean):l}const Gs=(t,e)=>t+(e?`?${e}`:""),go=t=>`/${yc(t)}`;function $i(...t){const e=n=>vl(n,!0).join("/"),l=t.map(e).join("/");return go(l)}const ko=1,Ss=2,mn=3,T0=4,Cc=5,N0=6,Mc=7,$0=8,E0=9,Sc=10,Tc=11,A0={[ko]:"Link",[Ss]:"Route",[mn]:"Router",[T0]:"useFocus",[Cc]:"useLocation",[N0]:"useMatch",[Mc]:"useNavigate",[$0]:"useParams",[E0]:"useResolvable",[Sc]:"useResolve",[Tc]:"navigate"},wo=t=>A0[t];function P0(t,e){let l;return t===Ss?l=e.path?`path="${e.path}"`:"default":t===ko?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${wo(t)} ${l||""} />`}function D0(t,e,l,n){const i=l&&P0(n||t,l),o=i?` -Occurred in: ${i}`:"",u=wo(t),a=pc(e)?e(u):e;return`<${u}> ${a}${o}`}const Nc=t=>(...e)=>t(D0(...e)),$c=Nc(t=>{throw new Error(t)}),ws=Nc(console.warn),Na=4,I0=3,R0=2,L0=1,O0=1;function F0(t,e){const l=t.default?0:vl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Na,C0(i)?o+=O0:M0(i)?o+=R0:wc(i)?o-=Na+L0:o+=I0,o},0);return{route:t,score:l,index:e}}function q0(t){return t.map(F0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Ec(t,e){let l,n;const[i]=e.split("?"),o=vl(i),u=o[0]==="",a=q0(t);for(let c=0,f=a.length;c({...p,params:b,uri:$});if(p.default){n=v(e);continue}const d=vl(p.fullPath),g=Math.max(o.length,d.length);let w=0;for(;w{f===".."?c.pop():f!=="."&&c.push(f)}),Gs(`/${c.join("/")}`,n)}function $a(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,u=vl(e,!0),a=vl(l,!0);for(;u.length;)u[0]!==a[0]&&$c(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),a.shift();return{pathname:$i(...a),hash:n,search:i,state:o}}const Ea=t=>t.length===1?"":t,yo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Ea(ki(t,l)):"",u=i?ki(t,0,l):t,a=n?Ea(ki(u,e)):"";return{pathname:(n?ki(u,0,e):u)||"/",search:a,hash:o}},U0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function H0(t,e,l){return $i(l,B0(t,e))}function j0(t,e){const l=go(S0(t)),n=vl(l,!0),i=vl(e,!0).slice(0,n.length),o=Ac({fullPath:l},$i(...i));return o&&o.uri}const Vs="POP",W0="PUSH",z0="REPLACE";function Ks(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function G0(t){let e=[],l=Ks(t),n=Vs;const i=(o=e)=>o.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const u=()=>{l=Ks(t),n=Vs,i([o])};i([o]);const a=vc(t,"popstate",u);return()=>{a(),e=e.filter(c=>c!==o)}},navigate(o,u){const{state:a={},replace:c=!1}=u||{};if(n=c?z0:W0,_c(o))u&&ws(Tc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Vs,t.history.go(o);else{const f={...a,_key:g0()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Ks(t),i()}}}function Ys(t,e){return{...yo(e),state:t}}function V0(t="/"){let e=0,l=[Ys(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(Ys(n,o))},replaceState(n,i,o){l[e]=Ys(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const K0=!!(!Wl&&window.document&&window.document.createElement),Y0=!Wl&&window.location.origin==="null",Pc=G0(K0&&!Y0?window:V0()),{navigate:si}=Pc;let Tl=null,Dc=!0;function Q0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nTl.level||t.level===Tl.level&&Q0(t.routerId,Tl.routerId))&&(Tl=t)}function Z0(){Tl=null}function J0(){Dc=!1}function Aa(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=vc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function x0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function e1(t){return/^H[1-6]$/i.test(t.tagName)}function Pa(t,e=document){return e.querySelector(t)}function t1(t){let l=Pa(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!x0(l,t);){if(e1(l))return l;const n=Pa("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function l1(t){Promise.resolve(ri(t.focusElement)).then(e=>{const l=e||t1(t.id);l||ws(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ss),!Aa(l)&&Aa(document.documentElement)})}const n1=(t,e,l)=>(n,i)=>_0().then(()=>{if(!Tl||Dc){J0();return}if(n&&l1(Tl.route),t.announcements&&i){const{path:o,fullPath:u,meta:a,params:c,uri:f}=Tl.route,p=t.createAnnouncement({path:o,fullPath:u,meta:a,params:c,uri:f},ri(l));Promise.resolve(p).then(_=>{e.set(_)})}Z0()}),i1="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 s1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},hc(t[6],i1)],i={};for(let o=0;o`Navigated to ${x.uri}`,announcements:!0,...d},$=p,S=go(p),P=jl(xs),F=jl(ui),A=!P,I=r1(),D=v&&!(F&&!F.manageFocus),O=it("");_l(t,O,x=>l(0,a=x));const ie=F?F.disableInlineStyles:g,j=it([]);_l(t,j,x=>l(20,u=x));const K=it(null);_l(t,K,x=>l(18,i=x));let G=!1;const Y=A?0:F.level+1,z=A?it((()=>$a(Wl?yo(_):b.location,S))()):P;_l(t,z,x=>l(17,n=x));const Z=it(n);_l(t,Z,x=>l(19,o=x));const V=n1(w,O,z),H=x=>W=>W.filter(U=>U.id!==x);function ee(x){if(Wl){if(G)return;const W=Ac(x,n.pathname);if(W)return G=!0,W}else j.update(W=>{const U=H(x.id)(W);return U.push(x),U})}function ue(x){j.update(H(x))}return!A&&p!==Da&&ws(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),A&&(ac(()=>b.listen(W=>{const U=$a(W.location,S);Z.set(n),z.set(U)})),Mi(xs,z)),Mi(ui,{activeRoute:K,registerRoute:ee,unregisterRoute:ue,manageFocus:D,level:Y,id:I,history:A?b:F.history,basepath:A?S:F.basepath,disableInlineStyles:ie}),t.$$set=x=>{"basepath"in x&&l(11,p=x.basepath),"url"in x&&l(12,_=x.url),"history"in x&&l(13,b=x.history),"primary"in x&&l(14,v=x.primary),"a11y"in x&&l(15,d=x.a11y),"disableInlineStyles"in x&&l(16,g=x.disableInlineStyles),"$$scope"in x&&l(21,f=x.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==$&&ws(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const x=Ec(u,n.pathname);K.set(x)}if(t.$$.dirty[0]&655360&&A){const x=!!n.hash,W=!x&&D,U=!x||n.pathname!==o.pathname;V(W,U)}t.$$.dirty[0]&262144&&D&&i&&i.primary&&X0({level:Y,routerId:I,route:i})},[a,w,A,I,D,O,ie,j,K,z,Z,p,_,b,v,d,g,n,i,o,u,f,c]}class u1 extends De{constructor(e){super(),Pe(this,e,a1,o1,Ne,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Ic=u1;function Ei(t,e,l=ui,n=mn){jl(l)||$c(t,o=>`You cannot use ${o} outside of a ${wo(n)}.`,e)}const f1=t=>{const{subscribe:e}=jl(t);return{subscribe:e}};function Rc(){return Ei(Cc),f1(xs)}function Lc(){const{history:t}=jl(ui);return t}function Oc(){const t=jl(gc);return t?k0(t,e=>e.base):it("/")}function Fc(){Ei(Sc);const t=Oc(),{basepath:e}=jl(ui);return n=>H0(n,ri(t),e)}function c1(){Ei(Mc);const t=Fc(),{navigate:e}=Lc();return(n,i)=>{const o=_c(n)?n:t(n);return e(o,i)}}const m1=t=>({params:t&16,location:t&8}),Ia=t=>({params:Wl?ri(t[10]):t[4],location:t[3],navigate:t[11]});function Ra(t){let e,l;return e=new Ic({props:{primary:t[1],$$slots:{default:[d1]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(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||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function p1(t){let e;const l=t[18].default,n=po(l,t,t[19],Ia);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&vo(n,l,i,i[19],e?_o(l,i[19],o,m1):ho(i[19]),Ia)},i(i){e||(R(n,i),e=!0)},o(i){B(n,i),e=!1},d(i){n&&n.d(i)}}}function _1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Wl?ri(t[10]):t[4],t[12]];var o=t[0];function u(a){let c={};for(let f=0;f{oe(p,1)}),Re()}o?(e=Ca(o,u()),re(e.$$.fragment),R(e.$$.fragment,1),se(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(a){n||(e&&R(e.$$.fragment,a),n=!0)},o(a){e&&B(e.$$.fragment,a),n=!1},d(a){a&&y(l),e&&oe(e,a)}}}function d1(t){let e,l,n,i;const o=[_1,p1],u=[];function a(c,f){return c[0]!==null?0:1}return e=a(t),l=u[e]=o[e](t),{c(){l.c(),n=Ke()},m(c,f){u[e].m(c,f),M(c,n,f),i=!0},p(c,f){let p=e;e=a(c),e===p?u[e].p(c,f):(Ie(),B(u[p],1,1,()=>{u[p]=null}),Re(),l=u[e],l?l.p(c,f):(l=u[e]=o[e](c),l.c()),R(l,1),l.m(n.parentNode,n))},i(c){i||(R(l),i=!0)},o(c){B(l),i=!1},d(c){u[e].d(c),c&&y(n)}}}function v1(t){let e,l,n,i,o,u=[Js(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let _=0;_{c=null}),Re())},i(_){o||(R(c),o=!0)},o(_){B(c),o=!1},d(_){_&&y(e),_&&y(l),c&&c.d(_),_&&y(n),_&&y(i)}}}const h1=dc();function b1(t,e,l){let n;const i=["path","component","meta","primary"];let o=gs(e,i),u,a,c,f,{$$slots:p={},$$scope:_}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:g=!0}=e;Ei(Ss,e);const w=h1(),{registerRoute:$,unregisterRoute:S,activeRoute:P,disableInlineStyles:F}=jl(ui);_l(t,P,G=>l(16,u=G));const A=Oc();_l(t,A,G=>l(17,c=G));const I=Rc();_l(t,I,G=>l(3,a=G));const D=it(null);let O;const ie=it(),j=it({});_l(t,j,G=>l(4,f=G)),Mi(gc,ie),Mi(w0,j),Mi(y0,D);const K=c1();return Wl||m0(()=>S(w)),t.$$set=G=>{l(24,e=sl(sl({},e),bs(G))),l(12,o=gs(e,i)),"path"in G&&l(13,b=G.path),"component"in G&&l(0,v=G.component),"meta"in G&&l(14,d=G.meta),"primary"in G&&l(1,g=G.primary),"$$scope"in G&&l(19,_=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=b==="",Y=$i(c,b),Q={id:w,path:b,meta:d,default:G,fullPath:G?"":Y,base:G?c:j0(Y,a.pathname),primary:g,focusElement:D};ie.set(Q),l(15,O=$(Q))}if(t.$$.dirty&98304&&l(2,n=!!(O||u&&u.id===w)),t.$$.dirty&98308&&n){const{params:G}=O||u;j.set(G)}},e=bs(e),[v,g,n,a,f,w,P,F,A,I,j,K,o,b,d,O,u,c,p,_]}class g1 extends De{constructor(e){super(),Pe(this,e,b1,v1,Ne,{path:13,component:0,meta:14,primary:1})}}const Sl=g1;function k1(t){let e,l,n,i;const o=t[13].default,u=po(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,_=D));const P=p0(),F=Fc(),{navigate:A}=Lc();function I(D){P("click",D),b0(D)&&(D.preventDefault(),A(n,{state:w,replace:u||g}))}return t.$$set=D=>{l(19,e=sl(sl({},e),bs(D))),l(18,p=gs(e,f)),"to"in D&&l(5,d=D.to),"replace"in D&&l(6,g=D.replace),"state"in D&&l(7,w=D.state),"getProps"in D&&l(8,$=D.getProps),"$$scope"in D&&l(12,v=D.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=F(d,_)),t.$$.dirty&2049&&l(10,i=eo(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(u=yo(n)===U0(_)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(pc($)){const D=$({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...D}}return p})())},e=bs(e),[n,c,a,S,I,d,g,w,$,o,i,_,v,b]}class y1 extends De{constructor(e){super(),Pe(this,e,w1,k1,Ne,{to:5,replace:6,state:7,getProps:8})}}const ol=y1;let to=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Hl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function C1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function qc(t,e){let l;return t>90?l="#d90000":t>85?l="#e32100":t>80?l="#ffb800":t>75?l="#dcd800":l="#32d900",l+(e?"88":"")}function M1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function ys(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Fe(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function ve(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1";case 80:return"Generic ESP32-S3"}}function La(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 Oa(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 Fa(t){switch(t){case 400:return"Unrecognized data in request";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-1:return"Connection 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 qa(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function oi(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Qe(t,e){return t==1||t==2&&e}function Ut(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function be(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function dl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Ba(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"}}function Ua(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function Ha(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}async function Nl(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 pl={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 Yt=it(pl);async function Co(){pl=await(await Nl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Yt.set(pl)}let ds=0,ja=-127,Wa=null,S1={};const Bc=bc(S1,t=>{let e;async function l(){Nl("/data.json").then(n=>n.json()).then(n=>{t(n),ja!=n.t&&(ja=n.t,setTimeout(zc,2e3)),Wa==null&&n.pe&&n.p!=null&&(Wa=n.p,Hc()),pl.upgrading?window.location.reload():(!pl||!pl.chip||pl.booting||ds>1&&!oi(pl.board))&&(Co(),an&&clearTimeout(an),an=setTimeout(So,2e3),un&&clearTimeout(un),un=setTimeout(To,3e3));let i=5e3;if(oi(pl.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),ds=0}).catch(n=>{ds++,ds>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,oi(pl.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let lo={},wi;const Mo=it(lo);async function Uc(){let t=!1;if(Mo.update(e=>{for(var l=0;l<36;l++){if(e[Fe(l)]==null){t=l<12;break}e[Fe(l)]=e[Fe(l+1)]}return e}),t)Hc();else{let e=new Date;wi=setTimeout(Uc,(60-e.getMinutes())*6e4)}}async function Hc(){wi&&(clearTimeout(wi),wi=0),lo=await(await Nl("/energyprice.json")).json(),Mo.set(lo);let e=new Date;wi=setTimeout(Uc,(60-e.getMinutes())*6e4)}let no={},an;async function So(){an&&(clearTimeout(an),an=0),no=await(await Nl("/dayplot.json")).json(),jc.set(no);let e=new Date;an=setTimeout(So,(60-e.getMinutes())*6e4+20)}const jc=it(no,t=>(So(),function(){}));let io={},un;async function To(){un&&(clearTimeout(un),un=0),io=await(await Nl("/monthplot.json")).json(),Wc.set(io);let e=new Date;un=setTimeout(To,(24-e.getHours())*36e5+40)}const Wc=it(io,t=>(To(),function(){}));let so={};async function zc(){so=await(await Nl("/temperature.json")).json(),Gc.set(so)}const Gc=it(so,t=>(zc(),function(){}));let oo={},vs;async function Vc(){vs&&(clearTimeout(vs),vs=0),oo=await(await Nl("/tariff.json")).json(),Kc.set(oo);let e=new Date;vs=setTimeout(Vc,(60-e.getMinutes())*6e4+30)}const Kc=it(oo,t=>function(){});let ro=[];const No=it(ro);async function T1(){ro=await(await Nl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),No.set(ro)}let ao={};async function N1(){ao=await(await Nl("/realtime.json")).json(),Yc.set(ao)}const Yc=it(ao,t=>(N1(),function(){}));function Cs(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 Qc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Xc(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]),u=[...e];u.reverse();let a,c,f;for(let p=0;po&&(a=_):g==i+1&&(c=_);else if(d==n+1)if(f){let $=f.tag_name.substring(1).split(".");parseInt($[0]);let S=parseInt($[1]);parseInt($[2]),g==S&&(f=_)}else f=_}return c||f||a||!1}else return e[0]}const $1="/github.svg";function za(t){let e,l;function n(u,a){return u[1]>1?L1:u[1]>0?R1:u[2]>1?I1:u[2]>0?D1:u[3]>1?P1:u[3]>0?A1:E1}let i=n(t),o=i(t);return{c(){e=N(`Up +Occurred in: ${i}`:"",u=wo(t),a=pc(e)?e(u):e;return`<${u}> ${a}${o}`}const Nc=t=>(...e)=>t(D0(...e)),$c=Nc(t=>{throw new Error(t)}),ws=Nc(console.warn),Na=4,I0=3,R0=2,L0=1,O0=1;function F0(t,e){const l=t.default?0:vl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Na,C0(i)?o+=O0:M0(i)?o+=R0:wc(i)?o-=Na+L0:o+=I0,o},0);return{route:t,score:l,index:e}}function q0(t){return t.map(F0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Ec(t,e){let l,n;const[i]=e.split("?"),o=vl(i),u=o[0]==="",a=q0(t);for(let c=0,f=a.length;c({...p,params:b,uri:$});if(p.default){n=v(e);continue}const d=vl(p.fullPath),g=Math.max(o.length,d.length);let w=0;for(;w{f===".."?c.pop():f!=="."&&c.push(f)}),Gs(`/${c.join("/")}`,n)}function $a(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,u=vl(e,!0),a=vl(l,!0);for(;u.length;)u[0]!==a[0]&&$c(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),a.shift();return{pathname:$i(...a),hash:n,search:i,state:o}}const Ea=t=>t.length===1?"":t,yo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Ea(ki(t,l)):"",u=i?ki(t,0,l):t,a=n?Ea(ki(u,e)):"";return{pathname:(n?ki(u,0,e):u)||"/",search:a,hash:o}},U0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function H0(t,e,l){return $i(l,B0(t,e))}function j0(t,e){const l=go(S0(t)),n=vl(l,!0),i=vl(e,!0).slice(0,n.length),o=Ac({fullPath:l},$i(...i));return o&&o.uri}const Vs="POP",W0="PUSH",z0="REPLACE";function Ks(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function G0(t){let e=[],l=Ks(t),n=Vs;const i=(o=e)=>o.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const u=()=>{l=Ks(t),n=Vs,i([o])};i([o]);const a=vc(t,"popstate",u);return()=>{a(),e=e.filter(c=>c!==o)}},navigate(o,u){const{state:a={},replace:c=!1}=u||{};if(n=c?z0:W0,_c(o))u&&ws(Tc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Vs,t.history.go(o);else{const f={...a,_key:g0()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Ks(t),i()}}}function Ys(t,e){return{...yo(e),state:t}}function V0(t="/"){let e=0,l=[Ys(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(Ys(n,o))},replaceState(n,i,o){l[e]=Ys(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const K0=!!(!Wl&&window.document&&window.document.createElement),Y0=!Wl&&window.location.origin==="null",Pc=G0(K0&&!Y0?window:V0()),{navigate:si}=Pc;let Tl=null,Dc=!0;function Q0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nTl.level||t.level===Tl.level&&Q0(t.routerId,Tl.routerId))&&(Tl=t)}function Z0(){Tl=null}function J0(){Dc=!1}function Aa(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=vc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function x0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function e1(t){return/^H[1-6]$/i.test(t.tagName)}function Pa(t,e=document){return e.querySelector(t)}function t1(t){let l=Pa(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!x0(l,t);){if(e1(l))return l;const n=Pa("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function l1(t){Promise.resolve(ri(t.focusElement)).then(e=>{const l=e||t1(t.id);l||ws(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ss),!Aa(l)&&Aa(document.documentElement)})}const n1=(t,e,l)=>(n,i)=>_0().then(()=>{if(!Tl||Dc){J0();return}if(n&&l1(Tl.route),t.announcements&&i){const{path:o,fullPath:u,meta:a,params:c,uri:f}=Tl.route,p=t.createAnnouncement({path:o,fullPath:u,meta:a,params:c,uri:f},ri(l));Promise.resolve(p).then(_=>{e.set(_)})}Z0()}),i1="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 s1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},hc(t[6],i1)],i={};for(let o=0;o`Navigated to ${x.uri}`,announcements:!0,...d},$=p,S=go(p),P=jl(xs),F=jl(ui),A=!P,I=r1(),D=v&&!(F&&!F.manageFocus),O=it("");_l(t,O,x=>l(0,a=x));const ie=F?F.disableInlineStyles:g,j=it([]);_l(t,j,x=>l(20,u=x));const K=it(null);_l(t,K,x=>l(18,i=x));let G=!1;const Y=A?0:F.level+1,z=A?it((()=>$a(Wl?yo(_):b.location,S))()):P;_l(t,z,x=>l(17,n=x));const Z=it(n);_l(t,Z,x=>l(19,o=x));const V=n1(w,O,z),H=x=>W=>W.filter(U=>U.id!==x);function ee(x){if(Wl){if(G)return;const W=Ac(x,n.pathname);if(W)return G=!0,W}else j.update(W=>{const U=H(x.id)(W);return U.push(x),U})}function ue(x){j.update(H(x))}return!A&&p!==Da&&ws(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),A&&(ac(()=>b.listen(W=>{const U=$a(W.location,S);Z.set(n),z.set(U)})),Mi(xs,z)),Mi(ui,{activeRoute:K,registerRoute:ee,unregisterRoute:ue,manageFocus:D,level:Y,id:I,history:A?b:F.history,basepath:A?S:F.basepath,disableInlineStyles:ie}),t.$$set=x=>{"basepath"in x&&l(11,p=x.basepath),"url"in x&&l(12,_=x.url),"history"in x&&l(13,b=x.history),"primary"in x&&l(14,v=x.primary),"a11y"in x&&l(15,d=x.a11y),"disableInlineStyles"in x&&l(16,g=x.disableInlineStyles),"$$scope"in x&&l(21,f=x.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==$&&ws(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const x=Ec(u,n.pathname);K.set(x)}if(t.$$.dirty[0]&655360&&A){const x=!!n.hash,W=!x&&D,U=!x||n.pathname!==o.pathname;V(W,U)}t.$$.dirty[0]&262144&&D&&i&&i.primary&&X0({level:Y,routerId:I,route:i})},[a,w,A,I,D,O,ie,j,K,z,Z,p,_,b,v,d,g,n,i,o,u,f,c]}class u1 extends De{constructor(e){super(),Pe(this,e,a1,o1,Ne,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Ic=u1;function Ei(t,e,l=ui,n=mn){jl(l)||$c(t,o=>`You cannot use ${o} outside of a ${wo(n)}.`,e)}const f1=t=>{const{subscribe:e}=jl(t);return{subscribe:e}};function Rc(){return Ei(Cc),f1(xs)}function Lc(){const{history:t}=jl(ui);return t}function Oc(){const t=jl(gc);return t?k0(t,e=>e.base):it("/")}function Fc(){Ei(Sc);const t=Oc(),{basepath:e}=jl(ui);return n=>H0(n,ri(t),e)}function c1(){Ei(Mc);const t=Fc(),{navigate:e}=Lc();return(n,i)=>{const o=_c(n)?n:t(n);return e(o,i)}}const m1=t=>({params:t&16,location:t&8}),Ia=t=>({params:Wl?ri(t[10]):t[4],location:t[3],navigate:t[11]});function Ra(t){let e,l;return e=new Ic({props:{primary:t[1],$$slots:{default:[d1]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(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||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function p1(t){let e;const l=t[18].default,n=po(l,t,t[19],Ia);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&vo(n,l,i,i[19],e?_o(l,i[19],o,m1):ho(i[19]),Ia)},i(i){e||(R(n,i),e=!0)},o(i){B(n,i),e=!1},d(i){n&&n.d(i)}}}function _1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Wl?ri(t[10]):t[4],t[12]];var o=t[0];function u(a){let c={};for(let f=0;f{oe(p,1)}),Re()}o?(e=Ca(o,u()),re(e.$$.fragment),R(e.$$.fragment,1),se(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(a){n||(e&&R(e.$$.fragment,a),n=!0)},o(a){e&&B(e.$$.fragment,a),n=!1},d(a){a&&y(l),e&&oe(e,a)}}}function d1(t){let e,l,n,i;const o=[_1,p1],u=[];function a(c,f){return c[0]!==null?0:1}return e=a(t),l=u[e]=o[e](t),{c(){l.c(),n=Ke()},m(c,f){u[e].m(c,f),M(c,n,f),i=!0},p(c,f){let p=e;e=a(c),e===p?u[e].p(c,f):(Ie(),B(u[p],1,1,()=>{u[p]=null}),Re(),l=u[e],l?l.p(c,f):(l=u[e]=o[e](c),l.c()),R(l,1),l.m(n.parentNode,n))},i(c){i||(R(l),i=!0)},o(c){B(l),i=!1},d(c){u[e].d(c),c&&y(n)}}}function v1(t){let e,l,n,i,o,u=[Js(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let _=0;_{c=null}),Re())},i(_){o||(R(c),o=!0)},o(_){B(c),o=!1},d(_){_&&y(e),_&&y(l),c&&c.d(_),_&&y(n),_&&y(i)}}}const h1=dc();function b1(t,e,l){let n;const i=["path","component","meta","primary"];let o=gs(e,i),u,a,c,f,{$$slots:p={},$$scope:_}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:g=!0}=e;Ei(Ss,e);const w=h1(),{registerRoute:$,unregisterRoute:S,activeRoute:P,disableInlineStyles:F}=jl(ui);_l(t,P,G=>l(16,u=G));const A=Oc();_l(t,A,G=>l(17,c=G));const I=Rc();_l(t,I,G=>l(3,a=G));const D=it(null);let O;const ie=it(),j=it({});_l(t,j,G=>l(4,f=G)),Mi(gc,ie),Mi(w0,j),Mi(y0,D);const K=c1();return Wl||m0(()=>S(w)),t.$$set=G=>{l(24,e=sl(sl({},e),bs(G))),l(12,o=gs(e,i)),"path"in G&&l(13,b=G.path),"component"in G&&l(0,v=G.component),"meta"in G&&l(14,d=G.meta),"primary"in G&&l(1,g=G.primary),"$$scope"in G&&l(19,_=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=b==="",Y=$i(c,b),Q={id:w,path:b,meta:d,default:G,fullPath:G?"":Y,base:G?c:j0(Y,a.pathname),primary:g,focusElement:D};ie.set(Q),l(15,O=$(Q))}if(t.$$.dirty&98304&&l(2,n=!!(O||u&&u.id===w)),t.$$.dirty&98308&&n){const{params:G}=O||u;j.set(G)}},e=bs(e),[v,g,n,a,f,w,P,F,A,I,j,K,o,b,d,O,u,c,p,_]}class g1 extends De{constructor(e){super(),Pe(this,e,b1,v1,Ne,{path:13,component:0,meta:14,primary:1})}}const Sl=g1;function k1(t){let e,l,n,i;const o=t[13].default,u=po(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,_=D));const P=p0(),F=Fc(),{navigate:A}=Lc();function I(D){P("click",D),b0(D)&&(D.preventDefault(),A(n,{state:w,replace:u||g}))}return t.$$set=D=>{l(19,e=sl(sl({},e),bs(D))),l(18,p=gs(e,f)),"to"in D&&l(5,d=D.to),"replace"in D&&l(6,g=D.replace),"state"in D&&l(7,w=D.state),"getProps"in D&&l(8,$=D.getProps),"$$scope"in D&&l(12,v=D.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=F(d,_)),t.$$.dirty&2049&&l(10,i=eo(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(u=yo(n)===U0(_)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(pc($)){const D=$({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...D}}return p})())},e=bs(e),[n,c,a,S,I,d,g,w,$,o,i,_,v,b]}class y1 extends De{constructor(e){super(),Pe(this,e,w1,k1,Ne,{to:5,replace:6,state:7,getProps:8})}}const ol=y1;let to=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Hl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function C1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function qc(t,e){let l;return t>90?l="#d90000":t>85?l="#e32100":t>80?l="#ffb800":t>75?l="#dcd800":l="#32d900",l+(e?"88":"")}function M1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function ys(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Fe(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function ve(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1";case 80:return"Generic ESP32-S3"}}function La(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 Oa(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 Fa(t){switch(t){case 400:return"Unrecognized data in request";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-1:return"Connection 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 qa(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function oi(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Qe(t,e){return t==1||t==2&&e}function Ut(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function be(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function dl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Ba(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"}}function Ua(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function Ha(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}async function Nl(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 pl={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null,if:{eth:!1}};const Yt=it(pl);async function Co(){pl=await(await Nl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Yt.set(pl)}let ds=0,ja=-127,Wa=null,S1={};const Bc=bc(S1,t=>{let e;async function l(){Nl("/data.json").then(n=>n.json()).then(n=>{t(n),ja!=n.t&&(ja=n.t,setTimeout(zc,2e3)),Wa==null&&n.pe&&n.p!=null&&(Wa=n.p,Hc()),pl.upgrading?window.location.reload():(!pl||!pl.chip||pl.booting||ds>1&&!oi(pl.board))&&(Co(),an&&clearTimeout(an),an=setTimeout(So,2e3),un&&clearTimeout(un),un=setTimeout(To,3e3));let i=5e3;if(oi(pl.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),ds=0}).catch(n=>{ds++,ds>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,oi(pl.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let lo={},wi;const Mo=it(lo);async function Uc(){let t=!1;if(Mo.update(e=>{for(var l=0;l<36;l++){if(e[Fe(l)]==null){t=l<12;break}e[Fe(l)]=e[Fe(l+1)]}return e}),t)Hc();else{let e=new Date;wi=setTimeout(Uc,(60-e.getMinutes())*6e4)}}async function Hc(){wi&&(clearTimeout(wi),wi=0),lo=await(await Nl("/energyprice.json")).json(),Mo.set(lo);let e=new Date;wi=setTimeout(Uc,(60-e.getMinutes())*6e4)}let no={},an;async function So(){an&&(clearTimeout(an),an=0),no=await(await Nl("/dayplot.json")).json(),jc.set(no);let e=new Date;an=setTimeout(So,(60-e.getMinutes())*6e4+20)}const jc=it(no,t=>(So(),function(){}));let io={},un;async function To(){un&&(clearTimeout(un),un=0),io=await(await Nl("/monthplot.json")).json(),Wc.set(io);let e=new Date;un=setTimeout(To,(24-e.getHours())*36e5+40)}const Wc=it(io,t=>(To(),function(){}));let so={};async function zc(){so=await(await Nl("/temperature.json")).json(),Gc.set(so)}const Gc=it(so,t=>(zc(),function(){}));let oo={},vs;async function Vc(){vs&&(clearTimeout(vs),vs=0),oo=await(await Nl("/tariff.json")).json(),Kc.set(oo);let e=new Date;vs=setTimeout(Vc,(60-e.getMinutes())*6e4+30)}const Kc=it(oo,t=>function(){});let ro=[];const No=it(ro);async function T1(){ro=await(await Nl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),No.set(ro)}let ao={};async function N1(){ao=await(await Nl("/realtime.json")).json(),Yc.set(ao)}const Yc=it(ao,t=>(N1(),function(){}));function Cs(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 Qc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Xc(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]),u=[...e];u.reverse();let a,c,f;for(let p=0;po&&(a=_):g==i+1&&(c=_);else if(d==n+1)if(f){let $=f.tag_name.substring(1).split(".");parseInt($[0]);let S=parseInt($[1]);parseInt($[2]),g==S&&(f=_)}else f=_}return c||f||a||!1}else return e[0]}const $1="/github.svg";function za(t){let e,l;function n(u,a){return u[1]>1?L1:u[1]>0?R1:u[2]>1?I1:u[2]>0?D1:u[3]>1?P1:u[3]>0?A1:E1}let i=n(t),o=i(t);return{c(){e=N(`Up `),o.c(),l=Ke()},m(u,a){M(u,e,a),o.m(u,a),M(u,l,a)},p(u,a){i===(i=n(u))&&o?o.p(u,a):(o.d(1),o=i(u),o&&(o.c(),o.m(l.parentNode,l)))},d(u){u&&y(e),o.d(u),u&&y(l)}}}function E1(t){let e,l;return{c(){e=N(t[0]),l=N(" seconds")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&1&&X(e,n[0])},d(n){n&&y(e),n&&y(l)}}}function A1(t){let e,l;return{c(){e=N(t[3]),l=N(" minute")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&y(e),n&&y(l)}}}function P1(t){let e,l;return{c(){e=N(t[3]),l=N(" minutes")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&y(e),n&&y(l)}}}function D1(t){let e,l;return{c(){e=N(t[2]),l=N(" hour")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&y(e),n&&y(l)}}}function I1(t){let e,l;return{c(){e=N(t[2]),l=N(" hours")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&y(e),n&&y(l)}}}function R1(t){let e,l;return{c(){e=N(t[1]),l=N(" day")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&y(e),n&&y(l)}}}function L1(t){let e,l;return{c(){e=N(t[1]),l=N(" days")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&y(e),n&&y(l)}}}function O1(t){let e,l=t[0]&&za(t);return{c(){l&&l.c(),e=Ke()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=za(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:_e,o:_e,d(n){l&&l.d(n),n&&y(e)}}}function F1(t,e,l){let{epoch:n}=e,i=0,o=0,u=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,u=Math.floor(n/60)))},[n,i,o,u]}class q1 extends De{constructor(e){super(),Pe(this,e,F1,O1,Ne,{epoch:0})}}function B1(t){let e,l,n;return{c(){e=m("span"),l=N(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){M(i,e,o),s(e,l)},p(i,[o]){o&4&&X(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:_e,o:_e,d(i){i&&y(e)}}}function U1(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,o=u.text)},[n,i,o]}class fn extends De{constructor(e){super(),Pe(this,e,U1,B1,Ne,{color:0,title:1,text:2})}}function H1(t){let e,l=`${Fe(t[0].getDate())}.${Fe(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Fe(t[0].getHours())}:${Fe(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=N(l),r(e,"class",t[1])},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Fe(i[0].getDate())}.${Fe(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Fe(i[0].getHours())}:${Fe(i[0].getMinutes())}`)&&X(n,l),o&2&&r(e,"class",i[1])},d(i){i&&y(e)}}}function j1(t){let e=`${Fe(t[0].getDate())}. ${to[t[0].getMonth()]} ${Fe(t[0].getHours())}:${Fe(t[0].getMinutes())}`,l;return{c(){l=N(e)},m(n,i){M(n,l,i)},p(n,i){i&1&&e!==(e=`${Fe(n[0].getDate())}. ${to[n[0].getMonth()]} ${Fe(n[0].getHours())}:${Fe(n[0].getMinutes())}`)&&X(l,e)},d(n){n&&y(l)}}}function W1(t){let e;function l(o,u){return o[2]?j1:H1}let n=l(t),i=n(t);return{c(){i.c(),e=Ke()},m(o,u){i.m(o,u),M(o,e,u)},p(o,[u]){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:_e,o:_e,d(o){i.d(o),o&&y(e)}}}function z1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,u;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,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||dl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,o]}class Zc extends De{constructor(e){super(),Pe(this,e,z1,W1,Ne,{timestamp:0,fullTimeColor:1,offset:3})}}function G1(t){let e,l,n;return{c(){e=Te("svg"),l=Te("path"),n=Te("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(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"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){M(i,e,o),s(e,l),s(e,n)},p:_e,i:_e,o:_e,d(i){i&&y(e)}}}class V1 extends De{constructor(e){super(),Pe(this,e,null,G1,Ne,{})}}function K1(t){let e,l;return{c(){e=Te("svg"),l=Te("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(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"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:_e,i:_e,o:_e,d(n){n&&y(e)}}}class Y1 extends De{constructor(e){super(),Pe(this,e,null,K1,Ne,{})}}function Q1(t){let e,l;return{c(){e=Te("svg"),l=Te("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(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"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:_e,i:_e,o:_e,d(n){n&&y(e)}}}class Bt extends De{constructor(e){super(),Pe(this,e,null,Q1,Ne,{})}}function X1(t){let e,l;return{c(){e=Te("svg"),l=Te("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(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"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:_e,i:_e,o:_e,d(n){n&&y(e)}}}class Jc extends De{constructor(e){super(),Pe(this,e,null,X1,Ne,{})}}function Z1(t){let e,l,n=t[1].version+"",i;return{c(){e=N("AMS reader "),l=m("span"),i=N(n)},m(o,u){M(o,e,u),M(o,l,u),s(l,i)},p(o,u){u&2&&n!==(n=o[1].version+"")&&X(i,n)},d(o){o&&y(e),o&&y(l)}}}function Ga(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=N(l),i=N("\xB0C"),r(e,"class","flex-none my-auto")},m(o,u){M(o,e,u),s(e,n),s(e,i)},p(o,u){u&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&X(n,l)},d(o){o&&y(e)}}}function Va(t){let e,l="HAN: "+La(t[0].he),n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+La(i[0].he))&&X(n,l)},d(i){i&&y(e)}}}function Ka(t){let e,l="MQTT: "+Oa(t[0].me),n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Oa(i[0].me))&&X(n,l)},d(i){i&&y(e)}}}function Ya(t){let e,l="Pricps: "+Fa(t[0].ee),n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="Pricps: "+Fa(i[0].ee))&&X(n,l)},d(i){i&&y(e)}}}function Qa(t){let e,l,n,i,o,u;return l=new ol({props:{to:"/configuration",$$slots:{default:[J1]},$$scope:{ctx:t}}}),o=new ol({props:{to:"/status",$$slots:{default:[x1]},$$scope:{ctx:t}}}),{c(){e=m("div"),re(l.$$.fragment),n=h(),i=m("div"),re(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(a,c){M(a,e,c),se(l,e,null),M(a,n,c),M(a,i,c),se(o,i,null),u=!0},i(a){u||(R(l.$$.fragment,a),R(o.$$.fragment,a),u=!0)},o(a){B(l.$$.fragment,a),B(o.$$.fragment,a),u=!1},d(a){a&&y(e),oe(l),a&&y(n),a&&y(i),oe(o)}}}function J1(t){let e,l;return e=new V1({}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function x1(t){let e,l;return e=new Y1({}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Xa(t){let e,l,n,i,o;const u=[tm,em],a=[];function c(f,p){return f[1].security==0||f[0].a?0:1}return l=c(t),n=a[l]=u[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[2].tag_name)},m(f,p){M(f,e,p),a[l].m(e,null),o=!0},p(f,p){let _=l;l=c(f),l===_?a[l].p(f,p):(Ie(),B(a[_],1,1,()=>{a[_]=null}),Re(),n=a[l],n?n.p(f,p):(n=a[l]=u[l](f),n.c()),R(n,1),n.m(e,null)),(!o||p&4&&i!==(i="New version: "+f[2].tag_name))&&r(e,"title",i)},i(f){o||(R(n),o=!0)},o(f){B(n),o=!1},d(f){f&&y(e),a[l].d()}}}function em(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=N("New version: "),i=N(n)},m(o,u){M(o,e,u),s(e,l),s(e,i)},p(o,u){u&4&&n!==(n=o[2].tag_name+"")&&X(i,n)},i:_e,o:_e,d(o){o&&y(e)}}}function tm(t){let e,l,n,i=t[2].tag_name+"",o,u,a,c,f,p;return a=new Jc({}),{c(){e=m("button"),l=m("span"),n=N("New version: "),o=N(i),u=h(),re(a.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(_,b){M(_,e,b),s(e,l),s(l,n),s(l,o),s(e,u),se(a,e,null),c=!0,f||(p=le(e,"click",t[3]),f=!0)},p(_,b){(!c||b&4)&&i!==(i=_[2].tag_name+"")&&X(o,i)},i(_){c||(R(a.$$.fragment,_),c=!0)},o(_){B(a.$$.fragment,_),c=!1},d(_){_&&y(e),oe(a),f=!1,p()}}}function lm(t){let e,l,n,i,o,u,a,c,f,p,_,b,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,g,w,$,S,P,F,A,I,D,O,ie,j,K,G,Y,Q,z,Z,V,H,ee,ue,x,W,U,ke,je,Be,We;i=new ol({props:{to:"/",$$slots:{default:[Z1]},$$scope:{ctx:t}}}),c=new q1({props:{epoch:t[0].u}});let $e=t[0].t>-50&&Ga(t);S=new fn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:Hl(t[1].booting?2:t[0].em)}}),F=new fn({props:{title:"HAN",text:"HAN",color:Hl(t[1].booting?9:t[0].hm)}}),I=new fn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:Hl(t[1].booting?9:t[0].wm)}}),O=new fn({props:{title:"MQTT",text:"MQTT",color:Hl(t[1].booting?9:t[0].mm)}});let ge=(t[0].he<0||t[0].he>0)&&Va(t),Le=t[0].me<0&&Ka(t),Me=(t[0].ee>0||t[0].ee<0)&&Ya(t);ue=new Zc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let T=t[1].vndcfg&&t[1].usrcfg&&Qa(t);je=new Bt({});let k=t[1].fwconsent===1&&t[2]&&Xa(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),re(i.$$.fragment),o=h(),u=m("div"),a=m("div"),re(c.$$.fragment),f=h(),$e&&$e.c(),p=h(),_=m("div"),b=N("Free mem: "),d=N(v),g=N("kb"),w=h(),$=m("div"),re(S.$$.fragment),P=h(),re(F.$$.fragment),A=h(),re(I.$$.fragment),D=h(),re(O.$$.fragment),ie=h(),ge&&ge.c(),j=h(),Le&&Le.c(),K=h(),Me&&Me.c(),G=h(),Y=m("div"),Q=m("div"),z=m("a"),Z=m("img"),H=h(),ee=m("div"),re(ue.$$.fragment),x=h(),T&&T.c(),W=h(),U=m("div"),ke=m("a"),re(je.$$.fragment),Be=h(),k&&k.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(a,"class","flex-none my-auto"),r(_,"class","flex-none my-auto"),r(u,"class","flex-none my-auto p-2 flex space-x-4"),r($,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(Z,"class","gh-logo"),Xs(Z.src,V=$1)||r(Z,"src",V),r(Z,"alt","GitHub repo"),r(z,"class","float-right"),r(z,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(z,"target","_blank"),r(z,"rel","noreferrer"),r(z,"aria-label","GitHub"),r(Q,"class","flex-none"),r(ee,"class","flex-none my-auto px-2"),r(ke,"href",Ut("")),r(ke,"target","_blank"),r(ke,"rel","noreferrer"),r(U,"class","flex-none px-1 mt-1"),r(U,"title","Documentation"),r(Y,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(C,E){M(C,e,E),s(e,l),s(l,n),se(i,n,null),s(l,o),s(l,u),s(u,a),se(c,a,null),s(u,f),$e&&$e.m(u,null),s(u,p),s(u,_),s(_,b),s(_,d),s(_,g),s(l,w),s(l,$),se(S,$,null),s($,P),se(F,$,null),s($,A),se(I,$,null),s($,D),se(O,$,null),s(l,ie),ge&&ge.m(l,null),s(l,j),Le&&Le.m(l,null),s(l,K),Me&&Me.m(l,null),s(l,G),s(l,Y),s(Y,Q),s(Q,z),s(z,Z),s(Y,H),s(Y,ee),se(ue,ee,null),s(Y,x),T&&T.m(Y,null),s(Y,W),s(Y,U),s(U,ke),se(je,ke,null),s(Y,Be),k&&k.m(Y,null),We=!0},p(C,[E]){const L={};E&18&&(L.$$scope={dirty:E,ctx:C}),i.$set(L);const J={};E&1&&(J.epoch=C[0].u),c.$set(J),C[0].t>-50?$e?$e.p(C,E):($e=Ga(C),$e.c(),$e.m(u,p)):$e&&($e.d(1),$e=null),(!We||E&1)&&v!==(v=(C[0].m?(C[0].m/1e3).toFixed(1):"-")+"")&&X(d,v);const te={};E&3&&(te.text=C[1].booting?"Booting":C[0].v>2?C[0].v.toFixed(2)+"V":"ESP"),E&3&&(te.color=Hl(C[1].booting?2:C[0].em)),S.$set(te);const fe={};E&3&&(fe.color=Hl(C[1].booting?9:C[0].hm)),F.$set(fe);const de={};E&1&&(de.text=C[0].r?C[0].r.toFixed(0)+"dBm":"WiFi"),E&3&&(de.color=Hl(C[1].booting?9:C[0].wm)),I.$set(de);const we={};E&3&&(we.color=Hl(C[1].booting?9:C[0].mm)),O.$set(we),C[0].he<0||C[0].he>0?ge?ge.p(C,E):(ge=Va(C),ge.c(),ge.m(l,j)):ge&&(ge.d(1),ge=null),C[0].me<0?Le?Le.p(C,E):(Le=Ka(C),Le.c(),Le.m(l,K)):Le&&(Le.d(1),Le=null),C[0].ee>0||C[0].ee<0?Me?Me.p(C,E):(Me=Ya(C),Me.c(),Me.m(l,G)):Me&&(Me.d(1),Me=null);const Ee={};E&1&&(Ee.timestamp=C[0].c?new Date(C[0].c*1e3):new Date(0)),E&2&&(Ee.offset=C[1].clock_offset),ue.$set(Ee),C[1].vndcfg&&C[1].usrcfg?T?E&2&&R(T,1):(T=Qa(C),T.c(),R(T,1),T.m(Y,W)):T&&(Ie(),B(T,1,1,()=>{T=null}),Re()),C[1].fwconsent===1&&C[2]?k?(k.p(C,E),E&6&&R(k,1)):(k=Xa(C),k.c(),R(k,1),k.m(Y,null)):k&&(Ie(),B(k,1,1,()=>{k=null}),Re())},i(C){We||(R(i.$$.fragment,C),R(c.$$.fragment,C),R(S.$$.fragment,C),R(F.$$.fragment,C),R(I.$$.fragment,C),R(O.$$.fragment,C),R(ue.$$.fragment,C),R(T),R(je.$$.fragment,C),R(k),We=!0)},o(C){B(i.$$.fragment,C),B(c.$$.fragment,C),B(S.$$.fragment,C),B(F.$$.fragment,C),B(I.$$.fragment,C),B(O.$$.fragment,C),B(ue.$$.fragment,C),B(T),B(je.$$.fragment,C),B(k),We=!1},d(C){C&&y(e),oe(i),oe(c),$e&&$e.d(),oe(S),oe(F),oe(I),oe(O),ge&&ge.d(),Le&&Le.d(),Me&&Me.d(),oe(ue),T&&T.d(),oe(je),k&&k.d()}}}function nm(t,e,l){let{data:n={}}=e,i={},o={};function u(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!oi(i.board)||confirm(Cs(ve(i.chip,i.board))))&&(Yt.update(a=>(a.upgrading=!0,a)),Qc(o.tag_name))}return Yt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&T1()}),No.subscribe(a=>{l(2,o=Xc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,u]}class im extends De{constructor(e){super(),Pe(this,e,nm,lm,Ne,{data:0})}}function sm(t){let e,l,n,i;return{c(){e=Te("svg"),l=Te("path"),n=Te("path"),r(l,"d",Qs(150,150,115,210,510)),r(l,"stroke","rgba(128, 128, 128, 0.15)"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=Qs(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,u){M(o,e,u),s(e,l),s(e,n)},p(o,[u]){u&1&&i!==(i=Qs(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),u&2&&r(n,"stroke",o[1])},i:_e,o:_e,d(o){o&&y(e)}}}function Za(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 Qs(t,e,l,n,i){var o=Za(t,e,l,i),u=Za(t,e,l,n),a=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,a,0,u.x,u.y].join(" ");return c}function om(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 rm extends De{constructor(e){super(),Pe(this,e,om,sm,Ne,{pct:0,color:1})}}function Ja(t){let e,l,n,i,o,u,a,c;return{c(){e=m("br"),l=h(),n=m("span"),i=N(t[3]),o=h(),u=m("span"),a=N(t[4]),c=N("/kWh"),r(n,"class","pl-sub"),r(u,"class","pl-snt")},m(f,p){M(f,e,p),M(f,l,p),M(f,n,p),s(n,i),M(f,o,p),M(f,u,p),s(u,a),s(u,c)},p(f,p){p&8&&X(i,f[3]),p&16&&X(a,f[4])},d(f){f&&y(e),f&&y(l),f&&y(n),f&&y(o),f&&y(u)}}}function am(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w;l=new rm({props:{pct:t[6],color:t[5](t[6])}});let $=t[3]&&Ja(t);return{c(){e=m("div"),re(l.$$.fragment),n=h(),i=m("span"),o=m("span"),u=N(t[2]),a=h(),c=m("br"),f=h(),p=m("span"),_=N(t[0]),b=h(),v=m("span"),d=N(t[1]),g=h(),$&&$.c(),r(o,"class","pl-lab"),r(p,"class","pl-val"),r(v,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(S,P){M(S,e,P),se(l,e,null),s(e,n),s(e,i),s(i,o),s(o,u),s(i,a),s(i,c),s(i,f),s(i,p),s(p,_),s(i,b),s(i,v),s(v,d),s(i,g),$&&$.m(i,null),w=!0},p(S,[P]){const F={};P&64&&(F.pct=S[6]),P&96&&(F.color=S[5](S[6])),l.$set(F),(!w||P&4)&&X(u,S[2]),(!w||P&1)&&X(_,S[0]),(!w||P&2)&&X(d,S[1]),S[3]?$?$.p(S,P):($=Ja(S),$.c(),$.m(i,null)):$&&($.d(1),$=null)},i(S){w||(R(l.$$.fragment,S),w=!0)},o(S){B(l.$$.fragment,S),w=!1},d(S){S&&y(e),oe(l),$&&$.d()}}}function um(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:a=""}=e,{subunit:c=""}=e,{colorFn:f}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,u=_.label),"sub"in _&&l(3,a=_.sub),"subunit"in _&&l(4,c=_.subunit),"colorFn"in _&&l(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,u,a,c,f,p,i]}class xc extends De{constructor(e){super(),Pe(this,e,um,am,Ne,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function xa(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function eu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function tu(t,e,l){const n=t.slice();return n[15]=e[l],n}function lu(t){let e,l,n,i,o,u,a=t[0].title&&nu(t),c=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(o,u){M(o,e,u),s(e,n),i=bo(e,t[9].bind(e))},p(o,u){u&1&&l!==(l=o[0].title+"")&&X(n,l)},d(o){o&&y(e),i()}}}function iu(t){let e,l,n,i=t[15].label+"",o,u,a,c;return{c(){e=Te("g"),l=Te("line"),n=Te("text"),o=N(i),r(l,"x2","100%"),r(n,"y","-4"),r(n,"x",u=t[15].align=="right"?"85%":""),r(e,"class",a="tick tick-"+t[15].value+" tick-"+t[15].color),r(e,"transform",c="translate(0, "+t[7](t[15].value)+")")},m(f,p){M(f,e,p),s(e,l),s(e,n),s(n,o)},p(f,p){p&1&&i!==(i=f[15].label+"")&&X(o,i),p&1&&u!==(u=f[15].align=="right"?"85%":"")&&r(n,"x",u),p&1&&a!==(a="tick tick-"+f[15].value+" tick-"+f[15].color)&&r(e,"class",a),p&129&&c!==(c="translate(0, "+f[7](f[15].value)+")")&&r(e,"transform",c)},d(f){f&&y(e)}}}function su(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&iu(t);return{c(){n&&n.c(),l=Ke()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,o):(n=iu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&y(l)}}}function ou(t){let e,l,n=(t[3]>20||t[13]%2==0)&&ru(t);return{c(){e=Te("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){M(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=ru(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&y(e),n&&n.d()}}}function ru(t){let e,l=t[11].label+"",n,i;return{c(){e=Te("text"),n=N(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,u){M(o,e,u),s(e,n)},p(o,u){u&1&&l!==(l=o[11].label+"")&&X(n,l),u&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&y(e)}}}function au(t){let e=!isNaN(t[6](t[13])),l,n=e&&ou(t);return{c(){n&&n.c(),l=Ke()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,o):(n=ou(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&y(l)}}}function uu(t){let e,l,n=t[11].value!==void 0&&fu(t),i=t[11].value2>1e-4&&pu(t);return{c(){e=Te("g"),n&&n.c(),l=Te("g"),i&&i.c()},m(o,u){M(o,e,u),n&&n.m(e,null),M(o,l,u),i&&i.m(l,null)},p(o,u){o[11].value!==void 0?n?n.p(o,u):(n=fu(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[11].value2>1e-4?i?i.p(o,u):(i=pu(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&y(e),n&&n.d(),o&&y(l),i&&i.d()}}}function fu(t){let e,l,n,i,o,u,a,c=t[3]>15&&cu(t);return{c(){e=Te("rect"),c&&c.c(),a=Ke(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](t[11].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),r(e,"fill",u=t[11].color)},m(f,p){M(f,e,p),c&&c.m(f,p),M(f,a,p)},p(f,p){p&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),p&129&&n!==(n=f[7](f[11].value))&&r(e,"y",n),p&8&&i!==(i=f[3]-4)&&r(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&r(e,"height",o),p&1&&u!==(u=f[11].color)&&r(e,"fill",u),f[3]>15?c?c.p(f,p):(c=cu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&y(e),c&&c.d(f),f&&y(a)}}}function cu(t){let e,l=t[11].label+"",n,i,o,u,a,c,f=t[11].title&&mu(t);return{c(){e=Te("text"),n=N(l),f&&f.c(),c=Ke(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[7](0)-t[8]?t[11].color:"white"),r(e,"transform",a="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[3]p[7](0)-p[8]?p[11].color:"white")&&r(e,"fill",u),_&457&&a!==(a="translate("+(p[6](p[13])+p[3]/2)+" "+(p[7](p[11].value)>p[7](0)-p[8]?p[7](p[11].value)-p[8]:p[7](p[11].value)+10)+") rotate("+(p[3]15&&_u(t);return{c(){e=Te("rect"),c&&c.c(),a=Ke(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),r(e,"fill",u=t[11].color2?t[11].color2:t[11].color)},m(f,p){M(f,e,p),c&&c.m(f,p),M(f,a,p)},p(f,p){p&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),p&128&&n!==(n=f[7](0))&&r(e,"y",n),p&8&&i!==(i=f[3]-4)&&r(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&r(e,"height",o),p&1&&u!==(u=f[11].color2?f[11].color2:f[11].color)&&r(e,"fill",u),f[3]>15?c?c.p(f,p):(c=_u(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&y(e),c&&c.d(f),f&&y(a)}}}function _u(t){let e,l=t[11].label2+"",n,i,o,u,a,c=t[11].title2&&du(t);return{c(){e=Te("text"),n=N(l),c&&c.c(),a=Ke(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(i,o){M(i,e,o),n&&n.m(e,null),l=bo(e,t[10].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=lu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:_e,o:_e,d(i){i&&y(e),n&&n.d(),l()}}}let cn=30;function cm(t,e,l){let{config:n}=e,i,o,u,a,c,f,p,_=0;function b(){_=this.clientHeight,l(5,_)}function v(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,f=o-_);let d=i-(n.padding.left+n.padding.right);l(3,u=d/n.points.length),l(8,p=un.y.max?$=n.padding.bottom:wf||$<0?0:$})}},[n,i,o,u,f,_,a,c,p,b,v]}class pn extends De{constructor(e){super(),Pe(this,e,cm,fm,Ne,{config:0})}}function mm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function pm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,a={};function c(f){return{label:be(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:C1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],p=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),p.push(c(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),p.push(c(i))),o>0&&(f.push({label:u===1?"L2-L3":"L3"}),p.push(c(o))),l(0,a={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:p})}},[a,n,i,o,u]}class _m extends De{constructor(e){super(),Pe(this,e,pm,mm,Ne,{u1:1,u2:2,u3:3,ds:4})}}function dm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function vm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:u}=e,{i2:a}=e,{i2e:c}=e,{i3:f}=e,{max:p}=e,_={};function b(v,d){return{label:be(v)+"A",title:(d?"Estimated ":"")+v.toFixed(1)+" A",value:isNaN(v)?0:v,color:qc(v?v/p*100:0,d)}}return t.$$set=v=>{"u1"in v&&l(1,n=v.u1),"u2"in v&&l(2,i=v.u2),"u3"in v&&l(3,o=v.u3),"i1"in v&&l(4,u=v.i1),"i2"in v&&l(5,a=v.i2),"i2e"in v&&l(6,c=v.i2e),"i3"in v&&l(7,f=v.i3),"max"in v&&l(8,p=v.max)},t.$$.update=()=>{if(t.$$.dirty&510){let v=[],d=[];n>0&&(v.push({label:"L1"}),d.push(b(u))),i>0&&(v.push({label:"L2"}),d.push(b(a,c))),o>0&&(v.push({label:"L3"}),d.push(b(f))),l(0,_={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:p,ticks:[{value:0,label:"0%"},{value:p/4,label:"25%"},{value:p/2,label:"50%"},{value:p/4*3,label:"75%"},{value:p,label:"100%"}]},x:{ticks:v},points:d})}},[_,n,i,o,u,a,c,f,p]}class hm extends De{constructor(e){super(),Pe(this,e,vm,dm,Ne,{u1:1,u2:2,u3:3,i1:4,i2:5,i2e:6,i3:7,max:8})}}function bm(t){let e,l,n,i,o,u,a,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,p,_,b,v,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",w,$,S,P,F,A,I,D=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",O,ie,j,K,G,Y,Q=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",z,Z;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",u=h(),a=m("div"),f=N(c),p=N(" VAr"),_=h(),b=m("div"),b.textContent="Instant out",v=h(),d=m("div"),w=N(g),$=N(" VAr"),S=h(),P=m("div"),F=m("div"),F.textContent="Total in",A=h(),I=m("div"),O=N(D),ie=N(" kVArh"),j=h(),K=m("div"),K.textContent="Total out",G=h(),Y=m("div"),z=N(Q),Z=N(" kVArh"),r(a,"class","text-right"),r(d,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(I,"class","text-right"),r(Y,"class","text-right"),r(P,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(V,H){M(V,e,H),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(i,a),s(a,f),s(a,p),s(i,_),s(i,b),s(i,v),s(i,d),s(d,w),s(d,$),s(e,S),s(e,P),s(P,F),s(P,A),s(P,I),s(I,O),s(I,ie),s(P,j),s(P,K),s(P,G),s(P,Y),s(Y,z),s(Y,Z)},p(V,[H]){H&1&&c!==(c=(typeof V[0]<"u"?V[0].toFixed(0):"-")+"")&&X(f,c),H&2&&g!==(g=(typeof V[1]<"u"?V[1].toFixed(0):"-")+"")&&X(w,g),H&4&&D!==(D=(typeof V[2]<"u"?V[2].toFixed(1):"-")+"")&&X(O,D),H&8&&Q!==(Q=(typeof V[3]<"u"?V[3].toFixed(1):"-")+"")&&X(z,Q)},i:_e,o:_e,d(V){V&&y(e)}}}function gm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=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,u=a.exportTotal)},[n,i,o,u]}class km extends De{constructor(e){super(),Pe(this,e,gm,bm,Ne,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function hu(t){let e;function l(o,u){return o[3]?ym:wm}let n=l(t),i=n(t);return{c(){i.c(),e=Ke()},m(o,u){i.m(o,u),M(o,e,u)},p(o,u){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&y(e)}}}function wm(t){let e,l,n,i,o,u,a=be(t[1].h.u,2)+"",c,f,p,_,b,v,d=be(t[1].d.u,1)+"",g,w,$,S,P,F,A=be(t[1].m.u)+"",I,D,O,ie,j,K,G=be(t[0].last_month.u)+"",Y,Q,z,Z,V=t[4]&&bu(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=N(a),f=N(" kWh"),p=h(),_=m("div"),_.textContent="Day",b=h(),v=m("div"),g=N(d),w=N(" kWh"),$=h(),S=m("div"),S.textContent="Month",P=h(),F=m("div"),I=N(A),D=N(" kWh"),O=h(),ie=m("div"),ie.textContent="Last month",j=h(),K=m("div"),Y=N(G),Q=N(" kWh"),z=h(),V&&V.c(),Z=Ke(),r(u,"class","text-right"),r(v,"class","text-right"),r(F,"class","text-right"),r(K,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(H,ee){M(H,e,ee),M(H,l,ee),M(H,n,ee),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(n,p),s(n,_),s(n,b),s(n,v),s(v,g),s(v,w),s(n,$),s(n,S),s(n,P),s(n,F),s(F,I),s(F,D),s(n,O),s(n,ie),s(n,j),s(n,K),s(K,Y),s(K,Q),M(H,z,ee),V&&V.m(H,ee),M(H,Z,ee)},p(H,ee){ee&2&&a!==(a=be(H[1].h.u,2)+"")&&X(c,a),ee&2&&d!==(d=be(H[1].d.u,1)+"")&&X(g,d),ee&2&&A!==(A=be(H[1].m.u)+"")&&X(I,A),ee&1&&G!==(G=be(H[0].last_month.u)+"")&&X(Y,G),H[4]?V?V.p(H,ee):(V=bu(H),V.c(),V.m(Z.parentNode,Z)):V&&(V.d(1),V=null)},d(H){H&&y(e),H&&y(l),H&&y(n),H&&y(z),V&&V.d(H),H&&y(Z)}}}function ym(t){let e,l,n,i,o,u,a=be(t[1].h.u,2)+"",c,f,p,_,b,v,d,g=be(t[1].d.u,1)+"",w,$,S,P,F,A,I,D=be(t[1].m.u)+"",O,ie,j,K,G,Y,Q,z=be(t[0].last_month.u)+"",Z,V,H,ee,ue,x,W,U,ke,je,Be,We=be(t[1].h.p,2)+"",$e,ge,Le,Me,T,k,C,E=be(t[1].d.p,1)+"",L,J,te,fe,de,we,Ee,ae=be(t[1].m.p)+"",Ce,Je,Et,st,ht,lt,At,Ye=be(t[0].last_month.p)+"",Qt,jt,bt,ze,xe=t[4]&&gu(t),Xe=t[4]&&ku(t),Ue=t[4]&&wu(t),qe=t[4]&&yu(t),et=t[4]&&Cu(t),Ae=t[4]&&Mu(t),Oe=t[4]&&Su(t),pe=t[4]&&Tu(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=N(a),f=N(" kWh"),p=h(),xe&&xe.c(),_=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),w=N(g),$=N(" kWh"),S=h(),Xe&&Xe.c(),P=h(),F=m("div"),F.textContent="Month",A=h(),I=m("div"),O=N(D),ie=N(" kWh"),j=h(),Ue&&Ue.c(),K=h(),G=m("div"),G.textContent="Last mo.",Y=h(),Q=m("div"),Z=N(z),V=N(" kWh"),H=h(),qe&&qe.c(),ue=h(),x=m("strong"),x.textContent="Export",W=h(),U=m("div"),ke=m("div"),ke.textContent="Hour",je=h(),Be=m("div"),$e=N(We),ge=N(" kWh"),Le=h(),et&&et.c(),Me=h(),T=m("div"),T.textContent="Day",k=h(),C=m("div"),L=N(E),J=N(" kWh"),te=h(),Ae&&Ae.c(),fe=h(),de=m("div"),de.textContent="Month",we=h(),Ee=m("div"),Ce=N(ae),Je=N(" kWh"),Et=h(),Oe&&Oe.c(),st=h(),ht=m("div"),ht.textContent="Last mo.",lt=h(),At=m("div"),Qt=N(Ye),jt=N(" kWh"),bt=h(),pe&&pe.c(),r(u,"class","text-right"),r(d,"class","text-right"),r(I,"class","text-right"),r(Q,"class","text-right"),r(n,"class",ee="grid grid-cols-"+t[5]+" mb-3"),r(Be,"class","text-right"),r(C,"class","text-right"),r(Ee,"class","text-right"),r(At,"class","text-right"),r(U,"class",ze="grid grid-cols-"+t[5])},m(ce,ye){M(ce,e,ye),M(ce,l,ye),M(ce,n,ye),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(n,p),xe&&xe.m(n,null),s(n,_),s(n,b),s(n,v),s(n,d),s(d,w),s(d,$),s(n,S),Xe&&Xe.m(n,null),s(n,P),s(n,F),s(n,A),s(n,I),s(I,O),s(I,ie),s(n,j),Ue&&Ue.m(n,null),s(n,K),s(n,G),s(n,Y),s(n,Q),s(Q,Z),s(Q,V),s(n,H),qe&&qe.m(n,null),M(ce,ue,ye),M(ce,x,ye),M(ce,W,ye),M(ce,U,ye),s(U,ke),s(U,je),s(U,Be),s(Be,$e),s(Be,ge),s(U,Le),et&&et.m(U,null),s(U,Me),s(U,T),s(U,k),s(U,C),s(C,L),s(C,J),s(U,te),Ae&&Ae.m(U,null),s(U,fe),s(U,de),s(U,we),s(U,Ee),s(Ee,Ce),s(Ee,Je),s(U,Et),Oe&&Oe.m(U,null),s(U,st),s(U,ht),s(U,lt),s(U,At),s(At,Qt),s(At,jt),s(U,bt),pe&&pe.m(U,null)},p(ce,ye){ye&2&&a!==(a=be(ce[1].h.u,2)+"")&&X(c,a),ce[4]?xe?xe.p(ce,ye):(xe=gu(ce),xe.c(),xe.m(n,_)):xe&&(xe.d(1),xe=null),ye&2&&g!==(g=be(ce[1].d.u,1)+"")&&X(w,g),ce[4]?Xe?Xe.p(ce,ye):(Xe=ku(ce),Xe.c(),Xe.m(n,P)):Xe&&(Xe.d(1),Xe=null),ye&2&&D!==(D=be(ce[1].m.u)+"")&&X(O,D),ce[4]?Ue?Ue.p(ce,ye):(Ue=wu(ce),Ue.c(),Ue.m(n,K)):Ue&&(Ue.d(1),Ue=null),ye&1&&z!==(z=be(ce[0].last_month.u)+"")&&X(Z,z),ce[4]?qe?qe.p(ce,ye):(qe=yu(ce),qe.c(),qe.m(n,null)):qe&&(qe.d(1),qe=null),ye&32&&ee!==(ee="grid grid-cols-"+ce[5]+" mb-3")&&r(n,"class",ee),ye&2&&We!==(We=be(ce[1].h.p,2)+"")&&X($e,We),ce[4]?et?et.p(ce,ye):(et=Cu(ce),et.c(),et.m(U,Me)):et&&(et.d(1),et=null),ye&2&&E!==(E=be(ce[1].d.p,1)+"")&&X(L,E),ce[4]?Ae?Ae.p(ce,ye):(Ae=Mu(ce),Ae.c(),Ae.m(U,fe)):Ae&&(Ae.d(1),Ae=null),ye&2&&ae!==(ae=be(ce[1].m.p)+"")&&X(Ce,ae),ce[4]?Oe?Oe.p(ce,ye):(Oe=Su(ce),Oe.c(),Oe.m(U,st)):Oe&&(Oe.d(1),Oe=null),ye&1&&Ye!==(Ye=be(ce[0].last_month.p)+"")&&X(Qt,Ye),ce[4]?pe?pe.p(ce,ye):(pe=Tu(ce),pe.c(),pe.m(U,null)):pe&&(pe.d(1),pe=null),ye&32&&ze!==(ze="grid grid-cols-"+ce[5])&&r(U,"class",ze)},d(ce){ce&&y(e),ce&&y(l),ce&&y(n),xe&&xe.d(),Xe&&Xe.d(),Ue&&Ue.d(),qe&&qe.d(),ce&&y(ue),ce&&y(x),ce&&y(W),ce&&y(U),et&&et.d(),Ae&&Ae.d(),Oe&&Oe.d(),pe&&pe.d()}}}function bu(t){let e,l,n,i,o,u,a=be(t[1].h.c,2)+"",c,f,p,_,b,v,d,g=be(t[1].d.c,1)+"",w,$,S,P,F,A,I,D=be(t[1].m.c)+"",O,ie,j,K,G,Y,Q,z=be(t[0].last_month.c)+"",Z,V,H;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=N(a),f=h(),p=N(t[2]),_=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),w=N(g),$=h(),S=N(t[2]),P=h(),F=m("div"),F.textContent="Month",A=h(),I=m("div"),O=N(D),ie=h(),j=N(t[2]),K=h(),G=m("div"),G.textContent="Last month",Y=h(),Q=m("div"),Z=N(z),V=h(),H=N(t[2]),r(u,"class","text-right"),r(d,"class","text-right"),r(I,"class","text-right"),r(Q,"class","text-right"),r(n,"class","grid grid-cols-2")},m(ee,ue){M(ee,e,ue),M(ee,l,ue),M(ee,n,ue),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(u,p),s(n,_),s(n,b),s(n,v),s(n,d),s(d,w),s(d,$),s(d,S),s(n,P),s(n,F),s(n,A),s(n,I),s(I,O),s(I,ie),s(I,j),s(n,K),s(n,G),s(n,Y),s(n,Q),s(Q,Z),s(Q,V),s(Q,H)},p(ee,ue){ue&2&&a!==(a=be(ee[1].h.c,2)+"")&&X(c,a),ue&4&&X(p,ee[2]),ue&2&&g!==(g=be(ee[1].d.c,1)+"")&&X(w,g),ue&4&&X(S,ee[2]),ue&2&&D!==(D=be(ee[1].m.c)+"")&&X(O,D),ue&4&&X(j,ee[2]),ue&1&&z!==(z=be(ee[0].last_month.c)+"")&&X(Z,z),ue&4&&X(H,ee[2])},d(ee){ee&&y(e),ee&&y(l),ee&&y(n)}}}function gu(t){let e,l=be(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=h(),o=N(t[2]),r(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].h.c,2)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function ku(t){let e,l=be(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=h(),o=N(t[2]),r(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].d.c,1)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function wu(t){let e,l=be(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=h(),o=N(t[2]),r(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].m.c)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function yu(t){let e,l=be(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=h(),o=N(t[2]),r(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=be(u[0].last_month.c)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function Cu(t){let e,l=be(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=h(),o=N(t[2]),r(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].h.i,2)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function Mu(t){let e,l=be(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=h(),o=N(t[2]),r(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].d.i,1)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function Su(t){let e,l=be(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=h(),o=N(t[2]),r(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].m.i)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function Tu(t){let e,l=be(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=h(),o=N(t[2]),r(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=be(u[0].last_month.i)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function Cm(t){let e,l,n,i,o,u,a=t[1]&&hu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),u=h(),a&&a.c(),r(e,"class","mx-2 text-sm")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,u),a&&a.m(e,null)},p(c,[f]){c[1]?a?a.p(c,f):(a=hu(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:_e,o:_e,d(c){c&&y(e),a&&a.d()}}}function Mm(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,a=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=a?3:2))},[n,i,o,u,a,c]}class Sm extends De{constructor(e){super(),Pe(this,e,Mm,Cm,Ne,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Tm(t){let e,l,n=Ua(t[0].source)+"",i,o,u,a,c;return a=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=N("Provided by: "),i=N(n),u=h(),re(a.$$.fragment),r(e,"href",o=Ha(t[0].source)),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(f,p){M(f,e,p),s(e,l),s(e,i),M(f,u,p),se(a,f,p),c=!0},p(f,[p]){(!c||p&1)&&n!==(n=Ua(f[0].source)+"")&&X(i,n),(!c||p&1&&o!==(o=Ha(f[0].source)))&&r(e,"href",o);const _={};p&2&&(_.config=f[1]),a.$set(_)},i(f){c||(R(a.$$.fragment,f),c=!0)},o(f){B(a.$$.fragment,f),c=!1},d(f){f&&y(e),f&&y(u),oe(a,f)}}}function Nm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},u,a;return t.$$set=c=>{"json"in c&&l(0,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let c=n.currency,f=new Date().getUTCHours(),p=0,_=0,b=0,v=[],d=[],g=[];l(4,a=l(3,u=0));let w=new Date;for(dl(w,i.clock_offset-(24+w.getHours()-w.getUTCHours())%24),p=f;p<24&&(_=n[Fe(b++)],_!=null);p++)d.push({label:Fe(w.getHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,u=Math.max(u,_*100)),dl(w,1);for(p=0;p<24&&(_=n[Fe(b++)],_!=null);p++)d.push({label:Fe(w.getHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,u=Math.max(u,_*100)),dl(w,1);if(a>-100&&u<100){switch(c){case"NOK":case"DKK":c="\xF8re";break;case"SEK":c="\xF6re";break;case"EUR":c="cent";break;case"CHF":c="rp.";break;default:c=c+"/100"}for(l(4,a*=100),l(3,u*=100),p=0;p=0?A.toFixed(I):"",title:A>=0?A.toFixed(2)+" "+c:"",value:_>=0?Math.abs(_):0,label2:A<0?A.toFixed(I):"",title2:A<0?A.toFixed(2)+" "+c:"",value2:_<0?Math.abs(_):0,color:"#7c3aed"})}let S=Math.max(u,Math.abs(a));if(a<0){l(4,a=Math.min(S/4*-1,a));let A=Math.ceil(Math.abs(a)/S*4),I=a/A;for(p=1;p{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],p=[],_=[];l(4,a=l(3,u=0));let b=dl(new Date,-24),v=new Date().getUTCHours();for(dl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),c=v;c<24;c++){let $=n["i"+Fe(c)],S=n["e"+Fe(c)];$===void 0&&($=0),S===void 0&&(S=0),p.push({label:Fe(b.getHours())}),_.push({label:$.toFixed(1),title:$.toFixed(2)+" kWh",value:$*10,label2:S.toFixed(1),title2:S.toFixed(2)+" kWh",value2:S*10,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,S*10)),l(3,u=Math.max(u,$*10)),dl(b,1)}for(c=0;c{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],p=[],_=[];l(4,a=l(3,u=0));let b=new Date,v=new Date;for(dl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),dl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),v.setDate(0),c=b.getDate();c<=v.getDate();c++){let $=n["i"+Fe(c)],S=n["e"+Fe(c)];$===void 0&&($=0),S===void 0&&(S=0),p.push({label:Fe(c)}),_.push({label:$.toFixed($<10?1:0),title:$.toFixed(2)+" kWh",value:$,label2:S.toFixed(S<10?1:0),title2:S.toFixed(2)+" kWh",value2:S,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,S)),l(3,u=Math.max(u,$))}for(c=1;c{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=0,f=[],p=[],_=[];n.s&&n.s.forEach((d,g)=>{var w=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),p.push({label:w.slice(-4)}),_.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,u=Math.min(u,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,u=Math.floor(u));let b=o;u<0&&(b+=Math.abs(u));let v=b/4;for(a=0;a<5;a++)c=u+v*a,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:u,max:o,ticks:f},x:{ticks:p},points:_})}},[i,n,o,u]}class Fm extends De{constructor(e){super(),Pe(this,e,Om,Lm,Ne,{json:1})}}function qm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}let Bm=0;function Um(t,e,l){let n={},i=0,o;return Kc.subscribe(u=>{l(2,o=u)}),Vc(),t.$$.update=()=>{if(t.$$.dirty&6){let u=0,a=[],c=[],f=[];if(a.push({value:0,label:0}),o&&o.p)for(u=0;u0?Fe(p.d)+"."+to[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,p.v))}if(o&&o.t){for(u=0;u=i)break;a.push({value:p,label:p})}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:Bm,max:i,ticks:a},x:{ticks:c},points:f})}},[n,i,o]}class Hm extends De{constructor(e){super(),Pe(this,e,Um,qm,Ne,{})}}function Nu(t,e,l){const n=t.slice();return n[18]=e[l],n[20]=l,n}function $u(t,e,l){const n=t.slice();return n[21]=e[l],n}function Eu(t){let e,l,n,i,o,u=t[7],a=[];for(let p=0;pt[14].call(e))},m(f,p){M(f,e,p),s(e,l),s(l,n),s(l,i),s(l,o),s(e,u),c&&c.m(e,null),a=bo(e,t[14].bind(e))},p(f,[p]){p&1024&&X(i,f[10]),f[7]?c?c.p(f,p):(c=Eu(f),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:_e,o:_e,d(f){f&&y(e),c&&c.d(),a()}}}let Wm=12;function zm(t,e,l){let n;Yc.subscribe(A=>{l(11,n=A)});let i,o=0;function u(){n.data.unshift(0),l(11,n.data=n.data.slice(0,n.size),n),o+=10,i=setTimeout(u,1e4)}Bc.subscribe(A=>{o>0?n.data&&A.u-o>=10&&(i&&clearTimeout(i),n.data.unshift(A.i-A.e),l(11,n.data=n.data.slice(0,n.size),n),o+=10,i=setTimeout(u,1e4)):o=A.u});let a,c,f,p,_,b,v,d,g,w,$,S,P;function F(){f=this.clientWidth,p=this.clientHeight,l(0,f),l(1,p)}return t.$$.update=()=>{if(t.$$.dirty&14847&&(l(2,_=parseInt(p)-50),l(3,b=f-35),l(9,S=b/n.size),l(13,c=0),l(12,a=0),n.data)){for(let I in n.data){let D=n.data[I];l(12,a=Math.max(Math.ceil(D/1e3)*1e3,a)),l(13,c=Math.min(Math.ceil(D/1e3)*1e3,c))}l(10,P=a>2500?"kW":"W"),l(7,w=[]);for(let I=c;I2500?(I/1e3).toFixed(1):I});l(8,$=[]);for(let I=c;I0||t[0].e>0}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function Hu(t){let e,l,n;return l=new Hm({}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){M(i,e,o),se(l,e,null),n=!0},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function ju(t){let e,l,n;return l=new Gm({}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(l,e,null),n=!0},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function Wu(t){let e,l,n;return l=new $m({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function zu(t){let e,l,n;return l=new Pm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function Gu(t){let e,l,n;return l=new Rm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function Vu(t){let e,l,n;return l=new Fm({props:{json:t[5]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&32&&(u.json=i[5]),l.$set(u)},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function Vm(t){let e,l=Qe(t[1].ui.i,t[0].i),n,i=Qe(t[1].ui.e,t[0].om||t[0].e>0),o,u=Qe(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,c=Qe(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,p=Qe(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,b=Qe(t[1].ui.c,t[0].ea),v,d=Qe(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),g,w=Qe(t[1].ui.l),$,S=Qe(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),P,F=Qe(t[1].ui.d,t[3]),A,I=Qe(t[1].ui.m,t[4]),D,O=Qe(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),ie,j=l&&Lu(t),K=i&&Ou(t),G=u&&Fu(t),Y=c&&qu(t),Q=p&&Bu(t),z=b&&Uu(t),Z=d&&Hu(),V=w&&ju(),H=S&&Wu(t),ee=F&&zu(t),ue=I&&Gu(t),x=O&&Vu(t);return{c(){e=m("div"),j&&j.c(),n=h(),K&&K.c(),o=h(),G&&G.c(),a=h(),Y&&Y.c(),f=h(),Q&&Q.c(),_=h(),z&&z.c(),v=h(),Z&&Z.c(),g=h(),V&&V.c(),$=h(),H&&H.c(),P=h(),ee&&ee.c(),A=h(),ue&&ue.c(),D=h(),x&&x.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(W,U){M(W,e,U),j&&j.m(e,null),s(e,n),K&&K.m(e,null),s(e,o),G&&G.m(e,null),s(e,a),Y&&Y.m(e,null),s(e,f),Q&&Q.m(e,null),s(e,_),z&&z.m(e,null),s(e,v),Z&&Z.m(e,null),s(e,g),V&&V.m(e,null),s(e,$),H&&H.m(e,null),s(e,P),ee&&ee.m(e,null),s(e,A),ue&&ue.m(e,null),s(e,D),x&&x.m(e,null),ie=!0},p(W,[U]){U&3&&(l=Qe(W[1].ui.i,W[0].i)),l?j?(j.p(W,U),U&3&&R(j,1)):(j=Lu(W),j.c(),R(j,1),j.m(e,n)):j&&(Ie(),B(j,1,1,()=>{j=null}),Re()),U&3&&(i=Qe(W[1].ui.e,W[0].om||W[0].e>0)),i?K?(K.p(W,U),U&3&&R(K,1)):(K=Ou(W),K.c(),R(K,1),K.m(e,o)):K&&(Ie(),B(K,1,1,()=>{K=null}),Re()),U&3&&(u=Qe(W[1].ui.v,W[0].u1>100||W[0].u2>100||W[0].u3>100)),u?G?(G.p(W,U),U&3&&R(G,1)):(G=Fu(W),G.c(),R(G,1),G.m(e,a)):G&&(Ie(),B(G,1,1,()=>{G=null}),Re()),U&3&&(c=Qe(W[1].ui.a,W[0].i1>.01||W[0].i2>.01||W[0].i3>.01)),c?Y?(Y.p(W,U),U&3&&R(Y,1)):(Y=qu(W),Y.c(),R(Y,1),Y.m(e,f)):Y&&(Ie(),B(Y,1,1,()=>{Y=null}),Re()),U&3&&(p=Qe(W[1].ui.r,W[0].ri>0||W[0].re>0||W[0].ric>0||W[0].rec>0)),p?Q?(Q.p(W,U),U&3&&R(Q,1)):(Q=Bu(W),Q.c(),R(Q,1),Q.m(e,_)):Q&&(Ie(),B(Q,1,1,()=>{Q=null}),Re()),U&3&&(b=Qe(W[1].ui.c,W[0].ea)),b?z?(z.p(W,U),U&3&&R(z,1)):(z=Uu(W),z.c(),R(z,1),z.m(e,v)):z&&(Ie(),B(z,1,1,()=>{z=null}),Re()),U&3&&(d=Qe(W[1].ui.t,W[0].pr&&(W[0].pr.startsWith("10YNO")||W[0].pr.startsWith("10Y1001A1001A4")))),d?Z?U&3&&R(Z,1):(Z=Hu(),Z.c(),R(Z,1),Z.m(e,g)):Z&&(Ie(),B(Z,1,1,()=>{Z=null}),Re()),U&2&&(w=Qe(W[1].ui.l)),w?V?U&2&&R(V,1):(V=ju(),V.c(),R(V,1),V.m(e,$)):V&&(Ie(),B(V,1,1,()=>{V=null}),Re()),U&3&&(S=Qe(W[1].ui.p,W[0].pe&&!Number.isNaN(W[0].p))),S?H?(H.p(W,U),U&3&&R(H,1)):(H=Wu(W),H.c(),R(H,1),H.m(e,P)):H&&(Ie(),B(H,1,1,()=>{H=null}),Re()),U&10&&(F=Qe(W[1].ui.d,W[3])),F?ee?(ee.p(W,U),U&10&&R(ee,1)):(ee=zu(W),ee.c(),R(ee,1),ee.m(e,A)):ee&&(Ie(),B(ee,1,1,()=>{ee=null}),Re()),U&18&&(I=Qe(W[1].ui.m,W[4])),I?ue?(ue.p(W,U),U&18&&R(ue,1)):(ue=Gu(W),ue.c(),R(ue,1),ue.m(e,D)):ue&&(Ie(),B(ue,1,1,()=>{ue=null}),Re()),U&35&&(O=Qe(W[1].ui.s,W[0].t&&W[0].t!=-127&&W[5].c>1)),O?x?(x.p(W,U),U&35&&R(x,1)):(x=Vu(W),x.c(),R(x,1),x.m(e,null)):x&&(Ie(),B(x,1,1,()=>{x=null}),Re())},i(W){ie||(R(j),R(K),R(G),R(Y),R(Q),R(z),R(Z),R(V),R(H),R(ee),R(ue),R(x),ie=!0)},o(W){B(j),B(K),B(G),B(Y),B(Q),B(z),B(Z),B(V),B(H),B(ee),B(ue),B(x),ie=!1},d(W){W&&y(e),j&&j.d(),K&&K.d(),G&&G.d(),Y&&Y.d(),Q&&Q.d(),z&&z.d(),Z&&Z.d(),V&&V.d(),H&&H.d(),ee&&ee.d(),ue&&ue.d(),x&&x.d()}}}function Km(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},u={},a={},c={};return Mo.subscribe(f=>{l(2,o=f)}),jc.subscribe(f=>{l(3,u=f)}),Wc.subscribe(f=>{l(4,a=f)}),Gc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,u,a,c]}class Ym extends De{constructor(e){super(),Pe(this,e,Km,Vm,Ne,{data:0,sysinfo:1})}}let uo={};const yi=it(uo);async function Qm(){uo=await(await fetch("/configuration.json")).json(),yi.set(uo)}function Ku(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Xm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function Zm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function Yu(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function Qu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){M(i,e,o),M(i,l,o),M(i,n,o)},d(i){i&&y(e),i&&y(l),i&&y(n)}}}function Xu(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function Zu(t){let e,l,n;return{c(){e=m("option"),l=N("GPIO"),n=N(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){M(i,e,o),s(e,l),s(e,n)},d(i){i&&y(e)}}}function Ju(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!((t[0]=="esp32s2"||t[0]=="esp32s3")&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Zu(t);return{c(){l&&l.c(),e=Ke()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!((n[0]=="esp32s2"||n[0]=="esp32s3")&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Zu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&y(e)}}}function Jm(t){let e,l,n,i,o;function u(d,g){return d[0]=="esp32c3"?Zm:Xm}let a=u(t),c=a(t),f=t[0]=="esp8266"&&Yu(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&Qu(),_=(t[0]=="esp32s2"||t[0]=="esp32s3")&&Xu(),b={length:t[1]+1},v=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32s3":l(1,i=46);break;case"esp32c3":l(1,i=19);break}},[n,i]}class fo extends De{constructor(e){super(),Pe(this,e,xm,Jm,Ne,{chip:0})}}function xu(t){let e,l,n=t[1]&&ef(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){M(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=ef(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&y(e),n&&n.d()}}}function ef(t){let e,l;return{c(){e=m("div"),l=N(t[1]),r(e,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(n,i){M(n,e,i),s(e,l)},p(n,i){i&2&&X(l,n[1])},d(n){n&&y(e)}}}function ep(t){let e,l=t[0]&&xu(t);return{c(){l&&l.c(),e=Ke()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=xu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:_e,o:_e,d(n){l&&l.d(n),n&&y(e)}}}function tp(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 Ht extends De{constructor(e){super(),Pe(this,e,tp,ep,Ne,{active:0,message:1})}}function tf(t,e,l){const n=t.slice();return n[1]=e[l],n}function lf(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=N("Europe/"),i=N(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){M(o,e,u),s(e,l),s(e,i)},p:_e,d(o){o&&y(e)}}}function lp(t){let e,l,n,i=t[0],o=[];for(let u=0;u>1&1,E=0;E0;k--)E[k]=E[k]?E[k-1]^A.EXPONENT[O._modN(A.LOG[E[k]]+T)]:E[k-1];E[0]=A.EXPONENT[O._modN(A.LOG[E[0]]+T)]}for(T=0;T<=C;T++)E[T]=A.LOG[E[T]]},_checkBadness:function(){var T,k,C,E,L,J=0,te=this._badness,fe=this.buffer,de=this.width;for(L=0;Lde*de;)ae-=de*de,Ee++;for(J+=Ee*O.N4,E=0;E=te-2&&(T=te-2,L>9&&T--);var fe=T;if(L>9){for(J[fe+2]=0,J[fe+3]=0;fe--;)k=J[fe],J[fe+3]|=255&k<<4,J[fe+2]=k>>4;J[2]|=255&T<<4,J[1]=T>>4,J[0]=64|T>>12}else{for(J[fe+1]=0,J[fe+2]=0;fe--;)k=J[fe],J[fe+2]|=255&k<<4,J[fe+1]=k>>4;J[1]|=255&T<<4,J[0]=64|T>>4}for(fe=T+3-(L<10);fe=5&&(C+=O.N1+E[k]-5);for(k=3;kT||E[k-3]*3>=E[k]*4||E[k+3]*3>=E[k]*4)&&(C+=O.N3);return C},_finish:function(){this._stringBuffer=this.buffer.slice();var T,k,C=0,E=3e4;for(k=0;k<8&&(this._applyMask(k),T=this._checkBadness(),T>=1)E&1&&(L[J-1-k+J*8]=1,k<6?L[8+J*k]=1:L[8+J*(k+1)]=1);for(k=0;k<7;k++,E>>=1)E&1&&(L[8+J*(J-7+k)]=1,k?L[6-k+J*8]=1:L[7+J*8]=1)},_interleaveBlocks:function(){var T,k,C=this._dataBlock,E=this._ecc,L=this._eccBlock,J=0,te=this._calculateMaxLength(),fe=this._neccBlock1,de=this._neccBlock2,we=this._stringBuffer;for(T=0;T1)for(T=$.BLOCK[E],C=L-7;;){for(k=L-7;k>T-3&&(this._addAlignment(k,C),!(k6)for(T=D.BLOCK[J-7],k=17,C=0;C<6;C++)for(E=0;E<3;E++,k--)1&(k>11?J>>k-12:T>>k)?(L[5-C+te*(2-E+te-11)]=1,L[2-E+te-11+te*(5-C)]=1):(this._setMask(5-C,2-E+te-11),this._setMask(2-E+te-11,5-C))},_isMasked:function(T,k){var C=O._getMaskBit(T,k);return this._mask[C]===1},_pack:function(){var T,k,C,E=1,L=1,J=this.width,te=J-1,fe=J-1,de=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(k=0;kk&&(C=T,T=k,k=C),C=k,C+=k*k,C>>=1,C+=T,C},_modN:function(T){for(;T>=255;)T-=255,T=(T>>8)+(T&255);return T},N1:3,N2:3,N3:40,N4:10}),ie=O,j=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var T=this.element;T.width=T.height=this.qrious.size}}),K=j,G=_.extend(function(T,k,C,E){this.name=T,this.modifiable=Boolean(k),this.defaultValue=C,this._valueTransformer=E},{transform:function(T){var k=this._valueTransformer;return typeof k=="function"?k(T,this):T}}),Y=G,Q=_.extend(null,{abs:function(T){return T!=null?Math.abs(T):null},hasOwn:function(T,k){return Object.prototype.hasOwnProperty.call(T,k)},noop:function(){},toUpperCase:function(T){return T!=null?T.toUpperCase():null}}),z=Q,Z=_.extend(function(T){this.options={},T.forEach(function(k){this.options[k.name]=k},this)},{exists:function(T){return this.options[T]!=null},get:function(T,k){return Z._get(this.options[T],k)},getAll:function(T){var k,C=this.options,E={};for(k in C)z.hasOwn(C,k)&&(E[k]=Z._get(C[k],T));return E},init:function(T,k,C){typeof C!="function"&&(C=z.noop);var E,L;for(E in this.options)z.hasOwn(this.options,E)&&(L=this.options[E],Z._set(L,L.defaultValue,k),Z._createAccessor(L,k,C));this._setAll(T,k,!0)},set:function(T,k,C){return this._set(T,k,C)},setAll:function(T,k){return this._setAll(T,k)},_set:function(T,k,C,E){var L=this.options[T];if(!L)throw new Error("Invalid option: "+T);if(!L.modifiable&&!E)throw new Error("Option cannot be modified: "+T);return Z._set(L,k,C)},_setAll:function(T,k,C){if(!T)return!1;var E,L=!1;for(E in T)z.hasOwn(T,E)&&this._set(E,T[E],k,C)&&(L=!0);return L}},{_createAccessor:function(T,k,C){var E={get:function(){return Z._get(T,k)}};T.modifiable&&(E.set=function(L){Z._set(T,L,k)&&C(L,T)}),Object.defineProperty(k,T.name,E)},_get:function(T,k){return k["_"+T.name]},_set:function(T,k,C){var E="_"+T.name,L=C[E],J=T.transform(k!=null?k:T.defaultValue);return C[E]=J,J!==L}}),V=Z,H=_.extend(function(){this._services={}},{getService:function(T){var k=this._services[T];if(!k)throw new Error("Service is not being managed with name: "+T);return k},setService:function(T,k){if(this._services[T])throw new Error("Service is already managed with name: "+T);k&&(this._services[T]=k)}}),ee=H,ue=new V([new Y("background",!0,"white"),new Y("backgroundAlpha",!0,1,z.abs),new Y("element"),new Y("foreground",!0,"black"),new Y("foregroundAlpha",!0,1,z.abs),new Y("level",!0,"L",z.toUpperCase),new Y("mime",!0,"image/png"),new Y("padding",!0,null,z.abs),new Y("size",!0,100,z.abs),new Y("value",!0,"")]),x=new ee,W=_.extend(function(T){ue.init(T,this,this.update.bind(this));var k=ue.get("element",this),C=x.getService("element"),E=k&&C.isCanvas(k)?k:C.createCanvas(),L=k&&C.isImage(k)?k:C.createImage();this._canvasRenderer=new g(this,E,!0),this._imageRenderer=new K(this,L,L===k),this.update()},{get:function(){return ue.getAll(this)},set:function(T){ue.setAll(T,this)&&this.update()},toDataURL:function(T){return this.canvas.toDataURL(T||this.mime)},update:function(){var T=new ie({level:this.level,value:this.value});this._canvasRenderer.render(T),this._imageRenderer.render(T)}},{use:function(T){x.setService(T.getName(),T)}});Object.defineProperties(W.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var U=W,ke=U,je=_.extend({getName:function(){}}),Be=je,We=Be.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(T){},isImage:function(T){}}),$e=We,ge=$e.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(T){return T instanceof HTMLCanvasElement},isImage:function(T){return T instanceof HTMLImageElement}}),Le=ge;ke.use(new Le);var Me=ke;return Me})})(t0);const ap=t0.exports;function up(t){let e,l;return{c(){e=m("img"),Xs(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){M(n,e,i)},p(n,[i]){i&4&&!Xs(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:_e,o:_e,d(n){n&&y(e)}}}function fp(t,e,l){const n=new ap;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:a="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:p="qrcode"}=e,_="";function b(){n.set({background:o,foreground:u,level:i,padding:f,size:a,value:c}),l(2,_=n.toDataURL("image/jpeg"))}return ac(()=>{b()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,o=v.background),"color"in v&&l(5,u=v.color),"size"in v&&l(6,a=v.size),"value"in v&&l(0,c=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,p=v.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&b()},[c,p,_,i,o,u,a,f]}class cp extends De{constructor(e){super(),Pe(this,e,fp,up,Ne,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function nf(t,e,l){const n=t.slice();return n[103]=e[l],n[104]=e,n[105]=l,n}function sf(t,e,l){const n=t.slice();return n[106]=e[l],n[107]=e,n[108]=l,n}function mp(t,e,l){const n=t.slice();return n[109]=e[l],n}function pp(t,e,l){const n=t.slice();return n[112]=e[l],n}function _p(t){let e,l;return{c(){e=m("option"),l=N(t[112]),e.__value=t[112],e.value=e.__value},m(n,i){M(n,e,i),s(e,l)},p:_e,d(n){n&&y(e)}}}function of(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){M(o,e,u),M(o,l,u),ne(l,t[3].p.t),n||(i=le(l,"input",t[22]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].p.t&&ne(l,o[3].p.t)},d(o){o&&y(e),o&&y(l),n=!1,i()}}}function rf(t){let e,l,n,i,o,u,a,c,f,p,_,b,v;return{c(){e=m("div"),l=N("Username"),n=m("br"),i=h(),o=m("input"),u=h(),a=m("div"),c=N("Password"),f=m("br"),p=h(),_=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(_,"name","gp"),r(_,"type","password"),r(_,"class","in-s"),r(a,"class","my-1")},m(d,g){M(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].g.u),M(d,u,g),M(d,a,g),s(a,c),s(a,f),s(a,p),s(a,_),ne(_,t[3].g.p),b||(v=[le(o,"input",t[24]),le(_,"input",t[25])],b=!0)},p(d,g){g[0]&8&&o.value!==d[3].g.u&&ne(o,d[3].g.u),g[0]&8&&_.value!==d[3].g.p&&ne(_,d[3].g.p)},d(d){d&&y(e),d&&y(u),d&&y(a),b=!1,Ve(v)}}}function dp(t){let e,l=t[109]*100+"",n;return{c(){e=m("option"),n=N(l),e.__value=t[109]*100,e.value=e.__value},m(i,o){M(i,e,o),s(e,n)},p:_e,d(i){i&&y(e)}}}function af(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,u){M(o,e,u),M(o,l,u),ne(l,t[3].m.e.k),n||(i=le(l,"input",t[35]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].m.e.k&&ne(l,o[3].m.e.k)},d(o){o&&y(e),o&&y(l),n=!1,i()}}}function uf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=N("Authentication key"),n=m("br"),i=h(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].m.e.a),u||(a=le(o,"input",t[36]),u=!0)},p(c,f){f[0]&8&&o.value!==c[3].m.e.a&&ne(o,c[3].m.e.a)},d(c){c&&y(e),u=!1,a()}}}function ff(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w,$,S,P,F,A,I,D,O,ie,j;return{c(){e=m("div"),l=m("div"),n=N("Watt"),i=m("br"),o=h(),u=m("input"),a=h(),c=m("div"),f=N("Volt"),p=m("br"),_=h(),b=m("input"),v=h(),d=m("div"),g=N("Amp"),w=m("br"),$=h(),S=m("input"),P=h(),F=m("div"),A=N("kWh"),I=m("br"),D=h(),O=m("input"),r(u,"name","mmw"),r(u,"type","number"),r(u,"min","0.00"),r(u,"max","1000"),r(u,"step","0.001"),r(u,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(b,"name","mmv"),r(b,"type","number"),r(b,"min","0.00"),r(b,"max","1000"),r(b,"step","0.001"),r(b,"class","in-m tr w-full"),r(c,"class","w-1/4"),r(S,"name","mma"),r(S,"type","number"),r(S,"min","0.00"),r(S,"max","1000"),r(S,"step","0.001"),r(S,"class","in-m tr w-full"),r(d,"class","w-1/4"),r(O,"name","mmc"),r(O,"type","number"),r(O,"min","0.00"),r(O,"max","1000"),r(O,"step","0.001"),r(O,"class","in-l tr w-full"),r(F,"class","w-1/4"),r(e,"class","flex my-1")},m(K,G){M(K,e,G),s(e,l),s(l,n),s(l,i),s(l,o),s(l,u),ne(u,t[3].m.m.w),s(e,a),s(e,c),s(c,f),s(c,p),s(c,_),s(c,b),ne(b,t[3].m.m.v),s(e,v),s(e,d),s(d,g),s(d,w),s(d,$),s(d,S),ne(S,t[3].m.m.a),s(e,P),s(e,F),s(F,A),s(F,I),s(F,D),s(F,O),ne(O,t[3].m.m.c),ie||(j=[le(u,"input",t[38]),le(b,"input",t[39]),le(S,"input",t[40]),le(O,"input",t[41])],ie=!0)},p(K,G){G[0]&8&&he(u.value)!==K[3].m.m.w&&ne(u,K[3].m.m.w),G[0]&8&&he(b.value)!==K[3].m.m.v&&ne(b,K[3].m.m.v),G[0]&8&&he(S.value)!==K[3].m.m.a&&ne(S,K[3].m.m.a),G[0]&8&&he(O.value)!==K[3].m.m.c&&ne(O,K[3].m.m.c)},d(K){K&&y(e),ie=!1,Ve(j)}}}function cf(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function mf(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w,$,S,P,F,A,I,D,O,ie,j,K,G,Y,Q,z,Z,V,H,ee,ue,x,W;return{c(){e=m("div"),l=N("SSID"),n=m("br"),i=h(),o=m("input"),u=h(),a=m("div"),c=N("Password"),f=m("br"),p=h(),_=m("input"),b=h(),v=m("div"),d=m("div"),g=N("Power saving"),w=m("br"),$=h(),S=m("select"),P=m("option"),P.textContent="Default",F=m("option"),F.textContent="Off",A=m("option"),A.textContent="Minimum",I=m("option"),I.textContent="Maximum",D=h(),O=m("div"),ie=N("Power"),j=m("br"),K=h(),G=m("div"),Y=m("input"),Q=h(),z=m("span"),z.textContent="dBm",Z=h(),V=m("div"),H=m("label"),ee=m("input"),ue=N(" Allow 802.11b legacy rates"),r(o,"name","ws"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(_,"name","wp"),r(_,"type","password"),r(_,"class","in-s"),r(a,"class","my-1"),P.__value=255,P.value=P.__value,F.__value=0,F.value=F.__value,A.__value=1,A.value=A.__value,I.__value=2,I.value=I.__value,r(S,"name","wz"),r(S,"class","in-s"),t[3].w.z===void 0&&Ge(()=>t[45].call(S)),r(d,"class","w-1/2"),r(Y,"name","ww"),r(Y,"type","number"),r(Y,"min","0"),r(Y,"max","20.5"),r(Y,"step","0.5"),r(Y,"class","in-f tr w-full"),r(z,"class","in-post"),r(G,"class","flex"),r(O,"class","ml-2 w-1/2"),r(v,"class","my-1 flex"),r(ee,"type","checkbox"),r(ee,"name","wb"),ee.__value="true",ee.value=ee.__value,r(ee,"class","rounded mb-1"),r(V,"class","my-3")},m(U,ke){M(U,e,ke),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].w.s),M(U,u,ke),M(U,a,ke),s(a,c),s(a,f),s(a,p),s(a,_),ne(_,t[3].w.p),M(U,b,ke),M(U,v,ke),s(v,d),s(d,g),s(d,w),s(d,$),s(d,S),s(S,P),s(S,F),s(S,A),s(S,I),Se(S,t[3].w.z,!0),s(v,D),s(v,O),s(O,ie),s(O,j),s(O,K),s(O,G),s(G,Y),ne(Y,t[3].w.w),s(G,Q),s(G,z),M(U,Z,ke),M(U,V,ke),s(V,H),s(H,ee),ee.checked=t[3].w.b,s(H,ue),x||(W=[le(o,"input",t[43]),le(_,"input",t[44]),le(S,"change",t[45]),le(Y,"input",t[46]),le(ee,"change",t[47])],x=!0)},p(U,ke){ke[0]&8&&o.value!==U[3].w.s&&ne(o,U[3].w.s),ke[0]&8&&_.value!==U[3].w.p&&ne(_,U[3].w.p),ke[0]&8&&Se(S,U[3].w.z),ke[0]&8&&he(Y.value)!==U[3].w.w&&ne(Y,U[3].w.w),ke[0]&8&&(ee.checked=U[3].w.b)},d(U){U&&y(e),U&&y(u),U&&y(a),U&&y(b),U&&y(v),U&&y(Z),U&&y(V),x=!1,Ve(W)}}}function pf(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w;return{c(){e=m("div"),l=N("Gateway"),n=m("br"),i=h(),o=m("input"),u=h(),a=m("div"),c=N("DNS"),f=m("br"),p=h(),_=m("div"),b=m("input"),v=h(),d=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(b,"name","nd1"),r(b,"type","text"),r(b,"class","in-f w-full"),r(d,"name","nd2"),r(d,"type","text"),r(d,"class","in-l w-full"),r(_,"class","flex"),r(a,"class","my-1")},m($,S){M($,e,S),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].n.g),M($,u,S),M($,a,S),s(a,c),s(a,f),s(a,p),s(a,_),s(_,b),ne(b,t[3].n.d1),s(_,v),s(_,d),ne(d,t[3].n.d2),g||(w=[le(o,"input",t[51]),le(b,"input",t[52]),le(d,"input",t[53])],g=!0)},p($,S){S[0]&8&&o.value!==$[3].n.g&&ne(o,$[3].n.g),S[0]&8&&b.value!==$[3].n.d1&&ne(b,$[3].n.d1),S[0]&8&&d.value!==$[3].n.d2&&ne(d,$[3].n.d2)},d($){$&&y(e),$&&y(u),$&&y(a),g=!1,Ve(w)}}}function _f(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=N(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(u,a){M(u,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[le(l,"change",t[57]),le(l,"change",t[14])],i=!0)},p(u,a){a[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&y(e),i=!1,Ve(o)}}}function df(t){let e,l,n,i,o,u,a,c,f,p,_,b,v;const d=[hp,vp],g=[];function w(D,O){return D[3].q.s.c?0:1}n=w(t),i=g[n]=d[n](t);const $=[wp,kp],S=[];function P(D,O){return D[3].q.s.r?0:1}a=P(t),c=S[a]=$[a](t);const F=[Sp,Mp],A=[];function I(D,O){return D[3].q.s.k?0:1}return _=I(t),b=A[_]=F[_](t),{c(){e=m("div"),l=m("span"),i.c(),o=h(),u=m("span"),c.c(),f=h(),p=m("span"),b.c(),r(l,"class","flex pr-2"),r(u,"class","flex pr-2"),r(p,"class","flex pr-2"),r(e,"class","my-1 flex")},m(D,O){M(D,e,O),s(e,l),g[n].m(l,null),s(e,o),s(e,u),S[a].m(u,null),s(e,f),s(e,p),A[_].m(p,null),v=!0},p(D,O){let ie=n;n=w(D),n===ie?g[n].p(D,O):(Ie(),B(g[ie],1,1,()=>{g[ie]=null}),Re(),i=g[n],i?i.p(D,O):(i=g[n]=d[n](D),i.c()),R(i,1),i.m(l,null));let j=a;a=P(D),a===j?S[a].p(D,O):(Ie(),B(S[j],1,1,()=>{S[j]=null}),Re(),c=S[a],c?c.p(D,O):(c=S[a]=$[a](D),c.c()),R(c,1),c.m(u,null));let K=_;_=I(D),_===K?A[_].p(D,O):(Ie(),B(A[K],1,1,()=>{A[K]=null}),Re(),b=A[_],b?b.p(D,O):(b=A[_]=F[_](D),b.c()),R(b,1),b.m(p,null))},i(D){v||(R(i),R(c),R(b),v=!0)},o(D){B(i),B(c),B(b),v=!1},d(D){D&&y(e),g[n].d(),S[a].d(),A[_].d()}}}function vp(t){let e,l;return e=new ol({props:{to:"/mqtt-ca",$$slots:{default:[bp]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function hp(t){let e,l,n,i,o,u,a,c;return l=new ol({props:{to:"/mqtt-ca",$$slots:{default:[gp]},$$scope:{ctx:t}}}),o=new $o({}),{c(){e=m("span"),re(l.$$.fragment),n=h(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(l,e,null),M(f,n,p),M(f,i,p),se(o,i,null),u=!0,a||(c=[le(i,"click",t[11]),le(i,"keypress",t[11])],a=!0)},p(f,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(R(l.$$.fragment,f),R(o.$$.fragment,f),u=!0)},o(f){B(l.$$.fragment,f),B(o.$$.fragment,f),u=!1},d(f){f&&y(e),oe(l),f&&y(n),f&&y(i),oe(o),a=!1,Ve(c)}}}function bp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function gp(t){let e;return{c(){e=N("CA OK")},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function kp(t){let e,l;return e=new ol({props:{to:"/mqtt-cert",$$slots:{default:[yp]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function wp(t){let e,l,n,i,o,u,a,c;return l=new ol({props:{to:"/mqtt-cert",$$slots:{default:[Cp]},$$scope:{ctx:t}}}),o=new $o({}),{c(){e=m("span"),re(l.$$.fragment),n=h(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(l,e,null),M(f,n,p),M(f,i,p),se(o,i,null),u=!0,a||(c=[le(i,"click",t[12]),le(i,"keypress",t[12])],a=!0)},p(f,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(R(l.$$.fragment,f),R(o.$$.fragment,f),u=!0)},o(f){B(l.$$.fragment,f),B(o.$$.fragment,f),u=!1},d(f){f&&y(e),oe(l),f&&y(n),f&&y(i),oe(o),a=!1,Ve(c)}}}function yp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Cp(t){let e;return{c(){e=N("Cert OK")},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function Mp(t){let e,l;return e=new ol({props:{to:"/mqtt-key",$$slots:{default:[Tp]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Sp(t){let e,l,n,i,o,u,a,c;return l=new ol({props:{to:"/mqtt-key",$$slots:{default:[Np]},$$scope:{ctx:t}}}),o=new $o({}),{c(){e=m("span"),re(l.$$.fragment),n=h(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(l,e,null),M(f,n,p),M(f,i,p),se(o,i,null),u=!0,a||(c=[le(i,"click",t[13]),le(i,"keypress",t[13])],a=!0)},p(f,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(R(l.$$.fragment,f),R(o.$$.fragment,f),u=!0)},o(f){B(l.$$.fragment,f),B(o.$$.fragment,f),u=!1},d(f){f&&y(e),oe(l),f&&y(n),f&&y(i),oe(o),a=!1,Ve(c)}}}function Tp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Np(t){let e;return{c(){e=N("Key OK")},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function vf(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w,$,S,P,F,A,I,D,O,ie,j,K,G,Y,Q,z,Z;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),re(o.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),p=m("div"),_=N("Electricity IDX"),b=m("br"),v=h(),d=m("input"),g=h(),w=m("div"),$=N("Current IDX"),S=m("br"),P=h(),F=m("input"),A=h(),I=m("div"),D=N(`Voltage IDX: L1, L2 & L3 `),O=m("div"),ie=m("input"),j=h(),K=m("input"),G=h(),Y=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","o"),a.value="true",r(d,"name","oe"),r(d,"type","text"),r(d,"class","in-f tr w-full"),r(p,"class","w-1/2"),r(F,"name","oc"),r(F,"type","text"),r(F,"class","in-l tr w-full"),r(w,"class","w-1/2"),r(f,"class","my-1 flex"),r(ie,"name","ou1"),r(ie,"type","text"),r(ie,"class","in-f tr w-1/3"),r(K,"name","ou2"),r(K,"type","text"),r(K,"class","in-m tr w-1/3"),r(Y,"name","ou3"),r(Y,"type","text"),r(Y,"class","in-l tr w-1/3"),r(O,"class","flex"),r(I,"class","my-1"),r(e,"class","cnt")},m(V,H){M(V,e,H),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,p),s(p,_),s(p,b),s(p,v),s(p,d),ne(d,t[3].o.e),s(f,g),s(f,w),s(w,$),s(w,S),s(w,P),s(w,F),ne(F,t[3].o.c),s(e,A),s(e,I),s(I,D),s(I,O),s(O,ie),ne(ie,t[3].o.u1),s(O,j),s(O,K),ne(K,t[3].o.u2),s(O,G),s(O,Y),ne(Y,t[3].o.u3),Q=!0,z||(Z=[le(d,"input",t[65]),le(F,"input",t[66]),le(ie,"input",t[67]),le(K,"input",t[68]),le(Y,"input",t[69])],z=!0)},p(V,H){H[0]&8&&d.value!==V[3].o.e&&ne(d,V[3].o.e),H[0]&8&&F.value!==V[3].o.c&&ne(F,V[3].o.c),H[0]&8&&ie.value!==V[3].o.u1&&ne(ie,V[3].o.u1),H[0]&8&&K.value!==V[3].o.u2&&ne(K,V[3].o.u2),H[0]&8&&Y.value!==V[3].o.u3&&ne(Y,V[3].o.u3)},i(V){Q||(R(o.$$.fragment,V),Q=!0)},o(V){B(o.$$.fragment,V),Q=!1},d(V){V&&y(e),oe(o),z=!1,Ve(Z)}}}function hf(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w,$,S,P,F,A,I,D,O,ie,j,K,G,Y;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),re(o.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),p=N("Discovery topic prefix"),_=m("br"),b=h(),v=m("input"),d=h(),g=m("div"),w=N("Hostname for URL"),$=m("br"),S=h(),P=m("input"),A=h(),I=m("div"),D=N("Name tag"),O=m("br"),ie=h(),j=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","h"),a.value="true",r(v,"name","ht"),r(v,"type","text"),r(v,"class","in-s"),r(v,"placeholder","homeassistant"),r(f,"class","my-1"),r(P,"name","hh"),r(P,"type","text"),r(P,"class","in-s"),r(P,"placeholder",F=t[3].g.h+".local"),r(g,"class","my-1"),r(j,"name","hn"),r(j,"type","text"),r(j,"class","in-s"),r(I,"class","my-1"),r(e,"class","cnt")},m(Q,z){M(Q,e,z),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,p),s(f,_),s(f,b),s(f,v),ne(v,t[3].h.t),s(e,d),s(e,g),s(g,w),s(g,$),s(g,S),s(g,P),ne(P,t[3].h.h),s(e,A),s(e,I),s(I,D),s(I,O),s(I,ie),s(I,j),ne(j,t[3].h.n),K=!0,G||(Y=[le(v,"input",t[70]),le(P,"input",t[71]),le(j,"input",t[72])],G=!0)},p(Q,z){z[0]&8&&v.value!==Q[3].h.t&&ne(v,Q[3].h.t),(!K||z[0]&8&&F!==(F=Q[3].g.h+".local"))&&r(P,"placeholder",F),z[0]&8&&P.value!==Q[3].h.h&&ne(P,Q[3].h.h),z[0]&8&&j.value!==Q[3].h.n&&ne(j,Q[3].h.n)},i(Q){K||(R(o.$$.fragment,Q),K=!0)},o(Q){B(o.$$.fragment,Q),K=!1},d(Q){Q&&y(e),oe(o),G=!1,Ve(Y)}}}function bf(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w,$,S,P,F,A,I,D,O,ie,j,K,G,Y,Q,z,Z,V,H,ee,ue;o=new Bt({});let x=t[3].c.es&&gf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Cloud connections",n=h(),i=m("a"),re(o.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),p=m("label"),_=m("input"),b=N(" Enable cloud upload"),v=h(),d=m("div"),g=N("Client ID"),w=m("br"),$=h(),S=m("input"),A=h(),I=m("div"),D=N("Client secret"),O=m("br"),ie=h(),j=m("input"),G=h(),Y=m("div"),Q=m("label"),z=m("input"),Z=N(" Energy Speedometer"),V=h(),x&&x.c(),r(l,"class","text-sm"),r(i,"href",Ut("Cloud")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","c"),a.value="true",r(_,"type","checkbox"),r(_,"name","ce"),_.__value="true",_.value=_.__value,r(_,"class","rounded mb-1"),r(f,"class","my-1"),r(S,"name","ci"),r(S,"type","text"),r(S,"class","in-s"),r(S,"pattern",P=t[3].c.e?"[A-Z0-9]{16}":".*"),S.required=F=t[3].c.e,r(d,"class","my-1"),r(j,"name","cs"),r(j,"type","text"),r(j,"class","in-s"),r(j,"pattern",K=t[3].c.e&&t[3].c.s!="***"?"[A-Z0-9]{16}":".*"),r(I,"class","my-1"),r(z,"type","checkbox"),r(z,"class","rounded mb-1"),r(z,"name","ces"),z.__value="true",z.value=z.__value,r(Y,"class","my-1"),r(e,"class","cnt")},m(W,U){M(W,e,U),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,p),s(p,_),_.checked=t[3].c.e,s(p,b),s(e,v),s(e,d),s(d,g),s(d,w),s(d,$),s(d,S),ne(S,t[3].c.i),s(e,A),s(e,I),s(I,D),s(I,O),s(I,ie),s(I,j),ne(j,t[3].c.s),s(e,G),s(e,Y),s(Y,Q),s(Q,z),z.checked=t[3].c.es,s(Q,Z),s(Y,V),x&&x.m(Y,null),H=!0,ee||(ue=[le(_,"change",t[73]),le(S,"input",t[74]),le(j,"input",t[75]),le(z,"change",t[76])],ee=!0)},p(W,U){U[0]&8&&(_.checked=W[3].c.e),(!H||U[0]&8&&P!==(P=W[3].c.e?"[A-Z0-9]{16}":".*"))&&r(S,"pattern",P),(!H||U[0]&8&&F!==(F=W[3].c.e))&&(S.required=F),U[0]&8&&S.value!==W[3].c.i&&ne(S,W[3].c.i),(!H||U[0]&8&&K!==(K=W[3].c.e&&W[3].c.s!="***"?"[A-Z0-9]{16}":".*"))&&r(j,"pattern",K),U[0]&8&&j.value!==W[3].c.s&&ne(j,W[3].c.s),U[0]&8&&(z.checked=W[3].c.es),W[3].c.es?x?(x.p(W,U),U[0]&8&&R(x,1)):(x=gf(W),x.c(),R(x,1),x.m(Y,null)):x&&(Ie(),B(x,1,1,()=>{x=null}),Re())},i(W){H||(R(o.$$.fragment,W),R(x),H=!0)},o(W){B(o.$$.fragment,W),B(x),H=!1},d(W){W&&y(e),oe(o),x&&x.d(),ee=!1,Ve(ue)}}}function gf(t){let e,l,n=t[0].mac+"",i,o,u,a,c=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,p,_,b,v=t[0].mac&&t[0].meter.id&&kf(t);return{c(){e=m("div"),l=N("MAC: "),i=N(n),o=h(),u=m("div"),a=N("Meter ID: "),f=N(c),p=h(),v&&v.c(),_=Ke(),r(e,"class","pl-5"),r(u,"class","pl-5")},m(d,g){M(d,e,g),s(e,l),s(e,i),M(d,o,g),M(d,u,g),s(u,a),s(u,f),M(d,p,g),v&&v.m(d,g),M(d,_,g),b=!0},p(d,g){(!b||g[0]&1)&&n!==(n=d[0].mac+"")&&X(i,n),(!b||g[0]&1)&&c!==(c=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&X(f,c),d[0].mac&&d[0].meter.id?v?(v.p(d,g),g[0]&1&&R(v,1)):(v=kf(d),v.c(),R(v,1),v.m(_.parentNode,_)):v&&(Ie(),B(v,1,1,()=>{v=null}),Re())},i(d){b||(R(v),b=!0)},o(d){B(v),b=!1},d(d){d&&y(e),d&&y(o),d&&y(u),d&&y(p),v&&v.d(d),d&&y(_)}}}function kf(t){let e,l,n;return l=new cp({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","pl-2")},m(i,o){M(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function wf(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w,$,S,P;o=new Bt({});let F={length:9},A=[];for(let I=0;I20&&Sf(t),_=t[3].i.d.d>0&&$f(t),b=t[0].chip=="esp8266"&&Ef(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),re(o.$$.fragment),u=h(),p&&p.c(),a=h(),_&&_.c(),c=h(),b&&b.c(),r(l,"class","text-sm"),r(i,"href",Ut("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),p&&p.m(e,null),s(e,a),_&&_.m(e,null),s(e,c),b&&b.m(e,null),f=!0},p(v,d){v[0].board>20?p?(p.p(v,d),d[0]&1&&R(p,1)):(p=Sf(v),p.c(),R(p,1),p.m(e,a)):p&&(Ie(),B(p,1,1,()=>{p=null}),Re()),v[3].i.d.d>0?_?_.p(v,d):(_=$f(v),_.c(),_.m(e,c)):_&&(_.d(1),_=null),v[0].chip=="esp8266"?b?b.p(v,d):(b=Ef(v),b.c(),b.m(e,null)):b&&(b.d(1),b=null)},i(v){f||(R(o.$$.fragment,v),R(p),f=!0)},o(v){B(o.$$.fragment,v),B(p),f=!1},d(v){v&&y(e),oe(o),p&&p.d(),_&&_.d(),b&&b.d()}}}function Sf(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w,$,S,P,F,A,I,D,O,ie,j,K,G,Y,Q,z,Z,V,H,ee,ue,x,W,U,ke,je,Be,We,$e,ge,Le,Me,T,k,C,E,L,J,te,fe,de,we,Ee,ae,Ce,Je,Et,st,ht,lt,At,Ye,Qt,jt,bt,ze,xe,Xe,Ue,qe,et;f=new fo({props:{chip:t[0].chip}}),w=new fo({props:{chip:t[0].chip}});let Ae=t[0].chip!="esp8266"&&Tf(t),Oe=t[3].i.v.p>0&&Nf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=N("HAN RX"),u=m("br"),a=h(),c=m("select"),re(f.$$.fragment),p=h(),_=m("div"),b=N("HAN TX"),v=m("br"),d=h(),g=m("select"),re(w.$$.fragment),$=h(),S=m("div"),P=m("label"),F=m("input"),A=N(" pullup"),I=h(),D=m("div"),O=m("div"),ie=N("AP button"),j=m("br"),K=h(),G=m("input"),Y=h(),Q=m("div"),z=N("LED"),Z=m("br"),V=h(),H=m("div"),ee=m("input"),ue=h(),x=m("div"),W=m("label"),U=m("input"),ke=N(" inverted"),je=h(),Be=m("div"),We=N("RGB"),$e=m("label"),ge=m("input"),Le=N(" inverted"),Me=m("br"),T=h(),k=m("div"),C=m("input"),E=h(),L=m("input"),J=h(),te=m("input"),fe=h(),de=m("div"),we=m("div"),Ee=N(`LED dis. GPIO `),ae=m("input"),Ce=h(),Je=m("div"),Et=N("Temperature"),st=m("br"),ht=h(),lt=m("input"),At=h(),Ye=m("div"),Qt=N("Analog temp"),jt=m("br"),bt=h(),ze=m("input"),xe=h(),Ae&&Ae.c(),Xe=h(),Oe&&Oe.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(c,"name","ihp"),r(c,"class","in-f w-full"),t[3].i.h.p===void 0&&Ge(()=>t[80].call(c)),r(i,"class","w-1/3"),r(g,"name","iht"),r(g,"class","in-l w-full"),t[3].i.h.t===void 0&&Ge(()=>t[81].call(g)),r(_,"class","w-1/3"),r(F,"name","ihu"),F.__value="true",F.value=F.__value,r(F,"type","checkbox"),r(F,"class","rounded mb-1"),r(P,"class","ml-2"),r(S,"class","w-1/3"),r(n,"class","flex flex-wrap"),r(G,"name","ia"),r(G,"type","number"),r(G,"min","0"),r(G,"max",t[6]),r(G,"class","in-f tr w-full"),r(O,"class","w-1/3"),r(ee,"name","ilp"),r(ee,"type","number"),r(ee,"min","0"),r(ee,"max",t[6]),r(ee,"class","in-l tr w-full"),r(H,"class","flex"),r(Q,"class","w-1/3"),r(U,"name","ili"),U.__value="true",U.value=U.__value,r(U,"type","checkbox"),r(U,"class","rounded mb-1"),r(W,"class","ml-4"),r(x,"class","w-1/3"),r(ge,"name","iri"),ge.__value="true",ge.value=ge.__value,r(ge,"type","checkbox"),r(ge,"class","rounded mb-1"),r($e,"class","ml-4"),r(C,"name","irr"),r(C,"type","number"),r(C,"min","0"),r(C,"max",t[6]),r(C,"class","in-f tr w-1/3"),r(L,"name","irg"),r(L,"type","number"),r(L,"min","0"),r(L,"max",t[6]),r(L,"class","in-m tr w-1/3"),r(te,"name","irb"),r(te,"type","number"),r(te,"min","0"),r(te,"max",t[6]),r(te,"class","in-l tr w-1/3"),r(k,"class","flex"),r(Be,"class","w-full"),r(ae,"name","idd"),r(ae,"type","number"),r(ae,"min","0"),r(ae,"max",t[6]),r(ae,"class","in-s tr"),r(we,"class","my-1 pr-1 w-1/3"),r(de,"class","w-full"),r(lt,"name","itd"),r(lt,"type","number"),r(lt,"min","0"),r(lt,"max",t[6]),r(lt,"class","in-f tr w-full"),r(Je,"class","my-1 w-1/3"),r(ze,"name","ita"),r(ze,"type","number"),r(ze,"min","0"),r(ze,"max",t[6]),r(ze,"class","in-l tr w-full"),r(Ye,"class","my-1 pr-1 w-1/3"),r(D,"class","flex flex-wrap")},m(pe,ce){M(pe,e,ce),M(pe,l,ce),M(pe,n,ce),s(n,i),s(i,o),s(i,u),s(i,a),s(i,c),se(f,c,null),Se(c,t[3].i.h.p,!0),s(n,p),s(n,_),s(_,b),s(_,v),s(_,d),s(_,g),se(w,g,null),Se(g,t[3].i.h.t,!0),s(n,$),s(n,S),s(S,P),s(P,F),F.checked=t[3].i.h.u,s(P,A),M(pe,I,ce),M(pe,D,ce),s(D,O),s(O,ie),s(O,j),s(O,K),s(O,G),ne(G,t[3].i.a),s(D,Y),s(D,Q),s(Q,z),s(Q,Z),s(Q,V),s(Q,H),s(H,ee),ne(ee,t[3].i.l.p),s(D,ue),s(D,x),s(x,W),s(W,U),U.checked=t[3].i.l.i,s(W,ke),s(D,je),s(D,Be),s(Be,We),s(Be,$e),s($e,ge),ge.checked=t[3].i.r.i,s($e,Le),s(Be,Me),s(Be,T),s(Be,k),s(k,C),ne(C,t[3].i.r.r),s(k,E),s(k,L),ne(L,t[3].i.r.g),s(k,J),s(k,te),ne(te,t[3].i.r.b),s(D,fe),s(D,de),s(de,we),s(we,Ee),s(we,ae),ne(ae,t[3].i.d.d),s(D,Ce),s(D,Je),s(Je,Et),s(Je,st),s(Je,ht),s(Je,lt),ne(lt,t[3].i.t.d),s(D,At),s(D,Ye),s(Ye,Qt),s(Ye,jt),s(Ye,bt),s(Ye,ze),ne(ze,t[3].i.t.a),s(D,xe),Ae&&Ae.m(D,null),s(D,Xe),Oe&&Oe.m(D,null),Ue=!0,qe||(et=[le(c,"change",t[80]),le(g,"change",t[81]),le(F,"change",t[82]),le(G,"input",t[83]),le(ee,"input",t[84]),le(U,"change",t[85]),le(ge,"change",t[86]),le(C,"input",t[87]),le(L,"input",t[88]),le(te,"input",t[89]),le(ae,"input",t[90]),le(lt,"input",t[91]),le(ze,"input",t[92])],qe=!0)},p(pe,ce){const ye={};ce[0]&1&&(ye.chip=pe[0].chip),f.$set(ye),ce[0]&8&&Se(c,pe[3].i.h.p);const zl={};ce[0]&1&&(zl.chip=pe[0].chip),w.$set(zl),ce[0]&8&&Se(g,pe[3].i.h.t),ce[0]&8&&(F.checked=pe[3].i.h.u),(!Ue||ce[0]&64)&&r(G,"max",pe[6]),ce[0]&8&&he(G.value)!==pe[3].i.a&&ne(G,pe[3].i.a),(!Ue||ce[0]&64)&&r(ee,"max",pe[6]),ce[0]&8&&he(ee.value)!==pe[3].i.l.p&&ne(ee,pe[3].i.l.p),ce[0]&8&&(U.checked=pe[3].i.l.i),ce[0]&8&&(ge.checked=pe[3].i.r.i),(!Ue||ce[0]&64)&&r(C,"max",pe[6]),ce[0]&8&&he(C.value)!==pe[3].i.r.r&&ne(C,pe[3].i.r.r),(!Ue||ce[0]&64)&&r(L,"max",pe[6]),ce[0]&8&&he(L.value)!==pe[3].i.r.g&&ne(L,pe[3].i.r.g),(!Ue||ce[0]&64)&&r(te,"max",pe[6]),ce[0]&8&&he(te.value)!==pe[3].i.r.b&&ne(te,pe[3].i.r.b),(!Ue||ce[0]&64)&&r(ae,"max",pe[6]),ce[0]&8&&he(ae.value)!==pe[3].i.d.d&&ne(ae,pe[3].i.d.d),(!Ue||ce[0]&64)&&r(lt,"max",pe[6]),ce[0]&8&&he(lt.value)!==pe[3].i.t.d&&ne(lt,pe[3].i.t.d),(!Ue||ce[0]&64)&&r(ze,"max",pe[6]),ce[0]&8&&he(ze.value)!==pe[3].i.t.a&&ne(ze,pe[3].i.t.a),pe[0].chip!="esp8266"?Ae?Ae.p(pe,ce):(Ae=Tf(pe),Ae.c(),Ae.m(D,Xe)):Ae&&(Ae.d(1),Ae=null),pe[3].i.v.p>0?Oe?Oe.p(pe,ce):(Oe=Nf(pe),Oe.c(),Oe.m(D,null)):Oe&&(Oe.d(1),Oe=null)},i(pe){Ue||(R(f.$$.fragment,pe),R(w.$$.fragment,pe),Ue=!0)},o(pe){B(f.$$.fragment,pe),B(w.$$.fragment,pe),Ue=!1},d(pe){pe&&y(e),pe&&y(l),pe&&y(n),oe(f),oe(w),pe&&y(I),pe&&y(D),Ae&&Ae.d(),Oe&&Oe.d(),qe=!1,Ve(et)}}}function Tf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=N("Vcc"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].i.v.p),u||(a=le(o,"input",t[93]),u=!0)},p(c,f){f[0]&64&&r(o,"max",c[6]),f[0]&8&&he(o.value)!==c[3].i.v.p&&ne(o,c[3].i.v.p)},d(c){c&&y(e),u=!1,a()}}}function Nf(t){let e,l,n,i,o,u,a,c,f,p;return{c(){e=m("div"),l=N("Voltage divider"),n=m("br"),i=h(),o=m("div"),u=m("input"),a=h(),c=m("input"),r(u,"name","ivdv"),r(u,"type","number"),r(u,"min","0"),r(u,"max","65535"),r(u,"class","in-f tr w-full"),r(u,"placeholder","VCC"),r(c,"name","ivdg"),r(c,"type","number"),r(c,"min","0"),r(c,"max","65535"),r(c,"class","in-l tr w-full"),r(c,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(_,b){M(_,e,b),s(e,l),s(e,n),s(e,i),s(e,o),s(o,u),ne(u,t[3].i.v.d.v),s(o,a),s(o,c),ne(c,t[3].i.v.d.g),f||(p=[le(u,"input",t[94]),le(c,"input",t[95])],f=!0)},p(_,b){b[0]&8&&he(u.value)!==_[3].i.v.d.v&&ne(u,_[3].i.v.d.v),b[0]&8&&he(c.value)!==_[3].i.v.d.g&&ne(c,_[3].i.v.d.g)},d(_){_&&y(e),f=!1,Ve(p)}}}function $f(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=N(`LED behaviour `),n=m("select"),i=m("option"),i.textContent="Enabled",o=m("option"),o.textContent="Disabled",i.__value=0,i.value=i.__value,o.__value=1,o.value=o.__value,r(n,"name","idb"),r(n,"class","in-s"),t[3].i.d.b===void 0&&Ge(()=>t[96].call(n)),r(e,"class","my-1 w-full")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(n,i),s(n,o),Se(n,t[3].i.d.b,!0),u||(a=le(n,"change",t[96]),u=!0)},p(c,f){f[0]&8&&Se(n,c[3].i.d.b)},d(c){c&&y(e),u=!1,a()}}}function Ef(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w,$,S=(t[0].board==2||t[0].board==100)&&Af(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=N("Vcc offset"),u=m("br"),a=h(),c=m("input"),f=h(),p=m("div"),_=N("Multiplier"),b=m("br"),v=h(),d=m("input"),g=h(),S&&S.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(c,"name","ivo"),r(c,"type","number"),r(c,"min","0.0"),r(c,"max","3.5"),r(c,"step","0.01"),r(c,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(d,"name","ivm"),r(d,"type","number"),r(d,"min","0.1"),r(d,"max","10"),r(d,"step","0.01"),r(d,"class","in-l tr w-full"),r(p,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(P,F){M(P,e,F),M(P,l,F),M(P,n,F),s(n,i),s(i,o),s(i,u),s(i,a),s(i,c),ne(c,t[3].i.v.o),s(n,f),s(n,p),s(p,_),s(p,b),s(p,v),s(p,d),ne(d,t[3].i.v.m),s(n,g),S&&S.m(n,null),w||($=[le(c,"input",t[97]),le(d,"input",t[98])],w=!0)},p(P,F){F[0]&8&&he(c.value)!==P[3].i.v.o&&ne(c,P[3].i.v.o),F[0]&8&&he(d.value)!==P[3].i.v.m&&ne(d,P[3].i.v.m),P[0].board==2||P[0].board==100?S?S.p(P,F):(S=Af(P),S.c(),S.m(n,null)):S&&(S.d(1),S=null)},d(P){P&&y(e),P&&y(l),P&&y(n),S&&S.d(),w=!1,Ve($)}}}function Af(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=N("Boot limit"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].i.v.b),u||(a=le(o,"input",t[99]),u=!0)},p(c,f){f[0]&8&&he(o.value)!==c[3].i.v.b&&ne(o,c[3].i.v.b)},d(c){c&&y(e),u=!1,a()}}}function Pf(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w,$=t[3].d.t&&Df();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),o=m("input"),u=N(" Enable telnet"),a=h(),$&&$.c(),c=h(),f=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",b=m("option"),b.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),_.__value=1,_.value=_.__value,b.__value=2,b.value=b.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,r(p,"name","dl"),r(p,"class","in-s"),t[3].d.l===void 0&&Ge(()=>t[102].call(p)),r(f,"class","my-1")},m(S,P){M(S,e,P),M(S,l,P),M(S,n,P),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,u),M(S,a,P),$&&$.m(S,P),M(S,c,P),M(S,f,P),s(f,p),s(p,_),s(p,b),s(p,v),s(p,d),Se(p,t[3].d.l,!0),g||(w=[le(o,"change",t[101]),le(p,"change",t[102])],g=!0)},p(S,P){P[0]&8&&(o.checked=S[3].d.t),S[3].d.t?$||($=Df(),$.c(),$.m(c.parentNode,c)):$&&($.d(1),$=null),P[0]&8&&Se(p,S[3].d.l)},d(S){S&&y(e),S&&y(l),S&&y(n),S&&y(a),$&&$.d(S),S&&y(c),S&&y(f),g=!1,Ve(w)}}}function Df(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function $p(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w,$,S,P,F,A,I,D,O,ie,j,K,G,Y,Q,z,Z,V,H,ee,ue,x,W,U,ke,je,Be,We,$e,ge,Le,Me,T,k,C,E,L,J,te,fe,de,we,Ee,ae,Ce,Je,Et,st,ht,lt,At,Ye,Qt,jt,bt,ze,xe,Xe,Ue,qe,et,Ae,Oe,pe,ce,ye,zl,hl,_n,Pt,Ai,Pi,Di,bl,Ii,Ri,Li,Dt,$l,El,Al,Oi,Fi,He,dn,qi,Pl,Dl,Bi,Gl,Ze,mt,Vl,Il,Ui,Rl,Hi,Wt,vn,hn,Ao,rl,ji,Po,Ts,Do,fi,Xt,Io,Ro,Ll,al,Ol,Lo,Wi,Oo,dt,Fl,Fo,zi,bn,gn,kn,wn,Gi,qo,It,Vi,Bo,Kl,Uo,Ho,jo,ul,yn,Cn,Wo,Mn,Yl,zo,Go,Vo,Sn,Zt,Ko,Ki,Yo,Ql,Qo,Xo,Zo,Tn,Jt,Jo,Yi,xo,Ns,er,Xl,Qi,xt,tr,lr,nr,$s,Xi,el,ir,sr,or,Rt,Zi,rr,Nn,$n,ar,ci,ur,Zl,fr,cr,mr,zt,En,An,pr,_r,pt,Ji,dr,Pn,Dn,vr,Jl,hr,br,gr,ql,fl,In,Rn,kr,Lt,xi,es,wr,Ot,Ln,ts,ls,yr,Es,ns,is,tl,Cr,Mr,mi,Sr,Bl,Tr,pi,ll,Nr,$r,Er,ss,gl,Ar,tt,os,Pr,On,Fn,Dr,_i,Ir,cl,Rr,As,Lr,Or,qn,kl,Fr,nl,qr,Ps,xl,Br,Ur,Hr,wl,jr,en,Wr,zr,Gr,yl,Vr,Bn,Un,Kr,Yr,Qr,Cl,Xr,Hn,Zr,Jr,xr,gt,jn,Wn,zn,Gn,Vn,Kn,ea,tn,ta,la,na,Ml,ia,Ds,Is,Rs,Ls=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),Os,ml,rs,sa,Yn,Qn,oa,di,ra,vi,aa,Fs,Ft,as,ua,Xn,Zn,fa,hi,ca,us,fs,il,ma,pa,_a,Ul,qs,Jn,da,cs,xn,va,ms,Bs,ln,Us,nn,Hs,sn,js,on,Gt,Ws,ha;a=new Bt({}),O=new ip({});let l0=["NOK","SEK","DKK","EUR","CHF"],bi=[];for(let q=0;q<5;q+=1)bi[q]=_p(pp(t,l0,q));let kt=t[3].p.e&&t[0].chip!="esp8266"&&of(t),wt=t[3].g.s>0&&rf(t);Dl=new Bt({});let n0=[24,48,96,192,384,576,1152],gi=[];for(let q=0;q<7;q+=1)gi[q]=dp(mp(t,n0,q));let yt=t[3].m.e.e&&af(t),Ct=t[3].m.e.e&&uf(t),Mt=t[3].m.m.e&&ff(t);$n=new Bt({});let qt=t[0].if&&t[0].if.eth&&cf(),St=(t[3].n.c==1||t[3].n.c==2)&&mf(t);Dn=new Bt({}),Ln=new e0({});let Tt=t[3].n.m=="static"&&pf(t);Fn=new Bt({});let Nt=t[0].chip!="esp8266"&&_f(t),ot=t[3].q.s.e&&df(t),rt=t[3].q.m==3&&vf(t),at=t[3].q.m==4&&hf(t),ut=t[3].c.es!=null&&bf(t),ft=Ls&&wf(t);Qn=new Bt({});let ei=t[7],vt=[];for(let q=0;q20||t[0].chip=="esp8266"||t[3].i.d.d>0)&&Mf(t);Zn=new Bt({});let $t=t[3].d.s&&Pf(t);return ln=new Ht({props:{active:t[1],message:"Loading configuration"}}),nn=new Ht({props:{active:t[2],message:"Saving configuration"}}),sn=new Ht({props:{active:t[4],message:"Performing factory reset"}}),on=new Ht({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=h(),u=m("a"),re(a.$$.fragment),c=h(),f=m("input"),p=h(),_=m("div"),b=m("div"),v=m("div"),d=N("Hostname"),g=m("br"),w=h(),$=m("input"),S=h(),P=m("div"),F=N("Time zone"),A=m("br"),I=h(),D=m("select"),re(O.$$.fragment),ie=h(),j=m("input"),K=h(),G=m("div"),Y=m("div"),Q=m("div"),z=N("Price region"),Z=m("br"),V=h(),H=m("select"),ee=m("optgroup"),ue=m("option"),ue.textContent="NO1",x=m("option"),x.textContent="NO2",W=m("option"),W.textContent="NO3",U=m("option"),U.textContent="NO4",ke=m("option"),ke.textContent="NO5",je=m("optgroup"),Be=m("option"),Be.textContent="SE1",We=m("option"),We.textContent="SE2",$e=m("option"),$e.textContent="SE3",ge=m("option"),ge.textContent="SE4",Le=m("optgroup"),Me=m("option"),Me.textContent="DK1",T=m("option"),T.textContent="DK2",k=m("option"),k.textContent="Austria",C=m("option"),C.textContent="Belgium",E=m("option"),E.textContent="Czech Republic",L=m("option"),L.textContent="Estonia",J=m("option"),J.textContent="Finland",te=m("option"),te.textContent="France",fe=m("option"),fe.textContent="Germany",de=m("option"),de.textContent="Great Britain",we=m("option"),we.textContent="Latvia",Ee=m("option"),Ee.textContent="Lithuania",ae=m("option"),ae.textContent="Netherland",Ce=m("option"),Ce.textContent="Poland",Je=m("option"),Je.textContent="Switzerland",Et=h(),st=m("div"),ht=N("Currency"),lt=m("br"),At=h(),Ye=m("select");for(let q=0;q<5;q+=1)bi[q].c();Qt=h(),jt=m("div"),bt=m("div"),ze=m("div"),xe=N("Fixed price"),Xe=m("br"),Ue=h(),qe=m("input"),et=h(),Ae=m("div"),Oe=N("Multiplier"),pe=m("br"),ce=h(),ye=m("input"),zl=h(),hl=m("div"),_n=m("label"),Pt=m("input"),Ai=N(" Enable price fetch from remote server"),Pi=h(),kt&&kt.c(),Di=h(),bl=m("div"),Ii=N("Security"),Ri=m("br"),Li=h(),Dt=m("select"),$l=m("option"),$l.textContent="None",El=m("option"),El.textContent="Only configuration",Al=m("option"),Al.textContent="Everything",Oi=h(),wt&&wt.c(),Fi=h(),He=m("div"),dn=m("strong"),dn.textContent="Meter",qi=h(),Pl=m("a"),re(Dl.$$.fragment),Bi=h(),Gl=m("input"),Ze=h(),mt=m("input"),Vl=h(),Il=m("div"),Ui=N("Communication"),Rl=m("br"),Hi=h(),Wt=m("select"),vn=m("option"),vn.textContent="Passive (Push)",hn=m("option"),hn.textContent="Kamstrup (Pull)",Ao=h(),rl=m("div"),ji=m("span"),ji.textContent="Buffer size",Po=h(),Ts=m("span"),Ts.textContent="Serial conf.",Do=h(),fi=m("label"),Xt=m("input"),Io=N(" inverted"),Ro=h(),Ll=m("div"),al=m("select"),Ol=m("option"),Lo=N("Autodetect");for(let q=0;q<7;q+=1)gi[q].c();Oo=h(),dt=m("select"),Fl=m("option"),Fo=N("-"),bn=m("option"),bn.textContent="7N1",gn=m("option"),gn.textContent="8N1",kn=m("option"),kn.textContent="7E1",wn=m("option"),wn.textContent="8E1",qo=h(),It=m("input"),Bo=h(),Kl=m("div"),Uo=N("Voltage"),Ho=m("br"),jo=h(),ul=m("select"),yn=m("option"),yn.textContent="400V (TN)",Cn=m("option"),Cn.textContent="230V (IT/TT)",Wo=h(),Mn=m("div"),Yl=m("div"),zo=N("Main fuse"),Go=m("br"),Vo=h(),Sn=m("label"),Zt=m("input"),Ko=h(),Ki=m("span"),Ki.textContent="A",Yo=h(),Ql=m("div"),Qo=N("Production"),Xo=m("br"),Zo=h(),Tn=m("label"),Jt=m("input"),Jo=h(),Yi=m("span"),Yi.textContent="kWp",xo=h(),Ns=m("div"),er=h(),Xl=m("div"),Qi=m("label"),xt=m("input"),tr=N(" Meter is encrypted"),lr=h(),yt&&yt.c(),nr=h(),Ct&&Ct.c(),$s=h(),Xi=m("label"),el=m("input"),ir=N(" Multipliers"),sr=h(),Mt&&Mt.c(),or=h(),Rt=m("div"),Zi=m("strong"),Zi.textContent="Connection",rr=h(),Nn=m("a"),re($n.$$.fragment),ar=h(),ci=m("input"),ur=h(),Zl=m("div"),fr=N("Connection"),cr=m("br"),mr=h(),zt=m("select"),En=m("option"),En.textContent="WiFi",An=m("option"),An.textContent="Access point",qt&&qt.c(),pr=h(),St&&St.c(),_r=h(),pt=m("div"),Ji=m("strong"),Ji.textContent="Network",dr=h(),Pn=m("a"),re(Dn.$$.fragment),vr=h(),Jl=m("div"),hr=N("IP"),br=m("br"),gr=h(),ql=m("div"),fl=m("select"),In=m("option"),In.textContent="DHCP",Rn=m("option"),Rn.textContent="Static",kr=h(),Lt=m("input"),wr=h(),Ot=m("select"),re(Ln.$$.fragment),yr=h(),Tt&&Tt.c(),Es=h(),ns=m("div"),is=m("label"),tl=m("input"),Cr=N(" enable mDNS"),Mr=h(),mi=m("input"),Sr=h(),Bl=m("div"),Tr=N("NTP "),pi=m("label"),ll=m("input"),Nr=N(" obtain from DHCP"),$r=m("br"),Er=h(),ss=m("div"),gl=m("input"),Ar=h(),tt=m("div"),os=m("strong"),os.textContent="MQTT",Pr=h(),On=m("a"),re(Fn.$$.fragment),Dr=h(),_i=m("input"),Ir=h(),cl=m("div"),Rr=N(`Server `),Nt&&Nt.c(),As=h(),Lr=m("br"),Or=h(),qn=m("div"),kl=m("input"),Fr=h(),nl=m("input"),qr=h(),ot&&ot.c(),Ps=h(),xl=m("div"),Br=N("Username"),Ur=m("br"),Hr=h(),wl=m("input"),jr=h(),en=m("div"),Wr=N("Password"),zr=m("br"),Gr=h(),yl=m("input"),Vr=h(),Bn=m("div"),Un=m("div"),Kr=N("Client ID"),Yr=m("br"),Qr=h(),Cl=m("input"),Xr=h(),Hn=m("div"),Zr=N("Payload"),Jr=m("br"),xr=h(),gt=m("select"),jn=m("option"),jn.textContent="JSON",Wn=m("option"),Wn.textContent="Raw (minimal)",zn=m("option"),zn.textContent="Raw (full)",Gn=m("option"),Gn.textContent="Domoticz",Vn=m("option"),Vn.textContent="HomeAssistant",Kn=m("option"),Kn.textContent="HEX dump",ea=h(),tn=m("div"),ta=N("Publish topic"),la=m("br"),na=h(),Ml=m("input"),ia=h(),rt&&rt.c(),Ds=h(),at&&at.c(),Is=h(),ut&&ut.c(),Rs=h(),ft&&ft.c(),Os=h(),ml=m("div"),rs=m("strong"),rs.textContent="User interface",sa=h(),Yn=m("a"),re(Qn.$$.fragment),oa=h(),di=m("input"),ra=h(),vi=m("div");for(let q=0;qSave',Bs=h(),re(ln.$$.fragment),Us=h(),re(nn.$$.fragment),Hs=h(),re(sn.$$.fragment),js=h(),re(on.$$.fragment),r(i,"class","text-sm"),r(u,"href",Ut("General-configuration")),r(u,"target","_blank"),r(u,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r($,"name","gh"),r($,"type","text"),r($,"class","in-f w-full"),r($,"pattern","[A-Za-z0-9-]+"),r(D,"name","gt"),r(D,"class","in-l w-full"),t[3].g.t===void 0&&Ge(()=>t[16].call(D)),r(b,"class","flex"),r(_,"class","my-1"),r(j,"type","hidden"),r(j,"name","p"),j.value="true",ue.__value="10YNO-1--------2",ue.value=ue.__value,x.__value="10YNO-2--------T",x.value=x.__value,W.__value="10YNO-3--------J",W.value=W.__value,U.__value="10YNO-4--------9",U.value=U.__value,ke.__value="10Y1001A1001A48H",ke.value=ke.__value,r(ee,"label","Norway"),Be.__value="10Y1001A1001A44P",Be.value=Be.__value,We.__value="10Y1001A1001A45N",We.value=We.__value,$e.__value="10Y1001A1001A46L",$e.value=$e.__value,ge.__value="10Y1001A1001A47J",ge.value=ge.__value,r(je,"label","Sweden"),Me.__value="10YDK-1--------W",Me.value=Me.__value,T.__value="10YDK-2--------M",T.value=T.__value,r(Le,"label","Denmark"),k.__value="10YAT-APG------L",k.value=k.__value,C.__value="10YBE----------2",C.value=C.__value,E.__value="10YCZ-CEPS-----N",E.value=E.__value,L.__value="10Y1001A1001A39I",L.value=L.__value,J.__value="10YFI-1--------U",J.value=J.__value,te.__value="10YFR-RTE------C",te.value=te.__value,fe.__value="10Y1001A1001A83F",fe.value=fe.__value,de.__value="10YGB----------A",de.value=de.__value,we.__value="10YLV-1001A00074",we.value=we.__value,Ee.__value="10YLT-1001A0008Q",Ee.value=Ee.__value,ae.__value="10YNL----------L",ae.value=ae.__value,Ce.__value="10YPL-AREA-----S",Ce.value=Ce.__value,Je.__value="10YCH-SWISSGRIDZ",Je.value=Je.__value,r(H,"name","pr"),r(H,"class","in-f w-full"),t[3].p.r===void 0&&Ge(()=>t[17].call(H)),r(Q,"class","w-full"),r(Ye,"name","pc"),r(Ye,"class","in-l"),t[3].p.c===void 0&&Ge(()=>t[18].call(Ye)),r(Y,"class","flex"),r(G,"class","my-1"),r(qe,"name","pf"),r(qe,"type","number"),r(qe,"min","0.001"),r(qe,"max","65"),r(qe,"step","0.001"),r(qe,"class","in-f tr w-full"),r(ze,"class","w-1/2"),r(ye,"name","pm"),r(ye,"type","number"),r(ye,"min","0.001"),r(ye,"max","1000"),r(ye,"step","0.001"),r(ye,"class","in-l tr w-full"),r(Ae,"class","w-1/2"),r(bt,"class","flex"),r(jt,"class","my-1"),r(Pt,"type","checkbox"),r(Pt,"name","pe"),Pt.__value="true",Pt.value=Pt.__value,r(Pt,"class","rounded mb-1"),r(hl,"class","my-1"),$l.__value=0,$l.value=$l.__value,El.__value=1,El.value=El.__value,Al.__value=2,Al.value=Al.__value,r(Dt,"name","gs"),r(Dt,"class","in-s"),t[3].g.s===void 0&&Ge(()=>t[23].call(Dt)),r(bl,"class","my-1"),r(n,"class","cnt"),r(dn,"class","text-sm"),r(Pl,"href",Ut("Meter-configuration")),r(Pl,"target","_blank"),r(Pl,"class","float-right"),r(Gl,"type","hidden"),r(Gl,"name","m"),Gl.value="true",r(mt,"type","hidden"),r(mt,"name","mo"),mt.value="1",vn.__value=0,vn.value=vn.__value,hn.__value=9,hn.value=hn.__value,r(Wt,"name","ma"),r(Wt,"class","in-s"),t[3].m.a===void 0&&Ge(()=>t[26].call(Wt)),r(Il,"class","my-1"),r(ji,"class","float-right"),r(Xt,"name","mi"),Xt.__value="true",Xt.value=Xt.__value,r(Xt,"type","checkbox"),r(Xt,"class","rounded mb-1"),r(fi,"class","mt-2 ml-3 whitespace-nowrap"),Ol.__value=0,Ol.value=Ol.__value,Ol.disabled=Wi=t[3].m.b!=0,r(al,"name","mb"),r(al,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Ge(()=>t[28].call(al)),Fl.__value=0,Fl.value=Fl.__value,Fl.disabled=zi=t[3].m.b!=0,bn.__value=2,bn.value=bn.__value,gn.__value=3,gn.value=gn.__value,kn.__value=10,kn.value=kn.__value,wn.__value=11,wn.value=wn.__value,r(dt,"name","mp"),r(dt,"class","in-m"),dt.disabled=Gi=t[3].m.b==0,t[3].m.p===void 0&&Ge(()=>t[29].call(dt)),r(It,"name","ms"),r(It,"type","number"),r(It,"min",64),r(It,"max",Vi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),r(It,"step",64),r(It,"class","in-l tr w-1/2"),r(Ll,"class","flex w-full"),r(rl,"class","my-1"),yn.__value=2,yn.value=yn.__value,Cn.__value=1,Cn.value=Cn.__value,r(ul,"name","md"),r(ul,"class","in-s"),t[3].m.d===void 0&&Ge(()=>t[31].call(ul)),r(Kl,"class","my-1"),r(Zt,"name","mf"),r(Zt,"type","number"),r(Zt,"min","5"),r(Zt,"max","65535"),r(Zt,"class","in-f tr w-full"),r(Ki,"class","in-post"),r(Sn,"class","flex"),r(Yl,"class","mx-1"),r(Jt,"name","mr"),r(Jt,"type","number"),r(Jt,"min","0"),r(Jt,"max","65535"),r(Jt,"class","in-f tr w-full"),r(Yi,"class","in-post"),r(Tn,"class","flex"),r(Ql,"class","mx-1"),r(Mn,"class","my-1 flex"),r(Ns,"class","my-1"),r(xt,"type","checkbox"),r(xt,"name","me"),xt.__value="true",xt.value=xt.__value,r(xt,"class","rounded mb-1"),r(Xl,"class","my-1"),r(el,"type","checkbox"),r(el,"name","mm"),el.__value="true",el.value=el.__value,r(el,"class","rounded mb-1"),r(He,"class","cnt"),r(Zi,"class","text-sm"),r(Nn,"href",Ut("WiFi-configuration")),r(Nn,"target","_blank"),r(Nn,"class","float-right"),r(ci,"type","hidden"),r(ci,"name","w"),ci.value="true",En.__value=1,En.value=En.__value,An.__value=2,An.value=An.__value,r(zt,"name","nc"),r(zt,"class","in-s"),t[3].n.c===void 0&&Ge(()=>t[42].call(zt)),r(Zl,"class","my-1"),r(Rt,"class","cnt"),r(Ji,"class","text-sm"),r(Pn,"href",Ut("Network-configuration")),r(Pn,"target","_blank"),r(Pn,"class","float-right"),In.__value="dhcp",In.value=In.__value,Rn.__value="static",Rn.value=Rn.__value,r(fl,"name","nm"),r(fl,"class","in-f"),t[3].n.m===void 0&&Ge(()=>t[48].call(fl)),r(Lt,"name","ni"),r(Lt,"type","text"),r(Lt,"class","in-m w-full"),Lt.disabled=xi=t[3].n.m=="dhcp",Lt.required=es=t[3].n.m=="static",r(Ot,"name","ns"),r(Ot,"class","in-l"),Ot.disabled=ts=t[3].n.m=="dhcp",Ot.required=ls=t[3].n.m=="static",t[3].n.s===void 0&&Ge(()=>t[50].call(Ot)),r(ql,"class","flex"),r(Jl,"class","my-1"),r(tl,"name","nd"),tl.__value="true",tl.value=tl.__value,r(tl,"type","checkbox"),r(tl,"class","rounded mb-1"),r(ns,"class","my-1"),r(mi,"type","hidden"),r(mi,"name","ntp"),mi.value="true",r(ll,"name","ntpd"),ll.__value="true",ll.value=ll.__value,r(ll,"type","checkbox"),r(ll,"class","rounded mb-1"),r(pi,"class","ml-4"),r(gl,"name","ntph"),r(gl,"type","text"),r(gl,"class","in-s"),r(ss,"class","flex"),r(Bl,"class","my-1"),r(pt,"class","cnt"),r(os,"class","text-sm"),r(On,"href",Ut("MQTT-configuration")),r(On,"target","_blank"),r(On,"class","float-right"),r(_i,"type","hidden"),r(_i,"name","q"),_i.value="true",r(kl,"name","qh"),r(kl,"type","text"),r(kl,"class","in-f w-3/4"),r(nl,"name","qp"),r(nl,"type","number"),r(nl,"min","1024"),r(nl,"max","65535"),r(nl,"class","in-l tr w-1/4"),r(qn,"class","flex"),r(cl,"class","my-1"),r(wl,"name","qu"),r(wl,"type","text"),r(wl,"class","in-s"),r(xl,"class","my-1"),r(yl,"name","qa"),r(yl,"type","password"),r(yl,"class","in-s"),r(en,"class","my-1"),r(Cl,"name","qc"),r(Cl,"type","text"),r(Cl,"class","in-f w-full"),jn.__value=0,jn.value=jn.__value,Wn.__value=1,Wn.value=Wn.__value,zn.__value=2,zn.value=zn.__value,Gn.__value=3,Gn.value=Gn.__value,Vn.__value=4,Vn.value=Vn.__value,Kn.__value=255,Kn.value=Kn.__value,r(gt,"name","qm"),r(gt,"class","in-l"),t[3].q.m===void 0&&Ge(()=>t[63].call(gt)),r(Bn,"class","my-1 flex"),r(Ml,"name","qb"),r(Ml,"type","text"),r(Ml,"class","in-s"),r(tn,"class","my-1"),r(tt,"class","cnt"),r(rs,"class","text-sm"),r(Yn,"href",Ut("User-interface")),r(Yn,"target","_blank"),r(Yn,"class","float-right"),r(di,"type","hidden"),r(di,"name","u"),di.value="true",r(vi,"class","flex flex-wrap"),r(ml,"class","cnt"),r(as,"class","text-sm"),r(Xn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(Xn,"target","_blank"),r(Xn,"class","float-right"),r(hi,"type","hidden"),r(hi,"name","d"),hi.value="true",r(il,"type","checkbox"),r(il,"name","ds"),il.__value="true",il.value=il.__value,r(il,"class","rounded mb-1"),r(us,"class","mt-3"),r(Ft,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(Jn,"type","button"),r(Jn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),r(xn,"type","button"),r(xn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),r(cs,"class","text-center"),r(ms,"class","text-right"),r(Ul,"class","grid grid-cols-3"),r(e,"autocomplete","off")},m(q,me){M(q,e,me),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),se(a,u,null),s(n,c),s(n,f),s(n,p),s(n,_),s(_,b),s(b,v),s(v,d),s(v,g),s(v,w),s(v,$),ne($,t[3].g.h),s(b,S),s(b,P),s(P,F),s(P,A),s(P,I),s(P,D),se(O,D,null),Se(D,t[3].g.t,!0),s(n,ie),s(n,j),s(n,K),s(n,G),s(G,Y),s(Y,Q),s(Q,z),s(Q,Z),s(Q,V),s(Q,H),s(H,ee),s(ee,ue),s(ee,x),s(ee,W),s(ee,U),s(ee,ke),s(H,je),s(je,Be),s(je,We),s(je,$e),s(je,ge),s(H,Le),s(Le,Me),s(Le,T),s(H,k),s(H,C),s(H,E),s(H,L),s(H,J),s(H,te),s(H,fe),s(H,de),s(H,we),s(H,Ee),s(H,ae),s(H,Ce),s(H,Je),Se(H,t[3].p.r,!0),s(Y,Et),s(Y,st),s(st,ht),s(st,lt),s(st,At),s(st,Ye);for(let _t=0;_t<5;_t+=1)bi[_t]&&bi[_t].m(Ye,null);Se(Ye,t[3].p.c,!0),s(n,Qt),s(n,jt),s(jt,bt),s(bt,ze),s(ze,xe),s(ze,Xe),s(ze,Ue),s(ze,qe),ne(qe,t[3].p.f),s(bt,et),s(bt,Ae),s(Ae,Oe),s(Ae,pe),s(Ae,ce),s(Ae,ye),ne(ye,t[3].p.m),s(n,zl),s(n,hl),s(hl,_n),s(_n,Pt),Pt.checked=t[3].p.e,s(_n,Ai),s(hl,Pi),kt&&kt.m(hl,null),s(n,Di),s(n,bl),s(bl,Ii),s(bl,Ri),s(bl,Li),s(bl,Dt),s(Dt,$l),s(Dt,El),s(Dt,Al),Se(Dt,t[3].g.s,!0),s(n,Oi),wt&&wt.m(n,null),s(l,Fi),s(l,He),s(He,dn),s(He,qi),s(He,Pl),se(Dl,Pl,null),s(He,Bi),s(He,Gl),s(He,Ze),s(He,mt),s(He,Vl),s(He,Il),s(Il,Ui),s(Il,Rl),s(Il,Hi),s(Il,Wt),s(Wt,vn),s(Wt,hn),Se(Wt,t[3].m.a,!0),s(He,Ao),s(He,rl),s(rl,ji),s(rl,Po),s(rl,Ts),s(rl,Do),s(rl,fi),s(fi,Xt),Xt.checked=t[3].m.i,s(fi,Io),s(rl,Ro),s(rl,Ll),s(Ll,al),s(al,Ol),s(Ol,Lo);for(let _t=0;_t<7;_t+=1)gi[_t]&&gi[_t].m(al,null);Se(al,t[3].m.b,!0),s(Ll,Oo),s(Ll,dt),s(dt,Fl),s(Fl,Fo),s(dt,bn),s(dt,gn),s(dt,kn),s(dt,wn),Se(dt,t[3].m.p,!0),s(Ll,qo),s(Ll,It),ne(It,t[3].m.s),s(He,Bo),s(He,Kl),s(Kl,Uo),s(Kl,Ho),s(Kl,jo),s(Kl,ul),s(ul,yn),s(ul,Cn),Se(ul,t[3].m.d,!0),s(He,Wo),s(He,Mn),s(Mn,Yl),s(Yl,zo),s(Yl,Go),s(Yl,Vo),s(Yl,Sn),s(Sn,Zt),ne(Zt,t[3].m.f),s(Sn,Ko),s(Sn,Ki),s(Mn,Yo),s(Mn,Ql),s(Ql,Qo),s(Ql,Xo),s(Ql,Zo),s(Ql,Tn),s(Tn,Jt),ne(Jt,t[3].m.r),s(Tn,Jo),s(Tn,Yi),s(He,xo),s(He,Ns),s(He,er),s(He,Xl),s(Xl,Qi),s(Qi,xt),xt.checked=t[3].m.e.e,s(Qi,tr),s(Xl,lr),yt&&yt.m(Xl,null),s(He,nr),Ct&&Ct.m(He,null),s(He,$s),s(He,Xi),s(Xi,el),el.checked=t[3].m.m.e,s(Xi,ir),s(He,sr),Mt&&Mt.m(He,null),s(l,or),s(l,Rt),s(Rt,Zi),s(Rt,rr),s(Rt,Nn),se($n,Nn,null),s(Rt,ar),s(Rt,ci),s(Rt,ur),s(Rt,Zl),s(Zl,fr),s(Zl,cr),s(Zl,mr),s(Zl,zt),s(zt,En),s(zt,An),qt&&qt.m(zt,null),Se(zt,t[3].n.c,!0),s(Rt,pr),St&&St.m(Rt,null),s(l,_r),s(l,pt),s(pt,Ji),s(pt,dr),s(pt,Pn),se(Dn,Pn,null),s(pt,vr),s(pt,Jl),s(Jl,hr),s(Jl,br),s(Jl,gr),s(Jl,ql),s(ql,fl),s(fl,In),s(fl,Rn),Se(fl,t[3].n.m,!0),s(ql,kr),s(ql,Lt),ne(Lt,t[3].n.i),s(ql,wr),s(ql,Ot),se(Ln,Ot,null),Se(Ot,t[3].n.s,!0),s(pt,yr),Tt&&Tt.m(pt,null),s(pt,Es),s(pt,ns),s(ns,is),s(is,tl),tl.checked=t[3].n.d,s(is,Cr),s(pt,Mr),s(pt,mi),s(pt,Sr),s(pt,Bl),s(Bl,Tr),s(Bl,pi),s(pi,ll),ll.checked=t[3].n.h,s(pi,Nr),s(Bl,$r),s(Bl,Er),s(Bl,ss),s(ss,gl),ne(gl,t[3].n.n1),s(l,Ar),s(l,tt),s(tt,os),s(tt,Pr),s(tt,On),se(Fn,On,null),s(tt,Dr),s(tt,_i),s(tt,Ir),s(tt,cl),s(cl,Rr),Nt&&Nt.m(cl,null),s(cl,As),s(cl,Lr),s(cl,Or),s(cl,qn),s(qn,kl),ne(kl,t[3].q.h),s(qn,Fr),s(qn,nl),ne(nl,t[3].q.p),s(tt,qr),ot&&ot.m(tt,null),s(tt,Ps),s(tt,xl),s(xl,Br),s(xl,Ur),s(xl,Hr),s(xl,wl),ne(wl,t[3].q.u),s(tt,jr),s(tt,en),s(en,Wr),s(en,zr),s(en,Gr),s(en,yl),ne(yl,t[3].q.a),s(tt,Vr),s(tt,Bn),s(Bn,Un),s(Un,Kr),s(Un,Yr),s(Un,Qr),s(Un,Cl),ne(Cl,t[3].q.c),s(Bn,Xr),s(Bn,Hn),s(Hn,Zr),s(Hn,Jr),s(Hn,xr),s(Hn,gt),s(gt,jn),s(gt,Wn),s(gt,zn),s(gt,Gn),s(gt,Vn),s(gt,Kn),Se(gt,t[3].q.m,!0),s(tt,ea),s(tt,tn),s(tn,ta),s(tn,la),s(tn,na),s(tn,Ml),ne(Ml,t[3].q.b),s(l,ia),rt&&rt.m(l,null),s(l,Ds),at&&at.m(l,null),s(l,Is),ut&&ut.m(l,null),s(l,Rs),ft&&ft.m(l,null),s(l,Os),s(l,ml),s(ml,rs),s(ml,sa),s(ml,Yn),se(Qn,Yn,null),s(ml,oa),s(ml,di),s(ml,ra),s(ml,vi);for(let _t=0;_t0?wt?wt.p(q,me):(wt=rf(q),wt.c(),wt.m(n,null)):wt&&(wt.d(1),wt=null),me[0]&8&&Se(Wt,q[3].m.a),me[0]&8&&(Xt.checked=q[3].m.i),(!Gt||me[0]&8&&Wi!==(Wi=q[3].m.b!=0))&&(Ol.disabled=Wi),me[0]&8&&Se(al,q[3].m.b),(!Gt||me[0]&8&&zi!==(zi=q[3].m.b!=0))&&(Fl.disabled=zi),(!Gt||me[0]&8&&Gi!==(Gi=q[3].m.b==0))&&(dt.disabled=Gi),me[0]&8&&Se(dt,q[3].m.p),(!Gt||me[0]&9&&Vi!==(Vi=q[0].chip=="esp8266"?q[3].i.h.p==3||q[3].i.h.p==113?512:128:4096))&&r(It,"max",Vi),me[0]&8&&he(It.value)!==q[3].m.s&&ne(It,q[3].m.s),me[0]&8&&Se(ul,q[3].m.d),me[0]&8&&he(Zt.value)!==q[3].m.f&&ne(Zt,q[3].m.f),me[0]&8&&he(Jt.value)!==q[3].m.r&&ne(Jt,q[3].m.r),me[0]&8&&(xt.checked=q[3].m.e.e),q[3].m.e.e?yt?yt.p(q,me):(yt=af(q),yt.c(),yt.m(Xl,null)):yt&&(yt.d(1),yt=null),q[3].m.e.e?Ct?Ct.p(q,me):(Ct=uf(q),Ct.c(),Ct.m(He,$s)):Ct&&(Ct.d(1),Ct=null),me[0]&8&&(el.checked=q[3].m.m.e),q[3].m.m.e?Mt?Mt.p(q,me):(Mt=ff(q),Mt.c(),Mt.m(He,null)):Mt&&(Mt.d(1),Mt=null),q[0].if&&q[0].if.eth?qt||(qt=cf(),qt.c(),qt.m(zt,null)):qt&&(qt.d(1),qt=null),me[0]&8&&Se(zt,q[3].n.c),q[3].n.c==1||q[3].n.c==2?St?St.p(q,me):(St=mf(q),St.c(),St.m(Rt,null)):St&&(St.d(1),St=null),me[0]&8&&Se(fl,q[3].n.m),(!Gt||me[0]&8&&xi!==(xi=q[3].n.m=="dhcp"))&&(Lt.disabled=xi),(!Gt||me[0]&8&&es!==(es=q[3].n.m=="static"))&&(Lt.required=es),me[0]&8&&Lt.value!==q[3].n.i&&ne(Lt,q[3].n.i),(!Gt||me[0]&8&&ts!==(ts=q[3].n.m=="dhcp"))&&(Ot.disabled=ts),(!Gt||me[0]&8&&ls!==(ls=q[3].n.m=="static"))&&(Ot.required=ls),me[0]&8&&Se(Ot,q[3].n.s),q[3].n.m=="static"?Tt?Tt.p(q,me):(Tt=pf(q),Tt.c(),Tt.m(pt,Es)):Tt&&(Tt.d(1),Tt=null),me[0]&8&&(tl.checked=q[3].n.d),me[0]&8&&(ll.checked=q[3].n.h),me[0]&8&&gl.value!==q[3].n.n1&&ne(gl,q[3].n.n1),q[0].chip!="esp8266"?Nt?Nt.p(q,me):(Nt=_f(q),Nt.c(),Nt.m(cl,As)):Nt&&(Nt.d(1),Nt=null),me[0]&8&&kl.value!==q[3].q.h&&ne(kl,q[3].q.h),me[0]&8&&he(nl.value)!==q[3].q.p&&ne(nl,q[3].q.p),q[3].q.s.e?ot?(ot.p(q,me),me[0]&8&&R(ot,1)):(ot=df(q),ot.c(),R(ot,1),ot.m(tt,Ps)):ot&&(Ie(),B(ot,1,1,()=>{ot=null}),Re()),me[0]&8&&wl.value!==q[3].q.u&&ne(wl,q[3].q.u),me[0]&8&&yl.value!==q[3].q.a&&ne(yl,q[3].q.a),me[0]&8&&Cl.value!==q[3].q.c&&ne(Cl,q[3].q.c),me[0]&8&&Se(gt,q[3].q.m),me[0]&8&&Ml.value!==q[3].q.b&&ne(Ml,q[3].q.b),q[3].q.m==3?rt?(rt.p(q,me),me[0]&8&&R(rt,1)):(rt=vf(q),rt.c(),R(rt,1),rt.m(l,Ds)):rt&&(Ie(),B(rt,1,1,()=>{rt=null}),Re()),q[3].q.m==4?at?(at.p(q,me),me[0]&8&&R(at,1)):(at=hf(q),at.c(),R(at,1),at.m(l,Is)):at&&(Ie(),B(at,1,1,()=>{at=null}),Re()),q[3].c.es!=null?ut?(ut.p(q,me),me[0]&8&&R(ut,1)):(ut=bf(q),ut.c(),R(ut,1),ut.m(l,Rs)):ut&&(Ie(),B(ut,1,1,()=>{ut=null}),Re()),me[0]&8&&(Ls=q[3].p.r.startsWith("10YNO")||q[3].p.r.startsWith("10Y1001A1001A4")),Ls?ft?(ft.p(q,me),me[0]&8&&R(ft,1)):(ft=wf(q),ft.c(),R(ft,1),ft.m(l,Os)):ft&&(Ie(),B(ft,1,1,()=>{ft=null}),Re()),me[0]&136){ei=q[7];let Vt;for(Vt=0;Vt20||q[0].chip=="esp8266"||q[3].i.d.d>0?ct?(ct.p(q,me),me[0]&9&&R(ct,1)):(ct=Mf(q),ct.c(),R(ct,1),ct.m(l,Fs)):ct&&(Ie(),B(ct,1,1,()=>{ct=null}),Re()),me[0]&8&&(il.checked=q[3].d.s),q[3].d.s?$t?$t.p(q,me):($t=Pf(q),$t.c(),$t.m(Ft,null)):$t&&($t.d(1),$t=null);const _t={};me[0]&2&&(_t.active=q[1]),ln.$set(_t);const ba={};me[0]&4&&(ba.active=q[2]),nn.$set(ba);const ga={};me[0]&16&&(ga.active=q[4]),sn.$set(ga);const ka={};me[0]&32&&(ka.active=q[5]),on.$set(ka)},i(q){Gt||(R(a.$$.fragment,q),R(O.$$.fragment,q),R(Dl.$$.fragment,q),R($n.$$.fragment,q),R(Dn.$$.fragment,q),R(Ln.$$.fragment,q),R(Fn.$$.fragment,q),R(ot),R(rt),R(at),R(ut),R(ft),R(Qn.$$.fragment,q),R(ct),R(Zn.$$.fragment,q),R(ln.$$.fragment,q),R(nn.$$.fragment,q),R(sn.$$.fragment,q),R(on.$$.fragment,q),Gt=!0)},o(q){B(a.$$.fragment,q),B(O.$$.fragment,q),B(Dl.$$.fragment,q),B($n.$$.fragment,q),B(Dn.$$.fragment,q),B(Ln.$$.fragment,q),B(Fn.$$.fragment,q),B(ot),B(rt),B(at),B(ut),B(ft),B(Qn.$$.fragment,q),B(ct),B(Zn.$$.fragment,q),B(ln.$$.fragment,q),B(nn.$$.fragment,q),B(sn.$$.fragment,q),B(on.$$.fragment,q),Gt=!1},d(q){q&&y(e),oe(a),oe(O),Kt(bi,q),kt&&kt.d(),wt&&wt.d(),oe(Dl),Kt(gi,q),yt&&yt.d(),Ct&&Ct.d(),Mt&&Mt.d(),oe($n),qt&&qt.d(),St&&St.d(),oe(Dn),oe(Ln),Tt&&Tt.d(),oe(Fn),Nt&&Nt.d(),ot&&ot.d(),rt&&rt.d(),at&&at.d(),ut&&ut.d(),ft&&ft.d(),oe(Qn),Kt(vt,q),ct&&ct.d(),oe(Zn),$t&&$t.d(),q&&y(Bs),oe(ln,q),q&&y(Us),oe(nn,q),q&&y(Hs),oe(sn,q),q&&y(js),oe(on,q),Ws=!1,Ve(ha)}}}async function Ep(){await(await fetch("/reboot",{method:"POST"})).json()}function Ap(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:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],o=!0,u=!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,b:!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},d:{d:null,b:0},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{e:!1,i:null,s:null,es:null}};yi.subscribe(Ze=>{Ze.version&&(l(3,a=Ze),l(1,o=!1))}),Qm();let c=!1,f=!1;async function p(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Ze=new URLSearchParams;Ze.append("perform","true");let Vl=await(await fetch("/reset",{method:"POST",body:Ze})).json();l(4,c=!1),l(5,f=Vl.success)}}async function _(Ze){l(2,u=!0);const mt=new FormData(Ze.target),Vl=new URLSearchParams;for(let Rl of mt){const[Hi,Wt]=Rl;Vl.append(Hi,Wt)}let Ui=await(await fetch("/save",{method:"POST",body:Vl})).json();Yt.update(Rl=>(Rl.booting=Ui.reboot,Rl.ui=a.u,Rl)),l(2,u=!1),si("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(Yt.update(Ze=>(Ze.booting=!0,Ze)),Ep())};async function v(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),yi.update(mt=>(mt.q.s.c=!1,mt)))}async function d(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),yi.update(mt=>(mt.q.s.r=!1,mt)))}async function g(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),yi.update(mt=>(mt.q.s.k=!1,mt)))}const w=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 $=44;function S(){a.g.h=this.value,l(3,a)}function P(){a.g.t=nt(this),l(3,a)}function F(){a.p.r=nt(this),l(3,a)}function A(){a.p.c=nt(this),l(3,a)}function I(){a.p.f=he(this.value),l(3,a)}function D(){a.p.m=he(this.value),l(3,a)}function O(){a.p.e=this.checked,l(3,a)}function ie(){a.p.t=this.value,l(3,a)}function j(){a.g.s=nt(this),l(3,a)}function K(){a.g.u=this.value,l(3,a)}function G(){a.g.p=this.value,l(3,a)}function Y(){a.m.a=nt(this),l(3,a)}function Q(){a.m.i=this.checked,l(3,a)}function z(){a.m.b=nt(this),l(3,a)}function Z(){a.m.p=nt(this),l(3,a)}function V(){a.m.s=he(this.value),l(3,a)}function H(){a.m.d=nt(this),l(3,a)}function ee(){a.m.f=he(this.value),l(3,a)}function ue(){a.m.r=he(this.value),l(3,a)}function x(){a.m.e.e=this.checked,l(3,a)}function W(){a.m.e.k=this.value,l(3,a)}function U(){a.m.e.a=this.value,l(3,a)}function ke(){a.m.m.e=this.checked,l(3,a)}function je(){a.m.m.w=he(this.value),l(3,a)}function Be(){a.m.m.v=he(this.value),l(3,a)}function We(){a.m.m.a=he(this.value),l(3,a)}function $e(){a.m.m.c=he(this.value),l(3,a)}function ge(){a.n.c=nt(this),l(3,a)}function Le(){a.w.s=this.value,l(3,a)}function Me(){a.w.p=this.value,l(3,a)}function T(){a.w.z=nt(this),l(3,a)}function k(){a.w.w=he(this.value),l(3,a)}function C(){a.w.b=this.checked,l(3,a)}function E(){a.n.m=nt(this),l(3,a)}function L(){a.n.i=this.value,l(3,a)}function J(){a.n.s=nt(this),l(3,a)}function te(){a.n.g=this.value,l(3,a)}function fe(){a.n.d1=this.value,l(3,a)}function de(){a.n.d2=this.value,l(3,a)}function we(){a.n.d=this.checked,l(3,a)}function Ee(){a.n.h=this.checked,l(3,a)}function ae(){a.n.n1=this.value,l(3,a)}function Ce(){a.q.s.e=this.checked,l(3,a)}function Je(){a.q.h=this.value,l(3,a)}function Et(){a.q.p=he(this.value),l(3,a)}function st(){a.q.u=this.value,l(3,a)}function ht(){a.q.a=this.value,l(3,a)}function lt(){a.q.c=this.value,l(3,a)}function At(){a.q.m=nt(this),l(3,a)}function Ye(){a.q.b=this.value,l(3,a)}function Qt(){a.o.e=this.value,l(3,a)}function jt(){a.o.c=this.value,l(3,a)}function bt(){a.o.u1=this.value,l(3,a)}function ze(){a.o.u2=this.value,l(3,a)}function xe(){a.o.u3=this.value,l(3,a)}function Xe(){a.h.t=this.value,l(3,a)}function Ue(){a.h.h=this.value,l(3,a)}function qe(){a.h.n=this.value,l(3,a)}function et(){a.c.e=this.checked,l(3,a)}function Ae(){a.c.i=this.value,l(3,a)}function Oe(){a.c.s=this.value,l(3,a)}function pe(){a.c.es=this.checked,l(3,a)}function ce(Ze){a.t.t[Ze]=he(this.value),l(3,a)}function ye(){a.t.h=he(this.value),l(3,a)}function zl(Ze){a.u[Ze.key]=nt(this),l(3,a)}function hl(){a.i.h.p=nt(this),l(3,a)}function _n(){a.i.h.t=nt(this),l(3,a)}function Pt(){a.i.h.u=this.checked,l(3,a)}function Ai(){a.i.a=he(this.value),l(3,a)}function Pi(){a.i.l.p=he(this.value),l(3,a)}function Di(){a.i.l.i=this.checked,l(3,a)}function bl(){a.i.r.i=this.checked,l(3,a)}function Ii(){a.i.r.r=he(this.value),l(3,a)}function Ri(){a.i.r.g=he(this.value),l(3,a)}function Li(){a.i.r.b=he(this.value),l(3,a)}function Dt(){a.i.d.d=he(this.value),l(3,a)}function $l(){a.i.t.d=he(this.value),l(3,a)}function El(){a.i.t.a=he(this.value),l(3,a)}function Al(){a.i.v.p=he(this.value),l(3,a)}function Oi(){a.i.v.d.v=he(this.value),l(3,a)}function Fi(){a.i.v.d.g=he(this.value),l(3,a)}function He(){a.i.d.b=nt(this),l(3,a)}function dn(){a.i.v.o=he(this.value),l(3,a)}function qi(){a.i.v.m=he(this.value),l(3,a)}function Pl(){a.i.v.b=he(this.value),l(3,a)}function Dl(){a.d.s=this.checked,l(3,a)}function Bi(){a.d.t=this.checked,l(3,a)}function Gl(){a.d.l=nt(this),l(3,a)}return t.$$set=Ze=>{"sysinfo"in Ze&&l(0,n=Ze.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,$=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,u,a,c,f,$,i,p,_,b,v,d,g,w,S,P,F,A,I,D,O,ie,j,K,G,Y,Q,z,Z,V,H,ee,ue,x,W,U,ke,je,Be,We,$e,ge,Le,Me,T,k,C,E,L,J,te,fe,de,we,Ee,ae,Ce,Je,Et,st,ht,lt,At,Ye,Qt,jt,bt,ze,xe,Xe,Ue,qe,et,Ae,Oe,pe,ce,ye,zl,hl,_n,Pt,Ai,Pi,Di,bl,Ii,Ri,Li,Dt,$l,El,Al,Oi,Fi,He,dn,qi,Pl,Dl,Bi,Gl]}class Pp extends De{constructor(e){super(),Pe(this,e,Ap,$p,Ne,{sysinfo:0},null,[-1,-1,-1,-1])}}function If(t,e,l){const n=t.slice();return n[20]=e[l],n}function Dp(t){let e=ve(t[1].chip,t[1].board)+"",l;return{c(){l=N(e)},m(n,i){M(n,l,i)},p(n,i){i&2&&e!==(e=ve(n[1].chip,n[1].board)+"")&&X(l,e)},d(n){n&&y(l)}}}function Rf(t){let e,l,n=t[1].apmac+"",i,o,u,a,c,f,p,_,b,v=Ba(t[1])+"",d,g,w=t[1].boot_reason+"",$,S,P=t[1].ex_cause+"",F,A,I;const D=[Rp,Ip],O=[];function ie(j,K){return j[0].u>0?0:1}return c=ie(t),f=O[c]=D[c](t),{c(){e=m("div"),l=N("AP MAC: "),i=N(n),o=h(),u=m("div"),a=N(`Last boot: `),f.c(),p=h(),_=m("div"),b=N("Reason: "),d=N(v),g=N(" ("),$=N(w),S=N("/"),F=N(P),A=N(")"),r(e,"class","my-2"),r(u,"class","my-2"),r(_,"class","my-2")},m(j,K){M(j,e,K),s(e,l),s(e,i),M(j,o,K),M(j,u,K),s(u,a),O[c].m(u,null),M(j,p,K),M(j,_,K),s(_,b),s(_,d),s(_,g),s(_,$),s(_,S),s(_,F),s(_,A),I=!0},p(j,K){(!I||K&2)&&n!==(n=j[1].apmac+"")&&X(i,n);let G=c;c=ie(j),c===G?O[c].p(j,K):(Ie(),B(O[G],1,1,()=>{O[G]=null}),Re(),f=O[c],f?f.p(j,K):(f=O[c]=D[c](j),f.c()),R(f,1),f.m(u,null)),(!I||K&2)&&v!==(v=Ba(j[1])+"")&&X(d,v),(!I||K&2)&&w!==(w=j[1].boot_reason+"")&&X($,w),(!I||K&2)&&P!==(P=j[1].ex_cause+"")&&X(F,P)},i(j){I||(R(f),I=!0)},o(j){B(f),I=!1},d(j){j&&y(e),j&&y(o),j&&y(u),O[c].d(),j&&y(p),j&&y(_)}}}function Ip(t){let e;return{c(){e=N("-")},m(l,n){M(l,e,n)},p:_e,i:_e,o:_e,d(l){l&&y(e)}}}function Rp(t){let e,l;return e=new Zc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){re(e.$$.fragment)},m(n,i){se(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||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Lp(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){M(l,e,n)},p:_e,d(l){l&&y(e)}}}function Lf(t){let e,l,n,i,o,u=ys(t[1].meter.mfg)+"",a,c,f,p,_=(t[1].meter.model?t[1].meter.model:"unknown")+"",b,v,d,g,w=(t[1].meter.id?t[1].meter.id:"unknown")+"",$;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),o=N("Manufacturer: "),a=N(u),c=h(),f=m("div"),p=N("Model: "),b=N(_),v=h(),d=m("div"),g=N("ID: "),$=N(w),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(e,"class","cnt")},m(S,P){M(S,e,P),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,c),s(e,f),s(f,p),s(f,b),s(e,v),s(e,d),s(d,g),s(d,$)},p(S,P){P&2&&u!==(u=ys(S[1].meter.mfg)+"")&&X(a,u),P&2&&_!==(_=(S[1].meter.model?S[1].meter.model:"unknown")+"")&&X(b,_),P&2&&w!==(w=(S[1].meter.id?S[1].meter.id:"unknown")+"")&&X($,w)},d(S){S&&y(e)}}}function Of(t){let e,l,n,i,o,u=t[1].net.ip+"",a,c,f,p,_=t[1].net.mask+"",b,v,d,g,w=t[1].net.gw+"",$,S,P,F,A=t[1].net.dns1+"",I,D,O=t[1].net.dns2&&Ff(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),o=N("IP: "),a=N(u),c=h(),f=m("div"),p=N("Mask: "),b=N(_),v=h(),d=m("div"),g=N("Gateway: "),$=N(w),S=h(),P=m("div"),F=N("DNS: "),I=N(A),D=h(),O&&O.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(P,"class","my-2"),r(e,"class","cnt")},m(ie,j){M(ie,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,c),s(e,f),s(f,p),s(f,b),s(e,v),s(e,d),s(d,g),s(d,$),s(e,S),s(e,P),s(P,F),s(P,I),s(P,D),O&&O.m(P,null)},p(ie,j){j&2&&u!==(u=ie[1].net.ip+"")&&X(a,u),j&2&&_!==(_=ie[1].net.mask+"")&&X(b,_),j&2&&w!==(w=ie[1].net.gw+"")&&X($,w),j&2&&A!==(A=ie[1].net.dns1+"")&&X(I,A),ie[1].net.dns2?O?O.p(ie,j):(O=Ff(ie),O.c(),O.m(P,null)):O&&(O.d(1),O=null)},d(ie){ie&&y(e),O&&O.d()}}}function Ff(t){let e,l=t[1].net.dns2+"",n;return{c(){e=N("/ "),n=N(l)},m(i,o){M(i,e,o),M(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&X(n,l)},d(i){i&&y(e),i&&y(n)}}}function qf(t){let e,l,n,i=t[1].upgrade.f+"",o,u,a=t[1].upgrade.t+"",c,f,p=qa(t[1].upgrade.e)+"",_;return{c(){e=m("div"),l=m("div"),n=N("Previous upgrade attempt from "),o=N(i),u=N(" to "),c=N(a),f=N(" failed. "),_=N(p),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(b,v){M(b,e,v),s(e,l),s(l,n),s(l,o),s(l,u),s(l,c),s(l,f),s(l,_)},p(b,v){v&2&&i!==(i=b[1].upgrade.f+"")&&X(o,i),v&2&&a!==(a=b[1].upgrade.t+"")&&X(c,a),v&2&&p!==(p=qa(b[1].upgrade.e)+"")&&X(_,p)},d(b){b&&y(e)}}}function Bf(t){let e,l,n,i=t[2].tag_name+"",o,u,a,c,f,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Uf(t),b=t[1].fwconsent===2&&Hf();return{c(){e=m("div"),l=N(`Latest version: - `),n=m("a"),o=N(i),a=h(),_&&_.c(),c=h(),b&&b.c(),f=Ke(),r(n,"href",u=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(n,o),s(e,a),_&&_.m(e,null),M(v,c,d),b&&b.m(v,d),M(v,f,d),p=!0},p(v,d){(!p||d&4)&&i!==(i=v[2].tag_name+"")&&X(o,i),(!p||d&4&&u!==(u=v[2].html_url))&&r(n,"href",u),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[2]&&v[2].tag_name!=v[1].version?_?(_.p(v,d),d&7&&R(_,1)):(_=Uf(v),_.c(),R(_,1),_.m(e,null)):_&&(Ie(),B(_,1,1,()=>{_=null}),Re()),v[1].fwconsent===2?b||(b=Hf(),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i(v){p||(R(_),p=!0)},o(v){B(_),p=!1},d(v){v&&y(e),_&&_.d(),v&&y(c),b&&b.d(v),v&&y(f)}}}function Uf(t){let e,l,n,i,o,u;return n=new Jc({}),{c(){e=m("div"),l=m("button"),re(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(a,c){M(a,e,c),s(e,l),se(n,l,null),i=!0,o||(u=le(l,"click",t[10]),o=!0)},p:_e,i(a){i||(R(n.$$.fragment,a),i=!0)},o(a){B(n.$$.fragment,a),i=!1},d(a){a&&y(e),oe(n),o=!1,u()}}}function Hf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',r(e,"class","my-2")},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function jf(t){let e,l=Cs(ve(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=Cs(ve(i[1].chip,i[1].board))+"")&&X(n,l)},d(i){i&&y(e)}}}function Wf(t){let e,l,n,i,o,u;function a(p,_){return p[4].length==0?Fp:Op}let c=a(t),f=c(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),f.c(),rc(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(p,_){M(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(u=[le(n,"change",t[13]),le(l,"submit",t[15])],o=!0)},p(p,_){c===(c=a(p))&&f?f.p(p,_):(f.d(1),f=c(p),f&&(f.c(),f.m(l,null)))},d(p){p&&y(e),t[12](null),f.d(),o=!1,Ve(u)}}}function Op(t){let e=t[4][0].name+"",l,n,i;return{c(){l=N(e),n=h(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,u){M(o,l,u),M(o,n,u),M(o,i,u)},p(o,u){u&16&&e!==(e=o[4][0].name+"")&&X(l,e)},d(o){o&&y(l),o&&y(n),o&&y(i)}}}function Fp(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){M(i,e,o),l||(n=le(e,"click",t[14]),l=!0)},p:_e,d(i){i&&y(e),l=!1,n()}}}function zf(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g=t[9],w=[];for(let A=0;A Include Secrets
(SSID, PSK, passwords and tokens)',c=h(),$&&$.c(),f=h(),p=m("form"),_=m("input"),b=h(),F.c(),r(l,"class","text-sm"),r(a,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),rc(_,"display","none"),r(_,"name","file"),r(_,"type","file"),r(_,"accept",".cfg"),r(p,"action","/configfile"),r(p,"enctype","multipart/form-data"),r(p,"method","post"),r(p,"autocomplete","off"),r(e,"class","cnt")},m(A,I){M(A,e,I),s(e,l),s(e,n),s(e,i),s(i,o);for(let D=0;D{E=null}),Re());const Et={};Ce&8388608&&(Et.$$scope={dirty:Ce,ctx:ae}),ie.$set(Et),ae[1].meter?L?L.p(ae,Ce):(L=Lf(ae),L.c(),L.m(e,Y)):L&&(L.d(1),L=null),ae[1].net?J?J.p(ae,Ce):(J=Of(ae),J.c(),J.m(e,Q)):J&&(J.d(1),J=null),(!T||Ce&2)&&ue!==(ue=ae[1].version+"")&&X(x,ue),ae[1].upgrade.t&&ae[1].upgrade.t!=ae[1].version?te?te.p(ae,Ce):(te=qf(ae),te.c(),te.m(z,U)):te&&(te.d(1),te=null),ae[2]?fe?(fe.p(ae,Ce),Ce&4&&R(fe,1)):(fe=Bf(ae),fe.c(),R(fe,1),fe.m(z,ke)):fe&&(Ie(),B(fe,1,1,()=>{fe=null}),Re()),Ce&3&&(je=(ae[1].security==0||ae[0].a)&&oi(ae[1].board)),je?de?de.p(ae,Ce):(de=jf(ae),de.c(),de.m(z,Be)):de&&(de.d(1),de=null),ae[1].security==0||ae[0].a?we?we.p(ae,Ce):(we=Wf(ae),we.c(),we.m(z,null)):we&&(we.d(1),we=null),ae[1].security==0||ae[0].a?Ee?Ee.p(ae,Ce):(Ee=zf(ae),Ee.c(),Ee.m(e,null)):Ee&&(Ee.d(1),Ee=null);const st={};Ce&32&&(st.active=ae[5]),ge.$set(st);const ht={};Ce&256&&(ht.active=ae[8]),Me.$set(ht)},i(ae){T||(R(w.$$.fragment,ae),R(E),R(ie.$$.fragment,ae),R(fe),R(ge.$$.fragment,ae),R(Me.$$.fragment,ae),T=!0)},o(ae){B(w.$$.fragment,ae),B(E),B(ie.$$.fragment,ae),B(fe),B(ge.$$.fragment,ae),B(Me.$$.fragment,ae),T=!1},d(ae){ae&&y(e),oe(w),E&&E.d(),oe(ie),L&&L.d(),J&&J.d(),te&&te.d(),fe&&fe.d(),de&&de.d(),we&&we.d(),Ee&&Ee.d(),ae&&y($e),oe(ge,ae),ae&&y(Le),oe(Me,ae),k=!1,C()}}}async function Hp(){await(await fetch("/reboot",{method:"POST"})).json()}function jp(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],u={};No.subscribe(D=>{l(2,u=Xc(i.version,D)),u||l(2,u=D[0])});function a(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Cs(ve(i.chip,i.board))))&&(Yt.update(D=>(D.upgrading=!0,D)),Qc(u.tag_name))}const c=function(){confirm("Are you sure you want to reboot the device?")&&(Yt.update(D=>(D.booting=!0,D)),Hp())};let f,p=[],_=!1,b,v=[],d=!1;Co();function g(D){ks[D?"unshift":"push"](()=>{f=D,l(3,f)})}function w(){p=this.files,l(4,p)}const $=()=>{f.click()},S=()=>l(5,_=!0);function P(D){ks[D?"unshift":"push"](()=>{b=D,l(6,b)})}function F(){v=this.files,l(7,v)}const A=()=>{b.click()},I=()=>l(8,d=!0);return t.$$set=D=>{"data"in D&&l(0,n=D.data),"sysinfo"in D&&l(1,i=D.sysinfo)},[n,i,u,f,p,_,b,v,d,o,a,c,g,w,$,S,P,F,A,I]}class Wp extends De{constructor(e){super(),Pe(this,e,jp,Up,Ne,{data:0,sysinfo:1})}}function Kf(t){let e,l,n=ve(t[0],7)+"",i,o,u=ve(t[0],5)+"",a,c,f=ve(t[0],4)+"",p,_,b=ve(t[0],3)+"",v,d,g,w,$=ve(t[0],2)+"",S,P,F=ve(t[0],1)+"",A,I,D=ve(t[0],0)+"",O,ie,j,K,G=ve(t[0],101)+"",Y,Q,z=ve(t[0],100)+"",Z;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),a=N(u),c=m("option"),p=N(f),_=m("option"),v=N(b),d=h(),g=m("optgroup"),w=m("option"),S=N($),P=m("option"),A=N(F),I=m("option"),O=N(D),ie=h(),j=m("optgroup"),K=m("option"),Y=N(G),Q=m("option"),Z=N(z),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,_.__value=3,_.value=_.__value,r(e,"label","amsleser.no"),w.__value=2,w.value=w.__value,P.__value=1,P.value=P.__value,I.__value=0,I.value=I.__value,r(g,"label","Custom hardware"),K.__value=101,K.value=K.__value,Q.__value=100,Q.value=Q.__value,r(j,"label","Generic hardware")},m(V,H){M(V,e,H),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,p),s(e,_),s(_,v),M(V,d,H),M(V,g,H),s(g,w),s(w,S),s(g,P),s(P,A),s(g,I),s(I,O),M(V,ie,H),M(V,j,H),s(j,K),s(K,Y),s(j,Q),s(Q,Z)},p(V,H){H&1&&n!==(n=ve(V[0],7)+"")&&X(i,n),H&1&&u!==(u=ve(V[0],5)+"")&&X(a,u),H&1&&f!==(f=ve(V[0],4)+"")&&X(p,f),H&1&&b!==(b=ve(V[0],3)+"")&&X(v,b),H&1&&$!==($=ve(V[0],2)+"")&&X(S,$),H&1&&F!==(F=ve(V[0],1)+"")&&X(A,F),H&1&&D!==(D=ve(V[0],0)+"")&&X(O,D),H&1&&G!==(G=ve(V[0],101)+"")&&X(Y,G),H&1&&z!==(z=ve(V[0],100)+"")&&X(Z,z)},d(V){V&&y(e),V&&y(d),V&&y(g),V&&y(ie),V&&y(j)}}}function Yf(t){let e,l,n=ve(t[0],201)+"",i,o,u=ve(t[0],202)+"",a,c,f=ve(t[0],203)+"",p,_,b=ve(t[0],241)+"",v,d,g=ve(t[0],242)+"",w,$,S=ve(t[0],243)+"",P,F,A=ve(t[0],200)+"",I;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),a=N(u),c=m("option"),p=N(f),_=m("option"),v=N(b),d=m("option"),w=N(g),$=m("option"),P=N(S),F=m("option"),I=N(A),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,_.__value=241,_.value=_.__value,d.__value=242,d.value=d.__value,$.__value=243,$.value=$.__value,F.__value=200,F.value=F.__value,r(e,"label","Generic hardware")},m(D,O){M(D,e,O),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,p),s(e,_),s(_,v),s(e,d),s(d,w),s(e,$),s($,P),s(e,F),s(F,I)},p(D,O){O&1&&n!==(n=ve(D[0],201)+"")&&X(i,n),O&1&&u!==(u=ve(D[0],202)+"")&&X(a,u),O&1&&f!==(f=ve(D[0],203)+"")&&X(p,f),O&1&&b!==(b=ve(D[0],241)+"")&&X(v,b),O&1&&g!==(g=ve(D[0],242)+"")&&X(w,g),O&1&&S!==(S=ve(D[0],243)+"")&&X(P,S),O&1&&A!==(A=ve(D[0],200)+"")&&X(I,A)},d(D){D&&y(e)}}}function Qf(t){let e,l,n=ve(t[0],7)+"",i,o,u=ve(t[0],6)+"",a,c,f=ve(t[0],5)+"",p,_,b,v,d=ve(t[0],51)+"",g,w,$=ve(t[0],50)+"",S;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),a=N(u),c=m("option"),p=N(f),_=h(),b=m("optgroup"),v=m("option"),g=N(d),w=m("option"),S=N($),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,r(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,w.__value=50,w.value=w.__value,r(b,"label","Generic hardware")},m(P,F){M(P,e,F),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,p),M(P,_,F),M(P,b,F),s(b,v),s(v,g),s(b,w),s(w,S)},p(P,F){F&1&&n!==(n=ve(P[0],7)+"")&&X(i,n),F&1&&u!==(u=ve(P[0],6)+"")&&X(a,u),F&1&&f!==(f=ve(P[0],5)+"")&&X(p,f),F&1&&d!==(d=ve(P[0],51)+"")&&X(g,d),F&1&&$!==($=ve(P[0],50)+"")&&X(S,$)},d(P){P&&y(e),P&&y(_),P&&y(b)}}}function Xf(t){let e,l,n=ve(t[0],8)+"",i,o,u,a,c=ve(t[0],71)+"",f,p,_=ve(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=h(),u=m("optgroup"),a=m("option"),f=N(c),p=m("option"),b=N(_),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,p.__value=70,p.value=p.__value,r(u,"label","Generic hardware")},m(v,d){M(v,e,d),s(e,l),s(l,i),M(v,o,d),M(v,u,d),s(u,a),s(a,f),s(u,p),s(p,b)},p(v,d){d&1&&n!==(n=ve(v[0],8)+"")&&X(i,n),d&1&&c!==(c=ve(v[0],71)+"")&&X(f,c),d&1&&_!==(_=ve(v[0],70)+"")&&X(b,_)},d(v){v&&y(e),v&&y(o),v&&y(u)}}}function Zf(t){let e,l,n=ve(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=N(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=ve(o[0],200)+"")&&X(i,n)},d(o){o&&y(e)}}}function Jf(t){let e,l,n=ve(t[0],80)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=N(n),l.__value=80,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=ve(o[0],80)+"")&&X(i,n)},d(o){o&&y(e)}}}function zp(t){let e,l,n,i,o,u,a,c,f=t[0]=="esp8266"&&Kf(t),p=t[0]=="esp32"&&Yf(t),_=t[0]=="esp32s2"&&Qf(t),b=t[0]=="esp32c3"&&Xf(t),v=t[0]=="esp32solo"&&Zf(t),d=t[0]=="esp32s3"&&Jf(t);return{c(){e=m("option"),l=h(),f&&f.c(),n=h(),p&&p.c(),i=h(),_&&_.c(),o=h(),b&&b.c(),u=h(),v&&v.c(),a=h(),d&&d.c(),c=Ke(),e.__value=-1,e.value=e.__value},m(g,w){M(g,e,w),M(g,l,w),f&&f.m(g,w),M(g,n,w),p&&p.m(g,w),M(g,i,w),_&&_.m(g,w),M(g,o,w),b&&b.m(g,w),M(g,u,w),v&&v.m(g,w),M(g,a,w),d&&d.m(g,w),M(g,c,w)},p(g,[w]){g[0]=="esp8266"?f?f.p(g,w):(f=Kf(g),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),g[0]=="esp32"?p?p.p(g,w):(p=Yf(g),p.c(),p.m(i.parentNode,i)):p&&(p.d(1),p=null),g[0]=="esp32s2"?_?_.p(g,w):(_=Qf(g),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),g[0]=="esp32c3"?b?b.p(g,w):(b=Xf(g),b.c(),b.m(u.parentNode,u)):b&&(b.d(1),b=null),g[0]=="esp32solo"?v?v.p(g,w):(v=Zf(g),v.c(),v.m(a.parentNode,a)):v&&(v.d(1),v=null),g[0]=="esp32s3"?d?d.p(g,w):(d=Jf(g),d.c(),d.m(c.parentNode,c)):d&&(d.d(1),d=null)},i:_e,o:_e,d(g){g&&y(e),g&&y(l),f&&f.d(g),g&&y(n),p&&p.d(g),g&&y(i),_&&_.d(g),g&&y(o),b&&b.d(g),g&&y(u),v&&v.d(g),g&&y(a),d&&d.d(g),g&&y(c)}}}function Gp(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Vp extends De{constructor(e){super(),Pe(this,e,Gp,zp,Ne,{chip:0})}}function xf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function ec(t){let e,l,n,i,o,u,a;return u=new fo({props:{chip:t[0].chip}}),{c(){e=m("div"),l=N("HAN GPIO"),n=m("br"),i=h(),o=m("select"),re(u.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),se(u,o,null),a=!0},p(c,f){const p={};f&1&&(p.chip=c[0].chip),u.$set(p)},i(c){a||(R(u.$$.fragment,c),a=!0)},o(c){B(u.$$.fragment,c),a=!1},d(c){c&&y(e),oe(u)}}}function Kp(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w,$,S,P,F,A,I,D,O,ie,j,K,G,Y,Q=t[0].usrcfg&&xf();d=new Vp({props:{chip:t[0].chip}});let z=t[0].board&&t[0].board>20&&ec(t);return j=new Ht({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),u=m("strong"),u.textContent="Initial configuration",a=h(),Q&&Q.c(),c=h(),f=m("div"),p=N("Board type"),_=m("br"),b=h(),v=m("select"),re(d.$$.fragment),g=h(),z&&z.c(),w=h(),$=m("div"),S=m("label"),P=m("input"),F=N(" Clear all other configuration"),A=h(),I=m("div"),I.innerHTML='',D=h(),O=m("span"),O.textContent="\xA0",ie=h(),re(j.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(u,"class","text-sm"),r(v,"name","vb"),r(v,"class","in-s"),t[0].board===void 0&&Ge(()=>t[4].call(v)),r(f,"class","my-3"),r(P,"type","checkbox"),r(P,"name","vr"),P.__value="true",P.value=P.__value,r(P,"class","rounded mb-1"),r($,"class","my-3"),r(I,"class","my-3"),r(O,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Z,V){M(Z,e,V),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),Q&&Q.m(n,null),s(n,c),s(n,f),s(f,p),s(f,_),s(f,b),s(f,v),se(d,v,null),Se(v,t[0].board,!0),s(n,g),z&&z.m(n,null),s(n,w),s(n,$),s($,S),s(S,P),P.checked=t[2],s(S,F),s(n,A),s(n,I),s(n,D),s(n,O),M(Z,ie,V),se(j,Z,V),K=!0,G||(Y=[le(v,"change",t[4]),le(P,"change",t[5]),le(n,"submit",Ms(t[3]))],G=!0)},p(Z,[V]){Z[0].usrcfg?Q||(Q=xf(),Q.c(),Q.m(n,c)):Q&&(Q.d(1),Q=null);const H={};V&1&&(H.chip=Z[0].chip),d.$set(H),V&1&&Se(v,Z[0].board),Z[0].board&&Z[0].board>20?z?(z.p(Z,V),V&1&&R(z,1)):(z=ec(Z),z.c(),R(z,1),z.m(n,w)):z&&(Ie(),B(z,1,1,()=>{z=null}),Re()),V&4&&(P.checked=Z[2]);const ee={};V&2&&(ee.active=Z[1]),j.$set(ee)},i(Z){K||(R(d.$$.fragment,Z),R(z),R(j.$$.fragment,Z),K=!0)},o(Z){B(d.$$.fragment,Z),B(z),B(j.$$.fragment,Z),K=!1},d(Z){Z&&y(e),Q&&Q.d(),oe(d),z&&z.d(),Z&&y(ie),oe(j,Z),G=!1,Ve(Y)}}}function Yp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(f){l(1,i=!0);const p=new FormData(f.target),_=new URLSearchParams;for(let d of p){const[g,w]=d;_.append(g,w)}let v=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),Yt.update(d=>(d.vndcfg=v.success,d.booting=v.reboot,d)),si(n.usrcfg?"/":"/setup")}let u=!1;function a(){n.board=nt(this),l(0,n)}function c(){u=this.checked,l(2,u),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,u=!n.usrcfg)},[n,i,u,o,a,c]}class Qp extends De{constructor(e){super(),Pe(this,e,Yp,Kp,Ne,{sysinfo:0})}}function tc(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function lc(t){let e,l,n,i,o,u,a,c,f,p,_,b,v;return{c(){e=m("div"),l=N("SSID"),n=m("br"),i=h(),o=m("input"),a=h(),c=m("div"),f=N("PSK"),p=m("br"),_=h(),b=m("input"),r(o,"name","ss"),r(o,"type","text"),r(o,"class","in-s"),o.required=u=t[2]==1||t[2]==2,r(e,"class","my-3"),r(b,"name","sp"),r(b,"type","password"),r(b,"class","in-s"),r(b,"autocomplete","off"),b.required=v=t[2]==2,r(c,"class","my-3")},m(d,g){M(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),M(d,a,g),M(d,c,g),s(c,f),s(c,p),s(c,_),s(c,b)},p(d,g){g&4&&u!==(u=d[2]==1||d[2]==2)&&(o.required=u),g&4&&v!==(v=d[2]==2)&&(b.required=v)},d(d){d&&y(e),d&&y(a),d&&y(c)}}}function nc(t){let e,l,n,i,o,u,a,c;return a=new e0({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),o=h(),u=m("select"),re(a.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(u,"name","su"),r(u,"class","in-l"),u.required=t[1],r(n,"class","flex")},m(f,p){M(f,e,p),M(f,l,p),M(f,n,p),s(n,i),s(n,o),s(n,u),se(a,u,null),c=!0},p(f,p){(!c||p&2)&&(i.required=f[1]),(!c||p&2)&&(u.required=f[1])},i(f){c||(R(a.$$.fragment,f),c=!0)},o(f){B(a.$$.fragment,f),c=!1},d(f){f&&y(e),f&&y(l),f&&y(n),oe(a)}}}function ic(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
+ `),n=m("a"),o=N(i),a=h(),_&&_.c(),c=h(),b&&b.c(),f=Ke(),r(n,"href",u=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(n,o),s(e,a),_&&_.m(e,null),M(v,c,d),b&&b.m(v,d),M(v,f,d),p=!0},p(v,d){(!p||d&4)&&i!==(i=v[2].tag_name+"")&&X(o,i),(!p||d&4&&u!==(u=v[2].html_url))&&r(n,"href",u),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[2]&&v[2].tag_name!=v[1].version?_?(_.p(v,d),d&7&&R(_,1)):(_=Uf(v),_.c(),R(_,1),_.m(e,null)):_&&(Ie(),B(_,1,1,()=>{_=null}),Re()),v[1].fwconsent===2?b||(b=Hf(),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i(v){p||(R(_),p=!0)},o(v){B(_),p=!1},d(v){v&&y(e),_&&_.d(),v&&y(c),b&&b.d(v),v&&y(f)}}}function Uf(t){let e,l,n,i,o,u;return n=new Jc({}),{c(){e=m("div"),l=m("button"),re(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(a,c){M(a,e,c),s(e,l),se(n,l,null),i=!0,o||(u=le(l,"click",t[10]),o=!0)},p:_e,i(a){i||(R(n.$$.fragment,a),i=!0)},o(a){B(n.$$.fragment,a),i=!1},d(a){a&&y(e),oe(n),o=!1,u()}}}function Hf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',r(e,"class","my-2")},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function jf(t){let e,l=Cs(ve(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=Cs(ve(i[1].chip,i[1].board))+"")&&X(n,l)},d(i){i&&y(e)}}}function Wf(t){let e,l,n,i,o,u;function a(p,_){return p[4].length==0?Fp:Op}let c=a(t),f=c(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),f.c(),rc(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(p,_){M(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(u=[le(n,"change",t[13]),le(l,"submit",t[15])],o=!0)},p(p,_){c===(c=a(p))&&f?f.p(p,_):(f.d(1),f=c(p),f&&(f.c(),f.m(l,null)))},d(p){p&&y(e),t[12](null),f.d(),o=!1,Ve(u)}}}function Op(t){let e=t[4][0].name+"",l,n,i;return{c(){l=N(e),n=h(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,u){M(o,l,u),M(o,n,u),M(o,i,u)},p(o,u){u&16&&e!==(e=o[4][0].name+"")&&X(l,e)},d(o){o&&y(l),o&&y(n),o&&y(i)}}}function Fp(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){M(i,e,o),l||(n=le(e,"click",t[14]),l=!0)},p:_e,d(i){i&&y(e),l=!1,n()}}}function zf(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g=t[9],w=[];for(let A=0;A Include Secrets
(SSID, PSK, passwords and tokens)',c=h(),$&&$.c(),f=h(),p=m("form"),_=m("input"),b=h(),F.c(),r(l,"class","text-sm"),r(a,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),rc(_,"display","none"),r(_,"name","file"),r(_,"type","file"),r(_,"accept",".cfg"),r(p,"action","/configfile"),r(p,"enctype","multipart/form-data"),r(p,"method","post"),r(p,"autocomplete","off"),r(e,"class","cnt")},m(A,I){M(A,e,I),s(e,l),s(e,n),s(e,i),s(i,o);for(let D=0;D{E=null}),Re());const Et={};Ce&8388608&&(Et.$$scope={dirty:Ce,ctx:ae}),ie.$set(Et),ae[1].meter?L?L.p(ae,Ce):(L=Lf(ae),L.c(),L.m(e,Y)):L&&(L.d(1),L=null),ae[1].net?J?J.p(ae,Ce):(J=Of(ae),J.c(),J.m(e,Q)):J&&(J.d(1),J=null),(!T||Ce&2)&&ue!==(ue=ae[1].version+"")&&X(x,ue),ae[1].upgrade.t&&ae[1].upgrade.t!=ae[1].version?te?te.p(ae,Ce):(te=qf(ae),te.c(),te.m(z,U)):te&&(te.d(1),te=null),ae[2]?fe?(fe.p(ae,Ce),Ce&4&&R(fe,1)):(fe=Bf(ae),fe.c(),R(fe,1),fe.m(z,ke)):fe&&(Ie(),B(fe,1,1,()=>{fe=null}),Re()),Ce&3&&(je=(ae[1].security==0||ae[0].a)&&oi(ae[1].board)),je?de?de.p(ae,Ce):(de=jf(ae),de.c(),de.m(z,Be)):de&&(de.d(1),de=null),ae[1].security==0||ae[0].a?we?we.p(ae,Ce):(we=Wf(ae),we.c(),we.m(z,null)):we&&(we.d(1),we=null),ae[1].security==0||ae[0].a?Ee?Ee.p(ae,Ce):(Ee=zf(ae),Ee.c(),Ee.m(e,null)):Ee&&(Ee.d(1),Ee=null);const st={};Ce&32&&(st.active=ae[5]),ge.$set(st);const ht={};Ce&256&&(ht.active=ae[8]),Me.$set(ht)},i(ae){T||(R(w.$$.fragment,ae),R(E),R(ie.$$.fragment,ae),R(fe),R(ge.$$.fragment,ae),R(Me.$$.fragment,ae),T=!0)},o(ae){B(w.$$.fragment,ae),B(E),B(ie.$$.fragment,ae),B(fe),B(ge.$$.fragment,ae),B(Me.$$.fragment,ae),T=!1},d(ae){ae&&y(e),oe(w),E&&E.d(),oe(ie),L&&L.d(),J&&J.d(),te&&te.d(),fe&&fe.d(),de&&de.d(),we&&we.d(),Ee&&Ee.d(),ae&&y($e),oe(ge,ae),ae&&y(Le),oe(Me,ae),k=!1,C()}}}async function Hp(){await(await fetch("/reboot",{method:"POST"})).json()}function jp(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],u={};No.subscribe(D=>{l(2,u=Xc(i.version,D)),u||l(2,u=D[0])});function a(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Cs(ve(i.chip,i.board))))&&(Yt.update(D=>(D.upgrading=!0,D)),Qc(u.tag_name))}const c=function(){confirm("Are you sure you want to reboot the device?")&&(Yt.update(D=>(D.booting=!0,D)),Hp())};let f,p=[],_=!1,b,v=[],d=!1;Co();function g(D){ks[D?"unshift":"push"](()=>{f=D,l(3,f)})}function w(){p=this.files,l(4,p)}const $=()=>{f.click()},S=()=>l(5,_=!0);function P(D){ks[D?"unshift":"push"](()=>{b=D,l(6,b)})}function F(){v=this.files,l(7,v)}const A=()=>{b.click()},I=()=>l(8,d=!0);return t.$$set=D=>{"data"in D&&l(0,n=D.data),"sysinfo"in D&&l(1,i=D.sysinfo)},[n,i,u,f,p,_,b,v,d,o,a,c,g,w,$,S,P,F,A,I]}class Wp extends De{constructor(e){super(),Pe(this,e,jp,Up,Ne,{data:0,sysinfo:1})}}function Kf(t){let e,l,n=ve(t[0],7)+"",i,o,u=ve(t[0],5)+"",a,c,f=ve(t[0],4)+"",p,_,b=ve(t[0],3)+"",v,d,g,w,$=ve(t[0],2)+"",S,P,F=ve(t[0],1)+"",A,I,D=ve(t[0],0)+"",O,ie,j,K,G=ve(t[0],101)+"",Y,Q,z=ve(t[0],100)+"",Z;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),a=N(u),c=m("option"),p=N(f),_=m("option"),v=N(b),d=h(),g=m("optgroup"),w=m("option"),S=N($),P=m("option"),A=N(F),I=m("option"),O=N(D),ie=h(),j=m("optgroup"),K=m("option"),Y=N(G),Q=m("option"),Z=N(z),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,_.__value=3,_.value=_.__value,r(e,"label","amsleser.no"),w.__value=2,w.value=w.__value,P.__value=1,P.value=P.__value,I.__value=0,I.value=I.__value,r(g,"label","Custom hardware"),K.__value=101,K.value=K.__value,Q.__value=100,Q.value=Q.__value,r(j,"label","Generic hardware")},m(V,H){M(V,e,H),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,p),s(e,_),s(_,v),M(V,d,H),M(V,g,H),s(g,w),s(w,S),s(g,P),s(P,A),s(g,I),s(I,O),M(V,ie,H),M(V,j,H),s(j,K),s(K,Y),s(j,Q),s(Q,Z)},p(V,H){H&1&&n!==(n=ve(V[0],7)+"")&&X(i,n),H&1&&u!==(u=ve(V[0],5)+"")&&X(a,u),H&1&&f!==(f=ve(V[0],4)+"")&&X(p,f),H&1&&b!==(b=ve(V[0],3)+"")&&X(v,b),H&1&&$!==($=ve(V[0],2)+"")&&X(S,$),H&1&&F!==(F=ve(V[0],1)+"")&&X(A,F),H&1&&D!==(D=ve(V[0],0)+"")&&X(O,D),H&1&&G!==(G=ve(V[0],101)+"")&&X(Y,G),H&1&&z!==(z=ve(V[0],100)+"")&&X(Z,z)},d(V){V&&y(e),V&&y(d),V&&y(g),V&&y(ie),V&&y(j)}}}function Yf(t){let e,l,n=ve(t[0],201)+"",i,o,u=ve(t[0],202)+"",a,c,f=ve(t[0],203)+"",p,_,b=ve(t[0],241)+"",v,d,g=ve(t[0],242)+"",w,$,S=ve(t[0],243)+"",P,F,A=ve(t[0],200)+"",I;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),a=N(u),c=m("option"),p=N(f),_=m("option"),v=N(b),d=m("option"),w=N(g),$=m("option"),P=N(S),F=m("option"),I=N(A),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,_.__value=241,_.value=_.__value,d.__value=242,d.value=d.__value,$.__value=243,$.value=$.__value,F.__value=200,F.value=F.__value,r(e,"label","Generic hardware")},m(D,O){M(D,e,O),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,p),s(e,_),s(_,v),s(e,d),s(d,w),s(e,$),s($,P),s(e,F),s(F,I)},p(D,O){O&1&&n!==(n=ve(D[0],201)+"")&&X(i,n),O&1&&u!==(u=ve(D[0],202)+"")&&X(a,u),O&1&&f!==(f=ve(D[0],203)+"")&&X(p,f),O&1&&b!==(b=ve(D[0],241)+"")&&X(v,b),O&1&&g!==(g=ve(D[0],242)+"")&&X(w,g),O&1&&S!==(S=ve(D[0],243)+"")&&X(P,S),O&1&&A!==(A=ve(D[0],200)+"")&&X(I,A)},d(D){D&&y(e)}}}function Qf(t){let e,l,n=ve(t[0],7)+"",i,o,u=ve(t[0],6)+"",a,c,f=ve(t[0],5)+"",p,_,b,v,d=ve(t[0],51)+"",g,w,$=ve(t[0],50)+"",S;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),a=N(u),c=m("option"),p=N(f),_=h(),b=m("optgroup"),v=m("option"),g=N(d),w=m("option"),S=N($),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,r(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,w.__value=50,w.value=w.__value,r(b,"label","Generic hardware")},m(P,F){M(P,e,F),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,p),M(P,_,F),M(P,b,F),s(b,v),s(v,g),s(b,w),s(w,S)},p(P,F){F&1&&n!==(n=ve(P[0],7)+"")&&X(i,n),F&1&&u!==(u=ve(P[0],6)+"")&&X(a,u),F&1&&f!==(f=ve(P[0],5)+"")&&X(p,f),F&1&&d!==(d=ve(P[0],51)+"")&&X(g,d),F&1&&$!==($=ve(P[0],50)+"")&&X(S,$)},d(P){P&&y(e),P&&y(_),P&&y(b)}}}function Xf(t){let e,l,n=ve(t[0],8)+"",i,o,u,a,c=ve(t[0],71)+"",f,p,_=ve(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=h(),u=m("optgroup"),a=m("option"),f=N(c),p=m("option"),b=N(_),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,p.__value=70,p.value=p.__value,r(u,"label","Generic hardware")},m(v,d){M(v,e,d),s(e,l),s(l,i),M(v,o,d),M(v,u,d),s(u,a),s(a,f),s(u,p),s(p,b)},p(v,d){d&1&&n!==(n=ve(v[0],8)+"")&&X(i,n),d&1&&c!==(c=ve(v[0],71)+"")&&X(f,c),d&1&&_!==(_=ve(v[0],70)+"")&&X(b,_)},d(v){v&&y(e),v&&y(o),v&&y(u)}}}function Zf(t){let e,l,n=ve(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=N(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=ve(o[0],200)+"")&&X(i,n)},d(o){o&&y(e)}}}function Jf(t){let e,l,n=ve(t[0],80)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=N(n),l.__value=80,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=ve(o[0],80)+"")&&X(i,n)},d(o){o&&y(e)}}}function zp(t){let e,l,n,i,o,u,a,c,f=t[0]=="esp8266"&&Kf(t),p=t[0]=="esp32"&&Yf(t),_=t[0]=="esp32s2"&&Qf(t),b=t[0]=="esp32c3"&&Xf(t),v=t[0]=="esp32solo"&&Zf(t),d=t[0]=="esp32s3"&&Jf(t);return{c(){e=m("option"),l=h(),f&&f.c(),n=h(),p&&p.c(),i=h(),_&&_.c(),o=h(),b&&b.c(),u=h(),v&&v.c(),a=h(),d&&d.c(),c=Ke(),e.__value=-1,e.value=e.__value},m(g,w){M(g,e,w),M(g,l,w),f&&f.m(g,w),M(g,n,w),p&&p.m(g,w),M(g,i,w),_&&_.m(g,w),M(g,o,w),b&&b.m(g,w),M(g,u,w),v&&v.m(g,w),M(g,a,w),d&&d.m(g,w),M(g,c,w)},p(g,[w]){g[0]=="esp8266"?f?f.p(g,w):(f=Kf(g),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),g[0]=="esp32"?p?p.p(g,w):(p=Yf(g),p.c(),p.m(i.parentNode,i)):p&&(p.d(1),p=null),g[0]=="esp32s2"?_?_.p(g,w):(_=Qf(g),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),g[0]=="esp32c3"?b?b.p(g,w):(b=Xf(g),b.c(),b.m(u.parentNode,u)):b&&(b.d(1),b=null),g[0]=="esp32solo"?v?v.p(g,w):(v=Zf(g),v.c(),v.m(a.parentNode,a)):v&&(v.d(1),v=null),g[0]=="esp32s3"?d?d.p(g,w):(d=Jf(g),d.c(),d.m(c.parentNode,c)):d&&(d.d(1),d=null)},i:_e,o:_e,d(g){g&&y(e),g&&y(l),f&&f.d(g),g&&y(n),p&&p.d(g),g&&y(i),_&&_.d(g),g&&y(o),b&&b.d(g),g&&y(u),v&&v.d(g),g&&y(a),d&&d.d(g),g&&y(c)}}}function Gp(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Vp extends De{constructor(e){super(),Pe(this,e,Gp,zp,Ne,{chip:0})}}function xf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function ec(t){let e,l,n,i,o,u,a;return u=new fo({props:{chip:t[0].chip}}),{c(){e=m("div"),l=N("HAN GPIO"),n=m("br"),i=h(),o=m("select"),re(u.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),se(u,o,null),a=!0},p(c,f){const p={};f&1&&(p.chip=c[0].chip),u.$set(p)},i(c){a||(R(u.$$.fragment,c),a=!0)},o(c){B(u.$$.fragment,c),a=!1},d(c){c&&y(e),oe(u)}}}function Kp(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w,$,S,P,F,A,I,D,O,ie,j,K,G,Y,Q=t[0].usrcfg&&xf();d=new Vp({props:{chip:t[0].chip}});let z=t[0].board&&t[0].board>20&&ec(t);return j=new Ht({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),u=m("strong"),u.textContent="Initial configuration",a=h(),Q&&Q.c(),c=h(),f=m("div"),p=N("Board type"),_=m("br"),b=h(),v=m("select"),re(d.$$.fragment),g=h(),z&&z.c(),w=h(),$=m("div"),S=m("label"),P=m("input"),F=N(" Clear all other configuration"),A=h(),I=m("div"),I.innerHTML='',D=h(),O=m("span"),O.textContent="\xA0",ie=h(),re(j.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(u,"class","text-sm"),r(v,"name","vb"),r(v,"class","in-s"),t[0].board===void 0&&Ge(()=>t[4].call(v)),r(f,"class","my-3"),r(P,"type","checkbox"),r(P,"name","vr"),P.__value="true",P.value=P.__value,r(P,"class","rounded mb-1"),r($,"class","my-3"),r(I,"class","my-3"),r(O,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Z,V){M(Z,e,V),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),Q&&Q.m(n,null),s(n,c),s(n,f),s(f,p),s(f,_),s(f,b),s(f,v),se(d,v,null),Se(v,t[0].board,!0),s(n,g),z&&z.m(n,null),s(n,w),s(n,$),s($,S),s(S,P),P.checked=t[2],s(S,F),s(n,A),s(n,I),s(n,D),s(n,O),M(Z,ie,V),se(j,Z,V),K=!0,G||(Y=[le(v,"change",t[4]),le(P,"change",t[5]),le(n,"submit",Ms(t[3]))],G=!0)},p(Z,[V]){Z[0].usrcfg?Q||(Q=xf(),Q.c(),Q.m(n,c)):Q&&(Q.d(1),Q=null);const H={};V&1&&(H.chip=Z[0].chip),d.$set(H),V&1&&Se(v,Z[0].board),Z[0].board&&Z[0].board>20?z?(z.p(Z,V),V&1&&R(z,1)):(z=ec(Z),z.c(),R(z,1),z.m(n,w)):z&&(Ie(),B(z,1,1,()=>{z=null}),Re()),V&4&&(P.checked=Z[2]);const ee={};V&2&&(ee.active=Z[1]),j.$set(ee)},i(Z){K||(R(d.$$.fragment,Z),R(z),R(j.$$.fragment,Z),K=!0)},o(Z){B(d.$$.fragment,Z),B(z),B(j.$$.fragment,Z),K=!1},d(Z){Z&&y(e),Q&&Q.d(),oe(d),z&&z.d(),Z&&y(ie),oe(j,Z),G=!1,Ve(Y)}}}function Yp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(f){l(1,i=!0);const p=new FormData(f.target),_=new URLSearchParams;for(let d of p){const[g,w]=d;_.append(g,w)}let v=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),Yt.update(d=>(d.vndcfg=v.success,d.booting=v.reboot,d.if.eth=d.boardType>240&&d.boardType<250,d)),si(n.usrcfg?"/":"/setup")}let u=!1;function a(){n.board=nt(this),l(0,n)}function c(){u=this.checked,l(2,u),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,u=!n.usrcfg)},[n,i,u,o,a,c]}class Qp extends De{constructor(e){super(),Pe(this,e,Yp,Kp,Ne,{sysinfo:0})}}function tc(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function lc(t){let e,l,n,i,o,u,a,c,f,p,_,b,v;return{c(){e=m("div"),l=N("SSID"),n=m("br"),i=h(),o=m("input"),a=h(),c=m("div"),f=N("PSK"),p=m("br"),_=h(),b=m("input"),r(o,"name","ss"),r(o,"type","text"),r(o,"class","in-s"),o.required=u=t[2]==1||t[2]==2,r(e,"class","my-3"),r(b,"name","sp"),r(b,"type","password"),r(b,"class","in-s"),r(b,"autocomplete","off"),b.required=v=t[2]==2,r(c,"class","my-3")},m(d,g){M(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),M(d,a,g),M(d,c,g),s(c,f),s(c,p),s(c,_),s(c,b)},p(d,g){g&4&&u!==(u=d[2]==1||d[2]==2)&&(o.required=u),g&4&&v!==(v=d[2]==2)&&(b.required=v)},d(d){d&&y(e),d&&y(a),d&&y(c)}}}function nc(t){let e,l,n,i,o,u,a,c;return a=new e0({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),o=h(),u=m("select"),re(a.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(u,"name","su"),r(u,"class","in-l"),u.required=t[1],r(n,"class","flex")},m(f,p){M(f,e,p),M(f,l,p),M(f,n,p),s(n,i),s(n,o),s(n,u),se(a,u,null),c=!0},p(f,p){(!c||p&2)&&(i.required=f[1]),(!c||p&2)&&(u.required=f[1])},i(f){c||(R(a.$$.fragment,f),c=!0)},o(f){B(a.$$.fragment,f),c=!1},d(f){f&&y(e),f&&y(l),f&&y(n),oe(a)}}}function ic(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
DNS
`,r(e,"class","my-3 flex")},m(l,n){M(l,e,n)},d(l){l&&y(e)}}}function Xp(t){let e,l,n,i,o,u,a,c,f,p,_,b,v,d,g,w,$,S,P,F,A,I,D,O,ie,j,K,G,Y,Q,z,Z,V,H=t[0].if&&t[0].if.eth&&tc(),ee=(t[2]==1||t[2]==2)&&lc(t),ue=t[1]&&nc(t),x=t[1]&&ic();return Q=new Ht({props:{active:t[3],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),u=m("strong"),u.textContent="Setup",a=h(),c=m("div"),f=N("Connection"),p=m("br"),_=h(),b=m("select"),v=m("option"),v.textContent="Connect to WiFi",d=m("option"),d.textContent="Standalone access point",H&&H.c(),g=h(),ee&&ee.c(),w=h(),$=m("div"),S=N(`Hostname diff --git a/lib/SvelteUi/app/src/lib/DataStores.js b/lib/SvelteUi/app/src/lib/DataStores.js index b7c6e220..88e163ab 100644 --- a/lib/SvelteUi/app/src/lib/DataStores.js +++ b/lib/SvelteUi/app/src/lib/DataStores.js @@ -33,7 +33,10 @@ let sysinfo = { f: null, t: null }, - trying: null + trying: null, + if: { + eth: false + } }; export const sysinfoStore = writable(sysinfo); export async function getSysinfo() { diff --git a/lib/SvelteUi/app/src/lib/VendorPanel.svelte b/lib/SvelteUi/app/src/lib/VendorPanel.svelte index 10e71f34..5605d046 100644 --- a/lib/SvelteUi/app/src/lib/VendorPanel.svelte +++ b/lib/SvelteUi/app/src/lib/VendorPanel.svelte @@ -5,7 +5,7 @@ import Mask from './Mask.svelte' import { navigate } from 'svelte-navigator'; - export let sysinfo = {} + export let sysinfo = {}; let loadingOrSaving = false; async function handleSubmit(e) { @@ -27,6 +27,8 @@ sysinfoStore.update(s => { s.vndcfg = res.success; s.booting = res.reboot; + s.if.eth = s.boardType > 240 && s.boardType < 250; + return s; }); navigate(sysinfo.usrcfg ? "/" : "/setup"); diff --git a/lib/SvelteUi/src/AmsWebServer.cpp b/lib/SvelteUi/src/AmsWebServer.cpp index 40e89020..24bacb47 100644 --- a/lib/SvelteUi/src/AmsWebServer.cpp +++ b/lib/SvelteUi/src/AmsWebServer.cpp @@ -1229,6 +1229,7 @@ void AmsWebServer::handleSave() { #endif if(success) { config->setGpioConfig(*gpioConfig); + config->setMeterConfig(meterConfig); SystemConfig sys; config->getSystemConfig(sys);