diff --git a/lib/AmsConfiguration/include/AmsConfiguration.h b/lib/AmsConfiguration/include/AmsConfiguration.h index 60e4c1f5..8116a30c 100644 --- a/lib/AmsConfiguration/include/AmsConfiguration.h +++ b/lib/AmsConfiguration/include/AmsConfiguration.h @@ -95,7 +95,9 @@ struct MqttConfig { uint8_t magic; bool stateUpdate; uint16_t stateUpdateInterval; -}; // 680 + uint16_t timeout; + uint8_t keepalive; +}; // 685 struct WebConfig { uint8_t security; diff --git a/lib/AmsConfiguration/src/AmsConfiguration.cpp b/lib/AmsConfiguration/src/AmsConfiguration.cpp index a823eec9..f6944230 100644 --- a/lib/AmsConfiguration/src/AmsConfiguration.cpp +++ b/lib/AmsConfiguration/src/AmsConfiguration.cpp @@ -147,10 +147,14 @@ bool AmsConfiguration::getMqttConfig(MqttConfig& config) { EEPROM.begin(EEPROM_SIZE); EEPROM.get(CONFIG_MQTT_START, config); EEPROM.end(); - if(config.magic != 0x7B) { - config.stateUpdate = false; - config.stateUpdateInterval = 10; - config.magic = 0x7B; + if(config.magic != 0x9C) { + if(config.magic != 0x7B) { + config.stateUpdate = false; + config.stateUpdateInterval = 10; + } + config.timeout = 1000; + config.keepalive = 60; + config.magic = 0x9C; } return true; } else { @@ -183,6 +187,10 @@ bool AmsConfiguration::setMqttConfig(MqttConfig& config) { stripNonAscii((uint8_t*) config.subscribeTopic, 64); stripNonAscii((uint8_t*) config.username, 128); stripNonAscii((uint8_t*) config.password, 256); + if(config.timeout < 500) config.timeout = 1000; + if(config.timeout > 10000) config.timeout = 1000; + if(config.keepalive < 5) config.keepalive = 60; + if(config.keepalive > 240) config.keepalive = 60; EEPROM.begin(EEPROM_SIZE); EEPROM.put(CONFIG_MQTT_START, config); @@ -205,6 +213,8 @@ void AmsConfiguration::clearMqtt(MqttConfig& config) { config.magic = 0x7B; config.stateUpdate = false; config.stateUpdateInterval = 10; + config.timeout = 1000; + config.keepalive = 60; } void AmsConfiguration::setMqttChanged() { diff --git a/lib/AmsMqttHandler/src/AmsMqttHandler.cpp b/lib/AmsMqttHandler/src/AmsMqttHandler.cpp index b8ba10cf..57d2eae0 100644 --- a/lib/AmsMqttHandler/src/AmsMqttHandler.cpp +++ b/lib/AmsMqttHandler/src/AmsMqttHandler.cpp @@ -100,6 +100,7 @@ bool AmsMqttHandler::connect() { } mqttConfigChanged = false; + mqtt.setTimeout(mqttConfig.timeout); mqtt.begin(mqttConfig.host, mqttConfig.port, *actualClient); String statusTopic = String(mqttConfig.publishTopic) + "/status"; mqtt.setWill(statusTopic.c_str(), "offline", true, 0); diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index 22b8b76c..36ab0edb 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,7 +1,7 @@ -var gu=Object.defineProperty;var ku=(t,e,l)=>e in t?gu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[e]=l;var Zn=(t,e,l)=>(ku(t,typeof e!="symbol"?e+"":e,l),l);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=l(i);fetch(i.href,s)}})();function Ve(){}function pl(t,e){for(const l in e)t[l]=e[l];return t}function Mf(t){return t()}function $i(){return Object.create(null)}function Lt(t){t.forEach(Mf)}function Mi(t){return typeof t=="function"}function St(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let In;function zn(t,e){return t===e?!0:(In||(In=document.createElement("a")),In.href=e,t===In.href)}function wu(t){return Object.keys(t).length===0}function Ni(t,...e){if(t==null){for(const n of e)n(void 0);return Ve}const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function Hl(t){let e;return Ni(t,l=>e=l)(),e}function Nl(t,e,l){t.$$.on_destroy.push(Ni(e,l))}function Ti(t,e,l,n){if(t){const i=Nf(t,e,l,n);return t[0](i)}}function Nf(t,e,l,n){return t[1]&&n?pl(l.ctx.slice(),t[1](n(e))):l.ctx}function Pi(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const s=[],a=Math.max(e.dirty.length,i.length);for(let r=0;r32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function zl(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const Su=["width","height"];function Zl(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&Su.indexOf(n)===-1?t[n]=e[n]:u(t,n,e[n])}function Ke(t){return t===""?null:+t}function Mu(t){return Array.from(t.childNodes)}function q(t,e){e=""+e,t.data!==e&&(t.data=e)}function Nu(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Tu(t,e,l){~Cu.indexOf(l)?Nu(t,e):q(t,e)}function y(t,e){t.value=e??""}function Ol(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Xe(t,e,l){for(let n=0;n{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{s=ce(n.contentWindow,"resize",e),e()}),o(t,n),()=>{(i||s&&n.contentWindow)&&s(),T(n)}}function Eu(t,e,{bubbles:l=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:l,cancelable:n})}function xi(t,e){return new t(e)}let Pn;function Nn(t){Pn=t}function Dn(){if(!Pn)throw new Error("Function called outside component initialization");return Pn}function Tf(t){Dn().$$.on_mount.push(t)}function qu(t){Dn().$$.on_destroy.push(t)}function Du(){const t=Dn();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const s=Eu(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,s)}),!s.defaultPrevented}return!0}}function Tn(t,e){return Dn().$$.context.set(t,e),e}function Rl(t){return Dn().$$.context.get(t)}const Kl=[],Vn=[];let Ql=[];const es=[],Pf=Promise.resolve();let si=!1;function Ef(){si||(si=!0,Pf.then(qf))}function Au(){return Ef(),Pf}function At(t){Ql.push(t)}const Jn=new Set;let Gl=0;function qf(){if(Gl!==0)return;const t=Pn;do{try{for(;Glt.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),Ql=e}const Hn=new Set;let Bl;function ht(){Bl={r:0,c:[],p:Bl}}function vt(){Bl.r||Lt(Bl.c),Bl=Bl.p}function Z(t,e){t&&t.i&&(Hn.delete(t),t.i(e))}function ie(t,e,l,n){if(t&&t.o){if(Hn.has(t))return;Hn.add(t),Bl.c.push(()=>{Hn.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function gt(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function oi(t,e){const l={},n={},i={$$scope:1};let s=t.length;for(;s--;){const a=t[s],r=e[s];if(r){for(const f in a)f in r||(n[f]=1);for(const f in r)i[f]||(l[f]=r[f],i[f]=1);t[s]=r}else for(const f in a)i[f]=1}for(const a in n)a in l||(l[a]=void 0);return l}function Fn(t){return typeof t=="object"&&t!==null?t:{}}function Te(t){t&&t.c()}function Me(t,e,l){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,l),At(()=>{const s=t.$$.on_mount.map(Mf).filter(Mi);t.$$.on_destroy?t.$$.on_destroy.push(...s):Lt(s),t.$$.on_mount=[]}),i.forEach(At)}function Ne(t,e){const l=t.$$;l.fragment!==null&&(Ou(l.after_update),Lt(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function Iu(t,e){t.$$.dirty[0]===-1&&(Kl.push(t),Ef(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const b=h.length?h[0]:d;return c.ctx&&i(c.ctx[m],c.ctx[m]=b)&&(!c.skip_bound&&c.bound[m]&&c.bound[m](b),_&&Iu(t,m)),d}):[],c.update(),_=!0,Lt(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const m=Mu(e.target);c.fragment&&c.fragment.l(m),m.forEach(T)}else c.fragment&&c.fragment.c();e.intro&&Z(t.$$.fragment),Me(t,e.target,e.anchor),qf()}Nn(f)}class Nt{constructor(){Zn(this,"$$");Zn(this,"$$set")}$destroy(){Ne(this,1),this.$destroy=Ve}$on(e,l){if(!Mi(l))return Ve;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!wu(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ru="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ru);const ts=t=>typeof t>"u",Df=t=>typeof t=="function",Af=t=>typeof t=="number";function Fu(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Lf(){let t=0;return()=>t++}function Bu(){return Math.random().toString(36).substring(2)}const Dl=typeof window>"u";function Of(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const If=(t,e)=>t?{}:{style:e},ai=t=>({"aria-hidden":"true",...If(t,"display:none;")}),Vl=[];function Rf(t,e){return{subscribe:nl(t,e).subscribe}}function nl(t,e=Ve){let l;const n=new Set;function i(r){if(St(t,r)&&(t=r,l)){const f=!Vl.length;for(const c of n)c[1](),Vl.push(c,t);if(f){for(let c=0;c{n.delete(c),n.size===0&&l&&(l(),l=null)}}return{set:i,update:s,subscribe:a}}function Uu(t,e,l){const n=!Array.isArray(t),i=n?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=e.length<2;return Rf(l,(a,r)=>{let f=!1;const c=[];let _=0,m=Ve;const d=()=>{if(_)return;m();const b=e(n?c[0]:c,a,r);s?a(b):m=Mi(b)?b:Ve},h=i.map((b,g)=>Ni(b,k=>{c[g]=k,_&=~(1<{_|=1<`@@svnav-ctx__${t}`,fi=An("LOCATION"),Jl=An("ROUTER"),Ff=An("ROUTE"),ju=An("ROUTE_PARAMS"),Hu=An("FOCUS_ELEM"),Bf=/^:(.+)/,Cn=(t,e,l)=>t.substr(e,l),ui=(t,e)=>Cn(t,0,e.length)===e,yu=t=>t==="",zu=t=>Bf.test(t),Uf=t=>t[0]==="*",Wu=t=>t.replace(/\*.*$/,""),jf=t=>t.replace(/(^\/+|\/+$)/g,"");function Tl(t,e=!1){const l=jf(t).split("/");return e?l.filter(Boolean):l}const $n=(t,e)=>t+(e?`?${e}`:""),Ai=t=>`/${jf(t)}`;function Ln(...t){const e=n=>Tl(n,!0).join("/"),l=t.map(e).join("/");return Ai(l)}const Li=1,Xn=2,yl=3,Gu=4,Hf=5,Vu=6,yf=7,Ku=8,Yu=9,zf=10,Wf=11,Qu={[Li]:"Link",[Xn]:"Route",[yl]:"Router",[Gu]:"useFocus",[Hf]:"useLocation",[Vu]:"useMatch",[yf]:"useNavigate",[Ku]:"useParams",[Yu]:"useResolvable",[zf]:"useResolve",[Wf]:"navigate"},Oi=t=>Qu[t];function Xu(t,e){let l;return t===Xn?l=e.path?`path="${e.path}"`:"default":t===Li?l=`to="${e.to}"`:t===yl&&(l=`basepath="${e.basepath||""}"`),`<${Oi(t)} ${l||""} />`}function Zu(t,e,l,n){const i=l&&Xu(n||t,l),s=i?` +var gu=Object.defineProperty;var ku=(t,e,l)=>e in t?gu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[e]=l;var Zn=(t,e,l)=>(ku(t,typeof e!="symbol"?e+"":e,l),l);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=l(i);fetch(i.href,s)}})();function We(){}function hl(t,e){for(const l in e)t[l]=e[l];return t}function Mf(t){return t()}function $i(){return Object.create(null)}function Ut(t){t.forEach(Mf)}function Mi(t){return typeof t=="function"}function Tt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let On;function zn(t,e){return t===e?!0:(On||(On=document.createElement("a")),On.href=e,t===On.href)}function wu(t){return Object.keys(t).length===0}function Ni(t,...e){if(t==null){for(const n of e)n(void 0);return We}const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function an(t){let e;return Ni(t,l=>e=l)(),e}function Nl(t,e,l){t.$$.on_destroy.push(Ni(e,l))}function Ti(t,e,l,n){if(t){const i=Nf(t,e,l,n);return t[0](i)}}function Nf(t,e,l,n){return t[1]&&n?hl(l.ctx.slice(),t[1](n(e))):l.ctx}function Pi(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const s=[],a=Math.max(e.dirty.length,i.length);for(let r=0;r32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function un(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const Su=["width","height"];function vn(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&Su.indexOf(n)===-1?t[n]=e[n]:u(t,n,e[n])}function He(t){return t===""?null:+t}function Mu(t){return Array.from(t.childNodes)}function E(t,e){e=""+e,t.data!==e&&(t.data=e)}function Nu(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Tu(t,e,l){~Cu.indexOf(l)?Nu(t,e):E(t,e)}function H(t,e){t.value=e??""}function xl(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Qe(t,e,l){for(let n=0;n{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{s=ce(n.contentWindow,"resize",e),e()}),o(t,n),()=>{(i||s&&n.contentWindow)&&s(),T(n)}}function Eu(t,e,{bubbles:l=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:l,cancelable:n})}function xi(t,e){return new t(e)}let Pn;function Nn(t){Pn=t}function Dn(){if(!Pn)throw new Error("Function called outside component initialization");return Pn}function Tf(t){Dn().$$.on_mount.push(t)}function qu(t){Dn().$$.on_destroy.push(t)}function Du(){const t=Dn();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const s=Eu(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,s)}),!s.defaultPrevented}return!0}}function Tn(t,e){return Dn().$$.context.set(t,e),e}function tn(t){return Dn().$$.context.get(t)}const _n=[],Vn=[];let dn=[];const es=[],Pf=Promise.resolve();let si=!1;function Ef(){si||(si=!0,Pf.then(qf))}function Au(){return Ef(),Pf}function Bt(t){dn.push(t)}const Jn=new Set;let cn=0;function qf(){if(cn!==0)return;const t=Pn;do{try{for(;cn<_n.length;){const e=_n[cn];cn++,Nn(e),Lu(e.$$)}}catch(e){throw _n.length=0,cn=0,e}for(Nn(null),_n.length=0,cn=0;Vn.length;)Vn.pop()();for(let e=0;et.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),dn=e}const Hn=new Set;let nn;function ht(){nn={r:0,c:[],p:nn}}function vt(){nn.r||Ut(nn.c),nn=nn.p}function Z(t,e){t&&t.i&&(Hn.delete(t),t.i(e))}function ie(t,e,l,n){if(t&&t.o){if(Hn.has(t))return;Hn.add(t),nn.c.push(()=>{Hn.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function kt(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function oi(t,e){const l={},n={},i={$$scope:1};let s=t.length;for(;s--;){const a=t[s],r=e[s];if(r){for(const f in a)f in r||(n[f]=1);for(const f in r)i[f]||(l[f]=r[f],i[f]=1);t[s]=r}else for(const f in a)i[f]=1}for(const a in n)a in l||(l[a]=void 0);return l}function Fn(t){return typeof t=="object"&&t!==null?t:{}}function Te(t){t&&t.c()}function Me(t,e,l){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,l),Bt(()=>{const s=t.$$.on_mount.map(Mf).filter(Mi);t.$$.on_destroy?t.$$.on_destroy.push(...s):Ut(s),t.$$.on_mount=[]}),i.forEach(Bt)}function Ne(t,e){const l=t.$$;l.fragment!==null&&(Iu(l.after_update),Ut(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function Ou(t,e){t.$$.dirty[0]===-1&&(_n.push(t),Ef(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const b=h.length?h[0]:d;return c.ctx&&i(c.ctx[_],c.ctx[_]=b)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](b),m&&Ou(t,_)),d}):[],c.update(),m=!0,Ut(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=Mu(e.target);c.fragment&&c.fragment.l(_),_.forEach(T)}else c.fragment&&c.fragment.c();e.intro&&Z(t.$$.fragment),Me(t,e.target,e.anchor),qf()}Nn(f)}class qt{constructor(){Zn(this,"$$");Zn(this,"$$set")}$destroy(){Ne(this,1),this.$destroy=We}$on(e,l){if(!Mi(l))return We;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!wu(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ru="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ru);const ts=t=>typeof t>"u",Df=t=>typeof t=="function",Af=t=>typeof t=="number";function Fu(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Lf(){let t=0;return()=>t++}function Bu(){return Math.random().toString(36).substring(2)}const Dl=typeof window>"u";function If(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Of=(t,e)=>t?{}:{style:e},ai=t=>({"aria-hidden":"true",...Of(t,"display:none;")}),mn=[];function Rf(t,e){return{subscribe:ol(t,e).subscribe}}function ol(t,e=We){let l;const n=new Set;function i(r){if(Tt(t,r)&&(t=r,l)){const f=!mn.length;for(const c of n)c[1](),mn.push(c,t);if(f){for(let c=0;c{n.delete(c),n.size===0&&l&&(l(),l=null)}}return{set:i,update:s,subscribe:a}}function Uu(t,e,l){const n=!Array.isArray(t),i=n?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=e.length<2;return Rf(l,(a,r)=>{let f=!1;const c=[];let m=0,_=We;const d=()=>{if(m)return;_();const b=e(n?c[0]:c,a,r);s?a(b):_=Mi(b)?b:We},h=i.map((b,g)=>Ni(b,k=>{c[g]=k,m&=~(1<{m|=1<`@@svnav-ctx__${t}`,fi=An("LOCATION"),bn=An("ROUTER"),Ff=An("ROUTE"),ju=An("ROUTE_PARAMS"),Hu=An("FOCUS_ELEM"),Bf=/^:(.+)/,Cn=(t,e,l)=>t.substr(e,l),ui=(t,e)=>Cn(t,0,e.length)===e,yu=t=>t==="",zu=t=>Bf.test(t),Uf=t=>t[0]==="*",Wu=t=>t.replace(/\*.*$/,""),jf=t=>t.replace(/(^\/+|\/+$)/g,"");function Tl(t,e=!1){const l=jf(t).split("/");return e?l.filter(Boolean):l}const $n=(t,e)=>t+(e?`?${e}`:""),Ai=t=>`/${jf(t)}`;function Ln(...t){const e=n=>Tl(n,!0).join("/"),l=t.map(e).join("/");return Ai(l)}const Li=1,Xn=2,fn=3,Gu=4,Hf=5,Vu=6,yf=7,Ku=8,Yu=9,zf=10,Wf=11,Qu={[Li]:"Link",[Xn]:"Route",[fn]:"Router",[Gu]:"useFocus",[Hf]:"useLocation",[Vu]:"useMatch",[yf]:"useNavigate",[Ku]:"useParams",[Yu]:"useResolvable",[zf]:"useResolve",[Wf]:"navigate"},Ii=t=>Qu[t];function Xu(t,e){let l;return t===Xn?l=e.path?`path="${e.path}"`:"default":t===Li?l=`to="${e.to}"`:t===fn&&(l=`basepath="${e.basepath||""}"`),`<${Ii(t)} ${l||""} />`}function Zu(t,e,l,n){const i=l&&Xu(n||t,l),s=i?` -Occurred in: ${i}`:"",a=Oi(t),r=Df(e)?e(a):e;return`<${a}> ${r}${s}`}const Gf=t=>(...e)=>t(Zu(...e)),Vf=Gf(t=>{throw new Error(t)}),Kn=Gf(console.warn),ls=4,Ju=3,$u=2,xu=1,er=1;function tr(t,e){const l=t.default?0:Tl(t.fullPath).reduce((n,i)=>{let s=n;return s+=ls,yu(i)?s+=er:zu(i)?s+=$u:Uf(i)?s-=ls+xu:s+=Ju,s},0);return{route:t,score:l,index:e}}function lr(t){return t.map(tr).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Kf(t,e){let l,n;const[i]=e.split("?"),s=Tl(i),a=s[0]==="",r=lr(t);for(let f=0,c=r.length;f({..._,params:d,uri:w});if(_.default){n=h(e);continue}const b=Tl(_.fullPath),g=Math.max(s.length,b.length);let k=0;for(;k{c===".."?f.pop():c!=="."&&f.push(c)}),$n(`/${f.join("/")}`,n)}function ns(t,e){const{pathname:l,hash:n="",search:i="",state:s}=t,a=Tl(e,!0),r=Tl(l,!0);for(;a.length;)a[0]!==r[0]&&Vf(yl,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),r.shift();return{pathname:Ln(...r),hash:n,search:i,state:s}}const is=t=>t.length===1?"":t,Ii=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,s=i?is(Cn(t,l)):"",a=i?Cn(t,0,l):t,r=n?is(Cn(a,e)):"";return{pathname:(n?Cn(a,0,e):a)||"/",search:r,hash:s}},ir=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function sr(t,e,l){return Ln(l,nr(t,e))}function or(t,e){const l=Ai(Wu(t)),n=Tl(l,!0),i=Tl(e,!0).slice(0,n.length),s=Yf({fullPath:l},Ln(...i));return s&&s.uri}const xn="POP",ar="PUSH",fr="REPLACE";function ei(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function ur(t){let e=[],l=ei(t),n=xn;const i=(s=e)=>s.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(s){e.push(s);const a=()=>{l=ei(t),n=xn,i([s])};i([s]);const r=Of(t,"popstate",a);return()=>{r(),e=e.filter(f=>f!==s)}},navigate(s,a){const{state:r={},replace:f=!1}=a||{};if(n=f?fr:ar,Af(s))a&&Kn(Wf,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=xn,t.history.go(s);else{const c={...r,_key:Bu()};try{t.history[f?"replaceState":"pushState"](c,"",s)}catch{t.location[f?"replace":"assign"](s)}}l=ei(t),i()}}}function ti(t,e){return{...Ii(e),state:t}}function rr(t="/"){let e=0,l=[ti(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,s){e++,l=l.slice(0,e),l.push(ti(n,s))},replaceState(n,i,s){l[e]=ti(n,s)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const cr=!!(!Dl&&window.document&&window.document.createElement),_r=!Dl&&window.location.origin==="null",Qf=ur(cr&&!_r?window:rr()),{navigate:Il}=Qf;let Pl=null,Xf=!0;function mr(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nPl.level||t.level===Pl.level&&mr(t.routerId,Pl.routerId))&&(Pl=t)}function dr(){Pl=null}function hr(){Xf=!1}function ss(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Of(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function vr(t,e){return Number(t.dataset.svnavRouteEnd)===e}function br(t){return/^H[1-6]$/i.test(t.tagName)}function os(t,e=document){return e.querySelector(t)}function gr(t){let l=os(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!vr(l,t);){if(br(l))return l;const n=os("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function kr(t){Promise.resolve(Hl(t.focusElement)).then(e=>{const l=e||gr(t.id);l||Kn(yl,`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,Xn),!ss(l)&&ss(document.documentElement)})}const wr=(t,e,l)=>(n,i)=>Au().then(()=>{if(!Pl||Xf){hr();return}if(n&&kr(Pl.route),t.announcements&&i){const{path:s,fullPath:a,meta:r,params:f,uri:c}=Pl.route,_=t.createAnnouncement({path:s,fullPath:a,meta:r,params:f,uri:c},Hl(l));Promise.resolve(_).then(m=>{e.set(m)})}dr()}),Cr="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 Sr(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},If(t[6],Cr)],i={};for(let s=0;s`Navigated to ${Q.uri}`,announcements:!0,...b},w=_,A=Ai(_),F=Rl(fi),L=Rl(Jl),M=!F,R=Nr(),O=h&&!(L&&!L.manageFocus),H=nl("");Nl(t,H,Q=>l(0,r=Q));const K=L?L.disableInlineStyles:g,W=nl([]);Nl(t,W,Q=>l(20,a=Q));const N=nl(null);Nl(t,N,Q=>l(18,i=Q));let B=!1;const X=M?0:L.level+1,V=M?nl((()=>ns(Dl?Ii(m):d.location,A))()):F;Nl(t,V,Q=>l(17,n=Q));const Y=nl(n);Nl(t,Y,Q=>l(19,s=Q));const U=wr(k,H,V),z=Q=>ee=>ee.filter(ue=>ue.id!==Q);function se(Q){if(Dl){if(B)return;const ee=Yf(Q,n.pathname);if(ee)return B=!0,ee}else W.update(ee=>{const ue=z(Q.id)(ee);return ue.push(Q),ue})}function le(Q){W.update(z(Q))}return!M&&_!==as&&Kn(yl,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),M&&(Tf(()=>d.listen(ee=>{const ue=ns(ee.location,A);Y.set(n),V.set(ue)})),Tn(fi,V)),Tn(Jl,{activeRoute:N,registerRoute:se,unregisterRoute:le,manageFocus:O,level:X,id:R,history:M?d:L.history,basepath:M?A:L.basepath,disableInlineStyles:K}),t.$$set=Q=>{"basepath"in Q&&l(11,_=Q.basepath),"url"in Q&&l(12,m=Q.url),"history"in Q&&l(13,d=Q.history),"primary"in Q&&l(14,h=Q.primary),"a11y"in Q&&l(15,b=Q.a11y),"disableInlineStyles"in Q&&l(16,g=Q.disableInlineStyles),"$$scope"in Q&&l(21,c=Q.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==w&&Kn(yl,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const Q=Kf(a,n.pathname);N.set(Q)}if(t.$$.dirty[0]&655360&&M){const Q=!!n.hash,ee=!Q&&O,ue=!Q||n.pathname!==s.pathname;U(ee,ue)}t.$$.dirty[0]&262144&&O&&i&&i.primary&&pr({level:X,routerId:R,route:i})},[r,k,M,R,O,H,K,W,N,V,Y,_,m,d,h,b,g,n,i,s,a,c,f]}class Pr extends Nt{constructor(e){super(),Mt(this,e,Tr,Mr,St,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Zf=Pr;function On(t,e,l=Jl,n=yl){Rl(l)||Vf(t,s=>`You cannot use ${s} outside of a ${Oi(n)}.`,e)}const Er=t=>{const{subscribe:e}=Rl(t);return{subscribe:e}};function Jf(){return On(Hf),Er(fi)}function $f(){const{history:t}=Rl(Jl);return t}function xf(){const t=Rl(Ff);return t?Uu(t,e=>e.base):nl("/")}function eu(){On(zf);const t=xf(),{basepath:e}=Rl(Jl);return n=>sr(n,Hl(t),e)}function qr(){On(yf);const t=eu(),{navigate:e}=$f();return(n,i)=>{const s=Af(n)?n:t(n);return e(s,i)}}const Dr=t=>({params:t&16,location:t&8}),fs=t=>({params:Dl?Hl(t[10]):t[4],location:t[3],navigate:t[11]});function us(t){let e,l;return e=new Zf({props:{primary:t[1],$$slots:{default:[Or]},$$scope:{ctx:t}}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&2&&(s.primary=n[1]),i&528409&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Ar(t){let e;const l=t[18].default,n=Ti(l,t,t[19],fs);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&524312)&&Ei(n,l,i,i[19],e?Pi(l,i[19],s,Dr):qi(i[19]),fs)},i(i){e||(Z(n,i),e=!0)},o(i){ie(n,i),e=!1},d(i){n&&n.d(i)}}}function Lr(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Dl?Hl(t[10]):t[4],t[12]];var s=t[0];function a(r,f){let c={};for(let _=0;_{Ne(c,1)}),vt()}s?(e=xi(s,a(r,f)),Te(e.$$.fragment),Z(e.$$.fragment,1),Me(e,l.parentNode,l)):e=null}else if(s){const c=f&7192?oi(i,[f&8&&{location:r[3]},f&2048&&{navigate:r[11]},f&1040&&Fn(Dl?Hl(r[10]):r[4]),f&4096&&Fn(r[12])]):{};e.$set(c)}},i(r){n||(e&&Z(e.$$.fragment,r),n=!0)},o(r){e&&ie(e.$$.fragment,r),n=!1},d(r){r&&T(l),e&&Ne(e,r)}}}function Or(t){let e,l,n,i;const s=[Lr,Ar],a=[];function r(f,c){return f[0]!==null?0:1}return e=r(t),l=a[e]=s[e](t),{c(){l.c(),n=Vt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let _=e;e=r(f),e===_?a[e].p(f,c):(ht(),ie(a[_],1,1,()=>{a[_]=null}),vt(),l=a[e],l?l.p(f,c):(l=a[e]=s[e](f),l.c()),Z(l,1),l.m(n.parentNode,n))},i(f){i||(Z(l),i=!0)},o(f){ie(l),i=!1},d(f){f&&T(n),a[e].d(f)}}}function Ir(t){let e,l,n,i,s,a=[ai(t[7]),{"data-svnav-route-start":t[5]}],r={};for(let m=0;m{f=null}),vt())},i(m){s||(Z(f),s=!0)},o(m){ie(f),s=!1},d(m){m&&(T(e),T(l),T(n),T(i)),f&&f.d(m)}}}const Rr=Lf();function Fr(t,e,l){let n;const i=["path","component","meta","primary"];let s=Gn(e,i),a,r,f,c,{$$slots:_={},$$scope:m}=e,{path:d=""}=e,{component:h=null}=e,{meta:b={}}=e,{primary:g=!0}=e;On(Xn,e);const k=Rr(),{registerRoute:w,unregisterRoute:A,activeRoute:F,disableInlineStyles:L}=Rl(Jl);Nl(t,F,B=>l(16,a=B));const M=xf();Nl(t,M,B=>l(17,f=B));const R=Jf();Nl(t,R,B=>l(3,r=B));const O=nl(null);let H;const K=nl(),W=nl({});Nl(t,W,B=>l(4,c=B)),Tn(Ff,K),Tn(ju,W),Tn(Hu,O);const N=qr();return Dl||qu(()=>A(k)),t.$$set=B=>{l(24,e=pl(pl({},e),Wn(B))),l(12,s=Gn(e,i)),"path"in B&&l(13,d=B.path),"component"in B&&l(0,h=B.component),"meta"in B&&l(14,b=B.meta),"primary"in B&&l(1,g=B.primary),"$$scope"in B&&l(19,m=B.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const B=d==="",X=Ln(f,d),G={id:k,path:d,meta:b,default:B,fullPath:B?"":X,base:B?f:or(X,r.pathname),primary:g,focusElement:O};K.set(G),l(15,H=w(G))}if(t.$$.dirty&98304&&l(2,n=!!(H||a&&a.id===k)),t.$$.dirty&98308&&n){const{params:B}=H||a;W.set(B)}},e=Wn(e),[h,g,n,r,c,k,F,L,M,R,W,N,s,d,b,H,a,f,_,m]}class Br extends Nt{constructor(e){super(),Mt(this,e,Fr,Ir,St,{path:13,component:0,meta:14,primary:1})}}const ml=Br;function Ur(t){let e,l,n,i;const s=t[13].default,a=Ti(s,t,t[12],null);let r=[{href:t[0]},t[2],t[1]],f={};for(let c=0;cl(11,m=O));const F=Du(),L=eu(),{navigate:M}=$f();function R(O){F("click",O),Fu(O)&&(O.preventDefault(),M(n,{state:k,replace:a||g}))}return t.$$set=O=>{l(19,e=pl(pl({},e),Wn(O))),l(18,_=Gn(e,c)),"to"in O&&l(5,b=O.to),"replace"in O&&l(6,g=O.replace),"state"in O&&l(7,k=O.state),"getProps"in O&&l(8,w=O.getProps),"$$scope"in O&&l(12,h=O.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=L(b,m)),t.$$.dirty&2049&&l(10,i=ui(m.pathname,n)),t.$$.dirty&2049&&l(9,s=n===m.pathname),t.$$.dirty&2049&&(a=Ii(n)===ir(m)),t.$$.dirty&512&&l(2,r=s?{"aria-current":"page"}:{}),l(1,f=(()=>{if(Df(w)){const O=w({location:m,href:n,isPartiallyCurrent:i,isCurrent:s});return{..._,...O}}return _})())},e=Wn(e),[n,f,r,A,R,b,g,k,w,s,i,m,h,d]}class Hr extends Nt{constructor(e){super(),Mt(this,e,jr,Ur,St,{to:5,replace:6,state:7,getProps:8})}}const _l=Hr;function Ll(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function yr(t,e){return t>218&&t<242?"#23ac05":t>212&&t<248?"#b1d900":t>208&&t<252?"#a3b200":"#b20000"}function Ri(t,e){let l;return t>90?l="#b20000":t>85?l="#b19601":t>80?l="#a3b200":t>75?l="#569f12":l="#23ac05",l}function En(t){return t>75?"#23ac05":t>50?"#77d900":t>25?"#94d900":"#569f12"}function Yn(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 Ct(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function Ye(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 245:return"wESP32";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"µHAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1";case 80:return"Generic ESP32-S3"}return"Unknown"}function Xl(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Gt(t,e){return t==1||t==2&&e}function cl(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function Ut(t,e){return t==null||isNaN(t)?"-":(isNaN(e)&&(e=t<1?2:t<10?1:0),t.toFixed(e))}function Al(t,e){return t.setTime(t.getTime()+e*36e5),t}function zr(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function Wr(t){return t=="EOE"?"https://transparency.entsoe.eu/":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}let Bn=0;function qn(t,e){var l="";Bn++;var n=function(){setTimeout(qn,1e3,t,e)};if(t.net.ip&&Bn%3==0){if(!t.net.ip){n();return}l="http://"+t.net.ip}else t.hostname&&Bn%3==1?l="http://"+t.hostname:t.hostname&&Bn%3==2?l="http://"+t.hostname+".local":l="";console&&console.log("Trying url "+l),e&&e(l);var i=new XMLHttpRequest;i.timeout=5e3,i.addEventListener("abort",n),i.addEventListener("error",n),i.addEventListener("timeout",n),i.addEventListener("load",function(s){window.location.href=l||"/"}),i.open("GET",l+"/is-alive",!0),i.send()}function Xt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function rs(t){return t.startsWith("esp32")?"esp32":t}function ol(t,e){let l=[t,e];return typeof t>"u"?(l[0]="-",l[1]=e):t>=1e9?(l[0]=(t/1e6).toFixed(t>1e10?0:1),l[1]="M"+e):t>1e4?(l[0]=(t/1e3).toFixed(t>1e6?0:t>1e5?1:2),l[1]="k"+e):(l[0]=t.toFixed(0),l[1]=e),l}let yn={},ri=[];async function Gr(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),s=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),s}let li;async function tu(){if(ri.length){let t=ri.shift();delete yn[t.resource];try{let e=await Gr(t.resource,t.options);for(let l in t.callbacks)t.callbacks[l](e.clone())}catch(e){console.error("Error calling "+t.resource,e);for(let l in t.callbacks)t.callbacks[l]()}}li&&clearTimeout(li),li=setTimeout(tu,100)}tu();async function dl(t,e={}){let l;return yn[t]?l=yn[t]:(l={resource:t,options:e,callbacks:[]},yn[t]=l,ri.push(l)),new Promise(i=>l.callbacks.push(i))}let Ml={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}};async function Fi(){Ml=await(await dl("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),al.set(Ml)}const al=nl(Ml,t=>(Fi(),function(){}));function Vr(t){al.update(e=>(e.trying=t,e))}let Un=0,cs=-127,_s=null,Kr={};const Yr=Rf(Kr,t=>{let e,l;async function n(){dl("data.json").then(i=>i.json()).then(i=>{t(i),cs!=i.t&&(cs=i.t,setTimeout(Qr,2e3)),_s==null&&i.pe&&i.p!=null&&(_s=i.p,nu()),Ml.upgrading?window.location.reload():(!Ml||!Ml.chip||Ml.booting||Un>1&&!Xl(Ml.board))&&(Fi(),El&&clearTimeout(El),El=setTimeout(mi,2e3),ql&&clearTimeout(ql),ql=setTimeout(di,3e3)),El||(El=mi()),ql||(ql=di());let s=5e3;if(Xl(Ml.board)&&i.v>2.5){let a=3.3-Math.min(3.3,i.v);a>0&&(s=Math.max(a,.1)*10*5e3)}s>5e3&&console.log("Next in "+s+"ms"),e&&clearTimeout(e),e=setTimeout(n,s),Un=0}).catch(i=>{Un++,Un>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(n,15e3),l||(l=setTimeout(qn,5e3,Ml,Vr))):e=setTimeout(n,Xl(Ml.board)?1e4:5e3)})}return n(),function(){clearTimeout(e)}});let ci={},Sn;const Bi=nl(ci);async function lu(){let t=!1;Bi.update(e=>{for(var l=0;l<36;l++){if(e[Ct(l)]==null){t=l<12;break}e[Ct(l)]=e[Ct(l+1)]}return e}),t?nu():Sn=setTimeout(lu,(60-new Date().getMinutes())*6e4)}async function nu(){Sn&&(clearTimeout(Sn),Sn=0),ci=await(await dl("energyprice.json")).json(),Bi.set(ci),Sn=setTimeout(lu,(60-new Date().getMinutes())*6e4)}let _i={},El;async function mi(){El&&(clearTimeout(El),El=0),_i=await(await dl("dayplot.json")).json(),iu.set(_i),El=setTimeout(mi,(60-new Date().getMinutes())*6e4+20)}const iu=nl(_i,t=>function(){});let pi={},ql;async function di(){ql&&(clearTimeout(ql),ql=0),pi=await(await dl("monthplot.json")).json(),su.set(pi),ql=setTimeout(di,(24-new Date().getHours())*36e5+40)}const su=nl(pi,t=>function(){});let hi={};async function Qr(){hi=await(await dl("temperature.json")).json(),ou.set(hi)}const ou=nl(hi,t=>function(){});let vi={},jn;async function au(){jn&&(clearTimeout(jn),jn=0),vi=await(await dl("tariff.json")).json(),fu.set(vi),jn=setTimeout(au,(60-new Date().getMinutes())*6e4+30)}const fu=nl(vi,t=>function(){});let bi=[];const Ui=nl(bi);async function Xr(){bi=await(await dl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Ui.set(bi)}let gi=!1;const hl=nl(gi);async function uu(t){gi=await(await dl("translations.json"+(t?"?lang="+t:""))).json(),hl.set(gi)}uu();function Qn(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 ru(t){await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function cu(t,e){if(!(!e||e.message))if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),s=parseInt(l[2]),a=[...e];a.reverse();let r,f,c;for(let _=0;_s&&(r=m):g==i+1&&(f=m);else if(b==n+1)if(c){let w=c.tag_name.substring(1).split(".");parseInt(w[0]);let A=parseInt(w[1]);parseInt(w[2]),g==A&&(c=m)}else c=m}return f||c||r||!1}else return e[0]}function ms(t){var f;let e=(((f=t[1].header)==null?void 0:f.uptime)??"Up")+"",l,n,i;function s(c,_){return c[2]>1?l1:c[2]>0?t1:c[3]>1?e1:c[3]>0?xr:c[4]>1?$r:c[4]>0?Jr:Zr}let a=s(t),r=a(t);return{c(){l=C(e),n=v(),r.c(),i=Vt()},m(c,_){P(c,l,_),P(c,n,_),r.m(c,_),P(c,i,_)},p(c,_){var m;_&2&&e!==(e=(((m=c[1].header)==null?void 0:m.uptime)??"Up")+"")&&q(l,e),a===(a=s(c))&&r?r.p(c,_):(r.d(1),r=a(c),r&&(r.c(),r.m(i.parentNode,i)))},d(c){c&&(T(l),T(n),T(i)),r.d(c)}}}function Zr(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.seconds)??"s")+"",i;return{c(){e=C(t[0]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&1&&q(e,a[0]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.seconds)??"s")+"")&&q(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function Jr(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.minute)??"m")+"",i;return{c(){e=C(t[4]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&16&&q(e,a[4]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minute)??"m")+"")&&q(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function $r(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.minutes)??"m")+"",i;return{c(){e=C(t[4]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&16&&q(e,a[4]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minutes)??"m")+"")&&q(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function xr(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.hour)??"h")+"",i;return{c(){e=C(t[3]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&8&&q(e,a[3]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hour)??"h")+"")&&q(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function e1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.hours)??"h")+"",i;return{c(){e=C(t[3]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&8&&q(e,a[3]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hours)??"h")+"")&&q(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function t1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.day)??"d")+"",i;return{c(){e=C(t[2]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&4&&q(e,a[2]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.day)??"d")+"")&&q(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function l1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.days)??"d")+"",i;return{c(){e=C(t[2]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&4&&q(e,a[2]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.days)??"d")+"")&&q(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function n1(t){let e,l=t[0]&&ms(t);return{c(){l&&l.c(),e=Vt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=ms(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:Ve,o:Ve,d(n){n&&T(e),l&&l.d(n)}}}function i1(t,e,l){let{epoch:n}=e,i={};hl.subscribe(f=>{l(1,i=f)});let s=0,a=0,r=0;return t.$$set=f=>{"epoch"in f&&l(0,n=f.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(2,s=Math.floor(n/86400)),l(3,a=Math.floor(n/3600)),l(4,r=Math.floor(n/60)))},[n,i,s,a,r]}class s1 extends Nt{constructor(e){super(),Mt(this,e,i1,n1,St,{epoch:0})}}function o1(t){let e,l,n;return{c(){e=p("span"),l=C(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,s){P(i,e,s),o(e,l)},p(i,[s]){s&4&&q(l,i[2]),s&2&&u(e,"title",i[1]),s&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:Ve,o:Ve,d(i){i&&T(e)}}}function a1(t,e,l){let{color:n}=e,{title:i}=e,{text:s}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,s=a.text)},[n,i,s]}class Ul extends Nt{constructor(e){super(),Mt(this,e,a1,o1,St,{color:0,title:1,text:2})}}function f1(t){let e,l=`${Ct(t[0].getDate())}.${Ct(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ct(t[0].getHours())}:${Ct(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=C(l),u(e,"class",t[1])},m(i,s){P(i,e,s),o(e,n)},p(i,s){s&1&&l!==(l=`${Ct(i[0].getDate())}.${Ct(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ct(i[0].getHours())}:${Ct(i[0].getMinutes())}`)&&q(n,l),s&2&&u(e,"class",i[1])},d(i){i&&T(e)}}}function u1(t){var n;let e=`${Ct(t[0].getDate())}. ${t[2].months?(n=t[2].months)==null?void 0:n[t[0].getMonth()]:Ct(t[0].getMonth()+1)} ${Ct(t[0].getHours())}:${Ct(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(i,s){P(i,l,s)},p(i,s){var a;s&5&&e!==(e=`${Ct(i[0].getDate())}. ${i[2].months?(a=i[2].months)==null?void 0:a[i[0].getMonth()]:Ct(i[0].getMonth()+1)} ${Ct(i[0].getHours())}:${Ct(i[0].getMinutes())}`)&&q(l,e)},d(i){i&&T(l)}}}function r1(t){let e;function l(s,a){return s[3]?u1:f1}let n=l(t),i=n(t);return{c(){i.c(),e=Vt()},m(s,a){i.m(s,a),P(s,e,a)},p(s,[a]){n===(n=l(s))&&i?i.p(s,a):(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},i:Ve,o:Ve,d(s){s&&T(e),i.d(s)}}}function c1(t,e,l){let n={};hl.subscribe(f=>{l(2,n=f)});let{timestamp:i}=e,{fullTimeColor:s}=e,{offset:a}=e,r;return t.$$set=f=>{"timestamp"in f&&l(0,i=f.timestamp),"fullTimeColor"in f&&l(1,s=f.fullTimeColor),"offset"in f&&l(4,a=f.offset)},t.$$.update=()=>{t.$$.dirty&17&&(l(3,r=Math.abs(new Date().getTime()-i.getTime())<3e5),isNaN(a)||Al(i,a-(24+i.getHours()-i.getUTCHours())%24))},[i,s,n,r,a]}class _u extends Nt{constructor(e){super(),Mt(this,e,c1,r1,St,{timestamp:0,fullTimeColor:1,offset:4})}}function _1(t){let e,l,n;return{c(){e=Et("svg"),l=Et("path"),n=Et("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,s){P(i,e,s),o(e,l),o(e,n)},p:Ve,i:Ve,o:Ve,d(i){i&&T(e)}}}class m1 extends Nt{constructor(e){super(),Mt(this,e,null,_1,St,{})}}function p1(t){let e,l;return{c(){e=Et("svg"),l=Et("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){P(n,e,i),o(e,l)},p:Ve,i:Ve,o:Ve,d(n){n&&T(e)}}}class d1 extends Nt{constructor(e){super(),Mt(this,e,null,p1,St,{})}}function h1(t){let e,l;return{c(){e=Et("svg"),l=Et("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){P(n,e,i),o(e,l)},p:Ve,i:Ve,o:Ve,d(n){n&&T(e)}}}class v1 extends Nt{constructor(e){super(),Mt(this,e,null,h1,St,{})}}function b1(t){let e,l,n=t[2].version+"",i;return{c(){e=C("AMS reader "),l=p("span"),i=C(n)},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&4&&n!==(n=s[2].version+"")&&q(i,n)},d(s){s&&(T(e),T(l))}}}function ps(t){let e,l=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=C(l),i=C("°C"),u(e,"class","flex-none my-auto")},m(s,a){P(s,e,a),o(e,n),o(e,i)},p(s,a){a&2&&l!==(l=(s[1].t>-50?s[1].t.toFixed(1):"-")+"")&&q(n,l)},d(s){s&&T(e)}}}function ds(t){var i,s,a;let e,l=(((i=t[4].header)==null?void 0:i.han)??"HAN")+": "+(((a=(s=t[4].errors)==null?void 0:s.han)==null?void 0:a[t[1].he])??t[1].he),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),o(e,n)},p(r,f){var c,_,m;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.han)??"HAN")+": "+(((m=(_=r[4].errors)==null?void 0:_.han)==null?void 0:m[r[1].he])??r[1].he))&&q(n,l)},d(r){r&&T(e)}}}function hs(t){var i,s,a;let e,l=(((i=t[4].header)==null?void 0:i.mqtt)??"MQTT")+": "+(((a=(s=t[4].errors)==null?void 0:s.mqtt)==null?void 0:a[t[1].me])??t[1].me),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),o(e,n)},p(r,f){var c,_,m;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.mqtt)??"MQTT")+": "+(((m=(_=r[4].errors)==null?void 0:_.mqtt)==null?void 0:m[r[1].me])??r[1].me))&&q(n,l)},d(r){r&&T(e)}}}function vs(t){var i,s,a;let e,l=(((i=t[4].header)==null?void 0:i.price)??"PS")+": "+(((a=(s=t[4].errors)==null?void 0:s.price)==null?void 0:a[t[1].ee])??t[1].ee),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),o(e,n)},p(r,f){var c,_,m;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.price)??"PS")+": "+(((m=(_=r[4].errors)==null?void 0:_.price)==null?void 0:m[r[1].ee])??r[1].ee))&&q(n,l)},d(r){r&&T(e)}}}function bs(t){let e,l,n,i,s,a,r,f;return l=new _l({props:{to:"/configuration",$$slots:{default:[g1]},$$scope:{ctx:t}}}),a=new _l({props:{to:"/status",$$slots:{default:[k1]},$$scope:{ctx:t}}}),{c(){var c,_;e=p("div"),Te(l.$$.fragment),i=v(),s=p("div"),Te(a.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title",n=((c=t[4].header)==null?void 0:c.config)??""),u(s,"class","flex-none px-1 mt-1"),u(s,"title",r=((_=t[4].header)==null?void 0:_.status)??"")},m(c,_){P(c,e,_),Me(l,e,null),P(c,i,_),P(c,s,_),Me(a,s,null),f=!0},p(c,_){var h,b;const m={};_&64&&(m.$$scope={dirty:_,ctx:c}),l.$set(m),(!f||_&16&&n!==(n=((h=c[4].header)==null?void 0:h.config)??""))&&u(e,"title",n);const d={};_&64&&(d.$$scope={dirty:_,ctx:c}),a.$set(d),(!f||_&16&&r!==(r=((b=c[4].header)==null?void 0:b.status)??""))&&u(s,"title",r)},i(c){f||(Z(l.$$.fragment,c),Z(a.$$.fragment,c),f=!0)},o(c){ie(l.$$.fragment,c),ie(a.$$.fragment,c),f=!1},d(c){c&&(T(e),T(i),T(s)),Ne(l),Ne(a)}}}function g1(t){let e,l;return e=new m1({}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function k1(t){let e,l;return e=new d1({}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function gs(t){let e,l;function n(a,r){return a[2].security==0||a[1].a?C1:w1}let i=n(t),s=i(t);return{c(){var a;e=p("div"),s.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",l=(((a=t[4].header)==null?void 0:a.new_version)??"New version")+": "+t[3].tag_name)},m(a,r){P(a,e,r),s.m(e,null)},p(a,r){var f;i===(i=n(a))&&s?s.p(a,r):(s.d(1),s=i(a),s&&(s.c(),s.m(e,null))),r&24&&l!==(l=(((f=a[4].header)==null?void 0:f.new_version)??"New version")+": "+a[3].tag_name)&&u(e,"title",l)},d(a){a&&T(e),s.d()}}}function w1(t){var r;let e,l=(((r=t[4].header)==null?void 0:r.new_version)??"New version")+"",n,i,s=t[3].tag_name+"",a;return{c(){e=p("span"),n=C(l),i=C(": "),a=C(s)},m(f,c){P(f,e,c),o(e,n),o(e,i),o(e,a)},p(f,c){var _;c&16&&l!==(l=(((_=f[4].header)==null?void 0:_.new_version)??"New version")+"")&&q(n,l),c&8&&s!==(s=f[3].tag_name+"")&&q(a,s)},d(f){f&&T(e)}}}function C1(t){var _;let e,l,n=(((_=t[4].header)==null?void 0:_.new_version)??"New version")+"",i,s,a=t[3].tag_name+"",r,f,c;return{c(){e=p("button"),l=p("span"),i=C(n),s=C(": "),r=C(a),u(l,"class","mt-1"),u(e,"class","flex")},m(m,d){P(m,e,d),o(e,l),o(l,i),o(l,s),o(l,r),f||(c=ce(e,"click",t[5]),f=!0)},p(m,d){var h;d&16&&n!==(n=(((h=m[4].header)==null?void 0:h.new_version)??"New version")+"")&&q(i,n),d&8&&a!==(a=m[3].tag_name+"")&&q(r,a)},d(m){m&&T(e),f=!1,c()}}}function S1(t){var ne,fe,me,he,pe,Se,we,Le,qe,Re;let e,l,n,i,s,a,r,f,c,_,m,d=(((ne=t[4].header)==null?void 0:ne.mem)??"Free")+"",h,b,g=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",k,w,A,F,L,M,R,O,H,K,W,N,B,X,G,V,Y,U,z,se,le,Q,ee,ue,ae,x,_e,oe,J,$,ve;i=new _l({props:{to:"/",$$slots:{default:[b1]},$$scope:{ctx:t}}}),f=new s1({props:{epoch:t[1].u}});let ke=t[1].t>-50&&ps(t);L=new Ul({props:{title:((fe=t[4].header)==null?void 0:fe.esp)??"ESP",text:t[2].booting?((me=t[4].header)==null?void 0:me.booting)??"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":((he=t[4].header)==null?void 0:he.esp)??"ESP",color:Ll(t[2].booting?2:t[1].em)}}),R=new Ul({props:{title:((pe=t[4].header)==null?void 0:pe.han)??"HAN",text:((Se=t[4].header)==null?void 0:Se.han)??"HAN",color:Ll(t[2].booting?9:t[1].hm)}}),H=new Ul({props:{title:((we=t[4].header)==null?void 0:we.wifi)??"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":((Le=t[4].header)==null?void 0:Le.wifi)??"WiFi",color:Ll(t[2].booting?9:t[1].wm)}}),W=new Ul({props:{title:((qe=t[4].header)==null?void 0:qe.mqtt)??"MQTT",text:((Re=t[4].header)==null?void 0:Re.mqtt)??"MQTT",color:Ll(t[2].booting?9:t[1].mm)}});let D=(t[1].he<0||t[1].he>0)&&ds(t),S=t[1].me<0&&hs(t),I=(t[1].ee>0||t[1].ee<0)&&vs(t);ee=new _u({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let E=t[2].vndcfg&&t[2].usrcfg&&bs(t);oe=new v1({});let j=t[2].fwconsent===1&&t[3]&&gs(t);return{c(){var re;e=p("nav"),l=p("div"),n=p("div"),Te(i.$$.fragment),s=v(),a=p("div"),r=p("div"),Te(f.$$.fragment),c=v(),ke&&ke.c(),_=v(),m=p("div"),h=C(d),b=C(": "),k=C(g),w=C("kb"),A=v(),F=p("div"),Te(L.$$.fragment),M=v(),Te(R.$$.fragment),O=v(),Te(H.$$.fragment),K=v(),Te(W.$$.fragment),N=v(),D&&D.c(),B=v(),S&&S.c(),X=v(),I&&I.c(),G=v(),V=p("div"),Y=p("div"),U=p("a"),z=p("img"),le=v(),Q=p("div"),Te(ee.$$.fragment),ue=v(),E&&E.c(),ae=v(),x=p("div"),_e=p("a"),Te(oe.$$.fragment),$=v(),j&&j.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(r,"class","flex-none my-auto"),u(m,"class","flex-none my-auto"),u(a,"class","flex-none my-auto p-2 flex space-x-4"),u(F,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(z,"class","logo"),zn(z.src,se=(t[0]+"/logo.svg").replace("//","/"))||u(z,"src",se),u(z,"alt","GitHub repo"),u(U,"class","float-right"),u(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(U,"target","_blank"),u(U,"rel","noreferrer"),u(U,"aria-label","GitHub"),u(Y,"class","flex-none"),u(Q,"class","flex-none my-auto px-2"),u(_e,"href",cl("")),u(_e,"target","_blank"),u(_e,"rel","noreferrer"),u(x,"class","flex-none px-1 mt-1"),u(x,"title",J=((re=t[4].header)==null?void 0:re.doc)??""),u(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","hdr")},m(re,Ce){P(re,e,Ce),o(e,l),o(l,n),Me(i,n,null),o(l,s),o(l,a),o(a,r),Me(f,r,null),o(a,c),ke&&ke.m(a,null),o(a,_),o(a,m),o(m,h),o(m,b),o(m,k),o(m,w),o(l,A),o(l,F),Me(L,F,null),o(F,M),Me(R,F,null),o(F,O),Me(H,F,null),o(F,K),Me(W,F,null),o(l,N),D&&D.m(l,null),o(l,B),S&&S.m(l,null),o(l,X),I&&I.m(l,null),o(l,G),o(l,V),o(V,Y),o(Y,U),o(U,z),o(V,le),o(V,Q),Me(ee,Q,null),o(V,ue),E&&E.m(V,null),o(V,ae),o(V,x),o(x,_e),Me(oe,_e,null),o(V,$),j&&j.m(V,null),ve=!0},p(re,[Ce]){var Ze,bt,st,Tt,Oe,De,He,ze,de,Ee,Ge;const Ue={};Ce&68&&(Ue.$$scope={dirty:Ce,ctx:re}),i.$set(Ue);const it={};Ce&2&&(it.epoch=re[1].u),f.$set(it),re[1].t>-50?ke?ke.p(re,Ce):(ke=ps(re),ke.c(),ke.m(a,_)):ke&&(ke.d(1),ke=null),(!ve||Ce&16)&&d!==(d=(((Ze=re[4].header)==null?void 0:Ze.mem)??"Free")+"")&&q(h,d),(!ve||Ce&2)&&g!==(g=(re[1].m?(re[1].m/1e3).toFixed(1):"-")+"")&&q(k,g);const _t={};Ce&16&&(_t.title=((bt=re[4].header)==null?void 0:bt.esp)??"ESP"),Ce&22&&(_t.text=re[2].booting?((st=re[4].header)==null?void 0:st.booting)??"Booting":re[1].v>2?re[1].v.toFixed(2)+"V":((Tt=re[4].header)==null?void 0:Tt.esp)??"ESP"),Ce&6&&(_t.color=Ll(re[2].booting?2:re[1].em)),L.$set(_t);const et={};Ce&16&&(et.title=((Oe=re[4].header)==null?void 0:Oe.han)??"HAN"),Ce&16&&(et.text=((De=re[4].header)==null?void 0:De.han)??"HAN"),Ce&6&&(et.color=Ll(re[2].booting?9:re[1].hm)),R.$set(et);const tt={};Ce&16&&(tt.title=((He=re[4].header)==null?void 0:He.wifi)??"WiFi"),Ce&18&&(tt.text=re[1].r?re[1].r.toFixed(0)+"dBm":((ze=re[4].header)==null?void 0:ze.wifi)??"WiFi"),Ce&6&&(tt.color=Ll(re[2].booting?9:re[1].wm)),H.$set(tt);const lt={};Ce&16&&(lt.title=((de=re[4].header)==null?void 0:de.mqtt)??"MQTT"),Ce&16&&(lt.text=((Ee=re[4].header)==null?void 0:Ee.mqtt)??"MQTT"),Ce&6&&(lt.color=Ll(re[2].booting?9:re[1].mm)),W.$set(lt),re[1].he<0||re[1].he>0?D?D.p(re,Ce):(D=ds(re),D.c(),D.m(l,B)):D&&(D.d(1),D=null),re[1].me<0?S?S.p(re,Ce):(S=hs(re),S.c(),S.m(l,X)):S&&(S.d(1),S=null),re[1].ee>0||re[1].ee<0?I?I.p(re,Ce):(I=vs(re),I.c(),I.m(l,G)):I&&(I.d(1),I=null),(!ve||Ce&1&&!zn(z.src,se=(re[0]+"/logo.svg").replace("//","/")))&&u(z,"src",se);const ot={};Ce&2&&(ot.timestamp=re[1].c?new Date(re[1].c*1e3):new Date(0)),Ce&4&&(ot.offset=re[2].clock_offset),ee.$set(ot),re[2].vndcfg&&re[2].usrcfg?E?(E.p(re,Ce),Ce&4&&Z(E,1)):(E=bs(re),E.c(),Z(E,1),E.m(V,ae)):E&&(ht(),ie(E,1,1,()=>{E=null}),vt()),(!ve||Ce&16&&J!==(J=((Ge=re[4].header)==null?void 0:Ge.doc)??""))&&u(x,"title",J),re[2].fwconsent===1&&re[3]?j?j.p(re,Ce):(j=gs(re),j.c(),j.m(V,null)):j&&(j.d(1),j=null)},i(re){ve||(Z(i.$$.fragment,re),Z(f.$$.fragment,re),Z(L.$$.fragment,re),Z(R.$$.fragment,re),Z(H.$$.fragment,re),Z(W.$$.fragment,re),Z(ee.$$.fragment,re),Z(E),Z(oe.$$.fragment,re),ve=!0)},o(re){ie(i.$$.fragment,re),ie(f.$$.fragment,re),ie(L.$$.fragment,re),ie(R.$$.fragment,re),ie(H.$$.fragment,re),ie(W.$$.fragment,re),ie(ee.$$.fragment,re),ie(E),ie(oe.$$.fragment,re),ve=!1},d(re){re&&T(e),Ne(i),Ne(f),ke&&ke.d(),Ne(L),Ne(R),Ne(H),Ne(W),D&&D.d(),S&&S.d(),I&&I.d(),Ne(ee),E&&E.d(),Ne(oe),j&&j.d()}}}function M1(t,e,l){let{basepath:n="/"}=e,{data:i={}}=e,s={},a={};function r(){var c;confirm((((c=f.header)==null?void 0:c.upgrade)??"Upgrade to {0}?").replace("{0}",a.tag_name))&&(!Xl(s.board)||confirm(Qn(Ye(s.chip,s.board))))&&(al.update(_=>(_.upgrading=!0,_)),ru(a.tag_name))}al.subscribe(c=>{l(2,s=c),c.fwconsent===1&&Xr()}),Ui.subscribe(c=>{l(3,a=cu(s.version,c))});let f={};return hl.subscribe(c=>{l(4,f=c)}),t.$$set=c=>{"basepath"in c&&l(0,n=c.basepath),"data"in c&&l(1,i=c.data)},[n,i,s,a,f,r]}class N1 extends Nt{constructor(e){super(),Mt(this,e,M1,S1,St,{basepath:0,data:1})}}function T1(t){let e,l,n,i;return{c(){e=Et("svg"),l=Et("path"),n=Et("path"),u(l,"d",ni(150,150,115,210,510)),u(l,"stroke","rgba(128, 128, 128, 0.15)"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=ni(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(s,a){P(s,e,a),o(e,l),o(e,n)},p(s,[a]){a&1&&i!==(i=ni(150,150,115,210,210+300*s[0]/100))&&u(n,"d",i),a&2&&u(n,"stroke",s[1])},i:Ve,o:Ve,d(s){s&&T(e)}}}function ks(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function ni(t,e,l,n,i){var s=ks(t,e,l,i),a=ks(t,e,l,n),r=i-n<=180?"0":"1",f=["M",s.x,s.y,"A",l,l,0,r,0,a.x,a.y].join(" ");return f}function P1(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=s=>{"pct"in s&&l(0,n=s.pct),"color"in s&&l(1,i=s.color)},[n,i]}class E1 extends Nt{constructor(e){super(),Mt(this,e,P1,T1,St,{pct:0,color:1})}}function ws(t){let e,l,n,i,s,a,r,f;return{c(){e=p("br"),l=v(),n=p("span"),i=C(t[1]),s=v(),a=p("span"),r=C(t[2]),f=C("/kWh"),u(n,"class","pl-sub"),u(a,"class","pl-snt")},m(c,_){P(c,e,_),P(c,l,_),P(c,n,_),o(n,i),P(c,s,_),P(c,a,_),o(a,r),o(a,f)},p(c,_){_&2&&q(i,c[1]),_&4&&q(r,c[2])},d(c){c&&(T(e),T(l),T(n),T(s),T(a))}}}function q1(t){let e,l,n,i,s,a,r,f,c,_,m=t[4][0]+"",d,h,b,g=t[4][1]+"",k,w,A;l=new E1({props:{pct:t[5],color:t[3](t[5],document.documentElement.classList.contains("dark"))}});let F=t[1]&&ws(t);return{c(){e=p("div"),Te(l.$$.fragment),n=v(),i=p("span"),s=p("span"),a=C(t[0]),r=v(),f=p("br"),c=v(),_=p("span"),d=C(m),h=v(),b=p("span"),k=C(g),w=v(),F&&F.c(),u(s,"class","pl-lab"),u(_,"class","pl-val"),u(b,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(L,M){P(L,e,M),Me(l,e,null),o(e,n),o(e,i),o(i,s),o(s,a),o(i,r),o(i,f),o(i,c),o(i,_),o(_,d),o(i,h),o(i,b),o(b,k),o(i,w),F&&F.m(i,null),A=!0},p(L,[M]){const R={};M&32&&(R.pct=L[5]),M&40&&(R.color=L[3](L[5],document.documentElement.classList.contains("dark"))),l.$set(R),(!A||M&1)&&q(a,L[0]),(!A||M&16)&&m!==(m=L[4][0]+"")&&q(d,m),(!A||M&16)&&g!==(g=L[4][1]+"")&&q(k,g),L[1]?F?F.p(L,M):(F=ws(L),F.c(),F.m(i,null)):F&&(F.d(1),F=null)},i(L){A||(Z(l.$$.fragment,L),A=!0)},o(L){ie(l.$$.fragment,L),A=!1},d(L){L&&T(e),Ne(l),F&&F.d()}}}function D1(t,e,l){let{val:n}=e,{max:i}=e,{unit:s}=e,{label:a}=e,{sub:r=""}=e,{subunit:f=""}=e,{colorFn:c}=e,_,m=0;return t.$$set=d=>{"val"in d&&l(6,n=d.val),"max"in d&&l(7,i=d.max),"unit"in d&&l(8,s=d.unit),"label"in d&&l(0,a=d.label),"sub"in d&&l(1,r=d.sub),"subunit"in d&&l(2,f=d.subunit),"colorFn"in d&&l(3,c=d.colorFn)},t.$$.update=()=>{t.$$.dirty&448&&(l(4,_=ol(n,s)),l(5,m=Math.min(n,i)/i*100))},[a,r,f,c,_,m,n,i,s]}class mu extends Nt{constructor(e){super(),Mt(this,e,D1,q1,St,{val:6,max:7,unit:8,label:0,sub:1,subunit:2,colorFn:3})}}function Cs(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Ss(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Ms(t,e,l){const n=t.slice();return n[15]=e[l],n}function Ns(t){let e,l,n,i,s,a,r,f=(t[0].title||t[0].link)&&Ts(t),c=gt(t[0].y.ticks),_=[];for(let g=0;g{f=null}),vt()),k&129){c=gt(g[0].y.ticks);let w;for(w=0;w{s=null}),vt())},i(a){n||(Z(s),n=!0)},o(a){ie(s),n=!1},d(a){a&&T(e),i&&i.d(),s&&s.d()}}}function Ps(t){let e,l=t[0].title+"",n,i;return{c(){e=p("div"),n=C(l),u(e,"class","text-sm font-bold"),At(()=>t[9].call(e))},m(s,a){P(s,e,a),o(e,n),i=Di(e,t[9].bind(e))},p(s,a){a&1&&l!==(l=s[0].title+"")&&q(n,l)},d(s){s&&T(e),i()}}}function Es(t){let e,l,n,i;const s=[L1,A1],a=[];function r(f,c){return f[0].link.route?0:1}return l=r(t),n=a[l]=s[l](t),{c(){e=p("div"),n.c(),u(e,"class","text-xs text-right")},m(f,c){P(f,e,c),a[l].m(e,null),i=!0},p(f,c){let _=l;l=r(f),l===_?a[l].p(f,c):(ht(),ie(a[_],1,1,()=>{a[_]=null}),vt(),n=a[l],n?n.p(f,c):(n=a[l]=s[l](f),n.c()),Z(n,1),n.m(e,null))},i(f){i||(Z(n),i=!0)},o(f){ie(n),i=!1},d(f){f&&T(e),a[l].d()}}}function A1(t){let e,l=t[0].link.text+"",n,i,s;return{c(){e=p("a"),n=C(l),u(e,"href",i=t[0].link.url),u(e,"target",s=t[0].link.target)},m(a,r){P(a,e,r),o(e,n)},p(a,r){r&1&&l!==(l=a[0].link.text+"")&&q(n,l),r&1&&i!==(i=a[0].link.url)&&u(e,"href",i),r&1&&s!==(s=a[0].link.target)&&u(e,"target",s)},i:Ve,o:Ve,d(a){a&&T(e)}}}function L1(t){let e,l;return e=new _l({props:{to:t[0].link.url,$$slots:{default:[O1]},$$scope:{ctx:t}}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.to=n[0].link.url),i&262145&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function O1(t){let e=t[0].link.text+"",l;return{c(){l=C(e)},m(n,i){P(n,l,i)},p(n,i){i&1&&e!==(e=n[0].link.text+"")&&q(l,e)},d(n){n&&T(l)}}}function qs(t){let e,l,n,i=t[15].label+"",s,a,r,f;return{c(){e=Et("g"),l=Et("line"),n=Et("text"),s=C(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",a=t[15].align=="right"?"85%":""),u(e,"class",r="tick tick-"+t[15].value+" tick-"+t[15].color),u(e,"transform",f="translate(0, "+t[7](t[15].value)+")")},m(c,_){P(c,e,_),o(e,l),o(e,n),o(n,s)},p(c,_){_&1&&i!==(i=c[15].label+"")&&q(s,i),_&1&&a!==(a=c[15].align=="right"?"85%":"")&&u(n,"x",a),_&1&&r!==(r="tick tick-"+c[15].value+" tick-"+c[15].color)&&u(e,"class",r),_&129&&f!==(f="translate(0, "+c[7](c[15].value)+")")&&u(e,"transform",f)},d(c){c&&T(e)}}}function Ds(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&qs(t);return{c(){n&&n.c(),l=Vt()},m(i,s){n&&n.m(i,s),P(i,l,s)},p(i,s){s&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,s):(n=qs(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&T(l),n&&n.d(i)}}}function As(t){let e,l,n=(t[3]>20||t[13]%2==0)&&Ls(t);return{c(){e=Et("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,s){P(i,e,s),n&&n.m(e,null)},p(i,s){i[3]>20||i[13]%2==0?n?n.p(i,s):(n=Ls(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),s&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&T(e),n&&n.d()}}}function Ls(t){let e,l=t[11].label+"",n,i;return{c(){e=Et("text"),n=C(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(s,a){P(s,e,a),o(e,n)},p(s,a){a&1&&l!==(l=s[11].label+"")&&q(n,l),a&8&&i!==(i=s[3]/2)&&u(e,"x",i)},d(s){s&&T(e)}}}function Os(t){let e=!isNaN(t[6](t[13])),l,n=e&&As(t);return{c(){n&&n.c(),l=Vt()},m(i,s){n&&n.m(i,s),P(i,l,s)},p(i,s){s&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,s):(n=As(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&T(l),n&&n.d(i)}}}function Is(t){let e,l,n=t[11].value!==void 0&&Rs(t),i=t[11].value2>1e-4&&Us(t);return{c(){e=Et("g"),n&&n.c(),l=Et("g"),i&&i.c()},m(s,a){P(s,e,a),n&&n.m(e,null),P(s,l,a),i&&i.m(l,null)},p(s,a){s[11].value!==void 0?n?n.p(s,a):(n=Rs(s),n.c(),n.m(e,null)):n&&(n.d(1),n=null),s[11].value2>1e-4?i?i.p(s,a):(i=Us(s),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(s){s&&(T(e),T(l)),n&&n.d(),i&&i.d()}}}function Rs(t){let e,l,n,i,s,a,r,f=t[3]>15&&Fs(t);return{c(){e=Et("rect"),f&&f.c(),r=Vt(),u(e,"x",l=t[6](t[13])+2),u(e,"y",n=t[7](t[11].value)),u(e,"width",i=t[3]-4),u(e,"height",s=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),u(e,"fill",a=t[11].color)},m(c,_){P(c,e,_),f&&f.m(c,_),P(c,r,_)},p(c,_){_&64&&l!==(l=c[6](c[13])+2)&&u(e,"x",l),_&129&&n!==(n=c[7](c[11].value))&&u(e,"y",n),_&8&&i!==(i=c[3]-4)&&u(e,"width",i),_&129&&s!==(s=c[7](c[0].y.min)-c[7](Math.min(c[0].y.min,0)+c[11].value))&&u(e,"height",s),_&1&&a!==(a=c[11].color)&&u(e,"fill",a),c[3]>15?f?f.p(c,_):(f=Fs(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(T(e),T(r)),f&&f.d(c)}}}function Fs(t){let e,l=t[11].label+"",n,i,s,a,r,f,c=t[11].title&&Bs(t);return{c(){e=Et("text"),n=C(l),c&&c.c(),f=Vt(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",s=t[3]t[7](0)-t[8]&&!t[0].dark?t[11].color:"white"),u(e,"transform",r="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]_[7](0)-_[8]&&!_[0].dark?_[11].color:"white")&&u(e,"fill",a),m&457&&r!==(r="translate("+(_[6](_[13])+_[3]/2)+" "+(_[7](_[11].value)>_[7](0)-_[8]?_[7](_[11].value)-_[8]:_[7](_[11].value)+10)+") rotate("+(_[11].labelAngle?_[11].labelAngle:_[3]15&&js(t);return{c(){e=Et("rect"),f&&f.c(),r=Vt(),u(e,"x",l=t[6](t[13])+2),u(e,"y",n=t[7](0)),u(e,"width",i=t[3]-4),u(e,"height",s=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),u(e,"fill",a=t[11].color2?t[11].color2:t[11].color)},m(c,_){P(c,e,_),f&&f.m(c,_),P(c,r,_)},p(c,_){_&64&&l!==(l=c[6](c[13])+2)&&u(e,"x",l),_&128&&n!==(n=c[7](0))&&u(e,"y",n),_&8&&i!==(i=c[3]-4)&&u(e,"width",i),_&129&&s!==(s=c[7](c[0].y.min)-c[7](c[0].y.min+c[11].value2))&&u(e,"height",s),_&1&&a!==(a=c[11].color2?c[11].color2:c[11].color)&&u(e,"fill",a),c[3]>15?f?f.p(c,_):(f=js(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(T(e),T(r)),f&&f.d(c)}}}function js(t){let e,l=t[11].label2+"",n,i,s,a,r,f=t[11].title2&&Hs(t);return{c(){e=Et("text"),n=C(l),f&&f.c(),r=Vt(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor","middle"),u(e,"fill",s=t[7](-t[11].value2)t[10].call(e))},m(s,a){P(s,e,a),i&&i.m(e,null),l=Di(e,t[10].bind(e)),n=!0},p(s,[a]){s[0].x.ticks&&s[0].points&&s[4]?i?(i.p(s,a),a&17&&Z(i,1)):(i=Ns(s),i.c(),Z(i,1),i.m(e,null)):i&&(ht(),ie(i,1,1,()=>{i=null}),vt())},i(s){n||(Z(i),n=!0)},o(s){ie(i),n=!1},d(s){s&&T(e),i&&i.d(),l()}}}let jl=30;function R1(t,e,l){let{config:n}=e,i,s,a,r,f,c,_,m=0;function d(){m=this.clientHeight,l(5,m)}function h(){i=this.clientWidth,s=this.clientHeight,l(1,i),l(2,s)}return t.$$set=b=>{"config"in b&&l(0,n=b.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,c=s-m);let b=i-(n.padding.left+n.padding.right);l(3,a=b/n.points.length),l(8,_=an.y.max?w=n.padding.bottom:kc||w<0?0:w})}},[n,i,s,a,c,m,r,f,_,d,h]}class Wl extends Nt{constructor(e){super(),Mt(this,e,R1,I1,St,{config:0})}}function F1(t){let e,l;return e=new Wl({props:{config:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function B1(t,e,l){let{title:n}=e,{u1:i}=e,{u2:s}=e,{u3:a}=e,{ds:r}=e,f={};function c(_){return{label:Ut(_)+"V",title:_.toFixed(1)+" V",value:isNaN(_)?0:_,color:yr(_||0,document.documentElement.classList.contains("dark"))}}return t.$$set=_=>{"title"in _&&l(1,n=_.title),"u1"in _&&l(2,i=_.u1),"u2"in _&&l(3,s=_.u2),"u3"in _&&l(4,a=_.u3),"ds"in _&&l(5,r=_.ds)},t.$$.update=()=>{if(t.$$.dirty&62){let _=[],m=[];i>0&&(_.push({label:r===1?"L1-L2":"L1"}),m.push(c(i))),s>0&&(_.push({label:r===1?"L1-L3":"L2"}),m.push(c(s))),a>0&&(_.push({label:r===1?"L2-L3":"L3"}),m.push(c(a))),l(0,f={title:n,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:_},points:m})}},[f,n,i,s,a,r]}class U1 extends Nt{constructor(e){super(),Mt(this,e,B1,F1,St,{title:1,u1:2,u2:3,u3:4,ds:5})}}function j1(t){var E,j,ne,fe,me;let e,l,n=(((E=t[0].reactive)==null?void 0:E.title)??"Reactive")+"",i,s,a,r,f=(((j=t[0].reactive)==null?void 0:j.instant_in)??"Instant in")+"",c,_,m,d=t[1][0]+"",h,b,g=t[1][1]+"",k,w,A,F=(((ne=t[0].reactive)==null?void 0:ne.instant_out)??"Instant out")+"",L,M,R,O=t[2][0]+"",H,K,W=t[2][1]+"",N,B,X,G,V=(((fe=t[0].reactive)==null?void 0:fe.total_in)??"Total in")+"",Y,U,z,se=t[3][0]+"",le,Q,ee=t[3][1]+"",ue,ae,x,_e=(((me=t[0].reactive)==null?void 0:me.total_out)??"Total out")+"",oe,J,$,ve=t[4][0]+"",ke,D,S=t[4][1]+"",I;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),r=p("div"),c=C(f),_=v(),m=p("div"),h=C(d),b=v(),k=C(g),w=v(),A=p("div"),L=C(F),M=v(),R=p("div"),H=C(O),K=v(),N=C(W),B=v(),X=p("div"),G=p("div"),Y=C(V),U=v(),z=p("div"),le=C(se),Q=v(),ue=C(ee),ae=v(),x=p("div"),oe=C(_e),J=v(),$=p("div"),ke=C(ve),D=v(),I=C(S),u(m,"class","text-right"),u(R,"class","text-right"),u(a,"class","grid grid-cols-2 mt-4"),u(z,"class","text-right"),u($,"class","text-right"),u(X,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(he,pe){P(he,e,pe),o(e,l),o(l,i),o(e,s),o(e,a),o(a,r),o(r,c),o(a,_),o(a,m),o(m,h),o(m,b),o(m,k),o(a,w),o(a,A),o(A,L),o(a,M),o(a,R),o(R,H),o(R,K),o(R,N),o(e,B),o(e,X),o(X,G),o(G,Y),o(X,U),o(X,z),o(z,le),o(z,Q),o(z,ue),o(X,ae),o(X,x),o(x,oe),o(X,J),o(X,$),o($,ke),o($,D),o($,I)},p(he,[pe]){var Se,we,Le,qe,Re;pe&1&&n!==(n=(((Se=he[0].reactive)==null?void 0:Se.title)??"Reactive")+"")&&q(i,n),pe&1&&f!==(f=(((we=he[0].reactive)==null?void 0:we.instant_in)??"Instant in")+"")&&q(c,f),pe&2&&d!==(d=he[1][0]+"")&&q(h,d),pe&2&&g!==(g=he[1][1]+"")&&q(k,g),pe&1&&F!==(F=(((Le=he[0].reactive)==null?void 0:Le.instant_out)??"Instant out")+"")&&q(L,F),pe&4&&O!==(O=he[2][0]+"")&&q(H,O),pe&4&&W!==(W=he[2][1]+"")&&q(N,W),pe&1&&V!==(V=(((qe=he[0].reactive)==null?void 0:qe.total_in)??"Total in")+"")&&q(Y,V),pe&8&&se!==(se=he[3][0]+"")&&q(le,se),pe&8&&ee!==(ee=he[3][1]+"")&&q(ue,ee),pe&1&&_e!==(_e=(((Re=he[0].reactive)==null?void 0:Re.total_out)??"Total out")+"")&&q(oe,_e),pe&16&&ve!==(ve=he[4][0]+"")&&q(ke,ve),pe&16&&S!==(S=he[4][1]+"")&&q(I,S)},i:Ve,o:Ve,d(he){he&&T(e)}}}function H1(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:s}=e,{exportTotal:a}=e,{translations:r={}}=e,f,c,_,m;return t.$$set=d=>{"importInstant"in d&&l(5,n=d.importInstant),"exportInstant"in d&&l(6,i=d.exportInstant),"importTotal"in d&&l(7,s=d.importTotal),"exportTotal"in d&&l(8,a=d.exportTotal),"translations"in d&&l(0,r=d.translations)},t.$$.update=()=>{t.$$.dirty&480&&(l(1,f=ol(n,"VAr")),l(2,c=ol(i,"VAr")),l(3,_=ol(s*1e3,"VArh")),l(4,m=ol(a*1e3,"VArh")))},[r,f,c,_,m,n,i,s,a]}class y1 extends Nt{constructor(e){super(),Mt(this,e,H1,j1,St,{importInstant:5,exportInstant:6,importTotal:7,exportTotal:8,translations:0})}}function zs(t){let e;function l(s,a){return s[3]?W1:z1}let n=l(t),i=n(t);return{c(){i.c(),e=Vt()},m(s,a){i.m(s,a),P(s,e,a)},p(s,a){n===(n=l(s))&&i?i.p(s,a):(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},d(s){s&&T(e),i.d(s)}}}function z1(t){var j,ne,fe,me,he;let e,l=(((j=t[4].realtime)==null?void 0:j.consumption)??"Consumption")+"",n,i,s,a,r=Xt(((ne=t[4].common)==null?void 0:ne.hour)??"Hour")+"",f,c,_,m=t[6][0]+"",d,h,b=t[6][1]+"",g,k,w,A=Xt(((fe=t[4].common)==null?void 0:fe.day)??"Day")+"",F,L,M,R=t[7][0]+"",O,H,K=t[7][1]+"",W,N,B,X=Xt(((me=t[4].common)==null?void 0:me.month)??"Month")+"",G,V,Y,U=t[8][0]+"",z,se,le=t[8][1]+"",Q,ee,ue,ae=(((he=t[4].realtime)==null?void 0:he.last_month)??"Last month")+"",x,_e,oe,J=t[9][0]+"",$,ve,ke=t[9][1]+"",D,S,I,E=t[5]&&Ws(t);return{c(){e=p("strong"),n=C(l),i=v(),s=p("div"),a=p("div"),f=C(r),c=v(),_=p("div"),d=C(m),h=v(),g=C(b),k=v(),w=p("div"),F=C(A),L=v(),M=p("div"),O=C(R),H=v(),W=C(K),N=v(),B=p("div"),G=C(X),V=v(),Y=p("div"),z=C(U),se=v(),Q=C(le),ee=v(),ue=p("div"),x=C(ae),_e=v(),oe=p("div"),$=C(J),ve=v(),D=C(ke),S=v(),E&&E.c(),I=Vt(),u(_,"class","text-right"),u(M,"class","text-right"),u(Y,"class","text-right"),u(oe,"class","text-right"),u(s,"class","grid grid-cols-2 mb-3")},m(pe,Se){P(pe,e,Se),o(e,n),P(pe,i,Se),P(pe,s,Se),o(s,a),o(a,f),o(s,c),o(s,_),o(_,d),o(_,h),o(_,g),o(s,k),o(s,w),o(w,F),o(s,L),o(s,M),o(M,O),o(M,H),o(M,W),o(s,N),o(s,B),o(B,G),o(s,V),o(s,Y),o(Y,z),o(Y,se),o(Y,Q),o(s,ee),o(s,ue),o(ue,x),o(s,_e),o(s,oe),o(oe,$),o(oe,ve),o(oe,D),P(pe,S,Se),E&&E.m(pe,Se),P(pe,I,Se)},p(pe,Se){var we,Le,qe,Re,re;Se&16&&l!==(l=(((we=pe[4].realtime)==null?void 0:we.consumption)??"Consumption")+"")&&q(n,l),Se&16&&r!==(r=Xt(((Le=pe[4].common)==null?void 0:Le.hour)??"Hour")+"")&&q(f,r),Se&64&&m!==(m=pe[6][0]+"")&&q(d,m),Se&64&&b!==(b=pe[6][1]+"")&&q(g,b),Se&16&&A!==(A=Xt(((qe=pe[4].common)==null?void 0:qe.day)??"Day")+"")&&q(F,A),Se&128&&R!==(R=pe[7][0]+"")&&q(O,R),Se&128&&K!==(K=pe[7][1]+"")&&q(W,K),Se&16&&X!==(X=Xt(((Re=pe[4].common)==null?void 0:Re.month)??"Month")+"")&&q(G,X),Se&256&&U!==(U=pe[8][0]+"")&&q(z,U),Se&256&&le!==(le=pe[8][1]+"")&&q(Q,le),Se&16&&ae!==(ae=(((re=pe[4].realtime)==null?void 0:re.last_month)??"Last month")+"")&&q(x,ae),Se&512&&J!==(J=pe[9][0]+"")&&q($,J),Se&512&&ke!==(ke=pe[9][1]+"")&&q(D,ke),pe[5]?E?E.p(pe,Se):(E=Ws(pe),E.c(),E.m(I.parentNode,I)):E&&(E.d(1),E=null)},d(pe){pe&&(T(e),T(i),T(s),T(S),T(I)),E&&E.d(pe)}}}function W1(t){var nt,Pe,kt,Wt,Qt,xt,Ft,tl,ll,il;let e,l=(((nt=t[4].common)==null?void 0:nt.import)??"Import")+"",n,i,s,a,r=Xt(((Pe=t[4].common)==null?void 0:Pe.hour)??"Hour")+"",f,c,_,m=t[6][0]+"",d,h,b=t[6][1]+"",g,k,w,A,F=Xt(((kt=t[4].common)==null?void 0:kt.day)??"Day")+"",L,M,R,O=t[7][0]+"",H,K,W=t[7][1]+"",N,B,X,G,V=Xt(((Wt=t[4].common)==null?void 0:Wt.month)??"Month")+"",Y,U,z,se=t[8][0]+"",le,Q,ee=t[8][1]+"",ue,ae,x,_e,oe=(((Qt=t[4].realtime)==null?void 0:Qt.last_mo)??"Last mo.")+"",J,$,ve,ke=t[9][0]+"",D,S,I=t[9][1]+"",E,j,ne,fe,me,he=(((xt=t[4].common)==null?void 0:xt.export)??"Export")+"",pe,Se,we,Le,qe=Xt(((Ft=t[4].common)==null?void 0:Ft.hour)??"Hour")+"",Re,re,Ce,Ue=t[10][0]+"",it,_t,et=t[10][1]+"",tt,lt,ot,Ze,bt=Xt(((tl=t[4].common)==null?void 0:tl.day)??"Day")+"",st,Tt,Oe,De=t[11][0]+"",He,ze,de=t[11][1]+"",Ee,Ge,ge,Ae,Je=Xt(((ll=t[4].common)==null?void 0:ll.month)??"Month")+"",Qe,It,$e,Fe=t[12][0]+"",wt,ut,rt=t[12][1]+"",mt,qt,jt,Pt,pt=(((il=t[4].realtime)==null?void 0:il.last_mo)??"Last mo.")+"",Ht,Kt,Rt,zt=t[13][0]+"",Yt,el,Jt=t[13][1]+"",$t,ye,ft,at=t[5]&&Gs(t),Dt=t[5]&&Vs(t),Ot=t[5]&&Ks(t),dt=t[5]&&Ys(t),Be=t[5]&&Qs(t),We=t[5]&&Xs(t),ct=t[5]&&Zs(t),be=t[5]&&Js(t);return{c(){e=p("strong"),n=C(l),i=v(),s=p("div"),a=p("div"),f=C(r),c=v(),_=p("div"),d=C(m),h=v(),g=C(b),k=v(),at&&at.c(),w=v(),A=p("div"),L=C(F),M=v(),R=p("div"),H=C(O),K=v(),N=C(W),B=v(),Dt&&Dt.c(),X=v(),G=p("div"),Y=C(V),U=v(),z=p("div"),le=C(se),Q=v(),ue=C(ee),ae=v(),Ot&&Ot.c(),x=v(),_e=p("div"),J=C(oe),$=v(),ve=p("div"),D=C(ke),S=v(),E=C(I),j=v(),dt&&dt.c(),fe=v(),me=p("strong"),pe=C(he),Se=v(),we=p("div"),Le=p("div"),Re=C(qe),re=v(),Ce=p("div"),it=C(Ue),_t=v(),tt=C(et),lt=v(),Be&&Be.c(),ot=v(),Ze=p("div"),st=C(bt),Tt=v(),Oe=p("div"),He=C(De),ze=v(),Ee=C(de),Ge=v(),We&&We.c(),ge=v(),Ae=p("div"),Qe=C(Je),It=v(),$e=p("div"),wt=C(Fe),ut=v(),mt=C(rt),qt=v(),ct&&ct.c(),jt=v(),Pt=p("div"),Ht=C(pt),Kt=v(),Rt=p("div"),Yt=C(zt),el=v(),$t=C(Jt),ye=v(),be&&be.c(),u(_,"class","text-right"),u(R,"class","text-right"),u(z,"class","text-right"),u(ve,"class","text-right"),u(s,"class",ne="grid grid-cols-"+t[14]+" mb-3"),u(Ce,"class","text-right"),u(Oe,"class","text-right"),u($e,"class","text-right"),u(Rt,"class","text-right"),u(we,"class",ft="grid grid-cols-"+t[14])},m(Ie,te){P(Ie,e,te),o(e,n),P(Ie,i,te),P(Ie,s,te),o(s,a),o(a,f),o(s,c),o(s,_),o(_,d),o(_,h),o(_,g),o(s,k),at&&at.m(s,null),o(s,w),o(s,A),o(A,L),o(s,M),o(s,R),o(R,H),o(R,K),o(R,N),o(s,B),Dt&&Dt.m(s,null),o(s,X),o(s,G),o(G,Y),o(s,U),o(s,z),o(z,le),o(z,Q),o(z,ue),o(s,ae),Ot&&Ot.m(s,null),o(s,x),o(s,_e),o(_e,J),o(s,$),o(s,ve),o(ve,D),o(ve,S),o(ve,E),o(s,j),dt&&dt.m(s,null),P(Ie,fe,te),P(Ie,me,te),o(me,pe),P(Ie,Se,te),P(Ie,we,te),o(we,Le),o(Le,Re),o(we,re),o(we,Ce),o(Ce,it),o(Ce,_t),o(Ce,tt),o(we,lt),Be&&Be.m(we,null),o(we,ot),o(we,Ze),o(Ze,st),o(we,Tt),o(we,Oe),o(Oe,He),o(Oe,ze),o(Oe,Ee),o(we,Ge),We&&We.m(we,null),o(we,ge),o(we,Ae),o(Ae,Qe),o(we,It),o(we,$e),o($e,wt),o($e,ut),o($e,mt),o(we,qt),ct&&ct.m(we,null),o(we,jt),o(we,Pt),o(Pt,Ht),o(we,Kt),o(we,Rt),o(Rt,Yt),o(Rt,el),o(Rt,$t),o(we,ye),be&&be.m(we,null)},p(Ie,te){var je,fl,ul,vl,bl,gl,kl,wl,Cl,Sl;te&16&&l!==(l=(((je=Ie[4].common)==null?void 0:je.import)??"Import")+"")&&q(n,l),te&16&&r!==(r=Xt(((fl=Ie[4].common)==null?void 0:fl.hour)??"Hour")+"")&&q(f,r),te&64&&m!==(m=Ie[6][0]+"")&&q(d,m),te&64&&b!==(b=Ie[6][1]+"")&&q(g,b),Ie[5]?at?at.p(Ie,te):(at=Gs(Ie),at.c(),at.m(s,w)):at&&(at.d(1),at=null),te&16&&F!==(F=Xt(((ul=Ie[4].common)==null?void 0:ul.day)??"Day")+"")&&q(L,F),te&128&&O!==(O=Ie[7][0]+"")&&q(H,O),te&128&&W!==(W=Ie[7][1]+"")&&q(N,W),Ie[5]?Dt?Dt.p(Ie,te):(Dt=Vs(Ie),Dt.c(),Dt.m(s,X)):Dt&&(Dt.d(1),Dt=null),te&16&&V!==(V=Xt(((vl=Ie[4].common)==null?void 0:vl.month)??"Month")+"")&&q(Y,V),te&256&&se!==(se=Ie[8][0]+"")&&q(le,se),te&256&&ee!==(ee=Ie[8][1]+"")&&q(ue,ee),Ie[5]?Ot?Ot.p(Ie,te):(Ot=Ks(Ie),Ot.c(),Ot.m(s,x)):Ot&&(Ot.d(1),Ot=null),te&16&&oe!==(oe=(((bl=Ie[4].realtime)==null?void 0:bl.last_mo)??"Last mo.")+"")&&q(J,oe),te&512&&ke!==(ke=Ie[9][0]+"")&&q(D,ke),te&512&&I!==(I=Ie[9][1]+"")&&q(E,I),Ie[5]?dt?dt.p(Ie,te):(dt=Ys(Ie),dt.c(),dt.m(s,null)):dt&&(dt.d(1),dt=null),te&16384&&ne!==(ne="grid grid-cols-"+Ie[14]+" mb-3")&&u(s,"class",ne),te&16&&he!==(he=(((gl=Ie[4].common)==null?void 0:gl.export)??"Export")+"")&&q(pe,he),te&16&&qe!==(qe=Xt(((kl=Ie[4].common)==null?void 0:kl.hour)??"Hour")+"")&&q(Re,qe),te&1024&&Ue!==(Ue=Ie[10][0]+"")&&q(it,Ue),te&1024&&et!==(et=Ie[10][1]+"")&&q(tt,et),Ie[5]?Be?Be.p(Ie,te):(Be=Qs(Ie),Be.c(),Be.m(we,ot)):Be&&(Be.d(1),Be=null),te&16&&bt!==(bt=Xt(((wl=Ie[4].common)==null?void 0:wl.day)??"Day")+"")&&q(st,bt),te&2048&&De!==(De=Ie[11][0]+"")&&q(He,De),te&2048&&de!==(de=Ie[11][1]+"")&&q(Ee,de),Ie[5]?We?We.p(Ie,te):(We=Xs(Ie),We.c(),We.m(we,ge)):We&&(We.d(1),We=null),te&16&&Je!==(Je=Xt(((Cl=Ie[4].common)==null?void 0:Cl.month)??"Month")+"")&&q(Qe,Je),te&4096&&Fe!==(Fe=Ie[12][0]+"")&&q(wt,Fe),te&4096&&rt!==(rt=Ie[12][1]+"")&&q(mt,rt),Ie[5]?ct?ct.p(Ie,te):(ct=Zs(Ie),ct.c(),ct.m(we,jt)):ct&&(ct.d(1),ct=null),te&16&&pt!==(pt=(((Sl=Ie[4].realtime)==null?void 0:Sl.last_mo)??"Last mo.")+"")&&q(Ht,pt),te&8192&&zt!==(zt=Ie[13][0]+"")&&q(Yt,zt),te&8192&&Jt!==(Jt=Ie[13][1]+"")&&q($t,Jt),Ie[5]?be?be.p(Ie,te):(be=Js(Ie),be.c(),be.m(we,null)):be&&(be.d(1),be=null),te&16384&&ft!==(ft="grid grid-cols-"+Ie[14])&&u(we,"class",ft)},d(Ie){Ie&&(T(e),T(i),T(s),T(fe),T(me),T(Se),T(we)),at&&at.d(),Dt&&Dt.d(),Ot&&Ot.d(),dt&&dt.d(),Be&&Be.d(),We&&We.d(),ct&&ct.d(),be&&be.d()}}}function Ws(t){var $,ve,ke,D,S,I;let e,l=((($=t[4].realtime)==null?void 0:$.cost)??"Cost")+"",n,i,s,a,r=Xt(((ve=t[4].common)==null?void 0:ve.hour)??"Hour")+"",f,c,_,m=Ut(t[1].h.c,2)+"",d,h,b,g,k,w=Xt(((ke=t[4].common)==null?void 0:ke.day)??"Day")+"",A,F,L,M=Ut(t[1].d.c,1)+"",R,O,H,K,W,N=Xt(((D=t[4].common)==null?void 0:D.month)??"Month")+"",B,X,G,V=Ut(t[1].m.c)+"",Y,U,z,se,le,Q=(((S=t[4].realtime)==null?void 0:S.last_month)??"Last month")+"",ee,ue,ae,x=Ut((I=t[0].last_month)==null?void 0:I.c)+"",_e,oe,J;return{c(){e=p("strong"),n=C(l),i=v(),s=p("div"),a=p("div"),f=C(r),c=v(),_=p("div"),d=C(m),h=v(),b=C(t[2]),g=v(),k=p("div"),A=C(w),F=v(),L=p("div"),R=C(M),O=v(),H=C(t[2]),K=v(),W=p("div"),B=C(N),X=v(),G=p("div"),Y=C(V),U=v(),z=C(t[2]),se=v(),le=p("div"),ee=C(Q),ue=v(),ae=p("div"),_e=C(x),oe=v(),J=C(t[2]),u(_,"class","text-right"),u(L,"class","text-right"),u(G,"class","text-right"),u(ae,"class","text-right"),u(s,"class","grid grid-cols-2")},m(E,j){P(E,e,j),o(e,n),P(E,i,j),P(E,s,j),o(s,a),o(a,f),o(s,c),o(s,_),o(_,d),o(_,h),o(_,b),o(s,g),o(s,k),o(k,A),o(s,F),o(s,L),o(L,R),o(L,O),o(L,H),o(s,K),o(s,W),o(W,B),o(s,X),o(s,G),o(G,Y),o(G,U),o(G,z),o(s,se),o(s,le),o(le,ee),o(s,ue),o(s,ae),o(ae,_e),o(ae,oe),o(ae,J)},p(E,j){var ne,fe,me,he,pe,Se;j&16&&l!==(l=(((ne=E[4].realtime)==null?void 0:ne.cost)??"Cost")+"")&&q(n,l),j&16&&r!==(r=Xt(((fe=E[4].common)==null?void 0:fe.hour)??"Hour")+"")&&q(f,r),j&2&&m!==(m=Ut(E[1].h.c,2)+"")&&q(d,m),j&4&&q(b,E[2]),j&16&&w!==(w=Xt(((me=E[4].common)==null?void 0:me.day)??"Day")+"")&&q(A,w),j&2&&M!==(M=Ut(E[1].d.c,1)+"")&&q(R,M),j&4&&q(H,E[2]),j&16&&N!==(N=Xt(((he=E[4].common)==null?void 0:he.month)??"Month")+"")&&q(B,N),j&2&&V!==(V=Ut(E[1].m.c)+"")&&q(Y,V),j&4&&q(z,E[2]),j&16&&Q!==(Q=(((pe=E[4].realtime)==null?void 0:pe.last_month)??"Last month")+"")&&q(ee,Q),j&1&&x!==(x=Ut((Se=E[0].last_month)==null?void 0:Se.c)+"")&&q(_e,x),j&4&&q(J,E[2])},d(E){E&&(T(e),T(i),T(s))}}}function Gs(t){let e,l=Ut(t[1].h.c,2)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Ut(a[1].h.c,2)+"")&&q(n,l),r&4&&q(s,a[2])},d(a){a&&T(e)}}}function Vs(t){let e,l=Ut(t[1].d.c,1)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Ut(a[1].d.c,1)+"")&&q(n,l),r&4&&q(s,a[2])},d(a){a&&T(e)}}}function Ks(t){let e,l=Ut(t[1].m.c)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Ut(a[1].m.c)+"")&&q(n,l),r&4&&q(s,a[2])},d(a){a&&T(e)}}}function Ys(t){var a;let e,l=Ut((a=t[0].last_month)==null?void 0:a.c)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(r,f){P(r,e,f),o(e,n),o(e,i),o(e,s)},p(r,f){var c;f&1&&l!==(l=Ut((c=r[0].last_month)==null?void 0:c.c)+"")&&q(n,l),f&4&&q(s,r[2])},d(r){r&&T(e)}}}function Qs(t){let e,l=Ut(t[1].h.i,2)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Ut(a[1].h.i,2)+"")&&q(n,l),r&4&&q(s,a[2])},d(a){a&&T(e)}}}function Xs(t){let e,l=Ut(t[1].d.i,1)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Ut(a[1].d.i,1)+"")&&q(n,l),r&4&&q(s,a[2])},d(a){a&&T(e)}}}function Zs(t){let e,l=Ut(t[1].m.i)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Ut(a[1].m.i)+"")&&q(n,l),r&4&&q(s,a[2])},d(a){a&&T(e)}}}function Js(t){var a;let e,l=Ut((a=t[0].last_month)==null?void 0:a.i)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(r,f){P(r,e,f),o(e,n),o(e,i),o(e,s)},p(r,f){var c;f&1&&l!==(l=Ut((c=r[0].last_month)==null?void 0:c.i)+"")&&q(n,l),f&4&&q(s,r[2])},d(r){r&&T(e)}}}function G1(t){var _;let e,l,n=(((_=t[4].realtime)==null?void 0:_.title)??"Real time calculations")+"",i,s,a,r,f,c=t[1]&&zs(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("br"),r=p("br"),f=v(),c&&c.c(),u(e,"class","mx-2 text-sm")},m(m,d){P(m,e,d),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),c&&c.m(e,null)},p(m,[d]){var h;d&16&&n!==(n=(((h=m[4].realtime)==null?void 0:h.title)??"Real time calculations")+"")&&q(i,n),m[1]?c?c.p(m,d):(c=zs(m),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:Ve,o:Ve,d(m){m&&T(e),c&&c.d()}}}function V1(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:s}=e,{hasExport:a}=e,{translations:r={}}=e,f,c,_,m,d,h,b,g,k=!1,w=3;return t.$$set=A=>{"sysinfo"in A&&l(0,n=A.sysinfo),"data"in A&&l(1,i=A.data),"currency"in A&&l(2,s=A.currency),"hasExport"in A&&l(3,a=A.hasExport),"translations"in A&&l(4,r=A.translations)},t.$$.update=()=>{var A,F,L,M,R,O,H,K;t.$$.dirty&35&&(l(5,k=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(14,w=k?3:2),l(6,f=ol(((A=i==null?void 0:i.h)==null?void 0:A.u)*1e3,"Wh")),l(7,c=ol(((F=i==null?void 0:i.d)==null?void 0:F.u)*1e3,"Wh")),l(8,_=ol(((L=i==null?void 0:i.m)==null?void 0:L.u)*1e3,"Wh")),l(9,m=ol(((M=n==null?void 0:n.last_month)==null?void 0:M.u)*1e3,"Wh")),l(10,d=ol(((R=i==null?void 0:i.h)==null?void 0:R.p)*1e3,"Wh")),l(11,h=ol(((O=i==null?void 0:i.d)==null?void 0:O.p)*1e3,"Wh")),l(12,b=ol(((H=i==null?void 0:i.m)==null?void 0:H.p)*1e3,"Wh")),l(13,g=ol(((K=n==null?void 0:n.last_month)==null?void 0:K.p)*1e3,"Wh")))},[n,i,s,a,r,k,f,c,_,m,d,h,b,g,w]}class K1 extends Nt{constructor(e){super(),Mt(this,e,V1,G1,St,{sysinfo:0,data:1,currency:2,hasExport:3,translations:4})}}function Y1(t){let e,l;return e=new Wl({props:{config:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Q1(t,e,l){let{title:n}=e,{json:i}=e,{sysinfo:s}=e,a={},r,f,c=document.documentElement.classList.contains("dark");return t.$$set=_=>{"title"in _&&l(1,n=_.title),"json"in _&&l(2,i=_.json),"sysinfo"in _&&l(3,s=_.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let _=i.currency,m=new Date().getUTCHours(),d=0,h=0,b=0,g=[],k=[],w=[];l(5,f=l(4,r=0));let A=new Date;for(Al(A,s.clock_offset-(24+A.getHours()-A.getUTCHours())%24),d=m;d<24&&(h=i[Ct(b++)],h!=null);d++)k.push({label:Ct(A.getHours())}),w.push(h*100),l(5,f=Math.min(f,h*100)),l(4,r=Math.max(r,h*100)),Al(A,1);for(d=0;d<24&&(h=i[Ct(b++)],h!=null);d++)k.push({label:Ct(A.getHours())}),w.push(h*100),l(5,f=Math.min(f,h*100)),l(4,r=Math.max(r,h*100)),Al(A,1);if(f>-100&&r<100){switch(_){case"NOK":case"DKK":_="øre";break;case"SEK":_="öre";break;case"EUR":_="cent";break;case"CHF":_="rp.";break;default:_=_+"/100"}for(l(5,f*=100),l(4,r*=100),d=0;d=0?O.toFixed(H):"",title:O>=0?O.toFixed(2)+" "+_:"",value:h>=0?Math.abs(h):0,label2:O<0?O.toFixed(H):"",title2:O<0?O.toFixed(2)+" "+_:"",value2:h<0?Math.abs(h):0,color:c?"#5c2da5":"#7c3aed"})}let L=Math.max(r,Math.abs(f));if(f<0){l(5,f=Math.min(L/4*-1,f));let O=Math.ceil(Math.abs(f)/L*4),H=f/O;for(d=1;d{"title"in _&&l(1,n=_.title),"json"in _&&l(2,i=_.json),"sysinfo"in _&&l(3,s=_.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let _=0,m=[],d=[],h=[];l(5,f=l(4,r=0));let b=new Date,g=new Date;g.setDate(0),g.setHours(12);let k=(g.getHours()-g.getUTCHours())%24-s.clock_offset,w=b.getUTCHours();for(Al(b,-k-24),_=w;_<24;_++){let M=i["i"+Ct(_)],R=i["e"+Ct(_)];M===void 0&&(M=0),R===void 0&&(R=0),d.push({label:Ct(b.getHours())}),h.push({label:M.toFixed(1),title:M.toFixed(2)+" kWh",value:M*10,label2:R.toFixed(1),title2:R.toFixed(2)+" kWh",value2:R*10,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,R*10)),l(4,r=Math.max(r,M*10)),Al(b,1)}for(_=0;_{"title"in _&&l(1,n=_.title),"json"in _&&l(2,i=_.json),"sysinfo"in _&&l(3,s=_.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let _=0,m=[],d=[],h=[];l(5,f=l(4,r=0));let b=new Date,g=new Date;g.setDate(0),g.setHours(12);let k=(g.getHours()-g.getUTCHours())%24-s.clock_offset;for(Al(b,-k),Al(g,-k),_=b.getDate();_<=g.getDate();_++){let L=i["i"+Ct(_)],M=i["e"+Ct(_)];L===void 0&&(L=0),M===void 0&&(M=0),d.push({label:Ct(_)}),h.push({label:L.toFixed(L<10?1:0),title:L.toFixed(2)+" kWh",value:L,label2:M.toFixed(M<10?1:0),title2:M.toFixed(2)+" kWh",value2:M,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,M)),l(4,r=Math.max(r,L))}for(_=1;_{"title"in c&&l(1,n=c.title),"json"in c&&l(2,i=c.json)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,_=0,m=[],d=[],h=[];i.s&&i.s.forEach((k,w)=>{var A=k.n?k.n:k.a;_=k.v,_==-127&&(_=0),d.push({label:A.slice(-4)}),h.push({label:_.toFixed(1),value:_,color:s?"#5c2da5":"#7c3aed"}),l(4,f=Math.min(f,_)),l(3,r=Math.max(r,_))}),l(3,r=Math.ceil(r)),l(4,f=Math.floor(f));let b=r;f<0&&(b+=Math.abs(f));let g=b/4;for(c=0;c<5;c++)_=f+g*c,m.push({value:_,label:_.toFixed(1)});l(0,a={title:n+" (°C)",dark:document.documentElement.classList.contains("dark"),height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:f,max:r,ticks:m},x:{ticks:d},points:h})}},[a,n,i,r,f]}class i0 extends Nt{constructor(e){super(),Mt(this,e,n0,l0,St,{title:1,json:2})}}function s0(t){let e,l;return e=new Wl({props:{config:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}let o0=0;function a0(t,e,l){let{title:n}=e,{translations:i={}}=e,s=document.documentElement.classList.contains("dark"),a={},r=0,{tariffData:f}=e;return t.$$set=c=>{"title"in c&&l(1,n=c.title),"translations"in c&&l(2,i=c.translations),"tariffData"in c&&l(3,f=c.tariffData)},t.$$.update=()=>{var c;if(t.$$.dirty&30){let _=0,m=[],d=[],h=[];if(m.push({value:0,label:0}),f&&f.p)for(_=0;_0?Ct(b.d)+"."+(i.months?(c=i.months)==null?void 0:c[new Date().getMonth()]:Ct(new Date().getMonth()+1)):"-"}),l(4,r=Math.max(r,b.v))}if(f&&f.t){for(_=0;_=r)break;m.push({value:b,label:b})}m.push({label:f.m.toFixed(1),align:"right",color:"green",value:f.m})}f&&f.c&&(m.push({label:f.c.toFixed(0),color:"orange",value:f.c}),l(4,r=Math.max(r,f.c))),l(4,r=Math.ceil(r)),l(0,a={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:35,bottom:20,left:35},y:{min:o0,max:r,ticks:m},x:{ticks:d},points:h})}},[a,n,i,f,r]}class f0 extends Nt{constructor(e){super(),Mt(this,e,a0,s0,St,{title:1,translations:2,tariffData:3})}}let Fl=0,u0={data:[]};async function ji(){let e=await(await dl(Fl<0?"realtime.json":"realtime.json?offset="+Fl)).json();Hi.update(l=>{for(let n=0;n=0&&(Fl+=e.size,FlYl||ki-Yl>300?(ji(),ii=0):Hi.update(t=>{if(t.lastUpdate)for(;Yl>t.lastUpdate;)t.data.unshift(pu),t.data=t.data.slice(0,t.size),t.lastUpdate+=10,ii++;else t.lastUpdate=Yl;return t})}function _0(t){if(pu=t.i-t.e,Yl=t.u,!$s){ji(),$s=!0,ki=Yl;return}r0()&&c0()}function xs(t,e,l){const n=t.slice();return n[18]=e[l],n[20]=l,n}function eo(t,e,l){const n=t.slice();return n[21]=e[l],n}function m0(t){let e,l,n;return{c(){e=p("strong"),l=C(t[0]),n=C(" not available"),u(e,"class","text-sm")},m(i,s){P(i,e,s),o(e,l),o(e,n)},p(i,s){s&1&&q(l,i[0])},d(i){i&&T(e)}}}function p0(t){let e,l,n,i,s,a,r,f=t[8]&&to(t);return{c(){e=p("strong"),l=C(t[0]),n=C(" ("),i=C(t[12]),s=C(")"),a=v(),f&&f.c(),r=Vt(),u(e,"class","text-sm")},m(c,_){P(c,e,_),o(e,l),o(e,n),o(e,i),o(e,s),P(c,a,_),f&&f.m(c,_),P(c,r,_)},p(c,_){_&1&&q(l,c[0]),_&4096&&q(i,c[12]),c[8]?f?f.p(c,_):(f=to(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(T(e),T(a),T(r)),f&&f.d(c)}}}function to(t){let e,l,n,i,s,a=gt(t[8]),r=[];for(let _=0;_t[17].call(e))},m(a,r){P(a,e,r),s.m(e,null),l=Di(e,t[17].bind(e))},p(a,[r]){i===(i=n(a))&&s?s.p(a,r):(s.d(1),s=i(a),s&&(s.c(),s.m(e,null)))},i:Ve,o:Ve,d(a){a&&T(e),s.d(),l()}}}function h0(t,e,l){let{title:n}=e,i=document.documentElement.classList.contains("dark"),s=null;Hi.subscribe(M=>{l(16,s=M)});let a=!1,r,f,c,_,m,d,h,b=function(M,R,O){return Math.ceil(m-(M-R)/(O-R)*m)-25},g=function(M){return 30+Math.ceil(M/s.size*(d-35))},k,w,A,F;function L(){c=this.clientWidth,_=this.clientHeight,l(3,c),l(4,_)}return t.$$set=M=>{"title"in M&&l(0,n=M.title)},t.$$.update=()=>{if(t.$$.dirty&67582)if(l(5,m=parseInt(_)-50),l(6,d=c-35),l(10,A=d/s.size),l(2,f=0),l(1,r=0),s.data&&m>10&&d>100&&A>.1){l(11,a=!0);for(let O in s.data){let H=s.data[O];isNaN(H)&&(H=0),l(1,r=Math.max(Math.ceil(H/1e3)*1e3,r)),l(2,f=Math.min(Math.floor(H/1e3)*1e3,f))}let M=r-f;l(12,F=r>2500?"kW":"W"),l(8,k=[]);for(let O=f;O2500?(O/1e3).toFixed(1):O}),!(k.length>6));O+=M/5);l(9,w=[]);for(let O=0;O12));O+=Math.round(s.size/Math.round(d/120)));let R=s.size;l(7,h=g(s.size)+","+b(0,f,r)+" "+g(1)+","+b(0,f,r));for(let O in s.data){if(R<0)break;let H=s.data[O];isNaN(H)&&(H=0),l(7,h=g(R--)+","+b(H,f,r)+" "+h)}}else l(11,a=!1)},[n,r,f,c,_,m,d,h,k,w,A,a,F,i,b,g,s,L]}class v0 extends Nt{constructor(e){super(),Mt(this,e,h0,d0,St,{title:0})}}function b0(t){let e,l;return e=new Wl({props:{config:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function g0(t,e,l){let{title:n}=e,{unit:i=""}=e,{l1:s=!1}=e,{l2:a=!1}=e,{l2x:r=!1}=e,{l3:f=!1}=e,{l1i:c=0}=e,{l2i:_=0}=e,{l3i:m=0}=e,{l1e:d=0}=e,{l2e:h=0}=e,{l3e:b=0}=e,{maxImport:g=0}=e,{maxExport:k=0}=e,{importColorFn:w}=e,{exportColorFn:A}=e,F={};function L(M,R){return{label:Ut(M>900?M/1e3:M)+(M>900?"k":"")+i,title:M.toFixed(2)+" "+i,value:isNaN(M)?0:M,color:w(M?M/g*100:0,document.documentElement.classList.contains("dark")),label2:Ut(R>900?R/1e3:R)+(R>900?"k":"")+i,title2:R.toFixed(2)+" "+i,value2:isNaN(R)?0:R,color2:A(R?R/k*100:0)}}return t.$$set=M=>{"title"in M&&l(1,n=M.title),"unit"in M&&l(2,i=M.unit),"l1"in M&&l(3,s=M.l1),"l2"in M&&l(4,a=M.l2),"l2x"in M&&l(5,r=M.l2x),"l3"in M&&l(6,f=M.l3),"l1i"in M&&l(7,c=M.l1i),"l2i"in M&&l(8,_=M.l2i),"l3i"in M&&l(9,m=M.l3i),"l1e"in M&&l(10,d=M.l1e),"l2e"in M&&l(11,h=M.l2e),"l3e"in M&&l(12,b=M.l3e),"maxImport"in M&&l(13,g=M.maxImport),"maxExport"in M&&l(14,k=M.maxExport),"importColorFn"in M&&l(15,w=M.importColorFn),"exportColorFn"in M&&l(16,A=M.exportColorFn)},t.$$.update=()=>{if(t.$$.dirty&32762){let M=[],R=[];s&&(M.push({label:"L1"}),R.push(L(c,d))),a&&(r?(M.push({label:"L2"}),R.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(M.push({label:"L2"}),R.push(L(_,h)))),f&&(M.push({label:"L3"}),R.push(L(m,b)));let O=[];if(k){let H=k>g?4:k*4/g;O.push({value:-k,label:"-100%"}),H>=4&&O.push({value:-k/4*3,label:"-75%"}),H>=2&&O.push({value:-k/2,label:"-50%"}),H>=4&&O.push({value:-k/4,label:"-25%"})}if(O.push({value:0,label:"0%"}),g){let H=g>k?4:g*4/k;O.push({value:g/4,label:"25%"}),H>=4&&O.push({value:g/2,label:"50%"}),H>=2&&O.push({value:g/4*3,label:"75%"}),H>=4&&O.push({value:g,label:"100%"})}l(0,F={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:15,bottom:20,left:35},y:{min:-k,max:g,ticks:O},x:{ticks:M},points:R})}},[F,n,i,s,a,r,f,c,_,m,d,h,b,g,k,w,A]}class yi extends Nt{constructor(e){super(),Mt(this,e,g0,b0,St,{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 oo(t){var w;let e,l,n,i,s,a,r=(t[0].mt?Yn(t[0].mt):"-")+"",f,c,_,m=t[11][0]+"",d,h,b=t[11][1]+"",g,k;return i=new mu({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:((w=t[6].common)==null?void 0:w.import)??"Import",sub:Ut(t[0].p,2),subunit:t[0].pc,colorFn:Ri}}),{c(){e=p("div"),l=p("div"),n=p("div"),Te(i.$$.fragment),s=v(),a=p("div"),f=C(r),c=v(),_=p("div"),d=C(m),h=v(),g=C(b),u(n,"class","col-span-2"),u(_,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(A,F){P(A,e,F),o(e,l),o(l,n),Me(i,n,null),o(l,s),o(l,a),o(a,f),o(l,c),o(l,_),o(_,d),o(_,h),o(_,g),k=!0},p(A,F){var M;const L={};F&1&&(L.val=A[0].i?A[0].i:0),F&1&&(L.max=A[0].im?A[0].im:15e3),F&64&&(L.label=((M=A[6].common)==null?void 0:M.import)??"Import"),F&1&&(L.sub=Ut(A[0].p,2)),F&1&&(L.subunit=A[0].pc),i.$set(L),(!k||F&1)&&r!==(r=(A[0].mt?Yn(A[0].mt):"-")+"")&&q(f,r),(!k||F&2048)&&m!==(m=A[11][0]+"")&&q(d,m),(!k||F&2048)&&b!==(b=A[11][1]+"")&&q(g,b)},i(A){k||(Z(i.$$.fragment,A),k=!0)},o(A){ie(i.$$.fragment,A),k=!1},d(A){A&&T(e),Ne(i)}}}function ao(t){var g;let e,l,n,i,s,a,r,f,c=t[12][0]+"",_,m,d=t[12][1]+"",h,b;return i=new mu({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:((g=t[6].common)==null?void 0:g.export)??"Export",sub:Ut(t[0].px,2),subunit:t[0].pc,colorFn:En}}),{c(){e=p("div"),l=p("div"),n=p("div"),Te(i.$$.fragment),s=v(),a=p("div"),r=v(),f=p("div"),_=C(c),m=v(),h=C(d),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(k,w){P(k,e,w),o(e,l),o(l,n),Me(i,n,null),o(l,s),o(l,a),o(l,r),o(l,f),o(f,_),o(f,m),o(f,h),b=!0},p(k,w){var F;const A={};w&1&&(A.val=k[0].e?k[0].e:0),w&1&&(A.max=k[0].om?k[0].om*1e3:1e4),w&64&&(A.label=((F=k[6].common)==null?void 0:F.export)??"Export"),w&1&&(A.sub=Ut(k[0].px,2)),w&1&&(A.subunit=k[0].pc),i.$set(A),(!b||w&4096)&&c!==(c=k[12][0]+"")&&q(_,c),(!b||w&4096)&&d!==(d=k[12][1]+"")&&q(h,d)},i(k){b||(Z(i.$$.fragment,k),b=!0)},o(k){ie(i.$$.fragment,k),b=!1},d(k){k&&T(e),Ne(i)}}}function fo(t){let e,l,n=t[0].l1&&uo(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=uo(i),n.c(),Z(n,1),n.m(e,null)):n&&(ht(),ie(n,1,1,()=>{n=null}),vt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&T(e),n&&n.d()}}}function uo(t){var n;let e,l;return e=new U1({props:{title:((n=t[6].common)==null?void 0:n.voltage)??"Volt",u1:t[0].l1.u,u2:t[0].l2.u,u3:t[0].l3.u,ds:t[0].ds}}),{c(){Te(e.$$.fragment)},m(i,s){Me(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].common)==null?void 0:r.voltage)??"Volt"),s&1&&(a.u1=i[0].l1.u),s&1&&(a.u2=i[0].l2.u),s&1&&(a.u3=i[0].l3.u),s&1&&(a.ds=i[0].ds),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Ne(e,i)}}}function ro(t){let e,l,n=t[0].l1&&co(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=co(i),n.c(),Z(n,1),n.m(e,null)):n&&(ht(),ie(n,1,1,()=>{n=null}),vt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&T(e),n&&n.d()}}}function co(t){var n;let e,l;return e=new yi({props:{title:((n=t[6].common)==null?void 0:n.amperage)??"Amp",unit:"A",importColorFn:Ri,exportColorFn:En,maxImport:t[0].mf,maxExport:t[0].om?t[13]?t[0].om/.4/Math.sqrt(3):t[0].om/.23:0,l1:t[8],l2:t[9],l3:t[10],l2x:t[0].l2.e,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.max(t[0].l1.i*-1,0),l2e:Math.max(t[0].l2.i*-1,0),l3e:Math.max(t[0].l3.i*-1,0)}}),{c(){Te(e.$$.fragment)},m(i,s){Me(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].common)==null?void 0:r.amperage)??"Amp"),s&1&&(a.maxImport=i[0].mf),s&8193&&(a.maxExport=i[0].om?i[13]?i[0].om/.4/Math.sqrt(3):i[0].om/.23:0),s&256&&(a.l1=i[8]),s&512&&(a.l2=i[9]),s&1024&&(a.l3=i[10]),s&1&&(a.l2x=i[0].l2.e),s&1&&(a.l1i=Math.max(i[0].l1.i,0)),s&1&&(a.l2i=Math.max(i[0].l2.i,0)),s&1&&(a.l3i=Math.max(i[0].l3.i,0)),s&1&&(a.l1e=Math.max(i[0].l1.i*-1,0)),s&1&&(a.l2e=Math.max(i[0].l2.i*-1,0)),s&1&&(a.l3e=Math.max(i[0].l3.i*-1,0)),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Ne(e,i)}}}function _o(t){let e,l,n=t[0].l1&&mo(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=mo(i),n.c(),Z(n,1),n.m(e,null)):n&&(ht(),ie(n,1,1,()=>{n=null}),vt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&T(e),n&&n.d()}}}function mo(t){var n;let e,l;return e=new yi({props:{title:((n=t[6].dashboard)==null?void 0:n.phase)??"Phase",unit:"W",importColorFn:Ri,exportColorFn:En,maxImport:(t[0].mf?t[0].mf:32)*230,maxExport:t[0].om?t[13]?t[0].om*1e3/Math.sqrt(3):t[0].om*1e3:0,l1:t[8],l2:t[9],l3:t[10],l1i:t[0].l1.p,l2i:t[0].l2.p,l3i:t[0].l3.p,l1e:t[0].l1.q,l2e:t[0].l2.q,l3e:t[0].l3.q}}),{c(){Te(e.$$.fragment)},m(i,s){Me(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].dashboard)==null?void 0:r.phase)??"Phase"),s&1&&(a.maxImport=(i[0].mf?i[0].mf:32)*230),s&8193&&(a.maxExport=i[0].om?i[13]?i[0].om*1e3/Math.sqrt(3):i[0].om*1e3:0),s&256&&(a.l1=i[8]),s&512&&(a.l2=i[9]),s&1024&&(a.l3=i[10]),s&1&&(a.l1i=i[0].l1.p),s&1&&(a.l2i=i[0].l2.p),s&1&&(a.l3i=i[0].l3.p),s&1&&(a.l1e=i[0].l1.q),s&1&&(a.l2e=i[0].l2.q),s&1&&(a.l3e=i[0].l3.q),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Ne(e,i)}}}function po(t){let e,l,n=t[0].l1&&ho(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=ho(i),n.c(),Z(n,1),n.m(e,null)):n&&(ht(),ie(n,1,1,()=>{n=null}),vt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&T(e),n&&n.d()}}}function ho(t){var n;let e,l;return e=new yi({props:{title:((n=t[6].dashboard)==null?void 0:n.pf)??"Pf",importColorFn:En,exportColorFn:En,maxImport:1,l1:t[8],l2:t[9],l3:t[10],l1i:t[0].l1.f,l2i:t[0].l2.f,l3i:t[0].l3.f}}),{c(){Te(e.$$.fragment)},m(i,s){Me(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].dashboard)==null?void 0:r.pf)??"Pf"),s&256&&(a.l1=i[8]),s&512&&(a.l2=i[9]),s&1024&&(a.l3=i[10]),s&1&&(a.l1i=i[0].l1.f),s&1&&(a.l2i=i[0].l2.f),s&1&&(a.l3i=i[0].l3.f),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Ne(e,i)}}}function vo(t){let e,l,n;return l=new y1({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec,translations:t[6]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt")},m(i,s){P(i,e,s),Me(l,e,null),n=!0},p(i,s){const a={};s&1&&(a.importInstant=i[0].ri),s&1&&(a.exportInstant=i[0].re),s&1&&(a.importTotal=i[0].ric),s&1&&(a.exportTotal=i[0].rec),s&64&&(a.translations=i[6]),l.$set(a)},i(i){n||(Z(l.$$.fragment,i),n=!0)},o(i){ie(l.$$.fragment,i),n=!1},d(i){i&&T(e),Ne(l)}}}function bo(t){let e,l,n;return l=new K1({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0,translations:t[6]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt")},m(i,s){P(i,e,s),Me(l,e,null),n=!0},p(i,s){const a={};s&2&&(a.sysinfo=i[1]),s&1&&(a.data=i[0].ea),s&1&&(a.currency=i[0].pc),s&1&&(a.hasExport=i[0].om>0||i[0].e>0),s&64&&(a.translations=i[6]),l.$set(a)},i(i){n||(Z(l.$$.fragment,i),n=!0)},o(i){ie(l.$$.fragment,i),n=!1},d(i){i&&T(e),Ne(l)}}}function go(t){var i;let e,l,n;return l=new f0({props:{title:((i=t[6].dashboard)==null?void 0:i.tariffpeak)??"Tariff peaks",tariffData:t[7],translations:t[6]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt h-64")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.tariffpeak)??"Tariff peaks"),a&128&&(r.tariffData=s[7]),a&64&&(r.translations=s[6]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&T(e),Ne(l)}}}function ko(t){var i;let e,l,n;return l=new v0({props:{title:((i=t[6].dashboard)==null?void 0:i.realtime)??"Real time"}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.realtime)??"Real time"),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&T(e),Ne(l)}}}function wo(t){var i;let e,l,n;return l=new X1({props:{title:((i=t[6].dashboard)==null?void 0:i.price)??"Price",json:t[2],sysinfo:t[1]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.price)??"Price"),a&4&&(r.json=s[2]),a&2&&(r.sysinfo=s[1]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&T(e),Ne(l)}}}function Co(t){var i;let e,l,n;return l=new $1({props:{title:((i=t[6].dashboard)==null?void 0:i.day)??"24 hours",json:t[3],sysinfo:t[1]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.day)??"24 hours"),a&8&&(r.json=s[3]),a&2&&(r.sysinfo=s[1]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&T(e),Ne(l)}}}function So(t){var i;let e,l,n;return l=new t0({props:{title:((i=t[6].dashboard)==null?void 0:i.month)??"{0} days",json:t[4],sysinfo:t[1]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.month)??"{0} days"),a&16&&(r.json=s[4]),a&2&&(r.sysinfo=s[1]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&T(e),Ne(l)}}}function Mo(t){var i;let e,l,n;return l=new i0({props:{title:((i=t[6].dashboard)==null?void 0:i.temperature)??"Temperature",json:t[5]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.temperature)??"Temperature"),a&32&&(r.json=s[5]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&T(e),Ne(l)}}}function k0(t){let e,l=Gt(t[1].ui.i,t[0].i),n,i=Gt(t[1].ui.e,t[0].om||t[0].e>0),s,a=Gt(t[1].ui.v,t[0].l1&&(t[0].l1.u>100||t[0].l2.u>100||t[0].l3.u>100)),r,f=Gt(t[1].ui.a,t[0].l1&&(t[0].l1.i>.01||t[0].l2.i>.01||t[0].l3.i>.01)),c,_=Gt(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)),m,d=Gt(t[1].ui.f,t[0].l1&&(t[0].l1.f>.01||t[0].l2.f>.01||t[0].l3.f>.01)),h,b=Gt(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),g,k=Gt(t[1].ui.c,t[0].ea),w,A=Gt(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("NO")||t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),F,L=Gt(t[1].ui.l,t[0].hm==1),M,R=Gt(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),O,H=Gt(t[1].ui.d,t[3]),K,W=Gt(t[1].ui.m,t[4]),N,B=Gt(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),X,G=l&&oo(t),V=i&&ao(t),Y=a&&fo(t),U=f&&ro(t),z=_&&_o(t),se=d&&po(t),le=b&&vo(t),Q=k&&bo(t),ee=A&&go(t),ue=L&&ko(t),ae=R&&wo(t),x=H&&Co(t),_e=W&&So(t),oe=B&&Mo(t);return{c(){e=p("div"),G&&G.c(),n=v(),V&&V.c(),s=v(),Y&&Y.c(),r=v(),U&&U.c(),c=v(),z&&z.c(),m=v(),se&&se.c(),h=v(),le&&le.c(),g=v(),Q&&Q.c(),w=v(),ee&&ee.c(),F=v(),ue&&ue.c(),M=v(),ae&&ae.c(),O=v(),x&&x.c(),K=v(),_e&&_e.c(),N=v(),oe&&oe.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(J,$){P(J,e,$),G&&G.m(e,null),o(e,n),V&&V.m(e,null),o(e,s),Y&&Y.m(e,null),o(e,r),U&&U.m(e,null),o(e,c),z&&z.m(e,null),o(e,m),se&&se.m(e,null),o(e,h),le&&le.m(e,null),o(e,g),Q&&Q.m(e,null),o(e,w),ee&&ee.m(e,null),o(e,F),ue&&ue.m(e,null),o(e,M),ae&&ae.m(e,null),o(e,O),x&&x.m(e,null),o(e,K),_e&&_e.m(e,null),o(e,N),oe&&oe.m(e,null),X=!0},p(J,[$]){$&3&&(l=Gt(J[1].ui.i,J[0].i)),l?G?(G.p(J,$),$&3&&Z(G,1)):(G=oo(J),G.c(),Z(G,1),G.m(e,n)):G&&(ht(),ie(G,1,1,()=>{G=null}),vt()),$&3&&(i=Gt(J[1].ui.e,J[0].om||J[0].e>0)),i?V?(V.p(J,$),$&3&&Z(V,1)):(V=ao(J),V.c(),Z(V,1),V.m(e,s)):V&&(ht(),ie(V,1,1,()=>{V=null}),vt()),$&3&&(a=Gt(J[1].ui.v,J[0].l1&&(J[0].l1.u>100||J[0].l2.u>100||J[0].l3.u>100))),a?Y?(Y.p(J,$),$&3&&Z(Y,1)):(Y=fo(J),Y.c(),Z(Y,1),Y.m(e,r)):Y&&(ht(),ie(Y,1,1,()=>{Y=null}),vt()),$&3&&(f=Gt(J[1].ui.a,J[0].l1&&(J[0].l1.i>.01||J[0].l2.i>.01||J[0].l3.i>.01))),f?U?(U.p(J,$),$&3&&Z(U,1)):(U=ro(J),U.c(),Z(U,1),U.m(e,c)):U&&(ht(),ie(U,1,1,()=>{U=null}),vt()),$&3&&(_=Gt(J[1].ui.h,J[0].l1&&(J[0].l1.p>.01||J[0].l2.p>.01||J[0].l3.p>.01||J[0].l1.q>.01||J[0].l2.q>.01||J[0].l3.q>.01))),_?z?(z.p(J,$),$&3&&Z(z,1)):(z=_o(J),z.c(),Z(z,1),z.m(e,m)):z&&(ht(),ie(z,1,1,()=>{z=null}),vt()),$&3&&(d=Gt(J[1].ui.f,J[0].l1&&(J[0].l1.f>.01||J[0].l2.f>.01||J[0].l3.f>.01))),d?se?(se.p(J,$),$&3&&Z(se,1)):(se=po(J),se.c(),Z(se,1),se.m(e,h)):se&&(ht(),ie(se,1,1,()=>{se=null}),vt()),$&3&&(b=Gt(J[1].ui.r,J[0].ri>0||J[0].re>0||J[0].ric>0||J[0].rec>0)),b?le?(le.p(J,$),$&3&&Z(le,1)):(le=vo(J),le.c(),Z(le,1),le.m(e,g)):le&&(ht(),ie(le,1,1,()=>{le=null}),vt()),$&3&&(k=Gt(J[1].ui.c,J[0].ea)),k?Q?(Q.p(J,$),$&3&&Z(Q,1)):(Q=bo(J),Q.c(),Z(Q,1),Q.m(e,w)):Q&&(ht(),ie(Q,1,1,()=>{Q=null}),vt()),$&3&&(A=Gt(J[1].ui.t,J[0].pr&&(J[0].pr.startsWith("NO")||J[0].pr.startsWith("10YNO")||J[0].pr.startsWith("10Y1001A1001A4")))),A?ee?(ee.p(J,$),$&3&&Z(ee,1)):(ee=go(J),ee.c(),Z(ee,1),ee.m(e,F)):ee&&(ht(),ie(ee,1,1,()=>{ee=null}),vt()),$&3&&(L=Gt(J[1].ui.l,J[0].hm==1)),L?ue?(ue.p(J,$),$&3&&Z(ue,1)):(ue=ko(J),ue.c(),Z(ue,1),ue.m(e,M)):ue&&(ht(),ie(ue,1,1,()=>{ue=null}),vt()),$&3&&(R=Gt(J[1].ui.p,J[0].pe&&!Number.isNaN(J[0].p))),R?ae?(ae.p(J,$),$&3&&Z(ae,1)):(ae=wo(J),ae.c(),Z(ae,1),ae.m(e,O)):ae&&(ht(),ie(ae,1,1,()=>{ae=null}),vt()),$&10&&(H=Gt(J[1].ui.d,J[3])),H?x?(x.p(J,$),$&10&&Z(x,1)):(x=Co(J),x.c(),Z(x,1),x.m(e,K)):x&&(ht(),ie(x,1,1,()=>{x=null}),vt()),$&18&&(W=Gt(J[1].ui.m,J[4])),W?_e?(_e.p(J,$),$&18&&Z(_e,1)):(_e=So(J),_e.c(),Z(_e,1),_e.m(e,N)):_e&&(ht(),ie(_e,1,1,()=>{_e=null}),vt()),$&35&&(B=Gt(J[1].ui.s,J[0].t&&J[0].t!=-127&&J[5].c>1)),B?oe?(oe.p(J,$),$&35&&Z(oe,1)):(oe=Mo(J),oe.c(),Z(oe,1),oe.m(e,null)):oe&&(ht(),ie(oe,1,1,()=>{oe=null}),vt())},i(J){X||(Z(G),Z(V),Z(Y),Z(U),Z(z),Z(se),Z(le),Z(Q),Z(ee),Z(ue),Z(ae),Z(x),Z(_e),Z(oe),X=!0)},o(J){ie(G),ie(V),ie(Y),ie(U),ie(z),ie(se),ie(le),ie(Q),ie(ee),ie(ue),ie(ae),ie(x),ie(_e),ie(oe),X=!1},d(J){J&&T(e),G&&G.d(),V&&V.d(),Y&&Y.d(),U&&U.d(),z&&z.d(),se&&se.d(),le&&le.d(),Q&&Q.d(),ee&&ee.d(),ue&&ue.d(),ae&&ae.d(),x&&x.d(),_e&&_e.d(),oe&&oe.d()}}}function w0(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,{prices:s={}}=e,{dayPlot:a={}}=e,{monthPlot:r={}}=e,{temperatures:f={}}=e,{translations:c={}}=e,{tariffData:_={}}=e,m,d,h,b,g,k;return t.$$set=w=>{"data"in w&&l(0,n=w.data),"sysinfo"in w&&l(1,i=w.sysinfo),"prices"in w&&l(2,s=w.prices),"dayPlot"in w&&l(3,a=w.dayPlot),"monthPlot"in w&&l(4,r=w.monthPlot),"temperatures"in w&&l(5,f=w.temperatures),"translations"in w&&l(6,c=w.translations),"tariffData"in w&&l(7,_=w.tariffData)},t.$$.update=()=>{var w,A,F,L,M,R,O,H,K,W,N,B,X,G,V;t.$$.dirty&1793&&(l(11,m=ol((n==null?void 0:n.ic)*1e3,"Wh")),l(12,d=ol((n==null?void 0:n.ec)*1e3,"Wh")),((w=n==null?void 0:n.l1)==null?void 0:w.u)==0&&((A=n==null?void 0:n.l2)==null?void 0:A.u)==0&&((F=n==null?void 0:n.l3)==null?void 0:F.u)==0?l(8,b=l(9,g=l(10,k=l(13,h=!0)))):(l(8,b=((L=n==null?void 0:n.l1)==null?void 0:L.u)>0||((M=n==null?void 0:n.l1)==null?void 0:M.i)>0||((R=n==null?void 0:n.l1)==null?void 0:R.p)>0||((O=n==null?void 0:n.l1)==null?void 0:O.q)>0),l(9,g=((H=n==null?void 0:n.l2)==null?void 0:H.u)>0||((K=n==null?void 0:n.l2)==null?void 0:K.i)>0||((W=n==null?void 0:n.l2)==null?void 0:W.p)>0||((N=n==null?void 0:n.l2)==null?void 0:N.q)>0),l(10,k=((B=n==null?void 0:n.l3)==null?void 0:B.u)>0||((X=n==null?void 0:n.l3)==null?void 0:X.i)>0||((G=n==null?void 0:n.l3)==null?void 0:G.p)>0||((V=n==null?void 0:n.l3)==null?void 0:V.q)>0),l(13,h=b&&g&&k)))},[n,i,s,a,r,f,c,_,b,g,k,m,d,h]}class C0 extends Nt{constructor(e){super(),Mt(this,e,w0,k0,St,{data:0,sysinfo:1,prices:2,dayPlot:3,monthPlot:4,temperatures:5,translations:6,tariffData:7})}}let wi={};const Mn=nl(wi);async function S0(){wi=await(await fetch("configuration.json")).json(),Mn.set(wi)}let Ci={};const du=nl(Ci);async function M0(){Ci=await(await fetch("priceconfig.json")).json(),du.set(Ci)}function No(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function To(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART0",l=v(),n=p("option"),n.textContent="UART2",e.__value=3,y(e,e.__value),n.__value=113,y(n,n.__value)},m(i,s){P(i,e,s),P(i,l,s),P(i,n,s)},d(i){i&&(T(e),T(l),T(n))}}}function Po(t){let e;return{c(){e=p("option"),e.textContent=`GPIO${t[4]}`,e.__value=t[4],y(e,e.__value)},m(l,n){P(l,e,n)},d(l){l&&T(e)}}}function Eo(t){let e,l=t[4]>1&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Po(t);return{c(){l&&l.c(),e=Vt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,i){n[4]>1&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Po(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){n&&T(e),l&&l.d(n)}}}function N0(t){let e,l,n,i,s=t[0]=="esp8266"&&To(),a=gt({length:t[1]+1}),r=[];for(let f=0;f{"chip"in s&&l(0,n=s.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32s3":l(1,i=46);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Si extends Nt{constructor(e){super(),Mt(this,e,T0,N0,St,{chip:0})}}function qo(t){let e,l,n=t[1]&&Do(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,s){P(i,e,s),o(e,l),n&&n.m(l,null)},p(i,s){i[1]?n?n.p(i,s):(n=Do(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&T(e),n&&n.d()}}}function Do(t){let e,l;return{c(){e=p("div"),l=C(t[1]),u(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(n,i){P(n,e,i),o(e,l)},p(n,i){i&2&&q(l,n[1])},d(n){n&&T(e)}}}function P0(t){let e,l=t[0]&&qo(t);return{c(){l&&l.c(),e=Vt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=qo(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:Ve,o:Ve,d(n){n&&T(e),l&&l.d(n)}}}function E0(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=s=>{"active"in s&&l(0,n=s.active),"message"in s&&l(1,i=s.message)},[n,i]}class sl extends Nt{constructor(e){super(),Mt(this,e,E0,P0,St,{active:0,message:1})}}function Ao(t,e,l){const n=t.slice();return n[1]=e[l],n}function Lo(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],y(e,e.__value)},m(s,a){P(s,e,a),o(e,l),o(e,i)},p:Ve,d(s){s&&T(e)}}}function q0(t){let e,l,n,i=gt(t[0]),s=[];for(let a=0;a>1&1,E=0;E0;S--)E[S]=E[S]?E[S-1]^M.EXPONENT[H._modN(M.LOG[E[S]]+D)]:E[S-1];E[0]=M.EXPONENT[H._modN(M.LOG[E[0]]+D)]}for(D=0;D<=I;D++)E[D]=M.LOG[E[D]]},_checkBadness:function(){var D,S,I,E,j,ne=0,fe=this._badness,me=this.buffer,he=this.width;for(j=0;jhe*he;)we-=he*he,Se++;for(ne+=Se*H.N4,E=0;E=fe-2&&(D=fe-2,j>9&&D--);var me=D;if(j>9){for(ne[me+2]=0,ne[me+3]=0;me--;)S=ne[me],ne[me+3]|=255&S<<4,ne[me+2]=S>>4;ne[2]|=255&D<<4,ne[1]=D>>4,ne[0]=64|D>>12}else{for(ne[me+1]=0,ne[me+2]=0;me--;)S=ne[me],ne[me+2]|=255&S<<4,ne[me+1]=S>>4;ne[1]|=255&D<<4,ne[0]=64|D>>4}for(me=D+3-(j<10);me=5&&(I+=H.N1+E[S]-5);for(S=3;SD||E[S-3]*3>=E[S]*4||E[S+3]*3>=E[S]*4)&&(I+=H.N3);return I},_finish:function(){this._stringBuffer=this.buffer.slice();var D,S,I=0,E=3e4;for(S=0;S<8&&(this._applyMask(S),D=this._checkBadness(),D>=1)E&1&&(j[ne-1-S+ne*8]=1,S<6?j[8+ne*S]=1:j[8+ne*(S+1)]=1);for(S=0;S<7;S++,E>>=1)E&1&&(j[8+ne*(ne-7+S)]=1,S?j[6-S+ne*8]=1:j[7+ne*8]=1)},_interleaveBlocks:function(){var D,S,I=this._dataBlock,E=this._ecc,j=this._eccBlock,ne=0,fe=this._calculateMaxLength(),me=this._neccBlock1,he=this._neccBlock2,pe=this._stringBuffer;for(D=0;D1)for(D=w.BLOCK[E],I=j-7;;){for(S=j-7;S>D-3&&(this._addAlignment(S,I),!(S6)for(D=O.BLOCK[ne-7],S=17,I=0;I<6;I++)for(E=0;E<3;E++,S--)1&(S>11?ne>>S-12:D>>S)?(j[5-I+fe*(2-E+fe-11)]=1,j[2-E+fe-11+fe*(5-I)]=1):(this._setMask(5-I,2-E+fe-11),this._setMask(2-E+fe-11,5-I))},_isMasked:function(D,S){var I=H._getMaskBit(D,S);return this._mask[I]===1},_pack:function(){var D,S,I,E=1,j=1,ne=this.width,fe=ne-1,me=ne-1,he=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(S=0;SS&&(I=D,D=S,S=I),I=S,I+=S*S,I>>=1,I+=D,I},_modN:function(D){for(;D>=255;)D-=255,D=(D>>8)+(D&255);return D},N1:3,N2:3,N3:40,N4:10}),K=H,W=h.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var D=this.element;D.width=D.height=this.qrious.size}}),N=W,B=m.extend(function(D,S,I,E){this.name=D,this.modifiable=!!S,this.defaultValue=I,this._valueTransformer=E},{transform:function(D){var S=this._valueTransformer;return typeof S=="function"?S(D,this):D}}),X=B,G=m.extend(null,{abs:function(D){return D!=null?Math.abs(D):null},hasOwn:function(D,S){return Object.prototype.hasOwnProperty.call(D,S)},noop:function(){},toUpperCase:function(D){return D!=null?D.toUpperCase():null}}),V=G,Y=m.extend(function(D){this.options={},D.forEach(function(S){this.options[S.name]=S},this)},{exists:function(D){return this.options[D]!=null},get:function(D,S){return Y._get(this.options[D],S)},getAll:function(D){var S,I=this.options,E={};for(S in I)V.hasOwn(I,S)&&(E[S]=Y._get(I[S],D));return E},init:function(D,S,I){typeof I!="function"&&(I=V.noop);var E,j;for(E in this.options)V.hasOwn(this.options,E)&&(j=this.options[E],Y._set(j,j.defaultValue,S),Y._createAccessor(j,S,I));this._setAll(D,S,!0)},set:function(D,S,I){return this._set(D,S,I)},setAll:function(D,S){return this._setAll(D,S)},_set:function(D,S,I,E){var j=this.options[D];if(!j)throw new Error("Invalid option: "+D);if(!j.modifiable&&!E)throw new Error("Option cannot be modified: "+D);return Y._set(j,S,I)},_setAll:function(D,S,I){if(!D)return!1;var E,j=!1;for(E in D)V.hasOwn(D,E)&&this._set(E,D[E],S,I)&&(j=!0);return j}},{_createAccessor:function(D,S,I){var E={get:function(){return Y._get(D,S)}};D.modifiable&&(E.set=function(j){Y._set(D,j,S)&&I(j,D)}),Object.defineProperty(S,D.name,E)},_get:function(D,S){return S["_"+D.name]},_set:function(D,S,I){var E="_"+D.name,j=I[E],ne=D.transform(S??D.defaultValue);return I[E]=ne,ne!==j}}),U=Y,z=m.extend(function(){this._services={}},{getService:function(D){var S=this._services[D];if(!S)throw new Error("Service is not being managed with name: "+D);return S},setService:function(D,S){if(this._services[D])throw new Error("Service is already managed with name: "+D);S&&(this._services[D]=S)}}),se=z,le=new U([new X("background",!0,"white"),new X("backgroundAlpha",!0,1,V.abs),new X("element"),new X("foreground",!0,"black"),new X("foregroundAlpha",!0,1,V.abs),new X("level",!0,"L",V.toUpperCase),new X("mime",!0,"image/png"),new X("padding",!0,null,V.abs),new X("size",!0,100,V.abs),new X("value",!0,"")]),Q=new se,ee=m.extend(function(D){le.init(D,this,this.update.bind(this));var S=le.get("element",this),I=Q.getService("element"),E=S&&I.isCanvas(S)?S:I.createCanvas(),j=S&&I.isImage(S)?S:I.createImage();this._canvasRenderer=new g(this,E,!0),this._imageRenderer=new N(this,j,j===S),this.update()},{get:function(){return le.getAll(this)},set:function(D){le.setAll(D,this)&&this.update()},toDataURL:function(D){return this.canvas.toDataURL(D||this.mime)},update:function(){var D=new K({level:this.level,value:this.value});this._canvasRenderer.render(D),this._imageRenderer.render(D)}},{use:function(D){Q.setService(D.getName(),D)}});Object.defineProperties(ee.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var ue=ee,ae=ue,x=m.extend({getName:function(){}}),_e=x,oe=_e.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(D){},isImage:function(D){}}),J=oe,$=J.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(D){return D instanceof HTMLCanvasElement},isImage:function(D){return D instanceof HTMLImageElement}}),ve=$;ae.use(new ve);var ke=ae;return ke})})(vu);var R0=vu.exports;const F0=I0(R0);function B0(t){let e,l;return{c(){e=p("img"),zn(e.src,l=t[2])||u(e,"src",l),u(e,"alt",t[0]),u(e,"class",t[1])},m(n,i){P(n,e,i)},p(n,[i]){i&4&&!zn(e.src,l=n[2])&&u(e,"src",l),i&1&&u(e,"alt",n[0]),i&2&&u(e,"class",n[1])},i:Ve,o:Ve,d(n){n&&T(e)}}}function U0(t,e,l){const n=new F0;let{errorCorrection:i="L"}=e,{background:s="#fff"}=e,{color:a="#000"}=e,{size:r="200"}=e,{value:f=""}=e,{padding:c=0}=e,{className:_="qrcode"}=e,m="";function d(){n.set({background:s,foreground:a,level:i,padding:c,size:r,value:f}),l(2,m=n.toDataURL("image/jpeg"))}return Tf(()=>{d()}),t.$$set=h=>{"errorCorrection"in h&&l(3,i=h.errorCorrection),"background"in h&&l(4,s=h.background),"color"in h&&l(5,a=h.color),"size"in h&&l(6,r=h.size),"value"in h&&l(0,f=h.value),"padding"in h&&l(7,c=h.padding),"className"in h&&l(1,_=h.className)},t.$$.update=()=>{t.$$.dirty&1&&f&&d()},[f,_,m,i,s,a,r,c]}class j0 extends Nt{constructor(e){super(),Mt(this,e,U0,B0,St,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function Oo(t,e,l){const n=t.slice();return n[114]=e[l],n}function Io(t,e,l){const n=t.slice();return n[117]=e[l],n[118]=e,n[119]=l,n}function Ro(t,e,l){const n=t.slice();return n[120]=e[l],n[121]=e,n[122]=l,n}function H0(t,e,l){const n=t.slice();return n[123]=e[l],n}function y0(t,e,l){const n=t.slice();return n[126]=e[l],n}function Fo(t){var nt,Pe,kt,Wt,Qt,xt,Ft,tl,ll,il,Ie,te,je,fl,ul,vl,bl,gl,kl,wl,Cl,Sl,$l,xl,en,tn;let e,l,n=(((Pe=(nt=t[2].conf)==null?void 0:nt.general)==null?void 0:Pe.title)??"General")+"",i,s,a,r,f,c,_,m,d,h=(((Wt=(kt=t[2].conf)==null?void 0:kt.general)==null?void 0:Wt.hostname)??"Hostname")+"",b,g,k,w,A,F,L=(((xt=(Qt=t[2].conf)==null?void 0:Qt.general)==null?void 0:xt.timezone)??"Time zone")+"",M,R,O,H,K,W,N,B,X,G,V,Y=(((tl=(Ft=t[2].conf)==null?void 0:Ft.price)==null?void 0:tl.region)??"Price region")+"",U,z,se,le,Q,ee,ue,ae,x,_e,oe,J,$,ve,ke,D,S,I,E,j,ne,fe,me,he,pe,Se,we,Le,qe,Re,re,Ce,Ue,it,_t=(((il=(ll=t[2].conf)==null?void 0:ll.price)==null?void 0:il.currency)??"Currency")+"",et,tt,lt,ot,Ze,bt,st,Tt,Oe,De,He,ze,de=(((te=(Ie=t[2].conf)==null?void 0:Ie.price)==null?void 0:te.enabled)??"Enabled")+"",Ee,Ge,ge,Ae,Je=(((ul=(fl=(je=t[2].conf)==null?void 0:je.general)==null?void 0:fl.security)==null?void 0:ul.title)??"Security")+"",Qe,It,$e,Fe,wt,ut=(((gl=(bl=(vl=t[2].conf)==null?void 0:vl.general)==null?void 0:bl.security)==null?void 0:gl.none)??"None")+"",rt,mt,qt=(((Cl=(wl=(kl=t[2].conf)==null?void 0:kl.general)==null?void 0:wl.security)==null?void 0:Cl.conf)??"Conf")+"",jt,Pt,pt=(((xl=($l=(Sl=t[2].conf)==null?void 0:Sl.general)==null?void 0:$l.security)==null?void 0:xl.all)??"All")+"",Ht,Kt,Rt,zt,Yt=(((tn=(en=t[2].conf)==null?void 0:en.general)==null?void 0:tn.context)??"Context")+"",el,Jt,$t,ye,ft,at,Dt,Ot;K=new A0({});let dt=!t[6].p.t&&Bo(),Be=gt(["NOK","SEK","DKK","EUR","CHF"]),We=[];for(let xe=0;xe<5;xe+=1)We[xe]=z0(y0(t,Be,xe));st=new _l({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[W0]},$$scope:{ctx:t}}});let ct=t[6].p.e&&t[0].chip!="esp8266"&&Uo(t),be=t[6].g.s>0&&jo(t);return{c(){var xe,Bt;e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),_=p("div"),m=p("div"),d=p("div"),b=C(h),g=p("br"),k=v(),w=p("input"),A=v(),F=p("div"),M=C(L),R=p("br"),O=v(),H=p("select"),Te(K.$$.fragment),W=v(),N=p("input"),B=v(),X=p("div"),G=p("div"),V=p("div"),U=C(Y),z=p("br"),se=v(),le=p("select"),Q=p("optgroup"),dt&&dt.c(),ee=p("option"),ee.textContent="NO1",ue=p("option"),ue.textContent="NO2",ae=p("option"),ae.textContent="NO3",x=p("option"),x.textContent="NO4",_e=p("option"),_e.textContent="NO5",oe=p("optgroup"),J=p("option"),J.textContent="SE1",$=p("option"),$.textContent="SE2",ve=p("option"),ve.textContent="SE3",ke=p("option"),ke.textContent="SE4",D=p("optgroup"),S=p("option"),S.textContent="DK1",I=p("option"),I.textContent="DK2",E=p("option"),E.textContent="Austria",j=p("option"),j.textContent="Belgium",ne=p("option"),ne.textContent="Czech Republic",fe=p("option"),fe.textContent="Estonia",me=p("option"),me.textContent="Finland",he=p("option"),he.textContent="France",pe=p("option"),pe.textContent="Germany",Se=p("option"),Se.textContent="Great Britain",we=p("option"),we.textContent="Latvia",Le=p("option"),Le.textContent="Lithuania",qe=p("option"),qe.textContent="Netherland",Re=p("option"),Re.textContent="Poland",re=p("option"),re.textContent="Slovenia",Ce=p("option"),Ce.textContent="Switzerland",Ue=v(),it=p("div"),et=C(_t),tt=p("br"),lt=v(),ot=p("select");for(let rl=0;rl<5;rl+=1)We[rl].c();Ze=v(),bt=p("div"),Te(st.$$.fragment),Tt=v(),Oe=p("div"),De=p("label"),He=p("input"),ze=v(),Ee=C(de),Ge=v(),ct&&ct.c(),ge=v(),Ae=p("div"),Qe=C(Je),It=p("br"),$e=v(),Fe=p("select"),wt=p("option"),rt=C(ut),mt=p("option"),jt=C(qt),Pt=p("option"),Ht=C(pt),Kt=v(),be&&be.c(),Rt=v(),zt=p("div"),el=C(Yt),Jt=p("br"),$t=v(),ye=p("input"),u(l,"class","text-sm"),u(a,"href",cl("General-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","g"),f.value="true",u(w,"name","gh"),u(w,"type","text"),u(w,"class","in-f w-full"),u(w,"pattern","[A-Za-z0-9-]+"),u(H,"name","gt"),u(H,"class","in-l w-full"),t[6].g.t===void 0&&At(()=>t[23].call(H)),u(m,"class","flex"),u(_,"class","my-1"),u(N,"type","hidden"),u(N,"name","p"),N.value="true",ee.__value="10YNO-1--------2",y(ee,ee.__value),ue.__value="10YNO-2--------T",y(ue,ue.__value),ae.__value="10YNO-3--------J",y(ae,ae.__value),x.__value="10YNO-4--------9",y(x,x.__value),_e.__value="10Y1001A1001A48H",y(_e,_e.__value),u(Q,"label","Norway"),J.__value="10Y1001A1001A44P",y(J,J.__value),$.__value="10Y1001A1001A45N",y($,$.__value),ve.__value="10Y1001A1001A46L",y(ve,ve.__value),ke.__value="10Y1001A1001A47J",y(ke,ke.__value),u(oe,"label","Sweden"),S.__value="10YDK-1--------W",y(S,S.__value),I.__value="10YDK-2--------M",y(I,I.__value),u(D,"label","Denmark"),E.__value="10YAT-APG------L",y(E,E.__value),j.__value="10YBE----------2",y(j,j.__value),ne.__value="10YCZ-CEPS-----N",y(ne,ne.__value),fe.__value="10Y1001A1001A39I",y(fe,fe.__value),me.__value="10YFI-1--------U",y(me,me.__value),he.__value="10YFR-RTE------C",y(he,he.__value),pe.__value="10Y1001A1001A83F",y(pe,pe.__value),Se.__value="10YGB----------A",y(Se,Se.__value),we.__value="10YLV-1001A00074",y(we,we.__value),Le.__value="10YLT-1001A0008Q",y(Le,Le.__value),qe.__value="10YNL----------L",y(qe,qe.__value),Re.__value="10YPL-AREA-----S",y(Re,Re.__value),re.__value="10YSI-ELES-----O",y(re,re.__value),Ce.__value="10YCH-SWISSGRIDZ",y(Ce,Ce.__value),u(le,"name","pr"),u(le,"class","in-f w-full"),t[6].p.r===void 0&&At(()=>t[24].call(le)),u(V,"class","w-full"),u(ot,"name","pc"),u(ot,"class","in-l"),t[6].p.c===void 0&&At(()=>t[25].call(ot)),u(G,"class","flex"),u(X,"class","my-1"),u(bt,"class","my-1"),u(He,"type","checkbox"),u(He,"name","pe"),He.__value="true",y(He,He.__value),u(He,"class","rounded mb-1"),u(Oe,"class","my-1"),wt.__value=0,y(wt,wt.__value),mt.__value=1,y(mt,mt.__value),Pt.__value=2,y(Pt,Pt.__value),u(Fe,"name","gs"),u(Fe,"class","in-s"),t[6].g.s===void 0&&At(()=>t[28].call(Fe)),u(Ae,"class","my-1"),u(ye,"name","gc"),u(ye,"type","text"),u(ye,"pattern","[A-Za-z0-9]+"),u(ye,"placeholder",ft=((Bt=(xe=t[2].conf)==null?void 0:xe.general)==null?void 0:Bt.context_placeholder)??"/"),u(ye,"class","in-s"),u(ye,"maxlength","36"),u(zt,"class","my-1"),u(e,"class","cnt")},m(xe,Bt){P(xe,e,Bt),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,_),o(_,m),o(m,d),o(d,b),o(d,g),o(d,k),o(d,w),y(w,t[6].g.h),o(m,A),o(m,F),o(F,M),o(F,R),o(F,O),o(F,H),Me(K,H,null),Xe(H,t[6].g.t,!0),o(e,W),o(e,N),o(e,B),o(e,X),o(X,G),o(G,V),o(V,U),o(V,z),o(V,se),o(V,le),o(le,Q),dt&&dt.m(Q,null),o(Q,ee),o(Q,ue),o(Q,ae),o(Q,x),o(Q,_e),o(le,oe),o(oe,J),o(oe,$),o(oe,ve),o(oe,ke),o(le,D),o(D,S),o(D,I),o(le,E),o(le,j),o(le,ne),o(le,fe),o(le,me),o(le,he),o(le,pe),o(le,Se),o(le,we),o(le,Le),o(le,qe),o(le,Re),o(le,re),o(le,Ce),Xe(le,t[6].p.r,!0),o(G,Ue),o(G,it),o(it,et),o(it,tt),o(it,lt),o(it,ot);for(let rl=0;rl<5;rl+=1)We[rl]&&We[rl].m(ot,null);Xe(ot,t[6].p.c,!0),o(e,Ze),o(e,bt),Me(st,bt,null),o(e,Tt),o(e,Oe),o(Oe,De),o(De,He),He.checked=t[6].p.e,o(De,ze),o(De,Ee),o(Oe,Ge),ct&&ct.m(Oe,null),o(e,ge),o(e,Ae),o(Ae,Qe),o(Ae,It),o(Ae,$e),o(Ae,Fe),o(Fe,wt),o(wt,rt),o(Fe,mt),o(mt,jt),o(Fe,Pt),o(Pt,Ht),Xe(Fe,t[6].g.s,!0),o(e,Kt),be&&be.m(e,null),o(e,Rt),o(e,zt),o(zt,el),o(zt,Jt),o(zt,$t),o(zt,ye),y(ye,t[6].g.c),at=!0,Dt||(Ot=[ce(w,"input",t[22]),ce(H,"change",t[23]),ce(le,"change",t[24]),ce(ot,"change",t[25]),ce(He,"change",t[26]),ce(Fe,"change",t[28]),ce(ye,"input",t[31])],Dt=!0)},p(xe,Bt){var ln,nn,sn,on,an,fn,un,rn,cn,_n,mn,pn,dn,hn,vn,bn,gn,kn,wn,Wi,Gi,Vi,Ki,Yi,Qi,Xi,Zi,Ji;(!at||Bt[0]&4)&&n!==(n=(((nn=(ln=xe[2].conf)==null?void 0:ln.general)==null?void 0:nn.title)??"General")+"")&&q(i,n),(!at||Bt[0]&4)&&h!==(h=(((on=(sn=xe[2].conf)==null?void 0:sn.general)==null?void 0:on.hostname)??"Hostname")+"")&&q(b,h),Bt[0]&64&&w.value!==xe[6].g.h&&y(w,xe[6].g.h),(!at||Bt[0]&4)&&L!==(L=(((fn=(an=xe[2].conf)==null?void 0:an.general)==null?void 0:fn.timezone)??"Time zone")+"")&&q(M,L),Bt[0]&64&&Xe(H,xe[6].g.t),(!at||Bt[0]&4)&&Y!==(Y=(((rn=(un=xe[2].conf)==null?void 0:un.price)==null?void 0:rn.region)??"Price region")+"")&&q(U,Y),xe[6].p.t?dt&&(dt.d(1),dt=null):dt||(dt=Bo(),dt.c(),dt.m(Q,ee)),Bt[0]&64&&Xe(le,xe[6].p.r),(!at||Bt[0]&4)&&_t!==(_t=(((_n=(cn=xe[2].conf)==null?void 0:cn.price)==null?void 0:_n.currency)??"Currency")+"")&&q(et,_t),Bt[0]&64&&Xe(ot,xe[6].p.c);const rl={};Bt[0]&4|Bt[4]&32&&(rl.$$scope={dirty:Bt,ctx:xe}),st.$set(rl),Bt[0]&64&&(He.checked=xe[6].p.e),(!at||Bt[0]&4)&&de!==(de=(((pn=(mn=xe[2].conf)==null?void 0:mn.price)==null?void 0:pn.enabled)??"Enabled")+"")&&q(Ee,de),xe[6].p.e&&xe[0].chip!="esp8266"?ct?ct.p(xe,Bt):(ct=Uo(xe),ct.c(),ct.m(Oe,null)):ct&&(ct.d(1),ct=null),(!at||Bt[0]&4)&&Je!==(Je=(((vn=(hn=(dn=xe[2].conf)==null?void 0:dn.general)==null?void 0:hn.security)==null?void 0:vn.title)??"Security")+"")&&q(Qe,Je),(!at||Bt[0]&4)&&ut!==(ut=(((kn=(gn=(bn=xe[2].conf)==null?void 0:bn.general)==null?void 0:gn.security)==null?void 0:kn.none)??"None")+"")&&q(rt,ut),(!at||Bt[0]&4)&&qt!==(qt=(((Gi=(Wi=(wn=xe[2].conf)==null?void 0:wn.general)==null?void 0:Wi.security)==null?void 0:Gi.conf)??"Conf")+"")&&q(jt,qt),(!at||Bt[0]&4)&&pt!==(pt=(((Yi=(Ki=(Vi=xe[2].conf)==null?void 0:Vi.general)==null?void 0:Ki.security)==null?void 0:Yi.all)??"All")+"")&&q(Ht,pt),Bt[0]&64&&Xe(Fe,xe[6].g.s),xe[6].g.s>0?be?be.p(xe,Bt):(be=jo(xe),be.c(),be.m(e,Rt)):be&&(be.d(1),be=null),(!at||Bt[0]&4)&&Yt!==(Yt=(((Xi=(Qi=xe[2].conf)==null?void 0:Qi.general)==null?void 0:Xi.context)??"Context")+"")&&q(el,Yt),(!at||Bt[0]&4&&ft!==(ft=((Ji=(Zi=xe[2].conf)==null?void 0:Zi.general)==null?void 0:Ji.context_placeholder)??"/"))&&u(ye,"placeholder",ft),Bt[0]&64&&ye.value!==xe[6].g.c&&y(ye,xe[6].g.c)},i(xe){at||(Z(K.$$.fragment,xe),Z(st.$$.fragment,xe),at=!0)},o(xe){ie(K.$$.fragment,xe),ie(st.$$.fragment,xe),at=!1},d(xe){xe&&T(e),Ne(K),dt&&dt.d(),Zt(We,xe),Ne(st),ct&&ct.d(),be&&be.d(),Dt=!1,Lt(Ot)}}}function Bo(t){let e,l,n,i,s;return{c(){e=p("option"),e.textContent="NO1 with support",l=p("option"),l.textContent="NO2 with support",n=p("option"),n.textContent="NO3 with support",i=p("option"),i.textContent="NO4 with support",s=p("option"),s.textContent="NO5 with support",e.__value="NO1S",y(e,e.__value),l.__value="NO2S",y(l,l.__value),n.__value="NO3S",y(n,n.__value),i.__value="NO4S",y(i,i.__value),s.__value="NO5S",y(s,s.__value)},m(a,r){P(a,e,r),P(a,l,r),P(a,n,r),P(a,i,r),P(a,s,r)},d(a){a&&(T(e),T(l),T(n),T(i),T(s))}}}function z0(t){let e;return{c(){e=p("option"),e.textContent=`${t[126]}`,e.__value=t[126],y(e,e.__value)},m(l,n){P(l,e,n)},p:Ve,d(l){l&&T(e)}}}function W0(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.price)==null?void 0:i.conf)??"Configure")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.price)==null?void 0:f.conf)??"Configure")+"")&&q(l,e)},d(s){s&&T(l)}}}function Uo(t){let e,l,n,i,s;return{c(){var a,r;e=p("br"),l=p("input"),u(l,"name","pt"),u(l,"type","text"),u(l,"class","in-s"),u(l,"placeholder",n=((r=(a=t[2].conf)==null?void 0:a.price)==null?void 0:r.api_key_placeholder)??"")},m(a,r){P(a,e,r),P(a,l,r),y(l,t[6].p.t),i||(s=ce(l,"input",t[27]),i=!0)},p(a,r){var f,c;r[0]&4&&n!==(n=((c=(f=a[2].conf)==null?void 0:f.price)==null?void 0:c.api_key_placeholder)??"")&&u(l,"placeholder",n),r[0]&64&&l.value!==a[6].p.t&&y(l,a[6].p.t)},d(a){a&&(T(e),T(l)),i=!1,s()}}}function jo(t){var k,w,A,F,L,M;let e,l=(((A=(w=(k=t[2].conf)==null?void 0:k.general)==null?void 0:w.security)==null?void 0:A.username)??"Username")+"",n,i,s,a,r,f,c=(((M=(L=(F=t[2].conf)==null?void 0:F.general)==null?void 0:L.security)==null?void 0:M.password)??"Password")+"",_,m,d,h,b,g;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),r=v(),f=p("div"),_=C(c),m=p("br"),d=v(),h=p("input"),u(a,"name","gu"),u(a,"type","text"),u(a,"class","in-s"),u(a,"maxlength","36"),u(e,"class","my-1"),u(h,"name","gp"),u(h,"type","password"),u(h,"class","in-s"),u(h,"maxlength","36"),u(f,"class","my-1")},m(R,O){P(R,e,O),o(e,n),o(e,i),o(e,s),o(e,a),y(a,t[6].g.u),P(R,r,O),P(R,f,O),o(f,_),o(f,m),o(f,d),o(f,h),y(h,t[6].g.p),b||(g=[ce(a,"input",t[29]),ce(h,"input",t[30])],b=!0)},p(R,O){var H,K,W,N,B,X;O[0]&4&&l!==(l=(((W=(K=(H=R[2].conf)==null?void 0:H.general)==null?void 0:K.security)==null?void 0:W.username)??"Username")+"")&&q(n,l),O[0]&64&&a.value!==R[6].g.u&&y(a,R[6].g.u),O[0]&4&&c!==(c=(((X=(B=(N=R[2].conf)==null?void 0:N.general)==null?void 0:B.security)==null?void 0:X.password)??"Password")+"")&&q(_,c),O[0]&64&&h.value!==R[6].g.p&&y(h,R[6].g.p)},d(R){R&&(T(e),T(r),T(f)),b=!1,Lt(g)}}}function Ho(t){var ge,Ae,Je,Qe,It,$e,Fe,wt,ut,rt,mt,qt,jt,Pt,pt,Ht,Kt,Rt,zt,Yt,el,Jt,$t;let e,l,n=(((Ae=(ge=t[2].conf)==null?void 0:ge.meter)==null?void 0:Ae.title)??"Meter")+"",i,s,a,r,f,c,_,m,d,h=(((It=(Qe=(Je=t[2].conf)==null?void 0:Je.meter)==null?void 0:Qe.comm)==null?void 0:It.title)??"Communication")+"",b,g,k,w,A,F=(((wt=(Fe=($e=t[2].conf)==null?void 0:$e.meter)==null?void 0:Fe.comm)==null?void 0:wt.passive)??"Passive")+"",L,M,R=(((mt=(rt=(ut=t[2].conf)==null?void 0:ut.meter)==null?void 0:rt.comm)==null?void 0:mt.pulse)??"Pulse")+"",O,H=(jt=(qt=t[0])==null?void 0:qt.features)==null?void 0:jt.includes("kmp"),K,W,N,B=(((Pt=t[2].common)==null?void 0:Pt.voltage)??"Voltage")+"",X,G,V,Y,U,z,se,le,Q,ee=(((Ht=(pt=t[2].conf)==null?void 0:pt.meter)==null?void 0:Ht.fuse)??"Main fuse")+"",ue,ae,x,_e,oe,J,$,ve,ke,D=(((Rt=(Kt=t[2].conf)==null?void 0:Kt.meter)==null?void 0:Rt.prod)??"Production")+"",S,I,E,j,ne,fe,me,he,pe,Se,we,Le,qe,Re,re=(((Yt=(zt=t[2].conf)==null?void 0:zt.meter)==null?void 0:Yt.encrypted)??"Encrypted")+"",Ce,Ue,it,_t,et,tt,lt,ot=((($t=(Jt=(el=t[2].conf)==null?void 0:el.meter)==null?void 0:Jt.multipliers)==null?void 0:$t.title)??"Multipliers")+"",Ze,bt,st,Tt,Oe=H&&yo();function De(ye,ft){return ye[6].m.a===2?V0:G0}let He=De(t),ze=He(t),de=t[6].m.e.e&&zo(t),Ee=t[6].m.e.e&&Wo(t),Ge=t[6].m.m.e&&Go(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),_=p("input"),m=v(),d=p("div"),b=C(h),g=p("br"),k=v(),w=p("select"),A=p("option"),L=C(F),M=p("option"),O=C(R),Oe&&Oe.c(),K=v(),ze.c(),W=v(),N=p("div"),X=C(B),G=p("br"),V=v(),Y=p("select"),U=p("option"),U.textContent="400V (TN)",z=p("option"),z.textContent="230V (IT/TT)",se=v(),le=p("div"),Q=p("div"),ue=C(ee),ae=p("br"),x=v(),_e=p("label"),oe=p("input"),J=v(),$=p("span"),$.textContent="A",ve=v(),ke=p("div"),S=C(D),I=p("br"),E=v(),j=p("label"),ne=p("input"),fe=v(),me=p("span"),me.textContent="kWp",he=v(),pe=p("div"),pe.innerHTML="",Se=v(),we=p("div"),Le=p("label"),qe=p("input"),Re=v(),Ce=C(re),Ue=v(),de&&de.c(),it=v(),Ee&&Ee.c(),_t=v(),et=p("label"),tt=p("input"),lt=v(),Ze=C(ot),bt=v(),Ge&&Ge.c(),u(l,"class","text-sm"),u(a,"href",cl("Meter-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","m"),f.value="true",u(_,"type","hidden"),u(_,"name","mo"),_.value="1",A.__value=0,y(A,A.__value),M.__value=2,y(M,M.__value),u(w,"name","ma"),u(w,"class","in-s"),t[6].m.a===void 0&&At(()=>t[32].call(w)),u(d,"class","my-1"),U.__value=2,y(U,U.__value),z.__value=1,y(z,z.__value),u(Y,"name","md"),u(Y,"class","in-s"),t[6].m.d===void 0&&At(()=>t[38].call(Y)),u(N,"class","my-1"),u(oe,"name","mf"),u(oe,"type","number"),u(oe,"min","5"),u(oe,"max","65535"),u(oe,"class","in-f tr w-full"),u($,"class","in-post"),u(_e,"class","flex"),u(Q,"class","mx-1"),u(ne,"name","mr"),u(ne,"type","number"),u(ne,"min","0"),u(ne,"max","65535"),u(ne,"class","in-f tr w-full"),u(me,"class","in-post"),u(j,"class","flex"),u(ke,"class","mx-1"),u(le,"class","my-1 flex"),u(pe,"class","my-1"),u(qe,"type","checkbox"),u(qe,"name","me"),qe.__value="true",y(qe,qe.__value),u(qe,"class","rounded mb-1"),u(we,"class","my-1"),u(tt,"type","checkbox"),u(tt,"name","mm"),tt.__value="true",y(tt,tt.__value),u(tt,"class","rounded mb-1"),u(e,"class","cnt")},m(ye,ft){P(ye,e,ft),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,_),o(e,m),o(e,d),o(d,b),o(d,g),o(d,k),o(d,w),o(w,A),o(A,L),o(w,M),o(M,O),Oe&&Oe.m(w,null),Xe(w,t[6].m.a,!0),o(e,K),ze.m(e,null),o(e,W),o(e,N),o(N,X),o(N,G),o(N,V),o(N,Y),o(Y,U),o(Y,z),Xe(Y,t[6].m.d,!0),o(e,se),o(e,le),o(le,Q),o(Q,ue),o(Q,ae),o(Q,x),o(Q,_e),o(_e,oe),y(oe,t[6].m.f),o(_e,J),o(_e,$),o(le,ve),o(le,ke),o(ke,S),o(ke,I),o(ke,E),o(ke,j),o(j,ne),y(ne,t[6].m.r),o(j,fe),o(j,me),o(e,he),o(e,pe),o(e,Se),o(e,we),o(we,Le),o(Le,qe),qe.checked=t[6].m.e.e,o(Le,Re),o(Le,Ce),o(we,Ue),de&&de.m(we,null),o(e,it),Ee&&Ee.m(e,null),o(e,_t),o(e,et),o(et,tt),tt.checked=t[6].m.m.e,o(et,lt),o(et,Ze),o(e,bt),Ge&&Ge.m(e,null),st||(Tt=[ce(w,"change",t[32]),ce(Y,"change",t[38]),ce(oe,"input",t[39]),ce(ne,"input",t[40]),ce(qe,"change",t[41]),ce(tt,"change",t[44])],st=!0)},p(ye,ft){var at,Dt,Ot,dt,Be,We,ct,be,nt,Pe,kt,Wt,Qt,xt,Ft,tl,ll,il,Ie,te,je,fl,ul;ft[0]&4&&n!==(n=(((Dt=(at=ye[2].conf)==null?void 0:at.meter)==null?void 0:Dt.title)??"Meter")+"")&&q(i,n),ft[0]&4&&h!==(h=(((Be=(dt=(Ot=ye[2].conf)==null?void 0:Ot.meter)==null?void 0:dt.comm)==null?void 0:Be.title)??"Communication")+"")&&q(b,h),ft[0]&4&&F!==(F=(((be=(ct=(We=ye[2].conf)==null?void 0:We.meter)==null?void 0:ct.comm)==null?void 0:be.passive)??"Passive")+"")&&q(L,F),ft[0]&4&&R!==(R=(((kt=(Pe=(nt=ye[2].conf)==null?void 0:nt.meter)==null?void 0:Pe.comm)==null?void 0:kt.pulse)??"Pulse")+"")&&q(O,R),ft[0]&1&&(H=(Qt=(Wt=ye[0])==null?void 0:Wt.features)==null?void 0:Qt.includes("kmp")),H?Oe||(Oe=yo(),Oe.c(),Oe.m(w,null)):Oe&&(Oe.d(1),Oe=null),ft[0]&64&&Xe(w,ye[6].m.a),He===(He=De(ye))&&ze?ze.p(ye,ft):(ze.d(1),ze=He(ye),ze&&(ze.c(),ze.m(e,W))),ft[0]&4&&B!==(B=(((xt=ye[2].common)==null?void 0:xt.voltage)??"Voltage")+"")&&q(X,B),ft[0]&64&&Xe(Y,ye[6].m.d),ft[0]&4&&ee!==(ee=(((tl=(Ft=ye[2].conf)==null?void 0:Ft.meter)==null?void 0:tl.fuse)??"Main fuse")+"")&&q(ue,ee),ft[0]&64&&Ke(oe.value)!==ye[6].m.f&&y(oe,ye[6].m.f),ft[0]&4&&D!==(D=(((il=(ll=ye[2].conf)==null?void 0:ll.meter)==null?void 0:il.prod)??"Production")+"")&&q(S,D),ft[0]&64&&Ke(ne.value)!==ye[6].m.r&&y(ne,ye[6].m.r),ft[0]&64&&(qe.checked=ye[6].m.e.e),ft[0]&4&&re!==(re=(((te=(Ie=ye[2].conf)==null?void 0:Ie.meter)==null?void 0:te.encrypted)??"Encrypted")+"")&&q(Ce,re),ye[6].m.e.e?de?de.p(ye,ft):(de=zo(ye),de.c(),de.m(we,null)):de&&(de.d(1),de=null),ye[6].m.e.e?Ee?Ee.p(ye,ft):(Ee=Wo(ye),Ee.c(),Ee.m(e,_t)):Ee&&(Ee.d(1),Ee=null),ft[0]&64&&(tt.checked=ye[6].m.m.e),ft[0]&4&&ot!==(ot=(((ul=(fl=(je=ye[2].conf)==null?void 0:je.meter)==null?void 0:fl.multipliers)==null?void 0:ul.title)??"Multipliers")+"")&&q(Ze,ot),ye[6].m.m.e?Ge?Ge.p(ye,ft):(Ge=Go(ye),Ge.c(),Ge.m(e,null)):Ge&&(Ge.d(1),Ge=null)},d(ye){ye&&T(e),Oe&&Oe.d(),ze.d(),de&&de.d(),Ee&&Ee.d(),Ge&&Ge.d(),st=!1,Lt(Tt)}}}function yo(t){let e;return{c(){e=p("option"),e.textContent="KMP",e.__value=9,y(e,e.__value)},m(l,n){P(l,e,n)},d(l){l&&T(e)}}}function G0(t){var ue,ae,x,_e,oe,J;let e,l,n=(((ae=(ue=t[2].conf)==null?void 0:ue.meter)==null?void 0:ae.buffer)??"Buffer size")+"",i,s,a,r=(((_e=(x=t[2].conf)==null?void 0:x.meter)==null?void 0:_e.serial)??"Serial conf.")+"",f,c,_,m,d,h=(((J=(oe=t[2].conf)==null?void 0:oe.meter)==null?void 0:J.inverted)??"inverted")+"",b,g,k,w,A,F,L,M,R,O,H,K,W,N,B,X,G,V,Y,U,z,se,le,Q=gt([3,12,24,48,96,192,384,576,1152]),ee=[];for(let $=0;$<9;$+=1)ee[$]=K0(H0(t,Q,$));return{c(){e=p("div"),l=p("span"),i=C(n),s=v(),a=p("span"),f=C(r),c=v(),_=p("label"),m=p("input"),d=v(),b=C(h),g=v(),k=p("div"),w=p("select"),A=p("option"),F=C("Autodetect");for(let $=0;$<9;$+=1)ee[$].c();M=v(),R=p("select"),O=p("option"),H=C("-"),W=p("option"),W.textContent="7N1",N=p("option"),N.textContent="8N1",B=p("option"),B.textContent="8N2",X=p("option"),X.textContent="7E1",G=p("option"),G.textContent="8E1",Y=v(),U=p("input"),u(l,"class","float-right"),u(m,"name","mi"),m.__value="true",y(m,m.__value),u(m,"type","checkbox"),u(m,"class","rounded mb-1"),u(_,"class","mt-2 ml-3 whitespace-nowrap"),A.__value=0,y(A,A.__value),A.disabled=L=t[6].m.b!=0,u(w,"name","mb"),u(w,"class","in-f tr w-1/2"),t[6].m.b===void 0&&At(()=>t[35].call(w)),O.__value=0,y(O,O.__value),O.disabled=K=t[6].m.b!=0,W.__value=2,y(W,W.__value),N.__value=3,y(N,N.__value),B.__value=7,y(B,B.__value),X.__value=10,y(X,X.__value),G.__value=11,y(G,G.__value),u(R,"name","mp"),u(R,"class","in-m"),R.disabled=V=t[6].m.b==0,t[6].m.p===void 0&&At(()=>t[36].call(R)),u(U,"name","ms"),u(U,"type","number"),u(U,"min",64),u(U,"max",z=t[0].chip=="esp8266"?t[6].i.h.p==3||t[6].i.h.p==113?512:256:4096),u(U,"step",64),u(U,"class","in-l tr w-1/2"),u(k,"class","flex w-full"),u(e,"class","my-1")},m($,ve){P($,e,ve),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(e,c),o(e,_),o(_,m),m.checked=t[6].m.i,o(_,d),o(_,b),o(e,g),o(e,k),o(k,w),o(w,A),o(A,F);for(let ke=0;ke<9;ke+=1)ee[ke]&&ee[ke].m(w,null);Xe(w,t[6].m.b,!0),o(k,M),o(k,R),o(R,O),o(O,H),o(R,W),o(R,N),o(R,B),o(R,X),o(R,G),Xe(R,t[6].m.p,!0),o(k,Y),o(k,U),y(U,t[6].m.s),se||(le=[ce(m,"change",t[34]),ce(w,"change",t[35]),ce(R,"change",t[36]),ce(U,"input",t[37])],se=!0)},p($,ve){var ke,D,S,I,E,j;ve[0]&4&&n!==(n=(((D=(ke=$[2].conf)==null?void 0:ke.meter)==null?void 0:D.buffer)??"Buffer size")+"")&&q(i,n),ve[0]&4&&r!==(r=(((I=(S=$[2].conf)==null?void 0:S.meter)==null?void 0:I.serial)??"Serial conf.")+"")&&q(f,r),ve[0]&64&&(m.checked=$[6].m.i),ve[0]&4&&h!==(h=(((j=(E=$[2].conf)==null?void 0:E.meter)==null?void 0:j.inverted)??"inverted")+"")&&q(b,h),ve[0]&64&&L!==(L=$[6].m.b!=0)&&(A.disabled=L),ve[0]&64&&Xe(w,$[6].m.b),ve[0]&64&&K!==(K=$[6].m.b!=0)&&(O.disabled=K),ve[0]&64&&V!==(V=$[6].m.b==0)&&(R.disabled=V),ve[0]&64&&Xe(R,$[6].m.p),ve[0]&65&&z!==(z=$[0].chip=="esp8266"?$[6].i.h.p==3||$[6].i.h.p==113?512:256:4096)&&u(U,"max",z),ve[0]&64&&Ke(U.value)!==$[6].m.s&&y(U,$[6].m.s)},d($){$&&T(e),Zt(ee,$),se=!1,Lt(le)}}}function V0(t){var c,_;let e,l,n=(((_=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:_.pulses)??"Pulses per kWh")+"",i,s,a,r,f;return{c(){e=p("div"),l=p("span"),i=C(n),s=v(),a=p("input"),u(a,"name","mb"),u(a,"class","in-s tr"),u(a,"type","number"),u(a,"min",1),u(a,"max",3600),u(e,"class","my-1")},m(m,d){P(m,e,d),o(e,l),o(l,i),o(e,s),o(e,a),y(a,t[6].m.b),r||(f=ce(a,"input",t[33]),r=!0)},p(m,d){var h,b;d[0]&4&&n!==(n=(((b=(h=m[2].conf)==null?void 0:h.meter)==null?void 0:b.pulses)??"Pulses per kWh")+"")&&q(i,n),d[0]&64&&Ke(a.value)!==m[6].m.b&&y(a,m[6].m.b)},d(m){m&&T(e),r=!1,f()}}}function K0(t){let e;return{c(){e=p("option"),e.textContent=`${t[123]*100}`,e.__value=t[123]*100,y(e,e.__value)},m(l,n){P(l,e,n)},p:Ve,d(l){l&&T(e)}}}function zo(t){let e,l,n,i;return{c(){e=p("br"),l=p("input"),u(l,"name","mek"),u(l,"type","text"),u(l,"class","in-s")},m(s,a){P(s,e,a),P(s,l,a),y(l,t[6].m.e.k),n||(i=ce(l,"input",t[42]),n=!0)},p(s,a){a[0]&64&&l.value!==s[6].m.e.k&&y(l,s[6].m.e.k)},d(s){s&&(T(e),T(l)),n=!1,i()}}}function Wo(t){var c,_;let e,l=(((_=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:_.authkey)??"Authentication key")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","mea"),u(a,"type","text"),u(a,"class","in-s"),u(e,"class","my-1")},m(m,d){P(m,e,d),o(e,n),o(e,i),o(e,s),o(e,a),y(a,t[6].m.e.a),r||(f=ce(a,"input",t[43]),r=!0)},p(m,d){var h,b;d[0]&4&&l!==(l=(((b=(h=m[2].conf)==null?void 0:h.meter)==null?void 0:b.authkey)??"Authentication key")+"")&&q(n,l),d[0]&64&&a.value!==m[6].m.e.a&&y(a,m[6].m.e.a)},d(m){m&&T(e),r=!1,f()}}}function Go(t){var V,Y,U,z,se,le,Q,ee,ue,ae,x,_e;let e,l,n=(((U=(Y=(V=t[2].conf)==null?void 0:V.meter)==null?void 0:Y.multipliers)==null?void 0:U.watt)??"Watt")+"",i,s,a,r,f,c,_=(((le=(se=(z=t[2].conf)==null?void 0:z.meter)==null?void 0:se.multipliers)==null?void 0:le.volt)??"Volt")+"",m,d,h,b,g,k,w=(((ue=(ee=(Q=t[2].conf)==null?void 0:Q.meter)==null?void 0:ee.multipliers)==null?void 0:ue.amp)??"Amp")+"",A,F,L,M,R,O,H=(((_e=(x=(ae=t[2].conf)==null?void 0:ae.meter)==null?void 0:x.multipliers)==null?void 0:_e.kwh)??"kWh")+"",K,W,N,B,X,G;return{c(){e=p("div"),l=p("div"),i=C(n),s=p("br"),a=v(),r=p("input"),f=v(),c=p("div"),m=C(_),d=p("br"),h=v(),b=p("input"),g=v(),k=p("div"),A=C(w),F=p("br"),L=v(),M=p("input"),R=v(),O=p("div"),K=C(H),W=p("br"),N=v(),B=p("input"),u(r,"name","mmw"),u(r,"type","number"),u(r,"min","0.00"),u(r,"max","1000"),u(r,"step","0.001"),u(r,"class","in-f tr w-full"),u(l,"class","w-1/4"),u(b,"name","mmv"),u(b,"type","number"),u(b,"min","0.00"),u(b,"max","1000"),u(b,"step","0.001"),u(b,"class","in-m tr w-full"),u(c,"class","w-1/4"),u(M,"name","mma"),u(M,"type","number"),u(M,"min","0.00"),u(M,"max","1000"),u(M,"step","0.001"),u(M,"class","in-m tr w-full"),u(k,"class","w-1/4"),u(B,"name","mmc"),u(B,"type","number"),u(B,"min","0.00"),u(B,"max","1000"),u(B,"step","0.001"),u(B,"class","in-l tr w-full"),u(O,"class","w-1/4"),u(e,"class","flex my-1")},m(oe,J){P(oe,e,J),o(e,l),o(l,i),o(l,s),o(l,a),o(l,r),y(r,t[6].m.m.w),o(e,f),o(e,c),o(c,m),o(c,d),o(c,h),o(c,b),y(b,t[6].m.m.v),o(e,g),o(e,k),o(k,A),o(k,F),o(k,L),o(k,M),y(M,t[6].m.m.a),o(e,R),o(e,O),o(O,K),o(O,W),o(O,N),o(O,B),y(B,t[6].m.m.c),X||(G=[ce(r,"input",t[45]),ce(b,"input",t[46]),ce(M,"input",t[47]),ce(B,"input",t[48])],X=!0)},p(oe,J){var $,ve,ke,D,S,I,E,j,ne,fe,me,he;J[0]&4&&n!==(n=(((ke=(ve=($=oe[2].conf)==null?void 0:$.meter)==null?void 0:ve.multipliers)==null?void 0:ke.watt)??"Watt")+"")&&q(i,n),J[0]&64&&Ke(r.value)!==oe[6].m.m.w&&y(r,oe[6].m.m.w),J[0]&4&&_!==(_=(((I=(S=(D=oe[2].conf)==null?void 0:D.meter)==null?void 0:S.multipliers)==null?void 0:I.volt)??"Volt")+"")&&q(m,_),J[0]&64&&Ke(b.value)!==oe[6].m.m.v&&y(b,oe[6].m.m.v),J[0]&4&&w!==(w=(((ne=(j=(E=oe[2].conf)==null?void 0:E.meter)==null?void 0:j.multipliers)==null?void 0:ne.amp)??"Amp")+"")&&q(A,w),J[0]&64&&Ke(M.value)!==oe[6].m.m.a&&y(M,oe[6].m.m.a),J[0]&4&&H!==(H=(((he=(me=(fe=oe[2].conf)==null?void 0:fe.meter)==null?void 0:me.multipliers)==null?void 0:he.kwh)??"kWh")+"")&&q(K,H),J[0]&64&&Ke(B.value)!==oe[6].m.m.c&&y(B,oe[6].m.m.c)},d(oe){oe&&T(e),X=!1,Lt(G)}}}function Vo(t){var O,H,K,W,N,B;let e,l,n=(((H=(O=t[2].conf)==null?void 0:O.connection)==null?void 0:H.title)??"Connection")+"",i,s,a,r,f,c,_,m,d,h=(((W=(K=t[2].conf)==null?void 0:K.connection)==null?void 0:W.wifi)??"WiFi")+"",b,g,k=(((B=(N=t[2].conf)==null?void 0:N.connection)==null?void 0:B.ap)??"AP")+"",w,A,F,L,M=t[0].if&&t[0].if.eth&&Ko(t),R=(t[6].n.c==1||t[6].n.c==2)&&Yo(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),_=p("div"),m=p("select"),d=p("option"),b=C(h),g=p("option"),w=C(k),M&&M.c(),A=v(),R&&R.c(),u(l,"class","text-sm"),u(a,"href",cl("Network-connection")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","w"),f.value="true",d.__value=1,y(d,d.__value),g.__value=2,y(g,g.__value),u(m,"name","nc"),u(m,"class","in-s"),t[6].n.c===void 0&&At(()=>t[49].call(m)),u(_,"class","my-1"),u(e,"class","cnt")},m(X,G){P(X,e,G),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,_),o(_,m),o(m,d),o(d,b),o(m,g),o(g,w),M&&M.m(m,null),Xe(m,t[6].n.c,!0),o(e,A),R&&R.m(e,null),F||(L=ce(m,"change",t[49]),F=!0)},p(X,G){var V,Y,U,z,se,le;G[0]&4&&n!==(n=(((Y=(V=X[2].conf)==null?void 0:V.connection)==null?void 0:Y.title)??"Connection")+"")&&q(i,n),G[0]&4&&h!==(h=(((z=(U=X[2].conf)==null?void 0:U.connection)==null?void 0:z.wifi)??"WiFi")+"")&&q(b,h),G[0]&4&&k!==(k=(((le=(se=X[2].conf)==null?void 0:se.connection)==null?void 0:le.ap)??"AP")+"")&&q(w,k),X[0].if&&X[0].if.eth?M?M.p(X,G):(M=Ko(X),M.c(),M.m(m,null)):M&&(M.d(1),M=null),G[0]&64&&Xe(m,X[6].n.c),X[6].n.c==1||X[6].n.c==2?R?R.p(X,G):(R=Yo(X),R.c(),R.m(e,null)):R&&(R.d(1),R=null)},d(X){X&&T(e),M&&M.d(),R&&R.d(),F=!1,L()}}}function Ko(t){var i,s;let e,l=(((s=(i=t[2].conf)==null?void 0:i.connection)==null?void 0:s.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=C(l),e.__value=3,y(e,e.__value)},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&q(n,l)},d(a){a&&T(e)}}}function Yo(t){var ne,fe,me,he,pe,Se,we,Le,qe,Re,re,Ce,Ue,it,_t,et,tt,lt,ot,Ze,bt,st,Tt;let e,l=(((fe=(ne=t[2].conf)==null?void 0:ne.connection)==null?void 0:fe.ssid)??"SSID")+"",n,i,s,a,r,f,c=(((he=(me=t[2].conf)==null?void 0:me.connection)==null?void 0:he.psk)??"Password")+"",_,m,d,h,b,g,k,w=(((we=(Se=(pe=t[2].conf)==null?void 0:pe.connection)==null?void 0:Se.ps)==null?void 0:we.title)??"Power saving")+"",A,F,L,M,R,O=(((Re=(qe=(Le=t[2].conf)==null?void 0:Le.connection)==null?void 0:qe.ps)==null?void 0:Re.default)??"Default")+"",H,K,W=(((Ue=(Ce=(re=t[2].conf)==null?void 0:re.connection)==null?void 0:Ce.ps)==null?void 0:Ue.off)??"Off")+"",N,B,X=(((et=(_t=(it=t[2].conf)==null?void 0:it.connection)==null?void 0:_t.ps)==null?void 0:et.min)??"Min")+"",G,V,Y=(((ot=(lt=(tt=t[2].conf)==null?void 0:tt.connection)==null?void 0:lt.ps)==null?void 0:ot.max)??"Max")+"",U,z,se,le=(((bt=(Ze=t[2].conf)==null?void 0:Ze.connection)==null?void 0:bt.pwr)??"Power")+"",Q,ee,ue,ae,x,_e,oe,J,$,ve,ke,D,S=(((Tt=(st=t[2].conf)==null?void 0:st.connection)==null?void 0:Tt.tick_11b)??"802.11b")+"",I,E,j;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),r=v(),f=p("div"),_=C(c),m=p("br"),d=v(),h=p("input"),b=v(),g=p("div"),k=p("div"),A=C(w),F=p("br"),L=v(),M=p("select"),R=p("option"),H=C(O),K=p("option"),N=C(W),B=p("option"),G=C(X),V=p("option"),U=C(Y),z=v(),se=p("div"),Q=C(le),ee=p("br"),ue=v(),ae=p("div"),x=p("input"),_e=v(),oe=p("span"),oe.textContent="dBm",J=v(),$=p("div"),ve=p("label"),ke=p("input"),D=v(),I=C(S),u(a,"name","ws"),u(a,"type","text"),u(a,"class","in-s"),u(e,"class","my-1"),u(h,"name","wp"),u(h,"type","password"),u(h,"class","in-s"),u(f,"class","my-1"),R.__value=255,y(R,R.__value),K.__value=0,y(K,K.__value),B.__value=1,y(B,B.__value),V.__value=2,y(V,V.__value),u(M,"name","wz"),u(M,"class","in-s"),t[6].w.z===void 0&&At(()=>t[52].call(M)),u(k,"class","w-1/2"),u(x,"name","ww"),u(x,"type","number"),u(x,"min","0"),u(x,"max","20.5"),u(x,"step","0.5"),u(x,"class","in-f tr w-full"),u(oe,"class","in-post"),u(ae,"class","flex"),u(se,"class","ml-2 w-1/2"),u(g,"class","my-1 flex"),u(ke,"type","checkbox"),u(ke,"name","wb"),ke.__value="true",y(ke,ke.__value),u(ke,"class","rounded mb-1"),u($,"class","my-3")},m(Oe,De){P(Oe,e,De),o(e,n),o(e,i),o(e,s),o(e,a),y(a,t[6].w.s),P(Oe,r,De),P(Oe,f,De),o(f,_),o(f,m),o(f,d),o(f,h),y(h,t[6].w.p),P(Oe,b,De),P(Oe,g,De),o(g,k),o(k,A),o(k,F),o(k,L),o(k,M),o(M,R),o(R,H),o(M,K),o(K,N),o(M,B),o(B,G),o(M,V),o(V,U),Xe(M,t[6].w.z,!0),o(g,z),o(g,se),o(se,Q),o(se,ee),o(se,ue),o(se,ae),o(ae,x),y(x,t[6].w.w),o(ae,_e),o(ae,oe),P(Oe,J,De),P(Oe,$,De),o($,ve),o(ve,ke),ke.checked=t[6].w.b,o(ve,D),o(ve,I),E||(j=[ce(a,"input",t[50]),ce(h,"input",t[51]),ce(M,"change",t[52]),ce(x,"input",t[53]),ce(ke,"change",t[54])],E=!0)},p(Oe,De){var He,ze,de,Ee,Ge,ge,Ae,Je,Qe,It,$e,Fe,wt,ut,rt,mt,qt,jt,Pt,pt,Ht,Kt,Rt;De[0]&4&&l!==(l=(((ze=(He=Oe[2].conf)==null?void 0:He.connection)==null?void 0:ze.ssid)??"SSID")+"")&&q(n,l),De[0]&64&&a.value!==Oe[6].w.s&&y(a,Oe[6].w.s),De[0]&4&&c!==(c=(((Ee=(de=Oe[2].conf)==null?void 0:de.connection)==null?void 0:Ee.psk)??"Password")+"")&&q(_,c),De[0]&64&&h.value!==Oe[6].w.p&&y(h,Oe[6].w.p),De[0]&4&&w!==(w=(((Ae=(ge=(Ge=Oe[2].conf)==null?void 0:Ge.connection)==null?void 0:ge.ps)==null?void 0:Ae.title)??"Power saving")+"")&&q(A,w),De[0]&4&&O!==(O=(((It=(Qe=(Je=Oe[2].conf)==null?void 0:Je.connection)==null?void 0:Qe.ps)==null?void 0:It.default)??"Default")+"")&&q(H,O),De[0]&4&&W!==(W=(((wt=(Fe=($e=Oe[2].conf)==null?void 0:$e.connection)==null?void 0:Fe.ps)==null?void 0:wt.off)??"Off")+"")&&q(N,W),De[0]&4&&X!==(X=(((mt=(rt=(ut=Oe[2].conf)==null?void 0:ut.connection)==null?void 0:rt.ps)==null?void 0:mt.min)??"Min")+"")&&q(G,X),De[0]&4&&Y!==(Y=(((Pt=(jt=(qt=Oe[2].conf)==null?void 0:qt.connection)==null?void 0:jt.ps)==null?void 0:Pt.max)??"Max")+"")&&q(U,Y),De[0]&64&&Xe(M,Oe[6].w.z),De[0]&4&&le!==(le=(((Ht=(pt=Oe[2].conf)==null?void 0:pt.connection)==null?void 0:Ht.pwr)??"Power")+"")&&q(Q,le),De[0]&64&&Ke(x.value)!==Oe[6].w.w&&y(x,Oe[6].w.w),De[0]&64&&(ke.checked=Oe[6].w.b),De[0]&4&&S!==(S=(((Rt=(Kt=Oe[2].conf)==null?void 0:Kt.connection)==null?void 0:Rt.tick_11b)??"802.11b")+"")&&q(I,S)},d(Oe){Oe&&(T(e),T(r),T(f),T(b),T(g),T(J),T($)),E=!1,Lt(j)}}}function Qo(t){var re,Ce,Ue,it,_t,et,tt,lt,ot,Ze,bt,st,Tt,Oe;let e,l,n=(((Ce=(re=t[2].conf)==null?void 0:re.network)==null?void 0:Ce.title)??"Network")+"",i,s,a,r,f,c=(((it=(Ue=t[2].conf)==null?void 0:Ue.network)==null?void 0:it.ip)??"IP")+"",_,m,d,h,b,g,k=(((et=(_t=t[2].conf)==null?void 0:_t.network)==null?void 0:et.dhcp)??"DHCP")+"",w,A,F=(((lt=(tt=t[2].conf)==null?void 0:tt.network)==null?void 0:lt.static)??"Static")+"",L,M,R,O,H,K,W,N,B,X,G,V,Y,U,z,se,le,Q,ee,ue,ae,x=(((Ze=(ot=t[2].conf)==null?void 0:ot.network)==null?void 0:Ze.tick_mdns)??"mDNS")+"",_e,oe,J,$,ve,ke=(((st=(bt=t[2].conf)==null?void 0:bt.network)==null?void 0:st.ntp)??"NTP")+"",D,S,I,E,j,ne=(((Oe=(Tt=t[2].conf)==null?void 0:Tt.network)==null?void 0:Oe.tick_ntp_dhcp)??"from DHCP")+"",fe,me,he,pe,Se,we,Le,qe;N=new hu({});let Re=t[6].n.m=="static"&&Xo(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("div"),_=C(c),m=p("br"),d=v(),h=p("div"),b=p("select"),g=p("option"),w=C(k),A=p("option"),L=C(F),M=v(),R=p("input"),K=v(),W=p("select"),Te(N.$$.fragment),G=v(),Re&&Re.c(),V=v(),Y=p("div"),U=p("label"),z=p("input"),se=C(" IPv6"),le=v(),Q=p("div"),ee=p("label"),ue=p("input"),ae=v(),_e=C(x),oe=v(),J=p("input"),$=v(),ve=p("div"),D=C(ke),S=v(),I=p("label"),E=p("input"),j=v(),fe=C(ne),me=p("br"),he=v(),pe=p("div"),Se=p("input"),u(l,"class","text-sm"),u(a,"href",cl("Network-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),g.__value="dhcp",y(g,g.__value),A.__value="static",y(A,A.__value),u(b,"name","nm"),u(b,"class","in-f"),t[6].n.m===void 0&&At(()=>t[55].call(b)),u(R,"name","ni"),u(R,"type","text"),u(R,"class","in-m w-full"),R.disabled=O=t[6].n.m=="dhcp",R.required=H=t[6].n.m=="static",u(W,"name","ns"),u(W,"class","in-l"),W.disabled=B=t[6].n.m=="dhcp",W.required=X=t[6].n.m=="static",t[6].n.s===void 0&&At(()=>t[57].call(W)),u(h,"class","flex"),u(f,"class","my-1"),u(z,"name","nx"),z.__value="true",y(z,z.__value),u(z,"type","checkbox"),u(z,"class","rounded mb-1"),u(Y,"class","my-1"),u(ue,"name","nd"),ue.__value="true",y(ue,ue.__value),u(ue,"type","checkbox"),u(ue,"class","rounded mb-1"),u(Q,"class","my-1"),u(J,"type","hidden"),u(J,"name","ntp"),J.value="true",u(E,"name","ntpd"),E.__value="true",y(E,E.__value),u(E,"type","checkbox"),u(E,"class","rounded mb-1"),u(I,"class","ml-4"),u(Se,"name","ntph"),u(Se,"type","text"),u(Se,"class","in-s"),u(pe,"class","flex"),u(ve,"class","my-1"),u(e,"class","cnt")},m(De,He){P(De,e,He),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(f,_),o(f,m),o(f,d),o(f,h),o(h,b),o(b,g),o(g,w),o(b,A),o(A,L),Xe(b,t[6].n.m,!0),o(h,M),o(h,R),y(R,t[6].n.i),o(h,K),o(h,W),Me(N,W,null),Xe(W,t[6].n.s,!0),o(e,G),Re&&Re.m(e,null),o(e,V),o(e,Y),o(Y,U),o(U,z),z.checked=t[6].n.x,o(U,se),o(e,le),o(e,Q),o(Q,ee),o(ee,ue),ue.checked=t[6].n.d,o(ee,ae),o(ee,_e),o(e,oe),o(e,J),o(e,$),o(e,ve),o(ve,D),o(ve,S),o(ve,I),o(I,E),E.checked=t[6].n.h,o(I,j),o(I,fe),o(ve,me),o(ve,he),o(ve,pe),o(pe,Se),y(Se,t[6].n.n1),we=!0,Le||(qe=[ce(b,"change",t[55]),ce(R,"input",t[56]),ce(W,"change",t[57]),ce(z,"change",t[61]),ce(ue,"change",t[62]),ce(E,"change",t[63]),ce(Se,"input",t[64])],Le=!0)},p(De,He){var ze,de,Ee,Ge,ge,Ae,Je,Qe,It,$e,Fe,wt,ut,rt;(!we||He[0]&4)&&n!==(n=(((de=(ze=De[2].conf)==null?void 0:ze.network)==null?void 0:de.title)??"Network")+"")&&q(i,n),(!we||He[0]&4)&&c!==(c=(((Ge=(Ee=De[2].conf)==null?void 0:Ee.network)==null?void 0:Ge.ip)??"IP")+"")&&q(_,c),(!we||He[0]&4)&&k!==(k=(((Ae=(ge=De[2].conf)==null?void 0:ge.network)==null?void 0:Ae.dhcp)??"DHCP")+"")&&q(w,k),(!we||He[0]&4)&&F!==(F=(((Qe=(Je=De[2].conf)==null?void 0:Je.network)==null?void 0:Qe.static)??"Static")+"")&&q(L,F),He[0]&64&&Xe(b,De[6].n.m),(!we||He[0]&64&&O!==(O=De[6].n.m=="dhcp"))&&(R.disabled=O),(!we||He[0]&64&&H!==(H=De[6].n.m=="static"))&&(R.required=H),He[0]&64&&R.value!==De[6].n.i&&y(R,De[6].n.i),(!we||He[0]&64&&B!==(B=De[6].n.m=="dhcp"))&&(W.disabled=B),(!we||He[0]&64&&X!==(X=De[6].n.m=="static"))&&(W.required=X),He[0]&64&&Xe(W,De[6].n.s),De[6].n.m=="static"?Re?Re.p(De,He):(Re=Xo(De),Re.c(),Re.m(e,V)):Re&&(Re.d(1),Re=null),He[0]&64&&(z.checked=De[6].n.x),He[0]&64&&(ue.checked=De[6].n.d),(!we||He[0]&4)&&x!==(x=((($e=(It=De[2].conf)==null?void 0:It.network)==null?void 0:$e.tick_mdns)??"mDNS")+"")&&q(_e,x),(!we||He[0]&4)&&ke!==(ke=(((wt=(Fe=De[2].conf)==null?void 0:Fe.network)==null?void 0:wt.ntp)??"NTP")+"")&&q(D,ke),He[0]&64&&(E.checked=De[6].n.h),(!we||He[0]&4)&&ne!==(ne=(((rt=(ut=De[2].conf)==null?void 0:ut.network)==null?void 0:rt.tick_ntp_dhcp)??"from DHCP")+"")&&q(fe,ne),He[0]&64&&Se.value!==De[6].n.n1&&y(Se,De[6].n.n1)},i(De){we||(Z(N.$$.fragment,De),we=!0)},o(De){ie(N.$$.fragment,De),we=!1},d(De){De&&T(e),Ne(N),Re&&Re.d(),Le=!1,Lt(qe)}}}function Xo(t){var F,L,M,R;let e,l=(((L=(F=t[2].conf)==null?void 0:F.network)==null?void 0:L.gw)??"Gateway")+"",n,i,s,a,r,f,c=(((R=(M=t[2].conf)==null?void 0:M.network)==null?void 0:R.dns)??"DNS")+"",_,m,d,h,b,g,k,w,A;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),r=v(),f=p("div"),_=C(c),m=p("br"),d=v(),h=p("div"),b=p("input"),g=v(),k=p("input"),u(a,"name","ng"),u(a,"type","text"),u(a,"class","in-s"),u(e,"class","my-1"),u(b,"name","nd1"),u(b,"type","text"),u(b,"class","in-f w-full"),u(k,"name","nd2"),u(k,"type","text"),u(k,"class","in-l w-full"),u(h,"class","flex"),u(f,"class","my-1")},m(O,H){P(O,e,H),o(e,n),o(e,i),o(e,s),o(e,a),y(a,t[6].n.g),P(O,r,H),P(O,f,H),o(f,_),o(f,m),o(f,d),o(f,h),o(h,b),y(b,t[6].n.d1),o(h,g),o(h,k),y(k,t[6].n.d2),w||(A=[ce(a,"input",t[58]),ce(b,"input",t[59]),ce(k,"input",t[60])],w=!0)},p(O,H){var K,W,N,B;H[0]&4&&l!==(l=(((W=(K=O[2].conf)==null?void 0:K.network)==null?void 0:W.gw)??"Gateway")+"")&&q(n,l),H[0]&64&&a.value!==O[6].n.g&&y(a,O[6].n.g),H[0]&4&&c!==(c=(((B=(N=O[2].conf)==null?void 0:N.network)==null?void 0:B.dns)??"DNS")+"")&&q(_,c),H[0]&64&&b.value!==O[6].n.d1&&y(b,O[6].n.d1),H[0]&64&&k.value!==O[6].n.d2&&y(k,O[6].n.d2)},d(O){O&&(T(e),T(r),T(f)),w=!1,Lt(A)}}}function Zo(t){var wt,ut,rt,mt,qt,jt,Pt,pt,Ht,Kt,Rt,zt,Yt,el,Jt,$t,ye,ft,at,Dt,Ot,dt;let e,l,n=(((ut=(wt=t[2].conf)==null?void 0:wt.mqtt)==null?void 0:ut.title)??"MQTT")+"",i,s,a,r,f,c,_,m=(((mt=(rt=t[2].conf)==null?void 0:rt.mqtt)==null?void 0:mt.server)??"Server")+"",d,h,b,g,k,w,A,F,L,M,R,O,H=(((jt=(qt=t[2].conf)==null?void 0:qt.mqtt)==null?void 0:jt.user)??"Username")+"",K,W,N,B,X,G,V=(((pt=(Pt=t[2].conf)==null?void 0:Pt.mqtt)==null?void 0:pt.pass)??"Password")+"",Y,U,z,se,le,Q,ee,ue=(((Kt=(Ht=t[2].conf)==null?void 0:Ht.mqtt)==null?void 0:Kt.id)??"Client ID")+"",ae,x,_e,oe,J,$,ve,ke=(((zt=(Rt=t[2].conf)==null?void 0:Rt.mqtt)==null?void 0:zt.payload)??"Payload")+"",D,S,I,E,j,ne,fe,me=(((Jt=(el=(Yt=t[2].conf)==null?void 0:Yt.mqtt)==null?void 0:el.domoticz)==null?void 0:Jt.title)??"Domoticz")+"",he,pe,Se=(((ft=(ye=($t=t[2].conf)==null?void 0:$t.mqtt)==null?void 0:ye.ha)==null?void 0:ft.title)??"Home-Assistant")+"",we,Le,qe,Re,re,Ce,Ue,it=(((Dt=(at=t[2].conf)==null?void 0:at.mqtt)==null?void 0:Dt.publish)??"Publish topic")+"",_t,et,tt,lt,ot,Ze,bt=(((dt=(Ot=t[2].conf)==null?void 0:Ot.mqtt)==null?void 0:dt.update)??"Update method")+"",st,Tt,Oe,De,He,ze,de,Ee,Ge,ge,Ae,Je,Qe,It,$e=t[0].chip!="esp8266"&&Jo(t),Fe=t[6].q.s.e&&$o(t);return{c(){var Be,We;e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),_=p("div"),d=C(m),h=v(),$e&&$e.c(),b=v(),g=p("br"),k=v(),w=p("div"),A=p("input"),F=v(),L=p("input"),M=v(),Fe&&Fe.c(),R=v(),O=p("div"),K=C(H),W=p("br"),N=v(),B=p("input"),X=v(),G=p("div"),Y=C(V),U=p("br"),z=v(),se=p("input"),le=v(),Q=p("div"),ee=p("div"),ae=C(ue),x=p("br"),_e=v(),oe=p("input"),$=v(),ve=p("div"),D=C(ke),S=p("br"),I=v(),E=p("select"),j=p("option"),j.textContent="Raw (minimal)",ne=p("option"),ne.textContent="Raw (full)",fe=p("option"),he=C(me),pe=p("option"),we=C(Se),Le=p("option"),Le.textContent="JSON (classic)",qe=p("option"),qe.textContent="JSON (multi topic)",Re=p("option"),Re.textContent="JSON (flat)",re=p("option"),re.textContent="HEX dump",Ce=v(),Ue=p("div"),_t=C(it),et=p("br"),tt=v(),lt=p("input"),ot=v(),Ze=p("div"),st=C(bt),Tt=v(),Oe=p("span"),Oe.textContent="Interval",De=v(),He=p("div"),ze=p("select"),de=p("option"),de.textContent="Real time",Ee=p("option"),Ee.textContent="Interval",Ge=v(),ge=p("input"),u(l,"class","text-sm"),u(a,"href",cl("MQTT-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","q"),f.value="true",u(A,"name","qh"),u(A,"type","text"),u(A,"class","in-f w-2/3"),u(L,"name","qp"),u(L,"type","number"),u(L,"min","1024"),u(L,"max","65535"),u(L,"class","in-l tr w-1/3"),u(w,"class","flex"),u(_,"class","my-1"),u(B,"name","qu"),u(B,"type","text"),u(B,"class","in-s"),u(O,"class","my-1"),u(se,"name","qa"),u(se,"type","password"),u(se,"class","in-s"),u(G,"class","my-1"),u(oe,"name","qc"),u(oe,"type","text"),u(oe,"class","in-f w-full"),oe.required=J=t[6].q.h,j.__value=1,y(j,j.__value),ne.__value=2,y(ne,ne.__value),fe.__value=3,y(fe,fe.__value),pe.__value=4,y(pe,pe.__value),Le.__value=0,y(Le,Le.__value),qe.__value=5,y(qe,qe.__value),Re.__value=6,y(Re,Re.__value),re.__value=255,y(re,re.__value),u(E,"name","qm"),u(E,"class","in-l"),t[6].q.m===void 0&&At(()=>t[71].call(E)),u(Q,"class","my-1 flex"),u(lt,"name","qb"),u(lt,"type","text"),u(lt,"class","in-s"),u(Ue,"class","my-1"),u(Oe,"class","float-right"),de.__value=0,y(de,de.__value),Ee.__value=1,y(Ee,Ee.__value),u(ze,"name","qt"),u(ze,"class","in-f w-1/2"),t[6].q.t===void 0&&At(()=>t[73].call(ze)),u(ge,"name","qd"),u(ge,"type","number"),u(ge,"min","1"),u(ge,"max","3600"),u(ge,"class","in-l tr w-1/2"),ge.disabled=Ae=((We=(Be=t[6])==null?void 0:Be.q)==null?void 0:We.t)!=1,u(He,"class","flex"),u(Ze,"class","my-1"),u(e,"class","cnt")},m(Be,We){P(Be,e,We),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,_),o(_,d),o(_,h),$e&&$e.m(_,null),o(_,b),o(_,g),o(_,k),o(_,w),o(w,A),y(A,t[6].q.h),o(w,F),o(w,L),y(L,t[6].q.p),o(e,M),Fe&&Fe.m(e,null),o(e,R),o(e,O),o(O,K),o(O,W),o(O,N),o(O,B),y(B,t[6].q.u),o(e,X),o(e,G),o(G,Y),o(G,U),o(G,z),o(G,se),y(se,t[6].q.a),o(e,le),o(e,Q),o(Q,ee),o(ee,ae),o(ee,x),o(ee,_e),o(ee,oe),y(oe,t[6].q.c),o(Q,$),o(Q,ve),o(ve,D),o(ve,S),o(ve,I),o(ve,E),o(E,j),o(E,ne),o(E,fe),o(fe,he),o(E,pe),o(pe,we),o(E,Le),o(E,qe),o(E,Re),o(E,re),Xe(E,t[6].q.m,!0),o(e,Ce),o(e,Ue),o(Ue,_t),o(Ue,et),o(Ue,tt),o(Ue,lt),y(lt,t[6].q.b),o(e,ot),o(e,Ze),o(Ze,st),o(Ze,Tt),o(Ze,Oe),o(Ze,De),o(Ze,He),o(He,ze),o(ze,de),o(ze,Ee),Xe(ze,t[6].q.t,!0),o(He,Ge),o(He,ge),y(ge,t[6].q.d),Je=!0,Qe||(It=[ce(A,"input",t[66]),ce(L,"input",t[67]),ce(B,"input",t[68]),ce(se,"input",t[69]),ce(oe,"input",t[70]),ce(E,"change",t[71]),ce(lt,"input",t[72]),ce(ze,"change",t[73]),ce(ge,"input",t[74])],Qe=!0)},p(Be,We){var ct,be,nt,Pe,kt,Wt,Qt,xt,Ft,tl,ll,il,Ie,te,je,fl,ul,vl,bl,gl,kl,wl,Cl,Sl;(!Je||We[0]&4)&&n!==(n=(((be=(ct=Be[2].conf)==null?void 0:ct.mqtt)==null?void 0:be.title)??"MQTT")+"")&&q(i,n),(!Je||We[0]&4)&&m!==(m=(((Pe=(nt=Be[2].conf)==null?void 0:nt.mqtt)==null?void 0:Pe.server)??"Server")+"")&&q(d,m),Be[0].chip!="esp8266"?$e?$e.p(Be,We):($e=Jo(Be),$e.c(),$e.m(_,b)):$e&&($e.d(1),$e=null),We[0]&64&&A.value!==Be[6].q.h&&y(A,Be[6].q.h),We[0]&64&&Ke(L.value)!==Be[6].q.p&&y(L,Be[6].q.p),Be[6].q.s.e?Fe?(Fe.p(Be,We),We[0]&64&&Z(Fe,1)):(Fe=$o(Be),Fe.c(),Z(Fe,1),Fe.m(e,R)):Fe&&(ht(),ie(Fe,1,1,()=>{Fe=null}),vt()),(!Je||We[0]&4)&&H!==(H=(((Wt=(kt=Be[2].conf)==null?void 0:kt.mqtt)==null?void 0:Wt.user)??"Username")+"")&&q(K,H),We[0]&64&&B.value!==Be[6].q.u&&y(B,Be[6].q.u),(!Je||We[0]&4)&&V!==(V=(((xt=(Qt=Be[2].conf)==null?void 0:Qt.mqtt)==null?void 0:xt.pass)??"Password")+"")&&q(Y,V),We[0]&64&&se.value!==Be[6].q.a&&y(se,Be[6].q.a),(!Je||We[0]&4)&&ue!==(ue=(((tl=(Ft=Be[2].conf)==null?void 0:Ft.mqtt)==null?void 0:tl.id)??"Client ID")+"")&&q(ae,ue),(!Je||We[0]&64&&J!==(J=Be[6].q.h))&&(oe.required=J),We[0]&64&&oe.value!==Be[6].q.c&&y(oe,Be[6].q.c),(!Je||We[0]&4)&&ke!==(ke=(((il=(ll=Be[2].conf)==null?void 0:ll.mqtt)==null?void 0:il.payload)??"Payload")+"")&&q(D,ke),(!Je||We[0]&4)&&me!==(me=(((je=(te=(Ie=Be[2].conf)==null?void 0:Ie.mqtt)==null?void 0:te.domoticz)==null?void 0:je.title)??"Domoticz")+"")&&q(he,me),(!Je||We[0]&4)&&Se!==(Se=(((vl=(ul=(fl=Be[2].conf)==null?void 0:fl.mqtt)==null?void 0:ul.ha)==null?void 0:vl.title)??"Home-Assistant")+"")&&q(we,Se),We[0]&64&&Xe(E,Be[6].q.m),(!Je||We[0]&4)&&it!==(it=(((gl=(bl=Be[2].conf)==null?void 0:bl.mqtt)==null?void 0:gl.publish)??"Publish topic")+"")&&q(_t,it),We[0]&64&<.value!==Be[6].q.b&&y(lt,Be[6].q.b),(!Je||We[0]&4)&&bt!==(bt=(((wl=(kl=Be[2].conf)==null?void 0:kl.mqtt)==null?void 0:wl.update)??"Update method")+"")&&q(st,bt),We[0]&64&&Xe(ze,Be[6].q.t),(!Je||We[0]&64&&Ae!==(Ae=((Sl=(Cl=Be[6])==null?void 0:Cl.q)==null?void 0:Sl.t)!=1))&&(ge.disabled=Ae),We[0]&64&&Ke(ge.value)!==Be[6].q.d&&y(ge,Be[6].q.d)},i(Be){Je||(Z(Fe),Je=!0)},o(Be){ie(Fe),Je=!1},d(Be){Be&&T(e),$e&&$e.d(),Fe&&Fe.d(),Qe=!1,Lt(It)}}}function Jo(t){let e,l,n,i,s;return{c(){e=p("label"),l=p("input"),n=C(" SSL"),u(l,"type","checkbox"),u(l,"name","qs"),l.__value="true",y(l,l.__value),u(l,"class","rounded mb-1"),u(e,"class","float-right mr-3")},m(a,r){P(a,e,r),o(e,l),l.checked=t[6].q.s.e,o(e,n),i||(s=[ce(l,"change",t[65]),ce(l,"change",t[18])],i=!0)},p(a,r){r[0]&64&&(l.checked=a[6].q.s.e)},d(a){a&&T(e),i=!1,Lt(s)}}}function $o(t){let e,l,n,i,s,a,r,f,c,_,m,d,h;const b=[Q0,Y0],g=[];function k(O,H){return O[6].q.s.c?0:1}n=k(t),i=g[n]=b[n](t);const w=[$0,J0],A=[];function F(O,H){return O[6].q.s.r?0:1}r=F(t),f=A[r]=w[r](t);const L=[lc,tc],M=[];function R(O,H){return O[6].q.s.k?0:1}return m=R(t),d=M[m]=L[m](t),{c(){e=p("div"),l=p("span"),i.c(),s=v(),a=p("span"),f.c(),c=v(),_=p("span"),d.c(),u(l,"class","flex pr-2"),u(a,"class","flex pr-2"),u(_,"class","flex pr-2"),u(e,"class","my-1 flex")},m(O,H){P(O,e,H),o(e,l),g[n].m(l,null),o(e,s),o(e,a),A[r].m(a,null),o(e,c),o(e,_),M[m].m(_,null),h=!0},p(O,H){let K=n;n=k(O),n===K?g[n].p(O,H):(ht(),ie(g[K],1,1,()=>{g[K]=null}),vt(),i=g[n],i?i.p(O,H):(i=g[n]=b[n](O),i.c()),Z(i,1),i.m(l,null));let W=r;r=F(O),r===W?A[r].p(O,H):(ht(),ie(A[W],1,1,()=>{A[W]=null}),vt(),f=A[r],f?f.p(O,H):(f=A[r]=w[r](O),f.c()),Z(f,1),f.m(a,null));let N=m;m=R(O),m===N?M[m].p(O,H):(ht(),ie(M[N],1,1,()=>{M[N]=null}),vt(),d=M[m],d?d.p(O,H):(d=M[m]=L[m](O),d.c()),Z(d,1),d.m(_,null))},i(O){h||(Z(i),Z(f),Z(d),h=!0)},o(O){ie(i),ie(f),ie(d),h=!1},d(O){O&&T(e),g[n].d(),A[r].d(),M[m].d()}}}function Y0(t){let e,l;return e=new _l({props:{to:"/mqtt-ca",$$slots:{default:[X0]},$$scope:{ctx:t}}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i[0]&4|i[4]&32&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Q0(t){let e,l,n,i,s,a,r;return l=new _l({props:{to:"/mqtt-ca",$$slots:{default:[Z0]},$$scope:{ctx:t}}}),{c(){e=p("span"),Te(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Me(l,e,null),P(f,n,c),P(f,i,c),s=!0,a||(r=[ce(i,"click",t[15]),ce(i,"keypress",t[15])],a=!0)},p(f,c){const _={};c[0]&4|c[4]&32&&(_.$$scope={dirty:c,ctx:f}),l.$set(_)},i(f){s||(Z(l.$$.fragment,f),s=!0)},o(f){ie(l.$$.fragment,f),s=!1},d(f){f&&(T(e),T(n),T(i)),Ne(l),a=!1,Lt(r)}}}function X0(t){var n,i,s,a;let e,l;return e=new Ul({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_ca_upload)??"Upload CA",title:((a=(s=t[2].conf)==null?void 0:s.mqtt)==null?void 0:a.title_ca)??""}}),{c(){Te(e.$$.fragment)},m(r,f){Me(e,r,f),l=!0},p(r,f){var _,m,d,h;const c={};f[0]&4&&(c.text=((m=(_=r[2].conf)==null?void 0:_.mqtt)==null?void 0:m.btn_ca_upload)??"Upload CA"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_ca)??""),e.$set(c)},i(r){l||(Z(e.$$.fragment,r),l=!0)},o(r){ie(e.$$.fragment,r),l=!1},d(r){Ne(e,r)}}}function Z0(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.ca_ok)??"CA OK")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.mqtt)==null?void 0:f.ca_ok)??"CA OK")+"")&&q(l,e)},d(s){s&&T(l)}}}function J0(t){let e,l;return e=new _l({props:{to:"/mqtt-cert",$$slots:{default:[x0]},$$scope:{ctx:t}}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i[0]&4|i[4]&32&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function $0(t){let e,l,n,i,s,a,r;return l=new _l({props:{to:"/mqtt-cert",$$slots:{default:[ec]},$$scope:{ctx:t}}}),{c(){e=p("span"),Te(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Me(l,e,null),P(f,n,c),P(f,i,c),s=!0,a||(r=[ce(i,"click",t[16]),ce(i,"keypress",t[16])],a=!0)},p(f,c){const _={};c[0]&4|c[4]&32&&(_.$$scope={dirty:c,ctx:f}),l.$set(_)},i(f){s||(Z(l.$$.fragment,f),s=!0)},o(f){ie(l.$$.fragment,f),s=!1},d(f){f&&(T(e),T(n),T(i)),Ne(l),a=!1,Lt(r)}}}function x0(t){var n,i,s,a;let e,l;return e=new Ul({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_crt_upload)??"Upload cert",title:((a=(s=t[2].conf)==null?void 0:s.mqtt)==null?void 0:a.title_crt)??""}}),{c(){Te(e.$$.fragment)},m(r,f){Me(e,r,f),l=!0},p(r,f){var _,m,d,h;const c={};f[0]&4&&(c.text=((m=(_=r[2].conf)==null?void 0:_.mqtt)==null?void 0:m.btn_crt_upload)??"Upload cert"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_crt)??""),e.$set(c)},i(r){l||(Z(e.$$.fragment,r),l=!0)},o(r){ie(e.$$.fragment,r),l=!1},d(r){Ne(e,r)}}}function ec(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.crt_ok)??"Cert OK")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.mqtt)==null?void 0:f.crt_ok)??"Cert OK")+"")&&q(l,e)},d(s){s&&T(l)}}}function tc(t){let e,l;return e=new _l({props:{to:"/mqtt-key",$$slots:{default:[nc]},$$scope:{ctx:t}}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i[0]&4|i[4]&32&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function lc(t){let e,l,n,i,s,a,r;return l=new _l({props:{to:"/mqtt-key",$$slots:{default:[ic]},$$scope:{ctx:t}}}),{c(){e=p("span"),Te(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Me(l,e,null),P(f,n,c),P(f,i,c),s=!0,a||(r=[ce(i,"click",t[17]),ce(i,"keypress",t[17])],a=!0)},p(f,c){const _={};c[0]&4|c[4]&32&&(_.$$scope={dirty:c,ctx:f}),l.$set(_)},i(f){s||(Z(l.$$.fragment,f),s=!0)},o(f){ie(l.$$.fragment,f),s=!1},d(f){f&&(T(e),T(n),T(i)),Ne(l),a=!1,Lt(r)}}}function nc(t){var n,i,s,a;let e,l;return e=new Ul({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_key_upload)??"Upload key",title:((a=(s=t[2].conf)==null?void 0:s.mqtt)==null?void 0:a.title_key)??""}}),{c(){Te(e.$$.fragment)},m(r,f){Me(e,r,f),l=!0},p(r,f){var _,m,d,h;const c={};f[0]&4&&(c.text=((m=(_=r[2].conf)==null?void 0:_.mqtt)==null?void 0:m.btn_key_upload)??"Upload key"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_key)??""),e.$set(c)},i(r){l||(Z(e.$$.fragment,r),l=!0)},o(r){ie(e.$$.fragment,r),l=!1},d(r){Ne(e,r)}}}function ic(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.key_ok)??"Key OK")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.mqtt)==null?void 0:f.key_ok)??"Key OK")+"")&&q(l,e)},d(s){s&&T(l)}}}function xo(t){var Q,ee,ue,ae,x,_e,oe,J,$,ve,ke,D;let e,l,n=(((ue=(ee=(Q=t[2].conf)==null?void 0:Q.mqtt)==null?void 0:ee.domoticz)==null?void 0:ue.title)??"Domoticz")+"",i,s,a,r,f,c,_,m,d=(((_e=(x=(ae=t[2].conf)==null?void 0:ae.mqtt)==null?void 0:x.domoticz)==null?void 0:_e.eidx)??"Electricity IDX")+"",h,b,g,k,w,A,F=((($=(J=(oe=t[2].conf)==null?void 0:oe.mqtt)==null?void 0:J.domoticz)==null?void 0:$.cidx)??"Current IDX")+"",L,M,R,O,H,K,W=(((D=(ke=(ve=t[2].conf)==null?void 0:ve.mqtt)==null?void 0:ke.domoticz)==null?void 0:D.vidx)??"Voltage IDX")+"",N,B,X,G,V,Y,U,z,se,le;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),_=p("div"),m=p("div"),h=C(d),b=p("br"),g=v(),k=p("input"),w=v(),A=p("div"),L=C(F),M=p("br"),R=v(),O=p("input"),H=v(),K=p("div"),N=C(W),B=C(`: L1, L2 & L3 - `),X=p("div"),G=p("input"),V=v(),Y=p("input"),U=v(),z=p("input"),u(l,"class","text-sm"),u(a,"href",cl("MQTT-configuration#domoticz")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","o"),f.value="true",u(k,"name","oe"),u(k,"type","text"),u(k,"class","in-f tr w-full"),u(m,"class","w-1/2"),u(O,"name","oc"),u(O,"type","text"),u(O,"class","in-l tr w-full"),u(A,"class","w-1/2"),u(_,"class","my-1 flex"),u(G,"name","ou1"),u(G,"type","text"),u(G,"class","in-f tr w-1/3"),u(Y,"name","ou2"),u(Y,"type","text"),u(Y,"class","in-m tr w-1/3"),u(z,"name","ou3"),u(z,"type","text"),u(z,"class","in-l tr w-1/3"),u(X,"class","flex"),u(K,"class","my-1"),u(e,"class","cnt")},m(S,I){P(S,e,I),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,_),o(_,m),o(m,h),o(m,b),o(m,g),o(m,k),y(k,t[6].o.e),o(_,w),o(_,A),o(A,L),o(A,M),o(A,R),o(A,O),y(O,t[6].o.c),o(e,H),o(e,K),o(K,N),o(K,B),o(K,X),o(X,G),y(G,t[6].o.u1),o(X,V),o(X,Y),y(Y,t[6].o.u2),o(X,U),o(X,z),y(z,t[6].o.u3),se||(le=[ce(k,"input",t[75]),ce(O,"input",t[76]),ce(G,"input",t[77]),ce(Y,"input",t[78]),ce(z,"input",t[79])],se=!0)},p(S,I){var E,j,ne,fe,me,he,pe,Se,we,Le,qe,Re;I[0]&4&&n!==(n=(((ne=(j=(E=S[2].conf)==null?void 0:E.mqtt)==null?void 0:j.domoticz)==null?void 0:ne.title)??"Domoticz")+"")&&q(i,n),I[0]&4&&d!==(d=(((he=(me=(fe=S[2].conf)==null?void 0:fe.mqtt)==null?void 0:me.domoticz)==null?void 0:he.eidx)??"Electricity IDX")+"")&&q(h,d),I[0]&64&&k.value!==S[6].o.e&&y(k,S[6].o.e),I[0]&4&&F!==(F=(((we=(Se=(pe=S[2].conf)==null?void 0:pe.mqtt)==null?void 0:Se.domoticz)==null?void 0:we.cidx)??"Current IDX")+"")&&q(L,F),I[0]&64&&O.value!==S[6].o.c&&y(O,S[6].o.c),I[0]&4&&W!==(W=(((Re=(qe=(Le=S[2].conf)==null?void 0:Le.mqtt)==null?void 0:qe.domoticz)==null?void 0:Re.vidx)??"Voltage IDX")+"")&&q(N,W),I[0]&64&&G.value!==S[6].o.u1&&y(G,S[6].o.u1),I[0]&64&&Y.value!==S[6].o.u2&&y(Y,S[6].o.u2),I[0]&64&&z.value!==S[6].o.u3&&y(z,S[6].o.u3)},d(S){S&&T(e),se=!1,Lt(le)}}}function ea(t){var U,z,se,le,Q,ee,ue,ae,x,_e,oe,J;let e,l,n=(((se=(z=(U=t[2].conf)==null?void 0:U.mqtt)==null?void 0:z.ha)==null?void 0:se.title)??"Home-Assistant")+"",i,s,a,r,f,c,_,m=(((ee=(Q=(le=t[2].conf)==null?void 0:le.mqtt)==null?void 0:Q.ha)==null?void 0:ee.discovery)??"Discovery topic prefix")+"",d,h,b,g,k,w,A=(((x=(ae=(ue=t[2].conf)==null?void 0:ue.mqtt)==null?void 0:ae.ha)==null?void 0:x.hostname)??"Hostname for URL")+"",F,L,M,R,O,H,K,W=(((J=(oe=(_e=t[2].conf)==null?void 0:_e.mqtt)==null?void 0:oe.ha)==null?void 0:J.tag)??"Name tag")+"",N,B,X,G,V,Y;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),_=p("div"),d=C(m),h=p("br"),b=v(),g=p("input"),k=v(),w=p("div"),F=C(A),L=p("br"),M=v(),R=p("input"),H=v(),K=p("div"),N=C(W),B=p("br"),X=v(),G=p("input"),u(l,"class","text-sm"),u(a,"href",cl("MQTT-configuration#home-assistant")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","h"),f.value="true",u(g,"name","ht"),u(g,"type","text"),u(g,"class","in-s"),u(g,"placeholder","homeassistant"),u(_,"class","my-1"),u(R,"name","hh"),u(R,"type","text"),u(R,"class","in-s"),u(R,"placeholder",O=t[6].g.h+".local"),u(w,"class","my-1"),u(G,"name","hn"),u(G,"type","text"),u(G,"class","in-s"),u(K,"class","my-1"),u(e,"class","cnt")},m($,ve){P($,e,ve),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,_),o(_,d),o(_,h),o(_,b),o(_,g),y(g,t[6].h.t),o(e,k),o(e,w),o(w,F),o(w,L),o(w,M),o(w,R),y(R,t[6].h.h),o(e,H),o(e,K),o(K,N),o(K,B),o(K,X),o(K,G),y(G,t[6].h.n),V||(Y=[ce(g,"input",t[80]),ce(R,"input",t[81]),ce(G,"input",t[82])],V=!0)},p($,ve){var ke,D,S,I,E,j,ne,fe,me,he,pe,Se;ve[0]&4&&n!==(n=(((S=(D=(ke=$[2].conf)==null?void 0:ke.mqtt)==null?void 0:D.ha)==null?void 0:S.title)??"Home-Assistant")+"")&&q(i,n),ve[0]&4&&m!==(m=(((j=(E=(I=$[2].conf)==null?void 0:I.mqtt)==null?void 0:E.ha)==null?void 0:j.discovery)??"Discovery topic prefix")+"")&&q(d,m),ve[0]&64&&g.value!==$[6].h.t&&y(g,$[6].h.t),ve[0]&4&&A!==(A=(((me=(fe=(ne=$[2].conf)==null?void 0:ne.mqtt)==null?void 0:fe.ha)==null?void 0:me.hostname)??"Hostname for URL")+"")&&q(F,A),ve[0]&64&&O!==(O=$[6].g.h+".local")&&u(R,"placeholder",O),ve[0]&64&&R.value!==$[6].h.h&&y(R,$[6].h.h),ve[0]&4&&W!==(W=(((Se=(pe=(he=$[2].conf)==null?void 0:he.mqtt)==null?void 0:pe.ha)==null?void 0:Se.tag)??"Name tag")+"")&&q(N,W),ve[0]&64&&G.value!==$[6].h.n&&y(G,$[6].h.n)},d($){$&&T(e),V=!1,Lt(Y)}}}function ta(t){var G,V,Y,U,z,se,le,Q;let e,l,n=(((V=(G=t[2].conf)==null?void 0:G.cloud)==null?void 0:V.title)??"Cloud connections")+"",i,s,a,r,f,c,_,m,d,h,b=(((U=(Y=t[2].conf)==null?void 0:Y.cloud)==null?void 0:U.ams)??"AMS reader cloud")+"",g,k,w,A,F,L,M,R=(((se=(z=t[2].conf)==null?void 0:z.cloud)==null?void 0:se.es)??"Energy Speedometer")+"",O,H,K,W,N,B=t[6].c.e&&la(t),X=((Q=(le=t[6])==null?void 0:le.c)==null?void 0:Q.es)&&sa(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),_=p("div"),m=p("label"),d=p("input"),h=v(),g=C(b),k=v(),B&&B.c(),w=v(),A=p("div"),F=p("label"),L=p("input"),M=v(),O=C(R),H=v(),X&&X.c(),u(l,"class","text-sm"),u(a,"href",cl("Cloud")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","c"),f.value="true",u(d,"type","checkbox"),u(d,"name","ce"),d.__value="true",y(d,d.__value),u(d,"class","rounded mb-1"),u(_,"class","my-1"),u(L,"type","checkbox"),u(L,"class","rounded mb-1"),u(L,"name","ces"),L.__value="true",y(L,L.__value),u(A,"class","my-1"),u(e,"class","cnt")},m(ee,ue){P(ee,e,ue),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,_),o(_,m),o(m,d),d.checked=t[6].c.e,o(m,h),o(m,g),o(_,k),B&&B.m(_,null),o(e,w),o(e,A),o(A,F),o(F,L),L.checked=t[6].c.es,o(F,M),o(F,O),o(A,H),X&&X.m(A,null),K=!0,W||(N=[ce(d,"change",t[83]),ce(L,"change",t[85])],W=!0)},p(ee,ue){var ae,x,_e,oe,J,$,ve,ke;(!K||ue[0]&4)&&n!==(n=(((x=(ae=ee[2].conf)==null?void 0:ae.cloud)==null?void 0:x.title)??"Cloud connections")+"")&&q(i,n),ue[0]&64&&(d.checked=ee[6].c.e),(!K||ue[0]&4)&&b!==(b=(((oe=(_e=ee[2].conf)==null?void 0:_e.cloud)==null?void 0:oe.ams)??"AMS reader cloud")+"")&&q(g,b),ee[6].c.e?B?B.p(ee,ue):(B=la(ee),B.c(),B.m(_,null)):B&&(B.d(1),B=null),ue[0]&64&&(L.checked=ee[6].c.es),(!K||ue[0]&4)&&R!==(R=((($=(J=ee[2].conf)==null?void 0:J.cloud)==null?void 0:$.es)??"Energy Speedometer")+"")&&q(O,R),(ke=(ve=ee[6])==null?void 0:ve.c)!=null&&ke.es?X?(X.p(ee,ue),ue[0]&64&&Z(X,1)):(X=sa(ee),X.c(),Z(X,1),X.m(A,null)):X&&(ht(),ie(X,1,1,()=>{X=null}),vt())},i(ee){K||(Z(X),K=!0)},o(ee){ie(X),K=!1},d(ee){ee&&T(e),B&&B.d(),X&&X.d(),W=!1,Lt(N)}}}function la(t){let e,l,n,i,s,a,r,f,c,_,m=t[6].c.p==0&&na(),d=t[5]&&ia(t);return{c(){e=p("div"),l=p("label"),l.textContent="Protocol",n=v(),i=p("select"),m&&m.c(),s=p("option"),s.textContent="TCP",a=p("option"),a.textContent="HTTP",r=v(),d&&d.c(),f=Vt(),u(l,"for","cp"),s.__value=1,y(s,s.__value),a.__value=2,y(a,a.__value),u(i,"name","cp"),u(i,"class","in-s"),t[6].c.p===void 0&&At(()=>t[84].call(i)),u(e,"class","ml-6")},m(h,b){P(h,e,b),o(e,l),o(e,n),o(e,i),m&&m.m(i,null),o(i,s),o(i,a),Xe(i,t[6].c.p,!0),P(h,r,b),d&&d.m(h,b),P(h,f,b),c||(_=ce(i,"change",t[84]),c=!0)},p(h,b){h[6].c.p==0?m||(m=na(),m.c(),m.m(i,s)):m&&(m.d(1),m=null),b[0]&64&&Xe(i,h[6].c.p),h[5]?d?d.p(h,b):(d=ia(h),d.c(),d.m(f.parentNode,f)):d&&(d.d(1),d=null)},d(h){h&&(T(e),T(r),T(f)),m&&m.d(),d&&d.d(h),c=!1,_()}}}function na(t){let e;return{c(){e=p("option"),e.textContent="UDP",e.__value=0,y(e,e.__value),u(e,"title","No longer recommended")},m(l,n){P(l,e,n)},d(l){l&&T(e)}}}function ia(t){let e,l,n;return{c(){e=p("button"),e.textContent="Connect device to my cloud account",u(e,"type","button"),u(e,"class","text-blue-500 ml-6")},m(i,s){P(i,e,s),l||(n=ce(e,"click",t[20]),l=!0)},p:Ve,d(i){i&&T(e),l=!1,n()}}}function sa(t){let e,l,n=t[0].mac+"",i,s,a,r,f=(t[0].meter.id?t[0].meter.id:"missing, required")+"",c,_,m,d,h=t[0].mac&&t[0].meter.id&&oa(t);return{c(){e=p("div"),l=C("MAC: "),i=C(n),s=v(),a=p("div"),r=C("Meter ID: "),c=C(f),_=v(),h&&h.c(),m=Vt(),u(e,"class","pl-5"),u(a,"class","pl-5")},m(b,g){P(b,e,g),o(e,l),o(e,i),P(b,s,g),P(b,a,g),o(a,r),o(a,c),P(b,_,g),h&&h.m(b,g),P(b,m,g),d=!0},p(b,g){(!d||g[0]&1)&&n!==(n=b[0].mac+"")&&q(i,n),(!d||g[0]&1)&&f!==(f=(b[0].meter.id?b[0].meter.id:"missing, required")+"")&&q(c,f),b[0].mac&&b[0].meter.id?h?(h.p(b,g),g[0]&1&&Z(h,1)):(h=oa(b),h.c(),Z(h,1),h.m(m.parentNode,m)):h&&(ht(),ie(h,1,1,()=>{h=null}),vt())},i(b){d||(Z(h),d=!0)},o(b){ie(h),d=!1},d(b){b&&(T(e),T(s),T(a),T(_),T(m)),h&&h.d(b)}}}function oa(t){let e,l,n;return l=new j0({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","pl-2")},m(i,s){P(i,e,s),Me(l,e,null),n=!0},p(i,s){const a={};s[0]&1&&(a.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(a)},i(i){n||(Z(l.$$.fragment,i),n=!0)},o(i){ie(l.$$.fragment,i),n=!1},d(i){i&&T(e),Ne(l)}}}function aa(t){var W,N,B,X,G;let e,l,n=(((N=(W=t[2].conf)==null?void 0:W.thresholds)==null?void 0:N.title)??"Thresholds")+"",i,s,a,r,f,c,_,m,d,h,b=(((X=(B=t[2].conf)==null?void 0:B.thresholds)==null?void 0:X.avg)??"Average of")+"",g,k,w,A,F,L=(((G=t[2].common)==null?void 0:G.hours)??"hours")+"",M,R,O,H=gt({length:9}),K=[];for(let V=0;Vt[89].call(k)),u(d,"class","w-1/2"),u(_,"class","flex flex-wrap"),u(e,"class","cnt")},m(N,B){P(N,e,B),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,_);for(let X=0;X20&&ma(t),d=((A=(w=(k=t[6])==null?void 0:k.i)==null?void 0:w.d)==null?void 0:A.d)>0&&ha(t),h=t[0].chip=="esp8266"&&va(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),m&&m.c(),f=v(),d&&d.c(),c=v(),h&&h.c(),u(l,"class","text-sm"),u(a,"href",cl("GPIO-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(e,"class","cnt")},m(F,L){P(F,e,L),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),m&&m.m(e,null),o(e,f),d&&d.m(e,null),o(e,c),h&&h.m(e,null),_=!0},p(F,L){var M,R,O,H,K;(!_||L[0]&4)&&n!==(n=(((R=(M=F[2].conf)==null?void 0:M.hw)==null?void 0:R.title)??"Hardware")+"")&&q(i,n),F[0].board>20?m?(m.p(F,L),L[0]&1&&Z(m,1)):(m=ma(F),m.c(),Z(m,1),m.m(e,f)):m&&(ht(),ie(m,1,1,()=>{m=null}),vt()),((K=(H=(O=F[6])==null?void 0:O.i)==null?void 0:H.d)==null?void 0:K.d)>0?d?d.p(F,L):(d=ha(F),d.c(),d.m(e,c)):d&&(d.d(1),d=null),F[0].chip=="esp8266"?h?h.p(F,L):(h=va(F),h.c(),h.m(e,null)):h&&(h.d(1),h=null)},i(F){_||(Z(m),_=!0)},o(F){ie(m),_=!1},d(F){F&&T(e),m&&m.d(),d&&d.d(),h&&h.d()}}}function ma(t){var qt,jt,Pt,pt,Ht,Kt,Rt,zt,Yt,el,Jt,$t,ye,ft,at,Dt,Ot,dt,Be,We,ct,be,nt,Pe,kt,Wt,Qt,xt,Ft,tl,ll,il,Ie;let e,l,n,i,s=(((Pt=(jt=(qt=t[2].conf)==null?void 0:qt.hw)==null?void 0:jt.han)==null?void 0:Pt.rx)??"HAN RX")+"",a,r,f,c,_,m,d,h=(((Kt=(Ht=(pt=t[2].conf)==null?void 0:pt.hw)==null?void 0:Ht.han)==null?void 0:Kt.tx)??"HAN TX")+"",b,g,k,w,A,F,L,M,R,O,H=(((Yt=(zt=(Rt=t[2].conf)==null?void 0:Rt.hw)==null?void 0:zt.han)==null?void 0:Yt.pullup)??"pullup")+"",K,W,N,B,X=(((Jt=(el=t[2].conf)==null?void 0:el.hw)==null?void 0:Jt.ap_btn)??"AP button")+"",G,V,Y,U,z,se,le=(((ft=(ye=($t=t[2].conf)==null?void 0:$t.hw)==null?void 0:ye.led)==null?void 0:ft.title)??"LED")+"",Q,ee,ue,ae,x,_e,oe,J,$,ve,ke=(((Ot=(Dt=(at=t[2].conf)==null?void 0:at.hw)==null?void 0:Dt.led)==null?void 0:Ot.inverted)??"inverted")+"",D,S,I,E=(((We=(Be=(dt=t[2].conf)==null?void 0:dt.hw)==null?void 0:Be.led)==null?void 0:We.rgb)??"RGB")+"",j,ne,fe,me,he=(((nt=(be=(ct=t[2].conf)==null?void 0:ct.hw)==null?void 0:be.led)==null?void 0:nt.inverted)??"inverted")+"",pe,Se,we,Le,qe,Re,re,Ce,Ue,it,_t,et,tt=(((Wt=(kt=(Pe=t[2].conf)==null?void 0:Pe.hw)==null?void 0:kt.led)==null?void 0:Wt.disable)??"LED dis. GPIO")+"",lt,ot,Ze,bt,st,Tt=(((xt=(Qt=t[2].conf)==null?void 0:Qt.hw)==null?void 0:xt.temp)??"Temperature")+"",Oe,De,He,ze,de,Ee,Ge=(((tl=(Ft=t[2].conf)==null?void 0:Ft.hw)==null?void 0:tl.temp_analog)??"Analog temp")+"",ge,Ae,Je,Qe,It,$e,Fe,wt,ut;_=new Si({props:{chip:t[0].chip}}),A=new Si({props:{chip:t[0].chip}});let rt=t[0].chip!="esp8266"&&pa(t),mt=((Ie=(il=(ll=t[6])==null?void 0:ll.i)==null?void 0:il.v)==null?void 0:Ie.p)>0&&da(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=C(s),r=p("br"),f=v(),c=p("select"),Te(_.$$.fragment),m=v(),d=p("div"),b=C(h),g=p("br"),k=v(),w=p("select"),Te(A.$$.fragment),F=v(),L=p("div"),M=p("label"),R=p("input"),O=v(),K=C(H),W=v(),N=p("div"),B=p("div"),G=C(X),V=p("br"),Y=v(),U=p("input"),z=v(),se=p("div"),Q=C(le),ee=p("br"),ue=v(),ae=p("div"),x=p("input"),_e=v(),oe=p("div"),J=p("label"),$=p("input"),ve=v(),D=C(ke),S=v(),I=p("div"),j=C(E),ne=p("label"),fe=p("input"),me=v(),pe=C(he),Se=p("br"),we=v(),Le=p("div"),qe=p("input"),Re=v(),re=p("input"),Ce=v(),Ue=p("input"),it=v(),_t=p("div"),et=p("div"),lt=C(tt),ot=v(),Ze=p("input"),bt=v(),st=p("div"),Oe=C(Tt),De=p("br"),He=v(),ze=p("input"),de=v(),Ee=p("div"),ge=C(Ge),Ae=p("br"),Je=v(),Qe=p("input"),It=v(),rt&&rt.c(),$e=v(),mt&&mt.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(c,"name","ihp"),u(c,"class","in-f w-full"),t[6].i.h.p===void 0&&At(()=>t[90].call(c)),u(i,"class","w-1/3"),u(w,"name","iht"),u(w,"class","in-l w-full"),t[6].i.h.t===void 0&&At(()=>t[91].call(w)),u(d,"class","w-1/3"),u(R,"name","ihu"),R.__value="true",y(R,R.__value),u(R,"type","checkbox"),u(R,"class","rounded mb-1"),u(M,"class","ml-2"),u(L,"class","w-1/3"),u(n,"class","flex flex-wrap"),u(U,"name","ia"),u(U,"type","number"),u(U,"min","0"),u(U,"max",t[10]),u(U,"class","in-f tr w-full"),u(B,"class","w-1/3"),u(x,"name","ilp"),u(x,"type","number"),u(x,"min","0"),u(x,"max",t[10]),u(x,"class","in-l tr w-full"),u(ae,"class","flex"),u(se,"class","w-1/3"),u($,"name","ili"),$.__value="true",y($,$.__value),u($,"type","checkbox"),u($,"class","rounded mb-1"),u(J,"class","ml-4"),u(oe,"class","w-1/3"),u(fe,"name","iri"),fe.__value="true",y(fe,fe.__value),u(fe,"type","checkbox"),u(fe,"class","rounded mb-1"),u(ne,"class","ml-4"),u(qe,"name","irr"),u(qe,"type","number"),u(qe,"min","0"),u(qe,"max",t[10]),u(qe,"class","in-f tr w-1/3"),u(re,"name","irg"),u(re,"type","number"),u(re,"min","0"),u(re,"max",t[10]),u(re,"class","in-m tr w-1/3"),u(Ue,"name","irb"),u(Ue,"type","number"),u(Ue,"min","0"),u(Ue,"max",t[10]),u(Ue,"class","in-l tr w-1/3"),u(Le,"class","flex"),u(I,"class","w-full"),u(Ze,"name","idd"),u(Ze,"type","number"),u(Ze,"min","0"),u(Ze,"max",t[10]),u(Ze,"class","in-s tr"),u(et,"class","my-1 pr-1 w-1/3"),u(_t,"class","w-full"),u(ze,"name","itd"),u(ze,"type","number"),u(ze,"min","0"),u(ze,"max",t[10]),u(ze,"class","in-f tr w-full"),u(st,"class","my-1 w-1/3"),u(Qe,"name","ita"),u(Qe,"type","number"),u(Qe,"min","0"),u(Qe,"max",t[10]),u(Qe,"class","in-l tr w-full"),u(Ee,"class","my-1 pr-1 w-1/3"),u(N,"class","flex flex-wrap")},m(te,je){P(te,e,je),P(te,l,je),P(te,n,je),o(n,i),o(i,a),o(i,r),o(i,f),o(i,c),Me(_,c,null),Xe(c,t[6].i.h.p,!0),o(n,m),o(n,d),o(d,b),o(d,g),o(d,k),o(d,w),Me(A,w,null),Xe(w,t[6].i.h.t,!0),o(n,F),o(n,L),o(L,M),o(M,R),R.checked=t[6].i.h.u,o(M,O),o(M,K),P(te,W,je),P(te,N,je),o(N,B),o(B,G),o(B,V),o(B,Y),o(B,U),y(U,t[6].i.a),o(N,z),o(N,se),o(se,Q),o(se,ee),o(se,ue),o(se,ae),o(ae,x),y(x,t[6].i.l.p),o(N,_e),o(N,oe),o(oe,J),o(J,$),$.checked=t[6].i.l.i,o(J,ve),o(J,D),o(N,S),o(N,I),o(I,j),o(I,ne),o(ne,fe),fe.checked=t[6].i.r.i,o(ne,me),o(ne,pe),o(I,Se),o(I,we),o(I,Le),o(Le,qe),y(qe,t[6].i.r.r),o(Le,Re),o(Le,re),y(re,t[6].i.r.g),o(Le,Ce),o(Le,Ue),y(Ue,t[6].i.r.b),o(N,it),o(N,_t),o(_t,et),o(et,lt),o(et,ot),o(et,Ze),y(Ze,t[6].i.d.d),o(N,bt),o(N,st),o(st,Oe),o(st,De),o(st,He),o(st,ze),y(ze,t[6].i.t.d),o(N,de),o(N,Ee),o(Ee,ge),o(Ee,Ae),o(Ee,Je),o(Ee,Qe),y(Qe,t[6].i.t.a),o(N,It),rt&&rt.m(N,null),o(N,$e),mt&&mt.m(N,null),Fe=!0,wt||(ut=[ce(c,"change",t[90]),ce(w,"change",t[91]),ce(R,"change",t[92]),ce(U,"input",t[93]),ce(x,"input",t[94]),ce($,"change",t[95]),ce(fe,"change",t[96]),ce(qe,"input",t[97]),ce(re,"input",t[98]),ce(Ue,"input",t[99]),ce(Ze,"input",t[100]),ce(ze,"input",t[101]),ce(Qe,"input",t[102])],wt=!0)},p(te,je){var vl,bl,gl,kl,wl,Cl,Sl,$l,xl,en,tn,xe,Bt,rl,ln,nn,sn,on,an,fn,un,rn,cn,_n,mn,pn,dn,hn,vn,bn,gn,kn,wn;(!Fe||je[0]&4)&&s!==(s=(((gl=(bl=(vl=te[2].conf)==null?void 0:vl.hw)==null?void 0:bl.han)==null?void 0:gl.rx)??"HAN RX")+"")&&q(a,s);const fl={};je[0]&1&&(fl.chip=te[0].chip),_.$set(fl),je[0]&64&&Xe(c,te[6].i.h.p),(!Fe||je[0]&4)&&h!==(h=(((Cl=(wl=(kl=te[2].conf)==null?void 0:kl.hw)==null?void 0:wl.han)==null?void 0:Cl.tx)??"HAN TX")+"")&&q(b,h);const ul={};je[0]&1&&(ul.chip=te[0].chip),A.$set(ul),je[0]&64&&Xe(w,te[6].i.h.t),je[0]&64&&(R.checked=te[6].i.h.u),(!Fe||je[0]&4)&&H!==(H=(((xl=($l=(Sl=te[2].conf)==null?void 0:Sl.hw)==null?void 0:$l.han)==null?void 0:xl.pullup)??"pullup")+"")&&q(K,H),(!Fe||je[0]&4)&&X!==(X=(((tn=(en=te[2].conf)==null?void 0:en.hw)==null?void 0:tn.ap_btn)??"AP button")+"")&&q(G,X),(!Fe||je[0]&1024)&&u(U,"max",te[10]),je[0]&64&&Ke(U.value)!==te[6].i.a&&y(U,te[6].i.a),(!Fe||je[0]&4)&&le!==(le=(((rl=(Bt=(xe=te[2].conf)==null?void 0:xe.hw)==null?void 0:Bt.led)==null?void 0:rl.title)??"LED")+"")&&q(Q,le),(!Fe||je[0]&1024)&&u(x,"max",te[10]),je[0]&64&&Ke(x.value)!==te[6].i.l.p&&y(x,te[6].i.l.p),je[0]&64&&($.checked=te[6].i.l.i),(!Fe||je[0]&4)&&ke!==(ke=(((sn=(nn=(ln=te[2].conf)==null?void 0:ln.hw)==null?void 0:nn.led)==null?void 0:sn.inverted)??"inverted")+"")&&q(D,ke),(!Fe||je[0]&4)&&E!==(E=(((fn=(an=(on=te[2].conf)==null?void 0:on.hw)==null?void 0:an.led)==null?void 0:fn.rgb)??"RGB")+"")&&q(j,E),je[0]&64&&(fe.checked=te[6].i.r.i),(!Fe||je[0]&4)&&he!==(he=(((cn=(rn=(un=te[2].conf)==null?void 0:un.hw)==null?void 0:rn.led)==null?void 0:cn.inverted)??"inverted")+"")&&q(pe,he),(!Fe||je[0]&1024)&&u(qe,"max",te[10]),je[0]&64&&Ke(qe.value)!==te[6].i.r.r&&y(qe,te[6].i.r.r),(!Fe||je[0]&1024)&&u(re,"max",te[10]),je[0]&64&&Ke(re.value)!==te[6].i.r.g&&y(re,te[6].i.r.g),(!Fe||je[0]&1024)&&u(Ue,"max",te[10]),je[0]&64&&Ke(Ue.value)!==te[6].i.r.b&&y(Ue,te[6].i.r.b),(!Fe||je[0]&4)&&tt!==(tt=(((pn=(mn=(_n=te[2].conf)==null?void 0:_n.hw)==null?void 0:mn.led)==null?void 0:pn.disable)??"LED dis. GPIO")+"")&&q(lt,tt),(!Fe||je[0]&1024)&&u(Ze,"max",te[10]),je[0]&64&&Ke(Ze.value)!==te[6].i.d.d&&y(Ze,te[6].i.d.d),(!Fe||je[0]&4)&&Tt!==(Tt=(((hn=(dn=te[2].conf)==null?void 0:dn.hw)==null?void 0:hn.temp)??"Temperature")+"")&&q(Oe,Tt),(!Fe||je[0]&1024)&&u(ze,"max",te[10]),je[0]&64&&Ke(ze.value)!==te[6].i.t.d&&y(ze,te[6].i.t.d),(!Fe||je[0]&4)&&Ge!==(Ge=(((bn=(vn=te[2].conf)==null?void 0:vn.hw)==null?void 0:bn.temp_analog)??"Analog temp")+"")&&q(ge,Ge),(!Fe||je[0]&1024)&&u(Qe,"max",te[10]),je[0]&64&&Ke(Qe.value)!==te[6].i.t.a&&y(Qe,te[6].i.t.a),te[0].chip!="esp8266"?rt?rt.p(te,je):(rt=pa(te),rt.c(),rt.m(N,$e)):rt&&(rt.d(1),rt=null),((wn=(kn=(gn=te[6])==null?void 0:gn.i)==null?void 0:kn.v)==null?void 0:wn.p)>0?mt?mt.p(te,je):(mt=da(te),mt.c(),mt.m(N,null)):mt&&(mt.d(1),mt=null)},i(te){Fe||(Z(_.$$.fragment,te),Z(A.$$.fragment,te),Fe=!0)},o(te){ie(_.$$.fragment,te),ie(A.$$.fragment,te),Fe=!1},d(te){te&&(T(e),T(l),T(n),T(W),T(N)),Ne(_),Ne(A),rt&&rt.d(),mt&&mt.d(),wt=!1,Lt(ut)}}}function pa(t){var c,_,m;let e,l=(((m=(_=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:_.vcc)==null?void 0:m.title)??"Vcc")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","ivp"),u(a,"type","number"),u(a,"min","0"),u(a,"max",t[10]),u(a,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(d,h){P(d,e,h),o(e,n),o(e,i),o(e,s),o(e,a),y(a,t[6].i.v.p),r||(f=ce(a,"input",t[103]),r=!0)},p(d,h){var b,g,k;h[0]&4&&l!==(l=(((k=(g=(b=d[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:k.title)??"Vcc")+"")&&q(n,l),h[0]&1024&&u(a,"max",d[10]),h[0]&64&&Ke(a.value)!==d[6].i.v.p&&y(a,d[6].i.v.p)},d(d){d&&T(e),r=!1,f()}}}function da(t){var b,g,k;let e,l=(((k=(g=(b=t[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:k.divider)??"Voltage divider")+"",n,i,s,a,r,f,c,_,m,d,h;return{c(){var w,A,F,L,M,R;e=p("div"),n=C(l),i=p("br"),s=v(),a=p("div"),r=p("input"),c=v(),_=p("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"placeholder",f=((F=(A=(w=t[2].conf)==null?void 0:w.hw)==null?void 0:A.vcc)==null?void 0:F.div_vcc)??"VCC"),u(_,"name","ivdg"),u(_,"type","number"),u(_,"min","0"),u(_,"max","65535"),u(_,"class","in-l tr w-full"),u(_,"placeholder",m=((R=(M=(L=t[2].conf)==null?void 0:L.hw)==null?void 0:M.vcc)==null?void 0:R.div_gnd)??"GND"),u(a,"class","flex"),u(e,"class","my-1")},m(w,A){P(w,e,A),o(e,n),o(e,i),o(e,s),o(e,a),o(a,r),y(r,t[6].i.v.d.v),o(a,c),o(a,_),y(_,t[6].i.v.d.g),d||(h=[ce(r,"input",t[104]),ce(_,"input",t[105])],d=!0)},p(w,A){var F,L,M,R,O,H,K,W,N;A[0]&4&&l!==(l=(((M=(L=(F=w[2].conf)==null?void 0:F.hw)==null?void 0:L.vcc)==null?void 0:M.divider)??"Voltage divider")+"")&&q(n,l),A[0]&4&&f!==(f=((H=(O=(R=w[2].conf)==null?void 0:R.hw)==null?void 0:O.vcc)==null?void 0:H.div_vcc)??"VCC")&&u(r,"placeholder",f),A[0]&64&&Ke(r.value)!==w[6].i.v.d.v&&y(r,w[6].i.v.d.v),A[0]&4&&m!==(m=((N=(W=(K=w[2].conf)==null?void 0:K.hw)==null?void 0:W.vcc)==null?void 0:N.div_gnd)??"GND")&&u(_,"placeholder",m),A[0]&64&&Ke(_.value)!==w[6].i.v.d.g&&y(_,w[6].i.v.d.g)},d(w){w&&T(e),d=!1,Lt(h)}}}function ha(t){var b,g,k,w,A,F,L,M,R,O,H,K;let e,l=(((w=(k=(g=(b=t[2].conf)==null?void 0:b.hw)==null?void 0:g.led)==null?void 0:k.behaviour)==null?void 0:w.title)??"LED behaviour")+"",n,i,s,a,r=(((M=(L=(F=(A=t[2].conf)==null?void 0:A.hw)==null?void 0:F.led)==null?void 0:L.behaviour)==null?void 0:M.enabled)??"Enabled")+"",f,c,_=(((K=(H=(O=(R=t[2].conf)==null?void 0:R.hw)==null?void 0:O.led)==null?void 0:H.behaviour)==null?void 0:K.disabled)??"Disabled")+"",m,d,h;return{c(){e=p("div"),n=C(l),i=v(),s=p("select"),a=p("option"),f=C(r),c=p("option"),m=C(_),a.__value=0,y(a,a.__value),c.__value=1,y(c,c.__value),u(s,"name","idb"),u(s,"class","in-s"),t[6].i.d.b===void 0&&At(()=>t[106].call(s)),u(e,"class","my-1 w-full")},m(W,N){P(W,e,N),o(e,n),o(e,i),o(e,s),o(s,a),o(a,f),o(s,c),o(c,m),Xe(s,t[6].i.d.b,!0),d||(h=ce(s,"change",t[106]),d=!0)},p(W,N){var B,X,G,V,Y,U,z,se,le,Q,ee,ue;N[0]&4&&l!==(l=(((V=(G=(X=(B=W[2].conf)==null?void 0:B.hw)==null?void 0:X.led)==null?void 0:G.behaviour)==null?void 0:V.title)??"LED behaviour")+"")&&q(n,l),N[0]&4&&r!==(r=(((se=(z=(U=(Y=W[2].conf)==null?void 0:Y.hw)==null?void 0:U.led)==null?void 0:z.behaviour)==null?void 0:se.enabled)??"Enabled")+"")&&q(f,r),N[0]&4&&_!==(_=(((ue=(ee=(Q=(le=W[2].conf)==null?void 0:le.hw)==null?void 0:Q.led)==null?void 0:ee.behaviour)==null?void 0:ue.disabled)??"Disabled")+"")&&q(m,_),N[0]&64&&Xe(s,W[6].i.d.b)},d(W){W&&T(e),d=!1,h()}}}function va(t){var M,R,O,H,K,W;let e,l,n,i,s=(((O=(R=(M=t[2].conf)==null?void 0:M.hw)==null?void 0:R.vcc)==null?void 0:O.offset)??"Vcc offset")+"",a,r,f,c,_,m,d=(((W=(K=(H=t[2].conf)==null?void 0:H.hw)==null?void 0:K.vcc)==null?void 0:W.multiplier)??"Multiplier")+"",h,b,g,k,w,A,F,L=(t[0].board==2||t[0].board==100)&&ba(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=C(s),r=p("br"),f=v(),c=p("input"),_=v(),m=p("div"),h=C(d),b=p("br"),g=v(),k=p("input"),w=v(),L&&L.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(c,"name","ivo"),u(c,"type","number"),u(c,"min","0.0"),u(c,"max","3.5"),u(c,"step","0.01"),u(c,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(k,"name","ivm"),u(k,"type","number"),u(k,"min","0.1"),u(k,"max","10"),u(k,"step","0.01"),u(k,"class","in-l tr w-full"),u(m,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(N,B){P(N,e,B),P(N,l,B),P(N,n,B),o(n,i),o(i,a),o(i,r),o(i,f),o(i,c),y(c,t[6].i.v.o),o(n,_),o(n,m),o(m,h),o(m,b),o(m,g),o(m,k),y(k,t[6].i.v.m),o(n,w),L&&L.m(n,null),A||(F=[ce(c,"input",t[107]),ce(k,"input",t[108])],A=!0)},p(N,B){var X,G,V,Y,U,z;B[0]&4&&s!==(s=(((V=(G=(X=N[2].conf)==null?void 0:X.hw)==null?void 0:G.vcc)==null?void 0:V.offset)??"Vcc offset")+"")&&q(a,s),B[0]&64&&Ke(c.value)!==N[6].i.v.o&&y(c,N[6].i.v.o),B[0]&4&&d!==(d=(((z=(U=(Y=N[2].conf)==null?void 0:Y.hw)==null?void 0:U.vcc)==null?void 0:z.multiplier)??"Multiplier")+"")&&q(h,d),B[0]&64&&Ke(k.value)!==N[6].i.v.m&&y(k,N[6].i.v.m),N[0].board==2||N[0].board==100?L?L.p(N,B):(L=ba(N),L.c(),L.m(n,null)):L&&(L.d(1),L=null)},d(N){N&&(T(e),T(l),T(n)),L&&L.d(),A=!1,Lt(F)}}}function ba(t){var c,_,m;let e,l=(((m=(_=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:_.vcc)==null?void 0:m.boot)??"Boot limit")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","ivb"),u(a,"type","number"),u(a,"min","2.5"),u(a,"max","3.5"),u(a,"step","0.1"),u(a,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(d,h){P(d,e,h),o(e,n),o(e,i),o(e,s),o(e,a),y(a,t[6].i.v.b),r||(f=ce(a,"input",t[109]),r=!0)},p(d,h){var b,g,k;h[0]&4&&l!==(l=(((k=(g=(b=d[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:k.boot)??"Boot limit")+"")&&q(n,l),h[0]&64&&Ke(a.value)!==d[6].i.v.b&&y(a,d[6].i.v.b)},d(d){d&&T(e),r=!1,f()}}}function ga(t){var L,M,R,O,H,K;let e,l,n=(((M=(L=t[2].conf)==null?void 0:L.debug)==null?void 0:M.title)??"Debugging")+"",i,s,a,r,f,c,_,m,d,h,b=(((O=(R=t[2].conf)==null?void 0:R.debug)==null?void 0:O.enable)??"Enable debugging")+"",g,k,w,A,F=((K=(H=t[6])==null?void 0:H.d)==null?void 0:K.s)&&ka(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),_=p("div"),m=p("label"),d=p("input"),h=v(),g=C(b),k=v(),F&&F.c(),u(l,"class","text-sm"),u(a,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","d"),f.value="true",u(d,"type","checkbox"),u(d,"name","ds"),d.__value="true",y(d,d.__value),u(d,"class","rounded mb-1"),u(_,"class","mt-3"),u(e,"class","cnt")},m(W,N){P(W,e,N),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,_),o(_,m),o(m,d),d.checked=t[6].d.s,o(m,h),o(m,g),o(e,k),F&&F.m(e,null),w||(A=ce(d,"change",t[110]),w=!0)},p(W,N){var B,X,G,V,Y,U;N[0]&4&&n!==(n=(((X=(B=W[2].conf)==null?void 0:B.debug)==null?void 0:X.title)??"Debugging")+"")&&q(i,n),N[0]&64&&(d.checked=W[6].d.s),N[0]&4&&b!==(b=(((V=(G=W[2].conf)==null?void 0:G.debug)==null?void 0:V.enable)??"Enable debugging")+"")&&q(g,b),(U=(Y=W[6])==null?void 0:Y.d)!=null&&U.s?F?F.p(W,N):(F=ka(W),F.c(),F.m(e,null)):F&&(F.d(1),F=null)},d(W){W&&T(e),F&&F.d(),w=!1,A()}}}function ka(t){var R,O,H,K;let e,l=(((O=(R=t[2].conf)==null?void 0:R.debug)==null?void 0:O.danger)??"Disable when done")+"",n,i,s,a,r,f,c=(((K=(H=t[2].conf)==null?void 0:H.debug)==null?void 0:K.telnet)??"Enable telnet")+"",_,m,d,h,b,g,k,w,A,F,L,M=t[6].d.t&&wa(t);return{c(){e=p("div"),n=C(l),i=v(),s=p("div"),a=p("label"),r=p("input"),f=v(),_=C(c),m=v(),M&&M.c(),d=v(),h=p("div"),b=p("select"),g=p("option"),g.textContent="Verbose",k=p("option"),k.textContent="Debug",w=p("option"),w.textContent="Info",A=p("option"),A.textContent="Warning",u(e,"class","bd-red"),u(r,"type","checkbox"),u(r,"name","dt"),r.__value="true",y(r,r.__value),u(r,"class","rounded mb-1"),u(s,"class","my-1"),g.__value=1,y(g,g.__value),k.__value=2,y(k,k.__value),w.__value=3,y(w,w.__value),A.__value=4,y(A,A.__value),u(b,"name","dl"),u(b,"class","in-s"),t[6].d.l===void 0&&At(()=>t[112].call(b)),u(h,"class","my-1")},m(W,N){P(W,e,N),o(e,n),P(W,i,N),P(W,s,N),o(s,a),o(a,r),r.checked=t[6].d.t,o(a,f),o(a,_),P(W,m,N),M&&M.m(W,N),P(W,d,N),P(W,h,N),o(h,b),o(b,g),o(b,k),o(b,w),o(b,A),Xe(b,t[6].d.l,!0),F||(L=[ce(r,"change",t[111]),ce(b,"change",t[112])],F=!0)},p(W,N){var B,X,G,V;N[0]&4&&l!==(l=(((X=(B=W[2].conf)==null?void 0:B.debug)==null?void 0:X.danger)??"Disable when done")+"")&&q(n,l),N[0]&64&&(r.checked=W[6].d.t),N[0]&4&&c!==(c=(((V=(G=W[2].conf)==null?void 0:G.debug)==null?void 0:V.telnet)??"Enable telnet")+"")&&q(_,c),W[6].d.t?M?M.p(W,N):(M=wa(W),M.c(),M.m(d.parentNode,d)):M&&(M.d(1),M=null),N[0]&64&&Xe(b,W[6].d.l)},d(W){W&&(T(e),T(i),T(s),T(m),T(d),T(h)),M&&M.d(W),F=!1,Lt(L)}}}function wa(t){var i,s;let e,l=(((s=(i=t[2].conf)==null?void 0:i.debug)==null?void 0:s.telnet_danger)??"Disable when done")+"",n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.debug)==null?void 0:c.telnet_danger)??"Disable when done")+"")&&q(n,l)},d(a){a&&T(e)}}}function Ca(t){var d,h;let e,l,n=(((d=t[2].conf)==null?void 0:d.btn_reset)??"Factory reset")+"",i,s,a,r,f=(((h=t[2].btn)==null?void 0:h.reboot)??"Reboot")+"",c,_,m;return{c(){e=p("div"),l=p("button"),i=C(n),s=v(),a=p("div"),r=p("button"),c=C(f),u(l,"type","button"),u(l,"class","btn-red"),u(r,"type","button"),u(r,"class","btn-yellow"),u(a,"class","text-center")},m(b,g){P(b,e,g),o(e,l),o(l,i),P(b,s,g),P(b,a,g),o(a,r),o(r,c),_||(m=[ce(l,"click",t[12]),ce(r,"click",t[14])],_=!0)},p(b,g){var k,w;g[0]&4&&n!==(n=(((k=b[2].conf)==null?void 0:k.btn_reset)??"Factory reset")+"")&&q(i,n),g[0]&4&&f!==(f=(((w=b[2].btn)==null?void 0:w.reboot)??"Reboot")+"")&&q(c,f)},d(b){b&&(T(e),T(s),T(a)),_=!1,Lt(m)}}}function Sa(t){var s;let e,l,n=(((s=t[2].btn)==null?void 0:s.save)??"Save")+"",i;return{c(){e=p("div"),l=p("button"),i=C(n),u(l,"type","submit"),u(l,"class","btn-pri"),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,l),o(l,i)},p(a,r){var f;r[0]&4&&n!==(n=(((f=a[2].btn)==null?void 0:f.save)??"Save")+"")&&q(i,n)},d(a){a&&T(e)}}}function sc(t){var J,$,ve,ke,D,S,I,E,j,ne,fe,me,he,pe,Se,we,Le,qe,Re,re,Ce,Ue,it,_t,et,tt,lt,ot,Ze,bt,st,Tt,Oe,De,He,ze,de,Ee,Ge;let e,l,n,i,s,a,r,f,c,_,m=((ve=($=(J=t[6])==null?void 0:J.p)==null?void 0:$.r)==null?void 0:ve.startsWith("NO"))||((S=(D=(ke=t[6])==null?void 0:ke.p)==null?void 0:D.r)==null?void 0:S.startsWith("10YNO"))||((j=(E=(I=t[6])==null?void 0:I.p)==null?void 0:E.r)==null?void 0:j.startsWith("10Y1001A1001A4")),d,h,b,g=((ne=t[6])==null?void 0:ne.d)&&((me=(fe=t[0])==null?void 0:fe.features)==null?void 0:me.includes("rdebug")),k,w,A,F,L,M,R,O,H,K,W,N,B,X,G=((he=t[6])==null?void 0:he.g)&&Fo(t),V=((pe=t[6])==null?void 0:pe.m)&&Ho(t),Y=((Se=t[6])==null?void 0:Se.w)&&Vo(t),U=((we=t[6])==null?void 0:we.n)&&Qo(t),z=((Le=t[6])==null?void 0:Le.q)&&Zo(t),se=((Re=(qe=t[6])==null?void 0:qe.q)==null?void 0:Re.m)==3&&xo(t),le=((Ce=(re=t[6])==null?void 0:re.q)==null?void 0:Ce.m)==4&&ea(t),Q=((Ue=t[6])==null?void 0:Ue.c)&&ta(t),ee=m&&aa(t),ue=((it=t[6])==null?void 0:it.u)&&ua(t),ae=((et=(_t=t[6])==null?void 0:_t.i)==null?void 0:et.h)&&(((tt=t[0])==null?void 0:tt.board)>20||((lt=t[0])==null?void 0:lt.chip)=="esp8266"||((bt=(Ze=(ot=t[6])==null?void 0:ot.i)==null?void 0:Ze.d)==null?void 0:bt.d)>0)&&_a(t),x=g&&ga(t),_e=((st=t[1])==null?void 0:st.a)&&Ca(t),oe=t[6]&&Sa(t);return L=new sl({props:{active:t[3],message:((Oe=(Tt=t[2].conf)==null?void 0:Tt.mask)==null?void 0:Oe.loading)??"Loading"}}),R=new sl({props:{active:t[4],message:((He=(De=t[2].conf)==null?void 0:De.mask)==null?void 0:He.saving)??"Saving"}}),H=new sl({props:{active:t[8],message:((de=(ze=t[2].conf)==null?void 0:ze.mask)==null?void 0:de.reset)??"Factory reset"}}),W=new sl({props:{active:t[9],message:((Ge=(Ee=t[2].conf)==null?void 0:Ee.mask)==null?void 0:Ge.reset_done)??"Done"}}),{c(){e=p("form"),l=p("div"),G&&G.c(),n=v(),V&&V.c(),i=v(),Y&&Y.c(),s=v(),U&&U.c(),a=v(),z&&z.c(),r=v(),se&&se.c(),f=v(),le&&le.c(),c=v(),Q&&Q.c(),_=v(),ee&&ee.c(),d=v(),ue&&ue.c(),h=v(),ae&&ae.c(),b=v(),x&&x.c(),k=v(),w=p("div"),_e&&_e.c(),A=v(),oe&&oe.c(),F=v(),Te(L.$$.fragment),M=v(),Te(R.$$.fragment),O=v(),Te(H.$$.fragment),K=v(),Te(W.$$.fragment),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(w,"class","grid grid-cols-3 mt-3"),u(e,"autocomplete","off")},m(ge,Ae){P(ge,e,Ae),o(e,l),G&&G.m(l,null),o(l,n),V&&V.m(l,null),o(l,i),Y&&Y.m(l,null),o(l,s),U&&U.m(l,null),o(l,a),z&&z.m(l,null),o(l,r),se&&se.m(l,null),o(l,f),le&&le.m(l,null),o(l,c),Q&&Q.m(l,null),o(l,_),ee&&ee.m(l,null),o(l,d),ue&&ue.m(l,null),o(l,h),ae&&ae.m(l,null),o(l,b),x&&x.m(l,null),o(e,k),o(e,w),_e&&_e.m(w,null),o(w,A),oe&&oe.m(w,null),P(ge,F,Ae),Me(L,ge,Ae),P(ge,M,Ae),Me(R,ge,Ae),P(ge,O,Ae),Me(H,ge,Ae),P(ge,K,Ae),Me(W,ge,Ae),N=!0,B||(X=ce(e,"submit",zl(t[13])),B=!0)},p(ge,Ae){var Fe,wt,ut,rt,mt,qt,jt,Pt,pt,Ht,Kt,Rt,zt,Yt,el,Jt,$t,ye,ft,at,Dt,Ot,dt,Be,We,ct,be,nt,Pe,kt,Wt,Qt,xt,Ft,tl,ll,il,Ie,te;(Fe=ge[6])!=null&&Fe.g?G?(G.p(ge,Ae),Ae[0]&64&&Z(G,1)):(G=Fo(ge),G.c(),Z(G,1),G.m(l,n)):G&&(ht(),ie(G,1,1,()=>{G=null}),vt()),(wt=ge[6])!=null&&wt.m?V?V.p(ge,Ae):(V=Ho(ge),V.c(),V.m(l,i)):V&&(V.d(1),V=null),(ut=ge[6])!=null&&ut.w?Y?Y.p(ge,Ae):(Y=Vo(ge),Y.c(),Y.m(l,s)):Y&&(Y.d(1),Y=null),(rt=ge[6])!=null&&rt.n?U?(U.p(ge,Ae),Ae[0]&64&&Z(U,1)):(U=Qo(ge),U.c(),Z(U,1),U.m(l,a)):U&&(ht(),ie(U,1,1,()=>{U=null}),vt()),(mt=ge[6])!=null&&mt.q?z?(z.p(ge,Ae),Ae[0]&64&&Z(z,1)):(z=Zo(ge),z.c(),Z(z,1),z.m(l,r)):z&&(ht(),ie(z,1,1,()=>{z=null}),vt()),((jt=(qt=ge[6])==null?void 0:qt.q)==null?void 0:jt.m)==3?se?se.p(ge,Ae):(se=xo(ge),se.c(),se.m(l,f)):se&&(se.d(1),se=null),((pt=(Pt=ge[6])==null?void 0:Pt.q)==null?void 0:pt.m)==4?le?le.p(ge,Ae):(le=ea(ge),le.c(),le.m(l,c)):le&&(le.d(1),le=null),(Ht=ge[6])!=null&&Ht.c?Q?(Q.p(ge,Ae),Ae[0]&64&&Z(Q,1)):(Q=ta(ge),Q.c(),Z(Q,1),Q.m(l,_)):Q&&(ht(),ie(Q,1,1,()=>{Q=null}),vt()),Ae[0]&64&&(m=((zt=(Rt=(Kt=ge[6])==null?void 0:Kt.p)==null?void 0:Rt.r)==null?void 0:zt.startsWith("NO"))||((Jt=(el=(Yt=ge[6])==null?void 0:Yt.p)==null?void 0:el.r)==null?void 0:Jt.startsWith("10YNO"))||((ft=(ye=($t=ge[6])==null?void 0:$t.p)==null?void 0:ye.r)==null?void 0:ft.startsWith("10Y1001A1001A4"))),m?ee?ee.p(ge,Ae):(ee=aa(ge),ee.c(),ee.m(l,d)):ee&&(ee.d(1),ee=null),(at=ge[6])!=null&&at.u?ue?ue.p(ge,Ae):(ue=ua(ge),ue.c(),ue.m(l,h)):ue&&(ue.d(1),ue=null),(Ot=(Dt=ge[6])==null?void 0:Dt.i)!=null&&Ot.h&&(((dt=ge[0])==null?void 0:dt.board)>20||((Be=ge[0])==null?void 0:Be.chip)=="esp8266"||((be=(ct=(We=ge[6])==null?void 0:We.i)==null?void 0:ct.d)==null?void 0:be.d)>0)?ae?(ae.p(ge,Ae),Ae[0]&65&&Z(ae,1)):(ae=_a(ge),ae.c(),Z(ae,1),ae.m(l,b)):ae&&(ht(),ie(ae,1,1,()=>{ae=null}),vt()),Ae[0]&65&&(g=((nt=ge[6])==null?void 0:nt.d)&&((kt=(Pe=ge[0])==null?void 0:Pe.features)==null?void 0:kt.includes("rdebug"))),g?x?x.p(ge,Ae):(x=ga(ge),x.c(),x.m(l,null)):x&&(x.d(1),x=null),(Wt=ge[1])!=null&&Wt.a?_e?_e.p(ge,Ae):(_e=Ca(ge),_e.c(),_e.m(w,A)):_e&&(_e.d(1),_e=null),ge[6]?oe?oe.p(ge,Ae):(oe=Sa(ge),oe.c(),oe.m(w,null)):oe&&(oe.d(1),oe=null);const Je={};Ae[0]&8&&(Je.active=ge[3]),Ae[0]&4&&(Je.message=((xt=(Qt=ge[2].conf)==null?void 0:Qt.mask)==null?void 0:xt.loading)??"Loading"),L.$set(Je);const Qe={};Ae[0]&16&&(Qe.active=ge[4]),Ae[0]&4&&(Qe.message=((tl=(Ft=ge[2].conf)==null?void 0:Ft.mask)==null?void 0:tl.saving)??"Saving"),R.$set(Qe);const It={};Ae[0]&256&&(It.active=ge[8]),Ae[0]&4&&(It.message=((il=(ll=ge[2].conf)==null?void 0:ll.mask)==null?void 0:il.reset)??"Factory reset"),H.$set(It);const $e={};Ae[0]&512&&($e.active=ge[9]),Ae[0]&4&&($e.message=((te=(Ie=ge[2].conf)==null?void 0:Ie.mask)==null?void 0:te.reset_done)??"Done"),W.$set($e)},i(ge){N||(Z(G),Z(U),Z(z),Z(Q),Z(ae),Z(L.$$.fragment,ge),Z(R.$$.fragment,ge),Z(H.$$.fragment,ge),Z(W.$$.fragment,ge),N=!0)},o(ge){ie(G),ie(U),ie(z),ie(Q),ie(ae),ie(L.$$.fragment,ge),ie(R.$$.fragment,ge),ie(H.$$.fragment,ge),ie(W.$$.fragment,ge),N=!1},d(ge){ge&&(T(e),T(F),T(M),T(O),T(K)),G&&G.d(),V&&V.d(),Y&&Y.d(),U&&U.d(),z&&z.d(),se&&se.d(),le&&le.d(),Q&&Q.d(),ee&&ee.d(),ue&&ue.d(),ae&&ae.d(),x&&x.d(),_e&&_e.d(),oe&&oe.d(),Ne(L,ge),Ne(R,ge),Ne(H,ge),Ne(W,ge),B=!1,X()}}}async function oc(){await(await fetch("reboot",{method:"POST"})).json()}function ac(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,{data:s}=e,a={};hl.subscribe(Pe=>{l(2,a=Pe)});let r=[{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"}],f=!0,c=!1,_=!1,m,d=[];Mn.subscribe(Pe=>{var kt,Wt,Qt;Pe.version&&(l(5,_=(kt=Pe==null?void 0:Pe.c)==null?void 0:kt.e),l(6,m=Pe),l(3,f=!1),l(7,d=[{code:"en",name:"English"}]),(Wt=m==null?void 0:m.u)!=null&&Wt.lang&&m.u.lang!="en"&&d.push({code:m.u.lang,name:((Qt=a.language)==null?void 0:Qt.name)??"Unknown"}),d.push({code:"hub",name:"Load from server"}))}),S0();let h=!1,b=!1;async function g(){if(confirm("Factory reset?")){l(8,h=!0);const Pe=new URLSearchParams;Pe.append("perform","true");let Wt=await(await fetch("reset",{method:"POST",body:Pe})).json();l(8,h=!1),l(9,b=Wt.success)}}async function k(Pe){l(4,c=!0);const kt=new FormData(Pe.target),Wt=new URLSearchParams;for(let Ft of kt){const[tl,ll]=Ft;Wt.append(tl,ll)}let xt=await(await fetch("save",{method:"POST",body:Wt})).json();al.update(Ft=>(Ft.hostname=kt.get("gh"),Ft.usrcfg=xt.success,Ft.booting=xt.reboot,kt.get("nm")=="static"&&(Ft.net.ip=kt.get("ni"),Ft.net.mask=kt.get("nu"),Ft.net.gw=kt.get("ng"),Ft.net.dns1=kt.get("nd")),Ft.ui=m.u,Ft)),l(4,c=!1),Il(n)}const w=function(){confirm("Reboot?")&&(al.update(Pe=>(Pe.booting=!0,Pe)),oc())};async function A(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),Mn.update(kt=>(kt.q.s.c=!1,kt)))}async function F(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),Mn.update(kt=>(kt.q.s.r=!1,kt)))}async function L(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),Mn.update(kt=>(kt.q.s.k=!1,kt)))}const M=function(){m.q.s.e?m.q.p==1883&&l(6,m.q.p=8883,m):m.q.p==8883&&l(6,m.q.p=1883,m)};async function R(){if(m.u.lang=="hub"){const Pe=await dl("http://hub.amsleser.no/hub/language/list.json");l(7,d=await Pe.json()),l(6,m.u.lang=a.language.code,m)}}let O=44;async function H(){const Pe=await dl("cloudkey.json");if(Pe.status==200){let kt=await Pe.json();window.open("https://www.amsleser.cloud/device/"+kt.seed)}else alert("Not able to bind to cloud")}const K=window||global;K.bindToCloud=function(){console.log("BIND CALLED")};function W(){m.g.h=this.value,l(6,m)}function N(){m.g.t=yt(this),l(6,m)}function B(){m.p.r=yt(this),l(6,m)}function X(){m.p.c=yt(this),l(6,m)}function G(){m.p.e=this.checked,l(6,m)}function V(){m.p.t=this.value,l(6,m)}function Y(){m.g.s=yt(this),l(6,m)}function U(){m.g.u=this.value,l(6,m)}function z(){m.g.p=this.value,l(6,m)}function se(){m.g.c=this.value,l(6,m)}function le(){m.m.a=yt(this),l(6,m)}function Q(){m.m.b=Ke(this.value),l(6,m)}function ee(){m.m.i=this.checked,l(6,m)}function ue(){m.m.b=yt(this),l(6,m)}function ae(){m.m.p=yt(this),l(6,m)}function x(){m.m.s=Ke(this.value),l(6,m)}function _e(){m.m.d=yt(this),l(6,m)}function oe(){m.m.f=Ke(this.value),l(6,m)}function J(){m.m.r=Ke(this.value),l(6,m)}function $(){m.m.e.e=this.checked,l(6,m)}function ve(){m.m.e.k=this.value,l(6,m)}function ke(){m.m.e.a=this.value,l(6,m)}function D(){m.m.m.e=this.checked,l(6,m)}function S(){m.m.m.w=Ke(this.value),l(6,m)}function I(){m.m.m.v=Ke(this.value),l(6,m)}function E(){m.m.m.a=Ke(this.value),l(6,m)}function j(){m.m.m.c=Ke(this.value),l(6,m)}function ne(){m.n.c=yt(this),l(6,m)}function fe(){m.w.s=this.value,l(6,m)}function me(){m.w.p=this.value,l(6,m)}function he(){m.w.z=yt(this),l(6,m)}function pe(){m.w.w=Ke(this.value),l(6,m)}function Se(){m.w.b=this.checked,l(6,m)}function we(){m.n.m=yt(this),l(6,m)}function Le(){m.n.i=this.value,l(6,m)}function qe(){m.n.s=yt(this),l(6,m)}function Re(){m.n.g=this.value,l(6,m)}function re(){m.n.d1=this.value,l(6,m)}function Ce(){m.n.d2=this.value,l(6,m)}function Ue(){m.n.x=this.checked,l(6,m)}function it(){m.n.d=this.checked,l(6,m)}function _t(){m.n.h=this.checked,l(6,m)}function et(){m.n.n1=this.value,l(6,m)}function tt(){m.q.s.e=this.checked,l(6,m)}function lt(){m.q.h=this.value,l(6,m)}function ot(){m.q.p=Ke(this.value),l(6,m)}function Ze(){m.q.u=this.value,l(6,m)}function bt(){m.q.a=this.value,l(6,m)}function st(){m.q.c=this.value,l(6,m)}function Tt(){m.q.m=yt(this),l(6,m)}function Oe(){m.q.b=this.value,l(6,m)}function De(){m.q.t=yt(this),l(6,m)}function He(){m.q.d=Ke(this.value),l(6,m)}function ze(){m.o.e=this.value,l(6,m)}function de(){m.o.c=this.value,l(6,m)}function Ee(){m.o.u1=this.value,l(6,m)}function Ge(){m.o.u2=this.value,l(6,m)}function ge(){m.o.u3=this.value,l(6,m)}function Ae(){m.h.t=this.value,l(6,m)}function Je(){m.h.h=this.value,l(6,m)}function Qe(){m.h.n=this.value,l(6,m)}function It(){m.c.e=this.checked,l(6,m)}function $e(){m.c.p=yt(this),l(6,m)}function Fe(){m.c.es=this.checked,l(6,m)}function wt(Pe){m.t.t[Pe]=Ke(this.value),l(6,m)}function ut(){m.t.h=Ke(this.value),l(6,m)}function rt(Pe){m.u[Pe.key]=yt(this),l(6,m)}function mt(){m.u.lang=yt(this),l(6,m)}function qt(){m.i.h.p=yt(this),l(6,m)}function jt(){m.i.h.t=yt(this),l(6,m)}function Pt(){m.i.h.u=this.checked,l(6,m)}function pt(){m.i.a=Ke(this.value),l(6,m)}function Ht(){m.i.l.p=Ke(this.value),l(6,m)}function Kt(){m.i.l.i=this.checked,l(6,m)}function Rt(){m.i.r.i=this.checked,l(6,m)}function zt(){m.i.r.r=Ke(this.value),l(6,m)}function Yt(){m.i.r.g=Ke(this.value),l(6,m)}function el(){m.i.r.b=Ke(this.value),l(6,m)}function Jt(){m.i.d.d=Ke(this.value),l(6,m)}function $t(){m.i.t.d=Ke(this.value),l(6,m)}function ye(){m.i.t.a=Ke(this.value),l(6,m)}function ft(){m.i.v.p=Ke(this.value),l(6,m)}function at(){m.i.v.d.v=Ke(this.value),l(6,m)}function Dt(){m.i.v.d.g=Ke(this.value),l(6,m)}function Ot(){m.i.d.b=yt(this),l(6,m)}function dt(){m.i.v.o=Ke(this.value),l(6,m)}function Be(){m.i.v.m=Ke(this.value),l(6,m)}function We(){m.i.v.b=Ke(this.value),l(6,m)}function ct(){m.d.s=this.checked,l(6,m)}function be(){m.d.t=this.checked,l(6,m)}function nt(){m.d.l=yt(this),l(6,m)}return t.$$set=Pe=>{"basepath"in Pe&&l(21,n=Pe.basepath),"sysinfo"in Pe&&l(0,i=Pe.sysinfo),"data"in Pe&&l(1,s=Pe.data)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(10,O=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,s,a,f,c,_,m,d,h,b,O,r,g,k,w,A,F,L,M,R,H,n,W,N,B,X,G,V,Y,U,z,se,le,Q,ee,ue,ae,x,_e,oe,J,$,ve,ke,D,S,I,E,j,ne,fe,me,he,pe,Se,we,Le,qe,Re,re,Ce,Ue,it,_t,et,tt,lt,ot,Ze,bt,st,Tt,Oe,De,He,ze,de,Ee,Ge,ge,Ae,Je,Qe,It,$e,Fe,wt,ut,rt,mt,qt,jt,Pt,pt,Ht,Kt,Rt,zt,Yt,el,Jt,$t,ye,ft,at,Dt,Ot,dt,Be,We,ct,be,nt]}class fc extends Nt{constructor(e){super(),Mt(this,e,ac,sc,St,{basepath:21,sysinfo:0,data:1},null,[-1,-1,-1,-1,-1])}}function Ma(t,e,l){const n=t.slice();return n[22]=e[l],n}function Na(t){let e,l=t[1].cpu+"",n,i;return{c(){e=C("("),n=C(l),i=C("MHz)")},m(s,a){P(s,e,a),P(s,n,a),P(s,i,a)},p(s,a){a&2&&l!==(l=s[1].cpu+"")&&q(n,l)},d(s){s&&(T(e),T(n),T(i))}}}function uc(t){let e=Ye(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){P(n,l,i)},p(n,i){i&2&&e!==(e=Ye(n[1].chip,n[1].board)+"")&&q(l,e)},d(n){n&&T(l)}}}function Ta(t){var Y,U,z,se,le,Q,ee,ue;let e,l=(((U=(Y=t[3].status)==null?void 0:Y.device)==null?void 0:U.apmac)??"AP MAC")+"",n,i,s=t[1].apmac+"",a,r,f,c=(((se=(z=t[3].status)==null?void 0:z.device)==null?void 0:se.last_boot)??"Last boot")+"",_,m,d,h,b,g,k=(((Q=(le=t[3].status)==null?void 0:le.device)==null?void 0:Q.reason)??"Reason")+"",w,A,F=(((ue=(ee=t[3][rs(t[1].chip)])==null?void 0:ee.reason)==null?void 0:ue[t[1].boot_reason])??t[1].boot_reason)+"",L,M,R=t[1].boot_reason+"",O,H,K=t[1].ex_cause+"",W,N,B;const X=[cc,rc],G=[];function V(ae,x){return ae[0].u>0?0:1}return d=V(t),h=G[d]=X[d](t),{c(){e=p("div"),n=C(l),i=C(": "),a=C(s),r=v(),f=p("div"),_=C(c),m=C(`: - `),h.c(),b=v(),g=p("div"),w=C(k),A=C(": "),L=C(F),M=C(" ("),O=C(R),H=C("/"),W=C(K),N=C(")"),u(e,"class","my-2"),u(f,"class","my-2"),u(g,"class","my-2")},m(ae,x){P(ae,e,x),o(e,n),o(e,i),o(e,a),P(ae,r,x),P(ae,f,x),o(f,_),o(f,m),G[d].m(f,null),P(ae,b,x),P(ae,g,x),o(g,w),o(g,A),o(g,L),o(g,M),o(g,O),o(g,H),o(g,W),o(g,N),B=!0},p(ae,x){var oe,J,$,ve,ke,D,S,I;(!B||x&8)&&l!==(l=(((J=(oe=ae[3].status)==null?void 0:oe.device)==null?void 0:J.apmac)??"AP MAC")+"")&&q(n,l),(!B||x&2)&&s!==(s=ae[1].apmac+"")&&q(a,s),(!B||x&8)&&c!==(c=(((ve=($=ae[3].status)==null?void 0:$.device)==null?void 0:ve.last_boot)??"Last boot")+"")&&q(_,c);let _e=d;d=V(ae),d===_e?G[d].p(ae,x):(ht(),ie(G[_e],1,1,()=>{G[_e]=null}),vt(),h=G[d],h?h.p(ae,x):(h=G[d]=X[d](ae),h.c()),Z(h,1),h.m(f,null)),(!B||x&8)&&k!==(k=(((D=(ke=ae[3].status)==null?void 0:ke.device)==null?void 0:D.reason)??"Reason")+"")&&q(w,k),(!B||x&10)&&F!==(F=(((I=(S=ae[3][rs(ae[1].chip)])==null?void 0:S.reason)==null?void 0:I[ae[1].boot_reason])??ae[1].boot_reason)+"")&&q(L,F),(!B||x&2)&&R!==(R=ae[1].boot_reason+"")&&q(O,R),(!B||x&2)&&K!==(K=ae[1].ex_cause+"")&&q(W,K)},i(ae){B||(Z(h),B=!0)},o(ae){ie(h),B=!1},d(ae){ae&&(T(e),T(r),T(f),T(b),T(g)),G[d].d()}}}function rc(t){let e;return{c(){e=C("-")},m(l,n){P(l,e,n)},p:Ve,i:Ve,o:Ve,d(l){l&&T(e)}}}function cc(t){let e,l;return e=new _u({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Pa(t){var _;let e,l,n,i,s=(((_=t[3].btn)==null?void 0:_.reboot)??"Reboot")+"",a,r,f,c;return l=new _l({props:{to:"/consent",$$slots:{default:[_c]},$$scope:{ctx:t}}}),{c(){e=p("div"),Te(l.$$.fragment),n=v(),i=p("button"),a=C(s),u(i,"class","btn-yellow-sm float-right"),u(e,"class","my-2")},m(m,d){P(m,e,d),Me(l,e,null),o(e,n),o(e,i),o(i,a),r=!0,f||(c=ce(i,"click",t[12]),f=!0)},p(m,d){var b;const h={};d&33554440&&(h.$$scope={dirty:d,ctx:m}),l.$set(h),(!r||d&8)&&s!==(s=(((b=m[3].btn)==null?void 0:b.reboot)??"Reboot")+"")&&q(a,s)},i(m){r||(Z(l.$$.fragment,m),r=!0)},o(m){ie(l.$$.fragment,m),r=!1},d(m){m&&T(e),Ne(l),f=!1,c()}}}function _c(t){var i,s;let e,l=(((s=(i=t[3].status)==null?void 0:i.device)==null?void 0:s.btn_consents)??"Consents")+"",n;return{c(){e=p("span"),n=C(l),u(e,"class","btn-pri-sm")},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r&8&&l!==(l=(((c=(f=a[3].status)==null?void 0:f.device)==null?void 0:c.btn_consents)??"Consents")+"")&&q(n,l)},d(a){a&&T(e)}}}function Ea(t){var W,N,B,X,G,V,Y,U;let e,l,n=(((N=(W=t[3].status)==null?void 0:W.meter)==null?void 0:N.title)??"Meter")+"",i,s,a,r=(((X=(B=t[3].status)==null?void 0:B.meter)==null?void 0:X.manufacturer)??"Manufacturer")+"",f,c,_=Yn(t[1].meter.mfg)+"",m,d,h,b=(((V=(G=t[3].status)==null?void 0:G.meter)==null?void 0:V.model)??"Model")+"",g,k,w=(t[1].meter.model?t[1].meter.model:"unknown")+"",A,F,L,M=(((U=(Y=t[3].status)==null?void 0:Y.meter)==null?void 0:U.id)??"ID")+"",R,O,H=(t[1].meter.id?t[1].meter.id:"unknown")+"",K;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),f=C(r),c=C(": "),m=C(_),d=v(),h=p("div"),g=C(b),k=C(": "),A=C(w),F=v(),L=p("div"),R=C(M),O=C(": "),K=C(H),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(L,"class","my-2"),u(e,"class","cnt")},m(z,se){P(z,e,se),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(a,c),o(a,m),o(e,d),o(e,h),o(h,g),o(h,k),o(h,A),o(e,F),o(e,L),o(L,R),o(L,O),o(L,K)},p(z,se){var le,Q,ee,ue,ae,x,_e,oe;se&8&&n!==(n=(((Q=(le=z[3].status)==null?void 0:le.meter)==null?void 0:Q.title)??"Meter")+"")&&q(i,n),se&8&&r!==(r=(((ue=(ee=z[3].status)==null?void 0:ee.meter)==null?void 0:ue.manufacturer)??"Manufacturer")+"")&&q(f,r),se&2&&_!==(_=Yn(z[1].meter.mfg)+"")&&q(m,_),se&8&&b!==(b=(((x=(ae=z[3].status)==null?void 0:ae.meter)==null?void 0:x.model)??"Model")+"")&&q(g,b),se&2&&w!==(w=(z[1].meter.model?z[1].meter.model:"unknown")+"")&&q(A,w),se&8&&M!==(M=(((oe=(_e=z[3].status)==null?void 0:_e.meter)==null?void 0:oe.id)??"ID")+"")&&q(R,M),se&2&&H!==(H=(z[1].meter.id?z[1].meter.id:"unknown")+"")&&q(K,H)},d(z){z&&T(e)}}}function qa(t){var U,z,se,le,Q,ee,ue,ae;let e,l,n=(((z=(U=t[3].status)==null?void 0:U.network)==null?void 0:z.title)??"Network")+"",i,s,a,r=(((le=(se=t[3].conf)==null?void 0:se.network)==null?void 0:le.ip)??"IP")+"",f,c,_=t[1].net.ip+"",m,d,h,b=(((ee=(Q=t[3].conf)==null?void 0:Q.network)==null?void 0:ee.mask)??"Mask")+"",g,k,w=t[1].net.mask+"",A,F,L,M=(((ae=(ue=t[3].conf)==null?void 0:ue.network)==null?void 0:ae.gw)??"Gateway")+"",R,O,H=t[1].net.gw+"",K,W,N,B,X,G=t[1].net.dns1&&Da(t),V=t[1].net.dns2&&Aa(t),Y=t[1].net.ipv6&&La(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),f=C(r),c=C(": "),m=C(_),d=v(),h=p("div"),g=C(b),k=C(": "),A=C(w),F=v(),L=p("div"),R=C(M),O=C(": "),K=C(H),W=v(),N=p("div"),G&&G.c(),B=v(),V&&V.c(),X=v(),Y&&Y.c(),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(L,"class","my-2"),u(N,"class","my-2"),u(e,"class","cnt")},m(x,_e){P(x,e,_e),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(a,c),o(a,m),o(e,d),o(e,h),o(h,g),o(h,k),o(h,A),o(e,F),o(e,L),o(L,R),o(L,O),o(L,K),o(e,W),o(e,N),G&&G.m(N,null),o(N,B),V&&V.m(N,null),o(e,X),Y&&Y.m(e,null)},p(x,_e){var oe,J,$,ve,ke,D,S,I;_e&8&&n!==(n=(((J=(oe=x[3].status)==null?void 0:oe.network)==null?void 0:J.title)??"Network")+"")&&q(i,n),_e&8&&r!==(r=(((ve=($=x[3].conf)==null?void 0:$.network)==null?void 0:ve.ip)??"IP")+"")&&q(f,r),_e&2&&_!==(_=x[1].net.ip+"")&&q(m,_),_e&8&&b!==(b=(((D=(ke=x[3].conf)==null?void 0:ke.network)==null?void 0:D.mask)??"Mask")+"")&&q(g,b),_e&2&&w!==(w=x[1].net.mask+"")&&q(A,w),_e&8&&M!==(M=(((I=(S=x[3].conf)==null?void 0:S.network)==null?void 0:I.gw)??"Gateway")+"")&&q(R,M),_e&2&&H!==(H=x[1].net.gw+"")&&q(K,H),x[1].net.dns1?G?G.p(x,_e):(G=Da(x),G.c(),G.m(N,B)):G&&(G.d(1),G=null),x[1].net.dns2?V?V.p(x,_e):(V=Aa(x),V.c(),V.m(N,null)):V&&(V.d(1),V=null),x[1].net.ipv6?Y?Y.p(x,_e):(Y=La(x),Y.c(),Y.m(e,null)):Y&&(Y.d(1),Y=null)},d(x){x&&T(e),G&&G.d(),V&&V.d(),Y&&Y.d()}}}function Da(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[1].net.dns1+"",s;return{c(){l=C(e),n=C(": "),s=C(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,s,c)},p(f,c){var _,m;c&8&&e!==(e=(((m=(_=f[3].conf)==null?void 0:_.network)==null?void 0:m.dns)??"DNS")+"")&&q(l,e),c&2&&i!==(i=f[1].net.dns1+"")&&q(s,i)},d(f){f&&(T(l),T(n),T(s))}}}function Aa(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[1].net.dns2+"",s;return{c(){l=C(e),n=C(": "),s=C(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,s,c)},p(f,c){var _,m;c&8&&e!==(e=(((m=(_=f[3].conf)==null?void 0:_.network)==null?void 0:m.dns)??"DNS")+"")&&q(l,e),c&2&&i!==(i=f[1].net.dns2+"")&&q(s,i)},d(f){f&&(T(l),T(n),T(s))}}}function La(t){let e,l,n,i=t[1].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"",s,a,r,f,c=t[1].net.dns1v6&&Oa(t),_=t[1].net.dns2v6&&Ia(t);return{c(){e=p("div"),l=C("IPv6: "),n=p("span"),s=C(i),a=v(),r=p("div"),c&&c.c(),f=v(),_&&_.c(),Ol(n,"font-size","14px"),u(e,"class","my-2"),u(r,"class","my-2")},m(m,d){P(m,e,d),o(e,l),o(e,n),o(n,s),P(m,a,d),P(m,r,d),c&&c.m(r,null),o(r,f),_&&_.m(r,null)},p(m,d){d&2&&i!==(i=m[1].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&q(s,i),m[1].net.dns1v6?c?c.p(m,d):(c=Oa(m),c.c(),c.m(r,f)):c&&(c.d(1),c=null),m[1].net.dns2v6?_?_.p(m,d):(_=Ia(m),_.c(),_.m(r,null)):_&&(_.d(1),_=null)},d(m){m&&(T(e),T(a),T(r)),c&&c.d(),_&&_.d()}}}function Oa(t){let e,l,n=t[1].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=C("DNSv6: "),l=p("span"),i=C(n),Ol(l,"font-size","14px")},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&2&&n!==(n=s[1].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&q(i,n)},d(s){s&&(T(e),T(l))}}}function Ia(t){let e,l,n=t[1].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=C("DNSv6: "),l=p("span"),i=C(n),Ol(l,"font-size","14px")},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&2&&n!==(n=s[1].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&q(i,n)},d(s){s&&(T(e),T(l))}}}function Ra(t){var f,c,_,m;let e,l,n=(((c=(f=t[3].status)==null?void 0:f.firmware)==null?void 0:c.failed)??"Upgrade from {0} to {1} failed").replace("{0}",t[1].upgrade.f).replace("{1}",t[1].upgrade.t)+"",i,s,a=(((m=(_=t[3].errors)==null?void 0:_.http)==null?void 0:m[t[1].upgrade.e])??t[1].upgrade.e)+"",r;return{c(){e=p("div"),l=p("div"),i=C(n),s=v(),r=C(a),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(d,h){P(d,e,h),o(e,l),o(l,i),o(l,s),o(l,r)},p(d,h){var b,g,k,w;h&10&&n!==(n=(((g=(b=d[3].status)==null?void 0:b.firmware)==null?void 0:g.failed)??"Upgrade from {0} to {1} failed").replace("{0}",d[1].upgrade.f).replace("{1}",d[1].upgrade.t)+"")&&q(i,n),h&10&&a!==(a=(((w=(k=d[3].errors)==null?void 0:k.http)==null?void 0:w[d[1].upgrade.e])??d[1].upgrade.e)+"")&&q(r,a)},d(d){d&&T(e)}}}function Fa(t){var b,g;let e,l=(((g=(b=t[3].status)==null?void 0:b.firmware)==null?void 0:g.latest)??"Latest")+"",n,i,s,a=t[4].tag_name+"",r,f,c,_,m,d=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[4]&&t[4].tag_name!=t[1].version&&Ba(t),h=t[1].fwconsent===2&&Ua(t);return{c(){e=p("div"),n=C(l),i=C(`: - `),s=p("a"),r=C(a),c=v(),d&&d.c(),_=v(),h&&h.c(),m=Vt(),u(s,"href",f=t[4].html_url),u(s,"class","ml-2 text-blue-600 hover:text-blue-800"),u(s,"target","_blank"),u(s,"rel","noreferrer"),u(e,"class","my-2 flex")},m(k,w){P(k,e,w),o(e,n),o(e,i),o(e,s),o(s,r),o(e,c),d&&d.m(e,null),P(k,_,w),h&&h.m(k,w),P(k,m,w)},p(k,w){var A,F;w&8&&l!==(l=(((F=(A=k[3].status)==null?void 0:A.firmware)==null?void 0:F.latest)??"Latest")+"")&&q(n,l),w&16&&a!==(a=k[4].tag_name+"")&&q(r,a),w&16&&f!==(f=k[4].html_url)&&u(s,"href",f),(k[1].security==0||k[0].a)&&k[1].fwconsent===1&&k[4]&&k[4].tag_name!=k[1].version?d?d.p(k,w):(d=Ba(k),d.c(),d.m(e,null)):d&&(d.d(1),d=null),k[1].fwconsent===2?h?h.p(k,w):(h=Ua(k),h.c(),h.m(m.parentNode,m)):h&&(h.d(1),h=null)},d(k){k&&(T(e),T(_),T(m)),d&&d.d(),h&&h.d(k)}}}function Ba(t){let e,l,n,i,s;return{c(){var a,r;e=p("div"),l=p("button"),l.textContent="⇓",u(e,"class","flex-none ml-2 text-green-500"),u(e,"title",n=((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.install)??"Install")},m(a,r){P(a,e,r),o(e,l),i||(s=ce(l,"click",t[11]),i=!0)},p(a,r){var f,c;r&8&&n!==(n=((c=(f=a[3].status)==null?void 0:f.firmware)==null?void 0:c.install)??"Install")&&u(e,"title",n)},d(a){a&&T(e),i=!1,s()}}}function Ua(t){var s,a;let e,l,n=(((a=(s=t[3].status)==null?void 0:s.firmware)==null?void 0:a.no_one_click)??"One-click upgrade disabled")+"",i;return{c(){e=p("div"),l=p("div"),i=C(n),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(r,f){P(r,e,f),o(e,l),o(l,i)},p(r,f){var c,_;f&8&&n!==(n=(((_=(c=r[3].status)==null?void 0:c.firmware)==null?void 0:_.no_one_click)??"One-click upgrade disabled")+"")&&q(i,n)},d(r){r&&T(e)}}}function ja(t){let e,l=Qn(Ye(t[1].chip,t[1].board))+"",n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,s){P(i,e,s),o(e,n)},p(i,s){s&2&&l!==(l=Qn(Ye(i[1].chip,i[1].board))+"")&&q(n,l)},d(i){i&&T(e)}}}function Ha(t){let e,l,n,i,s,a;function r(_,m){return _[6].length==0?pc:mc}let f=r(t),c=f(t);return{c(){e=p("div"),l=p("form"),n=p("input"),i=v(),c.c(),Ol(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","/firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(e,"class","my-2 flex")},m(_,m){P(_,e,m),o(e,l),o(l,n),t[14](n),o(l,i),c.m(l,null),s||(a=[ce(n,"change",t[15]),ce(l,"submit",t[17])],s=!0)},p(_,m){f===(f=r(_))&&c?c.p(_,m):(c.d(1),c=f(_),c&&(c.c(),c.m(l,null)))},d(_){_&&T(e),t[14](null),c.d(),s=!1,Lt(a)}}}function mc(t){var r;let e=t[6][0].name+"",l,n,i,s=(((r=t[3].btn)==null?void 0:r.upload)??"Upload")+"",a;return{c(){l=C(e),n=v(),i=p("button"),a=C(s),u(i,"type","submit"),u(i,"class","btn-pri-sm float-right ml-2")},m(f,c){P(f,l,c),P(f,n,c),P(f,i,c),o(i,a)},p(f,c){var _;c&64&&e!==(e=f[6][0].name+"")&&q(l,e),c&8&&s!==(s=(((_=f[3].btn)==null?void 0:_.upload)??"Upload")+"")&&q(a,s)},d(f){f&&(T(l),T(n),T(i))}}}function pc(t){var a,r;let e,l=(((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.btn_select_file)??"Select file")+"",n,i,s;return{c(){e=p("button"),n=C(l),u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(f,c){P(f,e,c),o(e,n),i||(s=ce(e,"click",t[16]),i=!0)},p(f,c){var _,m;c&8&&l!==(l=(((m=(_=f[3].status)==null?void 0:_.firmware)==null?void 0:m.btn_select_file)??"Select file")+"")&&q(n,l)},d(f){f&&T(e),i=!1,s()}}}function ya(t){var V,Y,U,z,se,le;let e,l,n=(((Y=(V=t[3].status)==null?void 0:V.backup)==null?void 0:Y.title)??"Backup")+"",i,s,a,r,f,c,_,m,d=(((z=(U=t[3].status)==null?void 0:U.backup)==null?void 0:z.secrets)??"Include secrets")+"",h,b,g,k=(((le=(se=t[3].status)==null?void 0:se.backup)==null?void 0:le.secrets_desc)??"")+"",w,A,F,L,M,R,O,H,K=gt(t[10]),W=[];for(let Q=0;Q{me=null}),vt()),(rt=de[0])!=null&&rt.a?he?(he.p(de,Ee),Ee&1&&Z(he,1)):(he=Pa(de),he.c(),Z(he,1),he.m(l,null)):he&&(ht(),ie(he,1,1,()=>{he=null}),vt()),de[1].meter?pe?pe.p(de,Ee):(pe=Ea(de),pe.c(),pe.m(e,G)):pe&&(pe.d(1),pe=null),de[1].net?Se?Se.p(de,Ee):(Se=qa(de),Se.c(),Se.m(e,V)):Se&&(Se.d(1),Se=null),(!ne||Ee&8)&&z!==(z=(((qt=(mt=de[3].status)==null?void 0:mt.firmware)==null?void 0:qt.title)??"Firmware")+"")&&q(se,z),(!ne||Ee&8)&&ee!==(ee=(((Pt=(jt=de[3].status)==null?void 0:jt.firmware)==null?void 0:Pt.installed)??"Installed")+"")&&q(ue,ee),(!ne||Ee&2)&&x!==(x=de[1].version+"")&&q(_e,x),de[1].upgrade.t&&de[1].upgrade.t!=de[1].version?we?we.p(de,Ee):(we=Ra(de),we.c(),we.m(Y,J)):we&&(we.d(1),we=null),de[4]?Le?Le.p(de,Ee):(Le=Fa(de),Le.c(),Le.m(Y,$)):Le&&(Le.d(1),Le=null),Ee&3&&(ve=(de[1].security==0||de[0].a)&&Xl(de[1].board)),ve?qe?qe.p(de,Ee):(qe=ja(de),qe.c(),qe.m(Y,ke)):qe&&(qe.d(1),qe=null),de[1].security==0||de[0].a?Re?Re.p(de,Ee):(Re=Ha(de),Re.c(),Re.m(Y,null)):Re&&(Re.d(1),Re=null),de[1].security==0||de[0].a?re?re.p(de,Ee):(re=ya(de),re.c(),re.m(e,null)):re&&(re.d(1),re=null);const ge={};Ee&128&&(ge.active=de[7]),Ee&8&&(ge.message=((Ht=(pt=de[3].status)==null?void 0:pt.mask)==null?void 0:Ht.firmware)??"Uploading"),I.$set(ge);const Ae={};Ee&512&&(Ae.active=de[9]),Ee&8&&(Ae.message=((Rt=(Kt=de[3].status)==null?void 0:Kt.mask)==null?void 0:Rt.config)??"Uploading"),j.$set(Ae)},i(de){ne||(Z(F.$$.fragment,de),Z(me),Z(he),Z(I.$$.fragment,de),Z(j.$$.fragment,de),ne=!0)},o(de){ie(F.$$.fragment,de),ie(me),ie(he),ie(I.$$.fragment,de),ie(j.$$.fragment,de),ne=!1},d(de){de&&(T(e),T(S),T(E)),fe&&fe.d(),Ne(F),me&&me.d(),he&&he.d(),pe&&pe.d(),Se&&Se.d(),we&&we.d(),Le&&Le.d(),qe&&qe.d(),Re&&Re.d(),re&&re.d(),Ne(I,de),Ne(j,de)}}}async function bc(){await(await fetch("reboot",{method:"POST"})).json()}function gc(t,e,l){let{data:n}=e,{sysinfo:i}=e,s=[{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",key:"is"}],a={};hl.subscribe(K=>{l(3,a=K)});let r={};Ui.subscribe(K=>{l(4,r=cu(i.version,K)),r||l(4,r=K[0])});function f(){var K;confirm((((K=a.header)==null?void 0:K.upgrade)??"Upgrade to {0}?").replace("{0}",r.tag_name))&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Qn(Ye(i.chip,i.board))))&&(al.update(W=>(W.upgrading=!0,W)),ru(r.tag_name))}const c=function(){var K;confirm(((K=a.device)==null?void 0:K.reboot_confirm)??"Reboot?")&&(al.update(W=>(W.booting=!0,W)),bc())};let _,m=[],d=!1,h,b=[],g=!1;Fi();let k={hostname:"",ip:""};function w(K){l(9,g=!0);const W=new FormData;W.append("file",b[0]),fetch("configfile",{method:"POST",body:W}).then(N=>N.json()).then(N=>{al.update(B=>(k&&k.hostname&&(B.hostname=k.hostname),B.booting=N.reboot,k&&k.ip&&(B.net.ip=k.ip),setTimeout(qn,5e3,i),B))}).catch(N=>{console.error("Error:",N),setTimeout(qn,5e3,i)})}function A(K){Vn[K?"unshift":"push"](()=>{_=K,l(5,_)})}function F(){m=this.files,l(6,m)}const L=()=>{_.click()},M=()=>l(7,d=!0);function R(K){Vn[K?"unshift":"push"](()=>{h=K,l(8,h)})}function O(){b=this.files,l(2,b)}const H=()=>{h.click()};return t.$$set=K=>{"data"in K&&l(0,n=K.data),"sysinfo"in K&&l(1,i=K.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&4&&b.length==1){let K=b[0],W=new FileReader,N=B=>{let X=B.target.result.split(` -`);for(let G in X){let V=X[G];V.startsWith("hostname ")?k.hostname=V.split(" ")[1]:V.startsWith("ip ")&&(k.ip=V.split(" ")[1])}};W.onload=N,W.readAsText(K)}},[n,i,b,a,r,_,m,d,h,g,s,f,c,w,A,F,L,M,R,O,H]}class kc extends Nt{constructor(e){super(),Mt(this,e,gc,vc,St,{data:0,sysinfo:1})}}function Ga(t){let e,l,n=Ye(t[0],7)+"",i,s,a=Ye(t[0],5)+"",r,f,c=Ye(t[0],4)+"",_,m,d=Ye(t[0],3)+"",h,b,g,k,w=Ye(t[0],2)+"",A,F,L=Ye(t[0],1)+"",M,R,O=Ye(t[0],0)+"",H,K,W,N,B=Ye(t[0],101)+"",X,G,V=Ye(t[0],100)+"",Y;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),_=C(c),m=p("option"),h=C(d),b=v(),g=p("optgroup"),k=p("option"),A=C(w),F=p("option"),M=C(L),R=p("option"),H=C(O),K=v(),W=p("optgroup"),N=p("option"),X=C(B),G=p("option"),Y=C(V),l.__value=7,y(l,l.__value),s.__value=5,y(s,s.__value),f.__value=4,y(f,f.__value),m.__value=3,y(m,m.__value),u(e,"label","amsleser.no"),k.__value=2,y(k,k.__value),F.__value=1,y(F,F.__value),R.__value=0,y(R,R.__value),u(g,"label","Custom hardware"),N.__value=101,y(N,N.__value),G.__value=100,y(G,G.__value),u(W,"label","Generic hardware")},m(U,z){P(U,e,z),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,_),o(e,m),o(m,h),P(U,b,z),P(U,g,z),o(g,k),o(k,A),o(g,F),o(F,M),o(g,R),o(R,H),P(U,K,z),P(U,W,z),o(W,N),o(N,X),o(W,G),o(G,Y)},p(U,z){z&1&&n!==(n=Ye(U[0],7)+"")&&q(i,n),z&1&&a!==(a=Ye(U[0],5)+"")&&q(r,a),z&1&&c!==(c=Ye(U[0],4)+"")&&q(_,c),z&1&&d!==(d=Ye(U[0],3)+"")&&q(h,d),z&1&&w!==(w=Ye(U[0],2)+"")&&q(A,w),z&1&&L!==(L=Ye(U[0],1)+"")&&q(M,L),z&1&&O!==(O=Ye(U[0],0)+"")&&q(H,O),z&1&&B!==(B=Ye(U[0],101)+"")&&q(X,B),z&1&&V!==(V=Ye(U[0],100)+"")&&q(Y,V)},d(U){U&&(T(e),T(b),T(g),T(K),T(W))}}}function Va(t){let e,l,n=Ye(t[0],201)+"",i,s,a=Ye(t[0],202)+"",r,f,c=Ye(t[0],203)+"",_,m,d=Ye(t[0],241)+"",h,b,g=Ye(t[0],242)+"",k,w,A=Ye(t[0],243)+"",F,L,M=Ye(t[0],245)+"",R,O,H=Ye(t[0],200)+"",K;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),_=C(c),m=p("option"),h=C(d),b=p("option"),k=C(g),w=p("option"),F=C(A),L=p("option"),R=C(M),O=p("option"),K=C(H),l.__value=201,y(l,l.__value),s.__value=202,y(s,s.__value),f.__value=203,y(f,f.__value),m.__value=241,y(m,m.__value),b.__value=242,y(b,b.__value),w.__value=243,y(w,w.__value),L.__value=245,y(L,L.__value),O.__value=200,y(O,O.__value),u(e,"label","Generic hardware")},m(W,N){P(W,e,N),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,_),o(e,m),o(m,h),o(e,b),o(b,k),o(e,w),o(w,F),o(e,L),o(L,R),o(e,O),o(O,K)},p(W,N){N&1&&n!==(n=Ye(W[0],201)+"")&&q(i,n),N&1&&a!==(a=Ye(W[0],202)+"")&&q(r,a),N&1&&c!==(c=Ye(W[0],203)+"")&&q(_,c),N&1&&d!==(d=Ye(W[0],241)+"")&&q(h,d),N&1&&g!==(g=Ye(W[0],242)+"")&&q(k,g),N&1&&A!==(A=Ye(W[0],243)+"")&&q(F,A),N&1&&M!==(M=Ye(W[0],245)+"")&&q(R,M),N&1&&H!==(H=Ye(W[0],200)+"")&&q(K,H)},d(W){W&&T(e)}}}function Ka(t){let e,l,n=Ye(t[0],7)+"",i,s,a=Ye(t[0],6)+"",r,f,c=Ye(t[0],5)+"",_,m,d,h,b=Ye(t[0],51)+"",g,k,w=Ye(t[0],50)+"",A;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),_=C(c),m=v(),d=p("optgroup"),h=p("option"),g=C(b),k=p("option"),A=C(w),l.__value=7,y(l,l.__value),s.__value=6,y(s,s.__value),f.__value=5,y(f,f.__value),u(e,"label","amsleser.no"),h.__value=51,y(h,h.__value),k.__value=50,y(k,k.__value),u(d,"label","Generic hardware")},m(F,L){P(F,e,L),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,_),P(F,m,L),P(F,d,L),o(d,h),o(h,g),o(d,k),o(k,A)},p(F,L){L&1&&n!==(n=Ye(F[0],7)+"")&&q(i,n),L&1&&a!==(a=Ye(F[0],6)+"")&&q(r,a),L&1&&c!==(c=Ye(F[0],5)+"")&&q(_,c),L&1&&b!==(b=Ye(F[0],51)+"")&&q(g,b),L&1&&w!==(w=Ye(F[0],50)+"")&&q(A,w)},d(F){F&&(T(e),T(m),T(d))}}}function Ya(t){let e,l,n=Ye(t[0],8)+"",i,s,a,r,f=Ye(t[0],71)+"",c,_,m=Ye(t[0],70)+"",d;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=v(),a=p("optgroup"),r=p("option"),c=C(f),_=p("option"),d=C(m),l.__value=8,y(l,l.__value),u(e,"label","Custom hardware"),r.__value=71,y(r,r.__value),_.__value=70,y(_,_.__value),u(a,"label","Generic hardware")},m(h,b){P(h,e,b),o(e,l),o(l,i),P(h,s,b),P(h,a,b),o(a,r),o(r,c),o(a,_),o(_,d)},p(h,b){b&1&&n!==(n=Ye(h[0],8)+"")&&q(i,n),b&1&&f!==(f=Ye(h[0],71)+"")&&q(c,f),b&1&&m!==(m=Ye(h[0],70)+"")&&q(d,m)},d(h){h&&(T(e),T(s),T(a))}}}function Qa(t){let e,l,n=Ye(t[0],200)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=200,y(l,l.__value),u(e,"label","Generic hardware")},m(s,a){P(s,e,a),o(e,l),o(l,i)},p(s,a){a&1&&n!==(n=Ye(s[0],200)+"")&&q(i,n)},d(s){s&&T(e)}}}function Xa(t){let e,l,n=Ye(t[0],80)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=80,y(l,l.__value),u(e,"label","Generic hardware")},m(s,a){P(s,e,a),o(e,l),o(l,i)},p(s,a){a&1&&n!==(n=Ye(s[0],80)+"")&&q(i,n)},d(s){s&&T(e)}}}function wc(t){let e,l,n,i,s,a,r,f,c=t[0]=="esp8266"&&Ga(t),_=t[0]=="esp32"&&Va(t),m=t[0]=="esp32s2"&&Ka(t),d=t[0]=="esp32c3"&&Ya(t),h=t[0]=="esp32solo"&&Qa(t),b=t[0]=="esp32s3"&&Xa(t);return{c(){e=p("option"),l=v(),c&&c.c(),n=v(),_&&_.c(),i=v(),m&&m.c(),s=v(),d&&d.c(),a=v(),h&&h.c(),r=v(),b&&b.c(),f=Vt(),e.__value=-1,y(e,e.__value)},m(g,k){P(g,e,k),P(g,l,k),c&&c.m(g,k),P(g,n,k),_&&_.m(g,k),P(g,i,k),m&&m.m(g,k),P(g,s,k),d&&d.m(g,k),P(g,a,k),h&&h.m(g,k),P(g,r,k),b&&b.m(g,k),P(g,f,k)},p(g,[k]){g[0]=="esp8266"?c?c.p(g,k):(c=Ga(g),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),g[0]=="esp32"?_?_.p(g,k):(_=Va(g),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null),g[0]=="esp32s2"?m?m.p(g,k):(m=Ka(g),m.c(),m.m(s.parentNode,s)):m&&(m.d(1),m=null),g[0]=="esp32c3"?d?d.p(g,k):(d=Ya(g),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null),g[0]=="esp32solo"?h?h.p(g,k):(h=Qa(g),h.c(),h.m(r.parentNode,r)):h&&(h.d(1),h=null),g[0]=="esp32s3"?b?b.p(g,k):(b=Xa(g),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i:Ve,o:Ve,d(g){g&&(T(e),T(l),T(n),T(i),T(s),T(a),T(r),T(f)),c&&c.d(g),_&&_.d(g),m&&m.d(g),d&&d.d(g),h&&h.d(g),b&&b.d(g)}}}function Cc(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Sc extends Nt{constructor(e){super(),Mt(this,e,Cc,wc,St,{chip:0})}}function Za(t){let e;return{c(){e=p("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(e,"class","bd-red")},m(l,n){P(l,e,n)},d(l){l&&T(e)}}}function Ja(t){let e,l,n,i,s,a,r;return a=new Si({props:{chip:t[0].chip}}),{c(){e=p("div"),l=C("HAN GPIO"),n=p("br"),i=v(),s=p("select"),Te(a.$$.fragment),u(s,"name","vh"),u(s,"class","in-s"),u(e,"class","my-3")},m(f,c){P(f,e,c),o(e,l),o(e,n),o(e,i),o(e,s),Me(a,s,null),r=!0},p(f,c){const _={};c&1&&(_.chip=f[0].chip),a.$set(_)},i(f){r||(Z(a.$$.fragment,f),r=!0)},o(f){ie(a.$$.fragment,f),r=!1},d(f){f&&T(e),Ne(a)}}}function Mc(t){let e,l,n,i,s,a,r,f,c,_,m,d,h,b,g,k,w,A,F,L,M,R,O,H,K,W,N,B,X,G=t[0].usrcfg&&Za();b=new Sc({props:{chip:t[0].chip}});let V=t[0].board&&t[0].board>20&&Ja(t);return W=new sl({props:{active:t[1],message:"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),s=v(),a=p("strong"),a.textContent="Initial configuration",r=v(),G&&G.c(),f=v(),c=p("div"),_=C("Board type"),m=p("br"),d=v(),h=p("select"),Te(b.$$.fragment),g=v(),V&&V.c(),k=v(),w=p("div"),A=p("label"),F=p("input"),L=C(" Clear all other configuration"),M=v(),R=p("div"),R.innerHTML='',O=v(),H=p("span"),H.textContent=" ",K=v(),Te(W.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(a,"class","text-sm"),u(h,"name","vb"),u(h,"class","in-s"),t[0].board===void 0&&At(()=>t[5].call(h)),u(c,"class","my-3"),u(F,"type","checkbox"),u(F,"name","vr"),F.__value="true",y(F,F.__value),u(F,"class","rounded mb-1"),u(w,"class","my-3"),u(R,"class","my-3"),u(H,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Y,U){P(Y,e,U),o(e,l),o(l,n),o(n,i),o(n,s),o(n,a),o(n,r),G&&G.m(n,null),o(n,f),o(n,c),o(c,_),o(c,m),o(c,d),o(c,h),Me(b,h,null),Xe(h,t[0].board,!0),o(n,g),V&&V.m(n,null),o(n,k),o(n,w),o(w,A),o(A,F),F.checked=t[2],o(A,L),o(n,M),o(n,R),o(n,O),o(n,H),P(Y,K,U),Me(W,Y,U),N=!0,B||(X=[ce(h,"change",t[5]),ce(F,"change",t[6]),ce(n,"submit",zl(t[3]))],B=!0)},p(Y,[U]){Y[0].usrcfg?G||(G=Za(),G.c(),G.m(n,f)):G&&(G.d(1),G=null);const z={};U&1&&(z.chip=Y[0].chip),b.$set(z),U&1&&Xe(h,Y[0].board),Y[0].board&&Y[0].board>20?V?(V.p(Y,U),U&1&&Z(V,1)):(V=Ja(Y),V.c(),Z(V,1),V.m(n,k)):V&&(ht(),ie(V,1,1,()=>{V=null}),vt()),U&4&&(F.checked=Y[2]);const se={};U&2&&(se.active=Y[1]),W.$set(se)},i(Y){N||(Z(b.$$.fragment,Y),Z(V),Z(W.$$.fragment,Y),N=!0)},o(Y){ie(b.$$.fragment,Y),ie(V),ie(W.$$.fragment,Y),N=!1},d(Y){Y&&(T(e),T(K)),G&&G.d(),Ne(b),V&&V.d(),Ne(W,Y),B=!1,Lt(X)}}}function Nc(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,s=!1;async function a(_){l(1,s=!0);const m=new FormData(_.target),d=new URLSearchParams;for(let g of m){const[k,w]=g;d.append(k,w)}let b=await(await fetch("save",{method:"POST",body:d})).json();l(1,s=!1),al.update(g=>(g.vndcfg=b.success,g.booting=b.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),Il(n+(i.usrcfg?"/":"/setup"))}let r=!1;al.subscribe(_=>{l(0,i=_),_.fwconsent===1&&l(2,r=!i.usrcfg)});function f(){i.board=yt(this),l(0,i)}function c(){r=this.checked,l(2,r)}return t.$$set=_=>{"basepath"in _&&l(4,n=_.basepath),"sysinfo"in _&&l(0,i=_.sysinfo)},[i,s,r,a,n,f,c]}class Tc extends Nt{constructor(e){super(),Mt(this,e,Nc,Mc,St,{basepath:4,sysinfo:0})}}function $a(t){var i,s;let e,l=(((s=(i=t[1].conf)==null?void 0:i.connection)==null?void 0:s.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=C(l),e.__value=3,y(e,e.__value)},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r&2&&l!==(l=(((c=(f=a[1].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&q(n,l)},d(a){a&&T(e)}}}function xa(t){var k,w,A,F;let e,l=(((w=(k=t[1].conf)==null?void 0:k.connection)==null?void 0:w.ssid)??"SSID")+"",n,i,s,a,r,f,c,_=(((F=(A=t[1].conf)==null?void 0:A.connection)==null?void 0:F.psk)??"Password")+"",m,d,h,b,g;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),f=v(),c=p("div"),m=C(_),d=p("br"),h=v(),b=p("input"),u(a,"name","ss"),u(a,"type","text"),u(a,"class","in-s"),a.required=r=t[3]==1||t[3]==2,u(e,"class","my-3"),u(b,"name","sp"),u(b,"type","password"),u(b,"class","in-s"),u(b,"autocomplete","off"),b.required=g=t[3]==2,u(c,"class","my-3")},m(L,M){P(L,e,M),o(e,n),o(e,i),o(e,s),o(e,a),P(L,f,M),P(L,c,M),o(c,m),o(c,d),o(c,h),o(c,b)},p(L,M){var R,O,H,K;M&2&&l!==(l=(((O=(R=L[1].conf)==null?void 0:R.connection)==null?void 0:O.ssid)??"SSID")+"")&&q(n,l),M&8&&r!==(r=L[3]==1||L[3]==2)&&(a.required=r),M&2&&_!==(_=(((K=(H=L[1].conf)==null?void 0:H.connection)==null?void 0:K.psk)??"Password")+"")&&q(m,_),M&8&&g!==(g=L[3]==2)&&(b.required=g)},d(L){L&&(T(e),T(f),T(c))}}}function ef(t){let e,l,n,i,s,a,r,f;return r=new hu({}),{c(){e=p("br"),l=v(),n=p("div"),i=p("input"),s=v(),a=p("select"),Te(r.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=t[2],u(a,"name","su"),u(a,"class","in-l"),a.required=t[2],u(n,"class","flex")},m(c,_){P(c,e,_),P(c,l,_),P(c,n,_),o(n,i),o(n,s),o(n,a),Me(r,a,null),f=!0},p(c,_){(!f||_&4)&&(i.required=c[2]),(!f||_&4)&&(a.required=c[2])},i(c){f||(Z(r.$$.fragment,c),f=!0)},o(c){ie(r.$$.fragment,c),f=!1},d(c){c&&(T(e),T(l),T(n)),Ne(r)}}}function tf(t){var g,k,w,A;let e,l,n=(((k=(g=t[1].conf)==null?void 0:g.network)==null?void 0:k.gw)??"Gateway")+"",i,s,a,r,f,c,_=(((A=(w=t[1].conf)==null?void 0:w.network)==null?void 0:A.dns)??"DNS")+"",m,d,h,b;return{c(){e=p("div"),l=p("div"),i=C(n),s=p("br"),a=v(),r=p("input"),f=v(),c=p("div"),m=C(_),d=p("br"),h=v(),b=p("input"),u(r,"name","sg"),u(r,"type","text"),u(r,"class","in-f w-full"),u(b,"name","sd"),u(b,"type","text"),u(b,"class","in-l w-full"),u(e,"class","my-3 flex")},m(F,L){P(F,e,L),o(e,l),o(l,i),o(l,s),o(l,a),o(l,r),o(e,f),o(e,c),o(c,m),o(c,d),o(c,h),o(c,b)},p(F,L){var M,R,O,H;L&2&&n!==(n=(((R=(M=F[1].conf)==null?void 0:M.network)==null?void 0:R.gw)??"Gateway")+"")&&q(i,n),L&2&&_!==(_=(((H=(O=F[1].conf)==null?void 0:O.network)==null?void 0:H.dns)??"DNS")+"")&&q(m,_)},d(F){F&&T(e)}}}function Pc(t){var j,ne,fe,me,he,pe,Se,we,Le,qe,Re,re;let e,l,n,i,s,a,r=(((j=t[1].setup)==null?void 0:j.title)??"Setup")+"",f,c,_,m=(((fe=(ne=t[1].conf)==null?void 0:ne.connection)==null?void 0:fe.title)??"Connection")+"",d,h,b,g,k,w=(((he=(me=t[1].conf)==null?void 0:me.connection)==null?void 0:he.wifi)??"Connect to WiFi")+"",A,F,L=(((Se=(pe=t[1].conf)==null?void 0:pe.connection)==null?void 0:Se.ap)??"Standalone access point")+"",M,R,O,H,K=(((Le=(we=t[1].conf)==null?void 0:we.general)==null?void 0:Le.hostname)??"Hostname")+"",W,N,B,X,G,V,Y,U,z=(((qe=t[1].setup)==null?void 0:qe.static)??"Static IP")+"",se,le,Q,ee,ue,ae,x=(((Re=t[1].btn)==null?void 0:Re.save)??"Save")+"",_e,oe,J,$,ve,ke,D=t[0].if&&t[0].if.eth&&$a(t),S=(t[3]==1||t[3]==2)&&xa(t),I=t[2]&&ef(t),E=t[2]&&tf(t);return J=new sl({props:{active:t[4],message:((re=t[1].setup)==null?void 0:re.mask)??"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),s=v(),a=p("strong"),f=C(r),c=v(),_=p("div"),d=C(m),h=p("br"),b=v(),g=p("select"),k=p("option"),A=C(w),F=p("option"),M=C(L),D&&D.c(),R=v(),S&&S.c(),O=v(),H=p("div"),W=C(K),N=v(),B=p("input"),X=v(),G=p("div"),V=p("label"),Y=p("input"),U=v(),se=C(z),le=v(),I&&I.c(),Q=v(),E&&E.c(),ee=v(),ue=p("div"),ae=p("button"),_e=C(x),oe=v(),Te(J.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(a,"class","text-sm"),k.__value=1,y(k,k.__value),F.__value=2,y(F,F.__value),u(g,"name","sc"),u(g,"class","in-s"),t[3]===void 0&&At(()=>t[6].call(g)),u(_,"class","my-3"),u(B,"name","sh"),u(B,"type","text"),u(B,"class","in-s"),u(B,"maxlength","32"),u(B,"pattern","[a-z0-9_-]+"),u(B,"placeholder","Optional, ex.: ams-reader"),u(B,"autocomplete","off"),u(Y,"type","checkbox"),u(Y,"name","sm"),Y.__value="static",y(Y,Y.__value),u(Y,"class","rounded mb-1"),u(G,"class","my-3"),u(ae,"type","submit"),u(ae,"class","btn-pri"),u(ue,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Ce,Ue){P(Ce,e,Ue),o(e,l),o(l,n),o(n,i),o(n,s),o(n,a),o(a,f),o(n,c),o(n,_),o(_,d),o(_,h),o(_,b),o(_,g),o(g,k),o(k,A),o(g,F),o(F,M),D&&D.m(g,null),Xe(g,t[3],!0),o(n,R),S&&S.m(n,null),o(n,O),o(n,H),o(H,W),o(H,N),o(H,B),y(B,t[0].hostname),o(n,X),o(n,G),o(G,V),o(V,Y),Y.checked=t[2],o(V,U),o(V,se),o(G,le),I&&I.m(G,null),o(n,Q),E&&E.m(n,null),o(n,ee),o(n,ue),o(ue,ae),o(ae,_e),P(Ce,oe,Ue),Me(J,Ce,Ue),$=!0,ve||(ke=[ce(g,"change",t[6]),ce(B,"input",t[7]),ce(Y,"change",t[8]),ce(n,"submit",zl(t[5]))],ve=!0)},p(Ce,[Ue]){var _t,et,tt,lt,ot,Ze,bt,st,Tt,Oe,De,He;(!$||Ue&2)&&r!==(r=(((_t=Ce[1].setup)==null?void 0:_t.title)??"Setup")+"")&&q(f,r),(!$||Ue&2)&&m!==(m=(((tt=(et=Ce[1].conf)==null?void 0:et.connection)==null?void 0:tt.title)??"Connection")+"")&&q(d,m),(!$||Ue&2)&&w!==(w=(((ot=(lt=Ce[1].conf)==null?void 0:lt.connection)==null?void 0:ot.wifi)??"Connect to WiFi")+"")&&q(A,w),(!$||Ue&2)&&L!==(L=(((bt=(Ze=Ce[1].conf)==null?void 0:Ze.connection)==null?void 0:bt.ap)??"Standalone access point")+"")&&q(M,L),Ce[0].if&&Ce[0].if.eth?D?D.p(Ce,Ue):(D=$a(Ce),D.c(),D.m(g,null)):D&&(D.d(1),D=null),Ue&8&&Xe(g,Ce[3]),Ce[3]==1||Ce[3]==2?S?S.p(Ce,Ue):(S=xa(Ce),S.c(),S.m(n,O)):S&&(S.d(1),S=null),(!$||Ue&2)&&K!==(K=(((Tt=(st=Ce[1].conf)==null?void 0:st.general)==null?void 0:Tt.hostname)??"Hostname")+"")&&q(W,K),Ue&1&&B.value!==Ce[0].hostname&&y(B,Ce[0].hostname),Ue&4&&(Y.checked=Ce[2]),(!$||Ue&2)&&z!==(z=(((Oe=Ce[1].setup)==null?void 0:Oe.static)??"Static IP")+"")&&q(se,z),Ce[2]?I?(I.p(Ce,Ue),Ue&4&&Z(I,1)):(I=ef(Ce),I.c(),Z(I,1),I.m(G,null)):I&&(ht(),ie(I,1,1,()=>{I=null}),vt()),Ce[2]?E?E.p(Ce,Ue):(E=tf(Ce),E.c(),E.m(n,ee)):E&&(E.d(1),E=null),(!$||Ue&2)&&x!==(x=(((De=Ce[1].btn)==null?void 0:De.save)??"Save")+"")&&q(_e,x);const it={};Ue&16&&(it.active=Ce[4]),Ue&2&&(it.message=((He=Ce[1].setup)==null?void 0:He.mask)??"Saving"),J.$set(it)},i(Ce){$||(Z(I),Z(J.$$.fragment,Ce),$=!0)},o(Ce){ie(I),ie(J.$$.fragment,Ce),$=!1},d(Ce){Ce&&(T(e),T(oe)),D&&D.d(),S&&S.d(),I&&I.d(),E&&E.d(),Ne(J,Ce),ve=!1,Lt(ke)}}}function Ec(t,e,l){let n={};hl.subscribe(h=>{l(1,n=h)});let{sysinfo:i={}}=e,s=!1,a=1,r=!1;function f(h){al.update(b=>(b.trying=h,b))}async function c(h){l(4,r=!0);const b=new FormData(h.target),g=new URLSearchParams;for(let A of b){const[F,L]=A;g.append(F,L)}let w=await(await fetch("save",{method:"POST",body:g})).json();l(4,r=!1),al.update(A=>(A.hostname=b.get("sh"),A.usrcfg=w.success,A.booting=w.reboot,s&&(A.net.ip=b.get("si"),A.net.mask=b.get("su"),A.net.gw=b.get("sg"),A.net.dns1=b.get("sd")),w.reboot&&setTimeout(qn,5e3,i,f),A))}function _(){a=yt(this),l(3,a)}function m(){i.hostname=this.value,l(0,i)}function d(){s=this.checked,l(2,s)}return t.$$set=h=>{"sysinfo"in h&&l(0,i=h.sysinfo)},[i,n,s,a,r,c,_,m,d]}class qc extends Nt{constructor(e){super(),Mt(this,e,Ec,Pc,St,{sysinfo:0})}}function Dc(t){var W,N,B,X;let e,l,n,i=(((W=t[2].upload)==null?void 0:W.title)??"Upload")+"",s,a,r,f,c,_=(((N=t[2].upload)==null?void 0:N.desc)??"")+"",m,d,h,b,g,k,w,A,F=(((B=t[2].btn)==null?void 0:B.upload)??"Upload")+"",L,M,R,O,H,K;return R=new sl({props:{active:t[3],message:((X=t[2].upload)==null?void 0:X.mask)??"Uploading"}}),{c(){e=p("div"),l=p("div"),n=p("strong"),s=C(i),a=v(),r=C(t[1]),f=v(),c=p("p"),m=C(_),d=v(),h=p("form"),b=p("input"),g=v(),k=p("div"),w=p("button"),A=p("p"),L=C(F),M=v(),Te(R.$$.fragment),u(c,"class","mb-4"),u(b,"name","file"),u(b,"type","file"),u(A,"class","mb-4"),u(w,"type","submit"),u(w,"class","btn-pri"),u(k,"class","w-full text-right mt-4"),u(h,"action",t[0]),u(h,"enctype","multipart/form-data"),u(h,"method","post"),u(h,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(G,V){P(G,e,V),o(e,l),o(l,n),o(n,s),o(n,a),o(n,r),o(l,f),o(l,c),o(c,m),o(l,d),o(l,h),o(h,b),o(h,g),o(h,k),o(k,w),o(w,A),o(A,L),P(G,M,V),Me(R,G,V),O=!0,H||(K=ce(h,"submit",t[4]),H=!0)},p(G,[V]){var U,z,se,le;(!O||V&4)&&i!==(i=(((U=G[2].upload)==null?void 0:U.title)??"Upload")+"")&&q(s,i),(!O||V&2)&&q(r,G[1]),(!O||V&4)&&_!==(_=(((z=G[2].upload)==null?void 0:z.desc)??"")+"")&&q(m,_),(!O||V&4)&&F!==(F=(((se=G[2].btn)==null?void 0:se.upload)??"Upload")+"")&&q(L,F),(!O||V&1)&&u(h,"action",G[0]);const Y={};V&8&&(Y.active=G[3]),V&4&&(Y.message=((le=G[2].upload)==null?void 0:le.mask)??"Uploading"),R.$set(Y)},i(G){O||(Z(R.$$.fragment,G),O=!0)},o(G){ie(R.$$.fragment,G),O=!1},d(G){G&&(T(e),T(M)),Ne(R,G),H=!1,K()}}}function Ac(t,e,l){let{action:n}=e,{title:i}=e,s={};hl.subscribe(f=>{l(2,s=f)});let a=!1;const r=()=>l(3,a=!0);return t.$$set=f=>{"action"in f&&l(0,n=f.action),"title"in f&&l(1,i=f.title)},[n,i,s,a,r]}class zi extends Nt{constructor(e){super(),Mt(this,e,Ac,Dc,St,{action:0,title:1})}}function Lc(t){var J,$,ve,ke,D,S,I;let e,l,n,i,s=(((J=t[1].consent)==null?void 0:J.title)??"Consents")+"",a,r,f,c,_,m=((($=t[1].consent)==null?void 0:$.one_click)??"One-click")+"",d,h,b,g,k=(((ve=t[1].consent)==null?void 0:ve.read_more)??"Read more")+"",w,A,F,L,M,R,O,H=(((ke=t[1].consent)==null?void 0:ke.yes)??"Yes")+"",K,W,N,B,X,G,V=(((D=t[1].consent)==null?void 0:D.no)??"No")+"",Y,U,z,se,le,Q=(((S=t[1].btn)==null?void 0:S.save)??"Save")+"",ee,ue,ae,x,_e,oe;return ae=new sl({props:{active:t[2],message:((I=t[1].consent)==null?void 0:I.mask_saving)??"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("div"),a=C(s),r=v(),f=p("hr"),c=v(),_=p("div"),d=C(m),h=p("br"),b=v(),g=p("a"),w=C(k),A=p("br"),F=v(),L=p("label"),M=p("input"),O=v(),K=C(H),W=v(),N=p("label"),B=p("input"),G=v(),Y=C(V),U=p("br"),z=v(),se=p("div"),le=p("button"),ee=C(Q),ue=v(),Te(ae.$$.fragment),u(g,"href",cl("Data-collection-on-one-click-firmware-upgrade")),u(g,"target","_blank"),u(g,"class","text-blue-600 hover:text-blue-800"),u(M,"type","radio"),u(M,"name","sf"),M.value=1,M.checked=R=t[0].fwconsent===1,u(M,"class","rounded m-2"),M.required=!0,u(B,"type","radio"),u(B,"name","sf"),B.value=2,B.checked=X=t[0].fwconsent===2,u(B,"class","rounded m-2"),B.required=!0,u(_,"class","my-3"),u(le,"type","submit"),u(le,"class","btn-pri"),u(se,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(E,j){P(E,e,j),o(e,l),o(l,n),o(n,i),o(i,a),o(n,r),o(n,f),o(n,c),o(n,_),o(_,d),o(_,h),o(_,b),o(_,g),o(g,w),o(_,A),o(_,F),o(_,L),o(L,M),o(L,O),o(L,K),o(_,W),o(_,N),o(N,B),o(N,G),o(N,Y),o(_,U),o(n,z),o(n,se),o(se,le),o(le,ee),P(E,ue,j),Me(ae,E,j),x=!0,_e||(oe=ce(n,"submit",zl(t[3])),_e=!0)},p(E,[j]){var fe,me,he,pe,Se,we,Le;(!x||j&2)&&s!==(s=(((fe=E[1].consent)==null?void 0:fe.title)??"Consents")+"")&&q(a,s),(!x||j&2)&&m!==(m=(((me=E[1].consent)==null?void 0:me.one_click)??"One-click")+"")&&q(d,m),(!x||j&2)&&k!==(k=(((he=E[1].consent)==null?void 0:he.read_more)??"Read more")+"")&&q(w,k),(!x||j&1&&R!==(R=E[0].fwconsent===1))&&(M.checked=R),(!x||j&2)&&H!==(H=(((pe=E[1].consent)==null?void 0:pe.yes)??"Yes")+"")&&q(K,H),(!x||j&1&&X!==(X=E[0].fwconsent===2))&&(B.checked=X),(!x||j&2)&&V!==(V=(((Se=E[1].consent)==null?void 0:Se.no)??"No")+"")&&q(Y,V),(!x||j&2)&&Q!==(Q=(((we=E[1].btn)==null?void 0:we.save)??"Save")+"")&&q(ee,Q);const ne={};j&4&&(ne.active=E[2]),j&2&&(ne.message=((Le=E[1].consent)==null?void 0:Le.mask_saving)??"Saving"),ae.$set(ne)},i(E){x||(Z(ae.$$.fragment,E),x=!0)},o(E){ie(ae.$$.fragment,E),x=!1},d(E){E&&(T(e),T(ue)),Ne(ae,E),_e=!1,oe()}}}function Oc(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,s={};hl.subscribe(f=>{l(1,s=f)});let a=!1;async function r(f){l(2,a=!0);const c=new FormData(f.target),_=new URLSearchParams;for(let h of c){const[b,g]=h;_.append(b,g)}let d=await(await fetch("save",{method:"POST",body:_})).json();l(2,a=!1),al.update(h=>(h.fwconsent=c.sf===!0?1:c.sf===!1?2:0,h.booting=d.reboot,h)),Il(n)}return t.$$set=f=>{"basepath"in f&&l(4,n=f.basepath),"sysinfo"in f&&l(0,i=f.sysinfo)},[i,s,a,r,n]}class Ic extends Nt{constructor(e){super(),Mt(this,e,Oc,Lc,St,{basepath:4,sysinfo:0})}}function lf(t,e,l){const n=t.slice();return n[30]=e[l],n[31]=e,n[32]=l,n}function nf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Rc(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function sf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Fc(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function of(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function af(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function ff(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function uf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function rf(t){let e,l=gt(t[1].o),n=[];for(let i=0;i0?"text-green-600":"text-gray-300"),u(it,"class",et=t[32]{l(0,i=U)});let s=["mo","tu","we","th","fr","sa","su"],a={},r=!0,f=!1;du.subscribe(U=>{U.o&&(l(1,a=U),l(2,r=!1))}),M0();async function c(U){l(3,f=!0);const z=new URLSearchParams;z.append("r","true"),z.append("rc",a.o.length),a.o.forEach(function(le,Q){z.append("rt"+Q,le.t),z.append("rn"+Q,le.n),z.append("rd"+Q,le.d),z.append("ra"+Q,le.a),z.append("rh"+Q,le.h),z.append("rv"+Q,le.v),z.append("rsm"+Q,le.s.m),z.append("rsd"+Q,le.s.d),z.append("rem"+Q,le.e.m),z.append("red"+Q,le.e.d)}),await(await fetch("save",{method:"POST",body:z})).json(),l(3,f=!1),Il(n+"configuration")}let _=function(U,z){return U.includes(z)?U=U.filter(function(se){return se!==z}):U.push(z),U},m=function(){let U=a.o;U.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}}),l(1,a.o=U,a)},d=function(U){let z=a.o;z.splice(U,1),l(1,a.o=z,a)},h=function(U){if(U<=0)return;let z=a.o;var se=z[U];z[U]=z[U-1],z[U-1]=se,l(1,a.o=z,a)},b=function(U){let z=a.o;if(!(U>=z.length-1)){var se=z[U];z[U]=z[U+1],z[U+1]=se,l(1,a.o=z,a)}};function g(U,z){U[z].n=this.value,l(1,a)}function k(U,z){U[z].d=yt(this),l(1,a)}function w(U,z){U[z].t=yt(this),l(1,a)}function A(U,z){U[z].v=Ke(this.value),l(1,a)}const F=(U,z,se,le)=>l(1,se[le].a=_(U.a,z),a),L=(U,z,se,le)=>l(1,se[le].h=_(U.h,z),a),M=(U,z,se,le)=>l(1,se[le].h=_(U.h,z+8),a),R=(U,z,se,le)=>l(1,se[le].h=_(U.h,z+16),a);function O(U,z){U[z].s.d=yt(this),l(1,a)}function H(U,z){U[z].s.m=yt(this),l(1,a)}function K(U,z){U[z].e.d=yt(this),l(1,a)}function W(U,z){U[z].e.m=yt(this),l(1,a)}const N=U=>h(U),B=U=>h(U),X=U=>b(U),G=U=>b(U),V=U=>d(U),Y=U=>d(U);return t.$$set=U=>{"basepath"in U&&l(11,n=U.basepath)},[i,a,r,f,s,c,_,m,d,h,b,n,g,k,w,A,F,L,M,R,O,H,K,W,N,B,X,G,V,Y]}class yc extends Nt{constructor(e){super(),Mt(this,e,Hc,jc,St,{basepath:11},null,[-1,-1])}}function bf(t,e,l){const n=t.slice();return n[13]=e[l],n[14]=e,n[15]=l,n}function gf(t,e,l){const n=t.slice();return n[13]=e[l],n[16]=e,n[17]=l,n}function kf(t){let e,l,n,i=gt(t[1]),s=[];for(let a=0;a{l(3,r=k)});let f=!1,c,_;async function m(){if(confirm("Clear all data?"))for(let k in i)(k.startsWith("i")||k.startsWith("e"))&&l(0,i[k]=0,i)}let d=!1;async function h(k){l(5,d=!0);const w=new FormData(k.target),A=new URLSearchParams;for(let L of w){const[M,R]=L;A.append(M,R)}await(await fetch(s,{method:"POST",body:A})).json(),l(5,d=!1),Il(a)}function b(k){i[k.key]=Ke(this.value),l(0,i)}function g(k){i[k.key]=Ke(this.value),l(0,i)}return t.$$set=k=>{"prefix"in k&&l(8,n=k.prefix),"data"in k&&l(0,i=k.data),"url"in k&&l(9,s=k.url),"basepath"in k&&l(10,a=k.basepath)},t.$$.update=()=>{if(t.$$.dirty&263){l(1,c=[]),l(2,_=[]);for(let k in i){let w=[];k.startsWith("i")?w=c:k.startsWith("e")&&(w=_,i[k]&&l(4,f=!0)),w.push({key:k,name:n+" "+k.substring(1),value:i[k]})}}},[i,c,_,r,f,d,m,h,n,s,a,b,g]}class bu extends Nt{constructor(e){super(),Mt(this,e,Wc,zc,St,{prefix:8,data:0,url:9,basepath:10})}}function Gc(t){let e,l;return e=new C0({props:{data:t[7],sysinfo:t[6],prices:t[1],dayPlot:t[2],monthPlot:t[3],temperatures:t[4],translations:t[5],tariffData:t[8]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.data=n[7]),i&64&&(s.sysinfo=n[6]),i&2&&(s.prices=n[1]),i&4&&(s.dayPlot=n[2]),i&8&&(s.monthPlot=n[3]),i&16&&(s.temperatures=n[4]),i&32&&(s.translations=n[5]),i&256&&(s.tariffData=n[8]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Vc(t){let e,l;return e=new fc({props:{sysinfo:t[6],basepath:t[0],data:t[7]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.sysinfo=n[6]),i&1&&(s.basepath=n[0]),i&128&&(s.data=n[7]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Kc(t){let e,l;return e=new yc({props:{basepath:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Yc(t){let e,l;return e=new kc({props:{sysinfo:t[6],data:t[7]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.sysinfo=n[6]),i&128&&(s.data=n[7]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Qc(t){let e,l;return e=new zi({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:Ve,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Xc(t){let e,l;return e=new zi({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:Ve,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Zc(t){let e,l;return e=new zi({props:{title:"private key",action:"/mqtt-key"}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:Ve,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Jc(t){let e,l;return e=new Ic({props:{sysinfo:t[6],basepath:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.sysinfo=n[6]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function $c(t){let e,l;return e=new qc({props:{sysinfo:t[6]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.sysinfo=n[6]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function xc(t){let e,l;return e=new Tc({props:{sysinfo:t[6],basepath:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.sysinfo=n[6]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function e_(t){let e,l;return e=new bu({props:{prefix:"UTC Hour",data:t[2],url:"/dayplot",basepath:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&4&&(s.data=n[2]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function t_(t){let e,l;return e=new bu({props:{prefix:"Day",data:t[3],url:"/monthplot",basepath:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&8&&(s.data=n[3]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function l_(t){let e,l,n,i,s,a,r,f,c,_,m,d,h,b,g,k,w,A,F,L,M,R,O,H,K,W;return e=new N1({props:{data:t[7],basepath:t[0]}}),n=new ml({props:{path:"/",$$slots:{default:[Gc]},$$scope:{ctx:t}}}),s=new ml({props:{path:"/configuration",$$slots:{default:[Vc]},$$scope:{ctx:t}}}),r=new ml({props:{path:"/priceconfig",$$slots:{default:[Kc]},$$scope:{ctx:t}}}),c=new ml({props:{path:"/status",$$slots:{default:[Yc]},$$scope:{ctx:t}}}),m=new ml({props:{path:"/mqtt-ca",$$slots:{default:[Qc]},$$scope:{ctx:t}}}),h=new ml({props:{path:"/mqtt-cert",$$slots:{default:[Xc]},$$scope:{ctx:t}}}),g=new ml({props:{path:"/mqtt-key",$$slots:{default:[Zc]},$$scope:{ctx:t}}}),w=new ml({props:{path:"/consent",$$slots:{default:[Jc]},$$scope:{ctx:t}}}),F=new ml({props:{path:"/setup",$$slots:{default:[$c]},$$scope:{ctx:t}}}),M=new ml({props:{path:"/vendor",$$slots:{default:[xc]},$$scope:{ctx:t}}}),O=new ml({props:{path:"/edit-day",$$slots:{default:[e_]},$$scope:{ctx:t}}}),K=new ml({props:{path:"/edit-month",$$slots:{default:[t_]},$$scope:{ctx:t}}}),{c(){Te(e.$$.fragment),l=v(),Te(n.$$.fragment),i=v(),Te(s.$$.fragment),a=v(),Te(r.$$.fragment),f=v(),Te(c.$$.fragment),_=v(),Te(m.$$.fragment),d=v(),Te(h.$$.fragment),b=v(),Te(g.$$.fragment),k=v(),Te(w.$$.fragment),A=v(),Te(F.$$.fragment),L=v(),Te(M.$$.fragment),R=v(),Te(O.$$.fragment),H=v(),Te(K.$$.fragment)},m(N,B){Me(e,N,B),P(N,l,B),Me(n,N,B),P(N,i,B),Me(s,N,B),P(N,a,B),Me(r,N,B),P(N,f,B),Me(c,N,B),P(N,_,B),Me(m,N,B),P(N,d,B),Me(h,N,B),P(N,b,B),Me(g,N,B),P(N,k,B),Me(w,N,B),P(N,A,B),Me(F,N,B),P(N,L,B),Me(M,N,B),P(N,R,B),Me(O,N,B),P(N,H,B),Me(K,N,B),W=!0},p(N,B){const X={};B&128&&(X.data=N[7]),B&1&&(X.basepath=N[0]),e.$set(X);const G={};B&1022&&(G.$$scope={dirty:B,ctx:N}),n.$set(G);const V={};B&705&&(V.$$scope={dirty:B,ctx:N}),s.$set(V);const Y={};B&513&&(Y.$$scope={dirty:B,ctx:N}),r.$set(Y);const U={};B&704&&(U.$$scope={dirty:B,ctx:N}),c.$set(U);const z={};B&512&&(z.$$scope={dirty:B,ctx:N}),m.$set(z);const se={};B&512&&(se.$$scope={dirty:B,ctx:N}),h.$set(se);const le={};B&512&&(le.$$scope={dirty:B,ctx:N}),g.$set(le);const Q={};B&577&&(Q.$$scope={dirty:B,ctx:N}),w.$set(Q);const ee={};B&576&&(ee.$$scope={dirty:B,ctx:N}),F.$set(ee);const ue={};B&577&&(ue.$$scope={dirty:B,ctx:N}),M.$set(ue);const ae={};B&517&&(ae.$$scope={dirty:B,ctx:N}),O.$set(ae);const x={};B&521&&(x.$$scope={dirty:B,ctx:N}),K.$set(x)},i(N){W||(Z(e.$$.fragment,N),Z(n.$$.fragment,N),Z(s.$$.fragment,N),Z(r.$$.fragment,N),Z(c.$$.fragment,N),Z(m.$$.fragment,N),Z(h.$$.fragment,N),Z(g.$$.fragment,N),Z(w.$$.fragment,N),Z(F.$$.fragment,N),Z(M.$$.fragment,N),Z(O.$$.fragment,N),Z(K.$$.fragment,N),W=!0)},o(N){ie(e.$$.fragment,N),ie(n.$$.fragment,N),ie(s.$$.fragment,N),ie(r.$$.fragment,N),ie(c.$$.fragment,N),ie(m.$$.fragment,N),ie(h.$$.fragment,N),ie(g.$$.fragment,N),ie(w.$$.fragment,N),ie(F.$$.fragment,N),ie(M.$$.fragment,N),ie(O.$$.fragment,N),ie(K.$$.fragment,N),W=!1},d(N){N&&(T(l),T(i),T(a),T(f),T(_),T(d),T(b),T(k),T(A),T(L),T(R),T(H)),Ne(e,N),Ne(n,N),Ne(s,N),Ne(r,N),Ne(c,N),Ne(m,N),Ne(h,N),Ne(g,N),Ne(w,N),Ne(F,N),Ne(M,N),Ne(O,N),Ne(K,N)}}}function n_(t){let e,l,n,i;const s=[o_,s_],a=[];function r(f,c){return f[6].trying?0:1}return e=r(t),l=a[e]=s[e](t),{c(){l.c(),n=Vt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let _=e;e=r(f),e===_?a[e].p(f,c):(ht(),ie(a[_],1,1,()=>{a[_]=null}),vt(),l=a[e],l?l.p(f,c):(l=a[e]=s[e](f),l.c()),Z(l,1),l.m(n.parentNode,n))},i(f){i||(Z(l),i=!0)},o(f){ie(l),i=!1},d(f){f&&T(n),a[e].d(f)}}}function i_(t){let e,l;return e=new sl({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:Ve,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function s_(t){let e,l;return e=new sl({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:Ve,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function o_(t){let e,l;return e=new sl({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[6].trying}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.message="Device is booting, please wait. Trying to reach it on "+n[6].trying),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function a_(t){let e,l,n,i,s,a;l=new Zf({props:{basepath:t[0],$$slots:{default:[l_]},$$scope:{ctx:t}}});const r=[i_,n_],f=[];function c(_,m){return _[6].upgrading?0:_[6].booting?1:-1}return~(i=c(t))&&(s=f[i]=r[i](t)),{c(){e=p("div"),Te(l.$$.fragment),n=v(),s&&s.c(),u(e,"class","container mx-auto m-3")},m(_,m){P(_,e,m),Me(l,e,null),o(e,n),~i&&f[i].m(e,null),a=!0},p(_,[m]){const d={};m&1&&(d.basepath=_[0]),m&1023&&(d.$$scope={dirty:m,ctx:_}),l.$set(d);let h=i;i=c(_),i===h?~i&&f[i].p(_,m):(s&&(ht(),ie(f[h],1,1,()=>{f[h]=null}),vt()),~i?(s=f[i],s?s.p(_,m):(s=f[i]=r[i](_),s.c()),Z(s,1),s.m(e,null)):s=null)},i(_){a||(Z(l.$$.fragment,_),Z(s),a=!0)},o(_){ie(l.$$.fragment,_),ie(s),a=!1},d(_){_&&T(e),Ne(l),~i&&f[i].d()}}}function f_(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i;Bi.subscribe(d=>{l(1,i=d)});let s;iu.subscribe(d=>{l(2,s=d)});let a;su.subscribe(d=>{l(3,a=d)});let r;ou.subscribe(d=>{l(4,r=d)});let f={};hl.subscribe(d=>{l(5,f=d)});let c={};al.subscribe(d=>{var h;l(6,c=d),c.vndcfg===!1?Il(n+"vendor"):c.usrcfg===!1?Il(n+"setup"):c.fwconsent===0&&Il(n+"consent"),c.ui.k===1?document.documentElement.classList.add("dark"):c.ui.k===0?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),c.ui.lang&&c.ui.lang!=((h=f==null?void 0:f.language)==null?void 0:h.code)&&uu(c.ui.lang)});let _={};Yr.subscribe(d=>{l(7,_=d),_0(d)});let m={};return fu.subscribe(d=>{l(8,m=d)}),au(),[n,i,s,a,r,f,c,_,m]}class u_ extends Nt{constructor(e){super(),Mt(this,e,f_,a_,St,{})}}new u_({target:document.getElementById("app")}); +Occurred in: ${i}`:"",a=Ii(t),r=Df(e)?e(a):e;return`<${a}> ${r}${s}`}const Gf=t=>(...e)=>t(Zu(...e)),Vf=Gf(t=>{throw new Error(t)}),Kn=Gf(console.warn),ls=4,Ju=3,$u=2,xu=1,er=1;function tr(t,e){const l=t.default?0:Tl(t.fullPath).reduce((n,i)=>{let s=n;return s+=ls,yu(i)?s+=er:zu(i)?s+=$u:Uf(i)?s-=ls+xu:s+=Ju,s},0);return{route:t,score:l,index:e}}function lr(t){return t.map(tr).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Kf(t,e){let l,n;const[i]=e.split("?"),s=Tl(i),a=s[0]==="",r=lr(t);for(let f=0,c=r.length;f({...m,params:d,uri:w});if(m.default){n=h(e);continue}const b=Tl(m.fullPath),g=Math.max(s.length,b.length);let k=0;for(;k{c===".."?f.pop():c!=="."&&f.push(c)}),$n(`/${f.join("/")}`,n)}function ns(t,e){const{pathname:l,hash:n="",search:i="",state:s}=t,a=Tl(e,!0),r=Tl(l,!0);for(;a.length;)a[0]!==r[0]&&Vf(fn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),r.shift();return{pathname:Ln(...r),hash:n,search:i,state:s}}const is=t=>t.length===1?"":t,Oi=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,s=i?is(Cn(t,l)):"",a=i?Cn(t,0,l):t,r=n?is(Cn(a,e)):"";return{pathname:(n?Cn(a,0,e):a)||"/",search:r,hash:s}},ir=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function sr(t,e,l){return Ln(l,nr(t,e))}function or(t,e){const l=Ai(Wu(t)),n=Tl(l,!0),i=Tl(e,!0).slice(0,n.length),s=Yf({fullPath:l},Ln(...i));return s&&s.uri}const xn="POP",ar="PUSH",fr="REPLACE";function ei(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function ur(t){let e=[],l=ei(t),n=xn;const i=(s=e)=>s.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(s){e.push(s);const a=()=>{l=ei(t),n=xn,i([s])};i([s]);const r=If(t,"popstate",a);return()=>{r(),e=e.filter(f=>f!==s)}},navigate(s,a){const{state:r={},replace:f=!1}=a||{};if(n=f?fr:ar,Af(s))a&&Kn(Wf,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=xn,t.history.go(s);else{const c={...r,_key:Bu()};try{t.history[f?"replaceState":"pushState"](c,"",s)}catch{t.location[f?"replace":"assign"](s)}}l=ei(t),i()}}}function ti(t,e){return{...Oi(e),state:t}}function rr(t="/"){let e=0,l=[ti(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,s){e++,l=l.slice(0,e),l.push(ti(n,s))},replaceState(n,i,s){l[e]=ti(n,s)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const cr=!!(!Dl&&window.document&&window.document.createElement),mr=!Dl&&window.location.origin==="null",Qf=ur(cr&&!mr?window:rr()),{navigate:en}=Qf;let Pl=null,Xf=!0;function _r(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nPl.level||t.level===Pl.level&&_r(t.routerId,Pl.routerId))&&(Pl=t)}function dr(){Pl=null}function hr(){Xf=!1}function ss(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=If(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function vr(t,e){return Number(t.dataset.svnavRouteEnd)===e}function br(t){return/^H[1-6]$/i.test(t.tagName)}function os(t,e=document){return e.querySelector(t)}function gr(t){let l=os(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!vr(l,t);){if(br(l))return l;const n=os("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function kr(t){Promise.resolve(an(t.focusElement)).then(e=>{const l=e||gr(t.id);l||Kn(fn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Xn),!ss(l)&&ss(document.documentElement)})}const wr=(t,e,l)=>(n,i)=>Au().then(()=>{if(!Pl||Xf){hr();return}if(n&&kr(Pl.route),t.announcements&&i){const{path:s,fullPath:a,meta:r,params:f,uri:c}=Pl.route,m=t.createAnnouncement({path:s,fullPath:a,meta:r,params:f,uri:c},an(l));Promise.resolve(m).then(_=>{e.set(_)})}dr()}),Cr="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 Sr(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Of(t[6],Cr)],i={};for(let s=0;s`Navigated to ${Q.uri}`,announcements:!0,...b},w=m,A=Ai(m),F=tn(fi),L=tn(bn),M=!F,R=Nr(),I=h&&!(L&&!L.manageFocus),y=ol("");Nl(t,y,Q=>l(0,r=Q));const K=L?L.disableInlineStyles:g,W=ol([]);Nl(t,W,Q=>l(20,a=Q));const N=ol(null);Nl(t,N,Q=>l(18,i=Q));let B=!1;const X=M?0:L.level+1,V=M?ol((()=>ns(Dl?Oi(_):d.location,A))()):F;Nl(t,V,Q=>l(17,n=Q));const Y=ol(n);Nl(t,Y,Q=>l(19,s=Q));const U=wr(k,y,V),z=Q=>ee=>ee.filter(ue=>ue.id!==Q);function se(Q){if(Dl){if(B)return;const ee=Yf(Q,n.pathname);if(ee)return B=!0,ee}else W.update(ee=>{const ue=z(Q.id)(ee);return ue.push(Q),ue})}function le(Q){W.update(z(Q))}return!M&&m!==as&&Kn(fn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:m}),M&&(Tf(()=>d.listen(ee=>{const ue=ns(ee.location,A);Y.set(n),V.set(ue)})),Tn(fi,V)),Tn(bn,{activeRoute:N,registerRoute:se,unregisterRoute:le,manageFocus:I,level:X,id:R,history:M?d:L.history,basepath:M?A:L.basepath,disableInlineStyles:K}),t.$$set=Q=>{"basepath"in Q&&l(11,m=Q.basepath),"url"in Q&&l(12,_=Q.url),"history"in Q&&l(13,d=Q.history),"primary"in Q&&l(14,h=Q.primary),"a11y"in Q&&l(15,b=Q.a11y),"disableInlineStyles"in Q&&l(16,g=Q.disableInlineStyles),"$$scope"in Q&&l(21,c=Q.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&m!==w&&Kn(fn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const Q=Kf(a,n.pathname);N.set(Q)}if(t.$$.dirty[0]&655360&&M){const Q=!!n.hash,ee=!Q&&I,ue=!Q||n.pathname!==s.pathname;U(ee,ue)}t.$$.dirty[0]&262144&&I&&i&&i.primary&&pr({level:X,routerId:R,route:i})},[r,k,M,R,I,y,K,W,N,V,Y,m,_,d,h,b,g,n,i,s,a,c,f]}class Pr extends qt{constructor(e){super(),Et(this,e,Tr,Mr,Tt,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Zf=Pr;function In(t,e,l=bn,n=fn){tn(l)||Vf(t,s=>`You cannot use ${s} outside of a ${Ii(n)}.`,e)}const Er=t=>{const{subscribe:e}=tn(t);return{subscribe:e}};function Jf(){return In(Hf),Er(fi)}function $f(){const{history:t}=tn(bn);return t}function xf(){const t=tn(Ff);return t?Uu(t,e=>e.base):ol("/")}function eu(){In(zf);const t=xf(),{basepath:e}=tn(bn);return n=>sr(n,an(t),e)}function qr(){In(yf);const t=eu(),{navigate:e}=$f();return(n,i)=>{const s=Af(n)?n:t(n);return e(s,i)}}const Dr=t=>({params:t&16,location:t&8}),fs=t=>({params:Dl?an(t[10]):t[4],location:t[3],navigate:t[11]});function us(t){let e,l;return e=new Zf({props:{primary:t[1],$$slots:{default:[Ir]},$$scope:{ctx:t}}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&2&&(s.primary=n[1]),i&528409&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Ar(t){let e;const l=t[18].default,n=Ti(l,t,t[19],fs);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&524312)&&Ei(n,l,i,i[19],e?Pi(l,i[19],s,Dr):qi(i[19]),fs)},i(i){e||(Z(n,i),e=!0)},o(i){ie(n,i),e=!1},d(i){n&&n.d(i)}}}function Lr(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Dl?an(t[10]):t[4],t[12]];var s=t[0];function a(r,f){let c={};for(let m=0;m{Ne(c,1)}),vt()}s?(e=xi(s,a(r,f)),Te(e.$$.fragment),Z(e.$$.fragment,1),Me(e,l.parentNode,l)):e=null}else if(s){const c=f&7192?oi(i,[f&8&&{location:r[3]},f&2048&&{navigate:r[11]},f&1040&&Fn(Dl?an(r[10]):r[4]),f&4096&&Fn(r[12])]):{};e.$set(c)}},i(r){n||(e&&Z(e.$$.fragment,r),n=!0)},o(r){e&&ie(e.$$.fragment,r),n=!1},d(r){r&&T(l),e&&Ne(e,r)}}}function Ir(t){let e,l,n,i;const s=[Lr,Ar],a=[];function r(f,c){return f[0]!==null?0:1}return e=r(t),l=a[e]=s[e](t),{c(){l.c(),n=Jt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(ht(),ie(a[m],1,1,()=>{a[m]=null}),vt(),l=a[e],l?l.p(f,c):(l=a[e]=s[e](f),l.c()),Z(l,1),l.m(n.parentNode,n))},i(f){i||(Z(l),i=!0)},o(f){ie(l),i=!1},d(f){f&&T(n),a[e].d(f)}}}function Or(t){let e,l,n,i,s,a=[ai(t[7]),{"data-svnav-route-start":t[5]}],r={};for(let _=0;_{f=null}),vt())},i(_){s||(Z(f),s=!0)},o(_){ie(f),s=!1},d(_){_&&(T(e),T(l),T(n),T(i)),f&&f.d(_)}}}const Rr=Lf();function Fr(t,e,l){let n;const i=["path","component","meta","primary"];let s=Gn(e,i),a,r,f,c,{$$slots:m={},$$scope:_}=e,{path:d=""}=e,{component:h=null}=e,{meta:b={}}=e,{primary:g=!0}=e;In(Xn,e);const k=Rr(),{registerRoute:w,unregisterRoute:A,activeRoute:F,disableInlineStyles:L}=tn(bn);Nl(t,F,B=>l(16,a=B));const M=xf();Nl(t,M,B=>l(17,f=B));const R=Jf();Nl(t,R,B=>l(3,r=B));const I=ol(null);let y;const K=ol(),W=ol({});Nl(t,W,B=>l(4,c=B)),Tn(Ff,K),Tn(ju,W),Tn(Hu,I);const N=qr();return Dl||qu(()=>A(k)),t.$$set=B=>{l(24,e=hl(hl({},e),Wn(B))),l(12,s=Gn(e,i)),"path"in B&&l(13,d=B.path),"component"in B&&l(0,h=B.component),"meta"in B&&l(14,b=B.meta),"primary"in B&&l(1,g=B.primary),"$$scope"in B&&l(19,_=B.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const B=d==="",X=Ln(f,d),G={id:k,path:d,meta:b,default:B,fullPath:B?"":X,base:B?f:or(X,r.pathname),primary:g,focusElement:I};K.set(G),l(15,y=w(G))}if(t.$$.dirty&98304&&l(2,n=!!(y||a&&a.id===k)),t.$$.dirty&98308&&n){const{params:B}=y||a;W.set(B)}},e=Wn(e),[h,g,n,r,c,k,F,L,M,R,W,N,s,d,b,y,a,f,m,_]}class Br extends qt{constructor(e){super(),Et(this,e,Fr,Or,Tt,{path:13,component:0,meta:14,primary:1})}}const dl=Br;function Ur(t){let e,l,n,i;const s=t[13].default,a=Ti(s,t,t[12],null);let r=[{href:t[0]},t[2],t[1]],f={};for(let c=0;cl(11,_=I));const F=Du(),L=eu(),{navigate:M}=$f();function R(I){F("click",I),Fu(I)&&(I.preventDefault(),M(n,{state:k,replace:a||g}))}return t.$$set=I=>{l(19,e=hl(hl({},e),Wn(I))),l(18,m=Gn(e,c)),"to"in I&&l(5,b=I.to),"replace"in I&&l(6,g=I.replace),"state"in I&&l(7,k=I.state),"getProps"in I&&l(8,w=I.getProps),"$$scope"in I&&l(12,h=I.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=L(b,_)),t.$$.dirty&2049&&l(10,i=ui(_.pathname,n)),t.$$.dirty&2049&&l(9,s=n===_.pathname),t.$$.dirty&2049&&(a=Oi(n)===ir(_)),t.$$.dirty&512&&l(2,r=s?{"aria-current":"page"}:{}),l(1,f=(()=>{if(Df(w)){const I=w({location:_,href:n,isPartiallyCurrent:i,isCurrent:s});return{...m,...I}}return m})())},e=Wn(e),[n,f,r,A,R,b,g,k,w,s,i,_,h,d]}class Hr extends qt{constructor(e){super(),Et(this,e,jr,Ur,Tt,{to:5,replace:6,state:7,getProps:8})}}const pl=Hr;function $l(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function yr(t,e){return t>218&&t<242?"#23ac05":t>212&&t<248?"#b1d900":t>208&&t<252?"#a3b200":"#b20000"}function Ri(t,e){let l;return t>90?l="#b20000":t>85?l="#b19601":t>80?l="#a3b200":t>75?l="#569f12":l="#23ac05",l}function En(t){return t>75?"#23ac05":t>50?"#77d900":t>25?"#94d900":"#569f12"}function Yn(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 Nt(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function Ge(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 245:return"wESP32";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"µHAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1";case 80:return"Generic ESP32-S3"}return"Unknown"}function hn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Zt(t,e){return t==1||t==2&&e}function _l(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function Gt(t,e){return t==null||isNaN(t)?"-":(isNaN(e)&&(e=t<1?2:t<10?1:0),t.toFixed(e))}function Al(t,e){return t.setTime(t.getTime()+e*36e5),t}function zr(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function Wr(t){return t=="EOE"?"https://transparency.entsoe.eu/":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}let Bn=0;function qn(t,e){var l="";Bn++;var n=function(){setTimeout(qn,1e3,t,e)};if(t.net.ip&&Bn%3==0){if(!t.net.ip){n();return}l="http://"+t.net.ip}else t.hostname&&Bn%3==1?l="http://"+t.hostname:t.hostname&&Bn%3==2?l="http://"+t.hostname+".local":l="";console&&console.log("Trying url "+l),e&&e(l);var i=new XMLHttpRequest;i.timeout=5e3,i.addEventListener("abort",n),i.addEventListener("error",n),i.addEventListener("timeout",n),i.addEventListener("load",function(s){window.location.href=l||"/"}),i.open("GET",l+"/is-alive",!0),i.send()}function el(t){return t.charAt(0).toUpperCase()+t.slice(1)}function rs(t){return t.startsWith("esp32")?"esp32":t}function ul(t,e){let l=[t,e];return typeof t>"u"?(l[0]="-",l[1]=e):t>=1e9?(l[0]=(t/1e6).toFixed(t>1e10?0:1),l[1]="M"+e):t>1e4?(l[0]=(t/1e3).toFixed(t>1e6?0:t>1e5?1:2),l[1]="k"+e):(l[0]=t.toFixed(0),l[1]=e),l}let yn={},ri=[];async function Gr(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),s=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),s}let li;async function tu(){if(ri.length){let t=ri.shift();delete yn[t.resource];try{let e=await Gr(t.resource,t.options);for(let l in t.callbacks)t.callbacks[l](e.clone())}catch(e){console.error("Error calling "+t.resource,e);for(let l in t.callbacks)t.callbacks[l]()}}li&&clearTimeout(li),li=setTimeout(tu,100)}tu();async function vl(t,e={}){let l;return yn[t]?l=yn[t]:(l={resource:t,options:e,callbacks:[]},yn[t]=l,ri.push(l)),new Promise(i=>l.callbacks.push(i))}let Ml={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}};async function Fi(){Ml=await(await vl("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),rl.set(Ml)}const rl=ol(Ml,t=>(Fi(),function(){}));function Vr(t){rl.update(e=>(e.trying=t,e))}let Un=0,cs=-127,ms=null,Kr={};const Yr=Rf(Kr,t=>{let e,l;async function n(){vl("data.json").then(i=>i.json()).then(i=>{t(i),cs!=i.t&&(cs=i.t,setTimeout(Qr,2e3)),ms==null&&i.pe&&i.p!=null&&(ms=i.p,nu()),Ml.upgrading?window.location.reload():(!Ml||!Ml.chip||Ml.booting||Un>1&&!hn(Ml.board))&&(Fi(),El&&clearTimeout(El),El=setTimeout(_i,2e3),ql&&clearTimeout(ql),ql=setTimeout(di,3e3)),El||(El=_i()),ql||(ql=di());let s=5e3;if(hn(Ml.board)&&i.v>2.5){let a=3.3-Math.min(3.3,i.v);a>0&&(s=Math.max(a,.1)*10*5e3)}s>5e3&&console.log("Next in "+s+"ms"),e&&clearTimeout(e),e=setTimeout(n,s),Un=0}).catch(i=>{Un++,Un>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(n,15e3),l||(l=setTimeout(qn,5e3,Ml,Vr))):e=setTimeout(n,hn(Ml.board)?1e4:5e3)})}return n(),function(){clearTimeout(e)}});let ci={},Sn;const Bi=ol(ci);async function lu(){let t=!1;Bi.update(e=>{for(var l=0;l<36;l++){if(e[Nt(l)]==null){t=l<12;break}e[Nt(l)]=e[Nt(l+1)]}return e}),t?nu():Sn=setTimeout(lu,(60-new Date().getMinutes())*6e4)}async function nu(){Sn&&(clearTimeout(Sn),Sn=0),ci=await(await vl("energyprice.json")).json(),Bi.set(ci),Sn=setTimeout(lu,(60-new Date().getMinutes())*6e4)}let mi={},El;async function _i(){El&&(clearTimeout(El),El=0),mi=await(await vl("dayplot.json")).json(),iu.set(mi),El=setTimeout(_i,(60-new Date().getMinutes())*6e4+20)}const iu=ol(mi,t=>function(){});let pi={},ql;async function di(){ql&&(clearTimeout(ql),ql=0),pi=await(await vl("monthplot.json")).json(),su.set(pi),ql=setTimeout(di,(24-new Date().getHours())*36e5+40)}const su=ol(pi,t=>function(){});let hi={};async function Qr(){hi=await(await vl("temperature.json")).json(),ou.set(hi)}const ou=ol(hi,t=>function(){});let vi={},jn;async function au(){jn&&(clearTimeout(jn),jn=0),vi=await(await vl("tariff.json")).json(),fu.set(vi),jn=setTimeout(au,(60-new Date().getMinutes())*6e4+30)}const fu=ol(vi,t=>function(){});let bi=[];const Ui=ol(bi);async function Xr(){bi=await(await vl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Ui.set(bi)}let gi=!1;const bl=ol(gi);async function uu(t){gi=await(await vl("translations.json"+(t?"?lang="+t:""))).json(),bl.set(gi)}uu();function Qn(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 ru(t){await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function cu(t,e){if(!(!e||e.message))if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),s=parseInt(l[2]),a=[...e];a.reverse();let r,f,c;for(let m=0;ms&&(r=_):g==i+1&&(f=_);else if(b==n+1)if(c){let w=c.tag_name.substring(1).split(".");parseInt(w[0]);let A=parseInt(w[1]);parseInt(w[2]),g==A&&(c=_)}else c=_}return f||c||r||!1}else return e[0]}function _s(t){var f;let e=(((f=t[1].header)==null?void 0:f.uptime)??"Up")+"",l,n,i;function s(c,m){return c[2]>1?l1:c[2]>0?t1:c[3]>1?e1:c[3]>0?xr:c[4]>1?$r:c[4]>0?Jr:Zr}let a=s(t),r=a(t);return{c(){l=C(e),n=v(),r.c(),i=Jt()},m(c,m){P(c,l,m),P(c,n,m),r.m(c,m),P(c,i,m)},p(c,m){var _;m&2&&e!==(e=(((_=c[1].header)==null?void 0:_.uptime)??"Up")+"")&&E(l,e),a===(a=s(c))&&r?r.p(c,m):(r.d(1),r=a(c),r&&(r.c(),r.m(i.parentNode,i)))},d(c){c&&(T(l),T(n),T(i)),r.d(c)}}}function Zr(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.seconds)??"s")+"",i;return{c(){e=C(t[0]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&1&&E(e,a[0]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.seconds)??"s")+"")&&E(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function Jr(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.minute)??"m")+"",i;return{c(){e=C(t[4]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&16&&E(e,a[4]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minute)??"m")+"")&&E(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function $r(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.minutes)??"m")+"",i;return{c(){e=C(t[4]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&16&&E(e,a[4]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minutes)??"m")+"")&&E(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function xr(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.hour)??"h")+"",i;return{c(){e=C(t[3]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&8&&E(e,a[3]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hour)??"h")+"")&&E(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function e1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.hours)??"h")+"",i;return{c(){e=C(t[3]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&8&&E(e,a[3]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hours)??"h")+"")&&E(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function t1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.day)??"d")+"",i;return{c(){e=C(t[2]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&4&&E(e,a[2]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.day)??"d")+"")&&E(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function l1(t){var s;let e,l,n=(((s=t[1].common)==null?void 0:s.days)??"d")+"",i;return{c(){e=C(t[2]),l=v(),i=C(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&4&&E(e,a[2]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.days)??"d")+"")&&E(i,n)},d(a){a&&(T(e),T(l),T(i))}}}function n1(t){let e,l=t[0]&&_s(t);return{c(){l&&l.c(),e=Jt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=_s(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:We,o:We,d(n){n&&T(e),l&&l.d(n)}}}function i1(t,e,l){let{epoch:n}=e,i={};bl.subscribe(f=>{l(1,i=f)});let s=0,a=0,r=0;return t.$$set=f=>{"epoch"in f&&l(0,n=f.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(2,s=Math.floor(n/86400)),l(3,a=Math.floor(n/3600)),l(4,r=Math.floor(n/60)))},[n,i,s,a,r]}class s1 extends qt{constructor(e){super(),Et(this,e,i1,n1,Tt,{epoch:0})}}function o1(t){let e,l,n;return{c(){e=p("span"),l=C(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,s){P(i,e,s),o(e,l)},p(i,[s]){s&4&&E(l,i[2]),s&2&&u(e,"title",i[1]),s&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:We,o:We,d(i){i&&T(e)}}}function a1(t,e,l){let{color:n}=e,{title:i}=e,{text:s}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,s=a.text)},[n,i,s]}class sn extends qt{constructor(e){super(),Et(this,e,a1,o1,Tt,{color:0,title:1,text:2})}}function f1(t){let e,l=`${Nt(t[0].getDate())}.${Nt(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Nt(t[0].getHours())}:${Nt(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=C(l),u(e,"class",t[1])},m(i,s){P(i,e,s),o(e,n)},p(i,s){s&1&&l!==(l=`${Nt(i[0].getDate())}.${Nt(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Nt(i[0].getHours())}:${Nt(i[0].getMinutes())}`)&&E(n,l),s&2&&u(e,"class",i[1])},d(i){i&&T(e)}}}function u1(t){var n;let e=`${Nt(t[0].getDate())}. ${t[2].months?(n=t[2].months)==null?void 0:n[t[0].getMonth()]:Nt(t[0].getMonth()+1)} ${Nt(t[0].getHours())}:${Nt(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(i,s){P(i,l,s)},p(i,s){var a;s&5&&e!==(e=`${Nt(i[0].getDate())}. ${i[2].months?(a=i[2].months)==null?void 0:a[i[0].getMonth()]:Nt(i[0].getMonth()+1)} ${Nt(i[0].getHours())}:${Nt(i[0].getMinutes())}`)&&E(l,e)},d(i){i&&T(l)}}}function r1(t){let e;function l(s,a){return s[3]?u1:f1}let n=l(t),i=n(t);return{c(){i.c(),e=Jt()},m(s,a){i.m(s,a),P(s,e,a)},p(s,[a]){n===(n=l(s))&&i?i.p(s,a):(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},i:We,o:We,d(s){s&&T(e),i.d(s)}}}function c1(t,e,l){let n={};bl.subscribe(f=>{l(2,n=f)});let{timestamp:i}=e,{fullTimeColor:s}=e,{offset:a}=e,r;return t.$$set=f=>{"timestamp"in f&&l(0,i=f.timestamp),"fullTimeColor"in f&&l(1,s=f.fullTimeColor),"offset"in f&&l(4,a=f.offset)},t.$$.update=()=>{t.$$.dirty&17&&(l(3,r=Math.abs(new Date().getTime()-i.getTime())<3e5),isNaN(a)||Al(i,a-(24+i.getHours()-i.getUTCHours())%24))},[i,s,n,r,a]}class mu extends qt{constructor(e){super(),Et(this,e,c1,r1,Tt,{timestamp:0,fullTimeColor:1,offset:4})}}function m1(t){let e,l,n;return{c(){e=Ot("svg"),l=Ot("path"),n=Ot("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,s){P(i,e,s),o(e,l),o(e,n)},p:We,i:We,o:We,d(i){i&&T(e)}}}class _1 extends qt{constructor(e){super(),Et(this,e,null,m1,Tt,{})}}function p1(t){let e,l;return{c(){e=Ot("svg"),l=Ot("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){P(n,e,i),o(e,l)},p:We,i:We,o:We,d(n){n&&T(e)}}}class d1 extends qt{constructor(e){super(),Et(this,e,null,p1,Tt,{})}}function h1(t){let e,l;return{c(){e=Ot("svg"),l=Ot("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){P(n,e,i),o(e,l)},p:We,i:We,o:We,d(n){n&&T(e)}}}class v1 extends qt{constructor(e){super(),Et(this,e,null,h1,Tt,{})}}function b1(t){let e,l,n=t[2].version+"",i;return{c(){e=C("AMS reader "),l=p("span"),i=C(n)},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&4&&n!==(n=s[2].version+"")&&E(i,n)},d(s){s&&(T(e),T(l))}}}function ps(t){let e,l=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=C(l),i=C("°C"),u(e,"class","flex-none my-auto")},m(s,a){P(s,e,a),o(e,n),o(e,i)},p(s,a){a&2&&l!==(l=(s[1].t>-50?s[1].t.toFixed(1):"-")+"")&&E(n,l)},d(s){s&&T(e)}}}function ds(t){var i,s,a;let e,l=(((i=t[4].header)==null?void 0:i.han)??"HAN")+": "+(((a=(s=t[4].errors)==null?void 0:s.han)==null?void 0:a[t[1].he])??t[1].he),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),o(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.han)??"HAN")+": "+(((_=(m=r[4].errors)==null?void 0:m.han)==null?void 0:_[r[1].he])??r[1].he))&&E(n,l)},d(r){r&&T(e)}}}function hs(t){var i,s,a;let e,l=(((i=t[4].header)==null?void 0:i.mqtt)??"MQTT")+": "+(((a=(s=t[4].errors)==null?void 0:s.mqtt)==null?void 0:a[t[1].me])??t[1].me),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),o(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.mqtt)??"MQTT")+": "+(((_=(m=r[4].errors)==null?void 0:m.mqtt)==null?void 0:_[r[1].me])??r[1].me))&&E(n,l)},d(r){r&&T(e)}}}function vs(t){var i,s,a;let e,l=(((i=t[4].header)==null?void 0:i.price)??"PS")+": "+(((a=(s=t[4].errors)==null?void 0:s.price)==null?void 0:a[t[1].ee])??t[1].ee),n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),o(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.price)??"PS")+": "+(((_=(m=r[4].errors)==null?void 0:m.price)==null?void 0:_[r[1].ee])??r[1].ee))&&E(n,l)},d(r){r&&T(e)}}}function bs(t){let e,l,n,i,s,a,r,f;return l=new pl({props:{to:"/configuration",$$slots:{default:[g1]},$$scope:{ctx:t}}}),a=new pl({props:{to:"/status",$$slots:{default:[k1]},$$scope:{ctx:t}}}),{c(){var c,m;e=p("div"),Te(l.$$.fragment),i=v(),s=p("div"),Te(a.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title",n=((c=t[4].header)==null?void 0:c.config)??""),u(s,"class","flex-none px-1 mt-1"),u(s,"title",r=((m=t[4].header)==null?void 0:m.status)??"")},m(c,m){P(c,e,m),Me(l,e,null),P(c,i,m),P(c,s,m),Me(a,s,null),f=!0},p(c,m){var h,b;const _={};m&64&&(_.$$scope={dirty:m,ctx:c}),l.$set(_),(!f||m&16&&n!==(n=((h=c[4].header)==null?void 0:h.config)??""))&&u(e,"title",n);const d={};m&64&&(d.$$scope={dirty:m,ctx:c}),a.$set(d),(!f||m&16&&r!==(r=((b=c[4].header)==null?void 0:b.status)??""))&&u(s,"title",r)},i(c){f||(Z(l.$$.fragment,c),Z(a.$$.fragment,c),f=!0)},o(c){ie(l.$$.fragment,c),ie(a.$$.fragment,c),f=!1},d(c){c&&(T(e),T(i),T(s)),Ne(l),Ne(a)}}}function g1(t){let e,l;return e=new _1({}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function k1(t){let e,l;return e=new d1({}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function gs(t){let e,l;function n(a,r){return a[2].security==0||a[1].a?C1:w1}let i=n(t),s=i(t);return{c(){var a;e=p("div"),s.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",l=(((a=t[4].header)==null?void 0:a.new_version)??"New version")+": "+t[3].tag_name)},m(a,r){P(a,e,r),s.m(e,null)},p(a,r){var f;i===(i=n(a))&&s?s.p(a,r):(s.d(1),s=i(a),s&&(s.c(),s.m(e,null))),r&24&&l!==(l=(((f=a[4].header)==null?void 0:f.new_version)??"New version")+": "+a[3].tag_name)&&u(e,"title",l)},d(a){a&&T(e),s.d()}}}function w1(t){var r;let e,l=(((r=t[4].header)==null?void 0:r.new_version)??"New version")+"",n,i,s=t[3].tag_name+"",a;return{c(){e=p("span"),n=C(l),i=C(": "),a=C(s)},m(f,c){P(f,e,c),o(e,n),o(e,i),o(e,a)},p(f,c){var m;c&16&&l!==(l=(((m=f[4].header)==null?void 0:m.new_version)??"New version")+"")&&E(n,l),c&8&&s!==(s=f[3].tag_name+"")&&E(a,s)},d(f){f&&T(e)}}}function C1(t){var m;let e,l,n=(((m=t[4].header)==null?void 0:m.new_version)??"New version")+"",i,s,a=t[3].tag_name+"",r,f,c;return{c(){e=p("button"),l=p("span"),i=C(n),s=C(": "),r=C(a),u(l,"class","mt-1"),u(e,"class","flex")},m(_,d){P(_,e,d),o(e,l),o(l,i),o(l,s),o(l,r),f||(c=ce(e,"click",t[5]),f=!0)},p(_,d){var h;d&16&&n!==(n=(((h=_[4].header)==null?void 0:h.new_version)??"New version")+"")&&E(i,n),d&8&&a!==(a=_[3].tag_name+"")&&E(r,a)},d(_){_&&T(e),f=!1,c()}}}function S1(t){var ne,fe,me,pe,de,Se,ge,Le,qe,Oe;let e,l,n,i,s,a,r,f,c,m,_,d=(((ne=t[4].header)==null?void 0:ne.mem)??"Free")+"",h,b,g=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",k,w,A,F,L,M,R,I,y,K,W,N,B,X,G,V,Y,U,z,se,le,Q,ee,ue,ae,x,_e,oe,J,$,he;i=new pl({props:{to:"/",$$slots:{default:[b1]},$$scope:{ctx:t}}}),f=new s1({props:{epoch:t[1].u}});let ke=t[1].t>-50&&ps(t);L=new sn({props:{title:((fe=t[4].header)==null?void 0:fe.esp)??"ESP",text:t[2].booting?((me=t[4].header)==null?void 0:me.booting)??"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":((pe=t[4].header)==null?void 0:pe.esp)??"ESP",color:$l(t[2].booting?2:t[1].em)}}),R=new sn({props:{title:((de=t[4].header)==null?void 0:de.han)??"HAN",text:((Se=t[4].header)==null?void 0:Se.han)??"HAN",color:$l(t[2].booting?9:t[1].hm)}}),y=new sn({props:{title:((ge=t[4].header)==null?void 0:ge.wifi)??"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":((Le=t[4].header)==null?void 0:Le.wifi)??"WiFi",color:$l(t[2].booting?9:t[1].wm)}}),W=new sn({props:{title:((qe=t[4].header)==null?void 0:qe.mqtt)??"MQTT",text:((Oe=t[4].header)==null?void 0:Oe.mqtt)??"MQTT",color:$l(t[2].booting?9:t[1].mm)}});let D=(t[1].he<0||t[1].he>0)&&ds(t),S=t[1].me<0&&hs(t),O=(t[1].ee>0||t[1].ee<0)&&vs(t);ee=new mu({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let q=t[2].vndcfg&&t[2].usrcfg&&bs(t);oe=new v1({});let j=t[2].fwconsent===1&&t[3]&&gs(t);return{c(){var re;e=p("nav"),l=p("div"),n=p("div"),Te(i.$$.fragment),s=v(),a=p("div"),r=p("div"),Te(f.$$.fragment),c=v(),ke&&ke.c(),m=v(),_=p("div"),h=C(d),b=C(": "),k=C(g),w=C("kb"),A=v(),F=p("div"),Te(L.$$.fragment),M=v(),Te(R.$$.fragment),I=v(),Te(y.$$.fragment),K=v(),Te(W.$$.fragment),N=v(),D&&D.c(),B=v(),S&&S.c(),X=v(),O&&O.c(),G=v(),V=p("div"),Y=p("div"),U=p("a"),z=p("img"),le=v(),Q=p("div"),Te(ee.$$.fragment),ue=v(),q&&q.c(),ae=v(),x=p("div"),_e=p("a"),Te(oe.$$.fragment),$=v(),j&&j.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(r,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(a,"class","flex-none my-auto p-2 flex space-x-4"),u(F,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(z,"class","logo"),zn(z.src,se=(t[0]+"/logo.svg").replace("//","/"))||u(z,"src",se),u(z,"alt","GitHub repo"),u(U,"class","float-right"),u(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(U,"target","_blank"),u(U,"rel","noreferrer"),u(U,"aria-label","GitHub"),u(Y,"class","flex-none"),u(Q,"class","flex-none my-auto px-2"),u(_e,"href",_l("")),u(_e,"target","_blank"),u(_e,"rel","noreferrer"),u(x,"class","flex-none px-1 mt-1"),u(x,"title",J=((re=t[4].header)==null?void 0:re.doc)??""),u(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","hdr")},m(re,Ce){P(re,e,Ce),o(e,l),o(l,n),Me(i,n,null),o(l,s),o(l,a),o(a,r),Me(f,r,null),o(a,c),ke&&ke.m(a,null),o(a,m),o(a,_),o(_,h),o(_,b),o(_,k),o(_,w),o(l,A),o(l,F),Me(L,F,null),o(F,M),Me(R,F,null),o(F,I),Me(y,F,null),o(F,K),Me(W,F,null),o(l,N),D&&D.m(l,null),o(l,B),S&&S.m(l,null),o(l,X),O&&O.m(l,null),o(l,G),o(l,V),o(V,Y),o(Y,U),o(U,z),o(V,le),o(V,Q),Me(ee,Q,null),o(V,ue),q&&q.m(V,null),o(V,ae),o(V,x),o(x,_e),Me(oe,_e,null),o(V,$),j&&j.m(V,null),he=!0},p(re,[Ce]){var tt,gt,it,Dt,Ae,Pe,Fe,Ye,ve,Ee,ye;const Be={};Ce&68&&(Be.$$scope={dirty:Ce,ctx:re}),i.$set(Be);const Ze={};Ce&2&&(Ze.epoch=re[1].u),f.$set(Ze),re[1].t>-50?ke?ke.p(re,Ce):(ke=ps(re),ke.c(),ke.m(a,m)):ke&&(ke.d(1),ke=null),(!he||Ce&16)&&d!==(d=(((tt=re[4].header)==null?void 0:tt.mem)??"Free")+"")&&E(h,d),(!he||Ce&2)&&g!==(g=(re[1].m?(re[1].m/1e3).toFixed(1):"-")+"")&&E(k,g);const bt={};Ce&16&&(bt.title=((gt=re[4].header)==null?void 0:gt.esp)??"ESP"),Ce&22&&(bt.text=re[2].booting?((it=re[4].header)==null?void 0:it.booting)??"Booting":re[1].v>2?re[1].v.toFixed(2)+"V":((Dt=re[4].header)==null?void 0:Dt.esp)??"ESP"),Ce&6&&(bt.color=$l(re[2].booting?2:re[1].em)),L.$set(bt);const Xe={};Ce&16&&(Xe.title=((Ae=re[4].header)==null?void 0:Ae.han)??"HAN"),Ce&16&&(Xe.text=((Pe=re[4].header)==null?void 0:Pe.han)??"HAN"),Ce&6&&(Xe.color=$l(re[2].booting?9:re[1].hm)),R.$set(Xe);const et={};Ce&16&&(et.title=((Fe=re[4].header)==null?void 0:Fe.wifi)??"WiFi"),Ce&18&&(et.text=re[1].r?re[1].r.toFixed(0)+"dBm":((Ye=re[4].header)==null?void 0:Ye.wifi)??"WiFi"),Ce&6&&(et.color=$l(re[2].booting?9:re[1].wm)),y.$set(et);const pt={};Ce&16&&(pt.title=((ve=re[4].header)==null?void 0:ve.mqtt)??"MQTT"),Ce&16&&(pt.text=((Ee=re[4].header)==null?void 0:Ee.mqtt)??"MQTT"),Ce&6&&(pt.color=$l(re[2].booting?9:re[1].mm)),W.$set(pt),re[1].he<0||re[1].he>0?D?D.p(re,Ce):(D=ds(re),D.c(),D.m(l,B)):D&&(D.d(1),D=null),re[1].me<0?S?S.p(re,Ce):(S=hs(re),S.c(),S.m(l,X)):S&&(S.d(1),S=null),re[1].ee>0||re[1].ee<0?O?O.p(re,Ce):(O=vs(re),O.c(),O.m(l,G)):O&&(O.d(1),O=null),(!he||Ce&1&&!zn(z.src,se=(re[0]+"/logo.svg").replace("//","/")))&&u(z,"src",se);const st={};Ce&2&&(st.timestamp=re[1].c?new Date(re[1].c*1e3):new Date(0)),Ce&4&&(st.offset=re[2].clock_offset),ee.$set(st),re[2].vndcfg&&re[2].usrcfg?q?(q.p(re,Ce),Ce&4&&Z(q,1)):(q=bs(re),q.c(),Z(q,1),q.m(V,ae)):q&&(ht(),ie(q,1,1,()=>{q=null}),vt()),(!he||Ce&16&&J!==(J=((ye=re[4].header)==null?void 0:ye.doc)??""))&&u(x,"title",J),re[2].fwconsent===1&&re[3]?j?j.p(re,Ce):(j=gs(re),j.c(),j.m(V,null)):j&&(j.d(1),j=null)},i(re){he||(Z(i.$$.fragment,re),Z(f.$$.fragment,re),Z(L.$$.fragment,re),Z(R.$$.fragment,re),Z(y.$$.fragment,re),Z(W.$$.fragment,re),Z(ee.$$.fragment,re),Z(q),Z(oe.$$.fragment,re),he=!0)},o(re){ie(i.$$.fragment,re),ie(f.$$.fragment,re),ie(L.$$.fragment,re),ie(R.$$.fragment,re),ie(y.$$.fragment,re),ie(W.$$.fragment,re),ie(ee.$$.fragment,re),ie(q),ie(oe.$$.fragment,re),he=!1},d(re){re&&T(e),Ne(i),Ne(f),ke&&ke.d(),Ne(L),Ne(R),Ne(y),Ne(W),D&&D.d(),S&&S.d(),O&&O.d(),Ne(ee),q&&q.d(),Ne(oe),j&&j.d()}}}function M1(t,e,l){let{basepath:n="/"}=e,{data:i={}}=e,s={},a={};function r(){var c;confirm((((c=f.header)==null?void 0:c.upgrade)??"Upgrade to {0}?").replace("{0}",a.tag_name))&&(!hn(s.board)||confirm(Qn(Ge(s.chip,s.board))))&&(rl.update(m=>(m.upgrading=!0,m)),ru(a.tag_name))}rl.subscribe(c=>{l(2,s=c),c.fwconsent===1&&Xr()}),Ui.subscribe(c=>{l(3,a=cu(s.version,c))});let f={};return bl.subscribe(c=>{l(4,f=c)}),t.$$set=c=>{"basepath"in c&&l(0,n=c.basepath),"data"in c&&l(1,i=c.data)},[n,i,s,a,f,r]}class N1 extends qt{constructor(e){super(),Et(this,e,M1,S1,Tt,{basepath:0,data:1})}}function T1(t){let e,l,n,i;return{c(){e=Ot("svg"),l=Ot("path"),n=Ot("path"),u(l,"d",ni(150,150,115,210,510)),u(l,"stroke","rgba(128, 128, 128, 0.15)"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=ni(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(s,a){P(s,e,a),o(e,l),o(e,n)},p(s,[a]){a&1&&i!==(i=ni(150,150,115,210,210+300*s[0]/100))&&u(n,"d",i),a&2&&u(n,"stroke",s[1])},i:We,o:We,d(s){s&&T(e)}}}function ks(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function ni(t,e,l,n,i){var s=ks(t,e,l,i),a=ks(t,e,l,n),r=i-n<=180?"0":"1",f=["M",s.x,s.y,"A",l,l,0,r,0,a.x,a.y].join(" ");return f}function P1(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=s=>{"pct"in s&&l(0,n=s.pct),"color"in s&&l(1,i=s.color)},[n,i]}class E1 extends qt{constructor(e){super(),Et(this,e,P1,T1,Tt,{pct:0,color:1})}}function ws(t){let e,l,n,i,s,a,r,f;return{c(){e=p("br"),l=v(),n=p("span"),i=C(t[1]),s=v(),a=p("span"),r=C(t[2]),f=C("/kWh"),u(n,"class","pl-sub"),u(a,"class","pl-snt")},m(c,m){P(c,e,m),P(c,l,m),P(c,n,m),o(n,i),P(c,s,m),P(c,a,m),o(a,r),o(a,f)},p(c,m){m&2&&E(i,c[1]),m&4&&E(r,c[2])},d(c){c&&(T(e),T(l),T(n),T(s),T(a))}}}function q1(t){let e,l,n,i,s,a,r,f,c,m,_=t[4][0]+"",d,h,b,g=t[4][1]+"",k,w,A;l=new E1({props:{pct:t[5],color:t[3](t[5],document.documentElement.classList.contains("dark"))}});let F=t[1]&&ws(t);return{c(){e=p("div"),Te(l.$$.fragment),n=v(),i=p("span"),s=p("span"),a=C(t[0]),r=v(),f=p("br"),c=v(),m=p("span"),d=C(_),h=v(),b=p("span"),k=C(g),w=v(),F&&F.c(),u(s,"class","pl-lab"),u(m,"class","pl-val"),u(b,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(L,M){P(L,e,M),Me(l,e,null),o(e,n),o(e,i),o(i,s),o(s,a),o(i,r),o(i,f),o(i,c),o(i,m),o(m,d),o(i,h),o(i,b),o(b,k),o(i,w),F&&F.m(i,null),A=!0},p(L,[M]){const R={};M&32&&(R.pct=L[5]),M&40&&(R.color=L[3](L[5],document.documentElement.classList.contains("dark"))),l.$set(R),(!A||M&1)&&E(a,L[0]),(!A||M&16)&&_!==(_=L[4][0]+"")&&E(d,_),(!A||M&16)&&g!==(g=L[4][1]+"")&&E(k,g),L[1]?F?F.p(L,M):(F=ws(L),F.c(),F.m(i,null)):F&&(F.d(1),F=null)},i(L){A||(Z(l.$$.fragment,L),A=!0)},o(L){ie(l.$$.fragment,L),A=!1},d(L){L&&T(e),Ne(l),F&&F.d()}}}function D1(t,e,l){let{val:n}=e,{max:i}=e,{unit:s}=e,{label:a}=e,{sub:r=""}=e,{subunit:f=""}=e,{colorFn:c}=e,m,_=0;return t.$$set=d=>{"val"in d&&l(6,n=d.val),"max"in d&&l(7,i=d.max),"unit"in d&&l(8,s=d.unit),"label"in d&&l(0,a=d.label),"sub"in d&&l(1,r=d.sub),"subunit"in d&&l(2,f=d.subunit),"colorFn"in d&&l(3,c=d.colorFn)},t.$$.update=()=>{t.$$.dirty&448&&(l(4,m=ul(n,s)),l(5,_=Math.min(n,i)/i*100))},[a,r,f,c,m,_,n,i,s]}class _u extends qt{constructor(e){super(),Et(this,e,D1,q1,Tt,{val:6,max:7,unit:8,label:0,sub:1,subunit:2,colorFn:3})}}function Cs(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Ss(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Ms(t,e,l){const n=t.slice();return n[15]=e[l],n}function Ns(t){let e,l,n,i,s,a,r,f=(t[0].title||t[0].link)&&Ts(t),c=kt(t[0].y.ticks),m=[];for(let g=0;g{f=null}),vt()),k&129){c=kt(g[0].y.ticks);let w;for(w=0;w{s=null}),vt())},i(a){n||(Z(s),n=!0)},o(a){ie(s),n=!1},d(a){a&&T(e),i&&i.d(),s&&s.d()}}}function Ps(t){let e,l=t[0].title+"",n,i;return{c(){e=p("div"),n=C(l),u(e,"class","text-sm font-bold"),Bt(()=>t[9].call(e))},m(s,a){P(s,e,a),o(e,n),i=Di(e,t[9].bind(e))},p(s,a){a&1&&l!==(l=s[0].title+"")&&E(n,l)},d(s){s&&T(e),i()}}}function Es(t){let e,l,n,i;const s=[L1,A1],a=[];function r(f,c){return f[0].link.route?0:1}return l=r(t),n=a[l]=s[l](t),{c(){e=p("div"),n.c(),u(e,"class","text-xs text-right")},m(f,c){P(f,e,c),a[l].m(e,null),i=!0},p(f,c){let m=l;l=r(f),l===m?a[l].p(f,c):(ht(),ie(a[m],1,1,()=>{a[m]=null}),vt(),n=a[l],n?n.p(f,c):(n=a[l]=s[l](f),n.c()),Z(n,1),n.m(e,null))},i(f){i||(Z(n),i=!0)},o(f){ie(n),i=!1},d(f){f&&T(e),a[l].d()}}}function A1(t){let e,l=t[0].link.text+"",n,i,s;return{c(){e=p("a"),n=C(l),u(e,"href",i=t[0].link.url),u(e,"target",s=t[0].link.target)},m(a,r){P(a,e,r),o(e,n)},p(a,r){r&1&&l!==(l=a[0].link.text+"")&&E(n,l),r&1&&i!==(i=a[0].link.url)&&u(e,"href",i),r&1&&s!==(s=a[0].link.target)&&u(e,"target",s)},i:We,o:We,d(a){a&&T(e)}}}function L1(t){let e,l;return e=new pl({props:{to:t[0].link.url,$$slots:{default:[I1]},$$scope:{ctx:t}}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.to=n[0].link.url),i&262145&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function I1(t){let e=t[0].link.text+"",l;return{c(){l=C(e)},m(n,i){P(n,l,i)},p(n,i){i&1&&e!==(e=n[0].link.text+"")&&E(l,e)},d(n){n&&T(l)}}}function qs(t){let e,l,n,i=t[15].label+"",s,a,r,f;return{c(){e=Ot("g"),l=Ot("line"),n=Ot("text"),s=C(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",a=t[15].align=="right"?"85%":""),u(e,"class",r="tick tick-"+t[15].value+" tick-"+t[15].color),u(e,"transform",f="translate(0, "+t[7](t[15].value)+")")},m(c,m){P(c,e,m),o(e,l),o(e,n),o(n,s)},p(c,m){m&1&&i!==(i=c[15].label+"")&&E(s,i),m&1&&a!==(a=c[15].align=="right"?"85%":"")&&u(n,"x",a),m&1&&r!==(r="tick tick-"+c[15].value+" tick-"+c[15].color)&&u(e,"class",r),m&129&&f!==(f="translate(0, "+c[7](c[15].value)+")")&&u(e,"transform",f)},d(c){c&&T(e)}}}function Ds(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&qs(t);return{c(){n&&n.c(),l=Jt()},m(i,s){n&&n.m(i,s),P(i,l,s)},p(i,s){s&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,s):(n=qs(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&T(l),n&&n.d(i)}}}function As(t){let e,l,n=(t[3]>20||t[13]%2==0)&&Ls(t);return{c(){e=Ot("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,s){P(i,e,s),n&&n.m(e,null)},p(i,s){i[3]>20||i[13]%2==0?n?n.p(i,s):(n=Ls(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),s&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&T(e),n&&n.d()}}}function Ls(t){let e,l=t[11].label+"",n,i;return{c(){e=Ot("text"),n=C(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(s,a){P(s,e,a),o(e,n)},p(s,a){a&1&&l!==(l=s[11].label+"")&&E(n,l),a&8&&i!==(i=s[3]/2)&&u(e,"x",i)},d(s){s&&T(e)}}}function Is(t){let e=!isNaN(t[6](t[13])),l,n=e&&As(t);return{c(){n&&n.c(),l=Jt()},m(i,s){n&&n.m(i,s),P(i,l,s)},p(i,s){s&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,s):(n=As(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&T(l),n&&n.d(i)}}}function Os(t){let e,l,n=t[11].value!==void 0&&Rs(t),i=t[11].value2>1e-4&&Us(t);return{c(){e=Ot("g"),n&&n.c(),l=Ot("g"),i&&i.c()},m(s,a){P(s,e,a),n&&n.m(e,null),P(s,l,a),i&&i.m(l,null)},p(s,a){s[11].value!==void 0?n?n.p(s,a):(n=Rs(s),n.c(),n.m(e,null)):n&&(n.d(1),n=null),s[11].value2>1e-4?i?i.p(s,a):(i=Us(s),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(s){s&&(T(e),T(l)),n&&n.d(),i&&i.d()}}}function Rs(t){let e,l,n,i,s,a,r,f=t[3]>15&&Fs(t);return{c(){e=Ot("rect"),f&&f.c(),r=Jt(),u(e,"x",l=t[6](t[13])+2),u(e,"y",n=t[7](t[11].value)),u(e,"width",i=t[3]-4),u(e,"height",s=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),u(e,"fill",a=t[11].color)},m(c,m){P(c,e,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&u(e,"x",l),m&129&&n!==(n=c[7](c[11].value))&&u(e,"y",n),m&8&&i!==(i=c[3]-4)&&u(e,"width",i),m&129&&s!==(s=c[7](c[0].y.min)-c[7](Math.min(c[0].y.min,0)+c[11].value))&&u(e,"height",s),m&1&&a!==(a=c[11].color)&&u(e,"fill",a),c[3]>15?f?f.p(c,m):(f=Fs(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(T(e),T(r)),f&&f.d(c)}}}function Fs(t){let e,l=t[11].label+"",n,i,s,a,r,f,c=t[11].title&&Bs(t);return{c(){e=Ot("text"),n=C(l),c&&c.c(),f=Jt(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",s=t[3]t[7](0)-t[8]&&!t[0].dark?t[11].color:"white"),u(e,"transform",r="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]m[7](0)-m[8]&&!m[0].dark?m[11].color:"white")&&u(e,"fill",a),_&457&&r!==(r="translate("+(m[6](m[13])+m[3]/2)+" "+(m[7](m[11].value)>m[7](0)-m[8]?m[7](m[11].value)-m[8]:m[7](m[11].value)+10)+") rotate("+(m[11].labelAngle?m[11].labelAngle:m[3]15&&js(t);return{c(){e=Ot("rect"),f&&f.c(),r=Jt(),u(e,"x",l=t[6](t[13])+2),u(e,"y",n=t[7](0)),u(e,"width",i=t[3]-4),u(e,"height",s=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),u(e,"fill",a=t[11].color2?t[11].color2:t[11].color)},m(c,m){P(c,e,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&u(e,"x",l),m&128&&n!==(n=c[7](0))&&u(e,"y",n),m&8&&i!==(i=c[3]-4)&&u(e,"width",i),m&129&&s!==(s=c[7](c[0].y.min)-c[7](c[0].y.min+c[11].value2))&&u(e,"height",s),m&1&&a!==(a=c[11].color2?c[11].color2:c[11].color)&&u(e,"fill",a),c[3]>15?f?f.p(c,m):(f=js(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(T(e),T(r)),f&&f.d(c)}}}function js(t){let e,l=t[11].label2+"",n,i,s,a,r,f=t[11].title2&&Hs(t);return{c(){e=Ot("text"),n=C(l),f&&f.c(),r=Jt(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor","middle"),u(e,"fill",s=t[7](-t[11].value2)t[10].call(e))},m(s,a){P(s,e,a),i&&i.m(e,null),l=Di(e,t[10].bind(e)),n=!0},p(s,[a]){s[0].x.ticks&&s[0].points&&s[4]?i?(i.p(s,a),a&17&&Z(i,1)):(i=Ns(s),i.c(),Z(i,1),i.m(e,null)):i&&(ht(),ie(i,1,1,()=>{i=null}),vt())},i(s){n||(Z(i),n=!0)},o(s){ie(i),n=!1},d(s){s&&T(e),i&&i.d(),l()}}}let on=30;function R1(t,e,l){let{config:n}=e,i,s,a,r,f,c,m,_=0;function d(){_=this.clientHeight,l(5,_)}function h(){i=this.clientWidth,s=this.clientHeight,l(1,i),l(2,s)}return t.$$set=b=>{"config"in b&&l(0,n=b.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,c=s-_);let b=i-(n.padding.left+n.padding.right);l(3,a=b/n.points.length),l(8,m=an.y.max?w=n.padding.bottom:kc||w<0?0:w})}},[n,i,s,a,c,_,r,f,m,d,h]}class rn extends qt{constructor(e){super(),Et(this,e,R1,O1,Tt,{config:0})}}function F1(t){let e,l;return e=new rn({props:{config:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function B1(t,e,l){let{title:n}=e,{u1:i}=e,{u2:s}=e,{u3:a}=e,{ds:r}=e,f={};function c(m){return{label:Gt(m)+"V",title:m.toFixed(1)+" V",value:isNaN(m)?0:m,color:yr(m||0,document.documentElement.classList.contains("dark"))}}return t.$$set=m=>{"title"in m&&l(1,n=m.title),"u1"in m&&l(2,i=m.u1),"u2"in m&&l(3,s=m.u2),"u3"in m&&l(4,a=m.u3),"ds"in m&&l(5,r=m.ds)},t.$$.update=()=>{if(t.$$.dirty&62){let m=[],_=[];i>0&&(m.push({label:r===1?"L1-L2":"L1"}),_.push(c(i))),s>0&&(m.push({label:r===1?"L1-L3":"L2"}),_.push(c(s))),a>0&&(m.push({label:r===1?"L2-L3":"L3"}),_.push(c(a))),l(0,f={title:n,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:m},points:_})}},[f,n,i,s,a,r]}class U1 extends qt{constructor(e){super(),Et(this,e,B1,F1,Tt,{title:1,u1:2,u2:3,u3:4,ds:5})}}function j1(t){var q,j,ne,fe,me;let e,l,n=(((q=t[0].reactive)==null?void 0:q.title)??"Reactive")+"",i,s,a,r,f=(((j=t[0].reactive)==null?void 0:j.instant_in)??"Instant in")+"",c,m,_,d=t[1][0]+"",h,b,g=t[1][1]+"",k,w,A,F=(((ne=t[0].reactive)==null?void 0:ne.instant_out)??"Instant out")+"",L,M,R,I=t[2][0]+"",y,K,W=t[2][1]+"",N,B,X,G,V=(((fe=t[0].reactive)==null?void 0:fe.total_in)??"Total in")+"",Y,U,z,se=t[3][0]+"",le,Q,ee=t[3][1]+"",ue,ae,x,_e=(((me=t[0].reactive)==null?void 0:me.total_out)??"Total out")+"",oe,J,$,he=t[4][0]+"",ke,D,S=t[4][1]+"",O;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),r=p("div"),c=C(f),m=v(),_=p("div"),h=C(d),b=v(),k=C(g),w=v(),A=p("div"),L=C(F),M=v(),R=p("div"),y=C(I),K=v(),N=C(W),B=v(),X=p("div"),G=p("div"),Y=C(V),U=v(),z=p("div"),le=C(se),Q=v(),ue=C(ee),ae=v(),x=p("div"),oe=C(_e),J=v(),$=p("div"),ke=C(he),D=v(),O=C(S),u(_,"class","text-right"),u(R,"class","text-right"),u(a,"class","grid grid-cols-2 mt-4"),u(z,"class","text-right"),u($,"class","text-right"),u(X,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(pe,de){P(pe,e,de),o(e,l),o(l,i),o(e,s),o(e,a),o(a,r),o(r,c),o(a,m),o(a,_),o(_,h),o(_,b),o(_,k),o(a,w),o(a,A),o(A,L),o(a,M),o(a,R),o(R,y),o(R,K),o(R,N),o(e,B),o(e,X),o(X,G),o(G,Y),o(X,U),o(X,z),o(z,le),o(z,Q),o(z,ue),o(X,ae),o(X,x),o(x,oe),o(X,J),o(X,$),o($,ke),o($,D),o($,O)},p(pe,[de]){var Se,ge,Le,qe,Oe;de&1&&n!==(n=(((Se=pe[0].reactive)==null?void 0:Se.title)??"Reactive")+"")&&E(i,n),de&1&&f!==(f=(((ge=pe[0].reactive)==null?void 0:ge.instant_in)??"Instant in")+"")&&E(c,f),de&2&&d!==(d=pe[1][0]+"")&&E(h,d),de&2&&g!==(g=pe[1][1]+"")&&E(k,g),de&1&&F!==(F=(((Le=pe[0].reactive)==null?void 0:Le.instant_out)??"Instant out")+"")&&E(L,F),de&4&&I!==(I=pe[2][0]+"")&&E(y,I),de&4&&W!==(W=pe[2][1]+"")&&E(N,W),de&1&&V!==(V=(((qe=pe[0].reactive)==null?void 0:qe.total_in)??"Total in")+"")&&E(Y,V),de&8&&se!==(se=pe[3][0]+"")&&E(le,se),de&8&&ee!==(ee=pe[3][1]+"")&&E(ue,ee),de&1&&_e!==(_e=(((Oe=pe[0].reactive)==null?void 0:Oe.total_out)??"Total out")+"")&&E(oe,_e),de&16&&he!==(he=pe[4][0]+"")&&E(ke,he),de&16&&S!==(S=pe[4][1]+"")&&E(O,S)},i:We,o:We,d(pe){pe&&T(e)}}}function H1(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:s}=e,{exportTotal:a}=e,{translations:r={}}=e,f,c,m,_;return t.$$set=d=>{"importInstant"in d&&l(5,n=d.importInstant),"exportInstant"in d&&l(6,i=d.exportInstant),"importTotal"in d&&l(7,s=d.importTotal),"exportTotal"in d&&l(8,a=d.exportTotal),"translations"in d&&l(0,r=d.translations)},t.$$.update=()=>{t.$$.dirty&480&&(l(1,f=ul(n,"VAr")),l(2,c=ul(i,"VAr")),l(3,m=ul(s*1e3,"VArh")),l(4,_=ul(a*1e3,"VArh")))},[r,f,c,m,_,n,i,s,a]}class y1 extends qt{constructor(e){super(),Et(this,e,H1,j1,Tt,{importInstant:5,exportInstant:6,importTotal:7,exportTotal:8,translations:0})}}function zs(t){let e;function l(s,a){return s[3]?W1:z1}let n=l(t),i=n(t);return{c(){i.c(),e=Jt()},m(s,a){i.m(s,a),P(s,e,a)},p(s,a){n===(n=l(s))&&i?i.p(s,a):(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},d(s){s&&T(e),i.d(s)}}}function z1(t){var j,ne,fe,me,pe;let e,l=(((j=t[4].realtime)==null?void 0:j.consumption)??"Consumption")+"",n,i,s,a,r=el(((ne=t[4].common)==null?void 0:ne.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",d,h,b=t[6][1]+"",g,k,w,A=el(((fe=t[4].common)==null?void 0:fe.day)??"Day")+"",F,L,M,R=t[7][0]+"",I,y,K=t[7][1]+"",W,N,B,X=el(((me=t[4].common)==null?void 0:me.month)??"Month")+"",G,V,Y,U=t[8][0]+"",z,se,le=t[8][1]+"",Q,ee,ue,ae=(((pe=t[4].realtime)==null?void 0:pe.last_month)??"Last month")+"",x,_e,oe,J=t[9][0]+"",$,he,ke=t[9][1]+"",D,S,O,q=t[5]&&Ws(t);return{c(){e=p("strong"),n=C(l),i=v(),s=p("div"),a=p("div"),f=C(r),c=v(),m=p("div"),d=C(_),h=v(),g=C(b),k=v(),w=p("div"),F=C(A),L=v(),M=p("div"),I=C(R),y=v(),W=C(K),N=v(),B=p("div"),G=C(X),V=v(),Y=p("div"),z=C(U),se=v(),Q=C(le),ee=v(),ue=p("div"),x=C(ae),_e=v(),oe=p("div"),$=C(J),he=v(),D=C(ke),S=v(),q&&q.c(),O=Jt(),u(m,"class","text-right"),u(M,"class","text-right"),u(Y,"class","text-right"),u(oe,"class","text-right"),u(s,"class","grid grid-cols-2 mb-3")},m(de,Se){P(de,e,Se),o(e,n),P(de,i,Se),P(de,s,Se),o(s,a),o(a,f),o(s,c),o(s,m),o(m,d),o(m,h),o(m,g),o(s,k),o(s,w),o(w,F),o(s,L),o(s,M),o(M,I),o(M,y),o(M,W),o(s,N),o(s,B),o(B,G),o(s,V),o(s,Y),o(Y,z),o(Y,se),o(Y,Q),o(s,ee),o(s,ue),o(ue,x),o(s,_e),o(s,oe),o(oe,$),o(oe,he),o(oe,D),P(de,S,Se),q&&q.m(de,Se),P(de,O,Se)},p(de,Se){var ge,Le,qe,Oe,re;Se&16&&l!==(l=(((ge=de[4].realtime)==null?void 0:ge.consumption)??"Consumption")+"")&&E(n,l),Se&16&&r!==(r=el(((Le=de[4].common)==null?void 0:Le.hour)??"Hour")+"")&&E(f,r),Se&64&&_!==(_=de[6][0]+"")&&E(d,_),Se&64&&b!==(b=de[6][1]+"")&&E(g,b),Se&16&&A!==(A=el(((qe=de[4].common)==null?void 0:qe.day)??"Day")+"")&&E(F,A),Se&128&&R!==(R=de[7][0]+"")&&E(I,R),Se&128&&K!==(K=de[7][1]+"")&&E(W,K),Se&16&&X!==(X=el(((Oe=de[4].common)==null?void 0:Oe.month)??"Month")+"")&&E(G,X),Se&256&&U!==(U=de[8][0]+"")&&E(z,U),Se&256&&le!==(le=de[8][1]+"")&&E(Q,le),Se&16&&ae!==(ae=(((re=de[4].realtime)==null?void 0:re.last_month)??"Last month")+"")&&E(x,ae),Se&512&&J!==(J=de[9][0]+"")&&E($,J),Se&512&&ke!==(ke=de[9][1]+"")&&E(D,ke),de[5]?q?q.p(de,Se):(q=Ws(de),q.c(),q.m(O.parentNode,O)):q&&(q.d(1),q=null)},d(de){de&&(T(e),T(i),T(s),T(S),T(O)),q&&q.d(de)}}}function W1(t){var nt,ze,il,Je,wt,Xt,xt,nl,Wt,sl;let e,l=(((nt=t[4].common)==null?void 0:nt.import)??"Import")+"",n,i,s,a,r=el(((ze=t[4].common)==null?void 0:ze.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",d,h,b=t[6][1]+"",g,k,w,A,F=el(((il=t[4].common)==null?void 0:il.day)??"Day")+"",L,M,R,I=t[7][0]+"",y,K,W=t[7][1]+"",N,B,X,G,V=el(((Je=t[4].common)==null?void 0:Je.month)??"Month")+"",Y,U,z,se=t[8][0]+"",le,Q,ee=t[8][1]+"",ue,ae,x,_e,oe=(((wt=t[4].realtime)==null?void 0:wt.last_mo)??"Last mo.")+"",J,$,he,ke=t[9][0]+"",D,S,O=t[9][1]+"",q,j,ne,fe,me,pe=(((Xt=t[4].common)==null?void 0:Xt.export)??"Export")+"",de,Se,ge,Le,qe=el(((xt=t[4].common)==null?void 0:xt.hour)??"Hour")+"",Oe,re,Ce,Be=t[10][0]+"",Ze,bt,Xe=t[10][1]+"",et,pt,st,tt,gt=el(((nl=t[4].common)==null?void 0:nl.day)??"Day")+"",it,Dt,Ae,Pe=t[11][0]+"",Fe,Ye,ve=t[11][1]+"",Ee,ye,we,De,lt=el(((Wt=t[4].common)==null?void 0:Wt.month)??"Month")+"",Ve,zt,at,je=t[12][0]+"",St,mt,ft=t[12][1]+"",rt,Lt,Vt,Mt,xe=(((sl=t[4].realtime)==null?void 0:sl.last_mo)??"Last mo.")+"",Kt,It,ot,Yt=t[13][0]+"",$t,jt,Pt=t[13][1]+"",ll,Ue,ct,ut=t[5]&&Gs(t),Rt=t[5]&&Vs(t),Ht=t[5]&&Ks(t),dt=t[5]&&Ys(t),yt=t[5]&&Qs(t),At=t[5]&&Xs(t),_t=t[5]&&Zs(t),be=t[5]&&Js(t);return{c(){e=p("strong"),n=C(l),i=v(),s=p("div"),a=p("div"),f=C(r),c=v(),m=p("div"),d=C(_),h=v(),g=C(b),k=v(),ut&&ut.c(),w=v(),A=p("div"),L=C(F),M=v(),R=p("div"),y=C(I),K=v(),N=C(W),B=v(),Rt&&Rt.c(),X=v(),G=p("div"),Y=C(V),U=v(),z=p("div"),le=C(se),Q=v(),ue=C(ee),ae=v(),Ht&&Ht.c(),x=v(),_e=p("div"),J=C(oe),$=v(),he=p("div"),D=C(ke),S=v(),q=C(O),j=v(),dt&&dt.c(),fe=v(),me=p("strong"),de=C(pe),Se=v(),ge=p("div"),Le=p("div"),Oe=C(qe),re=v(),Ce=p("div"),Ze=C(Be),bt=v(),et=C(Xe),pt=v(),yt&&yt.c(),st=v(),tt=p("div"),it=C(gt),Dt=v(),Ae=p("div"),Fe=C(Pe),Ye=v(),Ee=C(ve),ye=v(),At&&At.c(),we=v(),De=p("div"),Ve=C(lt),zt=v(),at=p("div"),St=C(je),mt=v(),rt=C(ft),Lt=v(),_t&&_t.c(),Vt=v(),Mt=p("div"),Kt=C(xe),It=v(),ot=p("div"),$t=C(Yt),jt=v(),ll=C(Pt),Ue=v(),be&&be.c(),u(m,"class","text-right"),u(R,"class","text-right"),u(z,"class","text-right"),u(he,"class","text-right"),u(s,"class",ne="grid grid-cols-"+t[14]+" mb-3"),u(Ce,"class","text-right"),u(Ae,"class","text-right"),u(at,"class","text-right"),u(ot,"class","text-right"),u(ge,"class",ct="grid grid-cols-"+t[14])},m(Ie,te){P(Ie,e,te),o(e,n),P(Ie,i,te),P(Ie,s,te),o(s,a),o(a,f),o(s,c),o(s,m),o(m,d),o(m,h),o(m,g),o(s,k),ut&&ut.m(s,null),o(s,w),o(s,A),o(A,L),o(s,M),o(s,R),o(R,y),o(R,K),o(R,N),o(s,B),Rt&&Rt.m(s,null),o(s,X),o(s,G),o(G,Y),o(s,U),o(s,z),o(z,le),o(z,Q),o(z,ue),o(s,ae),Ht&&Ht.m(s,null),o(s,x),o(s,_e),o(_e,J),o(s,$),o(s,he),o(he,D),o(he,S),o(he,q),o(s,j),dt&&dt.m(s,null),P(Ie,fe,te),P(Ie,me,te),o(me,de),P(Ie,Se,te),P(Ie,ge,te),o(ge,Le),o(Le,Oe),o(ge,re),o(ge,Ce),o(Ce,Ze),o(Ce,bt),o(Ce,et),o(ge,pt),yt&&yt.m(ge,null),o(ge,st),o(ge,tt),o(tt,it),o(ge,Dt),o(ge,Ae),o(Ae,Fe),o(Ae,Ye),o(Ae,Ee),o(ge,ye),At&&At.m(ge,null),o(ge,we),o(ge,De),o(De,Ve),o(ge,zt),o(ge,at),o(at,St),o(at,mt),o(at,rt),o(ge,Lt),_t&&_t.m(ge,null),o(ge,Vt),o(ge,Mt),o(Mt,Kt),o(ge,It),o(ge,ot),o(ot,$t),o(ot,jt),o(ot,ll),o(ge,Ue),be&&be.m(ge,null)},p(Ie,te){var Re,cl,ml,Ke,Ct,gl,kl,wl,Cl,Sl;te&16&&l!==(l=(((Re=Ie[4].common)==null?void 0:Re.import)??"Import")+"")&&E(n,l),te&16&&r!==(r=el(((cl=Ie[4].common)==null?void 0:cl.hour)??"Hour")+"")&&E(f,r),te&64&&_!==(_=Ie[6][0]+"")&&E(d,_),te&64&&b!==(b=Ie[6][1]+"")&&E(g,b),Ie[5]?ut?ut.p(Ie,te):(ut=Gs(Ie),ut.c(),ut.m(s,w)):ut&&(ut.d(1),ut=null),te&16&&F!==(F=el(((ml=Ie[4].common)==null?void 0:ml.day)??"Day")+"")&&E(L,F),te&128&&I!==(I=Ie[7][0]+"")&&E(y,I),te&128&&W!==(W=Ie[7][1]+"")&&E(N,W),Ie[5]?Rt?Rt.p(Ie,te):(Rt=Vs(Ie),Rt.c(),Rt.m(s,X)):Rt&&(Rt.d(1),Rt=null),te&16&&V!==(V=el(((Ke=Ie[4].common)==null?void 0:Ke.month)??"Month")+"")&&E(Y,V),te&256&&se!==(se=Ie[8][0]+"")&&E(le,se),te&256&&ee!==(ee=Ie[8][1]+"")&&E(ue,ee),Ie[5]?Ht?Ht.p(Ie,te):(Ht=Ks(Ie),Ht.c(),Ht.m(s,x)):Ht&&(Ht.d(1),Ht=null),te&16&&oe!==(oe=(((Ct=Ie[4].realtime)==null?void 0:Ct.last_mo)??"Last mo.")+"")&&E(J,oe),te&512&&ke!==(ke=Ie[9][0]+"")&&E(D,ke),te&512&&O!==(O=Ie[9][1]+"")&&E(q,O),Ie[5]?dt?dt.p(Ie,te):(dt=Ys(Ie),dt.c(),dt.m(s,null)):dt&&(dt.d(1),dt=null),te&16384&&ne!==(ne="grid grid-cols-"+Ie[14]+" mb-3")&&u(s,"class",ne),te&16&&pe!==(pe=(((gl=Ie[4].common)==null?void 0:gl.export)??"Export")+"")&&E(de,pe),te&16&&qe!==(qe=el(((kl=Ie[4].common)==null?void 0:kl.hour)??"Hour")+"")&&E(Oe,qe),te&1024&&Be!==(Be=Ie[10][0]+"")&&E(Ze,Be),te&1024&&Xe!==(Xe=Ie[10][1]+"")&&E(et,Xe),Ie[5]?yt?yt.p(Ie,te):(yt=Qs(Ie),yt.c(),yt.m(ge,st)):yt&&(yt.d(1),yt=null),te&16&>!==(gt=el(((wl=Ie[4].common)==null?void 0:wl.day)??"Day")+"")&&E(it,gt),te&2048&&Pe!==(Pe=Ie[11][0]+"")&&E(Fe,Pe),te&2048&&ve!==(ve=Ie[11][1]+"")&&E(Ee,ve),Ie[5]?At?At.p(Ie,te):(At=Xs(Ie),At.c(),At.m(ge,we)):At&&(At.d(1),At=null),te&16&<!==(lt=el(((Cl=Ie[4].common)==null?void 0:Cl.month)??"Month")+"")&&E(Ve,lt),te&4096&&je!==(je=Ie[12][0]+"")&&E(St,je),te&4096&&ft!==(ft=Ie[12][1]+"")&&E(rt,ft),Ie[5]?_t?_t.p(Ie,te):(_t=Zs(Ie),_t.c(),_t.m(ge,Vt)):_t&&(_t.d(1),_t=null),te&16&&xe!==(xe=(((Sl=Ie[4].realtime)==null?void 0:Sl.last_mo)??"Last mo.")+"")&&E(Kt,xe),te&8192&&Yt!==(Yt=Ie[13][0]+"")&&E($t,Yt),te&8192&&Pt!==(Pt=Ie[13][1]+"")&&E(ll,Pt),Ie[5]?be?be.p(Ie,te):(be=Js(Ie),be.c(),be.m(ge,null)):be&&(be.d(1),be=null),te&16384&&ct!==(ct="grid grid-cols-"+Ie[14])&&u(ge,"class",ct)},d(Ie){Ie&&(T(e),T(i),T(s),T(fe),T(me),T(Se),T(ge)),ut&&ut.d(),Rt&&Rt.d(),Ht&&Ht.d(),dt&&dt.d(),yt&&yt.d(),At&&At.d(),_t&&_t.d(),be&&be.d()}}}function Ws(t){var $,he,ke,D,S,O;let e,l=((($=t[4].realtime)==null?void 0:$.cost)??"Cost")+"",n,i,s,a,r=el(((he=t[4].common)==null?void 0:he.hour)??"Hour")+"",f,c,m,_=Gt(t[1].h.c,2)+"",d,h,b,g,k,w=el(((ke=t[4].common)==null?void 0:ke.day)??"Day")+"",A,F,L,M=Gt(t[1].d.c,1)+"",R,I,y,K,W,N=el(((D=t[4].common)==null?void 0:D.month)??"Month")+"",B,X,G,V=Gt(t[1].m.c)+"",Y,U,z,se,le,Q=(((S=t[4].realtime)==null?void 0:S.last_month)??"Last month")+"",ee,ue,ae,x=Gt((O=t[0].last_month)==null?void 0:O.c)+"",_e,oe,J;return{c(){e=p("strong"),n=C(l),i=v(),s=p("div"),a=p("div"),f=C(r),c=v(),m=p("div"),d=C(_),h=v(),b=C(t[2]),g=v(),k=p("div"),A=C(w),F=v(),L=p("div"),R=C(M),I=v(),y=C(t[2]),K=v(),W=p("div"),B=C(N),X=v(),G=p("div"),Y=C(V),U=v(),z=C(t[2]),se=v(),le=p("div"),ee=C(Q),ue=v(),ae=p("div"),_e=C(x),oe=v(),J=C(t[2]),u(m,"class","text-right"),u(L,"class","text-right"),u(G,"class","text-right"),u(ae,"class","text-right"),u(s,"class","grid grid-cols-2")},m(q,j){P(q,e,j),o(e,n),P(q,i,j),P(q,s,j),o(s,a),o(a,f),o(s,c),o(s,m),o(m,d),o(m,h),o(m,b),o(s,g),o(s,k),o(k,A),o(s,F),o(s,L),o(L,R),o(L,I),o(L,y),o(s,K),o(s,W),o(W,B),o(s,X),o(s,G),o(G,Y),o(G,U),o(G,z),o(s,se),o(s,le),o(le,ee),o(s,ue),o(s,ae),o(ae,_e),o(ae,oe),o(ae,J)},p(q,j){var ne,fe,me,pe,de,Se;j&16&&l!==(l=(((ne=q[4].realtime)==null?void 0:ne.cost)??"Cost")+"")&&E(n,l),j&16&&r!==(r=el(((fe=q[4].common)==null?void 0:fe.hour)??"Hour")+"")&&E(f,r),j&2&&_!==(_=Gt(q[1].h.c,2)+"")&&E(d,_),j&4&&E(b,q[2]),j&16&&w!==(w=el(((me=q[4].common)==null?void 0:me.day)??"Day")+"")&&E(A,w),j&2&&M!==(M=Gt(q[1].d.c,1)+"")&&E(R,M),j&4&&E(y,q[2]),j&16&&N!==(N=el(((pe=q[4].common)==null?void 0:pe.month)??"Month")+"")&&E(B,N),j&2&&V!==(V=Gt(q[1].m.c)+"")&&E(Y,V),j&4&&E(z,q[2]),j&16&&Q!==(Q=(((de=q[4].realtime)==null?void 0:de.last_month)??"Last month")+"")&&E(ee,Q),j&1&&x!==(x=Gt((Se=q[0].last_month)==null?void 0:Se.c)+"")&&E(_e,x),j&4&&E(J,q[2])},d(q){q&&(T(e),T(i),T(s))}}}function Gs(t){let e,l=Gt(t[1].h.c,2)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Gt(a[1].h.c,2)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&T(e)}}}function Vs(t){let e,l=Gt(t[1].d.c,1)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Gt(a[1].d.c,1)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&T(e)}}}function Ks(t){let e,l=Gt(t[1].m.c)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Gt(a[1].m.c)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&T(e)}}}function Ys(t){var a;let e,l=Gt((a=t[0].last_month)==null?void 0:a.c)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(r,f){P(r,e,f),o(e,n),o(e,i),o(e,s)},p(r,f){var c;f&1&&l!==(l=Gt((c=r[0].last_month)==null?void 0:c.c)+"")&&E(n,l),f&4&&E(s,r[2])},d(r){r&&T(e)}}}function Qs(t){let e,l=Gt(t[1].h.i,2)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Gt(a[1].h.i,2)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&T(e)}}}function Xs(t){let e,l=Gt(t[1].d.i,1)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Gt(a[1].d.i,1)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&T(e)}}}function Zs(t){let e,l=Gt(t[1].m.i)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,n),o(e,i),o(e,s)},p(a,r){r&2&&l!==(l=Gt(a[1].m.i)+"")&&E(n,l),r&4&&E(s,a[2])},d(a){a&&T(e)}}}function Js(t){var a;let e,l=Gt((a=t[0].last_month)==null?void 0:a.i)+"",n,i,s;return{c(){e=p("div"),n=C(l),i=v(),s=C(t[2]),u(e,"class","text-right")},m(r,f){P(r,e,f),o(e,n),o(e,i),o(e,s)},p(r,f){var c;f&1&&l!==(l=Gt((c=r[0].last_month)==null?void 0:c.i)+"")&&E(n,l),f&4&&E(s,r[2])},d(r){r&&T(e)}}}function G1(t){var m;let e,l,n=(((m=t[4].realtime)==null?void 0:m.title)??"Real time calculations")+"",i,s,a,r,f,c=t[1]&&zs(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("br"),r=p("br"),f=v(),c&&c.c(),u(e,"class","mx-2 text-sm")},m(_,d){P(_,e,d),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),c&&c.m(e,null)},p(_,[d]){var h;d&16&&n!==(n=(((h=_[4].realtime)==null?void 0:h.title)??"Real time calculations")+"")&&E(i,n),_[1]?c?c.p(_,d):(c=zs(_),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:We,o:We,d(_){_&&T(e),c&&c.d()}}}function V1(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:s}=e,{hasExport:a}=e,{translations:r={}}=e,f,c,m,_,d,h,b,g,k=!1,w=3;return t.$$set=A=>{"sysinfo"in A&&l(0,n=A.sysinfo),"data"in A&&l(1,i=A.data),"currency"in A&&l(2,s=A.currency),"hasExport"in A&&l(3,a=A.hasExport),"translations"in A&&l(4,r=A.translations)},t.$$.update=()=>{var A,F,L,M,R,I,y,K;t.$$.dirty&35&&(l(5,k=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(14,w=k?3:2),l(6,f=ul(((A=i==null?void 0:i.h)==null?void 0:A.u)*1e3,"Wh")),l(7,c=ul(((F=i==null?void 0:i.d)==null?void 0:F.u)*1e3,"Wh")),l(8,m=ul(((L=i==null?void 0:i.m)==null?void 0:L.u)*1e3,"Wh")),l(9,_=ul(((M=n==null?void 0:n.last_month)==null?void 0:M.u)*1e3,"Wh")),l(10,d=ul(((R=i==null?void 0:i.h)==null?void 0:R.p)*1e3,"Wh")),l(11,h=ul(((I=i==null?void 0:i.d)==null?void 0:I.p)*1e3,"Wh")),l(12,b=ul(((y=i==null?void 0:i.m)==null?void 0:y.p)*1e3,"Wh")),l(13,g=ul(((K=n==null?void 0:n.last_month)==null?void 0:K.p)*1e3,"Wh")))},[n,i,s,a,r,k,f,c,m,_,d,h,b,g,w]}class K1 extends qt{constructor(e){super(),Et(this,e,V1,G1,Tt,{sysinfo:0,data:1,currency:2,hasExport:3,translations:4})}}function Y1(t){let e,l;return e=new rn({props:{config:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Q1(t,e,l){let{title:n}=e,{json:i}=e,{sysinfo:s}=e,a={},r,f,c=document.documentElement.classList.contains("dark");return t.$$set=m=>{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,s=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=i.currency,_=new Date().getUTCHours(),d=0,h=0,b=0,g=[],k=[],w=[];l(5,f=l(4,r=0));let A=new Date;for(Al(A,s.clock_offset-(24+A.getHours()-A.getUTCHours())%24),d=_;d<24&&(h=i[Nt(b++)],h!=null);d++)k.push({label:Nt(A.getHours())}),w.push(h*100),l(5,f=Math.min(f,h*100)),l(4,r=Math.max(r,h*100)),Al(A,1);for(d=0;d<24&&(h=i[Nt(b++)],h!=null);d++)k.push({label:Nt(A.getHours())}),w.push(h*100),l(5,f=Math.min(f,h*100)),l(4,r=Math.max(r,h*100)),Al(A,1);if(f>-100&&r<100){switch(m){case"NOK":case"DKK":m="øre";break;case"SEK":m="öre";break;case"EUR":m="cent";break;case"CHF":m="rp.";break;default:m=m+"/100"}for(l(5,f*=100),l(4,r*=100),d=0;d=0?I.toFixed(y):"",title:I>=0?I.toFixed(2)+" "+m:"",value:h>=0?Math.abs(h):0,label2:I<0?I.toFixed(y):"",title2:I<0?I.toFixed(2)+" "+m:"",value2:h<0?Math.abs(h):0,color:c?"#5c2da5":"#7c3aed"})}let L=Math.max(r,Math.abs(f));if(f<0){l(5,f=Math.min(L/4*-1,f));let I=Math.ceil(Math.abs(f)/L*4),y=f/I;for(d=1;d{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,s=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],d=[],h=[];l(5,f=l(4,r=0));let b=new Date,g=new Date;g.setDate(0),g.setHours(12);let k=(g.getHours()-g.getUTCHours())%24-s.clock_offset,w=b.getUTCHours();for(Al(b,-k-24),m=w;m<24;m++){let M=i["i"+Nt(m)],R=i["e"+Nt(m)];M===void 0&&(M=0),R===void 0&&(R=0),d.push({label:Nt(b.getHours())}),h.push({label:M.toFixed(1),title:M.toFixed(2)+" kWh",value:M*10,label2:R.toFixed(1),title2:R.toFixed(2)+" kWh",value2:R*10,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,R*10)),l(4,r=Math.max(r,M*10)),Al(b,1)}for(m=0;m{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,s=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],d=[],h=[];l(5,f=l(4,r=0));let b=new Date,g=new Date;g.setDate(0),g.setHours(12);let k=(g.getHours()-g.getUTCHours())%24-s.clock_offset;for(Al(b,-k),Al(g,-k),m=b.getDate();m<=g.getDate();m++){let L=i["i"+Nt(m)],M=i["e"+Nt(m)];L===void 0&&(L=0),M===void 0&&(M=0),d.push({label:Nt(m)}),h.push({label:L.toFixed(L<10?1:0),title:L.toFixed(2)+" kWh",value:L,label2:M.toFixed(M<10?1:0),title2:M.toFixed(2)+" kWh",value2:M,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,M)),l(4,r=Math.max(r,L))}for(m=1;m{"title"in c&&l(1,n=c.title),"json"in c&&l(2,i=c.json)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,m=0,_=[],d=[],h=[];i.s&&i.s.forEach((k,w)=>{var A=k.n?k.n:k.a;m=k.v,m==-127&&(m=0),d.push({label:A.slice(-4)}),h.push({label:m.toFixed(1),value:m,color:s?"#5c2da5":"#7c3aed"}),l(4,f=Math.min(f,m)),l(3,r=Math.max(r,m))}),l(3,r=Math.ceil(r)),l(4,f=Math.floor(f));let b=r;f<0&&(b+=Math.abs(f));let g=b/4;for(c=0;c<5;c++)m=f+g*c,_.push({value:m,label:m.toFixed(1)});l(0,a={title:n+" (°C)",dark:document.documentElement.classList.contains("dark"),height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:f,max:r,ticks:_},x:{ticks:d},points:h})}},[a,n,i,r,f]}class i0 extends qt{constructor(e){super(),Et(this,e,n0,l0,Tt,{title:1,json:2})}}function s0(t){let e,l;return e=new rn({props:{config:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}let o0=0;function a0(t,e,l){let{title:n}=e,{translations:i={}}=e,s=document.documentElement.classList.contains("dark"),a={},r=0,{tariffData:f}=e;return t.$$set=c=>{"title"in c&&l(1,n=c.title),"translations"in c&&l(2,i=c.translations),"tariffData"in c&&l(3,f=c.tariffData)},t.$$.update=()=>{var c;if(t.$$.dirty&30){let m=0,_=[],d=[],h=[];if(_.push({value:0,label:0}),f&&f.p)for(m=0;m0?Nt(b.d)+"."+(i.months?(c=i.months)==null?void 0:c[new Date().getMonth()]:Nt(new Date().getMonth()+1)):"-"}),l(4,r=Math.max(r,b.v))}if(f&&f.t){for(m=0;m=r)break;_.push({value:b,label:b})}_.push({label:f.m.toFixed(1),align:"right",color:"green",value:f.m})}f&&f.c&&(_.push({label:f.c.toFixed(0),color:"orange",value:f.c}),l(4,r=Math.max(r,f.c))),l(4,r=Math.ceil(r)),l(0,a={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:35,bottom:20,left:35},y:{min:o0,max:r,ticks:_},x:{ticks:d},points:h})}},[a,n,i,f,r]}class f0 extends qt{constructor(e){super(),Et(this,e,a0,s0,Tt,{title:1,translations:2,tariffData:3})}}let ln=0,u0={data:[]};async function ji(){let e=await(await vl(ln<0?"realtime.json":"realtime.json?offset="+ln)).json();Hi.update(l=>{for(let n=0;n=0&&(ln+=e.size,lnpn||ki-pn>300?(ji(),ii=0):Hi.update(t=>{if(t.lastUpdate)for(;pn>t.lastUpdate;)t.data.unshift(pu),t.data=t.data.slice(0,t.size),t.lastUpdate+=10,ii++;else t.lastUpdate=pn;return t})}function m0(t){if(pu=t.i-t.e,pn=t.u,!$s){ji(),$s=!0,ki=pn;return}r0()&&c0()}function xs(t,e,l){const n=t.slice();return n[18]=e[l],n[20]=l,n}function eo(t,e,l){const n=t.slice();return n[21]=e[l],n}function _0(t){let e,l,n;return{c(){e=p("strong"),l=C(t[0]),n=C(" not available"),u(e,"class","text-sm")},m(i,s){P(i,e,s),o(e,l),o(e,n)},p(i,s){s&1&&E(l,i[0])},d(i){i&&T(e)}}}function p0(t){let e,l,n,i,s,a,r,f=t[8]&&to(t);return{c(){e=p("strong"),l=C(t[0]),n=C(" ("),i=C(t[12]),s=C(")"),a=v(),f&&f.c(),r=Jt(),u(e,"class","text-sm")},m(c,m){P(c,e,m),o(e,l),o(e,n),o(e,i),o(e,s),P(c,a,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&1&&E(l,c[0]),m&4096&&E(i,c[12]),c[8]?f?f.p(c,m):(f=to(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(T(e),T(a),T(r)),f&&f.d(c)}}}function to(t){let e,l,n,i,s,a=kt(t[8]),r=[];for(let m=0;mt[17].call(e))},m(a,r){P(a,e,r),s.m(e,null),l=Di(e,t[17].bind(e))},p(a,[r]){i===(i=n(a))&&s?s.p(a,r):(s.d(1),s=i(a),s&&(s.c(),s.m(e,null)))},i:We,o:We,d(a){a&&T(e),s.d(),l()}}}function h0(t,e,l){let{title:n}=e,i=document.documentElement.classList.contains("dark"),s=null;Hi.subscribe(M=>{l(16,s=M)});let a=!1,r,f,c,m,_,d,h,b=function(M,R,I){return Math.ceil(_-(M-R)/(I-R)*_)-25},g=function(M){return 30+Math.ceil(M/s.size*(d-35))},k,w,A,F;function L(){c=this.clientWidth,m=this.clientHeight,l(3,c),l(4,m)}return t.$$set=M=>{"title"in M&&l(0,n=M.title)},t.$$.update=()=>{if(t.$$.dirty&67582)if(l(5,_=parseInt(m)-50),l(6,d=c-35),l(10,A=d/s.size),l(2,f=0),l(1,r=0),s.data&&_>10&&d>100&&A>.1){l(11,a=!0);for(let I in s.data){let y=s.data[I];isNaN(y)&&(y=0),l(1,r=Math.max(Math.ceil(y/1e3)*1e3,r)),l(2,f=Math.min(Math.floor(y/1e3)*1e3,f))}let M=r-f;l(12,F=r>2500?"kW":"W"),l(8,k=[]);for(let I=f;I2500?(I/1e3).toFixed(1):I}),!(k.length>6));I+=M/5);l(9,w=[]);for(let I=0;I12));I+=Math.round(s.size/Math.round(d/120)));let R=s.size;l(7,h=g(s.size)+","+b(0,f,r)+" "+g(1)+","+b(0,f,r));for(let I in s.data){if(R<0)break;let y=s.data[I];isNaN(y)&&(y=0),l(7,h=g(R--)+","+b(y,f,r)+" "+h)}}else l(11,a=!1)},[n,r,f,c,m,_,d,h,k,w,A,a,F,i,b,g,s,L]}class v0 extends qt{constructor(e){super(),Et(this,e,h0,d0,Tt,{title:0})}}function b0(t){let e,l;return e=new rn({props:{config:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,[i]){const s={};i&1&&(s.config=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function g0(t,e,l){let{title:n}=e,{unit:i=""}=e,{l1:s=!1}=e,{l2:a=!1}=e,{l2x:r=!1}=e,{l3:f=!1}=e,{l1i:c=0}=e,{l2i:m=0}=e,{l3i:_=0}=e,{l1e:d=0}=e,{l2e:h=0}=e,{l3e:b=0}=e,{maxImport:g=0}=e,{maxExport:k=0}=e,{importColorFn:w}=e,{exportColorFn:A}=e,F={};function L(M,R){return{label:Gt(M>900?M/1e3:M)+(M>900?"k":"")+i,title:M.toFixed(2)+" "+i,value:isNaN(M)?0:M,color:w(M?M/g*100:0,document.documentElement.classList.contains("dark")),label2:Gt(R>900?R/1e3:R)+(R>900?"k":"")+i,title2:R.toFixed(2)+" "+i,value2:isNaN(R)?0:R,color2:A(R?R/k*100:0)}}return t.$$set=M=>{"title"in M&&l(1,n=M.title),"unit"in M&&l(2,i=M.unit),"l1"in M&&l(3,s=M.l1),"l2"in M&&l(4,a=M.l2),"l2x"in M&&l(5,r=M.l2x),"l3"in M&&l(6,f=M.l3),"l1i"in M&&l(7,c=M.l1i),"l2i"in M&&l(8,m=M.l2i),"l3i"in M&&l(9,_=M.l3i),"l1e"in M&&l(10,d=M.l1e),"l2e"in M&&l(11,h=M.l2e),"l3e"in M&&l(12,b=M.l3e),"maxImport"in M&&l(13,g=M.maxImport),"maxExport"in M&&l(14,k=M.maxExport),"importColorFn"in M&&l(15,w=M.importColorFn),"exportColorFn"in M&&l(16,A=M.exportColorFn)},t.$$.update=()=>{if(t.$$.dirty&32762){let M=[],R=[];s&&(M.push({label:"L1"}),R.push(L(c,d))),a&&(r?(M.push({label:"L2"}),R.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(M.push({label:"L2"}),R.push(L(m,h)))),f&&(M.push({label:"L3"}),R.push(L(_,b)));let I=[];if(k){let y=k>g?4:k*4/g;I.push({value:-k,label:"-100%"}),y>=4&&I.push({value:-k/4*3,label:"-75%"}),y>=2&&I.push({value:-k/2,label:"-50%"}),y>=4&&I.push({value:-k/4,label:"-25%"})}if(I.push({value:0,label:"0%"}),g){let y=g>k?4:g*4/k;I.push({value:g/4,label:"25%"}),y>=4&&I.push({value:g/2,label:"50%"}),y>=2&&I.push({value:g/4*3,label:"75%"}),y>=4&&I.push({value:g,label:"100%"})}l(0,F={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:15,bottom:20,left:35},y:{min:-k,max:g,ticks:I},x:{ticks:M},points:R})}},[F,n,i,s,a,r,f,c,m,_,d,h,b,g,k,w,A]}class yi extends qt{constructor(e){super(),Et(this,e,g0,b0,Tt,{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 oo(t){var w;let e,l,n,i,s,a,r=(t[0].mt?Yn(t[0].mt):"-")+"",f,c,m,_=t[11][0]+"",d,h,b=t[11][1]+"",g,k;return i=new _u({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:((w=t[6].common)==null?void 0:w.import)??"Import",sub:Gt(t[0].p,2),subunit:t[0].pc,colorFn:Ri}}),{c(){e=p("div"),l=p("div"),n=p("div"),Te(i.$$.fragment),s=v(),a=p("div"),f=C(r),c=v(),m=p("div"),d=C(_),h=v(),g=C(b),u(n,"class","col-span-2"),u(m,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(A,F){P(A,e,F),o(e,l),o(l,n),Me(i,n,null),o(l,s),o(l,a),o(a,f),o(l,c),o(l,m),o(m,d),o(m,h),o(m,g),k=!0},p(A,F){var M;const L={};F&1&&(L.val=A[0].i?A[0].i:0),F&1&&(L.max=A[0].im?A[0].im:15e3),F&64&&(L.label=((M=A[6].common)==null?void 0:M.import)??"Import"),F&1&&(L.sub=Gt(A[0].p,2)),F&1&&(L.subunit=A[0].pc),i.$set(L),(!k||F&1)&&r!==(r=(A[0].mt?Yn(A[0].mt):"-")+"")&&E(f,r),(!k||F&2048)&&_!==(_=A[11][0]+"")&&E(d,_),(!k||F&2048)&&b!==(b=A[11][1]+"")&&E(g,b)},i(A){k||(Z(i.$$.fragment,A),k=!0)},o(A){ie(i.$$.fragment,A),k=!1},d(A){A&&T(e),Ne(i)}}}function ao(t){var g;let e,l,n,i,s,a,r,f,c=t[12][0]+"",m,_,d=t[12][1]+"",h,b;return i=new _u({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:((g=t[6].common)==null?void 0:g.export)??"Export",sub:Gt(t[0].px,2),subunit:t[0].pc,colorFn:En}}),{c(){e=p("div"),l=p("div"),n=p("div"),Te(i.$$.fragment),s=v(),a=p("div"),r=v(),f=p("div"),m=C(c),_=v(),h=C(d),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(k,w){P(k,e,w),o(e,l),o(l,n),Me(i,n,null),o(l,s),o(l,a),o(l,r),o(l,f),o(f,m),o(f,_),o(f,h),b=!0},p(k,w){var F;const A={};w&1&&(A.val=k[0].e?k[0].e:0),w&1&&(A.max=k[0].om?k[0].om*1e3:1e4),w&64&&(A.label=((F=k[6].common)==null?void 0:F.export)??"Export"),w&1&&(A.sub=Gt(k[0].px,2)),w&1&&(A.subunit=k[0].pc),i.$set(A),(!b||w&4096)&&c!==(c=k[12][0]+"")&&E(m,c),(!b||w&4096)&&d!==(d=k[12][1]+"")&&E(h,d)},i(k){b||(Z(i.$$.fragment,k),b=!0)},o(k){ie(i.$$.fragment,k),b=!1},d(k){k&&T(e),Ne(i)}}}function fo(t){let e,l,n=t[0].l1&&uo(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=uo(i),n.c(),Z(n,1),n.m(e,null)):n&&(ht(),ie(n,1,1,()=>{n=null}),vt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&T(e),n&&n.d()}}}function uo(t){var n;let e,l;return e=new U1({props:{title:((n=t[6].common)==null?void 0:n.voltage)??"Volt",u1:t[0].l1.u,u2:t[0].l2.u,u3:t[0].l3.u,ds:t[0].ds}}),{c(){Te(e.$$.fragment)},m(i,s){Me(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].common)==null?void 0:r.voltage)??"Volt"),s&1&&(a.u1=i[0].l1.u),s&1&&(a.u2=i[0].l2.u),s&1&&(a.u3=i[0].l3.u),s&1&&(a.ds=i[0].ds),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Ne(e,i)}}}function ro(t){let e,l,n=t[0].l1&&co(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=co(i),n.c(),Z(n,1),n.m(e,null)):n&&(ht(),ie(n,1,1,()=>{n=null}),vt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&T(e),n&&n.d()}}}function co(t){var n;let e,l;return e=new yi({props:{title:((n=t[6].common)==null?void 0:n.amperage)??"Amp",unit:"A",importColorFn:Ri,exportColorFn:En,maxImport:t[0].mf,maxExport:t[0].om?t[13]?t[0].om/.4/Math.sqrt(3):t[0].om/.23:0,l1:t[8],l2:t[9],l3:t[10],l2x:t[0].l2.e,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.max(t[0].l1.i*-1,0),l2e:Math.max(t[0].l2.i*-1,0),l3e:Math.max(t[0].l3.i*-1,0)}}),{c(){Te(e.$$.fragment)},m(i,s){Me(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].common)==null?void 0:r.amperage)??"Amp"),s&1&&(a.maxImport=i[0].mf),s&8193&&(a.maxExport=i[0].om?i[13]?i[0].om/.4/Math.sqrt(3):i[0].om/.23:0),s&256&&(a.l1=i[8]),s&512&&(a.l2=i[9]),s&1024&&(a.l3=i[10]),s&1&&(a.l2x=i[0].l2.e),s&1&&(a.l1i=Math.max(i[0].l1.i,0)),s&1&&(a.l2i=Math.max(i[0].l2.i,0)),s&1&&(a.l3i=Math.max(i[0].l3.i,0)),s&1&&(a.l1e=Math.max(i[0].l1.i*-1,0)),s&1&&(a.l2e=Math.max(i[0].l2.i*-1,0)),s&1&&(a.l3e=Math.max(i[0].l3.i*-1,0)),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Ne(e,i)}}}function mo(t){let e,l,n=t[0].l1&&_o(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=_o(i),n.c(),Z(n,1),n.m(e,null)):n&&(ht(),ie(n,1,1,()=>{n=null}),vt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&T(e),n&&n.d()}}}function _o(t){var n;let e,l;return e=new yi({props:{title:((n=t[6].dashboard)==null?void 0:n.phase)??"Phase",unit:"W",importColorFn:Ri,exportColorFn:En,maxImport:(t[0].mf?t[0].mf:32)*230,maxExport:t[0].om?t[13]?t[0].om*1e3/Math.sqrt(3):t[0].om*1e3:0,l1:t[8],l2:t[9],l3:t[10],l1i:t[0].l1.p,l2i:t[0].l2.p,l3i:t[0].l3.p,l1e:t[0].l1.q,l2e:t[0].l2.q,l3e:t[0].l3.q}}),{c(){Te(e.$$.fragment)},m(i,s){Me(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].dashboard)==null?void 0:r.phase)??"Phase"),s&1&&(a.maxImport=(i[0].mf?i[0].mf:32)*230),s&8193&&(a.maxExport=i[0].om?i[13]?i[0].om*1e3/Math.sqrt(3):i[0].om*1e3:0),s&256&&(a.l1=i[8]),s&512&&(a.l2=i[9]),s&1024&&(a.l3=i[10]),s&1&&(a.l1i=i[0].l1.p),s&1&&(a.l2i=i[0].l2.p),s&1&&(a.l3i=i[0].l3.p),s&1&&(a.l1e=i[0].l1.q),s&1&&(a.l2e=i[0].l2.q),s&1&&(a.l3e=i[0].l3.q),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Ne(e,i)}}}function po(t){let e,l,n=t[0].l1&&ho(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,s){P(i,e,s),n&&n.m(e,null),l=!0},p(i,s){i[0].l1?n?(n.p(i,s),s&1&&Z(n,1)):(n=ho(i),n.c(),Z(n,1),n.m(e,null)):n&&(ht(),ie(n,1,1,()=>{n=null}),vt())},i(i){l||(Z(n),l=!0)},o(i){ie(n),l=!1},d(i){i&&T(e),n&&n.d()}}}function ho(t){var n;let e,l;return e=new yi({props:{title:((n=t[6].dashboard)==null?void 0:n.pf)??"Pf",importColorFn:En,exportColorFn:En,maxImport:1,l1:t[8],l2:t[9],l3:t[10],l1i:t[0].l1.f,l2i:t[0].l2.f,l3i:t[0].l3.f}}),{c(){Te(e.$$.fragment)},m(i,s){Me(e,i,s),l=!0},p(i,s){var r;const a={};s&64&&(a.title=((r=i[6].dashboard)==null?void 0:r.pf)??"Pf"),s&256&&(a.l1=i[8]),s&512&&(a.l2=i[9]),s&1024&&(a.l3=i[10]),s&1&&(a.l1i=i[0].l1.f),s&1&&(a.l2i=i[0].l2.f),s&1&&(a.l3i=i[0].l3.f),e.$set(a)},i(i){l||(Z(e.$$.fragment,i),l=!0)},o(i){ie(e.$$.fragment,i),l=!1},d(i){Ne(e,i)}}}function vo(t){let e,l,n;return l=new y1({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec,translations:t[6]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt")},m(i,s){P(i,e,s),Me(l,e,null),n=!0},p(i,s){const a={};s&1&&(a.importInstant=i[0].ri),s&1&&(a.exportInstant=i[0].re),s&1&&(a.importTotal=i[0].ric),s&1&&(a.exportTotal=i[0].rec),s&64&&(a.translations=i[6]),l.$set(a)},i(i){n||(Z(l.$$.fragment,i),n=!0)},o(i){ie(l.$$.fragment,i),n=!1},d(i){i&&T(e),Ne(l)}}}function bo(t){let e,l,n;return l=new K1({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0,translations:t[6]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt")},m(i,s){P(i,e,s),Me(l,e,null),n=!0},p(i,s){const a={};s&2&&(a.sysinfo=i[1]),s&1&&(a.data=i[0].ea),s&1&&(a.currency=i[0].pc),s&1&&(a.hasExport=i[0].om>0||i[0].e>0),s&64&&(a.translations=i[6]),l.$set(a)},i(i){n||(Z(l.$$.fragment,i),n=!0)},o(i){ie(l.$$.fragment,i),n=!1},d(i){i&&T(e),Ne(l)}}}function go(t){var i;let e,l,n;return l=new f0({props:{title:((i=t[6].dashboard)==null?void 0:i.tariffpeak)??"Tariff peaks",tariffData:t[7],translations:t[6]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt h-64")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.tariffpeak)??"Tariff peaks"),a&128&&(r.tariffData=s[7]),a&64&&(r.translations=s[6]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&T(e),Ne(l)}}}function ko(t){var i;let e,l,n;return l=new v0({props:{title:((i=t[6].dashboard)==null?void 0:i.realtime)??"Real time"}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.realtime)??"Real time"),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&T(e),Ne(l)}}}function wo(t){var i;let e,l,n;return l=new X1({props:{title:((i=t[6].dashboard)==null?void 0:i.price)??"Price",json:t[2],sysinfo:t[1]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.price)??"Price"),a&4&&(r.json=s[2]),a&2&&(r.sysinfo=s[1]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&T(e),Ne(l)}}}function Co(t){var i;let e,l,n;return l=new $1({props:{title:((i=t[6].dashboard)==null?void 0:i.day)??"24 hours",json:t[3],sysinfo:t[1]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.day)??"24 hours"),a&8&&(r.json=s[3]),a&2&&(r.sysinfo=s[1]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&T(e),Ne(l)}}}function So(t){var i;let e,l,n;return l=new t0({props:{title:((i=t[6].dashboard)==null?void 0:i.month)??"{0} days",json:t[4],sysinfo:t[1]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.month)??"{0} days"),a&16&&(r.json=s[4]),a&2&&(r.sysinfo=s[1]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&T(e),Ne(l)}}}function Mo(t){var i;let e,l,n;return l=new i0({props:{title:((i=t[6].dashboard)==null?void 0:i.temperature)??"Temperature",json:t[5]}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","cnt gwf")},m(s,a){P(s,e,a),Me(l,e,null),n=!0},p(s,a){var f;const r={};a&64&&(r.title=((f=s[6].dashboard)==null?void 0:f.temperature)??"Temperature"),a&32&&(r.json=s[5]),l.$set(r)},i(s){n||(Z(l.$$.fragment,s),n=!0)},o(s){ie(l.$$.fragment,s),n=!1},d(s){s&&T(e),Ne(l)}}}function k0(t){let e,l=Zt(t[1].ui.i,t[0].i),n,i=Zt(t[1].ui.e,t[0].om||t[0].e>0),s,a=Zt(t[1].ui.v,t[0].l1&&(t[0].l1.u>100||t[0].l2.u>100||t[0].l3.u>100)),r,f=Zt(t[1].ui.a,t[0].l1&&(t[0].l1.i>.01||t[0].l2.i>.01||t[0].l3.i>.01)),c,m=Zt(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)),_,d=Zt(t[1].ui.f,t[0].l1&&(t[0].l1.f>.01||t[0].l2.f>.01||t[0].l3.f>.01)),h,b=Zt(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),g,k=Zt(t[1].ui.c,t[0].ea),w,A=Zt(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("NO")||t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),F,L=Zt(t[1].ui.l,t[0].hm==1),M,R=Zt(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),I,y=Zt(t[1].ui.d,t[3]),K,W=Zt(t[1].ui.m,t[4]),N,B=Zt(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),X,G=l&&oo(t),V=i&&ao(t),Y=a&&fo(t),U=f&&ro(t),z=m&&mo(t),se=d&&po(t),le=b&&vo(t),Q=k&&bo(t),ee=A&&go(t),ue=L&&ko(t),ae=R&&wo(t),x=y&&Co(t),_e=W&&So(t),oe=B&&Mo(t);return{c(){e=p("div"),G&&G.c(),n=v(),V&&V.c(),s=v(),Y&&Y.c(),r=v(),U&&U.c(),c=v(),z&&z.c(),_=v(),se&&se.c(),h=v(),le&&le.c(),g=v(),Q&&Q.c(),w=v(),ee&&ee.c(),F=v(),ue&&ue.c(),M=v(),ae&&ae.c(),I=v(),x&&x.c(),K=v(),_e&&_e.c(),N=v(),oe&&oe.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(J,$){P(J,e,$),G&&G.m(e,null),o(e,n),V&&V.m(e,null),o(e,s),Y&&Y.m(e,null),o(e,r),U&&U.m(e,null),o(e,c),z&&z.m(e,null),o(e,_),se&&se.m(e,null),o(e,h),le&&le.m(e,null),o(e,g),Q&&Q.m(e,null),o(e,w),ee&&ee.m(e,null),o(e,F),ue&&ue.m(e,null),o(e,M),ae&&ae.m(e,null),o(e,I),x&&x.m(e,null),o(e,K),_e&&_e.m(e,null),o(e,N),oe&&oe.m(e,null),X=!0},p(J,[$]){$&3&&(l=Zt(J[1].ui.i,J[0].i)),l?G?(G.p(J,$),$&3&&Z(G,1)):(G=oo(J),G.c(),Z(G,1),G.m(e,n)):G&&(ht(),ie(G,1,1,()=>{G=null}),vt()),$&3&&(i=Zt(J[1].ui.e,J[0].om||J[0].e>0)),i?V?(V.p(J,$),$&3&&Z(V,1)):(V=ao(J),V.c(),Z(V,1),V.m(e,s)):V&&(ht(),ie(V,1,1,()=>{V=null}),vt()),$&3&&(a=Zt(J[1].ui.v,J[0].l1&&(J[0].l1.u>100||J[0].l2.u>100||J[0].l3.u>100))),a?Y?(Y.p(J,$),$&3&&Z(Y,1)):(Y=fo(J),Y.c(),Z(Y,1),Y.m(e,r)):Y&&(ht(),ie(Y,1,1,()=>{Y=null}),vt()),$&3&&(f=Zt(J[1].ui.a,J[0].l1&&(J[0].l1.i>.01||J[0].l2.i>.01||J[0].l3.i>.01))),f?U?(U.p(J,$),$&3&&Z(U,1)):(U=ro(J),U.c(),Z(U,1),U.m(e,c)):U&&(ht(),ie(U,1,1,()=>{U=null}),vt()),$&3&&(m=Zt(J[1].ui.h,J[0].l1&&(J[0].l1.p>.01||J[0].l2.p>.01||J[0].l3.p>.01||J[0].l1.q>.01||J[0].l2.q>.01||J[0].l3.q>.01))),m?z?(z.p(J,$),$&3&&Z(z,1)):(z=mo(J),z.c(),Z(z,1),z.m(e,_)):z&&(ht(),ie(z,1,1,()=>{z=null}),vt()),$&3&&(d=Zt(J[1].ui.f,J[0].l1&&(J[0].l1.f>.01||J[0].l2.f>.01||J[0].l3.f>.01))),d?se?(se.p(J,$),$&3&&Z(se,1)):(se=po(J),se.c(),Z(se,1),se.m(e,h)):se&&(ht(),ie(se,1,1,()=>{se=null}),vt()),$&3&&(b=Zt(J[1].ui.r,J[0].ri>0||J[0].re>0||J[0].ric>0||J[0].rec>0)),b?le?(le.p(J,$),$&3&&Z(le,1)):(le=vo(J),le.c(),Z(le,1),le.m(e,g)):le&&(ht(),ie(le,1,1,()=>{le=null}),vt()),$&3&&(k=Zt(J[1].ui.c,J[0].ea)),k?Q?(Q.p(J,$),$&3&&Z(Q,1)):(Q=bo(J),Q.c(),Z(Q,1),Q.m(e,w)):Q&&(ht(),ie(Q,1,1,()=>{Q=null}),vt()),$&3&&(A=Zt(J[1].ui.t,J[0].pr&&(J[0].pr.startsWith("NO")||J[0].pr.startsWith("10YNO")||J[0].pr.startsWith("10Y1001A1001A4")))),A?ee?(ee.p(J,$),$&3&&Z(ee,1)):(ee=go(J),ee.c(),Z(ee,1),ee.m(e,F)):ee&&(ht(),ie(ee,1,1,()=>{ee=null}),vt()),$&3&&(L=Zt(J[1].ui.l,J[0].hm==1)),L?ue?(ue.p(J,$),$&3&&Z(ue,1)):(ue=ko(J),ue.c(),Z(ue,1),ue.m(e,M)):ue&&(ht(),ie(ue,1,1,()=>{ue=null}),vt()),$&3&&(R=Zt(J[1].ui.p,J[0].pe&&!Number.isNaN(J[0].p))),R?ae?(ae.p(J,$),$&3&&Z(ae,1)):(ae=wo(J),ae.c(),Z(ae,1),ae.m(e,I)):ae&&(ht(),ie(ae,1,1,()=>{ae=null}),vt()),$&10&&(y=Zt(J[1].ui.d,J[3])),y?x?(x.p(J,$),$&10&&Z(x,1)):(x=Co(J),x.c(),Z(x,1),x.m(e,K)):x&&(ht(),ie(x,1,1,()=>{x=null}),vt()),$&18&&(W=Zt(J[1].ui.m,J[4])),W?_e?(_e.p(J,$),$&18&&Z(_e,1)):(_e=So(J),_e.c(),Z(_e,1),_e.m(e,N)):_e&&(ht(),ie(_e,1,1,()=>{_e=null}),vt()),$&35&&(B=Zt(J[1].ui.s,J[0].t&&J[0].t!=-127&&J[5].c>1)),B?oe?(oe.p(J,$),$&35&&Z(oe,1)):(oe=Mo(J),oe.c(),Z(oe,1),oe.m(e,null)):oe&&(ht(),ie(oe,1,1,()=>{oe=null}),vt())},i(J){X||(Z(G),Z(V),Z(Y),Z(U),Z(z),Z(se),Z(le),Z(Q),Z(ee),Z(ue),Z(ae),Z(x),Z(_e),Z(oe),X=!0)},o(J){ie(G),ie(V),ie(Y),ie(U),ie(z),ie(se),ie(le),ie(Q),ie(ee),ie(ue),ie(ae),ie(x),ie(_e),ie(oe),X=!1},d(J){J&&T(e),G&&G.d(),V&&V.d(),Y&&Y.d(),U&&U.d(),z&&z.d(),se&&se.d(),le&&le.d(),Q&&Q.d(),ee&&ee.d(),ue&&ue.d(),ae&&ae.d(),x&&x.d(),_e&&_e.d(),oe&&oe.d()}}}function w0(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,{prices:s={}}=e,{dayPlot:a={}}=e,{monthPlot:r={}}=e,{temperatures:f={}}=e,{translations:c={}}=e,{tariffData:m={}}=e,_,d,h,b,g,k;return t.$$set=w=>{"data"in w&&l(0,n=w.data),"sysinfo"in w&&l(1,i=w.sysinfo),"prices"in w&&l(2,s=w.prices),"dayPlot"in w&&l(3,a=w.dayPlot),"monthPlot"in w&&l(4,r=w.monthPlot),"temperatures"in w&&l(5,f=w.temperatures),"translations"in w&&l(6,c=w.translations),"tariffData"in w&&l(7,m=w.tariffData)},t.$$.update=()=>{var w,A,F,L,M,R,I,y,K,W,N,B,X,G,V;t.$$.dirty&1793&&(l(11,_=ul((n==null?void 0:n.ic)*1e3,"Wh")),l(12,d=ul((n==null?void 0:n.ec)*1e3,"Wh")),((w=n==null?void 0:n.l1)==null?void 0:w.u)==0&&((A=n==null?void 0:n.l2)==null?void 0:A.u)==0&&((F=n==null?void 0:n.l3)==null?void 0:F.u)==0?l(8,b=l(9,g=l(10,k=l(13,h=!0)))):(l(8,b=((L=n==null?void 0:n.l1)==null?void 0:L.u)>0||((M=n==null?void 0:n.l1)==null?void 0:M.i)>0||((R=n==null?void 0:n.l1)==null?void 0:R.p)>0||((I=n==null?void 0:n.l1)==null?void 0:I.q)>0),l(9,g=((y=n==null?void 0:n.l2)==null?void 0:y.u)>0||((K=n==null?void 0:n.l2)==null?void 0:K.i)>0||((W=n==null?void 0:n.l2)==null?void 0:W.p)>0||((N=n==null?void 0:n.l2)==null?void 0:N.q)>0),l(10,k=((B=n==null?void 0:n.l3)==null?void 0:B.u)>0||((X=n==null?void 0:n.l3)==null?void 0:X.i)>0||((G=n==null?void 0:n.l3)==null?void 0:G.p)>0||((V=n==null?void 0:n.l3)==null?void 0:V.q)>0),l(13,h=b&&g&&k)))},[n,i,s,a,r,f,c,m,b,g,k,_,d,h]}class C0 extends qt{constructor(e){super(),Et(this,e,w0,k0,Tt,{data:0,sysinfo:1,prices:2,dayPlot:3,monthPlot:4,temperatures:5,translations:6,tariffData:7})}}let wi={};const Mn=ol(wi);async function S0(){wi=await(await fetch("configuration.json")).json(),Mn.set(wi)}let Ci={};const du=ol(Ci);async function M0(){Ci=await(await fetch("priceconfig.json")).json(),du.set(Ci)}function No(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function To(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART0",l=v(),n=p("option"),n.textContent="UART2",e.__value=3,H(e,e.__value),n.__value=113,H(n,n.__value)},m(i,s){P(i,e,s),P(i,l,s),P(i,n,s)},d(i){i&&(T(e),T(l),T(n))}}}function Po(t){let e;return{c(){e=p("option"),e.textContent=`GPIO${t[4]}`,e.__value=t[4],H(e,e.__value)},m(l,n){P(l,e,n)},d(l){l&&T(e)}}}function Eo(t){let e,l=t[4]>1&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Po(t);return{c(){l&&l.c(),e=Jt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,i){n[4]>1&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Po(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){n&&T(e),l&&l.d(n)}}}function N0(t){let e,l,n,i,s=t[0]=="esp8266"&&To(),a=kt({length:t[1]+1}),r=[];for(let f=0;f{"chip"in s&&l(0,n=s.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32s3":l(1,i=46);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Si extends qt{constructor(e){super(),Et(this,e,T0,N0,Tt,{chip:0})}}function qo(t){let e,l,n=t[1]&&Do(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,s){P(i,e,s),o(e,l),n&&n.m(l,null)},p(i,s){i[1]?n?n.p(i,s):(n=Do(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&T(e),n&&n.d()}}}function Do(t){let e,l;return{c(){e=p("div"),l=C(t[1]),u(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(n,i){P(n,e,i),o(e,l)},p(n,i){i&2&&E(l,n[1])},d(n){n&&T(e)}}}function P0(t){let e,l=t[0]&&qo(t);return{c(){l&&l.c(),e=Jt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=qo(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:We,o:We,d(n){n&&T(e),l&&l.d(n)}}}function E0(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=s=>{"active"in s&&l(0,n=s.active),"message"in s&&l(1,i=s.message)},[n,i]}class fl extends qt{constructor(e){super(),Et(this,e,E0,P0,Tt,{active:0,message:1})}}function Ao(t,e,l){const n=t.slice();return n[1]=e[l],n}function Lo(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],H(e,e.__value)},m(s,a){P(s,e,a),o(e,l),o(e,i)},p:We,d(s){s&&T(e)}}}function q0(t){let e,l,n,i=kt(t[0]),s=[];for(let a=0;a>1&1,q=0;q0;S--)q[S]=q[S]?q[S-1]^M.EXPONENT[y._modN(M.LOG[q[S]]+D)]:q[S-1];q[0]=M.EXPONENT[y._modN(M.LOG[q[0]]+D)]}for(D=0;D<=O;D++)q[D]=M.LOG[q[D]]},_checkBadness:function(){var D,S,O,q,j,ne=0,fe=this._badness,me=this.buffer,pe=this.width;for(j=0;jpe*pe;)ge-=pe*pe,Se++;for(ne+=Se*y.N4,q=0;q=fe-2&&(D=fe-2,j>9&&D--);var me=D;if(j>9){for(ne[me+2]=0,ne[me+3]=0;me--;)S=ne[me],ne[me+3]|=255&S<<4,ne[me+2]=S>>4;ne[2]|=255&D<<4,ne[1]=D>>4,ne[0]=64|D>>12}else{for(ne[me+1]=0,ne[me+2]=0;me--;)S=ne[me],ne[me+2]|=255&S<<4,ne[me+1]=S>>4;ne[1]|=255&D<<4,ne[0]=64|D>>4}for(me=D+3-(j<10);me=5&&(O+=y.N1+q[S]-5);for(S=3;SD||q[S-3]*3>=q[S]*4||q[S+3]*3>=q[S]*4)&&(O+=y.N3);return O},_finish:function(){this._stringBuffer=this.buffer.slice();var D,S,O=0,q=3e4;for(S=0;S<8&&(this._applyMask(S),D=this._checkBadness(),D>=1)q&1&&(j[ne-1-S+ne*8]=1,S<6?j[8+ne*S]=1:j[8+ne*(S+1)]=1);for(S=0;S<7;S++,q>>=1)q&1&&(j[8+ne*(ne-7+S)]=1,S?j[6-S+ne*8]=1:j[7+ne*8]=1)},_interleaveBlocks:function(){var D,S,O=this._dataBlock,q=this._ecc,j=this._eccBlock,ne=0,fe=this._calculateMaxLength(),me=this._neccBlock1,pe=this._neccBlock2,de=this._stringBuffer;for(D=0;D1)for(D=w.BLOCK[q],O=j-7;;){for(S=j-7;S>D-3&&(this._addAlignment(S,O),!(S6)for(D=I.BLOCK[ne-7],S=17,O=0;O<6;O++)for(q=0;q<3;q++,S--)1&(S>11?ne>>S-12:D>>S)?(j[5-O+fe*(2-q+fe-11)]=1,j[2-q+fe-11+fe*(5-O)]=1):(this._setMask(5-O,2-q+fe-11),this._setMask(2-q+fe-11,5-O))},_isMasked:function(D,S){var O=y._getMaskBit(D,S);return this._mask[O]===1},_pack:function(){var D,S,O,q=1,j=1,ne=this.width,fe=ne-1,me=ne-1,pe=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(S=0;SS&&(O=D,D=S,S=O),O=S,O+=S*S,O>>=1,O+=D,O},_modN:function(D){for(;D>=255;)D-=255,D=(D>>8)+(D&255);return D},N1:3,N2:3,N3:40,N4:10}),K=y,W=h.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var D=this.element;D.width=D.height=this.qrious.size}}),N=W,B=_.extend(function(D,S,O,q){this.name=D,this.modifiable=!!S,this.defaultValue=O,this._valueTransformer=q},{transform:function(D){var S=this._valueTransformer;return typeof S=="function"?S(D,this):D}}),X=B,G=_.extend(null,{abs:function(D){return D!=null?Math.abs(D):null},hasOwn:function(D,S){return Object.prototype.hasOwnProperty.call(D,S)},noop:function(){},toUpperCase:function(D){return D!=null?D.toUpperCase():null}}),V=G,Y=_.extend(function(D){this.options={},D.forEach(function(S){this.options[S.name]=S},this)},{exists:function(D){return this.options[D]!=null},get:function(D,S){return Y._get(this.options[D],S)},getAll:function(D){var S,O=this.options,q={};for(S in O)V.hasOwn(O,S)&&(q[S]=Y._get(O[S],D));return q},init:function(D,S,O){typeof O!="function"&&(O=V.noop);var q,j;for(q in this.options)V.hasOwn(this.options,q)&&(j=this.options[q],Y._set(j,j.defaultValue,S),Y._createAccessor(j,S,O));this._setAll(D,S,!0)},set:function(D,S,O){return this._set(D,S,O)},setAll:function(D,S){return this._setAll(D,S)},_set:function(D,S,O,q){var j=this.options[D];if(!j)throw new Error("Invalid option: "+D);if(!j.modifiable&&!q)throw new Error("Option cannot be modified: "+D);return Y._set(j,S,O)},_setAll:function(D,S,O){if(!D)return!1;var q,j=!1;for(q in D)V.hasOwn(D,q)&&this._set(q,D[q],S,O)&&(j=!0);return j}},{_createAccessor:function(D,S,O){var q={get:function(){return Y._get(D,S)}};D.modifiable&&(q.set=function(j){Y._set(D,j,S)&&O(j,D)}),Object.defineProperty(S,D.name,q)},_get:function(D,S){return S["_"+D.name]},_set:function(D,S,O){var q="_"+D.name,j=O[q],ne=D.transform(S??D.defaultValue);return O[q]=ne,ne!==j}}),U=Y,z=_.extend(function(){this._services={}},{getService:function(D){var S=this._services[D];if(!S)throw new Error("Service is not being managed with name: "+D);return S},setService:function(D,S){if(this._services[D])throw new Error("Service is already managed with name: "+D);S&&(this._services[D]=S)}}),se=z,le=new U([new X("background",!0,"white"),new X("backgroundAlpha",!0,1,V.abs),new X("element"),new X("foreground",!0,"black"),new X("foregroundAlpha",!0,1,V.abs),new X("level",!0,"L",V.toUpperCase),new X("mime",!0,"image/png"),new X("padding",!0,null,V.abs),new X("size",!0,100,V.abs),new X("value",!0,"")]),Q=new se,ee=_.extend(function(D){le.init(D,this,this.update.bind(this));var S=le.get("element",this),O=Q.getService("element"),q=S&&O.isCanvas(S)?S:O.createCanvas(),j=S&&O.isImage(S)?S:O.createImage();this._canvasRenderer=new g(this,q,!0),this._imageRenderer=new N(this,j,j===S),this.update()},{get:function(){return le.getAll(this)},set:function(D){le.setAll(D,this)&&this.update()},toDataURL:function(D){return this.canvas.toDataURL(D||this.mime)},update:function(){var D=new K({level:this.level,value:this.value});this._canvasRenderer.render(D),this._imageRenderer.render(D)}},{use:function(D){Q.setService(D.getName(),D)}});Object.defineProperties(ee.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var ue=ee,ae=ue,x=_.extend({getName:function(){}}),_e=x,oe=_e.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(D){},isImage:function(D){}}),J=oe,$=J.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(D){return D instanceof HTMLCanvasElement},isImage:function(D){return D instanceof HTMLImageElement}}),he=$;ae.use(new he);var ke=ae;return ke})})(vu);var R0=vu.exports;const F0=O0(R0);function B0(t){let e,l;return{c(){e=p("img"),zn(e.src,l=t[2])||u(e,"src",l),u(e,"alt",t[0]),u(e,"class",t[1])},m(n,i){P(n,e,i)},p(n,[i]){i&4&&!zn(e.src,l=n[2])&&u(e,"src",l),i&1&&u(e,"alt",n[0]),i&2&&u(e,"class",n[1])},i:We,o:We,d(n){n&&T(e)}}}function U0(t,e,l){const n=new F0;let{errorCorrection:i="L"}=e,{background:s="#fff"}=e,{color:a="#000"}=e,{size:r="200"}=e,{value:f=""}=e,{padding:c=0}=e,{className:m="qrcode"}=e,_="";function d(){n.set({background:s,foreground:a,level:i,padding:c,size:r,value:f}),l(2,_=n.toDataURL("image/jpeg"))}return Tf(()=>{d()}),t.$$set=h=>{"errorCorrection"in h&&l(3,i=h.errorCorrection),"background"in h&&l(4,s=h.background),"color"in h&&l(5,a=h.color),"size"in h&&l(6,r=h.size),"value"in h&&l(0,f=h.value),"padding"in h&&l(7,c=h.padding),"className"in h&&l(1,m=h.className)},t.$$.update=()=>{t.$$.dirty&1&&f&&d()},[f,m,_,i,s,a,r,c]}class j0 extends qt{constructor(e){super(),Et(this,e,U0,B0,Tt,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function Io(t,e,l){const n=t.slice();return n[116]=e[l],n}function Oo(t,e,l){const n=t.slice();return n[119]=e[l],n[120]=e,n[121]=l,n}function Ro(t,e,l){const n=t.slice();return n[122]=e[l],n[123]=e,n[124]=l,n}function H0(t,e,l){const n=t.slice();return n[125]=e[l],n}function y0(t,e,l){const n=t.slice();return n[128]=e[l],n}function Fo(t){var nt,ze,il,Je,wt,Xt,xt,nl,Wt,sl,Ie,te,Re,cl,ml,Ke,Ct,gl,kl,wl,Cl,Sl,Ll,Il,Ol,Rl;let e,l,n=(((ze=(nt=t[2].conf)==null?void 0:nt.general)==null?void 0:ze.title)??"General")+"",i,s,a,r,f,c,m,_,d,h=(((Je=(il=t[2].conf)==null?void 0:il.general)==null?void 0:Je.hostname)??"Hostname")+"",b,g,k,w,A,F,L=(((Xt=(wt=t[2].conf)==null?void 0:wt.general)==null?void 0:Xt.timezone)??"Time zone")+"",M,R,I,y,K,W,N,B,X,G,V,Y=(((nl=(xt=t[2].conf)==null?void 0:xt.price)==null?void 0:nl.region)??"Price region")+"",U,z,se,le,Q,ee,ue,ae,x,_e,oe,J,$,he,ke,D,S,O,q,j,ne,fe,me,pe,de,Se,ge,Le,qe,Oe,re,Ce,Be,Ze,bt=(((sl=(Wt=t[2].conf)==null?void 0:Wt.price)==null?void 0:sl.currency)??"Currency")+"",Xe,et,pt,st,tt,gt,it,Dt,Ae,Pe,Fe,Ye,ve=(((te=(Ie=t[2].conf)==null?void 0:Ie.price)==null?void 0:te.enabled)??"Enabled")+"",Ee,ye,we,De,lt=(((ml=(cl=(Re=t[2].conf)==null?void 0:Re.general)==null?void 0:cl.security)==null?void 0:ml.title)??"Security")+"",Ve,zt,at,je,St,mt=(((gl=(Ct=(Ke=t[2].conf)==null?void 0:Ke.general)==null?void 0:Ct.security)==null?void 0:gl.none)??"None")+"",ft,rt,Lt=(((Cl=(wl=(kl=t[2].conf)==null?void 0:kl.general)==null?void 0:wl.security)==null?void 0:Cl.conf)??"Conf")+"",Vt,Mt,xe=(((Il=(Ll=(Sl=t[2].conf)==null?void 0:Sl.general)==null?void 0:Ll.security)==null?void 0:Il.all)??"All")+"",Kt,It,ot,Yt,$t=(((Rl=(Ol=t[2].conf)==null?void 0:Ol.general)==null?void 0:Rl.context)??"Context")+"",jt,Pt,ll,Ue,ct,ut,Rt,Ht;K=new A0({});let dt=!t[6].p.t&&Bo(),yt=kt(["NOK","SEK","DKK","EUR","CHF"]),At=[];for(let $e=0;$e<5;$e+=1)At[$e]=z0(y0(t,yt,$e));it=new pl({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[W0]},$$scope:{ctx:t}}});let _t=t[6].p.e&&t[0].chip!="esp8266"&&Uo(t),be=t[6].g.s>0&&jo(t);return{c(){var $e,Ft;e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("div"),d=p("div"),b=C(h),g=p("br"),k=v(),w=p("input"),A=v(),F=p("div"),M=C(L),R=p("br"),I=v(),y=p("select"),Te(K.$$.fragment),W=v(),N=p("input"),B=v(),X=p("div"),G=p("div"),V=p("div"),U=C(Y),z=p("br"),se=v(),le=p("select"),Q=p("optgroup"),dt&&dt.c(),ee=p("option"),ee.textContent="NO1",ue=p("option"),ue.textContent="NO2",ae=p("option"),ae.textContent="NO3",x=p("option"),x.textContent="NO4",_e=p("option"),_e.textContent="NO5",oe=p("optgroup"),J=p("option"),J.textContent="SE1",$=p("option"),$.textContent="SE2",he=p("option"),he.textContent="SE3",ke=p("option"),ke.textContent="SE4",D=p("optgroup"),S=p("option"),S.textContent="DK1",O=p("option"),O.textContent="DK2",q=p("option"),q.textContent="Austria",j=p("option"),j.textContent="Belgium",ne=p("option"),ne.textContent="Czech Republic",fe=p("option"),fe.textContent="Estonia",me=p("option"),me.textContent="Finland",pe=p("option"),pe.textContent="France",de=p("option"),de.textContent="Germany",Se=p("option"),Se.textContent="Great Britain",ge=p("option"),ge.textContent="Latvia",Le=p("option"),Le.textContent="Lithuania",qe=p("option"),qe.textContent="Netherland",Oe=p("option"),Oe.textContent="Poland",re=p("option"),re.textContent="Slovenia",Ce=p("option"),Ce.textContent="Switzerland",Be=v(),Ze=p("div"),Xe=C(bt),et=p("br"),pt=v(),st=p("select");for(let al=0;al<5;al+=1)At[al].c();tt=v(),gt=p("div"),Te(it.$$.fragment),Dt=v(),Ae=p("div"),Pe=p("label"),Fe=p("input"),Ye=v(),Ee=C(ve),ye=v(),_t&&_t.c(),we=v(),De=p("div"),Ve=C(lt),zt=p("br"),at=v(),je=p("select"),St=p("option"),ft=C(mt),rt=p("option"),Vt=C(Lt),Mt=p("option"),Kt=C(xe),It=v(),be&&be.c(),ot=v(),Yt=p("div"),jt=C($t),Pt=p("br"),ll=v(),Ue=p("input"),u(l,"class","text-sm"),u(a,"href",_l("General-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","g"),f.value="true",u(w,"name","gh"),u(w,"type","text"),u(w,"class","in-f w-full"),u(w,"pattern","[A-Za-z0-9-]+"),u(y,"name","gt"),u(y,"class","in-l w-full"),t[6].g.t===void 0&&Bt(()=>t[23].call(y)),u(_,"class","flex"),u(m,"class","my-1"),u(N,"type","hidden"),u(N,"name","p"),N.value="true",ee.__value="10YNO-1--------2",H(ee,ee.__value),ue.__value="10YNO-2--------T",H(ue,ue.__value),ae.__value="10YNO-3--------J",H(ae,ae.__value),x.__value="10YNO-4--------9",H(x,x.__value),_e.__value="10Y1001A1001A48H",H(_e,_e.__value),u(Q,"label","Norway"),J.__value="10Y1001A1001A44P",H(J,J.__value),$.__value="10Y1001A1001A45N",H($,$.__value),he.__value="10Y1001A1001A46L",H(he,he.__value),ke.__value="10Y1001A1001A47J",H(ke,ke.__value),u(oe,"label","Sweden"),S.__value="10YDK-1--------W",H(S,S.__value),O.__value="10YDK-2--------M",H(O,O.__value),u(D,"label","Denmark"),q.__value="10YAT-APG------L",H(q,q.__value),j.__value="10YBE----------2",H(j,j.__value),ne.__value="10YCZ-CEPS-----N",H(ne,ne.__value),fe.__value="10Y1001A1001A39I",H(fe,fe.__value),me.__value="10YFI-1--------U",H(me,me.__value),pe.__value="10YFR-RTE------C",H(pe,pe.__value),de.__value="10Y1001A1001A83F",H(de,de.__value),Se.__value="10YGB----------A",H(Se,Se.__value),ge.__value="10YLV-1001A00074",H(ge,ge.__value),Le.__value="10YLT-1001A0008Q",H(Le,Le.__value),qe.__value="10YNL----------L",H(qe,qe.__value),Oe.__value="10YPL-AREA-----S",H(Oe,Oe.__value),re.__value="10YSI-ELES-----O",H(re,re.__value),Ce.__value="10YCH-SWISSGRIDZ",H(Ce,Ce.__value),u(le,"name","pr"),u(le,"class","in-f w-full"),t[6].p.r===void 0&&Bt(()=>t[24].call(le)),u(V,"class","w-full"),u(st,"name","pc"),u(st,"class","in-l"),t[6].p.c===void 0&&Bt(()=>t[25].call(st)),u(G,"class","flex"),u(X,"class","my-1"),u(gt,"class","my-1"),u(Fe,"type","checkbox"),u(Fe,"name","pe"),Fe.__value="true",H(Fe,Fe.__value),u(Fe,"class","rounded mb-1"),u(Ae,"class","my-1"),St.__value=0,H(St,St.__value),rt.__value=1,H(rt,rt.__value),Mt.__value=2,H(Mt,Mt.__value),u(je,"name","gs"),u(je,"class","in-s"),t[6].g.s===void 0&&Bt(()=>t[28].call(je)),u(De,"class","my-1"),u(Ue,"name","gc"),u(Ue,"type","text"),u(Ue,"pattern","[A-Za-z0-9]+"),u(Ue,"placeholder",ct=((Ft=($e=t[2].conf)==null?void 0:$e.general)==null?void 0:Ft.context_placeholder)??"/"),u(Ue,"class","in-s"),u(Ue,"maxlength","36"),u(Yt,"class","my-1"),u(e,"class","cnt")},m($e,Ft){P($e,e,Ft),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,d),o(d,b),o(d,g),o(d,k),o(d,w),H(w,t[6].g.h),o(_,A),o(_,F),o(F,M),o(F,R),o(F,I),o(F,y),Me(K,y,null),Qe(y,t[6].g.t,!0),o(e,W),o(e,N),o(e,B),o(e,X),o(X,G),o(G,V),o(V,U),o(V,z),o(V,se),o(V,le),o(le,Q),dt&&dt.m(Q,null),o(Q,ee),o(Q,ue),o(Q,ae),o(Q,x),o(Q,_e),o(le,oe),o(oe,J),o(oe,$),o(oe,he),o(oe,ke),o(le,D),o(D,S),o(D,O),o(le,q),o(le,j),o(le,ne),o(le,fe),o(le,me),o(le,pe),o(le,de),o(le,Se),o(le,ge),o(le,Le),o(le,qe),o(le,Oe),o(le,re),o(le,Ce),Qe(le,t[6].p.r,!0),o(G,Be),o(G,Ze),o(Ze,Xe),o(Ze,et),o(Ze,pt),o(Ze,st);for(let al=0;al<5;al+=1)At[al]&&At[al].m(st,null);Qe(st,t[6].p.c,!0),o(e,tt),o(e,gt),Me(it,gt,null),o(e,Dt),o(e,Ae),o(Ae,Pe),o(Pe,Fe),Fe.checked=t[6].p.e,o(Pe,Ye),o(Pe,Ee),o(Ae,ye),_t&&_t.m(Ae,null),o(e,we),o(e,De),o(De,Ve),o(De,zt),o(De,at),o(De,je),o(je,St),o(St,ft),o(je,rt),o(rt,Vt),o(je,Mt),o(Mt,Kt),Qe(je,t[6].g.s,!0),o(e,It),be&&be.m(e,null),o(e,ot),o(e,Yt),o(Yt,jt),o(Yt,Pt),o(Yt,ll),o(Yt,Ue),H(Ue,t[6].g.c),ut=!0,Rt||(Ht=[ce(w,"input",t[22]),ce(y,"change",t[23]),ce(le,"change",t[24]),ce(st,"change",t[25]),ce(Fe,"change",t[26]),ce(je,"change",t[28]),ce(Ue,"input",t[31])],Rt=!0)},p($e,Ft){var Fl,Bl,Ul,jl,Hl,yl,zl,Wl,Gl,Vl,Kl,Yl,Ql,Xl,Zl,Jl,gn,kn,wn,Wi,Gi,Vi,Ki,Yi,Qi,Xi,Zi,Ji;(!ut||Ft[0]&4)&&n!==(n=(((Bl=(Fl=$e[2].conf)==null?void 0:Fl.general)==null?void 0:Bl.title)??"General")+"")&&E(i,n),(!ut||Ft[0]&4)&&h!==(h=(((jl=(Ul=$e[2].conf)==null?void 0:Ul.general)==null?void 0:jl.hostname)??"Hostname")+"")&&E(b,h),Ft[0]&64&&w.value!==$e[6].g.h&&H(w,$e[6].g.h),(!ut||Ft[0]&4)&&L!==(L=(((yl=(Hl=$e[2].conf)==null?void 0:Hl.general)==null?void 0:yl.timezone)??"Time zone")+"")&&E(M,L),Ft[0]&64&&Qe(y,$e[6].g.t),(!ut||Ft[0]&4)&&Y!==(Y=(((Wl=(zl=$e[2].conf)==null?void 0:zl.price)==null?void 0:Wl.region)??"Price region")+"")&&E(U,Y),$e[6].p.t?dt&&(dt.d(1),dt=null):dt||(dt=Bo(),dt.c(),dt.m(Q,ee)),Ft[0]&64&&Qe(le,$e[6].p.r),(!ut||Ft[0]&4)&&bt!==(bt=(((Vl=(Gl=$e[2].conf)==null?void 0:Gl.price)==null?void 0:Vl.currency)??"Currency")+"")&&E(Xe,bt),Ft[0]&64&&Qe(st,$e[6].p.c);const al={};Ft[0]&4|Ft[4]&128&&(al.$$scope={dirty:Ft,ctx:$e}),it.$set(al),Ft[0]&64&&(Fe.checked=$e[6].p.e),(!ut||Ft[0]&4)&&ve!==(ve=(((Yl=(Kl=$e[2].conf)==null?void 0:Kl.price)==null?void 0:Yl.enabled)??"Enabled")+"")&&E(Ee,ve),$e[6].p.e&&$e[0].chip!="esp8266"?_t?_t.p($e,Ft):(_t=Uo($e),_t.c(),_t.m(Ae,null)):_t&&(_t.d(1),_t=null),(!ut||Ft[0]&4)&<!==(lt=(((Zl=(Xl=(Ql=$e[2].conf)==null?void 0:Ql.general)==null?void 0:Xl.security)==null?void 0:Zl.title)??"Security")+"")&&E(Ve,lt),(!ut||Ft[0]&4)&&mt!==(mt=(((kn=(gn=(Jl=$e[2].conf)==null?void 0:Jl.general)==null?void 0:gn.security)==null?void 0:kn.none)??"None")+"")&&E(ft,mt),(!ut||Ft[0]&4)&&Lt!==(Lt=(((Gi=(Wi=(wn=$e[2].conf)==null?void 0:wn.general)==null?void 0:Wi.security)==null?void 0:Gi.conf)??"Conf")+"")&&E(Vt,Lt),(!ut||Ft[0]&4)&&xe!==(xe=(((Yi=(Ki=(Vi=$e[2].conf)==null?void 0:Vi.general)==null?void 0:Ki.security)==null?void 0:Yi.all)??"All")+"")&&E(Kt,xe),Ft[0]&64&&Qe(je,$e[6].g.s),$e[6].g.s>0?be?be.p($e,Ft):(be=jo($e),be.c(),be.m(e,ot)):be&&(be.d(1),be=null),(!ut||Ft[0]&4)&&$t!==($t=(((Xi=(Qi=$e[2].conf)==null?void 0:Qi.general)==null?void 0:Xi.context)??"Context")+"")&&E(jt,$t),(!ut||Ft[0]&4&&ct!==(ct=((Ji=(Zi=$e[2].conf)==null?void 0:Zi.general)==null?void 0:Ji.context_placeholder)??"/"))&&u(Ue,"placeholder",ct),Ft[0]&64&&Ue.value!==$e[6].g.c&&H(Ue,$e[6].g.c)},i($e){ut||(Z(K.$$.fragment,$e),Z(it.$$.fragment,$e),ut=!0)},o($e){ie(K.$$.fragment,$e),ie(it.$$.fragment,$e),ut=!1},d($e){$e&&T(e),Ne(K),dt&&dt.d(),tl(At,$e),Ne(it),_t&&_t.d(),be&&be.d(),Rt=!1,Ut(Ht)}}}function Bo(t){let e,l,n,i,s;return{c(){e=p("option"),e.textContent="NO1 with support",l=p("option"),l.textContent="NO2 with support",n=p("option"),n.textContent="NO3 with support",i=p("option"),i.textContent="NO4 with support",s=p("option"),s.textContent="NO5 with support",e.__value="NO1S",H(e,e.__value),l.__value="NO2S",H(l,l.__value),n.__value="NO3S",H(n,n.__value),i.__value="NO4S",H(i,i.__value),s.__value="NO5S",H(s,s.__value)},m(a,r){P(a,e,r),P(a,l,r),P(a,n,r),P(a,i,r),P(a,s,r)},d(a){a&&(T(e),T(l),T(n),T(i),T(s))}}}function z0(t){let e;return{c(){e=p("option"),e.textContent=`${t[128]}`,e.__value=t[128],H(e,e.__value)},m(l,n){P(l,e,n)},p:We,d(l){l&&T(e)}}}function W0(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.price)==null?void 0:i.conf)??"Configure")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.price)==null?void 0:f.conf)??"Configure")+"")&&E(l,e)},d(s){s&&T(l)}}}function Uo(t){let e,l,n,i,s;return{c(){var a,r;e=p("br"),l=p("input"),u(l,"name","pt"),u(l,"type","text"),u(l,"class","in-s"),u(l,"placeholder",n=((r=(a=t[2].conf)==null?void 0:a.price)==null?void 0:r.api_key_placeholder)??"")},m(a,r){P(a,e,r),P(a,l,r),H(l,t[6].p.t),i||(s=ce(l,"input",t[27]),i=!0)},p(a,r){var f,c;r[0]&4&&n!==(n=((c=(f=a[2].conf)==null?void 0:f.price)==null?void 0:c.api_key_placeholder)??"")&&u(l,"placeholder",n),r[0]&64&&l.value!==a[6].p.t&&H(l,a[6].p.t)},d(a){a&&(T(e),T(l)),i=!1,s()}}}function jo(t){var k,w,A,F,L,M;let e,l=(((A=(w=(k=t[2].conf)==null?void 0:k.general)==null?void 0:w.security)==null?void 0:A.username)??"Username")+"",n,i,s,a,r,f,c=(((M=(L=(F=t[2].conf)==null?void 0:F.general)==null?void 0:L.security)==null?void 0:M.password)??"Password")+"",m,_,d,h,b,g;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),r=v(),f=p("div"),m=C(c),_=p("br"),d=v(),h=p("input"),u(a,"name","gu"),u(a,"type","text"),u(a,"class","in-s"),u(a,"maxlength","36"),u(e,"class","my-1"),u(h,"name","gp"),u(h,"type","password"),u(h,"class","in-s"),u(h,"maxlength","36"),u(f,"class","my-1")},m(R,I){P(R,e,I),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].g.u),P(R,r,I),P(R,f,I),o(f,m),o(f,_),o(f,d),o(f,h),H(h,t[6].g.p),b||(g=[ce(a,"input",t[29]),ce(h,"input",t[30])],b=!0)},p(R,I){var y,K,W,N,B,X;I[0]&4&&l!==(l=(((W=(K=(y=R[2].conf)==null?void 0:y.general)==null?void 0:K.security)==null?void 0:W.username)??"Username")+"")&&E(n,l),I[0]&64&&a.value!==R[6].g.u&&H(a,R[6].g.u),I[0]&4&&c!==(c=(((X=(B=(N=R[2].conf)==null?void 0:N.general)==null?void 0:B.security)==null?void 0:X.password)??"Password")+"")&&E(m,c),I[0]&64&&h.value!==R[6].g.p&&H(h,R[6].g.p)},d(R){R&&(T(e),T(r),T(f)),b=!1,Ut(g)}}}function Ho(t){var we,De,lt,Ve,zt,at,je,St,mt,ft,rt,Lt,Vt,Mt,xe,Kt,It,ot,Yt,$t,jt,Pt,ll;let e,l,n=(((De=(we=t[2].conf)==null?void 0:we.meter)==null?void 0:De.title)??"Meter")+"",i,s,a,r,f,c,m,_,d,h=(((zt=(Ve=(lt=t[2].conf)==null?void 0:lt.meter)==null?void 0:Ve.comm)==null?void 0:zt.title)??"Communication")+"",b,g,k,w,A,F=(((St=(je=(at=t[2].conf)==null?void 0:at.meter)==null?void 0:je.comm)==null?void 0:St.passive)??"Passive")+"",L,M,R=(((rt=(ft=(mt=t[2].conf)==null?void 0:mt.meter)==null?void 0:ft.comm)==null?void 0:rt.pulse)??"Pulse")+"",I,y=(Vt=(Lt=t[0])==null?void 0:Lt.features)==null?void 0:Vt.includes("kmp"),K,W,N,B=(((Mt=t[2].common)==null?void 0:Mt.voltage)??"Voltage")+"",X,G,V,Y,U,z,se,le,Q,ee=(((Kt=(xe=t[2].conf)==null?void 0:xe.meter)==null?void 0:Kt.fuse)??"Main fuse")+"",ue,ae,x,_e,oe,J,$,he,ke,D=(((ot=(It=t[2].conf)==null?void 0:It.meter)==null?void 0:ot.prod)??"Production")+"",S,O,q,j,ne,fe,me,pe,de,Se,ge,Le,qe,Oe,re=((($t=(Yt=t[2].conf)==null?void 0:Yt.meter)==null?void 0:$t.encrypted)??"Encrypted")+"",Ce,Be,Ze,bt,Xe,et,pt,st=(((ll=(Pt=(jt=t[2].conf)==null?void 0:jt.meter)==null?void 0:Pt.multipliers)==null?void 0:ll.title)??"Multipliers")+"",tt,gt,it,Dt,Ae=y&&yo();function Pe(Ue,ct){return Ue[6].m.a===2?V0:G0}let Fe=Pe(t),Ye=Fe(t),ve=t[6].m.e.e&&zo(t),Ee=t[6].m.e.e&&Wo(t),ye=t[6].m.m.e&&Go(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("input"),_=v(),d=p("div"),b=C(h),g=p("br"),k=v(),w=p("select"),A=p("option"),L=C(F),M=p("option"),I=C(R),Ae&&Ae.c(),K=v(),Ye.c(),W=v(),N=p("div"),X=C(B),G=p("br"),V=v(),Y=p("select"),U=p("option"),U.textContent="400V (TN)",z=p("option"),z.textContent="230V (IT/TT)",se=v(),le=p("div"),Q=p("div"),ue=C(ee),ae=p("br"),x=v(),_e=p("label"),oe=p("input"),J=v(),$=p("span"),$.textContent="A",he=v(),ke=p("div"),S=C(D),O=p("br"),q=v(),j=p("label"),ne=p("input"),fe=v(),me=p("span"),me.textContent="kWp",pe=v(),de=p("div"),de.innerHTML="",Se=v(),ge=p("div"),Le=p("label"),qe=p("input"),Oe=v(),Ce=C(re),Be=v(),ve&&ve.c(),Ze=v(),Ee&&Ee.c(),bt=v(),Xe=p("label"),et=p("input"),pt=v(),tt=C(st),gt=v(),ye&&ye.c(),u(l,"class","text-sm"),u(a,"href",_l("Meter-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","m"),f.value="true",u(m,"type","hidden"),u(m,"name","mo"),m.value="1",A.__value=0,H(A,A.__value),M.__value=2,H(M,M.__value),u(w,"name","ma"),u(w,"class","in-s"),t[6].m.a===void 0&&Bt(()=>t[32].call(w)),u(d,"class","my-1"),U.__value=2,H(U,U.__value),z.__value=1,H(z,z.__value),u(Y,"name","md"),u(Y,"class","in-s"),t[6].m.d===void 0&&Bt(()=>t[38].call(Y)),u(N,"class","my-1"),u(oe,"name","mf"),u(oe,"type","number"),u(oe,"min","5"),u(oe,"max","65535"),u(oe,"class","in-f tr w-full"),u($,"class","in-post"),u(_e,"class","flex"),u(Q,"class","mx-1"),u(ne,"name","mr"),u(ne,"type","number"),u(ne,"min","0"),u(ne,"max","65535"),u(ne,"class","in-f tr w-full"),u(me,"class","in-post"),u(j,"class","flex"),u(ke,"class","mx-1"),u(le,"class","my-1 flex"),u(de,"class","my-1"),u(qe,"type","checkbox"),u(qe,"name","me"),qe.__value="true",H(qe,qe.__value),u(qe,"class","rounded mb-1"),u(ge,"class","my-1"),u(et,"type","checkbox"),u(et,"name","mm"),et.__value="true",H(et,et.__value),u(et,"class","rounded mb-1"),u(e,"class","cnt")},m(Ue,ct){P(Ue,e,ct),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(e,_),o(e,d),o(d,b),o(d,g),o(d,k),o(d,w),o(w,A),o(A,L),o(w,M),o(M,I),Ae&&Ae.m(w,null),Qe(w,t[6].m.a,!0),o(e,K),Ye.m(e,null),o(e,W),o(e,N),o(N,X),o(N,G),o(N,V),o(N,Y),o(Y,U),o(Y,z),Qe(Y,t[6].m.d,!0),o(e,se),o(e,le),o(le,Q),o(Q,ue),o(Q,ae),o(Q,x),o(Q,_e),o(_e,oe),H(oe,t[6].m.f),o(_e,J),o(_e,$),o(le,he),o(le,ke),o(ke,S),o(ke,O),o(ke,q),o(ke,j),o(j,ne),H(ne,t[6].m.r),o(j,fe),o(j,me),o(e,pe),o(e,de),o(e,Se),o(e,ge),o(ge,Le),o(Le,qe),qe.checked=t[6].m.e.e,o(Le,Oe),o(Le,Ce),o(ge,Be),ve&&ve.m(ge,null),o(e,Ze),Ee&&Ee.m(e,null),o(e,bt),o(e,Xe),o(Xe,et),et.checked=t[6].m.m.e,o(Xe,pt),o(Xe,tt),o(e,gt),ye&&ye.m(e,null),it||(Dt=[ce(w,"change",t[32]),ce(Y,"change",t[38]),ce(oe,"input",t[39]),ce(ne,"input",t[40]),ce(qe,"change",t[41]),ce(et,"change",t[44])],it=!0)},p(Ue,ct){var ut,Rt,Ht,dt,yt,At,_t,be,nt,ze,il,Je,wt,Xt,xt,nl,Wt,sl,Ie,te,Re,cl,ml;ct[0]&4&&n!==(n=(((Rt=(ut=Ue[2].conf)==null?void 0:ut.meter)==null?void 0:Rt.title)??"Meter")+"")&&E(i,n),ct[0]&4&&h!==(h=(((yt=(dt=(Ht=Ue[2].conf)==null?void 0:Ht.meter)==null?void 0:dt.comm)==null?void 0:yt.title)??"Communication")+"")&&E(b,h),ct[0]&4&&F!==(F=(((be=(_t=(At=Ue[2].conf)==null?void 0:At.meter)==null?void 0:_t.comm)==null?void 0:be.passive)??"Passive")+"")&&E(L,F),ct[0]&4&&R!==(R=(((il=(ze=(nt=Ue[2].conf)==null?void 0:nt.meter)==null?void 0:ze.comm)==null?void 0:il.pulse)??"Pulse")+"")&&E(I,R),ct[0]&1&&(y=(wt=(Je=Ue[0])==null?void 0:Je.features)==null?void 0:wt.includes("kmp")),y?Ae||(Ae=yo(),Ae.c(),Ae.m(w,null)):Ae&&(Ae.d(1),Ae=null),ct[0]&64&&Qe(w,Ue[6].m.a),Fe===(Fe=Pe(Ue))&&Ye?Ye.p(Ue,ct):(Ye.d(1),Ye=Fe(Ue),Ye&&(Ye.c(),Ye.m(e,W))),ct[0]&4&&B!==(B=(((Xt=Ue[2].common)==null?void 0:Xt.voltage)??"Voltage")+"")&&E(X,B),ct[0]&64&&Qe(Y,Ue[6].m.d),ct[0]&4&&ee!==(ee=(((nl=(xt=Ue[2].conf)==null?void 0:xt.meter)==null?void 0:nl.fuse)??"Main fuse")+"")&&E(ue,ee),ct[0]&64&&He(oe.value)!==Ue[6].m.f&&H(oe,Ue[6].m.f),ct[0]&4&&D!==(D=(((sl=(Wt=Ue[2].conf)==null?void 0:Wt.meter)==null?void 0:sl.prod)??"Production")+"")&&E(S,D),ct[0]&64&&He(ne.value)!==Ue[6].m.r&&H(ne,Ue[6].m.r),ct[0]&64&&(qe.checked=Ue[6].m.e.e),ct[0]&4&&re!==(re=(((te=(Ie=Ue[2].conf)==null?void 0:Ie.meter)==null?void 0:te.encrypted)??"Encrypted")+"")&&E(Ce,re),Ue[6].m.e.e?ve?ve.p(Ue,ct):(ve=zo(Ue),ve.c(),ve.m(ge,null)):ve&&(ve.d(1),ve=null),Ue[6].m.e.e?Ee?Ee.p(Ue,ct):(Ee=Wo(Ue),Ee.c(),Ee.m(e,bt)):Ee&&(Ee.d(1),Ee=null),ct[0]&64&&(et.checked=Ue[6].m.m.e),ct[0]&4&&st!==(st=(((ml=(cl=(Re=Ue[2].conf)==null?void 0:Re.meter)==null?void 0:cl.multipliers)==null?void 0:ml.title)??"Multipliers")+"")&&E(tt,st),Ue[6].m.m.e?ye?ye.p(Ue,ct):(ye=Go(Ue),ye.c(),ye.m(e,null)):ye&&(ye.d(1),ye=null)},d(Ue){Ue&&T(e),Ae&&Ae.d(),Ye.d(),ve&&ve.d(),Ee&&Ee.d(),ye&&ye.d(),it=!1,Ut(Dt)}}}function yo(t){let e;return{c(){e=p("option"),e.textContent="KMP",e.__value=9,H(e,e.__value)},m(l,n){P(l,e,n)},d(l){l&&T(e)}}}function G0(t){var ue,ae,x,_e,oe,J;let e,l,n=(((ae=(ue=t[2].conf)==null?void 0:ue.meter)==null?void 0:ae.buffer)??"Buffer size")+"",i,s,a,r=(((_e=(x=t[2].conf)==null?void 0:x.meter)==null?void 0:_e.serial)??"Serial conf.")+"",f,c,m,_,d,h=(((J=(oe=t[2].conf)==null?void 0:oe.meter)==null?void 0:J.inverted)??"inverted")+"",b,g,k,w,A,F,L,M,R,I,y,K,W,N,B,X,G,V,Y,U,z,se,le,Q=kt([3,12,24,48,96,192,384,576,1152]),ee=[];for(let $=0;$<9;$+=1)ee[$]=K0(H0(t,Q,$));return{c(){e=p("div"),l=p("span"),i=C(n),s=v(),a=p("span"),f=C(r),c=v(),m=p("label"),_=p("input"),d=v(),b=C(h),g=v(),k=p("div"),w=p("select"),A=p("option"),F=C("Autodetect");for(let $=0;$<9;$+=1)ee[$].c();M=v(),R=p("select"),I=p("option"),y=C("-"),W=p("option"),W.textContent="7N1",N=p("option"),N.textContent="8N1",B=p("option"),B.textContent="8N2",X=p("option"),X.textContent="7E1",G=p("option"),G.textContent="8E1",Y=v(),U=p("input"),u(l,"class","float-right"),u(_,"name","mi"),_.__value="true",H(_,_.__value),u(_,"type","checkbox"),u(_,"class","rounded mb-1"),u(m,"class","mt-2 ml-3 whitespace-nowrap"),A.__value=0,H(A,A.__value),A.disabled=L=t[6].m.b!=0,u(w,"name","mb"),u(w,"class","in-f tr w-1/2"),t[6].m.b===void 0&&Bt(()=>t[35].call(w)),I.__value=0,H(I,I.__value),I.disabled=K=t[6].m.b!=0,W.__value=2,H(W,W.__value),N.__value=3,H(N,N.__value),B.__value=7,H(B,B.__value),X.__value=10,H(X,X.__value),G.__value=11,H(G,G.__value),u(R,"name","mp"),u(R,"class","in-m"),R.disabled=V=t[6].m.b==0,t[6].m.p===void 0&&Bt(()=>t[36].call(R)),u(U,"name","ms"),u(U,"type","number"),u(U,"min",64),u(U,"max",z=t[0].chip=="esp8266"?t[6].i.h.p==3||t[6].i.h.p==113?512:256:4096),u(U,"step",64),u(U,"class","in-l tr w-1/2"),u(k,"class","flex w-full"),u(e,"class","my-1")},m($,he){P($,e,he),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(e,c),o(e,m),o(m,_),_.checked=t[6].m.i,o(m,d),o(m,b),o(e,g),o(e,k),o(k,w),o(w,A),o(A,F);for(let ke=0;ke<9;ke+=1)ee[ke]&&ee[ke].m(w,null);Qe(w,t[6].m.b,!0),o(k,M),o(k,R),o(R,I),o(I,y),o(R,W),o(R,N),o(R,B),o(R,X),o(R,G),Qe(R,t[6].m.p,!0),o(k,Y),o(k,U),H(U,t[6].m.s),se||(le=[ce(_,"change",t[34]),ce(w,"change",t[35]),ce(R,"change",t[36]),ce(U,"input",t[37])],se=!0)},p($,he){var ke,D,S,O,q,j;he[0]&4&&n!==(n=(((D=(ke=$[2].conf)==null?void 0:ke.meter)==null?void 0:D.buffer)??"Buffer size")+"")&&E(i,n),he[0]&4&&r!==(r=(((O=(S=$[2].conf)==null?void 0:S.meter)==null?void 0:O.serial)??"Serial conf.")+"")&&E(f,r),he[0]&64&&(_.checked=$[6].m.i),he[0]&4&&h!==(h=(((j=(q=$[2].conf)==null?void 0:q.meter)==null?void 0:j.inverted)??"inverted")+"")&&E(b,h),he[0]&64&&L!==(L=$[6].m.b!=0)&&(A.disabled=L),he[0]&64&&Qe(w,$[6].m.b),he[0]&64&&K!==(K=$[6].m.b!=0)&&(I.disabled=K),he[0]&64&&V!==(V=$[6].m.b==0)&&(R.disabled=V),he[0]&64&&Qe(R,$[6].m.p),he[0]&65&&z!==(z=$[0].chip=="esp8266"?$[6].i.h.p==3||$[6].i.h.p==113?512:256:4096)&&u(U,"max",z),he[0]&64&&He(U.value)!==$[6].m.s&&H(U,$[6].m.s)},d($){$&&T(e),tl(ee,$),se=!1,Ut(le)}}}function V0(t){var c,m;let e,l,n=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.pulses)??"Pulses per kWh")+"",i,s,a,r,f;return{c(){e=p("div"),l=p("span"),i=C(n),s=v(),a=p("input"),u(a,"name","mb"),u(a,"class","in-s tr"),u(a,"type","number"),u(a,"min",1),u(a,"max",3600),u(e,"class","my-1")},m(_,d){P(_,e,d),o(e,l),o(l,i),o(e,s),o(e,a),H(a,t[6].m.b),r||(f=ce(a,"input",t[33]),r=!0)},p(_,d){var h,b;d[0]&4&&n!==(n=(((b=(h=_[2].conf)==null?void 0:h.meter)==null?void 0:b.pulses)??"Pulses per kWh")+"")&&E(i,n),d[0]&64&&He(a.value)!==_[6].m.b&&H(a,_[6].m.b)},d(_){_&&T(e),r=!1,f()}}}function K0(t){let e;return{c(){e=p("option"),e.textContent=`${t[125]*100}`,e.__value=t[125]*100,H(e,e.__value)},m(l,n){P(l,e,n)},p:We,d(l){l&&T(e)}}}function zo(t){let e,l,n,i;return{c(){e=p("br"),l=p("input"),u(l,"name","mek"),u(l,"type","text"),u(l,"class","in-s")},m(s,a){P(s,e,a),P(s,l,a),H(l,t[6].m.e.k),n||(i=ce(l,"input",t[42]),n=!0)},p(s,a){a[0]&64&&l.value!==s[6].m.e.k&&H(l,s[6].m.e.k)},d(s){s&&(T(e),T(l)),n=!1,i()}}}function Wo(t){var c,m;let e,l=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.authkey)??"Authentication key")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","mea"),u(a,"type","text"),u(a,"class","in-s"),u(e,"class","my-1")},m(_,d){P(_,e,d),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].m.e.a),r||(f=ce(a,"input",t[43]),r=!0)},p(_,d){var h,b;d[0]&4&&l!==(l=(((b=(h=_[2].conf)==null?void 0:h.meter)==null?void 0:b.authkey)??"Authentication key")+"")&&E(n,l),d[0]&64&&a.value!==_[6].m.e.a&&H(a,_[6].m.e.a)},d(_){_&&T(e),r=!1,f()}}}function Go(t){var V,Y,U,z,se,le,Q,ee,ue,ae,x,_e;let e,l,n=(((U=(Y=(V=t[2].conf)==null?void 0:V.meter)==null?void 0:Y.multipliers)==null?void 0:U.watt)??"Watt")+"",i,s,a,r,f,c,m=(((le=(se=(z=t[2].conf)==null?void 0:z.meter)==null?void 0:se.multipliers)==null?void 0:le.volt)??"Volt")+"",_,d,h,b,g,k,w=(((ue=(ee=(Q=t[2].conf)==null?void 0:Q.meter)==null?void 0:ee.multipliers)==null?void 0:ue.amp)??"Amp")+"",A,F,L,M,R,I,y=(((_e=(x=(ae=t[2].conf)==null?void 0:ae.meter)==null?void 0:x.multipliers)==null?void 0:_e.kwh)??"kWh")+"",K,W,N,B,X,G;return{c(){e=p("div"),l=p("div"),i=C(n),s=p("br"),a=v(),r=p("input"),f=v(),c=p("div"),_=C(m),d=p("br"),h=v(),b=p("input"),g=v(),k=p("div"),A=C(w),F=p("br"),L=v(),M=p("input"),R=v(),I=p("div"),K=C(y),W=p("br"),N=v(),B=p("input"),u(r,"name","mmw"),u(r,"type","number"),u(r,"min","0.00"),u(r,"max","1000"),u(r,"step","0.001"),u(r,"class","in-f tr w-full"),u(l,"class","w-1/4"),u(b,"name","mmv"),u(b,"type","number"),u(b,"min","0.00"),u(b,"max","1000"),u(b,"step","0.001"),u(b,"class","in-m tr w-full"),u(c,"class","w-1/4"),u(M,"name","mma"),u(M,"type","number"),u(M,"min","0.00"),u(M,"max","1000"),u(M,"step","0.001"),u(M,"class","in-m tr w-full"),u(k,"class","w-1/4"),u(B,"name","mmc"),u(B,"type","number"),u(B,"min","0.00"),u(B,"max","1000"),u(B,"step","0.001"),u(B,"class","in-l tr w-full"),u(I,"class","w-1/4"),u(e,"class","flex my-1")},m(oe,J){P(oe,e,J),o(e,l),o(l,i),o(l,s),o(l,a),o(l,r),H(r,t[6].m.m.w),o(e,f),o(e,c),o(c,_),o(c,d),o(c,h),o(c,b),H(b,t[6].m.m.v),o(e,g),o(e,k),o(k,A),o(k,F),o(k,L),o(k,M),H(M,t[6].m.m.a),o(e,R),o(e,I),o(I,K),o(I,W),o(I,N),o(I,B),H(B,t[6].m.m.c),X||(G=[ce(r,"input",t[45]),ce(b,"input",t[46]),ce(M,"input",t[47]),ce(B,"input",t[48])],X=!0)},p(oe,J){var $,he,ke,D,S,O,q,j,ne,fe,me,pe;J[0]&4&&n!==(n=(((ke=(he=($=oe[2].conf)==null?void 0:$.meter)==null?void 0:he.multipliers)==null?void 0:ke.watt)??"Watt")+"")&&E(i,n),J[0]&64&&He(r.value)!==oe[6].m.m.w&&H(r,oe[6].m.m.w),J[0]&4&&m!==(m=(((O=(S=(D=oe[2].conf)==null?void 0:D.meter)==null?void 0:S.multipliers)==null?void 0:O.volt)??"Volt")+"")&&E(_,m),J[0]&64&&He(b.value)!==oe[6].m.m.v&&H(b,oe[6].m.m.v),J[0]&4&&w!==(w=(((ne=(j=(q=oe[2].conf)==null?void 0:q.meter)==null?void 0:j.multipliers)==null?void 0:ne.amp)??"Amp")+"")&&E(A,w),J[0]&64&&He(M.value)!==oe[6].m.m.a&&H(M,oe[6].m.m.a),J[0]&4&&y!==(y=(((pe=(me=(fe=oe[2].conf)==null?void 0:fe.meter)==null?void 0:me.multipliers)==null?void 0:pe.kwh)??"kWh")+"")&&E(K,y),J[0]&64&&He(B.value)!==oe[6].m.m.c&&H(B,oe[6].m.m.c)},d(oe){oe&&T(e),X=!1,Ut(G)}}}function Vo(t){var I,y,K,W,N,B;let e,l,n=(((y=(I=t[2].conf)==null?void 0:I.connection)==null?void 0:y.title)??"Connection")+"",i,s,a,r,f,c,m,_,d,h=(((W=(K=t[2].conf)==null?void 0:K.connection)==null?void 0:W.wifi)??"WiFi")+"",b,g,k=(((B=(N=t[2].conf)==null?void 0:N.connection)==null?void 0:B.ap)??"AP")+"",w,A,F,L,M=t[0].if&&t[0].if.eth&&Ko(t),R=(t[6].n.c==1||t[6].n.c==2)&&Yo(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("select"),d=p("option"),b=C(h),g=p("option"),w=C(k),M&&M.c(),A=v(),R&&R.c(),u(l,"class","text-sm"),u(a,"href",_l("Network-connection")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","w"),f.value="true",d.__value=1,H(d,d.__value),g.__value=2,H(g,g.__value),u(_,"name","nc"),u(_,"class","in-s"),t[6].n.c===void 0&&Bt(()=>t[49].call(_)),u(m,"class","my-1"),u(e,"class","cnt")},m(X,G){P(X,e,G),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,d),o(d,b),o(_,g),o(g,w),M&&M.m(_,null),Qe(_,t[6].n.c,!0),o(e,A),R&&R.m(e,null),F||(L=ce(_,"change",t[49]),F=!0)},p(X,G){var V,Y,U,z,se,le;G[0]&4&&n!==(n=(((Y=(V=X[2].conf)==null?void 0:V.connection)==null?void 0:Y.title)??"Connection")+"")&&E(i,n),G[0]&4&&h!==(h=(((z=(U=X[2].conf)==null?void 0:U.connection)==null?void 0:z.wifi)??"WiFi")+"")&&E(b,h),G[0]&4&&k!==(k=(((le=(se=X[2].conf)==null?void 0:se.connection)==null?void 0:le.ap)??"AP")+"")&&E(w,k),X[0].if&&X[0].if.eth?M?M.p(X,G):(M=Ko(X),M.c(),M.m(_,null)):M&&(M.d(1),M=null),G[0]&64&&Qe(_,X[6].n.c),X[6].n.c==1||X[6].n.c==2?R?R.p(X,G):(R=Yo(X),R.c(),R.m(e,null)):R&&(R.d(1),R=null)},d(X){X&&T(e),M&&M.d(),R&&R.d(),F=!1,L()}}}function Ko(t){var i,s;let e,l=(((s=(i=t[2].conf)==null?void 0:i.connection)==null?void 0:s.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=C(l),e.__value=3,H(e,e.__value)},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&E(n,l)},d(a){a&&T(e)}}}function Yo(t){var ne,fe,me,pe,de,Se,ge,Le,qe,Oe,re,Ce,Be,Ze,bt,Xe,et,pt,st,tt,gt,it,Dt;let e,l=(((fe=(ne=t[2].conf)==null?void 0:ne.connection)==null?void 0:fe.ssid)??"SSID")+"",n,i,s,a,r,f,c=(((pe=(me=t[2].conf)==null?void 0:me.connection)==null?void 0:pe.psk)??"Password")+"",m,_,d,h,b,g,k,w=(((ge=(Se=(de=t[2].conf)==null?void 0:de.connection)==null?void 0:Se.ps)==null?void 0:ge.title)??"Power saving")+"",A,F,L,M,R,I=(((Oe=(qe=(Le=t[2].conf)==null?void 0:Le.connection)==null?void 0:qe.ps)==null?void 0:Oe.default)??"Default")+"",y,K,W=(((Be=(Ce=(re=t[2].conf)==null?void 0:re.connection)==null?void 0:Ce.ps)==null?void 0:Be.off)??"Off")+"",N,B,X=(((Xe=(bt=(Ze=t[2].conf)==null?void 0:Ze.connection)==null?void 0:bt.ps)==null?void 0:Xe.min)??"Min")+"",G,V,Y=(((st=(pt=(et=t[2].conf)==null?void 0:et.connection)==null?void 0:pt.ps)==null?void 0:st.max)??"Max")+"",U,z,se,le=(((gt=(tt=t[2].conf)==null?void 0:tt.connection)==null?void 0:gt.pwr)??"Power")+"",Q,ee,ue,ae,x,_e,oe,J,$,he,ke,D,S=(((Dt=(it=t[2].conf)==null?void 0:it.connection)==null?void 0:Dt.tick_11b)??"802.11b")+"",O,q,j;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),r=v(),f=p("div"),m=C(c),_=p("br"),d=v(),h=p("input"),b=v(),g=p("div"),k=p("div"),A=C(w),F=p("br"),L=v(),M=p("select"),R=p("option"),y=C(I),K=p("option"),N=C(W),B=p("option"),G=C(X),V=p("option"),U=C(Y),z=v(),se=p("div"),Q=C(le),ee=p("br"),ue=v(),ae=p("div"),x=p("input"),_e=v(),oe=p("span"),oe.textContent="dBm",J=v(),$=p("div"),he=p("label"),ke=p("input"),D=v(),O=C(S),u(a,"name","ws"),u(a,"type","text"),u(a,"class","in-s"),u(e,"class","my-1"),u(h,"name","wp"),u(h,"type","password"),u(h,"class","in-s"),u(f,"class","my-1"),R.__value=255,H(R,R.__value),K.__value=0,H(K,K.__value),B.__value=1,H(B,B.__value),V.__value=2,H(V,V.__value),u(M,"name","wz"),u(M,"class","in-s"),t[6].w.z===void 0&&Bt(()=>t[52].call(M)),u(k,"class","w-1/2"),u(x,"name","ww"),u(x,"type","number"),u(x,"min","0"),u(x,"max","20.5"),u(x,"step","0.5"),u(x,"class","in-f tr w-full"),u(oe,"class","in-post"),u(ae,"class","flex"),u(se,"class","ml-2 w-1/2"),u(g,"class","my-1 flex"),u(ke,"type","checkbox"),u(ke,"name","wb"),ke.__value="true",H(ke,ke.__value),u(ke,"class","rounded mb-1"),u($,"class","my-3")},m(Ae,Pe){P(Ae,e,Pe),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].w.s),P(Ae,r,Pe),P(Ae,f,Pe),o(f,m),o(f,_),o(f,d),o(f,h),H(h,t[6].w.p),P(Ae,b,Pe),P(Ae,g,Pe),o(g,k),o(k,A),o(k,F),o(k,L),o(k,M),o(M,R),o(R,y),o(M,K),o(K,N),o(M,B),o(B,G),o(M,V),o(V,U),Qe(M,t[6].w.z,!0),o(g,z),o(g,se),o(se,Q),o(se,ee),o(se,ue),o(se,ae),o(ae,x),H(x,t[6].w.w),o(ae,_e),o(ae,oe),P(Ae,J,Pe),P(Ae,$,Pe),o($,he),o(he,ke),ke.checked=t[6].w.b,o(he,D),o(he,O),q||(j=[ce(a,"input",t[50]),ce(h,"input",t[51]),ce(M,"change",t[52]),ce(x,"input",t[53]),ce(ke,"change",t[54])],q=!0)},p(Ae,Pe){var Fe,Ye,ve,Ee,ye,we,De,lt,Ve,zt,at,je,St,mt,ft,rt,Lt,Vt,Mt,xe,Kt,It,ot;Pe[0]&4&&l!==(l=(((Ye=(Fe=Ae[2].conf)==null?void 0:Fe.connection)==null?void 0:Ye.ssid)??"SSID")+"")&&E(n,l),Pe[0]&64&&a.value!==Ae[6].w.s&&H(a,Ae[6].w.s),Pe[0]&4&&c!==(c=(((Ee=(ve=Ae[2].conf)==null?void 0:ve.connection)==null?void 0:Ee.psk)??"Password")+"")&&E(m,c),Pe[0]&64&&h.value!==Ae[6].w.p&&H(h,Ae[6].w.p),Pe[0]&4&&w!==(w=(((De=(we=(ye=Ae[2].conf)==null?void 0:ye.connection)==null?void 0:we.ps)==null?void 0:De.title)??"Power saving")+"")&&E(A,w),Pe[0]&4&&I!==(I=(((zt=(Ve=(lt=Ae[2].conf)==null?void 0:lt.connection)==null?void 0:Ve.ps)==null?void 0:zt.default)??"Default")+"")&&E(y,I),Pe[0]&4&&W!==(W=(((St=(je=(at=Ae[2].conf)==null?void 0:at.connection)==null?void 0:je.ps)==null?void 0:St.off)??"Off")+"")&&E(N,W),Pe[0]&4&&X!==(X=(((rt=(ft=(mt=Ae[2].conf)==null?void 0:mt.connection)==null?void 0:ft.ps)==null?void 0:rt.min)??"Min")+"")&&E(G,X),Pe[0]&4&&Y!==(Y=(((Mt=(Vt=(Lt=Ae[2].conf)==null?void 0:Lt.connection)==null?void 0:Vt.ps)==null?void 0:Mt.max)??"Max")+"")&&E(U,Y),Pe[0]&64&&Qe(M,Ae[6].w.z),Pe[0]&4&&le!==(le=(((Kt=(xe=Ae[2].conf)==null?void 0:xe.connection)==null?void 0:Kt.pwr)??"Power")+"")&&E(Q,le),Pe[0]&64&&He(x.value)!==Ae[6].w.w&&H(x,Ae[6].w.w),Pe[0]&64&&(ke.checked=Ae[6].w.b),Pe[0]&4&&S!==(S=(((ot=(It=Ae[2].conf)==null?void 0:It.connection)==null?void 0:ot.tick_11b)??"802.11b")+"")&&E(O,S)},d(Ae){Ae&&(T(e),T(r),T(f),T(b),T(g),T(J),T($)),q=!1,Ut(j)}}}function Qo(t){var re,Ce,Be,Ze,bt,Xe,et,pt,st,tt,gt,it,Dt,Ae;let e,l,n=(((Ce=(re=t[2].conf)==null?void 0:re.network)==null?void 0:Ce.title)??"Network")+"",i,s,a,r,f,c=(((Ze=(Be=t[2].conf)==null?void 0:Be.network)==null?void 0:Ze.ip)??"IP")+"",m,_,d,h,b,g,k=(((Xe=(bt=t[2].conf)==null?void 0:bt.network)==null?void 0:Xe.dhcp)??"DHCP")+"",w,A,F=(((pt=(et=t[2].conf)==null?void 0:et.network)==null?void 0:pt.static)??"Static")+"",L,M,R,I,y,K,W,N,B,X,G,V,Y,U,z,se,le,Q,ee,ue,ae,x=(((tt=(st=t[2].conf)==null?void 0:st.network)==null?void 0:tt.tick_mdns)??"mDNS")+"",_e,oe,J,$,he,ke=(((it=(gt=t[2].conf)==null?void 0:gt.network)==null?void 0:it.ntp)??"NTP")+"",D,S,O,q,j,ne=(((Ae=(Dt=t[2].conf)==null?void 0:Dt.network)==null?void 0:Ae.tick_ntp_dhcp)??"from DHCP")+"",fe,me,pe,de,Se,ge,Le,qe;N=new hu({});let Oe=t[6].n.m=="static"&&Xo(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("div"),m=C(c),_=p("br"),d=v(),h=p("div"),b=p("select"),g=p("option"),w=C(k),A=p("option"),L=C(F),M=v(),R=p("input"),K=v(),W=p("select"),Te(N.$$.fragment),G=v(),Oe&&Oe.c(),V=v(),Y=p("div"),U=p("label"),z=p("input"),se=C(" IPv6"),le=v(),Q=p("div"),ee=p("label"),ue=p("input"),ae=v(),_e=C(x),oe=v(),J=p("input"),$=v(),he=p("div"),D=C(ke),S=v(),O=p("label"),q=p("input"),j=v(),fe=C(ne),me=p("br"),pe=v(),de=p("div"),Se=p("input"),u(l,"class","text-sm"),u(a,"href",_l("Network-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),g.__value="dhcp",H(g,g.__value),A.__value="static",H(A,A.__value),u(b,"name","nm"),u(b,"class","in-f"),t[6].n.m===void 0&&Bt(()=>t[55].call(b)),u(R,"name","ni"),u(R,"type","text"),u(R,"class","in-m w-full"),R.disabled=I=t[6].n.m=="dhcp",R.required=y=t[6].n.m=="static",u(W,"name","ns"),u(W,"class","in-l"),W.disabled=B=t[6].n.m=="dhcp",W.required=X=t[6].n.m=="static",t[6].n.s===void 0&&Bt(()=>t[57].call(W)),u(h,"class","flex"),u(f,"class","my-1"),u(z,"name","nx"),z.__value="true",H(z,z.__value),u(z,"type","checkbox"),u(z,"class","rounded mb-1"),u(Y,"class","my-1"),u(ue,"name","nd"),ue.__value="true",H(ue,ue.__value),u(ue,"type","checkbox"),u(ue,"class","rounded mb-1"),u(Q,"class","my-1"),u(J,"type","hidden"),u(J,"name","ntp"),J.value="true",u(q,"name","ntpd"),q.__value="true",H(q,q.__value),u(q,"type","checkbox"),u(q,"class","rounded mb-1"),u(O,"class","ml-4"),u(Se,"name","ntph"),u(Se,"type","text"),u(Se,"class","in-s"),u(de,"class","flex"),u(he,"class","my-1"),u(e,"class","cnt")},m(Pe,Fe){P(Pe,e,Fe),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(f,m),o(f,_),o(f,d),o(f,h),o(h,b),o(b,g),o(g,w),o(b,A),o(A,L),Qe(b,t[6].n.m,!0),o(h,M),o(h,R),H(R,t[6].n.i),o(h,K),o(h,W),Me(N,W,null),Qe(W,t[6].n.s,!0),o(e,G),Oe&&Oe.m(e,null),o(e,V),o(e,Y),o(Y,U),o(U,z),z.checked=t[6].n.x,o(U,se),o(e,le),o(e,Q),o(Q,ee),o(ee,ue),ue.checked=t[6].n.d,o(ee,ae),o(ee,_e),o(e,oe),o(e,J),o(e,$),o(e,he),o(he,D),o(he,S),o(he,O),o(O,q),q.checked=t[6].n.h,o(O,j),o(O,fe),o(he,me),o(he,pe),o(he,de),o(de,Se),H(Se,t[6].n.n1),ge=!0,Le||(qe=[ce(b,"change",t[55]),ce(R,"input",t[56]),ce(W,"change",t[57]),ce(z,"change",t[61]),ce(ue,"change",t[62]),ce(q,"change",t[63]),ce(Se,"input",t[64])],Le=!0)},p(Pe,Fe){var Ye,ve,Ee,ye,we,De,lt,Ve,zt,at,je,St,mt,ft;(!ge||Fe[0]&4)&&n!==(n=(((ve=(Ye=Pe[2].conf)==null?void 0:Ye.network)==null?void 0:ve.title)??"Network")+"")&&E(i,n),(!ge||Fe[0]&4)&&c!==(c=(((ye=(Ee=Pe[2].conf)==null?void 0:Ee.network)==null?void 0:ye.ip)??"IP")+"")&&E(m,c),(!ge||Fe[0]&4)&&k!==(k=(((De=(we=Pe[2].conf)==null?void 0:we.network)==null?void 0:De.dhcp)??"DHCP")+"")&&E(w,k),(!ge||Fe[0]&4)&&F!==(F=(((Ve=(lt=Pe[2].conf)==null?void 0:lt.network)==null?void 0:Ve.static)??"Static")+"")&&E(L,F),Fe[0]&64&&Qe(b,Pe[6].n.m),(!ge||Fe[0]&64&&I!==(I=Pe[6].n.m=="dhcp"))&&(R.disabled=I),(!ge||Fe[0]&64&&y!==(y=Pe[6].n.m=="static"))&&(R.required=y),Fe[0]&64&&R.value!==Pe[6].n.i&&H(R,Pe[6].n.i),(!ge||Fe[0]&64&&B!==(B=Pe[6].n.m=="dhcp"))&&(W.disabled=B),(!ge||Fe[0]&64&&X!==(X=Pe[6].n.m=="static"))&&(W.required=X),Fe[0]&64&&Qe(W,Pe[6].n.s),Pe[6].n.m=="static"?Oe?Oe.p(Pe,Fe):(Oe=Xo(Pe),Oe.c(),Oe.m(e,V)):Oe&&(Oe.d(1),Oe=null),Fe[0]&64&&(z.checked=Pe[6].n.x),Fe[0]&64&&(ue.checked=Pe[6].n.d),(!ge||Fe[0]&4)&&x!==(x=(((at=(zt=Pe[2].conf)==null?void 0:zt.network)==null?void 0:at.tick_mdns)??"mDNS")+"")&&E(_e,x),(!ge||Fe[0]&4)&&ke!==(ke=(((St=(je=Pe[2].conf)==null?void 0:je.network)==null?void 0:St.ntp)??"NTP")+"")&&E(D,ke),Fe[0]&64&&(q.checked=Pe[6].n.h),(!ge||Fe[0]&4)&&ne!==(ne=(((ft=(mt=Pe[2].conf)==null?void 0:mt.network)==null?void 0:ft.tick_ntp_dhcp)??"from DHCP")+"")&&E(fe,ne),Fe[0]&64&&Se.value!==Pe[6].n.n1&&H(Se,Pe[6].n.n1)},i(Pe){ge||(Z(N.$$.fragment,Pe),ge=!0)},o(Pe){ie(N.$$.fragment,Pe),ge=!1},d(Pe){Pe&&T(e),Ne(N),Oe&&Oe.d(),Le=!1,Ut(qe)}}}function Xo(t){var F,L,M,R;let e,l=(((L=(F=t[2].conf)==null?void 0:F.network)==null?void 0:L.gw)??"Gateway")+"",n,i,s,a,r,f,c=(((R=(M=t[2].conf)==null?void 0:M.network)==null?void 0:R.dns)??"DNS")+"",m,_,d,h,b,g,k,w,A;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),r=v(),f=p("div"),m=C(c),_=p("br"),d=v(),h=p("div"),b=p("input"),g=v(),k=p("input"),u(a,"name","ng"),u(a,"type","text"),u(a,"class","in-s"),u(e,"class","my-1"),u(b,"name","nd1"),u(b,"type","text"),u(b,"class","in-f w-full"),u(k,"name","nd2"),u(k,"type","text"),u(k,"class","in-l w-full"),u(h,"class","flex"),u(f,"class","my-1")},m(I,y){P(I,e,y),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].n.g),P(I,r,y),P(I,f,y),o(f,m),o(f,_),o(f,d),o(f,h),o(h,b),H(b,t[6].n.d1),o(h,g),o(h,k),H(k,t[6].n.d2),w||(A=[ce(a,"input",t[58]),ce(b,"input",t[59]),ce(k,"input",t[60])],w=!0)},p(I,y){var K,W,N,B;y[0]&4&&l!==(l=(((W=(K=I[2].conf)==null?void 0:K.network)==null?void 0:W.gw)??"Gateway")+"")&&E(n,l),y[0]&64&&a.value!==I[6].n.g&&H(a,I[6].n.g),y[0]&4&&c!==(c=(((B=(N=I[2].conf)==null?void 0:N.network)==null?void 0:B.dns)??"DNS")+"")&&E(m,c),y[0]&64&&b.value!==I[6].n.d1&&H(b,I[6].n.d1),y[0]&64&&k.value!==I[6].n.d2&&H(k,I[6].n.d2)},d(I){I&&(T(e),T(r),T(f)),w=!1,Ut(A)}}}function Zo(t){var ll,Ue,ct,ut,Rt,Ht,dt,yt,At,_t,be,nt,ze,il,Je,wt,Xt,xt,nl,Wt,sl,Ie,te,Re,cl,ml;let e,l,n=(((Ue=(ll=t[2].conf)==null?void 0:ll.mqtt)==null?void 0:Ue.title)??"MQTT")+"",i,s,a,r,f,c,m,_=(((ut=(ct=t[2].conf)==null?void 0:ct.mqtt)==null?void 0:ut.server)??"Server")+"",d,h,b,g,k,w,A,F,L,M,R,I,y=(((Ht=(Rt=t[2].conf)==null?void 0:Rt.mqtt)==null?void 0:Ht.user)??"Username")+"",K,W,N,B,X,G,V=(((yt=(dt=t[2].conf)==null?void 0:dt.mqtt)==null?void 0:yt.pass)??"Password")+"",Y,U,z,se,le,Q,ee,ue=(((_t=(At=t[2].conf)==null?void 0:At.mqtt)==null?void 0:_t.id)??"Client ID")+"",ae,x,_e,oe,J,$,he,ke=(((nt=(be=t[2].conf)==null?void 0:be.mqtt)==null?void 0:nt.payload)??"Payload")+"",D,S,O,q,j,ne,fe,me,pe,de,Se,ge,Le,qe,Oe=(((il=(ze=t[2].conf)==null?void 0:ze.mqtt)==null?void 0:il.publish)??"Publish topic")+"",re,Ce,Be,Ze,bt,Xe,et=(((wt=(Je=t[2].conf)==null?void 0:Je.mqtt)==null?void 0:wt.update)??"Update method")+"",pt,st,tt,gt=(((xt=(Xt=t[2].conf)==null?void 0:Xt.mqtt)==null?void 0:xt.interval)??"Interval")+"",it,Dt,Ae,Pe,Fe,Ye=(((Wt=(nl=t[2].conf)==null?void 0:nl.mqtt)==null?void 0:Wt.realtime)??"Real time")+"",ve,Ee,ye=(((Ie=(sl=t[2].conf)==null?void 0:sl.mqtt)==null?void 0:Ie.interval)??"Interval")+"",we,De,lt,Ve,zt,at,je=(((Re=(te=t[2].conf)==null?void 0:te.mqtt)==null?void 0:Re.timeout)??"Timeout")+"",St,mt,ft,rt=(((ml=(cl=t[2].conf)==null?void 0:cl.mqtt)==null?void 0:ml.keepalive)??"Keep-alive")+"",Lt,Vt,Mt,xe,Kt,It,ot,Yt,$t,jt=t[0].chip!="esp8266"&&Jo(t),Pt=t[6].q.s.e&&$o(t);return{c(){var Ke,Ct;e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),d=C(_),h=v(),jt&&jt.c(),b=v(),g=p("br"),k=v(),w=p("div"),A=p("input"),F=v(),L=p("input"),M=v(),Pt&&Pt.c(),R=v(),I=p("div"),K=C(y),W=p("br"),N=v(),B=p("input"),X=v(),G=p("div"),Y=C(V),U=p("br"),z=v(),se=p("input"),le=v(),Q=p("div"),ee=p("div"),ae=C(ue),x=p("br"),_e=v(),oe=p("input"),$=v(),he=p("div"),D=C(ke),S=p("br"),O=v(),q=p("select"),j=p("option"),j.textContent="Raw (minimal)",ne=p("option"),ne.textContent="Raw (full)",fe=p("option"),fe.textContent="Domoticz",me=p("option"),me.textContent="Home-Assistant",pe=p("option"),pe.textContent="JSON (classic)",de=p("option"),de.textContent="JSON (multi topic)",Se=p("option"),Se.textContent="JSON (flat)",ge=p("option"),ge.textContent="HEX dump",Le=v(),qe=p("div"),re=C(Oe),Ce=p("br"),Be=v(),Ze=p("input"),bt=v(),Xe=p("div"),pt=C(et),st=v(),tt=p("span"),it=C(gt),Dt=v(),Ae=p("div"),Pe=p("select"),Fe=p("option"),ve=C(Ye),Ee=p("option"),we=C(ye),De=v(),lt=p("input"),zt=v(),at=p("div"),St=C(je),mt=v(),ft=p("span"),Lt=C(rt),Vt=v(),Mt=p("div"),xe=p("input"),Kt=v(),It=p("input"),u(l,"class","text-sm"),u(a,"href",_l("MQTT-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","q"),f.value="true",u(A,"name","qh"),u(A,"type","text"),u(A,"class","in-f w-2/3"),u(L,"name","qp"),u(L,"type","number"),u(L,"min","1024"),u(L,"max","65535"),u(L,"class","in-l tr w-1/3"),u(w,"class","flex"),u(m,"class","my-1"),u(B,"name","qu"),u(B,"type","text"),u(B,"class","in-s"),u(I,"class","my-1"),u(se,"name","qa"),u(se,"type","password"),u(se,"class","in-s"),u(G,"class","my-1"),u(oe,"name","qc"),u(oe,"type","text"),u(oe,"class","in-f w-full"),oe.required=J=t[6].q.h,j.__value=1,H(j,j.__value),ne.__value=2,H(ne,ne.__value),fe.__value=3,H(fe,fe.__value),me.__value=4,H(me,me.__value),pe.__value=0,H(pe,pe.__value),de.__value=5,H(de,de.__value),Se.__value=6,H(Se,Se.__value),ge.__value=255,H(ge,ge.__value),u(q,"name","qm"),u(q,"class","in-l"),t[6].q.m===void 0&&Bt(()=>t[71].call(q)),u(Q,"class","my-1 flex"),u(Ze,"name","qb"),u(Ze,"type","text"),u(Ze,"class","in-s"),u(qe,"class","my-1"),u(tt,"class","float-right"),Fe.__value=0,H(Fe,Fe.__value),Ee.__value=1,H(Ee,Ee.__value),u(Pe,"name","qt"),u(Pe,"class","in-f w-1/2"),t[6].q.t===void 0&&Bt(()=>t[73].call(Pe)),u(lt,"name","qd"),u(lt,"type","number"),u(lt,"min","1"),u(lt,"max","3600"),u(lt,"class","in-l tr w-1/2"),lt.disabled=Ve=((Ct=(Ke=t[6])==null?void 0:Ke.q)==null?void 0:Ct.t)!=1,u(Ae,"class","flex"),u(Xe,"class","my-1"),u(ft,"class","float-right"),u(xe,"name","qi"),u(xe,"type","number"),u(xe,"min","500"),u(xe,"max","10000"),u(xe,"class","in-f tr w-1/2"),u(It,"name","qk"),u(It,"type","number"),u(It,"min","5"),u(It,"max","180"),u(It,"class","in-l tr w-1/2"),u(Mt,"class","flex"),u(at,"class","my-1"),u(e,"class","cnt")},m(Ke,Ct){P(Ke,e,Ct),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,d),o(m,h),jt&&jt.m(m,null),o(m,b),o(m,g),o(m,k),o(m,w),o(w,A),H(A,t[6].q.h),o(w,F),o(w,L),H(L,t[6].q.p),o(e,M),Pt&&Pt.m(e,null),o(e,R),o(e,I),o(I,K),o(I,W),o(I,N),o(I,B),H(B,t[6].q.u),o(e,X),o(e,G),o(G,Y),o(G,U),o(G,z),o(G,se),H(se,t[6].q.a),o(e,le),o(e,Q),o(Q,ee),o(ee,ae),o(ee,x),o(ee,_e),o(ee,oe),H(oe,t[6].q.c),o(Q,$),o(Q,he),o(he,D),o(he,S),o(he,O),o(he,q),o(q,j),o(q,ne),o(q,fe),o(q,me),o(q,pe),o(q,de),o(q,Se),o(q,ge),Qe(q,t[6].q.m,!0),o(e,Le),o(e,qe),o(qe,re),o(qe,Ce),o(qe,Be),o(qe,Ze),H(Ze,t[6].q.b),o(e,bt),o(e,Xe),o(Xe,pt),o(Xe,st),o(Xe,tt),o(tt,it),o(Xe,Dt),o(Xe,Ae),o(Ae,Pe),o(Pe,Fe),o(Fe,ve),o(Pe,Ee),o(Ee,we),Qe(Pe,t[6].q.t,!0),o(Ae,De),o(Ae,lt),H(lt,t[6].q.d),o(e,zt),o(e,at),o(at,St),o(at,mt),o(at,ft),o(ft,Lt),o(at,Vt),o(at,Mt),o(Mt,xe),H(xe,t[6].q.i),o(Mt,Kt),o(Mt,It),H(It,t[6].q.k),ot=!0,Yt||($t=[ce(A,"input",t[66]),ce(L,"input",t[67]),ce(B,"input",t[68]),ce(se,"input",t[69]),ce(oe,"input",t[70]),ce(q,"change",t[71]),ce(Ze,"input",t[72]),ce(Pe,"change",t[73]),ce(lt,"input",t[74]),ce(xe,"input",t[75]),ce(It,"input",t[76])],Yt=!0)},p(Ke,Ct){var gl,kl,wl,Cl,Sl,Ll,Il,Ol,Rl,$e,Ft,al,Fl,Bl,Ul,jl,Hl,yl,zl,Wl,Gl,Vl,Kl,Yl,Ql,Xl,Zl,Jl;(!ot||Ct[0]&4)&&n!==(n=(((kl=(gl=Ke[2].conf)==null?void 0:gl.mqtt)==null?void 0:kl.title)??"MQTT")+"")&&E(i,n),(!ot||Ct[0]&4)&&_!==(_=(((Cl=(wl=Ke[2].conf)==null?void 0:wl.mqtt)==null?void 0:Cl.server)??"Server")+"")&&E(d,_),Ke[0].chip!="esp8266"?jt?jt.p(Ke,Ct):(jt=Jo(Ke),jt.c(),jt.m(m,b)):jt&&(jt.d(1),jt=null),Ct[0]&64&&A.value!==Ke[6].q.h&&H(A,Ke[6].q.h),Ct[0]&64&&He(L.value)!==Ke[6].q.p&&H(L,Ke[6].q.p),Ke[6].q.s.e?Pt?(Pt.p(Ke,Ct),Ct[0]&64&&Z(Pt,1)):(Pt=$o(Ke),Pt.c(),Z(Pt,1),Pt.m(e,R)):Pt&&(ht(),ie(Pt,1,1,()=>{Pt=null}),vt()),(!ot||Ct[0]&4)&&y!==(y=(((Ll=(Sl=Ke[2].conf)==null?void 0:Sl.mqtt)==null?void 0:Ll.user)??"Username")+"")&&E(K,y),Ct[0]&64&&B.value!==Ke[6].q.u&&H(B,Ke[6].q.u),(!ot||Ct[0]&4)&&V!==(V=(((Ol=(Il=Ke[2].conf)==null?void 0:Il.mqtt)==null?void 0:Ol.pass)??"Password")+"")&&E(Y,V),Ct[0]&64&&se.value!==Ke[6].q.a&&H(se,Ke[6].q.a),(!ot||Ct[0]&4)&&ue!==(ue=((($e=(Rl=Ke[2].conf)==null?void 0:Rl.mqtt)==null?void 0:$e.id)??"Client ID")+"")&&E(ae,ue),(!ot||Ct[0]&64&&J!==(J=Ke[6].q.h))&&(oe.required=J),Ct[0]&64&&oe.value!==Ke[6].q.c&&H(oe,Ke[6].q.c),(!ot||Ct[0]&4)&&ke!==(ke=(((al=(Ft=Ke[2].conf)==null?void 0:Ft.mqtt)==null?void 0:al.payload)??"Payload")+"")&&E(D,ke),Ct[0]&64&&Qe(q,Ke[6].q.m),(!ot||Ct[0]&4)&&Oe!==(Oe=(((Bl=(Fl=Ke[2].conf)==null?void 0:Fl.mqtt)==null?void 0:Bl.publish)??"Publish topic")+"")&&E(re,Oe),Ct[0]&64&&Ze.value!==Ke[6].q.b&&H(Ze,Ke[6].q.b),(!ot||Ct[0]&4)&&et!==(et=(((jl=(Ul=Ke[2].conf)==null?void 0:Ul.mqtt)==null?void 0:jl.update)??"Update method")+"")&&E(pt,et),(!ot||Ct[0]&4)&>!==(gt=(((yl=(Hl=Ke[2].conf)==null?void 0:Hl.mqtt)==null?void 0:yl.interval)??"Interval")+"")&&E(it,gt),(!ot||Ct[0]&4)&&Ye!==(Ye=(((Wl=(zl=Ke[2].conf)==null?void 0:zl.mqtt)==null?void 0:Wl.realtime)??"Real time")+"")&&E(ve,Ye),(!ot||Ct[0]&4)&&ye!==(ye=(((Vl=(Gl=Ke[2].conf)==null?void 0:Gl.mqtt)==null?void 0:Vl.interval)??"Interval")+"")&&E(we,ye),Ct[0]&64&&Qe(Pe,Ke[6].q.t),(!ot||Ct[0]&64&&Ve!==(Ve=((Yl=(Kl=Ke[6])==null?void 0:Kl.q)==null?void 0:Yl.t)!=1))&&(lt.disabled=Ve),Ct[0]&64&&He(lt.value)!==Ke[6].q.d&&H(lt,Ke[6].q.d),(!ot||Ct[0]&4)&&je!==(je=(((Xl=(Ql=Ke[2].conf)==null?void 0:Ql.mqtt)==null?void 0:Xl.timeout)??"Timeout")+"")&&E(St,je),(!ot||Ct[0]&4)&&rt!==(rt=(((Jl=(Zl=Ke[2].conf)==null?void 0:Zl.mqtt)==null?void 0:Jl.keepalive)??"Keep-alive")+"")&&E(Lt,rt),Ct[0]&64&&He(xe.value)!==Ke[6].q.i&&H(xe,Ke[6].q.i),Ct[0]&64&&He(It.value)!==Ke[6].q.k&&H(It,Ke[6].q.k)},i(Ke){ot||(Z(Pt),ot=!0)},o(Ke){ie(Pt),ot=!1},d(Ke){Ke&&T(e),jt&&jt.d(),Pt&&Pt.d(),Yt=!1,Ut($t)}}}function Jo(t){let e,l,n,i,s;return{c(){e=p("label"),l=p("input"),n=C(" SSL"),u(l,"type","checkbox"),u(l,"name","qs"),l.__value="true",H(l,l.__value),u(l,"class","rounded mb-1"),u(e,"class","float-right mr-3")},m(a,r){P(a,e,r),o(e,l),l.checked=t[6].q.s.e,o(e,n),i||(s=[ce(l,"change",t[65]),ce(l,"change",t[18])],i=!0)},p(a,r){r[0]&64&&(l.checked=a[6].q.s.e)},d(a){a&&T(e),i=!1,Ut(s)}}}function $o(t){let e,l,n,i,s,a,r,f,c,m,_,d,h;const b=[Q0,Y0],g=[];function k(I,y){return I[6].q.s.c?0:1}n=k(t),i=g[n]=b[n](t);const w=[$0,J0],A=[];function F(I,y){return I[6].q.s.r?0:1}r=F(t),f=A[r]=w[r](t);const L=[lc,tc],M=[];function R(I,y){return I[6].q.s.k?0:1}return _=R(t),d=M[_]=L[_](t),{c(){e=p("div"),l=p("span"),i.c(),s=v(),a=p("span"),f.c(),c=v(),m=p("span"),d.c(),u(l,"class","flex pr-2"),u(a,"class","flex pr-2"),u(m,"class","flex pr-2"),u(e,"class","my-1 flex")},m(I,y){P(I,e,y),o(e,l),g[n].m(l,null),o(e,s),o(e,a),A[r].m(a,null),o(e,c),o(e,m),M[_].m(m,null),h=!0},p(I,y){let K=n;n=k(I),n===K?g[n].p(I,y):(ht(),ie(g[K],1,1,()=>{g[K]=null}),vt(),i=g[n],i?i.p(I,y):(i=g[n]=b[n](I),i.c()),Z(i,1),i.m(l,null));let W=r;r=F(I),r===W?A[r].p(I,y):(ht(),ie(A[W],1,1,()=>{A[W]=null}),vt(),f=A[r],f?f.p(I,y):(f=A[r]=w[r](I),f.c()),Z(f,1),f.m(a,null));let N=_;_=R(I),_===N?M[_].p(I,y):(ht(),ie(M[N],1,1,()=>{M[N]=null}),vt(),d=M[_],d?d.p(I,y):(d=M[_]=L[_](I),d.c()),Z(d,1),d.m(m,null))},i(I){h||(Z(i),Z(f),Z(d),h=!0)},o(I){ie(i),ie(f),ie(d),h=!1},d(I){I&&T(e),g[n].d(),A[r].d(),M[_].d()}}}function Y0(t){let e,l;return e=new pl({props:{to:"/mqtt-ca",$$slots:{default:[X0]},$$scope:{ctx:t}}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i[0]&4|i[4]&128&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Q0(t){let e,l,n,i,s,a,r;return l=new pl({props:{to:"/mqtt-ca",$$slots:{default:[Z0]},$$scope:{ctx:t}}}),{c(){e=p("span"),Te(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Me(l,e,null),P(f,n,c),P(f,i,c),s=!0,a||(r=[ce(i,"click",t[15]),ce(i,"keypress",t[15])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&128&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){s||(Z(l.$$.fragment,f),s=!0)},o(f){ie(l.$$.fragment,f),s=!1},d(f){f&&(T(e),T(n),T(i)),Ne(l),a=!1,Ut(r)}}}function X0(t){var n,i,s,a;let e,l;return e=new sn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_ca_upload)??"Upload CA",title:((a=(s=t[2].conf)==null?void 0:s.mqtt)==null?void 0:a.title_ca)??""}}),{c(){Te(e.$$.fragment)},m(r,f){Me(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_ca_upload)??"Upload CA"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_ca)??""),e.$set(c)},i(r){l||(Z(e.$$.fragment,r),l=!0)},o(r){ie(e.$$.fragment,r),l=!1},d(r){Ne(e,r)}}}function Z0(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.ca_ok)??"CA OK")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.mqtt)==null?void 0:f.ca_ok)??"CA OK")+"")&&E(l,e)},d(s){s&&T(l)}}}function J0(t){let e,l;return e=new pl({props:{to:"/mqtt-cert",$$slots:{default:[x0]},$$scope:{ctx:t}}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i[0]&4|i[4]&128&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function $0(t){let e,l,n,i,s,a,r;return l=new pl({props:{to:"/mqtt-cert",$$slots:{default:[ec]},$$scope:{ctx:t}}}),{c(){e=p("span"),Te(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Me(l,e,null),P(f,n,c),P(f,i,c),s=!0,a||(r=[ce(i,"click",t[16]),ce(i,"keypress",t[16])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&128&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){s||(Z(l.$$.fragment,f),s=!0)},o(f){ie(l.$$.fragment,f),s=!1},d(f){f&&(T(e),T(n),T(i)),Ne(l),a=!1,Ut(r)}}}function x0(t){var n,i,s,a;let e,l;return e=new sn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_crt_upload)??"Upload cert",title:((a=(s=t[2].conf)==null?void 0:s.mqtt)==null?void 0:a.title_crt)??""}}),{c(){Te(e.$$.fragment)},m(r,f){Me(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_crt_upload)??"Upload cert"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_crt)??""),e.$set(c)},i(r){l||(Z(e.$$.fragment,r),l=!0)},o(r){ie(e.$$.fragment,r),l=!1},d(r){Ne(e,r)}}}function ec(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.crt_ok)??"Cert OK")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.mqtt)==null?void 0:f.crt_ok)??"Cert OK")+"")&&E(l,e)},d(s){s&&T(l)}}}function tc(t){let e,l;return e=new pl({props:{to:"/mqtt-key",$$slots:{default:[nc]},$$scope:{ctx:t}}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i[0]&4|i[4]&128&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function lc(t){let e,l,n,i,s,a,r;return l=new pl({props:{to:"/mqtt-key",$$slots:{default:[ic]},$$scope:{ctx:t}}}),{c(){e=p("span"),Te(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Me(l,e,null),P(f,n,c),P(f,i,c),s=!0,a||(r=[ce(i,"click",t[17]),ce(i,"keypress",t[17])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&128&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){s||(Z(l.$$.fragment,f),s=!0)},o(f){ie(l.$$.fragment,f),s=!1},d(f){f&&(T(e),T(n),T(i)),Ne(l),a=!1,Ut(r)}}}function nc(t){var n,i,s,a;let e,l;return e=new sn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_key_upload)??"Upload key",title:((a=(s=t[2].conf)==null?void 0:s.mqtt)==null?void 0:a.title_key)??""}}),{c(){Te(e.$$.fragment)},m(r,f){Me(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_key_upload)??"Upload key"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_key)??""),e.$set(c)},i(r){l||(Z(e.$$.fragment,r),l=!0)},o(r){ie(e.$$.fragment,r),l=!1},d(r){Ne(e,r)}}}function ic(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.key_ok)??"Key OK")+"",l;return{c(){l=C(e)},m(s,a){P(s,l,a)},p(s,a){var r,f;a[0]&4&&e!==(e=(((f=(r=s[2].conf)==null?void 0:r.mqtt)==null?void 0:f.key_ok)??"Key OK")+"")&&E(l,e)},d(s){s&&T(l)}}}function xo(t){var Q,ee,ue,ae,x,_e,oe,J,$,he,ke,D;let e,l,n=(((ue=(ee=(Q=t[2].conf)==null?void 0:Q.mqtt)==null?void 0:ee.domoticz)==null?void 0:ue.title)??"Domoticz")+"",i,s,a,r,f,c,m,_,d=(((_e=(x=(ae=t[2].conf)==null?void 0:ae.mqtt)==null?void 0:x.domoticz)==null?void 0:_e.eidx)??"Electricity IDX")+"",h,b,g,k,w,A,F=((($=(J=(oe=t[2].conf)==null?void 0:oe.mqtt)==null?void 0:J.domoticz)==null?void 0:$.cidx)??"Current IDX")+"",L,M,R,I,y,K,W=(((D=(ke=(he=t[2].conf)==null?void 0:he.mqtt)==null?void 0:ke.domoticz)==null?void 0:D.vidx)??"Voltage IDX")+"",N,B,X,G,V,Y,U,z,se,le;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("div"),h=C(d),b=p("br"),g=v(),k=p("input"),w=v(),A=p("div"),L=C(F),M=p("br"),R=v(),I=p("input"),y=v(),K=p("div"),N=C(W),B=C(`: L1, L2 & L3 + `),X=p("div"),G=p("input"),V=v(),Y=p("input"),U=v(),z=p("input"),u(l,"class","text-sm"),u(a,"href",_l("MQTT-configuration#domoticz")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","o"),f.value="true",u(k,"name","oe"),u(k,"type","text"),u(k,"class","in-f tr w-full"),u(_,"class","w-1/2"),u(I,"name","oc"),u(I,"type","text"),u(I,"class","in-l tr w-full"),u(A,"class","w-1/2"),u(m,"class","my-1 flex"),u(G,"name","ou1"),u(G,"type","text"),u(G,"class","in-f tr w-1/3"),u(Y,"name","ou2"),u(Y,"type","text"),u(Y,"class","in-m tr w-1/3"),u(z,"name","ou3"),u(z,"type","text"),u(z,"class","in-l tr w-1/3"),u(X,"class","flex"),u(K,"class","my-1"),u(e,"class","cnt")},m(S,O){P(S,e,O),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,h),o(_,b),o(_,g),o(_,k),H(k,t[6].o.e),o(m,w),o(m,A),o(A,L),o(A,M),o(A,R),o(A,I),H(I,t[6].o.c),o(e,y),o(e,K),o(K,N),o(K,B),o(K,X),o(X,G),H(G,t[6].o.u1),o(X,V),o(X,Y),H(Y,t[6].o.u2),o(X,U),o(X,z),H(z,t[6].o.u3),se||(le=[ce(k,"input",t[77]),ce(I,"input",t[78]),ce(G,"input",t[79]),ce(Y,"input",t[80]),ce(z,"input",t[81])],se=!0)},p(S,O){var q,j,ne,fe,me,pe,de,Se,ge,Le,qe,Oe;O[0]&4&&n!==(n=(((ne=(j=(q=S[2].conf)==null?void 0:q.mqtt)==null?void 0:j.domoticz)==null?void 0:ne.title)??"Domoticz")+"")&&E(i,n),O[0]&4&&d!==(d=(((pe=(me=(fe=S[2].conf)==null?void 0:fe.mqtt)==null?void 0:me.domoticz)==null?void 0:pe.eidx)??"Electricity IDX")+"")&&E(h,d),O[0]&64&&k.value!==S[6].o.e&&H(k,S[6].o.e),O[0]&4&&F!==(F=(((ge=(Se=(de=S[2].conf)==null?void 0:de.mqtt)==null?void 0:Se.domoticz)==null?void 0:ge.cidx)??"Current IDX")+"")&&E(L,F),O[0]&64&&I.value!==S[6].o.c&&H(I,S[6].o.c),O[0]&4&&W!==(W=(((Oe=(qe=(Le=S[2].conf)==null?void 0:Le.mqtt)==null?void 0:qe.domoticz)==null?void 0:Oe.vidx)??"Voltage IDX")+"")&&E(N,W),O[0]&64&&G.value!==S[6].o.u1&&H(G,S[6].o.u1),O[0]&64&&Y.value!==S[6].o.u2&&H(Y,S[6].o.u2),O[0]&64&&z.value!==S[6].o.u3&&H(z,S[6].o.u3)},d(S){S&&T(e),se=!1,Ut(le)}}}function ea(t){var U,z,se,le,Q,ee,ue,ae,x,_e,oe,J;let e,l,n=(((se=(z=(U=t[2].conf)==null?void 0:U.mqtt)==null?void 0:z.ha)==null?void 0:se.title)??"Home-Assistant")+"",i,s,a,r,f,c,m,_=(((ee=(Q=(le=t[2].conf)==null?void 0:le.mqtt)==null?void 0:Q.ha)==null?void 0:ee.discovery)??"Discovery topic prefix")+"",d,h,b,g,k,w,A=(((x=(ae=(ue=t[2].conf)==null?void 0:ue.mqtt)==null?void 0:ae.ha)==null?void 0:x.hostname)??"Hostname for URL")+"",F,L,M,R,I,y,K,W=(((J=(oe=(_e=t[2].conf)==null?void 0:_e.mqtt)==null?void 0:oe.ha)==null?void 0:J.tag)??"Name tag")+"",N,B,X,G,V,Y;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),d=C(_),h=p("br"),b=v(),g=p("input"),k=v(),w=p("div"),F=C(A),L=p("br"),M=v(),R=p("input"),y=v(),K=p("div"),N=C(W),B=p("br"),X=v(),G=p("input"),u(l,"class","text-sm"),u(a,"href",_l("MQTT-configuration#home-assistant")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","h"),f.value="true",u(g,"name","ht"),u(g,"type","text"),u(g,"class","in-s"),u(g,"placeholder","homeassistant"),u(m,"class","my-1"),u(R,"name","hh"),u(R,"type","text"),u(R,"class","in-s"),u(R,"placeholder",I=t[6].g.h+".local"),u(w,"class","my-1"),u(G,"name","hn"),u(G,"type","text"),u(G,"class","in-s"),u(K,"class","my-1"),u(e,"class","cnt")},m($,he){P($,e,he),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,d),o(m,h),o(m,b),o(m,g),H(g,t[6].h.t),o(e,k),o(e,w),o(w,F),o(w,L),o(w,M),o(w,R),H(R,t[6].h.h),o(e,y),o(e,K),o(K,N),o(K,B),o(K,X),o(K,G),H(G,t[6].h.n),V||(Y=[ce(g,"input",t[82]),ce(R,"input",t[83]),ce(G,"input",t[84])],V=!0)},p($,he){var ke,D,S,O,q,j,ne,fe,me,pe,de,Se;he[0]&4&&n!==(n=(((S=(D=(ke=$[2].conf)==null?void 0:ke.mqtt)==null?void 0:D.ha)==null?void 0:S.title)??"Home-Assistant")+"")&&E(i,n),he[0]&4&&_!==(_=(((j=(q=(O=$[2].conf)==null?void 0:O.mqtt)==null?void 0:q.ha)==null?void 0:j.discovery)??"Discovery topic prefix")+"")&&E(d,_),he[0]&64&&g.value!==$[6].h.t&&H(g,$[6].h.t),he[0]&4&&A!==(A=(((me=(fe=(ne=$[2].conf)==null?void 0:ne.mqtt)==null?void 0:fe.ha)==null?void 0:me.hostname)??"Hostname for URL")+"")&&E(F,A),he[0]&64&&I!==(I=$[6].g.h+".local")&&u(R,"placeholder",I),he[0]&64&&R.value!==$[6].h.h&&H(R,$[6].h.h),he[0]&4&&W!==(W=(((Se=(de=(pe=$[2].conf)==null?void 0:pe.mqtt)==null?void 0:de.ha)==null?void 0:Se.tag)??"Name tag")+"")&&E(N,W),he[0]&64&&G.value!==$[6].h.n&&H(G,$[6].h.n)},d($){$&&T(e),V=!1,Ut(Y)}}}function ta(t){var G,V,Y,U,z,se,le,Q;let e,l,n=(((V=(G=t[2].conf)==null?void 0:G.cloud)==null?void 0:V.title)??"Cloud connections")+"",i,s,a,r,f,c,m,_,d,h,b=(((U=(Y=t[2].conf)==null?void 0:Y.cloud)==null?void 0:U.ams)??"AMS reader cloud")+"",g,k,w,A,F,L,M,R=(((se=(z=t[2].conf)==null?void 0:z.cloud)==null?void 0:se.es)??"Energy Speedometer")+"",I,y,K,W,N,B=t[6].c.e&&la(t),X=((Q=(le=t[6])==null?void 0:le.c)==null?void 0:Q.es)&&sa(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("label"),d=p("input"),h=v(),g=C(b),k=v(),B&&B.c(),w=v(),A=p("div"),F=p("label"),L=p("input"),M=v(),I=C(R),y=v(),X&&X.c(),u(l,"class","text-sm"),u(a,"href",_l("Cloud")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","c"),f.value="true",u(d,"type","checkbox"),u(d,"name","ce"),d.__value="true",H(d,d.__value),u(d,"class","rounded mb-1"),u(m,"class","my-1"),u(L,"type","checkbox"),u(L,"class","rounded mb-1"),u(L,"name","ces"),L.__value="true",H(L,L.__value),u(A,"class","my-1"),u(e,"class","cnt")},m(ee,ue){P(ee,e,ue),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,d),d.checked=t[6].c.e,o(_,h),o(_,g),o(m,k),B&&B.m(m,null),o(e,w),o(e,A),o(A,F),o(F,L),L.checked=t[6].c.es,o(F,M),o(F,I),o(A,y),X&&X.m(A,null),K=!0,W||(N=[ce(d,"change",t[85]),ce(L,"change",t[87])],W=!0)},p(ee,ue){var ae,x,_e,oe,J,$,he,ke;(!K||ue[0]&4)&&n!==(n=(((x=(ae=ee[2].conf)==null?void 0:ae.cloud)==null?void 0:x.title)??"Cloud connections")+"")&&E(i,n),ue[0]&64&&(d.checked=ee[6].c.e),(!K||ue[0]&4)&&b!==(b=(((oe=(_e=ee[2].conf)==null?void 0:_e.cloud)==null?void 0:oe.ams)??"AMS reader cloud")+"")&&E(g,b),ee[6].c.e?B?B.p(ee,ue):(B=la(ee),B.c(),B.m(m,null)):B&&(B.d(1),B=null),ue[0]&64&&(L.checked=ee[6].c.es),(!K||ue[0]&4)&&R!==(R=((($=(J=ee[2].conf)==null?void 0:J.cloud)==null?void 0:$.es)??"Energy Speedometer")+"")&&E(I,R),(ke=(he=ee[6])==null?void 0:he.c)!=null&&ke.es?X?(X.p(ee,ue),ue[0]&64&&Z(X,1)):(X=sa(ee),X.c(),Z(X,1),X.m(A,null)):X&&(ht(),ie(X,1,1,()=>{X=null}),vt())},i(ee){K||(Z(X),K=!0)},o(ee){ie(X),K=!1},d(ee){ee&&T(e),B&&B.d(),X&&X.d(),W=!1,Ut(N)}}}function la(t){let e,l,n,i,s,a,r,f,c,m,_=t[6].c.p==0&&na(),d=t[5]&&ia(t);return{c(){e=p("div"),l=p("label"),l.textContent="Protocol",n=v(),i=p("select"),_&&_.c(),s=p("option"),s.textContent="TCP",a=p("option"),a.textContent="HTTP",r=v(),d&&d.c(),f=Jt(),u(l,"for","cp"),s.__value=1,H(s,s.__value),a.__value=2,H(a,a.__value),u(i,"name","cp"),u(i,"class","in-s"),t[6].c.p===void 0&&Bt(()=>t[86].call(i)),u(e,"class","ml-6")},m(h,b){P(h,e,b),o(e,l),o(e,n),o(e,i),_&&_.m(i,null),o(i,s),o(i,a),Qe(i,t[6].c.p,!0),P(h,r,b),d&&d.m(h,b),P(h,f,b),c||(m=ce(i,"change",t[86]),c=!0)},p(h,b){h[6].c.p==0?_||(_=na(),_.c(),_.m(i,s)):_&&(_.d(1),_=null),b[0]&64&&Qe(i,h[6].c.p),h[5]?d?d.p(h,b):(d=ia(h),d.c(),d.m(f.parentNode,f)):d&&(d.d(1),d=null)},d(h){h&&(T(e),T(r),T(f)),_&&_.d(),d&&d.d(h),c=!1,m()}}}function na(t){let e;return{c(){e=p("option"),e.textContent="UDP",e.__value=0,H(e,e.__value),u(e,"title","No longer recommended")},m(l,n){P(l,e,n)},d(l){l&&T(e)}}}function ia(t){let e,l,n;return{c(){e=p("button"),e.textContent="Connect device to my cloud account",u(e,"type","button"),u(e,"class","text-blue-500 ml-6")},m(i,s){P(i,e,s),l||(n=ce(e,"click",t[20]),l=!0)},p:We,d(i){i&&T(e),l=!1,n()}}}function sa(t){let e,l,n=t[0].mac+"",i,s,a,r,f=(t[0].meter.id?t[0].meter.id:"missing, required")+"",c,m,_,d,h=t[0].mac&&t[0].meter.id&&oa(t);return{c(){e=p("div"),l=C("MAC: "),i=C(n),s=v(),a=p("div"),r=C("Meter ID: "),c=C(f),m=v(),h&&h.c(),_=Jt(),u(e,"class","pl-5"),u(a,"class","pl-5")},m(b,g){P(b,e,g),o(e,l),o(e,i),P(b,s,g),P(b,a,g),o(a,r),o(a,c),P(b,m,g),h&&h.m(b,g),P(b,_,g),d=!0},p(b,g){(!d||g[0]&1)&&n!==(n=b[0].mac+"")&&E(i,n),(!d||g[0]&1)&&f!==(f=(b[0].meter.id?b[0].meter.id:"missing, required")+"")&&E(c,f),b[0].mac&&b[0].meter.id?h?(h.p(b,g),g[0]&1&&Z(h,1)):(h=oa(b),h.c(),Z(h,1),h.m(_.parentNode,_)):h&&(ht(),ie(h,1,1,()=>{h=null}),vt())},i(b){d||(Z(h),d=!0)},o(b){ie(h),d=!1},d(b){b&&(T(e),T(s),T(a),T(m),T(_)),h&&h.d(b)}}}function oa(t){let e,l,n;return l=new j0({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=p("div"),Te(l.$$.fragment),u(e,"class","pl-2")},m(i,s){P(i,e,s),Me(l,e,null),n=!0},p(i,s){const a={};s[0]&1&&(a.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(a)},i(i){n||(Z(l.$$.fragment,i),n=!0)},o(i){ie(l.$$.fragment,i),n=!1},d(i){i&&T(e),Ne(l)}}}function aa(t){var W,N,B,X,G;let e,l,n=(((N=(W=t[2].conf)==null?void 0:W.thresholds)==null?void 0:N.title)??"Thresholds")+"",i,s,a,r,f,c,m,_,d,h,b=(((X=(B=t[2].conf)==null?void 0:B.thresholds)==null?void 0:X.avg)??"Average of")+"",g,k,w,A,F,L=(((G=t[2].common)==null?void 0:G.hours)??"hours")+"",M,R,I,y=kt({length:9}),K=[];for(let V=0;Vt[91].call(k)),u(d,"class","w-1/2"),u(m,"class","flex flex-wrap"),u(e,"class","cnt")},m(N,B){P(N,e,B),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m);for(let X=0;X20&&_a(t),d=((A=(w=(k=t[6])==null?void 0:k.i)==null?void 0:w.d)==null?void 0:A.d)>0&&ha(t),h=t[0].chip=="esp8266"&&va(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),_&&_.c(),f=v(),d&&d.c(),c=v(),h&&h.c(),u(l,"class","text-sm"),u(a,"href",_l("GPIO-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(e,"class","cnt")},m(F,L){P(F,e,L),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),_&&_.m(e,null),o(e,f),d&&d.m(e,null),o(e,c),h&&h.m(e,null),m=!0},p(F,L){var M,R,I,y,K;(!m||L[0]&4)&&n!==(n=(((R=(M=F[2].conf)==null?void 0:M.hw)==null?void 0:R.title)??"Hardware")+"")&&E(i,n),F[0].board>20?_?(_.p(F,L),L[0]&1&&Z(_,1)):(_=_a(F),_.c(),Z(_,1),_.m(e,f)):_&&(ht(),ie(_,1,1,()=>{_=null}),vt()),((K=(y=(I=F[6])==null?void 0:I.i)==null?void 0:y.d)==null?void 0:K.d)>0?d?d.p(F,L):(d=ha(F),d.c(),d.m(e,c)):d&&(d.d(1),d=null),F[0].chip=="esp8266"?h?h.p(F,L):(h=va(F),h.c(),h.m(e,null)):h&&(h.d(1),h=null)},i(F){m||(Z(_),m=!0)},o(F){ie(_),m=!1},d(F){F&&T(e),_&&_.d(),d&&d.d(),h&&h.d()}}}function _a(t){var Lt,Vt,Mt,xe,Kt,It,ot,Yt,$t,jt,Pt,ll,Ue,ct,ut,Rt,Ht,dt,yt,At,_t,be,nt,ze,il,Je,wt,Xt,xt,nl,Wt,sl,Ie;let e,l,n,i,s=(((Mt=(Vt=(Lt=t[2].conf)==null?void 0:Lt.hw)==null?void 0:Vt.han)==null?void 0:Mt.rx)??"HAN RX")+"",a,r,f,c,m,_,d,h=(((It=(Kt=(xe=t[2].conf)==null?void 0:xe.hw)==null?void 0:Kt.han)==null?void 0:It.tx)??"HAN TX")+"",b,g,k,w,A,F,L,M,R,I,y=((($t=(Yt=(ot=t[2].conf)==null?void 0:ot.hw)==null?void 0:Yt.han)==null?void 0:$t.pullup)??"pullup")+"",K,W,N,B,X=(((Pt=(jt=t[2].conf)==null?void 0:jt.hw)==null?void 0:Pt.ap_btn)??"AP button")+"",G,V,Y,U,z,se,le=(((ct=(Ue=(ll=t[2].conf)==null?void 0:ll.hw)==null?void 0:Ue.led)==null?void 0:ct.title)??"LED")+"",Q,ee,ue,ae,x,_e,oe,J,$,he,ke=(((Ht=(Rt=(ut=t[2].conf)==null?void 0:ut.hw)==null?void 0:Rt.led)==null?void 0:Ht.inverted)??"inverted")+"",D,S,O,q=(((At=(yt=(dt=t[2].conf)==null?void 0:dt.hw)==null?void 0:yt.led)==null?void 0:At.rgb)??"RGB")+"",j,ne,fe,me,pe=(((nt=(be=(_t=t[2].conf)==null?void 0:_t.hw)==null?void 0:be.led)==null?void 0:nt.inverted)??"inverted")+"",de,Se,ge,Le,qe,Oe,re,Ce,Be,Ze,bt,Xe,et=(((Je=(il=(ze=t[2].conf)==null?void 0:ze.hw)==null?void 0:il.led)==null?void 0:Je.disable)??"LED dis. GPIO")+"",pt,st,tt,gt,it,Dt=(((Xt=(wt=t[2].conf)==null?void 0:wt.hw)==null?void 0:Xt.temp)??"Temperature")+"",Ae,Pe,Fe,Ye,ve,Ee,ye=(((nl=(xt=t[2].conf)==null?void 0:xt.hw)==null?void 0:nl.temp_analog)??"Analog temp")+"",we,De,lt,Ve,zt,at,je,St,mt;m=new Si({props:{chip:t[0].chip}}),A=new Si({props:{chip:t[0].chip}});let ft=t[0].chip!="esp8266"&&pa(t),rt=((Ie=(sl=(Wt=t[6])==null?void 0:Wt.i)==null?void 0:sl.v)==null?void 0:Ie.p)>0&&da(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=C(s),r=p("br"),f=v(),c=p("select"),Te(m.$$.fragment),_=v(),d=p("div"),b=C(h),g=p("br"),k=v(),w=p("select"),Te(A.$$.fragment),F=v(),L=p("div"),M=p("label"),R=p("input"),I=v(),K=C(y),W=v(),N=p("div"),B=p("div"),G=C(X),V=p("br"),Y=v(),U=p("input"),z=v(),se=p("div"),Q=C(le),ee=p("br"),ue=v(),ae=p("div"),x=p("input"),_e=v(),oe=p("div"),J=p("label"),$=p("input"),he=v(),D=C(ke),S=v(),O=p("div"),j=C(q),ne=p("label"),fe=p("input"),me=v(),de=C(pe),Se=p("br"),ge=v(),Le=p("div"),qe=p("input"),Oe=v(),re=p("input"),Ce=v(),Be=p("input"),Ze=v(),bt=p("div"),Xe=p("div"),pt=C(et),st=v(),tt=p("input"),gt=v(),it=p("div"),Ae=C(Dt),Pe=p("br"),Fe=v(),Ye=p("input"),ve=v(),Ee=p("div"),we=C(ye),De=p("br"),lt=v(),Ve=p("input"),zt=v(),ft&&ft.c(),at=v(),rt&&rt.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(c,"name","ihp"),u(c,"class","in-f w-full"),t[6].i.h.p===void 0&&Bt(()=>t[92].call(c)),u(i,"class","w-1/3"),u(w,"name","iht"),u(w,"class","in-l w-full"),t[6].i.h.t===void 0&&Bt(()=>t[93].call(w)),u(d,"class","w-1/3"),u(R,"name","ihu"),R.__value="true",H(R,R.__value),u(R,"type","checkbox"),u(R,"class","rounded mb-1"),u(M,"class","ml-2"),u(L,"class","w-1/3"),u(n,"class","flex flex-wrap"),u(U,"name","ia"),u(U,"type","number"),u(U,"min","0"),u(U,"max",t[10]),u(U,"class","in-f tr w-full"),u(B,"class","w-1/3"),u(x,"name","ilp"),u(x,"type","number"),u(x,"min","0"),u(x,"max",t[10]),u(x,"class","in-l tr w-full"),u(ae,"class","flex"),u(se,"class","w-1/3"),u($,"name","ili"),$.__value="true",H($,$.__value),u($,"type","checkbox"),u($,"class","rounded mb-1"),u(J,"class","ml-4"),u(oe,"class","w-1/3"),u(fe,"name","iri"),fe.__value="true",H(fe,fe.__value),u(fe,"type","checkbox"),u(fe,"class","rounded mb-1"),u(ne,"class","ml-4"),u(qe,"name","irr"),u(qe,"type","number"),u(qe,"min","0"),u(qe,"max",t[10]),u(qe,"class","in-f tr w-1/3"),u(re,"name","irg"),u(re,"type","number"),u(re,"min","0"),u(re,"max",t[10]),u(re,"class","in-m tr w-1/3"),u(Be,"name","irb"),u(Be,"type","number"),u(Be,"min","0"),u(Be,"max",t[10]),u(Be,"class","in-l tr w-1/3"),u(Le,"class","flex"),u(O,"class","w-full"),u(tt,"name","idd"),u(tt,"type","number"),u(tt,"min","0"),u(tt,"max",t[10]),u(tt,"class","in-s tr"),u(Xe,"class","my-1 pr-1 w-1/3"),u(bt,"class","w-full"),u(Ye,"name","itd"),u(Ye,"type","number"),u(Ye,"min","0"),u(Ye,"max",t[10]),u(Ye,"class","in-f tr w-full"),u(it,"class","my-1 w-1/3"),u(Ve,"name","ita"),u(Ve,"type","number"),u(Ve,"min","0"),u(Ve,"max",t[10]),u(Ve,"class","in-l tr w-full"),u(Ee,"class","my-1 pr-1 w-1/3"),u(N,"class","flex flex-wrap")},m(te,Re){P(te,e,Re),P(te,l,Re),P(te,n,Re),o(n,i),o(i,a),o(i,r),o(i,f),o(i,c),Me(m,c,null),Qe(c,t[6].i.h.p,!0),o(n,_),o(n,d),o(d,b),o(d,g),o(d,k),o(d,w),Me(A,w,null),Qe(w,t[6].i.h.t,!0),o(n,F),o(n,L),o(L,M),o(M,R),R.checked=t[6].i.h.u,o(M,I),o(M,K),P(te,W,Re),P(te,N,Re),o(N,B),o(B,G),o(B,V),o(B,Y),o(B,U),H(U,t[6].i.a),o(N,z),o(N,se),o(se,Q),o(se,ee),o(se,ue),o(se,ae),o(ae,x),H(x,t[6].i.l.p),o(N,_e),o(N,oe),o(oe,J),o(J,$),$.checked=t[6].i.l.i,o(J,he),o(J,D),o(N,S),o(N,O),o(O,j),o(O,ne),o(ne,fe),fe.checked=t[6].i.r.i,o(ne,me),o(ne,de),o(O,Se),o(O,ge),o(O,Le),o(Le,qe),H(qe,t[6].i.r.r),o(Le,Oe),o(Le,re),H(re,t[6].i.r.g),o(Le,Ce),o(Le,Be),H(Be,t[6].i.r.b),o(N,Ze),o(N,bt),o(bt,Xe),o(Xe,pt),o(Xe,st),o(Xe,tt),H(tt,t[6].i.d.d),o(N,gt),o(N,it),o(it,Ae),o(it,Pe),o(it,Fe),o(it,Ye),H(Ye,t[6].i.t.d),o(N,ve),o(N,Ee),o(Ee,we),o(Ee,De),o(Ee,lt),o(Ee,Ve),H(Ve,t[6].i.t.a),o(N,zt),ft&&ft.m(N,null),o(N,at),rt&&rt.m(N,null),je=!0,St||(mt=[ce(c,"change",t[92]),ce(w,"change",t[93]),ce(R,"change",t[94]),ce(U,"input",t[95]),ce(x,"input",t[96]),ce($,"change",t[97]),ce(fe,"change",t[98]),ce(qe,"input",t[99]),ce(re,"input",t[100]),ce(Be,"input",t[101]),ce(tt,"input",t[102]),ce(Ye,"input",t[103]),ce(Ve,"input",t[104])],St=!0)},p(te,Re){var Ke,Ct,gl,kl,wl,Cl,Sl,Ll,Il,Ol,Rl,$e,Ft,al,Fl,Bl,Ul,jl,Hl,yl,zl,Wl,Gl,Vl,Kl,Yl,Ql,Xl,Zl,Jl,gn,kn,wn;(!je||Re[0]&4)&&s!==(s=(((gl=(Ct=(Ke=te[2].conf)==null?void 0:Ke.hw)==null?void 0:Ct.han)==null?void 0:gl.rx)??"HAN RX")+"")&&E(a,s);const cl={};Re[0]&1&&(cl.chip=te[0].chip),m.$set(cl),Re[0]&64&&Qe(c,te[6].i.h.p),(!je||Re[0]&4)&&h!==(h=(((Cl=(wl=(kl=te[2].conf)==null?void 0:kl.hw)==null?void 0:wl.han)==null?void 0:Cl.tx)??"HAN TX")+"")&&E(b,h);const ml={};Re[0]&1&&(ml.chip=te[0].chip),A.$set(ml),Re[0]&64&&Qe(w,te[6].i.h.t),Re[0]&64&&(R.checked=te[6].i.h.u),(!je||Re[0]&4)&&y!==(y=(((Il=(Ll=(Sl=te[2].conf)==null?void 0:Sl.hw)==null?void 0:Ll.han)==null?void 0:Il.pullup)??"pullup")+"")&&E(K,y),(!je||Re[0]&4)&&X!==(X=(((Rl=(Ol=te[2].conf)==null?void 0:Ol.hw)==null?void 0:Rl.ap_btn)??"AP button")+"")&&E(G,X),(!je||Re[0]&1024)&&u(U,"max",te[10]),Re[0]&64&&He(U.value)!==te[6].i.a&&H(U,te[6].i.a),(!je||Re[0]&4)&&le!==(le=(((al=(Ft=($e=te[2].conf)==null?void 0:$e.hw)==null?void 0:Ft.led)==null?void 0:al.title)??"LED")+"")&&E(Q,le),(!je||Re[0]&1024)&&u(x,"max",te[10]),Re[0]&64&&He(x.value)!==te[6].i.l.p&&H(x,te[6].i.l.p),Re[0]&64&&($.checked=te[6].i.l.i),(!je||Re[0]&4)&&ke!==(ke=(((Ul=(Bl=(Fl=te[2].conf)==null?void 0:Fl.hw)==null?void 0:Bl.led)==null?void 0:Ul.inverted)??"inverted")+"")&&E(D,ke),(!je||Re[0]&4)&&q!==(q=(((yl=(Hl=(jl=te[2].conf)==null?void 0:jl.hw)==null?void 0:Hl.led)==null?void 0:yl.rgb)??"RGB")+"")&&E(j,q),Re[0]&64&&(fe.checked=te[6].i.r.i),(!je||Re[0]&4)&&pe!==(pe=(((Gl=(Wl=(zl=te[2].conf)==null?void 0:zl.hw)==null?void 0:Wl.led)==null?void 0:Gl.inverted)??"inverted")+"")&&E(de,pe),(!je||Re[0]&1024)&&u(qe,"max",te[10]),Re[0]&64&&He(qe.value)!==te[6].i.r.r&&H(qe,te[6].i.r.r),(!je||Re[0]&1024)&&u(re,"max",te[10]),Re[0]&64&&He(re.value)!==te[6].i.r.g&&H(re,te[6].i.r.g),(!je||Re[0]&1024)&&u(Be,"max",te[10]),Re[0]&64&&He(Be.value)!==te[6].i.r.b&&H(Be,te[6].i.r.b),(!je||Re[0]&4)&&et!==(et=(((Yl=(Kl=(Vl=te[2].conf)==null?void 0:Vl.hw)==null?void 0:Kl.led)==null?void 0:Yl.disable)??"LED dis. GPIO")+"")&&E(pt,et),(!je||Re[0]&1024)&&u(tt,"max",te[10]),Re[0]&64&&He(tt.value)!==te[6].i.d.d&&H(tt,te[6].i.d.d),(!je||Re[0]&4)&&Dt!==(Dt=(((Xl=(Ql=te[2].conf)==null?void 0:Ql.hw)==null?void 0:Xl.temp)??"Temperature")+"")&&E(Ae,Dt),(!je||Re[0]&1024)&&u(Ye,"max",te[10]),Re[0]&64&&He(Ye.value)!==te[6].i.t.d&&H(Ye,te[6].i.t.d),(!je||Re[0]&4)&&ye!==(ye=(((Jl=(Zl=te[2].conf)==null?void 0:Zl.hw)==null?void 0:Jl.temp_analog)??"Analog temp")+"")&&E(we,ye),(!je||Re[0]&1024)&&u(Ve,"max",te[10]),Re[0]&64&&He(Ve.value)!==te[6].i.t.a&&H(Ve,te[6].i.t.a),te[0].chip!="esp8266"?ft?ft.p(te,Re):(ft=pa(te),ft.c(),ft.m(N,at)):ft&&(ft.d(1),ft=null),((wn=(kn=(gn=te[6])==null?void 0:gn.i)==null?void 0:kn.v)==null?void 0:wn.p)>0?rt?rt.p(te,Re):(rt=da(te),rt.c(),rt.m(N,null)):rt&&(rt.d(1),rt=null)},i(te){je||(Z(m.$$.fragment,te),Z(A.$$.fragment,te),je=!0)},o(te){ie(m.$$.fragment,te),ie(A.$$.fragment,te),je=!1},d(te){te&&(T(e),T(l),T(n),T(W),T(N)),Ne(m),Ne(A),ft&&ft.d(),rt&&rt.d(),St=!1,Ut(mt)}}}function pa(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.title)??"Vcc")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","ivp"),u(a,"type","number"),u(a,"min","0"),u(a,"max",t[10]),u(a,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(d,h){P(d,e,h),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].i.v.p),r||(f=ce(a,"input",t[105]),r=!0)},p(d,h){var b,g,k;h[0]&4&&l!==(l=(((k=(g=(b=d[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:k.title)??"Vcc")+"")&&E(n,l),h[0]&1024&&u(a,"max",d[10]),h[0]&64&&He(a.value)!==d[6].i.v.p&&H(a,d[6].i.v.p)},d(d){d&&T(e),r=!1,f()}}}function da(t){var b,g,k;let e,l=(((k=(g=(b=t[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:k.divider)??"Voltage divider")+"",n,i,s,a,r,f,c,m,_,d,h;return{c(){var w,A,F,L,M,R;e=p("div"),n=C(l),i=p("br"),s=v(),a=p("div"),r=p("input"),c=v(),m=p("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"placeholder",f=((F=(A=(w=t[2].conf)==null?void 0:w.hw)==null?void 0:A.vcc)==null?void 0:F.div_vcc)??"VCC"),u(m,"name","ivdg"),u(m,"type","number"),u(m,"min","0"),u(m,"max","65535"),u(m,"class","in-l tr w-full"),u(m,"placeholder",_=((R=(M=(L=t[2].conf)==null?void 0:L.hw)==null?void 0:M.vcc)==null?void 0:R.div_gnd)??"GND"),u(a,"class","flex"),u(e,"class","my-1")},m(w,A){P(w,e,A),o(e,n),o(e,i),o(e,s),o(e,a),o(a,r),H(r,t[6].i.v.d.v),o(a,c),o(a,m),H(m,t[6].i.v.d.g),d||(h=[ce(r,"input",t[106]),ce(m,"input",t[107])],d=!0)},p(w,A){var F,L,M,R,I,y,K,W,N;A[0]&4&&l!==(l=(((M=(L=(F=w[2].conf)==null?void 0:F.hw)==null?void 0:L.vcc)==null?void 0:M.divider)??"Voltage divider")+"")&&E(n,l),A[0]&4&&f!==(f=((y=(I=(R=w[2].conf)==null?void 0:R.hw)==null?void 0:I.vcc)==null?void 0:y.div_vcc)??"VCC")&&u(r,"placeholder",f),A[0]&64&&He(r.value)!==w[6].i.v.d.v&&H(r,w[6].i.v.d.v),A[0]&4&&_!==(_=((N=(W=(K=w[2].conf)==null?void 0:K.hw)==null?void 0:W.vcc)==null?void 0:N.div_gnd)??"GND")&&u(m,"placeholder",_),A[0]&64&&He(m.value)!==w[6].i.v.d.g&&H(m,w[6].i.v.d.g)},d(w){w&&T(e),d=!1,Ut(h)}}}function ha(t){var b,g,k,w,A,F,L,M,R,I,y,K;let e,l=(((w=(k=(g=(b=t[2].conf)==null?void 0:b.hw)==null?void 0:g.led)==null?void 0:k.behaviour)==null?void 0:w.title)??"LED behaviour")+"",n,i,s,a,r=(((M=(L=(F=(A=t[2].conf)==null?void 0:A.hw)==null?void 0:F.led)==null?void 0:L.behaviour)==null?void 0:M.enabled)??"Enabled")+"",f,c,m=(((K=(y=(I=(R=t[2].conf)==null?void 0:R.hw)==null?void 0:I.led)==null?void 0:y.behaviour)==null?void 0:K.disabled)??"Disabled")+"",_,d,h;return{c(){e=p("div"),n=C(l),i=v(),s=p("select"),a=p("option"),f=C(r),c=p("option"),_=C(m),a.__value=0,H(a,a.__value),c.__value=1,H(c,c.__value),u(s,"name","idb"),u(s,"class","in-s"),t[6].i.d.b===void 0&&Bt(()=>t[108].call(s)),u(e,"class","my-1 w-full")},m(W,N){P(W,e,N),o(e,n),o(e,i),o(e,s),o(s,a),o(a,f),o(s,c),o(c,_),Qe(s,t[6].i.d.b,!0),d||(h=ce(s,"change",t[108]),d=!0)},p(W,N){var B,X,G,V,Y,U,z,se,le,Q,ee,ue;N[0]&4&&l!==(l=(((V=(G=(X=(B=W[2].conf)==null?void 0:B.hw)==null?void 0:X.led)==null?void 0:G.behaviour)==null?void 0:V.title)??"LED behaviour")+"")&&E(n,l),N[0]&4&&r!==(r=(((se=(z=(U=(Y=W[2].conf)==null?void 0:Y.hw)==null?void 0:U.led)==null?void 0:z.behaviour)==null?void 0:se.enabled)??"Enabled")+"")&&E(f,r),N[0]&4&&m!==(m=(((ue=(ee=(Q=(le=W[2].conf)==null?void 0:le.hw)==null?void 0:Q.led)==null?void 0:ee.behaviour)==null?void 0:ue.disabled)??"Disabled")+"")&&E(_,m),N[0]&64&&Qe(s,W[6].i.d.b)},d(W){W&&T(e),d=!1,h()}}}function va(t){var M,R,I,y,K,W;let e,l,n,i,s=(((I=(R=(M=t[2].conf)==null?void 0:M.hw)==null?void 0:R.vcc)==null?void 0:I.offset)??"Vcc offset")+"",a,r,f,c,m,_,d=(((W=(K=(y=t[2].conf)==null?void 0:y.hw)==null?void 0:K.vcc)==null?void 0:W.multiplier)??"Multiplier")+"",h,b,g,k,w,A,F,L=(t[0].board==2||t[0].board==100)&&ba(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=C(s),r=p("br"),f=v(),c=p("input"),m=v(),_=p("div"),h=C(d),b=p("br"),g=v(),k=p("input"),w=v(),L&&L.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(c,"name","ivo"),u(c,"type","number"),u(c,"min","0.0"),u(c,"max","3.5"),u(c,"step","0.01"),u(c,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(k,"name","ivm"),u(k,"type","number"),u(k,"min","0.1"),u(k,"max","10"),u(k,"step","0.01"),u(k,"class","in-l tr w-full"),u(_,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(N,B){P(N,e,B),P(N,l,B),P(N,n,B),o(n,i),o(i,a),o(i,r),o(i,f),o(i,c),H(c,t[6].i.v.o),o(n,m),o(n,_),o(_,h),o(_,b),o(_,g),o(_,k),H(k,t[6].i.v.m),o(n,w),L&&L.m(n,null),A||(F=[ce(c,"input",t[109]),ce(k,"input",t[110])],A=!0)},p(N,B){var X,G,V,Y,U,z;B[0]&4&&s!==(s=(((V=(G=(X=N[2].conf)==null?void 0:X.hw)==null?void 0:G.vcc)==null?void 0:V.offset)??"Vcc offset")+"")&&E(a,s),B[0]&64&&He(c.value)!==N[6].i.v.o&&H(c,N[6].i.v.o),B[0]&4&&d!==(d=(((z=(U=(Y=N[2].conf)==null?void 0:Y.hw)==null?void 0:U.vcc)==null?void 0:z.multiplier)??"Multiplier")+"")&&E(h,d),B[0]&64&&He(k.value)!==N[6].i.v.m&&H(k,N[6].i.v.m),N[0].board==2||N[0].board==100?L?L.p(N,B):(L=ba(N),L.c(),L.m(n,null)):L&&(L.d(1),L=null)},d(N){N&&(T(e),T(l),T(n)),L&&L.d(),A=!1,Ut(F)}}}function ba(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.boot)??"Boot limit")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","ivb"),u(a,"type","number"),u(a,"min","2.5"),u(a,"max","3.5"),u(a,"step","0.1"),u(a,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(d,h){P(d,e,h),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].i.v.b),r||(f=ce(a,"input",t[111]),r=!0)},p(d,h){var b,g,k;h[0]&4&&l!==(l=(((k=(g=(b=d[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:k.boot)??"Boot limit")+"")&&E(n,l),h[0]&64&&He(a.value)!==d[6].i.v.b&&H(a,d[6].i.v.b)},d(d){d&&T(e),r=!1,f()}}}function ga(t){var L,M,R,I,y,K;let e,l,n=(((M=(L=t[2].conf)==null?void 0:L.debug)==null?void 0:M.title)??"Debugging")+"",i,s,a,r,f,c,m,_,d,h,b=(((I=(R=t[2].conf)==null?void 0:R.debug)==null?void 0:I.enable)??"Enable debugging")+"",g,k,w,A,F=((K=(y=t[6])==null?void 0:y.d)==null?void 0:K.s)&&ka(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("label"),d=p("input"),h=v(),g=C(b),k=v(),F&&F.c(),u(l,"class","text-sm"),u(a,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","d"),f.value="true",u(d,"type","checkbox"),u(d,"name","ds"),d.__value="true",H(d,d.__value),u(d,"class","rounded mb-1"),u(m,"class","mt-3"),u(e,"class","cnt")},m(W,N){P(W,e,N),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,d),d.checked=t[6].d.s,o(_,h),o(_,g),o(e,k),F&&F.m(e,null),w||(A=ce(d,"change",t[112]),w=!0)},p(W,N){var B,X,G,V,Y,U;N[0]&4&&n!==(n=(((X=(B=W[2].conf)==null?void 0:B.debug)==null?void 0:X.title)??"Debugging")+"")&&E(i,n),N[0]&64&&(d.checked=W[6].d.s),N[0]&4&&b!==(b=(((V=(G=W[2].conf)==null?void 0:G.debug)==null?void 0:V.enable)??"Enable debugging")+"")&&E(g,b),(U=(Y=W[6])==null?void 0:Y.d)!=null&&U.s?F?F.p(W,N):(F=ka(W),F.c(),F.m(e,null)):F&&(F.d(1),F=null)},d(W){W&&T(e),F&&F.d(),w=!1,A()}}}function ka(t){var R,I,y,K;let e,l=(((I=(R=t[2].conf)==null?void 0:R.debug)==null?void 0:I.danger)??"Disable when done")+"",n,i,s,a,r,f,c=(((K=(y=t[2].conf)==null?void 0:y.debug)==null?void 0:K.telnet)??"Enable telnet")+"",m,_,d,h,b,g,k,w,A,F,L,M=t[6].d.t&&wa(t);return{c(){e=p("div"),n=C(l),i=v(),s=p("div"),a=p("label"),r=p("input"),f=v(),m=C(c),_=v(),M&&M.c(),d=v(),h=p("div"),b=p("select"),g=p("option"),g.textContent="Verbose",k=p("option"),k.textContent="Debug",w=p("option"),w.textContent="Info",A=p("option"),A.textContent="Warning",u(e,"class","bd-red"),u(r,"type","checkbox"),u(r,"name","dt"),r.__value="true",H(r,r.__value),u(r,"class","rounded mb-1"),u(s,"class","my-1"),g.__value=1,H(g,g.__value),k.__value=2,H(k,k.__value),w.__value=3,H(w,w.__value),A.__value=4,H(A,A.__value),u(b,"name","dl"),u(b,"class","in-s"),t[6].d.l===void 0&&Bt(()=>t[114].call(b)),u(h,"class","my-1")},m(W,N){P(W,e,N),o(e,n),P(W,i,N),P(W,s,N),o(s,a),o(a,r),r.checked=t[6].d.t,o(a,f),o(a,m),P(W,_,N),M&&M.m(W,N),P(W,d,N),P(W,h,N),o(h,b),o(b,g),o(b,k),o(b,w),o(b,A),Qe(b,t[6].d.l,!0),F||(L=[ce(r,"change",t[113]),ce(b,"change",t[114])],F=!0)},p(W,N){var B,X,G,V;N[0]&4&&l!==(l=(((X=(B=W[2].conf)==null?void 0:B.debug)==null?void 0:X.danger)??"Disable when done")+"")&&E(n,l),N[0]&64&&(r.checked=W[6].d.t),N[0]&4&&c!==(c=(((V=(G=W[2].conf)==null?void 0:G.debug)==null?void 0:V.telnet)??"Enable telnet")+"")&&E(m,c),W[6].d.t?M?M.p(W,N):(M=wa(W),M.c(),M.m(d.parentNode,d)):M&&(M.d(1),M=null),N[0]&64&&Qe(b,W[6].d.l)},d(W){W&&(T(e),T(i),T(s),T(_),T(d),T(h)),M&&M.d(W),F=!1,Ut(L)}}}function wa(t){var i,s;let e,l=(((s=(i=t[2].conf)==null?void 0:i.debug)==null?void 0:s.telnet_danger)??"Disable when done")+"",n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.debug)==null?void 0:c.telnet_danger)??"Disable when done")+"")&&E(n,l)},d(a){a&&T(e)}}}function Ca(t){var d,h;let e,l,n=(((d=t[2].conf)==null?void 0:d.btn_reset)??"Factory reset")+"",i,s,a,r,f=(((h=t[2].btn)==null?void 0:h.reboot)??"Reboot")+"",c,m,_;return{c(){e=p("div"),l=p("button"),i=C(n),s=v(),a=p("div"),r=p("button"),c=C(f),u(l,"type","button"),u(l,"class","btn-red"),u(r,"type","button"),u(r,"class","btn-yellow"),u(a,"class","text-center")},m(b,g){P(b,e,g),o(e,l),o(l,i),P(b,s,g),P(b,a,g),o(a,r),o(r,c),m||(_=[ce(l,"click",t[12]),ce(r,"click",t[14])],m=!0)},p(b,g){var k,w;g[0]&4&&n!==(n=(((k=b[2].conf)==null?void 0:k.btn_reset)??"Factory reset")+"")&&E(i,n),g[0]&4&&f!==(f=(((w=b[2].btn)==null?void 0:w.reboot)??"Reboot")+"")&&E(c,f)},d(b){b&&(T(e),T(s),T(a)),m=!1,Ut(_)}}}function Sa(t){var s;let e,l,n=(((s=t[2].btn)==null?void 0:s.save)??"Save")+"",i;return{c(){e=p("div"),l=p("button"),i=C(n),u(l,"type","submit"),u(l,"class","btn-pri"),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,l),o(l,i)},p(a,r){var f;r[0]&4&&n!==(n=(((f=a[2].btn)==null?void 0:f.save)??"Save")+"")&&E(i,n)},d(a){a&&T(e)}}}function sc(t){var J,$,he,ke,D,S,O,q,j,ne,fe,me,pe,de,Se,ge,Le,qe,Oe,re,Ce,Be,Ze,bt,Xe,et,pt,st,tt,gt,it,Dt,Ae,Pe,Fe,Ye,ve,Ee,ye;let e,l,n,i,s,a,r,f,c,m,_=((he=($=(J=t[6])==null?void 0:J.p)==null?void 0:$.r)==null?void 0:he.startsWith("NO"))||((S=(D=(ke=t[6])==null?void 0:ke.p)==null?void 0:D.r)==null?void 0:S.startsWith("10YNO"))||((j=(q=(O=t[6])==null?void 0:O.p)==null?void 0:q.r)==null?void 0:j.startsWith("10Y1001A1001A4")),d,h,b,g=((ne=t[6])==null?void 0:ne.d)&&((me=(fe=t[0])==null?void 0:fe.features)==null?void 0:me.includes("rdebug")),k,w,A,F,L,M,R,I,y,K,W,N,B,X,G=((pe=t[6])==null?void 0:pe.g)&&Fo(t),V=((de=t[6])==null?void 0:de.m)&&Ho(t),Y=((Se=t[6])==null?void 0:Se.w)&&Vo(t),U=((ge=t[6])==null?void 0:ge.n)&&Qo(t),z=((Le=t[6])==null?void 0:Le.q)&&Zo(t),se=((Oe=(qe=t[6])==null?void 0:qe.q)==null?void 0:Oe.m)==3&&xo(t),le=((Ce=(re=t[6])==null?void 0:re.q)==null?void 0:Ce.m)==4&&ea(t),Q=((Be=t[6])==null?void 0:Be.c)&&ta(t),ee=_&&aa(t),ue=((Ze=t[6])==null?void 0:Ze.u)&&ua(t),ae=((Xe=(bt=t[6])==null?void 0:bt.i)==null?void 0:Xe.h)&&(((et=t[0])==null?void 0:et.board)>20||((pt=t[0])==null?void 0:pt.chip)=="esp8266"||((gt=(tt=(st=t[6])==null?void 0:st.i)==null?void 0:tt.d)==null?void 0:gt.d)>0)&&ma(t),x=g&&ga(t),_e=((it=t[1])==null?void 0:it.a)&&Ca(t),oe=t[6]&&Sa(t);return L=new fl({props:{active:t[3],message:((Ae=(Dt=t[2].conf)==null?void 0:Dt.mask)==null?void 0:Ae.loading)??"Loading"}}),R=new fl({props:{active:t[4],message:((Fe=(Pe=t[2].conf)==null?void 0:Pe.mask)==null?void 0:Fe.saving)??"Saving"}}),y=new fl({props:{active:t[8],message:((ve=(Ye=t[2].conf)==null?void 0:Ye.mask)==null?void 0:ve.reset)??"Factory reset"}}),W=new fl({props:{active:t[9],message:((ye=(Ee=t[2].conf)==null?void 0:Ee.mask)==null?void 0:ye.reset_done)??"Done"}}),{c(){e=p("form"),l=p("div"),G&&G.c(),n=v(),V&&V.c(),i=v(),Y&&Y.c(),s=v(),U&&U.c(),a=v(),z&&z.c(),r=v(),se&&se.c(),f=v(),le&&le.c(),c=v(),Q&&Q.c(),m=v(),ee&&ee.c(),d=v(),ue&&ue.c(),h=v(),ae&&ae.c(),b=v(),x&&x.c(),k=v(),w=p("div"),_e&&_e.c(),A=v(),oe&&oe.c(),F=v(),Te(L.$$.fragment),M=v(),Te(R.$$.fragment),I=v(),Te(y.$$.fragment),K=v(),Te(W.$$.fragment),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(w,"class","grid grid-cols-3 mt-3"),u(e,"autocomplete","off")},m(we,De){P(we,e,De),o(e,l),G&&G.m(l,null),o(l,n),V&&V.m(l,null),o(l,i),Y&&Y.m(l,null),o(l,s),U&&U.m(l,null),o(l,a),z&&z.m(l,null),o(l,r),se&&se.m(l,null),o(l,f),le&&le.m(l,null),o(l,c),Q&&Q.m(l,null),o(l,m),ee&&ee.m(l,null),o(l,d),ue&&ue.m(l,null),o(l,h),ae&&ae.m(l,null),o(l,b),x&&x.m(l,null),o(e,k),o(e,w),_e&&_e.m(w,null),o(w,A),oe&&oe.m(w,null),P(we,F,De),Me(L,we,De),P(we,M,De),Me(R,we,De),P(we,I,De),Me(y,we,De),P(we,K,De),Me(W,we,De),N=!0,B||(X=ce(e,"submit",un(t[13])),B=!0)},p(we,De){var je,St,mt,ft,rt,Lt,Vt,Mt,xe,Kt,It,ot,Yt,$t,jt,Pt,ll,Ue,ct,ut,Rt,Ht,dt,yt,At,_t,be,nt,ze,il,Je,wt,Xt,xt,nl,Wt,sl,Ie,te;(je=we[6])!=null&&je.g?G?(G.p(we,De),De[0]&64&&Z(G,1)):(G=Fo(we),G.c(),Z(G,1),G.m(l,n)):G&&(ht(),ie(G,1,1,()=>{G=null}),vt()),(St=we[6])!=null&&St.m?V?V.p(we,De):(V=Ho(we),V.c(),V.m(l,i)):V&&(V.d(1),V=null),(mt=we[6])!=null&&mt.w?Y?Y.p(we,De):(Y=Vo(we),Y.c(),Y.m(l,s)):Y&&(Y.d(1),Y=null),(ft=we[6])!=null&&ft.n?U?(U.p(we,De),De[0]&64&&Z(U,1)):(U=Qo(we),U.c(),Z(U,1),U.m(l,a)):U&&(ht(),ie(U,1,1,()=>{U=null}),vt()),(rt=we[6])!=null&&rt.q?z?(z.p(we,De),De[0]&64&&Z(z,1)):(z=Zo(we),z.c(),Z(z,1),z.m(l,r)):z&&(ht(),ie(z,1,1,()=>{z=null}),vt()),((Vt=(Lt=we[6])==null?void 0:Lt.q)==null?void 0:Vt.m)==3?se?se.p(we,De):(se=xo(we),se.c(),se.m(l,f)):se&&(se.d(1),se=null),((xe=(Mt=we[6])==null?void 0:Mt.q)==null?void 0:xe.m)==4?le?le.p(we,De):(le=ea(we),le.c(),le.m(l,c)):le&&(le.d(1),le=null),(Kt=we[6])!=null&&Kt.c?Q?(Q.p(we,De),De[0]&64&&Z(Q,1)):(Q=ta(we),Q.c(),Z(Q,1),Q.m(l,m)):Q&&(ht(),ie(Q,1,1,()=>{Q=null}),vt()),De[0]&64&&(_=((Yt=(ot=(It=we[6])==null?void 0:It.p)==null?void 0:ot.r)==null?void 0:Yt.startsWith("NO"))||((Pt=(jt=($t=we[6])==null?void 0:$t.p)==null?void 0:jt.r)==null?void 0:Pt.startsWith("10YNO"))||((ct=(Ue=(ll=we[6])==null?void 0:ll.p)==null?void 0:Ue.r)==null?void 0:ct.startsWith("10Y1001A1001A4"))),_?ee?ee.p(we,De):(ee=aa(we),ee.c(),ee.m(l,d)):ee&&(ee.d(1),ee=null),(ut=we[6])!=null&&ut.u?ue?ue.p(we,De):(ue=ua(we),ue.c(),ue.m(l,h)):ue&&(ue.d(1),ue=null),(Ht=(Rt=we[6])==null?void 0:Rt.i)!=null&&Ht.h&&(((dt=we[0])==null?void 0:dt.board)>20||((yt=we[0])==null?void 0:yt.chip)=="esp8266"||((be=(_t=(At=we[6])==null?void 0:At.i)==null?void 0:_t.d)==null?void 0:be.d)>0)?ae?(ae.p(we,De),De[0]&65&&Z(ae,1)):(ae=ma(we),ae.c(),Z(ae,1),ae.m(l,b)):ae&&(ht(),ie(ae,1,1,()=>{ae=null}),vt()),De[0]&65&&(g=((nt=we[6])==null?void 0:nt.d)&&((il=(ze=we[0])==null?void 0:ze.features)==null?void 0:il.includes("rdebug"))),g?x?x.p(we,De):(x=ga(we),x.c(),x.m(l,null)):x&&(x.d(1),x=null),(Je=we[1])!=null&&Je.a?_e?_e.p(we,De):(_e=Ca(we),_e.c(),_e.m(w,A)):_e&&(_e.d(1),_e=null),we[6]?oe?oe.p(we,De):(oe=Sa(we),oe.c(),oe.m(w,null)):oe&&(oe.d(1),oe=null);const lt={};De[0]&8&&(lt.active=we[3]),De[0]&4&&(lt.message=((Xt=(wt=we[2].conf)==null?void 0:wt.mask)==null?void 0:Xt.loading)??"Loading"),L.$set(lt);const Ve={};De[0]&16&&(Ve.active=we[4]),De[0]&4&&(Ve.message=((nl=(xt=we[2].conf)==null?void 0:xt.mask)==null?void 0:nl.saving)??"Saving"),R.$set(Ve);const zt={};De[0]&256&&(zt.active=we[8]),De[0]&4&&(zt.message=((sl=(Wt=we[2].conf)==null?void 0:Wt.mask)==null?void 0:sl.reset)??"Factory reset"),y.$set(zt);const at={};De[0]&512&&(at.active=we[9]),De[0]&4&&(at.message=((te=(Ie=we[2].conf)==null?void 0:Ie.mask)==null?void 0:te.reset_done)??"Done"),W.$set(at)},i(we){N||(Z(G),Z(U),Z(z),Z(Q),Z(ae),Z(L.$$.fragment,we),Z(R.$$.fragment,we),Z(y.$$.fragment,we),Z(W.$$.fragment,we),N=!0)},o(we){ie(G),ie(U),ie(z),ie(Q),ie(ae),ie(L.$$.fragment,we),ie(R.$$.fragment,we),ie(y.$$.fragment,we),ie(W.$$.fragment,we),N=!1},d(we){we&&(T(e),T(F),T(M),T(I),T(K)),G&&G.d(),V&&V.d(),Y&&Y.d(),U&&U.d(),z&&z.d(),se&&se.d(),le&&le.d(),Q&&Q.d(),ee&&ee.d(),ue&&ue.d(),ae&&ae.d(),x&&x.d(),_e&&_e.d(),oe&&oe.d(),Ne(L,we),Ne(R,we),Ne(y,we),Ne(W,we),B=!1,X()}}}async function oc(){await(await fetch("reboot",{method:"POST"})).json()}function ac(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,{data:s}=e,a={};bl.subscribe(Je=>{l(2,a=Je)});let r=[{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"}],f=!0,c=!1,m=!1,_,d=[];Mn.subscribe(Je=>{var wt,Xt,xt;Je.version&&(l(5,m=(wt=Je==null?void 0:Je.c)==null?void 0:wt.e),l(6,_=Je),l(3,f=!1),l(7,d=[{code:"en",name:"English"}]),(Xt=_==null?void 0:_.u)!=null&&Xt.lang&&_.u.lang!="en"&&d.push({code:_.u.lang,name:((xt=a.language)==null?void 0:xt.name)??"Unknown"}),d.push({code:"hub",name:"Load from server"}))}),S0();let h=!1,b=!1;async function g(){if(confirm("Factory reset?")){l(8,h=!0);const Je=new URLSearchParams;Je.append("perform","true");let Xt=await(await fetch("reset",{method:"POST",body:Je})).json();l(8,h=!1),l(9,b=Xt.success)}}async function k(Je){l(4,c=!0);const wt=new FormData(Je.target),Xt=new URLSearchParams;for(let Wt of wt){const[sl,Ie]=Wt;Xt.append(sl,Ie)}let nl=await(await fetch("save",{method:"POST",body:Xt})).json();rl.update(Wt=>(Wt.hostname=wt.get("gh"),Wt.usrcfg=nl.success,Wt.booting=nl.reboot,wt.get("nm")=="static"&&(Wt.net.ip=wt.get("ni"),Wt.net.mask=wt.get("nu"),Wt.net.gw=wt.get("ng"),Wt.net.dns1=wt.get("nd")),Wt.ui=_.u,Wt)),l(4,c=!1),en(n)}const w=function(){confirm("Reboot?")&&(rl.update(Je=>(Je.booting=!0,Je)),oc())};async function A(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),Mn.update(wt=>(wt.q.s.c=!1,wt)))}async function F(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),Mn.update(wt=>(wt.q.s.r=!1,wt)))}async function L(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),Mn.update(wt=>(wt.q.s.k=!1,wt)))}const M=function(){_.q.s.e?_.q.p==1883&&l(6,_.q.p=8883,_):_.q.p==8883&&l(6,_.q.p=1883,_)};async function R(){if(_.u.lang=="hub"){const Je=await vl("http://hub.amsleser.no/hub/language/list.json");l(7,d=await Je.json()),l(6,_.u.lang=a.language.code,_)}}let I=44;async function y(){const Je=await vl("cloudkey.json");if(Je.status==200){let wt=await Je.json();window.open("https://www.amsleser.cloud/device/"+wt.seed)}else alert("Not able to bind to cloud")}const K=window||global;K.bindToCloud=function(){console.log("BIND CALLED")};function W(){_.g.h=this.value,l(6,_)}function N(){_.g.t=Qt(this),l(6,_)}function B(){_.p.r=Qt(this),l(6,_)}function X(){_.p.c=Qt(this),l(6,_)}function G(){_.p.e=this.checked,l(6,_)}function V(){_.p.t=this.value,l(6,_)}function Y(){_.g.s=Qt(this),l(6,_)}function U(){_.g.u=this.value,l(6,_)}function z(){_.g.p=this.value,l(6,_)}function se(){_.g.c=this.value,l(6,_)}function le(){_.m.a=Qt(this),l(6,_)}function Q(){_.m.b=He(this.value),l(6,_)}function ee(){_.m.i=this.checked,l(6,_)}function ue(){_.m.b=Qt(this),l(6,_)}function ae(){_.m.p=Qt(this),l(6,_)}function x(){_.m.s=He(this.value),l(6,_)}function _e(){_.m.d=Qt(this),l(6,_)}function oe(){_.m.f=He(this.value),l(6,_)}function J(){_.m.r=He(this.value),l(6,_)}function $(){_.m.e.e=this.checked,l(6,_)}function he(){_.m.e.k=this.value,l(6,_)}function ke(){_.m.e.a=this.value,l(6,_)}function D(){_.m.m.e=this.checked,l(6,_)}function S(){_.m.m.w=He(this.value),l(6,_)}function O(){_.m.m.v=He(this.value),l(6,_)}function q(){_.m.m.a=He(this.value),l(6,_)}function j(){_.m.m.c=He(this.value),l(6,_)}function ne(){_.n.c=Qt(this),l(6,_)}function fe(){_.w.s=this.value,l(6,_)}function me(){_.w.p=this.value,l(6,_)}function pe(){_.w.z=Qt(this),l(6,_)}function de(){_.w.w=He(this.value),l(6,_)}function Se(){_.w.b=this.checked,l(6,_)}function ge(){_.n.m=Qt(this),l(6,_)}function Le(){_.n.i=this.value,l(6,_)}function qe(){_.n.s=Qt(this),l(6,_)}function Oe(){_.n.g=this.value,l(6,_)}function re(){_.n.d1=this.value,l(6,_)}function Ce(){_.n.d2=this.value,l(6,_)}function Be(){_.n.x=this.checked,l(6,_)}function Ze(){_.n.d=this.checked,l(6,_)}function bt(){_.n.h=this.checked,l(6,_)}function Xe(){_.n.n1=this.value,l(6,_)}function et(){_.q.s.e=this.checked,l(6,_)}function pt(){_.q.h=this.value,l(6,_)}function st(){_.q.p=He(this.value),l(6,_)}function tt(){_.q.u=this.value,l(6,_)}function gt(){_.q.a=this.value,l(6,_)}function it(){_.q.c=this.value,l(6,_)}function Dt(){_.q.m=Qt(this),l(6,_)}function Ae(){_.q.b=this.value,l(6,_)}function Pe(){_.q.t=Qt(this),l(6,_)}function Fe(){_.q.d=He(this.value),l(6,_)}function Ye(){_.q.i=He(this.value),l(6,_)}function ve(){_.q.k=He(this.value),l(6,_)}function Ee(){_.o.e=this.value,l(6,_)}function ye(){_.o.c=this.value,l(6,_)}function we(){_.o.u1=this.value,l(6,_)}function De(){_.o.u2=this.value,l(6,_)}function lt(){_.o.u3=this.value,l(6,_)}function Ve(){_.h.t=this.value,l(6,_)}function zt(){_.h.h=this.value,l(6,_)}function at(){_.h.n=this.value,l(6,_)}function je(){_.c.e=this.checked,l(6,_)}function St(){_.c.p=Qt(this),l(6,_)}function mt(){_.c.es=this.checked,l(6,_)}function ft(Je){_.t.t[Je]=He(this.value),l(6,_)}function rt(){_.t.h=He(this.value),l(6,_)}function Lt(Je){_.u[Je.key]=Qt(this),l(6,_)}function Vt(){_.u.lang=Qt(this),l(6,_)}function Mt(){_.i.h.p=Qt(this),l(6,_)}function xe(){_.i.h.t=Qt(this),l(6,_)}function Kt(){_.i.h.u=this.checked,l(6,_)}function It(){_.i.a=He(this.value),l(6,_)}function ot(){_.i.l.p=He(this.value),l(6,_)}function Yt(){_.i.l.i=this.checked,l(6,_)}function $t(){_.i.r.i=this.checked,l(6,_)}function jt(){_.i.r.r=He(this.value),l(6,_)}function Pt(){_.i.r.g=He(this.value),l(6,_)}function ll(){_.i.r.b=He(this.value),l(6,_)}function Ue(){_.i.d.d=He(this.value),l(6,_)}function ct(){_.i.t.d=He(this.value),l(6,_)}function ut(){_.i.t.a=He(this.value),l(6,_)}function Rt(){_.i.v.p=He(this.value),l(6,_)}function Ht(){_.i.v.d.v=He(this.value),l(6,_)}function dt(){_.i.v.d.g=He(this.value),l(6,_)}function yt(){_.i.d.b=Qt(this),l(6,_)}function At(){_.i.v.o=He(this.value),l(6,_)}function _t(){_.i.v.m=He(this.value),l(6,_)}function be(){_.i.v.b=He(this.value),l(6,_)}function nt(){_.d.s=this.checked,l(6,_)}function ze(){_.d.t=this.checked,l(6,_)}function il(){_.d.l=Qt(this),l(6,_)}return t.$$set=Je=>{"basepath"in Je&&l(21,n=Je.basepath),"sysinfo"in Je&&l(0,i=Je.sysinfo),"data"in Je&&l(1,s=Je.data)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(10,I=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,s,a,f,c,m,_,d,h,b,I,r,g,k,w,A,F,L,M,R,y,n,W,N,B,X,G,V,Y,U,z,se,le,Q,ee,ue,ae,x,_e,oe,J,$,he,ke,D,S,O,q,j,ne,fe,me,pe,de,Se,ge,Le,qe,Oe,re,Ce,Be,Ze,bt,Xe,et,pt,st,tt,gt,it,Dt,Ae,Pe,Fe,Ye,ve,Ee,ye,we,De,lt,Ve,zt,at,je,St,mt,ft,rt,Lt,Vt,Mt,xe,Kt,It,ot,Yt,$t,jt,Pt,ll,Ue,ct,ut,Rt,Ht,dt,yt,At,_t,be,nt,ze,il]}class fc extends qt{constructor(e){super(),Et(this,e,ac,sc,Tt,{basepath:21,sysinfo:0,data:1},null,[-1,-1,-1,-1,-1])}}function Ma(t,e,l){const n=t.slice();return n[22]=e[l],n}function Na(t){let e,l=t[1].cpu+"",n,i;return{c(){e=C("("),n=C(l),i=C("MHz)")},m(s,a){P(s,e,a),P(s,n,a),P(s,i,a)},p(s,a){a&2&&l!==(l=s[1].cpu+"")&&E(n,l)},d(s){s&&(T(e),T(n),T(i))}}}function uc(t){let e=Ge(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){P(n,l,i)},p(n,i){i&2&&e!==(e=Ge(n[1].chip,n[1].board)+"")&&E(l,e)},d(n){n&&T(l)}}}function Ta(t){var Y,U,z,se,le,Q,ee,ue;let e,l=(((U=(Y=t[3].status)==null?void 0:Y.device)==null?void 0:U.apmac)??"AP MAC")+"",n,i,s=t[1].apmac+"",a,r,f,c=(((se=(z=t[3].status)==null?void 0:z.device)==null?void 0:se.last_boot)??"Last boot")+"",m,_,d,h,b,g,k=(((Q=(le=t[3].status)==null?void 0:le.device)==null?void 0:Q.reason)??"Reason")+"",w,A,F=(((ue=(ee=t[3][rs(t[1].chip)])==null?void 0:ee.reason)==null?void 0:ue[t[1].boot_reason])??t[1].boot_reason)+"",L,M,R=t[1].boot_reason+"",I,y,K=t[1].ex_cause+"",W,N,B;const X=[cc,rc],G=[];function V(ae,x){return ae[0].u>0?0:1}return d=V(t),h=G[d]=X[d](t),{c(){e=p("div"),n=C(l),i=C(": "),a=C(s),r=v(),f=p("div"),m=C(c),_=C(`: + `),h.c(),b=v(),g=p("div"),w=C(k),A=C(": "),L=C(F),M=C(" ("),I=C(R),y=C("/"),W=C(K),N=C(")"),u(e,"class","my-2"),u(f,"class","my-2"),u(g,"class","my-2")},m(ae,x){P(ae,e,x),o(e,n),o(e,i),o(e,a),P(ae,r,x),P(ae,f,x),o(f,m),o(f,_),G[d].m(f,null),P(ae,b,x),P(ae,g,x),o(g,w),o(g,A),o(g,L),o(g,M),o(g,I),o(g,y),o(g,W),o(g,N),B=!0},p(ae,x){var oe,J,$,he,ke,D,S,O;(!B||x&8)&&l!==(l=(((J=(oe=ae[3].status)==null?void 0:oe.device)==null?void 0:J.apmac)??"AP MAC")+"")&&E(n,l),(!B||x&2)&&s!==(s=ae[1].apmac+"")&&E(a,s),(!B||x&8)&&c!==(c=(((he=($=ae[3].status)==null?void 0:$.device)==null?void 0:he.last_boot)??"Last boot")+"")&&E(m,c);let _e=d;d=V(ae),d===_e?G[d].p(ae,x):(ht(),ie(G[_e],1,1,()=>{G[_e]=null}),vt(),h=G[d],h?h.p(ae,x):(h=G[d]=X[d](ae),h.c()),Z(h,1),h.m(f,null)),(!B||x&8)&&k!==(k=(((D=(ke=ae[3].status)==null?void 0:ke.device)==null?void 0:D.reason)??"Reason")+"")&&E(w,k),(!B||x&10)&&F!==(F=(((O=(S=ae[3][rs(ae[1].chip)])==null?void 0:S.reason)==null?void 0:O[ae[1].boot_reason])??ae[1].boot_reason)+"")&&E(L,F),(!B||x&2)&&R!==(R=ae[1].boot_reason+"")&&E(I,R),(!B||x&2)&&K!==(K=ae[1].ex_cause+"")&&E(W,K)},i(ae){B||(Z(h),B=!0)},o(ae){ie(h),B=!1},d(ae){ae&&(T(e),T(r),T(f),T(b),T(g)),G[d].d()}}}function rc(t){let e;return{c(){e=C("-")},m(l,n){P(l,e,n)},p:We,i:We,o:We,d(l){l&&T(e)}}}function cc(t){let e,l;return e=new mu({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Pa(t){var m;let e,l,n,i,s=(((m=t[3].btn)==null?void 0:m.reboot)??"Reboot")+"",a,r,f,c;return l=new pl({props:{to:"/consent",$$slots:{default:[mc]},$$scope:{ctx:t}}}),{c(){e=p("div"),Te(l.$$.fragment),n=v(),i=p("button"),a=C(s),u(i,"class","btn-yellow-sm float-right"),u(e,"class","my-2")},m(_,d){P(_,e,d),Me(l,e,null),o(e,n),o(e,i),o(i,a),r=!0,f||(c=ce(i,"click",t[12]),f=!0)},p(_,d){var b;const h={};d&33554440&&(h.$$scope={dirty:d,ctx:_}),l.$set(h),(!r||d&8)&&s!==(s=(((b=_[3].btn)==null?void 0:b.reboot)??"Reboot")+"")&&E(a,s)},i(_){r||(Z(l.$$.fragment,_),r=!0)},o(_){ie(l.$$.fragment,_),r=!1},d(_){_&&T(e),Ne(l),f=!1,c()}}}function mc(t){var i,s;let e,l=(((s=(i=t[3].status)==null?void 0:i.device)==null?void 0:s.btn_consents)??"Consents")+"",n;return{c(){e=p("span"),n=C(l),u(e,"class","btn-pri-sm")},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r&8&&l!==(l=(((c=(f=a[3].status)==null?void 0:f.device)==null?void 0:c.btn_consents)??"Consents")+"")&&E(n,l)},d(a){a&&T(e)}}}function Ea(t){var W,N,B,X,G,V,Y,U;let e,l,n=(((N=(W=t[3].status)==null?void 0:W.meter)==null?void 0:N.title)??"Meter")+"",i,s,a,r=(((X=(B=t[3].status)==null?void 0:B.meter)==null?void 0:X.manufacturer)??"Manufacturer")+"",f,c,m=Yn(t[1].meter.mfg)+"",_,d,h,b=(((V=(G=t[3].status)==null?void 0:G.meter)==null?void 0:V.model)??"Model")+"",g,k,w=(t[1].meter.model?t[1].meter.model:"unknown")+"",A,F,L,M=(((U=(Y=t[3].status)==null?void 0:Y.meter)==null?void 0:U.id)??"ID")+"",R,I,y=(t[1].meter.id?t[1].meter.id:"unknown")+"",K;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),f=C(r),c=C(": "),_=C(m),d=v(),h=p("div"),g=C(b),k=C(": "),A=C(w),F=v(),L=p("div"),R=C(M),I=C(": "),K=C(y),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(L,"class","my-2"),u(e,"class","cnt")},m(z,se){P(z,e,se),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(a,c),o(a,_),o(e,d),o(e,h),o(h,g),o(h,k),o(h,A),o(e,F),o(e,L),o(L,R),o(L,I),o(L,K)},p(z,se){var le,Q,ee,ue,ae,x,_e,oe;se&8&&n!==(n=(((Q=(le=z[3].status)==null?void 0:le.meter)==null?void 0:Q.title)??"Meter")+"")&&E(i,n),se&8&&r!==(r=(((ue=(ee=z[3].status)==null?void 0:ee.meter)==null?void 0:ue.manufacturer)??"Manufacturer")+"")&&E(f,r),se&2&&m!==(m=Yn(z[1].meter.mfg)+"")&&E(_,m),se&8&&b!==(b=(((x=(ae=z[3].status)==null?void 0:ae.meter)==null?void 0:x.model)??"Model")+"")&&E(g,b),se&2&&w!==(w=(z[1].meter.model?z[1].meter.model:"unknown")+"")&&E(A,w),se&8&&M!==(M=(((oe=(_e=z[3].status)==null?void 0:_e.meter)==null?void 0:oe.id)??"ID")+"")&&E(R,M),se&2&&y!==(y=(z[1].meter.id?z[1].meter.id:"unknown")+"")&&E(K,y)},d(z){z&&T(e)}}}function qa(t){var U,z,se,le,Q,ee,ue,ae;let e,l,n=(((z=(U=t[3].status)==null?void 0:U.network)==null?void 0:z.title)??"Network")+"",i,s,a,r=(((le=(se=t[3].conf)==null?void 0:se.network)==null?void 0:le.ip)??"IP")+"",f,c,m=t[1].net.ip+"",_,d,h,b=(((ee=(Q=t[3].conf)==null?void 0:Q.network)==null?void 0:ee.mask)??"Mask")+"",g,k,w=t[1].net.mask+"",A,F,L,M=(((ae=(ue=t[3].conf)==null?void 0:ue.network)==null?void 0:ae.gw)??"Gateway")+"",R,I,y=t[1].net.gw+"",K,W,N,B,X,G=t[1].net.dns1&&Da(t),V=t[1].net.dns2&&Aa(t),Y=t[1].net.ipv6&&La(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),f=C(r),c=C(": "),_=C(m),d=v(),h=p("div"),g=C(b),k=C(": "),A=C(w),F=v(),L=p("div"),R=C(M),I=C(": "),K=C(y),W=v(),N=p("div"),G&&G.c(),B=v(),V&&V.c(),X=v(),Y&&Y.c(),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(L,"class","my-2"),u(N,"class","my-2"),u(e,"class","cnt")},m(x,_e){P(x,e,_e),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(a,c),o(a,_),o(e,d),o(e,h),o(h,g),o(h,k),o(h,A),o(e,F),o(e,L),o(L,R),o(L,I),o(L,K),o(e,W),o(e,N),G&&G.m(N,null),o(N,B),V&&V.m(N,null),o(e,X),Y&&Y.m(e,null)},p(x,_e){var oe,J,$,he,ke,D,S,O;_e&8&&n!==(n=(((J=(oe=x[3].status)==null?void 0:oe.network)==null?void 0:J.title)??"Network")+"")&&E(i,n),_e&8&&r!==(r=(((he=($=x[3].conf)==null?void 0:$.network)==null?void 0:he.ip)??"IP")+"")&&E(f,r),_e&2&&m!==(m=x[1].net.ip+"")&&E(_,m),_e&8&&b!==(b=(((D=(ke=x[3].conf)==null?void 0:ke.network)==null?void 0:D.mask)??"Mask")+"")&&E(g,b),_e&2&&w!==(w=x[1].net.mask+"")&&E(A,w),_e&8&&M!==(M=(((O=(S=x[3].conf)==null?void 0:S.network)==null?void 0:O.gw)??"Gateway")+"")&&E(R,M),_e&2&&y!==(y=x[1].net.gw+"")&&E(K,y),x[1].net.dns1?G?G.p(x,_e):(G=Da(x),G.c(),G.m(N,B)):G&&(G.d(1),G=null),x[1].net.dns2?V?V.p(x,_e):(V=Aa(x),V.c(),V.m(N,null)):V&&(V.d(1),V=null),x[1].net.ipv6?Y?Y.p(x,_e):(Y=La(x),Y.c(),Y.m(e,null)):Y&&(Y.d(1),Y=null)},d(x){x&&T(e),G&&G.d(),V&&V.d(),Y&&Y.d()}}}function Da(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[1].net.dns1+"",s;return{c(){l=C(e),n=C(": "),s=C(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,s,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&E(l,e),c&2&&i!==(i=f[1].net.dns1+"")&&E(s,i)},d(f){f&&(T(l),T(n),T(s))}}}function Aa(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[1].net.dns2+"",s;return{c(){l=C(e),n=C(": "),s=C(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,s,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&E(l,e),c&2&&i!==(i=f[1].net.dns2+"")&&E(s,i)},d(f){f&&(T(l),T(n),T(s))}}}function La(t){let e,l,n,i=t[1].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"",s,a,r,f,c=t[1].net.dns1v6&&Ia(t),m=t[1].net.dns2v6&&Oa(t);return{c(){e=p("div"),l=C("IPv6: "),n=p("span"),s=C(i),a=v(),r=p("div"),c&&c.c(),f=v(),m&&m.c(),xl(n,"font-size","14px"),u(e,"class","my-2"),u(r,"class","my-2")},m(_,d){P(_,e,d),o(e,l),o(e,n),o(n,s),P(_,a,d),P(_,r,d),c&&c.m(r,null),o(r,f),m&&m.m(r,null)},p(_,d){d&2&&i!==(i=_[1].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(s,i),_[1].net.dns1v6?c?c.p(_,d):(c=Ia(_),c.c(),c.m(r,f)):c&&(c.d(1),c=null),_[1].net.dns2v6?m?m.p(_,d):(m=Oa(_),m.c(),m.m(r,null)):m&&(m.d(1),m=null)},d(_){_&&(T(e),T(a),T(r)),c&&c.d(),m&&m.d()}}}function Ia(t){let e,l,n=t[1].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=C("DNSv6: "),l=p("span"),i=C(n),xl(l,"font-size","14px")},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&2&&n!==(n=s[1].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(i,n)},d(s){s&&(T(e),T(l))}}}function Oa(t){let e,l,n=t[1].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=C("DNSv6: "),l=p("span"),i=C(n),xl(l,"font-size","14px")},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&2&&n!==(n=s[1].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(i,n)},d(s){s&&(T(e),T(l))}}}function Ra(t){var f,c,m,_;let e,l,n=(((c=(f=t[3].status)==null?void 0:f.firmware)==null?void 0:c.failed)??"Upgrade from {0} to {1} failed").replace("{0}",t[1].upgrade.f).replace("{1}",t[1].upgrade.t)+"",i,s,a=(((_=(m=t[3].errors)==null?void 0:m.http)==null?void 0:_[t[1].upgrade.e])??t[1].upgrade.e)+"",r;return{c(){e=p("div"),l=p("div"),i=C(n),s=v(),r=C(a),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(d,h){P(d,e,h),o(e,l),o(l,i),o(l,s),o(l,r)},p(d,h){var b,g,k,w;h&10&&n!==(n=(((g=(b=d[3].status)==null?void 0:b.firmware)==null?void 0:g.failed)??"Upgrade from {0} to {1} failed").replace("{0}",d[1].upgrade.f).replace("{1}",d[1].upgrade.t)+"")&&E(i,n),h&10&&a!==(a=(((w=(k=d[3].errors)==null?void 0:k.http)==null?void 0:w[d[1].upgrade.e])??d[1].upgrade.e)+"")&&E(r,a)},d(d){d&&T(e)}}}function Fa(t){var b,g;let e,l=(((g=(b=t[3].status)==null?void 0:b.firmware)==null?void 0:g.latest)??"Latest")+"",n,i,s,a=t[4].tag_name+"",r,f,c,m,_,d=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[4]&&t[4].tag_name!=t[1].version&&Ba(t),h=t[1].fwconsent===2&&Ua(t);return{c(){e=p("div"),n=C(l),i=C(`: + `),s=p("a"),r=C(a),c=v(),d&&d.c(),m=v(),h&&h.c(),_=Jt(),u(s,"href",f=t[4].html_url),u(s,"class","ml-2 text-blue-600 hover:text-blue-800"),u(s,"target","_blank"),u(s,"rel","noreferrer"),u(e,"class","my-2 flex")},m(k,w){P(k,e,w),o(e,n),o(e,i),o(e,s),o(s,r),o(e,c),d&&d.m(e,null),P(k,m,w),h&&h.m(k,w),P(k,_,w)},p(k,w){var A,F;w&8&&l!==(l=(((F=(A=k[3].status)==null?void 0:A.firmware)==null?void 0:F.latest)??"Latest")+"")&&E(n,l),w&16&&a!==(a=k[4].tag_name+"")&&E(r,a),w&16&&f!==(f=k[4].html_url)&&u(s,"href",f),(k[1].security==0||k[0].a)&&k[1].fwconsent===1&&k[4]&&k[4].tag_name!=k[1].version?d?d.p(k,w):(d=Ba(k),d.c(),d.m(e,null)):d&&(d.d(1),d=null),k[1].fwconsent===2?h?h.p(k,w):(h=Ua(k),h.c(),h.m(_.parentNode,_)):h&&(h.d(1),h=null)},d(k){k&&(T(e),T(m),T(_)),d&&d.d(),h&&h.d(k)}}}function Ba(t){let e,l,n,i,s;return{c(){var a,r;e=p("div"),l=p("button"),l.textContent="⇓",u(e,"class","flex-none ml-2 text-green-500"),u(e,"title",n=((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.install)??"Install")},m(a,r){P(a,e,r),o(e,l),i||(s=ce(l,"click",t[11]),i=!0)},p(a,r){var f,c;r&8&&n!==(n=((c=(f=a[3].status)==null?void 0:f.firmware)==null?void 0:c.install)??"Install")&&u(e,"title",n)},d(a){a&&T(e),i=!1,s()}}}function Ua(t){var s,a;let e,l,n=(((a=(s=t[3].status)==null?void 0:s.firmware)==null?void 0:a.no_one_click)??"One-click upgrade disabled")+"",i;return{c(){e=p("div"),l=p("div"),i=C(n),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(r,f){P(r,e,f),o(e,l),o(l,i)},p(r,f){var c,m;f&8&&n!==(n=(((m=(c=r[3].status)==null?void 0:c.firmware)==null?void 0:m.no_one_click)??"One-click upgrade disabled")+"")&&E(i,n)},d(r){r&&T(e)}}}function ja(t){let e,l=Qn(Ge(t[1].chip,t[1].board))+"",n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,s){P(i,e,s),o(e,n)},p(i,s){s&2&&l!==(l=Qn(Ge(i[1].chip,i[1].board))+"")&&E(n,l)},d(i){i&&T(e)}}}function Ha(t){let e,l,n,i,s,a;function r(m,_){return m[6].length==0?pc:_c}let f=r(t),c=f(t);return{c(){e=p("div"),l=p("form"),n=p("input"),i=v(),c.c(),xl(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","/firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(e,"class","my-2 flex")},m(m,_){P(m,e,_),o(e,l),o(l,n),t[14](n),o(l,i),c.m(l,null),s||(a=[ce(n,"change",t[15]),ce(l,"submit",t[17])],s=!0)},p(m,_){f===(f=r(m))&&c?c.p(m,_):(c.d(1),c=f(m),c&&(c.c(),c.m(l,null)))},d(m){m&&T(e),t[14](null),c.d(),s=!1,Ut(a)}}}function _c(t){var r;let e=t[6][0].name+"",l,n,i,s=(((r=t[3].btn)==null?void 0:r.upload)??"Upload")+"",a;return{c(){l=C(e),n=v(),i=p("button"),a=C(s),u(i,"type","submit"),u(i,"class","btn-pri-sm float-right ml-2")},m(f,c){P(f,l,c),P(f,n,c),P(f,i,c),o(i,a)},p(f,c){var m;c&64&&e!==(e=f[6][0].name+"")&&E(l,e),c&8&&s!==(s=(((m=f[3].btn)==null?void 0:m.upload)??"Upload")+"")&&E(a,s)},d(f){f&&(T(l),T(n),T(i))}}}function pc(t){var a,r;let e,l=(((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.btn_select_file)??"Select file")+"",n,i,s;return{c(){e=p("button"),n=C(l),u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(f,c){P(f,e,c),o(e,n),i||(s=ce(e,"click",t[16]),i=!0)},p(f,c){var m,_;c&8&&l!==(l=(((_=(m=f[3].status)==null?void 0:m.firmware)==null?void 0:_.btn_select_file)??"Select file")+"")&&E(n,l)},d(f){f&&T(e),i=!1,s()}}}function ya(t){var V,Y,U,z,se,le;let e,l,n=(((Y=(V=t[3].status)==null?void 0:V.backup)==null?void 0:Y.title)??"Backup")+"",i,s,a,r,f,c,m,_,d=(((z=(U=t[3].status)==null?void 0:U.backup)==null?void 0:z.secrets)??"Include secrets")+"",h,b,g,k=(((le=(se=t[3].status)==null?void 0:se.backup)==null?void 0:le.secrets_desc)??"")+"",w,A,F,L,M,R,I,y,K=kt(t[10]),W=[];for(let Q=0;Q{me=null}),vt()),(ft=ve[0])!=null&&ft.a?pe?(pe.p(ve,Ee),Ee&1&&Z(pe,1)):(pe=Pa(ve),pe.c(),Z(pe,1),pe.m(l,null)):pe&&(ht(),ie(pe,1,1,()=>{pe=null}),vt()),ve[1].meter?de?de.p(ve,Ee):(de=Ea(ve),de.c(),de.m(e,G)):de&&(de.d(1),de=null),ve[1].net?Se?Se.p(ve,Ee):(Se=qa(ve),Se.c(),Se.m(e,V)):Se&&(Se.d(1),Se=null),(!ne||Ee&8)&&z!==(z=(((Lt=(rt=ve[3].status)==null?void 0:rt.firmware)==null?void 0:Lt.title)??"Firmware")+"")&&E(se,z),(!ne||Ee&8)&&ee!==(ee=(((Mt=(Vt=ve[3].status)==null?void 0:Vt.firmware)==null?void 0:Mt.installed)??"Installed")+"")&&E(ue,ee),(!ne||Ee&2)&&x!==(x=ve[1].version+"")&&E(_e,x),ve[1].upgrade.t&&ve[1].upgrade.t!=ve[1].version?ge?ge.p(ve,Ee):(ge=Ra(ve),ge.c(),ge.m(Y,J)):ge&&(ge.d(1),ge=null),ve[4]?Le?Le.p(ve,Ee):(Le=Fa(ve),Le.c(),Le.m(Y,$)):Le&&(Le.d(1),Le=null),Ee&3&&(he=(ve[1].security==0||ve[0].a)&&hn(ve[1].board)),he?qe?qe.p(ve,Ee):(qe=ja(ve),qe.c(),qe.m(Y,ke)):qe&&(qe.d(1),qe=null),ve[1].security==0||ve[0].a?Oe?Oe.p(ve,Ee):(Oe=Ha(ve),Oe.c(),Oe.m(Y,null)):Oe&&(Oe.d(1),Oe=null),ve[1].security==0||ve[0].a?re?re.p(ve,Ee):(re=ya(ve),re.c(),re.m(e,null)):re&&(re.d(1),re=null);const we={};Ee&128&&(we.active=ve[7]),Ee&8&&(we.message=((Kt=(xe=ve[3].status)==null?void 0:xe.mask)==null?void 0:Kt.firmware)??"Uploading"),O.$set(we);const De={};Ee&512&&(De.active=ve[9]),Ee&8&&(De.message=((ot=(It=ve[3].status)==null?void 0:It.mask)==null?void 0:ot.config)??"Uploading"),j.$set(De)},i(ve){ne||(Z(F.$$.fragment,ve),Z(me),Z(pe),Z(O.$$.fragment,ve),Z(j.$$.fragment,ve),ne=!0)},o(ve){ie(F.$$.fragment,ve),ie(me),ie(pe),ie(O.$$.fragment,ve),ie(j.$$.fragment,ve),ne=!1},d(ve){ve&&(T(e),T(S),T(q)),fe&&fe.d(),Ne(F),me&&me.d(),pe&&pe.d(),de&&de.d(),Se&&Se.d(),ge&&ge.d(),Le&&Le.d(),qe&&qe.d(),Oe&&Oe.d(),re&&re.d(),Ne(O,ve),Ne(j,ve)}}}async function bc(){await(await fetch("reboot",{method:"POST"})).json()}function gc(t,e,l){let{data:n}=e,{sysinfo:i}=e,s=[{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",key:"is"}],a={};bl.subscribe(K=>{l(3,a=K)});let r={};Ui.subscribe(K=>{l(4,r=cu(i.version,K)),r||l(4,r=K[0])});function f(){var K;confirm((((K=a.header)==null?void 0:K.upgrade)??"Upgrade to {0}?").replace("{0}",r.tag_name))&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Qn(Ge(i.chip,i.board))))&&(rl.update(W=>(W.upgrading=!0,W)),ru(r.tag_name))}const c=function(){var K;confirm(((K=a.device)==null?void 0:K.reboot_confirm)??"Reboot?")&&(rl.update(W=>(W.booting=!0,W)),bc())};let m,_=[],d=!1,h,b=[],g=!1;Fi();let k={hostname:"",ip:""};function w(K){l(9,g=!0);const W=new FormData;W.append("file",b[0]),fetch("configfile",{method:"POST",body:W}).then(N=>N.json()).then(N=>{rl.update(B=>(k&&k.hostname&&(B.hostname=k.hostname),B.booting=N.reboot,k&&k.ip&&(B.net.ip=k.ip),setTimeout(qn,5e3,i),B))}).catch(N=>{console.error("Error:",N),setTimeout(qn,5e3,i)})}function A(K){Vn[K?"unshift":"push"](()=>{m=K,l(5,m)})}function F(){_=this.files,l(6,_)}const L=()=>{m.click()},M=()=>l(7,d=!0);function R(K){Vn[K?"unshift":"push"](()=>{h=K,l(8,h)})}function I(){b=this.files,l(2,b)}const y=()=>{h.click()};return t.$$set=K=>{"data"in K&&l(0,n=K.data),"sysinfo"in K&&l(1,i=K.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&4&&b.length==1){let K=b[0],W=new FileReader,N=B=>{let X=B.target.result.split(` +`);for(let G in X){let V=X[G];V.startsWith("hostname ")?k.hostname=V.split(" ")[1]:V.startsWith("ip ")&&(k.ip=V.split(" ")[1])}};W.onload=N,W.readAsText(K)}},[n,i,b,a,r,m,_,d,h,g,s,f,c,w,A,F,L,M,R,I,y]}class kc extends qt{constructor(e){super(),Et(this,e,gc,vc,Tt,{data:0,sysinfo:1})}}function Ga(t){let e,l,n=Ge(t[0],7)+"",i,s,a=Ge(t[0],5)+"",r,f,c=Ge(t[0],4)+"",m,_,d=Ge(t[0],3)+"",h,b,g,k,w=Ge(t[0],2)+"",A,F,L=Ge(t[0],1)+"",M,R,I=Ge(t[0],0)+"",y,K,W,N,B=Ge(t[0],101)+"",X,G,V=Ge(t[0],100)+"",Y;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=p("option"),h=C(d),b=v(),g=p("optgroup"),k=p("option"),A=C(w),F=p("option"),M=C(L),R=p("option"),y=C(I),K=v(),W=p("optgroup"),N=p("option"),X=C(B),G=p("option"),Y=C(V),l.__value=7,H(l,l.__value),s.__value=5,H(s,s.__value),f.__value=4,H(f,f.__value),_.__value=3,H(_,_.__value),u(e,"label","amsleser.no"),k.__value=2,H(k,k.__value),F.__value=1,H(F,F.__value),R.__value=0,H(R,R.__value),u(g,"label","Custom hardware"),N.__value=101,H(N,N.__value),G.__value=100,H(G,G.__value),u(W,"label","Generic hardware")},m(U,z){P(U,e,z),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),o(e,_),o(_,h),P(U,b,z),P(U,g,z),o(g,k),o(k,A),o(g,F),o(F,M),o(g,R),o(R,y),P(U,K,z),P(U,W,z),o(W,N),o(N,X),o(W,G),o(G,Y)},p(U,z){z&1&&n!==(n=Ge(U[0],7)+"")&&E(i,n),z&1&&a!==(a=Ge(U[0],5)+"")&&E(r,a),z&1&&c!==(c=Ge(U[0],4)+"")&&E(m,c),z&1&&d!==(d=Ge(U[0],3)+"")&&E(h,d),z&1&&w!==(w=Ge(U[0],2)+"")&&E(A,w),z&1&&L!==(L=Ge(U[0],1)+"")&&E(M,L),z&1&&I!==(I=Ge(U[0],0)+"")&&E(y,I),z&1&&B!==(B=Ge(U[0],101)+"")&&E(X,B),z&1&&V!==(V=Ge(U[0],100)+"")&&E(Y,V)},d(U){U&&(T(e),T(b),T(g),T(K),T(W))}}}function Va(t){let e,l,n=Ge(t[0],201)+"",i,s,a=Ge(t[0],202)+"",r,f,c=Ge(t[0],203)+"",m,_,d=Ge(t[0],241)+"",h,b,g=Ge(t[0],242)+"",k,w,A=Ge(t[0],243)+"",F,L,M=Ge(t[0],245)+"",R,I,y=Ge(t[0],200)+"",K;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=p("option"),h=C(d),b=p("option"),k=C(g),w=p("option"),F=C(A),L=p("option"),R=C(M),I=p("option"),K=C(y),l.__value=201,H(l,l.__value),s.__value=202,H(s,s.__value),f.__value=203,H(f,f.__value),_.__value=241,H(_,_.__value),b.__value=242,H(b,b.__value),w.__value=243,H(w,w.__value),L.__value=245,H(L,L.__value),I.__value=200,H(I,I.__value),u(e,"label","Generic hardware")},m(W,N){P(W,e,N),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),o(e,_),o(_,h),o(e,b),o(b,k),o(e,w),o(w,F),o(e,L),o(L,R),o(e,I),o(I,K)},p(W,N){N&1&&n!==(n=Ge(W[0],201)+"")&&E(i,n),N&1&&a!==(a=Ge(W[0],202)+"")&&E(r,a),N&1&&c!==(c=Ge(W[0],203)+"")&&E(m,c),N&1&&d!==(d=Ge(W[0],241)+"")&&E(h,d),N&1&&g!==(g=Ge(W[0],242)+"")&&E(k,g),N&1&&A!==(A=Ge(W[0],243)+"")&&E(F,A),N&1&&M!==(M=Ge(W[0],245)+"")&&E(R,M),N&1&&y!==(y=Ge(W[0],200)+"")&&E(K,y)},d(W){W&&T(e)}}}function Ka(t){let e,l,n=Ge(t[0],7)+"",i,s,a=Ge(t[0],6)+"",r,f,c=Ge(t[0],5)+"",m,_,d,h,b=Ge(t[0],51)+"",g,k,w=Ge(t[0],50)+"",A;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=v(),d=p("optgroup"),h=p("option"),g=C(b),k=p("option"),A=C(w),l.__value=7,H(l,l.__value),s.__value=6,H(s,s.__value),f.__value=5,H(f,f.__value),u(e,"label","amsleser.no"),h.__value=51,H(h,h.__value),k.__value=50,H(k,k.__value),u(d,"label","Generic hardware")},m(F,L){P(F,e,L),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),P(F,_,L),P(F,d,L),o(d,h),o(h,g),o(d,k),o(k,A)},p(F,L){L&1&&n!==(n=Ge(F[0],7)+"")&&E(i,n),L&1&&a!==(a=Ge(F[0],6)+"")&&E(r,a),L&1&&c!==(c=Ge(F[0],5)+"")&&E(m,c),L&1&&b!==(b=Ge(F[0],51)+"")&&E(g,b),L&1&&w!==(w=Ge(F[0],50)+"")&&E(A,w)},d(F){F&&(T(e),T(_),T(d))}}}function Ya(t){let e,l,n=Ge(t[0],8)+"",i,s,a,r,f=Ge(t[0],71)+"",c,m,_=Ge(t[0],70)+"",d;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=v(),a=p("optgroup"),r=p("option"),c=C(f),m=p("option"),d=C(_),l.__value=8,H(l,l.__value),u(e,"label","Custom hardware"),r.__value=71,H(r,r.__value),m.__value=70,H(m,m.__value),u(a,"label","Generic hardware")},m(h,b){P(h,e,b),o(e,l),o(l,i),P(h,s,b),P(h,a,b),o(a,r),o(r,c),o(a,m),o(m,d)},p(h,b){b&1&&n!==(n=Ge(h[0],8)+"")&&E(i,n),b&1&&f!==(f=Ge(h[0],71)+"")&&E(c,f),b&1&&_!==(_=Ge(h[0],70)+"")&&E(d,_)},d(h){h&&(T(e),T(s),T(a))}}}function Qa(t){let e,l,n=Ge(t[0],200)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=200,H(l,l.__value),u(e,"label","Generic hardware")},m(s,a){P(s,e,a),o(e,l),o(l,i)},p(s,a){a&1&&n!==(n=Ge(s[0],200)+"")&&E(i,n)},d(s){s&&T(e)}}}function Xa(t){let e,l,n=Ge(t[0],80)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=80,H(l,l.__value),u(e,"label","Generic hardware")},m(s,a){P(s,e,a),o(e,l),o(l,i)},p(s,a){a&1&&n!==(n=Ge(s[0],80)+"")&&E(i,n)},d(s){s&&T(e)}}}function wc(t){let e,l,n,i,s,a,r,f,c=t[0]=="esp8266"&&Ga(t),m=t[0]=="esp32"&&Va(t),_=t[0]=="esp32s2"&&Ka(t),d=t[0]=="esp32c3"&&Ya(t),h=t[0]=="esp32solo"&&Qa(t),b=t[0]=="esp32s3"&&Xa(t);return{c(){e=p("option"),l=v(),c&&c.c(),n=v(),m&&m.c(),i=v(),_&&_.c(),s=v(),d&&d.c(),a=v(),h&&h.c(),r=v(),b&&b.c(),f=Jt(),e.__value=-1,H(e,e.__value)},m(g,k){P(g,e,k),P(g,l,k),c&&c.m(g,k),P(g,n,k),m&&m.m(g,k),P(g,i,k),_&&_.m(g,k),P(g,s,k),d&&d.m(g,k),P(g,a,k),h&&h.m(g,k),P(g,r,k),b&&b.m(g,k),P(g,f,k)},p(g,[k]){g[0]=="esp8266"?c?c.p(g,k):(c=Ga(g),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),g[0]=="esp32"?m?m.p(g,k):(m=Va(g),m.c(),m.m(i.parentNode,i)):m&&(m.d(1),m=null),g[0]=="esp32s2"?_?_.p(g,k):(_=Ka(g),_.c(),_.m(s.parentNode,s)):_&&(_.d(1),_=null),g[0]=="esp32c3"?d?d.p(g,k):(d=Ya(g),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null),g[0]=="esp32solo"?h?h.p(g,k):(h=Qa(g),h.c(),h.m(r.parentNode,r)):h&&(h.d(1),h=null),g[0]=="esp32s3"?b?b.p(g,k):(b=Xa(g),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i:We,o:We,d(g){g&&(T(e),T(l),T(n),T(i),T(s),T(a),T(r),T(f)),c&&c.d(g),m&&m.d(g),_&&_.d(g),d&&d.d(g),h&&h.d(g),b&&b.d(g)}}}function Cc(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Sc extends qt{constructor(e){super(),Et(this,e,Cc,wc,Tt,{chip:0})}}function Za(t){let e;return{c(){e=p("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(e,"class","bd-red")},m(l,n){P(l,e,n)},d(l){l&&T(e)}}}function Ja(t){let e,l,n,i,s,a,r;return a=new Si({props:{chip:t[0].chip}}),{c(){e=p("div"),l=C("HAN GPIO"),n=p("br"),i=v(),s=p("select"),Te(a.$$.fragment),u(s,"name","vh"),u(s,"class","in-s"),u(e,"class","my-3")},m(f,c){P(f,e,c),o(e,l),o(e,n),o(e,i),o(e,s),Me(a,s,null),r=!0},p(f,c){const m={};c&1&&(m.chip=f[0].chip),a.$set(m)},i(f){r||(Z(a.$$.fragment,f),r=!0)},o(f){ie(a.$$.fragment,f),r=!1},d(f){f&&T(e),Ne(a)}}}function Mc(t){let e,l,n,i,s,a,r,f,c,m,_,d,h,b,g,k,w,A,F,L,M,R,I,y,K,W,N,B,X,G=t[0].usrcfg&&Za();b=new Sc({props:{chip:t[0].chip}});let V=t[0].board&&t[0].board>20&&Ja(t);return W=new fl({props:{active:t[1],message:"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),s=v(),a=p("strong"),a.textContent="Initial configuration",r=v(),G&&G.c(),f=v(),c=p("div"),m=C("Board type"),_=p("br"),d=v(),h=p("select"),Te(b.$$.fragment),g=v(),V&&V.c(),k=v(),w=p("div"),A=p("label"),F=p("input"),L=C(" Clear all other configuration"),M=v(),R=p("div"),R.innerHTML='',I=v(),y=p("span"),y.textContent=" ",K=v(),Te(W.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(a,"class","text-sm"),u(h,"name","vb"),u(h,"class","in-s"),t[0].board===void 0&&Bt(()=>t[5].call(h)),u(c,"class","my-3"),u(F,"type","checkbox"),u(F,"name","vr"),F.__value="true",H(F,F.__value),u(F,"class","rounded mb-1"),u(w,"class","my-3"),u(R,"class","my-3"),u(y,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Y,U){P(Y,e,U),o(e,l),o(l,n),o(n,i),o(n,s),o(n,a),o(n,r),G&&G.m(n,null),o(n,f),o(n,c),o(c,m),o(c,_),o(c,d),o(c,h),Me(b,h,null),Qe(h,t[0].board,!0),o(n,g),V&&V.m(n,null),o(n,k),o(n,w),o(w,A),o(A,F),F.checked=t[2],o(A,L),o(n,M),o(n,R),o(n,I),o(n,y),P(Y,K,U),Me(W,Y,U),N=!0,B||(X=[ce(h,"change",t[5]),ce(F,"change",t[6]),ce(n,"submit",un(t[3]))],B=!0)},p(Y,[U]){Y[0].usrcfg?G||(G=Za(),G.c(),G.m(n,f)):G&&(G.d(1),G=null);const z={};U&1&&(z.chip=Y[0].chip),b.$set(z),U&1&&Qe(h,Y[0].board),Y[0].board&&Y[0].board>20?V?(V.p(Y,U),U&1&&Z(V,1)):(V=Ja(Y),V.c(),Z(V,1),V.m(n,k)):V&&(ht(),ie(V,1,1,()=>{V=null}),vt()),U&4&&(F.checked=Y[2]);const se={};U&2&&(se.active=Y[1]),W.$set(se)},i(Y){N||(Z(b.$$.fragment,Y),Z(V),Z(W.$$.fragment,Y),N=!0)},o(Y){ie(b.$$.fragment,Y),ie(V),ie(W.$$.fragment,Y),N=!1},d(Y){Y&&(T(e),T(K)),G&&G.d(),Ne(b),V&&V.d(),Ne(W,Y),B=!1,Ut(X)}}}function Nc(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,s=!1;async function a(m){l(1,s=!0);const _=new FormData(m.target),d=new URLSearchParams;for(let g of _){const[k,w]=g;d.append(k,w)}let b=await(await fetch("save",{method:"POST",body:d})).json();l(1,s=!1),rl.update(g=>(g.vndcfg=b.success,g.booting=b.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),en(n+(i.usrcfg?"/":"/setup"))}let r=!1;rl.subscribe(m=>{l(0,i=m),m.fwconsent===1&&l(2,r=!i.usrcfg)});function f(){i.board=Qt(this),l(0,i)}function c(){r=this.checked,l(2,r)}return t.$$set=m=>{"basepath"in m&&l(4,n=m.basepath),"sysinfo"in m&&l(0,i=m.sysinfo)},[i,s,r,a,n,f,c]}class Tc extends qt{constructor(e){super(),Et(this,e,Nc,Mc,Tt,{basepath:4,sysinfo:0})}}function $a(t){var i,s;let e,l=(((s=(i=t[1].conf)==null?void 0:i.connection)==null?void 0:s.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=C(l),e.__value=3,H(e,e.__value)},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r&2&&l!==(l=(((c=(f=a[1].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&E(n,l)},d(a){a&&T(e)}}}function xa(t){var k,w,A,F;let e,l=(((w=(k=t[1].conf)==null?void 0:k.connection)==null?void 0:w.ssid)??"SSID")+"",n,i,s,a,r,f,c,m=(((F=(A=t[1].conf)==null?void 0:A.connection)==null?void 0:F.psk)??"Password")+"",_,d,h,b,g;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),f=v(),c=p("div"),_=C(m),d=p("br"),h=v(),b=p("input"),u(a,"name","ss"),u(a,"type","text"),u(a,"class","in-s"),a.required=r=t[3]==1||t[3]==2,u(e,"class","my-3"),u(b,"name","sp"),u(b,"type","password"),u(b,"class","in-s"),u(b,"autocomplete","off"),b.required=g=t[3]==2,u(c,"class","my-3")},m(L,M){P(L,e,M),o(e,n),o(e,i),o(e,s),o(e,a),P(L,f,M),P(L,c,M),o(c,_),o(c,d),o(c,h),o(c,b)},p(L,M){var R,I,y,K;M&2&&l!==(l=(((I=(R=L[1].conf)==null?void 0:R.connection)==null?void 0:I.ssid)??"SSID")+"")&&E(n,l),M&8&&r!==(r=L[3]==1||L[3]==2)&&(a.required=r),M&2&&m!==(m=(((K=(y=L[1].conf)==null?void 0:y.connection)==null?void 0:K.psk)??"Password")+"")&&E(_,m),M&8&&g!==(g=L[3]==2)&&(b.required=g)},d(L){L&&(T(e),T(f),T(c))}}}function ef(t){let e,l,n,i,s,a,r,f;return r=new hu({}),{c(){e=p("br"),l=v(),n=p("div"),i=p("input"),s=v(),a=p("select"),Te(r.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=t[2],u(a,"name","su"),u(a,"class","in-l"),a.required=t[2],u(n,"class","flex")},m(c,m){P(c,e,m),P(c,l,m),P(c,n,m),o(n,i),o(n,s),o(n,a),Me(r,a,null),f=!0},p(c,m){(!f||m&4)&&(i.required=c[2]),(!f||m&4)&&(a.required=c[2])},i(c){f||(Z(r.$$.fragment,c),f=!0)},o(c){ie(r.$$.fragment,c),f=!1},d(c){c&&(T(e),T(l),T(n)),Ne(r)}}}function tf(t){var g,k,w,A;let e,l,n=(((k=(g=t[1].conf)==null?void 0:g.network)==null?void 0:k.gw)??"Gateway")+"",i,s,a,r,f,c,m=(((A=(w=t[1].conf)==null?void 0:w.network)==null?void 0:A.dns)??"DNS")+"",_,d,h,b;return{c(){e=p("div"),l=p("div"),i=C(n),s=p("br"),a=v(),r=p("input"),f=v(),c=p("div"),_=C(m),d=p("br"),h=v(),b=p("input"),u(r,"name","sg"),u(r,"type","text"),u(r,"class","in-f w-full"),u(b,"name","sd"),u(b,"type","text"),u(b,"class","in-l w-full"),u(e,"class","my-3 flex")},m(F,L){P(F,e,L),o(e,l),o(l,i),o(l,s),o(l,a),o(l,r),o(e,f),o(e,c),o(c,_),o(c,d),o(c,h),o(c,b)},p(F,L){var M,R,I,y;L&2&&n!==(n=(((R=(M=F[1].conf)==null?void 0:M.network)==null?void 0:R.gw)??"Gateway")+"")&&E(i,n),L&2&&m!==(m=(((y=(I=F[1].conf)==null?void 0:I.network)==null?void 0:y.dns)??"DNS")+"")&&E(_,m)},d(F){F&&T(e)}}}function Pc(t){var j,ne,fe,me,pe,de,Se,ge,Le,qe,Oe,re;let e,l,n,i,s,a,r=(((j=t[1].setup)==null?void 0:j.title)??"Setup")+"",f,c,m,_=(((fe=(ne=t[1].conf)==null?void 0:ne.connection)==null?void 0:fe.title)??"Connection")+"",d,h,b,g,k,w=(((pe=(me=t[1].conf)==null?void 0:me.connection)==null?void 0:pe.wifi)??"Connect to WiFi")+"",A,F,L=(((Se=(de=t[1].conf)==null?void 0:de.connection)==null?void 0:Se.ap)??"Standalone access point")+"",M,R,I,y,K=(((Le=(ge=t[1].conf)==null?void 0:ge.general)==null?void 0:Le.hostname)??"Hostname")+"",W,N,B,X,G,V,Y,U,z=(((qe=t[1].setup)==null?void 0:qe.static)??"Static IP")+"",se,le,Q,ee,ue,ae,x=(((Oe=t[1].btn)==null?void 0:Oe.save)??"Save")+"",_e,oe,J,$,he,ke,D=t[0].if&&t[0].if.eth&&$a(t),S=(t[3]==1||t[3]==2)&&xa(t),O=t[2]&&ef(t),q=t[2]&&tf(t);return J=new fl({props:{active:t[4],message:((re=t[1].setup)==null?void 0:re.mask)??"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),s=v(),a=p("strong"),f=C(r),c=v(),m=p("div"),d=C(_),h=p("br"),b=v(),g=p("select"),k=p("option"),A=C(w),F=p("option"),M=C(L),D&&D.c(),R=v(),S&&S.c(),I=v(),y=p("div"),W=C(K),N=v(),B=p("input"),X=v(),G=p("div"),V=p("label"),Y=p("input"),U=v(),se=C(z),le=v(),O&&O.c(),Q=v(),q&&q.c(),ee=v(),ue=p("div"),ae=p("button"),_e=C(x),oe=v(),Te(J.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(a,"class","text-sm"),k.__value=1,H(k,k.__value),F.__value=2,H(F,F.__value),u(g,"name","sc"),u(g,"class","in-s"),t[3]===void 0&&Bt(()=>t[6].call(g)),u(m,"class","my-3"),u(B,"name","sh"),u(B,"type","text"),u(B,"class","in-s"),u(B,"maxlength","32"),u(B,"pattern","[a-z0-9_-]+"),u(B,"placeholder","Optional, ex.: ams-reader"),u(B,"autocomplete","off"),u(Y,"type","checkbox"),u(Y,"name","sm"),Y.__value="static",H(Y,Y.__value),u(Y,"class","rounded mb-1"),u(G,"class","my-3"),u(ae,"type","submit"),u(ae,"class","btn-pri"),u(ue,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Ce,Be){P(Ce,e,Be),o(e,l),o(l,n),o(n,i),o(n,s),o(n,a),o(a,f),o(n,c),o(n,m),o(m,d),o(m,h),o(m,b),o(m,g),o(g,k),o(k,A),o(g,F),o(F,M),D&&D.m(g,null),Qe(g,t[3],!0),o(n,R),S&&S.m(n,null),o(n,I),o(n,y),o(y,W),o(y,N),o(y,B),H(B,t[0].hostname),o(n,X),o(n,G),o(G,V),o(V,Y),Y.checked=t[2],o(V,U),o(V,se),o(G,le),O&&O.m(G,null),o(n,Q),q&&q.m(n,null),o(n,ee),o(n,ue),o(ue,ae),o(ae,_e),P(Ce,oe,Be),Me(J,Ce,Be),$=!0,he||(ke=[ce(g,"change",t[6]),ce(B,"input",t[7]),ce(Y,"change",t[8]),ce(n,"submit",un(t[5]))],he=!0)},p(Ce,[Be]){var bt,Xe,et,pt,st,tt,gt,it,Dt,Ae,Pe,Fe;(!$||Be&2)&&r!==(r=(((bt=Ce[1].setup)==null?void 0:bt.title)??"Setup")+"")&&E(f,r),(!$||Be&2)&&_!==(_=(((et=(Xe=Ce[1].conf)==null?void 0:Xe.connection)==null?void 0:et.title)??"Connection")+"")&&E(d,_),(!$||Be&2)&&w!==(w=(((st=(pt=Ce[1].conf)==null?void 0:pt.connection)==null?void 0:st.wifi)??"Connect to WiFi")+"")&&E(A,w),(!$||Be&2)&&L!==(L=(((gt=(tt=Ce[1].conf)==null?void 0:tt.connection)==null?void 0:gt.ap)??"Standalone access point")+"")&&E(M,L),Ce[0].if&&Ce[0].if.eth?D?D.p(Ce,Be):(D=$a(Ce),D.c(),D.m(g,null)):D&&(D.d(1),D=null),Be&8&&Qe(g,Ce[3]),Ce[3]==1||Ce[3]==2?S?S.p(Ce,Be):(S=xa(Ce),S.c(),S.m(n,I)):S&&(S.d(1),S=null),(!$||Be&2)&&K!==(K=(((Dt=(it=Ce[1].conf)==null?void 0:it.general)==null?void 0:Dt.hostname)??"Hostname")+"")&&E(W,K),Be&1&&B.value!==Ce[0].hostname&&H(B,Ce[0].hostname),Be&4&&(Y.checked=Ce[2]),(!$||Be&2)&&z!==(z=(((Ae=Ce[1].setup)==null?void 0:Ae.static)??"Static IP")+"")&&E(se,z),Ce[2]?O?(O.p(Ce,Be),Be&4&&Z(O,1)):(O=ef(Ce),O.c(),Z(O,1),O.m(G,null)):O&&(ht(),ie(O,1,1,()=>{O=null}),vt()),Ce[2]?q?q.p(Ce,Be):(q=tf(Ce),q.c(),q.m(n,ee)):q&&(q.d(1),q=null),(!$||Be&2)&&x!==(x=(((Pe=Ce[1].btn)==null?void 0:Pe.save)??"Save")+"")&&E(_e,x);const Ze={};Be&16&&(Ze.active=Ce[4]),Be&2&&(Ze.message=((Fe=Ce[1].setup)==null?void 0:Fe.mask)??"Saving"),J.$set(Ze)},i(Ce){$||(Z(O),Z(J.$$.fragment,Ce),$=!0)},o(Ce){ie(O),ie(J.$$.fragment,Ce),$=!1},d(Ce){Ce&&(T(e),T(oe)),D&&D.d(),S&&S.d(),O&&O.d(),q&&q.d(),Ne(J,Ce),he=!1,Ut(ke)}}}function Ec(t,e,l){let n={};bl.subscribe(h=>{l(1,n=h)});let{sysinfo:i={}}=e,s=!1,a=1,r=!1;function f(h){rl.update(b=>(b.trying=h,b))}async function c(h){l(4,r=!0);const b=new FormData(h.target),g=new URLSearchParams;for(let A of b){const[F,L]=A;g.append(F,L)}let w=await(await fetch("save",{method:"POST",body:g})).json();l(4,r=!1),rl.update(A=>(A.hostname=b.get("sh"),A.usrcfg=w.success,A.booting=w.reboot,s&&(A.net.ip=b.get("si"),A.net.mask=b.get("su"),A.net.gw=b.get("sg"),A.net.dns1=b.get("sd")),w.reboot&&setTimeout(qn,5e3,i,f),A))}function m(){a=Qt(this),l(3,a)}function _(){i.hostname=this.value,l(0,i)}function d(){s=this.checked,l(2,s)}return t.$$set=h=>{"sysinfo"in h&&l(0,i=h.sysinfo)},[i,n,s,a,r,c,m,_,d]}class qc extends qt{constructor(e){super(),Et(this,e,Ec,Pc,Tt,{sysinfo:0})}}function Dc(t){var W,N,B,X;let e,l,n,i=(((W=t[2].upload)==null?void 0:W.title)??"Upload")+"",s,a,r,f,c,m=(((N=t[2].upload)==null?void 0:N.desc)??"")+"",_,d,h,b,g,k,w,A,F=(((B=t[2].btn)==null?void 0:B.upload)??"Upload")+"",L,M,R,I,y,K;return R=new fl({props:{active:t[3],message:((X=t[2].upload)==null?void 0:X.mask)??"Uploading"}}),{c(){e=p("div"),l=p("div"),n=p("strong"),s=C(i),a=v(),r=C(t[1]),f=v(),c=p("p"),_=C(m),d=v(),h=p("form"),b=p("input"),g=v(),k=p("div"),w=p("button"),A=p("p"),L=C(F),M=v(),Te(R.$$.fragment),u(c,"class","mb-4"),u(b,"name","file"),u(b,"type","file"),u(A,"class","mb-4"),u(w,"type","submit"),u(w,"class","btn-pri"),u(k,"class","w-full text-right mt-4"),u(h,"action",t[0]),u(h,"enctype","multipart/form-data"),u(h,"method","post"),u(h,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(G,V){P(G,e,V),o(e,l),o(l,n),o(n,s),o(n,a),o(n,r),o(l,f),o(l,c),o(c,_),o(l,d),o(l,h),o(h,b),o(h,g),o(h,k),o(k,w),o(w,A),o(A,L),P(G,M,V),Me(R,G,V),I=!0,y||(K=ce(h,"submit",t[4]),y=!0)},p(G,[V]){var U,z,se,le;(!I||V&4)&&i!==(i=(((U=G[2].upload)==null?void 0:U.title)??"Upload")+"")&&E(s,i),(!I||V&2)&&E(r,G[1]),(!I||V&4)&&m!==(m=(((z=G[2].upload)==null?void 0:z.desc)??"")+"")&&E(_,m),(!I||V&4)&&F!==(F=(((se=G[2].btn)==null?void 0:se.upload)??"Upload")+"")&&E(L,F),(!I||V&1)&&u(h,"action",G[0]);const Y={};V&8&&(Y.active=G[3]),V&4&&(Y.message=((le=G[2].upload)==null?void 0:le.mask)??"Uploading"),R.$set(Y)},i(G){I||(Z(R.$$.fragment,G),I=!0)},o(G){ie(R.$$.fragment,G),I=!1},d(G){G&&(T(e),T(M)),Ne(R,G),y=!1,K()}}}function Ac(t,e,l){let{action:n}=e,{title:i}=e,s={};bl.subscribe(f=>{l(2,s=f)});let a=!1;const r=()=>l(3,a=!0);return t.$$set=f=>{"action"in f&&l(0,n=f.action),"title"in f&&l(1,i=f.title)},[n,i,s,a,r]}class zi extends qt{constructor(e){super(),Et(this,e,Ac,Dc,Tt,{action:0,title:1})}}function Lc(t){var J,$,he,ke,D,S,O;let e,l,n,i,s=(((J=t[1].consent)==null?void 0:J.title)??"Consents")+"",a,r,f,c,m,_=((($=t[1].consent)==null?void 0:$.one_click)??"One-click")+"",d,h,b,g,k=(((he=t[1].consent)==null?void 0:he.read_more)??"Read more")+"",w,A,F,L,M,R,I,y=(((ke=t[1].consent)==null?void 0:ke.yes)??"Yes")+"",K,W,N,B,X,G,V=(((D=t[1].consent)==null?void 0:D.no)??"No")+"",Y,U,z,se,le,Q=(((S=t[1].btn)==null?void 0:S.save)??"Save")+"",ee,ue,ae,x,_e,oe;return ae=new fl({props:{active:t[2],message:((O=t[1].consent)==null?void 0:O.mask_saving)??"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("div"),a=C(s),r=v(),f=p("hr"),c=v(),m=p("div"),d=C(_),h=p("br"),b=v(),g=p("a"),w=C(k),A=p("br"),F=v(),L=p("label"),M=p("input"),I=v(),K=C(y),W=v(),N=p("label"),B=p("input"),G=v(),Y=C(V),U=p("br"),z=v(),se=p("div"),le=p("button"),ee=C(Q),ue=v(),Te(ae.$$.fragment),u(g,"href",_l("Data-collection-on-one-click-firmware-upgrade")),u(g,"target","_blank"),u(g,"class","text-blue-600 hover:text-blue-800"),u(M,"type","radio"),u(M,"name","sf"),M.value=1,M.checked=R=t[0].fwconsent===1,u(M,"class","rounded m-2"),M.required=!0,u(B,"type","radio"),u(B,"name","sf"),B.value=2,B.checked=X=t[0].fwconsent===2,u(B,"class","rounded m-2"),B.required=!0,u(m,"class","my-3"),u(le,"type","submit"),u(le,"class","btn-pri"),u(se,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(q,j){P(q,e,j),o(e,l),o(l,n),o(n,i),o(i,a),o(n,r),o(n,f),o(n,c),o(n,m),o(m,d),o(m,h),o(m,b),o(m,g),o(g,w),o(m,A),o(m,F),o(m,L),o(L,M),o(L,I),o(L,K),o(m,W),o(m,N),o(N,B),o(N,G),o(N,Y),o(m,U),o(n,z),o(n,se),o(se,le),o(le,ee),P(q,ue,j),Me(ae,q,j),x=!0,_e||(oe=ce(n,"submit",un(t[3])),_e=!0)},p(q,[j]){var fe,me,pe,de,Se,ge,Le;(!x||j&2)&&s!==(s=(((fe=q[1].consent)==null?void 0:fe.title)??"Consents")+"")&&E(a,s),(!x||j&2)&&_!==(_=(((me=q[1].consent)==null?void 0:me.one_click)??"One-click")+"")&&E(d,_),(!x||j&2)&&k!==(k=(((pe=q[1].consent)==null?void 0:pe.read_more)??"Read more")+"")&&E(w,k),(!x||j&1&&R!==(R=q[0].fwconsent===1))&&(M.checked=R),(!x||j&2)&&y!==(y=(((de=q[1].consent)==null?void 0:de.yes)??"Yes")+"")&&E(K,y),(!x||j&1&&X!==(X=q[0].fwconsent===2))&&(B.checked=X),(!x||j&2)&&V!==(V=(((Se=q[1].consent)==null?void 0:Se.no)??"No")+"")&&E(Y,V),(!x||j&2)&&Q!==(Q=(((ge=q[1].btn)==null?void 0:ge.save)??"Save")+"")&&E(ee,Q);const ne={};j&4&&(ne.active=q[2]),j&2&&(ne.message=((Le=q[1].consent)==null?void 0:Le.mask_saving)??"Saving"),ae.$set(ne)},i(q){x||(Z(ae.$$.fragment,q),x=!0)},o(q){ie(ae.$$.fragment,q),x=!1},d(q){q&&(T(e),T(ue)),Ne(ae,q),_e=!1,oe()}}}function Ic(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,s={};bl.subscribe(f=>{l(1,s=f)});let a=!1;async function r(f){l(2,a=!0);const c=new FormData(f.target),m=new URLSearchParams;for(let h of c){const[b,g]=h;m.append(b,g)}let d=await(await fetch("save",{method:"POST",body:m})).json();l(2,a=!1),rl.update(h=>(h.fwconsent=c.sf===!0?1:c.sf===!1?2:0,h.booting=d.reboot,h)),en(n)}return t.$$set=f=>{"basepath"in f&&l(4,n=f.basepath),"sysinfo"in f&&l(0,i=f.sysinfo)},[i,s,a,r,n]}class Oc extends qt{constructor(e){super(),Et(this,e,Ic,Lc,Tt,{basepath:4,sysinfo:0})}}function lf(t,e,l){const n=t.slice();return n[30]=e[l],n[31]=e,n[32]=l,n}function nf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Rc(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function sf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Fc(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function of(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function af(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function ff(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function uf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function rf(t){let e,l=kt(t[1].o),n=[];for(let i=0;i0?"text-green-600":"text-gray-300"),u(Ze,"class",Xe=t[32]{l(0,i=U)});let s=["mo","tu","we","th","fr","sa","su"],a={},r=!0,f=!1;du.subscribe(U=>{U.o&&(l(1,a=U),l(2,r=!1))}),M0();async function c(U){l(3,f=!0);const z=new URLSearchParams;z.append("r","true"),z.append("rc",a.o.length),a.o.forEach(function(le,Q){z.append("rt"+Q,le.t),z.append("rn"+Q,le.n),z.append("rd"+Q,le.d),z.append("ra"+Q,le.a),z.append("rh"+Q,le.h),z.append("rv"+Q,le.v),z.append("rsm"+Q,le.s.m),z.append("rsd"+Q,le.s.d),z.append("rem"+Q,le.e.m),z.append("red"+Q,le.e.d)}),await(await fetch("save",{method:"POST",body:z})).json(),l(3,f=!1),en(n+"configuration")}let m=function(U,z){return U.includes(z)?U=U.filter(function(se){return se!==z}):U.push(z),U},_=function(){let U=a.o;U.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}}),l(1,a.o=U,a)},d=function(U){let z=a.o;z.splice(U,1),l(1,a.o=z,a)},h=function(U){if(U<=0)return;let z=a.o;var se=z[U];z[U]=z[U-1],z[U-1]=se,l(1,a.o=z,a)},b=function(U){let z=a.o;if(!(U>=z.length-1)){var se=z[U];z[U]=z[U+1],z[U+1]=se,l(1,a.o=z,a)}};function g(U,z){U[z].n=this.value,l(1,a)}function k(U,z){U[z].d=Qt(this),l(1,a)}function w(U,z){U[z].t=Qt(this),l(1,a)}function A(U,z){U[z].v=He(this.value),l(1,a)}const F=(U,z,se,le)=>l(1,se[le].a=m(U.a,z),a),L=(U,z,se,le)=>l(1,se[le].h=m(U.h,z),a),M=(U,z,se,le)=>l(1,se[le].h=m(U.h,z+8),a),R=(U,z,se,le)=>l(1,se[le].h=m(U.h,z+16),a);function I(U,z){U[z].s.d=Qt(this),l(1,a)}function y(U,z){U[z].s.m=Qt(this),l(1,a)}function K(U,z){U[z].e.d=Qt(this),l(1,a)}function W(U,z){U[z].e.m=Qt(this),l(1,a)}const N=U=>h(U),B=U=>h(U),X=U=>b(U),G=U=>b(U),V=U=>d(U),Y=U=>d(U);return t.$$set=U=>{"basepath"in U&&l(11,n=U.basepath)},[i,a,r,f,s,c,m,_,d,h,b,n,g,k,w,A,F,L,M,R,I,y,K,W,N,B,X,G,V,Y]}class yc extends qt{constructor(e){super(),Et(this,e,Hc,jc,Tt,{basepath:11},null,[-1,-1])}}function bf(t,e,l){const n=t.slice();return n[13]=e[l],n[14]=e,n[15]=l,n}function gf(t,e,l){const n=t.slice();return n[13]=e[l],n[16]=e,n[17]=l,n}function kf(t){let e,l,n,i=kt(t[1]),s=[];for(let a=0;a{l(3,r=k)});let f=!1,c,m;async function _(){if(confirm("Clear all data?"))for(let k in i)(k.startsWith("i")||k.startsWith("e"))&&l(0,i[k]=0,i)}let d=!1;async function h(k){l(5,d=!0);const w=new FormData(k.target),A=new URLSearchParams;for(let L of w){const[M,R]=L;A.append(M,R)}await(await fetch(s,{method:"POST",body:A})).json(),l(5,d=!1),en(a)}function b(k){i[k.key]=He(this.value),l(0,i)}function g(k){i[k.key]=He(this.value),l(0,i)}return t.$$set=k=>{"prefix"in k&&l(8,n=k.prefix),"data"in k&&l(0,i=k.data),"url"in k&&l(9,s=k.url),"basepath"in k&&l(10,a=k.basepath)},t.$$.update=()=>{if(t.$$.dirty&263){l(1,c=[]),l(2,m=[]);for(let k in i){let w=[];k.startsWith("i")?w=c:k.startsWith("e")&&(w=m,i[k]&&l(4,f=!0)),w.push({key:k,name:n+" "+k.substring(1),value:i[k]})}}},[i,c,m,r,f,d,_,h,n,s,a,b,g]}class bu extends qt{constructor(e){super(),Et(this,e,Wc,zc,Tt,{prefix:8,data:0,url:9,basepath:10})}}function Gc(t){let e,l;return e=new C0({props:{data:t[7],sysinfo:t[6],prices:t[1],dayPlot:t[2],monthPlot:t[3],temperatures:t[4],translations:t[5],tariffData:t[8]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.data=n[7]),i&64&&(s.sysinfo=n[6]),i&2&&(s.prices=n[1]),i&4&&(s.dayPlot=n[2]),i&8&&(s.monthPlot=n[3]),i&16&&(s.temperatures=n[4]),i&32&&(s.translations=n[5]),i&256&&(s.tariffData=n[8]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Vc(t){let e,l;return e=new fc({props:{sysinfo:t[6],basepath:t[0],data:t[7]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.sysinfo=n[6]),i&1&&(s.basepath=n[0]),i&128&&(s.data=n[7]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Kc(t){let e,l;return e=new yc({props:{basepath:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Yc(t){let e,l;return e=new kc({props:{sysinfo:t[6],data:t[7]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.sysinfo=n[6]),i&128&&(s.data=n[7]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Qc(t){let e,l;return e=new zi({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:We,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Xc(t){let e,l;return e=new zi({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:We,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Zc(t){let e,l;return e=new zi({props:{title:"private key",action:"/mqtt-key"}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:We,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function Jc(t){let e,l;return e=new Oc({props:{sysinfo:t[6],basepath:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.sysinfo=n[6]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function $c(t){let e,l;return e=new qc({props:{sysinfo:t[6]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.sysinfo=n[6]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function xc(t){let e,l;return e=new Tc({props:{sysinfo:t[6],basepath:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.sysinfo=n[6]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function em(t){let e,l;return e=new bu({props:{prefix:"UTC Hour",data:t[2],url:"/dayplot",basepath:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&4&&(s.data=n[2]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function tm(t){let e,l;return e=new bu({props:{prefix:"Day",data:t[3],url:"/monthplot",basepath:t[0]}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&8&&(s.data=n[3]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function lm(t){let e,l,n,i,s,a,r,f,c,m,_,d,h,b,g,k,w,A,F,L,M,R,I,y,K,W;return e=new N1({props:{data:t[7],basepath:t[0]}}),n=new dl({props:{path:"/",$$slots:{default:[Gc]},$$scope:{ctx:t}}}),s=new dl({props:{path:"/configuration",$$slots:{default:[Vc]},$$scope:{ctx:t}}}),r=new dl({props:{path:"/priceconfig",$$slots:{default:[Kc]},$$scope:{ctx:t}}}),c=new dl({props:{path:"/status",$$slots:{default:[Yc]},$$scope:{ctx:t}}}),_=new dl({props:{path:"/mqtt-ca",$$slots:{default:[Qc]},$$scope:{ctx:t}}}),h=new dl({props:{path:"/mqtt-cert",$$slots:{default:[Xc]},$$scope:{ctx:t}}}),g=new dl({props:{path:"/mqtt-key",$$slots:{default:[Zc]},$$scope:{ctx:t}}}),w=new dl({props:{path:"/consent",$$slots:{default:[Jc]},$$scope:{ctx:t}}}),F=new dl({props:{path:"/setup",$$slots:{default:[$c]},$$scope:{ctx:t}}}),M=new dl({props:{path:"/vendor",$$slots:{default:[xc]},$$scope:{ctx:t}}}),I=new dl({props:{path:"/edit-day",$$slots:{default:[em]},$$scope:{ctx:t}}}),K=new dl({props:{path:"/edit-month",$$slots:{default:[tm]},$$scope:{ctx:t}}}),{c(){Te(e.$$.fragment),l=v(),Te(n.$$.fragment),i=v(),Te(s.$$.fragment),a=v(),Te(r.$$.fragment),f=v(),Te(c.$$.fragment),m=v(),Te(_.$$.fragment),d=v(),Te(h.$$.fragment),b=v(),Te(g.$$.fragment),k=v(),Te(w.$$.fragment),A=v(),Te(F.$$.fragment),L=v(),Te(M.$$.fragment),R=v(),Te(I.$$.fragment),y=v(),Te(K.$$.fragment)},m(N,B){Me(e,N,B),P(N,l,B),Me(n,N,B),P(N,i,B),Me(s,N,B),P(N,a,B),Me(r,N,B),P(N,f,B),Me(c,N,B),P(N,m,B),Me(_,N,B),P(N,d,B),Me(h,N,B),P(N,b,B),Me(g,N,B),P(N,k,B),Me(w,N,B),P(N,A,B),Me(F,N,B),P(N,L,B),Me(M,N,B),P(N,R,B),Me(I,N,B),P(N,y,B),Me(K,N,B),W=!0},p(N,B){const X={};B&128&&(X.data=N[7]),B&1&&(X.basepath=N[0]),e.$set(X);const G={};B&1022&&(G.$$scope={dirty:B,ctx:N}),n.$set(G);const V={};B&705&&(V.$$scope={dirty:B,ctx:N}),s.$set(V);const Y={};B&513&&(Y.$$scope={dirty:B,ctx:N}),r.$set(Y);const U={};B&704&&(U.$$scope={dirty:B,ctx:N}),c.$set(U);const z={};B&512&&(z.$$scope={dirty:B,ctx:N}),_.$set(z);const se={};B&512&&(se.$$scope={dirty:B,ctx:N}),h.$set(se);const le={};B&512&&(le.$$scope={dirty:B,ctx:N}),g.$set(le);const Q={};B&577&&(Q.$$scope={dirty:B,ctx:N}),w.$set(Q);const ee={};B&576&&(ee.$$scope={dirty:B,ctx:N}),F.$set(ee);const ue={};B&577&&(ue.$$scope={dirty:B,ctx:N}),M.$set(ue);const ae={};B&517&&(ae.$$scope={dirty:B,ctx:N}),I.$set(ae);const x={};B&521&&(x.$$scope={dirty:B,ctx:N}),K.$set(x)},i(N){W||(Z(e.$$.fragment,N),Z(n.$$.fragment,N),Z(s.$$.fragment,N),Z(r.$$.fragment,N),Z(c.$$.fragment,N),Z(_.$$.fragment,N),Z(h.$$.fragment,N),Z(g.$$.fragment,N),Z(w.$$.fragment,N),Z(F.$$.fragment,N),Z(M.$$.fragment,N),Z(I.$$.fragment,N),Z(K.$$.fragment,N),W=!0)},o(N){ie(e.$$.fragment,N),ie(n.$$.fragment,N),ie(s.$$.fragment,N),ie(r.$$.fragment,N),ie(c.$$.fragment,N),ie(_.$$.fragment,N),ie(h.$$.fragment,N),ie(g.$$.fragment,N),ie(w.$$.fragment,N),ie(F.$$.fragment,N),ie(M.$$.fragment,N),ie(I.$$.fragment,N),ie(K.$$.fragment,N),W=!1},d(N){N&&(T(l),T(i),T(a),T(f),T(m),T(d),T(b),T(k),T(A),T(L),T(R),T(y)),Ne(e,N),Ne(n,N),Ne(s,N),Ne(r,N),Ne(c,N),Ne(_,N),Ne(h,N),Ne(g,N),Ne(w,N),Ne(F,N),Ne(M,N),Ne(I,N),Ne(K,N)}}}function nm(t){let e,l,n,i;const s=[om,sm],a=[];function r(f,c){return f[6].trying?0:1}return e=r(t),l=a[e]=s[e](t),{c(){l.c(),n=Jt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(ht(),ie(a[m],1,1,()=>{a[m]=null}),vt(),l=a[e],l?l.p(f,c):(l=a[e]=s[e](f),l.c()),Z(l,1),l.m(n.parentNode,n))},i(f){i||(Z(l),i=!0)},o(f){ie(l),i=!1},d(f){f&&T(n),a[e].d(f)}}}function im(t){let e,l;return e=new fl({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:We,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function sm(t){let e,l;return e=new fl({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p:We,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function om(t){let e,l;return e=new fl({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[6].trying}}),{c(){Te(e.$$.fragment)},m(n,i){Me(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.message="Device is booting, please wait. Trying to reach it on "+n[6].trying),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Ne(e,n)}}}function am(t){let e,l,n,i,s,a;l=new Zf({props:{basepath:t[0],$$slots:{default:[lm]},$$scope:{ctx:t}}});const r=[im,nm],f=[];function c(m,_){return m[6].upgrading?0:m[6].booting?1:-1}return~(i=c(t))&&(s=f[i]=r[i](t)),{c(){e=p("div"),Te(l.$$.fragment),n=v(),s&&s.c(),u(e,"class","container mx-auto m-3")},m(m,_){P(m,e,_),Me(l,e,null),o(e,n),~i&&f[i].m(e,null),a=!0},p(m,[_]){const d={};_&1&&(d.basepath=m[0]),_&1023&&(d.$$scope={dirty:_,ctx:m}),l.$set(d);let h=i;i=c(m),i===h?~i&&f[i].p(m,_):(s&&(ht(),ie(f[h],1,1,()=>{f[h]=null}),vt()),~i?(s=f[i],s?s.p(m,_):(s=f[i]=r[i](m),s.c()),Z(s,1),s.m(e,null)):s=null)},i(m){a||(Z(l.$$.fragment,m),Z(s),a=!0)},o(m){ie(l.$$.fragment,m),ie(s),a=!1},d(m){m&&T(e),Ne(l),~i&&f[i].d()}}}function fm(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i;Bi.subscribe(d=>{l(1,i=d)});let s;iu.subscribe(d=>{l(2,s=d)});let a;su.subscribe(d=>{l(3,a=d)});let r;ou.subscribe(d=>{l(4,r=d)});let f={};bl.subscribe(d=>{l(5,f=d)});let c={};rl.subscribe(d=>{var h;l(6,c=d),c.vndcfg===!1?en(n+"vendor"):c.usrcfg===!1?en(n+"setup"):c.fwconsent===0&&en(n+"consent"),c.ui.k===1?document.documentElement.classList.add("dark"):c.ui.k===0?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),c.ui.lang&&c.ui.lang!=((h=f==null?void 0:f.language)==null?void 0:h.code)&&uu(c.ui.lang)});let m={};Yr.subscribe(d=>{l(7,m=d),m0(d)});let _={};return fu.subscribe(d=>{l(8,_=d)}),au(),[n,i,s,a,r,f,c,m,_]}class um extends qt{constructor(e){super(),Et(this,e,fm,am,Tt,{})}}new um({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte index 86e6aa39..2836a828 100644 --- a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte +++ b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte @@ -605,8 +605,8 @@ - - + + +
+ {translations.conf?.mqtt?.timeout ?? "Timeout"} + {translations.conf?.mqtt?.keepalive ?? "Keep-alive"} +
+ + +
+
{/if} {#if configuration?.q?.m == 3} diff --git a/lib/SvelteUi/json/conf_mqtt.json b/lib/SvelteUi/json/conf_mqtt.json index 62a868fe..a77a3427 100644 --- a/lib/SvelteUi/json/conf_mqtt.json +++ b/lib/SvelteUi/json/conf_mqtt.json @@ -13,5 +13,7 @@ "k": %s }, "t": %d, - "d": %d + "d": %d, + "i": %d, + "k": %d }, diff --git a/lib/SvelteUi/src/AmsWebServer.cpp b/lib/SvelteUi/src/AmsWebServer.cpp index f81574b7..88fbafc1 100644 --- a/lib/SvelteUi/src/AmsWebServer.cpp +++ b/lib/SvelteUi/src/AmsWebServer.cpp @@ -972,7 +972,9 @@ void AmsWebServer::configurationJson() { qsr ? "true" : "false", qsk ? "true" : "false", mqttConfig.stateUpdate, - mqttConfig.stateUpdateInterval + mqttConfig.stateUpdateInterval, + mqttConfig.timeout, + mqttConfig.keepalive ); server.sendContent(buf); @@ -1389,6 +1391,8 @@ void AmsWebServer::handleSave() { mqtt.stateUpdate = server.arg(F("qt")).toInt() == 1; mqtt.stateUpdateInterval = server.arg(F("qd")).toInt(); + mqtt.timeout = server.arg(F("qi")).toInt(); + mqtt.keepalive = server.arg(F("qk")).toInt(); } else { config->clearMqtt(mqtt); }