diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index bafcba99..8f2b5833 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,7 +1,7 @@ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function ie(){}function Ut(t,e){for(const l in e)t[l]=e[l];return t}function Af(t){return t()}function $r(){return Object.create(null)}function Be(t){t.forEach(Af)}function Df(t){return typeof t=="function"}function ye(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let os;function Cc(t,e){return os||(os=document.createElement("a")),os.href=e,t===os.href}function Tc(t){return Object.keys(t).length===0}function lo(t,...e){if(t==null)return ie;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function zn(t){let e;return lo(t,l=>e=l)(),e}function zt(t,e,l){t.$$.on_destroy.push(lo(e,l))}function no(t,e,l,n){if(t){const i=Nf(t,e,l,n);return t[0](i)}}function Nf(t,e,l,n){return t[1]&&n?Ut(l.ctx.slice(),t[1](n(e))):l.ctx}function io(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(e.dirty.length,i.length);for(let r=0;r32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function gs(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}function Vt(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set?t[n]=e[n]:u(t,n,e[n])}function fe(t){return t===""?null:+t}function Sc(t){return Array.from(t.childNodes)}function B(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Y(t,e){t.value=e==null?"":e}function If(t,e,l,n){l===null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Re(t,e){for(let l=0;l{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=z(n.contentWindow,"resize",e)}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),w(n)}}function Ac(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}let ai;function oi(t){ai=t}function fi(){if(!ai)throw new Error("Function called outside component initialization");return ai}function Dc(t){fi().$$.on_mount.push(t)}function Nc(t){fi().$$.on_destroy.push(t)}function Ic(){const t=fi();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=Ac(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,o)}),!o.defaultPrevented}return!0}}function ui(t,e){return fi().$$.context.set(t,e),e}function yl(t){return fi().$$.context.get(t)}const ii=[],ds=[],cs=[],Cr=[],Ef=Promise.resolve();let Bs=!1;function Rf(){Bs||(Bs=!0,Ef.then(Ff))}function Ec(){return Rf(),Ef}function Ye(t){cs.push(t)}const Os=new Set;let rs=0;function Ff(){const t=ai;do{for(;rs{ps.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function Vn(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],r=e[o];if(r){for(const c in a)c in r||(n[c]=1);for(const c in r)i[c]||(l[c]=r[c],i[c]=1);t[o]=r}else for(const c in a)i[c]=1}for(const a in n)a in l||(l[a]=void 0);return l}function Tr(t){return typeof t=="object"&&t!==null?t:{}}function J(t){t&&t.c()}function Q(t,e,l,n){const{fragment:i,on_mount:o,on_destroy:a,after_update:r}=t.$$;i&&i.m(e,l),n||Ye(()=>{const c=o.map(Af).filter(Df);a?a.push(...c):Be(c),t.$$.on_mount=[]}),r.forEach(Ye)}function Z(t,e){const l=t.$$;l.fragment!==null&&(Be(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function Fc(t,e){t.$$.dirty[0]===-1&&(ii.push(t),Rf(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=b.length?b[0]:h;return f.ctx&&i(f.ctx[_],f.ctx[_]=d)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](d),m&&Fc(t,_)),h}):[],f.update(),m=!0,Be(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const _=Sc(e.target);f.fragment&&f.fragment.l(_),_.forEach(w)}else f.fragment&&f.fragment.c();e.intro&&M(t.$$.fragment),Q(t,e.target,e.anchor,e.customElement),Ff()}oi(c)}class Ce{$destroy(){Z(this,1),this.$destroy=ie}$on(e,l){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!Tc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Sr=t=>typeof t>"u",Lf=t=>typeof t=="function",qf=t=>typeof t=="number";function Lc(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Of(){let t=0;return()=>t++}function qc(){return Math.random().toString(36).substring(2)}const $l=typeof window>"u";function Uf(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Ys=(t,e)=>t?{}:{style:e},Gn=t=>({"aria-hidden":"true",...Ys(t,"display:none;")}),Wn=[];function Hf(t,e){return{subscribe:Je(t,e).subscribe}}function Je(t,e=ie){let l;const n=new Set;function i(r){if(ye(t,r)&&(t=r,l)){const c=!Wn.length;for(const f of n)f[1](),Wn.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&(l(),l=null)}}return{set:i,update:o,subscribe:a}}function Oc(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return Hf(l,a=>{let r=!1;const c=[];let f=0,m=ie;const _=()=>{if(f)return;m();const b=e(n?c[0]:c,a);o?a(b):m=Df(b)?b:ie},h=i.map((b,d)=>lo(b,g=>{c[d]=g,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,zs=ci("LOCATION"),Kn=ci("ROUTER"),jf=ci("ROUTE"),Uc=ci("ROUTE_PARAMS"),Hc=ci("FOCUS_ELEM"),Wf=/^:(.+)/,si=(t,e,l)=>t.substr(e,l),Vs=(t,e)=>si(t,0,e.length)===e,jc=t=>t==="",Wc=t=>Wf.test(t),Gf=t=>t[0]==="*",Gc=t=>t.replace(/\*.*$/,""),Bf=t=>t.replace(/(^\/+|\/+$)/g,"");function Zt(t,e=!1){const l=Bf(t).split("/");return e?l.filter(Boolean):l}const Us=(t,e)=>t+(e?`?${e}`:""),uo=t=>`/${Bf(t)}`;function pi(...t){const e=n=>Zt(n,!0).join("/"),l=t.map(e).join("/");return uo(l)}const ro=1,ks=2,zl=3,Bc=4,Yf=5,Yc=6,zf=7,zc=8,Vc=9,Vf=10,Kf=11,Kc={[ro]:"Link",[ks]:"Route",[zl]:"Router",[Bc]:"useFocus",[Yf]:"useLocation",[Yc]:"useMatch",[zf]:"useNavigate",[zc]:"useParams",[Vc]:"useResolvable",[Vf]:"useResolve",[Kf]:"navigate"},ao=t=>Kc[t];function Qc(t,e){let l;return t===ks?l=e.path?`path="${e.path}"`:"default":t===ro?l=`to="${e.to}"`:t===zl&&(l=`basepath="${e.basepath||""}"`),`<${ao(t)} ${l||""} />`}function Zc(t,e,l,n){const i=l&&Qc(n||t,l),o=i?` Occurred in: ${i}`:"",a=ao(t),r=Lf(e)?e(a):e;return`<${a}> ${r}${o}`}const Qf=t=>(...e)=>t(Zc(...e)),Zf=Qf(t=>{throw new Error(t)}),vs=Qf(console.warn),Pr=4,Jc=3,Xc=2,xc=1,e1=1;function t1(t,e){const l=t.default?0:Zt(t.fullPath).reduce((n,i)=>{let o=n;return o+=Pr,jc(i)?o+=e1:Wc(i)?o+=Xc:Gf(i)?o-=Pr+xc:o+=Jc,o},0);return{route:t,score:l,index:e}}function l1(t){return t.map(t1).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Jf(t,e){let l,n;const[i]=e.split("?"),o=Zt(i),a=o[0]==="",r=l1(t);for(let c=0,f=r.length;c({...m,params:h,uri:k});if(m.default){n=b(e);continue}const d=Zt(m.fullPath),g=Math.max(o.length,d.length);let $=0;for(;${f===".."?c.pop():f!=="."&&c.push(f)}),Us(`/${c.join("/")}`,n)}function Mr(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=Zt(e,!0),r=Zt(l,!0);for(;a.length;)a[0]!==r[0]&&Zf(zl,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),r.shift();return{pathname:pi(...r),hash:n,search:i,state:o}}const Ar=t=>t.length===1?"":t,fo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Ar(si(t,l)):"",a=i?si(t,0,l):t,r=n?Ar(si(a,e)):"";return{pathname:(n?si(a,0,e):a)||"/",search:r,hash:o}},i1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function s1(t,e,l){return pi(l,n1(t,e))}function o1(t,e){const l=uo(Gc(t)),n=Zt(l,!0),i=Zt(e,!0).slice(0,n.length),o=Xf({fullPath:l},pi(...i));return o&&o.uri}const Hs="POP",u1="PUSH",r1="REPLACE";function js(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function a1(t){let e=[],l=js(t),n=Hs;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=js(t),n=Hs,i([o])};i([o]);const r=Uf(t,"popstate",a);return()=>{r(),e=e.filter(c=>c!==o)}},navigate(o,a){const{state:r={},replace:c=!1}=a||{};if(n=c?r1:u1,qf(o))a&&vs(Kf,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Hs,t.history.go(o);else{const f={...r,_key:qc()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=js(t),i()}}}function Ws(t,e){return{...fo(e),state:t}}function f1(t="/"){let e=0,l=[Ws(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(Ws(n,o))},replaceState(n,i,o){l[e]=Ws(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const c1=!!(!$l&&window.document&&window.document.createElement),p1=!$l&&window.location.origin==="null",xf=a1(c1&&!p1?window:f1()),{navigate:Bn}=xf;let cl=null,ec=!0;function m1(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;ncl.level||t.level===cl.level&&m1(t.routerId,cl.routerId))&&(cl=t)}function d1(){cl=null}function v1(){ec=!1}function Dr(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Uf(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function h1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function b1(t){return/^H[1-6]$/i.test(t.tagName)}function Nr(t,e=document){return e.querySelector(t)}function g1(t){let l=Nr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!h1(l,t);){if(b1(l))return l;const n=Nr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function k1(t){Promise.resolve(zn(t.focusElement)).then(e=>{const l=e||g1(t.id);l||vs(zl,`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,ks),!Dr(l)&&Dr(document.documentElement)})}const w1=(t,e,l)=>(n,i)=>Ec().then(()=>{if(!cl||ec){v1();return}if(n&&k1(cl.route),t.announcements&&i){const{path:o,fullPath:a,meta:r,params:c,uri:f}=cl.route,m=t.createAnnouncement({path:o,fullPath:a,meta:r,params:c,uri:f},zn(l));Promise.resolve(m).then(_=>{e.set(_)})}d1()}),Ir="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 y1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Ys(t[6],Ir)],i={};for(let o=0;o`Navigated to ${le.uri}`,announcements:!0,...d},k=m,T=uo(m),P=yl(zs),E=yl(Kn),S=!P,N=C1(),D=b&&!(E&&!E.manageFocus),R=Je("");zt(t,R,le=>l(0,r=le));const W=E?E.disableInlineStyles:g,O=Je([]);zt(t,O,le=>l(20,a=le));const F=Je(null);zt(t,F,le=>l(18,i=le));let L=!1;const j=S?0:E.level+1,q=S?Je((()=>Mr($l?fo(_):h.location,T))()):P;zt(t,q,le=>l(17,n=le));const G=Je(n);zt(t,G,le=>l(19,o=le));const H=w1($,R,q),V=le=>_e=>_e.filter(Te=>Te.id!==le);function X(le){if($l){if(L)return;const _e=Xf(le,n.pathname);if(_e)return L=!0,_e}else O.update(_e=>{const Te=V(le.id)(_e);return Te.push(le),Te})}function ne(le){O.update(V(le))}return!S&&m!==Er&&vs(zl,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:m}),S&&(Dc(()=>h.listen(_e=>{const Te=Mr(_e.location,T);G.set(n),q.set(Te)})),ui(zs,q)),ui(Kn,{activeRoute:F,registerRoute:X,unregisterRoute:ne,manageFocus:D,level:j,id:N,history:S?h:E.history,basepath:S?T:E.basepath,disableInlineStyles:W}),t.$$set=le=>{"basepath"in le&&l(11,m=le.basepath),"url"in le&&l(12,_=le.url),"history"in le&&l(13,h=le.history),"primary"in le&&l(14,b=le.primary),"a11y"in le&&l(15,d=le.a11y),"disableInlineStyles"in le&&l(16,g=le.disableInlineStyles),"$$scope"in le&&l(21,f=le.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&m!==k&&vs(zl,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const le=Jf(a,n.pathname);F.set(le)}if(t.$$.dirty[0]&655360&&S){const le=!!n.hash,_e=!le&&D,Te=!le||n.pathname!==o.pathname;H(_e,Te)}t.$$.dirty[0]&262144&&D&&i&&i.primary&&_1({level:j,routerId:N,route:i})},[r,$,S,N,D,R,W,O,F,q,G,m,_,h,b,d,g,n,i,o,a,f,c]}class tc extends Ce{constructor(e){super(),$e(this,e,T1,$1,ye,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}function mi(t,e,l=Kn,n=zl){yl(l)||Zf(t,o=>`You cannot use ${o} outside of a ${ao(n)}.`,e)}const S1=t=>{const{subscribe:e}=yl(t);return{subscribe:e}};function lc(){return mi(Yf),S1(zs)}function nc(){const{history:t}=yl(Kn);return t}function ic(){const t=yl(jf);return t?Oc(t,e=>e.base):Je("/")}function sc(){mi(Vf);const t=ic(),{basepath:e}=yl(Kn);return n=>s1(n,zn(t),e)}function P1(){mi(zf);const t=sc(),{navigate:e}=nc();return(n,i)=>{const o=qf(n)?n:t(n);return e(o,i)}}const M1=t=>({params:t&16,location:t&8}),Rr=t=>({params:$l?zn(t[10]):t[4],location:t[3],navigate:t[11]});function Fr(t){let e,l;return e=new tc({props:{primary:t[1],$$slots:{default:[N1]},$$scope:{ctx:t}}}),{c(){J(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function A1(t){let e;const l=t[18].default,n=no(l,t,t[19],Rr);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&so(n,l,i,i[19],e?io(l,i[19],o,M1):oo(i[19]),Rr)},i(i){e||(M(n,i),e=!0)},o(i){I(n,i),e=!1},d(i){n&&n.d(i)}}}function D1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},$l?zn(t[10]):t[4],t[12]];var o=t[0];function a(r){let c={};for(let f=0;f{Z(m,1)}),Me()}o?(e=new o(a()),J(e.$$.fragment),M(e.$$.fragment,1),Q(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(r){n||(e&&M(e.$$.fragment,r),n=!0)},o(r){e&&I(e.$$.fragment,r),n=!1},d(r){r&&w(l),e&&Z(e,r)}}}function N1(t){let e,l,n,i;const o=[D1,A1],a=[];function r(c,f){return c[0]!==null?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e===m?a[e].p(c,f):(Pe(),I(a[m],1,1,()=>{a[m]=null}),Me(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function I1(t){let e,l,n,i,o,a=[Gn(t[7]),{"data-svnav-route-start":t[5]}],r={};for(let _=0;_{c=null}),Me()),Vt(i,m=Vn(f,[Gn(_[7]),{"data-svnav-route-end":_[5]}]))},i(_){o||(M(c),o=!0)},o(_){I(c),o=!1},d(_){_&&w(e),_&&w(l),c&&c.d(_),_&&w(n),_&&w(i)}}}const E1=Of();function R1(t,e,l){let n;const i=["path","component","meta","primary"];let o=_s(e,i),a,r,c,f,{$$slots:m={},$$scope:_}=e,{path:h=""}=e,{component:b=null}=e,{meta:d={}}=e,{primary:g=!0}=e;mi(ks,e);const $=E1(),{registerRoute:k,unregisterRoute:T,activeRoute:P,disableInlineStyles:E}=yl(Kn);zt(t,P,L=>l(16,a=L));const S=ic();zt(t,S,L=>l(17,c=L));const N=lc();zt(t,N,L=>l(3,r=L));const D=Je(null);let R;const W=Je(),O=Je({});zt(t,O,L=>l(4,f=L)),ui(jf,W),ui(Uc,O),ui(Hc,D);const F=P1();return $l||Nc(()=>T($)),t.$$set=L=>{l(24,e=Ut(Ut({},e),ms(L))),l(12,o=_s(e,i)),"path"in L&&l(13,h=L.path),"component"in L&&l(0,b=L.component),"meta"in L&&l(14,d=L.meta),"primary"in L&&l(1,g=L.primary),"$$scope"in L&&l(19,_=L.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const L=h==="",j=pi(c,h),U={id:$,path:h,meta:d,default:L,fullPath:L?"":j,base:L?c:o1(j,r.pathname),primary:g,focusElement:D};W.set(U),l(15,R=k(U))}if(t.$$.dirty&98304&&l(2,n=!!(R||a&&a.id===$)),t.$$.dirty&98308&&n){const{params:L}=R||a;O.set(L)}},e=ms(e),[b,g,n,r,f,$,P,E,S,N,O,F,o,h,d,R,a,c,m,_]}class fl extends Ce{constructor(e){super(),$e(this,e,R1,I1,ye,{path:13,component:0,meta:14,primary:1})}}function F1(t){let e,l,n,i;const o=t[13].default,a=no(o,t,t[12],null);let r=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,_=D));const P=Ic(),E=sc(),{navigate:S}=nc();function N(D){P("click",D),Lc(D)&&(D.preventDefault(),S(n,{state:$,replace:a||g}))}return t.$$set=D=>{l(19,e=Ut(Ut({},e),ms(D))),l(18,m=_s(e,f)),"to"in D&&l(5,d=D.to),"replace"in D&&l(6,g=D.replace),"state"in D&&l(7,$=D.state),"getProps"in D&&l(8,k=D.getProps),"$$scope"in D&&l(12,b=D.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=E(d,_)),t.$$.dirty&2049&&l(10,i=Vs(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(a=fo(n)===i1(_)),t.$$.dirty&512&&l(2,r=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(Lf(k)){const D=k({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...m,...D}}return m})())},e=ms(e),[n,c,r,T,N,d,g,$,k,o,i,_,b,h]}class wl extends Ce{constructor(e){super(),$e(this,e,L1,F1,ye,{to:5,replace:6,state:7,getProps:8})}}let Ks=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function kl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function q1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function oc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function O1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function hs(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 Ie(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"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Lr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received last 30s";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function qr(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 Or(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 Yn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function je(t,e){return t==1||t==2&&e}function Ct(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function we(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function ri(t,e){return t.setTime(t.getTime()+e*36e5),t}function Ur(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 Cl(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 Yt={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,trying:null};const Tt=Je(Yt);async function co(){Yt=await(await Cl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Tt.set(Yt)}let as=0,Hr=-127,jr=null,U1={};const H1=Hf(U1,t=>{let e;async function l(){Cl("/data.json").then(n=>n.json()).then(n=>{t(n),Hr!=n.t&&(Hr=n.t,setTimeout(fc,2e3)),jr!=n.p&&n.pe&&(jr=n.p,setTimeout(j1,4e3)),Yt.upgrading?window.location.reload():(!Yt||!Yt.chip||Yt.booting||as>1&&!Yn(Yt.board))&&(co(),Bl&&clearTimeout(Bl),Bl=setTimeout(po,2e3),Yl&&clearTimeout(Yl),Yl=setTimeout(mo,3e3));let i=5e3;if(Yn(Yt.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),as=0}).catch(n=>{as++,as>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,Yn(Yt.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Qs={};const uc=Je(Qs);async function j1(){Qs=await(await Cl("/energyprice.json")).json(),uc.set(Qs)}let Zs={},Bl;async function po(){Bl&&(clearTimeout(Bl),Bl=0),Zs=await(await Cl("/dayplot.json")).json(),rc.set(Zs);let e=new Date;Bl=setTimeout(po,(60-e.getMinutes())*6e4+20)}const rc=Je(Zs,t=>(po(),function(){}));let Js={},Yl;async function mo(){Yl&&(clearTimeout(Yl),Yl=0),Js=await(await Cl("/monthplot.json")).json(),ac.set(Js);let e=new Date;Yl=setTimeout(mo,(24-e.getHours())*36e5+40)}const ac=Je(Js,t=>(mo(),function(){}));let Xs={};async function fc(){Xs=await(await Cl("/temperature.json")).json(),cc.set(Xs)}const cc=Je(Xs,t=>(fc(),function(){}));let xs={},fs;async function pc(){fs&&(clearTimeout(fs),fs=0),xs=await(await Cl("/tariff.json")).json(),mc.set(xs);let e=new Date;fs=setTimeout(pc,(60-e.getMinutes())*6e4+30)}const mc=Je(xs,t=>function(){});let eo=[];const _o=Je(eo);async function W1(){eo=await(await Cl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),_o.set(eo)}function bs(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 _c(){await(await fetch("/upgrade",{method:"POST"})).json()}function dc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),a=[...e];a.reverse();let r,c,f;for(let m=0;mo&&(r=_):g==i+1&&(c=_);else if(d==n+1)if(f){let k=f.tag_name.substring(1).split(".");parseInt(k[0]);let T=parseInt(k[1]);parseInt(k[2]),g==T&&(f=_)}else f=_}return c||f||r||!1}else return e[0]}const G1="/github.svg";function Wr(t){let e,l;function n(a,r){return a[1]>1?Z1:a[1]>0?Q1:a[2]>1?K1:a[2]>0?V1:a[3]>1?z1:a[3]>0?Y1:B1}let i=n(t),o=i(t);return{c(){e=C(`Up - `),o.c(),l=We()},m(a,r){y(a,e,r),o.m(a,r),y(a,l,r)},p(a,r){i===(i=n(a))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},d(a){a&&w(e),o.d(a),a&&w(l)}}}function B1(t){let e,l;return{c(){e=C(t[0]),l=C(" seconds")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&1&&B(e,n[0])},d(n){n&&w(e),n&&w(l)}}}function Y1(t){let e,l;return{c(){e=C(t[3]),l=C(" minute")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function z1(t){let e,l;return{c(){e=C(t[3]),l=C(" minutes")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function V1(t){let e,l;return{c(){e=C(t[2]),l=C(" hour")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function K1(t){let e,l;return{c(){e=C(t[2]),l=C(" hours")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function Q1(t){let e,l;return{c(){e=C(t[1]),l=C(" day")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function Z1(t){let e,l;return{c(){e=C(t[1]),l=C(" days")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function J1(t){let e,l=t[0]&&Wr(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Wr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&w(e)}}}function X1(t,e,l){let{epoch:n}=e,i=0,o=0,a=0;return t.$$set=r=>{"epoch"in r&&l(0,n=r.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,a=Math.floor(n/60)))},[n,i,o,a]}class x1 extends Ce{constructor(e){super(),$e(this,e,X1,J1,ye,{epoch:0})}}function ep(t){let e,l,n;return{c(){e=p("span"),l=C(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){y(i,e,o),s(e,l)},p(i,[o]){o&4&&B(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ie,o:ie,d(i){i&&w(e)}}}function tp(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class Kt extends Ce{constructor(e){super(),$e(this,e,tp,ep,ye,{color:0,title:1,text:2})}}function lp(t){let e,l=`${Ie(t[0].getDate())}.${Ie(t[0].getMonth())}.${t[0].getFullYear()} ${Ie(t[0].getHours())}:${Ie(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=C(l),u(e,"class",t[1])},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ie(i[0].getDate())}.${Ie(i[0].getMonth())}.${i[0].getFullYear()} ${Ie(i[0].getHours())}:${Ie(i[0].getMinutes())}`)&&B(n,l),o&2&&u(e,"class",i[1])},d(i){i&&w(e)}}}function np(t){let e=`${Ie(t[0].getDate())}. ${Ks[t[0].getMonth()]} ${Ie(t[0].getHours())}:${Ie(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&1&&e!==(e=`${Ie(n[0].getDate())}. ${Ks[n[0].getMonth()]} ${Ie(n[0].getHours())}:${Ie(n[0].getMinutes())}`)&&B(l,e)},d(n){n&&w(l)}}}function ip(t){let e,l;function n(a,r){return r&1&&(e=null),e==null&&(e=Math.abs(new Date().getTime()-a[0].getTime())<3e5),e?np:lp}let i=n(t,-1),o=i(t);return{c(){o.c(),l=We()},m(a,r){o.m(a,r),y(a,l,r)},p(a,[r]){i===(i=n(a,r))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},i:ie,o:ie,d(a){o.d(a),a&&w(l)}}}function sp(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e;return t.$$set=o=>{"timestamp"in o&&l(0,n=o.timestamp),"fullTimeColor"in o&&l(1,i=o.fullTimeColor)},[n,i]}class vc extends Ce{constructor(e){super(),$e(this,e,sp,ip,ye,{timestamp:0,fullTimeColor:1})}}function op(t){let e,l,n;return{c(){e=Ue("svg"),l=Ue("path"),n=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){y(i,e,o),s(e,l),s(e,n)},p:ie,i:ie,o:ie,d(i){i&&w(e)}}}class up extends Ce{constructor(e){super(),$e(this,e,null,op,ye,{})}}function rp(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&w(e)}}}class ap extends Ce{constructor(e){super(),$e(this,e,null,rp,ye,{})}}function fp(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&w(e)}}}class $t extends Ce{constructor(e){super(),$e(this,e,null,fp,ye,{})}}function cp(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&w(e)}}}class hc extends Ce{constructor(e){super(),$e(this,e,null,cp,ye,{})}}function pp(t){let e,l,n=t[1].version+"",i;return{c(){e=C("AMS reader "),l=p("span"),i=C(n)},m(o,a){y(o,e,a),y(o,l,a),s(l,i)},p(o,a){a&2&&n!==(n=o[1].version+"")&&B(i,n)},d(o){o&&w(e),o&&w(l)}}}function Gr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=C(l),i=C("\xB0C"),u(e,"class","flex-none my-auto")},m(o,a){y(o,e,a),s(e,n),s(e,i)},p(o,a){a&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&B(n,l)},d(o){o&&w(e)}}}function Br(t){let e,l="HAN: "+Lr(t[0].he),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Lr(i[0].he))&&B(n,l)},d(i){i&&w(e)}}}function Yr(t){let e,l="MQTT: "+qr(t[0].me),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+qr(i[0].me))&&B(n,l)},d(i){i&&w(e)}}}function zr(t){let e,l="PriceAPI: "+Or(t[0].ee),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Or(i[0].ee))&&B(n,l)},d(i){i&&w(e)}}}function Vr(t){let e,l,n,i,o,a;return l=new wl({props:{to:"/configuration",$$slots:{default:[mp]},$$scope:{ctx:t}}}),o=new wl({props:{to:"/status",$$slots:{default:[_p]},$$scope:{ctx:t}}}),{c(){e=p("div"),J(l.$$.fragment),n=v(),i=p("div"),J(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(r,c){y(r,e,c),Q(l,e,null),y(r,n,c),y(r,i,c),Q(o,i,null),a=!0},i(r){a||(M(l.$$.fragment,r),M(o.$$.fragment,r),a=!0)},o(r){I(l.$$.fragment,r),I(o.$$.fragment,r),a=!1},d(r){r&&w(e),Z(l),r&&w(n),r&&w(i),Z(o)}}}function mp(t){let e,l;return e=new up({}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function _p(t){let e,l;return e=new ap({}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Kr(t){let e,l,n,i,o;const a=[vp,dp],r=[];function c(f,m){return f[1].security==0||f[0].a?0:1}return l=c(t),n=r[l]=a[l](t),{c(){e=p("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(f,m){y(f,e,m),r[l].m(e,null),o=!0},p(f,m){let _=l;l=c(f),l===_?r[l].p(f,m):(Pe(),I(r[_],1,1,()=>{r[_]=null}),Me(),n=r[l],n?n.p(f,m):(n=r[l]=a[l](f),n.c()),M(n,1),n.m(e,null)),(!o||m&4&&i!==(i="New version: "+f[2].tag_name))&&u(e,"title",i)},i(f){o||(M(n),o=!0)},o(f){I(n),o=!1},d(f){f&&w(e),r[l].d()}}}function dp(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=p("span"),l=C("New version: "),i=C(n)},m(o,a){y(o,e,a),s(e,l),s(e,i)},p(o,a){a&4&&n!==(n=o[2].tag_name+"")&&B(i,n)},i:ie,o:ie,d(o){o&&w(e)}}}function vp(t){let e,l,n,i=t[2].tag_name+"",o,a,r,c,f,m;return r=new hc({}),{c(){e=p("button"),l=p("span"),n=C("New version: "),o=C(i),a=v(),J(r.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(_,h){y(_,e,h),s(e,l),s(l,n),s(l,o),s(e,a),Q(r,e,null),c=!0,f||(m=z(e,"click",t[3]),f=!0)},p(_,h){(!c||h&4)&&i!==(i=_[2].tag_name+"")&&B(o,i)},i(_){c||(M(r.$$.fragment,_),c=!0)},o(_){I(r.$$.fragment,_),c=!1},d(_){_&&w(e),Z(r),f=!1,m()}}}function hp(t){let e,l,n,i,o,a,r,c,f,m,_,h,b=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U,q,G,H,V,X,ne,le,_e,Te,ve,qe,be,Ee;i=new wl({props:{to:"/",$$slots:{default:[pp]},$$scope:{ctx:t}}}),c=new x1({props:{epoch:t[0].u}});let he=t[0].t>-50&&Gr(t);T=new Kt({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:kl(t[1].booting?2:t[0].em)}}),E=new Kt({props:{title:"HAN",text:"HAN",color:kl(t[1].booting?9:t[0].hm)}}),N=new Kt({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:kl(t[1].booting?9:t[0].wm)}}),R=new Kt({props:{title:"MQTT",text:"MQTT",color:kl(t[1].booting?9:t[0].mm)}});let Ne=(t[0].he<0||t[0].he>0)&&Br(t),pe=t[0].me<0&&Yr(t),me=(t[0].ee>0||t[0].ee<0)&&zr(t);ne=new vc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),fullTimeColor:"text-red-500"}});let se=t[1].vndcfg&&t[1].usrcfg&&Vr(t);qe=new $t({});let re=t[1].fwconsent===1&&t[2]&&Kr(t);return{c(){e=p("nav"),l=p("div"),n=p("div"),J(i.$$.fragment),o=v(),a=p("div"),r=p("div"),J(c.$$.fragment),f=v(),he&&he.c(),m=v(),_=p("div"),h=C("Free mem: "),d=C(b),g=C("kb"),$=v(),k=p("div"),J(T.$$.fragment),P=v(),J(E.$$.fragment),S=v(),J(N.$$.fragment),D=v(),J(R.$$.fragment),W=v(),Ne&&Ne.c(),O=v(),pe&&pe.c(),F=v(),me&&me.c(),L=v(),j=p("div"),U=p("div"),q=p("a"),G=p("img"),V=v(),X=p("div"),J(ne.$$.fragment),le=v(),se&&se.c(),_e=v(),Te=p("div"),ve=p("a"),J(qe.$$.fragment),be=v(),re&&re.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(r,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(a,"class","flex-none my-auto p-2 flex space-x-4"),u(k,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(G,"class","gh-logo"),Cc(G.src,H=G1)||u(G,"src",H),u(G,"alt","GitHub repo"),u(q,"class","float-right"),u(q,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(q,"target","_blank"),u(q,"rel","noreferrer"),u(q,"aria-label","GitHub"),u(U,"class","flex-none"),u(X,"class","flex-none my-auto px-2"),u(ve,"href",Ct("")),u(ve,"target","_blank"),u(ve,"rel","noreferrer"),u(Te,"class","flex-none px-1 mt-1"),u(Te,"title","Documentation"),u(j,"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(K,ae){y(K,e,ae),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,a),s(a,r),Q(c,r,null),s(a,f),he&&he.m(a,null),s(a,m),s(a,_),s(_,h),s(_,d),s(_,g),s(l,$),s(l,k),Q(T,k,null),s(k,P),Q(E,k,null),s(k,S),Q(N,k,null),s(k,D),Q(R,k,null),s(l,W),Ne&&Ne.m(l,null),s(l,O),pe&&pe.m(l,null),s(l,F),me&&me.m(l,null),s(l,L),s(l,j),s(j,U),s(U,q),s(q,G),s(j,V),s(j,X),Q(ne,X,null),s(j,le),se&&se.m(j,null),s(j,_e),s(j,Te),s(Te,ve),Q(qe,ve,null),s(j,be),re&&re.m(j,null),Ee=!0},p(K,[ae]){const Ae={};ae&18&&(Ae.$$scope={dirty:ae,ctx:K}),i.$set(Ae);const te={};ae&1&&(te.epoch=K[0].u),c.$set(te),K[0].t>-50?he?he.p(K,ae):(he=Gr(K),he.c(),he.m(a,m)):he&&(he.d(1),he=null),(!Ee||ae&1)&&b!==(b=(K[0].m?(K[0].m/1e3).toFixed(1):"-")+"")&&B(d,b);const ue={};ae&3&&(ue.text=K[1].booting?"Booting":K[0].v>2?K[0].v.toFixed(2)+"V":"ESP"),ae&3&&(ue.color=kl(K[1].booting?2:K[0].em)),T.$set(ue);const He={};ae&3&&(He.color=kl(K[1].booting?9:K[0].hm)),E.$set(He);const Se={};ae&1&&(Se.text=K[0].r?K[0].r.toFixed(0)+"dBm":"WiFi"),ae&3&&(Se.color=kl(K[1].booting?9:K[0].wm)),N.$set(Se);const de={};ae&3&&(de.color=kl(K[1].booting?9:K[0].mm)),R.$set(de),K[0].he<0||K[0].he>0?Ne?Ne.p(K,ae):(Ne=Br(K),Ne.c(),Ne.m(l,O)):Ne&&(Ne.d(1),Ne=null),K[0].me<0?pe?pe.p(K,ae):(pe=Yr(K),pe.c(),pe.m(l,F)):pe&&(pe.d(1),pe=null),K[0].ee>0||K[0].ee<0?me?me.p(K,ae):(me=zr(K),me.c(),me.m(l,L)):me&&(me.d(1),me=null);const De={};ae&1&&(De.timestamp=K[0].c?new Date(K[0].c*1e3):new Date(0)),ne.$set(De),K[1].vndcfg&&K[1].usrcfg?se?ae&2&&M(se,1):(se=Vr(K),se.c(),M(se,1),se.m(j,_e)):se&&(Pe(),I(se,1,1,()=>{se=null}),Me()),K[1].fwconsent===1&&K[2]?re?(re.p(K,ae),ae&6&&M(re,1)):(re=Kr(K),re.c(),M(re,1),re.m(j,null)):re&&(Pe(),I(re,1,1,()=>{re=null}),Me())},i(K){Ee||(M(i.$$.fragment,K),M(c.$$.fragment,K),M(T.$$.fragment,K),M(E.$$.fragment,K),M(N.$$.fragment,K),M(R.$$.fragment,K),M(ne.$$.fragment,K),M(se),M(qe.$$.fragment,K),M(re),Ee=!0)},o(K){I(i.$$.fragment,K),I(c.$$.fragment,K),I(T.$$.fragment,K),I(E.$$.fragment,K),I(N.$$.fragment,K),I(R.$$.fragment,K),I(ne.$$.fragment,K),I(se),I(qe.$$.fragment,K),I(re),Ee=!1},d(K){K&&w(e),Z(i),Z(c),he&&he.d(),Z(T),Z(E),Z(N),Z(R),Ne&&Ne.d(),pe&&pe.d(),me&&me.d(),Z(ne),se&&se.d(),Z(qe),re&&re.d()}}}function bp(t,e,l){let{data:n={}}=e,i={},o={};function a(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!Yn(i.board)||confirm(bs(ce(i.chip,i.board))))&&(Tt.update(r=>(r.upgrading=!0,r)),_c())}return Tt.subscribe(r=>{l(1,i=r),r.fwconsent===1&&W1()}),_o.subscribe(r=>{l(2,o=dc(i.version,r))}),t.$$set=r=>{"data"in r&&l(0,n=r.data)},[n,i,o,a]}class gp extends Ce{constructor(e){super(),$e(this,e,bp,hp,ye,{data:0})}}function kp(t){let e,l,n,i;return{c(){e=Ue("svg"),l=Ue("path"),n=Ue("path"),u(l,"d",Gs(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Gs(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,a){y(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=Gs(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),a&2&&u(n,"stroke",o[1])},i:ie,o:ie,d(o){o&&w(e)}}}function Qr(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 Gs(t,e,l,n,i){var o=Qr(t,e,l,i),a=Qr(t,e,l,n),r=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,r,0,a.x,a.y].join(" ");return c}function wp(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 yp extends Ce{constructor(e){super(),$e(this,e,wp,kp,ye,{pct:0,color:1})}}function Zr(t){let e,l,n,i,o,a,r,c;return{c(){e=p("br"),l=v(),n=p("span"),i=C(t[3]),o=v(),a=p("span"),r=C(t[4]),c=C("/kWh"),u(n,"class","pl-sub"),u(a,"class","pl-snt")},m(f,m){y(f,e,m),y(f,l,m),y(f,n,m),s(n,i),y(f,o,m),y(f,a,m),s(a,r),s(a,c)},p(f,m){m&8&&B(i,f[3]),m&16&&B(r,f[4])},d(f){f&&w(e),f&&w(l),f&&w(n),f&&w(o),f&&w(a)}}}function $p(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$;l=new yp({props:{pct:t[6],color:t[5](t[6])}});let k=t[3]&&Zr(t);return{c(){e=p("div"),J(l.$$.fragment),n=v(),i=p("span"),o=p("span"),a=C(t[2]),r=v(),c=p("br"),f=v(),m=p("span"),_=C(t[0]),h=v(),b=p("span"),d=C(t[1]),g=v(),k&&k.c(),u(o,"class","pl-lab"),u(m,"class","pl-val"),u(b,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(T,P){y(T,e,P),Q(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,r),s(i,c),s(i,f),s(i,m),s(m,_),s(i,h),s(i,b),s(b,d),s(i,g),k&&k.m(i,null),$=!0},p(T,[P]){const E={};P&64&&(E.pct=T[6]),P&96&&(E.color=T[5](T[6])),l.$set(E),(!$||P&4)&&B(a,T[2]),(!$||P&1)&&B(_,T[0]),(!$||P&2)&&B(d,T[1]),T[3]?k?k.p(T,P):(k=Zr(T),k.c(),k.m(i,null)):k&&(k.d(1),k=null)},i(T){$||(M(l.$$.fragment,T),$=!0)},o(T){I(l.$$.fragment,T),$=!1},d(T){T&&w(e),Z(l),k&&k.d()}}}function Cp(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:r=""}=e,{subunit:c=""}=e,{colorFn:f}=e,m=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,a=_.label),"sub"in _&&l(3,r=_.sub),"subunit"in _&&l(4,c=_.subunit),"colorFn"in _&&l(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,m=Math.min(n,i)/i*100)},[n,o,a,r,c,f,m,i]}class bc extends Ce{constructor(e){super(),$e(this,e,Cp,$p,ye,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Jr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Xr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function xr(t,e,l){const n=t.slice();return n[13]=e[l],n}function ea(t){let e,l=t[0].title+"",n;return{c(){e=p("strong"),n=C(l),u(e,"class","text-sm")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[0].title+"")&&B(n,l)},d(i){i&&w(e)}}}function ta(t){let e,l,n,i=t[13].label+"",o,a,r,c;return{c(){e=Ue("g"),l=Ue("line"),n=Ue("text"),o=C(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",a=t[13].align=="right"?"85%":""),u(e,"class",r="tick tick-"+t[13].value+" tick-"+t[13].color),u(e,"transform",c="translate(0, "+t[6](t[13].value)+")")},m(f,m){y(f,e,m),s(e,l),s(e,n),s(n,o)},p(f,m){m&1&&i!==(i=f[13].label+"")&&B(o,i),m&1&&a!==(a=f[13].align=="right"?"85%":"")&&u(n,"x",a),m&1&&r!==(r="tick tick-"+f[13].value+" tick-"+f[13].color)&&u(e,"class",r),m&65&&c!==(c="translate(0, "+f[6](f[13].value)+")")&&u(e,"transform",c)},d(f){f&&w(e)}}}function la(t){let e,l,n=t[9].label+"",i,o,a;return{c(){e=Ue("g"),l=Ue("text"),i=C(n),u(l,"x",o=t[3]/2),u(l,"y","-4"),u(e,"class","tick"),u(e,"transform",a="translate("+t[5](t[11])+","+t[4]+")")},m(r,c){y(r,e,c),s(e,l),s(l,i)},p(r,c){c&1&&n!==(n=r[9].label+"")&&B(i,n),c&8&&o!==(o=r[3]/2)&&u(l,"x",o),c&48&&a!==(a="translate("+r[5](r[11])+","+r[4]+")")&&u(e,"transform",a)},d(r){r&&w(e)}}}function na(t){let e,l,n,i,o,a,r,c=t[3]>15&&ia(t);return{c(){e=Ue("rect"),c&&c.c(),r=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](t[9].value)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),u(e,"fill",a=t[9].color)},m(f,m){y(f,e,m),c&&c.m(f,m),y(f,r,m)},p(f,m){m&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),m&65&&n!==(n=f[6](f[9].value))&&u(e,"y",n),m&8&&i!==(i=f[3]-4)&&u(e,"width",i),m&65&&o!==(o=f[6](f[0].y.min)-f[6](Math.min(f[0].y.min,0)+f[9].value))&&u(e,"height",o),m&1&&a!==(a=f[9].color)&&u(e,"fill",a),f[3]>15?c?c.p(f,m):(c=ia(f),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(r)}}}function ia(t){let e,l=t[9].label+"",n,i,o,a,r,c,f;return{c(){e=Ue("text"),n=C(l),u(e,"y",i=t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10),u(e,"x",o=t[5](t[11])+t[3]/2),u(e,"width",a=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",r=t[3]<25?"left":"middle"),u(e,"fill",c=t[6](t[9].value)>t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",f="rotate("+(t[3]<25?90:0)+", "+(t[5](t[11])+t[3]/2)+", "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+9)+")")},m(m,_){y(m,e,_),s(e,n)},p(m,_){_&1&&l!==(l=m[9].label+"")&&B(n,l),_&193&&i!==(i=m[6](m[9].value)>m[6](0)-m[7]?m[6](m[9].value)-m[7]:m[6](m[9].value)+10)&&u(e,"y",i),_&40&&o!==(o=m[5](m[11])+m[3]/2)&&u(e,"x",o),_&8&&a!==(a=m[3]-4)&&u(e,"width",a),_&8&&r!==(r=m[3]<25?"left":"middle")&&u(e,"text-anchor",r),_&193&&c!==(c=m[6](m[9].value)>m[6](0)-m[7]?m[9].color:"white")&&u(e,"fill",c),_&233&&f!==(f="rotate("+(m[3]<25?90:0)+", "+(m[5](m[11])+m[3]/2)+", "+(m[6](m[9].value)>m[6](0)-m[7]?m[6](m[9].value)-m[7]:m[6](m[9].value)+9)+")")&&u(e,"transform",f)},d(m){m&&w(e)}}}function sa(t){let e,l,n,i,o,a,r,c=t[3]>15&&oa(t);return{c(){e=Ue("rect"),c&&c.c(),r=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](0)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),u(e,"fill",a=t[9].color)},m(f,m){y(f,e,m),c&&c.m(f,m),y(f,r,m)},p(f,m){m&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),m&64&&n!==(n=f[6](0))&&u(e,"y",n),m&8&&i!==(i=f[3]-4)&&u(e,"width",i),m&65&&o!==(o=f[6](f[0].y.min)-f[6](f[0].y.min+f[9].value2))&&u(e,"height",o),m&1&&a!==(a=f[9].color)&&u(e,"fill",a),f[3]>15?c?c.p(f,m):(c=oa(f),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(r)}}}function oa(t){let e,l=t[9].label2+"",n,i,o,a,r,c,f;return{c(){e=Ue("text"),n=C(l),u(e,"y",i=t[6](-t[9].value2)t[6](0)-12?t[6](t[9].value2-t[0].y.min)-12:t[6](t[9].value2-t[0].y.min)+9)+")")},m(m,_){y(m,e,_),s(e,n)},p(m,_){_&1&&l!==(l=m[9].label2+"")&&B(n,l),_&65&&i!==(i=m[6](-m[9].value2)m[6](0)-12?m[6](m[9].value2-m[0].y.min)-12:m[6](m[9].value2-m[0].y.min)+9)+")")&&u(e,"transform",f)},d(m){m&&w(e)}}}function ua(t){let e,l,n=t[9].value!==void 0&&na(t),i=t[9].value2>1e-4&&sa(t);return{c(){n&&n.c(),e=We(),i&&i.c(),l=We()},m(o,a){n&&n.m(o,a),y(o,e,a),i&&i.m(o,a),y(o,l,a)},p(o,a){o[9].value!==void 0?n?n.p(o,a):(n=na(o),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,a):(i=sa(o),i.c(),i.m(l.parentNode,l)):i&&(i.d(1),i=null)},d(o){n&&n.d(o),o&&w(e),i&&i.d(o),o&&w(l)}}}function Tp(t){let e,l,n,i,o,a,r,c=t[0].title&&ea(t),f=t[0].y.ticks,m=[];for(let g=0;gt[8].call(e))},m(g,$){y(g,e,$),c&&c.m(e,null),s(e,l),s(e,n),s(n,i);for(let k=0;k{"config"in h&&l(0,n=h.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,f=o-(n.title?20:0));let h=i-(n.padding.left+n.padding.right);l(3,a=h/n.points.length),l(7,m=a<25?28:17);let b=(f-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,r=function(d){return d*a+n.padding.left}),l(6,c=function(d){let g=0;return d>n.y.max?g=n.padding.bottom:df||g<0?0:g})}},[n,i,o,a,f,r,c,m,_]}class Vl extends Ce{constructor(e){super(),$e(this,e,Sp,Tp,ye,{config:0})}}function Pp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Mp(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:a}=e,r={};function c(f){return{label:we(f)+"V",value:isNaN(f)?0:f,color:q1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,a=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],m=[];n>0&&(f.push({label:a===1?"L1-L2":"L1"}),m.push(c(n))),i>0&&(f.push({label:a===1?"L1-L3":"L2"}),m.push(c(i))),o>0&&(f.push({label:a===1?"L2-L3":"L3"}),m.push(c(o))),l(0,r={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:m})}},[r,n,i,o,a]}class Ap extends Ce{constructor(e){super(),$e(this,e,Mp,Pp,ye,{u1:1,u2:2,u3:3,ds:4})}}function Dp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Np(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:a}=e,{i2:r}=e,{i3:c}=e,{max:f}=e,m={};function _(h){return{label:we(h)+"A",value:isNaN(h)?0:h,color:oc(h?h/f*100:0)}}return t.$$set=h=>{"u1"in h&&l(1,n=h.u1),"u2"in h&&l(2,i=h.u2),"u3"in h&&l(3,o=h.u3),"i1"in h&&l(4,a=h.i1),"i2"in h&&l(5,r=h.i2),"i3"in h&&l(6,c=h.i3),"max"in h&&l(7,f=h.max)},t.$$.update=()=>{if(t.$$.dirty&254){let h=[],b=[];n>0&&(h.push({label:"L1"}),b.push(_(a))),i>0&&(h.push({label:"L2"}),b.push(_(r))),o>0&&(h.push({label:"L3"}),b.push(_(c))),l(0,m={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:f,ticks:[{value:0,label:"0%"},{value:f/4,label:"25%"},{value:f/2,label:"50%"},{value:f/4*3,label:"75%"},{value:f,label:"100%"}]},x:{ticks:h},points:b})}},[m,n,i,o,a,r,c,f]}class Ip extends Ce{constructor(e){super(),$e(this,e,Np,Dp,ye,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function Ep(t){let e,l,n,i,o,a,r,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,m,_,h,b,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",$,k,T,P,E,S,N,D=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",R,W,O,F,L,j,U=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",q,G;return{c(){e=p("div"),l=p("strong"),l.textContent="Reactive",n=v(),i=p("div"),o=p("div"),o.textContent="Instant in",a=v(),r=p("div"),f=C(c),m=C(" VAr"),_=v(),h=p("div"),h.textContent="Instant out",b=v(),d=p("div"),$=C(g),k=C(" VAr"),T=v(),P=p("div"),E=p("div"),E.textContent="Total in",S=v(),N=p("div"),R=C(D),W=C(" kVArh"),O=v(),F=p("div"),F.textContent="Total out",L=v(),j=p("div"),q=C(U),G=C(" kVArh"),u(r,"class","text-right"),u(d,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(N,"class","text-right"),u(j,"class","text-right"),u(P,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(H,V){y(H,e,V),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(i,r),s(r,f),s(r,m),s(i,_),s(i,h),s(i,b),s(i,d),s(d,$),s(d,k),s(e,T),s(e,P),s(P,E),s(P,S),s(P,N),s(N,R),s(N,W),s(P,O),s(P,F),s(P,L),s(P,j),s(j,q),s(j,G)},p(H,[V]){V&1&&c!==(c=(typeof H[0]<"u"?H[0].toFixed(0):"-")+"")&&B(f,c),V&2&&g!==(g=(typeof H[1]<"u"?H[1].toFixed(0):"-")+"")&&B($,g),V&4&&D!==(D=(typeof H[2]<"u"?H[2].toFixed(1):"-")+"")&&B(R,D),V&8&&U!==(U=(typeof H[3]<"u"?H[3].toFixed(1):"-")+"")&&B(q,U)},i:ie,o:ie,d(H){H&&w(e)}}}function Rp(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e;return t.$$set=r=>{"importInstant"in r&&l(0,n=r.importInstant),"exportInstant"in r&&l(1,i=r.exportInstant),"importTotal"in r&&l(2,o=r.importTotal),"exportTotal"in r&&l(3,a=r.exportTotal)},[n,i,o,a]}class Fp extends Ce{constructor(e){super(),$e(this,e,Rp,Ep,ye,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function ra(t){let e;function l(o,a){return o[2]?qp:Lp}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,a){i.m(o,a),y(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&w(e)}}}function Lp(t){let e,l,n,i,o,a,r=we(t[0].h.u,2)+"",c,f,m,_,h,b,d=we(t[0].d.u,1)+"",g,$,k,T,P,E,S=we(t[0].m.u)+"",N,D,R,W,O=t[3]&&aa(t);return{c(){e=p("strong"),e.textContent="Consumption",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=C(" kWh"),m=v(),_=p("div"),_.textContent="Day",h=v(),b=p("div"),g=C(d),$=C(" kWh"),k=v(),T=p("div"),T.textContent="Month",P=v(),E=p("div"),N=C(S),D=C(" kWh"),R=v(),O&&O.c(),W=We(),u(a,"class","text-right"),u(b,"class","text-right"),u(E,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(F,L){y(F,e,L),y(F,l,L),y(F,n,L),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,m),s(n,_),s(n,h),s(n,b),s(b,g),s(b,$),s(n,k),s(n,T),s(n,P),s(n,E),s(E,N),s(E,D),y(F,R,L),O&&O.m(F,L),y(F,W,L)},p(F,L){L&1&&r!==(r=we(F[0].h.u,2)+"")&&B(c,r),L&1&&d!==(d=we(F[0].d.u,1)+"")&&B(g,d),L&1&&S!==(S=we(F[0].m.u)+"")&&B(N,S),F[3]?O?O.p(F,L):(O=aa(F),O.c(),O.m(W.parentNode,W)):O&&(O.d(1),O=null)},d(F){F&&w(e),F&&w(l),F&&w(n),F&&w(R),O&&O.d(F),F&&w(W)}}}function qp(t){let e,l,n,i,o,a,r=we(t[0].h.u,2)+"",c,f,m,_,h,b,d,g=we(t[0].d.u,1)+"",$,k,T,P,E,S,N,D=we(t[0].m.u)+"",R,W,O,F,L,j,U,q,G,H,V,X=we(t[0].h.p,2)+"",ne,le,_e,Te,ve,qe,be,Ee=we(t[0].d.p,1)+"",he,Ne,pe,me,se,re,K,ae=we(t[0].m.p)+"",Ae,te,ue,He,Se=t[3]&&fa(t),de=t[3]&&ca(t),De=t[3]&&pa(t),Oe=t[3]&&ma(t),ge=t[3]&&_a(t),ke=t[3]&&da(t);return{c(){e=p("strong"),e.textContent="Import",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=C(" kWh"),m=v(),Se&&Se.c(),_=v(),h=p("div"),h.textContent="Day",b=v(),d=p("div"),$=C(g),k=C(" kWh"),T=v(),de&&de.c(),P=v(),E=p("div"),E.textContent="Month",S=v(),N=p("div"),R=C(D),W=C(" kWh"),O=v(),De&&De.c(),L=v(),j=p("strong"),j.textContent="Export",U=v(),q=p("div"),G=p("div"),G.textContent="Hour",H=v(),V=p("div"),ne=C(X),le=C(" kWh"),_e=v(),Oe&&Oe.c(),Te=v(),ve=p("div"),ve.textContent="Day",qe=v(),be=p("div"),he=C(Ee),Ne=C(" kWh"),pe=v(),ge&&ge.c(),me=v(),se=p("div"),se.textContent="Month",re=v(),K=p("div"),Ae=C(ae),te=C(" kWh"),ue=v(),ke&&ke.c(),u(a,"class","text-right"),u(d,"class","text-right"),u(N,"class","text-right"),u(n,"class",F="grid grid-cols-"+t[4]+" mb-3"),u(V,"class","text-right"),u(be,"class","text-right"),u(K,"class","text-right"),u(q,"class",He="grid grid-cols-"+t[4])},m(x,oe){y(x,e,oe),y(x,l,oe),y(x,n,oe),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,m),Se&&Se.m(n,null),s(n,_),s(n,h),s(n,b),s(n,d),s(d,$),s(d,k),s(n,T),de&&de.m(n,null),s(n,P),s(n,E),s(n,S),s(n,N),s(N,R),s(N,W),s(n,O),De&&De.m(n,null),y(x,L,oe),y(x,j,oe),y(x,U,oe),y(x,q,oe),s(q,G),s(q,H),s(q,V),s(V,ne),s(V,le),s(q,_e),Oe&&Oe.m(q,null),s(q,Te),s(q,ve),s(q,qe),s(q,be),s(be,he),s(be,Ne),s(q,pe),ge&&ge.m(q,null),s(q,me),s(q,se),s(q,re),s(q,K),s(K,Ae),s(K,te),s(q,ue),ke&&ke.m(q,null)},p(x,oe){oe&1&&r!==(r=we(x[0].h.u,2)+"")&&B(c,r),x[3]?Se?Se.p(x,oe):(Se=fa(x),Se.c(),Se.m(n,_)):Se&&(Se.d(1),Se=null),oe&1&&g!==(g=we(x[0].d.u,1)+"")&&B($,g),x[3]?de?de.p(x,oe):(de=ca(x),de.c(),de.m(n,P)):de&&(de.d(1),de=null),oe&1&&D!==(D=we(x[0].m.u)+"")&&B(R,D),x[3]?De?De.p(x,oe):(De=pa(x),De.c(),De.m(n,null)):De&&(De.d(1),De=null),oe&16&&F!==(F="grid grid-cols-"+x[4]+" mb-3")&&u(n,"class",F),oe&1&&X!==(X=we(x[0].h.p,2)+"")&&B(ne,X),x[3]?Oe?Oe.p(x,oe):(Oe=ma(x),Oe.c(),Oe.m(q,Te)):Oe&&(Oe.d(1),Oe=null),oe&1&&Ee!==(Ee=we(x[0].d.p,1)+"")&&B(he,Ee),x[3]?ge?ge.p(x,oe):(ge=_a(x),ge.c(),ge.m(q,me)):ge&&(ge.d(1),ge=null),oe&1&&ae!==(ae=we(x[0].m.p)+"")&&B(Ae,ae),x[3]?ke?ke.p(x,oe):(ke=da(x),ke.c(),ke.m(q,null)):ke&&(ke.d(1),ke=null),oe&16&&He!==(He="grid grid-cols-"+x[4])&&u(q,"class",He)},d(x){x&&w(e),x&&w(l),x&&w(n),Se&&Se.d(),de&&de.d(),De&&De.d(),x&&w(L),x&&w(j),x&&w(U),x&&w(q),Oe&&Oe.d(),ge&&ge.d(),ke&&ke.d()}}}function aa(t){let e,l,n,i,o,a,r=we(t[0].h.c,2)+"",c,f,m,_,h,b,d,g=we(t[0].d.c,1)+"",$,k,T,P,E,S,N,D=we(t[0].m.c)+"",R,W,O;return{c(){e=p("strong"),e.textContent="Cost",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=v(),m=C(t[1]),_=v(),h=p("div"),h.textContent="Day",b=v(),d=p("div"),$=C(g),k=v(),T=C(t[1]),P=v(),E=p("div"),E.textContent="Month",S=v(),N=p("div"),R=C(D),W=v(),O=C(t[1]),u(a,"class","text-right"),u(d,"class","text-right"),u(N,"class","text-right"),u(n,"class","grid grid-cols-2")},m(F,L){y(F,e,L),y(F,l,L),y(F,n,L),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(a,m),s(n,_),s(n,h),s(n,b),s(n,d),s(d,$),s(d,k),s(d,T),s(n,P),s(n,E),s(n,S),s(n,N),s(N,R),s(N,W),s(N,O)},p(F,L){L&1&&r!==(r=we(F[0].h.c,2)+"")&&B(c,r),L&2&&B(m,F[1]),L&1&&g!==(g=we(F[0].d.c,1)+"")&&B($,g),L&2&&B(T,F[1]),L&1&&D!==(D=we(F[0].m.c)+"")&&B(R,D),L&2&&B(O,F[1])},d(F){F&&w(e),F&&w(l),F&&w(n)}}}function fa(t){let e,l=we(t[0].h.c,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].h.c,2)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function ca(t){let e,l=we(t[0].d.c,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].d.c,1)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function pa(t){let e,l=we(t[0].m.c)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].m.c)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function ma(t){let e,l=we(t[0].h.i,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].h.i,2)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function _a(t){let e,l=we(t[0].d.i,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].d.i,1)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function da(t){let e,l=we(t[0].m.i)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].m.i)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function Op(t){let e,l,n,i,o,a,r=t[0]&&ra(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Real time calculation",n=v(),i=p("br"),o=p("br"),a=v(),r&&r.c(),u(e,"class","mx-2 text-sm")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),r&&r.m(e,null)},p(c,[f]){c[0]?r?r.p(c,f):(r=ra(c),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},i:ie,o:ie,d(c){c&&w(e),r&&r.d()}}}function Up(t,e,l){let{data:n}=e,{currency:i}=e,{hasExport:o}=e,a=!1,r=3;return t.$$set=c=>{"data"in c&&l(0,n=c.data),"currency"in c&&l(1,i=c.currency),"hasExport"in c&&l(2,o=c.hasExport)},t.$$.update=()=>{t.$$.dirty&3&&(l(4,r=i?3:2),l(3,a=n&&n.h&&(n.h.c||n.d.c||n.m.c||n.h.i||n.d.i||n.m.i)))},[n,i,o,a,r]}class Hp extends Ce{constructor(e){super(),$e(this,e,Up,Op,ye,{data:0,currency:1,hasExport:2})}}function jp(t){let e,l,n,i;return n=new Vl({props:{config:t[0]}}),{c(){e=p("a"),e.textContent="Provided by ENTSO-E",l=v(),J(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,a){y(o,e,a),y(o,l,a),Q(n,o,a),i=!0},p(o,[a]){const r={};a&1&&(r.config=o[0]),n.$set(r)},i(o){i||(M(n.$$.fragment,o),i=!0)},o(o){I(n.$$.fragment,o),i=!1},d(o){o&&w(e),o&&w(l),Z(n,o)}}}function Wp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=new Date().getUTCHours(),c=0,f=0,m=0,_=n[20]==null?2:1,h=[],b=[],d=[],g=new Date;for(c=r;c<24&&(f=n[Ie(m++)],f!=null);c++)b.push({label:Ie(g.getHours())}),d.push({label:f>0?f.toFixed(_):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(_):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,a=Math.min(a,f*100)),l(2,o=Math.max(o,f*100)),ri(g,1);for(c=0;c<24&&(f=n[Ie(m++)],f!=null);c++)b.push({label:Ie(g.getHours())}),d.push({label:f>0?f.toFixed(_):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(_):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,a=Math.min(a,f*100)),l(2,o=Math.max(o,f*100)),ri(g,1);if(l(2,o=Math.ceil(o)),l(3,a=Math.floor(a)),a<0){let k=a/4;for(c=1;c<5;c++){let T=k*c;h.push({value:T,label:(T/100).toFixed(2)})}}let $=o/4;for(c=0;c<5;c++){let k=$*c;h.push({value:k,label:(k/100).toFixed(2)})}l(0,i={title:"Future energy price ("+n.currency+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:h},x:{ticks:b},points:d})}},[i,n,o,a]}class Gp extends Ce{constructor(e){super(),$e(this,e,Wp,jp,ye,{json:1})}}function Bp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Yp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=[],f=[],m=[],_=ri(new Date,-24),h=new Date().getUTCHours();for(r=h;r<24;r++){let g=n["i"+Ie(r)],$=n["e"+Ie(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(_.getHours())}),m.push({label:g.toFixed(1),value:g*10,label2:$.toFixed(1),value2:$*10,color:"#7c3aed"}),l(3,a=Math.max(a,$*10)),l(2,o=Math.max(o,g*10)),ri(_,1)}for(r=0;r{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=[],f=[],m=[],_=new Date,h=new Date;for(h.setDate(0),r=_.getDate();r<=h.getDate();r++){let g=n["i"+Ie(r)],$=n["e"+Ie(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(r)}),m.push({label:g.toFixed(0),value:g,label2:$.toFixed(0),value2:$,color:"#7c3aed"}),l(3,a=Math.max(a,$)),l(2,o=Math.max(o,g))}for(r=1;r<_.getDate();r++){let g=n["i"+Ie(r)],$=n["e"+Ie(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(r)}),m.push({label:g.toFixed(0),value:g,label2:$.toFixed(0),value2:$,color:"#7c3aed"}),l(3,a=Math.max(a,$)),l(2,o=Math.max(o,g))}let b=Math.ceil(Math.max(a,o)/10)*10;if(l(2,o=b),l(3,a=a==0?0:b*-1),a<0){let g=a/4;for(r=0;r<5;r++){let $=g*r;c.push({value:$,label:$.toFixed(0)})}}let d=o/4;for(r=0;r<5;r++){let g=d*r;c.push({value:g,label:g.toFixed(0)})}l(0,i={title:"Energy use last month (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:c},x:{ticks:f},points:m})}},[i,n,o,a]}class Qp extends Ce{constructor(e){super(),$e(this,e,Kp,Vp,ye,{json:1})}}function Zp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Jp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=0,f=[],m=[],_=[];n.s&&n.s.forEach((d,g)=>{var $=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),m.push({label:$.slice(-4)}),_.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,a=Math.min(a,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,a=Math.floor(a));let h=o;a<0&&(h+=Math.abs(a));let b=h/4;for(r=0;r<5;r++)c=a+b*r,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:f},x:{ticks:m},points:_})}},[i,n,o,a]}class Xp extends Ce{constructor(e){super(),$e(this,e,Jp,Zp,ye,{json:1})}}function xp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}let em=0;function tm(t,e,l){let n={},i=0,o;return mc.subscribe(a=>{l(2,o=a)}),pc(),t.$$.update=()=>{if(t.$$.dirty&6){let a=0,r=[],c=[],f=[];if(r.push({value:0,label:0}),o&&o.p)for(a=0;a0?Ie(m.d)+"."+Ks[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,m.v))}if(o&&o.t){for(a=0;a=i)break;r.push({value:m,label:m})}r.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(r.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:em,max:i,ticks:r},x:{ticks:c},points:f})}},[n,i,o]}class lm extends Ce{constructor(e){super(),$e(this,e,tm,xp,ye,{})}}function va(t){let e,l,n,i,o,a,r=(t[0].mt?hs(t[0].mt):"-")+"",c,f,m,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",h,b,d;return i=new bc({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:oc}}),{c(){e=p("div"),l=p("div"),n=p("div"),J(i.$$.fragment),o=v(),a=p("div"),c=C(r),f=v(),m=p("div"),h=C(_),b=C(" kWh"),u(n,"class","col-span-2"),u(m,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,$){y(g,e,$),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,a),s(a,c),s(l,f),s(l,m),s(m,h),s(m,b),d=!0},p(g,$){const k={};$&1&&(k.val=g[0].i?g[0].i:0),$&1&&(k.max=g[0].im?g[0].im:15e3),$&1&&(k.sub=g[0].p),$&1&&(k.subunit=g[0].pc),i.$set(k),(!d||$&1)&&r!==(r=(g[0].mt?hs(g[0].mt):"-")+"")&&B(c,r),(!d||$&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&B(h,_)},i(g){d||(M(i.$$.fragment,g),d=!0)},o(g){I(i.$$.fragment,g),d=!1},d(g){g&&w(e),Z(i)}}}function ha(t){let e,l,n,i,o,a,r,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",m,_,h;return i=new bc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:O1}}),{c(){e=p("div"),l=p("div"),n=p("div"),J(i.$$.fragment),o=v(),a=p("div"),r=v(),c=p("div"),m=C(f),_=C(" kWh"),u(n,"class","col-span-2"),u(c,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(b,d){y(b,e,d),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,a),s(l,r),s(l,c),s(c,m),s(c,_),h=!0},p(b,d){const g={};d&1&&(g.val=b[0].e?b[0].e:0),d&1&&(g.max=b[0].om?b[0].om*1e3:1e4),i.$set(g),(!h||d&1)&&f!==(f=(b[0].ec?b[0].ec.toFixed(1):"-")+"")&&B(m,f)},i(b){h||(M(i.$$.fragment,b),h=!0)},o(b){I(i.$$.fragment,b),h=!1},d(b){b&&w(e),Z(i)}}}function ba(t){let e,l,n;return l=new Ap({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.ds=i[0].ds),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function ga(t){let e,l,n;return l=new Ip({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=p("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.i1=i[0].i1),o&1&&(a.i2=i[0].i2),o&1&&(a.i3=i[0].i3),o&1&&(a.max=i[0].mf?i[0].mf:32),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function ka(t){let e,l,n;return l=new Fp({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function wa(t){let e,l,n;return l=new Hp({props:{data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.data=i[0].ea),o&1&&(a.currency=i[0].pc),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function ya(t){let e,l,n;return l=new lm({}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function $a(t){let e,l,n;return l=new Gp({props:{json:t[2]}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&4&&(a.json=i[2]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ca(t){let e,l,n;return l=new zp({props:{json:t[3]}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&8&&(a.json=i[3]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ta(t){let e,l,n;return l=new Qp({props:{json:t[4]}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&16&&(a.json=i[4]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Sa(t){let e,l,n;return l=new Xp({props:{json:t[5]}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&32&&(a.json=i[5]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function nm(t){let e,l=je(t[1].ui.i,t[0].i),n,i=je(t[1].ui.e,t[0].om||t[0].e>0),o,a=je(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),r,c=je(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,m=je(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,h=je(t[1].ui.c,t[0].ea),b,d=je(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,$=je(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),k,T=je(t[1].ui.d,t[3]),P,E=je(t[1].ui.m,t[4]),S,N=je(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),D,R=l&&va(t),W=i&&ha(t),O=a&&ba(t),F=c&&ga(t),L=m&&ka(t),j=h&&wa(t),U=d&&ya(),q=$&&$a(t),G=T&&Ca(t),H=E&&Ta(t),V=N&&Sa(t);return{c(){e=p("div"),R&&R.c(),n=v(),W&&W.c(),o=v(),O&&O.c(),r=v(),F&&F.c(),f=v(),L&&L.c(),_=v(),j&&j.c(),b=v(),U&&U.c(),g=v(),q&&q.c(),k=v(),G&&G.c(),P=v(),H&&H.c(),S=v(),V&&V.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(X,ne){y(X,e,ne),R&&R.m(e,null),s(e,n),W&&W.m(e,null),s(e,o),O&&O.m(e,null),s(e,r),F&&F.m(e,null),s(e,f),L&&L.m(e,null),s(e,_),j&&j.m(e,null),s(e,b),U&&U.m(e,null),s(e,g),q&&q.m(e,null),s(e,k),G&&G.m(e,null),s(e,P),H&&H.m(e,null),s(e,S),V&&V.m(e,null),D=!0},p(X,[ne]){ne&3&&(l=je(X[1].ui.i,X[0].i)),l?R?(R.p(X,ne),ne&3&&M(R,1)):(R=va(X),R.c(),M(R,1),R.m(e,n)):R&&(Pe(),I(R,1,1,()=>{R=null}),Me()),ne&3&&(i=je(X[1].ui.e,X[0].om||X[0].e>0)),i?W?(W.p(X,ne),ne&3&&M(W,1)):(W=ha(X),W.c(),M(W,1),W.m(e,o)):W&&(Pe(),I(W,1,1,()=>{W=null}),Me()),ne&3&&(a=je(X[1].ui.v,X[0].u1>100||X[0].u2>100||X[0].u3>100)),a?O?(O.p(X,ne),ne&3&&M(O,1)):(O=ba(X),O.c(),M(O,1),O.m(e,r)):O&&(Pe(),I(O,1,1,()=>{O=null}),Me()),ne&3&&(c=je(X[1].ui.a,X[0].i1>.01||X[0].i2>.01||X[0].i3>.01)),c?F?(F.p(X,ne),ne&3&&M(F,1)):(F=ga(X),F.c(),M(F,1),F.m(e,f)):F&&(Pe(),I(F,1,1,()=>{F=null}),Me()),ne&3&&(m=je(X[1].ui.r,X[0].ri>0||X[0].re>0||X[0].ric>0||X[0].rec>0)),m?L?(L.p(X,ne),ne&3&&M(L,1)):(L=ka(X),L.c(),M(L,1),L.m(e,_)):L&&(Pe(),I(L,1,1,()=>{L=null}),Me()),ne&3&&(h=je(X[1].ui.c,X[0].ea)),h?j?(j.p(X,ne),ne&3&&M(j,1)):(j=wa(X),j.c(),M(j,1),j.m(e,b)):j&&(Pe(),I(j,1,1,()=>{j=null}),Me()),ne&3&&(d=je(X[1].ui.t,X[0].pr&&(X[0].pr.startsWith("10YNO")||X[0].pr=="10Y1001A1001A48H"))),d?U?ne&3&&M(U,1):(U=ya(),U.c(),M(U,1),U.m(e,g)):U&&(Pe(),I(U,1,1,()=>{U=null}),Me()),ne&3&&($=je(X[1].ui.p,X[0].pe&&!Number.isNaN(X[0].p))),$?q?(q.p(X,ne),ne&3&&M(q,1)):(q=$a(X),q.c(),M(q,1),q.m(e,k)):q&&(Pe(),I(q,1,1,()=>{q=null}),Me()),ne&10&&(T=je(X[1].ui.d,X[3])),T?G?(G.p(X,ne),ne&10&&M(G,1)):(G=Ca(X),G.c(),M(G,1),G.m(e,P)):G&&(Pe(),I(G,1,1,()=>{G=null}),Me()),ne&18&&(E=je(X[1].ui.m,X[4])),E?H?(H.p(X,ne),ne&18&&M(H,1)):(H=Ta(X),H.c(),M(H,1),H.m(e,S)):H&&(Pe(),I(H,1,1,()=>{H=null}),Me()),ne&35&&(N=je(X[1].ui.s,X[0].t&&X[0].t!=-127&&X[5].c>1)),N?V?(V.p(X,ne),ne&35&&M(V,1)):(V=Sa(X),V.c(),M(V,1),V.m(e,null)):V&&(Pe(),I(V,1,1,()=>{V=null}),Me())},i(X){D||(M(R),M(W),M(O),M(F),M(L),M(j),M(U),M(q),M(G),M(H),M(V),D=!0)},o(X){I(R),I(W),I(O),I(F),I(L),I(j),I(U),I(q),I(G),I(H),I(V),D=!1},d(X){X&&w(e),R&&R.d(),W&&W.d(),O&&O.d(),F&&F.d(),L&&L.d(),j&&j.d(),U&&U.d(),q&&q.d(),G&&G.d(),H&&H.d(),V&&V.d()}}}function im(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},a={},r={},c={};return uc.subscribe(f=>{l(2,o=f)}),rc.subscribe(f=>{l(3,a=f)}),ac.subscribe(f=>{l(4,r=f)}),cc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,a,r,c]}class sm extends Ce{constructor(e){super(),$e(this,e,im,nm,ye,{data:0,sysinfo:1})}}let to={};const gc=Je(to);async function om(){to=await(await fetch("/configuration.json")).json(),gc.set(to)}function Pa(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function um(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function rm(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Ma(t){let e;return{c(){e=p("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Aa(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART1",l=v(),n=p("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){y(i,e,o),y(i,l,o),y(i,n,o)},d(i){i&&w(e),i&&w(l),i&&w(n)}}}function Da(t){let e;return{c(){e=p("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Na(t){let e,l,n;return{c(){e=p("option"),l=C("GPIO"),n=C(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){y(i,e,o),s(e,l),s(e,n)},d(i){i&&w(e)}}}function Ia(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))&&Na(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Na(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&w(e)}}}function am(t){let e,l,n,i,o;function a(d,g){return d[0]=="esp32c3"?rm:um}let r=a(t),c=r(t),f=t[0]=="esp8266"&&Ma(),m=(t[0]=="esp32"||t[0]=="esp32solo")&&Aa(),_=t[0]=="esp32s2"&&Da(),h={length:t[1]+1},b=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class kc extends Ce{constructor(e){super(),$e(this,e,fm,am,ye,{chip:0})}}function Ea(t){let e,l,n=t[1]&&Ra(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){y(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Ra(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&w(e),n&&n.d()}}}function Ra(t){let e,l;return{c(){e=p("div"),l=C(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){y(n,e,i),s(e,l)},p(n,i){i&2&&B(l,n[1])},d(n){n&&w(e)}}}function cm(t){let e,l=t[0]&&Ea(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ea(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&w(e)}}}function pm(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class gt extends Ce{constructor(e){super(),$e(this,e,pm,cm,ye,{active:0,message:1})}}function Fa(t,e,l){const n=t.slice();return n[1]=e[l],n}function La(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,a){y(o,e,a),s(e,l),s(e,i)},p:ie,d(o){o&&w(e)}}}function mm(t){let e,l,n,i=t[0],o=[];for(let a=0;a{a[m]=null}),Me(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function Cm(t){let e,l;return e=new Kt({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Tm(t){let e,l;return e=new Kt({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Sm(t){let e,l,n,i;const o=[Tm,Cm],a=[];function r(c,f){return c[3].q.s.r?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e!==m&&(Pe(),I(a[m],1,1,()=>{a[m]=null}),Me(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function Pm(t){let e,l;return e=new Kt({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Mm(t){let e,l;return e=new Kt({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Am(t){let e,l,n,i;const o=[Mm,Pm],a=[];function r(c,f){return c[3].q.s.k?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e!==m&&(Pe(),I(a[m],1,1,()=>{a[m]=null}),Me(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function Va(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U,q,G;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Domoticz",n=v(),i=p("a"),J(o.$$.fragment),a=v(),r=p("input"),c=v(),f=p("div"),m=p("div"),_=C("Electricity IDX"),h=p("br"),b=v(),d=p("input"),g=v(),$=p("div"),k=C("Current IDX"),T=p("br"),P=v(),E=p("input"),S=v(),N=p("div"),D=C(`Voltage IDX: L1, L2 & L3 + `),o.c(),l=We()},m(a,r){y(a,e,r),o.m(a,r),y(a,l,r)},p(a,r){i===(i=n(a))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},d(a){a&&w(e),o.d(a),a&&w(l)}}}function B1(t){let e,l;return{c(){e=C(t[0]),l=C(" seconds")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&1&&B(e,n[0])},d(n){n&&w(e),n&&w(l)}}}function Y1(t){let e,l;return{c(){e=C(t[3]),l=C(" minute")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function z1(t){let e,l;return{c(){e=C(t[3]),l=C(" minutes")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function V1(t){let e,l;return{c(){e=C(t[2]),l=C(" hour")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function K1(t){let e,l;return{c(){e=C(t[2]),l=C(" hours")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function Q1(t){let e,l;return{c(){e=C(t[1]),l=C(" day")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function Z1(t){let e,l;return{c(){e=C(t[1]),l=C(" days")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function J1(t){let e,l=t[0]&&Wr(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Wr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&w(e)}}}function X1(t,e,l){let{epoch:n}=e,i=0,o=0,a=0;return t.$$set=r=>{"epoch"in r&&l(0,n=r.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,a=Math.floor(n/60)))},[n,i,o,a]}class x1 extends Ce{constructor(e){super(),$e(this,e,X1,J1,ye,{epoch:0})}}function ep(t){let e,l,n;return{c(){e=p("span"),l=C(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){y(i,e,o),s(e,l)},p(i,[o]){o&4&&B(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ie,o:ie,d(i){i&&w(e)}}}function tp(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class Kt extends Ce{constructor(e){super(),$e(this,e,tp,ep,ye,{color:0,title:1,text:2})}}function lp(t){let e,l=`${Ie(t[0].getDate())}.${Ie(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ie(t[0].getHours())}:${Ie(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=C(l),u(e,"class",t[1])},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ie(i[0].getDate())}.${Ie(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ie(i[0].getHours())}:${Ie(i[0].getMinutes())}`)&&B(n,l),o&2&&u(e,"class",i[1])},d(i){i&&w(e)}}}function np(t){let e=`${Ie(t[0].getDate())}. ${Ks[t[0].getMonth()]} ${Ie(t[0].getHours())}:${Ie(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&1&&e!==(e=`${Ie(n[0].getDate())}. ${Ks[n[0].getMonth()]} ${Ie(n[0].getHours())}:${Ie(n[0].getMinutes())}`)&&B(l,e)},d(n){n&&w(l)}}}function ip(t){let e,l;function n(a,r){return r&1&&(e=null),e==null&&(e=Math.abs(new Date().getTime()-a[0].getTime())<3e5),e?np:lp}let i=n(t,-1),o=i(t);return{c(){o.c(),l=We()},m(a,r){o.m(a,r),y(a,l,r)},p(a,[r]){i===(i=n(a,r))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},i:ie,o:ie,d(a){o.d(a),a&&w(l)}}}function sp(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e;return t.$$set=o=>{"timestamp"in o&&l(0,n=o.timestamp),"fullTimeColor"in o&&l(1,i=o.fullTimeColor)},[n,i]}class vc extends Ce{constructor(e){super(),$e(this,e,sp,ip,ye,{timestamp:0,fullTimeColor:1})}}function op(t){let e,l,n;return{c(){e=Ue("svg"),l=Ue("path"),n=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){y(i,e,o),s(e,l),s(e,n)},p:ie,i:ie,o:ie,d(i){i&&w(e)}}}class up extends Ce{constructor(e){super(),$e(this,e,null,op,ye,{})}}function rp(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&w(e)}}}class ap extends Ce{constructor(e){super(),$e(this,e,null,rp,ye,{})}}function fp(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&w(e)}}}class $t extends Ce{constructor(e){super(),$e(this,e,null,fp,ye,{})}}function cp(t){let e,l;return{c(){e=Ue("svg"),l=Ue("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&w(e)}}}class hc extends Ce{constructor(e){super(),$e(this,e,null,cp,ye,{})}}function pp(t){let e,l,n=t[1].version+"",i;return{c(){e=C("AMS reader "),l=p("span"),i=C(n)},m(o,a){y(o,e,a),y(o,l,a),s(l,i)},p(o,a){a&2&&n!==(n=o[1].version+"")&&B(i,n)},d(o){o&&w(e),o&&w(l)}}}function Gr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=C(l),i=C("\xB0C"),u(e,"class","flex-none my-auto")},m(o,a){y(o,e,a),s(e,n),s(e,i)},p(o,a){a&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&B(n,l)},d(o){o&&w(e)}}}function Br(t){let e,l="HAN: "+Lr(t[0].he),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Lr(i[0].he))&&B(n,l)},d(i){i&&w(e)}}}function Yr(t){let e,l="MQTT: "+qr(t[0].me),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+qr(i[0].me))&&B(n,l)},d(i){i&&w(e)}}}function zr(t){let e,l="PriceAPI: "+Or(t[0].ee),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Or(i[0].ee))&&B(n,l)},d(i){i&&w(e)}}}function Vr(t){let e,l,n,i,o,a;return l=new wl({props:{to:"/configuration",$$slots:{default:[mp]},$$scope:{ctx:t}}}),o=new wl({props:{to:"/status",$$slots:{default:[_p]},$$scope:{ctx:t}}}),{c(){e=p("div"),J(l.$$.fragment),n=v(),i=p("div"),J(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(r,c){y(r,e,c),Q(l,e,null),y(r,n,c),y(r,i,c),Q(o,i,null),a=!0},i(r){a||(M(l.$$.fragment,r),M(o.$$.fragment,r),a=!0)},o(r){I(l.$$.fragment,r),I(o.$$.fragment,r),a=!1},d(r){r&&w(e),Z(l),r&&w(n),r&&w(i),Z(o)}}}function mp(t){let e,l;return e=new up({}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function _p(t){let e,l;return e=new ap({}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Kr(t){let e,l,n,i,o;const a=[vp,dp],r=[];function c(f,m){return f[1].security==0||f[0].a?0:1}return l=c(t),n=r[l]=a[l](t),{c(){e=p("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(f,m){y(f,e,m),r[l].m(e,null),o=!0},p(f,m){let _=l;l=c(f),l===_?r[l].p(f,m):(Pe(),I(r[_],1,1,()=>{r[_]=null}),Me(),n=r[l],n?n.p(f,m):(n=r[l]=a[l](f),n.c()),M(n,1),n.m(e,null)),(!o||m&4&&i!==(i="New version: "+f[2].tag_name))&&u(e,"title",i)},i(f){o||(M(n),o=!0)},o(f){I(n),o=!1},d(f){f&&w(e),r[l].d()}}}function dp(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=p("span"),l=C("New version: "),i=C(n)},m(o,a){y(o,e,a),s(e,l),s(e,i)},p(o,a){a&4&&n!==(n=o[2].tag_name+"")&&B(i,n)},i:ie,o:ie,d(o){o&&w(e)}}}function vp(t){let e,l,n,i=t[2].tag_name+"",o,a,r,c,f,m;return r=new hc({}),{c(){e=p("button"),l=p("span"),n=C("New version: "),o=C(i),a=v(),J(r.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(_,h){y(_,e,h),s(e,l),s(l,n),s(l,o),s(e,a),Q(r,e,null),c=!0,f||(m=z(e,"click",t[3]),f=!0)},p(_,h){(!c||h&4)&&i!==(i=_[2].tag_name+"")&&B(o,i)},i(_){c||(M(r.$$.fragment,_),c=!0)},o(_){I(r.$$.fragment,_),c=!1},d(_){_&&w(e),Z(r),f=!1,m()}}}function hp(t){let e,l,n,i,o,a,r,c,f,m,_,h,b=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U,q,G,H,V,X,ne,le,_e,Te,ve,qe,be,Ee;i=new wl({props:{to:"/",$$slots:{default:[pp]},$$scope:{ctx:t}}}),c=new x1({props:{epoch:t[0].u}});let he=t[0].t>-50&&Gr(t);T=new Kt({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:kl(t[1].booting?2:t[0].em)}}),E=new Kt({props:{title:"HAN",text:"HAN",color:kl(t[1].booting?9:t[0].hm)}}),N=new Kt({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:kl(t[1].booting?9:t[0].wm)}}),R=new Kt({props:{title:"MQTT",text:"MQTT",color:kl(t[1].booting?9:t[0].mm)}});let Ne=(t[0].he<0||t[0].he>0)&&Br(t),pe=t[0].me<0&&Yr(t),me=(t[0].ee>0||t[0].ee<0)&&zr(t);ne=new vc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),fullTimeColor:"text-red-500"}});let se=t[1].vndcfg&&t[1].usrcfg&&Vr(t);qe=new $t({});let re=t[1].fwconsent===1&&t[2]&&Kr(t);return{c(){e=p("nav"),l=p("div"),n=p("div"),J(i.$$.fragment),o=v(),a=p("div"),r=p("div"),J(c.$$.fragment),f=v(),he&&he.c(),m=v(),_=p("div"),h=C("Free mem: "),d=C(b),g=C("kb"),$=v(),k=p("div"),J(T.$$.fragment),P=v(),J(E.$$.fragment),S=v(),J(N.$$.fragment),D=v(),J(R.$$.fragment),W=v(),Ne&&Ne.c(),O=v(),pe&&pe.c(),F=v(),me&&me.c(),L=v(),j=p("div"),U=p("div"),q=p("a"),G=p("img"),V=v(),X=p("div"),J(ne.$$.fragment),le=v(),se&&se.c(),_e=v(),Te=p("div"),ve=p("a"),J(qe.$$.fragment),be=v(),re&&re.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(r,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(a,"class","flex-none my-auto p-2 flex space-x-4"),u(k,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(G,"class","gh-logo"),Cc(G.src,H=G1)||u(G,"src",H),u(G,"alt","GitHub repo"),u(q,"class","float-right"),u(q,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(q,"target","_blank"),u(q,"rel","noreferrer"),u(q,"aria-label","GitHub"),u(U,"class","flex-none"),u(X,"class","flex-none my-auto px-2"),u(ve,"href",Ct("")),u(ve,"target","_blank"),u(ve,"rel","noreferrer"),u(Te,"class","flex-none px-1 mt-1"),u(Te,"title","Documentation"),u(j,"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(K,ae){y(K,e,ae),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,a),s(a,r),Q(c,r,null),s(a,f),he&&he.m(a,null),s(a,m),s(a,_),s(_,h),s(_,d),s(_,g),s(l,$),s(l,k),Q(T,k,null),s(k,P),Q(E,k,null),s(k,S),Q(N,k,null),s(k,D),Q(R,k,null),s(l,W),Ne&&Ne.m(l,null),s(l,O),pe&&pe.m(l,null),s(l,F),me&&me.m(l,null),s(l,L),s(l,j),s(j,U),s(U,q),s(q,G),s(j,V),s(j,X),Q(ne,X,null),s(j,le),se&&se.m(j,null),s(j,_e),s(j,Te),s(Te,ve),Q(qe,ve,null),s(j,be),re&&re.m(j,null),Ee=!0},p(K,[ae]){const Ae={};ae&18&&(Ae.$$scope={dirty:ae,ctx:K}),i.$set(Ae);const te={};ae&1&&(te.epoch=K[0].u),c.$set(te),K[0].t>-50?he?he.p(K,ae):(he=Gr(K),he.c(),he.m(a,m)):he&&(he.d(1),he=null),(!Ee||ae&1)&&b!==(b=(K[0].m?(K[0].m/1e3).toFixed(1):"-")+"")&&B(d,b);const ue={};ae&3&&(ue.text=K[1].booting?"Booting":K[0].v>2?K[0].v.toFixed(2)+"V":"ESP"),ae&3&&(ue.color=kl(K[1].booting?2:K[0].em)),T.$set(ue);const He={};ae&3&&(He.color=kl(K[1].booting?9:K[0].hm)),E.$set(He);const Se={};ae&1&&(Se.text=K[0].r?K[0].r.toFixed(0)+"dBm":"WiFi"),ae&3&&(Se.color=kl(K[1].booting?9:K[0].wm)),N.$set(Se);const de={};ae&3&&(de.color=kl(K[1].booting?9:K[0].mm)),R.$set(de),K[0].he<0||K[0].he>0?Ne?Ne.p(K,ae):(Ne=Br(K),Ne.c(),Ne.m(l,O)):Ne&&(Ne.d(1),Ne=null),K[0].me<0?pe?pe.p(K,ae):(pe=Yr(K),pe.c(),pe.m(l,F)):pe&&(pe.d(1),pe=null),K[0].ee>0||K[0].ee<0?me?me.p(K,ae):(me=zr(K),me.c(),me.m(l,L)):me&&(me.d(1),me=null);const De={};ae&1&&(De.timestamp=K[0].c?new Date(K[0].c*1e3):new Date(0)),ne.$set(De),K[1].vndcfg&&K[1].usrcfg?se?ae&2&&M(se,1):(se=Vr(K),se.c(),M(se,1),se.m(j,_e)):se&&(Pe(),I(se,1,1,()=>{se=null}),Me()),K[1].fwconsent===1&&K[2]?re?(re.p(K,ae),ae&6&&M(re,1)):(re=Kr(K),re.c(),M(re,1),re.m(j,null)):re&&(Pe(),I(re,1,1,()=>{re=null}),Me())},i(K){Ee||(M(i.$$.fragment,K),M(c.$$.fragment,K),M(T.$$.fragment,K),M(E.$$.fragment,K),M(N.$$.fragment,K),M(R.$$.fragment,K),M(ne.$$.fragment,K),M(se),M(qe.$$.fragment,K),M(re),Ee=!0)},o(K){I(i.$$.fragment,K),I(c.$$.fragment,K),I(T.$$.fragment,K),I(E.$$.fragment,K),I(N.$$.fragment,K),I(R.$$.fragment,K),I(ne.$$.fragment,K),I(se),I(qe.$$.fragment,K),I(re),Ee=!1},d(K){K&&w(e),Z(i),Z(c),he&&he.d(),Z(T),Z(E),Z(N),Z(R),Ne&&Ne.d(),pe&&pe.d(),me&&me.d(),Z(ne),se&&se.d(),Z(qe),re&&re.d()}}}function bp(t,e,l){let{data:n={}}=e,i={},o={};function a(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!Yn(i.board)||confirm(bs(ce(i.chip,i.board))))&&(Tt.update(r=>(r.upgrading=!0,r)),_c())}return Tt.subscribe(r=>{l(1,i=r),r.fwconsent===1&&W1()}),_o.subscribe(r=>{l(2,o=dc(i.version,r))}),t.$$set=r=>{"data"in r&&l(0,n=r.data)},[n,i,o,a]}class gp extends Ce{constructor(e){super(),$e(this,e,bp,hp,ye,{data:0})}}function kp(t){let e,l,n,i;return{c(){e=Ue("svg"),l=Ue("path"),n=Ue("path"),u(l,"d",Gs(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Gs(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,a){y(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=Gs(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),a&2&&u(n,"stroke",o[1])},i:ie,o:ie,d(o){o&&w(e)}}}function Qr(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 Gs(t,e,l,n,i){var o=Qr(t,e,l,i),a=Qr(t,e,l,n),r=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,r,0,a.x,a.y].join(" ");return c}function wp(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 yp extends Ce{constructor(e){super(),$e(this,e,wp,kp,ye,{pct:0,color:1})}}function Zr(t){let e,l,n,i,o,a,r,c;return{c(){e=p("br"),l=v(),n=p("span"),i=C(t[3]),o=v(),a=p("span"),r=C(t[4]),c=C("/kWh"),u(n,"class","pl-sub"),u(a,"class","pl-snt")},m(f,m){y(f,e,m),y(f,l,m),y(f,n,m),s(n,i),y(f,o,m),y(f,a,m),s(a,r),s(a,c)},p(f,m){m&8&&B(i,f[3]),m&16&&B(r,f[4])},d(f){f&&w(e),f&&w(l),f&&w(n),f&&w(o),f&&w(a)}}}function $p(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$;l=new yp({props:{pct:t[6],color:t[5](t[6])}});let k=t[3]&&Zr(t);return{c(){e=p("div"),J(l.$$.fragment),n=v(),i=p("span"),o=p("span"),a=C(t[2]),r=v(),c=p("br"),f=v(),m=p("span"),_=C(t[0]),h=v(),b=p("span"),d=C(t[1]),g=v(),k&&k.c(),u(o,"class","pl-lab"),u(m,"class","pl-val"),u(b,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(T,P){y(T,e,P),Q(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,r),s(i,c),s(i,f),s(i,m),s(m,_),s(i,h),s(i,b),s(b,d),s(i,g),k&&k.m(i,null),$=!0},p(T,[P]){const E={};P&64&&(E.pct=T[6]),P&96&&(E.color=T[5](T[6])),l.$set(E),(!$||P&4)&&B(a,T[2]),(!$||P&1)&&B(_,T[0]),(!$||P&2)&&B(d,T[1]),T[3]?k?k.p(T,P):(k=Zr(T),k.c(),k.m(i,null)):k&&(k.d(1),k=null)},i(T){$||(M(l.$$.fragment,T),$=!0)},o(T){I(l.$$.fragment,T),$=!1},d(T){T&&w(e),Z(l),k&&k.d()}}}function Cp(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:r=""}=e,{subunit:c=""}=e,{colorFn:f}=e,m=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,a=_.label),"sub"in _&&l(3,r=_.sub),"subunit"in _&&l(4,c=_.subunit),"colorFn"in _&&l(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,m=Math.min(n,i)/i*100)},[n,o,a,r,c,f,m,i]}class bc extends Ce{constructor(e){super(),$e(this,e,Cp,$p,ye,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Jr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Xr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function xr(t,e,l){const n=t.slice();return n[13]=e[l],n}function ea(t){let e,l=t[0].title+"",n;return{c(){e=p("strong"),n=C(l),u(e,"class","text-sm")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[0].title+"")&&B(n,l)},d(i){i&&w(e)}}}function ta(t){let e,l,n,i=t[13].label+"",o,a,r,c;return{c(){e=Ue("g"),l=Ue("line"),n=Ue("text"),o=C(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",a=t[13].align=="right"?"85%":""),u(e,"class",r="tick tick-"+t[13].value+" tick-"+t[13].color),u(e,"transform",c="translate(0, "+t[6](t[13].value)+")")},m(f,m){y(f,e,m),s(e,l),s(e,n),s(n,o)},p(f,m){m&1&&i!==(i=f[13].label+"")&&B(o,i),m&1&&a!==(a=f[13].align=="right"?"85%":"")&&u(n,"x",a),m&1&&r!==(r="tick tick-"+f[13].value+" tick-"+f[13].color)&&u(e,"class",r),m&65&&c!==(c="translate(0, "+f[6](f[13].value)+")")&&u(e,"transform",c)},d(f){f&&w(e)}}}function la(t){let e,l,n=t[9].label+"",i,o,a;return{c(){e=Ue("g"),l=Ue("text"),i=C(n),u(l,"x",o=t[3]/2),u(l,"y","-4"),u(e,"class","tick"),u(e,"transform",a="translate("+t[5](t[11])+","+t[4]+")")},m(r,c){y(r,e,c),s(e,l),s(l,i)},p(r,c){c&1&&n!==(n=r[9].label+"")&&B(i,n),c&8&&o!==(o=r[3]/2)&&u(l,"x",o),c&48&&a!==(a="translate("+r[5](r[11])+","+r[4]+")")&&u(e,"transform",a)},d(r){r&&w(e)}}}function na(t){let e,l,n,i,o,a,r,c=t[3]>15&&ia(t);return{c(){e=Ue("rect"),c&&c.c(),r=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](t[9].value)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),u(e,"fill",a=t[9].color)},m(f,m){y(f,e,m),c&&c.m(f,m),y(f,r,m)},p(f,m){m&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),m&65&&n!==(n=f[6](f[9].value))&&u(e,"y",n),m&8&&i!==(i=f[3]-4)&&u(e,"width",i),m&65&&o!==(o=f[6](f[0].y.min)-f[6](Math.min(f[0].y.min,0)+f[9].value))&&u(e,"height",o),m&1&&a!==(a=f[9].color)&&u(e,"fill",a),f[3]>15?c?c.p(f,m):(c=ia(f),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(r)}}}function ia(t){let e,l=t[9].label+"",n,i,o,a,r,c,f;return{c(){e=Ue("text"),n=C(l),u(e,"y",i=t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10),u(e,"x",o=t[5](t[11])+t[3]/2),u(e,"width",a=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",r=t[3]<25?"left":"middle"),u(e,"fill",c=t[6](t[9].value)>t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",f="rotate("+(t[3]<25?90:0)+", "+(t[5](t[11])+t[3]/2)+", "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+9)+")")},m(m,_){y(m,e,_),s(e,n)},p(m,_){_&1&&l!==(l=m[9].label+"")&&B(n,l),_&193&&i!==(i=m[6](m[9].value)>m[6](0)-m[7]?m[6](m[9].value)-m[7]:m[6](m[9].value)+10)&&u(e,"y",i),_&40&&o!==(o=m[5](m[11])+m[3]/2)&&u(e,"x",o),_&8&&a!==(a=m[3]-4)&&u(e,"width",a),_&8&&r!==(r=m[3]<25?"left":"middle")&&u(e,"text-anchor",r),_&193&&c!==(c=m[6](m[9].value)>m[6](0)-m[7]?m[9].color:"white")&&u(e,"fill",c),_&233&&f!==(f="rotate("+(m[3]<25?90:0)+", "+(m[5](m[11])+m[3]/2)+", "+(m[6](m[9].value)>m[6](0)-m[7]?m[6](m[9].value)-m[7]:m[6](m[9].value)+9)+")")&&u(e,"transform",f)},d(m){m&&w(e)}}}function sa(t){let e,l,n,i,o,a,r,c=t[3]>15&&oa(t);return{c(){e=Ue("rect"),c&&c.c(),r=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](0)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),u(e,"fill",a=t[9].color)},m(f,m){y(f,e,m),c&&c.m(f,m),y(f,r,m)},p(f,m){m&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),m&64&&n!==(n=f[6](0))&&u(e,"y",n),m&8&&i!==(i=f[3]-4)&&u(e,"width",i),m&65&&o!==(o=f[6](f[0].y.min)-f[6](f[0].y.min+f[9].value2))&&u(e,"height",o),m&1&&a!==(a=f[9].color)&&u(e,"fill",a),f[3]>15?c?c.p(f,m):(c=oa(f),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(r)}}}function oa(t){let e,l=t[9].label2+"",n,i,o,a,r,c,f;return{c(){e=Ue("text"),n=C(l),u(e,"y",i=t[6](-t[9].value2)t[6](0)-12?t[6](t[9].value2-t[0].y.min)-12:t[6](t[9].value2-t[0].y.min)+9)+")")},m(m,_){y(m,e,_),s(e,n)},p(m,_){_&1&&l!==(l=m[9].label2+"")&&B(n,l),_&65&&i!==(i=m[6](-m[9].value2)m[6](0)-12?m[6](m[9].value2-m[0].y.min)-12:m[6](m[9].value2-m[0].y.min)+9)+")")&&u(e,"transform",f)},d(m){m&&w(e)}}}function ua(t){let e,l,n=t[9].value!==void 0&&na(t),i=t[9].value2>1e-4&&sa(t);return{c(){n&&n.c(),e=We(),i&&i.c(),l=We()},m(o,a){n&&n.m(o,a),y(o,e,a),i&&i.m(o,a),y(o,l,a)},p(o,a){o[9].value!==void 0?n?n.p(o,a):(n=na(o),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,a):(i=sa(o),i.c(),i.m(l.parentNode,l)):i&&(i.d(1),i=null)},d(o){n&&n.d(o),o&&w(e),i&&i.d(o),o&&w(l)}}}function Tp(t){let e,l,n,i,o,a,r,c=t[0].title&&ea(t),f=t[0].y.ticks,m=[];for(let g=0;gt[8].call(e))},m(g,$){y(g,e,$),c&&c.m(e,null),s(e,l),s(e,n),s(n,i);for(let k=0;k{"config"in h&&l(0,n=h.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,f=o-(n.title?20:0));let h=i-(n.padding.left+n.padding.right);l(3,a=h/n.points.length),l(7,m=a<25?28:17);let b=(f-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,r=function(d){return d*a+n.padding.left}),l(6,c=function(d){let g=0;return d>n.y.max?g=n.padding.bottom:df||g<0?0:g})}},[n,i,o,a,f,r,c,m,_]}class Vl extends Ce{constructor(e){super(),$e(this,e,Sp,Tp,ye,{config:0})}}function Pp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Mp(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:a}=e,r={};function c(f){return{label:we(f)+"V",value:isNaN(f)?0:f,color:q1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,a=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],m=[];n>0&&(f.push({label:a===1?"L1-L2":"L1"}),m.push(c(n))),i>0&&(f.push({label:a===1?"L1-L3":"L2"}),m.push(c(i))),o>0&&(f.push({label:a===1?"L2-L3":"L3"}),m.push(c(o))),l(0,r={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:m})}},[r,n,i,o,a]}class Ap extends Ce{constructor(e){super(),$e(this,e,Mp,Pp,ye,{u1:1,u2:2,u3:3,ds:4})}}function Dp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Np(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:a}=e,{i2:r}=e,{i3:c}=e,{max:f}=e,m={};function _(h){return{label:we(h)+"A",value:isNaN(h)?0:h,color:oc(h?h/f*100:0)}}return t.$$set=h=>{"u1"in h&&l(1,n=h.u1),"u2"in h&&l(2,i=h.u2),"u3"in h&&l(3,o=h.u3),"i1"in h&&l(4,a=h.i1),"i2"in h&&l(5,r=h.i2),"i3"in h&&l(6,c=h.i3),"max"in h&&l(7,f=h.max)},t.$$.update=()=>{if(t.$$.dirty&254){let h=[],b=[];n>0&&(h.push({label:"L1"}),b.push(_(a))),i>0&&(h.push({label:"L2"}),b.push(_(r))),o>0&&(h.push({label:"L3"}),b.push(_(c))),l(0,m={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:f,ticks:[{value:0,label:"0%"},{value:f/4,label:"25%"},{value:f/2,label:"50%"},{value:f/4*3,label:"75%"},{value:f,label:"100%"}]},x:{ticks:h},points:b})}},[m,n,i,o,a,r,c,f]}class Ip extends Ce{constructor(e){super(),$e(this,e,Np,Dp,ye,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function Ep(t){let e,l,n,i,o,a,r,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,m,_,h,b,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",$,k,T,P,E,S,N,D=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",R,W,O,F,L,j,U=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",q,G;return{c(){e=p("div"),l=p("strong"),l.textContent="Reactive",n=v(),i=p("div"),o=p("div"),o.textContent="Instant in",a=v(),r=p("div"),f=C(c),m=C(" VAr"),_=v(),h=p("div"),h.textContent="Instant out",b=v(),d=p("div"),$=C(g),k=C(" VAr"),T=v(),P=p("div"),E=p("div"),E.textContent="Total in",S=v(),N=p("div"),R=C(D),W=C(" kVArh"),O=v(),F=p("div"),F.textContent="Total out",L=v(),j=p("div"),q=C(U),G=C(" kVArh"),u(r,"class","text-right"),u(d,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(N,"class","text-right"),u(j,"class","text-right"),u(P,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(H,V){y(H,e,V),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(i,r),s(r,f),s(r,m),s(i,_),s(i,h),s(i,b),s(i,d),s(d,$),s(d,k),s(e,T),s(e,P),s(P,E),s(P,S),s(P,N),s(N,R),s(N,W),s(P,O),s(P,F),s(P,L),s(P,j),s(j,q),s(j,G)},p(H,[V]){V&1&&c!==(c=(typeof H[0]<"u"?H[0].toFixed(0):"-")+"")&&B(f,c),V&2&&g!==(g=(typeof H[1]<"u"?H[1].toFixed(0):"-")+"")&&B($,g),V&4&&D!==(D=(typeof H[2]<"u"?H[2].toFixed(1):"-")+"")&&B(R,D),V&8&&U!==(U=(typeof H[3]<"u"?H[3].toFixed(1):"-")+"")&&B(q,U)},i:ie,o:ie,d(H){H&&w(e)}}}function Rp(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e;return t.$$set=r=>{"importInstant"in r&&l(0,n=r.importInstant),"exportInstant"in r&&l(1,i=r.exportInstant),"importTotal"in r&&l(2,o=r.importTotal),"exportTotal"in r&&l(3,a=r.exportTotal)},[n,i,o,a]}class Fp extends Ce{constructor(e){super(),$e(this,e,Rp,Ep,ye,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function ra(t){let e;function l(o,a){return o[2]?qp:Lp}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,a){i.m(o,a),y(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&w(e)}}}function Lp(t){let e,l,n,i,o,a,r=we(t[0].h.u,2)+"",c,f,m,_,h,b,d=we(t[0].d.u,1)+"",g,$,k,T,P,E,S=we(t[0].m.u)+"",N,D,R,W,O=t[3]&&aa(t);return{c(){e=p("strong"),e.textContent="Consumption",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=C(" kWh"),m=v(),_=p("div"),_.textContent="Day",h=v(),b=p("div"),g=C(d),$=C(" kWh"),k=v(),T=p("div"),T.textContent="Month",P=v(),E=p("div"),N=C(S),D=C(" kWh"),R=v(),O&&O.c(),W=We(),u(a,"class","text-right"),u(b,"class","text-right"),u(E,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(F,L){y(F,e,L),y(F,l,L),y(F,n,L),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,m),s(n,_),s(n,h),s(n,b),s(b,g),s(b,$),s(n,k),s(n,T),s(n,P),s(n,E),s(E,N),s(E,D),y(F,R,L),O&&O.m(F,L),y(F,W,L)},p(F,L){L&1&&r!==(r=we(F[0].h.u,2)+"")&&B(c,r),L&1&&d!==(d=we(F[0].d.u,1)+"")&&B(g,d),L&1&&S!==(S=we(F[0].m.u)+"")&&B(N,S),F[3]?O?O.p(F,L):(O=aa(F),O.c(),O.m(W.parentNode,W)):O&&(O.d(1),O=null)},d(F){F&&w(e),F&&w(l),F&&w(n),F&&w(R),O&&O.d(F),F&&w(W)}}}function qp(t){let e,l,n,i,o,a,r=we(t[0].h.u,2)+"",c,f,m,_,h,b,d,g=we(t[0].d.u,1)+"",$,k,T,P,E,S,N,D=we(t[0].m.u)+"",R,W,O,F,L,j,U,q,G,H,V,X=we(t[0].h.p,2)+"",ne,le,_e,Te,ve,qe,be,Ee=we(t[0].d.p,1)+"",he,Ne,pe,me,se,re,K,ae=we(t[0].m.p)+"",Ae,te,ue,He,Se=t[3]&&fa(t),de=t[3]&&ca(t),De=t[3]&&pa(t),Oe=t[3]&&ma(t),ge=t[3]&&_a(t),ke=t[3]&&da(t);return{c(){e=p("strong"),e.textContent="Import",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=C(" kWh"),m=v(),Se&&Se.c(),_=v(),h=p("div"),h.textContent="Day",b=v(),d=p("div"),$=C(g),k=C(" kWh"),T=v(),de&&de.c(),P=v(),E=p("div"),E.textContent="Month",S=v(),N=p("div"),R=C(D),W=C(" kWh"),O=v(),De&&De.c(),L=v(),j=p("strong"),j.textContent="Export",U=v(),q=p("div"),G=p("div"),G.textContent="Hour",H=v(),V=p("div"),ne=C(X),le=C(" kWh"),_e=v(),Oe&&Oe.c(),Te=v(),ve=p("div"),ve.textContent="Day",qe=v(),be=p("div"),he=C(Ee),Ne=C(" kWh"),pe=v(),ge&&ge.c(),me=v(),se=p("div"),se.textContent="Month",re=v(),K=p("div"),Ae=C(ae),te=C(" kWh"),ue=v(),ke&&ke.c(),u(a,"class","text-right"),u(d,"class","text-right"),u(N,"class","text-right"),u(n,"class",F="grid grid-cols-"+t[4]+" mb-3"),u(V,"class","text-right"),u(be,"class","text-right"),u(K,"class","text-right"),u(q,"class",He="grid grid-cols-"+t[4])},m(x,oe){y(x,e,oe),y(x,l,oe),y(x,n,oe),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,m),Se&&Se.m(n,null),s(n,_),s(n,h),s(n,b),s(n,d),s(d,$),s(d,k),s(n,T),de&&de.m(n,null),s(n,P),s(n,E),s(n,S),s(n,N),s(N,R),s(N,W),s(n,O),De&&De.m(n,null),y(x,L,oe),y(x,j,oe),y(x,U,oe),y(x,q,oe),s(q,G),s(q,H),s(q,V),s(V,ne),s(V,le),s(q,_e),Oe&&Oe.m(q,null),s(q,Te),s(q,ve),s(q,qe),s(q,be),s(be,he),s(be,Ne),s(q,pe),ge&&ge.m(q,null),s(q,me),s(q,se),s(q,re),s(q,K),s(K,Ae),s(K,te),s(q,ue),ke&&ke.m(q,null)},p(x,oe){oe&1&&r!==(r=we(x[0].h.u,2)+"")&&B(c,r),x[3]?Se?Se.p(x,oe):(Se=fa(x),Se.c(),Se.m(n,_)):Se&&(Se.d(1),Se=null),oe&1&&g!==(g=we(x[0].d.u,1)+"")&&B($,g),x[3]?de?de.p(x,oe):(de=ca(x),de.c(),de.m(n,P)):de&&(de.d(1),de=null),oe&1&&D!==(D=we(x[0].m.u)+"")&&B(R,D),x[3]?De?De.p(x,oe):(De=pa(x),De.c(),De.m(n,null)):De&&(De.d(1),De=null),oe&16&&F!==(F="grid grid-cols-"+x[4]+" mb-3")&&u(n,"class",F),oe&1&&X!==(X=we(x[0].h.p,2)+"")&&B(ne,X),x[3]?Oe?Oe.p(x,oe):(Oe=ma(x),Oe.c(),Oe.m(q,Te)):Oe&&(Oe.d(1),Oe=null),oe&1&&Ee!==(Ee=we(x[0].d.p,1)+"")&&B(he,Ee),x[3]?ge?ge.p(x,oe):(ge=_a(x),ge.c(),ge.m(q,me)):ge&&(ge.d(1),ge=null),oe&1&&ae!==(ae=we(x[0].m.p)+"")&&B(Ae,ae),x[3]?ke?ke.p(x,oe):(ke=da(x),ke.c(),ke.m(q,null)):ke&&(ke.d(1),ke=null),oe&16&&He!==(He="grid grid-cols-"+x[4])&&u(q,"class",He)},d(x){x&&w(e),x&&w(l),x&&w(n),Se&&Se.d(),de&&de.d(),De&&De.d(),x&&w(L),x&&w(j),x&&w(U),x&&w(q),Oe&&Oe.d(),ge&&ge.d(),ke&&ke.d()}}}function aa(t){let e,l,n,i,o,a,r=we(t[0].h.c,2)+"",c,f,m,_,h,b,d,g=we(t[0].d.c,1)+"",$,k,T,P,E,S,N,D=we(t[0].m.c)+"",R,W,O;return{c(){e=p("strong"),e.textContent="Cost",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=v(),m=C(t[1]),_=v(),h=p("div"),h.textContent="Day",b=v(),d=p("div"),$=C(g),k=v(),T=C(t[1]),P=v(),E=p("div"),E.textContent="Month",S=v(),N=p("div"),R=C(D),W=v(),O=C(t[1]),u(a,"class","text-right"),u(d,"class","text-right"),u(N,"class","text-right"),u(n,"class","grid grid-cols-2")},m(F,L){y(F,e,L),y(F,l,L),y(F,n,L),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(a,m),s(n,_),s(n,h),s(n,b),s(n,d),s(d,$),s(d,k),s(d,T),s(n,P),s(n,E),s(n,S),s(n,N),s(N,R),s(N,W),s(N,O)},p(F,L){L&1&&r!==(r=we(F[0].h.c,2)+"")&&B(c,r),L&2&&B(m,F[1]),L&1&&g!==(g=we(F[0].d.c,1)+"")&&B($,g),L&2&&B(T,F[1]),L&1&&D!==(D=we(F[0].m.c)+"")&&B(R,D),L&2&&B(O,F[1])},d(F){F&&w(e),F&&w(l),F&&w(n)}}}function fa(t){let e,l=we(t[0].h.c,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].h.c,2)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function ca(t){let e,l=we(t[0].d.c,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].d.c,1)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function pa(t){let e,l=we(t[0].m.c)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].m.c)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function ma(t){let e,l=we(t[0].h.i,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].h.i,2)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function _a(t){let e,l=we(t[0].d.i,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].d.i,1)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function da(t){let e,l=we(t[0].m.i)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){y(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=we(a[0].m.i)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&w(e)}}}function Op(t){let e,l,n,i,o,a,r=t[0]&&ra(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Real time calculation",n=v(),i=p("br"),o=p("br"),a=v(),r&&r.c(),u(e,"class","mx-2 text-sm")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),r&&r.m(e,null)},p(c,[f]){c[0]?r?r.p(c,f):(r=ra(c),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},i:ie,o:ie,d(c){c&&w(e),r&&r.d()}}}function Up(t,e,l){let{data:n}=e,{currency:i}=e,{hasExport:o}=e,a=!1,r=3;return t.$$set=c=>{"data"in c&&l(0,n=c.data),"currency"in c&&l(1,i=c.currency),"hasExport"in c&&l(2,o=c.hasExport)},t.$$.update=()=>{t.$$.dirty&3&&(l(4,r=i?3:2),l(3,a=n&&n.h&&(n.h.c||n.d.c||n.m.c||n.h.i||n.d.i||n.m.i)))},[n,i,o,a,r]}class Hp extends Ce{constructor(e){super(),$e(this,e,Up,Op,ye,{data:0,currency:1,hasExport:2})}}function jp(t){let e,l,n,i;return n=new Vl({props:{config:t[0]}}),{c(){e=p("a"),e.textContent="Provided by ENTSO-E",l=v(),J(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,a){y(o,e,a),y(o,l,a),Q(n,o,a),i=!0},p(o,[a]){const r={};a&1&&(r.config=o[0]),n.$set(r)},i(o){i||(M(n.$$.fragment,o),i=!0)},o(o){I(n.$$.fragment,o),i=!1},d(o){o&&w(e),o&&w(l),Z(n,o)}}}function Wp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=new Date().getUTCHours(),c=0,f=0,m=0,_=n[20]==null?2:1,h=[],b=[],d=[],g=new Date;for(c=r;c<24&&(f=n[Ie(m++)],f!=null);c++)b.push({label:Ie(g.getHours())}),d.push({label:f>0?f.toFixed(_):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(_):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,a=Math.min(a,f*100)),l(2,o=Math.max(o,f*100)),ri(g,1);for(c=0;c<24&&(f=n[Ie(m++)],f!=null);c++)b.push({label:Ie(g.getHours())}),d.push({label:f>0?f.toFixed(_):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(_):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,a=Math.min(a,f*100)),l(2,o=Math.max(o,f*100)),ri(g,1);if(l(2,o=Math.ceil(o)),l(3,a=Math.floor(a)),a<0){let k=a/4;for(c=1;c<5;c++){let T=k*c;h.push({value:T,label:(T/100).toFixed(2)})}}let $=o/4;for(c=0;c<5;c++){let k=$*c;h.push({value:k,label:(k/100).toFixed(2)})}l(0,i={title:"Future energy price ("+n.currency+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:h},x:{ticks:b},points:d})}},[i,n,o,a]}class Gp extends Ce{constructor(e){super(),$e(this,e,Wp,jp,ye,{json:1})}}function Bp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Yp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=[],f=[],m=[],_=ri(new Date,-24),h=new Date().getUTCHours();for(r=h;r<24;r++){let g=n["i"+Ie(r)],$=n["e"+Ie(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(_.getHours())}),m.push({label:g.toFixed(1),value:g*10,label2:$.toFixed(1),value2:$*10,color:"#7c3aed"}),l(3,a=Math.max(a,$*10)),l(2,o=Math.max(o,g*10)),ri(_,1)}for(r=0;r{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=[],f=[],m=[],_=new Date,h=new Date;for(h.setDate(0),r=_.getDate();r<=h.getDate();r++){let g=n["i"+Ie(r)],$=n["e"+Ie(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(r)}),m.push({label:g.toFixed(0),value:g,label2:$.toFixed(0),value2:$,color:"#7c3aed"}),l(3,a=Math.max(a,$)),l(2,o=Math.max(o,g))}for(r=1;r<_.getDate();r++){let g=n["i"+Ie(r)],$=n["e"+Ie(r)];g===void 0&&(g=0),$===void 0&&($=0),f.push({label:Ie(r)}),m.push({label:g.toFixed(0),value:g,label2:$.toFixed(0),value2:$,color:"#7c3aed"}),l(3,a=Math.max(a,$)),l(2,o=Math.max(o,g))}let b=Math.ceil(Math.max(a,o)/10)*10;if(l(2,o=b),l(3,a=a==0?0:b*-1),a<0){let g=a/4;for(r=0;r<5;r++){let $=g*r;c.push({value:$,label:$.toFixed(0)})}}let d=o/4;for(r=0;r<5;r++){let g=d*r;c.push({value:g,label:g.toFixed(0)})}l(0,i={title:"Energy use last month (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:c},x:{ticks:f},points:m})}},[i,n,o,a]}class Qp extends Ce{constructor(e){super(),$e(this,e,Kp,Vp,ye,{json:1})}}function Zp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Jp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=0,f=[],m=[],_=[];n.s&&n.s.forEach((d,g)=>{var $=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),m.push({label:$.slice(-4)}),_.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,a=Math.min(a,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,a=Math.floor(a));let h=o;a<0&&(h+=Math.abs(a));let b=h/4;for(r=0;r<5;r++)c=a+b*r,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:f},x:{ticks:m},points:_})}},[i,n,o,a]}class Xp extends Ce{constructor(e){super(),$e(this,e,Jp,Zp,ye,{json:1})}}function xp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){J(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}let em=0;function tm(t,e,l){let n={},i=0,o;return mc.subscribe(a=>{l(2,o=a)}),pc(),t.$$.update=()=>{if(t.$$.dirty&6){let a=0,r=[],c=[],f=[];if(r.push({value:0,label:0}),o&&o.p)for(a=0;a0?Ie(m.d)+"."+Ks[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,m.v))}if(o&&o.t){for(a=0;a=i)break;r.push({value:m,label:m})}r.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(r.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:em,max:i,ticks:r},x:{ticks:c},points:f})}},[n,i,o]}class lm extends Ce{constructor(e){super(),$e(this,e,tm,xp,ye,{})}}function va(t){let e,l,n,i,o,a,r=(t[0].mt?hs(t[0].mt):"-")+"",c,f,m,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",h,b,d;return i=new bc({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:oc}}),{c(){e=p("div"),l=p("div"),n=p("div"),J(i.$$.fragment),o=v(),a=p("div"),c=C(r),f=v(),m=p("div"),h=C(_),b=C(" kWh"),u(n,"class","col-span-2"),u(m,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,$){y(g,e,$),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,a),s(a,c),s(l,f),s(l,m),s(m,h),s(m,b),d=!0},p(g,$){const k={};$&1&&(k.val=g[0].i?g[0].i:0),$&1&&(k.max=g[0].im?g[0].im:15e3),$&1&&(k.sub=g[0].p),$&1&&(k.subunit=g[0].pc),i.$set(k),(!d||$&1)&&r!==(r=(g[0].mt?hs(g[0].mt):"-")+"")&&B(c,r),(!d||$&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&B(h,_)},i(g){d||(M(i.$$.fragment,g),d=!0)},o(g){I(i.$$.fragment,g),d=!1},d(g){g&&w(e),Z(i)}}}function ha(t){let e,l,n,i,o,a,r,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",m,_,h;return i=new bc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:O1}}),{c(){e=p("div"),l=p("div"),n=p("div"),J(i.$$.fragment),o=v(),a=p("div"),r=v(),c=p("div"),m=C(f),_=C(" kWh"),u(n,"class","col-span-2"),u(c,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(b,d){y(b,e,d),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,a),s(l,r),s(l,c),s(c,m),s(c,_),h=!0},p(b,d){const g={};d&1&&(g.val=b[0].e?b[0].e:0),d&1&&(g.max=b[0].om?b[0].om*1e3:1e4),i.$set(g),(!h||d&1)&&f!==(f=(b[0].ec?b[0].ec.toFixed(1):"-")+"")&&B(m,f)},i(b){h||(M(i.$$.fragment,b),h=!0)},o(b){I(i.$$.fragment,b),h=!1},d(b){b&&w(e),Z(i)}}}function ba(t){let e,l,n;return l=new Ap({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.ds=i[0].ds),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function ga(t){let e,l,n;return l=new Ip({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=p("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.i1=i[0].i1),o&1&&(a.i2=i[0].i2),o&1&&(a.i3=i[0].i3),o&1&&(a.max=i[0].mf?i[0].mf:32),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function ka(t){let e,l,n;return l=new Fp({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function wa(t){let e,l,n;return l=new Hp({props:{data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.data=i[0].ea),o&1&&(a.currency=i[0].pc),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function ya(t){let e,l,n;return l=new lm({}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function $a(t){let e,l,n;return l=new Gp({props:{json:t[2]}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&4&&(a.json=i[2]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ca(t){let e,l,n;return l=new zp({props:{json:t[3]}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&8&&(a.json=i[3]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ta(t){let e,l,n;return l=new Qp({props:{json:t[4]}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&16&&(a.json=i[4]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Sa(t){let e,l,n;return l=new Xp({props:{json:t[5]}}),{c(){e=p("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&32&&(a.json=i[5]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function nm(t){let e,l=je(t[1].ui.i,t[0].i),n,i=je(t[1].ui.e,t[0].om||t[0].e>0),o,a=je(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),r,c=je(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,m=je(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,h=je(t[1].ui.c,t[0].ea),b,d=je(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,$=je(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),k,T=je(t[1].ui.d,t[3]),P,E=je(t[1].ui.m,t[4]),S,N=je(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),D,R=l&&va(t),W=i&&ha(t),O=a&&ba(t),F=c&&ga(t),L=m&&ka(t),j=h&&wa(t),U=d&&ya(),q=$&&$a(t),G=T&&Ca(t),H=E&&Ta(t),V=N&&Sa(t);return{c(){e=p("div"),R&&R.c(),n=v(),W&&W.c(),o=v(),O&&O.c(),r=v(),F&&F.c(),f=v(),L&&L.c(),_=v(),j&&j.c(),b=v(),U&&U.c(),g=v(),q&&q.c(),k=v(),G&&G.c(),P=v(),H&&H.c(),S=v(),V&&V.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(X,ne){y(X,e,ne),R&&R.m(e,null),s(e,n),W&&W.m(e,null),s(e,o),O&&O.m(e,null),s(e,r),F&&F.m(e,null),s(e,f),L&&L.m(e,null),s(e,_),j&&j.m(e,null),s(e,b),U&&U.m(e,null),s(e,g),q&&q.m(e,null),s(e,k),G&&G.m(e,null),s(e,P),H&&H.m(e,null),s(e,S),V&&V.m(e,null),D=!0},p(X,[ne]){ne&3&&(l=je(X[1].ui.i,X[0].i)),l?R?(R.p(X,ne),ne&3&&M(R,1)):(R=va(X),R.c(),M(R,1),R.m(e,n)):R&&(Pe(),I(R,1,1,()=>{R=null}),Me()),ne&3&&(i=je(X[1].ui.e,X[0].om||X[0].e>0)),i?W?(W.p(X,ne),ne&3&&M(W,1)):(W=ha(X),W.c(),M(W,1),W.m(e,o)):W&&(Pe(),I(W,1,1,()=>{W=null}),Me()),ne&3&&(a=je(X[1].ui.v,X[0].u1>100||X[0].u2>100||X[0].u3>100)),a?O?(O.p(X,ne),ne&3&&M(O,1)):(O=ba(X),O.c(),M(O,1),O.m(e,r)):O&&(Pe(),I(O,1,1,()=>{O=null}),Me()),ne&3&&(c=je(X[1].ui.a,X[0].i1>.01||X[0].i2>.01||X[0].i3>.01)),c?F?(F.p(X,ne),ne&3&&M(F,1)):(F=ga(X),F.c(),M(F,1),F.m(e,f)):F&&(Pe(),I(F,1,1,()=>{F=null}),Me()),ne&3&&(m=je(X[1].ui.r,X[0].ri>0||X[0].re>0||X[0].ric>0||X[0].rec>0)),m?L?(L.p(X,ne),ne&3&&M(L,1)):(L=ka(X),L.c(),M(L,1),L.m(e,_)):L&&(Pe(),I(L,1,1,()=>{L=null}),Me()),ne&3&&(h=je(X[1].ui.c,X[0].ea)),h?j?(j.p(X,ne),ne&3&&M(j,1)):(j=wa(X),j.c(),M(j,1),j.m(e,b)):j&&(Pe(),I(j,1,1,()=>{j=null}),Me()),ne&3&&(d=je(X[1].ui.t,X[0].pr&&(X[0].pr.startsWith("10YNO")||X[0].pr=="10Y1001A1001A48H"))),d?U?ne&3&&M(U,1):(U=ya(),U.c(),M(U,1),U.m(e,g)):U&&(Pe(),I(U,1,1,()=>{U=null}),Me()),ne&3&&($=je(X[1].ui.p,X[0].pe&&!Number.isNaN(X[0].p))),$?q?(q.p(X,ne),ne&3&&M(q,1)):(q=$a(X),q.c(),M(q,1),q.m(e,k)):q&&(Pe(),I(q,1,1,()=>{q=null}),Me()),ne&10&&(T=je(X[1].ui.d,X[3])),T?G?(G.p(X,ne),ne&10&&M(G,1)):(G=Ca(X),G.c(),M(G,1),G.m(e,P)):G&&(Pe(),I(G,1,1,()=>{G=null}),Me()),ne&18&&(E=je(X[1].ui.m,X[4])),E?H?(H.p(X,ne),ne&18&&M(H,1)):(H=Ta(X),H.c(),M(H,1),H.m(e,S)):H&&(Pe(),I(H,1,1,()=>{H=null}),Me()),ne&35&&(N=je(X[1].ui.s,X[0].t&&X[0].t!=-127&&X[5].c>1)),N?V?(V.p(X,ne),ne&35&&M(V,1)):(V=Sa(X),V.c(),M(V,1),V.m(e,null)):V&&(Pe(),I(V,1,1,()=>{V=null}),Me())},i(X){D||(M(R),M(W),M(O),M(F),M(L),M(j),M(U),M(q),M(G),M(H),M(V),D=!0)},o(X){I(R),I(W),I(O),I(F),I(L),I(j),I(U),I(q),I(G),I(H),I(V),D=!1},d(X){X&&w(e),R&&R.d(),W&&W.d(),O&&O.d(),F&&F.d(),L&&L.d(),j&&j.d(),U&&U.d(),q&&q.d(),G&&G.d(),H&&H.d(),V&&V.d()}}}function im(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},a={},r={},c={};return uc.subscribe(f=>{l(2,o=f)}),rc.subscribe(f=>{l(3,a=f)}),ac.subscribe(f=>{l(4,r=f)}),cc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,a,r,c]}class sm extends Ce{constructor(e){super(),$e(this,e,im,nm,ye,{data:0,sysinfo:1})}}let to={};const gc=Je(to);async function om(){to=await(await fetch("/configuration.json")).json(),gc.set(to)}function Pa(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function um(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function rm(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Ma(t){let e;return{c(){e=p("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Aa(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART1",l=v(),n=p("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){y(i,e,o),y(i,l,o),y(i,n,o)},d(i){i&&w(e),i&&w(l),i&&w(n)}}}function Da(t){let e;return{c(){e=p("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Na(t){let e,l,n;return{c(){e=p("option"),l=C("GPIO"),n=C(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){y(i,e,o),s(e,l),s(e,n)},d(i){i&&w(e)}}}function Ia(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))&&Na(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Na(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&w(e)}}}function am(t){let e,l,n,i,o;function a(d,g){return d[0]=="esp32c3"?rm:um}let r=a(t),c=r(t),f=t[0]=="esp8266"&&Ma(),m=(t[0]=="esp32"||t[0]=="esp32solo")&&Aa(),_=t[0]=="esp32s2"&&Da(),h={length:t[1]+1},b=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class kc extends Ce{constructor(e){super(),$e(this,e,fm,am,ye,{chip:0})}}function Ea(t){let e,l,n=t[1]&&Ra(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){y(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Ra(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&w(e),n&&n.d()}}}function Ra(t){let e,l;return{c(){e=p("div"),l=C(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){y(n,e,i),s(e,l)},p(n,i){i&2&&B(l,n[1])},d(n){n&&w(e)}}}function cm(t){let e,l=t[0]&&Ea(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ea(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&w(e)}}}function pm(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class gt extends Ce{constructor(e){super(),$e(this,e,pm,cm,ye,{active:0,message:1})}}function Fa(t,e,l){const n=t.slice();return n[1]=e[l],n}function La(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,a){y(o,e,a),s(e,l),s(e,i)},p:ie,d(o){o&&w(e)}}}function mm(t){let e,l,n,i=t[0],o=[];for(let a=0;a{a[m]=null}),Me(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function Cm(t){let e,l;return e=new Kt({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Tm(t){let e,l;return e=new Kt({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Sm(t){let e,l,n,i;const o=[Tm,Cm],a=[];function r(c,f){return c[3].q.s.r?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e!==m&&(Pe(),I(a[m],1,1,()=>{a[m]=null}),Me(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function Pm(t){let e,l;return e=new Kt({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Mm(t){let e,l;return e=new Kt({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Am(t){let e,l,n,i;const o=[Mm,Pm],a=[];function r(c,f){return c[3].q.s.k?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),y(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e!==m&&(Pe(),I(a[m],1,1,()=>{a[m]=null}),Me(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&w(n)}}}function Va(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U,q,G;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Domoticz",n=v(),i=p("a"),J(o.$$.fragment),a=v(),r=p("input"),c=v(),f=p("div"),m=p("div"),_=C("Electricity IDX"),h=p("br"),b=v(),d=p("input"),g=v(),$=p("div"),k=C("Current IDX"),T=p("br"),P=v(),E=p("input"),S=v(),N=p("div"),D=C(`Voltage IDX: L1, L2 & L3 `),R=p("div"),W=p("input"),O=v(),F=p("input"),L=v(),j=p("input"),u(l,"class","text-sm"),u(i,"href",Ct("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(r,"type","hidden"),u(r,"name","o"),r.value="true",u(d,"name","oe"),u(d,"type","text"),u(d,"class","in-f tr w-full"),u(m,"class","w-1/2"),u(E,"name","oc"),u(E,"type","text"),u(E,"class","in-l tr w-full"),u($,"class","w-1/2"),u(f,"class","my-1 flex"),u(W,"name","ou1"),u(W,"type","text"),u(W,"class","in-f tr w-1/3"),u(F,"name","ou2"),u(F,"type","text"),u(F,"class","in-m tr w-1/3"),u(j,"name","ou3"),u(j,"type","text"),u(j,"class","in-l tr w-1/3"),u(R,"class","flex"),u(N,"class","my-1"),u(e,"class","cnt")},m(H,V){y(H,e,V),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,a),s(e,r),s(e,c),s(e,f),s(f,m),s(m,_),s(m,h),s(m,b),s(m,d),Y(d,t[3].o.e),s(f,g),s(f,$),s($,k),s($,T),s($,P),s($,E),Y(E,t[3].o.c),s(e,S),s(e,N),s(N,D),s(N,R),s(R,W),Y(W,t[3].o.u1),s(R,O),s(R,F),Y(F,t[3].o.u2),s(R,L),s(R,j),Y(j,t[3].o.u3),U=!0,q||(G=[z(d,"input",t[59]),z(E,"input",t[60]),z(W,"input",t[61]),z(F,"input",t[62]),z(j,"input",t[63])],q=!0)},p(H,V){V[0]&8&&d.value!==H[3].o.e&&Y(d,H[3].o.e),V[0]&8&&E.value!==H[3].o.c&&Y(E,H[3].o.c),V[0]&8&&W.value!==H[3].o.u1&&Y(W,H[3].o.u1),V[0]&8&&F.value!==H[3].o.u2&&Y(F,H[3].o.u2),V[0]&8&&j.value!==H[3].o.u3&&Y(j,H[3].o.u3)},i(H){U||(M(o.$$.fragment,H),U=!0)},o(H){I(o.$$.fragment,H),U=!1},d(H){H&&w(e),Z(o),q=!1,Be(G)}}}function Ka(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Home-Assistant",n=v(),i=p("a"),J(o.$$.fragment),a=v(),r=p("input"),c=v(),f=p("div"),m=C("Discovery topic prefix"),_=p("br"),h=v(),b=p("input"),d=v(),g=p("div"),$=C("Hostname for URL"),k=p("br"),T=v(),P=p("input"),S=v(),N=p("div"),D=C("Name tag"),R=p("br"),W=v(),O=p("input"),u(l,"class","text-sm"),u(i,"href",Ct("MQTT-configuration#home-assistant")),u(i,"target","_blank"),u(i,"class","float-right"),u(r,"type","hidden"),u(r,"name","h"),r.value="true",u(b,"name","ht"),u(b,"type","text"),u(b,"class","in-s"),u(b,"placeholder","homeassistant"),u(f,"class","my-1"),u(P,"name","hh"),u(P,"type","text"),u(P,"class","in-s"),u(P,"placeholder",E=t[3].g.h+".local"),u(g,"class","my-1"),u(O,"name","hn"),u(O,"type","text"),u(O,"class","in-s"),u(N,"class","my-1"),u(e,"class","cnt")},m(U,q){y(U,e,q),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,a),s(e,r),s(e,c),s(e,f),s(f,m),s(f,_),s(f,h),s(f,b),Y(b,t[3].h.t),s(e,d),s(e,g),s(g,$),s(g,k),s(g,T),s(g,P),Y(P,t[3].h.h),s(e,S),s(e,N),s(N,D),s(N,R),s(N,W),s(N,O),Y(O,t[3].h.n),F=!0,L||(j=[z(b,"input",t[64]),z(P,"input",t[65]),z(O,"input",t[66])],L=!0)},p(U,q){q[0]&8&&b.value!==U[3].h.t&&Y(b,U[3].h.t),(!F||q[0]&8&&E!==(E=U[3].g.h+".local"))&&u(P,"placeholder",E),q[0]&8&&P.value!==U[3].h.h&&Y(P,U[3].h.h),q[0]&8&&O.value!==U[3].h.n&&Y(O,U[3].h.n)},i(U){F||(M(o.$$.fragment,U),F=!0)},o(U){I(o.$$.fragment,U),F=!1},d(U){U&&w(e),Z(o),L=!1,Be(j)}}}function Qa(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P;o=new $t({});let E={length:9},S=[];for(let N=0;N20&&xa(t),m=t[0].chip=="esp8266"&&lf(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Hardware",n=v(),i=p("a"),J(o.$$.fragment),a=v(),f&&f.c(),r=v(),m&&m.c(),u(l,"class","text-sm"),u(i,"href",Ct("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(_,h){y(_,e,h),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,a),f&&f.m(e,null),s(e,r),m&&m.m(e,null),c=!0},p(_,h){_[0].board>20?f?(f.p(_,h),h[0]&1&&M(f,1)):(f=xa(_),f.c(),M(f,1),f.m(e,r)):f&&(Pe(),I(f,1,1,()=>{f=null}),Me()),_[0].chip=="esp8266"?m?m.p(_,h):(m=lf(_),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},i(_){c||(M(o.$$.fragment,_),M(f),c=!0)},o(_){I(o.$$.fragment,_),I(f),c=!1},d(_){_&&w(e),Z(o),f&&f.d(),m&&m.d()}}}function xa(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U,q,G,H,V,X,ne,le,_e,Te,ve,qe,be,Ee,he,Ne,pe,me,se,re,K,ae,Ae,te,ue,He,Se,de,De,Oe;h=new kc({props:{chip:t[0].chip}});let ge=t[0].chip!="esp8266"&&ef(t),ke=t[3].i.v.p>0&&tf(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),o=C("HAN"),a=p("label"),r=p("input"),c=C(" pullup"),f=p("br"),m=v(),_=p("select"),J(h.$$.fragment),b=v(),d=p("div"),g=C("AP button"),$=p("br"),k=v(),T=p("input"),P=v(),E=p("div"),S=C("LED"),N=p("label"),D=p("input"),R=C(" inv"),W=p("br"),O=v(),F=p("div"),L=p("input"),j=v(),U=p("div"),q=C("RGB"),G=p("label"),H=p("input"),V=C(" inverted"),X=p("br"),ne=v(),le=p("div"),_e=p("input"),Te=v(),ve=p("input"),qe=v(),be=p("input"),Ee=v(),he=p("div"),Ne=C("Temperature"),pe=p("br"),me=v(),se=p("input"),re=v(),K=p("div"),ae=C("Analog temp"),Ae=p("br"),te=v(),ue=p("input"),He=v(),ge&&ge.c(),Se=v(),ke&&ke.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(r,"name","ihu"),r.__value="true",r.value=r.__value,u(r,"type","checkbox"),u(r,"class","rounded mb-1"),u(a,"class","ml-2"),u(_,"name","ihp"),u(_,"class","in-f w-full"),t[3].i.h.p===void 0&&Ye(()=>t[71].call(_)),u(i,"class","w-1/3"),u(T,"name","ia"),u(T,"type","number"),u(T,"min","0"),u(T,"max",t[6]),u(T,"class","in-m tr w-full"),u(d,"class","w-1/3"),u(D,"name","ili"),D.__value="true",D.value=D.__value,u(D,"type","checkbox"),u(D,"class","rounded mb-1"),u(N,"class","ml-4"),u(L,"name","ilp"),u(L,"type","number"),u(L,"min","0"),u(L,"max",t[6]),u(L,"class","in-l tr w-full"),u(F,"class","flex"),u(E,"class","w-1/3"),u(H,"name","iri"),H.__value="true",H.value=H.__value,u(H,"type","checkbox"),u(H,"class","rounded mb-1"),u(G,"class","ml-4"),u(_e,"name","irr"),u(_e,"type","number"),u(_e,"min","0"),u(_e,"max",t[6]),u(_e,"class","in-f tr w-1/3"),u(ve,"name","irg"),u(ve,"type","number"),u(ve,"min","0"),u(ve,"max",t[6]),u(ve,"class","in-m tr w-1/3"),u(be,"name","irb"),u(be,"type","number"),u(be,"min","0"),u(be,"max",t[6]),u(be,"class","in-l tr w-1/3"),u(le,"class","flex"),u(U,"class","w-full"),u(se,"name","itd"),u(se,"type","number"),u(se,"min","0"),u(se,"max",t[6]),u(se,"class","in-f tr w-full"),u(he,"class","my-1 w-1/3"),u(ue,"name","ita"),u(ue,"type","number"),u(ue,"min","0"),u(ue,"max",t[6]),u(ue,"class","in-l tr w-full"),u(K,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(x,oe){y(x,e,oe),y(x,l,oe),y(x,n,oe),s(n,i),s(i,o),s(i,a),s(a,r),r.checked=t[3].i.h.u,s(a,c),s(i,f),s(i,m),s(i,_),Q(h,_,null),Re(_,t[3].i.h.p),s(n,b),s(n,d),s(d,g),s(d,$),s(d,k),s(d,T),Y(T,t[3].i.a),s(n,P),s(n,E),s(E,S),s(E,N),s(N,D),D.checked=t[3].i.l.i,s(N,R),s(E,W),s(E,O),s(E,F),s(F,L),Y(L,t[3].i.l.p),s(n,j),s(n,U),s(U,q),s(U,G),s(G,H),H.checked=t[3].i.r.i,s(G,V),s(U,X),s(U,ne),s(U,le),s(le,_e),Y(_e,t[3].i.r.r),s(le,Te),s(le,ve),Y(ve,t[3].i.r.g),s(le,qe),s(le,be),Y(be,t[3].i.r.b),s(n,Ee),s(n,he),s(he,Ne),s(he,pe),s(he,me),s(he,se),Y(se,t[3].i.t.d),s(n,re),s(n,K),s(K,ae),s(K,Ae),s(K,te),s(K,ue),Y(ue,t[3].i.t.a),s(n,He),ge&&ge.m(n,null),s(n,Se),ke&&ke.m(n,null),de=!0,De||(Oe=[z(r,"change",t[70]),z(_,"change",t[71]),z(T,"input",t[72]),z(D,"change",t[73]),z(L,"input",t[74]),z(H,"change",t[75]),z(_e,"input",t[76]),z(ve,"input",t[77]),z(be,"input",t[78]),z(se,"input",t[79]),z(ue,"input",t[80])],De=!0)},p(x,oe){oe[0]&8&&(r.checked=x[3].i.h.u);const Tl={};oe[0]&1&&(Tl.chip=x[0].chip),h.$set(Tl),oe[0]&8&&Re(_,x[3].i.h.p),(!de||oe[0]&64)&&u(T,"max",x[6]),oe[0]&8&&fe(T.value)!==x[3].i.a&&Y(T,x[3].i.a),oe[0]&8&&(D.checked=x[3].i.l.i),(!de||oe[0]&64)&&u(L,"max",x[6]),oe[0]&8&&fe(L.value)!==x[3].i.l.p&&Y(L,x[3].i.l.p),oe[0]&8&&(H.checked=x[3].i.r.i),(!de||oe[0]&64)&&u(_e,"max",x[6]),oe[0]&8&&fe(_e.value)!==x[3].i.r.r&&Y(_e,x[3].i.r.r),(!de||oe[0]&64)&&u(ve,"max",x[6]),oe[0]&8&&fe(ve.value)!==x[3].i.r.g&&Y(ve,x[3].i.r.g),(!de||oe[0]&64)&&u(be,"max",x[6]),oe[0]&8&&fe(be.value)!==x[3].i.r.b&&Y(be,x[3].i.r.b),(!de||oe[0]&64)&&u(se,"max",x[6]),oe[0]&8&&fe(se.value)!==x[3].i.t.d&&Y(se,x[3].i.t.d),(!de||oe[0]&64)&&u(ue,"max",x[6]),oe[0]&8&&fe(ue.value)!==x[3].i.t.a&&Y(ue,x[3].i.t.a),x[0].chip!="esp8266"?ge?ge.p(x,oe):(ge=ef(x),ge.c(),ge.m(n,Se)):ge&&(ge.d(1),ge=null),x[3].i.v.p>0?ke?ke.p(x,oe):(ke=tf(x),ke.c(),ke.m(n,null)):ke&&(ke.d(1),ke=null)},i(x){de||(M(h.$$.fragment,x),de=!0)},o(x){I(h.$$.fragment,x),de=!1},d(x){x&&w(e),x&&w(l),x&&w(n),Z(h),ge&&ge.d(),ke&&ke.d(),De=!1,Be(Oe)}}}function ef(t){let e,l,n,i,o,a,r;return{c(){e=p("div"),l=C("Vcc"),n=p("br"),i=v(),o=p("input"),u(o,"name","ivp"),u(o,"type","number"),u(o,"min","0"),u(o,"max",t[6]),u(o,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Y(o,t[3].i.v.p),a||(r=z(o,"input",t[81]),a=!0)},p(c,f){f[0]&64&&u(o,"max",c[6]),f[0]&8&&fe(o.value)!==c[3].i.v.p&&Y(o,c[3].i.v.p)},d(c){c&&w(e),a=!1,r()}}}function tf(t){let e,l,n,i,o,a,r,c,f,m;return{c(){e=p("div"),l=C("Voltage divider"),n=p("br"),i=v(),o=p("div"),a=p("input"),r=v(),c=p("input"),u(a,"name","ivdv"),u(a,"type","number"),u(a,"min","0"),u(a,"max","65535"),u(a,"class","in-f tr w-full"),u(a,"placeholder","VCC"),u(c,"name","ivdg"),u(c,"type","number"),u(c,"min","0"),u(c,"max","65535"),u(c,"class","in-l tr w-full"),u(c,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(_,h){y(_,e,h),s(e,l),s(e,n),s(e,i),s(e,o),s(o,a),Y(a,t[3].i.v.d.v),s(o,r),s(o,c),Y(c,t[3].i.v.d.g),f||(m=[z(a,"input",t[82]),z(c,"input",t[83])],f=!0)},p(_,h){h[0]&8&&fe(a.value)!==_[3].i.v.d.v&&Y(a,_[3].i.v.d.v),h[0]&8&&fe(c.value)!==_[3].i.v.d.g&&Y(c,_[3].i.v.d.g)},d(_){_&&w(e),f=!1,Be(m)}}}function lf(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T=(t[0].board==2||t[0].board==100)&&nf(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),o=C("Vcc offset"),a=p("br"),r=v(),c=p("input"),f=v(),m=p("div"),_=C("Multiplier"),h=p("br"),b=v(),d=p("input"),g=v(),T&&T.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(c,"name","ivo"),u(c,"type","number"),u(c,"min","0.0"),u(c,"max","3.5"),u(c,"step","0.01"),u(c,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(d,"name","ivm"),u(d,"type","number"),u(d,"min","0.1"),u(d,"max","10"),u(d,"step","0.01"),u(d,"class","in-l tr w-full"),u(m,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(P,E){y(P,e,E),y(P,l,E),y(P,n,E),s(n,i),s(i,o),s(i,a),s(i,r),s(i,c),Y(c,t[3].i.v.o),s(n,f),s(n,m),s(m,_),s(m,h),s(m,b),s(m,d),Y(d,t[3].i.v.m),s(n,g),T&&T.m(n,null),$||(k=[z(c,"input",t[84]),z(d,"input",t[85])],$=!0)},p(P,E){E[0]&8&&fe(c.value)!==P[3].i.v.o&&Y(c,P[3].i.v.o),E[0]&8&&fe(d.value)!==P[3].i.v.m&&Y(d,P[3].i.v.m),P[0].board==2||P[0].board==100?T?T.p(P,E):(T=nf(P),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(P){P&&w(e),P&&w(l),P&&w(n),T&&T.d(),$=!1,Be(k)}}}function nf(t){let e,l,n,i,o,a,r;return{c(){e=p("div"),l=C("Boot limit"),n=p("br"),i=v(),o=p("input"),u(o,"name","ivb"),u(o,"type","number"),u(o,"min","2.5"),u(o,"max","3.5"),u(o,"step","0.1"),u(o,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(c,f){y(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Y(o,t[3].i.v.b),a||(r=z(o,"input",t[86]),a=!0)},p(c,f){f[0]&8&&fe(o.value)!==c[3].i.v.b&&Y(o,c[3].i.v.b)},d(c){c&&w(e),a=!1,r()}}}function sf(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k=t[3].d.t&&of();return{c(){e=p("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=v(),n=p("div"),i=p("label"),o=p("input"),a=C(" Enable telnet"),r=v(),k&&k.c(),c=v(),f=p("div"),m=p("select"),_=p("option"),_.textContent="Verbose",h=p("option"),h.textContent="Debug",b=p("option"),b.textContent="Info",d=p("option"),d.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,h.__value=2,h.value=h.__value,b.__value=3,b.value=b.__value,d.__value=4,d.value=d.__value,u(m,"name","dl"),u(m,"class","in-s"),t[3].d.l===void 0&&Ye(()=>t[89].call(m)),u(f,"class","my-1")},m(T,P){y(T,e,P),y(T,l,P),y(T,n,P),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,a),y(T,r,P),k&&k.m(T,P),y(T,c,P),y(T,f,P),s(f,m),s(m,_),s(m,h),s(m,b),s(m,d),Re(m,t[3].d.l),g||($=[z(o,"change",t[88]),z(m,"change",t[89])],g=!0)},p(T,P){P[0]&8&&(o.checked=T[3].d.t),T[3].d.t?k||(k=of(),k.c(),k.m(c.parentNode,c)):k&&(k.d(1),k=null),P[0]&8&&Re(m,T[3].d.l)},d(T){T&&w(e),T&&w(l),T&&w(n),T&&w(r),k&&k.d(T),T&&w(c),T&&w(f),g=!1,Be($)}}}function of(t){let e;return{c(){e=p("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Dm(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U,q,G,H,V,X,ne,le,_e,Te,ve,qe,be,Ee,he,Ne,pe,me,se,re,K,ae,Ae,te,ue,He,Se,de,De,Oe,ge,ke,x,oe,Tl,_i,di,St,vi,Kl,pl,Jt,hi,bi,gi,lt,ki,Xt,wi,yi,$i,nt,Ci,xt,Ql,dt,Ti,Si,Pi,el,Mi,Ai,Di,Fe,tl,Pt,Sl,Ni,ml,Le,Zl,ho,Jl,Xl,bo,Qn,go,xl,ws,ko,_l,Ht,dl,wo,Ii,yo,et,vl,$o,Ei,en,tn,ln,nn,Ri,Co,Zn,Mt,To,So,Pl,Po,Mo,Ao,jt,sn,on,Do,un,Ml,No,Io,Eo,rn,At,Ro,Fi,Fo,Al,Lo,qo,Oo,an,Dt,Uo,Li,Ho,ys,jo,Dl,qi,Nt,Wo,Go,Bo,$s,Oi,It,Yo,zo,Vo,xe,Ui,Ko,fn,cn,Qo,Jn,Zo,Nl,Jo,Xo,xo,ll,eu,Il,tu,lu,nu,nl,iu,pn,El,su,ou,uu,kt,mn,_n,dn,vn,ru,Rl,au,fu,cu,hn,wt,pu,Hi,mu,ji,Wi,Et,_u,du,Xe,Gi,vu,bn,gn,hu,Fl,bu,gu,ku,hl,Wt,kn,wn,wu,vt,Bi,Yi,yu,ht,yn,zi,Vi,$u,Cs,Ki,Qi,Rt,Cu,Tu,Xn,Su,bl,Pu,xn,Ft,Mu,Au,Du,Zi,il,Nu,Ge,Ji,Iu,$n,Cn,Eu,ei,Ru,Gt,Fu,Ts,Lu,qu,Tn,sl,Ou,Lt,Uu,Ss,Ll,Hu,ju,Wu,ol,Gu,ql,Bu,Yu,zu,ul,Vu,Sn,Pn,Ku,Qu,Zu,rl,Ju,Mn,Xu,xu,er,it,An,Dn,Nn,In,En,Rn,tr,Ol,lr,nr,ir,al,sr,Ps,Ms,As=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Ds,Bt,Xi,or,Fn,Ln,ur,ti,rr,li,ar,Ns,bt,xi,fr,qn,On,cr,ni,pr,es,ts,qt,mr,_r,dr,gl,Is,Un,vr,ls,Hn,hr,ns,Es,Ul,Rs,Hl,Fs,jl,Ls,Wl,Ot,qs,br;r=new $t({}),R=new dm({});let yc=["NOK","SEK","DKK","EUR"],is=[];for(let A=0;A<4;A+=1)is[A]=gm(bm(t,yc,A));let st=t[3].p.e&&t[0].chip!="esp8266"&&Ua(t),ot=t[3].g.s>0&&Ha(t);Xl=new $t({});let $c=[24,48,96,192,384,576,1152],ss=[];for(let A=0;A<7;A+=1)ss[A]=km(hm(t,$c,A));let ut=t[3].m.e.e&&ja(t),rt=t[3].m.e.e&&Wa(t),at=t[3].m.m.e&&Ga(t);cn=new $t({}),gn=new $t({}),yn=new wc({});let ft=t[3].n.m=="static"&&Ba(t);Cn=new $t({});let ct=t[0].chip!="esp8266"&&Ya(t),ze=t[3].q.s.e&&za(t),Ve=t[3].q.m==3&&Va(t),Ke=t[3].q.m==4&&Ka(t),Qe=As&&Qa(t);Ln=new $t({});let jn=t[7],pt=[];for(let A=0;A20||t[0].chip=="esp8266")&&Xa(t);On=new $t({});let mt=t[3].d.s&&sf(t);return Ul=new gt({props:{active:t[1],message:"Loading configuration"}}),Hl=new gt({props:{active:t[2],message:"Saving configuration"}}),jl=new gt({props:{active:t[4],message:"Performing factory reset"}}),Wl=new gt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=p("form"),l=p("div"),n=p("div"),i=p("strong"),i.textContent="General",o=v(),a=p("a"),J(r.$$.fragment),c=v(),f=p("input"),m=v(),_=p("div"),h=p("div"),b=p("div"),d=C("Hostname"),g=p("br"),$=v(),k=p("input"),T=v(),P=p("div"),E=C("Time zone"),S=p("br"),N=v(),D=p("select"),J(R.$$.fragment),W=v(),O=p("input"),F=v(),L=p("div"),j=p("div"),U=p("div"),q=C("Price region"),G=p("br"),H=v(),V=p("select"),X=p("optgroup"),ne=p("option"),ne.textContent="NO1",le=p("option"),le.textContent="NO2",_e=p("option"),_e.textContent="NO3",Te=p("option"),Te.textContent="NO4",ve=p("option"),ve.textContent="NO5",qe=p("optgroup"),be=p("option"),be.textContent="SE1",Ee=p("option"),Ee.textContent="SE2",he=p("option"),he.textContent="SE3",Ne=p("option"),Ne.textContent="SE4",pe=p("optgroup"),me=p("option"),me.textContent="DK1",se=p("option"),se.textContent="DK2",re=p("option"),re.textContent="Austria",K=p("option"),K.textContent="Belgium",ae=p("option"),ae.textContent="Czech Republic",Ae=p("option"),Ae.textContent="Estonia",te=p("option"),te.textContent="Finland",ue=p("option"),ue.textContent="France",He=p("option"),He.textContent="Germany",Se=p("option"),Se.textContent="Great Britain",de=p("option"),de.textContent="Latvia",De=p("option"),De.textContent="Lithuania",Oe=p("option"),Oe.textContent="Netherland",ge=p("option"),ge.textContent="Poland",ke=p("option"),ke.textContent="Switzerland",x=v(),oe=p("div"),Tl=C("Currency"),_i=p("br"),di=v(),St=p("select");for(let A=0;A<4;A+=1)is[A].c();vi=v(),Kl=p("div"),pl=p("div"),Jt=p("div"),hi=C("Fixed price"),bi=p("br"),gi=v(),lt=p("input"),ki=v(),Xt=p("div"),wi=C("Multiplier"),yi=p("br"),$i=v(),nt=p("input"),Ci=v(),xt=p("div"),Ql=p("label"),dt=p("input"),Ti=C(" Enable price fetch from remote server"),Si=v(),st&&st.c(),Pi=v(),el=p("div"),Mi=C("Security"),Ai=p("br"),Di=v(),Fe=p("select"),tl=p("option"),tl.textContent="None",Pt=p("option"),Pt.textContent="Only configuration",Sl=p("option"),Sl.textContent="Everything",Ni=v(),ot&&ot.c(),ml=v(),Le=p("div"),Zl=p("strong"),Zl.textContent="Meter",ho=v(),Jl=p("a"),J(Xl.$$.fragment),bo=v(),Qn=p("input"),go=v(),xl=p("div"),ws=p("span"),ws.textContent="Serial configuration",ko=v(),_l=p("div"),Ht=p("select"),dl=p("option"),wo=C("Autodetect");for(let A=0;A<7;A+=1)ss[A].c();yo=v(),et=p("select"),vl=p("option"),$o=C("-"),en=p("option"),en.textContent="7N1",tn=p("option"),tn.textContent="8N1",ln=p("option"),ln.textContent="7E1",nn=p("option"),nn.textContent="8E1",Co=v(),Zn=p("label"),Mt=p("input"),To=C(" inverted"),So=v(),Pl=p("div"),Po=C("Voltage"),Mo=p("br"),Ao=v(),jt=p("select"),sn=p("option"),sn.textContent="400V (TN)",on=p("option"),on.textContent="230V (IT/TT)",Do=v(),un=p("div"),Ml=p("div"),No=C("Main fuse"),Io=p("br"),Eo=v(),rn=p("label"),At=p("input"),Ro=v(),Fi=p("span"),Fi.textContent="A",Fo=v(),Al=p("div"),Lo=C("Production"),qo=p("br"),Oo=v(),an=p("label"),Dt=p("input"),Uo=v(),Li=p("span"),Li.textContent="kWp",Ho=v(),ys=p("div"),jo=v(),Dl=p("div"),qi=p("label"),Nt=p("input"),Wo=C(" Meter is encrypted"),Go=v(),ut&&ut.c(),Bo=v(),rt&&rt.c(),$s=v(),Oi=p("label"),It=p("input"),Yo=C(" Multipliers"),zo=v(),at&&at.c(),Vo=v(),xe=p("div"),Ui=p("strong"),Ui.textContent="WiFi",Ko=v(),fn=p("a"),J(cn.$$.fragment),Qo=v(),Jn=p("input"),Zo=v(),Nl=p("div"),Jo=C("SSID"),Xo=p("br"),xo=v(),ll=p("input"),eu=v(),Il=p("div"),tu=C("Password"),lu=p("br"),nu=v(),nl=p("input"),iu=v(),pn=p("div"),El=p("div"),su=C("Power saving"),ou=p("br"),uu=v(),kt=p("select"),mn=p("option"),mn.textContent="Default",_n=p("option"),_n.textContent="Off",dn=p("option"),dn.textContent="Minimum",vn=p("option"),vn.textContent="Maximum",ru=v(),Rl=p("div"),au=C("Power"),fu=p("br"),cu=v(),hn=p("div"),wt=p("input"),pu=v(),Hi=p("span"),Hi.textContent="dBm",mu=v(),ji=p("div"),Wi=p("label"),Et=p("input"),_u=C(" Auto reboot on connection problem"),du=v(),Xe=p("div"),Gi=p("strong"),Gi.textContent="Network",vu=v(),bn=p("a"),J(gn.$$.fragment),hu=v(),Fl=p("div"),bu=C("IP"),gu=p("br"),ku=v(),hl=p("div"),Wt=p("select"),kn=p("option"),kn.textContent="DHCP",wn=p("option"),wn.textContent="Static",wu=v(),vt=p("input"),yu=v(),ht=p("select"),J(yn.$$.fragment),$u=v(),ft&&ft.c(),Cs=v(),Ki=p("div"),Qi=p("label"),Rt=p("input"),Cu=C(" enable mDNS"),Tu=v(),Xn=p("input"),Su=v(),bl=p("div"),Pu=C("NTP "),xn=p("label"),Ft=p("input"),Mu=C(" obtain from DHCP"),Au=p("br"),Du=v(),Zi=p("div"),il=p("input"),Nu=v(),Ge=p("div"),Ji=p("strong"),Ji.textContent="MQTT",Iu=v(),$n=p("a"),J(Cn.$$.fragment),Eu=v(),ei=p("input"),Ru=v(),Gt=p("div"),Fu=C(`Server `),ct&&ct.c(),Ts=v(),Lu=p("br"),qu=v(),Tn=p("div"),sl=p("input"),Ou=v(),Lt=p("input"),Uu=v(),ze&&ze.c(),Ss=v(),Ll=p("div"),Hu=C("Username"),ju=p("br"),Wu=v(),ol=p("input"),Gu=v(),ql=p("div"),Bu=C("Password"),Yu=p("br"),zu=v(),ul=p("input"),Vu=v(),Sn=p("div"),Pn=p("div"),Ku=C("Client ID"),Qu=p("br"),Zu=v(),rl=p("input"),Ju=v(),Mn=p("div"),Xu=C("Payload"),xu=p("br"),er=v(),it=p("select"),An=p("option"),An.textContent="JSON",Dn=p("option"),Dn.textContent="Raw (minimal)",Nn=p("option"),Nn.textContent="Raw (full)",In=p("option"),In.textContent="Domoticz",En=p("option"),En.textContent="HomeAssistant",Rn=p("option"),Rn.textContent="HEX dump",tr=v(),Ol=p("div"),lr=C("Publish topic"),nr=p("br"),ir=v(),al=p("input"),sr=v(),Ve&&Ve.c(),Ps=v(),Ke&&Ke.c(),Ms=v(),Qe&&Qe.c(),Ds=v(),Bt=p("div"),Xi=p("strong"),Xi.textContent="User interface",or=v(),Fn=p("a"),J(Ln.$$.fragment),ur=v(),ti=p("input"),rr=v(),li=p("div");for(let A=0;ASave',Es=v(),J(Ul.$$.fragment),Rs=v(),J(Hl.$$.fragment),Fs=v(),J(jl.$$.fragment),Ls=v(),J(Wl.$$.fragment),u(i,"class","text-sm"),u(a,"href",Ct("General-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","g"),f.value="true",u(k,"name","gh"),u(k,"type","text"),u(k,"class","in-f w-full"),u(k,"pattern","[A-Za-z0-9-]+"),u(D,"name","gt"),u(D,"class","in-l w-full"),t[3].g.t===void 0&&Ye(()=>t[13].call(D)),u(h,"class","flex"),u(_,"class","my-1"),u(O,"type","hidden"),u(O,"name","p"),O.value="true",ne.__value="10YNO-1--------2",ne.value=ne.__value,le.__value="10YNO-2--------T",le.value=le.__value,_e.__value="10YNO-3--------J",_e.value=_e.__value,Te.__value="10YNO-4--------9",Te.value=Te.__value,ve.__value="10Y1001A1001A48H",ve.value=ve.__value,u(X,"label","Norway"),be.__value="10Y1001A1001A44P",be.value=be.__value,Ee.__value="10Y1001A1001A45N",Ee.value=Ee.__value,he.__value="10Y1001A1001A46L",he.value=he.__value,Ne.__value="10Y1001A1001A47J",Ne.value=Ne.__value,u(qe,"label","Sweden"),me.__value="10YDK-1--------W",me.value=me.__value,se.__value="10YDK-2--------M",se.value=se.__value,u(pe,"label","Denmark"),re.__value="10YAT-APG------L",re.value=re.__value,K.__value="10YBE----------2",K.value=K.__value,ae.__value="10YCZ-CEPS-----N",ae.value=ae.__value,Ae.__value="10Y1001A1001A39I",Ae.value=Ae.__value,te.__value="10YFI-1--------U",te.value=te.__value,ue.__value="10YFR-RTE------C",ue.value=ue.__value,He.__value="10Y1001A1001A83F",He.value=He.__value,Se.__value="10YGB----------A",Se.value=Se.__value,de.__value="10YLV-1001A00074",de.value=de.__value,De.__value="10YLT-1001A0008Q",De.value=De.__value,Oe.__value="10YNL----------L",Oe.value=Oe.__value,ge.__value="10YPL-AREA-----S",ge.value=ge.__value,ke.__value="10YCH-SWISSGRIDZ",ke.value=ke.__value,u(V,"name","pr"),u(V,"class","in-f w-full"),t[3].p.r===void 0&&Ye(()=>t[14].call(V)),u(U,"class","w-full"),u(St,"name","pc"),u(St,"class","in-l"),t[3].p.c===void 0&&Ye(()=>t[15].call(St)),u(j,"class","flex"),u(L,"class","my-1"),u(lt,"name","pf"),u(lt,"type","number"),u(lt,"min","0.001"),u(lt,"max","65"),u(lt,"step","0.001"),u(lt,"class","in-f tr w-full"),u(Jt,"class","w-1/2"),u(nt,"name","pm"),u(nt,"type","number"),u(nt,"min","0.001"),u(nt,"max","1000"),u(nt,"step","0.001"),u(nt,"class","in-l tr w-full"),u(Xt,"class","w-1/2"),u(pl,"class","flex"),u(Kl,"class","my-1"),u(dt,"type","checkbox"),u(dt,"name","pe"),dt.__value="true",dt.value=dt.__value,u(dt,"class","rounded mb-1"),u(xt,"class","my-1"),tl.__value=0,tl.value=tl.__value,Pt.__value=1,Pt.value=Pt.__value,Sl.__value=2,Sl.value=Sl.__value,u(Fe,"name","gs"),u(Fe,"class","in-s"),t[3].g.s===void 0&&Ye(()=>t[20].call(Fe)),u(el,"class","my-1"),u(n,"class","cnt"),u(Zl,"class","text-sm"),u(Jl,"href",Ct("Meter-configuration")),u(Jl,"target","_blank"),u(Jl,"class","float-right"),u(Qn,"type","hidden"),u(Qn,"name","m"),Qn.value="true",dl.__value=0,dl.value=dl.__value,dl.disabled=Ii=t[3].m.b!=0,u(Ht,"name","mb"),u(Ht,"class","in-f"),t[3].m.b===void 0&&Ye(()=>t[23].call(Ht)),vl.__value=0,vl.value=vl.__value,vl.disabled=Ei=t[3].m.b!=0,en.__value=2,en.value=en.__value,tn.__value=3,tn.value=tn.__value,ln.__value=10,ln.value=ln.__value,nn.__value=11,nn.value=nn.__value,u(et,"name","mp"),u(et,"class","in-l"),et.disabled=Ri=t[3].m.b==0,t[3].m.p===void 0&&Ye(()=>t[24].call(et)),u(Mt,"name","mi"),Mt.__value="true",Mt.value=Mt.__value,u(Mt,"type","checkbox"),u(Mt,"class","rounded mb-1"),u(Zn,"class","mt-2 ml-3 whitespace-nowrap"),u(_l,"class","flex"),u(xl,"class","my-1"),sn.__value=2,sn.value=sn.__value,on.__value=1,on.value=on.__value,u(jt,"name","md"),u(jt,"class","in-s"),t[3].m.d===void 0&&Ye(()=>t[26].call(jt)),u(Pl,"class","my-1"),u(At,"name","mf"),u(At,"type","number"),u(At,"min","5"),u(At,"max","65535"),u(At,"class","in-f tr w-full"),u(Fi,"class","in-post"),u(rn,"class","flex"),u(Ml,"class","mx-1"),u(Dt,"name","mr"),u(Dt,"type","number"),u(Dt,"min","0"),u(Dt,"max","65535"),u(Dt,"class","in-f tr w-full"),u(Li,"class","in-post"),u(an,"class","flex"),u(Al,"class","mx-1"),u(un,"class","my-1 flex"),u(ys,"class","my-1"),u(Nt,"type","checkbox"),u(Nt,"name","me"),Nt.__value="true",Nt.value=Nt.__value,u(Nt,"class","rounded mb-1"),u(Dl,"class","my-1"),u(It,"type","checkbox"),u(It,"name","mm"),It.__value="true",It.value=It.__value,u(It,"class","rounded mb-1"),u(Le,"class","cnt"),u(Ui,"class","text-sm"),u(fn,"href",Ct("WiFi-configuration")),u(fn,"target","_blank"),u(fn,"class","float-right"),u(Jn,"type","hidden"),u(Jn,"name","w"),Jn.value="true",u(ll,"name","ws"),u(ll,"type","text"),u(ll,"class","in-s"),u(Nl,"class","my-1"),u(nl,"name","wp"),u(nl,"type","password"),u(nl,"class","in-s"),u(Il,"class","my-1"),mn.__value=255,mn.value=mn.__value,_n.__value=0,_n.value=_n.__value,dn.__value=1,dn.value=dn.__value,vn.__value=2,vn.value=vn.__value,u(kt,"name","wz"),u(kt,"class","in-s"),t[3].w.z===void 0&&Ye(()=>t[39].call(kt)),u(El,"class","w-1/2"),u(wt,"name","ww"),u(wt,"type","number"),u(wt,"min","0"),u(wt,"max","20.5"),u(wt,"step","0.5"),u(wt,"class","in-f tr w-full"),u(Hi,"class","in-post"),u(hn,"class","flex"),u(Rl,"class","ml-2 w-1/2"),u(pn,"class","my-1 flex"),u(Et,"type","checkbox"),u(Et,"name","wa"),Et.__value="true",Et.value=Et.__value,u(Et,"class","rounded mb-1"),u(ji,"class","my-3"),u(xe,"class","cnt"),u(Gi,"class","text-sm"),u(bn,"href",Ct("Network-configuration")),u(bn,"target","_blank"),u(bn,"class","float-right"),kn.__value="dhcp",kn.value=kn.__value,wn.__value="static",wn.value=wn.__value,u(Wt,"name","nm"),u(Wt,"class","in-f"),t[3].n.m===void 0&&Ye(()=>t[42].call(Wt)),u(vt,"name","ni"),u(vt,"type","text"),u(vt,"class","in-m w-full"),vt.disabled=Bi=t[3].n.m=="dhcp",vt.required=Yi=t[3].n.m=="static",u(ht,"name","ns"),u(ht,"class","in-l"),ht.disabled=zi=t[3].n.m=="dhcp",ht.required=Vi=t[3].n.m=="static",t[3].n.s===void 0&&Ye(()=>t[44].call(ht)),u(hl,"class","flex"),u(Fl,"class","my-1"),u(Rt,"name","nd"),Rt.__value="true",Rt.value=Rt.__value,u(Rt,"type","checkbox"),u(Rt,"class","rounded mb-1"),u(Ki,"class","my-1"),u(Xn,"type","hidden"),u(Xn,"name","ntp"),Xn.value="true",u(Ft,"name","ntpd"),Ft.__value="true",Ft.value=Ft.__value,u(Ft,"type","checkbox"),u(Ft,"class","rounded mb-1"),u(xn,"class","ml-4"),u(il,"name","ntph"),u(il,"type","text"),u(il,"class","in-s"),u(Zi,"class","flex"),u(bl,"class","my-1"),u(Xe,"class","cnt"),u(Ji,"class","text-sm"),u($n,"href",Ct("MQTT-configuration")),u($n,"target","_blank"),u($n,"class","float-right"),u(ei,"type","hidden"),u(ei,"name","q"),ei.value="true",u(sl,"name","qh"),u(sl,"type","text"),u(sl,"class","in-f w-3/4"),u(Lt,"name","qp"),u(Lt,"type","number"),u(Lt,"min","1024"),u(Lt,"max","65535"),u(Lt,"class","in-l tr w-1/4"),u(Tn,"class","flex"),u(Gt,"class","my-1"),u(ol,"name","qu"),u(ol,"type","text"),u(ol,"class","in-s"),u(Ll,"class","my-1"),u(ul,"name","qa"),u(ul,"type","password"),u(ul,"class","in-s"),u(ql,"class","my-1"),u(rl,"name","qc"),u(rl,"type","text"),u(rl,"class","in-f w-full"),An.__value=0,An.value=An.__value,Dn.__value=1,Dn.value=Dn.__value,Nn.__value=2,Nn.value=Nn.__value,In.__value=3,In.value=In.__value,En.__value=4,En.value=En.__value,Rn.__value=255,Rn.value=Rn.__value,u(it,"name","qm"),u(it,"class","in-l"),t[3].q.m===void 0&&Ye(()=>t[57].call(it)),u(Sn,"class","my-1 flex"),u(al,"name","qb"),u(al,"type","text"),u(al,"class","in-s"),u(Ol,"class","my-1"),u(Ge,"class","cnt"),u(Xi,"class","text-sm"),u(Fn,"href",Ct("User-interface")),u(Fn,"target","_blank"),u(Fn,"class","float-right"),u(ti,"type","hidden"),u(ti,"name","u"),ti.value="true",u(li,"class","flex flex-wrap"),u(Bt,"class","cnt"),u(xi,"class","text-sm"),u(qn,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(qn,"target","_blank"),u(qn,"class","float-right"),u(ni,"type","hidden"),u(ni,"name","d"),ni.value="true",u(qt,"type","checkbox"),u(qt,"name","ds"),qt.__value="true",qt.value=qt.__value,u(qt,"class","rounded mb-1"),u(es,"class","mt-3"),u(bt,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(Un,"type","button"),u(Un,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),u(Hn,"type","button"),u(Hn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(ls,"class","text-center"),u(ns,"class","text-right"),u(gl,"class","grid grid-cols-3"),u(e,"autocomplete","off")},m(A,ee){y(A,e,ee),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),Q(r,a,null),s(n,c),s(n,f),s(n,m),s(n,_),s(_,h),s(h,b),s(b,d),s(b,g),s(b,$),s(b,k),Y(k,t[3].g.h),s(h,T),s(h,P),s(P,E),s(P,S),s(P,N),s(P,D),Q(R,D,null),Re(D,t[3].g.t),s(n,W),s(n,O),s(n,F),s(n,L),s(L,j),s(j,U),s(U,q),s(U,G),s(U,H),s(U,V),s(V,X),s(X,ne),s(X,le),s(X,_e),s(X,Te),s(X,ve),s(V,qe),s(qe,be),s(qe,Ee),s(qe,he),s(qe,Ne),s(V,pe),s(pe,me),s(pe,se),s(V,re),s(V,K),s(V,ae),s(V,Ae),s(V,te),s(V,ue),s(V,He),s(V,Se),s(V,de),s(V,De),s(V,Oe),s(V,ge),s(V,ke),Re(V,t[3].p.r),s(j,x),s(j,oe),s(oe,Tl),s(oe,_i),s(oe,di),s(oe,St);for(let _t=0;_t<4;_t+=1)is[_t].m(St,null);Re(St,t[3].p.c),s(n,vi),s(n,Kl),s(Kl,pl),s(pl,Jt),s(Jt,hi),s(Jt,bi),s(Jt,gi),s(Jt,lt),Y(lt,t[3].p.f),s(pl,ki),s(pl,Xt),s(Xt,wi),s(Xt,yi),s(Xt,$i),s(Xt,nt),Y(nt,t[3].p.m),s(n,Ci),s(n,xt),s(xt,Ql),s(Ql,dt),dt.checked=t[3].p.e,s(Ql,Ti),s(xt,Si),st&&st.m(xt,null),s(n,Pi),s(n,el),s(el,Mi),s(el,Ai),s(el,Di),s(el,Fe),s(Fe,tl),s(Fe,Pt),s(Fe,Sl),Re(Fe,t[3].g.s),s(n,Ni),ot&&ot.m(n,null),s(l,ml),s(l,Le),s(Le,Zl),s(Le,ho),s(Le,Jl),Q(Xl,Jl,null),s(Le,bo),s(Le,Qn),s(Le,go),s(Le,xl),s(xl,ws),s(xl,ko),s(xl,_l),s(_l,Ht),s(Ht,dl),s(dl,wo);for(let _t=0;_t<7;_t+=1)ss[_t].m(Ht,null);Re(Ht,t[3].m.b),s(_l,yo),s(_l,et),s(et,vl),s(vl,$o),s(et,en),s(et,tn),s(et,ln),s(et,nn),Re(et,t[3].m.p),s(_l,Co),s(_l,Zn),s(Zn,Mt),Mt.checked=t[3].m.i,s(Zn,To),s(Le,So),s(Le,Pl),s(Pl,Po),s(Pl,Mo),s(Pl,Ao),s(Pl,jt),s(jt,sn),s(jt,on),Re(jt,t[3].m.d),s(Le,Do),s(Le,un),s(un,Ml),s(Ml,No),s(Ml,Io),s(Ml,Eo),s(Ml,rn),s(rn,At),Y(At,t[3].m.f),s(rn,Ro),s(rn,Fi),s(un,Fo),s(un,Al),s(Al,Lo),s(Al,qo),s(Al,Oo),s(Al,an),s(an,Dt),Y(Dt,t[3].m.r),s(an,Uo),s(an,Li),s(Le,Ho),s(Le,ys),s(Le,jo),s(Le,Dl),s(Dl,qi),s(qi,Nt),Nt.checked=t[3].m.e.e,s(qi,Wo),s(Dl,Go),ut&&ut.m(Dl,null),s(Le,Bo),rt&&rt.m(Le,null),s(Le,$s),s(Le,Oi),s(Oi,It),It.checked=t[3].m.m.e,s(Oi,Yo),s(Le,zo),at&&at.m(Le,null),s(l,Vo),s(l,xe),s(xe,Ui),s(xe,Ko),s(xe,fn),Q(cn,fn,null),s(xe,Qo),s(xe,Jn),s(xe,Zo),s(xe,Nl),s(Nl,Jo),s(Nl,Xo),s(Nl,xo),s(Nl,ll),Y(ll,t[3].w.s),s(xe,eu),s(xe,Il),s(Il,tu),s(Il,lu),s(Il,nu),s(Il,nl),Y(nl,t[3].w.p),s(xe,iu),s(xe,pn),s(pn,El),s(El,su),s(El,ou),s(El,uu),s(El,kt),s(kt,mn),s(kt,_n),s(kt,dn),s(kt,vn),Re(kt,t[3].w.z),s(pn,ru),s(pn,Rl),s(Rl,au),s(Rl,fu),s(Rl,cu),s(Rl,hn),s(hn,wt),Y(wt,t[3].w.w),s(hn,pu),s(hn,Hi),s(xe,mu),s(xe,ji),s(ji,Wi),s(Wi,Et),Et.checked=t[3].w.a,s(Wi,_u),s(l,du),s(l,Xe),s(Xe,Gi),s(Xe,vu),s(Xe,bn),Q(gn,bn,null),s(Xe,hu),s(Xe,Fl),s(Fl,bu),s(Fl,gu),s(Fl,ku),s(Fl,hl),s(hl,Wt),s(Wt,kn),s(Wt,wn),Re(Wt,t[3].n.m),s(hl,wu),s(hl,vt),Y(vt,t[3].n.i),s(hl,yu),s(hl,ht),Q(yn,ht,null),Re(ht,t[3].n.s),s(Xe,$u),ft&&ft.m(Xe,null),s(Xe,Cs),s(Xe,Ki),s(Ki,Qi),s(Qi,Rt),Rt.checked=t[3].n.d,s(Qi,Cu),s(Xe,Tu),s(Xe,Xn),s(Xe,Su),s(Xe,bl),s(bl,Pu),s(bl,xn),s(xn,Ft),Ft.checked=t[3].n.h,s(xn,Mu),s(bl,Au),s(bl,Du),s(bl,Zi),s(Zi,il),Y(il,t[3].n.n1),s(l,Nu),s(l,Ge),s(Ge,Ji),s(Ge,Iu),s(Ge,$n),Q(Cn,$n,null),s(Ge,Eu),s(Ge,ei),s(Ge,Ru),s(Ge,Gt),s(Gt,Fu),ct&&ct.m(Gt,null),s(Gt,Ts),s(Gt,Lu),s(Gt,qu),s(Gt,Tn),s(Tn,sl),Y(sl,t[3].q.h),s(Tn,Ou),s(Tn,Lt),Y(Lt,t[3].q.p),s(Ge,Uu),ze&&ze.m(Ge,null),s(Ge,Ss),s(Ge,Ll),s(Ll,Hu),s(Ll,ju),s(Ll,Wu),s(Ll,ol),Y(ol,t[3].q.u),s(Ge,Gu),s(Ge,ql),s(ql,Bu),s(ql,Yu),s(ql,zu),s(ql,ul),Y(ul,t[3].q.a),s(Ge,Vu),s(Ge,Sn),s(Sn,Pn),s(Pn,Ku),s(Pn,Qu),s(Pn,Zu),s(Pn,rl),Y(rl,t[3].q.c),s(Sn,Ju),s(Sn,Mn),s(Mn,Xu),s(Mn,xu),s(Mn,er),s(Mn,it),s(it,An),s(it,Dn),s(it,Nn),s(it,In),s(it,En),s(it,Rn),Re(it,t[3].q.m),s(Ge,tr),s(Ge,Ol),s(Ol,lr),s(Ol,nr),s(Ol,ir),s(Ol,al),Y(al,t[3].q.b),s(l,sr),Ve&&Ve.m(l,null),s(l,Ps),Ke&&Ke.m(l,null),s(l,Ms),Qe&&Qe.m(l,null),s(l,Ds),s(l,Bt),s(Bt,Xi),s(Bt,or),s(Bt,Fn),Q(Ln,Fn,null),s(Bt,ur),s(Bt,ti),s(Bt,rr),s(Bt,li);for(let _t=0;_t0?ot?ot.p(A,ee):(ot=Ha(A),ot.c(),ot.m(n,null)):ot&&(ot.d(1),ot=null),(!Ot||ee[0]&8&&Ii!==(Ii=A[3].m.b!=0))&&(dl.disabled=Ii),ee[0]&8&&Re(Ht,A[3].m.b),(!Ot||ee[0]&8&&Ei!==(Ei=A[3].m.b!=0))&&(vl.disabled=Ei),(!Ot||ee[0]&8&&Ri!==(Ri=A[3].m.b==0))&&(et.disabled=Ri),ee[0]&8&&Re(et,A[3].m.p),ee[0]&8&&(Mt.checked=A[3].m.i),ee[0]&8&&Re(jt,A[3].m.d),ee[0]&8&&fe(At.value)!==A[3].m.f&&Y(At,A[3].m.f),ee[0]&8&&fe(Dt.value)!==A[3].m.r&&Y(Dt,A[3].m.r),ee[0]&8&&(Nt.checked=A[3].m.e.e),A[3].m.e.e?ut?ut.p(A,ee):(ut=ja(A),ut.c(),ut.m(Dl,null)):ut&&(ut.d(1),ut=null),A[3].m.e.e?rt?rt.p(A,ee):(rt=Wa(A),rt.c(),rt.m(Le,$s)):rt&&(rt.d(1),rt=null),ee[0]&8&&(It.checked=A[3].m.m.e),A[3].m.m.e?at?at.p(A,ee):(at=Ga(A),at.c(),at.m(Le,null)):at&&(at.d(1),at=null),ee[0]&8&&ll.value!==A[3].w.s&&Y(ll,A[3].w.s),ee[0]&8&&nl.value!==A[3].w.p&&Y(nl,A[3].w.p),ee[0]&8&&Re(kt,A[3].w.z),ee[0]&8&&fe(wt.value)!==A[3].w.w&&Y(wt,A[3].w.w),ee[0]&8&&(Et.checked=A[3].w.a),ee[0]&8&&Re(Wt,A[3].n.m),(!Ot||ee[0]&8&&Bi!==(Bi=A[3].n.m=="dhcp"))&&(vt.disabled=Bi),(!Ot||ee[0]&8&&Yi!==(Yi=A[3].n.m=="static"))&&(vt.required=Yi),ee[0]&8&&vt.value!==A[3].n.i&&Y(vt,A[3].n.i),(!Ot||ee[0]&8&&zi!==(zi=A[3].n.m=="dhcp"))&&(ht.disabled=zi),(!Ot||ee[0]&8&&Vi!==(Vi=A[3].n.m=="static"))&&(ht.required=Vi),ee[0]&8&&Re(ht,A[3].n.s),A[3].n.m=="static"?ft?ft.p(A,ee):(ft=Ba(A),ft.c(),ft.m(Xe,Cs)):ft&&(ft.d(1),ft=null),ee[0]&8&&(Rt.checked=A[3].n.d),ee[0]&8&&(Ft.checked=A[3].n.h),ee[0]&8&&il.value!==A[3].n.n1&&Y(il,A[3].n.n1),A[0].chip!="esp8266"?ct?ct.p(A,ee):(ct=Ya(A),ct.c(),ct.m(Gt,Ts)):ct&&(ct.d(1),ct=null),ee[0]&8&&sl.value!==A[3].q.h&&Y(sl,A[3].q.h),ee[0]&8&&fe(Lt.value)!==A[3].q.p&&Y(Lt,A[3].q.p),A[3].q.s.e?ze?(ze.p(A,ee),ee[0]&8&&M(ze,1)):(ze=za(A),ze.c(),M(ze,1),ze.m(Ge,Ss)):ze&&(Pe(),I(ze,1,1,()=>{ze=null}),Me()),ee[0]&8&&ol.value!==A[3].q.u&&Y(ol,A[3].q.u),ee[0]&8&&ul.value!==A[3].q.a&&Y(ul,A[3].q.a),ee[0]&8&&rl.value!==A[3].q.c&&Y(rl,A[3].q.c),ee[0]&8&&Re(it,A[3].q.m),ee[0]&8&&al.value!==A[3].q.b&&Y(al,A[3].q.b),A[3].q.m==3?Ve?(Ve.p(A,ee),ee[0]&8&&M(Ve,1)):(Ve=Va(A),Ve.c(),M(Ve,1),Ve.m(l,Ps)):Ve&&(Pe(),I(Ve,1,1,()=>{Ve=null}),Me()),A[3].q.m==4?Ke?(Ke.p(A,ee),ee[0]&8&&M(Ke,1)):(Ke=Ka(A),Ke.c(),M(Ke,1),Ke.m(l,Ms)):Ke&&(Pe(),I(Ke,1,1,()=>{Ke=null}),Me()),ee[0]&8&&(As=A[3].p.r.startsWith("10YNO")||A[3].p.r=="10Y1001A1001A48H"),As?Qe?(Qe.p(A,ee),ee[0]&8&&M(Qe,1)):(Qe=Qa(A),Qe.c(),M(Qe,1),Qe.m(l,Ds)):Qe&&(Pe(),I(Qe,1,1,()=>{Qe=null}),Me()),ee[0]&136){jn=A[7];let yt;for(yt=0;yt20||A[0].chip=="esp8266"?Ze?(Ze.p(A,ee),ee[0]&1&&M(Ze,1)):(Ze=Xa(A),Ze.c(),M(Ze,1),Ze.m(l,Ns)):Ze&&(Pe(),I(Ze,1,1,()=>{Ze=null}),Me()),ee[0]&8&&(qt.checked=A[3].d.s),A[3].d.s?mt?mt.p(A,ee):(mt=sf(A),mt.c(),mt.m(bt,null)):mt&&(mt.d(1),mt=null);const _t={};ee[0]&2&&(_t.active=A[1]),Ul.$set(_t);const gr={};ee[0]&4&&(gr.active=A[2]),Hl.$set(gr);const kr={};ee[0]&16&&(kr.active=A[4]),jl.$set(kr);const wr={};ee[0]&32&&(wr.active=A[5]),Wl.$set(wr)},i(A){Ot||(M(r.$$.fragment,A),M(R.$$.fragment,A),M(Xl.$$.fragment,A),M(cn.$$.fragment,A),M(gn.$$.fragment,A),M(yn.$$.fragment,A),M(Cn.$$.fragment,A),M(ze),M(Ve),M(Ke),M(Qe),M(Ln.$$.fragment,A),M(Ze),M(On.$$.fragment,A),M(Ul.$$.fragment,A),M(Hl.$$.fragment,A),M(jl.$$.fragment,A),M(Wl.$$.fragment,A),Ot=!0)},o(A){I(r.$$.fragment,A),I(R.$$.fragment,A),I(Xl.$$.fragment,A),I(cn.$$.fragment,A),I(gn.$$.fragment,A),I(yn.$$.fragment,A),I(Cn.$$.fragment,A),I(ze),I(Ve),I(Ke),I(Qe),I(Ln.$$.fragment,A),I(Ze),I(On.$$.fragment,A),I(Ul.$$.fragment,A),I(Hl.$$.fragment,A),I(jl.$$.fragment,A),I(Wl.$$.fragment,A),Ot=!1},d(A){A&&w(e),Z(r),Z(R),Qt(is,A),st&&st.d(),ot&&ot.d(),Z(Xl),Qt(ss,A),ut&&ut.d(),rt&&rt.d(),at&&at.d(),Z(cn),Z(gn),Z(yn),ft&&ft.d(),Z(Cn),ct&&ct.d(),ze&&ze.d(),Ve&&Ve.d(),Ke&&Ke.d(),Qe&&Qe.d(),Z(Ln),Qt(pt,A),Ze&&Ze.d(),Z(On),mt&&mt.d(),A&&w(Es),Z(Ul,A),A&&w(Rs),Z(Hl,A),A&&w(Fs),Z(jl,A),A&&w(Ls),Z(Wl,A),qs=!1,Be(br)}}}async function Nm(){await(await fetch("/reboot",{method:"POST"})).json()}function Im(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,a=!1,r={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,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:""}};gc.subscribe(Fe=>{Fe.version&&(l(3,r=Fe),l(1,o=!1))}),om();let c=!1,f=!1;async function m(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Fe=new URLSearchParams;Fe.append("perform","true");let Pt=await(await fetch("/reset",{method:"POST",body:Fe})).json();l(4,c=!1),l(5,f=Pt.success)}}async function _(Fe){l(2,a=!0);const tl=new FormData(Fe.target),Pt=new URLSearchParams;for(let ml of tl){const[Le,Zl]=ml;Pt.append(Le,Zl)}let Ni=await(await fetch("/save",{method:"POST",body:Pt})).json();Tt.update(ml=>(ml.booting=Ni.reboot,ml.ui=r.u,ml)),l(2,a=!1),Bn("/")}const h=function(){confirm("Are you sure you want to reboot the device?")&&(Tt.update(Fe=>(Fe.booting=!0,Fe)),Nm())},b=function(){r.q.s.e?r.q.p==1883&&l(3,r.q.p=8883,r):r.q.p==8883&&l(3,r.q.p=1883,r)};let d=44;function g(){r.g.h=this.value,l(3,r)}function $(){r.g.t=tt(this),l(3,r)}function k(){r.p.r=tt(this),l(3,r)}function T(){r.p.c=tt(this),l(3,r)}function P(){r.p.f=fe(this.value),l(3,r)}function E(){r.p.m=fe(this.value),l(3,r)}function S(){r.p.e=this.checked,l(3,r)}function N(){r.p.t=this.value,l(3,r)}function D(){r.g.s=tt(this),l(3,r)}function R(){r.g.u=this.value,l(3,r)}function W(){r.g.p=this.value,l(3,r)}function O(){r.m.b=tt(this),l(3,r)}function F(){r.m.p=tt(this),l(3,r)}function L(){r.m.i=this.checked,l(3,r)}function j(){r.m.d=tt(this),l(3,r)}function U(){r.m.f=fe(this.value),l(3,r)}function q(){r.m.r=fe(this.value),l(3,r)}function G(){r.m.e.e=this.checked,l(3,r)}function H(){r.m.e.k=this.value,l(3,r)}function V(){r.m.e.a=this.value,l(3,r)}function X(){r.m.m.e=this.checked,l(3,r)}function ne(){r.m.m.w=fe(this.value),l(3,r)}function le(){r.m.m.v=fe(this.value),l(3,r)}function _e(){r.m.m.a=fe(this.value),l(3,r)}function Te(){r.m.m.c=fe(this.value),l(3,r)}function ve(){r.w.s=this.value,l(3,r)}function qe(){r.w.p=this.value,l(3,r)}function be(){r.w.z=tt(this),l(3,r)}function Ee(){r.w.w=fe(this.value),l(3,r)}function he(){r.w.a=this.checked,l(3,r)}function Ne(){r.n.m=tt(this),l(3,r)}function pe(){r.n.i=this.value,l(3,r)}function me(){r.n.s=tt(this),l(3,r)}function se(){r.n.g=this.value,l(3,r)}function re(){r.n.d1=this.value,l(3,r)}function K(){r.n.d2=this.value,l(3,r)}function ae(){r.n.d=this.checked,l(3,r)}function Ae(){r.n.h=this.checked,l(3,r)}function te(){r.n.n1=this.value,l(3,r)}function ue(){r.q.s.e=this.checked,l(3,r)}function He(){r.q.h=this.value,l(3,r)}function Se(){r.q.p=fe(this.value),l(3,r)}function de(){r.q.u=this.value,l(3,r)}function De(){r.q.a=this.value,l(3,r)}function Oe(){r.q.c=this.value,l(3,r)}function ge(){r.q.m=tt(this),l(3,r)}function ke(){r.q.b=this.value,l(3,r)}function x(){r.o.e=this.value,l(3,r)}function oe(){r.o.c=this.value,l(3,r)}function Tl(){r.o.u1=this.value,l(3,r)}function _i(){r.o.u2=this.value,l(3,r)}function di(){r.o.u3=this.value,l(3,r)}function St(){r.h.t=this.value,l(3,r)}function vi(){r.h.h=this.value,l(3,r)}function Kl(){r.h.n=this.value,l(3,r)}function pl(Fe){r.t.t[Fe]=fe(this.value),l(3,r)}function Jt(){r.t.h=fe(this.value),l(3,r)}function hi(Fe){r.u[Fe.key]=tt(this),l(3,r)}function bi(){r.i.h.u=this.checked,l(3,r)}function gi(){r.i.h.p=tt(this),l(3,r)}function lt(){r.i.a=fe(this.value),l(3,r)}function ki(){r.i.l.i=this.checked,l(3,r)}function Xt(){r.i.l.p=fe(this.value),l(3,r)}function wi(){r.i.r.i=this.checked,l(3,r)}function yi(){r.i.r.r=fe(this.value),l(3,r)}function $i(){r.i.r.g=fe(this.value),l(3,r)}function nt(){r.i.r.b=fe(this.value),l(3,r)}function Ci(){r.i.t.d=fe(this.value),l(3,r)}function xt(){r.i.t.a=fe(this.value),l(3,r)}function Ql(){r.i.v.p=fe(this.value),l(3,r)}function dt(){r.i.v.d.v=fe(this.value),l(3,r)}function Ti(){r.i.v.d.g=fe(this.value),l(3,r)}function Si(){r.i.v.o=fe(this.value),l(3,r)}function Pi(){r.i.v.m=fe(this.value),l(3,r)}function el(){r.i.v.b=fe(this.value),l(3,r)}function Mi(){r.d.s=this.checked,l(3,r)}function Ai(){r.d.t=this.checked,l(3,r)}function Di(){r.d.l=tt(this),l(3,r)}return t.$$set=Fe=>{"sysinfo"in Fe&&l(0,n=Fe.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,d=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,a,r,c,f,d,i,m,_,h,b,g,$,k,T,P,E,S,N,D,R,W,O,F,L,j,U,q,G,H,V,X,ne,le,_e,Te,ve,qe,be,Ee,he,Ne,pe,me,se,re,K,ae,Ae,te,ue,He,Se,de,De,Oe,ge,ke,x,oe,Tl,_i,di,St,vi,Kl,pl,Jt,hi,bi,gi,lt,ki,Xt,wi,yi,$i,nt,Ci,xt,Ql,dt,Ti,Si,Pi,el,Mi,Ai,Di]}class Em extends Ce{constructor(e){super(),$e(this,e,Im,Dm,ye,{sysinfo:0},null,[-1,-1,-1,-1])}}function uf(t,e,l){const n=t.slice();return n[20]=e[l],n}function Rm(t){let e=ce(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&2&&e!==(e=ce(n[1].chip,n[1].board)+"")&&B(l,e)},d(n){n&&w(l)}}}function rf(t){let e,l,n=t[1].apmac+"",i,o,a,r,c,f,m,_,h,b=Ur(t[1])+"",d,g,$=t[1].boot_reason+"",k,T,P;const E=[Lm,Fm],S=[];function N(D,R){return D[0].u>0?0:1}return c=N(t),f=S[c]=E[c](t),{c(){e=p("div"),l=C("AP MAC: "),i=C(n),o=v(),a=p("div"),r=C(`Last boot: `),f.c(),m=v(),_=p("div"),h=C("Reason: "),d=C(b),g=C(" ("),k=C($),T=C(")"),u(e,"class","my-2"),u(a,"class","my-2"),u(_,"class","my-2")},m(D,R){y(D,e,R),s(e,l),s(e,i),y(D,o,R),y(D,a,R),s(a,r),S[c].m(a,null),y(D,m,R),y(D,_,R),s(_,h),s(_,d),s(_,g),s(_,k),s(_,T),P=!0},p(D,R){(!P||R&2)&&n!==(n=D[1].apmac+"")&&B(i,n);let W=c;c=N(D),c===W?S[c].p(D,R):(Pe(),I(S[W],1,1,()=>{S[W]=null}),Me(),f=S[c],f?f.p(D,R):(f=S[c]=E[c](D),f.c()),M(f,1),f.m(a,null)),(!P||R&2)&&b!==(b=Ur(D[1])+"")&&B(d,b),(!P||R&2)&&$!==($=D[1].boot_reason+"")&&B(k,$)},i(D){P||(M(f),P=!0)},o(D){I(f),P=!1},d(D){D&&w(e),D&&w(o),D&&w(a),S[c].d(),D&&w(m),D&&w(_)}}}function Fm(t){let e;return{c(){e=C("-")},m(l,n){y(l,e,n)},p:ie,i:ie,o:ie,d(l){l&&w(e)}}}function Lm(t){let e,l;return e=new vc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){J(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function qm(t){let e;return{c(){e=p("span"),e.textContent="Update consents",u(e,"class","btn-pri-sm")},m(l,n){y(l,e,n)},p:ie,d(l){l&&w(e)}}}function af(t){let e,l,n,i,o,a=hs(t[1].meter.mfg)+"",r,c,f,m,_=t[1].meter.model+"",h,b,d,g,$=t[1].meter.id+"",k;return{c(){e=p("div"),l=p("strong"),l.textContent="Meter",n=v(),i=p("div"),o=C("Manufacturer: "),r=C(a),c=v(),f=p("div"),m=C("Model: "),h=C(_),b=v(),d=p("div"),g=C("ID: "),k=C($),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(d,"class","my-2"),u(e,"class","cnt")},m(T,P){y(T,e,P),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(e,c),s(e,f),s(f,m),s(f,h),s(e,b),s(e,d),s(d,g),s(d,k)},p(T,P){P&2&&a!==(a=hs(T[1].meter.mfg)+"")&&B(r,a),P&2&&_!==(_=T[1].meter.model+"")&&B(h,_),P&2&&$!==($=T[1].meter.id+"")&&B(k,$)},d(T){T&&w(e)}}}function ff(t){let e,l,n,i,o,a=t[1].net.ip+"",r,c,f,m,_=t[1].net.mask+"",h,b,d,g,$=t[1].net.gw+"",k,T,P,E,S=t[1].net.dns1+"",N,D,R=t[1].net.dns2&&cf(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Network",n=v(),i=p("div"),o=C("IP: "),r=C(a),c=v(),f=p("div"),m=C("Mask: "),h=C(_),b=v(),d=p("div"),g=C("Gateway: "),k=C($),T=v(),P=p("div"),E=C("DNS: "),N=C(S),D=v(),R&&R.c(),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(d,"class","my-2"),u(P,"class","my-2"),u(e,"class","cnt")},m(W,O){y(W,e,O),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(e,c),s(e,f),s(f,m),s(f,h),s(e,b),s(e,d),s(d,g),s(d,k),s(e,T),s(e,P),s(P,E),s(P,N),s(P,D),R&&R.m(P,null)},p(W,O){O&2&&a!==(a=W[1].net.ip+"")&&B(r,a),O&2&&_!==(_=W[1].net.mask+"")&&B(h,_),O&2&&$!==($=W[1].net.gw+"")&&B(k,$),O&2&&S!==(S=W[1].net.dns1+"")&&B(N,S),W[1].net.dns2?R?R.p(W,O):(R=cf(W),R.c(),R.m(P,null)):R&&(R.d(1),R=null)},d(W){W&&w(e),R&&R.d()}}}function cf(t){let e,l=t[1].net.dns2+"",n;return{c(){e=C("/ "),n=C(l)},m(i,o){y(i,e,o),y(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&B(n,l)},d(i){i&&w(e),i&&w(n)}}}function pf(t){let e,l,n,i=t[2].tag_name+"",o,a,r,c,f,m,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name&&mf(t),h=t[1].fwconsent===2&&_f();return{c(){e=p("div"),l=C(`Latest version: diff --git a/lib/SvelteUi/app/src/lib/Clock.svelte b/lib/SvelteUi/app/src/lib/Clock.svelte index 4c103d75..8604e1d4 100644 --- a/lib/SvelteUi/app/src/lib/Clock.svelte +++ b/lib/SvelteUi/app/src/lib/Clock.svelte @@ -8,5 +8,5 @@ {#if Math.abs(new Date().getTime()-timestamp.getTime()) < 300000 } {`${zeropad(timestamp.getDate())}. ${monthnames[timestamp.getMonth()]} ${zeropad(timestamp.getHours())}:${zeropad(timestamp.getMinutes())}`} {:else} -{`${zeropad(timestamp.getDate())}.${zeropad(timestamp.getMonth())}.${timestamp.getFullYear()} ${zeropad(timestamp.getHours())}:${zeropad(timestamp.getMinutes())}`} +{`${zeropad(timestamp.getDate())}.${zeropad(timestamp.getMonth()+1)}.${timestamp.getFullYear()} ${zeropad(timestamp.getHours())}:${zeropad(timestamp.getMinutes())}`} {/if}