Files
UtilitechAS.amsreader-firmware/lib/SvelteUi/app/dist/index.js
2023-04-15 07:44:33 +02:00

15 lines
174 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 a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function ie(){}function Ut(t,e){for(const l in e)t[l]=e[l];return t}function Df(t){return t()}function $r(){return Object.create(null)}function Be(t){t.forEach(Df)}function Nf(t){return typeof t=="function"}function ke(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let os;function Tc(t,e){return os||(os=document.createElement("a")),os.href=e,t===os.href}function Sc(t){return Object.keys(t).length===0}function lo(t,...e){if(t==null)return ie;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function zn(t){let e;return lo(t,l=>e=l)(),e}function zt(t,e,l){t.$$.on_destroy.push(lo(e,l))}function no(t,e,l,n){if(t){const i=If(t,e,l,n);return t[0](i)}}function If(t,e,l,n){return t[1]&&n?Ut(l.ctx.slice(),t[1](n(e))):l.ctx}function io(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(e.dirty.length,i.length);for(let r=0;r<a;r+=1)o[r]=e.dirty[r]|i[r];return o}return e.dirty|i}return e.dirty}function so(t,e,l,n,i,o){if(i){const a=If(e,l,n,o);t.p(a,i)}}function oo(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 ms(t){const e={};for(const l in t)l[0]!=="$"&&(e[l]=t[l]);return e}function _s(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 $(t,e,l){t.insertBefore(e,l||null)}function y(t){t.parentNode.removeChild(t)}function Qt(t,e){for(let l=0;l<t.length;l+=1)t[l]&&t[l].d(e)}function p(t){return document.createElement(t)}function He(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function C(t){return document.createTextNode(t)}function v(){return C(" ")}function We(){return C("")}function z(t,e,l,n){return t.addEventListener(e,l,n),()=>t.removeEventListener(e,l,n)}function gs(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}function Vt(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set?t[n]=e[n]:u(t,n,e[n])}function ae(t){return t===""?null:+t}function Pc(t){return Array.from(t.childNodes)}function B(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Y(t,e){t.value=e==null?"":e}function Ef(t,e,l,n){l===null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Le(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 tt(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}let us;function Mc(){if(us===void 0){us=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{us=!0}}return us}function Ac(t,e){getComputedStyle(t).position==="static"&&(t.style.position="relative");const n=p("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=Mc();let o;return i?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",o=z(window,"message",a=>{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=z(n.contentWindow,"resize",e)}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),y(n)}}function Dc(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}let ai;function oi(t){ai=t}function fi(){if(!ai)throw new Error("Function called outside component initialization");return ai}function Nc(t){fi().$$.on_mount.push(t)}function Ic(t){fi().$$.on_destroy.push(t)}function Ec(){const t=fi();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=Dc(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,o)}),!o.defaultPrevented}return!0}}function ui(t,e){return fi().$$.context.set(t,e),e}function yl(t){return fi().$$.context.get(t)}const ii=[],ds=[],cs=[],Cr=[],Rf=Promise.resolve();let Bs=!1;function Ff(){Bs||(Bs=!0,Rf.then(Lf))}function Rc(){return Ff(),Rf}function Ye(t){cs.push(t)}const qs=new Set;let rs=0;function Lf(){const t=ai;do{for(;rs<ii.length;){const e=ii[rs];rs++,oi(e),Fc(e.$$)}for(oi(null),ii.length=0,rs=0;ds.length;)ds.pop()();for(let e=0;e<cs.length;e+=1){const l=cs[e];qs.has(l)||(qs.add(l),l())}cs.length=0}while(ii.length);for(;Cr.length;)Cr.pop()();Bs=!1,qs.clear(),oi(t)}function Fc(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(Ye)}}const ps=new Set;let Gl;function Te(){Gl={r:0,c:[],p:Gl}}function Se(){Gl.r||Be(Gl.c),Gl=Gl.p}function M(t,e){t&&t.i&&(ps.delete(t),t.i(e))}function I(t,e,l,n){if(t&&t.o){if(ps.has(t))return;ps.add(t),Gl.c.push(()=>{ps.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function Vn(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],r=e[o];if(r){for(const c in a)c in r||(n[c]=1);for(const c in r)i[c]||(l[c]=r[c],i[c]=1);t[o]=r}else for(const c in a)i[c]=1}for(const a in n)a in l||(l[a]=void 0);return l}function Tr(t){return typeof t=="object"&&t!==null?t:{}}function Z(t){t&&t.c()}function Q(t,e,l,n){const{fragment:i,on_mount:o,on_destroy:a,after_update:r}=t.$$;i&&i.m(e,l),n||Ye(()=>{const c=o.map(Df).filter(Nf);a?a.push(...c):Be(c),t.$$.on_mount=[]}),r.forEach(Ye)}function X(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 Lc(t,e){t.$$.dirty[0]===-1&&(ii.push(t),Ff(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function ye(t,e,l,n,i,o,a,r=[-1]){const c=ai;oi(t);const f=t.$$={fragment:null,ctx:null,props:o,update:ie,not_equal:i,bound:$r(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:$r(),dirty:r,skip_bound:!1,root:e.target||c.$$.root};a&&a(f.root);let m=!1;if(f.ctx=l?l(t,e.props||{},(_,h,...b)=>{const d=b.length?b[0]:h;return f.ctx&&i(f.ctx[_],f.ctx[_]=d)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](d),m&&Lc(t,_)),h}):[],f.update(),m=!0,Be(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const _=Pc(e.target);f.fragment&&f.fragment.l(_),_.forEach(y)}else f.fragment&&f.fragment.c();e.intro&&M(t.$$.fragment),Q(t,e.target,e.anchor,e.customElement),Lf()}oi(c)}class $e{$destroy(){X(this,1),this.$destroy=ie}$on(e,l){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!Sc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Sr=t=>typeof t>"u",Of=t=>typeof t=="function",qf=t=>typeof t=="number";function Oc(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Uf(){let t=0;return()=>t++}function qc(){return Math.random().toString(36).substring(2)}const $l=typeof window>"u";function Hf(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Ys=(t,e)=>t?{}:{style:e},Gn=t=>({"aria-hidden":"true",...Ys(t,"display:none;")}),Wn=[];function jf(t,e){return{subscribe:Ze(t,e).subscribe}}function Ze(t,e=ie){let l;const n=new Set;function i(r){if(ke(t,r)&&(t=r,l)){const c=!Wn.length;for(const f of n)f[1](),Wn.push(f,t);if(c){for(let f=0;f<Wn.length;f+=2)Wn[f][0](Wn[f+1]);Wn.length=0}}}function o(r){i(r(t))}function a(r,c=ie){const f=[r,c];return n.add(f),n.size===1&&(l=e(i)||ie),r(t),()=>{n.delete(f),n.size===0&&(l(),l=null)}}return{set:i,update:o,subscribe:a}}function Uc(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return jf(l,a=>{let r=!1;const c=[];let f=0,m=ie;const _=()=>{if(f)return;m();const b=e(n?c[0]:c,a);o?a(b):m=Nf(b)?b:ie},h=i.map((b,d)=>lo(b,g=>{c[d]=g,f&=~(1<<d),r&&_()},()=>{f|=1<<d}));return r=!0,_(),function(){Be(h),m()}})}const ci=t=>`@@svnav-ctx__${t}`,zs=ci("LOCATION"),Kn=ci("ROUTER"),Wf=ci("ROUTE"),Hc=ci("ROUTE_PARAMS"),jc=ci("FOCUS_ELEM"),Gf=/^:(.+)/,si=(t,e,l)=>t.substr(e,l),Vs=(t,e)=>si(t,0,e.length)===e,Wc=t=>t==="",Gc=t=>Gf.test(t),Bf=t=>t[0]==="*",Bc=t=>t.replace(/\*.*$/,""),Yf=t=>t.replace(/(^\/+|\/+$)/g,"");function Xt(t,e=!1){const l=Yf(t).split("/");return e?l.filter(Boolean):l}const Us=(t,e)=>t+(e?`?${e}`:""),uo=t=>`/${Yf(t)}`;function pi(...t){const e=n=>Xt(n,!0).join("/"),l=t.map(e).join("/");return uo(l)}const ro=1,ks=2,zl=3,Yc=4,zf=5,zc=6,Vf=7,Vc=8,Kc=9,Kf=10,Qf=11,Qc={[ro]:"Link",[ks]:"Route",[zl]:"Router",[Yc]:"useFocus",[zf]:"useLocation",[zc]:"useMatch",[Vf]:"useNavigate",[Vc]:"useParams",[Kc]:"useResolvable",[Kf]:"useResolve",[Qf]:"navigate"},ao=t=>Qc[t];function Xc(t,e){let l;return t===ks?l=e.path?`path="${e.path}"`:"default":t===ro?l=`to="${e.to}"`:t===zl&&(l=`basepath="${e.basepath||""}"`),`<${ao(t)} ${l||""} />`}function Zc(t,e,l,n){const i=l&&Xc(n||t,l),o=i?`
Occurred in: ${i}`:"",a=ao(t),r=Of(e)?e(a):e;return`<${a}> ${r}${o}`}const Xf=t=>(...e)=>t(Zc(...e)),Zf=Xf(t=>{throw new Error(t)}),vs=Xf(console.warn),Pr=4,Jc=3,xc=2,e1=1,t1=1;function l1(t,e){const l=t.default?0:Xt(t.fullPath).reduce((n,i)=>{let o=n;return o+=Pr,Wc(i)?o+=t1:Gc(i)?o+=xc:Bf(i)?o-=Pr+e1:o+=Jc,o},0);return{route:t,score:l,index:e}}function n1(t){return t.map(l1).sort((e,l)=>e.score<l.score?1:e.score>l.score?-1:e.index-l.index)}function Jf(t,e){let l,n;const[i]=e.split("?"),o=Xt(i),a=o[0]==="",r=n1(t);for(let c=0,f=r.length;c<f;c++){const{route:m}=r[c];let _=!1;const h={},b=k=>({...m,params:h,uri:k});if(m.default){n=b(e);continue}const d=Xt(m.fullPath),g=Math.max(o.length,d.length);let w=0;for(;w<g;w++){const k=d[w],T=o[w];if(!Sr(k)&&Bf(k)){const E=k==="*"?"*":k.slice(1);h[E]=o.slice(w).map(decodeURIComponent).join("/");break}if(Sr(T)){_=!0;break}const P=Gf.exec(k);if(P&&!a){const E=decodeURIComponent(T);h[P[1]]=E}else if(k!==T){_=!0;break}}if(!_){l=b(pi(...o.slice(0,w)));break}}return l||n||null}function xf(t,e){return Jf([t],e)}function i1(t,e){if(Vs(t,"/"))return t;const[l,n]=t.split("?"),[i]=e.split("?"),o=Xt(l),a=Xt(i);if(o[0]==="")return Us(i,n);if(!Vs(o[0],".")){const f=a.concat(o).join("/");return Us((i==="/"?"":"/")+f,n)}const r=a.concat(o),c=[];return r.forEach(f=>{f===".."?c.pop():f!=="."&&c.push(f)}),Us(`/${c.join("/")}`,n)}function Mr(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=Xt(e,!0),r=Xt(l,!0);for(;a.length;)a[0]!==r[0]&&Zf(zl,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),r.shift();return{pathname:pi(...r),hash:n,search:i,state:o}}const Ar=t=>t.length===1?"":t,fo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Ar(si(t,l)):"",a=i?si(t,0,l):t,r=n?Ar(si(a,e)):"";return{pathname:(n?si(a,0,e):a)||"/",search:r,hash:o}},s1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function o1(t,e,l){return pi(l,i1(t,e))}function u1(t,e){const l=uo(Bc(t)),n=Xt(l,!0),i=Xt(e,!0).slice(0,n.length),o=xf({fullPath:l},pi(...i));return o&&o.uri}const Hs="POP",r1="PUSH",a1="REPLACE";function js(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function f1(t){let e=[],l=js(t),n=Hs;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=js(t),n=Hs,i([o])};i([o]);const r=Hf(t,"popstate",a);return()=>{r(),e=e.filter(c=>c!==o)}},navigate(o,a){const{state:r={},replace:c=!1}=a||{};if(n=c?a1:r1,qf(o))a&&vs(Qf,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Hs,t.history.go(o);else{const f={...r,_key:qc()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=js(t),i()}}}function Ws(t,e){return{...fo(e),state:t}}function c1(t="/"){let e=0,l=[Ws(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Ws(n,o))},replaceState(n,i,o){l[e]=Ws(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const p1=!!(!$l&&window.document&&window.document.createElement),m1=!$l&&window.location.origin==="null",ec=f1(p1&&!m1?window:c1()),{navigate:Bn}=ec;let cl=null,tc=!0;function _1(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 d1(t){(!cl||t.level>cl.level||t.level===cl.level&&_1(t.routerId,cl.routerId))&&(cl=t)}function v1(){cl=null}function h1(){tc=!1}function Dr(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Hf(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function b1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function g1(t){return/^H[1-6]$/i.test(t.tagName)}function Nr(t,e=document){return e.querySelector(t)}function k1(t){let l=Nr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!b1(l,t);){if(g1(l))return l;const n=Nr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function w1(t){Promise.resolve(zn(t.focusElement)).then(e=>{const l=e||k1(t.id);l||vs(zl,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,ks),!Dr(l)&&Dr(document.documentElement)})}const y1=(t,e,l)=>(n,i)=>Rc().then(()=>{if(!cl||tc){h1();return}if(n&&w1(cl.route),t.announcements&&i){const{path:o,fullPath:a,meta:r,params:c,uri:f}=cl.route,m=t.createAnnouncement({path:o,fullPath:a,meta:r,params:c,uri:f},zn(l));Promise.resolve(m).then(_=>{e.set(_)})}v1()}),Ir="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function $1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Ys(t[6],Ir)],i={};for(let o=0;o<n.length;o+=1)i=Ut(i,n[o]);return{c(){e=p("div"),l=C(t[0]),Vt(e,i)},m(o,a){$(o,e,a),s(e,l)},p(o,a){a[0]&1&&B(l,o[0]),Vt(e,i=Vn(n,[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Ys(o[6],Ir)]))},d(o){o&&y(e)}}}function C1(t){let e,l,n,i,o,a=[Gn(t[6]),{"data-svnav-router":t[3]}],r={};for(let _=0;_<a.length;_+=1)r=Ut(r,a[_]);const c=t[22].default,f=no(c,t,t[21],null);let m=t[2]&&t[4]&&t[1].announcements&&$1(t);return{c(){e=p("div"),l=v(),f&&f.c(),n=v(),m&&m.c(),i=We(),Vt(e,r)},m(_,h){$(_,e,h),$(_,l,h),f&&f.m(_,h),$(_,n,h),m&&m.m(_,h),$(_,i,h),o=!0},p(_,h){Vt(e,r=Vn(a,[Gn(_[6]),{"data-svnav-router":_[3]}])),f&&f.p&&(!o||h[0]&2097152)&&so(f,c,_,_[21],o?io(c,_[21],h,null):oo(_[21]),null),_[2]&&_[4]&&_[1].announcements&&m.p(_,h)},i(_){o||(M(f,_),o=!0)},o(_){I(f,_),o=!1},d(_){_&&y(e),_&&y(l),f&&f.d(_),_&&y(n),m&&m.d(_),_&&y(i)}}}const T1=Uf(),Er="/";function S1(t,e,l){let n,i,o,a,r,{$$slots:c={},$$scope:f}=e,{basepath:m=Er}=e,{url:_=null}=e,{history:h=ec}=e,{primary:b=!0}=e,{a11y:d={}}=e,{disableInlineStyles:g=!1}=e;const w={createAnnouncement:le=>`Navigated to ${le.uri}`,announcements:!0,...d},k=m,T=uo(m),P=yl(zs),E=yl(Kn),S=!P,N=T1(),D=b&&!(E&&!E.manageFocus),R=Ze("");zt(t,R,le=>l(0,r=le));const W=E?E.disableInlineStyles:g,q=Ze([]);zt(t,q,le=>l(20,a=le));const F=Ze(null);zt(t,F,le=>l(18,i=le));let L=!1;const j=S?0:E.level+1,O=S?Ze((()=>Mr($l?fo(_):h.location,T))()):P;zt(t,O,le=>l(17,n=le));const G=Ze(n);zt(t,G,le=>l(19,o=le));const H=y1(w,R,O),V=le=>me=>me.filter(Pe=>Pe.id!==le);function J(le){if($l){if(L)return;const me=xf(le,n.pathname);if(me)return L=!0,me}else q.update(me=>{const Pe=V(le.id)(me);return Pe.push(le),Pe})}function ne(le){q.update(V(le))}return!S&&m!==Er&&vs(zl,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:m}),S&&(Nc(()=>h.listen(me=>{const Pe=Mr(me.location,T);G.set(n),O.set(Pe)})),ui(zs,O)),ui(Kn,{activeRoute:F,registerRoute:J,unregisterRoute:ne,manageFocus:D,level:j,id:N,history:S?h:E.history,basepath:S?T:E.basepath,disableInlineStyles:W}),t.$$set=le=>{"basepath"in le&&l(11,m=le.basepath),"url"in le&&l(12,_=le.url),"history"in le&&l(13,h=le.history),"primary"in le&&l(14,b=le.primary),"a11y"in le&&l(15,d=le.a11y),"disableInlineStyles"in le&&l(16,g=le.disableInlineStyles),"$$scope"in le&&l(21,f=le.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&m!==k&&vs(zl,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const le=Jf(a,n.pathname);F.set(le)}if(t.$$.dirty[0]&655360&&S){const le=!!n.hash,me=!le&&D,Pe=!le||n.pathname!==o.pathname;H(me,Pe)}t.$$.dirty[0]&262144&&D&&i&&i.primary&&d1({level:j,routerId:N,route:i})},[r,w,S,N,D,R,W,q,F,O,G,m,_,h,b,d,g,n,i,o,a,f,c]}class lc extends $e{constructor(e){super(),ye(this,e,S1,C1,ke,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}function mi(t,e,l=Kn,n=zl){yl(l)||Zf(t,o=>`You cannot use ${o} outside of a ${ao(n)}.`,e)}const P1=t=>{const{subscribe:e}=yl(t);return{subscribe:e}};function nc(){return mi(zf),P1(zs)}function ic(){const{history:t}=yl(Kn);return t}function sc(){const t=yl(Wf);return t?Uc(t,e=>e.base):Ze("/")}function oc(){mi(Kf);const t=sc(),{basepath:e}=yl(Kn);return n=>o1(n,zn(t),e)}function M1(){mi(Vf);const t=oc(),{navigate:e}=ic();return(n,i)=>{const o=qf(n)?n:t(n);return e(o,i)}}const A1=t=>({params:t&16,location:t&8}),Rr=t=>({params:$l?zn(t[10]):t[4],location:t[3],navigate:t[11]});function Fr(t){let e,l;return e=new lc({props:{primary:t[1],$$slots:{default:[I1]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function D1(t){let e;const l=t[18].default,n=no(l,t,t[19],Rr);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&so(n,l,i,i[19],e?io(l,i[19],o,A1):oo(i[19]),Rr)},i(i){e||(M(n,i),e=!0)},o(i){I(n,i),e=!1},d(i){n&&n.d(i)}}}function N1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},$l?zn(t[10]):t[4],t[12]];var o=t[0];function a(r){let c={};for(let f=0;f<i.length;f+=1)c=Ut(c,i[f]);return{props:c}}return o&&(e=new o(a())),{c(){e&&Z(e.$$.fragment),l=We()},m(r,c){e&&Q(e,r,c),$(r,l,c),n=!0},p(r,c){const f=c&7192?Vn(i,[c&8&&{location:r[3]},c&2048&&{navigate:r[11]},c&1040&&Tr($l?zn(r[10]):r[4]),c&4096&&Tr(r[12])]):{};if(o!==(o=r[0])){if(e){Te();const m=e;I(m.$$.fragment,1,0,()=>{X(m,1)}),Se()}o?(e=new o(a()),Z(e.$$.fragment),M(e.$$.fragment,1),Q(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(r){n||(e&&M(e.$$.fragment,r),n=!0)},o(r){e&&I(e.$$.fragment,r),n=!1},d(r){r&&y(l),e&&X(e,r)}}}function I1(t){let e,l,n,i;const o=[N1,D1],a=[];function r(c,f){return c[0]!==null?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),$(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e===m?a[e].p(c,f):(Te(),I(a[m],1,1,()=>{a[m]=null}),Se(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&y(n)}}}function E1(t){let e,l,n,i,o,a=[Gn(t[7]),{"data-svnav-route-start":t[5]}],r={};for(let _=0;_<a.length;_+=1)r=Ut(r,a[_]);let c=t[2]&&Fr(t),f=[Gn(t[7]),{"data-svnav-route-end":t[5]}],m={};for(let _=0;_<f.length;_+=1)m=Ut(m,f[_]);return{c(){e=p("div"),l=v(),c&&c.c(),n=v(),i=p("div"),Vt(e,r),Vt(i,m)},m(_,h){$(_,e,h),$(_,l,h),c&&c.m(_,h),$(_,n,h),$(_,i,h),o=!0},p(_,[h]){Vt(e,r=Vn(a,[Gn(_[7]),{"data-svnav-route-start":_[5]}])),_[2]?c?(c.p(_,h),h&4&&M(c,1)):(c=Fr(_),c.c(),M(c,1),c.m(n.parentNode,n)):c&&(Te(),I(c,1,1,()=>{c=null}),Se()),Vt(i,m=Vn(f,[Gn(_[7]),{"data-svnav-route-end":_[5]}]))},i(_){o||(M(c),o=!0)},o(_){I(c),o=!1},d(_){_&&y(e),_&&y(l),c&&c.d(_),_&&y(n),_&&y(i)}}}const R1=Uf();function F1(t,e,l){let n;const i=["path","component","meta","primary"];let o=_s(e,i),a,r,c,f,{$$slots:m={},$$scope:_}=e,{path:h=""}=e,{component:b=null}=e,{meta:d={}}=e,{primary:g=!0}=e;mi(ks,e);const w=R1(),{registerRoute:k,unregisterRoute:T,activeRoute:P,disableInlineStyles:E}=yl(Kn);zt(t,P,L=>l(16,a=L));const S=sc();zt(t,S,L=>l(17,c=L));const N=nc();zt(t,N,L=>l(3,r=L));const D=Ze(null);let R;const W=Ze(),q=Ze({});zt(t,q,L=>l(4,f=L)),ui(Wf,W),ui(Hc,q),ui(jc,D);const F=M1();return $l||Ic(()=>T(w)),t.$$set=L=>{l(24,e=Ut(Ut({},e),ms(L))),l(12,o=_s(e,i)),"path"in L&&l(13,h=L.path),"component"in L&&l(0,b=L.component),"meta"in L&&l(14,d=L.meta),"primary"in L&&l(1,g=L.primary),"$$scope"in L&&l(19,_=L.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const L=h==="",j=pi(c,h),U={id:w,path:h,meta:d,default:L,fullPath:L?"":j,base:L?c:u1(j,r.pathname),primary:g,focusElement:D};W.set(U),l(15,R=k(U))}if(t.$$.dirty&98304&&l(2,n=!!(R||a&&a.id===w)),t.$$.dirty&98308&&n){const{params:L}=R||a;q.set(L)}},e=ms(e),[b,g,n,r,f,w,P,E,S,N,q,F,o,h,d,R,a,c,m,_]}class fl extends $e{constructor(e){super(),ye(this,e,F1,E1,ke,{path:13,component:0,meta:14,primary:1})}}function L1(t){let e,l,n,i;const o=t[13].default,a=no(o,t,t[12],null);let r=[{href:t[0]},t[2],t[1]],c={};for(let f=0;f<r.length;f+=1)c=Ut(c,r[f]);return{c(){e=p("a"),a&&a.c(),Vt(e,c)},m(f,m){$(f,e,m),a&&a.m(e,null),l=!0,n||(i=z(e,"click",t[4]),n=!0)},p(f,[m]){a&&a.p&&(!l||m&4096)&&so(a,o,f,f[12],l?io(o,f[12],m,null):oo(f[12]),null),Vt(e,c=Vn(r,[(!l||m&1)&&{href:f[0]},m&4&&f[2],m&2&&f[1]]))},i(f){l||(M(a,f),l=!0)},o(f){I(a,f),l=!1},d(f){f&&y(e),a&&a.d(f),n=!1,i()}}}function O1(t,e,l){let n,i,o,a,r,c;const f=["to","replace","state","getProps"];let m=_s(e,f),_,{$$slots:h={},$$scope:b}=e,{to:d}=e,{replace:g=!1}=e,{state:w={}}=e,{getProps:k=null}=e;mi(ro,e);const T=nc();zt(t,T,D=>l(11,_=D));const P=Ec(),E=oc(),{navigate:S}=ic();function N(D){P("click",D),Oc(D)&&(D.preventDefault(),S(n,{state:w,replace:a||g}))}return t.$$set=D=>{l(19,e=Ut(Ut({},e),ms(D))),l(18,m=_s(e,f)),"to"in D&&l(5,d=D.to),"replace"in D&&l(6,g=D.replace),"state"in D&&l(7,w=D.state),"getProps"in D&&l(8,k=D.getProps),"$$scope"in D&&l(12,b=D.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=E(d,_)),t.$$.dirty&2049&&l(10,i=Vs(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(a=fo(n)===s1(_)),t.$$.dirty&512&&l(2,r=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(Of(k)){const D=k({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...m,...D}}return m})())},e=ms(e),[n,c,r,T,N,d,g,w,k,o,i,_,b,h]}class wl extends $e{constructor(e){super(),ye(this,e,O1,L1,ke,{to:5,replace:6,state:7,getProps:8})}}let Ks=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function kl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function q1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function uc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function U1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function hs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return""}}function Ee(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function fe(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Lr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received last 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Or(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 qr(t){switch(t){case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Yn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function je(t,e){return t==1||t==2&&e}function Ct(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function ri(t,e){return t.setTime(t.getTime()+e*36e5),t}function Ur(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}async function Cl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let Yt={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const Tt=Ze(Yt);async function co(){Yt=await(await Cl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Tt.set(Yt)}let as=0,Hr=-127,jr=null,H1={};const j1=jf(H1,t=>{let e;async function l(){Cl("/data.json").then(n=>n.json()).then(n=>{t(n),Hr!=n.t&&(Hr=n.t,setTimeout(cc,2e3)),jr!=n.p&&n.pe&&(jr=n.p,setTimeout(W1,4e3)),Yt.upgrading?window.location.reload():(!Yt||!Yt.chip||Yt.booting||as>1&&!Yn(Yt.board))&&(co(),Bl&&clearTimeout(Bl),Bl=setTimeout(po,2e3),Yl&&clearTimeout(Yl),Yl=setTimeout(mo,3e3));let i=5e3;if(Yn(Yt.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),as=0}).catch(n=>{as++,as>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,Yn(Yt.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Qs={};const rc=Ze(Qs);async function W1(){Qs=await(await Cl("/energyprice.json")).json(),rc.set(Qs)}let Xs={},Bl;async function po(){Bl&&(clearTimeout(Bl),Bl=0),Xs=await(await Cl("/dayplot.json")).json(),ac.set(Xs);let e=new Date;Bl=setTimeout(po,(60-e.getMinutes())*6e4+20)}const ac=Ze(Xs,t=>(po(),function(){}));let Zs={},Yl;async function mo(){Yl&&(clearTimeout(Yl),Yl=0),Zs=await(await Cl("/monthplot.json")).json(),fc.set(Zs);let e=new Date;Yl=setTimeout(mo,(24-e.getHours())*36e5+40)}const fc=Ze(Zs,t=>(mo(),function(){}));let Js={};async function cc(){Js=await(await Cl("/temperature.json")).json(),pc.set(Js)}const pc=Ze(Js,t=>(cc(),function(){}));let xs={},fs;async function mc(){fs&&(clearTimeout(fs),fs=0),xs=await(await Cl("/tariff.json")).json(),_c.set(xs);let e=new Date;fs=setTimeout(mc,(60-e.getMinutes())*6e4+30)}const _c=Ze(xs,t=>function(){});let eo=[];const _o=Ze(eo);async function G1(){eo=await(await Cl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),_o.set(eo)}function bs(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function dc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function vc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),a=[...e];a.reverse();let r,c,f;for(let m=0;m<a.length;m++){let _=a[m],b=_.tag_name.substring(1).split("."),d=parseInt(b[0]),g=parseInt(b[1]),w=parseInt(b[2]);if(d==n)g==i?w>o&&(r=_):g==i+1&&(c=_);else if(d==n+1)if(f){let k=f.tag_name.substring(1).split(".");parseInt(k[0]);let T=parseInt(k[1]);parseInt(k[2]),g==T&&(f=_)}else f=_}return c||f||r||!1}else return e[0]}const B1="/github.svg";function Wr(t){let e,l;function n(a,r){return a[1]>1?Z1:a[1]>0?X1:a[2]>1?Q1:a[2]>0?K1:a[3]>1?V1:a[3]>0?z1:Y1}let i=n(t),o=i(t);return{c(){e=C(`Up
`),o.c(),l=We()},m(a,r){$(a,e,r),o.m(a,r),$(a,l,r)},p(a,r){i===(i=n(a))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},d(a){a&&y(e),o.d(a),a&&y(l)}}}function Y1(t){let e,l;return{c(){e=C(t[0]),l=C(" seconds")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&1&&B(e,n[0])},d(n){n&&y(e),n&&y(l)}}}function z1(t){let e,l;return{c(){e=C(t[3]),l=C(" minute")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&y(e),n&&y(l)}}}function V1(t){let e,l;return{c(){e=C(t[3]),l=C(" minutes")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&y(e),n&&y(l)}}}function K1(t){let e,l;return{c(){e=C(t[2]),l=C(" hour")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&y(e),n&&y(l)}}}function Q1(t){let e,l;return{c(){e=C(t[2]),l=C(" hours")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&y(e),n&&y(l)}}}function X1(t){let e,l;return{c(){e=C(t[1]),l=C(" day")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&y(e),n&&y(l)}}}function Z1(t){let e,l;return{c(){e=C(t[1]),l=C(" days")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&y(e),n&&y(l)}}}function J1(t){let e,l=t[0]&&Wr(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Wr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&y(e)}}}function x1(t,e,l){let{epoch:n}=e,i=0,o=0,a=0;return t.$$set=r=>{"epoch"in r&&l(0,n=r.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,a=Math.floor(n/60)))},[n,i,o,a]}class ep extends $e{constructor(e){super(),ye(this,e,x1,J1,ke,{epoch:0})}}function tp(t){let e,l,n;return{c(){e=p("span"),l=C(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){$(i,e,o),s(e,l)},p(i,[o]){o&4&&B(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ie,o:ie,d(i){i&&y(e)}}}function lp(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class Kt extends $e{constructor(e){super(),ye(this,e,lp,tp,ke,{color:0,title:1,text:2})}}function np(t){let e,l=`${Ee(t[0].getDate())}.${Ee(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ee(t[0].getHours())}:${Ee(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=C(l),u(e,"class",t[1])},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ee(i[0].getDate())}.${Ee(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ee(i[0].getHours())}:${Ee(i[0].getMinutes())}`)&&B(n,l),o&2&&u(e,"class",i[1])},d(i){i&&y(e)}}}function ip(t){let e=`${Ee(t[0].getDate())}. ${Ks[t[0].getMonth()]} ${Ee(t[0].getHours())}:${Ee(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(n,i){$(n,l,i)},p(n,i){i&1&&e!==(e=`${Ee(n[0].getDate())}. ${Ks[n[0].getMonth()]} ${Ee(n[0].getHours())}:${Ee(n[0].getMinutes())}`)&&B(l,e)},d(n){n&&y(l)}}}function sp(t){let e,l;function n(a,r){return r&1&&(e=null),e==null&&(e=Math.abs(new Date().getTime()-a[0].getTime())<3e5),e?ip:np}let i=n(t,-1),o=i(t);return{c(){o.c(),l=We()},m(a,r){o.m(a,r),$(a,l,r)},p(a,[r]){i===(i=n(a,r))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},i:ie,o:ie,d(a){o.d(a),a&&y(l)}}}function op(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e;return t.$$set=o=>{"timestamp"in o&&l(0,n=o.timestamp),"fullTimeColor"in o&&l(1,i=o.fullTimeColor)},[n,i]}class hc extends $e{constructor(e){super(),ye(this,e,op,sp,ke,{timestamp:0,fullTimeColor:1})}}function up(t){let e,l,n;return{c(){e=He("svg"),l=He("path"),n=He("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){$(i,e,o),s(e,l),s(e,n)},p:ie,i:ie,o:ie,d(i){i&&y(e)}}}class rp extends $e{constructor(e){super(),ye(this,e,null,up,ke,{})}}function ap(t){let e,l;return{c(){e=He("svg"),l=He("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){$(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&y(e)}}}class fp extends $e{constructor(e){super(),ye(this,e,null,ap,ke,{})}}function cp(t){let e,l;return{c(){e=He("svg"),l=He("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){$(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&y(e)}}}class $t extends $e{constructor(e){super(),ye(this,e,null,cp,ke,{})}}function pp(t){let e,l;return{c(){e=He("svg"),l=He("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){$(n,e,i),s(e,l)},p:ie,i:ie,o:ie,d(n){n&&y(e)}}}class bc extends $e{constructor(e){super(),ye(this,e,null,pp,ke,{})}}function mp(t){let e,l,n=t[1].version+"",i;return{c(){e=C("AMS reader "),l=p("span"),i=C(n)},m(o,a){$(o,e,a),$(o,l,a),s(l,i)},p(o,a){a&2&&n!==(n=o[1].version+"")&&B(i,n)},d(o){o&&y(e),o&&y(l)}}}function Gr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=C(l),i=C("\xB0C"),u(e,"class","flex-none my-auto")},m(o,a){$(o,e,a),s(e,n),s(e,i)},p(o,a){a&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&B(n,l)},d(o){o&&y(e)}}}function Br(t){let e,l="HAN: "+Lr(t[0].he),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Lr(i[0].he))&&B(n,l)},d(i){i&&y(e)}}}function Yr(t){let e,l="MQTT: "+Or(t[0].me),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Or(i[0].me))&&B(n,l)},d(i){i&&y(e)}}}function zr(t){let e,l="PriceAPI: "+qr(t[0].ee),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+qr(i[0].ee))&&B(n,l)},d(i){i&&y(e)}}}function Vr(t){let e,l,n,i,o,a;return l=new wl({props:{to:"/configuration",$$slots:{default:[_p]},$$scope:{ctx:t}}}),o=new wl({props:{to:"/status",$$slots:{default:[dp]},$$scope:{ctx:t}}}),{c(){e=p("div"),Z(l.$$.fragment),n=v(),i=p("div"),Z(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(r,c){$(r,e,c),Q(l,e,null),$(r,n,c),$(r,i,c),Q(o,i,null),a=!0},i(r){a||(M(l.$$.fragment,r),M(o.$$.fragment,r),a=!0)},o(r){I(l.$$.fragment,r),I(o.$$.fragment,r),a=!1},d(r){r&&y(e),X(l),r&&y(n),r&&y(i),X(o)}}}function _p(t){let e,l;return e=new rp({}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function dp(t){let e,l;return e=new fp({}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Kr(t){let e,l,n,i,o;const a=[hp,vp],r=[];function c(f,m){return f[1].security==0||f[0].a?0:1}return l=c(t),n=r[l]=a[l](t),{c(){e=p("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(f,m){$(f,e,m),r[l].m(e,null),o=!0},p(f,m){let _=l;l=c(f),l===_?r[l].p(f,m):(Te(),I(r[_],1,1,()=>{r[_]=null}),Se(),n=r[l],n?n.p(f,m):(n=r[l]=a[l](f),n.c()),M(n,1),n.m(e,null)),(!o||m&4&&i!==(i="New version: "+f[2].tag_name))&&u(e,"title",i)},i(f){o||(M(n),o=!0)},o(f){I(n),o=!1},d(f){f&&y(e),r[l].d()}}}function vp(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=p("span"),l=C("New version: "),i=C(n)},m(o,a){$(o,e,a),s(e,l),s(e,i)},p(o,a){a&4&&n!==(n=o[2].tag_name+"")&&B(i,n)},i:ie,o:ie,d(o){o&&y(e)}}}function hp(t){let e,l,n,i=t[2].tag_name+"",o,a,r,c,f,m;return r=new bc({}),{c(){e=p("button"),l=p("span"),n=C("New version: "),o=C(i),a=v(),Z(r.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(_,h){$(_,e,h),s(e,l),s(l,n),s(l,o),s(e,a),Q(r,e,null),c=!0,f||(m=z(e,"click",t[3]),f=!0)},p(_,h){(!c||h&4)&&i!==(i=_[2].tag_name+"")&&B(o,i)},i(_){c||(M(r.$$.fragment,_),c=!0)},o(_){I(r.$$.fragment,_),c=!1},d(_){_&&y(e),X(r),f=!1,m()}}}function bp(t){let e,l,n,i,o,a,r,c,f,m,_,h,b=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,g,w,k,T,P,E,S,N,D,R,W,q,F,L,j,U,O,G,H,V,J,ne,le,me,Pe,we,Re,Ce,Fe;i=new wl({props:{to:"/",$$slots:{default:[mp]},$$scope:{ctx:t}}}),c=new ep({props:{epoch:t[0].u}});let _e=t[0].t>-50&&Gr(t);T=new Kt({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:kl(t[1].booting?2:t[0].em)}}),E=new Kt({props:{title:"HAN",text:"HAN",color:kl(t[1].booting?9:t[0].hm)}}),N=new Kt({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:kl(t[1].booting?9:t[0].wm)}}),R=new Kt({props:{title:"MQTT",text:"MQTT",color:kl(t[1].booting?9:t[0].mm)}});let Me=(t[0].he<0||t[0].he>0)&&Br(t),Ie=t[0].me<0&&Yr(t),ce=(t[0].ee>0||t[0].ee<0)&&zr(t);ne=new hc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),fullTimeColor:"text-red-500"}});let se=t[1].vndcfg&&t[1].usrcfg&&Vr(t);Re=new $t({});let pe=t[1].fwconsent===1&&t[2]&&Kr(t);return{c(){e=p("nav"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=v(),a=p("div"),r=p("div"),Z(c.$$.fragment),f=v(),_e&&_e.c(),m=v(),_=p("div"),h=C("Free mem: "),d=C(b),g=C("kb"),w=v(),k=p("div"),Z(T.$$.fragment),P=v(),Z(E.$$.fragment),S=v(),Z(N.$$.fragment),D=v(),Z(R.$$.fragment),W=v(),Me&&Me.c(),q=v(),Ie&&Ie.c(),F=v(),ce&&ce.c(),L=v(),j=p("div"),U=p("div"),O=p("a"),G=p("img"),V=v(),J=p("div"),Z(ne.$$.fragment),le=v(),se&&se.c(),me=v(),Pe=p("div"),we=p("a"),Z(Re.$$.fragment),Ce=v(),pe&&pe.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(r,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(a,"class","flex-none my-auto p-2 flex space-x-4"),u(k,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(G,"class","gh-logo"),Tc(G.src,H=B1)||u(G,"src",H),u(G,"alt","GitHub repo"),u(O,"class","float-right"),u(O,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(O,"target","_blank"),u(O,"rel","noreferrer"),u(O,"aria-label","GitHub"),u(U,"class","flex-none"),u(J,"class","flex-none my-auto px-2"),u(we,"href",Ct("")),u(we,"target","_blank"),u(we,"rel","noreferrer"),u(Pe,"class","flex-none px-1 mt-1"),u(Pe,"title","Documentation"),u(j,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(K,re){$(K,e,re),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,a),s(a,r),Q(c,r,null),s(a,f),_e&&_e.m(a,null),s(a,m),s(a,_),s(_,h),s(_,d),s(_,g),s(l,w),s(l,k),Q(T,k,null),s(k,P),Q(E,k,null),s(k,S),Q(N,k,null),s(k,D),Q(R,k,null),s(l,W),Me&&Me.m(l,null),s(l,q),Ie&&Ie.m(l,null),s(l,F),ce&&ce.m(l,null),s(l,L),s(l,j),s(j,U),s(U,O),s(O,G),s(j,V),s(j,J),Q(ne,J,null),s(j,le),se&&se.m(j,null),s(j,me),s(j,Pe),s(Pe,we),Q(Re,we,null),s(j,Ce),pe&&pe.m(j,null),Fe=!0},p(K,[re]){const Ae={};re&18&&(Ae.$$scope={dirty:re,ctx:K}),i.$set(Ae);const Ne={};re&1&&(Ne.epoch=K[0].u),c.$set(Ne),K[0].t>-50?_e?_e.p(K,re):(_e=Gr(K),_e.c(),_e.m(a,m)):_e&&(_e.d(1),_e=null),(!Fe||re&1)&&b!==(b=(K[0].m?(K[0].m/1e3).toFixed(1):"-")+"")&&B(d,b);const de={};re&3&&(de.text=K[1].booting?"Booting":K[0].v>2?K[0].v.toFixed(2)+"V":"ESP"),re&3&&(de.color=kl(K[1].booting?2:K[0].em)),T.$set(de);const ee={};re&3&&(ee.color=kl(K[1].booting?9:K[0].hm)),E.$set(ee);const oe={};re&1&&(oe.text=K[0].r?K[0].r.toFixed(0)+"dBm":"WiFi"),re&3&&(oe.color=kl(K[1].booting?9:K[0].wm)),N.$set(oe);const ve={};re&3&&(ve.color=kl(K[1].booting?9:K[0].mm)),R.$set(ve),K[0].he<0||K[0].he>0?Me?Me.p(K,re):(Me=Br(K),Me.c(),Me.m(l,q)):Me&&(Me.d(1),Me=null),K[0].me<0?Ie?Ie.p(K,re):(Ie=Yr(K),Ie.c(),Ie.m(l,F)):Ie&&(Ie.d(1),Ie=null),K[0].ee>0||K[0].ee<0?ce?ce.p(K,re):(ce=zr(K),ce.c(),ce.m(l,L)):ce&&(ce.d(1),ce=null);const De={};re&1&&(De.timestamp=K[0].c?new Date(K[0].c*1e3):new Date(0)),ne.$set(De),K[1].vndcfg&&K[1].usrcfg?se?re&2&&M(se,1):(se=Vr(K),se.c(),M(se,1),se.m(j,me)):se&&(Te(),I(se,1,1,()=>{se=null}),Se()),K[1].fwconsent===1&&K[2]?pe?(pe.p(K,re),re&6&&M(pe,1)):(pe=Kr(K),pe.c(),M(pe,1),pe.m(j,null)):pe&&(Te(),I(pe,1,1,()=>{pe=null}),Se())},i(K){Fe||(M(i.$$.fragment,K),M(c.$$.fragment,K),M(T.$$.fragment,K),M(E.$$.fragment,K),M(N.$$.fragment,K),M(R.$$.fragment,K),M(ne.$$.fragment,K),M(se),M(Re.$$.fragment,K),M(pe),Fe=!0)},o(K){I(i.$$.fragment,K),I(c.$$.fragment,K),I(T.$$.fragment,K),I(E.$$.fragment,K),I(N.$$.fragment,K),I(R.$$.fragment,K),I(ne.$$.fragment,K),I(se),I(Re.$$.fragment,K),I(pe),Fe=!1},d(K){K&&y(e),X(i),X(c),_e&&_e.d(),X(T),X(E),X(N),X(R),Me&&Me.d(),Ie&&Ie.d(),ce&&ce.d(),X(ne),se&&se.d(),X(Re),pe&&pe.d()}}}function gp(t,e,l){let{data:n={}}=e,i={},o={};function a(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!Yn(i.board)||confirm(bs(fe(i.chip,i.board))))&&(Tt.update(r=>(r.upgrading=!0,r)),dc(o.tag_name))}return Tt.subscribe(r=>{l(1,i=r),r.fwconsent===1&&G1()}),_o.subscribe(r=>{l(2,o=vc(i.version,r))}),t.$$set=r=>{"data"in r&&l(0,n=r.data)},[n,i,o,a]}class kp extends $e{constructor(e){super(),ye(this,e,gp,bp,ke,{data:0})}}function wp(t){let e,l,n,i;return{c(){e=He("svg"),l=He("path"),n=He("path"),u(l,"d",Gs(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Gs(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,a){$(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=Gs(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),a&2&&u(n,"stroke",o[1])},i:ie,o:ie,d(o){o&&y(e)}}}function Qr(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Gs(t,e,l,n,i){var o=Qr(t,e,l,i),a=Qr(t,e,l,n),r=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,r,0,a.x,a.y].join(" ");return c}function yp(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 $p extends $e{constructor(e){super(),ye(this,e,yp,wp,ke,{pct:0,color:1})}}function Xr(t){let e,l,n,i,o,a,r,c;return{c(){e=p("br"),l=v(),n=p("span"),i=C(t[3]),o=v(),a=p("span"),r=C(t[4]),c=C("/kWh"),u(n,"class","pl-sub"),u(a,"class","pl-snt")},m(f,m){$(f,e,m),$(f,l,m),$(f,n,m),s(n,i),$(f,o,m),$(f,a,m),s(a,r),s(a,c)},p(f,m){m&8&&B(i,f[3]),m&16&&B(r,f[4])},d(f){f&&y(e),f&&y(l),f&&y(n),f&&y(o),f&&y(a)}}}function Cp(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w;l=new $p({props:{pct:t[6],color:t[5](t[6])}});let k=t[3]&&Xr(t);return{c(){e=p("div"),Z(l.$$.fragment),n=v(),i=p("span"),o=p("span"),a=C(t[2]),r=v(),c=p("br"),f=v(),m=p("span"),_=C(t[0]),h=v(),b=p("span"),d=C(t[1]),g=v(),k&&k.c(),u(o,"class","pl-lab"),u(m,"class","pl-val"),u(b,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(T,P){$(T,e,P),Q(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,r),s(i,c),s(i,f),s(i,m),s(m,_),s(i,h),s(i,b),s(b,d),s(i,g),k&&k.m(i,null),w=!0},p(T,[P]){const E={};P&64&&(E.pct=T[6]),P&96&&(E.color=T[5](T[6])),l.$set(E),(!w||P&4)&&B(a,T[2]),(!w||P&1)&&B(_,T[0]),(!w||P&2)&&B(d,T[1]),T[3]?k?k.p(T,P):(k=Xr(T),k.c(),k.m(i,null)):k&&(k.d(1),k=null)},i(T){w||(M(l.$$.fragment,T),w=!0)},o(T){I(l.$$.fragment,T),w=!1},d(T){T&&y(e),X(l),k&&k.d()}}}function Tp(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:r=""}=e,{subunit:c=""}=e,{colorFn:f}=e,m=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,a=_.label),"sub"in _&&l(3,r=_.sub),"subunit"in _&&l(4,c=_.subunit),"colorFn"in _&&l(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,m=Math.min(n,i)/i*100)},[n,o,a,r,c,f,m,i]}class gc extends $e{constructor(e){super(),ye(this,e,Tp,Cp,ke,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Zr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Jr(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function xr(t,e,l){const n=t.slice();return n[13]=e[l],n}function ea(t){let e,l=t[0].title+"",n;return{c(){e=p("strong"),n=C(l),u(e,"class","text-sm")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[0].title+"")&&B(n,l)},d(i){i&&y(e)}}}function ta(t){let e,l,n,i=t[13].label+"",o,a,r,c;return{c(){e=He("g"),l=He("line"),n=He("text"),o=C(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",a=t[13].align=="right"?"85%":""),u(e,"class",r="tick tick-"+t[13].value+" tick-"+t[13].color),u(e,"transform",c="translate(0, "+t[6](t[13].value)+")")},m(f,m){$(f,e,m),s(e,l),s(e,n),s(n,o)},p(f,m){m&1&&i!==(i=f[13].label+"")&&B(o,i),m&1&&a!==(a=f[13].align=="right"?"85%":"")&&u(n,"x",a),m&1&&r!==(r="tick tick-"+f[13].value+" tick-"+f[13].color)&&u(e,"class",r),m&65&&c!==(c="translate(0, "+f[6](f[13].value)+")")&&u(e,"transform",c)},d(f){f&&y(e)}}}function la(t){let e,l,n=t[9].label+"",i,o,a;return{c(){e=He("g"),l=He("text"),i=C(n),u(l,"x",o=t[3]/2),u(l,"y","-4"),u(e,"class","tick"),u(e,"transform",a="translate("+t[5](t[11])+","+t[4]+")")},m(r,c){$(r,e,c),s(e,l),s(l,i)},p(r,c){c&1&&n!==(n=r[9].label+"")&&B(i,n),c&8&&o!==(o=r[3]/2)&&u(l,"x",o),c&48&&a!==(a="translate("+r[5](r[11])+","+r[4]+")")&&u(e,"transform",a)},d(r){r&&y(e)}}}function na(t){let e,l,n,i,o,a,r,c=t[3]>15&&ia(t);return{c(){e=He("rect"),c&&c.c(),r=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](t[9].value)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),u(e,"fill",a=t[9].color)},m(f,m){$(f,e,m),c&&c.m(f,m),$(f,r,m)},p(f,m){m&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),m&65&&n!==(n=f[6](f[9].value))&&u(e,"y",n),m&8&&i!==(i=f[3]-4)&&u(e,"width",i),m&65&&o!==(o=f[6](f[0].y.min)-f[6](Math.min(f[0].y.min,0)+f[9].value))&&u(e,"height",o),m&1&&a!==(a=f[9].color)&&u(e,"fill",a),f[3]>15?c?c.p(f,m):(c=ia(f),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(f){f&&y(e),c&&c.d(f),f&&y(r)}}}function ia(t){let e,l=t[9].label+"",n,i,o,a,r,c,f;return{c(){e=He("text"),n=C(l),u(e,"y",i=t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10),u(e,"x",o=t[5](t[11])+t[3]/2),u(e,"width",a=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",r=t[3]<25?"left":"middle"),u(e,"fill",c=t[6](t[9].value)>t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",f="rotate("+(t[3]<25?90:0)+", "+(t[5](t[11])+t[3]/2)+", "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+9)+")")},m(m,_){$(m,e,_),s(e,n)},p(m,_){_&1&&l!==(l=m[9].label+"")&&B(n,l),_&193&&i!==(i=m[6](m[9].value)>m[6](0)-m[7]?m[6](m[9].value)-m[7]:m[6](m[9].value)+10)&&u(e,"y",i),_&40&&o!==(o=m[5](m[11])+m[3]/2)&&u(e,"x",o),_&8&&a!==(a=m[3]-4)&&u(e,"width",a),_&8&&r!==(r=m[3]<25?"left":"middle")&&u(e,"text-anchor",r),_&193&&c!==(c=m[6](m[9].value)>m[6](0)-m[7]?m[9].color:"white")&&u(e,"fill",c),_&233&&f!==(f="rotate("+(m[3]<25?90:0)+", "+(m[5](m[11])+m[3]/2)+", "+(m[6](m[9].value)>m[6](0)-m[7]?m[6](m[9].value)-m[7]:m[6](m[9].value)+9)+")")&&u(e,"transform",f)},d(m){m&&y(e)}}}function sa(t){let e,l,n,i,o,a,r,c=t[3]>15&&oa(t);return{c(){e=He("rect"),c&&c.c(),r=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](0)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),u(e,"fill",a=t[9].color)},m(f,m){$(f,e,m),c&&c.m(f,m),$(f,r,m)},p(f,m){m&32&&l!==(l=f[5](f[11])+2)&&u(e,"x",l),m&64&&n!==(n=f[6](0))&&u(e,"y",n),m&8&&i!==(i=f[3]-4)&&u(e,"width",i),m&65&&o!==(o=f[6](f[0].y.min)-f[6](f[0].y.min+f[9].value2))&&u(e,"height",o),m&1&&a!==(a=f[9].color)&&u(e,"fill",a),f[3]>15?c?c.p(f,m):(c=oa(f),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(f){f&&y(e),c&&c.d(f),f&&y(r)}}}function oa(t){let e,l=t[9].label2+"",n,i,o,a,r,c,f;return{c(){e=He("text"),n=C(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",a=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",r=t[3]<25?"left":"middle"),u(e,"fill",c=t[6](-t[9].value2)<t[6](0)+12?t[9].color:"white"),u(e,"transform",f="rotate("+(t[3]<25?90:0)+", "+(t[5](t[11])+t[3]/2)+", "+(t[6](t[9].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(m,_){$(m,e,_),s(e,n)},p(m,_){_&1&&l!==(l=m[9].label2+"")&&B(n,l),_&65&&i!==(i=m[6](-m[9].value2)<m[6](0)+12?m[6](-m[9].value2)+12:m[6](-m[9].value2)-10)&&u(e,"y",i),_&40&&o!==(o=m[5](m[11])+m[3]/2)&&u(e,"x",o),_&8&&a!==(a=m[3]-4)&&u(e,"width",a),_&8&&r!==(r=m[3]<25?"left":"middle")&&u(e,"text-anchor",r),_&65&&c!==(c=m[6](-m[9].value2)<m[6](0)+12?m[9].color:"white")&&u(e,"fill",c),_&105&&f!==(f="rotate("+(m[3]<25?90:0)+", "+(m[5](m[11])+m[3]/2)+", "+(m[6](m[9].value2-m[0].y.min)>m[6](0)-12?m[6](m[9].value2-m[0].y.min)-12:m[6](m[9].value2-m[0].y.min)+9)+")")&&u(e,"transform",f)},d(m){m&&y(e)}}}function ua(t){let e,l,n=t[9].value!==void 0&&na(t),i=t[9].value2>1e-4&&sa(t);return{c(){n&&n.c(),e=We(),i&&i.c(),l=We()},m(o,a){n&&n.m(o,a),$(o,e,a),i&&i.m(o,a),$(o,l,a)},p(o,a){o[9].value!==void 0?n?n.p(o,a):(n=na(o),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,a):(i=sa(o),i.c(),i.m(l.parentNode,l)):i&&(i.d(1),i=null)},d(o){n&&n.d(o),o&&y(e),i&&i.d(o),o&&y(l)}}}function Sp(t){let e,l,n,i,o,a,r,c=t[0].title&&ea(t),f=t[0].y.ticks,m=[];for(let g=0;g<f.length;g+=1)m[g]=ta(xr(t,f,g));let _=t[0].x.ticks,h=[];for(let g=0;g<_.length;g+=1)h[g]=la(Jr(t,_,g));let b=t[0].points,d=[];for(let g=0;g<b.length;g+=1)d[g]=ua(Zr(t,b,g));return{c(){e=p("div"),c&&c.c(),l=v(),n=He("svg"),i=He("g");for(let g=0;g<m.length;g+=1)m[g].c();o=He("g");for(let g=0;g<h.length;g+=1)h[g].c();a=He("g");for(let g=0;g<d.length;g+=1)d[g].c();u(i,"class","axis y-axis"),u(o,"class","axis x-axis"),u(a,"class","bars"),u(n,"height",t[4]),u(e,"class","chart"),Ye(()=>t[8].call(e))},m(g,w){$(g,e,w),c&&c.m(e,null),s(e,l),s(e,n),s(n,i);for(let k=0;k<m.length;k+=1)m[k].m(i,null);s(n,o);for(let k=0;k<h.length;k+=1)h[k].m(o,null);s(n,a);for(let k=0;k<d.length;k+=1)d[k].m(a,null);r=Ac(e,t[8].bind(e))},p(g,[w]){if(g[0].title?c?c.p(g,w):(c=ea(g),c.c(),c.m(e,l)):c&&(c.d(1),c=null),w&65){f=g[0].y.ticks;let k;for(k=0;k<f.length;k+=1){const T=xr(g,f,k);m[k]?m[k].p(T,w):(m[k]=ta(T),m[k].c(),m[k].m(i,null))}for(;k<m.length;k+=1)m[k].d(1);m.length=f.length}if(w&57){_=g[0].x.ticks;let k;for(k=0;k<_.length;k+=1){const T=Jr(g,_,k);h[k]?h[k].p(T,w):(h[k]=la(T),h[k].c(),h[k].m(o,null))}for(;k<h.length;k+=1)h[k].d(1);h.length=_.length}if(w&233){b=g[0].points;let k;for(k=0;k<b.length;k+=1){const T=Zr(g,b,k);d[k]?d[k].p(T,w):(d[k]=ua(T),d[k].c(),d[k].m(a,null))}for(;k<d.length;k+=1)d[k].d(1);d.length=b.length}w&16&&u(n,"height",g[4])},i:ie,o:ie,d(g){g&&y(e),c&&c.d(),Qt(m,g),Qt(h,g),Qt(d,g),r()}}}function Pp(t,e,l){let{config:n}=e,i,o,a,r,c,f,m;function _(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=h=>{"config"in h&&l(0,n=h.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,f=o-(n.title?20:0));let h=i-(n.padding.left+n.padding.right);l(3,a=h/n.points.length),l(7,m=a<25?28:17);let b=(f-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,r=function(d){return d*a+n.padding.left}),l(6,c=function(d){let g=0;return d>n.y.max?g=n.padding.bottom:d<n.y.min?g=f-n.padding.bottom:g=f-n.padding.bottom-(d-n.y.min)*b,g>f||g<0?0:g})}},[n,i,o,a,f,r,c,m,_]}class Vl extends $e{constructor(e){super(),ye(this,e,Pp,Sp,ke,{config:0})}}function Mp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Ap(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:a}=e,r={};function c(f){return{label:ge(f)+"V",value:isNaN(f)?0:f,color:q1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,a=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],m=[];n>0&&(f.push({label:a===1?"L1-L2":"L1"}),m.push(c(n))),i>0&&(f.push({label:a===1?"L1-L3":"L2"}),m.push(c(i))),o>0&&(f.push({label:a===1?"L2-L3":"L3"}),m.push(c(o))),l(0,r={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:m})}},[r,n,i,o,a]}class Dp extends $e{constructor(e){super(),ye(this,e,Ap,Mp,ke,{u1:1,u2:2,u3:3,ds:4})}}function Np(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Ip(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:a}=e,{i2:r}=e,{i3:c}=e,{max:f}=e,m={};function _(h){return{label:ge(h)+"A",value:isNaN(h)?0:h,color:uc(h?h/f*100:0)}}return t.$$set=h=>{"u1"in h&&l(1,n=h.u1),"u2"in h&&l(2,i=h.u2),"u3"in h&&l(3,o=h.u3),"i1"in h&&l(4,a=h.i1),"i2"in h&&l(5,r=h.i2),"i3"in h&&l(6,c=h.i3),"max"in h&&l(7,f=h.max)},t.$$.update=()=>{if(t.$$.dirty&254){let h=[],b=[];n>0&&(h.push({label:"L1"}),b.push(_(a))),i>0&&(h.push({label:"L2"}),b.push(_(r))),o>0&&(h.push({label:"L3"}),b.push(_(c))),l(0,m={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:f,ticks:[{value:0,label:"0%"},{value:f/4,label:"25%"},{value:f/2,label:"50%"},{value:f/4*3,label:"75%"},{value:f,label:"100%"}]},x:{ticks:h},points:b})}},[m,n,i,o,a,r,c,f]}class Ep extends $e{constructor(e){super(),ye(this,e,Ip,Np,ke,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function Rp(t){let e,l,n,i,o,a,r,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,m,_,h,b,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",w,k,T,P,E,S,N,D=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",R,W,q,F,L,j,U=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",O,G;return{c(){e=p("div"),l=p("strong"),l.textContent="Reactive",n=v(),i=p("div"),o=p("div"),o.textContent="Instant in",a=v(),r=p("div"),f=C(c),m=C(" VAr"),_=v(),h=p("div"),h.textContent="Instant out",b=v(),d=p("div"),w=C(g),k=C(" VAr"),T=v(),P=p("div"),E=p("div"),E.textContent="Total in",S=v(),N=p("div"),R=C(D),W=C(" kVArh"),q=v(),F=p("div"),F.textContent="Total out",L=v(),j=p("div"),O=C(U),G=C(" kVArh"),u(r,"class","text-right"),u(d,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(N,"class","text-right"),u(j,"class","text-right"),u(P,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(H,V){$(H,e,V),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(i,r),s(r,f),s(r,m),s(i,_),s(i,h),s(i,b),s(i,d),s(d,w),s(d,k),s(e,T),s(e,P),s(P,E),s(P,S),s(P,N),s(N,R),s(N,W),s(P,q),s(P,F),s(P,L),s(P,j),s(j,O),s(j,G)},p(H,[V]){V&1&&c!==(c=(typeof H[0]<"u"?H[0].toFixed(0):"-")+"")&&B(f,c),V&2&&g!==(g=(typeof H[1]<"u"?H[1].toFixed(0):"-")+"")&&B(w,g),V&4&&D!==(D=(typeof H[2]<"u"?H[2].toFixed(1):"-")+"")&&B(R,D),V&8&&U!==(U=(typeof H[3]<"u"?H[3].toFixed(1):"-")+"")&&B(O,U)},i:ie,o:ie,d(H){H&&y(e)}}}function Fp(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e;return t.$$set=r=>{"importInstant"in r&&l(0,n=r.importInstant),"exportInstant"in r&&l(1,i=r.exportInstant),"importTotal"in r&&l(2,o=r.importTotal),"exportTotal"in r&&l(3,a=r.exportTotal)},[n,i,o,a]}class Lp extends $e{constructor(e){super(),ye(this,e,Fp,Rp,ke,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function ra(t){let e;function l(o,a){return o[2]?qp:Op}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,a){i.m(o,a),$(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&y(e)}}}function Op(t){let e,l,n,i,o,a,r=ge(t[0].h.u,2)+"",c,f,m,_,h,b,d=ge(t[0].d.u,1)+"",g,w,k,T,P,E,S=ge(t[0].m.u)+"",N,D,R,W,q=t[3]&&aa(t);return{c(){e=p("strong"),e.textContent="Consumption",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=C(" kWh"),m=v(),_=p("div"),_.textContent="Day",h=v(),b=p("div"),g=C(d),w=C(" kWh"),k=v(),T=p("div"),T.textContent="Month",P=v(),E=p("div"),N=C(S),D=C(" kWh"),R=v(),q&&q.c(),W=We(),u(a,"class","text-right"),u(b,"class","text-right"),u(E,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(F,L){$(F,e,L),$(F,l,L),$(F,n,L),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,m),s(n,_),s(n,h),s(n,b),s(b,g),s(b,w),s(n,k),s(n,T),s(n,P),s(n,E),s(E,N),s(E,D),$(F,R,L),q&&q.m(F,L),$(F,W,L)},p(F,L){L&1&&r!==(r=ge(F[0].h.u,2)+"")&&B(c,r),L&1&&d!==(d=ge(F[0].d.u,1)+"")&&B(g,d),L&1&&S!==(S=ge(F[0].m.u)+"")&&B(N,S),F[3]?q?q.p(F,L):(q=aa(F),q.c(),q.m(W.parentNode,W)):q&&(q.d(1),q=null)},d(F){F&&y(e),F&&y(l),F&&y(n),F&&y(R),q&&q.d(F),F&&y(W)}}}function qp(t){let e,l,n,i,o,a,r=ge(t[0].h.u,2)+"",c,f,m,_,h,b,d,g=ge(t[0].d.u,1)+"",w,k,T,P,E,S,N,D=ge(t[0].m.u)+"",R,W,q,F,L,j,U,O,G,H,V,J=ge(t[0].h.p,2)+"",ne,le,me,Pe,we,Re,Ce,Fe=ge(t[0].d.p,1)+"",_e,Me,Ie,ce,se,pe,K,re=ge(t[0].m.p)+"",Ae,Ne,de,ee,oe=t[3]&&fa(t),ve=t[3]&&ca(t),De=t[3]&&pa(t),Oe=t[3]&&ma(t),he=t[3]&&_a(t),be=t[3]&&da(t);return{c(){e=p("strong"),e.textContent="Import",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=C(" kWh"),m=v(),oe&&oe.c(),_=v(),h=p("div"),h.textContent="Day",b=v(),d=p("div"),w=C(g),k=C(" kWh"),T=v(),ve&&ve.c(),P=v(),E=p("div"),E.textContent="Month",S=v(),N=p("div"),R=C(D),W=C(" kWh"),q=v(),De&&De.c(),L=v(),j=p("strong"),j.textContent="Export",U=v(),O=p("div"),G=p("div"),G.textContent="Hour",H=v(),V=p("div"),ne=C(J),le=C(" kWh"),me=v(),Oe&&Oe.c(),Pe=v(),we=p("div"),we.textContent="Day",Re=v(),Ce=p("div"),_e=C(Fe),Me=C(" kWh"),Ie=v(),he&&he.c(),ce=v(),se=p("div"),se.textContent="Month",pe=v(),K=p("div"),Ae=C(re),Ne=C(" kWh"),de=v(),be&&be.c(),u(a,"class","text-right"),u(d,"class","text-right"),u(N,"class","text-right"),u(n,"class",F="grid grid-cols-"+t[4]+" mb-3"),u(V,"class","text-right"),u(Ce,"class","text-right"),u(K,"class","text-right"),u(O,"class",ee="grid grid-cols-"+t[4])},m(x,ue){$(x,e,ue),$(x,l,ue),$(x,n,ue),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,m),oe&&oe.m(n,null),s(n,_),s(n,h),s(n,b),s(n,d),s(d,w),s(d,k),s(n,T),ve&&ve.m(n,null),s(n,P),s(n,E),s(n,S),s(n,N),s(N,R),s(N,W),s(n,q),De&&De.m(n,null),$(x,L,ue),$(x,j,ue),$(x,U,ue),$(x,O,ue),s(O,G),s(O,H),s(O,V),s(V,ne),s(V,le),s(O,me),Oe&&Oe.m(O,null),s(O,Pe),s(O,we),s(O,Re),s(O,Ce),s(Ce,_e),s(Ce,Me),s(O,Ie),he&&he.m(O,null),s(O,ce),s(O,se),s(O,pe),s(O,K),s(K,Ae),s(K,Ne),s(O,de),be&&be.m(O,null)},p(x,ue){ue&1&&r!==(r=ge(x[0].h.u,2)+"")&&B(c,r),x[3]?oe?oe.p(x,ue):(oe=fa(x),oe.c(),oe.m(n,_)):oe&&(oe.d(1),oe=null),ue&1&&g!==(g=ge(x[0].d.u,1)+"")&&B(w,g),x[3]?ve?ve.p(x,ue):(ve=ca(x),ve.c(),ve.m(n,P)):ve&&(ve.d(1),ve=null),ue&1&&D!==(D=ge(x[0].m.u)+"")&&B(R,D),x[3]?De?De.p(x,ue):(De=pa(x),De.c(),De.m(n,null)):De&&(De.d(1),De=null),ue&16&&F!==(F="grid grid-cols-"+x[4]+" mb-3")&&u(n,"class",F),ue&1&&J!==(J=ge(x[0].h.p,2)+"")&&B(ne,J),x[3]?Oe?Oe.p(x,ue):(Oe=ma(x),Oe.c(),Oe.m(O,Pe)):Oe&&(Oe.d(1),Oe=null),ue&1&&Fe!==(Fe=ge(x[0].d.p,1)+"")&&B(_e,Fe),x[3]?he?he.p(x,ue):(he=_a(x),he.c(),he.m(O,ce)):he&&(he.d(1),he=null),ue&1&&re!==(re=ge(x[0].m.p)+"")&&B(Ae,re),x[3]?be?be.p(x,ue):(be=da(x),be.c(),be.m(O,null)):be&&(be.d(1),be=null),ue&16&&ee!==(ee="grid grid-cols-"+x[4])&&u(O,"class",ee)},d(x){x&&y(e),x&&y(l),x&&y(n),oe&&oe.d(),ve&&ve.d(),De&&De.d(),x&&y(L),x&&y(j),x&&y(U),x&&y(O),Oe&&Oe.d(),he&&he.d(),be&&be.d()}}}function aa(t){let e,l,n,i,o,a,r=ge(t[0].h.c,2)+"",c,f,m,_,h,b,d,g=ge(t[0].d.c,1)+"",w,k,T,P,E,S,N,D=ge(t[0].m.c)+"",R,W,q;return{c(){e=p("strong"),e.textContent="Cost",l=v(),n=p("div"),i=p("div"),i.textContent="Hour",o=v(),a=p("div"),c=C(r),f=v(),m=C(t[1]),_=v(),h=p("div"),h.textContent="Day",b=v(),d=p("div"),w=C(g),k=v(),T=C(t[1]),P=v(),E=p("div"),E.textContent="Month",S=v(),N=p("div"),R=C(D),W=v(),q=C(t[1]),u(a,"class","text-right"),u(d,"class","text-right"),u(N,"class","text-right"),u(n,"class","grid grid-cols-2")},m(F,L){$(F,e,L),$(F,l,L),$(F,n,L),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(a,m),s(n,_),s(n,h),s(n,b),s(n,d),s(d,w),s(d,k),s(d,T),s(n,P),s(n,E),s(n,S),s(n,N),s(N,R),s(N,W),s(N,q)},p(F,L){L&1&&r!==(r=ge(F[0].h.c,2)+"")&&B(c,r),L&2&&B(m,F[1]),L&1&&g!==(g=ge(F[0].d.c,1)+"")&&B(w,g),L&2&&B(T,F[1]),L&1&&D!==(D=ge(F[0].m.c)+"")&&B(R,D),L&2&&B(q,F[1])},d(F){F&&y(e),F&&y(l),F&&y(n)}}}function fa(t){let e,l=ge(t[0].h.c,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){$(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=ge(a[0].h.c,2)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&y(e)}}}function ca(t){let e,l=ge(t[0].d.c,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){$(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=ge(a[0].d.c,1)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&y(e)}}}function pa(t){let e,l=ge(t[0].m.c)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){$(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=ge(a[0].m.c)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&y(e)}}}function ma(t){let e,l=ge(t[0].h.i,2)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){$(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=ge(a[0].h.i,2)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&y(e)}}}function _a(t){let e,l=ge(t[0].d.i,1)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){$(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=ge(a[0].d.i,1)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&y(e)}}}function da(t){let e,l=ge(t[0].m.i)+"",n,i,o;return{c(){e=p("div"),n=C(l),i=v(),o=C(t[1]),u(e,"class","text-right")},m(a,r){$(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&1&&l!==(l=ge(a[0].m.i)+"")&&B(n,l),r&2&&B(o,a[1])},d(a){a&&y(e)}}}function Up(t){let e,l,n,i,o,a,r=t[0]&&ra(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Real time calculation",n=v(),i=p("br"),o=p("br"),a=v(),r&&r.c(),u(e,"class","mx-2 text-sm")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),r&&r.m(e,null)},p(c,[f]){c[0]?r?r.p(c,f):(r=ra(c),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},i:ie,o:ie,d(c){c&&y(e),r&&r.d()}}}function Hp(t,e,l){let{data:n}=e,{currency:i}=e,{hasExport:o}=e,a=!1,r=3;return t.$$set=c=>{"data"in c&&l(0,n=c.data),"currency"in c&&l(1,i=c.currency),"hasExport"in c&&l(2,o=c.hasExport)},t.$$.update=()=>{t.$$.dirty&9&&(l(3,a=n&&n.h&&(n.h.c||n.d.c||n.m.c||n.h.i||n.d.i||n.m.i)),l(4,r=a?3:2))},[n,i,o,a,r]}class jp extends $e{constructor(e){super(),ye(this,e,Hp,Up,ke,{data:0,currency:1,hasExport:2})}}function Wp(t){let e,l,n,i;return n=new Vl({props:{config:t[0]}}),{c(){e=p("a"),e.textContent="Provided by ENTSO-E",l=v(),Z(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,a){$(o,e,a),$(o,l,a),Q(n,o,a),i=!0},p(o,[a]){const r={};a&1&&(r.config=o[0]),n.$set(r)},i(o){i||(M(n.$$.fragment,o),i=!0)},o(o){I(n.$$.fragment,o),i=!1},d(o){o&&y(e),o&&y(l),X(n,o)}}}function Gp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=new Date().getUTCHours(),c=0,f=0,m=0,_=n[20]==null?2:1,h=[],b=[],d=[],g=new Date;for(c=r;c<24&&(f=n[Ee(m++)],f!=null);c++)b.push({label:Ee(g.getHours())}),d.push({label:f>0?f.toFixed(_):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(_):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,a=Math.min(a,f*100)),l(2,o=Math.max(o,f*100)),ri(g,1);for(c=0;c<24&&(f=n[Ee(m++)],f!=null);c++)b.push({label:Ee(g.getHours())}),d.push({label:f>0?f.toFixed(_):"",value:f>0?Math.abs(f*100):0,label2:f<0?f.toFixed(_):"",value2:f<0?Math.abs(f*100):0,color:"#7c3aed"}),l(3,a=Math.min(a,f*100)),l(2,o=Math.max(o,f*100)),ri(g,1);if(l(2,o=Math.ceil(o)),l(3,a=Math.floor(a)),a<0){let k=a/4;for(c=1;c<5;c++){let T=k*c;h.push({value:T,label:(T/100).toFixed(2)})}}let w=o/4;for(c=0;c<5;c++){let k=w*c;h.push({value:k,label:(k/100).toFixed(2)})}l(0,i={title:"Future energy price ("+n.currency+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:h},x:{ticks:b},points:d})}},[i,n,o,a]}class Bp extends $e{constructor(e){super(),ye(this,e,Gp,Wp,ke,{json:1})}}function Yp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function zp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=[],f=[],m=[],_=ri(new Date,-24),h=new Date().getUTCHours();for(r=h;r<24;r++){let g=n["i"+Ee(r)],w=n["e"+Ee(r)];g===void 0&&(g=0),w===void 0&&(w=0),f.push({label:Ee(_.getHours())}),m.push({label:g.toFixed(1),value:g*10,label2:w.toFixed(1),value2:w*10,color:"#7c3aed"}),l(3,a=Math.max(a,w*10)),l(2,o=Math.max(o,g*10)),ri(_,1)}for(r=0;r<h;r++){let g=n["i"+Ee(r)],w=n["e"+Ee(r)];g===void 0&&(g=0),w===void 0&&(w=0),f.push({label:Ee(_.getHours())}),m.push({label:g.toFixed(1),value:g*10,label2:w.toFixed(1),value2:w*10,color:"#7c3aed"}),l(3,a=Math.max(a,w*10)),l(2,o=Math.max(o,g*10)),ri(_,1)}let b=Math.ceil(Math.max(a,o));if(l(2,o=b),l(3,a=a==0?0:b*-1),a<0){let g=a/4;for(r=1;r<5;r++){let w=g*r;c.push({value:w,label:(w/10).toFixed(1)})}}let d=o/4;for(r=0;r<5;r++){let g=d*r;c.push({value:g,label:(g/10).toFixed(1)})}l(0,i={title:"Energy use last 24 hours (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:c},x:{ticks:f},points:m})}},[i,n,o,a]}class Vp extends $e{constructor(e){super(),ye(this,e,zp,Yp,ke,{json:1})}}function Kp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Qp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=[],f=[],m=[],_=new Date,h=new Date;for(h.setDate(0),r=_.getDate();r<=h.getDate();r++){let g=n["i"+Ee(r)],w=n["e"+Ee(r)];g===void 0&&(g=0),w===void 0&&(w=0),f.push({label:Ee(r)}),m.push({label:g.toFixed(0),value:g,label2:w.toFixed(0),value2:w,color:"#7c3aed"}),l(3,a=Math.max(a,w)),l(2,o=Math.max(o,g))}for(r=1;r<_.getDate();r++){let g=n["i"+Ee(r)],w=n["e"+Ee(r)];g===void 0&&(g=0),w===void 0&&(w=0),f.push({label:Ee(r)}),m.push({label:g.toFixed(0),value:g,label2:w.toFixed(0),value2:w,color:"#7c3aed"}),l(3,a=Math.max(a,w)),l(2,o=Math.max(o,g))}let b=Math.ceil(Math.max(a,o)/10)*10;if(l(2,o=b),l(3,a=a==0?0:b*-1),a<0){let g=a/4;for(r=0;r<5;r++){let w=g*r;c.push({value:w,label:w.toFixed(0)})}}let d=o/4;for(r=0;r<5;r++){let g=d*r;c.push({value:g,label:g.toFixed(0)})}l(0,i={title:"Energy use last month (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:c},x:{ticks:f},points:m})}},[i,n,o,a]}class Xp extends $e{constructor(e){super(),ye(this,e,Qp,Kp,ke,{json:1})}}function Zp(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Jp(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=r=>{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,c=0,f=[],m=[],_=[];n.s&&n.s.forEach((d,g)=>{var w=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),m.push({label:w.slice(-4)}),_.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,a=Math.min(a,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,a=Math.floor(a));let h=o;a<0&&(h+=Math.abs(a));let b=h/4;for(r=0;r<5;r++)c=a+b*r,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:f},x:{ticks:m},points:_})}},[i,n,o,a]}class xp extends $e{constructor(e){super(),ye(this,e,Jp,Zp,ke,{json:1})}}function em(t){let e,l;return e=new Vl({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}let tm=0;function lm(t,e,l){let n={},i=0,o;return _c.subscribe(a=>{l(2,o=a)}),mc(),t.$$.update=()=>{if(t.$$.dirty&6){let a=0,r=[],c=[],f=[];if(r.push({value:0,label:0}),o&&o.p)for(a=0;a<o.p.length;a++){let m=o.p[a];f.push({label:m.v.toFixed(2),value:m.v,color:"#7c3aed"}),c.push({label:m.d>0?Ee(m.d)+"."+Ks[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,m.v))}if(o&&o.t){for(a=0;a<o.t.length;a++){let m=o.t[a];if(m>=i)break;r.push({value:m,label:m})}r.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(r.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:tm,max:i,ticks:r},x:{ticks:c},points:f})}},[n,i,o]}class nm extends $e{constructor(e){super(),ye(this,e,lm,em,ke,{})}}function va(t){let e,l,n,i,o,a,r=(t[0].mt?hs(t[0].mt):"-")+"",c,f,m,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",h,b,d;return i=new gc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:uc}}),{c(){e=p("div"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=v(),a=p("div"),c=C(r),f=v(),m=p("div"),h=C(_),b=C(" kWh"),u(n,"class","col-span-2"),u(m,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,w){$(g,e,w),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,a),s(a,c),s(l,f),s(l,m),s(m,h),s(m,b),d=!0},p(g,w){const k={};w&1&&(k.val=g[0].i?g[0].i:0),w&1&&(k.max=g[0].im?g[0].im:15e3),w&1&&(k.sub=g[0].p),w&1&&(k.subunit=g[0].pc),i.$set(k),(!d||w&1)&&r!==(r=(g[0].mt?hs(g[0].mt):"-")+"")&&B(c,r),(!d||w&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&B(h,_)},i(g){d||(M(i.$$.fragment,g),d=!0)},o(g){I(i.$$.fragment,g),d=!1},d(g){g&&y(e),X(i)}}}function ha(t){let e,l,n,i,o,a,r,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",m,_,h;return i=new gc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:U1}}),{c(){e=p("div"),l=p("div"),n=p("div"),Z(i.$$.fragment),o=v(),a=p("div"),r=v(),c=p("div"),m=C(f),_=C(" kWh"),u(n,"class","col-span-2"),u(c,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(b,d){$(b,e,d),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,a),s(l,r),s(l,c),s(c,m),s(c,_),h=!0},p(b,d){const g={};d&1&&(g.val=b[0].e?b[0].e:0),d&1&&(g.max=b[0].om?b[0].om*1e3:1e4),i.$set(g),(!h||d&1)&&f!==(f=(b[0].ec?b[0].ec.toFixed(1):"-")+"")&&B(m,f)},i(b){h||(M(i.$$.fragment,b),h=!0)},o(b){I(i.$$.fragment,b),h=!1},d(b){b&&y(e),X(i)}}}function ba(t){let e,l,n;return l=new Dp({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.ds=i[0].ds),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function ga(t){let e,l,n;return l=new Ep({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.i1=i[0].i1),o&1&&(a.i2=i[0].i2),o&1&&(a.i3=i[0].i3),o&1&&(a.max=i[0].mf?i[0].mf:32),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function ka(t){let e,l,n;return l=new Lp({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function wa(t){let e,l,n;return l=new jp({props:{data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.data=i[0].ea),o&1&&(a.currency=i[0].pc),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function ya(t){let e,l,n;return l=new nm({}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function $a(t){let e,l,n;return l=new Bp({props:{json:t[2]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&4&&(a.json=i[2]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function Ca(t){let e,l,n;return l=new Vp({props:{json:t[3]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&8&&(a.json=i[3]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function Ta(t){let e,l,n;return l=new Xp({props:{json:t[4]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&16&&(a.json=i[4]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function Sa(t){let e,l,n;return l=new xp({props:{json:t[5]}}),{c(){e=p("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){$(i,e,o),Q(l,e,null),n=!0},p(i,o){const a={};o&32&&(a.json=i[5]),l.$set(a)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){I(l.$$.fragment,i),n=!1},d(i){i&&y(e),X(l)}}}function im(t){let e,l=je(t[1].ui.i,t[0].i),n,i=je(t[1].ui.e,t[0].om||t[0].e>0),o,a=je(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),r,c=je(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,m=je(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,h=je(t[1].ui.c,t[0].ea),b,d=je(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,w=je(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),k,T=je(t[1].ui.d,t[3]),P,E=je(t[1].ui.m,t[4]),S,N=je(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),D,R=l&&va(t),W=i&&ha(t),q=a&&ba(t),F=c&&ga(t),L=m&&ka(t),j=h&&wa(t),U=d&&ya(),O=w&&$a(t),G=T&&Ca(t),H=E&&Ta(t),V=N&&Sa(t);return{c(){e=p("div"),R&&R.c(),n=v(),W&&W.c(),o=v(),q&&q.c(),r=v(),F&&F.c(),f=v(),L&&L.c(),_=v(),j&&j.c(),b=v(),U&&U.c(),g=v(),O&&O.c(),k=v(),G&&G.c(),P=v(),H&&H.c(),S=v(),V&&V.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(J,ne){$(J,e,ne),R&&R.m(e,null),s(e,n),W&&W.m(e,null),s(e,o),q&&q.m(e,null),s(e,r),F&&F.m(e,null),s(e,f),L&&L.m(e,null),s(e,_),j&&j.m(e,null),s(e,b),U&&U.m(e,null),s(e,g),O&&O.m(e,null),s(e,k),G&&G.m(e,null),s(e,P),H&&H.m(e,null),s(e,S),V&&V.m(e,null),D=!0},p(J,[ne]){ne&3&&(l=je(J[1].ui.i,J[0].i)),l?R?(R.p(J,ne),ne&3&&M(R,1)):(R=va(J),R.c(),M(R,1),R.m(e,n)):R&&(Te(),I(R,1,1,()=>{R=null}),Se()),ne&3&&(i=je(J[1].ui.e,J[0].om||J[0].e>0)),i?W?(W.p(J,ne),ne&3&&M(W,1)):(W=ha(J),W.c(),M(W,1),W.m(e,o)):W&&(Te(),I(W,1,1,()=>{W=null}),Se()),ne&3&&(a=je(J[1].ui.v,J[0].u1>100||J[0].u2>100||J[0].u3>100)),a?q?(q.p(J,ne),ne&3&&M(q,1)):(q=ba(J),q.c(),M(q,1),q.m(e,r)):q&&(Te(),I(q,1,1,()=>{q=null}),Se()),ne&3&&(c=je(J[1].ui.a,J[0].i1>.01||J[0].i2>.01||J[0].i3>.01)),c?F?(F.p(J,ne),ne&3&&M(F,1)):(F=ga(J),F.c(),M(F,1),F.m(e,f)):F&&(Te(),I(F,1,1,()=>{F=null}),Se()),ne&3&&(m=je(J[1].ui.r,J[0].ri>0||J[0].re>0||J[0].ric>0||J[0].rec>0)),m?L?(L.p(J,ne),ne&3&&M(L,1)):(L=ka(J),L.c(),M(L,1),L.m(e,_)):L&&(Te(),I(L,1,1,()=>{L=null}),Se()),ne&3&&(h=je(J[1].ui.c,J[0].ea)),h?j?(j.p(J,ne),ne&3&&M(j,1)):(j=wa(J),j.c(),M(j,1),j.m(e,b)):j&&(Te(),I(j,1,1,()=>{j=null}),Se()),ne&3&&(d=je(J[1].ui.t,J[0].pr&&(J[0].pr.startsWith("10YNO")||J[0].pr=="10Y1001A1001A48H"))),d?U?ne&3&&M(U,1):(U=ya(),U.c(),M(U,1),U.m(e,g)):U&&(Te(),I(U,1,1,()=>{U=null}),Se()),ne&3&&(w=je(J[1].ui.p,J[0].pe&&!Number.isNaN(J[0].p))),w?O?(O.p(J,ne),ne&3&&M(O,1)):(O=$a(J),O.c(),M(O,1),O.m(e,k)):O&&(Te(),I(O,1,1,()=>{O=null}),Se()),ne&10&&(T=je(J[1].ui.d,J[3])),T?G?(G.p(J,ne),ne&10&&M(G,1)):(G=Ca(J),G.c(),M(G,1),G.m(e,P)):G&&(Te(),I(G,1,1,()=>{G=null}),Se()),ne&18&&(E=je(J[1].ui.m,J[4])),E?H?(H.p(J,ne),ne&18&&M(H,1)):(H=Ta(J),H.c(),M(H,1),H.m(e,S)):H&&(Te(),I(H,1,1,()=>{H=null}),Se()),ne&35&&(N=je(J[1].ui.s,J[0].t&&J[0].t!=-127&&J[5].c>1)),N?V?(V.p(J,ne),ne&35&&M(V,1)):(V=Sa(J),V.c(),M(V,1),V.m(e,null)):V&&(Te(),I(V,1,1,()=>{V=null}),Se())},i(J){D||(M(R),M(W),M(q),M(F),M(L),M(j),M(U),M(O),M(G),M(H),M(V),D=!0)},o(J){I(R),I(W),I(q),I(F),I(L),I(j),I(U),I(O),I(G),I(H),I(V),D=!1},d(J){J&&y(e),R&&R.d(),W&&W.d(),q&&q.d(),F&&F.d(),L&&L.d(),j&&j.d(),U&&U.d(),O&&O.d(),G&&G.d(),H&&H.d(),V&&V.d()}}}function sm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},a={},r={},c={};return rc.subscribe(f=>{l(2,o=f)}),ac.subscribe(f=>{l(3,a=f)}),fc.subscribe(f=>{l(4,r=f)}),pc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,a,r,c]}class om extends $e{constructor(e){super(),ye(this,e,sm,im,ke,{data:0,sysinfo:1})}}let to={};const kc=Ze(to);async function um(){to=await(await fetch("/configuration.json")).json(),kc.set(to)}function Pa(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function rm(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function am(t){let e;return{c(){e=p("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function Ma(t){let e;return{c(){e=p("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function Aa(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART1",l=v(),n=p("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){$(i,e,o),$(i,l,o),$(i,n,o)},d(i){i&&y(e),i&&y(l),i&&y(n)}}}function Da(t){let e;return{c(){e=p("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function Na(t){let e,l,n;return{c(){e=p("option"),l=C("GPIO"),n=C(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){$(i,e,o),s(e,l),s(e,n)},d(i){i&&y(e)}}}function Ia(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Na(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Na(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&y(e)}}}function fm(t){let e,l,n,i,o;function a(d,g){return d[0]=="esp32c3"?am:rm}let r=a(t),c=r(t),f=t[0]=="esp8266"&&Ma(),m=(t[0]=="esp32"||t[0]=="esp32solo")&&Aa(),_=t[0]=="esp32s2"&&Da(),h={length:t[1]+1},b=[];for(let d=0;d<h.length;d+=1)b[d]=Ia(Pa(t,h,d));return{c(){c.c(),e=v(),f&&f.c(),l=v(),m&&m.c(),n=v(),_&&_.c(),i=v();for(let d=0;d<b.length;d+=1)b[d].c();o=We()},m(d,g){c.m(d,g),$(d,e,g),f&&f.m(d,g),$(d,l,g),m&&m.m(d,g),$(d,n,g),_&&_.m(d,g),$(d,i,g);for(let w=0;w<b.length;w+=1)b[w].m(d,g);$(d,o,g)},p(d,[g]){if(r!==(r=a(d))&&(c.d(1),c=r(d),c&&(c.c(),c.m(e.parentNode,e))),d[0]=="esp8266"?f||(f=Ma(),f.c(),f.m(l.parentNode,l)):f&&(f.d(1),f=null),d[0]=="esp32"||d[0]=="esp32solo"?m||(m=Aa(),m.c(),m.m(n.parentNode,n)):m&&(m.d(1),m=null),d[0]=="esp32s2"?_||(_=Da(),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null),g&3){h={length:d[1]+1};let w;for(w=0;w<h.length;w+=1){const k=Pa(d,h,w);b[w]?b[w].p(k,g):(b[w]=Ia(k),b[w].c(),b[w].m(o.parentNode,o))}for(;w<b.length;w+=1)b[w].d(1);b.length=h.length}},i:ie,o:ie,d(d){c.d(d),d&&y(e),f&&f.d(d),d&&y(l),m&&m.d(d),d&&y(n),_&&_.d(d),d&&y(i),Qt(b,d),d&&y(o)}}}function cm(t,e,l){let{chip:n}=e,i=39;return t.$$set=o=>{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class wc extends $e{constructor(e){super(),ye(this,e,cm,fm,ke,{chip:0})}}function Ea(t){let e,l,n=t[1]&&Ra(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){$(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Ra(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&y(e),n&&n.d()}}}function Ra(t){let e,l;return{c(){e=p("div"),l=C(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){$(n,e,i),s(e,l)},p(n,i){i&2&&B(l,n[1])},d(n){n&&y(e)}}}function pm(t){let e,l=t[0]&&Ea(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ea(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ie,o:ie,d(n){l&&l.d(n),n&&y(e)}}}function mm(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 $e{constructor(e){super(),ye(this,e,mm,pm,ke,{active:0,message:1})}}function Fa(t,e,l){const n=t.slice();return n[1]=e[l],n}function La(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,a){$(o,e,a),s(e,l),s(e,i)},p:ie,d(o){o&&y(e)}}}function _m(t){let e,l,n,i=t[0],o=[];for(let a=0;a<i.length;a+=1)o[a]=La(Fa(t,i,a));return{c(){e=p("option"),e.textContent="GMT",l=v();for(let a=0;a<o.length;a+=1)o[a].c();n=We(),e.__value="GMT",e.value=e.__value},m(a,r){$(a,e,r),$(a,l,r);for(let c=0;c<o.length;c+=1)o[c].m(a,r);$(a,n,r)},p(a,[r]){if(r&1){i=a[0];let c;for(c=0;c<i.length;c+=1){const f=Fa(a,i,c);o[c]?o[c].p(f,r):(o[c]=La(f),o[c].c(),o[c].m(n.parentNode,n))}for(;c<o.length;c+=1)o[c].d(1);o.length=i.length}},i:ie,o:ie,d(a){a&&y(e),a&&y(l),Qt(o,a),a&&y(n)}}}function dm(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 vm extends $e{constructor(e){super(),ye(this,e,dm,_m,ke,{})}}function hm(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d;return{c(){e=p("optgroup"),l=p("option"),l.textContent="/24",n=v(),i=p("optgroup"),o=p("option"),o.textContent="/25",a=p("option"),a.textContent="/26",r=p("option"),r.textContent="/27",c=p("option"),c.textContent="/28",f=p("option"),f.textContent="/29",m=v(),_=p("optgroup"),h=p("option"),h.textContent="/23",b=p("option"),b.textContent="/22",d=p("option"),d.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,a.__value="255.255.255.192",a.value=a.__value,r.__value="255.255.255.224",r.value=r.__value,c.__value="255.255.255.240",c.value=c.__value,f.__value="255.255.255.248",f.value=f.__value,u(i,"label","Smaller subnets"),h.__value="255.255.254.0",h.value=h.__value,b.__value="255.255.252.0",b.value=b.__value,d.__value="255.255.0.0",d.value=d.__value,u(_,"label","Larger subnets")},m(g,w){$(g,e,w),s(e,l),$(g,n,w),$(g,i,w),s(i,o),s(i,a),s(i,r),s(i,c),s(i,f),$(g,m,w),$(g,_,w),s(_,h),s(_,b),s(_,d)},p:ie,i:ie,o:ie,d(g){g&&y(e),g&&y(n),g&&y(i),g&&y(m),g&&y(_)}}}class yc extends $e{constructor(e){super(),ye(this,e,null,hm,ke,{})}}function Oa(t,e,l){const n=t.slice();return n[90]=e[l],n[91]=e,n[92]=l,n}function qa(t,e,l){const n=t.slice();return n[93]=e[l],n[94]=e,n[95]=l,n}function bm(t,e,l){const n=t.slice();return n[96]=e[l],n}function gm(t,e,l){const n=t.slice();return n[99]=e[l],n}function km(t){let e,l;return{c(){e=p("option"),l=C(t[99]),e.__value=t[99],e.value=e.__value},m(n,i){$(n,e,i),s(e,l)},p:ie,d(n){n&&y(e)}}}function Ua(t){let e,l,n,i;return{c(){e=p("br"),l=p("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,a){$(o,e,a),$(o,l,a),Y(l,t[3].p.t),n||(i=z(l,"input",t[19]),n=!0)},p(o,a){a[0]&8&&l.value!==o[3].p.t&&Y(l,o[3].p.t)},d(o){o&&y(e),o&&y(l),n=!1,i()}}}function Ha(t){let e,l,n,i,o,a,r,c,f,m,_,h,b;return{c(){e=p("div"),l=C("Username"),n=p("br"),i=v(),o=p("input"),a=v(),r=p("div"),c=C("Password"),f=p("br"),m=v(),_=p("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(r,"class","my-1")},m(d,g){$(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),Y(o,t[3].g.u),$(d,a,g),$(d,r,g),s(r,c),s(r,f),s(r,m),s(r,_),Y(_,t[3].g.p),h||(b=[z(o,"input",t[21]),z(_,"input",t[22])],h=!0)},p(d,g){g[0]&8&&o.value!==d[3].g.u&&Y(o,d[3].g.u),g[0]&8&&_.value!==d[3].g.p&&Y(_,d[3].g.p)},d(d){d&&y(e),d&&y(a),d&&y(r),h=!1,Be(b)}}}function wm(t){let e,l=t[96]*100+"",n;return{c(){e=p("option"),n=C(l),e.__value=t[96]*100,e.value=e.__value},m(i,o){$(i,e,o),s(e,n)},p:ie,d(i){i&&y(e)}}}function ja(t){let e,l,n,i;return{c(){e=p("br"),l=p("input"),u(l,"name","mek"),u(l,"type","text"),u(l,"class","in-s")},m(o,a){$(o,e,a),$(o,l,a),Y(l,t[3].m.e.k),n||(i=z(l,"input",t[30]),n=!0)},p(o,a){a[0]&8&&l.value!==o[3].m.e.k&&Y(l,o[3].m.e.k)},d(o){o&&y(e),o&&y(l),n=!1,i()}}}function Wa(t){let e,l,n,i,o,a,r;return{c(){e=p("div"),l=C("Authentication key"),n=p("br"),i=v(),o=p("input"),u(o,"name","mea"),u(o,"type","text"),u(o,"class","in-s"),u(e,"class","my-1")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Y(o,t[3].m.e.a),a||(r=z(o,"input",t[31]),a=!0)},p(c,f){f[0]&8&&o.value!==c[3].m.e.a&&Y(o,c[3].m.e.a)},d(c){c&&y(e),a=!1,r()}}}function Ga(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w,k,T,P,E,S,N,D,R,W,q;return{c(){e=p("div"),l=p("div"),n=C("Watt"),i=p("br"),o=v(),a=p("input"),r=v(),c=p("div"),f=C("Volt"),m=p("br"),_=v(),h=p("input"),b=v(),d=p("div"),g=C("Amp"),w=p("br"),k=v(),T=p("input"),P=v(),E=p("div"),S=C("kWh"),N=p("br"),D=v(),R=p("input"),u(a,"name","mmw"),u(a,"type","number"),u(a,"min","0.00"),u(a,"max","655.35"),u(a,"step","0.01"),u(a,"class","in-f tr w-full"),u(l,"class","w-1/4"),u(h,"name","mmv"),u(h,"type","number"),u(h,"min","0.00"),u(h,"max","655.35"),u(h,"step","0.01"),u(h,"class","in-m tr w-full"),u(c,"class","w-1/4"),u(T,"name","mma"),u(T,"type","number"),u(T,"min","0.00"),u(T,"max","655.35"),u(T,"step","0.01"),u(T,"class","in-m tr w-full"),u(d,"class","w-1/4"),u(R,"name","mmc"),u(R,"type","number"),u(R,"min","0.00"),u(R,"max","655.35"),u(R,"step","0.01"),u(R,"class","in-l tr w-full"),u(E,"class","w-1/4"),u(e,"class","flex my-1")},m(F,L){$(F,e,L),s(e,l),s(l,n),s(l,i),s(l,o),s(l,a),Y(a,t[3].m.m.w),s(e,r),s(e,c),s(c,f),s(c,m),s(c,_),s(c,h),Y(h,t[3].m.m.v),s(e,b),s(e,d),s(d,g),s(d,w),s(d,k),s(d,T),Y(T,t[3].m.m.a),s(e,P),s(e,E),s(E,S),s(E,N),s(E,D),s(E,R),Y(R,t[3].m.m.c),W||(q=[z(a,"input",t[33]),z(h,"input",t[34]),z(T,"input",t[35]),z(R,"input",t[36])],W=!0)},p(F,L){L[0]&8&&ae(a.value)!==F[3].m.m.w&&Y(a,F[3].m.m.w),L[0]&8&&ae(h.value)!==F[3].m.m.v&&Y(h,F[3].m.m.v),L[0]&8&&ae(T.value)!==F[3].m.m.a&&Y(T,F[3].m.m.a),L[0]&8&&ae(R.value)!==F[3].m.m.c&&Y(R,F[3].m.m.c)},d(F){F&&y(e),W=!1,Be(q)}}}function Ba(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w;return{c(){e=p("div"),l=C("Gateway"),n=p("br"),i=v(),o=p("input"),a=v(),r=p("div"),c=C("DNS"),f=p("br"),m=v(),_=p("div"),h=p("input"),b=v(),d=p("input"),u(o,"name","ng"),u(o,"type","text"),u(o,"class","in-s"),u(e,"class","my-1"),u(h,"name","nd1"),u(h,"type","text"),u(h,"class","in-f w-full"),u(d,"name","nd2"),u(d,"type","text"),u(d,"class","in-l w-full"),u(_,"class","flex"),u(r,"class","my-1")},m(k,T){$(k,e,T),s(e,l),s(e,n),s(e,i),s(e,o),Y(o,t[3].n.g),$(k,a,T),$(k,r,T),s(r,c),s(r,f),s(r,m),s(r,_),s(_,h),Y(h,t[3].n.d1),s(_,b),s(_,d),Y(d,t[3].n.d2),g||(w=[z(o,"input",t[45]),z(h,"input",t[46]),z(d,"input",t[47])],g=!0)},p(k,T){T[0]&8&&o.value!==k[3].n.g&&Y(o,k[3].n.g),T[0]&8&&h.value!==k[3].n.d1&&Y(h,k[3].n.d1),T[0]&8&&d.value!==k[3].n.d2&&Y(d,k[3].n.d2)},d(k){k&&y(e),k&&y(a),k&&y(r),g=!1,Be(w)}}}function Ya(t){let e,l,n,i,o;return{c(){e=p("label"),l=p("input"),n=C(" 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(a,r){$(a,e,r),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[z(l,"change",t[51]),z(l,"change",t[11])],i=!0)},p(a,r){r[0]&8&&(l.checked=a[3].q.s.e)},d(a){a&&y(e),i=!1,Be(o)}}}function za(t){let e,l,n,i,o,a,r,c;return n=new wl({props:{to:"/mqtt-ca",$$slots:{default:[Cm]},$$scope:{ctx:t}}}),o=new wl({props:{to:"/mqtt-cert",$$slots:{default:[Pm]},$$scope:{ctx:t}}}),r=new wl({props:{to:"/mqtt-key",$$slots:{default:[Dm]},$$scope:{ctx:t}}}),{c(){e=p("div"),l=p("div"),Z(n.$$.fragment),i=v(),Z(o.$$.fragment),a=v(),Z(r.$$.fragment),u(e,"class","my-1")},m(f,m){$(f,e,m),s(e,l),Q(n,l,null),s(l,i),Q(o,l,null),s(l,a),Q(r,l,null),c=!0},p(f,m){const _={};m[0]&8|m[3]&512&&(_.$$scope={dirty:m,ctx:f}),n.$set(_);const h={};m[0]&8|m[3]&512&&(h.$$scope={dirty:m,ctx:f}),o.$set(h);const b={};m[0]&8|m[3]&512&&(b.$$scope={dirty:m,ctx:f}),r.$set(b)},i(f){c||(M(n.$$.fragment,f),M(o.$$.fragment,f),M(r.$$.fragment,f),c=!0)},o(f){I(n.$$.fragment,f),I(o.$$.fragment,f),I(r.$$.fragment,f),c=!1},d(f){f&&y(e),X(n),X(o),X(r)}}}function ym(t){let e,l;return e=new Kt({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function $m(t){let e,l;return e=new Kt({props:{color:"green",text:"CA OK",title:"Click here to replace CA"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Cm(t){let e,l,n,i;const o=[$m,ym],a=[];function r(c,f){return c[3].q.s.c?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),$(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e!==m&&(Te(),I(a[m],1,1,()=>{a[m]=null}),Se(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&y(n)}}}function Tm(t){let e,l;return e=new Kt({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Sm(t){let e,l;return e=new Kt({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Pm(t){let e,l,n,i;const o=[Sm,Tm],a=[];function r(c,f){return c[3].q.s.r?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),$(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e!==m&&(Te(),I(a[m],1,1,()=>{a[m]=null}),Se(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&y(n)}}}function Mm(t){let e,l;return e=new Kt({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Am(t){let e,l;return e=new Kt({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Dm(t){let e,l,n,i;const o=[Am,Mm],a=[];function r(c,f){return c[3].q.s.k?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),$(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e!==m&&(Te(),I(a[m],1,1,()=>{a[m]=null}),Se(),l=a[e],l||(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&y(n)}}}function Va(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w,k,T,P,E,S,N,D,R,W,q,F,L,j,U,O,G;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Domoticz",n=v(),i=p("a"),Z(o.$$.fragment),a=v(),r=p("input"),c=v(),f=p("div"),m=p("div"),_=C("Electricity IDX"),h=p("br"),b=v(),d=p("input"),g=v(),w=p("div"),k=C("Current IDX"),T=p("br"),P=v(),E=p("input"),S=v(),N=p("div"),D=C(`Voltage IDX: L1, L2 & L3
`),R=p("div"),W=p("input"),q=v(),F=p("input"),L=v(),j=p("input"),u(l,"class","text-sm"),u(i,"href",Ct("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(r,"type","hidden"),u(r,"name","o"),r.value="true",u(d,"name","oe"),u(d,"type","text"),u(d,"class","in-f tr w-full"),u(m,"class","w-1/2"),u(E,"name","oc"),u(E,"type","text"),u(E,"class","in-l tr w-full"),u(w,"class","w-1/2"),u(f,"class","my-1 flex"),u(W,"name","ou1"),u(W,"type","text"),u(W,"class","in-f tr w-1/3"),u(F,"name","ou2"),u(F,"type","text"),u(F,"class","in-m tr w-1/3"),u(j,"name","ou3"),u(j,"type","text"),u(j,"class","in-l tr w-1/3"),u(R,"class","flex"),u(N,"class","my-1"),u(e,"class","cnt")},m(H,V){$(H,e,V),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,a),s(e,r),s(e,c),s(e,f),s(f,m),s(m,_),s(m,h),s(m,b),s(m,d),Y(d,t[3].o.e),s(f,g),s(f,w),s(w,k),s(w,T),s(w,P),s(w,E),Y(E,t[3].o.c),s(e,S),s(e,N),s(N,D),s(N,R),s(R,W),Y(W,t[3].o.u1),s(R,q),s(R,F),Y(F,t[3].o.u2),s(R,L),s(R,j),Y(j,t[3].o.u3),U=!0,O||(G=[z(d,"input",t[59]),z(E,"input",t[60]),z(W,"input",t[61]),z(F,"input",t[62]),z(j,"input",t[63])],O=!0)},p(H,V){V[0]&8&&d.value!==H[3].o.e&&Y(d,H[3].o.e),V[0]&8&&E.value!==H[3].o.c&&Y(E,H[3].o.c),V[0]&8&&W.value!==H[3].o.u1&&Y(W,H[3].o.u1),V[0]&8&&F.value!==H[3].o.u2&&Y(F,H[3].o.u2),V[0]&8&&j.value!==H[3].o.u3&&Y(j,H[3].o.u3)},i(H){U||(M(o.$$.fragment,H),U=!0)},o(H){I(o.$$.fragment,H),U=!1},d(H){H&&y(e),X(o),O=!1,Be(G)}}}function Ka(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w,k,T,P,E,S,N,D,R,W,q,F,L,j;return o=new $t({}),{c(){e=p("div"),l=p("strong"),l.textContent="Home-Assistant",n=v(),i=p("a"),Z(o.$$.fragment),a=v(),r=p("input"),c=v(),f=p("div"),m=C("Discovery topic prefix"),_=p("br"),h=v(),b=p("input"),d=v(),g=p("div"),w=C("Hostname for URL"),k=p("br"),T=v(),P=p("input"),S=v(),N=p("div"),D=C("Name tag"),R=p("br"),W=v(),q=p("input"),u(l,"class","text-sm"),u(i,"href",Ct("MQTT-configuration#home-assistant")),u(i,"target","_blank"),u(i,"class","float-right"),u(r,"type","hidden"),u(r,"name","h"),r.value="true",u(b,"name","ht"),u(b,"type","text"),u(b,"class","in-s"),u(b,"placeholder","homeassistant"),u(f,"class","my-1"),u(P,"name","hh"),u(P,"type","text"),u(P,"class","in-s"),u(P,"placeholder",E=t[3].g.h+".local"),u(g,"class","my-1"),u(q,"name","hn"),u(q,"type","text"),u(q,"class","in-s"),u(N,"class","my-1"),u(e,"class","cnt")},m(U,O){$(U,e,O),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,a),s(e,r),s(e,c),s(e,f),s(f,m),s(f,_),s(f,h),s(f,b),Y(b,t[3].h.t),s(e,d),s(e,g),s(g,w),s(g,k),s(g,T),s(g,P),Y(P,t[3].h.h),s(e,S),s(e,N),s(N,D),s(N,R),s(N,W),s(N,q),Y(q,t[3].h.n),F=!0,L||(j=[z(b,"input",t[64]),z(P,"input",t[65]),z(q,"input",t[66])],L=!0)},p(U,O){O[0]&8&&b.value!==U[3].h.t&&Y(b,U[3].h.t),(!F||O[0]&8&&E!==(E=U[3].g.h+".local"))&&u(P,"placeholder",E),O[0]&8&&P.value!==U[3].h.h&&Y(P,U[3].h.h),O[0]&8&&q.value!==U[3].h.n&&Y(q,U[3].h.n)},i(U){F||(M(o.$$.fragment,U),F=!0)},o(U){I(o.$$.fragment,U),F=!1},d(U){U&&y(e),X(o),L=!1,Be(j)}}}function Qa(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w,k,T,P;o=new $t({});let E={length:9},S=[];for(let N=0;N<E.length;N+=1)S[N]=Xa(qa(t,E,N));return{c(){e=p("div"),l=p("strong"),l.textContent="Tariff thresholds",n=v(),i=p("a"),Z(o.$$.fragment),a=v(),r=p("input"),c=v(),f=p("div");for(let N=0;N<S.length;N+=1)S[N].c();m=v(),_=p("label"),h=p("span"),h.textContent="Average of",b=v(),d=p("input"),g=v(),w=p("span"),w.textContent="hours",u(l,"class","text-sm"),u(i,"href",Ct("Threshold-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(r,"type","hidden"),u(r,"name","t"),r.value="true",u(f,"class","flex flex-wrap my-1"),u(h,"class","in-pre"),u(d,"name","th"),u(d,"type","number"),u(d,"min","0"),u(d,"max","255"),u(d,"class","in-txt tr w-full"),u(w,"class","in-post"),u(_,"class","flex m-1"),u(e,"class","cnt")},m(N,D){$(N,e,D),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,a),s(e,r),s(e,c),s(e,f);for(let R=0;R<S.length;R+=1)S[R].m(f,null);s(e,m),s(e,_),s(_,h),s(_,b),s(_,d),Y(d,t[3].t.h),s(_,g),s(_,w),k=!0,T||(P=z(d,"input",t[68]),T=!0)},p(N,D){if(D[0]&8){E={length:9};let R;for(R=0;R<E.length;R+=1){const W=qa(N,E,R);S[R]?S[R].p(W,D):(S[R]=Xa(W),S[R].c(),S[R].m(f,null))}for(;R<S.length;R+=1)S[R].d(1);S.length=E.length}D[0]&8&&ae(d.value)!==N[3].t.h&&Y(d,N[3].t.h)},i(N){k||(M(o.$$.fragment,N),k=!0)},o(N){I(o.$$.fragment,N),k=!1},d(N){N&&y(e),X(o),Qt(S,N),T=!1,P()}}}function Xa(t){let e,l,n=t[95]+1+"",i,o,a,r,c,f,m,_;function h(){t[67].call(a,t[95])}return{c(){e=p("label"),l=p("span"),i=C(n),o=v(),a=p("input"),r=v(),c=p("span"),c.textContent="kWh",f=v(),u(l,"class","in-pre"),u(a,"name","t"+t[95]),u(a,"type","number"),u(a,"min","0"),u(a,"max","65535"),u(a,"class","in-txt w-full"),u(c,"class","in-post"),u(e,"class","flex w-40 m-1")},m(b,d){$(b,e,d),s(e,l),s(l,i),s(e,o),s(e,a),Y(a,t[3].t.t[t[95]]),s(e,r),s(e,c),s(e,f),m||(_=z(a,"input",h),m=!0)},p(b,d){t=b,d[0]&8&&ae(a.value)!==t[3].t.t[t[95]]&&Y(a,t[3].t.t[t[95]])},d(b){b&&y(e),m=!1,_()}}}function Za(t){let e,l=t[90].name+"",n,i,o,a,r,c,f,m,_,h;function b(){t[69].call(a,t[90])}return{c(){e=p("div"),n=C(l),i=p("br"),o=v(),a=p("select"),r=p("option"),r.textContent="Hide",c=p("option"),c.textContent="Show",f=p("option"),f.textContent="Dynamic",m=v(),r.__value=0,r.value=r.__value,c.__value=1,c.value=c.__value,f.__value=2,f.value=f.__value,u(a,"name","u"+t[90].key),u(a,"class","in-s"),t[3].u[t[90].key]===void 0&&Ye(b),u(e,"class","w-1/2")},m(d,g){$(d,e,g),s(e,n),s(e,i),s(e,o),s(e,a),s(a,r),s(a,c),s(a,f),Le(a,t[3].u[t[90].key]),s(e,m),_||(h=z(a,"change",b),_=!0)},p(d,g){t=d,g[0]&136&&Le(a,t[3].u[t[90].key])},d(d){d&&y(e),_=!1,h()}}}function Ja(t){let e,l,n,i,o,a,r,c;o=new $t({});let f=t[0].board>20&&xa(t),m=t[0].chip=="esp8266"&&lf(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Hardware",n=v(),i=p("a"),Z(o.$$.fragment),a=v(),f&&f.c(),r=v(),m&&m.c(),u(l,"class","text-sm"),u(i,"href",Ct("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(_,h){$(_,e,h),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,a),f&&f.m(e,null),s(e,r),m&&m.m(e,null),c=!0},p(_,h){_[0].board>20?f?(f.p(_,h),h[0]&1&&M(f,1)):(f=xa(_),f.c(),M(f,1),f.m(e,r)):f&&(Te(),I(f,1,1,()=>{f=null}),Se()),_[0].chip=="esp8266"?m?m.p(_,h):(m=lf(_),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},i(_){c||(M(o.$$.fragment,_),M(f),c=!0)},o(_){I(o.$$.fragment,_),I(f),c=!1},d(_){_&&y(e),X(o),f&&f.d(),m&&m.d()}}}function xa(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w,k,T,P,E,S,N,D,R,W,q,F,L,j,U,O,G,H,V,J,ne,le,me,Pe,we,Re,Ce,Fe,_e,Me,Ie,ce,se,pe,K,re,Ae,Ne,de,ee,oe,ve,De,Oe;h=new wc({props:{chip:t[0].chip}});let he=t[0].chip!="esp8266"&&ef(t),be=t[3].i.v.p>0&&tf(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),o=C("HAN"),a=p("label"),r=p("input"),c=C(" pullup"),f=p("br"),m=v(),_=p("select"),Z(h.$$.fragment),b=v(),d=p("div"),g=C("AP button"),w=p("br"),k=v(),T=p("input"),P=v(),E=p("div"),S=C("LED"),N=p("label"),D=p("input"),R=C(" inv"),W=p("br"),q=v(),F=p("div"),L=p("input"),j=v(),U=p("div"),O=C("RGB"),G=p("label"),H=p("input"),V=C(" inverted"),J=p("br"),ne=v(),le=p("div"),me=p("input"),Pe=v(),we=p("input"),Re=v(),Ce=p("input"),Fe=v(),_e=p("div"),Me=C("Temperature"),Ie=p("br"),ce=v(),se=p("input"),pe=v(),K=p("div"),re=C("Analog temp"),Ae=p("br"),Ne=v(),de=p("input"),ee=v(),he&&he.c(),oe=v(),be&&be.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(r,"name","ihu"),r.__value="true",r.value=r.__value,u(r,"type","checkbox"),u(r,"class","rounded mb-1"),u(a,"class","ml-2"),u(_,"name","ihp"),u(_,"class","in-f w-full"),t[3].i.h.p===void 0&&Ye(()=>t[71].call(_)),u(i,"class","w-1/3"),u(T,"name","ia"),u(T,"type","number"),u(T,"min","0"),u(T,"max",t[6]),u(T,"class","in-m tr w-full"),u(d,"class","w-1/3"),u(D,"name","ili"),D.__value="true",D.value=D.__value,u(D,"type","checkbox"),u(D,"class","rounded mb-1"),u(N,"class","ml-4"),u(L,"name","ilp"),u(L,"type","number"),u(L,"min","0"),u(L,"max",t[6]),u(L,"class","in-l tr w-full"),u(F,"class","flex"),u(E,"class","w-1/3"),u(H,"name","iri"),H.__value="true",H.value=H.__value,u(H,"type","checkbox"),u(H,"class","rounded mb-1"),u(G,"class","ml-4"),u(me,"name","irr"),u(me,"type","number"),u(me,"min","0"),u(me,"max",t[6]),u(me,"class","in-f tr w-1/3"),u(we,"name","irg"),u(we,"type","number"),u(we,"min","0"),u(we,"max",t[6]),u(we,"class","in-m tr w-1/3"),u(Ce,"name","irb"),u(Ce,"type","number"),u(Ce,"min","0"),u(Ce,"max",t[6]),u(Ce,"class","in-l tr w-1/3"),u(le,"class","flex"),u(U,"class","w-full"),u(se,"name","itd"),u(se,"type","number"),u(se,"min","0"),u(se,"max",t[6]),u(se,"class","in-f tr w-full"),u(_e,"class","my-1 w-1/3"),u(de,"name","ita"),u(de,"type","number"),u(de,"min","0"),u(de,"max",t[6]),u(de,"class","in-l tr w-full"),u(K,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(x,ue){$(x,e,ue),$(x,l,ue),$(x,n,ue),s(n,i),s(i,o),s(i,a),s(a,r),r.checked=t[3].i.h.u,s(a,c),s(i,f),s(i,m),s(i,_),Q(h,_,null),Le(_,t[3].i.h.p),s(n,b),s(n,d),s(d,g),s(d,w),s(d,k),s(d,T),Y(T,t[3].i.a),s(n,P),s(n,E),s(E,S),s(E,N),s(N,D),D.checked=t[3].i.l.i,s(N,R),s(E,W),s(E,q),s(E,F),s(F,L),Y(L,t[3].i.l.p),s(n,j),s(n,U),s(U,O),s(U,G),s(G,H),H.checked=t[3].i.r.i,s(G,V),s(U,J),s(U,ne),s(U,le),s(le,me),Y(me,t[3].i.r.r),s(le,Pe),s(le,we),Y(we,t[3].i.r.g),s(le,Re),s(le,Ce),Y(Ce,t[3].i.r.b),s(n,Fe),s(n,_e),s(_e,Me),s(_e,Ie),s(_e,ce),s(_e,se),Y(se,t[3].i.t.d),s(n,pe),s(n,K),s(K,re),s(K,Ae),s(K,Ne),s(K,de),Y(de,t[3].i.t.a),s(n,ee),he&&he.m(n,null),s(n,oe),be&&be.m(n,null),ve=!0,De||(Oe=[z(r,"change",t[70]),z(_,"change",t[71]),z(T,"input",t[72]),z(D,"change",t[73]),z(L,"input",t[74]),z(H,"change",t[75]),z(me,"input",t[76]),z(we,"input",t[77]),z(Ce,"input",t[78]),z(se,"input",t[79]),z(de,"input",t[80])],De=!0)},p(x,ue){ue[0]&8&&(r.checked=x[3].i.h.u);const Tl={};ue[0]&1&&(Tl.chip=x[0].chip),h.$set(Tl),ue[0]&8&&Le(_,x[3].i.h.p),(!ve||ue[0]&64)&&u(T,"max",x[6]),ue[0]&8&&ae(T.value)!==x[3].i.a&&Y(T,x[3].i.a),ue[0]&8&&(D.checked=x[3].i.l.i),(!ve||ue[0]&64)&&u(L,"max",x[6]),ue[0]&8&&ae(L.value)!==x[3].i.l.p&&Y(L,x[3].i.l.p),ue[0]&8&&(H.checked=x[3].i.r.i),(!ve||ue[0]&64)&&u(me,"max",x[6]),ue[0]&8&&ae(me.value)!==x[3].i.r.r&&Y(me,x[3].i.r.r),(!ve||ue[0]&64)&&u(we,"max",x[6]),ue[0]&8&&ae(we.value)!==x[3].i.r.g&&Y(we,x[3].i.r.g),(!ve||ue[0]&64)&&u(Ce,"max",x[6]),ue[0]&8&&ae(Ce.value)!==x[3].i.r.b&&Y(Ce,x[3].i.r.b),(!ve||ue[0]&64)&&u(se,"max",x[6]),ue[0]&8&&ae(se.value)!==x[3].i.t.d&&Y(se,x[3].i.t.d),(!ve||ue[0]&64)&&u(de,"max",x[6]),ue[0]&8&&ae(de.value)!==x[3].i.t.a&&Y(de,x[3].i.t.a),x[0].chip!="esp8266"?he?he.p(x,ue):(he=ef(x),he.c(),he.m(n,oe)):he&&(he.d(1),he=null),x[3].i.v.p>0?be?be.p(x,ue):(be=tf(x),be.c(),be.m(n,null)):be&&(be.d(1),be=null)},i(x){ve||(M(h.$$.fragment,x),ve=!0)},o(x){I(h.$$.fragment,x),ve=!1},d(x){x&&y(e),x&&y(l),x&&y(n),X(h),he&&he.d(),be&&be.d(),De=!1,Be(Oe)}}}function ef(t){let e,l,n,i,o,a,r;return{c(){e=p("div"),l=C("Vcc"),n=p("br"),i=v(),o=p("input"),u(o,"name","ivp"),u(o,"type","number"),u(o,"min","0"),u(o,"max",t[6]),u(o,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Y(o,t[3].i.v.p),a||(r=z(o,"input",t[81]),a=!0)},p(c,f){f[0]&64&&u(o,"max",c[6]),f[0]&8&&ae(o.value)!==c[3].i.v.p&&Y(o,c[3].i.v.p)},d(c){c&&y(e),a=!1,r()}}}function tf(t){let e,l,n,i,o,a,r,c,f,m;return{c(){e=p("div"),l=C("Voltage divider"),n=p("br"),i=v(),o=p("div"),a=p("input"),r=v(),c=p("input"),u(a,"name","ivdv"),u(a,"type","number"),u(a,"min","0"),u(a,"max","65535"),u(a,"class","in-f tr w-full"),u(a,"placeholder","VCC"),u(c,"name","ivdg"),u(c,"type","number"),u(c,"min","0"),u(c,"max","65535"),u(c,"class","in-l tr w-full"),u(c,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(_,h){$(_,e,h),s(e,l),s(e,n),s(e,i),s(e,o),s(o,a),Y(a,t[3].i.v.d.v),s(o,r),s(o,c),Y(c,t[3].i.v.d.g),f||(m=[z(a,"input",t[82]),z(c,"input",t[83])],f=!0)},p(_,h){h[0]&8&&ae(a.value)!==_[3].i.v.d.v&&Y(a,_[3].i.v.d.v),h[0]&8&&ae(c.value)!==_[3].i.v.d.g&&Y(c,_[3].i.v.d.g)},d(_){_&&y(e),f=!1,Be(m)}}}function lf(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w,k,T=(t[0].board==2||t[0].board==100)&&nf(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),o=C("Vcc offset"),a=p("br"),r=v(),c=p("input"),f=v(),m=p("div"),_=C("Multiplier"),h=p("br"),b=v(),d=p("input"),g=v(),T&&T.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(c,"name","ivo"),u(c,"type","number"),u(c,"min","0.0"),u(c,"max","3.5"),u(c,"step","0.01"),u(c,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(d,"name","ivm"),u(d,"type","number"),u(d,"min","0.1"),u(d,"max","10"),u(d,"step","0.01"),u(d,"class","in-l tr w-full"),u(m,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(P,E){$(P,e,E),$(P,l,E),$(P,n,E),s(n,i),s(i,o),s(i,a),s(i,r),s(i,c),Y(c,t[3].i.v.o),s(n,f),s(n,m),s(m,_),s(m,h),s(m,b),s(m,d),Y(d,t[3].i.v.m),s(n,g),T&&T.m(n,null),w||(k=[z(c,"input",t[84]),z(d,"input",t[85])],w=!0)},p(P,E){E[0]&8&&ae(c.value)!==P[3].i.v.o&&Y(c,P[3].i.v.o),E[0]&8&&ae(d.value)!==P[3].i.v.m&&Y(d,P[3].i.v.m),P[0].board==2||P[0].board==100?T?T.p(P,E):(T=nf(P),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(P){P&&y(e),P&&y(l),P&&y(n),T&&T.d(),w=!1,Be(k)}}}function nf(t){let e,l,n,i,o,a,r;return{c(){e=p("div"),l=C("Boot limit"),n=p("br"),i=v(),o=p("input"),u(o,"name","ivb"),u(o,"type","number"),u(o,"min","2.5"),u(o,"max","3.5"),u(o,"step","0.1"),u(o,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Y(o,t[3].i.v.b),a||(r=z(o,"input",t[86]),a=!0)},p(c,f){f[0]&8&&ae(o.value)!==c[3].i.v.b&&Y(o,c[3].i.v.b)},d(c){c&&y(e),a=!1,r()}}}function sf(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w,k=t[3].d.t&&of();return{c(){e=p("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=v(),n=p("div"),i=p("label"),o=p("input"),a=C(" Enable telnet"),r=v(),k&&k.c(),c=v(),f=p("div"),m=p("select"),_=p("option"),_.textContent="Verbose",h=p("option"),h.textContent="Debug",b=p("option"),b.textContent="Info",d=p("option"),d.textContent="Warning",u(e,"class","bd-red"),u(o,"type","checkbox"),u(o,"name","dt"),o.__value="true",o.value=o.__value,u(o,"class","rounded mb-1"),u(n,"class","my-1"),_.__value=1,_.value=_.__value,h.__value=2,h.value=h.__value,b.__value=3,b.value=b.__value,d.__value=4,d.value=d.__value,u(m,"name","dl"),u(m,"class","in-s"),t[3].d.l===void 0&&Ye(()=>t[89].call(m)),u(f,"class","my-1")},m(T,P){$(T,e,P),$(T,l,P),$(T,n,P),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,a),$(T,r,P),k&&k.m(T,P),$(T,c,P),$(T,f,P),s(f,m),s(m,_),s(m,h),s(m,b),s(m,d),Le(m,t[3].d.l),g||(w=[z(o,"change",t[88]),z(m,"change",t[89])],g=!0)},p(T,P){P[0]&8&&(o.checked=T[3].d.t),T[3].d.t?k||(k=of(),k.c(),k.m(c.parentNode,c)):k&&(k.d(1),k=null),P[0]&8&&Le(m,T[3].d.l)},d(T){T&&y(e),T&&y(l),T&&y(n),T&&y(r),k&&k.d(T),T&&y(c),T&&y(f),g=!1,Be(w)}}}function of(t){let e;return{c(){e=p("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function Nm(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w,k,T,P,E,S,N,D,R,W,q,F,L,j,U,O,G,H,V,J,ne,le,me,Pe,we,Re,Ce,Fe,_e,Me,Ie,ce,se,pe,K,re,Ae,Ne,de,ee,oe,ve,De,Oe,he,be,x,ue,Tl,_i,di,St,vi,Kl,pl,Zt,hi,bi,gi,lt,ki,Jt,wi,yi,$i,nt,Ci,xt,Ql,dt,Ti,Si,Pi,el,Mi,Ai,Di,qe,tl,Pt,Sl,Ni,ml,Ue,Xl,ho,Zl,Jl,bo,Qn,go,xl,ws,ko,_l,Ht,dl,wo,Ii,yo,et,vl,$o,Ei,en,tn,ln,nn,Ri,Co,Xn,Mt,To,So,Pl,Po,Mo,Ao,jt,sn,on,Do,un,Ml,No,Io,Eo,rn,At,Ro,Fi,Fo,Al,Lo,Oo,qo,an,Dt,Uo,Li,Ho,ys,jo,Dl,Oi,Nt,Wo,Go,Bo,$s,qi,It,Yo,zo,Vo,xe,Ui,Ko,fn,cn,Qo,Zn,Xo,Nl,Zo,Jo,xo,ll,eu,Il,tu,lu,nu,nl,iu,pn,El,su,ou,uu,kt,mn,_n,dn,vn,ru,Rl,au,fu,cu,hn,wt,pu,Hi,mu,ji,Wi,Et,_u,du,Je,Gi,vu,bn,gn,hu,Fl,bu,gu,ku,hl,Wt,kn,wn,wu,vt,Bi,Yi,yu,ht,yn,zi,Vi,$u,Cs,Ki,Qi,Rt,Cu,Tu,Jn,Su,bl,Pu,xn,Ft,Mu,Au,Du,Xi,il,Nu,Ge,Zi,Iu,$n,Cn,Eu,ei,Ru,Gt,Fu,Ts,Lu,Ou,Tn,sl,qu,Lt,Uu,Ss,Ll,Hu,ju,Wu,ol,Gu,Ol,Bu,Yu,zu,ul,Vu,Sn,Pn,Ku,Qu,Xu,rl,Zu,Mn,Ju,xu,er,it,An,Dn,Nn,In,En,Rn,tr,ql,lr,nr,ir,al,sr,Ps,Ms,As=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Ds,Bt,Ji,or,Fn,Ln,ur,ti,rr,li,ar,Ns,bt,xi,fr,On,qn,cr,ni,pr,es,ts,Ot,mr,_r,dr,gl,Is,Un,vr,ls,Hn,hr,ns,Es,Ul,Rs,Hl,Fs,jl,Ls,Wl,qt,Os,br;r=new $t({}),R=new vm({});let $c=["NOK","SEK","DKK","EUR"],is=[];for(let A=0;A<4;A+=1)is[A]=km(gm(t,$c,A));let st=t[3].p.e&&t[0].chip!="esp8266"&&Ua(t),ot=t[3].g.s>0&&Ha(t);Jl=new $t({});let Cc=[24,48,96,192,384,576,1152],ss=[];for(let A=0;A<7;A+=1)ss[A]=wm(bm(t,Cc,A));let ut=t[3].m.e.e&&ja(t),rt=t[3].m.e.e&&Wa(t),at=t[3].m.m.e&&Ga(t);cn=new $t({}),gn=new $t({}),yn=new yc({});let ft=t[3].n.m=="static"&&Ba(t);Cn=new $t({});let ct=t[0].chip!="esp8266"&&Ya(t),ze=t[3].q.s.e&&za(t),Ve=t[3].q.m==3&&Va(t),Ke=t[3].q.m==4&&Ka(t),Qe=As&&Qa(t);Ln=new $t({});let jn=t[7],pt=[];for(let A=0;A<jn.length;A+=1)pt[A]=Za(Oa(t,jn,A));let Xe=(t[0].board>20||t[0].chip=="esp8266")&&Ja(t);qn=new $t({});let mt=t[3].d.s&&sf(t);return Ul=new gt({props:{active:t[1],message:"Loading configuration"}}),Hl=new gt({props:{active:t[2],message:"Saving configuration"}}),jl=new gt({props:{active:t[4],message:"Performing factory reset"}}),Wl=new gt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=p("form"),l=p("div"),n=p("div"),i=p("strong"),i.textContent="General",o=v(),a=p("a"),Z(r.$$.fragment),c=v(),f=p("input"),m=v(),_=p("div"),h=p("div"),b=p("div"),d=C("Hostname"),g=p("br"),w=v(),k=p("input"),T=v(),P=p("div"),E=C("Time zone"),S=p("br"),N=v(),D=p("select"),Z(R.$$.fragment),W=v(),q=p("input"),F=v(),L=p("div"),j=p("div"),U=p("div"),O=C("Price region"),G=p("br"),H=v(),V=p("select"),J=p("optgroup"),ne=p("option"),ne.textContent="NO1",le=p("option"),le.textContent="NO2",me=p("option"),me.textContent="NO3",Pe=p("option"),Pe.textContent="NO4",we=p("option"),we.textContent="NO5",Re=p("optgroup"),Ce=p("option"),Ce.textContent="SE1",Fe=p("option"),Fe.textContent="SE2",_e=p("option"),_e.textContent="SE3",Me=p("option"),Me.textContent="SE4",Ie=p("optgroup"),ce=p("option"),ce.textContent="DK1",se=p("option"),se.textContent="DK2",pe=p("option"),pe.textContent="Austria",K=p("option"),K.textContent="Belgium",re=p("option"),re.textContent="Czech Republic",Ae=p("option"),Ae.textContent="Estonia",Ne=p("option"),Ne.textContent="Finland",de=p("option"),de.textContent="France",ee=p("option"),ee.textContent="Germany",oe=p("option"),oe.textContent="Great Britain",ve=p("option"),ve.textContent="Latvia",De=p("option"),De.textContent="Lithuania",Oe=p("option"),Oe.textContent="Netherland",he=p("option"),he.textContent="Poland",be=p("option"),be.textContent="Switzerland",x=v(),ue=p("div"),Tl=C("Currency"),_i=p("br"),di=v(),St=p("select");for(let A=0;A<4;A+=1)is[A].c();vi=v(),Kl=p("div"),pl=p("div"),Zt=p("div"),hi=C("Fixed price"),bi=p("br"),gi=v(),lt=p("input"),ki=v(),Jt=p("div"),wi=C("Multiplier"),yi=p("br"),$i=v(),nt=p("input"),Ci=v(),xt=p("div"),Ql=p("label"),dt=p("input"),Ti=C(" Enable price fetch from remote server"),Si=v(),st&&st.c(),Pi=v(),el=p("div"),Mi=C("Security"),Ai=p("br"),Di=v(),qe=p("select"),tl=p("option"),tl.textContent="None",Pt=p("option"),Pt.textContent="Only configuration",Sl=p("option"),Sl.textContent="Everything",Ni=v(),ot&&ot.c(),ml=v(),Ue=p("div"),Xl=p("strong"),Xl.textContent="Meter",ho=v(),Zl=p("a"),Z(Jl.$$.fragment),bo=v(),Qn=p("input"),go=v(),xl=p("div"),ws=p("span"),ws.textContent="Serial configuration",ko=v(),_l=p("div"),Ht=p("select"),dl=p("option"),wo=C("Autodetect");for(let A=0;A<7;A+=1)ss[A].c();yo=v(),et=p("select"),vl=p("option"),$o=C("-"),en=p("option"),en.textContent="7N1",tn=p("option"),tn.textContent="8N1",ln=p("option"),ln.textContent="7E1",nn=p("option"),nn.textContent="8E1",Co=v(),Xn=p("label"),Mt=p("input"),To=C(" inverted"),So=v(),Pl=p("div"),Po=C("Voltage"),Mo=p("br"),Ao=v(),jt=p("select"),sn=p("option"),sn.textContent="400V (TN)",on=p("option"),on.textContent="230V (IT/TT)",Do=v(),un=p("div"),Ml=p("div"),No=C("Main fuse"),Io=p("br"),Eo=v(),rn=p("label"),At=p("input"),Ro=v(),Fi=p("span"),Fi.textContent="A",Fo=v(),Al=p("div"),Lo=C("Production"),Oo=p("br"),qo=v(),an=p("label"),Dt=p("input"),Uo=v(),Li=p("span"),Li.textContent="kWp",Ho=v(),ys=p("div"),jo=v(),Dl=p("div"),Oi=p("label"),Nt=p("input"),Wo=C(" Meter is encrypted"),Go=v(),ut&&ut.c(),Bo=v(),rt&&rt.c(),$s=v(),qi=p("label"),It=p("input"),Yo=C(" Multipliers"),zo=v(),at&&at.c(),Vo=v(),xe=p("div"),Ui=p("strong"),Ui.textContent="WiFi",Ko=v(),fn=p("a"),Z(cn.$$.fragment),Qo=v(),Zn=p("input"),Xo=v(),Nl=p("div"),Zo=C("SSID"),Jo=p("br"),xo=v(),ll=p("input"),eu=v(),Il=p("div"),tu=C("Password"),lu=p("br"),nu=v(),nl=p("input"),iu=v(),pn=p("div"),El=p("div"),su=C("Power saving"),ou=p("br"),uu=v(),kt=p("select"),mn=p("option"),mn.textContent="Default",_n=p("option"),_n.textContent="Off",dn=p("option"),dn.textContent="Minimum",vn=p("option"),vn.textContent="Maximum",ru=v(),Rl=p("div"),au=C("Power"),fu=p("br"),cu=v(),hn=p("div"),wt=p("input"),pu=v(),Hi=p("span"),Hi.textContent="dBm",mu=v(),ji=p("div"),Wi=p("label"),Et=p("input"),_u=C(" Auto reboot on connection problem"),du=v(),Je=p("div"),Gi=p("strong"),Gi.textContent="Network",vu=v(),bn=p("a"),Z(gn.$$.fragment),hu=v(),Fl=p("div"),bu=C("IP"),gu=p("br"),ku=v(),hl=p("div"),Wt=p("select"),kn=p("option"),kn.textContent="DHCP",wn=p("option"),wn.textContent="Static",wu=v(),vt=p("input"),yu=v(),ht=p("select"),Z(yn.$$.fragment),$u=v(),ft&&ft.c(),Cs=v(),Ki=p("div"),Qi=p("label"),Rt=p("input"),Cu=C(" enable mDNS"),Tu=v(),Jn=p("input"),Su=v(),bl=p("div"),Pu=C("NTP "),xn=p("label"),Ft=p("input"),Mu=C(" obtain from DHCP"),Au=p("br"),Du=v(),Xi=p("div"),il=p("input"),Nu=v(),Ge=p("div"),Zi=p("strong"),Zi.textContent="MQTT",Iu=v(),$n=p("a"),Z(Cn.$$.fragment),Eu=v(),ei=p("input"),Ru=v(),Gt=p("div"),Fu=C(`Server
`),ct&&ct.c(),Ts=v(),Lu=p("br"),Ou=v(),Tn=p("div"),sl=p("input"),qu=v(),Lt=p("input"),Uu=v(),ze&&ze.c(),Ss=v(),Ll=p("div"),Hu=C("Username"),ju=p("br"),Wu=v(),ol=p("input"),Gu=v(),Ol=p("div"),Bu=C("Password"),Yu=p("br"),zu=v(),ul=p("input"),Vu=v(),Sn=p("div"),Pn=p("div"),Ku=C("Client ID"),Qu=p("br"),Xu=v(),rl=p("input"),Zu=v(),Mn=p("div"),Ju=C("Payload"),xu=p("br"),er=v(),it=p("select"),An=p("option"),An.textContent="JSON",Dn=p("option"),Dn.textContent="Raw (minimal)",Nn=p("option"),Nn.textContent="Raw (full)",In=p("option"),In.textContent="Domoticz",En=p("option"),En.textContent="HomeAssistant",Rn=p("option"),Rn.textContent="HEX dump",tr=v(),ql=p("div"),lr=C("Publish topic"),nr=p("br"),ir=v(),al=p("input"),sr=v(),Ve&&Ve.c(),Ps=v(),Ke&&Ke.c(),Ms=v(),Qe&&Qe.c(),Ds=v(),Bt=p("div"),Ji=p("strong"),Ji.textContent="User interface",or=v(),Fn=p("a"),Z(Ln.$$.fragment),ur=v(),ti=p("input"),rr=v(),li=p("div");for(let A=0;A<pt.length;A+=1)pt[A].c();ar=v(),Xe&&Xe.c(),Ns=v(),bt=p("div"),xi=p("strong"),xi.textContent="Debugging",fr=v(),On=p("a"),Z(qn.$$.fragment),cr=v(),ni=p("input"),pr=v(),es=p("div"),ts=p("label"),Ot=p("input"),mr=C(" Enable debugging"),_r=v(),mt&&mt.c(),dr=v(),gl=p("div"),Is=p("div"),Un=p("button"),Un.textContent="Factory reset",vr=v(),ls=p("div"),Hn=p("button"),Hn.textContent="Reboot",hr=v(),ns=p("div"),ns.innerHTML='<button type="submit" class="btn-pri">Save</button>',Es=v(),Z(Ul.$$.fragment),Rs=v(),Z(Hl.$$.fragment),Fs=v(),Z(jl.$$.fragment),Ls=v(),Z(Wl.$$.fragment),u(i,"class","text-sm"),u(a,"href",Ct("General-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","g"),f.value="true",u(k,"name","gh"),u(k,"type","text"),u(k,"class","in-f w-full"),u(k,"pattern","[A-Za-z0-9-]+"),u(D,"name","gt"),u(D,"class","in-l w-full"),t[3].g.t===void 0&&Ye(()=>t[13].call(D)),u(h,"class","flex"),u(_,"class","my-1"),u(q,"type","hidden"),u(q,"name","p"),q.value="true",ne.__value="10YNO-1--------2",ne.value=ne.__value,le.__value="10YNO-2--------T",le.value=le.__value,me.__value="10YNO-3--------J",me.value=me.__value,Pe.__value="10YNO-4--------9",Pe.value=Pe.__value,we.__value="10Y1001A1001A48H",we.value=we.__value,u(J,"label","Norway"),Ce.__value="10Y1001A1001A44P",Ce.value=Ce.__value,Fe.__value="10Y1001A1001A45N",Fe.value=Fe.__value,_e.__value="10Y1001A1001A46L",_e.value=_e.__value,Me.__value="10Y1001A1001A47J",Me.value=Me.__value,u(Re,"label","Sweden"),ce.__value="10YDK-1--------W",ce.value=ce.__value,se.__value="10YDK-2--------M",se.value=se.__value,u(Ie,"label","Denmark"),pe.__value="10YAT-APG------L",pe.value=pe.__value,K.__value="10YBE----------2",K.value=K.__value,re.__value="10YCZ-CEPS-----N",re.value=re.__value,Ae.__value="10Y1001A1001A39I",Ae.value=Ae.__value,Ne.__value="10YFI-1--------U",Ne.value=Ne.__value,de.__value="10YFR-RTE------C",de.value=de.__value,ee.__value="10Y1001A1001A83F",ee.value=ee.__value,oe.__value="10YGB----------A",oe.value=oe.__value,ve.__value="10YLV-1001A00074",ve.value=ve.__value,De.__value="10YLT-1001A0008Q",De.value=De.__value,Oe.__value="10YNL----------L",Oe.value=Oe.__value,he.__value="10YPL-AREA-----S",he.value=he.__value,be.__value="10YCH-SWISSGRIDZ",be.value=be.__value,u(V,"name","pr"),u(V,"class","in-f w-full"),t[3].p.r===void 0&&Ye(()=>t[14].call(V)),u(U,"class","w-full"),u(St,"name","pc"),u(St,"class","in-l"),t[3].p.c===void 0&&Ye(()=>t[15].call(St)),u(j,"class","flex"),u(L,"class","my-1"),u(lt,"name","pf"),u(lt,"type","number"),u(lt,"min","0.001"),u(lt,"max","65"),u(lt,"step","0.001"),u(lt,"class","in-f tr w-full"),u(Zt,"class","w-1/2"),u(nt,"name","pm"),u(nt,"type","number"),u(nt,"min","0.001"),u(nt,"max","1000"),u(nt,"step","0.001"),u(nt,"class","in-l tr w-full"),u(Jt,"class","w-1/2"),u(pl,"class","flex"),u(Kl,"class","my-1"),u(dt,"type","checkbox"),u(dt,"name","pe"),dt.__value="true",dt.value=dt.__value,u(dt,"class","rounded mb-1"),u(xt,"class","my-1"),tl.__value=0,tl.value=tl.__value,Pt.__value=1,Pt.value=Pt.__value,Sl.__value=2,Sl.value=Sl.__value,u(qe,"name","gs"),u(qe,"class","in-s"),t[3].g.s===void 0&&Ye(()=>t[20].call(qe)),u(el,"class","my-1"),u(n,"class","cnt"),u(Xl,"class","text-sm"),u(Zl,"href",Ct("Meter-configuration")),u(Zl,"target","_blank"),u(Zl,"class","float-right"),u(Qn,"type","hidden"),u(Qn,"name","m"),Qn.value="true",dl.__value=0,dl.value=dl.__value,dl.disabled=Ii=t[3].m.b!=0,u(Ht,"name","mb"),u(Ht,"class","in-f"),t[3].m.b===void 0&&Ye(()=>t[23].call(Ht)),vl.__value=0,vl.value=vl.__value,vl.disabled=Ei=t[3].m.b!=0,en.__value=2,en.value=en.__value,tn.__value=3,tn.value=tn.__value,ln.__value=10,ln.value=ln.__value,nn.__value=11,nn.value=nn.__value,u(et,"name","mp"),u(et,"class","in-l"),et.disabled=Ri=t[3].m.b==0,t[3].m.p===void 0&&Ye(()=>t[24].call(et)),u(Mt,"name","mi"),Mt.__value="true",Mt.value=Mt.__value,u(Mt,"type","checkbox"),u(Mt,"class","rounded mb-1"),u(Xn,"class","mt-2 ml-3 whitespace-nowrap"),u(_l,"class","flex"),u(xl,"class","my-1"),sn.__value=2,sn.value=sn.__value,on.__value=1,on.value=on.__value,u(jt,"name","md"),u(jt,"class","in-s"),t[3].m.d===void 0&&Ye(()=>t[26].call(jt)),u(Pl,"class","my-1"),u(At,"name","mf"),u(At,"type","number"),u(At,"min","5"),u(At,"max","65535"),u(At,"class","in-f tr w-full"),u(Fi,"class","in-post"),u(rn,"class","flex"),u(Ml,"class","mx-1"),u(Dt,"name","mr"),u(Dt,"type","number"),u(Dt,"min","0"),u(Dt,"max","65535"),u(Dt,"class","in-f tr w-full"),u(Li,"class","in-post"),u(an,"class","flex"),u(Al,"class","mx-1"),u(un,"class","my-1 flex"),u(ys,"class","my-1"),u(Nt,"type","checkbox"),u(Nt,"name","me"),Nt.__value="true",Nt.value=Nt.__value,u(Nt,"class","rounded mb-1"),u(Dl,"class","my-1"),u(It,"type","checkbox"),u(It,"name","mm"),It.__value="true",It.value=It.__value,u(It,"class","rounded mb-1"),u(Ue,"class","cnt"),u(Ui,"class","text-sm"),u(fn,"href",Ct("WiFi-configuration")),u(fn,"target","_blank"),u(fn,"class","float-right"),u(Zn,"type","hidden"),u(Zn,"name","w"),Zn.value="true",u(ll,"name","ws"),u(ll,"type","text"),u(ll,"class","in-s"),u(Nl,"class","my-1"),u(nl,"name","wp"),u(nl,"type","password"),u(nl,"class","in-s"),u(Il,"class","my-1"),mn.__value=255,mn.value=mn.__value,_n.__value=0,_n.value=_n.__value,dn.__value=1,dn.value=dn.__value,vn.__value=2,vn.value=vn.__value,u(kt,"name","wz"),u(kt,"class","in-s"),t[3].w.z===void 0&&Ye(()=>t[39].call(kt)),u(El,"class","w-1/2"),u(wt,"name","ww"),u(wt,"type","number"),u(wt,"min","0"),u(wt,"max","20.5"),u(wt,"step","0.5"),u(wt,"class","in-f tr w-full"),u(Hi,"class","in-post"),u(hn,"class","flex"),u(Rl,"class","ml-2 w-1/2"),u(pn,"class","my-1 flex"),u(Et,"type","checkbox"),u(Et,"name","wa"),Et.__value="true",Et.value=Et.__value,u(Et,"class","rounded mb-1"),u(ji,"class","my-3"),u(xe,"class","cnt"),u(Gi,"class","text-sm"),u(bn,"href",Ct("Network-configuration")),u(bn,"target","_blank"),u(bn,"class","float-right"),kn.__value="dhcp",kn.value=kn.__value,wn.__value="static",wn.value=wn.__value,u(Wt,"name","nm"),u(Wt,"class","in-f"),t[3].n.m===void 0&&Ye(()=>t[42].call(Wt)),u(vt,"name","ni"),u(vt,"type","text"),u(vt,"class","in-m w-full"),vt.disabled=Bi=t[3].n.m=="dhcp",vt.required=Yi=t[3].n.m=="static",u(ht,"name","ns"),u(ht,"class","in-l"),ht.disabled=zi=t[3].n.m=="dhcp",ht.required=Vi=t[3].n.m=="static",t[3].n.s===void 0&&Ye(()=>t[44].call(ht)),u(hl,"class","flex"),u(Fl,"class","my-1"),u(Rt,"name","nd"),Rt.__value="true",Rt.value=Rt.__value,u(Rt,"type","checkbox"),u(Rt,"class","rounded mb-1"),u(Ki,"class","my-1"),u(Jn,"type","hidden"),u(Jn,"name","ntp"),Jn.value="true",u(Ft,"name","ntpd"),Ft.__value="true",Ft.value=Ft.__value,u(Ft,"type","checkbox"),u(Ft,"class","rounded mb-1"),u(xn,"class","ml-4"),u(il,"name","ntph"),u(il,"type","text"),u(il,"class","in-s"),u(Xi,"class","flex"),u(bl,"class","my-1"),u(Je,"class","cnt"),u(Zi,"class","text-sm"),u($n,"href",Ct("MQTT-configuration")),u($n,"target","_blank"),u($n,"class","float-right"),u(ei,"type","hidden"),u(ei,"name","q"),ei.value="true",u(sl,"name","qh"),u(sl,"type","text"),u(sl,"class","in-f w-3/4"),u(Lt,"name","qp"),u(Lt,"type","number"),u(Lt,"min","1024"),u(Lt,"max","65535"),u(Lt,"class","in-l tr w-1/4"),u(Tn,"class","flex"),u(Gt,"class","my-1"),u(ol,"name","qu"),u(ol,"type","text"),u(ol,"class","in-s"),u(Ll,"class","my-1"),u(ul,"name","qa"),u(ul,"type","password"),u(ul,"class","in-s"),u(Ol,"class","my-1"),u(rl,"name","qc"),u(rl,"type","text"),u(rl,"class","in-f w-full"),An.__value=0,An.value=An.__value,Dn.__value=1,Dn.value=Dn.__value,Nn.__value=2,Nn.value=Nn.__value,In.__value=3,In.value=In.__value,En.__value=4,En.value=En.__value,Rn.__value=255,Rn.value=Rn.__value,u(it,"name","qm"),u(it,"class","in-l"),t[3].q.m===void 0&&Ye(()=>t[57].call(it)),u(Sn,"class","my-1 flex"),u(al,"name","qb"),u(al,"type","text"),u(al,"class","in-s"),u(ql,"class","my-1"),u(Ge,"class","cnt"),u(Ji,"class","text-sm"),u(Fn,"href",Ct("User-interface")),u(Fn,"target","_blank"),u(Fn,"class","float-right"),u(ti,"type","hidden"),u(ti,"name","u"),ti.value="true",u(li,"class","flex flex-wrap"),u(Bt,"class","cnt"),u(xi,"class","text-sm"),u(On,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(On,"target","_blank"),u(On,"class","float-right"),u(ni,"type","hidden"),u(ni,"name","d"),ni.value="true",u(Ot,"type","checkbox"),u(Ot,"name","ds"),Ot.__value="true",Ot.value=Ot.__value,u(Ot,"class","rounded mb-1"),u(es,"class","mt-3"),u(bt,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(Un,"type","button"),u(Un,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),u(Hn,"type","button"),u(Hn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(ls,"class","text-center"),u(ns,"class","text-right"),u(gl,"class","grid grid-cols-3"),u(e,"autocomplete","off")},m(A,te){$(A,e,te),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),Q(r,a,null),s(n,c),s(n,f),s(n,m),s(n,_),s(_,h),s(h,b),s(b,d),s(b,g),s(b,w),s(b,k),Y(k,t[3].g.h),s(h,T),s(h,P),s(P,E),s(P,S),s(P,N),s(P,D),Q(R,D,null),Le(D,t[3].g.t),s(n,W),s(n,q),s(n,F),s(n,L),s(L,j),s(j,U),s(U,O),s(U,G),s(U,H),s(U,V),s(V,J),s(J,ne),s(J,le),s(J,me),s(J,Pe),s(J,we),s(V,Re),s(Re,Ce),s(Re,Fe),s(Re,_e),s(Re,Me),s(V,Ie),s(Ie,ce),s(Ie,se),s(V,pe),s(V,K),s(V,re),s(V,Ae),s(V,Ne),s(V,de),s(V,ee),s(V,oe),s(V,ve),s(V,De),s(V,Oe),s(V,he),s(V,be),Le(V,t[3].p.r),s(j,x),s(j,ue),s(ue,Tl),s(ue,_i),s(ue,di),s(ue,St);for(let _t=0;_t<4;_t+=1)is[_t].m(St,null);Le(St,t[3].p.c),s(n,vi),s(n,Kl),s(Kl,pl),s(pl,Zt),s(Zt,hi),s(Zt,bi),s(Zt,gi),s(Zt,lt),Y(lt,t[3].p.f),s(pl,ki),s(pl,Jt),s(Jt,wi),s(Jt,yi),s(Jt,$i),s(Jt,nt),Y(nt,t[3].p.m),s(n,Ci),s(n,xt),s(xt,Ql),s(Ql,dt),dt.checked=t[3].p.e,s(Ql,Ti),s(xt,Si),st&&st.m(xt,null),s(n,Pi),s(n,el),s(el,Mi),s(el,Ai),s(el,Di),s(el,qe),s(qe,tl),s(qe,Pt),s(qe,Sl),Le(qe,t[3].g.s),s(n,Ni),ot&&ot.m(n,null),s(l,ml),s(l,Ue),s(Ue,Xl),s(Ue,ho),s(Ue,Zl),Q(Jl,Zl,null),s(Ue,bo),s(Ue,Qn),s(Ue,go),s(Ue,xl),s(xl,ws),s(xl,ko),s(xl,_l),s(_l,Ht),s(Ht,dl),s(dl,wo);for(let _t=0;_t<7;_t+=1)ss[_t].m(Ht,null);Le(Ht,t[3].m.b),s(_l,yo),s(_l,et),s(et,vl),s(vl,$o),s(et,en),s(et,tn),s(et,ln),s(et,nn),Le(et,t[3].m.p),s(_l,Co),s(_l,Xn),s(Xn,Mt),Mt.checked=t[3].m.i,s(Xn,To),s(Ue,So),s(Ue,Pl),s(Pl,Po),s(Pl,Mo),s(Pl,Ao),s(Pl,jt),s(jt,sn),s(jt,on),Le(jt,t[3].m.d),s(Ue,Do),s(Ue,un),s(un,Ml),s(Ml,No),s(Ml,Io),s(Ml,Eo),s(Ml,rn),s(rn,At),Y(At,t[3].m.f),s(rn,Ro),s(rn,Fi),s(un,Fo),s(un,Al),s(Al,Lo),s(Al,Oo),s(Al,qo),s(Al,an),s(an,Dt),Y(Dt,t[3].m.r),s(an,Uo),s(an,Li),s(Ue,Ho),s(Ue,ys),s(Ue,jo),s(Ue,Dl),s(Dl,Oi),s(Oi,Nt),Nt.checked=t[3].m.e.e,s(Oi,Wo),s(Dl,Go),ut&&ut.m(Dl,null),s(Ue,Bo),rt&&rt.m(Ue,null),s(Ue,$s),s(Ue,qi),s(qi,It),It.checked=t[3].m.m.e,s(qi,Yo),s(Ue,zo),at&&at.m(Ue,null),s(l,Vo),s(l,xe),s(xe,Ui),s(xe,Ko),s(xe,fn),Q(cn,fn,null),s(xe,Qo),s(xe,Zn),s(xe,Xo),s(xe,Nl),s(Nl,Zo),s(Nl,Jo),s(Nl,xo),s(Nl,ll),Y(ll,t[3].w.s),s(xe,eu),s(xe,Il),s(Il,tu),s(Il,lu),s(Il,nu),s(Il,nl),Y(nl,t[3].w.p),s(xe,iu),s(xe,pn),s(pn,El),s(El,su),s(El,ou),s(El,uu),s(El,kt),s(kt,mn),s(kt,_n),s(kt,dn),s(kt,vn),Le(kt,t[3].w.z),s(pn,ru),s(pn,Rl),s(Rl,au),s(Rl,fu),s(Rl,cu),s(Rl,hn),s(hn,wt),Y(wt,t[3].w.w),s(hn,pu),s(hn,Hi),s(xe,mu),s(xe,ji),s(ji,Wi),s(Wi,Et),Et.checked=t[3].w.a,s(Wi,_u),s(l,du),s(l,Je),s(Je,Gi),s(Je,vu),s(Je,bn),Q(gn,bn,null),s(Je,hu),s(Je,Fl),s(Fl,bu),s(Fl,gu),s(Fl,ku),s(Fl,hl),s(hl,Wt),s(Wt,kn),s(Wt,wn),Le(Wt,t[3].n.m),s(hl,wu),s(hl,vt),Y(vt,t[3].n.i),s(hl,yu),s(hl,ht),Q(yn,ht,null),Le(ht,t[3].n.s),s(Je,$u),ft&&ft.m(Je,null),s(Je,Cs),s(Je,Ki),s(Ki,Qi),s(Qi,Rt),Rt.checked=t[3].n.d,s(Qi,Cu),s(Je,Tu),s(Je,Jn),s(Je,Su),s(Je,bl),s(bl,Pu),s(bl,xn),s(xn,Ft),Ft.checked=t[3].n.h,s(xn,Mu),s(bl,Au),s(bl,Du),s(bl,Xi),s(Xi,il),Y(il,t[3].n.n1),s(l,Nu),s(l,Ge),s(Ge,Zi),s(Ge,Iu),s(Ge,$n),Q(Cn,$n,null),s(Ge,Eu),s(Ge,ei),s(Ge,Ru),s(Ge,Gt),s(Gt,Fu),ct&&ct.m(Gt,null),s(Gt,Ts),s(Gt,Lu),s(Gt,Ou),s(Gt,Tn),s(Tn,sl),Y(sl,t[3].q.h),s(Tn,qu),s(Tn,Lt),Y(Lt,t[3].q.p),s(Ge,Uu),ze&&ze.m(Ge,null),s(Ge,Ss),s(Ge,Ll),s(Ll,Hu),s(Ll,ju),s(Ll,Wu),s(Ll,ol),Y(ol,t[3].q.u),s(Ge,Gu),s(Ge,Ol),s(Ol,Bu),s(Ol,Yu),s(Ol,zu),s(Ol,ul),Y(ul,t[3].q.a),s(Ge,Vu),s(Ge,Sn),s(Sn,Pn),s(Pn,Ku),s(Pn,Qu),s(Pn,Xu),s(Pn,rl),Y(rl,t[3].q.c),s(Sn,Zu),s(Sn,Mn),s(Mn,Ju),s(Mn,xu),s(Mn,er),s(Mn,it),s(it,An),s(it,Dn),s(it,Nn),s(it,In),s(it,En),s(it,Rn),Le(it,t[3].q.m),s(Ge,tr),s(Ge,ql),s(ql,lr),s(ql,nr),s(ql,ir),s(ql,al),Y(al,t[3].q.b),s(l,sr),Ve&&Ve.m(l,null),s(l,Ps),Ke&&Ke.m(l,null),s(l,Ms),Qe&&Qe.m(l,null),s(l,Ds),s(l,Bt),s(Bt,Ji),s(Bt,or),s(Bt,Fn),Q(Ln,Fn,null),s(Bt,ur),s(Bt,ti),s(Bt,rr),s(Bt,li);for(let _t=0;_t<pt.length;_t+=1)pt[_t].m(li,null);s(l,ar),Xe&&Xe.m(l,null),s(l,Ns),s(l,bt),s(bt,xi),s(bt,fr),s(bt,On),Q(qn,On,null),s(bt,cr),s(bt,ni),s(bt,pr),s(bt,es),s(es,ts),s(ts,Ot),Ot.checked=t[3].d.s,s(ts,mr),s(bt,_r),mt&&mt.m(bt,null),s(e,dr),s(e,gl),s(gl,Is),s(Is,Un),s(gl,vr),s(gl,ls),s(ls,Hn),s(gl,hr),s(gl,ns),$(A,Es,te),Q(Ul,A,te),$(A,Rs,te),Q(Hl,A,te),$(A,Fs,te),Q(jl,A,te),$(A,Ls,te),Q(Wl,A,te),qt=!0,Os||(br=[z(k,"input",t[12]),z(D,"change",t[13]),z(V,"change",t[14]),z(St,"change",t[15]),z(lt,"input",t[16]),z(nt,"input",t[17]),z(dt,"change",t[18]),z(qe,"change",t[20]),z(Ht,"change",t[23]),z(et,"change",t[24]),z(Mt,"change",t[25]),z(jt,"change",t[26]),z(At,"input",t[27]),z(Dt,"input",t[28]),z(Nt,"change",t[29]),z(It,"change",t[32]),z(ll,"input",t[37]),z(nl,"input",t[38]),z(kt,"change",t[39]),z(wt,"input",t[40]),z(Et,"change",t[41]),z(Wt,"change",t[42]),z(vt,"input",t[43]),z(ht,"change",t[44]),z(Rt,"change",t[48]),z(Ft,"change",t[49]),z(il,"input",t[50]),z(sl,"input",t[52]),z(Lt,"input",t[53]),z(ol,"input",t[54]),z(ul,"input",t[55]),z(rl,"input",t[56]),z(it,"change",t[57]),z(al,"input",t[58]),z(Ot,"change",t[87]),z(Un,"click",t[8]),z(Hn,"click",t[10]),z(e,"submit",gs(t[9]))],Os=!0)},p(A,te){if(te[0]&8&&k.value!==A[3].g.h&&Y(k,A[3].g.h),te[0]&8&&Le(D,A[3].g.t),te[0]&8&&Le(V,A[3].p.r),te[0]&8&&Le(St,A[3].p.c),te[0]&8&&ae(lt.value)!==A[3].p.f&&Y(lt,A[3].p.f),te[0]&8&&ae(nt.value)!==A[3].p.m&&Y(nt,A[3].p.m),te[0]&8&&(dt.checked=A[3].p.e),A[3].p.e&&A[0].chip!="esp8266"?st?st.p(A,te):(st=Ua(A),st.c(),st.m(xt,null)):st&&(st.d(1),st=null),te[0]&8&&Le(qe,A[3].g.s),A[3].g.s>0?ot?ot.p(A,te):(ot=Ha(A),ot.c(),ot.m(n,null)):ot&&(ot.d(1),ot=null),(!qt||te[0]&8&&Ii!==(Ii=A[3].m.b!=0))&&(dl.disabled=Ii),te[0]&8&&Le(Ht,A[3].m.b),(!qt||te[0]&8&&Ei!==(Ei=A[3].m.b!=0))&&(vl.disabled=Ei),(!qt||te[0]&8&&Ri!==(Ri=A[3].m.b==0))&&(et.disabled=Ri),te[0]&8&&Le(et,A[3].m.p),te[0]&8&&(Mt.checked=A[3].m.i),te[0]&8&&Le(jt,A[3].m.d),te[0]&8&&ae(At.value)!==A[3].m.f&&Y(At,A[3].m.f),te[0]&8&&ae(Dt.value)!==A[3].m.r&&Y(Dt,A[3].m.r),te[0]&8&&(Nt.checked=A[3].m.e.e),A[3].m.e.e?ut?ut.p(A,te):(ut=ja(A),ut.c(),ut.m(Dl,null)):ut&&(ut.d(1),ut=null),A[3].m.e.e?rt?rt.p(A,te):(rt=Wa(A),rt.c(),rt.m(Ue,$s)):rt&&(rt.d(1),rt=null),te[0]&8&&(It.checked=A[3].m.m.e),A[3].m.m.e?at?at.p(A,te):(at=Ga(A),at.c(),at.m(Ue,null)):at&&(at.d(1),at=null),te[0]&8&&ll.value!==A[3].w.s&&Y(ll,A[3].w.s),te[0]&8&&nl.value!==A[3].w.p&&Y(nl,A[3].w.p),te[0]&8&&Le(kt,A[3].w.z),te[0]&8&&ae(wt.value)!==A[3].w.w&&Y(wt,A[3].w.w),te[0]&8&&(Et.checked=A[3].w.a),te[0]&8&&Le(Wt,A[3].n.m),(!qt||te[0]&8&&Bi!==(Bi=A[3].n.m=="dhcp"))&&(vt.disabled=Bi),(!qt||te[0]&8&&Yi!==(Yi=A[3].n.m=="static"))&&(vt.required=Yi),te[0]&8&&vt.value!==A[3].n.i&&Y(vt,A[3].n.i),(!qt||te[0]&8&&zi!==(zi=A[3].n.m=="dhcp"))&&(ht.disabled=zi),(!qt||te[0]&8&&Vi!==(Vi=A[3].n.m=="static"))&&(ht.required=Vi),te[0]&8&&Le(ht,A[3].n.s),A[3].n.m=="static"?ft?ft.p(A,te):(ft=Ba(A),ft.c(),ft.m(Je,Cs)):ft&&(ft.d(1),ft=null),te[0]&8&&(Rt.checked=A[3].n.d),te[0]&8&&(Ft.checked=A[3].n.h),te[0]&8&&il.value!==A[3].n.n1&&Y(il,A[3].n.n1),A[0].chip!="esp8266"?ct?ct.p(A,te):(ct=Ya(A),ct.c(),ct.m(Gt,Ts)):ct&&(ct.d(1),ct=null),te[0]&8&&sl.value!==A[3].q.h&&Y(sl,A[3].q.h),te[0]&8&&ae(Lt.value)!==A[3].q.p&&Y(Lt,A[3].q.p),A[3].q.s.e?ze?(ze.p(A,te),te[0]&8&&M(ze,1)):(ze=za(A),ze.c(),M(ze,1),ze.m(Ge,Ss)):ze&&(Te(),I(ze,1,1,()=>{ze=null}),Se()),te[0]&8&&ol.value!==A[3].q.u&&Y(ol,A[3].q.u),te[0]&8&&ul.value!==A[3].q.a&&Y(ul,A[3].q.a),te[0]&8&&rl.value!==A[3].q.c&&Y(rl,A[3].q.c),te[0]&8&&Le(it,A[3].q.m),te[0]&8&&al.value!==A[3].q.b&&Y(al,A[3].q.b),A[3].q.m==3?Ve?(Ve.p(A,te),te[0]&8&&M(Ve,1)):(Ve=Va(A),Ve.c(),M(Ve,1),Ve.m(l,Ps)):Ve&&(Te(),I(Ve,1,1,()=>{Ve=null}),Se()),A[3].q.m==4?Ke?(Ke.p(A,te),te[0]&8&&M(Ke,1)):(Ke=Ka(A),Ke.c(),M(Ke,1),Ke.m(l,Ms)):Ke&&(Te(),I(Ke,1,1,()=>{Ke=null}),Se()),te[0]&8&&(As=A[3].p.r.startsWith("10YNO")||A[3].p.r=="10Y1001A1001A48H"),As?Qe?(Qe.p(A,te),te[0]&8&&M(Qe,1)):(Qe=Qa(A),Qe.c(),M(Qe,1),Qe.m(l,Ds)):Qe&&(Te(),I(Qe,1,1,()=>{Qe=null}),Se()),te[0]&136){jn=A[7];let yt;for(yt=0;yt<jn.length;yt+=1){const yr=Oa(A,jn,yt);pt[yt]?pt[yt].p(yr,te):(pt[yt]=Za(yr),pt[yt].c(),pt[yt].m(li,null))}for(;yt<pt.length;yt+=1)pt[yt].d(1);pt.length=jn.length}A[0].board>20||A[0].chip=="esp8266"?Xe?(Xe.p(A,te),te[0]&1&&M(Xe,1)):(Xe=Ja(A),Xe.c(),M(Xe,1),Xe.m(l,Ns)):Xe&&(Te(),I(Xe,1,1,()=>{Xe=null}),Se()),te[0]&8&&(Ot.checked=A[3].d.s),A[3].d.s?mt?mt.p(A,te):(mt=sf(A),mt.c(),mt.m(bt,null)):mt&&(mt.d(1),mt=null);const _t={};te[0]&2&&(_t.active=A[1]),Ul.$set(_t);const gr={};te[0]&4&&(gr.active=A[2]),Hl.$set(gr);const kr={};te[0]&16&&(kr.active=A[4]),jl.$set(kr);const wr={};te[0]&32&&(wr.active=A[5]),Wl.$set(wr)},i(A){qt||(M(r.$$.fragment,A),M(R.$$.fragment,A),M(Jl.$$.fragment,A),M(cn.$$.fragment,A),M(gn.$$.fragment,A),M(yn.$$.fragment,A),M(Cn.$$.fragment,A),M(ze),M(Ve),M(Ke),M(Qe),M(Ln.$$.fragment,A),M(Xe),M(qn.$$.fragment,A),M(Ul.$$.fragment,A),M(Hl.$$.fragment,A),M(jl.$$.fragment,A),M(Wl.$$.fragment,A),qt=!0)},o(A){I(r.$$.fragment,A),I(R.$$.fragment,A),I(Jl.$$.fragment,A),I(cn.$$.fragment,A),I(gn.$$.fragment,A),I(yn.$$.fragment,A),I(Cn.$$.fragment,A),I(ze),I(Ve),I(Ke),I(Qe),I(Ln.$$.fragment,A),I(Xe),I(qn.$$.fragment,A),I(Ul.$$.fragment,A),I(Hl.$$.fragment,A),I(jl.$$.fragment,A),I(Wl.$$.fragment,A),qt=!1},d(A){A&&y(e),X(r),X(R),Qt(is,A),st&&st.d(),ot&&ot.d(),X(Jl),Qt(ss,A),ut&&ut.d(),rt&&rt.d(),at&&at.d(),X(cn),X(gn),X(yn),ft&&ft.d(),X(Cn),ct&&ct.d(),ze&&ze.d(),Ve&&Ve.d(),Ke&&Ke.d(),Qe&&Qe.d(),X(Ln),Qt(pt,A),Xe&&Xe.d(),X(qn),mt&&mt.d(),A&&y(Es),X(Ul,A),A&&y(Rs),X(Hl,A),A&&y(Fs),X(jl,A),A&&y(Ls),X(Wl,A),Os=!1,Be(br)}}}async function Im(){await(await fetch("/reboot",{method:"POST"})).json()}function Em(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,a=!1,r={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""}};kc.subscribe(qe=>{qe.version&&(l(3,r=qe),l(1,o=!1))}),um();let c=!1,f=!1;async function m(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const qe=new URLSearchParams;qe.append("perform","true");let Pt=await(await fetch("/reset",{method:"POST",body:qe})).json();l(4,c=!1),l(5,f=Pt.success)}}async function _(qe){l(2,a=!0);const tl=new FormData(qe.target),Pt=new URLSearchParams;for(let ml of tl){const[Ue,Xl]=ml;Pt.append(Ue,Xl)}let Ni=await(await fetch("/save",{method:"POST",body:Pt})).json();Tt.update(ml=>(ml.booting=Ni.reboot,ml.ui=r.u,ml)),l(2,a=!1),Bn("/")}const h=function(){confirm("Are you sure you want to reboot the device?")&&(Tt.update(qe=>(qe.booting=!0,qe)),Im())},b=function(){r.q.s.e?r.q.p==1883&&l(3,r.q.p=8883,r):r.q.p==8883&&l(3,r.q.p=1883,r)};let d=44;function g(){r.g.h=this.value,l(3,r)}function w(){r.g.t=tt(this),l(3,r)}function k(){r.p.r=tt(this),l(3,r)}function T(){r.p.c=tt(this),l(3,r)}function P(){r.p.f=ae(this.value),l(3,r)}function E(){r.p.m=ae(this.value),l(3,r)}function S(){r.p.e=this.checked,l(3,r)}function N(){r.p.t=this.value,l(3,r)}function D(){r.g.s=tt(this),l(3,r)}function R(){r.g.u=this.value,l(3,r)}function W(){r.g.p=this.value,l(3,r)}function q(){r.m.b=tt(this),l(3,r)}function F(){r.m.p=tt(this),l(3,r)}function L(){r.m.i=this.checked,l(3,r)}function j(){r.m.d=tt(this),l(3,r)}function U(){r.m.f=ae(this.value),l(3,r)}function O(){r.m.r=ae(this.value),l(3,r)}function G(){r.m.e.e=this.checked,l(3,r)}function H(){r.m.e.k=this.value,l(3,r)}function V(){r.m.e.a=this.value,l(3,r)}function J(){r.m.m.e=this.checked,l(3,r)}function ne(){r.m.m.w=ae(this.value),l(3,r)}function le(){r.m.m.v=ae(this.value),l(3,r)}function me(){r.m.m.a=ae(this.value),l(3,r)}function Pe(){r.m.m.c=ae(this.value),l(3,r)}function we(){r.w.s=this.value,l(3,r)}function Re(){r.w.p=this.value,l(3,r)}function Ce(){r.w.z=tt(this),l(3,r)}function Fe(){r.w.w=ae(this.value),l(3,r)}function _e(){r.w.a=this.checked,l(3,r)}function Me(){r.n.m=tt(this),l(3,r)}function Ie(){r.n.i=this.value,l(3,r)}function ce(){r.n.s=tt(this),l(3,r)}function se(){r.n.g=this.value,l(3,r)}function pe(){r.n.d1=this.value,l(3,r)}function K(){r.n.d2=this.value,l(3,r)}function re(){r.n.d=this.checked,l(3,r)}function Ae(){r.n.h=this.checked,l(3,r)}function Ne(){r.n.n1=this.value,l(3,r)}function de(){r.q.s.e=this.checked,l(3,r)}function ee(){r.q.h=this.value,l(3,r)}function oe(){r.q.p=ae(this.value),l(3,r)}function ve(){r.q.u=this.value,l(3,r)}function De(){r.q.a=this.value,l(3,r)}function Oe(){r.q.c=this.value,l(3,r)}function he(){r.q.m=tt(this),l(3,r)}function be(){r.q.b=this.value,l(3,r)}function x(){r.o.e=this.value,l(3,r)}function ue(){r.o.c=this.value,l(3,r)}function Tl(){r.o.u1=this.value,l(3,r)}function _i(){r.o.u2=this.value,l(3,r)}function di(){r.o.u3=this.value,l(3,r)}function St(){r.h.t=this.value,l(3,r)}function vi(){r.h.h=this.value,l(3,r)}function Kl(){r.h.n=this.value,l(3,r)}function pl(qe){r.t.t[qe]=ae(this.value),l(3,r)}function Zt(){r.t.h=ae(this.value),l(3,r)}function hi(qe){r.u[qe.key]=tt(this),l(3,r)}function bi(){r.i.h.u=this.checked,l(3,r)}function gi(){r.i.h.p=tt(this),l(3,r)}function lt(){r.i.a=ae(this.value),l(3,r)}function ki(){r.i.l.i=this.checked,l(3,r)}function Jt(){r.i.l.p=ae(this.value),l(3,r)}function wi(){r.i.r.i=this.checked,l(3,r)}function yi(){r.i.r.r=ae(this.value),l(3,r)}function $i(){r.i.r.g=ae(this.value),l(3,r)}function nt(){r.i.r.b=ae(this.value),l(3,r)}function Ci(){r.i.t.d=ae(this.value),l(3,r)}function xt(){r.i.t.a=ae(this.value),l(3,r)}function Ql(){r.i.v.p=ae(this.value),l(3,r)}function dt(){r.i.v.d.v=ae(this.value),l(3,r)}function Ti(){r.i.v.d.g=ae(this.value),l(3,r)}function Si(){r.i.v.o=ae(this.value),l(3,r)}function Pi(){r.i.v.m=ae(this.value),l(3,r)}function el(){r.i.v.b=ae(this.value),l(3,r)}function Mi(){r.d.s=this.checked,l(3,r)}function Ai(){r.d.t=this.checked,l(3,r)}function Di(){r.d.l=tt(this),l(3,r)}return t.$$set=qe=>{"sysinfo"in qe&&l(0,n=qe.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,d=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,a,r,c,f,d,i,m,_,h,b,g,w,k,T,P,E,S,N,D,R,W,q,F,L,j,U,O,G,H,V,J,ne,le,me,Pe,we,Re,Ce,Fe,_e,Me,Ie,ce,se,pe,K,re,Ae,Ne,de,ee,oe,ve,De,Oe,he,be,x,ue,Tl,_i,di,St,vi,Kl,pl,Zt,hi,bi,gi,lt,ki,Jt,wi,yi,$i,nt,Ci,xt,Ql,dt,Ti,Si,Pi,el,Mi,Ai,Di]}class Rm extends $e{constructor(e){super(),ye(this,e,Em,Nm,ke,{sysinfo:0},null,[-1,-1,-1,-1])}}function uf(t,e,l){const n=t.slice();return n[20]=e[l],n}function Fm(t){let e=fe(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){$(n,l,i)},p(n,i){i&2&&e!==(e=fe(n[1].chip,n[1].board)+"")&&B(l,e)},d(n){n&&y(l)}}}function rf(t){let e,l,n=t[1].apmac+"",i,o,a,r,c,f,m,_,h,b=Ur(t[1])+"",d,g,w=t[1].boot_reason+"",k,T,P;const E=[Om,Lm],S=[];function N(D,R){return D[0].u>0?0:1}return c=N(t),f=S[c]=E[c](t),{c(){e=p("div"),l=C("AP MAC: "),i=C(n),o=v(),a=p("div"),r=C(`Last boot:
`),f.c(),m=v(),_=p("div"),h=C("Reason: "),d=C(b),g=C(" ("),k=C(w),T=C(")"),u(e,"class","my-2"),u(a,"class","my-2"),u(_,"class","my-2")},m(D,R){$(D,e,R),s(e,l),s(e,i),$(D,o,R),$(D,a,R),s(a,r),S[c].m(a,null),$(D,m,R),$(D,_,R),s(_,h),s(_,d),s(_,g),s(_,k),s(_,T),P=!0},p(D,R){(!P||R&2)&&n!==(n=D[1].apmac+"")&&B(i,n);let W=c;c=N(D),c===W?S[c].p(D,R):(Te(),I(S[W],1,1,()=>{S[W]=null}),Se(),f=S[c],f?f.p(D,R):(f=S[c]=E[c](D),f.c()),M(f,1),f.m(a,null)),(!P||R&2)&&b!==(b=Ur(D[1])+"")&&B(d,b),(!P||R&2)&&w!==(w=D[1].boot_reason+"")&&B(k,w)},i(D){P||(M(f),P=!0)},o(D){I(f),P=!1},d(D){D&&y(e),D&&y(o),D&&y(a),S[c].d(),D&&y(m),D&&y(_)}}}function Lm(t){let e;return{c(){e=C("-")},m(l,n){$(l,e,n)},p:ie,i:ie,o:ie,d(l){l&&y(e)}}}function Om(t){let e,l;return e=new hc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function qm(t){let e;return{c(){e=p("span"),e.textContent="Update consents",u(e,"class","btn-pri-sm")},m(l,n){$(l,e,n)},p:ie,d(l){l&&y(e)}}}function af(t){let e,l,n,i,o,a=hs(t[1].meter.mfg)+"",r,c,f,m,_=t[1].meter.model+"",h,b,d,g,w=t[1].meter.id+"",k;return{c(){e=p("div"),l=p("strong"),l.textContent="Meter",n=v(),i=p("div"),o=C("Manufacturer: "),r=C(a),c=v(),f=p("div"),m=C("Model: "),h=C(_),b=v(),d=p("div"),g=C("ID: "),k=C(w),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(d,"class","my-2"),u(e,"class","cnt")},m(T,P){$(T,e,P),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(e,c),s(e,f),s(f,m),s(f,h),s(e,b),s(e,d),s(d,g),s(d,k)},p(T,P){P&2&&a!==(a=hs(T[1].meter.mfg)+"")&&B(r,a),P&2&&_!==(_=T[1].meter.model+"")&&B(h,_),P&2&&w!==(w=T[1].meter.id+"")&&B(k,w)},d(T){T&&y(e)}}}function ff(t){let e,l,n,i,o,a=t[1].net.ip+"",r,c,f,m,_=t[1].net.mask+"",h,b,d,g,w=t[1].net.gw+"",k,T,P,E,S=t[1].net.dns1+"",N,D,R=t[1].net.dns2&&cf(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Network",n=v(),i=p("div"),o=C("IP: "),r=C(a),c=v(),f=p("div"),m=C("Mask: "),h=C(_),b=v(),d=p("div"),g=C("Gateway: "),k=C(w),T=v(),P=p("div"),E=C("DNS: "),N=C(S),D=v(),R&&R.c(),u(l,"class","text-sm"),u(i,"class","my-2"),u(f,"class","my-2"),u(d,"class","my-2"),u(P,"class","my-2"),u(e,"class","cnt")},m(W,q){$(W,e,q),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(e,c),s(e,f),s(f,m),s(f,h),s(e,b),s(e,d),s(d,g),s(d,k),s(e,T),s(e,P),s(P,E),s(P,N),s(P,D),R&&R.m(P,null)},p(W,q){q&2&&a!==(a=W[1].net.ip+"")&&B(r,a),q&2&&_!==(_=W[1].net.mask+"")&&B(h,_),q&2&&w!==(w=W[1].net.gw+"")&&B(k,w),q&2&&S!==(S=W[1].net.dns1+"")&&B(N,S),W[1].net.dns2?R?R.p(W,q):(R=cf(W),R.c(),R.m(P,null)):R&&(R.d(1),R=null)},d(W){W&&y(e),R&&R.d()}}}function cf(t){let e,l=t[1].net.dns2+"",n;return{c(){e=C("/ "),n=C(l)},m(i,o){$(i,e,o),$(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&B(n,l)},d(i){i&&y(e),i&&y(n)}}}function pf(t){let e,l,n,i=t[1].upgrade.t+"",o,a,r=t[1].version+"",c,f,m=t[1].upgrade.x+"",_,h,b=t[1].upgrade.e+"",d,g;return{c(){e=p("div"),l=p("div"),n=C("Previous upgrade attempt ("),o=C(i),a=C(") does not match current version ("),c=C(r),f=C(") ["),_=C(m),h=C("/"),d=C(b),g=C("]"),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(w,k){$(w,e,k),s(e,l),s(l,n),s(l,o),s(l,a),s(l,c),s(l,f),s(l,_),s(l,h),s(l,d),s(l,g)},p(w,k){k&2&&i!==(i=w[1].upgrade.t+"")&&B(o,i),k&2&&r!==(r=w[1].version+"")&&B(c,r),k&2&&m!==(m=w[1].upgrade.x+"")&&B(_,m),k&2&&b!==(b=w[1].upgrade.e+"")&&B(d,b)},d(w){w&&y(e)}}}function mf(t){let e,l,n,i=t[2].tag_name+"",o,a,r,c,f,m,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name&&_f(t),h=t[1].fwconsent===2&&df();return{c(){e=p("div"),l=C(`Latest version:
`),n=p("a"),o=C(i),r=v(),_&&_.c(),c=v(),h&&h.c(),f=We(),u(n,"href",a=t[2].html_url),u(n,"class","ml-2 text-blue-600 hover:text-blue-800"),u(n,"target","_blank"),u(n,"rel","noreferrer"),u(e,"class","my-2 flex")},m(b,d){$(b,e,d),s(e,l),s(e,n),s(n,o),s(e,r),_&&_.m(e,null),$(b,c,d),h&&h.m(b,d),$(b,f,d),m=!0},p(b,d){(!m||d&4)&&i!==(i=b[2].tag_name+"")&&B(o,i),(!m||d&4&&a!==(a=b[2].html_url))&&u(n,"href",a),(b[1].security==0||b[0].a)&&b[1].fwconsent===1&&b[2]&&b[2].tag_name?_?(_.p(b,d),d&7&&M(_,1)):(_=_f(b),_.c(),M(_,1),_.m(e,null)):_&&(Te(),I(_,1,1,()=>{_=null}),Se()),b[1].fwconsent===2?h||(h=df(),h.c(),h.m(f.parentNode,f)):h&&(h.d(1),h=null)},i(b){m||(M(_),m=!0)},o(b){I(_),m=!1},d(b){b&&y(e),_&&_.d(),b&&y(c),h&&h.d(b),b&&y(f)}}}function _f(t){let e,l,n,i,o,a;return n=new bc({}),{c(){e=p("div"),l=p("button"),Z(n.$$.fragment),u(e,"class","flex-none ml-2 text-green-500"),u(e,"title","Install this version")},m(r,c){$(r,e,c),s(e,l),Q(n,l,null),i=!0,o||(a=z(l,"click",t[10]),o=!0)},p:ie,i(r){i||(M(n.$$.fragment,r),i=!0)},o(r){I(n.$$.fragment,r),i=!1},d(r){r&&y(e),X(n),o=!1,a()}}}function df(t){let e;return{c(){e=p("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){$(l,e,n)},d(l){l&&y(e)}}}function vf(t){let e,l=bs(fe(t[1].chip,t[1].board))+"",n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=bs(fe(i[1].chip,i[1].board))+"")&&B(n,l)},d(i){i&&y(e)}}}function hf(t){let e,l,n,i,o,a;function r(m,_){return m[4].length==0?Hm:Um}let c=r(t),f=c(t);return{c(){e=p("div"),l=p("form"),n=p("input"),i=v(),f.c(),Ef(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(m,_){$(m,e,_),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(a=[z(n,"change",t[13]),z(l,"submit",t[15])],o=!0)},p(m,_){c===(c=r(m))&&f?f.p(m,_):(f.d(1),f=c(m),f&&(f.c(),f.m(l,null)))},d(m){m&&y(e),t[12](null),f.d(),o=!1,Be(a)}}}function Um(t){let e=t[4][0].name+"",l,n,i;return{c(){l=C(e),n=v(),i=p("button"),i.textContent="Upload",u(i,"type","submit"),u(i,"class","btn-pri-sm float-right")},m(o,a){$(o,l,a),$(o,n,a),$(o,i,a)},p(o,a){a&16&&e!==(e=o[4][0].name+"")&&B(l,e)},d(o){o&&y(l),o&&y(n),o&&y(i)}}}function Hm(t){let e,l,n;return{c(){e=p("button"),e.textContent="Select firmware file for upgrade",u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(i,o){$(i,e,o),l||(n=z(e,"click",t[14]),l=!0)},p:ie,d(i){i&&y(e),l=!1,n()}}}function bf(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g=t[9],w=[];for(let S=0;S<g.length;S+=1)w[S]=gf(uf(t,g,S));let k=t[7].length==0&&kf();function T(S,N){return S[7].length==0?Wm:jm}let P=T(t),E=P(t);return{c(){e=p("div"),l=p("strong"),l.textContent="Backup & restore",n=v(),i=p("form"),o=p("div");for(let S=0;S<w.length;S+=1)w[S].c();a=v(),r=p("label"),r.innerHTML='<input type="checkbox" class="rounded" name="ic" value="true"/> Include Secrets<br/><small>(SSID, PSK, passwords and tokens)</small>',c=v(),k&&k.c(),f=v(),m=p("form"),_=p("input"),h=v(),E.c(),u(l,"class","text-sm"),u(r,"class","my-1 mx-3 col-span-2"),u(o,"class","grid grid-cols-2"),u(i,"method","get"),u(i,"action","/configfile.cfg"),u(i,"autocomplete","off"),Ef(_,"display","none"),u(_,"name","file"),u(_,"type","file"),u(_,"accept",".cfg"),u(m,"action","/configfile"),u(m,"enctype","multipart/form-data"),u(m,"method","post"),u(m,"autocomplete","off"),u(e,"class","cnt")},m(S,N){$(S,e,N),s(e,l),s(e,n),s(e,i),s(i,o);for(let D=0;D<w.length;D+=1)w[D].m(o,null);s(o,a),s(o,r),s(i,c),k&&k.m(i,null),s(e,f),s(e,m),s(m,_),t[16](_),s(m,h),E.m(m,null),b||(d=[z(_,"change",t[17]),z(m,"submit",t[19])],b=!0)},p(S,N){if(N&512){g=S[9];let D;for(D=0;D<g.length;D+=1){const R=uf(S,g,D);w[D]?w[D].p(R,N):(w[D]=gf(R),w[D].c(),w[D].m(o,a))}for(;D<w.length;D+=1)w[D].d(1);w.length=g.length}S[7].length==0?k||(k=kf(),k.c(),k.m(i,null)):k&&(k.d(1),k=null),P===(P=T(S))&&E?E.p(S,N):(E.d(1),E=P(S),E&&(E.c(),E.m(m,null)))},d(S){S&&y(e),Qt(w,S),k&&k.d(),t[16](null),E.d(),b=!1,Be(d)}}}function gf(t){let e,l,n,i=t[20].name+"",o;return{c(){e=p("label"),l=p("input"),n=v(),o=C(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(a,r){$(a,e,r),s(e,l),s(e,n),s(e,o)},p:ie,d(a){a&&y(e)}}}function kf(t){let e;return{c(){e=p("button"),e.textContent="Download",u(e,"type","submit"),u(e,"class","btn-pri-sm float-right")},m(l,n){$(l,e,n)},d(l){l&&y(e)}}}function jm(t){let e=t[7][0].name+"",l,n,i;return{c(){l=C(e),n=v(),i=p("button"),i.textContent="Upload",u(i,"type","submit"),u(i,"class","btn-pri-sm")},m(o,a){$(o,l,a),$(o,n,a),$(o,i,a)},p(o,a){a&128&&e!==(e=o[7][0].name+"")&&B(l,e)},d(o){o&&y(l),o&&y(n),o&&y(i)}}}function Wm(t){let e,l,n;return{c(){e=p("button"),e.textContent="Select file...",u(e,"type","button"),u(e,"class","btn-pri-sm")},m(i,o){$(i,e,o),l||(n=z(e,"click",t[18]),l=!0)},p:ie,d(i){i&&y(e),l=!1,n()}}}function Gm(t){let e,l,n,i,o,a,r=t[1].chip+"",c,f,m,_,h,b,d,g,w=t[1].mac+"",k,T,P,E,S,N,D,R,W,q,F,L,j,U,O,G=t[1].version+"",H,V,J,ne,le=(t[1].security==0||t[0].a)&&Yn(t[1].board),me,Pe,we,Re,Ce,Fe,_e,Me,Ie;h=new wl({props:{to:"/vendor",$$slots:{default:[Fm]},$$scope:{ctx:t}}});let ce=t[1].apmac&&t[1].apmac!=t[1].mac&&rf(t);S=new wl({props:{to:"/consent",$$slots:{default:[qm]},$$scope:{ctx:t}}});let se=t[1].meter&&af(t),pe=t[1].net&&ff(t),K=t[1].upgrade.t&&t[1].upgrade.t!=t[1].version&&pf(t),re=t[2]&&mf(t),Ae=le&&vf(t),Ne=(t[1].security==0||t[0].a)&&hf(t),de=(t[1].security==0||t[0].a)&&bf(t);return Re=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=p("div"),l=p("div"),n=p("strong"),n.textContent="Device information",i=v(),o=p("div"),a=C("Chip: "),c=C(r),f=v(),m=p("div"),_=C("Device: "),Z(h.$$.fragment),b=v(),d=p("div"),g=C("MAC: "),k=C(w),T=v(),ce&&ce.c(),P=v(),E=p("div"),Z(S.$$.fragment),N=v(),D=p("button"),D.textContent="Reboot",R=v(),se&&se.c(),W=v(),pe&&pe.c(),q=v(),F=p("div"),L=p("strong"),L.textContent="Firmware",j=v(),U=p("div"),O=C("Installed version: "),H=C(G),V=v(),K&&K.c(),J=v(),re&&re.c(),ne=v(),Ae&&Ae.c(),me=v(),Ne&&Ne.c(),Pe=v(),de&&de.c(),we=v(),Z(Re.$$.fragment),Ce=v(),Z(Fe.$$.fragment),u(n,"class","text-sm"),u(o,"class","my-2"),u(m,"class","my-2"),u(d,"class","my-2"),u(D,"class","text-xs py-1 px-2 rounded bg-yellow-500 text-white mr-3 float-right"),u(E,"class","my-2"),u(l,"class","cnt"),u(L,"class","text-sm"),u(U,"class","my-2"),u(F,"class","cnt"),u(e,"class","grid xl:grid-cols-5 lg:grid-cols-3 md:grid-cols-2")},m(ee,oe){$(ee,e,oe),s(e,l),s(l,n),s(l,i),s(l,o),s(o,a),s(o,c),s(l,f),s(l,m),s(m,_),Q(h,m,null),s(l,b),s(l,d),s(d,g),s(d,k),s(l,T),ce&&ce.m(l,null),s(l,P),s(l,E),Q(S,E,null),s(E,N),s(E,D),s(e,R),se&&se.m(e,null),s(e,W),pe&&pe.m(e,null),s(e,q),s(e,F),s(F,L),s(F,j),s(F,U),s(U,O),s(U,H),s(F,V),K&&K.m(F,null),s(F,J),re&&re.m(F,null),s(F,ne),Ae&&Ae.m(F,null),s(F,me),Ne&&Ne.m(F,null),s(e,Pe),de&&de.m(e,null),$(ee,we,oe),Q(Re,ee,oe),$(ee,Ce,oe),Q(Fe,ee,oe),_e=!0,Me||(Ie=z(D,"click",t[11]),Me=!0)},p(ee,[oe]){(!_e||oe&2)&&r!==(r=ee[1].chip+"")&&B(c,r);const ve={};oe&8388610&&(ve.$$scope={dirty:oe,ctx:ee}),h.$set(ve),(!_e||oe&2)&&w!==(w=ee[1].mac+"")&&B(k,w),ee[1].apmac&&ee[1].apmac!=ee[1].mac?ce?(ce.p(ee,oe),oe&2&&M(ce,1)):(ce=rf(ee),ce.c(),M(ce,1),ce.m(l,P)):ce&&(Te(),I(ce,1,1,()=>{ce=null}),Se());const De={};oe&8388608&&(De.$$scope={dirty:oe,ctx:ee}),S.$set(De),ee[1].meter?se?se.p(ee,oe):(se=af(ee),se.c(),se.m(e,W)):se&&(se.d(1),se=null),ee[1].net?pe?pe.p(ee,oe):(pe=ff(ee),pe.c(),pe.m(e,q)):pe&&(pe.d(1),pe=null),(!_e||oe&2)&&G!==(G=ee[1].version+"")&&B(H,G),ee[1].upgrade.t&&ee[1].upgrade.t!=ee[1].version?K?K.p(ee,oe):(K=pf(ee),K.c(),K.m(F,J)):K&&(K.d(1),K=null),ee[2]?re?(re.p(ee,oe),oe&4&&M(re,1)):(re=mf(ee),re.c(),M(re,1),re.m(F,ne)):re&&(Te(),I(re,1,1,()=>{re=null}),Se()),oe&3&&(le=(ee[1].security==0||ee[0].a)&&Yn(ee[1].board)),le?Ae?Ae.p(ee,oe):(Ae=vf(ee),Ae.c(),Ae.m(F,me)):Ae&&(Ae.d(1),Ae=null),ee[1].security==0||ee[0].a?Ne?Ne.p(ee,oe):(Ne=hf(ee),Ne.c(),Ne.m(F,null)):Ne&&(Ne.d(1),Ne=null),ee[1].security==0||ee[0].a?de?de.p(ee,oe):(de=bf(ee),de.c(),de.m(e,null)):de&&(de.d(1),de=null);const Oe={};oe&32&&(Oe.active=ee[5]),Re.$set(Oe);const he={};oe&256&&(he.active=ee[8]),Fe.$set(he)},i(ee){_e||(M(h.$$.fragment,ee),M(ce),M(S.$$.fragment,ee),M(re),M(Re.$$.fragment,ee),M(Fe.$$.fragment,ee),_e=!0)},o(ee){I(h.$$.fragment,ee),I(ce),I(S.$$.fragment,ee),I(re),I(Re.$$.fragment,ee),I(Fe.$$.fragment,ee),_e=!1},d(ee){ee&&y(e),X(h),ce&&ce.d(),X(S),se&&se.d(),pe&&pe.d(),K&&K.d(),re&&re.d(),Ae&&Ae.d(),Ne&&Ne.d(),de&&de.d(),ee&&y(we),X(Re,ee),ee&&y(Ce),X(Fe,ee),Me=!1,Ie()}}}async function Bm(){await(await fetch("/reboot",{method:"POST"})).json()}function Ym(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:"NTP",key:"in"},{name:"Price API",key:"is"}],a={};_o.subscribe(D=>{l(2,a=vc(i.version,D)),a||l(2,a=D[0])});function r(){confirm("Do you want to upgrade this device to "+a.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(bs(fe(i.chip,i.board))))&&(Tt.update(D=>(D.upgrading=!0,D)),dc(a))}const c=function(){confirm("Are you sure you want to reboot the device?")&&(Tt.update(D=>(D.booting=!0,D)),Bm())};let f,m=[],_=!1,h,b=[],d=!1;co();function g(D){ds[D?"unshift":"push"](()=>{f=D,l(3,f)})}function w(){m=this.files,l(4,m)}const k=()=>{f.click()},T=()=>l(5,_=!0);function P(D){ds[D?"unshift":"push"](()=>{h=D,l(6,h)})}function E(){b=this.files,l(7,b)}const S=()=>{h.click()},N=()=>l(8,d=!0);return t.$$set=D=>{"data"in D&&l(0,n=D.data),"sysinfo"in D&&l(1,i=D.sysinfo)},[n,i,a,f,m,_,h,b,d,o,r,c,g,w,k,T,P,E,S,N]}class zm extends $e{constructor(e){super(),ye(this,e,Ym,Gm,ke,{data:0,sysinfo:1})}}function wf(t){let e,l,n=fe(t[0],7)+"",i,o,a=fe(t[0],5)+"",r,c,f=fe(t[0],4)+"",m,_,h=fe(t[0],3)+"",b,d,g,w,k=fe(t[0],2)+"",T,P,E=fe(t[0],1)+"",S,N,D=fe(t[0],0)+"",R,W,q,F,L=fe(t[0],101)+"",j,U,O=fe(t[0],100)+"",G;return{c(){e=p("optgroup"),l=p("option"),i=C(n),o=p("option"),r=C(a),c=p("option"),m=C(f),_=p("option"),b=C(h),d=v(),g=p("optgroup"),w=p("option"),T=C(k),P=p("option"),S=C(E),N=p("option"),R=C(D),W=v(),q=p("optgroup"),F=p("option"),j=C(L),U=p("option"),G=C(O),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,_.__value=3,_.value=_.__value,u(e,"label","amsleser.no"),w.__value=2,w.value=w.__value,P.__value=1,P.value=P.__value,N.__value=0,N.value=N.__value,u(g,"label","Custom hardware"),F.__value=101,F.value=F.__value,U.__value=100,U.value=U.__value,u(q,"label","Generic hardware")},m(H,V){$(H,e,V),s(e,l),s(l,i),s(e,o),s(o,r),s(e,c),s(c,m),s(e,_),s(_,b),$(H,d,V),$(H,g,V),s(g,w),s(w,T),s(g,P),s(P,S),s(g,N),s(N,R),$(H,W,V),$(H,q,V),s(q,F),s(F,j),s(q,U),s(U,G)},p(H,V){V&1&&n!==(n=fe(H[0],7)+"")&&B(i,n),V&1&&a!==(a=fe(H[0],5)+"")&&B(r,a),V&1&&f!==(f=fe(H[0],4)+"")&&B(m,f),V&1&&h!==(h=fe(H[0],3)+"")&&B(b,h),V&1&&k!==(k=fe(H[0],2)+"")&&B(T,k),V&1&&E!==(E=fe(H[0],1)+"")&&B(S,E),V&1&&D!==(D=fe(H[0],0)+"")&&B(R,D),V&1&&L!==(L=fe(H[0],101)+"")&&B(j,L),V&1&&O!==(O=fe(H[0],100)+"")&&B(G,O)},d(H){H&&y(e),H&&y(d),H&&y(g),H&&y(W),H&&y(q)}}}function yf(t){let e,l,n=fe(t[0],201)+"",i,o,a=fe(t[0],202)+"",r,c,f=fe(t[0],203)+"",m,_,h=fe(t[0],200)+"",b;return{c(){e=p("optgroup"),l=p("option"),i=C(n),o=p("option"),r=C(a),c=p("option"),m=C(f),_=p("option"),b=C(h),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,_.__value=200,_.value=_.__value,u(e,"label","Generic hardware")},m(d,g){$(d,e,g),s(e,l),s(l,i),s(e,o),s(o,r),s(e,c),s(c,m),s(e,_),s(_,b)},p(d,g){g&1&&n!==(n=fe(d[0],201)+"")&&B(i,n),g&1&&a!==(a=fe(d[0],202)+"")&&B(r,a),g&1&&f!==(f=fe(d[0],203)+"")&&B(m,f),g&1&&h!==(h=fe(d[0],200)+"")&&B(b,h)},d(d){d&&y(e)}}}function $f(t){let e,l,n=fe(t[0],7)+"",i,o,a=fe(t[0],6)+"",r,c,f=fe(t[0],5)+"",m,_,h,b,d=fe(t[0],51)+"",g,w,k=fe(t[0],50)+"",T;return{c(){e=p("optgroup"),l=p("option"),i=C(n),o=p("option"),r=C(a),c=p("option"),m=C(f),_=v(),h=p("optgroup"),b=p("option"),g=C(d),w=p("option"),T=C(k),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,u(e,"label","amsleser.no"),b.__value=51,b.value=b.__value,w.__value=50,w.value=w.__value,u(h,"label","Generic hardware")},m(P,E){$(P,e,E),s(e,l),s(l,i),s(e,o),s(o,r),s(e,c),s(c,m),$(P,_,E),$(P,h,E),s(h,b),s(b,g),s(h,w),s(w,T)},p(P,E){E&1&&n!==(n=fe(P[0],7)+"")&&B(i,n),E&1&&a!==(a=fe(P[0],6)+"")&&B(r,a),E&1&&f!==(f=fe(P[0],5)+"")&&B(m,f),E&1&&d!==(d=fe(P[0],51)+"")&&B(g,d),E&1&&k!==(k=fe(P[0],50)+"")&&B(T,k)},d(P){P&&y(e),P&&y(_),P&&y(h)}}}function Cf(t){let e,l,n=fe(t[0],8)+"",i,o,a,r,c=fe(t[0],71)+"",f,m,_=fe(t[0],70)+"",h;return{c(){e=p("optgroup"),l=p("option"),i=C(n),o=v(),a=p("optgroup"),r=p("option"),f=C(c),m=p("option"),h=C(_),l.__value=8,l.value=l.__value,u(e,"label","Custom hardware"),r.__value=71,r.value=r.__value,m.__value=70,m.value=m.__value,u(a,"label","Generic hardware")},m(b,d){$(b,e,d),s(e,l),s(l,i),$(b,o,d),$(b,a,d),s(a,r),s(r,f),s(a,m),s(m,h)},p(b,d){d&1&&n!==(n=fe(b[0],8)+"")&&B(i,n),d&1&&c!==(c=fe(b[0],71)+"")&&B(f,c),d&1&&_!==(_=fe(b[0],70)+"")&&B(h,_)},d(b){b&&y(e),b&&y(o),b&&y(a)}}}function Tf(t){let e,l,n=fe(t[0],200)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=200,l.value=l.__value,u(e,"label","Generic hardware")},m(o,a){$(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=fe(o[0],200)+"")&&B(i,n)},d(o){o&&y(e)}}}function Vm(t){let e,l,n,i,o,a,r,c=t[0]=="esp8266"&&wf(t),f=t[0]=="esp32"&&yf(t),m=t[0]=="esp32s2"&&$f(t),_=t[0]=="esp32c3"&&Cf(t),h=t[0]=="esp32solo"&&Tf(t);return{c(){e=p("option"),l=v(),c&&c.c(),n=v(),f&&f.c(),i=v(),m&&m.c(),o=v(),_&&_.c(),a=v(),h&&h.c(),r=We(),e.__value=-1,e.value=e.__value},m(b,d){$(b,e,d),$(b,l,d),c&&c.m(b,d),$(b,n,d),f&&f.m(b,d),$(b,i,d),m&&m.m(b,d),$(b,o,d),_&&_.m(b,d),$(b,a,d),h&&h.m(b,d),$(b,r,d)},p(b,[d]){b[0]=="esp8266"?c?c.p(b,d):(c=wf(b),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),b[0]=="esp32"?f?f.p(b,d):(f=yf(b),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),b[0]=="esp32s2"?m?m.p(b,d):(m=$f(b),m.c(),m.m(o.parentNode,o)):m&&(m.d(1),m=null),b[0]=="esp32c3"?_?_.p(b,d):(_=Cf(b),_.c(),_.m(a.parentNode,a)):_&&(_.d(1),_=null),b[0]=="esp32solo"?h?h.p(b,d):(h=Tf(b),h.c(),h.m(r.parentNode,r)):h&&(h.d(1),h=null)},i:ie,o:ie,d(b){b&&y(e),b&&y(l),c&&c.d(b),b&&y(n),f&&f.d(b),b&&y(i),m&&m.d(b),b&&y(o),_&&_.d(b),b&&y(a),h&&h.d(b),b&&y(r)}}}function Km(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Qm extends $e{constructor(e){super(),ye(this,e,Km,Vm,ke,{chip:0})}}function Sf(t){let e;return{c(){e=p("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){$(l,e,n)},d(l){l&&y(e)}}}function Pf(t){let e,l,n,i,o,a,r;return a=new wc({props:{chip:t[0].chip}}),{c(){e=p("div"),l=C("HAN GPIO"),n=p("br"),i=v(),o=p("select"),Z(a.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(e,"class","my-3")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),Q(a,o,null),r=!0},p(c,f){const m={};f&1&&(m.chip=c[0].chip),a.$set(m)},i(c){r||(M(a.$$.fragment,c),r=!0)},o(c){I(a.$$.fragment,c),r=!1},d(c){c&&y(e),X(a)}}}function Xm(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w,k,T,P,E,S,N,D,R,W,q,F,L,j,U=t[0].usrcfg&&Sf();d=new Qm({props:{chip:t[0].chip}});let O=t[0].board&&t[0].board>20&&Pf(t);return q=new gt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),o=v(),a=p("strong"),a.textContent="Initial configuration",r=v(),U&&U.c(),c=v(),f=p("div"),m=C("Board type"),_=p("br"),h=v(),b=p("select"),Z(d.$$.fragment),g=v(),O&&O.c(),w=v(),k=p("div"),T=p("label"),P=p("input"),E=C(" Clear all other configuration"),S=v(),N=p("div"),N.innerHTML='<button type="submit" class="btn-pri">Save</button>',D=v(),R=p("span"),R.textContent="\xA0",W=v(),Z(q.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(a,"class","text-sm"),u(b,"name","vb"),u(b,"class","in-s"),t[0].board===void 0&&Ye(()=>t[4].call(b)),u(f,"class","my-3"),u(P,"type","checkbox"),u(P,"name","vr"),P.__value="true",P.value=P.__value,u(P,"class","rounded mb-1"),u(k,"class","my-3"),u(N,"class","my-3"),u(R,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(G,H){$(G,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),U&&U.m(n,null),s(n,c),s(n,f),s(f,m),s(f,_),s(f,h),s(f,b),Q(d,b,null),Le(b,t[0].board),s(n,g),O&&O.m(n,null),s(n,w),s(n,k),s(k,T),s(T,P),P.checked=t[2],s(T,E),s(n,S),s(n,N),s(n,D),s(n,R),$(G,W,H),Q(q,G,H),F=!0,L||(j=[z(b,"change",t[4]),z(P,"change",t[5]),z(n,"submit",gs(t[3]))],L=!0)},p(G,[H]){G[0].usrcfg?U||(U=Sf(),U.c(),U.m(n,c)):U&&(U.d(1),U=null);const V={};H&1&&(V.chip=G[0].chip),d.$set(V),H&1&&Le(b,G[0].board),G[0].board&&G[0].board>20?O?(O.p(G,H),H&1&&M(O,1)):(O=Pf(G),O.c(),M(O,1),O.m(n,w)):O&&(Te(),I(O,1,1,()=>{O=null}),Se()),H&4&&(P.checked=G[2]);const J={};H&2&&(J.active=G[1]),q.$set(J)},i(G){F||(M(d.$$.fragment,G),M(O),M(q.$$.fragment,G),F=!0)},o(G){I(d.$$.fragment,G),I(O),I(q.$$.fragment,G),F=!1},d(G){G&&y(e),U&&U.d(),X(d),O&&O.d(),G&&y(W),X(q,G),L=!1,Be(j)}}}function Zm(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(f){l(1,i=!0);const m=new FormData(f.target),_=new URLSearchParams;for(let d of m){const[g,w]=d;_.append(g,w)}let b=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),Tt.update(d=>(d.vndcfg=b.success,d.booting=b.reboot,d)),Bn(n.usrcfg?"/":"/setup")}let a=!1;function r(){n.board=tt(this),l(0,n)}function c(){a=this.checked,l(2,a),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,a=!n.usrcfg)},[n,i,a,o,r,c]}class Jm extends $e{constructor(e){super(),ye(this,e,Zm,Xm,ke,{sysinfo:0})}}function Mf(t){let e,l,n,i,o,a,r,c;return r=new yc({}),{c(){e=p("br"),l=v(),n=p("div"),i=p("input"),o=v(),a=p("select"),Z(r.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=t[1],u(a,"name","su"),u(a,"class","in-l"),a.required=t[1],u(n,"class","flex")},m(f,m){$(f,e,m),$(f,l,m),$(f,n,m),s(n,i),s(n,o),s(n,a),Q(r,a,null),c=!0},p(f,m){(!c||m&2)&&(i.required=f[1]),(!c||m&2)&&(a.required=f[1])},i(f){c||(M(r.$$.fragment,f),c=!0)},o(f){I(r.$$.fragment,f),c=!1},d(f){f&&y(e),f&&y(l),f&&y(n),X(r)}}}function Af(t){let e;return{c(){e=p("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){$(l,e,n)},d(l){l&&y(e)}}}function xm(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w,k,T,P,E,S,N,D,R,W,q,F,L,j=t[1]&&Mf(t),U=t[1]&&Af();return W=new gt({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),o=v(),a=p("strong"),a.textContent="Setup",r=v(),c=p("div"),c.innerHTML=`SSID<br/>
<input name="ss" type="text" class="in-s" required=""/>`,f=v(),m=p("div"),m.innerHTML=`PSK<br/>
<input name="sp" type="password" class="in-s" autocomplete="off"/>`,_=v(),h=p("div"),b=C(`Hostname
`),d=p("input"),g=v(),w=p("div"),k=p("label"),T=p("input"),P=C(" Static IP"),E=v(),j&&j.c(),S=v(),U&&U.c(),N=v(),D=p("div"),D.innerHTML='<button type="submit" class="btn-pri">Save</button>',R=v(),Z(W.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(a,"class","text-sm"),u(c,"class","my-3"),u(m,"class","my-3"),u(d,"name","sh"),u(d,"type","text"),u(d,"class","in-s"),u(d,"maxlength","32"),u(d,"pattern","[a-z0-9_-]+"),u(d,"placeholder","Optional, ex.: ams-reader"),u(d,"autocomplete","off"),u(T,"type","checkbox"),u(T,"name","sm"),T.__value="static",T.value=T.__value,u(T,"class","rounded mb-1"),u(w,"class","my-3"),u(D,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(O,G){$(O,e,G),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),s(n,c),s(n,f),s(n,m),s(n,_),s(n,h),s(h,b),s(h,d),Y(d,t[0].hostname),s(n,g),s(n,w),s(w,k),s(k,T),T.checked=t[1],s(k,P),s(w,E),j&&j.m(w,null),s(n,S),U&&U.m(n,null),s(n,N),s(n,D),$(O,R,G),Q(W,O,G),q=!0,F||(L=[z(d,"input",t[4]),z(T,"change",t[5]),z(n,"submit",gs(t[3]))],F=!0)},p(O,[G]){G&1&&d.value!==O[0].hostname&&Y(d,O[0].hostname),G&2&&(T.checked=O[1]),O[1]?j?(j.p(O,G),G&2&&M(j,1)):(j=Mf(O),j.c(),M(j,1),j.m(w,null)):j&&(Te(),I(j,1,1,()=>{j=null}),Se()),O[1]?U||(U=Af(),U.c(),U.m(n,N)):U&&(U.d(1),U=null);const H={};G&4&&(H.active=O[2]),W.$set(H)},i(O){q||(M(j),M(W.$$.fragment,O),q=!0)},o(O){I(j),I(W.$$.fragment,O),q=!1},d(O){O&&y(e),j&&j.d(),U&&U.d(),O&&y(R),X(W,O),F=!1,Be(L)}}}function e0(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,a=0;function r(){var _="";a++;var h=function(){setTimeout(r,1e3)};if(n.net.ip&&a%3==0){if(!n.net.ip){h();return}_="http://"+n.net.ip}else n.hostname&&a%3==1?_="http://"+n.hostname:n.hostname&&a%3==2?_="http://"+n.hostname+".local":_="";console&&console.log("Trying url "+_),Tt.update(d=>(d.trying=_,d));var b=new XMLHttpRequest;b.timeout=5e3,b.addEventListener("abort",h),b.addEventListener("error",h),b.addEventListener("timeout",h),b.addEventListener("load",function(d){window.location.href=_||"/"}),b.open("GET",_+"/is-alive",!0),b.send()}async function c(_){l(2,o=!0);const h=new FormData(_.target),b=new URLSearchParams;for(let w of h){const[k,T]=w;b.append(k,T)}let g=await(await fetch("/save",{method:"POST",body:b})).json();l(2,o=!1),Tt.update(w=>(w.hostname=h.get("sh"),w.usrcfg=g.success,w.booting=g.reboot,i&&(w.net.ip=h.get("si"),w.net.mask=h.get("su"),w.net.gw=h.get("sg"),w.net.dns1=h.get("sd")),setTimeout(r,5e3),w))}function f(){n.hostname=this.value,l(0,n)}function m(){i=this.checked,l(1,i)}return t.$$set=_=>{"sysinfo"in _&&l(0,n=_.sysinfo)},[n,i,o,c,f,m]}class t0 extends $e{constructor(e){super(),ye(this,e,e0,xm,ke,{sysinfo:0})}}function l0(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w,k;return d=new gt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=p("div"),l=p("div"),n=p("strong"),i=C("Upload "),o=C(t[1]),a=v(),r=p("p"),r.textContent="Select a suitable file and click upload",c=v(),f=p("form"),m=p("input"),_=v(),h=p("div"),h.innerHTML='<button type="submit" class="btn-pri">Upload</button>',b=v(),Z(d.$$.fragment),u(r,"class","mb-4"),u(m,"name","file"),u(m,"type","file"),u(h,"class","w-full text-right mt-4"),u(f,"action",t[0]),u(f,"enctype","multipart/form-data"),u(f,"method","post"),u(f,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(T,P){$(T,e,P),s(e,l),s(l,n),s(n,i),s(n,o),s(l,a),s(l,r),s(l,c),s(l,f),s(f,m),s(f,_),s(f,h),$(T,b,P),Q(d,T,P),g=!0,w||(k=z(f,"submit",t[3]),w=!0)},p(T,[P]){(!g||P&2)&&B(o,T[1]),(!g||P&1)&&u(f,"action",T[0]);const E={};P&4&&(E.active=T[2]),d.$set(E)},i(T){g||(M(d.$$.fragment,T),g=!0)},o(T){I(d.$$.fragment,T),g=!1},d(T){T&&y(e),T&&y(b),X(d,T),w=!1,k()}}}function n0(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const a=()=>l(2,o=!0);return t.$$set=r=>{"action"in r&&l(0,n=r.action),"title"in r&&l(1,i=r.title)},[n,i,o,a]}class vo extends $e{constructor(e){super(),ye(this,e,n0,l0,ke,{action:0,title:1})}}function i0(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w,k,T,P,E,S,N,D,R,W,q,F,L,j,U,O;return L=new gt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("div"),i.textContent="Various permissions we need to do stuff:",o=v(),a=p("hr"),r=v(),c=p("div"),f=C("Enable one-click upgrade? (implies data collection)"),m=p("br"),_=v(),h=p("a"),b=C("Read more"),d=p("br"),g=v(),w=p("label"),k=p("input"),P=C(" Yes"),E=p("label"),S=p("input"),D=C(" No"),R=p("br"),W=v(),q=p("div"),q.innerHTML='<button type="submit" class="btn-pri">Save</button>',F=v(),Z(L.$$.fragment),u(h,"href",Ct("Data-collection-on-one-click-firmware-upgrade")),u(h,"target","_blank"),u(h,"class","text-blue-600 hover:text-blue-800"),u(k,"type","radio"),u(k,"name","sf"),k.value=1,k.checked=T=t[0].fwconsent===1,u(k,"class","rounded m-2"),k.required=!0,u(S,"type","radio"),u(S,"name","sf"),S.value=2,S.checked=N=t[0].fwconsent===2,u(S,"class","rounded m-2"),S.required=!0,u(c,"class","my-3"),u(q,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(G,H){$(G,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),s(n,c),s(c,f),s(c,m),s(c,_),s(c,h),s(h,b),s(c,d),s(c,g),s(c,w),s(w,k),s(w,P),s(c,E),s(E,S),s(E,D),s(c,R),s(n,W),s(n,q),$(G,F,H),Q(L,G,H),j=!0,U||(O=z(n,"submit",gs(t[2])),U=!0)},p(G,[H]){(!j||H&1&&T!==(T=G[0].fwconsent===1))&&(k.checked=T),(!j||H&1&&N!==(N=G[0].fwconsent===2))&&(S.checked=N);const V={};H&2&&(V.active=G[1]),L.$set(V)},i(G){j||(M(L.$$.fragment,G),j=!0)},o(G){I(L.$$.fragment,G),j=!1},d(G){G&&y(e),G&&y(F),X(L,G),U=!1,O()}}}function s0(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(a){l(1,i=!0);const r=new FormData(a.target),c=new URLSearchParams;for(let _ of r){const[h,b]=_;c.append(h,b)}let m=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),Tt.update(_=>(_.fwconsent=r.sf===!0?1:r.sf===!1?2:0,_.booting=m.reboot,_)),Bn("/")}return t.$$set=a=>{"sysinfo"in a&&l(0,n=a.sysinfo)},[n,i,o]}class o0 extends $e{constructor(e){super(),ye(this,e,s0,i0,ke,{sysinfo:0})}}function u0(t){let e,l;return e=new om({props:{data:t[1],sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function r0(t){let e,l;return e=new Rm({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function a0(t){let e,l;return e=new zm({props:{sysinfo:t[0],data:t[1]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function f0(t){let e,l;return e=new vo({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function c0(t){let e,l;return e=new vo({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function p0(t){let e,l;return e=new vo({props:{title:"private key",action:"/mqtt-key"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function m0(t){let e,l;return e=new o0({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function _0(t){let e,l;return e=new t0({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function d0(t){let e,l;return e=new Jm({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function v0(t){let e,l,n,i,o,a,r,c,f,m,_,h,b,d,g,w,k,T,P,E;return e=new kp({props:{data:t[1]}}),n=new fl({props:{path:"/",$$slots:{default:[u0]},$$scope:{ctx:t}}}),o=new fl({props:{path:"/configuration",$$slots:{default:[r0]},$$scope:{ctx:t}}}),r=new fl({props:{path:"/status",$$slots:{default:[a0]},$$scope:{ctx:t}}}),f=new fl({props:{path:"/mqtt-ca",$$slots:{default:[f0]},$$scope:{ctx:t}}}),_=new fl({props:{path:"/mqtt-cert",$$slots:{default:[c0]},$$scope:{ctx:t}}}),b=new fl({props:{path:"/mqtt-key",$$slots:{default:[p0]},$$scope:{ctx:t}}}),g=new fl({props:{path:"/consent",$$slots:{default:[m0]},$$scope:{ctx:t}}}),k=new fl({props:{path:"/setup",$$slots:{default:[_0]},$$scope:{ctx:t}}}),P=new fl({props:{path:"/vendor",$$slots:{default:[d0]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment),l=v(),Z(n.$$.fragment),i=v(),Z(o.$$.fragment),a=v(),Z(r.$$.fragment),c=v(),Z(f.$$.fragment),m=v(),Z(_.$$.fragment),h=v(),Z(b.$$.fragment),d=v(),Z(g.$$.fragment),w=v(),Z(k.$$.fragment),T=v(),Z(P.$$.fragment)},m(S,N){Q(e,S,N),$(S,l,N),Q(n,S,N),$(S,i,N),Q(o,S,N),$(S,a,N),Q(r,S,N),$(S,c,N),Q(f,S,N),$(S,m,N),Q(_,S,N),$(S,h,N),Q(b,S,N),$(S,d,N),Q(g,S,N),$(S,w,N),Q(k,S,N),$(S,T,N),Q(P,S,N),E=!0},p(S,N){const D={};N&2&&(D.data=S[1]),e.$set(D);const R={};N&7&&(R.$$scope={dirty:N,ctx:S}),n.$set(R);const W={};N&5&&(W.$$scope={dirty:N,ctx:S}),o.$set(W);const q={};N&7&&(q.$$scope={dirty:N,ctx:S}),r.$set(q);const F={};N&4&&(F.$$scope={dirty:N,ctx:S}),f.$set(F);const L={};N&4&&(L.$$scope={dirty:N,ctx:S}),_.$set(L);const j={};N&4&&(j.$$scope={dirty:N,ctx:S}),b.$set(j);const U={};N&5&&(U.$$scope={dirty:N,ctx:S}),g.$set(U);const O={};N&5&&(O.$$scope={dirty:N,ctx:S}),k.$set(O);const G={};N&5&&(G.$$scope={dirty:N,ctx:S}),P.$set(G)},i(S){E||(M(e.$$.fragment,S),M(n.$$.fragment,S),M(o.$$.fragment,S),M(r.$$.fragment,S),M(f.$$.fragment,S),M(_.$$.fragment,S),M(b.$$.fragment,S),M(g.$$.fragment,S),M(k.$$.fragment,S),M(P.$$.fragment,S),E=!0)},o(S){I(e.$$.fragment,S),I(n.$$.fragment,S),I(o.$$.fragment,S),I(r.$$.fragment,S),I(f.$$.fragment,S),I(_.$$.fragment,S),I(b.$$.fragment,S),I(g.$$.fragment,S),I(k.$$.fragment,S),I(P.$$.fragment,S),E=!1},d(S){X(e,S),S&&y(l),X(n,S),S&&y(i),X(o,S),S&&y(a),X(r,S),S&&y(c),X(f,S),S&&y(m),X(_,S),S&&y(h),X(b,S),S&&y(d),X(g,S),S&&y(w),X(k,S),S&&y(T),X(P,S)}}}function h0(t){let e,l,n,i;const o=[k0,g0],a=[];function r(c,f){return c[0].trying?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=We()},m(c,f){a[e].m(c,f),$(c,n,f),i=!0},p(c,f){let m=e;e=r(c),e===m?a[e].p(c,f):(Te(),I(a[m],1,1,()=>{a[m]=null}),Se(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),M(l,1),l.m(n.parentNode,n))},i(c){i||(M(l),i=!0)},o(c){I(l),i=!1},d(c){a[e].d(c),c&&y(n)}}}function b0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function g0(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ie,i(n){l||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function k0(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){Q(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||(M(e.$$.fragment,n),l=!0)},o(n){I(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function w0(t){let e,l,n,i,o,a;l=new lc({props:{$$slots:{default:[v0]},$$scope:{ctx:t}}});const r=[b0,h0],c=[];function f(m,_){return m[0].upgrading?0:m[0].booting?1:-1}return~(i=f(t))&&(o=c[i]=r[i](t)),{c(){e=p("div"),Z(l.$$.fragment),n=v(),o&&o.c(),u(e,"class","container mx-auto m-3")},m(m,_){$(m,e,_),Q(l,e,null),s(e,n),~i&&c[i].m(e,null),a=!0},p(m,[_]){const h={};_&7&&(h.$$scope={dirty:_,ctx:m}),l.$set(h);let b=i;i=f(m),i===b?~i&&c[i].p(m,_):(o&&(Te(),I(c[b],1,1,()=>{c[b]=null}),Se()),~i?(o=c[i],o?o.p(m,_):(o=c[i]=r[i](m),o.c()),M(o,1),o.m(e,null)):o=null)},i(m){a||(M(l.$$.fragment,m),M(o),a=!0)},o(m){I(l.$$.fragment,m),I(o),a=!1},d(m){m&&y(e),X(l),~i&&c[i].d()}}}function y0(t,e,l){let n={};Tt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?Bn("/vendor"):n.usrcfg===!1?Bn("/setup"):n.fwconsent===0&&Bn("/consent")}),co();let i={};return j1.subscribe(o=>{l(1,i=o)}),[n,i]}class $0 extends $e{constructor(e){super(),ye(this,e,y0,w0,ke,{})}}new $0({target:document.getElementById("app")});