diff --git a/lib/AmsConfiguration/include/AmsConfiguration.h b/lib/AmsConfiguration/include/AmsConfiguration.h index 4e2821c5..6f5d870a 100644 --- a/lib/AmsConfiguration/include/AmsConfiguration.h +++ b/lib/AmsConfiguration/include/AmsConfiguration.h @@ -277,7 +277,7 @@ public: bool getWebConfig(WebConfig&); bool setWebConfig(WebConfig&); - void clearAuth(WebConfig&); + void clearWebConfig(WebConfig&); bool getMeterConfig(MeterConfig&); bool setMeterConfig(MeterConfig&); diff --git a/lib/AmsConfiguration/src/AmsConfiguration.cpp b/lib/AmsConfiguration/src/AmsConfiguration.cpp index 16bbce39..94b84046 100644 --- a/lib/AmsConfiguration/src/AmsConfiguration.cpp +++ b/lib/AmsConfiguration/src/AmsConfiguration.cpp @@ -210,7 +210,7 @@ bool AmsConfiguration::getWebConfig(WebConfig& config) { EEPROM.end(); return true; } else { - clearAuth(config); + clearWebConfig(config); return false; } } @@ -228,10 +228,11 @@ bool AmsConfiguration::setWebConfig(WebConfig& config) { return ret; } -void AmsConfiguration::clearAuth(WebConfig& config) { +void AmsConfiguration::clearWebConfig(WebConfig& config) { config.security = 0; strcpy(config.username, ""); strcpy(config.password, ""); + strcpy(config.context, ""); } bool AmsConfiguration::getMeterConfig(MeterConfig& config) { @@ -840,7 +841,7 @@ void AmsConfiguration::clear() { EEPROM.put(CONFIG_MQTT_START, mqtt); WebConfig web; - clearAuth(web); + clearWebConfig(web); EEPROM.put(CONFIG_WEB_START, web); DomoticzConfig domo; diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index a93251eb..382238cf 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,14 +1,15 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))l(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&l(u)}).observe(document,{childList:!0,subtree:!0});function n(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 l(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function be(){}function fl(t,e){for(const n in e)t[n]=e[n];return t}function E1(t){return t()}function yr(){return Object.create(null)}function nt(t){t.forEach(E1)}function co(t){return typeof t=="function"}function Be(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ms;function vs(t,e){return ms||(ms=document.createElement("a")),ms.href=e,t===ms.href}function T0(t){return Object.keys(t).length===0}function mo(t,...e){if(t==null)return be;const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function ni(t){let e;return mo(t,n=>e=n)(),e}function gl(t,e,n){t.$$.on_destroy.push(mo(e,n))}function _o(t,e,n,l){if(t){const i=P1(t,e,n,l);return t[0](i)}}function P1(t,e,n,l){return t[1]&&l?fl(n.ctx.slice(),t[1](l(e))):n.ctx}function po(t,e,n,l){if(t[2]&&l){const i=t[2](l(n));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],u=Math.max(e.dirty.length,i.length);for(let m=0;m32){const e=[],n=t.ctx.length/32;for(let l=0;lt.removeEventListener(e,n,l)}function Ti(t){return function(e){return e.preventDefault(),t.call(this,e)}}function a(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}const E0=["width","height"];function ii(t,e){const n=Object.getOwnPropertyDescriptors(t.__proto__);for(const l in e)e[l]==null?t.removeAttribute(l):l==="style"?t.style.cssText=e[l]:l==="__value"?t.value=t[l]=e[l]:n[l]&&n[l].set&&E0.indexOf(l)===-1?t[l]=e[l]:a(t,l,e[l])}function Se(t){return t===""?null:+t}function P0(t){return Array.from(t.childNodes)}function X(t,e){e=""+e,t.data!==e&&(t.data=e)}function A0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function $0(t,e,n){~N0.indexOf(n)?A0(t,e):X(t,e)}function ue(t,e){t.value=e==null?"":e}function ki(t,e,n,l){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,l?"important":"")}function Te(t,e,n){for(let l=0;l{u.source===l.contentWindow&&e()})):(l.src="about:blank",l.onload=()=>{o=Q(l.contentWindow,"resize",e),e()}),s(t,l),()=>{(i||o&&l.contentWindow)&&o(),y(l)}}function L0(t,e,{bubbles:n=!1,cancelable:l=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,n,l,e),i}function Mr(t,e){return new t(e)}let yi;function wi(t){yi=t}function Ni(){if(!yi)throw new Error("Function called outside component initialization");return yi}function A1(t){Ni().$$.on_mount.push(t)}function I0(t){Ni().$$.on_destroy.push(t)}function R0(){const t=Ni();return(e,n,{cancelable:l=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=L0(e,n,{cancelable:l});return i.slice().forEach(u=>{u.call(t,o)}),!o.defaultPrevented}return!0}}function Ci(t,e){return Ni().$$.context.set(t,e),e}function jl(t){return Ni().$$.context.get(t)}const ei=[],ks=[];let ti=[];const Sr=[],$1=Promise.resolve();let Zs=!1;function D1(){Zs||(Zs=!0,$1.then(L1))}function F0(){return D1(),$1}function Ze(t){ti.push(t)}const Gs=new Set;let Jn=0;function L1(){if(Jn!==0)return;const t=yi;do{try{for(;Jnt.indexOf(l)===-1?e.push(l):n.push(l)),n.forEach(l=>l()),ti=e}const hs=new Set;let on;function $e(){on={r:0,c:[],p:on}}function De(){on.r||nt(on.c),on=on.p}function L(t,e){t&&t.i&&(hs.delete(t),t.i(e))}function q(t,e,n,l){if(t&&t.o){if(hs.has(t))return;hs.add(t),on.c.push(()=>{hs.delete(t),l&&(n&&t.d(1),l())}),t.o(e)}else l&&l()}function I1(t,e){const n={},l={},i={$$scope:1};let o=t.length;for(;o--;){const u=t[o],m=e[o];if(m){for(const r in u)r in m||(l[r]=1);for(const r in m)i[r]||(n[r]=m[r],i[r]=1);t[o]=m}else for(const r in u)i[r]=1}for(const u in l)u in n||(n[u]=void 0);return n}function Tr(t){return typeof t=="object"&&t!==null?t:{}}function ae(t){t&&t.c()}function se(t,e,n,l){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,n),l||Ze(()=>{const u=t.$$.on_mount.map(E1).filter(co);t.$$.on_destroy?t.$$.on_destroy.push(...u):nt(u),t.$$.on_mount=[]}),o.forEach(Ze)}function oe(t,e){const n=t.$$;n.fragment!==null&&(q0(n.after_update),nt(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function B0(t,e){t.$$.dirty[0]===-1&&(ei.push(t),D1(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=h.length?h[0]:v;return f.ctx&&i(f.ctx[_],f.ctx[_]=d)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](d),p&&B0(t,_)),v}):[],f.update(),p=!0,nt(f.before_update),f.fragment=l?l(f.ctx):!1,e.target){if(e.hydrate){const _=P0(e.target);f.fragment&&f.fragment.l(_),_.forEach(y)}else f.fragment&&f.fragment.c();e.intro&&L(t.$$.fragment),se(t,e.target,e.anchor,e.customElement),L1()}wi(r)}class We{$destroy(){oe(this,1),this.$destroy=be}$on(e,n){if(!co(n))return be;const l=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return l.push(n),()=>{const i=l.indexOf(n);i!==-1&&l.splice(i,1)}}$set(e){this.$$set&&!T0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Nr=t=>typeof t>"u",R1=t=>typeof t=="function",F1=t=>typeof t=="number";function U0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function O1(){let t=0;return()=>t++}function j0(){return Math.random().toString(36).substring(2)}const Hl=typeof window>"u";function q1(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}const B1=(t,e)=>t?{}:{style:e},Js=t=>({"aria-hidden":"true",...B1(t,"display:none;")}),xn=[];function U1(t,e){return{subscribe:pt(t,e).subscribe}}function pt(t,e=be){let n;const l=new Set;function i(m){if(Be(t,m)&&(t=m,n)){const r=!xn.length;for(const f of l)f[1](),xn.push(f,t);if(r){for(let f=0;f{l.delete(f),l.size===0&&n&&(n(),n=null)}}return{set:i,update:o,subscribe:u}}function H0(t,e,n){const l=!Array.isArray(t),i=l?[t]:t,o=e.length<2;return U1(n,u=>{let m=!1;const r=[];let f=0,p=be;const _=()=>{if(f)return;p();const h=e(l?r[0]:r,u);o?u(h):p=co(h)?h:be},v=i.map((h,d)=>mo(h,g=>{r[d]=g,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,xs=Ei("LOCATION"),si=Ei("ROUTER"),j1=Ei("ROUTE"),W0=Ei("ROUTE_PARAMS"),z0=Ei("FOCUS_ELEM"),H1=/^:(.+)/,vi=(t,e,n)=>t.substr(e,n),eo=(t,e)=>vi(t,0,e.length)===e,G0=t=>t==="",V0=t=>H1.test(t),W1=t=>t[0]==="*",K0=t=>t.replace(/\*.*$/,""),z1=t=>t.replace(/(^\/+|\/+$)/g,"");function wl(t,e=!1){const n=z1(t).split("/");return e?n.filter(Boolean):n}const Vs=(t,e)=>t+(e?`?${e}`:""),go=t=>`/${z1(t)}`;function Pi(...t){const e=l=>wl(l,!0).join("/"),n=t.map(e).join("/");return go(n)}const ko=1,Ms=2,mn=3,Y0=4,G1=5,Q0=6,V1=7,X0=8,Z0=9,K1=10,Y1=11,J0={[ko]:"Link",[Ms]:"Route",[mn]:"Router",[Y0]:"useFocus",[G1]:"useLocation",[Q0]:"useMatch",[V1]:"useNavigate",[X0]:"useParams",[Z0]:"useResolvable",[K1]:"useResolve",[Y1]:"navigate"},wo=t=>J0[t];function x0(t,e){let n;return t===Ms?n=e.path?`path="${e.path}"`:"default":t===ko?n=`to="${e.to}"`:t===mn&&(n=`basepath="${e.basepath||""}"`),`<${wo(t)} ${n||""} />`}function ec(t,e,n,l){const i=n&&x0(l||t,n),o=i?` +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))l(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&l(u)}).observe(document,{childList:!0,subtree:!0});function n(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 l(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function be(){}function cl(t,e){for(const n in e)t[n]=e[n];return t}function A1(t){return t()}function Sr(){return Object.create(null)}function lt(t){t.forEach(A1)}function _o(t){return typeof t=="function"}function Be(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ps;function ks(t,e){return ps||(ps=document.createElement("a")),ps.href=e,t===ps.href}function E0(t){return Object.keys(t).length===0}function po(t,...e){if(t==null)return be;const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function ii(t){let e;return po(t,n=>e=n)(),e}function kl(t,e,n){t.$$.on_destroy.push(po(e,n))}function ho(t,e,n,l){if(t){const i=$1(t,e,n,l);return t[0](i)}}function $1(t,e,n,l){return t[1]&&l?cl(n.ctx.slice(),t[1](l(e))):n.ctx}function vo(t,e,n,l){if(t[2]&&l){const i=t[2](l(n));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],u=Math.max(e.dirty.length,i.length);for(let m=0;m32){const e=[],n=t.ctx.length/32;for(let l=0;lt.removeEventListener(e,n,l)}function ai(t){return function(e){return e.preventDefault(),t.call(this,e)}}function a(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}const A0=["width","height"];function si(t,e){const n=Object.getOwnPropertyDescriptors(t.__proto__);for(const l in e)e[l]==null?t.removeAttribute(l):l==="style"?t.style.cssText=e[l]:l==="__value"?t.value=t[l]=e[l]:n[l]&&n[l].set&&A0.indexOf(l)===-1?t[l]=e[l]:a(t,l,e[l])}function Se(t){return t===""?null:+t}function $0(t){return Array.from(t.childNodes)}function X(t,e){e=""+e,t.data!==e&&(t.data=e)}function D0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function L0(t,e,n){~P0.indexOf(n)?D0(t,e):X(t,e)}function ue(t,e){t.value=e==null?"":e}function Ci(t,e,n,l){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,l?"important":"")}function Te(t,e,n){for(let l=0;l{u.source===l.contentWindow&&e()})):(l.src="about:blank",l.onload=()=>{o=Q(l.contentWindow,"resize",e),e()}),s(t,l),()=>{(i||o&&l.contentWindow)&&o(),y(l)}}function R0(t,e,{bubbles:n=!1,cancelable:l=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,n,l,e),i}function Tr(t,e){return new t(e)}let Si;function yi(t){Si=t}function Pi(){if(!Si)throw new Error("Function called outside component initialization");return Si}function D1(t){Pi().$$.on_mount.push(t)}function F0(t){Pi().$$.on_destroy.push(t)}function O0(){const t=Pi();return(e,n,{cancelable:l=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=R0(e,n,{cancelable:l});return i.slice().forEach(u=>{u.call(t,o)}),!o.defaultPrevented}return!0}}function Mi(t,e){return Pi().$$.context.set(t,e),e}function Hl(t){return Pi().$$.context.get(t)}const ti=[],ys=[];let li=[];const Nr=[],L1=Promise.resolve();let xs=!1;function I1(){xs||(xs=!0,L1.then(R1))}function q0(){return I1(),L1}function Ze(t){li.push(t)}const Ks=new Set;let xn=0;function R1(){if(xn!==0)return;const t=Si;do{try{for(;xnt.indexOf(l)===-1?e.push(l):n.push(l)),n.forEach(l=>l()),li=e}const gs=new Set;let an;function $e(){an={r:0,c:[],p:an}}function De(){an.r||lt(an.c),an=an.p}function L(t,e){t&&t.i&&(gs.delete(t),t.i(e))}function q(t,e,n,l){if(t&&t.o){if(gs.has(t))return;gs.add(t),an.c.push(()=>{gs.delete(t),l&&(n&&t.d(1),l())}),t.o(e)}else l&&l()}function F1(t,e){const n={},l={},i={$$scope:1};let o=t.length;for(;o--;){const u=t[o],m=e[o];if(m){for(const r in u)r in m||(l[r]=1);for(const r in m)i[r]||(n[r]=m[r],i[r]=1);t[o]=m}else for(const r in u)i[r]=1}for(const u in l)u in n||(n[u]=void 0);return n}function Er(t){return typeof t=="object"&&t!==null?t:{}}function ae(t){t&&t.c()}function se(t,e,n,l){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,n),l||Ze(()=>{const u=t.$$.on_mount.map(A1).filter(_o);t.$$.on_destroy?t.$$.on_destroy.push(...u):lt(u),t.$$.on_mount=[]}),o.forEach(Ze)}function oe(t,e){const n=t.$$;n.fragment!==null&&(U0(n.after_update),lt(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function j0(t,e){t.$$.dirty[0]===-1&&(ti.push(t),I1(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=v.length?v[0]:h;return f.ctx&&i(f.ctx[_],f.ctx[_]=d)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](d),p&&j0(t,_)),h}):[],f.update(),p=!0,lt(f.before_update),f.fragment=l?l(f.ctx):!1,e.target){if(e.hydrate){const _=$0(e.target);f.fragment&&f.fragment.l(_),_.forEach(y)}else f.fragment&&f.fragment.c();e.intro&&L(t.$$.fragment),se(t,e.target,e.anchor,e.customElement),R1()}yi(r)}class We{$destroy(){oe(this,1),this.$destroy=be}$on(e,n){if(!_o(n))return be;const l=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return l.push(n),()=>{const i=l.indexOf(n);i!==-1&&l.splice(i,1)}}$set(e){this.$$set&&!E0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Pr=t=>typeof t>"u",O1=t=>typeof t=="function",q1=t=>typeof t=="number";function H0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function B1(){let t=0;return()=>t++}function W0(){return Math.random().toString(36).substring(2)}const Wl=typeof window>"u";function U1(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}const j1=(t,e)=>t?{}:{style:e},eo=t=>({"aria-hidden":"true",...j1(t,"display:none;")}),ei=[];function H1(t,e){return{subscribe:ht(t,e).subscribe}}function ht(t,e=be){let n;const l=new Set;function i(m){if(Be(t,m)&&(t=m,n)){const r=!ei.length;for(const f of l)f[1](),ei.push(f,t);if(r){for(let f=0;f{l.delete(f),l.size===0&&n&&(n(),n=null)}}return{set:i,update:o,subscribe:u}}function z0(t,e,n){const l=!Array.isArray(t),i=l?[t]:t,o=e.length<2;return H1(n,u=>{let m=!1;const r=[];let f=0,p=be;const _=()=>{if(f)return;p();const v=e(l?r[0]:r,u);o?u(v):p=_o(v)?v:be},h=i.map((v,d)=>po(v,g=>{r[d]=g,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,to=Ai("LOCATION"),oi=Ai("ROUTER"),W1=Ai("ROUTE"),G0=Ai("ROUTE_PARAMS"),V0=Ai("FOCUS_ELEM"),z1=/^:(.+)/,gi=(t,e,n)=>t.substr(e,n),lo=(t,e)=>gi(t,0,e.length)===e,K0=t=>t==="",Y0=t=>z1.test(t),G1=t=>t[0]==="*",Q0=t=>t.replace(/\*.*$/,""),V1=t=>t.replace(/(^\/+|\/+$)/g,"");function Cl(t,e=!1){const n=V1(t).split("/");return e?n.filter(Boolean):n}const Ys=(t,e)=>t+(e?`?${e}`:""),wo=t=>`/${V1(t)}`;function $i(...t){const e=l=>Cl(l,!0).join("/"),n=t.map(e).join("/");return wo(n)}const Co=1,Ns=2,_n=3,X0=4,K1=5,Z0=6,Y1=7,J0=8,x0=9,Q1=10,X1=11,ec={[Co]:"Link",[Ns]:"Route",[_n]:"Router",[X0]:"useFocus",[K1]:"useLocation",[Z0]:"useMatch",[Y1]:"useNavigate",[J0]:"useParams",[x0]:"useResolvable",[Q1]:"useResolve",[X1]:"navigate"},yo=t=>ec[t];function tc(t,e){let n;return t===Ns?n=e.path?`path="${e.path}"`:"default":t===Co?n=`to="${e.to}"`:t===_n&&(n=`basepath="${e.basepath||""}"`),`<${yo(t)} ${n||""} />`}function lc(t,e,n,l){const i=n&&tc(l||t,n),o=i?` -Occurred in: ${i}`:"",u=wo(t),m=R1(e)?e(u):e;return`<${u}> ${m}${o}`}const Q1=t=>(...e)=>t(ec(...e)),X1=Q1(t=>{throw new Error(t)}),ws=Q1(console.warn),Er=4,tc=3,lc=2,nc=1,ic=1;function sc(t,e){const n=t.default?0:wl(t.fullPath).reduce((l,i)=>{let o=l;return o+=Er,G0(i)?o+=ic:V0(i)?o+=lc:W1(i)?o-=Er+nc:o+=tc,o},0);return{route:t,score:n,index:e}}function oc(t){return t.map(sc).sort((e,n)=>e.scoren.score?-1:e.index-n.index)}function Z1(t,e){let n,l;const[i]=e.split("?"),o=wl(i),u=o[0]==="",m=oc(t);for(let r=0,f=m.length;r({...p,params:v,uri:A});if(p.default){l=h(e);continue}const d=wl(p.fullPath),g=Math.max(o.length,d.length);let k=0;for(;k{f===".."?r.pop():f!=="."&&r.push(f)}),Vs(`/${r.join("/")}`,l)}function Pr(t,e){const{pathname:n,hash:l="",search:i="",state:o}=t,u=wl(e,!0),m=wl(n,!0);for(;u.length;)u[0]!==m[0]&&X1(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${n}"`),u.shift(),m.shift();return{pathname:Pi(...m),hash:l,search:i,state:o}}const Ar=t=>t.length===1?"":t,Co=t=>{const e=t.indexOf("?"),n=t.indexOf("#"),l=e!==-1,i=n!==-1,o=i?Ar(vi(t,n)):"",u=i?vi(t,0,n):t,m=l?Ar(vi(u,e)):"";return{pathname:(l?vi(u,0,e):u)||"/",search:m,hash:o}},rc=t=>{const{pathname:e,search:n,hash:l}=t;return e+n+l};function uc(t,e,n){return Pi(n,ac(t,e))}function fc(t,e){const n=go(K0(t)),l=wl(n,!0),i=wl(e,!0).slice(0,l.length),o=J1({fullPath:n},Pi(...i));return o&&o.uri}const Ks="POP",cc="PUSH",mc="REPLACE";function Ys(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function _c(t){let e=[],n=Ys(t),l=Ks;const i=(o=e)=>o.forEach(u=>u({location:n,action:l}));return{get location(){return n},listen(o){e.push(o);const u=()=>{n=Ys(t),l=Ks,i([o])};i([o]);const m=q1(t,"popstate",u);return()=>{m(),e=e.filter(r=>r!==o)}},navigate(o,u){const{state:m={},replace:r=!1}=u||{};if(l=r?mc:cc,F1(o))u&&ws(Y1,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),l=Ks,t.history.go(o);else{const f={...m,_key:j0()};try{t.history[r?"replaceState":"pushState"](f,"",o)}catch{t.location[r?"replace":"assign"](o)}}n=Ys(t),i()}}}function Qs(t,e){return{...Co(e),state:t}}function pc(t="/"){let e=0,n=[Qs(null,t)];return{get entries(){return n},get location(){return n[e]},addEventListener(){},removeEventListener(){},history:{get state(){return n[e].state},pushState(l,i,o){e++,n=n.slice(0,e),n.push(Qs(l,o))},replaceState(l,i,o){n[e]=Qs(l,o)},go(l){const i=e+l;i<0||i>n.length-1||(e=i)}}}}const dc=!!(!Hl&&window.document&&window.document.createElement),hc=!Hl&&window.location.origin==="null",x1=_c(dc&&!hc?window:pc()),{navigate:cn}=x1;let Pl=null,e0=!0;function vc(t,e){const n=document.querySelectorAll("[data-svnav-router]");for(let l=0;lPl.level||t.level===Pl.level&&vc(t.routerId,Pl.routerId))&&(Pl=t)}function gc(){Pl=null}function kc(){e0=!1}function $r(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let n;n=q1(t,"blur",()=>{t.removeAttribute(e),n()})}return t.focus(),document.activeElement===t}catch{return!1}}function wc(t,e){return Number(t.dataset.svnavRouteEnd)===e}function Cc(t){return/^H[1-6]$/i.test(t.tagName)}function Dr(t,e=document){return e.querySelector(t)}function yc(t){let n=Dr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!wc(n,t);){if(Cc(n))return n;const l=Dr("h1,h2,h3,h4,h5,h6",n);if(l)return l;n=n.nextElementSibling}return null}function Mc(t){Promise.resolve(ni(t.focusElement)).then(e=>{const n=e||yc(t.id);n||ws(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ms),!$r(n)&&$r(document.documentElement)})}const Sc=(t,e,n)=>(l,i)=>F0().then(()=>{if(!Pl||e0){kc();return}if(l&&Mc(Pl.route),t.announcements&&i){const{path:o,fullPath:u,meta:m,params:r,uri:f}=Pl.route,p=t.createAnnouncement({path:o,fullPath:u,meta:m,params:r,uri:f},ni(n));Promise.resolve(p).then(_=>{e.set(_)})}gc()}),Tc="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 Nc(t){let e,n,l=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},B1(t[6],Tc)],i={};for(let o=0;o`Navigated to ${ne.uri}`,announcements:!0,...d},A=p,T=go(p),P=jl(xs),F=jl(si),I=!P,R=Pc(),w=h&&!(F&&!F.manageFocus),$=pt("");gl(t,$,ne=>n(0,m=ne));const ie=F?F.disableInlineStyles:g,j=pt([]);gl(t,j,ne=>n(20,u=ne));const U=pt(null);gl(t,U,ne=>n(18,i=ne));let H=!1;const G=I?0:F.level+1,K=I?pt((()=>Pr(Hl?Co(_):v.location,T))()):P;gl(t,K,ne=>n(17,l=ne));const Z=pt(l);gl(t,Z,ne=>n(19,o=ne));const z=Sc(k,$,K),W=ne=>me=>me.filter(Y=>Y.id!==ne);function x(ne){if(Hl){if(H)return;const me=J1(ne,l.pathname);if(me)return H=!0,me}else j.update(me=>{const Y=W(ne.id)(me);return Y.push(ne),Y})}function _e(ne){j.update(W(ne))}return!I&&p!==Lr&&ws(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),I&&(A1(()=>v.listen(me=>{const Y=Pr(me.location,T);Z.set(l),K.set(Y)})),Ci(xs,K)),Ci(si,{activeRoute:U,registerRoute:x,unregisterRoute:_e,manageFocus:w,level:G,id:R,history:I?v:F.history,basepath:I?T:F.basepath,disableInlineStyles:ie}),t.$$set=ne=>{"basepath"in ne&&n(11,p=ne.basepath),"url"in ne&&n(12,_=ne.url),"history"in ne&&n(13,v=ne.history),"primary"in ne&&n(14,h=ne.primary),"a11y"in ne&&n(15,d=ne.a11y),"disableInlineStyles"in ne&&n(16,g=ne.disableInlineStyles),"$$scope"in ne&&n(21,f=ne.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==A&&ws(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ne=Z1(u,l.pathname);U.set(ne)}if(t.$$.dirty[0]&655360&&I){const ne=!!l.hash,me=!ne&&w,Y=!ne||l.pathname!==o.pathname;z(me,Y)}t.$$.dirty[0]&262144&&w&&i&&i.primary&&bc({level:G,routerId:R,route:i})},[m,k,I,R,w,$,ie,j,U,K,Z,p,_,v,h,d,g,l,i,o,u,f,r]}class $c extends We{constructor(e){super(),He(this,e,Ac,Ec,Be,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const t0=$c;function Ai(t,e,n=si,l=mn){jl(n)||X1(t,o=>`You cannot use ${o} outside of a ${wo(l)}.`,e)}const Dc=t=>{const{subscribe:e}=jl(t);return{subscribe:e}};function l0(){return Ai(G1),Dc(xs)}function n0(){const{history:t}=jl(si);return t}function i0(){const t=jl(j1);return t?H0(t,e=>e.base):pt("/")}function s0(){Ai(K1);const t=i0(),{basepath:e}=jl(si);return l=>uc(l,ni(t),e)}function Lc(){Ai(V1);const t=s0(),{navigate:e}=n0();return(l,i)=>{const o=F1(l)?l:t(l);return e(o,i)}}const Ic=t=>({params:t&16,location:t&8}),Ir=t=>({params:Hl?ni(t[10]):t[4],location:t[3],navigate:t[11]});function Rr(t){let e,n;return e=new t0({props:{primary:t[1],$$slots:{default:[Oc]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.primary=l[1]),i&528409&&(o.$$scope={dirty:i,ctx:l}),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Rc(t){let e;const n=t[18].default,l=_o(n,t,t[19],Ir);return{c(){l&&l.c()},m(i,o){l&&l.m(i,o),e=!0},p(i,o){l&&l.p&&(!e||o&524312)&&ho(l,n,i,i[19],e?po(n,i[19],o,Ic):vo(i[19]),Ir)},i(i){e||(L(l,i),e=!0)},o(i){q(l,i),e=!1},d(i){l&&l.d(i)}}}function Fc(t){let e,n,l;const i=[{location:t[3]},{navigate:t[11]},Hl?ni(t[10]):t[4],t[12]];var o=t[0];function u(m){let r={};for(let f=0;f{oe(p,1)}),De()}o?(e=Mr(o,u()),ae(e.$$.fragment),L(e.$$.fragment,1),se(e,n.parentNode,n)):e=null}else o&&e.$set(f)},i(m){l||(e&&L(e.$$.fragment,m),l=!0)},o(m){e&&q(e.$$.fragment,m),l=!1},d(m){m&&y(n),e&&oe(e,m)}}}function Oc(t){let e,n,l,i;const o=[Fc,Rc],u=[];function m(r,f){return r[0]!==null?0:1}return e=m(t),n=u[e]=o[e](t),{c(){n.c(),l=it()},m(r,f){u[e].m(r,f),M(r,l,f),i=!0},p(r,f){let p=e;e=m(r),e===p?u[e].p(r,f):($e(),q(u[p],1,1,()=>{u[p]=null}),De(),n=u[e],n?n.p(r,f):(n=u[e]=o[e](r),n.c()),L(n,1),n.m(l.parentNode,l))},i(r){i||(L(n),i=!0)},o(r){q(n),i=!1},d(r){u[e].d(r),r&&y(l)}}}function qc(t){let e,n,l,i,o,u=[Js(t[7]),{"data-svnav-route-start":t[5]}],m={};for(let _=0;_{r=null}),De())},i(_){o||(L(r),o=!0)},o(_){q(r),o=!1},d(_){_&&y(e),_&&y(n),r&&r.d(_),_&&y(l),_&&y(i)}}}const Bc=O1();function Uc(t,e,n){let l;const i=["path","component","meta","primary"];let o=gs(e,i),u,m,r,f,{$$slots:p={},$$scope:_}=e,{path:v=""}=e,{component:h=null}=e,{meta:d={}}=e,{primary:g=!0}=e;Ai(Ms,e);const k=Bc(),{registerRoute:A,unregisterRoute:T,activeRoute:P,disableInlineStyles:F}=jl(si);gl(t,P,H=>n(16,u=H));const I=i0();gl(t,I,H=>n(17,r=H));const R=l0();gl(t,R,H=>n(3,m=H));const w=pt(null);let $;const ie=pt(),j=pt({});gl(t,j,H=>n(4,f=H)),Ci(j1,ie),Ci(W0,j),Ci(z0,w);const U=Lc();return Hl||I0(()=>T(k)),t.$$set=H=>{n(24,e=fl(fl({},e),bs(H))),n(12,o=gs(e,i)),"path"in H&&n(13,v=H.path),"component"in H&&n(0,h=H.component),"meta"in H&&n(14,d=H.meta),"primary"in H&&n(1,g=H.primary),"$$scope"in H&&n(19,_=H.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const H=v==="",G=Pi(r,v),V={id:k,path:v,meta:d,default:H,fullPath:H?"":G,base:H?r:fc(G,m.pathname),primary:g,focusElement:w};ie.set(V),n(15,$=A(V))}if(t.$$.dirty&98304&&n(2,l=!!($||u&&u.id===k)),t.$$.dirty&98308&&l){const{params:H}=$||u;j.set(H)}},e=bs(e),[h,g,l,m,f,k,P,F,I,R,j,U,o,v,d,$,u,r,p,_]}class jc extends We{constructor(e){super(),He(this,e,Uc,qc,Be,{path:13,component:0,meta:14,primary:1})}}const vl=jc;function Hc(t){let e,n,l,i;const o=t[13].default,u=_o(o,t,t[12],null);let m=[{href:t[0]},t[2],t[1]],r={};for(let f=0;fn(11,_=w));const P=R0(),F=s0(),{navigate:I}=n0();function R(w){P("click",w),U0(w)&&(w.preventDefault(),I(l,{state:k,replace:u||g}))}return t.$$set=w=>{n(19,e=fl(fl({},e),bs(w))),n(18,p=gs(e,f)),"to"in w&&n(5,d=w.to),"replace"in w&&n(6,g=w.replace),"state"in w&&n(7,k=w.state),"getProps"in w&&n(8,A=w.getProps),"$$scope"in w&&n(12,h=w.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&n(0,l=F(d,_)),t.$$.dirty&2049&&n(10,i=eo(_.pathname,l)),t.$$.dirty&2049&&n(9,o=l===_.pathname),t.$$.dirty&2049&&(u=Co(l)===rc(_)),t.$$.dirty&512&&n(2,m=o?{"aria-current":"page"}:{}),n(1,r=(()=>{if(R1(A)){const w=A({location:_,href:l,isPartiallyCurrent:i,isCurrent:o});return{...p,...w}}return p})())},e=bs(e),[l,r,m,T,R,d,g,k,A,o,i,_,h,v]}class zc extends We{constructor(e){super(),He(this,e,Wc,Hc,Be,{to:5,replace:6,state:7,getProps:8})}}const el=zc;let Mi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ul(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function Gc(t,e){return e?t>218&&t<242?"#32c000":t>212&&t<248?"#b1c000":t>208&&t<252?"#ffa000":"#d90000":t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function yo(t,e){let n;return e?t>90?n="#d90000":t>85?n="#e31000":t>80?n="#ffa900":t>75?n="#dcc300":n="#32c500":t>90?n="#d90000":t>85?n="#e32100":t>80?n="#ffb800":t>75?n="#dcd800":n="#32d900",n}function Si(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Cs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Ye(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function Ce(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";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";case 80:return"Generic ESP32-S3"}}function Fr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function 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 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Br(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function li(t){switch(t){case 2:case 4:case 7:return!0}return!1}function lt(t,e){return t==1||t==2&&e}function jt(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function Ne(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<1?2:t<10?1:0),t.toFixed(e))}function kl(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"}}function jr(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function Hr(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}async function Al(t,e={}){const{timeout:n=8e3}=e,l=new AbortController,i=setTimeout(()=>l.abort(),n),o=await fetch(t,{...e,signal:l.signal});return clearTimeout(i),o}let bl={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,if:{eth:!1}};const Yt=pt(bl);async function Mo(){bl=await(await Al("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Yt.set(bl)}let ps=0,Wr=-127,zr=null,Vc={};const o0=U1(Vc,t=>{let e;async function n(){Al("data.json").then(l=>l.json()).then(l=>{t(l),Wr!=l.t&&(Wr=l.t,setTimeout(c0,2e3)),zr==null&&l.pe&&l.p!=null&&(zr=l.p,r0()),bl.upgrading?window.location.reload():(!bl||!bl.chip||bl.booting||ps>1&&!li(bl.board))&&(Mo(),an&&clearTimeout(an),an=setTimeout(To,2e3),rn&&clearTimeout(rn),rn=setTimeout(No,3e3));let i=5e3;if(li(bl.board)&&l.v>2.5){let o=3.3-Math.min(3.3,l.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(n,i),ps=0}).catch(l=>{ps++,ps>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(n,15e3)):e=setTimeout(n,li(bl.board)?1e4:5e3)})}return n(),function(){clearTimeout(e)}});let to={},bi;const So=pt(to);async function a0(){let t=!1;if(So.update(e=>{for(var n=0;n<36;n++){if(e[Ye(n)]==null){t=n<12;break}e[Ye(n)]=e[Ye(n+1)]}return e}),t)r0();else{let e=new Date;bi=setTimeout(a0,(60-e.getMinutes())*6e4)}}async function r0(){bi&&(clearTimeout(bi),bi=0),to=await(await Al("energyprice.json")).json(),So.set(to);let e=new Date;bi=setTimeout(a0,(60-e.getMinutes())*6e4)}let lo={},an;async function To(){an&&(clearTimeout(an),an=0),lo=await(await Al("dayplot.json")).json(),u0.set(lo);let e=new Date;an=setTimeout(To,(60-e.getMinutes())*6e4+20)}const u0=pt(lo,t=>(To(),function(){}));let no={},rn;async function No(){rn&&(clearTimeout(rn),rn=0),no=await(await Al("monthplot.json")).json(),f0.set(no);let e=new Date;rn=setTimeout(No,(24-e.getHours())*36e5+40)}const f0=pt(no,t=>(No(),function(){}));let io={};async function c0(){io=await(await Al("temperature.json")).json(),m0.set(io)}const m0=pt(io,t=>(c0(),function(){}));let so={},ds;async function _0(){ds&&(clearTimeout(ds),ds=0),so=await(await Al("tariff.json")).json(),p0.set(so);let e=new Date;ds=setTimeout(_0,(60-e.getMinutes())*6e4+30)}const p0=pt(so,t=>function(){});let oo=[];const Eo=pt(oo);async function Kc(){oo=await(await Al("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Eo.set(oo)}let ao={};async function Yc(){ao=await(await Al("realtime.json")).json(),d0.set(ao)}const d0=pt(ao,t=>(Yc(),function(){}));function ys(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 h0(t){await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function v0(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let n=t.substring(1).split("."),l=parseInt(n[0]),i=parseInt(n[1]),o=parseInt(n[2]),u=[...e];u.reverse();let m,r,f;for(let p=0;po&&(m=_):g==i+1&&(r=_);else if(d==l+1)if(f){let A=f.tag_name.substring(1).split(".");parseInt(A[0]);let T=parseInt(A[1]);parseInt(A[2]),g==T&&(f=_)}else f=_}return r||f||m||!1}else return e[0]}const Gr="/github.svg";function Vr(t){let e,n;function l(u,m){return u[1]>1?tm:u[1]>0?em:u[2]>1?xc:u[2]>0?Jc:u[3]>1?Zc:u[3]>0?Xc:Qc}let i=l(t),o=i(t);return{c(){e=E(`Up - `),o.c(),n=it()},m(u,m){M(u,e,m),o.m(u,m),M(u,n,m)},p(u,m){i===(i=l(u))&&o?o.p(u,m):(o.d(1),o=i(u),o&&(o.c(),o.m(n.parentNode,n)))},d(u){u&&y(e),o.d(u),u&&y(n)}}}function Qc(t){let e,n;return{c(){e=E(t[0]),n=E(" seconds")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&1&&X(e,l[0])},d(l){l&&y(e),l&&y(n)}}}function Xc(t){let e,n;return{c(){e=E(t[3]),n=E(" minute")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&8&&X(e,l[3])},d(l){l&&y(e),l&&y(n)}}}function Zc(t){let e,n;return{c(){e=E(t[3]),n=E(" minutes")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&8&&X(e,l[3])},d(l){l&&y(e),l&&y(n)}}}function Jc(t){let e,n;return{c(){e=E(t[2]),n=E(" hour")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&4&&X(e,l[2])},d(l){l&&y(e),l&&y(n)}}}function xc(t){let e,n;return{c(){e=E(t[2]),n=E(" hours")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&4&&X(e,l[2])},d(l){l&&y(e),l&&y(n)}}}function em(t){let e,n;return{c(){e=E(t[1]),n=E(" day")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&2&&X(e,l[1])},d(l){l&&y(e),l&&y(n)}}}function tm(t){let e,n;return{c(){e=E(t[1]),n=E(" days")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&2&&X(e,l[1])},d(l){l&&y(e),l&&y(n)}}}function lm(t){let e,n=t[0]&&Vr(t);return{c(){n&&n.c(),e=it()},m(l,i){n&&n.m(l,i),M(l,e,i)},p(l,[i]){l[0]?n?n.p(l,i):(n=Vr(l),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:be,o:be,d(l){n&&n.d(l),l&&y(e)}}}function nm(t,e,n){let{epoch:l}=e,i=0,o=0,u=0;return t.$$set=m=>{"epoch"in m&&n(0,l=m.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(n(1,i=Math.floor(l/86400)),n(2,o=Math.floor(l/3600)),n(3,u=Math.floor(l/60)))},[l,i,o,u]}class im extends We{constructor(e){super(),He(this,e,nm,lm,Be,{epoch:0})}}function sm(t){let e,n,l;return{c(){e=c("span"),n=E(t[2]),a(e,"title",t[1]),a(e,"class",l="bd-"+t[0])},m(i,o){M(i,e,o),s(e,n)},p(i,[o]){o&4&&X(n,i[2]),o&2&&a(e,"title",i[1]),o&1&&l!==(l="bd-"+i[0])&&a(e,"class",l)},i:be,o:be,d(i){i&&y(e)}}}function om(t,e,n){let{color:l}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&n(0,l=u.color),"title"in u&&n(1,i=u.title),"text"in u&&n(2,o=u.text)},[l,i,o]}class un extends We{constructor(e){super(),He(this,e,om,sm,Be,{color:0,title:1,text:2})}}function am(t){let e,n=`${Ye(t[0].getDate())}.${Ye(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ye(t[0].getHours())}:${Ye(t[0].getMinutes())}`,l;return{c(){e=c("span"),l=E(n),a(e,"class",t[1])},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&1&&n!==(n=`${Ye(i[0].getDate())}.${Ye(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ye(i[0].getHours())}:${Ye(i[0].getMinutes())}`)&&X(l,n),o&2&&a(e,"class",i[1])},d(i){i&&y(e)}}}function rm(t){let e=`${Ye(t[0].getDate())}. ${Mi[t[0].getMonth()]} ${Ye(t[0].getHours())}:${Ye(t[0].getMinutes())}`,n;return{c(){n=E(e)},m(l,i){M(l,n,i)},p(l,i){i&1&&e!==(e=`${Ye(l[0].getDate())}. ${Mi[l[0].getMonth()]} ${Ye(l[0].getHours())}:${Ye(l[0].getMinutes())}`)&&X(n,e)},d(l){l&&y(n)}}}function um(t){let e;function n(o,u){return o[2]?rm:am}let l=n(t),i=l(t);return{c(){i.c(),e=it()},m(o,u){i.m(o,u),M(o,e,u)},p(o,[u]){l===(l=n(o))&&i?i.p(o,u):(i.d(1),i=l(o),i&&(i.c(),i.m(e.parentNode,e)))},i:be,o:be,d(o){i.d(o),o&&y(e)}}}function fm(t,e,n){let{timestamp:l}=e,{fullTimeColor:i}=e,{offset:o}=e,u;return t.$$set=m=>{"timestamp"in m&&n(0,l=m.timestamp),"fullTimeColor"in m&&n(1,i=m.fullTimeColor),"offset"in m&&n(3,o=m.offset)},t.$$.update=()=>{t.$$.dirty&9&&(n(2,u=Math.abs(new Date().getTime()-l.getTime())<3e5),isNaN(o)||kl(l,o-(24+l.getHours()-l.getUTCHours())%24))},[l,i,u,o]}class b0 extends We{constructor(e){super(),He(this,e,fm,um,Be,{timestamp:0,fullTimeColor:1,offset:3})}}function cm(t){let e,n,l;return{c(){e=je("svg"),n=je("path"),l=je("path"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"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"),a(l,"stroke-linecap","round"),a(l,"stroke-linejoin","round"),a(l,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(i,o){M(i,e,o),s(e,n),s(e,l)},p:be,i:be,o:be,d(i){i&&y(e)}}}class mm extends We{constructor(e){super(),He(this,e,null,cm,Be,{})}}function _m(t){let e,n;return{c(){e=je("svg"),n=je("path"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"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"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(l,i){M(l,e,i),s(e,n)},p:be,i:be,o:be,d(l){l&&y(e)}}}class pm extends We{constructor(e){super(),He(this,e,null,_m,Be,{})}}function dm(t){let e,n;return{c(){e=je("svg"),n=je("path"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"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"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(l,i){M(l,e,i),s(e,n)},p:be,i:be,o:be,d(l){l&&y(e)}}}class Ut extends We{constructor(e){super(),He(this,e,null,dm,Be,{})}}function hm(t){let e,n;return{c(){e=je("svg"),n=je("path"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"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"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(l,i){M(l,e,i),s(e,n)},p:be,i:be,o:be,d(l){l&&y(e)}}}class g0 extends We{constructor(e){super(),He(this,e,null,hm,Be,{})}}function vm(t){let e,n,l=t[2].version+"",i;return{c(){e=E("AMS reader "),n=c("span"),i=E(l)},m(o,u){M(o,e,u),M(o,n,u),s(n,i)},p(o,u){u&4&&l!==(l=o[2].version+"")&&X(i,l)},d(o){o&&y(e),o&&y(n)}}}function Kr(t){let e,n=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",l,i;return{c(){e=c("div"),l=E(n),i=E("\xB0C"),a(e,"class","flex-none my-auto")},m(o,u){M(o,e,u),s(e,l),s(e,i)},p(o,u){u&2&&n!==(n=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&X(l,n)},d(o){o&&y(e)}}}function Yr(t){let e,n="HAN: "+Fr(t[1].he),l;return{c(){e=c("div"),l=E(n),a(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&2&&n!==(n="HAN: "+Fr(i[1].he))&&X(l,n)},d(i){i&&y(e)}}}function Qr(t){let e,n="MQTT: "+Or(t[1].me),l;return{c(){e=c("div"),l=E(n),a(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&2&&n!==(n="MQTT: "+Or(i[1].me))&&X(l,n)},d(i){i&&y(e)}}}function Xr(t){let e,n="Price service: "+qr(t[1].ee),l;return{c(){e=c("div"),l=E(n),a(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&2&&n!==(n="Price service: "+qr(i[1].ee))&&X(l,n)},d(i){i&&y(e)}}}function Zr(t){let e,n,l,i,o,u;return n=new el({props:{to:"/configuration",$$slots:{default:[bm]},$$scope:{ctx:t}}}),o=new el({props:{to:"/status",$$slots:{default:[gm]},$$scope:{ctx:t}}}),{c(){e=c("div"),ae(n.$$.fragment),l=b(),i=c("div"),ae(o.$$.fragment),a(e,"class","flex-none px-1 mt-1"),a(e,"title","Configuration"),a(i,"class","flex-none px-1 mt-1"),a(i,"title","Device information")},m(m,r){M(m,e,r),se(n,e,null),M(m,l,r),M(m,i,r),se(o,i,null),u=!0},i(m){u||(L(n.$$.fragment,m),L(o.$$.fragment,m),u=!0)},o(m){q(n.$$.fragment,m),q(o.$$.fragment,m),u=!1},d(m){m&&y(e),oe(n),m&&y(l),m&&y(i),oe(o)}}}function bm(t){let e,n;return e=new mm({}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function gm(t){let e,n;return e=new pm({}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Jr(t){let e,n,l,i,o;const u=[wm,km],m=[];function r(f,p){return f[2].security==0||f[1].a?0:1}return n=r(t),l=m[n]=u[n](t),{c(){e=c("div"),l.c(),a(e,"class","flex-none mr-3 text-yellow-500"),a(e,"title",i="New version: "+t[3].tag_name)},m(f,p){M(f,e,p),m[n].m(e,null),o=!0},p(f,p){let _=n;n=r(f),n===_?m[n].p(f,p):($e(),q(m[_],1,1,()=>{m[_]=null}),De(),l=m[n],l?l.p(f,p):(l=m[n]=u[n](f),l.c()),L(l,1),l.m(e,null)),(!o||p&8&&i!==(i="New version: "+f[3].tag_name))&&a(e,"title",i)},i(f){o||(L(l),o=!0)},o(f){q(l),o=!1},d(f){f&&y(e),m[n].d()}}}function km(t){let e,n,l=t[3].tag_name+"",i;return{c(){e=c("span"),n=E("New version: "),i=E(l)},m(o,u){M(o,e,u),s(e,n),s(e,i)},p(o,u){u&8&&l!==(l=o[3].tag_name+"")&&X(i,l)},i:be,o:be,d(o){o&&y(e)}}}function wm(t){let e,n,l,i=t[3].tag_name+"",o,u,m,r,f,p;return m=new g0({}),{c(){e=c("button"),n=c("span"),l=E("New version: "),o=E(i),u=b(),ae(m.$$.fragment),a(n,"class","mt-1"),a(e,"class","flex")},m(_,v){M(_,e,v),s(e,n),s(n,l),s(n,o),s(e,u),se(m,e,null),r=!0,f||(p=Q(e,"click",t[4]),f=!0)},p(_,v){(!r||v&8)&&i!==(i=_[3].tag_name+"")&&X(o,i)},i(_){r||(L(m.$$.fragment,_),r=!0)},o(_){q(m.$$.fragment,_),r=!1},d(_){_&&y(e),oe(m),f=!1,p()}}}function Cm(t){let e,n,l,i,o,u,m,r,f,p,_,v,h=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",d,g,k,A,T,P,F,I,R,w,$,ie,j,U,H,G,V,K,Z,z,W,x,_e,ne,me,Y,ke,Ee,we,Me;i=new el({props:{to:"/",$$slots:{default:[vm]},$$scope:{ctx:t}}}),r=new im({props:{epoch:t[1].u}});let te=t[1].t>-50&&Kr(t);T=new un({props:{title:"ESP",text:t[2].booting?"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":"ESP",color:Ul(t[2].booting?2:t[1].em)}}),F=new un({props:{title:"HAN",text:"HAN",color:Ul(t[2].booting?9:t[1].hm)}}),R=new un({props:{title:"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":"WiFi",color:Ul(t[2].booting?9:t[1].wm)}}),$=new un({props:{title:"MQTT",text:"MQTT",color:Ul(t[2].booting?9:t[1].mm)}});let fe=(t[1].he<0||t[1].he>0)&&Yr(t),Oe=t[1].me<0&&Qr(t),Ie=(t[1].ee>0||t[1].ee<0)&&Xr(t);_e=new b0({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let N=t[2].vndcfg&&t[2].usrcfg&&Zr(t);Ee=new Ut({});let C=t[2].fwconsent===1&&t[3]&&Jr(t);return{c(){e=c("nav"),n=c("div"),l=c("div"),ae(i.$$.fragment),o=b(),u=c("div"),m=c("div"),ae(r.$$.fragment),f=b(),te&&te.c(),p=b(),_=c("div"),v=E("Free mem: "),d=E(h),g=E("kb"),k=b(),A=c("div"),ae(T.$$.fragment),P=b(),ae(F.$$.fragment),I=b(),ae(R.$$.fragment),w=b(),ae($.$$.fragment),ie=b(),fe&&fe.c(),j=b(),Oe&&Oe.c(),U=b(),Ie&&Ie.c(),H=b(),G=c("div"),V=c("div"),K=c("a"),Z=c("img"),W=b(),x=c("div"),ae(_e.$$.fragment),ne=b(),N&&N.c(),me=b(),Y=c("div"),ke=c("a"),ae(Ee.$$.fragment),we=b(),C&&C.c(),a(l,"class","flex text-lg text-gray-100 p-2"),a(m,"class","flex-none my-auto"),a(_,"class","flex-none my-auto"),a(u,"class","flex-none my-auto p-2 flex space-x-4"),a(A,"class","flex-auto flex-wrap my-auto justify-center p-2"),a(Z,"class","gh-logo"),vs(Z.src,z=t[0]+Gr)||a(Z,"src",z),a(Z,"alt","GitHub repo"),a(K,"class","float-right"),a(K,"href","https://github.com/UtilitechAS/amsreader-firmware"),a(K,"target","_blank"),a(K,"rel","noreferrer"),a(K,"aria-label","GitHub"),a(V,"class","flex-none"),a(x,"class","flex-none my-auto px-2"),a(ke,"href",jt("")),a(ke,"target","_blank"),a(ke,"rel","noreferrer"),a(Y,"class","flex-none px-1 mt-1"),a(Y,"title","Documentation"),a(G,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),a(n,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),a(e,"class","hdr")},m(S,D){M(S,e,D),s(e,n),s(n,l),se(i,l,null),s(n,o),s(n,u),s(u,m),se(r,m,null),s(u,f),te&&te.m(u,null),s(u,p),s(u,_),s(_,v),s(_,d),s(_,g),s(n,k),s(n,A),se(T,A,null),s(A,P),se(F,A,null),s(A,I),se(R,A,null),s(A,w),se($,A,null),s(n,ie),fe&&fe.m(n,null),s(n,j),Oe&&Oe.m(n,null),s(n,U),Ie&&Ie.m(n,null),s(n,H),s(n,G),s(G,V),s(V,K),s(K,Z),s(G,W),s(G,x),se(_e,x,null),s(G,ne),N&&N.m(G,null),s(G,me),s(G,Y),s(Y,ke),se(Ee,ke,null),s(G,we),C&&C.m(G,null),Me=!0},p(S,[D]){const O={};D&36&&(O.$$scope={dirty:D,ctx:S}),i.$set(O);const J={};D&2&&(J.epoch=S[1].u),r.$set(J),S[1].t>-50?te?te.p(S,D):(te=Kr(S),te.c(),te.m(u,p)):te&&(te.d(1),te=null),(!Me||D&2)&&h!==(h=(S[1].m?(S[1].m/1e3).toFixed(1):"-")+"")&&X(d,h);const le={};D&6&&(le.text=S[2].booting?"Booting":S[1].v>2?S[1].v.toFixed(2)+"V":"ESP"),D&6&&(le.color=Ul(S[2].booting?2:S[1].em)),T.$set(le);const pe={};D&6&&(pe.color=Ul(S[2].booting?9:S[1].hm)),F.$set(pe);const ge={};D&2&&(ge.text=S[1].r?S[1].r.toFixed(0)+"dBm":"WiFi"),D&6&&(ge.color=Ul(S[2].booting?9:S[1].wm)),R.$set(ge);const Ae={};D&6&&(Ae.color=Ul(S[2].booting?9:S[1].mm)),$.$set(Ae),S[1].he<0||S[1].he>0?fe?fe.p(S,D):(fe=Yr(S),fe.c(),fe.m(n,j)):fe&&(fe.d(1),fe=null),S[1].me<0?Oe?Oe.p(S,D):(Oe=Qr(S),Oe.c(),Oe.m(n,U)):Oe&&(Oe.d(1),Oe=null),S[1].ee>0||S[1].ee<0?Ie?Ie.p(S,D):(Ie=Xr(S),Ie.c(),Ie.m(n,H)):Ie&&(Ie.d(1),Ie=null),(!Me||D&1&&!vs(Z.src,z=S[0]+Gr))&&a(Z,"src",z);const Fe={};D&2&&(Fe.timestamp=S[1].c?new Date(S[1].c*1e3):new Date(0)),D&4&&(Fe.offset=S[2].clock_offset),_e.$set(Fe),S[2].vndcfg&&S[2].usrcfg?N?D&4&&L(N,1):(N=Zr(S),N.c(),L(N,1),N.m(G,me)):N&&($e(),q(N,1,1,()=>{N=null}),De()),S[2].fwconsent===1&&S[3]?C?(C.p(S,D),D&12&&L(C,1)):(C=Jr(S),C.c(),L(C,1),C.m(G,null)):C&&($e(),q(C,1,1,()=>{C=null}),De())},i(S){Me||(L(i.$$.fragment,S),L(r.$$.fragment,S),L(T.$$.fragment,S),L(F.$$.fragment,S),L(R.$$.fragment,S),L($.$$.fragment,S),L(_e.$$.fragment,S),L(N),L(Ee.$$.fragment,S),L(C),Me=!0)},o(S){q(i.$$.fragment,S),q(r.$$.fragment,S),q(T.$$.fragment,S),q(F.$$.fragment,S),q(R.$$.fragment,S),q($.$$.fragment,S),q(_e.$$.fragment,S),q(N),q(Ee.$$.fragment,S),q(C),Me=!1},d(S){S&&y(e),oe(i),oe(r),te&&te.d(),oe(T),oe(F),oe(R),oe($),fe&&fe.d(),Oe&&Oe.d(),Ie&&Ie.d(),oe(_e),N&&N.d(),oe(Ee),C&&C.d()}}}function ym(t,e,n){let{basepath:l="/"}=e,{data:i={}}=e,o={},u={};function m(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(!li(o.board)||confirm(ys(Ce(o.chip,o.board))))&&(Yt.update(r=>(r.upgrading=!0,r)),h0(u.tag_name))}return Yt.subscribe(r=>{n(2,o=r),r.fwconsent===1&&Kc()}),Eo.subscribe(r=>{n(3,u=v0(o.version,r))}),t.$$set=r=>{"basepath"in r&&n(0,l=r.basepath),"data"in r&&n(1,i=r.data)},[l,i,o,u,m]}class Mm extends We{constructor(e){super(),He(this,e,ym,Cm,Be,{basepath:0,data:1})}}function Sm(t){let e,n,l,i;return{c(){e=je("svg"),n=je("path"),l=je("path"),a(n,"d",Xs(150,150,115,210,510)),a(n,"stroke","rgba(128, 128, 128, 0.15)"),a(n,"fill","none"),a(n,"stroke-width","55"),a(l,"d",i=Xs(150,150,115,210,210+300*t[0]/100)),a(l,"stroke",t[1]),a(l,"fill","none"),a(l,"stroke-width","55"),a(e,"viewBox","0 0 300 300"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"height","100%")},m(o,u){M(o,e,u),s(e,n),s(e,l)},p(o,[u]){u&1&&i!==(i=Xs(150,150,115,210,210+300*o[0]/100))&&a(l,"d",i),u&2&&a(l,"stroke",o[1])},i:be,o:be,d(o){o&&y(e)}}}function xr(t,e,n,l){var i=(l-90)*Math.PI/180;return{x:t+n*Math.cos(i),y:e+n*Math.sin(i)}}function Xs(t,e,n,l,i){var o=xr(t,e,n,i),u=xr(t,e,n,l),m=i-l<=180?"0":"1",r=["M",o.x,o.y,"A",n,n,0,m,0,u.x,u.y].join(" ");return r}function Tm(t,e,n){let{pct:l=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&n(0,l=o.pct),"color"in o&&n(1,i=o.color)},[l,i]}class Nm extends We{constructor(e){super(),He(this,e,Tm,Sm,Be,{pct:0,color:1})}}function eu(t){let e,n,l,i,o,u,m,r;return{c(){e=c("br"),n=b(),l=c("span"),i=E(t[3]),o=b(),u=c("span"),m=E(t[4]),r=E("/kWh"),a(l,"class","pl-sub"),a(u,"class","pl-snt")},m(f,p){M(f,e,p),M(f,n,p),M(f,l,p),s(l,i),M(f,o,p),M(f,u,p),s(u,m),s(u,r)},p(f,p){p&8&&X(i,f[3]),p&16&&X(m,f[4])},d(f){f&&y(e),f&&y(n),f&&y(l),f&&y(o),f&&y(u)}}}function Em(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k;n=new Nm({props:{pct:t[6],color:t[5](t[6],document.documentElement.classList.contains("dark"))}});let A=t[3]&&eu(t);return{c(){e=c("div"),ae(n.$$.fragment),l=b(),i=c("span"),o=c("span"),u=E(t[2]),m=b(),r=c("br"),f=b(),p=c("span"),_=E(t[0]),v=b(),h=c("span"),d=E(t[1]),g=b(),A&&A.c(),a(o,"class","pl-lab"),a(p,"class","pl-val"),a(h,"class","pl-unt"),a(i,"class","pl-ov"),a(e,"class","pl-root")},m(T,P){M(T,e,P),se(n,e,null),s(e,l),s(e,i),s(i,o),s(o,u),s(i,m),s(i,r),s(i,f),s(i,p),s(p,_),s(i,v),s(i,h),s(h,d),s(i,g),A&&A.m(i,null),k=!0},p(T,[P]){const F={};P&64&&(F.pct=T[6]),P&96&&(F.color=T[5](T[6],document.documentElement.classList.contains("dark"))),n.$set(F),(!k||P&4)&&X(u,T[2]),(!k||P&1)&&X(_,T[0]),(!k||P&2)&&X(d,T[1]),T[3]?A?A.p(T,P):(A=eu(T),A.c(),A.m(i,null)):A&&(A.d(1),A=null)},i(T){k||(L(n.$$.fragment,T),k=!0)},o(T){q(n.$$.fragment,T),k=!1},d(T){T&&y(e),oe(n),A&&A.d()}}}function Pm(t,e,n){let{val:l}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:m=""}=e,{subunit:r=""}=e,{colorFn:f}=e,p=0;return t.$$set=_=>{"val"in _&&n(0,l=_.val),"max"in _&&n(7,i=_.max),"unit"in _&&n(1,o=_.unit),"label"in _&&n(2,u=_.label),"sub"in _&&n(3,m=_.sub),"subunit"in _&&n(4,r=_.subunit),"colorFn"in _&&n(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&n(6,p=Math.min(l,i)/i*100)},[l,o,u,m,r,f,p,i]}class k0 extends We{constructor(e){super(),He(this,e,Pm,Em,Be,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function tu(t,e,n){const l=t.slice();return l[11]=e[n],l[13]=n,l}function lu(t,e,n){const l=t.slice();return l[11]=e[n],l[13]=n,l}function nu(t,e,n){const l=t.slice();return l[15]=e[n],l}function iu(t){let e,n,l,i,o,u,m=t[0].title&&su(t),r=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(o,u){M(o,e,u),s(e,l),i=bo(e,t[9].bind(e))},p(o,u){u&1&&n!==(n=o[0].title+"")&&X(l,n)},d(o){o&&y(e),i()}}}function ou(t){let e,n,l,i=t[15].label+"",o,u,m,r;return{c(){e=je("g"),n=je("line"),l=je("text"),o=E(i),a(n,"x2","100%"),a(l,"y","-4"),a(l,"x",u=t[15].align=="right"?"85%":""),a(e,"class",m="tick tick-"+t[15].value+" tick-"+t[15].color),a(e,"transform",r="translate(0, "+t[7](t[15].value)+")")},m(f,p){M(f,e,p),s(e,n),s(e,l),s(l,o)},p(f,p){p&1&&i!==(i=f[15].label+"")&&X(o,i),p&1&&u!==(u=f[15].align=="right"?"85%":"")&&a(l,"x",u),p&1&&m!==(m="tick tick-"+f[15].value+" tick-"+f[15].color)&&a(e,"class",m),p&129&&r!==(r="translate(0, "+f[7](f[15].value)+")")&&a(e,"transform",r)},d(f){f&&y(e)}}}function au(t){let e=!isNaN(t[7](t[15].value)),n,l=e&&ou(t);return{c(){l&&l.c(),n=it()},m(i,o){l&&l.m(i,o),M(i,n,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?l?l.p(i,o):(l=ou(i),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(i){l&&l.d(i),i&&y(n)}}}function ru(t){let e,n,l=(t[3]>20||t[13]%2==0)&&uu(t);return{c(){e=je("g"),l&&l.c(),a(e,"class","tick"),a(e,"transform",n="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){M(i,e,o),l&&l.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?l?l.p(i,o):(l=uu(i),l.c(),l.m(e,null)):l&&(l.d(1),l=null),o&80&&n!==(n="translate("+i[6](i[13])+","+i[4]+")")&&a(e,"transform",n)},d(i){i&&y(e),l&&l.d()}}}function uu(t){let e,n=t[11].label+"",l,i;return{c(){e=je("text"),l=E(n),a(e,"x",i=t[3]/2),a(e,"y","-4")},m(o,u){M(o,e,u),s(e,l)},p(o,u){u&1&&n!==(n=o[11].label+"")&&X(l,n),u&8&&i!==(i=o[3]/2)&&a(e,"x",i)},d(o){o&&y(e)}}}function fu(t){let e=!isNaN(t[6](t[13])),n,l=e&&ru(t);return{c(){l&&l.c(),n=it()},m(i,o){l&&l.m(i,o),M(i,n,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?l?l.p(i,o):(l=ru(i),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(i){l&&l.d(i),i&&y(n)}}}function cu(t){let e,n,l=t[11].value!==void 0&&mu(t),i=t[11].value2>1e-4&&du(t);return{c(){e=je("g"),l&&l.c(),n=je("g"),i&&i.c()},m(o,u){M(o,e,u),l&&l.m(e,null),M(o,n,u),i&&i.m(n,null)},p(o,u){o[11].value!==void 0?l?l.p(o,u):(l=mu(o),l.c(),l.m(e,null)):l&&(l.d(1),l=null),o[11].value2>1e-4?i?i.p(o,u):(i=du(o),i.c(),i.m(n,null)):i&&(i.d(1),i=null)},d(o){o&&y(e),l&&l.d(),o&&y(n),i&&i.d()}}}function mu(t){let e,n,l,i,o,u,m,r=t[3]>15&&_u(t);return{c(){e=je("rect"),r&&r.c(),m=it(),a(e,"x",n=t[6](t[13])+2),a(e,"y",l=t[7](t[11].value)),a(e,"width",i=t[3]-4),a(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),a(e,"fill",u=t[11].color)},m(f,p){M(f,e,p),r&&r.m(f,p),M(f,m,p)},p(f,p){p&64&&n!==(n=f[6](f[13])+2)&&a(e,"x",n),p&129&&l!==(l=f[7](f[11].value))&&a(e,"y",l),p&8&&i!==(i=f[3]-4)&&a(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&a(e,"height",o),p&1&&u!==(u=f[11].color)&&a(e,"fill",u),f[3]>15?r?r.p(f,p):(r=_u(f),r.c(),r.m(m.parentNode,m)):r&&(r.d(1),r=null)},d(f){f&&y(e),r&&r.d(f),f&&y(m)}}}function _u(t){let e,n=t[11].label+"",l,i,o,u,m,r,f=t[11].title&&pu(t);return{c(){e=je("text"),l=E(n),f&&f.c(),r=it(),a(e,"width",i=t[3]-4),a(e,"dominant-baseline","middle"),a(e,"text-anchor",o=t[3]t[7](0)-t[8]?t[11].color:"white"),a(e,"transform",m="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[11].labelAngle?t[11].labelAngle:t[3]p[7](0)-p[8]?p[11].color:"white")&&a(e,"fill",u),_&457&&m!==(m="translate("+(p[6](p[13])+p[3]/2)+" "+(p[7](p[11].value)>p[7](0)-p[8]?p[7](p[11].value)-p[8]:p[7](p[11].value)+10)+") rotate("+(p[11].labelAngle?p[11].labelAngle:p[3]15&&hu(t);return{c(){e=je("rect"),r&&r.c(),m=it(),a(e,"x",n=t[6](t[13])+2),a(e,"y",l=t[7](0)),a(e,"width",i=t[3]-4),a(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),a(e,"fill",u=t[11].color2?t[11].color2:t[11].color)},m(f,p){M(f,e,p),r&&r.m(f,p),M(f,m,p)},p(f,p){p&64&&n!==(n=f[6](f[13])+2)&&a(e,"x",n),p&128&&l!==(l=f[7](0))&&a(e,"y",l),p&8&&i!==(i=f[3]-4)&&a(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&a(e,"height",o),p&1&&u!==(u=f[11].color2?f[11].color2:f[11].color)&&a(e,"fill",u),f[3]>15?r?r.p(f,p):(r=hu(f),r.c(),r.m(m.parentNode,m)):r&&(r.d(1),r=null)},d(f){f&&y(e),r&&r.d(f),f&&y(m)}}}function hu(t){let e,n=t[11].label2+"",l,i,o,u,m,r=t[11].title2&&vu(t);return{c(){e=je("text"),l=E(n),r&&r.c(),m=it(),a(e,"width",i=t[3]-4),a(e,"dominant-baseline","middle"),a(e,"text-anchor","middle"),a(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(i,o){M(i,e,o),l&&l.m(e,null),n=bo(e,t[10].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?l?l.p(i,o):(l=iu(i),l.c(),l.m(e,null)):l&&(l.d(1),l=null)},i:be,o:be,d(i){i&&y(e),l&&l.d(),n()}}}let fn=30;function $m(t,e,n){let{config:l}=e,i,o,u,m,r,f,p,_=0;function v(){_=this.clientHeight,n(5,_)}function h(){i=this.clientWidth,o=this.clientHeight,n(1,i),n(2,o)}return t.$$set=d=>{"config"in d&&n(0,l=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){n(4,f=o-_);let d=i-(l.padding.left+l.padding.right);n(3,u=d/l.points.length),n(8,p=ul.y.max?A=l.padding.bottom:kf||A<0?0:A})}},[l,i,o,u,f,_,m,r,p,v,h]}class _n extends We{constructor(e){super(),He(this,e,$m,Am,Be,{config:0})}}function Dm(t){let e,n;return e=new _n({props:{config:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,[i]){const o={};i&1&&(o.config=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Lm(t,e,n){let{u1:l}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,m={};function r(f){return{label:Ne(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:Gc(f||0,document.documentElement.classList.contains("dark"))}}return t.$$set=f=>{"u1"in f&&n(1,l=f.u1),"u2"in f&&n(2,i=f.u2),"u3"in f&&n(3,o=f.u3),"ds"in f&&n(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],p=[];l>0&&(f.push({label:u===1?"L1-L2":"L1"}),p.push(r(l))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),p.push(r(i))),o>0&&(f.push({label:u===1?"L2-L3":"L3"}),p.push(r(o))),n(0,m={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:p})}},[m,l,i,o,u]}class Im extends We{constructor(e){super(),He(this,e,Lm,Dm,Be,{u1:1,u2:2,u3:3,ds:4})}}function Rm(t){let e,n,l,i,o,u,m,r=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,p,_,v,h,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",k,A,T,P,F,I,R,w=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",$,ie,j,U,H,G,V=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",K,Z;return{c(){e=c("div"),n=c("strong"),n.textContent="Reactive",l=b(),i=c("div"),o=c("div"),o.textContent="Instant in",u=b(),m=c("div"),f=E(r),p=E(" VAr"),_=b(),v=c("div"),v.textContent="Instant out",h=b(),d=c("div"),k=E(g),A=E(" VAr"),T=b(),P=c("div"),F=c("div"),F.textContent="Total in",I=b(),R=c("div"),$=E(w),ie=E(" kVArh"),j=b(),U=c("div"),U.textContent="Total out",H=b(),G=c("div"),K=E(V),Z=E(" kVArh"),a(m,"class","text-right"),a(d,"class","text-right"),a(i,"class","grid grid-cols-2 mt-4"),a(R,"class","text-right"),a(G,"class","text-right"),a(P,"class","grid grid-cols-2 mt-4"),a(e,"class","mx-2 text-sm")},m(z,W){M(z,e,W),s(e,n),s(e,l),s(e,i),s(i,o),s(i,u),s(i,m),s(m,f),s(m,p),s(i,_),s(i,v),s(i,h),s(i,d),s(d,k),s(d,A),s(e,T),s(e,P),s(P,F),s(P,I),s(P,R),s(R,$),s(R,ie),s(P,j),s(P,U),s(P,H),s(P,G),s(G,K),s(G,Z)},p(z,[W]){W&1&&r!==(r=(typeof z[0]<"u"?z[0].toFixed(0):"-")+"")&&X(f,r),W&2&&g!==(g=(typeof z[1]<"u"?z[1].toFixed(0):"-")+"")&&X(k,g),W&4&&w!==(w=(typeof z[2]<"u"?z[2].toFixed(1):"-")+"")&&X($,w),W&8&&V!==(V=(typeof z[3]<"u"?z[3].toFixed(1):"-")+"")&&X(K,V)},i:be,o:be,d(z){z&&y(e)}}}function Fm(t,e,n){let{importInstant:l}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=e;return t.$$set=m=>{"importInstant"in m&&n(0,l=m.importInstant),"exportInstant"in m&&n(1,i=m.exportInstant),"importTotal"in m&&n(2,o=m.importTotal),"exportTotal"in m&&n(3,u=m.exportTotal)},[l,i,o,u]}class Om extends We{constructor(e){super(),He(this,e,Fm,Rm,Be,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function gu(t){let e;function n(o,u){return o[3]?Bm:qm}let l=n(t),i=l(t);return{c(){i.c(),e=it()},m(o,u){i.m(o,u),M(o,e,u)},p(o,u){l===(l=n(o))&&i?i.p(o,u):(i.d(1),i=l(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&y(e)}}}function qm(t){let e,n,l,i,o,u,m=Ne(t[1].h.u,2)+"",r,f,p,_,v,h,d=Ne(t[1].d.u,1)+"",g,k,A,T,P,F,I=Ne(t[1].m.u)+"",R,w,$,ie,j,U,H=Ne(t[0].last_month.u)+"",G,V,K,Z,z=t[4]&&ku(t);return{c(){e=c("strong"),e.textContent="Consumption",n=b(),l=c("div"),i=c("div"),i.textContent="Hour",o=b(),u=c("div"),r=E(m),f=E(" kWh"),p=b(),_=c("div"),_.textContent="Day",v=b(),h=c("div"),g=E(d),k=E(" kWh"),A=b(),T=c("div"),T.textContent="Month",P=b(),F=c("div"),R=E(I),w=E(" kWh"),$=b(),ie=c("div"),ie.textContent="Last month",j=b(),U=c("div"),G=E(H),V=E(" kWh"),K=b(),z&&z.c(),Z=it(),a(u,"class","text-right"),a(h,"class","text-right"),a(F,"class","text-right"),a(U,"class","text-right"),a(l,"class","grid grid-cols-2 mb-3")},m(W,x){M(W,e,x),M(W,n,x),M(W,l,x),s(l,i),s(l,o),s(l,u),s(u,r),s(u,f),s(l,p),s(l,_),s(l,v),s(l,h),s(h,g),s(h,k),s(l,A),s(l,T),s(l,P),s(l,F),s(F,R),s(F,w),s(l,$),s(l,ie),s(l,j),s(l,U),s(U,G),s(U,V),M(W,K,x),z&&z.m(W,x),M(W,Z,x)},p(W,x){x&2&&m!==(m=Ne(W[1].h.u,2)+"")&&X(r,m),x&2&&d!==(d=Ne(W[1].d.u,1)+"")&&X(g,d),x&2&&I!==(I=Ne(W[1].m.u)+"")&&X(R,I),x&1&&H!==(H=Ne(W[0].last_month.u)+"")&&X(G,H),W[4]?z?z.p(W,x):(z=ku(W),z.c(),z.m(Z.parentNode,Z)):z&&(z.d(1),z=null)},d(W){W&&y(e),W&&y(n),W&&y(l),W&&y(K),z&&z.d(W),W&&y(Z)}}}function Bm(t){let e,n,l,i,o,u,m=Ne(t[1].h.u,2)+"",r,f,p,_,v,h,d,g=Ne(t[1].d.u,1)+"",k,A,T,P,F,I,R,w=Ne(t[1].m.u)+"",$,ie,j,U,H,G,V,K=Ne(t[0].last_month.u)+"",Z,z,W,x,_e,ne,me,Y,ke,Ee,we,Me=Ne(t[1].h.p,2)+"",te,fe,Oe,Ie,N,C,S,D=Ne(t[1].d.p,1)+"",O,J,le,pe,ge,Ae,Fe,ce=Ne(t[1].m.p)+"",Pe,ze,ct,Ke,rt,Ge,mt,Ue=Ne(t[0].last_month.p)+"",Nt,_t,dt,et,Re=t[4]&&wu(t),tt=t[4]&&Cu(t),Le=t[4]&&yu(t),Je=t[4]&&Mu(t),at=t[4]&&Su(t),qe=t[4]&&Tu(t),ye=t[4]&&Nu(t),ve=t[4]&&Eu(t);return{c(){e=c("strong"),e.textContent="Import",n=b(),l=c("div"),i=c("div"),i.textContent="Hour",o=b(),u=c("div"),r=E(m),f=E(" kWh"),p=b(),Re&&Re.c(),_=b(),v=c("div"),v.textContent="Day",h=b(),d=c("div"),k=E(g),A=E(" kWh"),T=b(),tt&&tt.c(),P=b(),F=c("div"),F.textContent="Month",I=b(),R=c("div"),$=E(w),ie=E(" kWh"),j=b(),Le&&Le.c(),U=b(),H=c("div"),H.textContent="Last mo.",G=b(),V=c("div"),Z=E(K),z=E(" kWh"),W=b(),Je&&Je.c(),_e=b(),ne=c("strong"),ne.textContent="Export",me=b(),Y=c("div"),ke=c("div"),ke.textContent="Hour",Ee=b(),we=c("div"),te=E(Me),fe=E(" kWh"),Oe=b(),at&&at.c(),Ie=b(),N=c("div"),N.textContent="Day",C=b(),S=c("div"),O=E(D),J=E(" kWh"),le=b(),qe&&qe.c(),pe=b(),ge=c("div"),ge.textContent="Month",Ae=b(),Fe=c("div"),Pe=E(ce),ze=E(" kWh"),ct=b(),ye&&ye.c(),Ke=b(),rt=c("div"),rt.textContent="Last mo.",Ge=b(),mt=c("div"),Nt=E(Ue),_t=E(" kWh"),dt=b(),ve&&ve.c(),a(u,"class","text-right"),a(d,"class","text-right"),a(R,"class","text-right"),a(V,"class","text-right"),a(l,"class",x="grid grid-cols-"+t[5]+" mb-3"),a(we,"class","text-right"),a(S,"class","text-right"),a(Fe,"class","text-right"),a(mt,"class","text-right"),a(Y,"class",et="grid grid-cols-"+t[5])},m(de,Ve){M(de,e,Ve),M(de,n,Ve),M(de,l,Ve),s(l,i),s(l,o),s(l,u),s(u,r),s(u,f),s(l,p),Re&&Re.m(l,null),s(l,_),s(l,v),s(l,h),s(l,d),s(d,k),s(d,A),s(l,T),tt&&tt.m(l,null),s(l,P),s(l,F),s(l,I),s(l,R),s(R,$),s(R,ie),s(l,j),Le&&Le.m(l,null),s(l,U),s(l,H),s(l,G),s(l,V),s(V,Z),s(V,z),s(l,W),Je&&Je.m(l,null),M(de,_e,Ve),M(de,ne,Ve),M(de,me,Ve),M(de,Y,Ve),s(Y,ke),s(Y,Ee),s(Y,we),s(we,te),s(we,fe),s(Y,Oe),at&&at.m(Y,null),s(Y,Ie),s(Y,N),s(Y,C),s(Y,S),s(S,O),s(S,J),s(Y,le),qe&&qe.m(Y,null),s(Y,pe),s(Y,ge),s(Y,Ae),s(Y,Fe),s(Fe,Pe),s(Fe,ze),s(Y,ct),ye&&ye.m(Y,null),s(Y,Ke),s(Y,rt),s(Y,Ge),s(Y,mt),s(mt,Nt),s(mt,_t),s(Y,dt),ve&&ve.m(Y,null)},p(de,Ve){Ve&2&&m!==(m=Ne(de[1].h.u,2)+"")&&X(r,m),de[4]?Re?Re.p(de,Ve):(Re=wu(de),Re.c(),Re.m(l,_)):Re&&(Re.d(1),Re=null),Ve&2&&g!==(g=Ne(de[1].d.u,1)+"")&&X(k,g),de[4]?tt?tt.p(de,Ve):(tt=Cu(de),tt.c(),tt.m(l,P)):tt&&(tt.d(1),tt=null),Ve&2&&w!==(w=Ne(de[1].m.u)+"")&&X($,w),de[4]?Le?Le.p(de,Ve):(Le=yu(de),Le.c(),Le.m(l,U)):Le&&(Le.d(1),Le=null),Ve&1&&K!==(K=Ne(de[0].last_month.u)+"")&&X(Z,K),de[4]?Je?Je.p(de,Ve):(Je=Mu(de),Je.c(),Je.m(l,null)):Je&&(Je.d(1),Je=null),Ve&32&&x!==(x="grid grid-cols-"+de[5]+" mb-3")&&a(l,"class",x),Ve&2&&Me!==(Me=Ne(de[1].h.p,2)+"")&&X(te,Me),de[4]?at?at.p(de,Ve):(at=Su(de),at.c(),at.m(Y,Ie)):at&&(at.d(1),at=null),Ve&2&&D!==(D=Ne(de[1].d.p,1)+"")&&X(O,D),de[4]?qe?qe.p(de,Ve):(qe=Tu(de),qe.c(),qe.m(Y,pe)):qe&&(qe.d(1),qe=null),Ve&2&&ce!==(ce=Ne(de[1].m.p)+"")&&X(Pe,ce),de[4]?ye?ye.p(de,Ve):(ye=Nu(de),ye.c(),ye.m(Y,Ke)):ye&&(ye.d(1),ye=null),Ve&1&&Ue!==(Ue=Ne(de[0].last_month.p)+"")&&X(Nt,Ue),de[4]?ve?ve.p(de,Ve):(ve=Eu(de),ve.c(),ve.m(Y,null)):ve&&(ve.d(1),ve=null),Ve&32&&et!==(et="grid grid-cols-"+de[5])&&a(Y,"class",et)},d(de){de&&y(e),de&&y(n),de&&y(l),Re&&Re.d(),tt&&tt.d(),Le&&Le.d(),Je&&Je.d(),de&&y(_e),de&&y(ne),de&&y(me),de&&y(Y),at&&at.d(),qe&&qe.d(),ye&&ye.d(),ve&&ve.d()}}}function ku(t){let e,n,l,i,o,u,m=Ne(t[1].h.c,2)+"",r,f,p,_,v,h,d,g=Ne(t[1].d.c,1)+"",k,A,T,P,F,I,R,w=Ne(t[1].m.c)+"",$,ie,j,U,H,G,V,K=Ne(t[0].last_month.c)+"",Z,z,W;return{c(){e=c("strong"),e.textContent="Cost",n=b(),l=c("div"),i=c("div"),i.textContent="Hour",o=b(),u=c("div"),r=E(m),f=b(),p=E(t[2]),_=b(),v=c("div"),v.textContent="Day",h=b(),d=c("div"),k=E(g),A=b(),T=E(t[2]),P=b(),F=c("div"),F.textContent="Month",I=b(),R=c("div"),$=E(w),ie=b(),j=E(t[2]),U=b(),H=c("div"),H.textContent="Last month",G=b(),V=c("div"),Z=E(K),z=b(),W=E(t[2]),a(u,"class","text-right"),a(d,"class","text-right"),a(R,"class","text-right"),a(V,"class","text-right"),a(l,"class","grid grid-cols-2")},m(x,_e){M(x,e,_e),M(x,n,_e),M(x,l,_e),s(l,i),s(l,o),s(l,u),s(u,r),s(u,f),s(u,p),s(l,_),s(l,v),s(l,h),s(l,d),s(d,k),s(d,A),s(d,T),s(l,P),s(l,F),s(l,I),s(l,R),s(R,$),s(R,ie),s(R,j),s(l,U),s(l,H),s(l,G),s(l,V),s(V,Z),s(V,z),s(V,W)},p(x,_e){_e&2&&m!==(m=Ne(x[1].h.c,2)+"")&&X(r,m),_e&4&&X(p,x[2]),_e&2&&g!==(g=Ne(x[1].d.c,1)+"")&&X(k,g),_e&4&&X(T,x[2]),_e&2&&w!==(w=Ne(x[1].m.c)+"")&&X($,w),_e&4&&X(j,x[2]),_e&1&&K!==(K=Ne(x[0].last_month.c)+"")&&X(Z,K),_e&4&&X(W,x[2])},d(x){x&&y(e),x&&y(n),x&&y(l)}}}function wu(t){let e,n=Ne(t[1].h.c,2)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].h.c,2)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Cu(t){let e,n=Ne(t[1].d.c,1)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].d.c,1)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function yu(t){let e,n=Ne(t[1].m.c)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].m.c)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Mu(t){let e,n=Ne(t[0].last_month.c)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&1&&n!==(n=Ne(u[0].last_month.c)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Su(t){let e,n=Ne(t[1].h.i,2)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].h.i,2)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Tu(t){let e,n=Ne(t[1].d.i,1)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].d.i,1)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Nu(t){let e,n=Ne(t[1].m.i)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].m.i)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Eu(t){let e,n=Ne(t[0].last_month.i)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&1&&n!==(n=Ne(u[0].last_month.i)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Um(t){let e,n,l,i,o,u,m=t[1]&&gu(t);return{c(){e=c("div"),n=c("strong"),n.textContent="Real time calculation",l=b(),i=c("br"),o=c("br"),u=b(),m&&m.c(),a(e,"class","mx-2 text-sm")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),s(e,u),m&&m.m(e,null)},p(r,[f]){r[1]?m?m.p(r,f):(m=gu(r),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},i:be,o:be,d(r){r&&y(e),m&&m.d()}}}function jm(t,e,n){let{sysinfo:l}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,m=!1,r=3;return t.$$set=f=>{"sysinfo"in f&&n(0,l=f.sysinfo),"data"in f&&n(1,i=f.data),"currency"in f&&n(2,o=f.currency),"hasExport"in f&&n(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(n(4,m=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),n(5,r=m?3:2))},[l,i,o,u,m,r]}class Hm extends We{constructor(e){super(),He(this,e,jm,Um,Be,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Wm(t){let e,n,l=jr(t[0].source)+"",i,o,u,m,r;return m=new _n({props:{config:t[1]}}),{c(){e=c("a"),n=E("Provided by: "),i=E(l),u=b(),ae(m.$$.fragment),a(e,"href",o=Hr(t[0].source)),a(e,"target","_blank"),a(e,"class","text-xs float-right z-40")},m(f,p){M(f,e,p),s(e,n),s(e,i),M(f,u,p),se(m,f,p),r=!0},p(f,[p]){(!r||p&1)&&l!==(l=jr(f[0].source)+"")&&X(i,l),(!r||p&1&&o!==(o=Hr(f[0].source)))&&a(e,"href",o);const _={};p&2&&(_.config=f[1]),m.$set(_)},i(f){r||(L(m.$$.fragment,f),r=!0)},o(f){q(m.$$.fragment,f),r=!1},d(f){f&&y(e),f&&y(u),oe(m,f)}}}function zm(t,e,n){let{json:l}=e,{sysinfo:i}=e,o={},u,m,r=document.documentElement.classList.contains("dark");return t.$$set=f=>{"json"in f&&n(0,l=f.json),"sysinfo"in f&&n(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let f=l.currency,p=new Date().getUTCHours(),_=0,v=0,h=0,d=[],g=[],k=[];n(4,m=n(3,u=0));let A=new Date;for(kl(A,i.clock_offset-(24+A.getHours()-A.getUTCHours())%24),_=p;_<24&&(v=l[Ye(h++)],v!=null);_++)g.push({label:Ye(A.getHours())}),k.push(v*100),n(4,m=Math.min(m,v*100)),n(3,u=Math.max(u,v*100)),kl(A,1);for(_=0;_<24&&(v=l[Ye(h++)],v!=null);_++)g.push({label:Ye(A.getHours())}),k.push(v*100),n(4,m=Math.min(m,v*100)),n(3,u=Math.max(u,v*100)),kl(A,1);if(m>-100&&u<100){switch(f){case"NOK":case"DKK":f="\xF8re";break;case"SEK":f="\xF6re";break;case"EUR":f="cent";break;case"CHF":f="rp.";break;default:f=f+"/100"}for(n(4,m*=100),n(3,u*=100),_=0;_=0?R.toFixed(w):"",title:R>=0?R.toFixed(2)+" "+f:"",value:v>=0?Math.abs(v):0,label2:R<0?R.toFixed(w):"",title2:R<0?R.toFixed(2)+" "+f:"",value2:v<0?Math.abs(v):0,color:r?"#5c2da5":"#7c3aed"})}let P=Math.max(u,Math.abs(m));if(m<0){n(4,m=Math.min(P/4*-1,m));let R=Math.ceil(Math.abs(m)/P*4),w=m/R;for(_=1;_{"json"in f&&n(1,l=f.json),"sysinfo"in f&&n(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],v=[];n(4,m=n(3,u=0));let h=kl(new Date,-24),d=new Date().getUTCHours();for(kl(h,i.clock_offset-(24+h.getHours()-h.getUTCHours())%24),f=d;f<24;f++){let T=l["i"+Ye(f)],P=l["e"+Ye(f)];T===void 0&&(T=0),P===void 0&&(P=0),_.push({label:Ye(h.getHours())}),v.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:P.toFixed(1),title2:P.toFixed(2)+" kWh",value2:P*10,color:r?"#5c2da5":"#7c3aed",color2:r?"#27728e":"#37829e"}),n(4,m=Math.max(m,P*10)),n(3,u=Math.max(u,T*10)),kl(h,1)}for(f=0;f{"json"in f&&n(1,l=f.json),"sysinfo"in f&&n(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],v=[];n(4,m=n(3,u=0));let h=new Date,d=new Date;for(kl(h,i.clock_offset-(24+h.getHours()-h.getUTCHours())%24),kl(d,i.clock_offset-(24+d.getHours()-d.getUTCHours())%24),d.setDate(0),f=h.getDate();f<=d.getDate();f++){let T=l["i"+Ye(f)],P=l["e"+Ye(f)];T===void 0&&(T=0),P===void 0&&(P=0),_.push({label:Ye(f)}),v.push({label:T.toFixed(T<10?1:0),title:T.toFixed(2)+" kWh",value:T,label2:P.toFixed(P<10?1:0),title2:P.toFixed(2)+" kWh",value2:P,color:r?"#5c2da5":"#7c3aed",color2:r?"#27728e":"#37829e"}),n(4,m=Math.max(m,P)),n(3,u=Math.max(u,T))}for(f=1;f{"json"in r&&n(1,l=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,f=0,p=[],_=[],v=[];l.s&&l.s.forEach((g,k)=>{var A=g.n?g.n:g.a;f=g.v,f==-127&&(f=0),_.push({label:A.slice(-4)}),v.push({label:f.toFixed(1),value:f,color:i?"#5c2da5":"#7c3aed"}),n(3,m=Math.min(m,f)),n(2,u=Math.max(u,f))}),n(2,u=Math.ceil(u)),n(3,m=Math.floor(m));let h=u;m<0&&(h+=Math.abs(m));let d=h/4;for(r=0;r<5;r++)f=m+d*r,p.push({value:f,label:f.toFixed(1)});n(0,o={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:m,max:u,ticks:p},x:{ticks:_},points:v})}},[o,l,u,m]}class e_ extends We{constructor(e){super(),He(this,e,xm,Jm,Be,{json:1})}}function t_(t){let e,n;return e=new _n({props:{config:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,[i]){const o={};i&1&&(o.config=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}let l_=0;function n_(t,e,n){let l=document.documentElement.classList.contains("dark"),i={},o=0,u;return p0.subscribe(m=>{n(2,u=m)}),_0(),t.$$.update=()=>{if(t.$$.dirty&6){let m=0,r=[],f=[],p=[];if(r.push({value:0,label:0}),u&&u.p)for(m=0;m0?Ye(_.d)+"."+Mi[new Date().getMonth()]:"-"}),n(1,o=Math.max(o,_.v))}if(u&&u.t){for(m=0;m=o)break;r.push({value:_,label:_})}r.push({label:u.m.toFixed(1),align:"right",color:"green",value:u.m})}u&&u.c&&(r.push({label:u.c.toFixed(0),color:"orange",value:u.c}),n(1,o=Math.max(o,u.c))),n(1,o=Math.ceil(o)),n(0,i={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:l_,max:o,ticks:r},x:{ticks:f},points:p})}},[i,o,u]}class i_ extends We{constructor(e){super(),He(this,e,n_,t_,Be,{})}}function Pu(t,e,n){const l=t.slice();return l[20]=e[n],l[22]=n,l}function Au(t,e,n){const l=t.slice();return l[23]=e[n],l}function $u(t){let e,n,l,i,o,u=t[7],m=[];for(let p=0;pt[15].call(e))},m(f,p){M(f,e,p),s(e,n),s(n,l),s(n,i),s(n,o),s(e,u),r&&r.m(e,null),m=bo(e,t[15].bind(e))},p(f,[p]){p&1024&&X(i,f[10]),f[7]?r?r.p(f,p):(r=$u(f),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},i:be,o:be,d(f){f&&y(e),r&&r.d(),m()}}}let o_=12;function a_(t,e,n){let l=document.documentElement.classList.contains("dark"),i;d0.subscribe(w=>{n(12,i=w)});let o,u=0,m=0;function r(){o&&clearTimeout(o),o=setTimeout(r,1e4),i.data.unshift(m),n(12,i.data=i.data.slice(0,i.size),i),u+=10}o0.subscribe(w=>{u==0&&(o&&clearTimeout(o),o=setTimeout(r,1e4)),m=w.i-w.e,u=w.u});let f,p,_,v,h,d,g,k,A,T,P,F,I;function R(){_=this.clientWidth,v=this.clientHeight,n(0,_),n(1,v)}return t.$$.update=()=>{if(t.$$.dirty&29183&&(n(2,h=parseInt(v)-50),n(3,d=_-35),n(9,F=d/i.size),n(14,p=0),n(13,f=0),i.data)){for(let $ in i.data){let ie=i.data[$];n(13,f=Math.max(Math.ceil(ie/1e3)*1e3,f)),n(14,p=Math.min(Math.ceil(ie/1e3)*1e3,p))}n(10,I=f>2500?"kW":"W"),n(7,T=[]);for(let $=p;$2500?($/1e3).toFixed(1):$});n(8,P=[]);for(let $=p;$900?I/1e3:I)+(I>900?"k":"")+i,title:I.toFixed(2)+" "+i,value:isNaN(I)?0:I,color:A(I?I/g*100:0,document.documentElement.classList.contains("dark")),label2:Ne(R>900?R/1e3:R)+(R>900?"k":"")+i,title2:R.toFixed(2)+" "+i,value2:isNaN(R)?0:R,color2:T(R?R/k*100:0)}}return t.$$set=I=>{"title"in I&&n(1,l=I.title),"unit"in I&&n(2,i=I.unit),"l1"in I&&n(3,o=I.l1),"l2"in I&&n(4,u=I.l2),"l2x"in I&&n(5,m=I.l2x),"l3"in I&&n(6,r=I.l3),"l1i"in I&&n(7,f=I.l1i),"l2i"in I&&n(8,p=I.l2i),"l3i"in I&&n(9,_=I.l3i),"l1e"in I&&n(10,v=I.l1e),"l2e"in I&&n(11,h=I.l2e),"l3e"in I&&n(12,d=I.l3e),"maxImport"in I&&n(13,g=I.maxImport),"maxExport"in I&&n(14,k=I.maxExport),"importColorFn"in I&&n(15,A=I.importColorFn),"exportColorFn"in I&&n(16,T=I.exportColorFn)},t.$$.update=()=>{if(t.$$.dirty&32762){let I=[],R=[];o&&(I.push({label:"L1"}),R.push(F(f,v))),u&&(m?(I.push({label:"L2"}),R.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(I.push({label:"L2"}),R.push(F(p,h)))),r&&(I.push({label:"L3"}),R.push(F(_,d)));let w=[];k&&(w.push({value:-k,label:"-100%"}),w.push({value:-k/4*3,label:"-75%"}),w.push({value:-k/2,label:"-50%"}),w.push({value:-k/4,label:"-25%"})),w.push({value:0,label:"0%"}),g&&(w.push({value:g/4,label:"25%"}),w.push({value:g/2,label:"50%"}),w.push({value:g/4*3,label:"75%"}),w.push({value:g,label:"100%"})),n(0,P={title:l,padding:{top:20,right:15,bottom:20,left:35},y:{min:-k,max:g,ticks:w},x:{ticks:I},points:R})}},[P,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T]}class Po extends We{constructor(e){super(),He(this,e,f_,u_,Be,{title:1,unit:2,l1:3,l2:4,l2x:5,l3:6,l1i:7,l2i:8,l3i:9,l1e:10,l2e:11,l3e:12,maxImport:13,maxExport:14,importColorFn:15,exportColorFn:16})}}function Ou(t){let e,n,l,i,o,u,m=(t[0].mt?Cs(t[0].mt):"-")+"",r,f,p,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",v,h,d;return i=new k0({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:yo}}),{c(){e=c("div"),n=c("div"),l=c("div"),ae(i.$$.fragment),o=b(),u=c("div"),r=E(m),f=b(),p=c("div"),v=E(_),h=E(" kWh"),a(l,"class","col-span-2"),a(p,"class","text-right"),a(n,"class","grid grid-cols-2"),a(e,"class","cnt")},m(g,k){M(g,e,k),s(e,n),s(n,l),se(i,l,null),s(n,o),s(n,u),s(u,r),s(n,f),s(n,p),s(p,v),s(p,h),d=!0},p(g,k){const A={};k&1&&(A.val=g[0].i?g[0].i:0),k&1&&(A.max=g[0].im?g[0].im:15e3),k&1&&(A.sub=g[0].p),k&1&&(A.subunit=g[0].pc),i.$set(A),(!d||k&1)&&m!==(m=(g[0].mt?Cs(g[0].mt):"-")+"")&&X(r,m),(!d||k&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&X(v,_)},i(g){d||(L(i.$$.fragment,g),d=!0)},o(g){q(i.$$.fragment,g),d=!1},d(g){g&&y(e),oe(i)}}}function qu(t){let e,n,l,i,o,u,m,r,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",p,_,v;return i=new k0({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:Si}}),{c(){e=c("div"),n=c("div"),l=c("div"),ae(i.$$.fragment),o=b(),u=c("div"),m=b(),r=c("div"),p=E(f),_=E(" kWh"),a(l,"class","col-span-2"),a(r,"class","text-right"),a(n,"class","grid grid-cols-2"),a(e,"class","cnt")},m(h,d){M(h,e,d),s(e,n),s(n,l),se(i,l,null),s(n,o),s(n,u),s(n,m),s(n,r),s(r,p),s(r,_),v=!0},p(h,d){const g={};d&1&&(g.val=h[0].e?h[0].e:0),d&1&&(g.max=h[0].om?h[0].om*1e3:1e4),i.$set(g),(!v||d&1)&&f!==(f=(h[0].ec?h[0].ec.toFixed(1):"-")+"")&&X(p,f)},i(h){v||(L(i.$$.fragment,h),v=!0)},o(h){q(i.$$.fragment,h),v=!1},d(h){h&&y(e),oe(i)}}}function Bu(t){let e,n,l=t[0].l1&&Uu(t);return{c(){e=c("div"),l&&l.c(),a(e,"class","cnt")},m(i,o){M(i,e,o),l&&l.m(e,null),n=!0},p(i,o){i[0].l1?l?(l.p(i,o),o&1&&L(l,1)):(l=Uu(i),l.c(),L(l,1),l.m(e,null)):l&&($e(),q(l,1,1,()=>{l=null}),De())},i(i){n||(L(l),n=!0)},o(i){q(l),n=!1},d(i){i&&y(e),l&&l.d()}}}function Uu(t){let e,n;return e=new Im({props:{u1:t[0].l1.u,u2:t[0].l2.u,u3:t[0].l3.u,ds:t[0].ds}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.u1=l[0].l1.u),i&1&&(o.u2=l[0].l2.u),i&1&&(o.u3=l[0].l3.u),i&1&&(o.ds=l[0].ds),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function ju(t){let e,n,l=t[0].l1&&Hu(t);return{c(){e=c("div"),l&&l.c(),a(e,"class","cnt")},m(i,o){M(i,e,o),l&&l.m(e,null),n=!0},p(i,o){i[0].l1?l?(l.p(i,o),o&1&&L(l,1)):(l=Hu(i),l.c(),L(l,1),l.m(e,null)):l&&($e(),q(l,1,1,()=>{l=null}),De())},i(i){n||(L(l),n=!0)},o(i){q(l),n=!1},d(i){i&&y(e),l&&l.d()}}}function Hu(t){let e,n;return e=new Po({props:{title:"Amperage",unit:"A",importColorFn:yo,exportColorFn:Si,maxImport:t[0].mf,maxExport:t[0].om?t[0].om/230:0,l1:t[0].l1&&t[0].l1.u>100,l2:t[0].l2&&t[0].l2.u>100,l3:t[0].l3&&t[0].l3.u>100,l2x:t[0].i2e,l1i:Math.max(t[0].l1.i,0),l2i:Math.max(t[0].l2.i,0),l3i:Math.max(t[0].l3.i,0),l1e:Math.min(t[0].l1.i*-1,0),l2e:Math.min(t[0].l2.i*-1,0),l3e:Math.min(t[0].l3.i*-1,0)}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.maxImport=l[0].mf),i&1&&(o.maxExport=l[0].om?l[0].om/230:0),i&1&&(o.l1=l[0].l1&&l[0].l1.u>100),i&1&&(o.l2=l[0].l2&&l[0].l2.u>100),i&1&&(o.l3=l[0].l3&&l[0].l3.u>100),i&1&&(o.l2x=l[0].i2e),i&1&&(o.l1i=Math.max(l[0].l1.i,0)),i&1&&(o.l2i=Math.max(l[0].l2.i,0)),i&1&&(o.l3i=Math.max(l[0].l3.i,0)),i&1&&(o.l1e=Math.min(l[0].l1.i*-1,0)),i&1&&(o.l2e=Math.min(l[0].l2.i*-1,0)),i&1&&(o.l3e=Math.min(l[0].l3.i*-1,0)),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Wu(t){let e,n,l=t[0].l1&&zu(t);return{c(){e=c("div"),l&&l.c(),a(e,"class","cnt")},m(i,o){M(i,e,o),l&&l.m(e,null),n=!0},p(i,o){i[0].l1?l?(l.p(i,o),o&1&&L(l,1)):(l=zu(i),l.c(),L(l,1),l.m(e,null)):l&&($e(),q(l,1,1,()=>{l=null}),De())},i(i){n||(L(l),n=!0)},o(i){q(l),n=!1},d(i){i&&y(e),l&&l.d()}}}function zu(t){let e,n;return e=new Po({props:{title:"Phase power",unit:"W",importColorFn:yo,exportColorFn:Si,maxImport:(t[0].mf?t[0].mf:32)*230,maxExport:t[0].om,l1:t[0].l1&&t[0].l1.u>100,l2:t[0].l2&&t[0].l2.u>100,l3:t[0].l3&&t[0].l3.u>100,l1i:t[0].l1.p,l1e:t[0].l1.q,l2i:t[0].l2.p,l2e:t[0].l2.q,l3i:t[0].l3.p,l3e:t[0].l3.q}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.maxImport=(l[0].mf?l[0].mf:32)*230),i&1&&(o.maxExport=l[0].om),i&1&&(o.l1=l[0].l1&&l[0].l1.u>100),i&1&&(o.l2=l[0].l2&&l[0].l2.u>100),i&1&&(o.l3=l[0].l3&&l[0].l3.u>100),i&1&&(o.l1i=l[0].l1.p),i&1&&(o.l1e=l[0].l1.q),i&1&&(o.l2i=l[0].l2.p),i&1&&(o.l2e=l[0].l2.q),i&1&&(o.l3i=l[0].l3.p),i&1&&(o.l3e=l[0].l3.q),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Gu(t){let e,n,l=t[0].l1&&Vu(t);return{c(){e=c("div"),l&&l.c(),a(e,"class","cnt")},m(i,o){M(i,e,o),l&&l.m(e,null),n=!0},p(i,o){i[0].l1?l?(l.p(i,o),o&1&&L(l,1)):(l=Vu(i),l.c(),L(l,1),l.m(e,null)):l&&($e(),q(l,1,1,()=>{l=null}),De())},i(i){n||(L(l),n=!0)},o(i){q(l),n=!1},d(i){i&&y(e),l&&l.d()}}}function Vu(t){let e,n;return e=new Po({props:{title:"Power factor",importColorFn:Si,exportColorFn:Si,maxImport:1,l1:t[0].l1&&t[0].l1.u>100,l2:t[0].l2&&t[0].l2.u>100,l3:t[0].l3&&t[0].l3.u>100,l1i:t[0].l1.f,l2i:t[0].l2.f,l3i:t[0].l3.f}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.l1=l[0].l1&&l[0].l1.u>100),i&1&&(o.l2=l[0].l2&&l[0].l2.u>100),i&1&&(o.l3=l[0].l3&&l[0].l3.u>100),i&1&&(o.l1i=l[0].l1.f),i&1&&(o.l2i=l[0].l2.f),i&1&&(o.l3i=l[0].l3.f),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Ku(t){let e,n,l;return n=new Om({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&1&&(u.importInstant=i[0].ri),o&1&&(u.exportInstant=i[0].re),o&1&&(u.importTotal=i[0].ric),o&1&&(u.exportTotal=i[0].rec),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function Yu(t){let e,n,l;return n=new Hm({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function Qu(t){let e,n,l;return n=new i_({}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt h-64")},m(i,o){M(i,e,o),se(n,e,null),l=!0},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function Xu(t){let e,n,l;return n=new r_({}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function Zu(t){let e,n,l;return n=new Gm({props:{json:t[2],sysinfo:t[1]}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function Ju(t){let e,n,l;return n=new Ym({props:{json:t[3],sysinfo:t[1]}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function xu(t){let e,n,l;return n=new Zm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function ef(t){let e,n,l;return n=new e_({props:{json:t[5]}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&32&&(u.json=i[5]),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function c_(t){let e,n=lt(t[1].ui.i,t[0].i),l,i=lt(t[1].ui.e,t[0].om||t[0].e>0),o,u=lt(t[1].ui.v,t[0].l1&&(t[0].l1.u>100||t[0].l2.u>100||t[0].l3.u>100)),m,r=lt(t[1].ui.a,t[0].l1&&(t[0].l1.i>.01||t[0].l2.i>.01||t[0].l3.i>.01)),f,p=lt(t[1].ui.h,t[0].l1&&(t[0].l1.p>.01||t[0].l2.p>.01||t[0].l3.p>.01||t[0].l1.q>.01||t[0].l2.q>.01||t[0].l3.q>.01)),_,v=lt(t[1].ui.f,t[0].l1&&(t[0].l1.f>.01||t[0].l2.f>.01||t[0].l3.f>.01)),h,d=lt(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),g,k=lt(t[1].ui.c,t[0].ea),A,T=lt(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),P,F=lt(t[1].ui.l),I,R=lt(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),w,$=lt(t[1].ui.d,t[3]),ie,j=lt(t[1].ui.m,t[4]),U,H=lt(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),G,V=n&&Ou(t),K=i&&qu(t),Z=u&&Bu(t),z=r&&ju(t),W=p&&Wu(t),x=v&&Gu(t),_e=d&&Ku(t),ne=k&&Yu(t),me=T&&Qu(),Y=F&&Xu(),ke=R&&Zu(t),Ee=$&&Ju(t),we=j&&xu(t),Me=H&&ef(t);return{c(){e=c("div"),V&&V.c(),l=b(),K&&K.c(),o=b(),Z&&Z.c(),m=b(),z&&z.c(),f=b(),W&&W.c(),_=b(),x&&x.c(),h=b(),_e&&_e.c(),g=b(),ne&&ne.c(),A=b(),me&&me.c(),P=b(),Y&&Y.c(),I=b(),ke&&ke.c(),w=b(),Ee&&Ee.c(),ie=b(),we&&we.c(),U=b(),Me&&Me.c(),a(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(te,fe){M(te,e,fe),V&&V.m(e,null),s(e,l),K&&K.m(e,null),s(e,o),Z&&Z.m(e,null),s(e,m),z&&z.m(e,null),s(e,f),W&&W.m(e,null),s(e,_),x&&x.m(e,null),s(e,h),_e&&_e.m(e,null),s(e,g),ne&&ne.m(e,null),s(e,A),me&&me.m(e,null),s(e,P),Y&&Y.m(e,null),s(e,I),ke&&ke.m(e,null),s(e,w),Ee&&Ee.m(e,null),s(e,ie),we&&we.m(e,null),s(e,U),Me&&Me.m(e,null),G=!0},p(te,[fe]){fe&3&&(n=lt(te[1].ui.i,te[0].i)),n?V?(V.p(te,fe),fe&3&&L(V,1)):(V=Ou(te),V.c(),L(V,1),V.m(e,l)):V&&($e(),q(V,1,1,()=>{V=null}),De()),fe&3&&(i=lt(te[1].ui.e,te[0].om||te[0].e>0)),i?K?(K.p(te,fe),fe&3&&L(K,1)):(K=qu(te),K.c(),L(K,1),K.m(e,o)):K&&($e(),q(K,1,1,()=>{K=null}),De()),fe&3&&(u=lt(te[1].ui.v,te[0].l1&&(te[0].l1.u>100||te[0].l2.u>100||te[0].l3.u>100))),u?Z?(Z.p(te,fe),fe&3&&L(Z,1)):(Z=Bu(te),Z.c(),L(Z,1),Z.m(e,m)):Z&&($e(),q(Z,1,1,()=>{Z=null}),De()),fe&3&&(r=lt(te[1].ui.a,te[0].l1&&(te[0].l1.i>.01||te[0].l2.i>.01||te[0].l3.i>.01))),r?z?(z.p(te,fe),fe&3&&L(z,1)):(z=ju(te),z.c(),L(z,1),z.m(e,f)):z&&($e(),q(z,1,1,()=>{z=null}),De()),fe&3&&(p=lt(te[1].ui.h,te[0].l1&&(te[0].l1.p>.01||te[0].l2.p>.01||te[0].l3.p>.01||te[0].l1.q>.01||te[0].l2.q>.01||te[0].l3.q>.01))),p?W?(W.p(te,fe),fe&3&&L(W,1)):(W=Wu(te),W.c(),L(W,1),W.m(e,_)):W&&($e(),q(W,1,1,()=>{W=null}),De()),fe&3&&(v=lt(te[1].ui.f,te[0].l1&&(te[0].l1.f>.01||te[0].l2.f>.01||te[0].l3.f>.01))),v?x?(x.p(te,fe),fe&3&&L(x,1)):(x=Gu(te),x.c(),L(x,1),x.m(e,h)):x&&($e(),q(x,1,1,()=>{x=null}),De()),fe&3&&(d=lt(te[1].ui.r,te[0].ri>0||te[0].re>0||te[0].ric>0||te[0].rec>0)),d?_e?(_e.p(te,fe),fe&3&&L(_e,1)):(_e=Ku(te),_e.c(),L(_e,1),_e.m(e,g)):_e&&($e(),q(_e,1,1,()=>{_e=null}),De()),fe&3&&(k=lt(te[1].ui.c,te[0].ea)),k?ne?(ne.p(te,fe),fe&3&&L(ne,1)):(ne=Yu(te),ne.c(),L(ne,1),ne.m(e,A)):ne&&($e(),q(ne,1,1,()=>{ne=null}),De()),fe&3&&(T=lt(te[1].ui.t,te[0].pr&&(te[0].pr.startsWith("10YNO")||te[0].pr.startsWith("10Y1001A1001A4")))),T?me?fe&3&&L(me,1):(me=Qu(),me.c(),L(me,1),me.m(e,P)):me&&($e(),q(me,1,1,()=>{me=null}),De()),fe&2&&(F=lt(te[1].ui.l)),F?Y?fe&2&&L(Y,1):(Y=Xu(),Y.c(),L(Y,1),Y.m(e,I)):Y&&($e(),q(Y,1,1,()=>{Y=null}),De()),fe&3&&(R=lt(te[1].ui.p,te[0].pe&&!Number.isNaN(te[0].p))),R?ke?(ke.p(te,fe),fe&3&&L(ke,1)):(ke=Zu(te),ke.c(),L(ke,1),ke.m(e,w)):ke&&($e(),q(ke,1,1,()=>{ke=null}),De()),fe&10&&($=lt(te[1].ui.d,te[3])),$?Ee?(Ee.p(te,fe),fe&10&&L(Ee,1)):(Ee=Ju(te),Ee.c(),L(Ee,1),Ee.m(e,ie)):Ee&&($e(),q(Ee,1,1,()=>{Ee=null}),De()),fe&18&&(j=lt(te[1].ui.m,te[4])),j?we?(we.p(te,fe),fe&18&&L(we,1)):(we=xu(te),we.c(),L(we,1),we.m(e,U)):we&&($e(),q(we,1,1,()=>{we=null}),De()),fe&35&&(H=lt(te[1].ui.s,te[0].t&&te[0].t!=-127&&te[5].c>1)),H?Me?(Me.p(te,fe),fe&35&&L(Me,1)):(Me=ef(te),Me.c(),L(Me,1),Me.m(e,null)):Me&&($e(),q(Me,1,1,()=>{Me=null}),De())},i(te){G||(L(V),L(K),L(Z),L(z),L(W),L(x),L(_e),L(ne),L(me),L(Y),L(ke),L(Ee),L(we),L(Me),G=!0)},o(te){q(V),q(K),q(Z),q(z),q(W),q(x),q(_e),q(ne),q(me),q(Y),q(ke),q(Ee),q(we),q(Me),G=!1},d(te){te&&y(e),V&&V.d(),K&&K.d(),Z&&Z.d(),z&&z.d(),W&&W.d(),x&&x.d(),_e&&_e.d(),ne&&ne.d(),me&&me.d(),Y&&Y.d(),ke&&ke.d(),Ee&&Ee.d(),we&&we.d(),Me&&Me.d()}}}function m_(t,e,n){let{data:l={}}=e,{sysinfo:i={}}=e,o={},u={},m={},r={};return So.subscribe(f=>{n(2,o=f)}),u0.subscribe(f=>{n(3,u=f)}),f0.subscribe(f=>{n(4,m=f)}),m0.subscribe(f=>{n(5,r=f)}),t.$$set=f=>{"data"in f&&n(0,l=f.data),"sysinfo"in f&&n(1,i=f.sysinfo)},[l,i,o,u,m,r]}class __ extends We{constructor(e){super(),He(this,e,m_,c_,Be,{data:0,sysinfo:1})}}let ro={};const gi=pt(ro);async function p_(){ro=await(await fetch("configuration.json")).json(),gi.set(ro)}let uo={};const w0=pt(uo);async function d_(){uo=await(await fetch("priceconfig.json")).json(),w0.set(uo)}function tf(t,e,n){const l=t.slice();return l[2]=e[n],l[4]=n,l}function h_(t){let e;return{c(){e=c("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function v_(t){let e;return{c(){e=c("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function lf(t){let e;return{c(){e=c("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function nf(t){let e,n,l;return{c(){e=c("option"),e.textContent="UART1",n=b(),l=c("option"),l.textContent="UART2",e.__value=9,e.value=e.__value,l.__value=16,l.value=l.__value},m(i,o){M(i,e,o),M(i,n,o),M(i,l,o)},d(i){i&&y(e),i&&y(n),i&&y(l)}}}function sf(t){let e;return{c(){e=c("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function of(t){let e,n,l;return{c(){e=c("option"),n=E("GPIO"),l=E(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){M(i,e,o),s(e,n),s(e,l)},d(i){i&&y(e)}}}function af(t){let e,n=t[4]>1&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!((t[0]=="esp32s2"||t[0]=="esp32s3")&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&of(t);return{c(){n&&n.c(),e=it()},m(l,i){n&&n.m(l,i),M(l,e,i)},p(l,i){l[4]>1&&!(l[0]=="esp32"&&(l[4]==9||l[4]==16))&&!((l[0]=="esp32s2"||l[0]=="esp32s3")&&l[4]==18)&&!(l[0]=="esp8266"&&(l[4]==3||l[4]==113))?n||(n=of(l),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(l){n&&n.d(l),l&&y(e)}}}function b_(t){let e,n,l,i,o;function u(d,g){return d[0]=="esp32c3"?v_:h_}let m=u(t),r=m(t),f=t[0]=="esp8266"&&lf(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&nf(),_=(t[0]=="esp32s2"||t[0]=="esp32s3")&&sf(),v={length:t[1]+1},h=[];for(let d=0;d{"chip"in o&&n(0,l=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(l){case"esp8266":n(1,i=16);break;case"esp32s2":n(1,i=44);break;case"esp32s3":n(1,i=46);break;case"esp32c3":n(1,i=19);break}},[l,i]}class fo extends We{constructor(e){super(),He(this,e,g_,b_,Be,{chip:0})}}function rf(t){let e,n,l=t[1]&&uf(t);return{c(){e=c("div"),n=c("div"),l&&l.c(),a(n,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),a(e,"class","z-50"),a(e,"aria-modal","true")},m(i,o){M(i,e,o),s(e,n),l&&l.m(n,null)},p(i,o){i[1]?l?l.p(i,o):(l=uf(i),l.c(),l.m(n,null)):l&&(l.d(1),l=null)},d(i){i&&y(e),l&&l.d()}}}function uf(t){let e,n;return{c(){e=c("div"),n=E(t[1]),a(e,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(l,i){M(l,e,i),s(e,n)},p(l,i){i&2&&X(n,l[1])},d(l){l&&y(e)}}}function k_(t){let e,n=t[0]&&rf(t);return{c(){n&&n.c(),e=it()},m(l,i){n&&n.m(l,i),M(l,e,i)},p(l,[i]){l[0]?n?n.p(l,i):(n=rf(l),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:be,o:be,d(l){n&&n.d(l),l&&y(e)}}}function w_(t,e,n){let{active:l}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&n(0,l=o.active),"message"in o&&n(1,i=o.message)},[l,i]}class Tt extends We{constructor(e){super(),He(this,e,w_,k_,Be,{active:0,message:1})}}function ff(t,e,n){const l=t.slice();return l[1]=e[n],l}function cf(t){let e,n,l=t[1]+"",i;return{c(){e=c("option"),n=E("Europe/"),i=E(l),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){M(o,e,u),s(e,n),s(e,i)},p:be,d(o){o&&y(e)}}}function C_(t){let e,n,l,i=t[0],o=[];for(let u=0;u>1&1,D=0;D0;C--)D[C]=D[C]?D[C-1]^I.EXPONENT[$._modN(I.LOG[D[C]]+N)]:D[C-1];D[0]=I.EXPONENT[$._modN(I.LOG[D[0]]+N)]}for(N=0;N<=S;N++)D[N]=I.LOG[D[N]]},_checkBadness:function(){var N,C,S,D,O,J=0,le=this._badness,pe=this.buffer,ge=this.width;for(O=0;Oge*ge;)ce-=ge*ge,Fe++;for(J+=Fe*$.N4,D=0;D=le-2&&(N=le-2,O>9&&N--);var pe=N;if(O>9){for(J[pe+2]=0,J[pe+3]=0;pe--;)C=J[pe],J[pe+3]|=255&C<<4,J[pe+2]=C>>4;J[2]|=255&N<<4,J[1]=N>>4,J[0]=64|N>>12}else{for(J[pe+1]=0,J[pe+2]=0;pe--;)C=J[pe],J[pe+2]|=255&C<<4,J[pe+1]=C>>4;J[1]|=255&N<<4,J[0]=64|N>>4}for(pe=N+3-(O<10);pe=5&&(S+=$.N1+D[C]-5);for(C=3;CN||D[C-3]*3>=D[C]*4||D[C+3]*3>=D[C]*4)&&(S+=$.N3);return S},_finish:function(){this._stringBuffer=this.buffer.slice();var N,C,S=0,D=3e4;for(C=0;C<8&&(this._applyMask(C),N=this._checkBadness(),N>=1)D&1&&(O[J-1-C+J*8]=1,C<6?O[8+J*C]=1:O[8+J*(C+1)]=1);for(C=0;C<7;C++,D>>=1)D&1&&(O[8+J*(J-7+C)]=1,C?O[6-C+J*8]=1:O[7+J*8]=1)},_interleaveBlocks:function(){var N,C,S=this._dataBlock,D=this._ecc,O=this._eccBlock,J=0,le=this._calculateMaxLength(),pe=this._neccBlock1,ge=this._neccBlock2,Ae=this._stringBuffer;for(N=0;N1)for(N=A.BLOCK[D],S=O-7;;){for(C=O-7;C>N-3&&(this._addAlignment(C,S),!(C6)for(N=w.BLOCK[J-7],C=17,S=0;S<6;S++)for(D=0;D<3;D++,C--)1&(C>11?J>>C-12:N>>C)?(O[5-S+le*(2-D+le-11)]=1,O[2-D+le-11+le*(5-S)]=1):(this._setMask(5-S,2-D+le-11),this._setMask(2-D+le-11,5-S))},_isMasked:function(N,C){var S=$._getMaskBit(N,C);return this._mask[S]===1},_pack:function(){var N,C,S,D=1,O=1,J=this.width,le=J-1,pe=J-1,ge=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(C=0;CC&&(S=N,N=C,C=S),S=C,S+=C*C,S>>=1,S+=N,S},_modN:function(N){for(;N>=255;)N-=255,N=(N>>8)+(N&255);return N},N1:3,N2:3,N3:40,N4:10}),ie=$,j=h.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var N=this.element;N.width=N.height=this.qrious.size}}),U=j,H=_.extend(function(N,C,S,D){this.name=N,this.modifiable=Boolean(C),this.defaultValue=S,this._valueTransformer=D},{transform:function(N){var C=this._valueTransformer;return typeof C=="function"?C(N,this):N}}),G=H,V=_.extend(null,{abs:function(N){return N!=null?Math.abs(N):null},hasOwn:function(N,C){return Object.prototype.hasOwnProperty.call(N,C)},noop:function(){},toUpperCase:function(N){return N!=null?N.toUpperCase():null}}),K=V,Z=_.extend(function(N){this.options={},N.forEach(function(C){this.options[C.name]=C},this)},{exists:function(N){return this.options[N]!=null},get:function(N,C){return Z._get(this.options[N],C)},getAll:function(N){var C,S=this.options,D={};for(C in S)K.hasOwn(S,C)&&(D[C]=Z._get(S[C],N));return D},init:function(N,C,S){typeof S!="function"&&(S=K.noop);var D,O;for(D in this.options)K.hasOwn(this.options,D)&&(O=this.options[D],Z._set(O,O.defaultValue,C),Z._createAccessor(O,C,S));this._setAll(N,C,!0)},set:function(N,C,S){return this._set(N,C,S)},setAll:function(N,C){return this._setAll(N,C)},_set:function(N,C,S,D){var O=this.options[N];if(!O)throw new Error("Invalid option: "+N);if(!O.modifiable&&!D)throw new Error("Option cannot be modified: "+N);return Z._set(O,C,S)},_setAll:function(N,C,S){if(!N)return!1;var D,O=!1;for(D in N)K.hasOwn(N,D)&&this._set(D,N[D],C,S)&&(O=!0);return O}},{_createAccessor:function(N,C,S){var D={get:function(){return Z._get(N,C)}};N.modifiable&&(D.set=function(O){Z._set(N,O,C)&&S(O,N)}),Object.defineProperty(C,N.name,D)},_get:function(N,C){return C["_"+N.name]},_set:function(N,C,S){var D="_"+N.name,O=S[D],J=N.transform(C!=null?C:N.defaultValue);return S[D]=J,J!==O}}),z=Z,W=_.extend(function(){this._services={}},{getService:function(N){var C=this._services[N];if(!C)throw new Error("Service is not being managed with name: "+N);return C},setService:function(N,C){if(this._services[N])throw new Error("Service is already managed with name: "+N);C&&(this._services[N]=C)}}),x=W,_e=new z([new G("background",!0,"white"),new G("backgroundAlpha",!0,1,K.abs),new G("element"),new G("foreground",!0,"black"),new G("foregroundAlpha",!0,1,K.abs),new G("level",!0,"L",K.toUpperCase),new G("mime",!0,"image/png"),new G("padding",!0,null,K.abs),new G("size",!0,100,K.abs),new G("value",!0,"")]),ne=new x,me=_.extend(function(N){_e.init(N,this,this.update.bind(this));var C=_e.get("element",this),S=ne.getService("element"),D=C&&S.isCanvas(C)?C:S.createCanvas(),O=C&&S.isImage(C)?C:S.createImage();this._canvasRenderer=new g(this,D,!0),this._imageRenderer=new U(this,O,O===C),this.update()},{get:function(){return _e.getAll(this)},set:function(N){_e.setAll(N,this)&&this.update()},toDataURL:function(N){return this.canvas.toDataURL(N||this.mime)},update:function(){var N=new ie({level:this.level,value:this.value});this._canvasRenderer.render(N),this._imageRenderer.render(N)}},{use:function(N){ne.setService(N.getName(),N)}});Object.defineProperties(me.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var Y=me,ke=Y,Ee=_.extend({getName:function(){}}),we=Ee,Me=we.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(N){},isImage:function(N){}}),te=Me,fe=te.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(N){return N instanceof HTMLCanvasElement},isImage:function(N){return N instanceof HTMLImageElement}}),Oe=fe;ke.use(new Oe);var Ie=ke;return Ie})})(y0);const E_=y0.exports;function P_(t){let e,n;return{c(){e=c("img"),vs(e.src,n=t[2])||a(e,"src",n),a(e,"alt",t[0]),a(e,"class",t[1])},m(l,i){M(l,e,i)},p(l,[i]){i&4&&!vs(e.src,n=l[2])&&a(e,"src",n),i&1&&a(e,"alt",l[0]),i&2&&a(e,"class",l[1])},i:be,o:be,d(l){l&&y(e)}}}function A_(t,e,n){const l=new E_;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:m="200"}=e,{value:r=""}=e,{padding:f=0}=e,{className:p="qrcode"}=e,_="";function v(){l.set({background:o,foreground:u,level:i,padding:f,size:m,value:r}),n(2,_=l.toDataURL("image/jpeg"))}return A1(()=>{v()}),t.$$set=h=>{"errorCorrection"in h&&n(3,i=h.errorCorrection),"background"in h&&n(4,o=h.background),"color"in h&&n(5,u=h.color),"size"in h&&n(6,m=h.size),"value"in h&&n(0,r=h.value),"padding"in h&&n(7,f=h.padding),"className"in h&&n(1,p=h.className)},t.$$.update=()=>{t.$$.dirty&1&&r&&v()},[r,p,_,i,o,u,m,f]}class $_ extends We{constructor(e){super(),He(this,e,A_,P_,Be,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function mf(t,e,n){const l=t.slice();return l[101]=e[n],l[102]=e,l[103]=n,l}function _f(t,e,n){const l=t.slice();return l[104]=e[n],l[105]=e,l[106]=n,l}function D_(t,e,n){const l=t.slice();return l[107]=e[n],l}function L_(t,e,n){const l=t.slice();return l[110]=e[n],l}function I_(t){let e,n;return{c(){e=c("option"),n=E(t[110]),e.__value=t[110],e.value=e.__value},m(l,i){M(l,e,i),s(e,n)},p:be,d(l){l&&y(e)}}}function R_(t){let e;return{c(){e=E("Configure price")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function pf(t){let e,n,l,i;return{c(){e=c("br"),n=c("input"),a(n,"name","pt"),a(n,"type","text"),a(n,"class","in-s"),a(n,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){M(o,e,u),M(o,n,u),ue(n,t[3].p.t),l||(i=Q(n,"input",t[21]),l=!0)},p(o,u){u[0]&8&&n.value!==o[3].p.t&&ue(n,o[3].p.t)},d(o){o&&y(e),o&&y(n),l=!1,i()}}}function df(t){let e,n,l,i,o,u,m,r,f,p,_,v,h;return{c(){e=c("div"),n=E("Username"),l=c("br"),i=b(),o=c("input"),u=b(),m=c("div"),r=E("Password"),f=c("br"),p=b(),_=c("input"),a(o,"name","gu"),a(o,"type","text"),a(o,"class","in-s"),a(o,"maxlength","36"),a(e,"class","my-1"),a(_,"name","gp"),a(_,"type","password"),a(_,"class","in-s"),a(_,"maxlength","36"),a(m,"class","my-1")},m(d,g){M(d,e,g),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].g.u),M(d,u,g),M(d,m,g),s(m,r),s(m,f),s(m,p),s(m,_),ue(_,t[3].g.p),v||(h=[Q(o,"input",t[23]),Q(_,"input",t[24])],v=!0)},p(d,g){g[0]&8&&o.value!==d[3].g.u&&ue(o,d[3].g.u),g[0]&8&&_.value!==d[3].g.p&&ue(_,d[3].g.p)},d(d){d&&y(e),d&&y(u),d&&y(m),v=!1,nt(h)}}}function F_(t){let e,n=t[107]*100+"",l;return{c(){e=c("option"),l=E(n),e.__value=t[107]*100,e.value=e.__value},m(i,o){M(i,e,o),s(e,l)},p:be,d(i){i&&y(e)}}}function hf(t){let e,n,l,i;return{c(){e=c("br"),n=c("input"),a(n,"name","mek"),a(n,"type","text"),a(n,"class","in-s")},m(o,u){M(o,e,u),M(o,n,u),ue(n,t[3].m.e.k),l||(i=Q(n,"input",t[35]),l=!0)},p(o,u){u[0]&8&&n.value!==o[3].m.e.k&&ue(n,o[3].m.e.k)},d(o){o&&y(e),o&&y(n),l=!1,i()}}}function vf(t){let e,n,l,i,o,u,m;return{c(){e=c("div"),n=E("Authentication key"),l=c("br"),i=b(),o=c("input"),a(o,"name","mea"),a(o,"type","text"),a(o,"class","in-s"),a(e,"class","my-1")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].m.e.a),u||(m=Q(o,"input",t[36]),u=!0)},p(r,f){f[0]&8&&o.value!==r[3].m.e.a&&ue(o,r[3].m.e.a)},d(r){r&&y(e),u=!1,m()}}}function bf(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T,P,F,I,R,w,$,ie,j;return{c(){e=c("div"),n=c("div"),l=E("Watt"),i=c("br"),o=b(),u=c("input"),m=b(),r=c("div"),f=E("Volt"),p=c("br"),_=b(),v=c("input"),h=b(),d=c("div"),g=E("Amp"),k=c("br"),A=b(),T=c("input"),P=b(),F=c("div"),I=E("kWh"),R=c("br"),w=b(),$=c("input"),a(u,"name","mmw"),a(u,"type","number"),a(u,"min","0.00"),a(u,"max","1000"),a(u,"step","0.001"),a(u,"class","in-f tr w-full"),a(n,"class","w-1/4"),a(v,"name","mmv"),a(v,"type","number"),a(v,"min","0.00"),a(v,"max","1000"),a(v,"step","0.001"),a(v,"class","in-m tr w-full"),a(r,"class","w-1/4"),a(T,"name","mma"),a(T,"type","number"),a(T,"min","0.00"),a(T,"max","1000"),a(T,"step","0.001"),a(T,"class","in-m tr w-full"),a(d,"class","w-1/4"),a($,"name","mmc"),a($,"type","number"),a($,"min","0.00"),a($,"max","1000"),a($,"step","0.001"),a($,"class","in-l tr w-full"),a(F,"class","w-1/4"),a(e,"class","flex my-1")},m(U,H){M(U,e,H),s(e,n),s(n,l),s(n,i),s(n,o),s(n,u),ue(u,t[3].m.m.w),s(e,m),s(e,r),s(r,f),s(r,p),s(r,_),s(r,v),ue(v,t[3].m.m.v),s(e,h),s(e,d),s(d,g),s(d,k),s(d,A),s(d,T),ue(T,t[3].m.m.a),s(e,P),s(e,F),s(F,I),s(F,R),s(F,w),s(F,$),ue($,t[3].m.m.c),ie||(j=[Q(u,"input",t[38]),Q(v,"input",t[39]),Q(T,"input",t[40]),Q($,"input",t[41])],ie=!0)},p(U,H){H[0]&8&&Se(u.value)!==U[3].m.m.w&&ue(u,U[3].m.m.w),H[0]&8&&Se(v.value)!==U[3].m.m.v&&ue(v,U[3].m.m.v),H[0]&8&&Se(T.value)!==U[3].m.m.a&&ue(T,U[3].m.m.a),H[0]&8&&Se($.value)!==U[3].m.m.c&&ue($,U[3].m.m.c)},d(U){U&&y(e),ie=!1,nt(j)}}}function gf(t){let e;return{c(){e=c("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function kf(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T,P,F,I,R,w,$,ie,j,U,H,G,V,K,Z,z,W,x,_e,ne,me;return{c(){e=c("div"),n=E("SSID"),l=c("br"),i=b(),o=c("input"),u=b(),m=c("div"),r=E("Password"),f=c("br"),p=b(),_=c("input"),v=b(),h=c("div"),d=c("div"),g=E("Power saving"),k=c("br"),A=b(),T=c("select"),P=c("option"),P.textContent="Default",F=c("option"),F.textContent="Off",I=c("option"),I.textContent="Minimum",R=c("option"),R.textContent="Maximum",w=b(),$=c("div"),ie=E("Power"),j=c("br"),U=b(),H=c("div"),G=c("input"),V=b(),K=c("span"),K.textContent="dBm",Z=b(),z=c("div"),W=c("label"),x=c("input"),_e=E(" Allow 802.11b legacy rates"),a(o,"name","ws"),a(o,"type","text"),a(o,"class","in-s"),a(e,"class","my-1"),a(_,"name","wp"),a(_,"type","password"),a(_,"class","in-s"),a(m,"class","my-1"),P.__value=255,P.value=P.__value,F.__value=0,F.value=F.__value,I.__value=1,I.value=I.__value,R.__value=2,R.value=R.__value,a(T,"name","wz"),a(T,"class","in-s"),t[3].w.z===void 0&&Ze(()=>t[45].call(T)),a(d,"class","w-1/2"),a(G,"name","ww"),a(G,"type","number"),a(G,"min","0"),a(G,"max","20.5"),a(G,"step","0.5"),a(G,"class","in-f tr w-full"),a(K,"class","in-post"),a(H,"class","flex"),a($,"class","ml-2 w-1/2"),a(h,"class","my-1 flex"),a(x,"type","checkbox"),a(x,"name","wb"),x.__value="true",x.value=x.__value,a(x,"class","rounded mb-1"),a(z,"class","my-3")},m(Y,ke){M(Y,e,ke),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].w.s),M(Y,u,ke),M(Y,m,ke),s(m,r),s(m,f),s(m,p),s(m,_),ue(_,t[3].w.p),M(Y,v,ke),M(Y,h,ke),s(h,d),s(d,g),s(d,k),s(d,A),s(d,T),s(T,P),s(T,F),s(T,I),s(T,R),Te(T,t[3].w.z,!0),s(h,w),s(h,$),s($,ie),s($,j),s($,U),s($,H),s(H,G),ue(G,t[3].w.w),s(H,V),s(H,K),M(Y,Z,ke),M(Y,z,ke),s(z,W),s(W,x),x.checked=t[3].w.b,s(W,_e),ne||(me=[Q(o,"input",t[43]),Q(_,"input",t[44]),Q(T,"change",t[45]),Q(G,"input",t[46]),Q(x,"change",t[47])],ne=!0)},p(Y,ke){ke[0]&8&&o.value!==Y[3].w.s&&ue(o,Y[3].w.s),ke[0]&8&&_.value!==Y[3].w.p&&ue(_,Y[3].w.p),ke[0]&8&&Te(T,Y[3].w.z),ke[0]&8&&Se(G.value)!==Y[3].w.w&&ue(G,Y[3].w.w),ke[0]&8&&(x.checked=Y[3].w.b)},d(Y){Y&&y(e),Y&&y(u),Y&&y(m),Y&&y(v),Y&&y(h),Y&&y(Z),Y&&y(z),ne=!1,nt(me)}}}function wf(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k;return{c(){e=c("div"),n=E("Gateway"),l=c("br"),i=b(),o=c("input"),u=b(),m=c("div"),r=E("DNS"),f=c("br"),p=b(),_=c("div"),v=c("input"),h=b(),d=c("input"),a(o,"name","ng"),a(o,"type","text"),a(o,"class","in-s"),a(e,"class","my-1"),a(v,"name","nd1"),a(v,"type","text"),a(v,"class","in-f w-full"),a(d,"name","nd2"),a(d,"type","text"),a(d,"class","in-l w-full"),a(_,"class","flex"),a(m,"class","my-1")},m(A,T){M(A,e,T),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].n.g),M(A,u,T),M(A,m,T),s(m,r),s(m,f),s(m,p),s(m,_),s(_,v),ue(v,t[3].n.d1),s(_,h),s(_,d),ue(d,t[3].n.d2),g||(k=[Q(o,"input",t[51]),Q(v,"input",t[52]),Q(d,"input",t[53])],g=!0)},p(A,T){T[0]&8&&o.value!==A[3].n.g&&ue(o,A[3].n.g),T[0]&8&&v.value!==A[3].n.d1&&ue(v,A[3].n.d1),T[0]&8&&d.value!==A[3].n.d2&&ue(d,A[3].n.d2)},d(A){A&&y(e),A&&y(u),A&&y(m),g=!1,nt(k)}}}function Cf(t){let e,n,l,i,o;return{c(){e=c("label"),n=c("input"),l=E(" SSL"),a(n,"type","checkbox"),a(n,"name","qs"),n.__value="true",n.value=n.__value,a(n,"class","rounded mb-1"),a(e,"class","float-right mr-3")},m(u,m){M(u,e,m),s(e,n),n.checked=t[3].q.s.e,s(e,l),i||(o=[Q(n,"change",t[57]),Q(n,"change",t[14])],i=!0)},p(u,m){m[0]&8&&(n.checked=u[3].q.s.e)},d(u){u&&y(e),i=!1,nt(o)}}}function yf(t){let e,n,l,i,o,u,m,r,f,p,_,v,h;const d=[q_,O_],g=[];function k(w,$){return w[3].q.s.c?0:1}l=k(t),i=g[l]=d[l](t);const A=[H_,j_],T=[];function P(w,$){return w[3].q.s.r?0:1}m=P(t),r=T[m]=A[m](t);const F=[V_,G_],I=[];function R(w,$){return w[3].q.s.k?0:1}return _=R(t),v=I[_]=F[_](t),{c(){e=c("div"),n=c("span"),i.c(),o=b(),u=c("span"),r.c(),f=b(),p=c("span"),v.c(),a(n,"class","flex pr-2"),a(u,"class","flex pr-2"),a(p,"class","flex pr-2"),a(e,"class","my-1 flex")},m(w,$){M(w,e,$),s(e,n),g[l].m(n,null),s(e,o),s(e,u),T[m].m(u,null),s(e,f),s(e,p),I[_].m(p,null),h=!0},p(w,$){let ie=l;l=k(w),l===ie?g[l].p(w,$):($e(),q(g[ie],1,1,()=>{g[ie]=null}),De(),i=g[l],i?i.p(w,$):(i=g[l]=d[l](w),i.c()),L(i,1),i.m(n,null));let j=m;m=P(w),m===j?T[m].p(w,$):($e(),q(T[j],1,1,()=>{T[j]=null}),De(),r=T[m],r?r.p(w,$):(r=T[m]=A[m](w),r.c()),L(r,1),r.m(u,null));let U=_;_=R(w),_===U?I[_].p(w,$):($e(),q(I[U],1,1,()=>{I[U]=null}),De(),v=I[_],v?v.p(w,$):(v=I[_]=F[_](w),v.c()),L(v,1),v.m(p,null))},i(w){h||(L(i),L(r),L(v),h=!0)},o(w){q(i),q(r),q(v),h=!1},d(w){w&&y(e),g[l].d(),T[m].d(),I[_].d()}}}function O_(t){let e,n;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[B_]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:l}),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function q_(t){let e,n,l,i,o,u,m,r;return n=new el({props:{to:"/mqtt-ca",$$slots:{default:[U_]},$$scope:{ctx:t}}}),o=new Ss({}),{c(){e=c("span"),ae(n.$$.fragment),l=b(),i=c("span"),ae(o.$$.fragment),a(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),a(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(n,e,null),M(f,l,p),M(f,i,p),se(o,i,null),u=!0,m||(r=[Q(i,"click",t[11]),Q(i,"keypress",t[11])],m=!0)},p(f,p){const _={};p[3]&1048576&&(_.$$scope={dirty:p,ctx:f}),n.$set(_)},i(f){u||(L(n.$$.fragment,f),L(o.$$.fragment,f),u=!0)},o(f){q(n.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&y(e),oe(n),f&&y(l),f&&y(i),oe(o),m=!1,nt(r)}}}function B_(t){let e,n;return e=new un({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function U_(t){let e;return{c(){e=E("CA OK")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function j_(t){let e,n;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[W_]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:l}),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function H_(t){let e,n,l,i,o,u,m,r;return n=new el({props:{to:"/mqtt-cert",$$slots:{default:[z_]},$$scope:{ctx:t}}}),o=new Ss({}),{c(){e=c("span"),ae(n.$$.fragment),l=b(),i=c("span"),ae(o.$$.fragment),a(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),a(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(n,e,null),M(f,l,p),M(f,i,p),se(o,i,null),u=!0,m||(r=[Q(i,"click",t[12]),Q(i,"keypress",t[12])],m=!0)},p(f,p){const _={};p[3]&1048576&&(_.$$scope={dirty:p,ctx:f}),n.$set(_)},i(f){u||(L(n.$$.fragment,f),L(o.$$.fragment,f),u=!0)},o(f){q(n.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&y(e),oe(n),f&&y(l),f&&y(i),oe(o),m=!1,nt(r)}}}function W_(t){let e,n;return e=new un({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function z_(t){let e;return{c(){e=E("Cert OK")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function G_(t){let e,n;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[K_]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:l}),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function V_(t){let e,n,l,i,o,u,m,r;return n=new el({props:{to:"/mqtt-key",$$slots:{default:[Y_]},$$scope:{ctx:t}}}),o=new Ss({}),{c(){e=c("span"),ae(n.$$.fragment),l=b(),i=c("span"),ae(o.$$.fragment),a(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),a(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(n,e,null),M(f,l,p),M(f,i,p),se(o,i,null),u=!0,m||(r=[Q(i,"click",t[13]),Q(i,"keypress",t[13])],m=!0)},p(f,p){const _={};p[3]&1048576&&(_.$$scope={dirty:p,ctx:f}),n.$set(_)},i(f){u||(L(n.$$.fragment,f),L(o.$$.fragment,f),u=!0)},o(f){q(n.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&y(e),oe(n),f&&y(l),f&&y(i),oe(o),m=!1,nt(r)}}}function K_(t){let e,n;return e=new un({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Y_(t){let e;return{c(){e=E("Key OK")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function Mf(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T,P,F,I,R,w,$,ie,j,U,H,G,V,K,Z;return o=new Ut({}),{c(){e=c("div"),n=c("strong"),n.textContent="Domoticz",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("input"),r=b(),f=c("div"),p=c("div"),_=E("Electricity IDX"),v=c("br"),h=b(),d=c("input"),g=b(),k=c("div"),A=E("Current IDX"),T=c("br"),P=b(),F=c("input"),I=b(),R=c("div"),w=E(`Voltage IDX: L1, L2 & L3 - `),$=c("div"),ie=c("input"),j=b(),U=c("input"),H=b(),G=c("input"),a(n,"class","text-sm"),a(i,"href",jt("MQTT-configuration#domoticz")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"type","hidden"),a(m,"name","o"),m.value="true",a(d,"name","oe"),a(d,"type","text"),a(d,"class","in-f tr w-full"),a(p,"class","w-1/2"),a(F,"name","oc"),a(F,"type","text"),a(F,"class","in-l tr w-full"),a(k,"class","w-1/2"),a(f,"class","my-1 flex"),a(ie,"name","ou1"),a(ie,"type","text"),a(ie,"class","in-f tr w-1/3"),a(U,"name","ou2"),a(U,"type","text"),a(U,"class","in-m tr w-1/3"),a(G,"name","ou3"),a(G,"type","text"),a(G,"class","in-l tr w-1/3"),a($,"class","flex"),a(R,"class","my-1"),a(e,"class","cnt")},m(z,W){M(z,e,W),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(p,_),s(p,v),s(p,h),s(p,d),ue(d,t[3].o.e),s(f,g),s(f,k),s(k,A),s(k,T),s(k,P),s(k,F),ue(F,t[3].o.c),s(e,I),s(e,R),s(R,w),s(R,$),s($,ie),ue(ie,t[3].o.u1),s($,j),s($,U),ue(U,t[3].o.u2),s($,H),s($,G),ue(G,t[3].o.u3),V=!0,K||(Z=[Q(d,"input",t[65]),Q(F,"input",t[66]),Q(ie,"input",t[67]),Q(U,"input",t[68]),Q(G,"input",t[69])],K=!0)},p(z,W){W[0]&8&&d.value!==z[3].o.e&&ue(d,z[3].o.e),W[0]&8&&F.value!==z[3].o.c&&ue(F,z[3].o.c),W[0]&8&&ie.value!==z[3].o.u1&&ue(ie,z[3].o.u1),W[0]&8&&U.value!==z[3].o.u2&&ue(U,z[3].o.u2),W[0]&8&&G.value!==z[3].o.u3&&ue(G,z[3].o.u3)},i(z){V||(L(o.$$.fragment,z),V=!0)},o(z){q(o.$$.fragment,z),V=!1},d(z){z&&y(e),oe(o),K=!1,nt(Z)}}}function Sf(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T,P,F,I,R,w,$,ie,j,U,H,G;return o=new Ut({}),{c(){e=c("div"),n=c("strong"),n.textContent="Home-Assistant",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("input"),r=b(),f=c("div"),p=E("Discovery topic prefix"),_=c("br"),v=b(),h=c("input"),d=b(),g=c("div"),k=E("Hostname for URL"),A=c("br"),T=b(),P=c("input"),I=b(),R=c("div"),w=E("Name tag"),$=c("br"),ie=b(),j=c("input"),a(n,"class","text-sm"),a(i,"href",jt("MQTT-configuration#home-assistant")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"type","hidden"),a(m,"name","h"),m.value="true",a(h,"name","ht"),a(h,"type","text"),a(h,"class","in-s"),a(h,"placeholder","homeassistant"),a(f,"class","my-1"),a(P,"name","hh"),a(P,"type","text"),a(P,"class","in-s"),a(P,"placeholder",F=t[3].g.h+".local"),a(g,"class","my-1"),a(j,"name","hn"),a(j,"type","text"),a(j,"class","in-s"),a(R,"class","my-1"),a(e,"class","cnt")},m(V,K){M(V,e,K),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(f,_),s(f,v),s(f,h),ue(h,t[3].h.t),s(e,d),s(e,g),s(g,k),s(g,A),s(g,T),s(g,P),ue(P,t[3].h.h),s(e,I),s(e,R),s(R,w),s(R,$),s(R,ie),s(R,j),ue(j,t[3].h.n),U=!0,H||(G=[Q(h,"input",t[70]),Q(P,"input",t[71]),Q(j,"input",t[72])],H=!0)},p(V,K){K[0]&8&&h.value!==V[3].h.t&&ue(h,V[3].h.t),(!U||K[0]&8&&F!==(F=V[3].g.h+".local"))&&a(P,"placeholder",F),K[0]&8&&P.value!==V[3].h.h&&ue(P,V[3].h.h),K[0]&8&&j.value!==V[3].h.n&&ue(j,V[3].h.n)},i(V){U||(L(o.$$.fragment,V),U=!0)},o(V){q(o.$$.fragment,V),U=!1},d(V){V&&y(e),oe(o),H=!1,nt(G)}}}function Tf(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T,P,F,I;o=new Ut({});let R=t[3].c.es&&Nf(t);return{c(){e=c("div"),n=c("strong"),n.textContent="Cloud connections",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("input"),r=b(),f=c("div"),p=c("label"),_=c("input"),v=E(" AMSreader cloud"),h=b(),d=c("div"),g=c("label"),k=c("input"),A=E(" Energy Speedometer"),T=b(),R&&R.c(),a(n,"class","text-sm"),a(i,"href",jt("Cloud")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"type","hidden"),a(m,"name","c"),m.value="true",a(_,"type","checkbox"),a(_,"name","ce"),_.__value="true",_.value=_.__value,a(_,"class","rounded mb-1"),a(f,"class","my-1"),a(k,"type","checkbox"),a(k,"class","rounded mb-1"),a(k,"name","ces"),k.__value="true",k.value=k.__value,a(d,"class","my-1"),a(e,"class","cnt")},m(w,$){M(w,e,$),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(p,_),_.checked=t[3].c.e,s(p,v),s(e,h),s(e,d),s(d,g),s(g,k),k.checked=t[3].c.es,s(g,A),s(d,T),R&&R.m(d,null),P=!0,F||(I=[Q(_,"change",t[73]),Q(k,"change",t[74])],F=!0)},p(w,$){$[0]&8&&(_.checked=w[3].c.e),$[0]&8&&(k.checked=w[3].c.es),w[3].c.es?R?(R.p(w,$),$[0]&8&&L(R,1)):(R=Nf(w),R.c(),L(R,1),R.m(d,null)):R&&($e(),q(R,1,1,()=>{R=null}),De())},i(w){P||(L(o.$$.fragment,w),L(R),P=!0)},o(w){q(o.$$.fragment,w),q(R),P=!1},d(w){w&&y(e),oe(o),R&&R.d(),F=!1,nt(I)}}}function Nf(t){let e,n,l=t[0].mac+"",i,o,u,m,r=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,p,_,v,h=t[0].mac&&t[0].meter.id&&Ef(t);return{c(){e=c("div"),n=E("MAC: "),i=E(l),o=b(),u=c("div"),m=E("Meter ID: "),f=E(r),p=b(),h&&h.c(),_=it(),a(e,"class","pl-5"),a(u,"class","pl-5")},m(d,g){M(d,e,g),s(e,n),s(e,i),M(d,o,g),M(d,u,g),s(u,m),s(u,f),M(d,p,g),h&&h.m(d,g),M(d,_,g),v=!0},p(d,g){(!v||g[0]&1)&&l!==(l=d[0].mac+"")&&X(i,l),(!v||g[0]&1)&&r!==(r=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&X(f,r),d[0].mac&&d[0].meter.id?h?(h.p(d,g),g[0]&1&&L(h,1)):(h=Ef(d),h.c(),L(h,1),h.m(_.parentNode,_)):h&&($e(),q(h,1,1,()=>{h=null}),De())},i(d){v||(L(h),v=!0)},o(d){q(h),v=!1},d(d){d&&y(e),d&&y(o),d&&y(u),d&&y(p),h&&h.d(d),d&&y(_)}}}function Ef(t){let e,n,l;return n=new $_({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","pl-2")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function Pf(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T,P;o=new Ut({});let F={length:9},I=[];for(let R=0;R20&&Lf(t),_=t[3].i.d.d>0&&Ff(t),v=t[0].chip=="esp8266"&&Of(t);return{c(){e=c("div"),n=c("strong"),n.textContent="Hardware",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),p&&p.c(),m=b(),_&&_.c(),r=b(),v&&v.c(),a(n,"class","text-sm"),a(i,"href",jt("GPIO-configuration")),a(i,"target","_blank"),a(i,"class","float-right"),a(e,"class","cnt")},m(h,d){M(h,e,d),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),p&&p.m(e,null),s(e,m),_&&_.m(e,null),s(e,r),v&&v.m(e,null),f=!0},p(h,d){h[0].board>20?p?(p.p(h,d),d[0]&1&&L(p,1)):(p=Lf(h),p.c(),L(p,1),p.m(e,m)):p&&($e(),q(p,1,1,()=>{p=null}),De()),h[3].i.d.d>0?_?_.p(h,d):(_=Ff(h),_.c(),_.m(e,r)):_&&(_.d(1),_=null),h[0].chip=="esp8266"?v?v.p(h,d):(v=Of(h),v.c(),v.m(e,null)):v&&(v.d(1),v=null)},i(h){f||(L(o.$$.fragment,h),L(p),f=!0)},o(h){q(o.$$.fragment,h),q(p),f=!1},d(h){h&&y(e),oe(o),p&&p.d(),_&&_.d(),v&&v.d()}}}function Lf(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T,P,F,I,R,w,$,ie,j,U,H,G,V,K,Z,z,W,x,_e,ne,me,Y,ke,Ee,we,Me,te,fe,Oe,Ie,N,C,S,D,O,J,le,pe,ge,Ae,Fe,ce,Pe,ze,ct,Ke,rt,Ge,mt,Ue,Nt,_t,dt,et,Re,tt,Le,Je,at;f=new fo({props:{chip:t[0].chip}}),k=new fo({props:{chip:t[0].chip}});let qe=t[0].chip!="esp8266"&&If(t),ye=t[3].i.v.p>0&&Rf(t);return{c(){e=c("input"),n=b(),l=c("div"),i=c("div"),o=E("HAN RX"),u=c("br"),m=b(),r=c("select"),ae(f.$$.fragment),p=b(),_=c("div"),v=E("HAN TX"),h=c("br"),d=b(),g=c("select"),ae(k.$$.fragment),A=b(),T=c("div"),P=c("label"),F=c("input"),I=E(" pullup"),R=b(),w=c("div"),$=c("div"),ie=E("AP button"),j=c("br"),U=b(),H=c("input"),G=b(),V=c("div"),K=E("LED"),Z=c("br"),z=b(),W=c("div"),x=c("input"),_e=b(),ne=c("div"),me=c("label"),Y=c("input"),ke=E(" inverted"),Ee=b(),we=c("div"),Me=E("RGB"),te=c("label"),fe=c("input"),Oe=E(" inverted"),Ie=c("br"),N=b(),C=c("div"),S=c("input"),D=b(),O=c("input"),J=b(),le=c("input"),pe=b(),ge=c("div"),Ae=c("div"),Fe=E(`LED dis. GPIO - `),ce=c("input"),Pe=b(),ze=c("div"),ct=E("Temperature"),Ke=c("br"),rt=b(),Ge=c("input"),mt=b(),Ue=c("div"),Nt=E("Analog temp"),_t=c("br"),dt=b(),et=c("input"),Re=b(),qe&&qe.c(),tt=b(),ye&&ye.c(),a(e,"type","hidden"),a(e,"name","i"),e.value="true",a(r,"name","ihp"),a(r,"class","in-f w-full"),t[3].i.h.p===void 0&&Ze(()=>t[78].call(r)),a(i,"class","w-1/3"),a(g,"name","iht"),a(g,"class","in-l w-full"),t[3].i.h.t===void 0&&Ze(()=>t[79].call(g)),a(_,"class","w-1/3"),a(F,"name","ihu"),F.__value="true",F.value=F.__value,a(F,"type","checkbox"),a(F,"class","rounded mb-1"),a(P,"class","ml-2"),a(T,"class","w-1/3"),a(l,"class","flex flex-wrap"),a(H,"name","ia"),a(H,"type","number"),a(H,"min","0"),a(H,"max",t[6]),a(H,"class","in-f tr w-full"),a($,"class","w-1/3"),a(x,"name","ilp"),a(x,"type","number"),a(x,"min","0"),a(x,"max",t[6]),a(x,"class","in-l tr w-full"),a(W,"class","flex"),a(V,"class","w-1/3"),a(Y,"name","ili"),Y.__value="true",Y.value=Y.__value,a(Y,"type","checkbox"),a(Y,"class","rounded mb-1"),a(me,"class","ml-4"),a(ne,"class","w-1/3"),a(fe,"name","iri"),fe.__value="true",fe.value=fe.__value,a(fe,"type","checkbox"),a(fe,"class","rounded mb-1"),a(te,"class","ml-4"),a(S,"name","irr"),a(S,"type","number"),a(S,"min","0"),a(S,"max",t[6]),a(S,"class","in-f tr w-1/3"),a(O,"name","irg"),a(O,"type","number"),a(O,"min","0"),a(O,"max",t[6]),a(O,"class","in-m tr w-1/3"),a(le,"name","irb"),a(le,"type","number"),a(le,"min","0"),a(le,"max",t[6]),a(le,"class","in-l tr w-1/3"),a(C,"class","flex"),a(we,"class","w-full"),a(ce,"name","idd"),a(ce,"type","number"),a(ce,"min","0"),a(ce,"max",t[6]),a(ce,"class","in-s tr"),a(Ae,"class","my-1 pr-1 w-1/3"),a(ge,"class","w-full"),a(Ge,"name","itd"),a(Ge,"type","number"),a(Ge,"min","0"),a(Ge,"max",t[6]),a(Ge,"class","in-f tr w-full"),a(ze,"class","my-1 w-1/3"),a(et,"name","ita"),a(et,"type","number"),a(et,"min","0"),a(et,"max",t[6]),a(et,"class","in-l tr w-full"),a(Ue,"class","my-1 pr-1 w-1/3"),a(w,"class","flex flex-wrap")},m(ve,de){M(ve,e,de),M(ve,n,de),M(ve,l,de),s(l,i),s(i,o),s(i,u),s(i,m),s(i,r),se(f,r,null),Te(r,t[3].i.h.p,!0),s(l,p),s(l,_),s(_,v),s(_,h),s(_,d),s(_,g),se(k,g,null),Te(g,t[3].i.h.t,!0),s(l,A),s(l,T),s(T,P),s(P,F),F.checked=t[3].i.h.u,s(P,I),M(ve,R,de),M(ve,w,de),s(w,$),s($,ie),s($,j),s($,U),s($,H),ue(H,t[3].i.a),s(w,G),s(w,V),s(V,K),s(V,Z),s(V,z),s(V,W),s(W,x),ue(x,t[3].i.l.p),s(w,_e),s(w,ne),s(ne,me),s(me,Y),Y.checked=t[3].i.l.i,s(me,ke),s(w,Ee),s(w,we),s(we,Me),s(we,te),s(te,fe),fe.checked=t[3].i.r.i,s(te,Oe),s(we,Ie),s(we,N),s(we,C),s(C,S),ue(S,t[3].i.r.r),s(C,D),s(C,O),ue(O,t[3].i.r.g),s(C,J),s(C,le),ue(le,t[3].i.r.b),s(w,pe),s(w,ge),s(ge,Ae),s(Ae,Fe),s(Ae,ce),ue(ce,t[3].i.d.d),s(w,Pe),s(w,ze),s(ze,ct),s(ze,Ke),s(ze,rt),s(ze,Ge),ue(Ge,t[3].i.t.d),s(w,mt),s(w,Ue),s(Ue,Nt),s(Ue,_t),s(Ue,dt),s(Ue,et),ue(et,t[3].i.t.a),s(w,Re),qe&&qe.m(w,null),s(w,tt),ye&&ye.m(w,null),Le=!0,Je||(at=[Q(r,"change",t[78]),Q(g,"change",t[79]),Q(F,"change",t[80]),Q(H,"input",t[81]),Q(x,"input",t[82]),Q(Y,"change",t[83]),Q(fe,"change",t[84]),Q(S,"input",t[85]),Q(O,"input",t[86]),Q(le,"input",t[87]),Q(ce,"input",t[88]),Q(Ge,"input",t[89]),Q(et,"input",t[90])],Je=!0)},p(ve,de){const Ve={};de[0]&1&&(Ve.chip=ve[0].chip),f.$set(Ve),de[0]&8&&Te(r,ve[3].i.h.p);const re={};de[0]&1&&(re.chip=ve[0].chip),k.$set(re),de[0]&8&&Te(g,ve[3].i.h.t),de[0]&8&&(F.checked=ve[3].i.h.u),(!Le||de[0]&64)&&a(H,"max",ve[6]),de[0]&8&&Se(H.value)!==ve[3].i.a&&ue(H,ve[3].i.a),(!Le||de[0]&64)&&a(x,"max",ve[6]),de[0]&8&&Se(x.value)!==ve[3].i.l.p&&ue(x,ve[3].i.l.p),de[0]&8&&(Y.checked=ve[3].i.l.i),de[0]&8&&(fe.checked=ve[3].i.r.i),(!Le||de[0]&64)&&a(S,"max",ve[6]),de[0]&8&&Se(S.value)!==ve[3].i.r.r&&ue(S,ve[3].i.r.r),(!Le||de[0]&64)&&a(O,"max",ve[6]),de[0]&8&&Se(O.value)!==ve[3].i.r.g&&ue(O,ve[3].i.r.g),(!Le||de[0]&64)&&a(le,"max",ve[6]),de[0]&8&&Se(le.value)!==ve[3].i.r.b&&ue(le,ve[3].i.r.b),(!Le||de[0]&64)&&a(ce,"max",ve[6]),de[0]&8&&Se(ce.value)!==ve[3].i.d.d&&ue(ce,ve[3].i.d.d),(!Le||de[0]&64)&&a(Ge,"max",ve[6]),de[0]&8&&Se(Ge.value)!==ve[3].i.t.d&&ue(Ge,ve[3].i.t.d),(!Le||de[0]&64)&&a(et,"max",ve[6]),de[0]&8&&Se(et.value)!==ve[3].i.t.a&&ue(et,ve[3].i.t.a),ve[0].chip!="esp8266"?qe?qe.p(ve,de):(qe=If(ve),qe.c(),qe.m(w,tt)):qe&&(qe.d(1),qe=null),ve[3].i.v.p>0?ye?ye.p(ve,de):(ye=Rf(ve),ye.c(),ye.m(w,null)):ye&&(ye.d(1),ye=null)},i(ve){Le||(L(f.$$.fragment,ve),L(k.$$.fragment,ve),Le=!0)},o(ve){q(f.$$.fragment,ve),q(k.$$.fragment,ve),Le=!1},d(ve){ve&&y(e),ve&&y(n),ve&&y(l),oe(f),oe(k),ve&&y(R),ve&&y(w),qe&&qe.d(),ye&&ye.d(),Je=!1,nt(at)}}}function If(t){let e,n,l,i,o,u,m;return{c(){e=c("div"),n=E("Vcc"),l=c("br"),i=b(),o=c("input"),a(o,"name","ivp"),a(o,"type","number"),a(o,"min","0"),a(o,"max",t[6]),a(o,"class","in-s tr w-full"),a(e,"class","my-1 pl-1 w-1/3")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].i.v.p),u||(m=Q(o,"input",t[91]),u=!0)},p(r,f){f[0]&64&&a(o,"max",r[6]),f[0]&8&&Se(o.value)!==r[3].i.v.p&&ue(o,r[3].i.v.p)},d(r){r&&y(e),u=!1,m()}}}function Rf(t){let e,n,l,i,o,u,m,r,f,p;return{c(){e=c("div"),n=E("Voltage divider"),l=c("br"),i=b(),o=c("div"),u=c("input"),m=b(),r=c("input"),a(u,"name","ivdv"),a(u,"type","number"),a(u,"min","0"),a(u,"max","65535"),a(u,"class","in-f tr w-full"),a(u,"placeholder","VCC"),a(r,"name","ivdg"),a(r,"type","number"),a(r,"min","0"),a(r,"max","65535"),a(r,"class","in-l tr w-full"),a(r,"placeholder","GND"),a(o,"class","flex"),a(e,"class","my-1")},m(_,v){M(_,e,v),s(e,n),s(e,l),s(e,i),s(e,o),s(o,u),ue(u,t[3].i.v.d.v),s(o,m),s(o,r),ue(r,t[3].i.v.d.g),f||(p=[Q(u,"input",t[92]),Q(r,"input",t[93])],f=!0)},p(_,v){v[0]&8&&Se(u.value)!==_[3].i.v.d.v&&ue(u,_[3].i.v.d.v),v[0]&8&&Se(r.value)!==_[3].i.v.d.g&&ue(r,_[3].i.v.d.g)},d(_){_&&y(e),f=!1,nt(p)}}}function Ff(t){let e,n,l,i,o,u,m;return{c(){e=c("div"),n=E(`LED behaviour - `),l=c("select"),i=c("option"),i.textContent="Enabled",o=c("option"),o.textContent="Disabled",i.__value=0,i.value=i.__value,o.__value=1,o.value=o.__value,a(l,"name","idb"),a(l,"class","in-s"),t[3].i.d.b===void 0&&Ze(()=>t[94].call(l)),a(e,"class","my-1 w-full")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(l,i),s(l,o),Te(l,t[3].i.d.b,!0),u||(m=Q(l,"change",t[94]),u=!0)},p(r,f){f[0]&8&&Te(l,r[3].i.d.b)},d(r){r&&y(e),u=!1,m()}}}function Of(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T=(t[0].board==2||t[0].board==100)&&qf(t);return{c(){e=c("input"),n=b(),l=c("div"),i=c("div"),o=E("Vcc offset"),u=c("br"),m=b(),r=c("input"),f=b(),p=c("div"),_=E("Multiplier"),v=c("br"),h=b(),d=c("input"),g=b(),T&&T.c(),a(e,"type","hidden"),a(e,"name","iv"),e.value="true",a(r,"name","ivo"),a(r,"type","number"),a(r,"min","0.0"),a(r,"max","3.5"),a(r,"step","0.01"),a(r,"class","in-f tr w-full"),a(i,"class","w-1/3"),a(d,"name","ivm"),a(d,"type","number"),a(d,"min","0.1"),a(d,"max","10"),a(d,"step","0.01"),a(d,"class","in-l tr w-full"),a(p,"class","w-1/3 pr-1"),a(l,"class","my-1 flex flex-wrap")},m(P,F){M(P,e,F),M(P,n,F),M(P,l,F),s(l,i),s(i,o),s(i,u),s(i,m),s(i,r),ue(r,t[3].i.v.o),s(l,f),s(l,p),s(p,_),s(p,v),s(p,h),s(p,d),ue(d,t[3].i.v.m),s(l,g),T&&T.m(l,null),k||(A=[Q(r,"input",t[95]),Q(d,"input",t[96])],k=!0)},p(P,F){F[0]&8&&Se(r.value)!==P[3].i.v.o&&ue(r,P[3].i.v.o),F[0]&8&&Se(d.value)!==P[3].i.v.m&&ue(d,P[3].i.v.m),P[0].board==2||P[0].board==100?T?T.p(P,F):(T=qf(P),T.c(),T.m(l,null)):T&&(T.d(1),T=null)},d(P){P&&y(e),P&&y(n),P&&y(l),T&&T.d(),k=!1,nt(A)}}}function qf(t){let e,n,l,i,o,u,m;return{c(){e=c("div"),n=E("Boot limit"),l=c("br"),i=b(),o=c("input"),a(o,"name","ivb"),a(o,"type","number"),a(o,"min","2.5"),a(o,"max","3.5"),a(o,"step","0.1"),a(o,"class","in-s tr w-full"),a(e,"class","w-1/3 pl-1")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].i.v.b),u||(m=Q(o,"input",t[97]),u=!0)},p(r,f){f[0]&8&&Se(o.value)!==r[3].i.v.b&&ue(o,r[3].i.v.b)},d(r){r&&y(e),u=!1,m()}}}function Bf(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A=t[3].d.t&&Uf();return{c(){e=c("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",n=b(),l=c("div"),i=c("label"),o=c("input"),u=E(" Enable telnet"),m=b(),A&&A.c(),r=b(),f=c("div"),p=c("select"),_=c("option"),_.textContent="Verbose",v=c("option"),v.textContent="Debug",h=c("option"),h.textContent="Info",d=c("option"),d.textContent="Warning",a(e,"class","bd-red"),a(o,"type","checkbox"),a(o,"name","dt"),o.__value="true",o.value=o.__value,a(o,"class","rounded mb-1"),a(l,"class","my-1"),_.__value=1,_.value=_.__value,v.__value=2,v.value=v.__value,h.__value=3,h.value=h.__value,d.__value=4,d.value=d.__value,a(p,"name","dl"),a(p,"class","in-s"),t[3].d.l===void 0&&Ze(()=>t[100].call(p)),a(f,"class","my-1")},m(T,P){M(T,e,P),M(T,n,P),M(T,l,P),s(l,i),s(i,o),o.checked=t[3].d.t,s(i,u),M(T,m,P),A&&A.m(T,P),M(T,r,P),M(T,f,P),s(f,p),s(p,_),s(p,v),s(p,h),s(p,d),Te(p,t[3].d.l,!0),g||(k=[Q(o,"change",t[99]),Q(p,"change",t[100])],g=!0)},p(T,P){P[0]&8&&(o.checked=T[3].d.t),T[3].d.t?A||(A=Uf(),A.c(),A.m(r.parentNode,r)):A&&(A.d(1),A=null),P[0]&8&&Te(p,T[3].d.l)},d(T){T&&y(e),T&&y(n),T&&y(l),T&&y(m),A&&A.d(T),T&&y(r),T&&y(f),g=!1,nt(k)}}}function Uf(t){let e;return{c(){e=c("div"),e.textContent="Telnet is unsafe and should be off when not in use",a(e,"class","bd-red")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function Q_(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T,P,F,I,R,w,$,ie,j,U,H,G,V,K,Z,z,W,x,_e,ne,me,Y,ke,Ee,we,Me,te,fe,Oe,Ie,N,C,S,D,O,J,le,pe,ge,Ae,Fe,ce,Pe,ze,ct,Ke,rt,Ge,mt,Ue,Nt,_t,dt,et,Re,tt,Le,Je,at,qe,ye,ve,de,Ve,re,Qe,ee,st,$i,oi,Cl,Di,Li,Ii,Et,Ri,Xe,pn,Fi,$l,Dl,Oi,Wl,qi,zl,Bi,xe,Pt,Gl,Ts,Qt,Xt,Ll,Ui,cl,ji,$o,Ns,Do,ai,tl,Lo,Io,Il,ml,Rl,Ro,Hi,Fo,Mt,Fl,Oo,Wi,dn,hn,vn,bn,zi,qo,Ht,Gi,Bo,Vl,Uo,jo,Ho,_l,gn,kn,Wo,wn,Kl,zo,Go,Vo,Cn,ll,Ko,Vi,Yo,Yl,Qo,Xo,Zo,yn,nl,Jo,Ki,xo,Es,ea,Ql,Yi,il,ta,la,na,Ps,Qi,sl,ia,sa,oa,Wt,Xi,aa,Mn,Sn,ra,ri,ua,Xl,fa,ca,ma,Zt,Tn,Nn,_a,pa,Ct,Zi,da,En,Pn,ha,Zl,va,ba,ga,Ol,pl,An,$n,ka,zt,Ji,xi,wa,Gt,Dn,es,ts,Ca,As,ls,ns,ol,ya,Ma,ui,Sa,ql,Ta,fi,al,Na,Ea,Pa,is,yl,Aa,ut,ss,$a,Ln,In,Da,ci,La,dl,Ia,$s,Ra,Fa,Rn,Ml,Oa,rl,qa,Ds,Jl,Ba,Ua,ja,Sl,Ha,xl,Wa,za,Ga,Tl,Va,Fn,On,Ka,Ya,Qa,Nl,Xa,qn,Za,Ja,xa,At,Bn,Un,jn,Hn,Wn,zn,er,en,tr,lr,nr,El,ir,Ls,Is,Rs,Fs=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),Os,hl,os,sr,Gn,Vn,or,mi,ar,_i,rr,qs,Vt,as,ur,Kn,Yn,fr,pi,cr,rs,us,ul,mr,_r,pr,Bl,Bs,Qn,dr,fs,Xn,hr,cs,Us,tn,js,ln,Hs,nn,Ws,sn,Jt,zs,vr;m=new Ut({}),$=new M_({});let M0=["NOK","SEK","DKK","EUR","CHF"],di=[];for(let B=0;B<5;B+=1)di[B]=I_(L_(t,M0,B));dt=new el({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[R_]},$$scope:{ctx:t}}});let $t=t[3].p.e&&t[0].chip!="esp8266"&&pf(t),Dt=t[3].g.s>0&&df(t);Dl=new Ut({});let S0=[24,48,96,192,384,576,1152],hi=[];for(let B=0;B<7;B+=1)hi[B]=F_(D_(t,S0,B));let Lt=t[3].m.e.e&&hf(t),It=t[3].m.e.e&&vf(t),Rt=t[3].m.m.e&&bf(t);Sn=new Ut({});let Kt=t[0].if&&t[0].if.eth&&gf(),Ft=(t[3].n.c==1||t[3].n.c==2)&&kf(t);Pn=new Ut({}),Dn=new C0({});let Ot=t[3].n.m=="static"&&wf(t);In=new Ut({});let qt=t[0].chip!="esp8266"&&Cf(t),ht=t[3].q.s.e&&yf(t),vt=t[3].q.m==3&&Mf(t),bt=t[3].q.m==4&&Sf(t),gt=t[3].c.es!=null&&Tf(t),kt=Fs&&Pf(t);Vn=new Ut({});let Zn=t[7],St=[];for(let B=0;B20||t[0].chip=="esp8266"||t[3].i.d.d>0)&&Df(t);Yn=new Ut({});let Bt=t[3].d.s&&Bf(t);return tn=new Tt({props:{active:t[1],message:"Loading configuration"}}),ln=new Tt({props:{active:t[2],message:"Saving configuration"}}),nn=new Tt({props:{active:t[4],message:"Performing factory reset"}}),sn=new Tt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=c("form"),n=c("div"),l=c("div"),i=c("strong"),i.textContent="General",o=b(),u=c("a"),ae(m.$$.fragment),r=b(),f=c("input"),p=b(),_=c("div"),v=c("div"),h=c("div"),d=E("Hostname"),g=c("br"),k=b(),A=c("input"),T=b(),P=c("div"),F=E("Time zone"),I=c("br"),R=b(),w=c("select"),ae($.$$.fragment),ie=b(),j=c("input"),U=b(),H=c("div"),G=c("div"),V=c("div"),K=E("Price region"),Z=c("br"),z=b(),W=c("select"),x=c("optgroup"),_e=c("option"),_e.textContent="NO1",ne=c("option"),ne.textContent="NO2",me=c("option"),me.textContent="NO3",Y=c("option"),Y.textContent="NO4",ke=c("option"),ke.textContent="NO5",Ee=c("optgroup"),we=c("option"),we.textContent="SE1",Me=c("option"),Me.textContent="SE2",te=c("option"),te.textContent="SE3",fe=c("option"),fe.textContent="SE4",Oe=c("optgroup"),Ie=c("option"),Ie.textContent="DK1",N=c("option"),N.textContent="DK2",C=c("option"),C.textContent="Austria",S=c("option"),S.textContent="Belgium",D=c("option"),D.textContent="Czech Republic",O=c("option"),O.textContent="Estonia",J=c("option"),J.textContent="Finland",le=c("option"),le.textContent="France",pe=c("option"),pe.textContent="Germany",ge=c("option"),ge.textContent="Great Britain",Ae=c("option"),Ae.textContent="Latvia",Fe=c("option"),Fe.textContent="Lithuania",ce=c("option"),ce.textContent="Netherland",Pe=c("option"),Pe.textContent="Poland",ze=c("option"),ze.textContent="Switzerland",ct=b(),Ke=c("div"),rt=E("Currency"),Ge=c("br"),mt=b(),Ue=c("select");for(let B=0;B<5;B+=1)di[B].c();Nt=b(),_t=c("div"),ae(dt.$$.fragment),et=b(),Re=c("div"),tt=c("label"),Le=c("input"),Je=E(" Enable price fetch from remote server"),at=b(),$t&&$t.c(),qe=b(),ye=c("div"),ve=E("Security"),de=c("br"),Ve=b(),re=c("select"),Qe=c("option"),Qe.textContent="None",ee=c("option"),ee.textContent="Only configuration",st=c("option"),st.textContent="Everything",$i=b(),Dt&&Dt.c(),oi=b(),Cl=c("div"),Di=E("Context"),Li=c("br"),Ii=b(),Et=c("input"),Ri=b(),Xe=c("div"),pn=c("strong"),pn.textContent="Meter",Fi=b(),$l=c("a"),ae(Dl.$$.fragment),Oi=b(),Wl=c("input"),qi=b(),zl=c("input"),Bi=b(),xe=c("div"),Pt=E("Communication"),Gl=c("br"),Ts=b(),Qt=c("select"),Xt=c("option"),Xt.textContent="Passive (Push)",Ll=c("option"),Ll.textContent="Kamstrup (Pull)",Ui=b(),cl=c("div"),ji=c("span"),ji.textContent="Buffer size",$o=b(),Ns=c("span"),Ns.textContent="Serial conf.",Do=b(),ai=c("label"),tl=c("input"),Lo=E(" inverted"),Io=b(),Il=c("div"),ml=c("select"),Rl=c("option"),Ro=E("Autodetect");for(let B=0;B<7;B+=1)hi[B].c();Fo=b(),Mt=c("select"),Fl=c("option"),Oo=E("-"),dn=c("option"),dn.textContent="7N1",hn=c("option"),hn.textContent="8N1",vn=c("option"),vn.textContent="7E1",bn=c("option"),bn.textContent="8E1",qo=b(),Ht=c("input"),Bo=b(),Vl=c("div"),Uo=E("Voltage"),jo=c("br"),Ho=b(),_l=c("select"),gn=c("option"),gn.textContent="400V (TN)",kn=c("option"),kn.textContent="230V (IT/TT)",Wo=b(),wn=c("div"),Kl=c("div"),zo=E("Main fuse"),Go=c("br"),Vo=b(),Cn=c("label"),ll=c("input"),Ko=b(),Vi=c("span"),Vi.textContent="A",Yo=b(),Yl=c("div"),Qo=E("Production"),Xo=c("br"),Zo=b(),yn=c("label"),nl=c("input"),Jo=b(),Ki=c("span"),Ki.textContent="kWp",xo=b(),Es=c("div"),ea=b(),Ql=c("div"),Yi=c("label"),il=c("input"),ta=E(" Meter is encrypted"),la=b(),Lt&&Lt.c(),na=b(),It&&It.c(),Ps=b(),Qi=c("label"),sl=c("input"),ia=E(" Multipliers"),sa=b(),Rt&&Rt.c(),oa=b(),Wt=c("div"),Xi=c("strong"),Xi.textContent="Connection",aa=b(),Mn=c("a"),ae(Sn.$$.fragment),ra=b(),ri=c("input"),ua=b(),Xl=c("div"),fa=E("Connection"),ca=c("br"),ma=b(),Zt=c("select"),Tn=c("option"),Tn.textContent="WiFi",Nn=c("option"),Nn.textContent="Access point",Kt&&Kt.c(),_a=b(),Ft&&Ft.c(),pa=b(),Ct=c("div"),Zi=c("strong"),Zi.textContent="Network",da=b(),En=c("a"),ae(Pn.$$.fragment),ha=b(),Zl=c("div"),va=E("IP"),ba=c("br"),ga=b(),Ol=c("div"),pl=c("select"),An=c("option"),An.textContent="DHCP",$n=c("option"),$n.textContent="Static",ka=b(),zt=c("input"),wa=b(),Gt=c("select"),ae(Dn.$$.fragment),Ca=b(),Ot&&Ot.c(),As=b(),ls=c("div"),ns=c("label"),ol=c("input"),ya=E(" enable mDNS"),Ma=b(),ui=c("input"),Sa=b(),ql=c("div"),Ta=E("NTP "),fi=c("label"),al=c("input"),Na=E(" obtain from DHCP"),Ea=c("br"),Pa=b(),is=c("div"),yl=c("input"),Aa=b(),ut=c("div"),ss=c("strong"),ss.textContent="MQTT",$a=b(),Ln=c("a"),ae(In.$$.fragment),Da=b(),ci=c("input"),La=b(),dl=c("div"),Ia=E(`Server - `),qt&&qt.c(),$s=b(),Ra=c("br"),Fa=b(),Rn=c("div"),Ml=c("input"),Oa=b(),rl=c("input"),qa=b(),ht&&ht.c(),Ds=b(),Jl=c("div"),Ba=E("Username"),Ua=c("br"),ja=b(),Sl=c("input"),Ha=b(),xl=c("div"),Wa=E("Password"),za=c("br"),Ga=b(),Tl=c("input"),Va=b(),Fn=c("div"),On=c("div"),Ka=E("Client ID"),Ya=c("br"),Qa=b(),Nl=c("input"),Xa=b(),qn=c("div"),Za=E("Payload"),Ja=c("br"),xa=b(),At=c("select"),Bn=c("option"),Bn.textContent="JSON",Un=c("option"),Un.textContent="Raw (minimal)",jn=c("option"),jn.textContent="Raw (full)",Hn=c("option"),Hn.textContent="Domoticz",Wn=c("option"),Wn.textContent="HomeAssistant",zn=c("option"),zn.textContent="HEX dump",er=b(),en=c("div"),tr=E("Publish topic"),lr=c("br"),nr=b(),El=c("input"),ir=b(),vt&&vt.c(),Ls=b(),bt&&bt.c(),Is=b(),gt&>.c(),Rs=b(),kt&&kt.c(),Os=b(),hl=c("div"),os=c("strong"),os.textContent="User interface",sr=b(),Gn=c("a"),ae(Vn.$$.fragment),or=b(),mi=c("input"),ar=b(),_i=c("div");for(let B=0;BSave',Us=b(),ae(tn.$$.fragment),js=b(),ae(ln.$$.fragment),Hs=b(),ae(nn.$$.fragment),Ws=b(),ae(sn.$$.fragment),a(i,"class","text-sm"),a(u,"href",jt("General-configuration")),a(u,"target","_blank"),a(u,"class","float-right"),a(f,"type","hidden"),a(f,"name","g"),f.value="true",a(A,"name","gh"),a(A,"type","text"),a(A,"class","in-f w-full"),a(A,"pattern","[A-Za-z0-9-]+"),a(w,"name","gt"),a(w,"class","in-l w-full"),t[3].g.t===void 0&&Ze(()=>t[17].call(w)),a(v,"class","flex"),a(_,"class","my-1"),a(j,"type","hidden"),a(j,"name","p"),j.value="true",_e.__value="10YNO-1--------2",_e.value=_e.__value,ne.__value="10YNO-2--------T",ne.value=ne.__value,me.__value="10YNO-3--------J",me.value=me.__value,Y.__value="10YNO-4--------9",Y.value=Y.__value,ke.__value="10Y1001A1001A48H",ke.value=ke.__value,a(x,"label","Norway"),we.__value="10Y1001A1001A44P",we.value=we.__value,Me.__value="10Y1001A1001A45N",Me.value=Me.__value,te.__value="10Y1001A1001A46L",te.value=te.__value,fe.__value="10Y1001A1001A47J",fe.value=fe.__value,a(Ee,"label","Sweden"),Ie.__value="10YDK-1--------W",Ie.value=Ie.__value,N.__value="10YDK-2--------M",N.value=N.__value,a(Oe,"label","Denmark"),C.__value="10YAT-APG------L",C.value=C.__value,S.__value="10YBE----------2",S.value=S.__value,D.__value="10YCZ-CEPS-----N",D.value=D.__value,O.__value="10Y1001A1001A39I",O.value=O.__value,J.__value="10YFI-1--------U",J.value=J.__value,le.__value="10YFR-RTE------C",le.value=le.__value,pe.__value="10Y1001A1001A83F",pe.value=pe.__value,ge.__value="10YGB----------A",ge.value=ge.__value,Ae.__value="10YLV-1001A00074",Ae.value=Ae.__value,Fe.__value="10YLT-1001A0008Q",Fe.value=Fe.__value,ce.__value="10YNL----------L",ce.value=ce.__value,Pe.__value="10YPL-AREA-----S",Pe.value=Pe.__value,ze.__value="10YCH-SWISSGRIDZ",ze.value=ze.__value,a(W,"name","pr"),a(W,"class","in-f w-full"),t[3].p.r===void 0&&Ze(()=>t[18].call(W)),a(V,"class","w-full"),a(Ue,"name","pc"),a(Ue,"class","in-l"),t[3].p.c===void 0&&Ze(()=>t[19].call(Ue)),a(G,"class","flex"),a(H,"class","my-1"),a(_t,"class","my-1"),a(Le,"type","checkbox"),a(Le,"name","pe"),Le.__value="true",Le.value=Le.__value,a(Le,"class","rounded mb-1"),a(Re,"class","my-1"),Qe.__value=0,Qe.value=Qe.__value,ee.__value=1,ee.value=ee.__value,st.__value=2,st.value=st.__value,a(re,"name","gs"),a(re,"class","in-s"),t[3].g.s===void 0&&Ze(()=>t[22].call(re)),a(ye,"class","my-1"),a(Et,"name","gc"),a(Et,"type","text"),a(Et,"pattern","[A-Za-z0-9]+"),a(Et,"placeholder","[root]"),a(Et,"class","in-s"),a(Et,"maxlength","36"),a(Cl,"class","my-1"),a(l,"class","cnt"),a(pn,"class","text-sm"),a($l,"href",jt("Meter-configuration")),a($l,"target","_blank"),a($l,"class","float-right"),a(Wl,"type","hidden"),a(Wl,"name","m"),Wl.value="true",a(zl,"type","hidden"),a(zl,"name","mo"),zl.value="1",Xt.__value=0,Xt.value=Xt.__value,Ll.__value=9,Ll.value=Ll.__value,a(Qt,"name","ma"),a(Qt,"class","in-s"),t[3].m.a===void 0&&Ze(()=>t[26].call(Qt)),a(xe,"class","my-1"),a(ji,"class","float-right"),a(tl,"name","mi"),tl.__value="true",tl.value=tl.__value,a(tl,"type","checkbox"),a(tl,"class","rounded mb-1"),a(ai,"class","mt-2 ml-3 whitespace-nowrap"),Rl.__value=0,Rl.value=Rl.__value,Rl.disabled=Hi=t[3].m.b!=0,a(ml,"name","mb"),a(ml,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Ze(()=>t[28].call(ml)),Fl.__value=0,Fl.value=Fl.__value,Fl.disabled=Wi=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,hn.__value=3,hn.value=hn.__value,vn.__value=10,vn.value=vn.__value,bn.__value=11,bn.value=bn.__value,a(Mt,"name","mp"),a(Mt,"class","in-m"),Mt.disabled=zi=t[3].m.b==0,t[3].m.p===void 0&&Ze(()=>t[29].call(Mt)),a(Ht,"name","ms"),a(Ht,"type","number"),a(Ht,"min",64),a(Ht,"max",Gi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),a(Ht,"step",64),a(Ht,"class","in-l tr w-1/2"),a(Il,"class","flex w-full"),a(cl,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,a(_l,"name","md"),a(_l,"class","in-s"),t[3].m.d===void 0&&Ze(()=>t[31].call(_l)),a(Vl,"class","my-1"),a(ll,"name","mf"),a(ll,"type","number"),a(ll,"min","5"),a(ll,"max","65535"),a(ll,"class","in-f tr w-full"),a(Vi,"class","in-post"),a(Cn,"class","flex"),a(Kl,"class","mx-1"),a(nl,"name","mr"),a(nl,"type","number"),a(nl,"min","0"),a(nl,"max","65535"),a(nl,"class","in-f tr w-full"),a(Ki,"class","in-post"),a(yn,"class","flex"),a(Yl,"class","mx-1"),a(wn,"class","my-1 flex"),a(Es,"class","my-1"),a(il,"type","checkbox"),a(il,"name","me"),il.__value="true",il.value=il.__value,a(il,"class","rounded mb-1"),a(Ql,"class","my-1"),a(sl,"type","checkbox"),a(sl,"name","mm"),sl.__value="true",sl.value=sl.__value,a(sl,"class","rounded mb-1"),a(Xe,"class","cnt"),a(Xi,"class","text-sm"),a(Mn,"href",jt("WiFi-configuration")),a(Mn,"target","_blank"),a(Mn,"class","float-right"),a(ri,"type","hidden"),a(ri,"name","w"),ri.value="true",Tn.__value=1,Tn.value=Tn.__value,Nn.__value=2,Nn.value=Nn.__value,a(Zt,"name","nc"),a(Zt,"class","in-s"),t[3].n.c===void 0&&Ze(()=>t[42].call(Zt)),a(Xl,"class","my-1"),a(Wt,"class","cnt"),a(Zi,"class","text-sm"),a(En,"href",jt("Network-configuration")),a(En,"target","_blank"),a(En,"class","float-right"),An.__value="dhcp",An.value=An.__value,$n.__value="static",$n.value=$n.__value,a(pl,"name","nm"),a(pl,"class","in-f"),t[3].n.m===void 0&&Ze(()=>t[48].call(pl)),a(zt,"name","ni"),a(zt,"type","text"),a(zt,"class","in-m w-full"),zt.disabled=Ji=t[3].n.m=="dhcp",zt.required=xi=t[3].n.m=="static",a(Gt,"name","ns"),a(Gt,"class","in-l"),Gt.disabled=es=t[3].n.m=="dhcp",Gt.required=ts=t[3].n.m=="static",t[3].n.s===void 0&&Ze(()=>t[50].call(Gt)),a(Ol,"class","flex"),a(Zl,"class","my-1"),a(ol,"name","nd"),ol.__value="true",ol.value=ol.__value,a(ol,"type","checkbox"),a(ol,"class","rounded mb-1"),a(ls,"class","my-1"),a(ui,"type","hidden"),a(ui,"name","ntp"),ui.value="true",a(al,"name","ntpd"),al.__value="true",al.value=al.__value,a(al,"type","checkbox"),a(al,"class","rounded mb-1"),a(fi,"class","ml-4"),a(yl,"name","ntph"),a(yl,"type","text"),a(yl,"class","in-s"),a(is,"class","flex"),a(ql,"class","my-1"),a(Ct,"class","cnt"),a(ss,"class","text-sm"),a(Ln,"href",jt("MQTT-configuration")),a(Ln,"target","_blank"),a(Ln,"class","float-right"),a(ci,"type","hidden"),a(ci,"name","q"),ci.value="true",a(Ml,"name","qh"),a(Ml,"type","text"),a(Ml,"class","in-f w-3/4"),a(rl,"name","qp"),a(rl,"type","number"),a(rl,"min","1024"),a(rl,"max","65535"),a(rl,"class","in-l tr w-1/4"),a(Rn,"class","flex"),a(dl,"class","my-1"),a(Sl,"name","qu"),a(Sl,"type","text"),a(Sl,"class","in-s"),a(Jl,"class","my-1"),a(Tl,"name","qa"),a(Tl,"type","password"),a(Tl,"class","in-s"),a(xl,"class","my-1"),a(Nl,"name","qc"),a(Nl,"type","text"),a(Nl,"class","in-f w-full"),Bn.__value=0,Bn.value=Bn.__value,Un.__value=1,Un.value=Un.__value,jn.__value=2,jn.value=jn.__value,Hn.__value=3,Hn.value=Hn.__value,Wn.__value=4,Wn.value=Wn.__value,zn.__value=255,zn.value=zn.__value,a(At,"name","qm"),a(At,"class","in-l"),t[3].q.m===void 0&&Ze(()=>t[63].call(At)),a(Fn,"class","my-1 flex"),a(El,"name","qb"),a(El,"type","text"),a(El,"class","in-s"),a(en,"class","my-1"),a(ut,"class","cnt"),a(os,"class","text-sm"),a(Gn,"href",jt("User-interface")),a(Gn,"target","_blank"),a(Gn,"class","float-right"),a(mi,"type","hidden"),a(mi,"name","u"),mi.value="true",a(_i,"class","flex flex-wrap"),a(hl,"class","cnt"),a(as,"class","text-sm"),a(Kn,"href","https://amsleser.no/blog/post/24-telnet-debug"),a(Kn,"target","_blank"),a(Kn,"class","float-right"),a(pi,"type","hidden"),a(pi,"name","d"),pi.value="true",a(ul,"type","checkbox"),a(ul,"name","ds"),ul.__value="true",ul.value=ul.__value,a(ul,"class","rounded mb-1"),a(rs,"class","mt-3"),a(Vt,"class","cnt"),a(n,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),a(Qn,"type","button"),a(Qn,"class","btn-red"),a(Xn,"type","button"),a(Xn,"class","btn-yellow"),a(fs,"class","text-center"),a(cs,"class","text-right"),a(Bl,"class","grid grid-cols-3 mt-3"),a(e,"autocomplete","off")},m(B,he){M(B,e,he),s(e,n),s(n,l),s(l,i),s(l,o),s(l,u),se(m,u,null),s(l,r),s(l,f),s(l,p),s(l,_),s(_,v),s(v,h),s(h,d),s(h,g),s(h,k),s(h,A),ue(A,t[3].g.h),s(v,T),s(v,P),s(P,F),s(P,I),s(P,R),s(P,w),se($,w,null),Te(w,t[3].g.t,!0),s(l,ie),s(l,j),s(l,U),s(l,H),s(H,G),s(G,V),s(V,K),s(V,Z),s(V,z),s(V,W),s(W,x),s(x,_e),s(x,ne),s(x,me),s(x,Y),s(x,ke),s(W,Ee),s(Ee,we),s(Ee,Me),s(Ee,te),s(Ee,fe),s(W,Oe),s(Oe,Ie),s(Oe,N),s(W,C),s(W,S),s(W,D),s(W,O),s(W,J),s(W,le),s(W,pe),s(W,ge),s(W,Ae),s(W,Fe),s(W,ce),s(W,Pe),s(W,ze),Te(W,t[3].p.r,!0),s(G,ct),s(G,Ke),s(Ke,rt),s(Ke,Ge),s(Ke,mt),s(Ke,Ue);for(let yt=0;yt<5;yt+=1)di[yt]&&di[yt].m(Ue,null);Te(Ue,t[3].p.c,!0),s(l,Nt),s(l,_t),se(dt,_t,null),s(l,et),s(l,Re),s(Re,tt),s(tt,Le),Le.checked=t[3].p.e,s(tt,Je),s(Re,at),$t&&$t.m(Re,null),s(l,qe),s(l,ye),s(ye,ve),s(ye,de),s(ye,Ve),s(ye,re),s(re,Qe),s(re,ee),s(re,st),Te(re,t[3].g.s,!0),s(l,$i),Dt&&Dt.m(l,null),s(l,oi),s(l,Cl),s(Cl,Di),s(Cl,Li),s(Cl,Ii),s(Cl,Et),ue(Et,t[3].g.c),s(n,Ri),s(n,Xe),s(Xe,pn),s(Xe,Fi),s(Xe,$l),se(Dl,$l,null),s(Xe,Oi),s(Xe,Wl),s(Xe,qi),s(Xe,zl),s(Xe,Bi),s(Xe,xe),s(xe,Pt),s(xe,Gl),s(xe,Ts),s(xe,Qt),s(Qt,Xt),s(Qt,Ll),Te(Qt,t[3].m.a,!0),s(Xe,Ui),s(Xe,cl),s(cl,ji),s(cl,$o),s(cl,Ns),s(cl,Do),s(cl,ai),s(ai,tl),tl.checked=t[3].m.i,s(ai,Lo),s(cl,Io),s(cl,Il),s(Il,ml),s(ml,Rl),s(Rl,Ro);for(let yt=0;yt<7;yt+=1)hi[yt]&&hi[yt].m(ml,null);Te(ml,t[3].m.b,!0),s(Il,Fo),s(Il,Mt),s(Mt,Fl),s(Fl,Oo),s(Mt,dn),s(Mt,hn),s(Mt,vn),s(Mt,bn),Te(Mt,t[3].m.p,!0),s(Il,qo),s(Il,Ht),ue(Ht,t[3].m.s),s(Xe,Bo),s(Xe,Vl),s(Vl,Uo),s(Vl,jo),s(Vl,Ho),s(Vl,_l),s(_l,gn),s(_l,kn),Te(_l,t[3].m.d,!0),s(Xe,Wo),s(Xe,wn),s(wn,Kl),s(Kl,zo),s(Kl,Go),s(Kl,Vo),s(Kl,Cn),s(Cn,ll),ue(ll,t[3].m.f),s(Cn,Ko),s(Cn,Vi),s(wn,Yo),s(wn,Yl),s(Yl,Qo),s(Yl,Xo),s(Yl,Zo),s(Yl,yn),s(yn,nl),ue(nl,t[3].m.r),s(yn,Jo),s(yn,Ki),s(Xe,xo),s(Xe,Es),s(Xe,ea),s(Xe,Ql),s(Ql,Yi),s(Yi,il),il.checked=t[3].m.e.e,s(Yi,ta),s(Ql,la),Lt&&Lt.m(Ql,null),s(Xe,na),It&&It.m(Xe,null),s(Xe,Ps),s(Xe,Qi),s(Qi,sl),sl.checked=t[3].m.m.e,s(Qi,ia),s(Xe,sa),Rt&&Rt.m(Xe,null),s(n,oa),s(n,Wt),s(Wt,Xi),s(Wt,aa),s(Wt,Mn),se(Sn,Mn,null),s(Wt,ra),s(Wt,ri),s(Wt,ua),s(Wt,Xl),s(Xl,fa),s(Xl,ca),s(Xl,ma),s(Xl,Zt),s(Zt,Tn),s(Zt,Nn),Kt&&Kt.m(Zt,null),Te(Zt,t[3].n.c,!0),s(Wt,_a),Ft&&Ft.m(Wt,null),s(n,pa),s(n,Ct),s(Ct,Zi),s(Ct,da),s(Ct,En),se(Pn,En,null),s(Ct,ha),s(Ct,Zl),s(Zl,va),s(Zl,ba),s(Zl,ga),s(Zl,Ol),s(Ol,pl),s(pl,An),s(pl,$n),Te(pl,t[3].n.m,!0),s(Ol,ka),s(Ol,zt),ue(zt,t[3].n.i),s(Ol,wa),s(Ol,Gt),se(Dn,Gt,null),Te(Gt,t[3].n.s,!0),s(Ct,Ca),Ot&&Ot.m(Ct,null),s(Ct,As),s(Ct,ls),s(ls,ns),s(ns,ol),ol.checked=t[3].n.d,s(ns,ya),s(Ct,Ma),s(Ct,ui),s(Ct,Sa),s(Ct,ql),s(ql,Ta),s(ql,fi),s(fi,al),al.checked=t[3].n.h,s(fi,Na),s(ql,Ea),s(ql,Pa),s(ql,is),s(is,yl),ue(yl,t[3].n.n1),s(n,Aa),s(n,ut),s(ut,ss),s(ut,$a),s(ut,Ln),se(In,Ln,null),s(ut,Da),s(ut,ci),s(ut,La),s(ut,dl),s(dl,Ia),qt&&qt.m(dl,null),s(dl,$s),s(dl,Ra),s(dl,Fa),s(dl,Rn),s(Rn,Ml),ue(Ml,t[3].q.h),s(Rn,Oa),s(Rn,rl),ue(rl,t[3].q.p),s(ut,qa),ht&&ht.m(ut,null),s(ut,Ds),s(ut,Jl),s(Jl,Ba),s(Jl,Ua),s(Jl,ja),s(Jl,Sl),ue(Sl,t[3].q.u),s(ut,Ha),s(ut,xl),s(xl,Wa),s(xl,za),s(xl,Ga),s(xl,Tl),ue(Tl,t[3].q.a),s(ut,Va),s(ut,Fn),s(Fn,On),s(On,Ka),s(On,Ya),s(On,Qa),s(On,Nl),ue(Nl,t[3].q.c),s(Fn,Xa),s(Fn,qn),s(qn,Za),s(qn,Ja),s(qn,xa),s(qn,At),s(At,Bn),s(At,Un),s(At,jn),s(At,Hn),s(At,Wn),s(At,zn),Te(At,t[3].q.m,!0),s(ut,er),s(ut,en),s(en,tr),s(en,lr),s(en,nr),s(en,El),ue(El,t[3].q.b),s(n,ir),vt&&vt.m(n,null),s(n,Ls),bt&&bt.m(n,null),s(n,Is),gt&>.m(n,null),s(n,Rs),kt&&kt.m(n,null),s(n,Os),s(n,hl),s(hl,os),s(hl,sr),s(hl,Gn),se(Vn,Gn,null),s(hl,or),s(hl,mi),s(hl,ar),s(hl,_i);for(let yt=0;yt0?Dt?Dt.p(B,he):(Dt=df(B),Dt.c(),Dt.m(l,oi)):Dt&&(Dt.d(1),Dt=null),he[0]&8&&Et.value!==B[3].g.c&&ue(Et,B[3].g.c),he[0]&8&&Te(Qt,B[3].m.a),he[0]&8&&(tl.checked=B[3].m.i),(!Jt||he[0]&8&&Hi!==(Hi=B[3].m.b!=0))&&(Rl.disabled=Hi),he[0]&8&&Te(ml,B[3].m.b),(!Jt||he[0]&8&&Wi!==(Wi=B[3].m.b!=0))&&(Fl.disabled=Wi),(!Jt||he[0]&8&&zi!==(zi=B[3].m.b==0))&&(Mt.disabled=zi),he[0]&8&&Te(Mt,B[3].m.p),(!Jt||he[0]&9&&Gi!==(Gi=B[0].chip=="esp8266"?B[3].i.h.p==3||B[3].i.h.p==113?512:128:4096))&&a(Ht,"max",Gi),he[0]&8&&Se(Ht.value)!==B[3].m.s&&ue(Ht,B[3].m.s),he[0]&8&&Te(_l,B[3].m.d),he[0]&8&&Se(ll.value)!==B[3].m.f&&ue(ll,B[3].m.f),he[0]&8&&Se(nl.value)!==B[3].m.r&&ue(nl,B[3].m.r),he[0]&8&&(il.checked=B[3].m.e.e),B[3].m.e.e?Lt?Lt.p(B,he):(Lt=hf(B),Lt.c(),Lt.m(Ql,null)):Lt&&(Lt.d(1),Lt=null),B[3].m.e.e?It?It.p(B,he):(It=vf(B),It.c(),It.m(Xe,Ps)):It&&(It.d(1),It=null),he[0]&8&&(sl.checked=B[3].m.m.e),B[3].m.m.e?Rt?Rt.p(B,he):(Rt=bf(B),Rt.c(),Rt.m(Xe,null)):Rt&&(Rt.d(1),Rt=null),B[0].if&&B[0].if.eth?Kt||(Kt=gf(),Kt.c(),Kt.m(Zt,null)):Kt&&(Kt.d(1),Kt=null),he[0]&8&&Te(Zt,B[3].n.c),B[3].n.c==1||B[3].n.c==2?Ft?Ft.p(B,he):(Ft=kf(B),Ft.c(),Ft.m(Wt,null)):Ft&&(Ft.d(1),Ft=null),he[0]&8&&Te(pl,B[3].n.m),(!Jt||he[0]&8&&Ji!==(Ji=B[3].n.m=="dhcp"))&&(zt.disabled=Ji),(!Jt||he[0]&8&&xi!==(xi=B[3].n.m=="static"))&&(zt.required=xi),he[0]&8&&zt.value!==B[3].n.i&&ue(zt,B[3].n.i),(!Jt||he[0]&8&&es!==(es=B[3].n.m=="dhcp"))&&(Gt.disabled=es),(!Jt||he[0]&8&&ts!==(ts=B[3].n.m=="static"))&&(Gt.required=ts),he[0]&8&&Te(Gt,B[3].n.s),B[3].n.m=="static"?Ot?Ot.p(B,he):(Ot=wf(B),Ot.c(),Ot.m(Ct,As)):Ot&&(Ot.d(1),Ot=null),he[0]&8&&(ol.checked=B[3].n.d),he[0]&8&&(al.checked=B[3].n.h),he[0]&8&&yl.value!==B[3].n.n1&&ue(yl,B[3].n.n1),B[0].chip!="esp8266"?qt?qt.p(B,he):(qt=Cf(B),qt.c(),qt.m(dl,$s)):qt&&(qt.d(1),qt=null),he[0]&8&&Ml.value!==B[3].q.h&&ue(Ml,B[3].q.h),he[0]&8&&Se(rl.value)!==B[3].q.p&&ue(rl,B[3].q.p),B[3].q.s.e?ht?(ht.p(B,he),he[0]&8&&L(ht,1)):(ht=yf(B),ht.c(),L(ht,1),ht.m(ut,Ds)):ht&&($e(),q(ht,1,1,()=>{ht=null}),De()),he[0]&8&&Sl.value!==B[3].q.u&&ue(Sl,B[3].q.u),he[0]&8&&Tl.value!==B[3].q.a&&ue(Tl,B[3].q.a),he[0]&8&&Nl.value!==B[3].q.c&&ue(Nl,B[3].q.c),he[0]&8&&Te(At,B[3].q.m),he[0]&8&&El.value!==B[3].q.b&&ue(El,B[3].q.b),B[3].q.m==3?vt?(vt.p(B,he),he[0]&8&&L(vt,1)):(vt=Mf(B),vt.c(),L(vt,1),vt.m(n,Ls)):vt&&($e(),q(vt,1,1,()=>{vt=null}),De()),B[3].q.m==4?bt?(bt.p(B,he),he[0]&8&&L(bt,1)):(bt=Sf(B),bt.c(),L(bt,1),bt.m(n,Is)):bt&&($e(),q(bt,1,1,()=>{bt=null}),De()),B[3].c.es!=null?gt?(gt.p(B,he),he[0]&8&&L(gt,1)):(gt=Tf(B),gt.c(),L(gt,1),gt.m(n,Rs)):gt&&($e(),q(gt,1,1,()=>{gt=null}),De()),he[0]&8&&(Fs=B[3].p.r.startsWith("10YNO")||B[3].p.r.startsWith("10Y1001A1001A4")),Fs?kt?(kt.p(B,he),he[0]&8&&L(kt,1)):(kt=Pf(B),kt.c(),L(kt,1),kt.m(n,Os)):kt&&($e(),q(kt,1,1,()=>{kt=null}),De()),he[0]&136){Zn=B[7];let xt;for(xt=0;xt20||B[0].chip=="esp8266"||B[3].i.d.d>0?wt?(wt.p(B,he),he[0]&9&&L(wt,1)):(wt=Df(B),wt.c(),L(wt,1),wt.m(n,qs)):wt&&($e(),q(wt,1,1,()=>{wt=null}),De()),he[0]&8&&(ul.checked=B[3].d.s),B[3].d.s?Bt?Bt.p(B,he):(Bt=Bf(B),Bt.c(),Bt.m(Vt,null)):Bt&&(Bt.d(1),Bt=null);const br={};he[0]&2&&(br.active=B[1]),tn.$set(br);const gr={};he[0]&4&&(gr.active=B[2]),ln.$set(gr);const kr={};he[0]&16&&(kr.active=B[4]),nn.$set(kr);const wr={};he[0]&32&&(wr.active=B[5]),sn.$set(wr)},i(B){Jt||(L(m.$$.fragment,B),L($.$$.fragment,B),L(dt.$$.fragment,B),L(Dl.$$.fragment,B),L(Sn.$$.fragment,B),L(Pn.$$.fragment,B),L(Dn.$$.fragment,B),L(In.$$.fragment,B),L(ht),L(vt),L(bt),L(gt),L(kt),L(Vn.$$.fragment,B),L(wt),L(Yn.$$.fragment,B),L(tn.$$.fragment,B),L(ln.$$.fragment,B),L(nn.$$.fragment,B),L(sn.$$.fragment,B),Jt=!0)},o(B){q(m.$$.fragment,B),q($.$$.fragment,B),q(dt.$$.fragment,B),q(Dl.$$.fragment,B),q(Sn.$$.fragment,B),q(Pn.$$.fragment,B),q(Dn.$$.fragment,B),q(In.$$.fragment,B),q(ht),q(vt),q(bt),q(gt),q(kt),q(Vn.$$.fragment,B),q(wt),q(Yn.$$.fragment,B),q(tn.$$.fragment,B),q(ln.$$.fragment,B),q(nn.$$.fragment,B),q(sn.$$.fragment,B),Jt=!1},d(B){B&&y(e),oe(m),oe($),ft(di,B),oe(dt),$t&&$t.d(),Dt&&Dt.d(),oe(Dl),ft(hi,B),Lt&&Lt.d(),It&&It.d(),Rt&&Rt.d(),oe(Sn),Kt&&Kt.d(),Ft&&Ft.d(),oe(Pn),oe(Dn),Ot&&Ot.d(),oe(In),qt&&qt.d(),ht&&ht.d(),vt&&vt.d(),bt&&bt.d(),gt&>.d(),kt&&kt.d(),oe(Vn),ft(St,B),wt&&wt.d(),oe(Yn),Bt&&Bt.d(),B&&y(Us),oe(tn,B),B&&y(js),oe(ln,B),B&&y(Hs),oe(nn,B),B&&y(Ws),oe(sn,B),zs=!1,nt(vr)}}}async function X_(){await(await fetch("reboot",{method:"POST"})).json()}function Z_(t,e,n){let{basepath:l="/"}=e,{sysinfo:i={}}=e,o=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Per phase",key:"h"},{name:"Power factor",key:"f"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],u=!0,m=!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,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},d:{d:null,b:0},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{e:!1,i:null,es:null}};gi.subscribe(xe=>{xe.version&&(n(3,r=xe),n(1,u=!1))}),p_();let f=!1,p=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){n(4,f=!0);const xe=new URLSearchParams;xe.append("perform","true");let Gl=await(await fetch("reset",{method:"POST",body:xe})).json();n(4,f=!1),n(5,p=Gl.success)}}async function v(xe){n(2,m=!0);const Pt=new FormData(xe.target),Gl=new URLSearchParams;for(let Xt of Pt){const[Ll,Ui]=Xt;Gl.append(Ll,Ui)}let Qt=await(await fetch("save",{method:"POST",body:Gl})).json();Yt.update(Xt=>(Xt.booting=Qt.reboot,Xt.ui=r.u,Xt)),n(2,m=!1),cn(l)}const h=function(){confirm("Are you sure you want to reboot the device?")&&(Yt.update(xe=>(xe.booting=!0,xe)),X_())};async function d(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),gi.update(Pt=>(Pt.q.s.c=!1,Pt)))}async function g(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),gi.update(Pt=>(Pt.q.s.r=!1,Pt)))}async function k(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),gi.update(Pt=>(Pt.q.s.k=!1,Pt)))}const A=function(){r.q.s.e?r.q.p==1883&&n(3,r.q.p=8883,r):r.q.p==8883&&n(3,r.q.p=1883,r)};let T=44;function P(){r.g.h=this.value,n(3,r)}function F(){r.g.t=ot(this),n(3,r)}function I(){r.p.r=ot(this),n(3,r)}function R(){r.p.c=ot(this),n(3,r)}function w(){r.p.e=this.checked,n(3,r)}function $(){r.p.t=this.value,n(3,r)}function ie(){r.g.s=ot(this),n(3,r)}function j(){r.g.u=this.value,n(3,r)}function U(){r.g.p=this.value,n(3,r)}function H(){r.g.c=this.value,n(3,r)}function G(){r.m.a=ot(this),n(3,r)}function V(){r.m.i=this.checked,n(3,r)}function K(){r.m.b=ot(this),n(3,r)}function Z(){r.m.p=ot(this),n(3,r)}function z(){r.m.s=Se(this.value),n(3,r)}function W(){r.m.d=ot(this),n(3,r)}function x(){r.m.f=Se(this.value),n(3,r)}function _e(){r.m.r=Se(this.value),n(3,r)}function ne(){r.m.e.e=this.checked,n(3,r)}function me(){r.m.e.k=this.value,n(3,r)}function Y(){r.m.e.a=this.value,n(3,r)}function ke(){r.m.m.e=this.checked,n(3,r)}function Ee(){r.m.m.w=Se(this.value),n(3,r)}function we(){r.m.m.v=Se(this.value),n(3,r)}function Me(){r.m.m.a=Se(this.value),n(3,r)}function te(){r.m.m.c=Se(this.value),n(3,r)}function fe(){r.n.c=ot(this),n(3,r)}function Oe(){r.w.s=this.value,n(3,r)}function Ie(){r.w.p=this.value,n(3,r)}function N(){r.w.z=ot(this),n(3,r)}function C(){r.w.w=Se(this.value),n(3,r)}function S(){r.w.b=this.checked,n(3,r)}function D(){r.n.m=ot(this),n(3,r)}function O(){r.n.i=this.value,n(3,r)}function J(){r.n.s=ot(this),n(3,r)}function le(){r.n.g=this.value,n(3,r)}function pe(){r.n.d1=this.value,n(3,r)}function ge(){r.n.d2=this.value,n(3,r)}function Ae(){r.n.d=this.checked,n(3,r)}function Fe(){r.n.h=this.checked,n(3,r)}function ce(){r.n.n1=this.value,n(3,r)}function Pe(){r.q.s.e=this.checked,n(3,r)}function ze(){r.q.h=this.value,n(3,r)}function ct(){r.q.p=Se(this.value),n(3,r)}function Ke(){r.q.u=this.value,n(3,r)}function rt(){r.q.a=this.value,n(3,r)}function Ge(){r.q.c=this.value,n(3,r)}function mt(){r.q.m=ot(this),n(3,r)}function Ue(){r.q.b=this.value,n(3,r)}function Nt(){r.o.e=this.value,n(3,r)}function _t(){r.o.c=this.value,n(3,r)}function dt(){r.o.u1=this.value,n(3,r)}function et(){r.o.u2=this.value,n(3,r)}function Re(){r.o.u3=this.value,n(3,r)}function tt(){r.h.t=this.value,n(3,r)}function Le(){r.h.h=this.value,n(3,r)}function Je(){r.h.n=this.value,n(3,r)}function at(){r.c.e=this.checked,n(3,r)}function qe(){r.c.es=this.checked,n(3,r)}function ye(xe){r.t.t[xe]=Se(this.value),n(3,r)}function ve(){r.t.h=Se(this.value),n(3,r)}function de(xe){r.u[xe.key]=ot(this),n(3,r)}function Ve(){r.i.h.p=ot(this),n(3,r)}function re(){r.i.h.t=ot(this),n(3,r)}function Qe(){r.i.h.u=this.checked,n(3,r)}function ee(){r.i.a=Se(this.value),n(3,r)}function st(){r.i.l.p=Se(this.value),n(3,r)}function $i(){r.i.l.i=this.checked,n(3,r)}function oi(){r.i.r.i=this.checked,n(3,r)}function Cl(){r.i.r.r=Se(this.value),n(3,r)}function Di(){r.i.r.g=Se(this.value),n(3,r)}function Li(){r.i.r.b=Se(this.value),n(3,r)}function Ii(){r.i.d.d=Se(this.value),n(3,r)}function Et(){r.i.t.d=Se(this.value),n(3,r)}function Ri(){r.i.t.a=Se(this.value),n(3,r)}function Xe(){r.i.v.p=Se(this.value),n(3,r)}function pn(){r.i.v.d.v=Se(this.value),n(3,r)}function Fi(){r.i.v.d.g=Se(this.value),n(3,r)}function $l(){r.i.d.b=ot(this),n(3,r)}function Dl(){r.i.v.o=Se(this.value),n(3,r)}function Oi(){r.i.v.m=Se(this.value),n(3,r)}function Wl(){r.i.v.b=Se(this.value),n(3,r)}function qi(){r.d.s=this.checked,n(3,r)}function zl(){r.d.t=this.checked,n(3,r)}function Bi(){r.d.l=ot(this),n(3,r)}return t.$$set=xe=>{"basepath"in xe&&n(15,l=xe.basepath),"sysinfo"in xe&&n(0,i=xe.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&n(6,T=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,u,m,r,f,p,T,o,_,v,h,d,g,k,A,l,P,F,I,R,w,$,ie,j,U,H,G,V,K,Z,z,W,x,_e,ne,me,Y,ke,Ee,we,Me,te,fe,Oe,Ie,N,C,S,D,O,J,le,pe,ge,Ae,Fe,ce,Pe,ze,ct,Ke,rt,Ge,mt,Ue,Nt,_t,dt,et,Re,tt,Le,Je,at,qe,ye,ve,de,Ve,re,Qe,ee,st,$i,oi,Cl,Di,Li,Ii,Et,Ri,Xe,pn,Fi,$l,Dl,Oi,Wl,qi,zl,Bi]}class J_ extends We{constructor(e){super(),He(this,e,Z_,Q_,Be,{basepath:15,sysinfo:0},null,[-1,-1,-1,-1])}}function jf(t,e,n){const l=t.slice();return l[20]=e[n],l}function x_(t){let e=Ce(t[1].chip,t[1].board)+"",n;return{c(){n=E(e)},m(l,i){M(l,n,i)},p(l,i){i&2&&e!==(e=Ce(l[1].chip,l[1].board)+"")&&X(n,e)},d(l){l&&y(n)}}}function Hf(t){let e,n,l=t[1].apmac+"",i,o,u,m,r,f,p,_,v,h=Ur(t[1])+"",d,g,k=t[1].boot_reason+"",A,T,P=t[1].ex_cause+"",F,I,R;const w=[tp,ep],$=[];function ie(j,U){return j[0].u>0?0:1}return r=ie(t),f=$[r]=w[r](t),{c(){e=c("div"),n=E("AP MAC: "),i=E(l),o=b(),u=c("div"),m=E(`Last boot: - `),f.c(),p=b(),_=c("div"),v=E("Reason: "),d=E(h),g=E(" ("),A=E(k),T=E("/"),F=E(P),I=E(")"),a(e,"class","my-2"),a(u,"class","my-2"),a(_,"class","my-2")},m(j,U){M(j,e,U),s(e,n),s(e,i),M(j,o,U),M(j,u,U),s(u,m),$[r].m(u,null),M(j,p,U),M(j,_,U),s(_,v),s(_,d),s(_,g),s(_,A),s(_,T),s(_,F),s(_,I),R=!0},p(j,U){(!R||U&2)&&l!==(l=j[1].apmac+"")&&X(i,l);let H=r;r=ie(j),r===H?$[r].p(j,U):($e(),q($[H],1,1,()=>{$[H]=null}),De(),f=$[r],f?f.p(j,U):(f=$[r]=w[r](j),f.c()),L(f,1),f.m(u,null)),(!R||U&2)&&h!==(h=Ur(j[1])+"")&&X(d,h),(!R||U&2)&&k!==(k=j[1].boot_reason+"")&&X(A,k),(!R||U&2)&&P!==(P=j[1].ex_cause+"")&&X(F,P)},i(j){R||(L(f),R=!0)},o(j){q(f),R=!1},d(j){j&&y(e),j&&y(o),j&&y(u),$[r].d(),j&&y(p),j&&y(_)}}}function ep(t){let e;return{c(){e=E("-")},m(n,l){M(n,e,l)},p:be,i:be,o:be,d(n){n&&y(e)}}}function tp(t){let e,n;return e=new b0({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-l[0].u*1e3)),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function lp(t){let e;return{c(){e=c("span"),e.textContent="Update consents",a(e,"class","btn-pri-sm")},m(n,l){M(n,e,l)},p:be,d(n){n&&y(e)}}}function Wf(t){let e,n,l,i,o,u=Cs(t[1].meter.mfg)+"",m,r,f,p,_=(t[1].meter.model?t[1].meter.model:"unknown")+"",v,h,d,g,k=(t[1].meter.id?t[1].meter.id:"unknown")+"",A;return{c(){e=c("div"),n=c("strong"),n.textContent="Meter",l=b(),i=c("div"),o=E("Manufacturer: "),m=E(u),r=b(),f=c("div"),p=E("Model: "),v=E(_),h=b(),d=c("div"),g=E("ID: "),A=E(k),a(n,"class","text-sm"),a(i,"class","my-2"),a(f,"class","my-2"),a(d,"class","my-2"),a(e,"class","cnt")},m(T,P){M(T,e,P),s(e,n),s(e,l),s(e,i),s(i,o),s(i,m),s(e,r),s(e,f),s(f,p),s(f,v),s(e,h),s(e,d),s(d,g),s(d,A)},p(T,P){P&2&&u!==(u=Cs(T[1].meter.mfg)+"")&&X(m,u),P&2&&_!==(_=(T[1].meter.model?T[1].meter.model:"unknown")+"")&&X(v,_),P&2&&k!==(k=(T[1].meter.id?T[1].meter.id:"unknown")+"")&&X(A,k)},d(T){T&&y(e)}}}function zf(t){let e,n,l,i,o,u=t[1].net.ip+"",m,r,f,p,_=t[1].net.mask+"",v,h,d,g,k=t[1].net.gw+"",A,T,P,F,I=t[1].net.dns1+"",R,w,$=t[1].net.dns2&&Gf(t);return{c(){e=c("div"),n=c("strong"),n.textContent="Network",l=b(),i=c("div"),o=E("IP: "),m=E(u),r=b(),f=c("div"),p=E("Mask: "),v=E(_),h=b(),d=c("div"),g=E("Gateway: "),A=E(k),T=b(),P=c("div"),F=E("DNS: "),R=E(I),w=b(),$&&$.c(),a(n,"class","text-sm"),a(i,"class","my-2"),a(f,"class","my-2"),a(d,"class","my-2"),a(P,"class","my-2"),a(e,"class","cnt")},m(ie,j){M(ie,e,j),s(e,n),s(e,l),s(e,i),s(i,o),s(i,m),s(e,r),s(e,f),s(f,p),s(f,v),s(e,h),s(e,d),s(d,g),s(d,A),s(e,T),s(e,P),s(P,F),s(P,R),s(P,w),$&&$.m(P,null)},p(ie,j){j&2&&u!==(u=ie[1].net.ip+"")&&X(m,u),j&2&&_!==(_=ie[1].net.mask+"")&&X(v,_),j&2&&k!==(k=ie[1].net.gw+"")&&X(A,k),j&2&&I!==(I=ie[1].net.dns1+"")&&X(R,I),ie[1].net.dns2?$?$.p(ie,j):($=Gf(ie),$.c(),$.m(P,null)):$&&($.d(1),$=null)},d(ie){ie&&y(e),$&&$.d()}}}function Gf(t){let e,n=t[1].net.dns2+"",l;return{c(){e=E("/ "),l=E(n)},m(i,o){M(i,e,o),M(i,l,o)},p(i,o){o&2&&n!==(n=i[1].net.dns2+"")&&X(l,n)},d(i){i&&y(e),i&&y(l)}}}function Vf(t){let e,n,l,i=t[1].upgrade.f+"",o,u,m=t[1].upgrade.t+"",r,f,p=Br(t[1].upgrade.e)+"",_;return{c(){e=c("div"),n=c("div"),l=E("Previous upgrade attempt from "),o=E(i),u=E(" to "),r=E(m),f=E(" failed. "),_=E(p),a(n,"class","bd-yellow"),a(e,"class","my-2")},m(v,h){M(v,e,h),s(e,n),s(n,l),s(n,o),s(n,u),s(n,r),s(n,f),s(n,_)},p(v,h){h&2&&i!==(i=v[1].upgrade.f+"")&&X(o,i),h&2&&m!==(m=v[1].upgrade.t+"")&&X(r,m),h&2&&p!==(p=Br(v[1].upgrade.e)+"")&&X(_,p)},d(v){v&&y(e)}}}function Kf(t){let e,n,l,i=t[2].tag_name+"",o,u,m,r,f,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Yf(t),v=t[1].fwconsent===2&&Qf();return{c(){e=c("div"),n=E(`Latest version: - `),l=c("a"),o=E(i),m=b(),_&&_.c(),r=b(),v&&v.c(),f=it(),a(l,"href",u=t[2].html_url),a(l,"class","ml-2 text-blue-600 hover:text-blue-800"),a(l,"target","_blank"),a(l,"rel","noreferrer"),a(e,"class","my-2 flex")},m(h,d){M(h,e,d),s(e,n),s(e,l),s(l,o),s(e,m),_&&_.m(e,null),M(h,r,d),v&&v.m(h,d),M(h,f,d),p=!0},p(h,d){(!p||d&4)&&i!==(i=h[2].tag_name+"")&&X(o,i),(!p||d&4&&u!==(u=h[2].html_url))&&a(l,"href",u),(h[1].security==0||h[0].a)&&h[1].fwconsent===1&&h[2]&&h[2].tag_name!=h[1].version?_?(_.p(h,d),d&7&&L(_,1)):(_=Yf(h),_.c(),L(_,1),_.m(e,null)):_&&($e(),q(_,1,1,()=>{_=null}),De()),h[1].fwconsent===2?v||(v=Qf(),v.c(),v.m(f.parentNode,f)):v&&(v.d(1),v=null)},i(h){p||(L(_),p=!0)},o(h){q(_),p=!1},d(h){h&&y(e),_&&_.d(),h&&y(r),v&&v.d(h),h&&y(f)}}}function Yf(t){let e,n,l,i,o,u;return l=new g0({}),{c(){e=c("div"),n=c("button"),ae(l.$$.fragment),a(e,"class","flex-none ml-2 text-green-500"),a(e,"title","Install this version")},m(m,r){M(m,e,r),s(e,n),se(l,n,null),i=!0,o||(u=Q(n,"click",t[10]),o=!0)},p:be,i(m){i||(L(l.$$.fragment,m),i=!0)},o(m){q(l.$$.fragment,m),i=!1},d(m){m&&y(e),oe(l),o=!1,u()}}}function Qf(t){let e;return{c(){e=c("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',a(e,"class","my-2")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function Xf(t){let e,n=ys(Ce(t[1].chip,t[1].board))+"",l;return{c(){e=c("div"),l=E(n),a(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&2&&n!==(n=ys(Ce(i[1].chip,i[1].board))+"")&&X(l,n)},d(i){i&&y(e)}}}function Zf(t){let e,n,l,i,o,u;function m(p,_){return p[4].length==0?ip:np}let r=m(t),f=r(t);return{c(){e=c("div"),n=c("form"),l=c("input"),i=b(),f.c(),ki(l,"display","none"),a(l,"name","file"),a(l,"type","file"),a(l,"accept",".bin"),a(n,"action","/firmware"),a(n,"enctype","multipart/form-data"),a(n,"method","post"),a(n,"autocomplete","off"),a(e,"class","my-2 flex")},m(p,_){M(p,e,_),s(e,n),s(n,l),t[12](l),s(n,i),f.m(n,null),o||(u=[Q(l,"change",t[13]),Q(n,"submit",t[15])],o=!0)},p(p,_){r===(r=m(p))&&f?f.p(p,_):(f.d(1),f=r(p),f&&(f.c(),f.m(n,null)))},d(p){p&&y(e),t[12](null),f.d(),o=!1,nt(u)}}}function np(t){let e=t[4][0].name+"",n,l,i;return{c(){n=E(e),l=b(),i=c("button"),i.textContent="Upload",a(i,"type","submit"),a(i,"class","btn-pri-sm float-right")},m(o,u){M(o,n,u),M(o,l,u),M(o,i,u)},p(o,u){u&16&&e!==(e=o[4][0].name+"")&&X(n,e)},d(o){o&&y(n),o&&y(l),o&&y(i)}}}function ip(t){let e,n,l;return{c(){e=c("button"),e.textContent="Select firmware file for upgrade",a(e,"type","button"),a(e,"class","btn-pri-sm float-right")},m(i,o){M(i,e,o),n||(l=Q(e,"click",t[14]),n=!0)},p:be,d(i){i&&y(e),n=!1,l()}}}function Jf(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g=t[9],k=[];for(let I=0;I Include Secrets
(SSID, PSK, passwords and tokens)',r=b(),A&&A.c(),f=b(),p=c("form"),_=c("input"),v=b(),F.c(),a(n,"class","text-sm"),a(m,"class","my-1 mx-3 col-span-2"),a(o,"class","grid grid-cols-2"),a(i,"method","get"),a(i,"action","/configfile.cfg"),a(i,"autocomplete","off"),ki(_,"display","none"),a(_,"name","file"),a(_,"type","file"),a(_,"accept",".cfg"),a(p,"action","/configfile"),a(p,"enctype","multipart/form-data"),a(p,"method","post"),a(p,"autocomplete","off"),a(e,"class","cnt")},m(I,R){M(I,e,R),s(e,n),s(e,l),s(e,i),s(i,o);for(let w=0;w{D=null}),De());const ct={};Pe&8388608&&(ct.$$scope={dirty:Pe,ctx:ce}),ie.$set(ct),ce[1].meter?O?O.p(ce,Pe):(O=Wf(ce),O.c(),O.m(e,G)):O&&(O.d(1),O=null),ce[1].net?J?J.p(ce,Pe):(J=zf(ce),J.c(),J.m(e,V)):J&&(J.d(1),J=null),(!N||Pe&2)&&_e!==(_e=ce[1].version+"")&&X(ne,_e),ce[1].upgrade.t&&ce[1].upgrade.t!=ce[1].version?le?le.p(ce,Pe):(le=Vf(ce),le.c(),le.m(K,Y)):le&&(le.d(1),le=null),ce[2]?pe?(pe.p(ce,Pe),Pe&4&&L(pe,1)):(pe=Kf(ce),pe.c(),L(pe,1),pe.m(K,ke)):pe&&($e(),q(pe,1,1,()=>{pe=null}),De()),Pe&3&&(Ee=(ce[1].security==0||ce[0].a)&&li(ce[1].board)),Ee?ge?ge.p(ce,Pe):(ge=Xf(ce),ge.c(),ge.m(K,we)):ge&&(ge.d(1),ge=null),ce[1].security==0||ce[0].a?Ae?Ae.p(ce,Pe):(Ae=Zf(ce),Ae.c(),Ae.m(K,null)):Ae&&(Ae.d(1),Ae=null),ce[1].security==0||ce[0].a?Fe?Fe.p(ce,Pe):(Fe=Jf(ce),Fe.c(),Fe.m(e,null)):Fe&&(Fe.d(1),Fe=null);const Ke={};Pe&32&&(Ke.active=ce[5]),fe.$set(Ke);const rt={};Pe&256&&(rt.active=ce[8]),Ie.$set(rt)},i(ce){N||(L(k.$$.fragment,ce),L(D),L(ie.$$.fragment,ce),L(pe),L(fe.$$.fragment,ce),L(Ie.$$.fragment,ce),N=!0)},o(ce){q(k.$$.fragment,ce),q(D),q(ie.$$.fragment,ce),q(pe),q(fe.$$.fragment,ce),q(Ie.$$.fragment,ce),N=!1},d(ce){ce&&y(e),oe(k),D&&D.d(),oe(ie),O&&O.d(),J&&J.d(),le&&le.d(),pe&&pe.d(),ge&&ge.d(),Ae&&Ae.d(),Fe&&Fe.d(),ce&&y(te),oe(fe,ce),ce&&y(Oe),oe(Ie,ce),C=!1,S()}}}async function rp(){await(await fetch("reboot",{method:"POST"})).json()}function up(t,e,n){let{data:l}=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"}],u={};Eo.subscribe(w=>{n(2,u=v0(i.version,w)),u||n(2,u=w[0])});function m(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(ys(Ce(i.chip,i.board))))&&(Yt.update(w=>(w.upgrading=!0,w)),h0(u.tag_name))}const r=function(){confirm("Are you sure you want to reboot the device?")&&(Yt.update(w=>(w.booting=!0,w)),rp())};let f,p=[],_=!1,v,h=[],d=!1;Mo();function g(w){ks[w?"unshift":"push"](()=>{f=w,n(3,f)})}function k(){p=this.files,n(4,p)}const A=()=>{f.click()},T=()=>n(5,_=!0);function P(w){ks[w?"unshift":"push"](()=>{v=w,n(6,v)})}function F(){h=this.files,n(7,h)}const I=()=>{v.click()},R=()=>n(8,d=!0);return t.$$set=w=>{"data"in w&&n(0,l=w.data),"sysinfo"in w&&n(1,i=w.sysinfo)},[l,i,u,f,p,_,v,h,d,o,m,r,g,k,A,T,P,F,I,R]}class fp extends We{constructor(e){super(),He(this,e,up,ap,Be,{data:0,sysinfo:1})}}function t1(t){let e,n,l=Ce(t[0],7)+"",i,o,u=Ce(t[0],5)+"",m,r,f=Ce(t[0],4)+"",p,_,v=Ce(t[0],3)+"",h,d,g,k,A=Ce(t[0],2)+"",T,P,F=Ce(t[0],1)+"",I,R,w=Ce(t[0],0)+"",$,ie,j,U,H=Ce(t[0],101)+"",G,V,K=Ce(t[0],100)+"",Z;return{c(){e=c("optgroup"),n=c("option"),i=E(l),o=c("option"),m=E(u),r=c("option"),p=E(f),_=c("option"),h=E(v),d=b(),g=c("optgroup"),k=c("option"),T=E(A),P=c("option"),I=E(F),R=c("option"),$=E(w),ie=b(),j=c("optgroup"),U=c("option"),G=E(H),V=c("option"),Z=E(K),n.__value=7,n.value=n.__value,o.__value=5,o.value=o.__value,r.__value=4,r.value=r.__value,_.__value=3,_.value=_.__value,a(e,"label","amsleser.no"),k.__value=2,k.value=k.__value,P.__value=1,P.value=P.__value,R.__value=0,R.value=R.__value,a(g,"label","Custom hardware"),U.__value=101,U.value=U.__value,V.__value=100,V.value=V.__value,a(j,"label","Generic hardware")},m(z,W){M(z,e,W),s(e,n),s(n,i),s(e,o),s(o,m),s(e,r),s(r,p),s(e,_),s(_,h),M(z,d,W),M(z,g,W),s(g,k),s(k,T),s(g,P),s(P,I),s(g,R),s(R,$),M(z,ie,W),M(z,j,W),s(j,U),s(U,G),s(j,V),s(V,Z)},p(z,W){W&1&&l!==(l=Ce(z[0],7)+"")&&X(i,l),W&1&&u!==(u=Ce(z[0],5)+"")&&X(m,u),W&1&&f!==(f=Ce(z[0],4)+"")&&X(p,f),W&1&&v!==(v=Ce(z[0],3)+"")&&X(h,v),W&1&&A!==(A=Ce(z[0],2)+"")&&X(T,A),W&1&&F!==(F=Ce(z[0],1)+"")&&X(I,F),W&1&&w!==(w=Ce(z[0],0)+"")&&X($,w),W&1&&H!==(H=Ce(z[0],101)+"")&&X(G,H),W&1&&K!==(K=Ce(z[0],100)+"")&&X(Z,K)},d(z){z&&y(e),z&&y(d),z&&y(g),z&&y(ie),z&&y(j)}}}function l1(t){let e,n,l=Ce(t[0],201)+"",i,o,u=Ce(t[0],202)+"",m,r,f=Ce(t[0],203)+"",p,_,v=Ce(t[0],241)+"",h,d,g=Ce(t[0],242)+"",k,A,T=Ce(t[0],243)+"",P,F,I=Ce(t[0],200)+"",R;return{c(){e=c("optgroup"),n=c("option"),i=E(l),o=c("option"),m=E(u),r=c("option"),p=E(f),_=c("option"),h=E(v),d=c("option"),k=E(g),A=c("option"),P=E(T),F=c("option"),R=E(I),n.__value=201,n.value=n.__value,o.__value=202,o.value=o.__value,r.__value=203,r.value=r.__value,_.__value=241,_.value=_.__value,d.__value=242,d.value=d.__value,A.__value=243,A.value=A.__value,F.__value=200,F.value=F.__value,a(e,"label","Generic hardware")},m(w,$){M(w,e,$),s(e,n),s(n,i),s(e,o),s(o,m),s(e,r),s(r,p),s(e,_),s(_,h),s(e,d),s(d,k),s(e,A),s(A,P),s(e,F),s(F,R)},p(w,$){$&1&&l!==(l=Ce(w[0],201)+"")&&X(i,l),$&1&&u!==(u=Ce(w[0],202)+"")&&X(m,u),$&1&&f!==(f=Ce(w[0],203)+"")&&X(p,f),$&1&&v!==(v=Ce(w[0],241)+"")&&X(h,v),$&1&&g!==(g=Ce(w[0],242)+"")&&X(k,g),$&1&&T!==(T=Ce(w[0],243)+"")&&X(P,T),$&1&&I!==(I=Ce(w[0],200)+"")&&X(R,I)},d(w){w&&y(e)}}}function n1(t){let e,n,l=Ce(t[0],7)+"",i,o,u=Ce(t[0],6)+"",m,r,f=Ce(t[0],5)+"",p,_,v,h,d=Ce(t[0],51)+"",g,k,A=Ce(t[0],50)+"",T;return{c(){e=c("optgroup"),n=c("option"),i=E(l),o=c("option"),m=E(u),r=c("option"),p=E(f),_=b(),v=c("optgroup"),h=c("option"),g=E(d),k=c("option"),T=E(A),n.__value=7,n.value=n.__value,o.__value=6,o.value=o.__value,r.__value=5,r.value=r.__value,a(e,"label","amsleser.no"),h.__value=51,h.value=h.__value,k.__value=50,k.value=k.__value,a(v,"label","Generic hardware")},m(P,F){M(P,e,F),s(e,n),s(n,i),s(e,o),s(o,m),s(e,r),s(r,p),M(P,_,F),M(P,v,F),s(v,h),s(h,g),s(v,k),s(k,T)},p(P,F){F&1&&l!==(l=Ce(P[0],7)+"")&&X(i,l),F&1&&u!==(u=Ce(P[0],6)+"")&&X(m,u),F&1&&f!==(f=Ce(P[0],5)+"")&&X(p,f),F&1&&d!==(d=Ce(P[0],51)+"")&&X(g,d),F&1&&A!==(A=Ce(P[0],50)+"")&&X(T,A)},d(P){P&&y(e),P&&y(_),P&&y(v)}}}function i1(t){let e,n,l=Ce(t[0],8)+"",i,o,u,m,r=Ce(t[0],71)+"",f,p,_=Ce(t[0],70)+"",v;return{c(){e=c("optgroup"),n=c("option"),i=E(l),o=b(),u=c("optgroup"),m=c("option"),f=E(r),p=c("option"),v=E(_),n.__value=8,n.value=n.__value,a(e,"label","Custom hardware"),m.__value=71,m.value=m.__value,p.__value=70,p.value=p.__value,a(u,"label","Generic hardware")},m(h,d){M(h,e,d),s(e,n),s(n,i),M(h,o,d),M(h,u,d),s(u,m),s(m,f),s(u,p),s(p,v)},p(h,d){d&1&&l!==(l=Ce(h[0],8)+"")&&X(i,l),d&1&&r!==(r=Ce(h[0],71)+"")&&X(f,r),d&1&&_!==(_=Ce(h[0],70)+"")&&X(v,_)},d(h){h&&y(e),h&&y(o),h&&y(u)}}}function s1(t){let e,n,l=Ce(t[0],200)+"",i;return{c(){e=c("optgroup"),n=c("option"),i=E(l),n.__value=200,n.value=n.__value,a(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,n),s(n,i)},p(o,u){u&1&&l!==(l=Ce(o[0],200)+"")&&X(i,l)},d(o){o&&y(e)}}}function o1(t){let e,n,l=Ce(t[0],80)+"",i;return{c(){e=c("optgroup"),n=c("option"),i=E(l),n.__value=80,n.value=n.__value,a(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,n),s(n,i)},p(o,u){u&1&&l!==(l=Ce(o[0],80)+"")&&X(i,l)},d(o){o&&y(e)}}}function cp(t){let e,n,l,i,o,u,m,r,f=t[0]=="esp8266"&&t1(t),p=t[0]=="esp32"&&l1(t),_=t[0]=="esp32s2"&&n1(t),v=t[0]=="esp32c3"&&i1(t),h=t[0]=="esp32solo"&&s1(t),d=t[0]=="esp32s3"&&o1(t);return{c(){e=c("option"),n=b(),f&&f.c(),l=b(),p&&p.c(),i=b(),_&&_.c(),o=b(),v&&v.c(),u=b(),h&&h.c(),m=b(),d&&d.c(),r=it(),e.__value=-1,e.value=e.__value},m(g,k){M(g,e,k),M(g,n,k),f&&f.m(g,k),M(g,l,k),p&&p.m(g,k),M(g,i,k),_&&_.m(g,k),M(g,o,k),v&&v.m(g,k),M(g,u,k),h&&h.m(g,k),M(g,m,k),d&&d.m(g,k),M(g,r,k)},p(g,[k]){g[0]=="esp8266"?f?f.p(g,k):(f=t1(g),f.c(),f.m(l.parentNode,l)):f&&(f.d(1),f=null),g[0]=="esp32"?p?p.p(g,k):(p=l1(g),p.c(),p.m(i.parentNode,i)):p&&(p.d(1),p=null),g[0]=="esp32s2"?_?_.p(g,k):(_=n1(g),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),g[0]=="esp32c3"?v?v.p(g,k):(v=i1(g),v.c(),v.m(u.parentNode,u)):v&&(v.d(1),v=null),g[0]=="esp32solo"?h?h.p(g,k):(h=s1(g),h.c(),h.m(m.parentNode,m)):h&&(h.d(1),h=null),g[0]=="esp32s3"?d?d.p(g,k):(d=o1(g),d.c(),d.m(r.parentNode,r)):d&&(d.d(1),d=null)},i:be,o:be,d(g){g&&y(e),g&&y(n),f&&f.d(g),g&&y(l),p&&p.d(g),g&&y(i),_&&_.d(g),g&&y(o),v&&v.d(g),g&&y(u),h&&h.d(g),g&&y(m),d&&d.d(g),g&&y(r)}}}function mp(t,e,n){let{chip:l}=e;return t.$$set=i=>{"chip"in i&&n(0,l=i.chip)},[l]}class _p extends We{constructor(e){super(),He(this,e,mp,cp,Be,{chip:0})}}function a1(t){let e;return{c(){e=c("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",a(e,"class","bd-red")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function r1(t){let e,n,l,i,o,u,m;return u=new fo({props:{chip:t[0].chip}}),{c(){e=c("div"),n=E("HAN GPIO"),l=c("br"),i=b(),o=c("select"),ae(u.$$.fragment),a(o,"name","vh"),a(o,"class","in-s"),a(e,"class","my-3")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),se(u,o,null),m=!0},p(r,f){const p={};f&1&&(p.chip=r[0].chip),u.$set(p)},i(r){m||(L(u.$$.fragment,r),m=!0)},o(r){q(u.$$.fragment,r),m=!1},d(r){r&&y(e),oe(u)}}}function pp(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T,P,F,I,R,w,$,ie,j,U,H,G,V=t[0].usrcfg&&a1();d=new _p({props:{chip:t[0].chip}});let K=t[0].board&&t[0].board>20&&r1(t);return j=new Tt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=c("div"),n=c("div"),l=c("form"),i=c("input"),o=b(),u=c("strong"),u.textContent="Initial configuration",m=b(),V&&V.c(),r=b(),f=c("div"),p=E("Board type"),_=c("br"),v=b(),h=c("select"),ae(d.$$.fragment),g=b(),K&&K.c(),k=b(),A=c("div"),T=c("label"),P=c("input"),F=E(" Clear all other configuration"),I=b(),R=c("div"),R.innerHTML='',w=b(),$=c("span"),$.textContent="\xA0",ie=b(),ae(j.$$.fragment),a(i,"type","hidden"),a(i,"name","v"),i.value="true",a(u,"class","text-sm"),a(h,"name","vb"),a(h,"class","in-s"),t[0].board===void 0&&Ze(()=>t[5].call(h)),a(f,"class","my-3"),a(P,"type","checkbox"),a(P,"name","vr"),P.__value="true",P.value=P.__value,a(P,"class","rounded mb-1"),a(A,"class","my-3"),a(R,"class","my-3"),a($,"class","clear-both"),a(l,"autocomplete","off"),a(n,"class","cnt"),a(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Z,z){M(Z,e,z),s(e,n),s(n,l),s(l,i),s(l,o),s(l,u),s(l,m),V&&V.m(l,null),s(l,r),s(l,f),s(f,p),s(f,_),s(f,v),s(f,h),se(d,h,null),Te(h,t[0].board,!0),s(l,g),K&&K.m(l,null),s(l,k),s(l,A),s(A,T),s(T,P),P.checked=t[2],s(T,F),s(l,I),s(l,R),s(l,w),s(l,$),M(Z,ie,z),se(j,Z,z),U=!0,H||(G=[Q(h,"change",t[5]),Q(P,"change",t[6]),Q(l,"submit",Ti(t[3]))],H=!0)},p(Z,[z]){Z[0].usrcfg?V||(V=a1(),V.c(),V.m(l,r)):V&&(V.d(1),V=null);const W={};z&1&&(W.chip=Z[0].chip),d.$set(W),z&1&&Te(h,Z[0].board),Z[0].board&&Z[0].board>20?K?(K.p(Z,z),z&1&&L(K,1)):(K=r1(Z),K.c(),L(K,1),K.m(l,k)):K&&($e(),q(K,1,1,()=>{K=null}),De()),z&4&&(P.checked=Z[2]);const x={};z&2&&(x.active=Z[1]),j.$set(x)},i(Z){U||(L(d.$$.fragment,Z),L(K),L(j.$$.fragment,Z),U=!0)},o(Z){q(d.$$.fragment,Z),q(K),q(j.$$.fragment,Z),U=!1},d(Z){Z&&y(e),V&&V.d(),oe(d),K&&K.d(),Z&&y(ie),oe(j,Z),H=!1,nt(G)}}}function dp(t,e,n){let{basepath:l="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(p){n(1,o=!0);const _=new FormData(p.target),v=new URLSearchParams;for(let g of _){const[k,A]=g;v.append(k,A)}let d=await(await fetch("save",{method:"POST",body:v})).json();n(1,o=!1),Yt.update(g=>(g.vndcfg=d.success,g.booting=d.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),cn(l+(i.usrcfg?"/":"/setup"))}let m=!1;Yt.subscribe(p=>{n(0,i=p),p.fwconsent===1&&n(2,m=!i.usrcfg)});function r(){i.board=ot(this),n(0,i)}function f(){m=this.checked,n(2,m)}return t.$$set=p=>{"basepath"in p&&n(4,l=p.basepath),"sysinfo"in p&&n(0,i=p.sysinfo)},[i,o,m,u,l,r,f]}class hp extends We{constructor(e){super(),He(this,e,dp,pp,Be,{basepath:4,sysinfo:0})}}function u1(t){let e;return{c(){e=c("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function f1(t){let e,n,l,i,o,u,m,r,f,p,_,v,h;return{c(){e=c("div"),n=E("SSID"),l=c("br"),i=b(),o=c("input"),m=b(),r=c("div"),f=E("PSK"),p=c("br"),_=b(),v=c("input"),a(o,"name","ss"),a(o,"type","text"),a(o,"class","in-s"),o.required=u=t[2]==1||t[2]==2,a(e,"class","my-3"),a(v,"name","sp"),a(v,"type","password"),a(v,"class","in-s"),a(v,"autocomplete","off"),v.required=h=t[2]==2,a(r,"class","my-3")},m(d,g){M(d,e,g),s(e,n),s(e,l),s(e,i),s(e,o),M(d,m,g),M(d,r,g),s(r,f),s(r,p),s(r,_),s(r,v)},p(d,g){g&4&&u!==(u=d[2]==1||d[2]==2)&&(o.required=u),g&4&&h!==(h=d[2]==2)&&(v.required=h)},d(d){d&&y(e),d&&y(m),d&&y(r)}}}function c1(t){let e,n,l,i,o,u,m,r;return m=new C0({}),{c(){e=c("br"),n=b(),l=c("div"),i=c("input"),o=b(),u=c("select"),ae(m.$$.fragment),a(i,"name","si"),a(i,"type","text"),a(i,"class","in-f w-full"),i.required=t[1],a(u,"name","su"),a(u,"class","in-l"),u.required=t[1],a(l,"class","flex")},m(f,p){M(f,e,p),M(f,n,p),M(f,l,p),s(l,i),s(l,o),s(l,u),se(m,u,null),r=!0},p(f,p){(!r||p&2)&&(i.required=f[1]),(!r||p&2)&&(u.required=f[1])},i(f){r||(L(m.$$.fragment,f),r=!0)},o(f){q(m.$$.fragment,f),r=!1},d(f){f&&y(e),f&&y(n),f&&y(l),oe(m)}}}function m1(t){let e;return{c(){e=c("div"),e.innerHTML=`
Gateway
+Occurred in: ${i}`:"",u=yo(t),m=O1(e)?e(u):e;return`<${u}> ${m}${o}`}const Z1=t=>(...e)=>t(lc(...e)),J1=Z1(t=>{throw new Error(t)}),Ms=Z1(console.warn),Ar=4,nc=3,ic=2,sc=1,oc=1;function ac(t,e){const n=t.default?0:Cl(t.fullPath).reduce((l,i)=>{let o=l;return o+=Ar,K0(i)?o+=oc:Y0(i)?o+=ic:G1(i)?o-=Ar+sc:o+=nc,o},0);return{route:t,score:n,index:e}}function rc(t){return t.map(ac).sort((e,n)=>e.scoren.score?-1:e.index-n.index)}function x1(t,e){let n,l;const[i]=e.split("?"),o=Cl(i),u=o[0]==="",m=rc(t);for(let r=0,f=m.length;r({...p,params:h,uri:$});if(p.default){l=v(e);continue}const d=Cl(p.fullPath),g=Math.max(o.length,d.length);let k=0;for(;k{f===".."?r.pop():f!=="."&&r.push(f)}),Ys(`/${r.join("/")}`,l)}function $r(t,e){const{pathname:n,hash:l="",search:i="",state:o}=t,u=Cl(e,!0),m=Cl(n,!0);for(;u.length;)u[0]!==m[0]&&J1(_n,`Invalid state: All locations must begin with the basepath "${e}", found "${n}"`),u.shift(),m.shift();return{pathname:$i(...m),hash:l,search:i,state:o}}const Dr=t=>t.length===1?"":t,Mo=t=>{const e=t.indexOf("?"),n=t.indexOf("#"),l=e!==-1,i=n!==-1,o=i?Dr(gi(t,n)):"",u=i?gi(t,0,n):t,m=l?Dr(gi(u,e)):"";return{pathname:(l?gi(u,0,e):u)||"/",search:m,hash:o}},fc=t=>{const{pathname:e,search:n,hash:l}=t;return e+n+l};function cc(t,e,n){return $i(n,uc(t,e))}function mc(t,e){const n=wo(Q0(t)),l=Cl(n,!0),i=Cl(e,!0).slice(0,l.length),o=e0({fullPath:n},$i(...i));return o&&o.uri}const Qs="POP",_c="PUSH",pc="REPLACE";function Xs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function dc(t){let e=[],n=Xs(t),l=Qs;const i=(o=e)=>o.forEach(u=>u({location:n,action:l}));return{get location(){return n},listen(o){e.push(o);const u=()=>{n=Xs(t),l=Qs,i([o])};i([o]);const m=U1(t,"popstate",u);return()=>{m(),e=e.filter(r=>r!==o)}},navigate(o,u){const{state:m={},replace:r=!1}=u||{};if(l=r?pc:_c,q1(o))u&&Ms(X1,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),l=Qs,t.history.go(o);else{const f={...m,_key:W0()};try{t.history[r?"replaceState":"pushState"](f,"",o)}catch{t.location[r?"replace":"assign"](o)}}n=Xs(t),i()}}}function Zs(t,e){return{...Mo(e),state:t}}function hc(t="/"){let e=0,n=[Zs(null,t)];return{get entries(){return n},get location(){return n[e]},addEventListener(){},removeEventListener(){},history:{get state(){return n[e].state},pushState(l,i,o){e++,n=n.slice(0,e),n.push(Zs(l,o))},replaceState(l,i,o){n[e]=Zs(l,o)},go(l){const i=e+l;i<0||i>n.length-1||(e=i)}}}}const vc=!!(!Wl&&window.document&&window.document.createElement),bc=!Wl&&window.location.origin==="null",t0=dc(vc&&!bc?window:hc()),{navigate:mn}=t0;let $l=null,l0=!0;function gc(t,e){const n=document.querySelectorAll("[data-svnav-router]");for(let l=0;l$l.level||t.level===$l.level&&gc(t.routerId,$l.routerId))&&($l=t)}function wc(){$l=null}function Cc(){l0=!1}function Lr(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let n;n=U1(t,"blur",()=>{t.removeAttribute(e),n()})}return t.focus(),document.activeElement===t}catch{return!1}}function yc(t,e){return Number(t.dataset.svnavRouteEnd)===e}function Mc(t){return/^H[1-6]$/i.test(t.tagName)}function Ir(t,e=document){return e.querySelector(t)}function Sc(t){let n=Ir(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!yc(n,t);){if(Mc(n))return n;const l=Ir("h1,h2,h3,h4,h5,h6",n);if(l)return l;n=n.nextElementSibling}return null}function Tc(t){Promise.resolve(ii(t.focusElement)).then(e=>{const n=e||Sc(t.id);n||Ms(_n,`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,Ns),!Lr(n)&&Lr(document.documentElement)})}const Nc=(t,e,n)=>(l,i)=>q0().then(()=>{if(!$l||l0){Cc();return}if(l&&Tc($l.route),t.announcements&&i){const{path:o,fullPath:u,meta:m,params:r,uri:f}=$l.route,p=t.createAnnouncement({path:o,fullPath:u,meta:m,params:r,uri:f},ii(n));Promise.resolve(p).then(_=>{e.set(_)})}wc()}),Ec="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 Pc(t){let e,n,l=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},j1(t[6],Ec)],i={};for(let o=0;o`Navigated to ${ie.uri}`,announcements:!0,...d},$=p,N=wo(p),A=Hl(to),F=Hl(oi),I=!A,R=$c(),C=v&&!(F&&!F.manageFocus),P=ht("");kl(t,P,ie=>n(0,m=ie));const ne=F?F.disableInlineStyles:g,j=ht([]);kl(t,j,ie=>n(20,u=ie));const B=ht(null);kl(t,B,ie=>n(18,i=ie));let H=!1;const V=I?0:F.level+1,K=I?ht((()=>$r(Wl?Mo(_):h.location,N))()):A;kl(t,K,ie=>n(17,l=ie));const Z=ht(l);kl(t,Z,ie=>n(19,o=ie));const z=Nc(k,P,K),W=ie=>me=>me.filter(Y=>Y.id!==ie);function x(ie){if(Wl){if(H)return;const me=e0(ie,l.pathname);if(me)return H=!0,me}else j.update(me=>{const Y=W(ie.id)(me);return Y.push(ie),Y})}function _e(ie){j.update(W(ie))}return!I&&p!==Rr&&Ms(_n,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),I&&(D1(()=>h.listen(me=>{const Y=$r(me.location,N);Z.set(l),K.set(Y)})),Mi(to,K)),Mi(oi,{activeRoute:B,registerRoute:x,unregisterRoute:_e,manageFocus:C,level:V,id:R,history:I?h:F.history,basepath:I?N:F.basepath,disableInlineStyles:ne}),t.$$set=ie=>{"basepath"in ie&&n(11,p=ie.basepath),"url"in ie&&n(12,_=ie.url),"history"in ie&&n(13,h=ie.history),"primary"in ie&&n(14,v=ie.primary),"a11y"in ie&&n(15,d=ie.a11y),"disableInlineStyles"in ie&&n(16,g=ie.disableInlineStyles),"$$scope"in ie&&n(21,f=ie.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==$&&Ms(_n,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ie=x1(u,l.pathname);B.set(ie)}if(t.$$.dirty[0]&655360&&I){const ie=!!l.hash,me=!ie&&C,Y=!ie||l.pathname!==o.pathname;z(me,Y)}t.$$.dirty[0]&262144&&C&&i&&i.primary&&kc({level:V,routerId:R,route:i})},[m,k,I,R,C,P,ne,j,B,K,Z,p,_,h,v,d,g,l,i,o,u,f,r]}class Lc extends We{constructor(e){super(),He(this,e,Dc,Ac,Be,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const n0=Lc;function Di(t,e,n=oi,l=_n){Hl(n)||J1(t,o=>`You cannot use ${o} outside of a ${yo(l)}.`,e)}const Ic=t=>{const{subscribe:e}=Hl(t);return{subscribe:e}};function i0(){return Di(K1),Ic(to)}function s0(){const{history:t}=Hl(oi);return t}function o0(){const t=Hl(W1);return t?z0(t,e=>e.base):ht("/")}function a0(){Di(Q1);const t=o0(),{basepath:e}=Hl(oi);return l=>cc(l,ii(t),e)}function Rc(){Di(Y1);const t=a0(),{navigate:e}=s0();return(l,i)=>{const o=q1(l)?l:t(l);return e(o,i)}}const Fc=t=>({params:t&16,location:t&8}),Fr=t=>({params:Wl?ii(t[10]):t[4],location:t[3],navigate:t[11]});function Or(t){let e,n;return e=new n0({props:{primary:t[1],$$slots:{default:[Bc]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.primary=l[1]),i&528409&&(o.$$scope={dirty:i,ctx:l}),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Oc(t){let e;const n=t[18].default,l=ho(n,t,t[19],Fr);return{c(){l&&l.c()},m(i,o){l&&l.m(i,o),e=!0},p(i,o){l&&l.p&&(!e||o&524312)&&bo(l,n,i,i[19],e?vo(n,i[19],o,Fc):go(i[19]),Fr)},i(i){e||(L(l,i),e=!0)},o(i){q(l,i),e=!1},d(i){l&&l.d(i)}}}function qc(t){let e,n,l;const i=[{location:t[3]},{navigate:t[11]},Wl?ii(t[10]):t[4],t[12]];var o=t[0];function u(m){let r={};for(let f=0;f{oe(p,1)}),De()}o?(e=Tr(o,u()),ae(e.$$.fragment),L(e.$$.fragment,1),se(e,n.parentNode,n)):e=null}else o&&e.$set(f)},i(m){l||(e&&L(e.$$.fragment,m),l=!0)},o(m){e&&q(e.$$.fragment,m),l=!1},d(m){m&&y(n),e&&oe(e,m)}}}function Bc(t){let e,n,l,i;const o=[qc,Oc],u=[];function m(r,f){return r[0]!==null?0:1}return e=m(t),n=u[e]=o[e](t),{c(){n.c(),l=it()},m(r,f){u[e].m(r,f),M(r,l,f),i=!0},p(r,f){let p=e;e=m(r),e===p?u[e].p(r,f):($e(),q(u[p],1,1,()=>{u[p]=null}),De(),n=u[e],n?n.p(r,f):(n=u[e]=o[e](r),n.c()),L(n,1),n.m(l.parentNode,l))},i(r){i||(L(n),i=!0)},o(r){q(n),i=!1},d(r){u[e].d(r),r&&y(l)}}}function Uc(t){let e,n,l,i,o,u=[eo(t[7]),{"data-svnav-route-start":t[5]}],m={};for(let _=0;_{r=null}),De())},i(_){o||(L(r),o=!0)},o(_){q(r),o=!1},d(_){_&&y(e),_&&y(n),r&&r.d(_),_&&y(l),_&&y(i)}}}const jc=B1();function Hc(t,e,n){let l;const i=["path","component","meta","primary"];let o=Cs(e,i),u,m,r,f,{$$slots:p={},$$scope:_}=e,{path:h=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:g=!0}=e;Di(Ns,e);const k=jc(),{registerRoute:$,unregisterRoute:N,activeRoute:A,disableInlineStyles:F}=Hl(oi);kl(t,A,H=>n(16,u=H));const I=o0();kl(t,I,H=>n(17,r=H));const R=i0();kl(t,R,H=>n(3,m=H));const C=ht(null);let P;const ne=ht(),j=ht({});kl(t,j,H=>n(4,f=H)),Mi(W1,ne),Mi(G0,j),Mi(V0,C);const B=Rc();return Wl||F0(()=>N(k)),t.$$set=H=>{n(24,e=cl(cl({},e),ws(H))),n(12,o=Cs(e,i)),"path"in H&&n(13,h=H.path),"component"in H&&n(0,v=H.component),"meta"in H&&n(14,d=H.meta),"primary"in H&&n(1,g=H.primary),"$$scope"in H&&n(19,_=H.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const H=h==="",V=$i(r,h),G={id:k,path:h,meta:d,default:H,fullPath:H?"":V,base:H?r:mc(V,m.pathname),primary:g,focusElement:C};ne.set(G),n(15,P=$(G))}if(t.$$.dirty&98304&&n(2,l=!!(P||u&&u.id===k)),t.$$.dirty&98308&&l){const{params:H}=P||u;j.set(H)}},e=ws(e),[v,g,l,m,f,k,A,F,I,R,j,B,o,h,d,P,u,r,p,_]}class Wc extends We{constructor(e){super(),He(this,e,Hc,Uc,Be,{path:13,component:0,meta:14,primary:1})}}const bl=Wc;function zc(t){let e,n,l,i;const o=t[13].default,u=ho(o,t,t[12],null);let m=[{href:t[0]},t[2],t[1]],r={};for(let f=0;fn(11,_=C));const A=O0(),F=a0(),{navigate:I}=s0();function R(C){A("click",C),H0(C)&&(C.preventDefault(),I(l,{state:k,replace:u||g}))}return t.$$set=C=>{n(19,e=cl(cl({},e),ws(C))),n(18,p=Cs(e,f)),"to"in C&&n(5,d=C.to),"replace"in C&&n(6,g=C.replace),"state"in C&&n(7,k=C.state),"getProps"in C&&n(8,$=C.getProps),"$$scope"in C&&n(12,v=C.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&n(0,l=F(d,_)),t.$$.dirty&2049&&n(10,i=lo(_.pathname,l)),t.$$.dirty&2049&&n(9,o=l===_.pathname),t.$$.dirty&2049&&(u=Mo(l)===fc(_)),t.$$.dirty&512&&n(2,m=o?{"aria-current":"page"}:{}),n(1,r=(()=>{if(O1($)){const C=$({location:_,href:l,isPartiallyCurrent:i,isCurrent:o});return{...p,...C}}return p})())},e=ws(e),[l,r,m,N,R,d,g,k,$,o,i,_,v,h]}class Vc extends We{constructor(e){super(),He(this,e,Gc,zc,Be,{to:5,replace:6,state:7,getProps:8})}}const el=Vc;let Ti=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function jl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function Kc(t,e){return e?t>218&&t<242?"#32c000":t>212&&t<248?"#b1c000":t>208&&t<252?"#ffa000":"#d90000":t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function So(t,e){let n;return e?t>90?n="#d90000":t>85?n="#e31000":t>80?n="#ffa900":t>75?n="#dcc300":n="#32c500":t>90?n="#d90000":t>85?n="#e32100":t>80?n="#ffb800":t>75?n="#dcd800":n="#32d900",n}function Ni(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Ss(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Ye(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function Ce(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";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";case 80:return"Generic ESP32-S3"}}function qr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Br(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Ur(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function jr(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function ni(t){switch(t){case 2:case 4:case 7:return!0}return!1}function tt(t,e){return t==1||t==2&&e}function Wt(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function Ne(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<1?2:t<10?1:0),t.toFixed(e))}function wl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Hr(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function Wr(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function zr(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}let hs=0;function Ei(t,e){var n="";hs++;var l=function(){setTimeout(Ei,1e3,t,e)};if(t.net.ip&&hs%3==0){if(!t.net.ip){l();return}n="http://"+t.net.ip}else t.hostname&&hs%3==1?n="http://"+t.hostname:t.hostname&&hs%3==2?n="http://"+t.hostname+".local":n="";console&&console.log("Trying url "+n),e&&e(n);var i=new XMLHttpRequest;i.timeout=5e3,i.addEventListener("abort",l),i.addEventListener("error",l),i.addEventListener("timeout",l),i.addEventListener("load",function(o){window.location.href=n||"/"}),i.open("GET",n+"/is-alive",!0),i.send()}async function Dl(t,e={}){const{timeout:n=8e3}=e,l=new AbortController,i=setTimeout(()=>l.abort(),n),o=await fetch(t,{...e,signal:l.signal});return clearTimeout(i),o}let gl={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,if:{eth:!1}};const Tt=ht(gl);async function To(){gl=await(await Dl("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Tt.set(gl)}let vs=0,Gr=-127,Vr=null,Yc={};const r0=H1(Yc,t=>{let e;async function n(){Dl("data.json").then(l=>l.json()).then(l=>{t(l),Gr!=l.t&&(Gr=l.t,setTimeout(_0,2e3)),Vr==null&&l.pe&&l.p!=null&&(Vr=l.p,f0()),gl.upgrading?window.location.reload():(!gl||!gl.chip||gl.booting||vs>1&&!ni(gl.board))&&(To(),rn&&clearTimeout(rn),rn=setTimeout(Eo,2e3),un&&clearTimeout(un),un=setTimeout(Po,3e3));let i=5e3;if(ni(gl.board)&&l.v>2.5){let o=3.3-Math.min(3.3,l.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(n,i),vs=0}).catch(l=>{vs++,vs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(n,15e3)):e=setTimeout(n,ni(gl.board)?1e4:5e3)})}return n(),function(){clearTimeout(e)}});let no={},ki;const No=ht(no);async function u0(){let t=!1;if(No.update(e=>{for(var n=0;n<36;n++){if(e[Ye(n)]==null){t=n<12;break}e[Ye(n)]=e[Ye(n+1)]}return e}),t)f0();else{let e=new Date;ki=setTimeout(u0,(60-e.getMinutes())*6e4)}}async function f0(){ki&&(clearTimeout(ki),ki=0),no=await(await Dl("energyprice.json")).json(),No.set(no);let e=new Date;ki=setTimeout(u0,(60-e.getMinutes())*6e4)}let io={},rn;async function Eo(){rn&&(clearTimeout(rn),rn=0),io=await(await Dl("dayplot.json")).json(),c0.set(io);let e=new Date;rn=setTimeout(Eo,(60-e.getMinutes())*6e4+20)}const c0=ht(io,t=>(Eo(),function(){}));let so={},un;async function Po(){un&&(clearTimeout(un),un=0),so=await(await Dl("monthplot.json")).json(),m0.set(so);let e=new Date;un=setTimeout(Po,(24-e.getHours())*36e5+40)}const m0=ht(so,t=>(Po(),function(){}));let oo={};async function _0(){oo=await(await Dl("temperature.json")).json(),p0.set(oo)}const p0=ht(oo,t=>(_0(),function(){}));let ao={},bs;async function d0(){bs&&(clearTimeout(bs),bs=0),ao=await(await Dl("tariff.json")).json(),h0.set(ao);let e=new Date;bs=setTimeout(d0,(60-e.getMinutes())*6e4+30)}const h0=ht(ao,t=>function(){});let ro=[];const Ao=ht(ro);async function Qc(){ro=await(await Dl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Ao.set(ro)}let uo={};async function Xc(){uo=await(await Dl("realtime.json")).json(),v0.set(uo)}const v0=ht(uo,t=>(Xc(),function(){}));function Ts(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 b0(t){await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function g0(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let n=t.substring(1).split("."),l=parseInt(n[0]),i=parseInt(n[1]),o=parseInt(n[2]),u=[...e];u.reverse();let m,r,f;for(let p=0;po&&(m=_):g==i+1&&(r=_);else if(d==l+1)if(f){let $=f.tag_name.substring(1).split(".");parseInt($[0]);let N=parseInt($[1]);parseInt($[2]),g==N&&(f=_)}else f=_}return r||f||m||!1}else return e[0]}const Kr="/github.svg";function Yr(t){let e,n;function l(u,m){return u[1]>1?nm:u[1]>0?lm:u[2]>1?tm:u[2]>0?em:u[3]>1?xc:u[3]>0?Jc:Zc}let i=l(t),o=i(t);return{c(){e=E(`Up + `),o.c(),n=it()},m(u,m){M(u,e,m),o.m(u,m),M(u,n,m)},p(u,m){i===(i=l(u))&&o?o.p(u,m):(o.d(1),o=i(u),o&&(o.c(),o.m(n.parentNode,n)))},d(u){u&&y(e),o.d(u),u&&y(n)}}}function Zc(t){let e,n;return{c(){e=E(t[0]),n=E(" seconds")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&1&&X(e,l[0])},d(l){l&&y(e),l&&y(n)}}}function Jc(t){let e,n;return{c(){e=E(t[3]),n=E(" minute")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&8&&X(e,l[3])},d(l){l&&y(e),l&&y(n)}}}function xc(t){let e,n;return{c(){e=E(t[3]),n=E(" minutes")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&8&&X(e,l[3])},d(l){l&&y(e),l&&y(n)}}}function em(t){let e,n;return{c(){e=E(t[2]),n=E(" hour")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&4&&X(e,l[2])},d(l){l&&y(e),l&&y(n)}}}function tm(t){let e,n;return{c(){e=E(t[2]),n=E(" hours")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&4&&X(e,l[2])},d(l){l&&y(e),l&&y(n)}}}function lm(t){let e,n;return{c(){e=E(t[1]),n=E(" day")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&2&&X(e,l[1])},d(l){l&&y(e),l&&y(n)}}}function nm(t){let e,n;return{c(){e=E(t[1]),n=E(" days")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&2&&X(e,l[1])},d(l){l&&y(e),l&&y(n)}}}function im(t){let e,n=t[0]&&Yr(t);return{c(){n&&n.c(),e=it()},m(l,i){n&&n.m(l,i),M(l,e,i)},p(l,[i]){l[0]?n?n.p(l,i):(n=Yr(l),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:be,o:be,d(l){n&&n.d(l),l&&y(e)}}}function sm(t,e,n){let{epoch:l}=e,i=0,o=0,u=0;return t.$$set=m=>{"epoch"in m&&n(0,l=m.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(n(1,i=Math.floor(l/86400)),n(2,o=Math.floor(l/3600)),n(3,u=Math.floor(l/60)))},[l,i,o,u]}class om extends We{constructor(e){super(),He(this,e,sm,im,Be,{epoch:0})}}function am(t){let e,n,l;return{c(){e=c("span"),n=E(t[2]),a(e,"title",t[1]),a(e,"class",l="bd-"+t[0])},m(i,o){M(i,e,o),s(e,n)},p(i,[o]){o&4&&X(n,i[2]),o&2&&a(e,"title",i[1]),o&1&&l!==(l="bd-"+i[0])&&a(e,"class",l)},i:be,o:be,d(i){i&&y(e)}}}function rm(t,e,n){let{color:l}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&n(0,l=u.color),"title"in u&&n(1,i=u.title),"text"in u&&n(2,o=u.text)},[l,i,o]}class fn extends We{constructor(e){super(),He(this,e,rm,am,Be,{color:0,title:1,text:2})}}function um(t){let e,n=`${Ye(t[0].getDate())}.${Ye(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ye(t[0].getHours())}:${Ye(t[0].getMinutes())}`,l;return{c(){e=c("span"),l=E(n),a(e,"class",t[1])},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&1&&n!==(n=`${Ye(i[0].getDate())}.${Ye(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ye(i[0].getHours())}:${Ye(i[0].getMinutes())}`)&&X(l,n),o&2&&a(e,"class",i[1])},d(i){i&&y(e)}}}function fm(t){let e=`${Ye(t[0].getDate())}. ${Ti[t[0].getMonth()]} ${Ye(t[0].getHours())}:${Ye(t[0].getMinutes())}`,n;return{c(){n=E(e)},m(l,i){M(l,n,i)},p(l,i){i&1&&e!==(e=`${Ye(l[0].getDate())}. ${Ti[l[0].getMonth()]} ${Ye(l[0].getHours())}:${Ye(l[0].getMinutes())}`)&&X(n,e)},d(l){l&&y(n)}}}function cm(t){let e;function n(o,u){return o[2]?fm:um}let l=n(t),i=l(t);return{c(){i.c(),e=it()},m(o,u){i.m(o,u),M(o,e,u)},p(o,[u]){l===(l=n(o))&&i?i.p(o,u):(i.d(1),i=l(o),i&&(i.c(),i.m(e.parentNode,e)))},i:be,o:be,d(o){i.d(o),o&&y(e)}}}function mm(t,e,n){let{timestamp:l}=e,{fullTimeColor:i}=e,{offset:o}=e,u;return t.$$set=m=>{"timestamp"in m&&n(0,l=m.timestamp),"fullTimeColor"in m&&n(1,i=m.fullTimeColor),"offset"in m&&n(3,o=m.offset)},t.$$.update=()=>{t.$$.dirty&9&&(n(2,u=Math.abs(new Date().getTime()-l.getTime())<3e5),isNaN(o)||wl(l,o-(24+l.getHours()-l.getUTCHours())%24))},[l,i,u,o]}class k0 extends We{constructor(e){super(),He(this,e,mm,cm,Be,{timestamp:0,fullTimeColor:1,offset:3})}}function _m(t){let e,n,l;return{c(){e=je("svg"),n=je("path"),l=je("path"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"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"),a(l,"stroke-linecap","round"),a(l,"stroke-linejoin","round"),a(l,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(i,o){M(i,e,o),s(e,n),s(e,l)},p:be,i:be,o:be,d(i){i&&y(e)}}}class pm extends We{constructor(e){super(),He(this,e,null,_m,Be,{})}}function dm(t){let e,n;return{c(){e=je("svg"),n=je("path"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"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"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(l,i){M(l,e,i),s(e,n)},p:be,i:be,o:be,d(l){l&&y(e)}}}class hm extends We{constructor(e){super(),He(this,e,null,dm,Be,{})}}function vm(t){let e,n;return{c(){e=je("svg"),n=je("path"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"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"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(l,i){M(l,e,i),s(e,n)},p:be,i:be,o:be,d(l){l&&y(e)}}}class Ht extends We{constructor(e){super(),He(this,e,null,vm,Be,{})}}function bm(t){let e,n;return{c(){e=je("svg"),n=je("path"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"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"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(l,i){M(l,e,i),s(e,n)},p:be,i:be,o:be,d(l){l&&y(e)}}}class w0 extends We{constructor(e){super(),He(this,e,null,bm,Be,{})}}function gm(t){let e,n,l=t[2].version+"",i;return{c(){e=E("AMS reader "),n=c("span"),i=E(l)},m(o,u){M(o,e,u),M(o,n,u),s(n,i)},p(o,u){u&4&&l!==(l=o[2].version+"")&&X(i,l)},d(o){o&&y(e),o&&y(n)}}}function Qr(t){let e,n=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",l,i;return{c(){e=c("div"),l=E(n),i=E("\xB0C"),a(e,"class","flex-none my-auto")},m(o,u){M(o,e,u),s(e,l),s(e,i)},p(o,u){u&2&&n!==(n=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&X(l,n)},d(o){o&&y(e)}}}function Xr(t){let e,n="HAN: "+qr(t[1].he),l;return{c(){e=c("div"),l=E(n),a(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&2&&n!==(n="HAN: "+qr(i[1].he))&&X(l,n)},d(i){i&&y(e)}}}function Zr(t){let e,n="MQTT: "+Br(t[1].me),l;return{c(){e=c("div"),l=E(n),a(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&2&&n!==(n="MQTT: "+Br(i[1].me))&&X(l,n)},d(i){i&&y(e)}}}function Jr(t){let e,n="Price service: "+Ur(t[1].ee),l;return{c(){e=c("div"),l=E(n),a(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&2&&n!==(n="Price service: "+Ur(i[1].ee))&&X(l,n)},d(i){i&&y(e)}}}function xr(t){let e,n,l,i,o,u;return n=new el({props:{to:"/configuration",$$slots:{default:[km]},$$scope:{ctx:t}}}),o=new el({props:{to:"/status",$$slots:{default:[wm]},$$scope:{ctx:t}}}),{c(){e=c("div"),ae(n.$$.fragment),l=b(),i=c("div"),ae(o.$$.fragment),a(e,"class","flex-none px-1 mt-1"),a(e,"title","Configuration"),a(i,"class","flex-none px-1 mt-1"),a(i,"title","Device information")},m(m,r){M(m,e,r),se(n,e,null),M(m,l,r),M(m,i,r),se(o,i,null),u=!0},i(m){u||(L(n.$$.fragment,m),L(o.$$.fragment,m),u=!0)},o(m){q(n.$$.fragment,m),q(o.$$.fragment,m),u=!1},d(m){m&&y(e),oe(n),m&&y(l),m&&y(i),oe(o)}}}function km(t){let e,n;return e=new pm({}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function wm(t){let e,n;return e=new hm({}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function eu(t){let e,n,l,i,o;const u=[ym,Cm],m=[];function r(f,p){return f[2].security==0||f[1].a?0:1}return n=r(t),l=m[n]=u[n](t),{c(){e=c("div"),l.c(),a(e,"class","flex-none mr-3 text-yellow-500"),a(e,"title",i="New version: "+t[3].tag_name)},m(f,p){M(f,e,p),m[n].m(e,null),o=!0},p(f,p){let _=n;n=r(f),n===_?m[n].p(f,p):($e(),q(m[_],1,1,()=>{m[_]=null}),De(),l=m[n],l?l.p(f,p):(l=m[n]=u[n](f),l.c()),L(l,1),l.m(e,null)),(!o||p&8&&i!==(i="New version: "+f[3].tag_name))&&a(e,"title",i)},i(f){o||(L(l),o=!0)},o(f){q(l),o=!1},d(f){f&&y(e),m[n].d()}}}function Cm(t){let e,n,l=t[3].tag_name+"",i;return{c(){e=c("span"),n=E("New version: "),i=E(l)},m(o,u){M(o,e,u),s(e,n),s(e,i)},p(o,u){u&8&&l!==(l=o[3].tag_name+"")&&X(i,l)},i:be,o:be,d(o){o&&y(e)}}}function ym(t){let e,n,l,i=t[3].tag_name+"",o,u,m,r,f,p;return m=new w0({}),{c(){e=c("button"),n=c("span"),l=E("New version: "),o=E(i),u=b(),ae(m.$$.fragment),a(n,"class","mt-1"),a(e,"class","flex")},m(_,h){M(_,e,h),s(e,n),s(n,l),s(n,o),s(e,u),se(m,e,null),r=!0,f||(p=Q(e,"click",t[4]),f=!0)},p(_,h){(!r||h&8)&&i!==(i=_[3].tag_name+"")&&X(o,i)},i(_){r||(L(m.$$.fragment,_),r=!0)},o(_){q(m.$$.fragment,_),r=!1},d(_){_&&y(e),oe(m),f=!1,p()}}}function Mm(t){let e,n,l,i,o,u,m,r,f,p,_,h,v=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K,Z,z,W,x,_e,ie,me,Y,ke,Ee,we,Me;i=new el({props:{to:"/",$$slots:{default:[gm]},$$scope:{ctx:t}}}),r=new om({props:{epoch:t[1].u}});let te=t[1].t>-50&&Qr(t);N=new fn({props:{title:"ESP",text:t[2].booting?"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":"ESP",color:jl(t[2].booting?2:t[1].em)}}),F=new fn({props:{title:"HAN",text:"HAN",color:jl(t[2].booting?9:t[1].hm)}}),R=new fn({props:{title:"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":"WiFi",color:jl(t[2].booting?9:t[1].wm)}}),P=new fn({props:{title:"MQTT",text:"MQTT",color:jl(t[2].booting?9:t[1].mm)}});let fe=(t[1].he<0||t[1].he>0)&&Xr(t),Oe=t[1].me<0&&Zr(t),Ie=(t[1].ee>0||t[1].ee<0)&&Jr(t);_e=new k0({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let T=t[2].vndcfg&&t[2].usrcfg&&xr(t);Ee=new Ht({});let w=t[2].fwconsent===1&&t[3]&&eu(t);return{c(){e=c("nav"),n=c("div"),l=c("div"),ae(i.$$.fragment),o=b(),u=c("div"),m=c("div"),ae(r.$$.fragment),f=b(),te&&te.c(),p=b(),_=c("div"),h=E("Free mem: "),d=E(v),g=E("kb"),k=b(),$=c("div"),ae(N.$$.fragment),A=b(),ae(F.$$.fragment),I=b(),ae(R.$$.fragment),C=b(),ae(P.$$.fragment),ne=b(),fe&&fe.c(),j=b(),Oe&&Oe.c(),B=b(),Ie&&Ie.c(),H=b(),V=c("div"),G=c("div"),K=c("a"),Z=c("img"),W=b(),x=c("div"),ae(_e.$$.fragment),ie=b(),T&&T.c(),me=b(),Y=c("div"),ke=c("a"),ae(Ee.$$.fragment),we=b(),w&&w.c(),a(l,"class","flex text-lg text-gray-100 p-2"),a(m,"class","flex-none my-auto"),a(_,"class","flex-none my-auto"),a(u,"class","flex-none my-auto p-2 flex space-x-4"),a($,"class","flex-auto flex-wrap my-auto justify-center p-2"),a(Z,"class","gh-logo"),ks(Z.src,z=t[0]+Kr)||a(Z,"src",z),a(Z,"alt","GitHub repo"),a(K,"class","float-right"),a(K,"href","https://github.com/UtilitechAS/amsreader-firmware"),a(K,"target","_blank"),a(K,"rel","noreferrer"),a(K,"aria-label","GitHub"),a(G,"class","flex-none"),a(x,"class","flex-none my-auto px-2"),a(ke,"href",Wt("")),a(ke,"target","_blank"),a(ke,"rel","noreferrer"),a(Y,"class","flex-none px-1 mt-1"),a(Y,"title","Documentation"),a(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),a(n,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),a(e,"class","hdr")},m(S,D){M(S,e,D),s(e,n),s(n,l),se(i,l,null),s(n,o),s(n,u),s(u,m),se(r,m,null),s(u,f),te&&te.m(u,null),s(u,p),s(u,_),s(_,h),s(_,d),s(_,g),s(n,k),s(n,$),se(N,$,null),s($,A),se(F,$,null),s($,I),se(R,$,null),s($,C),se(P,$,null),s(n,ne),fe&&fe.m(n,null),s(n,j),Oe&&Oe.m(n,null),s(n,B),Ie&&Ie.m(n,null),s(n,H),s(n,V),s(V,G),s(G,K),s(K,Z),s(V,W),s(V,x),se(_e,x,null),s(V,ie),T&&T.m(V,null),s(V,me),s(V,Y),s(Y,ke),se(Ee,ke,null),s(V,we),w&&w.m(V,null),Me=!0},p(S,[D]){const O={};D&36&&(O.$$scope={dirty:D,ctx:S}),i.$set(O);const J={};D&2&&(J.epoch=S[1].u),r.$set(J),S[1].t>-50?te?te.p(S,D):(te=Qr(S),te.c(),te.m(u,p)):te&&(te.d(1),te=null),(!Me||D&2)&&v!==(v=(S[1].m?(S[1].m/1e3).toFixed(1):"-")+"")&&X(d,v);const le={};D&6&&(le.text=S[2].booting?"Booting":S[1].v>2?S[1].v.toFixed(2)+"V":"ESP"),D&6&&(le.color=jl(S[2].booting?2:S[1].em)),N.$set(le);const pe={};D&6&&(pe.color=jl(S[2].booting?9:S[1].hm)),F.$set(pe);const ge={};D&2&&(ge.text=S[1].r?S[1].r.toFixed(0)+"dBm":"WiFi"),D&6&&(ge.color=jl(S[2].booting?9:S[1].wm)),R.$set(ge);const Ae={};D&6&&(Ae.color=jl(S[2].booting?9:S[1].mm)),P.$set(Ae),S[1].he<0||S[1].he>0?fe?fe.p(S,D):(fe=Xr(S),fe.c(),fe.m(n,j)):fe&&(fe.d(1),fe=null),S[1].me<0?Oe?Oe.p(S,D):(Oe=Zr(S),Oe.c(),Oe.m(n,B)):Oe&&(Oe.d(1),Oe=null),S[1].ee>0||S[1].ee<0?Ie?Ie.p(S,D):(Ie=Jr(S),Ie.c(),Ie.m(n,H)):Ie&&(Ie.d(1),Ie=null),(!Me||D&1&&!ks(Z.src,z=S[0]+Kr))&&a(Z,"src",z);const Fe={};D&2&&(Fe.timestamp=S[1].c?new Date(S[1].c*1e3):new Date(0)),D&4&&(Fe.offset=S[2].clock_offset),_e.$set(Fe),S[2].vndcfg&&S[2].usrcfg?T?D&4&&L(T,1):(T=xr(S),T.c(),L(T,1),T.m(V,me)):T&&($e(),q(T,1,1,()=>{T=null}),De()),S[2].fwconsent===1&&S[3]?w?(w.p(S,D),D&12&&L(w,1)):(w=eu(S),w.c(),L(w,1),w.m(V,null)):w&&($e(),q(w,1,1,()=>{w=null}),De())},i(S){Me||(L(i.$$.fragment,S),L(r.$$.fragment,S),L(N.$$.fragment,S),L(F.$$.fragment,S),L(R.$$.fragment,S),L(P.$$.fragment,S),L(_e.$$.fragment,S),L(T),L(Ee.$$.fragment,S),L(w),Me=!0)},o(S){q(i.$$.fragment,S),q(r.$$.fragment,S),q(N.$$.fragment,S),q(F.$$.fragment,S),q(R.$$.fragment,S),q(P.$$.fragment,S),q(_e.$$.fragment,S),q(T),q(Ee.$$.fragment,S),q(w),Me=!1},d(S){S&&y(e),oe(i),oe(r),te&&te.d(),oe(N),oe(F),oe(R),oe(P),fe&&fe.d(),Oe&&Oe.d(),Ie&&Ie.d(),oe(_e),T&&T.d(),oe(Ee),w&&w.d()}}}function Sm(t,e,n){let{basepath:l="/"}=e,{data:i={}}=e,o={},u={};function m(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(!ni(o.board)||confirm(Ts(Ce(o.chip,o.board))))&&(Tt.update(r=>(r.upgrading=!0,r)),b0(u.tag_name))}return Tt.subscribe(r=>{n(2,o=r),r.fwconsent===1&&Qc()}),Ao.subscribe(r=>{n(3,u=g0(o.version,r))}),t.$$set=r=>{"basepath"in r&&n(0,l=r.basepath),"data"in r&&n(1,i=r.data)},[l,i,o,u,m]}class Tm extends We{constructor(e){super(),He(this,e,Sm,Mm,Be,{basepath:0,data:1})}}function Nm(t){let e,n,l,i;return{c(){e=je("svg"),n=je("path"),l=je("path"),a(n,"d",Js(150,150,115,210,510)),a(n,"stroke","rgba(128, 128, 128, 0.15)"),a(n,"fill","none"),a(n,"stroke-width","55"),a(l,"d",i=Js(150,150,115,210,210+300*t[0]/100)),a(l,"stroke",t[1]),a(l,"fill","none"),a(l,"stroke-width","55"),a(e,"viewBox","0 0 300 300"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"height","100%")},m(o,u){M(o,e,u),s(e,n),s(e,l)},p(o,[u]){u&1&&i!==(i=Js(150,150,115,210,210+300*o[0]/100))&&a(l,"d",i),u&2&&a(l,"stroke",o[1])},i:be,o:be,d(o){o&&y(e)}}}function tu(t,e,n,l){var i=(l-90)*Math.PI/180;return{x:t+n*Math.cos(i),y:e+n*Math.sin(i)}}function Js(t,e,n,l,i){var o=tu(t,e,n,i),u=tu(t,e,n,l),m=i-l<=180?"0":"1",r=["M",o.x,o.y,"A",n,n,0,m,0,u.x,u.y].join(" ");return r}function Em(t,e,n){let{pct:l=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&n(0,l=o.pct),"color"in o&&n(1,i=o.color)},[l,i]}class Pm extends We{constructor(e){super(),He(this,e,Em,Nm,Be,{pct:0,color:1})}}function lu(t){let e,n,l,i,o,u,m,r;return{c(){e=c("br"),n=b(),l=c("span"),i=E(t[3]),o=b(),u=c("span"),m=E(t[4]),r=E("/kWh"),a(l,"class","pl-sub"),a(u,"class","pl-snt")},m(f,p){M(f,e,p),M(f,n,p),M(f,l,p),s(l,i),M(f,o,p),M(f,u,p),s(u,m),s(u,r)},p(f,p){p&8&&X(i,f[3]),p&16&&X(m,f[4])},d(f){f&&y(e),f&&y(n),f&&y(l),f&&y(o),f&&y(u)}}}function Am(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k;n=new Pm({props:{pct:t[6],color:t[5](t[6],document.documentElement.classList.contains("dark"))}});let $=t[3]&&lu(t);return{c(){e=c("div"),ae(n.$$.fragment),l=b(),i=c("span"),o=c("span"),u=E(t[2]),m=b(),r=c("br"),f=b(),p=c("span"),_=E(t[0]),h=b(),v=c("span"),d=E(t[1]),g=b(),$&&$.c(),a(o,"class","pl-lab"),a(p,"class","pl-val"),a(v,"class","pl-unt"),a(i,"class","pl-ov"),a(e,"class","pl-root")},m(N,A){M(N,e,A),se(n,e,null),s(e,l),s(e,i),s(i,o),s(o,u),s(i,m),s(i,r),s(i,f),s(i,p),s(p,_),s(i,h),s(i,v),s(v,d),s(i,g),$&&$.m(i,null),k=!0},p(N,[A]){const F={};A&64&&(F.pct=N[6]),A&96&&(F.color=N[5](N[6],document.documentElement.classList.contains("dark"))),n.$set(F),(!k||A&4)&&X(u,N[2]),(!k||A&1)&&X(_,N[0]),(!k||A&2)&&X(d,N[1]),N[3]?$?$.p(N,A):($=lu(N),$.c(),$.m(i,null)):$&&($.d(1),$=null)},i(N){k||(L(n.$$.fragment,N),k=!0)},o(N){q(n.$$.fragment,N),k=!1},d(N){N&&y(e),oe(n),$&&$.d()}}}function $m(t,e,n){let{val:l}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:m=""}=e,{subunit:r=""}=e,{colorFn:f}=e,p=0;return t.$$set=_=>{"val"in _&&n(0,l=_.val),"max"in _&&n(7,i=_.max),"unit"in _&&n(1,o=_.unit),"label"in _&&n(2,u=_.label),"sub"in _&&n(3,m=_.sub),"subunit"in _&&n(4,r=_.subunit),"colorFn"in _&&n(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&n(6,p=Math.min(l,i)/i*100)},[l,o,u,m,r,f,p,i]}class C0 extends We{constructor(e){super(),He(this,e,$m,Am,Be,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function nu(t,e,n){const l=t.slice();return l[11]=e[n],l[13]=n,l}function iu(t,e,n){const l=t.slice();return l[11]=e[n],l[13]=n,l}function su(t,e,n){const l=t.slice();return l[15]=e[n],l}function ou(t){let e,n,l,i,o,u,m=t[0].title&&au(t),r=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(o,u){M(o,e,u),s(e,l),i=ko(e,t[9].bind(e))},p(o,u){u&1&&n!==(n=o[0].title+"")&&X(l,n)},d(o){o&&y(e),i()}}}function ru(t){let e,n,l,i=t[15].label+"",o,u,m,r;return{c(){e=je("g"),n=je("line"),l=je("text"),o=E(i),a(n,"x2","100%"),a(l,"y","-4"),a(l,"x",u=t[15].align=="right"?"85%":""),a(e,"class",m="tick tick-"+t[15].value+" tick-"+t[15].color),a(e,"transform",r="translate(0, "+t[7](t[15].value)+")")},m(f,p){M(f,e,p),s(e,n),s(e,l),s(l,o)},p(f,p){p&1&&i!==(i=f[15].label+"")&&X(o,i),p&1&&u!==(u=f[15].align=="right"?"85%":"")&&a(l,"x",u),p&1&&m!==(m="tick tick-"+f[15].value+" tick-"+f[15].color)&&a(e,"class",m),p&129&&r!==(r="translate(0, "+f[7](f[15].value)+")")&&a(e,"transform",r)},d(f){f&&y(e)}}}function uu(t){let e=!isNaN(t[7](t[15].value)),n,l=e&&ru(t);return{c(){l&&l.c(),n=it()},m(i,o){l&&l.m(i,o),M(i,n,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?l?l.p(i,o):(l=ru(i),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(i){l&&l.d(i),i&&y(n)}}}function fu(t){let e,n,l=(t[3]>20||t[13]%2==0)&&cu(t);return{c(){e=je("g"),l&&l.c(),a(e,"class","tick"),a(e,"transform",n="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){M(i,e,o),l&&l.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?l?l.p(i,o):(l=cu(i),l.c(),l.m(e,null)):l&&(l.d(1),l=null),o&80&&n!==(n="translate("+i[6](i[13])+","+i[4]+")")&&a(e,"transform",n)},d(i){i&&y(e),l&&l.d()}}}function cu(t){let e,n=t[11].label+"",l,i;return{c(){e=je("text"),l=E(n),a(e,"x",i=t[3]/2),a(e,"y","-4")},m(o,u){M(o,e,u),s(e,l)},p(o,u){u&1&&n!==(n=o[11].label+"")&&X(l,n),u&8&&i!==(i=o[3]/2)&&a(e,"x",i)},d(o){o&&y(e)}}}function mu(t){let e=!isNaN(t[6](t[13])),n,l=e&&fu(t);return{c(){l&&l.c(),n=it()},m(i,o){l&&l.m(i,o),M(i,n,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?l?l.p(i,o):(l=fu(i),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(i){l&&l.d(i),i&&y(n)}}}function _u(t){let e,n,l=t[11].value!==void 0&&pu(t),i=t[11].value2>1e-4&&vu(t);return{c(){e=je("g"),l&&l.c(),n=je("g"),i&&i.c()},m(o,u){M(o,e,u),l&&l.m(e,null),M(o,n,u),i&&i.m(n,null)},p(o,u){o[11].value!==void 0?l?l.p(o,u):(l=pu(o),l.c(),l.m(e,null)):l&&(l.d(1),l=null),o[11].value2>1e-4?i?i.p(o,u):(i=vu(o),i.c(),i.m(n,null)):i&&(i.d(1),i=null)},d(o){o&&y(e),l&&l.d(),o&&y(n),i&&i.d()}}}function pu(t){let e,n,l,i,o,u,m,r=t[3]>15&&du(t);return{c(){e=je("rect"),r&&r.c(),m=it(),a(e,"x",n=t[6](t[13])+2),a(e,"y",l=t[7](t[11].value)),a(e,"width",i=t[3]-4),a(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),a(e,"fill",u=t[11].color)},m(f,p){M(f,e,p),r&&r.m(f,p),M(f,m,p)},p(f,p){p&64&&n!==(n=f[6](f[13])+2)&&a(e,"x",n),p&129&&l!==(l=f[7](f[11].value))&&a(e,"y",l),p&8&&i!==(i=f[3]-4)&&a(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&a(e,"height",o),p&1&&u!==(u=f[11].color)&&a(e,"fill",u),f[3]>15?r?r.p(f,p):(r=du(f),r.c(),r.m(m.parentNode,m)):r&&(r.d(1),r=null)},d(f){f&&y(e),r&&r.d(f),f&&y(m)}}}function du(t){let e,n=t[11].label+"",l,i,o,u,m,r,f=t[11].title&&hu(t);return{c(){e=je("text"),l=E(n),f&&f.c(),r=it(),a(e,"width",i=t[3]-4),a(e,"dominant-baseline","middle"),a(e,"text-anchor",o=t[3]t[7](0)-t[8]?t[11].color:"white"),a(e,"transform",m="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[11].labelAngle?t[11].labelAngle:t[3]p[7](0)-p[8]?p[11].color:"white")&&a(e,"fill",u),_&457&&m!==(m="translate("+(p[6](p[13])+p[3]/2)+" "+(p[7](p[11].value)>p[7](0)-p[8]?p[7](p[11].value)-p[8]:p[7](p[11].value)+10)+") rotate("+(p[11].labelAngle?p[11].labelAngle:p[3]15&&bu(t);return{c(){e=je("rect"),r&&r.c(),m=it(),a(e,"x",n=t[6](t[13])+2),a(e,"y",l=t[7](0)),a(e,"width",i=t[3]-4),a(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),a(e,"fill",u=t[11].color2?t[11].color2:t[11].color)},m(f,p){M(f,e,p),r&&r.m(f,p),M(f,m,p)},p(f,p){p&64&&n!==(n=f[6](f[13])+2)&&a(e,"x",n),p&128&&l!==(l=f[7](0))&&a(e,"y",l),p&8&&i!==(i=f[3]-4)&&a(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&a(e,"height",o),p&1&&u!==(u=f[11].color2?f[11].color2:f[11].color)&&a(e,"fill",u),f[3]>15?r?r.p(f,p):(r=bu(f),r.c(),r.m(m.parentNode,m)):r&&(r.d(1),r=null)},d(f){f&&y(e),r&&r.d(f),f&&y(m)}}}function bu(t){let e,n=t[11].label2+"",l,i,o,u,m,r=t[11].title2&&gu(t);return{c(){e=je("text"),l=E(n),r&&r.c(),m=it(),a(e,"width",i=t[3]-4),a(e,"dominant-baseline","middle"),a(e,"text-anchor","middle"),a(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(i,o){M(i,e,o),l&&l.m(e,null),n=ko(e,t[10].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?l?l.p(i,o):(l=ou(i),l.c(),l.m(e,null)):l&&(l.d(1),l=null)},i:be,o:be,d(i){i&&y(e),l&&l.d(),n()}}}let cn=30;function Lm(t,e,n){let{config:l}=e,i,o,u,m,r,f,p,_=0;function h(){_=this.clientHeight,n(5,_)}function v(){i=this.clientWidth,o=this.clientHeight,n(1,i),n(2,o)}return t.$$set=d=>{"config"in d&&n(0,l=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){n(4,f=o-_);let d=i-(l.padding.left+l.padding.right);n(3,u=d/l.points.length),n(8,p=ul.y.max?$=l.padding.bottom:kf||$<0?0:$})}},[l,i,o,u,f,_,m,r,p,h,v]}class pn extends We{constructor(e){super(),He(this,e,Lm,Dm,Be,{config:0})}}function Im(t){let e,n;return e=new pn({props:{config:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,[i]){const o={};i&1&&(o.config=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Rm(t,e,n){let{u1:l}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,m={};function r(f){return{label:Ne(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:Kc(f||0,document.documentElement.classList.contains("dark"))}}return t.$$set=f=>{"u1"in f&&n(1,l=f.u1),"u2"in f&&n(2,i=f.u2),"u3"in f&&n(3,o=f.u3),"ds"in f&&n(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],p=[];l>0&&(f.push({label:u===1?"L1-L2":"L1"}),p.push(r(l))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),p.push(r(i))),o>0&&(f.push({label:u===1?"L2-L3":"L3"}),p.push(r(o))),n(0,m={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:p})}},[m,l,i,o,u]}class Fm extends We{constructor(e){super(),He(this,e,Rm,Im,Be,{u1:1,u2:2,u3:3,ds:4})}}function Om(t){let e,n,l,i,o,u,m,r=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,p,_,h,v,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",k,$,N,A,F,I,R,C=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",P,ne,j,B,H,V,G=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",K,Z;return{c(){e=c("div"),n=c("strong"),n.textContent="Reactive",l=b(),i=c("div"),o=c("div"),o.textContent="Instant in",u=b(),m=c("div"),f=E(r),p=E(" VAr"),_=b(),h=c("div"),h.textContent="Instant out",v=b(),d=c("div"),k=E(g),$=E(" VAr"),N=b(),A=c("div"),F=c("div"),F.textContent="Total in",I=b(),R=c("div"),P=E(C),ne=E(" kVArh"),j=b(),B=c("div"),B.textContent="Total out",H=b(),V=c("div"),K=E(G),Z=E(" kVArh"),a(m,"class","text-right"),a(d,"class","text-right"),a(i,"class","grid grid-cols-2 mt-4"),a(R,"class","text-right"),a(V,"class","text-right"),a(A,"class","grid grid-cols-2 mt-4"),a(e,"class","mx-2 text-sm")},m(z,W){M(z,e,W),s(e,n),s(e,l),s(e,i),s(i,o),s(i,u),s(i,m),s(m,f),s(m,p),s(i,_),s(i,h),s(i,v),s(i,d),s(d,k),s(d,$),s(e,N),s(e,A),s(A,F),s(A,I),s(A,R),s(R,P),s(R,ne),s(A,j),s(A,B),s(A,H),s(A,V),s(V,K),s(V,Z)},p(z,[W]){W&1&&r!==(r=(typeof z[0]<"u"?z[0].toFixed(0):"-")+"")&&X(f,r),W&2&&g!==(g=(typeof z[1]<"u"?z[1].toFixed(0):"-")+"")&&X(k,g),W&4&&C!==(C=(typeof z[2]<"u"?z[2].toFixed(1):"-")+"")&&X(P,C),W&8&&G!==(G=(typeof z[3]<"u"?z[3].toFixed(1):"-")+"")&&X(K,G)},i:be,o:be,d(z){z&&y(e)}}}function qm(t,e,n){let{importInstant:l}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=e;return t.$$set=m=>{"importInstant"in m&&n(0,l=m.importInstant),"exportInstant"in m&&n(1,i=m.exportInstant),"importTotal"in m&&n(2,o=m.importTotal),"exportTotal"in m&&n(3,u=m.exportTotal)},[l,i,o,u]}class Bm extends We{constructor(e){super(),He(this,e,qm,Om,Be,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function wu(t){let e;function n(o,u){return o[3]?jm:Um}let l=n(t),i=l(t);return{c(){i.c(),e=it()},m(o,u){i.m(o,u),M(o,e,u)},p(o,u){l===(l=n(o))&&i?i.p(o,u):(i.d(1),i=l(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&y(e)}}}function Um(t){let e,n,l,i,o,u,m=Ne(t[1].h.u,2)+"",r,f,p,_,h,v,d=Ne(t[1].d.u,1)+"",g,k,$,N,A,F,I=Ne(t[1].m.u)+"",R,C,P,ne,j,B,H=Ne(t[0].last_month.u)+"",V,G,K,Z,z=t[4]&&Cu(t);return{c(){e=c("strong"),e.textContent="Consumption",n=b(),l=c("div"),i=c("div"),i.textContent="Hour",o=b(),u=c("div"),r=E(m),f=E(" kWh"),p=b(),_=c("div"),_.textContent="Day",h=b(),v=c("div"),g=E(d),k=E(" kWh"),$=b(),N=c("div"),N.textContent="Month",A=b(),F=c("div"),R=E(I),C=E(" kWh"),P=b(),ne=c("div"),ne.textContent="Last month",j=b(),B=c("div"),V=E(H),G=E(" kWh"),K=b(),z&&z.c(),Z=it(),a(u,"class","text-right"),a(v,"class","text-right"),a(F,"class","text-right"),a(B,"class","text-right"),a(l,"class","grid grid-cols-2 mb-3")},m(W,x){M(W,e,x),M(W,n,x),M(W,l,x),s(l,i),s(l,o),s(l,u),s(u,r),s(u,f),s(l,p),s(l,_),s(l,h),s(l,v),s(v,g),s(v,k),s(l,$),s(l,N),s(l,A),s(l,F),s(F,R),s(F,C),s(l,P),s(l,ne),s(l,j),s(l,B),s(B,V),s(B,G),M(W,K,x),z&&z.m(W,x),M(W,Z,x)},p(W,x){x&2&&m!==(m=Ne(W[1].h.u,2)+"")&&X(r,m),x&2&&d!==(d=Ne(W[1].d.u,1)+"")&&X(g,d),x&2&&I!==(I=Ne(W[1].m.u)+"")&&X(R,I),x&1&&H!==(H=Ne(W[0].last_month.u)+"")&&X(V,H),W[4]?z?z.p(W,x):(z=Cu(W),z.c(),z.m(Z.parentNode,Z)):z&&(z.d(1),z=null)},d(W){W&&y(e),W&&y(n),W&&y(l),W&&y(K),z&&z.d(W),W&&y(Z)}}}function jm(t){let e,n,l,i,o,u,m=Ne(t[1].h.u,2)+"",r,f,p,_,h,v,d,g=Ne(t[1].d.u,1)+"",k,$,N,A,F,I,R,C=Ne(t[1].m.u)+"",P,ne,j,B,H,V,G,K=Ne(t[0].last_month.u)+"",Z,z,W,x,_e,ie,me,Y,ke,Ee,we,Me=Ne(t[1].h.p,2)+"",te,fe,Oe,Ie,T,w,S,D=Ne(t[1].d.p,1)+"",O,J,le,pe,ge,Ae,Fe,ce=Ne(t[1].m.p)+"",Pe,ze,_t,Ke,ut,Ge,pt,Ue=Ne(t[0].last_month.p)+"",At,dt,vt,xe,Re=t[4]&&yu(t),et=t[4]&&Mu(t),Le=t[4]&&Su(t),Je=t[4]&&Tu(t),at=t[4]&&Nu(t),qe=t[4]&&Eu(t),ye=t[4]&&Pu(t),ve=t[4]&&Au(t);return{c(){e=c("strong"),e.textContent="Import",n=b(),l=c("div"),i=c("div"),i.textContent="Hour",o=b(),u=c("div"),r=E(m),f=E(" kWh"),p=b(),Re&&Re.c(),_=b(),h=c("div"),h.textContent="Day",v=b(),d=c("div"),k=E(g),$=E(" kWh"),N=b(),et&&et.c(),A=b(),F=c("div"),F.textContent="Month",I=b(),R=c("div"),P=E(C),ne=E(" kWh"),j=b(),Le&&Le.c(),B=b(),H=c("div"),H.textContent="Last mo.",V=b(),G=c("div"),Z=E(K),z=E(" kWh"),W=b(),Je&&Je.c(),_e=b(),ie=c("strong"),ie.textContent="Export",me=b(),Y=c("div"),ke=c("div"),ke.textContent="Hour",Ee=b(),we=c("div"),te=E(Me),fe=E(" kWh"),Oe=b(),at&&at.c(),Ie=b(),T=c("div"),T.textContent="Day",w=b(),S=c("div"),O=E(D),J=E(" kWh"),le=b(),qe&&qe.c(),pe=b(),ge=c("div"),ge.textContent="Month",Ae=b(),Fe=c("div"),Pe=E(ce),ze=E(" kWh"),_t=b(),ye&&ye.c(),Ke=b(),ut=c("div"),ut.textContent="Last mo.",Ge=b(),pt=c("div"),At=E(Ue),dt=E(" kWh"),vt=b(),ve&&ve.c(),a(u,"class","text-right"),a(d,"class","text-right"),a(R,"class","text-right"),a(G,"class","text-right"),a(l,"class",x="grid grid-cols-"+t[5]+" mb-3"),a(we,"class","text-right"),a(S,"class","text-right"),a(Fe,"class","text-right"),a(pt,"class","text-right"),a(Y,"class",xe="grid grid-cols-"+t[5])},m(de,Ve){M(de,e,Ve),M(de,n,Ve),M(de,l,Ve),s(l,i),s(l,o),s(l,u),s(u,r),s(u,f),s(l,p),Re&&Re.m(l,null),s(l,_),s(l,h),s(l,v),s(l,d),s(d,k),s(d,$),s(l,N),et&&et.m(l,null),s(l,A),s(l,F),s(l,I),s(l,R),s(R,P),s(R,ne),s(l,j),Le&&Le.m(l,null),s(l,B),s(l,H),s(l,V),s(l,G),s(G,Z),s(G,z),s(l,W),Je&&Je.m(l,null),M(de,_e,Ve),M(de,ie,Ve),M(de,me,Ve),M(de,Y,Ve),s(Y,ke),s(Y,Ee),s(Y,we),s(we,te),s(we,fe),s(Y,Oe),at&&at.m(Y,null),s(Y,Ie),s(Y,T),s(Y,w),s(Y,S),s(S,O),s(S,J),s(Y,le),qe&&qe.m(Y,null),s(Y,pe),s(Y,ge),s(Y,Ae),s(Y,Fe),s(Fe,Pe),s(Fe,ze),s(Y,_t),ye&&ye.m(Y,null),s(Y,Ke),s(Y,ut),s(Y,Ge),s(Y,pt),s(pt,At),s(pt,dt),s(Y,vt),ve&&ve.m(Y,null)},p(de,Ve){Ve&2&&m!==(m=Ne(de[1].h.u,2)+"")&&X(r,m),de[4]?Re?Re.p(de,Ve):(Re=yu(de),Re.c(),Re.m(l,_)):Re&&(Re.d(1),Re=null),Ve&2&&g!==(g=Ne(de[1].d.u,1)+"")&&X(k,g),de[4]?et?et.p(de,Ve):(et=Mu(de),et.c(),et.m(l,A)):et&&(et.d(1),et=null),Ve&2&&C!==(C=Ne(de[1].m.u)+"")&&X(P,C),de[4]?Le?Le.p(de,Ve):(Le=Su(de),Le.c(),Le.m(l,B)):Le&&(Le.d(1),Le=null),Ve&1&&K!==(K=Ne(de[0].last_month.u)+"")&&X(Z,K),de[4]?Je?Je.p(de,Ve):(Je=Tu(de),Je.c(),Je.m(l,null)):Je&&(Je.d(1),Je=null),Ve&32&&x!==(x="grid grid-cols-"+de[5]+" mb-3")&&a(l,"class",x),Ve&2&&Me!==(Me=Ne(de[1].h.p,2)+"")&&X(te,Me),de[4]?at?at.p(de,Ve):(at=Nu(de),at.c(),at.m(Y,Ie)):at&&(at.d(1),at=null),Ve&2&&D!==(D=Ne(de[1].d.p,1)+"")&&X(O,D),de[4]?qe?qe.p(de,Ve):(qe=Eu(de),qe.c(),qe.m(Y,pe)):qe&&(qe.d(1),qe=null),Ve&2&&ce!==(ce=Ne(de[1].m.p)+"")&&X(Pe,ce),de[4]?ye?ye.p(de,Ve):(ye=Pu(de),ye.c(),ye.m(Y,Ke)):ye&&(ye.d(1),ye=null),Ve&1&&Ue!==(Ue=Ne(de[0].last_month.p)+"")&&X(At,Ue),de[4]?ve?ve.p(de,Ve):(ve=Au(de),ve.c(),ve.m(Y,null)):ve&&(ve.d(1),ve=null),Ve&32&&xe!==(xe="grid grid-cols-"+de[5])&&a(Y,"class",xe)},d(de){de&&y(e),de&&y(n),de&&y(l),Re&&Re.d(),et&&et.d(),Le&&Le.d(),Je&&Je.d(),de&&y(_e),de&&y(ie),de&&y(me),de&&y(Y),at&&at.d(),qe&&qe.d(),ye&&ye.d(),ve&&ve.d()}}}function Cu(t){let e,n,l,i,o,u,m=Ne(t[1].h.c,2)+"",r,f,p,_,h,v,d,g=Ne(t[1].d.c,1)+"",k,$,N,A,F,I,R,C=Ne(t[1].m.c)+"",P,ne,j,B,H,V,G,K=Ne(t[0].last_month.c)+"",Z,z,W;return{c(){e=c("strong"),e.textContent="Cost",n=b(),l=c("div"),i=c("div"),i.textContent="Hour",o=b(),u=c("div"),r=E(m),f=b(),p=E(t[2]),_=b(),h=c("div"),h.textContent="Day",v=b(),d=c("div"),k=E(g),$=b(),N=E(t[2]),A=b(),F=c("div"),F.textContent="Month",I=b(),R=c("div"),P=E(C),ne=b(),j=E(t[2]),B=b(),H=c("div"),H.textContent="Last month",V=b(),G=c("div"),Z=E(K),z=b(),W=E(t[2]),a(u,"class","text-right"),a(d,"class","text-right"),a(R,"class","text-right"),a(G,"class","text-right"),a(l,"class","grid grid-cols-2")},m(x,_e){M(x,e,_e),M(x,n,_e),M(x,l,_e),s(l,i),s(l,o),s(l,u),s(u,r),s(u,f),s(u,p),s(l,_),s(l,h),s(l,v),s(l,d),s(d,k),s(d,$),s(d,N),s(l,A),s(l,F),s(l,I),s(l,R),s(R,P),s(R,ne),s(R,j),s(l,B),s(l,H),s(l,V),s(l,G),s(G,Z),s(G,z),s(G,W)},p(x,_e){_e&2&&m!==(m=Ne(x[1].h.c,2)+"")&&X(r,m),_e&4&&X(p,x[2]),_e&2&&g!==(g=Ne(x[1].d.c,1)+"")&&X(k,g),_e&4&&X(N,x[2]),_e&2&&C!==(C=Ne(x[1].m.c)+"")&&X(P,C),_e&4&&X(j,x[2]),_e&1&&K!==(K=Ne(x[0].last_month.c)+"")&&X(Z,K),_e&4&&X(W,x[2])},d(x){x&&y(e),x&&y(n),x&&y(l)}}}function yu(t){let e,n=Ne(t[1].h.c,2)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].h.c,2)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Mu(t){let e,n=Ne(t[1].d.c,1)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].d.c,1)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Su(t){let e,n=Ne(t[1].m.c)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].m.c)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Tu(t){let e,n=Ne(t[0].last_month.c)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&1&&n!==(n=Ne(u[0].last_month.c)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Nu(t){let e,n=Ne(t[1].h.i,2)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].h.i,2)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Eu(t){let e,n=Ne(t[1].d.i,1)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].d.i,1)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Pu(t){let e,n=Ne(t[1].m.i)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].m.i)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Au(t){let e,n=Ne(t[0].last_month.i)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&1&&n!==(n=Ne(u[0].last_month.i)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Hm(t){let e,n,l,i,o,u,m=t[1]&&wu(t);return{c(){e=c("div"),n=c("strong"),n.textContent="Real time calculation",l=b(),i=c("br"),o=c("br"),u=b(),m&&m.c(),a(e,"class","mx-2 text-sm")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),s(e,u),m&&m.m(e,null)},p(r,[f]){r[1]?m?m.p(r,f):(m=wu(r),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},i:be,o:be,d(r){r&&y(e),m&&m.d()}}}function Wm(t,e,n){let{sysinfo:l}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,m=!1,r=3;return t.$$set=f=>{"sysinfo"in f&&n(0,l=f.sysinfo),"data"in f&&n(1,i=f.data),"currency"in f&&n(2,o=f.currency),"hasExport"in f&&n(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(n(4,m=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),n(5,r=m?3:2))},[l,i,o,u,m,r]}class zm extends We{constructor(e){super(),He(this,e,Wm,Hm,Be,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Gm(t){let e,n,l=Wr(t[0].source)+"",i,o,u,m,r;return m=new pn({props:{config:t[1]}}),{c(){e=c("a"),n=E("Provided by: "),i=E(l),u=b(),ae(m.$$.fragment),a(e,"href",o=zr(t[0].source)),a(e,"target","_blank"),a(e,"class","text-xs float-right z-40")},m(f,p){M(f,e,p),s(e,n),s(e,i),M(f,u,p),se(m,f,p),r=!0},p(f,[p]){(!r||p&1)&&l!==(l=Wr(f[0].source)+"")&&X(i,l),(!r||p&1&&o!==(o=zr(f[0].source)))&&a(e,"href",o);const _={};p&2&&(_.config=f[1]),m.$set(_)},i(f){r||(L(m.$$.fragment,f),r=!0)},o(f){q(m.$$.fragment,f),r=!1},d(f){f&&y(e),f&&y(u),oe(m,f)}}}function Vm(t,e,n){let{json:l}=e,{sysinfo:i}=e,o={},u,m,r=document.documentElement.classList.contains("dark");return t.$$set=f=>{"json"in f&&n(0,l=f.json),"sysinfo"in f&&n(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let f=l.currency,p=new Date().getUTCHours(),_=0,h=0,v=0,d=[],g=[],k=[];n(4,m=n(3,u=0));let $=new Date;for(wl($,i.clock_offset-(24+$.getHours()-$.getUTCHours())%24),_=p;_<24&&(h=l[Ye(v++)],h!=null);_++)g.push({label:Ye($.getHours())}),k.push(h*100),n(4,m=Math.min(m,h*100)),n(3,u=Math.max(u,h*100)),wl($,1);for(_=0;_<24&&(h=l[Ye(v++)],h!=null);_++)g.push({label:Ye($.getHours())}),k.push(h*100),n(4,m=Math.min(m,h*100)),n(3,u=Math.max(u,h*100)),wl($,1);if(m>-100&&u<100){switch(f){case"NOK":case"DKK":f="\xF8re";break;case"SEK":f="\xF6re";break;case"EUR":f="cent";break;case"CHF":f="rp.";break;default:f=f+"/100"}for(n(4,m*=100),n(3,u*=100),_=0;_=0?R.toFixed(C):"",title:R>=0?R.toFixed(2)+" "+f:"",value:h>=0?Math.abs(h):0,label2:R<0?R.toFixed(C):"",title2:R<0?R.toFixed(2)+" "+f:"",value2:h<0?Math.abs(h):0,color:r?"#5c2da5":"#7c3aed"})}let A=Math.max(u,Math.abs(m));if(m<0){n(4,m=Math.min(A/4*-1,m));let R=Math.ceil(Math.abs(m)/A*4),C=m/R;for(_=1;_{"json"in f&&n(1,l=f.json),"sysinfo"in f&&n(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],h=[];n(4,m=n(3,u=0));let v=wl(new Date,-24),d=new Date().getUTCHours();for(wl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),f=d;f<24;f++){let N=l["i"+Ye(f)],A=l["e"+Ye(f)];N===void 0&&(N=0),A===void 0&&(A=0),_.push({label:Ye(v.getHours())}),h.push({label:N.toFixed(1),title:N.toFixed(2)+" kWh",value:N*10,label2:A.toFixed(1),title2:A.toFixed(2)+" kWh",value2:A*10,color:r?"#5c2da5":"#7c3aed",color2:r?"#27728e":"#37829e"}),n(4,m=Math.max(m,A*10)),n(3,u=Math.max(u,N*10)),wl(v,1)}for(f=0;f{"json"in f&&n(1,l=f.json),"sysinfo"in f&&n(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],h=[];n(4,m=n(3,u=0));let v=new Date,d=new Date;for(wl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),wl(d,i.clock_offset-(24+d.getHours()-d.getUTCHours())%24),d.setDate(0),f=v.getDate();f<=d.getDate();f++){let N=l["i"+Ye(f)],A=l["e"+Ye(f)];N===void 0&&(N=0),A===void 0&&(A=0),_.push({label:Ye(f)}),h.push({label:N.toFixed(N<10?1:0),title:N.toFixed(2)+" kWh",value:N,label2:A.toFixed(A<10?1:0),title2:A.toFixed(2)+" kWh",value2:A,color:r?"#5c2da5":"#7c3aed",color2:r?"#27728e":"#37829e"}),n(4,m=Math.max(m,A)),n(3,u=Math.max(u,N))}for(f=1;f{"json"in r&&n(1,l=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,f=0,p=[],_=[],h=[];l.s&&l.s.forEach((g,k)=>{var $=g.n?g.n:g.a;f=g.v,f==-127&&(f=0),_.push({label:$.slice(-4)}),h.push({label:f.toFixed(1),value:f,color:i?"#5c2da5":"#7c3aed"}),n(3,m=Math.min(m,f)),n(2,u=Math.max(u,f))}),n(2,u=Math.ceil(u)),n(3,m=Math.floor(m));let v=u;m<0&&(v+=Math.abs(m));let d=v/4;for(r=0;r<5;r++)f=m+d*r,p.push({value:f,label:f.toFixed(1)});n(0,o={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:m,max:u,ticks:p},x:{ticks:_},points:h})}},[o,l,u,m]}class l_ extends We{constructor(e){super(),He(this,e,t_,e_,Be,{json:1})}}function n_(t){let e,n;return e=new pn({props:{config:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,[i]){const o={};i&1&&(o.config=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}let i_=0;function s_(t,e,n){let l=document.documentElement.classList.contains("dark"),i={},o=0,u;return h0.subscribe(m=>{n(2,u=m)}),d0(),t.$$.update=()=>{if(t.$$.dirty&6){let m=0,r=[],f=[],p=[];if(r.push({value:0,label:0}),u&&u.p)for(m=0;m0?Ye(_.d)+"."+Ti[new Date().getMonth()]:"-"}),n(1,o=Math.max(o,_.v))}if(u&&u.t){for(m=0;m=o)break;r.push({value:_,label:_})}r.push({label:u.m.toFixed(1),align:"right",color:"green",value:u.m})}u&&u.c&&(r.push({label:u.c.toFixed(0),color:"orange",value:u.c}),n(1,o=Math.max(o,u.c))),n(1,o=Math.ceil(o)),n(0,i={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:i_,max:o,ticks:r},x:{ticks:f},points:p})}},[i,o,u]}class o_ extends We{constructor(e){super(),He(this,e,s_,n_,Be,{})}}function $u(t,e,n){const l=t.slice();return l[20]=e[n],l[22]=n,l}function Du(t,e,n){const l=t.slice();return l[23]=e[n],l}function Lu(t){let e,n,l,i,o,u=t[7],m=[];for(let p=0;pt[15].call(e))},m(f,p){M(f,e,p),s(e,n),s(n,l),s(n,i),s(n,o),s(e,u),r&&r.m(e,null),m=ko(e,t[15].bind(e))},p(f,[p]){p&1024&&X(i,f[10]),f[7]?r?r.p(f,p):(r=Lu(f),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},i:be,o:be,d(f){f&&y(e),r&&r.d(),m()}}}let r_=12;function u_(t,e,n){let l=document.documentElement.classList.contains("dark"),i;v0.subscribe(C=>{n(12,i=C)});let o,u=0,m=0;function r(){o&&clearTimeout(o),o=setTimeout(r,1e4),i.data.unshift(m),n(12,i.data=i.data.slice(0,i.size),i),u+=10}r0.subscribe(C=>{u==0&&(o&&clearTimeout(o),o=setTimeout(r,1e4)),m=C.i-C.e,u=C.u});let f,p,_,h,v,d,g,k,$,N,A,F,I;function R(){_=this.clientWidth,h=this.clientHeight,n(0,_),n(1,h)}return t.$$.update=()=>{if(t.$$.dirty&29183&&(n(2,v=parseInt(h)-50),n(3,d=_-35),n(9,F=d/i.size),n(14,p=0),n(13,f=0),i.data)){for(let P in i.data){let ne=i.data[P];n(13,f=Math.max(Math.ceil(ne/1e3)*1e3,f)),n(14,p=Math.min(Math.ceil(ne/1e3)*1e3,p))}n(10,I=f>2500?"kW":"W"),n(7,N=[]);for(let P=p;P2500?(P/1e3).toFixed(1):P});n(8,A=[]);for(let P=p;P900?I/1e3:I)+(I>900?"k":"")+i,title:I.toFixed(2)+" "+i,value:isNaN(I)?0:I,color:$(I?I/g*100:0,document.documentElement.classList.contains("dark")),label2:Ne(R>900?R/1e3:R)+(R>900?"k":"")+i,title2:R.toFixed(2)+" "+i,value2:isNaN(R)?0:R,color2:N(R?R/k*100:0)}}return t.$$set=I=>{"title"in I&&n(1,l=I.title),"unit"in I&&n(2,i=I.unit),"l1"in I&&n(3,o=I.l1),"l2"in I&&n(4,u=I.l2),"l2x"in I&&n(5,m=I.l2x),"l3"in I&&n(6,r=I.l3),"l1i"in I&&n(7,f=I.l1i),"l2i"in I&&n(8,p=I.l2i),"l3i"in I&&n(9,_=I.l3i),"l1e"in I&&n(10,h=I.l1e),"l2e"in I&&n(11,v=I.l2e),"l3e"in I&&n(12,d=I.l3e),"maxImport"in I&&n(13,g=I.maxImport),"maxExport"in I&&n(14,k=I.maxExport),"importColorFn"in I&&n(15,$=I.importColorFn),"exportColorFn"in I&&n(16,N=I.exportColorFn)},t.$$.update=()=>{if(t.$$.dirty&32762){let I=[],R=[];o&&(I.push({label:"L1"}),R.push(F(f,h))),u&&(m?(I.push({label:"L2"}),R.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(I.push({label:"L2"}),R.push(F(p,v)))),r&&(I.push({label:"L3"}),R.push(F(_,d)));let C=[];k&&(C.push({value:-k,label:"-100%"}),C.push({value:-k/4*3,label:"-75%"}),C.push({value:-k/2,label:"-50%"}),C.push({value:-k/4,label:"-25%"})),C.push({value:0,label:"0%"}),g&&(C.push({value:g/4,label:"25%"}),C.push({value:g/2,label:"50%"}),C.push({value:g/4*3,label:"75%"}),C.push({value:g,label:"100%"})),n(0,A={title:l,padding:{top:20,right:15,bottom:20,left:35},y:{min:-k,max:g,ticks:C},x:{ticks:I},points:R})}},[A,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N]}class $o extends We{constructor(e){super(),He(this,e,m_,c_,Be,{title:1,unit:2,l1:3,l2:4,l2x:5,l3:6,l1i:7,l2i:8,l3i:9,l1e:10,l2e:11,l3e:12,maxImport:13,maxExport:14,importColorFn:15,exportColorFn:16})}}function Bu(t){let e,n,l,i,o,u,m=(t[0].mt?Ss(t[0].mt):"-")+"",r,f,p,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",h,v,d;return i=new C0({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:So}}),{c(){e=c("div"),n=c("div"),l=c("div"),ae(i.$$.fragment),o=b(),u=c("div"),r=E(m),f=b(),p=c("div"),h=E(_),v=E(" kWh"),a(l,"class","col-span-2"),a(p,"class","text-right"),a(n,"class","grid grid-cols-2"),a(e,"class","cnt")},m(g,k){M(g,e,k),s(e,n),s(n,l),se(i,l,null),s(n,o),s(n,u),s(u,r),s(n,f),s(n,p),s(p,h),s(p,v),d=!0},p(g,k){const $={};k&1&&($.val=g[0].i?g[0].i:0),k&1&&($.max=g[0].im?g[0].im:15e3),k&1&&($.sub=g[0].p),k&1&&($.subunit=g[0].pc),i.$set($),(!d||k&1)&&m!==(m=(g[0].mt?Ss(g[0].mt):"-")+"")&&X(r,m),(!d||k&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&X(h,_)},i(g){d||(L(i.$$.fragment,g),d=!0)},o(g){q(i.$$.fragment,g),d=!1},d(g){g&&y(e),oe(i)}}}function Uu(t){let e,n,l,i,o,u,m,r,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",p,_,h;return i=new C0({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:Ni}}),{c(){e=c("div"),n=c("div"),l=c("div"),ae(i.$$.fragment),o=b(),u=c("div"),m=b(),r=c("div"),p=E(f),_=E(" kWh"),a(l,"class","col-span-2"),a(r,"class","text-right"),a(n,"class","grid grid-cols-2"),a(e,"class","cnt")},m(v,d){M(v,e,d),s(e,n),s(n,l),se(i,l,null),s(n,o),s(n,u),s(n,m),s(n,r),s(r,p),s(r,_),h=!0},p(v,d){const g={};d&1&&(g.val=v[0].e?v[0].e:0),d&1&&(g.max=v[0].om?v[0].om*1e3:1e4),i.$set(g),(!h||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&X(p,f)},i(v){h||(L(i.$$.fragment,v),h=!0)},o(v){q(i.$$.fragment,v),h=!1},d(v){v&&y(e),oe(i)}}}function ju(t){let e,n,l=t[0].l1&&Hu(t);return{c(){e=c("div"),l&&l.c(),a(e,"class","cnt")},m(i,o){M(i,e,o),l&&l.m(e,null),n=!0},p(i,o){i[0].l1?l?(l.p(i,o),o&1&&L(l,1)):(l=Hu(i),l.c(),L(l,1),l.m(e,null)):l&&($e(),q(l,1,1,()=>{l=null}),De())},i(i){n||(L(l),n=!0)},o(i){q(l),n=!1},d(i){i&&y(e),l&&l.d()}}}function Hu(t){let e,n;return e=new Fm({props:{u1:t[0].l1.u,u2:t[0].l2.u,u3:t[0].l3.u,ds:t[0].ds}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.u1=l[0].l1.u),i&1&&(o.u2=l[0].l2.u),i&1&&(o.u3=l[0].l3.u),i&1&&(o.ds=l[0].ds),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Wu(t){let e,n,l=t[0].l1&&zu(t);return{c(){e=c("div"),l&&l.c(),a(e,"class","cnt")},m(i,o){M(i,e,o),l&&l.m(e,null),n=!0},p(i,o){i[0].l1?l?(l.p(i,o),o&1&&L(l,1)):(l=zu(i),l.c(),L(l,1),l.m(e,null)):l&&($e(),q(l,1,1,()=>{l=null}),De())},i(i){n||(L(l),n=!0)},o(i){q(l),n=!1},d(i){i&&y(e),l&&l.d()}}}function zu(t){let e,n;return e=new $o({props:{title:"Amperage",unit:"A",importColorFn:So,exportColorFn:Ni,maxImport:t[0].mf,maxExport:t[0].om?t[0].om/230:0,l1:t[0].l1&&t[0].l1.u>100,l2:t[0].l2&&t[0].l2.u>100,l3:t[0].l3&&t[0].l3.u>100,l2x:t[0].i2e,l1i:Math.max(t[0].l1.i,0),l2i:Math.max(t[0].l2.i,0),l3i:Math.max(t[0].l3.i,0),l1e:Math.min(t[0].l1.i*-1,0),l2e:Math.min(t[0].l2.i*-1,0),l3e:Math.min(t[0].l3.i*-1,0)}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.maxImport=l[0].mf),i&1&&(o.maxExport=l[0].om?l[0].om/230:0),i&1&&(o.l1=l[0].l1&&l[0].l1.u>100),i&1&&(o.l2=l[0].l2&&l[0].l2.u>100),i&1&&(o.l3=l[0].l3&&l[0].l3.u>100),i&1&&(o.l2x=l[0].i2e),i&1&&(o.l1i=Math.max(l[0].l1.i,0)),i&1&&(o.l2i=Math.max(l[0].l2.i,0)),i&1&&(o.l3i=Math.max(l[0].l3.i,0)),i&1&&(o.l1e=Math.min(l[0].l1.i*-1,0)),i&1&&(o.l2e=Math.min(l[0].l2.i*-1,0)),i&1&&(o.l3e=Math.min(l[0].l3.i*-1,0)),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Gu(t){let e,n,l=t[0].l1&&Vu(t);return{c(){e=c("div"),l&&l.c(),a(e,"class","cnt")},m(i,o){M(i,e,o),l&&l.m(e,null),n=!0},p(i,o){i[0].l1?l?(l.p(i,o),o&1&&L(l,1)):(l=Vu(i),l.c(),L(l,1),l.m(e,null)):l&&($e(),q(l,1,1,()=>{l=null}),De())},i(i){n||(L(l),n=!0)},o(i){q(l),n=!1},d(i){i&&y(e),l&&l.d()}}}function Vu(t){let e,n;return e=new $o({props:{title:"Phase power",unit:"W",importColorFn:So,exportColorFn:Ni,maxImport:(t[0].mf?t[0].mf:32)*230,maxExport:t[0].om,l1:t[0].l1&&t[0].l1.u>100,l2:t[0].l2&&t[0].l2.u>100,l3:t[0].l3&&t[0].l3.u>100,l1i:t[0].l1.p,l1e:t[0].l1.q,l2i:t[0].l2.p,l2e:t[0].l2.q,l3i:t[0].l3.p,l3e:t[0].l3.q}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.maxImport=(l[0].mf?l[0].mf:32)*230),i&1&&(o.maxExport=l[0].om),i&1&&(o.l1=l[0].l1&&l[0].l1.u>100),i&1&&(o.l2=l[0].l2&&l[0].l2.u>100),i&1&&(o.l3=l[0].l3&&l[0].l3.u>100),i&1&&(o.l1i=l[0].l1.p),i&1&&(o.l1e=l[0].l1.q),i&1&&(o.l2i=l[0].l2.p),i&1&&(o.l2e=l[0].l2.q),i&1&&(o.l3i=l[0].l3.p),i&1&&(o.l3e=l[0].l3.q),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Ku(t){let e,n,l=t[0].l1&&Yu(t);return{c(){e=c("div"),l&&l.c(),a(e,"class","cnt")},m(i,o){M(i,e,o),l&&l.m(e,null),n=!0},p(i,o){i[0].l1?l?(l.p(i,o),o&1&&L(l,1)):(l=Yu(i),l.c(),L(l,1),l.m(e,null)):l&&($e(),q(l,1,1,()=>{l=null}),De())},i(i){n||(L(l),n=!0)},o(i){q(l),n=!1},d(i){i&&y(e),l&&l.d()}}}function Yu(t){let e,n;return e=new $o({props:{title:"Power factor",importColorFn:Ni,exportColorFn:Ni,maxImport:1,l1:t[0].l1&&t[0].l1.u>100,l2:t[0].l2&&t[0].l2.u>100,l3:t[0].l3&&t[0].l3.u>100,l1i:t[0].l1.f,l2i:t[0].l2.f,l3i:t[0].l3.f}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.l1=l[0].l1&&l[0].l1.u>100),i&1&&(o.l2=l[0].l2&&l[0].l2.u>100),i&1&&(o.l3=l[0].l3&&l[0].l3.u>100),i&1&&(o.l1i=l[0].l1.f),i&1&&(o.l2i=l[0].l2.f),i&1&&(o.l3i=l[0].l3.f),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Qu(t){let e,n,l;return n=new Bm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&1&&(u.importInstant=i[0].ri),o&1&&(u.exportInstant=i[0].re),o&1&&(u.importTotal=i[0].ric),o&1&&(u.exportTotal=i[0].rec),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function Xu(t){let e,n,l;return n=new zm({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function Zu(t){let e,n,l;return n=new o_({}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt h-64")},m(i,o){M(i,e,o),se(n,e,null),l=!0},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function Ju(t){let e,n,l;return n=new f_({}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function xu(t){let e,n,l;return n=new Km({props:{json:t[2],sysinfo:t[1]}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function ef(t){let e,n,l;return n=new Xm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function tf(t){let e,n,l;return n=new xm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function lf(t){let e,n,l;return n=new l_({props:{json:t[5]}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&32&&(u.json=i[5]),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function __(t){let e,n=tt(t[1].ui.i,t[0].i),l,i=tt(t[1].ui.e,t[0].om||t[0].e>0),o,u=tt(t[1].ui.v,t[0].l1&&(t[0].l1.u>100||t[0].l2.u>100||t[0].l3.u>100)),m,r=tt(t[1].ui.a,t[0].l1&&(t[0].l1.i>.01||t[0].l2.i>.01||t[0].l3.i>.01)),f,p=tt(t[1].ui.h,t[0].l1&&(t[0].l1.p>.01||t[0].l2.p>.01||t[0].l3.p>.01||t[0].l1.q>.01||t[0].l2.q>.01||t[0].l3.q>.01)),_,h=tt(t[1].ui.f,t[0].l1&&(t[0].l1.f>.01||t[0].l2.f>.01||t[0].l3.f>.01)),v,d=tt(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),g,k=tt(t[1].ui.c,t[0].ea),$,N=tt(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),A,F=tt(t[1].ui.l),I,R=tt(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),C,P=tt(t[1].ui.d,t[3]),ne,j=tt(t[1].ui.m,t[4]),B,H=tt(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),V,G=n&&Bu(t),K=i&&Uu(t),Z=u&&ju(t),z=r&&Wu(t),W=p&&Gu(t),x=h&&Ku(t),_e=d&&Qu(t),ie=k&&Xu(t),me=N&&Zu(),Y=F&&Ju(),ke=R&&xu(t),Ee=P&&ef(t),we=j&&tf(t),Me=H&&lf(t);return{c(){e=c("div"),G&&G.c(),l=b(),K&&K.c(),o=b(),Z&&Z.c(),m=b(),z&&z.c(),f=b(),W&&W.c(),_=b(),x&&x.c(),v=b(),_e&&_e.c(),g=b(),ie&&ie.c(),$=b(),me&&me.c(),A=b(),Y&&Y.c(),I=b(),ke&&ke.c(),C=b(),Ee&&Ee.c(),ne=b(),we&&we.c(),B=b(),Me&&Me.c(),a(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(te,fe){M(te,e,fe),G&&G.m(e,null),s(e,l),K&&K.m(e,null),s(e,o),Z&&Z.m(e,null),s(e,m),z&&z.m(e,null),s(e,f),W&&W.m(e,null),s(e,_),x&&x.m(e,null),s(e,v),_e&&_e.m(e,null),s(e,g),ie&&ie.m(e,null),s(e,$),me&&me.m(e,null),s(e,A),Y&&Y.m(e,null),s(e,I),ke&&ke.m(e,null),s(e,C),Ee&&Ee.m(e,null),s(e,ne),we&&we.m(e,null),s(e,B),Me&&Me.m(e,null),V=!0},p(te,[fe]){fe&3&&(n=tt(te[1].ui.i,te[0].i)),n?G?(G.p(te,fe),fe&3&&L(G,1)):(G=Bu(te),G.c(),L(G,1),G.m(e,l)):G&&($e(),q(G,1,1,()=>{G=null}),De()),fe&3&&(i=tt(te[1].ui.e,te[0].om||te[0].e>0)),i?K?(K.p(te,fe),fe&3&&L(K,1)):(K=Uu(te),K.c(),L(K,1),K.m(e,o)):K&&($e(),q(K,1,1,()=>{K=null}),De()),fe&3&&(u=tt(te[1].ui.v,te[0].l1&&(te[0].l1.u>100||te[0].l2.u>100||te[0].l3.u>100))),u?Z?(Z.p(te,fe),fe&3&&L(Z,1)):(Z=ju(te),Z.c(),L(Z,1),Z.m(e,m)):Z&&($e(),q(Z,1,1,()=>{Z=null}),De()),fe&3&&(r=tt(te[1].ui.a,te[0].l1&&(te[0].l1.i>.01||te[0].l2.i>.01||te[0].l3.i>.01))),r?z?(z.p(te,fe),fe&3&&L(z,1)):(z=Wu(te),z.c(),L(z,1),z.m(e,f)):z&&($e(),q(z,1,1,()=>{z=null}),De()),fe&3&&(p=tt(te[1].ui.h,te[0].l1&&(te[0].l1.p>.01||te[0].l2.p>.01||te[0].l3.p>.01||te[0].l1.q>.01||te[0].l2.q>.01||te[0].l3.q>.01))),p?W?(W.p(te,fe),fe&3&&L(W,1)):(W=Gu(te),W.c(),L(W,1),W.m(e,_)):W&&($e(),q(W,1,1,()=>{W=null}),De()),fe&3&&(h=tt(te[1].ui.f,te[0].l1&&(te[0].l1.f>.01||te[0].l2.f>.01||te[0].l3.f>.01))),h?x?(x.p(te,fe),fe&3&&L(x,1)):(x=Ku(te),x.c(),L(x,1),x.m(e,v)):x&&($e(),q(x,1,1,()=>{x=null}),De()),fe&3&&(d=tt(te[1].ui.r,te[0].ri>0||te[0].re>0||te[0].ric>0||te[0].rec>0)),d?_e?(_e.p(te,fe),fe&3&&L(_e,1)):(_e=Qu(te),_e.c(),L(_e,1),_e.m(e,g)):_e&&($e(),q(_e,1,1,()=>{_e=null}),De()),fe&3&&(k=tt(te[1].ui.c,te[0].ea)),k?ie?(ie.p(te,fe),fe&3&&L(ie,1)):(ie=Xu(te),ie.c(),L(ie,1),ie.m(e,$)):ie&&($e(),q(ie,1,1,()=>{ie=null}),De()),fe&3&&(N=tt(te[1].ui.t,te[0].pr&&(te[0].pr.startsWith("10YNO")||te[0].pr.startsWith("10Y1001A1001A4")))),N?me?fe&3&&L(me,1):(me=Zu(),me.c(),L(me,1),me.m(e,A)):me&&($e(),q(me,1,1,()=>{me=null}),De()),fe&2&&(F=tt(te[1].ui.l)),F?Y?fe&2&&L(Y,1):(Y=Ju(),Y.c(),L(Y,1),Y.m(e,I)):Y&&($e(),q(Y,1,1,()=>{Y=null}),De()),fe&3&&(R=tt(te[1].ui.p,te[0].pe&&!Number.isNaN(te[0].p))),R?ke?(ke.p(te,fe),fe&3&&L(ke,1)):(ke=xu(te),ke.c(),L(ke,1),ke.m(e,C)):ke&&($e(),q(ke,1,1,()=>{ke=null}),De()),fe&10&&(P=tt(te[1].ui.d,te[3])),P?Ee?(Ee.p(te,fe),fe&10&&L(Ee,1)):(Ee=ef(te),Ee.c(),L(Ee,1),Ee.m(e,ne)):Ee&&($e(),q(Ee,1,1,()=>{Ee=null}),De()),fe&18&&(j=tt(te[1].ui.m,te[4])),j?we?(we.p(te,fe),fe&18&&L(we,1)):(we=tf(te),we.c(),L(we,1),we.m(e,B)):we&&($e(),q(we,1,1,()=>{we=null}),De()),fe&35&&(H=tt(te[1].ui.s,te[0].t&&te[0].t!=-127&&te[5].c>1)),H?Me?(Me.p(te,fe),fe&35&&L(Me,1)):(Me=lf(te),Me.c(),L(Me,1),Me.m(e,null)):Me&&($e(),q(Me,1,1,()=>{Me=null}),De())},i(te){V||(L(G),L(K),L(Z),L(z),L(W),L(x),L(_e),L(ie),L(me),L(Y),L(ke),L(Ee),L(we),L(Me),V=!0)},o(te){q(G),q(K),q(Z),q(z),q(W),q(x),q(_e),q(ie),q(me),q(Y),q(ke),q(Ee),q(we),q(Me),V=!1},d(te){te&&y(e),G&&G.d(),K&&K.d(),Z&&Z.d(),z&&z.d(),W&&W.d(),x&&x.d(),_e&&_e.d(),ie&&ie.d(),me&&me.d(),Y&&Y.d(),ke&&ke.d(),Ee&&Ee.d(),we&&we.d(),Me&&Me.d()}}}function p_(t,e,n){let{data:l={}}=e,{sysinfo:i={}}=e,o={},u={},m={},r={};return No.subscribe(f=>{n(2,o=f)}),c0.subscribe(f=>{n(3,u=f)}),m0.subscribe(f=>{n(4,m=f)}),p0.subscribe(f=>{n(5,r=f)}),t.$$set=f=>{"data"in f&&n(0,l=f.data),"sysinfo"in f&&n(1,i=f.sysinfo)},[l,i,o,u,m,r]}class d_ extends We{constructor(e){super(),He(this,e,p_,__,Be,{data:0,sysinfo:1})}}let fo={};const wi=ht(fo);async function h_(){fo=await(await fetch("configuration.json")).json(),wi.set(fo)}let co={};const y0=ht(co);async function v_(){co=await(await fetch("priceconfig.json")).json(),y0.set(co)}function nf(t,e,n){const l=t.slice();return l[2]=e[n],l[4]=n,l}function b_(t){let e;return{c(){e=c("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function g_(t){let e;return{c(){e=c("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function sf(t){let e;return{c(){e=c("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function of(t){let e,n,l;return{c(){e=c("option"),e.textContent="UART1",n=b(),l=c("option"),l.textContent="UART2",e.__value=9,e.value=e.__value,l.__value=16,l.value=l.__value},m(i,o){M(i,e,o),M(i,n,o),M(i,l,o)},d(i){i&&y(e),i&&y(n),i&&y(l)}}}function af(t){let e;return{c(){e=c("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function rf(t){let e,n,l;return{c(){e=c("option"),n=E("GPIO"),l=E(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){M(i,e,o),s(e,n),s(e,l)},d(i){i&&y(e)}}}function uf(t){let e,n=t[4]>1&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!((t[0]=="esp32s2"||t[0]=="esp32s3")&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&rf(t);return{c(){n&&n.c(),e=it()},m(l,i){n&&n.m(l,i),M(l,e,i)},p(l,i){l[4]>1&&!(l[0]=="esp32"&&(l[4]==9||l[4]==16))&&!((l[0]=="esp32s2"||l[0]=="esp32s3")&&l[4]==18)&&!(l[0]=="esp8266"&&(l[4]==3||l[4]==113))?n||(n=rf(l),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(l){n&&n.d(l),l&&y(e)}}}function k_(t){let e,n,l,i,o;function u(d,g){return d[0]=="esp32c3"?g_:b_}let m=u(t),r=m(t),f=t[0]=="esp8266"&&sf(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&of(),_=(t[0]=="esp32s2"||t[0]=="esp32s3")&&af(),h={length:t[1]+1},v=[];for(let d=0;d{"chip"in o&&n(0,l=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(l){case"esp8266":n(1,i=16);break;case"esp32s2":n(1,i=44);break;case"esp32s3":n(1,i=46);break;case"esp32c3":n(1,i=19);break}},[l,i]}class mo extends We{constructor(e){super(),He(this,e,w_,k_,Be,{chip:0})}}function ff(t){let e,n,l=t[1]&&cf(t);return{c(){e=c("div"),n=c("div"),l&&l.c(),a(n,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),a(e,"class","z-50"),a(e,"aria-modal","true")},m(i,o){M(i,e,o),s(e,n),l&&l.m(n,null)},p(i,o){i[1]?l?l.p(i,o):(l=cf(i),l.c(),l.m(n,null)):l&&(l.d(1),l=null)},d(i){i&&y(e),l&&l.d()}}}function cf(t){let e,n;return{c(){e=c("div"),n=E(t[1]),a(e,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(l,i){M(l,e,i),s(e,n)},p(l,i){i&2&&X(n,l[1])},d(l){l&&y(e)}}}function C_(t){let e,n=t[0]&&ff(t);return{c(){n&&n.c(),e=it()},m(l,i){n&&n.m(l,i),M(l,e,i)},p(l,[i]){l[0]?n?n.p(l,i):(n=ff(l),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:be,o:be,d(l){n&&n.d(l),l&&y(e)}}}function y_(t,e,n){let{active:l}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&n(0,l=o.active),"message"in o&&n(1,i=o.message)},[l,i]}class Pt extends We{constructor(e){super(),He(this,e,y_,C_,Be,{active:0,message:1})}}function mf(t,e,n){const l=t.slice();return l[1]=e[n],l}function _f(t){let e,n,l=t[1]+"",i;return{c(){e=c("option"),n=E("Europe/"),i=E(l),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){M(o,e,u),s(e,n),s(e,i)},p:be,d(o){o&&y(e)}}}function M_(t){let e,n,l,i=t[0],o=[];for(let u=0;u>1&1,D=0;D0;w--)D[w]=D[w]?D[w-1]^I.EXPONENT[P._modN(I.LOG[D[w]]+T)]:D[w-1];D[0]=I.EXPONENT[P._modN(I.LOG[D[0]]+T)]}for(T=0;T<=S;T++)D[T]=I.LOG[D[T]]},_checkBadness:function(){var T,w,S,D,O,J=0,le=this._badness,pe=this.buffer,ge=this.width;for(O=0;Oge*ge;)ce-=ge*ge,Fe++;for(J+=Fe*P.N4,D=0;D=le-2&&(T=le-2,O>9&&T--);var pe=T;if(O>9){for(J[pe+2]=0,J[pe+3]=0;pe--;)w=J[pe],J[pe+3]|=255&w<<4,J[pe+2]=w>>4;J[2]|=255&T<<4,J[1]=T>>4,J[0]=64|T>>12}else{for(J[pe+1]=0,J[pe+2]=0;pe--;)w=J[pe],J[pe+2]|=255&w<<4,J[pe+1]=w>>4;J[1]|=255&T<<4,J[0]=64|T>>4}for(pe=T+3-(O<10);pe=5&&(S+=P.N1+D[w]-5);for(w=3;wT||D[w-3]*3>=D[w]*4||D[w+3]*3>=D[w]*4)&&(S+=P.N3);return S},_finish:function(){this._stringBuffer=this.buffer.slice();var T,w,S=0,D=3e4;for(w=0;w<8&&(this._applyMask(w),T=this._checkBadness(),T>=1)D&1&&(O[J-1-w+J*8]=1,w<6?O[8+J*w]=1:O[8+J*(w+1)]=1);for(w=0;w<7;w++,D>>=1)D&1&&(O[8+J*(J-7+w)]=1,w?O[6-w+J*8]=1:O[7+J*8]=1)},_interleaveBlocks:function(){var T,w,S=this._dataBlock,D=this._ecc,O=this._eccBlock,J=0,le=this._calculateMaxLength(),pe=this._neccBlock1,ge=this._neccBlock2,Ae=this._stringBuffer;for(T=0;T1)for(T=$.BLOCK[D],S=O-7;;){for(w=O-7;w>T-3&&(this._addAlignment(w,S),!(w6)for(T=C.BLOCK[J-7],w=17,S=0;S<6;S++)for(D=0;D<3;D++,w--)1&(w>11?J>>w-12:T>>w)?(O[5-S+le*(2-D+le-11)]=1,O[2-D+le-11+le*(5-S)]=1):(this._setMask(5-S,2-D+le-11),this._setMask(2-D+le-11,5-S))},_isMasked:function(T,w){var S=P._getMaskBit(T,w);return this._mask[S]===1},_pack:function(){var T,w,S,D=1,O=1,J=this.width,le=J-1,pe=J-1,ge=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(w=0;ww&&(S=T,T=w,w=S),S=w,S+=w*w,S>>=1,S+=T,S},_modN:function(T){for(;T>=255;)T-=255,T=(T>>8)+(T&255);return T},N1:3,N2:3,N3:40,N4:10}),ne=P,j=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var T=this.element;T.width=T.height=this.qrious.size}}),B=j,H=_.extend(function(T,w,S,D){this.name=T,this.modifiable=Boolean(w),this.defaultValue=S,this._valueTransformer=D},{transform:function(T){var w=this._valueTransformer;return typeof w=="function"?w(T,this):T}}),V=H,G=_.extend(null,{abs:function(T){return T!=null?Math.abs(T):null},hasOwn:function(T,w){return Object.prototype.hasOwnProperty.call(T,w)},noop:function(){},toUpperCase:function(T){return T!=null?T.toUpperCase():null}}),K=G,Z=_.extend(function(T){this.options={},T.forEach(function(w){this.options[w.name]=w},this)},{exists:function(T){return this.options[T]!=null},get:function(T,w){return Z._get(this.options[T],w)},getAll:function(T){var w,S=this.options,D={};for(w in S)K.hasOwn(S,w)&&(D[w]=Z._get(S[w],T));return D},init:function(T,w,S){typeof S!="function"&&(S=K.noop);var D,O;for(D in this.options)K.hasOwn(this.options,D)&&(O=this.options[D],Z._set(O,O.defaultValue,w),Z._createAccessor(O,w,S));this._setAll(T,w,!0)},set:function(T,w,S){return this._set(T,w,S)},setAll:function(T,w){return this._setAll(T,w)},_set:function(T,w,S,D){var O=this.options[T];if(!O)throw new Error("Invalid option: "+T);if(!O.modifiable&&!D)throw new Error("Option cannot be modified: "+T);return Z._set(O,w,S)},_setAll:function(T,w,S){if(!T)return!1;var D,O=!1;for(D in T)K.hasOwn(T,D)&&this._set(D,T[D],w,S)&&(O=!0);return O}},{_createAccessor:function(T,w,S){var D={get:function(){return Z._get(T,w)}};T.modifiable&&(D.set=function(O){Z._set(T,O,w)&&S(O,T)}),Object.defineProperty(w,T.name,D)},_get:function(T,w){return w["_"+T.name]},_set:function(T,w,S){var D="_"+T.name,O=S[D],J=T.transform(w!=null?w:T.defaultValue);return S[D]=J,J!==O}}),z=Z,W=_.extend(function(){this._services={}},{getService:function(T){var w=this._services[T];if(!w)throw new Error("Service is not being managed with name: "+T);return w},setService:function(T,w){if(this._services[T])throw new Error("Service is already managed with name: "+T);w&&(this._services[T]=w)}}),x=W,_e=new z([new V("background",!0,"white"),new V("backgroundAlpha",!0,1,K.abs),new V("element"),new V("foreground",!0,"black"),new V("foregroundAlpha",!0,1,K.abs),new V("level",!0,"L",K.toUpperCase),new V("mime",!0,"image/png"),new V("padding",!0,null,K.abs),new V("size",!0,100,K.abs),new V("value",!0,"")]),ie=new x,me=_.extend(function(T){_e.init(T,this,this.update.bind(this));var w=_e.get("element",this),S=ie.getService("element"),D=w&&S.isCanvas(w)?w:S.createCanvas(),O=w&&S.isImage(w)?w:S.createImage();this._canvasRenderer=new g(this,D,!0),this._imageRenderer=new B(this,O,O===w),this.update()},{get:function(){return _e.getAll(this)},set:function(T){_e.setAll(T,this)&&this.update()},toDataURL:function(T){return this.canvas.toDataURL(T||this.mime)},update:function(){var T=new ne({level:this.level,value:this.value});this._canvasRenderer.render(T),this._imageRenderer.render(T)}},{use:function(T){ie.setService(T.getName(),T)}});Object.defineProperties(me.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var Y=me,ke=Y,Ee=_.extend({getName:function(){}}),we=Ee,Me=we.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(T){},isImage:function(T){}}),te=Me,fe=te.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(T){return T instanceof HTMLCanvasElement},isImage:function(T){return T instanceof HTMLImageElement}}),Oe=fe;ke.use(new Oe);var Ie=ke;return Ie})})(S0);const A_=S0.exports;function $_(t){let e,n;return{c(){e=c("img"),ks(e.src,n=t[2])||a(e,"src",n),a(e,"alt",t[0]),a(e,"class",t[1])},m(l,i){M(l,e,i)},p(l,[i]){i&4&&!ks(e.src,n=l[2])&&a(e,"src",n),i&1&&a(e,"alt",l[0]),i&2&&a(e,"class",l[1])},i:be,o:be,d(l){l&&y(e)}}}function D_(t,e,n){const l=new A_;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:m="200"}=e,{value:r=""}=e,{padding:f=0}=e,{className:p="qrcode"}=e,_="";function h(){l.set({background:o,foreground:u,level:i,padding:f,size:m,value:r}),n(2,_=l.toDataURL("image/jpeg"))}return D1(()=>{h()}),t.$$set=v=>{"errorCorrection"in v&&n(3,i=v.errorCorrection),"background"in v&&n(4,o=v.background),"color"in v&&n(5,u=v.color),"size"in v&&n(6,m=v.size),"value"in v&&n(0,r=v.value),"padding"in v&&n(7,f=v.padding),"className"in v&&n(1,p=v.className)},t.$$.update=()=>{t.$$.dirty&1&&r&&h()},[r,p,_,i,o,u,m,f]}class L_ extends We{constructor(e){super(),He(this,e,D_,$_,Be,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function pf(t,e,n){const l=t.slice();return l[102]=e[n],l[103]=e,l[104]=n,l}function df(t,e,n){const l=t.slice();return l[105]=e[n],l[106]=e,l[107]=n,l}function I_(t,e,n){const l=t.slice();return l[108]=e[n],l}function R_(t,e,n){const l=t.slice();return l[111]=e[n],l}function F_(t){let e,n;return{c(){e=c("option"),n=E(t[111]),e.__value=t[111],e.value=e.__value},m(l,i){M(l,e,i),s(e,n)},p:be,d(l){l&&y(e)}}}function O_(t){let e;return{c(){e=E("Configure price")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function hf(t){let e,n,l,i;return{c(){e=c("br"),n=c("input"),a(n,"name","pt"),a(n,"type","text"),a(n,"class","in-s"),a(n,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){M(o,e,u),M(o,n,u),ue(n,t[3].p.t),l||(i=Q(n,"input",t[21]),l=!0)},p(o,u){u[0]&8&&n.value!==o[3].p.t&&ue(n,o[3].p.t)},d(o){o&&y(e),o&&y(n),l=!1,i()}}}function vf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v;return{c(){e=c("div"),n=E("Username"),l=c("br"),i=b(),o=c("input"),u=b(),m=c("div"),r=E("Password"),f=c("br"),p=b(),_=c("input"),a(o,"name","gu"),a(o,"type","text"),a(o,"class","in-s"),a(o,"maxlength","36"),a(e,"class","my-1"),a(_,"name","gp"),a(_,"type","password"),a(_,"class","in-s"),a(_,"maxlength","36"),a(m,"class","my-1")},m(d,g){M(d,e,g),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].g.u),M(d,u,g),M(d,m,g),s(m,r),s(m,f),s(m,p),s(m,_),ue(_,t[3].g.p),h||(v=[Q(o,"input",t[23]),Q(_,"input",t[24])],h=!0)},p(d,g){g[0]&8&&o.value!==d[3].g.u&&ue(o,d[3].g.u),g[0]&8&&_.value!==d[3].g.p&&ue(_,d[3].g.p)},d(d){d&&y(e),d&&y(u),d&&y(m),h=!1,lt(v)}}}function q_(t){let e,n=t[108]*100+"",l;return{c(){e=c("option"),l=E(n),e.__value=t[108]*100,e.value=e.__value},m(i,o){M(i,e,o),s(e,l)},p:be,d(i){i&&y(e)}}}function bf(t){let e,n,l,i;return{c(){e=c("br"),n=c("input"),a(n,"name","mek"),a(n,"type","text"),a(n,"class","in-s")},m(o,u){M(o,e,u),M(o,n,u),ue(n,t[3].m.e.k),l||(i=Q(n,"input",t[35]),l=!0)},p(o,u){u[0]&8&&n.value!==o[3].m.e.k&&ue(n,o[3].m.e.k)},d(o){o&&y(e),o&&y(n),l=!1,i()}}}function gf(t){let e,n,l,i,o,u,m;return{c(){e=c("div"),n=E("Authentication key"),l=c("br"),i=b(),o=c("input"),a(o,"name","mea"),a(o,"type","text"),a(o,"class","in-s"),a(e,"class","my-1")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].m.e.a),u||(m=Q(o,"input",t[36]),u=!0)},p(r,f){f[0]&8&&o.value!==r[3].m.e.a&&ue(o,r[3].m.e.a)},d(r){r&&y(e),u=!1,m()}}}function kf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j;return{c(){e=c("div"),n=c("div"),l=E("Watt"),i=c("br"),o=b(),u=c("input"),m=b(),r=c("div"),f=E("Volt"),p=c("br"),_=b(),h=c("input"),v=b(),d=c("div"),g=E("Amp"),k=c("br"),$=b(),N=c("input"),A=b(),F=c("div"),I=E("kWh"),R=c("br"),C=b(),P=c("input"),a(u,"name","mmw"),a(u,"type","number"),a(u,"min","0.00"),a(u,"max","1000"),a(u,"step","0.001"),a(u,"class","in-f tr w-full"),a(n,"class","w-1/4"),a(h,"name","mmv"),a(h,"type","number"),a(h,"min","0.00"),a(h,"max","1000"),a(h,"step","0.001"),a(h,"class","in-m tr w-full"),a(r,"class","w-1/4"),a(N,"name","mma"),a(N,"type","number"),a(N,"min","0.00"),a(N,"max","1000"),a(N,"step","0.001"),a(N,"class","in-m tr w-full"),a(d,"class","w-1/4"),a(P,"name","mmc"),a(P,"type","number"),a(P,"min","0.00"),a(P,"max","1000"),a(P,"step","0.001"),a(P,"class","in-l tr w-full"),a(F,"class","w-1/4"),a(e,"class","flex my-1")},m(B,H){M(B,e,H),s(e,n),s(n,l),s(n,i),s(n,o),s(n,u),ue(u,t[3].m.m.w),s(e,m),s(e,r),s(r,f),s(r,p),s(r,_),s(r,h),ue(h,t[3].m.m.v),s(e,v),s(e,d),s(d,g),s(d,k),s(d,$),s(d,N),ue(N,t[3].m.m.a),s(e,A),s(e,F),s(F,I),s(F,R),s(F,C),s(F,P),ue(P,t[3].m.m.c),ne||(j=[Q(u,"input",t[38]),Q(h,"input",t[39]),Q(N,"input",t[40]),Q(P,"input",t[41])],ne=!0)},p(B,H){H[0]&8&&Se(u.value)!==B[3].m.m.w&&ue(u,B[3].m.m.w),H[0]&8&&Se(h.value)!==B[3].m.m.v&&ue(h,B[3].m.m.v),H[0]&8&&Se(N.value)!==B[3].m.m.a&&ue(N,B[3].m.m.a),H[0]&8&&Se(P.value)!==B[3].m.m.c&&ue(P,B[3].m.m.c)},d(B){B&&y(e),ne=!1,lt(j)}}}function wf(t){let e;return{c(){e=c("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function Cf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K,Z,z,W,x,_e,ie,me;return{c(){e=c("div"),n=E("SSID"),l=c("br"),i=b(),o=c("input"),u=b(),m=c("div"),r=E("Password"),f=c("br"),p=b(),_=c("input"),h=b(),v=c("div"),d=c("div"),g=E("Power saving"),k=c("br"),$=b(),N=c("select"),A=c("option"),A.textContent="Default",F=c("option"),F.textContent="Off",I=c("option"),I.textContent="Minimum",R=c("option"),R.textContent="Maximum",C=b(),P=c("div"),ne=E("Power"),j=c("br"),B=b(),H=c("div"),V=c("input"),G=b(),K=c("span"),K.textContent="dBm",Z=b(),z=c("div"),W=c("label"),x=c("input"),_e=E(" Allow 802.11b legacy rates"),a(o,"name","ws"),a(o,"type","text"),a(o,"class","in-s"),a(e,"class","my-1"),a(_,"name","wp"),a(_,"type","password"),a(_,"class","in-s"),a(m,"class","my-1"),A.__value=255,A.value=A.__value,F.__value=0,F.value=F.__value,I.__value=1,I.value=I.__value,R.__value=2,R.value=R.__value,a(N,"name","wz"),a(N,"class","in-s"),t[3].w.z===void 0&&Ze(()=>t[45].call(N)),a(d,"class","w-1/2"),a(V,"name","ww"),a(V,"type","number"),a(V,"min","0"),a(V,"max","20.5"),a(V,"step","0.5"),a(V,"class","in-f tr w-full"),a(K,"class","in-post"),a(H,"class","flex"),a(P,"class","ml-2 w-1/2"),a(v,"class","my-1 flex"),a(x,"type","checkbox"),a(x,"name","wb"),x.__value="true",x.value=x.__value,a(x,"class","rounded mb-1"),a(z,"class","my-3")},m(Y,ke){M(Y,e,ke),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].w.s),M(Y,u,ke),M(Y,m,ke),s(m,r),s(m,f),s(m,p),s(m,_),ue(_,t[3].w.p),M(Y,h,ke),M(Y,v,ke),s(v,d),s(d,g),s(d,k),s(d,$),s(d,N),s(N,A),s(N,F),s(N,I),s(N,R),Te(N,t[3].w.z,!0),s(v,C),s(v,P),s(P,ne),s(P,j),s(P,B),s(P,H),s(H,V),ue(V,t[3].w.w),s(H,G),s(H,K),M(Y,Z,ke),M(Y,z,ke),s(z,W),s(W,x),x.checked=t[3].w.b,s(W,_e),ie||(me=[Q(o,"input",t[43]),Q(_,"input",t[44]),Q(N,"change",t[45]),Q(V,"input",t[46]),Q(x,"change",t[47])],ie=!0)},p(Y,ke){ke[0]&8&&o.value!==Y[3].w.s&&ue(o,Y[3].w.s),ke[0]&8&&_.value!==Y[3].w.p&&ue(_,Y[3].w.p),ke[0]&8&&Te(N,Y[3].w.z),ke[0]&8&&Se(V.value)!==Y[3].w.w&&ue(V,Y[3].w.w),ke[0]&8&&(x.checked=Y[3].w.b)},d(Y){Y&&y(e),Y&&y(u),Y&&y(m),Y&&y(h),Y&&y(v),Y&&y(Z),Y&&y(z),ie=!1,lt(me)}}}function yf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k;return{c(){e=c("div"),n=E("Gateway"),l=c("br"),i=b(),o=c("input"),u=b(),m=c("div"),r=E("DNS"),f=c("br"),p=b(),_=c("div"),h=c("input"),v=b(),d=c("input"),a(o,"name","ng"),a(o,"type","text"),a(o,"class","in-s"),a(e,"class","my-1"),a(h,"name","nd1"),a(h,"type","text"),a(h,"class","in-f w-full"),a(d,"name","nd2"),a(d,"type","text"),a(d,"class","in-l w-full"),a(_,"class","flex"),a(m,"class","my-1")},m($,N){M($,e,N),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].n.g),M($,u,N),M($,m,N),s(m,r),s(m,f),s(m,p),s(m,_),s(_,h),ue(h,t[3].n.d1),s(_,v),s(_,d),ue(d,t[3].n.d2),g||(k=[Q(o,"input",t[51]),Q(h,"input",t[52]),Q(d,"input",t[53])],g=!0)},p($,N){N[0]&8&&o.value!==$[3].n.g&&ue(o,$[3].n.g),N[0]&8&&h.value!==$[3].n.d1&&ue(h,$[3].n.d1),N[0]&8&&d.value!==$[3].n.d2&&ue(d,$[3].n.d2)},d($){$&&y(e),$&&y(u),$&&y(m),g=!1,lt(k)}}}function Mf(t){let e,n,l,i,o;return{c(){e=c("label"),n=c("input"),l=E(" SSL"),a(n,"type","checkbox"),a(n,"name","qs"),n.__value="true",n.value=n.__value,a(n,"class","rounded mb-1"),a(e,"class","float-right mr-3")},m(u,m){M(u,e,m),s(e,n),n.checked=t[3].q.s.e,s(e,l),i||(o=[Q(n,"change",t[57]),Q(n,"change",t[14])],i=!0)},p(u,m){m[0]&8&&(n.checked=u[3].q.s.e)},d(u){u&&y(e),i=!1,lt(o)}}}function Sf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v;const d=[U_,B_],g=[];function k(C,P){return C[3].q.s.c?0:1}l=k(t),i=g[l]=d[l](t);const $=[z_,W_],N=[];function A(C,P){return C[3].q.s.r?0:1}m=A(t),r=N[m]=$[m](t);const F=[Y_,K_],I=[];function R(C,P){return C[3].q.s.k?0:1}return _=R(t),h=I[_]=F[_](t),{c(){e=c("div"),n=c("span"),i.c(),o=b(),u=c("span"),r.c(),f=b(),p=c("span"),h.c(),a(n,"class","flex pr-2"),a(u,"class","flex pr-2"),a(p,"class","flex pr-2"),a(e,"class","my-1 flex")},m(C,P){M(C,e,P),s(e,n),g[l].m(n,null),s(e,o),s(e,u),N[m].m(u,null),s(e,f),s(e,p),I[_].m(p,null),v=!0},p(C,P){let ne=l;l=k(C),l===ne?g[l].p(C,P):($e(),q(g[ne],1,1,()=>{g[ne]=null}),De(),i=g[l],i?i.p(C,P):(i=g[l]=d[l](C),i.c()),L(i,1),i.m(n,null));let j=m;m=A(C),m===j?N[m].p(C,P):($e(),q(N[j],1,1,()=>{N[j]=null}),De(),r=N[m],r?r.p(C,P):(r=N[m]=$[m](C),r.c()),L(r,1),r.m(u,null));let B=_;_=R(C),_===B?I[_].p(C,P):($e(),q(I[B],1,1,()=>{I[B]=null}),De(),h=I[_],h?h.p(C,P):(h=I[_]=F[_](C),h.c()),L(h,1),h.m(p,null))},i(C){v||(L(i),L(r),L(h),v=!0)},o(C){q(i),q(r),q(h),v=!1},d(C){C&&y(e),g[l].d(),N[m].d(),I[_].d()}}}function B_(t){let e,n;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[j_]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i[3]&2097152&&(o.$$scope={dirty:i,ctx:l}),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function U_(t){let e,n,l,i,o,u,m,r;return n=new el({props:{to:"/mqtt-ca",$$slots:{default:[H_]},$$scope:{ctx:t}}}),o=new Es({}),{c(){e=c("span"),ae(n.$$.fragment),l=b(),i=c("span"),ae(o.$$.fragment),a(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),a(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(n,e,null),M(f,l,p),M(f,i,p),se(o,i,null),u=!0,m||(r=[Q(i,"click",t[11]),Q(i,"keypress",t[11])],m=!0)},p(f,p){const _={};p[3]&2097152&&(_.$$scope={dirty:p,ctx:f}),n.$set(_)},i(f){u||(L(n.$$.fragment,f),L(o.$$.fragment,f),u=!0)},o(f){q(n.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&y(e),oe(n),f&&y(l),f&&y(i),oe(o),m=!1,lt(r)}}}function j_(t){let e,n;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function H_(t){let e;return{c(){e=E("CA OK")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function W_(t){let e,n;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[G_]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i[3]&2097152&&(o.$$scope={dirty:i,ctx:l}),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function z_(t){let e,n,l,i,o,u,m,r;return n=new el({props:{to:"/mqtt-cert",$$slots:{default:[V_]},$$scope:{ctx:t}}}),o=new Es({}),{c(){e=c("span"),ae(n.$$.fragment),l=b(),i=c("span"),ae(o.$$.fragment),a(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),a(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(n,e,null),M(f,l,p),M(f,i,p),se(o,i,null),u=!0,m||(r=[Q(i,"click",t[12]),Q(i,"keypress",t[12])],m=!0)},p(f,p){const _={};p[3]&2097152&&(_.$$scope={dirty:p,ctx:f}),n.$set(_)},i(f){u||(L(n.$$.fragment,f),L(o.$$.fragment,f),u=!0)},o(f){q(n.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&y(e),oe(n),f&&y(l),f&&y(i),oe(o),m=!1,lt(r)}}}function G_(t){let e,n;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function V_(t){let e;return{c(){e=E("Cert OK")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function K_(t){let e,n;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[Q_]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i[3]&2097152&&(o.$$scope={dirty:i,ctx:l}),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Y_(t){let e,n,l,i,o,u,m,r;return n=new el({props:{to:"/mqtt-key",$$slots:{default:[X_]},$$scope:{ctx:t}}}),o=new Es({}),{c(){e=c("span"),ae(n.$$.fragment),l=b(),i=c("span"),ae(o.$$.fragment),a(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),a(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(n,e,null),M(f,l,p),M(f,i,p),se(o,i,null),u=!0,m||(r=[Q(i,"click",t[13]),Q(i,"keypress",t[13])],m=!0)},p(f,p){const _={};p[3]&2097152&&(_.$$scope={dirty:p,ctx:f}),n.$set(_)},i(f){u||(L(n.$$.fragment,f),L(o.$$.fragment,f),u=!0)},o(f){q(n.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&y(e),oe(n),f&&y(l),f&&y(i),oe(o),m=!1,lt(r)}}}function Q_(t){let e,n;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function X_(t){let e;return{c(){e=E("Key OK")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function Tf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K,Z;return o=new Ht({}),{c(){e=c("div"),n=c("strong"),n.textContent="Domoticz",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("input"),r=b(),f=c("div"),p=c("div"),_=E("Electricity IDX"),h=c("br"),v=b(),d=c("input"),g=b(),k=c("div"),$=E("Current IDX"),N=c("br"),A=b(),F=c("input"),I=b(),R=c("div"),C=E(`Voltage IDX: L1, L2 & L3 + `),P=c("div"),ne=c("input"),j=b(),B=c("input"),H=b(),V=c("input"),a(n,"class","text-sm"),a(i,"href",Wt("MQTT-configuration#domoticz")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"type","hidden"),a(m,"name","o"),m.value="true",a(d,"name","oe"),a(d,"type","text"),a(d,"class","in-f tr w-full"),a(p,"class","w-1/2"),a(F,"name","oc"),a(F,"type","text"),a(F,"class","in-l tr w-full"),a(k,"class","w-1/2"),a(f,"class","my-1 flex"),a(ne,"name","ou1"),a(ne,"type","text"),a(ne,"class","in-f tr w-1/3"),a(B,"name","ou2"),a(B,"type","text"),a(B,"class","in-m tr w-1/3"),a(V,"name","ou3"),a(V,"type","text"),a(V,"class","in-l tr w-1/3"),a(P,"class","flex"),a(R,"class","my-1"),a(e,"class","cnt")},m(z,W){M(z,e,W),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(p,_),s(p,h),s(p,v),s(p,d),ue(d,t[3].o.e),s(f,g),s(f,k),s(k,$),s(k,N),s(k,A),s(k,F),ue(F,t[3].o.c),s(e,I),s(e,R),s(R,C),s(R,P),s(P,ne),ue(ne,t[3].o.u1),s(P,j),s(P,B),ue(B,t[3].o.u2),s(P,H),s(P,V),ue(V,t[3].o.u3),G=!0,K||(Z=[Q(d,"input",t[65]),Q(F,"input",t[66]),Q(ne,"input",t[67]),Q(B,"input",t[68]),Q(V,"input",t[69])],K=!0)},p(z,W){W[0]&8&&d.value!==z[3].o.e&&ue(d,z[3].o.e),W[0]&8&&F.value!==z[3].o.c&&ue(F,z[3].o.c),W[0]&8&&ne.value!==z[3].o.u1&&ue(ne,z[3].o.u1),W[0]&8&&B.value!==z[3].o.u2&&ue(B,z[3].o.u2),W[0]&8&&V.value!==z[3].o.u3&&ue(V,z[3].o.u3)},i(z){G||(L(o.$$.fragment,z),G=!0)},o(z){q(o.$$.fragment,z),G=!1},d(z){z&&y(e),oe(o),K=!1,lt(Z)}}}function Nf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V;return o=new Ht({}),{c(){e=c("div"),n=c("strong"),n.textContent="Home-Assistant",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("input"),r=b(),f=c("div"),p=E("Discovery topic prefix"),_=c("br"),h=b(),v=c("input"),d=b(),g=c("div"),k=E("Hostname for URL"),$=c("br"),N=b(),A=c("input"),I=b(),R=c("div"),C=E("Name tag"),P=c("br"),ne=b(),j=c("input"),a(n,"class","text-sm"),a(i,"href",Wt("MQTT-configuration#home-assistant")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"type","hidden"),a(m,"name","h"),m.value="true",a(v,"name","ht"),a(v,"type","text"),a(v,"class","in-s"),a(v,"placeholder","homeassistant"),a(f,"class","my-1"),a(A,"name","hh"),a(A,"type","text"),a(A,"class","in-s"),a(A,"placeholder",F=t[3].g.h+".local"),a(g,"class","my-1"),a(j,"name","hn"),a(j,"type","text"),a(j,"class","in-s"),a(R,"class","my-1"),a(e,"class","cnt")},m(G,K){M(G,e,K),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(f,_),s(f,h),s(f,v),ue(v,t[3].h.t),s(e,d),s(e,g),s(g,k),s(g,$),s(g,N),s(g,A),ue(A,t[3].h.h),s(e,I),s(e,R),s(R,C),s(R,P),s(R,ne),s(R,j),ue(j,t[3].h.n),B=!0,H||(V=[Q(v,"input",t[70]),Q(A,"input",t[71]),Q(j,"input",t[72])],H=!0)},p(G,K){K[0]&8&&v.value!==G[3].h.t&&ue(v,G[3].h.t),(!B||K[0]&8&&F!==(F=G[3].g.h+".local"))&&a(A,"placeholder",F),K[0]&8&&A.value!==G[3].h.h&&ue(A,G[3].h.h),K[0]&8&&j.value!==G[3].h.n&&ue(j,G[3].h.n)},i(G){B||(L(o.$$.fragment,G),B=!0)},o(G){q(o.$$.fragment,G),B=!1},d(G){G&&y(e),oe(o),H=!1,lt(V)}}}function Ef(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I;o=new Ht({});let R=t[3].c.es&&Pf(t);return{c(){e=c("div"),n=c("strong"),n.textContent="Cloud connections",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("input"),r=b(),f=c("div"),p=c("label"),_=c("input"),h=E(" AMSreader cloud"),v=b(),d=c("div"),g=c("label"),k=c("input"),$=E(" Energy Speedometer"),N=b(),R&&R.c(),a(n,"class","text-sm"),a(i,"href",Wt("Cloud")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"type","hidden"),a(m,"name","c"),m.value="true",a(_,"type","checkbox"),a(_,"name","ce"),_.__value="true",_.value=_.__value,a(_,"class","rounded mb-1"),a(f,"class","my-1"),a(k,"type","checkbox"),a(k,"class","rounded mb-1"),a(k,"name","ces"),k.__value="true",k.value=k.__value,a(d,"class","my-1"),a(e,"class","cnt")},m(C,P){M(C,e,P),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(p,_),_.checked=t[3].c.e,s(p,h),s(e,v),s(e,d),s(d,g),s(g,k),k.checked=t[3].c.es,s(g,$),s(d,N),R&&R.m(d,null),A=!0,F||(I=[Q(_,"change",t[73]),Q(k,"change",t[74])],F=!0)},p(C,P){P[0]&8&&(_.checked=C[3].c.e),P[0]&8&&(k.checked=C[3].c.es),C[3].c.es?R?(R.p(C,P),P[0]&8&&L(R,1)):(R=Pf(C),R.c(),L(R,1),R.m(d,null)):R&&($e(),q(R,1,1,()=>{R=null}),De())},i(C){A||(L(o.$$.fragment,C),L(R),A=!0)},o(C){q(o.$$.fragment,C),q(R),A=!1},d(C){C&&y(e),oe(o),R&&R.d(),F=!1,lt(I)}}}function Pf(t){let e,n,l=t[0].mac+"",i,o,u,m,r=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,p,_,h,v=t[0].mac&&t[0].meter.id&&Af(t);return{c(){e=c("div"),n=E("MAC: "),i=E(l),o=b(),u=c("div"),m=E("Meter ID: "),f=E(r),p=b(),v&&v.c(),_=it(),a(e,"class","pl-5"),a(u,"class","pl-5")},m(d,g){M(d,e,g),s(e,n),s(e,i),M(d,o,g),M(d,u,g),s(u,m),s(u,f),M(d,p,g),v&&v.m(d,g),M(d,_,g),h=!0},p(d,g){(!h||g[0]&1)&&l!==(l=d[0].mac+"")&&X(i,l),(!h||g[0]&1)&&r!==(r=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&X(f,r),d[0].mac&&d[0].meter.id?v?(v.p(d,g),g[0]&1&&L(v,1)):(v=Af(d),v.c(),L(v,1),v.m(_.parentNode,_)):v&&($e(),q(v,1,1,()=>{v=null}),De())},i(d){h||(L(v),h=!0)},o(d){q(v),h=!1},d(d){d&&y(e),d&&y(o),d&&y(u),d&&y(p),v&&v.d(d),d&&y(_)}}}function Af(t){let e,n,l;return n=new L_({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","pl-2")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function $f(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A;o=new Ht({});let F={length:9},I=[];for(let R=0;R20&&Rf(t),_=t[3].i.d.d>0&&qf(t),h=t[0].chip=="esp8266"&&Bf(t);return{c(){e=c("div"),n=c("strong"),n.textContent="Hardware",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),p&&p.c(),m=b(),_&&_.c(),r=b(),h&&h.c(),a(n,"class","text-sm"),a(i,"href",Wt("GPIO-configuration")),a(i,"target","_blank"),a(i,"class","float-right"),a(e,"class","cnt")},m(v,d){M(v,e,d),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),p&&p.m(e,null),s(e,m),_&&_.m(e,null),s(e,r),h&&h.m(e,null),f=!0},p(v,d){v[0].board>20?p?(p.p(v,d),d[0]&1&&L(p,1)):(p=Rf(v),p.c(),L(p,1),p.m(e,m)):p&&($e(),q(p,1,1,()=>{p=null}),De()),v[3].i.d.d>0?_?_.p(v,d):(_=qf(v),_.c(),_.m(e,r)):_&&(_.d(1),_=null),v[0].chip=="esp8266"?h?h.p(v,d):(h=Bf(v),h.c(),h.m(e,null)):h&&(h.d(1),h=null)},i(v){f||(L(o.$$.fragment,v),L(p),f=!0)},o(v){q(o.$$.fragment,v),q(p),f=!1},d(v){v&&y(e),oe(o),p&&p.d(),_&&_.d(),h&&h.d()}}}function Rf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K,Z,z,W,x,_e,ie,me,Y,ke,Ee,we,Me,te,fe,Oe,Ie,T,w,S,D,O,J,le,pe,ge,Ae,Fe,ce,Pe,ze,_t,Ke,ut,Ge,pt,Ue,At,dt,vt,xe,Re,et,Le,Je,at;f=new mo({props:{chip:t[0].chip}}),k=new mo({props:{chip:t[0].chip}});let qe=t[0].chip!="esp8266"&&Ff(t),ye=t[3].i.v.p>0&&Of(t);return{c(){e=c("input"),n=b(),l=c("div"),i=c("div"),o=E("HAN RX"),u=c("br"),m=b(),r=c("select"),ae(f.$$.fragment),p=b(),_=c("div"),h=E("HAN TX"),v=c("br"),d=b(),g=c("select"),ae(k.$$.fragment),$=b(),N=c("div"),A=c("label"),F=c("input"),I=E(" pullup"),R=b(),C=c("div"),P=c("div"),ne=E("AP button"),j=c("br"),B=b(),H=c("input"),V=b(),G=c("div"),K=E("LED"),Z=c("br"),z=b(),W=c("div"),x=c("input"),_e=b(),ie=c("div"),me=c("label"),Y=c("input"),ke=E(" inverted"),Ee=b(),we=c("div"),Me=E("RGB"),te=c("label"),fe=c("input"),Oe=E(" inverted"),Ie=c("br"),T=b(),w=c("div"),S=c("input"),D=b(),O=c("input"),J=b(),le=c("input"),pe=b(),ge=c("div"),Ae=c("div"),Fe=E(`LED dis. GPIO + `),ce=c("input"),Pe=b(),ze=c("div"),_t=E("Temperature"),Ke=c("br"),ut=b(),Ge=c("input"),pt=b(),Ue=c("div"),At=E("Analog temp"),dt=c("br"),vt=b(),xe=c("input"),Re=b(),qe&&qe.c(),et=b(),ye&&ye.c(),a(e,"type","hidden"),a(e,"name","i"),e.value="true",a(r,"name","ihp"),a(r,"class","in-f w-full"),t[3].i.h.p===void 0&&Ze(()=>t[78].call(r)),a(i,"class","w-1/3"),a(g,"name","iht"),a(g,"class","in-l w-full"),t[3].i.h.t===void 0&&Ze(()=>t[79].call(g)),a(_,"class","w-1/3"),a(F,"name","ihu"),F.__value="true",F.value=F.__value,a(F,"type","checkbox"),a(F,"class","rounded mb-1"),a(A,"class","ml-2"),a(N,"class","w-1/3"),a(l,"class","flex flex-wrap"),a(H,"name","ia"),a(H,"type","number"),a(H,"min","0"),a(H,"max",t[6]),a(H,"class","in-f tr w-full"),a(P,"class","w-1/3"),a(x,"name","ilp"),a(x,"type","number"),a(x,"min","0"),a(x,"max",t[6]),a(x,"class","in-l tr w-full"),a(W,"class","flex"),a(G,"class","w-1/3"),a(Y,"name","ili"),Y.__value="true",Y.value=Y.__value,a(Y,"type","checkbox"),a(Y,"class","rounded mb-1"),a(me,"class","ml-4"),a(ie,"class","w-1/3"),a(fe,"name","iri"),fe.__value="true",fe.value=fe.__value,a(fe,"type","checkbox"),a(fe,"class","rounded mb-1"),a(te,"class","ml-4"),a(S,"name","irr"),a(S,"type","number"),a(S,"min","0"),a(S,"max",t[6]),a(S,"class","in-f tr w-1/3"),a(O,"name","irg"),a(O,"type","number"),a(O,"min","0"),a(O,"max",t[6]),a(O,"class","in-m tr w-1/3"),a(le,"name","irb"),a(le,"type","number"),a(le,"min","0"),a(le,"max",t[6]),a(le,"class","in-l tr w-1/3"),a(w,"class","flex"),a(we,"class","w-full"),a(ce,"name","idd"),a(ce,"type","number"),a(ce,"min","0"),a(ce,"max",t[6]),a(ce,"class","in-s tr"),a(Ae,"class","my-1 pr-1 w-1/3"),a(ge,"class","w-full"),a(Ge,"name","itd"),a(Ge,"type","number"),a(Ge,"min","0"),a(Ge,"max",t[6]),a(Ge,"class","in-f tr w-full"),a(ze,"class","my-1 w-1/3"),a(xe,"name","ita"),a(xe,"type","number"),a(xe,"min","0"),a(xe,"max",t[6]),a(xe,"class","in-l tr w-full"),a(Ue,"class","my-1 pr-1 w-1/3"),a(C,"class","flex flex-wrap")},m(ve,de){M(ve,e,de),M(ve,n,de),M(ve,l,de),s(l,i),s(i,o),s(i,u),s(i,m),s(i,r),se(f,r,null),Te(r,t[3].i.h.p,!0),s(l,p),s(l,_),s(_,h),s(_,v),s(_,d),s(_,g),se(k,g,null),Te(g,t[3].i.h.t,!0),s(l,$),s(l,N),s(N,A),s(A,F),F.checked=t[3].i.h.u,s(A,I),M(ve,R,de),M(ve,C,de),s(C,P),s(P,ne),s(P,j),s(P,B),s(P,H),ue(H,t[3].i.a),s(C,V),s(C,G),s(G,K),s(G,Z),s(G,z),s(G,W),s(W,x),ue(x,t[3].i.l.p),s(C,_e),s(C,ie),s(ie,me),s(me,Y),Y.checked=t[3].i.l.i,s(me,ke),s(C,Ee),s(C,we),s(we,Me),s(we,te),s(te,fe),fe.checked=t[3].i.r.i,s(te,Oe),s(we,Ie),s(we,T),s(we,w),s(w,S),ue(S,t[3].i.r.r),s(w,D),s(w,O),ue(O,t[3].i.r.g),s(w,J),s(w,le),ue(le,t[3].i.r.b),s(C,pe),s(C,ge),s(ge,Ae),s(Ae,Fe),s(Ae,ce),ue(ce,t[3].i.d.d),s(C,Pe),s(C,ze),s(ze,_t),s(ze,Ke),s(ze,ut),s(ze,Ge),ue(Ge,t[3].i.t.d),s(C,pt),s(C,Ue),s(Ue,At),s(Ue,dt),s(Ue,vt),s(Ue,xe),ue(xe,t[3].i.t.a),s(C,Re),qe&&qe.m(C,null),s(C,et),ye&&ye.m(C,null),Le=!0,Je||(at=[Q(r,"change",t[78]),Q(g,"change",t[79]),Q(F,"change",t[80]),Q(H,"input",t[81]),Q(x,"input",t[82]),Q(Y,"change",t[83]),Q(fe,"change",t[84]),Q(S,"input",t[85]),Q(O,"input",t[86]),Q(le,"input",t[87]),Q(ce,"input",t[88]),Q(Ge,"input",t[89]),Q(xe,"input",t[90])],Je=!0)},p(ve,de){const Ve={};de[0]&1&&(Ve.chip=ve[0].chip),f.$set(Ve),de[0]&8&&Te(r,ve[3].i.h.p);const re={};de[0]&1&&(re.chip=ve[0].chip),k.$set(re),de[0]&8&&Te(g,ve[3].i.h.t),de[0]&8&&(F.checked=ve[3].i.h.u),(!Le||de[0]&64)&&a(H,"max",ve[6]),de[0]&8&&Se(H.value)!==ve[3].i.a&&ue(H,ve[3].i.a),(!Le||de[0]&64)&&a(x,"max",ve[6]),de[0]&8&&Se(x.value)!==ve[3].i.l.p&&ue(x,ve[3].i.l.p),de[0]&8&&(Y.checked=ve[3].i.l.i),de[0]&8&&(fe.checked=ve[3].i.r.i),(!Le||de[0]&64)&&a(S,"max",ve[6]),de[0]&8&&Se(S.value)!==ve[3].i.r.r&&ue(S,ve[3].i.r.r),(!Le||de[0]&64)&&a(O,"max",ve[6]),de[0]&8&&Se(O.value)!==ve[3].i.r.g&&ue(O,ve[3].i.r.g),(!Le||de[0]&64)&&a(le,"max",ve[6]),de[0]&8&&Se(le.value)!==ve[3].i.r.b&&ue(le,ve[3].i.r.b),(!Le||de[0]&64)&&a(ce,"max",ve[6]),de[0]&8&&Se(ce.value)!==ve[3].i.d.d&&ue(ce,ve[3].i.d.d),(!Le||de[0]&64)&&a(Ge,"max",ve[6]),de[0]&8&&Se(Ge.value)!==ve[3].i.t.d&&ue(Ge,ve[3].i.t.d),(!Le||de[0]&64)&&a(xe,"max",ve[6]),de[0]&8&&Se(xe.value)!==ve[3].i.t.a&&ue(xe,ve[3].i.t.a),ve[0].chip!="esp8266"?qe?qe.p(ve,de):(qe=Ff(ve),qe.c(),qe.m(C,et)):qe&&(qe.d(1),qe=null),ve[3].i.v.p>0?ye?ye.p(ve,de):(ye=Of(ve),ye.c(),ye.m(C,null)):ye&&(ye.d(1),ye=null)},i(ve){Le||(L(f.$$.fragment,ve),L(k.$$.fragment,ve),Le=!0)},o(ve){q(f.$$.fragment,ve),q(k.$$.fragment,ve),Le=!1},d(ve){ve&&y(e),ve&&y(n),ve&&y(l),oe(f),oe(k),ve&&y(R),ve&&y(C),qe&&qe.d(),ye&&ye.d(),Je=!1,lt(at)}}}function Ff(t){let e,n,l,i,o,u,m;return{c(){e=c("div"),n=E("Vcc"),l=c("br"),i=b(),o=c("input"),a(o,"name","ivp"),a(o,"type","number"),a(o,"min","0"),a(o,"max",t[6]),a(o,"class","in-s tr w-full"),a(e,"class","my-1 pl-1 w-1/3")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].i.v.p),u||(m=Q(o,"input",t[91]),u=!0)},p(r,f){f[0]&64&&a(o,"max",r[6]),f[0]&8&&Se(o.value)!==r[3].i.v.p&&ue(o,r[3].i.v.p)},d(r){r&&y(e),u=!1,m()}}}function Of(t){let e,n,l,i,o,u,m,r,f,p;return{c(){e=c("div"),n=E("Voltage divider"),l=c("br"),i=b(),o=c("div"),u=c("input"),m=b(),r=c("input"),a(u,"name","ivdv"),a(u,"type","number"),a(u,"min","0"),a(u,"max","65535"),a(u,"class","in-f tr w-full"),a(u,"placeholder","VCC"),a(r,"name","ivdg"),a(r,"type","number"),a(r,"min","0"),a(r,"max","65535"),a(r,"class","in-l tr w-full"),a(r,"placeholder","GND"),a(o,"class","flex"),a(e,"class","my-1")},m(_,h){M(_,e,h),s(e,n),s(e,l),s(e,i),s(e,o),s(o,u),ue(u,t[3].i.v.d.v),s(o,m),s(o,r),ue(r,t[3].i.v.d.g),f||(p=[Q(u,"input",t[92]),Q(r,"input",t[93])],f=!0)},p(_,h){h[0]&8&&Se(u.value)!==_[3].i.v.d.v&&ue(u,_[3].i.v.d.v),h[0]&8&&Se(r.value)!==_[3].i.v.d.g&&ue(r,_[3].i.v.d.g)},d(_){_&&y(e),f=!1,lt(p)}}}function qf(t){let e,n,l,i,o,u,m;return{c(){e=c("div"),n=E(`LED behaviour + `),l=c("select"),i=c("option"),i.textContent="Enabled",o=c("option"),o.textContent="Disabled",i.__value=0,i.value=i.__value,o.__value=1,o.value=o.__value,a(l,"name","idb"),a(l,"class","in-s"),t[3].i.d.b===void 0&&Ze(()=>t[94].call(l)),a(e,"class","my-1 w-full")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(l,i),s(l,o),Te(l,t[3].i.d.b,!0),u||(m=Q(l,"change",t[94]),u=!0)},p(r,f){f[0]&8&&Te(l,r[3].i.d.b)},d(r){r&&y(e),u=!1,m()}}}function Bf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N=(t[0].board==2||t[0].board==100)&&Uf(t);return{c(){e=c("input"),n=b(),l=c("div"),i=c("div"),o=E("Vcc offset"),u=c("br"),m=b(),r=c("input"),f=b(),p=c("div"),_=E("Multiplier"),h=c("br"),v=b(),d=c("input"),g=b(),N&&N.c(),a(e,"type","hidden"),a(e,"name","iv"),e.value="true",a(r,"name","ivo"),a(r,"type","number"),a(r,"min","0.0"),a(r,"max","3.5"),a(r,"step","0.01"),a(r,"class","in-f tr w-full"),a(i,"class","w-1/3"),a(d,"name","ivm"),a(d,"type","number"),a(d,"min","0.1"),a(d,"max","10"),a(d,"step","0.01"),a(d,"class","in-l tr w-full"),a(p,"class","w-1/3 pr-1"),a(l,"class","my-1 flex flex-wrap")},m(A,F){M(A,e,F),M(A,n,F),M(A,l,F),s(l,i),s(i,o),s(i,u),s(i,m),s(i,r),ue(r,t[3].i.v.o),s(l,f),s(l,p),s(p,_),s(p,h),s(p,v),s(p,d),ue(d,t[3].i.v.m),s(l,g),N&&N.m(l,null),k||($=[Q(r,"input",t[95]),Q(d,"input",t[96])],k=!0)},p(A,F){F[0]&8&&Se(r.value)!==A[3].i.v.o&&ue(r,A[3].i.v.o),F[0]&8&&Se(d.value)!==A[3].i.v.m&&ue(d,A[3].i.v.m),A[0].board==2||A[0].board==100?N?N.p(A,F):(N=Uf(A),N.c(),N.m(l,null)):N&&(N.d(1),N=null)},d(A){A&&y(e),A&&y(n),A&&y(l),N&&N.d(),k=!1,lt($)}}}function Uf(t){let e,n,l,i,o,u,m;return{c(){e=c("div"),n=E("Boot limit"),l=c("br"),i=b(),o=c("input"),a(o,"name","ivb"),a(o,"type","number"),a(o,"min","2.5"),a(o,"max","3.5"),a(o,"step","0.1"),a(o,"class","in-s tr w-full"),a(e,"class","w-1/3 pl-1")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].i.v.b),u||(m=Q(o,"input",t[97]),u=!0)},p(r,f){f[0]&8&&Se(o.value)!==r[3].i.v.b&&ue(o,r[3].i.v.b)},d(r){r&&y(e),u=!1,m()}}}function jf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$=t[3].d.t&&Hf();return{c(){e=c("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",n=b(),l=c("div"),i=c("label"),o=c("input"),u=E(" Enable telnet"),m=b(),$&&$.c(),r=b(),f=c("div"),p=c("select"),_=c("option"),_.textContent="Verbose",h=c("option"),h.textContent="Debug",v=c("option"),v.textContent="Info",d=c("option"),d.textContent="Warning",a(e,"class","bd-red"),a(o,"type","checkbox"),a(o,"name","dt"),o.__value="true",o.value=o.__value,a(o,"class","rounded mb-1"),a(l,"class","my-1"),_.__value=1,_.value=_.__value,h.__value=2,h.value=h.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,a(p,"name","dl"),a(p,"class","in-s"),t[3].d.l===void 0&&Ze(()=>t[100].call(p)),a(f,"class","my-1")},m(N,A){M(N,e,A),M(N,n,A),M(N,l,A),s(l,i),s(i,o),o.checked=t[3].d.t,s(i,u),M(N,m,A),$&&$.m(N,A),M(N,r,A),M(N,f,A),s(f,p),s(p,_),s(p,h),s(p,v),s(p,d),Te(p,t[3].d.l,!0),g||(k=[Q(o,"change",t[99]),Q(p,"change",t[100])],g=!0)},p(N,A){A[0]&8&&(o.checked=N[3].d.t),N[3].d.t?$||($=Hf(),$.c(),$.m(r.parentNode,r)):$&&($.d(1),$=null),A[0]&8&&Te(p,N[3].d.l)},d(N){N&&y(e),N&&y(n),N&&y(l),N&&y(m),$&&$.d(N),N&&y(r),N&&y(f),g=!1,lt(k)}}}function Hf(t){let e;return{c(){e=c("div"),e.textContent="Telnet is unsafe and should be off when not in use",a(e,"class","bd-red")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function Z_(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K,Z,z,W,x,_e,ie,me,Y,ke,Ee,we,Me,te,fe,Oe,Ie,T,w,S,D,O,J,le,pe,ge,Ae,Fe,ce,Pe,ze,_t,Ke,ut,Ge,pt,Ue,At,dt,vt,xe,Re,et,Le,Je,at,qe,ye,ve,de,Ve,re,Qe,ee,st,Li,ri,yl,Ii,Ri,Fi,$t,Oi,Xe,dn,qi,Ll,Il,Bi,zl,Ui,Gl,ji,Ml,nt,rt,Vl,tl,ml,ft,Hi,Xt,Wi,Lo,Ps,Io,ui,ll,Ro,Fo,Rl,_l,Fl,Oo,zi,qo,Nt,Ol,Bo,Gi,hn,vn,bn,gn,Vi,Uo,zt,Ki,jo,Kl,Ho,Wo,zo,pl,kn,wn,Go,Cn,Yl,Vo,Ko,Yo,yn,nl,Qo,Yi,Xo,Ql,Zo,Jo,xo,Mn,il,ea,Qi,ta,As,la,Xl,Xi,sl,na,ia,sa,$s,Zi,ol,oa,aa,ra,Gt,Ji,ua,Sn,Tn,fa,fi,ca,Zl,ma,_a,pa,Zt,Nn,En,da,ha,Mt,xi,va,Pn,An,ba,Jl,ga,ka,wa,ql,dl,$n,Dn,Ca,Vt,es,ts,ya,Kt,Ln,ls,ns,Ma,Ds,is,ss,al,Sa,Ta,ci,Na,Bl,Ea,mi,rl,Pa,Aa,$a,os,Sl,Da,ct,as,La,In,Rn,Ia,_i,Ra,hl,Fa,Ls,Oa,qa,Fn,Tl,Ba,ul,Ua,Is,xl,ja,Ha,Wa,Nl,za,en,Ga,Va,Ka,El,Ya,On,qn,Qa,Xa,Za,Pl,Ja,Bn,xa,er,tr,Dt,Un,jn,Hn,Wn,zn,Gn,lr,tn,nr,ir,sr,Al,or,Rs,Fs,Os,qs=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),Bs,vl,rs,ar,Vn,Kn,rr,pi,ur,di,fr,Us,Yt,us,cr,Yn,Qn,mr,hi,_r,fs,cs,fl,pr,dr,hr,Ul,js,Xn,vr,ms,Zn,br,_s,Hs,ln,Ws,nn,zs,sn,Gs,on,Jt,Vs,gr;m=new Ht({}),P=new T_({});let T0=["NOK","SEK","DKK","EUR","CHF"],vi=[];for(let U=0;U<5;U+=1)vi[U]=F_(R_(t,T0,U));vt=new el({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[O_]},$$scope:{ctx:t}}});let Lt=t[3].p.e&&t[0].chip!="esp8266"&&hf(t),It=t[3].g.s>0&&vf(t);Il=new Ht({});let N0=[24,48,96,192,384,576,1152],bi=[];for(let U=0;U<7;U+=1)bi[U]=q_(I_(t,N0,U));let Rt=t[3].m.e.e&&bf(t),Ft=t[3].m.e.e&&gf(t),Ot=t[3].m.m.e&&kf(t);Tn=new Ht({});let Qt=t[0].if&&t[0].if.eth&&wf(),qt=(t[3].n.c==1||t[3].n.c==2)&&Cf(t);An=new Ht({}),Ln=new M0({});let Bt=t[3].n.m=="static"&&yf(t);Rn=new Ht({});let Ut=t[0].chip!="esp8266"&&Mf(t),bt=t[3].q.s.e&&Sf(t),gt=t[3].q.m==3&&Tf(t),kt=t[3].q.m==4&&Nf(t),wt=t[3].c.es!=null&&Ef(t),Ct=qs&&$f(t);Kn=new Ht({});let Jn=t[7],Et=[];for(let U=0;U20||t[0].chip=="esp8266"||t[3].i.d.d>0)&&If(t);Qn=new Ht({});let jt=t[3].d.s&&jf(t);return ln=new Pt({props:{active:t[1],message:"Loading configuration"}}),nn=new Pt({props:{active:t[2],message:"Saving configuration"}}),sn=new Pt({props:{active:t[4],message:"Performing factory reset"}}),on=new Pt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=c("form"),n=c("div"),l=c("div"),i=c("strong"),i.textContent="General",o=b(),u=c("a"),ae(m.$$.fragment),r=b(),f=c("input"),p=b(),_=c("div"),h=c("div"),v=c("div"),d=E("Hostname"),g=c("br"),k=b(),$=c("input"),N=b(),A=c("div"),F=E("Time zone"),I=c("br"),R=b(),C=c("select"),ae(P.$$.fragment),ne=b(),j=c("input"),B=b(),H=c("div"),V=c("div"),G=c("div"),K=E("Price region"),Z=c("br"),z=b(),W=c("select"),x=c("optgroup"),_e=c("option"),_e.textContent="NO1",ie=c("option"),ie.textContent="NO2",me=c("option"),me.textContent="NO3",Y=c("option"),Y.textContent="NO4",ke=c("option"),ke.textContent="NO5",Ee=c("optgroup"),we=c("option"),we.textContent="SE1",Me=c("option"),Me.textContent="SE2",te=c("option"),te.textContent="SE3",fe=c("option"),fe.textContent="SE4",Oe=c("optgroup"),Ie=c("option"),Ie.textContent="DK1",T=c("option"),T.textContent="DK2",w=c("option"),w.textContent="Austria",S=c("option"),S.textContent="Belgium",D=c("option"),D.textContent="Czech Republic",O=c("option"),O.textContent="Estonia",J=c("option"),J.textContent="Finland",le=c("option"),le.textContent="France",pe=c("option"),pe.textContent="Germany",ge=c("option"),ge.textContent="Great Britain",Ae=c("option"),Ae.textContent="Latvia",Fe=c("option"),Fe.textContent="Lithuania",ce=c("option"),ce.textContent="Netherland",Pe=c("option"),Pe.textContent="Poland",ze=c("option"),ze.textContent="Switzerland",_t=b(),Ke=c("div"),ut=E("Currency"),Ge=c("br"),pt=b(),Ue=c("select");for(let U=0;U<5;U+=1)vi[U].c();At=b(),dt=c("div"),ae(vt.$$.fragment),xe=b(),Re=c("div"),et=c("label"),Le=c("input"),Je=E(" Enable price fetch from remote server"),at=b(),Lt&&Lt.c(),qe=b(),ye=c("div"),ve=E("Security"),de=c("br"),Ve=b(),re=c("select"),Qe=c("option"),Qe.textContent="None",ee=c("option"),ee.textContent="Only configuration",st=c("option"),st.textContent="Everything",Li=b(),It&&It.c(),ri=b(),yl=c("div"),Ii=E("Context"),Ri=c("br"),Fi=b(),$t=c("input"),Oi=b(),Xe=c("div"),dn=c("strong"),dn.textContent="Meter",qi=b(),Ll=c("a"),ae(Il.$$.fragment),Bi=b(),zl=c("input"),Ui=b(),Gl=c("input"),ji=b(),Ml=c("div"),nt=E("Communication"),rt=c("br"),Vl=b(),tl=c("select"),ml=c("option"),ml.textContent="Passive (Push)",ft=c("option"),ft.textContent="Kamstrup (Pull)",Hi=b(),Xt=c("div"),Wi=c("span"),Wi.textContent="Buffer size",Lo=b(),Ps=c("span"),Ps.textContent="Serial conf.",Io=b(),ui=c("label"),ll=c("input"),Ro=E(" inverted"),Fo=b(),Rl=c("div"),_l=c("select"),Fl=c("option"),Oo=E("Autodetect");for(let U=0;U<7;U+=1)bi[U].c();qo=b(),Nt=c("select"),Ol=c("option"),Bo=E("-"),hn=c("option"),hn.textContent="7N1",vn=c("option"),vn.textContent="8N1",bn=c("option"),bn.textContent="7E1",gn=c("option"),gn.textContent="8E1",Uo=b(),zt=c("input"),jo=b(),Kl=c("div"),Ho=E("Voltage"),Wo=c("br"),zo=b(),pl=c("select"),kn=c("option"),kn.textContent="400V (TN)",wn=c("option"),wn.textContent="230V (IT/TT)",Go=b(),Cn=c("div"),Yl=c("div"),Vo=E("Main fuse"),Ko=c("br"),Yo=b(),yn=c("label"),nl=c("input"),Qo=b(),Yi=c("span"),Yi.textContent="A",Xo=b(),Ql=c("div"),Zo=E("Production"),Jo=c("br"),xo=b(),Mn=c("label"),il=c("input"),ea=b(),Qi=c("span"),Qi.textContent="kWp",ta=b(),As=c("div"),la=b(),Xl=c("div"),Xi=c("label"),sl=c("input"),na=E(" Meter is encrypted"),ia=b(),Rt&&Rt.c(),sa=b(),Ft&&Ft.c(),$s=b(),Zi=c("label"),ol=c("input"),oa=E(" Multipliers"),aa=b(),Ot&&Ot.c(),ra=b(),Gt=c("div"),Ji=c("strong"),Ji.textContent="Connection",ua=b(),Sn=c("a"),ae(Tn.$$.fragment),fa=b(),fi=c("input"),ca=b(),Zl=c("div"),ma=E("Connection"),_a=c("br"),pa=b(),Zt=c("select"),Nn=c("option"),Nn.textContent="WiFi",En=c("option"),En.textContent="Access point",Qt&&Qt.c(),da=b(),qt&&qt.c(),ha=b(),Mt=c("div"),xi=c("strong"),xi.textContent="Network",va=b(),Pn=c("a"),ae(An.$$.fragment),ba=b(),Jl=c("div"),ga=E("IP"),ka=c("br"),wa=b(),ql=c("div"),dl=c("select"),$n=c("option"),$n.textContent="DHCP",Dn=c("option"),Dn.textContent="Static",Ca=b(),Vt=c("input"),ya=b(),Kt=c("select"),ae(Ln.$$.fragment),Ma=b(),Bt&&Bt.c(),Ds=b(),is=c("div"),ss=c("label"),al=c("input"),Sa=E(" enable mDNS"),Ta=b(),ci=c("input"),Na=b(),Bl=c("div"),Ea=E("NTP "),mi=c("label"),rl=c("input"),Pa=E(" obtain from DHCP"),Aa=c("br"),$a=b(),os=c("div"),Sl=c("input"),Da=b(),ct=c("div"),as=c("strong"),as.textContent="MQTT",La=b(),In=c("a"),ae(Rn.$$.fragment),Ia=b(),_i=c("input"),Ra=b(),hl=c("div"),Fa=E(`Server + `),Ut&&Ut.c(),Ls=b(),Oa=c("br"),qa=b(),Fn=c("div"),Tl=c("input"),Ba=b(),ul=c("input"),Ua=b(),bt&&bt.c(),Is=b(),xl=c("div"),ja=E("Username"),Ha=c("br"),Wa=b(),Nl=c("input"),za=b(),en=c("div"),Ga=E("Password"),Va=c("br"),Ka=b(),El=c("input"),Ya=b(),On=c("div"),qn=c("div"),Qa=E("Client ID"),Xa=c("br"),Za=b(),Pl=c("input"),Ja=b(),Bn=c("div"),xa=E("Payload"),er=c("br"),tr=b(),Dt=c("select"),Un=c("option"),Un.textContent="JSON",jn=c("option"),jn.textContent="Raw (minimal)",Hn=c("option"),Hn.textContent="Raw (full)",Wn=c("option"),Wn.textContent="Domoticz",zn=c("option"),zn.textContent="HomeAssistant",Gn=c("option"),Gn.textContent="HEX dump",lr=b(),tn=c("div"),nr=E("Publish topic"),ir=c("br"),sr=b(),Al=c("input"),or=b(),gt&>.c(),Rs=b(),kt&&kt.c(),Fs=b(),wt&&wt.c(),Os=b(),Ct&&Ct.c(),Bs=b(),vl=c("div"),rs=c("strong"),rs.textContent="User interface",ar=b(),Vn=c("a"),ae(Kn.$$.fragment),rr=b(),pi=c("input"),ur=b(),di=c("div");for(let U=0;USave',Hs=b(),ae(ln.$$.fragment),Ws=b(),ae(nn.$$.fragment),zs=b(),ae(sn.$$.fragment),Gs=b(),ae(on.$$.fragment),a(i,"class","text-sm"),a(u,"href",Wt("General-configuration")),a(u,"target","_blank"),a(u,"class","float-right"),a(f,"type","hidden"),a(f,"name","g"),f.value="true",a($,"name","gh"),a($,"type","text"),a($,"class","in-f w-full"),a($,"pattern","[A-Za-z0-9-]+"),a(C,"name","gt"),a(C,"class","in-l w-full"),t[3].g.t===void 0&&Ze(()=>t[17].call(C)),a(h,"class","flex"),a(_,"class","my-1"),a(j,"type","hidden"),a(j,"name","p"),j.value="true",_e.__value="10YNO-1--------2",_e.value=_e.__value,ie.__value="10YNO-2--------T",ie.value=ie.__value,me.__value="10YNO-3--------J",me.value=me.__value,Y.__value="10YNO-4--------9",Y.value=Y.__value,ke.__value="10Y1001A1001A48H",ke.value=ke.__value,a(x,"label","Norway"),we.__value="10Y1001A1001A44P",we.value=we.__value,Me.__value="10Y1001A1001A45N",Me.value=Me.__value,te.__value="10Y1001A1001A46L",te.value=te.__value,fe.__value="10Y1001A1001A47J",fe.value=fe.__value,a(Ee,"label","Sweden"),Ie.__value="10YDK-1--------W",Ie.value=Ie.__value,T.__value="10YDK-2--------M",T.value=T.__value,a(Oe,"label","Denmark"),w.__value="10YAT-APG------L",w.value=w.__value,S.__value="10YBE----------2",S.value=S.__value,D.__value="10YCZ-CEPS-----N",D.value=D.__value,O.__value="10Y1001A1001A39I",O.value=O.__value,J.__value="10YFI-1--------U",J.value=J.__value,le.__value="10YFR-RTE------C",le.value=le.__value,pe.__value="10Y1001A1001A83F",pe.value=pe.__value,ge.__value="10YGB----------A",ge.value=ge.__value,Ae.__value="10YLV-1001A00074",Ae.value=Ae.__value,Fe.__value="10YLT-1001A0008Q",Fe.value=Fe.__value,ce.__value="10YNL----------L",ce.value=ce.__value,Pe.__value="10YPL-AREA-----S",Pe.value=Pe.__value,ze.__value="10YCH-SWISSGRIDZ",ze.value=ze.__value,a(W,"name","pr"),a(W,"class","in-f w-full"),t[3].p.r===void 0&&Ze(()=>t[18].call(W)),a(G,"class","w-full"),a(Ue,"name","pc"),a(Ue,"class","in-l"),t[3].p.c===void 0&&Ze(()=>t[19].call(Ue)),a(V,"class","flex"),a(H,"class","my-1"),a(dt,"class","my-1"),a(Le,"type","checkbox"),a(Le,"name","pe"),Le.__value="true",Le.value=Le.__value,a(Le,"class","rounded mb-1"),a(Re,"class","my-1"),Qe.__value=0,Qe.value=Qe.__value,ee.__value=1,ee.value=ee.__value,st.__value=2,st.value=st.__value,a(re,"name","gs"),a(re,"class","in-s"),t[3].g.s===void 0&&Ze(()=>t[22].call(re)),a(ye,"class","my-1"),a($t,"name","gc"),a($t,"type","text"),a($t,"pattern","[A-Za-z0-9]+"),a($t,"placeholder","[root]"),a($t,"class","in-s"),a($t,"maxlength","36"),a(yl,"class","my-1"),a(l,"class","cnt"),a(dn,"class","text-sm"),a(Ll,"href",Wt("Meter-configuration")),a(Ll,"target","_blank"),a(Ll,"class","float-right"),a(zl,"type","hidden"),a(zl,"name","m"),zl.value="true",a(Gl,"type","hidden"),a(Gl,"name","mo"),Gl.value="1",ml.__value=0,ml.value=ml.__value,ft.__value=9,ft.value=ft.__value,a(tl,"name","ma"),a(tl,"class","in-s"),t[3].m.a===void 0&&Ze(()=>t[26].call(tl)),a(Ml,"class","my-1"),a(Wi,"class","float-right"),a(ll,"name","mi"),ll.__value="true",ll.value=ll.__value,a(ll,"type","checkbox"),a(ll,"class","rounded mb-1"),a(ui,"class","mt-2 ml-3 whitespace-nowrap"),Fl.__value=0,Fl.value=Fl.__value,Fl.disabled=zi=t[3].m.b!=0,a(_l,"name","mb"),a(_l,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Ze(()=>t[28].call(_l)),Ol.__value=0,Ol.value=Ol.__value,Ol.disabled=Gi=t[3].m.b!=0,hn.__value=2,hn.value=hn.__value,vn.__value=3,vn.value=vn.__value,bn.__value=10,bn.value=bn.__value,gn.__value=11,gn.value=gn.__value,a(Nt,"name","mp"),a(Nt,"class","in-m"),Nt.disabled=Vi=t[3].m.b==0,t[3].m.p===void 0&&Ze(()=>t[29].call(Nt)),a(zt,"name","ms"),a(zt,"type","number"),a(zt,"min",64),a(zt,"max",Ki=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),a(zt,"step",64),a(zt,"class","in-l tr w-1/2"),a(Rl,"class","flex w-full"),a(Xt,"class","my-1"),kn.__value=2,kn.value=kn.__value,wn.__value=1,wn.value=wn.__value,a(pl,"name","md"),a(pl,"class","in-s"),t[3].m.d===void 0&&Ze(()=>t[31].call(pl)),a(Kl,"class","my-1"),a(nl,"name","mf"),a(nl,"type","number"),a(nl,"min","5"),a(nl,"max","65535"),a(nl,"class","in-f tr w-full"),a(Yi,"class","in-post"),a(yn,"class","flex"),a(Yl,"class","mx-1"),a(il,"name","mr"),a(il,"type","number"),a(il,"min","0"),a(il,"max","65535"),a(il,"class","in-f tr w-full"),a(Qi,"class","in-post"),a(Mn,"class","flex"),a(Ql,"class","mx-1"),a(Cn,"class","my-1 flex"),a(As,"class","my-1"),a(sl,"type","checkbox"),a(sl,"name","me"),sl.__value="true",sl.value=sl.__value,a(sl,"class","rounded mb-1"),a(Xl,"class","my-1"),a(ol,"type","checkbox"),a(ol,"name","mm"),ol.__value="true",ol.value=ol.__value,a(ol,"class","rounded mb-1"),a(Xe,"class","cnt"),a(Ji,"class","text-sm"),a(Sn,"href",Wt("WiFi-configuration")),a(Sn,"target","_blank"),a(Sn,"class","float-right"),a(fi,"type","hidden"),a(fi,"name","w"),fi.value="true",Nn.__value=1,Nn.value=Nn.__value,En.__value=2,En.value=En.__value,a(Zt,"name","nc"),a(Zt,"class","in-s"),t[3].n.c===void 0&&Ze(()=>t[42].call(Zt)),a(Zl,"class","my-1"),a(Gt,"class","cnt"),a(xi,"class","text-sm"),a(Pn,"href",Wt("Network-configuration")),a(Pn,"target","_blank"),a(Pn,"class","float-right"),$n.__value="dhcp",$n.value=$n.__value,Dn.__value="static",Dn.value=Dn.__value,a(dl,"name","nm"),a(dl,"class","in-f"),t[3].n.m===void 0&&Ze(()=>t[48].call(dl)),a(Vt,"name","ni"),a(Vt,"type","text"),a(Vt,"class","in-m w-full"),Vt.disabled=es=t[3].n.m=="dhcp",Vt.required=ts=t[3].n.m=="static",a(Kt,"name","ns"),a(Kt,"class","in-l"),Kt.disabled=ls=t[3].n.m=="dhcp",Kt.required=ns=t[3].n.m=="static",t[3].n.s===void 0&&Ze(()=>t[50].call(Kt)),a(ql,"class","flex"),a(Jl,"class","my-1"),a(al,"name","nd"),al.__value="true",al.value=al.__value,a(al,"type","checkbox"),a(al,"class","rounded mb-1"),a(is,"class","my-1"),a(ci,"type","hidden"),a(ci,"name","ntp"),ci.value="true",a(rl,"name","ntpd"),rl.__value="true",rl.value=rl.__value,a(rl,"type","checkbox"),a(rl,"class","rounded mb-1"),a(mi,"class","ml-4"),a(Sl,"name","ntph"),a(Sl,"type","text"),a(Sl,"class","in-s"),a(os,"class","flex"),a(Bl,"class","my-1"),a(Mt,"class","cnt"),a(as,"class","text-sm"),a(In,"href",Wt("MQTT-configuration")),a(In,"target","_blank"),a(In,"class","float-right"),a(_i,"type","hidden"),a(_i,"name","q"),_i.value="true",a(Tl,"name","qh"),a(Tl,"type","text"),a(Tl,"class","in-f w-3/4"),a(ul,"name","qp"),a(ul,"type","number"),a(ul,"min","1024"),a(ul,"max","65535"),a(ul,"class","in-l tr w-1/4"),a(Fn,"class","flex"),a(hl,"class","my-1"),a(Nl,"name","qu"),a(Nl,"type","text"),a(Nl,"class","in-s"),a(xl,"class","my-1"),a(El,"name","qa"),a(El,"type","password"),a(El,"class","in-s"),a(en,"class","my-1"),a(Pl,"name","qc"),a(Pl,"type","text"),a(Pl,"class","in-f w-full"),Un.__value=0,Un.value=Un.__value,jn.__value=1,jn.value=jn.__value,Hn.__value=2,Hn.value=Hn.__value,Wn.__value=3,Wn.value=Wn.__value,zn.__value=4,zn.value=zn.__value,Gn.__value=255,Gn.value=Gn.__value,a(Dt,"name","qm"),a(Dt,"class","in-l"),t[3].q.m===void 0&&Ze(()=>t[63].call(Dt)),a(On,"class","my-1 flex"),a(Al,"name","qb"),a(Al,"type","text"),a(Al,"class","in-s"),a(tn,"class","my-1"),a(ct,"class","cnt"),a(rs,"class","text-sm"),a(Vn,"href",Wt("User-interface")),a(Vn,"target","_blank"),a(Vn,"class","float-right"),a(pi,"type","hidden"),a(pi,"name","u"),pi.value="true",a(di,"class","flex flex-wrap"),a(vl,"class","cnt"),a(us,"class","text-sm"),a(Yn,"href","https://amsleser.no/blog/post/24-telnet-debug"),a(Yn,"target","_blank"),a(Yn,"class","float-right"),a(hi,"type","hidden"),a(hi,"name","d"),hi.value="true",a(fl,"type","checkbox"),a(fl,"name","ds"),fl.__value="true",fl.value=fl.__value,a(fl,"class","rounded mb-1"),a(fs,"class","mt-3"),a(Yt,"class","cnt"),a(n,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),a(Xn,"type","button"),a(Xn,"class","btn-red"),a(Zn,"type","button"),a(Zn,"class","btn-yellow"),a(ms,"class","text-center"),a(_s,"class","text-right"),a(Ul,"class","grid grid-cols-3 mt-3"),a(e,"autocomplete","off")},m(U,he){M(U,e,he),s(e,n),s(n,l),s(l,i),s(l,o),s(l,u),se(m,u,null),s(l,r),s(l,f),s(l,p),s(l,_),s(_,h),s(h,v),s(v,d),s(v,g),s(v,k),s(v,$),ue($,t[3].g.h),s(h,N),s(h,A),s(A,F),s(A,I),s(A,R),s(A,C),se(P,C,null),Te(C,t[3].g.t,!0),s(l,ne),s(l,j),s(l,B),s(l,H),s(H,V),s(V,G),s(G,K),s(G,Z),s(G,z),s(G,W),s(W,x),s(x,_e),s(x,ie),s(x,me),s(x,Y),s(x,ke),s(W,Ee),s(Ee,we),s(Ee,Me),s(Ee,te),s(Ee,fe),s(W,Oe),s(Oe,Ie),s(Oe,T),s(W,w),s(W,S),s(W,D),s(W,O),s(W,J),s(W,le),s(W,pe),s(W,ge),s(W,Ae),s(W,Fe),s(W,ce),s(W,Pe),s(W,ze),Te(W,t[3].p.r,!0),s(V,_t),s(V,Ke),s(Ke,ut),s(Ke,Ge),s(Ke,pt),s(Ke,Ue);for(let St=0;St<5;St+=1)vi[St]&&vi[St].m(Ue,null);Te(Ue,t[3].p.c,!0),s(l,At),s(l,dt),se(vt,dt,null),s(l,xe),s(l,Re),s(Re,et),s(et,Le),Le.checked=t[3].p.e,s(et,Je),s(Re,at),Lt&&Lt.m(Re,null),s(l,qe),s(l,ye),s(ye,ve),s(ye,de),s(ye,Ve),s(ye,re),s(re,Qe),s(re,ee),s(re,st),Te(re,t[3].g.s,!0),s(l,Li),It&&It.m(l,null),s(l,ri),s(l,yl),s(yl,Ii),s(yl,Ri),s(yl,Fi),s(yl,$t),ue($t,t[3].g.c),s(n,Oi),s(n,Xe),s(Xe,dn),s(Xe,qi),s(Xe,Ll),se(Il,Ll,null),s(Xe,Bi),s(Xe,zl),s(Xe,Ui),s(Xe,Gl),s(Xe,ji),s(Xe,Ml),s(Ml,nt),s(Ml,rt),s(Ml,Vl),s(Ml,tl),s(tl,ml),s(tl,ft),Te(tl,t[3].m.a,!0),s(Xe,Hi),s(Xe,Xt),s(Xt,Wi),s(Xt,Lo),s(Xt,Ps),s(Xt,Io),s(Xt,ui),s(ui,ll),ll.checked=t[3].m.i,s(ui,Ro),s(Xt,Fo),s(Xt,Rl),s(Rl,_l),s(_l,Fl),s(Fl,Oo);for(let St=0;St<7;St+=1)bi[St]&&bi[St].m(_l,null);Te(_l,t[3].m.b,!0),s(Rl,qo),s(Rl,Nt),s(Nt,Ol),s(Ol,Bo),s(Nt,hn),s(Nt,vn),s(Nt,bn),s(Nt,gn),Te(Nt,t[3].m.p,!0),s(Rl,Uo),s(Rl,zt),ue(zt,t[3].m.s),s(Xe,jo),s(Xe,Kl),s(Kl,Ho),s(Kl,Wo),s(Kl,zo),s(Kl,pl),s(pl,kn),s(pl,wn),Te(pl,t[3].m.d,!0),s(Xe,Go),s(Xe,Cn),s(Cn,Yl),s(Yl,Vo),s(Yl,Ko),s(Yl,Yo),s(Yl,yn),s(yn,nl),ue(nl,t[3].m.f),s(yn,Qo),s(yn,Yi),s(Cn,Xo),s(Cn,Ql),s(Ql,Zo),s(Ql,Jo),s(Ql,xo),s(Ql,Mn),s(Mn,il),ue(il,t[3].m.r),s(Mn,ea),s(Mn,Qi),s(Xe,ta),s(Xe,As),s(Xe,la),s(Xe,Xl),s(Xl,Xi),s(Xi,sl),sl.checked=t[3].m.e.e,s(Xi,na),s(Xl,ia),Rt&&Rt.m(Xl,null),s(Xe,sa),Ft&&Ft.m(Xe,null),s(Xe,$s),s(Xe,Zi),s(Zi,ol),ol.checked=t[3].m.m.e,s(Zi,oa),s(Xe,aa),Ot&&Ot.m(Xe,null),s(n,ra),s(n,Gt),s(Gt,Ji),s(Gt,ua),s(Gt,Sn),se(Tn,Sn,null),s(Gt,fa),s(Gt,fi),s(Gt,ca),s(Gt,Zl),s(Zl,ma),s(Zl,_a),s(Zl,pa),s(Zl,Zt),s(Zt,Nn),s(Zt,En),Qt&&Qt.m(Zt,null),Te(Zt,t[3].n.c,!0),s(Gt,da),qt&&qt.m(Gt,null),s(n,ha),s(n,Mt),s(Mt,xi),s(Mt,va),s(Mt,Pn),se(An,Pn,null),s(Mt,ba),s(Mt,Jl),s(Jl,ga),s(Jl,ka),s(Jl,wa),s(Jl,ql),s(ql,dl),s(dl,$n),s(dl,Dn),Te(dl,t[3].n.m,!0),s(ql,Ca),s(ql,Vt),ue(Vt,t[3].n.i),s(ql,ya),s(ql,Kt),se(Ln,Kt,null),Te(Kt,t[3].n.s,!0),s(Mt,Ma),Bt&&Bt.m(Mt,null),s(Mt,Ds),s(Mt,is),s(is,ss),s(ss,al),al.checked=t[3].n.d,s(ss,Sa),s(Mt,Ta),s(Mt,ci),s(Mt,Na),s(Mt,Bl),s(Bl,Ea),s(Bl,mi),s(mi,rl),rl.checked=t[3].n.h,s(mi,Pa),s(Bl,Aa),s(Bl,$a),s(Bl,os),s(os,Sl),ue(Sl,t[3].n.n1),s(n,Da),s(n,ct),s(ct,as),s(ct,La),s(ct,In),se(Rn,In,null),s(ct,Ia),s(ct,_i),s(ct,Ra),s(ct,hl),s(hl,Fa),Ut&&Ut.m(hl,null),s(hl,Ls),s(hl,Oa),s(hl,qa),s(hl,Fn),s(Fn,Tl),ue(Tl,t[3].q.h),s(Fn,Ba),s(Fn,ul),ue(ul,t[3].q.p),s(ct,Ua),bt&&bt.m(ct,null),s(ct,Is),s(ct,xl),s(xl,ja),s(xl,Ha),s(xl,Wa),s(xl,Nl),ue(Nl,t[3].q.u),s(ct,za),s(ct,en),s(en,Ga),s(en,Va),s(en,Ka),s(en,El),ue(El,t[3].q.a),s(ct,Ya),s(ct,On),s(On,qn),s(qn,Qa),s(qn,Xa),s(qn,Za),s(qn,Pl),ue(Pl,t[3].q.c),s(On,Ja),s(On,Bn),s(Bn,xa),s(Bn,er),s(Bn,tr),s(Bn,Dt),s(Dt,Un),s(Dt,jn),s(Dt,Hn),s(Dt,Wn),s(Dt,zn),s(Dt,Gn),Te(Dt,t[3].q.m,!0),s(ct,lr),s(ct,tn),s(tn,nr),s(tn,ir),s(tn,sr),s(tn,Al),ue(Al,t[3].q.b),s(n,or),gt&>.m(n,null),s(n,Rs),kt&&kt.m(n,null),s(n,Fs),wt&&wt.m(n,null),s(n,Os),Ct&&Ct.m(n,null),s(n,Bs),s(n,vl),s(vl,rs),s(vl,ar),s(vl,Vn),se(Kn,Vn,null),s(vl,rr),s(vl,pi),s(vl,ur),s(vl,di);for(let St=0;St0?It?It.p(U,he):(It=vf(U),It.c(),It.m(l,ri)):It&&(It.d(1),It=null),he[0]&8&&$t.value!==U[3].g.c&&ue($t,U[3].g.c),he[0]&8&&Te(tl,U[3].m.a),he[0]&8&&(ll.checked=U[3].m.i),(!Jt||he[0]&8&&zi!==(zi=U[3].m.b!=0))&&(Fl.disabled=zi),he[0]&8&&Te(_l,U[3].m.b),(!Jt||he[0]&8&&Gi!==(Gi=U[3].m.b!=0))&&(Ol.disabled=Gi),(!Jt||he[0]&8&&Vi!==(Vi=U[3].m.b==0))&&(Nt.disabled=Vi),he[0]&8&&Te(Nt,U[3].m.p),(!Jt||he[0]&9&&Ki!==(Ki=U[0].chip=="esp8266"?U[3].i.h.p==3||U[3].i.h.p==113?512:128:4096))&&a(zt,"max",Ki),he[0]&8&&Se(zt.value)!==U[3].m.s&&ue(zt,U[3].m.s),he[0]&8&&Te(pl,U[3].m.d),he[0]&8&&Se(nl.value)!==U[3].m.f&&ue(nl,U[3].m.f),he[0]&8&&Se(il.value)!==U[3].m.r&&ue(il,U[3].m.r),he[0]&8&&(sl.checked=U[3].m.e.e),U[3].m.e.e?Rt?Rt.p(U,he):(Rt=bf(U),Rt.c(),Rt.m(Xl,null)):Rt&&(Rt.d(1),Rt=null),U[3].m.e.e?Ft?Ft.p(U,he):(Ft=gf(U),Ft.c(),Ft.m(Xe,$s)):Ft&&(Ft.d(1),Ft=null),he[0]&8&&(ol.checked=U[3].m.m.e),U[3].m.m.e?Ot?Ot.p(U,he):(Ot=kf(U),Ot.c(),Ot.m(Xe,null)):Ot&&(Ot.d(1),Ot=null),U[0].if&&U[0].if.eth?Qt||(Qt=wf(),Qt.c(),Qt.m(Zt,null)):Qt&&(Qt.d(1),Qt=null),he[0]&8&&Te(Zt,U[3].n.c),U[3].n.c==1||U[3].n.c==2?qt?qt.p(U,he):(qt=Cf(U),qt.c(),qt.m(Gt,null)):qt&&(qt.d(1),qt=null),he[0]&8&&Te(dl,U[3].n.m),(!Jt||he[0]&8&&es!==(es=U[3].n.m=="dhcp"))&&(Vt.disabled=es),(!Jt||he[0]&8&&ts!==(ts=U[3].n.m=="static"))&&(Vt.required=ts),he[0]&8&&Vt.value!==U[3].n.i&&ue(Vt,U[3].n.i),(!Jt||he[0]&8&&ls!==(ls=U[3].n.m=="dhcp"))&&(Kt.disabled=ls),(!Jt||he[0]&8&&ns!==(ns=U[3].n.m=="static"))&&(Kt.required=ns),he[0]&8&&Te(Kt,U[3].n.s),U[3].n.m=="static"?Bt?Bt.p(U,he):(Bt=yf(U),Bt.c(),Bt.m(Mt,Ds)):Bt&&(Bt.d(1),Bt=null),he[0]&8&&(al.checked=U[3].n.d),he[0]&8&&(rl.checked=U[3].n.h),he[0]&8&&Sl.value!==U[3].n.n1&&ue(Sl,U[3].n.n1),U[0].chip!="esp8266"?Ut?Ut.p(U,he):(Ut=Mf(U),Ut.c(),Ut.m(hl,Ls)):Ut&&(Ut.d(1),Ut=null),he[0]&8&&Tl.value!==U[3].q.h&&ue(Tl,U[3].q.h),he[0]&8&&Se(ul.value)!==U[3].q.p&&ue(ul,U[3].q.p),U[3].q.s.e?bt?(bt.p(U,he),he[0]&8&&L(bt,1)):(bt=Sf(U),bt.c(),L(bt,1),bt.m(ct,Is)):bt&&($e(),q(bt,1,1,()=>{bt=null}),De()),he[0]&8&&Nl.value!==U[3].q.u&&ue(Nl,U[3].q.u),he[0]&8&&El.value!==U[3].q.a&&ue(El,U[3].q.a),he[0]&8&&Pl.value!==U[3].q.c&&ue(Pl,U[3].q.c),he[0]&8&&Te(Dt,U[3].q.m),he[0]&8&&Al.value!==U[3].q.b&&ue(Al,U[3].q.b),U[3].q.m==3?gt?(gt.p(U,he),he[0]&8&&L(gt,1)):(gt=Tf(U),gt.c(),L(gt,1),gt.m(n,Rs)):gt&&($e(),q(gt,1,1,()=>{gt=null}),De()),U[3].q.m==4?kt?(kt.p(U,he),he[0]&8&&L(kt,1)):(kt=Nf(U),kt.c(),L(kt,1),kt.m(n,Fs)):kt&&($e(),q(kt,1,1,()=>{kt=null}),De()),U[3].c.es!=null?wt?(wt.p(U,he),he[0]&8&&L(wt,1)):(wt=Ef(U),wt.c(),L(wt,1),wt.m(n,Os)):wt&&($e(),q(wt,1,1,()=>{wt=null}),De()),he[0]&8&&(qs=U[3].p.r.startsWith("10YNO")||U[3].p.r.startsWith("10Y1001A1001A4")),qs?Ct?(Ct.p(U,he),he[0]&8&&L(Ct,1)):(Ct=$f(U),Ct.c(),L(Ct,1),Ct.m(n,Bs)):Ct&&($e(),q(Ct,1,1,()=>{Ct=null}),De()),he[0]&136){Jn=U[7];let xt;for(xt=0;xt20||U[0].chip=="esp8266"||U[3].i.d.d>0?yt?(yt.p(U,he),he[0]&9&&L(yt,1)):(yt=If(U),yt.c(),L(yt,1),yt.m(n,Us)):yt&&($e(),q(yt,1,1,()=>{yt=null}),De()),he[0]&8&&(fl.checked=U[3].d.s),U[3].d.s?jt?jt.p(U,he):(jt=jf(U),jt.c(),jt.m(Yt,null)):jt&&(jt.d(1),jt=null);const kr={};he[0]&2&&(kr.active=U[1]),ln.$set(kr);const wr={};he[0]&4&&(wr.active=U[2]),nn.$set(wr);const Cr={};he[0]&16&&(Cr.active=U[4]),sn.$set(Cr);const yr={};he[0]&32&&(yr.active=U[5]),on.$set(yr)},i(U){Jt||(L(m.$$.fragment,U),L(P.$$.fragment,U),L(vt.$$.fragment,U),L(Il.$$.fragment,U),L(Tn.$$.fragment,U),L(An.$$.fragment,U),L(Ln.$$.fragment,U),L(Rn.$$.fragment,U),L(bt),L(gt),L(kt),L(wt),L(Ct),L(Kn.$$.fragment,U),L(yt),L(Qn.$$.fragment,U),L(ln.$$.fragment,U),L(nn.$$.fragment,U),L(sn.$$.fragment,U),L(on.$$.fragment,U),Jt=!0)},o(U){q(m.$$.fragment,U),q(P.$$.fragment,U),q(vt.$$.fragment,U),q(Il.$$.fragment,U),q(Tn.$$.fragment,U),q(An.$$.fragment,U),q(Ln.$$.fragment,U),q(Rn.$$.fragment,U),q(bt),q(gt),q(kt),q(wt),q(Ct),q(Kn.$$.fragment,U),q(yt),q(Qn.$$.fragment,U),q(ln.$$.fragment,U),q(nn.$$.fragment,U),q(sn.$$.fragment,U),q(on.$$.fragment,U),Jt=!1},d(U){U&&y(e),oe(m),oe(P),mt(vi,U),oe(vt),Lt&&Lt.d(),It&&It.d(),oe(Il),mt(bi,U),Rt&&Rt.d(),Ft&&Ft.d(),Ot&&Ot.d(),oe(Tn),Qt&&Qt.d(),qt&&qt.d(),oe(An),oe(Ln),Bt&&Bt.d(),oe(Rn),Ut&&Ut.d(),bt&&bt.d(),gt&>.d(),kt&&kt.d(),wt&&wt.d(),Ct&&Ct.d(),oe(Kn),mt(Et,U),yt&&yt.d(),oe(Qn),jt&&jt.d(),U&&y(Hs),oe(ln,U),U&&y(Ws),oe(nn,U),U&&y(zs),oe(sn,U),U&&y(Gs),oe(on,U),Vs=!1,lt(gr)}}}async function J_(){await(await fetch("reboot",{method:"POST"})).json()}function x_(t,e,n){let{basepath:l="/"}=e,{sysinfo:i={}}=e,o=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Per phase",key:"h"},{name:"Power factor",key:"f"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],u=!0,m=!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,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},d:{d:null,b:0},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{e:!1,i:null,es:null}};wi.subscribe(nt=>{nt.version&&(n(3,r=nt),n(1,u=!1))}),h_();let f=!1,p=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){n(4,f=!0);const nt=new URLSearchParams;nt.append("perform","true");let Vl=await(await fetch("reset",{method:"POST",body:nt})).json();n(4,f=!1),n(5,p=Vl.success)}}function h(nt){Tt.update(rt=>(rt.trying=nt,rt))}async function v(nt){n(2,m=!0);const rt=new FormData(nt.target),Vl=new URLSearchParams;for(let ft of rt){const[Hi,Xt]=ft;Vl.append(Hi,Xt)}let ml=await(await fetch("save",{method:"POST",body:Vl})).json();Tt.update(ft=>(ft.hostname=rt.get("gh"),ft.usrcfg=ml.success,ft.booting=ml.reboot,rt.get("nm")=="static"&&(ft.net.ip=rt.get("ni"),ft.net.mask=rt.get("nu"),ft.net.gw=rt.get("ng"),ft.net.dns1=rt.get("nd")),setTimeout(Ei,5e3,i,h),ft)),Tt.update(ft=>(ft.booting=ml.reboot,ft.ui=r.u,ft)),n(2,m=!1),mn(l)}const d=function(){confirm("Are you sure you want to reboot the device?")&&(Tt.update(nt=>(nt.booting=!0,nt)),J_())};async function g(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),wi.update(rt=>(rt.q.s.c=!1,rt)))}async function k(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),wi.update(rt=>(rt.q.s.r=!1,rt)))}async function $(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),wi.update(rt=>(rt.q.s.k=!1,rt)))}const N=function(){r.q.s.e?r.q.p==1883&&n(3,r.q.p=8883,r):r.q.p==8883&&n(3,r.q.p=1883,r)};let A=44;function F(){r.g.h=this.value,n(3,r)}function I(){r.g.t=ot(this),n(3,r)}function R(){r.p.r=ot(this),n(3,r)}function C(){r.p.c=ot(this),n(3,r)}function P(){r.p.e=this.checked,n(3,r)}function ne(){r.p.t=this.value,n(3,r)}function j(){r.g.s=ot(this),n(3,r)}function B(){r.g.u=this.value,n(3,r)}function H(){r.g.p=this.value,n(3,r)}function V(){r.g.c=this.value,n(3,r)}function G(){r.m.a=ot(this),n(3,r)}function K(){r.m.i=this.checked,n(3,r)}function Z(){r.m.b=ot(this),n(3,r)}function z(){r.m.p=ot(this),n(3,r)}function W(){r.m.s=Se(this.value),n(3,r)}function x(){r.m.d=ot(this),n(3,r)}function _e(){r.m.f=Se(this.value),n(3,r)}function ie(){r.m.r=Se(this.value),n(3,r)}function me(){r.m.e.e=this.checked,n(3,r)}function Y(){r.m.e.k=this.value,n(3,r)}function ke(){r.m.e.a=this.value,n(3,r)}function Ee(){r.m.m.e=this.checked,n(3,r)}function we(){r.m.m.w=Se(this.value),n(3,r)}function Me(){r.m.m.v=Se(this.value),n(3,r)}function te(){r.m.m.a=Se(this.value),n(3,r)}function fe(){r.m.m.c=Se(this.value),n(3,r)}function Oe(){r.n.c=ot(this),n(3,r)}function Ie(){r.w.s=this.value,n(3,r)}function T(){r.w.p=this.value,n(3,r)}function w(){r.w.z=ot(this),n(3,r)}function S(){r.w.w=Se(this.value),n(3,r)}function D(){r.w.b=this.checked,n(3,r)}function O(){r.n.m=ot(this),n(3,r)}function J(){r.n.i=this.value,n(3,r)}function le(){r.n.s=ot(this),n(3,r)}function pe(){r.n.g=this.value,n(3,r)}function ge(){r.n.d1=this.value,n(3,r)}function Ae(){r.n.d2=this.value,n(3,r)}function Fe(){r.n.d=this.checked,n(3,r)}function ce(){r.n.h=this.checked,n(3,r)}function Pe(){r.n.n1=this.value,n(3,r)}function ze(){r.q.s.e=this.checked,n(3,r)}function _t(){r.q.h=this.value,n(3,r)}function Ke(){r.q.p=Se(this.value),n(3,r)}function ut(){r.q.u=this.value,n(3,r)}function Ge(){r.q.a=this.value,n(3,r)}function pt(){r.q.c=this.value,n(3,r)}function Ue(){r.q.m=ot(this),n(3,r)}function At(){r.q.b=this.value,n(3,r)}function dt(){r.o.e=this.value,n(3,r)}function vt(){r.o.c=this.value,n(3,r)}function xe(){r.o.u1=this.value,n(3,r)}function Re(){r.o.u2=this.value,n(3,r)}function et(){r.o.u3=this.value,n(3,r)}function Le(){r.h.t=this.value,n(3,r)}function Je(){r.h.h=this.value,n(3,r)}function at(){r.h.n=this.value,n(3,r)}function qe(){r.c.e=this.checked,n(3,r)}function ye(){r.c.es=this.checked,n(3,r)}function ve(nt){r.t.t[nt]=Se(this.value),n(3,r)}function de(){r.t.h=Se(this.value),n(3,r)}function Ve(nt){r.u[nt.key]=ot(this),n(3,r)}function re(){r.i.h.p=ot(this),n(3,r)}function Qe(){r.i.h.t=ot(this),n(3,r)}function ee(){r.i.h.u=this.checked,n(3,r)}function st(){r.i.a=Se(this.value),n(3,r)}function Li(){r.i.l.p=Se(this.value),n(3,r)}function ri(){r.i.l.i=this.checked,n(3,r)}function yl(){r.i.r.i=this.checked,n(3,r)}function Ii(){r.i.r.r=Se(this.value),n(3,r)}function Ri(){r.i.r.g=Se(this.value),n(3,r)}function Fi(){r.i.r.b=Se(this.value),n(3,r)}function $t(){r.i.d.d=Se(this.value),n(3,r)}function Oi(){r.i.t.d=Se(this.value),n(3,r)}function Xe(){r.i.t.a=Se(this.value),n(3,r)}function dn(){r.i.v.p=Se(this.value),n(3,r)}function qi(){r.i.v.d.v=Se(this.value),n(3,r)}function Ll(){r.i.v.d.g=Se(this.value),n(3,r)}function Il(){r.i.d.b=ot(this),n(3,r)}function Bi(){r.i.v.o=Se(this.value),n(3,r)}function zl(){r.i.v.m=Se(this.value),n(3,r)}function Ui(){r.i.v.b=Se(this.value),n(3,r)}function Gl(){r.d.s=this.checked,n(3,r)}function ji(){r.d.t=this.checked,n(3,r)}function Ml(){r.d.l=ot(this),n(3,r)}return t.$$set=nt=>{"basepath"in nt&&n(15,l=nt.basepath),"sysinfo"in nt&&n(0,i=nt.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&n(6,A=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,u,m,r,f,p,A,o,_,v,d,g,k,$,N,l,F,I,R,C,P,ne,j,B,H,V,G,K,Z,z,W,x,_e,ie,me,Y,ke,Ee,we,Me,te,fe,Oe,Ie,T,w,S,D,O,J,le,pe,ge,Ae,Fe,ce,Pe,ze,_t,Ke,ut,Ge,pt,Ue,At,dt,vt,xe,Re,et,Le,Je,at,qe,ye,ve,de,Ve,re,Qe,ee,st,Li,ri,yl,Ii,Ri,Fi,$t,Oi,Xe,dn,qi,Ll,Il,Bi,zl,Ui,Gl,ji,Ml]}class ep extends We{constructor(e){super(),He(this,e,x_,Z_,Be,{basepath:15,sysinfo:0},null,[-1,-1,-1,-1])}}function Wf(t,e,n){const l=t.slice();return l[21]=e[n],l}function tp(t){let e=Ce(t[1].chip,t[1].board)+"",n;return{c(){n=E(e)},m(l,i){M(l,n,i)},p(l,i){i&2&&e!==(e=Ce(l[1].chip,l[1].board)+"")&&X(n,e)},d(l){l&&y(n)}}}function zf(t){let e,n,l=t[1].apmac+"",i,o,u,m,r,f,p,_,h,v=Hr(t[1])+"",d,g,k=t[1].boot_reason+"",$,N,A=t[1].ex_cause+"",F,I,R;const C=[np,lp],P=[];function ne(j,B){return j[0].u>0?0:1}return r=ne(t),f=P[r]=C[r](t),{c(){e=c("div"),n=E("AP MAC: "),i=E(l),o=b(),u=c("div"),m=E(`Last boot: + `),f.c(),p=b(),_=c("div"),h=E("Reason: "),d=E(v),g=E(" ("),$=E(k),N=E("/"),F=E(A),I=E(")"),a(e,"class","my-2"),a(u,"class","my-2"),a(_,"class","my-2")},m(j,B){M(j,e,B),s(e,n),s(e,i),M(j,o,B),M(j,u,B),s(u,m),P[r].m(u,null),M(j,p,B),M(j,_,B),s(_,h),s(_,d),s(_,g),s(_,$),s(_,N),s(_,F),s(_,I),R=!0},p(j,B){(!R||B&2)&&l!==(l=j[1].apmac+"")&&X(i,l);let H=r;r=ne(j),r===H?P[r].p(j,B):($e(),q(P[H],1,1,()=>{P[H]=null}),De(),f=P[r],f?f.p(j,B):(f=P[r]=C[r](j),f.c()),L(f,1),f.m(u,null)),(!R||B&2)&&v!==(v=Hr(j[1])+"")&&X(d,v),(!R||B&2)&&k!==(k=j[1].boot_reason+"")&&X($,k),(!R||B&2)&&A!==(A=j[1].ex_cause+"")&&X(F,A)},i(j){R||(L(f),R=!0)},o(j){q(f),R=!1},d(j){j&&y(e),j&&y(o),j&&y(u),P[r].d(),j&&y(p),j&&y(_)}}}function lp(t){let e;return{c(){e=E("-")},m(n,l){M(n,e,l)},p:be,i:be,o:be,d(n){n&&y(e)}}}function np(t){let e,n;return e=new k0({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-l[0].u*1e3)),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function ip(t){let e;return{c(){e=c("span"),e.textContent="Update consents",a(e,"class","btn-pri-sm")},m(n,l){M(n,e,l)},p:be,d(n){n&&y(e)}}}function Gf(t){let e,n,l,i,o,u=Ss(t[1].meter.mfg)+"",m,r,f,p,_=(t[1].meter.model?t[1].meter.model:"unknown")+"",h,v,d,g,k=(t[1].meter.id?t[1].meter.id:"unknown")+"",$;return{c(){e=c("div"),n=c("strong"),n.textContent="Meter",l=b(),i=c("div"),o=E("Manufacturer: "),m=E(u),r=b(),f=c("div"),p=E("Model: "),h=E(_),v=b(),d=c("div"),g=E("ID: "),$=E(k),a(n,"class","text-sm"),a(i,"class","my-2"),a(f,"class","my-2"),a(d,"class","my-2"),a(e,"class","cnt")},m(N,A){M(N,e,A),s(e,n),s(e,l),s(e,i),s(i,o),s(i,m),s(e,r),s(e,f),s(f,p),s(f,h),s(e,v),s(e,d),s(d,g),s(d,$)},p(N,A){A&2&&u!==(u=Ss(N[1].meter.mfg)+"")&&X(m,u),A&2&&_!==(_=(N[1].meter.model?N[1].meter.model:"unknown")+"")&&X(h,_),A&2&&k!==(k=(N[1].meter.id?N[1].meter.id:"unknown")+"")&&X($,k)},d(N){N&&y(e)}}}function Vf(t){let e,n,l,i,o,u=t[1].net.ip+"",m,r,f,p,_=t[1].net.mask+"",h,v,d,g,k=t[1].net.gw+"",$,N,A,F,I=t[1].net.dns1+"",R,C,P=t[1].net.dns2&&Kf(t);return{c(){e=c("div"),n=c("strong"),n.textContent="Network",l=b(),i=c("div"),o=E("IP: "),m=E(u),r=b(),f=c("div"),p=E("Mask: "),h=E(_),v=b(),d=c("div"),g=E("Gateway: "),$=E(k),N=b(),A=c("div"),F=E("DNS: "),R=E(I),C=b(),P&&P.c(),a(n,"class","text-sm"),a(i,"class","my-2"),a(f,"class","my-2"),a(d,"class","my-2"),a(A,"class","my-2"),a(e,"class","cnt")},m(ne,j){M(ne,e,j),s(e,n),s(e,l),s(e,i),s(i,o),s(i,m),s(e,r),s(e,f),s(f,p),s(f,h),s(e,v),s(e,d),s(d,g),s(d,$),s(e,N),s(e,A),s(A,F),s(A,R),s(A,C),P&&P.m(A,null)},p(ne,j){j&2&&u!==(u=ne[1].net.ip+"")&&X(m,u),j&2&&_!==(_=ne[1].net.mask+"")&&X(h,_),j&2&&k!==(k=ne[1].net.gw+"")&&X($,k),j&2&&I!==(I=ne[1].net.dns1+"")&&X(R,I),ne[1].net.dns2?P?P.p(ne,j):(P=Kf(ne),P.c(),P.m(A,null)):P&&(P.d(1),P=null)},d(ne){ne&&y(e),P&&P.d()}}}function Kf(t){let e,n=t[1].net.dns2+"",l;return{c(){e=E("/ "),l=E(n)},m(i,o){M(i,e,o),M(i,l,o)},p(i,o){o&2&&n!==(n=i[1].net.dns2+"")&&X(l,n)},d(i){i&&y(e),i&&y(l)}}}function Yf(t){let e,n,l,i=t[1].upgrade.f+"",o,u,m=t[1].upgrade.t+"",r,f,p=jr(t[1].upgrade.e)+"",_;return{c(){e=c("div"),n=c("div"),l=E("Previous upgrade attempt from "),o=E(i),u=E(" to "),r=E(m),f=E(" failed. "),_=E(p),a(n,"class","bd-yellow"),a(e,"class","my-2")},m(h,v){M(h,e,v),s(e,n),s(n,l),s(n,o),s(n,u),s(n,r),s(n,f),s(n,_)},p(h,v){v&2&&i!==(i=h[1].upgrade.f+"")&&X(o,i),v&2&&m!==(m=h[1].upgrade.t+"")&&X(r,m),v&2&&p!==(p=jr(h[1].upgrade.e)+"")&&X(_,p)},d(h){h&&y(e)}}}function Qf(t){let e,n,l,i=t[3].tag_name+"",o,u,m,r,f,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[3]&&t[3].tag_name!=t[1].version&&Xf(t),h=t[1].fwconsent===2&&Zf();return{c(){e=c("div"),n=E(`Latest version: + `),l=c("a"),o=E(i),m=b(),_&&_.c(),r=b(),h&&h.c(),f=it(),a(l,"href",u=t[3].html_url),a(l,"class","ml-2 text-blue-600 hover:text-blue-800"),a(l,"target","_blank"),a(l,"rel","noreferrer"),a(e,"class","my-2 flex")},m(v,d){M(v,e,d),s(e,n),s(e,l),s(l,o),s(e,m),_&&_.m(e,null),M(v,r,d),h&&h.m(v,d),M(v,f,d),p=!0},p(v,d){(!p||d&8)&&i!==(i=v[3].tag_name+"")&&X(o,i),(!p||d&8&&u!==(u=v[3].html_url))&&a(l,"href",u),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[3]&&v[3].tag_name!=v[1].version?_?(_.p(v,d),d&11&&L(_,1)):(_=Xf(v),_.c(),L(_,1),_.m(e,null)):_&&($e(),q(_,1,1,()=>{_=null}),De()),v[1].fwconsent===2?h||(h=Zf(),h.c(),h.m(f.parentNode,f)):h&&(h.d(1),h=null)},i(v){p||(L(_),p=!0)},o(v){q(_),p=!1},d(v){v&&y(e),_&&_.d(),v&&y(r),h&&h.d(v),v&&y(f)}}}function Xf(t){let e,n,l,i,o,u;return l=new w0({}),{c(){e=c("div"),n=c("button"),ae(l.$$.fragment),a(e,"class","flex-none ml-2 text-green-500"),a(e,"title","Install this version")},m(m,r){M(m,e,r),s(e,n),se(l,n,null),i=!0,o||(u=Q(n,"click",t[10]),o=!0)},p:be,i(m){i||(L(l.$$.fragment,m),i=!0)},o(m){q(l.$$.fragment,m),i=!1},d(m){m&&y(e),oe(l),o=!1,u()}}}function Zf(t){let e;return{c(){e=c("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',a(e,"class","my-2")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function Jf(t){let e,n=Ts(Ce(t[1].chip,t[1].board))+"",l;return{c(){e=c("div"),l=E(n),a(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&2&&n!==(n=Ts(Ce(i[1].chip,i[1].board))+"")&&X(l,n)},d(i){i&&y(e)}}}function xf(t){let e,n,l,i,o,u;function m(p,_){return p[5].length==0?op:sp}let r=m(t),f=r(t);return{c(){e=c("div"),n=c("form"),l=c("input"),i=b(),f.c(),Ci(l,"display","none"),a(l,"name","file"),a(l,"type","file"),a(l,"accept",".bin"),a(n,"action","/firmware"),a(n,"enctype","multipart/form-data"),a(n,"method","post"),a(n,"autocomplete","off"),a(e,"class","my-2 flex")},m(p,_){M(p,e,_),s(e,n),s(n,l),t[13](l),s(n,i),f.m(n,null),o||(u=[Q(l,"change",t[14]),Q(n,"submit",t[16])],o=!0)},p(p,_){r===(r=m(p))&&f?f.p(p,_):(f.d(1),f=r(p),f&&(f.c(),f.m(n,null)))},d(p){p&&y(e),t[13](null),f.d(),o=!1,lt(u)}}}function sp(t){let e=t[5][0].name+"",n,l,i;return{c(){n=E(e),l=b(),i=c("button"),i.textContent="Upload",a(i,"type","submit"),a(i,"class","btn-pri-sm float-right")},m(o,u){M(o,n,u),M(o,l,u),M(o,i,u)},p(o,u){u&32&&e!==(e=o[5][0].name+"")&&X(n,e)},d(o){o&&y(n),o&&y(l),o&&y(i)}}}function op(t){let e,n,l;return{c(){e=c("button"),e.textContent="Select firmware file for upgrade",a(e,"type","button"),a(e,"class","btn-pri-sm float-right")},m(i,o){M(i,e,o),n||(l=Q(e,"click",t[15]),n=!0)},p:be,d(i){i&&y(e),n=!1,l()}}}function e1(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g=t[9],k=[];for(let I=0;I Include Secrets
(SSID, PSK, passwords and tokens)',r=b(),$&&$.c(),f=b(),p=c("form"),_=c("input"),h=b(),F.c(),a(n,"class","text-sm"),a(m,"class","my-1 mx-3 col-span-2"),a(o,"class","grid grid-cols-2"),a(i,"method","get"),a(i,"action","/configfile.cfg"),a(i,"autocomplete","off"),Ci(_,"display","none"),a(_,"name","file"),a(_,"type","file"),a(_,"accept",".cfg"),a(p,"autocomplete","off"),a(e,"class","cnt")},m(I,R){M(I,e,R),s(e,n),s(e,l),s(e,i),s(i,o);for(let C=0;C{D=null}),De());const _t={};Pe&16777216&&(_t.$$scope={dirty:Pe,ctx:ce}),ne.$set(_t),ce[1].meter?O?O.p(ce,Pe):(O=Gf(ce),O.c(),O.m(e,V)):O&&(O.d(1),O=null),ce[1].net?J?J.p(ce,Pe):(J=Vf(ce),J.c(),J.m(e,G)):J&&(J.d(1),J=null),(!T||Pe&2)&&_e!==(_e=ce[1].version+"")&&X(ie,_e),ce[1].upgrade.t&&ce[1].upgrade.t!=ce[1].version?le?le.p(ce,Pe):(le=Yf(ce),le.c(),le.m(K,Y)):le&&(le.d(1),le=null),ce[3]?pe?(pe.p(ce,Pe),Pe&8&&L(pe,1)):(pe=Qf(ce),pe.c(),L(pe,1),pe.m(K,ke)):pe&&($e(),q(pe,1,1,()=>{pe=null}),De()),Pe&3&&(Ee=(ce[1].security==0||ce[0].a)&&ni(ce[1].board)),Ee?ge?ge.p(ce,Pe):(ge=Jf(ce),ge.c(),ge.m(K,we)):ge&&(ge.d(1),ge=null),ce[1].security==0||ce[0].a?Ae?Ae.p(ce,Pe):(Ae=xf(ce),Ae.c(),Ae.m(K,null)):Ae&&(Ae.d(1),Ae=null),ce[1].security==0||ce[0].a?Fe?Fe.p(ce,Pe):(Fe=e1(ce),Fe.c(),Fe.m(e,null)):Fe&&(Fe.d(1),Fe=null);const Ke={};Pe&64&&(Ke.active=ce[6]),fe.$set(Ke);const ut={};Pe&256&&(ut.active=ce[8]),Ie.$set(ut)},i(ce){T||(L(k.$$.fragment,ce),L(D),L(ne.$$.fragment,ce),L(pe),L(fe.$$.fragment,ce),L(Ie.$$.fragment,ce),T=!0)},o(ce){q(k.$$.fragment,ce),q(D),q(ne.$$.fragment,ce),q(pe),q(fe.$$.fragment,ce),q(Ie.$$.fragment,ce),T=!1},d(ce){ce&&y(e),oe(k),D&&D.d(),oe(ne),O&&O.d(),J&&J.d(),le&&le.d(),pe&&pe.d(),ge&&ge.d(),Ae&&Ae.d(),Fe&&Fe.d(),ce&&y(te),oe(fe,ce),ce&&y(Oe),oe(Ie,ce),w=!1,S()}}}async function fp(){await(await fetch("reboot",{method:"POST"})).json()}function cp(t,e,n){let{data:l}=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"}],u={};Ao.subscribe(P=>{n(3,u=g0(i.version,P)),u||n(3,u=P[0])});function m(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Ts(Ce(i.chip,i.board))))&&(Tt.update(P=>(P.upgrading=!0,P)),b0(u.tag_name))}const r=function(){confirm("Are you sure you want to reboot the device?")&&(Tt.update(P=>(P.booting=!0,P)),fp())};let f,p=[],_=!1,h,v=[],d=!1;To();let g={hostname:"",ip:""};function k(P){n(8,d=!0);const ne=new FormData;ne.append("file",v[0]),fetch("/configfile",{method:"POST",body:ne}).then(j=>j.json()).then(j=>{Tt.update(B=>(console.log("updating sysinfo with: ",g),g&&g.hostname&&(B.hostname=g.hostname),B.booting=j.reboot,g&&g.ip&&(B.net.ip=g.ip),setTimeout(Ei,5e3,i),B))}).catch(j=>{console.error("Error:",j),setTimeout(Ei,5e3,i)})}function $(P){ys[P?"unshift":"push"](()=>{f=P,n(4,f)})}function N(){p=this.files,n(5,p)}const A=()=>{f.click()},F=()=>n(6,_=!0);function I(P){ys[P?"unshift":"push"](()=>{h=P,n(7,h)})}function R(){v=this.files,n(2,v)}const C=()=>{h.click()};return t.$$set=P=>{"data"in P&&n(0,l=P.data),"sysinfo"in P&&n(1,i=P.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&4&&v.length==1){let P=v[0],ne=new FileReader,j=B=>{let H=B.target.result.split(` +`);for(let V in H){let G=H[V];G.startsWith("hostname ")?g.hostname=G.split(" ")[1]:G.startsWith("ip ")&&(g.ip=G.split(" ")[1])}};ne.onload=j,ne.readAsText(P)}},[l,i,v,u,f,p,_,h,d,o,m,r,k,$,N,A,F,I,R,C]}class mp extends We{constructor(e){super(),He(this,e,cp,up,Be,{data:0,sysinfo:1})}}function n1(t){let e,n,l=Ce(t[0],7)+"",i,o,u=Ce(t[0],5)+"",m,r,f=Ce(t[0],4)+"",p,_,h=Ce(t[0],3)+"",v,d,g,k,$=Ce(t[0],2)+"",N,A,F=Ce(t[0],1)+"",I,R,C=Ce(t[0],0)+"",P,ne,j,B,H=Ce(t[0],101)+"",V,G,K=Ce(t[0],100)+"",Z;return{c(){e=c("optgroup"),n=c("option"),i=E(l),o=c("option"),m=E(u),r=c("option"),p=E(f),_=c("option"),v=E(h),d=b(),g=c("optgroup"),k=c("option"),N=E($),A=c("option"),I=E(F),R=c("option"),P=E(C),ne=b(),j=c("optgroup"),B=c("option"),V=E(H),G=c("option"),Z=E(K),n.__value=7,n.value=n.__value,o.__value=5,o.value=o.__value,r.__value=4,r.value=r.__value,_.__value=3,_.value=_.__value,a(e,"label","amsleser.no"),k.__value=2,k.value=k.__value,A.__value=1,A.value=A.__value,R.__value=0,R.value=R.__value,a(g,"label","Custom hardware"),B.__value=101,B.value=B.__value,G.__value=100,G.value=G.__value,a(j,"label","Generic hardware")},m(z,W){M(z,e,W),s(e,n),s(n,i),s(e,o),s(o,m),s(e,r),s(r,p),s(e,_),s(_,v),M(z,d,W),M(z,g,W),s(g,k),s(k,N),s(g,A),s(A,I),s(g,R),s(R,P),M(z,ne,W),M(z,j,W),s(j,B),s(B,V),s(j,G),s(G,Z)},p(z,W){W&1&&l!==(l=Ce(z[0],7)+"")&&X(i,l),W&1&&u!==(u=Ce(z[0],5)+"")&&X(m,u),W&1&&f!==(f=Ce(z[0],4)+"")&&X(p,f),W&1&&h!==(h=Ce(z[0],3)+"")&&X(v,h),W&1&&$!==($=Ce(z[0],2)+"")&&X(N,$),W&1&&F!==(F=Ce(z[0],1)+"")&&X(I,F),W&1&&C!==(C=Ce(z[0],0)+"")&&X(P,C),W&1&&H!==(H=Ce(z[0],101)+"")&&X(V,H),W&1&&K!==(K=Ce(z[0],100)+"")&&X(Z,K)},d(z){z&&y(e),z&&y(d),z&&y(g),z&&y(ne),z&&y(j)}}}function i1(t){let e,n,l=Ce(t[0],201)+"",i,o,u=Ce(t[0],202)+"",m,r,f=Ce(t[0],203)+"",p,_,h=Ce(t[0],241)+"",v,d,g=Ce(t[0],242)+"",k,$,N=Ce(t[0],243)+"",A,F,I=Ce(t[0],200)+"",R;return{c(){e=c("optgroup"),n=c("option"),i=E(l),o=c("option"),m=E(u),r=c("option"),p=E(f),_=c("option"),v=E(h),d=c("option"),k=E(g),$=c("option"),A=E(N),F=c("option"),R=E(I),n.__value=201,n.value=n.__value,o.__value=202,o.value=o.__value,r.__value=203,r.value=r.__value,_.__value=241,_.value=_.__value,d.__value=242,d.value=d.__value,$.__value=243,$.value=$.__value,F.__value=200,F.value=F.__value,a(e,"label","Generic hardware")},m(C,P){M(C,e,P),s(e,n),s(n,i),s(e,o),s(o,m),s(e,r),s(r,p),s(e,_),s(_,v),s(e,d),s(d,k),s(e,$),s($,A),s(e,F),s(F,R)},p(C,P){P&1&&l!==(l=Ce(C[0],201)+"")&&X(i,l),P&1&&u!==(u=Ce(C[0],202)+"")&&X(m,u),P&1&&f!==(f=Ce(C[0],203)+"")&&X(p,f),P&1&&h!==(h=Ce(C[0],241)+"")&&X(v,h),P&1&&g!==(g=Ce(C[0],242)+"")&&X(k,g),P&1&&N!==(N=Ce(C[0],243)+"")&&X(A,N),P&1&&I!==(I=Ce(C[0],200)+"")&&X(R,I)},d(C){C&&y(e)}}}function s1(t){let e,n,l=Ce(t[0],7)+"",i,o,u=Ce(t[0],6)+"",m,r,f=Ce(t[0],5)+"",p,_,h,v,d=Ce(t[0],51)+"",g,k,$=Ce(t[0],50)+"",N;return{c(){e=c("optgroup"),n=c("option"),i=E(l),o=c("option"),m=E(u),r=c("option"),p=E(f),_=b(),h=c("optgroup"),v=c("option"),g=E(d),k=c("option"),N=E($),n.__value=7,n.value=n.__value,o.__value=6,o.value=o.__value,r.__value=5,r.value=r.__value,a(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,k.__value=50,k.value=k.__value,a(h,"label","Generic hardware")},m(A,F){M(A,e,F),s(e,n),s(n,i),s(e,o),s(o,m),s(e,r),s(r,p),M(A,_,F),M(A,h,F),s(h,v),s(v,g),s(h,k),s(k,N)},p(A,F){F&1&&l!==(l=Ce(A[0],7)+"")&&X(i,l),F&1&&u!==(u=Ce(A[0],6)+"")&&X(m,u),F&1&&f!==(f=Ce(A[0],5)+"")&&X(p,f),F&1&&d!==(d=Ce(A[0],51)+"")&&X(g,d),F&1&&$!==($=Ce(A[0],50)+"")&&X(N,$)},d(A){A&&y(e),A&&y(_),A&&y(h)}}}function o1(t){let e,n,l=Ce(t[0],8)+"",i,o,u,m,r=Ce(t[0],71)+"",f,p,_=Ce(t[0],70)+"",h;return{c(){e=c("optgroup"),n=c("option"),i=E(l),o=b(),u=c("optgroup"),m=c("option"),f=E(r),p=c("option"),h=E(_),n.__value=8,n.value=n.__value,a(e,"label","Custom hardware"),m.__value=71,m.value=m.__value,p.__value=70,p.value=p.__value,a(u,"label","Generic hardware")},m(v,d){M(v,e,d),s(e,n),s(n,i),M(v,o,d),M(v,u,d),s(u,m),s(m,f),s(u,p),s(p,h)},p(v,d){d&1&&l!==(l=Ce(v[0],8)+"")&&X(i,l),d&1&&r!==(r=Ce(v[0],71)+"")&&X(f,r),d&1&&_!==(_=Ce(v[0],70)+"")&&X(h,_)},d(v){v&&y(e),v&&y(o),v&&y(u)}}}function a1(t){let e,n,l=Ce(t[0],200)+"",i;return{c(){e=c("optgroup"),n=c("option"),i=E(l),n.__value=200,n.value=n.__value,a(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,n),s(n,i)},p(o,u){u&1&&l!==(l=Ce(o[0],200)+"")&&X(i,l)},d(o){o&&y(e)}}}function r1(t){let e,n,l=Ce(t[0],80)+"",i;return{c(){e=c("optgroup"),n=c("option"),i=E(l),n.__value=80,n.value=n.__value,a(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,n),s(n,i)},p(o,u){u&1&&l!==(l=Ce(o[0],80)+"")&&X(i,l)},d(o){o&&y(e)}}}function _p(t){let e,n,l,i,o,u,m,r,f=t[0]=="esp8266"&&n1(t),p=t[0]=="esp32"&&i1(t),_=t[0]=="esp32s2"&&s1(t),h=t[0]=="esp32c3"&&o1(t),v=t[0]=="esp32solo"&&a1(t),d=t[0]=="esp32s3"&&r1(t);return{c(){e=c("option"),n=b(),f&&f.c(),l=b(),p&&p.c(),i=b(),_&&_.c(),o=b(),h&&h.c(),u=b(),v&&v.c(),m=b(),d&&d.c(),r=it(),e.__value=-1,e.value=e.__value},m(g,k){M(g,e,k),M(g,n,k),f&&f.m(g,k),M(g,l,k),p&&p.m(g,k),M(g,i,k),_&&_.m(g,k),M(g,o,k),h&&h.m(g,k),M(g,u,k),v&&v.m(g,k),M(g,m,k),d&&d.m(g,k),M(g,r,k)},p(g,[k]){g[0]=="esp8266"?f?f.p(g,k):(f=n1(g),f.c(),f.m(l.parentNode,l)):f&&(f.d(1),f=null),g[0]=="esp32"?p?p.p(g,k):(p=i1(g),p.c(),p.m(i.parentNode,i)):p&&(p.d(1),p=null),g[0]=="esp32s2"?_?_.p(g,k):(_=s1(g),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),g[0]=="esp32c3"?h?h.p(g,k):(h=o1(g),h.c(),h.m(u.parentNode,u)):h&&(h.d(1),h=null),g[0]=="esp32solo"?v?v.p(g,k):(v=a1(g),v.c(),v.m(m.parentNode,m)):v&&(v.d(1),v=null),g[0]=="esp32s3"?d?d.p(g,k):(d=r1(g),d.c(),d.m(r.parentNode,r)):d&&(d.d(1),d=null)},i:be,o:be,d(g){g&&y(e),g&&y(n),f&&f.d(g),g&&y(l),p&&p.d(g),g&&y(i),_&&_.d(g),g&&y(o),h&&h.d(g),g&&y(u),v&&v.d(g),g&&y(m),d&&d.d(g),g&&y(r)}}}function pp(t,e,n){let{chip:l}=e;return t.$$set=i=>{"chip"in i&&n(0,l=i.chip)},[l]}class dp extends We{constructor(e){super(),He(this,e,pp,_p,Be,{chip:0})}}function u1(t){let e;return{c(){e=c("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",a(e,"class","bd-red")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function f1(t){let e,n,l,i,o,u,m;return u=new mo({props:{chip:t[0].chip}}),{c(){e=c("div"),n=E("HAN GPIO"),l=c("br"),i=b(),o=c("select"),ae(u.$$.fragment),a(o,"name","vh"),a(o,"class","in-s"),a(e,"class","my-3")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),se(u,o,null),m=!0},p(r,f){const p={};f&1&&(p.chip=r[0].chip),u.$set(p)},i(r){m||(L(u.$$.fragment,r),m=!0)},o(r){q(u.$$.fragment,r),m=!1},d(r){r&&y(e),oe(u)}}}function hp(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G=t[0].usrcfg&&u1();d=new dp({props:{chip:t[0].chip}});let K=t[0].board&&t[0].board>20&&f1(t);return j=new Pt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=c("div"),n=c("div"),l=c("form"),i=c("input"),o=b(),u=c("strong"),u.textContent="Initial configuration",m=b(),G&&G.c(),r=b(),f=c("div"),p=E("Board type"),_=c("br"),h=b(),v=c("select"),ae(d.$$.fragment),g=b(),K&&K.c(),k=b(),$=c("div"),N=c("label"),A=c("input"),F=E(" Clear all other configuration"),I=b(),R=c("div"),R.innerHTML='',C=b(),P=c("span"),P.textContent="\xA0",ne=b(),ae(j.$$.fragment),a(i,"type","hidden"),a(i,"name","v"),i.value="true",a(u,"class","text-sm"),a(v,"name","vb"),a(v,"class","in-s"),t[0].board===void 0&&Ze(()=>t[5].call(v)),a(f,"class","my-3"),a(A,"type","checkbox"),a(A,"name","vr"),A.__value="true",A.value=A.__value,a(A,"class","rounded mb-1"),a($,"class","my-3"),a(R,"class","my-3"),a(P,"class","clear-both"),a(l,"autocomplete","off"),a(n,"class","cnt"),a(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Z,z){M(Z,e,z),s(e,n),s(n,l),s(l,i),s(l,o),s(l,u),s(l,m),G&&G.m(l,null),s(l,r),s(l,f),s(f,p),s(f,_),s(f,h),s(f,v),se(d,v,null),Te(v,t[0].board,!0),s(l,g),K&&K.m(l,null),s(l,k),s(l,$),s($,N),s(N,A),A.checked=t[2],s(N,F),s(l,I),s(l,R),s(l,C),s(l,P),M(Z,ne,z),se(j,Z,z),B=!0,H||(V=[Q(v,"change",t[5]),Q(A,"change",t[6]),Q(l,"submit",ai(t[3]))],H=!0)},p(Z,[z]){Z[0].usrcfg?G||(G=u1(),G.c(),G.m(l,r)):G&&(G.d(1),G=null);const W={};z&1&&(W.chip=Z[0].chip),d.$set(W),z&1&&Te(v,Z[0].board),Z[0].board&&Z[0].board>20?K?(K.p(Z,z),z&1&&L(K,1)):(K=f1(Z),K.c(),L(K,1),K.m(l,k)):K&&($e(),q(K,1,1,()=>{K=null}),De()),z&4&&(A.checked=Z[2]);const x={};z&2&&(x.active=Z[1]),j.$set(x)},i(Z){B||(L(d.$$.fragment,Z),L(K),L(j.$$.fragment,Z),B=!0)},o(Z){q(d.$$.fragment,Z),q(K),q(j.$$.fragment,Z),B=!1},d(Z){Z&&y(e),G&&G.d(),oe(d),K&&K.d(),Z&&y(ne),oe(j,Z),H=!1,lt(V)}}}function vp(t,e,n){let{basepath:l="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(p){n(1,o=!0);const _=new FormData(p.target),h=new URLSearchParams;for(let g of _){const[k,$]=g;h.append(k,$)}let d=await(await fetch("save",{method:"POST",body:h})).json();n(1,o=!1),Tt.update(g=>(g.vndcfg=d.success,g.booting=d.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),mn(l+(i.usrcfg?"/":"/setup"))}let m=!1;Tt.subscribe(p=>{n(0,i=p),p.fwconsent===1&&n(2,m=!i.usrcfg)});function r(){i.board=ot(this),n(0,i)}function f(){m=this.checked,n(2,m)}return t.$$set=p=>{"basepath"in p&&n(4,l=p.basepath),"sysinfo"in p&&n(0,i=p.sysinfo)},[i,o,m,u,l,r,f]}class bp extends We{constructor(e){super(),He(this,e,vp,hp,Be,{basepath:4,sysinfo:0})}}function c1(t){let e;return{c(){e=c("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function m1(t){let e,n,l,i,o,u,m,r,f,p,_,h,v;return{c(){e=c("div"),n=E("SSID"),l=c("br"),i=b(),o=c("input"),m=b(),r=c("div"),f=E("PSK"),p=c("br"),_=b(),h=c("input"),a(o,"name","ss"),a(o,"type","text"),a(o,"class","in-s"),o.required=u=t[2]==1||t[2]==2,a(e,"class","my-3"),a(h,"name","sp"),a(h,"type","password"),a(h,"class","in-s"),a(h,"autocomplete","off"),h.required=v=t[2]==2,a(r,"class","my-3")},m(d,g){M(d,e,g),s(e,n),s(e,l),s(e,i),s(e,o),M(d,m,g),M(d,r,g),s(r,f),s(r,p),s(r,_),s(r,h)},p(d,g){g&4&&u!==(u=d[2]==1||d[2]==2)&&(o.required=u),g&4&&v!==(v=d[2]==2)&&(h.required=v)},d(d){d&&y(e),d&&y(m),d&&y(r)}}}function _1(t){let e,n,l,i,o,u,m,r;return m=new M0({}),{c(){e=c("br"),n=b(),l=c("div"),i=c("input"),o=b(),u=c("select"),ae(m.$$.fragment),a(i,"name","si"),a(i,"type","text"),a(i,"class","in-f w-full"),i.required=t[1],a(u,"name","su"),a(u,"class","in-l"),u.required=t[1],a(l,"class","flex")},m(f,p){M(f,e,p),M(f,n,p),M(f,l,p),s(l,i),s(l,o),s(l,u),se(m,u,null),r=!0},p(f,p){(!r||p&2)&&(i.required=f[1]),(!r||p&2)&&(u.required=f[1])},i(f){r||(L(m.$$.fragment,f),r=!0)},o(f){q(m.$$.fragment,f),r=!1},d(f){f&&y(e),f&&y(n),f&&y(l),oe(m)}}}function p1(t){let e;return{c(){e=c("div"),e.innerHTML=`
Gateway
DNS
-
`,a(e,"class","my-3 flex")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function vp(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T,P,F,I,R,w,$,ie,j,U,H,G,V,K,Z,z,W=t[0].if&&t[0].if.eth&&u1(),x=(t[2]==1||t[2]==2)&&f1(t),_e=t[1]&&c1(t),ne=t[1]&&m1();return V=new Tt({props:{active:t[3],message:"Saving your configuration to the device"}}),{c(){e=c("div"),n=c("div"),l=c("form"),i=c("input"),o=b(),u=c("strong"),u.textContent="Setup",m=b(),r=c("div"),f=E("Connection"),p=c("br"),_=b(),v=c("select"),h=c("option"),h.textContent="Connect to WiFi",d=c("option"),d.textContent="Standalone access point",W&&W.c(),g=b(),x&&x.c(),k=b(),A=c("div"),T=E(`Hostname - `),P=c("input"),F=b(),I=c("div"),R=c("label"),w=c("input"),$=E(" Static IP"),ie=b(),_e&&_e.c(),j=b(),ne&&ne.c(),U=b(),H=c("div"),H.innerHTML='',G=b(),ae(V.$$.fragment),a(i,"type","hidden"),a(i,"name","s"),i.value="true",a(u,"class","text-sm"),h.__value=1,h.value=h.__value,d.__value=2,d.value=d.__value,a(v,"name","sc"),a(v,"class","in-s"),t[2]===void 0&&Ze(()=>t[5].call(v)),a(r,"class","my-3"),a(P,"name","sh"),a(P,"type","text"),a(P,"class","in-s"),a(P,"maxlength","32"),a(P,"pattern","[a-z0-9_-]+"),a(P,"placeholder","Optional, ex.: ams-reader"),a(P,"autocomplete","off"),a(w,"type","checkbox"),a(w,"name","sm"),w.__value="static",w.value=w.__value,a(w,"class","rounded mb-1"),a(I,"class","my-3"),a(H,"class","my-3"),a(n,"class","cnt"),a(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(me,Y){M(me,e,Y),s(e,n),s(n,l),s(l,i),s(l,o),s(l,u),s(l,m),s(l,r),s(r,f),s(r,p),s(r,_),s(r,v),s(v,h),s(v,d),W&&W.m(v,null),Te(v,t[2],!0),s(l,g),x&&x.m(l,null),s(l,k),s(l,A),s(A,T),s(A,P),ue(P,t[0].hostname),s(l,F),s(l,I),s(I,R),s(R,w),w.checked=t[1],s(R,$),s(I,ie),_e&&_e.m(I,null),s(l,j),ne&&ne.m(l,null),s(l,U),s(l,H),M(me,G,Y),se(V,me,Y),K=!0,Z||(z=[Q(v,"change",t[5]),Q(P,"input",t[6]),Q(w,"change",t[7]),Q(l,"submit",Ti(t[4]))],Z=!0)},p(me,[Y]){me[0].if&&me[0].if.eth?W||(W=u1(),W.c(),W.m(v,null)):W&&(W.d(1),W=null),Y&4&&Te(v,me[2]),me[2]==1||me[2]==2?x?x.p(me,Y):(x=f1(me),x.c(),x.m(l,k)):x&&(x.d(1),x=null),Y&1&&P.value!==me[0].hostname&&ue(P,me[0].hostname),Y&2&&(w.checked=me[1]),me[1]?_e?(_e.p(me,Y),Y&2&&L(_e,1)):(_e=c1(me),_e.c(),L(_e,1),_e.m(I,null)):_e&&($e(),q(_e,1,1,()=>{_e=null}),De()),me[1]?ne||(ne=m1(),ne.c(),ne.m(l,U)):ne&&(ne.d(1),ne=null);const ke={};Y&8&&(ke.active=me[3]),V.$set(ke)},i(me){K||(L(_e),L(V.$$.fragment,me),K=!0)},o(me){q(_e),q(V.$$.fragment,me),K=!1},d(me){me&&y(e),W&&W.d(),x&&x.d(),_e&&_e.d(),ne&&ne.d(),me&&y(G),oe(V,me),Z=!1,nt(z)}}}function bp(t,e,n){let{sysinfo:l={}}=e,i=!1,o=1,u=!1,m=0;function r(){var h="";m++;var d=function(){setTimeout(r,1e3)};if(l.net.ip&&m%3==0){if(!l.net.ip){d();return}h="http://"+l.net.ip}else l.hostname&&m%3==1?h="http://"+l.hostname:l.hostname&&m%3==2?h="http://"+l.hostname+".local":h="";console&&console.log("Trying url "+h),Yt.update(k=>(k.trying=h,k));var g=new XMLHttpRequest;g.timeout=5e3,g.addEventListener("abort",d),g.addEventListener("error",d),g.addEventListener("timeout",d),g.addEventListener("load",function(k){window.location.href=h||"/"}),g.open("GET",h+"/is-alive",!0),g.send()}async function f(h){n(3,u=!0);const d=new FormData(h.target),g=new URLSearchParams;for(let T of d){const[P,F]=T;g.append(P,F)}let A=await(await fetch("save",{method:"POST",body:g})).json();n(3,u=!1),Yt.update(T=>(T.hostname=d.get("sh"),T.usrcfg=A.success,T.booting=A.reboot,i&&(T.net.ip=d.get("si"),T.net.mask=d.get("su"),T.net.gw=d.get("sg"),T.net.dns1=d.get("sd")),setTimeout(r,5e3),T))}function p(){o=ot(this),n(2,o)}function _(){l.hostname=this.value,n(0,l)}function v(){i=this.checked,n(1,i)}return t.$$set=h=>{"sysinfo"in h&&n(0,l=h.sysinfo)},[l,i,o,u,f,p,_,v]}class gp extends We{constructor(e){super(),He(this,e,bp,vp,Be,{sysinfo:0})}}function kp(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A;return d=new Tt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=c("div"),n=c("div"),l=c("strong"),i=E("Upload "),o=E(t[1]),u=b(),m=c("p"),m.textContent="Select a suitable file and click upload",r=b(),f=c("form"),p=c("input"),_=b(),v=c("div"),v.innerHTML='',h=b(),ae(d.$$.fragment),a(m,"class","mb-4"),a(p,"name","file"),a(p,"type","file"),a(v,"class","w-full text-right mt-4"),a(f,"action",t[0]),a(f,"enctype","multipart/form-data"),a(f,"method","post"),a(f,"autocomplete","off"),a(n,"class","cnt"),a(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(T,P){M(T,e,P),s(e,n),s(n,l),s(l,i),s(l,o),s(n,u),s(n,m),s(n,r),s(n,f),s(f,p),s(f,_),s(f,v),M(T,h,P),se(d,T,P),g=!0,k||(A=Q(f,"submit",t[3]),k=!0)},p(T,[P]){(!g||P&2)&&X(o,T[1]),(!g||P&1)&&a(f,"action",T[0]);const F={};P&4&&(F.active=T[2]),d.$set(F)},i(T){g||(L(d.$$.fragment,T),g=!0)},o(T){q(d.$$.fragment,T),g=!1},d(T){T&&y(e),T&&y(h),oe(d,T),k=!1,A()}}}function wp(t,e,n){let{action:l}=e,{title:i}=e,o=!1;const u=()=>n(2,o=!0);return t.$$set=m=>{"action"in m&&n(0,l=m.action),"title"in m&&n(1,i=m.title)},[l,i,o,u]}class Ao extends We{constructor(e){super(),He(this,e,wp,kp,Be,{action:0,title:1})}}function Cp(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T,P,F,I,R,w,$,ie,j,U,H,G,V,K;return H=new Tt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=c("div"),n=c("div"),l=c("form"),i=c("div"),i.textContent="Various permissions we need to do stuff:",o=b(),u=c("hr"),m=b(),r=c("div"),f=E("Enable one-click upgrade? (implies data collection)"),p=c("br"),_=b(),v=c("a"),h=E("Read more"),d=c("br"),g=b(),k=c("label"),A=c("input"),P=E(" Yes"),F=c("label"),I=c("input"),w=E(" No"),$=c("br"),ie=b(),j=c("div"),j.innerHTML='',U=b(),ae(H.$$.fragment),a(v,"href",jt("Data-collection-on-one-click-firmware-upgrade")),a(v,"target","_blank"),a(v,"class","text-blue-600 hover:text-blue-800"),a(A,"type","radio"),a(A,"name","sf"),A.value=1,A.checked=T=t[0].fwconsent===1,a(A,"class","rounded m-2"),A.required=!0,a(I,"type","radio"),a(I,"name","sf"),I.value=2,I.checked=R=t[0].fwconsent===2,a(I,"class","rounded m-2"),I.required=!0,a(r,"class","my-3"),a(j,"class","my-3"),a(l,"autocomplete","off"),a(n,"class","cnt"),a(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(Z,z){M(Z,e,z),s(e,n),s(n,l),s(l,i),s(l,o),s(l,u),s(l,m),s(l,r),s(r,f),s(r,p),s(r,_),s(r,v),s(v,h),s(r,d),s(r,g),s(r,k),s(k,A),s(k,P),s(r,F),s(F,I),s(F,w),s(r,$),s(l,ie),s(l,j),M(Z,U,z),se(H,Z,z),G=!0,V||(K=Q(l,"submit",Ti(t[2])),V=!0)},p(Z,[z]){(!G||z&1&&T!==(T=Z[0].fwconsent===1))&&(A.checked=T),(!G||z&1&&R!==(R=Z[0].fwconsent===2))&&(I.checked=R);const W={};z&2&&(W.active=Z[1]),H.$set(W)},i(Z){G||(L(H.$$.fragment,Z),G=!0)},o(Z){q(H.$$.fragment,Z),G=!1},d(Z){Z&&y(e),Z&&y(U),oe(H,Z),V=!1,K()}}}function yp(t,e,n){let{basepath:l="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(m){n(1,o=!0);const r=new FormData(m.target),f=new URLSearchParams;for(let v of r){const[h,d]=v;f.append(h,d)}let _=await(await fetch("save",{method:"POST",body:f})).json();n(1,o=!1),Yt.update(v=>(v.fwconsent=r.sf===!0?1:r.sf===!1?2:0,v.booting=_.reboot,v)),cn(l)}return t.$$set=m=>{"basepath"in m&&n(3,l=m.basepath),"sysinfo"in m&&n(0,i=m.sysinfo)},[i,o,u,l]}class Mp extends We{constructor(e){super(),He(this,e,yp,Cp,Be,{basepath:3,sysinfo:0})}}function _1(t,e,n){const l=t.slice();return l[23]=e[n],l[24]=e,l[25]=n,l}function p1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function Sp(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function d1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function Tp(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function h1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function v1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function b1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function g1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function k1(t){let e,n,l=t[0].o,i=[];for(let u=0;uq(i[u],1,1,()=>{i[u]=null});return{c(){for(let u=0;uSave',F=b(),ae(I.$$.fragment),R=b(),ae(w.$$.fragment),a(n,"class","text-sm"),a(i,"href",jt("Price-configuration")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"class","m-3"),a(p,"type","hidden"),a(p,"name","r"),p.value="true",a(g,"type","button"),a(g,"class","btn-pri"),a(A,"class","text-center"),a(P,"class","text-right"),a(h,"class","grid grid-cols-3"),a(f,"autocomplete","off"),a(e,"class","cnt")},m(H,G){M(H,e,G),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(f,_),U&&U.m(f,null),s(f,v),s(f,h),s(h,d),s(d,g),s(h,k),s(h,A),s(h,T),s(h,P),M(H,F,G),se(I,H,G),M(H,R,G),se(w,H,G),$=!0,ie||(j=[Q(g,"click",t[6]),Q(f,"submit",Ti(t[4]))],ie=!0)},p(H,G){H[0].o?U?(U.p(H,G),G[0]&1&&L(U,1)):(U=k1(H),U.c(),L(U,1),U.m(f,v)):U&&($e(),q(U,1,1,()=>{U=null}),De());const V={};G[0]&2&&(V.active=H[1]),I.$set(V);const K={};G[0]&4&&(K.active=H[2]),w.$set(K)},i(H){$||(L(o.$$.fragment,H),L(U),L(I.$$.fragment,H),L(w.$$.fragment,H),$=!0)},o(H){q(o.$$.fragment,H),q(U),q(I.$$.fragment,H),q(w.$$.fragment,H),$=!1},d(H){H&&y(e),oe(o),U&&U.d(),H&&y(F),oe(I,H),H&&y(R),oe(w,H),ie=!1,nt(j)}}}function Ap(t,e,n){let{basepath:l="/"}=e,i=["mo","tu","we","th","fr","sa","su"],o={},u=!0,m=!1;w0.subscribe(j=>{j.o&&(n(0,o=j),n(1,u=!1))}),d_();async function r(j){n(2,m=!0);const U=new URLSearchParams;U.append("r","true"),U.append("rc",o.o.length),o.o.forEach(function(G,V){U.append("rt"+V,G.t),U.append("rn"+V,G.n),U.append("rd"+V,G.d),U.append("ra"+V,G.a),U.append("rh"+V,G.h),U.append("rv"+V,G.v),U.append("rsm"+V,G.s.m),U.append("rsd"+V,G.s.d),U.append("rem"+V,G.e.m),U.append("red"+V,G.e.d)}),await(await fetch("save",{method:"POST",body:U})).json(),n(2,m=!1),cn(l+"configuration")}let f=function(j,U){return j.includes(U)?j=j.filter(function(H){return H!==U}):j.push(U),j},p=function(){let j=o.o;j.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),n(0,o.o=j,o)},_=function(j){let U=o.o;U.splice(j,1),n(0,o.o=U,o)};function v(j,U){j[U].n=this.value,n(0,o)}function h(j,U){j[U].d=ot(this),n(0,o)}function d(j,U){j[U].t=ot(this),n(0,o)}function g(j,U){j[U].v=Se(this.value),n(0,o)}const k=(j,U,H,G)=>n(0,H[G].a=f(j.a,U),o),A=(j,U,H,G)=>n(0,H[G].h=f(j.h,U),o),T=(j,U,H,G)=>n(0,H[G].h=f(j.h,U+8),o),P=(j,U,H,G)=>n(0,H[G].h=f(j.h,U+16),o);function F(j,U){j[U].s.m=ot(this),n(0,o)}function I(j,U){j[U].s.d=ot(this),n(0,o)}function R(j,U){j[U].e.m=ot(this),n(0,o)}function w(j,U){j[U].e.d=ot(this),n(0,o)}const $=j=>_(j),ie=j=>_(j);return t.$$set=j=>{"basepath"in j&&n(8,l=j.basepath)},[o,u,m,i,r,f,p,_,l,v,h,d,g,k,A,T,P,F,I,R,w,$,ie]}class $p extends We{constructor(e){super(),He(this,e,Ap,Pp,Be,{basepath:8},null,[-1,-1])}}function Dp(t){let e,n;return e=new __({props:{data:t[2],sysinfo:t[1]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&4&&(o.data=l[2]),i&2&&(o.sysinfo=l[1]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Lp(t){let e,n;return e=new J_({props:{sysinfo:t[1],basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),i&1&&(o.basepath=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Ip(t){let e,n;return e=new $p({props:{basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.basepath=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Rp(t){let e,n;return e=new fp({props:{sysinfo:t[1],data:t[2]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),i&4&&(o.data=l[2]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Fp(t){let e,n;return e=new Ao({props:{title:"CA",action:"/mqtt-ca"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Op(t){let e,n;return e=new Ao({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function qp(t){let e,n;return e=new Ao({props:{title:"private key",action:"/mqtt-key"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Bp(t){let e,n;return e=new Mp({props:{sysinfo:t[1],basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),i&1&&(o.basepath=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Up(t){let e,n;return e=new gp({props:{sysinfo:t[1]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function jp(t){let e,n;return e=new hp({props:{sysinfo:t[1],basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),i&1&&(o.basepath=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Hp(t){let e,n,l,i,o,u,m,r,f,p,_,v,h,d,g,k,A,T,P,F,I,R;return e=new Mm({props:{data:t[2],basepath:t[0]}}),l=new vl({props:{path:"/",$$slots:{default:[Dp]},$$scope:{ctx:t}}}),o=new vl({props:{path:"/configuration",$$slots:{default:[Lp]},$$scope:{ctx:t}}}),m=new vl({props:{path:"/priceconfig",$$slots:{default:[Ip]},$$scope:{ctx:t}}}),f=new vl({props:{path:"/status",$$slots:{default:[Rp]},$$scope:{ctx:t}}}),_=new vl({props:{path:"/mqtt-ca",$$slots:{default:[Fp]},$$scope:{ctx:t}}}),h=new vl({props:{path:"/mqtt-cert",$$slots:{default:[Op]},$$scope:{ctx:t}}}),g=new vl({props:{path:"/mqtt-key",$$slots:{default:[qp]},$$scope:{ctx:t}}}),A=new vl({props:{path:"/consent",$$slots:{default:[Bp]},$$scope:{ctx:t}}}),P=new vl({props:{path:"/setup",$$slots:{default:[Up]},$$scope:{ctx:t}}}),I=new vl({props:{path:"/vendor",$$slots:{default:[jp]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment),n=b(),ae(l.$$.fragment),i=b(),ae(o.$$.fragment),u=b(),ae(m.$$.fragment),r=b(),ae(f.$$.fragment),p=b(),ae(_.$$.fragment),v=b(),ae(h.$$.fragment),d=b(),ae(g.$$.fragment),k=b(),ae(A.$$.fragment),T=b(),ae(P.$$.fragment),F=b(),ae(I.$$.fragment)},m(w,$){se(e,w,$),M(w,n,$),se(l,w,$),M(w,i,$),se(o,w,$),M(w,u,$),se(m,w,$),M(w,r,$),se(f,w,$),M(w,p,$),se(_,w,$),M(w,v,$),se(h,w,$),M(w,d,$),se(g,w,$),M(w,k,$),se(A,w,$),M(w,T,$),se(P,w,$),M(w,F,$),se(I,w,$),R=!0},p(w,$){const ie={};$&4&&(ie.data=w[2]),$&1&&(ie.basepath=w[0]),e.$set(ie);const j={};$&14&&(j.$$scope={dirty:$,ctx:w}),l.$set(j);const U={};$&11&&(U.$$scope={dirty:$,ctx:w}),o.$set(U);const H={};$&9&&(H.$$scope={dirty:$,ctx:w}),m.$set(H);const G={};$&14&&(G.$$scope={dirty:$,ctx:w}),f.$set(G);const V={};$&8&&(V.$$scope={dirty:$,ctx:w}),_.$set(V);const K={};$&8&&(K.$$scope={dirty:$,ctx:w}),h.$set(K);const Z={};$&8&&(Z.$$scope={dirty:$,ctx:w}),g.$set(Z);const z={};$&11&&(z.$$scope={dirty:$,ctx:w}),A.$set(z);const W={};$&10&&(W.$$scope={dirty:$,ctx:w}),P.$set(W);const x={};$&11&&(x.$$scope={dirty:$,ctx:w}),I.$set(x)},i(w){R||(L(e.$$.fragment,w),L(l.$$.fragment,w),L(o.$$.fragment,w),L(m.$$.fragment,w),L(f.$$.fragment,w),L(_.$$.fragment,w),L(h.$$.fragment,w),L(g.$$.fragment,w),L(A.$$.fragment,w),L(P.$$.fragment,w),L(I.$$.fragment,w),R=!0)},o(w){q(e.$$.fragment,w),q(l.$$.fragment,w),q(o.$$.fragment,w),q(m.$$.fragment,w),q(f.$$.fragment,w),q(_.$$.fragment,w),q(h.$$.fragment,w),q(g.$$.fragment,w),q(A.$$.fragment,w),q(P.$$.fragment,w),q(I.$$.fragment,w),R=!1},d(w){oe(e,w),w&&y(n),oe(l,w),w&&y(i),oe(o,w),w&&y(u),oe(m,w),w&&y(r),oe(f,w),w&&y(p),oe(_,w),w&&y(v),oe(h,w),w&&y(d),oe(g,w),w&&y(k),oe(A,w),w&&y(T),oe(P,w),w&&y(F),oe(I,w)}}}function Wp(t){let e,n,l,i;const o=[Vp,Gp],u=[];function m(r,f){return r[1].trying?0:1}return e=m(t),n=u[e]=o[e](t),{c(){n.c(),l=it()},m(r,f){u[e].m(r,f),M(r,l,f),i=!0},p(r,f){let p=e;e=m(r),e===p?u[e].p(r,f):($e(),q(u[p],1,1,()=>{u[p]=null}),De(),n=u[e],n?n.p(r,f):(n=u[e]=o[e](r),n.c()),L(n,1),n.m(l.parentNode,l))},i(r){i||(L(n),i=!0)},o(r){q(n),i=!1},d(r){u[e].d(r),r&&y(l)}}}function zp(t){let e,n;return e=new Tt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Gp(t){let e,n;return e=new Tt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Vp(t){let e,n;return e=new Tt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[1].trying}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.message="Device is booting, please wait. Trying to reach it on "+l[1].trying),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Kp(t){let e,n,l,i,o,u;n=new t0({props:{basepath:t[0],$$slots:{default:[Hp]},$$scope:{ctx:t}}});const m=[zp,Wp],r=[];function f(p,_){return p[1].upgrading?0:p[1].booting?1:-1}return~(i=f(t))&&(o=r[i]=m[i](t)),{c(){e=c("div"),ae(n.$$.fragment),l=b(),o&&o.c(),a(e,"class","container mx-auto m-3")},m(p,_){M(p,e,_),se(n,e,null),s(e,l),~i&&r[i].m(e,null),u=!0},p(p,[_]){const v={};_&1&&(v.basepath=p[0]),_&15&&(v.$$scope={dirty:_,ctx:p}),n.$set(v);let h=i;i=f(p),i===h?~i&&r[i].p(p,_):(o&&($e(),q(r[h],1,1,()=>{r[h]=null}),De()),~i?(o=r[i],o?o.p(p,_):(o=r[i]=m[i](p),o.c()),L(o,1),o.m(e,null)):o=null)},i(p){u||(L(n.$$.fragment,p),L(o),u=!0)},o(p){q(n.$$.fragment,p),q(o),u=!1},d(p){p&&y(e),oe(n),~i&&r[i].d()}}}function Yp(t,e,n){let l=document.getElementsByTagName("base")[0].getAttribute("href");l||(l="/");let i={};Yt.subscribe(u=>{n(1,i=u),i.vndcfg===!1?cn(l+"vendor"):i.usrcfg===!1?cn(l+"setup"):i.fwconsent===0&&cn(l+"consent"),i.ui.k===1?(console.log("dark"),document.documentElement.classList.add("dark")):i.ui.k===0?(console.log("light"),document.documentElement.classList.remove("dark")):window.matchMedia("(prefers-color-scheme: dark)").matches?(console.log("dark auto"),document.documentElement.classList.add("dark")):(console.log("light auto"),document.documentElement.classList.remove("dark"))}),Mo();let o={};return o0.subscribe(u=>{n(2,o=u)}),[l,i,o]}class Qp extends We{constructor(e){super(),He(this,e,Yp,Kp,Be,{})}}new Qp({target:document.getElementById("app")}); +
`,a(e,"class","my-3 flex")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function gp(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K,Z,z,W=t[0].if&&t[0].if.eth&&c1(),x=(t[2]==1||t[2]==2)&&m1(t),_e=t[1]&&_1(t),ie=t[1]&&p1();return G=new Pt({props:{active:t[3],message:"Saving your configuration to the device"}}),{c(){e=c("div"),n=c("div"),l=c("form"),i=c("input"),o=b(),u=c("strong"),u.textContent="Setup",m=b(),r=c("div"),f=E("Connection"),p=c("br"),_=b(),h=c("select"),v=c("option"),v.textContent="Connect to WiFi",d=c("option"),d.textContent="Standalone access point",W&&W.c(),g=b(),x&&x.c(),k=b(),$=c("div"),N=E(`Hostname + `),A=c("input"),F=b(),I=c("div"),R=c("label"),C=c("input"),P=E(" Static IP"),ne=b(),_e&&_e.c(),j=b(),ie&&ie.c(),B=b(),H=c("div"),H.innerHTML='',V=b(),ae(G.$$.fragment),a(i,"type","hidden"),a(i,"name","s"),i.value="true",a(u,"class","text-sm"),v.__value=1,v.value=v.__value,d.__value=2,d.value=d.__value,a(h,"name","sc"),a(h,"class","in-s"),t[2]===void 0&&Ze(()=>t[5].call(h)),a(r,"class","my-3"),a(A,"name","sh"),a(A,"type","text"),a(A,"class","in-s"),a(A,"maxlength","32"),a(A,"pattern","[a-z0-9_-]+"),a(A,"placeholder","Optional, ex.: ams-reader"),a(A,"autocomplete","off"),a(C,"type","checkbox"),a(C,"name","sm"),C.__value="static",C.value=C.__value,a(C,"class","rounded mb-1"),a(I,"class","my-3"),a(H,"class","my-3"),a(n,"class","cnt"),a(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(me,Y){M(me,e,Y),s(e,n),s(n,l),s(l,i),s(l,o),s(l,u),s(l,m),s(l,r),s(r,f),s(r,p),s(r,_),s(r,h),s(h,v),s(h,d),W&&W.m(h,null),Te(h,t[2],!0),s(l,g),x&&x.m(l,null),s(l,k),s(l,$),s($,N),s($,A),ue(A,t[0].hostname),s(l,F),s(l,I),s(I,R),s(R,C),C.checked=t[1],s(R,P),s(I,ne),_e&&_e.m(I,null),s(l,j),ie&&ie.m(l,null),s(l,B),s(l,H),M(me,V,Y),se(G,me,Y),K=!0,Z||(z=[Q(h,"change",t[5]),Q(A,"input",t[6]),Q(C,"change",t[7]),Q(l,"submit",ai(t[4]))],Z=!0)},p(me,[Y]){me[0].if&&me[0].if.eth?W||(W=c1(),W.c(),W.m(h,null)):W&&(W.d(1),W=null),Y&4&&Te(h,me[2]),me[2]==1||me[2]==2?x?x.p(me,Y):(x=m1(me),x.c(),x.m(l,k)):x&&(x.d(1),x=null),Y&1&&A.value!==me[0].hostname&&ue(A,me[0].hostname),Y&2&&(C.checked=me[1]),me[1]?_e?(_e.p(me,Y),Y&2&&L(_e,1)):(_e=_1(me),_e.c(),L(_e,1),_e.m(I,null)):_e&&($e(),q(_e,1,1,()=>{_e=null}),De()),me[1]?ie||(ie=p1(),ie.c(),ie.m(l,B)):ie&&(ie.d(1),ie=null);const ke={};Y&8&&(ke.active=me[3]),G.$set(ke)},i(me){K||(L(_e),L(G.$$.fragment,me),K=!0)},o(me){q(_e),q(G.$$.fragment,me),K=!1},d(me){me&&y(e),W&&W.d(),x&&x.d(),_e&&_e.d(),ie&&ie.d(),me&&y(V),oe(G,me),Z=!1,lt(z)}}}function kp(t,e,n){let{sysinfo:l={}}=e,i=!1,o=1,u=!1;function m(h){Tt.update(v=>(v.trying=h,v))}async function r(h){n(3,u=!0);const v=new FormData(h.target),d=new URLSearchParams;for(let $ of v){const[N,A]=$;d.append(N,A)}let k=await(await fetch("save",{method:"POST",body:d})).json();n(3,u=!1),Tt.update($=>($.hostname=v.get("sh"),$.usrcfg=k.success,$.booting=k.reboot,i&&($.net.ip=v.get("si"),$.net.mask=v.get("su"),$.net.gw=v.get("sg"),$.net.dns1=v.get("sd")),k.reboot&&setTimeout(Ei,5e3,l,m),$))}function f(){o=ot(this),n(2,o)}function p(){l.hostname=this.value,n(0,l)}function _(){i=this.checked,n(1,i)}return t.$$set=h=>{"sysinfo"in h&&n(0,l=h.sysinfo)},[l,i,o,u,r,f,p,_]}class wp extends We{constructor(e){super(),He(this,e,kp,gp,Be,{sysinfo:0})}}function Cp(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$;return d=new Pt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=c("div"),n=c("div"),l=c("strong"),i=E("Upload "),o=E(t[1]),u=b(),m=c("p"),m.textContent="Select a suitable file and click upload",r=b(),f=c("form"),p=c("input"),_=b(),h=c("div"),h.innerHTML='',v=b(),ae(d.$$.fragment),a(m,"class","mb-4"),a(p,"name","file"),a(p,"type","file"),a(h,"class","w-full text-right mt-4"),a(f,"action",t[0]),a(f,"enctype","multipart/form-data"),a(f,"method","post"),a(f,"autocomplete","off"),a(n,"class","cnt"),a(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(N,A){M(N,e,A),s(e,n),s(n,l),s(l,i),s(l,o),s(n,u),s(n,m),s(n,r),s(n,f),s(f,p),s(f,_),s(f,h),M(N,v,A),se(d,N,A),g=!0,k||($=Q(f,"submit",t[3]),k=!0)},p(N,[A]){(!g||A&2)&&X(o,N[1]),(!g||A&1)&&a(f,"action",N[0]);const F={};A&4&&(F.active=N[2]),d.$set(F)},i(N){g||(L(d.$$.fragment,N),g=!0)},o(N){q(d.$$.fragment,N),g=!1},d(N){N&&y(e),N&&y(v),oe(d,N),k=!1,$()}}}function yp(t,e,n){let{action:l}=e,{title:i}=e,o=!1;const u=()=>n(2,o=!0);return t.$$set=m=>{"action"in m&&n(0,l=m.action),"title"in m&&n(1,i=m.title)},[l,i,o,u]}class Do extends We{constructor(e){super(),He(this,e,yp,Cp,Be,{action:0,title:1})}}function Mp(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K;return H=new Pt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=c("div"),n=c("div"),l=c("form"),i=c("div"),i.textContent="Various permissions we need to do stuff:",o=b(),u=c("hr"),m=b(),r=c("div"),f=E("Enable one-click upgrade? (implies data collection)"),p=c("br"),_=b(),h=c("a"),v=E("Read more"),d=c("br"),g=b(),k=c("label"),$=c("input"),A=E(" Yes"),F=c("label"),I=c("input"),C=E(" No"),P=c("br"),ne=b(),j=c("div"),j.innerHTML='',B=b(),ae(H.$$.fragment),a(h,"href",Wt("Data-collection-on-one-click-firmware-upgrade")),a(h,"target","_blank"),a(h,"class","text-blue-600 hover:text-blue-800"),a($,"type","radio"),a($,"name","sf"),$.value=1,$.checked=N=t[0].fwconsent===1,a($,"class","rounded m-2"),$.required=!0,a(I,"type","radio"),a(I,"name","sf"),I.value=2,I.checked=R=t[0].fwconsent===2,a(I,"class","rounded m-2"),I.required=!0,a(r,"class","my-3"),a(j,"class","my-3"),a(l,"autocomplete","off"),a(n,"class","cnt"),a(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(Z,z){M(Z,e,z),s(e,n),s(n,l),s(l,i),s(l,o),s(l,u),s(l,m),s(l,r),s(r,f),s(r,p),s(r,_),s(r,h),s(h,v),s(r,d),s(r,g),s(r,k),s(k,$),s(k,A),s(r,F),s(F,I),s(F,C),s(r,P),s(l,ne),s(l,j),M(Z,B,z),se(H,Z,z),V=!0,G||(K=Q(l,"submit",ai(t[2])),G=!0)},p(Z,[z]){(!V||z&1&&N!==(N=Z[0].fwconsent===1))&&($.checked=N),(!V||z&1&&R!==(R=Z[0].fwconsent===2))&&(I.checked=R);const W={};z&2&&(W.active=Z[1]),H.$set(W)},i(Z){V||(L(H.$$.fragment,Z),V=!0)},o(Z){q(H.$$.fragment,Z),V=!1},d(Z){Z&&y(e),Z&&y(B),oe(H,Z),G=!1,K()}}}function Sp(t,e,n){let{basepath:l="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(m){n(1,o=!0);const r=new FormData(m.target),f=new URLSearchParams;for(let h of r){const[v,d]=h;f.append(v,d)}let _=await(await fetch("save",{method:"POST",body:f})).json();n(1,o=!1),Tt.update(h=>(h.fwconsent=r.sf===!0?1:r.sf===!1?2:0,h.booting=_.reboot,h)),mn(l)}return t.$$set=m=>{"basepath"in m&&n(3,l=m.basepath),"sysinfo"in m&&n(0,i=m.sysinfo)},[i,o,u,l]}class Tp extends We{constructor(e){super(),He(this,e,Sp,Mp,Be,{basepath:3,sysinfo:0})}}function d1(t,e,n){const l=t.slice();return l[23]=e[n],l[24]=e,l[25]=n,l}function h1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function Np(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function v1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function Ep(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function b1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function g1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function k1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function w1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function C1(t){let e,n,l=t[0].o,i=[];for(let u=0;uq(i[u],1,1,()=>{i[u]=null});return{c(){for(let u=0;uSave',F=b(),ae(I.$$.fragment),R=b(),ae(C.$$.fragment),a(n,"class","text-sm"),a(i,"href",Wt("Price-configuration")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"class","m-3"),a(p,"type","hidden"),a(p,"name","r"),p.value="true",a(g,"type","button"),a(g,"class","btn-pri"),a($,"class","text-center"),a(A,"class","text-right"),a(v,"class","grid grid-cols-3"),a(f,"autocomplete","off"),a(e,"class","cnt")},m(H,V){M(H,e,V),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(f,_),B&&B.m(f,null),s(f,h),s(f,v),s(v,d),s(d,g),s(v,k),s(v,$),s(v,N),s(v,A),M(H,F,V),se(I,H,V),M(H,R,V),se(C,H,V),P=!0,ne||(j=[Q(g,"click",t[6]),Q(f,"submit",ai(t[4]))],ne=!0)},p(H,V){H[0].o?B?(B.p(H,V),V[0]&1&&L(B,1)):(B=C1(H),B.c(),L(B,1),B.m(f,h)):B&&($e(),q(B,1,1,()=>{B=null}),De());const G={};V[0]&2&&(G.active=H[1]),I.$set(G);const K={};V[0]&4&&(K.active=H[2]),C.$set(K)},i(H){P||(L(o.$$.fragment,H),L(B),L(I.$$.fragment,H),L(C.$$.fragment,H),P=!0)},o(H){q(o.$$.fragment,H),q(B),q(I.$$.fragment,H),q(C.$$.fragment,H),P=!1},d(H){H&&y(e),oe(o),B&&B.d(),H&&y(F),oe(I,H),H&&y(R),oe(C,H),ne=!1,lt(j)}}}function Dp(t,e,n){let{basepath:l="/"}=e,i=["mo","tu","we","th","fr","sa","su"],o={},u=!0,m=!1;y0.subscribe(j=>{j.o&&(n(0,o=j),n(1,u=!1))}),v_();async function r(j){n(2,m=!0);const B=new URLSearchParams;B.append("r","true"),B.append("rc",o.o.length),o.o.forEach(function(V,G){B.append("rt"+G,V.t),B.append("rn"+G,V.n),B.append("rd"+G,V.d),B.append("ra"+G,V.a),B.append("rh"+G,V.h),B.append("rv"+G,V.v),B.append("rsm"+G,V.s.m),B.append("rsd"+G,V.s.d),B.append("rem"+G,V.e.m),B.append("red"+G,V.e.d)}),await(await fetch("save",{method:"POST",body:B})).json(),n(2,m=!1),mn(l+"configuration")}let f=function(j,B){return j.includes(B)?j=j.filter(function(H){return H!==B}):j.push(B),j},p=function(){let j=o.o;j.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),n(0,o.o=j,o)},_=function(j){let B=o.o;B.splice(j,1),n(0,o.o=B,o)};function h(j,B){j[B].n=this.value,n(0,o)}function v(j,B){j[B].d=ot(this),n(0,o)}function d(j,B){j[B].t=ot(this),n(0,o)}function g(j,B){j[B].v=Se(this.value),n(0,o)}const k=(j,B,H,V)=>n(0,H[V].a=f(j.a,B),o),$=(j,B,H,V)=>n(0,H[V].h=f(j.h,B),o),N=(j,B,H,V)=>n(0,H[V].h=f(j.h,B+8),o),A=(j,B,H,V)=>n(0,H[V].h=f(j.h,B+16),o);function F(j,B){j[B].s.m=ot(this),n(0,o)}function I(j,B){j[B].s.d=ot(this),n(0,o)}function R(j,B){j[B].e.m=ot(this),n(0,o)}function C(j,B){j[B].e.d=ot(this),n(0,o)}const P=j=>_(j),ne=j=>_(j);return t.$$set=j=>{"basepath"in j&&n(8,l=j.basepath)},[o,u,m,i,r,f,p,_,l,h,v,d,g,k,$,N,A,F,I,R,C,P,ne]}class Lp extends We{constructor(e){super(),He(this,e,Dp,$p,Be,{basepath:8},null,[-1,-1])}}function Ip(t){let e,n;return e=new d_({props:{data:t[2],sysinfo:t[1]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&4&&(o.data=l[2]),i&2&&(o.sysinfo=l[1]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Rp(t){let e,n;return e=new ep({props:{sysinfo:t[1],basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),i&1&&(o.basepath=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Fp(t){let e,n;return e=new Lp({props:{basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.basepath=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Op(t){let e,n;return e=new mp({props:{sysinfo:t[1],data:t[2]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),i&4&&(o.data=l[2]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function qp(t){let e,n;return e=new Do({props:{title:"CA",action:"/mqtt-ca"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Bp(t){let e,n;return e=new Do({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Up(t){let e,n;return e=new Do({props:{title:"private key",action:"/mqtt-key"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function jp(t){let e,n;return e=new Tp({props:{sysinfo:t[1],basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),i&1&&(o.basepath=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Hp(t){let e,n;return e=new wp({props:{sysinfo:t[1]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Wp(t){let e,n;return e=new bp({props:{sysinfo:t[1],basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),i&1&&(o.basepath=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function zp(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R;return e=new Tm({props:{data:t[2],basepath:t[0]}}),l=new bl({props:{path:"/",$$slots:{default:[Ip]},$$scope:{ctx:t}}}),o=new bl({props:{path:"/configuration",$$slots:{default:[Rp]},$$scope:{ctx:t}}}),m=new bl({props:{path:"/priceconfig",$$slots:{default:[Fp]},$$scope:{ctx:t}}}),f=new bl({props:{path:"/status",$$slots:{default:[Op]},$$scope:{ctx:t}}}),_=new bl({props:{path:"/mqtt-ca",$$slots:{default:[qp]},$$scope:{ctx:t}}}),v=new bl({props:{path:"/mqtt-cert",$$slots:{default:[Bp]},$$scope:{ctx:t}}}),g=new bl({props:{path:"/mqtt-key",$$slots:{default:[Up]},$$scope:{ctx:t}}}),$=new bl({props:{path:"/consent",$$slots:{default:[jp]},$$scope:{ctx:t}}}),A=new bl({props:{path:"/setup",$$slots:{default:[Hp]},$$scope:{ctx:t}}}),I=new bl({props:{path:"/vendor",$$slots:{default:[Wp]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment),n=b(),ae(l.$$.fragment),i=b(),ae(o.$$.fragment),u=b(),ae(m.$$.fragment),r=b(),ae(f.$$.fragment),p=b(),ae(_.$$.fragment),h=b(),ae(v.$$.fragment),d=b(),ae(g.$$.fragment),k=b(),ae($.$$.fragment),N=b(),ae(A.$$.fragment),F=b(),ae(I.$$.fragment)},m(C,P){se(e,C,P),M(C,n,P),se(l,C,P),M(C,i,P),se(o,C,P),M(C,u,P),se(m,C,P),M(C,r,P),se(f,C,P),M(C,p,P),se(_,C,P),M(C,h,P),se(v,C,P),M(C,d,P),se(g,C,P),M(C,k,P),se($,C,P),M(C,N,P),se(A,C,P),M(C,F,P),se(I,C,P),R=!0},p(C,P){const ne={};P&4&&(ne.data=C[2]),P&1&&(ne.basepath=C[0]),e.$set(ne);const j={};P&14&&(j.$$scope={dirty:P,ctx:C}),l.$set(j);const B={};P&11&&(B.$$scope={dirty:P,ctx:C}),o.$set(B);const H={};P&9&&(H.$$scope={dirty:P,ctx:C}),m.$set(H);const V={};P&14&&(V.$$scope={dirty:P,ctx:C}),f.$set(V);const G={};P&8&&(G.$$scope={dirty:P,ctx:C}),_.$set(G);const K={};P&8&&(K.$$scope={dirty:P,ctx:C}),v.$set(K);const Z={};P&8&&(Z.$$scope={dirty:P,ctx:C}),g.$set(Z);const z={};P&11&&(z.$$scope={dirty:P,ctx:C}),$.$set(z);const W={};P&10&&(W.$$scope={dirty:P,ctx:C}),A.$set(W);const x={};P&11&&(x.$$scope={dirty:P,ctx:C}),I.$set(x)},i(C){R||(L(e.$$.fragment,C),L(l.$$.fragment,C),L(o.$$.fragment,C),L(m.$$.fragment,C),L(f.$$.fragment,C),L(_.$$.fragment,C),L(v.$$.fragment,C),L(g.$$.fragment,C),L($.$$.fragment,C),L(A.$$.fragment,C),L(I.$$.fragment,C),R=!0)},o(C){q(e.$$.fragment,C),q(l.$$.fragment,C),q(o.$$.fragment,C),q(m.$$.fragment,C),q(f.$$.fragment,C),q(_.$$.fragment,C),q(v.$$.fragment,C),q(g.$$.fragment,C),q($.$$.fragment,C),q(A.$$.fragment,C),q(I.$$.fragment,C),R=!1},d(C){oe(e,C),C&&y(n),oe(l,C),C&&y(i),oe(o,C),C&&y(u),oe(m,C),C&&y(r),oe(f,C),C&&y(p),oe(_,C),C&&y(h),oe(v,C),C&&y(d),oe(g,C),C&&y(k),oe($,C),C&&y(N),oe(A,C),C&&y(F),oe(I,C)}}}function Gp(t){let e,n,l,i;const o=[Yp,Kp],u=[];function m(r,f){return r[1].trying?0:1}return e=m(t),n=u[e]=o[e](t),{c(){n.c(),l=it()},m(r,f){u[e].m(r,f),M(r,l,f),i=!0},p(r,f){let p=e;e=m(r),e===p?u[e].p(r,f):($e(),q(u[p],1,1,()=>{u[p]=null}),De(),n=u[e],n?n.p(r,f):(n=u[e]=o[e](r),n.c()),L(n,1),n.m(l.parentNode,l))},i(r){i||(L(n),i=!0)},o(r){q(n),i=!1},d(r){u[e].d(r),r&&y(l)}}}function Vp(t){let e,n;return e=new Pt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Kp(t){let e,n;return e=new Pt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Yp(t){let e,n;return e=new Pt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[1].trying}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.message="Device is booting, please wait. Trying to reach it on "+l[1].trying),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Qp(t){let e,n,l,i,o,u;n=new n0({props:{basepath:t[0],$$slots:{default:[zp]},$$scope:{ctx:t}}});const m=[Vp,Gp],r=[];function f(p,_){return p[1].upgrading?0:p[1].booting?1:-1}return~(i=f(t))&&(o=r[i]=m[i](t)),{c(){e=c("div"),ae(n.$$.fragment),l=b(),o&&o.c(),a(e,"class","container mx-auto m-3")},m(p,_){M(p,e,_),se(n,e,null),s(e,l),~i&&r[i].m(e,null),u=!0},p(p,[_]){const h={};_&1&&(h.basepath=p[0]),_&15&&(h.$$scope={dirty:_,ctx:p}),n.$set(h);let v=i;i=f(p),i===v?~i&&r[i].p(p,_):(o&&($e(),q(r[v],1,1,()=>{r[v]=null}),De()),~i?(o=r[i],o?o.p(p,_):(o=r[i]=m[i](p),o.c()),L(o,1),o.m(e,null)):o=null)},i(p){u||(L(n.$$.fragment,p),L(o),u=!0)},o(p){q(n.$$.fragment,p),q(o),u=!1},d(p){p&&y(e),oe(n),~i&&r[i].d()}}}function Xp(t,e,n){let l=document.getElementsByTagName("base")[0].getAttribute("href");l||(l="/");let i={};Tt.subscribe(u=>{n(1,i=u),i.vndcfg===!1?mn(l+"vendor"):i.usrcfg===!1?mn(l+"setup"):i.fwconsent===0&&mn(l+"consent"),i.ui.k===1?(console.log("dark"),document.documentElement.classList.add("dark")):i.ui.k===0?(console.log("light"),document.documentElement.classList.remove("dark")):window.matchMedia("(prefers-color-scheme: dark)").matches?(console.log("dark auto"),document.documentElement.classList.add("dark")):(console.log("light auto"),document.documentElement.classList.remove("dark"))}),To();let o={};return r0.subscribe(u=>{n(2,o=u)}),[l,i,o]}class Zp extends We{constructor(e){super(),He(this,e,Xp,Qp,Be,{})}}new Zp({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte index 05827bdf..3afdad60 100644 --- a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte +++ b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte @@ -11,6 +11,7 @@ import SubnetOptions from './SubnetOptions.svelte'; import TrashIcon from './TrashIcon.svelte'; import QrCode from 'svelte-qrcode'; + import { scanForDevice } from './Helpers.js'; export let basepath = "/"; export let sysinfo = {}; @@ -142,6 +143,13 @@ } } + function updateSysinfo(url) { + sysinfoStore.update(s => { + s.trying = url; + return s; + }); + } + async function handleSubmit(e) { saving = true; const formData = new FormData(e.target); @@ -157,6 +165,20 @@ }); let res = (await response.json()) + sysinfoStore.update(s => { + s.hostname = formData.get('gh'); + s.usrcfg = res.success; + s.booting = res.reboot; + if(formData.get('nm') == 'static') { + s.net.ip = formData.get('ni'); + s.net.mask = formData.get('nu'); + s.net.gw = formData.get('ng'); + s.net.dns1 = formData.get('nd'); + } + setTimeout(scanForDevice, 5000, sysinfo, updateSysinfo); + return s; + }); + sysinfoStore.update(s => { s.booting = res.reboot; s.ui = configuration.u; diff --git a/lib/SvelteUi/app/src/lib/Helpers.js b/lib/SvelteUi/app/src/lib/Helpers.js index f58b5d40..2b432052 100644 --- a/lib/SvelteUi/app/src/lib/Helpers.js +++ b/lib/SvelteUi/app/src/lib/Helpers.js @@ -292,3 +292,40 @@ export function getPriceSourceUrl(code) { if(code == "EDS") return "https://www.energidataservice.dk/"; return "#"; } + +let tries = 0; +export function scanForDevice(sysinfo, updateFn) { + var url = ""; + tries++; + + var retry = function() { + setTimeout(scanForDevice, 1000, sysinfo, updateFn); + }; + + if(sysinfo.net.ip && tries%3 == 0) { + if(!sysinfo.net.ip) { + retry(); + return; + }; + url = "http://" + sysinfo.net.ip; + } else if(sysinfo.hostname && tries%3 == 1) { + url = "http://" + sysinfo.hostname; + } else if(sysinfo.hostname && tries%3 == 2) { + url = "http://" + sysinfo.hostname + ".local"; + } else { + url = ""; + } + if(console) console.log("Trying url " + url); + if(updateFn) updateFn(url); + + var xhr = new XMLHttpRequest(); + xhr.timeout = 5000; + xhr.addEventListener('abort', retry); + xhr.addEventListener('error', retry); + xhr.addEventListener('timeout', retry); + xhr.addEventListener('load', function(e) { + window.location.href = url ? url : "/"; + }); + xhr.open("GET", url + "/is-alive", true); + xhr.send(); +}; diff --git a/lib/SvelteUi/app/src/lib/SetupPanel.svelte b/lib/SvelteUi/app/src/lib/SetupPanel.svelte index 6d23832e..6a30de28 100644 --- a/lib/SvelteUi/app/src/lib/SetupPanel.svelte +++ b/lib/SvelteUi/app/src/lib/SetupPanel.svelte @@ -2,6 +2,7 @@ import { sysinfoStore } from './DataStores.js'; import Mask from './Mask.svelte' import SubnetOptions from './SubnetOptions.svelte'; + import { scanForDevice } from './Helpers.js'; export let sysinfo = {} @@ -9,45 +10,12 @@ let connectionMode = 1; let loadingOrSaving = false; - let tries = 0; - function scanForDevice() { - var url = ""; - tries++; - - var retry = function() { - setTimeout(scanForDevice, 1000); - }; - - if(sysinfo.net.ip && tries%3 == 0) { - if(!sysinfo.net.ip) { - retry(); - return; - }; - url = "http://" + sysinfo.net.ip; - } else if(sysinfo.hostname && tries%3 == 1) { - url = "http://" + sysinfo.hostname; - } else if(sysinfo.hostname && tries%3 == 2) { - url = "http://" + sysinfo.hostname + ".local"; - } else { - url = ""; - } - if(console) console.log("Trying url " + url); + function updateSysinfo(url) { sysinfoStore.update(s => { s.trying = url; return s; }); - - var xhr = new XMLHttpRequest(); - xhr.timeout = 5000; - xhr.addEventListener('abort', retry); - xhr.addEventListener('error', retry); - xhr.addEventListener('timeout', retry); - xhr.addEventListener('load', function(e) { - window.location.href = url ? url : "/"; - }); - xhr.open("GET", url + "/is-alive", true); - xhr.send(); - }; + } async function handleSubmit(e) { loadingOrSaving = true; @@ -75,7 +43,7 @@ s.net.gw = formData.get('sg'); s.net.dns1 = formData.get('sd'); } - setTimeout(scanForDevice, 5000); + if(res.reboot) setTimeout(scanForDevice, 5000, sysinfo, updateSysinfo); return s; }); } diff --git a/lib/SvelteUi/app/src/lib/StatusPage.svelte b/lib/SvelteUi/app/src/lib/StatusPage.svelte index 25ce684d..6372f611 100644 --- a/lib/SvelteUi/app/src/lib/StatusPage.svelte +++ b/lib/SvelteUi/app/src/lib/StatusPage.svelte @@ -6,6 +6,7 @@ import { Link } from 'svelte-navigator'; import Clock from './Clock.svelte'; import Mask from './Mask.svelte'; + import { scanForDevice } from './Helpers.js'; export let data; export let sysinfo; @@ -82,6 +83,54 @@ let configUploading = false; getSysinfo(); + + let newconfig = { + hostname: '', + ip: '' + }; + + function uploadConfigFile(e) { + configUploading=true; + const formData = new FormData(); + formData.append('file', configFiles[0]); + + const upload = fetch('/configfile', { + method: 'POST', + body: formData + }).then((response) => response.json()).then((res) => { + sysinfoStore.update(s => { + console.log('updating sysinfo with: ', newconfig); + if(newconfig && newconfig.hostname) s.hostname = newconfig.hostname; + s.booting = res.reboot; + if(newconfig && newconfig.ip) s.net.ip = newconfig.ip; + setTimeout(scanForDevice, 5000, sysinfo); + return s; + }); + }).catch((error) => { + console.error('Error:', error); + setTimeout(scanForDevice, 5000, sysinfo); + }); + }; + + $: { + if(configFiles.length == 1) { + let file = configFiles[0]; + let reader = new FileReader(); + let parseConfigFile = ( e ) => { + let lines = e.target.result.split('\n'); + for(let i in lines) { + let line = lines[i]; + if(line.startsWith('hostname ')) { + newconfig.hostname = line.split(' ')[1]; + } else if(line.startsWith('ip ')) { + newconfig.ip = line.split(' ')[1]; + } + } + }; + reader.onload = parseConfigFile; + reader.readAsText(file); + } + }
@@ -209,7 +258,7 @@ {/if} -
configUploading=true} autocomplete="off"> + {#if configFiles.length == 0} diff --git a/lib/SvelteUi/app/vite.config.js b/lib/SvelteUi/app/vite.config.js index 1c7eda4d..8b103071 100644 --- a/lib/SvelteUi/app/vite.config.js +++ b/lib/SvelteUi/app/vite.config.js @@ -17,23 +17,23 @@ export default defineConfig({ plugins: [svelte()], server: { proxy: { - "/data.json": "http://192.168.233.115", - "/energyprice.json": "http://192.168.233.115", - "/dayplot.json": "http://192.168.233.115", - "/monthplot.json": "http://192.168.233.115", - "/temperature.json": "http://192.168.233.115", - "/sysinfo.json": "http://192.168.233.115", - "/configuration.json": "http://192.168.233.115", - "/tariff.json": "http://192.168.233.115", - "/realtime.json": "http://192.168.233.115", - "/priceconfig.json": "http://192.168.233.115", - "/save": "http://192.168.233.115", - "/reboot": "http://192.168.233.115", - "/configfile": "http://192.168.233.115", - "/upgrade": "http://192.168.233.115", - "/mqtt-ca": "http://192.168.233.115", - "/mqtt-cert": "http://192.168.233.115", - "/mqtt-key": "http://192.168.233.115", + "/data.json": "http://192.168.21.87", + "/energyprice.json": "http://192.168.21.87", + "/dayplot.json": "http://192.168.21.87", + "/monthplot.json": "http://192.168.21.87", + "/temperature.json": "http://192.168.21.87", + "/sysinfo.json": "http://192.168.21.87", + "/configuration.json": "http://192.168.21.87", + "/tariff.json": "http://192.168.21.87", + "/realtime.json": "http://192.168.21.87", + "/priceconfig.json": "http://192.168.21.87", + "/save": "http://192.168.21.87", + "/reboot": "http://192.168.21.87", + "/configfile": "http://192.168.21.87", + "/upgrade": "http://192.168.21.87", + "/mqtt-ca": "http://192.168.21.87", + "/mqtt-cert": "http://192.168.21.87", + "/mqtt-key": "http://192.168.21.87", } } }) diff --git a/lib/SvelteUi/include/AmsWebServer.h b/lib/SvelteUi/include/AmsWebServer.h index 21875f2d..d2f9bf96 100644 --- a/lib/SvelteUi/include/AmsWebServer.h +++ b/lib/SvelteUi/include/AmsWebServer.h @@ -140,6 +140,7 @@ private: void configFileDownload(); void configFileUpload(); + void configFilePost(); void factoryResetPost(); void notFound(); diff --git a/lib/SvelteUi/src/AmsWebServer.cpp b/lib/SvelteUi/src/AmsWebServer.cpp index e309ab20..29096fde 100644 --- a/lib/SvelteUi/src/AmsWebServer.cpp +++ b/lib/SvelteUi/src/AmsWebServer.cpp @@ -143,7 +143,7 @@ void AmsWebServer::setup(AmsConfiguration* config, GpioConfig* gpioConfig, AmsDa server.on(context + F("/mqtt-cert"), HTTP_POST, std::bind(&AmsWebServer::mqttCertDelete, this), std::bind(&AmsWebServer::mqttCertUpload, this)); server.on(context + F("/mqtt-key"), HTTP_POST, std::bind(&AmsWebServer::mqttKeyDelete, this), std::bind(&AmsWebServer::mqttKeyUpload, this)); - server.on(context + F("/configfile"), HTTP_POST, std::bind(&AmsWebServer::firmwarePost, this), std::bind(&AmsWebServer::configFileUpload, this)); + server.on(context + F("/configfile"), HTTP_POST, std::bind(&AmsWebServer::configFilePost, this), std::bind(&AmsWebServer::configFileUpload, this)); server.on(context + F("/configfile.cfg"), HTTP_GET, std::bind(&AmsWebServer::configFileDownload, this)); /* These trigger captive portal. Only problem is that after you have "signed in", the portal is closed and the user has no idea how to reach the device @@ -2637,6 +2637,16 @@ void AmsWebServer::configFileDownload() { } } +void AmsWebServer::configFilePost() { + snprintf_P(buf, BufferSize, RESPONSE_JSON, + "true", + "", + performRestart ? "true" : "false" + ); + server.setContentLength(strlen(buf)); + server.send(200, MIME_JSON, buf); +} + void AmsWebServer::configFileUpload() { if(!checkSecurity(1)) return; @@ -2644,8 +2654,28 @@ void AmsWebServer::configFileUpload() { HTTPUpload& upload = uploadFile(FILE_CFG); if(upload.status == UPLOAD_FILE_END) { performRestart = true; - server.sendHeader(HEADER_LOCATION,F("/")); - server.send(303); + snprintf_P(buf, BufferSize, RESPONSE_JSON, + "true", + "", + performRestart ? "true" : "false" + ); + server.setContentLength(strlen(buf)); + server.send(200, MIME_JSON, buf); + + if(performRestart || rebootForUpgrade) { + server.handleClient(); + delay(250); + + if(ds != NULL) { + ds->save(); + } + if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Rebooting\n")); + debugger->flush(); + delay(1000); + rdc->cause = 6; + performRestart = false; + ESP.restart(); + } } }