From 062068eacd4e546343d39dfbfc40e7504a5e205c Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Tue, 21 Feb 2023 15:29:10 +0100 Subject: [PATCH] Increased range of tariff thresholds --- .../include/AmsConfiguration.h | 8 ++++- lib/AmsConfiguration/src/AmsConfiguration.cpp | 33 +++++++++++++++++-- lib/SvelteUi/app/dist/index.js | 8 ++--- .../app/src/lib/ConfigurationPanel.svelte | 2 +- 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/lib/AmsConfiguration/include/AmsConfiguration.h b/lib/AmsConfiguration/include/AmsConfiguration.h index fc7e5429..7f267b80 100644 --- a/lib/AmsConfiguration/include/AmsConfiguration.h +++ b/lib/AmsConfiguration/include/AmsConfiguration.h @@ -4,7 +4,7 @@ #include "Arduino.h" #define EEPROM_SIZE 1024*3 -#define EEPROM_CHECK_SUM 101 // Used to check if config is stored. Change if structure changes +#define EEPROM_CHECK_SUM 102 // Used to check if config is stored. Change if structure changes #define EEPROM_CLEARED_INDICATOR 0xFC #define EEPROM_CONFIG_ADDRESS 0 #define EEPROM_TEMP_CONFIG_ADDRESS 2048 @@ -175,6 +175,11 @@ struct EntsoeConfig { }; // 62 struct EnergyAccountingConfig { + uint16_t thresholds[10]; + uint8_t hours; +}; // 21 + +struct EnergyAccountingConfig101 { uint8_t thresholds[10]; uint8_t hours; }; // 11 @@ -298,6 +303,7 @@ private: bool relocateConfig95(); // 2.1.4 bool relocateConfig96(); // 2.1.14 bool relocateConfig100(); // 2.2-dev + bool relocateConfig101(); // 2.2.0 through 2.2.8 void saveToFs(); bool loadFromFs(uint8_t version); diff --git a/lib/AmsConfiguration/src/AmsConfiguration.cpp b/lib/AmsConfiguration/src/AmsConfiguration.cpp index bbf737bb..c3ae8881 100644 --- a/lib/AmsConfiguration/src/AmsConfiguration.cpp +++ b/lib/AmsConfiguration/src/AmsConfiguration.cpp @@ -556,7 +556,7 @@ bool AmsConfiguration::getEnergyAccountingConfig(EnergyAccountingConfig& config) EEPROM.begin(EEPROM_SIZE); EEPROM.get(CONFIG_ENERGYACCOUNTING_START, config); EEPROM.end(); - if(config.thresholds[9] != 255) { + if(config.thresholds[9] != 0xFFFF) { clearEnergyAccountingConfig(config); } if(config.hours > 5) config.hours = 5; @@ -576,7 +576,7 @@ bool AmsConfiguration::setEnergyAccountingConfig(EnergyAccountingConfig& config) energyAccountingChanged = true; } } - config.thresholds[9] = 255; + config.thresholds[9] = 0xFFFF; energyAccountingChanged |= config.hours != existing.hours; } else { energyAccountingChanged = true; @@ -598,7 +598,7 @@ void AmsConfiguration::clearEnergyAccountingConfig(EnergyAccountingConfig& confi config.thresholds[6] = 75; config.thresholds[7] = 100; config.thresholds[8] = 150; - config.thresholds[9] = 255; + config.thresholds[9] = 0xFFFF; config.hours = 3; } @@ -756,6 +756,14 @@ bool AmsConfiguration::hasConfig() { configVersion = 0; return false; } + case 101: + configVersion = -1; // Prevent loop + if(relocateConfig101()) { + configVersion = 102; + } else { + configVersion = 0; + return false; + } case EEPROM_CHECK_SUM: return true; default: @@ -958,6 +966,25 @@ bool AmsConfiguration::relocateConfig100() { return ret; } +bool AmsConfiguration::relocateConfig101() { + EEPROM.begin(EEPROM_SIZE); + + EnergyAccountingConfig config; + EnergyAccountingConfig101 config101; + EEPROM.get(CONFIG_ENERGYACCOUNTING_START, config101); + for(uint8_t i = 0; i < 9; i++) { + config.thresholds[i] = config101.thresholds[i]; + } + config.thresholds[9] = 0xFFFF; + config.hours = config101.hours; + EEPROM.put(CONFIG_ENERGYACCOUNTING_START, config); + + EEPROM.put(EEPROM_CONFIG_ADDRESS, 102); + bool ret = EEPROM.commit(); + EEPROM.end(); + return ret; +} + bool AmsConfiguration::save() { EEPROM.begin(EEPROM_SIZE); EEPROM.put(EEPROM_CONFIG_ADDRESS, EEPROM_CHECK_SUM); diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index c7fef1cb..bd80ac03 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 a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function se(){}function Ot(t,e){for(const l in e)t[l]=e[l];return t}function df(t){return t()}function mr(){return Object.create(null)}function Be(t){t.forEach(df)}function vf(t){return typeof t=="function"}function ke(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Ji;function ac(t,e){return Ji||(Ji=document.createElement("a")),Ji.href=e,t===Ji.href}function fc(t){return Object.keys(t).length===0}function Ys(t,...e){if(t==null)return se;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function jn(t){let e;return Ys(t,l=>e=l)(),e}function Bt(t,e,l){t.$$.on_destroy.push(Ys(e,l))}function Vs(t,e,l,n){if(t){const i=hf(t,e,l,n);return t[0](i)}}function hf(t,e,l,n){return t[1]&&n?Ot(l.ctx.slice(),t[1](n(e))):l.ctx}function Ks(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(e.dirty.length,i.length);for(let r=0;r32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function fs(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}function Gt(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set?t[n]=e[n]:u(t,n,e[n])}function ce(t){return t===""?null:+t}function cc(t){return Array.from(t.childNodes)}function G(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Q(t,e){t.value=e==null?"":e}function gf(t,e,l,n){l===null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Fe(t,e){for(let l=0;l{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=Y(n.contentWindow,"resize",e)}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),w(n)}}function _c(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}let ii;function li(t){ii=t}function si(){if(!ii)throw new Error("Function called outside component initialization");return ii}function dc(t){si().$$.on_mount.push(t)}function vc(t){si().$$.on_destroy.push(t)}function hc(){const t=si();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=_c(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,o)}),!o.defaultPrevented}return!0}}function ni(t,e){return si().$$.context.set(t,e),e}function wl(t){return si().$$.context.get(t)}const ei=[],os=[],ls=[],pr=[],bf=Promise.resolve();let Fs=!1;function kf(){Fs||(Fs=!0,bf.then(wf))}function gc(){return kf(),bf}function Ge(t){ls.push(t)}const Ms=new Set;let xi=0;function wf(){const t=ii;do{for(;xi{ns.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function Wn(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],r=e[o];if(r){for(const c in a)c in r||(n[c]=1);for(const c in r)i[c]||(l[c]=r[c],i[c]=1);t[o]=r}else for(const c in a)i[c]=1}for(const a in n)a in l||(l[a]=void 0);return l}function _r(t){return typeof t=="object"&&t!==null?t:{}}function Z(t){t&&t.c()}function V(t,e,l,n){const{fragment:i,on_mount:o,on_destroy:a,after_update:r}=t.$$;i&&i.m(e,l),n||Ge(()=>{const c=o.map(df).filter(vf);a?a.push(...c):Be(c),t.$$.on_mount=[]}),r.forEach(Ge)}function K(t,e){const l=t.$$;l.fragment!==null&&(Be(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function kc(t,e){t.$$.dirty[0]===-1&&(ei.push(t),kf(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const h=b.length?b[0]:d;return f.ctx&&i(f.ctx[_],f.ctx[_]=h)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](h),p&&kc(t,_)),d}):[],f.update(),p=!0,Be(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const _=cc(e.target);f.fragment&&f.fragment.l(_),_.forEach(w)}else f.fragment&&f.fragment.c();e.intro&&P(t.$$.fragment),V(t,e.target,e.anchor,e.customElement),wf()}li(c)}class ye{$destroy(){K(this,1),this.$destroy=se}$on(e,l){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!fc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const dr=t=>typeof t>"u",yf=t=>typeof t=="function",$f=t=>typeof t=="number";function wc(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Cf(){let t=0;return()=>t++}function yc(){return Math.random().toString(36).substring(2)}const yl=typeof window>"u";function Sf(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Rs=(t,e)=>t?{}:{style:e},qn=t=>({"aria-hidden":"true",...Rs(t,"display:none;")}),On=[];function Tf(t,e){return{subscribe:Ze(t,e).subscribe}}function Ze(t,e=se){let l;const n=new Set;function i(r){if(ke(t,r)&&(t=r,l)){const c=!On.length;for(const f of n)f[1](),On.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&(l(),l=null)}}return{set:i,update:o,subscribe:a}}function $c(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return Tf(l,a=>{let r=!1;const c=[];let f=0,p=se;const _=()=>{if(f)return;p();const b=e(n?c[0]:c,a);o?a(b):p=vf(b)?b:se},d=i.map((b,h)=>Ys(b,g=>{c[h]=g,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,Ls=oi("LOCATION"),zn=oi("ROUTER"),Pf=oi("ROUTE"),Cc=oi("ROUTE_PARAMS"),Sc=oi("FOCUS_ELEM"),Mf=/^:(.+)/,ti=(t,e,l)=>t.substr(e,l),Os=(t,e)=>ti(t,0,e.length)===e,Tc=t=>t==="",Pc=t=>Mf.test(t),Af=t=>t[0]==="*",Mc=t=>t.replace(/\*.*$/,""),Nf=t=>t.replace(/(^\/+|\/+$)/g,"");function Kt(t,e=!1){const l=Nf(t).split("/");return e?l.filter(Boolean):l}const As=(t,e)=>t+(e?`?${e}`:""),Js=t=>`/${Nf(t)}`;function ui(...t){const e=n=>Kt(n,!0).join("/"),l=t.map(e).join("/");return Js(l)}const Xs=1,cs=2,Bl=3,Ac=4,If=5,Nc=6,Df=7,Ic=8,Dc=9,Ef=10,Ff=11,Ec={[Xs]:"Link",[cs]:"Route",[Bl]:"Router",[Ac]:"useFocus",[If]:"useLocation",[Nc]:"useMatch",[Df]:"useNavigate",[Ic]:"useParams",[Dc]:"useResolvable",[Ef]:"useResolve",[Ff]:"navigate"},xs=t=>Ec[t];function Fc(t,e){let l;return t===cs?l=e.path?`path="${e.path}"`:"default":t===Xs?l=`to="${e.to}"`:t===Bl&&(l=`basepath="${e.basepath||""}"`),`<${xs(t)} ${l||""} />`}function Rc(t,e,l,n){const i=l&&Fc(n||t,l),o=i?` -Occurred in: ${i}`:"",a=xs(t),r=yf(e)?e(a):e;return`<${a}> ${r}${o}`}const Rf=t=>(...e)=>t(Rc(...e)),Lf=Rf(t=>{throw new Error(t)}),us=Rf(console.warn),vr=4,Lc=3,Oc=2,qc=1,Uc=1;function Hc(t,e){const l=t.default?0:Kt(t.fullPath).reduce((n,i)=>{let o=n;return o+=vr,Tc(i)?o+=Uc:Pc(i)?o+=Oc:Af(i)?o-=vr+qc:o+=Lc,o},0);return{route:t,score:l,index:e}}function jc(t){return t.map(Hc).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Of(t,e){let l,n;const[i]=e.split("?"),o=Kt(i),a=o[0]==="",r=jc(t);for(let c=0,f=r.length;c({...p,params:d,uri:k});if(p.default){n=b(e);continue}const h=Kt(p.fullPath),g=Math.max(o.length,h.length);let $=0;for(;${f===".."?c.pop():f!=="."&&c.push(f)}),As(`/${c.join("/")}`,n)}function hr(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=Kt(e,!0),r=Kt(l,!0);for(;a.length;)a[0]!==r[0]&&Lf(Bl,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),r.shift();return{pathname:ui(...r),hash:n,search:i,state:o}}const gr=t=>t.length===1?"":t,eo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?gr(ti(t,l)):"",a=i?ti(t,0,l):t,r=n?gr(ti(a,e)):"";return{pathname:(n?ti(a,0,e):a)||"/",search:r,hash:o}},zc=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function Bc(t,e,l){return ui(l,Wc(t,e))}function Gc(t,e){const l=Js(Mc(t)),n=Kt(l,!0),i=Kt(e,!0).slice(0,n.length),o=qf({fullPath:l},ui(...i));return o&&o.uri}const Ns="POP",Yc="PUSH",Vc="REPLACE";function Is(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function Kc(t){let e=[],l=Is(t),n=Ns;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=Is(t),n=Ns,i([o])};i([o]);const r=Sf(t,"popstate",a);return()=>{r(),e=e.filter(c=>c!==o)}},navigate(o,a){const{state:r={},replace:c=!1}=a||{};if(n=c?Vc:Yc,$f(o))a&&us(Ff,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ns,t.history.go(o);else{const f={...r,_key:yc()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Is(t),i()}}}function Ds(t,e){return{...eo(e),state:t}}function Qc(t="/"){let e=0,l=[Ds(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(Ds(n,o))},replaceState(n,i,o){l[e]=Ds(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const Zc=!!(!yl&&window.document&&window.document.createElement),Jc=!yl&&window.location.origin==="null",Uf=Kc(Zc&&!Jc?window:Qc()),{navigate:Un}=Uf;let ul=null,Hf=!0;function Xc(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nul.level||t.level===ul.level&&Xc(t.routerId,ul.routerId))&&(ul=t)}function e1(){ul=null}function t1(){Hf=!1}function br(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Sf(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function l1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function n1(t){return/^H[1-6]$/i.test(t.tagName)}function kr(t,e=document){return e.querySelector(t)}function i1(t){let l=kr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!l1(l,t);){if(n1(l))return l;const n=kr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function s1(t){Promise.resolve(jn(t.focusElement)).then(e=>{const l=e||i1(t.id);l||us(Bl,`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,cs),!br(l)&&br(document.documentElement)})}const o1=(t,e,l)=>(n,i)=>gc().then(()=>{if(!ul||Hf){t1();return}if(n&&s1(ul.route),t.announcements&&i){const{path:o,fullPath:a,meta:r,params:c,uri:f}=ul.route,p=t.createAnnouncement({path:o,fullPath:a,meta:r,params:c,uri:f},jn(l));Promise.resolve(p).then(_=>{e.set(_)})}e1()}),wr="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function u1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Rs(t[6],wr)],i={};for(let o=0;o`Navigated to ${te.uri}`,announcements:!0,...h},k=p,S=Js(p),M=wl(Ls),D=wl(zn),T=!M,N=a1(),F=b&&!(D&&!D.manageFocus),R=Ze("");Bt(t,R,te=>l(0,r=te));const H=D?D.disableInlineStyles:g,j=Ze([]);Bt(t,j,te=>l(20,a=te));const E=Ze(null);Bt(t,E,te=>l(18,i=te));let L=!1;const W=T?0:D.level+1,q=T?Ze((()=>hr(yl?eo(_):d.location,S))()):M;Bt(t,q,te=>l(17,n=te));const O=Ze(n);Bt(t,O,te=>l(19,o=te));const U=o1($,R,q),X=te=>Te=>Te.filter(me=>me.id!==te);function B(te){if(yl){if(L)return;const Te=qf(te,n.pathname);if(Te)return L=!0,Te}else j.update(Te=>{const me=X(te.id)(Te);return me.push(te),me})}function ne(te){j.update(X(te))}return!T&&p!==yr&&us(Bl,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),T&&(dc(()=>d.listen(Te=>{const me=hr(Te.location,S);O.set(n),q.set(me)})),ni(Ls,q)),ni(zn,{activeRoute:E,registerRoute:B,unregisterRoute:ne,manageFocus:F,level:W,id:N,history:T?d:D.history,basepath:T?S:D.basepath,disableInlineStyles:H}),t.$$set=te=>{"basepath"in te&&l(11,p=te.basepath),"url"in te&&l(12,_=te.url),"history"in te&&l(13,d=te.history),"primary"in te&&l(14,b=te.primary),"a11y"in te&&l(15,h=te.a11y),"disableInlineStyles"in te&&l(16,g=te.disableInlineStyles),"$$scope"in te&&l(21,f=te.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==k&&us(Bl,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const te=Of(a,n.pathname);E.set(te)}if(t.$$.dirty[0]&655360&&T){const te=!!n.hash,Te=!te&&F,me=!te||n.pathname!==o.pathname;U(Te,me)}t.$$.dirty[0]&262144&&F&&i&&i.primary&&xc({level:W,routerId:N,route:i})},[r,$,T,N,F,R,H,j,E,q,O,p,_,d,b,h,g,n,i,o,a,f,c]}class jf extends ye{constructor(e){super(),we(this,e,f1,r1,ke,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}function ri(t,e,l=zn,n=Bl){wl(l)||Lf(t,o=>`You cannot use ${o} outside of a ${xs(n)}.`,e)}const c1=t=>{const{subscribe:e}=wl(t);return{subscribe:e}};function Wf(){return ri(If),c1(Ls)}function zf(){const{history:t}=wl(zn);return t}function Bf(){const t=wl(Pf);return t?$c(t,e=>e.base):Ze("/")}function Gf(){ri(Ef);const t=Bf(),{basepath:e}=wl(zn);return n=>Bc(n,jn(t),e)}function m1(){ri(Df);const t=Gf(),{navigate:e}=zf();return(n,i)=>{const o=$f(n)?n:t(n);return e(o,i)}}const p1=t=>({params:t&16,location:t&8}),$r=t=>({params:yl?jn(t[10]):t[4],location:t[3],navigate:t[11]});function Cr(t){let e,l;return e=new jf({props:{primary:t[1],$$slots:{default:[v1]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment)},m(n,i){V(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||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function _1(t){let e;const l=t[18].default,n=Vs(l,t,t[19],$r);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&Qs(n,l,i,i[19],e?Ks(l,i[19],o,p1):Zs(i[19]),$r)},i(i){e||(P(n,i),e=!0)},o(i){I(n,i),e=!1},d(i){n&&n.d(i)}}}function d1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},yl?jn(t[10]):t[4],t[12]];var o=t[0];function a(r){let c={};for(let f=0;f{K(p,1)}),Ae()}o?(e=new o(a()),Z(e.$$.fragment),P(e.$$.fragment,1),V(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(r){n||(e&&P(e.$$.fragment,r),n=!0)},o(r){e&&I(e.$$.fragment,r),n=!1},d(r){r&&w(l),e&&K(e,r)}}}function v1(t){let e,l,n,i;const o=[d1,_1],a=[];function r(c,f){return c[0]!==null?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let p=e;e=r(c),e===p?a[e].p(c,f):(Me(),I(a[p],1,1,()=>{a[p]=null}),Ae(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),P(l,1),l.m(n.parentNode,n))},i(c){i||(P(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function h1(t){let e,l,n,i,o,a=[qn(t[7]),{"data-svnav-route-start":t[5]}],r={};for(let _=0;_{c=null}),Ae()),Gt(i,p=Wn(f,[qn(_[7]),{"data-svnav-route-end":_[5]}]))},i(_){o||(P(c),o=!0)},o(_){I(c),o=!1},d(_){_&&w(e),_&&w(l),c&&c.d(_),_&&w(n),_&&w(i)}}}const g1=Cf();function b1(t,e,l){let n;const i=["path","component","meta","primary"];let o=ss(e,i),a,r,c,f,{$$slots:p={},$$scope:_}=e,{path:d=""}=e,{component:b=null}=e,{meta:h={}}=e,{primary:g=!0}=e;ri(cs,e);const $=g1(),{registerRoute:k,unregisterRoute:S,activeRoute:M,disableInlineStyles:D}=wl(zn);Bt(t,M,L=>l(16,a=L));const T=Bf();Bt(t,T,L=>l(17,c=L));const N=Wf();Bt(t,N,L=>l(3,r=L));const F=Ze(null);let R;const H=Ze(),j=Ze({});Bt(t,j,L=>l(4,f=L)),ni(Pf,H),ni(Cc,j),ni(Sc,F);const E=m1();return yl||vc(()=>S($)),t.$$set=L=>{l(24,e=Ot(Ot({},e),is(L))),l(12,o=ss(e,i)),"path"in L&&l(13,d=L.path),"component"in L&&l(0,b=L.component),"meta"in L&&l(14,h=L.meta),"primary"in L&&l(1,g=L.primary),"$$scope"in L&&l(19,_=L.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const L=d==="",W=ui(c,d),z={id:$,path:d,meta:h,default:L,fullPath:L?"":W,base:L?c:Gc(W,r.pathname),primary:g,focusElement:F};H.set(z),l(15,R=k(z))}if(t.$$.dirty&98304&&l(2,n=!!(R||a&&a.id===$)),t.$$.dirty&98308&&n){const{params:L}=R||a;j.set(L)}},e=is(e),[b,g,n,r,f,$,M,D,T,N,j,E,o,d,h,R,a,c,p,_]}class ol extends ye{constructor(e){super(),we(this,e,b1,h1,ke,{path:13,component:0,meta:14,primary:1})}}function k1(t){let e,l,n,i;const o=t[13].default,a=Vs(o,t,t[12],null);let r=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,_=F));const M=hc(),D=Gf(),{navigate:T}=zf();function N(F){M("click",F),wc(F)&&(F.preventDefault(),T(n,{state:$,replace:a||g}))}return t.$$set=F=>{l(19,e=Ot(Ot({},e),is(F))),l(18,p=ss(e,f)),"to"in F&&l(5,h=F.to),"replace"in F&&l(6,g=F.replace),"state"in F&&l(7,$=F.state),"getProps"in F&&l(8,k=F.getProps),"$$scope"in F&&l(12,b=F.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=D(h,_)),t.$$.dirty&2049&&l(10,i=Os(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(a=eo(n)===zc(_)),t.$$.dirty&512&&l(2,r=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(yf(k)){const F=k({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...F}}return p})())},e=is(e),[n,c,r,S,N,h,g,$,k,o,i,_,b,d]}class kl extends ye{constructor(e){super(),we(this,e,w1,k1,ke,{to:5,replace:6,state:7,getProps:8})}}let qs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function bl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function y1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Yf(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function $1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function rs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return""}}function Ne(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function he(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266"}}function Sr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received last 30s";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Tr(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 Pr(t){switch(t){case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 500:return"Internal server error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Hn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function je(t,e){return t==1||t==2&&e}function Lt(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))}async function $l(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let zt={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,trying:null};const yt=Ze(zt);async function to(){zt=await(await $l("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),yt.set(zt)}let es=0,Mr=-127,Ar=null,C1={};const S1=Tf(C1,t=>{let e;async function l(){$l("/data.json").then(n=>n.json()).then(n=>{t(n),Mr!=n.t&&(Mr=n.t,setTimeout(Zf,2e3)),Ar!=n.p&&(Ar=n.p,setTimeout(T1,4e3)),zt.upgrading?window.location.reload():(!zt||!zt.chip||zt.booting||es>1&&!Hn(zt.board))&&(to(),Wl&&clearTimeout(Wl),Wl=setTimeout(lo,2e3),zl&&clearTimeout(zl),zl=setTimeout(no,3e3));let i=5e3;if(Hn(zt.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),es=0}).catch(n=>{es++,es>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,Hn(zt.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Us={};const Vf=Ze(Us);async function T1(){Us=await(await $l("/energyprice.json")).json(),Vf.set(Us)}let Hs={},Wl;async function lo(){Wl&&(clearTimeout(Wl),Wl=0),Hs=await(await $l("/dayplot.json")).json(),Kf.set(Hs);let e=new Date;Wl=setTimeout(lo,(60-e.getMinutes())*6e4+20)}const Kf=Ze(Hs,t=>(lo(),function(){}));let js={},zl;async function no(){zl&&(clearTimeout(zl),zl=0),js=await(await $l("/monthplot.json")).json(),Qf.set(js);let e=new Date;zl=setTimeout(no,(24-e.getHours())*36e5+40)}const Qf=Ze(js,t=>(no(),function(){}));let Ws={};async function Zf(){Ws=await(await $l("/temperature.json")).json(),Jf.set(Ws)}const Jf=Ze(Ws,t=>(Zf(),function(){}));let zs={},ts;async function Xf(){ts&&(clearTimeout(ts),ts=0),zs=await(await $l("/tariff.json")).json(),xf.set(zs);let e=new Date;ts=setTimeout(Xf,(60-e.getMinutes())*6e4+30)}const xf=Ze(zs,t=>function(){});let Bs=[];const io=Ze(Bs);async function P1(){Bs=await(await $l("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),io.set(Bs)}function as(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 ec(){await(await fetch("/upgrade",{method:"POST"})).json()}function tc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),a=[...e];a.reverse();let r,c,f;for(let p=0;po&&(r=_):g==i+1&&(c=_);else if(h==n+1)if(f){let k=f.tag_name.substring(1).split(".");parseInt(k[0]);let S=parseInt(k[1]);parseInt(k[2]),g==S&&(f=_)}else f=_}return c||f||r||!1}else return e[0]}const M1="/github.svg";function Nr(t){let e,l;function n(a,r){return a[1]>1?R1:a[1]>0?F1:a[2]>1?E1:a[2]>0?D1:a[3]>1?I1:a[3]>0?N1:A1}let i=n(t),o=i(t);return{c(){e=C(`Up +Occurred in: ${i}`:"",a=xs(t),r=yf(e)?e(a):e;return`<${a}> ${r}${o}`}const Rf=t=>(...e)=>t(Rc(...e)),Lf=Rf(t=>{throw new Error(t)}),us=Rf(console.warn),vr=4,Lc=3,Oc=2,qc=1,Uc=1;function Hc(t,e){const l=t.default?0:Kt(t.fullPath).reduce((n,i)=>{let o=n;return o+=vr,Tc(i)?o+=Uc:Pc(i)?o+=Oc:Af(i)?o-=vr+qc:o+=Lc,o},0);return{route:t,score:l,index:e}}function jc(t){return t.map(Hc).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Of(t,e){let l,n;const[i]=e.split("?"),o=Kt(i),a=o[0]==="",r=jc(t);for(let c=0,f=r.length;c({...p,params:d,uri:k});if(p.default){n=b(e);continue}const h=Kt(p.fullPath),g=Math.max(o.length,h.length);let $=0;for(;${f===".."?c.pop():f!=="."&&c.push(f)}),As(`/${c.join("/")}`,n)}function hr(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=Kt(e,!0),r=Kt(l,!0);for(;a.length;)a[0]!==r[0]&&Lf(Bl,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),r.shift();return{pathname:ui(...r),hash:n,search:i,state:o}}const gr=t=>t.length===1?"":t,eo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?gr(ti(t,l)):"",a=i?ti(t,0,l):t,r=n?gr(ti(a,e)):"";return{pathname:(n?ti(a,0,e):a)||"/",search:r,hash:o}},zc=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function Bc(t,e,l){return ui(l,Wc(t,e))}function Gc(t,e){const l=Js(Mc(t)),n=Kt(l,!0),i=Kt(e,!0).slice(0,n.length),o=qf({fullPath:l},ui(...i));return o&&o.uri}const Ns="POP",Yc="PUSH",Vc="REPLACE";function Is(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function Kc(t){let e=[],l=Is(t),n=Ns;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=Is(t),n=Ns,i([o])};i([o]);const r=Sf(t,"popstate",a);return()=>{r(),e=e.filter(c=>c!==o)}},navigate(o,a){const{state:r={},replace:c=!1}=a||{};if(n=c?Vc:Yc,$f(o))a&&us(Ff,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ns,t.history.go(o);else{const f={...r,_key:yc()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Is(t),i()}}}function Ds(t,e){return{...eo(e),state:t}}function Qc(t="/"){let e=0,l=[Ds(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(Ds(n,o))},replaceState(n,i,o){l[e]=Ds(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const Zc=!!(!yl&&window.document&&window.document.createElement),Jc=!yl&&window.location.origin==="null",Uf=Kc(Zc&&!Jc?window:Qc()),{navigate:Un}=Uf;let ul=null,Hf=!0;function Xc(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nul.level||t.level===ul.level&&Xc(t.routerId,ul.routerId))&&(ul=t)}function e1(){ul=null}function t1(){Hf=!1}function br(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Sf(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function l1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function n1(t){return/^H[1-6]$/i.test(t.tagName)}function kr(t,e=document){return e.querySelector(t)}function i1(t){let l=kr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!l1(l,t);){if(n1(l))return l;const n=kr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function s1(t){Promise.resolve(jn(t.focusElement)).then(e=>{const l=e||i1(t.id);l||us(Bl,`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,cs),!br(l)&&br(document.documentElement)})}const o1=(t,e,l)=>(n,i)=>gc().then(()=>{if(!ul||Hf){t1();return}if(n&&s1(ul.route),t.announcements&&i){const{path:o,fullPath:a,meta:r,params:c,uri:f}=ul.route,p=t.createAnnouncement({path:o,fullPath:a,meta:r,params:c,uri:f},jn(l));Promise.resolve(p).then(_=>{e.set(_)})}e1()}),wr="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function u1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Rs(t[6],wr)],i={};for(let o=0;o`Navigated to ${te.uri}`,announcements:!0,...h},k=p,S=Js(p),M=wl(Ls),D=wl(zn),T=!M,N=a1(),F=b&&!(D&&!D.manageFocus),R=Ze("");Bt(t,R,te=>l(0,r=te));const H=D?D.disableInlineStyles:g,j=Ze([]);Bt(t,j,te=>l(20,a=te));const E=Ze(null);Bt(t,E,te=>l(18,i=te));let L=!1;const W=T?0:D.level+1,q=T?Ze((()=>hr(yl?eo(_):d.location,S))()):M;Bt(t,q,te=>l(17,n=te));const O=Ze(n);Bt(t,O,te=>l(19,o=te));const U=o1($,R,q),X=te=>Te=>Te.filter(me=>me.id!==te);function B(te){if(yl){if(L)return;const Te=qf(te,n.pathname);if(Te)return L=!0,Te}else j.update(Te=>{const me=X(te.id)(Te);return me.push(te),me})}function ne(te){j.update(X(te))}return!T&&p!==yr&&us(Bl,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),T&&(dc(()=>d.listen(Te=>{const me=hr(Te.location,S);O.set(n),q.set(me)})),ni(Ls,q)),ni(zn,{activeRoute:E,registerRoute:B,unregisterRoute:ne,manageFocus:F,level:W,id:N,history:T?d:D.history,basepath:T?S:D.basepath,disableInlineStyles:H}),t.$$set=te=>{"basepath"in te&&l(11,p=te.basepath),"url"in te&&l(12,_=te.url),"history"in te&&l(13,d=te.history),"primary"in te&&l(14,b=te.primary),"a11y"in te&&l(15,h=te.a11y),"disableInlineStyles"in te&&l(16,g=te.disableInlineStyles),"$$scope"in te&&l(21,f=te.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==k&&us(Bl,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const te=Of(a,n.pathname);E.set(te)}if(t.$$.dirty[0]&655360&&T){const te=!!n.hash,Te=!te&&F,me=!te||n.pathname!==o.pathname;U(Te,me)}t.$$.dirty[0]&262144&&F&&i&&i.primary&&xc({level:W,routerId:N,route:i})},[r,$,T,N,F,R,H,j,E,q,O,p,_,d,b,h,g,n,i,o,a,f,c]}class jf extends ye{constructor(e){super(),we(this,e,f1,r1,ke,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}function ri(t,e,l=zn,n=Bl){wl(l)||Lf(t,o=>`You cannot use ${o} outside of a ${xs(n)}.`,e)}const c1=t=>{const{subscribe:e}=wl(t);return{subscribe:e}};function Wf(){return ri(If),c1(Ls)}function zf(){const{history:t}=wl(zn);return t}function Bf(){const t=wl(Pf);return t?$c(t,e=>e.base):Ze("/")}function Gf(){ri(Ef);const t=Bf(),{basepath:e}=wl(zn);return n=>Bc(n,jn(t),e)}function m1(){ri(Df);const t=Gf(),{navigate:e}=zf();return(n,i)=>{const o=$f(n)?n:t(n);return e(o,i)}}const p1=t=>({params:t&16,location:t&8}),$r=t=>({params:yl?jn(t[10]):t[4],location:t[3],navigate:t[11]});function Cr(t){let e,l;return e=new jf({props:{primary:t[1],$$slots:{default:[v1]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment)},m(n,i){V(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||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function _1(t){let e;const l=t[18].default,n=Vs(l,t,t[19],$r);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&Qs(n,l,i,i[19],e?Ks(l,i[19],o,p1):Zs(i[19]),$r)},i(i){e||(P(n,i),e=!0)},o(i){I(n,i),e=!1},d(i){n&&n.d(i)}}}function d1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},yl?jn(t[10]):t[4],t[12]];var o=t[0];function a(r){let c={};for(let f=0;f{K(p,1)}),Ae()}o?(e=new o(a()),Z(e.$$.fragment),P(e.$$.fragment,1),V(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(r){n||(e&&P(e.$$.fragment,r),n=!0)},o(r){e&&I(e.$$.fragment,r),n=!1},d(r){r&&w(l),e&&K(e,r)}}}function v1(t){let e,l,n,i;const o=[d1,_1],a=[];function r(c,f){return c[0]!==null?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let p=e;e=r(c),e===p?a[e].p(c,f):(Me(),I(a[p],1,1,()=>{a[p]=null}),Ae(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),P(l,1),l.m(n.parentNode,n))},i(c){i||(P(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function h1(t){let e,l,n,i,o,a=[qn(t[7]),{"data-svnav-route-start":t[5]}],r={};for(let _=0;_{c=null}),Ae()),Gt(i,p=Wn(f,[qn(_[7]),{"data-svnav-route-end":_[5]}]))},i(_){o||(P(c),o=!0)},o(_){I(c),o=!1},d(_){_&&w(e),_&&w(l),c&&c.d(_),_&&w(n),_&&w(i)}}}const g1=Cf();function b1(t,e,l){let n;const i=["path","component","meta","primary"];let o=ss(e,i),a,r,c,f,{$$slots:p={},$$scope:_}=e,{path:d=""}=e,{component:b=null}=e,{meta:h={}}=e,{primary:g=!0}=e;ri(cs,e);const $=g1(),{registerRoute:k,unregisterRoute:S,activeRoute:M,disableInlineStyles:D}=wl(zn);Bt(t,M,L=>l(16,a=L));const T=Bf();Bt(t,T,L=>l(17,c=L));const N=Wf();Bt(t,N,L=>l(3,r=L));const F=Ze(null);let R;const H=Ze(),j=Ze({});Bt(t,j,L=>l(4,f=L)),ni(Pf,H),ni(Cc,j),ni(Sc,F);const E=m1();return yl||vc(()=>S($)),t.$$set=L=>{l(24,e=Ot(Ot({},e),is(L))),l(12,o=ss(e,i)),"path"in L&&l(13,d=L.path),"component"in L&&l(0,b=L.component),"meta"in L&&l(14,h=L.meta),"primary"in L&&l(1,g=L.primary),"$$scope"in L&&l(19,_=L.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const L=d==="",W=ui(c,d),z={id:$,path:d,meta:h,default:L,fullPath:L?"":W,base:L?c:Gc(W,r.pathname),primary:g,focusElement:F};H.set(z),l(15,R=k(z))}if(t.$$.dirty&98304&&l(2,n=!!(R||a&&a.id===$)),t.$$.dirty&98308&&n){const{params:L}=R||a;j.set(L)}},e=is(e),[b,g,n,r,f,$,M,D,T,N,j,E,o,d,h,R,a,c,p,_]}class ol extends ye{constructor(e){super(),we(this,e,b1,h1,ke,{path:13,component:0,meta:14,primary:1})}}function k1(t){let e,l,n,i;const o=t[13].default,a=Vs(o,t,t[12],null);let r=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,_=F));const M=hc(),D=Gf(),{navigate:T}=zf();function N(F){M("click",F),wc(F)&&(F.preventDefault(),T(n,{state:$,replace:a||g}))}return t.$$set=F=>{l(19,e=Ot(Ot({},e),is(F))),l(18,p=ss(e,f)),"to"in F&&l(5,h=F.to),"replace"in F&&l(6,g=F.replace),"state"in F&&l(7,$=F.state),"getProps"in F&&l(8,k=F.getProps),"$$scope"in F&&l(12,b=F.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=D(h,_)),t.$$.dirty&2049&&l(10,i=Os(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(a=eo(n)===zc(_)),t.$$.dirty&512&&l(2,r=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(yf(k)){const F=k({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...F}}return p})())},e=is(e),[n,c,r,S,N,h,g,$,k,o,i,_,b,d]}class kl extends ye{constructor(e){super(),we(this,e,w1,k1,ke,{to:5,replace:6,state:7,getProps:8})}}let qs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function bl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function y1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Yf(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function $1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function rs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return""}}function Ne(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function he(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266"}}function Sr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received last 30s";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Tr(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 Pr(t){switch(t){case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 500:return"Internal server error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Hn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function je(t,e){return t==1||t==2&&e}function Lt(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))}async function $l(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let zt={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,trying:null};const yt=Ze(zt);async function to(){zt=await(await $l("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),yt.set(zt)}let es=0,Mr=-127,Ar=null,C1={};const S1=Tf(C1,t=>{let e;async function l(){$l("/data.json").then(n=>n.json()).then(n=>{t(n),Mr!=n.t&&(Mr=n.t,setTimeout(Zf,2e3)),Ar!=n.p&&(Ar=n.p,setTimeout(T1,4e3)),zt.upgrading?window.location.reload():(!zt||!zt.chip||zt.booting||es>1&&!Hn(zt.board))&&(to(),Wl&&clearTimeout(Wl),Wl=setTimeout(lo,2e3),zl&&clearTimeout(zl),zl=setTimeout(no,3e3));let i=5e3;if(Hn(zt.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),es=0}).catch(n=>{es++,es>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,Hn(zt.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Us={};const Vf=Ze(Us);async function T1(){Us=await(await $l("/energyprice.json")).json(),Vf.set(Us)}let Hs={},Wl;async function lo(){Wl&&(clearTimeout(Wl),Wl=0),Hs=await(await $l("/dayplot.json")).json(),Kf.set(Hs);let e=new Date;Wl=setTimeout(lo,(60-e.getMinutes())*6e4+20)}const Kf=Ze(Hs,t=>(lo(),function(){}));let js={},zl;async function no(){zl&&(clearTimeout(zl),zl=0),js=await(await $l("/monthplot.json")).json(),Qf.set(js);let e=new Date;zl=setTimeout(no,(24-e.getHours())*36e5+40)}const Qf=Ze(js,t=>(no(),function(){}));let Ws={};async function Zf(){Ws=await(await $l("/temperature.json")).json(),Jf.set(Ws)}const Jf=Ze(Ws,t=>(Zf(),function(){}));let zs={},ts;async function Xf(){ts&&(clearTimeout(ts),ts=0),zs=await(await $l("/tariff.json")).json(),xf.set(zs);let e=new Date;ts=setTimeout(Xf,(60-e.getMinutes())*6e4+30)}const xf=Ze(zs,t=>function(){});let Bs=[];const io=Ze(Bs);async function P1(){Bs=await(await $l("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),io.set(Bs)}function as(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 ec(){await(await fetch("/upgrade",{method:"POST"})).json()}function tc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),a=[...e];a.reverse();let r,c,f;for(let p=0;po&&(r=_):g==i+1&&(c=_);else if(h==n+1)if(f){let k=f.tag_name.substring(1).split(".");parseInt(k[0]);let S=parseInt(k[1]);parseInt(k[2]),g==S&&(f=_)}else f=_}return c||f||r||!1}else return e[0]}const M1="/github.svg";function Nr(t){let e,l;function n(a,r){return a[1]>1?R1:a[1]>0?F1:a[2]>1?E1:a[2]>0?D1:a[3]>1?I1:a[3]>0?N1:A1}let i=n(t),o=i(t);return{c(){e=C(`Up `),o.c(),l=We()},m(a,r){y(a,e,r),o.m(a,r),y(a,l,r)},p(a,r){i===(i=n(a))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},d(a){a&&w(e),o.d(a),a&&w(l)}}}function A1(t){let e,l;return{c(){e=C(t[0]),l=C(" seconds")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&1&&G(e,n[0])},d(n){n&&w(e),n&&w(l)}}}function N1(t){let e,l;return{c(){e=C(t[3]),l=C(" minute")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&G(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function I1(t){let e,l;return{c(){e=C(t[3]),l=C(" minutes")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&G(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function D1(t){let e,l;return{c(){e=C(t[2]),l=C(" hour")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&G(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function E1(t){let e,l;return{c(){e=C(t[2]),l=C(" hours")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&G(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function F1(t){let e,l;return{c(){e=C(t[1]),l=C(" day")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&G(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function R1(t){let e,l;return{c(){e=C(t[1]),l=C(" days")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&G(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function L1(t){let e,l=t[0]&&Nr(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Nr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:se,o:se,d(n){l&&l.d(n),n&&w(e)}}}function O1(t,e,l){let{epoch:n}=e,i=0,o=0,a=0;return t.$$set=r=>{"epoch"in r&&l(0,n=r.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,a=Math.floor(n/60)))},[n,i,o,a]}class q1 extends ye{constructor(e){super(),we(this,e,O1,L1,ke,{epoch:0})}}function U1(t){let e,l,n;return{c(){e=m("span"),l=C(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){y(i,e,o),s(e,l)},p(i,[o]){o&4&&G(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:se,o:se,d(i){i&&w(e)}}}function H1(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class Yt extends ye{constructor(e){super(),we(this,e,H1,U1,ke,{color:0,title:1,text:2})}}function j1(t){let e,l=`${Ne(t[0].getDate())}.${Ne(t[0].getMonth())}.${t[0].getFullYear()} ${Ne(t[0].getHours())}:${Ne(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=C(l),u(e,"class","text-red-500")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ne(i[0].getDate())}.${Ne(i[0].getMonth())}.${i[0].getFullYear()} ${Ne(i[0].getHours())}:${Ne(i[0].getMinutes())}`)&&G(n,l)},d(i){i&&w(e)}}}function W1(t){let e=`${Ne(t[0].getDate())}. ${qs[t[0].getMonth()]} ${Ne(t[0].getHours())}:${Ne(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&1&&e!==(e=`${Ne(n[0].getDate())}. ${qs[n[0].getMonth()]} ${Ne(n[0].getHours())}:${Ne(n[0].getMinutes())}`)&&G(l,e)},d(n){n&&w(l)}}}function z1(t){let e,l;function n(a,r){return r&1&&(e=null),e==null&&(e=Math.abs(new Date().getTime()-a[0].getTime())<3e5),e?W1:j1}let i=n(t,-1),o=i(t);return{c(){o.c(),l=We()},m(a,r){o.m(a,r),y(a,l,r)},p(a,[r]){i===(i=n(a,r))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},i:se,o:se,d(a){o.d(a),a&&w(l)}}}function B1(t,e,l){let{timestamp:n}=e;return t.$$set=i=>{"timestamp"in i&&l(0,n=i.timestamp)},[n]}class G1 extends ye{constructor(e){super(),we(this,e,B1,z1,ke,{timestamp:0})}}function Y1(t){let e,l,n;return{c(){e=Oe("svg"),l=Oe("path"),n=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){y(i,e,o),s(e,l),s(e,n)},p:se,i:se,o:se,d(i){i&&w(e)}}}class V1 extends ye{constructor(e){super(),we(this,e,null,Y1,ke,{})}}function K1(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:se,i:se,o:se,d(n){n&&w(e)}}}class Q1 extends ye{constructor(e){super(),we(this,e,null,K1,ke,{})}}function Z1(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:se,i:se,o:se,d(n){n&&w(e)}}}class Rt extends ye{constructor(e){super(),we(this,e,null,Z1,ke,{})}}function J1(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:se,i:se,o:se,d(n){n&&w(e)}}}class lc extends ye{constructor(e){super(),we(this,e,null,J1,ke,{})}}function X1(t){let e,l,n=t[1].version+"",i;return{c(){e=C("AMS reader "),l=m("span"),i=C(n)},m(o,a){y(o,e,a),y(o,l,a),s(l,i)},p(o,a){a&2&&n!==(n=o[1].version+"")&&G(i,n)},d(o){o&&w(e),o&&w(l)}}}function Ir(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=C(l),i=C("\xB0C"),u(e,"class","flex-none my-auto")},m(o,a){y(o,e,a),s(e,n),s(e,i)},p(o,a){a&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&G(n,l)},d(o){o&&w(e)}}}function Dr(t){let e,l="HAN: "+Sr(t[0].he),n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Sr(i[0].he))&&G(n,l)},d(i){i&&w(e)}}}function Er(t){let e,l="MQTT: "+Tr(t[0].me),n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Tr(i[0].me))&&G(n,l)},d(i){i&&w(e)}}}function Fr(t){let e,l="PriceAPI: "+Pr(t[0].ee),n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Pr(i[0].ee))&&G(n,l)},d(i){i&&w(e)}}}function Rr(t){let e,l,n,i,o,a;return l=new kl({props:{to:"/configuration",$$slots:{default:[x1]},$$scope:{ctx:t}}}),o=new kl({props:{to:"/status",$$slots:{default:[em]},$$scope:{ctx:t}}}),{c(){e=m("div"),Z(l.$$.fragment),n=v(),i=m("div"),Z(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(r,c){y(r,e,c),V(l,e,null),y(r,n,c),y(r,i,c),V(o,i,null),a=!0},i(r){a||(P(l.$$.fragment,r),P(o.$$.fragment,r),a=!0)},o(r){I(l.$$.fragment,r),I(o.$$.fragment,r),a=!1},d(r){r&&w(e),K(l),r&&w(n),r&&w(i),K(o)}}}function x1(t){let e,l;return e=new V1({}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function em(t){let e,l;return e=new Q1({}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Lr(t){let e,l,n,i,o;const a=[lm,tm],r=[];function c(f,p){return f[1].security==0||f[0].a?0:1}return l=c(t),n=r[l]=a[l](t),{c(){e=m("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(f,p){y(f,e,p),r[l].m(e,null),o=!0},p(f,p){let _=l;l=c(f),l===_?r[l].p(f,p):(Me(),I(r[_],1,1,()=>{r[_]=null}),Ae(),n=r[l],n?n.p(f,p):(n=r[l]=a[l](f),n.c()),P(n,1),n.m(e,null)),(!o||p&4&&i!==(i="New version: "+f[2].tag_name))&&u(e,"title",i)},i(f){o||(P(n),o=!0)},o(f){I(n),o=!1},d(f){f&&w(e),r[l].d()}}}function tm(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=C("New version: "),i=C(n)},m(o,a){y(o,e,a),s(e,l),s(e,i)},p(o,a){a&4&&n!==(n=o[2].tag_name+"")&&G(i,n)},i:se,o:se,d(o){o&&w(e)}}}function lm(t){let e,l,n,i=t[2].tag_name+"",o,a,r,c,f,p;return r=new lc({}),{c(){e=m("button"),l=m("span"),n=C("New version: "),o=C(i),a=v(),Z(r.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(_,d){y(_,e,d),s(e,l),s(l,n),s(l,o),s(e,a),V(r,e,null),c=!0,f||(p=Y(e,"click",t[3]),f=!0)},p(_,d){(!c||d&4)&&i!==(i=_[2].tag_name+"")&&G(o,i)},i(_){c||(P(r.$$.fragment,_),c=!0)},o(_){I(r.$$.fragment,_),c=!1},d(_){_&&w(e),K(r),f=!1,p()}}}function nm(t){let e,l,n,i,o,a,r,c,f,p,_,d,b=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",h,g,$,k,S,M,D,T,N,F,R,H,j,E,L,W,z,q,O,U,X,B,ne,te,Te,me,Ie,De,Re,Ee;i=new kl({props:{to:"/",$$slots:{default:[X1]},$$scope:{ctx:t}}}),c=new q1({props:{epoch:t[0].u}});let $e=t[0].t>-50&&Ir(t);S=new Yt({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:bl(t[1].booting?2:t[0].em)}}),D=new Yt({props:{title:"HAN",text:"HAN",color:bl(t[1].booting?9:t[0].hm)}}),N=new Yt({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:bl(t[1].booting?9:t[0].wm)}}),R=new Yt({props:{title:"MQTT",text:"MQTT",color:bl(t[1].booting?9:t[0].mm)}});let ge=(t[0].he<0||t[0].he>0)&&Dr(t),pe=t[0].me<0&&Er(t),ae=(t[0].ee>0||t[0].ee<0)&&Fr(t);ne=new G1({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0)}});let fe=t[1].vndcfg&&t[1].usrcfg&&Rr(t);De=new Rt({});let oe=t[1].fwconsent===1&&t[2]&&Lr(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),Z(i.$$.fragment),o=v(),a=m("div"),r=m("div"),Z(c.$$.fragment),f=v(),$e&&$e.c(),p=v(),_=m("div"),d=C("Free mem: "),h=C(b),g=C("kb"),$=v(),k=m("div"),Z(S.$$.fragment),M=v(),Z(D.$$.fragment),T=v(),Z(N.$$.fragment),F=v(),Z(R.$$.fragment),H=v(),ge&&ge.c(),j=v(),pe&&pe.c(),E=v(),ae&&ae.c(),L=v(),W=m("div"),z=m("div"),q=m("a"),O=m("img"),X=v(),B=m("div"),Z(ne.$$.fragment),te=v(),fe&&fe.c(),Te=v(),me=m("div"),Ie=m("a"),Z(De.$$.fragment),Re=v(),oe&&oe.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(r,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(a,"class","flex-none my-auto p-2 flex space-x-4"),u(k,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(O,"class","gh-logo"),ac(O.src,U=M1)||u(O,"src",U),u(O,"alt","GitHub repo"),u(q,"class","float-right"),u(q,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(q,"target","_blank"),u(q,"rel","noreferrer"),u(q,"aria-label","GitHub"),u(z,"class","flex-none"),u(B,"class","flex-none my-auto px-2"),u(Ie,"href",Lt("")),u(Ie,"target","_blank"),u(Ie,"rel","noreferrer"),u(me,"class","flex-none px-1 mt-1"),u(me,"title","Documentation"),u(W,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(J,ie){y(J,e,ie),s(e,l),s(l,n),V(i,n,null),s(l,o),s(l,a),s(a,r),V(c,r,null),s(a,f),$e&&$e.m(a,null),s(a,p),s(a,_),s(_,d),s(_,h),s(_,g),s(l,$),s(l,k),V(S,k,null),s(k,M),V(D,k,null),s(k,T),V(N,k,null),s(k,F),V(R,k,null),s(l,H),ge&&ge.m(l,null),s(l,j),pe&&pe.m(l,null),s(l,E),ae&&ae.m(l,null),s(l,L),s(l,W),s(W,z),s(z,q),s(q,O),s(W,X),s(W,B),V(ne,B,null),s(W,te),fe&&fe.m(W,null),s(W,Te),s(W,me),s(me,Ie),V(De,Ie,null),s(W,Re),oe&&oe.m(W,null),Ee=!0},p(J,[ie]){const Ce={};ie&18&&(Ce.$$scope={dirty:ie,ctx:J}),i.$set(Ce);const x={};ie&1&&(x.epoch=J[0].u),c.$set(x),J[0].t>-50?$e?$e.p(J,ie):($e=Ir(J),$e.c(),$e.m(a,p)):$e&&($e.d(1),$e=null),(!Ee||ie&1)&&b!==(b=(J[0].m?(J[0].m/1e3).toFixed(1):"-")+"")&&G(h,b);const ue={};ie&3&&(ue.text=J[1].booting?"Booting":J[0].v>2?J[0].v.toFixed(2)+"V":"ESP"),ie&3&&(ue.color=bl(J[1].booting?2:J[0].em)),S.$set(ue);const He={};ie&3&&(He.color=bl(J[1].booting?9:J[0].hm)),D.$set(He);const Se={};ie&1&&(Se.text=J[0].r?J[0].r.toFixed(0)+"dBm":"WiFi"),ie&3&&(Se.color=bl(J[1].booting?9:J[0].wm)),N.$set(Se);const _e={};ie&3&&(_e.color=bl(J[1].booting?9:J[0].mm)),R.$set(_e),J[0].he<0||J[0].he>0?ge?ge.p(J,ie):(ge=Dr(J),ge.c(),ge.m(l,j)):ge&&(ge.d(1),ge=null),J[0].me<0?pe?pe.p(J,ie):(pe=Er(J),pe.c(),pe.m(l,E)):pe&&(pe.d(1),pe=null),J[0].ee>0||J[0].ee<0?ae?ae.p(J,ie):(ae=Fr(J),ae.c(),ae.m(l,L)):ae&&(ae.d(1),ae=null);const de={};ie&1&&(de.timestamp=J[0].c?new Date(J[0].c*1e3):new Date(0)),ne.$set(de),J[1].vndcfg&&J[1].usrcfg?fe?ie&2&&P(fe,1):(fe=Rr(J),fe.c(),P(fe,1),fe.m(W,Te)):fe&&(Me(),I(fe,1,1,()=>{fe=null}),Ae()),J[1].fwconsent===1&&J[2]?oe?(oe.p(J,ie),ie&6&&P(oe,1)):(oe=Lr(J),oe.c(),P(oe,1),oe.m(W,null)):oe&&(Me(),I(oe,1,1,()=>{oe=null}),Ae())},i(J){Ee||(P(i.$$.fragment,J),P(c.$$.fragment,J),P(S.$$.fragment,J),P(D.$$.fragment,J),P(N.$$.fragment,J),P(R.$$.fragment,J),P(ne.$$.fragment,J),P(fe),P(De.$$.fragment,J),P(oe),Ee=!0)},o(J){I(i.$$.fragment,J),I(c.$$.fragment,J),I(S.$$.fragment,J),I(D.$$.fragment,J),I(N.$$.fragment,J),I(R.$$.fragment,J),I(ne.$$.fragment,J),I(fe),I(De.$$.fragment,J),I(oe),Ee=!1},d(J){J&&w(e),K(i),K(c),$e&&$e.d(),K(S),K(D),K(N),K(R),ge&&ge.d(),pe&&pe.d(),ae&&ae.d(),K(ne),fe&&fe.d(),K(De),oe&&oe.d()}}}function im(t,e,l){let{data:n={}}=e,i={},o={};function a(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!Hn(i.board)||confirm(as(he(i.chip,i.board))))&&(yt.update(r=>(r.upgrading=!0,r)),ec())}return yt.subscribe(r=>{l(1,i=r),r.fwconsent===1&&P1()}),io.subscribe(r=>{l(2,o=tc(i.version,r))}),t.$$set=r=>{"data"in r&&l(0,n=r.data)},[n,i,o,a]}class sm extends ye{constructor(e){super(),we(this,e,im,nm,ke,{data:0})}}function om(t){let e,l,n,i;return{c(){e=Oe("svg"),l=Oe("path"),n=Oe("path"),u(l,"d",Es(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Es(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,a){y(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=Es(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),a&2&&u(n,"stroke",o[1])},i:se,o:se,d(o){o&&w(e)}}}function Or(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 Es(t,e,l,n,i){var o=Or(t,e,l,i),a=Or(t,e,l,n),r=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,r,0,a.x,a.y].join(" ");return c}function um(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 ye{constructor(e){super(),we(this,e,um,om,ke,{pct:0,color:1})}}function qr(t){let e,l,n,i,o,a,r,c;return{c(){e=m("br"),l=v(),n=m("span"),i=C(t[3]),o=v(),a=m("span"),r=C(t[4]),c=C("/kWh"),u(n,"class","pl-sub"),u(a,"class","pl-snt")},m(f,p){y(f,e,p),y(f,l,p),y(f,n,p),s(n,i),y(f,o,p),y(f,a,p),s(a,r),s(a,c)},p(f,p){p&8&&G(i,f[3]),p&16&&G(r,f[4])},d(f){f&&w(e),f&&w(l),f&&w(n),f&&w(o),f&&w(a)}}}function am(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$;l=new rm({props:{pct:t[6],color:t[5](t[6])}});let k=t[3]&&qr(t);return{c(){e=m("div"),Z(l.$$.fragment),n=v(),i=m("span"),o=m("span"),a=C(t[2]),r=v(),c=m("br"),f=v(),p=m("span"),_=C(t[0]),d=v(),b=m("span"),h=C(t[1]),g=v(),k&&k.c(),u(o,"class","pl-lab"),u(p,"class","pl-val"),u(b,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(S,M){y(S,e,M),V(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,r),s(i,c),s(i,f),s(i,p),s(p,_),s(i,d),s(i,b),s(b,h),s(i,g),k&&k.m(i,null),$=!0},p(S,[M]){const D={};M&64&&(D.pct=S[6]),M&96&&(D.color=S[5](S[6])),l.$set(D),(!$||M&4)&&G(a,S[2]),(!$||M&1)&&G(_,S[0]),(!$||M&2)&&G(h,S[1]),S[3]?k?k.p(S,M):(k=qr(S),k.c(),k.m(i,null)):k&&(k.d(1),k=null)},i(S){$||(P(l.$$.fragment,S),$=!0)},o(S){I(l.$$.fragment,S),$=!1},d(S){S&&w(e),K(l),k&&k.d()}}}function fm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:r=""}=e,{subunit:c=""}=e,{colorFn:f}=e,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,a=_.label),"sub"in _&&l(3,r=_.sub),"subunit"in _&&l(4,c=_.subunit),"colorFn"in _&&l(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,a,r,c,f,p,i]}class nc extends ye{constructor(e){super(),we(this,e,fm,am,ke,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Ur(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Hr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function jr(t,e,l){const n=t.slice();return n[13]=e[l],n}function Wr(t){let e,l=t[0].title+"",n;return{c(){e=m("strong"),n=C(l),u(e,"class","text-sm")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[0].title+"")&&G(n,l)},d(i){i&&w(e)}}}function zr(t){let e,l,n,i=t[13].label+"",o,a,r,c;return{c(){e=Oe("g"),l=Oe("line"),n=Oe("text"),o=C(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",a=t[13].align=="right"?"85%":""),u(e,"class",r="tick tick-"+t[13].value+" tick-"+t[13].color),u(e,"transform",c="translate(0, "+t[6](t[13].value)+")")},m(f,p){y(f,e,p),s(e,l),s(e,n),s(n,o)},p(f,p){p&1&&i!==(i=f[13].label+"")&&G(o,i),p&1&&a!==(a=f[13].align=="right"?"85%":"")&&u(n,"x",a),p&1&&r!==(r="tick tick-"+f[13].value+" tick-"+f[13].color)&&u(e,"class",r),p&65&&c!==(c="translate(0, "+f[6](f[13].value)+")")&&u(e,"transform",c)},d(f){f&&w(e)}}}function Br(t){let e,l,n=t[9].label+"",i,o,a;return{c(){e=Oe("g"),l=Oe("text"),i=C(n),u(l,"x",o=t[3]/2),u(l,"y","-4"),u(e,"class","tick"),u(e,"transform",a="translate("+t[5](t[11])+","+t[4]+")")},m(r,c){y(r,e,c),s(e,l),s(l,i)},p(r,c){c&1&&n!==(n=r[9].label+"")&&G(i,n),c&8&&o!==(o=r[3]/2)&&u(l,"x",o),c&48&&a!==(a="translate("+r[5](r[11])+","+r[4]+")")&&u(e,"transform",a)},d(r){r&&w(e)}}}function Gr(t){let e,l,n,i,o,a,r,c=t[3]>15&&Yr(t);return{c(){e=Oe("rect"),c&&c.c(),r=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](t[9].value)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),u(e,"fill",a=t[9].color)},m(f,p){y(f,e,p),c&&c.m(f,p),y(f,r,p)},p(f,p){p&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),p&65&&n!==(n=f[6](f[9].value))&&u(e,"y",n),p&8&&i!==(i=f[3]-4)&&u(e,"width",i),p&65&&o!==(o=f[6](f[0].y.min)-f[6](Math.min(f[0].y.min,0)+f[9].value))&&u(e,"height",o),p&1&&a!==(a=f[9].color)&&u(e,"fill",a),f[3]>15?c?c.p(f,p):(c=Yr(f),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(r)}}}function Yr(t){let e,l=t[9].label+"",n,i,o,a,r,c,f;return{c(){e=Oe("text"),n=C(l),u(e,"y",i=t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10),u(e,"x",o=t[5](t[11])+t[3]/2),u(e,"width",a=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",r=t[3]<25?"left":"middle"),u(e,"fill",c=t[6](t[9].value)>t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",f="rotate("+(t[3]<25?90:0)+", "+(t[5](t[11])+t[3]/2)+", "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+9)+")")},m(p,_){y(p,e,_),s(e,n)},p(p,_){_&1&&l!==(l=p[9].label+"")&&G(n,l),_&193&&i!==(i=p[6](p[9].value)>p[6](0)-p[7]?p[6](p[9].value)-p[7]:p[6](p[9].value)+10)&&u(e,"y",i),_&40&&o!==(o=p[5](p[11])+p[3]/2)&&u(e,"x",o),_&8&&a!==(a=p[3]-4)&&u(e,"width",a),_&8&&r!==(r=p[3]<25?"left":"middle")&&u(e,"text-anchor",r),_&193&&c!==(c=p[6](p[9].value)>p[6](0)-p[7]?p[9].color:"white")&&u(e,"fill",c),_&233&&f!==(f="rotate("+(p[3]<25?90:0)+", "+(p[5](p[11])+p[3]/2)+", "+(p[6](p[9].value)>p[6](0)-p[7]?p[6](p[9].value)-p[7]:p[6](p[9].value)+9)+")")&&u(e,"transform",f)},d(p){p&&w(e)}}}function Vr(t){let e,l,n,i,o,a,r,c=t[3]>15&&Kr(t);return{c(){e=Oe("rect"),c&&c.c(),r=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](0)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),u(e,"fill",a=t[9].color)},m(f,p){y(f,e,p),c&&c.m(f,p),y(f,r,p)},p(f,p){p&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),p&64&&n!==(n=f[6](0))&&u(e,"y",n),p&8&&i!==(i=f[3]-4)&&u(e,"width",i),p&65&&o!==(o=f[6](f[0].y.min)-f[6](f[0].y.min+f[9].value2))&&u(e,"height",o),p&1&&a!==(a=f[9].color)&&u(e,"fill",a),f[3]>15?c?c.p(f,p):(c=Kr(f),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(r)}}}function Kr(t){let e,l=t[9].label2+"",n,i,o,a,r,c,f;return{c(){e=Oe("text"),n=C(l),u(e,"y",i=t[6](-t[9].value2)t[6](0)-12?t[6](t[9].value2-t[0].y.min)-12:t[6](t[9].value2-t[0].y.min)+9)+")")},m(p,_){y(p,e,_),s(e,n)},p(p,_){_&1&&l!==(l=p[9].label2+"")&&G(n,l),_&65&&i!==(i=p[6](-p[9].value2)p[6](0)-12?p[6](p[9].value2-p[0].y.min)-12:p[6](p[9].value2-p[0].y.min)+9)+")")&&u(e,"transform",f)},d(p){p&&w(e)}}}function Qr(t){let e,l,n=t[9].value!==void 0&&Gr(t),i=t[9].value2>1e-4&&Vr(t);return{c(){n&&n.c(),e=We(),i&&i.c(),l=We()},m(o,a){n&&n.m(o,a),y(o,e,a),i&&i.m(o,a),y(o,l,a)},p(o,a){o[9].value!==void 0?n?n.p(o,a):(n=Gr(o),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,a):(i=Vr(o),i.c(),i.m(l.parentNode,l)):i&&(i.d(1),i=null)},d(o){n&&n.d(o),o&&w(e),i&&i.d(o),o&&w(l)}}}function cm(t){let e,l,n,i,o,a,r,c=t[0].title&&Wr(t),f=t[0].y.ticks,p=[];for(let g=0;gt[8].call(e))},m(g,$){y(g,e,$),c&&c.m(e,null),s(e,l),s(e,n),s(n,i);for(let k=0;k{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,f=o-(n.title?20:0));let d=i-(n.padding.left+n.padding.right);l(3,a=d/n.points.length),l(7,p=a<25?28:17);let b=(f-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,r=function(h){return h*a+n.padding.left}),l(6,c=function(h){let g=0;return h>n.y.max?g=n.padding.bottom:hf||g<0?0:g})}},[n,i,o,a,f,r,c,p,_]}class Gl extends ye{constructor(e){super(),we(this,e,mm,cm,ke,{config:0})}}function pm(t){let e,l;return e=new Gl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function _m(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:a}=e,r={};function c(f){return{label:be(f)+"V",value:isNaN(f)?0:f,color:y1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,a=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],p=[];n>0&&(f.push({label:a===1?"L1-L2":"L1"}),p.push(c(n))),i>0&&(f.push({label:a===1?"L1-L3":"L2"}),p.push(c(i))),o>0&&(f.push({label:a===1?"L2-L3":"L3"}),p.push(c(o))),l(0,r={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:p})}},[r,n,i,o,a]}class dm extends ye{constructor(e){super(),we(this,e,_m,pm,ke,{u1:1,u2:2,u3:3,ds:4})}}function vm(t){let e,l;return e=new Gl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function hm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:a}=e,{i2:r}=e,{i3:c}=e,{max:f}=e,p={};function _(d){return{label:be(d)+"A",value:isNaN(d)?0:d,color:Yf(d?d/f*100:0)}}return t.$$set=d=>{"u1"in d&&l(1,n=d.u1),"u2"in d&&l(2,i=d.u2),"u3"in d&&l(3,o=d.u3),"i1"in d&&l(4,a=d.i1),"i2"in d&&l(5,r=d.i2),"i3"in d&&l(6,c=d.i3),"max"in d&&l(7,f=d.max)},t.$$.update=()=>{if(t.$$.dirty&254){let d=[],b=[];n>0&&(d.push({label:"L1"}),b.push(_(a))),i>0&&(d.push({label:"L2"}),b.push(_(r))),o>0&&(d.push({label:"L3"}),b.push(_(c))),l(0,p={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:f,ticks:[{value:0,label:"0%"},{value:f/4,label:"25%"},{value:f/2,label:"50%"},{value:f/4*3,label:"75%"},{value:f,label:"100%"}]},x:{ticks:d},points:b})}},[p,n,i,o,a,r,c,f]}class gm extends ye{constructor(e){super(),we(this,e,hm,vm,ke,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function bm(t){let e,l,n,i,o,a,r,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,p,_,d,b,h,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",$,k,S,M,D,T,N,F=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",R,H,j,E,L,W,z=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",q,O;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=v(),i=m("div"),o=m("div"),o.textContent="Instant in",a=v(),r=m("div"),f=C(c),p=C(" VAr"),_=v(),d=m("div"),d.textContent="Instant out",b=v(),h=m("div"),$=C(g),k=C(" VAr"),S=v(),M=m("div"),D=m("div"),D.textContent="Total in",T=v(),N=m("div"),R=C(F),H=C(" kVArh"),j=v(),E=m("div"),E.textContent="Total out",L=v(),W=m("div"),q=C(z),O=C(" kVArh"),u(r,"class","text-right"),u(h,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(N,"class","text-right"),u(W,"class","text-right"),u(M,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(U,X){y(U,e,X),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(i,r),s(r,f),s(r,p),s(i,_),s(i,d),s(i,b),s(i,h),s(h,$),s(h,k),s(e,S),s(e,M),s(M,D),s(M,T),s(M,N),s(N,R),s(N,H),s(M,j),s(M,E),s(M,L),s(M,W),s(W,q),s(W,O)},p(U,[X]){X&1&&c!==(c=(typeof U[0]<"u"?U[0].toFixed(0):"-")+"")&&G(f,c),X&2&&g!==(g=(typeof U[1]<"u"?U[1].toFixed(0):"-")+"")&&G($,g),X&4&&F!==(F=(typeof U[2]<"u"?U[2].toFixed(1):"-")+"")&&G(R,F),X&8&&z!==(z=(typeof U[3]<"u"?U[3].toFixed(1):"-")+"")&&G(q,z)},i:se,o:se,d(U){U&&w(e)}}}function km(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e;return t.$$set=r=>{"importInstant"in r&&l(0,n=r.importInstant),"exportInstant"in r&&l(1,i=r.exportInstant),"importTotal"in r&&l(2,o=r.importTotal),"exportTotal"in r&&l(3,a=r.exportTotal)},[n,i,o,a]}class wm extends ye{constructor(e){super(),we(this,e,km,bm,ke,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Zr(t){let e;function l(o,a){return o[2]?$m:ym}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,a){i.m(o,a),y(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&w(e)}}}function ym(t){let e,l,n,i,o,a,r=be(t[0].h.u,2)+"",c,f,p,_,d,b,h=be(t[0].d.u,1)+"",g,$,k,S,M,D,T=be(t[0].m.u)+"",N,F,R,H,j=t[1]&&Jr(t);return{c(){e=m("strong"),e.textContent="Consumption",l=v(),n=m("div"),i=m("div"),i.textContent="Hour",o=v(),a=m("div"),c=C(r),f=C(" kWh"),p=v(),_=m("div"),_.textContent="Day",d=v(),b=m("div"),g=C(h),$=C(" kWh"),k=v(),S=m("div"),S.textContent="Month",M=v(),D=m("div"),N=C(T),F=C(" kWh"),R=v(),j&&j.c(),H=We(),u(a,"class","text-right"),u(b,"class","text-right"),u(D,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(E,L){y(E,e,L),y(E,l,L),y(E,n,L),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,p),s(n,_),s(n,d),s(n,b),s(b,g),s(b,$),s(n,k),s(n,S),s(n,M),s(n,D),s(D,N),s(D,F),y(E,R,L),j&&j.m(E,L),y(E,H,L)},p(E,L){L&1&&r!==(r=be(E[0].h.u,2)+"")&&G(c,r),L&1&&h!==(h=be(E[0].d.u,1)+"")&&G(g,h),L&1&&T!==(T=be(E[0].m.u)+"")&&G(N,T),E[1]?j?j.p(E,L):(j=Jr(E),j.c(),j.m(H.parentNode,H)):j&&(j.d(1),j=null)},d(E){E&&w(e),E&&w(l),E&&w(n),E&&w(R),j&&j.d(E),E&&w(H)}}}function $m(t){let e,l,n,i,o,a,r=be(t[0].h.u,2)+"",c,f,p,_,d,b,h,g=be(t[0].d.u,1)+"",$,k,S,M,D,T,N,F=be(t[0].m.u)+"",R,H,j,E,L,W,z,q,O,U,X,B=be(t[0].h.p,2)+"",ne,te,Te,me,Ie,De,Re,Ee=be(t[0].d.p,1)+"",$e,ge,pe,ae,fe,oe,J,ie=be(t[0].m.p)+"",Ce,x,ue,He,Se=t[1]&&Xr(t),_e=t[1]&&xr(t),de=t[1]&&ea(t),le=t[1]&&ta(t),ve=t[1]&&la(t),qe=t[1]&&na(t);return{c(){e=m("strong"),e.textContent="Import",l=v(),n=m("div"),i=m("div"),i.textContent="Hour",o=v(),a=m("div"),c=C(r),f=C(" kWh"),p=v(),Se&&Se.c(),_=v(),d=m("div"),d.textContent="Day",b=v(),h=m("div"),$=C(g),k=C(" kWh"),S=v(),_e&&_e.c(),M=v(),D=m("div"),D.textContent="Month",T=v(),N=m("div"),R=C(F),H=C(" kWh"),j=v(),de&&de.c(),L=v(),W=m("strong"),W.textContent="Export",z=v(),q=m("div"),O=m("div"),O.textContent="Hour",U=v(),X=m("div"),ne=C(B),te=C(" kWh"),Te=v(),le&&le.c(),me=v(),Ie=m("div"),Ie.textContent="Day",De=v(),Re=m("div"),$e=C(Ee),ge=C(" kWh"),pe=v(),ve&&ve.c(),ae=v(),fe=m("div"),fe.textContent="Month",oe=v(),J=m("div"),Ce=C(ie),x=C(" kWh"),ue=v(),qe&&qe.c(),u(a,"class","text-right"),u(h,"class","text-right"),u(N,"class","text-right"),u(n,"class",E="grid grid-cols-"+t[3]+" mb-3"),u(X,"class","text-right"),u(Re,"class","text-right"),u(J,"class","text-right"),u(q,"class",He="grid grid-cols-"+t[3])},m(re,Pe){y(re,e,Pe),y(re,l,Pe),y(re,n,Pe),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,p),Se&&Se.m(n,null),s(n,_),s(n,d),s(n,b),s(n,h),s(h,$),s(h,k),s(n,S),_e&&_e.m(n,null),s(n,M),s(n,D),s(n,T),s(n,N),s(N,R),s(N,H),s(n,j),de&&de.m(n,null),y(re,L,Pe),y(re,W,Pe),y(re,z,Pe),y(re,q,Pe),s(q,O),s(q,U),s(q,X),s(X,ne),s(X,te),s(q,Te),le&&le.m(q,null),s(q,me),s(q,Ie),s(q,De),s(q,Re),s(Re,$e),s(Re,ge),s(q,pe),ve&&ve.m(q,null),s(q,ae),s(q,fe),s(q,oe),s(q,J),s(J,Ce),s(J,x),s(q,ue),qe&&qe.m(q,null)},p(re,Pe){Pe&1&&r!==(r=be(re[0].h.u,2)+"")&&G(c,r),re[1]?Se?Se.p(re,Pe):(Se=Xr(re),Se.c(),Se.m(n,_)):Se&&(Se.d(1),Se=null),Pe&1&&g!==(g=be(re[0].d.u,1)+"")&&G($,g),re[1]?_e?_e.p(re,Pe):(_e=xr(re),_e.c(),_e.m(n,M)):_e&&(_e.d(1),_e=null),Pe&1&&F!==(F=be(re[0].m.u)+"")&&G(R,F),re[1]?de?de.p(re,Pe):(de=ea(re),de.c(),de.m(n,null)):de&&(de.d(1),de=null),Pe&8&&E!==(E="grid grid-cols-"+re[3]+" mb-3")&&u(n,"class",E),Pe&1&&B!==(B=be(re[0].h.p,2)+"")&&G(ne,B),re[1]?le?le.p(re,Pe):(le=ta(re),le.c(),le.m(q,me)):le&&(le.d(1),le=null),Pe&1&&Ee!==(Ee=be(re[0].d.p,1)+"")&&G($e,Ee),re[1]?ve?ve.p(re,Pe):(ve=la(re),ve.c(),ve.m(q,ae)):ve&&(ve.d(1),ve=null),Pe&1&&ie!==(ie=be(re[0].m.p)+"")&&G(Ce,ie),re[1]?qe?qe.p(re,Pe):(qe=na(re),qe.c(),qe.m(q,null)):qe&&(qe.d(1),qe=null),Pe&8&&He!==(He="grid grid-cols-"+re[3])&&u(q,"class",He)},d(re){re&&w(e),re&&w(l),re&&w(n),Se&&Se.d(),_e&&_e.d(),de&&de.d(),re&&w(L),re&&w(W),re&&w(z),re&&w(q),le&&le.d(),ve&&ve.d(),qe&&qe.d()}}}function Jr(t){let e,l,n,i,o,a,r=be(t[0].h.c,2)+"",c,f,p,_,d,b,h,g=be(t[0].d.c,1)+"",$,k,S,M,D,T,N,F=be(t[0].m.c)+"",R,H,j;return{c(){e=m("strong"),e.textContent="Cost",l=v(),n=m("div"),i=m("div"),i.textContent="Hour",o=v(),a=m("div"),c=C(r),f=v(),p=C(t[1]),_=v(),d=m("div"),d.textContent="Day",b=v(),h=m("div"),$=C(g),k=v(),S=C(t[1]),M=v(),D=m("div"),D.textContent="Month",T=v(),N=m("div"),R=C(F),H=v(),j=C(t[1]),u(a,"class","text-right"),u(h,"class","text-right"),u(N,"class","text-right"),u(n,"class","grid grid-cols-2")},m(E,L){y(E,e,L),y(E,l,L),y(E,n,L),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(a,p),s(n,_),s(n,d),s(n,b),s(n,h),s(h,$),s(h,k),s(h,S),s(n,M),s(n,D),s(n,T),s(n,N),s(N,R),s(N,H),s(N,j)},p(E,L){L&1&&r!==(r=be(E[0].h.c,2)+"")&&G(c,r),L&2&&G(p,E[1]),L&1&&g!==(g=be(E[0].d.c,1)+"")&&G($,g),L&2&&G(S,E[1]),L&1&&F!==(F=be(E[0].m.c)+"")&&G(R,F),L&2&&G(j,E[1])},d(E){E&&w(e),E&&w(l),E&&w(n)}}}function Xr(t){let e,l=be(t[0].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=be(a[0].h.c,2)+"")&&G(n,l),r&2&&G(o,a[1])},d(a){a&&w(e)}}}function xr(t){let e,l=be(t[0].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=be(a[0].d.c,1)+"")&&G(n,l),r&2&&G(o,a[1])},d(a){a&&w(e)}}}function ea(t){let e,l=be(t[0].m.c)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=be(a[0].m.c)+"")&&G(n,l),r&2&&G(o,a[1])},d(a){a&&w(e)}}}function ta(t){let e,l=be(t[0].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=be(a[0].h.i,2)+"")&&G(n,l),r&2&&G(o,a[1])},d(a){a&&w(e)}}}function la(t){let e,l=be(t[0].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=be(a[0].d.i,1)+"")&&G(n,l),r&2&&G(o,a[1])},d(a){a&&w(e)}}}function na(t){let e,l=be(t[0].m.i)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=be(a[0].m.i)+"")&&G(n,l),r&2&&G(o,a[1])},d(a){a&&w(e)}}}function Cm(t){let e,l,n,i,o,a,r=t[0]&&Zr(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=v(),i=m("br"),o=m("br"),a=v(),r&&r.c(),u(e,"class","mx-2 text-sm")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),r&&r.m(e,null)},p(c,[f]){c[0]?r?r.p(c,f):(r=Zr(c),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},i:se,o:se,d(c){c&&w(e),r&&r.d()}}}function Sm(t,e,l){let{data:n}=e,{currency:i}=e,{hasExport:o}=e,a=3;return t.$$set=r=>{"data"in r&&l(0,n=r.data),"currency"in r&&l(1,i=r.currency),"hasExport"in r&&l(2,o=r.hasExport)},t.$$.update=()=>{t.$$.dirty&2&&l(3,a=i?3:2)},[n,i,o,a]}class Tm extends ye{constructor(e){super(),we(this,e,Sm,Cm,ke,{data:0,currency:1,hasExport:2})}}function Pm(t){let e,l,n,i;return n=new Gl({props:{config:t[0]}}),{c(){e=m("a"),e.textContent="Provided by ENTSO-E",l=v(),Z(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,a){y(o,e,a),y(o,l,a),V(n,o,a),i=!0},p(o,[a]){const r={};a&1&&(r.config=o[0]),n.$set(r)},i(o){i||(P(n.$$.fragment,o),i=!0)},o(o){I(n.$$.fragment,o),i=!1},d(o){o&&w(e),o&&w(l),K(n,o)}}}function Mm(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=new Date().getUTCHours(),c=0,f=0,p=0,_=n[20]==null?2:1,d=[],b=[],h=[],g=new Date;for(c=r;c<24&&(g.setUTCHours(c),f=n[Ne(p++)],f!=null);c++)b.push({label:Ne(g.getHours())}),h.push({label:f>0?f.toFixed(_):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(_):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,a=Math.min(a,f*100)),l(2,o=Math.max(o,f*100));for(c=0;c<24&&(g.setUTCHours(c),f=n[Ne(p++)],f!=null);c++)b.push({label:Ne(g.getHours())}),h.push({label:f>0?f.toFixed(_):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(_):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,a=Math.min(a,f*100)),l(2,o=Math.max(o,f*100));if(l(2,o=Math.ceil(o)),l(3,a=Math.floor(a)),a<0){let k=a/4;for(c=1;c<5;c++){let S=k*c;d.push({value:S,label:(S/100).toFixed(2)})}}let $=o/4;for(c=0;c<5;c++){let k=$*c;d.push({value:k,label:(k/100).toFixed(2)})}l(0,i={title:"Future energy price ("+n.currency+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:d},x:{ticks:b},points:h})}},[i,n,o,a]}class Am extends ye{constructor(e){super(),we(this,e,Mm,Pm,ke,{json:1})}}function Nm(t){let e,l;return e=new Gl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Im(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=[],f=[],p=[],_=new Date,d=-_.getTimezoneOffset()/60;for(r=_.getUTCHours();r<24;r++){let g=n["i"+Ne(r)],$=n["e"+Ne(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ne((r+d)%24)}),p.push({label:g.toFixed(1),value:g*10,label2:$.toFixed(1),value2:$*10,color:"#7c3aed"}),l(3,a=Math.max(a,$*10)),l(2,o=Math.max(o,g*10))}for(r=0;r<_.getUTCHours();r++){let g=n["i"+Ne(r)],$=n["e"+Ne(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ne((r+d)%24)}),p.push({label:g.toFixed(1),value:g*10,label2:$.toFixed(1),value2:$*10,color:"#7c3aed"}),l(3,a=Math.max(a,$*10)),l(2,o=Math.max(o,g*10))}let b=Math.ceil(Math.max(a,o));if(l(2,o=b),l(3,a=a==0?0:b*-1),a<0){let g=a/4;for(r=1;r<5;r++){let $=g*r;c.push({value:$,label:($/10).toFixed(1)})}}let h=o/4;for(r=0;r<5;r++){let g=h*r;c.push({value:g,label:(g/10).toFixed(1)})}l(0,i={title:"Energy use last 24 hours (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:c},x:{ticks:f},points:p})}},[i,n,o,a]}class Dm extends ye{constructor(e){super(),we(this,e,Im,Nm,ke,{json:1})}}function Em(t){let e,l;return e=new Gl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Fm(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=[],f=[],p=[],_=new Date,d=new Date;for(d.setDate(0),r=_.getDate();r<=d.getDate();r++){let g=n["i"+Ne(r)],$=n["e"+Ne(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ne(r)}),p.push({label:g.toFixed(0),value:g,label2:$.toFixed(0),value2:$,color:"#7c3aed"}),l(3,a=Math.max(a,$)),l(2,o=Math.max(o,g))}for(r=1;r<_.getDate();r++){let g=n["i"+Ne(r)],$=n["e"+Ne(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ne(r)}),p.push({label:g.toFixed(0),value:g,label2:$.toFixed(0),value2:$,color:"#7c3aed"}),l(3,a=Math.max(a,$)),l(2,o=Math.max(o,g))}let b=Math.ceil(Math.max(a,o)/10)*10;if(l(2,o=b),l(3,a=a==0?0:b*-1),a<0){let g=a/4;for(r=0;r<5;r++){let $=g*r;c.push({value:$,label:$.toFixed(0)})}}let h=o/4;for(r=0;r<5;r++){let g=h*r;c.push({value:g,label:g.toFixed(0)})}l(0,i={title:"Energy use last month (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:c},x:{ticks:f},points:p})}},[i,n,o,a]}class Rm extends ye{constructor(e){super(),we(this,e,Fm,Em,ke,{json:1})}}function Lm(t){let e,l;return e=new Gl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Om(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=0,f=[],p=[],_=[];n.s&&n.s.forEach((h,g)=>{var $=h.n?h.n:h.a;c=h.v,c==-127&&(c=0),p.push({label:$.slice(-4)}),_.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,a=Math.min(a,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,a=Math.floor(a));let d=o;a<0&&(d+=Math.abs(a));let b=d/4;for(r=0;r<5;r++)c=a+b*r,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:f},x:{ticks:p},points:_})}},[i,n,o,a]}class qm extends ye{constructor(e){super(),we(this,e,Om,Lm,ke,{json:1})}}function Um(t){let e,l;return e=new Gl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}let Hm=0;function jm(t,e,l){let n={},i=0,o;return xf.subscribe(a=>{l(2,o=a)}),Xf(),t.$$.update=()=>{if(t.$$.dirty&6){let a=0,r=[],c=[],f=[];if(r.push({value:0,label:0}),o&&o.p)for(a=0;a0?Ne(p.d)+"."+qs[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,p.v))}if(o&&o.t){for(a=0;a=i)break;r.push({value:p,label:p})}r.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(r.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Hm,max:i,ticks:r},x:{ticks:c},points:f})}},[n,i,o]}class Wm extends ye{constructor(e){super(),we(this,e,jm,Um,ke,{})}}function ia(t){let e,l,n,i,o,a,r=(t[0].mt?rs(t[0].mt):"-")+"",c,f,p,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",d,b,h;return i=new nc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[2].currency,colorFn:Yf}}),{c(){e=m("div"),l=m("div"),n=m("div"),Z(i.$$.fragment),o=v(),a=m("div"),c=C(r),f=v(),p=m("div"),d=C(_),b=C(" kWh"),u(n,"class","col-span-2"),u(p,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,$){y(g,e,$),s(e,l),s(l,n),V(i,n,null),s(l,o),s(l,a),s(a,c),s(l,f),s(l,p),s(p,d),s(p,b),h=!0},p(g,$){const k={};$&1&&(k.val=g[0].i?g[0].i:0),$&1&&(k.max=g[0].im?g[0].im:15e3),$&1&&(k.sub=g[0].p),$&4&&(k.subunit=g[2].currency),i.$set(k),(!h||$&1)&&r!==(r=(g[0].mt?rs(g[0].mt):"-")+"")&&G(c,r),(!h||$&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&G(d,_)},i(g){h||(P(i.$$.fragment,g),h=!0)},o(g){I(i.$$.fragment,g),h=!1},d(g){g&&w(e),K(i)}}}function sa(t){let e,l,n,i,o,a,r,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",p,_,d;return i=new nc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:$1}}),{c(){e=m("div"),l=m("div"),n=m("div"),Z(i.$$.fragment),o=v(),a=m("div"),r=v(),c=m("div"),p=C(f),_=C(" kWh"),u(n,"class","col-span-2"),u(c,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(b,h){y(b,e,h),s(e,l),s(l,n),V(i,n,null),s(l,o),s(l,a),s(l,r),s(l,c),s(c,p),s(c,_),d=!0},p(b,h){const g={};h&1&&(g.val=b[0].e?b[0].e:0),h&1&&(g.max=b[0].om?b[0].om*1e3:1e4),i.$set(g),(!d||h&1)&&f!==(f=(b[0].ec?b[0].ec.toFixed(1):"-")+"")&&G(p,f)},i(b){d||(P(i.$$.fragment,b),d=!0)},o(b){I(i.$$.fragment,b),d=!1},d(b){b&&w(e),K(i)}}}function oa(t){let e,l,n;return l=new dm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.ds=i[0].ds),l.$set(a)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function ua(t){let e,l,n;return l=new gm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.i1=i[0].i1),o&1&&(a.i2=i[0].i2),o&1&&(a.i3=i[0].i3),o&1&&(a.max=i[0].mf?i[0].mf:32),l.$set(a)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function ra(t){let e,l,n;return l=new wm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),l.$set(a)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function aa(t){let e,l,n;return l=new Tm({props:{data:t[0].ea,currency:t[2].currency,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.data=i[0].ea),o&4&&(a.currency=i[2].currency),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),l.$set(a)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function fa(t){let e,l,n;return l=new Wm({}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){y(i,e,o),V(l,e,null),n=!0},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function ca(t){let e,l,n;return l=new Am({props:{json:t[2]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const a={};o&4&&(a.json=i[2]),l.$set(a)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function ma(t){let e,l,n;return l=new Dm({props:{json:t[3]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const a={};o&8&&(a.json=i[3]),l.$set(a)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function pa(t){let e,l,n;return l=new Rm({props:{json:t[4]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const a={};o&16&&(a.json=i[4]),l.$set(a)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function _a(t){let e,l,n;return l=new qm({props:{json:t[5]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const a={};o&32&&(a.json=i[5]),l.$set(a)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function zm(t){let e,l=je(t[1].ui.i,t[0].i),n,i=je(t[1].ui.e,t[0].om||t[0].e>0),o,a=je(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),r,c=je(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,p=je(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,d=je(t[1].ui.c,t[0].ea),b,h=je(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,$=je(t[1].ui.p,typeof t[0].p=="number"&&!Number.isNaN(t[0].p)),k,S=je(t[1].ui.d,t[3]),M,D=je(t[1].ui.m,t[4]),T,N=je(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),F,R=l&&ia(t),H=i&&sa(t),j=a&&oa(t),E=c&&ua(t),L=p&&ra(t),W=d&&aa(t),z=h&&fa(),q=$&&ca(t),O=S&&ma(t),U=D&&pa(t),X=N&&_a(t);return{c(){e=m("div"),R&&R.c(),n=v(),H&&H.c(),o=v(),j&&j.c(),r=v(),E&&E.c(),f=v(),L&&L.c(),_=v(),W&&W.c(),b=v(),z&&z.c(),g=v(),q&&q.c(),k=v(),O&&O.c(),M=v(),U&&U.c(),T=v(),X&&X.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(B,ne){y(B,e,ne),R&&R.m(e,null),s(e,n),H&&H.m(e,null),s(e,o),j&&j.m(e,null),s(e,r),E&&E.m(e,null),s(e,f),L&&L.m(e,null),s(e,_),W&&W.m(e,null),s(e,b),z&&z.m(e,null),s(e,g),q&&q.m(e,null),s(e,k),O&&O.m(e,null),s(e,M),U&&U.m(e,null),s(e,T),X&&X.m(e,null),F=!0},p(B,[ne]){ne&3&&(l=je(B[1].ui.i,B[0].i)),l?R?(R.p(B,ne),ne&3&&P(R,1)):(R=ia(B),R.c(),P(R,1),R.m(e,n)):R&&(Me(),I(R,1,1,()=>{R=null}),Ae()),ne&3&&(i=je(B[1].ui.e,B[0].om||B[0].e>0)),i?H?(H.p(B,ne),ne&3&&P(H,1)):(H=sa(B),H.c(),P(H,1),H.m(e,o)):H&&(Me(),I(H,1,1,()=>{H=null}),Ae()),ne&3&&(a=je(B[1].ui.v,B[0].u1>100||B[0].u2>100||B[0].u3>100)),a?j?(j.p(B,ne),ne&3&&P(j,1)):(j=oa(B),j.c(),P(j,1),j.m(e,r)):j&&(Me(),I(j,1,1,()=>{j=null}),Ae()),ne&3&&(c=je(B[1].ui.a,B[0].i1>.01||B[0].i2>.01||B[0].i3>.01)),c?E?(E.p(B,ne),ne&3&&P(E,1)):(E=ua(B),E.c(),P(E,1),E.m(e,f)):E&&(Me(),I(E,1,1,()=>{E=null}),Ae()),ne&3&&(p=je(B[1].ui.r,B[0].ri>0||B[0].re>0||B[0].ric>0||B[0].rec>0)),p?L?(L.p(B,ne),ne&3&&P(L,1)):(L=ra(B),L.c(),P(L,1),L.m(e,_)):L&&(Me(),I(L,1,1,()=>{L=null}),Ae()),ne&3&&(d=je(B[1].ui.c,B[0].ea)),d?W?(W.p(B,ne),ne&3&&P(W,1)):(W=aa(B),W.c(),P(W,1),W.m(e,b)):W&&(Me(),I(W,1,1,()=>{W=null}),Ae()),ne&3&&(h=je(B[1].ui.t,B[0].pr&&(B[0].pr.startsWith("10YNO")||B[0].pr=="10Y1001A1001A48H"))),h?z?ne&3&&P(z,1):(z=fa(),z.c(),P(z,1),z.m(e,g)):z&&(Me(),I(z,1,1,()=>{z=null}),Ae()),ne&3&&($=je(B[1].ui.p,typeof B[0].p=="number"&&!Number.isNaN(B[0].p))),$?q?(q.p(B,ne),ne&3&&P(q,1)):(q=ca(B),q.c(),P(q,1),q.m(e,k)):q&&(Me(),I(q,1,1,()=>{q=null}),Ae()),ne&10&&(S=je(B[1].ui.d,B[3])),S?O?(O.p(B,ne),ne&10&&P(O,1)):(O=ma(B),O.c(),P(O,1),O.m(e,M)):O&&(Me(),I(O,1,1,()=>{O=null}),Ae()),ne&18&&(D=je(B[1].ui.m,B[4])),D?U?(U.p(B,ne),ne&18&&P(U,1)):(U=pa(B),U.c(),P(U,1),U.m(e,T)):U&&(Me(),I(U,1,1,()=>{U=null}),Ae()),ne&35&&(N=je(B[1].ui.s,B[0].t&&B[0].t!=-127&&B[5].c>1)),N?X?(X.p(B,ne),ne&35&&P(X,1)):(X=_a(B),X.c(),P(X,1),X.m(e,null)):X&&(Me(),I(X,1,1,()=>{X=null}),Ae())},i(B){F||(P(R),P(H),P(j),P(E),P(L),P(W),P(z),P(q),P(O),P(U),P(X),F=!0)},o(B){I(R),I(H),I(j),I(E),I(L),I(W),I(z),I(q),I(O),I(U),I(X),F=!1},d(B){B&&w(e),R&&R.d(),H&&H.d(),j&&j.d(),E&&E.d(),L&&L.d(),W&&W.d(),z&&z.d(),q&&q.d(),O&&O.d(),U&&U.d(),X&&X.d()}}}function Bm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},a={},r={},c={};return Vf.subscribe(f=>{l(2,o=f)}),Kf.subscribe(f=>{l(3,a=f)}),Qf.subscribe(f=>{l(4,r=f)}),Jf.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,a,r,c]}class Gm extends ye{constructor(e){super(),we(this,e,Bm,zm,ke,{data:0,sysinfo:1})}}let Gs={};const ic=Ze(Gs);async function Ym(){Gs=await(await fetch("/configuration.json")).json(),ic.set(Gs)}function da(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function va(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function ha(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=v(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){y(i,e,o),y(i,l,o),y(i,n,o)},d(i){i&&w(e),i&&w(l),i&&w(n)}}}function ga(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function ba(t){let e,l,n;return{c(){e=m("option"),l=C("GPIO"),n=C(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){y(i,e,o),s(e,l),s(e,n)},d(i){i&&w(e)}}}function ka(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&ba(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=ba(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&w(e)}}}function Vm(t){let e,l,n,i,o,a,r=t[0]=="esp8266"&&va(),c=(t[0]=="esp32"||t[0]=="esp32solo")&&ha(),f=t[0]=="esp32s2"&&ga(),p={length:t[1]+1},_=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{t.$$.dirty&1&&l(1,i=n=="esp8266"?16:n=="esp32s2"?44:39)},[n,i]}class sc extends ye{constructor(e){super(),we(this,e,Km,Vm,ke,{chip:0})}}function wa(t){let e,l,n=t[1]&&ya(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){y(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=ya(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&w(e),n&&n.d()}}}function ya(t){let e,l;return{c(){e=m("div"),l=C(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){y(n,e,i),s(e,l)},p(n,i){i&2&&G(l,n[1])},d(n){n&&w(e)}}}function Qm(t){let e,l=t[0]&&wa(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=wa(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:se,o:se,d(n){l&&l.d(n),n&&w(e)}}}function Zm(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class gt extends ye{constructor(e){super(),we(this,e,Zm,Qm,ke,{active:0,message:1})}}function $a(t,e,l){const n=t.slice();return n[1]=e[l],n}function Ca(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,a){y(o,e,a),s(e,l),s(e,i)},p:se,d(o){o&&w(e)}}}function Jm(t){let e,l,n,i=t[0],o=[];for(let a=0;a{a[p]=null}),Ae(),l=a[e],l||(l=a[e]=o[e](c),l.c()),P(l,1),l.m(n.parentNode,n))},i(c){i||(P(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function rp(t){let e,l;return e=new Yt({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function ap(t){let e,l;return e=new Yt({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function fp(t){let e,l,n,i;const o=[ap,rp],a=[];function r(c,f){return c[3].q.s.r?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let p=e;e=r(c),e!==p&&(Me(),I(a[p],1,1,()=>{a[p]=null}),Ae(),l=a[e],l||(l=a[e]=o[e](c),l.c()),P(l,1),l.m(n.parentNode,n))},i(c){i||(P(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function cp(t){let e,l;return e=new Yt({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function mp(t){let e,l;return e=new Yt({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function pp(t){let e,l,n,i;const o=[mp,cp],a=[];function r(c,f){return c[3].q.s.k?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let p=e;e=r(c),e!==p&&(Me(),I(a[p],1,1,()=>{a[p]=null}),Ae(),l=a[e],l||(l=a[e]=o[e](c),l.c()),P(l,1),l.m(n.parentNode,n))},i(c){i||(P(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function Ra(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S,M,D,T,N,F,R,H,j,E,L,W,z,q,O;return o=new Rt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=v(),i=m("a"),Z(o.$$.fragment),a=v(),r=m("input"),c=v(),f=m("div"),p=m("div"),_=C("Electricity IDX"),d=m("br"),b=v(),h=m("input"),g=v(),$=m("div"),k=C("Current IDX"),S=m("br"),M=v(),D=m("input"),T=v(),N=m("div"),F=C(`Voltage IDX: L1, L2 & L3 - `),R=m("div"),H=m("input"),j=v(),E=m("input"),L=v(),W=m("input"),u(l,"class","text-sm"),u(i,"href",Lt("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(r,"type","hidden"),u(r,"name","o"),r.value="true",u(h,"name","oe"),u(h,"type","text"),u(h,"class","in-f tr w-full"),u(p,"class","w-1/2"),u(D,"name","oc"),u(D,"type","text"),u(D,"class","in-l tr w-full"),u($,"class","w-1/2"),u(f,"class","my-1 flex"),u(H,"name","ou1"),u(H,"type","text"),u(H,"class","in-f tr w-1/3"),u(E,"name","ou2"),u(E,"type","text"),u(E,"class","in-m tr w-1/3"),u(W,"name","ou3"),u(W,"type","text"),u(W,"class","in-l tr w-1/3"),u(R,"class","flex"),u(N,"class","my-1"),u(e,"class","cnt")},m(U,X){y(U,e,X),s(e,l),s(e,n),s(e,i),V(o,i,null),s(e,a),s(e,r),s(e,c),s(e,f),s(f,p),s(p,_),s(p,d),s(p,b),s(p,h),Q(h,t[3].o.e),s(f,g),s(f,$),s($,k),s($,S),s($,M),s($,D),Q(D,t[3].o.c),s(e,T),s(e,N),s(N,F),s(N,R),s(R,H),Q(H,t[3].o.u1),s(R,j),s(R,E),Q(E,t[3].o.u2),s(R,L),s(R,W),Q(W,t[3].o.u3),z=!0,q||(O=[Y(h,"input",t[58]),Y(D,"input",t[59]),Y(H,"input",t[60]),Y(E,"input",t[61]),Y(W,"input",t[62])],q=!0)},p(U,X){X[0]&8&&h.value!==U[3].o.e&&Q(h,U[3].o.e),X[0]&8&&D.value!==U[3].o.c&&Q(D,U[3].o.c),X[0]&8&&H.value!==U[3].o.u1&&Q(H,U[3].o.u1),X[0]&8&&E.value!==U[3].o.u2&&Q(E,U[3].o.u2),X[0]&8&&W.value!==U[3].o.u3&&Q(W,U[3].o.u3)},i(U){z||(P(o.$$.fragment,U),z=!0)},o(U){I(o.$$.fragment,U),z=!1},d(U){U&&w(e),K(o),q=!1,Be(O)}}}function La(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S,M;o=new Rt({});let D={length:9},T=[];for(let N=0;N20&&Ha(t),p=t[0].chip=="esp8266"&&za(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=v(),i=m("a"),Z(o.$$.fragment),a=v(),f&&f.c(),r=v(),p&&p.c(),u(l,"class","text-sm"),u(i,"href",Lt("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(_,d){y(_,e,d),s(e,l),s(e,n),s(e,i),V(o,i,null),s(e,a),f&&f.m(e,null),s(e,r),p&&p.m(e,null),c=!0},p(_,d){_[0].board>20?f?(f.p(_,d),d[0]&1&&P(f,1)):(f=Ha(_),f.c(),P(f,1),f.m(e,r)):f&&(Me(),I(f,1,1,()=>{f=null}),Ae()),_[0].chip=="esp8266"?p?p.p(_,d):(p=za(_),p.c(),p.m(e,null)):p&&(p.d(1),p=null)},i(_){c||(P(o.$$.fragment,_),P(f),c=!0)},o(_){I(o.$$.fragment,_),I(f),c=!1},d(_){_&&w(e),K(o),f&&f.d(),p&&p.d()}}}function Ha(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S,M,D,T,N,F,R,H,j,E,L,W,z,q,O,U,X,B,ne,te,Te,me,Ie,De,Re,Ee,$e,ge,pe,ae,fe,oe,J,ie,Ce,x,ue,He,Se;f=new sc({props:{chip:t[0].chip}});let _e=t[0].chip!="esp8266"&&ja(t),de=t[3].i.v.p>0&&Wa(t);return{c(){e=m("input"),l=v(),n=m("div"),i=m("div"),o=C("HAN"),a=m("br"),r=v(),c=m("select"),Z(f.$$.fragment),p=v(),_=m("div"),d=C("AP button"),b=m("br"),h=v(),g=m("input"),$=v(),k=m("div"),S=C("LED"),M=m("label"),D=m("input"),T=C(" inv"),N=m("br"),F=v(),R=m("div"),H=m("input"),j=v(),E=m("div"),L=C("RGB"),W=m("label"),z=m("input"),q=C(" inverted"),O=m("br"),U=v(),X=m("div"),B=m("input"),ne=v(),te=m("input"),Te=v(),me=m("input"),Ie=v(),De=m("div"),Re=C("Temperature"),Ee=m("br"),$e=v(),ge=m("input"),pe=v(),ae=m("div"),fe=C("Analog temp"),oe=m("br"),J=v(),ie=m("input"),Ce=v(),_e&&_e.c(),x=v(),de&&de.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(c,"name","ih"),u(c,"class","in-f w-full"),t[3].i.h===void 0&&Ge(()=>t[66].call(c)),u(i,"class","w-1/3"),u(g,"name","ia"),u(g,"type","number"),u(g,"min","0"),u(g,"max",t[6]),u(g,"class","in-m tr w-full"),u(_,"class","w-1/3"),u(D,"name","ili"),D.__value="true",D.value=D.__value,u(D,"type","checkbox"),u(D,"class","rounded mb-1"),u(M,"class","ml-4"),u(H,"name","ilp"),u(H,"type","number"),u(H,"min","0"),u(H,"max",t[6]),u(H,"class","in-l tr w-full"),u(R,"class","flex"),u(k,"class","w-1/3"),u(z,"name","iri"),z.__value="true",z.value=z.__value,u(z,"type","checkbox"),u(z,"class","rounded mb-1"),u(W,"class","ml-4"),u(B,"name","irr"),u(B,"type","number"),u(B,"min","0"),u(B,"max",t[6]),u(B,"class","in-f tr w-1/3"),u(te,"name","irg"),u(te,"type","number"),u(te,"min","0"),u(te,"max",t[6]),u(te,"class","in-m tr w-1/3"),u(me,"name","irb"),u(me,"type","number"),u(me,"min","0"),u(me,"max",t[6]),u(me,"class","in-l tr w-1/3"),u(X,"class","flex"),u(E,"class","w-full"),u(ge,"name","itd"),u(ge,"type","number"),u(ge,"min","0"),u(ge,"max",t[6]),u(ge,"class","in-f tr w-full"),u(De,"class","my-1 w-1/3"),u(ie,"name","ita"),u(ie,"type","number"),u(ie,"min","0"),u(ie,"max",t[6]),u(ie,"class","in-l tr w-full"),u(ae,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(le,ve){y(le,e,ve),y(le,l,ve),y(le,n,ve),s(n,i),s(i,o),s(i,a),s(i,r),s(i,c),V(f,c,null),Fe(c,t[3].i.h),s(n,p),s(n,_),s(_,d),s(_,b),s(_,h),s(_,g),Q(g,t[3].i.a),s(n,$),s(n,k),s(k,S),s(k,M),s(M,D),D.checked=t[3].i.l.i,s(M,T),s(k,N),s(k,F),s(k,R),s(R,H),Q(H,t[3].i.l.p),s(n,j),s(n,E),s(E,L),s(E,W),s(W,z),z.checked=t[3].i.r.i,s(W,q),s(E,O),s(E,U),s(E,X),s(X,B),Q(B,t[3].i.r.r),s(X,ne),s(X,te),Q(te,t[3].i.r.g),s(X,Te),s(X,me),Q(me,t[3].i.r.b),s(n,Ie),s(n,De),s(De,Re),s(De,Ee),s(De,$e),s(De,ge),Q(ge,t[3].i.t.d),s(n,pe),s(n,ae),s(ae,fe),s(ae,oe),s(ae,J),s(ae,ie),Q(ie,t[3].i.t.a),s(n,Ce),_e&&_e.m(n,null),s(n,x),de&&de.m(n,null),ue=!0,He||(Se=[Y(c,"change",t[66]),Y(g,"input",t[67]),Y(D,"change",t[68]),Y(H,"input",t[69]),Y(z,"change",t[70]),Y(B,"input",t[71]),Y(te,"input",t[72]),Y(me,"input",t[73]),Y(ge,"input",t[74]),Y(ie,"input",t[75])],He=!0)},p(le,ve){const qe={};ve[0]&1&&(qe.chip=le[0].chip),f.$set(qe),ve[0]&8&&Fe(c,le[3].i.h),(!ue||ve[0]&64)&&u(g,"max",le[6]),ve[0]&8&&ce(g.value)!==le[3].i.a&&Q(g,le[3].i.a),ve[0]&8&&(D.checked=le[3].i.l.i),(!ue||ve[0]&64)&&u(H,"max",le[6]),ve[0]&8&&ce(H.value)!==le[3].i.l.p&&Q(H,le[3].i.l.p),ve[0]&8&&(z.checked=le[3].i.r.i),(!ue||ve[0]&64)&&u(B,"max",le[6]),ve[0]&8&&ce(B.value)!==le[3].i.r.r&&Q(B,le[3].i.r.r),(!ue||ve[0]&64)&&u(te,"max",le[6]),ve[0]&8&&ce(te.value)!==le[3].i.r.g&&Q(te,le[3].i.r.g),(!ue||ve[0]&64)&&u(me,"max",le[6]),ve[0]&8&&ce(me.value)!==le[3].i.r.b&&Q(me,le[3].i.r.b),(!ue||ve[0]&64)&&u(ge,"max",le[6]),ve[0]&8&&ce(ge.value)!==le[3].i.t.d&&Q(ge,le[3].i.t.d),(!ue||ve[0]&64)&&u(ie,"max",le[6]),ve[0]&8&&ce(ie.value)!==le[3].i.t.a&&Q(ie,le[3].i.t.a),le[0].chip!="esp8266"?_e?_e.p(le,ve):(_e=ja(le),_e.c(),_e.m(n,x)):_e&&(_e.d(1),_e=null),le[3].i.v.p>0?de?de.p(le,ve):(de=Wa(le),de.c(),de.m(n,null)):de&&(de.d(1),de=null)},i(le){ue||(P(f.$$.fragment,le),ue=!0)},o(le){I(f.$$.fragment,le),ue=!1},d(le){le&&w(e),le&&w(l),le&&w(n),K(f),_e&&_e.d(),de&&de.d(),He=!1,Be(Se)}}}function ja(t){let e,l,n,i,o,a,r;return{c(){e=m("div"),l=C("Vcc"),n=m("br"),i=v(),o=m("input"),u(o,"name","ivp"),u(o,"type","number"),u(o,"min","0"),u(o,"max",t[6]),u(o,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Q(o,t[3].i.v.p),a||(r=Y(o,"input",t[76]),a=!0)},p(c,f){f[0]&64&&u(o,"max",c[6]),f[0]&8&&ce(o.value)!==c[3].i.v.p&&Q(o,c[3].i.v.p)},d(c){c&&w(e),a=!1,r()}}}function Wa(t){let e,l,n,i,o,a,r,c,f,p;return{c(){e=m("div"),l=C("Voltage divider"),n=m("br"),i=v(),o=m("div"),a=m("input"),r=v(),c=m("input"),u(a,"name","ivdv"),u(a,"type","number"),u(a,"min","0"),u(a,"max","65535"),u(a,"class","in-f tr w-full"),u(a,"placeholder","VCC"),u(c,"name","ivdg"),u(c,"type","number"),u(c,"min","0"),u(c,"max","65535"),u(c,"class","in-l tr w-full"),u(c,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(_,d){y(_,e,d),s(e,l),s(e,n),s(e,i),s(e,o),s(o,a),Q(a,t[3].i.v.d.v),s(o,r),s(o,c),Q(c,t[3].i.v.d.g),f||(p=[Y(a,"input",t[77]),Y(c,"input",t[78])],f=!0)},p(_,d){d[0]&8&&ce(a.value)!==_[3].i.v.d.v&&Q(a,_[3].i.v.d.v),d[0]&8&&ce(c.value)!==_[3].i.v.d.g&&Q(c,_[3].i.v.d.g)},d(_){_&&w(e),f=!1,Be(p)}}}function za(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S=(t[0].board==2||t[0].board==100)&&Ba(t);return{c(){e=m("input"),l=v(),n=m("div"),i=m("div"),o=C("Vcc offset"),a=m("br"),r=v(),c=m("input"),f=v(),p=m("div"),_=C("Multiplier"),d=m("br"),b=v(),h=m("input"),g=v(),S&&S.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(c,"name","ivo"),u(c,"type","number"),u(c,"min","0.0"),u(c,"max","3.5"),u(c,"step","0.01"),u(c,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(h,"name","ivm"),u(h,"type","number"),u(h,"min","0.1"),u(h,"max","10"),u(h,"step","0.01"),u(h,"class","in-l tr w-full"),u(p,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(M,D){y(M,e,D),y(M,l,D),y(M,n,D),s(n,i),s(i,o),s(i,a),s(i,r),s(i,c),Q(c,t[3].i.v.o),s(n,f),s(n,p),s(p,_),s(p,d),s(p,b),s(p,h),Q(h,t[3].i.v.m),s(n,g),S&&S.m(n,null),$||(k=[Y(c,"input",t[79]),Y(h,"input",t[80])],$=!0)},p(M,D){D[0]&8&&ce(c.value)!==M[3].i.v.o&&Q(c,M[3].i.v.o),D[0]&8&&ce(h.value)!==M[3].i.v.m&&Q(h,M[3].i.v.m),M[0].board==2||M[0].board==100?S?S.p(M,D):(S=Ba(M),S.c(),S.m(n,null)):S&&(S.d(1),S=null)},d(M){M&&w(e),M&&w(l),M&&w(n),S&&S.d(),$=!1,Be(k)}}}function Ba(t){let e,l,n,i,o,a,r;return{c(){e=m("div"),l=C("Boot limit"),n=m("br"),i=v(),o=m("input"),u(o,"name","ivb"),u(o,"type","number"),u(o,"min","2.5"),u(o,"max","3.5"),u(o,"step","0.1"),u(o,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Q(o,t[3].i.v.b),a||(r=Y(o,"input",t[81]),a=!0)},p(c,f){f[0]&8&&ce(o.value)!==c[3].i.v.b&&Q(o,c[3].i.v.b)},d(c){c&&w(e),a=!1,r()}}}function Ga(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k=t[3].d.t&&Ya();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=v(),n=m("div"),i=m("label"),o=m("input"),a=C(" Enable telnet"),r=v(),k&&k.c(),c=v(),f=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",d=m("option"),d.textContent="Debug",b=m("option"),b.textContent="Info",h=m("option"),h.textContent="Warning",u(e,"class","bd-red"),u(o,"type","checkbox"),u(o,"name","dt"),o.__value="true",o.value=o.__value,u(o,"class","rounded mb-1"),u(n,"class","my-1"),_.__value=1,_.value=_.__value,d.__value=2,d.value=d.__value,b.__value=3,b.value=b.__value,h.__value=4,h.value=h.__value,u(p,"name","dl"),u(p,"class","in-s"),t[3].d.l===void 0&&Ge(()=>t[84].call(p)),u(f,"class","my-1")},m(S,M){y(S,e,M),y(S,l,M),y(S,n,M),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,a),y(S,r,M),k&&k.m(S,M),y(S,c,M),y(S,f,M),s(f,p),s(p,_),s(p,d),s(p,b),s(p,h),Fe(p,t[3].d.l),g||($=[Y(o,"change",t[83]),Y(p,"change",t[84])],g=!0)},p(S,M){M[0]&8&&(o.checked=S[3].d.t),S[3].d.t?k||(k=Ya(),k.c(),k.m(c.parentNode,c)):k&&(k.d(1),k=null),M[0]&8&&Fe(p,S[3].d.l)},d(S){S&&w(e),S&&w(l),S&&w(n),S&&w(r),k&&k.d(S),S&&w(c),S&&w(f),g=!1,Be($)}}}function Ya(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function _p(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S,M,D,T,N,F,R,H,j,E,L,W,z,q,O,U,X,B,ne,te,Te,me,Ie,De,Re,Ee,$e,ge,pe,ae,fe,oe,J,ie,Ce,x,ue,He,Se,_e,de,le,ve,qe,re,Pe,ai,fi,ci,$t,mi,Qt,pi,_i,di,tt,vi,Zt,Yl,pt,hi,gi,bi,Jt,ki,wi,yi,_t,rl,al,Ue,Bn,Cl,Le,Vl,fl,cl,ml,oo,Gn,uo,Kl,ms,ro,pl,qt,_l,ao,$i,fo,xe,dl,co,Ci,Ql,Zl,Jl,Xl,Si,mo,Yn,Ct,po,_o,Sl,vo,ho,go,Ut,xl,en,bo,tn,Tl,ko,wo,yo,ln,St,$o,Ti,Co,Pl,So,To,Po,nn,Tt,Mo,Pi,Ao,ps,No,Ml,Mi,Pt,Io,Do,Eo,_s,Ai,Mt,Fo,Ro,Lo,Xe,Ni,Oo,sn,on,qo,Vn,Uo,Al,Ho,jo,Wo,Xt,zo,Nl,Bo,Go,Yo,xt,Vo,un,Il,Ko,Qo,Zo,bt,rn,an,fn,cn,Jo,Dl,Xo,xo,eu,mn,kt,tu,Ii,lu,Di,Ei,At,nu,iu,Je,Fi,su,pn,_n,ou,El,uu,ru,au,vl,Ht,dn,vn,fu,dt,Ri,Li,cu,vt,hn,Oi,qi,mu,ds,Ui,Hi,Nt,pu,_u,Kn,du,hl,vu,Qn,It,hu,gu,bu,ji,el,ku,ze,Wi,wu,gn,bn,yu,Zn,$u,jt,Cu,vs,Su,Tu,kn,tl,Pu,Dt,Mu,hs,Fl,Au,Nu,Iu,ll,Du,Rl,Eu,Fu,Ru,nl,Lu,wn,yn,Ou,qu,Uu,il,Hu,$n,ju,Wu,zu,lt,Cn,Sn,Tn,Pn,Mn,An,Bu,Ll,Gu,Yu,Vu,sl,Ku,gs,bs=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",ks,Wt,zi,Qu,Nn,In,Zu,Jn,Ju,Xn,Xu,ws,ht,Bi,xu,Dn,En,er,xn,tr,Gi,Yi,Et,lr,nr,ir,gl,ys,Fn,sr,Vi,Rn,or,Ki,$s,Ol,Cs,ql,Ss,Ul,Ts,Hl,Ft,Ps,ur;r=new Rt({}),R=new xm({});let uc=["NOK","SEK","DKK","EUR"],Qi=[];for(let A=0;A<4;A+=1)Qi[A]=np(lp(t,uc,A));let nt=t[3].p.e&&t[0].chip!="esp8266"&&Pa(t),it=t[3].g.s>0&&Ma(t);ml=new Rt({});let rc=[24,48,96,192,384,576,1152],Zi=[];for(let A=0;A<7;A+=1)Zi[A]=ip(tp(t,rc,A));let st=t[3].m.e.e&&Aa(t),ot=t[3].m.e.e&&Na(t),ut=t[3].m.m.e&&Ia(t);on=new Rt({}),_n=new Rt({}),hn=new oc({});let rt=t[3].n.m=="static"&&Da(t);bn=new Rt({});let at=t[0].chip!="esp8266"&&Ea(t),Ye=t[3].q.s.e&&Fa(t),Ve=t[3].q.m==3&&Ra(t),Ke=bs&&La(t);In=new Rt({});let Ln=t[7],ft=[];for(let A=0;A20||t[0].chip=="esp8266")&&Ua(t);En=new Rt({});let ct=t[3].d.s&&Ga(t);return Ol=new gt({props:{active:t[1],message:"Loading configuration"}}),ql=new gt({props:{active:t[2],message:"Saving configuration"}}),Ul=new gt({props:{active:t[4],message:"Performing factory reset"}}),Hl=new gt({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=v(),a=m("a"),Z(r.$$.fragment),c=v(),f=m("input"),p=v(),_=m("div"),d=m("div"),b=m("div"),h=C("Hostname"),g=m("br"),$=v(),k=m("input"),S=v(),M=m("div"),D=C("Time zone"),T=m("br"),N=v(),F=m("select"),Z(R.$$.fragment),H=v(),j=m("input"),E=v(),L=m("div"),W=C("Price region"),z=m("br"),q=v(),O=m("select"),U=m("optgroup"),X=m("option"),X.textContent="NO1",B=m("option"),B.textContent="NO2",ne=m("option"),ne.textContent="NO3",te=m("option"),te.textContent="NO4",Te=m("option"),Te.textContent="NO5",me=m("optgroup"),Ie=m("option"),Ie.textContent="SE1",De=m("option"),De.textContent="SE2",Re=m("option"),Re.textContent="SE3",Ee=m("option"),Ee.textContent="SE4",$e=m("optgroup"),ge=m("option"),ge.textContent="DK1",pe=m("option"),pe.textContent="DK2",ae=m("option"),ae.textContent="Austria",fe=m("option"),fe.textContent="Belgium",oe=m("option"),oe.textContent="Czech Republic",J=m("option"),J.textContent="Estonia",ie=m("option"),ie.textContent="Finland",Ce=m("option"),Ce.textContent="France",x=m("option"),x.textContent="Germany",ue=m("option"),ue.textContent="Great Britain",He=m("option"),He.textContent="Latvia",Se=m("option"),Se.textContent="Lithuania",_e=m("option"),_e.textContent="Netherland",de=m("option"),de.textContent="Poland",le=m("option"),le.textContent="Switzerland",ve=v(),qe=m("div"),re=m("div"),Pe=m("div"),ai=C("Currency"),fi=m("br"),ci=v(),$t=m("select");for(let A=0;A<4;A+=1)Qi[A].c();mi=v(),Qt=m("div"),pi=C("Multiplier"),_i=m("br"),di=v(),tt=m("input"),vi=v(),Zt=m("div"),Yl=m("label"),pt=m("input"),hi=C(" Enable price fetch from remote server"),gi=v(),nt&&nt.c(),bi=v(),Jt=m("div"),ki=C("Security"),wi=m("br"),yi=v(),_t=m("select"),rl=m("option"),rl.textContent="None",al=m("option"),al.textContent="Only configuration",Ue=m("option"),Ue.textContent="Everything",Bn=v(),it&&it.c(),Cl=v(),Le=m("div"),Vl=m("strong"),Vl.textContent="Meter",fl=v(),cl=m("a"),Z(ml.$$.fragment),oo=v(),Gn=m("input"),uo=v(),Kl=m("div"),ms=m("span"),ms.textContent="Serial configuration",ro=v(),pl=m("div"),qt=m("select"),_l=m("option"),ao=C("Autodetect");for(let A=0;A<7;A+=1)Zi[A].c();fo=v(),xe=m("select"),dl=m("option"),co=C("-"),Ql=m("option"),Ql.textContent="7N1",Zl=m("option"),Zl.textContent="8N1",Jl=m("option"),Jl.textContent="7E1",Xl=m("option"),Xl.textContent="8E1",mo=v(),Yn=m("label"),Ct=m("input"),po=C(" inverted"),_o=v(),Sl=m("div"),vo=C("Voltage"),ho=m("br"),go=v(),Ut=m("select"),xl=m("option"),xl.textContent="400V (TN)",en=m("option"),en.textContent="230V (IT/TT)",bo=v(),tn=m("div"),Tl=m("div"),ko=C("Main fuse"),wo=m("br"),yo=v(),ln=m("label"),St=m("input"),$o=v(),Ti=m("span"),Ti.textContent="A",Co=v(),Pl=m("div"),So=C("Production"),To=m("br"),Po=v(),nn=m("label"),Tt=m("input"),Mo=v(),Pi=m("span"),Pi.textContent="kWp",Ao=v(),ps=m("div"),No=v(),Ml=m("div"),Mi=m("label"),Pt=m("input"),Io=C(" Meter is encrypted"),Do=v(),st&&st.c(),Eo=v(),ot&&ot.c(),_s=v(),Ai=m("label"),Mt=m("input"),Fo=C(" Multipliers"),Ro=v(),ut&&ut.c(),Lo=v(),Xe=m("div"),Ni=m("strong"),Ni.textContent="WiFi",Oo=v(),sn=m("a"),Z(on.$$.fragment),qo=v(),Vn=m("input"),Uo=v(),Al=m("div"),Ho=C("SSID"),jo=m("br"),Wo=v(),Xt=m("input"),zo=v(),Nl=m("div"),Bo=C("Password"),Go=m("br"),Yo=v(),xt=m("input"),Vo=v(),un=m("div"),Il=m("div"),Ko=C("Power saving"),Qo=m("br"),Zo=v(),bt=m("select"),rn=m("option"),rn.textContent="Default",an=m("option"),an.textContent="Off",fn=m("option"),fn.textContent="Minimum",cn=m("option"),cn.textContent="Maximum",Jo=v(),Dl=m("div"),Xo=C("Power"),xo=m("br"),eu=v(),mn=m("div"),kt=m("input"),tu=v(),Ii=m("span"),Ii.textContent="dBm",lu=v(),Di=m("div"),Ei=m("label"),At=m("input"),nu=C(" Auto reboot on connection problem"),iu=v(),Je=m("div"),Fi=m("strong"),Fi.textContent="Network",su=v(),pn=m("a"),Z(_n.$$.fragment),ou=v(),El=m("div"),uu=C("IP"),ru=m("br"),au=v(),vl=m("div"),Ht=m("select"),dn=m("option"),dn.textContent="DHCP",vn=m("option"),vn.textContent="Static",fu=v(),dt=m("input"),cu=v(),vt=m("select"),Z(hn.$$.fragment),mu=v(),rt&&rt.c(),ds=v(),Ui=m("div"),Hi=m("label"),Nt=m("input"),pu=C(" enable mDNS"),_u=v(),Kn=m("input"),du=v(),hl=m("div"),vu=C("NTP "),Qn=m("label"),It=m("input"),hu=C(" obtain from DHCP"),gu=m("br"),bu=v(),ji=m("div"),el=m("input"),ku=v(),ze=m("div"),Wi=m("strong"),Wi.textContent="MQTT",wu=v(),gn=m("a"),Z(bn.$$.fragment),yu=v(),Zn=m("input"),$u=v(),jt=m("div"),Cu=C(`Server - `),at&&at.c(),vs=v(),Su=m("br"),Tu=v(),kn=m("div"),tl=m("input"),Pu=v(),Dt=m("input"),Mu=v(),Ye&&Ye.c(),hs=v(),Fl=m("div"),Au=C("Username"),Nu=m("br"),Iu=v(),ll=m("input"),Du=v(),Rl=m("div"),Eu=C("Password"),Fu=m("br"),Ru=v(),nl=m("input"),Lu=v(),wn=m("div"),yn=m("div"),Ou=C("Client ID"),qu=m("br"),Uu=v(),il=m("input"),Hu=v(),$n=m("div"),ju=C("Payload"),Wu=m("br"),zu=v(),lt=m("select"),Cn=m("option"),Cn.textContent="JSON",Sn=m("option"),Sn.textContent="Raw (minimal)",Tn=m("option"),Tn.textContent="Raw (full)",Pn=m("option"),Pn.textContent="Domoticz",Mn=m("option"),Mn.textContent="HomeAssistant",An=m("option"),An.textContent="HEX dump",Bu=v(),Ll=m("div"),Gu=C("Publish topic"),Yu=m("br"),Vu=v(),sl=m("input"),Ku=v(),Ve&&Ve.c(),gs=v(),Ke&&Ke.c(),ks=v(),Wt=m("div"),zi=m("strong"),zi.textContent="User interface",Qu=v(),Nn=m("a"),Z(In.$$.fragment),Zu=v(),Jn=m("input"),Ju=v(),Xn=m("div");for(let A=0;ASave',$s=v(),Z(Ol.$$.fragment),Cs=v(),Z(ql.$$.fragment),Ss=v(),Z(Ul.$$.fragment),Ts=v(),Z(Hl.$$.fragment),u(i,"class","text-sm"),u(a,"href",Lt("General-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","g"),f.value="true",u(k,"name","gh"),u(k,"type","text"),u(k,"class","in-f w-full"),u(k,"pattern","[A-Za-z0-9-]+"),u(F,"name","gt"),u(F,"class","in-l w-full"),t[3].g.t===void 0&&Ge(()=>t[13].call(F)),u(d,"class","flex"),u(_,"class","my-1"),u(j,"type","hidden"),u(j,"name","p"),j.value="true",X.__value="10YNO-1--------2",X.value=X.__value,B.__value="10YNO-2--------T",B.value=B.__value,ne.__value="10YNO-3--------J",ne.value=ne.__value,te.__value="10YNO-4--------9",te.value=te.__value,Te.__value="10Y1001A1001A48H",Te.value=Te.__value,u(U,"label","Norway"),Ie.__value="10Y1001A1001A44P",Ie.value=Ie.__value,De.__value="10Y1001A1001A45N",De.value=De.__value,Re.__value="10Y1001A1001A46L",Re.value=Re.__value,Ee.__value="10Y1001A1001A47J",Ee.value=Ee.__value,u(me,"label","Sweden"),ge.__value="10YDK-1--------W",ge.value=ge.__value,pe.__value="10YDK-2--------M",pe.value=pe.__value,u($e,"label","Denmark"),ae.__value="10YAT-APG------L",ae.value=ae.__value,fe.__value="10YBE----------2",fe.value=fe.__value,oe.__value="10YCZ-CEPS-----N",oe.value=oe.__value,J.__value="10Y1001A1001A39I",J.value=J.__value,ie.__value="10YFI-1--------U",ie.value=ie.__value,Ce.__value="10YFR-RTE------C",Ce.value=Ce.__value,x.__value="10Y1001A1001A83F",x.value=x.__value,ue.__value="10YGB----------A",ue.value=ue.__value,He.__value="10YLV-1001A00074",He.value=He.__value,Se.__value="10YLT-1001A0008Q",Se.value=Se.__value,_e.__value="10YNL----------L",_e.value=_e.__value,de.__value="10YPL-AREA-----S",de.value=de.__value,le.__value="10YCH-SWISSGRIDZ",le.value=le.__value,u(O,"name","pr"),u(O,"class","in-s"),t[3].p.r===void 0&&Ge(()=>t[14].call(O)),u(L,"class","my-1"),u($t,"name","pc"),u($t,"class","in-f w-full"),t[3].p.c===void 0&&Ge(()=>t[15].call($t)),u(Pe,"class","w-1/2"),u(tt,"name","pm"),u(tt,"type","number"),u(tt,"min","0.001"),u(tt,"max","1000"),u(tt,"step","0.001"),u(tt,"class","in-l tr w-full"),u(Qt,"class","w-1/2"),u(re,"class","flex"),u(qe,"class","my-1"),u(pt,"type","checkbox"),u(pt,"name","pe"),pt.__value="true",pt.value=pt.__value,u(pt,"class","rounded mb-1"),u(Zt,"class","my-1"),rl.__value=0,rl.value=rl.__value,al.__value=1,al.value=al.__value,Ue.__value=2,Ue.value=Ue.__value,u(_t,"name","gs"),u(_t,"class","in-s"),t[3].g.s===void 0&&Ge(()=>t[19].call(_t)),u(Jt,"class","my-1"),u(n,"class","cnt"),u(Vl,"class","text-sm"),u(cl,"href",Lt("Meter-configuration")),u(cl,"target","_blank"),u(cl,"class","float-right"),u(Gn,"type","hidden"),u(Gn,"name","m"),Gn.value="true",_l.__value=0,_l.value=_l.__value,_l.disabled=$i=t[3].m.b!=0,u(qt,"name","mb"),u(qt,"class","in-f"),t[3].m.b===void 0&&Ge(()=>t[22].call(qt)),dl.__value=0,dl.value=dl.__value,dl.disabled=Ci=t[3].m.b!=0,Ql.__value=2,Ql.value=Ql.__value,Zl.__value=3,Zl.value=Zl.__value,Jl.__value=10,Jl.value=Jl.__value,Xl.__value=11,Xl.value=Xl.__value,u(xe,"name","mp"),u(xe,"class","in-l"),xe.disabled=Si=t[3].m.b==0,t[3].m.p===void 0&&Ge(()=>t[23].call(xe)),u(Ct,"name","mi"),Ct.__value="true",Ct.value=Ct.__value,u(Ct,"type","checkbox"),u(Ct,"class","rounded mb-1"),u(Yn,"class","mt-2 ml-3 whitespace-nowrap"),u(pl,"class","flex"),u(Kl,"class","my-1"),xl.__value=2,xl.value=xl.__value,en.__value=1,en.value=en.__value,u(Ut,"name","md"),u(Ut,"class","in-s"),t[3].m.d===void 0&&Ge(()=>t[25].call(Ut)),u(Sl,"class","my-1"),u(St,"name","mf"),u(St,"type","number"),u(St,"min","5"),u(St,"max","65535"),u(St,"class","in-f tr w-full"),u(Ti,"class","in-post"),u(ln,"class","flex"),u(Tl,"class","mx-1"),u(Tt,"name","mr"),u(Tt,"type","number"),u(Tt,"min","0"),u(Tt,"max","65535"),u(Tt,"class","in-f tr w-full"),u(Pi,"class","in-post"),u(nn,"class","flex"),u(Pl,"class","mx-1"),u(tn,"class","my-1 flex"),u(ps,"class","my-1"),u(Pt,"type","checkbox"),u(Pt,"name","me"),Pt.__value="true",Pt.value=Pt.__value,u(Pt,"class","rounded mb-1"),u(Ml,"class","my-1"),u(Mt,"type","checkbox"),u(Mt,"name","mm"),Mt.__value="true",Mt.value=Mt.__value,u(Mt,"class","rounded mb-1"),u(Le,"class","cnt"),u(Ni,"class","text-sm"),u(sn,"href",Lt("WiFi-configuration")),u(sn,"target","_blank"),u(sn,"class","float-right"),u(Vn,"type","hidden"),u(Vn,"name","w"),Vn.value="true",u(Xt,"name","ws"),u(Xt,"type","text"),u(Xt,"class","in-s"),u(Al,"class","my-1"),u(xt,"name","wp"),u(xt,"type","password"),u(xt,"class","in-s"),u(Nl,"class","my-1"),rn.__value=255,rn.value=rn.__value,an.__value=0,an.value=an.__value,fn.__value=1,fn.value=fn.__value,cn.__value=2,cn.value=cn.__value,u(bt,"name","wz"),u(bt,"class","in-s"),t[3].w.z===void 0&&Ge(()=>t[38].call(bt)),u(Il,"class","w-1/2"),u(kt,"name","ww"),u(kt,"type","number"),u(kt,"min","0"),u(kt,"max","20.5"),u(kt,"step","0.5"),u(kt,"class","in-f tr w-full"),u(Ii,"class","in-post"),u(mn,"class","flex"),u(Dl,"class","ml-2 w-1/2"),u(un,"class","my-1 flex"),u(At,"type","checkbox"),u(At,"name","wa"),At.__value="true",At.value=At.__value,u(At,"class","rounded mb-1"),u(Di,"class","my-3"),u(Xe,"class","cnt"),u(Fi,"class","text-sm"),u(pn,"href",Lt("Network-configuration")),u(pn,"target","_blank"),u(pn,"class","float-right"),dn.__value="dhcp",dn.value=dn.__value,vn.__value="static",vn.value=vn.__value,u(Ht,"name","nm"),u(Ht,"class","in-f"),t[3].n.m===void 0&&Ge(()=>t[41].call(Ht)),u(dt,"name","ni"),u(dt,"type","text"),u(dt,"class","in-m w-full"),dt.disabled=Ri=t[3].n.m=="dhcp",dt.required=Li=t[3].n.m=="static",u(vt,"name","ns"),u(vt,"class","in-l"),vt.disabled=Oi=t[3].n.m=="dhcp",vt.required=qi=t[3].n.m=="static",t[3].n.s===void 0&&Ge(()=>t[43].call(vt)),u(vl,"class","flex"),u(El,"class","my-1"),u(Nt,"name","nd"),Nt.__value="true",Nt.value=Nt.__value,u(Nt,"type","checkbox"),u(Nt,"class","rounded mb-1"),u(Ui,"class","my-1"),u(Kn,"type","hidden"),u(Kn,"name","ntp"),Kn.value="true",u(It,"name","ntpd"),It.__value="true",It.value=It.__value,u(It,"type","checkbox"),u(It,"class","rounded mb-1"),u(Qn,"class","ml-4"),u(el,"name","ntph"),u(el,"type","text"),u(el,"class","in-s"),u(ji,"class","flex"),u(hl,"class","my-1"),u(Je,"class","cnt"),u(Wi,"class","text-sm"),u(gn,"href",Lt("MQTT-configuration")),u(gn,"target","_blank"),u(gn,"class","float-right"),u(Zn,"type","hidden"),u(Zn,"name","q"),Zn.value="true",u(tl,"name","qh"),u(tl,"type","text"),u(tl,"class","in-f w-3/4"),u(Dt,"name","qp"),u(Dt,"type","number"),u(Dt,"min","1024"),u(Dt,"max","65535"),u(Dt,"class","in-l tr w-1/4"),u(kn,"class","flex"),u(jt,"class","my-1"),u(ll,"name","qu"),u(ll,"type","text"),u(ll,"class","in-s"),u(Fl,"class","my-1"),u(nl,"name","qa"),u(nl,"type","password"),u(nl,"class","in-s"),u(Rl,"class","my-1"),u(il,"name","qc"),u(il,"type","text"),u(il,"class","in-f w-full"),Cn.__value=0,Cn.value=Cn.__value,Sn.__value=1,Sn.value=Sn.__value,Tn.__value=2,Tn.value=Tn.__value,Pn.__value=3,Pn.value=Pn.__value,Mn.__value=4,Mn.value=Mn.__value,An.__value=255,An.value=An.__value,u(lt,"name","qm"),u(lt,"class","in-l"),t[3].q.m===void 0&&Ge(()=>t[56].call(lt)),u(wn,"class","my-1 flex"),u(sl,"name","qb"),u(sl,"type","text"),u(sl,"class","in-s"),u(Ll,"class","my-1"),u(ze,"class","cnt"),u(zi,"class","text-sm"),u(Nn,"href",Lt("User-interface")),u(Nn,"target","_blank"),u(Nn,"class","float-right"),u(Jn,"type","hidden"),u(Jn,"name","u"),Jn.value="true",u(Xn,"class","flex flex-wrap"),u(Wt,"class","cnt"),u(Bi,"class","text-sm"),u(Dn,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(Dn,"target","_blank"),u(Dn,"class","float-right"),u(xn,"type","hidden"),u(xn,"name","d"),xn.value="true",u(Et,"type","checkbox"),u(Et,"name","ds"),Et.__value="true",Et.value=Et.__value,u(Et,"class","rounded mb-1"),u(Gi,"class","mt-3"),u(ht,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(Fn,"type","button"),u(Fn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),u(Rn,"type","button"),u(Rn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(Vi,"class","text-center"),u(Ki,"class","text-right"),u(gl,"class","grid grid-cols-3"),u(e,"autocomplete","off")},m(A,ee){y(A,e,ee),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),V(r,a,null),s(n,c),s(n,f),s(n,p),s(n,_),s(_,d),s(d,b),s(b,h),s(b,g),s(b,$),s(b,k),Q(k,t[3].g.h),s(d,S),s(d,M),s(M,D),s(M,T),s(M,N),s(M,F),V(R,F,null),Fe(F,t[3].g.t),s(n,H),s(n,j),s(n,E),s(n,L),s(L,W),s(L,z),s(L,q),s(L,O),s(O,U),s(U,X),s(U,B),s(U,ne),s(U,te),s(U,Te),s(O,me),s(me,Ie),s(me,De),s(me,Re),s(me,Ee),s(O,$e),s($e,ge),s($e,pe),s(O,ae),s(O,fe),s(O,oe),s(O,J),s(O,ie),s(O,Ce),s(O,x),s(O,ue),s(O,He),s(O,Se),s(O,_e),s(O,de),s(O,le),Fe(O,t[3].p.r),s(n,ve),s(n,qe),s(qe,re),s(re,Pe),s(Pe,ai),s(Pe,fi),s(Pe,ci),s(Pe,$t);for(let mt=0;mt<4;mt+=1)Qi[mt].m($t,null);Fe($t,t[3].p.c),s(re,mi),s(re,Qt),s(Qt,pi),s(Qt,_i),s(Qt,di),s(Qt,tt),Q(tt,t[3].p.m),s(n,vi),s(n,Zt),s(Zt,Yl),s(Yl,pt),pt.checked=t[3].p.e,s(Yl,hi),s(Zt,gi),nt&&nt.m(Zt,null),s(n,bi),s(n,Jt),s(Jt,ki),s(Jt,wi),s(Jt,yi),s(Jt,_t),s(_t,rl),s(_t,al),s(_t,Ue),Fe(_t,t[3].g.s),s(n,Bn),it&&it.m(n,null),s(l,Cl),s(l,Le),s(Le,Vl),s(Le,fl),s(Le,cl),V(ml,cl,null),s(Le,oo),s(Le,Gn),s(Le,uo),s(Le,Kl),s(Kl,ms),s(Kl,ro),s(Kl,pl),s(pl,qt),s(qt,_l),s(_l,ao);for(let mt=0;mt<7;mt+=1)Zi[mt].m(qt,null);Fe(qt,t[3].m.b),s(pl,fo),s(pl,xe),s(xe,dl),s(dl,co),s(xe,Ql),s(xe,Zl),s(xe,Jl),s(xe,Xl),Fe(xe,t[3].m.p),s(pl,mo),s(pl,Yn),s(Yn,Ct),Ct.checked=t[3].m.i,s(Yn,po),s(Le,_o),s(Le,Sl),s(Sl,vo),s(Sl,ho),s(Sl,go),s(Sl,Ut),s(Ut,xl),s(Ut,en),Fe(Ut,t[3].m.d),s(Le,bo),s(Le,tn),s(tn,Tl),s(Tl,ko),s(Tl,wo),s(Tl,yo),s(Tl,ln),s(ln,St),Q(St,t[3].m.f),s(ln,$o),s(ln,Ti),s(tn,Co),s(tn,Pl),s(Pl,So),s(Pl,To),s(Pl,Po),s(Pl,nn),s(nn,Tt),Q(Tt,t[3].m.r),s(nn,Mo),s(nn,Pi),s(Le,Ao),s(Le,ps),s(Le,No),s(Le,Ml),s(Ml,Mi),s(Mi,Pt),Pt.checked=t[3].m.e.e,s(Mi,Io),s(Ml,Do),st&&st.m(Ml,null),s(Le,Eo),ot&&ot.m(Le,null),s(Le,_s),s(Le,Ai),s(Ai,Mt),Mt.checked=t[3].m.m.e,s(Ai,Fo),s(Le,Ro),ut&&ut.m(Le,null),s(l,Lo),s(l,Xe),s(Xe,Ni),s(Xe,Oo),s(Xe,sn),V(on,sn,null),s(Xe,qo),s(Xe,Vn),s(Xe,Uo),s(Xe,Al),s(Al,Ho),s(Al,jo),s(Al,Wo),s(Al,Xt),Q(Xt,t[3].w.s),s(Xe,zo),s(Xe,Nl),s(Nl,Bo),s(Nl,Go),s(Nl,Yo),s(Nl,xt),Q(xt,t[3].w.p),s(Xe,Vo),s(Xe,un),s(un,Il),s(Il,Ko),s(Il,Qo),s(Il,Zo),s(Il,bt),s(bt,rn),s(bt,an),s(bt,fn),s(bt,cn),Fe(bt,t[3].w.z),s(un,Jo),s(un,Dl),s(Dl,Xo),s(Dl,xo),s(Dl,eu),s(Dl,mn),s(mn,kt),Q(kt,t[3].w.w),s(mn,tu),s(mn,Ii),s(Xe,lu),s(Xe,Di),s(Di,Ei),s(Ei,At),At.checked=t[3].w.a,s(Ei,nu),s(l,iu),s(l,Je),s(Je,Fi),s(Je,su),s(Je,pn),V(_n,pn,null),s(Je,ou),s(Je,El),s(El,uu),s(El,ru),s(El,au),s(El,vl),s(vl,Ht),s(Ht,dn),s(Ht,vn),Fe(Ht,t[3].n.m),s(vl,fu),s(vl,dt),Q(dt,t[3].n.i),s(vl,cu),s(vl,vt),V(hn,vt,null),Fe(vt,t[3].n.s),s(Je,mu),rt&&rt.m(Je,null),s(Je,ds),s(Je,Ui),s(Ui,Hi),s(Hi,Nt),Nt.checked=t[3].n.d,s(Hi,pu),s(Je,_u),s(Je,Kn),s(Je,du),s(Je,hl),s(hl,vu),s(hl,Qn),s(Qn,It),It.checked=t[3].n.h,s(Qn,hu),s(hl,gu),s(hl,bu),s(hl,ji),s(ji,el),Q(el,t[3].n.n1),s(l,ku),s(l,ze),s(ze,Wi),s(ze,wu),s(ze,gn),V(bn,gn,null),s(ze,yu),s(ze,Zn),s(ze,$u),s(ze,jt),s(jt,Cu),at&&at.m(jt,null),s(jt,vs),s(jt,Su),s(jt,Tu),s(jt,kn),s(kn,tl),Q(tl,t[3].q.h),s(kn,Pu),s(kn,Dt),Q(Dt,t[3].q.p),s(ze,Mu),Ye&&Ye.m(ze,null),s(ze,hs),s(ze,Fl),s(Fl,Au),s(Fl,Nu),s(Fl,Iu),s(Fl,ll),Q(ll,t[3].q.u),s(ze,Du),s(ze,Rl),s(Rl,Eu),s(Rl,Fu),s(Rl,Ru),s(Rl,nl),Q(nl,t[3].q.a),s(ze,Lu),s(ze,wn),s(wn,yn),s(yn,Ou),s(yn,qu),s(yn,Uu),s(yn,il),Q(il,t[3].q.c),s(wn,Hu),s(wn,$n),s($n,ju),s($n,Wu),s($n,zu),s($n,lt),s(lt,Cn),s(lt,Sn),s(lt,Tn),s(lt,Pn),s(lt,Mn),s(lt,An),Fe(lt,t[3].q.m),s(ze,Bu),s(ze,Ll),s(Ll,Gu),s(Ll,Yu),s(Ll,Vu),s(Ll,sl),Q(sl,t[3].q.b),s(l,Ku),Ve&&Ve.m(l,null),s(l,gs),Ke&&Ke.m(l,null),s(l,ks),s(l,Wt),s(Wt,zi),s(Wt,Qu),s(Wt,Nn),V(In,Nn,null),s(Wt,Zu),s(Wt,Jn),s(Wt,Ju),s(Wt,Xn);for(let mt=0;mt0?it?it.p(A,ee):(it=Ma(A),it.c(),it.m(n,null)):it&&(it.d(1),it=null),(!Ft||ee[0]&8&&$i!==($i=A[3].m.b!=0))&&(_l.disabled=$i),ee[0]&8&&Fe(qt,A[3].m.b),(!Ft||ee[0]&8&&Ci!==(Ci=A[3].m.b!=0))&&(dl.disabled=Ci),(!Ft||ee[0]&8&&Si!==(Si=A[3].m.b==0))&&(xe.disabled=Si),ee[0]&8&&Fe(xe,A[3].m.p),ee[0]&8&&(Ct.checked=A[3].m.i),ee[0]&8&&Fe(Ut,A[3].m.d),ee[0]&8&&ce(St.value)!==A[3].m.f&&Q(St,A[3].m.f),ee[0]&8&&ce(Tt.value)!==A[3].m.r&&Q(Tt,A[3].m.r),ee[0]&8&&(Pt.checked=A[3].m.e.e),A[3].m.e.e?st?st.p(A,ee):(st=Aa(A),st.c(),st.m(Ml,null)):st&&(st.d(1),st=null),A[3].m.e.e?ot?ot.p(A,ee):(ot=Na(A),ot.c(),ot.m(Le,_s)):ot&&(ot.d(1),ot=null),ee[0]&8&&(Mt.checked=A[3].m.m.e),A[3].m.m.e?ut?ut.p(A,ee):(ut=Ia(A),ut.c(),ut.m(Le,null)):ut&&(ut.d(1),ut=null),ee[0]&8&&Xt.value!==A[3].w.s&&Q(Xt,A[3].w.s),ee[0]&8&&xt.value!==A[3].w.p&&Q(xt,A[3].w.p),ee[0]&8&&Fe(bt,A[3].w.z),ee[0]&8&&ce(kt.value)!==A[3].w.w&&Q(kt,A[3].w.w),ee[0]&8&&(At.checked=A[3].w.a),ee[0]&8&&Fe(Ht,A[3].n.m),(!Ft||ee[0]&8&&Ri!==(Ri=A[3].n.m=="dhcp"))&&(dt.disabled=Ri),(!Ft||ee[0]&8&&Li!==(Li=A[3].n.m=="static"))&&(dt.required=Li),ee[0]&8&&dt.value!==A[3].n.i&&Q(dt,A[3].n.i),(!Ft||ee[0]&8&&Oi!==(Oi=A[3].n.m=="dhcp"))&&(vt.disabled=Oi),(!Ft||ee[0]&8&&qi!==(qi=A[3].n.m=="static"))&&(vt.required=qi),ee[0]&8&&Fe(vt,A[3].n.s),A[3].n.m=="static"?rt?rt.p(A,ee):(rt=Da(A),rt.c(),rt.m(Je,ds)):rt&&(rt.d(1),rt=null),ee[0]&8&&(Nt.checked=A[3].n.d),ee[0]&8&&(It.checked=A[3].n.h),ee[0]&8&&el.value!==A[3].n.n1&&Q(el,A[3].n.n1),A[0].chip!="esp8266"?at?at.p(A,ee):(at=Ea(A),at.c(),at.m(jt,vs)):at&&(at.d(1),at=null),ee[0]&8&&tl.value!==A[3].q.h&&Q(tl,A[3].q.h),ee[0]&8&&ce(Dt.value)!==A[3].q.p&&Q(Dt,A[3].q.p),A[3].q.s.e?Ye?(Ye.p(A,ee),ee[0]&8&&P(Ye,1)):(Ye=Fa(A),Ye.c(),P(Ye,1),Ye.m(ze,hs)):Ye&&(Me(),I(Ye,1,1,()=>{Ye=null}),Ae()),ee[0]&8&&ll.value!==A[3].q.u&&Q(ll,A[3].q.u),ee[0]&8&&nl.value!==A[3].q.a&&Q(nl,A[3].q.a),ee[0]&8&&il.value!==A[3].q.c&&Q(il,A[3].q.c),ee[0]&8&&Fe(lt,A[3].q.m),ee[0]&8&&sl.value!==A[3].q.b&&Q(sl,A[3].q.b),A[3].q.m==3?Ve?(Ve.p(A,ee),ee[0]&8&&P(Ve,1)):(Ve=Ra(A),Ve.c(),P(Ve,1),Ve.m(l,gs)):Ve&&(Me(),I(Ve,1,1,()=>{Ve=null}),Ae()),ee[0]&8&&(bs=A[3].p.r.startsWith("10YNO")||A[3].p.r=="10Y1001A1001A48H"),bs?Ke?(Ke.p(A,ee),ee[0]&8&&P(Ke,1)):(Ke=La(A),Ke.c(),P(Ke,1),Ke.m(l,ks)):Ke&&(Me(),I(Ke,1,1,()=>{Ke=null}),Ae()),ee[0]&136){Ln=A[7];let wt;for(wt=0;wt20||A[0].chip=="esp8266"?Qe?(Qe.p(A,ee),ee[0]&1&&P(Qe,1)):(Qe=Ua(A),Qe.c(),P(Qe,1),Qe.m(l,ws)):Qe&&(Me(),I(Qe,1,1,()=>{Qe=null}),Ae()),ee[0]&8&&(Et.checked=A[3].d.s),A[3].d.s?ct?ct.p(A,ee):(ct=Ga(A),ct.c(),ct.m(ht,null)):ct&&(ct.d(1),ct=null);const mt={};ee[0]&2&&(mt.active=A[1]),Ol.$set(mt);const rr={};ee[0]&4&&(rr.active=A[2]),ql.$set(rr);const ar={};ee[0]&16&&(ar.active=A[4]),Ul.$set(ar);const fr={};ee[0]&32&&(fr.active=A[5]),Hl.$set(fr)},i(A){Ft||(P(r.$$.fragment,A),P(R.$$.fragment,A),P(ml.$$.fragment,A),P(on.$$.fragment,A),P(_n.$$.fragment,A),P(hn.$$.fragment,A),P(bn.$$.fragment,A),P(Ye),P(Ve),P(Ke),P(In.$$.fragment,A),P(Qe),P(En.$$.fragment,A),P(Ol.$$.fragment,A),P(ql.$$.fragment,A),P(Ul.$$.fragment,A),P(Hl.$$.fragment,A),Ft=!0)},o(A){I(r.$$.fragment,A),I(R.$$.fragment,A),I(ml.$$.fragment,A),I(on.$$.fragment,A),I(_n.$$.fragment,A),I(hn.$$.fragment,A),I(bn.$$.fragment,A),I(Ye),I(Ve),I(Ke),I(In.$$.fragment,A),I(Qe),I(En.$$.fragment,A),I(Ol.$$.fragment,A),I(ql.$$.fragment,A),I(Ul.$$.fragment,A),I(Hl.$$.fragment,A),Ft=!1},d(A){A&&w(e),K(r),K(R),Vt(Qi,A),nt&&nt.d(),it&&it.d(),K(ml),Vt(Zi,A),st&&st.d(),ot&&ot.d(),ut&&ut.d(),K(on),K(_n),K(hn),rt&&rt.d(),K(bn),at&&at.d(),Ye&&Ye.d(),Ve&&Ve.d(),Ke&&Ke.d(),K(In),Vt(ft,A),Qe&&Qe.d(),K(En),ct&&ct.d(),A&&w($s),K(Ol,A),A&&w(Cs),K(ql,A),A&&w(Ss),K(Ul,A),A&&w(Ts),K(Hl,A),Ps=!1,Be(ur)}}}async function dp(){await(await fetch("/reboot",{method:"POST"})).json()}function vp(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,a=!1,r={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1},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:null,a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}}};ic.subscribe(Ue=>{Ue.version&&(l(3,r=Ue),l(1,o=!1))}),Ym();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 Ue=new URLSearchParams;Ue.append("perform","true");let Cl=await(await fetch("/reset",{method:"POST",body:Ue})).json();l(4,c=!1),l(5,f=Cl.success)}}async function _(Ue){l(2,a=!0);const Bn=new FormData(Ue.target),Cl=new URLSearchParams;for(let fl of Bn){const[cl,ml]=fl;Cl.append(cl,ml)}let Vl=await(await fetch("/save",{method:"POST",body:Cl})).json();yt.update(fl=>(fl.booting=Vl.reboot,fl.ui=r.u,fl)),l(2,a=!1),Un("/")}const d=function(){confirm("Are you sure you want to reboot the device?")&&(yt.update(Ue=>(Ue.booting=!0,Ue)),dp())},b=function(){r.q.s.e?r.q.p==1883&&l(3,r.q.p=8883,r):r.q.p==8883&&l(3,r.q.p=1883,r)};let h=44;function g(){r.g.h=this.value,l(3,r)}function $(){r.g.t=et(this),l(3,r)}function k(){r.p.r=et(this),l(3,r)}function S(){r.p.c=et(this),l(3,r)}function M(){r.p.m=ce(this.value),l(3,r)}function D(){r.p.e=this.checked,l(3,r)}function T(){r.p.t=this.value,l(3,r)}function N(){r.g.s=et(this),l(3,r)}function F(){r.g.u=this.value,l(3,r)}function R(){r.g.p=this.value,l(3,r)}function H(){r.m.b=et(this),l(3,r)}function j(){r.m.p=et(this),l(3,r)}function E(){r.m.i=this.checked,l(3,r)}function L(){r.m.d=et(this),l(3,r)}function W(){r.m.f=ce(this.value),l(3,r)}function z(){r.m.r=ce(this.value),l(3,r)}function q(){r.m.e.e=this.checked,l(3,r)}function O(){r.m.e.k=this.value,l(3,r)}function U(){r.m.e.a=this.value,l(3,r)}function X(){r.m.m.e=this.checked,l(3,r)}function B(){r.m.m.w=ce(this.value),l(3,r)}function ne(){r.m.m.v=ce(this.value),l(3,r)}function te(){r.m.m.a=ce(this.value),l(3,r)}function Te(){r.m.m.c=ce(this.value),l(3,r)}function me(){r.w.s=this.value,l(3,r)}function Ie(){r.w.p=this.value,l(3,r)}function De(){r.w.z=et(this),l(3,r)}function Re(){r.w.w=ce(this.value),l(3,r)}function Ee(){r.w.a=this.checked,l(3,r)}function $e(){r.n.m=et(this),l(3,r)}function ge(){r.n.i=this.value,l(3,r)}function pe(){r.n.s=et(this),l(3,r)}function ae(){r.n.g=this.value,l(3,r)}function fe(){r.n.d1=this.value,l(3,r)}function oe(){r.n.d2=this.value,l(3,r)}function J(){r.n.d=this.checked,l(3,r)}function ie(){r.n.h=this.checked,l(3,r)}function Ce(){r.n.n1=this.value,l(3,r)}function x(){r.q.s.e=this.checked,l(3,r)}function ue(){r.q.h=this.value,l(3,r)}function He(){r.q.p=ce(this.value),l(3,r)}function Se(){r.q.u=this.value,l(3,r)}function _e(){r.q.a=this.value,l(3,r)}function de(){r.q.c=this.value,l(3,r)}function le(){r.q.m=et(this),l(3,r)}function ve(){r.q.b=this.value,l(3,r)}function qe(){r.o.e=this.value,l(3,r)}function re(){r.o.c=this.value,l(3,r)}function Pe(){r.o.u1=this.value,l(3,r)}function ai(){r.o.u2=this.value,l(3,r)}function fi(){r.o.u3=this.value,l(3,r)}function ci(Ue){r.t.t[Ue]=ce(this.value),l(3,r)}function $t(){r.t.h=ce(this.value),l(3,r)}function mi(Ue){r.u[Ue.key]=et(this),l(3,r)}function Qt(){r.i.h=et(this),l(3,r)}function pi(){r.i.a=ce(this.value),l(3,r)}function _i(){r.i.l.i=this.checked,l(3,r)}function di(){r.i.l.p=ce(this.value),l(3,r)}function tt(){r.i.r.i=this.checked,l(3,r)}function vi(){r.i.r.r=ce(this.value),l(3,r)}function Zt(){r.i.r.g=ce(this.value),l(3,r)}function Yl(){r.i.r.b=ce(this.value),l(3,r)}function pt(){r.i.t.d=ce(this.value),l(3,r)}function hi(){r.i.t.a=ce(this.value),l(3,r)}function gi(){r.i.v.p=ce(this.value),l(3,r)}function bi(){r.i.v.d.v=ce(this.value),l(3,r)}function Jt(){r.i.v.d.g=ce(this.value),l(3,r)}function ki(){r.i.v.o=ce(this.value),l(3,r)}function wi(){r.i.v.m=ce(this.value),l(3,r)}function yi(){r.i.v.b=ce(this.value),l(3,r)}function _t(){r.d.s=this.checked,l(3,r)}function rl(){r.d.t=this.checked,l(3,r)}function al(){r.d.l=et(this),l(3,r)}return t.$$set=Ue=>{"sysinfo"in Ue&&l(0,n=Ue.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,h=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,a,r,c,f,h,i,p,_,d,b,g,$,k,S,M,D,T,N,F,R,H,j,E,L,W,z,q,O,U,X,B,ne,te,Te,me,Ie,De,Re,Ee,$e,ge,pe,ae,fe,oe,J,ie,Ce,x,ue,He,Se,_e,de,le,ve,qe,re,Pe,ai,fi,ci,$t,mi,Qt,pi,_i,di,tt,vi,Zt,Yl,pt,hi,gi,bi,Jt,ki,wi,yi,_t,rl,al]}class hp extends ye{constructor(e){super(),we(this,e,vp,_p,ke,{sysinfo:0},null,[-1,-1,-1,-1])}}function Va(t,e,l){const n=t.slice();return n[20]=e[l],n}function gp(t){let e=he(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&2&&e!==(e=he(n[1].chip,n[1].board)+"")&&G(l,e)},d(n){n&&w(l)}}}function Ka(t){let e,l,n=t[1].apmac+"",i;return{c(){e=m("div"),l=C("AP MAC: "),i=C(n),u(e,"class","my-2")},m(o,a){y(o,e,a),s(e,l),s(e,i)},p(o,a){a&2&&n!==(n=o[1].apmac+"")&&G(i,n)},d(o){o&&w(e)}}}function bp(t){let e;return{c(){e=m("span"),e.textContent="Update consents",u(e,"class","btn-pri-sm")},m(l,n){y(l,e,n)},p:se,d(l){l&&w(e)}}}function Qa(t){let e,l,n,i,o,a=rs(t[1].meter.mfg)+"",r,c,f,p,_=t[1].meter.model+"",d,b,h,g,$=t[1].meter.id+"",k;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=v(),i=m("div"),o=C("Manufacturer: "),r=C(a),c=v(),f=m("div"),p=C("Model: "),d=C(_),b=v(),h=m("div"),g=C("ID: "),k=C($),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(h,"class","my-2"),u(e,"class","cnt")},m(S,M){y(S,e,M),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(e,c),s(e,f),s(f,p),s(f,d),s(e,b),s(e,h),s(h,g),s(h,k)},p(S,M){M&2&&a!==(a=rs(S[1].meter.mfg)+"")&&G(r,a),M&2&&_!==(_=S[1].meter.model+"")&&G(d,_),M&2&&$!==($=S[1].meter.id+"")&&G(k,$)},d(S){S&&w(e)}}}function Za(t){let e,l,n,i,o,a=t[1].net.ip+"",r,c,f,p,_=t[1].net.mask+"",d,b,h,g,$=t[1].net.gw+"",k,S,M,D,T=t[1].net.dns1+"",N,F,R=t[1].net.dns2&&t[1].net.dns2!="0.0.0.0"&&Ja(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=v(),i=m("div"),o=C("IP: "),r=C(a),c=v(),f=m("div"),p=C("Mask: "),d=C(_),b=v(),h=m("div"),g=C("Gateway: "),k=C($),S=v(),M=m("div"),D=C("DNS: "),N=C(T),F=v(),R&&R.c(),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(h,"class","my-2"),u(M,"class","my-2"),u(e,"class","cnt")},m(H,j){y(H,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(e,c),s(e,f),s(f,p),s(f,d),s(e,b),s(e,h),s(h,g),s(h,k),s(e,S),s(e,M),s(M,D),s(M,N),s(M,F),R&&R.m(M,null)},p(H,j){j&2&&a!==(a=H[1].net.ip+"")&&G(r,a),j&2&&_!==(_=H[1].net.mask+"")&&G(d,_),j&2&&$!==($=H[1].net.gw+"")&&G(k,$),j&2&&T!==(T=H[1].net.dns1+"")&&G(N,T),H[1].net.dns2&&H[1].net.dns2!="0.0.0.0"?R?R.p(H,j):(R=Ja(H),R.c(),R.m(M,null)):R&&(R.d(1),R=null)},d(H){H&&w(e),R&&R.d()}}}function Ja(t){let e,l=t[1].net.dns2+"",n;return{c(){e=C("/ "),n=C(l)},m(i,o){y(i,e,o),y(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&G(n,l)},d(i){i&&w(e),i&&w(n)}}}function Xa(t){let e,l,n,i=t[2].tag_name+"",o,a,r,c,f,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name&&xa(t),d=t[1].fwconsent===2&&ef();return{c(){e=m("div"),l=C(`Latest version: + `),R=m("div"),H=m("input"),j=v(),E=m("input"),L=v(),W=m("input"),u(l,"class","text-sm"),u(i,"href",Lt("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(r,"type","hidden"),u(r,"name","o"),r.value="true",u(h,"name","oe"),u(h,"type","text"),u(h,"class","in-f tr w-full"),u(p,"class","w-1/2"),u(D,"name","oc"),u(D,"type","text"),u(D,"class","in-l tr w-full"),u($,"class","w-1/2"),u(f,"class","my-1 flex"),u(H,"name","ou1"),u(H,"type","text"),u(H,"class","in-f tr w-1/3"),u(E,"name","ou2"),u(E,"type","text"),u(E,"class","in-m tr w-1/3"),u(W,"name","ou3"),u(W,"type","text"),u(W,"class","in-l tr w-1/3"),u(R,"class","flex"),u(N,"class","my-1"),u(e,"class","cnt")},m(U,X){y(U,e,X),s(e,l),s(e,n),s(e,i),V(o,i,null),s(e,a),s(e,r),s(e,c),s(e,f),s(f,p),s(p,_),s(p,d),s(p,b),s(p,h),Q(h,t[3].o.e),s(f,g),s(f,$),s($,k),s($,S),s($,M),s($,D),Q(D,t[3].o.c),s(e,T),s(e,N),s(N,F),s(N,R),s(R,H),Q(H,t[3].o.u1),s(R,j),s(R,E),Q(E,t[3].o.u2),s(R,L),s(R,W),Q(W,t[3].o.u3),z=!0,q||(O=[Y(h,"input",t[58]),Y(D,"input",t[59]),Y(H,"input",t[60]),Y(E,"input",t[61]),Y(W,"input",t[62])],q=!0)},p(U,X){X[0]&8&&h.value!==U[3].o.e&&Q(h,U[3].o.e),X[0]&8&&D.value!==U[3].o.c&&Q(D,U[3].o.c),X[0]&8&&H.value!==U[3].o.u1&&Q(H,U[3].o.u1),X[0]&8&&E.value!==U[3].o.u2&&Q(E,U[3].o.u2),X[0]&8&&W.value!==U[3].o.u3&&Q(W,U[3].o.u3)},i(U){z||(P(o.$$.fragment,U),z=!0)},o(U){I(o.$$.fragment,U),z=!1},d(U){U&&w(e),K(o),q=!1,Be(O)}}}function La(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S,M;o=new Rt({});let D={length:9},T=[];for(let N=0;N20&&Ha(t),p=t[0].chip=="esp8266"&&za(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=v(),i=m("a"),Z(o.$$.fragment),a=v(),f&&f.c(),r=v(),p&&p.c(),u(l,"class","text-sm"),u(i,"href",Lt("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(_,d){y(_,e,d),s(e,l),s(e,n),s(e,i),V(o,i,null),s(e,a),f&&f.m(e,null),s(e,r),p&&p.m(e,null),c=!0},p(_,d){_[0].board>20?f?(f.p(_,d),d[0]&1&&P(f,1)):(f=Ha(_),f.c(),P(f,1),f.m(e,r)):f&&(Me(),I(f,1,1,()=>{f=null}),Ae()),_[0].chip=="esp8266"?p?p.p(_,d):(p=za(_),p.c(),p.m(e,null)):p&&(p.d(1),p=null)},i(_){c||(P(o.$$.fragment,_),P(f),c=!0)},o(_){I(o.$$.fragment,_),I(f),c=!1},d(_){_&&w(e),K(o),f&&f.d(),p&&p.d()}}}function Ha(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S,M,D,T,N,F,R,H,j,E,L,W,z,q,O,U,X,B,ne,te,Te,me,Ie,De,Re,Ee,$e,ge,pe,ae,fe,oe,J,ie,Ce,x,ue,He,Se;f=new sc({props:{chip:t[0].chip}});let _e=t[0].chip!="esp8266"&&ja(t),de=t[3].i.v.p>0&&Wa(t);return{c(){e=m("input"),l=v(),n=m("div"),i=m("div"),o=C("HAN"),a=m("br"),r=v(),c=m("select"),Z(f.$$.fragment),p=v(),_=m("div"),d=C("AP button"),b=m("br"),h=v(),g=m("input"),$=v(),k=m("div"),S=C("LED"),M=m("label"),D=m("input"),T=C(" inv"),N=m("br"),F=v(),R=m("div"),H=m("input"),j=v(),E=m("div"),L=C("RGB"),W=m("label"),z=m("input"),q=C(" inverted"),O=m("br"),U=v(),X=m("div"),B=m("input"),ne=v(),te=m("input"),Te=v(),me=m("input"),Ie=v(),De=m("div"),Re=C("Temperature"),Ee=m("br"),$e=v(),ge=m("input"),pe=v(),ae=m("div"),fe=C("Analog temp"),oe=m("br"),J=v(),ie=m("input"),Ce=v(),_e&&_e.c(),x=v(),de&&de.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(c,"name","ih"),u(c,"class","in-f w-full"),t[3].i.h===void 0&&Ge(()=>t[66].call(c)),u(i,"class","w-1/3"),u(g,"name","ia"),u(g,"type","number"),u(g,"min","0"),u(g,"max",t[6]),u(g,"class","in-m tr w-full"),u(_,"class","w-1/3"),u(D,"name","ili"),D.__value="true",D.value=D.__value,u(D,"type","checkbox"),u(D,"class","rounded mb-1"),u(M,"class","ml-4"),u(H,"name","ilp"),u(H,"type","number"),u(H,"min","0"),u(H,"max",t[6]),u(H,"class","in-l tr w-full"),u(R,"class","flex"),u(k,"class","w-1/3"),u(z,"name","iri"),z.__value="true",z.value=z.__value,u(z,"type","checkbox"),u(z,"class","rounded mb-1"),u(W,"class","ml-4"),u(B,"name","irr"),u(B,"type","number"),u(B,"min","0"),u(B,"max",t[6]),u(B,"class","in-f tr w-1/3"),u(te,"name","irg"),u(te,"type","number"),u(te,"min","0"),u(te,"max",t[6]),u(te,"class","in-m tr w-1/3"),u(me,"name","irb"),u(me,"type","number"),u(me,"min","0"),u(me,"max",t[6]),u(me,"class","in-l tr w-1/3"),u(X,"class","flex"),u(E,"class","w-full"),u(ge,"name","itd"),u(ge,"type","number"),u(ge,"min","0"),u(ge,"max",t[6]),u(ge,"class","in-f tr w-full"),u(De,"class","my-1 w-1/3"),u(ie,"name","ita"),u(ie,"type","number"),u(ie,"min","0"),u(ie,"max",t[6]),u(ie,"class","in-l tr w-full"),u(ae,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(le,ve){y(le,e,ve),y(le,l,ve),y(le,n,ve),s(n,i),s(i,o),s(i,a),s(i,r),s(i,c),V(f,c,null),Fe(c,t[3].i.h),s(n,p),s(n,_),s(_,d),s(_,b),s(_,h),s(_,g),Q(g,t[3].i.a),s(n,$),s(n,k),s(k,S),s(k,M),s(M,D),D.checked=t[3].i.l.i,s(M,T),s(k,N),s(k,F),s(k,R),s(R,H),Q(H,t[3].i.l.p),s(n,j),s(n,E),s(E,L),s(E,W),s(W,z),z.checked=t[3].i.r.i,s(W,q),s(E,O),s(E,U),s(E,X),s(X,B),Q(B,t[3].i.r.r),s(X,ne),s(X,te),Q(te,t[3].i.r.g),s(X,Te),s(X,me),Q(me,t[3].i.r.b),s(n,Ie),s(n,De),s(De,Re),s(De,Ee),s(De,$e),s(De,ge),Q(ge,t[3].i.t.d),s(n,pe),s(n,ae),s(ae,fe),s(ae,oe),s(ae,J),s(ae,ie),Q(ie,t[3].i.t.a),s(n,Ce),_e&&_e.m(n,null),s(n,x),de&&de.m(n,null),ue=!0,He||(Se=[Y(c,"change",t[66]),Y(g,"input",t[67]),Y(D,"change",t[68]),Y(H,"input",t[69]),Y(z,"change",t[70]),Y(B,"input",t[71]),Y(te,"input",t[72]),Y(me,"input",t[73]),Y(ge,"input",t[74]),Y(ie,"input",t[75])],He=!0)},p(le,ve){const qe={};ve[0]&1&&(qe.chip=le[0].chip),f.$set(qe),ve[0]&8&&Fe(c,le[3].i.h),(!ue||ve[0]&64)&&u(g,"max",le[6]),ve[0]&8&&ce(g.value)!==le[3].i.a&&Q(g,le[3].i.a),ve[0]&8&&(D.checked=le[3].i.l.i),(!ue||ve[0]&64)&&u(H,"max",le[6]),ve[0]&8&&ce(H.value)!==le[3].i.l.p&&Q(H,le[3].i.l.p),ve[0]&8&&(z.checked=le[3].i.r.i),(!ue||ve[0]&64)&&u(B,"max",le[6]),ve[0]&8&&ce(B.value)!==le[3].i.r.r&&Q(B,le[3].i.r.r),(!ue||ve[0]&64)&&u(te,"max",le[6]),ve[0]&8&&ce(te.value)!==le[3].i.r.g&&Q(te,le[3].i.r.g),(!ue||ve[0]&64)&&u(me,"max",le[6]),ve[0]&8&&ce(me.value)!==le[3].i.r.b&&Q(me,le[3].i.r.b),(!ue||ve[0]&64)&&u(ge,"max",le[6]),ve[0]&8&&ce(ge.value)!==le[3].i.t.d&&Q(ge,le[3].i.t.d),(!ue||ve[0]&64)&&u(ie,"max",le[6]),ve[0]&8&&ce(ie.value)!==le[3].i.t.a&&Q(ie,le[3].i.t.a),le[0].chip!="esp8266"?_e?_e.p(le,ve):(_e=ja(le),_e.c(),_e.m(n,x)):_e&&(_e.d(1),_e=null),le[3].i.v.p>0?de?de.p(le,ve):(de=Wa(le),de.c(),de.m(n,null)):de&&(de.d(1),de=null)},i(le){ue||(P(f.$$.fragment,le),ue=!0)},o(le){I(f.$$.fragment,le),ue=!1},d(le){le&&w(e),le&&w(l),le&&w(n),K(f),_e&&_e.d(),de&&de.d(),He=!1,Be(Se)}}}function ja(t){let e,l,n,i,o,a,r;return{c(){e=m("div"),l=C("Vcc"),n=m("br"),i=v(),o=m("input"),u(o,"name","ivp"),u(o,"type","number"),u(o,"min","0"),u(o,"max",t[6]),u(o,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Q(o,t[3].i.v.p),a||(r=Y(o,"input",t[76]),a=!0)},p(c,f){f[0]&64&&u(o,"max",c[6]),f[0]&8&&ce(o.value)!==c[3].i.v.p&&Q(o,c[3].i.v.p)},d(c){c&&w(e),a=!1,r()}}}function Wa(t){let e,l,n,i,o,a,r,c,f,p;return{c(){e=m("div"),l=C("Voltage divider"),n=m("br"),i=v(),o=m("div"),a=m("input"),r=v(),c=m("input"),u(a,"name","ivdv"),u(a,"type","number"),u(a,"min","0"),u(a,"max","65535"),u(a,"class","in-f tr w-full"),u(a,"placeholder","VCC"),u(c,"name","ivdg"),u(c,"type","number"),u(c,"min","0"),u(c,"max","65535"),u(c,"class","in-l tr w-full"),u(c,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(_,d){y(_,e,d),s(e,l),s(e,n),s(e,i),s(e,o),s(o,a),Q(a,t[3].i.v.d.v),s(o,r),s(o,c),Q(c,t[3].i.v.d.g),f||(p=[Y(a,"input",t[77]),Y(c,"input",t[78])],f=!0)},p(_,d){d[0]&8&&ce(a.value)!==_[3].i.v.d.v&&Q(a,_[3].i.v.d.v),d[0]&8&&ce(c.value)!==_[3].i.v.d.g&&Q(c,_[3].i.v.d.g)},d(_){_&&w(e),f=!1,Be(p)}}}function za(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S=(t[0].board==2||t[0].board==100)&&Ba(t);return{c(){e=m("input"),l=v(),n=m("div"),i=m("div"),o=C("Vcc offset"),a=m("br"),r=v(),c=m("input"),f=v(),p=m("div"),_=C("Multiplier"),d=m("br"),b=v(),h=m("input"),g=v(),S&&S.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(c,"name","ivo"),u(c,"type","number"),u(c,"min","0.0"),u(c,"max","3.5"),u(c,"step","0.01"),u(c,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(h,"name","ivm"),u(h,"type","number"),u(h,"min","0.1"),u(h,"max","10"),u(h,"step","0.01"),u(h,"class","in-l tr w-full"),u(p,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(M,D){y(M,e,D),y(M,l,D),y(M,n,D),s(n,i),s(i,o),s(i,a),s(i,r),s(i,c),Q(c,t[3].i.v.o),s(n,f),s(n,p),s(p,_),s(p,d),s(p,b),s(p,h),Q(h,t[3].i.v.m),s(n,g),S&&S.m(n,null),$||(k=[Y(c,"input",t[79]),Y(h,"input",t[80])],$=!0)},p(M,D){D[0]&8&&ce(c.value)!==M[3].i.v.o&&Q(c,M[3].i.v.o),D[0]&8&&ce(h.value)!==M[3].i.v.m&&Q(h,M[3].i.v.m),M[0].board==2||M[0].board==100?S?S.p(M,D):(S=Ba(M),S.c(),S.m(n,null)):S&&(S.d(1),S=null)},d(M){M&&w(e),M&&w(l),M&&w(n),S&&S.d(),$=!1,Be(k)}}}function Ba(t){let e,l,n,i,o,a,r;return{c(){e=m("div"),l=C("Boot limit"),n=m("br"),i=v(),o=m("input"),u(o,"name","ivb"),u(o,"type","number"),u(o,"min","2.5"),u(o,"max","3.5"),u(o,"step","0.1"),u(o,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Q(o,t[3].i.v.b),a||(r=Y(o,"input",t[81]),a=!0)},p(c,f){f[0]&8&&ce(o.value)!==c[3].i.v.b&&Q(o,c[3].i.v.b)},d(c){c&&w(e),a=!1,r()}}}function Ga(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k=t[3].d.t&&Ya();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=v(),n=m("div"),i=m("label"),o=m("input"),a=C(" Enable telnet"),r=v(),k&&k.c(),c=v(),f=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",d=m("option"),d.textContent="Debug",b=m("option"),b.textContent="Info",h=m("option"),h.textContent="Warning",u(e,"class","bd-red"),u(o,"type","checkbox"),u(o,"name","dt"),o.__value="true",o.value=o.__value,u(o,"class","rounded mb-1"),u(n,"class","my-1"),_.__value=1,_.value=_.__value,d.__value=2,d.value=d.__value,b.__value=3,b.value=b.__value,h.__value=4,h.value=h.__value,u(p,"name","dl"),u(p,"class","in-s"),t[3].d.l===void 0&&Ge(()=>t[84].call(p)),u(f,"class","my-1")},m(S,M){y(S,e,M),y(S,l,M),y(S,n,M),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,a),y(S,r,M),k&&k.m(S,M),y(S,c,M),y(S,f,M),s(f,p),s(p,_),s(p,d),s(p,b),s(p,h),Fe(p,t[3].d.l),g||($=[Y(o,"change",t[83]),Y(p,"change",t[84])],g=!0)},p(S,M){M[0]&8&&(o.checked=S[3].d.t),S[3].d.t?k||(k=Ya(),k.c(),k.m(c.parentNode,c)):k&&(k.d(1),k=null),M[0]&8&&Fe(p,S[3].d.l)},d(S){S&&w(e),S&&w(l),S&&w(n),S&&w(r),k&&k.d(S),S&&w(c),S&&w(f),g=!1,Be($)}}}function Ya(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function _p(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S,M,D,T,N,F,R,H,j,E,L,W,z,q,O,U,X,B,ne,te,Te,me,Ie,De,Re,Ee,$e,ge,pe,ae,fe,oe,J,ie,Ce,x,ue,He,Se,_e,de,le,ve,qe,re,Pe,ai,fi,ci,$t,mi,Qt,pi,_i,di,tt,vi,Zt,Yl,pt,hi,gi,bi,Jt,ki,wi,yi,_t,rl,al,Ue,Bn,Cl,Le,Vl,fl,cl,ml,oo,Gn,uo,Kl,ms,ro,pl,qt,_l,ao,$i,fo,xe,dl,co,Ci,Ql,Zl,Jl,Xl,Si,mo,Yn,Ct,po,_o,Sl,vo,ho,go,Ut,xl,en,bo,tn,Tl,ko,wo,yo,ln,St,$o,Ti,Co,Pl,So,To,Po,nn,Tt,Mo,Pi,Ao,ps,No,Ml,Mi,Pt,Io,Do,Eo,_s,Ai,Mt,Fo,Ro,Lo,Xe,Ni,Oo,sn,on,qo,Vn,Uo,Al,Ho,jo,Wo,Xt,zo,Nl,Bo,Go,Yo,xt,Vo,un,Il,Ko,Qo,Zo,bt,rn,an,fn,cn,Jo,Dl,Xo,xo,eu,mn,kt,tu,Ii,lu,Di,Ei,At,nu,iu,Je,Fi,su,pn,_n,ou,El,uu,ru,au,vl,Ht,dn,vn,fu,dt,Ri,Li,cu,vt,hn,Oi,qi,mu,ds,Ui,Hi,Nt,pu,_u,Kn,du,hl,vu,Qn,It,hu,gu,bu,ji,el,ku,ze,Wi,wu,gn,bn,yu,Zn,$u,jt,Cu,vs,Su,Tu,kn,tl,Pu,Dt,Mu,hs,Fl,Au,Nu,Iu,ll,Du,Rl,Eu,Fu,Ru,nl,Lu,wn,yn,Ou,qu,Uu,il,Hu,$n,ju,Wu,zu,lt,Cn,Sn,Tn,Pn,Mn,An,Bu,Ll,Gu,Yu,Vu,sl,Ku,gs,bs=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",ks,Wt,zi,Qu,Nn,In,Zu,Jn,Ju,Xn,Xu,ws,ht,Bi,xu,Dn,En,er,xn,tr,Gi,Yi,Et,lr,nr,ir,gl,ys,Fn,sr,Vi,Rn,or,Ki,$s,Ol,Cs,ql,Ss,Ul,Ts,Hl,Ft,Ps,ur;r=new Rt({}),R=new xm({});let uc=["NOK","SEK","DKK","EUR"],Qi=[];for(let A=0;A<4;A+=1)Qi[A]=np(lp(t,uc,A));let nt=t[3].p.e&&t[0].chip!="esp8266"&&Pa(t),it=t[3].g.s>0&&Ma(t);ml=new Rt({});let rc=[24,48,96,192,384,576,1152],Zi=[];for(let A=0;A<7;A+=1)Zi[A]=ip(tp(t,rc,A));let st=t[3].m.e.e&&Aa(t),ot=t[3].m.e.e&&Na(t),ut=t[3].m.m.e&&Ia(t);on=new Rt({}),_n=new Rt({}),hn=new oc({});let rt=t[3].n.m=="static"&&Da(t);bn=new Rt({});let at=t[0].chip!="esp8266"&&Ea(t),Ye=t[3].q.s.e&&Fa(t),Ve=t[3].q.m==3&&Ra(t),Ke=bs&&La(t);In=new Rt({});let Ln=t[7],ft=[];for(let A=0;A20||t[0].chip=="esp8266")&&Ua(t);En=new Rt({});let ct=t[3].d.s&&Ga(t);return Ol=new gt({props:{active:t[1],message:"Loading configuration"}}),ql=new gt({props:{active:t[2],message:"Saving configuration"}}),Ul=new gt({props:{active:t[4],message:"Performing factory reset"}}),Hl=new gt({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=v(),a=m("a"),Z(r.$$.fragment),c=v(),f=m("input"),p=v(),_=m("div"),d=m("div"),b=m("div"),h=C("Hostname"),g=m("br"),$=v(),k=m("input"),S=v(),M=m("div"),D=C("Time zone"),T=m("br"),N=v(),F=m("select"),Z(R.$$.fragment),H=v(),j=m("input"),E=v(),L=m("div"),W=C("Price region"),z=m("br"),q=v(),O=m("select"),U=m("optgroup"),X=m("option"),X.textContent="NO1",B=m("option"),B.textContent="NO2",ne=m("option"),ne.textContent="NO3",te=m("option"),te.textContent="NO4",Te=m("option"),Te.textContent="NO5",me=m("optgroup"),Ie=m("option"),Ie.textContent="SE1",De=m("option"),De.textContent="SE2",Re=m("option"),Re.textContent="SE3",Ee=m("option"),Ee.textContent="SE4",$e=m("optgroup"),ge=m("option"),ge.textContent="DK1",pe=m("option"),pe.textContent="DK2",ae=m("option"),ae.textContent="Austria",fe=m("option"),fe.textContent="Belgium",oe=m("option"),oe.textContent="Czech Republic",J=m("option"),J.textContent="Estonia",ie=m("option"),ie.textContent="Finland",Ce=m("option"),Ce.textContent="France",x=m("option"),x.textContent="Germany",ue=m("option"),ue.textContent="Great Britain",He=m("option"),He.textContent="Latvia",Se=m("option"),Se.textContent="Lithuania",_e=m("option"),_e.textContent="Netherland",de=m("option"),de.textContent="Poland",le=m("option"),le.textContent="Switzerland",ve=v(),qe=m("div"),re=m("div"),Pe=m("div"),ai=C("Currency"),fi=m("br"),ci=v(),$t=m("select");for(let A=0;A<4;A+=1)Qi[A].c();mi=v(),Qt=m("div"),pi=C("Multiplier"),_i=m("br"),di=v(),tt=m("input"),vi=v(),Zt=m("div"),Yl=m("label"),pt=m("input"),hi=C(" Enable price fetch from remote server"),gi=v(),nt&&nt.c(),bi=v(),Jt=m("div"),ki=C("Security"),wi=m("br"),yi=v(),_t=m("select"),rl=m("option"),rl.textContent="None",al=m("option"),al.textContent="Only configuration",Ue=m("option"),Ue.textContent="Everything",Bn=v(),it&&it.c(),Cl=v(),Le=m("div"),Vl=m("strong"),Vl.textContent="Meter",fl=v(),cl=m("a"),Z(ml.$$.fragment),oo=v(),Gn=m("input"),uo=v(),Kl=m("div"),ms=m("span"),ms.textContent="Serial configuration",ro=v(),pl=m("div"),qt=m("select"),_l=m("option"),ao=C("Autodetect");for(let A=0;A<7;A+=1)Zi[A].c();fo=v(),xe=m("select"),dl=m("option"),co=C("-"),Ql=m("option"),Ql.textContent="7N1",Zl=m("option"),Zl.textContent="8N1",Jl=m("option"),Jl.textContent="7E1",Xl=m("option"),Xl.textContent="8E1",mo=v(),Yn=m("label"),Ct=m("input"),po=C(" inverted"),_o=v(),Sl=m("div"),vo=C("Voltage"),ho=m("br"),go=v(),Ut=m("select"),xl=m("option"),xl.textContent="400V (TN)",en=m("option"),en.textContent="230V (IT/TT)",bo=v(),tn=m("div"),Tl=m("div"),ko=C("Main fuse"),wo=m("br"),yo=v(),ln=m("label"),St=m("input"),$o=v(),Ti=m("span"),Ti.textContent="A",Co=v(),Pl=m("div"),So=C("Production"),To=m("br"),Po=v(),nn=m("label"),Tt=m("input"),Mo=v(),Pi=m("span"),Pi.textContent="kWp",Ao=v(),ps=m("div"),No=v(),Ml=m("div"),Mi=m("label"),Pt=m("input"),Io=C(" Meter is encrypted"),Do=v(),st&&st.c(),Eo=v(),ot&&ot.c(),_s=v(),Ai=m("label"),Mt=m("input"),Fo=C(" Multipliers"),Ro=v(),ut&&ut.c(),Lo=v(),Xe=m("div"),Ni=m("strong"),Ni.textContent="WiFi",Oo=v(),sn=m("a"),Z(on.$$.fragment),qo=v(),Vn=m("input"),Uo=v(),Al=m("div"),Ho=C("SSID"),jo=m("br"),Wo=v(),Xt=m("input"),zo=v(),Nl=m("div"),Bo=C("Password"),Go=m("br"),Yo=v(),xt=m("input"),Vo=v(),un=m("div"),Il=m("div"),Ko=C("Power saving"),Qo=m("br"),Zo=v(),bt=m("select"),rn=m("option"),rn.textContent="Default",an=m("option"),an.textContent="Off",fn=m("option"),fn.textContent="Minimum",cn=m("option"),cn.textContent="Maximum",Jo=v(),Dl=m("div"),Xo=C("Power"),xo=m("br"),eu=v(),mn=m("div"),kt=m("input"),tu=v(),Ii=m("span"),Ii.textContent="dBm",lu=v(),Di=m("div"),Ei=m("label"),At=m("input"),nu=C(" Auto reboot on connection problem"),iu=v(),Je=m("div"),Fi=m("strong"),Fi.textContent="Network",su=v(),pn=m("a"),Z(_n.$$.fragment),ou=v(),El=m("div"),uu=C("IP"),ru=m("br"),au=v(),vl=m("div"),Ht=m("select"),dn=m("option"),dn.textContent="DHCP",vn=m("option"),vn.textContent="Static",fu=v(),dt=m("input"),cu=v(),vt=m("select"),Z(hn.$$.fragment),mu=v(),rt&&rt.c(),ds=v(),Ui=m("div"),Hi=m("label"),Nt=m("input"),pu=C(" enable mDNS"),_u=v(),Kn=m("input"),du=v(),hl=m("div"),vu=C("NTP "),Qn=m("label"),It=m("input"),hu=C(" obtain from DHCP"),gu=m("br"),bu=v(),ji=m("div"),el=m("input"),ku=v(),ze=m("div"),Wi=m("strong"),Wi.textContent="MQTT",wu=v(),gn=m("a"),Z(bn.$$.fragment),yu=v(),Zn=m("input"),$u=v(),jt=m("div"),Cu=C(`Server + `),at&&at.c(),vs=v(),Su=m("br"),Tu=v(),kn=m("div"),tl=m("input"),Pu=v(),Dt=m("input"),Mu=v(),Ye&&Ye.c(),hs=v(),Fl=m("div"),Au=C("Username"),Nu=m("br"),Iu=v(),ll=m("input"),Du=v(),Rl=m("div"),Eu=C("Password"),Fu=m("br"),Ru=v(),nl=m("input"),Lu=v(),wn=m("div"),yn=m("div"),Ou=C("Client ID"),qu=m("br"),Uu=v(),il=m("input"),Hu=v(),$n=m("div"),ju=C("Payload"),Wu=m("br"),zu=v(),lt=m("select"),Cn=m("option"),Cn.textContent="JSON",Sn=m("option"),Sn.textContent="Raw (minimal)",Tn=m("option"),Tn.textContent="Raw (full)",Pn=m("option"),Pn.textContent="Domoticz",Mn=m("option"),Mn.textContent="HomeAssistant",An=m("option"),An.textContent="HEX dump",Bu=v(),Ll=m("div"),Gu=C("Publish topic"),Yu=m("br"),Vu=v(),sl=m("input"),Ku=v(),Ve&&Ve.c(),gs=v(),Ke&&Ke.c(),ks=v(),Wt=m("div"),zi=m("strong"),zi.textContent="User interface",Qu=v(),Nn=m("a"),Z(In.$$.fragment),Zu=v(),Jn=m("input"),Ju=v(),Xn=m("div");for(let A=0;ASave',$s=v(),Z(Ol.$$.fragment),Cs=v(),Z(ql.$$.fragment),Ss=v(),Z(Ul.$$.fragment),Ts=v(),Z(Hl.$$.fragment),u(i,"class","text-sm"),u(a,"href",Lt("General-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","g"),f.value="true",u(k,"name","gh"),u(k,"type","text"),u(k,"class","in-f w-full"),u(k,"pattern","[A-Za-z0-9-]+"),u(F,"name","gt"),u(F,"class","in-l w-full"),t[3].g.t===void 0&&Ge(()=>t[13].call(F)),u(d,"class","flex"),u(_,"class","my-1"),u(j,"type","hidden"),u(j,"name","p"),j.value="true",X.__value="10YNO-1--------2",X.value=X.__value,B.__value="10YNO-2--------T",B.value=B.__value,ne.__value="10YNO-3--------J",ne.value=ne.__value,te.__value="10YNO-4--------9",te.value=te.__value,Te.__value="10Y1001A1001A48H",Te.value=Te.__value,u(U,"label","Norway"),Ie.__value="10Y1001A1001A44P",Ie.value=Ie.__value,De.__value="10Y1001A1001A45N",De.value=De.__value,Re.__value="10Y1001A1001A46L",Re.value=Re.__value,Ee.__value="10Y1001A1001A47J",Ee.value=Ee.__value,u(me,"label","Sweden"),ge.__value="10YDK-1--------W",ge.value=ge.__value,pe.__value="10YDK-2--------M",pe.value=pe.__value,u($e,"label","Denmark"),ae.__value="10YAT-APG------L",ae.value=ae.__value,fe.__value="10YBE----------2",fe.value=fe.__value,oe.__value="10YCZ-CEPS-----N",oe.value=oe.__value,J.__value="10Y1001A1001A39I",J.value=J.__value,ie.__value="10YFI-1--------U",ie.value=ie.__value,Ce.__value="10YFR-RTE------C",Ce.value=Ce.__value,x.__value="10Y1001A1001A83F",x.value=x.__value,ue.__value="10YGB----------A",ue.value=ue.__value,He.__value="10YLV-1001A00074",He.value=He.__value,Se.__value="10YLT-1001A0008Q",Se.value=Se.__value,_e.__value="10YNL----------L",_e.value=_e.__value,de.__value="10YPL-AREA-----S",de.value=de.__value,le.__value="10YCH-SWISSGRIDZ",le.value=le.__value,u(O,"name","pr"),u(O,"class","in-s"),t[3].p.r===void 0&&Ge(()=>t[14].call(O)),u(L,"class","my-1"),u($t,"name","pc"),u($t,"class","in-f w-full"),t[3].p.c===void 0&&Ge(()=>t[15].call($t)),u(Pe,"class","w-1/2"),u(tt,"name","pm"),u(tt,"type","number"),u(tt,"min","0.001"),u(tt,"max","1000"),u(tt,"step","0.001"),u(tt,"class","in-l tr w-full"),u(Qt,"class","w-1/2"),u(re,"class","flex"),u(qe,"class","my-1"),u(pt,"type","checkbox"),u(pt,"name","pe"),pt.__value="true",pt.value=pt.__value,u(pt,"class","rounded mb-1"),u(Zt,"class","my-1"),rl.__value=0,rl.value=rl.__value,al.__value=1,al.value=al.__value,Ue.__value=2,Ue.value=Ue.__value,u(_t,"name","gs"),u(_t,"class","in-s"),t[3].g.s===void 0&&Ge(()=>t[19].call(_t)),u(Jt,"class","my-1"),u(n,"class","cnt"),u(Vl,"class","text-sm"),u(cl,"href",Lt("Meter-configuration")),u(cl,"target","_blank"),u(cl,"class","float-right"),u(Gn,"type","hidden"),u(Gn,"name","m"),Gn.value="true",_l.__value=0,_l.value=_l.__value,_l.disabled=$i=t[3].m.b!=0,u(qt,"name","mb"),u(qt,"class","in-f"),t[3].m.b===void 0&&Ge(()=>t[22].call(qt)),dl.__value=0,dl.value=dl.__value,dl.disabled=Ci=t[3].m.b!=0,Ql.__value=2,Ql.value=Ql.__value,Zl.__value=3,Zl.value=Zl.__value,Jl.__value=10,Jl.value=Jl.__value,Xl.__value=11,Xl.value=Xl.__value,u(xe,"name","mp"),u(xe,"class","in-l"),xe.disabled=Si=t[3].m.b==0,t[3].m.p===void 0&&Ge(()=>t[23].call(xe)),u(Ct,"name","mi"),Ct.__value="true",Ct.value=Ct.__value,u(Ct,"type","checkbox"),u(Ct,"class","rounded mb-1"),u(Yn,"class","mt-2 ml-3 whitespace-nowrap"),u(pl,"class","flex"),u(Kl,"class","my-1"),xl.__value=2,xl.value=xl.__value,en.__value=1,en.value=en.__value,u(Ut,"name","md"),u(Ut,"class","in-s"),t[3].m.d===void 0&&Ge(()=>t[25].call(Ut)),u(Sl,"class","my-1"),u(St,"name","mf"),u(St,"type","number"),u(St,"min","5"),u(St,"max","65535"),u(St,"class","in-f tr w-full"),u(Ti,"class","in-post"),u(ln,"class","flex"),u(Tl,"class","mx-1"),u(Tt,"name","mr"),u(Tt,"type","number"),u(Tt,"min","0"),u(Tt,"max","65535"),u(Tt,"class","in-f tr w-full"),u(Pi,"class","in-post"),u(nn,"class","flex"),u(Pl,"class","mx-1"),u(tn,"class","my-1 flex"),u(ps,"class","my-1"),u(Pt,"type","checkbox"),u(Pt,"name","me"),Pt.__value="true",Pt.value=Pt.__value,u(Pt,"class","rounded mb-1"),u(Ml,"class","my-1"),u(Mt,"type","checkbox"),u(Mt,"name","mm"),Mt.__value="true",Mt.value=Mt.__value,u(Mt,"class","rounded mb-1"),u(Le,"class","cnt"),u(Ni,"class","text-sm"),u(sn,"href",Lt("WiFi-configuration")),u(sn,"target","_blank"),u(sn,"class","float-right"),u(Vn,"type","hidden"),u(Vn,"name","w"),Vn.value="true",u(Xt,"name","ws"),u(Xt,"type","text"),u(Xt,"class","in-s"),u(Al,"class","my-1"),u(xt,"name","wp"),u(xt,"type","password"),u(xt,"class","in-s"),u(Nl,"class","my-1"),rn.__value=255,rn.value=rn.__value,an.__value=0,an.value=an.__value,fn.__value=1,fn.value=fn.__value,cn.__value=2,cn.value=cn.__value,u(bt,"name","wz"),u(bt,"class","in-s"),t[3].w.z===void 0&&Ge(()=>t[38].call(bt)),u(Il,"class","w-1/2"),u(kt,"name","ww"),u(kt,"type","number"),u(kt,"min","0"),u(kt,"max","20.5"),u(kt,"step","0.5"),u(kt,"class","in-f tr w-full"),u(Ii,"class","in-post"),u(mn,"class","flex"),u(Dl,"class","ml-2 w-1/2"),u(un,"class","my-1 flex"),u(At,"type","checkbox"),u(At,"name","wa"),At.__value="true",At.value=At.__value,u(At,"class","rounded mb-1"),u(Di,"class","my-3"),u(Xe,"class","cnt"),u(Fi,"class","text-sm"),u(pn,"href",Lt("Network-configuration")),u(pn,"target","_blank"),u(pn,"class","float-right"),dn.__value="dhcp",dn.value=dn.__value,vn.__value="static",vn.value=vn.__value,u(Ht,"name","nm"),u(Ht,"class","in-f"),t[3].n.m===void 0&&Ge(()=>t[41].call(Ht)),u(dt,"name","ni"),u(dt,"type","text"),u(dt,"class","in-m w-full"),dt.disabled=Ri=t[3].n.m=="dhcp",dt.required=Li=t[3].n.m=="static",u(vt,"name","ns"),u(vt,"class","in-l"),vt.disabled=Oi=t[3].n.m=="dhcp",vt.required=qi=t[3].n.m=="static",t[3].n.s===void 0&&Ge(()=>t[43].call(vt)),u(vl,"class","flex"),u(El,"class","my-1"),u(Nt,"name","nd"),Nt.__value="true",Nt.value=Nt.__value,u(Nt,"type","checkbox"),u(Nt,"class","rounded mb-1"),u(Ui,"class","my-1"),u(Kn,"type","hidden"),u(Kn,"name","ntp"),Kn.value="true",u(It,"name","ntpd"),It.__value="true",It.value=It.__value,u(It,"type","checkbox"),u(It,"class","rounded mb-1"),u(Qn,"class","ml-4"),u(el,"name","ntph"),u(el,"type","text"),u(el,"class","in-s"),u(ji,"class","flex"),u(hl,"class","my-1"),u(Je,"class","cnt"),u(Wi,"class","text-sm"),u(gn,"href",Lt("MQTT-configuration")),u(gn,"target","_blank"),u(gn,"class","float-right"),u(Zn,"type","hidden"),u(Zn,"name","q"),Zn.value="true",u(tl,"name","qh"),u(tl,"type","text"),u(tl,"class","in-f w-3/4"),u(Dt,"name","qp"),u(Dt,"type","number"),u(Dt,"min","1024"),u(Dt,"max","65535"),u(Dt,"class","in-l tr w-1/4"),u(kn,"class","flex"),u(jt,"class","my-1"),u(ll,"name","qu"),u(ll,"type","text"),u(ll,"class","in-s"),u(Fl,"class","my-1"),u(nl,"name","qa"),u(nl,"type","password"),u(nl,"class","in-s"),u(Rl,"class","my-1"),u(il,"name","qc"),u(il,"type","text"),u(il,"class","in-f w-full"),Cn.__value=0,Cn.value=Cn.__value,Sn.__value=1,Sn.value=Sn.__value,Tn.__value=2,Tn.value=Tn.__value,Pn.__value=3,Pn.value=Pn.__value,Mn.__value=4,Mn.value=Mn.__value,An.__value=255,An.value=An.__value,u(lt,"name","qm"),u(lt,"class","in-l"),t[3].q.m===void 0&&Ge(()=>t[56].call(lt)),u(wn,"class","my-1 flex"),u(sl,"name","qb"),u(sl,"type","text"),u(sl,"class","in-s"),u(Ll,"class","my-1"),u(ze,"class","cnt"),u(zi,"class","text-sm"),u(Nn,"href",Lt("User-interface")),u(Nn,"target","_blank"),u(Nn,"class","float-right"),u(Jn,"type","hidden"),u(Jn,"name","u"),Jn.value="true",u(Xn,"class","flex flex-wrap"),u(Wt,"class","cnt"),u(Bi,"class","text-sm"),u(Dn,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(Dn,"target","_blank"),u(Dn,"class","float-right"),u(xn,"type","hidden"),u(xn,"name","d"),xn.value="true",u(Et,"type","checkbox"),u(Et,"name","ds"),Et.__value="true",Et.value=Et.__value,u(Et,"class","rounded mb-1"),u(Gi,"class","mt-3"),u(ht,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(Fn,"type","button"),u(Fn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),u(Rn,"type","button"),u(Rn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(Vi,"class","text-center"),u(Ki,"class","text-right"),u(gl,"class","grid grid-cols-3"),u(e,"autocomplete","off")},m(A,ee){y(A,e,ee),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),V(r,a,null),s(n,c),s(n,f),s(n,p),s(n,_),s(_,d),s(d,b),s(b,h),s(b,g),s(b,$),s(b,k),Q(k,t[3].g.h),s(d,S),s(d,M),s(M,D),s(M,T),s(M,N),s(M,F),V(R,F,null),Fe(F,t[3].g.t),s(n,H),s(n,j),s(n,E),s(n,L),s(L,W),s(L,z),s(L,q),s(L,O),s(O,U),s(U,X),s(U,B),s(U,ne),s(U,te),s(U,Te),s(O,me),s(me,Ie),s(me,De),s(me,Re),s(me,Ee),s(O,$e),s($e,ge),s($e,pe),s(O,ae),s(O,fe),s(O,oe),s(O,J),s(O,ie),s(O,Ce),s(O,x),s(O,ue),s(O,He),s(O,Se),s(O,_e),s(O,de),s(O,le),Fe(O,t[3].p.r),s(n,ve),s(n,qe),s(qe,re),s(re,Pe),s(Pe,ai),s(Pe,fi),s(Pe,ci),s(Pe,$t);for(let mt=0;mt<4;mt+=1)Qi[mt].m($t,null);Fe($t,t[3].p.c),s(re,mi),s(re,Qt),s(Qt,pi),s(Qt,_i),s(Qt,di),s(Qt,tt),Q(tt,t[3].p.m),s(n,vi),s(n,Zt),s(Zt,Yl),s(Yl,pt),pt.checked=t[3].p.e,s(Yl,hi),s(Zt,gi),nt&&nt.m(Zt,null),s(n,bi),s(n,Jt),s(Jt,ki),s(Jt,wi),s(Jt,yi),s(Jt,_t),s(_t,rl),s(_t,al),s(_t,Ue),Fe(_t,t[3].g.s),s(n,Bn),it&&it.m(n,null),s(l,Cl),s(l,Le),s(Le,Vl),s(Le,fl),s(Le,cl),V(ml,cl,null),s(Le,oo),s(Le,Gn),s(Le,uo),s(Le,Kl),s(Kl,ms),s(Kl,ro),s(Kl,pl),s(pl,qt),s(qt,_l),s(_l,ao);for(let mt=0;mt<7;mt+=1)Zi[mt].m(qt,null);Fe(qt,t[3].m.b),s(pl,fo),s(pl,xe),s(xe,dl),s(dl,co),s(xe,Ql),s(xe,Zl),s(xe,Jl),s(xe,Xl),Fe(xe,t[3].m.p),s(pl,mo),s(pl,Yn),s(Yn,Ct),Ct.checked=t[3].m.i,s(Yn,po),s(Le,_o),s(Le,Sl),s(Sl,vo),s(Sl,ho),s(Sl,go),s(Sl,Ut),s(Ut,xl),s(Ut,en),Fe(Ut,t[3].m.d),s(Le,bo),s(Le,tn),s(tn,Tl),s(Tl,ko),s(Tl,wo),s(Tl,yo),s(Tl,ln),s(ln,St),Q(St,t[3].m.f),s(ln,$o),s(ln,Ti),s(tn,Co),s(tn,Pl),s(Pl,So),s(Pl,To),s(Pl,Po),s(Pl,nn),s(nn,Tt),Q(Tt,t[3].m.r),s(nn,Mo),s(nn,Pi),s(Le,Ao),s(Le,ps),s(Le,No),s(Le,Ml),s(Ml,Mi),s(Mi,Pt),Pt.checked=t[3].m.e.e,s(Mi,Io),s(Ml,Do),st&&st.m(Ml,null),s(Le,Eo),ot&&ot.m(Le,null),s(Le,_s),s(Le,Ai),s(Ai,Mt),Mt.checked=t[3].m.m.e,s(Ai,Fo),s(Le,Ro),ut&&ut.m(Le,null),s(l,Lo),s(l,Xe),s(Xe,Ni),s(Xe,Oo),s(Xe,sn),V(on,sn,null),s(Xe,qo),s(Xe,Vn),s(Xe,Uo),s(Xe,Al),s(Al,Ho),s(Al,jo),s(Al,Wo),s(Al,Xt),Q(Xt,t[3].w.s),s(Xe,zo),s(Xe,Nl),s(Nl,Bo),s(Nl,Go),s(Nl,Yo),s(Nl,xt),Q(xt,t[3].w.p),s(Xe,Vo),s(Xe,un),s(un,Il),s(Il,Ko),s(Il,Qo),s(Il,Zo),s(Il,bt),s(bt,rn),s(bt,an),s(bt,fn),s(bt,cn),Fe(bt,t[3].w.z),s(un,Jo),s(un,Dl),s(Dl,Xo),s(Dl,xo),s(Dl,eu),s(Dl,mn),s(mn,kt),Q(kt,t[3].w.w),s(mn,tu),s(mn,Ii),s(Xe,lu),s(Xe,Di),s(Di,Ei),s(Ei,At),At.checked=t[3].w.a,s(Ei,nu),s(l,iu),s(l,Je),s(Je,Fi),s(Je,su),s(Je,pn),V(_n,pn,null),s(Je,ou),s(Je,El),s(El,uu),s(El,ru),s(El,au),s(El,vl),s(vl,Ht),s(Ht,dn),s(Ht,vn),Fe(Ht,t[3].n.m),s(vl,fu),s(vl,dt),Q(dt,t[3].n.i),s(vl,cu),s(vl,vt),V(hn,vt,null),Fe(vt,t[3].n.s),s(Je,mu),rt&&rt.m(Je,null),s(Je,ds),s(Je,Ui),s(Ui,Hi),s(Hi,Nt),Nt.checked=t[3].n.d,s(Hi,pu),s(Je,_u),s(Je,Kn),s(Je,du),s(Je,hl),s(hl,vu),s(hl,Qn),s(Qn,It),It.checked=t[3].n.h,s(Qn,hu),s(hl,gu),s(hl,bu),s(hl,ji),s(ji,el),Q(el,t[3].n.n1),s(l,ku),s(l,ze),s(ze,Wi),s(ze,wu),s(ze,gn),V(bn,gn,null),s(ze,yu),s(ze,Zn),s(ze,$u),s(ze,jt),s(jt,Cu),at&&at.m(jt,null),s(jt,vs),s(jt,Su),s(jt,Tu),s(jt,kn),s(kn,tl),Q(tl,t[3].q.h),s(kn,Pu),s(kn,Dt),Q(Dt,t[3].q.p),s(ze,Mu),Ye&&Ye.m(ze,null),s(ze,hs),s(ze,Fl),s(Fl,Au),s(Fl,Nu),s(Fl,Iu),s(Fl,ll),Q(ll,t[3].q.u),s(ze,Du),s(ze,Rl),s(Rl,Eu),s(Rl,Fu),s(Rl,Ru),s(Rl,nl),Q(nl,t[3].q.a),s(ze,Lu),s(ze,wn),s(wn,yn),s(yn,Ou),s(yn,qu),s(yn,Uu),s(yn,il),Q(il,t[3].q.c),s(wn,Hu),s(wn,$n),s($n,ju),s($n,Wu),s($n,zu),s($n,lt),s(lt,Cn),s(lt,Sn),s(lt,Tn),s(lt,Pn),s(lt,Mn),s(lt,An),Fe(lt,t[3].q.m),s(ze,Bu),s(ze,Ll),s(Ll,Gu),s(Ll,Yu),s(Ll,Vu),s(Ll,sl),Q(sl,t[3].q.b),s(l,Ku),Ve&&Ve.m(l,null),s(l,gs),Ke&&Ke.m(l,null),s(l,ks),s(l,Wt),s(Wt,zi),s(Wt,Qu),s(Wt,Nn),V(In,Nn,null),s(Wt,Zu),s(Wt,Jn),s(Wt,Ju),s(Wt,Xn);for(let mt=0;mt0?it?it.p(A,ee):(it=Ma(A),it.c(),it.m(n,null)):it&&(it.d(1),it=null),(!Ft||ee[0]&8&&$i!==($i=A[3].m.b!=0))&&(_l.disabled=$i),ee[0]&8&&Fe(qt,A[3].m.b),(!Ft||ee[0]&8&&Ci!==(Ci=A[3].m.b!=0))&&(dl.disabled=Ci),(!Ft||ee[0]&8&&Si!==(Si=A[3].m.b==0))&&(xe.disabled=Si),ee[0]&8&&Fe(xe,A[3].m.p),ee[0]&8&&(Ct.checked=A[3].m.i),ee[0]&8&&Fe(Ut,A[3].m.d),ee[0]&8&&ce(St.value)!==A[3].m.f&&Q(St,A[3].m.f),ee[0]&8&&ce(Tt.value)!==A[3].m.r&&Q(Tt,A[3].m.r),ee[0]&8&&(Pt.checked=A[3].m.e.e),A[3].m.e.e?st?st.p(A,ee):(st=Aa(A),st.c(),st.m(Ml,null)):st&&(st.d(1),st=null),A[3].m.e.e?ot?ot.p(A,ee):(ot=Na(A),ot.c(),ot.m(Le,_s)):ot&&(ot.d(1),ot=null),ee[0]&8&&(Mt.checked=A[3].m.m.e),A[3].m.m.e?ut?ut.p(A,ee):(ut=Ia(A),ut.c(),ut.m(Le,null)):ut&&(ut.d(1),ut=null),ee[0]&8&&Xt.value!==A[3].w.s&&Q(Xt,A[3].w.s),ee[0]&8&&xt.value!==A[3].w.p&&Q(xt,A[3].w.p),ee[0]&8&&Fe(bt,A[3].w.z),ee[0]&8&&ce(kt.value)!==A[3].w.w&&Q(kt,A[3].w.w),ee[0]&8&&(At.checked=A[3].w.a),ee[0]&8&&Fe(Ht,A[3].n.m),(!Ft||ee[0]&8&&Ri!==(Ri=A[3].n.m=="dhcp"))&&(dt.disabled=Ri),(!Ft||ee[0]&8&&Li!==(Li=A[3].n.m=="static"))&&(dt.required=Li),ee[0]&8&&dt.value!==A[3].n.i&&Q(dt,A[3].n.i),(!Ft||ee[0]&8&&Oi!==(Oi=A[3].n.m=="dhcp"))&&(vt.disabled=Oi),(!Ft||ee[0]&8&&qi!==(qi=A[3].n.m=="static"))&&(vt.required=qi),ee[0]&8&&Fe(vt,A[3].n.s),A[3].n.m=="static"?rt?rt.p(A,ee):(rt=Da(A),rt.c(),rt.m(Je,ds)):rt&&(rt.d(1),rt=null),ee[0]&8&&(Nt.checked=A[3].n.d),ee[0]&8&&(It.checked=A[3].n.h),ee[0]&8&&el.value!==A[3].n.n1&&Q(el,A[3].n.n1),A[0].chip!="esp8266"?at?at.p(A,ee):(at=Ea(A),at.c(),at.m(jt,vs)):at&&(at.d(1),at=null),ee[0]&8&&tl.value!==A[3].q.h&&Q(tl,A[3].q.h),ee[0]&8&&ce(Dt.value)!==A[3].q.p&&Q(Dt,A[3].q.p),A[3].q.s.e?Ye?(Ye.p(A,ee),ee[0]&8&&P(Ye,1)):(Ye=Fa(A),Ye.c(),P(Ye,1),Ye.m(ze,hs)):Ye&&(Me(),I(Ye,1,1,()=>{Ye=null}),Ae()),ee[0]&8&&ll.value!==A[3].q.u&&Q(ll,A[3].q.u),ee[0]&8&&nl.value!==A[3].q.a&&Q(nl,A[3].q.a),ee[0]&8&&il.value!==A[3].q.c&&Q(il,A[3].q.c),ee[0]&8&&Fe(lt,A[3].q.m),ee[0]&8&&sl.value!==A[3].q.b&&Q(sl,A[3].q.b),A[3].q.m==3?Ve?(Ve.p(A,ee),ee[0]&8&&P(Ve,1)):(Ve=Ra(A),Ve.c(),P(Ve,1),Ve.m(l,gs)):Ve&&(Me(),I(Ve,1,1,()=>{Ve=null}),Ae()),ee[0]&8&&(bs=A[3].p.r.startsWith("10YNO")||A[3].p.r=="10Y1001A1001A48H"),bs?Ke?(Ke.p(A,ee),ee[0]&8&&P(Ke,1)):(Ke=La(A),Ke.c(),P(Ke,1),Ke.m(l,ks)):Ke&&(Me(),I(Ke,1,1,()=>{Ke=null}),Ae()),ee[0]&136){Ln=A[7];let wt;for(wt=0;wt20||A[0].chip=="esp8266"?Qe?(Qe.p(A,ee),ee[0]&1&&P(Qe,1)):(Qe=Ua(A),Qe.c(),P(Qe,1),Qe.m(l,ws)):Qe&&(Me(),I(Qe,1,1,()=>{Qe=null}),Ae()),ee[0]&8&&(Et.checked=A[3].d.s),A[3].d.s?ct?ct.p(A,ee):(ct=Ga(A),ct.c(),ct.m(ht,null)):ct&&(ct.d(1),ct=null);const mt={};ee[0]&2&&(mt.active=A[1]),Ol.$set(mt);const rr={};ee[0]&4&&(rr.active=A[2]),ql.$set(rr);const ar={};ee[0]&16&&(ar.active=A[4]),Ul.$set(ar);const fr={};ee[0]&32&&(fr.active=A[5]),Hl.$set(fr)},i(A){Ft||(P(r.$$.fragment,A),P(R.$$.fragment,A),P(ml.$$.fragment,A),P(on.$$.fragment,A),P(_n.$$.fragment,A),P(hn.$$.fragment,A),P(bn.$$.fragment,A),P(Ye),P(Ve),P(Ke),P(In.$$.fragment,A),P(Qe),P(En.$$.fragment,A),P(Ol.$$.fragment,A),P(ql.$$.fragment,A),P(Ul.$$.fragment,A),P(Hl.$$.fragment,A),Ft=!0)},o(A){I(r.$$.fragment,A),I(R.$$.fragment,A),I(ml.$$.fragment,A),I(on.$$.fragment,A),I(_n.$$.fragment,A),I(hn.$$.fragment,A),I(bn.$$.fragment,A),I(Ye),I(Ve),I(Ke),I(In.$$.fragment,A),I(Qe),I(En.$$.fragment,A),I(Ol.$$.fragment,A),I(ql.$$.fragment,A),I(Ul.$$.fragment,A),I(Hl.$$.fragment,A),Ft=!1},d(A){A&&w(e),K(r),K(R),Vt(Qi,A),nt&&nt.d(),it&&it.d(),K(ml),Vt(Zi,A),st&&st.d(),ot&&ot.d(),ut&&ut.d(),K(on),K(_n),K(hn),rt&&rt.d(),K(bn),at&&at.d(),Ye&&Ye.d(),Ve&&Ve.d(),Ke&&Ke.d(),K(In),Vt(ft,A),Qe&&Qe.d(),K(En),ct&&ct.d(),A&&w($s),K(Ol,A),A&&w(Cs),K(ql,A),A&&w(Ss),K(Ul,A),A&&w(Ts),K(Hl,A),Ps=!1,Be(ur)}}}async function dp(){await(await fetch("/reboot",{method:"POST"})).json()}function vp(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,a=!1,r={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1},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:null,a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}}};ic.subscribe(Ue=>{Ue.version&&(l(3,r=Ue),l(1,o=!1))}),Ym();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 Ue=new URLSearchParams;Ue.append("perform","true");let Cl=await(await fetch("/reset",{method:"POST",body:Ue})).json();l(4,c=!1),l(5,f=Cl.success)}}async function _(Ue){l(2,a=!0);const Bn=new FormData(Ue.target),Cl=new URLSearchParams;for(let fl of Bn){const[cl,ml]=fl;Cl.append(cl,ml)}let Vl=await(await fetch("/save",{method:"POST",body:Cl})).json();yt.update(fl=>(fl.booting=Vl.reboot,fl.ui=r.u,fl)),l(2,a=!1),Un("/")}const d=function(){confirm("Are you sure you want to reboot the device?")&&(yt.update(Ue=>(Ue.booting=!0,Ue)),dp())},b=function(){r.q.s.e?r.q.p==1883&&l(3,r.q.p=8883,r):r.q.p==8883&&l(3,r.q.p=1883,r)};let h=44;function g(){r.g.h=this.value,l(3,r)}function $(){r.g.t=et(this),l(3,r)}function k(){r.p.r=et(this),l(3,r)}function S(){r.p.c=et(this),l(3,r)}function M(){r.p.m=ce(this.value),l(3,r)}function D(){r.p.e=this.checked,l(3,r)}function T(){r.p.t=this.value,l(3,r)}function N(){r.g.s=et(this),l(3,r)}function F(){r.g.u=this.value,l(3,r)}function R(){r.g.p=this.value,l(3,r)}function H(){r.m.b=et(this),l(3,r)}function j(){r.m.p=et(this),l(3,r)}function E(){r.m.i=this.checked,l(3,r)}function L(){r.m.d=et(this),l(3,r)}function W(){r.m.f=ce(this.value),l(3,r)}function z(){r.m.r=ce(this.value),l(3,r)}function q(){r.m.e.e=this.checked,l(3,r)}function O(){r.m.e.k=this.value,l(3,r)}function U(){r.m.e.a=this.value,l(3,r)}function X(){r.m.m.e=this.checked,l(3,r)}function B(){r.m.m.w=ce(this.value),l(3,r)}function ne(){r.m.m.v=ce(this.value),l(3,r)}function te(){r.m.m.a=ce(this.value),l(3,r)}function Te(){r.m.m.c=ce(this.value),l(3,r)}function me(){r.w.s=this.value,l(3,r)}function Ie(){r.w.p=this.value,l(3,r)}function De(){r.w.z=et(this),l(3,r)}function Re(){r.w.w=ce(this.value),l(3,r)}function Ee(){r.w.a=this.checked,l(3,r)}function $e(){r.n.m=et(this),l(3,r)}function ge(){r.n.i=this.value,l(3,r)}function pe(){r.n.s=et(this),l(3,r)}function ae(){r.n.g=this.value,l(3,r)}function fe(){r.n.d1=this.value,l(3,r)}function oe(){r.n.d2=this.value,l(3,r)}function J(){r.n.d=this.checked,l(3,r)}function ie(){r.n.h=this.checked,l(3,r)}function Ce(){r.n.n1=this.value,l(3,r)}function x(){r.q.s.e=this.checked,l(3,r)}function ue(){r.q.h=this.value,l(3,r)}function He(){r.q.p=ce(this.value),l(3,r)}function Se(){r.q.u=this.value,l(3,r)}function _e(){r.q.a=this.value,l(3,r)}function de(){r.q.c=this.value,l(3,r)}function le(){r.q.m=et(this),l(3,r)}function ve(){r.q.b=this.value,l(3,r)}function qe(){r.o.e=this.value,l(3,r)}function re(){r.o.c=this.value,l(3,r)}function Pe(){r.o.u1=this.value,l(3,r)}function ai(){r.o.u2=this.value,l(3,r)}function fi(){r.o.u3=this.value,l(3,r)}function ci(Ue){r.t.t[Ue]=ce(this.value),l(3,r)}function $t(){r.t.h=ce(this.value),l(3,r)}function mi(Ue){r.u[Ue.key]=et(this),l(3,r)}function Qt(){r.i.h=et(this),l(3,r)}function pi(){r.i.a=ce(this.value),l(3,r)}function _i(){r.i.l.i=this.checked,l(3,r)}function di(){r.i.l.p=ce(this.value),l(3,r)}function tt(){r.i.r.i=this.checked,l(3,r)}function vi(){r.i.r.r=ce(this.value),l(3,r)}function Zt(){r.i.r.g=ce(this.value),l(3,r)}function Yl(){r.i.r.b=ce(this.value),l(3,r)}function pt(){r.i.t.d=ce(this.value),l(3,r)}function hi(){r.i.t.a=ce(this.value),l(3,r)}function gi(){r.i.v.p=ce(this.value),l(3,r)}function bi(){r.i.v.d.v=ce(this.value),l(3,r)}function Jt(){r.i.v.d.g=ce(this.value),l(3,r)}function ki(){r.i.v.o=ce(this.value),l(3,r)}function wi(){r.i.v.m=ce(this.value),l(3,r)}function yi(){r.i.v.b=ce(this.value),l(3,r)}function _t(){r.d.s=this.checked,l(3,r)}function rl(){r.d.t=this.checked,l(3,r)}function al(){r.d.l=et(this),l(3,r)}return t.$$set=Ue=>{"sysinfo"in Ue&&l(0,n=Ue.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,h=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,a,r,c,f,h,i,p,_,d,b,g,$,k,S,M,D,T,N,F,R,H,j,E,L,W,z,q,O,U,X,B,ne,te,Te,me,Ie,De,Re,Ee,$e,ge,pe,ae,fe,oe,J,ie,Ce,x,ue,He,Se,_e,de,le,ve,qe,re,Pe,ai,fi,ci,$t,mi,Qt,pi,_i,di,tt,vi,Zt,Yl,pt,hi,gi,bi,Jt,ki,wi,yi,_t,rl,al]}class hp extends ye{constructor(e){super(),we(this,e,vp,_p,ke,{sysinfo:0},null,[-1,-1,-1,-1])}}function Va(t,e,l){const n=t.slice();return n[20]=e[l],n}function gp(t){let e=he(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&2&&e!==(e=he(n[1].chip,n[1].board)+"")&&G(l,e)},d(n){n&&w(l)}}}function Ka(t){let e,l,n=t[1].apmac+"",i;return{c(){e=m("div"),l=C("AP MAC: "),i=C(n),u(e,"class","my-2")},m(o,a){y(o,e,a),s(e,l),s(e,i)},p(o,a){a&2&&n!==(n=o[1].apmac+"")&&G(i,n)},d(o){o&&w(e)}}}function bp(t){let e;return{c(){e=m("span"),e.textContent="Update consents",u(e,"class","btn-pri-sm")},m(l,n){y(l,e,n)},p:se,d(l){l&&w(e)}}}function Qa(t){let e,l,n,i,o,a=rs(t[1].meter.mfg)+"",r,c,f,p,_=t[1].meter.model+"",d,b,h,g,$=t[1].meter.id+"",k;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=v(),i=m("div"),o=C("Manufacturer: "),r=C(a),c=v(),f=m("div"),p=C("Model: "),d=C(_),b=v(),h=m("div"),g=C("ID: "),k=C($),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(h,"class","my-2"),u(e,"class","cnt")},m(S,M){y(S,e,M),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(e,c),s(e,f),s(f,p),s(f,d),s(e,b),s(e,h),s(h,g),s(h,k)},p(S,M){M&2&&a!==(a=rs(S[1].meter.mfg)+"")&&G(r,a),M&2&&_!==(_=S[1].meter.model+"")&&G(d,_),M&2&&$!==($=S[1].meter.id+"")&&G(k,$)},d(S){S&&w(e)}}}function Za(t){let e,l,n,i,o,a=t[1].net.ip+"",r,c,f,p,_=t[1].net.mask+"",d,b,h,g,$=t[1].net.gw+"",k,S,M,D,T=t[1].net.dns1+"",N,F,R=t[1].net.dns2&&Ja(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=v(),i=m("div"),o=C("IP: "),r=C(a),c=v(),f=m("div"),p=C("Mask: "),d=C(_),b=v(),h=m("div"),g=C("Gateway: "),k=C($),S=v(),M=m("div"),D=C("DNS: "),N=C(T),F=v(),R&&R.c(),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(h,"class","my-2"),u(M,"class","my-2"),u(e,"class","cnt")},m(H,j){y(H,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(e,c),s(e,f),s(f,p),s(f,d),s(e,b),s(e,h),s(h,g),s(h,k),s(e,S),s(e,M),s(M,D),s(M,N),s(M,F),R&&R.m(M,null)},p(H,j){j&2&&a!==(a=H[1].net.ip+"")&&G(r,a),j&2&&_!==(_=H[1].net.mask+"")&&G(d,_),j&2&&$!==($=H[1].net.gw+"")&&G(k,$),j&2&&T!==(T=H[1].net.dns1+"")&&G(N,T),H[1].net.dns2?R?R.p(H,j):(R=Ja(H),R.c(),R.m(M,null)):R&&(R.d(1),R=null)},d(H){H&&w(e),R&&R.d()}}}function Ja(t){let e,l=t[1].net.dns2+"",n;return{c(){e=C("/ "),n=C(l)},m(i,o){y(i,e,o),y(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&G(n,l)},d(i){i&&w(e),i&&w(n)}}}function Xa(t){let e,l,n,i=t[2].tag_name+"",o,a,r,c,f,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name&&xa(t),d=t[1].fwconsent===2&&ef();return{c(){e=m("div"),l=C(`Latest version: `),n=m("a"),o=C(i),r=v(),_&&_.c(),c=v(),d&&d.c(),f=We(),u(n,"href",a=t[2].html_url),u(n,"class","ml-2 text-blue-600 hover:text-blue-800"),u(n,"target","_blank"),u(n,"rel","noreferrer"),u(e,"class","my-2 flex")},m(b,h){y(b,e,h),s(e,l),s(e,n),s(n,o),s(e,r),_&&_.m(e,null),y(b,c,h),d&&d.m(b,h),y(b,f,h),p=!0},p(b,h){(!p||h&4)&&i!==(i=b[2].tag_name+"")&&G(o,i),(!p||h&4&&a!==(a=b[2].html_url))&&u(n,"href",a),(b[1].security==0||b[0].a)&&b[1].fwconsent===1&&b[2]&&b[2].tag_name?_?(_.p(b,h),h&7&&P(_,1)):(_=xa(b),_.c(),P(_,1),_.m(e,null)):_&&(Me(),I(_,1,1,()=>{_=null}),Ae()),b[1].fwconsent===2?d||(d=ef(),d.c(),d.m(f.parentNode,f)):d&&(d.d(1),d=null)},i(b){p||(P(_),p=!0)},o(b){I(_),p=!1},d(b){b&&w(e),_&&_.d(),b&&w(c),d&&d.d(b),b&&w(f)}}}function xa(t){let e,l,n,i,o,a;return n=new lc({}),{c(){e=m("div"),l=m("button"),Z(n.$$.fragment),u(e,"class","flex-none ml-2 text-green-500"),u(e,"title","Install this version")},m(r,c){y(r,e,c),s(e,l),V(n,l,null),i=!0,o||(a=Y(l,"click",t[10]),o=!0)},p:se,i(r){i||(P(n.$$.fragment,r),i=!0)},o(r){I(n.$$.fragment,r),i=!1},d(r){r&&w(e),K(n),o=!1,a()}}}function ef(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',u(e,"class","my-2")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function tf(t){let e,l=as(he(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=as(he(i[1].chip,i[1].board))+"")&&G(n,l)},d(i){i&&w(e)}}}function lf(t){let e,l,n,i,o,a;function r(p,_){return p[4].length==0?wp:kp}let c=r(t),f=c(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=v(),f.c(),gf(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","/firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(e,"class","my-2 flex")},m(p,_){y(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(a=[Y(n,"change",t[13]),Y(l,"submit",t[15])],o=!0)},p(p,_){c===(c=r(p))&&f?f.p(p,_):(f.d(1),f=c(p),f&&(f.c(),f.m(l,null)))},d(p){p&&w(e),t[12](null),f.d(),o=!1,Be(a)}}}function kp(t){let e=t[4][0].name+"",l,n,i;return{c(){l=C(e),n=v(),i=m("button"),i.textContent="Upload",u(i,"type","submit"),u(i,"class","btn-pri-sm float-right")},m(o,a){y(o,l,a),y(o,n,a),y(o,i,a)},p(o,a){a&16&&e!==(e=o[4][0].name+"")&&G(l,e)},d(o){o&&w(l),o&&w(n),o&&w(i)}}}function wp(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(i,o){y(i,e,o),l||(n=Y(e,"click",t[14]),l=!0)},p:se,d(i){i&&w(e),l=!1,n()}}}function nf(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g=t[9],$=[];for(let T=0;T Include Secrets
(SSID, PSK, passwords and tokens)',c=v(),k&&k.c(),f=v(),p=m("form"),_=m("input"),d=v(),D.c(),u(l,"class","text-sm"),u(r,"class","my-1 mx-3 col-span-2"),u(o,"class","grid grid-cols-2"),u(i,"method","get"),u(i,"action","/configfile.cfg"),u(i,"autocomplete","off"),gf(_,"display","none"),u(_,"name","file"),u(_,"type","file"),u(_,"accept",".cfg"),u(p,"action","/configfile"),u(p,"enctype","multipart/form-data"),u(p,"method","post"),u(p,"autocomplete","off"),u(e,"class","cnt")},m(T,N){y(T,e,N),s(e,l),s(e,n),s(e,i),s(i,o);for(let F=0;F<$.length;F+=1)$[F].m(o,null);s(o,a),s(o,r),s(i,c),k&&k.m(i,null),s(e,f),s(e,p),s(p,_),t[16](_),s(p,d),D.m(p,null),b||(h=[Y(_,"change",t[17]),Y(p,"submit",t[19])],b=!0)},p(T,N){if(N&512){g=T[9];let F;for(F=0;F{oe=null}),Ae()),ue&3&&(ne=(x[1].security==0||x[0].a)&&Hn(x[1].board)),ne?J?J.p(x,ue):(J=tf(x),J.c(),J.m(E,te)):J&&(J.d(1),J=null),x[1].security==0||x[0].a?ie?ie.p(x,ue):(ie=lf(x),ie.c(),ie.m(E,null)):ie&&(ie.d(1),ie=null),x[1].security==0||x[0].a?Ce?Ce.p(x,ue):(Ce=nf(x),Ce.c(),Ce.m(e,null)):Ce&&(Ce.d(1),Ce=null);const _e={};ue&32&&(_e.active=x[5]),Ie.$set(_e);const de={};ue&256&&(de.active=x[8]),Re.$set(de)},i(x){Ee||(P(d.$$.fragment,x),P(T.$$.fragment,x),P(oe),P(Ie.$$.fragment,x),P(Re.$$.fragment,x),Ee=!0)},o(x){I(d.$$.fragment,x),I(T.$$.fragment,x),I(oe),I(Ie.$$.fragment,x),I(Re.$$.fragment,x),Ee=!1},d(x){x&&w(e),K(d),pe&&pe.d(),K(T),ae&&ae.d(),fe&&fe.d(),oe&&oe.d(),J&&J.d(),ie&&ie.d(),Ce&&Ce.d(),x&&w(me),K(Ie,x),x&&w(De),K(Re,x),$e=!1,ge()}}}async function Sp(){await(await fetch("/reboot",{method:"POST"})).json()}function Tp(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:"Domoticz",key:"id"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],a={};io.subscribe(F=>{l(2,a=tc(i.version,F)),a||l(2,a=F[0])});function r(){confirm("Do you want to upgrade this device to "+a.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(as(he(i.chip,i.board))))&&(yt.update(F=>(F.upgrading=!0,F)),ec())}const c=function(){confirm("Are you sure you want to reboot the device?")&&(yt.update(F=>(F.booting=!0,F)),Sp())};let f,p=[],_=!1,d,b=[],h=!1;to();function g(F){os[F?"unshift":"push"](()=>{f=F,l(3,f)})}function $(){p=this.files,l(4,p)}const k=()=>{f.click()},S=()=>l(5,_=!0);function M(F){os[F?"unshift":"push"](()=>{d=F,l(6,d)})}function D(){b=this.files,l(7,b)}const T=()=>{d.click()},N=()=>l(8,h=!0);return t.$$set=F=>{"data"in F&&l(0,n=F.data),"sysinfo"in F&&l(1,i=F.sysinfo)},[n,i,a,f,p,_,d,b,h,o,r,c,g,$,k,S,M,D,T,N]}class Pp extends ye{constructor(e){super(),we(this,e,Tp,Cp,ke,{data:0,sysinfo:1})}}function uf(t){let e,l,n=he(t[0],7)+"",i,o,a=he(t[0],5)+"",r,c,f=he(t[0],4)+"",p,_,d=he(t[0],3)+"",b,h,g,$,k=he(t[0],2)+"",S,M,D=he(t[0],1)+"",T,N,F=he(t[0],0)+"",R,H,j,E,L=he(t[0],101)+"",W,z,q=he(t[0],100)+"",O;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=m("option"),r=C(a),c=m("option"),p=C(f),_=m("option"),b=C(d),h=v(),g=m("optgroup"),$=m("option"),S=C(k),M=m("option"),T=C(D),N=m("option"),R=C(F),H=v(),j=m("optgroup"),E=m("option"),W=C(L),z=m("option"),O=C(q),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,_.__value=3,_.value=_.__value,u(e,"label","amsleser.no"),$.__value=2,$.value=$.__value,M.__value=1,M.value=M.__value,N.__value=0,N.value=N.__value,u(g,"label","Custom hardware"),E.__value=101,E.value=E.__value,z.__value=100,z.value=z.__value,u(j,"label","Generic hardware")},m(U,X){y(U,e,X),s(e,l),s(l,i),s(e,o),s(o,r),s(e,c),s(c,p),s(e,_),s(_,b),y(U,h,X),y(U,g,X),s(g,$),s($,S),s(g,M),s(M,T),s(g,N),s(N,R),y(U,H,X),y(U,j,X),s(j,E),s(E,W),s(j,z),s(z,O)},p(U,X){X&1&&n!==(n=he(U[0],7)+"")&&G(i,n),X&1&&a!==(a=he(U[0],5)+"")&&G(r,a),X&1&&f!==(f=he(U[0],4)+"")&&G(p,f),X&1&&d!==(d=he(U[0],3)+"")&&G(b,d),X&1&&k!==(k=he(U[0],2)+"")&&G(S,k),X&1&&D!==(D=he(U[0],1)+"")&&G(T,D),X&1&&F!==(F=he(U[0],0)+"")&&G(R,F),X&1&&L!==(L=he(U[0],101)+"")&&G(W,L),X&1&&q!==(q=he(U[0],100)+"")&&G(O,q)},d(U){U&&w(e),U&&w(h),U&&w(g),U&&w(H),U&&w(j)}}}function rf(t){let e,l,n=he(t[0],201)+"",i,o,a=he(t[0],202)+"",r,c,f=he(t[0],203)+"",p,_,d=he(t[0],200)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=m("option"),r=C(a),c=m("option"),p=C(f),_=m("option"),b=C(d),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,_.__value=200,_.value=_.__value,u(e,"label","Generic hardware")},m(h,g){y(h,e,g),s(e,l),s(l,i),s(e,o),s(o,r),s(e,c),s(c,p),s(e,_),s(_,b)},p(h,g){g&1&&n!==(n=he(h[0],201)+"")&&G(i,n),g&1&&a!==(a=he(h[0],202)+"")&&G(r,a),g&1&&f!==(f=he(h[0],203)+"")&&G(p,f),g&1&&d!==(d=he(h[0],200)+"")&&G(b,d)},d(h){h&&w(e)}}}function af(t){let e,l,n=he(t[0],7)+"",i,o,a=he(t[0],6)+"",r,c,f=he(t[0],5)+"",p,_,d,b,h=he(t[0],51)+"",g,$,k=he(t[0],50)+"",S;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=m("option"),r=C(a),c=m("option"),p=C(f),_=v(),d=m("optgroup"),b=m("option"),g=C(h),$=m("option"),S=C(k),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,u(e,"label","amsleser.no"),b.__value=51,b.value=b.__value,$.__value=50,$.value=$.__value,u(d,"label","Generic hardware")},m(M,D){y(M,e,D),s(e,l),s(l,i),s(e,o),s(o,r),s(e,c),s(c,p),y(M,_,D),y(M,d,D),s(d,b),s(b,g),s(d,$),s($,S)},p(M,D){D&1&&n!==(n=he(M[0],7)+"")&&G(i,n),D&1&&a!==(a=he(M[0],6)+"")&&G(r,a),D&1&&f!==(f=he(M[0],5)+"")&&G(p,f),D&1&&h!==(h=he(M[0],51)+"")&&G(g,h),D&1&&k!==(k=he(M[0],50)+"")&&G(S,k)},d(M){M&&w(e),M&&w(_),M&&w(d)}}}function ff(t){let e,l,n=he(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=C(n),l.__value=200,l.value=l.__value,u(e,"label","Generic hardware")},m(o,a){y(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=he(o[0],200)+"")&&G(i,n)},d(o){o&&w(e)}}}function Mp(t){let e,l,n,i,o,a,r=t[0]=="esp8266"&&uf(t),c=t[0]=="esp32"&&rf(t),f=t[0]=="esp32s2"&&af(t),p=t[0]=="esp32solo"&&ff(t);return{c(){e=m("option"),l=v(),r&&r.c(),n=v(),c&&c.c(),i=v(),f&&f.c(),o=v(),p&&p.c(),a=We(),e.__value=-1,e.value=e.__value},m(_,d){y(_,e,d),y(_,l,d),r&&r.m(_,d),y(_,n,d),c&&c.m(_,d),y(_,i,d),f&&f.m(_,d),y(_,o,d),p&&p.m(_,d),y(_,a,d)},p(_,[d]){_[0]=="esp8266"?r?r.p(_,d):(r=uf(_),r.c(),r.m(n.parentNode,n)):r&&(r.d(1),r=null),_[0]=="esp32"?c?c.p(_,d):(c=rf(_),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null),_[0]=="esp32s2"?f?f.p(_,d):(f=af(_),f.c(),f.m(o.parentNode,o)):f&&(f.d(1),f=null),_[0]=="esp32solo"?p?p.p(_,d):(p=ff(_),p.c(),p.m(a.parentNode,a)):p&&(p.d(1),p=null)},i:se,o:se,d(_){_&&w(e),_&&w(l),r&&r.d(_),_&&w(n),c&&c.d(_),_&&w(i),f&&f.d(_),_&&w(o),p&&p.d(_),_&&w(a)}}}function Ap(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Np extends ye{constructor(e){super(),we(this,e,Ap,Mp,ke,{chip:0})}}function cf(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",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function mf(t){let e,l,n,i,o,a,r;return a=new sc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=C("HAN GPIO"),n=m("br"),i=v(),o=m("select"),Z(a.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(e,"class","my-3")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),V(a,o,null),r=!0},p(c,f){const p={};f&1&&(p.chip=c[0].chip),a.$set(p)},i(c){r||(P(a.$$.fragment,c),r=!0)},o(c){I(a.$$.fragment,c),r=!1},d(c){c&&w(e),K(a)}}}function Ip(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S,M,D,T,N,F,R,H,j,E,L,W,z=t[0].usrcfg&&cf();h=new Np({props:{chip:t[0].chip}});let q=t[0].board&&t[0].board>20&&mf(t);return j=new gt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=v(),a=m("strong"),a.textContent="Initial configuration",r=v(),z&&z.c(),c=v(),f=m("div"),p=C("Board type"),_=m("br"),d=v(),b=m("select"),Z(h.$$.fragment),g=v(),q&&q.c(),$=v(),k=m("div"),S=m("label"),M=m("input"),D=C(" Clear all other configuration"),T=v(),N=m("div"),N.innerHTML='',F=v(),R=m("span"),R.textContent="\xA0",H=v(),Z(j.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(a,"class","text-sm"),u(b,"name","vb"),u(b,"class","in-s"),t[0].board===void 0&&Ge(()=>t[4].call(b)),u(f,"class","my-3"),u(M,"type","checkbox"),u(M,"name","vr"),M.__value="true",M.value=M.__value,u(M,"class","rounded mb-1"),u(k,"class","my-3"),u(N,"class","my-3"),u(R,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(O,U){y(O,e,U),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),z&&z.m(n,null),s(n,c),s(n,f),s(f,p),s(f,_),s(f,d),s(f,b),V(h,b,null),Fe(b,t[0].board),s(n,g),q&&q.m(n,null),s(n,$),s(n,k),s(k,S),s(S,M),M.checked=t[2],s(S,D),s(n,T),s(n,N),s(n,F),s(n,R),y(O,H,U),V(j,O,U),E=!0,L||(W=[Y(b,"change",t[4]),Y(M,"change",t[5]),Y(n,"submit",fs(t[3]))],L=!0)},p(O,[U]){O[0].usrcfg?z||(z=cf(),z.c(),z.m(n,c)):z&&(z.d(1),z=null);const X={};U&1&&(X.chip=O[0].chip),h.$set(X),U&1&&Fe(b,O[0].board),O[0].board&&O[0].board>20?q?(q.p(O,U),U&1&&P(q,1)):(q=mf(O),q.c(),P(q,1),q.m(n,$)):q&&(Me(),I(q,1,1,()=>{q=null}),Ae()),U&4&&(M.checked=O[2]);const B={};U&2&&(B.active=O[1]),j.$set(B)},i(O){E||(P(h.$$.fragment,O),P(q),P(j.$$.fragment,O),E=!0)},o(O){I(h.$$.fragment,O),I(q),I(j.$$.fragment,O),E=!1},d(O){O&&w(e),z&&z.d(),K(h),q&&q.d(),O&&w(H),K(j,O),L=!1,Be(W)}}}function Dp(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 h of p){const[g,$]=h;_.append(g,$)}let b=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),yt.update(h=>(h.vndcfg=b.success,h.booting=b.reboot,h)),Un(n.usrcfg?"/":"/setup")}let a=!1;function r(){n.board=et(this),l(0,n)}function c(){a=this.checked,l(2,a),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,a=!n.usrcfg)},[n,i,a,o,r,c]}class Ep extends ye{constructor(e){super(),we(this,e,Dp,Ip,ke,{sysinfo:0})}}function pf(t){let e,l,n,i,o,a,r,c;return r=new oc({}),{c(){e=m("br"),l=v(),n=m("div"),i=m("input"),o=v(),a=m("select"),Z(r.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=t[1],u(a,"name","su"),u(a,"class","in-l"),a.required=t[1],u(n,"class","flex")},m(f,p){y(f,e,p),y(f,l,p),y(f,n,p),s(n,i),s(n,o),s(n,a),V(r,a,null),c=!0},p(f,p){(!c||p&2)&&(i.required=f[1]),(!c||p&2)&&(a.required=f[1])},i(f){c||(P(r.$$.fragment,f),c=!0)},o(f){I(r.$$.fragment,f),c=!1},d(f){f&&w(e),f&&w(l),f&&w(n),K(r)}}}function _f(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
DNS
`,u(e,"class","my-3 flex")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Fp(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S,M,D,T,N,F,R,H,j,E,L,W=t[1]&&pf(t),z=t[1]&&_f();return H=new gt({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=v(),a=m("strong"),a.textContent="Setup",r=v(),c=m("div"),c.innerHTML=`SSID
`,f=v(),p=m("div"),p.innerHTML=`PSK
`,_=v(),d=m("div"),b=C(`Hostname - `),h=m("input"),g=v(),$=m("div"),k=m("label"),S=m("input"),M=C(" Static IP"),D=v(),W&&W.c(),T=v(),z&&z.c(),N=v(),F=m("div"),F.innerHTML='',R=v(),Z(H.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(a,"class","text-sm"),u(c,"class","my-3"),u(p,"class","my-3"),u(h,"name","sh"),u(h,"type","text"),u(h,"class","in-s"),u(h,"maxlength","32"),u(h,"pattern","[a-z0-9_-]+"),u(h,"placeholder","Optional, ex.: ams-reader"),u(h,"autocomplete","off"),u(S,"type","checkbox"),u(S,"name","sm"),S.__value="static",S.value=S.__value,u(S,"class","rounded mb-1"),u($,"class","my-3"),u(F,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(q,O){y(q,e,O),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),s(n,c),s(n,f),s(n,p),s(n,_),s(n,d),s(d,b),s(d,h),Q(h,t[0].hostname),s(n,g),s(n,$),s($,k),s(k,S),S.checked=t[1],s(k,M),s($,D),W&&W.m($,null),s(n,T),z&&z.m(n,null),s(n,N),s(n,F),y(q,R,O),V(H,q,O),j=!0,E||(L=[Y(h,"input",t[4]),Y(S,"change",t[5]),Y(n,"submit",fs(t[3]))],E=!0)},p(q,[O]){O&1&&h.value!==q[0].hostname&&Q(h,q[0].hostname),O&2&&(S.checked=q[1]),q[1]?W?(W.p(q,O),O&2&&P(W,1)):(W=pf(q),W.c(),P(W,1),W.m($,null)):W&&(Me(),I(W,1,1,()=>{W=null}),Ae()),q[1]?z||(z=_f(),z.c(),z.m(n,N)):z&&(z.d(1),z=null);const U={};O&4&&(U.active=q[2]),H.$set(U)},i(q){j||(P(W),P(H.$$.fragment,q),j=!0)},o(q){I(W),I(H.$$.fragment,q),j=!1},d(q){q&&w(e),W&&W.d(),z&&z.d(),q&&w(R),K(H,q),E=!1,Be(L)}}}function Rp(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,a=0;function r(){var _="";a++;var d=function(){setTimeout(r,1e3)};if(n.net.ip&&a%3==0){if(n.net.ip=="0.0.0.0"){d();return}_="http://"+n.net.ip}else n.hostname&&a%3==1?_="http://"+n.hostname:n.hostname&&a%3==2?_="http://"+n.hostname+".local":_="";console&&console.log("Trying url "+_),yt.update(h=>(h.trying=_,h));var b=new XMLHttpRequest;b.timeout=5e3,b.addEventListener("abort",d),b.addEventListener("error",d),b.addEventListener("timeout",d),b.addEventListener("load",function(h){window.location.href=_||"/"}),b.open("GET",_+"/is-alive",!0),b.send()}async function c(_){l(2,o=!0);const d=new FormData(_.target),b=new URLSearchParams;for(let $ of d){const[k,S]=$;b.append(k,S)}let g=await(await fetch("/save",{method:"POST",body:b})).json();l(2,o=!1),yt.update($=>($.hostname=d.get("sh"),$.usrcfg=g.success,$.booting=g.reboot,i&&($.net.ip=d.get("si"),$.net.mask=d.get("su"),$.net.gw=d.get("sg"),$.net.dns1=d.get("sd")),setTimeout(r,5e3),$))}function f(){n.hostname=this.value,l(0,n)}function p(){i=this.checked,l(1,i)}return t.$$set=_=>{"sysinfo"in _&&l(0,n=_.sysinfo)},[n,i,o,c,f,p]}class Lp extends ye{constructor(e){super(),we(this,e,Rp,Fp,ke,{sysinfo:0})}}function Op(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k;return h=new gt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=C("Upload "),o=C(t[1]),a=v(),r=m("p"),r.textContent="Select a suitable file and click upload",c=v(),f=m("form"),p=m("input"),_=v(),d=m("div"),d.innerHTML='',b=v(),Z(h.$$.fragment),u(r,"class","mb-4"),u(p,"name","file"),u(p,"type","file"),u(d,"class","w-full text-right mt-4"),u(f,"action",t[0]),u(f,"enctype","multipart/form-data"),u(f,"method","post"),u(f,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(S,M){y(S,e,M),s(e,l),s(l,n),s(n,i),s(n,o),s(l,a),s(l,r),s(l,c),s(l,f),s(f,p),s(f,_),s(f,d),y(S,b,M),V(h,S,M),g=!0,$||(k=Y(f,"submit",t[3]),$=!0)},p(S,[M]){(!g||M&2)&&G(o,S[1]),(!g||M&1)&&u(f,"action",S[0]);const D={};M&4&&(D.active=S[2]),h.$set(D)},i(S){g||(P(h.$$.fragment,S),g=!0)},o(S){I(h.$$.fragment,S),g=!1},d(S){S&&w(e),S&&w(b),K(h,S),$=!1,k()}}}function qp(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const a=()=>l(2,o=!0);return t.$$set=r=>{"action"in r&&l(0,n=r.action),"title"in r&&l(1,i=r.title)},[n,i,o,a]}class so extends ye{constructor(e){super(),we(this,e,qp,Op,ke,{action:0,title:1})}}function Up(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S,M,D,T,N,F,R,H,j,E,L,W,z,q;return L=new gt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=v(),a=m("hr"),r=v(),c=m("div"),f=C("Enable one-click upgrade? (implies data collection)"),p=m("br"),_=v(),d=m("a"),b=C("Read more"),h=m("br"),g=v(),$=m("label"),k=m("input"),M=C(" Yes"),D=m("label"),T=m("input"),F=C(" No"),R=m("br"),H=v(),j=m("div"),j.innerHTML='',E=v(),Z(L.$$.fragment),u(d,"href",Lt("Data-collection-on-one-click-firmware-upgrade")),u(d,"target","_blank"),u(d,"class","text-blue-600 hover:text-blue-800"),u(k,"type","radio"),u(k,"name","sf"),k.value=1,k.checked=S=t[0].fwconsent===1,u(k,"class","rounded m-2"),k.required=!0,u(T,"type","radio"),u(T,"name","sf"),T.value=2,T.checked=N=t[0].fwconsent===2,u(T,"class","rounded m-2"),T.required=!0,u(c,"class","my-3"),u(j,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(O,U){y(O,e,U),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),s(n,c),s(c,f),s(c,p),s(c,_),s(c,d),s(d,b),s(c,h),s(c,g),s(c,$),s($,k),s($,M),s(c,D),s(D,T),s(D,F),s(c,R),s(n,H),s(n,j),y(O,E,U),V(L,O,U),W=!0,z||(q=Y(n,"submit",fs(t[2])),z=!0)},p(O,[U]){(!W||U&1&&S!==(S=O[0].fwconsent===1))&&(k.checked=S),(!W||U&1&&N!==(N=O[0].fwconsent===2))&&(T.checked=N);const X={};U&2&&(X.active=O[1]),L.$set(X)},i(O){W||(P(L.$$.fragment,O),W=!0)},o(O){I(L.$$.fragment,O),W=!1},d(O){O&&w(e),O&&w(E),K(L,O),z=!1,q()}}}function Hp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(a){l(1,i=!0);const r=new FormData(a.target),c=new URLSearchParams;for(let _ of r){const[d,b]=_;c.append(d,b)}let p=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),yt.update(_=>(_.fwconsent=r.sf===!0?1:r.sf===!1?2:0,_.booting=p.reboot,_)),Un("/")}return t.$$set=a=>{"sysinfo"in a&&l(0,n=a.sysinfo)},[n,i,o]}class jp extends ye{constructor(e){super(),we(this,e,Hp,Up,ke,{sysinfo:0})}}function Wp(t){let e,l;return e=new Gm({props:{data:t[1],sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function zp(t){let e,l;return e=new hp({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Bp(t){let e,l;return e=new Pp({props:{sysinfo:t[0],data:t[1]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Gp(t){let e,l;return e=new so({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Yp(t){let e,l;return e=new so({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Vp(t){let e,l;return e=new so({props:{title:"private key",action:"/mqtt-key"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Kp(t){let e,l;return e=new jp({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Qp(t){let e,l;return e=new Lp({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Zp(t){let e,l;return e=new Ep({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Jp(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S,M,D;return e=new sm({props:{data:t[1]}}),n=new ol({props:{path:"/",$$slots:{default:[Wp]},$$scope:{ctx:t}}}),o=new ol({props:{path:"/configuration",$$slots:{default:[zp]},$$scope:{ctx:t}}}),r=new ol({props:{path:"/status",$$slots:{default:[Bp]},$$scope:{ctx:t}}}),f=new ol({props:{path:"/mqtt-ca",$$slots:{default:[Gp]},$$scope:{ctx:t}}}),_=new ol({props:{path:"/mqtt-cert",$$slots:{default:[Yp]},$$scope:{ctx:t}}}),b=new ol({props:{path:"/mqtt-key",$$slots:{default:[Vp]},$$scope:{ctx:t}}}),g=new ol({props:{path:"/consent",$$slots:{default:[Kp]},$$scope:{ctx:t}}}),k=new ol({props:{path:"/setup",$$slots:{default:[Qp]},$$scope:{ctx:t}}}),M=new ol({props:{path:"/vendor",$$slots:{default:[Zp]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment),l=v(),Z(n.$$.fragment),i=v(),Z(o.$$.fragment),a=v(),Z(r.$$.fragment),c=v(),Z(f.$$.fragment),p=v(),Z(_.$$.fragment),d=v(),Z(b.$$.fragment),h=v(),Z(g.$$.fragment),$=v(),Z(k.$$.fragment),S=v(),Z(M.$$.fragment)},m(T,N){V(e,T,N),y(T,l,N),V(n,T,N),y(T,i,N),V(o,T,N),y(T,a,N),V(r,T,N),y(T,c,N),V(f,T,N),y(T,p,N),V(_,T,N),y(T,d,N),V(b,T,N),y(T,h,N),V(g,T,N),y(T,$,N),V(k,T,N),y(T,S,N),V(M,T,N),D=!0},p(T,N){const F={};N&2&&(F.data=T[1]),e.$set(F);const R={};N&7&&(R.$$scope={dirty:N,ctx:T}),n.$set(R);const H={};N&5&&(H.$$scope={dirty:N,ctx:T}),o.$set(H);const j={};N&7&&(j.$$scope={dirty:N,ctx:T}),r.$set(j);const E={};N&4&&(E.$$scope={dirty:N,ctx:T}),f.$set(E);const L={};N&4&&(L.$$scope={dirty:N,ctx:T}),_.$set(L);const W={};N&4&&(W.$$scope={dirty:N,ctx:T}),b.$set(W);const z={};N&5&&(z.$$scope={dirty:N,ctx:T}),g.$set(z);const q={};N&5&&(q.$$scope={dirty:N,ctx:T}),k.$set(q);const O={};N&5&&(O.$$scope={dirty:N,ctx:T}),M.$set(O)},i(T){D||(P(e.$$.fragment,T),P(n.$$.fragment,T),P(o.$$.fragment,T),P(r.$$.fragment,T),P(f.$$.fragment,T),P(_.$$.fragment,T),P(b.$$.fragment,T),P(g.$$.fragment,T),P(k.$$.fragment,T),P(M.$$.fragment,T),D=!0)},o(T){I(e.$$.fragment,T),I(n.$$.fragment,T),I(o.$$.fragment,T),I(r.$$.fragment,T),I(f.$$.fragment,T),I(_.$$.fragment,T),I(b.$$.fragment,T),I(g.$$.fragment,T),I(k.$$.fragment,T),I(M.$$.fragment,T),D=!1},d(T){K(e,T),T&&w(l),K(n,T),T&&w(i),K(o,T),T&&w(a),K(r,T),T&&w(c),K(f,T),T&&w(p),K(_,T),T&&w(d),K(b,T),T&&w(h),K(g,T),T&&w($),K(k,T),T&&w(S),K(M,T)}}}function Xp(t){let e,l,n,i;const o=[t0,e0],a=[];function r(c,f){return c[0].trying?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let p=e;e=r(c),e===p?a[e].p(c,f):(Me(),I(a[p],1,1,()=>{a[p]=null}),Ae(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),P(l,1),l.m(n.parentNode,n))},i(c){i||(P(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function xp(t){let e,l;return e=new gt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function e0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function t0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function l0(t){let e,l,n,i,o,a;l=new jf({props:{$$slots:{default:[Jp]},$$scope:{ctx:t}}});const r=[xp,Xp],c=[];function f(p,_){return p[0].upgrading?0:p[0].booting?1:-1}return~(i=f(t))&&(o=c[i]=r[i](t)),{c(){e=m("div"),Z(l.$$.fragment),n=v(),o&&o.c(),u(e,"class","container mx-auto m-3")},m(p,_){y(p,e,_),V(l,e,null),s(e,n),~i&&c[i].m(e,null),a=!0},p(p,[_]){const d={};_&7&&(d.$$scope={dirty:_,ctx:p}),l.$set(d);let b=i;i=f(p),i===b?~i&&c[i].p(p,_):(o&&(Me(),I(c[b],1,1,()=>{c[b]=null}),Ae()),~i?(o=c[i],o?o.p(p,_):(o=c[i]=r[i](p),o.c()),P(o,1),o.m(e,null)):o=null)},i(p){a||(P(l.$$.fragment,p),P(o),a=!0)},o(p){I(l.$$.fragment,p),I(o),a=!1},d(p){p&&w(e),K(l),~i&&c[i].d()}}}function n0(t,e,l){let n={};yt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?Un("/vendor"):n.usrcfg===!1?Un("/setup"):n.fwconsent===0&&Un("/consent")}),to();let i={};return S1.subscribe(o=>{l(1,i=o)}),[n,i]}class i0 extends ye{constructor(e){super(),we(this,e,n0,l0,ke,{})}}new i0({target:document.getElementById("app")}); + `),h=m("input"),g=v(),$=m("div"),k=m("label"),S=m("input"),M=C(" Static IP"),D=v(),W&&W.c(),T=v(),z&&z.c(),N=v(),F=m("div"),F.innerHTML='',R=v(),Z(H.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(a,"class","text-sm"),u(c,"class","my-3"),u(p,"class","my-3"),u(h,"name","sh"),u(h,"type","text"),u(h,"class","in-s"),u(h,"maxlength","32"),u(h,"pattern","[a-z0-9_-]+"),u(h,"placeholder","Optional, ex.: ams-reader"),u(h,"autocomplete","off"),u(S,"type","checkbox"),u(S,"name","sm"),S.__value="static",S.value=S.__value,u(S,"class","rounded mb-1"),u($,"class","my-3"),u(F,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(q,O){y(q,e,O),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),s(n,c),s(n,f),s(n,p),s(n,_),s(n,d),s(d,b),s(d,h),Q(h,t[0].hostname),s(n,g),s(n,$),s($,k),s(k,S),S.checked=t[1],s(k,M),s($,D),W&&W.m($,null),s(n,T),z&&z.m(n,null),s(n,N),s(n,F),y(q,R,O),V(H,q,O),j=!0,E||(L=[Y(h,"input",t[4]),Y(S,"change",t[5]),Y(n,"submit",fs(t[3]))],E=!0)},p(q,[O]){O&1&&h.value!==q[0].hostname&&Q(h,q[0].hostname),O&2&&(S.checked=q[1]),q[1]?W?(W.p(q,O),O&2&&P(W,1)):(W=pf(q),W.c(),P(W,1),W.m($,null)):W&&(Me(),I(W,1,1,()=>{W=null}),Ae()),q[1]?z||(z=_f(),z.c(),z.m(n,N)):z&&(z.d(1),z=null);const U={};O&4&&(U.active=q[2]),H.$set(U)},i(q){j||(P(W),P(H.$$.fragment,q),j=!0)},o(q){I(W),I(H.$$.fragment,q),j=!1},d(q){q&&w(e),W&&W.d(),z&&z.d(),q&&w(R),K(H,q),E=!1,Be(L)}}}function Rp(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,a=0;function r(){var _="";a++;var d=function(){setTimeout(r,1e3)};if(n.net.ip&&a%3==0){if(!n.net.ip){d();return}_="http://"+n.net.ip}else n.hostname&&a%3==1?_="http://"+n.hostname:n.hostname&&a%3==2?_="http://"+n.hostname+".local":_="";console&&console.log("Trying url "+_),yt.update(h=>(h.trying=_,h));var b=new XMLHttpRequest;b.timeout=5e3,b.addEventListener("abort",d),b.addEventListener("error",d),b.addEventListener("timeout",d),b.addEventListener("load",function(h){window.location.href=_||"/"}),b.open("GET",_+"/is-alive",!0),b.send()}async function c(_){l(2,o=!0);const d=new FormData(_.target),b=new URLSearchParams;for(let $ of d){const[k,S]=$;b.append(k,S)}let g=await(await fetch("/save",{method:"POST",body:b})).json();l(2,o=!1),yt.update($=>($.hostname=d.get("sh"),$.usrcfg=g.success,$.booting=g.reboot,i&&($.net.ip=d.get("si"),$.net.mask=d.get("su"),$.net.gw=d.get("sg"),$.net.dns1=d.get("sd")),setTimeout(r,5e3),$))}function f(){n.hostname=this.value,l(0,n)}function p(){i=this.checked,l(1,i)}return t.$$set=_=>{"sysinfo"in _&&l(0,n=_.sysinfo)},[n,i,o,c,f,p]}class Lp extends ye{constructor(e){super(),we(this,e,Rp,Fp,ke,{sysinfo:0})}}function Op(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k;return h=new gt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=C("Upload "),o=C(t[1]),a=v(),r=m("p"),r.textContent="Select a suitable file and click upload",c=v(),f=m("form"),p=m("input"),_=v(),d=m("div"),d.innerHTML='',b=v(),Z(h.$$.fragment),u(r,"class","mb-4"),u(p,"name","file"),u(p,"type","file"),u(d,"class","w-full text-right mt-4"),u(f,"action",t[0]),u(f,"enctype","multipart/form-data"),u(f,"method","post"),u(f,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(S,M){y(S,e,M),s(e,l),s(l,n),s(n,i),s(n,o),s(l,a),s(l,r),s(l,c),s(l,f),s(f,p),s(f,_),s(f,d),y(S,b,M),V(h,S,M),g=!0,$||(k=Y(f,"submit",t[3]),$=!0)},p(S,[M]){(!g||M&2)&&G(o,S[1]),(!g||M&1)&&u(f,"action",S[0]);const D={};M&4&&(D.active=S[2]),h.$set(D)},i(S){g||(P(h.$$.fragment,S),g=!0)},o(S){I(h.$$.fragment,S),g=!1},d(S){S&&w(e),S&&w(b),K(h,S),$=!1,k()}}}function qp(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const a=()=>l(2,o=!0);return t.$$set=r=>{"action"in r&&l(0,n=r.action),"title"in r&&l(1,i=r.title)},[n,i,o,a]}class so extends ye{constructor(e){super(),we(this,e,qp,Op,ke,{action:0,title:1})}}function Up(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S,M,D,T,N,F,R,H,j,E,L,W,z,q;return L=new gt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=v(),a=m("hr"),r=v(),c=m("div"),f=C("Enable one-click upgrade? (implies data collection)"),p=m("br"),_=v(),d=m("a"),b=C("Read more"),h=m("br"),g=v(),$=m("label"),k=m("input"),M=C(" Yes"),D=m("label"),T=m("input"),F=C(" No"),R=m("br"),H=v(),j=m("div"),j.innerHTML='',E=v(),Z(L.$$.fragment),u(d,"href",Lt("Data-collection-on-one-click-firmware-upgrade")),u(d,"target","_blank"),u(d,"class","text-blue-600 hover:text-blue-800"),u(k,"type","radio"),u(k,"name","sf"),k.value=1,k.checked=S=t[0].fwconsent===1,u(k,"class","rounded m-2"),k.required=!0,u(T,"type","radio"),u(T,"name","sf"),T.value=2,T.checked=N=t[0].fwconsent===2,u(T,"class","rounded m-2"),T.required=!0,u(c,"class","my-3"),u(j,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(O,U){y(O,e,U),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),s(n,c),s(c,f),s(c,p),s(c,_),s(c,d),s(d,b),s(c,h),s(c,g),s(c,$),s($,k),s($,M),s(c,D),s(D,T),s(D,F),s(c,R),s(n,H),s(n,j),y(O,E,U),V(L,O,U),W=!0,z||(q=Y(n,"submit",fs(t[2])),z=!0)},p(O,[U]){(!W||U&1&&S!==(S=O[0].fwconsent===1))&&(k.checked=S),(!W||U&1&&N!==(N=O[0].fwconsent===2))&&(T.checked=N);const X={};U&2&&(X.active=O[1]),L.$set(X)},i(O){W||(P(L.$$.fragment,O),W=!0)},o(O){I(L.$$.fragment,O),W=!1},d(O){O&&w(e),O&&w(E),K(L,O),z=!1,q()}}}function Hp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(a){l(1,i=!0);const r=new FormData(a.target),c=new URLSearchParams;for(let _ of r){const[d,b]=_;c.append(d,b)}let p=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),yt.update(_=>(_.fwconsent=r.sf===!0?1:r.sf===!1?2:0,_.booting=p.reboot,_)),Un("/")}return t.$$set=a=>{"sysinfo"in a&&l(0,n=a.sysinfo)},[n,i,o]}class jp extends ye{constructor(e){super(),we(this,e,Hp,Up,ke,{sysinfo:0})}}function Wp(t){let e,l;return e=new Gm({props:{data:t[1],sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function zp(t){let e,l;return e=new hp({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Bp(t){let e,l;return e=new Pp({props:{sysinfo:t[0],data:t[1]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Gp(t){let e,l;return e=new so({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Yp(t){let e,l;return e=new so({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Vp(t){let e,l;return e=new so({props:{title:"private key",action:"/mqtt-key"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Kp(t){let e,l;return e=new jp({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Qp(t){let e,l;return e=new Lp({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Zp(t){let e,l;return e=new Ep({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Jp(t){let e,l,n,i,o,a,r,c,f,p,_,d,b,h,g,$,k,S,M,D;return e=new sm({props:{data:t[1]}}),n=new ol({props:{path:"/",$$slots:{default:[Wp]},$$scope:{ctx:t}}}),o=new ol({props:{path:"/configuration",$$slots:{default:[zp]},$$scope:{ctx:t}}}),r=new ol({props:{path:"/status",$$slots:{default:[Bp]},$$scope:{ctx:t}}}),f=new ol({props:{path:"/mqtt-ca",$$slots:{default:[Gp]},$$scope:{ctx:t}}}),_=new ol({props:{path:"/mqtt-cert",$$slots:{default:[Yp]},$$scope:{ctx:t}}}),b=new ol({props:{path:"/mqtt-key",$$slots:{default:[Vp]},$$scope:{ctx:t}}}),g=new ol({props:{path:"/consent",$$slots:{default:[Kp]},$$scope:{ctx:t}}}),k=new ol({props:{path:"/setup",$$slots:{default:[Qp]},$$scope:{ctx:t}}}),M=new ol({props:{path:"/vendor",$$slots:{default:[Zp]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment),l=v(),Z(n.$$.fragment),i=v(),Z(o.$$.fragment),a=v(),Z(r.$$.fragment),c=v(),Z(f.$$.fragment),p=v(),Z(_.$$.fragment),d=v(),Z(b.$$.fragment),h=v(),Z(g.$$.fragment),$=v(),Z(k.$$.fragment),S=v(),Z(M.$$.fragment)},m(T,N){V(e,T,N),y(T,l,N),V(n,T,N),y(T,i,N),V(o,T,N),y(T,a,N),V(r,T,N),y(T,c,N),V(f,T,N),y(T,p,N),V(_,T,N),y(T,d,N),V(b,T,N),y(T,h,N),V(g,T,N),y(T,$,N),V(k,T,N),y(T,S,N),V(M,T,N),D=!0},p(T,N){const F={};N&2&&(F.data=T[1]),e.$set(F);const R={};N&7&&(R.$$scope={dirty:N,ctx:T}),n.$set(R);const H={};N&5&&(H.$$scope={dirty:N,ctx:T}),o.$set(H);const j={};N&7&&(j.$$scope={dirty:N,ctx:T}),r.$set(j);const E={};N&4&&(E.$$scope={dirty:N,ctx:T}),f.$set(E);const L={};N&4&&(L.$$scope={dirty:N,ctx:T}),_.$set(L);const W={};N&4&&(W.$$scope={dirty:N,ctx:T}),b.$set(W);const z={};N&5&&(z.$$scope={dirty:N,ctx:T}),g.$set(z);const q={};N&5&&(q.$$scope={dirty:N,ctx:T}),k.$set(q);const O={};N&5&&(O.$$scope={dirty:N,ctx:T}),M.$set(O)},i(T){D||(P(e.$$.fragment,T),P(n.$$.fragment,T),P(o.$$.fragment,T),P(r.$$.fragment,T),P(f.$$.fragment,T),P(_.$$.fragment,T),P(b.$$.fragment,T),P(g.$$.fragment,T),P(k.$$.fragment,T),P(M.$$.fragment,T),D=!0)},o(T){I(e.$$.fragment,T),I(n.$$.fragment,T),I(o.$$.fragment,T),I(r.$$.fragment,T),I(f.$$.fragment,T),I(_.$$.fragment,T),I(b.$$.fragment,T),I(g.$$.fragment,T),I(k.$$.fragment,T),I(M.$$.fragment,T),D=!1},d(T){K(e,T),T&&w(l),K(n,T),T&&w(i),K(o,T),T&&w(a),K(r,T),T&&w(c),K(f,T),T&&w(p),K(_,T),T&&w(d),K(b,T),T&&w(h),K(g,T),T&&w($),K(k,T),T&&w(S),K(M,T)}}}function Xp(t){let e,l,n,i;const o=[t0,e0],a=[];function r(c,f){return c[0].trying?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let p=e;e=r(c),e===p?a[e].p(c,f):(Me(),I(a[p],1,1,()=>{a[p]=null}),Ae(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),P(l,1),l.m(n.parentNode,n))},i(c){i||(P(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function xp(t){let e,l;return e=new gt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function e0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function t0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function l0(t){let e,l,n,i,o,a;l=new jf({props:{$$slots:{default:[Jp]},$$scope:{ctx:t}}});const r=[xp,Xp],c=[];function f(p,_){return p[0].upgrading?0:p[0].booting?1:-1}return~(i=f(t))&&(o=c[i]=r[i](t)),{c(){e=m("div"),Z(l.$$.fragment),n=v(),o&&o.c(),u(e,"class","container mx-auto m-3")},m(p,_){y(p,e,_),V(l,e,null),s(e,n),~i&&c[i].m(e,null),a=!0},p(p,[_]){const d={};_&7&&(d.$$scope={dirty:_,ctx:p}),l.$set(d);let b=i;i=f(p),i===b?~i&&c[i].p(p,_):(o&&(Me(),I(c[b],1,1,()=>{c[b]=null}),Ae()),~i?(o=c[i],o?o.p(p,_):(o=c[i]=r[i](p),o.c()),P(o,1),o.m(e,null)):o=null)},i(p){a||(P(l.$$.fragment,p),P(o),a=!0)},o(p){I(l.$$.fragment,p),I(o),a=!1},d(p){p&&w(e),K(l),~i&&c[i].d()}}}function n0(t,e,l){let n={};yt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?Un("/vendor"):n.usrcfg===!1?Un("/setup"):n.fwconsent===0&&Un("/consent")}),to();let i={};return S1.subscribe(o=>{l(1,i=o)}),[n,i]}class i0 extends ye{constructor(e){super(),we(this,e,n0,l0,ke,{})}}new i0({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte index 8f3d64a1..121b2082 100644 --- a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte +++ b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte @@ -540,7 +540,7 @@ {#each {length: 9} as _, i} {/each}