diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index 70cad578..8f07b01d 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,6 +1,6 @@ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function ne(){}function Jt(t,e){for(const l in e)t[l]=e[l];return t}function Vf(t){return t()}function Ar(){return Object.create(null)}function Ke(t){t.forEach(Vf)}function so(t){return typeof t=="function"}function $e(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let fs;function Bc(t,e){return fs||(fs=document.createElement("a")),fs.href=e,t===fs.href}function zc(t){return Object.keys(t).length===0}function oo(t,...e){if(t==null)return ne;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ui(t){let e;return oo(t,l=>e=l)(),e}function rl(t,e,l){t.$$.on_destroy.push(oo(e,l))}function uo(t,e,l,n){if(t){const i=Kf(t,e,l,n);return t[0](i)}}function Kf(t,e,l,n){return t[1]&&n?Jt(l.ctx.slice(),t[1](n(e))):l.ctx}function ro(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],r=Math.max(e.dirty.length,i.length);for(let a=0;a32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function ws(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const Vc=["width","height"];function ri(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&&Vc.indexOf(n)===-1?t[n]=e[n]:u(t,n,e[n])}function fe(t){return t===""?null:+t}function Kc(t){return Array.from(t.childNodes)}function G(t,e){e=""+e,t.data!==e&&(t.data=e)}function Qc(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Xc(t,e,l){~Yc.indexOf(l)?Qc(t,e):G(t,e)}function V(t,e){t.value=e??""}function Qf(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Le(t,e,l){for(let n=0;n{r.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=K(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),k(n)}}function xc(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function Dr(t,e){return new t(e)}let $i;function yi(t){$i=t}function Ti(){if(!$i)throw new Error("Function called outside component initialization");return $i}function e1(t){Ti().$$.on_mount.push(t)}function t1(t){Ti().$$.on_destroy.push(t)}function l1(){const t=Ti();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=xc(e,l,{cancelable:n});return i.slice().forEach(r=>{r.call(t,o)}),!o.defaultPrevented}return!0}}function Ci(t,e){return Ti().$$.context.set(t,e),e}function Ol(t){return Ti().$$.context.get(t)}const ni=[],hs=[];let ii=[];const Er=[],Xf=Promise.resolve();let Vs=!1;function Zf(){Vs||(Vs=!0,Xf.then(Jf))}function n1(){return Zf(),Xf}function lt(t){ii.push(t)}const js=new Set;let ti=0;function Jf(){if(ti!==0)return;const t=$i;do{try{for(;tit.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),ii=e}const _s=new Set;let on;function Ae(){on={r:0,c:[],p:on}}function De(){on.r||Ke(on.c),on=on.p}function N(t,e){t&&t.i&&(_s.delete(t),t.i(e))}function D(t,e,l,n){if(t&&t.o){if(_s.has(t))return;_s.add(t),on.c.push(()=>{_s.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function xf(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const r=t[o],a=e[o];if(a){for(const f in r)f in a||(n[f]=1);for(const f in a)i[f]||(l[f]=a[f],i[f]=1);t[o]=a}else for(const f in r)i[f]=1}for(const r in n)r in l||(l[r]=void 0);return l}function Ir(t){return typeof t=="object"&&t!==null?t:{}}function Z(t){t&&t.c()}function Q(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||lt(()=>{const r=t.$$.on_mount.map(Vf).filter(so);t.$$.on_destroy?t.$$.on_destroy.push(...r):Ke(r),t.$$.on_mount=[]}),o.forEach(lt)}function X(t,e){const l=t.$$;l.fragment!==null&&(s1(l.after_update),Ke(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function o1(t,e){t.$$.dirty[0]===-1&&(ni.push(t),Zf(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const v=d.length?d[0]:b;return c.ctx&&i(c.ctx[_],c.ctx[_]=v)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](v),p&&o1(t,_)),b}):[],c.update(),p=!0,Ke(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=Kc(e.target);c.fragment&&c.fragment.l(_),_.forEach(k)}else c.fragment&&c.fragment.c();e.intro&&N(t.$$.fragment),Q(t,e.target,e.anchor,e.customElement),Jf()}yi(f)}class Me{$destroy(){X(this,1),this.$destroy=ne}$on(e,l){if(!so(l))return ne;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!zc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Fr=t=>typeof t>"u",ec=t=>typeof t=="function",tc=t=>typeof t=="number";function u1(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function lc(){let t=0;return()=>t++}function r1(){return Math.random().toString(36).substring(2)}const ql=typeof window>"u";function nc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const ic=(t,e)=>t?{}:{style:e},Ks=t=>({"aria-hidden":"true",...ic(t,"display:none;")}),li=[];function sc(t,e){return{subscribe:rt(t,e).subscribe}}function rt(t,e=ne){let l;const n=new Set;function i(a){if($e(t,a)&&(t=a,l)){const f=!li.length;for(const c of n)c[1](),li.push(c,t);if(f){for(let c=0;c{n.delete(c),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:r}}function a1(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return sc(l,r=>{let a=!1;const f=[];let c=0,p=ne;const _=()=>{if(c)return;p();const d=e(n?f[0]:f,r);o?r(d):p=so(d)?d:ne},b=i.map((d,v)=>oo(d,g=>{f[v]=g,c&=~(1<{c|=1<`@@svnav-ctx__${t}`,Qs=Si("LOCATION"),ai=Si("ROUTER"),oc=Si("ROUTE"),f1=Si("ROUTE_PARAMS"),c1=Si("FOCUS_ELEM"),uc=/^:(.+)/,wi=(t,e,l)=>t.substr(e,l),Xs=(t,e)=>wi(t,0,e.length)===e,m1=t=>t==="",p1=t=>uc.test(t),rc=t=>t[0]==="*",_1=t=>t.replace(/\*.*$/,""),ac=t=>t.replace(/(^\/+|\/+$)/g,"");function ml(t,e=!1){const l=ac(t).split("/");return e?l.filter(Boolean):l}const Ws=(t,e)=>t+(e?`?${e}`:""),co=t=>`/${ac(t)}`;function Mi(...t){const e=n=>ml(n,!0).join("/"),l=t.map(e).join("/");return co(l)}const mo=1,ys=2,fn=3,d1=4,fc=5,v1=6,cc=7,h1=8,b1=9,mc=10,pc=11,g1={[mo]:"Link",[ys]:"Route",[fn]:"Router",[d1]:"useFocus",[fc]:"useLocation",[v1]:"useMatch",[cc]:"useNavigate",[h1]:"useParams",[b1]:"useResolvable",[mc]:"useResolve",[pc]:"navigate"},po=t=>g1[t];function k1(t,e){let l;return t===ys?l=e.path?`path="${e.path}"`:"default":t===mo?l=`to="${e.to}"`:t===fn&&(l=`basepath="${e.basepath||""}"`),`<${po(t)} ${l||""} />`}function w1(t,e,l,n){const i=l&&k1(n||t,l),o=i?` -Occurred in: ${i}`:"",r=po(t),a=ec(e)?e(r):e;return`<${r}> ${a}${o}`}const _c=t=>(...e)=>t(w1(...e)),dc=_c(t=>{throw new Error(t)}),bs=_c(console.warn),Rr=4,y1=3,C1=2,$1=1,T1=1;function S1(t,e){const l=t.default?0:ml(t.fullPath).reduce((n,i)=>{let o=n;return o+=Rr,m1(i)?o+=T1:p1(i)?o+=C1:rc(i)?o-=Rr+$1:o+=y1,o},0);return{route:t,score:l,index:e}}function M1(t){return t.map(S1).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function vc(t,e){let l,n;const[i]=e.split("?"),o=ml(i),r=o[0]==="",a=M1(t);for(let f=0,c=a.length;f({...p,params:b,uri:C});if(p.default){n=d(e);continue}const v=ml(p.fullPath),g=Math.max(o.length,v.length);let T=0;for(;T{c===".."?f.pop():c!=="."&&f.push(c)}),Ws(`/${f.join("/")}`,n)}function Lr(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,r=ml(e,!0),a=ml(l,!0);for(;r.length;)r[0]!==a[0]&&dc(fn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),r.shift(),a.shift();return{pathname:Mi(...a),hash:n,search:i,state:o}}const Ur=t=>t.length===1?"":t,_o=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Ur(wi(t,l)):"",r=i?wi(t,0,l):t,a=n?Ur(wi(r,e)):"";return{pathname:(n?wi(r,0,e):r)||"/",search:a,hash:o}},P1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function A1(t,e,l){return Mi(l,N1(t,e))}function D1(t,e){const l=co(_1(t)),n=ml(l,!0),i=ml(e,!0).slice(0,n.length),o=hc({fullPath:l},Mi(...i));return o&&o.uri}const Gs="POP",E1="PUSH",I1="REPLACE";function Bs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function F1(t){let e=[],l=Bs(t),n=Gs;const i=(o=e)=>o.forEach(r=>r({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const r=()=>{l=Bs(t),n=Gs,i([o])};i([o]);const a=nc(t,"popstate",r);return()=>{a(),e=e.filter(f=>f!==o)}},navigate(o,r){const{state:a={},replace:f=!1}=r||{};if(n=f?I1:E1,tc(o))r&&bs(pc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Gs,t.history.go(o);else{const c={...a,_key:r1()};try{t.history[f?"replaceState":"pushState"](c,"",o)}catch{t.location[f?"replace":"assign"](o)}}l=Bs(t),i()}}}function zs(t,e){return{..._o(e),state:t}}function R1(t="/"){let e=0,l=[zs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(zs(n,o))},replaceState(n,i,o){l[e]=zs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const L1=!!(!ql&&window.document&&window.document.createElement),U1=!ql&&window.location.origin==="null",bc=F1(L1&&!U1?window:R1()),{navigate:si}=bc;let Sl=null,gc=!0;function O1(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nSl.level||t.level===Sl.level&&O1(t.routerId,Sl.routerId))&&(Sl=t)}function H1(){Sl=null}function j1(){gc=!1}function Or(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=nc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function W1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function G1(t){return/^H[1-6]$/i.test(t.tagName)}function qr(t,e=document){return e.querySelector(t)}function B1(t){let l=qr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!W1(l,t);){if(G1(l))return l;const n=qr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function z1(t){Promise.resolve(ui(t.focusElement)).then(e=>{const l=e||B1(t.id);l||bs(fn,`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,ys),!Or(l)&&Or(document.documentElement)})}const Y1=(t,e,l)=>(n,i)=>n1().then(()=>{if(!Sl||gc){j1();return}if(n&&z1(Sl.route),t.announcements&&i){const{path:o,fullPath:r,meta:a,params:f,uri:c}=Sl.route,p=t.createAnnouncement({path:o,fullPath:r,meta:a,params:f,uri:c},ui(l));Promise.resolve(p).then(_=>{e.set(_)})}H1()}),V1="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 K1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},ic(t[6],V1)],i={};for(let o=0;o`Navigated to ${le.uri}`,announcements:!0,...v},C=p,$=co(p),M=Ol(Qs),E=Ol(ai),S=!M,A=X1(),I=d&&!(E&&!E.manageFocus),F=rt("");rl(t,F,le=>l(0,a=le));const Y=E?E.disableInlineStyles:g,U=rt([]);rl(t,U,le=>l(20,r=le));const H=rt(null);rl(t,H,le=>l(18,i=le));let q=!1;const z=S?0:E.level+1,R=S?rt((()=>Lr(ql?_o(_):b.location,$))()):M;rl(t,R,le=>l(17,n=le));const B=rt(n);rl(t,B,le=>l(19,o=le));const L=Y1(T,F,R),j=le=>pe=>pe.filter(ie=>ie.id!==le);function W(le){if(ql){if(q)return;const pe=hc(le,n.pathname);if(pe)return q=!0,pe}else U.update(pe=>{const ie=j(le.id)(pe);return ie.push(le),ie})}function te(le){U.update(j(le))}return!S&&p!==Hr&&bs(fn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),S&&(e1(()=>b.listen(pe=>{const ie=Lr(pe.location,$);B.set(n),R.set(ie)})),Ci(Qs,R)),Ci(ai,{activeRoute:H,registerRoute:W,unregisterRoute:te,manageFocus:I,level:z,id:A,history:S?b:E.history,basepath:S?$:E.basepath,disableInlineStyles:Y}),t.$$set=le=>{"basepath"in le&&l(11,p=le.basepath),"url"in le&&l(12,_=le.url),"history"in le&&l(13,b=le.history),"primary"in le&&l(14,d=le.primary),"a11y"in le&&l(15,v=le.a11y),"disableInlineStyles"in le&&l(16,g=le.disableInlineStyles),"$$scope"in le&&l(21,c=le.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==C&&bs(fn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const le=vc(r,n.pathname);H.set(le)}if(t.$$.dirty[0]&655360&&S){const le=!!n.hash,pe=!le&&I,ie=!le||n.pathname!==o.pathname;L(pe,ie)}t.$$.dirty[0]&262144&&I&&i&&i.primary&&q1({level:z,routerId:A,route:i})},[a,T,S,A,I,F,Y,U,H,R,B,p,_,b,d,v,g,n,i,o,r,c,f]}class J1 extends Me{constructor(e){super(),Se(this,e,Z1,Q1,$e,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const kc=J1;function Ni(t,e,l=ai,n=fn){Ol(l)||dc(t,o=>`You cannot use ${o} outside of a ${po(n)}.`,e)}const x1=t=>{const{subscribe:e}=Ol(t);return{subscribe:e}};function wc(){return Ni(fc),x1(Qs)}function yc(){const{history:t}=Ol(ai);return t}function Cc(){const t=Ol(oc);return t?a1(t,e=>e.base):rt("/")}function $c(){Ni(mc);const t=Cc(),{basepath:e}=Ol(ai);return n=>A1(n,ui(t),e)}function em(){Ni(cc);const t=$c(),{navigate:e}=yc();return(n,i)=>{const o=tc(n)?n:t(n);return e(o,i)}}const tm=t=>({params:t&16,location:t&8}),jr=t=>({params:ql?ui(t[10]):t[4],location:t[3],navigate:t[11]});function Wr(t){let e,l;return e=new kc({props:{primary:t[1],$$slots:{default:[im]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function lm(t){let e;const l=t[18].default,n=uo(l,t,t[19],jr);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&ao(n,l,i,i[19],e?ro(l,i[19],o,tm):fo(i[19]),jr)},i(i){e||(N(n,i),e=!0)},o(i){D(n,i),e=!1},d(i){n&&n.d(i)}}}function nm(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},ql?ui(t[10]):t[4],t[12]];var o=t[0];function r(a){let f={};for(let c=0;c{X(p,1)}),De()}o?(e=Dr(o,r()),Z(e.$$.fragment),N(e.$$.fragment,1),Q(e,l.parentNode,l)):e=null}else o&&e.$set(c)},i(a){n||(e&&N(e.$$.fragment,a),n=!0)},o(a){e&&D(e.$$.fragment,a),n=!1},d(a){a&&k(l),e&&X(e,a)}}}function im(t){let e,l,n,i;const o=[nm,lm],r=[];function a(f,c){return f[0]!==null?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),w(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?r[e].p(f,c):(Ae(),D(r[p],1,1,()=>{r[p]=null}),De(),l=r[e],l?l.p(f,c):(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&k(n)}}}function sm(t){let e,l,n,i,o,r=[Ks(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let _=0;_{f=null}),De())},i(_){o||(N(f),o=!0)},o(_){D(f),o=!1},d(_){_&&k(e),_&&k(l),f&&f.d(_),_&&k(n),_&&k(i)}}}const om=lc();function um(t,e,l){let n;const i=["path","component","meta","primary"];let o=vs(e,i),r,a,f,c,{$$slots:p={},$$scope:_}=e,{path:b=""}=e,{component:d=null}=e,{meta:v={}}=e,{primary:g=!0}=e;Ni(ys,e);const T=om(),{registerRoute:C,unregisterRoute:$,activeRoute:M,disableInlineStyles:E}=Ol(ai);rl(t,M,q=>l(16,r=q));const S=Cc();rl(t,S,q=>l(17,f=q));const A=wc();rl(t,A,q=>l(3,a=q));const I=rt(null);let F;const Y=rt(),U=rt({});rl(t,U,q=>l(4,c=q)),Ci(oc,Y),Ci(f1,U),Ci(c1,I);const H=em();return ql||t1(()=>$(T)),t.$$set=q=>{l(24,e=Jt(Jt({},e),ds(q))),l(12,o=vs(e,i)),"path"in q&&l(13,b=q.path),"component"in q&&l(0,d=q.component),"meta"in q&&l(14,v=q.meta),"primary"in q&&l(1,g=q.primary),"$$scope"in q&&l(19,_=q.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const q=b==="",z=Mi(f,b),O={id:T,path:b,meta:v,default:q,fullPath:q?"":z,base:q?f:D1(z,a.pathname),primary:g,focusElement:I};Y.set(O),l(15,F=C(O))}if(t.$$.dirty&98304&&l(2,n=!!(F||r&&r.id===T)),t.$$.dirty&98308&&n){const{params:q}=F||r;U.set(q)}},e=ds(e),[d,g,n,a,c,T,M,E,S,A,U,H,o,b,v,F,r,f,p,_]}class rm extends Me{constructor(e){super(),Se(this,e,um,sm,$e,{path:13,component:0,meta:14,primary:1})}}const Tl=rm;function am(t){let e,l,n,i;const o=t[13].default,r=uo(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],f={};for(let c=0;cl(11,_=I));const M=l1(),E=$c(),{navigate:S}=yc();function A(I){M("click",I),u1(I)&&(I.preventDefault(),S(n,{state:T,replace:r||g}))}return t.$$set=I=>{l(19,e=Jt(Jt({},e),ds(I))),l(18,p=vs(e,c)),"to"in I&&l(5,v=I.to),"replace"in I&&l(6,g=I.replace),"state"in I&&l(7,T=I.state),"getProps"in I&&l(8,C=I.getProps),"$$scope"in I&&l(12,d=I.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=E(v,_)),t.$$.dirty&2049&&l(10,i=Xs(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(r=_o(n)===P1(_)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,f=(()=>{if(ec(C)){const I=C({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...I}}return p})())},e=ds(e),[n,f,a,$,A,v,g,T,C,o,i,_,d,b]}class cm extends Me{constructor(e){super(),Se(this,e,fm,am,$e,{to:5,replace:6,state:7,getProps:8})}}const Ul=cm;let Zs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ll(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function mm(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Tc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function pm(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function gs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return""}}function Ee(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function ce(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"µHAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Gr(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 Br(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 zr(t){switch(t){case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function oi(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ye(t,e){return t==1||t==2&&e}function Ot(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function me(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function al(t,e){return t.setTime(t.getTime()+e*36e5),t}function Yr(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}async function Hl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let ul={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 qt=rt(ul);async function vo(){ul=await(await Hl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),qt.set(ul)}let ms=0,Vr=-127,Kr=null,_m={};const dm=sc(_m,t=>{let e;async function l(){Hl("/data.json").then(n=>n.json()).then(n=>{t(n),Vr!=n.t&&(Vr=n.t,setTimeout(Ac,2e3)),Kr==null&&n.pe&&n.p&&(Kr=n.p,Mc()),ul.upgrading?window.location.reload():(!ul||!ul.chip||ul.booting||ms>1&&!oi(ul.board))&&(vo(),un&&clearTimeout(un),un=setTimeout(bo,2e3),rn&&clearTimeout(rn),rn=setTimeout(go,3e3));let i=5e3;if(oi(ul.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),ms=0}).catch(n=>{ms++,ms>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,oi(ul.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Js={};const ho=rt(Js);async function Sc(){let t=!1;ho.update(l=>{for(var n=0;n<36;n++){if(l[Ee(n)]==null){t=n<12;break}l[Ee(n)]=l[Ee(n+1)]}return l}),t&&Mc(),setTimeout(Sc,(60-new Date().getMinutes())*6e4)}async function Mc(){Js=await(await Hl("/energyprice.json")).json(),ho.set(Js),setTimeout(Sc,(60-new Date().getMinutes())*6e4)}let xs={},un;async function bo(){un&&(clearTimeout(un),un=0),xs=await(await Hl("/dayplot.json")).json(),Nc.set(xs),un=setTimeout(bo,(60-new Date().getMinutes())*6e4+20)}const Nc=rt(xs,t=>(bo(),function(){}));let eo={},rn;async function go(){rn&&(clearTimeout(rn),rn=0),eo=await(await Hl("/monthplot.json")).json(),Pc.set(eo),rn=setTimeout(go,(24-new Date().getHours())*36e5+40)}const Pc=rt(eo,t=>(go(),function(){}));let to={};async function Ac(){to=await(await Hl("/temperature.json")).json(),Dc.set(to)}const Dc=rt(to,t=>(Ac(),function(){}));let lo={},ps;async function Ec(){ps&&(clearTimeout(ps),ps=0),lo=await(await Hl("/tariff.json")).json(),Ic.set(lo),ps=setTimeout(Ec,(60-new Date().getMinutes())*6e4+30)}const Ic=rt(lo,t=>function(){});let no=[];const ko=rt(no);async function vm(){no=await(await Hl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),ko.set(no)}function ks(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 Fc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Rc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),r=[...e];r.reverse();let a,f,c;for(let p=0;po&&(a=_):g==i+1&&(f=_);else if(v==n+1)if(c){let C=c.tag_name.substring(1).split(".");parseInt(C[0]);let $=parseInt(C[1]);parseInt(C[2]),g==$&&(c=_)}else c=_}return f||c||a||!1}else return e[0]}const hm="/github.svg";function Qr(t){let e,l;function n(r,a){return r[1]>1?$m:r[1]>0?Cm:r[2]>1?ym:r[2]>0?wm:r[3]>1?km:r[3]>0?gm:bm}let i=n(t),o=i(t);return{c(){e=y(`Up +Occurred in: ${i}`:"",r=po(t),a=ec(e)?e(r):e;return`<${r}> ${a}${o}`}const _c=t=>(...e)=>t(w1(...e)),dc=_c(t=>{throw new Error(t)}),bs=_c(console.warn),Rr=4,y1=3,C1=2,$1=1,T1=1;function S1(t,e){const l=t.default?0:ml(t.fullPath).reduce((n,i)=>{let o=n;return o+=Rr,m1(i)?o+=T1:p1(i)?o+=C1:rc(i)?o-=Rr+$1:o+=y1,o},0);return{route:t,score:l,index:e}}function M1(t){return t.map(S1).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function vc(t,e){let l,n;const[i]=e.split("?"),o=ml(i),r=o[0]==="",a=M1(t);for(let f=0,c=a.length;f({...p,params:b,uri:C});if(p.default){n=d(e);continue}const v=ml(p.fullPath),g=Math.max(o.length,v.length);let T=0;for(;T{c===".."?f.pop():c!=="."&&f.push(c)}),Ws(`/${f.join("/")}`,n)}function Lr(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,r=ml(e,!0),a=ml(l,!0);for(;r.length;)r[0]!==a[0]&&dc(fn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),r.shift(),a.shift();return{pathname:Mi(...a),hash:n,search:i,state:o}}const Ur=t=>t.length===1?"":t,_o=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Ur(wi(t,l)):"",r=i?wi(t,0,l):t,a=n?Ur(wi(r,e)):"";return{pathname:(n?wi(r,0,e):r)||"/",search:a,hash:o}},P1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function A1(t,e,l){return Mi(l,N1(t,e))}function D1(t,e){const l=co(_1(t)),n=ml(l,!0),i=ml(e,!0).slice(0,n.length),o=hc({fullPath:l},Mi(...i));return o&&o.uri}const Gs="POP",E1="PUSH",I1="REPLACE";function Bs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function F1(t){let e=[],l=Bs(t),n=Gs;const i=(o=e)=>o.forEach(r=>r({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const r=()=>{l=Bs(t),n=Gs,i([o])};i([o]);const a=nc(t,"popstate",r);return()=>{a(),e=e.filter(f=>f!==o)}},navigate(o,r){const{state:a={},replace:f=!1}=r||{};if(n=f?I1:E1,tc(o))r&&bs(pc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Gs,t.history.go(o);else{const c={...a,_key:r1()};try{t.history[f?"replaceState":"pushState"](c,"",o)}catch{t.location[f?"replace":"assign"](o)}}l=Bs(t),i()}}}function zs(t,e){return{..._o(e),state:t}}function R1(t="/"){let e=0,l=[zs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(zs(n,o))},replaceState(n,i,o){l[e]=zs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const L1=!!(!ql&&window.document&&window.document.createElement),U1=!ql&&window.location.origin==="null",bc=F1(L1&&!U1?window:R1()),{navigate:si}=bc;let Sl=null,gc=!0;function O1(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nSl.level||t.level===Sl.level&&O1(t.routerId,Sl.routerId))&&(Sl=t)}function H1(){Sl=null}function j1(){gc=!1}function Or(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=nc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function W1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function G1(t){return/^H[1-6]$/i.test(t.tagName)}function qr(t,e=document){return e.querySelector(t)}function B1(t){let l=qr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!W1(l,t);){if(G1(l))return l;const n=qr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function z1(t){Promise.resolve(ui(t.focusElement)).then(e=>{const l=e||B1(t.id);l||bs(fn,`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,ys),!Or(l)&&Or(document.documentElement)})}const Y1=(t,e,l)=>(n,i)=>n1().then(()=>{if(!Sl||gc){j1();return}if(n&&z1(Sl.route),t.announcements&&i){const{path:o,fullPath:r,meta:a,params:f,uri:c}=Sl.route,p=t.createAnnouncement({path:o,fullPath:r,meta:a,params:f,uri:c},ui(l));Promise.resolve(p).then(_=>{e.set(_)})}H1()}),V1="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 K1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},ic(t[6],V1)],i={};for(let o=0;o`Navigated to ${le.uri}`,announcements:!0,...v},C=p,$=co(p),M=Ol(Qs),E=Ol(ai),S=!M,A=X1(),I=d&&!(E&&!E.manageFocus),F=rt("");rl(t,F,le=>l(0,a=le));const Y=E?E.disableInlineStyles:g,U=rt([]);rl(t,U,le=>l(20,r=le));const H=rt(null);rl(t,H,le=>l(18,i=le));let q=!1;const z=S?0:E.level+1,R=S?rt((()=>Lr(ql?_o(_):b.location,$))()):M;rl(t,R,le=>l(17,n=le));const B=rt(n);rl(t,B,le=>l(19,o=le));const L=Y1(T,F,R),j=le=>pe=>pe.filter(ie=>ie.id!==le);function W(le){if(ql){if(q)return;const pe=hc(le,n.pathname);if(pe)return q=!0,pe}else U.update(pe=>{const ie=j(le.id)(pe);return ie.push(le),ie})}function te(le){U.update(j(le))}return!S&&p!==Hr&&bs(fn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),S&&(e1(()=>b.listen(pe=>{const ie=Lr(pe.location,$);B.set(n),R.set(ie)})),Ci(Qs,R)),Ci(ai,{activeRoute:H,registerRoute:W,unregisterRoute:te,manageFocus:I,level:z,id:A,history:S?b:E.history,basepath:S?$:E.basepath,disableInlineStyles:Y}),t.$$set=le=>{"basepath"in le&&l(11,p=le.basepath),"url"in le&&l(12,_=le.url),"history"in le&&l(13,b=le.history),"primary"in le&&l(14,d=le.primary),"a11y"in le&&l(15,v=le.a11y),"disableInlineStyles"in le&&l(16,g=le.disableInlineStyles),"$$scope"in le&&l(21,c=le.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==C&&bs(fn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const le=vc(r,n.pathname);H.set(le)}if(t.$$.dirty[0]&655360&&S){const le=!!n.hash,pe=!le&&I,ie=!le||n.pathname!==o.pathname;L(pe,ie)}t.$$.dirty[0]&262144&&I&&i&&i.primary&&q1({level:z,routerId:A,route:i})},[a,T,S,A,I,F,Y,U,H,R,B,p,_,b,d,v,g,n,i,o,r,c,f]}class J1 extends Me{constructor(e){super(),Se(this,e,Z1,Q1,$e,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const kc=J1;function Ni(t,e,l=ai,n=fn){Ol(l)||dc(t,o=>`You cannot use ${o} outside of a ${po(n)}.`,e)}const x1=t=>{const{subscribe:e}=Ol(t);return{subscribe:e}};function wc(){return Ni(fc),x1(Qs)}function yc(){const{history:t}=Ol(ai);return t}function Cc(){const t=Ol(oc);return t?a1(t,e=>e.base):rt("/")}function $c(){Ni(mc);const t=Cc(),{basepath:e}=Ol(ai);return n=>A1(n,ui(t),e)}function em(){Ni(cc);const t=$c(),{navigate:e}=yc();return(n,i)=>{const o=tc(n)?n:t(n);return e(o,i)}}const tm=t=>({params:t&16,location:t&8}),jr=t=>({params:ql?ui(t[10]):t[4],location:t[3],navigate:t[11]});function Wr(t){let e,l;return e=new kc({props:{primary:t[1],$$slots:{default:[im]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function lm(t){let e;const l=t[18].default,n=uo(l,t,t[19],jr);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&ao(n,l,i,i[19],e?ro(l,i[19],o,tm):fo(i[19]),jr)},i(i){e||(N(n,i),e=!0)},o(i){D(n,i),e=!1},d(i){n&&n.d(i)}}}function nm(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},ql?ui(t[10]):t[4],t[12]];var o=t[0];function r(a){let f={};for(let c=0;c{X(p,1)}),De()}o?(e=Dr(o,r()),Z(e.$$.fragment),N(e.$$.fragment,1),Q(e,l.parentNode,l)):e=null}else o&&e.$set(c)},i(a){n||(e&&N(e.$$.fragment,a),n=!0)},o(a){e&&D(e.$$.fragment,a),n=!1},d(a){a&&k(l),e&&X(e,a)}}}function im(t){let e,l,n,i;const o=[nm,lm],r=[];function a(f,c){return f[0]!==null?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),w(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?r[e].p(f,c):(Ae(),D(r[p],1,1,()=>{r[p]=null}),De(),l=r[e],l?l.p(f,c):(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&k(n)}}}function sm(t){let e,l,n,i,o,r=[Ks(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let _=0;_{f=null}),De())},i(_){o||(N(f),o=!0)},o(_){D(f),o=!1},d(_){_&&k(e),_&&k(l),f&&f.d(_),_&&k(n),_&&k(i)}}}const om=lc();function um(t,e,l){let n;const i=["path","component","meta","primary"];let o=vs(e,i),r,a,f,c,{$$slots:p={},$$scope:_}=e,{path:b=""}=e,{component:d=null}=e,{meta:v={}}=e,{primary:g=!0}=e;Ni(ys,e);const T=om(),{registerRoute:C,unregisterRoute:$,activeRoute:M,disableInlineStyles:E}=Ol(ai);rl(t,M,q=>l(16,r=q));const S=Cc();rl(t,S,q=>l(17,f=q));const A=wc();rl(t,A,q=>l(3,a=q));const I=rt(null);let F;const Y=rt(),U=rt({});rl(t,U,q=>l(4,c=q)),Ci(oc,Y),Ci(f1,U),Ci(c1,I);const H=em();return ql||t1(()=>$(T)),t.$$set=q=>{l(24,e=Jt(Jt({},e),ds(q))),l(12,o=vs(e,i)),"path"in q&&l(13,b=q.path),"component"in q&&l(0,d=q.component),"meta"in q&&l(14,v=q.meta),"primary"in q&&l(1,g=q.primary),"$$scope"in q&&l(19,_=q.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const q=b==="",z=Mi(f,b),O={id:T,path:b,meta:v,default:q,fullPath:q?"":z,base:q?f:D1(z,a.pathname),primary:g,focusElement:I};Y.set(O),l(15,F=C(O))}if(t.$$.dirty&98304&&l(2,n=!!(F||r&&r.id===T)),t.$$.dirty&98308&&n){const{params:q}=F||r;U.set(q)}},e=ds(e),[d,g,n,a,c,T,M,E,S,A,U,H,o,b,v,F,r,f,p,_]}class rm extends Me{constructor(e){super(),Se(this,e,um,sm,$e,{path:13,component:0,meta:14,primary:1})}}const Tl=rm;function am(t){let e,l,n,i;const o=t[13].default,r=uo(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],f={};for(let c=0;cl(11,_=I));const M=l1(),E=$c(),{navigate:S}=yc();function A(I){M("click",I),u1(I)&&(I.preventDefault(),S(n,{state:T,replace:r||g}))}return t.$$set=I=>{l(19,e=Jt(Jt({},e),ds(I))),l(18,p=vs(e,c)),"to"in I&&l(5,v=I.to),"replace"in I&&l(6,g=I.replace),"state"in I&&l(7,T=I.state),"getProps"in I&&l(8,C=I.getProps),"$$scope"in I&&l(12,d=I.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=E(v,_)),t.$$.dirty&2049&&l(10,i=Xs(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(r=_o(n)===P1(_)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,f=(()=>{if(ec(C)){const I=C({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...I}}return p})())},e=ds(e),[n,f,a,$,A,v,g,T,C,o,i,_,d,b]}class cm extends Me{constructor(e){super(),Se(this,e,fm,am,$e,{to:5,replace:6,state:7,getProps:8})}}const Ul=cm;let Zs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ll(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function mm(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Tc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function pm(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function gs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return""}}function Ee(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function ce(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"µHAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Gr(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 Br(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 zr(t){switch(t){case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function oi(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ye(t,e){return t==1||t==2&&e}function Ot(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function me(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function al(t,e){return t.setTime(t.getTime()+e*36e5),t}function Yr(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}async function Hl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let ul={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 qt=rt(ul);async function vo(){ul=await(await Hl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),qt.set(ul)}let ms=0,Vr=-127,Kr=null,_m={};const dm=sc(_m,t=>{let e;async function l(){Hl("/data.json").then(n=>n.json()).then(n=>{t(n),Vr!=n.t&&(Vr=n.t,setTimeout(Ac,2e3)),Kr==null&&n.pe&&n.p!=null&&(Kr=n.p,Mc()),ul.upgrading?window.location.reload():(!ul||!ul.chip||ul.booting||ms>1&&!oi(ul.board))&&(vo(),un&&clearTimeout(un),un=setTimeout(bo,2e3),rn&&clearTimeout(rn),rn=setTimeout(go,3e3));let i=5e3;if(oi(ul.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),ms=0}).catch(n=>{ms++,ms>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,oi(ul.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Js={};const ho=rt(Js);async function Sc(){let t=!1;ho.update(l=>{for(var n=0;n<36;n++){if(l[Ee(n)]==null){t=n<12;break}l[Ee(n)]=l[Ee(n+1)]}return l}),t&&Mc(),setTimeout(Sc,(60-new Date().getMinutes())*6e4)}async function Mc(){Js=await(await Hl("/energyprice.json")).json(),ho.set(Js),setTimeout(Sc,(60-new Date().getMinutes())*6e4)}let xs={},un;async function bo(){un&&(clearTimeout(un),un=0),xs=await(await Hl("/dayplot.json")).json(),Nc.set(xs),un=setTimeout(bo,(60-new Date().getMinutes())*6e4+20)}const Nc=rt(xs,t=>(bo(),function(){}));let eo={},rn;async function go(){rn&&(clearTimeout(rn),rn=0),eo=await(await Hl("/monthplot.json")).json(),Pc.set(eo),rn=setTimeout(go,(24-new Date().getHours())*36e5+40)}const Pc=rt(eo,t=>(go(),function(){}));let to={};async function Ac(){to=await(await Hl("/temperature.json")).json(),Dc.set(to)}const Dc=rt(to,t=>(Ac(),function(){}));let lo={},ps;async function Ec(){ps&&(clearTimeout(ps),ps=0),lo=await(await Hl("/tariff.json")).json(),Ic.set(lo),ps=setTimeout(Ec,(60-new Date().getMinutes())*6e4+30)}const Ic=rt(lo,t=>function(){});let no=[];const ko=rt(no);async function vm(){no=await(await Hl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),ko.set(no)}function ks(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 Fc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Rc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),r=[...e];r.reverse();let a,f,c;for(let p=0;po&&(a=_):g==i+1&&(f=_);else if(v==n+1)if(c){let C=c.tag_name.substring(1).split(".");parseInt(C[0]);let $=parseInt(C[1]);parseInt(C[2]),g==$&&(c=_)}else c=_}return f||c||a||!1}else return e[0]}const hm="/github.svg";function Qr(t){let e,l;function n(r,a){return r[1]>1?$m:r[1]>0?Cm:r[2]>1?ym:r[2]>0?wm:r[3]>1?km:r[3]>0?gm:bm}let i=n(t),o=i(t);return{c(){e=y(`Up `),o.c(),l=Ge()},m(r,a){w(r,e,a),o.m(r,a),w(r,l,a)},p(r,a){i===(i=n(r))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},d(r){r&&k(e),o.d(r),r&&k(l)}}}function bm(t){let e,l;return{c(){e=y(t[0]),l=y(" seconds")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&1&&G(e,n[0])},d(n){n&&k(e),n&&k(l)}}}function gm(t){let e,l;return{c(){e=y(t[3]),l=y(" minute")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&8&&G(e,n[3])},d(n){n&&k(e),n&&k(l)}}}function km(t){let e,l;return{c(){e=y(t[3]),l=y(" minutes")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&8&&G(e,n[3])},d(n){n&&k(e),n&&k(l)}}}function wm(t){let e,l;return{c(){e=y(t[2]),l=y(" hour")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&4&&G(e,n[2])},d(n){n&&k(e),n&&k(l)}}}function ym(t){let e,l;return{c(){e=y(t[2]),l=y(" hours")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&4&&G(e,n[2])},d(n){n&&k(e),n&&k(l)}}}function Cm(t){let e,l;return{c(){e=y(t[1]),l=y(" day")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&2&&G(e,n[1])},d(n){n&&k(e),n&&k(l)}}}function $m(t){let e,l;return{c(){e=y(t[1]),l=y(" days")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&2&&G(e,n[1])},d(n){n&&k(e),n&&k(l)}}}function Tm(t){let e,l=t[0]&&Qr(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),w(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Qr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ne,o:ne,d(n){l&&l.d(n),n&&k(e)}}}function Sm(t,e,l){let{epoch:n}=e,i=0,o=0,r=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,r=Math.floor(n/60)))},[n,i,o,r]}class Mm extends Me{constructor(e){super(),Se(this,e,Sm,Tm,$e,{epoch:0})}}function Nm(t){let e,l,n;return{c(){e=m("span"),l=y(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){w(i,e,o),s(e,l)},p(i,[o]){o&4&&G(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ne,o:ne,d(i){i&&k(e)}}}function Pm(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=r=>{"color"in r&&l(0,n=r.color),"title"in r&&l(1,i=r.title),"text"in r&&l(2,o=r.text)},[n,i,o]}class fl extends Me{constructor(e){super(),Se(this,e,Pm,Nm,$e,{color:0,title:1,text:2})}}function Am(t){let e,l=`${Ee(t[0].getDate())}.${Ee(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ee(t[0].getHours())}:${Ee(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=y(l),u(e,"class",t[1])},m(i,o){w(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ee(i[0].getDate())}.${Ee(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ee(i[0].getHours())}:${Ee(i[0].getMinutes())}`)&&G(n,l),o&2&&u(e,"class",i[1])},d(i){i&&k(e)}}}function Dm(t){let e=`${Ee(t[0].getDate())}. ${Zs[t[0].getMonth()]} ${Ee(t[0].getHours())}:${Ee(t[0].getMinutes())}`,l;return{c(){l=y(e)},m(n,i){w(n,l,i)},p(n,i){i&1&&e!==(e=`${Ee(n[0].getDate())}. ${Zs[n[0].getMonth()]} ${Ee(n[0].getHours())}:${Ee(n[0].getMinutes())}`)&&G(l,e)},d(n){n&&k(l)}}}function Em(t){let e;function l(o,r){return o[2]?Dm:Am}let n=l(t),i=n(t);return{c(){i.c(),e=Ge()},m(o,r){i.m(o,r),w(o,e,r)},p(o,[r]){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:ne,o:ne,d(o){i.d(o),o&&k(e)}}}function Im(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,r;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,o=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,r=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||al(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,r,o]}class Lc extends Me{constructor(e){super(),Se(this,e,Im,Em,$e,{timestamp:0,fullTimeColor:1,offset:3})}}function Fm(t){let e,l,n;return{c(){e=qe("svg"),l=qe("path"),n=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){w(i,e,o),s(e,l),s(e,n)},p:ne,i:ne,o:ne,d(i){i&&k(e)}}}class Rm extends Me{constructor(e){super(),Se(this,e,null,Fm,$e,{})}}function Lm(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){w(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&k(e)}}}class Um extends Me{constructor(e){super(),Se(this,e,null,Lm,$e,{})}}function Om(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){w(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&k(e)}}}class Ut extends Me{constructor(e){super(),Se(this,e,null,Om,$e,{})}}function qm(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){w(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&k(e)}}}class Uc extends Me{constructor(e){super(),Se(this,e,null,qm,$e,{})}}function Hm(t){let e,l,n=t[1].version+"",i;return{c(){e=y("AMS reader "),l=m("span"),i=y(n)},m(o,r){w(o,e,r),w(o,l,r),s(l,i)},p(o,r){r&2&&n!==(n=o[1].version+"")&&G(i,n)},d(o){o&&k(e),o&&k(l)}}}function Xr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=y(l),i=y("°C"),u(e,"class","flex-none my-auto")},m(o,r){w(o,e,r),s(e,n),s(e,i)},p(o,r){r&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&G(n,l)},d(o){o&&k(e)}}}function Zr(t){let e,l="HAN: "+Gr(t[0].he),n;return{c(){e=m("div"),n=y(l),u(e,"class","bd-red")},m(i,o){w(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Gr(i[0].he))&&G(n,l)},d(i){i&&k(e)}}}function Jr(t){let e,l="MQTT: "+Br(t[0].me),n;return{c(){e=m("div"),n=y(l),u(e,"class","bd-red")},m(i,o){w(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Br(i[0].me))&&G(n,l)},d(i){i&&k(e)}}}function xr(t){let e,l="PriceAPI: "+zr(t[0].ee),n;return{c(){e=m("div"),n=y(l),u(e,"class","bd-red")},m(i,o){w(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+zr(i[0].ee))&&G(n,l)},d(i){i&&k(e)}}}function ea(t){let e,l,n,i,o,r;return l=new Ul({props:{to:"/configuration",$$slots:{default:[jm]},$$scope:{ctx:t}}}),o=new Ul({props:{to:"/status",$$slots:{default:[Wm]},$$scope:{ctx:t}}}),{c(){e=m("div"),Z(l.$$.fragment),n=h(),i=m("div"),Z(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(a,f){w(a,e,f),Q(l,e,null),w(a,n,f),w(a,i,f),Q(o,i,null),r=!0},i(a){r||(N(l.$$.fragment,a),N(o.$$.fragment,a),r=!0)},o(a){D(l.$$.fragment,a),D(o.$$.fragment,a),r=!1},d(a){a&&k(e),X(l),a&&k(n),a&&k(i),X(o)}}}function jm(t){let e,l;return e=new Rm({}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Wm(t){let e,l;return e=new Um({}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function ta(t){let e,l,n,i,o;const r=[Bm,Gm],a=[];function f(c,p){return c[1].security==0||c[0].a?0:1}return l=f(t),n=a[l]=r[l](t),{c(){e=m("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(c,p){w(c,e,p),a[l].m(e,null),o=!0},p(c,p){let _=l;l=f(c),l===_?a[l].p(c,p):(Ae(),D(a[_],1,1,()=>{a[_]=null}),De(),n=a[l],n?n.p(c,p):(n=a[l]=r[l](c),n.c()),N(n,1),n.m(e,null)),(!o||p&4&&i!==(i="New version: "+c[2].tag_name))&&u(e,"title",i)},i(c){o||(N(n),o=!0)},o(c){D(n),o=!1},d(c){c&&k(e),a[l].d()}}}function Gm(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=y("New version: "),i=y(n)},m(o,r){w(o,e,r),s(e,l),s(e,i)},p(o,r){r&4&&n!==(n=o[2].tag_name+"")&&G(i,n)},i:ne,o:ne,d(o){o&&k(e)}}}function Bm(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,p;return a=new Uc({}),{c(){e=m("button"),l=m("span"),n=y("New version: "),o=y(i),r=h(),Z(a.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(_,b){w(_,e,b),s(e,l),s(l,n),s(l,o),s(e,r),Q(a,e,null),f=!0,c||(p=K(e,"click",t[3]),c=!0)},p(_,b){(!f||b&4)&&i!==(i=_[2].tag_name+"")&&G(o,i)},i(_){f||(N(a.$$.fragment,_),f=!0)},o(_){D(a.$$.fragment,_),f=!1},d(_){_&&k(e),X(a),c=!1,p()}}}function zm(t){let e,l,n,i,o,r,a,f,c,p,_,b,d=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",v,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z,O,R,B,L,j,W,te,le,pe,ie,Te,je,Pe,We;i=new Ul({props:{to:"/",$$slots:{default:[Hm]},$$scope:{ctx:t}}}),f=new Mm({props:{epoch:t[0].u}});let be=t[0].t>-50&&Xr(t);$=new fl({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:Ll(t[1].booting?2:t[0].em)}}),E=new fl({props:{title:"HAN",text:"HAN",color:Ll(t[1].booting?9:t[0].hm)}}),A=new fl({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:Ll(t[1].booting?9:t[0].wm)}}),F=new fl({props:{title:"MQTT",text:"MQTT",color:Ll(t[1].booting?9:t[0].mm)}});let ke=(t[0].he<0||t[0].he>0)&&Zr(t),Fe=t[0].me<0&&Jr(t),ge=(t[0].ee>0||t[0].ee<0)&&xr(t);te=new Lc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let ae=t[1].vndcfg&&t[1].usrcfg&&ea(t);je=new Ut({});let we=t[1].fwconsent===1&&t[2]&&ta(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),Z(i.$$.fragment),o=h(),r=m("div"),a=m("div"),Z(f.$$.fragment),c=h(),be&&be.c(),p=h(),_=m("div"),b=y("Free mem: "),v=y(d),g=y("kb"),T=h(),C=m("div"),Z($.$$.fragment),M=h(),Z(E.$$.fragment),S=h(),Z(A.$$.fragment),I=h(),Z(F.$$.fragment),Y=h(),ke&&ke.c(),U=h(),Fe&&Fe.c(),H=h(),ge&&ge.c(),q=h(),z=m("div"),O=m("div"),R=m("a"),B=m("img"),j=h(),W=m("div"),Z(te.$$.fragment),le=h(),ae&&ae.c(),pe=h(),ie=m("div"),Te=m("a"),Z(je.$$.fragment),Pe=h(),we&&we.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(a,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(r,"class","flex-none my-auto p-2 flex space-x-4"),u(C,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(B,"class","gh-logo"),Bc(B.src,L=hm)||u(B,"src",L),u(B,"alt","GitHub repo"),u(R,"class","float-right"),u(R,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(R,"target","_blank"),u(R,"rel","noreferrer"),u(R,"aria-label","GitHub"),u(O,"class","flex-none"),u(W,"class","flex-none my-auto px-2"),u(Te,"href",Ot("")),u(Te,"target","_blank"),u(Te,"rel","noreferrer"),u(ie,"class","flex-none px-1 mt-1"),u(ie,"title","Documentation"),u(z,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(J,se){w(J,e,se),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,r),s(r,a),Q(f,a,null),s(r,c),be&&be.m(r,null),s(r,p),s(r,_),s(_,b),s(_,v),s(_,g),s(l,T),s(l,C),Q($,C,null),s(C,M),Q(E,C,null),s(C,S),Q(A,C,null),s(C,I),Q(F,C,null),s(l,Y),ke&&ke.m(l,null),s(l,U),Fe&&Fe.m(l,null),s(l,H),ge&&ge.m(l,null),s(l,q),s(l,z),s(z,O),s(O,R),s(R,B),s(z,j),s(z,W),Q(te,W,null),s(z,le),ae&&ae.m(z,null),s(z,pe),s(z,ie),s(ie,Te),Q(je,Te,null),s(z,Pe),we&&we.m(z,null),We=!0},p(J,[se]){const Ie={};se&18&&(Ie.$$scope={dirty:se,ctx:J}),i.$set(Ie);const Re={};se&1&&(Re.epoch=J[0].u),f.$set(Re),J[0].t>-50?be?be.p(J,se):(be=Xr(J),be.c(),be.m(r,p)):be&&(be.d(1),be=null),(!We||se&1)&&d!==(d=(J[0].m?(J[0].m/1e3).toFixed(1):"-")+"")&&G(v,d);const _e={};se&3&&(_e.text=J[1].booting?"Booting":J[0].v>2?J[0].v.toFixed(2)+"V":"ESP"),se&3&&(_e.color=Ll(J[1].booting?2:J[0].em)),$.$set(_e);const ye={};se&3&&(ye.color=Ll(J[1].booting?9:J[0].hm)),E.$set(ye);const Ne={};se&1&&(Ne.text=J[0].r?J[0].r.toFixed(0)+"dBm":"WiFi"),se&3&&(Ne.color=Ll(J[1].booting?9:J[0].wm)),A.$set(Ne);const de={};se&3&&(de.color=Ll(J[1].booting?9:J[0].mm)),F.$set(de),J[0].he<0||J[0].he>0?ke?ke.p(J,se):(ke=Zr(J),ke.c(),ke.m(l,U)):ke&&(ke.d(1),ke=null),J[0].me<0?Fe?Fe.p(J,se):(Fe=Jr(J),Fe.c(),Fe.m(l,H)):Fe&&(Fe.d(1),Fe=null),J[0].ee>0||J[0].ee<0?ge?ge.p(J,se):(ge=xr(J),ge.c(),ge.m(l,q)):ge&&(ge.d(1),ge=null);const Ce={};se&1&&(Ce.timestamp=J[0].c?new Date(J[0].c*1e3):new Date(0)),se&2&&(Ce.offset=J[1].clock_offset),te.$set(Ce),J[1].vndcfg&&J[1].usrcfg?ae?se&2&&N(ae,1):(ae=ea(J),ae.c(),N(ae,1),ae.m(z,pe)):ae&&(Ae(),D(ae,1,1,()=>{ae=null}),De()),J[1].fwconsent===1&&J[2]?we?(we.p(J,se),se&6&&N(we,1)):(we=ta(J),we.c(),N(we,1),we.m(z,null)):we&&(Ae(),D(we,1,1,()=>{we=null}),De())},i(J){We||(N(i.$$.fragment,J),N(f.$$.fragment,J),N($.$$.fragment,J),N(E.$$.fragment,J),N(A.$$.fragment,J),N(F.$$.fragment,J),N(te.$$.fragment,J),N(ae),N(je.$$.fragment,J),N(we),We=!0)},o(J){D(i.$$.fragment,J),D(f.$$.fragment,J),D($.$$.fragment,J),D(E.$$.fragment,J),D(A.$$.fragment,J),D(F.$$.fragment,J),D(te.$$.fragment,J),D(ae),D(je.$$.fragment,J),D(we),We=!1},d(J){J&&k(e),X(i),X(f),be&&be.d(),X($),X(E),X(A),X(F),ke&&ke.d(),Fe&&Fe.d(),ge&&ge.d(),X(te),ae&&ae.d(),X(je),we&&we.d()}}}function Ym(t,e,l){let{data:n={}}=e,i={},o={};function r(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!oi(i.board)||confirm(ks(ce(i.chip,i.board))))&&(qt.update(a=>(a.upgrading=!0,a)),Fc(o.tag_name))}return qt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&vm()}),ko.subscribe(a=>{l(2,o=Rc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,r]}class Vm extends Me{constructor(e){super(),Se(this,e,Ym,zm,$e,{data:0})}}function Km(t){let e,l,n,i;return{c(){e=qe("svg"),l=qe("path"),n=qe("path"),u(l,"d",Ys(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Ys(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,r){w(o,e,r),s(e,l),s(e,n)},p(o,[r]){r&1&&i!==(i=Ys(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),r&2&&u(n,"stroke",o[1])},i:ne,o:ne,d(o){o&&k(e)}}}function la(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 Ys(t,e,l,n,i){var o=la(t,e,l,i),r=la(t,e,l,n),a=i-n<=180?"0":"1",f=["M",o.x,o.y,"A",l,l,0,a,0,r.x,r.y].join(" ");return f}function Qm(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class Xm extends Me{constructor(e){super(),Se(this,e,Qm,Km,$e,{pct:0,color:1})}}function na(t){let e,l,n,i,o,r,a,f;return{c(){e=m("br"),l=h(),n=m("span"),i=y(t[3]),o=h(),r=m("span"),a=y(t[4]),f=y("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(c,p){w(c,e,p),w(c,l,p),w(c,n,p),s(n,i),w(c,o,p),w(c,r,p),s(r,a),s(r,f)},p(c,p){p&8&&G(i,c[3]),p&16&&G(a,c[4])},d(c){c&&k(e),c&&k(l),c&&k(n),c&&k(o),c&&k(r)}}}function Zm(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T;l=new Xm({props:{pct:t[6],color:t[5](t[6])}});let C=t[3]&&na(t);return{c(){e=m("div"),Z(l.$$.fragment),n=h(),i=m("span"),o=m("span"),r=y(t[2]),a=h(),f=m("br"),c=h(),p=m("span"),_=y(t[0]),b=h(),d=m("span"),v=y(t[1]),g=h(),C&&C.c(),u(o,"class","pl-lab"),u(p,"class","pl-val"),u(d,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m($,M){w($,e,M),Q(l,e,null),s(e,n),s(e,i),s(i,o),s(o,r),s(i,a),s(i,f),s(i,c),s(i,p),s(p,_),s(i,b),s(i,d),s(d,v),s(i,g),C&&C.m(i,null),T=!0},p($,[M]){const E={};M&64&&(E.pct=$[6]),M&96&&(E.color=$[5]($[6])),l.$set(E),(!T||M&4)&&G(r,$[2]),(!T||M&1)&&G(_,$[0]),(!T||M&2)&&G(v,$[1]),$[3]?C?C.p($,M):(C=na($),C.c(),C.m(i,null)):C&&(C.d(1),C=null)},i($){T||(N(l.$$.fragment,$),T=!0)},o($){D(l.$$.fragment,$),T=!1},d($){$&&k(e),X(l),C&&C.d()}}}function Jm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:r}=e,{sub:a=""}=e,{subunit:f=""}=e,{colorFn:c}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,r=_.label),"sub"in _&&l(3,a=_.sub),"subunit"in _&&l(4,f=_.subunit),"colorFn"in _&&l(5,c=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,r,a,f,c,p,i]}class Oc extends Me{constructor(e){super(),Se(this,e,Jm,Zm,$e,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function ia(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function sa(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function oa(t,e,l){const n=t.slice();return n[13]=e[l],n}function ua(t){let e,l,n,i,o,r=t[0].title&&ra(t),a=t[0].y.ticks,f=[];for(let d=0;d20||t[11]%2==0)&&ma(t);return{c(){e=qe("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[5](t[11])+","+t[4]+")")},m(i,o){w(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[11]%2==0?n?n.p(i,o):(n=ma(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[11])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&k(e),n&&n.d()}}}function ma(t){let e,l=t[9].label+"",n,i;return{c(){e=qe("text"),n=y(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(o,r){w(o,e,r),s(e,n)},p(o,r){r&1&&l!==(l=o[9].label+"")&&G(n,l),r&8&&i!==(i=o[3]/2)&&u(e,"x",i)},d(o){o&&k(e)}}}function pa(t){let e=!isNaN(t[5](t[11])),l,n=e&&ca(t);return{c(){n&&n.c(),l=Ge()},m(i,o){n&&n.m(i,o),w(i,l,o)},p(i,o){o&32&&(e=!isNaN(i[5](i[11]))),e?n?n.p(i,o):(n=ca(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&k(l)}}}function _a(t){let e,l,n=t[9].value!==void 0&&da(t),i=t[9].value2>1e-4&&ba(t);return{c(){e=qe("g"),n&&n.c(),l=qe("g"),i&&i.c()},m(o,r){w(o,e,r),n&&n.m(e,null),w(o,l,r),i&&i.m(l,null)},p(o,r){o[9].value!==void 0?n?n.p(o,r):(n=da(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,r):(i=ba(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&k(e),n&&n.d(),o&&k(l),i&&i.d()}}}function da(t){let e,l,n,i,o,r,a,f=t[3]>15&&va(t);return{c(){e=qe("rect"),f&&f.c(),a=Ge(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](t[9].value)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),u(e,"fill",r=t[9].color)},m(c,p){w(c,e,p),f&&f.m(c,p),w(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&u(e,"x",l),p&65&&n!==(n=c[6](c[9].value))&&u(e,"y",n),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](Math.min(c[0].y.min,0)+c[9].value))&&u(e,"height",o),p&1&&r!==(r=c[9].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,p):(f=va(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&k(e),f&&f.d(c),c&&k(a)}}}function va(t){let e,l=t[9].label+"",n,i,o,r,a,f,c=t[9].title&&ha(t);return{c(){e=qe("text"),n=y(l),c&&c.c(),f=Ge(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",o=t[3]t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",a="translate("+(t[5](t[11])+t[3]/2)+" "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10)+") rotate("+(t[3]p[6](0)-p[7]?p[9].color:"white")&&u(e,"fill",r),_&233&&a!==(a="translate("+(p[5](p[11])+p[3]/2)+" "+(p[6](p[9].value)>p[6](0)-p[7]?p[6](p[9].value)-p[7]:p[6](p[9].value)+10)+") rotate("+(p[3]15&&ga(t);return{c(){e=qe("rect"),f&&f.c(),a=Ge(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](0)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),u(e,"fill",r=t[9].color2?t[9].color2:t[9].color)},m(c,p){w(c,e,p),f&&f.m(c,p),w(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&u(e,"x",l),p&64&&n!==(n=c[6](0))&&u(e,"y",n),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](c[0].y.min+c[9].value2))&&u(e,"height",o),p&1&&r!==(r=c[9].color2?c[9].color2:c[9].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,p):(f=ga(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&k(e),f&&f.d(c),c&&k(a)}}}function ga(t){let e,l=t[9].label2+"",n,i,o,r,a,f=t[9].title2&&ka(t);return{c(){e=qe("text"),n=y(l),f&&f.c(),a=Ge(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor","middle"),u(e,"fill",o=t[6](-t[9].value2)t[8].call(e))},m(i,o){w(i,e,o),n&&n.m(e,null),l=Jc(e,t[8].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=ua(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:ne,o:ne,d(i){i&&k(e),n&&n.d(),l()}}}let an=30;function ep(t,e,l){let{config:n}=e,i,o,r,a,f,c,p;function _(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=b=>{"config"in b&&l(0,n=b.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,c=o-(n.title?20:0));let b=i-(n.padding.left+n.padding.right);l(3,r=b/n.points.length),l(7,p=rn.y.max?g=n.padding.bottom:vc||g<0?0:g})}},[n,i,o,r,c,a,f,p,_]}class cn extends Me{constructor(e){super(),Se(this,e,ep,xm,$e,{config:0})}}function tp(t){let e,l;return e=new cn({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function lp(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:r}=e,a={};function f(c){return{label:me(c)+"V",title:c.toFixed(1)+" V",value:isNaN(c)?0:c,color:mm(c||0)}}return t.$$set=c=>{"u1"in c&&l(1,n=c.u1),"u2"in c&&l(2,i=c.u2),"u3"in c&&l(3,o=c.u3),"ds"in c&&l(4,r=c.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let c=[],p=[];n>0&&(c.push({label:r===1?"L1-L2":"L1"}),p.push(f(n))),i>0&&(c.push({label:r===1?"L1-L3":"L2"}),p.push(f(i))),o>0&&(c.push({label:r===1?"L2-L3":"L3"}),p.push(f(o))),l(0,a={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:c},points:p})}},[a,n,i,o,r]}class np extends Me{constructor(e){super(),Se(this,e,lp,tp,$e,{u1:1,u2:2,u3:3,ds:4})}}function ip(t){let e,l;return e=new cn({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function sp(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:r}=e,{i2:a}=e,{i3:f}=e,{max:c}=e,p={};function _(b){return{label:me(b)+"A",title:b.toFixed(1)+" A",value:isNaN(b)?0:b,color:Tc(b?b/c*100:0)}}return t.$$set=b=>{"u1"in b&&l(1,n=b.u1),"u2"in b&&l(2,i=b.u2),"u3"in b&&l(3,o=b.u3),"i1"in b&&l(4,r=b.i1),"i2"in b&&l(5,a=b.i2),"i3"in b&&l(6,f=b.i3),"max"in b&&l(7,c=b.max)},t.$$.update=()=>{if(t.$$.dirty&254){let b=[],d=[];n>0&&(b.push({label:"L1"}),d.push(_(r))),i>0&&(b.push({label:"L2"}),d.push(_(a))),o>0&&(b.push({label:"L3"}),d.push(_(f))),l(0,p={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:c,ticks:[{value:0,label:"0%"},{value:c/4,label:"25%"},{value:c/2,label:"50%"},{value:c/4*3,label:"75%"},{value:c,label:"100%"}]},x:{ticks:b},points:d})}},[p,n,i,o,r,a,f,c]}class op extends Me{constructor(e){super(),Se(this,e,sp,ip,$e,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function up(t){let e,l,n,i,o,r,a,f=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",c,p,_,b,d,v,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",T,C,$,M,E,S,A,I=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,Y,U,H,q,z,O=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",R,B;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",r=h(),a=m("div"),c=y(f),p=y(" VAr"),_=h(),b=m("div"),b.textContent="Instant out",d=h(),v=m("div"),T=y(g),C=y(" VAr"),$=h(),M=m("div"),E=m("div"),E.textContent="Total in",S=h(),A=m("div"),F=y(I),Y=y(" kVArh"),U=h(),H=m("div"),H.textContent="Total out",q=h(),z=m("div"),R=y(O),B=y(" kVArh"),u(a,"class","text-right"),u(v,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(A,"class","text-right"),u(z,"class","text-right"),u(M,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(L,j){w(L,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(i,a),s(a,c),s(a,p),s(i,_),s(i,b),s(i,d),s(i,v),s(v,T),s(v,C),s(e,$),s(e,M),s(M,E),s(M,S),s(M,A),s(A,F),s(A,Y),s(M,U),s(M,H),s(M,q),s(M,z),s(z,R),s(z,B)},p(L,[j]){j&1&&f!==(f=(typeof L[0]<"u"?L[0].toFixed(0):"-")+"")&&G(c,f),j&2&&g!==(g=(typeof L[1]<"u"?L[1].toFixed(0):"-")+"")&&G(T,g),j&4&&I!==(I=(typeof L[2]<"u"?L[2].toFixed(1):"-")+"")&&G(F,I),j&8&&O!==(O=(typeof L[3]<"u"?L[3].toFixed(1):"-")+"")&&G(R,O)},i:ne,o:ne,d(L){L&&k(e)}}}function rp(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:r}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,r=a.exportTotal)},[n,i,o,r]}class ap extends Me{constructor(e){super(),Se(this,e,rp,up,$e,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function ya(t){let e;function l(o,r){return o[3]?cp:fp}let n=l(t),i=n(t);return{c(){i.c(),e=Ge()},m(o,r){i.m(o,r),w(o,e,r)},p(o,r){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&k(e)}}}function fp(t){let e,l,n,i,o,r,a=me(t[1].h.u,2)+"",f,c,p,_,b,d,v=me(t[1].d.u,1)+"",g,T,C,$,M,E,S=me(t[1].m.u)+"",A,I,F,Y,U,H,q=me(t[0].last_month.u)+"",z,O,R,B,L=t[4]&&Ca(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=y(a),c=y(" kWh"),p=h(),_=m("div"),_.textContent="Day",b=h(),d=m("div"),g=y(v),T=y(" kWh"),C=h(),$=m("div"),$.textContent="Month",M=h(),E=m("div"),A=y(S),I=y(" kWh"),F=h(),Y=m("div"),Y.textContent="Last month",U=h(),H=m("div"),z=y(q),O=y(" kWh"),R=h(),L&&L.c(),B=Ge(),u(r,"class","text-right"),u(d,"class","text-right"),u(E,"class","text-right"),u(H,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(j,W){w(j,e,W),w(j,l,W),w(j,n,W),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,p),s(n,_),s(n,b),s(n,d),s(d,g),s(d,T),s(n,C),s(n,$),s(n,M),s(n,E),s(E,A),s(E,I),s(n,F),s(n,Y),s(n,U),s(n,H),s(H,z),s(H,O),w(j,R,W),L&&L.m(j,W),w(j,B,W)},p(j,W){W&2&&a!==(a=me(j[1].h.u,2)+"")&&G(f,a),W&2&&v!==(v=me(j[1].d.u,1)+"")&&G(g,v),W&2&&S!==(S=me(j[1].m.u)+"")&&G(A,S),W&1&&q!==(q=me(j[0].last_month.u)+"")&&G(z,q),j[4]?L?L.p(j,W):(L=Ca(j),L.c(),L.m(B.parentNode,B)):L&&(L.d(1),L=null)},d(j){j&&k(e),j&&k(l),j&&k(n),j&&k(R),L&&L.d(j),j&&k(B)}}}function cp(t){let e,l,n,i,o,r,a=me(t[1].h.u,2)+"",f,c,p,_,b,d,v,g=me(t[1].d.u,1)+"",T,C,$,M,E,S,A,I=me(t[1].m.u)+"",F,Y,U,H,q,z,O,R=me(t[0].last_month.u)+"",B,L,j,W,te,le,pe,ie,Te,je,Pe,We=me(t[1].h.p,2)+"",be,ke,Fe,ge,ae,we,J,se=me(t[1].d.p,1)+"",Ie,Re,_e,ye,Ne,de,Ce,x=me(t[1].m.p)+"",oe,Ue,ue,ve,dt,jl,xt,ct=me(t[0].last_month.p)+"",Ml,pl,Ht,vt,Qe=t[4]&&$a(t),Xe=t[4]&&Ta(t),Ze=t[4]&&Sa(t),Oe=t[4]&&Ma(t),Je=t[4]&&Na(t),Be=t[4]&&Pa(t),xe=t[4]&&Aa(t),et=t[4]&&Da(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=y(a),c=y(" kWh"),p=h(),Qe&&Qe.c(),_=h(),b=m("div"),b.textContent="Day",d=h(),v=m("div"),T=y(g),C=y(" kWh"),$=h(),Xe&&Xe.c(),M=h(),E=m("div"),E.textContent="Month",S=h(),A=m("div"),F=y(I),Y=y(" kWh"),U=h(),Ze&&Ze.c(),H=h(),q=m("div"),q.textContent="Last mo.",z=h(),O=m("div"),B=y(R),L=y(" kWh"),j=h(),Oe&&Oe.c(),te=h(),le=m("strong"),le.textContent="Export",pe=h(),ie=m("div"),Te=m("div"),Te.textContent="Hour",je=h(),Pe=m("div"),be=y(We),ke=y(" kWh"),Fe=h(),Je&&Je.c(),ge=h(),ae=m("div"),ae.textContent="Day",we=h(),J=m("div"),Ie=y(se),Re=y(" kWh"),_e=h(),Be&&Be.c(),ye=h(),Ne=m("div"),Ne.textContent="Month",de=h(),Ce=m("div"),oe=y(x),Ue=y(" kWh"),ue=h(),xe&&xe.c(),ve=h(),dt=m("div"),dt.textContent="Last mo.",jl=h(),xt=m("div"),Ml=y(ct),pl=y(" kWh"),Ht=h(),et&&et.c(),u(r,"class","text-right"),u(v,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class",W="grid grid-cols-"+t[5]+" mb-3"),u(Pe,"class","text-right"),u(J,"class","text-right"),u(Ce,"class","text-right"),u(xt,"class","text-right"),u(ie,"class",vt="grid grid-cols-"+t[5])},m(re,he){w(re,e,he),w(re,l,he),w(re,n,he),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,p),Qe&&Qe.m(n,null),s(n,_),s(n,b),s(n,d),s(n,v),s(v,T),s(v,C),s(n,$),Xe&&Xe.m(n,null),s(n,M),s(n,E),s(n,S),s(n,A),s(A,F),s(A,Y),s(n,U),Ze&&Ze.m(n,null),s(n,H),s(n,q),s(n,z),s(n,O),s(O,B),s(O,L),s(n,j),Oe&&Oe.m(n,null),w(re,te,he),w(re,le,he),w(re,pe,he),w(re,ie,he),s(ie,Te),s(ie,je),s(ie,Pe),s(Pe,be),s(Pe,ke),s(ie,Fe),Je&&Je.m(ie,null),s(ie,ge),s(ie,ae),s(ie,we),s(ie,J),s(J,Ie),s(J,Re),s(ie,_e),Be&&Be.m(ie,null),s(ie,ye),s(ie,Ne),s(ie,de),s(ie,Ce),s(Ce,oe),s(Ce,Ue),s(ie,ue),xe&&xe.m(ie,null),s(ie,ve),s(ie,dt),s(ie,jl),s(ie,xt),s(xt,Ml),s(xt,pl),s(ie,Ht),et&&et.m(ie,null)},p(re,he){he&2&&a!==(a=me(re[1].h.u,2)+"")&&G(f,a),re[4]?Qe?Qe.p(re,he):(Qe=$a(re),Qe.c(),Qe.m(n,_)):Qe&&(Qe.d(1),Qe=null),he&2&&g!==(g=me(re[1].d.u,1)+"")&&G(T,g),re[4]?Xe?Xe.p(re,he):(Xe=Ta(re),Xe.c(),Xe.m(n,M)):Xe&&(Xe.d(1),Xe=null),he&2&&I!==(I=me(re[1].m.u)+"")&&G(F,I),re[4]?Ze?Ze.p(re,he):(Ze=Sa(re),Ze.c(),Ze.m(n,H)):Ze&&(Ze.d(1),Ze=null),he&1&&R!==(R=me(re[0].last_month.u)+"")&&G(B,R),re[4]?Oe?Oe.p(re,he):(Oe=Ma(re),Oe.c(),Oe.m(n,null)):Oe&&(Oe.d(1),Oe=null),he&32&&W!==(W="grid grid-cols-"+re[5]+" mb-3")&&u(n,"class",W),he&2&&We!==(We=me(re[1].h.p,2)+"")&&G(be,We),re[4]?Je?Je.p(re,he):(Je=Na(re),Je.c(),Je.m(ie,ge)):Je&&(Je.d(1),Je=null),he&2&&se!==(se=me(re[1].d.p,1)+"")&&G(Ie,se),re[4]?Be?Be.p(re,he):(Be=Pa(re),Be.c(),Be.m(ie,ye)):Be&&(Be.d(1),Be=null),he&2&&x!==(x=me(re[1].m.p)+"")&&G(oe,x),re[4]?xe?xe.p(re,he):(xe=Aa(re),xe.c(),xe.m(ie,ve)):xe&&(xe.d(1),xe=null),he&1&&ct!==(ct=me(re[0].last_month.p)+"")&&G(Ml,ct),re[4]?et?et.p(re,he):(et=Da(re),et.c(),et.m(ie,null)):et&&(et.d(1),et=null),he&32&&vt!==(vt="grid grid-cols-"+re[5])&&u(ie,"class",vt)},d(re){re&&k(e),re&&k(l),re&&k(n),Qe&&Qe.d(),Xe&&Xe.d(),Ze&&Ze.d(),Oe&&Oe.d(),re&&k(te),re&&k(le),re&&k(pe),re&&k(ie),Je&&Je.d(),Be&&Be.d(),xe&&xe.d(),et&&et.d()}}}function Ca(t){let e,l,n,i,o,r,a=me(t[1].h.c,2)+"",f,c,p,_,b,d,v,g=me(t[1].d.c,1)+"",T,C,$,M,E,S,A,I=me(t[1].m.c)+"",F,Y,U,H,q,z,O,R=me(t[0].last_month.c)+"",B,L,j;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=y(a),c=h(),p=y(t[2]),_=h(),b=m("div"),b.textContent="Day",d=h(),v=m("div"),T=y(g),C=h(),$=y(t[2]),M=h(),E=m("div"),E.textContent="Month",S=h(),A=m("div"),F=y(I),Y=h(),U=y(t[2]),H=h(),q=m("div"),q.textContent="Last month",z=h(),O=m("div"),B=y(R),L=h(),j=y(t[2]),u(r,"class","text-right"),u(v,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class","grid grid-cols-2")},m(W,te){w(W,e,te),w(W,l,te),w(W,n,te),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(r,p),s(n,_),s(n,b),s(n,d),s(n,v),s(v,T),s(v,C),s(v,$),s(n,M),s(n,E),s(n,S),s(n,A),s(A,F),s(A,Y),s(A,U),s(n,H),s(n,q),s(n,z),s(n,O),s(O,B),s(O,L),s(O,j)},p(W,te){te&2&&a!==(a=me(W[1].h.c,2)+"")&&G(f,a),te&4&&G(p,W[2]),te&2&&g!==(g=me(W[1].d.c,1)+"")&&G(T,g),te&4&&G($,W[2]),te&2&&I!==(I=me(W[1].m.c)+"")&&G(F,I),te&4&&G(U,W[2]),te&1&&R!==(R=me(W[0].last_month.c)+"")&&G(B,R),te&4&&G(j,W[2])},d(W){W&&k(e),W&&k(l),W&&k(n)}}}function $a(t){let e,l=me(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=me(r[1].h.c,2)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function Ta(t){let e,l=me(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=me(r[1].d.c,1)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function Sa(t){let e,l=me(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=me(r[1].m.c)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function Ma(t){let e,l=me(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=me(r[0].last_month.c)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function Na(t){let e,l=me(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=me(r[1].h.i,2)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function Pa(t){let e,l=me(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=me(r[1].d.i,1)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function Aa(t){let e,l=me(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=me(r[1].m.i)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function Da(t){let e,l=me(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=me(r[0].last_month.i)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function mp(t){let e,l,n,i,o,r,a=t[1]&&ya(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),r=h(),a&&a.c(),u(e,"class","mx-2 text-sm")},m(f,c){w(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),s(e,r),a&&a.m(e,null)},p(f,[c]){f[1]?a?a.p(f,c):(a=ya(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:ne,o:ne,d(f){f&&k(e),a&&a.d()}}}function pp(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:r}=e,a=!1,f=3;return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo),"data"in c&&l(1,i=c.data),"currency"in c&&l(2,o=c.currency),"hasExport"in c&&l(3,r=c.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(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,f=a?3:2))},[n,i,o,r,a,f]}class _p extends Me{constructor(e){super(),Se(this,e,pp,mp,$e,{sysinfo:0,data:1,currency:2,hasExport:3})}}function dp(t){let e,l,n,i;return n=new cn({props:{config:t[0]}}),{c(){e=m("a"),e.textContent="Provided by ENTSO-E",l=h(),Z(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,r){w(o,e,r),w(o,l,r),Q(n,o,r),i=!0},p(o,[r]){const a={};r&1&&(a.config=o[0]),n.$set(a)},i(o){i||(N(n.$$.fragment,o),i=!0)},o(o){D(n.$$.fragment,o),i=!1},d(o){o&&k(e),o&&k(l),X(n,o)}}}function vp(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},r,a;return t.$$set=f=>{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=n.currency,c=new Date().getUTCHours(),p=0,_=0,b=0,d=[],v=[],g=[];l(4,a=l(3,r=0));let T=new Date;for(al(T,i.clock_offset),p=c;p<24&&(_=n[Ee(b++)],_!=null);p++)v.push({label:Ee(T.getUTCHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),al(T,1);for(p=0;p<24&&(_=n[Ee(b++)],_!=null);p++)v.push({label:Ee(T.getUTCHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),al(T,1);if(a>-100&&r<100){switch(f){case"NOK":case"SEK":case"DKK":f="øre";break;case"EUR":f="cent";break;default:f=f+"/100"}for(l(4,a*=100),l(3,r*=100),p=0;p=0?S.toFixed(A):"",title:S>=0?S.toFixed(2)+" "+f:"",value:_>=0?Math.abs(_):0,label2:S<0?S.toFixed(A):"",title2:S<0?S.toFixed(2)+" "+f:"",value2:_<0?Math.abs(_):0,color:"#7c3aed"})}let $=Math.max(r,Math.abs(a));if(a<0){l(4,a=Math.min($/4*-1,a));let S=Math.ceil(Math.abs(a)/$*4),A=a/S;for(p=1;p{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],p=[],_=[];l(4,a=l(3,r=0));let b=al(new Date,-24),d=new Date().getUTCHours();for(al(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),f=d;f<24;f++){let C=n["i"+Ee(f)],$=n["e"+Ee(f)];C===void 0&&(C=0),$===void 0&&($=0),p.push({label:Ee(b.getHours())}),_.push({label:C.toFixed(1),title:C.toFixed(2)+" kWh",value:C*10,label2:$.toFixed(1),title2:$.toFixed(2)+" kWh",value2:$*10,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,$*10)),l(3,r=Math.max(r,C*10)),al(b,1)}for(f=0;f{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],p=[],_=[];l(4,a=l(3,r=0));let b=new Date,d=new Date;for(al(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),al(d,i.clock_offset-(24+d.getHours()-d.getUTCHours())%24),d.setDate(0),f=b.getDate();f<=d.getDate();f++){let C=n["i"+Ee(f)],$=n["e"+Ee(f)];C===void 0&&(C=0),$===void 0&&($=0),p.push({label:Ee(f)}),_.push({label:C.toFixed(C<10?1:0),title:C.toFixed(2)+" kWh",value:C,label2:$.toFixed($<10?1:0),title2:$.toFixed(2)+" kWh",value2:$,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,$)),l(3,r=Math.max(r,C))}for(f=1;f{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,f=0,c=[],p=[],_=[];n.s&&n.s.forEach((v,g)=>{var T=v.n?v.n:v.a;f=v.v,f==-127&&(f=0),p.push({label:T.slice(-4)}),_.push({label:f.toFixed(1),value:f,color:"#7c3aed"}),l(3,r=Math.min(r,f)),l(2,o=Math.max(o,f))}),l(2,o=Math.ceil(o)),l(3,r=Math.floor(r));let b=o;r<0&&(b+=Math.abs(r));let d=b/4;for(a=0;a<5;a++)f=r+d*a,c.push({value:f,label:f.toFixed(1)});l(0,i={title:"Temperature sensors (°C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:r,max:o,ticks:c},x:{ticks:p},points:_})}},[i,n,o,r]}class Sp extends Me{constructor(e){super(),Se(this,e,Tp,$p,$e,{json:1})}}function Mp(t){let e,l;return e=new cn({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}let Np=0;function Pp(t,e,l){let n={},i=0,o;return Ic.subscribe(r=>{l(2,o=r)}),Ec(),t.$$.update=()=>{if(t.$$.dirty&6){let r=0,a=[],f=[],c=[];if(a.push({value:0,label:0}),o&&o.p)for(r=0;r0?Ee(p.d)+"."+Zs[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,p.v))}if(o&&o.t){for(r=0;r=i)break;a.push({value:p,label:p})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Np,max:i,ticks:a},x:{ticks:f},points:c})}},[n,i,o]}class Ap extends Me{constructor(e){super(),Se(this,e,Pp,Mp,$e,{})}}function Ea(t){let e,l,n,i,o,r,a=(t[0].mt?gs(t[0].mt):"-")+"",f,c,p,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,d,v;return i=new Oc({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:Tc}}),{c(){e=m("div"),l=m("div"),n=m("div"),Z(i.$$.fragment),o=h(),r=m("div"),f=y(a),c=h(),p=m("div"),b=y(_),d=y(" kWh"),u(n,"class","col-span-2"),u(p,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,T){w(g,e,T),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,r),s(r,f),s(l,c),s(l,p),s(p,b),s(p,d),v=!0},p(g,T){const C={};T&1&&(C.val=g[0].i?g[0].i:0),T&1&&(C.max=g[0].im?g[0].im:15e3),T&1&&(C.sub=g[0].p),T&1&&(C.subunit=g[0].pc),i.$set(C),(!v||T&1)&&a!==(a=(g[0].mt?gs(g[0].mt):"-")+"")&&G(f,a),(!v||T&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&G(b,_)},i(g){v||(N(i.$$.fragment,g),v=!0)},o(g){D(i.$$.fragment,g),v=!1},d(g){g&&k(e),X(i)}}}function Ia(t){let e,l,n,i,o,r,a,f,c=(t[0].ec?t[0].ec.toFixed(1):"-")+"",p,_,b;return i=new Oc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:pm}}),{c(){e=m("div"),l=m("div"),n=m("div"),Z(i.$$.fragment),o=h(),r=m("div"),a=h(),f=m("div"),p=y(c),_=y(" kWh"),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(d,v){w(d,e,v),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,r),s(l,a),s(l,f),s(f,p),s(f,_),b=!0},p(d,v){const g={};v&1&&(g.val=d[0].e?d[0].e:0),v&1&&(g.max=d[0].om?d[0].om*1e3:1e4),i.$set(g),(!b||v&1)&&c!==(c=(d[0].ec?d[0].ec.toFixed(1):"-")+"")&&G(p,c)},i(d){b||(N(i.$$.fragment,d),b=!0)},o(d){D(i.$$.fragment,d),b=!1},d(d){d&&k(e),X(i)}}}function Fa(t){let e,l,n;return l=new np({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.ds=i[0].ds),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function Ra(t){let e,l,n;return l=new op({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.i1=i[0].i1),o&1&&(r.i2=i[0].i2),o&1&&(r.i3=i[0].i3),o&1&&(r.max=i[0].mf?i[0].mf:32),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function La(t){let e,l,n;return l=new ap({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.importInstant=i[0].ri),o&1&&(r.exportInstant=i[0].re),o&1&&(r.importTotal=i[0].ric),o&1&&(r.exportTotal=i[0].rec),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function Ua(t){let e,l,n;return l=new _p({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"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&2&&(r.sysinfo=i[1]),o&1&&(r.data=i[0].ea),o&1&&(r.currency=i[0].pc),o&1&&(r.hasExport=i[0].om>0||i[0].e>0),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function Oa(t){let e,l,n;return l=new Ap({}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function qa(t){let e,l,n;return l=new hp({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&4&&(r.json=i[2]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function Ha(t){let e,l,n;return l=new kp({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&8&&(r.json=i[3]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function ja(t){let e,l,n;return l=new Cp({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&16&&(r.json=i[4]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function Wa(t){let e,l,n;return l=new Sp({props:{json:t[5]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&32&&(r.json=i[5]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function Dp(t){let e,l=Ye(t[1].ui.i,t[0].i),n,i=Ye(t[1].ui.e,t[0].om||t[0].e>0),o,r=Ye(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,f=Ye(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),c,p=Ye(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,b=Ye(t[1].ui.c,t[0].ea),d,v=Ye(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,T=Ye(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),C,$=Ye(t[1].ui.d,t[3]),M,E=Ye(t[1].ui.m,t[4]),S,A=Ye(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),I,F=l&&Ea(t),Y=i&&Ia(t),U=r&&Fa(t),H=f&&Ra(t),q=p&&La(t),z=b&&Ua(t),O=v&&Oa(),R=T&&qa(t),B=$&&Ha(t),L=E&&ja(t),j=A&&Wa(t);return{c(){e=m("div"),F&&F.c(),n=h(),Y&&Y.c(),o=h(),U&&U.c(),a=h(),H&&H.c(),c=h(),q&&q.c(),_=h(),z&&z.c(),d=h(),O&&O.c(),g=h(),R&&R.c(),C=h(),B&&B.c(),M=h(),L&&L.c(),S=h(),j&&j.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(W,te){w(W,e,te),F&&F.m(e,null),s(e,n),Y&&Y.m(e,null),s(e,o),U&&U.m(e,null),s(e,a),H&&H.m(e,null),s(e,c),q&&q.m(e,null),s(e,_),z&&z.m(e,null),s(e,d),O&&O.m(e,null),s(e,g),R&&R.m(e,null),s(e,C),B&&B.m(e,null),s(e,M),L&&L.m(e,null),s(e,S),j&&j.m(e,null),I=!0},p(W,[te]){te&3&&(l=Ye(W[1].ui.i,W[0].i)),l?F?(F.p(W,te),te&3&&N(F,1)):(F=Ea(W),F.c(),N(F,1),F.m(e,n)):F&&(Ae(),D(F,1,1,()=>{F=null}),De()),te&3&&(i=Ye(W[1].ui.e,W[0].om||W[0].e>0)),i?Y?(Y.p(W,te),te&3&&N(Y,1)):(Y=Ia(W),Y.c(),N(Y,1),Y.m(e,o)):Y&&(Ae(),D(Y,1,1,()=>{Y=null}),De()),te&3&&(r=Ye(W[1].ui.v,W[0].u1>100||W[0].u2>100||W[0].u3>100)),r?U?(U.p(W,te),te&3&&N(U,1)):(U=Fa(W),U.c(),N(U,1),U.m(e,a)):U&&(Ae(),D(U,1,1,()=>{U=null}),De()),te&3&&(f=Ye(W[1].ui.a,W[0].i1>.01||W[0].i2>.01||W[0].i3>.01)),f?H?(H.p(W,te),te&3&&N(H,1)):(H=Ra(W),H.c(),N(H,1),H.m(e,c)):H&&(Ae(),D(H,1,1,()=>{H=null}),De()),te&3&&(p=Ye(W[1].ui.r,W[0].ri>0||W[0].re>0||W[0].ric>0||W[0].rec>0)),p?q?(q.p(W,te),te&3&&N(q,1)):(q=La(W),q.c(),N(q,1),q.m(e,_)):q&&(Ae(),D(q,1,1,()=>{q=null}),De()),te&3&&(b=Ye(W[1].ui.c,W[0].ea)),b?z?(z.p(W,te),te&3&&N(z,1)):(z=Ua(W),z.c(),N(z,1),z.m(e,d)):z&&(Ae(),D(z,1,1,()=>{z=null}),De()),te&3&&(v=Ye(W[1].ui.t,W[0].pr&&(W[0].pr.startsWith("10YNO")||W[0].pr=="10Y1001A1001A48H"))),v?O?te&3&&N(O,1):(O=Oa(),O.c(),N(O,1),O.m(e,g)):O&&(Ae(),D(O,1,1,()=>{O=null}),De()),te&3&&(T=Ye(W[1].ui.p,W[0].pe&&!Number.isNaN(W[0].p))),T?R?(R.p(W,te),te&3&&N(R,1)):(R=qa(W),R.c(),N(R,1),R.m(e,C)):R&&(Ae(),D(R,1,1,()=>{R=null}),De()),te&10&&($=Ye(W[1].ui.d,W[3])),$?B?(B.p(W,te),te&10&&N(B,1)):(B=Ha(W),B.c(),N(B,1),B.m(e,M)):B&&(Ae(),D(B,1,1,()=>{B=null}),De()),te&18&&(E=Ye(W[1].ui.m,W[4])),E?L?(L.p(W,te),te&18&&N(L,1)):(L=ja(W),L.c(),N(L,1),L.m(e,S)):L&&(Ae(),D(L,1,1,()=>{L=null}),De()),te&35&&(A=Ye(W[1].ui.s,W[0].t&&W[0].t!=-127&&W[5].c>1)),A?j?(j.p(W,te),te&35&&N(j,1)):(j=Wa(W),j.c(),N(j,1),j.m(e,null)):j&&(Ae(),D(j,1,1,()=>{j=null}),De())},i(W){I||(N(F),N(Y),N(U),N(H),N(q),N(z),N(O),N(R),N(B),N(L),N(j),I=!0)},o(W){D(F),D(Y),D(U),D(H),D(q),D(z),D(O),D(R),D(B),D(L),D(j),I=!1},d(W){W&&k(e),F&&F.d(),Y&&Y.d(),U&&U.d(),H&&H.d(),q&&q.d(),z&&z.d(),O&&O.d(),R&&R.d(),B&&B.d(),L&&L.d(),j&&j.d()}}}function Ep(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},r={},a={},f={};return ho.subscribe(c=>{l(2,o=c)}),Nc.subscribe(c=>{l(3,r=c)}),Pc.subscribe(c=>{l(4,a=c)}),Dc.subscribe(c=>{l(5,f=c)}),t.$$set=c=>{"data"in c&&l(0,n=c.data),"sysinfo"in c&&l(1,i=c.sysinfo)},[n,i,o,r,a,f]}class Ip extends Me{constructor(e){super(),Se(this,e,Ep,Dp,$e,{data:0,sysinfo:1})}}let io={};const qc=rt(io);async function Fp(){io=await(await fetch("/configuration.json")).json(),qc.set(io)}function Ga(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Rp(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function Lp(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function Ba(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function za(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){w(i,e,o),w(i,l,o),w(i,n,o)},d(i){i&&k(e),i&&k(l),i&&k(n)}}}function Ya(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function Va(t){let e,l,n;return{c(){e=m("option"),l=y("GPIO"),n=y(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){w(i,e,o),s(e,l),s(e,n)},d(i){i&&k(e)}}}function Ka(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Va(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),w(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=Va(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&k(e)}}}function Up(t){let e,l,n,i,o;function r(v,g){return v[0]=="esp32c3"?Lp:Rp}let a=r(t),f=a(t),c=t[0]=="esp8266"&&Ba(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&za(),_=t[0]=="esp32s2"&&Ya(),b={length:t[1]+1},d=[];for(let v=0;v{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Hc extends Me{constructor(e){super(),Se(this,e,Op,Up,$e,{chip:0})}}function Qa(t){let e,l,n=t[1]&&Xa(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){w(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Xa(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&k(e),n&&n.d()}}}function Xa(t){let e,l;return{c(){e=m("div"),l=y(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){w(n,e,i),s(e,l)},p(n,i){i&2&&G(l,n[1])},d(n){n&&k(e)}}}function qp(t){let e,l=t[0]&&Qa(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),w(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Qa(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ne,o:ne,d(n){l&&l.d(n),n&&k(e)}}}function Hp(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class Et extends Me{constructor(e){super(),Se(this,e,Hp,qp,$e,{active:0,message:1})}}function Za(t,e,l){const n=t.slice();return n[1]=e[l],n}function Ja(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=y("Europe/"),i=y(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,r){w(o,e,r),s(e,l),s(e,i)},p:ne,d(o){o&&k(e)}}}function jp(t){let e,l,n,i=t[0],o=[];for(let r=0;r{r[p]=null}),De(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&k(n)}}}function Jp(t){let e,l;return e=new fl({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function xp(t){let e,l;return e=new fl({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function e0(t){let e,l,n,i;const o=[xp,Jp],r=[];function a(f,c){return f[3].q.s.r?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),w(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Ae(),D(r[p],1,1,()=>{r[p]=null}),De(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&k(n)}}}function t0(t){let e,l;return e=new fl({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function l0(t){let e,l;return e=new fl({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function n0(t){let e,l,n,i;const o=[l0,t0],r=[];function a(f,c){return f[3].q.s.k?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),w(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Ae(),D(r[p],1,1,()=>{r[p]=null}),De(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&k(n)}}}function cf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z,O,R,B;return o=new Ut({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),Z(o.$$.fragment),r=h(),a=m("input"),f=h(),c=m("div"),p=m("div"),_=y("Electricity IDX"),b=m("br"),d=h(),v=m("input"),g=h(),T=m("div"),C=y("Current IDX"),$=m("br"),M=h(),E=m("input"),S=h(),A=m("div"),I=y(`Voltage IDX: L1, L2 & L3 `),F=m("div"),Y=m("input"),U=h(),H=m("input"),q=h(),z=m("input"),u(l,"class","text-sm"),u(i,"href",Ot("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","o"),a.value="true",u(v,"name","oe"),u(v,"type","text"),u(v,"class","in-f tr w-full"),u(p,"class","w-1/2"),u(E,"name","oc"),u(E,"type","text"),u(E,"class","in-l tr w-full"),u(T,"class","w-1/2"),u(c,"class","my-1 flex"),u(Y,"name","ou1"),u(Y,"type","text"),u(Y,"class","in-f tr w-1/3"),u(H,"name","ou2"),u(H,"type","text"),u(H,"class","in-m tr w-1/3"),u(z,"name","ou3"),u(z,"type","text"),u(z,"class","in-l tr w-1/3"),u(F,"class","flex"),u(A,"class","my-1"),u(e,"class","cnt")},m(L,j){w(L,e,j),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c),s(c,p),s(p,_),s(p,b),s(p,d),s(p,v),V(v,t[3].o.e),s(c,g),s(c,T),s(T,C),s(T,$),s(T,M),s(T,E),V(E,t[3].o.c),s(e,S),s(e,A),s(A,I),s(A,F),s(F,Y),V(Y,t[3].o.u1),s(F,U),s(F,H),V(H,t[3].o.u2),s(F,q),s(F,z),V(z,t[3].o.u3),O=!0,R||(B=[K(v,"input",t[61]),K(E,"input",t[62]),K(Y,"input",t[63]),K(H,"input",t[64]),K(z,"input",t[65])],R=!0)},p(L,j){j[0]&8&&v.value!==L[3].o.e&&V(v,L[3].o.e),j[0]&8&&E.value!==L[3].o.c&&V(E,L[3].o.c),j[0]&8&&Y.value!==L[3].o.u1&&V(Y,L[3].o.u1),j[0]&8&&H.value!==L[3].o.u2&&V(H,L[3].o.u2),j[0]&8&&z.value!==L[3].o.u3&&V(z,L[3].o.u3)},i(L){O||(N(o.$$.fragment,L),O=!0)},o(L){D(o.$$.fragment,L),O=!1},d(L){L&&k(e),X(o),R=!1,Ke(B)}}}function mf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z;return o=new Ut({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),Z(o.$$.fragment),r=h(),a=m("input"),f=h(),c=m("div"),p=y("Discovery topic prefix"),_=m("br"),b=h(),d=m("input"),v=h(),g=m("div"),T=y("Hostname for URL"),C=m("br"),$=h(),M=m("input"),S=h(),A=m("div"),I=y("Name tag"),F=m("br"),Y=h(),U=m("input"),u(l,"class","text-sm"),u(i,"href",Ot("MQTT-configuration#home-assistant")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","h"),a.value="true",u(d,"name","ht"),u(d,"type","text"),u(d,"class","in-s"),u(d,"placeholder","homeassistant"),u(c,"class","my-1"),u(M,"name","hh"),u(M,"type","text"),u(M,"class","in-s"),u(M,"placeholder",E=t[3].g.h+".local"),u(g,"class","my-1"),u(U,"name","hn"),u(U,"type","text"),u(U,"class","in-s"),u(A,"class","my-1"),u(e,"class","cnt")},m(O,R){w(O,e,R),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c),s(c,p),s(c,_),s(c,b),s(c,d),V(d,t[3].h.t),s(e,v),s(e,g),s(g,T),s(g,C),s(g,$),s(g,M),V(M,t[3].h.h),s(e,S),s(e,A),s(A,I),s(A,F),s(A,Y),s(A,U),V(U,t[3].h.n),H=!0,q||(z=[K(d,"input",t[66]),K(M,"input",t[67]),K(U,"input",t[68])],q=!0)},p(O,R){R[0]&8&&d.value!==O[3].h.t&&V(d,O[3].h.t),(!H||R[0]&8&&E!==(E=O[3].g.h+".local"))&&u(M,"placeholder",E),R[0]&8&&M.value!==O[3].h.h&&V(M,O[3].h.h),R[0]&8&&U.value!==O[3].h.n&&V(U,O[3].h.n)},i(O){H||(N(o.$$.fragment,O),H=!0)},o(O){D(o.$$.fragment,O),H=!1},d(O){O&&k(e),X(o),q=!1,Ke(z)}}}function pf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M;o=new Ut({});let E={length:9},S=[];for(let A=0;A20&&hf(t),p=t[0].chip=="esp8266"&&kf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),Z(o.$$.fragment),r=h(),c&&c.c(),a=h(),p&&p.c(),u(l,"class","text-sm"),u(i,"href",Ot("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(_,b){w(_,e,b),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,r),c&&c.m(e,null),s(e,a),p&&p.m(e,null),f=!0},p(_,b){_[0].board>20?c?(c.p(_,b),b[0]&1&&N(c,1)):(c=hf(_),c.c(),N(c,1),c.m(e,a)):c&&(Ae(),D(c,1,1,()=>{c=null}),De()),_[0].chip=="esp8266"?p?p.p(_,b):(p=kf(_),p.c(),p.m(e,null)):p&&(p.d(1),p=null)},i(_){f||(N(o.$$.fragment,_),N(c),f=!0)},o(_){D(o.$$.fragment,_),D(c),f=!1},d(_){_&&k(e),X(o),c&&c.d(),p&&p.d()}}}function hf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z,O,R,B,L,j,W,te,le,pe,ie,Te,je,Pe,We,be,ke,Fe,ge,ae,we,J,se,Ie,Re,_e,ye,Ne,de,Ce,x;b=new Hc({props:{chip:t[0].chip}});let oe=t[0].chip!="esp8266"&&bf(t),Ue=t[3].i.v.p>0&&gf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=y("HAN"),r=m("label"),a=m("input"),f=y(" pullup"),c=m("br"),p=h(),_=m("select"),Z(b.$$.fragment),d=h(),v=m("div"),g=y("AP button"),T=m("br"),C=h(),$=m("input"),M=h(),E=m("div"),S=y("LED"),A=m("label"),I=m("input"),F=y(" inv"),Y=m("br"),U=h(),H=m("div"),q=m("input"),z=h(),O=m("div"),R=y("RGB"),B=m("label"),L=m("input"),j=y(" inverted"),W=m("br"),te=h(),le=m("div"),pe=m("input"),ie=h(),Te=m("input"),je=h(),Pe=m("input"),We=h(),be=m("div"),ke=y("Temperature"),Fe=m("br"),ge=h(),ae=m("input"),we=h(),J=m("div"),se=y("Analog temp"),Ie=m("br"),Re=h(),_e=m("input"),ye=h(),oe&&oe.c(),Ne=h(),Ue&&Ue.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(a,"name","ihu"),a.__value="true",a.value=a.__value,u(a,"type","checkbox"),u(a,"class","rounded mb-1"),u(r,"class","ml-2"),u(_,"name","ihp"),u(_,"class","in-f w-full"),t[3].i.h.p===void 0&<(()=>t[73].call(_)),u(i,"class","w-1/3"),u($,"name","ia"),u($,"type","number"),u($,"min","0"),u($,"max",t[6]),u($,"class","in-m tr w-full"),u(v,"class","w-1/3"),u(I,"name","ili"),I.__value="true",I.value=I.__value,u(I,"type","checkbox"),u(I,"class","rounded mb-1"),u(A,"class","ml-4"),u(q,"name","ilp"),u(q,"type","number"),u(q,"min","0"),u(q,"max",t[6]),u(q,"class","in-l tr w-full"),u(H,"class","flex"),u(E,"class","w-1/3"),u(L,"name","iri"),L.__value="true",L.value=L.__value,u(L,"type","checkbox"),u(L,"class","rounded mb-1"),u(B,"class","ml-4"),u(pe,"name","irr"),u(pe,"type","number"),u(pe,"min","0"),u(pe,"max",t[6]),u(pe,"class","in-f tr w-1/3"),u(Te,"name","irg"),u(Te,"type","number"),u(Te,"min","0"),u(Te,"max",t[6]),u(Te,"class","in-m tr w-1/3"),u(Pe,"name","irb"),u(Pe,"type","number"),u(Pe,"min","0"),u(Pe,"max",t[6]),u(Pe,"class","in-l tr w-1/3"),u(le,"class","flex"),u(O,"class","w-full"),u(ae,"name","itd"),u(ae,"type","number"),u(ae,"min","0"),u(ae,"max",t[6]),u(ae,"class","in-f tr w-full"),u(be,"class","my-1 w-1/3"),u(_e,"name","ita"),u(_e,"type","number"),u(_e,"min","0"),u(_e,"max",t[6]),u(_e,"class","in-l tr w-full"),u(J,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(ue,ve){w(ue,e,ve),w(ue,l,ve),w(ue,n,ve),s(n,i),s(i,o),s(i,r),s(r,a),a.checked=t[3].i.h.u,s(r,f),s(i,c),s(i,p),s(i,_),Q(b,_,null),Le(_,t[3].i.h.p,!0),s(n,d),s(n,v),s(v,g),s(v,T),s(v,C),s(v,$),V($,t[3].i.a),s(n,M),s(n,E),s(E,S),s(E,A),s(A,I),I.checked=t[3].i.l.i,s(A,F),s(E,Y),s(E,U),s(E,H),s(H,q),V(q,t[3].i.l.p),s(n,z),s(n,O),s(O,R),s(O,B),s(B,L),L.checked=t[3].i.r.i,s(B,j),s(O,W),s(O,te),s(O,le),s(le,pe),V(pe,t[3].i.r.r),s(le,ie),s(le,Te),V(Te,t[3].i.r.g),s(le,je),s(le,Pe),V(Pe,t[3].i.r.b),s(n,We),s(n,be),s(be,ke),s(be,Fe),s(be,ge),s(be,ae),V(ae,t[3].i.t.d),s(n,we),s(n,J),s(J,se),s(J,Ie),s(J,Re),s(J,_e),V(_e,t[3].i.t.a),s(n,ye),oe&&oe.m(n,null),s(n,Ne),Ue&&Ue.m(n,null),de=!0,Ce||(x=[K(a,"change",t[72]),K(_,"change",t[73]),K($,"input",t[74]),K(I,"change",t[75]),K(q,"input",t[76]),K(L,"change",t[77]),K(pe,"input",t[78]),K(Te,"input",t[79]),K(Pe,"input",t[80]),K(ae,"input",t[81]),K(_e,"input",t[82])],Ce=!0)},p(ue,ve){ve[0]&8&&(a.checked=ue[3].i.h.u);const dt={};ve[0]&1&&(dt.chip=ue[0].chip),b.$set(dt),ve[0]&8&&Le(_,ue[3].i.h.p),(!de||ve[0]&64)&&u($,"max",ue[6]),ve[0]&8&&fe($.value)!==ue[3].i.a&&V($,ue[3].i.a),ve[0]&8&&(I.checked=ue[3].i.l.i),(!de||ve[0]&64)&&u(q,"max",ue[6]),ve[0]&8&&fe(q.value)!==ue[3].i.l.p&&V(q,ue[3].i.l.p),ve[0]&8&&(L.checked=ue[3].i.r.i),(!de||ve[0]&64)&&u(pe,"max",ue[6]),ve[0]&8&&fe(pe.value)!==ue[3].i.r.r&&V(pe,ue[3].i.r.r),(!de||ve[0]&64)&&u(Te,"max",ue[6]),ve[0]&8&&fe(Te.value)!==ue[3].i.r.g&&V(Te,ue[3].i.r.g),(!de||ve[0]&64)&&u(Pe,"max",ue[6]),ve[0]&8&&fe(Pe.value)!==ue[3].i.r.b&&V(Pe,ue[3].i.r.b),(!de||ve[0]&64)&&u(ae,"max",ue[6]),ve[0]&8&&fe(ae.value)!==ue[3].i.t.d&&V(ae,ue[3].i.t.d),(!de||ve[0]&64)&&u(_e,"max",ue[6]),ve[0]&8&&fe(_e.value)!==ue[3].i.t.a&&V(_e,ue[3].i.t.a),ue[0].chip!="esp8266"?oe?oe.p(ue,ve):(oe=bf(ue),oe.c(),oe.m(n,Ne)):oe&&(oe.d(1),oe=null),ue[3].i.v.p>0?Ue?Ue.p(ue,ve):(Ue=gf(ue),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null)},i(ue){de||(N(b.$$.fragment,ue),de=!0)},o(ue){D(b.$$.fragment,ue),de=!1},d(ue){ue&&k(e),ue&&k(l),ue&&k(n),X(b),oe&&oe.d(),Ue&&Ue.d(),Ce=!1,Ke(x)}}}function bf(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=y("Vcc"),n=m("br"),i=h(),o=m("input"),u(o,"name","ivp"),u(o,"type","number"),u(o,"min","0"),u(o,"max",t[6]),u(o,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(f,c){w(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].i.v.p),r||(a=K(o,"input",t[83]),r=!0)},p(f,c){c[0]&64&&u(o,"max",f[6]),c[0]&8&&fe(o.value)!==f[3].i.v.p&&V(o,f[3].i.v.p)},d(f){f&&k(e),r=!1,a()}}}function gf(t){let e,l,n,i,o,r,a,f,c,p;return{c(){e=m("div"),l=y("Voltage divider"),n=m("br"),i=h(),o=m("div"),r=m("input"),a=h(),f=m("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"placeholder","VCC"),u(f,"name","ivdg"),u(f,"type","number"),u(f,"min","0"),u(f,"max","65535"),u(f,"class","in-l tr w-full"),u(f,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(_,b){w(_,e,b),s(e,l),s(e,n),s(e,i),s(e,o),s(o,r),V(r,t[3].i.v.d.v),s(o,a),s(o,f),V(f,t[3].i.v.d.g),c||(p=[K(r,"input",t[84]),K(f,"input",t[85])],c=!0)},p(_,b){b[0]&8&&fe(r.value)!==_[3].i.v.d.v&&V(r,_[3].i.v.d.v),b[0]&8&&fe(f.value)!==_[3].i.v.d.g&&V(f,_[3].i.v.d.g)},d(_){_&&k(e),c=!1,Ke(p)}}}function kf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$=(t[0].board==2||t[0].board==100)&&wf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=y("Vcc offset"),r=m("br"),a=h(),f=m("input"),c=h(),p=m("div"),_=y("Multiplier"),b=m("br"),d=h(),v=m("input"),g=h(),$&&$.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(f,"name","ivo"),u(f,"type","number"),u(f,"min","0.0"),u(f,"max","3.5"),u(f,"step","0.01"),u(f,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(v,"name","ivm"),u(v,"type","number"),u(v,"min","0.1"),u(v,"max","10"),u(v,"step","0.01"),u(v,"class","in-l tr w-full"),u(p,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(M,E){w(M,e,E),w(M,l,E),w(M,n,E),s(n,i),s(i,o),s(i,r),s(i,a),s(i,f),V(f,t[3].i.v.o),s(n,c),s(n,p),s(p,_),s(p,b),s(p,d),s(p,v),V(v,t[3].i.v.m),s(n,g),$&&$.m(n,null),T||(C=[K(f,"input",t[86]),K(v,"input",t[87])],T=!0)},p(M,E){E[0]&8&&fe(f.value)!==M[3].i.v.o&&V(f,M[3].i.v.o),E[0]&8&&fe(v.value)!==M[3].i.v.m&&V(v,M[3].i.v.m),M[0].board==2||M[0].board==100?$?$.p(M,E):($=wf(M),$.c(),$.m(n,null)):$&&($.d(1),$=null)},d(M){M&&k(e),M&&k(l),M&&k(n),$&&$.d(),T=!1,Ke(C)}}}function wf(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=y("Boot limit"),n=m("br"),i=h(),o=m("input"),u(o,"name","ivb"),u(o,"type","number"),u(o,"min","2.5"),u(o,"max","3.5"),u(o,"step","0.1"),u(o,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(f,c){w(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].i.v.b),r||(a=K(o,"input",t[88]),r=!0)},p(f,c){c[0]&8&&fe(o.value)!==f[3].i.v.b&&V(o,f[3].i.v.b)},d(f){f&&k(e),r=!1,a()}}}function yf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C=t[3].d.t&&Cf();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),o=m("input"),r=y(" Enable telnet"),a=h(),C&&C.c(),f=h(),c=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",b=m("option"),b.textContent="Debug",d=m("option"),d.textContent="Info",v=m("option"),v.textContent="Warning",u(e,"class","bd-red"),u(o,"type","checkbox"),u(o,"name","dt"),o.__value="true",o.value=o.__value,u(o,"class","rounded mb-1"),u(n,"class","my-1"),_.__value=1,_.value=_.__value,b.__value=2,b.value=b.__value,d.__value=3,d.value=d.__value,v.__value=4,v.value=v.__value,u(p,"name","dl"),u(p,"class","in-s"),t[3].d.l===void 0&<(()=>t[91].call(p)),u(c,"class","my-1")},m($,M){w($,e,M),w($,l,M),w($,n,M),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,r),w($,a,M),C&&C.m($,M),w($,f,M),w($,c,M),s(c,p),s(p,_),s(p,b),s(p,d),s(p,v),Le(p,t[3].d.l,!0),g||(T=[K(o,"change",t[90]),K(p,"change",t[91])],g=!0)},p($,M){M[0]&8&&(o.checked=$[3].d.t),$[3].d.t?C||(C=Cf(),C.c(),C.m(f.parentNode,f)):C&&(C.d(1),C=null),M[0]&8&&Le(p,$[3].d.l)},d($){$&&k(e),$&&k(l),$&&k(n),$&&k(a),C&&C.d($),$&&k(f),$&&k(c),g=!1,Ke(T)}}}function Cf(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function i0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z,O,R,B,L,j,W,te,le,pe,ie,Te,je,Pe,We,be,ke,Fe,ge,ae,we,J,se,Ie,Re,_e,ye,Ne,de,Ce,x,oe,Ue,ue,ve,dt,jl,xt,ct,Ml,pl,Ht,vt,Qe,Xe,Ze,Oe,Je,Be,xe,et,re,he,Pi,_l,mn,Mt,Ai,Di,Ei,dl,Ii,Fi,Ri,Nt,Nl,ze,vl,Wl,Cs,He,el,Li,Pl,pn,yo,fi,Co,tl,Ui,$o,$s,To,ci,jt,So,Mo,Al,ll,Dl,No,Oi,Po,mt,El,Ao,qi,_n,dn,vn,hn,Hi,Do,It,Eo,Gl,Io,Fo,Ro,nl,bn,gn,Lo,kn,Bl,Uo,Oo,qo,wn,Wt,Ho,ji,jo,zl,Wo,Go,Bo,yn,Gt,zo,Wi,Yo,Ts,Vo,Yl,Gi,Bt,Ko,Qo,Xo,Ss,Bi,zt,Zo,Jo,xo,tt,zi,eu,Cn,$n,tu,mi,lu,Vl,nu,iu,su,hl,ou,Kl,uu,ru,au,bl,fu,Tn,Ql,cu,mu,pu,Ft,Sn,Mn,Nn,Pn,_u,Xl,du,vu,hu,An,Rt,bu,Yi,gu,Vi,Ki,Yt,ku,wu,yu,at,Qi,Cu,Dn,En,$u,Zl,Tu,Su,Mu,Il,il,In,Fn,Nu,Pt,Xi,Zi,Pu,At,Rn,Ji,xi,Au,Ms,es,ts,Vt,Du,Eu,pi,Iu,Fl,Fu,_i,Kt,Ru,Lu,Uu,ls,gl,Ou,Ve,ns,qu,Ln,Un,Hu,di,ju,sl,Wu,Ns,Gu,Bu,On,kl,zu,Qt,Yu,Ps,Jl,Vu,Ku,Qu,wl,Xu,xl,Zu,Ju,xu,yl,er,qn,Hn,tr,lr,nr,Cl,ir,jn,sr,or,ur,ht,Wn,Gn,Bn,zn,Yn,Vn,rr,en,ar,fr,cr,$l,mr,As,Ds,Es=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Is,ol,is,pr,Kn,Qn,_r,vi,dr,hi,vr,Fs,Dt,ss,hr,Xn,Zn,br,bi,gr,os,us,Xt,kr,wr,yr,Rl,Rs,Jn,Cr,rs,xn,$r,as,Ls,tn,Us,ln,Os,nn,qs,sn,Zt,Hs,Tr;a=new Ut({}),F=new Gp({});let Wc=["NOK","SEK","DKK","EUR"],gi=[];for(let P=0;P<4;P+=1)gi[P]=Vp(Yp(t,Wc,P));let bt=t[3].p.e&&t[0].chip!="esp8266"&&tf(t),gt=t[3].g.s>0&&lf(t);pn=new Ut({});let Gc=[24,48,96,192,384,576,1152],ki=[];for(let P=0;P<7;P+=1)ki[P]=Kp(zp(t,Gc,P));let kt=t[3].m.e.e&&nf(t),wt=t[3].m.e.e&&sf(t),yt=t[3].m.m.e&&of(t);$n=new Ut({});let Ct=t[0].chip!="esp8266"&&uf(t);En=new Ut({}),Rn=new jc({});let $t=t[3].n.m=="static"&&rf(t);Un=new Ut({});let Tt=t[0].chip!="esp8266"&&af(t),nt=t[3].q.s.e&&ff(t),it=t[3].q.m==3&&cf(t),st=t[3].q.m==4&&mf(t),ot=Es&&pf(t);Qn=new Ut({});let ei=t[7],pt=[];for(let P=0;P20||t[0].chip=="esp8266")&&vf(t);Zn=new Ut({});let St=t[3].d.s&&yf(t);return tn=new Et({props:{active:t[1],message:"Loading configuration"}}),ln=new Et({props:{active:t[2],message:"Saving configuration"}}),nn=new Et({props:{active:t[4],message:"Performing factory reset"}}),sn=new Et({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=h(),r=m("a"),Z(a.$$.fragment),f=h(),c=m("input"),p=h(),_=m("div"),b=m("div"),d=m("div"),v=y("Hostname"),g=m("br"),T=h(),C=m("input"),$=h(),M=m("div"),E=y("Time zone"),S=m("br"),A=h(),I=m("select"),Z(F.$$.fragment),Y=h(),U=m("input"),H=h(),q=m("div"),z=m("div"),O=m("div"),R=y("Price region"),B=m("br"),L=h(),j=m("select"),W=m("optgroup"),te=m("option"),te.textContent="NO1",le=m("option"),le.textContent="NO2",pe=m("option"),pe.textContent="NO3",ie=m("option"),ie.textContent="NO4",Te=m("option"),Te.textContent="NO5",je=m("optgroup"),Pe=m("option"),Pe.textContent="SE1",We=m("option"),We.textContent="SE2",be=m("option"),be.textContent="SE3",ke=m("option"),ke.textContent="SE4",Fe=m("optgroup"),ge=m("option"),ge.textContent="DK1",ae=m("option"),ae.textContent="DK2",we=m("option"),we.textContent="Austria",J=m("option"),J.textContent="Belgium",se=m("option"),se.textContent="Czech Republic",Ie=m("option"),Ie.textContent="Estonia",Re=m("option"),Re.textContent="Finland",_e=m("option"),_e.textContent="France",ye=m("option"),ye.textContent="Germany",Ne=m("option"),Ne.textContent="Great Britain",de=m("option"),de.textContent="Latvia",Ce=m("option"),Ce.textContent="Lithuania",x=m("option"),x.textContent="Netherland",oe=m("option"),oe.textContent="Poland",Ue=m("option"),Ue.textContent="Switzerland",ue=h(),ve=m("div"),dt=y("Currency"),jl=m("br"),xt=h(),ct=m("select");for(let P=0;P<4;P+=1)gi[P].c();Ml=h(),pl=m("div"),Ht=m("div"),vt=m("div"),Qe=y("Fixed price"),Xe=m("br"),Ze=h(),Oe=m("input"),Je=h(),Be=m("div"),xe=y("Multiplier"),et=m("br"),re=h(),he=m("input"),Pi=h(),_l=m("div"),mn=m("label"),Mt=m("input"),Ai=y(" Enable price fetch from remote server"),Di=h(),bt&&bt.c(),Ei=h(),dl=m("div"),Ii=y("Security"),Fi=m("br"),Ri=h(),Nt=m("select"),Nl=m("option"),Nl.textContent="None",ze=m("option"),ze.textContent="Only configuration",vl=m("option"),vl.textContent="Everything",Wl=h(),gt&>.c(),Cs=h(),He=m("div"),el=m("strong"),el.textContent="Meter",Li=h(),Pl=m("a"),Z(pn.$$.fragment),yo=h(),fi=m("input"),Co=h(),tl=m("div"),Ui=m("span"),Ui.textContent="Buffer size",$o=h(),$s=m("span"),$s.textContent="Serial conf.",To=h(),ci=m("label"),jt=m("input"),So=y(" inverted"),Mo=h(),Al=m("div"),ll=m("select"),Dl=m("option"),No=y("Autodetect");for(let P=0;P<7;P+=1)ki[P].c();Po=h(),mt=m("select"),El=m("option"),Ao=y("-"),_n=m("option"),_n.textContent="7N1",dn=m("option"),dn.textContent="8N1",vn=m("option"),vn.textContent="7E1",hn=m("option"),hn.textContent="8E1",Do=h(),It=m("input"),Eo=h(),Gl=m("div"),Io=y("Voltage"),Fo=m("br"),Ro=h(),nl=m("select"),bn=m("option"),bn.textContent="400V (TN)",gn=m("option"),gn.textContent="230V (IT/TT)",Lo=h(),kn=m("div"),Bl=m("div"),Uo=y("Main fuse"),Oo=m("br"),qo=h(),wn=m("label"),Wt=m("input"),Ho=h(),ji=m("span"),ji.textContent="A",jo=h(),zl=m("div"),Wo=y("Production"),Go=m("br"),Bo=h(),yn=m("label"),Gt=m("input"),zo=h(),Wi=m("span"),Wi.textContent="kWp",Yo=h(),Ts=m("div"),Vo=h(),Yl=m("div"),Gi=m("label"),Bt=m("input"),Ko=y(" Meter is encrypted"),Qo=h(),kt&&kt.c(),Xo=h(),wt&&wt.c(),Ss=h(),Bi=m("label"),zt=m("input"),Zo=y(" Multipliers"),Jo=h(),yt&&yt.c(),xo=h(),tt=m("div"),zi=m("strong"),zi.textContent="WiFi",eu=h(),Cn=m("a"),Z($n.$$.fragment),tu=h(),mi=m("input"),lu=h(),Vl=m("div"),nu=y("SSID"),iu=m("br"),su=h(),hl=m("input"),ou=h(),Kl=m("div"),uu=y("Password"),ru=m("br"),au=h(),bl=m("input"),fu=h(),Tn=m("div"),Ql=m("div"),cu=y("Power saving"),mu=m("br"),pu=h(),Ft=m("select"),Sn=m("option"),Sn.textContent="Default",Mn=m("option"),Mn.textContent="Off",Nn=m("option"),Nn.textContent="Minimum",Pn=m("option"),Pn.textContent="Maximum",_u=h(),Xl=m("div"),du=y("Power"),vu=m("br"),hu=h(),An=m("div"),Rt=m("input"),bu=h(),Yi=m("span"),Yi.textContent="dBm",gu=h(),Vi=m("div"),Ki=m("label"),Yt=m("input"),ku=y(" Auto reboot on connection problem"),wu=h(),Ct&&Ct.c(),yu=h(),at=m("div"),Qi=m("strong"),Qi.textContent="Network",Cu=h(),Dn=m("a"),Z(En.$$.fragment),$u=h(),Zl=m("div"),Tu=y("IP"),Su=m("br"),Mu=h(),Il=m("div"),il=m("select"),In=m("option"),In.textContent="DHCP",Fn=m("option"),Fn.textContent="Static",Nu=h(),Pt=m("input"),Pu=h(),At=m("select"),Z(Rn.$$.fragment),Au=h(),$t&&$t.c(),Ms=h(),es=m("div"),ts=m("label"),Vt=m("input"),Du=y(" enable mDNS"),Eu=h(),pi=m("input"),Iu=h(),Fl=m("div"),Fu=y("NTP "),_i=m("label"),Kt=m("input"),Ru=y(" obtain from DHCP"),Lu=m("br"),Uu=h(),ls=m("div"),gl=m("input"),Ou=h(),Ve=m("div"),ns=m("strong"),ns.textContent="MQTT",qu=h(),Ln=m("a"),Z(Un.$$.fragment),Hu=h(),di=m("input"),ju=h(),sl=m("div"),Wu=y(`Server `),Tt&&Tt.c(),Ns=h(),Gu=m("br"),Bu=h(),On=m("div"),kl=m("input"),zu=h(),Qt=m("input"),Yu=h(),nt&&nt.c(),Ps=h(),Jl=m("div"),Vu=y("Username"),Ku=m("br"),Qu=h(),wl=m("input"),Xu=h(),xl=m("div"),Zu=y("Password"),Ju=m("br"),xu=h(),yl=m("input"),er=h(),qn=m("div"),Hn=m("div"),tr=y("Client ID"),lr=m("br"),nr=h(),Cl=m("input"),ir=h(),jn=m("div"),sr=y("Payload"),or=m("br"),ur=h(),ht=m("select"),Wn=m("option"),Wn.textContent="JSON",Gn=m("option"),Gn.textContent="Raw (minimal)",Bn=m("option"),Bn.textContent="Raw (full)",zn=m("option"),zn.textContent="Domoticz",Yn=m("option"),Yn.textContent="HomeAssistant",Vn=m("option"),Vn.textContent="HEX dump",rr=h(),en=m("div"),ar=y("Publish topic"),fr=m("br"),cr=h(),$l=m("input"),mr=h(),it&&it.c(),As=h(),st&&st.c(),Ds=h(),ot&&ot.c(),Is=h(),ol=m("div"),is=m("strong"),is.textContent="User interface",pr=h(),Kn=m("a"),Z(Qn.$$.fragment),_r=h(),vi=m("input"),dr=h(),hi=m("div");for(let P=0;PSave',Ls=h(),Z(tn.$$.fragment),Us=h(),Z(ln.$$.fragment),Os=h(),Z(nn.$$.fragment),qs=h(),Z(sn.$$.fragment),u(i,"class","text-sm"),u(r,"href",Ot("General-configuration")),u(r,"target","_blank"),u(r,"class","float-right"),u(c,"type","hidden"),u(c,"name","g"),c.value="true",u(C,"name","gh"),u(C,"type","text"),u(C,"class","in-f w-full"),u(C,"pattern","[A-Za-z0-9-]+"),u(I,"name","gt"),u(I,"class","in-l w-full"),t[3].g.t===void 0&<(()=>t[13].call(I)),u(b,"class","flex"),u(_,"class","my-1"),u(U,"type","hidden"),u(U,"name","p"),U.value="true",te.__value="10YNO-1--------2",te.value=te.__value,le.__value="10YNO-2--------T",le.value=le.__value,pe.__value="10YNO-3--------J",pe.value=pe.__value,ie.__value="10YNO-4--------9",ie.value=ie.__value,Te.__value="10Y1001A1001A48H",Te.value=Te.__value,u(W,"label","Norway"),Pe.__value="10Y1001A1001A44P",Pe.value=Pe.__value,We.__value="10Y1001A1001A45N",We.value=We.__value,be.__value="10Y1001A1001A46L",be.value=be.__value,ke.__value="10Y1001A1001A47J",ke.value=ke.__value,u(je,"label","Sweden"),ge.__value="10YDK-1--------W",ge.value=ge.__value,ae.__value="10YDK-2--------M",ae.value=ae.__value,u(Fe,"label","Denmark"),we.__value="10YAT-APG------L",we.value=we.__value,J.__value="10YBE----------2",J.value=J.__value,se.__value="10YCZ-CEPS-----N",se.value=se.__value,Ie.__value="10Y1001A1001A39I",Ie.value=Ie.__value,Re.__value="10YFI-1--------U",Re.value=Re.__value,_e.__value="10YFR-RTE------C",_e.value=_e.__value,ye.__value="10Y1001A1001A83F",ye.value=ye.__value,Ne.__value="10YGB----------A",Ne.value=Ne.__value,de.__value="10YLV-1001A00074",de.value=de.__value,Ce.__value="10YLT-1001A0008Q",Ce.value=Ce.__value,x.__value="10YNL----------L",x.value=x.__value,oe.__value="10YPL-AREA-----S",oe.value=oe.__value,Ue.__value="10YCH-SWISSGRIDZ",Ue.value=Ue.__value,u(j,"name","pr"),u(j,"class","in-f w-full"),t[3].p.r===void 0&<(()=>t[14].call(j)),u(O,"class","w-full"),u(ct,"name","pc"),u(ct,"class","in-l"),t[3].p.c===void 0&<(()=>t[15].call(ct)),u(z,"class","flex"),u(q,"class","my-1"),u(Oe,"name","pf"),u(Oe,"type","number"),u(Oe,"min","0.001"),u(Oe,"max","65"),u(Oe,"step","0.001"),u(Oe,"class","in-f tr w-full"),u(vt,"class","w-1/2"),u(he,"name","pm"),u(he,"type","number"),u(he,"min","0.001"),u(he,"max","1000"),u(he,"step","0.001"),u(he,"class","in-l tr w-full"),u(Be,"class","w-1/2"),u(Ht,"class","flex"),u(pl,"class","my-1"),u(Mt,"type","checkbox"),u(Mt,"name","pe"),Mt.__value="true",Mt.value=Mt.__value,u(Mt,"class","rounded mb-1"),u(_l,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,ze.__value=1,ze.value=ze.__value,vl.__value=2,vl.value=vl.__value,u(Nt,"name","gs"),u(Nt,"class","in-s"),t[3].g.s===void 0&<(()=>t[20].call(Nt)),u(dl,"class","my-1"),u(n,"class","cnt"),u(el,"class","text-sm"),u(Pl,"href",Ot("Meter-configuration")),u(Pl,"target","_blank"),u(Pl,"class","float-right"),u(fi,"type","hidden"),u(fi,"name","m"),fi.value="true",u(Ui,"class","float-right"),u(jt,"name","mi"),jt.__value="true",jt.value=jt.__value,u(jt,"type","checkbox"),u(jt,"class","rounded mb-1"),u(ci,"class","mt-2 ml-3 whitespace-nowrap"),Dl.__value=0,Dl.value=Dl.__value,Dl.disabled=Oi=t[3].m.b!=0,u(ll,"name","mb"),u(ll,"class","in-f tr w-1/2"),t[3].m.b===void 0&<(()=>t[24].call(ll)),El.__value=0,El.value=El.__value,El.disabled=qi=t[3].m.b!=0,_n.__value=2,_n.value=_n.__value,dn.__value=3,dn.value=dn.__value,vn.__value=10,vn.value=vn.__value,hn.__value=11,hn.value=hn.__value,u(mt,"name","mp"),u(mt,"class","in-m"),mt.disabled=Hi=t[3].m.b==0,t[3].m.p===void 0&<(()=>t[25].call(mt)),u(It,"name","ms"),u(It,"type","number"),u(It,"min",64),u(It,"max",4096),u(It,"step",64),u(It,"class","in-l tr w-1/2"),u(Al,"class","flex w-full"),u(tl,"class","my-1"),bn.__value=2,bn.value=bn.__value,gn.__value=1,gn.value=gn.__value,u(nl,"name","md"),u(nl,"class","in-s"),t[3].m.d===void 0&<(()=>t[27].call(nl)),u(Gl,"class","my-1"),u(Wt,"name","mf"),u(Wt,"type","number"),u(Wt,"min","5"),u(Wt,"max","65535"),u(Wt,"class","in-f tr w-full"),u(ji,"class","in-post"),u(wn,"class","flex"),u(Bl,"class","mx-1"),u(Gt,"name","mr"),u(Gt,"type","number"),u(Gt,"min","0"),u(Gt,"max","65535"),u(Gt,"class","in-f tr w-full"),u(Wi,"class","in-post"),u(yn,"class","flex"),u(zl,"class","mx-1"),u(kn,"class","my-1 flex"),u(Ts,"class","my-1"),u(Bt,"type","checkbox"),u(Bt,"name","me"),Bt.__value="true",Bt.value=Bt.__value,u(Bt,"class","rounded mb-1"),u(Yl,"class","my-1"),u(zt,"type","checkbox"),u(zt,"name","mm"),zt.__value="true",zt.value=zt.__value,u(zt,"class","rounded mb-1"),u(He,"class","cnt"),u(zi,"class","text-sm"),u(Cn,"href",Ot("WiFi-configuration")),u(Cn,"target","_blank"),u(Cn,"class","float-right"),u(mi,"type","hidden"),u(mi,"name","w"),mi.value="true",u(hl,"name","ws"),u(hl,"type","text"),u(hl,"class","in-s"),u(Vl,"class","my-1"),u(bl,"name","wp"),u(bl,"type","password"),u(bl,"class","in-s"),u(Kl,"class","my-1"),Sn.__value=255,Sn.value=Sn.__value,Mn.__value=0,Mn.value=Mn.__value,Nn.__value=1,Nn.value=Nn.__value,Pn.__value=2,Pn.value=Pn.__value,u(Ft,"name","wz"),u(Ft,"class","in-s"),t[3].w.z===void 0&<(()=>t[40].call(Ft)),u(Ql,"class","w-1/2"),u(Rt,"name","ww"),u(Rt,"type","number"),u(Rt,"min","0"),u(Rt,"max","20.5"),u(Rt,"step","0.5"),u(Rt,"class","in-f tr w-full"),u(Yi,"class","in-post"),u(An,"class","flex"),u(Xl,"class","ml-2 w-1/2"),u(Tn,"class","my-1 flex"),u(Yt,"type","checkbox"),u(Yt,"name","wa"),Yt.__value="true",Yt.value=Yt.__value,u(Yt,"class","rounded mb-1"),u(Vi,"class","my-3"),u(tt,"class","cnt"),u(Qi,"class","text-sm"),u(Dn,"href",Ot("Network-configuration")),u(Dn,"target","_blank"),u(Dn,"class","float-right"),In.__value="dhcp",In.value=In.__value,Fn.__value="static",Fn.value=Fn.__value,u(il,"name","nm"),u(il,"class","in-f"),t[3].n.m===void 0&<(()=>t[44].call(il)),u(Pt,"name","ni"),u(Pt,"type","text"),u(Pt,"class","in-m w-full"),Pt.disabled=Xi=t[3].n.m=="dhcp",Pt.required=Zi=t[3].n.m=="static",u(At,"name","ns"),u(At,"class","in-l"),At.disabled=Ji=t[3].n.m=="dhcp",At.required=xi=t[3].n.m=="static",t[3].n.s===void 0&<(()=>t[46].call(At)),u(Il,"class","flex"),u(Zl,"class","my-1"),u(Vt,"name","nd"),Vt.__value="true",Vt.value=Vt.__value,u(Vt,"type","checkbox"),u(Vt,"class","rounded mb-1"),u(es,"class","my-1"),u(pi,"type","hidden"),u(pi,"name","ntp"),pi.value="true",u(Kt,"name","ntpd"),Kt.__value="true",Kt.value=Kt.__value,u(Kt,"type","checkbox"),u(Kt,"class","rounded mb-1"),u(_i,"class","ml-4"),u(gl,"name","ntph"),u(gl,"type","text"),u(gl,"class","in-s"),u(ls,"class","flex"),u(Fl,"class","my-1"),u(at,"class","cnt"),u(ns,"class","text-sm"),u(Ln,"href",Ot("MQTT-configuration")),u(Ln,"target","_blank"),u(Ln,"class","float-right"),u(di,"type","hidden"),u(di,"name","q"),di.value="true",u(kl,"name","qh"),u(kl,"type","text"),u(kl,"class","in-f w-3/4"),u(Qt,"name","qp"),u(Qt,"type","number"),u(Qt,"min","1024"),u(Qt,"max","65535"),u(Qt,"class","in-l tr w-1/4"),u(On,"class","flex"),u(sl,"class","my-1"),u(wl,"name","qu"),u(wl,"type","text"),u(wl,"class","in-s"),u(Jl,"class","my-1"),u(yl,"name","qa"),u(yl,"type","password"),u(yl,"class","in-s"),u(xl,"class","my-1"),u(Cl,"name","qc"),u(Cl,"type","text"),u(Cl,"class","in-f w-full"),Wn.__value=0,Wn.value=Wn.__value,Gn.__value=1,Gn.value=Gn.__value,Bn.__value=2,Bn.value=Bn.__value,zn.__value=3,zn.value=zn.__value,Yn.__value=4,Yn.value=Yn.__value,Vn.__value=255,Vn.value=Vn.__value,u(ht,"name","qm"),u(ht,"class","in-l"),t[3].q.m===void 0&<(()=>t[59].call(ht)),u(qn,"class","my-1 flex"),u($l,"name","qb"),u($l,"type","text"),u($l,"class","in-s"),u(en,"class","my-1"),u(Ve,"class","cnt"),u(is,"class","text-sm"),u(Kn,"href",Ot("User-interface")),u(Kn,"target","_blank"),u(Kn,"class","float-right"),u(vi,"type","hidden"),u(vi,"name","u"),vi.value="true",u(hi,"class","flex flex-wrap"),u(ol,"class","cnt"),u(ss,"class","text-sm"),u(Xn,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(Xn,"target","_blank"),u(Xn,"class","float-right"),u(bi,"type","hidden"),u(bi,"name","d"),bi.value="true",u(Xt,"type","checkbox"),u(Xt,"name","ds"),Xt.__value="true",Xt.value=Xt.__value,u(Xt,"class","rounded mb-1"),u(os,"class","mt-3"),u(Dt,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(Jn,"type","button"),u(Jn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),u(xn,"type","button"),u(xn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(rs,"class","text-center"),u(as,"class","text-right"),u(Rl,"class","grid grid-cols-3"),u(e,"autocomplete","off")},m(P,ee){w(P,e,ee),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),Q(a,r,null),s(n,f),s(n,c),s(n,p),s(n,_),s(_,b),s(b,d),s(d,v),s(d,g),s(d,T),s(d,C),V(C,t[3].g.h),s(b,$),s(b,M),s(M,E),s(M,S),s(M,A),s(M,I),Q(F,I,null),Le(I,t[3].g.t,!0),s(n,Y),s(n,U),s(n,H),s(n,q),s(q,z),s(z,O),s(O,R),s(O,B),s(O,L),s(O,j),s(j,W),s(W,te),s(W,le),s(W,pe),s(W,ie),s(W,Te),s(j,je),s(je,Pe),s(je,We),s(je,be),s(je,ke),s(j,Fe),s(Fe,ge),s(Fe,ae),s(j,we),s(j,J),s(j,se),s(j,Ie),s(j,Re),s(j,_e),s(j,ye),s(j,Ne),s(j,de),s(j,Ce),s(j,x),s(j,oe),s(j,Ue),Le(j,t[3].p.r,!0),s(z,ue),s(z,ve),s(ve,dt),s(ve,jl),s(ve,xt),s(ve,ct);for(let ft=0;ft<4;ft+=1)gi[ft]&&gi[ft].m(ct,null);Le(ct,t[3].p.c,!0),s(n,Ml),s(n,pl),s(pl,Ht),s(Ht,vt),s(vt,Qe),s(vt,Xe),s(vt,Ze),s(vt,Oe),V(Oe,t[3].p.f),s(Ht,Je),s(Ht,Be),s(Be,xe),s(Be,et),s(Be,re),s(Be,he),V(he,t[3].p.m),s(n,Pi),s(n,_l),s(_l,mn),s(mn,Mt),Mt.checked=t[3].p.e,s(mn,Ai),s(_l,Di),bt&&bt.m(_l,null),s(n,Ei),s(n,dl),s(dl,Ii),s(dl,Fi),s(dl,Ri),s(dl,Nt),s(Nt,Nl),s(Nt,ze),s(Nt,vl),Le(Nt,t[3].g.s,!0),s(n,Wl),gt&>.m(n,null),s(l,Cs),s(l,He),s(He,el),s(He,Li),s(He,Pl),Q(pn,Pl,null),s(He,yo),s(He,fi),s(He,Co),s(He,tl),s(tl,Ui),s(tl,$o),s(tl,$s),s(tl,To),s(tl,ci),s(ci,jt),jt.checked=t[3].m.i,s(ci,So),s(tl,Mo),s(tl,Al),s(Al,ll),s(ll,Dl),s(Dl,No);for(let ft=0;ft<7;ft+=1)ki[ft]&&ki[ft].m(ll,null);Le(ll,t[3].m.b,!0),s(Al,Po),s(Al,mt),s(mt,El),s(El,Ao),s(mt,_n),s(mt,dn),s(mt,vn),s(mt,hn),Le(mt,t[3].m.p,!0),s(Al,Do),s(Al,It),V(It,t[3].m.s),s(He,Eo),s(He,Gl),s(Gl,Io),s(Gl,Fo),s(Gl,Ro),s(Gl,nl),s(nl,bn),s(nl,gn),Le(nl,t[3].m.d,!0),s(He,Lo),s(He,kn),s(kn,Bl),s(Bl,Uo),s(Bl,Oo),s(Bl,qo),s(Bl,wn),s(wn,Wt),V(Wt,t[3].m.f),s(wn,Ho),s(wn,ji),s(kn,jo),s(kn,zl),s(zl,Wo),s(zl,Go),s(zl,Bo),s(zl,yn),s(yn,Gt),V(Gt,t[3].m.r),s(yn,zo),s(yn,Wi),s(He,Yo),s(He,Ts),s(He,Vo),s(He,Yl),s(Yl,Gi),s(Gi,Bt),Bt.checked=t[3].m.e.e,s(Gi,Ko),s(Yl,Qo),kt&&kt.m(Yl,null),s(He,Xo),wt&&wt.m(He,null),s(He,Ss),s(He,Bi),s(Bi,zt),zt.checked=t[3].m.m.e,s(Bi,Zo),s(He,Jo),yt&&yt.m(He,null),s(l,xo),s(l,tt),s(tt,zi),s(tt,eu),s(tt,Cn),Q($n,Cn,null),s(tt,tu),s(tt,mi),s(tt,lu),s(tt,Vl),s(Vl,nu),s(Vl,iu),s(Vl,su),s(Vl,hl),V(hl,t[3].w.s),s(tt,ou),s(tt,Kl),s(Kl,uu),s(Kl,ru),s(Kl,au),s(Kl,bl),V(bl,t[3].w.p),s(tt,fu),s(tt,Tn),s(Tn,Ql),s(Ql,cu),s(Ql,mu),s(Ql,pu),s(Ql,Ft),s(Ft,Sn),s(Ft,Mn),s(Ft,Nn),s(Ft,Pn),Le(Ft,t[3].w.z,!0),s(Tn,_u),s(Tn,Xl),s(Xl,du),s(Xl,vu),s(Xl,hu),s(Xl,An),s(An,Rt),V(Rt,t[3].w.w),s(An,bu),s(An,Yi),s(tt,gu),s(tt,Vi),s(Vi,Ki),s(Ki,Yt),Yt.checked=t[3].w.a,s(Ki,ku),s(tt,wu),Ct&&Ct.m(tt,null),s(l,yu),s(l,at),s(at,Qi),s(at,Cu),s(at,Dn),Q(En,Dn,null),s(at,$u),s(at,Zl),s(Zl,Tu),s(Zl,Su),s(Zl,Mu),s(Zl,Il),s(Il,il),s(il,In),s(il,Fn),Le(il,t[3].n.m,!0),s(Il,Nu),s(Il,Pt),V(Pt,t[3].n.i),s(Il,Pu),s(Il,At),Q(Rn,At,null),Le(At,t[3].n.s,!0),s(at,Au),$t&&$t.m(at,null),s(at,Ms),s(at,es),s(es,ts),s(ts,Vt),Vt.checked=t[3].n.d,s(ts,Du),s(at,Eu),s(at,pi),s(at,Iu),s(at,Fl),s(Fl,Fu),s(Fl,_i),s(_i,Kt),Kt.checked=t[3].n.h,s(_i,Ru),s(Fl,Lu),s(Fl,Uu),s(Fl,ls),s(ls,gl),V(gl,t[3].n.n1),s(l,Ou),s(l,Ve),s(Ve,ns),s(Ve,qu),s(Ve,Ln),Q(Un,Ln,null),s(Ve,Hu),s(Ve,di),s(Ve,ju),s(Ve,sl),s(sl,Wu),Tt&&Tt.m(sl,null),s(sl,Ns),s(sl,Gu),s(sl,Bu),s(sl,On),s(On,kl),V(kl,t[3].q.h),s(On,zu),s(On,Qt),V(Qt,t[3].q.p),s(Ve,Yu),nt&&nt.m(Ve,null),s(Ve,Ps),s(Ve,Jl),s(Jl,Vu),s(Jl,Ku),s(Jl,Qu),s(Jl,wl),V(wl,t[3].q.u),s(Ve,Xu),s(Ve,xl),s(xl,Zu),s(xl,Ju),s(xl,xu),s(xl,yl),V(yl,t[3].q.a),s(Ve,er),s(Ve,qn),s(qn,Hn),s(Hn,tr),s(Hn,lr),s(Hn,nr),s(Hn,Cl),V(Cl,t[3].q.c),s(qn,ir),s(qn,jn),s(jn,sr),s(jn,or),s(jn,ur),s(jn,ht),s(ht,Wn),s(ht,Gn),s(ht,Bn),s(ht,zn),s(ht,Yn),s(ht,Vn),Le(ht,t[3].q.m,!0),s(Ve,rr),s(Ve,en),s(en,ar),s(en,fr),s(en,cr),s(en,$l),V($l,t[3].q.b),s(l,mr),it&&it.m(l,null),s(l,As),st&&st.m(l,null),s(l,Ds),ot&&ot.m(l,null),s(l,Is),s(l,ol),s(ol,is),s(ol,pr),s(ol,Kn),Q(Qn,Kn,null),s(ol,_r),s(ol,vi),s(ol,dr),s(ol,hi);for(let ft=0;ft0?gt?gt.p(P,ee):(gt=lf(P),gt.c(),gt.m(n,null)):gt&&(gt.d(1),gt=null),ee[0]&8&&(jt.checked=P[3].m.i),(!Zt||ee[0]&8&&Oi!==(Oi=P[3].m.b!=0))&&(Dl.disabled=Oi),ee[0]&8&&Le(ll,P[3].m.b),(!Zt||ee[0]&8&&qi!==(qi=P[3].m.b!=0))&&(El.disabled=qi),(!Zt||ee[0]&8&&Hi!==(Hi=P[3].m.b==0))&&(mt.disabled=Hi),ee[0]&8&&Le(mt,P[3].m.p),ee[0]&8&&fe(It.value)!==P[3].m.s&&V(It,P[3].m.s),ee[0]&8&&Le(nl,P[3].m.d),ee[0]&8&&fe(Wt.value)!==P[3].m.f&&V(Wt,P[3].m.f),ee[0]&8&&fe(Gt.value)!==P[3].m.r&&V(Gt,P[3].m.r),ee[0]&8&&(Bt.checked=P[3].m.e.e),P[3].m.e.e?kt?kt.p(P,ee):(kt=nf(P),kt.c(),kt.m(Yl,null)):kt&&(kt.d(1),kt=null),P[3].m.e.e?wt?wt.p(P,ee):(wt=sf(P),wt.c(),wt.m(He,Ss)):wt&&(wt.d(1),wt=null),ee[0]&8&&(zt.checked=P[3].m.m.e),P[3].m.m.e?yt?yt.p(P,ee):(yt=of(P),yt.c(),yt.m(He,null)):yt&&(yt.d(1),yt=null),ee[0]&8&&hl.value!==P[3].w.s&&V(hl,P[3].w.s),ee[0]&8&&bl.value!==P[3].w.p&&V(bl,P[3].w.p),ee[0]&8&&Le(Ft,P[3].w.z),ee[0]&8&&fe(Rt.value)!==P[3].w.w&&V(Rt,P[3].w.w),ee[0]&8&&(Yt.checked=P[3].w.a),P[0].chip!="esp8266"?Ct?Ct.p(P,ee):(Ct=uf(P),Ct.c(),Ct.m(tt,null)):Ct&&(Ct.d(1),Ct=null),ee[0]&8&&Le(il,P[3].n.m),(!Zt||ee[0]&8&&Xi!==(Xi=P[3].n.m=="dhcp"))&&(Pt.disabled=Xi),(!Zt||ee[0]&8&&Zi!==(Zi=P[3].n.m=="static"))&&(Pt.required=Zi),ee[0]&8&&Pt.value!==P[3].n.i&&V(Pt,P[3].n.i),(!Zt||ee[0]&8&&Ji!==(Ji=P[3].n.m=="dhcp"))&&(At.disabled=Ji),(!Zt||ee[0]&8&&xi!==(xi=P[3].n.m=="static"))&&(At.required=xi),ee[0]&8&&Le(At,P[3].n.s),P[3].n.m=="static"?$t?$t.p(P,ee):($t=rf(P),$t.c(),$t.m(at,Ms)):$t&&($t.d(1),$t=null),ee[0]&8&&(Vt.checked=P[3].n.d),ee[0]&8&&(Kt.checked=P[3].n.h),ee[0]&8&&gl.value!==P[3].n.n1&&V(gl,P[3].n.n1),P[0].chip!="esp8266"?Tt?Tt.p(P,ee):(Tt=af(P),Tt.c(),Tt.m(sl,Ns)):Tt&&(Tt.d(1),Tt=null),ee[0]&8&&kl.value!==P[3].q.h&&V(kl,P[3].q.h),ee[0]&8&&fe(Qt.value)!==P[3].q.p&&V(Qt,P[3].q.p),P[3].q.s.e?nt?(nt.p(P,ee),ee[0]&8&&N(nt,1)):(nt=ff(P),nt.c(),N(nt,1),nt.m(Ve,Ps)):nt&&(Ae(),D(nt,1,1,()=>{nt=null}),De()),ee[0]&8&&wl.value!==P[3].q.u&&V(wl,P[3].q.u),ee[0]&8&&yl.value!==P[3].q.a&&V(yl,P[3].q.a),ee[0]&8&&Cl.value!==P[3].q.c&&V(Cl,P[3].q.c),ee[0]&8&&Le(ht,P[3].q.m),ee[0]&8&&$l.value!==P[3].q.b&&V($l,P[3].q.b),P[3].q.m==3?it?(it.p(P,ee),ee[0]&8&&N(it,1)):(it=cf(P),it.c(),N(it,1),it.m(l,As)):it&&(Ae(),D(it,1,1,()=>{it=null}),De()),P[3].q.m==4?st?(st.p(P,ee),ee[0]&8&&N(st,1)):(st=mf(P),st.c(),N(st,1),st.m(l,Ds)):st&&(Ae(),D(st,1,1,()=>{st=null}),De()),ee[0]&8&&(Es=P[3].p.r.startsWith("10YNO")||P[3].p.r=="10Y1001A1001A48H"),Es?ot?(ot.p(P,ee),ee[0]&8&&N(ot,1)):(ot=pf(P),ot.c(),N(ot,1),ot.m(l,Is)):ot&&(Ae(),D(ot,1,1,()=>{ot=null}),De()),ee[0]&136){ei=P[7];let Lt;for(Lt=0;Lt20||P[0].chip=="esp8266"?ut?(ut.p(P,ee),ee[0]&1&&N(ut,1)):(ut=vf(P),ut.c(),N(ut,1),ut.m(l,Fs)):ut&&(Ae(),D(ut,1,1,()=>{ut=null}),De()),ee[0]&8&&(Xt.checked=P[3].d.s),P[3].d.s?St?St.p(P,ee):(St=yf(P),St.c(),St.m(Dt,null)):St&&(St.d(1),St=null);const ft={};ee[0]&2&&(ft.active=P[1]),tn.$set(ft);const Sr={};ee[0]&4&&(Sr.active=P[2]),ln.$set(Sr);const Mr={};ee[0]&16&&(Mr.active=P[4]),nn.$set(Mr);const Nr={};ee[0]&32&&(Nr.active=P[5]),sn.$set(Nr)},i(P){Zt||(N(a.$$.fragment,P),N(F.$$.fragment,P),N(pn.$$.fragment,P),N($n.$$.fragment,P),N(En.$$.fragment,P),N(Rn.$$.fragment,P),N(Un.$$.fragment,P),N(nt),N(it),N(st),N(ot),N(Qn.$$.fragment,P),N(ut),N(Zn.$$.fragment,P),N(tn.$$.fragment,P),N(ln.$$.fragment,P),N(nn.$$.fragment,P),N(sn.$$.fragment,P),Zt=!0)},o(P){D(a.$$.fragment,P),D(F.$$.fragment,P),D(pn.$$.fragment,P),D($n.$$.fragment,P),D(En.$$.fragment,P),D(Rn.$$.fragment,P),D(Un.$$.fragment,P),D(nt),D(it),D(st),D(ot),D(Qn.$$.fragment,P),D(ut),D(Zn.$$.fragment,P),D(tn.$$.fragment,P),D(ln.$$.fragment,P),D(nn.$$.fragment,P),D(sn.$$.fragment,P),Zt=!1},d(P){P&&k(e),X(a),X(F),cl(gi,P),bt&&bt.d(),gt&>.d(),X(pn),cl(ki,P),kt&&kt.d(),wt&&wt.d(),yt&&yt.d(),X($n),Ct&&Ct.d(),X(En),X(Rn),$t&&$t.d(),X(Un),Tt&&Tt.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),ot&&ot.d(),X(Qn),cl(pt,P),ut&&ut.d(),X(Zn),St&&St.d(),P&&k(Ls),X(tn,P),P&&k(Us),X(ln,P),P&&k(Os),X(nn,P),P&&k(qs),X(sn,P),Hs=!1,Ke(Tr)}}}async function s0(){await(await fetch("/reboot",{method:"POST"})).json()}function o0(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,r=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,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:""}};qc.subscribe(ze=>{ze.version&&(l(3,a=ze),l(1,o=!1))}),Fp();let f=!1,c=!1;async function p(){if(confirm("Are you sure you want to factory reset the device?")){l(4,f=!0);const ze=new URLSearchParams;ze.append("perform","true");let Wl=await(await fetch("/reset",{method:"POST",body:ze})).json();l(4,f=!1),l(5,c=Wl.success)}}async function _(ze){l(2,r=!0);const vl=new FormData(ze.target),Wl=new URLSearchParams;for(let el of vl){const[Li,Pl]=el;Wl.append(Li,Pl)}let He=await(await fetch("/save",{method:"POST",body:Wl})).json();qt.update(el=>(el.booting=He.reboot,el.ui=a.u,el)),l(2,r=!1),si("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(qt.update(ze=>(ze.booting=!0,ze)),s0())},d=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let v=44;function g(){a.g.h=this.value,l(3,a)}function T(){a.g.t=_t(this),l(3,a)}function C(){a.p.r=_t(this),l(3,a)}function $(){a.p.c=_t(this),l(3,a)}function M(){a.p.f=fe(this.value),l(3,a)}function E(){a.p.m=fe(this.value),l(3,a)}function S(){a.p.e=this.checked,l(3,a)}function A(){a.p.t=this.value,l(3,a)}function I(){a.g.s=_t(this),l(3,a)}function F(){a.g.u=this.value,l(3,a)}function Y(){a.g.p=this.value,l(3,a)}function U(){a.m.i=this.checked,l(3,a)}function H(){a.m.b=_t(this),l(3,a)}function q(){a.m.p=_t(this),l(3,a)}function z(){a.m.s=fe(this.value),l(3,a)}function O(){a.m.d=_t(this),l(3,a)}function R(){a.m.f=fe(this.value),l(3,a)}function B(){a.m.r=fe(this.value),l(3,a)}function L(){a.m.e.e=this.checked,l(3,a)}function j(){a.m.e.k=this.value,l(3,a)}function W(){a.m.e.a=this.value,l(3,a)}function te(){a.m.m.e=this.checked,l(3,a)}function le(){a.m.m.w=fe(this.value),l(3,a)}function pe(){a.m.m.v=fe(this.value),l(3,a)}function ie(){a.m.m.a=fe(this.value),l(3,a)}function Te(){a.m.m.c=fe(this.value),l(3,a)}function je(){a.w.s=this.value,l(3,a)}function Pe(){a.w.p=this.value,l(3,a)}function We(){a.w.z=_t(this),l(3,a)}function be(){a.w.w=fe(this.value),l(3,a)}function ke(){a.w.a=this.checked,l(3,a)}function Fe(){a.w.b=this.checked,l(3,a)}function ge(){a.n.m=_t(this),l(3,a)}function ae(){a.n.i=this.value,l(3,a)}function we(){a.n.s=_t(this),l(3,a)}function J(){a.n.g=this.value,l(3,a)}function se(){a.n.d1=this.value,l(3,a)}function Ie(){a.n.d2=this.value,l(3,a)}function Re(){a.n.d=this.checked,l(3,a)}function _e(){a.n.h=this.checked,l(3,a)}function ye(){a.n.n1=this.value,l(3,a)}function Ne(){a.q.s.e=this.checked,l(3,a)}function de(){a.q.h=this.value,l(3,a)}function Ce(){a.q.p=fe(this.value),l(3,a)}function x(){a.q.u=this.value,l(3,a)}function oe(){a.q.a=this.value,l(3,a)}function Ue(){a.q.c=this.value,l(3,a)}function ue(){a.q.m=_t(this),l(3,a)}function ve(){a.q.b=this.value,l(3,a)}function dt(){a.o.e=this.value,l(3,a)}function jl(){a.o.c=this.value,l(3,a)}function xt(){a.o.u1=this.value,l(3,a)}function ct(){a.o.u2=this.value,l(3,a)}function Ml(){a.o.u3=this.value,l(3,a)}function pl(){a.h.t=this.value,l(3,a)}function Ht(){a.h.h=this.value,l(3,a)}function vt(){a.h.n=this.value,l(3,a)}function Qe(ze){a.t.t[ze]=fe(this.value),l(3,a)}function Xe(){a.t.h=fe(this.value),l(3,a)}function Ze(ze){a.u[ze.key]=_t(this),l(3,a)}function Oe(){a.i.h.u=this.checked,l(3,a)}function Je(){a.i.h.p=_t(this),l(3,a)}function Be(){a.i.a=fe(this.value),l(3,a)}function xe(){a.i.l.i=this.checked,l(3,a)}function et(){a.i.l.p=fe(this.value),l(3,a)}function re(){a.i.r.i=this.checked,l(3,a)}function he(){a.i.r.r=fe(this.value),l(3,a)}function Pi(){a.i.r.g=fe(this.value),l(3,a)}function _l(){a.i.r.b=fe(this.value),l(3,a)}function mn(){a.i.t.d=fe(this.value),l(3,a)}function Mt(){a.i.t.a=fe(this.value),l(3,a)}function Ai(){a.i.v.p=fe(this.value),l(3,a)}function Di(){a.i.v.d.v=fe(this.value),l(3,a)}function Ei(){a.i.v.d.g=fe(this.value),l(3,a)}function dl(){a.i.v.o=fe(this.value),l(3,a)}function Ii(){a.i.v.m=fe(this.value),l(3,a)}function Fi(){a.i.v.b=fe(this.value),l(3,a)}function Ri(){a.d.s=this.checked,l(3,a)}function Nt(){a.d.t=this.checked,l(3,a)}function Nl(){a.d.l=_t(this),l(3,a)}return t.$$set=ze=>{"sysinfo"in ze&&l(0,n=ze.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,v=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,r,a,f,c,v,i,p,_,b,d,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z,O,R,B,L,j,W,te,le,pe,ie,Te,je,Pe,We,be,ke,Fe,ge,ae,we,J,se,Ie,Re,_e,ye,Ne,de,Ce,x,oe,Ue,ue,ve,dt,jl,xt,ct,Ml,pl,Ht,vt,Qe,Xe,Ze,Oe,Je,Be,xe,et,re,he,Pi,_l,mn,Mt,Ai,Di,Ei,dl,Ii,Fi,Ri,Nt,Nl]}class u0 extends Me{constructor(e){super(),Se(this,e,o0,i0,$e,{sysinfo:0},null,[-1,-1,-1,-1])}}function $f(t,e,l){const n=t.slice();return n[20]=e[l],n}function r0(t){let e=ce(t[1].chip,t[1].board)+"",l;return{c(){l=y(e)},m(n,i){w(n,l,i)},p(n,i){i&2&&e!==(e=ce(n[1].chip,n[1].board)+"")&&G(l,e)},d(n){n&&k(l)}}}function Tf(t){let e,l,n=t[1].apmac+"",i,o,r,a,f,c,p,_,b,d=Yr(t[1])+"",v,g,T=t[1].boot_reason+"",C,$,M=t[1].ex_cause+"",E,S,A;const I=[f0,a0],F=[];function Y(U,H){return U[0].u>0?0:1}return f=Y(t),c=F[f]=I[f](t),{c(){e=m("div"),l=y("AP MAC: "),i=y(n),o=h(),r=m("div"),a=y(`Last boot: diff --git a/lib/SvelteUi/app/src/lib/DataStores.js b/lib/SvelteUi/app/src/lib/DataStores.js index fb73bd41..06abe2a2 100644 --- a/lib/SvelteUi/app/src/lib/DataStores.js +++ b/lib/SvelteUi/app/src/lib/DataStores.js @@ -57,7 +57,7 @@ export const dataStore = readable(data, (set) => { lastTemp = data.t; setTimeout(getTemperatures, 2000); } - if(lastPrice == null && data.pe && data.p) { + if(lastPrice == null && data.pe && data.p != null) { lastPrice = data.p; getPrices(); }