mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-05-01 05:59:24 +00:00
14 lines
168 KiB
JavaScript
14 lines
168 KiB
JavaScript
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function se(){}function Ot(t,e){for(const l in e)t[l]=e[l];return t}function gf(t){return t()}function pr(){return Object.create(null)}function Be(t){t.forEach(gf)}function bf(t){return typeof t=="function"}function ke(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Xi;function mc(t,e){return Xi||(Xi=document.createElement("a")),Xi.href=e,t===Xi.href}function pc(t){return Object.keys(t).length===0}function Vs(t,...e){if(t==null)return se;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function jn(t){let e;return Vs(t,l=>e=l)(),e}function Bt(t,e,l){t.$$.on_destroy.push(Vs(e,l))}function Ks(t,e,l,n){if(t){const i=kf(t,e,l,n);return t[0](i)}}function kf(t,e,l,n){return t[1]&&n?Ot(l.ctx.slice(),t[1](n(e))):l.ctx}function Qs(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],r=Math.max(e.dirty.length,i.length);for(let a=0;a<r;a+=1)o[a]=e.dirty[a]|i[a];return o}return e.dirty|i}return e.dirty}function Zs(t,e,l,n,i,o){if(i){const r=kf(e,l,n,o);t.p(r,i)}}function Js(t){if(t.ctx.length>32){const e=[],l=t.ctx.length/32;for(let n=0;n<l;n++)e[n]=-1;return e}return-1}function ss(t){const e={};for(const l in t)l[0]!=="$"&&(e[l]=t[l]);return e}function os(t,e){const l={};e=new Set(e);for(const n in t)!e.has(n)&&n[0]!=="$"&&(l[n]=t[n]);return l}function s(t,e){t.appendChild(e)}function y(t,e,l){t.insertBefore(e,l||null)}function w(t){t.parentNode.removeChild(t)}function Vt(t,e){for(let l=0;l<t.length;l+=1)t[l]&&t[l].d(e)}function m(t){return document.createElement(t)}function Oe(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function $(t){return document.createTextNode(t)}function v(){return $(" ")}function We(){return $("")}function Y(t,e,l,n){return t.addEventListener(e,l,n),()=>t.removeEventListener(e,l,n)}function cs(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 zt(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set?t[n]=e[n]:u(t,n,e[n])}function ce(t){return t===""?null:+t}function _c(t){return Array.from(t.childNodes)}function B(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Q(t,e){t.value=e==null?"":e}function wf(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<t.options.length;l+=1){const n=t.options[l];if(n.__value===e){n.selected=!0;return}}t.selectedIndex=-1}function et(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}let xi;function dc(){if(xi===void 0){xi=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{xi=!0}}return xi}function vc(t,e){getComputedStyle(t).position==="static"&&(t.style.position="relative");const n=m("iframe");n.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),n.setAttribute("aria-hidden","true"),n.tabIndex=-1;const i=dc();let o;return i?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",o=Y(window,"message",r=>{r.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=Y(n.contentWindow,"resize",e)}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),w(n)}}function hc(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}let si;function li(t){si=t}function oi(){if(!si)throw new Error("Function called outside component initialization");return si}function gc(t){oi().$$.on_mount.push(t)}function bc(t){oi().$$.on_destroy.push(t)}function kc(){const t=oi();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=hc(e,l,{cancelable:n});return i.slice().forEach(r=>{r.call(t,o)}),!o.defaultPrevented}return!0}}function ni(t,e){return oi().$$.context.set(t,e),e}function wl(t){return oi().$$.context.get(t)}const ei=[],us=[],ns=[],_r=[],yf=Promise.resolve();let Fs=!1;function $f(){Fs||(Fs=!0,yf.then(Cf))}function wc(){return $f(),yf}function ze(t){ns.push(t)}const As=new Set;let es=0;function Cf(){const t=si;do{for(;es<ei.length;){const e=ei[es];es++,li(e),yc(e.$$)}for(li(null),ei.length=0,es=0;us.length;)us.pop()();for(let e=0;e<ns.length;e+=1){const l=ns[e];As.has(l)||(As.add(l),l())}ns.length=0}while(ei.length);for(;_r.length;)_r.pop()();Fs=!1,As.clear(),li(t)}function yc(t){if(t.fragment!==null){t.update(),Be(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(ze)}}const is=new Set;let jl;function Me(){jl={r:0,c:[],p:jl}}function Ae(){jl.r||Be(jl.c),jl=jl.p}function P(t,e){t&&t.i&&(is.delete(t),t.i(e))}function N(t,e,l,n){if(t&&t.o){if(is.has(t))return;is.add(t),jl.c.push(()=>{is.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function Wn(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const r=t[o],a=e[o];if(a){for(const f in r)f in a||(n[f]=1);for(const f in a)i[f]||(l[f]=a[f],i[f]=1);t[o]=a}else for(const f in r)i[f]=1}for(const r in n)r in l||(l[r]=void 0);return l}function dr(t){return typeof t=="object"&&t!==null?t:{}}function Z(t){t&&t.c()}function V(t,e,l,n){const{fragment:i,on_mount:o,on_destroy:r,after_update:a}=t.$$;i&&i.m(e,l),n||ze(()=>{const f=o.map(gf).filter(bf);r?r.push(...f):Be(f),t.$$.on_mount=[]}),a.forEach(ze)}function K(t,e){const l=t.$$;l.fragment!==null&&(Be(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function $c(t,e){t.$$.dirty[0]===-1&&(ei.push(t),$f(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function we(t,e,l,n,i,o,r,a=[-1]){const f=si;li(t);const c=t.$$={fragment:null,ctx:null,props:o,update:se,not_equal:i,bound:pr(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(f?f.$$.context:[])),callbacks:pr(),dirty:a,skip_bound:!1,root:e.target||f.$$.root};r&&r(c.root);let p=!1;if(c.ctx=l?l(t,e.props||{},(_,d,...g)=>{const h=g.length?g[0]:d;return c.ctx&&i(c.ctx[_],c.ctx[_]=h)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](h),p&&$c(t,_)),d}):[],c.update(),p=!0,Be(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=_c(e.target);c.fragment&&c.fragment.l(_),_.forEach(w)}else c.fragment&&c.fragment.c();e.intro&&P(t.$$.fragment),V(t,e.target,e.anchor,e.customElement),Cf()}li(f)}class ye{$destroy(){K(this,1),this.$destroy=se}$on(e,l){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!pc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const vr=t=>typeof t>"u",Sf=t=>typeof t=="function",Tf=t=>typeof t=="number";function Cc(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Pf(){let t=0;return()=>t++}function Sc(){return Math.random().toString(36).substring(2)}const yl=typeof window>"u";function Mf(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Ls=(t,e)=>t?{}:{style:e},qn=t=>({"aria-hidden":"true",...Ls(t,"display:none;")}),On=[];function Af(t,e){return{subscribe:Ze(t,e).subscribe}}function Ze(t,e=se){let l;const n=new Set;function i(a){if(ke(t,a)&&(t=a,l)){const f=!On.length;for(const c of n)c[1](),On.push(c,t);if(f){for(let c=0;c<On.length;c+=2)On[c][0](On[c+1]);On.length=0}}}function o(a){i(a(t))}function r(a,f=se){const c=[a,f];return n.add(c),n.size===1&&(l=e(i)||se),a(t),()=>{n.delete(c),n.size===0&&(l(),l=null)}}return{set:i,update:o,subscribe:r}}function Tc(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return Af(l,r=>{let a=!1;const f=[];let c=0,p=se;const _=()=>{if(c)return;p();const g=e(n?f[0]:f,r);o?r(g):p=bf(g)?g:se},d=i.map((g,h)=>Vs(g,b=>{f[h]=b,c&=~(1<<h),a&&_()},()=>{c|=1<<h}));return a=!0,_(),function(){Be(d),p()}})}const ui=t=>`@@svnav-ctx__${t}`,Os=ui("LOCATION"),Gn=ui("ROUTER"),Df=ui("ROUTE"),Pc=ui("ROUTE_PARAMS"),Mc=ui("FOCUS_ELEM"),Nf=/^:(.+)/,ti=(t,e,l)=>t.substr(e,l),qs=(t,e)=>ti(t,0,e.length)===e,Ac=t=>t==="",Dc=t=>Nf.test(t),If=t=>t[0]==="*",Nc=t=>t.replace(/\*.*$/,""),Ef=t=>t.replace(/(^\/+|\/+$)/g,"");function Kt(t,e=!1){const l=Ef(t).split("/");return e?l.filter(Boolean):l}const Ds=(t,e)=>t+(e?`?${e}`:""),Xs=t=>`/${Ef(t)}`;function ri(...t){const e=n=>Kt(n,!0).join("/"),l=t.map(e).join("/");return Xs(l)}const xs=1,ms=2,Bl=3,Ic=4,Rf=5,Ec=6,Ff=7,Rc=8,Fc=9,Lf=10,Of=11,Lc={[xs]:"Link",[ms]:"Route",[Bl]:"Router",[Ic]:"useFocus",[Rf]:"useLocation",[Ec]:"useMatch",[Ff]:"useNavigate",[Rc]:"useParams",[Fc]:"useResolvable",[Lf]:"useResolve",[Of]:"navigate"},eo=t=>Lc[t];function Oc(t,e){let l;return t===ms?l=e.path?`path="${e.path}"`:"default":t===xs?l=`to="${e.to}"`:t===Bl&&(l=`basepath="${e.basepath||""}"`),`<${eo(t)} ${l||""} />`}function qc(t,e,l,n){const i=l&&Oc(n||t,l),o=i?`
|
|
|
|
Occurred in: ${i}`:"",r=eo(t),a=Sf(e)?e(r):e;return`<${r}> ${a}${o}`}const qf=t=>(...e)=>t(qc(...e)),Uf=qf(t=>{throw new Error(t)}),rs=qf(console.warn),hr=4,Uc=3,Hc=2,jc=1,Wc=1;function Gc(t,e){const l=t.default?0:Kt(t.fullPath).reduce((n,i)=>{let o=n;return o+=hr,Ac(i)?o+=Wc:Dc(i)?o+=Hc:If(i)?o-=hr+jc:o+=Uc,o},0);return{route:t,score:l,index:e}}function Bc(t){return t.map(Gc).sort((e,l)=>e.score<l.score?1:e.score>l.score?-1:e.index-l.index)}function Hf(t,e){let l,n;const[i]=e.split("?"),o=Kt(i),r=o[0]==="",a=Bc(t);for(let f=0,c=a.length;f<c;f++){const{route:p}=a[f];let _=!1;const d={},g=k=>({...p,params:d,uri:k});if(p.default){n=g(e);continue}const h=Kt(p.fullPath),b=Math.max(o.length,h.length);let C=0;for(;C<b;C++){const k=h[C],S=o[C];if(!vr(k)&&If(k)){const I=k==="*"?"*":k.slice(1);d[I]=o.slice(C).map(decodeURIComponent).join("/");break}if(vr(S)){_=!0;break}const M=Nf.exec(k);if(M&&!r){const I=decodeURIComponent(S);d[M[1]]=I}else if(k!==S){_=!0;break}}if(!_){l=g(ri(...o.slice(0,C)));break}}return l||n||null}function jf(t,e){return Hf([t],e)}function zc(t,e){if(qs(t,"/"))return t;const[l,n]=t.split("?"),[i]=e.split("?"),o=Kt(l),r=Kt(i);if(o[0]==="")return Ds(i,n);if(!qs(o[0],".")){const c=r.concat(o).join("/");return Ds((i==="/"?"":"/")+c,n)}const a=r.concat(o),f=[];return a.forEach(c=>{c===".."?f.pop():c!=="."&&f.push(c)}),Ds(`/${f.join("/")}`,n)}function gr(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,r=Kt(e,!0),a=Kt(l,!0);for(;r.length;)r[0]!==a[0]&&Uf(Bl,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),r.shift(),a.shift();return{pathname:ri(...a),hash:n,search:i,state:o}}const br=t=>t.length===1?"":t,to=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?br(ti(t,l)):"",r=i?ti(t,0,l):t,a=n?br(ti(r,e)):"";return{pathname:(n?ti(r,0,e):r)||"/",search:a,hash:o}},Yc=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function Vc(t,e,l){return ri(l,zc(t,e))}function Kc(t,e){const l=Xs(Nc(t)),n=Kt(l,!0),i=Kt(e,!0).slice(0,n.length),o=jf({fullPath:l},ri(...i));return o&&o.uri}const Ns="POP",Qc="PUSH",Zc="REPLACE";function Is(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function Jc(t){let e=[],l=Is(t),n=Ns;const i=(o=e)=>o.forEach(r=>r({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const r=()=>{l=Is(t),n=Ns,i([o])};i([o]);const a=Mf(t,"popstate",r);return()=>{a(),e=e.filter(f=>f!==o)}},navigate(o,r){const{state:a={},replace:f=!1}=r||{};if(n=f?Zc:Qc,Tf(o))r&&rs(Of,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ns,t.history.go(o);else{const c={...a,_key:Sc()};try{t.history[f?"replaceState":"pushState"](c,"",o)}catch{t.location[f?"replace":"assign"](o)}}l=Is(t),i()}}}function Es(t,e){return{...to(e),state:t}}function Xc(t="/"){let e=0,l=[Es(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(Es(n,o))},replaceState(n,i,o){l[e]=Es(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const xc=!!(!yl&&window.document&&window.document.createElement),e1=!yl&&window.location.origin==="null",Wf=Jc(xc&&!e1?window:Xc()),{navigate:Un}=Wf;let ul=null,Gf=!0;function t1(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;n<l.length;n++){const i=l[n],o=Number(i.dataset.svnavRouter);if(o===t)return!0;if(o===e)return!1}return!1}function l1(t){(!ul||t.level>ul.level||t.level===ul.level&&t1(t.routerId,ul.routerId))&&(ul=t)}function n1(){ul=null}function i1(){Gf=!1}function kr(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Mf(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function s1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function o1(t){return/^H[1-6]$/i.test(t.tagName)}function wr(t,e=document){return e.querySelector(t)}function u1(t){let l=wr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!s1(l,t);){if(o1(l))return l;const n=wr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function r1(t){Promise.resolve(jn(t.focusElement)).then(e=>{const l=e||u1(t.id);l||rs(Bl,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,ms),!kr(l)&&kr(document.documentElement)})}const a1=(t,e,l)=>(n,i)=>wc().then(()=>{if(!ul||Gf){i1();return}if(n&&r1(ul.route),t.announcements&&i){const{path:o,fullPath:r,meta:a,params:f,uri:c}=ul.route,p=t.createAnnouncement({path:o,fullPath:r,meta:a,params:f,uri:c},jn(l));Promise.resolve(p).then(_=>{e.set(_)})}n1()}),yr="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 f1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Ls(t[6],yr)],i={};for(let o=0;o<n.length;o+=1)i=Ot(i,n[o]);return{c(){e=m("div"),l=$(t[0]),zt(e,i)},m(o,r){y(o,e,r),s(e,l)},p(o,r){r[0]&1&&B(l,o[0]),zt(e,i=Wn(n,[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Ls(o[6],yr)]))},d(o){o&&w(e)}}}function c1(t){let e,l,n,i,o,r=[qn(t[6]),{"data-svnav-router":t[3]}],a={};for(let _=0;_<r.length;_+=1)a=Ot(a,r[_]);const f=t[22].default,c=Ks(f,t,t[21],null);let p=t[2]&&t[4]&&t[1].announcements&&f1(t);return{c(){e=m("div"),l=v(),c&&c.c(),n=v(),p&&p.c(),i=We(),zt(e,a)},m(_,d){y(_,e,d),y(_,l,d),c&&c.m(_,d),y(_,n,d),p&&p.m(_,d),y(_,i,d),o=!0},p(_,d){zt(e,a=Wn(r,[qn(_[6]),{"data-svnav-router":_[3]}])),c&&c.p&&(!o||d[0]&2097152)&&Zs(c,f,_,_[21],o?Qs(f,_[21],d,null):Js(_[21]),null),_[2]&&_[4]&&_[1].announcements&&p.p(_,d)},i(_){o||(P(c,_),o=!0)},o(_){N(c,_),o=!1},d(_){_&&w(e),_&&w(l),c&&c.d(_),_&&w(n),p&&p.d(_),_&&w(i)}}}const m1=Pf(),$r="/";function p1(t,e,l){let n,i,o,r,a,{$$slots:f={},$$scope:c}=e,{basepath:p=$r}=e,{url:_=null}=e,{history:d=Wf}=e,{primary:g=!0}=e,{a11y:h={}}=e,{disableInlineStyles:b=!1}=e;const C={createAnnouncement:te=>`Navigated to ${te.uri}`,announcements:!0,...h},k=p,S=Xs(p),M=wl(Os),I=wl(Gn),T=!M,D=m1(),R=g&&!(I&&!I.manageFocus),F=Ze("");Bt(t,F,te=>l(0,a=te));const H=I?I.disableInlineStyles:b,j=Ze([]);Bt(t,j,te=>l(20,r=te));const E=Ze(null);Bt(t,E,te=>l(18,i=te));let L=!1;const W=T?0:I.level+1,q=T?Ze((()=>gr(yl?to(_):d.location,S))()):M;Bt(t,q,te=>l(17,n=te));const O=Ze(n);Bt(t,O,te=>l(19,o=te));const U=a1(C,F,q),X=te=>Te=>Te.filter(pe=>pe.id!==te);function z(te){if(yl){if(L)return;const Te=jf(te,n.pathname);if(Te)return L=!0,Te}else j.update(Te=>{const pe=X(te.id)(Te);return pe.push(te),pe})}function ne(te){j.update(X(te))}return!T&&p!==$r&&rs(Bl,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),T&&(gc(()=>d.listen(Te=>{const pe=gr(Te.location,S);O.set(n),q.set(pe)})),ni(Os,q)),ni(Gn,{activeRoute:E,registerRoute:z,unregisterRoute:ne,manageFocus:R,level:W,id:D,history:T?d:I.history,basepath:T?S:I.basepath,disableInlineStyles:H}),t.$$set=te=>{"basepath"in te&&l(11,p=te.basepath),"url"in te&&l(12,_=te.url),"history"in te&&l(13,d=te.history),"primary"in te&&l(14,g=te.primary),"a11y"in te&&l(15,h=te.a11y),"disableInlineStyles"in te&&l(16,b=te.disableInlineStyles),"$$scope"in te&&l(21,c=te.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==k&&rs(Bl,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const te=Hf(r,n.pathname);E.set(te)}if(t.$$.dirty[0]&655360&&T){const te=!!n.hash,Te=!te&&R,pe=!te||n.pathname!==o.pathname;U(Te,pe)}t.$$.dirty[0]&262144&&R&&i&&i.primary&&l1({level:W,routerId:D,route:i})},[a,C,T,D,R,F,H,j,E,q,O,p,_,d,g,h,b,n,i,o,r,c,f]}class Bf extends ye{constructor(e){super(),we(this,e,p1,c1,ke,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}function ai(t,e,l=Gn,n=Bl){wl(l)||Uf(t,o=>`You cannot use ${o} outside of a ${eo(n)}.`,e)}const _1=t=>{const{subscribe:e}=wl(t);return{subscribe:e}};function zf(){return ai(Rf),_1(Os)}function Yf(){const{history:t}=wl(Gn);return t}function Vf(){const t=wl(Df);return t?Tc(t,e=>e.base):Ze("/")}function Kf(){ai(Lf);const t=Vf(),{basepath:e}=wl(Gn);return n=>Vc(n,jn(t),e)}function d1(){ai(Ff);const t=Kf(),{navigate:e}=Yf();return(n,i)=>{const o=Tf(n)?n:t(n);return e(o,i)}}const v1=t=>({params:t&16,location:t&8}),Cr=t=>({params:yl?jn(t[10]):t[4],location:t[3],navigate:t[11]});function Sr(t){let e,l;return e=new Bf({props:{primary:t[1],$$slots:{default:[b1]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function h1(t){let e;const l=t[18].default,n=Ks(l,t,t[19],Cr);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&Zs(n,l,i,i[19],e?Qs(l,i[19],o,v1):Js(i[19]),Cr)},i(i){e||(P(n,i),e=!0)},o(i){N(n,i),e=!1},d(i){n&&n.d(i)}}}function g1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},yl?jn(t[10]):t[4],t[12]];var o=t[0];function r(a){let f={};for(let c=0;c<i.length;c+=1)f=Ot(f,i[c]);return{props:f}}return o&&(e=new o(r())),{c(){e&&Z(e.$$.fragment),l=We()},m(a,f){e&&V(e,a,f),y(a,l,f),n=!0},p(a,f){const c=f&7192?Wn(i,[f&8&&{location:a[3]},f&2048&&{navigate:a[11]},f&1040&&dr(yl?jn(a[10]):a[4]),f&4096&&dr(a[12])]):{};if(o!==(o=a[0])){if(e){Me();const p=e;N(p.$$.fragment,1,0,()=>{K(p,1)}),Ae()}o?(e=new o(r()),Z(e.$$.fragment),P(e.$$.fragment,1),V(e,l.parentNode,l)):e=null}else o&&e.$set(c)},i(a){n||(e&&P(e.$$.fragment,a),n=!0)},o(a){e&&N(e.$$.fragment,a),n=!1},d(a){a&&w(l),e&&K(e,a)}}}function b1(t){let e,l,n,i;const o=[g1,h1],r=[];function a(f,c){return f[0]!==null?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?r[e].p(f,c):(Me(),N(r[p],1,1,()=>{r[p]=null}),Ae(),l=r[e],l?l.p(f,c):(l=r[e]=o[e](f),l.c()),P(l,1),l.m(n.parentNode,n))},i(f){i||(P(l),i=!0)},o(f){N(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function k1(t){let e,l,n,i,o,r=[qn(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let _=0;_<r.length;_+=1)a=Ot(a,r[_]);let f=t[2]&&Sr(t),c=[qn(t[7]),{"data-svnav-route-end":t[5]}],p={};for(let _=0;_<c.length;_+=1)p=Ot(p,c[_]);return{c(){e=m("div"),l=v(),f&&f.c(),n=v(),i=m("div"),zt(e,a),zt(i,p)},m(_,d){y(_,e,d),y(_,l,d),f&&f.m(_,d),y(_,n,d),y(_,i,d),o=!0},p(_,[d]){zt(e,a=Wn(r,[qn(_[7]),{"data-svnav-route-start":_[5]}])),_[2]?f?(f.p(_,d),d&4&&P(f,1)):(f=Sr(_),f.c(),P(f,1),f.m(n.parentNode,n)):f&&(Me(),N(f,1,1,()=>{f=null}),Ae()),zt(i,p=Wn(c,[qn(_[7]),{"data-svnav-route-end":_[5]}]))},i(_){o||(P(f),o=!0)},o(_){N(f),o=!1},d(_){_&&w(e),_&&w(l),f&&f.d(_),_&&w(n),_&&w(i)}}}const w1=Pf();function y1(t,e,l){let n;const i=["path","component","meta","primary"];let o=os(e,i),r,a,f,c,{$$slots:p={},$$scope:_}=e,{path:d=""}=e,{component:g=null}=e,{meta:h={}}=e,{primary:b=!0}=e;ai(ms,e);const C=w1(),{registerRoute:k,unregisterRoute:S,activeRoute:M,disableInlineStyles:I}=wl(Gn);Bt(t,M,L=>l(16,r=L));const T=Vf();Bt(t,T,L=>l(17,f=L));const D=zf();Bt(t,D,L=>l(3,a=L));const R=Ze(null);let F;const H=Ze(),j=Ze({});Bt(t,j,L=>l(4,c=L)),ni(Df,H),ni(Pc,j),ni(Mc,R);const E=d1();return yl||bc(()=>S(C)),t.$$set=L=>{l(24,e=Ot(Ot({},e),ss(L))),l(12,o=os(e,i)),"path"in L&&l(13,d=L.path),"component"in L&&l(0,g=L.component),"meta"in L&&l(14,h=L.meta),"primary"in L&&l(1,b=L.primary),"$$scope"in L&&l(19,_=L.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const L=d==="",W=ri(f,d),G={id:C,path:d,meta:h,default:L,fullPath:L?"":W,base:L?f:Kc(W,a.pathname),primary:b,focusElement:R};H.set(G),l(15,F=k(G))}if(t.$$.dirty&98304&&l(2,n=!!(F||r&&r.id===C)),t.$$.dirty&98308&&n){const{params:L}=F||r;j.set(L)}},e=ss(e),[g,b,n,a,c,C,M,I,T,D,j,E,o,d,h,F,r,f,p,_]}class ol extends ye{constructor(e){super(),we(this,e,y1,k1,ke,{path:13,component:0,meta:14,primary:1})}}function $1(t){let e,l,n,i;const o=t[13].default,r=Ks(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],f={};for(let c=0;c<a.length;c+=1)f=Ot(f,a[c]);return{c(){e=m("a"),r&&r.c(),zt(e,f)},m(c,p){y(c,e,p),r&&r.m(e,null),l=!0,n||(i=Y(e,"click",t[4]),n=!0)},p(c,[p]){r&&r.p&&(!l||p&4096)&&Zs(r,o,c,c[12],l?Qs(o,c[12],p,null):Js(c[12]),null),zt(e,f=Wn(a,[(!l||p&1)&&{href:c[0]},p&4&&c[2],p&2&&c[1]]))},i(c){l||(P(r,c),l=!0)},o(c){N(r,c),l=!1},d(c){c&&w(e),r&&r.d(c),n=!1,i()}}}function C1(t,e,l){let n,i,o,r,a,f;const c=["to","replace","state","getProps"];let p=os(e,c),_,{$$slots:d={},$$scope:g}=e,{to:h}=e,{replace:b=!1}=e,{state:C={}}=e,{getProps:k=null}=e;ai(xs,e);const S=zf();Bt(t,S,R=>l(11,_=R));const M=kc(),I=Kf(),{navigate:T}=Yf();function D(R){M("click",R),Cc(R)&&(R.preventDefault(),T(n,{state:C,replace:r||b}))}return t.$$set=R=>{l(19,e=Ot(Ot({},e),ss(R))),l(18,p=os(e,c)),"to"in R&&l(5,h=R.to),"replace"in R&&l(6,b=R.replace),"state"in R&&l(7,C=R.state),"getProps"in R&&l(8,k=R.getProps),"$$scope"in R&&l(12,g=R.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=I(h,_)),t.$$.dirty&2049&&l(10,i=qs(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(r=to(n)===Yc(_)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,f=(()=>{if(Sf(k)){const R=k({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...R}}return p})())},e=ss(e),[n,f,a,S,D,h,b,C,k,o,i,_,g,d]}class kl extends ye{constructor(e){super(),we(this,e,C1,$1,ke,{to:5,replace:6,state:7,getProps:8})}}let Us=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function bl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function S1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Qf(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function T1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function as(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 De(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function me(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Tr(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 Pr(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 Mr(t){switch(t){case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 500:return"Internal server error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Hn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function je(t,e){return t==1||t==2&&e}function Lt(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function be(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function ii(t,e){return t.setTime(t.getTime()+e*36e5),t}function Ar(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"Normal";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";case 11:return"Time Group reset";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Unstable Vdd";case 16:return"RTC reset";default:return"Unknown"}}async function $l(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let Gt={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,trying:null};const yt=Ze(Gt);async function lo(){Gt=await(await $l("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),yt.set(Gt)}let ts=0,Dr=-127,Nr=null,P1={};const M1=Af(P1,t=>{let e;async function l(){$l("/data.json").then(n=>n.json()).then(n=>{t(n),Dr!=n.t&&(Dr=n.t,setTimeout(xf,2e3)),Nr!=n.p&&(Nr=n.p,setTimeout(A1,4e3)),Gt.upgrading?window.location.reload():(!Gt||!Gt.chip||Gt.booting||ts>1&&!Hn(Gt.board))&&(lo(),Wl&&clearTimeout(Wl),Wl=setTimeout(no,2e3),Gl&&clearTimeout(Gl),Gl=setTimeout(io,3e3));let i=5e3;if(Hn(Gt.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),ts=0}).catch(n=>{ts++,ts>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,Hn(Gt.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Hs={};const Zf=Ze(Hs);async function A1(){Hs=await(await $l("/energyprice.json")).json(),Zf.set(Hs)}let js={},Wl;async function no(){Wl&&(clearTimeout(Wl),Wl=0),js=await(await $l("/dayplot.json")).json(),Jf.set(js);let e=new Date;Wl=setTimeout(no,(60-e.getMinutes())*6e4+20)}const Jf=Ze(js,t=>(no(),function(){}));let Ws={},Gl;async function io(){Gl&&(clearTimeout(Gl),Gl=0),Ws=await(await $l("/monthplot.json")).json(),Xf.set(Ws);let e=new Date;Gl=setTimeout(io,(24-e.getHours())*36e5+40)}const Xf=Ze(Ws,t=>(io(),function(){}));let Gs={};async function xf(){Gs=await(await $l("/temperature.json")).json(),ec.set(Gs)}const ec=Ze(Gs,t=>(xf(),function(){}));let Bs={},ls;async function tc(){ls&&(clearTimeout(ls),ls=0),Bs=await(await $l("/tariff.json")).json(),lc.set(Bs);let e=new Date;ls=setTimeout(tc,(60-e.getMinutes())*6e4+30)}const lc=Ze(Bs,t=>function(){});let zs=[];const so=Ze(zs);async function D1(){zs=await(await $l("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),so.set(zs)}function fs(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 nc(){await(await fetch("/upgrade",{method:"POST"})).json()}function ic(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),r=[...e];r.reverse();let a,f,c;for(let p=0;p<r.length;p++){let _=r[p],g=_.tag_name.substring(1).split("."),h=parseInt(g[0]),b=parseInt(g[1]),C=parseInt(g[2]);if(h==n)b==i?C>o&&(a=_):b==i+1&&(f=_);else if(h==n+1)if(c){let k=c.tag_name.substring(1).split(".");parseInt(k[0]);let S=parseInt(k[1]);parseInt(k[2]),b==S&&(c=_)}else c=_}return f||c||a||!1}else return e[0]}const N1="/github.svg";function Ir(t){let e,l;function n(r,a){return r[1]>1?q1:r[1]>0?O1:r[2]>1?L1:r[2]>0?F1:r[3]>1?R1:r[3]>0?E1:I1}let i=n(t),o=i(t);return{c(){e=$(`Up
|
|
`),o.c(),l=We()},m(r,a){y(r,e,a),o.m(r,a),y(r,l,a)},p(r,a){i===(i=n(r))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},d(r){r&&w(e),o.d(r),r&&w(l)}}}function I1(t){let e,l;return{c(){e=$(t[0]),l=$(" 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 E1(t){let e,l;return{c(){e=$(t[3]),l=$(" 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 R1(t){let e,l;return{c(){e=$(t[3]),l=$(" 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 F1(t){let e,l;return{c(){e=$(t[2]),l=$(" 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 L1(t){let e,l;return{c(){e=$(t[2]),l=$(" 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 O1(t){let e,l;return{c(){e=$(t[1]),l=$(" 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 q1(t){let e,l;return{c(){e=$(t[1]),l=$(" 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 U1(t){let e,l=t[0]&&Ir(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=Ir(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:se,o:se,d(n){l&&l.d(n),n&&w(e)}}}function H1(t,e,l){let{epoch:n}=e,i=0,o=0,r=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,r=Math.floor(n/60)))},[n,i,o,r]}class j1 extends ye{constructor(e){super(),we(this,e,H1,U1,ke,{epoch:0})}}function W1(t){let e,l,n;return{c(){e=m("span"),l=$(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:se,o:se,d(i){i&&w(e)}}}function G1(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=r=>{"color"in r&&l(0,n=r.color),"title"in r&&l(1,i=r.title),"text"in r&&l(2,o=r.text)},[n,i,o]}class Yt extends ye{constructor(e){super(),we(this,e,G1,W1,ke,{color:0,title:1,text:2})}}function B1(t){let e,l=`${De(t[0].getDate())}.${De(t[0].getMonth())}.${t[0].getFullYear()} ${De(t[0].getHours())}:${De(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=$(l),u(e,"class","text-red-500")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${De(i[0].getDate())}.${De(i[0].getMonth())}.${i[0].getFullYear()} ${De(i[0].getHours())}:${De(i[0].getMinutes())}`)&&B(n,l)},d(i){i&&w(e)}}}function z1(t){let e=`${De(t[0].getDate())}. ${Us[t[0].getMonth()]} ${De(t[0].getHours())}:${De(t[0].getMinutes())}`,l;return{c(){l=$(e)},m(n,i){y(n,l,i)},p(n,i){i&1&&e!==(e=`${De(n[0].getDate())}. ${Us[n[0].getMonth()]} ${De(n[0].getHours())}:${De(n[0].getMinutes())}`)&&B(l,e)},d(n){n&&w(l)}}}function Y1(t){let e,l;function n(r,a){return a&1&&(e=null),e==null&&(e=Math.abs(new Date().getTime()-r[0].getTime())<3e5),e?z1:B1}let i=n(t,-1),o=i(t);return{c(){o.c(),l=We()},m(r,a){o.m(r,a),y(r,l,a)},p(r,[a]){i===(i=n(r,a))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},i:se,o:se,d(r){o.d(r),r&&w(l)}}}function V1(t,e,l){let{timestamp:n}=e;return t.$$set=i=>{"timestamp"in i&&l(0,n=i.timestamp)},[n]}class K1 extends ye{constructor(e){super(),we(this,e,V1,Y1,ke,{timestamp:0})}}function Q1(t){let e,l,n;return{c(){e=Oe("svg"),l=Oe("path"),n=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){y(i,e,o),s(e,l),s(e,n)},p:se,i:se,o:se,d(i){i&&w(e)}}}class Z1 extends ye{constructor(e){super(),we(this,e,null,Q1,ke,{})}}function J1(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:se,i:se,o:se,d(n){n&&w(e)}}}class X1 extends ye{constructor(e){super(),we(this,e,null,J1,ke,{})}}function x1(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:se,i:se,o:se,d(n){n&&w(e)}}}class Ft extends ye{constructor(e){super(),we(this,e,null,x1,ke,{})}}function em(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:se,i:se,o:se,d(n){n&&w(e)}}}class sc extends ye{constructor(e){super(),we(this,e,null,em,ke,{})}}function tm(t){let e,l,n=t[1].version+"",i;return{c(){e=$("AMS reader "),l=m("span"),i=$(n)},m(o,r){y(o,e,r),y(o,l,r),s(l,i)},p(o,r){r&2&&n!==(n=o[1].version+"")&&B(i,n)},d(o){o&&w(e),o&&w(l)}}}function Er(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=$(l),i=$("\xB0C"),u(e,"class","flex-none my-auto")},m(o,r){y(o,e,r),s(e,n),s(e,i)},p(o,r){r&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&B(n,l)},d(o){o&&w(e)}}}function Rr(t){let e,l="HAN: "+Tr(t[0].he),n;return{c(){e=m("div"),n=$(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Tr(i[0].he))&&B(n,l)},d(i){i&&w(e)}}}function Fr(t){let e,l="MQTT: "+Pr(t[0].me),n;return{c(){e=m("div"),n=$(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Pr(i[0].me))&&B(n,l)},d(i){i&&w(e)}}}function Lr(t){let e,l="PriceAPI: "+Mr(t[0].ee),n;return{c(){e=m("div"),n=$(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Mr(i[0].ee))&&B(n,l)},d(i){i&&w(e)}}}function Or(t){let e,l,n,i,o,r;return l=new kl({props:{to:"/configuration",$$slots:{default:[lm]},$$scope:{ctx:t}}}),o=new kl({props:{to:"/status",$$slots:{default:[nm]},$$scope:{ctx:t}}}),{c(){e=m("div"),Z(l.$$.fragment),n=v(),i=m("div"),Z(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(a,f){y(a,e,f),V(l,e,null),y(a,n,f),y(a,i,f),V(o,i,null),r=!0},i(a){r||(P(l.$$.fragment,a),P(o.$$.fragment,a),r=!0)},o(a){N(l.$$.fragment,a),N(o.$$.fragment,a),r=!1},d(a){a&&w(e),K(l),a&&w(n),a&&w(i),K(o)}}}function lm(t){let e,l;return e=new Z1({}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function nm(t){let e,l;return e=new X1({}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function qr(t){let e,l,n,i,o;const r=[sm,im],a=[];function f(c,p){return c[1].security==0||c[0].a?0:1}return l=f(t),n=a[l]=r[l](t),{c(){e=m("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(c,p){y(c,e,p),a[l].m(e,null),o=!0},p(c,p){let _=l;l=f(c),l===_?a[l].p(c,p):(Me(),N(a[_],1,1,()=>{a[_]=null}),Ae(),n=a[l],n?n.p(c,p):(n=a[l]=r[l](c),n.c()),P(n,1),n.m(e,null)),(!o||p&4&&i!==(i="New version: "+c[2].tag_name))&&u(e,"title",i)},i(c){o||(P(n),o=!0)},o(c){N(n),o=!1},d(c){c&&w(e),a[l].d()}}}function im(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=$("New version: "),i=$(n)},m(o,r){y(o,e,r),s(e,l),s(e,i)},p(o,r){r&4&&n!==(n=o[2].tag_name+"")&&B(i,n)},i:se,o:se,d(o){o&&w(e)}}}function sm(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,p;return a=new sc({}),{c(){e=m("button"),l=m("span"),n=$("New version: "),o=$(i),r=v(),Z(a.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(_,d){y(_,e,d),s(e,l),s(l,n),s(l,o),s(e,r),V(a,e,null),f=!0,c||(p=Y(e,"click",t[3]),c=!0)},p(_,d){(!f||d&4)&&i!==(i=_[2].tag_name+"")&&B(o,i)},i(_){f||(P(a.$$.fragment,_),f=!0)},o(_){N(a.$$.fragment,_),f=!1},d(_){_&&w(e),K(a),c=!1,p()}}}function om(t){let e,l,n,i,o,r,a,f,c,p,_,d,g=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",h,b,C,k,S,M,I,T,D,R,F,H,j,E,L,W,G,q,O,U,X,z,ne,te,Te,pe,Ne,Ie,Fe,Ee;i=new kl({props:{to:"/",$$slots:{default:[tm]},$$scope:{ctx:t}}}),f=new j1({props:{epoch:t[0].u}});let $e=t[0].t>-50&&Er(t);S=new Yt({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:bl(t[1].booting?2:t[0].em)}}),I=new Yt({props:{title:"HAN",text:"HAN",color:bl(t[1].booting?9:t[0].hm)}}),D=new Yt({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:bl(t[1].booting?9:t[0].wm)}}),F=new Yt({props:{title:"MQTT",text:"MQTT",color:bl(t[1].booting?9:t[0].mm)}});let ge=(t[0].he<0||t[0].he>0)&&Rr(t),_e=t[0].me<0&&Fr(t),ae=(t[0].ee>0||t[0].ee<0)&&Lr(t);ne=new K1({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0)}});let fe=t[1].vndcfg&&t[1].usrcfg&&Or(t);Ie=new Ft({});let oe=t[1].fwconsent===1&&t[2]&&qr(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),Z(i.$$.fragment),o=v(),r=m("div"),a=m("div"),Z(f.$$.fragment),c=v(),$e&&$e.c(),p=v(),_=m("div"),d=$("Free mem: "),h=$(g),b=$("kb"),C=v(),k=m("div"),Z(S.$$.fragment),M=v(),Z(I.$$.fragment),T=v(),Z(D.$$.fragment),R=v(),Z(F.$$.fragment),H=v(),ge&&ge.c(),j=v(),_e&&_e.c(),E=v(),ae&&ae.c(),L=v(),W=m("div"),G=m("div"),q=m("a"),O=m("img"),X=v(),z=m("div"),Z(ne.$$.fragment),te=v(),fe&&fe.c(),Te=v(),pe=m("div"),Ne=m("a"),Z(Ie.$$.fragment),Fe=v(),oe&&oe.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(a,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(r,"class","flex-none my-auto p-2 flex space-x-4"),u(k,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(O,"class","gh-logo"),mc(O.src,U=N1)||u(O,"src",U),u(O,"alt","GitHub repo"),u(q,"class","float-right"),u(q,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(q,"target","_blank"),u(q,"rel","noreferrer"),u(q,"aria-label","GitHub"),u(G,"class","flex-none"),u(z,"class","flex-none my-auto px-2"),u(Ne,"href",Lt("")),u(Ne,"target","_blank"),u(Ne,"rel","noreferrer"),u(pe,"class","flex-none px-1 mt-1"),u(pe,"title","Documentation"),u(W,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(J,ie){y(J,e,ie),s(e,l),s(l,n),V(i,n,null),s(l,o),s(l,r),s(r,a),V(f,a,null),s(r,c),$e&&$e.m(r,null),s(r,p),s(r,_),s(_,d),s(_,h),s(_,b),s(l,C),s(l,k),V(S,k,null),s(k,M),V(I,k,null),s(k,T),V(D,k,null),s(k,R),V(F,k,null),s(l,H),ge&&ge.m(l,null),s(l,j),_e&&_e.m(l,null),s(l,E),ae&&ae.m(l,null),s(l,L),s(l,W),s(W,G),s(G,q),s(q,O),s(W,X),s(W,z),V(ne,z,null),s(W,te),fe&&fe.m(W,null),s(W,Te),s(W,pe),s(pe,Ne),V(Ie,Ne,null),s(W,Fe),oe&&oe.m(W,null),Ee=!0},p(J,[ie]){const Ce={};ie&18&&(Ce.$$scope={dirty:ie,ctx:J}),i.$set(Ce);const x={};ie&1&&(x.epoch=J[0].u),f.$set(x),J[0].t>-50?$e?$e.p(J,ie):($e=Er(J),$e.c(),$e.m(r,p)):$e&&($e.d(1),$e=null),(!Ee||ie&1)&&g!==(g=(J[0].m?(J[0].m/1e3).toFixed(1):"-")+"")&&B(h,g);const ue={};ie&3&&(ue.text=J[1].booting?"Booting":J[0].v>2?J[0].v.toFixed(2)+"V":"ESP"),ie&3&&(ue.color=bl(J[1].booting?2:J[0].em)),S.$set(ue);const He={};ie&3&&(He.color=bl(J[1].booting?9:J[0].hm)),I.$set(He);const Se={};ie&1&&(Se.text=J[0].r?J[0].r.toFixed(0)+"dBm":"WiFi"),ie&3&&(Se.color=bl(J[1].booting?9:J[0].wm)),D.$set(Se);const de={};ie&3&&(de.color=bl(J[1].booting?9:J[0].mm)),F.$set(de),J[0].he<0||J[0].he>0?ge?ge.p(J,ie):(ge=Rr(J),ge.c(),ge.m(l,j)):ge&&(ge.d(1),ge=null),J[0].me<0?_e?_e.p(J,ie):(_e=Fr(J),_e.c(),_e.m(l,E)):_e&&(_e.d(1),_e=null),J[0].ee>0||J[0].ee<0?ae?ae.p(J,ie):(ae=Lr(J),ae.c(),ae.m(l,L)):ae&&(ae.d(1),ae=null);const ve={};ie&1&&(ve.timestamp=J[0].c?new Date(J[0].c*1e3):new Date(0)),ne.$set(ve),J[1].vndcfg&&J[1].usrcfg?fe?ie&2&&P(fe,1):(fe=Or(J),fe.c(),P(fe,1),fe.m(W,Te)):fe&&(Me(),N(fe,1,1,()=>{fe=null}),Ae()),J[1].fwconsent===1&&J[2]?oe?(oe.p(J,ie),ie&6&&P(oe,1)):(oe=qr(J),oe.c(),P(oe,1),oe.m(W,null)):oe&&(Me(),N(oe,1,1,()=>{oe=null}),Ae())},i(J){Ee||(P(i.$$.fragment,J),P(f.$$.fragment,J),P(S.$$.fragment,J),P(I.$$.fragment,J),P(D.$$.fragment,J),P(F.$$.fragment,J),P(ne.$$.fragment,J),P(fe),P(Ie.$$.fragment,J),P(oe),Ee=!0)},o(J){N(i.$$.fragment,J),N(f.$$.fragment,J),N(S.$$.fragment,J),N(I.$$.fragment,J),N(D.$$.fragment,J),N(F.$$.fragment,J),N(ne.$$.fragment,J),N(fe),N(Ie.$$.fragment,J),N(oe),Ee=!1},d(J){J&&w(e),K(i),K(f),$e&&$e.d(),K(S),K(I),K(D),K(F),ge&&ge.d(),_e&&_e.d(),ae&&ae.d(),K(ne),fe&&fe.d(),K(Ie),oe&&oe.d()}}}function um(t,e,l){let{data:n={}}=e,i={},o={};function r(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!Hn(i.board)||confirm(fs(me(i.chip,i.board))))&&(yt.update(a=>(a.upgrading=!0,a)),nc())}return yt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&D1()}),so.subscribe(a=>{l(2,o=ic(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,r]}class rm extends ye{constructor(e){super(),we(this,e,um,om,ke,{data:0})}}function am(t){let e,l,n,i;return{c(){e=Oe("svg"),l=Oe("path"),n=Oe("path"),u(l,"d",Rs(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Rs(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,r){y(o,e,r),s(e,l),s(e,n)},p(o,[r]){r&1&&i!==(i=Rs(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),r&2&&u(n,"stroke",o[1])},i:se,o:se,d(o){o&&w(e)}}}function Ur(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 Rs(t,e,l,n,i){var o=Ur(t,e,l,i),r=Ur(t,e,l,n),a=i-n<=180?"0":"1",f=["M",o.x,o.y,"A",l,l,0,a,0,r.x,r.y].join(" ");return f}function fm(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 cm extends ye{constructor(e){super(),we(this,e,fm,am,ke,{pct:0,color:1})}}function Hr(t){let e,l,n,i,o,r,a,f;return{c(){e=m("br"),l=v(),n=m("span"),i=$(t[3]),o=v(),r=m("span"),a=$(t[4]),f=$("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(c,p){y(c,e,p),y(c,l,p),y(c,n,p),s(n,i),y(c,o,p),y(c,r,p),s(r,a),s(r,f)},p(c,p){p&8&&B(i,c[3]),p&16&&B(a,c[4])},d(c){c&&w(e),c&&w(l),c&&w(n),c&&w(o),c&&w(r)}}}function mm(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C;l=new cm({props:{pct:t[6],color:t[5](t[6])}});let k=t[3]&&Hr(t);return{c(){e=m("div"),Z(l.$$.fragment),n=v(),i=m("span"),o=m("span"),r=$(t[2]),a=v(),f=m("br"),c=v(),p=m("span"),_=$(t[0]),d=v(),g=m("span"),h=$(t[1]),b=v(),k&&k.c(),u(o,"class","pl-lab"),u(p,"class","pl-val"),u(g,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(S,M){y(S,e,M),V(l,e,null),s(e,n),s(e,i),s(i,o),s(o,r),s(i,a),s(i,f),s(i,c),s(i,p),s(p,_),s(i,d),s(i,g),s(g,h),s(i,b),k&&k.m(i,null),C=!0},p(S,[M]){const I={};M&64&&(I.pct=S[6]),M&96&&(I.color=S[5](S[6])),l.$set(I),(!C||M&4)&&B(r,S[2]),(!C||M&1)&&B(_,S[0]),(!C||M&2)&&B(h,S[1]),S[3]?k?k.p(S,M):(k=Hr(S),k.c(),k.m(i,null)):k&&(k.d(1),k=null)},i(S){C||(P(l.$$.fragment,S),C=!0)},o(S){N(l.$$.fragment,S),C=!1},d(S){S&&w(e),K(l),k&&k.d()}}}function pm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:r}=e,{sub:a=""}=e,{subunit:f=""}=e,{colorFn:c}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,r=_.label),"sub"in _&&l(3,a=_.sub),"subunit"in _&&l(4,f=_.subunit),"colorFn"in _&&l(5,c=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,r,a,f,c,p,i]}class oc extends ye{constructor(e){super(),we(this,e,pm,mm,ke,{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 Wr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Gr(t,e,l){const n=t.slice();return n[13]=e[l],n}function Br(t){let e,l=t[0].title+"",n;return{c(){e=m("strong"),n=$(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 zr(t){let e,l,n,i=t[13].label+"",o,r,a,f;return{c(){e=Oe("g"),l=Oe("line"),n=Oe("text"),o=$(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",r=t[13].align=="right"?"85%":""),u(e,"class",a="tick tick-"+t[13].value+" tick-"+t[13].color),u(e,"transform",f="translate(0, "+t[6](t[13].value)+")")},m(c,p){y(c,e,p),s(e,l),s(e,n),s(n,o)},p(c,p){p&1&&i!==(i=c[13].label+"")&&B(o,i),p&1&&r!==(r=c[13].align=="right"?"85%":"")&&u(n,"x",r),p&1&&a!==(a="tick tick-"+c[13].value+" tick-"+c[13].color)&&u(e,"class",a),p&65&&f!==(f="translate(0, "+c[6](c[13].value)+")")&&u(e,"transform",f)},d(c){c&&w(e)}}}function Yr(t){let e,l,n=t[9].label+"",i,o,r;return{c(){e=Oe("g"),l=Oe("text"),i=$(n),u(l,"x",o=t[3]/2),u(l,"y","-4"),u(e,"class","tick"),u(e,"transform",r="translate("+t[5](t[11])+","+t[4]+")")},m(a,f){y(a,e,f),s(e,l),s(l,i)},p(a,f){f&1&&n!==(n=a[9].label+"")&&B(i,n),f&8&&o!==(o=a[3]/2)&&u(l,"x",o),f&48&&r!==(r="translate("+a[5](a[11])+","+a[4]+")")&&u(e,"transform",r)},d(a){a&&w(e)}}}function Vr(t){let e,l,n,i,o,r,a,f=t[3]>15&&Kr(t);return{c(){e=Oe("rect"),f&&f.c(),a=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",r=t[9].color)},m(c,p){y(c,e,p),f&&f.m(c,p),y(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&u(e,"x",l),p&65&&n!==(n=c[6](c[9].value))&&u(e,"y",n),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](Math.min(c[0].y.min,0)+c[9].value))&&u(e,"height",o),p&1&&r!==(r=c[9].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,p):(f=Kr(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&w(e),f&&f.d(c),c&&w(a)}}}function Kr(t){let e,l=t[9].label+"",n,i,o,r,a,f,c;return{c(){e=Oe("text"),n=$(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",r=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",a=t[3]<25?"left":"middle"),u(e,"fill",f=t[6](t[9].value)>t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",c="rotate("+(t[3]<25?90:0)+", "+(t[5](t[11])+t[3]/2)+", "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+9)+")")},m(p,_){y(p,e,_),s(e,n)},p(p,_){_&1&&l!==(l=p[9].label+"")&&B(n,l),_&193&&i!==(i=p[6](p[9].value)>p[6](0)-p[7]?p[6](p[9].value)-p[7]:p[6](p[9].value)+10)&&u(e,"y",i),_&40&&o!==(o=p[5](p[11])+p[3]/2)&&u(e,"x",o),_&8&&r!==(r=p[3]-4)&&u(e,"width",r),_&8&&a!==(a=p[3]<25?"left":"middle")&&u(e,"text-anchor",a),_&193&&f!==(f=p[6](p[9].value)>p[6](0)-p[7]?p[9].color:"white")&&u(e,"fill",f),_&233&&c!==(c="rotate("+(p[3]<25?90:0)+", "+(p[5](p[11])+p[3]/2)+", "+(p[6](p[9].value)>p[6](0)-p[7]?p[6](p[9].value)-p[7]:p[6](p[9].value)+9)+")")&&u(e,"transform",c)},d(p){p&&w(e)}}}function Qr(t){let e,l,n,i,o,r,a,f=t[3]>15&&Zr(t);return{c(){e=Oe("rect"),f&&f.c(),a=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",r=t[9].color)},m(c,p){y(c,e,p),f&&f.m(c,p),y(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&u(e,"x",l),p&64&&n!==(n=c[6](0))&&u(e,"y",n),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](c[0].y.min+c[9].value2))&&u(e,"height",o),p&1&&r!==(r=c[9].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,p):(f=Zr(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&w(e),f&&f.d(c),c&&w(a)}}}function Zr(t){let e,l=t[9].label2+"",n,i,o,r,a,f,c;return{c(){e=Oe("text"),n=$(l),u(e,"y",i=t[6](-t[9].value2)<t[6](0)+12?t[6](-t[9].value2)+12:t[6](-t[9].value2)-10),u(e,"x",o=t[5](t[11])+t[3]/2),u(e,"width",r=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",a=t[3]<25?"left":"middle"),u(e,"fill",f=t[6](-t[9].value2)<t[6](0)+12?t[9].color:"white"),u(e,"transform",c="rotate("+(t[3]<25?90:0)+", "+(t[5](t[11])+t[3]/2)+", "+(t[6](t[9].value2-t[0].y.min)>t[6](0)-12?t[6](t[9].value2-t[0].y.min)-12:t[6](t[9].value2-t[0].y.min)+9)+")")},m(p,_){y(p,e,_),s(e,n)},p(p,_){_&1&&l!==(l=p[9].label2+"")&&B(n,l),_&65&&i!==(i=p[6](-p[9].value2)<p[6](0)+12?p[6](-p[9].value2)+12:p[6](-p[9].value2)-10)&&u(e,"y",i),_&40&&o!==(o=p[5](p[11])+p[3]/2)&&u(e,"x",o),_&8&&r!==(r=p[3]-4)&&u(e,"width",r),_&8&&a!==(a=p[3]<25?"left":"middle")&&u(e,"text-anchor",a),_&65&&f!==(f=p[6](-p[9].value2)<p[6](0)+12?p[9].color:"white")&&u(e,"fill",f),_&105&&c!==(c="rotate("+(p[3]<25?90:0)+", "+(p[5](p[11])+p[3]/2)+", "+(p[6](p[9].value2-p[0].y.min)>p[6](0)-12?p[6](p[9].value2-p[0].y.min)-12:p[6](p[9].value2-p[0].y.min)+9)+")")&&u(e,"transform",c)},d(p){p&&w(e)}}}function Jr(t){let e,l,n=t[9].value!==void 0&&Vr(t),i=t[9].value2>1e-4&&Qr(t);return{c(){n&&n.c(),e=We(),i&&i.c(),l=We()},m(o,r){n&&n.m(o,r),y(o,e,r),i&&i.m(o,r),y(o,l,r)},p(o,r){o[9].value!==void 0?n?n.p(o,r):(n=Vr(o),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,r):(i=Qr(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 _m(t){let e,l,n,i,o,r,a,f=t[0].title&&Br(t),c=t[0].y.ticks,p=[];for(let b=0;b<c.length;b+=1)p[b]=zr(Gr(t,c,b));let _=t[0].x.ticks,d=[];for(let b=0;b<_.length;b+=1)d[b]=Yr(Wr(t,_,b));let g=t[0].points,h=[];for(let b=0;b<g.length;b+=1)h[b]=Jr(jr(t,g,b));return{c(){e=m("div"),f&&f.c(),l=v(),n=Oe("svg"),i=Oe("g");for(let b=0;b<p.length;b+=1)p[b].c();o=Oe("g");for(let b=0;b<d.length;b+=1)d[b].c();r=Oe("g");for(let b=0;b<h.length;b+=1)h[b].c();u(i,"class","axis y-axis"),u(o,"class","axis x-axis"),u(r,"class","bars"),u(n,"height",t[4]),u(e,"class","chart"),ze(()=>t[8].call(e))},m(b,C){y(b,e,C),f&&f.m(e,null),s(e,l),s(e,n),s(n,i);for(let k=0;k<p.length;k+=1)p[k].m(i,null);s(n,o);for(let k=0;k<d.length;k+=1)d[k].m(o,null);s(n,r);for(let k=0;k<h.length;k+=1)h[k].m(r,null);a=vc(e,t[8].bind(e))},p(b,[C]){if(b[0].title?f?f.p(b,C):(f=Br(b),f.c(),f.m(e,l)):f&&(f.d(1),f=null),C&65){c=b[0].y.ticks;let k;for(k=0;k<c.length;k+=1){const S=Gr(b,c,k);p[k]?p[k].p(S,C):(p[k]=zr(S),p[k].c(),p[k].m(i,null))}for(;k<p.length;k+=1)p[k].d(1);p.length=c.length}if(C&57){_=b[0].x.ticks;let k;for(k=0;k<_.length;k+=1){const S=Wr(b,_,k);d[k]?d[k].p(S,C):(d[k]=Yr(S),d[k].c(),d[k].m(o,null))}for(;k<d.length;k+=1)d[k].d(1);d.length=_.length}if(C&233){g=b[0].points;let k;for(k=0;k<g.length;k+=1){const S=jr(b,g,k);h[k]?h[k].p(S,C):(h[k]=Jr(S),h[k].c(),h[k].m(r,null))}for(;k<h.length;k+=1)h[k].d(1);h.length=g.length}C&16&&u(n,"height",b[4])},i:se,o:se,d(b){b&&w(e),f&&f.d(),Vt(p,b),Vt(d,b),Vt(h,b),a()}}}function dm(t,e,l){let{config:n}=e,i,o,r,a,f,c,p;function _(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,c=o-(n.title?20:0));let d=i-(n.padding.left+n.padding.right);l(3,r=d/n.points.length),l(7,p=r<25?28:17);let g=(c-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,a=function(h){return h*r+n.padding.left}),l(6,f=function(h){let b=0;return h>n.y.max?b=n.padding.bottom:h<n.y.min?b=c-n.padding.bottom:b=c-n.padding.bottom-(h-n.y.min)*g,b>c||b<0?0:b})}},[n,i,o,r,c,a,f,p,_]}class zl extends ye{constructor(e){super(),we(this,e,dm,_m,ke,{config:0})}}function vm(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function hm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:r}=e,a={};function f(c){return{label:be(c)+"V",value:isNaN(c)?0:c,color:S1(c||0)}}return t.$$set=c=>{"u1"in c&&l(1,n=c.u1),"u2"in c&&l(2,i=c.u2),"u3"in c&&l(3,o=c.u3),"ds"in c&&l(4,r=c.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let c=[],p=[];n>0&&(c.push({label:r===1?"L1-L2":"L1"}),p.push(f(n))),i>0&&(c.push({label:r===1?"L1-L3":"L2"}),p.push(f(i))),o>0&&(c.push({label:r===1?"L2-L3":"L3"}),p.push(f(o))),l(0,a={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:c},points:p})}},[a,n,i,o,r]}class gm extends ye{constructor(e){super(),we(this,e,hm,vm,ke,{u1:1,u2:2,u3:3,ds:4})}}function bm(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function km(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:r}=e,{i2:a}=e,{i3:f}=e,{max:c}=e,p={};function _(d){return{label:be(d)+"A",value:isNaN(d)?0:d,color:Qf(d?d/c*100:0)}}return t.$$set=d=>{"u1"in d&&l(1,n=d.u1),"u2"in d&&l(2,i=d.u2),"u3"in d&&l(3,o=d.u3),"i1"in d&&l(4,r=d.i1),"i2"in d&&l(5,a=d.i2),"i3"in d&&l(6,f=d.i3),"max"in d&&l(7,c=d.max)},t.$$.update=()=>{if(t.$$.dirty&254){let d=[],g=[];n>0&&(d.push({label:"L1"}),g.push(_(r))),i>0&&(d.push({label:"L2"}),g.push(_(a))),o>0&&(d.push({label:"L3"}),g.push(_(f))),l(0,p={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:c,ticks:[{value:0,label:"0%"},{value:c/4,label:"25%"},{value:c/2,label:"50%"},{value:c/4*3,label:"75%"},{value:c,label:"100%"}]},x:{ticks:d},points:g})}},[p,n,i,o,r,a,f,c]}class wm extends ye{constructor(e){super(),we(this,e,km,bm,ke,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function ym(t){let e,l,n,i,o,r,a,f=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",c,p,_,d,g,h,b=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",C,k,S,M,I,T,D,R=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,H,j,E,L,W,G=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",q,O;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=v(),i=m("div"),o=m("div"),o.textContent="Instant in",r=v(),a=m("div"),c=$(f),p=$(" VAr"),_=v(),d=m("div"),d.textContent="Instant out",g=v(),h=m("div"),C=$(b),k=$(" VAr"),S=v(),M=m("div"),I=m("div"),I.textContent="Total in",T=v(),D=m("div"),F=$(R),H=$(" kVArh"),j=v(),E=m("div"),E.textContent="Total out",L=v(),W=m("div"),q=$(G),O=$(" kVArh"),u(a,"class","text-right"),u(h,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(D,"class","text-right"),u(W,"class","text-right"),u(M,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(U,X){y(U,e,X),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(i,a),s(a,c),s(a,p),s(i,_),s(i,d),s(i,g),s(i,h),s(h,C),s(h,k),s(e,S),s(e,M),s(M,I),s(M,T),s(M,D),s(D,F),s(D,H),s(M,j),s(M,E),s(M,L),s(M,W),s(W,q),s(W,O)},p(U,[X]){X&1&&f!==(f=(typeof U[0]<"u"?U[0].toFixed(0):"-")+"")&&B(c,f),X&2&&b!==(b=(typeof U[1]<"u"?U[1].toFixed(0):"-")+"")&&B(C,b),X&4&&R!==(R=(typeof U[2]<"u"?U[2].toFixed(1):"-")+"")&&B(F,R),X&8&&G!==(G=(typeof U[3]<"u"?U[3].toFixed(1):"-")+"")&&B(q,G)},i:se,o:se,d(U){U&&w(e)}}}function $m(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:r}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,r=a.exportTotal)},[n,i,o,r]}class Cm extends ye{constructor(e){super(),we(this,e,$m,ym,ke,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Xr(t){let e;function l(o,r){return o[2]?Tm:Sm}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,r){i.m(o,r),y(o,e,r)},p(o,r){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&w(e)}}}function Sm(t){let e,l,n,i,o,r,a=be(t[0].h.u,2)+"",f,c,p,_,d,g,h=be(t[0].d.u,1)+"",b,C,k,S,M,I,T=be(t[0].m.u)+"",D,R,F,H,j=t[1]&&xr(t);return{c(){e=m("strong"),e.textContent="Consumption",l=v(),n=m("div"),i=m("div"),i.textContent="Hour",o=v(),r=m("div"),f=$(a),c=$(" kWh"),p=v(),_=m("div"),_.textContent="Day",d=v(),g=m("div"),b=$(h),C=$(" kWh"),k=v(),S=m("div"),S.textContent="Month",M=v(),I=m("div"),D=$(T),R=$(" kWh"),F=v(),j&&j.c(),H=We(),u(r,"class","text-right"),u(g,"class","text-right"),u(I,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(E,L){y(E,e,L),y(E,l,L),y(E,n,L),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,p),s(n,_),s(n,d),s(n,g),s(g,b),s(g,C),s(n,k),s(n,S),s(n,M),s(n,I),s(I,D),s(I,R),y(E,F,L),j&&j.m(E,L),y(E,H,L)},p(E,L){L&1&&a!==(a=be(E[0].h.u,2)+"")&&B(f,a),L&1&&h!==(h=be(E[0].d.u,1)+"")&&B(b,h),L&1&&T!==(T=be(E[0].m.u)+"")&&B(D,T),E[1]?j?j.p(E,L):(j=xr(E),j.c(),j.m(H.parentNode,H)):j&&(j.d(1),j=null)},d(E){E&&w(e),E&&w(l),E&&w(n),E&&w(F),j&&j.d(E),E&&w(H)}}}function Tm(t){let e,l,n,i,o,r,a=be(t[0].h.u,2)+"",f,c,p,_,d,g,h,b=be(t[0].d.u,1)+"",C,k,S,M,I,T,D,R=be(t[0].m.u)+"",F,H,j,E,L,W,G,q,O,U,X,z=be(t[0].h.p,2)+"",ne,te,Te,pe,Ne,Ie,Fe,Ee=be(t[0].d.p,1)+"",$e,ge,_e,ae,fe,oe,J,ie=be(t[0].m.p)+"",Ce,x,ue,He,Se=t[1]&&ea(t),de=t[1]&&ta(t),ve=t[1]&&la(t),le=t[1]&&na(t),he=t[1]&&ia(t),qe=t[1]&&sa(t);return{c(){e=m("strong"),e.textContent="Import",l=v(),n=m("div"),i=m("div"),i.textContent="Hour",o=v(),r=m("div"),f=$(a),c=$(" kWh"),p=v(),Se&&Se.c(),_=v(),d=m("div"),d.textContent="Day",g=v(),h=m("div"),C=$(b),k=$(" kWh"),S=v(),de&&de.c(),M=v(),I=m("div"),I.textContent="Month",T=v(),D=m("div"),F=$(R),H=$(" kWh"),j=v(),ve&&ve.c(),L=v(),W=m("strong"),W.textContent="Export",G=v(),q=m("div"),O=m("div"),O.textContent="Hour",U=v(),X=m("div"),ne=$(z),te=$(" kWh"),Te=v(),le&&le.c(),pe=v(),Ne=m("div"),Ne.textContent="Day",Ie=v(),Fe=m("div"),$e=$(Ee),ge=$(" kWh"),_e=v(),he&&he.c(),ae=v(),fe=m("div"),fe.textContent="Month",oe=v(),J=m("div"),Ce=$(ie),x=$(" kWh"),ue=v(),qe&&qe.c(),u(r,"class","text-right"),u(h,"class","text-right"),u(D,"class","text-right"),u(n,"class",E="grid grid-cols-"+t[3]+" mb-3"),u(X,"class","text-right"),u(Fe,"class","text-right"),u(J,"class","text-right"),u(q,"class",He="grid grid-cols-"+t[3])},m(re,Pe){y(re,e,Pe),y(re,l,Pe),y(re,n,Pe),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,p),Se&&Se.m(n,null),s(n,_),s(n,d),s(n,g),s(n,h),s(h,C),s(h,k),s(n,S),de&&de.m(n,null),s(n,M),s(n,I),s(n,T),s(n,D),s(D,F),s(D,H),s(n,j),ve&&ve.m(n,null),y(re,L,Pe),y(re,W,Pe),y(re,G,Pe),y(re,q,Pe),s(q,O),s(q,U),s(q,X),s(X,ne),s(X,te),s(q,Te),le&&le.m(q,null),s(q,pe),s(q,Ne),s(q,Ie),s(q,Fe),s(Fe,$e),s(Fe,ge),s(q,_e),he&&he.m(q,null),s(q,ae),s(q,fe),s(q,oe),s(q,J),s(J,Ce),s(J,x),s(q,ue),qe&&qe.m(q,null)},p(re,Pe){Pe&1&&a!==(a=be(re[0].h.u,2)+"")&&B(f,a),re[1]?Se?Se.p(re,Pe):(Se=ea(re),Se.c(),Se.m(n,_)):Se&&(Se.d(1),Se=null),Pe&1&&b!==(b=be(re[0].d.u,1)+"")&&B(C,b),re[1]?de?de.p(re,Pe):(de=ta(re),de.c(),de.m(n,M)):de&&(de.d(1),de=null),Pe&1&&R!==(R=be(re[0].m.u)+"")&&B(F,R),re[1]?ve?ve.p(re,Pe):(ve=la(re),ve.c(),ve.m(n,null)):ve&&(ve.d(1),ve=null),Pe&8&&E!==(E="grid grid-cols-"+re[3]+" mb-3")&&u(n,"class",E),Pe&1&&z!==(z=be(re[0].h.p,2)+"")&&B(ne,z),re[1]?le?le.p(re,Pe):(le=na(re),le.c(),le.m(q,pe)):le&&(le.d(1),le=null),Pe&1&&Ee!==(Ee=be(re[0].d.p,1)+"")&&B($e,Ee),re[1]?he?he.p(re,Pe):(he=ia(re),he.c(),he.m(q,ae)):he&&(he.d(1),he=null),Pe&1&&ie!==(ie=be(re[0].m.p)+"")&&B(Ce,ie),re[1]?qe?qe.p(re,Pe):(qe=sa(re),qe.c(),qe.m(q,null)):qe&&(qe.d(1),qe=null),Pe&8&&He!==(He="grid grid-cols-"+re[3])&&u(q,"class",He)},d(re){re&&w(e),re&&w(l),re&&w(n),Se&&Se.d(),de&&de.d(),ve&&ve.d(),re&&w(L),re&&w(W),re&&w(G),re&&w(q),le&&le.d(),he&&he.d(),qe&&qe.d()}}}function xr(t){let e,l,n,i,o,r,a=be(t[0].h.c,2)+"",f,c,p,_,d,g,h,b=be(t[0].d.c,1)+"",C,k,S,M,I,T,D,R=be(t[0].m.c)+"",F,H,j;return{c(){e=m("strong"),e.textContent="Cost",l=v(),n=m("div"),i=m("div"),i.textContent="Hour",o=v(),r=m("div"),f=$(a),c=v(),p=$(t[1]),_=v(),d=m("div"),d.textContent="Day",g=v(),h=m("div"),C=$(b),k=v(),S=$(t[1]),M=v(),I=m("div"),I.textContent="Month",T=v(),D=m("div"),F=$(R),H=v(),j=$(t[1]),u(r,"class","text-right"),u(h,"class","text-right"),u(D,"class","text-right"),u(n,"class","grid grid-cols-2")},m(E,L){y(E,e,L),y(E,l,L),y(E,n,L),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(r,p),s(n,_),s(n,d),s(n,g),s(n,h),s(h,C),s(h,k),s(h,S),s(n,M),s(n,I),s(n,T),s(n,D),s(D,F),s(D,H),s(D,j)},p(E,L){L&1&&a!==(a=be(E[0].h.c,2)+"")&&B(f,a),L&2&&B(p,E[1]),L&1&&b!==(b=be(E[0].d.c,1)+"")&&B(C,b),L&2&&B(S,E[1]),L&1&&R!==(R=be(E[0].m.c)+"")&&B(F,R),L&2&&B(j,E[1])},d(E){E&&w(e),E&&w(l),E&&w(n)}}}function ea(t){let e,l=be(t[0].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=v(),o=$(t[1]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=be(r[0].h.c,2)+"")&&B(n,l),a&2&&B(o,r[1])},d(r){r&&w(e)}}}function ta(t){let e,l=be(t[0].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=v(),o=$(t[1]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=be(r[0].d.c,1)+"")&&B(n,l),a&2&&B(o,r[1])},d(r){r&&w(e)}}}function la(t){let e,l=be(t[0].m.c)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=v(),o=$(t[1]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=be(r[0].m.c)+"")&&B(n,l),a&2&&B(o,r[1])},d(r){r&&w(e)}}}function na(t){let e,l=be(t[0].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=v(),o=$(t[1]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=be(r[0].h.i,2)+"")&&B(n,l),a&2&&B(o,r[1])},d(r){r&&w(e)}}}function ia(t){let e,l=be(t[0].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=v(),o=$(t[1]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=be(r[0].d.i,1)+"")&&B(n,l),a&2&&B(o,r[1])},d(r){r&&w(e)}}}function sa(t){let e,l=be(t[0].m.i)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=v(),o=$(t[1]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=be(r[0].m.i)+"")&&B(n,l),a&2&&B(o,r[1])},d(r){r&&w(e)}}}function Pm(t){let e,l,n,i,o,r,a=t[0]&&Xr(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=v(),i=m("br"),o=m("br"),r=v(),a&&a.c(),u(e,"class","mx-2 text-sm")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),s(e,r),a&&a.m(e,null)},p(f,[c]){f[0]?a?a.p(f,c):(a=Xr(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:se,o:se,d(f){f&&w(e),a&&a.d()}}}function Mm(t,e,l){let{data:n}=e,{currency:i}=e,{hasExport:o}=e,r=3;return t.$$set=a=>{"data"in a&&l(0,n=a.data),"currency"in a&&l(1,i=a.currency),"hasExport"in a&&l(2,o=a.hasExport)},t.$$.update=()=>{t.$$.dirty&2&&l(3,r=i?3:2)},[n,i,o,r]}class Am extends ye{constructor(e){super(),we(this,e,Mm,Pm,ke,{data:0,currency:1,hasExport:2})}}function Dm(t){let e,l,n,i;return n=new zl({props:{config:t[0]}}),{c(){e=m("a"),e.textContent="Provided by ENTSO-E",l=v(),Z(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,r){y(o,e,r),y(o,l,r),V(n,o,r),i=!0},p(o,[r]){const a={};r&1&&(a.config=o[0]),n.$set(a)},i(o){i||(P(n.$$.fragment,o),i=!0)},o(o){N(n.$$.fragment,o),i=!1},d(o){o&&w(e),o&&w(l),K(n,o)}}}function Nm(t,e,l){let{json:n}=e,i={},o=0,r=0;return t.$$set=a=>{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=new Date().getUTCHours(),f=0,c=0,p=0,_=n[20]==null?2:1,d=[],g=[],h=[],b=new Date;for(f=a;f<24&&(c=n[De(p++)],c!=null);f++)g.push({label:De(b.getHours())}),h.push({label:c>0?c.toFixed(_):"",value:c>0?Math.abs(c*100):0,label2:c<0?c.toFixed(_):"",value2:c<0?Math.abs(c*100):0,color:"#7c3aed"}),l(3,r=Math.min(r,c*100)),l(2,o=Math.max(o,c*100)),ii(b,1);for(f=0;f<24&&(c=n[De(p++)],c!=null);f++)g.push({label:De(b.getHours())}),h.push({label:c>0?c.toFixed(_):"",value:c>0?Math.abs(c*100):0,label2:c<0?c.toFixed(_):"",value2:c<0?Math.abs(c*100):0,color:"#7c3aed"}),l(3,r=Math.min(r,c*100)),l(2,o=Math.max(o,c*100)),ii(b,1);if(l(2,o=Math.ceil(o)),l(3,r=Math.floor(r)),r<0){let k=r/4;for(f=1;f<5;f++){let S=k*f;d.push({value:S,label:(S/100).toFixed(2)})}}let C=o/4;for(f=0;f<5;f++){let k=C*f;d.push({value:k,label:(k/100).toFixed(2)})}l(0,i={title:"Future energy price ("+n.currency+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:r,max:o,ticks:d},x:{ticks:g},points:h})}},[i,n,o,r]}class Im extends ye{constructor(e){super(),we(this,e,Nm,Dm,ke,{json:1})}}function Em(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Rm(t,e,l){let{json:n}=e,i={},o=0,r=0;return t.$$set=a=>{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,f=[],c=[],p=[],_=ii(new Date,-24),d=new Date().getUTCHours();for(a=d;a<24;a++){let b=n["i"+De(a)],C=n["e"+De(a)];b===void 0&&(b=0),C===void 0&&(C=0),c.push({label:De(_.getHours())}),p.push({label:b.toFixed(1),value:b*10,label2:C.toFixed(1),value2:C*10,color:"#7c3aed"}),l(3,r=Math.max(r,C*10)),l(2,o=Math.max(o,b*10)),ii(_,1)}for(a=0;a<d;a++){let b=n["i"+De(a)],C=n["e"+De(a)];b===void 0&&(b=0),C===void 0&&(C=0),c.push({label:De(_.getHours())}),p.push({label:b.toFixed(1),value:b*10,label2:C.toFixed(1),value2:C*10,color:"#7c3aed"}),l(3,r=Math.max(r,C*10)),l(2,o=Math.max(o,b*10)),ii(_,1)}let g=Math.ceil(Math.max(r,o));if(l(2,o=g),l(3,r=r==0?0:g*-1),r<0){let b=r/4;for(a=1;a<5;a++){let C=b*a;f.push({value:C,label:(C/10).toFixed(1)})}}let h=o/4;for(a=0;a<5;a++){let b=h*a;f.push({value:b,label:(b/10).toFixed(1)})}l(0,i={title:"Energy use last 24 hours (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:r,max:o,ticks:f},x:{ticks:c},points:p})}},[i,n,o,r]}class Fm extends ye{constructor(e){super(),we(this,e,Rm,Em,ke,{json:1})}}function Lm(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Om(t,e,l){let{json:n}=e,i={},o=0,r=0;return t.$$set=a=>{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,f=[],c=[],p=[],_=new Date,d=new Date;for(d.setDate(0),a=_.getDate();a<=d.getDate();a++){let b=n["i"+De(a)],C=n["e"+De(a)];b===void 0&&(b=0),C===void 0&&(C=0),c.push({label:De(a)}),p.push({label:b.toFixed(0),value:b,label2:C.toFixed(0),value2:C,color:"#7c3aed"}),l(3,r=Math.max(r,C)),l(2,o=Math.max(o,b))}for(a=1;a<_.getDate();a++){let b=n["i"+De(a)],C=n["e"+De(a)];b===void 0&&(b=0),C===void 0&&(C=0),c.push({label:De(a)}),p.push({label:b.toFixed(0),value:b,label2:C.toFixed(0),value2:C,color:"#7c3aed"}),l(3,r=Math.max(r,C)),l(2,o=Math.max(o,b))}let g=Math.ceil(Math.max(r,o)/10)*10;if(l(2,o=g),l(3,r=r==0?0:g*-1),r<0){let b=r/4;for(a=0;a<5;a++){let C=b*a;f.push({value:C,label:C.toFixed(0)})}}let h=o/4;for(a=0;a<5;a++){let b=h*a;f.push({value:b,label:b.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:r,max:o,ticks:f},x:{ticks:c},points:p})}},[i,n,o,r]}class qm extends ye{constructor(e){super(),we(this,e,Om,Lm,ke,{json:1})}}function Um(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Hm(t,e,l){let{json:n}=e,i={},o=0,r=0;return t.$$set=a=>{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,f=0,c=[],p=[],_=[];n.s&&n.s.forEach((h,b)=>{var C=h.n?h.n:h.a;f=h.v,f==-127&&(f=0),p.push({label:C.slice(-4)}),_.push({label:f.toFixed(1),value:f,color:"#7c3aed"}),l(3,r=Math.min(r,f)),l(2,o=Math.max(o,f))}),l(2,o=Math.ceil(o)),l(3,r=Math.floor(r));let d=o;r<0&&(d+=Math.abs(r));let g=d/4;for(a=0;a<5;a++)f=r+g*a,c.push({value:f,label:f.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:r,max:o,ticks:c},x:{ticks:p},points:_})}},[i,n,o,r]}class jm extends ye{constructor(e){super(),we(this,e,Hm,Um,ke,{json:1})}}function Wm(t){let e,l;return e=new zl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}let Gm=0;function Bm(t,e,l){let n={},i=0,o;return lc.subscribe(r=>{l(2,o=r)}),tc(),t.$$.update=()=>{if(t.$$.dirty&6){let r=0,a=[],f=[],c=[];if(a.push({value:0,label:0}),o&&o.p)for(r=0;r<o.p.length;r++){let p=o.p[r];c.push({label:p.v.toFixed(2),value:p.v,color:"#7c3aed"}),f.push({label:p.d>0?De(p.d)+"."+Us[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,p.v))}if(o&&o.t){for(r=0;r<o.t.length;r++){let p=o.t[r];if(p>=i)break;a.push({value:p,label:p})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Gm,max:i,ticks:a},x:{ticks:f},points:c})}},[n,i,o]}class zm extends ye{constructor(e){super(),we(this,e,Bm,Wm,ke,{})}}function oa(t){let e,l,n,i,o,r,a=(t[0].mt?as(t[0].mt):"-")+"",f,c,p,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",d,g,h;return i=new oc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[2].currency,colorFn:Qf}}),{c(){e=m("div"),l=m("div"),n=m("div"),Z(i.$$.fragment),o=v(),r=m("div"),f=$(a),c=v(),p=m("div"),d=$(_),g=$(" kWh"),u(n,"class","col-span-2"),u(p,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(b,C){y(b,e,C),s(e,l),s(l,n),V(i,n,null),s(l,o),s(l,r),s(r,f),s(l,c),s(l,p),s(p,d),s(p,g),h=!0},p(b,C){const k={};C&1&&(k.val=b[0].i?b[0].i:0),C&1&&(k.max=b[0].im?b[0].im:15e3),C&1&&(k.sub=b[0].p),C&4&&(k.subunit=b[2].currency),i.$set(k),(!h||C&1)&&a!==(a=(b[0].mt?as(b[0].mt):"-")+"")&&B(f,a),(!h||C&1)&&_!==(_=(b[0].ic?b[0].ic.toFixed(1):"-")+"")&&B(d,_)},i(b){h||(P(i.$$.fragment,b),h=!0)},o(b){N(i.$$.fragment,b),h=!1},d(b){b&&w(e),K(i)}}}function ua(t){let e,l,n,i,o,r,a,f,c=(t[0].ec?t[0].ec.toFixed(1):"-")+"",p,_,d;return i=new oc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:T1}}),{c(){e=m("div"),l=m("div"),n=m("div"),Z(i.$$.fragment),o=v(),r=m("div"),a=v(),f=m("div"),p=$(c),_=$(" kWh"),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,h){y(g,e,h),s(e,l),s(l,n),V(i,n,null),s(l,o),s(l,r),s(l,a),s(l,f),s(f,p),s(f,_),d=!0},p(g,h){const b={};h&1&&(b.val=g[0].e?g[0].e:0),h&1&&(b.max=g[0].om?g[0].om*1e3:1e4),i.$set(b),(!d||h&1)&&c!==(c=(g[0].ec?g[0].ec.toFixed(1):"-")+"")&&B(p,c)},i(g){d||(P(i.$$.fragment,g),d=!0)},o(g){N(i.$$.fragment,g),d=!1},d(g){g&&w(e),K(i)}}}function ra(t){let e,l,n;return l=new gm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.ds=i[0].ds),l.$set(r)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){N(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function aa(t){let e,l,n;return l=new wm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.i1=i[0].i1),o&1&&(r.i2=i[0].i2),o&1&&(r.i3=i[0].i3),o&1&&(r.max=i[0].mf?i[0].mf:32),l.$set(r)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){N(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function fa(t){let e,l,n;return l=new Cm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.importInstant=i[0].ri),o&1&&(r.exportInstant=i[0].re),o&1&&(r.importTotal=i[0].ric),o&1&&(r.exportTotal=i[0].rec),l.$set(r)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){N(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function ca(t){let e,l,n;return l=new Am({props:{data:t[0].ea,currency:t[2].currency,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.data=i[0].ea),o&4&&(r.currency=i[2].currency),o&1&&(r.hasExport=i[0].om>0||i[0].e>0),l.$set(r)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){N(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function ma(t){let e,l,n;return l=new zm({}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){y(i,e,o),V(l,e,null),n=!0},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){N(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function pa(t){let e,l,n;return l=new Im({props:{json:t[2]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const r={};o&4&&(r.json=i[2]),l.$set(r)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){N(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function _a(t){let e,l,n;return l=new Fm({props:{json:t[3]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const r={};o&8&&(r.json=i[3]),l.$set(r)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){N(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function da(t){let e,l,n;return l=new qm({props:{json:t[4]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const r={};o&16&&(r.json=i[4]),l.$set(r)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){N(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function va(t){let e,l,n;return l=new jm({props:{json:t[5]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),V(l,e,null),n=!0},p(i,o){const r={};o&32&&(r.json=i[5]),l.$set(r)},i(i){n||(P(l.$$.fragment,i),n=!0)},o(i){N(l.$$.fragment,i),n=!1},d(i){i&&w(e),K(l)}}}function Ym(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,r=je(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,f=je(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),c,p=je(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,d=je(t[1].ui.c,t[0].ea),g,h=je(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),b,C=je(t[1].ui.p,typeof t[0].p=="number"&&!Number.isNaN(t[0].p)),k,S=je(t[1].ui.d,t[3]),M,I=je(t[1].ui.m,t[4]),T,D=je(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),R,F=l&&oa(t),H=i&&ua(t),j=r&&ra(t),E=f&&aa(t),L=p&&fa(t),W=d&&ca(t),G=h&&ma(),q=C&&pa(t),O=S&&_a(t),U=I&&da(t),X=D&&va(t);return{c(){e=m("div"),F&&F.c(),n=v(),H&&H.c(),o=v(),j&&j.c(),a=v(),E&&E.c(),c=v(),L&&L.c(),_=v(),W&&W.c(),g=v(),G&&G.c(),b=v(),q&&q.c(),k=v(),O&&O.c(),M=v(),U&&U.c(),T=v(),X&&X.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(z,ne){y(z,e,ne),F&&F.m(e,null),s(e,n),H&&H.m(e,null),s(e,o),j&&j.m(e,null),s(e,a),E&&E.m(e,null),s(e,c),L&&L.m(e,null),s(e,_),W&&W.m(e,null),s(e,g),G&&G.m(e,null),s(e,b),q&&q.m(e,null),s(e,k),O&&O.m(e,null),s(e,M),U&&U.m(e,null),s(e,T),X&&X.m(e,null),R=!0},p(z,[ne]){ne&3&&(l=je(z[1].ui.i,z[0].i)),l?F?(F.p(z,ne),ne&3&&P(F,1)):(F=oa(z),F.c(),P(F,1),F.m(e,n)):F&&(Me(),N(F,1,1,()=>{F=null}),Ae()),ne&3&&(i=je(z[1].ui.e,z[0].om||z[0].e>0)),i?H?(H.p(z,ne),ne&3&&P(H,1)):(H=ua(z),H.c(),P(H,1),H.m(e,o)):H&&(Me(),N(H,1,1,()=>{H=null}),Ae()),ne&3&&(r=je(z[1].ui.v,z[0].u1>100||z[0].u2>100||z[0].u3>100)),r?j?(j.p(z,ne),ne&3&&P(j,1)):(j=ra(z),j.c(),P(j,1),j.m(e,a)):j&&(Me(),N(j,1,1,()=>{j=null}),Ae()),ne&3&&(f=je(z[1].ui.a,z[0].i1>.01||z[0].i2>.01||z[0].i3>.01)),f?E?(E.p(z,ne),ne&3&&P(E,1)):(E=aa(z),E.c(),P(E,1),E.m(e,c)):E&&(Me(),N(E,1,1,()=>{E=null}),Ae()),ne&3&&(p=je(z[1].ui.r,z[0].ri>0||z[0].re>0||z[0].ric>0||z[0].rec>0)),p?L?(L.p(z,ne),ne&3&&P(L,1)):(L=fa(z),L.c(),P(L,1),L.m(e,_)):L&&(Me(),N(L,1,1,()=>{L=null}),Ae()),ne&3&&(d=je(z[1].ui.c,z[0].ea)),d?W?(W.p(z,ne),ne&3&&P(W,1)):(W=ca(z),W.c(),P(W,1),W.m(e,g)):W&&(Me(),N(W,1,1,()=>{W=null}),Ae()),ne&3&&(h=je(z[1].ui.t,z[0].pr&&(z[0].pr.startsWith("10YNO")||z[0].pr=="10Y1001A1001A48H"))),h?G?ne&3&&P(G,1):(G=ma(),G.c(),P(G,1),G.m(e,b)):G&&(Me(),N(G,1,1,()=>{G=null}),Ae()),ne&3&&(C=je(z[1].ui.p,typeof z[0].p=="number"&&!Number.isNaN(z[0].p))),C?q?(q.p(z,ne),ne&3&&P(q,1)):(q=pa(z),q.c(),P(q,1),q.m(e,k)):q&&(Me(),N(q,1,1,()=>{q=null}),Ae()),ne&10&&(S=je(z[1].ui.d,z[3])),S?O?(O.p(z,ne),ne&10&&P(O,1)):(O=_a(z),O.c(),P(O,1),O.m(e,M)):O&&(Me(),N(O,1,1,()=>{O=null}),Ae()),ne&18&&(I=je(z[1].ui.m,z[4])),I?U?(U.p(z,ne),ne&18&&P(U,1)):(U=da(z),U.c(),P(U,1),U.m(e,T)):U&&(Me(),N(U,1,1,()=>{U=null}),Ae()),ne&35&&(D=je(z[1].ui.s,z[0].t&&z[0].t!=-127&&z[5].c>1)),D?X?(X.p(z,ne),ne&35&&P(X,1)):(X=va(z),X.c(),P(X,1),X.m(e,null)):X&&(Me(),N(X,1,1,()=>{X=null}),Ae())},i(z){R||(P(F),P(H),P(j),P(E),P(L),P(W),P(G),P(q),P(O),P(U),P(X),R=!0)},o(z){N(F),N(H),N(j),N(E),N(L),N(W),N(G),N(q),N(O),N(U),N(X),R=!1},d(z){z&&w(e),F&&F.d(),H&&H.d(),j&&j.d(),E&&E.d(),L&&L.d(),W&&W.d(),G&&G.d(),q&&q.d(),O&&O.d(),U&&U.d(),X&&X.d()}}}function Vm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},r={},a={},f={};return Zf.subscribe(c=>{l(2,o=c)}),Jf.subscribe(c=>{l(3,r=c)}),Xf.subscribe(c=>{l(4,a=c)}),ec.subscribe(c=>{l(5,f=c)}),t.$$set=c=>{"data"in c&&l(0,n=c.data),"sysinfo"in c&&l(1,i=c.sysinfo)},[n,i,o,r,a,f]}class Km extends ye{constructor(e){super(),we(this,e,Vm,Ym,ke,{data:0,sysinfo:1})}}let Ys={};const uc=Ze(Ys);async function Qm(){Ys=await(await fetch("/configuration.json")).json(),uc.set(Ys)}function ha(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function ga(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function ba(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=v(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){y(i,e,o),y(i,l,o),y(i,n,o)},d(i){i&&w(e),i&&w(l),i&&w(n)}}}function ka(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function wa(t){let e,l,n;return{c(){e=m("option"),l=$("GPIO"),n=$(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){y(i,e,o),s(e,l),s(e,n)},d(i){i&&w(e)}}}function ya(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))&&wa(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,i){n[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=wa(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&w(e)}}}function Zm(t){let e,l,n,i,o,r,a=t[0]=="esp8266"&&ga(),f=(t[0]=="esp32"||t[0]=="esp32solo")&&ba(),c=t[0]=="esp32s2"&&ka(),p={length:t[1]+1},_=[];for(let d=0;d<p.length;d+=1)_[d]=ya(ha(t,p,d));return{c(){e=m("option"),e.textContent="UART0",l=v(),a&&a.c(),n=v(),f&&f.c(),i=v(),c&&c.c(),o=v();for(let d=0;d<_.length;d+=1)_[d].c();r=We(),e.__value=3,e.value=e.__value},m(d,g){y(d,e,g),y(d,l,g),a&&a.m(d,g),y(d,n,g),f&&f.m(d,g),y(d,i,g),c&&c.m(d,g),y(d,o,g);for(let h=0;h<_.length;h+=1)_[h].m(d,g);y(d,r,g)},p(d,[g]){if(d[0]=="esp8266"?a||(a=ga(),a.c(),a.m(n.parentNode,n)):a&&(a.d(1),a=null),d[0]=="esp32"||d[0]=="esp32solo"?f||(f=ba(),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),d[0]=="esp32s2"?c||(c=ka(),c.c(),c.m(o.parentNode,o)):c&&(c.d(1),c=null),g&3){p={length:d[1]+1};let h;for(h=0;h<p.length;h+=1){const b=ha(d,p,h);_[h]?_[h].p(b,g):(_[h]=ya(b),_[h].c(),_[h].m(r.parentNode,r))}for(;h<_.length;h+=1)_[h].d(1);_.length=p.length}},i:se,o:se,d(d){d&&w(e),d&&w(l),a&&a.d(d),d&&w(n),f&&f.d(d),d&&w(i),c&&c.d(d),d&&w(o),Vt(_,d),d&&w(r)}}}function Jm(t,e,l){let{chip:n}=e,i=44;return t.$$set=o=>{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{t.$$.dirty&1&&l(1,i=n=="esp8266"?16:n=="esp32s2"?44:39)},[n,i]}class rc extends ye{constructor(e){super(),we(this,e,Jm,Zm,ke,{chip:0})}}function $a(t){let e,l,n=t[1]&&Ca(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){y(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Ca(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&w(e),n&&n.d()}}}function Ca(t){let e,l;return{c(){e=m("div"),l=$(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 Xm(t){let e,l=t[0]&&$a(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=$a(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:se,o:se,d(n){l&&l.d(n),n&&w(e)}}}function xm(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class gt extends ye{constructor(e){super(),we(this,e,xm,Xm,ke,{active:0,message:1})}}function Sa(t,e,l){const n=t.slice();return n[1]=e[l],n}function Ta(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=$("Europe/"),i=$(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,r){y(o,e,r),s(e,l),s(e,i)},p:se,d(o){o&&w(e)}}}function ep(t){let e,l,n,i=t[0],o=[];for(let r=0;r<i.length;r+=1)o[r]=Ta(Sa(t,i,r));return{c(){e=m("option"),e.textContent="GMT",l=v();for(let r=0;r<o.length;r+=1)o[r].c();n=We(),e.__value="GMT",e.value=e.__value},m(r,a){y(r,e,a),y(r,l,a);for(let f=0;f<o.length;f+=1)o[f].m(r,a);y(r,n,a)},p(r,[a]){if(a&1){i=r[0];let f;for(f=0;f<i.length;f+=1){const c=Sa(r,i,f);o[f]?o[f].p(c,a):(o[f]=Ta(c),o[f].c(),o[f].m(n.parentNode,n))}for(;f<o.length;f+=1)o[f].d(1);o.length=i.length}},i:se,o:se,d(r){r&&w(e),r&&w(l),Vt(o,r),r&&w(n)}}}function tp(t){return[["Amsterdam","Athens","Belfast","Berlin","Bratislava","Brussels","Bucharest","Budapest","Copenhagen","Dublin","Helsinki","Lisbon","Ljubljana","London","Luxembourg","Madrid","Malta","Nicosia","Oslo","Paris","Prague","Riga","Rome","Sofia","Stockholm","Tallinn","Vienna","Vilnius","Warsaw","Zagreb","Zurich"]]}class lp extends ye{constructor(e){super(),we(this,e,tp,ep,ke,{})}}function np(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h;return{c(){e=m("optgroup"),l=m("option"),l.textContent="/24",n=v(),i=m("optgroup"),o=m("option"),o.textContent="/25",r=m("option"),r.textContent="/26",a=m("option"),a.textContent="/27",f=m("option"),f.textContent="/28",c=m("option"),c.textContent="/29",p=v(),_=m("optgroup"),d=m("option"),d.textContent="/23",g=m("option"),g.textContent="/22",h=m("option"),h.textContent="/16",l.__value="255.255.255.0",l.value=l.__value,u(e,"label","Most common is /24 (255.255.255.0)"),o.__value="255.255.255.128",o.value=o.__value,r.__value="255.255.255.192",r.value=r.__value,a.__value="255.255.255.224",a.value=a.__value,f.__value="255.255.255.240",f.value=f.__value,c.__value="255.255.255.248",c.value=c.__value,u(i,"label","Smaller subnets"),d.__value="255.255.254.0",d.value=d.__value,g.__value="255.255.252.0",g.value=g.__value,h.__value="255.255.0.0",h.value=h.__value,u(_,"label","Larger subnets")},m(b,C){y(b,e,C),s(e,l),y(b,n,C),y(b,i,C),s(i,o),s(i,r),s(i,a),s(i,f),s(i,c),y(b,p,C),y(b,_,C),s(_,d),s(_,g),s(_,h)},p:se,i:se,o:se,d(b){b&&w(e),b&&w(n),b&&w(i),b&&w(p),b&&w(_)}}}class ac extends ye{constructor(e){super(),we(this,e,null,np,ke,{})}}function Pa(t,e,l){const n=t.slice();return n[85]=e[l],n[86]=e,n[87]=l,n}function Ma(t,e,l){const n=t.slice();return n[88]=e[l],n[89]=e,n[90]=l,n}function ip(t,e,l){const n=t.slice();return n[91]=e[l],n}function sp(t,e,l){const n=t.slice();return n[94]=e[l],n}function op(t){let e,l;return{c(){e=m("option"),l=$(t[94]),e.__value=t[94],e.value=e.__value},m(n,i){y(n,e,i),s(e,l)},p:se,d(n){n&&w(e)}}}function Aa(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),u(l,"name","pt"),u(l,"type","text"),u(l,"class","in-s"),u(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,r){y(o,e,r),y(o,l,r),Q(l,t[3].p.t),n||(i=Y(l,"input",t[18]),n=!0)},p(o,r){r[0]&8&&l.value!==o[3].p.t&&Q(l,o[3].p.t)},d(o){o&&w(e),o&&w(l),n=!1,i()}}}function Da(t){let e,l,n,i,o,r,a,f,c,p,_,d,g;return{c(){e=m("div"),l=$("Username"),n=m("br"),i=v(),o=m("input"),r=v(),a=m("div"),f=$("Password"),c=m("br"),p=v(),_=m("input"),u(o,"name","gu"),u(o,"type","text"),u(o,"class","in-s"),u(e,"class","my-1"),u(_,"name","gp"),u(_,"type","password"),u(_,"class","in-s"),u(a,"class","my-1")},m(h,b){y(h,e,b),s(e,l),s(e,n),s(e,i),s(e,o),Q(o,t[3].g.u),y(h,r,b),y(h,a,b),s(a,f),s(a,c),s(a,p),s(a,_),Q(_,t[3].g.p),d||(g=[Y(o,"input",t[20]),Y(_,"input",t[21])],d=!0)},p(h,b){b[0]&8&&o.value!==h[3].g.u&&Q(o,h[3].g.u),b[0]&8&&_.value!==h[3].g.p&&Q(_,h[3].g.p)},d(h){h&&w(e),h&&w(r),h&&w(a),d=!1,Be(g)}}}function up(t){let e,l=t[91]*100+"",n;return{c(){e=m("option"),n=$(l),e.__value=t[91]*100,e.value=e.__value},m(i,o){y(i,e,o),s(e,n)},p:se,d(i){i&&w(e)}}}function Na(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),u(l,"name","mek"),u(l,"type","text"),u(l,"class","in-s")},m(o,r){y(o,e,r),y(o,l,r),Q(l,t[3].m.e.k),n||(i=Y(l,"input",t[29]),n=!0)},p(o,r){r[0]&8&&l.value!==o[3].m.e.k&&Q(l,o[3].m.e.k)},d(o){o&&w(e),o&&w(l),n=!1,i()}}}function Ia(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=$("Authentication key"),n=m("br"),i=v(),o=m("input"),u(o,"name","mea"),u(o,"type","text"),u(o,"class","in-s"),u(e,"class","my-1")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),Q(o,t[3].m.e.a),r||(a=Y(o,"input",t[30]),r=!0)},p(f,c){c[0]&8&&o.value!==f[3].m.e.a&&Q(o,f[3].m.e.a)},d(f){f&&w(e),r=!1,a()}}}function Ea(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C,k,S,M,I,T,D,R,F,H,j;return{c(){e=m("div"),l=m("div"),n=$("Watt"),i=m("br"),o=v(),r=m("input"),a=v(),f=m("div"),c=$("Volt"),p=m("br"),_=v(),d=m("input"),g=v(),h=m("div"),b=$("Amp"),C=m("br"),k=v(),S=m("input"),M=v(),I=m("div"),T=$("kWh"),D=m("br"),R=v(),F=m("input"),u(r,"name","mmw"),u(r,"type","number"),u(r,"min","0.00"),u(r,"max","655.35"),u(r,"step","0.01"),u(r,"class","in-f tr w-full"),u(l,"class","w-1/4"),u(d,"name","mmv"),u(d,"type","number"),u(d,"min","0.00"),u(d,"max","655.35"),u(d,"step","0.01"),u(d,"class","in-m tr w-full"),u(f,"class","w-1/4"),u(S,"name","mma"),u(S,"type","number"),u(S,"min","0.00"),u(S,"max","655.35"),u(S,"step","0.01"),u(S,"class","in-m tr w-full"),u(h,"class","w-1/4"),u(F,"name","mmc"),u(F,"type","number"),u(F,"min","0.00"),u(F,"max","655.35"),u(F,"step","0.01"),u(F,"class","in-l tr w-full"),u(I,"class","w-1/4"),u(e,"class","flex my-1")},m(E,L){y(E,e,L),s(e,l),s(l,n),s(l,i),s(l,o),s(l,r),Q(r,t[3].m.m.w),s(e,a),s(e,f),s(f,c),s(f,p),s(f,_),s(f,d),Q(d,t[3].m.m.v),s(e,g),s(e,h),s(h,b),s(h,C),s(h,k),s(h,S),Q(S,t[3].m.m.a),s(e,M),s(e,I),s(I,T),s(I,D),s(I,R),s(I,F),Q(F,t[3].m.m.c),H||(j=[Y(r,"input",t[32]),Y(d,"input",t[33]),Y(S,"input",t[34]),Y(F,"input",t[35])],H=!0)},p(E,L){L[0]&8&&ce(r.value)!==E[3].m.m.w&&Q(r,E[3].m.m.w),L[0]&8&&ce(d.value)!==E[3].m.m.v&&Q(d,E[3].m.m.v),L[0]&8&&ce(S.value)!==E[3].m.m.a&&Q(S,E[3].m.m.a),L[0]&8&&ce(F.value)!==E[3].m.m.c&&Q(F,E[3].m.m.c)},d(E){E&&w(e),H=!1,Be(j)}}}function Ra(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C;return{c(){e=m("div"),l=$("Gateway"),n=m("br"),i=v(),o=m("input"),r=v(),a=m("div"),f=$("DNS"),c=m("br"),p=v(),_=m("div"),d=m("input"),g=v(),h=m("input"),u(o,"name","ng"),u(o,"type","text"),u(o,"class","in-s"),u(e,"class","my-1"),u(d,"name","nd1"),u(d,"type","text"),u(d,"class","in-f w-full"),u(h,"name","nd2"),u(h,"type","text"),u(h,"class","in-l w-full"),u(_,"class","flex"),u(a,"class","my-1")},m(k,S){y(k,e,S),s(e,l),s(e,n),s(e,i),s(e,o),Q(o,t[3].n.g),y(k,r,S),y(k,a,S),s(a,f),s(a,c),s(a,p),s(a,_),s(_,d),Q(d,t[3].n.d1),s(_,g),s(_,h),Q(h,t[3].n.d2),b||(C=[Y(o,"input",t[44]),Y(d,"input",t[45]),Y(h,"input",t[46])],b=!0)},p(k,S){S[0]&8&&o.value!==k[3].n.g&&Q(o,k[3].n.g),S[0]&8&&d.value!==k[3].n.d1&&Q(d,k[3].n.d1),S[0]&8&&h.value!==k[3].n.d2&&Q(h,k[3].n.d2)},d(k){k&&w(e),k&&w(r),k&&w(a),b=!1,Be(C)}}}function Fa(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=$(" SSL"),u(l,"type","checkbox"),u(l,"name","qs"),l.__value="true",l.value=l.__value,u(l,"class","rounded mb-1"),u(e,"class","float-right mr-3")},m(r,a){y(r,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[Y(l,"change",t[50]),Y(l,"change",t[11])],i=!0)},p(r,a){a[0]&8&&(l.checked=r[3].q.s.e)},d(r){r&&w(e),i=!1,Be(o)}}}function La(t){let e,l,n,i,o,r,a,f;return n=new kl({props:{to:"/mqtt-ca",$$slots:{default:[fp]},$$scope:{ctx:t}}}),o=new kl({props:{to:"/mqtt-cert",$$slots:{default:[pp]},$$scope:{ctx:t}}}),a=new kl({props:{to:"/mqtt-key",$$slots:{default:[vp]},$$scope:{ctx:t}}}),{c(){e=m("div"),l=m("div"),Z(n.$$.fragment),i=v(),Z(o.$$.fragment),r=v(),Z(a.$$.fragment),u(e,"class","my-1")},m(c,p){y(c,e,p),s(e,l),V(n,l,null),s(l,i),V(o,l,null),s(l,r),V(a,l,null),f=!0},p(c,p){const _={};p[0]&8|p[3]&16&&(_.$$scope={dirty:p,ctx:c}),n.$set(_);const d={};p[0]&8|p[3]&16&&(d.$$scope={dirty:p,ctx:c}),o.$set(d);const g={};p[0]&8|p[3]&16&&(g.$$scope={dirty:p,ctx:c}),a.$set(g)},i(c){f||(P(n.$$.fragment,c),P(o.$$.fragment,c),P(a.$$.fragment,c),f=!0)},o(c){N(n.$$.fragment,c),N(o.$$.fragment,c),N(a.$$.fragment,c),f=!1},d(c){c&&w(e),K(n),K(o),K(a)}}}function rp(t){let e,l;return e=new Yt({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function ap(t){let e,l;return e=new Yt({props:{color:"green",text:"CA OK",title:"Click here to replace CA"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function fp(t){let e,l,n,i;const o=[ap,rp],r=[];function a(f,c){return f[3].q.s.c?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Me(),N(r[p],1,1,()=>{r[p]=null}),Ae(),l=r[e],l||(l=r[e]=o[e](f),l.c()),P(l,1),l.m(n.parentNode,n))},i(f){i||(P(l),i=!0)},o(f){N(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function cp(t){let e,l;return e=new Yt({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function mp(t){let e,l;return e=new Yt({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function pp(t){let e,l,n,i;const o=[mp,cp],r=[];function a(f,c){return f[3].q.s.r?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Me(),N(r[p],1,1,()=>{r[p]=null}),Ae(),l=r[e],l||(l=r[e]=o[e](f),l.c()),P(l,1),l.m(n.parentNode,n))},i(f){i||(P(l),i=!0)},o(f){N(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function _p(t){let e,l;return e=new Yt({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function dp(t){let e,l;return e=new Yt({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function vp(t){let e,l,n,i;const o=[dp,_p],r=[];function a(f,c){return f[3].q.s.k?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Me(),N(r[p],1,1,()=>{r[p]=null}),Ae(),l=r[e],l||(l=r[e]=o[e](f),l.c()),P(l,1),l.m(n.parentNode,n))},i(f){i||(P(l),i=!0)},o(f){N(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function Oa(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C,k,S,M,I,T,D,R,F,H,j,E,L,W,G,q,O;return o=new Ft({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=v(),i=m("a"),Z(o.$$.fragment),r=v(),a=m("input"),f=v(),c=m("div"),p=m("div"),_=$("Electricity IDX"),d=m("br"),g=v(),h=m("input"),b=v(),C=m("div"),k=$("Current IDX"),S=m("br"),M=v(),I=m("input"),T=v(),D=m("div"),R=$(`Voltage IDX: L1, L2 & L3
|
|
`),F=m("div"),H=m("input"),j=v(),E=m("input"),L=v(),W=m("input"),u(l,"class","text-sm"),u(i,"href",Lt("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","o"),a.value="true",u(h,"name","oe"),u(h,"type","text"),u(h,"class","in-f tr w-full"),u(p,"class","w-1/2"),u(I,"name","oc"),u(I,"type","text"),u(I,"class","in-l tr w-full"),u(C,"class","w-1/2"),u(c,"class","my-1 flex"),u(H,"name","ou1"),u(H,"type","text"),u(H,"class","in-f tr w-1/3"),u(E,"name","ou2"),u(E,"type","text"),u(E,"class","in-m tr w-1/3"),u(W,"name","ou3"),u(W,"type","text"),u(W,"class","in-l tr w-1/3"),u(F,"class","flex"),u(D,"class","my-1"),u(e,"class","cnt")},m(U,X){y(U,e,X),s(e,l),s(e,n),s(e,i),V(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c),s(c,p),s(p,_),s(p,d),s(p,g),s(p,h),Q(h,t[3].o.e),s(c,b),s(c,C),s(C,k),s(C,S),s(C,M),s(C,I),Q(I,t[3].o.c),s(e,T),s(e,D),s(D,R),s(D,F),s(F,H),Q(H,t[3].o.u1),s(F,j),s(F,E),Q(E,t[3].o.u2),s(F,L),s(F,W),Q(W,t[3].o.u3),G=!0,q||(O=[Y(h,"input",t[58]),Y(I,"input",t[59]),Y(H,"input",t[60]),Y(E,"input",t[61]),Y(W,"input",t[62])],q=!0)},p(U,X){X[0]&8&&h.value!==U[3].o.e&&Q(h,U[3].o.e),X[0]&8&&I.value!==U[3].o.c&&Q(I,U[3].o.c),X[0]&8&&H.value!==U[3].o.u1&&Q(H,U[3].o.u1),X[0]&8&&E.value!==U[3].o.u2&&Q(E,U[3].o.u2),X[0]&8&&W.value!==U[3].o.u3&&Q(W,U[3].o.u3)},i(U){G||(P(o.$$.fragment,U),G=!0)},o(U){N(o.$$.fragment,U),G=!1},d(U){U&&w(e),K(o),q=!1,Be(O)}}}function qa(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C,k,S,M;o=new Ft({});let I={length:9},T=[];for(let D=0;D<I.length;D+=1)T[D]=Ua(Ma(t,I,D));return{c(){e=m("div"),l=m("strong"),l.textContent="Tariff thresholds",n=v(),i=m("a"),Z(o.$$.fragment),r=v(),a=m("input"),f=v(),c=m("div");for(let D=0;D<T.length;D+=1)T[D].c();p=v(),_=m("label"),d=m("span"),d.textContent="Average of",g=v(),h=m("input"),b=v(),C=m("span"),C.textContent="hours",u(l,"class","text-sm"),u(i,"href",Lt("Threshold-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","t"),a.value="true",u(c,"class","flex flex-wrap my-1"),u(d,"class","in-pre"),u(h,"name","th"),u(h,"type","number"),u(h,"min","0"),u(h,"max","255"),u(h,"class","in-txt tr w-full"),u(C,"class","in-post"),u(_,"class","flex m-1"),u(e,"class","cnt")},m(D,R){y(D,e,R),s(e,l),s(e,n),s(e,i),V(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c);for(let F=0;F<T.length;F+=1)T[F].m(c,null);s(e,p),s(e,_),s(_,d),s(_,g),s(_,h),Q(h,t[3].t.h),s(_,b),s(_,C),k=!0,S||(M=Y(h,"input",t[64]),S=!0)},p(D,R){if(R[0]&8){I={length:9};let F;for(F=0;F<I.length;F+=1){const H=Ma(D,I,F);T[F]?T[F].p(H,R):(T[F]=Ua(H),T[F].c(),T[F].m(c,null))}for(;F<T.length;F+=1)T[F].d(1);T.length=I.length}R[0]&8&&ce(h.value)!==D[3].t.h&&Q(h,D[3].t.h)},i(D){k||(P(o.$$.fragment,D),k=!0)},o(D){N(o.$$.fragment,D),k=!1},d(D){D&&w(e),K(o),Vt(T,D),S=!1,M()}}}function Ua(t){let e,l,n=t[90]+1+"",i,o,r,a,f,c,p,_;function d(){t[63].call(r,t[90])}return{c(){e=m("label"),l=m("span"),i=$(n),o=v(),r=m("input"),a=v(),f=m("span"),f.textContent="kWh",c=v(),u(l,"class","in-pre"),u(r,"name","t"+t[90]),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-txt w-full"),u(f,"class","in-post"),u(e,"class","flex w-40 m-1")},m(g,h){y(g,e,h),s(e,l),s(l,i),s(e,o),s(e,r),Q(r,t[3].t.t[t[90]]),s(e,a),s(e,f),s(e,c),p||(_=Y(r,"input",d),p=!0)},p(g,h){t=g,h[0]&8&&ce(r.value)!==t[3].t.t[t[90]]&&Q(r,t[3].t.t[t[90]])},d(g){g&&w(e),p=!1,_()}}}function Ha(t){let e,l=t[85].name+"",n,i,o,r,a,f,c,p,_,d;function g(){t[65].call(r,t[85])}return{c(){e=m("div"),n=$(l),i=m("br"),o=v(),r=m("select"),a=m("option"),a.textContent="Hide",f=m("option"),f.textContent="Show",c=m("option"),c.textContent="Dynamic",p=v(),a.__value=0,a.value=a.__value,f.__value=1,f.value=f.__value,c.__value=2,c.value=c.__value,u(r,"name","u"+t[85].key),u(r,"class","in-s"),t[3].u[t[85].key]===void 0&&ze(g),u(e,"class","w-1/2")},m(h,b){y(h,e,b),s(e,n),s(e,i),s(e,o),s(e,r),s(r,a),s(r,f),s(r,c),Re(r,t[3].u[t[85].key]),s(e,p),_||(d=Y(r,"change",g),_=!0)},p(h,b){t=h,b[0]&136&&Re(r,t[3].u[t[85].key])},d(h){h&&w(e),_=!1,d()}}}function ja(t){let e,l,n,i,o,r,a,f;o=new Ft({});let c=t[0].board>20&&Wa(t),p=t[0].chip=="esp8266"&&za(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=v(),i=m("a"),Z(o.$$.fragment),r=v(),c&&c.c(),a=v(),p&&p.c(),u(l,"class","text-sm"),u(i,"href",Lt("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(_,d){y(_,e,d),s(e,l),s(e,n),s(e,i),V(o,i,null),s(e,r),c&&c.m(e,null),s(e,a),p&&p.m(e,null),f=!0},p(_,d){_[0].board>20?c?(c.p(_,d),d[0]&1&&P(c,1)):(c=Wa(_),c.c(),P(c,1),c.m(e,a)):c&&(Me(),N(c,1,1,()=>{c=null}),Ae()),_[0].chip=="esp8266"?p?p.p(_,d):(p=za(_),p.c(),p.m(e,null)):p&&(p.d(1),p=null)},i(_){f||(P(o.$$.fragment,_),P(c),f=!0)},o(_){N(o.$$.fragment,_),N(c),f=!1},d(_){_&&w(e),K(o),c&&c.d(),p&&p.d()}}}function Wa(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C,k,S,M,I,T,D,R,F,H,j,E,L,W,G,q,O,U,X,z,ne,te,Te,pe,Ne,Ie,Fe,Ee,$e,ge,_e,ae,fe,oe,J,ie,Ce,x,ue,He,Se;c=new rc({props:{chip:t[0].chip}});let de=t[0].chip!="esp8266"&&Ga(t),ve=t[3].i.v.p>0&&Ba(t);return{c(){e=m("input"),l=v(),n=m("div"),i=m("div"),o=$("HAN"),r=m("br"),a=v(),f=m("select"),Z(c.$$.fragment),p=v(),_=m("div"),d=$("AP button"),g=m("br"),h=v(),b=m("input"),C=v(),k=m("div"),S=$("LED"),M=m("label"),I=m("input"),T=$(" inv"),D=m("br"),R=v(),F=m("div"),H=m("input"),j=v(),E=m("div"),L=$("RGB"),W=m("label"),G=m("input"),q=$(" inverted"),O=m("br"),U=v(),X=m("div"),z=m("input"),ne=v(),te=m("input"),Te=v(),pe=m("input"),Ne=v(),Ie=m("div"),Fe=$("Temperature"),Ee=m("br"),$e=v(),ge=m("input"),_e=v(),ae=m("div"),fe=$("Analog temp"),oe=m("br"),J=v(),ie=m("input"),Ce=v(),de&&de.c(),x=v(),ve&&ve.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(f,"name","ih"),u(f,"class","in-f w-full"),t[3].i.h===void 0&&ze(()=>t[66].call(f)),u(i,"class","w-1/3"),u(b,"name","ia"),u(b,"type","number"),u(b,"min","0"),u(b,"max",t[6]),u(b,"class","in-m tr w-full"),u(_,"class","w-1/3"),u(I,"name","ili"),I.__value="true",I.value=I.__value,u(I,"type","checkbox"),u(I,"class","rounded mb-1"),u(M,"class","ml-4"),u(H,"name","ilp"),u(H,"type","number"),u(H,"min","0"),u(H,"max",t[6]),u(H,"class","in-l tr w-full"),u(F,"class","flex"),u(k,"class","w-1/3"),u(G,"name","iri"),G.__value="true",G.value=G.__value,u(G,"type","checkbox"),u(G,"class","rounded mb-1"),u(W,"class","ml-4"),u(z,"name","irr"),u(z,"type","number"),u(z,"min","0"),u(z,"max",t[6]),u(z,"class","in-f tr w-1/3"),u(te,"name","irg"),u(te,"type","number"),u(te,"min","0"),u(te,"max",t[6]),u(te,"class","in-m tr w-1/3"),u(pe,"name","irb"),u(pe,"type","number"),u(pe,"min","0"),u(pe,"max",t[6]),u(pe,"class","in-l tr w-1/3"),u(X,"class","flex"),u(E,"class","w-full"),u(ge,"name","itd"),u(ge,"type","number"),u(ge,"min","0"),u(ge,"max",t[6]),u(ge,"class","in-f tr w-full"),u(Ie,"class","my-1 w-1/3"),u(ie,"name","ita"),u(ie,"type","number"),u(ie,"min","0"),u(ie,"max",t[6]),u(ie,"class","in-l tr w-full"),u(ae,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(le,he){y(le,e,he),y(le,l,he),y(le,n,he),s(n,i),s(i,o),s(i,r),s(i,a),s(i,f),V(c,f,null),Re(f,t[3].i.h),s(n,p),s(n,_),s(_,d),s(_,g),s(_,h),s(_,b),Q(b,t[3].i.a),s(n,C),s(n,k),s(k,S),s(k,M),s(M,I),I.checked=t[3].i.l.i,s(M,T),s(k,D),s(k,R),s(k,F),s(F,H),Q(H,t[3].i.l.p),s(n,j),s(n,E),s(E,L),s(E,W),s(W,G),G.checked=t[3].i.r.i,s(W,q),s(E,O),s(E,U),s(E,X),s(X,z),Q(z,t[3].i.r.r),s(X,ne),s(X,te),Q(te,t[3].i.r.g),s(X,Te),s(X,pe),Q(pe,t[3].i.r.b),s(n,Ne),s(n,Ie),s(Ie,Fe),s(Ie,Ee),s(Ie,$e),s(Ie,ge),Q(ge,t[3].i.t.d),s(n,_e),s(n,ae),s(ae,fe),s(ae,oe),s(ae,J),s(ae,ie),Q(ie,t[3].i.t.a),s(n,Ce),de&&de.m(n,null),s(n,x),ve&&ve.m(n,null),ue=!0,He||(Se=[Y(f,"change",t[66]),Y(b,"input",t[67]),Y(I,"change",t[68]),Y(H,"input",t[69]),Y(G,"change",t[70]),Y(z,"input",t[71]),Y(te,"input",t[72]),Y(pe,"input",t[73]),Y(ge,"input",t[74]),Y(ie,"input",t[75])],He=!0)},p(le,he){const qe={};he[0]&1&&(qe.chip=le[0].chip),c.$set(qe),he[0]&8&&Re(f,le[3].i.h),(!ue||he[0]&64)&&u(b,"max",le[6]),he[0]&8&&ce(b.value)!==le[3].i.a&&Q(b,le[3].i.a),he[0]&8&&(I.checked=le[3].i.l.i),(!ue||he[0]&64)&&u(H,"max",le[6]),he[0]&8&&ce(H.value)!==le[3].i.l.p&&Q(H,le[3].i.l.p),he[0]&8&&(G.checked=le[3].i.r.i),(!ue||he[0]&64)&&u(z,"max",le[6]),he[0]&8&&ce(z.value)!==le[3].i.r.r&&Q(z,le[3].i.r.r),(!ue||he[0]&64)&&u(te,"max",le[6]),he[0]&8&&ce(te.value)!==le[3].i.r.g&&Q(te,le[3].i.r.g),(!ue||he[0]&64)&&u(pe,"max",le[6]),he[0]&8&&ce(pe.value)!==le[3].i.r.b&&Q(pe,le[3].i.r.b),(!ue||he[0]&64)&&u(ge,"max",le[6]),he[0]&8&&ce(ge.value)!==le[3].i.t.d&&Q(ge,le[3].i.t.d),(!ue||he[0]&64)&&u(ie,"max",le[6]),he[0]&8&&ce(ie.value)!==le[3].i.t.a&&Q(ie,le[3].i.t.a),le[0].chip!="esp8266"?de?de.p(le,he):(de=Ga(le),de.c(),de.m(n,x)):de&&(de.d(1),de=null),le[3].i.v.p>0?ve?ve.p(le,he):(ve=Ba(le),ve.c(),ve.m(n,null)):ve&&(ve.d(1),ve=null)},i(le){ue||(P(c.$$.fragment,le),ue=!0)},o(le){N(c.$$.fragment,le),ue=!1},d(le){le&&w(e),le&&w(l),le&&w(n),K(c),de&&de.d(),ve&&ve.d(),He=!1,Be(Se)}}}function Ga(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=$("Vcc"),n=m("br"),i=v(),o=m("input"),u(o,"name","ivp"),u(o,"type","number"),u(o,"min","0"),u(o,"max",t[6]),u(o,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),Q(o,t[3].i.v.p),r||(a=Y(o,"input",t[76]),r=!0)},p(f,c){c[0]&64&&u(o,"max",f[6]),c[0]&8&&ce(o.value)!==f[3].i.v.p&&Q(o,f[3].i.v.p)},d(f){f&&w(e),r=!1,a()}}}function Ba(t){let e,l,n,i,o,r,a,f,c,p;return{c(){e=m("div"),l=$("Voltage divider"),n=m("br"),i=v(),o=m("div"),r=m("input"),a=v(),f=m("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"placeholder","VCC"),u(f,"name","ivdg"),u(f,"type","number"),u(f,"min","0"),u(f,"max","65535"),u(f,"class","in-l tr w-full"),u(f,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(_,d){y(_,e,d),s(e,l),s(e,n),s(e,i),s(e,o),s(o,r),Q(r,t[3].i.v.d.v),s(o,a),s(o,f),Q(f,t[3].i.v.d.g),c||(p=[Y(r,"input",t[77]),Y(f,"input",t[78])],c=!0)},p(_,d){d[0]&8&&ce(r.value)!==_[3].i.v.d.v&&Q(r,_[3].i.v.d.v),d[0]&8&&ce(f.value)!==_[3].i.v.d.g&&Q(f,_[3].i.v.d.g)},d(_){_&&w(e),c=!1,Be(p)}}}function za(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C,k,S=(t[0].board==2||t[0].board==100)&&Ya(t);return{c(){e=m("input"),l=v(),n=m("div"),i=m("div"),o=$("Vcc offset"),r=m("br"),a=v(),f=m("input"),c=v(),p=m("div"),_=$("Multiplier"),d=m("br"),g=v(),h=m("input"),b=v(),S&&S.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(f,"name","ivo"),u(f,"type","number"),u(f,"min","0.0"),u(f,"max","3.5"),u(f,"step","0.01"),u(f,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(h,"name","ivm"),u(h,"type","number"),u(h,"min","0.1"),u(h,"max","10"),u(h,"step","0.01"),u(h,"class","in-l tr w-full"),u(p,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(M,I){y(M,e,I),y(M,l,I),y(M,n,I),s(n,i),s(i,o),s(i,r),s(i,a),s(i,f),Q(f,t[3].i.v.o),s(n,c),s(n,p),s(p,_),s(p,d),s(p,g),s(p,h),Q(h,t[3].i.v.m),s(n,b),S&&S.m(n,null),C||(k=[Y(f,"input",t[79]),Y(h,"input",t[80])],C=!0)},p(M,I){I[0]&8&&ce(f.value)!==M[3].i.v.o&&Q(f,M[3].i.v.o),I[0]&8&&ce(h.value)!==M[3].i.v.m&&Q(h,M[3].i.v.m),M[0].board==2||M[0].board==100?S?S.p(M,I):(S=Ya(M),S.c(),S.m(n,null)):S&&(S.d(1),S=null)},d(M){M&&w(e),M&&w(l),M&&w(n),S&&S.d(),C=!1,Be(k)}}}function Ya(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=$("Boot limit"),n=m("br"),i=v(),o=m("input"),u(o,"name","ivb"),u(o,"type","number"),u(o,"min","2.5"),u(o,"max","3.5"),u(o,"step","0.1"),u(o,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),Q(o,t[3].i.v.b),r||(a=Y(o,"input",t[81]),r=!0)},p(f,c){c[0]&8&&ce(o.value)!==f[3].i.v.b&&Q(o,f[3].i.v.b)},d(f){f&&w(e),r=!1,a()}}}function Va(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C,k=t[3].d.t&&Ka();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=v(),n=m("div"),i=m("label"),o=m("input"),r=$(" Enable telnet"),a=v(),k&&k.c(),f=v(),c=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",d=m("option"),d.textContent="Debug",g=m("option"),g.textContent="Info",h=m("option"),h.textContent="Warning",u(e,"class","bd-red"),u(o,"type","checkbox"),u(o,"name","dt"),o.__value="true",o.value=o.__value,u(o,"class","rounded mb-1"),u(n,"class","my-1"),_.__value=1,_.value=_.__value,d.__value=2,d.value=d.__value,g.__value=3,g.value=g.__value,h.__value=4,h.value=h.__value,u(p,"name","dl"),u(p,"class","in-s"),t[3].d.l===void 0&&ze(()=>t[84].call(p)),u(c,"class","my-1")},m(S,M){y(S,e,M),y(S,l,M),y(S,n,M),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,r),y(S,a,M),k&&k.m(S,M),y(S,f,M),y(S,c,M),s(c,p),s(p,_),s(p,d),s(p,g),s(p,h),Re(p,t[3].d.l),b||(C=[Y(o,"change",t[83]),Y(p,"change",t[84])],b=!0)},p(S,M){M[0]&8&&(o.checked=S[3].d.t),S[3].d.t?k||(k=Ka(),k.c(),k.m(f.parentNode,f)):k&&(k.d(1),k=null),M[0]&8&&Re(p,S[3].d.l)},d(S){S&&w(e),S&&w(l),S&&w(n),S&&w(a),k&&k.d(S),S&&w(f),S&&w(c),b=!1,Be(C)}}}function Ka(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function hp(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C,k,S,M,I,T,D,R,F,H,j,E,L,W,G,q,O,U,X,z,ne,te,Te,pe,Ne,Ie,Fe,Ee,$e,ge,_e,ae,fe,oe,J,ie,Ce,x,ue,He,Se,de,ve,le,he,qe,re,Pe,fi,ci,mi,$t,pi,Qt,_i,di,vi,tt,hi,Zt,Yl,pt,gi,bi,ki,Jt,wi,yi,$i,_t,rl,al,Ue,Bn,Cl,Le,Vl,fl,cl,ml,uo,zn,ro,Kl,ps,ao,pl,qt,_l,fo,Ci,co,xe,dl,mo,Si,Ql,Zl,Jl,Xl,Ti,po,Yn,Ct,_o,vo,Sl,ho,go,bo,Ut,xl,en,ko,tn,Tl,wo,yo,$o,ln,St,Co,Pi,So,Pl,To,Po,Mo,nn,Tt,Ao,Mi,Do,_s,No,Ml,Ai,Pt,Io,Eo,Ro,ds,Di,Mt,Fo,Lo,Oo,Xe,Ni,qo,sn,on,Uo,Vn,Ho,Al,jo,Wo,Go,Xt,Bo,Dl,zo,Yo,Vo,xt,Ko,un,Nl,Qo,Zo,Jo,bt,rn,an,fn,cn,Xo,Il,xo,eu,tu,mn,kt,lu,Ii,nu,Ei,Ri,At,iu,su,Je,Fi,ou,pn,_n,uu,El,ru,au,fu,vl,Ht,dn,vn,cu,dt,Li,Oi,mu,vt,hn,qi,Ui,pu,vs,Hi,ji,Dt,_u,du,Kn,vu,hl,hu,Qn,Nt,gu,bu,ku,Wi,el,wu,Ge,Gi,yu,gn,bn,$u,Zn,Cu,jt,Su,hs,Tu,Pu,kn,tl,Mu,It,Au,gs,Rl,Du,Nu,Iu,ll,Eu,Fl,Ru,Fu,Lu,nl,Ou,wn,yn,qu,Uu,Hu,il,ju,$n,Wu,Gu,Bu,lt,Cn,Sn,Tn,Pn,Mn,An,zu,Ll,Yu,Vu,Ku,sl,Qu,bs,ks=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",ws,Wt,Bi,Zu,Dn,Nn,Ju,Jn,Xu,Xn,xu,ys,ht,zi,er,In,En,tr,xn,lr,Yi,Vi,Et,nr,ir,sr,gl,$s,Rn,or,Ki,Fn,ur,Qi,Cs,Ol,Ss,ql,Ts,Ul,Ps,Hl,Rt,Ms,rr;a=new Ft({}),F=new lp({});let fc=["NOK","SEK","DKK","EUR"],Zi=[];for(let A=0;A<4;A+=1)Zi[A]=op(sp(t,fc,A));let nt=t[3].p.e&&t[0].chip!="esp8266"&&Aa(t),it=t[3].g.s>0&&Da(t);ml=new Ft({});let cc=[24,48,96,192,384,576,1152],Ji=[];for(let A=0;A<7;A+=1)Ji[A]=up(ip(t,cc,A));let st=t[3].m.e.e&&Na(t),ot=t[3].m.e.e&&Ia(t),ut=t[3].m.m.e&&Ea(t);on=new Ft({}),_n=new Ft({}),hn=new ac({});let rt=t[3].n.m=="static"&&Ra(t);bn=new Ft({});let at=t[0].chip!="esp8266"&&Fa(t),Ye=t[3].q.s.e&&La(t),Ve=t[3].q.m==3&&Oa(t),Ke=ks&&qa(t);Nn=new Ft({});let Ln=t[7],ft=[];for(let A=0;A<Ln.length;A+=1)ft[A]=Ha(Pa(t,Ln,A));let Qe=(t[0].board>20||t[0].chip=="esp8266")&&ja(t);En=new Ft({});let ct=t[3].d.s&&Va(t);return Ol=new gt({props:{active:t[1],message:"Loading configuration"}}),ql=new gt({props:{active:t[2],message:"Saving configuration"}}),Ul=new gt({props:{active:t[4],message:"Performing factory reset"}}),Hl=new gt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=v(),r=m("a"),Z(a.$$.fragment),f=v(),c=m("input"),p=v(),_=m("div"),d=m("div"),g=m("div"),h=$("Hostname"),b=m("br"),C=v(),k=m("input"),S=v(),M=m("div"),I=$("Time zone"),T=m("br"),D=v(),R=m("select"),Z(F.$$.fragment),H=v(),j=m("input"),E=v(),L=m("div"),W=$("Price region"),G=m("br"),q=v(),O=m("select"),U=m("optgroup"),X=m("option"),X.textContent="NO1",z=m("option"),z.textContent="NO2",ne=m("option"),ne.textContent="NO3",te=m("option"),te.textContent="NO4",Te=m("option"),Te.textContent="NO5",pe=m("optgroup"),Ne=m("option"),Ne.textContent="SE1",Ie=m("option"),Ie.textContent="SE2",Fe=m("option"),Fe.textContent="SE3",Ee=m("option"),Ee.textContent="SE4",$e=m("optgroup"),ge=m("option"),ge.textContent="DK1",_e=m("option"),_e.textContent="DK2",ae=m("option"),ae.textContent="Austria",fe=m("option"),fe.textContent="Belgium",oe=m("option"),oe.textContent="Czech Republic",J=m("option"),J.textContent="Estonia",ie=m("option"),ie.textContent="Finland",Ce=m("option"),Ce.textContent="France",x=m("option"),x.textContent="Germany",ue=m("option"),ue.textContent="Great Britain",He=m("option"),He.textContent="Latvia",Se=m("option"),Se.textContent="Lithuania",de=m("option"),de.textContent="Netherland",ve=m("option"),ve.textContent="Poland",le=m("option"),le.textContent="Switzerland",he=v(),qe=m("div"),re=m("div"),Pe=m("div"),fi=$("Currency"),ci=m("br"),mi=v(),$t=m("select");for(let A=0;A<4;A+=1)Zi[A].c();pi=v(),Qt=m("div"),_i=$("Multiplier"),di=m("br"),vi=v(),tt=m("input"),hi=v(),Zt=m("div"),Yl=m("label"),pt=m("input"),gi=$(" Enable price fetch from remote server"),bi=v(),nt&&nt.c(),ki=v(),Jt=m("div"),wi=$("Security"),yi=m("br"),$i=v(),_t=m("select"),rl=m("option"),rl.textContent="None",al=m("option"),al.textContent="Only configuration",Ue=m("option"),Ue.textContent="Everything",Bn=v(),it&&it.c(),Cl=v(),Le=m("div"),Vl=m("strong"),Vl.textContent="Meter",fl=v(),cl=m("a"),Z(ml.$$.fragment),uo=v(),zn=m("input"),ro=v(),Kl=m("div"),ps=m("span"),ps.textContent="Serial configuration",ao=v(),pl=m("div"),qt=m("select"),_l=m("option"),fo=$("Autodetect");for(let A=0;A<7;A+=1)Ji[A].c();co=v(),xe=m("select"),dl=m("option"),mo=$("-"),Ql=m("option"),Ql.textContent="7N1",Zl=m("option"),Zl.textContent="8N1",Jl=m("option"),Jl.textContent="7E1",Xl=m("option"),Xl.textContent="8E1",po=v(),Yn=m("label"),Ct=m("input"),_o=$(" inverted"),vo=v(),Sl=m("div"),ho=$("Voltage"),go=m("br"),bo=v(),Ut=m("select"),xl=m("option"),xl.textContent="400V (TN)",en=m("option"),en.textContent="230V (IT/TT)",ko=v(),tn=m("div"),Tl=m("div"),wo=$("Main fuse"),yo=m("br"),$o=v(),ln=m("label"),St=m("input"),Co=v(),Pi=m("span"),Pi.textContent="A",So=v(),Pl=m("div"),To=$("Production"),Po=m("br"),Mo=v(),nn=m("label"),Tt=m("input"),Ao=v(),Mi=m("span"),Mi.textContent="kWp",Do=v(),_s=m("div"),No=v(),Ml=m("div"),Ai=m("label"),Pt=m("input"),Io=$(" Meter is encrypted"),Eo=v(),st&&st.c(),Ro=v(),ot&&ot.c(),ds=v(),Di=m("label"),Mt=m("input"),Fo=$(" Multipliers"),Lo=v(),ut&&ut.c(),Oo=v(),Xe=m("div"),Ni=m("strong"),Ni.textContent="WiFi",qo=v(),sn=m("a"),Z(on.$$.fragment),Uo=v(),Vn=m("input"),Ho=v(),Al=m("div"),jo=$("SSID"),Wo=m("br"),Go=v(),Xt=m("input"),Bo=v(),Dl=m("div"),zo=$("Password"),Yo=m("br"),Vo=v(),xt=m("input"),Ko=v(),un=m("div"),Nl=m("div"),Qo=$("Power saving"),Zo=m("br"),Jo=v(),bt=m("select"),rn=m("option"),rn.textContent="Default",an=m("option"),an.textContent="Off",fn=m("option"),fn.textContent="Minimum",cn=m("option"),cn.textContent="Maximum",Xo=v(),Il=m("div"),xo=$("Power"),eu=m("br"),tu=v(),mn=m("div"),kt=m("input"),lu=v(),Ii=m("span"),Ii.textContent="dBm",nu=v(),Ei=m("div"),Ri=m("label"),At=m("input"),iu=$(" Auto reboot on connection problem"),su=v(),Je=m("div"),Fi=m("strong"),Fi.textContent="Network",ou=v(),pn=m("a"),Z(_n.$$.fragment),uu=v(),El=m("div"),ru=$("IP"),au=m("br"),fu=v(),vl=m("div"),Ht=m("select"),dn=m("option"),dn.textContent="DHCP",vn=m("option"),vn.textContent="Static",cu=v(),dt=m("input"),mu=v(),vt=m("select"),Z(hn.$$.fragment),pu=v(),rt&&rt.c(),vs=v(),Hi=m("div"),ji=m("label"),Dt=m("input"),_u=$(" enable mDNS"),du=v(),Kn=m("input"),vu=v(),hl=m("div"),hu=$("NTP "),Qn=m("label"),Nt=m("input"),gu=$(" obtain from DHCP"),bu=m("br"),ku=v(),Wi=m("div"),el=m("input"),wu=v(),Ge=m("div"),Gi=m("strong"),Gi.textContent="MQTT",yu=v(),gn=m("a"),Z(bn.$$.fragment),$u=v(),Zn=m("input"),Cu=v(),jt=m("div"),Su=$(`Server
|
|
`),at&&at.c(),hs=v(),Tu=m("br"),Pu=v(),kn=m("div"),tl=m("input"),Mu=v(),It=m("input"),Au=v(),Ye&&Ye.c(),gs=v(),Rl=m("div"),Du=$("Username"),Nu=m("br"),Iu=v(),ll=m("input"),Eu=v(),Fl=m("div"),Ru=$("Password"),Fu=m("br"),Lu=v(),nl=m("input"),Ou=v(),wn=m("div"),yn=m("div"),qu=$("Client ID"),Uu=m("br"),Hu=v(),il=m("input"),ju=v(),$n=m("div"),Wu=$("Payload"),Gu=m("br"),Bu=v(),lt=m("select"),Cn=m("option"),Cn.textContent="JSON",Sn=m("option"),Sn.textContent="Raw (minimal)",Tn=m("option"),Tn.textContent="Raw (full)",Pn=m("option"),Pn.textContent="Domoticz",Mn=m("option"),Mn.textContent="HomeAssistant",An=m("option"),An.textContent="HEX dump",zu=v(),Ll=m("div"),Yu=$("Publish topic"),Vu=m("br"),Ku=v(),sl=m("input"),Qu=v(),Ve&&Ve.c(),bs=v(),Ke&&Ke.c(),ws=v(),Wt=m("div"),Bi=m("strong"),Bi.textContent="User interface",Zu=v(),Dn=m("a"),Z(Nn.$$.fragment),Ju=v(),Jn=m("input"),Xu=v(),Xn=m("div");for(let A=0;A<ft.length;A+=1)ft[A].c();xu=v(),Qe&&Qe.c(),ys=v(),ht=m("div"),zi=m("strong"),zi.textContent="Debugging",er=v(),In=m("a"),Z(En.$$.fragment),tr=v(),xn=m("input"),lr=v(),Yi=m("div"),Vi=m("label"),Et=m("input"),nr=$(" Enable debugging"),ir=v(),ct&&ct.c(),sr=v(),gl=m("div"),$s=m("div"),Rn=m("button"),Rn.textContent="Factory reset",or=v(),Ki=m("div"),Fn=m("button"),Fn.textContent="Reboot",ur=v(),Qi=m("div"),Qi.innerHTML='<button type="submit" class="btn-pri">Save</button>',Cs=v(),Z(Ol.$$.fragment),Ss=v(),Z(ql.$$.fragment),Ts=v(),Z(Ul.$$.fragment),Ps=v(),Z(Hl.$$.fragment),u(i,"class","text-sm"),u(r,"href",Lt("General-configuration")),u(r,"target","_blank"),u(r,"class","float-right"),u(c,"type","hidden"),u(c,"name","g"),c.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(R,"name","gt"),u(R,"class","in-l w-full"),t[3].g.t===void 0&&ze(()=>t[13].call(R)),u(d,"class","flex"),u(_,"class","my-1"),u(j,"type","hidden"),u(j,"name","p"),j.value="true",X.__value="10YNO-1--------2",X.value=X.__value,z.__value="10YNO-2--------T",z.value=z.__value,ne.__value="10YNO-3--------J",ne.value=ne.__value,te.__value="10YNO-4--------9",te.value=te.__value,Te.__value="10Y1001A1001A48H",Te.value=Te.__value,u(U,"label","Norway"),Ne.__value="10Y1001A1001A44P",Ne.value=Ne.__value,Ie.__value="10Y1001A1001A45N",Ie.value=Ie.__value,Fe.__value="10Y1001A1001A46L",Fe.value=Fe.__value,Ee.__value="10Y1001A1001A47J",Ee.value=Ee.__value,u(pe,"label","Sweden"),ge.__value="10YDK-1--------W",ge.value=ge.__value,_e.__value="10YDK-2--------M",_e.value=_e.__value,u($e,"label","Denmark"),ae.__value="10YAT-APG------L",ae.value=ae.__value,fe.__value="10YBE----------2",fe.value=fe.__value,oe.__value="10YCZ-CEPS-----N",oe.value=oe.__value,J.__value="10Y1001A1001A39I",J.value=J.__value,ie.__value="10YFI-1--------U",ie.value=ie.__value,Ce.__value="10YFR-RTE------C",Ce.value=Ce.__value,x.__value="10Y1001A1001A83F",x.value=x.__value,ue.__value="10YGB----------A",ue.value=ue.__value,He.__value="10YLV-1001A00074",He.value=He.__value,Se.__value="10YLT-1001A0008Q",Se.value=Se.__value,de.__value="10YNL----------L",de.value=de.__value,ve.__value="10YPL-AREA-----S",ve.value=ve.__value,le.__value="10YCH-SWISSGRIDZ",le.value=le.__value,u(O,"name","pr"),u(O,"class","in-s"),t[3].p.r===void 0&&ze(()=>t[14].call(O)),u(L,"class","my-1"),u($t,"name","pc"),u($t,"class","in-f w-full"),t[3].p.c===void 0&&ze(()=>t[15].call($t)),u(Pe,"class","w-1/2"),u(tt,"name","pm"),u(tt,"type","number"),u(tt,"min","0.001"),u(tt,"max","1000"),u(tt,"step","0.001"),u(tt,"class","in-l tr w-full"),u(Qt,"class","w-1/2"),u(re,"class","flex"),u(qe,"class","my-1"),u(pt,"type","checkbox"),u(pt,"name","pe"),pt.__value="true",pt.value=pt.__value,u(pt,"class","rounded mb-1"),u(Zt,"class","my-1"),rl.__value=0,rl.value=rl.__value,al.__value=1,al.value=al.__value,Ue.__value=2,Ue.value=Ue.__value,u(_t,"name","gs"),u(_t,"class","in-s"),t[3].g.s===void 0&&ze(()=>t[19].call(_t)),u(Jt,"class","my-1"),u(n,"class","cnt"),u(Vl,"class","text-sm"),u(cl,"href",Lt("Meter-configuration")),u(cl,"target","_blank"),u(cl,"class","float-right"),u(zn,"type","hidden"),u(zn,"name","m"),zn.value="true",_l.__value=0,_l.value=_l.__value,_l.disabled=Ci=t[3].m.b!=0,u(qt,"name","mb"),u(qt,"class","in-f"),t[3].m.b===void 0&&ze(()=>t[22].call(qt)),dl.__value=0,dl.value=dl.__value,dl.disabled=Si=t[3].m.b!=0,Ql.__value=2,Ql.value=Ql.__value,Zl.__value=3,Zl.value=Zl.__value,Jl.__value=10,Jl.value=Jl.__value,Xl.__value=11,Xl.value=Xl.__value,u(xe,"name","mp"),u(xe,"class","in-l"),xe.disabled=Ti=t[3].m.b==0,t[3].m.p===void 0&&ze(()=>t[23].call(xe)),u(Ct,"name","mi"),Ct.__value="true",Ct.value=Ct.__value,u(Ct,"type","checkbox"),u(Ct,"class","rounded mb-1"),u(Yn,"class","mt-2 ml-3 whitespace-nowrap"),u(pl,"class","flex"),u(Kl,"class","my-1"),xl.__value=2,xl.value=xl.__value,en.__value=1,en.value=en.__value,u(Ut,"name","md"),u(Ut,"class","in-s"),t[3].m.d===void 0&&ze(()=>t[25].call(Ut)),u(Sl,"class","my-1"),u(St,"name","mf"),u(St,"type","number"),u(St,"min","5"),u(St,"max","65535"),u(St,"class","in-f tr w-full"),u(Pi,"class","in-post"),u(ln,"class","flex"),u(Tl,"class","mx-1"),u(Tt,"name","mr"),u(Tt,"type","number"),u(Tt,"min","0"),u(Tt,"max","65535"),u(Tt,"class","in-f tr w-full"),u(Mi,"class","in-post"),u(nn,"class","flex"),u(Pl,"class","mx-1"),u(tn,"class","my-1 flex"),u(_s,"class","my-1"),u(Pt,"type","checkbox"),u(Pt,"name","me"),Pt.__value="true",Pt.value=Pt.__value,u(Pt,"class","rounded mb-1"),u(Ml,"class","my-1"),u(Mt,"type","checkbox"),u(Mt,"name","mm"),Mt.__value="true",Mt.value=Mt.__value,u(Mt,"class","rounded mb-1"),u(Le,"class","cnt"),u(Ni,"class","text-sm"),u(sn,"href",Lt("WiFi-configuration")),u(sn,"target","_blank"),u(sn,"class","float-right"),u(Vn,"type","hidden"),u(Vn,"name","w"),Vn.value="true",u(Xt,"name","ws"),u(Xt,"type","text"),u(Xt,"class","in-s"),u(Al,"class","my-1"),u(xt,"name","wp"),u(xt,"type","password"),u(xt,"class","in-s"),u(Dl,"class","my-1"),rn.__value=255,rn.value=rn.__value,an.__value=0,an.value=an.__value,fn.__value=1,fn.value=fn.__value,cn.__value=2,cn.value=cn.__value,u(bt,"name","wz"),u(bt,"class","in-s"),t[3].w.z===void 0&&ze(()=>t[38].call(bt)),u(Nl,"class","w-1/2"),u(kt,"name","ww"),u(kt,"type","number"),u(kt,"min","0"),u(kt,"max","20.5"),u(kt,"step","0.5"),u(kt,"class","in-f tr w-full"),u(Ii,"class","in-post"),u(mn,"class","flex"),u(Il,"class","ml-2 w-1/2"),u(un,"class","my-1 flex"),u(At,"type","checkbox"),u(At,"name","wa"),At.__value="true",At.value=At.__value,u(At,"class","rounded mb-1"),u(Ei,"class","my-3"),u(Xe,"class","cnt"),u(Fi,"class","text-sm"),u(pn,"href",Lt("Network-configuration")),u(pn,"target","_blank"),u(pn,"class","float-right"),dn.__value="dhcp",dn.value=dn.__value,vn.__value="static",vn.value=vn.__value,u(Ht,"name","nm"),u(Ht,"class","in-f"),t[3].n.m===void 0&&ze(()=>t[41].call(Ht)),u(dt,"name","ni"),u(dt,"type","text"),u(dt,"class","in-m w-full"),dt.disabled=Li=t[3].n.m=="dhcp",dt.required=Oi=t[3].n.m=="static",u(vt,"name","ns"),u(vt,"class","in-l"),vt.disabled=qi=t[3].n.m=="dhcp",vt.required=Ui=t[3].n.m=="static",t[3].n.s===void 0&&ze(()=>t[43].call(vt)),u(vl,"class","flex"),u(El,"class","my-1"),u(Dt,"name","nd"),Dt.__value="true",Dt.value=Dt.__value,u(Dt,"type","checkbox"),u(Dt,"class","rounded mb-1"),u(Hi,"class","my-1"),u(Kn,"type","hidden"),u(Kn,"name","ntp"),Kn.value="true",u(Nt,"name","ntpd"),Nt.__value="true",Nt.value=Nt.__value,u(Nt,"type","checkbox"),u(Nt,"class","rounded mb-1"),u(Qn,"class","ml-4"),u(el,"name","ntph"),u(el,"type","text"),u(el,"class","in-s"),u(Wi,"class","flex"),u(hl,"class","my-1"),u(Je,"class","cnt"),u(Gi,"class","text-sm"),u(gn,"href",Lt("MQTT-configuration")),u(gn,"target","_blank"),u(gn,"class","float-right"),u(Zn,"type","hidden"),u(Zn,"name","q"),Zn.value="true",u(tl,"name","qh"),u(tl,"type","text"),u(tl,"class","in-f w-3/4"),u(It,"name","qp"),u(It,"type","number"),u(It,"min","1024"),u(It,"max","65535"),u(It,"class","in-l tr w-1/4"),u(kn,"class","flex"),u(jt,"class","my-1"),u(ll,"name","qu"),u(ll,"type","text"),u(ll,"class","in-s"),u(Rl,"class","my-1"),u(nl,"name","qa"),u(nl,"type","password"),u(nl,"class","in-s"),u(Fl,"class","my-1"),u(il,"name","qc"),u(il,"type","text"),u(il,"class","in-f w-full"),Cn.__value=0,Cn.value=Cn.__value,Sn.__value=1,Sn.value=Sn.__value,Tn.__value=2,Tn.value=Tn.__value,Pn.__value=3,Pn.value=Pn.__value,Mn.__value=4,Mn.value=Mn.__value,An.__value=255,An.value=An.__value,u(lt,"name","qm"),u(lt,"class","in-l"),t[3].q.m===void 0&&ze(()=>t[56].call(lt)),u(wn,"class","my-1 flex"),u(sl,"name","qb"),u(sl,"type","text"),u(sl,"class","in-s"),u(Ll,"class","my-1"),u(Ge,"class","cnt"),u(Bi,"class","text-sm"),u(Dn,"href",Lt("User-interface")),u(Dn,"target","_blank"),u(Dn,"class","float-right"),u(Jn,"type","hidden"),u(Jn,"name","u"),Jn.value="true",u(Xn,"class","flex flex-wrap"),u(Wt,"class","cnt"),u(zi,"class","text-sm"),u(In,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(In,"target","_blank"),u(In,"class","float-right"),u(xn,"type","hidden"),u(xn,"name","d"),xn.value="true",u(Et,"type","checkbox"),u(Et,"name","ds"),Et.__value="true",Et.value=Et.__value,u(Et,"class","rounded mb-1"),u(Yi,"class","mt-3"),u(ht,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(Rn,"type","button"),u(Rn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),u(Fn,"type","button"),u(Fn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(Ki,"class","text-center"),u(Qi,"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,r),V(a,r,null),s(n,f),s(n,c),s(n,p),s(n,_),s(_,d),s(d,g),s(g,h),s(g,b),s(g,C),s(g,k),Q(k,t[3].g.h),s(d,S),s(d,M),s(M,I),s(M,T),s(M,D),s(M,R),V(F,R,null),Re(R,t[3].g.t),s(n,H),s(n,j),s(n,E),s(n,L),s(L,W),s(L,G),s(L,q),s(L,O),s(O,U),s(U,X),s(U,z),s(U,ne),s(U,te),s(U,Te),s(O,pe),s(pe,Ne),s(pe,Ie),s(pe,Fe),s(pe,Ee),s(O,$e),s($e,ge),s($e,_e),s(O,ae),s(O,fe),s(O,oe),s(O,J),s(O,ie),s(O,Ce),s(O,x),s(O,ue),s(O,He),s(O,Se),s(O,de),s(O,ve),s(O,le),Re(O,t[3].p.r),s(n,he),s(n,qe),s(qe,re),s(re,Pe),s(Pe,fi),s(Pe,ci),s(Pe,mi),s(Pe,$t);for(let mt=0;mt<4;mt+=1)Zi[mt].m($t,null);Re($t,t[3].p.c),s(re,pi),s(re,Qt),s(Qt,_i),s(Qt,di),s(Qt,vi),s(Qt,tt),Q(tt,t[3].p.m),s(n,hi),s(n,Zt),s(Zt,Yl),s(Yl,pt),pt.checked=t[3].p.e,s(Yl,gi),s(Zt,bi),nt&&nt.m(Zt,null),s(n,ki),s(n,Jt),s(Jt,wi),s(Jt,yi),s(Jt,$i),s(Jt,_t),s(_t,rl),s(_t,al),s(_t,Ue),Re(_t,t[3].g.s),s(n,Bn),it&&it.m(n,null),s(l,Cl),s(l,Le),s(Le,Vl),s(Le,fl),s(Le,cl),V(ml,cl,null),s(Le,uo),s(Le,zn),s(Le,ro),s(Le,Kl),s(Kl,ps),s(Kl,ao),s(Kl,pl),s(pl,qt),s(qt,_l),s(_l,fo);for(let mt=0;mt<7;mt+=1)Ji[mt].m(qt,null);Re(qt,t[3].m.b),s(pl,co),s(pl,xe),s(xe,dl),s(dl,mo),s(xe,Ql),s(xe,Zl),s(xe,Jl),s(xe,Xl),Re(xe,t[3].m.p),s(pl,po),s(pl,Yn),s(Yn,Ct),Ct.checked=t[3].m.i,s(Yn,_o),s(Le,vo),s(Le,Sl),s(Sl,ho),s(Sl,go),s(Sl,bo),s(Sl,Ut),s(Ut,xl),s(Ut,en),Re(Ut,t[3].m.d),s(Le,ko),s(Le,tn),s(tn,Tl),s(Tl,wo),s(Tl,yo),s(Tl,$o),s(Tl,ln),s(ln,St),Q(St,t[3].m.f),s(ln,Co),s(ln,Pi),s(tn,So),s(tn,Pl),s(Pl,To),s(Pl,Po),s(Pl,Mo),s(Pl,nn),s(nn,Tt),Q(Tt,t[3].m.r),s(nn,Ao),s(nn,Mi),s(Le,Do),s(Le,_s),s(Le,No),s(Le,Ml),s(Ml,Ai),s(Ai,Pt),Pt.checked=t[3].m.e.e,s(Ai,Io),s(Ml,Eo),st&&st.m(Ml,null),s(Le,Ro),ot&&ot.m(Le,null),s(Le,ds),s(Le,Di),s(Di,Mt),Mt.checked=t[3].m.m.e,s(Di,Fo),s(Le,Lo),ut&&ut.m(Le,null),s(l,Oo),s(l,Xe),s(Xe,Ni),s(Xe,qo),s(Xe,sn),V(on,sn,null),s(Xe,Uo),s(Xe,Vn),s(Xe,Ho),s(Xe,Al),s(Al,jo),s(Al,Wo),s(Al,Go),s(Al,Xt),Q(Xt,t[3].w.s),s(Xe,Bo),s(Xe,Dl),s(Dl,zo),s(Dl,Yo),s(Dl,Vo),s(Dl,xt),Q(xt,t[3].w.p),s(Xe,Ko),s(Xe,un),s(un,Nl),s(Nl,Qo),s(Nl,Zo),s(Nl,Jo),s(Nl,bt),s(bt,rn),s(bt,an),s(bt,fn),s(bt,cn),Re(bt,t[3].w.z),s(un,Xo),s(un,Il),s(Il,xo),s(Il,eu),s(Il,tu),s(Il,mn),s(mn,kt),Q(kt,t[3].w.w),s(mn,lu),s(mn,Ii),s(Xe,nu),s(Xe,Ei),s(Ei,Ri),s(Ri,At),At.checked=t[3].w.a,s(Ri,iu),s(l,su),s(l,Je),s(Je,Fi),s(Je,ou),s(Je,pn),V(_n,pn,null),s(Je,uu),s(Je,El),s(El,ru),s(El,au),s(El,fu),s(El,vl),s(vl,Ht),s(Ht,dn),s(Ht,vn),Re(Ht,t[3].n.m),s(vl,cu),s(vl,dt),Q(dt,t[3].n.i),s(vl,mu),s(vl,vt),V(hn,vt,null),Re(vt,t[3].n.s),s(Je,pu),rt&&rt.m(Je,null),s(Je,vs),s(Je,Hi),s(Hi,ji),s(ji,Dt),Dt.checked=t[3].n.d,s(ji,_u),s(Je,du),s(Je,Kn),s(Je,vu),s(Je,hl),s(hl,hu),s(hl,Qn),s(Qn,Nt),Nt.checked=t[3].n.h,s(Qn,gu),s(hl,bu),s(hl,ku),s(hl,Wi),s(Wi,el),Q(el,t[3].n.n1),s(l,wu),s(l,Ge),s(Ge,Gi),s(Ge,yu),s(Ge,gn),V(bn,gn,null),s(Ge,$u),s(Ge,Zn),s(Ge,Cu),s(Ge,jt),s(jt,Su),at&&at.m(jt,null),s(jt,hs),s(jt,Tu),s(jt,Pu),s(jt,kn),s(kn,tl),Q(tl,t[3].q.h),s(kn,Mu),s(kn,It),Q(It,t[3].q.p),s(Ge,Au),Ye&&Ye.m(Ge,null),s(Ge,gs),s(Ge,Rl),s(Rl,Du),s(Rl,Nu),s(Rl,Iu),s(Rl,ll),Q(ll,t[3].q.u),s(Ge,Eu),s(Ge,Fl),s(Fl,Ru),s(Fl,Fu),s(Fl,Lu),s(Fl,nl),Q(nl,t[3].q.a),s(Ge,Ou),s(Ge,wn),s(wn,yn),s(yn,qu),s(yn,Uu),s(yn,Hu),s(yn,il),Q(il,t[3].q.c),s(wn,ju),s(wn,$n),s($n,Wu),s($n,Gu),s($n,Bu),s($n,lt),s(lt,Cn),s(lt,Sn),s(lt,Tn),s(lt,Pn),s(lt,Mn),s(lt,An),Re(lt,t[3].q.m),s(Ge,zu),s(Ge,Ll),s(Ll,Yu),s(Ll,Vu),s(Ll,Ku),s(Ll,sl),Q(sl,t[3].q.b),s(l,Qu),Ve&&Ve.m(l,null),s(l,bs),Ke&&Ke.m(l,null),s(l,ws),s(l,Wt),s(Wt,Bi),s(Wt,Zu),s(Wt,Dn),V(Nn,Dn,null),s(Wt,Ju),s(Wt,Jn),s(Wt,Xu),s(Wt,Xn);for(let mt=0;mt<ft.length;mt+=1)ft[mt].m(Xn,null);s(l,xu),Qe&&Qe.m(l,null),s(l,ys),s(l,ht),s(ht,zi),s(ht,er),s(ht,In),V(En,In,null),s(ht,tr),s(ht,xn),s(ht,lr),s(ht,Yi),s(Yi,Vi),s(Vi,Et),Et.checked=t[3].d.s,s(Vi,nr),s(ht,ir),ct&&ct.m(ht,null),s(e,sr),s(e,gl),s(gl,$s),s($s,Rn),s(gl,or),s(gl,Ki),s(Ki,Fn),s(gl,ur),s(gl,Qi),y(A,Cs,ee),V(Ol,A,ee),y(A,Ss,ee),V(ql,A,ee),y(A,Ts,ee),V(Ul,A,ee),y(A,Ps,ee),V(Hl,A,ee),Rt=!0,Ms||(rr=[Y(k,"input",t[12]),Y(R,"change",t[13]),Y(O,"change",t[14]),Y($t,"change",t[15]),Y(tt,"input",t[16]),Y(pt,"change",t[17]),Y(_t,"change",t[19]),Y(qt,"change",t[22]),Y(xe,"change",t[23]),Y(Ct,"change",t[24]),Y(Ut,"change",t[25]),Y(St,"input",t[26]),Y(Tt,"input",t[27]),Y(Pt,"change",t[28]),Y(Mt,"change",t[31]),Y(Xt,"input",t[36]),Y(xt,"input",t[37]),Y(bt,"change",t[38]),Y(kt,"input",t[39]),Y(At,"change",t[40]),Y(Ht,"change",t[41]),Y(dt,"input",t[42]),Y(vt,"change",t[43]),Y(Dt,"change",t[47]),Y(Nt,"change",t[48]),Y(el,"input",t[49]),Y(tl,"input",t[51]),Y(It,"input",t[52]),Y(ll,"input",t[53]),Y(nl,"input",t[54]),Y(il,"input",t[55]),Y(lt,"change",t[56]),Y(sl,"input",t[57]),Y(Et,"change",t[82]),Y(Rn,"click",t[8]),Y(Fn,"click",t[10]),Y(e,"submit",cs(t[9]))],Ms=!0)},p(A,ee){if(ee[0]&8&&k.value!==A[3].g.h&&Q(k,A[3].g.h),ee[0]&8&&Re(R,A[3].g.t),ee[0]&8&&Re(O,A[3].p.r),ee[0]&8&&Re($t,A[3].p.c),ee[0]&8&&ce(tt.value)!==A[3].p.m&&Q(tt,A[3].p.m),ee[0]&8&&(pt.checked=A[3].p.e),A[3].p.e&&A[0].chip!="esp8266"?nt?nt.p(A,ee):(nt=Aa(A),nt.c(),nt.m(Zt,null)):nt&&(nt.d(1),nt=null),ee[0]&8&&Re(_t,A[3].g.s),A[3].g.s>0?it?it.p(A,ee):(it=Da(A),it.c(),it.m(n,null)):it&&(it.d(1),it=null),(!Rt||ee[0]&8&&Ci!==(Ci=A[3].m.b!=0))&&(_l.disabled=Ci),ee[0]&8&&Re(qt,A[3].m.b),(!Rt||ee[0]&8&&Si!==(Si=A[3].m.b!=0))&&(dl.disabled=Si),(!Rt||ee[0]&8&&Ti!==(Ti=A[3].m.b==0))&&(xe.disabled=Ti),ee[0]&8&&Re(xe,A[3].m.p),ee[0]&8&&(Ct.checked=A[3].m.i),ee[0]&8&&Re(Ut,A[3].m.d),ee[0]&8&&ce(St.value)!==A[3].m.f&&Q(St,A[3].m.f),ee[0]&8&&ce(Tt.value)!==A[3].m.r&&Q(Tt,A[3].m.r),ee[0]&8&&(Pt.checked=A[3].m.e.e),A[3].m.e.e?st?st.p(A,ee):(st=Na(A),st.c(),st.m(Ml,null)):st&&(st.d(1),st=null),A[3].m.e.e?ot?ot.p(A,ee):(ot=Ia(A),ot.c(),ot.m(Le,ds)):ot&&(ot.d(1),ot=null),ee[0]&8&&(Mt.checked=A[3].m.m.e),A[3].m.m.e?ut?ut.p(A,ee):(ut=Ea(A),ut.c(),ut.m(Le,null)):ut&&(ut.d(1),ut=null),ee[0]&8&&Xt.value!==A[3].w.s&&Q(Xt,A[3].w.s),ee[0]&8&&xt.value!==A[3].w.p&&Q(xt,A[3].w.p),ee[0]&8&&Re(bt,A[3].w.z),ee[0]&8&&ce(kt.value)!==A[3].w.w&&Q(kt,A[3].w.w),ee[0]&8&&(At.checked=A[3].w.a),ee[0]&8&&Re(Ht,A[3].n.m),(!Rt||ee[0]&8&&Li!==(Li=A[3].n.m=="dhcp"))&&(dt.disabled=Li),(!Rt||ee[0]&8&&Oi!==(Oi=A[3].n.m=="static"))&&(dt.required=Oi),ee[0]&8&&dt.value!==A[3].n.i&&Q(dt,A[3].n.i),(!Rt||ee[0]&8&&qi!==(qi=A[3].n.m=="dhcp"))&&(vt.disabled=qi),(!Rt||ee[0]&8&&Ui!==(Ui=A[3].n.m=="static"))&&(vt.required=Ui),ee[0]&8&&Re(vt,A[3].n.s),A[3].n.m=="static"?rt?rt.p(A,ee):(rt=Ra(A),rt.c(),rt.m(Je,vs)):rt&&(rt.d(1),rt=null),ee[0]&8&&(Dt.checked=A[3].n.d),ee[0]&8&&(Nt.checked=A[3].n.h),ee[0]&8&&el.value!==A[3].n.n1&&Q(el,A[3].n.n1),A[0].chip!="esp8266"?at?at.p(A,ee):(at=Fa(A),at.c(),at.m(jt,hs)):at&&(at.d(1),at=null),ee[0]&8&&tl.value!==A[3].q.h&&Q(tl,A[3].q.h),ee[0]&8&&ce(It.value)!==A[3].q.p&&Q(It,A[3].q.p),A[3].q.s.e?Ye?(Ye.p(A,ee),ee[0]&8&&P(Ye,1)):(Ye=La(A),Ye.c(),P(Ye,1),Ye.m(Ge,gs)):Ye&&(Me(),N(Ye,1,1,()=>{Ye=null}),Ae()),ee[0]&8&&ll.value!==A[3].q.u&&Q(ll,A[3].q.u),ee[0]&8&&nl.value!==A[3].q.a&&Q(nl,A[3].q.a),ee[0]&8&&il.value!==A[3].q.c&&Q(il,A[3].q.c),ee[0]&8&&Re(lt,A[3].q.m),ee[0]&8&&sl.value!==A[3].q.b&&Q(sl,A[3].q.b),A[3].q.m==3?Ve?(Ve.p(A,ee),ee[0]&8&&P(Ve,1)):(Ve=Oa(A),Ve.c(),P(Ve,1),Ve.m(l,bs)):Ve&&(Me(),N(Ve,1,1,()=>{Ve=null}),Ae()),ee[0]&8&&(ks=A[3].p.r.startsWith("10YNO")||A[3].p.r=="10Y1001A1001A48H"),ks?Ke?(Ke.p(A,ee),ee[0]&8&&P(Ke,1)):(Ke=qa(A),Ke.c(),P(Ke,1),Ke.m(l,ws)):Ke&&(Me(),N(Ke,1,1,()=>{Ke=null}),Ae()),ee[0]&136){Ln=A[7];let wt;for(wt=0;wt<Ln.length;wt+=1){const mr=Pa(A,Ln,wt);ft[wt]?ft[wt].p(mr,ee):(ft[wt]=Ha(mr),ft[wt].c(),ft[wt].m(Xn,null))}for(;wt<ft.length;wt+=1)ft[wt].d(1);ft.length=Ln.length}A[0].board>20||A[0].chip=="esp8266"?Qe?(Qe.p(A,ee),ee[0]&1&&P(Qe,1)):(Qe=ja(A),Qe.c(),P(Qe,1),Qe.m(l,ys)):Qe&&(Me(),N(Qe,1,1,()=>{Qe=null}),Ae()),ee[0]&8&&(Et.checked=A[3].d.s),A[3].d.s?ct?ct.p(A,ee):(ct=Va(A),ct.c(),ct.m(ht,null)):ct&&(ct.d(1),ct=null);const mt={};ee[0]&2&&(mt.active=A[1]),Ol.$set(mt);const ar={};ee[0]&4&&(ar.active=A[2]),ql.$set(ar);const fr={};ee[0]&16&&(fr.active=A[4]),Ul.$set(fr);const cr={};ee[0]&32&&(cr.active=A[5]),Hl.$set(cr)},i(A){Rt||(P(a.$$.fragment,A),P(F.$$.fragment,A),P(ml.$$.fragment,A),P(on.$$.fragment,A),P(_n.$$.fragment,A),P(hn.$$.fragment,A),P(bn.$$.fragment,A),P(Ye),P(Ve),P(Ke),P(Nn.$$.fragment,A),P(Qe),P(En.$$.fragment,A),P(Ol.$$.fragment,A),P(ql.$$.fragment,A),P(Ul.$$.fragment,A),P(Hl.$$.fragment,A),Rt=!0)},o(A){N(a.$$.fragment,A),N(F.$$.fragment,A),N(ml.$$.fragment,A),N(on.$$.fragment,A),N(_n.$$.fragment,A),N(hn.$$.fragment,A),N(bn.$$.fragment,A),N(Ye),N(Ve),N(Ke),N(Nn.$$.fragment,A),N(Qe),N(En.$$.fragment,A),N(Ol.$$.fragment,A),N(ql.$$.fragment,A),N(Ul.$$.fragment,A),N(Hl.$$.fragment,A),Rt=!1},d(A){A&&w(e),K(a),K(F),Vt(Zi,A),nt&&nt.d(),it&&it.d(),K(ml),Vt(Ji,A),st&&st.d(),ot&&ot.d(),ut&&ut.d(),K(on),K(_n),K(hn),rt&&rt.d(),K(bn),at&&at.d(),Ye&&Ye.d(),Ve&&Ve.d(),Ke&&Ke.d(),K(Nn),Vt(ft,A),Qe&&Qe.d(),K(En),ct&&ct.d(),A&&w(Cs),K(Ol,A),A&&w(Ss),K(ql,A),A&&w(Ts),K(Ul,A),A&&w(Ps),K(Hl,A),Ms=!1,Be(rr)}}}async function gp(){await(await fetch("/reboot",{method:"POST"})).json()}function bp(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,r=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:null,a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}}};uc.subscribe(Ue=>{Ue.version&&(l(3,a=Ue),l(1,o=!1))}),Qm();let f=!1,c=!1;async function p(){if(confirm("Are you sure you want to factory reset the device?")){l(4,f=!0);const Ue=new URLSearchParams;Ue.append("perform","true");let Cl=await(await fetch("/reset",{method:"POST",body:Ue})).json();l(4,f=!1),l(5,c=Cl.success)}}async function _(Ue){l(2,r=!0);const Bn=new FormData(Ue.target),Cl=new URLSearchParams;for(let fl of Bn){const[cl,ml]=fl;Cl.append(cl,ml)}let Vl=await(await fetch("/save",{method:"POST",body:Cl})).json();yt.update(fl=>(fl.booting=Vl.reboot,fl.ui=a.u,fl)),l(2,r=!1),Un("/")}const d=function(){confirm("Are you sure you want to reboot the device?")&&(yt.update(Ue=>(Ue.booting=!0,Ue)),gp())},g=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let h=44;function b(){a.g.h=this.value,l(3,a)}function C(){a.g.t=et(this),l(3,a)}function k(){a.p.r=et(this),l(3,a)}function S(){a.p.c=et(this),l(3,a)}function M(){a.p.m=ce(this.value),l(3,a)}function I(){a.p.e=this.checked,l(3,a)}function T(){a.p.t=this.value,l(3,a)}function D(){a.g.s=et(this),l(3,a)}function R(){a.g.u=this.value,l(3,a)}function F(){a.g.p=this.value,l(3,a)}function H(){a.m.b=et(this),l(3,a)}function j(){a.m.p=et(this),l(3,a)}function E(){a.m.i=this.checked,l(3,a)}function L(){a.m.d=et(this),l(3,a)}function W(){a.m.f=ce(this.value),l(3,a)}function G(){a.m.r=ce(this.value),l(3,a)}function q(){a.m.e.e=this.checked,l(3,a)}function O(){a.m.e.k=this.value,l(3,a)}function U(){a.m.e.a=this.value,l(3,a)}function X(){a.m.m.e=this.checked,l(3,a)}function z(){a.m.m.w=ce(this.value),l(3,a)}function ne(){a.m.m.v=ce(this.value),l(3,a)}function te(){a.m.m.a=ce(this.value),l(3,a)}function Te(){a.m.m.c=ce(this.value),l(3,a)}function pe(){a.w.s=this.value,l(3,a)}function Ne(){a.w.p=this.value,l(3,a)}function Ie(){a.w.z=et(this),l(3,a)}function Fe(){a.w.w=ce(this.value),l(3,a)}function Ee(){a.w.a=this.checked,l(3,a)}function $e(){a.n.m=et(this),l(3,a)}function ge(){a.n.i=this.value,l(3,a)}function _e(){a.n.s=et(this),l(3,a)}function ae(){a.n.g=this.value,l(3,a)}function fe(){a.n.d1=this.value,l(3,a)}function oe(){a.n.d2=this.value,l(3,a)}function J(){a.n.d=this.checked,l(3,a)}function ie(){a.n.h=this.checked,l(3,a)}function Ce(){a.n.n1=this.value,l(3,a)}function x(){a.q.s.e=this.checked,l(3,a)}function ue(){a.q.h=this.value,l(3,a)}function He(){a.q.p=ce(this.value),l(3,a)}function Se(){a.q.u=this.value,l(3,a)}function de(){a.q.a=this.value,l(3,a)}function ve(){a.q.c=this.value,l(3,a)}function le(){a.q.m=et(this),l(3,a)}function he(){a.q.b=this.value,l(3,a)}function qe(){a.o.e=this.value,l(3,a)}function re(){a.o.c=this.value,l(3,a)}function Pe(){a.o.u1=this.value,l(3,a)}function fi(){a.o.u2=this.value,l(3,a)}function ci(){a.o.u3=this.value,l(3,a)}function mi(Ue){a.t.t[Ue]=ce(this.value),l(3,a)}function $t(){a.t.h=ce(this.value),l(3,a)}function pi(Ue){a.u[Ue.key]=et(this),l(3,a)}function Qt(){a.i.h=et(this),l(3,a)}function _i(){a.i.a=ce(this.value),l(3,a)}function di(){a.i.l.i=this.checked,l(3,a)}function vi(){a.i.l.p=ce(this.value),l(3,a)}function tt(){a.i.r.i=this.checked,l(3,a)}function hi(){a.i.r.r=ce(this.value),l(3,a)}function Zt(){a.i.r.g=ce(this.value),l(3,a)}function Yl(){a.i.r.b=ce(this.value),l(3,a)}function pt(){a.i.t.d=ce(this.value),l(3,a)}function gi(){a.i.t.a=ce(this.value),l(3,a)}function bi(){a.i.v.p=ce(this.value),l(3,a)}function ki(){a.i.v.d.v=ce(this.value),l(3,a)}function Jt(){a.i.v.d.g=ce(this.value),l(3,a)}function wi(){a.i.v.o=ce(this.value),l(3,a)}function yi(){a.i.v.m=ce(this.value),l(3,a)}function $i(){a.i.v.b=ce(this.value),l(3,a)}function _t(){a.d.s=this.checked,l(3,a)}function rl(){a.d.t=this.checked,l(3,a)}function al(){a.d.l=et(this),l(3,a)}return t.$$set=Ue=>{"sysinfo"in Ue&&l(0,n=Ue.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,h=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,r,a,f,c,h,i,p,_,d,g,b,C,k,S,M,I,T,D,R,F,H,j,E,L,W,G,q,O,U,X,z,ne,te,Te,pe,Ne,Ie,Fe,Ee,$e,ge,_e,ae,fe,oe,J,ie,Ce,x,ue,He,Se,de,ve,le,he,qe,re,Pe,fi,ci,mi,$t,pi,Qt,_i,di,vi,tt,hi,Zt,Yl,pt,gi,bi,ki,Jt,wi,yi,$i,_t,rl,al]}class kp extends ye{constructor(e){super(),we(this,e,bp,hp,ke,{sysinfo:0},null,[-1,-1,-1,-1])}}function Qa(t,e,l){const n=t.slice();return n[20]=e[l],n}function wp(t){let e=me(t[1].chip,t[1].board)+"",l;return{c(){l=$(e)},m(n,i){y(n,l,i)},p(n,i){i&2&&e!==(e=me(n[1].chip,n[1].board)+"")&&B(l,e)},d(n){n&&w(l)}}}function Za(t){let e,l,n=t[1].apmac+"",i,o,r,a,f=Ar(t[1])+"",c,p,_=t[1].boot_reason+"",d,g;return{c(){e=m("div"),l=$("AP MAC: "),i=$(n),o=v(),r=m("div"),a=$("Last boot: "),c=$(f),p=$(" ("),d=$(_),g=$(")"),u(e,"class","my-2"),u(r,"class","my-2")},m(h,b){y(h,e,b),s(e,l),s(e,i),y(h,o,b),y(h,r,b),s(r,a),s(r,c),s(r,p),s(r,d),s(r,g)},p(h,b){b&2&&n!==(n=h[1].apmac+"")&&B(i,n),b&2&&f!==(f=Ar(h[1])+"")&&B(c,f),b&2&&_!==(_=h[1].boot_reason+"")&&B(d,_)},d(h){h&&w(e),h&&w(o),h&&w(r)}}}function yp(t){let e;return{c(){e=m("span"),e.textContent="Update consents",u(e,"class","btn-pri-sm")},m(l,n){y(l,e,n)},p:se,d(l){l&&w(e)}}}function Ja(t){let e,l,n,i,o,r=as(t[1].meter.mfg)+"",a,f,c,p,_=t[1].meter.model+"",d,g,h,b,C=t[1].meter.id+"",k;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=v(),i=m("div"),o=$("Manufacturer: "),a=$(r),f=v(),c=m("div"),p=$("Model: "),d=$(_),g=v(),h=m("div"),b=$("ID: "),k=$(C),u(l,"class","text-sm"),u(i,"class","my-2"),u(c,"class","my-2"),u(h,"class","my-2"),u(e,"class","cnt")},m(S,M){y(S,e,M),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,p),s(c,d),s(e,g),s(e,h),s(h,b),s(h,k)},p(S,M){M&2&&r!==(r=as(S[1].meter.mfg)+"")&&B(a,r),M&2&&_!==(_=S[1].meter.model+"")&&B(d,_),M&2&&C!==(C=S[1].meter.id+"")&&B(k,C)},d(S){S&&w(e)}}}function Xa(t){let e,l,n,i,o,r=t[1].net.ip+"",a,f,c,p,_=t[1].net.mask+"",d,g,h,b,C=t[1].net.gw+"",k,S,M,I,T=t[1].net.dns1+"",D,R,F=t[1].net.dns2&&xa(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=v(),i=m("div"),o=$("IP: "),a=$(r),f=v(),c=m("div"),p=$("Mask: "),d=$(_),g=v(),h=m("div"),b=$("Gateway: "),k=$(C),S=v(),M=m("div"),I=$("DNS: "),D=$(T),R=v(),F&&F.c(),u(l,"class","text-sm"),u(i,"class","my-2"),u(c,"class","my-2"),u(h,"class","my-2"),u(M,"class","my-2"),u(e,"class","cnt")},m(H,j){y(H,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,p),s(c,d),s(e,g),s(e,h),s(h,b),s(h,k),s(e,S),s(e,M),s(M,I),s(M,D),s(M,R),F&&F.m(M,null)},p(H,j){j&2&&r!==(r=H[1].net.ip+"")&&B(a,r),j&2&&_!==(_=H[1].net.mask+"")&&B(d,_),j&2&&C!==(C=H[1].net.gw+"")&&B(k,C),j&2&&T!==(T=H[1].net.dns1+"")&&B(D,T),H[1].net.dns2?F?F.p(H,j):(F=xa(H),F.c(),F.m(M,null)):F&&(F.d(1),F=null)},d(H){H&&w(e),F&&F.d()}}}function xa(t){let e,l=t[1].net.dns2+"",n;return{c(){e=$("/ "),n=$(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 ef(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name&&tf(t),d=t[1].fwconsent===2&&lf();return{c(){e=m("div"),l=$(`Latest version:
|
|
`),n=m("a"),o=$(i),a=v(),_&&_.c(),f=v(),d&&d.c(),c=We(),u(n,"href",r=t[2].html_url),u(n,"class","ml-2 text-blue-600 hover:text-blue-800"),u(n,"target","_blank"),u(n,"rel","noreferrer"),u(e,"class","my-2 flex")},m(g,h){y(g,e,h),s(e,l),s(e,n),s(n,o),s(e,a),_&&_.m(e,null),y(g,f,h),d&&d.m(g,h),y(g,c,h),p=!0},p(g,h){(!p||h&4)&&i!==(i=g[2].tag_name+"")&&B(o,i),(!p||h&4&&r!==(r=g[2].html_url))&&u(n,"href",r),(g[1].security==0||g[0].a)&&g[1].fwconsent===1&&g[2]&&g[2].tag_name?_?(_.p(g,h),h&7&&P(_,1)):(_=tf(g),_.c(),P(_,1),_.m(e,null)):_&&(Me(),N(_,1,1,()=>{_=null}),Ae()),g[1].fwconsent===2?d||(d=lf(),d.c(),d.m(c.parentNode,c)):d&&(d.d(1),d=null)},i(g){p||(P(_),p=!0)},o(g){N(_),p=!1},d(g){g&&w(e),_&&_.d(),g&&w(f),d&&d.d(g),g&&w(c)}}}function tf(t){let e,l,n,i,o,r;return n=new sc({}),{c(){e=m("div"),l=m("button"),Z(n.$$.fragment),u(e,"class","flex-none ml-2 text-green-500"),u(e,"title","Install this version")},m(a,f){y(a,e,f),s(e,l),V(n,l,null),i=!0,o||(r=Y(l,"click",t[10]),o=!0)},p:se,i(a){i||(P(n.$$.fragment,a),i=!0)},o(a){N(n.$$.fragment,a),i=!1},d(a){a&&w(e),K(n),o=!1,r()}}}function lf(t){let e;return{c(){e=m("div"),e.innerHTML='<div class="bd-yellow">You have disabled one-click firmware upgrade, link to self-upgrade is disabled</div>',u(e,"class","my-2")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function nf(t){let e,l=fs(me(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=$(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=fs(me(i[1].chip,i[1].board))+"")&&B(n,l)},d(i){i&&w(e)}}}function sf(t){let e,l,n,i,o,r;function a(p,_){return p[4].length==0?Cp:$p}let f=a(t),c=f(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=v(),c.c(),wf(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","/firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(e,"class","my-2 flex")},m(p,_){y(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),c.m(l,null),o||(r=[Y(n,"change",t[13]),Y(l,"submit",t[15])],o=!0)},p(p,_){f===(f=a(p))&&c?c.p(p,_):(c.d(1),c=f(p),c&&(c.c(),c.m(l,null)))},d(p){p&&w(e),t[12](null),c.d(),o=!1,Be(r)}}}function $p(t){let e=t[4][0].name+"",l,n,i;return{c(){l=$(e),n=v(),i=m("button"),i.textContent="Upload",u(i,"type","submit"),u(i,"class","btn-pri-sm float-right")},m(o,r){y(o,l,r),y(o,n,r),y(o,i,r)},p(o,r){r&16&&e!==(e=o[4][0].name+"")&&B(l,e)},d(o){o&&w(l),o&&w(n),o&&w(i)}}}function Cp(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(i,o){y(i,e,o),l||(n=Y(e,"click",t[14]),l=!0)},p:se,d(i){i&&w(e),l=!1,n()}}}function of(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b=t[9],C=[];for(let T=0;T<b.length;T+=1)C[T]=uf(Qa(t,b,T));let k=t[7].length==0&&rf();function S(T,D){return T[7].length==0?Tp:Sp}let M=S(t),I=M(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Backup & restore",n=v(),i=m("form"),o=m("div");for(let T=0;T<C.length;T+=1)C[T].c();r=v(),a=m("label"),a.innerHTML='<input type="checkbox" class="rounded" name="ic" value="true"/> Include Secrets<br/><small>(SSID, PSK, passwords and tokens)</small>',f=v(),k&&k.c(),c=v(),p=m("form"),_=m("input"),d=v(),I.c(),u(l,"class","text-sm"),u(a,"class","my-1 mx-3 col-span-2"),u(o,"class","grid grid-cols-2"),u(i,"method","get"),u(i,"action","/configfile.cfg"),u(i,"autocomplete","off"),wf(_,"display","none"),u(_,"name","file"),u(_,"type","file"),u(_,"accept",".cfg"),u(p,"action","/configfile"),u(p,"enctype","multipart/form-data"),u(p,"method","post"),u(p,"autocomplete","off"),u(e,"class","cnt")},m(T,D){y(T,e,D),s(e,l),s(e,n),s(e,i),s(i,o);for(let R=0;R<C.length;R+=1)C[R].m(o,null);s(o,r),s(o,a),s(i,f),k&&k.m(i,null),s(e,c),s(e,p),s(p,_),t[16](_),s(p,d),I.m(p,null),g||(h=[Y(_,"change",t[17]),Y(p,"submit",t[19])],g=!0)},p(T,D){if(D&512){b=T[9];let R;for(R=0;R<b.length;R+=1){const F=Qa(T,b,R);C[R]?C[R].p(F,D):(C[R]=uf(F),C[R].c(),C[R].m(o,r))}for(;R<C.length;R+=1)C[R].d(1);C.length=b.length}T[7].length==0?k||(k=rf(),k.c(),k.m(i,null)):k&&(k.d(1),k=null),M===(M=S(T))&&I?I.p(T,D):(I.d(1),I=M(T),I&&(I.c(),I.m(p,null)))},d(T){T&&w(e),Vt(C,T),k&&k.d(),t[16](null),I.d(),g=!1,Be(h)}}}function uf(t){let e,l,n,i=t[20].name+"",o;return{c(){e=m("label"),l=m("input"),n=v(),o=$(i),u(l,"type","checkbox"),u(l,"class","rounded"),u(l,"name",t[20].key),l.value="true",l.checked=!0,u(e,"class","my-1 mx-3")},m(r,a){y(r,e,a),s(e,l),s(e,n),s(e,o)},p:se,d(r){r&&w(e)}}}function rf(t){let e;return{c(){e=m("button"),e.textContent="Download",u(e,"type","submit"),u(e,"class","btn-pri-sm float-right")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Sp(t){let e=t[7][0].name+"",l,n,i;return{c(){l=$(e),n=v(),i=m("button"),i.textContent="Upload",u(i,"type","submit"),u(i,"class","btn-pri-sm")},m(o,r){y(o,l,r),y(o,n,r),y(o,i,r)},p(o,r){r&128&&e!==(e=o[7][0].name+"")&&B(l,e)},d(o){o&&w(l),o&&w(n),o&&w(i)}}}function Tp(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select file...",u(e,"type","button"),u(e,"class","btn-pri-sm")},m(i,o){y(i,e,o),l||(n=Y(e,"click",t[18]),l=!0)},p:se,d(i){i&&w(e),l=!1,n()}}}function Pp(t){let e,l,n,i,o,r,a=t[1].chip+"",f,c,p,_,d,g,h,b,C=t[1].mac+"",k,S,M,I,T,D,R,F,H,j,E,L,W,G,q,O=t[1].version+"",U,X,z,ne=(t[1].security==0||t[0].a)&&Hn(t[1].board),te,Te,pe,Ne,Ie,Fe,Ee,$e,ge;d=new kl({props:{to:"/vendor",$$slots:{default:[wp]},$$scope:{ctx:t}}});let _e=t[1].apmac&&t[1].apmac!=t[1].mac&&Za(t);T=new kl({props:{to:"/consent",$$slots:{default:[yp]},$$scope:{ctx:t}}});let ae=t[1].meter&&Ja(t),fe=t[1].net&&Xa(t),oe=t[2]&&ef(t),J=ne&&nf(t),ie=(t[1].security==0||t[0].a)&&sf(t),Ce=(t[1].security==0||t[0].a)&&of(t);return Ne=new gt({props:{active:t[5],message:"Uploading firmware, please wait"}}),Fe=new gt({props:{active:t[8],message:"Uploading configuration, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),n.textContent="Device information",i=v(),o=m("div"),r=$("Chip: "),f=$(a),c=v(),p=m("div"),_=$("Device: "),Z(d.$$.fragment),g=v(),h=m("div"),b=$("MAC: "),k=$(C),S=v(),_e&&_e.c(),M=v(),I=m("div"),Z(T.$$.fragment),D=v(),R=m("button"),R.textContent="Reboot",F=v(),ae&&ae.c(),H=v(),fe&&fe.c(),j=v(),E=m("div"),L=m("strong"),L.textContent="Firmware",W=v(),G=m("div"),q=$("Installed version: "),U=$(O),X=v(),oe&&oe.c(),z=v(),J&&J.c(),te=v(),ie&&ie.c(),Te=v(),Ce&&Ce.c(),pe=v(),Z(Ne.$$.fragment),Ie=v(),Z(Fe.$$.fragment),u(n,"class","text-sm"),u(o,"class","my-2"),u(p,"class","my-2"),u(h,"class","my-2"),u(R,"class","text-xs py-1 px-2 rounded bg-yellow-500 text-white mr-3 float-right"),u(I,"class","my-2"),u(l,"class","cnt"),u(L,"class","text-sm"),u(G,"class","my-2"),u(E,"class","cnt"),u(e,"class","grid xl:grid-cols-5 lg:grid-cols-3 md:grid-cols-2")},m(x,ue){y(x,e,ue),s(e,l),s(l,n),s(l,i),s(l,o),s(o,r),s(o,f),s(l,c),s(l,p),s(p,_),V(d,p,null),s(l,g),s(l,h),s(h,b),s(h,k),s(l,S),_e&&_e.m(l,null),s(l,M),s(l,I),V(T,I,null),s(I,D),s(I,R),s(e,F),ae&&ae.m(e,null),s(e,H),fe&&fe.m(e,null),s(e,j),s(e,E),s(E,L),s(E,W),s(E,G),s(G,q),s(G,U),s(E,X),oe&&oe.m(E,null),s(E,z),J&&J.m(E,null),s(E,te),ie&&ie.m(E,null),s(e,Te),Ce&&Ce.m(e,null),y(x,pe,ue),V(Ne,x,ue),y(x,Ie,ue),V(Fe,x,ue),Ee=!0,$e||(ge=Y(R,"click",t[11]),$e=!0)},p(x,[ue]){(!Ee||ue&2)&&a!==(a=x[1].chip+"")&&B(f,a);const He={};ue&8388610&&(He.$$scope={dirty:ue,ctx:x}),d.$set(He),(!Ee||ue&2)&&C!==(C=x[1].mac+"")&&B(k,C),x[1].apmac&&x[1].apmac!=x[1].mac?_e?_e.p(x,ue):(_e=Za(x),_e.c(),_e.m(l,M)):_e&&(_e.d(1),_e=null);const Se={};ue&8388608&&(Se.$$scope={dirty:ue,ctx:x}),T.$set(Se),x[1].meter?ae?ae.p(x,ue):(ae=Ja(x),ae.c(),ae.m(e,H)):ae&&(ae.d(1),ae=null),x[1].net?fe?fe.p(x,ue):(fe=Xa(x),fe.c(),fe.m(e,j)):fe&&(fe.d(1),fe=null),(!Ee||ue&2)&&O!==(O=x[1].version+"")&&B(U,O),x[2]?oe?(oe.p(x,ue),ue&4&&P(oe,1)):(oe=ef(x),oe.c(),P(oe,1),oe.m(E,z)):oe&&(Me(),N(oe,1,1,()=>{oe=null}),Ae()),ue&3&&(ne=(x[1].security==0||x[0].a)&&Hn(x[1].board)),ne?J?J.p(x,ue):(J=nf(x),J.c(),J.m(E,te)):J&&(J.d(1),J=null),x[1].security==0||x[0].a?ie?ie.p(x,ue):(ie=sf(x),ie.c(),ie.m(E,null)):ie&&(ie.d(1),ie=null),x[1].security==0||x[0].a?Ce?Ce.p(x,ue):(Ce=of(x),Ce.c(),Ce.m(e,null)):Ce&&(Ce.d(1),Ce=null);const de={};ue&32&&(de.active=x[5]),Ne.$set(de);const ve={};ue&256&&(ve.active=x[8]),Fe.$set(ve)},i(x){Ee||(P(d.$$.fragment,x),P(T.$$.fragment,x),P(oe),P(Ne.$$.fragment,x),P(Fe.$$.fragment,x),Ee=!0)},o(x){N(d.$$.fragment,x),N(T.$$.fragment,x),N(oe),N(Ne.$$.fragment,x),N(Fe.$$.fragment,x),Ee=!1},d(x){x&&w(e),K(d),_e&&_e.d(),K(T),ae&&ae.d(),fe&&fe.d(),oe&&oe.d(),J&&J.d(),ie&&ie.d(),Ce&&Ce.d(),x&&w(pe),K(Ne,x),x&&w(Ie),K(Fe,x),$e=!1,ge()}}}async function Mp(){await(await fetch("/reboot",{method:"POST"})).json()}function Ap(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"Domoticz",key:"id"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],r={};so.subscribe(R=>{l(2,r=ic(i.version,R)),r||l(2,r=R[0])});function a(){confirm("Do you want to upgrade this device to "+r.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(fs(me(i.chip,i.board))))&&(yt.update(R=>(R.upgrading=!0,R)),nc())}const f=function(){confirm("Are you sure you want to reboot the device?")&&(yt.update(R=>(R.booting=!0,R)),Mp())};let c,p=[],_=!1,d,g=[],h=!1;lo();function b(R){us[R?"unshift":"push"](()=>{c=R,l(3,c)})}function C(){p=this.files,l(4,p)}const k=()=>{c.click()},S=()=>l(5,_=!0);function M(R){us[R?"unshift":"push"](()=>{d=R,l(6,d)})}function I(){g=this.files,l(7,g)}const T=()=>{d.click()},D=()=>l(8,h=!0);return t.$$set=R=>{"data"in R&&l(0,n=R.data),"sysinfo"in R&&l(1,i=R.sysinfo)},[n,i,r,c,p,_,d,g,h,o,a,f,b,C,k,S,M,I,T,D]}class Dp extends ye{constructor(e){super(),we(this,e,Ap,Pp,ke,{data:0,sysinfo:1})}}function af(t){let e,l,n=me(t[0],7)+"",i,o,r=me(t[0],5)+"",a,f,c=me(t[0],4)+"",p,_,d=me(t[0],3)+"",g,h,b,C,k=me(t[0],2)+"",S,M,I=me(t[0],1)+"",T,D,R=me(t[0],0)+"",F,H,j,E,L=me(t[0],101)+"",W,G,q=me(t[0],100)+"",O;return{c(){e=m("optgroup"),l=m("option"),i=$(n),o=m("option"),a=$(r),f=m("option"),p=$(c),_=m("option"),g=$(d),h=v(),b=m("optgroup"),C=m("option"),S=$(k),M=m("option"),T=$(I),D=m("option"),F=$(R),H=v(),j=m("optgroup"),E=m("option"),W=$(L),G=m("option"),O=$(q),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,f.__value=4,f.value=f.__value,_.__value=3,_.value=_.__value,u(e,"label","amsleser.no"),C.__value=2,C.value=C.__value,M.__value=1,M.value=M.__value,D.__value=0,D.value=D.__value,u(b,"label","Custom hardware"),E.__value=101,E.value=E.__value,G.__value=100,G.value=G.__value,u(j,"label","Generic hardware")},m(U,X){y(U,e,X),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),s(e,_),s(_,g),y(U,h,X),y(U,b,X),s(b,C),s(C,S),s(b,M),s(M,T),s(b,D),s(D,F),y(U,H,X),y(U,j,X),s(j,E),s(E,W),s(j,G),s(G,O)},p(U,X){X&1&&n!==(n=me(U[0],7)+"")&&B(i,n),X&1&&r!==(r=me(U[0],5)+"")&&B(a,r),X&1&&c!==(c=me(U[0],4)+"")&&B(p,c),X&1&&d!==(d=me(U[0],3)+"")&&B(g,d),X&1&&k!==(k=me(U[0],2)+"")&&B(S,k),X&1&&I!==(I=me(U[0],1)+"")&&B(T,I),X&1&&R!==(R=me(U[0],0)+"")&&B(F,R),X&1&&L!==(L=me(U[0],101)+"")&&B(W,L),X&1&&q!==(q=me(U[0],100)+"")&&B(O,q)},d(U){U&&w(e),U&&w(h),U&&w(b),U&&w(H),U&&w(j)}}}function ff(t){let e,l,n=me(t[0],201)+"",i,o,r=me(t[0],202)+"",a,f,c=me(t[0],203)+"",p,_,d=me(t[0],200)+"",g;return{c(){e=m("optgroup"),l=m("option"),i=$(n),o=m("option"),a=$(r),f=m("option"),p=$(c),_=m("option"),g=$(d),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,f.__value=203,f.value=f.__value,_.__value=200,_.value=_.__value,u(e,"label","Generic hardware")},m(h,b){y(h,e,b),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),s(e,_),s(_,g)},p(h,b){b&1&&n!==(n=me(h[0],201)+"")&&B(i,n),b&1&&r!==(r=me(h[0],202)+"")&&B(a,r),b&1&&c!==(c=me(h[0],203)+"")&&B(p,c),b&1&&d!==(d=me(h[0],200)+"")&&B(g,d)},d(h){h&&w(e)}}}function cf(t){let e,l,n=me(t[0],7)+"",i,o,r=me(t[0],6)+"",a,f,c=me(t[0],5)+"",p,_,d,g,h=me(t[0],51)+"",b,C,k=me(t[0],50)+"",S;return{c(){e=m("optgroup"),l=m("option"),i=$(n),o=m("option"),a=$(r),f=m("option"),p=$(c),_=v(),d=m("optgroup"),g=m("option"),b=$(h),C=m("option"),S=$(k),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,f.__value=5,f.value=f.__value,u(e,"label","amsleser.no"),g.__value=51,g.value=g.__value,C.__value=50,C.value=C.__value,u(d,"label","Generic hardware")},m(M,I){y(M,e,I),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),y(M,_,I),y(M,d,I),s(d,g),s(g,b),s(d,C),s(C,S)},p(M,I){I&1&&n!==(n=me(M[0],7)+"")&&B(i,n),I&1&&r!==(r=me(M[0],6)+"")&&B(a,r),I&1&&c!==(c=me(M[0],5)+"")&&B(p,c),I&1&&h!==(h=me(M[0],51)+"")&&B(b,h),I&1&&k!==(k=me(M[0],50)+"")&&B(S,k)},d(M){M&&w(e),M&&w(_),M&&w(d)}}}function mf(t){let e,l,n=me(t[0],71)+"",i,o,r=me(t[0],70)+"",a;return{c(){e=m("optgroup"),l=m("option"),i=$(n),o=m("option"),a=$(r),l.__value=71,l.value=l.__value,o.__value=70,o.value=o.__value,u(e,"label","Generic hardware")},m(f,c){y(f,e,c),s(e,l),s(l,i),s(e,o),s(o,a)},p(f,c){c&1&&n!==(n=me(f[0],71)+"")&&B(i,n),c&1&&r!==(r=me(f[0],70)+"")&&B(a,r)},d(f){f&&w(e)}}}function pf(t){let e,l,n=me(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=$(n),l.__value=200,l.value=l.__value,u(e,"label","Generic hardware")},m(o,r){y(o,e,r),s(e,l),s(l,i)},p(o,r){r&1&&n!==(n=me(o[0],200)+"")&&B(i,n)},d(o){o&&w(e)}}}function Np(t){let e,l,n,i,o,r,a,f=t[0]=="esp8266"&&af(t),c=t[0]=="esp32"&&ff(t),p=t[0]=="esp32s2"&&cf(t),_=t[0]=="esp32c3"&&mf(t),d=t[0]=="esp32solo"&&pf(t);return{c(){e=m("option"),l=v(),f&&f.c(),n=v(),c&&c.c(),i=v(),p&&p.c(),o=v(),_&&_.c(),r=v(),d&&d.c(),a=We(),e.__value=-1,e.value=e.__value},m(g,h){y(g,e,h),y(g,l,h),f&&f.m(g,h),y(g,n,h),c&&c.m(g,h),y(g,i,h),p&&p.m(g,h),y(g,o,h),_&&_.m(g,h),y(g,r,h),d&&d.m(g,h),y(g,a,h)},p(g,[h]){g[0]=="esp8266"?f?f.p(g,h):(f=af(g),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),g[0]=="esp32"?c?c.p(g,h):(c=ff(g),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null),g[0]=="esp32s2"?p?p.p(g,h):(p=cf(g),p.c(),p.m(o.parentNode,o)):p&&(p.d(1),p=null),g[0]=="esp32c3"?_?_.p(g,h):(_=mf(g),_.c(),_.m(r.parentNode,r)):_&&(_.d(1),_=null),g[0]=="esp32solo"?d?d.p(g,h):(d=pf(g),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null)},i:se,o:se,d(g){g&&w(e),g&&w(l),f&&f.d(g),g&&w(n),c&&c.d(g),g&&w(i),p&&p.d(g),g&&w(o),_&&_.d(g),g&&w(r),d&&d.d(g),g&&w(a)}}}function Ip(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Ep extends ye{constructor(e){super(),we(this,e,Ip,Np,ke,{chip:0})}}function _f(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function df(t){let e,l,n,i,o,r,a;return r=new rc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=$("HAN GPIO"),n=m("br"),i=v(),o=m("select"),Z(r.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(e,"class","my-3")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(r,o,null),a=!0},p(f,c){const p={};c&1&&(p.chip=f[0].chip),r.$set(p)},i(f){a||(P(r.$$.fragment,f),a=!0)},o(f){N(r.$$.fragment,f),a=!1},d(f){f&&w(e),K(r)}}}function Rp(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C,k,S,M,I,T,D,R,F,H,j,E,L,W,G=t[0].usrcfg&&_f();h=new Ep({props:{chip:t[0].chip}});let q=t[0].board&&t[0].board>20&&df(t);return j=new gt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=v(),r=m("strong"),r.textContent="Initial configuration",a=v(),G&&G.c(),f=v(),c=m("div"),p=$("Board type"),_=m("br"),d=v(),g=m("select"),Z(h.$$.fragment),b=v(),q&&q.c(),C=v(),k=m("div"),S=m("label"),M=m("input"),I=$(" Clear all other configuration"),T=v(),D=m("div"),D.innerHTML='<button type="submit" class="btn-pri">Save</button>',R=v(),F=m("span"),F.textContent="\xA0",H=v(),Z(j.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(r,"class","text-sm"),u(g,"name","vb"),u(g,"class","in-s"),t[0].board===void 0&&ze(()=>t[4].call(g)),u(c,"class","my-3"),u(M,"type","checkbox"),u(M,"name","vr"),M.__value="true",M.value=M.__value,u(M,"class","rounded mb-1"),u(k,"class","my-3"),u(D,"class","my-3"),u(F,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(O,U){y(O,e,U),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),G&&G.m(n,null),s(n,f),s(n,c),s(c,p),s(c,_),s(c,d),s(c,g),V(h,g,null),Re(g,t[0].board),s(n,b),q&&q.m(n,null),s(n,C),s(n,k),s(k,S),s(S,M),M.checked=t[2],s(S,I),s(n,T),s(n,D),s(n,R),s(n,F),y(O,H,U),V(j,O,U),E=!0,L||(W=[Y(g,"change",t[4]),Y(M,"change",t[5]),Y(n,"submit",cs(t[3]))],L=!0)},p(O,[U]){O[0].usrcfg?G||(G=_f(),G.c(),G.m(n,f)):G&&(G.d(1),G=null);const X={};U&1&&(X.chip=O[0].chip),h.$set(X),U&1&&Re(g,O[0].board),O[0].board&&O[0].board>20?q?(q.p(O,U),U&1&&P(q,1)):(q=df(O),q.c(),P(q,1),q.m(n,C)):q&&(Me(),N(q,1,1,()=>{q=null}),Ae()),U&4&&(M.checked=O[2]);const z={};U&2&&(z.active=O[1]),j.$set(z)},i(O){E||(P(h.$$.fragment,O),P(q),P(j.$$.fragment,O),E=!0)},o(O){N(h.$$.fragment,O),N(q),N(j.$$.fragment,O),E=!1},d(O){O&&w(e),G&&G.d(),K(h),q&&q.d(),O&&w(H),K(j,O),L=!1,Be(W)}}}function Fp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(c){l(1,i=!0);const p=new FormData(c.target),_=new URLSearchParams;for(let h of p){const[b,C]=h;_.append(b,C)}let g=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),yt.update(h=>(h.vndcfg=g.success,h.booting=g.reboot,h)),Un(n.usrcfg?"/":"/setup")}let r=!1;function a(){n.board=et(this),l(0,n)}function f(){r=this.checked,l(2,r),l(0,n)}return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,r=!n.usrcfg)},[n,i,r,o,a,f]}class Lp extends ye{constructor(e){super(),we(this,e,Fp,Rp,ke,{sysinfo:0})}}function vf(t){let e,l,n,i,o,r,a,f;return a=new ac({}),{c(){e=m("br"),l=v(),n=m("div"),i=m("input"),o=v(),r=m("select"),Z(a.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=t[1],u(r,"name","su"),u(r,"class","in-l"),r.required=t[1],u(n,"class","flex")},m(c,p){y(c,e,p),y(c,l,p),y(c,n,p),s(n,i),s(n,o),s(n,r),V(a,r,null),f=!0},p(c,p){(!f||p&2)&&(i.required=c[1]),(!f||p&2)&&(r.required=c[1])},i(c){f||(P(a.$$.fragment,c),f=!0)},o(c){N(a.$$.fragment,c),f=!1},d(c){c&&w(e),c&&w(l),c&&w(n),K(a)}}}function hf(t){let e;return{c(){e=m("div"),e.innerHTML=`<div>Gateway<br/>
|
|
<input name="sg" type="text" class="in-f w-full"/></div>
|
|
<div>DNS<br/>
|
|
<input name="sd" type="text" class="in-l w-full"/></div>`,u(e,"class","my-3 flex")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Op(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C,k,S,M,I,T,D,R,F,H,j,E,L,W=t[1]&&vf(t),G=t[1]&&hf();return H=new gt({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=v(),r=m("strong"),r.textContent="Setup",a=v(),f=m("div"),f.innerHTML=`SSID<br/>
|
|
<input name="ss" type="text" class="in-s" required=""/>`,c=v(),p=m("div"),p.innerHTML=`PSK<br/>
|
|
<input name="sp" type="password" class="in-s" autocomplete="off"/>`,_=v(),d=m("div"),g=$(`Hostname
|
|
`),h=m("input"),b=v(),C=m("div"),k=m("label"),S=m("input"),M=$(" Static IP"),I=v(),W&&W.c(),T=v(),G&&G.c(),D=v(),R=m("div"),R.innerHTML='<button type="submit" class="btn-pri">Save</button>',F=v(),Z(H.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(r,"class","text-sm"),u(f,"class","my-3"),u(p,"class","my-3"),u(h,"name","sh"),u(h,"type","text"),u(h,"class","in-s"),u(h,"maxlength","32"),u(h,"pattern","[a-z0-9_-]+"),u(h,"placeholder","Optional, ex.: ams-reader"),u(h,"autocomplete","off"),u(S,"type","checkbox"),u(S,"name","sm"),S.__value="static",S.value=S.__value,u(S,"class","rounded mb-1"),u(C,"class","my-3"),u(R,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(q,O){y(q,e,O),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),s(n,f),s(n,c),s(n,p),s(n,_),s(n,d),s(d,g),s(d,h),Q(h,t[0].hostname),s(n,b),s(n,C),s(C,k),s(k,S),S.checked=t[1],s(k,M),s(C,I),W&&W.m(C,null),s(n,T),G&&G.m(n,null),s(n,D),s(n,R),y(q,F,O),V(H,q,O),j=!0,E||(L=[Y(h,"input",t[4]),Y(S,"change",t[5]),Y(n,"submit",cs(t[3]))],E=!0)},p(q,[O]){O&1&&h.value!==q[0].hostname&&Q(h,q[0].hostname),O&2&&(S.checked=q[1]),q[1]?W?(W.p(q,O),O&2&&P(W,1)):(W=vf(q),W.c(),P(W,1),W.m(C,null)):W&&(Me(),N(W,1,1,()=>{W=null}),Ae()),q[1]?G||(G=hf(),G.c(),G.m(n,D)):G&&(G.d(1),G=null);const U={};O&4&&(U.active=q[2]),H.$set(U)},i(q){j||(P(W),P(H.$$.fragment,q),j=!0)},o(q){N(W),N(H.$$.fragment,q),j=!1},d(q){q&&w(e),W&&W.d(),G&&G.d(),q&&w(F),K(H,q),E=!1,Be(L)}}}function qp(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,r=0;function a(){var _="";r++;var d=function(){setTimeout(a,1e3)};if(n.net.ip&&r%3==0){if(!n.net.ip){d();return}_="http://"+n.net.ip}else n.hostname&&r%3==1?_="http://"+n.hostname:n.hostname&&r%3==2?_="http://"+n.hostname+".local":_="";console&&console.log("Trying url "+_),yt.update(h=>(h.trying=_,h));var g=new XMLHttpRequest;g.timeout=5e3,g.addEventListener("abort",d),g.addEventListener("error",d),g.addEventListener("timeout",d),g.addEventListener("load",function(h){window.location.href=_||"/"}),g.open("GET",_+"/is-alive",!0),g.send()}async function f(_){l(2,o=!0);const d=new FormData(_.target),g=new URLSearchParams;for(let C of d){const[k,S]=C;g.append(k,S)}let b=await(await fetch("/save",{method:"POST",body:g})).json();l(2,o=!1),yt.update(C=>(C.hostname=d.get("sh"),C.usrcfg=b.success,C.booting=b.reboot,i&&(C.net.ip=d.get("si"),C.net.mask=d.get("su"),C.net.gw=d.get("sg"),C.net.dns1=d.get("sd")),setTimeout(a,5e3),C))}function c(){n.hostname=this.value,l(0,n)}function p(){i=this.checked,l(1,i)}return t.$$set=_=>{"sysinfo"in _&&l(0,n=_.sysinfo)},[n,i,o,f,c,p]}class Up extends ye{constructor(e){super(),we(this,e,qp,Op,ke,{sysinfo:0})}}function Hp(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C,k;return h=new gt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=$("Upload "),o=$(t[1]),r=v(),a=m("p"),a.textContent="Select a suitable file and click upload",f=v(),c=m("form"),p=m("input"),_=v(),d=m("div"),d.innerHTML='<button type="submit" class="btn-pri">Upload</button>',g=v(),Z(h.$$.fragment),u(a,"class","mb-4"),u(p,"name","file"),u(p,"type","file"),u(d,"class","w-full text-right mt-4"),u(c,"action",t[0]),u(c,"enctype","multipart/form-data"),u(c,"method","post"),u(c,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(S,M){y(S,e,M),s(e,l),s(l,n),s(n,i),s(n,o),s(l,r),s(l,a),s(l,f),s(l,c),s(c,p),s(c,_),s(c,d),y(S,g,M),V(h,S,M),b=!0,C||(k=Y(c,"submit",t[3]),C=!0)},p(S,[M]){(!b||M&2)&&B(o,S[1]),(!b||M&1)&&u(c,"action",S[0]);const I={};M&4&&(I.active=S[2]),h.$set(I)},i(S){b||(P(h.$$.fragment,S),b=!0)},o(S){N(h.$$.fragment,S),b=!1},d(S){S&&w(e),S&&w(g),K(h,S),C=!1,k()}}}function jp(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const r=()=>l(2,o=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,o,r]}class oo extends ye{constructor(e){super(),we(this,e,jp,Hp,ke,{action:0,title:1})}}function Wp(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C,k,S,M,I,T,D,R,F,H,j,E,L,W,G,q;return L=new gt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=v(),r=m("hr"),a=v(),f=m("div"),c=$("Enable one-click upgrade? (implies data collection)"),p=m("br"),_=v(),d=m("a"),g=$("Read more"),h=m("br"),b=v(),C=m("label"),k=m("input"),M=$(" Yes"),I=m("label"),T=m("input"),R=$(" No"),F=m("br"),H=v(),j=m("div"),j.innerHTML='<button type="submit" class="btn-pri">Save</button>',E=v(),Z(L.$$.fragment),u(d,"href",Lt("Data-collection-on-one-click-firmware-upgrade")),u(d,"target","_blank"),u(d,"class","text-blue-600 hover:text-blue-800"),u(k,"type","radio"),u(k,"name","sf"),k.value=1,k.checked=S=t[0].fwconsent===1,u(k,"class","rounded m-2"),k.required=!0,u(T,"type","radio"),u(T,"name","sf"),T.value=2,T.checked=D=t[0].fwconsent===2,u(T,"class","rounded m-2"),T.required=!0,u(f,"class","my-3"),u(j,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(O,U){y(O,e,U),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),s(n,f),s(f,c),s(f,p),s(f,_),s(f,d),s(d,g),s(f,h),s(f,b),s(f,C),s(C,k),s(C,M),s(f,I),s(I,T),s(I,R),s(f,F),s(n,H),s(n,j),y(O,E,U),V(L,O,U),W=!0,G||(q=Y(n,"submit",cs(t[2])),G=!0)},p(O,[U]){(!W||U&1&&S!==(S=O[0].fwconsent===1))&&(k.checked=S),(!W||U&1&&D!==(D=O[0].fwconsent===2))&&(T.checked=D);const X={};U&2&&(X.active=O[1]),L.$set(X)},i(O){W||(P(L.$$.fragment,O),W=!0)},o(O){N(L.$$.fragment,O),W=!1},d(O){O&&w(e),O&&w(E),K(L,O),G=!1,q()}}}function Gp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(r){l(1,i=!0);const a=new FormData(r.target),f=new URLSearchParams;for(let _ of a){const[d,g]=_;f.append(d,g)}let p=await(await fetch("/save",{method:"POST",body:f})).json();l(1,i=!1),yt.update(_=>(_.fwconsent=a.sf===!0?1:a.sf===!1?2:0,_.booting=p.reboot,_)),Un("/")}return t.$$set=r=>{"sysinfo"in r&&l(0,n=r.sysinfo)},[n,i,o]}class Bp extends ye{constructor(e){super(),we(this,e,Gp,Wp,ke,{sysinfo:0})}}function zp(t){let e,l;return e=new Km({props:{data:t[1],sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Yp(t){let e,l;return e=new kp({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Vp(t){let e,l;return e=new Dp({props:{sysinfo:t[0],data:t[1]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Kp(t){let e,l;return e=new oo({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Qp(t){let e,l;return e=new oo({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Zp(t){let e,l;return e=new oo({props:{title:"private key",action:"/mqtt-key"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Jp(t){let e,l;return e=new Bp({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function Xp(t){let e,l;return e=new Up({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function xp(t){let e,l;return e=new Lp({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function e0(t){let e,l,n,i,o,r,a,f,c,p,_,d,g,h,b,C,k,S,M,I;return e=new rm({props:{data:t[1]}}),n=new ol({props:{path:"/",$$slots:{default:[zp]},$$scope:{ctx:t}}}),o=new ol({props:{path:"/configuration",$$slots:{default:[Yp]},$$scope:{ctx:t}}}),a=new ol({props:{path:"/status",$$slots:{default:[Vp]},$$scope:{ctx:t}}}),c=new ol({props:{path:"/mqtt-ca",$$slots:{default:[Kp]},$$scope:{ctx:t}}}),_=new ol({props:{path:"/mqtt-cert",$$slots:{default:[Qp]},$$scope:{ctx:t}}}),g=new ol({props:{path:"/mqtt-key",$$slots:{default:[Zp]},$$scope:{ctx:t}}}),b=new ol({props:{path:"/consent",$$slots:{default:[Jp]},$$scope:{ctx:t}}}),k=new ol({props:{path:"/setup",$$slots:{default:[Xp]},$$scope:{ctx:t}}}),M=new ol({props:{path:"/vendor",$$slots:{default:[xp]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment),l=v(),Z(n.$$.fragment),i=v(),Z(o.$$.fragment),r=v(),Z(a.$$.fragment),f=v(),Z(c.$$.fragment),p=v(),Z(_.$$.fragment),d=v(),Z(g.$$.fragment),h=v(),Z(b.$$.fragment),C=v(),Z(k.$$.fragment),S=v(),Z(M.$$.fragment)},m(T,D){V(e,T,D),y(T,l,D),V(n,T,D),y(T,i,D),V(o,T,D),y(T,r,D),V(a,T,D),y(T,f,D),V(c,T,D),y(T,p,D),V(_,T,D),y(T,d,D),V(g,T,D),y(T,h,D),V(b,T,D),y(T,C,D),V(k,T,D),y(T,S,D),V(M,T,D),I=!0},p(T,D){const R={};D&2&&(R.data=T[1]),e.$set(R);const F={};D&7&&(F.$$scope={dirty:D,ctx:T}),n.$set(F);const H={};D&5&&(H.$$scope={dirty:D,ctx:T}),o.$set(H);const j={};D&7&&(j.$$scope={dirty:D,ctx:T}),a.$set(j);const E={};D&4&&(E.$$scope={dirty:D,ctx:T}),c.$set(E);const L={};D&4&&(L.$$scope={dirty:D,ctx:T}),_.$set(L);const W={};D&4&&(W.$$scope={dirty:D,ctx:T}),g.$set(W);const G={};D&5&&(G.$$scope={dirty:D,ctx:T}),b.$set(G);const q={};D&5&&(q.$$scope={dirty:D,ctx:T}),k.$set(q);const O={};D&5&&(O.$$scope={dirty:D,ctx:T}),M.$set(O)},i(T){I||(P(e.$$.fragment,T),P(n.$$.fragment,T),P(o.$$.fragment,T),P(a.$$.fragment,T),P(c.$$.fragment,T),P(_.$$.fragment,T),P(g.$$.fragment,T),P(b.$$.fragment,T),P(k.$$.fragment,T),P(M.$$.fragment,T),I=!0)},o(T){N(e.$$.fragment,T),N(n.$$.fragment,T),N(o.$$.fragment,T),N(a.$$.fragment,T),N(c.$$.fragment,T),N(_.$$.fragment,T),N(g.$$.fragment,T),N(b.$$.fragment,T),N(k.$$.fragment,T),N(M.$$.fragment,T),I=!1},d(T){K(e,T),T&&w(l),K(n,T),T&&w(i),K(o,T),T&&w(r),K(a,T),T&&w(f),K(c,T),T&&w(p),K(_,T),T&&w(d),K(g,T),T&&w(h),K(b,T),T&&w(C),K(k,T),T&&w(S),K(M,T)}}}function t0(t){let e,l,n,i;const o=[i0,n0],r=[];function a(f,c){return f[0].trying?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?r[e].p(f,c):(Me(),N(r[p],1,1,()=>{r[p]=null}),Ae(),l=r[e],l?l.p(f,c):(l=r[e]=o[e](f),l.c()),P(l,1),l.m(n.parentNode,n))},i(f){i||(P(l),i=!0)},o(f){N(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function l0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function n0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p:se,i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function i0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){Z(e.$$.fragment)},m(n,i){V(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(P(e.$$.fragment,n),l=!0)},o(n){N(e.$$.fragment,n),l=!1},d(n){K(e,n)}}}function s0(t){let e,l,n,i,o,r;l=new Bf({props:{$$slots:{default:[e0]},$$scope:{ctx:t}}});const a=[l0,t0],f=[];function c(p,_){return p[0].upgrading?0:p[0].booting?1:-1}return~(i=c(t))&&(o=f[i]=a[i](t)),{c(){e=m("div"),Z(l.$$.fragment),n=v(),o&&o.c(),u(e,"class","container mx-auto m-3")},m(p,_){y(p,e,_),V(l,e,null),s(e,n),~i&&f[i].m(e,null),r=!0},p(p,[_]){const d={};_&7&&(d.$$scope={dirty:_,ctx:p}),l.$set(d);let g=i;i=c(p),i===g?~i&&f[i].p(p,_):(o&&(Me(),N(f[g],1,1,()=>{f[g]=null}),Ae()),~i?(o=f[i],o?o.p(p,_):(o=f[i]=a[i](p),o.c()),P(o,1),o.m(e,null)):o=null)},i(p){r||(P(l.$$.fragment,p),P(o),r=!0)},o(p){N(l.$$.fragment,p),N(o),r=!1},d(p){p&&w(e),K(l),~i&&f[i].d()}}}function o0(t,e,l){let n={};yt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?Un("/vendor"):n.usrcfg===!1?Un("/setup"):n.fwconsent===0&&Un("/consent")}),lo();let i={};return M1.subscribe(o=>{l(1,i=o)}),[n,i]}class u0 extends ye{constructor(e){super(),we(this,e,o0,s0,ke,{})}}new u0({target:document.getElementById("app")});
|