From 32ad71bba6fdad8b776c9c2e3dc9ccf18c98114e Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Thu, 21 Dec 2023 15:56:30 +0100 Subject: [PATCH] Fixed checking "Clear all other configuration" --- lib/SvelteUi/app/dist/index.js | 12 ++++++------ lib/SvelteUi/app/src/lib/VendorPanel.svelte | 7 +++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index ed00f2b2..a146f8db 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,14 +1,14 @@ (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 r of i)if(r.type==="childList")for(const u of r.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function l(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerpolicy&&(r.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?r.credentials="include":i.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function n(i){if(i.ep)return;i.ep=!0;const r=l(i);fetch(i.href,r)}})();function fe(){}function xt(t,e){for(const l in e)t[l]=e[l];return t}function nc(t){return t()}function La(){return Object.create(null)}function ze(t){t.forEach(nc)}function cr(t){return typeof t=="function"}function Ne(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let _s;function Js(t,e){return _s||(_s=document.createElement("a")),_s.href=e,t===_s.href}function l0(t){return Object.keys(t).length===0}function mr(t,...e){if(t==null)return fe;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ai(t){let e;return mr(t,l=>e=l)(),e}function ul(t,e,l){t.$$.on_destroy.push(mr(e,l))}function pr(t,e,l,n){if(t){const i=ic(t,e,l,n);return t[0](i)}}function ic(t,e,l,n){return t[1]&&n?xt(l.ctx.slice(),t[1](n(e))):l.ctx}function _r(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 r=[],u=Math.max(e.dirty.length,i.length);for(let a=0;a32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function Ss(t){return function(e){return e.preventDefault(),t.call(this,e)}}function o(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const i0=["width","height"];function ui(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&&i0.indexOf(n)===-1?t[n]=e[n]:o(t,n,e[n])}function he(t){return t===""?null:+t}function s0(t){return Array.from(t.childNodes)}function Z(t,e){e=""+e,t.data!==e&&(t.data=e)}function r0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function o0(t,e,l){~n0.indexOf(l)?r0(t,e):Z(t,e)}function te(t,e){t.value=e==null?"":e}function sc(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function qe(t,e,l){for(let n=0;n{u.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{r=ee(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||r&&n.contentWindow)&&r(),C(n)}}function u0(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function Oa(t,e){return new t(e)}let Ti;function Mi(t){Ti=t}function $i(){if(!Ti)throw new Error("Function called outside component initialization");return Ti}function oc(t){$i().$$.on_mount.push(t)}function f0(t){$i().$$.on_destroy.push(t)}function c0(){const t=$i();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const r=u0(e,l,{cancelable:n});return i.slice().forEach(u=>{u.call(t,r)}),!r.defaultPrevented}return!0}}function Si(t,e){return $i().$$.context.set(t,e),e}function Bl(t){return $i().$$.context.get(t)}const ii=[],ws=[];let si=[];const Fa=[],ac=Promise.resolve();let xs=!1;function uc(){xs||(xs=!0,ac.then(fc))}function m0(){return uc(),ac}function Qe(t){si.push(t)}const Vs=new Set;let li=0;function fc(){if(li!==0)return;const t=Ti;do{try{for(;lit.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),si=e}const bs=new Set;let on;function De(){on={r:0,c:[],p:on}}function Ie(){on.r||ze(on.c),on=on.p}function D(t,e){t&&t.i&&(bs.delete(t),t.i(e))}function q(t,e,l,n){if(t&&t.o){if(bs.has(t))return;bs.add(t),on.c.push(()=>{bs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function cc(t,e){const l={},n={},i={$$scope:1};let r=t.length;for(;r--;){const u=t[r],a=e[r];if(a){for(const c in u)c in a||(n[c]=1);for(const c in a)i[c]||(l[c]=a[c],i[c]=1);t[r]=a}else for(const c in u)i[c]=1}for(const u in n)u in l||(l[u]=void 0);return l}function qa(t){return typeof t=="object"&&t!==null?t:{}}function ie(t){t&&t.c()}function le(t,e,l,n){const{fragment:i,after_update:r}=t.$$;i&&i.m(e,l),n||Qe(()=>{const u=t.$$.on_mount.map(nc).filter(cr);t.$$.on_destroy?t.$$.on_destroy.push(...u):ze(u),t.$$.on_mount=[]}),r.forEach(Qe)}function ne(t,e){const l=t.$$;l.fragment!==null&&(_0(l.after_update),ze(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function d0(t,e){t.$$.dirty[0]===-1&&(ii.push(t),uc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=v.length?v[0]:b;return f.ctx&&i(f.ctx[p],f.ctx[p]=d)&&(!f.skip_bound&&f.bound[p]&&f.bound[p](d),_&&d0(t,p)),b}):[],f.update(),_=!0,ze(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const p=s0(e.target);f.fragment&&f.fragment.l(p),p.forEach(C)}else f.fragment&&f.fragment.c();e.intro&&D(t.$$.fragment),le(t,e.target,e.anchor,e.customElement),fc()}Mi(c)}class Ee{$destroy(){ne(this,1),this.$destroy=fe}$on(e,l){if(!cr(l))return fe;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&&!l0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ba=t=>typeof t>"u",mc=t=>typeof t=="function",pc=t=>typeof t=="number";function v0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function _c(){let t=0;return()=>t++}function h0(){return Math.random().toString(36).substring(2)}const Ul=typeof window>"u";function dc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const vc=(t,e)=>t?{}:{style:e},er=t=>({"aria-hidden":"true",...vc(t,"display:none;")}),ni=[];function hc(t,e){return{subscribe:at(t,e).subscribe}}function at(t,e=fe){let l;const n=new Set;function i(a){if(Ne(t,a)&&(t=a,l)){const c=!ni.length;for(const f of n)f[1](),ni.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:r,subscribe:u}}function b0(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,r=e.length<2;return hc(l,u=>{let a=!1;const c=[];let f=0,_=fe;const p=()=>{if(f)return;_();const v=e(n?c[0]:c,u);r?u(v):_=cr(v)?v:fe},b=i.map((v,d)=>mr(v,S=>{c[d]=S,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,tr=Ni("LOCATION"),fi=Ni("ROUTER"),bc=Ni("ROUTE"),g0=Ni("ROUTE_PARAMS"),k0=Ni("FOCUS_ELEM"),gc=/^:(.+)/,wi=(t,e,l)=>t.substr(e,l),lr=(t,e)=>wi(t,0,e.length)===e,w0=t=>t==="",y0=t=>gc.test(t),kc=t=>t[0]==="*",C0=t=>t.replace(/\*.*$/,""),wc=t=>t.replace(/(^\/+|\/+$)/g,"");function ml(t,e=!1){const l=wc(t).split("/");return e?l.filter(Boolean):l}const Ks=(t,e)=>t+(e?`?${e}`:""),hr=t=>`/${wc(t)}`;function Ai(...t){const e=n=>ml(n,!0).join("/"),l=t.map(e).join("/");return hr(l)}const br=1,Ts=2,mn=3,M0=4,yc=5,S0=6,Cc=7,T0=8,$0=9,Mc=10,Sc=11,N0={[br]:"Link",[Ts]:"Route",[mn]:"Router",[M0]:"useFocus",[yc]:"useLocation",[S0]:"useMatch",[Cc]:"useNavigate",[T0]:"useParams",[$0]:"useResolvable",[Mc]:"useResolve",[Sc]:"navigate"},gr=t=>N0[t];function A0(t,e){let l;return t===Ts?l=e.path?`path="${e.path}"`:"default":t===br?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${gr(t)} ${l||""} />`}function P0(t,e,l,n){const i=l&&A0(n||t,l),r=i?` -Occurred in: ${i}`:"",u=gr(t),a=mc(e)?e(u):e;return`<${u}> ${a}${r}`}const Tc=t=>(...e)=>t(P0(...e)),$c=Tc(t=>{throw new Error(t)}),ys=Tc(console.warn),Ua=4,E0=3,D0=2,I0=1,R0=1;function L0(t,e){const l=t.default?0:ml(t.fullPath).reduce((n,i)=>{let r=n;return r+=Ua,w0(i)?r+=R0:y0(i)?r+=D0:kc(i)?r-=Ua+I0:r+=E0,r},0);return{route:t,score:l,index:e}}function O0(t){return t.map(L0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Nc(t,e){let l,n;const[i]=e.split("?"),r=ml(i),u=r[0]==="",a=O0(t);for(let c=0,f=a.length;c({..._,params:b,uri:T});if(_.default){n=v(e);continue}const d=ml(_.fullPath),S=Math.max(r.length,d.length);let y=0;for(;y{f===".."?c.pop():f!=="."&&c.push(f)}),Ks(`/${c.join("/")}`,n)}function Ha(t,e){const{pathname:l,hash:n="",search:i="",state:r}=t,u=ml(e,!0),a=ml(l,!0);for(;u.length;)u[0]!==a[0]&&$c(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),a.shift();return{pathname:Ai(...a),hash:n,search:i,state:r}}const ja=t=>t.length===1?"":t,kr=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,r=i?ja(wi(t,l)):"",u=i?wi(t,0,l):t,a=n?ja(wi(u,e)):"";return{pathname:(n?wi(u,0,e):u)||"/",search:a,hash:r}},q0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function B0(t,e,l){return Ai(l,F0(t,e))}function U0(t,e){const l=hr(C0(t)),n=ml(l,!0),i=ml(e,!0).slice(0,n.length),r=Ac({fullPath:l},Ai(...i));return r&&r.uri}const Ys="POP",H0="PUSH",j0="REPLACE";function Qs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function W0(t){let e=[],l=Qs(t),n=Ys;const i=(r=e)=>r.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(r){e.push(r);const u=()=>{l=Qs(t),n=Ys,i([r])};i([r]);const a=dc(t,"popstate",u);return()=>{a(),e=e.filter(c=>c!==r)}},navigate(r,u){const{state:a={},replace:c=!1}=u||{};if(n=c?j0:H0,pc(r))u&&ys(Sc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ys,t.history.go(r);else{const f={...a,_key:h0()};try{t.history[c?"replaceState":"pushState"](f,"",r)}catch{t.location[c?"replace":"assign"](r)}}l=Qs(t),i()}}}function Xs(t,e){return{...kr(e),state:t}}function z0(t="/"){let e=0,l=[Xs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,r){e++,l=l.slice(0,e),l.push(Xs(n,r))},replaceState(n,i,r){l[e]=Xs(n,r)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const G0=!!(!Ul&&window.document&&window.document.createElement),V0=!Ul&&window.location.origin==="null",Pc=W0(G0&&!V0?window:z0()),{navigate:ri}=Pc;let Tl=null,Ec=!0;function K0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nTl.level||t.level===Tl.level&&K0(t.routerId,Tl.routerId))&&(Tl=t)}function Q0(){Tl=null}function X0(){Ec=!1}function Wa(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=dc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function Z0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function J0(t){return/^H[1-6]$/i.test(t.tagName)}function za(t,e=document){return e.querySelector(t)}function x0(t){let l=za(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!Z0(l,t);){if(J0(l))return l;const n=za("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function e1(t){Promise.resolve(ai(t.focusElement)).then(e=>{const l=e||x0(t.id);l||ys(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ts),!Wa(l)&&Wa(document.documentElement)})}const t1=(t,e,l)=>(n,i)=>m0().then(()=>{if(!Tl||Ec){X0();return}if(n&&e1(Tl.route),t.announcements&&i){const{path:r,fullPath:u,meta:a,params:c,uri:f}=Tl.route,_=t.createAnnouncement({path:r,fullPath:u,meta:a,params:c,uri:f},ai(l));Promise.resolve(_).then(p=>{e.set(p)})}Q0()}),l1="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function n1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},vc(t[6],l1)],i={};for(let r=0;r`Navigated to ${ue.uri}`,announcements:!0,...d},T=_,N=hr(_),E=Bl(tr),B=Bl(fi),P=!E,L=s1(),O=v&&!(B&&!B.manageFocus),F=at("");ul(t,F,ue=>l(0,a=ue));const x=B?B.disableInlineStyles:S,H=at([]);ul(t,H,ue=>l(20,u=ue));const z=at(null);ul(t,z,ue=>l(18,i=ue));let G=!1;const V=P?0:B.level+1,U=P?at((()=>Ha(Ul?kr(p):b.location,N))()):E;ul(t,U,ue=>l(17,n=ue));const K=at(n);ul(t,K,ue=>l(19,r=ue));const j=t1(y,F,U),Y=ue=>ke=>ke.filter(me=>me.id!==ue);function X(ue){if(Ul){if(G)return;const ke=Ac(ue,n.pathname);if(ke)return G=!0,ke}else H.update(ke=>{const me=Y(ue.id)(ke);return me.push(ue),me})}function oe(ue){H.update(Y(ue))}return!P&&_!==Ga&&ys(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),P&&(oc(()=>b.listen(ke=>{const me=Ha(ke.location,N);K.set(n),U.set(me)})),Si(tr,U)),Si(fi,{activeRoute:z,registerRoute:X,unregisterRoute:oe,manageFocus:O,level:V,id:L,history:P?b:B.history,basepath:P?N:B.basepath,disableInlineStyles:x}),t.$$set=ue=>{"basepath"in ue&&l(11,_=ue.basepath),"url"in ue&&l(12,p=ue.url),"history"in ue&&l(13,b=ue.history),"primary"in ue&&l(14,v=ue.primary),"a11y"in ue&&l(15,d=ue.a11y),"disableInlineStyles"in ue&&l(16,S=ue.disableInlineStyles),"$$scope"in ue&&l(21,f=ue.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==T&&ys(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ue=Nc(u,n.pathname);z.set(ue)}if(t.$$.dirty[0]&655360&&P){const ue=!!n.hash,ke=!ue&&O,me=!ue||n.pathname!==r.pathname;j(ke,me)}t.$$.dirty[0]&262144&&O&&i&&i.primary&&Y0({level:V,routerId:L,route:i})},[a,y,P,L,O,F,x,H,z,U,K,_,p,b,v,d,S,n,i,r,u,f,c]}class o1 extends Ee{constructor(e){super(),Pe(this,e,r1,i1,Ne,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Dc=o1;function Pi(t,e,l=fi,n=mn){Bl(l)||$c(t,r=>`You cannot use ${r} outside of a ${gr(n)}.`,e)}const a1=t=>{const{subscribe:e}=Bl(t);return{subscribe:e}};function Ic(){return Pi(yc),a1(tr)}function Rc(){const{history:t}=Bl(fi);return t}function Lc(){const t=Bl(bc);return t?b0(t,e=>e.base):at("/")}function Oc(){Pi(Mc);const t=Lc(),{basepath:e}=Bl(fi);return n=>B0(n,ai(t),e)}function u1(){Pi(Cc);const t=Oc(),{navigate:e}=Rc();return(n,i)=>{const r=pc(n)?n:t(n);return e(r,i)}}const f1=t=>({params:t&16,location:t&8}),Va=t=>({params:Ul?ai(t[10]):t[4],location:t[3],navigate:t[11]});function Ka(t){let e,l;return e=new Dc({props:{primary:t[1],$$slots:{default:[p1]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&2&&(r.primary=n[1]),i&528409&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function c1(t){let e;const l=t[18].default,n=pr(l,t,t[19],Va);return{c(){n&&n.c()},m(i,r){n&&n.m(i,r),e=!0},p(i,r){n&&n.p&&(!e||r&524312)&&dr(n,l,i,i[19],e?_r(l,i[19],r,f1):vr(i[19]),Va)},i(i){e||(D(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function m1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ul?ai(t[10]):t[4],t[12]];var r=t[0];function u(a){let c={};for(let f=0;f{ne(_,1)}),Ie()}r?(e=Oa(r,u()),ie(e.$$.fragment),D(e.$$.fragment,1),le(e,l.parentNode,l)):e=null}else r&&e.$set(f)},i(a){n||(e&&D(e.$$.fragment,a),n=!0)},o(a){e&&q(e.$$.fragment,a),n=!1},d(a){a&&C(l),e&&ne(e,a)}}}function p1(t){let e,l,n,i;const r=[m1,c1],u=[];function a(c,f){return c[0]!==null?0:1}return e=a(t),l=u[e]=r[e](t),{c(){l.c(),n=Ve()},m(c,f){u[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?u[e].p(c,f):(De(),q(u[_],1,1,()=>{u[_]=null}),Ie(),l=u[e],l?l.p(c,f):(l=u[e]=r[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){u[e].d(c),c&&C(n)}}}function _1(t){let e,l,n,i,r,u=[er(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let p=0;p{c=null}),Ie())},i(p){r||(D(c),r=!0)},o(p){q(c),r=!1},d(p){p&&C(e),p&&C(l),c&&c.d(p),p&&C(n),p&&C(i)}}}const d1=_c();function v1(t,e,l){let n;const i=["path","component","meta","primary"];let r=ks(e,i),u,a,c,f,{$$slots:_={},$$scope:p}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:S=!0}=e;Pi(Ts,e);const y=d1(),{registerRoute:T,unregisterRoute:N,activeRoute:E,disableInlineStyles:B}=Bl(fi);ul(t,E,G=>l(16,u=G));const P=Lc();ul(t,P,G=>l(17,c=G));const L=Ic();ul(t,L,G=>l(3,a=G));const O=at(null);let F;const x=at(),H=at({});ul(t,H,G=>l(4,f=G)),Si(bc,x),Si(g0,H),Si(k0,O);const z=u1();return Ul||f0(()=>N(y)),t.$$set=G=>{l(24,e=xt(xt({},e),gs(G))),l(12,r=ks(e,i)),"path"in G&&l(13,b=G.path),"component"in G&&l(0,v=G.component),"meta"in G&&l(14,d=G.meta),"primary"in G&&l(1,S=G.primary),"$$scope"in G&&l(19,p=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=b==="",V=Ai(c,b),W={id:y,path:b,meta:d,default:G,fullPath:G?"":V,base:G?c:U0(V,a.pathname),primary:S,focusElement:O};x.set(W),l(15,F=T(W))}if(t.$$.dirty&98304&&l(2,n=!!(F||u&&u.id===y)),t.$$.dirty&98308&&n){const{params:G}=F||u;H.set(G)}},e=gs(e),[v,S,n,a,f,y,E,B,P,L,H,z,r,b,d,F,u,c,_,p]}class h1 extends Ee{constructor(e){super(),Pe(this,e,v1,_1,Ne,{path:13,component:0,meta:14,primary:1})}}const Sl=h1;function b1(t){let e,l,n,i;const r=t[13].default,u=pr(r,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,p=O));const E=c0(),B=Oc(),{navigate:P}=Rc();function L(O){E("click",O),v0(O)&&(O.preventDefault(),P(n,{state:y,replace:u||S}))}return t.$$set=O=>{l(19,e=xt(xt({},e),gs(O))),l(18,_=ks(e,f)),"to"in O&&l(5,d=O.to),"replace"in O&&l(6,S=O.replace),"state"in O&&l(7,y=O.state),"getProps"in O&&l(8,T=O.getProps),"$$scope"in O&&l(12,v=O.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=B(d,p)),t.$$.dirty&2049&&l(10,i=lr(p.pathname,n)),t.$$.dirty&2049&&l(9,r=n===p.pathname),t.$$.dirty&2049&&(u=kr(n)===q0(p)),t.$$.dirty&512&&l(2,a=r?{"aria-current":"page"}:{}),l(1,c=(()=>{if(mc(T)){const O=T({location:p,href:n,isPartiallyCurrent:i,isCurrent:r});return{..._,...O}}return _})())},e=gs(e),[n,c,a,N,L,d,S,y,T,r,i,p,v,b]}class k1 extends Ee{constructor(e){super(),Pe(this,e,g1,b1,Ne,{to:5,replace:6,state:7,getProps:8})}}const el=k1;let nr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ql(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function w1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Fc(t){let e;return t>90?e="#d90000":t>85?e="#e32100":t>80?e="#ffb800":t>75?e="#dcd800":e="#32d900",e}function y1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Cs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Oe(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function be(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Ya(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Qa(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 Xa(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Za(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function oi(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ke(t,e){return t==1||t==2&&e}function Ut(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function fl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Ja(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function xa(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function eu(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}async function Hl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),r=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),r}let al={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const Ht=at(al);async function wr(){al=await(await Hl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Ht.set(al)}let vs=0,tu=-127,lu=null,C1={};const M1=hc(C1,t=>{let e;async function l(){Hl("/data.json").then(n=>n.json()).then(n=>{t(n),tu!=n.t&&(tu=n.t,setTimeout(jc,2e3)),lu==null&&n.pe&&n.p!=null&&(lu=n.p,Bc()),al.upgrading?window.location.reload():(!al||!al.chip||al.booting||vs>1&&!oi(al.board))&&(wr(),an&&clearTimeout(an),an=setTimeout(Cr,2e3),un&&clearTimeout(un),un=setTimeout(Mr,3e3));let i=5e3;if(oi(al.board)&&n.v>2.5){let r=3.3-Math.min(3.3,n.v);r>0&&(i=Math.max(r,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),vs=0}).catch(n=>{vs++,vs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,oi(al.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let ir={},yi;const yr=at(ir);async function qc(){let t=!1;if(yr.update(e=>{for(var l=0;l<36;l++){if(e[Oe(l)]==null){t=l<12;break}e[Oe(l)]=e[Oe(l+1)]}return e}),t)Bc();else{let e=new Date;yi=setTimeout(qc,(60-e.getMinutes())*6e4)}}async function Bc(){yi&&(clearTimeout(yi),yi=0),ir=await(await Hl("/energyprice.json")).json(),yr.set(ir);let e=new Date;yi=setTimeout(qc,(60-e.getMinutes())*6e4)}let sr={},an;async function Cr(){an&&(clearTimeout(an),an=0),sr=await(await Hl("/dayplot.json")).json(),Uc.set(sr);let e=new Date;an=setTimeout(Cr,(60-e.getMinutes())*6e4+20)}const Uc=at(sr,t=>(Cr(),function(){}));let rr={},un;async function Mr(){un&&(clearTimeout(un),un=0),rr=await(await Hl("/monthplot.json")).json(),Hc.set(rr);let e=new Date;un=setTimeout(Mr,(24-e.getHours())*36e5+40)}const Hc=at(rr,t=>(Mr(),function(){}));let or={};async function jc(){or=await(await Hl("/temperature.json")).json(),Wc.set(or)}const Wc=at(or,t=>(jc(),function(){}));let ar={},hs;async function zc(){hs&&(clearTimeout(hs),hs=0),ar=await(await Hl("/tariff.json")).json(),Gc.set(ar);let e=new Date;hs=setTimeout(zc,(60-e.getMinutes())*6e4+30)}const Gc=at(ar,t=>function(){});let ur=[];const Sr=at(ur);async function S1(){ur=await(await Hl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Sr.set(ur)}function Ms(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 Vc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Kc(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]),r=parseInt(l[2]),u=[...e];u.reverse();let a,c,f;for(let _=0;_r&&(a=p):S==i+1&&(c=p);else if(d==n+1)if(f){let T=f.tag_name.substring(1).split(".");parseInt(T[0]);let N=parseInt(T[1]);parseInt(T[2]),S==N&&(f=p)}else f=p}return c||f||a||!1}else return e[0]}const T1="/github.svg";function nu(t){let e,l;function n(u,a){return u[1]>1?I1:u[1]>0?D1:u[2]>1?E1:u[2]>0?P1:u[3]>1?A1:u[3]>0?N1:$1}let i=n(t),r=i(t);return{c(){e=$(`Up - `),r.c(),l=Ve()},m(u,a){M(u,e,a),r.m(u,a),M(u,l,a)},p(u,a){i===(i=n(u))&&r?r.p(u,a):(r.d(1),r=i(u),r&&(r.c(),r.m(l.parentNode,l)))},d(u){u&&C(e),r.d(u),u&&C(l)}}}function $1(t){let e,l;return{c(){e=$(t[0]),l=$(" seconds")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&1&&Z(e,n[0])},d(n){n&&C(e),n&&C(l)}}}function N1(t){let e,l;return{c(){e=$(t[3]),l=$(" minute")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function A1(t){let e,l;return{c(){e=$(t[3]),l=$(" minutes")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function P1(t){let e,l;return{c(){e=$(t[2]),l=$(" hour")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function E1(t){let e,l;return{c(){e=$(t[2]),l=$(" hours")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function D1(t){let e,l;return{c(){e=$(t[1]),l=$(" day")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function I1(t){let e,l;return{c(){e=$(t[1]),l=$(" days")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function R1(t){let e,l=t[0]&&nu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=nu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function L1(t,e,l){let{epoch:n}=e,i=0,r=0,u=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,r=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,r,u]}class O1 extends Ee{constructor(e){super(),Pe(this,e,L1,R1,Ne,{epoch:0})}}function F1(t){let e,l,n;return{c(){e=m("span"),l=$(t[2]),o(e,"title",t[1]),o(e,"class",n="bd-"+t[0])},m(i,r){M(i,e,r),s(e,l)},p(i,[r]){r&4&&Z(l,i[2]),r&2&&o(e,"title",i[1]),r&1&&n!==(n="bd-"+i[0])&&o(e,"class",n)},i:fe,o:fe,d(i){i&&C(e)}}}function q1(t,e,l){let{color:n}=e,{title:i}=e,{text:r}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,r=u.text)},[n,i,r]}class fn extends Ee{constructor(e){super(),Pe(this,e,q1,F1,Ne,{color:0,title:1,text:2})}}function B1(t){let e,l=`${Oe(t[0].getDate())}.${Oe(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=$(l),o(e,"class",t[1])},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l=`${Oe(i[0].getDate())}.${Oe(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Oe(i[0].getHours())}:${Oe(i[0].getMinutes())}`)&&Z(n,l),r&2&&o(e,"class",i[1])},d(i){i&&C(e)}}}function U1(t){let e=`${Oe(t[0].getDate())}. ${nr[t[0].getMonth()]} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,l;return{c(){l=$(e)},m(n,i){M(n,l,i)},p(n,i){i&1&&e!==(e=`${Oe(n[0].getDate())}. ${nr[n[0].getMonth()]} ${Oe(n[0].getHours())}:${Oe(n[0].getMinutes())}`)&&Z(l,e)},d(n){n&&C(l)}}}function H1(t){let e;function l(r,u){return r[2]?U1:B1}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(r,u){i.m(r,u),M(r,e,u)},p(r,[u]){n===(n=l(r))&&i?i.p(r,u):(i.d(1),i=n(r),i&&(i.c(),i.m(e.parentNode,e)))},i:fe,o:fe,d(r){i.d(r),r&&C(e)}}}function j1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:r}=e,u;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,r=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(r)||fl(n,r-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,r]}class Yc extends Ee{constructor(e){super(),Pe(this,e,j1,H1,Ne,{timestamp:0,fullTimeColor:1,offset:3})}}function W1(t){let e,l,n;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(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"),o(n,"stroke-linecap","round"),o(n,"stroke-linejoin","round"),o(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(i,r){M(i,e,r),s(e,l),s(e,n)},p:fe,i:fe,o:fe,d(i){i&&C(e)}}}class z1 extends Ee{constructor(e){super(),Pe(this,e,null,W1,Ne,{})}}function G1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(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"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class V1 extends Ee{constructor(e){super(),Pe(this,e,null,G1,Ne,{})}}function K1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(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"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Bt extends Ee{constructor(e){super(),Pe(this,e,null,K1,Ne,{})}}function Y1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(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"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Qc extends Ee{constructor(e){super(),Pe(this,e,null,Y1,Ne,{})}}function Q1(t){let e,l,n=t[1].version+"",i;return{c(){e=$("AMS reader "),l=m("span"),i=$(n)},m(r,u){M(r,e,u),M(r,l,u),s(l,i)},p(r,u){u&2&&n!==(n=r[1].version+"")&&Z(i,n)},d(r){r&&C(e),r&&C(l)}}}function iu(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=$(l),i=$("\xB0C"),o(e,"class","flex-none my-auto")},m(r,u){M(r,e,u),s(e,n),s(e,i)},p(r,u){u&1&&l!==(l=(r[0].t>-50?r[0].t.toFixed(1):"-")+"")&&Z(n,l)},d(r){r&&C(e)}}}function su(t){let e,l="HAN: "+Ya(t[0].he),n;return{c(){e=m("div"),n=$(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l="HAN: "+Ya(i[0].he))&&Z(n,l)},d(i){i&&C(e)}}}function ru(t){let e,l="MQTT: "+Qa(t[0].me),n;return{c(){e=m("div"),n=$(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l="MQTT: "+Qa(i[0].me))&&Z(n,l)},d(i){i&&C(e)}}}function ou(t){let e,l="PriceAPI: "+Xa(t[0].ee),n;return{c(){e=m("div"),n=$(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l="PriceAPI: "+Xa(i[0].ee))&&Z(n,l)},d(i){i&&C(e)}}}function au(t){let e,l,n,i,r,u;return l=new el({props:{to:"/configuration",$$slots:{default:[X1]},$$scope:{ctx:t}}}),r=new el({props:{to:"/status",$$slots:{default:[Z1]},$$scope:{ctx:t}}}),{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("div"),ie(r.$$.fragment),o(e,"class","flex-none px-1 mt-1"),o(e,"title","Configuration"),o(i,"class","flex-none px-1 mt-1"),o(i,"title","Device information")},m(a,c){M(a,e,c),le(l,e,null),M(a,n,c),M(a,i,c),le(r,i,null),u=!0},i(a){u||(D(l.$$.fragment,a),D(r.$$.fragment,a),u=!0)},o(a){q(l.$$.fragment,a),q(r.$$.fragment,a),u=!1},d(a){a&&C(e),ne(l),a&&C(n),a&&C(i),ne(r)}}}function X1(t){let e,l;return e=new z1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Z1(t){let e,l;return e=new V1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function uu(t){let e,l,n,i,r;const u=[x1,J1],a=[];function c(f,_){return f[1].security==0||f[0].a?0:1}return l=c(t),n=a[l]=u[l](t),{c(){e=m("div"),n.c(),o(e,"class","flex-none mr-3 text-yellow-500"),o(e,"title",i="New version: "+t[2].tag_name)},m(f,_){M(f,e,_),a[l].m(e,null),r=!0},p(f,_){let p=l;l=c(f),l===p?a[l].p(f,_):(De(),q(a[p],1,1,()=>{a[p]=null}),Ie(),n=a[l],n?n.p(f,_):(n=a[l]=u[l](f),n.c()),D(n,1),n.m(e,null)),(!r||_&4&&i!==(i="New version: "+f[2].tag_name))&&o(e,"title",i)},i(f){r||(D(n),r=!0)},o(f){q(n),r=!1},d(f){f&&C(e),a[l].d()}}}function J1(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=$("New version: "),i=$(n)},m(r,u){M(r,e,u),s(e,l),s(e,i)},p(r,u){u&4&&n!==(n=r[2].tag_name+"")&&Z(i,n)},i:fe,o:fe,d(r){r&&C(e)}}}function x1(t){let e,l,n,i=t[2].tag_name+"",r,u,a,c,f,_;return a=new Qc({}),{c(){e=m("button"),l=m("span"),n=$("New version: "),r=$(i),u=h(),ie(a.$$.fragment),o(l,"class","mt-1"),o(e,"class","flex")},m(p,b){M(p,e,b),s(e,l),s(l,n),s(l,r),s(e,u),le(a,e,null),c=!0,f||(_=ee(e,"click",t[3]),f=!0)},p(p,b){(!c||b&4)&&i!==(i=p[2].tag_name+"")&&Z(r,i)},i(p){c||(D(a.$$.fragment,p),c=!0)},o(p){q(a.$$.fragment,p),c=!1},d(p){p&&C(e),ne(a),f=!1,_()}}}function em(t){let e,l,n,i,r,u,a,c,f,_,p,b,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,Te,He,Re,je;i=new el({props:{to:"/",$$slots:{default:[Q1]},$$scope:{ctx:t}}}),c=new O1({props:{epoch:t[0].u}});let we=t[0].t>-50&&iu(t);N=new fn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:ql(t[1].booting?2:t[0].em)}}),B=new fn({props:{title:"HAN",text:"HAN",color:ql(t[1].booting?9:t[0].hm)}}),L=new fn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:ql(t[1].booting?9:t[0].wm)}}),F=new fn({props:{title:"MQTT",text:"MQTT",color:ql(t[1].booting?9:t[0].mm)}});let $e=(t[0].he<0||t[0].he>0)&&su(t),Le=t[0].me<0&&ru(t),Me=(t[0].ee>0||t[0].ee<0)&&ou(t);oe=new Yc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let w=t[1].vndcfg&&t[1].usrcfg&&au(t);He=new Bt({});let g=t[1].fwconsent===1&&t[2]&&uu(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),ie(i.$$.fragment),r=h(),u=m("div"),a=m("div"),ie(c.$$.fragment),f=h(),we&&we.c(),_=h(),p=m("div"),b=$("Free mem: "),d=$(v),S=$("kb"),y=h(),T=m("div"),ie(N.$$.fragment),E=h(),ie(B.$$.fragment),P=h(),ie(L.$$.fragment),O=h(),ie(F.$$.fragment),x=h(),$e&&$e.c(),H=h(),Le&&Le.c(),z=h(),Me&&Me.c(),G=h(),V=m("div"),W=m("div"),U=m("a"),K=m("img"),Y=h(),X=m("div"),ie(oe.$$.fragment),ue=h(),w&&w.c(),ke=h(),me=m("div"),Te=m("a"),ie(He.$$.fragment),Re=h(),g&&g.c(),o(n,"class","flex text-lg text-gray-100 p-2"),o(a,"class","flex-none my-auto"),o(p,"class","flex-none my-auto"),o(u,"class","flex-none my-auto p-2 flex space-x-4"),o(T,"class","flex-auto flex-wrap my-auto justify-center p-2"),o(K,"class","gh-logo"),Js(K.src,j=T1)||o(K,"src",j),o(K,"alt","GitHub repo"),o(U,"class","float-right"),o(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),o(U,"target","_blank"),o(U,"rel","noreferrer"),o(U,"aria-label","GitHub"),o(W,"class","flex-none"),o(X,"class","flex-none my-auto px-2"),o(Te,"href",Ut("")),o(Te,"target","_blank"),o(Te,"rel","noreferrer"),o(me,"class","flex-none px-1 mt-1"),o(me,"title","Documentation"),o(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),o(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),o(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(k,A){M(k,e,A),s(e,l),s(l,n),le(i,n,null),s(l,r),s(l,u),s(u,a),le(c,a,null),s(u,f),we&&we.m(u,null),s(u,_),s(u,p),s(p,b),s(p,d),s(p,S),s(l,y),s(l,T),le(N,T,null),s(T,E),le(B,T,null),s(T,P),le(L,T,null),s(T,O),le(F,T,null),s(l,x),$e&&$e.m(l,null),s(l,H),Le&&Le.m(l,null),s(l,z),Me&&Me.m(l,null),s(l,G),s(l,V),s(V,W),s(W,U),s(U,K),s(V,Y),s(V,X),le(oe,X,null),s(V,ue),w&&w.m(V,null),s(V,ke),s(V,me),s(me,Te),le(He,Te,null),s(V,Re),g&&g.m(V,null),je=!0},p(k,[A]){const I={};A&18&&(I.$$scope={dirty:A,ctx:k}),i.$set(I);const Q={};A&1&&(Q.epoch=k[0].u),c.$set(Q),k[0].t>-50?we?we.p(k,A):(we=iu(k),we.c(),we.m(u,_)):we&&(we.d(1),we=null),(!je||A&1)&&v!==(v=(k[0].m?(k[0].m/1e3).toFixed(1):"-")+"")&&Z(d,v);const J={};A&3&&(J.text=k[1].booting?"Booting":k[0].v>2?k[0].v.toFixed(2)+"V":"ESP"),A&3&&(J.color=ql(k[1].booting?2:k[0].em)),N.$set(J);const se={};A&3&&(se.color=ql(k[1].booting?9:k[0].hm)),B.$set(se);const ce={};A&1&&(ce.text=k[0].r?k[0].r.toFixed(0)+"dBm":"WiFi"),A&3&&(ce.color=ql(k[1].booting?9:k[0].wm)),L.$set(ce);const ve={};A&3&&(ve.color=ql(k[1].booting?9:k[0].mm)),F.$set(ve),k[0].he<0||k[0].he>0?$e?$e.p(k,A):($e=su(k),$e.c(),$e.m(l,H)):$e&&($e.d(1),$e=null),k[0].me<0?Le?Le.p(k,A):(Le=ru(k),Le.c(),Le.m(l,z)):Le&&(Le.d(1),Le=null),k[0].ee>0||k[0].ee<0?Me?Me.p(k,A):(Me=ou(k),Me.c(),Me.m(l,G)):Me&&(Me.d(1),Me=null);const Se={};A&1&&(Se.timestamp=k[0].c?new Date(k[0].c*1e3):new Date(0)),A&2&&(Se.offset=k[1].clock_offset),oe.$set(Se),k[1].vndcfg&&k[1].usrcfg?w?A&2&&D(w,1):(w=au(k),w.c(),D(w,1),w.m(V,ke)):w&&(De(),q(w,1,1,()=>{w=null}),Ie()),k[1].fwconsent===1&&k[2]?g?(g.p(k,A),A&6&&D(g,1)):(g=uu(k),g.c(),D(g,1),g.m(V,null)):g&&(De(),q(g,1,1,()=>{g=null}),Ie())},i(k){je||(D(i.$$.fragment,k),D(c.$$.fragment,k),D(N.$$.fragment,k),D(B.$$.fragment,k),D(L.$$.fragment,k),D(F.$$.fragment,k),D(oe.$$.fragment,k),D(w),D(He.$$.fragment,k),D(g),je=!0)},o(k){q(i.$$.fragment,k),q(c.$$.fragment,k),q(N.$$.fragment,k),q(B.$$.fragment,k),q(L.$$.fragment,k),q(F.$$.fragment,k),q(oe.$$.fragment,k),q(w),q(He.$$.fragment,k),q(g),je=!1},d(k){k&&C(e),ne(i),ne(c),we&&we.d(),ne(N),ne(B),ne(L),ne(F),$e&&$e.d(),Le&&Le.d(),Me&&Me.d(),ne(oe),w&&w.d(),ne(He),g&&g.d()}}}function tm(t,e,l){let{data:n={}}=e,i={},r={};function u(){confirm("Do you want to upgrade this device to "+r.tag_name+"?")&&(!oi(i.board)||confirm(Ms(be(i.chip,i.board))))&&(Ht.update(a=>(a.upgrading=!0,a)),Vc(r.tag_name))}return Ht.subscribe(a=>{l(1,i=a),a.fwconsent===1&&S1()}),Sr.subscribe(a=>{l(2,r=Kc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,r,u]}class lm extends Ee{constructor(e){super(),Pe(this,e,tm,em,Ne,{data:0})}}function nm(t){let e,l,n,i;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),o(l,"d",Zs(150,150,115,210,510)),o(l,"stroke","#eee"),o(l,"fill","none"),o(l,"stroke-width","55"),o(n,"d",i=Zs(150,150,115,210,210+300*t[0]/100)),o(n,"stroke",t[1]),o(n,"fill","none"),o(n,"stroke-width","55"),o(e,"viewBox","0 0 300 300"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"height","100%")},m(r,u){M(r,e,u),s(e,l),s(e,n)},p(r,[u]){u&1&&i!==(i=Zs(150,150,115,210,210+300*r[0]/100))&&o(n,"d",i),u&2&&o(n,"stroke",r[1])},i:fe,o:fe,d(r){r&&C(e)}}}function fu(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 Zs(t,e,l,n,i){var r=fu(t,e,l,i),u=fu(t,e,l,n),a=i-n<=180?"0":"1",c=["M",r.x,r.y,"A",l,l,0,a,0,u.x,u.y].join(" ");return c}function im(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=r=>{"pct"in r&&l(0,n=r.pct),"color"in r&&l(1,i=r.color)},[n,i]}class sm extends Ee{constructor(e){super(),Pe(this,e,im,nm,Ne,{pct:0,color:1})}}function cu(t){let e,l,n,i,r,u,a,c;return{c(){e=m("br"),l=h(),n=m("span"),i=$(t[3]),r=h(),u=m("span"),a=$(t[4]),c=$("/kWh"),o(n,"class","pl-sub"),o(u,"class","pl-snt")},m(f,_){M(f,e,_),M(f,l,_),M(f,n,_),s(n,i),M(f,r,_),M(f,u,_),s(u,a),s(u,c)},p(f,_){_&8&&Z(i,f[3]),_&16&&Z(a,f[4])},d(f){f&&C(e),f&&C(l),f&&C(n),f&&C(r),f&&C(u)}}}function rm(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y;l=new sm({props:{pct:t[6],color:t[5](t[6])}});let T=t[3]&&cu(t);return{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("span"),r=m("span"),u=$(t[2]),a=h(),c=m("br"),f=h(),_=m("span"),p=$(t[0]),b=h(),v=m("span"),d=$(t[1]),S=h(),T&&T.c(),o(r,"class","pl-lab"),o(_,"class","pl-val"),o(v,"class","pl-unt"),o(i,"class","pl-ov"),o(e,"class","pl-root")},m(N,E){M(N,e,E),le(l,e,null),s(e,n),s(e,i),s(i,r),s(r,u),s(i,a),s(i,c),s(i,f),s(i,_),s(_,p),s(i,b),s(i,v),s(v,d),s(i,S),T&&T.m(i,null),y=!0},p(N,[E]){const B={};E&64&&(B.pct=N[6]),E&96&&(B.color=N[5](N[6])),l.$set(B),(!y||E&4)&&Z(u,N[2]),(!y||E&1)&&Z(p,N[0]),(!y||E&2)&&Z(d,N[1]),N[3]?T?T.p(N,E):(T=cu(N),T.c(),T.m(i,null)):T&&(T.d(1),T=null)},i(N){y||(D(l.$$.fragment,N),y=!0)},o(N){q(l.$$.fragment,N),y=!1},d(N){N&&C(e),ne(l),T&&T.d()}}}function om(t,e,l){let{val:n}=e,{max:i}=e,{unit:r}=e,{label:u}=e,{sub:a=""}=e,{subunit:c=""}=e,{colorFn:f}=e,_=0;return t.$$set=p=>{"val"in p&&l(0,n=p.val),"max"in p&&l(7,i=p.max),"unit"in p&&l(1,r=p.unit),"label"in p&&l(2,u=p.label),"sub"in p&&l(3,a=p.sub),"subunit"in p&&l(4,c=p.subunit),"colorFn"in p&&l(5,f=p.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,r,u,a,c,f,_,i]}class Xc extends Ee{constructor(e){super(),Pe(this,e,om,rm,Ne,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function mu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function pu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function _u(t,e,l){const n=t.slice();return n[15]=e[l],n}function du(t){let e,l,n,i,r,u,a=t[0].title&&vu(t),c=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(r,u){M(r,e,u),s(e,n),i=rc(e,t[9].bind(e))},p(r,u){u&1&&l!==(l=r[0].title+"")&&Z(n,l)},d(r){r&&C(e),i()}}}function hu(t){let e,l,n,i=t[15].label+"",r,u,a,c;return{c(){e=Fe("g"),l=Fe("line"),n=Fe("text"),r=$(i),o(l,"x2","100%"),o(n,"y","-4"),o(n,"x",u=t[15].align=="right"?"85%":""),o(e,"class",a="tick tick-"+t[15].value+" tick-"+t[15].color),o(e,"transform",c="translate(0, "+t[7](t[15].value)+")")},m(f,_){M(f,e,_),s(e,l),s(e,n),s(n,r)},p(f,_){_&1&&i!==(i=f[15].label+"")&&Z(r,i),_&1&&u!==(u=f[15].align=="right"?"85%":"")&&o(n,"x",u),_&1&&a!==(a="tick tick-"+f[15].value+" tick-"+f[15].color)&&o(e,"class",a),_&129&&c!==(c="translate(0, "+f[7](f[15].value)+")")&&o(e,"transform",c)},d(f){f&&C(e)}}}function bu(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&hu(t);return{c(){n&&n.c(),l=Ve()},m(i,r){n&&n.m(i,r),M(i,l,r)},p(i,r){r&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,r):(n=hu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function gu(t){let e,l,n=(t[3]>20||t[13]%2==0)&&ku(t);return{c(){e=Fe("g"),n&&n.c(),o(e,"class","tick"),o(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,r){M(i,e,r),n&&n.m(e,null)},p(i,r){i[3]>20||i[13]%2==0?n?n.p(i,r):(n=ku(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),r&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&o(e,"transform",l)},d(i){i&&C(e),n&&n.d()}}}function ku(t){let e,l=t[11].label+"",n,i;return{c(){e=Fe("text"),n=$(l),o(e,"x",i=t[3]/2),o(e,"y","-4")},m(r,u){M(r,e,u),s(e,n)},p(r,u){u&1&&l!==(l=r[11].label+"")&&Z(n,l),u&8&&i!==(i=r[3]/2)&&o(e,"x",i)},d(r){r&&C(e)}}}function wu(t){let e=!isNaN(t[6](t[13])),l,n=e&&gu(t);return{c(){n&&n.c(),l=Ve()},m(i,r){n&&n.m(i,r),M(i,l,r)},p(i,r){r&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,r):(n=gu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function yu(t){let e,l,n=t[11].value!==void 0&&Cu(t),i=t[11].value2>1e-4&&Tu(t);return{c(){e=Fe("g"),n&&n.c(),l=Fe("g"),i&&i.c()},m(r,u){M(r,e,u),n&&n.m(e,null),M(r,l,u),i&&i.m(l,null)},p(r,u){r[11].value!==void 0?n?n.p(r,u):(n=Cu(r),n.c(),n.m(e,null)):n&&(n.d(1),n=null),r[11].value2>1e-4?i?i.p(r,u):(i=Tu(r),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(r){r&&C(e),n&&n.d(),r&&C(l),i&&i.d()}}}function Cu(t){let e,l,n,i,r,u,a,c=t[3]>15&&Mu(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),o(e,"x",l=t[6](t[13])+2),o(e,"y",n=t[7](t[11].value)),o(e,"width",i=t[3]-4),o(e,"height",r=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),o(e,"fill",u=t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,a,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&o(e,"x",l),_&129&&n!==(n=f[7](f[11].value))&&o(e,"y",n),_&8&&i!==(i=f[3]-4)&&o(e,"width",i),_&129&&r!==(r=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&o(e,"height",r),_&1&&u!==(u=f[11].color)&&o(e,"fill",u),f[3]>15?c?c.p(f,_):(c=Mu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function Mu(t){let e,l=t[11].label+"",n,i,r,u,a,c,f=t[11].title&&Su(t);return{c(){e=Fe("text"),n=$(l),f&&f.c(),c=Ve(),o(e,"width",i=t[3]-4),o(e,"dominant-baseline","middle"),o(e,"text-anchor",r=t[3]t[7](0)-t[8]?t[11].color:"white"),o(e,"transform",a="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[3]_[7](0)-_[8]?_[11].color:"white")&&o(e,"fill",u),p&457&&a!==(a="translate("+(_[6](_[13])+_[3]/2)+" "+(_[7](_[11].value)>_[7](0)-_[8]?_[7](_[11].value)-_[8]:_[7](_[11].value)+10)+") rotate("+(_[3]15&&$u(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),o(e,"x",l=t[6](t[13])+2),o(e,"y",n=t[7](0)),o(e,"width",i=t[3]-4),o(e,"height",r=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),o(e,"fill",u=t[11].color2?t[11].color2:t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,a,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&o(e,"x",l),_&128&&n!==(n=f[7](0))&&o(e,"y",n),_&8&&i!==(i=f[3]-4)&&o(e,"width",i),_&129&&r!==(r=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&o(e,"height",r),_&1&&u!==(u=f[11].color2?f[11].color2:f[11].color)&&o(e,"fill",u),f[3]>15?c?c.p(f,_):(c=$u(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function $u(t){let e,l=t[11].label2+"",n,i,r,u,a,c=t[11].title2&&Nu(t);return{c(){e=Fe("text"),n=$(l),c&&c.c(),a=Ve(),o(e,"width",i=t[3]-4),o(e,"dominant-baseline","middle"),o(e,"text-anchor","middle"),o(e,"fill",r=t[7](-t[11].value2)t[10].call(e))},m(i,r){M(i,e,r),n&&n.m(e,null),l=rc(e,t[10].bind(e))},p(i,[r]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,r):(n=du(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:fe,o:fe,d(i){i&&C(e),n&&n.d(),l()}}}let cn=30;function um(t,e,l){let{config:n}=e,i,r,u,a,c,f,_,p=0;function b(){p=this.clientHeight,l(5,p)}function v(){i=this.clientWidth,r=this.clientHeight,l(1,i),l(2,r)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,f=r-p);let d=i-(n.padding.left+n.padding.right);l(3,u=d/n.points.length),l(8,_=un.y.max?T=n.padding.bottom:yf||T<0?0:T})}},[n,i,r,u,f,p,a,c,_,b,v]}class pn extends Ee{constructor(e){super(),Pe(this,e,um,am,Ne,{config:0})}}function fm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const r={};i&1&&(r.config=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function cm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:r}=e,{ds:u}=e,a={};function c(f){return{label:ge(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:w1(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,r=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],_=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),_.push(c(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),_.push(c(i))),r>0&&(f.push({label:u===1?"L2-L3":"L3"}),_.push(c(r))),l(0,a={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:_})}},[a,n,i,r,u]}class mm extends Ee{constructor(e){super(),Pe(this,e,cm,fm,Ne,{u1:1,u2:2,u3:3,ds:4})}}function pm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const r={};i&1&&(r.config=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function _m(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:r}=e,{i1:u}=e,{i2:a}=e,{i2e:c}=e,{i3:f}=e,{max:_}=e,p={};function b(v){return{label:ge(v)+"A",title:v.toFixed(1)+" A",value:isNaN(v)?0:v,color:Fc(v?v/_*100:0)}}return t.$$set=v=>{"u1"in v&&l(1,n=v.u1),"u2"in v&&l(2,i=v.u2),"u3"in v&&l(3,r=v.u3),"i1"in v&&l(4,u=v.i1),"i2"in v&&l(5,a=v.i2),"i2e"in v&&l(6,c=v.i2e),"i3"in v&&l(7,f=v.i3),"max"in v&&l(8,_=v.max)},t.$$.update=()=>{if(t.$$.dirty&510){let v=[],d=[];n>0&&(v.push({label:"L1"}),d.push(b(u))),i>0&&(c?(v.push({label:"L2"}),d.push({label:"N/A",labelAngle:90,title:"The value is not reported by your meter",value:0,color:"#7c3aedcc"})):(v.push({label:"L2"}),d.push(b(a)))),r>0&&(v.push({label:"L3"}),d.push(b(f))),l(0,p={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:_,ticks:[{value:0,label:"0%"},{value:_/4,label:"25%"},{value:_/2,label:"50%"},{value:_/4*3,label:"75%"},{value:_,label:"100%"}]},x:{ticks:v},points:d})}},[p,n,i,r,u,a,c,f,_]}class dm extends Ee{constructor(e){super(),Pe(this,e,_m,pm,Ne,{u1:1,u2:2,u3:3,i1:4,i2:5,i2e:6,i3:7,max:8})}}function vm(t){let e,l,n,i,r,u,a,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,_,p,b,v,d,S=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",y,T,N,E,B,P,L,O=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,x,H,z,G,V,W=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",U,K;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),r=m("div"),r.textContent="Instant in",u=h(),a=m("div"),f=$(c),_=$(" VAr"),p=h(),b=m("div"),b.textContent="Instant out",v=h(),d=m("div"),y=$(S),T=$(" VAr"),N=h(),E=m("div"),B=m("div"),B.textContent="Total in",P=h(),L=m("div"),F=$(O),x=$(" kVArh"),H=h(),z=m("div"),z.textContent="Total out",G=h(),V=m("div"),U=$(W),K=$(" kVArh"),o(a,"class","text-right"),o(d,"class","text-right"),o(i,"class","grid grid-cols-2 mt-4"),o(L,"class","text-right"),o(V,"class","text-right"),o(E,"class","grid grid-cols-2 mt-4"),o(e,"class","mx-2 text-sm")},m(j,Y){M(j,e,Y),s(e,l),s(e,n),s(e,i),s(i,r),s(i,u),s(i,a),s(a,f),s(a,_),s(i,p),s(i,b),s(i,v),s(i,d),s(d,y),s(d,T),s(e,N),s(e,E),s(E,B),s(E,P),s(E,L),s(L,F),s(L,x),s(E,H),s(E,z),s(E,G),s(E,V),s(V,U),s(V,K)},p(j,[Y]){Y&1&&c!==(c=(typeof j[0]<"u"?j[0].toFixed(0):"-")+"")&&Z(f,c),Y&2&&S!==(S=(typeof j[1]<"u"?j[1].toFixed(0):"-")+"")&&Z(y,S),Y&4&&O!==(O=(typeof j[2]<"u"?j[2].toFixed(1):"-")+"")&&Z(F,O),Y&8&&W!==(W=(typeof j[3]<"u"?j[3].toFixed(1):"-")+"")&&Z(U,W)},i:fe,o:fe,d(j){j&&C(e)}}}function hm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:r}=e,{exportTotal:u}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,r=a.importTotal),"exportTotal"in a&&l(3,u=a.exportTotal)},[n,i,r,u]}class bm extends Ee{constructor(e){super(),Pe(this,e,hm,vm,Ne,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Pu(t){let e;function l(r,u){return r[3]?km:gm}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(r,u){i.m(r,u),M(r,e,u)},p(r,u){n===(n=l(r))&&i?i.p(r,u):(i.d(1),i=n(r),i&&(i.c(),i.m(e.parentNode,e)))},d(r){i.d(r),r&&C(e)}}}function gm(t){let e,l,n,i,r,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d=ge(t[1].d.u,1)+"",S,y,T,N,E,B,P=ge(t[1].m.u)+"",L,O,F,x,H,z,G=ge(t[0].last_month.u)+"",V,W,U,K,j=t[4]&&Eu(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",r=h(),u=m("div"),c=$(a),f=$(" kWh"),_=h(),p=m("div"),p.textContent="Day",b=h(),v=m("div"),S=$(d),y=$(" kWh"),T=h(),N=m("div"),N.textContent="Month",E=h(),B=m("div"),L=$(P),O=$(" kWh"),F=h(),x=m("div"),x.textContent="Last month",H=h(),z=m("div"),V=$(G),W=$(" kWh"),U=h(),j&&j.c(),K=Ve(),o(u,"class","text-right"),o(v,"class","text-right"),o(B,"class","text-right"),o(z,"class","text-right"),o(n,"class","grid grid-cols-2 mb-3")},m(Y,X){M(Y,e,X),M(Y,l,X),M(Y,n,X),s(n,i),s(n,r),s(n,u),s(u,c),s(u,f),s(n,_),s(n,p),s(n,b),s(n,v),s(v,S),s(v,y),s(n,T),s(n,N),s(n,E),s(n,B),s(B,L),s(B,O),s(n,F),s(n,x),s(n,H),s(n,z),s(z,V),s(z,W),M(Y,U,X),j&&j.m(Y,X),M(Y,K,X)},p(Y,X){X&2&&a!==(a=ge(Y[1].h.u,2)+"")&&Z(c,a),X&2&&d!==(d=ge(Y[1].d.u,1)+"")&&Z(S,d),X&2&&P!==(P=ge(Y[1].m.u)+"")&&Z(L,P),X&1&&G!==(G=ge(Y[0].last_month.u)+"")&&Z(V,G),Y[4]?j?j.p(Y,X):(j=Eu(Y),j.c(),j.m(K.parentNode,K)):j&&(j.d(1),j=null)},d(Y){Y&&C(e),Y&&C(l),Y&&C(n),Y&&C(U),j&&j.d(Y),Y&&C(K)}}}function km(t){let e,l,n,i,r,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.u,1)+"",y,T,N,E,B,P,L,O=ge(t[1].m.u)+"",F,x,H,z,G,V,W,U=ge(t[0].last_month.u)+"",K,j,Y,X,oe,ue,ke,me,Te,He,Re,je=ge(t[1].h.p,2)+"",we,$e,Le,Me,w,g,k,A=ge(t[1].d.p,1)+"",I,Q,J,se,ce,ve,Se,re=ge(t[1].m.p)+"",pe,Be,_e,ye,vt,jl,tl,ct=ge(t[0].last_month.p)+"",$l,pl,jt,ht,Xe=t[4]&&Du(t),Ze=t[4]&&Iu(t),Je=t[4]&&Ru(t),Ue=t[4]&&Lu(t),xe=t[4]&&Ou(t),We=t[4]&&Fu(t),et=t[4]&&qu(t),tt=t[4]&&Bu(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",r=h(),u=m("div"),c=$(a),f=$(" kWh"),_=h(),Xe&&Xe.c(),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=$(S),T=$(" kWh"),N=h(),Ze&&Ze.c(),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=$(O),x=$(" kWh"),H=h(),Je&&Je.c(),z=h(),G=m("div"),G.textContent="Last mo.",V=h(),W=m("div"),K=$(U),j=$(" kWh"),Y=h(),Ue&&Ue.c(),oe=h(),ue=m("strong"),ue.textContent="Export",ke=h(),me=m("div"),Te=m("div"),Te.textContent="Hour",He=h(),Re=m("div"),we=$(je),$e=$(" kWh"),Le=h(),xe&&xe.c(),Me=h(),w=m("div"),w.textContent="Day",g=h(),k=m("div"),I=$(A),Q=$(" kWh"),J=h(),We&&We.c(),se=h(),ce=m("div"),ce.textContent="Month",ve=h(),Se=m("div"),pe=$(re),Be=$(" kWh"),_e=h(),et&&et.c(),ye=h(),vt=m("div"),vt.textContent="Last mo.",jl=h(),tl=m("div"),$l=$(ct),pl=$(" kWh"),jt=h(),tt&&tt.c(),o(u,"class","text-right"),o(d,"class","text-right"),o(L,"class","text-right"),o(W,"class","text-right"),o(n,"class",X="grid grid-cols-"+t[5]+" mb-3"),o(Re,"class","text-right"),o(k,"class","text-right"),o(Se,"class","text-right"),o(tl,"class","text-right"),o(me,"class",ht="grid grid-cols-"+t[5])},m(de,Ce){M(de,e,Ce),M(de,l,Ce),M(de,n,Ce),s(n,i),s(n,r),s(n,u),s(u,c),s(u,f),s(n,_),Xe&&Xe.m(n,null),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,T),s(n,N),Ze&&Ze.m(n,null),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(n,H),Je&&Je.m(n,null),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,j),s(n,Y),Ue&&Ue.m(n,null),M(de,oe,Ce),M(de,ue,Ce),M(de,ke,Ce),M(de,me,Ce),s(me,Te),s(me,He),s(me,Re),s(Re,we),s(Re,$e),s(me,Le),xe&&xe.m(me,null),s(me,Me),s(me,w),s(me,g),s(me,k),s(k,I),s(k,Q),s(me,J),We&&We.m(me,null),s(me,se),s(me,ce),s(me,ve),s(me,Se),s(Se,pe),s(Se,Be),s(me,_e),et&&et.m(me,null),s(me,ye),s(me,vt),s(me,jl),s(me,tl),s(tl,$l),s(tl,pl),s(me,jt),tt&&tt.m(me,null)},p(de,Ce){Ce&2&&a!==(a=ge(de[1].h.u,2)+"")&&Z(c,a),de[4]?Xe?Xe.p(de,Ce):(Xe=Du(de),Xe.c(),Xe.m(n,p)):Xe&&(Xe.d(1),Xe=null),Ce&2&&S!==(S=ge(de[1].d.u,1)+"")&&Z(y,S),de[4]?Ze?Ze.p(de,Ce):(Ze=Iu(de),Ze.c(),Ze.m(n,E)):Ze&&(Ze.d(1),Ze=null),Ce&2&&O!==(O=ge(de[1].m.u)+"")&&Z(F,O),de[4]?Je?Je.p(de,Ce):(Je=Ru(de),Je.c(),Je.m(n,z)):Je&&(Je.d(1),Je=null),Ce&1&&U!==(U=ge(de[0].last_month.u)+"")&&Z(K,U),de[4]?Ue?Ue.p(de,Ce):(Ue=Lu(de),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),Ce&32&&X!==(X="grid grid-cols-"+de[5]+" mb-3")&&o(n,"class",X),Ce&2&&je!==(je=ge(de[1].h.p,2)+"")&&Z(we,je),de[4]?xe?xe.p(de,Ce):(xe=Ou(de),xe.c(),xe.m(me,Me)):xe&&(xe.d(1),xe=null),Ce&2&&A!==(A=ge(de[1].d.p,1)+"")&&Z(I,A),de[4]?We?We.p(de,Ce):(We=Fu(de),We.c(),We.m(me,se)):We&&(We.d(1),We=null),Ce&2&&re!==(re=ge(de[1].m.p)+"")&&Z(pe,re),de[4]?et?et.p(de,Ce):(et=qu(de),et.c(),et.m(me,ye)):et&&(et.d(1),et=null),Ce&1&&ct!==(ct=ge(de[0].last_month.p)+"")&&Z($l,ct),de[4]?tt?tt.p(de,Ce):(tt=Bu(de),tt.c(),tt.m(me,null)):tt&&(tt.d(1),tt=null),Ce&32&&ht!==(ht="grid grid-cols-"+de[5])&&o(me,"class",ht)},d(de){de&&C(e),de&&C(l),de&&C(n),Xe&&Xe.d(),Ze&&Ze.d(),Je&&Je.d(),Ue&&Ue.d(),de&&C(oe),de&&C(ue),de&&C(ke),de&&C(me),xe&&xe.d(),We&&We.d(),et&&et.d(),tt&&tt.d()}}}function Eu(t){let e,l,n,i,r,u,a=ge(t[1].h.c,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.c,1)+"",y,T,N,E,B,P,L,O=ge(t[1].m.c)+"",F,x,H,z,G,V,W,U=ge(t[0].last_month.c)+"",K,j,Y;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",r=h(),u=m("div"),c=$(a),f=h(),_=$(t[2]),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=$(S),T=h(),N=$(t[2]),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=$(O),x=h(),H=$(t[2]),z=h(),G=m("div"),G.textContent="Last month",V=h(),W=m("div"),K=$(U),j=h(),Y=$(t[2]),o(u,"class","text-right"),o(d,"class","text-right"),o(L,"class","text-right"),o(W,"class","text-right"),o(n,"class","grid grid-cols-2")},m(X,oe){M(X,e,oe),M(X,l,oe),M(X,n,oe),s(n,i),s(n,r),s(n,u),s(u,c),s(u,f),s(u,_),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,T),s(d,N),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(L,H),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,j),s(W,Y)},p(X,oe){oe&2&&a!==(a=ge(X[1].h.c,2)+"")&&Z(c,a),oe&4&&Z(_,X[2]),oe&2&&S!==(S=ge(X[1].d.c,1)+"")&&Z(y,S),oe&4&&Z(N,X[2]),oe&2&&O!==(O=ge(X[1].m.c)+"")&&Z(F,O),oe&4&&Z(H,X[2]),oe&1&&U!==(U=ge(X[0].last_month.c)+"")&&Z(K,U),oe&4&&Z(Y,X[2])},d(X){X&&C(e),X&&C(l),X&&C(n)}}}function Du(t){let e,l=ge(t[1].h.c,2)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].h.c,2)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Iu(t){let e,l=ge(t[1].d.c,1)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].d.c,1)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Ru(t){let e,l=ge(t[1].m.c)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].m.c)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Lu(t){let e,l=ge(t[0].last_month.c)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.c)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Ou(t){let e,l=ge(t[1].h.i,2)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].h.i,2)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Fu(t){let e,l=ge(t[1].d.i,1)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].d.i,1)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function qu(t){let e,l=ge(t[1].m.i)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].m.i)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Bu(t){let e,l=ge(t[0].last_month.i)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.i)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function wm(t){let e,l,n,i,r,u,a=t[1]&&Pu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),r=m("br"),u=h(),a&&a.c(),o(e,"class","mx-2 text-sm")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),s(e,u),a&&a.m(e,null)},p(c,[f]){c[1]?a?a.p(c,f):(a=Pu(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:fe,o:fe,d(c){c&&C(e),a&&a.d()}}}function ym(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:r}=e,{hasExport:u}=e,a=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,r=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=a?3:2))},[n,i,r,u,a,c]}class Cm extends Ee{constructor(e){super(),Pe(this,e,ym,wm,Ne,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Mm(t){let e,l,n=xa(t[0].source)+"",i,r,u,a,c;return a=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=$("Provided by: "),i=$(n),u=h(),ie(a.$$.fragment),o(e,"href",r=eu(t[0].source)),o(e,"target","_blank"),o(e,"class","text-xs float-right z-40")},m(f,_){M(f,e,_),s(e,l),s(e,i),M(f,u,_),le(a,f,_),c=!0},p(f,[_]){(!c||_&1)&&n!==(n=xa(f[0].source)+"")&&Z(i,n),(!c||_&1&&r!==(r=eu(f[0].source)))&&o(e,"href",r);const p={};_&2&&(p.config=f[1]),a.$set(p)},i(f){c||(D(a.$$.fragment,f),c=!0)},o(f){q(a.$$.fragment,f),c=!1},d(f){f&&C(e),f&&C(u),ne(a,f)}}}function Sm(t,e,l){let{json:n}=e,{sysinfo:i}=e,r={},u,a;return t.$$set=c=>{"json"in c&&l(0,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let c=n.currency,f=new Date().getUTCHours(),_=0,p=0,b=0,v=[],d=[],S=[];l(4,a=l(3,u=0));let y=new Date;for(fl(y,i.clock_offset-(24+y.getHours()-y.getUTCHours())%24),_=f;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),S.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);for(_=0;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),S.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);if(a>-100&&u<100){switch(c){case"NOK":case"DKK":c="\xF8re";break;case"SEK":c="\xF6re";break;case"EUR":c="cent";break;case"CHF":c="rp.";break;default:c=c+"/100"}for(l(4,a*=100),l(3,u*=100),_=0;_=0?P.toFixed(L):"",title:P>=0?P.toFixed(2)+" "+c:"",value:p>=0?Math.abs(p):0,label2:P<0?P.toFixed(L):"",title2:P<0?P.toFixed(2)+" "+c:"",value2:p<0?Math.abs(p):0,color:"#7c3aed"})}let N=Math.max(u,Math.abs(a));if(a<0){l(4,a=Math.min(N/4*-1,a));let P=Math.ceil(Math.abs(a)/N*4),L=a/P;for(_=1;_{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=fl(new Date,-24),v=new Date().getUTCHours();for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),c=v;c<24;c++){let T=n["i"+Oe(c)],N=n["e"+Oe(c)];T===void 0&&(T=0),N===void 0&&(N=0),_.push({label:Oe(b.getHours())}),p.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:N.toFixed(1),title2:N.toFixed(2)+" kWh",value2:N*10,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N*10)),l(3,u=Math.max(u,T*10)),fl(b,1)}for(c=0;c{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=new Date,v=new Date;for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),fl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),v.setDate(0),c=b.getDate();c<=v.getDate();c++){let T=n["i"+Oe(c)],N=n["e"+Oe(c)];T===void 0&&(T=0),N===void 0&&(N=0),_.push({label:Oe(c)}),p.push({label:T.toFixed(T<10?1:0),title:T.toFixed(2)+" kWh",value:T,label2:N.toFixed(N<10?1:0),title2:N.toFixed(2)+" kWh",value2:N,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N)),l(3,u=Math.max(u,T))}for(c=1;c{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=0,f=[],_=[],p=[];n.s&&n.s.forEach((d,S)=>{var y=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),_.push({label:y.slice(-4)}),p.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,u=Math.min(u,c)),l(2,r=Math.max(r,c))}),l(2,r=Math.ceil(r)),l(3,u=Math.floor(u));let b=r;u<0&&(b+=Math.abs(u));let v=b/4;for(a=0;a<5;a++)c=u+v*a,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:u,max:r,ticks:f},x:{ticks:_},points:p})}},[i,n,r,u]}class Lm extends Ee{constructor(e){super(),Pe(this,e,Rm,Im,Ne,{json:1})}}function Om(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const r={};i&1&&(r.config=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}let Fm=0;function qm(t,e,l){let n={},i=0,r;return Gc.subscribe(u=>{l(2,r=u)}),zc(),t.$$.update=()=>{if(t.$$.dirty&6){let u=0,a=[],c=[],f=[];if(a.push({value:0,label:0}),r&&r.p)for(u=0;u0?Oe(_.d)+"."+nr[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,_.v))}if(r&&r.t){for(u=0;u=i)break;a.push({value:_,label:_})}a.push({label:r.m.toFixed(1),align:"right",color:"green",value:r.m})}r&&r.c&&(a.push({label:r.c.toFixed(0),color:"orange",value:r.c}),l(1,i=Math.max(i,r.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Fm,max:i,ticks:a},x:{ticks:c},points:f})}},[n,i,r]}class Bm extends Ee{constructor(e){super(),Pe(this,e,qm,Om,Ne,{})}}function Uu(t){let e,l,n,i,r,u,a=(t[0].mt?Cs(t[0].mt):"-")+"",c,f,_,p=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,v,d;return i=new Xc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:Fc}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),r=h(),u=m("div"),c=$(a),f=h(),_=m("div"),b=$(p),v=$(" kWh"),o(n,"class","col-span-2"),o(_,"class","text-right"),o(l,"class","grid grid-cols-2"),o(e,"class","cnt")},m(S,y){M(S,e,y),s(e,l),s(l,n),le(i,n,null),s(l,r),s(l,u),s(u,c),s(l,f),s(l,_),s(_,b),s(_,v),d=!0},p(S,y){const T={};y&1&&(T.val=S[0].i?S[0].i:0),y&1&&(T.max=S[0].im?S[0].im:15e3),y&1&&(T.sub=S[0].p),y&1&&(T.subunit=S[0].pc),i.$set(T),(!d||y&1)&&a!==(a=(S[0].mt?Cs(S[0].mt):"-")+"")&&Z(c,a),(!d||y&1)&&p!==(p=(S[0].ic?S[0].ic.toFixed(1):"-")+"")&&Z(b,p)},i(S){d||(D(i.$$.fragment,S),d=!0)},o(S){q(i.$$.fragment,S),d=!1},d(S){S&&C(e),ne(i)}}}function Hu(t){let e,l,n,i,r,u,a,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,p,b;return i=new Xc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:y1}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),r=h(),u=m("div"),a=h(),c=m("div"),_=$(f),p=$(" kWh"),o(n,"class","col-span-2"),o(c,"class","text-right"),o(l,"class","grid grid-cols-2"),o(e,"class","cnt")},m(v,d){M(v,e,d),s(e,l),s(l,n),le(i,n,null),s(l,r),s(l,u),s(l,a),s(l,c),s(c,_),s(c,p),b=!0},p(v,d){const S={};d&1&&(S.val=v[0].e?v[0].e:0),d&1&&(S.max=v[0].om?v[0].om*1e3:1e4),i.$set(S),(!b||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&Z(_,f)},i(v){b||(D(i.$$.fragment,v),b=!0)},o(v){q(i.$$.fragment,v),b=!1},d(v){v&&C(e),ne(i)}}}function ju(t){let e,l,n;return l=new mm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&1&&(u.u1=i[0].u1),r&1&&(u.u2=i[0].u2),r&1&&(u.u3=i[0].u3),r&1&&(u.ds=i[0].ds),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Wu(t){let e,l,n;return l=new dm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i2e:t[0].i2e,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&1&&(u.u1=i[0].u1),r&1&&(u.u2=i[0].u2),r&1&&(u.u3=i[0].u3),r&1&&(u.i1=i[0].i1),r&1&&(u.i2=i[0].i2),r&1&&(u.i2e=i[0].i2e),r&1&&(u.i3=i[0].i3),r&1&&(u.max=i[0].mf?i[0].mf:32),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function zu(t){let e,l,n;return l=new bm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&1&&(u.importInstant=i[0].ri),r&1&&(u.exportInstant=i[0].re),r&1&&(u.importTotal=i[0].ric),r&1&&(u.exportTotal=i[0].rec),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Gu(t){let e,l,n;return l=new Cm({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&2&&(u.sysinfo=i[1]),r&1&&(u.data=i[0].ea),r&1&&(u.currency=i[0].pc),r&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Vu(t){let e,l,n;return l=new Bm({}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt h-64")},m(i,r){M(i,e,r),le(l,e,null),n=!0},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Ku(t){let e,l,n;return l=new Tm({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&4&&(u.json=i[2]),r&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Yu(t){let e,l,n;return l=new Am({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&8&&(u.json=i[3]),r&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Qu(t){let e,l,n;return l=new Dm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&16&&(u.json=i[4]),r&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Xu(t){let e,l,n;return l=new Lm({props:{json:t[5]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&32&&(u.json=i[5]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Um(t){let e,l=Ke(t[1].ui.i,t[0].i),n,i=Ke(t[1].ui.e,t[0].om||t[0].e>0),r,u=Ke(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,c=Ke(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,_=Ke(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),p,b=Ke(t[1].ui.c,t[0].ea),v,d=Ke(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),S,y=Ke(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),T,N=Ke(t[1].ui.d,t[3]),E,B=Ke(t[1].ui.m,t[4]),P,L=Ke(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),O,F=l&&Uu(t),x=i&&Hu(t),H=u&&ju(t),z=c&&Wu(t),G=_&&zu(t),V=b&&Gu(t),W=d&&Vu(),U=y&&Ku(t),K=N&&Yu(t),j=B&&Qu(t),Y=L&&Xu(t);return{c(){e=m("div"),F&&F.c(),n=h(),x&&x.c(),r=h(),H&&H.c(),a=h(),z&&z.c(),f=h(),G&&G.c(),p=h(),V&&V.c(),v=h(),W&&W.c(),S=h(),U&&U.c(),T=h(),K&&K.c(),E=h(),j&&j.c(),P=h(),Y&&Y.c(),o(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(X,oe){M(X,e,oe),F&&F.m(e,null),s(e,n),x&&x.m(e,null),s(e,r),H&&H.m(e,null),s(e,a),z&&z.m(e,null),s(e,f),G&&G.m(e,null),s(e,p),V&&V.m(e,null),s(e,v),W&&W.m(e,null),s(e,S),U&&U.m(e,null),s(e,T),K&&K.m(e,null),s(e,E),j&&j.m(e,null),s(e,P),Y&&Y.m(e,null),O=!0},p(X,[oe]){oe&3&&(l=Ke(X[1].ui.i,X[0].i)),l?F?(F.p(X,oe),oe&3&&D(F,1)):(F=Uu(X),F.c(),D(F,1),F.m(e,n)):F&&(De(),q(F,1,1,()=>{F=null}),Ie()),oe&3&&(i=Ke(X[1].ui.e,X[0].om||X[0].e>0)),i?x?(x.p(X,oe),oe&3&&D(x,1)):(x=Hu(X),x.c(),D(x,1),x.m(e,r)):x&&(De(),q(x,1,1,()=>{x=null}),Ie()),oe&3&&(u=Ke(X[1].ui.v,X[0].u1>100||X[0].u2>100||X[0].u3>100)),u?H?(H.p(X,oe),oe&3&&D(H,1)):(H=ju(X),H.c(),D(H,1),H.m(e,a)):H&&(De(),q(H,1,1,()=>{H=null}),Ie()),oe&3&&(c=Ke(X[1].ui.a,X[0].i1>.01||X[0].i2>.01||X[0].i3>.01)),c?z?(z.p(X,oe),oe&3&&D(z,1)):(z=Wu(X),z.c(),D(z,1),z.m(e,f)):z&&(De(),q(z,1,1,()=>{z=null}),Ie()),oe&3&&(_=Ke(X[1].ui.r,X[0].ri>0||X[0].re>0||X[0].ric>0||X[0].rec>0)),_?G?(G.p(X,oe),oe&3&&D(G,1)):(G=zu(X),G.c(),D(G,1),G.m(e,p)):G&&(De(),q(G,1,1,()=>{G=null}),Ie()),oe&3&&(b=Ke(X[1].ui.c,X[0].ea)),b?V?(V.p(X,oe),oe&3&&D(V,1)):(V=Gu(X),V.c(),D(V,1),V.m(e,v)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),oe&3&&(d=Ke(X[1].ui.t,X[0].pr&&(X[0].pr.startsWith("10YNO")||X[0].pr.startsWith("10Y1001A1001A4")))),d?W?oe&3&&D(W,1):(W=Vu(),W.c(),D(W,1),W.m(e,S)):W&&(De(),q(W,1,1,()=>{W=null}),Ie()),oe&3&&(y=Ke(X[1].ui.p,X[0].pe&&!Number.isNaN(X[0].p))),y?U?(U.p(X,oe),oe&3&&D(U,1)):(U=Ku(X),U.c(),D(U,1),U.m(e,T)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),oe&10&&(N=Ke(X[1].ui.d,X[3])),N?K?(K.p(X,oe),oe&10&&D(K,1)):(K=Yu(X),K.c(),D(K,1),K.m(e,E)):K&&(De(),q(K,1,1,()=>{K=null}),Ie()),oe&18&&(B=Ke(X[1].ui.m,X[4])),B?j?(j.p(X,oe),oe&18&&D(j,1)):(j=Qu(X),j.c(),D(j,1),j.m(e,P)):j&&(De(),q(j,1,1,()=>{j=null}),Ie()),oe&35&&(L=Ke(X[1].ui.s,X[0].t&&X[0].t!=-127&&X[5].c>1)),L?Y?(Y.p(X,oe),oe&35&&D(Y,1)):(Y=Xu(X),Y.c(),D(Y,1),Y.m(e,null)):Y&&(De(),q(Y,1,1,()=>{Y=null}),Ie())},i(X){O||(D(F),D(x),D(H),D(z),D(G),D(V),D(W),D(U),D(K),D(j),D(Y),O=!0)},o(X){q(F),q(x),q(H),q(z),q(G),q(V),q(W),q(U),q(K),q(j),q(Y),O=!1},d(X){X&&C(e),F&&F.d(),x&&x.d(),H&&H.d(),z&&z.d(),G&&G.d(),V&&V.d(),W&&W.d(),U&&U.d(),K&&K.d(),j&&j.d(),Y&&Y.d()}}}function Hm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,r={},u={},a={},c={};return yr.subscribe(f=>{l(2,r=f)}),Uc.subscribe(f=>{l(3,u=f)}),Hc.subscribe(f=>{l(4,a=f)}),Wc.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,r,u,a,c]}class jm extends Ee{constructor(e){super(),Pe(this,e,Hm,Um,Ne,{data:0,sysinfo:1})}}let fr={};const Ci=at(fr);async function Wm(){fr=await(await fetch("/configuration.json")).json(),Ci.set(fr)}function Zu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function zm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Gm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Ju(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function xu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,r){M(i,e,r),M(i,l,r),M(i,n,r)},d(i){i&&C(e),i&&C(l),i&&C(n)}}}function ef(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function tf(t){let e,l,n;return{c(){e=m("option"),l=$("GPIO"),n=$(t[4]),e.__value=t[4],e.value=e.__value},m(i,r){M(i,e,r),s(e,l),s(e,n)},d(i){i&&C(e)}}}function lf(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))&&tf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=tf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&C(e)}}}function Vm(t){let e,l,n,i,r;function u(d,S){return d[0]=="esp32c3"?Gm:zm}let a=u(t),c=a(t),f=t[0]=="esp8266"&&Ju(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&xu(),p=t[0]=="esp32s2"&&ef(),b={length:t[1]+1},v=[];for(let d=0;d{"chip"in r&&l(0,n=r.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Zc extends Ee{constructor(e){super(),Pe(this,e,Km,Vm,Ne,{chip:0})}}function nf(t){let e,l,n=t[1]&&sf(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),o(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),o(e,"class","z-50"),o(e,"aria-modal","true")},m(i,r){M(i,e,r),s(e,l),n&&n.m(l,null)},p(i,r){i[1]?n?n.p(i,r):(n=sf(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&C(e),n&&n.d()}}}function sf(t){let e,l;return{c(){e=m("div"),l=$(t[1]),o(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){M(n,e,i),s(e,l)},p(n,i){i&2&&Z(l,n[1])},d(n){n&&C(e)}}}function Ym(t){let e,l=t[0]&&nf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=nf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function Qm(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=r=>{"active"in r&&l(0,n=r.active),"message"in r&&l(1,i=r.message)},[n,i]}class It extends Ee{constructor(e){super(),Pe(this,e,Qm,Ym,Ne,{active:0,message:1})}}function rf(t,e,l){const n=t.slice();return n[1]=e[l],n}function of(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=$("Europe/"),i=$(n),e.__value="Europe/"+t[1],e.value=e.__value},m(r,u){M(r,e,u),s(e,l),s(e,i)},p:fe,d(r){r&&C(e)}}}function Xm(t){let e,l,n,i=t[0],r=[];for(let u=0;u>1&1,A=0;A0;g--)A[g]=A[g]?A[g-1]^P.EXPONENT[F._modN(P.LOG[A[g]]+w)]:A[g-1];A[0]=P.EXPONENT[F._modN(P.LOG[A[0]]+w)]}for(w=0;w<=k;w++)A[w]=P.LOG[A[w]]},_checkBadness:function(){var w,g,k,A,I,Q=0,J=this._badness,se=this.buffer,ce=this.width;for(I=0;Ice*ce;)re-=ce*ce,Se++;for(Q+=Se*F.N4,A=0;A=J-2&&(w=J-2,I>9&&w--);var se=w;if(I>9){for(Q[se+2]=0,Q[se+3]=0;se--;)g=Q[se],Q[se+3]|=255&g<<4,Q[se+2]=g>>4;Q[2]|=255&w<<4,Q[1]=w>>4,Q[0]=64|w>>12}else{for(Q[se+1]=0,Q[se+2]=0;se--;)g=Q[se],Q[se+2]|=255&g<<4,Q[se+1]=g>>4;Q[1]|=255&w<<4,Q[0]=64|w>>4}for(se=w+3-(I<10);se=5&&(k+=F.N1+A[g]-5);for(g=3;gw||A[g-3]*3>=A[g]*4||A[g+3]*3>=A[g]*4)&&(k+=F.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var w,g,k=0,A=3e4;for(g=0;g<8&&(this._applyMask(g),w=this._checkBadness(),w>=1)A&1&&(I[Q-1-g+Q*8]=1,g<6?I[8+Q*g]=1:I[8+Q*(g+1)]=1);for(g=0;g<7;g++,A>>=1)A&1&&(I[8+Q*(Q-7+g)]=1,g?I[6-g+Q*8]=1:I[7+Q*8]=1)},_interleaveBlocks:function(){var w,g,k=this._dataBlock,A=this._ecc,I=this._eccBlock,Q=0,J=this._calculateMaxLength(),se=this._neccBlock1,ce=this._neccBlock2,ve=this._stringBuffer;for(w=0;w1)for(w=T.BLOCK[A],k=I-7;;){for(g=I-7;g>w-3&&(this._addAlignment(g,k),!(g6)for(w=O.BLOCK[Q-7],g=17,k=0;k<6;k++)for(A=0;A<3;A++,g--)1&(g>11?Q>>g-12:w>>g)?(I[5-k+J*(2-A+J-11)]=1,I[2-A+J-11+J*(5-k)]=1):(this._setMask(5-k,2-A+J-11),this._setMask(2-A+J-11,5-k))},_isMasked:function(w,g){var k=F._getMaskBit(w,g);return this._mask[k]===1},_pack:function(){var w,g,k,A=1,I=1,Q=this.width,J=Q-1,se=Q-1,ce=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(g=0;gg&&(k=w,w=g,g=k),k=g,k+=g*g,k>>=1,k+=w,k},_modN:function(w){for(;w>=255;)w-=255,w=(w>>8)+(w&255);return w},N1:3,N2:3,N3:40,N4:10}),x=F,H=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var w=this.element;w.width=w.height=this.qrious.size}}),z=H,G=p.extend(function(w,g,k,A){this.name=w,this.modifiable=Boolean(g),this.defaultValue=k,this._valueTransformer=A},{transform:function(w){var g=this._valueTransformer;return typeof g=="function"?g(w,this):w}}),V=G,W=p.extend(null,{abs:function(w){return w!=null?Math.abs(w):null},hasOwn:function(w,g){return Object.prototype.hasOwnProperty.call(w,g)},noop:function(){},toUpperCase:function(w){return w!=null?w.toUpperCase():null}}),U=W,K=p.extend(function(w){this.options={},w.forEach(function(g){this.options[g.name]=g},this)},{exists:function(w){return this.options[w]!=null},get:function(w,g){return K._get(this.options[w],g)},getAll:function(w){var g,k=this.options,A={};for(g in k)U.hasOwn(k,g)&&(A[g]=K._get(k[g],w));return A},init:function(w,g,k){typeof k!="function"&&(k=U.noop);var A,I;for(A in this.options)U.hasOwn(this.options,A)&&(I=this.options[A],K._set(I,I.defaultValue,g),K._createAccessor(I,g,k));this._setAll(w,g,!0)},set:function(w,g,k){return this._set(w,g,k)},setAll:function(w,g){return this._setAll(w,g)},_set:function(w,g,k,A){var I=this.options[w];if(!I)throw new Error("Invalid option: "+w);if(!I.modifiable&&!A)throw new Error("Option cannot be modified: "+w);return K._set(I,g,k)},_setAll:function(w,g,k){if(!w)return!1;var A,I=!1;for(A in w)U.hasOwn(w,A)&&this._set(A,w[A],g,k)&&(I=!0);return I}},{_createAccessor:function(w,g,k){var A={get:function(){return K._get(w,g)}};w.modifiable&&(A.set=function(I){K._set(w,I,g)&&k(I,w)}),Object.defineProperty(g,w.name,A)},_get:function(w,g){return g["_"+w.name]},_set:function(w,g,k){var A="_"+w.name,I=k[A],Q=w.transform(g!=null?g:w.defaultValue);return k[A]=Q,Q!==I}}),j=K,Y=p.extend(function(){this._services={}},{getService:function(w){var g=this._services[w];if(!g)throw new Error("Service is not being managed with name: "+w);return g},setService:function(w,g){if(this._services[w])throw new Error("Service is already managed with name: "+w);g&&(this._services[w]=g)}}),X=Y,oe=new j([new V("background",!0,"white"),new V("backgroundAlpha",!0,1,U.abs),new V("element"),new V("foreground",!0,"black"),new V("foregroundAlpha",!0,1,U.abs),new V("level",!0,"L",U.toUpperCase),new V("mime",!0,"image/png"),new V("padding",!0,null,U.abs),new V("size",!0,100,U.abs),new V("value",!0,"")]),ue=new X,ke=p.extend(function(w){oe.init(w,this,this.update.bind(this));var g=oe.get("element",this),k=ue.getService("element"),A=g&&k.isCanvas(g)?g:k.createCanvas(),I=g&&k.isImage(g)?g:k.createImage();this._canvasRenderer=new S(this,A,!0),this._imageRenderer=new z(this,I,I===g),this.update()},{get:function(){return oe.getAll(this)},set:function(w){oe.setAll(w,this)&&this.update()},toDataURL:function(w){return this.canvas.toDataURL(w||this.mime)},update:function(){var w=new x({level:this.level,value:this.value});this._canvasRenderer.render(w),this._imageRenderer.render(w)}},{use:function(w){ue.setService(w.getName(),w)}});Object.defineProperties(ke.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var me=ke,Te=me,He=p.extend({getName:function(){}}),Re=He,je=Re.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(w){},isImage:function(w){}}),we=je,$e=we.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(w){return w instanceof HTMLCanvasElement},isImage:function(w){return w instanceof HTMLImageElement}}),Le=$e;Te.use(new Le);var Me=Te;return Me})})(xc);const lp=xc.exports;function np(t){let e,l;return{c(){e=m("img"),Js(e.src,l=t[2])||o(e,"src",l),o(e,"alt",t[0]),o(e,"class",t[1])},m(n,i){M(n,e,i)},p(n,[i]){i&4&&!Js(e.src,l=n[2])&&o(e,"src",l),i&1&&o(e,"alt",n[0]),i&2&&o(e,"class",n[1])},i:fe,o:fe,d(n){n&&C(e)}}}function ip(t,e,l){const n=new lp;let{errorCorrection:i="L"}=e,{background:r="#fff"}=e,{color:u="#000"}=e,{size:a="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:_="qrcode"}=e,p="";function b(){n.set({background:r,foreground:u,level:i,padding:f,size:a,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return oc(()=>{b()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,r=v.background),"color"in v&&l(5,u=v.color),"size"in v&&l(6,a=v.size),"value"in v&&l(0,c=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,_=v.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&b()},[c,_,p,i,r,u,a,f]}class sp extends Ee{constructor(e){super(),Pe(this,e,ip,np,Ne,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function af(t,e,l){const n=t.slice();return n[95]=e[l],n[96]=e,n[97]=l,n}function uf(t,e,l){const n=t.slice();return n[98]=e[l],n[99]=e,n[100]=l,n}function rp(t,e,l){const n=t.slice();return n[101]=e[l],n}function op(t,e,l){const n=t.slice();return n[104]=e[l],n}function ap(t){let e,l;return{c(){e=m("option"),l=$(t[104]),e.__value=t[104],e.value=e.__value},m(n,i){M(n,e,i),s(e,l)},p:fe,d(n){n&&C(e)}}}function ff(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),o(l,"name","pt"),o(l,"type","text"),o(l,"class","in-s"),o(l,"placeholder","ENTSO-E API key, optional, read docs")},m(r,u){M(r,e,u),M(r,l,u),te(l,t[3].p.t),n||(i=ee(l,"input",t[22]),n=!0)},p(r,u){u[0]&8&&l.value!==r[3].p.t&&te(l,r[3].p.t)},d(r){r&&C(e),r&&C(l),n=!1,i()}}}function cf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v;return{c(){e=m("div"),l=$("Username"),n=m("br"),i=h(),r=m("input"),u=h(),a=m("div"),c=$("Password"),f=m("br"),_=h(),p=m("input"),o(r,"name","gu"),o(r,"type","text"),o(r,"class","in-s"),o(e,"class","my-1"),o(p,"name","gp"),o(p,"type","password"),o(p,"class","in-s"),o(a,"class","my-1")},m(d,S){M(d,e,S),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].g.u),M(d,u,S),M(d,a,S),s(a,c),s(a,f),s(a,_),s(a,p),te(p,t[3].g.p),b||(v=[ee(r,"input",t[24]),ee(p,"input",t[25])],b=!0)},p(d,S){S[0]&8&&r.value!==d[3].g.u&&te(r,d[3].g.u),S[0]&8&&p.value!==d[3].g.p&&te(p,d[3].g.p)},d(d){d&&C(e),d&&C(u),d&&C(a),b=!1,ze(v)}}}function up(t){let e,l=t[101]*100+"",n;return{c(){e=m("option"),n=$(l),e.__value=t[101]*100,e.value=e.__value},m(i,r){M(i,e,r),s(e,n)},p:fe,d(i){i&&C(e)}}}function mf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),o(l,"name","mek"),o(l,"type","text"),o(l,"class","in-s")},m(r,u){M(r,e,u),M(r,l,u),te(l,t[3].m.e.k),n||(i=ee(l,"input",t[34]),n=!0)},p(r,u){u[0]&8&&l.value!==r[3].m.e.k&&te(l,r[3].m.e.k)},d(r){r&&C(e),r&&C(l),n=!1,i()}}}function pf(t){let e,l,n,i,r,u,a;return{c(){e=m("div"),l=$("Authentication key"),n=m("br"),i=h(),r=m("input"),o(r,"name","mea"),o(r,"type","text"),o(r,"class","in-s"),o(e,"class","my-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].m.e.a),u||(a=ee(r,"input",t[35]),u=!0)},p(c,f){f[0]&8&&r.value!==c[3].m.e.a&&te(r,c[3].m.e.a)},d(c){c&&C(e),u=!1,a()}}}function _f(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H;return{c(){e=m("div"),l=m("div"),n=$("Watt"),i=m("br"),r=h(),u=m("input"),a=h(),c=m("div"),f=$("Volt"),_=m("br"),p=h(),b=m("input"),v=h(),d=m("div"),S=$("Amp"),y=m("br"),T=h(),N=m("input"),E=h(),B=m("div"),P=$("kWh"),L=m("br"),O=h(),F=m("input"),o(u,"name","mmw"),o(u,"type","number"),o(u,"min","0.00"),o(u,"max","1000"),o(u,"step","0.001"),o(u,"class","in-f tr w-full"),o(l,"class","w-1/4"),o(b,"name","mmv"),o(b,"type","number"),o(b,"min","0.00"),o(b,"max","1000"),o(b,"step","0.001"),o(b,"class","in-m tr w-full"),o(c,"class","w-1/4"),o(N,"name","mma"),o(N,"type","number"),o(N,"min","0.00"),o(N,"max","1000"),o(N,"step","0.001"),o(N,"class","in-m tr w-full"),o(d,"class","w-1/4"),o(F,"name","mmc"),o(F,"type","number"),o(F,"min","0.00"),o(F,"max","1000"),o(F,"step","0.001"),o(F,"class","in-l tr w-full"),o(B,"class","w-1/4"),o(e,"class","flex my-1")},m(z,G){M(z,e,G),s(e,l),s(l,n),s(l,i),s(l,r),s(l,u),te(u,t[3].m.m.w),s(e,a),s(e,c),s(c,f),s(c,_),s(c,p),s(c,b),te(b,t[3].m.m.v),s(e,v),s(e,d),s(d,S),s(d,y),s(d,T),s(d,N),te(N,t[3].m.m.a),s(e,E),s(e,B),s(B,P),s(B,L),s(B,O),s(B,F),te(F,t[3].m.m.c),x||(H=[ee(u,"input",t[37]),ee(b,"input",t[38]),ee(N,"input",t[39]),ee(F,"input",t[40])],x=!0)},p(z,G){G[0]&8&&he(u.value)!==z[3].m.m.w&&te(u,z[3].m.m.w),G[0]&8&&he(b.value)!==z[3].m.m.v&&te(b,z[3].m.m.v),G[0]&8&&he(N.value)!==z[3].m.m.a&&te(N,z[3].m.m.a),G[0]&8&&he(F.value)!==z[3].m.m.c&&te(F,z[3].m.m.c)},d(z){z&&C(e),x=!1,ze(H)}}}function df(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y;return{c(){e=m("div"),l=$("Gateway"),n=m("br"),i=h(),r=m("input"),u=h(),a=m("div"),c=$("DNS"),f=m("br"),_=h(),p=m("div"),b=m("input"),v=h(),d=m("input"),o(r,"name","ng"),o(r,"type","text"),o(r,"class","in-s"),o(e,"class","my-1"),o(b,"name","nd1"),o(b,"type","text"),o(b,"class","in-f w-full"),o(d,"name","nd2"),o(d,"type","text"),o(d,"class","in-l w-full"),o(p,"class","flex"),o(a,"class","my-1")},m(T,N){M(T,e,N),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].n.g),M(T,u,N),M(T,a,N),s(a,c),s(a,f),s(a,_),s(a,p),s(p,b),te(b,t[3].n.d1),s(p,v),s(p,d),te(d,t[3].n.d2),S||(y=[ee(r,"input",t[49]),ee(b,"input",t[50]),ee(d,"input",t[51])],S=!0)},p(T,N){N[0]&8&&r.value!==T[3].n.g&&te(r,T[3].n.g),N[0]&8&&b.value!==T[3].n.d1&&te(b,T[3].n.d1),N[0]&8&&d.value!==T[3].n.d2&&te(d,T[3].n.d2)},d(T){T&&C(e),T&&C(u),T&&C(a),S=!1,ze(y)}}}function vf(t){let e,l,n,i,r;return{c(){e=m("label"),l=m("input"),n=$(" SSL"),o(l,"type","checkbox"),o(l,"name","qs"),l.__value="true",l.value=l.__value,o(l,"class","rounded mb-1"),o(e,"class","float-right mr-3")},m(u,a){M(u,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(r=[ee(l,"change",t[55]),ee(l,"change",t[14])],i=!0)},p(u,a){a[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&C(e),i=!1,ze(r)}}}function hf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v;const d=[cp,fp],S=[];function y(O,F){return O[3].q.s.c?0:1}n=y(t),i=S[n]=d[n](t);const T=[dp,_p],N=[];function E(O,F){return O[3].q.s.r?0:1}a=E(t),c=N[a]=T[a](t);const B=[gp,bp],P=[];function L(O,F){return O[3].q.s.k?0:1}return p=L(t),b=P[p]=B[p](t),{c(){e=m("div"),l=m("span"),i.c(),r=h(),u=m("span"),c.c(),f=h(),_=m("span"),b.c(),o(l,"class","flex pr-2"),o(u,"class","flex pr-2"),o(_,"class","flex pr-2"),o(e,"class","my-1 flex")},m(O,F){M(O,e,F),s(e,l),S[n].m(l,null),s(e,r),s(e,u),N[a].m(u,null),s(e,f),s(e,_),P[p].m(_,null),v=!0},p(O,F){let x=n;n=y(O),n===x?S[n].p(O,F):(De(),q(S[x],1,1,()=>{S[x]=null}),Ie(),i=S[n],i?i.p(O,F):(i=S[n]=d[n](O),i.c()),D(i,1),i.m(l,null));let H=a;a=E(O),a===H?N[a].p(O,F):(De(),q(N[H],1,1,()=>{N[H]=null}),Ie(),c=N[a],c?c.p(O,F):(c=N[a]=T[a](O),c.c()),D(c,1),c.m(u,null));let z=p;p=L(O),p===z?P[p].p(O,F):(De(),q(P[z],1,1,()=>{P[z]=null}),Ie(),b=P[p],b?b.p(O,F):(b=P[p]=B[p](O),b.c()),D(b,1),b.m(_,null))},i(O){v||(D(i),D(c),D(b),v=!0)},o(O){q(i),q(c),q(b),v=!1},d(O){O&&C(e),S[n].d(),N[a].d(),P[p].d()}}}function fp(t){let e,l;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[mp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i[3]&16384&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function cp(t){let e,l,n,i,r,u,a,c;return l=new el({props:{to:"/mqtt-ca",$$slots:{default:[pp]},$$scope:{ctx:t}}}),r=new Tr({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(r.$$.fragment),o(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),o(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(r,i,null),u=!0,a||(c=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(r.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(r.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(r),a=!1,ze(c)}}}function mp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function pp(t){let e;return{c(){e=$("CA OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function _p(t){let e,l;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[vp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i[3]&16384&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function dp(t){let e,l,n,i,r,u,a,c;return l=new el({props:{to:"/mqtt-cert",$$slots:{default:[hp]},$$scope:{ctx:t}}}),r=new Tr({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(r.$$.fragment),o(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),o(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(r,i,null),u=!0,a||(c=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(r.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(r.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(r),a=!1,ze(c)}}}function vp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function hp(t){let e;return{c(){e=$("Cert OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function bp(t){let e,l;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[kp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i[3]&16384&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function gp(t){let e,l,n,i,r,u,a,c;return l=new el({props:{to:"/mqtt-key",$$slots:{default:[wp]},$$scope:{ctx:t}}}),r=new Tr({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(r.$$.fragment),o(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),o(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(r,i,null),u=!0,a||(c=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(r.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(r.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(r),a=!1,ze(c)}}}function kp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function wp(t){let e;return{c(){e=$("Key OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function bf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K;return r=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),ie(r.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=m("div"),p=$("Electricity IDX"),b=m("br"),v=h(),d=m("input"),S=h(),y=m("div"),T=$("Current IDX"),N=m("br"),E=h(),B=m("input"),P=h(),L=m("div"),O=$(`Voltage IDX: L1, L2 & L3 - `),F=m("div"),x=m("input"),H=h(),z=m("input"),G=h(),V=m("input"),o(l,"class","text-sm"),o(i,"href",Ut("MQTT-configuration#domoticz")),o(i,"target","_blank"),o(i,"class","float-right"),o(a,"type","hidden"),o(a,"name","o"),a.value="true",o(d,"name","oe"),o(d,"type","text"),o(d,"class","in-f tr w-full"),o(_,"class","w-1/2"),o(B,"name","oc"),o(B,"type","text"),o(B,"class","in-l tr w-full"),o(y,"class","w-1/2"),o(f,"class","my-1 flex"),o(x,"name","ou1"),o(x,"type","text"),o(x,"class","in-f tr w-1/3"),o(z,"name","ou2"),o(z,"type","text"),o(z,"class","in-m tr w-1/3"),o(V,"name","ou3"),o(V,"type","text"),o(V,"class","in-l tr w-1/3"),o(F,"class","flex"),o(L,"class","my-1"),o(e,"class","cnt")},m(j,Y){M(j,e,Y),s(e,l),s(e,n),s(e,i),le(r,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].o.e),s(f,S),s(f,y),s(y,T),s(y,N),s(y,E),s(y,B),te(B,t[3].o.c),s(e,P),s(e,L),s(L,O),s(L,F),s(F,x),te(x,t[3].o.u1),s(F,H),s(F,z),te(z,t[3].o.u2),s(F,G),s(F,V),te(V,t[3].o.u3),W=!0,U||(K=[ee(d,"input",t[63]),ee(B,"input",t[64]),ee(x,"input",t[65]),ee(z,"input",t[66]),ee(V,"input",t[67])],U=!0)},p(j,Y){Y[0]&8&&d.value!==j[3].o.e&&te(d,j[3].o.e),Y[0]&8&&B.value!==j[3].o.c&&te(B,j[3].o.c),Y[0]&8&&x.value!==j[3].o.u1&&te(x,j[3].o.u1),Y[0]&8&&z.value!==j[3].o.u2&&te(z,j[3].o.u2),Y[0]&8&&V.value!==j[3].o.u3&&te(V,j[3].o.u3)},i(j){W||(D(r.$$.fragment,j),W=!0)},o(j){q(r.$$.fragment,j),W=!1},d(j){j&&C(e),ne(r),U=!1,ze(K)}}}function gf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V;return r=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),ie(r.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=$("Discovery topic prefix"),p=m("br"),b=h(),v=m("input"),d=h(),S=m("div"),y=$("Hostname for URL"),T=m("br"),N=h(),E=m("input"),P=h(),L=m("div"),O=$("Name tag"),F=m("br"),x=h(),H=m("input"),o(l,"class","text-sm"),o(i,"href",Ut("MQTT-configuration#home-assistant")),o(i,"target","_blank"),o(i,"class","float-right"),o(a,"type","hidden"),o(a,"name","h"),a.value="true",o(v,"name","ht"),o(v,"type","text"),o(v,"class","in-s"),o(v,"placeholder","homeassistant"),o(f,"class","my-1"),o(E,"name","hh"),o(E,"type","text"),o(E,"class","in-s"),o(E,"placeholder",B=t[3].g.h+".local"),o(S,"class","my-1"),o(H,"name","hn"),o(H,"type","text"),o(H,"class","in-s"),o(L,"class","my-1"),o(e,"class","cnt")},m(W,U){M(W,e,U),s(e,l),s(e,n),s(e,i),le(r,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(f,p),s(f,b),s(f,v),te(v,t[3].h.t),s(e,d),s(e,S),s(S,y),s(S,T),s(S,N),s(S,E),te(E,t[3].h.h),s(e,P),s(e,L),s(L,O),s(L,F),s(L,x),s(L,H),te(H,t[3].h.n),z=!0,G||(V=[ee(v,"input",t[68]),ee(E,"input",t[69]),ee(H,"input",t[70])],G=!0)},p(W,U){U[0]&8&&v.value!==W[3].h.t&&te(v,W[3].h.t),(!z||U[0]&8&&B!==(B=W[3].g.h+".local"))&&o(E,"placeholder",B),U[0]&8&&E.value!==W[3].h.h&&te(E,W[3].h.h),U[0]&8&&H.value!==W[3].h.n&&te(H,W[3].h.n)},i(W){z||(D(r.$$.fragment,W),z=!0)},o(W){q(r.$$.fragment,W),z=!1},d(W){W&&C(e),ne(r),G=!1,ze(V)}}}function kf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d=t[3].c.es&&wf(t);return{c(){e=m("div"),l=m("input"),n=h(),i=m("strong"),i.textContent="Cloud connections",r=h(),u=m("div"),a=m("label"),c=m("input"),f=$(" Energy Speedometer"),_=h(),d&&d.c(),o(l,"type","hidden"),o(l,"name","c"),l.value="true",o(i,"class","text-sm"),o(c,"type","checkbox"),o(c,"class","rounded mb-1"),o(c,"name","ces"),c.__value="true",c.value=c.__value,o(u,"class","my-1"),o(e,"class","cnt")},m(S,y){M(S,e,y),s(e,l),s(e,n),s(e,i),s(e,r),s(e,u),s(u,a),s(a,c),c.checked=t[3].c.es,s(a,f),s(u,_),d&&d.m(u,null),p=!0,b||(v=ee(c,"change",t[71]),b=!0)},p(S,y){y[0]&8&&(c.checked=S[3].c.es),S[3].c.es?d?(d.p(S,y),y[0]&8&&D(d,1)):(d=wf(S),d.c(),D(d,1),d.m(u,null)):d&&(De(),q(d,1,1,()=>{d=null}),Ie())},i(S){p||(D(d),p=!0)},o(S){q(d),p=!1},d(S){S&&C(e),d&&d.d(),b=!1,v()}}}function wf(t){let e,l,n=t[0].mac+"",i,r,u,a,c=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,_,p,b,v=t[0].mac&&t[0].meter.id&&yf(t);return{c(){e=m("div"),l=$("MAC: "),i=$(n),r=h(),u=m("div"),a=$("Meter ID: "),f=$(c),_=h(),v&&v.c(),p=Ve(),o(e,"class","pl-5"),o(u,"class","pl-5")},m(d,S){M(d,e,S),s(e,l),s(e,i),M(d,r,S),M(d,u,S),s(u,a),s(u,f),M(d,_,S),v&&v.m(d,S),M(d,p,S),b=!0},p(d,S){(!b||S[0]&1)&&n!==(n=d[0].mac+"")&&Z(i,n),(!b||S[0]&1)&&c!==(c=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&Z(f,c),d[0].mac&&d[0].meter.id?v?(v.p(d,S),S[0]&1&&D(v,1)):(v=yf(d),v.c(),D(v,1),v.m(p.parentNode,p)):v&&(De(),q(v,1,1,()=>{v=null}),Ie())},i(d){b||(D(v),b=!0)},o(d){q(v),b=!1},d(d){d&&C(e),d&&C(r),d&&C(u),d&&C(_),v&&v.d(d),d&&C(p)}}}function yf(t){let e,l,n;return l=new sp({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","pl-2")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Cf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E;r=new Bt({});let B={length:9},P=[];for(let L=0;L20&&$f(t),_=t[0].chip=="esp8266"&&Pf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),ie(r.$$.fragment),u=h(),f&&f.c(),a=h(),_&&_.c(),o(l,"class","text-sm"),o(i,"href",Ut("GPIO-configuration")),o(i,"target","_blank"),o(i,"class","float-right"),o(e,"class","cnt")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),le(r,i,null),s(e,u),f&&f.m(e,null),s(e,a),_&&_.m(e,null),c=!0},p(p,b){p[0].board>20?f?(f.p(p,b),b[0]&1&&D(f,1)):(f=$f(p),f.c(),D(f,1),f.m(e,a)):f&&(De(),q(f,1,1,()=>{f=null}),Ie()),p[0].chip=="esp8266"?_?_.p(p,b):(_=Pf(p),_.c(),_.m(e,null)):_&&(_.d(1),_=null)},i(p){c||(D(r.$$.fragment,p),D(f),c=!0)},o(p){q(r.$$.fragment,p),q(f),c=!1},d(p){p&&C(e),ne(r),f&&f.d(),_&&_.d()}}}function $f(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,Te,He,Re,je,we,$e,Le,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,re;b=new Zc({props:{chip:t[0].chip}});let pe=t[0].chip!="esp8266"&&Nf(t),Be=t[3].i.v.p>0&&Af(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),r=$("HAN"),u=m("label"),a=m("input"),c=$(" pullup"),f=m("br"),_=h(),p=m("select"),ie(b.$$.fragment),v=h(),d=m("div"),S=$("AP button"),y=m("br"),T=h(),N=m("input"),E=h(),B=m("div"),P=$("LED"),L=m("label"),O=m("input"),F=$(" inv"),x=m("br"),H=h(),z=m("div"),G=m("input"),V=h(),W=m("div"),U=$("RGB"),K=m("label"),j=m("input"),Y=$(" inverted"),X=m("br"),oe=h(),ue=m("div"),ke=m("input"),me=h(),Te=m("input"),He=h(),Re=m("input"),je=h(),we=m("div"),$e=$("Temperature"),Le=m("br"),Me=h(),w=m("input"),g=h(),k=m("div"),A=$("Analog temp"),I=m("br"),Q=h(),J=m("input"),se=h(),pe&&pe.c(),ce=h(),Be&&Be.c(),o(e,"type","hidden"),o(e,"name","i"),e.value="true",o(a,"name","ihu"),a.__value="true",a.value=a.__value,o(a,"type","checkbox"),o(a,"class","rounded mb-1"),o(u,"class","ml-2"),o(p,"name","ihp"),o(p,"class","in-f w-full"),t[3].i.h.p===void 0&&Qe(()=>t[76].call(p)),o(i,"class","w-1/3"),o(N,"name","ia"),o(N,"type","number"),o(N,"min","0"),o(N,"max",t[6]),o(N,"class","in-m tr w-full"),o(d,"class","w-1/3"),o(O,"name","ili"),O.__value="true",O.value=O.__value,o(O,"type","checkbox"),o(O,"class","rounded mb-1"),o(L,"class","ml-4"),o(G,"name","ilp"),o(G,"type","number"),o(G,"min","0"),o(G,"max",t[6]),o(G,"class","in-l tr w-full"),o(z,"class","flex"),o(B,"class","w-1/3"),o(j,"name","iri"),j.__value="true",j.value=j.__value,o(j,"type","checkbox"),o(j,"class","rounded mb-1"),o(K,"class","ml-4"),o(ke,"name","irr"),o(ke,"type","number"),o(ke,"min","0"),o(ke,"max",t[6]),o(ke,"class","in-f tr w-1/3"),o(Te,"name","irg"),o(Te,"type","number"),o(Te,"min","0"),o(Te,"max",t[6]),o(Te,"class","in-m tr w-1/3"),o(Re,"name","irb"),o(Re,"type","number"),o(Re,"min","0"),o(Re,"max",t[6]),o(Re,"class","in-l tr w-1/3"),o(ue,"class","flex"),o(W,"class","w-full"),o(w,"name","itd"),o(w,"type","number"),o(w,"min","0"),o(w,"max",t[6]),o(w,"class","in-f tr w-full"),o(we,"class","my-1 w-1/3"),o(J,"name","ita"),o(J,"type","number"),o(J,"min","0"),o(J,"max",t[6]),o(J,"class","in-l tr w-full"),o(k,"class","my-1 pr-1 w-1/3"),o(n,"class","flex flex-wrap")},m(_e,ye){M(_e,e,ye),M(_e,l,ye),M(_e,n,ye),s(n,i),s(i,r),s(i,u),s(u,a),a.checked=t[3].i.h.u,s(u,c),s(i,f),s(i,_),s(i,p),le(b,p,null),qe(p,t[3].i.h.p,!0),s(n,v),s(n,d),s(d,S),s(d,y),s(d,T),s(d,N),te(N,t[3].i.a),s(n,E),s(n,B),s(B,P),s(B,L),s(L,O),O.checked=t[3].i.l.i,s(L,F),s(B,x),s(B,H),s(B,z),s(z,G),te(G,t[3].i.l.p),s(n,V),s(n,W),s(W,U),s(W,K),s(K,j),j.checked=t[3].i.r.i,s(K,Y),s(W,X),s(W,oe),s(W,ue),s(ue,ke),te(ke,t[3].i.r.r),s(ue,me),s(ue,Te),te(Te,t[3].i.r.g),s(ue,He),s(ue,Re),te(Re,t[3].i.r.b),s(n,je),s(n,we),s(we,$e),s(we,Le),s(we,Me),s(we,w),te(w,t[3].i.t.d),s(n,g),s(n,k),s(k,A),s(k,I),s(k,Q),s(k,J),te(J,t[3].i.t.a),s(n,se),pe&&pe.m(n,null),s(n,ce),Be&&Be.m(n,null),ve=!0,Se||(re=[ee(a,"change",t[75]),ee(p,"change",t[76]),ee(N,"input",t[77]),ee(O,"change",t[78]),ee(G,"input",t[79]),ee(j,"change",t[80]),ee(ke,"input",t[81]),ee(Te,"input",t[82]),ee(Re,"input",t[83]),ee(w,"input",t[84]),ee(J,"input",t[85])],Se=!0)},p(_e,ye){ye[0]&8&&(a.checked=_e[3].i.h.u);const vt={};ye[0]&1&&(vt.chip=_e[0].chip),b.$set(vt),ye[0]&8&&qe(p,_e[3].i.h.p),(!ve||ye[0]&64)&&o(N,"max",_e[6]),ye[0]&8&&he(N.value)!==_e[3].i.a&&te(N,_e[3].i.a),ye[0]&8&&(O.checked=_e[3].i.l.i),(!ve||ye[0]&64)&&o(G,"max",_e[6]),ye[0]&8&&he(G.value)!==_e[3].i.l.p&&te(G,_e[3].i.l.p),ye[0]&8&&(j.checked=_e[3].i.r.i),(!ve||ye[0]&64)&&o(ke,"max",_e[6]),ye[0]&8&&he(ke.value)!==_e[3].i.r.r&&te(ke,_e[3].i.r.r),(!ve||ye[0]&64)&&o(Te,"max",_e[6]),ye[0]&8&&he(Te.value)!==_e[3].i.r.g&&te(Te,_e[3].i.r.g),(!ve||ye[0]&64)&&o(Re,"max",_e[6]),ye[0]&8&&he(Re.value)!==_e[3].i.r.b&&te(Re,_e[3].i.r.b),(!ve||ye[0]&64)&&o(w,"max",_e[6]),ye[0]&8&&he(w.value)!==_e[3].i.t.d&&te(w,_e[3].i.t.d),(!ve||ye[0]&64)&&o(J,"max",_e[6]),ye[0]&8&&he(J.value)!==_e[3].i.t.a&&te(J,_e[3].i.t.a),_e[0].chip!="esp8266"?pe?pe.p(_e,ye):(pe=Nf(_e),pe.c(),pe.m(n,ce)):pe&&(pe.d(1),pe=null),_e[3].i.v.p>0?Be?Be.p(_e,ye):(Be=Af(_e),Be.c(),Be.m(n,null)):Be&&(Be.d(1),Be=null)},i(_e){ve||(D(b.$$.fragment,_e),ve=!0)},o(_e){q(b.$$.fragment,_e),ve=!1},d(_e){_e&&C(e),_e&&C(l),_e&&C(n),ne(b),pe&&pe.d(),Be&&Be.d(),Se=!1,ze(re)}}}function Nf(t){let e,l,n,i,r,u,a;return{c(){e=m("div"),l=$("Vcc"),n=m("br"),i=h(),r=m("input"),o(r,"name","ivp"),o(r,"type","number"),o(r,"min","0"),o(r,"max",t[6]),o(r,"class","in-s tr w-full"),o(e,"class","my-1 pl-1 w-1/3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].i.v.p),u||(a=ee(r,"input",t[86]),u=!0)},p(c,f){f[0]&64&&o(r,"max",c[6]),f[0]&8&&he(r.value)!==c[3].i.v.p&&te(r,c[3].i.v.p)},d(c){c&&C(e),u=!1,a()}}}function Af(t){let e,l,n,i,r,u,a,c,f,_;return{c(){e=m("div"),l=$("Voltage divider"),n=m("br"),i=h(),r=m("div"),u=m("input"),a=h(),c=m("input"),o(u,"name","ivdv"),o(u,"type","number"),o(u,"min","0"),o(u,"max","65535"),o(u,"class","in-f tr w-full"),o(u,"placeholder","VCC"),o(c,"name","ivdg"),o(c,"type","number"),o(c,"min","0"),o(c,"max","65535"),o(c,"class","in-l tr w-full"),o(c,"placeholder","GND"),o(r,"class","flex"),o(e,"class","my-1")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),s(e,r),s(r,u),te(u,t[3].i.v.d.v),s(r,a),s(r,c),te(c,t[3].i.v.d.g),f||(_=[ee(u,"input",t[87]),ee(c,"input",t[88])],f=!0)},p(p,b){b[0]&8&&he(u.value)!==p[3].i.v.d.v&&te(u,p[3].i.v.d.v),b[0]&8&&he(c.value)!==p[3].i.v.d.g&&te(c,p[3].i.v.d.g)},d(p){p&&C(e),f=!1,ze(_)}}}function Pf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N=(t[0].board==2||t[0].board==100)&&Ef(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),r=$("Vcc offset"),u=m("br"),a=h(),c=m("input"),f=h(),_=m("div"),p=$("Multiplier"),b=m("br"),v=h(),d=m("input"),S=h(),N&&N.c(),o(e,"type","hidden"),o(e,"name","iv"),e.value="true",o(c,"name","ivo"),o(c,"type","number"),o(c,"min","0.0"),o(c,"max","3.5"),o(c,"step","0.01"),o(c,"class","in-f tr w-full"),o(i,"class","w-1/3"),o(d,"name","ivm"),o(d,"type","number"),o(d,"min","0.1"),o(d,"max","10"),o(d,"step","0.01"),o(d,"class","in-l tr w-full"),o(_,"class","w-1/3 pr-1"),o(n,"class","my-1 flex flex-wrap")},m(E,B){M(E,e,B),M(E,l,B),M(E,n,B),s(n,i),s(i,r),s(i,u),s(i,a),s(i,c),te(c,t[3].i.v.o),s(n,f),s(n,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].i.v.m),s(n,S),N&&N.m(n,null),y||(T=[ee(c,"input",t[89]),ee(d,"input",t[90])],y=!0)},p(E,B){B[0]&8&&he(c.value)!==E[3].i.v.o&&te(c,E[3].i.v.o),B[0]&8&&he(d.value)!==E[3].i.v.m&&te(d,E[3].i.v.m),E[0].board==2||E[0].board==100?N?N.p(E,B):(N=Ef(E),N.c(),N.m(n,null)):N&&(N.d(1),N=null)},d(E){E&&C(e),E&&C(l),E&&C(n),N&&N.d(),y=!1,ze(T)}}}function Ef(t){let e,l,n,i,r,u,a;return{c(){e=m("div"),l=$("Boot limit"),n=m("br"),i=h(),r=m("input"),o(r,"name","ivb"),o(r,"type","number"),o(r,"min","2.5"),o(r,"max","3.5"),o(r,"step","0.1"),o(r,"class","in-s tr w-full"),o(e,"class","w-1/3 pl-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].i.v.b),u||(a=ee(r,"input",t[91]),u=!0)},p(c,f){f[0]&8&&he(r.value)!==c[3].i.v.b&&te(r,c[3].i.v.b)},d(c){c&&C(e),u=!1,a()}}}function Df(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T=t[3].d.t&&If();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),r=m("input"),u=$(" Enable telnet"),a=h(),T&&T.c(),c=h(),f=m("div"),_=m("select"),p=m("option"),p.textContent="Verbose",b=m("option"),b.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",o(e,"class","bd-red"),o(r,"type","checkbox"),o(r,"name","dt"),r.__value="true",r.value=r.__value,o(r,"class","rounded mb-1"),o(n,"class","my-1"),p.__value=1,p.value=p.__value,b.__value=2,b.value=b.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,o(_,"name","dl"),o(_,"class","in-s"),t[3].d.l===void 0&&Qe(()=>t[94].call(_)),o(f,"class","my-1")},m(N,E){M(N,e,E),M(N,l,E),M(N,n,E),s(n,i),s(i,r),r.checked=t[3].d.t,s(i,u),M(N,a,E),T&&T.m(N,E),M(N,c,E),M(N,f,E),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),qe(_,t[3].d.l,!0),S||(y=[ee(r,"change",t[93]),ee(_,"change",t[94])],S=!0)},p(N,E){E[0]&8&&(r.checked=N[3].d.t),N[3].d.t?T||(T=If(),T.c(),T.m(c.parentNode,c)):T&&(T.d(1),T=null),E[0]&8&&qe(_,N[3].d.l)},d(N){N&&C(e),N&&C(l),N&&C(n),N&&C(a),T&&T.d(N),N&&C(c),N&&C(f),S=!1,ze(y)}}}function If(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",o(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function yp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,Te,He,Re,je,we,$e,Le,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,re,pe,Be,_e,ye,vt,jl,tl,ct,$l,pl,jt,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Ei,_l,_n,$t,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi,Ge,Ae,vl,$s,El,Rt,Bi,Wl,Nr,ll,Ui,Ar,Ns,Pr,ci,Wt,Er,Dr,Dl,nl,Il,Ir,Hi,Rr,pt,Rl,Lr,ji,dn,vn,hn,bn,Wi,Or,At,zi,Fr,zl,qr,Br,Ur,il,gn,kn,Hr,wn,Gl,jr,Wr,zr,yn,zt,Gr,Gi,Vr,Vl,Kr,Yr,Qr,Cn,Gt,Xr,Vi,Zr,As,Jr,Kl,Ki,Vt,xr,eo,to,Ps,Yi,Kt,lo,no,io,mt,Qi,so,Mn,Sn,ro,mi,oo,Yl,ao,uo,fo,hl,co,Ql,mo,po,_o,bl,vo,Tn,Xl,ho,bo,go,Lt,$n,Nn,An,Pn,ko,Zl,wo,yo,Co,En,Ot,Mo,Xi,So,Zi,Ji,Yt,To,$o,ut,xi,No,Dn,In,Ao,Jl,Po,Eo,Do,Ll,sl,Rn,Ln,Io,Pt,es,ts,Ro,Et,On,ls,ns,Lo,Es,is,ss,Qt,Oo,Fo,pi,qo,Ol,Bo,_i,Xt,Uo,Ho,jo,rs,gl,Wo,Ye,os,zo,Fn,qn,Go,di,Vo,rl,Ko,Ds,Yo,Qo,Bn,kl,Xo,Zt,Zo,Is,xl,Jo,xo,ea,wl,ta,en,la,na,ia,yl,sa,Un,Hn,ra,oa,aa,Cl,ua,jn,fa,ca,ma,bt,Wn,zn,Gn,Vn,Kn,Yn,pa,tn,_a,da,va,Ml,ha,Rs,Ls,Os,Fs=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),qs,ol,as,ba,Qn,Xn,ga,vi,ka,hi,wa,Bs,Dt,us,ya,Zn,Jn,Ca,bi,Ma,fs,cs,Jt,Sa,Ta,$a,Fl,Us,xn,Na,ms,ei,Aa,ps,Hs,ln,js,nn,Ws,sn,zs,rn,Ft,Gs,Pa;a=new Bt({}),F=new Jm({});let e0=["NOK","SEK","DKK","EUR","CHF"],gi=[];for(let R=0;R<5;R+=1)gi[R]=ap(op(t,e0,R));let gt=t[3].p.e&&t[0].chip!="esp8266"&&ff(t),kt=t[3].g.s>0&&cf(t);Rt=new Bt({});let t0=[24,48,96,192,384,576,1152],ki=[];for(let R=0;R<7;R+=1)ki[R]=up(rp(t,t0,R));let wt=t[3].m.e.e&&mf(t),yt=t[3].m.e.e&&pf(t),Ct=t[3].m.m.e&&_f(t);Sn=new Bt({}),In=new Bt({}),On=new Jc({});let Mt=t[3].n.m=="static"&&df(t);qn=new Bt({});let St=t[0].chip!="esp8266"&&vf(t),lt=t[3].q.s.e&&hf(t),nt=t[3].q.m==3&&bf(t),it=t[3].q.m==4&&gf(t),st=t[3].c.es!=null&&kf(t),rt=Fs&&Cf(t);Xn=new Bt({});let ti=t[7],_t=[];for(let R=0;R20||t[0].chip=="esp8266")&&Tf(t);Jn=new Bt({});let Tt=t[3].d.s&&Df(t);return ln=new It({props:{active:t[1],message:"Loading configuration"}}),nn=new It({props:{active:t[2],message:"Saving configuration"}}),sn=new It({props:{active:t[4],message:"Performing factory reset"}}),rn=new It({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",r=h(),u=m("a"),ie(a.$$.fragment),c=h(),f=m("input"),_=h(),p=m("div"),b=m("div"),v=m("div"),d=$("Hostname"),S=m("br"),y=h(),T=m("input"),N=h(),E=m("div"),B=$("Time zone"),P=m("br"),L=h(),O=m("select"),ie(F.$$.fragment),x=h(),H=m("input"),z=h(),G=m("div"),V=m("div"),W=m("div"),U=$("Price region"),K=m("br"),j=h(),Y=m("select"),X=m("optgroup"),oe=m("option"),oe.textContent="NO1",ue=m("option"),ue.textContent="NO2",ke=m("option"),ke.textContent="NO3",me=m("option"),me.textContent="NO4",Te=m("option"),Te.textContent="NO5",He=m("optgroup"),Re=m("option"),Re.textContent="SE1",je=m("option"),je.textContent="SE2",we=m("option"),we.textContent="SE3",$e=m("option"),$e.textContent="SE4",Le=m("optgroup"),Me=m("option"),Me.textContent="DK1",w=m("option"),w.textContent="DK2",g=m("option"),g.textContent="Austria",k=m("option"),k.textContent="Belgium",A=m("option"),A.textContent="Czech Republic",I=m("option"),I.textContent="Estonia",Q=m("option"),Q.textContent="Finland",J=m("option"),J.textContent="France",se=m("option"),se.textContent="Germany",ce=m("option"),ce.textContent="Great Britain",ve=m("option"),ve.textContent="Latvia",Se=m("option"),Se.textContent="Lithuania",re=m("option"),re.textContent="Netherland",pe=m("option"),pe.textContent="Poland",Be=m("option"),Be.textContent="Switzerland",_e=h(),ye=m("div"),vt=$("Currency"),jl=m("br"),tl=h(),ct=m("select");for(let R=0;R<5;R+=1)gi[R].c();$l=h(),pl=m("div"),jt=m("div"),ht=m("div"),Xe=$("Fixed price"),Ze=m("br"),Je=h(),Ue=m("input"),xe=h(),We=m("div"),et=$("Multiplier"),tt=m("br"),de=h(),Ce=m("input"),Ei=h(),_l=m("div"),_n=m("label"),$t=m("input"),Di=$(" Enable price fetch from remote server"),Ii=h(),gt&>.c(),Ri=h(),dl=m("div"),Li=$("Security"),Oi=m("br"),Fi=h(),Nt=m("select"),Nl=m("option"),Nl.textContent="None",Al=m("option"),Al.textContent="Only configuration",Pl=m("option"),Pl.textContent="Everything",qi=h(),kt&&kt.c(),Ge=h(),Ae=m("div"),vl=m("strong"),vl.textContent="Meter",$s=h(),El=m("a"),ie(Rt.$$.fragment),Bi=h(),Wl=m("input"),Nr=h(),ll=m("div"),Ui=m("span"),Ui.textContent="Buffer size",Ar=h(),Ns=m("span"),Ns.textContent="Serial conf.",Pr=h(),ci=m("label"),Wt=m("input"),Er=$(" inverted"),Dr=h(),Dl=m("div"),nl=m("select"),Il=m("option"),Ir=$("Autodetect");for(let R=0;R<7;R+=1)ki[R].c();Rr=h(),pt=m("select"),Rl=m("option"),Lr=$("-"),dn=m("option"),dn.textContent="7N1",vn=m("option"),vn.textContent="8N1",hn=m("option"),hn.textContent="7E1",bn=m("option"),bn.textContent="8E1",Or=h(),At=m("input"),Fr=h(),zl=m("div"),qr=$("Voltage"),Br=m("br"),Ur=h(),il=m("select"),gn=m("option"),gn.textContent="400V (TN)",kn=m("option"),kn.textContent="230V (IT/TT)",Hr=h(),wn=m("div"),Gl=m("div"),jr=$("Main fuse"),Wr=m("br"),zr=h(),yn=m("label"),zt=m("input"),Gr=h(),Gi=m("span"),Gi.textContent="A",Vr=h(),Vl=m("div"),Kr=$("Production"),Yr=m("br"),Qr=h(),Cn=m("label"),Gt=m("input"),Xr=h(),Vi=m("span"),Vi.textContent="kWp",Zr=h(),As=m("div"),Jr=h(),Kl=m("div"),Ki=m("label"),Vt=m("input"),xr=$(" Meter is encrypted"),eo=h(),wt&&wt.c(),to=h(),yt&&yt.c(),Ps=h(),Yi=m("label"),Kt=m("input"),lo=$(" Multipliers"),no=h(),Ct&&Ct.c(),io=h(),mt=m("div"),Qi=m("strong"),Qi.textContent="WiFi",so=h(),Mn=m("a"),ie(Sn.$$.fragment),ro=h(),mi=m("input"),oo=h(),Yl=m("div"),ao=$("SSID"),uo=m("br"),fo=h(),hl=m("input"),co=h(),Ql=m("div"),mo=$("Password"),po=m("br"),_o=h(),bl=m("input"),vo=h(),Tn=m("div"),Xl=m("div"),ho=$("Power saving"),bo=m("br"),go=h(),Lt=m("select"),$n=m("option"),$n.textContent="Default",Nn=m("option"),Nn.textContent="Off",An=m("option"),An.textContent="Minimum",Pn=m("option"),Pn.textContent="Maximum",ko=h(),Zl=m("div"),wo=$("Power"),yo=m("br"),Co=h(),En=m("div"),Ot=m("input"),Mo=h(),Xi=m("span"),Xi.textContent="dBm",So=h(),Zi=m("div"),Ji=m("label"),Yt=m("input"),To=$(" Allow 802.11b legacy rates"),$o=h(),ut=m("div"),xi=m("strong"),xi.textContent="Network",No=h(),Dn=m("a"),ie(In.$$.fragment),Ao=h(),Jl=m("div"),Po=$("IP"),Eo=m("br"),Do=h(),Ll=m("div"),sl=m("select"),Rn=m("option"),Rn.textContent="DHCP",Ln=m("option"),Ln.textContent="Static",Io=h(),Pt=m("input"),Ro=h(),Et=m("select"),ie(On.$$.fragment),Lo=h(),Mt&&Mt.c(),Es=h(),is=m("div"),ss=m("label"),Qt=m("input"),Oo=$(" enable mDNS"),Fo=h(),pi=m("input"),qo=h(),Ol=m("div"),Bo=$("NTP "),_i=m("label"),Xt=m("input"),Uo=$(" obtain from DHCP"),Ho=m("br"),jo=h(),rs=m("div"),gl=m("input"),Wo=h(),Ye=m("div"),os=m("strong"),os.textContent="MQTT",zo=h(),Fn=m("a"),ie(qn.$$.fragment),Go=h(),di=m("input"),Vo=h(),rl=m("div"),Ko=$(`Server - `),St&&St.c(),Ds=h(),Yo=m("br"),Qo=h(),Bn=m("div"),kl=m("input"),Xo=h(),Zt=m("input"),Zo=h(),lt&<.c(),Is=h(),xl=m("div"),Jo=$("Username"),xo=m("br"),ea=h(),wl=m("input"),ta=h(),en=m("div"),la=$("Password"),na=m("br"),ia=h(),yl=m("input"),sa=h(),Un=m("div"),Hn=m("div"),ra=$("Client ID"),oa=m("br"),aa=h(),Cl=m("input"),ua=h(),jn=m("div"),fa=$("Payload"),ca=m("br"),ma=h(),bt=m("select"),Wn=m("option"),Wn.textContent="JSON",zn=m("option"),zn.textContent="Raw (minimal)",Gn=m("option"),Gn.textContent="Raw (full)",Vn=m("option"),Vn.textContent="Domoticz",Kn=m("option"),Kn.textContent="HomeAssistant",Yn=m("option"),Yn.textContent="HEX dump",pa=h(),tn=m("div"),_a=$("Publish topic"),da=m("br"),va=h(),Ml=m("input"),ha=h(),nt&&nt.c(),Rs=h(),it&&it.c(),Ls=h(),st&&st.c(),Os=h(),rt&&rt.c(),qs=h(),ol=m("div"),as=m("strong"),as.textContent="User interface",ba=h(),Qn=m("a"),ie(Xn.$$.fragment),ga=h(),vi=m("input"),ka=h(),hi=m("div");for(let R=0;R<_t.length;R+=1)_t[R].c();wa=h(),ot&&ot.c(),Bs=h(),Dt=m("div"),us=m("strong"),us.textContent="Debugging",ya=h(),Zn=m("a"),ie(Jn.$$.fragment),Ca=h(),bi=m("input"),Ma=h(),fs=m("div"),cs=m("label"),Jt=m("input"),Sa=$(" Enable debugging"),Ta=h(),Tt&&Tt.c(),$a=h(),Fl=m("div"),Us=m("div"),xn=m("button"),xn.textContent="Factory reset",Na=h(),ms=m("div"),ei=m("button"),ei.textContent="Reboot",Aa=h(),ps=m("div"),ps.innerHTML='',Hs=h(),ie(ln.$$.fragment),js=h(),ie(nn.$$.fragment),Ws=h(),ie(sn.$$.fragment),zs=h(),ie(rn.$$.fragment),o(i,"class","text-sm"),o(u,"href",Ut("General-configuration")),o(u,"target","_blank"),o(u,"class","float-right"),o(f,"type","hidden"),o(f,"name","g"),f.value="true",o(T,"name","gh"),o(T,"type","text"),o(T,"class","in-f w-full"),o(T,"pattern","[A-Za-z0-9-]+"),o(O,"name","gt"),o(O,"class","in-l w-full"),t[3].g.t===void 0&&Qe(()=>t[16].call(O)),o(b,"class","flex"),o(p,"class","my-1"),o(H,"type","hidden"),o(H,"name","p"),H.value="true",oe.__value="10YNO-1--------2",oe.value=oe.__value,ue.__value="10YNO-2--------T",ue.value=ue.__value,ke.__value="10YNO-3--------J",ke.value=ke.__value,me.__value="10YNO-4--------9",me.value=me.__value,Te.__value="10Y1001A1001A48H",Te.value=Te.__value,o(X,"label","Norway"),Re.__value="10Y1001A1001A44P",Re.value=Re.__value,je.__value="10Y1001A1001A45N",je.value=je.__value,we.__value="10Y1001A1001A46L",we.value=we.__value,$e.__value="10Y1001A1001A47J",$e.value=$e.__value,o(He,"label","Sweden"),Me.__value="10YDK-1--------W",Me.value=Me.__value,w.__value="10YDK-2--------M",w.value=w.__value,o(Le,"label","Denmark"),g.__value="10YAT-APG------L",g.value=g.__value,k.__value="10YBE----------2",k.value=k.__value,A.__value="10YCZ-CEPS-----N",A.value=A.__value,I.__value="10Y1001A1001A39I",I.value=I.__value,Q.__value="10YFI-1--------U",Q.value=Q.__value,J.__value="10YFR-RTE------C",J.value=J.__value,se.__value="10Y1001A1001A83F",se.value=se.__value,ce.__value="10YGB----------A",ce.value=ce.__value,ve.__value="10YLV-1001A00074",ve.value=ve.__value,Se.__value="10YLT-1001A0008Q",Se.value=Se.__value,re.__value="10YNL----------L",re.value=re.__value,pe.__value="10YPL-AREA-----S",pe.value=pe.__value,Be.__value="10YCH-SWISSGRIDZ",Be.value=Be.__value,o(Y,"name","pr"),o(Y,"class","in-f w-full"),t[3].p.r===void 0&&Qe(()=>t[17].call(Y)),o(W,"class","w-full"),o(ct,"name","pc"),o(ct,"class","in-l"),t[3].p.c===void 0&&Qe(()=>t[18].call(ct)),o(V,"class","flex"),o(G,"class","my-1"),o(Ue,"name","pf"),o(Ue,"type","number"),o(Ue,"min","0.001"),o(Ue,"max","65"),o(Ue,"step","0.001"),o(Ue,"class","in-f tr w-full"),o(ht,"class","w-1/2"),o(Ce,"name","pm"),o(Ce,"type","number"),o(Ce,"min","0.001"),o(Ce,"max","1000"),o(Ce,"step","0.001"),o(Ce,"class","in-l tr w-full"),o(We,"class","w-1/2"),o(jt,"class","flex"),o(pl,"class","my-1"),o($t,"type","checkbox"),o($t,"name","pe"),$t.__value="true",$t.value=$t.__value,o($t,"class","rounded mb-1"),o(_l,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,Al.__value=1,Al.value=Al.__value,Pl.__value=2,Pl.value=Pl.__value,o(Nt,"name","gs"),o(Nt,"class","in-s"),t[3].g.s===void 0&&Qe(()=>t[23].call(Nt)),o(dl,"class","my-1"),o(n,"class","cnt"),o(vl,"class","text-sm"),o(El,"href",Ut("Meter-configuration")),o(El,"target","_blank"),o(El,"class","float-right"),o(Wl,"type","hidden"),o(Wl,"name","m"),Wl.value="true",o(Ui,"class","float-right"),o(Wt,"name","mi"),Wt.__value="true",Wt.value=Wt.__value,o(Wt,"type","checkbox"),o(Wt,"class","rounded mb-1"),o(ci,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=Hi=t[3].m.b!=0,o(nl,"name","mb"),o(nl,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Qe(()=>t[27].call(nl)),Rl.__value=0,Rl.value=Rl.__value,Rl.disabled=ji=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,vn.__value=3,vn.value=vn.__value,hn.__value=10,hn.value=hn.__value,bn.__value=11,bn.value=bn.__value,o(pt,"name","mp"),o(pt,"class","in-m"),pt.disabled=Wi=t[3].m.b==0,t[3].m.p===void 0&&Qe(()=>t[28].call(pt)),o(At,"name","ms"),o(At,"type","number"),o(At,"min",64),o(At,"max",zi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),o(At,"step",64),o(At,"class","in-l tr w-1/2"),o(Dl,"class","flex w-full"),o(ll,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,o(il,"name","md"),o(il,"class","in-s"),t[3].m.d===void 0&&Qe(()=>t[30].call(il)),o(zl,"class","my-1"),o(zt,"name","mf"),o(zt,"type","number"),o(zt,"min","5"),o(zt,"max","65535"),o(zt,"class","in-f tr w-full"),o(Gi,"class","in-post"),o(yn,"class","flex"),o(Gl,"class","mx-1"),o(Gt,"name","mr"),o(Gt,"type","number"),o(Gt,"min","0"),o(Gt,"max","65535"),o(Gt,"class","in-f tr w-full"),o(Vi,"class","in-post"),o(Cn,"class","flex"),o(Vl,"class","mx-1"),o(wn,"class","my-1 flex"),o(As,"class","my-1"),o(Vt,"type","checkbox"),o(Vt,"name","me"),Vt.__value="true",Vt.value=Vt.__value,o(Vt,"class","rounded mb-1"),o(Kl,"class","my-1"),o(Kt,"type","checkbox"),o(Kt,"name","mm"),Kt.__value="true",Kt.value=Kt.__value,o(Kt,"class","rounded mb-1"),o(Ae,"class","cnt"),o(Qi,"class","text-sm"),o(Mn,"href",Ut("WiFi-configuration")),o(Mn,"target","_blank"),o(Mn,"class","float-right"),o(mi,"type","hidden"),o(mi,"name","w"),mi.value="true",o(hl,"name","ws"),o(hl,"type","text"),o(hl,"class","in-s"),o(Yl,"class","my-1"),o(bl,"name","wp"),o(bl,"type","password"),o(bl,"class","in-s"),o(Ql,"class","my-1"),$n.__value=255,$n.value=$n.__value,Nn.__value=0,Nn.value=Nn.__value,An.__value=1,An.value=An.__value,Pn.__value=2,Pn.value=Pn.__value,o(Lt,"name","wz"),o(Lt,"class","in-s"),t[3].w.z===void 0&&Qe(()=>t[43].call(Lt)),o(Xl,"class","w-1/2"),o(Ot,"name","ww"),o(Ot,"type","number"),o(Ot,"min","0"),o(Ot,"max","20.5"),o(Ot,"step","0.5"),o(Ot,"class","in-f tr w-full"),o(Xi,"class","in-post"),o(En,"class","flex"),o(Zl,"class","ml-2 w-1/2"),o(Tn,"class","my-1 flex"),o(Yt,"type","checkbox"),o(Yt,"name","wb"),Yt.__value="true",Yt.value=Yt.__value,o(Yt,"class","rounded mb-1"),o(Zi,"class","my-3"),o(mt,"class","cnt"),o(xi,"class","text-sm"),o(Dn,"href",Ut("Network-configuration")),o(Dn,"target","_blank"),o(Dn,"class","float-right"),Rn.__value="dhcp",Rn.value=Rn.__value,Ln.__value="static",Ln.value=Ln.__value,o(sl,"name","nm"),o(sl,"class","in-f"),t[3].n.m===void 0&&Qe(()=>t[46].call(sl)),o(Pt,"name","ni"),o(Pt,"type","text"),o(Pt,"class","in-m w-full"),Pt.disabled=es=t[3].n.m=="dhcp",Pt.required=ts=t[3].n.m=="static",o(Et,"name","ns"),o(Et,"class","in-l"),Et.disabled=ls=t[3].n.m=="dhcp",Et.required=ns=t[3].n.m=="static",t[3].n.s===void 0&&Qe(()=>t[48].call(Et)),o(Ll,"class","flex"),o(Jl,"class","my-1"),o(Qt,"name","nd"),Qt.__value="true",Qt.value=Qt.__value,o(Qt,"type","checkbox"),o(Qt,"class","rounded mb-1"),o(is,"class","my-1"),o(pi,"type","hidden"),o(pi,"name","ntp"),pi.value="true",o(Xt,"name","ntpd"),Xt.__value="true",Xt.value=Xt.__value,o(Xt,"type","checkbox"),o(Xt,"class","rounded mb-1"),o(_i,"class","ml-4"),o(gl,"name","ntph"),o(gl,"type","text"),o(gl,"class","in-s"),o(rs,"class","flex"),o(Ol,"class","my-1"),o(ut,"class","cnt"),o(os,"class","text-sm"),o(Fn,"href",Ut("MQTT-configuration")),o(Fn,"target","_blank"),o(Fn,"class","float-right"),o(di,"type","hidden"),o(di,"name","q"),di.value="true",o(kl,"name","qh"),o(kl,"type","text"),o(kl,"class","in-f w-3/4"),o(Zt,"name","qp"),o(Zt,"type","number"),o(Zt,"min","1024"),o(Zt,"max","65535"),o(Zt,"class","in-l tr w-1/4"),o(Bn,"class","flex"),o(rl,"class","my-1"),o(wl,"name","qu"),o(wl,"type","text"),o(wl,"class","in-s"),o(xl,"class","my-1"),o(yl,"name","qa"),o(yl,"type","password"),o(yl,"class","in-s"),o(en,"class","my-1"),o(Cl,"name","qc"),o(Cl,"type","text"),o(Cl,"class","in-f w-full"),Wn.__value=0,Wn.value=Wn.__value,zn.__value=1,zn.value=zn.__value,Gn.__value=2,Gn.value=Gn.__value,Vn.__value=3,Vn.value=Vn.__value,Kn.__value=4,Kn.value=Kn.__value,Yn.__value=255,Yn.value=Yn.__value,o(bt,"name","qm"),o(bt,"class","in-l"),t[3].q.m===void 0&&Qe(()=>t[61].call(bt)),o(Un,"class","my-1 flex"),o(Ml,"name","qb"),o(Ml,"type","text"),o(Ml,"class","in-s"),o(tn,"class","my-1"),o(Ye,"class","cnt"),o(as,"class","text-sm"),o(Qn,"href",Ut("User-interface")),o(Qn,"target","_blank"),o(Qn,"class","float-right"),o(vi,"type","hidden"),o(vi,"name","u"),vi.value="true",o(hi,"class","flex flex-wrap"),o(ol,"class","cnt"),o(us,"class","text-sm"),o(Zn,"href","https://amsleser.no/blog/post/24-telnet-debug"),o(Zn,"target","_blank"),o(Zn,"class","float-right"),o(bi,"type","hidden"),o(bi,"name","d"),bi.value="true",o(Jt,"type","checkbox"),o(Jt,"name","ds"),Jt.__value="true",Jt.value=Jt.__value,o(Jt,"class","rounded mb-1"),o(fs,"class","mt-3"),o(Dt,"class","cnt"),o(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),o(xn,"type","button"),o(xn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),o(ei,"type","button"),o(ei,"class","py-2 px-4 rounded bg-yellow-500 text-white"),o(ms,"class","text-center"),o(ps,"class","text-right"),o(Fl,"class","grid grid-cols-3"),o(e,"autocomplete","off")},m(R,ae){M(R,e,ae),s(e,l),s(l,n),s(n,i),s(n,r),s(n,u),le(a,u,null),s(n,c),s(n,f),s(n,_),s(n,p),s(p,b),s(b,v),s(v,d),s(v,S),s(v,y),s(v,T),te(T,t[3].g.h),s(b,N),s(b,E),s(E,B),s(E,P),s(E,L),s(E,O),le(F,O,null),qe(O,t[3].g.t,!0),s(n,x),s(n,H),s(n,z),s(n,G),s(G,V),s(V,W),s(W,U),s(W,K),s(W,j),s(W,Y),s(Y,X),s(X,oe),s(X,ue),s(X,ke),s(X,me),s(X,Te),s(Y,He),s(He,Re),s(He,je),s(He,we),s(He,$e),s(Y,Le),s(Le,Me),s(Le,w),s(Y,g),s(Y,k),s(Y,A),s(Y,I),s(Y,Q),s(Y,J),s(Y,se),s(Y,ce),s(Y,ve),s(Y,Se),s(Y,re),s(Y,pe),s(Y,Be),qe(Y,t[3].p.r,!0),s(V,_e),s(V,ye),s(ye,vt),s(ye,jl),s(ye,tl),s(ye,ct);for(let ft=0;ft<5;ft+=1)gi[ft]&&gi[ft].m(ct,null);qe(ct,t[3].p.c,!0),s(n,$l),s(n,pl),s(pl,jt),s(jt,ht),s(ht,Xe),s(ht,Ze),s(ht,Je),s(ht,Ue),te(Ue,t[3].p.f),s(jt,xe),s(jt,We),s(We,et),s(We,tt),s(We,de),s(We,Ce),te(Ce,t[3].p.m),s(n,Ei),s(n,_l),s(_l,_n),s(_n,$t),$t.checked=t[3].p.e,s(_n,Di),s(_l,Ii),gt&>.m(_l,null),s(n,Ri),s(n,dl),s(dl,Li),s(dl,Oi),s(dl,Fi),s(dl,Nt),s(Nt,Nl),s(Nt,Al),s(Nt,Pl),qe(Nt,t[3].g.s,!0),s(n,qi),kt&&kt.m(n,null),s(l,Ge),s(l,Ae),s(Ae,vl),s(Ae,$s),s(Ae,El),le(Rt,El,null),s(Ae,Bi),s(Ae,Wl),s(Ae,Nr),s(Ae,ll),s(ll,Ui),s(ll,Ar),s(ll,Ns),s(ll,Pr),s(ll,ci),s(ci,Wt),Wt.checked=t[3].m.i,s(ci,Er),s(ll,Dr),s(ll,Dl),s(Dl,nl),s(nl,Il),s(Il,Ir);for(let ft=0;ft<7;ft+=1)ki[ft]&&ki[ft].m(nl,null);qe(nl,t[3].m.b,!0),s(Dl,Rr),s(Dl,pt),s(pt,Rl),s(Rl,Lr),s(pt,dn),s(pt,vn),s(pt,hn),s(pt,bn),qe(pt,t[3].m.p,!0),s(Dl,Or),s(Dl,At),te(At,t[3].m.s),s(Ae,Fr),s(Ae,zl),s(zl,qr),s(zl,Br),s(zl,Ur),s(zl,il),s(il,gn),s(il,kn),qe(il,t[3].m.d,!0),s(Ae,Hr),s(Ae,wn),s(wn,Gl),s(Gl,jr),s(Gl,Wr),s(Gl,zr),s(Gl,yn),s(yn,zt),te(zt,t[3].m.f),s(yn,Gr),s(yn,Gi),s(wn,Vr),s(wn,Vl),s(Vl,Kr),s(Vl,Yr),s(Vl,Qr),s(Vl,Cn),s(Cn,Gt),te(Gt,t[3].m.r),s(Cn,Xr),s(Cn,Vi),s(Ae,Zr),s(Ae,As),s(Ae,Jr),s(Ae,Kl),s(Kl,Ki),s(Ki,Vt),Vt.checked=t[3].m.e.e,s(Ki,xr),s(Kl,eo),wt&&wt.m(Kl,null),s(Ae,to),yt&&yt.m(Ae,null),s(Ae,Ps),s(Ae,Yi),s(Yi,Kt),Kt.checked=t[3].m.m.e,s(Yi,lo),s(Ae,no),Ct&&Ct.m(Ae,null),s(l,io),s(l,mt),s(mt,Qi),s(mt,so),s(mt,Mn),le(Sn,Mn,null),s(mt,ro),s(mt,mi),s(mt,oo),s(mt,Yl),s(Yl,ao),s(Yl,uo),s(Yl,fo),s(Yl,hl),te(hl,t[3].w.s),s(mt,co),s(mt,Ql),s(Ql,mo),s(Ql,po),s(Ql,_o),s(Ql,bl),te(bl,t[3].w.p),s(mt,vo),s(mt,Tn),s(Tn,Xl),s(Xl,ho),s(Xl,bo),s(Xl,go),s(Xl,Lt),s(Lt,$n),s(Lt,Nn),s(Lt,An),s(Lt,Pn),qe(Lt,t[3].w.z,!0),s(Tn,ko),s(Tn,Zl),s(Zl,wo),s(Zl,yo),s(Zl,Co),s(Zl,En),s(En,Ot),te(Ot,t[3].w.w),s(En,Mo),s(En,Xi),s(mt,So),s(mt,Zi),s(Zi,Ji),s(Ji,Yt),Yt.checked=t[3].w.b,s(Ji,To),s(l,$o),s(l,ut),s(ut,xi),s(ut,No),s(ut,Dn),le(In,Dn,null),s(ut,Ao),s(ut,Jl),s(Jl,Po),s(Jl,Eo),s(Jl,Do),s(Jl,Ll),s(Ll,sl),s(sl,Rn),s(sl,Ln),qe(sl,t[3].n.m,!0),s(Ll,Io),s(Ll,Pt),te(Pt,t[3].n.i),s(Ll,Ro),s(Ll,Et),le(On,Et,null),qe(Et,t[3].n.s,!0),s(ut,Lo),Mt&&Mt.m(ut,null),s(ut,Es),s(ut,is),s(is,ss),s(ss,Qt),Qt.checked=t[3].n.d,s(ss,Oo),s(ut,Fo),s(ut,pi),s(ut,qo),s(ut,Ol),s(Ol,Bo),s(Ol,_i),s(_i,Xt),Xt.checked=t[3].n.h,s(_i,Uo),s(Ol,Ho),s(Ol,jo),s(Ol,rs),s(rs,gl),te(gl,t[3].n.n1),s(l,Wo),s(l,Ye),s(Ye,os),s(Ye,zo),s(Ye,Fn),le(qn,Fn,null),s(Ye,Go),s(Ye,di),s(Ye,Vo),s(Ye,rl),s(rl,Ko),St&&St.m(rl,null),s(rl,Ds),s(rl,Yo),s(rl,Qo),s(rl,Bn),s(Bn,kl),te(kl,t[3].q.h),s(Bn,Xo),s(Bn,Zt),te(Zt,t[3].q.p),s(Ye,Zo),lt&<.m(Ye,null),s(Ye,Is),s(Ye,xl),s(xl,Jo),s(xl,xo),s(xl,ea),s(xl,wl),te(wl,t[3].q.u),s(Ye,ta),s(Ye,en),s(en,la),s(en,na),s(en,ia),s(en,yl),te(yl,t[3].q.a),s(Ye,sa),s(Ye,Un),s(Un,Hn),s(Hn,ra),s(Hn,oa),s(Hn,aa),s(Hn,Cl),te(Cl,t[3].q.c),s(Un,ua),s(Un,jn),s(jn,fa),s(jn,ca),s(jn,ma),s(jn,bt),s(bt,Wn),s(bt,zn),s(bt,Gn),s(bt,Vn),s(bt,Kn),s(bt,Yn),qe(bt,t[3].q.m,!0),s(Ye,pa),s(Ye,tn),s(tn,_a),s(tn,da),s(tn,va),s(tn,Ml),te(Ml,t[3].q.b),s(l,ha),nt&&nt.m(l,null),s(l,Rs),it&&it.m(l,null),s(l,Ls),st&&st.m(l,null),s(l,Os),rt&&rt.m(l,null),s(l,qs),s(l,ol),s(ol,as),s(ol,ba),s(ol,Qn),le(Xn,Qn,null),s(ol,ga),s(ol,vi),s(ol,ka),s(ol,hi);for(let ft=0;ft<_t.length;ft+=1)_t[ft]&&_t[ft].m(hi,null);s(l,wa),ot&&ot.m(l,null),s(l,Bs),s(l,Dt),s(Dt,us),s(Dt,ya),s(Dt,Zn),le(Jn,Zn,null),s(Dt,Ca),s(Dt,bi),s(Dt,Ma),s(Dt,fs),s(fs,cs),s(cs,Jt),Jt.checked=t[3].d.s,s(cs,Sa),s(Dt,Ta),Tt&&Tt.m(Dt,null),s(e,$a),s(e,Fl),s(Fl,Us),s(Us,xn),s(Fl,Na),s(Fl,ms),s(ms,ei),s(Fl,Aa),s(Fl,ps),M(R,Hs,ae),le(ln,R,ae),M(R,js,ae),le(nn,R,ae),M(R,Ws,ae),le(sn,R,ae),M(R,zs,ae),le(rn,R,ae),Ft=!0,Gs||(Pa=[ee(T,"input",t[15]),ee(O,"change",t[16]),ee(Y,"change",t[17]),ee(ct,"change",t[18]),ee(Ue,"input",t[19]),ee(Ce,"input",t[20]),ee($t,"change",t[21]),ee(Nt,"change",t[23]),ee(Wt,"change",t[26]),ee(nl,"change",t[27]),ee(pt,"change",t[28]),ee(At,"input",t[29]),ee(il,"change",t[30]),ee(zt,"input",t[31]),ee(Gt,"input",t[32]),ee(Vt,"change",t[33]),ee(Kt,"change",t[36]),ee(hl,"input",t[41]),ee(bl,"input",t[42]),ee(Lt,"change",t[43]),ee(Ot,"input",t[44]),ee(Yt,"change",t[45]),ee(sl,"change",t[46]),ee(Pt,"input",t[47]),ee(Et,"change",t[48]),ee(Qt,"change",t[52]),ee(Xt,"change",t[53]),ee(gl,"input",t[54]),ee(kl,"input",t[56]),ee(Zt,"input",t[57]),ee(wl,"input",t[58]),ee(yl,"input",t[59]),ee(Cl,"input",t[60]),ee(bt,"change",t[61]),ee(Ml,"input",t[62]),ee(Jt,"change",t[92]),ee(xn,"click",t[8]),ee(ei,"click",t[10]),ee(e,"submit",Ss(t[9]))],Gs=!0)},p(R,ae){if(ae[0]&8&&T.value!==R[3].g.h&&te(T,R[3].g.h),ae[0]&8&&qe(O,R[3].g.t),ae[0]&8&&qe(Y,R[3].p.r),ae[0]&8&&qe(ct,R[3].p.c),ae[0]&8&&he(Ue.value)!==R[3].p.f&&te(Ue,R[3].p.f),ae[0]&8&&he(Ce.value)!==R[3].p.m&&te(Ce,R[3].p.m),ae[0]&8&&($t.checked=R[3].p.e),R[3].p.e&&R[0].chip!="esp8266"?gt?gt.p(R,ae):(gt=ff(R),gt.c(),gt.m(_l,null)):gt&&(gt.d(1),gt=null),ae[0]&8&&qe(Nt,R[3].g.s),R[3].g.s>0?kt?kt.p(R,ae):(kt=cf(R),kt.c(),kt.m(n,null)):kt&&(kt.d(1),kt=null),ae[0]&8&&(Wt.checked=R[3].m.i),(!Ft||ae[0]&8&&Hi!==(Hi=R[3].m.b!=0))&&(Il.disabled=Hi),ae[0]&8&&qe(nl,R[3].m.b),(!Ft||ae[0]&8&&ji!==(ji=R[3].m.b!=0))&&(Rl.disabled=ji),(!Ft||ae[0]&8&&Wi!==(Wi=R[3].m.b==0))&&(pt.disabled=Wi),ae[0]&8&&qe(pt,R[3].m.p),(!Ft||ae[0]&9&&zi!==(zi=R[0].chip=="esp8266"?R[3].i.h.p==3||R[3].i.h.p==113?512:128:4096))&&o(At,"max",zi),ae[0]&8&&he(At.value)!==R[3].m.s&&te(At,R[3].m.s),ae[0]&8&&qe(il,R[3].m.d),ae[0]&8&&he(zt.value)!==R[3].m.f&&te(zt,R[3].m.f),ae[0]&8&&he(Gt.value)!==R[3].m.r&&te(Gt,R[3].m.r),ae[0]&8&&(Vt.checked=R[3].m.e.e),R[3].m.e.e?wt?wt.p(R,ae):(wt=mf(R),wt.c(),wt.m(Kl,null)):wt&&(wt.d(1),wt=null),R[3].m.e.e?yt?yt.p(R,ae):(yt=pf(R),yt.c(),yt.m(Ae,Ps)):yt&&(yt.d(1),yt=null),ae[0]&8&&(Kt.checked=R[3].m.m.e),R[3].m.m.e?Ct?Ct.p(R,ae):(Ct=_f(R),Ct.c(),Ct.m(Ae,null)):Ct&&(Ct.d(1),Ct=null),ae[0]&8&&hl.value!==R[3].w.s&&te(hl,R[3].w.s),ae[0]&8&&bl.value!==R[3].w.p&&te(bl,R[3].w.p),ae[0]&8&&qe(Lt,R[3].w.z),ae[0]&8&&he(Ot.value)!==R[3].w.w&&te(Ot,R[3].w.w),ae[0]&8&&(Yt.checked=R[3].w.b),ae[0]&8&&qe(sl,R[3].n.m),(!Ft||ae[0]&8&&es!==(es=R[3].n.m=="dhcp"))&&(Pt.disabled=es),(!Ft||ae[0]&8&&ts!==(ts=R[3].n.m=="static"))&&(Pt.required=ts),ae[0]&8&&Pt.value!==R[3].n.i&&te(Pt,R[3].n.i),(!Ft||ae[0]&8&&ls!==(ls=R[3].n.m=="dhcp"))&&(Et.disabled=ls),(!Ft||ae[0]&8&&ns!==(ns=R[3].n.m=="static"))&&(Et.required=ns),ae[0]&8&&qe(Et,R[3].n.s),R[3].n.m=="static"?Mt?Mt.p(R,ae):(Mt=df(R),Mt.c(),Mt.m(ut,Es)):Mt&&(Mt.d(1),Mt=null),ae[0]&8&&(Qt.checked=R[3].n.d),ae[0]&8&&(Xt.checked=R[3].n.h),ae[0]&8&&gl.value!==R[3].n.n1&&te(gl,R[3].n.n1),R[0].chip!="esp8266"?St?St.p(R,ae):(St=vf(R),St.c(),St.m(rl,Ds)):St&&(St.d(1),St=null),ae[0]&8&&kl.value!==R[3].q.h&&te(kl,R[3].q.h),ae[0]&8&&he(Zt.value)!==R[3].q.p&&te(Zt,R[3].q.p),R[3].q.s.e?lt?(lt.p(R,ae),ae[0]&8&&D(lt,1)):(lt=hf(R),lt.c(),D(lt,1),lt.m(Ye,Is)):lt&&(De(),q(lt,1,1,()=>{lt=null}),Ie()),ae[0]&8&&wl.value!==R[3].q.u&&te(wl,R[3].q.u),ae[0]&8&&yl.value!==R[3].q.a&&te(yl,R[3].q.a),ae[0]&8&&Cl.value!==R[3].q.c&&te(Cl,R[3].q.c),ae[0]&8&&qe(bt,R[3].q.m),ae[0]&8&&Ml.value!==R[3].q.b&&te(Ml,R[3].q.b),R[3].q.m==3?nt?(nt.p(R,ae),ae[0]&8&&D(nt,1)):(nt=bf(R),nt.c(),D(nt,1),nt.m(l,Rs)):nt&&(De(),q(nt,1,1,()=>{nt=null}),Ie()),R[3].q.m==4?it?(it.p(R,ae),ae[0]&8&&D(it,1)):(it=gf(R),it.c(),D(it,1),it.m(l,Ls)):it&&(De(),q(it,1,1,()=>{it=null}),Ie()),R[3].c.es!=null?st?(st.p(R,ae),ae[0]&8&&D(st,1)):(st=kf(R),st.c(),D(st,1),st.m(l,Os)):st&&(De(),q(st,1,1,()=>{st=null}),Ie()),ae[0]&8&&(Fs=R[3].p.r.startsWith("10YNO")||R[3].p.r.startsWith("10Y1001A1001A4")),Fs?rt?(rt.p(R,ae),ae[0]&8&&D(rt,1)):(rt=Cf(R),rt.c(),D(rt,1),rt.m(l,qs)):rt&&(De(),q(rt,1,1,()=>{rt=null}),Ie()),ae[0]&136){ti=R[7];let qt;for(qt=0;qt20||R[0].chip=="esp8266"?ot?(ot.p(R,ae),ae[0]&1&&D(ot,1)):(ot=Tf(R),ot.c(),D(ot,1),ot.m(l,Bs)):ot&&(De(),q(ot,1,1,()=>{ot=null}),Ie()),ae[0]&8&&(Jt.checked=R[3].d.s),R[3].d.s?Tt?Tt.p(R,ae):(Tt=Df(R),Tt.c(),Tt.m(Dt,null)):Tt&&(Tt.d(1),Tt=null);const ft={};ae[0]&2&&(ft.active=R[1]),ln.$set(ft);const Ea={};ae[0]&4&&(Ea.active=R[2]),nn.$set(Ea);const Da={};ae[0]&16&&(Da.active=R[4]),sn.$set(Da);const Ia={};ae[0]&32&&(Ia.active=R[5]),rn.$set(Ia)},i(R){Ft||(D(a.$$.fragment,R),D(F.$$.fragment,R),D(Rt.$$.fragment,R),D(Sn.$$.fragment,R),D(In.$$.fragment,R),D(On.$$.fragment,R),D(qn.$$.fragment,R),D(lt),D(nt),D(it),D(st),D(rt),D(Xn.$$.fragment,R),D(ot),D(Jn.$$.fragment,R),D(ln.$$.fragment,R),D(nn.$$.fragment,R),D(sn.$$.fragment,R),D(rn.$$.fragment,R),Ft=!0)},o(R){q(a.$$.fragment,R),q(F.$$.fragment,R),q(Rt.$$.fragment,R),q(Sn.$$.fragment,R),q(In.$$.fragment,R),q(On.$$.fragment,R),q(qn.$$.fragment,R),q(lt),q(nt),q(it),q(st),q(rt),q(Xn.$$.fragment,R),q(ot),q(Jn.$$.fragment,R),q(ln.$$.fragment,R),q(nn.$$.fragment,R),q(sn.$$.fragment,R),q(rn.$$.fragment,R),Ft=!1},d(R){R&&C(e),ne(a),ne(F),cl(gi,R),gt&>.d(),kt&&kt.d(),ne(Rt),cl(ki,R),wt&&wt.d(),yt&&yt.d(),Ct&&Ct.d(),ne(Sn),ne(In),ne(On),Mt&&Mt.d(),ne(qn),St&&St.d(),lt&<.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),rt&&rt.d(),ne(Xn),cl(_t,R),ot&&ot.d(),ne(Jn),Tt&&Tt.d(),R&&C(Hs),ne(ln,R),R&&C(js),ne(nn,R),R&&C(Ws),ne(sn,R),R&&C(zs),ne(rn,R),Gs=!1,ze(Pa)}}}async function Cp(){await(await fetch("/reboot",{method:"POST"})).json()}function Mp(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"}],r=!0,u=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{es:null}};Ci.subscribe(Ge=>{Ge.version&&(l(3,a=Ge),l(1,r=!1))}),Wm();let c=!1,f=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Ge=new URLSearchParams;Ge.append("perform","true");let vl=await(await fetch("/reset",{method:"POST",body:Ge})).json();l(4,c=!1),l(5,f=vl.success)}}async function p(Ge){l(2,u=!0);const Ae=new FormData(Ge.target),vl=new URLSearchParams;for(let Rt of Ae){const[Bi,Wl]=Rt;vl.append(Bi,Wl)}let El=await(await fetch("/save",{method:"POST",body:vl})).json();Ht.update(Rt=>(Rt.booting=El.reboot,Rt.ui=a.u,Rt)),l(2,u=!1),ri("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(Ht.update(Ge=>(Ge.booting=!0,Ge)),Cp())};async function v(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.c=!1,Ae)))}async function d(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.r=!1,Ae)))}async function S(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.k=!1,Ae)))}const y=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let T=44;function N(){a.g.h=this.value,l(3,a)}function E(){a.g.t=dt(this),l(3,a)}function B(){a.p.r=dt(this),l(3,a)}function P(){a.p.c=dt(this),l(3,a)}function L(){a.p.f=he(this.value),l(3,a)}function O(){a.p.m=he(this.value),l(3,a)}function F(){a.p.e=this.checked,l(3,a)}function x(){a.p.t=this.value,l(3,a)}function H(){a.g.s=dt(this),l(3,a)}function z(){a.g.u=this.value,l(3,a)}function G(){a.g.p=this.value,l(3,a)}function V(){a.m.i=this.checked,l(3,a)}function W(){a.m.b=dt(this),l(3,a)}function U(){a.m.p=dt(this),l(3,a)}function K(){a.m.s=he(this.value),l(3,a)}function j(){a.m.d=dt(this),l(3,a)}function Y(){a.m.f=he(this.value),l(3,a)}function X(){a.m.r=he(this.value),l(3,a)}function oe(){a.m.e.e=this.checked,l(3,a)}function ue(){a.m.e.k=this.value,l(3,a)}function ke(){a.m.e.a=this.value,l(3,a)}function me(){a.m.m.e=this.checked,l(3,a)}function Te(){a.m.m.w=he(this.value),l(3,a)}function He(){a.m.m.v=he(this.value),l(3,a)}function Re(){a.m.m.a=he(this.value),l(3,a)}function je(){a.m.m.c=he(this.value),l(3,a)}function we(){a.w.s=this.value,l(3,a)}function $e(){a.w.p=this.value,l(3,a)}function Le(){a.w.z=dt(this),l(3,a)}function Me(){a.w.w=he(this.value),l(3,a)}function w(){a.w.b=this.checked,l(3,a)}function g(){a.n.m=dt(this),l(3,a)}function k(){a.n.i=this.value,l(3,a)}function A(){a.n.s=dt(this),l(3,a)}function I(){a.n.g=this.value,l(3,a)}function Q(){a.n.d1=this.value,l(3,a)}function J(){a.n.d2=this.value,l(3,a)}function se(){a.n.d=this.checked,l(3,a)}function ce(){a.n.h=this.checked,l(3,a)}function ve(){a.n.n1=this.value,l(3,a)}function Se(){a.q.s.e=this.checked,l(3,a)}function re(){a.q.h=this.value,l(3,a)}function pe(){a.q.p=he(this.value),l(3,a)}function Be(){a.q.u=this.value,l(3,a)}function _e(){a.q.a=this.value,l(3,a)}function ye(){a.q.c=this.value,l(3,a)}function vt(){a.q.m=dt(this),l(3,a)}function jl(){a.q.b=this.value,l(3,a)}function tl(){a.o.e=this.value,l(3,a)}function ct(){a.o.c=this.value,l(3,a)}function $l(){a.o.u1=this.value,l(3,a)}function pl(){a.o.u2=this.value,l(3,a)}function jt(){a.o.u3=this.value,l(3,a)}function ht(){a.h.t=this.value,l(3,a)}function Xe(){a.h.h=this.value,l(3,a)}function Ze(){a.h.n=this.value,l(3,a)}function Je(){a.c.es=this.checked,l(3,a)}function Ue(Ge){a.t.t[Ge]=he(this.value),l(3,a)}function xe(){a.t.h=he(this.value),l(3,a)}function We(Ge){a.u[Ge.key]=dt(this),l(3,a)}function et(){a.i.h.u=this.checked,l(3,a)}function tt(){a.i.h.p=dt(this),l(3,a)}function de(){a.i.a=he(this.value),l(3,a)}function Ce(){a.i.l.i=this.checked,l(3,a)}function Ei(){a.i.l.p=he(this.value),l(3,a)}function _l(){a.i.r.i=this.checked,l(3,a)}function _n(){a.i.r.r=he(this.value),l(3,a)}function $t(){a.i.r.g=he(this.value),l(3,a)}function Di(){a.i.r.b=he(this.value),l(3,a)}function Ii(){a.i.t.d=he(this.value),l(3,a)}function Ri(){a.i.t.a=he(this.value),l(3,a)}function dl(){a.i.v.p=he(this.value),l(3,a)}function Li(){a.i.v.d.v=he(this.value),l(3,a)}function Oi(){a.i.v.d.g=he(this.value),l(3,a)}function Fi(){a.i.v.o=he(this.value),l(3,a)}function Nt(){a.i.v.m=he(this.value),l(3,a)}function Nl(){a.i.v.b=he(this.value),l(3,a)}function Al(){a.d.s=this.checked,l(3,a)}function Pl(){a.d.t=this.checked,l(3,a)}function qi(){a.d.l=dt(this),l(3,a)}return t.$$set=Ge=>{"sysinfo"in Ge&&l(0,n=Ge.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,T=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,r,u,a,c,f,T,i,_,p,b,v,d,S,y,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,Te,He,Re,je,we,$e,Le,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,re,pe,Be,_e,ye,vt,jl,tl,ct,$l,pl,jt,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Ei,_l,_n,$t,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi]}class Sp extends Ee{constructor(e){super(),Pe(this,e,Mp,yp,Ne,{sysinfo:0},null,[-1,-1,-1,-1])}}function Rf(t,e,l){const n=t.slice();return n[20]=e[l],n}function Tp(t){let e=be(t[1].chip,t[1].board)+"",l;return{c(){l=$(e)},m(n,i){M(n,l,i)},p(n,i){i&2&&e!==(e=be(n[1].chip,n[1].board)+"")&&Z(l,e)},d(n){n&&C(l)}}}function Lf(t){let e,l,n=t[1].apmac+"",i,r,u,a,c,f,_,p,b,v=Ja(t[1])+"",d,S,y=t[1].boot_reason+"",T,N,E=t[1].ex_cause+"",B,P,L;const O=[Np,$p],F=[];function x(H,z){return H[0].u>0?0:1}return c=x(t),f=F[c]=O[c](t),{c(){e=m("div"),l=$("AP MAC: "),i=$(n),r=h(),u=m("div"),a=$(`Last boot: +Occurred in: ${i}`:"",u=gr(t),a=mc(e)?e(u):e;return`<${u}> ${a}${r}`}const Tc=t=>(...e)=>t(P0(...e)),$c=Tc(t=>{throw new Error(t)}),ys=Tc(console.warn),Ua=4,E0=3,D0=2,I0=1,R0=1;function L0(t,e){const l=t.default?0:ml(t.fullPath).reduce((n,i)=>{let r=n;return r+=Ua,w0(i)?r+=R0:y0(i)?r+=D0:kc(i)?r-=Ua+I0:r+=E0,r},0);return{route:t,score:l,index:e}}function O0(t){return t.map(L0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Nc(t,e){let l,n;const[i]=e.split("?"),r=ml(i),u=r[0]==="",a=O0(t);for(let c=0,f=a.length;c({..._,params:b,uri:T});if(_.default){n=v(e);continue}const d=ml(_.fullPath),S=Math.max(r.length,d.length);let y=0;for(;y{f===".."?c.pop():f!=="."&&c.push(f)}),Ks(`/${c.join("/")}`,n)}function Ha(t,e){const{pathname:l,hash:n="",search:i="",state:r}=t,u=ml(e,!0),a=ml(l,!0);for(;u.length;)u[0]!==a[0]&&$c(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),a.shift();return{pathname:Ai(...a),hash:n,search:i,state:r}}const ja=t=>t.length===1?"":t,kr=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,r=i?ja(wi(t,l)):"",u=i?wi(t,0,l):t,a=n?ja(wi(u,e)):"";return{pathname:(n?wi(u,0,e):u)||"/",search:a,hash:r}},q0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function B0(t,e,l){return Ai(l,F0(t,e))}function U0(t,e){const l=hr(C0(t)),n=ml(l,!0),i=ml(e,!0).slice(0,n.length),r=Ac({fullPath:l},Ai(...i));return r&&r.uri}const Ys="POP",H0="PUSH",j0="REPLACE";function Qs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function W0(t){let e=[],l=Qs(t),n=Ys;const i=(r=e)=>r.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(r){e.push(r);const u=()=>{l=Qs(t),n=Ys,i([r])};i([r]);const a=dc(t,"popstate",u);return()=>{a(),e=e.filter(c=>c!==r)}},navigate(r,u){const{state:a={},replace:c=!1}=u||{};if(n=c?j0:H0,pc(r))u&&ys(Sc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ys,t.history.go(r);else{const f={...a,_key:h0()};try{t.history[c?"replaceState":"pushState"](f,"",r)}catch{t.location[c?"replace":"assign"](r)}}l=Qs(t),i()}}}function Xs(t,e){return{...kr(e),state:t}}function z0(t="/"){let e=0,l=[Xs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,r){e++,l=l.slice(0,e),l.push(Xs(n,r))},replaceState(n,i,r){l[e]=Xs(n,r)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const G0=!!(!Ul&&window.document&&window.document.createElement),V0=!Ul&&window.location.origin==="null",Pc=W0(G0&&!V0?window:z0()),{navigate:ri}=Pc;let Tl=null,Ec=!0;function K0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nTl.level||t.level===Tl.level&&K0(t.routerId,Tl.routerId))&&(Tl=t)}function Q0(){Tl=null}function X0(){Ec=!1}function Wa(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=dc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function Z0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function J0(t){return/^H[1-6]$/i.test(t.tagName)}function za(t,e=document){return e.querySelector(t)}function x0(t){let l=za(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!Z0(l,t);){if(J0(l))return l;const n=za("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function e1(t){Promise.resolve(ai(t.focusElement)).then(e=>{const l=e||x0(t.id);l||ys(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ts),!Wa(l)&&Wa(document.documentElement)})}const t1=(t,e,l)=>(n,i)=>m0().then(()=>{if(!Tl||Ec){X0();return}if(n&&e1(Tl.route),t.announcements&&i){const{path:r,fullPath:u,meta:a,params:c,uri:f}=Tl.route,_=t.createAnnouncement({path:r,fullPath:u,meta:a,params:c,uri:f},ai(l));Promise.resolve(_).then(p=>{e.set(p)})}Q0()}),l1="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function n1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},vc(t[6],l1)],i={};for(let r=0;r`Navigated to ${ue.uri}`,announcements:!0,...d},T=_,N=hr(_),E=Bl(tr),B=Bl(fi),P=!E,L=s1(),O=v&&!(B&&!B.manageFocus),F=at("");ul(t,F,ue=>l(0,a=ue));const x=B?B.disableInlineStyles:S,H=at([]);ul(t,H,ue=>l(20,u=ue));const z=at(null);ul(t,z,ue=>l(18,i=ue));let G=!1;const V=P?0:B.level+1,U=P?at((()=>Ha(Ul?kr(p):b.location,N))()):E;ul(t,U,ue=>l(17,n=ue));const K=at(n);ul(t,K,ue=>l(19,r=ue));const j=t1(y,F,U),Y=ue=>ke=>ke.filter(me=>me.id!==ue);function X(ue){if(Ul){if(G)return;const ke=Ac(ue,n.pathname);if(ke)return G=!0,ke}else H.update(ke=>{const me=Y(ue.id)(ke);return me.push(ue),me})}function oe(ue){H.update(Y(ue))}return!P&&_!==Ga&&ys(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),P&&(oc(()=>b.listen(ke=>{const me=Ha(ke.location,N);K.set(n),U.set(me)})),Si(tr,U)),Si(fi,{activeRoute:z,registerRoute:X,unregisterRoute:oe,manageFocus:O,level:V,id:L,history:P?b:B.history,basepath:P?N:B.basepath,disableInlineStyles:x}),t.$$set=ue=>{"basepath"in ue&&l(11,_=ue.basepath),"url"in ue&&l(12,p=ue.url),"history"in ue&&l(13,b=ue.history),"primary"in ue&&l(14,v=ue.primary),"a11y"in ue&&l(15,d=ue.a11y),"disableInlineStyles"in ue&&l(16,S=ue.disableInlineStyles),"$$scope"in ue&&l(21,f=ue.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==T&&ys(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ue=Nc(u,n.pathname);z.set(ue)}if(t.$$.dirty[0]&655360&&P){const ue=!!n.hash,ke=!ue&&O,me=!ue||n.pathname!==r.pathname;j(ke,me)}t.$$.dirty[0]&262144&&O&&i&&i.primary&&Y0({level:V,routerId:L,route:i})},[a,y,P,L,O,F,x,H,z,U,K,_,p,b,v,d,S,n,i,r,u,f,c]}class o1 extends Ee{constructor(e){super(),Pe(this,e,r1,i1,Ne,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Dc=o1;function Pi(t,e,l=fi,n=mn){Bl(l)||$c(t,r=>`You cannot use ${r} outside of a ${gr(n)}.`,e)}const a1=t=>{const{subscribe:e}=Bl(t);return{subscribe:e}};function Ic(){return Pi(yc),a1(tr)}function Rc(){const{history:t}=Bl(fi);return t}function Lc(){const t=Bl(bc);return t?b0(t,e=>e.base):at("/")}function Oc(){Pi(Mc);const t=Lc(),{basepath:e}=Bl(fi);return n=>B0(n,ai(t),e)}function u1(){Pi(Cc);const t=Oc(),{navigate:e}=Rc();return(n,i)=>{const r=pc(n)?n:t(n);return e(r,i)}}const f1=t=>({params:t&16,location:t&8}),Va=t=>({params:Ul?ai(t[10]):t[4],location:t[3],navigate:t[11]});function Ka(t){let e,l;return e=new Dc({props:{primary:t[1],$$slots:{default:[p1]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&2&&(r.primary=n[1]),i&528409&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function c1(t){let e;const l=t[18].default,n=pr(l,t,t[19],Va);return{c(){n&&n.c()},m(i,r){n&&n.m(i,r),e=!0},p(i,r){n&&n.p&&(!e||r&524312)&&dr(n,l,i,i[19],e?_r(l,i[19],r,f1):vr(i[19]),Va)},i(i){e||(D(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function m1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ul?ai(t[10]):t[4],t[12]];var r=t[0];function u(a){let c={};for(let f=0;f{ne(_,1)}),Ie()}r?(e=Oa(r,u()),ie(e.$$.fragment),D(e.$$.fragment,1),le(e,l.parentNode,l)):e=null}else r&&e.$set(f)},i(a){n||(e&&D(e.$$.fragment,a),n=!0)},o(a){e&&q(e.$$.fragment,a),n=!1},d(a){a&&C(l),e&&ne(e,a)}}}function p1(t){let e,l,n,i;const r=[m1,c1],u=[];function a(c,f){return c[0]!==null?0:1}return e=a(t),l=u[e]=r[e](t),{c(){l.c(),n=Ve()},m(c,f){u[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?u[e].p(c,f):(De(),q(u[_],1,1,()=>{u[_]=null}),Ie(),l=u[e],l?l.p(c,f):(l=u[e]=r[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){u[e].d(c),c&&C(n)}}}function _1(t){let e,l,n,i,r,u=[er(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let p=0;p{c=null}),Ie())},i(p){r||(D(c),r=!0)},o(p){q(c),r=!1},d(p){p&&C(e),p&&C(l),c&&c.d(p),p&&C(n),p&&C(i)}}}const d1=_c();function v1(t,e,l){let n;const i=["path","component","meta","primary"];let r=ks(e,i),u,a,c,f,{$$slots:_={},$$scope:p}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:S=!0}=e;Pi(Ts,e);const y=d1(),{registerRoute:T,unregisterRoute:N,activeRoute:E,disableInlineStyles:B}=Bl(fi);ul(t,E,G=>l(16,u=G));const P=Lc();ul(t,P,G=>l(17,c=G));const L=Ic();ul(t,L,G=>l(3,a=G));const O=at(null);let F;const x=at(),H=at({});ul(t,H,G=>l(4,f=G)),Si(bc,x),Si(g0,H),Si(k0,O);const z=u1();return Ul||f0(()=>N(y)),t.$$set=G=>{l(24,e=xt(xt({},e),gs(G))),l(12,r=ks(e,i)),"path"in G&&l(13,b=G.path),"component"in G&&l(0,v=G.component),"meta"in G&&l(14,d=G.meta),"primary"in G&&l(1,S=G.primary),"$$scope"in G&&l(19,p=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=b==="",V=Ai(c,b),W={id:y,path:b,meta:d,default:G,fullPath:G?"":V,base:G?c:U0(V,a.pathname),primary:S,focusElement:O};x.set(W),l(15,F=T(W))}if(t.$$.dirty&98304&&l(2,n=!!(F||u&&u.id===y)),t.$$.dirty&98308&&n){const{params:G}=F||u;H.set(G)}},e=gs(e),[v,S,n,a,f,y,E,B,P,L,H,z,r,b,d,F,u,c,_,p]}class h1 extends Ee{constructor(e){super(),Pe(this,e,v1,_1,Ne,{path:13,component:0,meta:14,primary:1})}}const Sl=h1;function b1(t){let e,l,n,i;const r=t[13].default,u=pr(r,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,p=O));const E=c0(),B=Oc(),{navigate:P}=Rc();function L(O){E("click",O),v0(O)&&(O.preventDefault(),P(n,{state:y,replace:u||S}))}return t.$$set=O=>{l(19,e=xt(xt({},e),gs(O))),l(18,_=ks(e,f)),"to"in O&&l(5,d=O.to),"replace"in O&&l(6,S=O.replace),"state"in O&&l(7,y=O.state),"getProps"in O&&l(8,T=O.getProps),"$$scope"in O&&l(12,v=O.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=B(d,p)),t.$$.dirty&2049&&l(10,i=lr(p.pathname,n)),t.$$.dirty&2049&&l(9,r=n===p.pathname),t.$$.dirty&2049&&(u=kr(n)===q0(p)),t.$$.dirty&512&&l(2,a=r?{"aria-current":"page"}:{}),l(1,c=(()=>{if(mc(T)){const O=T({location:p,href:n,isPartiallyCurrent:i,isCurrent:r});return{..._,...O}}return _})())},e=gs(e),[n,c,a,N,L,d,S,y,T,r,i,p,v,b]}class k1 extends Ee{constructor(e){super(),Pe(this,e,g1,b1,Ne,{to:5,replace:6,state:7,getProps:8})}}const el=k1;let nr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ql(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function w1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Fc(t){let e;return t>90?e="#d90000":t>85?e="#e32100":t>80?e="#ffb800":t>75?e="#dcd800":e="#32d900",e}function y1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Cs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Oe(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function be(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Ya(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Qa(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 Xa(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Za(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function oi(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ke(t,e){return t==1||t==2&&e}function Ht(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function fl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Ja(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function xa(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function eu(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}async function Hl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),r=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),r}let al={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const Rt=at(al);async function wr(){al=await(await Hl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Rt.set(al)}let vs=0,tu=-127,lu=null,C1={};const M1=hc(C1,t=>{let e;async function l(){Hl("/data.json").then(n=>n.json()).then(n=>{t(n),tu!=n.t&&(tu=n.t,setTimeout(jc,2e3)),lu==null&&n.pe&&n.p!=null&&(lu=n.p,Bc()),al.upgrading?window.location.reload():(!al||!al.chip||al.booting||vs>1&&!oi(al.board))&&(wr(),an&&clearTimeout(an),an=setTimeout(Cr,2e3),un&&clearTimeout(un),un=setTimeout(Mr,3e3));let i=5e3;if(oi(al.board)&&n.v>2.5){let r=3.3-Math.min(3.3,n.v);r>0&&(i=Math.max(r,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),vs=0}).catch(n=>{vs++,vs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,oi(al.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let ir={},yi;const yr=at(ir);async function qc(){let t=!1;if(yr.update(e=>{for(var l=0;l<36;l++){if(e[Oe(l)]==null){t=l<12;break}e[Oe(l)]=e[Oe(l+1)]}return e}),t)Bc();else{let e=new Date;yi=setTimeout(qc,(60-e.getMinutes())*6e4)}}async function Bc(){yi&&(clearTimeout(yi),yi=0),ir=await(await Hl("/energyprice.json")).json(),yr.set(ir);let e=new Date;yi=setTimeout(qc,(60-e.getMinutes())*6e4)}let sr={},an;async function Cr(){an&&(clearTimeout(an),an=0),sr=await(await Hl("/dayplot.json")).json(),Uc.set(sr);let e=new Date;an=setTimeout(Cr,(60-e.getMinutes())*6e4+20)}const Uc=at(sr,t=>(Cr(),function(){}));let rr={},un;async function Mr(){un&&(clearTimeout(un),un=0),rr=await(await Hl("/monthplot.json")).json(),Hc.set(rr);let e=new Date;un=setTimeout(Mr,(24-e.getHours())*36e5+40)}const Hc=at(rr,t=>(Mr(),function(){}));let or={};async function jc(){or=await(await Hl("/temperature.json")).json(),Wc.set(or)}const Wc=at(or,t=>(jc(),function(){}));let ar={},hs;async function zc(){hs&&(clearTimeout(hs),hs=0),ar=await(await Hl("/tariff.json")).json(),Gc.set(ar);let e=new Date;hs=setTimeout(zc,(60-e.getMinutes())*6e4+30)}const Gc=at(ar,t=>function(){});let ur=[];const Sr=at(ur);async function S1(){ur=await(await Hl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Sr.set(ur)}function Ms(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 Vc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Kc(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]),r=parseInt(l[2]),u=[...e];u.reverse();let a,c,f;for(let _=0;_r&&(a=p):S==i+1&&(c=p);else if(d==n+1)if(f){let T=f.tag_name.substring(1).split(".");parseInt(T[0]);let N=parseInt(T[1]);parseInt(T[2]),S==N&&(f=p)}else f=p}return c||f||a||!1}else return e[0]}const T1="/github.svg";function nu(t){let e,l;function n(u,a){return u[1]>1?I1:u[1]>0?D1:u[2]>1?E1:u[2]>0?P1:u[3]>1?A1:u[3]>0?N1:$1}let i=n(t),r=i(t);return{c(){e=$(`Up + `),r.c(),l=Ve()},m(u,a){M(u,e,a),r.m(u,a),M(u,l,a)},p(u,a){i===(i=n(u))&&r?r.p(u,a):(r.d(1),r=i(u),r&&(r.c(),r.m(l.parentNode,l)))},d(u){u&&C(e),r.d(u),u&&C(l)}}}function $1(t){let e,l;return{c(){e=$(t[0]),l=$(" seconds")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&1&&Z(e,n[0])},d(n){n&&C(e),n&&C(l)}}}function N1(t){let e,l;return{c(){e=$(t[3]),l=$(" minute")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function A1(t){let e,l;return{c(){e=$(t[3]),l=$(" minutes")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function P1(t){let e,l;return{c(){e=$(t[2]),l=$(" hour")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function E1(t){let e,l;return{c(){e=$(t[2]),l=$(" hours")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function D1(t){let e,l;return{c(){e=$(t[1]),l=$(" day")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function I1(t){let e,l;return{c(){e=$(t[1]),l=$(" days")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function R1(t){let e,l=t[0]&&nu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=nu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function L1(t,e,l){let{epoch:n}=e,i=0,r=0,u=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,r=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,r,u]}class O1 extends Ee{constructor(e){super(),Pe(this,e,L1,R1,Ne,{epoch:0})}}function F1(t){let e,l,n;return{c(){e=m("span"),l=$(t[2]),o(e,"title",t[1]),o(e,"class",n="bd-"+t[0])},m(i,r){M(i,e,r),s(e,l)},p(i,[r]){r&4&&Z(l,i[2]),r&2&&o(e,"title",i[1]),r&1&&n!==(n="bd-"+i[0])&&o(e,"class",n)},i:fe,o:fe,d(i){i&&C(e)}}}function q1(t,e,l){let{color:n}=e,{title:i}=e,{text:r}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,r=u.text)},[n,i,r]}class fn extends Ee{constructor(e){super(),Pe(this,e,q1,F1,Ne,{color:0,title:1,text:2})}}function B1(t){let e,l=`${Oe(t[0].getDate())}.${Oe(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=$(l),o(e,"class",t[1])},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l=`${Oe(i[0].getDate())}.${Oe(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Oe(i[0].getHours())}:${Oe(i[0].getMinutes())}`)&&Z(n,l),r&2&&o(e,"class",i[1])},d(i){i&&C(e)}}}function U1(t){let e=`${Oe(t[0].getDate())}. ${nr[t[0].getMonth()]} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,l;return{c(){l=$(e)},m(n,i){M(n,l,i)},p(n,i){i&1&&e!==(e=`${Oe(n[0].getDate())}. ${nr[n[0].getMonth()]} ${Oe(n[0].getHours())}:${Oe(n[0].getMinutes())}`)&&Z(l,e)},d(n){n&&C(l)}}}function H1(t){let e;function l(r,u){return r[2]?U1:B1}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(r,u){i.m(r,u),M(r,e,u)},p(r,[u]){n===(n=l(r))&&i?i.p(r,u):(i.d(1),i=n(r),i&&(i.c(),i.m(e.parentNode,e)))},i:fe,o:fe,d(r){i.d(r),r&&C(e)}}}function j1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:r}=e,u;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,r=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(r)||fl(n,r-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,r]}class Yc extends Ee{constructor(e){super(),Pe(this,e,j1,H1,Ne,{timestamp:0,fullTimeColor:1,offset:3})}}function W1(t){let e,l,n;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(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"),o(n,"stroke-linecap","round"),o(n,"stroke-linejoin","round"),o(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(i,r){M(i,e,r),s(e,l),s(e,n)},p:fe,i:fe,o:fe,d(i){i&&C(e)}}}class z1 extends Ee{constructor(e){super(),Pe(this,e,null,W1,Ne,{})}}function G1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(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"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class V1 extends Ee{constructor(e){super(),Pe(this,e,null,G1,Ne,{})}}function K1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(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"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Ut extends Ee{constructor(e){super(),Pe(this,e,null,K1,Ne,{})}}function Y1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(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"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Qc extends Ee{constructor(e){super(),Pe(this,e,null,Y1,Ne,{})}}function Q1(t){let e,l,n=t[1].version+"",i;return{c(){e=$("AMS reader "),l=m("span"),i=$(n)},m(r,u){M(r,e,u),M(r,l,u),s(l,i)},p(r,u){u&2&&n!==(n=r[1].version+"")&&Z(i,n)},d(r){r&&C(e),r&&C(l)}}}function iu(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=$(l),i=$("\xB0C"),o(e,"class","flex-none my-auto")},m(r,u){M(r,e,u),s(e,n),s(e,i)},p(r,u){u&1&&l!==(l=(r[0].t>-50?r[0].t.toFixed(1):"-")+"")&&Z(n,l)},d(r){r&&C(e)}}}function su(t){let e,l="HAN: "+Ya(t[0].he),n;return{c(){e=m("div"),n=$(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l="HAN: "+Ya(i[0].he))&&Z(n,l)},d(i){i&&C(e)}}}function ru(t){let e,l="MQTT: "+Qa(t[0].me),n;return{c(){e=m("div"),n=$(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l="MQTT: "+Qa(i[0].me))&&Z(n,l)},d(i){i&&C(e)}}}function ou(t){let e,l="PriceAPI: "+Xa(t[0].ee),n;return{c(){e=m("div"),n=$(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l="PriceAPI: "+Xa(i[0].ee))&&Z(n,l)},d(i){i&&C(e)}}}function au(t){let e,l,n,i,r,u;return l=new el({props:{to:"/configuration",$$slots:{default:[X1]},$$scope:{ctx:t}}}),r=new el({props:{to:"/status",$$slots:{default:[Z1]},$$scope:{ctx:t}}}),{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("div"),ie(r.$$.fragment),o(e,"class","flex-none px-1 mt-1"),o(e,"title","Configuration"),o(i,"class","flex-none px-1 mt-1"),o(i,"title","Device information")},m(a,c){M(a,e,c),le(l,e,null),M(a,n,c),M(a,i,c),le(r,i,null),u=!0},i(a){u||(D(l.$$.fragment,a),D(r.$$.fragment,a),u=!0)},o(a){q(l.$$.fragment,a),q(r.$$.fragment,a),u=!1},d(a){a&&C(e),ne(l),a&&C(n),a&&C(i),ne(r)}}}function X1(t){let e,l;return e=new z1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Z1(t){let e,l;return e=new V1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function uu(t){let e,l,n,i,r;const u=[x1,J1],a=[];function c(f,_){return f[1].security==0||f[0].a?0:1}return l=c(t),n=a[l]=u[l](t),{c(){e=m("div"),n.c(),o(e,"class","flex-none mr-3 text-yellow-500"),o(e,"title",i="New version: "+t[2].tag_name)},m(f,_){M(f,e,_),a[l].m(e,null),r=!0},p(f,_){let p=l;l=c(f),l===p?a[l].p(f,_):(De(),q(a[p],1,1,()=>{a[p]=null}),Ie(),n=a[l],n?n.p(f,_):(n=a[l]=u[l](f),n.c()),D(n,1),n.m(e,null)),(!r||_&4&&i!==(i="New version: "+f[2].tag_name))&&o(e,"title",i)},i(f){r||(D(n),r=!0)},o(f){q(n),r=!1},d(f){f&&C(e),a[l].d()}}}function J1(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=$("New version: "),i=$(n)},m(r,u){M(r,e,u),s(e,l),s(e,i)},p(r,u){u&4&&n!==(n=r[2].tag_name+"")&&Z(i,n)},i:fe,o:fe,d(r){r&&C(e)}}}function x1(t){let e,l,n,i=t[2].tag_name+"",r,u,a,c,f,_;return a=new Qc({}),{c(){e=m("button"),l=m("span"),n=$("New version: "),r=$(i),u=h(),ie(a.$$.fragment),o(l,"class","mt-1"),o(e,"class","flex")},m(p,b){M(p,e,b),s(e,l),s(l,n),s(l,r),s(e,u),le(a,e,null),c=!0,f||(_=ee(e,"click",t[3]),f=!0)},p(p,b){(!c||b&4)&&i!==(i=p[2].tag_name+"")&&Z(r,i)},i(p){c||(D(a.$$.fragment,p),c=!0)},o(p){q(a.$$.fragment,p),c=!1},d(p){p&&C(e),ne(a),f=!1,_()}}}function em(t){let e,l,n,i,r,u,a,c,f,_,p,b,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,Te,He,Re,je;i=new el({props:{to:"/",$$slots:{default:[Q1]},$$scope:{ctx:t}}}),c=new O1({props:{epoch:t[0].u}});let we=t[0].t>-50&&iu(t);N=new fn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:ql(t[1].booting?2:t[0].em)}}),B=new fn({props:{title:"HAN",text:"HAN",color:ql(t[1].booting?9:t[0].hm)}}),L=new fn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:ql(t[1].booting?9:t[0].wm)}}),F=new fn({props:{title:"MQTT",text:"MQTT",color:ql(t[1].booting?9:t[0].mm)}});let $e=(t[0].he<0||t[0].he>0)&&su(t),Le=t[0].me<0&&ru(t),Me=(t[0].ee>0||t[0].ee<0)&&ou(t);oe=new Yc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let w=t[1].vndcfg&&t[1].usrcfg&&au(t);He=new Ut({});let g=t[1].fwconsent===1&&t[2]&&uu(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),ie(i.$$.fragment),r=h(),u=m("div"),a=m("div"),ie(c.$$.fragment),f=h(),we&&we.c(),_=h(),p=m("div"),b=$("Free mem: "),d=$(v),S=$("kb"),y=h(),T=m("div"),ie(N.$$.fragment),E=h(),ie(B.$$.fragment),P=h(),ie(L.$$.fragment),O=h(),ie(F.$$.fragment),x=h(),$e&&$e.c(),H=h(),Le&&Le.c(),z=h(),Me&&Me.c(),G=h(),V=m("div"),W=m("div"),U=m("a"),K=m("img"),Y=h(),X=m("div"),ie(oe.$$.fragment),ue=h(),w&&w.c(),ke=h(),me=m("div"),Te=m("a"),ie(He.$$.fragment),Re=h(),g&&g.c(),o(n,"class","flex text-lg text-gray-100 p-2"),o(a,"class","flex-none my-auto"),o(p,"class","flex-none my-auto"),o(u,"class","flex-none my-auto p-2 flex space-x-4"),o(T,"class","flex-auto flex-wrap my-auto justify-center p-2"),o(K,"class","gh-logo"),Js(K.src,j=T1)||o(K,"src",j),o(K,"alt","GitHub repo"),o(U,"class","float-right"),o(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),o(U,"target","_blank"),o(U,"rel","noreferrer"),o(U,"aria-label","GitHub"),o(W,"class","flex-none"),o(X,"class","flex-none my-auto px-2"),o(Te,"href",Ht("")),o(Te,"target","_blank"),o(Te,"rel","noreferrer"),o(me,"class","flex-none px-1 mt-1"),o(me,"title","Documentation"),o(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),o(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),o(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(k,A){M(k,e,A),s(e,l),s(l,n),le(i,n,null),s(l,r),s(l,u),s(u,a),le(c,a,null),s(u,f),we&&we.m(u,null),s(u,_),s(u,p),s(p,b),s(p,d),s(p,S),s(l,y),s(l,T),le(N,T,null),s(T,E),le(B,T,null),s(T,P),le(L,T,null),s(T,O),le(F,T,null),s(l,x),$e&&$e.m(l,null),s(l,H),Le&&Le.m(l,null),s(l,z),Me&&Me.m(l,null),s(l,G),s(l,V),s(V,W),s(W,U),s(U,K),s(V,Y),s(V,X),le(oe,X,null),s(V,ue),w&&w.m(V,null),s(V,ke),s(V,me),s(me,Te),le(He,Te,null),s(V,Re),g&&g.m(V,null),je=!0},p(k,[A]){const I={};A&18&&(I.$$scope={dirty:A,ctx:k}),i.$set(I);const Q={};A&1&&(Q.epoch=k[0].u),c.$set(Q),k[0].t>-50?we?we.p(k,A):(we=iu(k),we.c(),we.m(u,_)):we&&(we.d(1),we=null),(!je||A&1)&&v!==(v=(k[0].m?(k[0].m/1e3).toFixed(1):"-")+"")&&Z(d,v);const J={};A&3&&(J.text=k[1].booting?"Booting":k[0].v>2?k[0].v.toFixed(2)+"V":"ESP"),A&3&&(J.color=ql(k[1].booting?2:k[0].em)),N.$set(J);const se={};A&3&&(se.color=ql(k[1].booting?9:k[0].hm)),B.$set(se);const ce={};A&1&&(ce.text=k[0].r?k[0].r.toFixed(0)+"dBm":"WiFi"),A&3&&(ce.color=ql(k[1].booting?9:k[0].wm)),L.$set(ce);const ve={};A&3&&(ve.color=ql(k[1].booting?9:k[0].mm)),F.$set(ve),k[0].he<0||k[0].he>0?$e?$e.p(k,A):($e=su(k),$e.c(),$e.m(l,H)):$e&&($e.d(1),$e=null),k[0].me<0?Le?Le.p(k,A):(Le=ru(k),Le.c(),Le.m(l,z)):Le&&(Le.d(1),Le=null),k[0].ee>0||k[0].ee<0?Me?Me.p(k,A):(Me=ou(k),Me.c(),Me.m(l,G)):Me&&(Me.d(1),Me=null);const Se={};A&1&&(Se.timestamp=k[0].c?new Date(k[0].c*1e3):new Date(0)),A&2&&(Se.offset=k[1].clock_offset),oe.$set(Se),k[1].vndcfg&&k[1].usrcfg?w?A&2&&D(w,1):(w=au(k),w.c(),D(w,1),w.m(V,ke)):w&&(De(),q(w,1,1,()=>{w=null}),Ie()),k[1].fwconsent===1&&k[2]?g?(g.p(k,A),A&6&&D(g,1)):(g=uu(k),g.c(),D(g,1),g.m(V,null)):g&&(De(),q(g,1,1,()=>{g=null}),Ie())},i(k){je||(D(i.$$.fragment,k),D(c.$$.fragment,k),D(N.$$.fragment,k),D(B.$$.fragment,k),D(L.$$.fragment,k),D(F.$$.fragment,k),D(oe.$$.fragment,k),D(w),D(He.$$.fragment,k),D(g),je=!0)},o(k){q(i.$$.fragment,k),q(c.$$.fragment,k),q(N.$$.fragment,k),q(B.$$.fragment,k),q(L.$$.fragment,k),q(F.$$.fragment,k),q(oe.$$.fragment,k),q(w),q(He.$$.fragment,k),q(g),je=!1},d(k){k&&C(e),ne(i),ne(c),we&&we.d(),ne(N),ne(B),ne(L),ne(F),$e&&$e.d(),Le&&Le.d(),Me&&Me.d(),ne(oe),w&&w.d(),ne(He),g&&g.d()}}}function tm(t,e,l){let{data:n={}}=e,i={},r={};function u(){confirm("Do you want to upgrade this device to "+r.tag_name+"?")&&(!oi(i.board)||confirm(Ms(be(i.chip,i.board))))&&(Rt.update(a=>(a.upgrading=!0,a)),Vc(r.tag_name))}return Rt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&S1()}),Sr.subscribe(a=>{l(2,r=Kc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,r,u]}class lm extends Ee{constructor(e){super(),Pe(this,e,tm,em,Ne,{data:0})}}function nm(t){let e,l,n,i;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),o(l,"d",Zs(150,150,115,210,510)),o(l,"stroke","#eee"),o(l,"fill","none"),o(l,"stroke-width","55"),o(n,"d",i=Zs(150,150,115,210,210+300*t[0]/100)),o(n,"stroke",t[1]),o(n,"fill","none"),o(n,"stroke-width","55"),o(e,"viewBox","0 0 300 300"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"height","100%")},m(r,u){M(r,e,u),s(e,l),s(e,n)},p(r,[u]){u&1&&i!==(i=Zs(150,150,115,210,210+300*r[0]/100))&&o(n,"d",i),u&2&&o(n,"stroke",r[1])},i:fe,o:fe,d(r){r&&C(e)}}}function fu(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 Zs(t,e,l,n,i){var r=fu(t,e,l,i),u=fu(t,e,l,n),a=i-n<=180?"0":"1",c=["M",r.x,r.y,"A",l,l,0,a,0,u.x,u.y].join(" ");return c}function im(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=r=>{"pct"in r&&l(0,n=r.pct),"color"in r&&l(1,i=r.color)},[n,i]}class sm extends Ee{constructor(e){super(),Pe(this,e,im,nm,Ne,{pct:0,color:1})}}function cu(t){let e,l,n,i,r,u,a,c;return{c(){e=m("br"),l=h(),n=m("span"),i=$(t[3]),r=h(),u=m("span"),a=$(t[4]),c=$("/kWh"),o(n,"class","pl-sub"),o(u,"class","pl-snt")},m(f,_){M(f,e,_),M(f,l,_),M(f,n,_),s(n,i),M(f,r,_),M(f,u,_),s(u,a),s(u,c)},p(f,_){_&8&&Z(i,f[3]),_&16&&Z(a,f[4])},d(f){f&&C(e),f&&C(l),f&&C(n),f&&C(r),f&&C(u)}}}function rm(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y;l=new sm({props:{pct:t[6],color:t[5](t[6])}});let T=t[3]&&cu(t);return{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("span"),r=m("span"),u=$(t[2]),a=h(),c=m("br"),f=h(),_=m("span"),p=$(t[0]),b=h(),v=m("span"),d=$(t[1]),S=h(),T&&T.c(),o(r,"class","pl-lab"),o(_,"class","pl-val"),o(v,"class","pl-unt"),o(i,"class","pl-ov"),o(e,"class","pl-root")},m(N,E){M(N,e,E),le(l,e,null),s(e,n),s(e,i),s(i,r),s(r,u),s(i,a),s(i,c),s(i,f),s(i,_),s(_,p),s(i,b),s(i,v),s(v,d),s(i,S),T&&T.m(i,null),y=!0},p(N,[E]){const B={};E&64&&(B.pct=N[6]),E&96&&(B.color=N[5](N[6])),l.$set(B),(!y||E&4)&&Z(u,N[2]),(!y||E&1)&&Z(p,N[0]),(!y||E&2)&&Z(d,N[1]),N[3]?T?T.p(N,E):(T=cu(N),T.c(),T.m(i,null)):T&&(T.d(1),T=null)},i(N){y||(D(l.$$.fragment,N),y=!0)},o(N){q(l.$$.fragment,N),y=!1},d(N){N&&C(e),ne(l),T&&T.d()}}}function om(t,e,l){let{val:n}=e,{max:i}=e,{unit:r}=e,{label:u}=e,{sub:a=""}=e,{subunit:c=""}=e,{colorFn:f}=e,_=0;return t.$$set=p=>{"val"in p&&l(0,n=p.val),"max"in p&&l(7,i=p.max),"unit"in p&&l(1,r=p.unit),"label"in p&&l(2,u=p.label),"sub"in p&&l(3,a=p.sub),"subunit"in p&&l(4,c=p.subunit),"colorFn"in p&&l(5,f=p.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,r,u,a,c,f,_,i]}class Xc extends Ee{constructor(e){super(),Pe(this,e,om,rm,Ne,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function mu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function pu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function _u(t,e,l){const n=t.slice();return n[15]=e[l],n}function du(t){let e,l,n,i,r,u,a=t[0].title&&vu(t),c=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(r,u){M(r,e,u),s(e,n),i=rc(e,t[9].bind(e))},p(r,u){u&1&&l!==(l=r[0].title+"")&&Z(n,l)},d(r){r&&C(e),i()}}}function hu(t){let e,l,n,i=t[15].label+"",r,u,a,c;return{c(){e=Fe("g"),l=Fe("line"),n=Fe("text"),r=$(i),o(l,"x2","100%"),o(n,"y","-4"),o(n,"x",u=t[15].align=="right"?"85%":""),o(e,"class",a="tick tick-"+t[15].value+" tick-"+t[15].color),o(e,"transform",c="translate(0, "+t[7](t[15].value)+")")},m(f,_){M(f,e,_),s(e,l),s(e,n),s(n,r)},p(f,_){_&1&&i!==(i=f[15].label+"")&&Z(r,i),_&1&&u!==(u=f[15].align=="right"?"85%":"")&&o(n,"x",u),_&1&&a!==(a="tick tick-"+f[15].value+" tick-"+f[15].color)&&o(e,"class",a),_&129&&c!==(c="translate(0, "+f[7](f[15].value)+")")&&o(e,"transform",c)},d(f){f&&C(e)}}}function bu(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&hu(t);return{c(){n&&n.c(),l=Ve()},m(i,r){n&&n.m(i,r),M(i,l,r)},p(i,r){r&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,r):(n=hu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function gu(t){let e,l,n=(t[3]>20||t[13]%2==0)&&ku(t);return{c(){e=Fe("g"),n&&n.c(),o(e,"class","tick"),o(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,r){M(i,e,r),n&&n.m(e,null)},p(i,r){i[3]>20||i[13]%2==0?n?n.p(i,r):(n=ku(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),r&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&o(e,"transform",l)},d(i){i&&C(e),n&&n.d()}}}function ku(t){let e,l=t[11].label+"",n,i;return{c(){e=Fe("text"),n=$(l),o(e,"x",i=t[3]/2),o(e,"y","-4")},m(r,u){M(r,e,u),s(e,n)},p(r,u){u&1&&l!==(l=r[11].label+"")&&Z(n,l),u&8&&i!==(i=r[3]/2)&&o(e,"x",i)},d(r){r&&C(e)}}}function wu(t){let e=!isNaN(t[6](t[13])),l,n=e&&gu(t);return{c(){n&&n.c(),l=Ve()},m(i,r){n&&n.m(i,r),M(i,l,r)},p(i,r){r&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,r):(n=gu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function yu(t){let e,l,n=t[11].value!==void 0&&Cu(t),i=t[11].value2>1e-4&&Tu(t);return{c(){e=Fe("g"),n&&n.c(),l=Fe("g"),i&&i.c()},m(r,u){M(r,e,u),n&&n.m(e,null),M(r,l,u),i&&i.m(l,null)},p(r,u){r[11].value!==void 0?n?n.p(r,u):(n=Cu(r),n.c(),n.m(e,null)):n&&(n.d(1),n=null),r[11].value2>1e-4?i?i.p(r,u):(i=Tu(r),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(r){r&&C(e),n&&n.d(),r&&C(l),i&&i.d()}}}function Cu(t){let e,l,n,i,r,u,a,c=t[3]>15&&Mu(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),o(e,"x",l=t[6](t[13])+2),o(e,"y",n=t[7](t[11].value)),o(e,"width",i=t[3]-4),o(e,"height",r=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),o(e,"fill",u=t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,a,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&o(e,"x",l),_&129&&n!==(n=f[7](f[11].value))&&o(e,"y",n),_&8&&i!==(i=f[3]-4)&&o(e,"width",i),_&129&&r!==(r=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&o(e,"height",r),_&1&&u!==(u=f[11].color)&&o(e,"fill",u),f[3]>15?c?c.p(f,_):(c=Mu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function Mu(t){let e,l=t[11].label+"",n,i,r,u,a,c,f=t[11].title&&Su(t);return{c(){e=Fe("text"),n=$(l),f&&f.c(),c=Ve(),o(e,"width",i=t[3]-4),o(e,"dominant-baseline","middle"),o(e,"text-anchor",r=t[3]t[7](0)-t[8]?t[11].color:"white"),o(e,"transform",a="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[3]_[7](0)-_[8]?_[11].color:"white")&&o(e,"fill",u),p&457&&a!==(a="translate("+(_[6](_[13])+_[3]/2)+" "+(_[7](_[11].value)>_[7](0)-_[8]?_[7](_[11].value)-_[8]:_[7](_[11].value)+10)+") rotate("+(_[3]15&&$u(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),o(e,"x",l=t[6](t[13])+2),o(e,"y",n=t[7](0)),o(e,"width",i=t[3]-4),o(e,"height",r=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),o(e,"fill",u=t[11].color2?t[11].color2:t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,a,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&o(e,"x",l),_&128&&n!==(n=f[7](0))&&o(e,"y",n),_&8&&i!==(i=f[3]-4)&&o(e,"width",i),_&129&&r!==(r=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&o(e,"height",r),_&1&&u!==(u=f[11].color2?f[11].color2:f[11].color)&&o(e,"fill",u),f[3]>15?c?c.p(f,_):(c=$u(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function $u(t){let e,l=t[11].label2+"",n,i,r,u,a,c=t[11].title2&&Nu(t);return{c(){e=Fe("text"),n=$(l),c&&c.c(),a=Ve(),o(e,"width",i=t[3]-4),o(e,"dominant-baseline","middle"),o(e,"text-anchor","middle"),o(e,"fill",r=t[7](-t[11].value2)t[10].call(e))},m(i,r){M(i,e,r),n&&n.m(e,null),l=rc(e,t[10].bind(e))},p(i,[r]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,r):(n=du(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:fe,o:fe,d(i){i&&C(e),n&&n.d(),l()}}}let cn=30;function um(t,e,l){let{config:n}=e,i,r,u,a,c,f,_,p=0;function b(){p=this.clientHeight,l(5,p)}function v(){i=this.clientWidth,r=this.clientHeight,l(1,i),l(2,r)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,f=r-p);let d=i-(n.padding.left+n.padding.right);l(3,u=d/n.points.length),l(8,_=un.y.max?T=n.padding.bottom:yf||T<0?0:T})}},[n,i,r,u,f,p,a,c,_,b,v]}class pn extends Ee{constructor(e){super(),Pe(this,e,um,am,Ne,{config:0})}}function fm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const r={};i&1&&(r.config=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function cm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:r}=e,{ds:u}=e,a={};function c(f){return{label:ge(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:w1(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,r=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],_=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),_.push(c(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),_.push(c(i))),r>0&&(f.push({label:u===1?"L2-L3":"L3"}),_.push(c(r))),l(0,a={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:_})}},[a,n,i,r,u]}class mm extends Ee{constructor(e){super(),Pe(this,e,cm,fm,Ne,{u1:1,u2:2,u3:3,ds:4})}}function pm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const r={};i&1&&(r.config=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function _m(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:r}=e,{i1:u}=e,{i2:a}=e,{i2e:c}=e,{i3:f}=e,{max:_}=e,p={};function b(v){return{label:ge(v)+"A",title:v.toFixed(1)+" A",value:isNaN(v)?0:v,color:Fc(v?v/_*100:0)}}return t.$$set=v=>{"u1"in v&&l(1,n=v.u1),"u2"in v&&l(2,i=v.u2),"u3"in v&&l(3,r=v.u3),"i1"in v&&l(4,u=v.i1),"i2"in v&&l(5,a=v.i2),"i2e"in v&&l(6,c=v.i2e),"i3"in v&&l(7,f=v.i3),"max"in v&&l(8,_=v.max)},t.$$.update=()=>{if(t.$$.dirty&510){let v=[],d=[];n>0&&(v.push({label:"L1"}),d.push(b(u))),i>0&&(c?(v.push({label:"L2"}),d.push({label:"N/A",labelAngle:90,title:"The value is not reported by your meter",value:0,color:"#7c3aedcc"})):(v.push({label:"L2"}),d.push(b(a)))),r>0&&(v.push({label:"L3"}),d.push(b(f))),l(0,p={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:_,ticks:[{value:0,label:"0%"},{value:_/4,label:"25%"},{value:_/2,label:"50%"},{value:_/4*3,label:"75%"},{value:_,label:"100%"}]},x:{ticks:v},points:d})}},[p,n,i,r,u,a,c,f,_]}class dm extends Ee{constructor(e){super(),Pe(this,e,_m,pm,Ne,{u1:1,u2:2,u3:3,i1:4,i2:5,i2e:6,i3:7,max:8})}}function vm(t){let e,l,n,i,r,u,a,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,_,p,b,v,d,S=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",y,T,N,E,B,P,L,O=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,x,H,z,G,V,W=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",U,K;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),r=m("div"),r.textContent="Instant in",u=h(),a=m("div"),f=$(c),_=$(" VAr"),p=h(),b=m("div"),b.textContent="Instant out",v=h(),d=m("div"),y=$(S),T=$(" VAr"),N=h(),E=m("div"),B=m("div"),B.textContent="Total in",P=h(),L=m("div"),F=$(O),x=$(" kVArh"),H=h(),z=m("div"),z.textContent="Total out",G=h(),V=m("div"),U=$(W),K=$(" kVArh"),o(a,"class","text-right"),o(d,"class","text-right"),o(i,"class","grid grid-cols-2 mt-4"),o(L,"class","text-right"),o(V,"class","text-right"),o(E,"class","grid grid-cols-2 mt-4"),o(e,"class","mx-2 text-sm")},m(j,Y){M(j,e,Y),s(e,l),s(e,n),s(e,i),s(i,r),s(i,u),s(i,a),s(a,f),s(a,_),s(i,p),s(i,b),s(i,v),s(i,d),s(d,y),s(d,T),s(e,N),s(e,E),s(E,B),s(E,P),s(E,L),s(L,F),s(L,x),s(E,H),s(E,z),s(E,G),s(E,V),s(V,U),s(V,K)},p(j,[Y]){Y&1&&c!==(c=(typeof j[0]<"u"?j[0].toFixed(0):"-")+"")&&Z(f,c),Y&2&&S!==(S=(typeof j[1]<"u"?j[1].toFixed(0):"-")+"")&&Z(y,S),Y&4&&O!==(O=(typeof j[2]<"u"?j[2].toFixed(1):"-")+"")&&Z(F,O),Y&8&&W!==(W=(typeof j[3]<"u"?j[3].toFixed(1):"-")+"")&&Z(U,W)},i:fe,o:fe,d(j){j&&C(e)}}}function hm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:r}=e,{exportTotal:u}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,r=a.importTotal),"exportTotal"in a&&l(3,u=a.exportTotal)},[n,i,r,u]}class bm extends Ee{constructor(e){super(),Pe(this,e,hm,vm,Ne,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Pu(t){let e;function l(r,u){return r[3]?km:gm}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(r,u){i.m(r,u),M(r,e,u)},p(r,u){n===(n=l(r))&&i?i.p(r,u):(i.d(1),i=n(r),i&&(i.c(),i.m(e.parentNode,e)))},d(r){i.d(r),r&&C(e)}}}function gm(t){let e,l,n,i,r,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d=ge(t[1].d.u,1)+"",S,y,T,N,E,B,P=ge(t[1].m.u)+"",L,O,F,x,H,z,G=ge(t[0].last_month.u)+"",V,W,U,K,j=t[4]&&Eu(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",r=h(),u=m("div"),c=$(a),f=$(" kWh"),_=h(),p=m("div"),p.textContent="Day",b=h(),v=m("div"),S=$(d),y=$(" kWh"),T=h(),N=m("div"),N.textContent="Month",E=h(),B=m("div"),L=$(P),O=$(" kWh"),F=h(),x=m("div"),x.textContent="Last month",H=h(),z=m("div"),V=$(G),W=$(" kWh"),U=h(),j&&j.c(),K=Ve(),o(u,"class","text-right"),o(v,"class","text-right"),o(B,"class","text-right"),o(z,"class","text-right"),o(n,"class","grid grid-cols-2 mb-3")},m(Y,X){M(Y,e,X),M(Y,l,X),M(Y,n,X),s(n,i),s(n,r),s(n,u),s(u,c),s(u,f),s(n,_),s(n,p),s(n,b),s(n,v),s(v,S),s(v,y),s(n,T),s(n,N),s(n,E),s(n,B),s(B,L),s(B,O),s(n,F),s(n,x),s(n,H),s(n,z),s(z,V),s(z,W),M(Y,U,X),j&&j.m(Y,X),M(Y,K,X)},p(Y,X){X&2&&a!==(a=ge(Y[1].h.u,2)+"")&&Z(c,a),X&2&&d!==(d=ge(Y[1].d.u,1)+"")&&Z(S,d),X&2&&P!==(P=ge(Y[1].m.u)+"")&&Z(L,P),X&1&&G!==(G=ge(Y[0].last_month.u)+"")&&Z(V,G),Y[4]?j?j.p(Y,X):(j=Eu(Y),j.c(),j.m(K.parentNode,K)):j&&(j.d(1),j=null)},d(Y){Y&&C(e),Y&&C(l),Y&&C(n),Y&&C(U),j&&j.d(Y),Y&&C(K)}}}function km(t){let e,l,n,i,r,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.u,1)+"",y,T,N,E,B,P,L,O=ge(t[1].m.u)+"",F,x,H,z,G,V,W,U=ge(t[0].last_month.u)+"",K,j,Y,X,oe,ue,ke,me,Te,He,Re,je=ge(t[1].h.p,2)+"",we,$e,Le,Me,w,g,k,A=ge(t[1].d.p,1)+"",I,Q,J,se,ce,ve,Se,re=ge(t[1].m.p)+"",pe,Be,_e,ye,vt,jl,tl,ct=ge(t[0].last_month.p)+"",$l,pl,jt,ht,Xe=t[4]&&Du(t),Ze=t[4]&&Iu(t),Je=t[4]&&Ru(t),Ue=t[4]&&Lu(t),xe=t[4]&&Ou(t),We=t[4]&&Fu(t),et=t[4]&&qu(t),tt=t[4]&&Bu(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",r=h(),u=m("div"),c=$(a),f=$(" kWh"),_=h(),Xe&&Xe.c(),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=$(S),T=$(" kWh"),N=h(),Ze&&Ze.c(),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=$(O),x=$(" kWh"),H=h(),Je&&Je.c(),z=h(),G=m("div"),G.textContent="Last mo.",V=h(),W=m("div"),K=$(U),j=$(" kWh"),Y=h(),Ue&&Ue.c(),oe=h(),ue=m("strong"),ue.textContent="Export",ke=h(),me=m("div"),Te=m("div"),Te.textContent="Hour",He=h(),Re=m("div"),we=$(je),$e=$(" kWh"),Le=h(),xe&&xe.c(),Me=h(),w=m("div"),w.textContent="Day",g=h(),k=m("div"),I=$(A),Q=$(" kWh"),J=h(),We&&We.c(),se=h(),ce=m("div"),ce.textContent="Month",ve=h(),Se=m("div"),pe=$(re),Be=$(" kWh"),_e=h(),et&&et.c(),ye=h(),vt=m("div"),vt.textContent="Last mo.",jl=h(),tl=m("div"),$l=$(ct),pl=$(" kWh"),jt=h(),tt&&tt.c(),o(u,"class","text-right"),o(d,"class","text-right"),o(L,"class","text-right"),o(W,"class","text-right"),o(n,"class",X="grid grid-cols-"+t[5]+" mb-3"),o(Re,"class","text-right"),o(k,"class","text-right"),o(Se,"class","text-right"),o(tl,"class","text-right"),o(me,"class",ht="grid grid-cols-"+t[5])},m(de,Ce){M(de,e,Ce),M(de,l,Ce),M(de,n,Ce),s(n,i),s(n,r),s(n,u),s(u,c),s(u,f),s(n,_),Xe&&Xe.m(n,null),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,T),s(n,N),Ze&&Ze.m(n,null),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(n,H),Je&&Je.m(n,null),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,j),s(n,Y),Ue&&Ue.m(n,null),M(de,oe,Ce),M(de,ue,Ce),M(de,ke,Ce),M(de,me,Ce),s(me,Te),s(me,He),s(me,Re),s(Re,we),s(Re,$e),s(me,Le),xe&&xe.m(me,null),s(me,Me),s(me,w),s(me,g),s(me,k),s(k,I),s(k,Q),s(me,J),We&&We.m(me,null),s(me,se),s(me,ce),s(me,ve),s(me,Se),s(Se,pe),s(Se,Be),s(me,_e),et&&et.m(me,null),s(me,ye),s(me,vt),s(me,jl),s(me,tl),s(tl,$l),s(tl,pl),s(me,jt),tt&&tt.m(me,null)},p(de,Ce){Ce&2&&a!==(a=ge(de[1].h.u,2)+"")&&Z(c,a),de[4]?Xe?Xe.p(de,Ce):(Xe=Du(de),Xe.c(),Xe.m(n,p)):Xe&&(Xe.d(1),Xe=null),Ce&2&&S!==(S=ge(de[1].d.u,1)+"")&&Z(y,S),de[4]?Ze?Ze.p(de,Ce):(Ze=Iu(de),Ze.c(),Ze.m(n,E)):Ze&&(Ze.d(1),Ze=null),Ce&2&&O!==(O=ge(de[1].m.u)+"")&&Z(F,O),de[4]?Je?Je.p(de,Ce):(Je=Ru(de),Je.c(),Je.m(n,z)):Je&&(Je.d(1),Je=null),Ce&1&&U!==(U=ge(de[0].last_month.u)+"")&&Z(K,U),de[4]?Ue?Ue.p(de,Ce):(Ue=Lu(de),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),Ce&32&&X!==(X="grid grid-cols-"+de[5]+" mb-3")&&o(n,"class",X),Ce&2&&je!==(je=ge(de[1].h.p,2)+"")&&Z(we,je),de[4]?xe?xe.p(de,Ce):(xe=Ou(de),xe.c(),xe.m(me,Me)):xe&&(xe.d(1),xe=null),Ce&2&&A!==(A=ge(de[1].d.p,1)+"")&&Z(I,A),de[4]?We?We.p(de,Ce):(We=Fu(de),We.c(),We.m(me,se)):We&&(We.d(1),We=null),Ce&2&&re!==(re=ge(de[1].m.p)+"")&&Z(pe,re),de[4]?et?et.p(de,Ce):(et=qu(de),et.c(),et.m(me,ye)):et&&(et.d(1),et=null),Ce&1&&ct!==(ct=ge(de[0].last_month.p)+"")&&Z($l,ct),de[4]?tt?tt.p(de,Ce):(tt=Bu(de),tt.c(),tt.m(me,null)):tt&&(tt.d(1),tt=null),Ce&32&&ht!==(ht="grid grid-cols-"+de[5])&&o(me,"class",ht)},d(de){de&&C(e),de&&C(l),de&&C(n),Xe&&Xe.d(),Ze&&Ze.d(),Je&&Je.d(),Ue&&Ue.d(),de&&C(oe),de&&C(ue),de&&C(ke),de&&C(me),xe&&xe.d(),We&&We.d(),et&&et.d(),tt&&tt.d()}}}function Eu(t){let e,l,n,i,r,u,a=ge(t[1].h.c,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.c,1)+"",y,T,N,E,B,P,L,O=ge(t[1].m.c)+"",F,x,H,z,G,V,W,U=ge(t[0].last_month.c)+"",K,j,Y;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",r=h(),u=m("div"),c=$(a),f=h(),_=$(t[2]),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=$(S),T=h(),N=$(t[2]),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=$(O),x=h(),H=$(t[2]),z=h(),G=m("div"),G.textContent="Last month",V=h(),W=m("div"),K=$(U),j=h(),Y=$(t[2]),o(u,"class","text-right"),o(d,"class","text-right"),o(L,"class","text-right"),o(W,"class","text-right"),o(n,"class","grid grid-cols-2")},m(X,oe){M(X,e,oe),M(X,l,oe),M(X,n,oe),s(n,i),s(n,r),s(n,u),s(u,c),s(u,f),s(u,_),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,T),s(d,N),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(L,H),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,j),s(W,Y)},p(X,oe){oe&2&&a!==(a=ge(X[1].h.c,2)+"")&&Z(c,a),oe&4&&Z(_,X[2]),oe&2&&S!==(S=ge(X[1].d.c,1)+"")&&Z(y,S),oe&4&&Z(N,X[2]),oe&2&&O!==(O=ge(X[1].m.c)+"")&&Z(F,O),oe&4&&Z(H,X[2]),oe&1&&U!==(U=ge(X[0].last_month.c)+"")&&Z(K,U),oe&4&&Z(Y,X[2])},d(X){X&&C(e),X&&C(l),X&&C(n)}}}function Du(t){let e,l=ge(t[1].h.c,2)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].h.c,2)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Iu(t){let e,l=ge(t[1].d.c,1)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].d.c,1)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Ru(t){let e,l=ge(t[1].m.c)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].m.c)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Lu(t){let e,l=ge(t[0].last_month.c)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.c)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Ou(t){let e,l=ge(t[1].h.i,2)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].h.i,2)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Fu(t){let e,l=ge(t[1].d.i,1)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].d.i,1)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function qu(t){let e,l=ge(t[1].m.i)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].m.i)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Bu(t){let e,l=ge(t[0].last_month.i)+"",n,i,r;return{c(){e=m("div"),n=$(l),i=h(),r=$(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.i)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function wm(t){let e,l,n,i,r,u,a=t[1]&&Pu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),r=m("br"),u=h(),a&&a.c(),o(e,"class","mx-2 text-sm")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),s(e,u),a&&a.m(e,null)},p(c,[f]){c[1]?a?a.p(c,f):(a=Pu(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:fe,o:fe,d(c){c&&C(e),a&&a.d()}}}function ym(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:r}=e,{hasExport:u}=e,a=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,r=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=a?3:2))},[n,i,r,u,a,c]}class Cm extends Ee{constructor(e){super(),Pe(this,e,ym,wm,Ne,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Mm(t){let e,l,n=xa(t[0].source)+"",i,r,u,a,c;return a=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=$("Provided by: "),i=$(n),u=h(),ie(a.$$.fragment),o(e,"href",r=eu(t[0].source)),o(e,"target","_blank"),o(e,"class","text-xs float-right z-40")},m(f,_){M(f,e,_),s(e,l),s(e,i),M(f,u,_),le(a,f,_),c=!0},p(f,[_]){(!c||_&1)&&n!==(n=xa(f[0].source)+"")&&Z(i,n),(!c||_&1&&r!==(r=eu(f[0].source)))&&o(e,"href",r);const p={};_&2&&(p.config=f[1]),a.$set(p)},i(f){c||(D(a.$$.fragment,f),c=!0)},o(f){q(a.$$.fragment,f),c=!1},d(f){f&&C(e),f&&C(u),ne(a,f)}}}function Sm(t,e,l){let{json:n}=e,{sysinfo:i}=e,r={},u,a;return t.$$set=c=>{"json"in c&&l(0,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let c=n.currency,f=new Date().getUTCHours(),_=0,p=0,b=0,v=[],d=[],S=[];l(4,a=l(3,u=0));let y=new Date;for(fl(y,i.clock_offset-(24+y.getHours()-y.getUTCHours())%24),_=f;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),S.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);for(_=0;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),S.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);if(a>-100&&u<100){switch(c){case"NOK":case"DKK":c="\xF8re";break;case"SEK":c="\xF6re";break;case"EUR":c="cent";break;case"CHF":c="rp.";break;default:c=c+"/100"}for(l(4,a*=100),l(3,u*=100),_=0;_=0?P.toFixed(L):"",title:P>=0?P.toFixed(2)+" "+c:"",value:p>=0?Math.abs(p):0,label2:P<0?P.toFixed(L):"",title2:P<0?P.toFixed(2)+" "+c:"",value2:p<0?Math.abs(p):0,color:"#7c3aed"})}let N=Math.max(u,Math.abs(a));if(a<0){l(4,a=Math.min(N/4*-1,a));let P=Math.ceil(Math.abs(a)/N*4),L=a/P;for(_=1;_{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=fl(new Date,-24),v=new Date().getUTCHours();for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),c=v;c<24;c++){let T=n["i"+Oe(c)],N=n["e"+Oe(c)];T===void 0&&(T=0),N===void 0&&(N=0),_.push({label:Oe(b.getHours())}),p.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:N.toFixed(1),title2:N.toFixed(2)+" kWh",value2:N*10,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N*10)),l(3,u=Math.max(u,T*10)),fl(b,1)}for(c=0;c{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=new Date,v=new Date;for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),fl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),v.setDate(0),c=b.getDate();c<=v.getDate();c++){let T=n["i"+Oe(c)],N=n["e"+Oe(c)];T===void 0&&(T=0),N===void 0&&(N=0),_.push({label:Oe(c)}),p.push({label:T.toFixed(T<10?1:0),title:T.toFixed(2)+" kWh",value:T,label2:N.toFixed(N<10?1:0),title2:N.toFixed(2)+" kWh",value2:N,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N)),l(3,u=Math.max(u,T))}for(c=1;c{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=0,f=[],_=[],p=[];n.s&&n.s.forEach((d,S)=>{var y=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),_.push({label:y.slice(-4)}),p.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,u=Math.min(u,c)),l(2,r=Math.max(r,c))}),l(2,r=Math.ceil(r)),l(3,u=Math.floor(u));let b=r;u<0&&(b+=Math.abs(u));let v=b/4;for(a=0;a<5;a++)c=u+v*a,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:u,max:r,ticks:f},x:{ticks:_},points:p})}},[i,n,r,u]}class Lm extends Ee{constructor(e){super(),Pe(this,e,Rm,Im,Ne,{json:1})}}function Om(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const r={};i&1&&(r.config=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}let Fm=0;function qm(t,e,l){let n={},i=0,r;return Gc.subscribe(u=>{l(2,r=u)}),zc(),t.$$.update=()=>{if(t.$$.dirty&6){let u=0,a=[],c=[],f=[];if(a.push({value:0,label:0}),r&&r.p)for(u=0;u0?Oe(_.d)+"."+nr[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,_.v))}if(r&&r.t){for(u=0;u=i)break;a.push({value:_,label:_})}a.push({label:r.m.toFixed(1),align:"right",color:"green",value:r.m})}r&&r.c&&(a.push({label:r.c.toFixed(0),color:"orange",value:r.c}),l(1,i=Math.max(i,r.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Fm,max:i,ticks:a},x:{ticks:c},points:f})}},[n,i,r]}class Bm extends Ee{constructor(e){super(),Pe(this,e,qm,Om,Ne,{})}}function Uu(t){let e,l,n,i,r,u,a=(t[0].mt?Cs(t[0].mt):"-")+"",c,f,_,p=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,v,d;return i=new Xc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:Fc}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),r=h(),u=m("div"),c=$(a),f=h(),_=m("div"),b=$(p),v=$(" kWh"),o(n,"class","col-span-2"),o(_,"class","text-right"),o(l,"class","grid grid-cols-2"),o(e,"class","cnt")},m(S,y){M(S,e,y),s(e,l),s(l,n),le(i,n,null),s(l,r),s(l,u),s(u,c),s(l,f),s(l,_),s(_,b),s(_,v),d=!0},p(S,y){const T={};y&1&&(T.val=S[0].i?S[0].i:0),y&1&&(T.max=S[0].im?S[0].im:15e3),y&1&&(T.sub=S[0].p),y&1&&(T.subunit=S[0].pc),i.$set(T),(!d||y&1)&&a!==(a=(S[0].mt?Cs(S[0].mt):"-")+"")&&Z(c,a),(!d||y&1)&&p!==(p=(S[0].ic?S[0].ic.toFixed(1):"-")+"")&&Z(b,p)},i(S){d||(D(i.$$.fragment,S),d=!0)},o(S){q(i.$$.fragment,S),d=!1},d(S){S&&C(e),ne(i)}}}function Hu(t){let e,l,n,i,r,u,a,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,p,b;return i=new Xc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:y1}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),r=h(),u=m("div"),a=h(),c=m("div"),_=$(f),p=$(" kWh"),o(n,"class","col-span-2"),o(c,"class","text-right"),o(l,"class","grid grid-cols-2"),o(e,"class","cnt")},m(v,d){M(v,e,d),s(e,l),s(l,n),le(i,n,null),s(l,r),s(l,u),s(l,a),s(l,c),s(c,_),s(c,p),b=!0},p(v,d){const S={};d&1&&(S.val=v[0].e?v[0].e:0),d&1&&(S.max=v[0].om?v[0].om*1e3:1e4),i.$set(S),(!b||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&Z(_,f)},i(v){b||(D(i.$$.fragment,v),b=!0)},o(v){q(i.$$.fragment,v),b=!1},d(v){v&&C(e),ne(i)}}}function ju(t){let e,l,n;return l=new mm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&1&&(u.u1=i[0].u1),r&1&&(u.u2=i[0].u2),r&1&&(u.u3=i[0].u3),r&1&&(u.ds=i[0].ds),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Wu(t){let e,l,n;return l=new dm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i2e:t[0].i2e,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&1&&(u.u1=i[0].u1),r&1&&(u.u2=i[0].u2),r&1&&(u.u3=i[0].u3),r&1&&(u.i1=i[0].i1),r&1&&(u.i2=i[0].i2),r&1&&(u.i2e=i[0].i2e),r&1&&(u.i3=i[0].i3),r&1&&(u.max=i[0].mf?i[0].mf:32),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function zu(t){let e,l,n;return l=new bm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&1&&(u.importInstant=i[0].ri),r&1&&(u.exportInstant=i[0].re),r&1&&(u.importTotal=i[0].ric),r&1&&(u.exportTotal=i[0].rec),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Gu(t){let e,l,n;return l=new Cm({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&2&&(u.sysinfo=i[1]),r&1&&(u.data=i[0].ea),r&1&&(u.currency=i[0].pc),r&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Vu(t){let e,l,n;return l=new Bm({}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt h-64")},m(i,r){M(i,e,r),le(l,e,null),n=!0},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Ku(t){let e,l,n;return l=new Tm({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&4&&(u.json=i[2]),r&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Yu(t){let e,l,n;return l=new Am({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&8&&(u.json=i[3]),r&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Qu(t){let e,l,n;return l=new Dm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&16&&(u.json=i[4]),r&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Xu(t){let e,l,n;return l=new Lm({props:{json:t[5]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&32&&(u.json=i[5]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Um(t){let e,l=Ke(t[1].ui.i,t[0].i),n,i=Ke(t[1].ui.e,t[0].om||t[0].e>0),r,u=Ke(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,c=Ke(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,_=Ke(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),p,b=Ke(t[1].ui.c,t[0].ea),v,d=Ke(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),S,y=Ke(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),T,N=Ke(t[1].ui.d,t[3]),E,B=Ke(t[1].ui.m,t[4]),P,L=Ke(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),O,F=l&&Uu(t),x=i&&Hu(t),H=u&&ju(t),z=c&&Wu(t),G=_&&zu(t),V=b&&Gu(t),W=d&&Vu(),U=y&&Ku(t),K=N&&Yu(t),j=B&&Qu(t),Y=L&&Xu(t);return{c(){e=m("div"),F&&F.c(),n=h(),x&&x.c(),r=h(),H&&H.c(),a=h(),z&&z.c(),f=h(),G&&G.c(),p=h(),V&&V.c(),v=h(),W&&W.c(),S=h(),U&&U.c(),T=h(),K&&K.c(),E=h(),j&&j.c(),P=h(),Y&&Y.c(),o(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(X,oe){M(X,e,oe),F&&F.m(e,null),s(e,n),x&&x.m(e,null),s(e,r),H&&H.m(e,null),s(e,a),z&&z.m(e,null),s(e,f),G&&G.m(e,null),s(e,p),V&&V.m(e,null),s(e,v),W&&W.m(e,null),s(e,S),U&&U.m(e,null),s(e,T),K&&K.m(e,null),s(e,E),j&&j.m(e,null),s(e,P),Y&&Y.m(e,null),O=!0},p(X,[oe]){oe&3&&(l=Ke(X[1].ui.i,X[0].i)),l?F?(F.p(X,oe),oe&3&&D(F,1)):(F=Uu(X),F.c(),D(F,1),F.m(e,n)):F&&(De(),q(F,1,1,()=>{F=null}),Ie()),oe&3&&(i=Ke(X[1].ui.e,X[0].om||X[0].e>0)),i?x?(x.p(X,oe),oe&3&&D(x,1)):(x=Hu(X),x.c(),D(x,1),x.m(e,r)):x&&(De(),q(x,1,1,()=>{x=null}),Ie()),oe&3&&(u=Ke(X[1].ui.v,X[0].u1>100||X[0].u2>100||X[0].u3>100)),u?H?(H.p(X,oe),oe&3&&D(H,1)):(H=ju(X),H.c(),D(H,1),H.m(e,a)):H&&(De(),q(H,1,1,()=>{H=null}),Ie()),oe&3&&(c=Ke(X[1].ui.a,X[0].i1>.01||X[0].i2>.01||X[0].i3>.01)),c?z?(z.p(X,oe),oe&3&&D(z,1)):(z=Wu(X),z.c(),D(z,1),z.m(e,f)):z&&(De(),q(z,1,1,()=>{z=null}),Ie()),oe&3&&(_=Ke(X[1].ui.r,X[0].ri>0||X[0].re>0||X[0].ric>0||X[0].rec>0)),_?G?(G.p(X,oe),oe&3&&D(G,1)):(G=zu(X),G.c(),D(G,1),G.m(e,p)):G&&(De(),q(G,1,1,()=>{G=null}),Ie()),oe&3&&(b=Ke(X[1].ui.c,X[0].ea)),b?V?(V.p(X,oe),oe&3&&D(V,1)):(V=Gu(X),V.c(),D(V,1),V.m(e,v)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),oe&3&&(d=Ke(X[1].ui.t,X[0].pr&&(X[0].pr.startsWith("10YNO")||X[0].pr.startsWith("10Y1001A1001A4")))),d?W?oe&3&&D(W,1):(W=Vu(),W.c(),D(W,1),W.m(e,S)):W&&(De(),q(W,1,1,()=>{W=null}),Ie()),oe&3&&(y=Ke(X[1].ui.p,X[0].pe&&!Number.isNaN(X[0].p))),y?U?(U.p(X,oe),oe&3&&D(U,1)):(U=Ku(X),U.c(),D(U,1),U.m(e,T)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),oe&10&&(N=Ke(X[1].ui.d,X[3])),N?K?(K.p(X,oe),oe&10&&D(K,1)):(K=Yu(X),K.c(),D(K,1),K.m(e,E)):K&&(De(),q(K,1,1,()=>{K=null}),Ie()),oe&18&&(B=Ke(X[1].ui.m,X[4])),B?j?(j.p(X,oe),oe&18&&D(j,1)):(j=Qu(X),j.c(),D(j,1),j.m(e,P)):j&&(De(),q(j,1,1,()=>{j=null}),Ie()),oe&35&&(L=Ke(X[1].ui.s,X[0].t&&X[0].t!=-127&&X[5].c>1)),L?Y?(Y.p(X,oe),oe&35&&D(Y,1)):(Y=Xu(X),Y.c(),D(Y,1),Y.m(e,null)):Y&&(De(),q(Y,1,1,()=>{Y=null}),Ie())},i(X){O||(D(F),D(x),D(H),D(z),D(G),D(V),D(W),D(U),D(K),D(j),D(Y),O=!0)},o(X){q(F),q(x),q(H),q(z),q(G),q(V),q(W),q(U),q(K),q(j),q(Y),O=!1},d(X){X&&C(e),F&&F.d(),x&&x.d(),H&&H.d(),z&&z.d(),G&&G.d(),V&&V.d(),W&&W.d(),U&&U.d(),K&&K.d(),j&&j.d(),Y&&Y.d()}}}function Hm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,r={},u={},a={},c={};return yr.subscribe(f=>{l(2,r=f)}),Uc.subscribe(f=>{l(3,u=f)}),Hc.subscribe(f=>{l(4,a=f)}),Wc.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,r,u,a,c]}class jm extends Ee{constructor(e){super(),Pe(this,e,Hm,Um,Ne,{data:0,sysinfo:1})}}let fr={};const Ci=at(fr);async function Wm(){fr=await(await fetch("/configuration.json")).json(),Ci.set(fr)}function Zu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function zm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Gm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Ju(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function xu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,r){M(i,e,r),M(i,l,r),M(i,n,r)},d(i){i&&C(e),i&&C(l),i&&C(n)}}}function ef(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function tf(t){let e,l,n;return{c(){e=m("option"),l=$("GPIO"),n=$(t[4]),e.__value=t[4],e.value=e.__value},m(i,r){M(i,e,r),s(e,l),s(e,n)},d(i){i&&C(e)}}}function lf(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))&&tf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=tf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&C(e)}}}function Vm(t){let e,l,n,i,r;function u(d,S){return d[0]=="esp32c3"?Gm:zm}let a=u(t),c=a(t),f=t[0]=="esp8266"&&Ju(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&xu(),p=t[0]=="esp32s2"&&ef(),b={length:t[1]+1},v=[];for(let d=0;d{"chip"in r&&l(0,n=r.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Zc extends Ee{constructor(e){super(),Pe(this,e,Km,Vm,Ne,{chip:0})}}function nf(t){let e,l,n=t[1]&&sf(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),o(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),o(e,"class","z-50"),o(e,"aria-modal","true")},m(i,r){M(i,e,r),s(e,l),n&&n.m(l,null)},p(i,r){i[1]?n?n.p(i,r):(n=sf(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&C(e),n&&n.d()}}}function sf(t){let e,l;return{c(){e=m("div"),l=$(t[1]),o(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){M(n,e,i),s(e,l)},p(n,i){i&2&&Z(l,n[1])},d(n){n&&C(e)}}}function Ym(t){let e,l=t[0]&&nf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=nf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function Qm(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=r=>{"active"in r&&l(0,n=r.active),"message"in r&&l(1,i=r.message)},[n,i]}class It extends Ee{constructor(e){super(),Pe(this,e,Qm,Ym,Ne,{active:0,message:1})}}function rf(t,e,l){const n=t.slice();return n[1]=e[l],n}function of(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=$("Europe/"),i=$(n),e.__value="Europe/"+t[1],e.value=e.__value},m(r,u){M(r,e,u),s(e,l),s(e,i)},p:fe,d(r){r&&C(e)}}}function Xm(t){let e,l,n,i=t[0],r=[];for(let u=0;u>1&1,A=0;A0;g--)A[g]=A[g]?A[g-1]^P.EXPONENT[F._modN(P.LOG[A[g]]+w)]:A[g-1];A[0]=P.EXPONENT[F._modN(P.LOG[A[0]]+w)]}for(w=0;w<=k;w++)A[w]=P.LOG[A[w]]},_checkBadness:function(){var w,g,k,A,I,Q=0,J=this._badness,se=this.buffer,ce=this.width;for(I=0;Ice*ce;)re-=ce*ce,Se++;for(Q+=Se*F.N4,A=0;A=J-2&&(w=J-2,I>9&&w--);var se=w;if(I>9){for(Q[se+2]=0,Q[se+3]=0;se--;)g=Q[se],Q[se+3]|=255&g<<4,Q[se+2]=g>>4;Q[2]|=255&w<<4,Q[1]=w>>4,Q[0]=64|w>>12}else{for(Q[se+1]=0,Q[se+2]=0;se--;)g=Q[se],Q[se+2]|=255&g<<4,Q[se+1]=g>>4;Q[1]|=255&w<<4,Q[0]=64|w>>4}for(se=w+3-(I<10);se=5&&(k+=F.N1+A[g]-5);for(g=3;gw||A[g-3]*3>=A[g]*4||A[g+3]*3>=A[g]*4)&&(k+=F.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var w,g,k=0,A=3e4;for(g=0;g<8&&(this._applyMask(g),w=this._checkBadness(),w>=1)A&1&&(I[Q-1-g+Q*8]=1,g<6?I[8+Q*g]=1:I[8+Q*(g+1)]=1);for(g=0;g<7;g++,A>>=1)A&1&&(I[8+Q*(Q-7+g)]=1,g?I[6-g+Q*8]=1:I[7+Q*8]=1)},_interleaveBlocks:function(){var w,g,k=this._dataBlock,A=this._ecc,I=this._eccBlock,Q=0,J=this._calculateMaxLength(),se=this._neccBlock1,ce=this._neccBlock2,ve=this._stringBuffer;for(w=0;w1)for(w=T.BLOCK[A],k=I-7;;){for(g=I-7;g>w-3&&(this._addAlignment(g,k),!(g6)for(w=O.BLOCK[Q-7],g=17,k=0;k<6;k++)for(A=0;A<3;A++,g--)1&(g>11?Q>>g-12:w>>g)?(I[5-k+J*(2-A+J-11)]=1,I[2-A+J-11+J*(5-k)]=1):(this._setMask(5-k,2-A+J-11),this._setMask(2-A+J-11,5-k))},_isMasked:function(w,g){var k=F._getMaskBit(w,g);return this._mask[k]===1},_pack:function(){var w,g,k,A=1,I=1,Q=this.width,J=Q-1,se=Q-1,ce=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(g=0;gg&&(k=w,w=g,g=k),k=g,k+=g*g,k>>=1,k+=w,k},_modN:function(w){for(;w>=255;)w-=255,w=(w>>8)+(w&255);return w},N1:3,N2:3,N3:40,N4:10}),x=F,H=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var w=this.element;w.width=w.height=this.qrious.size}}),z=H,G=p.extend(function(w,g,k,A){this.name=w,this.modifiable=Boolean(g),this.defaultValue=k,this._valueTransformer=A},{transform:function(w){var g=this._valueTransformer;return typeof g=="function"?g(w,this):w}}),V=G,W=p.extend(null,{abs:function(w){return w!=null?Math.abs(w):null},hasOwn:function(w,g){return Object.prototype.hasOwnProperty.call(w,g)},noop:function(){},toUpperCase:function(w){return w!=null?w.toUpperCase():null}}),U=W,K=p.extend(function(w){this.options={},w.forEach(function(g){this.options[g.name]=g},this)},{exists:function(w){return this.options[w]!=null},get:function(w,g){return K._get(this.options[w],g)},getAll:function(w){var g,k=this.options,A={};for(g in k)U.hasOwn(k,g)&&(A[g]=K._get(k[g],w));return A},init:function(w,g,k){typeof k!="function"&&(k=U.noop);var A,I;for(A in this.options)U.hasOwn(this.options,A)&&(I=this.options[A],K._set(I,I.defaultValue,g),K._createAccessor(I,g,k));this._setAll(w,g,!0)},set:function(w,g,k){return this._set(w,g,k)},setAll:function(w,g){return this._setAll(w,g)},_set:function(w,g,k,A){var I=this.options[w];if(!I)throw new Error("Invalid option: "+w);if(!I.modifiable&&!A)throw new Error("Option cannot be modified: "+w);return K._set(I,g,k)},_setAll:function(w,g,k){if(!w)return!1;var A,I=!1;for(A in w)U.hasOwn(w,A)&&this._set(A,w[A],g,k)&&(I=!0);return I}},{_createAccessor:function(w,g,k){var A={get:function(){return K._get(w,g)}};w.modifiable&&(A.set=function(I){K._set(w,I,g)&&k(I,w)}),Object.defineProperty(g,w.name,A)},_get:function(w,g){return g["_"+w.name]},_set:function(w,g,k){var A="_"+w.name,I=k[A],Q=w.transform(g!=null?g:w.defaultValue);return k[A]=Q,Q!==I}}),j=K,Y=p.extend(function(){this._services={}},{getService:function(w){var g=this._services[w];if(!g)throw new Error("Service is not being managed with name: "+w);return g},setService:function(w,g){if(this._services[w])throw new Error("Service is already managed with name: "+w);g&&(this._services[w]=g)}}),X=Y,oe=new j([new V("background",!0,"white"),new V("backgroundAlpha",!0,1,U.abs),new V("element"),new V("foreground",!0,"black"),new V("foregroundAlpha",!0,1,U.abs),new V("level",!0,"L",U.toUpperCase),new V("mime",!0,"image/png"),new V("padding",!0,null,U.abs),new V("size",!0,100,U.abs),new V("value",!0,"")]),ue=new X,ke=p.extend(function(w){oe.init(w,this,this.update.bind(this));var g=oe.get("element",this),k=ue.getService("element"),A=g&&k.isCanvas(g)?g:k.createCanvas(),I=g&&k.isImage(g)?g:k.createImage();this._canvasRenderer=new S(this,A,!0),this._imageRenderer=new z(this,I,I===g),this.update()},{get:function(){return oe.getAll(this)},set:function(w){oe.setAll(w,this)&&this.update()},toDataURL:function(w){return this.canvas.toDataURL(w||this.mime)},update:function(){var w=new x({level:this.level,value:this.value});this._canvasRenderer.render(w),this._imageRenderer.render(w)}},{use:function(w){ue.setService(w.getName(),w)}});Object.defineProperties(ke.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var me=ke,Te=me,He=p.extend({getName:function(){}}),Re=He,je=Re.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(w){},isImage:function(w){}}),we=je,$e=we.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(w){return w instanceof HTMLCanvasElement},isImage:function(w){return w instanceof HTMLImageElement}}),Le=$e;Te.use(new Le);var Me=Te;return Me})})(xc);const lp=xc.exports;function np(t){let e,l;return{c(){e=m("img"),Js(e.src,l=t[2])||o(e,"src",l),o(e,"alt",t[0]),o(e,"class",t[1])},m(n,i){M(n,e,i)},p(n,[i]){i&4&&!Js(e.src,l=n[2])&&o(e,"src",l),i&1&&o(e,"alt",n[0]),i&2&&o(e,"class",n[1])},i:fe,o:fe,d(n){n&&C(e)}}}function ip(t,e,l){const n=new lp;let{errorCorrection:i="L"}=e,{background:r="#fff"}=e,{color:u="#000"}=e,{size:a="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:_="qrcode"}=e,p="";function b(){n.set({background:r,foreground:u,level:i,padding:f,size:a,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return oc(()=>{b()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,r=v.background),"color"in v&&l(5,u=v.color),"size"in v&&l(6,a=v.size),"value"in v&&l(0,c=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,_=v.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&b()},[c,_,p,i,r,u,a,f]}class sp extends Ee{constructor(e){super(),Pe(this,e,ip,np,Ne,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function af(t,e,l){const n=t.slice();return n[95]=e[l],n[96]=e,n[97]=l,n}function uf(t,e,l){const n=t.slice();return n[98]=e[l],n[99]=e,n[100]=l,n}function rp(t,e,l){const n=t.slice();return n[101]=e[l],n}function op(t,e,l){const n=t.slice();return n[104]=e[l],n}function ap(t){let e,l;return{c(){e=m("option"),l=$(t[104]),e.__value=t[104],e.value=e.__value},m(n,i){M(n,e,i),s(e,l)},p:fe,d(n){n&&C(e)}}}function ff(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),o(l,"name","pt"),o(l,"type","text"),o(l,"class","in-s"),o(l,"placeholder","ENTSO-E API key, optional, read docs")},m(r,u){M(r,e,u),M(r,l,u),te(l,t[3].p.t),n||(i=ee(l,"input",t[22]),n=!0)},p(r,u){u[0]&8&&l.value!==r[3].p.t&&te(l,r[3].p.t)},d(r){r&&C(e),r&&C(l),n=!1,i()}}}function cf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v;return{c(){e=m("div"),l=$("Username"),n=m("br"),i=h(),r=m("input"),u=h(),a=m("div"),c=$("Password"),f=m("br"),_=h(),p=m("input"),o(r,"name","gu"),o(r,"type","text"),o(r,"class","in-s"),o(e,"class","my-1"),o(p,"name","gp"),o(p,"type","password"),o(p,"class","in-s"),o(a,"class","my-1")},m(d,S){M(d,e,S),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].g.u),M(d,u,S),M(d,a,S),s(a,c),s(a,f),s(a,_),s(a,p),te(p,t[3].g.p),b||(v=[ee(r,"input",t[24]),ee(p,"input",t[25])],b=!0)},p(d,S){S[0]&8&&r.value!==d[3].g.u&&te(r,d[3].g.u),S[0]&8&&p.value!==d[3].g.p&&te(p,d[3].g.p)},d(d){d&&C(e),d&&C(u),d&&C(a),b=!1,ze(v)}}}function up(t){let e,l=t[101]*100+"",n;return{c(){e=m("option"),n=$(l),e.__value=t[101]*100,e.value=e.__value},m(i,r){M(i,e,r),s(e,n)},p:fe,d(i){i&&C(e)}}}function mf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),o(l,"name","mek"),o(l,"type","text"),o(l,"class","in-s")},m(r,u){M(r,e,u),M(r,l,u),te(l,t[3].m.e.k),n||(i=ee(l,"input",t[34]),n=!0)},p(r,u){u[0]&8&&l.value!==r[3].m.e.k&&te(l,r[3].m.e.k)},d(r){r&&C(e),r&&C(l),n=!1,i()}}}function pf(t){let e,l,n,i,r,u,a;return{c(){e=m("div"),l=$("Authentication key"),n=m("br"),i=h(),r=m("input"),o(r,"name","mea"),o(r,"type","text"),o(r,"class","in-s"),o(e,"class","my-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].m.e.a),u||(a=ee(r,"input",t[35]),u=!0)},p(c,f){f[0]&8&&r.value!==c[3].m.e.a&&te(r,c[3].m.e.a)},d(c){c&&C(e),u=!1,a()}}}function _f(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H;return{c(){e=m("div"),l=m("div"),n=$("Watt"),i=m("br"),r=h(),u=m("input"),a=h(),c=m("div"),f=$("Volt"),_=m("br"),p=h(),b=m("input"),v=h(),d=m("div"),S=$("Amp"),y=m("br"),T=h(),N=m("input"),E=h(),B=m("div"),P=$("kWh"),L=m("br"),O=h(),F=m("input"),o(u,"name","mmw"),o(u,"type","number"),o(u,"min","0.00"),o(u,"max","1000"),o(u,"step","0.001"),o(u,"class","in-f tr w-full"),o(l,"class","w-1/4"),o(b,"name","mmv"),o(b,"type","number"),o(b,"min","0.00"),o(b,"max","1000"),o(b,"step","0.001"),o(b,"class","in-m tr w-full"),o(c,"class","w-1/4"),o(N,"name","mma"),o(N,"type","number"),o(N,"min","0.00"),o(N,"max","1000"),o(N,"step","0.001"),o(N,"class","in-m tr w-full"),o(d,"class","w-1/4"),o(F,"name","mmc"),o(F,"type","number"),o(F,"min","0.00"),o(F,"max","1000"),o(F,"step","0.001"),o(F,"class","in-l tr w-full"),o(B,"class","w-1/4"),o(e,"class","flex my-1")},m(z,G){M(z,e,G),s(e,l),s(l,n),s(l,i),s(l,r),s(l,u),te(u,t[3].m.m.w),s(e,a),s(e,c),s(c,f),s(c,_),s(c,p),s(c,b),te(b,t[3].m.m.v),s(e,v),s(e,d),s(d,S),s(d,y),s(d,T),s(d,N),te(N,t[3].m.m.a),s(e,E),s(e,B),s(B,P),s(B,L),s(B,O),s(B,F),te(F,t[3].m.m.c),x||(H=[ee(u,"input",t[37]),ee(b,"input",t[38]),ee(N,"input",t[39]),ee(F,"input",t[40])],x=!0)},p(z,G){G[0]&8&&he(u.value)!==z[3].m.m.w&&te(u,z[3].m.m.w),G[0]&8&&he(b.value)!==z[3].m.m.v&&te(b,z[3].m.m.v),G[0]&8&&he(N.value)!==z[3].m.m.a&&te(N,z[3].m.m.a),G[0]&8&&he(F.value)!==z[3].m.m.c&&te(F,z[3].m.m.c)},d(z){z&&C(e),x=!1,ze(H)}}}function df(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y;return{c(){e=m("div"),l=$("Gateway"),n=m("br"),i=h(),r=m("input"),u=h(),a=m("div"),c=$("DNS"),f=m("br"),_=h(),p=m("div"),b=m("input"),v=h(),d=m("input"),o(r,"name","ng"),o(r,"type","text"),o(r,"class","in-s"),o(e,"class","my-1"),o(b,"name","nd1"),o(b,"type","text"),o(b,"class","in-f w-full"),o(d,"name","nd2"),o(d,"type","text"),o(d,"class","in-l w-full"),o(p,"class","flex"),o(a,"class","my-1")},m(T,N){M(T,e,N),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].n.g),M(T,u,N),M(T,a,N),s(a,c),s(a,f),s(a,_),s(a,p),s(p,b),te(b,t[3].n.d1),s(p,v),s(p,d),te(d,t[3].n.d2),S||(y=[ee(r,"input",t[49]),ee(b,"input",t[50]),ee(d,"input",t[51])],S=!0)},p(T,N){N[0]&8&&r.value!==T[3].n.g&&te(r,T[3].n.g),N[0]&8&&b.value!==T[3].n.d1&&te(b,T[3].n.d1),N[0]&8&&d.value!==T[3].n.d2&&te(d,T[3].n.d2)},d(T){T&&C(e),T&&C(u),T&&C(a),S=!1,ze(y)}}}function vf(t){let e,l,n,i,r;return{c(){e=m("label"),l=m("input"),n=$(" SSL"),o(l,"type","checkbox"),o(l,"name","qs"),l.__value="true",l.value=l.__value,o(l,"class","rounded mb-1"),o(e,"class","float-right mr-3")},m(u,a){M(u,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(r=[ee(l,"change",t[55]),ee(l,"change",t[14])],i=!0)},p(u,a){a[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&C(e),i=!1,ze(r)}}}function hf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v;const d=[cp,fp],S=[];function y(O,F){return O[3].q.s.c?0:1}n=y(t),i=S[n]=d[n](t);const T=[dp,_p],N=[];function E(O,F){return O[3].q.s.r?0:1}a=E(t),c=N[a]=T[a](t);const B=[gp,bp],P=[];function L(O,F){return O[3].q.s.k?0:1}return p=L(t),b=P[p]=B[p](t),{c(){e=m("div"),l=m("span"),i.c(),r=h(),u=m("span"),c.c(),f=h(),_=m("span"),b.c(),o(l,"class","flex pr-2"),o(u,"class","flex pr-2"),o(_,"class","flex pr-2"),o(e,"class","my-1 flex")},m(O,F){M(O,e,F),s(e,l),S[n].m(l,null),s(e,r),s(e,u),N[a].m(u,null),s(e,f),s(e,_),P[p].m(_,null),v=!0},p(O,F){let x=n;n=y(O),n===x?S[n].p(O,F):(De(),q(S[x],1,1,()=>{S[x]=null}),Ie(),i=S[n],i?i.p(O,F):(i=S[n]=d[n](O),i.c()),D(i,1),i.m(l,null));let H=a;a=E(O),a===H?N[a].p(O,F):(De(),q(N[H],1,1,()=>{N[H]=null}),Ie(),c=N[a],c?c.p(O,F):(c=N[a]=T[a](O),c.c()),D(c,1),c.m(u,null));let z=p;p=L(O),p===z?P[p].p(O,F):(De(),q(P[z],1,1,()=>{P[z]=null}),Ie(),b=P[p],b?b.p(O,F):(b=P[p]=B[p](O),b.c()),D(b,1),b.m(_,null))},i(O){v||(D(i),D(c),D(b),v=!0)},o(O){q(i),q(c),q(b),v=!1},d(O){O&&C(e),S[n].d(),N[a].d(),P[p].d()}}}function fp(t){let e,l;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[mp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i[3]&16384&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function cp(t){let e,l,n,i,r,u,a,c;return l=new el({props:{to:"/mqtt-ca",$$slots:{default:[pp]},$$scope:{ctx:t}}}),r=new Tr({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(r.$$.fragment),o(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),o(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(r,i,null),u=!0,a||(c=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(r.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(r.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(r),a=!1,ze(c)}}}function mp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function pp(t){let e;return{c(){e=$("CA OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function _p(t){let e,l;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[vp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i[3]&16384&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function dp(t){let e,l,n,i,r,u,a,c;return l=new el({props:{to:"/mqtt-cert",$$slots:{default:[hp]},$$scope:{ctx:t}}}),r=new Tr({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(r.$$.fragment),o(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),o(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(r,i,null),u=!0,a||(c=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(r.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(r.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(r),a=!1,ze(c)}}}function vp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function hp(t){let e;return{c(){e=$("Cert OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function bp(t){let e,l;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[kp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i[3]&16384&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function gp(t){let e,l,n,i,r,u,a,c;return l=new el({props:{to:"/mqtt-key",$$slots:{default:[wp]},$$scope:{ctx:t}}}),r=new Tr({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(r.$$.fragment),o(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),o(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(r,i,null),u=!0,a||(c=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(r.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(r.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(r),a=!1,ze(c)}}}function kp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function wp(t){let e;return{c(){e=$("Key OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function bf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K;return r=new Ut({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),ie(r.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=m("div"),p=$("Electricity IDX"),b=m("br"),v=h(),d=m("input"),S=h(),y=m("div"),T=$("Current IDX"),N=m("br"),E=h(),B=m("input"),P=h(),L=m("div"),O=$(`Voltage IDX: L1, L2 & L3 + `),F=m("div"),x=m("input"),H=h(),z=m("input"),G=h(),V=m("input"),o(l,"class","text-sm"),o(i,"href",Ht("MQTT-configuration#domoticz")),o(i,"target","_blank"),o(i,"class","float-right"),o(a,"type","hidden"),o(a,"name","o"),a.value="true",o(d,"name","oe"),o(d,"type","text"),o(d,"class","in-f tr w-full"),o(_,"class","w-1/2"),o(B,"name","oc"),o(B,"type","text"),o(B,"class","in-l tr w-full"),o(y,"class","w-1/2"),o(f,"class","my-1 flex"),o(x,"name","ou1"),o(x,"type","text"),o(x,"class","in-f tr w-1/3"),o(z,"name","ou2"),o(z,"type","text"),o(z,"class","in-m tr w-1/3"),o(V,"name","ou3"),o(V,"type","text"),o(V,"class","in-l tr w-1/3"),o(F,"class","flex"),o(L,"class","my-1"),o(e,"class","cnt")},m(j,Y){M(j,e,Y),s(e,l),s(e,n),s(e,i),le(r,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].o.e),s(f,S),s(f,y),s(y,T),s(y,N),s(y,E),s(y,B),te(B,t[3].o.c),s(e,P),s(e,L),s(L,O),s(L,F),s(F,x),te(x,t[3].o.u1),s(F,H),s(F,z),te(z,t[3].o.u2),s(F,G),s(F,V),te(V,t[3].o.u3),W=!0,U||(K=[ee(d,"input",t[63]),ee(B,"input",t[64]),ee(x,"input",t[65]),ee(z,"input",t[66]),ee(V,"input",t[67])],U=!0)},p(j,Y){Y[0]&8&&d.value!==j[3].o.e&&te(d,j[3].o.e),Y[0]&8&&B.value!==j[3].o.c&&te(B,j[3].o.c),Y[0]&8&&x.value!==j[3].o.u1&&te(x,j[3].o.u1),Y[0]&8&&z.value!==j[3].o.u2&&te(z,j[3].o.u2),Y[0]&8&&V.value!==j[3].o.u3&&te(V,j[3].o.u3)},i(j){W||(D(r.$$.fragment,j),W=!0)},o(j){q(r.$$.fragment,j),W=!1},d(j){j&&C(e),ne(r),U=!1,ze(K)}}}function gf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V;return r=new Ut({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),ie(r.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=$("Discovery topic prefix"),p=m("br"),b=h(),v=m("input"),d=h(),S=m("div"),y=$("Hostname for URL"),T=m("br"),N=h(),E=m("input"),P=h(),L=m("div"),O=$("Name tag"),F=m("br"),x=h(),H=m("input"),o(l,"class","text-sm"),o(i,"href",Ht("MQTT-configuration#home-assistant")),o(i,"target","_blank"),o(i,"class","float-right"),o(a,"type","hidden"),o(a,"name","h"),a.value="true",o(v,"name","ht"),o(v,"type","text"),o(v,"class","in-s"),o(v,"placeholder","homeassistant"),o(f,"class","my-1"),o(E,"name","hh"),o(E,"type","text"),o(E,"class","in-s"),o(E,"placeholder",B=t[3].g.h+".local"),o(S,"class","my-1"),o(H,"name","hn"),o(H,"type","text"),o(H,"class","in-s"),o(L,"class","my-1"),o(e,"class","cnt")},m(W,U){M(W,e,U),s(e,l),s(e,n),s(e,i),le(r,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(f,p),s(f,b),s(f,v),te(v,t[3].h.t),s(e,d),s(e,S),s(S,y),s(S,T),s(S,N),s(S,E),te(E,t[3].h.h),s(e,P),s(e,L),s(L,O),s(L,F),s(L,x),s(L,H),te(H,t[3].h.n),z=!0,G||(V=[ee(v,"input",t[68]),ee(E,"input",t[69]),ee(H,"input",t[70])],G=!0)},p(W,U){U[0]&8&&v.value!==W[3].h.t&&te(v,W[3].h.t),(!z||U[0]&8&&B!==(B=W[3].g.h+".local"))&&o(E,"placeholder",B),U[0]&8&&E.value!==W[3].h.h&&te(E,W[3].h.h),U[0]&8&&H.value!==W[3].h.n&&te(H,W[3].h.n)},i(W){z||(D(r.$$.fragment,W),z=!0)},o(W){q(r.$$.fragment,W),z=!1},d(W){W&&C(e),ne(r),G=!1,ze(V)}}}function kf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d=t[3].c.es&&wf(t);return{c(){e=m("div"),l=m("input"),n=h(),i=m("strong"),i.textContent="Cloud connections",r=h(),u=m("div"),a=m("label"),c=m("input"),f=$(" Energy Speedometer"),_=h(),d&&d.c(),o(l,"type","hidden"),o(l,"name","c"),l.value="true",o(i,"class","text-sm"),o(c,"type","checkbox"),o(c,"class","rounded mb-1"),o(c,"name","ces"),c.__value="true",c.value=c.__value,o(u,"class","my-1"),o(e,"class","cnt")},m(S,y){M(S,e,y),s(e,l),s(e,n),s(e,i),s(e,r),s(e,u),s(u,a),s(a,c),c.checked=t[3].c.es,s(a,f),s(u,_),d&&d.m(u,null),p=!0,b||(v=ee(c,"change",t[71]),b=!0)},p(S,y){y[0]&8&&(c.checked=S[3].c.es),S[3].c.es?d?(d.p(S,y),y[0]&8&&D(d,1)):(d=wf(S),d.c(),D(d,1),d.m(u,null)):d&&(De(),q(d,1,1,()=>{d=null}),Ie())},i(S){p||(D(d),p=!0)},o(S){q(d),p=!1},d(S){S&&C(e),d&&d.d(),b=!1,v()}}}function wf(t){let e,l,n=t[0].mac+"",i,r,u,a,c=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,_,p,b,v=t[0].mac&&t[0].meter.id&&yf(t);return{c(){e=m("div"),l=$("MAC: "),i=$(n),r=h(),u=m("div"),a=$("Meter ID: "),f=$(c),_=h(),v&&v.c(),p=Ve(),o(e,"class","pl-5"),o(u,"class","pl-5")},m(d,S){M(d,e,S),s(e,l),s(e,i),M(d,r,S),M(d,u,S),s(u,a),s(u,f),M(d,_,S),v&&v.m(d,S),M(d,p,S),b=!0},p(d,S){(!b||S[0]&1)&&n!==(n=d[0].mac+"")&&Z(i,n),(!b||S[0]&1)&&c!==(c=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&Z(f,c),d[0].mac&&d[0].meter.id?v?(v.p(d,S),S[0]&1&&D(v,1)):(v=yf(d),v.c(),D(v,1),v.m(p.parentNode,p)):v&&(De(),q(v,1,1,()=>{v=null}),Ie())},i(d){b||(D(v),b=!0)},o(d){q(v),b=!1},d(d){d&&C(e),d&&C(r),d&&C(u),d&&C(_),v&&v.d(d),d&&C(p)}}}function yf(t){let e,l,n;return l=new sp({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","pl-2")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Cf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E;r=new Ut({});let B={length:9},P=[];for(let L=0;L20&&$f(t),_=t[0].chip=="esp8266"&&Pf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),ie(r.$$.fragment),u=h(),f&&f.c(),a=h(),_&&_.c(),o(l,"class","text-sm"),o(i,"href",Ht("GPIO-configuration")),o(i,"target","_blank"),o(i,"class","float-right"),o(e,"class","cnt")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),le(r,i,null),s(e,u),f&&f.m(e,null),s(e,a),_&&_.m(e,null),c=!0},p(p,b){p[0].board>20?f?(f.p(p,b),b[0]&1&&D(f,1)):(f=$f(p),f.c(),D(f,1),f.m(e,a)):f&&(De(),q(f,1,1,()=>{f=null}),Ie()),p[0].chip=="esp8266"?_?_.p(p,b):(_=Pf(p),_.c(),_.m(e,null)):_&&(_.d(1),_=null)},i(p){c||(D(r.$$.fragment,p),D(f),c=!0)},o(p){q(r.$$.fragment,p),q(f),c=!1},d(p){p&&C(e),ne(r),f&&f.d(),_&&_.d()}}}function $f(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,Te,He,Re,je,we,$e,Le,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,re;b=new Zc({props:{chip:t[0].chip}});let pe=t[0].chip!="esp8266"&&Nf(t),Be=t[3].i.v.p>0&&Af(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),r=$("HAN"),u=m("label"),a=m("input"),c=$(" pullup"),f=m("br"),_=h(),p=m("select"),ie(b.$$.fragment),v=h(),d=m("div"),S=$("AP button"),y=m("br"),T=h(),N=m("input"),E=h(),B=m("div"),P=$("LED"),L=m("label"),O=m("input"),F=$(" inv"),x=m("br"),H=h(),z=m("div"),G=m("input"),V=h(),W=m("div"),U=$("RGB"),K=m("label"),j=m("input"),Y=$(" inverted"),X=m("br"),oe=h(),ue=m("div"),ke=m("input"),me=h(),Te=m("input"),He=h(),Re=m("input"),je=h(),we=m("div"),$e=$("Temperature"),Le=m("br"),Me=h(),w=m("input"),g=h(),k=m("div"),A=$("Analog temp"),I=m("br"),Q=h(),J=m("input"),se=h(),pe&&pe.c(),ce=h(),Be&&Be.c(),o(e,"type","hidden"),o(e,"name","i"),e.value="true",o(a,"name","ihu"),a.__value="true",a.value=a.__value,o(a,"type","checkbox"),o(a,"class","rounded mb-1"),o(u,"class","ml-2"),o(p,"name","ihp"),o(p,"class","in-f w-full"),t[3].i.h.p===void 0&&Qe(()=>t[76].call(p)),o(i,"class","w-1/3"),o(N,"name","ia"),o(N,"type","number"),o(N,"min","0"),o(N,"max",t[6]),o(N,"class","in-m tr w-full"),o(d,"class","w-1/3"),o(O,"name","ili"),O.__value="true",O.value=O.__value,o(O,"type","checkbox"),o(O,"class","rounded mb-1"),o(L,"class","ml-4"),o(G,"name","ilp"),o(G,"type","number"),o(G,"min","0"),o(G,"max",t[6]),o(G,"class","in-l tr w-full"),o(z,"class","flex"),o(B,"class","w-1/3"),o(j,"name","iri"),j.__value="true",j.value=j.__value,o(j,"type","checkbox"),o(j,"class","rounded mb-1"),o(K,"class","ml-4"),o(ke,"name","irr"),o(ke,"type","number"),o(ke,"min","0"),o(ke,"max",t[6]),o(ke,"class","in-f tr w-1/3"),o(Te,"name","irg"),o(Te,"type","number"),o(Te,"min","0"),o(Te,"max",t[6]),o(Te,"class","in-m tr w-1/3"),o(Re,"name","irb"),o(Re,"type","number"),o(Re,"min","0"),o(Re,"max",t[6]),o(Re,"class","in-l tr w-1/3"),o(ue,"class","flex"),o(W,"class","w-full"),o(w,"name","itd"),o(w,"type","number"),o(w,"min","0"),o(w,"max",t[6]),o(w,"class","in-f tr w-full"),o(we,"class","my-1 w-1/3"),o(J,"name","ita"),o(J,"type","number"),o(J,"min","0"),o(J,"max",t[6]),o(J,"class","in-l tr w-full"),o(k,"class","my-1 pr-1 w-1/3"),o(n,"class","flex flex-wrap")},m(_e,ye){M(_e,e,ye),M(_e,l,ye),M(_e,n,ye),s(n,i),s(i,r),s(i,u),s(u,a),a.checked=t[3].i.h.u,s(u,c),s(i,f),s(i,_),s(i,p),le(b,p,null),qe(p,t[3].i.h.p,!0),s(n,v),s(n,d),s(d,S),s(d,y),s(d,T),s(d,N),te(N,t[3].i.a),s(n,E),s(n,B),s(B,P),s(B,L),s(L,O),O.checked=t[3].i.l.i,s(L,F),s(B,x),s(B,H),s(B,z),s(z,G),te(G,t[3].i.l.p),s(n,V),s(n,W),s(W,U),s(W,K),s(K,j),j.checked=t[3].i.r.i,s(K,Y),s(W,X),s(W,oe),s(W,ue),s(ue,ke),te(ke,t[3].i.r.r),s(ue,me),s(ue,Te),te(Te,t[3].i.r.g),s(ue,He),s(ue,Re),te(Re,t[3].i.r.b),s(n,je),s(n,we),s(we,$e),s(we,Le),s(we,Me),s(we,w),te(w,t[3].i.t.d),s(n,g),s(n,k),s(k,A),s(k,I),s(k,Q),s(k,J),te(J,t[3].i.t.a),s(n,se),pe&&pe.m(n,null),s(n,ce),Be&&Be.m(n,null),ve=!0,Se||(re=[ee(a,"change",t[75]),ee(p,"change",t[76]),ee(N,"input",t[77]),ee(O,"change",t[78]),ee(G,"input",t[79]),ee(j,"change",t[80]),ee(ke,"input",t[81]),ee(Te,"input",t[82]),ee(Re,"input",t[83]),ee(w,"input",t[84]),ee(J,"input",t[85])],Se=!0)},p(_e,ye){ye[0]&8&&(a.checked=_e[3].i.h.u);const vt={};ye[0]&1&&(vt.chip=_e[0].chip),b.$set(vt),ye[0]&8&&qe(p,_e[3].i.h.p),(!ve||ye[0]&64)&&o(N,"max",_e[6]),ye[0]&8&&he(N.value)!==_e[3].i.a&&te(N,_e[3].i.a),ye[0]&8&&(O.checked=_e[3].i.l.i),(!ve||ye[0]&64)&&o(G,"max",_e[6]),ye[0]&8&&he(G.value)!==_e[3].i.l.p&&te(G,_e[3].i.l.p),ye[0]&8&&(j.checked=_e[3].i.r.i),(!ve||ye[0]&64)&&o(ke,"max",_e[6]),ye[0]&8&&he(ke.value)!==_e[3].i.r.r&&te(ke,_e[3].i.r.r),(!ve||ye[0]&64)&&o(Te,"max",_e[6]),ye[0]&8&&he(Te.value)!==_e[3].i.r.g&&te(Te,_e[3].i.r.g),(!ve||ye[0]&64)&&o(Re,"max",_e[6]),ye[0]&8&&he(Re.value)!==_e[3].i.r.b&&te(Re,_e[3].i.r.b),(!ve||ye[0]&64)&&o(w,"max",_e[6]),ye[0]&8&&he(w.value)!==_e[3].i.t.d&&te(w,_e[3].i.t.d),(!ve||ye[0]&64)&&o(J,"max",_e[6]),ye[0]&8&&he(J.value)!==_e[3].i.t.a&&te(J,_e[3].i.t.a),_e[0].chip!="esp8266"?pe?pe.p(_e,ye):(pe=Nf(_e),pe.c(),pe.m(n,ce)):pe&&(pe.d(1),pe=null),_e[3].i.v.p>0?Be?Be.p(_e,ye):(Be=Af(_e),Be.c(),Be.m(n,null)):Be&&(Be.d(1),Be=null)},i(_e){ve||(D(b.$$.fragment,_e),ve=!0)},o(_e){q(b.$$.fragment,_e),ve=!1},d(_e){_e&&C(e),_e&&C(l),_e&&C(n),ne(b),pe&&pe.d(),Be&&Be.d(),Se=!1,ze(re)}}}function Nf(t){let e,l,n,i,r,u,a;return{c(){e=m("div"),l=$("Vcc"),n=m("br"),i=h(),r=m("input"),o(r,"name","ivp"),o(r,"type","number"),o(r,"min","0"),o(r,"max",t[6]),o(r,"class","in-s tr w-full"),o(e,"class","my-1 pl-1 w-1/3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].i.v.p),u||(a=ee(r,"input",t[86]),u=!0)},p(c,f){f[0]&64&&o(r,"max",c[6]),f[0]&8&&he(r.value)!==c[3].i.v.p&&te(r,c[3].i.v.p)},d(c){c&&C(e),u=!1,a()}}}function Af(t){let e,l,n,i,r,u,a,c,f,_;return{c(){e=m("div"),l=$("Voltage divider"),n=m("br"),i=h(),r=m("div"),u=m("input"),a=h(),c=m("input"),o(u,"name","ivdv"),o(u,"type","number"),o(u,"min","0"),o(u,"max","65535"),o(u,"class","in-f tr w-full"),o(u,"placeholder","VCC"),o(c,"name","ivdg"),o(c,"type","number"),o(c,"min","0"),o(c,"max","65535"),o(c,"class","in-l tr w-full"),o(c,"placeholder","GND"),o(r,"class","flex"),o(e,"class","my-1")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),s(e,r),s(r,u),te(u,t[3].i.v.d.v),s(r,a),s(r,c),te(c,t[3].i.v.d.g),f||(_=[ee(u,"input",t[87]),ee(c,"input",t[88])],f=!0)},p(p,b){b[0]&8&&he(u.value)!==p[3].i.v.d.v&&te(u,p[3].i.v.d.v),b[0]&8&&he(c.value)!==p[3].i.v.d.g&&te(c,p[3].i.v.d.g)},d(p){p&&C(e),f=!1,ze(_)}}}function Pf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N=(t[0].board==2||t[0].board==100)&&Ef(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),r=$("Vcc offset"),u=m("br"),a=h(),c=m("input"),f=h(),_=m("div"),p=$("Multiplier"),b=m("br"),v=h(),d=m("input"),S=h(),N&&N.c(),o(e,"type","hidden"),o(e,"name","iv"),e.value="true",o(c,"name","ivo"),o(c,"type","number"),o(c,"min","0.0"),o(c,"max","3.5"),o(c,"step","0.01"),o(c,"class","in-f tr w-full"),o(i,"class","w-1/3"),o(d,"name","ivm"),o(d,"type","number"),o(d,"min","0.1"),o(d,"max","10"),o(d,"step","0.01"),o(d,"class","in-l tr w-full"),o(_,"class","w-1/3 pr-1"),o(n,"class","my-1 flex flex-wrap")},m(E,B){M(E,e,B),M(E,l,B),M(E,n,B),s(n,i),s(i,r),s(i,u),s(i,a),s(i,c),te(c,t[3].i.v.o),s(n,f),s(n,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].i.v.m),s(n,S),N&&N.m(n,null),y||(T=[ee(c,"input",t[89]),ee(d,"input",t[90])],y=!0)},p(E,B){B[0]&8&&he(c.value)!==E[3].i.v.o&&te(c,E[3].i.v.o),B[0]&8&&he(d.value)!==E[3].i.v.m&&te(d,E[3].i.v.m),E[0].board==2||E[0].board==100?N?N.p(E,B):(N=Ef(E),N.c(),N.m(n,null)):N&&(N.d(1),N=null)},d(E){E&&C(e),E&&C(l),E&&C(n),N&&N.d(),y=!1,ze(T)}}}function Ef(t){let e,l,n,i,r,u,a;return{c(){e=m("div"),l=$("Boot limit"),n=m("br"),i=h(),r=m("input"),o(r,"name","ivb"),o(r,"type","number"),o(r,"min","2.5"),o(r,"max","3.5"),o(r,"step","0.1"),o(r,"class","in-s tr w-full"),o(e,"class","w-1/3 pl-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].i.v.b),u||(a=ee(r,"input",t[91]),u=!0)},p(c,f){f[0]&8&&he(r.value)!==c[3].i.v.b&&te(r,c[3].i.v.b)},d(c){c&&C(e),u=!1,a()}}}function Df(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T=t[3].d.t&&If();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),r=m("input"),u=$(" Enable telnet"),a=h(),T&&T.c(),c=h(),f=m("div"),_=m("select"),p=m("option"),p.textContent="Verbose",b=m("option"),b.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",o(e,"class","bd-red"),o(r,"type","checkbox"),o(r,"name","dt"),r.__value="true",r.value=r.__value,o(r,"class","rounded mb-1"),o(n,"class","my-1"),p.__value=1,p.value=p.__value,b.__value=2,b.value=b.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,o(_,"name","dl"),o(_,"class","in-s"),t[3].d.l===void 0&&Qe(()=>t[94].call(_)),o(f,"class","my-1")},m(N,E){M(N,e,E),M(N,l,E),M(N,n,E),s(n,i),s(i,r),r.checked=t[3].d.t,s(i,u),M(N,a,E),T&&T.m(N,E),M(N,c,E),M(N,f,E),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),qe(_,t[3].d.l,!0),S||(y=[ee(r,"change",t[93]),ee(_,"change",t[94])],S=!0)},p(N,E){E[0]&8&&(r.checked=N[3].d.t),N[3].d.t?T||(T=If(),T.c(),T.m(c.parentNode,c)):T&&(T.d(1),T=null),E[0]&8&&qe(_,N[3].d.l)},d(N){N&&C(e),N&&C(l),N&&C(n),N&&C(a),T&&T.d(N),N&&C(c),N&&C(f),S=!1,ze(y)}}}function If(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",o(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function yp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,Te,He,Re,je,we,$e,Le,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,re,pe,Be,_e,ye,vt,jl,tl,ct,$l,pl,jt,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Ei,_l,_n,$t,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi,Ge,Ae,vl,$s,El,Lt,Bi,Wl,Nr,ll,Ui,Ar,Ns,Pr,ci,Wt,Er,Dr,Dl,nl,Il,Ir,Hi,Rr,pt,Rl,Lr,ji,dn,vn,hn,bn,Wi,Or,At,zi,Fr,zl,qr,Br,Ur,il,gn,kn,Hr,wn,Gl,jr,Wr,zr,yn,zt,Gr,Gi,Vr,Vl,Kr,Yr,Qr,Cn,Gt,Xr,Vi,Zr,As,Jr,Kl,Ki,Vt,xr,eo,to,Ps,Yi,Kt,lo,no,io,mt,Qi,so,Mn,Sn,ro,mi,oo,Yl,ao,uo,fo,hl,co,Ql,mo,po,_o,bl,vo,Tn,Xl,ho,bo,go,Ot,$n,Nn,An,Pn,ko,Zl,wo,yo,Co,En,Ft,Mo,Xi,So,Zi,Ji,Yt,To,$o,ut,xi,No,Dn,In,Ao,Jl,Po,Eo,Do,Ll,sl,Rn,Ln,Io,Pt,es,ts,Ro,Et,On,ls,ns,Lo,Es,is,ss,Qt,Oo,Fo,pi,qo,Ol,Bo,_i,Xt,Uo,Ho,jo,rs,gl,Wo,Ye,os,zo,Fn,qn,Go,di,Vo,rl,Ko,Ds,Yo,Qo,Bn,kl,Xo,Zt,Zo,Is,xl,Jo,xo,ea,wl,ta,en,la,na,ia,yl,sa,Un,Hn,ra,oa,aa,Cl,ua,jn,fa,ca,ma,bt,Wn,zn,Gn,Vn,Kn,Yn,pa,tn,_a,da,va,Ml,ha,Rs,Ls,Os,Fs=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),qs,ol,as,ba,Qn,Xn,ga,vi,ka,hi,wa,Bs,Dt,us,ya,Zn,Jn,Ca,bi,Ma,fs,cs,Jt,Sa,Ta,$a,Fl,Us,xn,Na,ms,ei,Aa,ps,Hs,ln,js,nn,Ws,sn,zs,rn,qt,Gs,Pa;a=new Ut({}),F=new Jm({});let e0=["NOK","SEK","DKK","EUR","CHF"],gi=[];for(let R=0;R<5;R+=1)gi[R]=ap(op(t,e0,R));let gt=t[3].p.e&&t[0].chip!="esp8266"&&ff(t),kt=t[3].g.s>0&&cf(t);Lt=new Ut({});let t0=[24,48,96,192,384,576,1152],ki=[];for(let R=0;R<7;R+=1)ki[R]=up(rp(t,t0,R));let wt=t[3].m.e.e&&mf(t),yt=t[3].m.e.e&&pf(t),Ct=t[3].m.m.e&&_f(t);Sn=new Ut({}),In=new Ut({}),On=new Jc({});let Mt=t[3].n.m=="static"&&df(t);qn=new Ut({});let St=t[0].chip!="esp8266"&&vf(t),lt=t[3].q.s.e&&hf(t),nt=t[3].q.m==3&&bf(t),it=t[3].q.m==4&&gf(t),st=t[3].c.es!=null&&kf(t),rt=Fs&&Cf(t);Xn=new Ut({});let ti=t[7],_t=[];for(let R=0;R20||t[0].chip=="esp8266")&&Tf(t);Jn=new Ut({});let Tt=t[3].d.s&&Df(t);return ln=new It({props:{active:t[1],message:"Loading configuration"}}),nn=new It({props:{active:t[2],message:"Saving configuration"}}),sn=new It({props:{active:t[4],message:"Performing factory reset"}}),rn=new It({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",r=h(),u=m("a"),ie(a.$$.fragment),c=h(),f=m("input"),_=h(),p=m("div"),b=m("div"),v=m("div"),d=$("Hostname"),S=m("br"),y=h(),T=m("input"),N=h(),E=m("div"),B=$("Time zone"),P=m("br"),L=h(),O=m("select"),ie(F.$$.fragment),x=h(),H=m("input"),z=h(),G=m("div"),V=m("div"),W=m("div"),U=$("Price region"),K=m("br"),j=h(),Y=m("select"),X=m("optgroup"),oe=m("option"),oe.textContent="NO1",ue=m("option"),ue.textContent="NO2",ke=m("option"),ke.textContent="NO3",me=m("option"),me.textContent="NO4",Te=m("option"),Te.textContent="NO5",He=m("optgroup"),Re=m("option"),Re.textContent="SE1",je=m("option"),je.textContent="SE2",we=m("option"),we.textContent="SE3",$e=m("option"),$e.textContent="SE4",Le=m("optgroup"),Me=m("option"),Me.textContent="DK1",w=m("option"),w.textContent="DK2",g=m("option"),g.textContent="Austria",k=m("option"),k.textContent="Belgium",A=m("option"),A.textContent="Czech Republic",I=m("option"),I.textContent="Estonia",Q=m("option"),Q.textContent="Finland",J=m("option"),J.textContent="France",se=m("option"),se.textContent="Germany",ce=m("option"),ce.textContent="Great Britain",ve=m("option"),ve.textContent="Latvia",Se=m("option"),Se.textContent="Lithuania",re=m("option"),re.textContent="Netherland",pe=m("option"),pe.textContent="Poland",Be=m("option"),Be.textContent="Switzerland",_e=h(),ye=m("div"),vt=$("Currency"),jl=m("br"),tl=h(),ct=m("select");for(let R=0;R<5;R+=1)gi[R].c();$l=h(),pl=m("div"),jt=m("div"),ht=m("div"),Xe=$("Fixed price"),Ze=m("br"),Je=h(),Ue=m("input"),xe=h(),We=m("div"),et=$("Multiplier"),tt=m("br"),de=h(),Ce=m("input"),Ei=h(),_l=m("div"),_n=m("label"),$t=m("input"),Di=$(" Enable price fetch from remote server"),Ii=h(),gt&>.c(),Ri=h(),dl=m("div"),Li=$("Security"),Oi=m("br"),Fi=h(),Nt=m("select"),Nl=m("option"),Nl.textContent="None",Al=m("option"),Al.textContent="Only configuration",Pl=m("option"),Pl.textContent="Everything",qi=h(),kt&&kt.c(),Ge=h(),Ae=m("div"),vl=m("strong"),vl.textContent="Meter",$s=h(),El=m("a"),ie(Lt.$$.fragment),Bi=h(),Wl=m("input"),Nr=h(),ll=m("div"),Ui=m("span"),Ui.textContent="Buffer size",Ar=h(),Ns=m("span"),Ns.textContent="Serial conf.",Pr=h(),ci=m("label"),Wt=m("input"),Er=$(" inverted"),Dr=h(),Dl=m("div"),nl=m("select"),Il=m("option"),Ir=$("Autodetect");for(let R=0;R<7;R+=1)ki[R].c();Rr=h(),pt=m("select"),Rl=m("option"),Lr=$("-"),dn=m("option"),dn.textContent="7N1",vn=m("option"),vn.textContent="8N1",hn=m("option"),hn.textContent="7E1",bn=m("option"),bn.textContent="8E1",Or=h(),At=m("input"),Fr=h(),zl=m("div"),qr=$("Voltage"),Br=m("br"),Ur=h(),il=m("select"),gn=m("option"),gn.textContent="400V (TN)",kn=m("option"),kn.textContent="230V (IT/TT)",Hr=h(),wn=m("div"),Gl=m("div"),jr=$("Main fuse"),Wr=m("br"),zr=h(),yn=m("label"),zt=m("input"),Gr=h(),Gi=m("span"),Gi.textContent="A",Vr=h(),Vl=m("div"),Kr=$("Production"),Yr=m("br"),Qr=h(),Cn=m("label"),Gt=m("input"),Xr=h(),Vi=m("span"),Vi.textContent="kWp",Zr=h(),As=m("div"),Jr=h(),Kl=m("div"),Ki=m("label"),Vt=m("input"),xr=$(" Meter is encrypted"),eo=h(),wt&&wt.c(),to=h(),yt&&yt.c(),Ps=h(),Yi=m("label"),Kt=m("input"),lo=$(" Multipliers"),no=h(),Ct&&Ct.c(),io=h(),mt=m("div"),Qi=m("strong"),Qi.textContent="WiFi",so=h(),Mn=m("a"),ie(Sn.$$.fragment),ro=h(),mi=m("input"),oo=h(),Yl=m("div"),ao=$("SSID"),uo=m("br"),fo=h(),hl=m("input"),co=h(),Ql=m("div"),mo=$("Password"),po=m("br"),_o=h(),bl=m("input"),vo=h(),Tn=m("div"),Xl=m("div"),ho=$("Power saving"),bo=m("br"),go=h(),Ot=m("select"),$n=m("option"),$n.textContent="Default",Nn=m("option"),Nn.textContent="Off",An=m("option"),An.textContent="Minimum",Pn=m("option"),Pn.textContent="Maximum",ko=h(),Zl=m("div"),wo=$("Power"),yo=m("br"),Co=h(),En=m("div"),Ft=m("input"),Mo=h(),Xi=m("span"),Xi.textContent="dBm",So=h(),Zi=m("div"),Ji=m("label"),Yt=m("input"),To=$(" Allow 802.11b legacy rates"),$o=h(),ut=m("div"),xi=m("strong"),xi.textContent="Network",No=h(),Dn=m("a"),ie(In.$$.fragment),Ao=h(),Jl=m("div"),Po=$("IP"),Eo=m("br"),Do=h(),Ll=m("div"),sl=m("select"),Rn=m("option"),Rn.textContent="DHCP",Ln=m("option"),Ln.textContent="Static",Io=h(),Pt=m("input"),Ro=h(),Et=m("select"),ie(On.$$.fragment),Lo=h(),Mt&&Mt.c(),Es=h(),is=m("div"),ss=m("label"),Qt=m("input"),Oo=$(" enable mDNS"),Fo=h(),pi=m("input"),qo=h(),Ol=m("div"),Bo=$("NTP "),_i=m("label"),Xt=m("input"),Uo=$(" obtain from DHCP"),Ho=m("br"),jo=h(),rs=m("div"),gl=m("input"),Wo=h(),Ye=m("div"),os=m("strong"),os.textContent="MQTT",zo=h(),Fn=m("a"),ie(qn.$$.fragment),Go=h(),di=m("input"),Vo=h(),rl=m("div"),Ko=$(`Server + `),St&&St.c(),Ds=h(),Yo=m("br"),Qo=h(),Bn=m("div"),kl=m("input"),Xo=h(),Zt=m("input"),Zo=h(),lt&<.c(),Is=h(),xl=m("div"),Jo=$("Username"),xo=m("br"),ea=h(),wl=m("input"),ta=h(),en=m("div"),la=$("Password"),na=m("br"),ia=h(),yl=m("input"),sa=h(),Un=m("div"),Hn=m("div"),ra=$("Client ID"),oa=m("br"),aa=h(),Cl=m("input"),ua=h(),jn=m("div"),fa=$("Payload"),ca=m("br"),ma=h(),bt=m("select"),Wn=m("option"),Wn.textContent="JSON",zn=m("option"),zn.textContent="Raw (minimal)",Gn=m("option"),Gn.textContent="Raw (full)",Vn=m("option"),Vn.textContent="Domoticz",Kn=m("option"),Kn.textContent="HomeAssistant",Yn=m("option"),Yn.textContent="HEX dump",pa=h(),tn=m("div"),_a=$("Publish topic"),da=m("br"),va=h(),Ml=m("input"),ha=h(),nt&&nt.c(),Rs=h(),it&&it.c(),Ls=h(),st&&st.c(),Os=h(),rt&&rt.c(),qs=h(),ol=m("div"),as=m("strong"),as.textContent="User interface",ba=h(),Qn=m("a"),ie(Xn.$$.fragment),ga=h(),vi=m("input"),ka=h(),hi=m("div");for(let R=0;R<_t.length;R+=1)_t[R].c();wa=h(),ot&&ot.c(),Bs=h(),Dt=m("div"),us=m("strong"),us.textContent="Debugging",ya=h(),Zn=m("a"),ie(Jn.$$.fragment),Ca=h(),bi=m("input"),Ma=h(),fs=m("div"),cs=m("label"),Jt=m("input"),Sa=$(" Enable debugging"),Ta=h(),Tt&&Tt.c(),$a=h(),Fl=m("div"),Us=m("div"),xn=m("button"),xn.textContent="Factory reset",Na=h(),ms=m("div"),ei=m("button"),ei.textContent="Reboot",Aa=h(),ps=m("div"),ps.innerHTML='',Hs=h(),ie(ln.$$.fragment),js=h(),ie(nn.$$.fragment),Ws=h(),ie(sn.$$.fragment),zs=h(),ie(rn.$$.fragment),o(i,"class","text-sm"),o(u,"href",Ht("General-configuration")),o(u,"target","_blank"),o(u,"class","float-right"),o(f,"type","hidden"),o(f,"name","g"),f.value="true",o(T,"name","gh"),o(T,"type","text"),o(T,"class","in-f w-full"),o(T,"pattern","[A-Za-z0-9-]+"),o(O,"name","gt"),o(O,"class","in-l w-full"),t[3].g.t===void 0&&Qe(()=>t[16].call(O)),o(b,"class","flex"),o(p,"class","my-1"),o(H,"type","hidden"),o(H,"name","p"),H.value="true",oe.__value="10YNO-1--------2",oe.value=oe.__value,ue.__value="10YNO-2--------T",ue.value=ue.__value,ke.__value="10YNO-3--------J",ke.value=ke.__value,me.__value="10YNO-4--------9",me.value=me.__value,Te.__value="10Y1001A1001A48H",Te.value=Te.__value,o(X,"label","Norway"),Re.__value="10Y1001A1001A44P",Re.value=Re.__value,je.__value="10Y1001A1001A45N",je.value=je.__value,we.__value="10Y1001A1001A46L",we.value=we.__value,$e.__value="10Y1001A1001A47J",$e.value=$e.__value,o(He,"label","Sweden"),Me.__value="10YDK-1--------W",Me.value=Me.__value,w.__value="10YDK-2--------M",w.value=w.__value,o(Le,"label","Denmark"),g.__value="10YAT-APG------L",g.value=g.__value,k.__value="10YBE----------2",k.value=k.__value,A.__value="10YCZ-CEPS-----N",A.value=A.__value,I.__value="10Y1001A1001A39I",I.value=I.__value,Q.__value="10YFI-1--------U",Q.value=Q.__value,J.__value="10YFR-RTE------C",J.value=J.__value,se.__value="10Y1001A1001A83F",se.value=se.__value,ce.__value="10YGB----------A",ce.value=ce.__value,ve.__value="10YLV-1001A00074",ve.value=ve.__value,Se.__value="10YLT-1001A0008Q",Se.value=Se.__value,re.__value="10YNL----------L",re.value=re.__value,pe.__value="10YPL-AREA-----S",pe.value=pe.__value,Be.__value="10YCH-SWISSGRIDZ",Be.value=Be.__value,o(Y,"name","pr"),o(Y,"class","in-f w-full"),t[3].p.r===void 0&&Qe(()=>t[17].call(Y)),o(W,"class","w-full"),o(ct,"name","pc"),o(ct,"class","in-l"),t[3].p.c===void 0&&Qe(()=>t[18].call(ct)),o(V,"class","flex"),o(G,"class","my-1"),o(Ue,"name","pf"),o(Ue,"type","number"),o(Ue,"min","0.001"),o(Ue,"max","65"),o(Ue,"step","0.001"),o(Ue,"class","in-f tr w-full"),o(ht,"class","w-1/2"),o(Ce,"name","pm"),o(Ce,"type","number"),o(Ce,"min","0.001"),o(Ce,"max","1000"),o(Ce,"step","0.001"),o(Ce,"class","in-l tr w-full"),o(We,"class","w-1/2"),o(jt,"class","flex"),o(pl,"class","my-1"),o($t,"type","checkbox"),o($t,"name","pe"),$t.__value="true",$t.value=$t.__value,o($t,"class","rounded mb-1"),o(_l,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,Al.__value=1,Al.value=Al.__value,Pl.__value=2,Pl.value=Pl.__value,o(Nt,"name","gs"),o(Nt,"class","in-s"),t[3].g.s===void 0&&Qe(()=>t[23].call(Nt)),o(dl,"class","my-1"),o(n,"class","cnt"),o(vl,"class","text-sm"),o(El,"href",Ht("Meter-configuration")),o(El,"target","_blank"),o(El,"class","float-right"),o(Wl,"type","hidden"),o(Wl,"name","m"),Wl.value="true",o(Ui,"class","float-right"),o(Wt,"name","mi"),Wt.__value="true",Wt.value=Wt.__value,o(Wt,"type","checkbox"),o(Wt,"class","rounded mb-1"),o(ci,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=Hi=t[3].m.b!=0,o(nl,"name","mb"),o(nl,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Qe(()=>t[27].call(nl)),Rl.__value=0,Rl.value=Rl.__value,Rl.disabled=ji=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,vn.__value=3,vn.value=vn.__value,hn.__value=10,hn.value=hn.__value,bn.__value=11,bn.value=bn.__value,o(pt,"name","mp"),o(pt,"class","in-m"),pt.disabled=Wi=t[3].m.b==0,t[3].m.p===void 0&&Qe(()=>t[28].call(pt)),o(At,"name","ms"),o(At,"type","number"),o(At,"min",64),o(At,"max",zi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),o(At,"step",64),o(At,"class","in-l tr w-1/2"),o(Dl,"class","flex w-full"),o(ll,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,o(il,"name","md"),o(il,"class","in-s"),t[3].m.d===void 0&&Qe(()=>t[30].call(il)),o(zl,"class","my-1"),o(zt,"name","mf"),o(zt,"type","number"),o(zt,"min","5"),o(zt,"max","65535"),o(zt,"class","in-f tr w-full"),o(Gi,"class","in-post"),o(yn,"class","flex"),o(Gl,"class","mx-1"),o(Gt,"name","mr"),o(Gt,"type","number"),o(Gt,"min","0"),o(Gt,"max","65535"),o(Gt,"class","in-f tr w-full"),o(Vi,"class","in-post"),o(Cn,"class","flex"),o(Vl,"class","mx-1"),o(wn,"class","my-1 flex"),o(As,"class","my-1"),o(Vt,"type","checkbox"),o(Vt,"name","me"),Vt.__value="true",Vt.value=Vt.__value,o(Vt,"class","rounded mb-1"),o(Kl,"class","my-1"),o(Kt,"type","checkbox"),o(Kt,"name","mm"),Kt.__value="true",Kt.value=Kt.__value,o(Kt,"class","rounded mb-1"),o(Ae,"class","cnt"),o(Qi,"class","text-sm"),o(Mn,"href",Ht("WiFi-configuration")),o(Mn,"target","_blank"),o(Mn,"class","float-right"),o(mi,"type","hidden"),o(mi,"name","w"),mi.value="true",o(hl,"name","ws"),o(hl,"type","text"),o(hl,"class","in-s"),o(Yl,"class","my-1"),o(bl,"name","wp"),o(bl,"type","password"),o(bl,"class","in-s"),o(Ql,"class","my-1"),$n.__value=255,$n.value=$n.__value,Nn.__value=0,Nn.value=Nn.__value,An.__value=1,An.value=An.__value,Pn.__value=2,Pn.value=Pn.__value,o(Ot,"name","wz"),o(Ot,"class","in-s"),t[3].w.z===void 0&&Qe(()=>t[43].call(Ot)),o(Xl,"class","w-1/2"),o(Ft,"name","ww"),o(Ft,"type","number"),o(Ft,"min","0"),o(Ft,"max","20.5"),o(Ft,"step","0.5"),o(Ft,"class","in-f tr w-full"),o(Xi,"class","in-post"),o(En,"class","flex"),o(Zl,"class","ml-2 w-1/2"),o(Tn,"class","my-1 flex"),o(Yt,"type","checkbox"),o(Yt,"name","wb"),Yt.__value="true",Yt.value=Yt.__value,o(Yt,"class","rounded mb-1"),o(Zi,"class","my-3"),o(mt,"class","cnt"),o(xi,"class","text-sm"),o(Dn,"href",Ht("Network-configuration")),o(Dn,"target","_blank"),o(Dn,"class","float-right"),Rn.__value="dhcp",Rn.value=Rn.__value,Ln.__value="static",Ln.value=Ln.__value,o(sl,"name","nm"),o(sl,"class","in-f"),t[3].n.m===void 0&&Qe(()=>t[46].call(sl)),o(Pt,"name","ni"),o(Pt,"type","text"),o(Pt,"class","in-m w-full"),Pt.disabled=es=t[3].n.m=="dhcp",Pt.required=ts=t[3].n.m=="static",o(Et,"name","ns"),o(Et,"class","in-l"),Et.disabled=ls=t[3].n.m=="dhcp",Et.required=ns=t[3].n.m=="static",t[3].n.s===void 0&&Qe(()=>t[48].call(Et)),o(Ll,"class","flex"),o(Jl,"class","my-1"),o(Qt,"name","nd"),Qt.__value="true",Qt.value=Qt.__value,o(Qt,"type","checkbox"),o(Qt,"class","rounded mb-1"),o(is,"class","my-1"),o(pi,"type","hidden"),o(pi,"name","ntp"),pi.value="true",o(Xt,"name","ntpd"),Xt.__value="true",Xt.value=Xt.__value,o(Xt,"type","checkbox"),o(Xt,"class","rounded mb-1"),o(_i,"class","ml-4"),o(gl,"name","ntph"),o(gl,"type","text"),o(gl,"class","in-s"),o(rs,"class","flex"),o(Ol,"class","my-1"),o(ut,"class","cnt"),o(os,"class","text-sm"),o(Fn,"href",Ht("MQTT-configuration")),o(Fn,"target","_blank"),o(Fn,"class","float-right"),o(di,"type","hidden"),o(di,"name","q"),di.value="true",o(kl,"name","qh"),o(kl,"type","text"),o(kl,"class","in-f w-3/4"),o(Zt,"name","qp"),o(Zt,"type","number"),o(Zt,"min","1024"),o(Zt,"max","65535"),o(Zt,"class","in-l tr w-1/4"),o(Bn,"class","flex"),o(rl,"class","my-1"),o(wl,"name","qu"),o(wl,"type","text"),o(wl,"class","in-s"),o(xl,"class","my-1"),o(yl,"name","qa"),o(yl,"type","password"),o(yl,"class","in-s"),o(en,"class","my-1"),o(Cl,"name","qc"),o(Cl,"type","text"),o(Cl,"class","in-f w-full"),Wn.__value=0,Wn.value=Wn.__value,zn.__value=1,zn.value=zn.__value,Gn.__value=2,Gn.value=Gn.__value,Vn.__value=3,Vn.value=Vn.__value,Kn.__value=4,Kn.value=Kn.__value,Yn.__value=255,Yn.value=Yn.__value,o(bt,"name","qm"),o(bt,"class","in-l"),t[3].q.m===void 0&&Qe(()=>t[61].call(bt)),o(Un,"class","my-1 flex"),o(Ml,"name","qb"),o(Ml,"type","text"),o(Ml,"class","in-s"),o(tn,"class","my-1"),o(Ye,"class","cnt"),o(as,"class","text-sm"),o(Qn,"href",Ht("User-interface")),o(Qn,"target","_blank"),o(Qn,"class","float-right"),o(vi,"type","hidden"),o(vi,"name","u"),vi.value="true",o(hi,"class","flex flex-wrap"),o(ol,"class","cnt"),o(us,"class","text-sm"),o(Zn,"href","https://amsleser.no/blog/post/24-telnet-debug"),o(Zn,"target","_blank"),o(Zn,"class","float-right"),o(bi,"type","hidden"),o(bi,"name","d"),bi.value="true",o(Jt,"type","checkbox"),o(Jt,"name","ds"),Jt.__value="true",Jt.value=Jt.__value,o(Jt,"class","rounded mb-1"),o(fs,"class","mt-3"),o(Dt,"class","cnt"),o(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),o(xn,"type","button"),o(xn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),o(ei,"type","button"),o(ei,"class","py-2 px-4 rounded bg-yellow-500 text-white"),o(ms,"class","text-center"),o(ps,"class","text-right"),o(Fl,"class","grid grid-cols-3"),o(e,"autocomplete","off")},m(R,ae){M(R,e,ae),s(e,l),s(l,n),s(n,i),s(n,r),s(n,u),le(a,u,null),s(n,c),s(n,f),s(n,_),s(n,p),s(p,b),s(b,v),s(v,d),s(v,S),s(v,y),s(v,T),te(T,t[3].g.h),s(b,N),s(b,E),s(E,B),s(E,P),s(E,L),s(E,O),le(F,O,null),qe(O,t[3].g.t,!0),s(n,x),s(n,H),s(n,z),s(n,G),s(G,V),s(V,W),s(W,U),s(W,K),s(W,j),s(W,Y),s(Y,X),s(X,oe),s(X,ue),s(X,ke),s(X,me),s(X,Te),s(Y,He),s(He,Re),s(He,je),s(He,we),s(He,$e),s(Y,Le),s(Le,Me),s(Le,w),s(Y,g),s(Y,k),s(Y,A),s(Y,I),s(Y,Q),s(Y,J),s(Y,se),s(Y,ce),s(Y,ve),s(Y,Se),s(Y,re),s(Y,pe),s(Y,Be),qe(Y,t[3].p.r,!0),s(V,_e),s(V,ye),s(ye,vt),s(ye,jl),s(ye,tl),s(ye,ct);for(let ft=0;ft<5;ft+=1)gi[ft]&&gi[ft].m(ct,null);qe(ct,t[3].p.c,!0),s(n,$l),s(n,pl),s(pl,jt),s(jt,ht),s(ht,Xe),s(ht,Ze),s(ht,Je),s(ht,Ue),te(Ue,t[3].p.f),s(jt,xe),s(jt,We),s(We,et),s(We,tt),s(We,de),s(We,Ce),te(Ce,t[3].p.m),s(n,Ei),s(n,_l),s(_l,_n),s(_n,$t),$t.checked=t[3].p.e,s(_n,Di),s(_l,Ii),gt&>.m(_l,null),s(n,Ri),s(n,dl),s(dl,Li),s(dl,Oi),s(dl,Fi),s(dl,Nt),s(Nt,Nl),s(Nt,Al),s(Nt,Pl),qe(Nt,t[3].g.s,!0),s(n,qi),kt&&kt.m(n,null),s(l,Ge),s(l,Ae),s(Ae,vl),s(Ae,$s),s(Ae,El),le(Lt,El,null),s(Ae,Bi),s(Ae,Wl),s(Ae,Nr),s(Ae,ll),s(ll,Ui),s(ll,Ar),s(ll,Ns),s(ll,Pr),s(ll,ci),s(ci,Wt),Wt.checked=t[3].m.i,s(ci,Er),s(ll,Dr),s(ll,Dl),s(Dl,nl),s(nl,Il),s(Il,Ir);for(let ft=0;ft<7;ft+=1)ki[ft]&&ki[ft].m(nl,null);qe(nl,t[3].m.b,!0),s(Dl,Rr),s(Dl,pt),s(pt,Rl),s(Rl,Lr),s(pt,dn),s(pt,vn),s(pt,hn),s(pt,bn),qe(pt,t[3].m.p,!0),s(Dl,Or),s(Dl,At),te(At,t[3].m.s),s(Ae,Fr),s(Ae,zl),s(zl,qr),s(zl,Br),s(zl,Ur),s(zl,il),s(il,gn),s(il,kn),qe(il,t[3].m.d,!0),s(Ae,Hr),s(Ae,wn),s(wn,Gl),s(Gl,jr),s(Gl,Wr),s(Gl,zr),s(Gl,yn),s(yn,zt),te(zt,t[3].m.f),s(yn,Gr),s(yn,Gi),s(wn,Vr),s(wn,Vl),s(Vl,Kr),s(Vl,Yr),s(Vl,Qr),s(Vl,Cn),s(Cn,Gt),te(Gt,t[3].m.r),s(Cn,Xr),s(Cn,Vi),s(Ae,Zr),s(Ae,As),s(Ae,Jr),s(Ae,Kl),s(Kl,Ki),s(Ki,Vt),Vt.checked=t[3].m.e.e,s(Ki,xr),s(Kl,eo),wt&&wt.m(Kl,null),s(Ae,to),yt&&yt.m(Ae,null),s(Ae,Ps),s(Ae,Yi),s(Yi,Kt),Kt.checked=t[3].m.m.e,s(Yi,lo),s(Ae,no),Ct&&Ct.m(Ae,null),s(l,io),s(l,mt),s(mt,Qi),s(mt,so),s(mt,Mn),le(Sn,Mn,null),s(mt,ro),s(mt,mi),s(mt,oo),s(mt,Yl),s(Yl,ao),s(Yl,uo),s(Yl,fo),s(Yl,hl),te(hl,t[3].w.s),s(mt,co),s(mt,Ql),s(Ql,mo),s(Ql,po),s(Ql,_o),s(Ql,bl),te(bl,t[3].w.p),s(mt,vo),s(mt,Tn),s(Tn,Xl),s(Xl,ho),s(Xl,bo),s(Xl,go),s(Xl,Ot),s(Ot,$n),s(Ot,Nn),s(Ot,An),s(Ot,Pn),qe(Ot,t[3].w.z,!0),s(Tn,ko),s(Tn,Zl),s(Zl,wo),s(Zl,yo),s(Zl,Co),s(Zl,En),s(En,Ft),te(Ft,t[3].w.w),s(En,Mo),s(En,Xi),s(mt,So),s(mt,Zi),s(Zi,Ji),s(Ji,Yt),Yt.checked=t[3].w.b,s(Ji,To),s(l,$o),s(l,ut),s(ut,xi),s(ut,No),s(ut,Dn),le(In,Dn,null),s(ut,Ao),s(ut,Jl),s(Jl,Po),s(Jl,Eo),s(Jl,Do),s(Jl,Ll),s(Ll,sl),s(sl,Rn),s(sl,Ln),qe(sl,t[3].n.m,!0),s(Ll,Io),s(Ll,Pt),te(Pt,t[3].n.i),s(Ll,Ro),s(Ll,Et),le(On,Et,null),qe(Et,t[3].n.s,!0),s(ut,Lo),Mt&&Mt.m(ut,null),s(ut,Es),s(ut,is),s(is,ss),s(ss,Qt),Qt.checked=t[3].n.d,s(ss,Oo),s(ut,Fo),s(ut,pi),s(ut,qo),s(ut,Ol),s(Ol,Bo),s(Ol,_i),s(_i,Xt),Xt.checked=t[3].n.h,s(_i,Uo),s(Ol,Ho),s(Ol,jo),s(Ol,rs),s(rs,gl),te(gl,t[3].n.n1),s(l,Wo),s(l,Ye),s(Ye,os),s(Ye,zo),s(Ye,Fn),le(qn,Fn,null),s(Ye,Go),s(Ye,di),s(Ye,Vo),s(Ye,rl),s(rl,Ko),St&&St.m(rl,null),s(rl,Ds),s(rl,Yo),s(rl,Qo),s(rl,Bn),s(Bn,kl),te(kl,t[3].q.h),s(Bn,Xo),s(Bn,Zt),te(Zt,t[3].q.p),s(Ye,Zo),lt&<.m(Ye,null),s(Ye,Is),s(Ye,xl),s(xl,Jo),s(xl,xo),s(xl,ea),s(xl,wl),te(wl,t[3].q.u),s(Ye,ta),s(Ye,en),s(en,la),s(en,na),s(en,ia),s(en,yl),te(yl,t[3].q.a),s(Ye,sa),s(Ye,Un),s(Un,Hn),s(Hn,ra),s(Hn,oa),s(Hn,aa),s(Hn,Cl),te(Cl,t[3].q.c),s(Un,ua),s(Un,jn),s(jn,fa),s(jn,ca),s(jn,ma),s(jn,bt),s(bt,Wn),s(bt,zn),s(bt,Gn),s(bt,Vn),s(bt,Kn),s(bt,Yn),qe(bt,t[3].q.m,!0),s(Ye,pa),s(Ye,tn),s(tn,_a),s(tn,da),s(tn,va),s(tn,Ml),te(Ml,t[3].q.b),s(l,ha),nt&&nt.m(l,null),s(l,Rs),it&&it.m(l,null),s(l,Ls),st&&st.m(l,null),s(l,Os),rt&&rt.m(l,null),s(l,qs),s(l,ol),s(ol,as),s(ol,ba),s(ol,Qn),le(Xn,Qn,null),s(ol,ga),s(ol,vi),s(ol,ka),s(ol,hi);for(let ft=0;ft<_t.length;ft+=1)_t[ft]&&_t[ft].m(hi,null);s(l,wa),ot&&ot.m(l,null),s(l,Bs),s(l,Dt),s(Dt,us),s(Dt,ya),s(Dt,Zn),le(Jn,Zn,null),s(Dt,Ca),s(Dt,bi),s(Dt,Ma),s(Dt,fs),s(fs,cs),s(cs,Jt),Jt.checked=t[3].d.s,s(cs,Sa),s(Dt,Ta),Tt&&Tt.m(Dt,null),s(e,$a),s(e,Fl),s(Fl,Us),s(Us,xn),s(Fl,Na),s(Fl,ms),s(ms,ei),s(Fl,Aa),s(Fl,ps),M(R,Hs,ae),le(ln,R,ae),M(R,js,ae),le(nn,R,ae),M(R,Ws,ae),le(sn,R,ae),M(R,zs,ae),le(rn,R,ae),qt=!0,Gs||(Pa=[ee(T,"input",t[15]),ee(O,"change",t[16]),ee(Y,"change",t[17]),ee(ct,"change",t[18]),ee(Ue,"input",t[19]),ee(Ce,"input",t[20]),ee($t,"change",t[21]),ee(Nt,"change",t[23]),ee(Wt,"change",t[26]),ee(nl,"change",t[27]),ee(pt,"change",t[28]),ee(At,"input",t[29]),ee(il,"change",t[30]),ee(zt,"input",t[31]),ee(Gt,"input",t[32]),ee(Vt,"change",t[33]),ee(Kt,"change",t[36]),ee(hl,"input",t[41]),ee(bl,"input",t[42]),ee(Ot,"change",t[43]),ee(Ft,"input",t[44]),ee(Yt,"change",t[45]),ee(sl,"change",t[46]),ee(Pt,"input",t[47]),ee(Et,"change",t[48]),ee(Qt,"change",t[52]),ee(Xt,"change",t[53]),ee(gl,"input",t[54]),ee(kl,"input",t[56]),ee(Zt,"input",t[57]),ee(wl,"input",t[58]),ee(yl,"input",t[59]),ee(Cl,"input",t[60]),ee(bt,"change",t[61]),ee(Ml,"input",t[62]),ee(Jt,"change",t[92]),ee(xn,"click",t[8]),ee(ei,"click",t[10]),ee(e,"submit",Ss(t[9]))],Gs=!0)},p(R,ae){if(ae[0]&8&&T.value!==R[3].g.h&&te(T,R[3].g.h),ae[0]&8&&qe(O,R[3].g.t),ae[0]&8&&qe(Y,R[3].p.r),ae[0]&8&&qe(ct,R[3].p.c),ae[0]&8&&he(Ue.value)!==R[3].p.f&&te(Ue,R[3].p.f),ae[0]&8&&he(Ce.value)!==R[3].p.m&&te(Ce,R[3].p.m),ae[0]&8&&($t.checked=R[3].p.e),R[3].p.e&&R[0].chip!="esp8266"?gt?gt.p(R,ae):(gt=ff(R),gt.c(),gt.m(_l,null)):gt&&(gt.d(1),gt=null),ae[0]&8&&qe(Nt,R[3].g.s),R[3].g.s>0?kt?kt.p(R,ae):(kt=cf(R),kt.c(),kt.m(n,null)):kt&&(kt.d(1),kt=null),ae[0]&8&&(Wt.checked=R[3].m.i),(!qt||ae[0]&8&&Hi!==(Hi=R[3].m.b!=0))&&(Il.disabled=Hi),ae[0]&8&&qe(nl,R[3].m.b),(!qt||ae[0]&8&&ji!==(ji=R[3].m.b!=0))&&(Rl.disabled=ji),(!qt||ae[0]&8&&Wi!==(Wi=R[3].m.b==0))&&(pt.disabled=Wi),ae[0]&8&&qe(pt,R[3].m.p),(!qt||ae[0]&9&&zi!==(zi=R[0].chip=="esp8266"?R[3].i.h.p==3||R[3].i.h.p==113?512:128:4096))&&o(At,"max",zi),ae[0]&8&&he(At.value)!==R[3].m.s&&te(At,R[3].m.s),ae[0]&8&&qe(il,R[3].m.d),ae[0]&8&&he(zt.value)!==R[3].m.f&&te(zt,R[3].m.f),ae[0]&8&&he(Gt.value)!==R[3].m.r&&te(Gt,R[3].m.r),ae[0]&8&&(Vt.checked=R[3].m.e.e),R[3].m.e.e?wt?wt.p(R,ae):(wt=mf(R),wt.c(),wt.m(Kl,null)):wt&&(wt.d(1),wt=null),R[3].m.e.e?yt?yt.p(R,ae):(yt=pf(R),yt.c(),yt.m(Ae,Ps)):yt&&(yt.d(1),yt=null),ae[0]&8&&(Kt.checked=R[3].m.m.e),R[3].m.m.e?Ct?Ct.p(R,ae):(Ct=_f(R),Ct.c(),Ct.m(Ae,null)):Ct&&(Ct.d(1),Ct=null),ae[0]&8&&hl.value!==R[3].w.s&&te(hl,R[3].w.s),ae[0]&8&&bl.value!==R[3].w.p&&te(bl,R[3].w.p),ae[0]&8&&qe(Ot,R[3].w.z),ae[0]&8&&he(Ft.value)!==R[3].w.w&&te(Ft,R[3].w.w),ae[0]&8&&(Yt.checked=R[3].w.b),ae[0]&8&&qe(sl,R[3].n.m),(!qt||ae[0]&8&&es!==(es=R[3].n.m=="dhcp"))&&(Pt.disabled=es),(!qt||ae[0]&8&&ts!==(ts=R[3].n.m=="static"))&&(Pt.required=ts),ae[0]&8&&Pt.value!==R[3].n.i&&te(Pt,R[3].n.i),(!qt||ae[0]&8&&ls!==(ls=R[3].n.m=="dhcp"))&&(Et.disabled=ls),(!qt||ae[0]&8&&ns!==(ns=R[3].n.m=="static"))&&(Et.required=ns),ae[0]&8&&qe(Et,R[3].n.s),R[3].n.m=="static"?Mt?Mt.p(R,ae):(Mt=df(R),Mt.c(),Mt.m(ut,Es)):Mt&&(Mt.d(1),Mt=null),ae[0]&8&&(Qt.checked=R[3].n.d),ae[0]&8&&(Xt.checked=R[3].n.h),ae[0]&8&&gl.value!==R[3].n.n1&&te(gl,R[3].n.n1),R[0].chip!="esp8266"?St?St.p(R,ae):(St=vf(R),St.c(),St.m(rl,Ds)):St&&(St.d(1),St=null),ae[0]&8&&kl.value!==R[3].q.h&&te(kl,R[3].q.h),ae[0]&8&&he(Zt.value)!==R[3].q.p&&te(Zt,R[3].q.p),R[3].q.s.e?lt?(lt.p(R,ae),ae[0]&8&&D(lt,1)):(lt=hf(R),lt.c(),D(lt,1),lt.m(Ye,Is)):lt&&(De(),q(lt,1,1,()=>{lt=null}),Ie()),ae[0]&8&&wl.value!==R[3].q.u&&te(wl,R[3].q.u),ae[0]&8&&yl.value!==R[3].q.a&&te(yl,R[3].q.a),ae[0]&8&&Cl.value!==R[3].q.c&&te(Cl,R[3].q.c),ae[0]&8&&qe(bt,R[3].q.m),ae[0]&8&&Ml.value!==R[3].q.b&&te(Ml,R[3].q.b),R[3].q.m==3?nt?(nt.p(R,ae),ae[0]&8&&D(nt,1)):(nt=bf(R),nt.c(),D(nt,1),nt.m(l,Rs)):nt&&(De(),q(nt,1,1,()=>{nt=null}),Ie()),R[3].q.m==4?it?(it.p(R,ae),ae[0]&8&&D(it,1)):(it=gf(R),it.c(),D(it,1),it.m(l,Ls)):it&&(De(),q(it,1,1,()=>{it=null}),Ie()),R[3].c.es!=null?st?(st.p(R,ae),ae[0]&8&&D(st,1)):(st=kf(R),st.c(),D(st,1),st.m(l,Os)):st&&(De(),q(st,1,1,()=>{st=null}),Ie()),ae[0]&8&&(Fs=R[3].p.r.startsWith("10YNO")||R[3].p.r.startsWith("10Y1001A1001A4")),Fs?rt?(rt.p(R,ae),ae[0]&8&&D(rt,1)):(rt=Cf(R),rt.c(),D(rt,1),rt.m(l,qs)):rt&&(De(),q(rt,1,1,()=>{rt=null}),Ie()),ae[0]&136){ti=R[7];let Bt;for(Bt=0;Bt20||R[0].chip=="esp8266"?ot?(ot.p(R,ae),ae[0]&1&&D(ot,1)):(ot=Tf(R),ot.c(),D(ot,1),ot.m(l,Bs)):ot&&(De(),q(ot,1,1,()=>{ot=null}),Ie()),ae[0]&8&&(Jt.checked=R[3].d.s),R[3].d.s?Tt?Tt.p(R,ae):(Tt=Df(R),Tt.c(),Tt.m(Dt,null)):Tt&&(Tt.d(1),Tt=null);const ft={};ae[0]&2&&(ft.active=R[1]),ln.$set(ft);const Ea={};ae[0]&4&&(Ea.active=R[2]),nn.$set(Ea);const Da={};ae[0]&16&&(Da.active=R[4]),sn.$set(Da);const Ia={};ae[0]&32&&(Ia.active=R[5]),rn.$set(Ia)},i(R){qt||(D(a.$$.fragment,R),D(F.$$.fragment,R),D(Lt.$$.fragment,R),D(Sn.$$.fragment,R),D(In.$$.fragment,R),D(On.$$.fragment,R),D(qn.$$.fragment,R),D(lt),D(nt),D(it),D(st),D(rt),D(Xn.$$.fragment,R),D(ot),D(Jn.$$.fragment,R),D(ln.$$.fragment,R),D(nn.$$.fragment,R),D(sn.$$.fragment,R),D(rn.$$.fragment,R),qt=!0)},o(R){q(a.$$.fragment,R),q(F.$$.fragment,R),q(Lt.$$.fragment,R),q(Sn.$$.fragment,R),q(In.$$.fragment,R),q(On.$$.fragment,R),q(qn.$$.fragment,R),q(lt),q(nt),q(it),q(st),q(rt),q(Xn.$$.fragment,R),q(ot),q(Jn.$$.fragment,R),q(ln.$$.fragment,R),q(nn.$$.fragment,R),q(sn.$$.fragment,R),q(rn.$$.fragment,R),qt=!1},d(R){R&&C(e),ne(a),ne(F),cl(gi,R),gt&>.d(),kt&&kt.d(),ne(Lt),cl(ki,R),wt&&wt.d(),yt&&yt.d(),Ct&&Ct.d(),ne(Sn),ne(In),ne(On),Mt&&Mt.d(),ne(qn),St&&St.d(),lt&<.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),rt&&rt.d(),ne(Xn),cl(_t,R),ot&&ot.d(),ne(Jn),Tt&&Tt.d(),R&&C(Hs),ne(ln,R),R&&C(js),ne(nn,R),R&&C(Ws),ne(sn,R),R&&C(zs),ne(rn,R),Gs=!1,ze(Pa)}}}async function Cp(){await(await fetch("/reboot",{method:"POST"})).json()}function Mp(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"}],r=!0,u=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{es:null}};Ci.subscribe(Ge=>{Ge.version&&(l(3,a=Ge),l(1,r=!1))}),Wm();let c=!1,f=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Ge=new URLSearchParams;Ge.append("perform","true");let vl=await(await fetch("/reset",{method:"POST",body:Ge})).json();l(4,c=!1),l(5,f=vl.success)}}async function p(Ge){l(2,u=!0);const Ae=new FormData(Ge.target),vl=new URLSearchParams;for(let Lt of Ae){const[Bi,Wl]=Lt;vl.append(Bi,Wl)}let El=await(await fetch("/save",{method:"POST",body:vl})).json();Rt.update(Lt=>(Lt.booting=El.reboot,Lt.ui=a.u,Lt)),l(2,u=!1),ri("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(Rt.update(Ge=>(Ge.booting=!0,Ge)),Cp())};async function v(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.c=!1,Ae)))}async function d(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.r=!1,Ae)))}async function S(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.k=!1,Ae)))}const y=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let T=44;function N(){a.g.h=this.value,l(3,a)}function E(){a.g.t=dt(this),l(3,a)}function B(){a.p.r=dt(this),l(3,a)}function P(){a.p.c=dt(this),l(3,a)}function L(){a.p.f=he(this.value),l(3,a)}function O(){a.p.m=he(this.value),l(3,a)}function F(){a.p.e=this.checked,l(3,a)}function x(){a.p.t=this.value,l(3,a)}function H(){a.g.s=dt(this),l(3,a)}function z(){a.g.u=this.value,l(3,a)}function G(){a.g.p=this.value,l(3,a)}function V(){a.m.i=this.checked,l(3,a)}function W(){a.m.b=dt(this),l(3,a)}function U(){a.m.p=dt(this),l(3,a)}function K(){a.m.s=he(this.value),l(3,a)}function j(){a.m.d=dt(this),l(3,a)}function Y(){a.m.f=he(this.value),l(3,a)}function X(){a.m.r=he(this.value),l(3,a)}function oe(){a.m.e.e=this.checked,l(3,a)}function ue(){a.m.e.k=this.value,l(3,a)}function ke(){a.m.e.a=this.value,l(3,a)}function me(){a.m.m.e=this.checked,l(3,a)}function Te(){a.m.m.w=he(this.value),l(3,a)}function He(){a.m.m.v=he(this.value),l(3,a)}function Re(){a.m.m.a=he(this.value),l(3,a)}function je(){a.m.m.c=he(this.value),l(3,a)}function we(){a.w.s=this.value,l(3,a)}function $e(){a.w.p=this.value,l(3,a)}function Le(){a.w.z=dt(this),l(3,a)}function Me(){a.w.w=he(this.value),l(3,a)}function w(){a.w.b=this.checked,l(3,a)}function g(){a.n.m=dt(this),l(3,a)}function k(){a.n.i=this.value,l(3,a)}function A(){a.n.s=dt(this),l(3,a)}function I(){a.n.g=this.value,l(3,a)}function Q(){a.n.d1=this.value,l(3,a)}function J(){a.n.d2=this.value,l(3,a)}function se(){a.n.d=this.checked,l(3,a)}function ce(){a.n.h=this.checked,l(3,a)}function ve(){a.n.n1=this.value,l(3,a)}function Se(){a.q.s.e=this.checked,l(3,a)}function re(){a.q.h=this.value,l(3,a)}function pe(){a.q.p=he(this.value),l(3,a)}function Be(){a.q.u=this.value,l(3,a)}function _e(){a.q.a=this.value,l(3,a)}function ye(){a.q.c=this.value,l(3,a)}function vt(){a.q.m=dt(this),l(3,a)}function jl(){a.q.b=this.value,l(3,a)}function tl(){a.o.e=this.value,l(3,a)}function ct(){a.o.c=this.value,l(3,a)}function $l(){a.o.u1=this.value,l(3,a)}function pl(){a.o.u2=this.value,l(3,a)}function jt(){a.o.u3=this.value,l(3,a)}function ht(){a.h.t=this.value,l(3,a)}function Xe(){a.h.h=this.value,l(3,a)}function Ze(){a.h.n=this.value,l(3,a)}function Je(){a.c.es=this.checked,l(3,a)}function Ue(Ge){a.t.t[Ge]=he(this.value),l(3,a)}function xe(){a.t.h=he(this.value),l(3,a)}function We(Ge){a.u[Ge.key]=dt(this),l(3,a)}function et(){a.i.h.u=this.checked,l(3,a)}function tt(){a.i.h.p=dt(this),l(3,a)}function de(){a.i.a=he(this.value),l(3,a)}function Ce(){a.i.l.i=this.checked,l(3,a)}function Ei(){a.i.l.p=he(this.value),l(3,a)}function _l(){a.i.r.i=this.checked,l(3,a)}function _n(){a.i.r.r=he(this.value),l(3,a)}function $t(){a.i.r.g=he(this.value),l(3,a)}function Di(){a.i.r.b=he(this.value),l(3,a)}function Ii(){a.i.t.d=he(this.value),l(3,a)}function Ri(){a.i.t.a=he(this.value),l(3,a)}function dl(){a.i.v.p=he(this.value),l(3,a)}function Li(){a.i.v.d.v=he(this.value),l(3,a)}function Oi(){a.i.v.d.g=he(this.value),l(3,a)}function Fi(){a.i.v.o=he(this.value),l(3,a)}function Nt(){a.i.v.m=he(this.value),l(3,a)}function Nl(){a.i.v.b=he(this.value),l(3,a)}function Al(){a.d.s=this.checked,l(3,a)}function Pl(){a.d.t=this.checked,l(3,a)}function qi(){a.d.l=dt(this),l(3,a)}return t.$$set=Ge=>{"sysinfo"in Ge&&l(0,n=Ge.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,T=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,r,u,a,c,f,T,i,_,p,b,v,d,S,y,N,E,B,P,L,O,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,Te,He,Re,je,we,$e,Le,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,re,pe,Be,_e,ye,vt,jl,tl,ct,$l,pl,jt,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Ei,_l,_n,$t,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi]}class Sp extends Ee{constructor(e){super(),Pe(this,e,Mp,yp,Ne,{sysinfo:0},null,[-1,-1,-1,-1])}}function Rf(t,e,l){const n=t.slice();return n[20]=e[l],n}function Tp(t){let e=be(t[1].chip,t[1].board)+"",l;return{c(){l=$(e)},m(n,i){M(n,l,i)},p(n,i){i&2&&e!==(e=be(n[1].chip,n[1].board)+"")&&Z(l,e)},d(n){n&&C(l)}}}function Lf(t){let e,l,n=t[1].apmac+"",i,r,u,a,c,f,_,p,b,v=Ja(t[1])+"",d,S,y=t[1].boot_reason+"",T,N,E=t[1].ex_cause+"",B,P,L;const O=[Np,$p],F=[];function x(H,z){return H[0].u>0?0:1}return c=x(t),f=F[c]=O[c](t),{c(){e=m("div"),l=$("AP MAC: "),i=$(n),r=h(),u=m("div"),a=$(`Last boot: `),f.c(),_=h(),p=m("div"),b=$("Reason: "),d=$(v),S=$(" ("),T=$(y),N=$("/"),B=$(E),P=$(")"),o(e,"class","my-2"),o(u,"class","my-2"),o(p,"class","my-2")},m(H,z){M(H,e,z),s(e,l),s(e,i),M(H,r,z),M(H,u,z),s(u,a),F[c].m(u,null),M(H,_,z),M(H,p,z),s(p,b),s(p,d),s(p,S),s(p,T),s(p,N),s(p,B),s(p,P),L=!0},p(H,z){(!L||z&2)&&n!==(n=H[1].apmac+"")&&Z(i,n);let G=c;c=x(H),c===G?F[c].p(H,z):(De(),q(F[G],1,1,()=>{F[G]=null}),Ie(),f=F[c],f?f.p(H,z):(f=F[c]=O[c](H),f.c()),D(f,1),f.m(u,null)),(!L||z&2)&&v!==(v=Ja(H[1])+"")&&Z(d,v),(!L||z&2)&&y!==(y=H[1].boot_reason+"")&&Z(T,y),(!L||z&2)&&E!==(E=H[1].ex_cause+"")&&Z(B,E)},i(H){L||(D(f),L=!0)},o(H){q(f),L=!1},d(H){H&&C(e),H&&C(r),H&&C(u),F[c].d(),H&&C(_),H&&C(p)}}}function $p(t){let e;return{c(){e=$("-")},m(l,n){M(l,e,n)},p:fe,i:fe,o:fe,d(l){l&&C(e)}}}function Np(t){let e,l;return e=new Yc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Ap(t){let e;return{c(){e=m("span"),e.textContent="Update consents",o(e,"class","btn-pri-sm")},m(l,n){M(l,e,n)},p:fe,d(l){l&&C(e)}}}function Of(t){let e,l,n,i,r,u=Cs(t[1].meter.mfg)+"",a,c,f,_,p=(t[1].meter.model?t[1].meter.model:"unknown")+"",b,v,d,S,y=(t[1].meter.id?t[1].meter.id:"unknown")+"",T;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),r=$("Manufacturer: "),a=$(u),c=h(),f=m("div"),_=$("Model: "),b=$(p),v=h(),d=m("div"),S=$("ID: "),T=$(y),o(l,"class","text-sm"),o(i,"class","my-2"),o(f,"class","my-2"),o(d,"class","my-2"),o(e,"class","cnt")},m(N,E){M(N,e,E),s(e,l),s(e,n),s(e,i),s(i,r),s(i,a),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,S),s(d,T)},p(N,E){E&2&&u!==(u=Cs(N[1].meter.mfg)+"")&&Z(a,u),E&2&&p!==(p=(N[1].meter.model?N[1].meter.model:"unknown")+"")&&Z(b,p),E&2&&y!==(y=(N[1].meter.id?N[1].meter.id:"unknown")+"")&&Z(T,y)},d(N){N&&C(e)}}}function Ff(t){let e,l,n,i,r,u=t[1].net.ip+"",a,c,f,_,p=t[1].net.mask+"",b,v,d,S,y=t[1].net.gw+"",T,N,E,B,P=t[1].net.dns1+"",L,O,F=t[1].net.dns2&&qf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),r=$("IP: "),a=$(u),c=h(),f=m("div"),_=$("Mask: "),b=$(p),v=h(),d=m("div"),S=$("Gateway: "),T=$(y),N=h(),E=m("div"),B=$("DNS: "),L=$(P),O=h(),F&&F.c(),o(l,"class","text-sm"),o(i,"class","my-2"),o(f,"class","my-2"),o(d,"class","my-2"),o(E,"class","my-2"),o(e,"class","cnt")},m(x,H){M(x,e,H),s(e,l),s(e,n),s(e,i),s(i,r),s(i,a),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,S),s(d,T),s(e,N),s(e,E),s(E,B),s(E,L),s(E,O),F&&F.m(E,null)},p(x,H){H&2&&u!==(u=x[1].net.ip+"")&&Z(a,u),H&2&&p!==(p=x[1].net.mask+"")&&Z(b,p),H&2&&y!==(y=x[1].net.gw+"")&&Z(T,y),H&2&&P!==(P=x[1].net.dns1+"")&&Z(L,P),x[1].net.dns2?F?F.p(x,H):(F=qf(x),F.c(),F.m(E,null)):F&&(F.d(1),F=null)},d(x){x&&C(e),F&&F.d()}}}function qf(t){let e,l=t[1].net.dns2+"",n;return{c(){e=$("/ "),n=$(l)},m(i,r){M(i,e,r),M(i,n,r)},p(i,r){r&2&&l!==(l=i[1].net.dns2+"")&&Z(n,l)},d(i){i&&C(e),i&&C(n)}}}function Bf(t){let e,l,n,i=t[1].upgrade.f+"",r,u,a=t[1].upgrade.t+"",c,f,_=Za(t[1].upgrade.e)+"",p;return{c(){e=m("div"),l=m("div"),n=$("Previous upgrade attempt from "),r=$(i),u=$(" to "),c=$(a),f=$(" failed. "),p=$(_),o(l,"class","bd-yellow"),o(e,"class","my-2")},m(b,v){M(b,e,v),s(e,l),s(l,n),s(l,r),s(l,u),s(l,c),s(l,f),s(l,p)},p(b,v){v&2&&i!==(i=b[1].upgrade.f+"")&&Z(r,i),v&2&&a!==(a=b[1].upgrade.t+"")&&Z(c,a),v&2&&_!==(_=Za(b[1].upgrade.e)+"")&&Z(p,_)},d(b){b&&C(e)}}}function Uf(t){let e,l,n,i=t[2].tag_name+"",r,u,a,c,f,_,p=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Hf(t),b=t[1].fwconsent===2&&jf();return{c(){e=m("div"),l=$(`Latest version: - `),n=m("a"),r=$(i),a=h(),p&&p.c(),c=h(),b&&b.c(),f=Ve(),o(n,"href",u=t[2].html_url),o(n,"class","ml-2 text-blue-600 hover:text-blue-800"),o(n,"target","_blank"),o(n,"rel","noreferrer"),o(e,"class","my-2 flex")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(n,r),s(e,a),p&&p.m(e,null),M(v,c,d),b&&b.m(v,d),M(v,f,d),_=!0},p(v,d){(!_||d&4)&&i!==(i=v[2].tag_name+"")&&Z(r,i),(!_||d&4&&u!==(u=v[2].html_url))&&o(n,"href",u),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[2]&&v[2].tag_name!=v[1].version?p?(p.p(v,d),d&7&&D(p,1)):(p=Hf(v),p.c(),D(p,1),p.m(e,null)):p&&(De(),q(p,1,1,()=>{p=null}),Ie()),v[1].fwconsent===2?b||(b=jf(),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i(v){_||(D(p),_=!0)},o(v){q(p),_=!1},d(v){v&&C(e),p&&p.d(),v&&C(c),b&&b.d(v),v&&C(f)}}}function Hf(t){let e,l,n,i,r,u;return n=new Qc({}),{c(){e=m("div"),l=m("button"),ie(n.$$.fragment),o(e,"class","flex-none ml-2 text-green-500"),o(e,"title","Install this version")},m(a,c){M(a,e,c),s(e,l),le(n,l,null),i=!0,r||(u=ee(l,"click",t[10]),r=!0)},p:fe,i(a){i||(D(n.$$.fragment,a),i=!0)},o(a){q(n.$$.fragment,a),i=!1},d(a){a&&C(e),ne(n),r=!1,u()}}}function jf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',o(e,"class","my-2")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Wf(t){let e,l=Ms(be(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=$(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&2&&l!==(l=Ms(be(i[1].chip,i[1].board))+"")&&Z(n,l)},d(i){i&&C(e)}}}function zf(t){let e,l,n,i,r,u;function a(_,p){return _[4].length==0?Ep:Pp}let c=a(t),f=c(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),f.c(),sc(n,"display","none"),o(n,"name","file"),o(n,"type","file"),o(n,"accept",".bin"),o(l,"action","/firmware"),o(l,"enctype","multipart/form-data"),o(l,"method","post"),o(l,"autocomplete","off"),o(e,"class","my-2 flex")},m(_,p){M(_,e,p),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),r||(u=[ee(n,"change",t[13]),ee(l,"submit",t[15])],r=!0)},p(_,p){c===(c=a(_))&&f?f.p(_,p):(f.d(1),f=c(_),f&&(f.c(),f.m(l,null)))},d(_){_&&C(e),t[12](null),f.d(),r=!1,ze(u)}}}function Pp(t){let e=t[4][0].name+"",l,n,i;return{c(){l=$(e),n=h(),i=m("button"),i.textContent="Upload",o(i,"type","submit"),o(i,"class","btn-pri-sm float-right")},m(r,u){M(r,l,u),M(r,n,u),M(r,i,u)},p(r,u){u&16&&e!==(e=r[4][0].name+"")&&Z(l,e)},d(r){r&&C(l),r&&C(n),r&&C(i)}}}function Ep(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",o(e,"type","button"),o(e,"class","btn-pri-sm float-right")},m(i,r){M(i,e,r),l||(n=ee(e,"click",t[14]),l=!0)},p:fe,d(i){i&&C(e),l=!1,n()}}}function Gf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S=t[9],y=[];for(let P=0;P Include Secrets
(SSID, PSK, passwords and tokens)',c=h(),T&&T.c(),f=h(),_=m("form"),p=m("input"),b=h(),B.c(),o(l,"class","text-sm"),o(a,"class","my-1 mx-3 col-span-2"),o(r,"class","grid grid-cols-2"),o(i,"method","get"),o(i,"action","/configfile.cfg"),o(i,"autocomplete","off"),sc(p,"display","none"),o(p,"name","file"),o(p,"type","file"),o(p,"accept",".cfg"),o(_,"action","/configfile"),o(_,"enctype","multipart/form-data"),o(_,"method","post"),o(_,"autocomplete","off"),o(e,"class","cnt")},m(P,L){M(P,e,L),s(e,l),s(e,n),s(e,i),s(i,r);for(let O=0;O{A=null}),Ie());const _e={};pe&8388608&&(_e.$$scope={dirty:pe,ctx:re}),x.$set(_e),re[1].meter?I?I.p(re,pe):(I=Of(re),I.c(),I.m(e,V)):I&&(I.d(1),I=null),re[1].net?Q?Q.p(re,pe):(Q=Ff(re),Q.c(),Q.m(e,W)):Q&&(Q.d(1),Q=null),(!w||pe&2)&&oe!==(oe=re[1].version+"")&&Z(ue,oe),re[1].upgrade.t&&re[1].upgrade.t!=re[1].version?J?J.p(re,pe):(J=Bf(re),J.c(),J.m(U,me)):J&&(J.d(1),J=null),re[2]?se?(se.p(re,pe),pe&4&&D(se,1)):(se=Uf(re),se.c(),D(se,1),se.m(U,Te)):se&&(De(),q(se,1,1,()=>{se=null}),Ie()),pe&3&&(He=(re[1].security==0||re[0].a)&&oi(re[1].board)),He?ce?ce.p(re,pe):(ce=Wf(re),ce.c(),ce.m(U,Re)):ce&&(ce.d(1),ce=null),re[1].security==0||re[0].a?ve?ve.p(re,pe):(ve=zf(re),ve.c(),ve.m(U,null)):ve&&(ve.d(1),ve=null),re[1].security==0||re[0].a?Se?Se.p(re,pe):(Se=Gf(re),Se.c(),Se.m(e,null)):Se&&(Se.d(1),Se=null);const ye={};pe&32&&(ye.active=re[5]),$e.$set(ye);const vt={};pe&256&&(vt.active=re[8]),Me.$set(vt)},i(re){w||(D(y.$$.fragment,re),D(A),D(x.$$.fragment,re),D(se),D($e.$$.fragment,re),D(Me.$$.fragment,re),w=!0)},o(re){q(y.$$.fragment,re),q(A),q(x.$$.fragment,re),q(se),q($e.$$.fragment,re),q(Me.$$.fragment,re),w=!1},d(re){re&&C(e),ne(y),A&&A.d(),ne(x),I&&I.d(),Q&&Q.d(),J&&J.d(),se&&se.d(),ce&&ce.d(),ve&&ve.d(),Se&&Se.d(),re&&C(we),ne($e,re),re&&C(Le),ne(Me,re),g=!1,k()}}}async function Lp(){await(await fetch("/reboot",{method:"POST"})).json()}function Op(t,e,l){let{data:n}=e,{sysinfo:i}=e,r=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],u={};Sr.subscribe(O=>{l(2,u=Kc(i.version,O)),u||l(2,u=O[0])});function a(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Ms(be(i.chip,i.board))))&&(Ht.update(O=>(O.upgrading=!0,O)),Vc(u.tag_name))}const c=function(){confirm("Are you sure you want to reboot the device?")&&(Ht.update(O=>(O.booting=!0,O)),Lp())};let f,_=[],p=!1,b,v=[],d=!1;wr();function S(O){ws[O?"unshift":"push"](()=>{f=O,l(3,f)})}function y(){_=this.files,l(4,_)}const T=()=>{f.click()},N=()=>l(5,p=!0);function E(O){ws[O?"unshift":"push"](()=>{b=O,l(6,b)})}function B(){v=this.files,l(7,v)}const P=()=>{b.click()},L=()=>l(8,d=!0);return t.$$set=O=>{"data"in O&&l(0,n=O.data),"sysinfo"in O&&l(1,i=O.sysinfo)},[n,i,u,f,_,p,b,v,d,r,a,c,S,y,T,N,E,B,P,L]}class Fp extends Ee{constructor(e){super(),Pe(this,e,Op,Rp,Ne,{data:0,sysinfo:1})}}function Yf(t){let e,l,n=be(t[0],7)+"",i,r,u=be(t[0],5)+"",a,c,f=be(t[0],4)+"",_,p,b=be(t[0],3)+"",v,d,S,y,T=be(t[0],2)+"",N,E,B=be(t[0],1)+"",P,L,O=be(t[0],0)+"",F,x,H,z,G=be(t[0],101)+"",V,W,U=be(t[0],100)+"",K;return{c(){e=m("optgroup"),l=m("option"),i=$(n),r=m("option"),a=$(u),c=m("option"),_=$(f),p=m("option"),v=$(b),d=h(),S=m("optgroup"),y=m("option"),N=$(T),E=m("option"),P=$(B),L=m("option"),F=$(O),x=h(),H=m("optgroup"),z=m("option"),V=$(G),W=m("option"),K=$(U),l.__value=7,l.value=l.__value,r.__value=5,r.value=r.__value,c.__value=4,c.value=c.__value,p.__value=3,p.value=p.__value,o(e,"label","amsleser.no"),y.__value=2,y.value=y.__value,E.__value=1,E.value=E.__value,L.__value=0,L.value=L.__value,o(S,"label","Custom hardware"),z.__value=101,z.value=z.__value,W.__value=100,W.value=W.__value,o(H,"label","Generic hardware")},m(j,Y){M(j,e,Y),s(e,l),s(l,i),s(e,r),s(r,a),s(e,c),s(c,_),s(e,p),s(p,v),M(j,d,Y),M(j,S,Y),s(S,y),s(y,N),s(S,E),s(E,P),s(S,L),s(L,F),M(j,x,Y),M(j,H,Y),s(H,z),s(z,V),s(H,W),s(W,K)},p(j,Y){Y&1&&n!==(n=be(j[0],7)+"")&&Z(i,n),Y&1&&u!==(u=be(j[0],5)+"")&&Z(a,u),Y&1&&f!==(f=be(j[0],4)+"")&&Z(_,f),Y&1&&b!==(b=be(j[0],3)+"")&&Z(v,b),Y&1&&T!==(T=be(j[0],2)+"")&&Z(N,T),Y&1&&B!==(B=be(j[0],1)+"")&&Z(P,B),Y&1&&O!==(O=be(j[0],0)+"")&&Z(F,O),Y&1&&G!==(G=be(j[0],101)+"")&&Z(V,G),Y&1&&U!==(U=be(j[0],100)+"")&&Z(K,U)},d(j){j&&C(e),j&&C(d),j&&C(S),j&&C(x),j&&C(H)}}}function Qf(t){let e,l,n=be(t[0],201)+"",i,r,u=be(t[0],202)+"",a,c,f=be(t[0],203)+"",_,p,b=be(t[0],200)+"",v;return{c(){e=m("optgroup"),l=m("option"),i=$(n),r=m("option"),a=$(u),c=m("option"),_=$(f),p=m("option"),v=$(b),l.__value=201,l.value=l.__value,r.__value=202,r.value=r.__value,c.__value=203,c.value=c.__value,p.__value=200,p.value=p.__value,o(e,"label","Generic hardware")},m(d,S){M(d,e,S),s(e,l),s(l,i),s(e,r),s(r,a),s(e,c),s(c,_),s(e,p),s(p,v)},p(d,S){S&1&&n!==(n=be(d[0],201)+"")&&Z(i,n),S&1&&u!==(u=be(d[0],202)+"")&&Z(a,u),S&1&&f!==(f=be(d[0],203)+"")&&Z(_,f),S&1&&b!==(b=be(d[0],200)+"")&&Z(v,b)},d(d){d&&C(e)}}}function Xf(t){let e,l,n=be(t[0],7)+"",i,r,u=be(t[0],6)+"",a,c,f=be(t[0],5)+"",_,p,b,v,d=be(t[0],51)+"",S,y,T=be(t[0],50)+"",N;return{c(){e=m("optgroup"),l=m("option"),i=$(n),r=m("option"),a=$(u),c=m("option"),_=$(f),p=h(),b=m("optgroup"),v=m("option"),S=$(d),y=m("option"),N=$(T),l.__value=7,l.value=l.__value,r.__value=6,r.value=r.__value,c.__value=5,c.value=c.__value,o(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,y.__value=50,y.value=y.__value,o(b,"label","Generic hardware")},m(E,B){M(E,e,B),s(e,l),s(l,i),s(e,r),s(r,a),s(e,c),s(c,_),M(E,p,B),M(E,b,B),s(b,v),s(v,S),s(b,y),s(y,N)},p(E,B){B&1&&n!==(n=be(E[0],7)+"")&&Z(i,n),B&1&&u!==(u=be(E[0],6)+"")&&Z(a,u),B&1&&f!==(f=be(E[0],5)+"")&&Z(_,f),B&1&&d!==(d=be(E[0],51)+"")&&Z(S,d),B&1&&T!==(T=be(E[0],50)+"")&&Z(N,T)},d(E){E&&C(e),E&&C(p),E&&C(b)}}}function Zf(t){let e,l,n=be(t[0],8)+"",i,r,u,a,c=be(t[0],71)+"",f,_,p=be(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=$(n),r=h(),u=m("optgroup"),a=m("option"),f=$(c),_=m("option"),b=$(p),l.__value=8,l.value=l.__value,o(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,_.__value=70,_.value=_.__value,o(u,"label","Generic hardware")},m(v,d){M(v,e,d),s(e,l),s(l,i),M(v,r,d),M(v,u,d),s(u,a),s(a,f),s(u,_),s(_,b)},p(v,d){d&1&&n!==(n=be(v[0],8)+"")&&Z(i,n),d&1&&c!==(c=be(v[0],71)+"")&&Z(f,c),d&1&&p!==(p=be(v[0],70)+"")&&Z(b,p)},d(v){v&&C(e),v&&C(r),v&&C(u)}}}function Jf(t){let e,l,n=be(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=$(n),l.__value=200,l.value=l.__value,o(e,"label","Generic hardware")},m(r,u){M(r,e,u),s(e,l),s(l,i)},p(r,u){u&1&&n!==(n=be(r[0],200)+"")&&Z(i,n)},d(r){r&&C(e)}}}function qp(t){let e,l,n,i,r,u,a,c=t[0]=="esp8266"&&Yf(t),f=t[0]=="esp32"&&Qf(t),_=t[0]=="esp32s2"&&Xf(t),p=t[0]=="esp32c3"&&Zf(t),b=t[0]=="esp32solo"&&Jf(t);return{c(){e=m("option"),l=h(),c&&c.c(),n=h(),f&&f.c(),i=h(),_&&_.c(),r=h(),p&&p.c(),u=h(),b&&b.c(),a=Ve(),e.__value=-1,e.value=e.__value},m(v,d){M(v,e,d),M(v,l,d),c&&c.m(v,d),M(v,n,d),f&&f.m(v,d),M(v,i,d),_&&_.m(v,d),M(v,r,d),p&&p.m(v,d),M(v,u,d),b&&b.m(v,d),M(v,a,d)},p(v,[d]){v[0]=="esp8266"?c?c.p(v,d):(c=Yf(v),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),v[0]=="esp32"?f?f.p(v,d):(f=Qf(v),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),v[0]=="esp32s2"?_?_.p(v,d):(_=Xf(v),_.c(),_.m(r.parentNode,r)):_&&(_.d(1),_=null),v[0]=="esp32c3"?p?p.p(v,d):(p=Zf(v),p.c(),p.m(u.parentNode,u)):p&&(p.d(1),p=null),v[0]=="esp32solo"?b?b.p(v,d):(b=Jf(v),b.c(),b.m(a.parentNode,a)):b&&(b.d(1),b=null)},i:fe,o:fe,d(v){v&&C(e),v&&C(l),c&&c.d(v),v&&C(n),f&&f.d(v),v&&C(i),_&&_.d(v),v&&C(r),p&&p.d(v),v&&C(u),b&&b.d(v),v&&C(a)}}}function Bp(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Up extends Ee{constructor(e){super(),Pe(this,e,Bp,qp,Ne,{chip:0})}}function xf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",o(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function ec(t){let e,l,n,i,r,u,a;return u=new Zc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=$("HAN GPIO"),n=m("br"),i=h(),r=m("select"),ie(u.$$.fragment),o(r,"name","vh"),o(r,"class","in-s"),o(e,"class","my-3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),le(u,r,null),a=!0},p(c,f){const _={};f&1&&(_.chip=c[0].chip),u.$set(_)},i(c){a||(D(u.$$.fragment,c),a=!0)},o(c){q(u.$$.fragment,c),a=!1},d(c){c&&C(e),ne(u)}}}function Hp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V,W=t[0].usrcfg&&xf();d=new Up({props:{chip:t[0].chip}});let U=t[0].board&&t[0].board>20&&ec(t);return H=new It({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),r=h(),u=m("strong"),u.textContent="Initial configuration",a=h(),W&&W.c(),c=h(),f=m("div"),_=$("Board type"),p=m("br"),b=h(),v=m("select"),ie(d.$$.fragment),S=h(),U&&U.c(),y=h(),T=m("div"),N=m("label"),E=m("input"),B=$(" Clear all other configuration"),P=h(),L=m("div"),L.innerHTML='',O=h(),F=m("span"),F.textContent="\xA0",x=h(),ie(H.$$.fragment),o(i,"type","hidden"),o(i,"name","v"),i.value="true",o(u,"class","text-sm"),o(v,"name","vb"),o(v,"class","in-s"),t[0].board===void 0&&Qe(()=>t[4].call(v)),o(f,"class","my-3"),o(E,"type","checkbox"),o(E,"name","vr"),E.__value="true",E.value=E.__value,o(E,"class","rounded mb-1"),o(T,"class","my-3"),o(L,"class","my-3"),o(F,"class","clear-both"),o(n,"autocomplete","off"),o(l,"class","cnt"),o(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(K,j){M(K,e,j),s(e,l),s(l,n),s(n,i),s(n,r),s(n,u),s(n,a),W&&W.m(n,null),s(n,c),s(n,f),s(f,_),s(f,p),s(f,b),s(f,v),le(d,v,null),qe(v,t[0].board,!0),s(n,S),U&&U.m(n,null),s(n,y),s(n,T),s(T,N),s(N,E),E.checked=t[2],s(N,B),s(n,P),s(n,L),s(n,O),s(n,F),M(K,x,j),le(H,K,j),z=!0,G||(V=[ee(v,"change",t[4]),ee(E,"change",t[5]),ee(n,"submit",Ss(t[3]))],G=!0)},p(K,[j]){K[0].usrcfg?W||(W=xf(),W.c(),W.m(n,c)):W&&(W.d(1),W=null);const Y={};j&1&&(Y.chip=K[0].chip),d.$set(Y),j&1&&qe(v,K[0].board),K[0].board&&K[0].board>20?U?(U.p(K,j),j&1&&D(U,1)):(U=ec(K),U.c(),D(U,1),U.m(n,y)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),j&4&&(E.checked=K[2]);const X={};j&2&&(X.active=K[1]),H.$set(X)},i(K){z||(D(d.$$.fragment,K),D(U),D(H.$$.fragment,K),z=!0)},o(K){q(d.$$.fragment,K),q(U),q(H.$$.fragment,K),z=!1},d(K){K&&C(e),W&&W.d(),ne(d),U&&U.d(),K&&C(x),ne(H,K),G=!1,ze(V)}}}function jp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function r(f){l(1,i=!0);const _=new FormData(f.target),p=new URLSearchParams;for(let d of _){const[S,y]=d;p.append(S,y)}let v=await(await fetch("/save",{method:"POST",body:p})).json();l(1,i=!1),Ht.update(d=>(d.vndcfg=v.success,d.booting=v.reboot,d)),ri(n.usrcfg?"/":"/setup")}let u=!1;function a(){n.board=dt(this),l(0,n)}function c(){u=this.checked,l(2,u),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,u=!n.usrcfg)},[n,i,u,r,a,c]}class Wp extends Ee{constructor(e){super(),Pe(this,e,jp,Hp,Ne,{sysinfo:0})}}function tc(t){let e,l,n,i,r,u,a,c;return a=new Jc({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),r=h(),u=m("select"),ie(a.$$.fragment),o(i,"name","si"),o(i,"type","text"),o(i,"class","in-f w-full"),i.required=t[1],o(u,"name","su"),o(u,"class","in-l"),u.required=t[1],o(n,"class","flex")},m(f,_){M(f,e,_),M(f,l,_),M(f,n,_),s(n,i),s(n,r),s(n,u),le(a,u,null),c=!0},p(f,_){(!c||_&2)&&(i.required=f[1]),(!c||_&2)&&(u.required=f[1])},i(f){c||(D(a.$$.fragment,f),c=!0)},o(f){q(a.$$.fragment,f),c=!1},d(f){f&&C(e),f&&C(l),f&&C(n),ne(a)}}}function lc(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
+ `),n=m("a"),r=$(i),a=h(),p&&p.c(),c=h(),b&&b.c(),f=Ve(),o(n,"href",u=t[2].html_url),o(n,"class","ml-2 text-blue-600 hover:text-blue-800"),o(n,"target","_blank"),o(n,"rel","noreferrer"),o(e,"class","my-2 flex")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(n,r),s(e,a),p&&p.m(e,null),M(v,c,d),b&&b.m(v,d),M(v,f,d),_=!0},p(v,d){(!_||d&4)&&i!==(i=v[2].tag_name+"")&&Z(r,i),(!_||d&4&&u!==(u=v[2].html_url))&&o(n,"href",u),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[2]&&v[2].tag_name!=v[1].version?p?(p.p(v,d),d&7&&D(p,1)):(p=Hf(v),p.c(),D(p,1),p.m(e,null)):p&&(De(),q(p,1,1,()=>{p=null}),Ie()),v[1].fwconsent===2?b||(b=jf(),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i(v){_||(D(p),_=!0)},o(v){q(p),_=!1},d(v){v&&C(e),p&&p.d(),v&&C(c),b&&b.d(v),v&&C(f)}}}function Hf(t){let e,l,n,i,r,u;return n=new Qc({}),{c(){e=m("div"),l=m("button"),ie(n.$$.fragment),o(e,"class","flex-none ml-2 text-green-500"),o(e,"title","Install this version")},m(a,c){M(a,e,c),s(e,l),le(n,l,null),i=!0,r||(u=ee(l,"click",t[10]),r=!0)},p:fe,i(a){i||(D(n.$$.fragment,a),i=!0)},o(a){q(n.$$.fragment,a),i=!1},d(a){a&&C(e),ne(n),r=!1,u()}}}function jf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',o(e,"class","my-2")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Wf(t){let e,l=Ms(be(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=$(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&2&&l!==(l=Ms(be(i[1].chip,i[1].board))+"")&&Z(n,l)},d(i){i&&C(e)}}}function zf(t){let e,l,n,i,r,u;function a(_,p){return _[4].length==0?Ep:Pp}let c=a(t),f=c(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),f.c(),sc(n,"display","none"),o(n,"name","file"),o(n,"type","file"),o(n,"accept",".bin"),o(l,"action","/firmware"),o(l,"enctype","multipart/form-data"),o(l,"method","post"),o(l,"autocomplete","off"),o(e,"class","my-2 flex")},m(_,p){M(_,e,p),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),r||(u=[ee(n,"change",t[13]),ee(l,"submit",t[15])],r=!0)},p(_,p){c===(c=a(_))&&f?f.p(_,p):(f.d(1),f=c(_),f&&(f.c(),f.m(l,null)))},d(_){_&&C(e),t[12](null),f.d(),r=!1,ze(u)}}}function Pp(t){let e=t[4][0].name+"",l,n,i;return{c(){l=$(e),n=h(),i=m("button"),i.textContent="Upload",o(i,"type","submit"),o(i,"class","btn-pri-sm float-right")},m(r,u){M(r,l,u),M(r,n,u),M(r,i,u)},p(r,u){u&16&&e!==(e=r[4][0].name+"")&&Z(l,e)},d(r){r&&C(l),r&&C(n),r&&C(i)}}}function Ep(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",o(e,"type","button"),o(e,"class","btn-pri-sm float-right")},m(i,r){M(i,e,r),l||(n=ee(e,"click",t[14]),l=!0)},p:fe,d(i){i&&C(e),l=!1,n()}}}function Gf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S=t[9],y=[];for(let P=0;P Include Secrets
(SSID, PSK, passwords and tokens)',c=h(),T&&T.c(),f=h(),_=m("form"),p=m("input"),b=h(),B.c(),o(l,"class","text-sm"),o(a,"class","my-1 mx-3 col-span-2"),o(r,"class","grid grid-cols-2"),o(i,"method","get"),o(i,"action","/configfile.cfg"),o(i,"autocomplete","off"),sc(p,"display","none"),o(p,"name","file"),o(p,"type","file"),o(p,"accept",".cfg"),o(_,"action","/configfile"),o(_,"enctype","multipart/form-data"),o(_,"method","post"),o(_,"autocomplete","off"),o(e,"class","cnt")},m(P,L){M(P,e,L),s(e,l),s(e,n),s(e,i),s(i,r);for(let O=0;O{A=null}),Ie());const _e={};pe&8388608&&(_e.$$scope={dirty:pe,ctx:re}),x.$set(_e),re[1].meter?I?I.p(re,pe):(I=Of(re),I.c(),I.m(e,V)):I&&(I.d(1),I=null),re[1].net?Q?Q.p(re,pe):(Q=Ff(re),Q.c(),Q.m(e,W)):Q&&(Q.d(1),Q=null),(!w||pe&2)&&oe!==(oe=re[1].version+"")&&Z(ue,oe),re[1].upgrade.t&&re[1].upgrade.t!=re[1].version?J?J.p(re,pe):(J=Bf(re),J.c(),J.m(U,me)):J&&(J.d(1),J=null),re[2]?se?(se.p(re,pe),pe&4&&D(se,1)):(se=Uf(re),se.c(),D(se,1),se.m(U,Te)):se&&(De(),q(se,1,1,()=>{se=null}),Ie()),pe&3&&(He=(re[1].security==0||re[0].a)&&oi(re[1].board)),He?ce?ce.p(re,pe):(ce=Wf(re),ce.c(),ce.m(U,Re)):ce&&(ce.d(1),ce=null),re[1].security==0||re[0].a?ve?ve.p(re,pe):(ve=zf(re),ve.c(),ve.m(U,null)):ve&&(ve.d(1),ve=null),re[1].security==0||re[0].a?Se?Se.p(re,pe):(Se=Gf(re),Se.c(),Se.m(e,null)):Se&&(Se.d(1),Se=null);const ye={};pe&32&&(ye.active=re[5]),$e.$set(ye);const vt={};pe&256&&(vt.active=re[8]),Me.$set(vt)},i(re){w||(D(y.$$.fragment,re),D(A),D(x.$$.fragment,re),D(se),D($e.$$.fragment,re),D(Me.$$.fragment,re),w=!0)},o(re){q(y.$$.fragment,re),q(A),q(x.$$.fragment,re),q(se),q($e.$$.fragment,re),q(Me.$$.fragment,re),w=!1},d(re){re&&C(e),ne(y),A&&A.d(),ne(x),I&&I.d(),Q&&Q.d(),J&&J.d(),se&&se.d(),ce&&ce.d(),ve&&ve.d(),Se&&Se.d(),re&&C(we),ne($e,re),re&&C(Le),ne(Me,re),g=!1,k()}}}async function Lp(){await(await fetch("/reboot",{method:"POST"})).json()}function Op(t,e,l){let{data:n}=e,{sysinfo:i}=e,r=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],u={};Sr.subscribe(O=>{l(2,u=Kc(i.version,O)),u||l(2,u=O[0])});function a(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Ms(be(i.chip,i.board))))&&(Rt.update(O=>(O.upgrading=!0,O)),Vc(u.tag_name))}const c=function(){confirm("Are you sure you want to reboot the device?")&&(Rt.update(O=>(O.booting=!0,O)),Lp())};let f,_=[],p=!1,b,v=[],d=!1;wr();function S(O){ws[O?"unshift":"push"](()=>{f=O,l(3,f)})}function y(){_=this.files,l(4,_)}const T=()=>{f.click()},N=()=>l(5,p=!0);function E(O){ws[O?"unshift":"push"](()=>{b=O,l(6,b)})}function B(){v=this.files,l(7,v)}const P=()=>{b.click()},L=()=>l(8,d=!0);return t.$$set=O=>{"data"in O&&l(0,n=O.data),"sysinfo"in O&&l(1,i=O.sysinfo)},[n,i,u,f,_,p,b,v,d,r,a,c,S,y,T,N,E,B,P,L]}class Fp extends Ee{constructor(e){super(),Pe(this,e,Op,Rp,Ne,{data:0,sysinfo:1})}}function Yf(t){let e,l,n=be(t[0],7)+"",i,r,u=be(t[0],5)+"",a,c,f=be(t[0],4)+"",_,p,b=be(t[0],3)+"",v,d,S,y,T=be(t[0],2)+"",N,E,B=be(t[0],1)+"",P,L,O=be(t[0],0)+"",F,x,H,z,G=be(t[0],101)+"",V,W,U=be(t[0],100)+"",K;return{c(){e=m("optgroup"),l=m("option"),i=$(n),r=m("option"),a=$(u),c=m("option"),_=$(f),p=m("option"),v=$(b),d=h(),S=m("optgroup"),y=m("option"),N=$(T),E=m("option"),P=$(B),L=m("option"),F=$(O),x=h(),H=m("optgroup"),z=m("option"),V=$(G),W=m("option"),K=$(U),l.__value=7,l.value=l.__value,r.__value=5,r.value=r.__value,c.__value=4,c.value=c.__value,p.__value=3,p.value=p.__value,o(e,"label","amsleser.no"),y.__value=2,y.value=y.__value,E.__value=1,E.value=E.__value,L.__value=0,L.value=L.__value,o(S,"label","Custom hardware"),z.__value=101,z.value=z.__value,W.__value=100,W.value=W.__value,o(H,"label","Generic hardware")},m(j,Y){M(j,e,Y),s(e,l),s(l,i),s(e,r),s(r,a),s(e,c),s(c,_),s(e,p),s(p,v),M(j,d,Y),M(j,S,Y),s(S,y),s(y,N),s(S,E),s(E,P),s(S,L),s(L,F),M(j,x,Y),M(j,H,Y),s(H,z),s(z,V),s(H,W),s(W,K)},p(j,Y){Y&1&&n!==(n=be(j[0],7)+"")&&Z(i,n),Y&1&&u!==(u=be(j[0],5)+"")&&Z(a,u),Y&1&&f!==(f=be(j[0],4)+"")&&Z(_,f),Y&1&&b!==(b=be(j[0],3)+"")&&Z(v,b),Y&1&&T!==(T=be(j[0],2)+"")&&Z(N,T),Y&1&&B!==(B=be(j[0],1)+"")&&Z(P,B),Y&1&&O!==(O=be(j[0],0)+"")&&Z(F,O),Y&1&&G!==(G=be(j[0],101)+"")&&Z(V,G),Y&1&&U!==(U=be(j[0],100)+"")&&Z(K,U)},d(j){j&&C(e),j&&C(d),j&&C(S),j&&C(x),j&&C(H)}}}function Qf(t){let e,l,n=be(t[0],201)+"",i,r,u=be(t[0],202)+"",a,c,f=be(t[0],203)+"",_,p,b=be(t[0],200)+"",v;return{c(){e=m("optgroup"),l=m("option"),i=$(n),r=m("option"),a=$(u),c=m("option"),_=$(f),p=m("option"),v=$(b),l.__value=201,l.value=l.__value,r.__value=202,r.value=r.__value,c.__value=203,c.value=c.__value,p.__value=200,p.value=p.__value,o(e,"label","Generic hardware")},m(d,S){M(d,e,S),s(e,l),s(l,i),s(e,r),s(r,a),s(e,c),s(c,_),s(e,p),s(p,v)},p(d,S){S&1&&n!==(n=be(d[0],201)+"")&&Z(i,n),S&1&&u!==(u=be(d[0],202)+"")&&Z(a,u),S&1&&f!==(f=be(d[0],203)+"")&&Z(_,f),S&1&&b!==(b=be(d[0],200)+"")&&Z(v,b)},d(d){d&&C(e)}}}function Xf(t){let e,l,n=be(t[0],7)+"",i,r,u=be(t[0],6)+"",a,c,f=be(t[0],5)+"",_,p,b,v,d=be(t[0],51)+"",S,y,T=be(t[0],50)+"",N;return{c(){e=m("optgroup"),l=m("option"),i=$(n),r=m("option"),a=$(u),c=m("option"),_=$(f),p=h(),b=m("optgroup"),v=m("option"),S=$(d),y=m("option"),N=$(T),l.__value=7,l.value=l.__value,r.__value=6,r.value=r.__value,c.__value=5,c.value=c.__value,o(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,y.__value=50,y.value=y.__value,o(b,"label","Generic hardware")},m(E,B){M(E,e,B),s(e,l),s(l,i),s(e,r),s(r,a),s(e,c),s(c,_),M(E,p,B),M(E,b,B),s(b,v),s(v,S),s(b,y),s(y,N)},p(E,B){B&1&&n!==(n=be(E[0],7)+"")&&Z(i,n),B&1&&u!==(u=be(E[0],6)+"")&&Z(a,u),B&1&&f!==(f=be(E[0],5)+"")&&Z(_,f),B&1&&d!==(d=be(E[0],51)+"")&&Z(S,d),B&1&&T!==(T=be(E[0],50)+"")&&Z(N,T)},d(E){E&&C(e),E&&C(p),E&&C(b)}}}function Zf(t){let e,l,n=be(t[0],8)+"",i,r,u,a,c=be(t[0],71)+"",f,_,p=be(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=$(n),r=h(),u=m("optgroup"),a=m("option"),f=$(c),_=m("option"),b=$(p),l.__value=8,l.value=l.__value,o(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,_.__value=70,_.value=_.__value,o(u,"label","Generic hardware")},m(v,d){M(v,e,d),s(e,l),s(l,i),M(v,r,d),M(v,u,d),s(u,a),s(a,f),s(u,_),s(_,b)},p(v,d){d&1&&n!==(n=be(v[0],8)+"")&&Z(i,n),d&1&&c!==(c=be(v[0],71)+"")&&Z(f,c),d&1&&p!==(p=be(v[0],70)+"")&&Z(b,p)},d(v){v&&C(e),v&&C(r),v&&C(u)}}}function Jf(t){let e,l,n=be(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=$(n),l.__value=200,l.value=l.__value,o(e,"label","Generic hardware")},m(r,u){M(r,e,u),s(e,l),s(l,i)},p(r,u){u&1&&n!==(n=be(r[0],200)+"")&&Z(i,n)},d(r){r&&C(e)}}}function qp(t){let e,l,n,i,r,u,a,c=t[0]=="esp8266"&&Yf(t),f=t[0]=="esp32"&&Qf(t),_=t[0]=="esp32s2"&&Xf(t),p=t[0]=="esp32c3"&&Zf(t),b=t[0]=="esp32solo"&&Jf(t);return{c(){e=m("option"),l=h(),c&&c.c(),n=h(),f&&f.c(),i=h(),_&&_.c(),r=h(),p&&p.c(),u=h(),b&&b.c(),a=Ve(),e.__value=-1,e.value=e.__value},m(v,d){M(v,e,d),M(v,l,d),c&&c.m(v,d),M(v,n,d),f&&f.m(v,d),M(v,i,d),_&&_.m(v,d),M(v,r,d),p&&p.m(v,d),M(v,u,d),b&&b.m(v,d),M(v,a,d)},p(v,[d]){v[0]=="esp8266"?c?c.p(v,d):(c=Yf(v),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),v[0]=="esp32"?f?f.p(v,d):(f=Qf(v),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),v[0]=="esp32s2"?_?_.p(v,d):(_=Xf(v),_.c(),_.m(r.parentNode,r)):_&&(_.d(1),_=null),v[0]=="esp32c3"?p?p.p(v,d):(p=Zf(v),p.c(),p.m(u.parentNode,u)):p&&(p.d(1),p=null),v[0]=="esp32solo"?b?b.p(v,d):(b=Jf(v),b.c(),b.m(a.parentNode,a)):b&&(b.d(1),b=null)},i:fe,o:fe,d(v){v&&C(e),v&&C(l),c&&c.d(v),v&&C(n),f&&f.d(v),v&&C(i),_&&_.d(v),v&&C(r),p&&p.d(v),v&&C(u),b&&b.d(v),v&&C(a)}}}function Bp(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Up extends Ee{constructor(e){super(),Pe(this,e,Bp,qp,Ne,{chip:0})}}function xf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",o(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function ec(t){let e,l,n,i,r,u,a;return u=new Zc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=$("HAN GPIO"),n=m("br"),i=h(),r=m("select"),ie(u.$$.fragment),o(r,"name","vh"),o(r,"class","in-s"),o(e,"class","my-3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),le(u,r,null),a=!0},p(c,f){const _={};f&1&&(_.chip=c[0].chip),u.$set(_)},i(c){a||(D(u.$$.fragment,c),a=!0)},o(c){q(u.$$.fragment,c),a=!1},d(c){c&&C(e),ne(u)}}}function Hp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V,W=t[0].usrcfg&&xf();d=new Up({props:{chip:t[0].chip}});let U=t[0].board&&t[0].board>20&&ec(t);return H=new It({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),r=h(),u=m("strong"),u.textContent="Initial configuration",a=h(),W&&W.c(),c=h(),f=m("div"),_=$("Board type"),p=m("br"),b=h(),v=m("select"),ie(d.$$.fragment),S=h(),U&&U.c(),y=h(),T=m("div"),N=m("label"),E=m("input"),B=$(" Clear all other configuration"),P=h(),L=m("div"),L.innerHTML='',O=h(),F=m("span"),F.textContent="\xA0",x=h(),ie(H.$$.fragment),o(i,"type","hidden"),o(i,"name","v"),i.value="true",o(u,"class","text-sm"),o(v,"name","vb"),o(v,"class","in-s"),t[0].board===void 0&&Qe(()=>t[4].call(v)),o(f,"class","my-3"),o(E,"type","checkbox"),o(E,"name","vr"),E.__value="true",E.value=E.__value,o(E,"class","rounded mb-1"),o(T,"class","my-3"),o(L,"class","my-3"),o(F,"class","clear-both"),o(n,"autocomplete","off"),o(l,"class","cnt"),o(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(K,j){M(K,e,j),s(e,l),s(l,n),s(n,i),s(n,r),s(n,u),s(n,a),W&&W.m(n,null),s(n,c),s(n,f),s(f,_),s(f,p),s(f,b),s(f,v),le(d,v,null),qe(v,t[0].board,!0),s(n,S),U&&U.m(n,null),s(n,y),s(n,T),s(T,N),s(N,E),E.checked=t[2],s(N,B),s(n,P),s(n,L),s(n,O),s(n,F),M(K,x,j),le(H,K,j),z=!0,G||(V=[ee(v,"change",t[4]),ee(E,"change",t[5]),ee(n,"submit",Ss(t[3]))],G=!0)},p(K,[j]){K[0].usrcfg?W||(W=xf(),W.c(),W.m(n,c)):W&&(W.d(1),W=null);const Y={};j&1&&(Y.chip=K[0].chip),d.$set(Y),j&1&&qe(v,K[0].board),K[0].board&&K[0].board>20?U?(U.p(K,j),j&1&&D(U,1)):(U=ec(K),U.c(),D(U,1),U.m(n,y)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),j&4&&(E.checked=K[2]);const X={};j&2&&(X.active=K[1]),H.$set(X)},i(K){z||(D(d.$$.fragment,K),D(U),D(H.$$.fragment,K),z=!0)},o(K){q(d.$$.fragment,K),q(U),q(H.$$.fragment,K),z=!1},d(K){K&&C(e),W&&W.d(),ne(d),U&&U.d(),K&&C(x),ne(H,K),G=!1,ze(V)}}}function jp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function r(f){l(1,i=!0);const _=new FormData(f.target),p=new URLSearchParams;for(let d of _){const[S,y]=d;p.append(S,y)}let v=await(await fetch("/save",{method:"POST",body:p})).json();l(1,i=!1),Rt.update(d=>(d.vndcfg=v.success,d.booting=v.reboot,d)),ri(n.usrcfg?"/":"/setup")}let u=!1;Rt.subscribe(f=>{l(0,n=f),f.fwconsent===1&&l(2,u=!n.usrcfg)});function a(){n.board=dt(this),l(0,n)}function c(){u=this.checked,l(2,u)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},[n,i,u,r,a,c]}class Wp extends Ee{constructor(e){super(),Pe(this,e,jp,Hp,Ne,{sysinfo:0})}}function tc(t){let e,l,n,i,r,u,a,c;return a=new Jc({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),r=h(),u=m("select"),ie(a.$$.fragment),o(i,"name","si"),o(i,"type","text"),o(i,"class","in-f w-full"),i.required=t[1],o(u,"name","su"),o(u,"class","in-l"),u.required=t[1],o(n,"class","flex")},m(f,_){M(f,e,_),M(f,l,_),M(f,n,_),s(n,i),s(n,r),s(n,u),le(a,u,null),c=!0},p(f,_){(!c||_&2)&&(i.required=f[1]),(!c||_&2)&&(u.required=f[1])},i(f){c||(D(a.$$.fragment,f),c=!0)},o(f){q(a.$$.fragment,f),c=!1},d(f){f&&C(e),f&&C(l),f&&C(n),ne(a)}}}function lc(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
DNS
`,o(e,"class","my-3 flex")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function zp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V=t[1]&&tc(t),W=t[1]&&lc();return x=new It({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),r=h(),u=m("strong"),u.textContent="Setup",a=h(),c=m("div"),c.innerHTML=`SSID
`,f=h(),_=m("div"),_.innerHTML=`PSK
`,p=h(),b=m("div"),v=$(`Hostname - `),d=m("input"),S=h(),y=m("div"),T=m("label"),N=m("input"),E=$(" Static IP"),B=h(),V&&V.c(),P=h(),W&&W.c(),L=h(),O=m("div"),O.innerHTML='',F=h(),ie(x.$$.fragment),o(i,"type","hidden"),o(i,"name","s"),i.value="true",o(u,"class","text-sm"),o(c,"class","my-3"),o(_,"class","my-3"),o(d,"name","sh"),o(d,"type","text"),o(d,"class","in-s"),o(d,"maxlength","32"),o(d,"pattern","[a-z0-9_-]+"),o(d,"placeholder","Optional, ex.: ams-reader"),o(d,"autocomplete","off"),o(N,"type","checkbox"),o(N,"name","sm"),N.__value="static",N.value=N.__value,o(N,"class","rounded mb-1"),o(y,"class","my-3"),o(O,"class","my-3"),o(l,"class","cnt"),o(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(U,K){M(U,e,K),s(e,l),s(l,n),s(n,i),s(n,r),s(n,u),s(n,a),s(n,c),s(n,f),s(n,_),s(n,p),s(n,b),s(b,v),s(b,d),te(d,t[0].hostname),s(n,S),s(n,y),s(y,T),s(T,N),N.checked=t[1],s(T,E),s(y,B),V&&V.m(y,null),s(n,P),W&&W.m(n,null),s(n,L),s(n,O),M(U,F,K),le(x,U,K),H=!0,z||(G=[ee(d,"input",t[4]),ee(N,"change",t[5]),ee(n,"submit",Ss(t[3]))],z=!0)},p(U,[K]){K&1&&d.value!==U[0].hostname&&te(d,U[0].hostname),K&2&&(N.checked=U[1]),U[1]?V?(V.p(U,K),K&2&&D(V,1)):(V=tc(U),V.c(),D(V,1),V.m(y,null)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),U[1]?W||(W=lc(),W.c(),W.m(n,L)):W&&(W.d(1),W=null);const j={};K&4&&(j.active=U[2]),x.$set(j)},i(U){H||(D(V),D(x.$$.fragment,U),H=!0)},o(U){q(V),q(x.$$.fragment,U),H=!1},d(U){U&&C(e),V&&V.d(),W&&W.d(),U&&C(F),ne(x,U),z=!1,ze(G)}}}function Gp(t,e,l){let{sysinfo:n={}}=e,i=!1,r=!1,u=0;function a(){var p="";u++;var b=function(){setTimeout(a,1e3)};if(n.net.ip&&u%3==0){if(!n.net.ip){b();return}p="http://"+n.net.ip}else n.hostname&&u%3==1?p="http://"+n.hostname:n.hostname&&u%3==2?p="http://"+n.hostname+".local":p="";console&&console.log("Trying url "+p),Ht.update(d=>(d.trying=p,d));var v=new XMLHttpRequest;v.timeout=5e3,v.addEventListener("abort",b),v.addEventListener("error",b),v.addEventListener("timeout",b),v.addEventListener("load",function(d){window.location.href=p||"/"}),v.open("GET",p+"/is-alive",!0),v.send()}async function c(p){l(2,r=!0);const b=new FormData(p.target),v=new URLSearchParams;for(let y of b){const[T,N]=y;v.append(T,N)}let S=await(await fetch("/save",{method:"POST",body:v})).json();l(2,r=!1),Ht.update(y=>(y.hostname=b.get("sh"),y.usrcfg=S.success,y.booting=S.reboot,i&&(y.net.ip=b.get("si"),y.net.mask=b.get("su"),y.net.gw=b.get("sg"),y.net.dns1=b.get("sd")),setTimeout(a,5e3),y))}function f(){n.hostname=this.value,l(0,n)}function _(){i=this.checked,l(1,i)}return t.$$set=p=>{"sysinfo"in p&&l(0,n=p.sysinfo)},[n,i,r,c,f,_]}class Vp extends Ee{constructor(e){super(),Pe(this,e,Gp,zp,Ne,{sysinfo:0})}}function Kp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T;return d=new It({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=$("Upload "),r=$(t[1]),u=h(),a=m("p"),a.textContent="Select a suitable file and click upload",c=h(),f=m("form"),_=m("input"),p=h(),b=m("div"),b.innerHTML='',v=h(),ie(d.$$.fragment),o(a,"class","mb-4"),o(_,"name","file"),o(_,"type","file"),o(b,"class","w-full text-right mt-4"),o(f,"action",t[0]),o(f,"enctype","multipart/form-data"),o(f,"method","post"),o(f,"autocomplete","off"),o(l,"class","cnt"),o(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(N,E){M(N,e,E),s(e,l),s(l,n),s(n,i),s(n,r),s(l,u),s(l,a),s(l,c),s(l,f),s(f,_),s(f,p),s(f,b),M(N,v,E),le(d,N,E),S=!0,y||(T=ee(f,"submit",t[3]),y=!0)},p(N,[E]){(!S||E&2)&&Z(r,N[1]),(!S||E&1)&&o(f,"action",N[0]);const B={};E&4&&(B.active=N[2]),d.$set(B)},i(N){S||(D(d.$$.fragment,N),S=!0)},o(N){q(d.$$.fragment,N),S=!1},d(N){N&&C(e),N&&C(v),ne(d,N),y=!1,T()}}}function Yp(t,e,l){let{action:n}=e,{title:i}=e,r=!1;const u=()=>l(2,r=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,r,u]}class $r extends Ee{constructor(e){super(),Pe(this,e,Yp,Kp,Ne,{action:0,title:1})}}function Qp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V,W,U;return G=new It({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:",r=h(),u=m("hr"),a=h(),c=m("div"),f=$("Enable one-click upgrade? (implies data collection)"),_=m("br"),p=h(),b=m("a"),v=$("Read more"),d=m("br"),S=h(),y=m("label"),T=m("input"),E=$(" Yes"),B=m("label"),P=m("input"),O=$(" No"),F=m("br"),x=h(),H=m("div"),H.innerHTML='',z=h(),ie(G.$$.fragment),o(b,"href",Ut("Data-collection-on-one-click-firmware-upgrade")),o(b,"target","_blank"),o(b,"class","text-blue-600 hover:text-blue-800"),o(T,"type","radio"),o(T,"name","sf"),T.value=1,T.checked=N=t[0].fwconsent===1,o(T,"class","rounded m-2"),T.required=!0,o(P,"type","radio"),o(P,"name","sf"),P.value=2,P.checked=L=t[0].fwconsent===2,o(P,"class","rounded m-2"),P.required=!0,o(c,"class","my-3"),o(H,"class","my-3"),o(n,"autocomplete","off"),o(l,"class","cnt"),o(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(K,j){M(K,e,j),s(e,l),s(l,n),s(n,i),s(n,r),s(n,u),s(n,a),s(n,c),s(c,f),s(c,_),s(c,p),s(c,b),s(b,v),s(c,d),s(c,S),s(c,y),s(y,T),s(y,E),s(c,B),s(B,P),s(B,O),s(c,F),s(n,x),s(n,H),M(K,z,j),le(G,K,j),V=!0,W||(U=ee(n,"submit",Ss(t[2])),W=!0)},p(K,[j]){(!V||j&1&&N!==(N=K[0].fwconsent===1))&&(T.checked=N),(!V||j&1&&L!==(L=K[0].fwconsent===2))&&(P.checked=L);const Y={};j&2&&(Y.active=K[1]),G.$set(Y)},i(K){V||(D(G.$$.fragment,K),V=!0)},o(K){q(G.$$.fragment,K),V=!1},d(K){K&&C(e),K&&C(z),ne(G,K),W=!1,U()}}}function Xp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function r(u){l(1,i=!0);const a=new FormData(u.target),c=new URLSearchParams;for(let p of a){const[b,v]=p;c.append(b,v)}let _=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),Ht.update(p=>(p.fwconsent=a.sf===!0?1:a.sf===!1?2:0,p.booting=_.reboot,p)),ri("/")}return t.$$set=u=>{"sysinfo"in u&&l(0,n=u.sysinfo)},[n,i,r]}class Zp extends Ee{constructor(e){super(),Pe(this,e,Xp,Qp,Ne,{sysinfo:0})}}function Jp(t){let e,l;return e=new jm({props:{data:t[1],sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&2&&(r.data=n[1]),i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function xp(t){let e,l;return e=new Sp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function e_(t){let e,l;return e=new Fp({props:{sysinfo:t[0],data:t[1]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),i&2&&(r.data=n[1]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function t_(t){let e,l;return e=new $r({props:{title:"CA",action:"/mqtt-ca"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function l_(t){let e,l;return e=new $r({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function n_(t){let e,l;return e=new $r({props:{title:"private key",action:"/mqtt-key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function i_(t){let e,l;return e=new Zp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function s_(t){let e,l;return e=new Vp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function r_(t){let e,l;return e=new Wp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function o_(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B;return e=new lm({props:{data:t[1]}}),n=new Sl({props:{path:"/",$$slots:{default:[Jp]},$$scope:{ctx:t}}}),r=new Sl({props:{path:"/configuration",$$slots:{default:[xp]},$$scope:{ctx:t}}}),a=new Sl({props:{path:"/status",$$slots:{default:[e_]},$$scope:{ctx:t}}}),f=new Sl({props:{path:"/mqtt-ca",$$slots:{default:[t_]},$$scope:{ctx:t}}}),p=new Sl({props:{path:"/mqtt-cert",$$slots:{default:[l_]},$$scope:{ctx:t}}}),v=new Sl({props:{path:"/mqtt-key",$$slots:{default:[n_]},$$scope:{ctx:t}}}),S=new Sl({props:{path:"/consent",$$slots:{default:[i_]},$$scope:{ctx:t}}}),T=new Sl({props:{path:"/setup",$$slots:{default:[s_]},$$scope:{ctx:t}}}),E=new Sl({props:{path:"/vendor",$$slots:{default:[r_]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment),l=h(),ie(n.$$.fragment),i=h(),ie(r.$$.fragment),u=h(),ie(a.$$.fragment),c=h(),ie(f.$$.fragment),_=h(),ie(p.$$.fragment),b=h(),ie(v.$$.fragment),d=h(),ie(S.$$.fragment),y=h(),ie(T.$$.fragment),N=h(),ie(E.$$.fragment)},m(P,L){le(e,P,L),M(P,l,L),le(n,P,L),M(P,i,L),le(r,P,L),M(P,u,L),le(a,P,L),M(P,c,L),le(f,P,L),M(P,_,L),le(p,P,L),M(P,b,L),le(v,P,L),M(P,d,L),le(S,P,L),M(P,y,L),le(T,P,L),M(P,N,L),le(E,P,L),B=!0},p(P,L){const O={};L&2&&(O.data=P[1]),e.$set(O);const F={};L&7&&(F.$$scope={dirty:L,ctx:P}),n.$set(F);const x={};L&5&&(x.$$scope={dirty:L,ctx:P}),r.$set(x);const H={};L&7&&(H.$$scope={dirty:L,ctx:P}),a.$set(H);const z={};L&4&&(z.$$scope={dirty:L,ctx:P}),f.$set(z);const G={};L&4&&(G.$$scope={dirty:L,ctx:P}),p.$set(G);const V={};L&4&&(V.$$scope={dirty:L,ctx:P}),v.$set(V);const W={};L&5&&(W.$$scope={dirty:L,ctx:P}),S.$set(W);const U={};L&5&&(U.$$scope={dirty:L,ctx:P}),T.$set(U);const K={};L&5&&(K.$$scope={dirty:L,ctx:P}),E.$set(K)},i(P){B||(D(e.$$.fragment,P),D(n.$$.fragment,P),D(r.$$.fragment,P),D(a.$$.fragment,P),D(f.$$.fragment,P),D(p.$$.fragment,P),D(v.$$.fragment,P),D(S.$$.fragment,P),D(T.$$.fragment,P),D(E.$$.fragment,P),B=!0)},o(P){q(e.$$.fragment,P),q(n.$$.fragment,P),q(r.$$.fragment,P),q(a.$$.fragment,P),q(f.$$.fragment,P),q(p.$$.fragment,P),q(v.$$.fragment,P),q(S.$$.fragment,P),q(T.$$.fragment,P),q(E.$$.fragment,P),B=!1},d(P){ne(e,P),P&&C(l),ne(n,P),P&&C(i),ne(r,P),P&&C(u),ne(a,P),P&&C(c),ne(f,P),P&&C(_),ne(p,P),P&&C(b),ne(v,P),P&&C(d),ne(S,P),P&&C(y),ne(T,P),P&&C(N),ne(E,P)}}}function a_(t){let e,l,n,i;const r=[c_,f_],u=[];function a(c,f){return c[0].trying?0:1}return e=a(t),l=u[e]=r[e](t),{c(){l.c(),n=Ve()},m(c,f){u[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?u[e].p(c,f):(De(),q(u[_],1,1,()=>{u[_]=null}),Ie(),l=u[e],l?l.p(c,f):(l=u[e]=r[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){u[e].d(c),c&&C(n)}}}function u_(t){let e,l;return e=new It({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function f_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function c_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function m_(t){let e,l,n,i,r,u;l=new Dc({props:{$$slots:{default:[o_]},$$scope:{ctx:t}}});const a=[u_,a_],c=[];function f(_,p){return _[0].upgrading?0:_[0].booting?1:-1}return~(i=f(t))&&(r=c[i]=a[i](t)),{c(){e=m("div"),ie(l.$$.fragment),n=h(),r&&r.c(),o(e,"class","container mx-auto m-3")},m(_,p){M(_,e,p),le(l,e,null),s(e,n),~i&&c[i].m(e,null),u=!0},p(_,[p]){const b={};p&7&&(b.$$scope={dirty:p,ctx:_}),l.$set(b);let v=i;i=f(_),i===v?~i&&c[i].p(_,p):(r&&(De(),q(c[v],1,1,()=>{c[v]=null}),Ie()),~i?(r=c[i],r?r.p(_,p):(r=c[i]=a[i](_),r.c()),D(r,1),r.m(e,null)):r=null)},i(_){u||(D(l.$$.fragment,_),D(r),u=!0)},o(_){q(l.$$.fragment,_),q(r),u=!1},d(_){_&&C(e),ne(l),~i&&c[i].d()}}}function p_(t,e,l){let n={};Ht.subscribe(r=>{l(0,n=r),n.vndcfg===!1?ri("/vendor"):n.usrcfg===!1?ri("/setup"):n.fwconsent===0&&ri("/consent")}),wr();let i={};return M1.subscribe(r=>{l(1,i=r)}),[n,i]}class __ extends Ee{constructor(e){super(),Pe(this,e,p_,m_,Ne,{})}}new __({target:document.getElementById("app")}); + `),d=m("input"),S=h(),y=m("div"),T=m("label"),N=m("input"),E=$(" Static IP"),B=h(),V&&V.c(),P=h(),W&&W.c(),L=h(),O=m("div"),O.innerHTML='',F=h(),ie(x.$$.fragment),o(i,"type","hidden"),o(i,"name","s"),i.value="true",o(u,"class","text-sm"),o(c,"class","my-3"),o(_,"class","my-3"),o(d,"name","sh"),o(d,"type","text"),o(d,"class","in-s"),o(d,"maxlength","32"),o(d,"pattern","[a-z0-9_-]+"),o(d,"placeholder","Optional, ex.: ams-reader"),o(d,"autocomplete","off"),o(N,"type","checkbox"),o(N,"name","sm"),N.__value="static",N.value=N.__value,o(N,"class","rounded mb-1"),o(y,"class","my-3"),o(O,"class","my-3"),o(l,"class","cnt"),o(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(U,K){M(U,e,K),s(e,l),s(l,n),s(n,i),s(n,r),s(n,u),s(n,a),s(n,c),s(n,f),s(n,_),s(n,p),s(n,b),s(b,v),s(b,d),te(d,t[0].hostname),s(n,S),s(n,y),s(y,T),s(T,N),N.checked=t[1],s(T,E),s(y,B),V&&V.m(y,null),s(n,P),W&&W.m(n,null),s(n,L),s(n,O),M(U,F,K),le(x,U,K),H=!0,z||(G=[ee(d,"input",t[4]),ee(N,"change",t[5]),ee(n,"submit",Ss(t[3]))],z=!0)},p(U,[K]){K&1&&d.value!==U[0].hostname&&te(d,U[0].hostname),K&2&&(N.checked=U[1]),U[1]?V?(V.p(U,K),K&2&&D(V,1)):(V=tc(U),V.c(),D(V,1),V.m(y,null)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),U[1]?W||(W=lc(),W.c(),W.m(n,L)):W&&(W.d(1),W=null);const j={};K&4&&(j.active=U[2]),x.$set(j)},i(U){H||(D(V),D(x.$$.fragment,U),H=!0)},o(U){q(V),q(x.$$.fragment,U),H=!1},d(U){U&&C(e),V&&V.d(),W&&W.d(),U&&C(F),ne(x,U),z=!1,ze(G)}}}function Gp(t,e,l){let{sysinfo:n={}}=e,i=!1,r=!1,u=0;function a(){var p="";u++;var b=function(){setTimeout(a,1e3)};if(n.net.ip&&u%3==0){if(!n.net.ip){b();return}p="http://"+n.net.ip}else n.hostname&&u%3==1?p="http://"+n.hostname:n.hostname&&u%3==2?p="http://"+n.hostname+".local":p="";console&&console.log("Trying url "+p),Rt.update(d=>(d.trying=p,d));var v=new XMLHttpRequest;v.timeout=5e3,v.addEventListener("abort",b),v.addEventListener("error",b),v.addEventListener("timeout",b),v.addEventListener("load",function(d){window.location.href=p||"/"}),v.open("GET",p+"/is-alive",!0),v.send()}async function c(p){l(2,r=!0);const b=new FormData(p.target),v=new URLSearchParams;for(let y of b){const[T,N]=y;v.append(T,N)}let S=await(await fetch("/save",{method:"POST",body:v})).json();l(2,r=!1),Rt.update(y=>(y.hostname=b.get("sh"),y.usrcfg=S.success,y.booting=S.reboot,i&&(y.net.ip=b.get("si"),y.net.mask=b.get("su"),y.net.gw=b.get("sg"),y.net.dns1=b.get("sd")),setTimeout(a,5e3),y))}function f(){n.hostname=this.value,l(0,n)}function _(){i=this.checked,l(1,i)}return t.$$set=p=>{"sysinfo"in p&&l(0,n=p.sysinfo)},[n,i,r,c,f,_]}class Vp extends Ee{constructor(e){super(),Pe(this,e,Gp,zp,Ne,{sysinfo:0})}}function Kp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T;return d=new It({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=$("Upload "),r=$(t[1]),u=h(),a=m("p"),a.textContent="Select a suitable file and click upload",c=h(),f=m("form"),_=m("input"),p=h(),b=m("div"),b.innerHTML='',v=h(),ie(d.$$.fragment),o(a,"class","mb-4"),o(_,"name","file"),o(_,"type","file"),o(b,"class","w-full text-right mt-4"),o(f,"action",t[0]),o(f,"enctype","multipart/form-data"),o(f,"method","post"),o(f,"autocomplete","off"),o(l,"class","cnt"),o(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(N,E){M(N,e,E),s(e,l),s(l,n),s(n,i),s(n,r),s(l,u),s(l,a),s(l,c),s(l,f),s(f,_),s(f,p),s(f,b),M(N,v,E),le(d,N,E),S=!0,y||(T=ee(f,"submit",t[3]),y=!0)},p(N,[E]){(!S||E&2)&&Z(r,N[1]),(!S||E&1)&&o(f,"action",N[0]);const B={};E&4&&(B.active=N[2]),d.$set(B)},i(N){S||(D(d.$$.fragment,N),S=!0)},o(N){q(d.$$.fragment,N),S=!1},d(N){N&&C(e),N&&C(v),ne(d,N),y=!1,T()}}}function Yp(t,e,l){let{action:n}=e,{title:i}=e,r=!1;const u=()=>l(2,r=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,r,u]}class $r extends Ee{constructor(e){super(),Pe(this,e,Yp,Kp,Ne,{action:0,title:1})}}function Qp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B,P,L,O,F,x,H,z,G,V,W,U;return G=new It({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:",r=h(),u=m("hr"),a=h(),c=m("div"),f=$("Enable one-click upgrade? (implies data collection)"),_=m("br"),p=h(),b=m("a"),v=$("Read more"),d=m("br"),S=h(),y=m("label"),T=m("input"),E=$(" Yes"),B=m("label"),P=m("input"),O=$(" No"),F=m("br"),x=h(),H=m("div"),H.innerHTML='',z=h(),ie(G.$$.fragment),o(b,"href",Ht("Data-collection-on-one-click-firmware-upgrade")),o(b,"target","_blank"),o(b,"class","text-blue-600 hover:text-blue-800"),o(T,"type","radio"),o(T,"name","sf"),T.value=1,T.checked=N=t[0].fwconsent===1,o(T,"class","rounded m-2"),T.required=!0,o(P,"type","radio"),o(P,"name","sf"),P.value=2,P.checked=L=t[0].fwconsent===2,o(P,"class","rounded m-2"),P.required=!0,o(c,"class","my-3"),o(H,"class","my-3"),o(n,"autocomplete","off"),o(l,"class","cnt"),o(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(K,j){M(K,e,j),s(e,l),s(l,n),s(n,i),s(n,r),s(n,u),s(n,a),s(n,c),s(c,f),s(c,_),s(c,p),s(c,b),s(b,v),s(c,d),s(c,S),s(c,y),s(y,T),s(y,E),s(c,B),s(B,P),s(B,O),s(c,F),s(n,x),s(n,H),M(K,z,j),le(G,K,j),V=!0,W||(U=ee(n,"submit",Ss(t[2])),W=!0)},p(K,[j]){(!V||j&1&&N!==(N=K[0].fwconsent===1))&&(T.checked=N),(!V||j&1&&L!==(L=K[0].fwconsent===2))&&(P.checked=L);const Y={};j&2&&(Y.active=K[1]),G.$set(Y)},i(K){V||(D(G.$$.fragment,K),V=!0)},o(K){q(G.$$.fragment,K),V=!1},d(K){K&&C(e),K&&C(z),ne(G,K),W=!1,U()}}}function Xp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function r(u){l(1,i=!0);const a=new FormData(u.target),c=new URLSearchParams;for(let p of a){const[b,v]=p;c.append(b,v)}let _=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),Rt.update(p=>(p.fwconsent=a.sf===!0?1:a.sf===!1?2:0,p.booting=_.reboot,p)),ri("/")}return t.$$set=u=>{"sysinfo"in u&&l(0,n=u.sysinfo)},[n,i,r]}class Zp extends Ee{constructor(e){super(),Pe(this,e,Xp,Qp,Ne,{sysinfo:0})}}function Jp(t){let e,l;return e=new jm({props:{data:t[1],sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&2&&(r.data=n[1]),i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function xp(t){let e,l;return e=new Sp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function e_(t){let e,l;return e=new Fp({props:{sysinfo:t[0],data:t[1]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),i&2&&(r.data=n[1]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function t_(t){let e,l;return e=new $r({props:{title:"CA",action:"/mqtt-ca"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function l_(t){let e,l;return e=new $r({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function n_(t){let e,l;return e=new $r({props:{title:"private key",action:"/mqtt-key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function i_(t){let e,l;return e=new Zp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function s_(t){let e,l;return e=new Vp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function r_(t){let e,l;return e=new Wp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.sysinfo=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function o_(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,T,N,E,B;return e=new lm({props:{data:t[1]}}),n=new Sl({props:{path:"/",$$slots:{default:[Jp]},$$scope:{ctx:t}}}),r=new Sl({props:{path:"/configuration",$$slots:{default:[xp]},$$scope:{ctx:t}}}),a=new Sl({props:{path:"/status",$$slots:{default:[e_]},$$scope:{ctx:t}}}),f=new Sl({props:{path:"/mqtt-ca",$$slots:{default:[t_]},$$scope:{ctx:t}}}),p=new Sl({props:{path:"/mqtt-cert",$$slots:{default:[l_]},$$scope:{ctx:t}}}),v=new Sl({props:{path:"/mqtt-key",$$slots:{default:[n_]},$$scope:{ctx:t}}}),S=new Sl({props:{path:"/consent",$$slots:{default:[i_]},$$scope:{ctx:t}}}),T=new Sl({props:{path:"/setup",$$slots:{default:[s_]},$$scope:{ctx:t}}}),E=new Sl({props:{path:"/vendor",$$slots:{default:[r_]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment),l=h(),ie(n.$$.fragment),i=h(),ie(r.$$.fragment),u=h(),ie(a.$$.fragment),c=h(),ie(f.$$.fragment),_=h(),ie(p.$$.fragment),b=h(),ie(v.$$.fragment),d=h(),ie(S.$$.fragment),y=h(),ie(T.$$.fragment),N=h(),ie(E.$$.fragment)},m(P,L){le(e,P,L),M(P,l,L),le(n,P,L),M(P,i,L),le(r,P,L),M(P,u,L),le(a,P,L),M(P,c,L),le(f,P,L),M(P,_,L),le(p,P,L),M(P,b,L),le(v,P,L),M(P,d,L),le(S,P,L),M(P,y,L),le(T,P,L),M(P,N,L),le(E,P,L),B=!0},p(P,L){const O={};L&2&&(O.data=P[1]),e.$set(O);const F={};L&7&&(F.$$scope={dirty:L,ctx:P}),n.$set(F);const x={};L&5&&(x.$$scope={dirty:L,ctx:P}),r.$set(x);const H={};L&7&&(H.$$scope={dirty:L,ctx:P}),a.$set(H);const z={};L&4&&(z.$$scope={dirty:L,ctx:P}),f.$set(z);const G={};L&4&&(G.$$scope={dirty:L,ctx:P}),p.$set(G);const V={};L&4&&(V.$$scope={dirty:L,ctx:P}),v.$set(V);const W={};L&5&&(W.$$scope={dirty:L,ctx:P}),S.$set(W);const U={};L&5&&(U.$$scope={dirty:L,ctx:P}),T.$set(U);const K={};L&5&&(K.$$scope={dirty:L,ctx:P}),E.$set(K)},i(P){B||(D(e.$$.fragment,P),D(n.$$.fragment,P),D(r.$$.fragment,P),D(a.$$.fragment,P),D(f.$$.fragment,P),D(p.$$.fragment,P),D(v.$$.fragment,P),D(S.$$.fragment,P),D(T.$$.fragment,P),D(E.$$.fragment,P),B=!0)},o(P){q(e.$$.fragment,P),q(n.$$.fragment,P),q(r.$$.fragment,P),q(a.$$.fragment,P),q(f.$$.fragment,P),q(p.$$.fragment,P),q(v.$$.fragment,P),q(S.$$.fragment,P),q(T.$$.fragment,P),q(E.$$.fragment,P),B=!1},d(P){ne(e,P),P&&C(l),ne(n,P),P&&C(i),ne(r,P),P&&C(u),ne(a,P),P&&C(c),ne(f,P),P&&C(_),ne(p,P),P&&C(b),ne(v,P),P&&C(d),ne(S,P),P&&C(y),ne(T,P),P&&C(N),ne(E,P)}}}function a_(t){let e,l,n,i;const r=[c_,f_],u=[];function a(c,f){return c[0].trying?0:1}return e=a(t),l=u[e]=r[e](t),{c(){l.c(),n=Ve()},m(c,f){u[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?u[e].p(c,f):(De(),q(u[_],1,1,()=>{u[_]=null}),Ie(),l=u[e],l?l.p(c,f):(l=u[e]=r[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){u[e].d(c),c&&C(n)}}}function u_(t){let e,l;return e=new It({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function f_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function c_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&1&&(r.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function m_(t){let e,l,n,i,r,u;l=new Dc({props:{$$slots:{default:[o_]},$$scope:{ctx:t}}});const a=[u_,a_],c=[];function f(_,p){return _[0].upgrading?0:_[0].booting?1:-1}return~(i=f(t))&&(r=c[i]=a[i](t)),{c(){e=m("div"),ie(l.$$.fragment),n=h(),r&&r.c(),o(e,"class","container mx-auto m-3")},m(_,p){M(_,e,p),le(l,e,null),s(e,n),~i&&c[i].m(e,null),u=!0},p(_,[p]){const b={};p&7&&(b.$$scope={dirty:p,ctx:_}),l.$set(b);let v=i;i=f(_),i===v?~i&&c[i].p(_,p):(r&&(De(),q(c[v],1,1,()=>{c[v]=null}),Ie()),~i?(r=c[i],r?r.p(_,p):(r=c[i]=a[i](_),r.c()),D(r,1),r.m(e,null)):r=null)},i(_){u||(D(l.$$.fragment,_),D(r),u=!0)},o(_){q(l.$$.fragment,_),q(r),u=!1},d(_){_&&C(e),ne(l),~i&&c[i].d()}}}function p_(t,e,l){let n={};Rt.subscribe(r=>{l(0,n=r),n.vndcfg===!1?ri("/vendor"):n.usrcfg===!1?ri("/setup"):n.fwconsent===0&&ri("/consent")}),wr();let i={};return M1.subscribe(r=>{l(1,i=r)}),[n,i]}class __ extends Ee{constructor(e){super(),Pe(this,e,p_,m_,Ne,{})}}new __({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/VendorPanel.svelte b/lib/SvelteUi/app/src/lib/VendorPanel.svelte index 10e71f34..ce6ae8b2 100644 --- a/lib/SvelteUi/app/src/lib/VendorPanel.svelte +++ b/lib/SvelteUi/app/src/lib/VendorPanel.svelte @@ -33,9 +33,12 @@ } let cc = false; - $: { + sysinfoStore.subscribe(update => { + sysinfo = update; + if(update.fwconsent === 1) { cc = !sysinfo.usrcfg; - } + } + });