diff --git a/lib/PriceService/include/PriceService.h b/lib/PriceService/include/PriceService.h index af0eac0c..94f60bbb 100644 --- a/lib/PriceService/include/PriceService.h +++ b/lib/PriceService/include/PriceService.h @@ -47,13 +47,17 @@ struct PriceConfig { uint8_t days; uint32_t hours; uint8_t type; - uint16_t value; + uint32_t value; + uint8_t start_month; + uint8_t start_dayofmonth; + uint8_t end_month; + uint8_t end_dayofmonth; }; struct PricePart { char name[32]; char description[32]; - uint16_t value; + uint32_t value; }; class PriceService { diff --git a/lib/PriceService/src/PriceService.cpp b/lib/PriceService/src/PriceService.cpp index 59520b35..821622b4 100644 --- a/lib/PriceService/src/PriceService.cpp +++ b/lib/PriceService/src/PriceService.cpp @@ -12,6 +12,7 @@ #include "FirmwareVersion.h" #include #include "AmsStorage.h" +#include "hexutils.h" #include "GcmParser.h" @@ -112,13 +113,18 @@ float PriceService::getValueForHour(uint8_t direction, time_t ts, int8_t hour) { for (uint8_t i = 0; i < priceConfig.size(); i++) { PriceConfig pc = priceConfig.at(i); if(pc.type == PRICE_TYPE_FIXED) continue; - if((pc.direction & direction) == direction && (pc.days & day) == day && (pc.hours & hrs) == hrs) { + uint8_t start_month = pc.start_month == 0 || pc.start_month > 12 ? 1 : pc.start_month; + uint8_t start_dayofmonth = pc.start_dayofmonth == 0 || pc.start_dayofmonth > 31 ? 1 : pc.start_dayofmonth; + uint8_t end_month = pc.end_month == 0 || pc.end_month > 12 ? 1 : pc.end_month; + uint8_t end_dayofmonth = pc.end_dayofmonth == 0 || pc.end_dayofmonth > 31 ? 1 : pc.end_dayofmonth; + + if((pc.direction & direction) == direction && (pc.days & day) == day && (pc.hours & hrs) == hrs && tm.Month >= start_month && tm.Day >= start_dayofmonth && tm.Month <= end_month && tm.Day <= end_dayofmonth) { switch(pc.type) { case PRICE_TYPE_ADD: ret += pc.value / 10000.0; break; case PRICE_TYPE_PCT: - ret += ((pc.value / 100.0) * ret) / 100.0; + ret += ((pc.value / 10000.0) * ret) / 100.0; break; } } @@ -135,13 +141,17 @@ float PriceService::getEnergyPriceForHour(uint8_t direction, time_t ts, int8_t h float value = PRICE_NO_VALUE; for (uint8_t i = 0; i < priceConfig.size(); i++) { PriceConfig pc = priceConfig.at(i); - if((pc.direction & direction) == direction && (pc.days & day) == day && (pc.hours & hrs) == hrs) { - if(pc.type == PRICE_TYPE_FIXED) { - if(value == PRICE_NO_VALUE) { - value = pc.value / 10000.0; - } else { - value += pc.value / 10000.0; - } + if(pc.type != PRICE_TYPE_FIXED) continue; + uint8_t start_month = pc.start_month == 0 || pc.start_month > 12 ? 1 : pc.start_month; + uint8_t start_dayofmonth = pc.start_dayofmonth == 0 || pc.start_dayofmonth > 31 ? 1 : pc.start_dayofmonth; + uint8_t end_month = pc.end_month == 0 || pc.end_month > 12 ? 1 : pc.end_month; + uint8_t end_dayofmonth = pc.end_dayofmonth == 0 || pc.end_dayofmonth > 31 ? 1 : pc.end_dayofmonth; + + if((pc.direction & direction) == direction && (pc.days & day) == day && (pc.hours & hrs) == hrs && tm.Month >= start_month && tm.Day >= start_dayofmonth && tm.Month <= end_month && tm.Day <= end_dayofmonth) { + if(value == PRICE_NO_VALUE) { + value = pc.value / 10000.0; + } else { + value += pc.value / 10000.0; } } } @@ -526,6 +536,8 @@ std::vector& PriceService::getPriceConfig() { } void PriceService::setPriceConfig(uint8_t index, PriceConfig &priceConfig) { + stripNonAscii((uint8_t*) priceConfig.name, 32); + if(this->priceConfig.capacity() != index+1) this->priceConfig.resize(index+1); if(this->priceConfig.size() > index) diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index 9be02df7..a7025745 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,14 +1,14 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function pe(){}function rl(t,e){for(const l in e)t[l]=e[l];return t}function _c(t){return t()}function ka(){return Object.create(null)}function Ge(t){t.forEach(_c)}function uo(t){return typeof t=="function"}function Ee(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let us;function ps(t,e){return us||(us=document.createElement("a")),us.href=e,t===us.href}function m1(t){return Object.keys(t).length===0}function fo(t,...e){if(t==null)return pe;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ni(t){let e;return fo(t,l=>e=l)(),e}function hl(t,e,l){t.$$.on_destroy.push(fo(e,l))}function co(t,e,l,n){if(t){const i=pc(t,e,l,n);return t[0](i)}}function pc(t,e,l,n){return t[1]&&n?rl(l.ctx.slice(),t[1](n(e))):l.ctx}function mo(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],u=Math.max(e.dirty.length,i.length);for(let c=0;c32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function Ci(t){return function(e){return e.preventDefault(),t.call(this,e)}}function r(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const p1=["width","height"];function ii(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&&p1.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function ge(t){return t===""?null:+t}function d1(t){return Array.from(t.childNodes)}function J(t,e){e=""+e,t.data!==e&&(t.data=e)}function h1(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function v1(t,e,l){~_1.indexOf(l)?h1(t,e):J(t,e)}function oe(t,e){t.value=e==null?"":e}function ho(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Me(t,e,l){for(let n=0;n{u.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=ee(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),S(n)}}function g1(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function wa(t,e){return new t(e)}let yi;function ki(t){yi=t}function Si(){if(!yi)throw new Error("Function called outside component initialization");return yi}function dc(t){Si().$$.on_mount.push(t)}function k1(t){Si().$$.on_destroy.push(t)}function w1(){const t=Si();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=g1(e,l,{cancelable:n});return i.slice().forEach(u=>{u.call(t,o)}),!o.defaultPrevented}return!0}}function wi(t,e){return Si().$$.context.set(t,e),e}function jl(t){return Si().$$.context.get(t)}const ei=[],vs=[];let ti=[];const ya=[],hc=Promise.resolve();let Ys=!1;function vc(){Ys||(Ys=!0,hc.then(bc))}function y1(){return vc(),hc}function ze(t){ti.push(t)}const Hs=new Set;let Jn=0;function bc(){if(Jn!==0)return;const t=yi;do{try{for(;Jnt.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),ti=e}const _s=new Set;let on;function Ae(){on={r:0,c:[],p:on}}function Pe(){on.r||Ge(on.c),on=on.p}function I(t,e){t&&t.i&&(_s.delete(t),t.i(e))}function q(t,e,l,n){if(t&&t.o){if(_s.has(t))return;_s.add(t),on.c.push(()=>{_s.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function gc(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const u=t[o],c=e[o];if(c){for(const a in u)a in c||(n[a]=1);for(const a in c)i[a]||(l[a]=c[a],i[a]=1);t[o]=c}else for(const a in u)i[a]=1}for(const u in n)u in l||(l[u]=void 0);return l}function Ca(t){return typeof t=="object"&&t!==null?t:{}}function se(t){t&&t.c()}function ne(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||ze(()=>{const u=t.$$.on_mount.map(_c).filter(uo);t.$$.on_destroy?t.$$.on_destroy.push(...u):Ge(u),t.$$.on_mount=[]}),o.forEach(ze)}function ie(t,e){const l=t.$$;l.fragment!==null&&(S1(l.after_update),Ge(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function M1(t,e){t.$$.dirty[0]===-1&&(ei.push(t),vc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=h.length?h[0]:v;return f.ctx&&i(f.ctx[_],f.ctx[_]=d)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](d),p&&M1(t,_)),v}):[],f.update(),p=!0,Ge(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const _=d1(e.target);f.fragment&&f.fragment.l(_),_.forEach(S)}else f.fragment&&f.fragment.c();e.intro&&I(t.$$.fragment),ne(t,e.target,e.anchor,e.customElement),bc()}ki(a)}class Re{$destroy(){ie(this,1),this.$destroy=pe}$on(e,l){if(!uo(l))return pe;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&&!m1(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Sa=t=>typeof t>"u",kc=t=>typeof t=="function",wc=t=>typeof t=="number";function T1(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function yc(){let t=0;return()=>t++}function $1(){return Math.random().toString(36).substring(2)}const Hl=typeof window>"u";function Cc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Sc=(t,e)=>t?{}:{style:e},Qs=t=>({"aria-hidden":"true",...Sc(t,"display:none;")}),xn=[];function Mc(t,e){return{subscribe:it(t,e).subscribe}}function it(t,e=pe){let l;const n=new Set;function i(c){if(Ee(t,c)&&(t=c,l)){const a=!xn.length;for(const f of n)f[1](),xn.push(f,t);if(a){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:u}}function N1(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return Mc(l,u=>{let c=!1;const a=[];let f=0,p=pe;const _=()=>{if(f)return;p();const h=e(n?a[0]:a,u);o?u(h):p=uo(h)?h:pe},v=i.map((h,d)=>fo(h,g=>{a[d]=g,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,Xs=Mi("LOCATION"),si=Mi("ROUTER"),Tc=Mi("ROUTE"),E1=Mi("ROUTE_PARAMS"),A1=Mi("FOCUS_ELEM"),$c=/^:(.+)/,vi=(t,e,l)=>t.substr(e,l),Zs=(t,e)=>vi(t,0,e.length)===e,P1=t=>t==="",D1=t=>$c.test(t),Nc=t=>t[0]==="*",L1=t=>t.replace(/\*.*$/,""),Ec=t=>t.replace(/(^\/+|\/+$)/g,"");function bl(t,e=!1){const l=Ec(t).split("/");return e?l.filter(Boolean):l}const Ws=(t,e)=>t+(e?`?${e}`:""),bo=t=>`/${Ec(t)}`;function Ti(...t){const e=n=>bl(n,!0).join("/"),l=t.map(e).join("/");return bo(l)}const go=1,ws=2,mn=3,R1=4,Ac=5,I1=6,Pc=7,O1=8,F1=9,Dc=10,Lc=11,B1={[go]:"Link",[ws]:"Route",[mn]:"Router",[R1]:"useFocus",[Ac]:"useLocation",[I1]:"useMatch",[Pc]:"useNavigate",[O1]:"useParams",[F1]:"useResolvable",[Dc]:"useResolve",[Lc]:"navigate"},ko=t=>B1[t];function q1(t,e){let l;return t===ws?l=e.path?`path="${e.path}"`:"default":t===go?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${ko(t)} ${l||""} />`}function U1(t,e,l,n){const i=l&&q1(n||t,l),o=i?` +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function he(){}function fl(t,e){for(const l in e)t[l]=e[l];return t}function gc(t){return t()}function kr(){return Object.create(null)}function lt(t){t.forEach(gc)}function fo(t){return typeof t=="function"}function Ie(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let cs;function hs(t,e){return cs||(cs=document.createElement("a")),cs.href=e,t===cs.href}function b1(t){return Object.keys(t).length===0}function co(t,...e){if(t==null)return he;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ni(t){let e;return co(t,l=>e=l)(),e}function gl(t,e,l){t.$$.on_destroy.push(co(e,l))}function mo(t,e,l,n){if(t){const i=kc(t,e,l,n);return t[0](i)}}function kc(t,e,l,n){return t[1]&&n?fl(l.ctx.slice(),t[1](n(e))):l.ctx}function _o(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],u=Math.max(e.dirty.length,i.length);for(let m=0;m32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function Mi(t){return function(e){return e.preventDefault(),t.call(this,e)}}function a(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const k1=["width","height"];function ii(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&&k1.indexOf(n)===-1?t[n]=e[n]:a(t,n,e[n])}function ye(t){return t===""?null:+t}function w1(t){return Array.from(t.childNodes)}function Z(t,e){e=""+e,t.data!==e&&(t.data=e)}function y1(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function C1(t,e,l){~g1.indexOf(l)?y1(t,e):Z(t,e)}function ue(t,e){t.value=e==null?"":e}function ki(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Ce(t,e,l){for(let n=0;n{u.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=X(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),C(n)}}function M1(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function wr(t,e){return new t(e)}let Ci;function wi(t){Ci=t}function Ti(){if(!Ci)throw new Error("Function called outside component initialization");return Ci}function wc(t){Ti().$$.on_mount.push(t)}function T1(t){Ti().$$.on_destroy.push(t)}function $1(){const t=Ti();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=M1(e,l,{cancelable:n});return i.slice().forEach(u=>{u.call(t,o)}),!o.defaultPrevented}return!0}}function yi(t,e){return Ti().$$.context.set(t,e),e}function jl(t){return Ti().$$.context.get(t)}const ei=[],gs=[];let ti=[];const yr=[],yc=Promise.resolve();let Xs=!1;function Cc(){Xs||(Xs=!0,yc.then(Sc))}function N1(){return Cc(),yc}function Xe(t){ti.push(t)}const zs=new Set;let Jn=0;function Sc(){if(Jn!==0)return;const t=Ci;do{try{for(;Jnt.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),ti=e}const ds=new Set;let on;function Fe(){on={r:0,c:[],p:on}}function Be(){on.r||lt(on.c),on=on.p}function L(t,e){t&&t.i&&(ds.delete(t),t.i(e))}function U(t,e,l,n){if(t&&t.o){if(ds.has(t))return;ds.add(t),on.c.push(()=>{ds.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function Mc(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const u=t[o],m=e[o];if(m){for(const r in u)r in m||(n[r]=1);for(const r in m)i[r]||(l[r]=m[r],i[r]=1);t[o]=m}else for(const r in u)i[r]=1}for(const u in n)u in l||(l[u]=void 0);return l}function Cr(t){return typeof t=="object"&&t!==null?t:{}}function ae(t){t&&t.c()}function se(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||Xe(()=>{const u=t.$$.on_mount.map(gc).filter(fo);t.$$.on_destroy?t.$$.on_destroy.push(...u):lt(u),t.$$.on_mount=[]}),o.forEach(Xe)}function oe(t,e){const l=t.$$;l.fragment!==null&&(A1(l.after_update),lt(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function P1(t,e){t.$$.dirty[0]===-1&&(ei.push(t),Cc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=h.length?h[0]:v;return f.ctx&&i(f.ctx[_],f.ctx[_]=d)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](d),p&&P1(t,_)),v}):[],f.update(),p=!0,lt(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const _=w1(e.target);f.fragment&&f.fragment.l(_),_.forEach(C)}else f.fragment&&f.fragment.c();e.intro&&L(t.$$.fragment),se(t,e.target,e.anchor,e.customElement),Sc()}wi(r)}class je{$destroy(){oe(this,1),this.$destroy=he}$on(e,l){if(!fo(l))return he;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&&!b1(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Sr=t=>typeof t>"u",Tc=t=>typeof t=="function",$c=t=>typeof t=="number";function D1(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Nc(){let t=0;return()=>t++}function L1(){return Math.random().toString(36).substring(2)}const Hl=typeof window>"u";function Ec(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Ac=(t,e)=>t?{}:{style:e},Zs=t=>({"aria-hidden":"true",...Ac(t,"display:none;")}),xn=[];function Pc(t,e){return{subscribe:pt(t,e).subscribe}}function pt(t,e=he){let l;const n=new Set;function i(m){if(Ie(t,m)&&(t=m,l)){const r=!xn.length;for(const f of n)f[1](),xn.push(f,t);if(r){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:u}}function R1(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return Pc(l,u=>{let m=!1;const r=[];let f=0,p=he;const _=()=>{if(f)return;p();const h=e(n?r[0]:r,u);o?u(h):p=fo(h)?h:he},v=i.map((h,d)=>co(h,g=>{r[d]=g,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,Js=$i("LOCATION"),si=$i("ROUTER"),Dc=$i("ROUTE"),I1=$i("ROUTE_PARAMS"),O1=$i("FOCUS_ELEM"),Lc=/^:(.+)/,vi=(t,e,l)=>t.substr(e,l),xs=(t,e)=>vi(t,0,e.length)===e,F1=t=>t==="",B1=t=>Lc.test(t),Rc=t=>t[0]==="*",q1=t=>t.replace(/\*.*$/,""),Ic=t=>t.replace(/(^\/+|\/+$)/g,"");function wl(t,e=!1){const l=Ic(t).split("/");return e?l.filter(Boolean):l}const Gs=(t,e)=>t+(e?`?${e}`:""),bo=t=>`/${Ic(t)}`;function Ni(...t){const e=n=>wl(n,!0).join("/"),l=t.map(e).join("/");return bo(l)}const go=1,Cs=2,mn=3,U1=4,Oc=5,j1=6,Fc=7,H1=8,W1=9,Bc=10,qc=11,z1={[go]:"Link",[Cs]:"Route",[mn]:"Router",[U1]:"useFocus",[Oc]:"useLocation",[j1]:"useMatch",[Fc]:"useNavigate",[H1]:"useParams",[W1]:"useResolvable",[Bc]:"useResolve",[qc]:"navigate"},ko=t=>z1[t];function G1(t,e){let l;return t===Cs?l=e.path?`path="${e.path}"`:"default":t===go?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${ko(t)} ${l||""} />`}function V1(t,e,l,n){const i=l&&G1(n||t,l),o=i?` -Occurred in: ${i}`:"",u=ko(t),c=kc(e)?e(u):e;return`<${u}> ${c}${o}`}const Rc=t=>(...e)=>t(U1(...e)),Ic=Rc(t=>{throw new Error(t)}),bs=Rc(console.warn),Ma=4,j1=3,H1=2,W1=1,z1=1;function G1(t,e){const l=t.default?0:bl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Ma,P1(i)?o+=z1:D1(i)?o+=H1:Nc(i)?o-=Ma+W1:o+=j1,o},0);return{route:t,score:l,index:e}}function V1(t){return t.map(G1).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Oc(t,e){let l,n;const[i]=e.split("?"),o=bl(i),u=o[0]==="",c=V1(t);for(let a=0,f=c.length;a({...p,params:v,uri:D});if(p.default){n=h(e);continue}const d=bl(p.fullPath),g=Math.max(o.length,d.length);let w=0;for(;w{f===".."?a.pop():f!=="."&&a.push(f)}),Ws(`/${a.join("/")}`,n)}function Ta(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,u=bl(e,!0),c=bl(l,!0);for(;u.length;)u[0]!==c[0]&&Ic(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),c.shift();return{pathname:Ti(...c),hash:n,search:i,state:o}}const $a=t=>t.length===1?"":t,wo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?$a(vi(t,l)):"",u=i?vi(t,0,l):t,c=n?$a(vi(u,e)):"";return{pathname:(n?vi(u,0,e):u)||"/",search:c,hash:o}},Y1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function Q1(t,e,l){return Ti(l,K1(t,e))}function X1(t,e){const l=bo(L1(t)),n=bl(l,!0),i=bl(e,!0).slice(0,n.length),o=Fc({fullPath:l},Ti(...i));return o&&o.uri}const zs="POP",Z1="PUSH",J1="REPLACE";function Gs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function x1(t){let e=[],l=Gs(t),n=zs;const i=(o=e)=>o.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const u=()=>{l=Gs(t),n=zs,i([o])};i([o]);const c=Cc(t,"popstate",u);return()=>{c(),e=e.filter(a=>a!==o)}},navigate(o,u){const{state:c={},replace:a=!1}=u||{};if(n=a?J1:Z1,wc(o))u&&bs(Lc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=zs,t.history.go(o);else{const f={...c,_key:$1()};try{t.history[a?"replaceState":"pushState"](f,"",o)}catch{t.location[a?"replace":"assign"](o)}}l=Gs(t),i()}}}function Vs(t,e){return{...wo(e),state:t}}function e0(t="/"){let e=0,l=[Vs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Vs(n,o))},replaceState(n,i,o){l[e]=Vs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const t0=!!(!Hl&&window.document&&window.document.createElement),l0=!Hl&&window.location.origin==="null",Bc=x1(t0&&!l0?window:e0()),{navigate:cn}=Bc;let Tl=null,qc=!0;function n0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nTl.level||t.level===Tl.level&&n0(t.routerId,Tl.routerId))&&(Tl=t)}function s0(){Tl=null}function o0(){qc=!1}function Na(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Cc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function r0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function a0(t){return/^H[1-6]$/i.test(t.tagName)}function Ea(t,e=document){return e.querySelector(t)}function u0(t){let l=Ea(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!r0(l,t);){if(a0(l))return l;const n=Ea("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function f0(t){Promise.resolve(ni(t.focusElement)).then(e=>{const l=e||u0(t.id);l||bs(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,ws),!Na(l)&&Na(document.documentElement)})}const c0=(t,e,l)=>(n,i)=>y1().then(()=>{if(!Tl||qc){o0();return}if(n&&f0(Tl.route),t.announcements&&i){const{path:o,fullPath:u,meta:c,params:a,uri:f}=Tl.route,p=t.createAnnouncement({path:o,fullPath:u,meta:c,params:a,uri:f},ni(l));Promise.resolve(p).then(_=>{e.set(_)})}s0()}),m0="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 _0(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Sc(t[6],m0)],i={};for(let o=0;o`Navigated to ${re.uri}`,announcements:!0,...d},D=p,T=bo(p),E=jl(Xs),F=jl(si),O=!E,R=d0(),y=h&&!(F&&!F.manageFocus),A=it("");hl(t,A,re=>l(0,c=re));const te=F?F.disableInlineStyles:g,W=it([]);hl(t,W,re=>l(20,u=re));const j=it(null);hl(t,j,re=>l(18,i=re));let U=!1;const K=O?0:F.level+1,G=O?it((()=>Ta(Hl?wo(_):v.location,T))()):E;hl(t,G,re=>l(17,n=re));const Z=it(n);hl(t,Z,re=>l(19,o=re));const V=c0(w,A,G),H=re=>Q=>Q.filter(z=>z.id!==re);function x(re){if(Hl){if(U)return;const Q=Fc(re,n.pathname);if(Q)return U=!0,Q}else W.update(Q=>{const z=H(re.id)(Q);return z.push(re),z})}function ue(re){W.update(H(re))}return!O&&p!==Aa&&bs(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),O&&(dc(()=>v.listen(Q=>{const z=Ta(Q.location,T);Z.set(n),G.set(z)})),wi(Xs,G)),wi(si,{activeRoute:j,registerRoute:x,unregisterRoute:ue,manageFocus:y,level:K,id:R,history:O?v:F.history,basepath:O?T:F.basepath,disableInlineStyles:te}),t.$$set=re=>{"basepath"in re&&l(11,p=re.basepath),"url"in re&&l(12,_=re.url),"history"in re&&l(13,v=re.history),"primary"in re&&l(14,h=re.primary),"a11y"in re&&l(15,d=re.a11y),"disableInlineStyles"in re&&l(16,g=re.disableInlineStyles),"$$scope"in re&&l(21,f=re.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==D&&bs(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const re=Oc(u,n.pathname);j.set(re)}if(t.$$.dirty[0]&655360&&O){const re=!!n.hash,Q=!re&&y,z=!re||n.pathname!==o.pathname;V(Q,z)}t.$$.dirty[0]&262144&&y&&i&&i.primary&&i0({level:K,routerId:R,route:i})},[c,w,O,R,y,A,te,W,j,G,Z,p,_,v,h,d,g,n,i,o,u,f,a]}class v0 extends Re{constructor(e){super(),Le(this,e,h0,p0,Ee,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Uc=v0;function $i(t,e,l=si,n=mn){jl(l)||Ic(t,o=>`You cannot use ${o} outside of a ${ko(n)}.`,e)}const b0=t=>{const{subscribe:e}=jl(t);return{subscribe:e}};function jc(){return $i(Ac),b0(Xs)}function Hc(){const{history:t}=jl(si);return t}function Wc(){const t=jl(Tc);return t?N1(t,e=>e.base):it("/")}function zc(){$i(Dc);const t=Wc(),{basepath:e}=jl(si);return n=>Q1(n,ni(t),e)}function g0(){$i(Pc);const t=zc(),{navigate:e}=Hc();return(n,i)=>{const o=wc(n)?n:t(n);return e(o,i)}}const k0=t=>({params:t&16,location:t&8}),Pa=t=>({params:Hl?ni(t[10]):t[4],location:t[3],navigate:t[11]});function Da(t){let e,l;return e=new Uc({props:{primary:t[1],$$slots:{default:[C0]},$$scope:{ctx:t}}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function w0(t){let e;const l=t[18].default,n=co(l,t,t[19],Pa);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&_o(n,l,i,i[19],e?mo(l,i[19],o,k0):po(i[19]),Pa)},i(i){e||(I(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function y0(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Hl?ni(t[10]):t[4],t[12]];var o=t[0];function u(c){let a={};for(let f=0;f{ie(p,1)}),Pe()}o?(e=wa(o,u()),se(e.$$.fragment),I(e.$$.fragment,1),ne(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(c){n||(e&&I(e.$$.fragment,c),n=!0)},o(c){e&&q(e.$$.fragment,c),n=!1},d(c){c&&S(l),e&&ie(e,c)}}}function C0(t){let e,l,n,i;const o=[y0,w0],u=[];function c(a,f){return a[0]!==null?0:1}return e=c(t),l=u[e]=o[e](t),{c(){l.c(),n=Ke()},m(a,f){u[e].m(a,f),M(a,n,f),i=!0},p(a,f){let p=e;e=c(a),e===p?u[e].p(a,f):(Ae(),q(u[p],1,1,()=>{u[p]=null}),Pe(),l=u[e],l?l.p(a,f):(l=u[e]=o[e](a),l.c()),I(l,1),l.m(n.parentNode,n))},i(a){i||(I(l),i=!0)},o(a){q(l),i=!1},d(a){u[e].d(a),a&&S(n)}}}function S0(t){let e,l,n,i,o,u=[Qs(t[7]),{"data-svnav-route-start":t[5]}],c={};for(let _=0;_{a=null}),Pe())},i(_){o||(I(a),o=!0)},o(_){q(a),o=!1},d(_){_&&S(e),_&&S(l),a&&a.d(_),_&&S(n),_&&S(i)}}}const M0=yc();function T0(t,e,l){let n;const i=["path","component","meta","primary"];let o=hs(e,i),u,c,a,f,{$$slots:p={},$$scope:_}=e,{path:v=""}=e,{component:h=null}=e,{meta:d={}}=e,{primary:g=!0}=e;$i(ws,e);const w=M0(),{registerRoute:D,unregisterRoute:T,activeRoute:E,disableInlineStyles:F}=jl(si);hl(t,E,U=>l(16,u=U));const O=Wc();hl(t,O,U=>l(17,a=U));const R=jc();hl(t,R,U=>l(3,c=U));const y=it(null);let A;const te=it(),W=it({});hl(t,W,U=>l(4,f=U)),wi(Tc,te),wi(E1,W),wi(A1,y);const j=g0();return Hl||k1(()=>T(w)),t.$$set=U=>{l(24,e=rl(rl({},e),ds(U))),l(12,o=hs(e,i)),"path"in U&&l(13,v=U.path),"component"in U&&l(0,h=U.component),"meta"in U&&l(14,d=U.meta),"primary"in U&&l(1,g=U.primary),"$$scope"in U&&l(19,_=U.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const U=v==="",K=Ti(a,v),Y={id:w,path:v,meta:d,default:U,fullPath:U?"":K,base:U?a:X1(K,c.pathname),primary:g,focusElement:y};te.set(Y),l(15,A=D(Y))}if(t.$$.dirty&98304&&l(2,n=!!(A||u&&u.id===w)),t.$$.dirty&98308&&n){const{params:U}=A||u;W.set(U)}},e=ds(e),[h,g,n,c,f,w,E,F,O,R,W,j,o,v,d,A,u,a,p,_]}class $0 extends Re{constructor(e){super(),Le(this,e,T0,S0,Ee,{path:13,component:0,meta:14,primary:1})}}const pl=$0;function N0(t){let e,l,n,i;const o=t[13].default,u=co(o,t,t[12],null);let c=[{href:t[0]},t[2],t[1]],a={};for(let f=0;fl(11,_=y));const E=w1(),F=zc(),{navigate:O}=Hc();function R(y){E("click",y),T1(y)&&(y.preventDefault(),O(n,{state:w,replace:u||g}))}return t.$$set=y=>{l(19,e=rl(rl({},e),ds(y))),l(18,p=hs(e,f)),"to"in y&&l(5,d=y.to),"replace"in y&&l(6,g=y.replace),"state"in y&&l(7,w=y.state),"getProps"in y&&l(8,D=y.getProps),"$$scope"in y&&l(12,h=y.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=F(d,_)),t.$$.dirty&2049&&l(10,i=Zs(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(u=wo(n)===Y1(_)),t.$$.dirty&512&&l(2,c=o?{"aria-current":"page"}:{}),l(1,a=(()=>{if(kc(D)){const y=D({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...y}}return p})())},e=ds(e),[n,a,c,T,R,d,g,w,D,o,i,_,h,v]}class A0 extends Re{constructor(e){super(),Le(this,e,E0,N0,Ee,{to:5,replace:6,state:7,getProps:8})}}const Xt=A0;let Js=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ul(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function P0(t,e){return e?t>218&&t<242?"#32c000":t>212&&t<248?"#b1c000":t>208&&t<252?"#ffa000":"#d90000":t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Gc(t,e){let l;return e?t>90?l="#d90000":t>85?l="#e31000":t>80?l="#ffa900":t>75?l="#dcc300":l="#32c500":t>90?l="#d90000":t>85?l="#e32100":t>80?l="#ffb800":t>75?l="#dcd800":l="#32d900",l}function D0(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function gs(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 Ue(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function ve(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1";case 80:return"Generic ESP32-S3"}}function La(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Ra(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Ia(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Oa(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function li(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Xe(t,e){return t==1||t==2&&e}function Rt(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ke(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function vl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Fa(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function Ba(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function qa(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}async function $l(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let dl={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null,if:{eth:!1}};const Wt=it(dl);async function yo(){dl=await(await $l("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Wt.set(dl)}let cs=0,Ua=-127,ja=null,L0={};const Vc=Mc(L0,t=>{let e;async function l(){$l("data.json").then(n=>n.json()).then(n=>{t(n),Ua!=n.t&&(Ua=n.t,setTimeout(Zc,2e3)),ja==null&&n.pe&&n.p!=null&&(ja=n.p,Yc()),dl.upgrading?window.location.reload():(!dl||!dl.chip||dl.booting||cs>1&&!li(dl.board))&&(yo(),rn&&clearTimeout(rn),rn=setTimeout(So,2e3),an&&clearTimeout(an),an=setTimeout(Mo,3e3));let i=5e3;if(li(dl.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),cs=0}).catch(n=>{cs++,cs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,li(dl.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let xs={},bi;const Co=it(xs);async function Kc(){let t=!1;if(Co.update(e=>{for(var l=0;l<36;l++){if(e[Ue(l)]==null){t=l<12;break}e[Ue(l)]=e[Ue(l+1)]}return e}),t)Yc();else{let e=new Date;bi=setTimeout(Kc,(60-e.getMinutes())*6e4)}}async function Yc(){bi&&(clearTimeout(bi),bi=0),xs=await(await $l("energyprice.json")).json(),Co.set(xs);let e=new Date;bi=setTimeout(Kc,(60-e.getMinutes())*6e4)}let eo={},rn;async function So(){rn&&(clearTimeout(rn),rn=0),eo=await(await $l("dayplot.json")).json(),Qc.set(eo);let e=new Date;rn=setTimeout(So,(60-e.getMinutes())*6e4+20)}const Qc=it(eo,t=>(So(),function(){}));let to={},an;async function Mo(){an&&(clearTimeout(an),an=0),to=await(await $l("monthplot.json")).json(),Xc.set(to);let e=new Date;an=setTimeout(Mo,(24-e.getHours())*36e5+40)}const Xc=it(to,t=>(Mo(),function(){}));let lo={};async function Zc(){lo=await(await $l("temperature.json")).json(),Jc.set(lo)}const Jc=it(lo,t=>(Zc(),function(){}));let no={},ms;async function xc(){ms&&(clearTimeout(ms),ms=0),no=await(await $l("tariff.json")).json(),e1.set(no);let e=new Date;ms=setTimeout(xc,(60-e.getMinutes())*6e4+30)}const e1=it(no,t=>function(){});let io=[];const To=it(io);async function R0(){io=await(await $l("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),To.set(io)}let so={};async function I0(){so=await(await $l("realtime.json")).json(),t1.set(so)}const t1=it(so,t=>(I0(),function(){}));function ks(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 l1(t){await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function n1(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),u=[...e];u.reverse();let c,a,f;for(let p=0;po&&(c=_):g==i+1&&(a=_);else if(d==n+1)if(f){let D=f.tag_name.substring(1).split(".");parseInt(D[0]);let T=parseInt(D[1]);parseInt(D[2]),g==T&&(f=_)}else f=_}return a||f||c||!1}else return e[0]}const Ha="/github.svg";function Wa(t){let e,l;function n(u,c){return u[1]>1?H0:u[1]>0?j0:u[2]>1?U0:u[2]>0?q0:u[3]>1?B0:u[3]>0?F0:O0}let i=n(t),o=i(t);return{c(){e=N(`Up - `),o.c(),l=Ke()},m(u,c){M(u,e,c),o.m(u,c),M(u,l,c)},p(u,c){i===(i=n(u))&&o?o.p(u,c):(o.d(1),o=i(u),o&&(o.c(),o.m(l.parentNode,l)))},d(u){u&&S(e),o.d(u),u&&S(l)}}}function O0(t){let e,l;return{c(){e=N(t[0]),l=N(" seconds")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&1&&J(e,n[0])},d(n){n&&S(e),n&&S(l)}}}function F0(t){let e,l;return{c(){e=N(t[3]),l=N(" minute")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&J(e,n[3])},d(n){n&&S(e),n&&S(l)}}}function B0(t){let e,l;return{c(){e=N(t[3]),l=N(" minutes")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&J(e,n[3])},d(n){n&&S(e),n&&S(l)}}}function q0(t){let e,l;return{c(){e=N(t[2]),l=N(" hour")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&J(e,n[2])},d(n){n&&S(e),n&&S(l)}}}function U0(t){let e,l;return{c(){e=N(t[2]),l=N(" hours")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&J(e,n[2])},d(n){n&&S(e),n&&S(l)}}}function j0(t){let e,l;return{c(){e=N(t[1]),l=N(" day")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&J(e,n[1])},d(n){n&&S(e),n&&S(l)}}}function H0(t){let e,l;return{c(){e=N(t[1]),l=N(" days")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&J(e,n[1])},d(n){n&&S(e),n&&S(l)}}}function W0(t){let e,l=t[0]&&Wa(t);return{c(){l&&l.c(),e=Ke()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Wa(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:pe,o:pe,d(n){l&&l.d(n),n&&S(e)}}}function z0(t,e,l){let{epoch:n}=e,i=0,o=0,u=0;return t.$$set=c=>{"epoch"in c&&l(0,n=c.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,o,u]}class G0 extends Re{constructor(e){super(),Le(this,e,z0,W0,Ee,{epoch:0})}}function V0(t){let e,l,n;return{c(){e=m("span"),l=N(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){M(i,e,o),s(e,l)},p(i,[o]){o&4&&J(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:pe,o:pe,d(i){i&&S(e)}}}function K0(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,o=u.text)},[n,i,o]}class un extends Re{constructor(e){super(),Le(this,e,K0,V0,Ee,{color:0,title:1,text:2})}}function Y0(t){let e,l=`${Ue(t[0].getDate())}.${Ue(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ue(t[0].getHours())}:${Ue(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=N(l),r(e,"class",t[1])},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ue(i[0].getDate())}.${Ue(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ue(i[0].getHours())}:${Ue(i[0].getMinutes())}`)&&J(n,l),o&2&&r(e,"class",i[1])},d(i){i&&S(e)}}}function Q0(t){let e=`${Ue(t[0].getDate())}. ${Js[t[0].getMonth()]} ${Ue(t[0].getHours())}:${Ue(t[0].getMinutes())}`,l;return{c(){l=N(e)},m(n,i){M(n,l,i)},p(n,i){i&1&&e!==(e=`${Ue(n[0].getDate())}. ${Js[n[0].getMonth()]} ${Ue(n[0].getHours())}:${Ue(n[0].getMinutes())}`)&&J(l,e)},d(n){n&&S(l)}}}function X0(t){let e;function l(o,u){return o[2]?Q0:Y0}let n=l(t),i=n(t);return{c(){i.c(),e=Ke()},m(o,u){i.m(o,u),M(o,e,u)},p(o,[u]){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:pe,o:pe,d(o){i.d(o),o&&S(e)}}}function Z0(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,u;return t.$$set=c=>{"timestamp"in c&&l(0,n=c.timestamp),"fullTimeColor"in c&&l(1,i=c.fullTimeColor),"offset"in c&&l(3,o=c.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||vl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,o]}class i1 extends Re{constructor(e){super(),Le(this,e,Z0,X0,Ee,{timestamp:0,fullTimeColor:1,offset:3})}}function J0(t){let e,l,n;return{c(){e=De("svg"),l=De("path"),n=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(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"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){M(i,e,o),s(e,l),s(e,n)},p:pe,i:pe,o:pe,d(i){i&&S(e)}}}class x0 extends Re{constructor(e){super(),Le(this,e,null,J0,Ee,{})}}function em(t){let e,l;return{c(){e=De("svg"),l=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(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"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:pe,i:pe,o:pe,d(n){n&&S(e)}}}class tm extends Re{constructor(e){super(),Le(this,e,null,em,Ee,{})}}function lm(t){let e,l;return{c(){e=De("svg"),l=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(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"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:pe,i:pe,o:pe,d(n){n&&S(e)}}}class Lt extends Re{constructor(e){super(),Le(this,e,null,lm,Ee,{})}}function nm(t){let e,l;return{c(){e=De("svg"),l=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:pe,i:pe,o:pe,d(n){n&&S(e)}}}class s1 extends Re{constructor(e){super(),Le(this,e,null,nm,Ee,{})}}function im(t){let e,l,n=t[2].version+"",i;return{c(){e=N("AMS reader "),l=m("span"),i=N(n)},m(o,u){M(o,e,u),M(o,l,u),s(l,i)},p(o,u){u&4&&n!==(n=o[2].version+"")&&J(i,n)},d(o){o&&S(e),o&&S(l)}}}function za(t){let e,l=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=N(l),i=N("\xB0C"),r(e,"class","flex-none my-auto")},m(o,u){M(o,e,u),s(e,n),s(e,i)},p(o,u){u&2&&l!==(l=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&J(n,l)},d(o){o&&S(e)}}}function Ga(t){let e,l="HAN: "+La(t[1].he),n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l="HAN: "+La(i[1].he))&&J(n,l)},d(i){i&&S(e)}}}function Va(t){let e,l="MQTT: "+Ra(t[1].me),n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l="MQTT: "+Ra(i[1].me))&&J(n,l)},d(i){i&&S(e)}}}function Ka(t){let e,l="Price service: "+Ia(t[1].ee),n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l="Price service: "+Ia(i[1].ee))&&J(n,l)},d(i){i&&S(e)}}}function Ya(t){let e,l,n,i,o,u;return l=new Xt({props:{to:"/configuration",$$slots:{default:[sm]},$$scope:{ctx:t}}}),o=new Xt({props:{to:"/status",$$slots:{default:[om]},$$scope:{ctx:t}}}),{c(){e=m("div"),se(l.$$.fragment),n=b(),i=m("div"),se(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(c,a){M(c,e,a),ne(l,e,null),M(c,n,a),M(c,i,a),ne(o,i,null),u=!0},i(c){u||(I(l.$$.fragment,c),I(o.$$.fragment,c),u=!0)},o(c){q(l.$$.fragment,c),q(o.$$.fragment,c),u=!1},d(c){c&&S(e),ie(l),c&&S(n),c&&S(i),ie(o)}}}function sm(t){let e,l;return e=new x0({}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function om(t){let e,l;return e=new tm({}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Qa(t){let e,l,n,i,o;const u=[am,rm],c=[];function a(f,p){return f[2].security==0||f[1].a?0:1}return l=a(t),n=c[l]=u[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[3].tag_name)},m(f,p){M(f,e,p),c[l].m(e,null),o=!0},p(f,p){let _=l;l=a(f),l===_?c[l].p(f,p):(Ae(),q(c[_],1,1,()=>{c[_]=null}),Pe(),n=c[l],n?n.p(f,p):(n=c[l]=u[l](f),n.c()),I(n,1),n.m(e,null)),(!o||p&8&&i!==(i="New version: "+f[3].tag_name))&&r(e,"title",i)},i(f){o||(I(n),o=!0)},o(f){q(n),o=!1},d(f){f&&S(e),c[l].d()}}}function rm(t){let e,l,n=t[3].tag_name+"",i;return{c(){e=m("span"),l=N("New version: "),i=N(n)},m(o,u){M(o,e,u),s(e,l),s(e,i)},p(o,u){u&8&&n!==(n=o[3].tag_name+"")&&J(i,n)},i:pe,o:pe,d(o){o&&S(e)}}}function am(t){let e,l,n,i=t[3].tag_name+"",o,u,c,a,f,p;return c=new s1({}),{c(){e=m("button"),l=m("span"),n=N("New version: "),o=N(i),u=b(),se(c.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(_,v){M(_,e,v),s(e,l),s(l,n),s(l,o),s(e,u),ne(c,e,null),a=!0,f||(p=ee(e,"click",t[4]),f=!0)},p(_,v){(!a||v&8)&&i!==(i=_[3].tag_name+"")&&J(o,i)},i(_){a||(I(c.$$.fragment,_),a=!0)},o(_){q(c.$$.fragment,_),a=!1},d(_){_&&S(e),ie(c),f=!1,p()}}}function um(t){let e,l,n,i,o,u,c,a,f,p,_,v,h=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z,V,H,x,ue,re,Q,z,we,He,Ie,Se;i=new Xt({props:{to:"/",$$slots:{default:[im]},$$scope:{ctx:t}}}),a=new G0({props:{epoch:t[1].u}});let ye=t[1].t>-50&&za(t);T=new un({props:{title:"ESP",text:t[2].booting?"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":"ESP",color:Ul(t[2].booting?2:t[1].em)}}),F=new un({props:{title:"HAN",text:"HAN",color:Ul(t[2].booting?9:t[1].hm)}}),R=new un({props:{title:"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":"WiFi",color:Ul(t[2].booting?9:t[1].wm)}}),A=new un({props:{title:"MQTT",text:"MQTT",color:Ul(t[2].booting?9:t[1].mm)}});let he=(t[1].he<0||t[1].he>0)&&Ga(t),$e=t[1].me<0&&Va(t),be=(t[1].ee>0||t[1].ee<0)&&Ka(t);ue=new i1({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let $=t[2].vndcfg&&t[2].usrcfg&&Ya(t);He=new Lt({});let C=t[2].fwconsent===1&&t[3]&&Qa(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),se(i.$$.fragment),o=b(),u=m("div"),c=m("div"),se(a.$$.fragment),f=b(),ye&&ye.c(),p=b(),_=m("div"),v=N("Free mem: "),d=N(h),g=N("kb"),w=b(),D=m("div"),se(T.$$.fragment),E=b(),se(F.$$.fragment),O=b(),se(R.$$.fragment),y=b(),se(A.$$.fragment),te=b(),he&&he.c(),W=b(),$e&&$e.c(),j=b(),be&&be.c(),U=b(),K=m("div"),Y=m("div"),G=m("a"),Z=m("img"),H=b(),x=m("div"),se(ue.$$.fragment),re=b(),$&&$.c(),Q=b(),z=m("div"),we=m("a"),se(He.$$.fragment),Ie=b(),C&&C.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(c,"class","flex-none my-auto"),r(_,"class","flex-none my-auto"),r(u,"class","flex-none my-auto p-2 flex space-x-4"),r(D,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(Z,"class","gh-logo"),ps(Z.src,V=t[0]+Ha)||r(Z,"src",V),r(Z,"alt","GitHub repo"),r(G,"class","float-right"),r(G,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(G,"target","_blank"),r(G,"rel","noreferrer"),r(G,"aria-label","GitHub"),r(Y,"class","flex-none"),r(x,"class","flex-none my-auto px-2"),r(we,"href",Rt("")),r(we,"target","_blank"),r(we,"rel","noreferrer"),r(z,"class","flex-none px-1 mt-1"),r(z,"title","Documentation"),r(K,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","hdr")},m(k,P){M(k,e,P),s(e,l),s(l,n),ne(i,n,null),s(l,o),s(l,u),s(u,c),ne(a,c,null),s(u,f),ye&&ye.m(u,null),s(u,p),s(u,_),s(_,v),s(_,d),s(_,g),s(l,w),s(l,D),ne(T,D,null),s(D,E),ne(F,D,null),s(D,O),ne(R,D,null),s(D,y),ne(A,D,null),s(l,te),he&&he.m(l,null),s(l,W),$e&&$e.m(l,null),s(l,j),be&&be.m(l,null),s(l,U),s(l,K),s(K,Y),s(Y,G),s(G,Z),s(K,H),s(K,x),ne(ue,x,null),s(K,re),$&&$.m(K,null),s(K,Q),s(K,z),s(z,we),ne(He,we,null),s(K,Ie),C&&C.m(K,null),Se=!0},p(k,[P]){const L={};P&36&&(L.$$scope={dirty:P,ctx:k}),i.$set(L);const X={};P&2&&(X.epoch=k[1].u),a.$set(X),k[1].t>-50?ye?ye.p(k,P):(ye=za(k),ye.c(),ye.m(u,p)):ye&&(ye.d(1),ye=null),(!Se||P&2)&&h!==(h=(k[1].m?(k[1].m/1e3).toFixed(1):"-")+"")&&J(d,h);const le={};P&6&&(le.text=k[2].booting?"Booting":k[1].v>2?k[1].v.toFixed(2)+"V":"ESP"),P&6&&(le.color=Ul(k[2].booting?2:k[1].em)),T.$set(le);const fe={};P&6&&(fe.color=Ul(k[2].booting?9:k[1].hm)),F.$set(fe);const de={};P&2&&(de.text=k[1].r?k[1].r.toFixed(0)+"dBm":"WiFi"),P&6&&(de.color=Ul(k[2].booting?9:k[1].wm)),R.$set(de);const Ce={};P&6&&(Ce.color=Ul(k[2].booting?9:k[1].mm)),A.$set(Ce),k[1].he<0||k[1].he>0?he?he.p(k,P):(he=Ga(k),he.c(),he.m(l,W)):he&&(he.d(1),he=null),k[1].me<0?$e?$e.p(k,P):($e=Va(k),$e.c(),$e.m(l,j)):$e&&($e.d(1),$e=null),k[1].ee>0||k[1].ee<0?be?be.p(k,P):(be=Ka(k),be.c(),be.m(l,U)):be&&(be.d(1),be=null),(!Se||P&1&&!ps(Z.src,V=k[0]+Ha))&&r(Z,"src",V);const Oe={};P&2&&(Oe.timestamp=k[1].c?new Date(k[1].c*1e3):new Date(0)),P&4&&(Oe.offset=k[2].clock_offset),ue.$set(Oe),k[2].vndcfg&&k[2].usrcfg?$?P&4&&I($,1):($=Ya(k),$.c(),I($,1),$.m(K,Q)):$&&(Ae(),q($,1,1,()=>{$=null}),Pe()),k[2].fwconsent===1&&k[3]?C?(C.p(k,P),P&12&&I(C,1)):(C=Qa(k),C.c(),I(C,1),C.m(K,null)):C&&(Ae(),q(C,1,1,()=>{C=null}),Pe())},i(k){Se||(I(i.$$.fragment,k),I(a.$$.fragment,k),I(T.$$.fragment,k),I(F.$$.fragment,k),I(R.$$.fragment,k),I(A.$$.fragment,k),I(ue.$$.fragment,k),I($),I(He.$$.fragment,k),I(C),Se=!0)},o(k){q(i.$$.fragment,k),q(a.$$.fragment,k),q(T.$$.fragment,k),q(F.$$.fragment,k),q(R.$$.fragment,k),q(A.$$.fragment,k),q(ue.$$.fragment,k),q($),q(He.$$.fragment,k),q(C),Se=!1},d(k){k&&S(e),ie(i),ie(a),ye&&ye.d(),ie(T),ie(F),ie(R),ie(A),he&&he.d(),$e&&$e.d(),be&&be.d(),ie(ue),$&&$.d(),ie(He),C&&C.d()}}}function fm(t,e,l){let{basepath:n="/"}=e,{data:i={}}=e,o={},u={};function c(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(!li(o.board)||confirm(ks(ve(o.chip,o.board))))&&(Wt.update(a=>(a.upgrading=!0,a)),l1(u.tag_name))}return Wt.subscribe(a=>{l(2,o=a),a.fwconsent===1&&R0()}),To.subscribe(a=>{l(3,u=n1(o.version,a))}),t.$$set=a=>{"basepath"in a&&l(0,n=a.basepath),"data"in a&&l(1,i=a.data)},[n,i,o,u,c]}class cm extends Re{constructor(e){super(),Le(this,e,fm,um,Ee,{basepath:0,data:1})}}function mm(t){let e,l,n,i;return{c(){e=De("svg"),l=De("path"),n=De("path"),r(l,"d",Ks(150,150,115,210,510)),r(l,"stroke","rgba(128, 128, 128, 0.15)"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=Ks(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,u){M(o,e,u),s(e,l),s(e,n)},p(o,[u]){u&1&&i!==(i=Ks(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),u&2&&r(n,"stroke",o[1])},i:pe,o:pe,d(o){o&&S(e)}}}function Xa(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 Ks(t,e,l,n,i){var o=Xa(t,e,l,i),u=Xa(t,e,l,n),c=i-n<=180?"0":"1",a=["M",o.x,o.y,"A",l,l,0,c,0,u.x,u.y].join(" ");return a}function _m(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class pm extends Re{constructor(e){super(),Le(this,e,_m,mm,Ee,{pct:0,color:1})}}function Za(t){let e,l,n,i,o,u,c,a;return{c(){e=m("br"),l=b(),n=m("span"),i=N(t[3]),o=b(),u=m("span"),c=N(t[4]),a=N("/kWh"),r(n,"class","pl-sub"),r(u,"class","pl-snt")},m(f,p){M(f,e,p),M(f,l,p),M(f,n,p),s(n,i),M(f,o,p),M(f,u,p),s(u,c),s(u,a)},p(f,p){p&8&&J(i,f[3]),p&16&&J(c,f[4])},d(f){f&&S(e),f&&S(l),f&&S(n),f&&S(o),f&&S(u)}}}function dm(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w;l=new pm({props:{pct:t[6],color:t[5](t[6],document.documentElement.classList.contains("dark"))}});let D=t[3]&&Za(t);return{c(){e=m("div"),se(l.$$.fragment),n=b(),i=m("span"),o=m("span"),u=N(t[2]),c=b(),a=m("br"),f=b(),p=m("span"),_=N(t[0]),v=b(),h=m("span"),d=N(t[1]),g=b(),D&&D.c(),r(o,"class","pl-lab"),r(p,"class","pl-val"),r(h,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(T,E){M(T,e,E),ne(l,e,null),s(e,n),s(e,i),s(i,o),s(o,u),s(i,c),s(i,a),s(i,f),s(i,p),s(p,_),s(i,v),s(i,h),s(h,d),s(i,g),D&&D.m(i,null),w=!0},p(T,[E]){const F={};E&64&&(F.pct=T[6]),E&96&&(F.color=T[5](T[6],document.documentElement.classList.contains("dark"))),l.$set(F),(!w||E&4)&&J(u,T[2]),(!w||E&1)&&J(_,T[0]),(!w||E&2)&&J(d,T[1]),T[3]?D?D.p(T,E):(D=Za(T),D.c(),D.m(i,null)):D&&(D.d(1),D=null)},i(T){w||(I(l.$$.fragment,T),w=!0)},o(T){q(l.$$.fragment,T),w=!1},d(T){T&&S(e),ie(l),D&&D.d()}}}function hm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:c=""}=e,{subunit:a=""}=e,{colorFn:f}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,u=_.label),"sub"in _&&l(3,c=_.sub),"subunit"in _&&l(4,a=_.subunit),"colorFn"in _&&l(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,u,c,a,f,p,i]}class o1 extends Re{constructor(e){super(),Le(this,e,hm,dm,Ee,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Ja(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function xa(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function eu(t,e,l){const n=t.slice();return n[15]=e[l],n}function tu(t){let e,l,n,i,o,u,c=t[0].title&&lu(t),a=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(o,u){M(o,e,u),s(e,n),i=vo(e,t[9].bind(e))},p(o,u){u&1&&l!==(l=o[0].title+"")&&J(n,l)},d(o){o&&S(e),i()}}}function nu(t){let e,l,n,i=t[15].label+"",o,u,c,a;return{c(){e=De("g"),l=De("line"),n=De("text"),o=N(i),r(l,"x2","100%"),r(n,"y","-4"),r(n,"x",u=t[15].align=="right"?"85%":""),r(e,"class",c="tick tick-"+t[15].value+" tick-"+t[15].color),r(e,"transform",a="translate(0, "+t[7](t[15].value)+")")},m(f,p){M(f,e,p),s(e,l),s(e,n),s(n,o)},p(f,p){p&1&&i!==(i=f[15].label+"")&&J(o,i),p&1&&u!==(u=f[15].align=="right"?"85%":"")&&r(n,"x",u),p&1&&c!==(c="tick tick-"+f[15].value+" tick-"+f[15].color)&&r(e,"class",c),p&129&&a!==(a="translate(0, "+f[7](f[15].value)+")")&&r(e,"transform",a)},d(f){f&&S(e)}}}function iu(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&nu(t);return{c(){n&&n.c(),l=Ke()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,o):(n=nu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&S(l)}}}function su(t){let e,l,n=(t[3]>20||t[13]%2==0)&&ou(t);return{c(){e=De("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){M(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=ou(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&S(e),n&&n.d()}}}function ou(t){let e,l=t[11].label+"",n,i;return{c(){e=De("text"),n=N(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,u){M(o,e,u),s(e,n)},p(o,u){u&1&&l!==(l=o[11].label+"")&&J(n,l),u&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&S(e)}}}function ru(t){let e=!isNaN(t[6](t[13])),l,n=e&&su(t);return{c(){n&&n.c(),l=Ke()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,o):(n=su(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&S(l)}}}function au(t){let e,l,n=t[11].value!==void 0&&uu(t),i=t[11].value2>1e-4&&mu(t);return{c(){e=De("g"),n&&n.c(),l=De("g"),i&&i.c()},m(o,u){M(o,e,u),n&&n.m(e,null),M(o,l,u),i&&i.m(l,null)},p(o,u){o[11].value!==void 0?n?n.p(o,u):(n=uu(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[11].value2>1e-4?i?i.p(o,u):(i=mu(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&S(e),n&&n.d(),o&&S(l),i&&i.d()}}}function uu(t){let e,l,n,i,o,u,c,a=t[3]>15&&fu(t);return{c(){e=De("rect"),a&&a.c(),c=Ke(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](t[11].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),r(e,"fill",u=t[11].color)},m(f,p){M(f,e,p),a&&a.m(f,p),M(f,c,p)},p(f,p){p&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),p&129&&n!==(n=f[7](f[11].value))&&r(e,"y",n),p&8&&i!==(i=f[3]-4)&&r(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&r(e,"height",o),p&1&&u!==(u=f[11].color)&&r(e,"fill",u),f[3]>15?a?a.p(f,p):(a=fu(f),a.c(),a.m(c.parentNode,c)):a&&(a.d(1),a=null)},d(f){f&&S(e),a&&a.d(f),f&&S(c)}}}function fu(t){let e,l=t[11].label+"",n,i,o,u,c,a,f=t[11].title&&cu(t);return{c(){e=De("text"),n=N(l),f&&f.c(),a=Ke(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[7](0)-t[8]?t[11].color:"white"),r(e,"transform",c="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[11].labelAngle?t[11].labelAngle:t[3]p[7](0)-p[8]?p[11].color:"white")&&r(e,"fill",u),_&457&&c!==(c="translate("+(p[6](p[13])+p[3]/2)+" "+(p[7](p[11].value)>p[7](0)-p[8]?p[7](p[11].value)-p[8]:p[7](p[11].value)+10)+") rotate("+(p[11].labelAngle?p[11].labelAngle:p[3]15&&_u(t);return{c(){e=De("rect"),a&&a.c(),c=Ke(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),r(e,"fill",u=t[11].color2?t[11].color2:t[11].color)},m(f,p){M(f,e,p),a&&a.m(f,p),M(f,c,p)},p(f,p){p&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),p&128&&n!==(n=f[7](0))&&r(e,"y",n),p&8&&i!==(i=f[3]-4)&&r(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&r(e,"height",o),p&1&&u!==(u=f[11].color2?f[11].color2:f[11].color)&&r(e,"fill",u),f[3]>15?a?a.p(f,p):(a=_u(f),a.c(),a.m(c.parentNode,c)):a&&(a.d(1),a=null)},d(f){f&&S(e),a&&a.d(f),f&&S(c)}}}function _u(t){let e,l=t[11].label2+"",n,i,o,u,c,a=t[11].title2&&pu(t);return{c(){e=De("text"),n=N(l),a&&a.c(),c=Ke(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(i,o){M(i,e,o),n&&n.m(e,null),l=vo(e,t[10].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=tu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:pe,o:pe,d(i){i&&S(e),n&&n.d(),l()}}}let fn=30;function bm(t,e,l){let{config:n}=e,i,o,u,c,a,f,p,_=0;function v(){_=this.clientHeight,l(5,_)}function h(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,f=o-_);let d=i-(n.padding.left+n.padding.right);l(3,u=d/n.points.length),l(8,p=un.y.max?D=n.padding.bottom:wf||D<0?0:D})}},[n,i,o,u,f,_,c,a,p,v,h]}class _n extends Re{constructor(e){super(),Le(this,e,bm,vm,Ee,{config:0})}}function gm(t){let e,l;return e=new _n({props:{config:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function km(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,c={};function a(f){return{label:ke(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:P0(f||0,document.documentElement.classList.contains("dark"))}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],p=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),p.push(a(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),p.push(a(i))),o>0&&(f.push({label:u===1?"L2-L3":"L3"}),p.push(a(o))),l(0,c={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:p})}},[c,n,i,o,u]}class wm extends Re{constructor(e){super(),Le(this,e,km,gm,Ee,{u1:1,u2:2,u3:3,ds:4})}}function ym(t){let e,l;return e=new _n({props:{config:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Cm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:u}=e,{i2:c}=e,{i2e:a}=e,{i3:f}=e,{max:p}=e,_={};function v(h){return{label:ke(h)+"A",title:h.toFixed(1)+" A",value:isNaN(h)?0:h,color:Gc(h?h/p*100:0,document.documentElement.classList.contains("dark"))}}return t.$$set=h=>{"u1"in h&&l(1,n=h.u1),"u2"in h&&l(2,i=h.u2),"u3"in h&&l(3,o=h.u3),"i1"in h&&l(4,u=h.i1),"i2"in h&&l(5,c=h.i2),"i2e"in h&&l(6,a=h.i2e),"i3"in h&&l(7,f=h.i3),"max"in h&&l(8,p=h.max)},t.$$.update=()=>{if(t.$$.dirty&510){let h=[],d=[];n>0&&(h.push({label:"L1"}),d.push(v(u))),i>0&&(a?(h.push({label:"L2"}),d.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(h.push({label:"L2"}),d.push(v(c)))),o>0&&(h.push({label:"L3"}),d.push(v(f))),l(0,_={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:p,ticks:[{value:0,label:"0%"},{value:p/4,label:"25%"},{value:p/2,label:"50%"},{value:p/4*3,label:"75%"},{value:p,label:"100%"}]},x:{ticks:h},points:d})}},[_,n,i,o,u,c,a,f,p]}class Sm extends Re{constructor(e){super(),Le(this,e,Cm,ym,Ee,{u1:1,u2:2,u3:3,i1:4,i2:5,i2e:6,i3:7,max:8})}}function Mm(t){let e,l,n,i,o,u,c,a=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,p,_,v,h,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",w,D,T,E,F,O,R,y=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",A,te,W,j,U,K,Y=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",G,Z;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=b(),i=m("div"),o=m("div"),o.textContent="Instant in",u=b(),c=m("div"),f=N(a),p=N(" VAr"),_=b(),v=m("div"),v.textContent="Instant out",h=b(),d=m("div"),w=N(g),D=N(" VAr"),T=b(),E=m("div"),F=m("div"),F.textContent="Total in",O=b(),R=m("div"),A=N(y),te=N(" kVArh"),W=b(),j=m("div"),j.textContent="Total out",U=b(),K=m("div"),G=N(Y),Z=N(" kVArh"),r(c,"class","text-right"),r(d,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(R,"class","text-right"),r(K,"class","text-right"),r(E,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(V,H){M(V,e,H),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(i,c),s(c,f),s(c,p),s(i,_),s(i,v),s(i,h),s(i,d),s(d,w),s(d,D),s(e,T),s(e,E),s(E,F),s(E,O),s(E,R),s(R,A),s(R,te),s(E,W),s(E,j),s(E,U),s(E,K),s(K,G),s(K,Z)},p(V,[H]){H&1&&a!==(a=(typeof V[0]<"u"?V[0].toFixed(0):"-")+"")&&J(f,a),H&2&&g!==(g=(typeof V[1]<"u"?V[1].toFixed(0):"-")+"")&&J(w,g),H&4&&y!==(y=(typeof V[2]<"u"?V[2].toFixed(1):"-")+"")&&J(A,y),H&8&&Y!==(Y=(typeof V[3]<"u"?V[3].toFixed(1):"-")+"")&&J(G,Y)},i:pe,o:pe,d(V){V&&S(e)}}}function Tm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=e;return t.$$set=c=>{"importInstant"in c&&l(0,n=c.importInstant),"exportInstant"in c&&l(1,i=c.exportInstant),"importTotal"in c&&l(2,o=c.importTotal),"exportTotal"in c&&l(3,u=c.exportTotal)},[n,i,o,u]}class $m extends Re{constructor(e){super(),Le(this,e,Tm,Mm,Ee,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function hu(t){let e;function l(o,u){return o[3]?Em:Nm}let n=l(t),i=n(t);return{c(){i.c(),e=Ke()},m(o,u){i.m(o,u),M(o,e,u)},p(o,u){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&S(e)}}}function Nm(t){let e,l,n,i,o,u,c=ke(t[1].h.u,2)+"",a,f,p,_,v,h,d=ke(t[1].d.u,1)+"",g,w,D,T,E,F,O=ke(t[1].m.u)+"",R,y,A,te,W,j,U=ke(t[0].last_month.u)+"",K,Y,G,Z,V=t[4]&&vu(t);return{c(){e=m("strong"),e.textContent="Consumption",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),a=N(c),f=N(" kWh"),p=b(),_=m("div"),_.textContent="Day",v=b(),h=m("div"),g=N(d),w=N(" kWh"),D=b(),T=m("div"),T.textContent="Month",E=b(),F=m("div"),R=N(O),y=N(" kWh"),A=b(),te=m("div"),te.textContent="Last month",W=b(),j=m("div"),K=N(U),Y=N(" kWh"),G=b(),V&&V.c(),Z=Ke(),r(u,"class","text-right"),r(h,"class","text-right"),r(F,"class","text-right"),r(j,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(H,x){M(H,e,x),M(H,l,x),M(H,n,x),s(n,i),s(n,o),s(n,u),s(u,a),s(u,f),s(n,p),s(n,_),s(n,v),s(n,h),s(h,g),s(h,w),s(n,D),s(n,T),s(n,E),s(n,F),s(F,R),s(F,y),s(n,A),s(n,te),s(n,W),s(n,j),s(j,K),s(j,Y),M(H,G,x),V&&V.m(H,x),M(H,Z,x)},p(H,x){x&2&&c!==(c=ke(H[1].h.u,2)+"")&&J(a,c),x&2&&d!==(d=ke(H[1].d.u,1)+"")&&J(g,d),x&2&&O!==(O=ke(H[1].m.u)+"")&&J(R,O),x&1&&U!==(U=ke(H[0].last_month.u)+"")&&J(K,U),H[4]?V?V.p(H,x):(V=vu(H),V.c(),V.m(Z.parentNode,Z)):V&&(V.d(1),V=null)},d(H){H&&S(e),H&&S(l),H&&S(n),H&&S(G),V&&V.d(H),H&&S(Z)}}}function Em(t){let e,l,n,i,o,u,c=ke(t[1].h.u,2)+"",a,f,p,_,v,h,d,g=ke(t[1].d.u,1)+"",w,D,T,E,F,O,R,y=ke(t[1].m.u)+"",A,te,W,j,U,K,Y,G=ke(t[0].last_month.u)+"",Z,V,H,x,ue,re,Q,z,we,He,Ie,Se=ke(t[1].h.p,2)+"",ye,he,$e,be,$,C,k,P=ke(t[1].d.p,1)+"",L,X,le,fe,de,Ce,Oe,ae=ke(t[1].m.p)+"",Te,Je,It,st,kt,nt,Ot,Qe=ke(t[0].last_month.p)+"",Zt,zt,ht,xe,Ve=t[4]&&bu(t),Ye=t[4]&&gu(t),Ne=t[4]&&ku(t),Ze=t[4]&&wu(t),et=t[4]&&yu(t),Be=t[4]&&Cu(t),Fe=t[4]&&Su(t),_e=t[4]&&Mu(t);return{c(){e=m("strong"),e.textContent="Import",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),a=N(c),f=N(" kWh"),p=b(),Ve&&Ve.c(),_=b(),v=m("div"),v.textContent="Day",h=b(),d=m("div"),w=N(g),D=N(" kWh"),T=b(),Ye&&Ye.c(),E=b(),F=m("div"),F.textContent="Month",O=b(),R=m("div"),A=N(y),te=N(" kWh"),W=b(),Ne&&Ne.c(),j=b(),U=m("div"),U.textContent="Last mo.",K=b(),Y=m("div"),Z=N(G),V=N(" kWh"),H=b(),Ze&&Ze.c(),ue=b(),re=m("strong"),re.textContent="Export",Q=b(),z=m("div"),we=m("div"),we.textContent="Hour",He=b(),Ie=m("div"),ye=N(Se),he=N(" kWh"),$e=b(),et&&et.c(),be=b(),$=m("div"),$.textContent="Day",C=b(),k=m("div"),L=N(P),X=N(" kWh"),le=b(),Be&&Be.c(),fe=b(),de=m("div"),de.textContent="Month",Ce=b(),Oe=m("div"),Te=N(ae),Je=N(" kWh"),It=b(),Fe&&Fe.c(),st=b(),kt=m("div"),kt.textContent="Last mo.",nt=b(),Ot=m("div"),Zt=N(Qe),zt=N(" kWh"),ht=b(),_e&&_e.c(),r(u,"class","text-right"),r(d,"class","text-right"),r(R,"class","text-right"),r(Y,"class","text-right"),r(n,"class",x="grid grid-cols-"+t[5]+" mb-3"),r(Ie,"class","text-right"),r(k,"class","text-right"),r(Oe,"class","text-right"),r(Ot,"class","text-right"),r(z,"class",xe="grid grid-cols-"+t[5])},m(ce,qe){M(ce,e,qe),M(ce,l,qe),M(ce,n,qe),s(n,i),s(n,o),s(n,u),s(u,a),s(u,f),s(n,p),Ve&&Ve.m(n,null),s(n,_),s(n,v),s(n,h),s(n,d),s(d,w),s(d,D),s(n,T),Ye&&Ye.m(n,null),s(n,E),s(n,F),s(n,O),s(n,R),s(R,A),s(R,te),s(n,W),Ne&&Ne.m(n,null),s(n,j),s(n,U),s(n,K),s(n,Y),s(Y,Z),s(Y,V),s(n,H),Ze&&Ze.m(n,null),M(ce,ue,qe),M(ce,re,qe),M(ce,Q,qe),M(ce,z,qe),s(z,we),s(z,He),s(z,Ie),s(Ie,ye),s(Ie,he),s(z,$e),et&&et.m(z,null),s(z,be),s(z,$),s(z,C),s(z,k),s(k,L),s(k,X),s(z,le),Be&&Be.m(z,null),s(z,fe),s(z,de),s(z,Ce),s(z,Oe),s(Oe,Te),s(Oe,Je),s(z,It),Fe&&Fe.m(z,null),s(z,st),s(z,kt),s(z,nt),s(z,Ot),s(Ot,Zt),s(Ot,zt),s(z,ht),_e&&_e.m(z,null)},p(ce,qe){qe&2&&c!==(c=ke(ce[1].h.u,2)+"")&&J(a,c),ce[4]?Ve?Ve.p(ce,qe):(Ve=bu(ce),Ve.c(),Ve.m(n,_)):Ve&&(Ve.d(1),Ve=null),qe&2&&g!==(g=ke(ce[1].d.u,1)+"")&&J(w,g),ce[4]?Ye?Ye.p(ce,qe):(Ye=gu(ce),Ye.c(),Ye.m(n,E)):Ye&&(Ye.d(1),Ye=null),qe&2&&y!==(y=ke(ce[1].m.u)+"")&&J(A,y),ce[4]?Ne?Ne.p(ce,qe):(Ne=ku(ce),Ne.c(),Ne.m(n,j)):Ne&&(Ne.d(1),Ne=null),qe&1&&G!==(G=ke(ce[0].last_month.u)+"")&&J(Z,G),ce[4]?Ze?Ze.p(ce,qe):(Ze=wu(ce),Ze.c(),Ze.m(n,null)):Ze&&(Ze.d(1),Ze=null),qe&32&&x!==(x="grid grid-cols-"+ce[5]+" mb-3")&&r(n,"class",x),qe&2&&Se!==(Se=ke(ce[1].h.p,2)+"")&&J(ye,Se),ce[4]?et?et.p(ce,qe):(et=yu(ce),et.c(),et.m(z,be)):et&&(et.d(1),et=null),qe&2&&P!==(P=ke(ce[1].d.p,1)+"")&&J(L,P),ce[4]?Be?Be.p(ce,qe):(Be=Cu(ce),Be.c(),Be.m(z,fe)):Be&&(Be.d(1),Be=null),qe&2&&ae!==(ae=ke(ce[1].m.p)+"")&&J(Te,ae),ce[4]?Fe?Fe.p(ce,qe):(Fe=Su(ce),Fe.c(),Fe.m(z,st)):Fe&&(Fe.d(1),Fe=null),qe&1&&Qe!==(Qe=ke(ce[0].last_month.p)+"")&&J(Zt,Qe),ce[4]?_e?_e.p(ce,qe):(_e=Mu(ce),_e.c(),_e.m(z,null)):_e&&(_e.d(1),_e=null),qe&32&&xe!==(xe="grid grid-cols-"+ce[5])&&r(z,"class",xe)},d(ce){ce&&S(e),ce&&S(l),ce&&S(n),Ve&&Ve.d(),Ye&&Ye.d(),Ne&&Ne.d(),Ze&&Ze.d(),ce&&S(ue),ce&&S(re),ce&&S(Q),ce&&S(z),et&&et.d(),Be&&Be.d(),Fe&&Fe.d(),_e&&_e.d()}}}function vu(t){let e,l,n,i,o,u,c=ke(t[1].h.c,2)+"",a,f,p,_,v,h,d,g=ke(t[1].d.c,1)+"",w,D,T,E,F,O,R,y=ke(t[1].m.c)+"",A,te,W,j,U,K,Y,G=ke(t[0].last_month.c)+"",Z,V,H;return{c(){e=m("strong"),e.textContent="Cost",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),a=N(c),f=b(),p=N(t[2]),_=b(),v=m("div"),v.textContent="Day",h=b(),d=m("div"),w=N(g),D=b(),T=N(t[2]),E=b(),F=m("div"),F.textContent="Month",O=b(),R=m("div"),A=N(y),te=b(),W=N(t[2]),j=b(),U=m("div"),U.textContent="Last month",K=b(),Y=m("div"),Z=N(G),V=b(),H=N(t[2]),r(u,"class","text-right"),r(d,"class","text-right"),r(R,"class","text-right"),r(Y,"class","text-right"),r(n,"class","grid grid-cols-2")},m(x,ue){M(x,e,ue),M(x,l,ue),M(x,n,ue),s(n,i),s(n,o),s(n,u),s(u,a),s(u,f),s(u,p),s(n,_),s(n,v),s(n,h),s(n,d),s(d,w),s(d,D),s(d,T),s(n,E),s(n,F),s(n,O),s(n,R),s(R,A),s(R,te),s(R,W),s(n,j),s(n,U),s(n,K),s(n,Y),s(Y,Z),s(Y,V),s(Y,H)},p(x,ue){ue&2&&c!==(c=ke(x[1].h.c,2)+"")&&J(a,c),ue&4&&J(p,x[2]),ue&2&&g!==(g=ke(x[1].d.c,1)+"")&&J(w,g),ue&4&&J(T,x[2]),ue&2&&y!==(y=ke(x[1].m.c)+"")&&J(A,y),ue&4&&J(W,x[2]),ue&1&&G!==(G=ke(x[0].last_month.c)+"")&&J(Z,G),ue&4&&J(H,x[2])},d(x){x&&S(e),x&&S(l),x&&S(n)}}}function bu(t){let e,l=ke(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].h.c,2)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function gu(t){let e,l=ke(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].d.c,1)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function ku(t){let e,l=ke(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].m.c)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function wu(t){let e,l=ke(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&1&&l!==(l=ke(u[0].last_month.c)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function yu(t){let e,l=ke(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].h.i,2)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function Cu(t){let e,l=ke(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].d.i,1)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function Su(t){let e,l=ke(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].m.i)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function Mu(t){let e,l=ke(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&1&&l!==(l=ke(u[0].last_month.i)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function Am(t){let e,l,n,i,o,u,c=t[1]&&hu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=b(),i=m("br"),o=m("br"),u=b(),c&&c.c(),r(e,"class","mx-2 text-sm")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,u),c&&c.m(e,null)},p(a,[f]){a[1]?c?c.p(a,f):(c=hu(a),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:pe,o:pe,d(a){a&&S(e),c&&c.d()}}}function Pm(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,c=!1,a=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,c=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(5,a=c?3:2))},[n,i,o,u,c,a]}class Dm extends Re{constructor(e){super(),Le(this,e,Pm,Am,Ee,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Lm(t){let e,l,n=Ba(t[0].source)+"",i,o,u,c,a;return c=new _n({props:{config:t[1]}}),{c(){e=m("a"),l=N("Provided by: "),i=N(n),u=b(),se(c.$$.fragment),r(e,"href",o=qa(t[0].source)),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(f,p){M(f,e,p),s(e,l),s(e,i),M(f,u,p),ne(c,f,p),a=!0},p(f,[p]){(!a||p&1)&&n!==(n=Ba(f[0].source)+"")&&J(i,n),(!a||p&1&&o!==(o=qa(f[0].source)))&&r(e,"href",o);const _={};p&2&&(_.config=f[1]),c.$set(_)},i(f){a||(I(c.$$.fragment,f),a=!0)},o(f){q(c.$$.fragment,f),a=!1},d(f){f&&S(e),f&&S(u),ie(c,f)}}}function Rm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},u,c,a=document.documentElement.classList.contains("dark");return t.$$set=f=>{"json"in f&&l(0,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let f=n.currency,p=new Date().getUTCHours(),_=0,v=0,h=0,d=[],g=[],w=[];l(4,c=l(3,u=0));let D=new Date;for(vl(D,i.clock_offset-(24+D.getHours()-D.getUTCHours())%24),_=p;_<24&&(v=n[Ue(h++)],v!=null);_++)g.push({label:Ue(D.getHours())}),w.push(v*100),l(4,c=Math.min(c,v*100)),l(3,u=Math.max(u,v*100)),vl(D,1);for(_=0;_<24&&(v=n[Ue(h++)],v!=null);_++)g.push({label:Ue(D.getHours())}),w.push(v*100),l(4,c=Math.min(c,v*100)),l(3,u=Math.max(u,v*100)),vl(D,1);if(c>-100&&u<100){switch(f){case"NOK":case"DKK":f="\xF8re";break;case"SEK":f="\xF6re";break;case"EUR":f="cent";break;case"CHF":f="rp.";break;default:f=f+"/100"}for(l(4,c*=100),l(3,u*=100),_=0;_=0?R.toFixed(y):"",title:R>=0?R.toFixed(2)+" "+f:"",value:v>=0?Math.abs(v):0,label2:R<0?R.toFixed(y):"",title2:R<0?R.toFixed(2)+" "+f:"",value2:v<0?Math.abs(v):0,color:a?"#5c2da5":"#7c3aed"})}let E=Math.max(u,Math.abs(c));if(c<0){l(4,c=Math.min(E/4*-1,c));let R=Math.ceil(Math.abs(c)/E*4),y=c/R;for(_=1;_{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],v=[];l(4,c=l(3,u=0));let h=vl(new Date,-24),d=new Date().getUTCHours();for(vl(h,i.clock_offset-(24+h.getHours()-h.getUTCHours())%24),f=d;f<24;f++){let T=n["i"+Ue(f)],E=n["e"+Ue(f)];T===void 0&&(T=0),E===void 0&&(E=0),_.push({label:Ue(h.getHours())}),v.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:E.toFixed(1),title2:E.toFixed(2)+" kWh",value2:E*10,color:a?"#5c2da5":"#7c3aed",color2:a?"#27728e":"#37829e"}),l(4,c=Math.max(c,E*10)),l(3,u=Math.max(u,T*10)),vl(h,1)}for(f=0;f{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],v=[];l(4,c=l(3,u=0));let h=new Date,d=new Date;for(vl(h,i.clock_offset-(24+h.getHours()-h.getUTCHours())%24),vl(d,i.clock_offset-(24+d.getHours()-d.getUTCHours())%24),d.setDate(0),f=h.getDate();f<=d.getDate();f++){let T=n["i"+Ue(f)],E=n["e"+Ue(f)];T===void 0&&(T=0),E===void 0&&(E=0),_.push({label:Ue(f)}),v.push({label:T.toFixed(T<10?1:0),title:T.toFixed(2)+" kWh",value:T,label2:E.toFixed(E<10?1:0),title2:E.toFixed(2)+" kWh",value2:E,color:a?"#5c2da5":"#7c3aed",color2:a?"#27728e":"#37829e"}),l(4,c=Math.max(c,E)),l(3,u=Math.max(u,T))}for(f=1;f{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,f=0,p=[],_=[],v=[];n.s&&n.s.forEach((g,w)=>{var D=g.n?g.n:g.a;f=g.v,f==-127&&(f=0),_.push({label:D.slice(-4)}),v.push({label:f.toFixed(1),value:f,color:i?"#5c2da5":"#7c3aed"}),l(3,c=Math.min(c,f)),l(2,u=Math.max(u,f))}),l(2,u=Math.ceil(u)),l(3,c=Math.floor(c));let h=u;c<0&&(h+=Math.abs(c));let d=h/4;for(a=0;a<5;a++)f=c+d*a,p.push({value:f,label:f.toFixed(1)});l(0,o={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:c,max:u,ticks:p},x:{ticks:_},points:v})}},[o,n,u,c]}class zm extends Re{constructor(e){super(),Le(this,e,Wm,Hm,Ee,{json:1})}}function Gm(t){let e,l;return e=new _n({props:{config:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}let Vm=0;function Km(t,e,l){let n=document.documentElement.classList.contains("dark"),i={},o=0,u;return e1.subscribe(c=>{l(2,u=c)}),xc(),t.$$.update=()=>{if(t.$$.dirty&6){let c=0,a=[],f=[],p=[];if(a.push({value:0,label:0}),u&&u.p)for(c=0;c0?Ue(_.d)+"."+Js[new Date().getMonth()]:"-"}),l(1,o=Math.max(o,_.v))}if(u&&u.t){for(c=0;c=o)break;a.push({value:_,label:_})}a.push({label:u.m.toFixed(1),align:"right",color:"green",value:u.m})}u&&u.c&&(a.push({label:u.c.toFixed(0),color:"orange",value:u.c}),l(1,o=Math.max(o,u.c))),l(1,o=Math.ceil(o)),l(0,i={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Vm,max:o,ticks:a},x:{ticks:f},points:p})}},[i,o,u]}class Ym extends Re{constructor(e){super(),Le(this,e,Km,Gm,Ee,{})}}function Tu(t,e,l){const n=t.slice();return n[20]=e[l],n[22]=l,n}function $u(t,e,l){const n=t.slice();return n[23]=e[l],n}function Nu(t){let e,l,n,i,o,u=t[7],c=[];for(let p=0;pt[15].call(e))},m(f,p){M(f,e,p),s(e,l),s(l,n),s(l,i),s(l,o),s(e,u),a&&a.m(e,null),c=vo(e,t[15].bind(e))},p(f,[p]){p&1024&&J(i,f[10]),f[7]?a?a.p(f,p):(a=Nu(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:pe,o:pe,d(f){f&&S(e),a&&a.d(),c()}}}let Xm=12;function Zm(t,e,l){let n=document.documentElement.classList.contains("dark"),i;t1.subscribe(y=>{l(12,i=y)});let o,u=0,c=0;function a(){o&&clearTimeout(o),o=setTimeout(a,1e4),i.data.unshift(c),l(12,i.data=i.data.slice(0,i.size),i),u+=10}Vc.subscribe(y=>{u==0&&(o&&clearTimeout(o),o=setTimeout(a,1e4)),c=y.i-y.e,u=y.u});let f,p,_,v,h,d,g,w,D,T,E,F,O;function R(){_=this.clientWidth,v=this.clientHeight,l(0,_),l(1,v)}return t.$$.update=()=>{if(t.$$.dirty&29183&&(l(2,h=parseInt(v)-50),l(3,d=_-35),l(9,F=d/i.size),l(14,p=0),l(13,f=0),i.data)){for(let A in i.data){let te=i.data[A];l(13,f=Math.max(Math.ceil(te/1e3)*1e3,f)),l(14,p=Math.min(Math.ceil(te/1e3)*1e3,p))}l(10,O=f>2500?"kW":"W"),l(7,T=[]);for(let A=p;A2500?(A/1e3).toFixed(1):A});l(8,E=[]);for(let A=p;A0||t[0].e>0}}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function Uu(t){let e,l,n;return l=new Ym({}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function ju(t){let e,l,n;return l=new Jm({}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function Hu(t){let e,l,n;return l=new Im({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function Wu(t){let e,l,n;return l=new Bm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function zu(t){let e,l,n;return l=new jm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function Gu(t){let e,l,n;return l=new zm({props:{json:t[5]}}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},p(i,o){const u={};o&32&&(u.json=i[5]),l.$set(u)},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function xm(t){let e,l=Xe(t[1].ui.i,t[0].i),n,i=Xe(t[1].ui.e,t[0].om||t[0].e>0),o,u=Xe(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),c,a=Xe(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,p=Xe(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,v=Xe(t[1].ui.c,t[0].ea),h,d=Xe(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),g,w=Xe(t[1].ui.l),D,T=Xe(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),E,F=Xe(t[1].ui.d,t[3]),O,R=Xe(t[1].ui.m,t[4]),y,A=Xe(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),te,W=l&&Ru(t),j=i&&Iu(t),U=u&&Ou(t),K=a&&Fu(t),Y=p&&Bu(t),G=v&&qu(t),Z=d&&Uu(),V=w&&ju(),H=T&&Hu(t),x=F&&Wu(t),ue=R&&zu(t),re=A&&Gu(t);return{c(){e=m("div"),W&&W.c(),n=b(),j&&j.c(),o=b(),U&&U.c(),c=b(),K&&K.c(),f=b(),Y&&Y.c(),_=b(),G&&G.c(),h=b(),Z&&Z.c(),g=b(),V&&V.c(),D=b(),H&&H.c(),E=b(),x&&x.c(),O=b(),ue&&ue.c(),y=b(),re&&re.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(Q,z){M(Q,e,z),W&&W.m(e,null),s(e,n),j&&j.m(e,null),s(e,o),U&&U.m(e,null),s(e,c),K&&K.m(e,null),s(e,f),Y&&Y.m(e,null),s(e,_),G&&G.m(e,null),s(e,h),Z&&Z.m(e,null),s(e,g),V&&V.m(e,null),s(e,D),H&&H.m(e,null),s(e,E),x&&x.m(e,null),s(e,O),ue&&ue.m(e,null),s(e,y),re&&re.m(e,null),te=!0},p(Q,[z]){z&3&&(l=Xe(Q[1].ui.i,Q[0].i)),l?W?(W.p(Q,z),z&3&&I(W,1)):(W=Ru(Q),W.c(),I(W,1),W.m(e,n)):W&&(Ae(),q(W,1,1,()=>{W=null}),Pe()),z&3&&(i=Xe(Q[1].ui.e,Q[0].om||Q[0].e>0)),i?j?(j.p(Q,z),z&3&&I(j,1)):(j=Iu(Q),j.c(),I(j,1),j.m(e,o)):j&&(Ae(),q(j,1,1,()=>{j=null}),Pe()),z&3&&(u=Xe(Q[1].ui.v,Q[0].u1>100||Q[0].u2>100||Q[0].u3>100)),u?U?(U.p(Q,z),z&3&&I(U,1)):(U=Ou(Q),U.c(),I(U,1),U.m(e,c)):U&&(Ae(),q(U,1,1,()=>{U=null}),Pe()),z&3&&(a=Xe(Q[1].ui.a,Q[0].i1>.01||Q[0].i2>.01||Q[0].i3>.01)),a?K?(K.p(Q,z),z&3&&I(K,1)):(K=Fu(Q),K.c(),I(K,1),K.m(e,f)):K&&(Ae(),q(K,1,1,()=>{K=null}),Pe()),z&3&&(p=Xe(Q[1].ui.r,Q[0].ri>0||Q[0].re>0||Q[0].ric>0||Q[0].rec>0)),p?Y?(Y.p(Q,z),z&3&&I(Y,1)):(Y=Bu(Q),Y.c(),I(Y,1),Y.m(e,_)):Y&&(Ae(),q(Y,1,1,()=>{Y=null}),Pe()),z&3&&(v=Xe(Q[1].ui.c,Q[0].ea)),v?G?(G.p(Q,z),z&3&&I(G,1)):(G=qu(Q),G.c(),I(G,1),G.m(e,h)):G&&(Ae(),q(G,1,1,()=>{G=null}),Pe()),z&3&&(d=Xe(Q[1].ui.t,Q[0].pr&&(Q[0].pr.startsWith("10YNO")||Q[0].pr.startsWith("10Y1001A1001A4")))),d?Z?z&3&&I(Z,1):(Z=Uu(),Z.c(),I(Z,1),Z.m(e,g)):Z&&(Ae(),q(Z,1,1,()=>{Z=null}),Pe()),z&2&&(w=Xe(Q[1].ui.l)),w?V?z&2&&I(V,1):(V=ju(),V.c(),I(V,1),V.m(e,D)):V&&(Ae(),q(V,1,1,()=>{V=null}),Pe()),z&3&&(T=Xe(Q[1].ui.p,Q[0].pe&&!Number.isNaN(Q[0].p))),T?H?(H.p(Q,z),z&3&&I(H,1)):(H=Hu(Q),H.c(),I(H,1),H.m(e,E)):H&&(Ae(),q(H,1,1,()=>{H=null}),Pe()),z&10&&(F=Xe(Q[1].ui.d,Q[3])),F?x?(x.p(Q,z),z&10&&I(x,1)):(x=Wu(Q),x.c(),I(x,1),x.m(e,O)):x&&(Ae(),q(x,1,1,()=>{x=null}),Pe()),z&18&&(R=Xe(Q[1].ui.m,Q[4])),R?ue?(ue.p(Q,z),z&18&&I(ue,1)):(ue=zu(Q),ue.c(),I(ue,1),ue.m(e,y)):ue&&(Ae(),q(ue,1,1,()=>{ue=null}),Pe()),z&35&&(A=Xe(Q[1].ui.s,Q[0].t&&Q[0].t!=-127&&Q[5].c>1)),A?re?(re.p(Q,z),z&35&&I(re,1)):(re=Gu(Q),re.c(),I(re,1),re.m(e,null)):re&&(Ae(),q(re,1,1,()=>{re=null}),Pe())},i(Q){te||(I(W),I(j),I(U),I(K),I(Y),I(G),I(Z),I(V),I(H),I(x),I(ue),I(re),te=!0)},o(Q){q(W),q(j),q(U),q(K),q(Y),q(G),q(Z),q(V),q(H),q(x),q(ue),q(re),te=!1},d(Q){Q&&S(e),W&&W.d(),j&&j.d(),U&&U.d(),K&&K.d(),Y&&Y.d(),G&&G.d(),Z&&Z.d(),V&&V.d(),H&&H.d(),x&&x.d(),ue&&ue.d(),re&&re.d()}}}function e_(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},u={},c={},a={};return Co.subscribe(f=>{l(2,o=f)}),Qc.subscribe(f=>{l(3,u=f)}),Xc.subscribe(f=>{l(4,c=f)}),Jc.subscribe(f=>{l(5,a=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,u,c,a]}class t_ extends Re{constructor(e){super(),Le(this,e,e_,xm,Ee,{data:0,sysinfo:1})}}let oo={};const gi=it(oo);async function l_(){oo=await(await fetch("configuration.json")).json(),gi.set(oo)}let ro={};const r1=it(ro);async function n_(){ro=await(await fetch("priceconfig.json")).json(),r1.set(ro)}function Vu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function i_(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function s_(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function Ku(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function Yu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=b(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){M(i,e,o),M(i,l,o),M(i,n,o)},d(i){i&&S(e),i&&S(l),i&&S(n)}}}function Qu(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function Xu(t){let e,l,n;return{c(){e=m("option"),l=N("GPIO"),n=N(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){M(i,e,o),s(e,l),s(e,n)},d(i){i&&S(e)}}}function Zu(t){let e,l=t[4]>1&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!((t[0]=="esp32s2"||t[0]=="esp32s3")&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Xu(t);return{c(){l&&l.c(),e=Ke()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,i){n[4]>1&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!((n[0]=="esp32s2"||n[0]=="esp32s3")&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Xu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&S(e)}}}function o_(t){let e,l,n,i,o;function u(d,g){return d[0]=="esp32c3"?s_:i_}let c=u(t),a=c(t),f=t[0]=="esp8266"&&Ku(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&Yu(),_=(t[0]=="esp32s2"||t[0]=="esp32s3")&&Qu(),v={length:t[1]+1},h=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32s3":l(1,i=46);break;case"esp32c3":l(1,i=19);break}},[n,i]}class ao extends Re{constructor(e){super(),Le(this,e,r_,o_,Ee,{chip:0})}}function Ju(t){let e,l,n=t[1]&&xu(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){M(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=xu(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&S(e),n&&n.d()}}}function xu(t){let e,l;return{c(){e=m("div"),l=N(t[1]),r(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){M(n,e,i),s(e,l)},p(n,i){i&2&&J(l,n[1])},d(n){n&&S(e)}}}function a_(t){let e,l=t[0]&&Ju(t);return{c(){l&&l.c(),e=Ke()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ju(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:pe,o:pe,d(n){l&&l.d(n),n&&S(e)}}}function u_(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class gt extends Re{constructor(e){super(),Le(this,e,u_,a_,Ee,{active:0,message:1})}}function ef(t,e,l){const n=t.slice();return n[1]=e[l],n}function tf(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=N("Europe/"),i=N(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){M(o,e,u),s(e,l),s(e,i)},p:pe,d(o){o&&S(e)}}}function f_(t){let e,l,n,i=t[0],o=[];for(let u=0;u>1&1,P=0;P0;C--)P[C]=P[C]?P[C-1]^O.EXPONENT[A._modN(O.LOG[P[C]]+$)]:P[C-1];P[0]=O.EXPONENT[A._modN(O.LOG[P[0]]+$)]}for($=0;$<=k;$++)P[$]=O.LOG[P[$]]},_checkBadness:function(){var $,C,k,P,L,X=0,le=this._badness,fe=this.buffer,de=this.width;for(L=0;Lde*de;)ae-=de*de,Oe++;for(X+=Oe*A.N4,P=0;P=le-2&&($=le-2,L>9&&$--);var fe=$;if(L>9){for(X[fe+2]=0,X[fe+3]=0;fe--;)C=X[fe],X[fe+3]|=255&C<<4,X[fe+2]=C>>4;X[2]|=255&$<<4,X[1]=$>>4,X[0]=64|$>>12}else{for(X[fe+1]=0,X[fe+2]=0;fe--;)C=X[fe],X[fe+2]|=255&C<<4,X[fe+1]=C>>4;X[1]|=255&$<<4,X[0]=64|$>>4}for(fe=$+3-(L<10);fe=5&&(k+=A.N1+P[C]-5);for(C=3;C<$-1;C+=2)P[C-2]===P[C+2]&&P[C+2]===P[C-1]&&P[C-1]===P[C+1]&&P[C-1]*3===P[C]&&(P[C-3]===0||C+3>$||P[C-3]*3>=P[C]*4||P[C+3]*3>=P[C]*4)&&(k+=A.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var $,C,k=0,P=3e4;for(C=0;C<8&&(this._applyMask(C),$=this._checkBadness(),$>=1)P&1&&(L[X-1-C+X*8]=1,C<6?L[8+X*C]=1:L[8+X*(C+1)]=1);for(C=0;C<7;C++,P>>=1)P&1&&(L[8+X*(X-7+C)]=1,C?L[6-C+X*8]=1:L[7+X*8]=1)},_interleaveBlocks:function(){var $,C,k=this._dataBlock,P=this._ecc,L=this._eccBlock,X=0,le=this._calculateMaxLength(),fe=this._neccBlock1,de=this._neccBlock2,Ce=this._stringBuffer;for($=0;$1)for($=D.BLOCK[P],k=L-7;;){for(C=L-7;C>$-3&&(this._addAlignment(C,k),!(C<$));)C-=$;if(k<=$+9)break;k-=$,this._addAlignment(6,k),this._addAlignment(k,6)}},_insertFinders:function(){var $,C,k,P,L=this.buffer,X=this.width;for($=0;$<3;$++){for(C=0,P=0,$===1&&(C=X-7),$===2&&(P=X-7),L[P+3+X*(C+3)]=1,k=0;k<6;k++)L[P+k+X*C]=1,L[P+X*(C+k+1)]=1,L[P+6+X*(C+k)]=1,L[P+k+1+X*(C+6)]=1;for(k=1;k<5;k++)this._setMask(P+k,C+1),this._setMask(P+1,C+k+1),this._setMask(P+5,C+k),this._setMask(P+k+1,C+5);for(k=2;k<4;k++)L[P+k+X*(C+2)]=1,L[P+2+X*(C+k+1)]=1,L[P+4+X*(C+k)]=1,L[P+k+1+X*(C+4)]=1}},_insertTimingGap:function(){var $,C,k=this.width;for(C=0;C<7;C++)this._setMask(7,C),this._setMask(k-8,C),this._setMask(7,C+k-7);for($=0;$<8;$++)this._setMask($,7),this._setMask($+k-8,7),this._setMask($,k-8)},_insertTimingRowAndColumn:function(){var $,C=this.buffer,k=this.width;for($=0;$6)for($=y.BLOCK[X-7],C=17,k=0;k<6;k++)for(P=0;P<3;P++,C--)1&(C>11?X>>C-12:$>>C)?(L[5-k+le*(2-P+le-11)]=1,L[2-P+le-11+le*(5-k)]=1):(this._setMask(5-k,2-P+le-11),this._setMask(2-P+le-11,5-k))},_isMasked:function($,C){var k=A._getMaskBit($,C);return this._mask[k]===1},_pack:function(){var $,C,k,P=1,L=1,X=this.width,le=X-1,fe=X-1,de=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(C=0;CC&&(k=$,$=C,C=k),k=C,k+=C*C,k>>=1,k+=$,k},_modN:function($){for(;$>=255;)$-=255,$=($>>8)+($&255);return $},N1:3,N2:3,N3:40,N4:10}),te=A,W=h.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var $=this.element;$.width=$.height=this.qrious.size}}),j=W,U=_.extend(function($,C,k,P){this.name=$,this.modifiable=Boolean(C),this.defaultValue=k,this._valueTransformer=P},{transform:function($){var C=this._valueTransformer;return typeof C=="function"?C($,this):$}}),K=U,Y=_.extend(null,{abs:function($){return $!=null?Math.abs($):null},hasOwn:function($,C){return Object.prototype.hasOwnProperty.call($,C)},noop:function(){},toUpperCase:function($){return $!=null?$.toUpperCase():null}}),G=Y,Z=_.extend(function($){this.options={},$.forEach(function(C){this.options[C.name]=C},this)},{exists:function($){return this.options[$]!=null},get:function($,C){return Z._get(this.options[$],C)},getAll:function($){var C,k=this.options,P={};for(C in k)G.hasOwn(k,C)&&(P[C]=Z._get(k[C],$));return P},init:function($,C,k){typeof k!="function"&&(k=G.noop);var P,L;for(P in this.options)G.hasOwn(this.options,P)&&(L=this.options[P],Z._set(L,L.defaultValue,C),Z._createAccessor(L,C,k));this._setAll($,C,!0)},set:function($,C,k){return this._set($,C,k)},setAll:function($,C){return this._setAll($,C)},_set:function($,C,k,P){var L=this.options[$];if(!L)throw new Error("Invalid option: "+$);if(!L.modifiable&&!P)throw new Error("Option cannot be modified: "+$);return Z._set(L,C,k)},_setAll:function($,C,k){if(!$)return!1;var P,L=!1;for(P in $)G.hasOwn($,P)&&this._set(P,$[P],C,k)&&(L=!0);return L}},{_createAccessor:function($,C,k){var P={get:function(){return Z._get($,C)}};$.modifiable&&(P.set=function(L){Z._set($,L,C)&&k(L,$)}),Object.defineProperty(C,$.name,P)},_get:function($,C){return C["_"+$.name]},_set:function($,C,k){var P="_"+$.name,L=k[P],X=$.transform(C!=null?C:$.defaultValue);return k[P]=X,X!==L}}),V=Z,H=_.extend(function(){this._services={}},{getService:function($){var C=this._services[$];if(!C)throw new Error("Service is not being managed with name: "+$);return C},setService:function($,C){if(this._services[$])throw new Error("Service is already managed with name: "+$);C&&(this._services[$]=C)}}),x=H,ue=new V([new K("background",!0,"white"),new K("backgroundAlpha",!0,1,G.abs),new K("element"),new K("foreground",!0,"black"),new K("foregroundAlpha",!0,1,G.abs),new K("level",!0,"L",G.toUpperCase),new K("mime",!0,"image/png"),new K("padding",!0,null,G.abs),new K("size",!0,100,G.abs),new K("value",!0,"")]),re=new x,Q=_.extend(function($){ue.init($,this,this.update.bind(this));var C=ue.get("element",this),k=re.getService("element"),P=C&&k.isCanvas(C)?C:k.createCanvas(),L=C&&k.isImage(C)?C:k.createImage();this._canvasRenderer=new g(this,P,!0),this._imageRenderer=new j(this,L,L===C),this.update()},{get:function(){return ue.getAll(this)},set:function($){ue.setAll($,this)&&this.update()},toDataURL:function($){return this.canvas.toDataURL($||this.mime)},update:function(){var $=new te({level:this.level,value:this.value});this._canvasRenderer.render($),this._imageRenderer.render($)}},{use:function($){re.setService($.getName(),$)}});Object.defineProperties(Q.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var z=Q,we=z,He=_.extend({getName:function(){}}),Ie=He,Se=Ie.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function($){},isImage:function($){}}),ye=Se,he=ye.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function($){return $ instanceof HTMLCanvasElement},isImage:function($){return $ instanceof HTMLImageElement}}),$e=he;we.use(new $e);var be=we;return be})})(u1);const h_=u1.exports;function v_(t){let e,l;return{c(){e=m("img"),ps(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){M(n,e,i)},p(n,[i]){i&4&&!ps(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:pe,o:pe,d(n){n&&S(e)}}}function b_(t,e,l){const n=new h_;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:c="200"}=e,{value:a=""}=e,{padding:f=0}=e,{className:p="qrcode"}=e,_="";function v(){n.set({background:o,foreground:u,level:i,padding:f,size:c,value:a}),l(2,_=n.toDataURL("image/jpeg"))}return dc(()=>{v()}),t.$$set=h=>{"errorCorrection"in h&&l(3,i=h.errorCorrection),"background"in h&&l(4,o=h.background),"color"in h&&l(5,u=h.color),"size"in h&&l(6,c=h.size),"value"in h&&l(0,a=h.value),"padding"in h&&l(7,f=h.padding),"className"in h&&l(1,p=h.className)},t.$$.update=()=>{t.$$.dirty&1&&a&&v()},[a,p,_,i,o,u,c,f]}class g_ extends Re{constructor(e){super(),Le(this,e,b_,v_,Ee,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function lf(t,e,l){const n=t.slice();return n[101]=e[l],n[102]=e,n[103]=l,n}function nf(t,e,l){const n=t.slice();return n[104]=e[l],n[105]=e,n[106]=l,n}function k_(t,e,l){const n=t.slice();return n[107]=e[l],n}function w_(t,e,l){const n=t.slice();return n[110]=e[l],n}function y_(t){let e,l;return{c(){e=m("option"),l=N(t[110]),e.__value=t[110],e.value=e.__value},m(n,i){M(n,e,i),s(e,l)},p:pe,d(n){n&&S(e)}}}function C_(t){let e;return{c(){e=N("Configure price")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function sf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){M(o,e,u),M(o,l,u),oe(l,t[3].p.t),n||(i=ee(l,"input",t[21]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].p.t&&oe(l,o[3].p.t)},d(o){o&&S(e),o&&S(l),n=!1,i()}}}function of(t){let e,l,n,i,o,u,c,a,f,p,_,v,h;return{c(){e=m("div"),l=N("Username"),n=m("br"),i=b(),o=m("input"),u=b(),c=m("div"),a=N("Password"),f=m("br"),p=b(),_=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(o,"maxlength","36"),r(e,"class","my-1"),r(_,"name","gp"),r(_,"type","password"),r(_,"class","in-s"),r(_,"maxlength","36"),r(c,"class","my-1")},m(d,g){M(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].g.u),M(d,u,g),M(d,c,g),s(c,a),s(c,f),s(c,p),s(c,_),oe(_,t[3].g.p),v||(h=[ee(o,"input",t[23]),ee(_,"input",t[24])],v=!0)},p(d,g){g[0]&8&&o.value!==d[3].g.u&&oe(o,d[3].g.u),g[0]&8&&_.value!==d[3].g.p&&oe(_,d[3].g.p)},d(d){d&&S(e),d&&S(u),d&&S(c),v=!1,Ge(h)}}}function S_(t){let e,l=t[107]*100+"",n;return{c(){e=m("option"),n=N(l),e.__value=t[107]*100,e.value=e.__value},m(i,o){M(i,e,o),s(e,n)},p:pe,d(i){i&&S(e)}}}function rf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,u){M(o,e,u),M(o,l,u),oe(l,t[3].m.e.k),n||(i=ee(l,"input",t[35]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].m.e.k&&oe(l,o[3].m.e.k)},d(o){o&&S(e),o&&S(l),n=!1,i()}}}function af(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N("Authentication key"),n=m("br"),i=b(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].m.e.a),u||(c=ee(o,"input",t[36]),u=!0)},p(a,f){f[0]&8&&o.value!==a[3].m.e.a&&oe(o,a[3].m.e.a)},d(a){a&&S(e),u=!1,c()}}}function uf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W;return{c(){e=m("div"),l=m("div"),n=N("Watt"),i=m("br"),o=b(),u=m("input"),c=b(),a=m("div"),f=N("Volt"),p=m("br"),_=b(),v=m("input"),h=b(),d=m("div"),g=N("Amp"),w=m("br"),D=b(),T=m("input"),E=b(),F=m("div"),O=N("kWh"),R=m("br"),y=b(),A=m("input"),r(u,"name","mmw"),r(u,"type","number"),r(u,"min","0.00"),r(u,"max","1000"),r(u,"step","0.001"),r(u,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(v,"name","mmv"),r(v,"type","number"),r(v,"min","0.00"),r(v,"max","1000"),r(v,"step","0.001"),r(v,"class","in-m tr w-full"),r(a,"class","w-1/4"),r(T,"name","mma"),r(T,"type","number"),r(T,"min","0.00"),r(T,"max","1000"),r(T,"step","0.001"),r(T,"class","in-m tr w-full"),r(d,"class","w-1/4"),r(A,"name","mmc"),r(A,"type","number"),r(A,"min","0.00"),r(A,"max","1000"),r(A,"step","0.001"),r(A,"class","in-l tr w-full"),r(F,"class","w-1/4"),r(e,"class","flex my-1")},m(j,U){M(j,e,U),s(e,l),s(l,n),s(l,i),s(l,o),s(l,u),oe(u,t[3].m.m.w),s(e,c),s(e,a),s(a,f),s(a,p),s(a,_),s(a,v),oe(v,t[3].m.m.v),s(e,h),s(e,d),s(d,g),s(d,w),s(d,D),s(d,T),oe(T,t[3].m.m.a),s(e,E),s(e,F),s(F,O),s(F,R),s(F,y),s(F,A),oe(A,t[3].m.m.c),te||(W=[ee(u,"input",t[38]),ee(v,"input",t[39]),ee(T,"input",t[40]),ee(A,"input",t[41])],te=!0)},p(j,U){U[0]&8&&ge(u.value)!==j[3].m.m.w&&oe(u,j[3].m.m.w),U[0]&8&&ge(v.value)!==j[3].m.m.v&&oe(v,j[3].m.m.v),U[0]&8&&ge(T.value)!==j[3].m.m.a&&oe(T,j[3].m.m.a),U[0]&8&&ge(A.value)!==j[3].m.m.c&&oe(A,j[3].m.m.c)},d(j){j&&S(e),te=!1,Ge(W)}}}function ff(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function cf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z,V,H,x,ue,re,Q;return{c(){e=m("div"),l=N("SSID"),n=m("br"),i=b(),o=m("input"),u=b(),c=m("div"),a=N("Password"),f=m("br"),p=b(),_=m("input"),v=b(),h=m("div"),d=m("div"),g=N("Power saving"),w=m("br"),D=b(),T=m("select"),E=m("option"),E.textContent="Default",F=m("option"),F.textContent="Off",O=m("option"),O.textContent="Minimum",R=m("option"),R.textContent="Maximum",y=b(),A=m("div"),te=N("Power"),W=m("br"),j=b(),U=m("div"),K=m("input"),Y=b(),G=m("span"),G.textContent="dBm",Z=b(),V=m("div"),H=m("label"),x=m("input"),ue=N(" Allow 802.11b legacy rates"),r(o,"name","ws"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(_,"name","wp"),r(_,"type","password"),r(_,"class","in-s"),r(c,"class","my-1"),E.__value=255,E.value=E.__value,F.__value=0,F.value=F.__value,O.__value=1,O.value=O.__value,R.__value=2,R.value=R.__value,r(T,"name","wz"),r(T,"class","in-s"),t[3].w.z===void 0&&ze(()=>t[45].call(T)),r(d,"class","w-1/2"),r(K,"name","ww"),r(K,"type","number"),r(K,"min","0"),r(K,"max","20.5"),r(K,"step","0.5"),r(K,"class","in-f tr w-full"),r(G,"class","in-post"),r(U,"class","flex"),r(A,"class","ml-2 w-1/2"),r(h,"class","my-1 flex"),r(x,"type","checkbox"),r(x,"name","wb"),x.__value="true",x.value=x.__value,r(x,"class","rounded mb-1"),r(V,"class","my-3")},m(z,we){M(z,e,we),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].w.s),M(z,u,we),M(z,c,we),s(c,a),s(c,f),s(c,p),s(c,_),oe(_,t[3].w.p),M(z,v,we),M(z,h,we),s(h,d),s(d,g),s(d,w),s(d,D),s(d,T),s(T,E),s(T,F),s(T,O),s(T,R),Me(T,t[3].w.z,!0),s(h,y),s(h,A),s(A,te),s(A,W),s(A,j),s(A,U),s(U,K),oe(K,t[3].w.w),s(U,Y),s(U,G),M(z,Z,we),M(z,V,we),s(V,H),s(H,x),x.checked=t[3].w.b,s(H,ue),re||(Q=[ee(o,"input",t[43]),ee(_,"input",t[44]),ee(T,"change",t[45]),ee(K,"input",t[46]),ee(x,"change",t[47])],re=!0)},p(z,we){we[0]&8&&o.value!==z[3].w.s&&oe(o,z[3].w.s),we[0]&8&&_.value!==z[3].w.p&&oe(_,z[3].w.p),we[0]&8&&Me(T,z[3].w.z),we[0]&8&&ge(K.value)!==z[3].w.w&&oe(K,z[3].w.w),we[0]&8&&(x.checked=z[3].w.b)},d(z){z&&S(e),z&&S(u),z&&S(c),z&&S(v),z&&S(h),z&&S(Z),z&&S(V),re=!1,Ge(Q)}}}function mf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w;return{c(){e=m("div"),l=N("Gateway"),n=m("br"),i=b(),o=m("input"),u=b(),c=m("div"),a=N("DNS"),f=m("br"),p=b(),_=m("div"),v=m("input"),h=b(),d=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(v,"name","nd1"),r(v,"type","text"),r(v,"class","in-f w-full"),r(d,"name","nd2"),r(d,"type","text"),r(d,"class","in-l w-full"),r(_,"class","flex"),r(c,"class","my-1")},m(D,T){M(D,e,T),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].n.g),M(D,u,T),M(D,c,T),s(c,a),s(c,f),s(c,p),s(c,_),s(_,v),oe(v,t[3].n.d1),s(_,h),s(_,d),oe(d,t[3].n.d2),g||(w=[ee(o,"input",t[51]),ee(v,"input",t[52]),ee(d,"input",t[53])],g=!0)},p(D,T){T[0]&8&&o.value!==D[3].n.g&&oe(o,D[3].n.g),T[0]&8&&v.value!==D[3].n.d1&&oe(v,D[3].n.d1),T[0]&8&&d.value!==D[3].n.d2&&oe(d,D[3].n.d2)},d(D){D&&S(e),D&&S(u),D&&S(c),g=!1,Ge(w)}}}function _f(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=N(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(u,c){M(u,e,c),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[ee(l,"change",t[57]),ee(l,"change",t[14])],i=!0)},p(u,c){c[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&S(e),i=!1,Ge(o)}}}function pf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h;const d=[T_,M_],g=[];function w(y,A){return y[3].q.s.c?0:1}n=w(t),i=g[n]=d[n](t);const D=[A_,E_],T=[];function E(y,A){return y[3].q.s.r?0:1}c=E(t),a=T[c]=D[c](t);const F=[R_,L_],O=[];function R(y,A){return y[3].q.s.k?0:1}return _=R(t),v=O[_]=F[_](t),{c(){e=m("div"),l=m("span"),i.c(),o=b(),u=m("span"),a.c(),f=b(),p=m("span"),v.c(),r(l,"class","flex pr-2"),r(u,"class","flex pr-2"),r(p,"class","flex pr-2"),r(e,"class","my-1 flex")},m(y,A){M(y,e,A),s(e,l),g[n].m(l,null),s(e,o),s(e,u),T[c].m(u,null),s(e,f),s(e,p),O[_].m(p,null),h=!0},p(y,A){let te=n;n=w(y),n===te?g[n].p(y,A):(Ae(),q(g[te],1,1,()=>{g[te]=null}),Pe(),i=g[n],i?i.p(y,A):(i=g[n]=d[n](y),i.c()),I(i,1),i.m(l,null));let W=c;c=E(y),c===W?T[c].p(y,A):(Ae(),q(T[W],1,1,()=>{T[W]=null}),Pe(),a=T[c],a?a.p(y,A):(a=T[c]=D[c](y),a.c()),I(a,1),a.m(u,null));let j=_;_=R(y),_===j?O[_].p(y,A):(Ae(),q(O[j],1,1,()=>{O[j]=null}),Pe(),v=O[_],v?v.p(y,A):(v=O[_]=F[_](y),v.c()),I(v,1),v.m(p,null))},i(y){h||(I(i),I(a),I(v),h=!0)},o(y){q(i),q(a),q(v),h=!1},d(y){y&&S(e),g[n].d(),T[c].d(),O[_].d()}}}function M_(t){let e,l;return e=new Xt({props:{to:"/mqtt-ca",$$slots:{default:[$_]},$$scope:{ctx:t}}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function T_(t){let e,l,n,i,o,u,c,a;return l=new Xt({props:{to:"/mqtt-ca",$$slots:{default:[N_]},$$scope:{ctx:t}}}),o=new ys({}),{c(){e=m("span"),se(l.$$.fragment),n=b(),i=m("span"),se(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),ne(l,e,null),M(f,n,p),M(f,i,p),ne(o,i,null),u=!0,c||(a=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],c=!0)},p(f,p){const _={};p[3]&1048576&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(I(l.$$.fragment,f),I(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&S(e),ie(l),f&&S(n),f&&S(i),ie(o),c=!1,Ge(a)}}}function $_(t){let e,l;return e=new un({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function N_(t){let e;return{c(){e=N("CA OK")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function E_(t){let e,l;return e=new Xt({props:{to:"/mqtt-cert",$$slots:{default:[P_]},$$scope:{ctx:t}}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function A_(t){let e,l,n,i,o,u,c,a;return l=new Xt({props:{to:"/mqtt-cert",$$slots:{default:[D_]},$$scope:{ctx:t}}}),o=new ys({}),{c(){e=m("span"),se(l.$$.fragment),n=b(),i=m("span"),se(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),ne(l,e,null),M(f,n,p),M(f,i,p),ne(o,i,null),u=!0,c||(a=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],c=!0)},p(f,p){const _={};p[3]&1048576&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(I(l.$$.fragment,f),I(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&S(e),ie(l),f&&S(n),f&&S(i),ie(o),c=!1,Ge(a)}}}function P_(t){let e,l;return e=new un({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function D_(t){let e;return{c(){e=N("Cert OK")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function L_(t){let e,l;return e=new Xt({props:{to:"/mqtt-key",$$slots:{default:[I_]},$$scope:{ctx:t}}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function R_(t){let e,l,n,i,o,u,c,a;return l=new Xt({props:{to:"/mqtt-key",$$slots:{default:[O_]},$$scope:{ctx:t}}}),o=new ys({}),{c(){e=m("span"),se(l.$$.fragment),n=b(),i=m("span"),se(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),ne(l,e,null),M(f,n,p),M(f,i,p),ne(o,i,null),u=!0,c||(a=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],c=!0)},p(f,p){const _={};p[3]&1048576&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(I(l.$$.fragment,f),I(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&S(e),ie(l),f&&S(n),f&&S(i),ie(o),c=!1,Ge(a)}}}function I_(t){let e,l;return e=new un({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function O_(t){let e;return{c(){e=N("Key OK")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function df(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z;return o=new Lt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=b(),i=m("a"),se(o.$$.fragment),u=b(),c=m("input"),a=b(),f=m("div"),p=m("div"),_=N("Electricity IDX"),v=m("br"),h=b(),d=m("input"),g=b(),w=m("div"),D=N("Current IDX"),T=m("br"),E=b(),F=m("input"),O=b(),R=m("div"),y=N(`Voltage IDX: L1, L2 & L3 - `),A=m("div"),te=m("input"),W=b(),j=m("input"),U=b(),K=m("input"),r(l,"class","text-sm"),r(i,"href",Rt("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"type","hidden"),r(c,"name","o"),c.value="true",r(d,"name","oe"),r(d,"type","text"),r(d,"class","in-f tr w-full"),r(p,"class","w-1/2"),r(F,"name","oc"),r(F,"type","text"),r(F,"class","in-l tr w-full"),r(w,"class","w-1/2"),r(f,"class","my-1 flex"),r(te,"name","ou1"),r(te,"type","text"),r(te,"class","in-f tr w-1/3"),r(j,"name","ou2"),r(j,"type","text"),r(j,"class","in-m tr w-1/3"),r(K,"name","ou3"),r(K,"type","text"),r(K,"class","in-l tr w-1/3"),r(A,"class","flex"),r(R,"class","my-1"),r(e,"class","cnt")},m(V,H){M(V,e,H),s(e,l),s(e,n),s(e,i),ne(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(p,_),s(p,v),s(p,h),s(p,d),oe(d,t[3].o.e),s(f,g),s(f,w),s(w,D),s(w,T),s(w,E),s(w,F),oe(F,t[3].o.c),s(e,O),s(e,R),s(R,y),s(R,A),s(A,te),oe(te,t[3].o.u1),s(A,W),s(A,j),oe(j,t[3].o.u2),s(A,U),s(A,K),oe(K,t[3].o.u3),Y=!0,G||(Z=[ee(d,"input",t[65]),ee(F,"input",t[66]),ee(te,"input",t[67]),ee(j,"input",t[68]),ee(K,"input",t[69])],G=!0)},p(V,H){H[0]&8&&d.value!==V[3].o.e&&oe(d,V[3].o.e),H[0]&8&&F.value!==V[3].o.c&&oe(F,V[3].o.c),H[0]&8&&te.value!==V[3].o.u1&&oe(te,V[3].o.u1),H[0]&8&&j.value!==V[3].o.u2&&oe(j,V[3].o.u2),H[0]&8&&K.value!==V[3].o.u3&&oe(K,V[3].o.u3)},i(V){Y||(I(o.$$.fragment,V),Y=!0)},o(V){q(o.$$.fragment,V),Y=!1},d(V){V&&S(e),ie(o),G=!1,Ge(Z)}}}function hf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K;return o=new Lt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=b(),i=m("a"),se(o.$$.fragment),u=b(),c=m("input"),a=b(),f=m("div"),p=N("Discovery topic prefix"),_=m("br"),v=b(),h=m("input"),d=b(),g=m("div"),w=N("Hostname for URL"),D=m("br"),T=b(),E=m("input"),O=b(),R=m("div"),y=N("Name tag"),A=m("br"),te=b(),W=m("input"),r(l,"class","text-sm"),r(i,"href",Rt("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"type","hidden"),r(c,"name","h"),c.value="true",r(h,"name","ht"),r(h,"type","text"),r(h,"class","in-s"),r(h,"placeholder","homeassistant"),r(f,"class","my-1"),r(E,"name","hh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"placeholder",F=t[3].g.h+".local"),r(g,"class","my-1"),r(W,"name","hn"),r(W,"type","text"),r(W,"class","in-s"),r(R,"class","my-1"),r(e,"class","cnt")},m(Y,G){M(Y,e,G),s(e,l),s(e,n),s(e,i),ne(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(f,_),s(f,v),s(f,h),oe(h,t[3].h.t),s(e,d),s(e,g),s(g,w),s(g,D),s(g,T),s(g,E),oe(E,t[3].h.h),s(e,O),s(e,R),s(R,y),s(R,A),s(R,te),s(R,W),oe(W,t[3].h.n),j=!0,U||(K=[ee(h,"input",t[70]),ee(E,"input",t[71]),ee(W,"input",t[72])],U=!0)},p(Y,G){G[0]&8&&h.value!==Y[3].h.t&&oe(h,Y[3].h.t),(!j||G[0]&8&&F!==(F=Y[3].g.h+".local"))&&r(E,"placeholder",F),G[0]&8&&E.value!==Y[3].h.h&&oe(E,Y[3].h.h),G[0]&8&&W.value!==Y[3].h.n&&oe(W,Y[3].h.n)},i(Y){j||(I(o.$$.fragment,Y),j=!0)},o(Y){q(o.$$.fragment,Y),j=!1},d(Y){Y&&S(e),ie(o),U=!1,Ge(K)}}}function vf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O;o=new Lt({});let R=t[3].c.es&&bf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Cloud connections",n=b(),i=m("a"),se(o.$$.fragment),u=b(),c=m("input"),a=b(),f=m("div"),p=m("label"),_=m("input"),v=N(" AMSreader cloud"),h=b(),d=m("div"),g=m("label"),w=m("input"),D=N(" Energy Speedometer"),T=b(),R&&R.c(),r(l,"class","text-sm"),r(i,"href",Rt("Cloud")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"type","hidden"),r(c,"name","c"),c.value="true",r(_,"type","checkbox"),r(_,"name","ce"),_.__value="true",_.value=_.__value,r(_,"class","rounded mb-1"),r(f,"class","my-1"),r(w,"type","checkbox"),r(w,"class","rounded mb-1"),r(w,"name","ces"),w.__value="true",w.value=w.__value,r(d,"class","my-1"),r(e,"class","cnt")},m(y,A){M(y,e,A),s(e,l),s(e,n),s(e,i),ne(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(p,_),_.checked=t[3].c.e,s(p,v),s(e,h),s(e,d),s(d,g),s(g,w),w.checked=t[3].c.es,s(g,D),s(d,T),R&&R.m(d,null),E=!0,F||(O=[ee(_,"change",t[73]),ee(w,"change",t[74])],F=!0)},p(y,A){A[0]&8&&(_.checked=y[3].c.e),A[0]&8&&(w.checked=y[3].c.es),y[3].c.es?R?(R.p(y,A),A[0]&8&&I(R,1)):(R=bf(y),R.c(),I(R,1),R.m(d,null)):R&&(Ae(),q(R,1,1,()=>{R=null}),Pe())},i(y){E||(I(o.$$.fragment,y),I(R),E=!0)},o(y){q(o.$$.fragment,y),q(R),E=!1},d(y){y&&S(e),ie(o),R&&R.d(),F=!1,Ge(O)}}}function bf(t){let e,l,n=t[0].mac+"",i,o,u,c,a=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,p,_,v,h=t[0].mac&&t[0].meter.id&&gf(t);return{c(){e=m("div"),l=N("MAC: "),i=N(n),o=b(),u=m("div"),c=N("Meter ID: "),f=N(a),p=b(),h&&h.c(),_=Ke(),r(e,"class","pl-5"),r(u,"class","pl-5")},m(d,g){M(d,e,g),s(e,l),s(e,i),M(d,o,g),M(d,u,g),s(u,c),s(u,f),M(d,p,g),h&&h.m(d,g),M(d,_,g),v=!0},p(d,g){(!v||g[0]&1)&&n!==(n=d[0].mac+"")&&J(i,n),(!v||g[0]&1)&&a!==(a=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&J(f,a),d[0].mac&&d[0].meter.id?h?(h.p(d,g),g[0]&1&&I(h,1)):(h=gf(d),h.c(),I(h,1),h.m(_.parentNode,_)):h&&(Ae(),q(h,1,1,()=>{h=null}),Pe())},i(d){v||(I(h),v=!0)},o(d){q(h),v=!1},d(d){d&&S(e),d&&S(o),d&&S(u),d&&S(p),h&&h.d(d),d&&S(_)}}}function gf(t){let e,l,n;return l=new g_({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","pl-2")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function kf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E;o=new Lt({});let F={length:9},O=[];for(let R=0;R20&&Sf(t),_=t[3].i.d.d>0&&$f(t),v=t[0].chip=="esp8266"&&Nf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=b(),i=m("a"),se(o.$$.fragment),u=b(),p&&p.c(),c=b(),_&&_.c(),a=b(),v&&v.c(),r(l,"class","text-sm"),r(i,"href",Rt("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(h,d){M(h,e,d),s(e,l),s(e,n),s(e,i),ne(o,i,null),s(e,u),p&&p.m(e,null),s(e,c),_&&_.m(e,null),s(e,a),v&&v.m(e,null),f=!0},p(h,d){h[0].board>20?p?(p.p(h,d),d[0]&1&&I(p,1)):(p=Sf(h),p.c(),I(p,1),p.m(e,c)):p&&(Ae(),q(p,1,1,()=>{p=null}),Pe()),h[3].i.d.d>0?_?_.p(h,d):(_=$f(h),_.c(),_.m(e,a)):_&&(_.d(1),_=null),h[0].chip=="esp8266"?v?v.p(h,d):(v=Nf(h),v.c(),v.m(e,null)):v&&(v.d(1),v=null)},i(h){f||(I(o.$$.fragment,h),I(p),f=!0)},o(h){q(o.$$.fragment,h),q(p),f=!1},d(h){h&&S(e),ie(o),p&&p.d(),_&&_.d(),v&&v.d()}}}function Sf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z,V,H,x,ue,re,Q,z,we,He,Ie,Se,ye,he,$e,be,$,C,k,P,L,X,le,fe,de,Ce,Oe,ae,Te,Je,It,st,kt,nt,Ot,Qe,Zt,zt,ht,xe,Ve,Ye,Ne,Ze,et;f=new ao({props:{chip:t[0].chip}}),w=new ao({props:{chip:t[0].chip}});let Be=t[0].chip!="esp8266"&&Mf(t),Fe=t[3].i.v.p>0&&Tf(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=N("HAN RX"),u=m("br"),c=b(),a=m("select"),se(f.$$.fragment),p=b(),_=m("div"),v=N("HAN TX"),h=m("br"),d=b(),g=m("select"),se(w.$$.fragment),D=b(),T=m("div"),E=m("label"),F=m("input"),O=N(" pullup"),R=b(),y=m("div"),A=m("div"),te=N("AP button"),W=m("br"),j=b(),U=m("input"),K=b(),Y=m("div"),G=N("LED"),Z=m("br"),V=b(),H=m("div"),x=m("input"),ue=b(),re=m("div"),Q=m("label"),z=m("input"),we=N(" inverted"),He=b(),Ie=m("div"),Se=N("RGB"),ye=m("label"),he=m("input"),$e=N(" inverted"),be=m("br"),$=b(),C=m("div"),k=m("input"),P=b(),L=m("input"),X=b(),le=m("input"),fe=b(),de=m("div"),Ce=m("div"),Oe=N(`LED dis. GPIO - `),ae=m("input"),Te=b(),Je=m("div"),It=N("Temperature"),st=m("br"),kt=b(),nt=m("input"),Ot=b(),Qe=m("div"),Zt=N("Analog temp"),zt=m("br"),ht=b(),xe=m("input"),Ve=b(),Be&&Be.c(),Ye=b(),Fe&&Fe.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(a,"name","ihp"),r(a,"class","in-f w-full"),t[3].i.h.p===void 0&&ze(()=>t[78].call(a)),r(i,"class","w-1/3"),r(g,"name","iht"),r(g,"class","in-l w-full"),t[3].i.h.t===void 0&&ze(()=>t[79].call(g)),r(_,"class","w-1/3"),r(F,"name","ihu"),F.__value="true",F.value=F.__value,r(F,"type","checkbox"),r(F,"class","rounded mb-1"),r(E,"class","ml-2"),r(T,"class","w-1/3"),r(n,"class","flex flex-wrap"),r(U,"name","ia"),r(U,"type","number"),r(U,"min","0"),r(U,"max",t[6]),r(U,"class","in-f tr w-full"),r(A,"class","w-1/3"),r(x,"name","ilp"),r(x,"type","number"),r(x,"min","0"),r(x,"max",t[6]),r(x,"class","in-l tr w-full"),r(H,"class","flex"),r(Y,"class","w-1/3"),r(z,"name","ili"),z.__value="true",z.value=z.__value,r(z,"type","checkbox"),r(z,"class","rounded mb-1"),r(Q,"class","ml-4"),r(re,"class","w-1/3"),r(he,"name","iri"),he.__value="true",he.value=he.__value,r(he,"type","checkbox"),r(he,"class","rounded mb-1"),r(ye,"class","ml-4"),r(k,"name","irr"),r(k,"type","number"),r(k,"min","0"),r(k,"max",t[6]),r(k,"class","in-f tr w-1/3"),r(L,"name","irg"),r(L,"type","number"),r(L,"min","0"),r(L,"max",t[6]),r(L,"class","in-m tr w-1/3"),r(le,"name","irb"),r(le,"type","number"),r(le,"min","0"),r(le,"max",t[6]),r(le,"class","in-l tr w-1/3"),r(C,"class","flex"),r(Ie,"class","w-full"),r(ae,"name","idd"),r(ae,"type","number"),r(ae,"min","0"),r(ae,"max",t[6]),r(ae,"class","in-s tr"),r(Ce,"class","my-1 pr-1 w-1/3"),r(de,"class","w-full"),r(nt,"name","itd"),r(nt,"type","number"),r(nt,"min","0"),r(nt,"max",t[6]),r(nt,"class","in-f tr w-full"),r(Je,"class","my-1 w-1/3"),r(xe,"name","ita"),r(xe,"type","number"),r(xe,"min","0"),r(xe,"max",t[6]),r(xe,"class","in-l tr w-full"),r(Qe,"class","my-1 pr-1 w-1/3"),r(y,"class","flex flex-wrap")},m(_e,ce){M(_e,e,ce),M(_e,l,ce),M(_e,n,ce),s(n,i),s(i,o),s(i,u),s(i,c),s(i,a),ne(f,a,null),Me(a,t[3].i.h.p,!0),s(n,p),s(n,_),s(_,v),s(_,h),s(_,d),s(_,g),ne(w,g,null),Me(g,t[3].i.h.t,!0),s(n,D),s(n,T),s(T,E),s(E,F),F.checked=t[3].i.h.u,s(E,O),M(_e,R,ce),M(_e,y,ce),s(y,A),s(A,te),s(A,W),s(A,j),s(A,U),oe(U,t[3].i.a),s(y,K),s(y,Y),s(Y,G),s(Y,Z),s(Y,V),s(Y,H),s(H,x),oe(x,t[3].i.l.p),s(y,ue),s(y,re),s(re,Q),s(Q,z),z.checked=t[3].i.l.i,s(Q,we),s(y,He),s(y,Ie),s(Ie,Se),s(Ie,ye),s(ye,he),he.checked=t[3].i.r.i,s(ye,$e),s(Ie,be),s(Ie,$),s(Ie,C),s(C,k),oe(k,t[3].i.r.r),s(C,P),s(C,L),oe(L,t[3].i.r.g),s(C,X),s(C,le),oe(le,t[3].i.r.b),s(y,fe),s(y,de),s(de,Ce),s(Ce,Oe),s(Ce,ae),oe(ae,t[3].i.d.d),s(y,Te),s(y,Je),s(Je,It),s(Je,st),s(Je,kt),s(Je,nt),oe(nt,t[3].i.t.d),s(y,Ot),s(y,Qe),s(Qe,Zt),s(Qe,zt),s(Qe,ht),s(Qe,xe),oe(xe,t[3].i.t.a),s(y,Ve),Be&&Be.m(y,null),s(y,Ye),Fe&&Fe.m(y,null),Ne=!0,Ze||(et=[ee(a,"change",t[78]),ee(g,"change",t[79]),ee(F,"change",t[80]),ee(U,"input",t[81]),ee(x,"input",t[82]),ee(z,"change",t[83]),ee(he,"change",t[84]),ee(k,"input",t[85]),ee(L,"input",t[86]),ee(le,"input",t[87]),ee(ae,"input",t[88]),ee(nt,"input",t[89]),ee(xe,"input",t[90])],Ze=!0)},p(_e,ce){const qe={};ce[0]&1&&(qe.chip=_e[0].chip),f.$set(qe),ce[0]&8&&Me(a,_e[3].i.h.p);const pt={};ce[0]&1&&(pt.chip=_e[0].chip),w.$set(pt),ce[0]&8&&Me(g,_e[3].i.h.t),ce[0]&8&&(F.checked=_e[3].i.h.u),(!Ne||ce[0]&64)&&r(U,"max",_e[6]),ce[0]&8&&ge(U.value)!==_e[3].i.a&&oe(U,_e[3].i.a),(!Ne||ce[0]&64)&&r(x,"max",_e[6]),ce[0]&8&&ge(x.value)!==_e[3].i.l.p&&oe(x,_e[3].i.l.p),ce[0]&8&&(z.checked=_e[3].i.l.i),ce[0]&8&&(he.checked=_e[3].i.r.i),(!Ne||ce[0]&64)&&r(k,"max",_e[6]),ce[0]&8&&ge(k.value)!==_e[3].i.r.r&&oe(k,_e[3].i.r.r),(!Ne||ce[0]&64)&&r(L,"max",_e[6]),ce[0]&8&&ge(L.value)!==_e[3].i.r.g&&oe(L,_e[3].i.r.g),(!Ne||ce[0]&64)&&r(le,"max",_e[6]),ce[0]&8&&ge(le.value)!==_e[3].i.r.b&&oe(le,_e[3].i.r.b),(!Ne||ce[0]&64)&&r(ae,"max",_e[6]),ce[0]&8&&ge(ae.value)!==_e[3].i.d.d&&oe(ae,_e[3].i.d.d),(!Ne||ce[0]&64)&&r(nt,"max",_e[6]),ce[0]&8&&ge(nt.value)!==_e[3].i.t.d&&oe(nt,_e[3].i.t.d),(!Ne||ce[0]&64)&&r(xe,"max",_e[6]),ce[0]&8&&ge(xe.value)!==_e[3].i.t.a&&oe(xe,_e[3].i.t.a),_e[0].chip!="esp8266"?Be?Be.p(_e,ce):(Be=Mf(_e),Be.c(),Be.m(y,Ye)):Be&&(Be.d(1),Be=null),_e[3].i.v.p>0?Fe?Fe.p(_e,ce):(Fe=Tf(_e),Fe.c(),Fe.m(y,null)):Fe&&(Fe.d(1),Fe=null)},i(_e){Ne||(I(f.$$.fragment,_e),I(w.$$.fragment,_e),Ne=!0)},o(_e){q(f.$$.fragment,_e),q(w.$$.fragment,_e),Ne=!1},d(_e){_e&&S(e),_e&&S(l),_e&&S(n),ie(f),ie(w),_e&&S(R),_e&&S(y),Be&&Be.d(),Fe&&Fe.d(),Ze=!1,Ge(et)}}}function Mf(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N("Vcc"),n=m("br"),i=b(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].i.v.p),u||(c=ee(o,"input",t[91]),u=!0)},p(a,f){f[0]&64&&r(o,"max",a[6]),f[0]&8&&ge(o.value)!==a[3].i.v.p&&oe(o,a[3].i.v.p)},d(a){a&&S(e),u=!1,c()}}}function Tf(t){let e,l,n,i,o,u,c,a,f,p;return{c(){e=m("div"),l=N("Voltage divider"),n=m("br"),i=b(),o=m("div"),u=m("input"),c=b(),a=m("input"),r(u,"name","ivdv"),r(u,"type","number"),r(u,"min","0"),r(u,"max","65535"),r(u,"class","in-f tr w-full"),r(u,"placeholder","VCC"),r(a,"name","ivdg"),r(a,"type","number"),r(a,"min","0"),r(a,"max","65535"),r(a,"class","in-l tr w-full"),r(a,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(_,v){M(_,e,v),s(e,l),s(e,n),s(e,i),s(e,o),s(o,u),oe(u,t[3].i.v.d.v),s(o,c),s(o,a),oe(a,t[3].i.v.d.g),f||(p=[ee(u,"input",t[92]),ee(a,"input",t[93])],f=!0)},p(_,v){v[0]&8&&ge(u.value)!==_[3].i.v.d.v&&oe(u,_[3].i.v.d.v),v[0]&8&&ge(a.value)!==_[3].i.v.d.g&&oe(a,_[3].i.v.d.g)},d(_){_&&S(e),f=!1,Ge(p)}}}function $f(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N(`LED behaviour - `),n=m("select"),i=m("option"),i.textContent="Enabled",o=m("option"),o.textContent="Disabled",i.__value=0,i.value=i.__value,o.__value=1,o.value=o.__value,r(n,"name","idb"),r(n,"class","in-s"),t[3].i.d.b===void 0&&ze(()=>t[94].call(n)),r(e,"class","my-1 w-full")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(n,i),s(n,o),Me(n,t[3].i.d.b,!0),u||(c=ee(n,"change",t[94]),u=!0)},p(a,f){f[0]&8&&Me(n,a[3].i.d.b)},d(a){a&&S(e),u=!1,c()}}}function Nf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T=(t[0].board==2||t[0].board==100)&&Ef(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=N("Vcc offset"),u=m("br"),c=b(),a=m("input"),f=b(),p=m("div"),_=N("Multiplier"),v=m("br"),h=b(),d=m("input"),g=b(),T&&T.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(a,"name","ivo"),r(a,"type","number"),r(a,"min","0.0"),r(a,"max","3.5"),r(a,"step","0.01"),r(a,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(d,"name","ivm"),r(d,"type","number"),r(d,"min","0.1"),r(d,"max","10"),r(d,"step","0.01"),r(d,"class","in-l tr w-full"),r(p,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(E,F){M(E,e,F),M(E,l,F),M(E,n,F),s(n,i),s(i,o),s(i,u),s(i,c),s(i,a),oe(a,t[3].i.v.o),s(n,f),s(n,p),s(p,_),s(p,v),s(p,h),s(p,d),oe(d,t[3].i.v.m),s(n,g),T&&T.m(n,null),w||(D=[ee(a,"input",t[95]),ee(d,"input",t[96])],w=!0)},p(E,F){F[0]&8&&ge(a.value)!==E[3].i.v.o&&oe(a,E[3].i.v.o),F[0]&8&&ge(d.value)!==E[3].i.v.m&&oe(d,E[3].i.v.m),E[0].board==2||E[0].board==100?T?T.p(E,F):(T=Ef(E),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(E){E&&S(e),E&&S(l),E&&S(n),T&&T.d(),w=!1,Ge(D)}}}function Ef(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N("Boot limit"),n=m("br"),i=b(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].i.v.b),u||(c=ee(o,"input",t[97]),u=!0)},p(a,f){f[0]&8&&ge(o.value)!==a[3].i.v.b&&oe(o,a[3].i.v.b)},d(a){a&&S(e),u=!1,c()}}}function Af(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D=t[3].d.t&&Pf();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=b(),n=m("div"),i=m("label"),o=m("input"),u=N(" Enable telnet"),c=b(),D&&D.c(),a=b(),f=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",v=m("option"),v.textContent="Debug",h=m("option"),h.textContent="Info",d=m("option"),d.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),_.__value=1,_.value=_.__value,v.__value=2,v.value=v.__value,h.__value=3,h.value=h.__value,d.__value=4,d.value=d.__value,r(p,"name","dl"),r(p,"class","in-s"),t[3].d.l===void 0&&ze(()=>t[100].call(p)),r(f,"class","my-1")},m(T,E){M(T,e,E),M(T,l,E),M(T,n,E),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,u),M(T,c,E),D&&D.m(T,E),M(T,a,E),M(T,f,E),s(f,p),s(p,_),s(p,v),s(p,h),s(p,d),Me(p,t[3].d.l,!0),g||(w=[ee(o,"change",t[99]),ee(p,"change",t[100])],g=!0)},p(T,E){E[0]&8&&(o.checked=T[3].d.t),T[3].d.t?D||(D=Pf(),D.c(),D.m(a.parentNode,a)):D&&(D.d(1),D=null),E[0]&8&&Me(p,T[3].d.l)},d(T){T&&S(e),T&&S(l),T&&S(n),T&&S(c),D&&D.d(T),T&&S(a),T&&S(f),g=!1,Ge(w)}}}function Pf(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function F_(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z,V,H,x,ue,re,Q,z,we,He,Ie,Se,ye,he,$e,be,$,C,k,P,L,X,le,fe,de,Ce,Oe,ae,Te,Je,It,st,kt,nt,Ot,Qe,Zt,zt,ht,xe,Ve,Ye,Ne,Ze,et,Be,Fe,_e,ce,qe,pt,Nl,El,Al,Ni,oi,gl,Ei,Ai,Pi,wt,Di,je,pn,Li,Pl,Dl,Ri,Wl,Ii,zl,Oi,We,yt,Gl,Cs,Gt,Vt,Ll,Fi,al,Bi,No,Ss,Eo,ri,Jt,Ao,Po,Rl,ul,Il,Do,qi,Lo,vt,Ol,Ro,Ui,dn,hn,vn,bn,ji,Io,Ft,Hi,Oo,Vl,Fo,Bo,qo,fl,gn,kn,Uo,wn,Kl,jo,Ho,Wo,yn,xt,zo,Wi,Go,Yl,Vo,Ko,Yo,Cn,el,Qo,zi,Xo,Ms,Zo,Ql,Gi,tl,Jo,xo,er,Ts,Vi,ll,tr,lr,nr,Bt,Ki,ir,Sn,Mn,sr,ai,or,Xl,rr,ar,ur,Kt,Tn,$n,fr,cr,mt,Yi,mr,Nn,En,_r,Zl,pr,dr,hr,Fl,cl,An,Pn,vr,qt,Qi,Xi,br,Ut,Dn,Zi,Ji,gr,$s,xi,es,nl,kr,wr,ui,yr,Bl,Cr,fi,il,Sr,Mr,Tr,ts,kl,$r,lt,ls,Nr,Ln,Rn,Er,ci,Ar,ml,Pr,Ns,Dr,Lr,In,wl,Rr,sl,Ir,Es,Jl,Or,Fr,Br,yl,qr,xl,Ur,jr,Hr,Cl,Wr,On,Fn,zr,Gr,Vr,Sl,Kr,Bn,Yr,Qr,Xr,Ct,qn,Un,jn,Hn,Wn,zn,Zr,en,Jr,xr,ea,Ml,ta,As,Ps,Ds,Ls=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),Rs,_l,ns,la,Gn,Vn,na,mi,ia,_i,sa,Is,jt,is,oa,Kn,Yn,ra,pi,aa,ss,os,ol,ua,fa,ca,ql,Os,Qn,ma,rs,Xn,_a,as,Fs,tn,Bs,ln,qs,nn,Us,sn,Yt,js,pa;c=new Lt({}),A=new m_({});let f1=["NOK","SEK","DKK","EUR","CHF"],di=[];for(let B=0;B<5;B+=1)di[B]=y_(w_(t,f1,B));ht=new Xt({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[C_]},$$scope:{ctx:t}}});let St=t[3].p.e&&t[0].chip!="esp8266"&&sf(t),Mt=t[3].g.s>0&&of(t);Dl=new Lt({});let c1=[24,48,96,192,384,576,1152],hi=[];for(let B=0;B<7;B+=1)hi[B]=S_(k_(t,c1,B));let Tt=t[3].m.e.e&&rf(t),$t=t[3].m.e.e&&af(t),Nt=t[3].m.m.e&&uf(t);Mn=new Lt({});let Ht=t[0].if&&t[0].if.eth&&ff(),Et=(t[3].n.c==1||t[3].n.c==2)&&cf(t);En=new Lt({}),Dn=new a1({});let At=t[3].n.m=="static"&&mf(t);Rn=new Lt({});let Pt=t[0].chip!="esp8266"&&_f(t),ot=t[3].q.s.e&&pf(t),rt=t[3].q.m==3&&df(t),at=t[3].q.m==4&&hf(t),ut=t[3].c.es!=null&&vf(t),ft=Ls&&kf(t);Vn=new Lt({});let Zn=t[7],bt=[];for(let B=0;B20||t[0].chip=="esp8266"||t[3].i.d.d>0)&&Cf(t);Yn=new Lt({});let Dt=t[3].d.s&&Af(t);return tn=new gt({props:{active:t[1],message:"Loading configuration"}}),ln=new gt({props:{active:t[2],message:"Saving configuration"}}),nn=new gt({props:{active:t[4],message:"Performing factory reset"}}),sn=new gt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=b(),u=m("a"),se(c.$$.fragment),a=b(),f=m("input"),p=b(),_=m("div"),v=m("div"),h=m("div"),d=N("Hostname"),g=m("br"),w=b(),D=m("input"),T=b(),E=m("div"),F=N("Time zone"),O=m("br"),R=b(),y=m("select"),se(A.$$.fragment),te=b(),W=m("input"),j=b(),U=m("div"),K=m("div"),Y=m("div"),G=N("Price region"),Z=m("br"),V=b(),H=m("select"),x=m("optgroup"),ue=m("option"),ue.textContent="NO1",re=m("option"),re.textContent="NO2",Q=m("option"),Q.textContent="NO3",z=m("option"),z.textContent="NO4",we=m("option"),we.textContent="NO5",He=m("optgroup"),Ie=m("option"),Ie.textContent="SE1",Se=m("option"),Se.textContent="SE2",ye=m("option"),ye.textContent="SE3",he=m("option"),he.textContent="SE4",$e=m("optgroup"),be=m("option"),be.textContent="DK1",$=m("option"),$.textContent="DK2",C=m("option"),C.textContent="Austria",k=m("option"),k.textContent="Belgium",P=m("option"),P.textContent="Czech Republic",L=m("option"),L.textContent="Estonia",X=m("option"),X.textContent="Finland",le=m("option"),le.textContent="France",fe=m("option"),fe.textContent="Germany",de=m("option"),de.textContent="Great Britain",Ce=m("option"),Ce.textContent="Latvia",Oe=m("option"),Oe.textContent="Lithuania",ae=m("option"),ae.textContent="Netherland",Te=m("option"),Te.textContent="Poland",Je=m("option"),Je.textContent="Switzerland",It=b(),st=m("div"),kt=N("Currency"),nt=m("br"),Ot=b(),Qe=m("select");for(let B=0;B<5;B+=1)di[B].c();Zt=b(),zt=m("div"),se(ht.$$.fragment),xe=b(),Ve=m("div"),Ye=m("label"),Ne=m("input"),Ze=N(" Enable price fetch from remote server"),et=b(),St&&St.c(),Be=b(),Fe=m("div"),_e=N("Security"),ce=m("br"),qe=b(),pt=m("select"),Nl=m("option"),Nl.textContent="None",El=m("option"),El.textContent="Only configuration",Al=m("option"),Al.textContent="Everything",Ni=b(),Mt&&Mt.c(),oi=b(),gl=m("div"),Ei=N("Context"),Ai=m("br"),Pi=b(),wt=m("input"),Di=b(),je=m("div"),pn=m("strong"),pn.textContent="Meter",Li=b(),Pl=m("a"),se(Dl.$$.fragment),Ri=b(),Wl=m("input"),Ii=b(),zl=m("input"),Oi=b(),We=m("div"),yt=N("Communication"),Gl=m("br"),Cs=b(),Gt=m("select"),Vt=m("option"),Vt.textContent="Passive (Push)",Ll=m("option"),Ll.textContent="Kamstrup (Pull)",Fi=b(),al=m("div"),Bi=m("span"),Bi.textContent="Buffer size",No=b(),Ss=m("span"),Ss.textContent="Serial conf.",Eo=b(),ri=m("label"),Jt=m("input"),Ao=N(" inverted"),Po=b(),Rl=m("div"),ul=m("select"),Il=m("option"),Do=N("Autodetect");for(let B=0;B<7;B+=1)hi[B].c();Lo=b(),vt=m("select"),Ol=m("option"),Ro=N("-"),dn=m("option"),dn.textContent="7N1",hn=m("option"),hn.textContent="8N1",vn=m("option"),vn.textContent="7E1",bn=m("option"),bn.textContent="8E1",Io=b(),Ft=m("input"),Oo=b(),Vl=m("div"),Fo=N("Voltage"),Bo=m("br"),qo=b(),fl=m("select"),gn=m("option"),gn.textContent="400V (TN)",kn=m("option"),kn.textContent="230V (IT/TT)",Uo=b(),wn=m("div"),Kl=m("div"),jo=N("Main fuse"),Ho=m("br"),Wo=b(),yn=m("label"),xt=m("input"),zo=b(),Wi=m("span"),Wi.textContent="A",Go=b(),Yl=m("div"),Vo=N("Production"),Ko=m("br"),Yo=b(),Cn=m("label"),el=m("input"),Qo=b(),zi=m("span"),zi.textContent="kWp",Xo=b(),Ms=m("div"),Zo=b(),Ql=m("div"),Gi=m("label"),tl=m("input"),Jo=N(" Meter is encrypted"),xo=b(),Tt&&Tt.c(),er=b(),$t&&$t.c(),Ts=b(),Vi=m("label"),ll=m("input"),tr=N(" Multipliers"),lr=b(),Nt&&Nt.c(),nr=b(),Bt=m("div"),Ki=m("strong"),Ki.textContent="Connection",ir=b(),Sn=m("a"),se(Mn.$$.fragment),sr=b(),ai=m("input"),or=b(),Xl=m("div"),rr=N("Connection"),ar=m("br"),ur=b(),Kt=m("select"),Tn=m("option"),Tn.textContent="WiFi",$n=m("option"),$n.textContent="Access point",Ht&&Ht.c(),fr=b(),Et&&Et.c(),cr=b(),mt=m("div"),Yi=m("strong"),Yi.textContent="Network",mr=b(),Nn=m("a"),se(En.$$.fragment),_r=b(),Zl=m("div"),pr=N("IP"),dr=m("br"),hr=b(),Fl=m("div"),cl=m("select"),An=m("option"),An.textContent="DHCP",Pn=m("option"),Pn.textContent="Static",vr=b(),qt=m("input"),br=b(),Ut=m("select"),se(Dn.$$.fragment),gr=b(),At&&At.c(),$s=b(),xi=m("div"),es=m("label"),nl=m("input"),kr=N(" enable mDNS"),wr=b(),ui=m("input"),yr=b(),Bl=m("div"),Cr=N("NTP "),fi=m("label"),il=m("input"),Sr=N(" obtain from DHCP"),Mr=m("br"),Tr=b(),ts=m("div"),kl=m("input"),$r=b(),lt=m("div"),ls=m("strong"),ls.textContent="MQTT",Nr=b(),Ln=m("a"),se(Rn.$$.fragment),Er=b(),ci=m("input"),Ar=b(),ml=m("div"),Pr=N(`Server - `),Pt&&Pt.c(),Ns=b(),Dr=m("br"),Lr=b(),In=m("div"),wl=m("input"),Rr=b(),sl=m("input"),Ir=b(),ot&&ot.c(),Es=b(),Jl=m("div"),Or=N("Username"),Fr=m("br"),Br=b(),yl=m("input"),qr=b(),xl=m("div"),Ur=N("Password"),jr=m("br"),Hr=b(),Cl=m("input"),Wr=b(),On=m("div"),Fn=m("div"),zr=N("Client ID"),Gr=m("br"),Vr=b(),Sl=m("input"),Kr=b(),Bn=m("div"),Yr=N("Payload"),Qr=m("br"),Xr=b(),Ct=m("select"),qn=m("option"),qn.textContent="JSON",Un=m("option"),Un.textContent="Raw (minimal)",jn=m("option"),jn.textContent="Raw (full)",Hn=m("option"),Hn.textContent="Domoticz",Wn=m("option"),Wn.textContent="HomeAssistant",zn=m("option"),zn.textContent="HEX dump",Zr=b(),en=m("div"),Jr=N("Publish topic"),xr=m("br"),ea=b(),Ml=m("input"),ta=b(),rt&&rt.c(),As=b(),at&&at.c(),Ps=b(),ut&&ut.c(),Ds=b(),ft&&ft.c(),Rs=b(),_l=m("div"),ns=m("strong"),ns.textContent="User interface",la=b(),Gn=m("a"),se(Vn.$$.fragment),na=b(),mi=m("input"),ia=b(),_i=m("div");for(let B=0;BSave',Fs=b(),se(tn.$$.fragment),Bs=b(),se(ln.$$.fragment),qs=b(),se(nn.$$.fragment),Us=b(),se(sn.$$.fragment),r(i,"class","text-sm"),r(u,"href",Rt("General-configuration")),r(u,"target","_blank"),r(u,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r(D,"name","gh"),r(D,"type","text"),r(D,"class","in-f w-full"),r(D,"pattern","[A-Za-z0-9-]+"),r(y,"name","gt"),r(y,"class","in-l w-full"),t[3].g.t===void 0&&ze(()=>t[17].call(y)),r(v,"class","flex"),r(_,"class","my-1"),r(W,"type","hidden"),r(W,"name","p"),W.value="true",ue.__value="10YNO-1--------2",ue.value=ue.__value,re.__value="10YNO-2--------T",re.value=re.__value,Q.__value="10YNO-3--------J",Q.value=Q.__value,z.__value="10YNO-4--------9",z.value=z.__value,we.__value="10Y1001A1001A48H",we.value=we.__value,r(x,"label","Norway"),Ie.__value="10Y1001A1001A44P",Ie.value=Ie.__value,Se.__value="10Y1001A1001A45N",Se.value=Se.__value,ye.__value="10Y1001A1001A46L",ye.value=ye.__value,he.__value="10Y1001A1001A47J",he.value=he.__value,r(He,"label","Sweden"),be.__value="10YDK-1--------W",be.value=be.__value,$.__value="10YDK-2--------M",$.value=$.__value,r($e,"label","Denmark"),C.__value="10YAT-APG------L",C.value=C.__value,k.__value="10YBE----------2",k.value=k.__value,P.__value="10YCZ-CEPS-----N",P.value=P.__value,L.__value="10Y1001A1001A39I",L.value=L.__value,X.__value="10YFI-1--------U",X.value=X.__value,le.__value="10YFR-RTE------C",le.value=le.__value,fe.__value="10Y1001A1001A83F",fe.value=fe.__value,de.__value="10YGB----------A",de.value=de.__value,Ce.__value="10YLV-1001A00074",Ce.value=Ce.__value,Oe.__value="10YLT-1001A0008Q",Oe.value=Oe.__value,ae.__value="10YNL----------L",ae.value=ae.__value,Te.__value="10YPL-AREA-----S",Te.value=Te.__value,Je.__value="10YCH-SWISSGRIDZ",Je.value=Je.__value,r(H,"name","pr"),r(H,"class","in-f w-full"),t[3].p.r===void 0&&ze(()=>t[18].call(H)),r(Y,"class","w-full"),r(Qe,"name","pc"),r(Qe,"class","in-l"),t[3].p.c===void 0&&ze(()=>t[19].call(Qe)),r(K,"class","flex"),r(U,"class","my-1"),r(zt,"class","my-1"),r(Ne,"type","checkbox"),r(Ne,"name","pe"),Ne.__value="true",Ne.value=Ne.__value,r(Ne,"class","rounded mb-1"),r(Ve,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,El.__value=1,El.value=El.__value,Al.__value=2,Al.value=Al.__value,r(pt,"name","gs"),r(pt,"class","in-s"),t[3].g.s===void 0&&ze(()=>t[22].call(pt)),r(Fe,"class","my-1"),r(wt,"name","gc"),r(wt,"type","text"),r(wt,"pattern","[A-Za-z0-9]+"),r(wt,"placeholder","[root]"),r(wt,"class","in-s"),r(wt,"maxlength","36"),r(gl,"class","my-1"),r(n,"class","cnt"),r(pn,"class","text-sm"),r(Pl,"href",Rt("Meter-configuration")),r(Pl,"target","_blank"),r(Pl,"class","float-right"),r(Wl,"type","hidden"),r(Wl,"name","m"),Wl.value="true",r(zl,"type","hidden"),r(zl,"name","mo"),zl.value="1",Vt.__value=0,Vt.value=Vt.__value,Ll.__value=9,Ll.value=Ll.__value,r(Gt,"name","ma"),r(Gt,"class","in-s"),t[3].m.a===void 0&&ze(()=>t[26].call(Gt)),r(We,"class","my-1"),r(Bi,"class","float-right"),r(Jt,"name","mi"),Jt.__value="true",Jt.value=Jt.__value,r(Jt,"type","checkbox"),r(Jt,"class","rounded mb-1"),r(ri,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=qi=t[3].m.b!=0,r(ul,"name","mb"),r(ul,"class","in-f tr w-1/2"),t[3].m.b===void 0&&ze(()=>t[28].call(ul)),Ol.__value=0,Ol.value=Ol.__value,Ol.disabled=Ui=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,hn.__value=3,hn.value=hn.__value,vn.__value=10,vn.value=vn.__value,bn.__value=11,bn.value=bn.__value,r(vt,"name","mp"),r(vt,"class","in-m"),vt.disabled=ji=t[3].m.b==0,t[3].m.p===void 0&&ze(()=>t[29].call(vt)),r(Ft,"name","ms"),r(Ft,"type","number"),r(Ft,"min",64),r(Ft,"max",Hi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),r(Ft,"step",64),r(Ft,"class","in-l tr w-1/2"),r(Rl,"class","flex w-full"),r(al,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,r(fl,"name","md"),r(fl,"class","in-s"),t[3].m.d===void 0&&ze(()=>t[31].call(fl)),r(Vl,"class","my-1"),r(xt,"name","mf"),r(xt,"type","number"),r(xt,"min","5"),r(xt,"max","65535"),r(xt,"class","in-f tr w-full"),r(Wi,"class","in-post"),r(yn,"class","flex"),r(Kl,"class","mx-1"),r(el,"name","mr"),r(el,"type","number"),r(el,"min","0"),r(el,"max","65535"),r(el,"class","in-f tr w-full"),r(zi,"class","in-post"),r(Cn,"class","flex"),r(Yl,"class","mx-1"),r(wn,"class","my-1 flex"),r(Ms,"class","my-1"),r(tl,"type","checkbox"),r(tl,"name","me"),tl.__value="true",tl.value=tl.__value,r(tl,"class","rounded mb-1"),r(Ql,"class","my-1"),r(ll,"type","checkbox"),r(ll,"name","mm"),ll.__value="true",ll.value=ll.__value,r(ll,"class","rounded mb-1"),r(je,"class","cnt"),r(Ki,"class","text-sm"),r(Sn,"href",Rt("WiFi-configuration")),r(Sn,"target","_blank"),r(Sn,"class","float-right"),r(ai,"type","hidden"),r(ai,"name","w"),ai.value="true",Tn.__value=1,Tn.value=Tn.__value,$n.__value=2,$n.value=$n.__value,r(Kt,"name","nc"),r(Kt,"class","in-s"),t[3].n.c===void 0&&ze(()=>t[42].call(Kt)),r(Xl,"class","my-1"),r(Bt,"class","cnt"),r(Yi,"class","text-sm"),r(Nn,"href",Rt("Network-configuration")),r(Nn,"target","_blank"),r(Nn,"class","float-right"),An.__value="dhcp",An.value=An.__value,Pn.__value="static",Pn.value=Pn.__value,r(cl,"name","nm"),r(cl,"class","in-f"),t[3].n.m===void 0&&ze(()=>t[48].call(cl)),r(qt,"name","ni"),r(qt,"type","text"),r(qt,"class","in-m w-full"),qt.disabled=Qi=t[3].n.m=="dhcp",qt.required=Xi=t[3].n.m=="static",r(Ut,"name","ns"),r(Ut,"class","in-l"),Ut.disabled=Zi=t[3].n.m=="dhcp",Ut.required=Ji=t[3].n.m=="static",t[3].n.s===void 0&&ze(()=>t[50].call(Ut)),r(Fl,"class","flex"),r(Zl,"class","my-1"),r(nl,"name","nd"),nl.__value="true",nl.value=nl.__value,r(nl,"type","checkbox"),r(nl,"class","rounded mb-1"),r(xi,"class","my-1"),r(ui,"type","hidden"),r(ui,"name","ntp"),ui.value="true",r(il,"name","ntpd"),il.__value="true",il.value=il.__value,r(il,"type","checkbox"),r(il,"class","rounded mb-1"),r(fi,"class","ml-4"),r(kl,"name","ntph"),r(kl,"type","text"),r(kl,"class","in-s"),r(ts,"class","flex"),r(Bl,"class","my-1"),r(mt,"class","cnt"),r(ls,"class","text-sm"),r(Ln,"href",Rt("MQTT-configuration")),r(Ln,"target","_blank"),r(Ln,"class","float-right"),r(ci,"type","hidden"),r(ci,"name","q"),ci.value="true",r(wl,"name","qh"),r(wl,"type","text"),r(wl,"class","in-f w-3/4"),r(sl,"name","qp"),r(sl,"type","number"),r(sl,"min","1024"),r(sl,"max","65535"),r(sl,"class","in-l tr w-1/4"),r(In,"class","flex"),r(ml,"class","my-1"),r(yl,"name","qu"),r(yl,"type","text"),r(yl,"class","in-s"),r(Jl,"class","my-1"),r(Cl,"name","qa"),r(Cl,"type","password"),r(Cl,"class","in-s"),r(xl,"class","my-1"),r(Sl,"name","qc"),r(Sl,"type","text"),r(Sl,"class","in-f w-full"),qn.__value=0,qn.value=qn.__value,Un.__value=1,Un.value=Un.__value,jn.__value=2,jn.value=jn.__value,Hn.__value=3,Hn.value=Hn.__value,Wn.__value=4,Wn.value=Wn.__value,zn.__value=255,zn.value=zn.__value,r(Ct,"name","qm"),r(Ct,"class","in-l"),t[3].q.m===void 0&&ze(()=>t[63].call(Ct)),r(On,"class","my-1 flex"),r(Ml,"name","qb"),r(Ml,"type","text"),r(Ml,"class","in-s"),r(en,"class","my-1"),r(lt,"class","cnt"),r(ns,"class","text-sm"),r(Gn,"href",Rt("User-interface")),r(Gn,"target","_blank"),r(Gn,"class","float-right"),r(mi,"type","hidden"),r(mi,"name","u"),mi.value="true",r(_i,"class","flex flex-wrap"),r(_l,"class","cnt"),r(is,"class","text-sm"),r(Kn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(Kn,"target","_blank"),r(Kn,"class","float-right"),r(pi,"type","hidden"),r(pi,"name","d"),pi.value="true",r(ol,"type","checkbox"),r(ol,"name","ds"),ol.__value="true",ol.value=ol.__value,r(ol,"class","rounded mb-1"),r(ss,"class","mt-3"),r(jt,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(Qn,"type","button"),r(Qn,"class","btn-red"),r(Xn,"type","button"),r(Xn,"class","btn-yellow"),r(rs,"class","text-center"),r(as,"class","text-right"),r(ql,"class","grid grid-cols-3 mt-3"),r(e,"autocomplete","off")},m(B,me){M(B,e,me),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),ne(c,u,null),s(n,a),s(n,f),s(n,p),s(n,_),s(_,v),s(v,h),s(h,d),s(h,g),s(h,w),s(h,D),oe(D,t[3].g.h),s(v,T),s(v,E),s(E,F),s(E,O),s(E,R),s(E,y),ne(A,y,null),Me(y,t[3].g.t,!0),s(n,te),s(n,W),s(n,j),s(n,U),s(U,K),s(K,Y),s(Y,G),s(Y,Z),s(Y,V),s(Y,H),s(H,x),s(x,ue),s(x,re),s(x,Q),s(x,z),s(x,we),s(H,He),s(He,Ie),s(He,Se),s(He,ye),s(He,he),s(H,$e),s($e,be),s($e,$),s(H,C),s(H,k),s(H,P),s(H,L),s(H,X),s(H,le),s(H,fe),s(H,de),s(H,Ce),s(H,Oe),s(H,ae),s(H,Te),s(H,Je),Me(H,t[3].p.r,!0),s(K,It),s(K,st),s(st,kt),s(st,nt),s(st,Ot),s(st,Qe);for(let _t=0;_t<5;_t+=1)di[_t]&&di[_t].m(Qe,null);Me(Qe,t[3].p.c,!0),s(n,Zt),s(n,zt),ne(ht,zt,null),s(n,xe),s(n,Ve),s(Ve,Ye),s(Ye,Ne),Ne.checked=t[3].p.e,s(Ye,Ze),s(Ve,et),St&&St.m(Ve,null),s(n,Be),s(n,Fe),s(Fe,_e),s(Fe,ce),s(Fe,qe),s(Fe,pt),s(pt,Nl),s(pt,El),s(pt,Al),Me(pt,t[3].g.s,!0),s(n,Ni),Mt&&Mt.m(n,null),s(n,oi),s(n,gl),s(gl,Ei),s(gl,Ai),s(gl,Pi),s(gl,wt),oe(wt,t[3].g.c),s(l,Di),s(l,je),s(je,pn),s(je,Li),s(je,Pl),ne(Dl,Pl,null),s(je,Ri),s(je,Wl),s(je,Ii),s(je,zl),s(je,Oi),s(je,We),s(We,yt),s(We,Gl),s(We,Cs),s(We,Gt),s(Gt,Vt),s(Gt,Ll),Me(Gt,t[3].m.a,!0),s(je,Fi),s(je,al),s(al,Bi),s(al,No),s(al,Ss),s(al,Eo),s(al,ri),s(ri,Jt),Jt.checked=t[3].m.i,s(ri,Ao),s(al,Po),s(al,Rl),s(Rl,ul),s(ul,Il),s(Il,Do);for(let _t=0;_t<7;_t+=1)hi[_t]&&hi[_t].m(ul,null);Me(ul,t[3].m.b,!0),s(Rl,Lo),s(Rl,vt),s(vt,Ol),s(Ol,Ro),s(vt,dn),s(vt,hn),s(vt,vn),s(vt,bn),Me(vt,t[3].m.p,!0),s(Rl,Io),s(Rl,Ft),oe(Ft,t[3].m.s),s(je,Oo),s(je,Vl),s(Vl,Fo),s(Vl,Bo),s(Vl,qo),s(Vl,fl),s(fl,gn),s(fl,kn),Me(fl,t[3].m.d,!0),s(je,Uo),s(je,wn),s(wn,Kl),s(Kl,jo),s(Kl,Ho),s(Kl,Wo),s(Kl,yn),s(yn,xt),oe(xt,t[3].m.f),s(yn,zo),s(yn,Wi),s(wn,Go),s(wn,Yl),s(Yl,Vo),s(Yl,Ko),s(Yl,Yo),s(Yl,Cn),s(Cn,el),oe(el,t[3].m.r),s(Cn,Qo),s(Cn,zi),s(je,Xo),s(je,Ms),s(je,Zo),s(je,Ql),s(Ql,Gi),s(Gi,tl),tl.checked=t[3].m.e.e,s(Gi,Jo),s(Ql,xo),Tt&&Tt.m(Ql,null),s(je,er),$t&&$t.m(je,null),s(je,Ts),s(je,Vi),s(Vi,ll),ll.checked=t[3].m.m.e,s(Vi,tr),s(je,lr),Nt&&Nt.m(je,null),s(l,nr),s(l,Bt),s(Bt,Ki),s(Bt,ir),s(Bt,Sn),ne(Mn,Sn,null),s(Bt,sr),s(Bt,ai),s(Bt,or),s(Bt,Xl),s(Xl,rr),s(Xl,ar),s(Xl,ur),s(Xl,Kt),s(Kt,Tn),s(Kt,$n),Ht&&Ht.m(Kt,null),Me(Kt,t[3].n.c,!0),s(Bt,fr),Et&&Et.m(Bt,null),s(l,cr),s(l,mt),s(mt,Yi),s(mt,mr),s(mt,Nn),ne(En,Nn,null),s(mt,_r),s(mt,Zl),s(Zl,pr),s(Zl,dr),s(Zl,hr),s(Zl,Fl),s(Fl,cl),s(cl,An),s(cl,Pn),Me(cl,t[3].n.m,!0),s(Fl,vr),s(Fl,qt),oe(qt,t[3].n.i),s(Fl,br),s(Fl,Ut),ne(Dn,Ut,null),Me(Ut,t[3].n.s,!0),s(mt,gr),At&&At.m(mt,null),s(mt,$s),s(mt,xi),s(xi,es),s(es,nl),nl.checked=t[3].n.d,s(es,kr),s(mt,wr),s(mt,ui),s(mt,yr),s(mt,Bl),s(Bl,Cr),s(Bl,fi),s(fi,il),il.checked=t[3].n.h,s(fi,Sr),s(Bl,Mr),s(Bl,Tr),s(Bl,ts),s(ts,kl),oe(kl,t[3].n.n1),s(l,$r),s(l,lt),s(lt,ls),s(lt,Nr),s(lt,Ln),ne(Rn,Ln,null),s(lt,Er),s(lt,ci),s(lt,Ar),s(lt,ml),s(ml,Pr),Pt&&Pt.m(ml,null),s(ml,Ns),s(ml,Dr),s(ml,Lr),s(ml,In),s(In,wl),oe(wl,t[3].q.h),s(In,Rr),s(In,sl),oe(sl,t[3].q.p),s(lt,Ir),ot&&ot.m(lt,null),s(lt,Es),s(lt,Jl),s(Jl,Or),s(Jl,Fr),s(Jl,Br),s(Jl,yl),oe(yl,t[3].q.u),s(lt,qr),s(lt,xl),s(xl,Ur),s(xl,jr),s(xl,Hr),s(xl,Cl),oe(Cl,t[3].q.a),s(lt,Wr),s(lt,On),s(On,Fn),s(Fn,zr),s(Fn,Gr),s(Fn,Vr),s(Fn,Sl),oe(Sl,t[3].q.c),s(On,Kr),s(On,Bn),s(Bn,Yr),s(Bn,Qr),s(Bn,Xr),s(Bn,Ct),s(Ct,qn),s(Ct,Un),s(Ct,jn),s(Ct,Hn),s(Ct,Wn),s(Ct,zn),Me(Ct,t[3].q.m,!0),s(lt,Zr),s(lt,en),s(en,Jr),s(en,xr),s(en,ea),s(en,Ml),oe(Ml,t[3].q.b),s(l,ta),rt&&rt.m(l,null),s(l,As),at&&at.m(l,null),s(l,Ps),ut&&ut.m(l,null),s(l,Ds),ft&&ft.m(l,null),s(l,Rs),s(l,_l),s(_l,ns),s(_l,la),s(_l,Gn),ne(Vn,Gn,null),s(_l,na),s(_l,mi),s(_l,ia),s(_l,_i);for(let _t=0;_t0?Mt?Mt.p(B,me):(Mt=of(B),Mt.c(),Mt.m(n,oi)):Mt&&(Mt.d(1),Mt=null),me[0]&8&&wt.value!==B[3].g.c&&oe(wt,B[3].g.c),me[0]&8&&Me(Gt,B[3].m.a),me[0]&8&&(Jt.checked=B[3].m.i),(!Yt||me[0]&8&&qi!==(qi=B[3].m.b!=0))&&(Il.disabled=qi),me[0]&8&&Me(ul,B[3].m.b),(!Yt||me[0]&8&&Ui!==(Ui=B[3].m.b!=0))&&(Ol.disabled=Ui),(!Yt||me[0]&8&&ji!==(ji=B[3].m.b==0))&&(vt.disabled=ji),me[0]&8&&Me(vt,B[3].m.p),(!Yt||me[0]&9&&Hi!==(Hi=B[0].chip=="esp8266"?B[3].i.h.p==3||B[3].i.h.p==113?512:128:4096))&&r(Ft,"max",Hi),me[0]&8&&ge(Ft.value)!==B[3].m.s&&oe(Ft,B[3].m.s),me[0]&8&&Me(fl,B[3].m.d),me[0]&8&&ge(xt.value)!==B[3].m.f&&oe(xt,B[3].m.f),me[0]&8&&ge(el.value)!==B[3].m.r&&oe(el,B[3].m.r),me[0]&8&&(tl.checked=B[3].m.e.e),B[3].m.e.e?Tt?Tt.p(B,me):(Tt=rf(B),Tt.c(),Tt.m(Ql,null)):Tt&&(Tt.d(1),Tt=null),B[3].m.e.e?$t?$t.p(B,me):($t=af(B),$t.c(),$t.m(je,Ts)):$t&&($t.d(1),$t=null),me[0]&8&&(ll.checked=B[3].m.m.e),B[3].m.m.e?Nt?Nt.p(B,me):(Nt=uf(B),Nt.c(),Nt.m(je,null)):Nt&&(Nt.d(1),Nt=null),B[0].if&&B[0].if.eth?Ht||(Ht=ff(),Ht.c(),Ht.m(Kt,null)):Ht&&(Ht.d(1),Ht=null),me[0]&8&&Me(Kt,B[3].n.c),B[3].n.c==1||B[3].n.c==2?Et?Et.p(B,me):(Et=cf(B),Et.c(),Et.m(Bt,null)):Et&&(Et.d(1),Et=null),me[0]&8&&Me(cl,B[3].n.m),(!Yt||me[0]&8&&Qi!==(Qi=B[3].n.m=="dhcp"))&&(qt.disabled=Qi),(!Yt||me[0]&8&&Xi!==(Xi=B[3].n.m=="static"))&&(qt.required=Xi),me[0]&8&&qt.value!==B[3].n.i&&oe(qt,B[3].n.i),(!Yt||me[0]&8&&Zi!==(Zi=B[3].n.m=="dhcp"))&&(Ut.disabled=Zi),(!Yt||me[0]&8&&Ji!==(Ji=B[3].n.m=="static"))&&(Ut.required=Ji),me[0]&8&&Me(Ut,B[3].n.s),B[3].n.m=="static"?At?At.p(B,me):(At=mf(B),At.c(),At.m(mt,$s)):At&&(At.d(1),At=null),me[0]&8&&(nl.checked=B[3].n.d),me[0]&8&&(il.checked=B[3].n.h),me[0]&8&&kl.value!==B[3].n.n1&&oe(kl,B[3].n.n1),B[0].chip!="esp8266"?Pt?Pt.p(B,me):(Pt=_f(B),Pt.c(),Pt.m(ml,Ns)):Pt&&(Pt.d(1),Pt=null),me[0]&8&&wl.value!==B[3].q.h&&oe(wl,B[3].q.h),me[0]&8&&ge(sl.value)!==B[3].q.p&&oe(sl,B[3].q.p),B[3].q.s.e?ot?(ot.p(B,me),me[0]&8&&I(ot,1)):(ot=pf(B),ot.c(),I(ot,1),ot.m(lt,Es)):ot&&(Ae(),q(ot,1,1,()=>{ot=null}),Pe()),me[0]&8&&yl.value!==B[3].q.u&&oe(yl,B[3].q.u),me[0]&8&&Cl.value!==B[3].q.a&&oe(Cl,B[3].q.a),me[0]&8&&Sl.value!==B[3].q.c&&oe(Sl,B[3].q.c),me[0]&8&&Me(Ct,B[3].q.m),me[0]&8&&Ml.value!==B[3].q.b&&oe(Ml,B[3].q.b),B[3].q.m==3?rt?(rt.p(B,me),me[0]&8&&I(rt,1)):(rt=df(B),rt.c(),I(rt,1),rt.m(l,As)):rt&&(Ae(),q(rt,1,1,()=>{rt=null}),Pe()),B[3].q.m==4?at?(at.p(B,me),me[0]&8&&I(at,1)):(at=hf(B),at.c(),I(at,1),at.m(l,Ps)):at&&(Ae(),q(at,1,1,()=>{at=null}),Pe()),B[3].c.es!=null?ut?(ut.p(B,me),me[0]&8&&I(ut,1)):(ut=vf(B),ut.c(),I(ut,1),ut.m(l,Ds)):ut&&(Ae(),q(ut,1,1,()=>{ut=null}),Pe()),me[0]&8&&(Ls=B[3].p.r.startsWith("10YNO")||B[3].p.r.startsWith("10Y1001A1001A4")),Ls?ft?(ft.p(B,me),me[0]&8&&I(ft,1)):(ft=kf(B),ft.c(),I(ft,1),ft.m(l,Rs)):ft&&(Ae(),q(ft,1,1,()=>{ft=null}),Pe()),me[0]&136){Zn=B[7];let Qt;for(Qt=0;Qt20||B[0].chip=="esp8266"||B[3].i.d.d>0?ct?(ct.p(B,me),me[0]&9&&I(ct,1)):(ct=Cf(B),ct.c(),I(ct,1),ct.m(l,Is)):ct&&(Ae(),q(ct,1,1,()=>{ct=null}),Pe()),me[0]&8&&(ol.checked=B[3].d.s),B[3].d.s?Dt?Dt.p(B,me):(Dt=Af(B),Dt.c(),Dt.m(jt,null)):Dt&&(Dt.d(1),Dt=null);const da={};me[0]&2&&(da.active=B[1]),tn.$set(da);const ha={};me[0]&4&&(ha.active=B[2]),ln.$set(ha);const va={};me[0]&16&&(va.active=B[4]),nn.$set(va);const ba={};me[0]&32&&(ba.active=B[5]),sn.$set(ba)},i(B){Yt||(I(c.$$.fragment,B),I(A.$$.fragment,B),I(ht.$$.fragment,B),I(Dl.$$.fragment,B),I(Mn.$$.fragment,B),I(En.$$.fragment,B),I(Dn.$$.fragment,B),I(Rn.$$.fragment,B),I(ot),I(rt),I(at),I(ut),I(ft),I(Vn.$$.fragment,B),I(ct),I(Yn.$$.fragment,B),I(tn.$$.fragment,B),I(ln.$$.fragment,B),I(nn.$$.fragment,B),I(sn.$$.fragment,B),Yt=!0)},o(B){q(c.$$.fragment,B),q(A.$$.fragment,B),q(ht.$$.fragment,B),q(Dl.$$.fragment,B),q(Mn.$$.fragment,B),q(En.$$.fragment,B),q(Dn.$$.fragment,B),q(Rn.$$.fragment,B),q(ot),q(rt),q(at),q(ut),q(ft),q(Vn.$$.fragment,B),q(ct),q(Yn.$$.fragment,B),q(tn.$$.fragment,B),q(ln.$$.fragment,B),q(nn.$$.fragment,B),q(sn.$$.fragment,B),Yt=!1},d(B){B&&S(e),ie(c),ie(A),dt(di,B),ie(ht),St&&St.d(),Mt&&Mt.d(),ie(Dl),dt(hi,B),Tt&&Tt.d(),$t&&$t.d(),Nt&&Nt.d(),ie(Mn),Ht&&Ht.d(),Et&&Et.d(),ie(En),ie(Dn),At&&At.d(),ie(Rn),Pt&&Pt.d(),ot&&ot.d(),rt&&rt.d(),at&&at.d(),ut&&ut.d(),ft&&ft.d(),ie(Vn),dt(bt,B),ct&&ct.d(),ie(Yn),Dt&&Dt.d(),B&&S(Fs),ie(tn,B),B&&S(Bs),ie(ln,B),B&&S(qs),ie(nn,B),B&&S(Us),ie(sn,B),js=!1,Ge(pa)}}}async function B_(){await(await fetch("reboot",{method:"POST"})).json()}function q_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],u=!0,c=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},d:{d:null,b:0},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{e:!1,i:null,s:null,es:null}};gi.subscribe(We=>{We.version&&(l(3,a=We),l(1,u=!1))}),l_();let f=!1,p=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,f=!0);const We=new URLSearchParams;We.append("perform","true");let Gl=await(await fetch("reset",{method:"POST",body:We})).json();l(4,f=!1),l(5,p=Gl.success)}}async function v(We){l(2,c=!0);const yt=new FormData(We.target),Gl=new URLSearchParams;for(let Vt of yt){const[Ll,Fi]=Vt;Gl.append(Ll,Fi)}let Gt=await(await fetch("save",{method:"POST",body:Gl})).json();Wt.update(Vt=>(Vt.booting=Gt.reboot,Vt.ui=a.u,Vt)),l(2,c=!1),cn(n)}const h=function(){confirm("Are you sure you want to reboot the device?")&&(Wt.update(We=>(We.booting=!0,We)),B_())};async function d(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),gi.update(yt=>(yt.q.s.c=!1,yt)))}async function g(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),gi.update(yt=>(yt.q.s.r=!1,yt)))}async function w(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),gi.update(yt=>(yt.q.s.k=!1,yt)))}const D=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let T=44;function E(){a.g.h=this.value,l(3,a)}function F(){a.g.t=tt(this),l(3,a)}function O(){a.p.r=tt(this),l(3,a)}function R(){a.p.c=tt(this),l(3,a)}function y(){a.p.e=this.checked,l(3,a)}function A(){a.p.t=this.value,l(3,a)}function te(){a.g.s=tt(this),l(3,a)}function W(){a.g.u=this.value,l(3,a)}function j(){a.g.p=this.value,l(3,a)}function U(){a.g.c=this.value,l(3,a)}function K(){a.m.a=tt(this),l(3,a)}function Y(){a.m.i=this.checked,l(3,a)}function G(){a.m.b=tt(this),l(3,a)}function Z(){a.m.p=tt(this),l(3,a)}function V(){a.m.s=ge(this.value),l(3,a)}function H(){a.m.d=tt(this),l(3,a)}function x(){a.m.f=ge(this.value),l(3,a)}function ue(){a.m.r=ge(this.value),l(3,a)}function re(){a.m.e.e=this.checked,l(3,a)}function Q(){a.m.e.k=this.value,l(3,a)}function z(){a.m.e.a=this.value,l(3,a)}function we(){a.m.m.e=this.checked,l(3,a)}function He(){a.m.m.w=ge(this.value),l(3,a)}function Ie(){a.m.m.v=ge(this.value),l(3,a)}function Se(){a.m.m.a=ge(this.value),l(3,a)}function ye(){a.m.m.c=ge(this.value),l(3,a)}function he(){a.n.c=tt(this),l(3,a)}function $e(){a.w.s=this.value,l(3,a)}function be(){a.w.p=this.value,l(3,a)}function $(){a.w.z=tt(this),l(3,a)}function C(){a.w.w=ge(this.value),l(3,a)}function k(){a.w.b=this.checked,l(3,a)}function P(){a.n.m=tt(this),l(3,a)}function L(){a.n.i=this.value,l(3,a)}function X(){a.n.s=tt(this),l(3,a)}function le(){a.n.g=this.value,l(3,a)}function fe(){a.n.d1=this.value,l(3,a)}function de(){a.n.d2=this.value,l(3,a)}function Ce(){a.n.d=this.checked,l(3,a)}function Oe(){a.n.h=this.checked,l(3,a)}function ae(){a.n.n1=this.value,l(3,a)}function Te(){a.q.s.e=this.checked,l(3,a)}function Je(){a.q.h=this.value,l(3,a)}function It(){a.q.p=ge(this.value),l(3,a)}function st(){a.q.u=this.value,l(3,a)}function kt(){a.q.a=this.value,l(3,a)}function nt(){a.q.c=this.value,l(3,a)}function Ot(){a.q.m=tt(this),l(3,a)}function Qe(){a.q.b=this.value,l(3,a)}function Zt(){a.o.e=this.value,l(3,a)}function zt(){a.o.c=this.value,l(3,a)}function ht(){a.o.u1=this.value,l(3,a)}function xe(){a.o.u2=this.value,l(3,a)}function Ve(){a.o.u3=this.value,l(3,a)}function Ye(){a.h.t=this.value,l(3,a)}function Ne(){a.h.h=this.value,l(3,a)}function Ze(){a.h.n=this.value,l(3,a)}function et(){a.c.e=this.checked,l(3,a)}function Be(){a.c.es=this.checked,l(3,a)}function Fe(We){a.t.t[We]=ge(this.value),l(3,a)}function _e(){a.t.h=ge(this.value),l(3,a)}function ce(We){a.u[We.key]=tt(this),l(3,a)}function qe(){a.i.h.p=tt(this),l(3,a)}function pt(){a.i.h.t=tt(this),l(3,a)}function Nl(){a.i.h.u=this.checked,l(3,a)}function El(){a.i.a=ge(this.value),l(3,a)}function Al(){a.i.l.p=ge(this.value),l(3,a)}function Ni(){a.i.l.i=this.checked,l(3,a)}function oi(){a.i.r.i=this.checked,l(3,a)}function gl(){a.i.r.r=ge(this.value),l(3,a)}function Ei(){a.i.r.g=ge(this.value),l(3,a)}function Ai(){a.i.r.b=ge(this.value),l(3,a)}function Pi(){a.i.d.d=ge(this.value),l(3,a)}function wt(){a.i.t.d=ge(this.value),l(3,a)}function Di(){a.i.t.a=ge(this.value),l(3,a)}function je(){a.i.v.p=ge(this.value),l(3,a)}function pn(){a.i.v.d.v=ge(this.value),l(3,a)}function Li(){a.i.v.d.g=ge(this.value),l(3,a)}function Pl(){a.i.d.b=tt(this),l(3,a)}function Dl(){a.i.v.o=ge(this.value),l(3,a)}function Ri(){a.i.v.m=ge(this.value),l(3,a)}function Wl(){a.i.v.b=ge(this.value),l(3,a)}function Ii(){a.d.s=this.checked,l(3,a)}function zl(){a.d.t=this.checked,l(3,a)}function Oi(){a.d.l=tt(this),l(3,a)}return t.$$set=We=>{"basepath"in We&&l(15,n=We.basepath),"sysinfo"in We&&l(0,i=We.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,T=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,u,c,a,f,p,T,o,_,v,h,d,g,w,D,n,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z,V,H,x,ue,re,Q,z,we,He,Ie,Se,ye,he,$e,be,$,C,k,P,L,X,le,fe,de,Ce,Oe,ae,Te,Je,It,st,kt,nt,Ot,Qe,Zt,zt,ht,xe,Ve,Ye,Ne,Ze,et,Be,Fe,_e,ce,qe,pt,Nl,El,Al,Ni,oi,gl,Ei,Ai,Pi,wt,Di,je,pn,Li,Pl,Dl,Ri,Wl,Ii,zl,Oi]}class U_ extends Re{constructor(e){super(),Le(this,e,q_,F_,Ee,{basepath:15,sysinfo:0},null,[-1,-1,-1,-1])}}function Df(t,e,l){const n=t.slice();return n[20]=e[l],n}function j_(t){let e=ve(t[1].chip,t[1].board)+"",l;return{c(){l=N(e)},m(n,i){M(n,l,i)},p(n,i){i&2&&e!==(e=ve(n[1].chip,n[1].board)+"")&&J(l,e)},d(n){n&&S(l)}}}function Lf(t){let e,l,n=t[1].apmac+"",i,o,u,c,a,f,p,_,v,h=Fa(t[1])+"",d,g,w=t[1].boot_reason+"",D,T,E=t[1].ex_cause+"",F,O,R;const y=[W_,H_],A=[];function te(W,j){return W[0].u>0?0:1}return a=te(t),f=A[a]=y[a](t),{c(){e=m("div"),l=N("AP MAC: "),i=N(n),o=b(),u=m("div"),c=N(`Last boot: - `),f.c(),p=b(),_=m("div"),v=N("Reason: "),d=N(h),g=N(" ("),D=N(w),T=N("/"),F=N(E),O=N(")"),r(e,"class","my-2"),r(u,"class","my-2"),r(_,"class","my-2")},m(W,j){M(W,e,j),s(e,l),s(e,i),M(W,o,j),M(W,u,j),s(u,c),A[a].m(u,null),M(W,p,j),M(W,_,j),s(_,v),s(_,d),s(_,g),s(_,D),s(_,T),s(_,F),s(_,O),R=!0},p(W,j){(!R||j&2)&&n!==(n=W[1].apmac+"")&&J(i,n);let U=a;a=te(W),a===U?A[a].p(W,j):(Ae(),q(A[U],1,1,()=>{A[U]=null}),Pe(),f=A[a],f?f.p(W,j):(f=A[a]=y[a](W),f.c()),I(f,1),f.m(u,null)),(!R||j&2)&&h!==(h=Fa(W[1])+"")&&J(d,h),(!R||j&2)&&w!==(w=W[1].boot_reason+"")&&J(D,w),(!R||j&2)&&E!==(E=W[1].ex_cause+"")&&J(F,E)},i(W){R||(I(f),R=!0)},o(W){q(f),R=!1},d(W){W&&S(e),W&&S(o),W&&S(u),A[a].d(),W&&S(p),W&&S(_)}}}function H_(t){let e;return{c(){e=N("-")},m(l,n){M(l,e,n)},p:pe,i:pe,o:pe,d(l){l&&S(e)}}}function W_(t){let e,l;return e=new i1({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function z_(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){M(l,e,n)},p:pe,d(l){l&&S(e)}}}function Rf(t){let e,l,n,i,o,u=gs(t[1].meter.mfg)+"",c,a,f,p,_=(t[1].meter.model?t[1].meter.model:"unknown")+"",v,h,d,g,w=(t[1].meter.id?t[1].meter.id:"unknown")+"",D;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=b(),i=m("div"),o=N("Manufacturer: "),c=N(u),a=b(),f=m("div"),p=N("Model: "),v=N(_),h=b(),d=m("div"),g=N("ID: "),D=N(w),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(e,"class","cnt")},m(T,E){M(T,e,E),s(e,l),s(e,n),s(e,i),s(i,o),s(i,c),s(e,a),s(e,f),s(f,p),s(f,v),s(e,h),s(e,d),s(d,g),s(d,D)},p(T,E){E&2&&u!==(u=gs(T[1].meter.mfg)+"")&&J(c,u),E&2&&_!==(_=(T[1].meter.model?T[1].meter.model:"unknown")+"")&&J(v,_),E&2&&w!==(w=(T[1].meter.id?T[1].meter.id:"unknown")+"")&&J(D,w)},d(T){T&&S(e)}}}function If(t){let e,l,n,i,o,u=t[1].net.ip+"",c,a,f,p,_=t[1].net.mask+"",v,h,d,g,w=t[1].net.gw+"",D,T,E,F,O=t[1].net.dns1+"",R,y,A=t[1].net.dns2&&Of(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=b(),i=m("div"),o=N("IP: "),c=N(u),a=b(),f=m("div"),p=N("Mask: "),v=N(_),h=b(),d=m("div"),g=N("Gateway: "),D=N(w),T=b(),E=m("div"),F=N("DNS: "),R=N(O),y=b(),A&&A.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(E,"class","my-2"),r(e,"class","cnt")},m(te,W){M(te,e,W),s(e,l),s(e,n),s(e,i),s(i,o),s(i,c),s(e,a),s(e,f),s(f,p),s(f,v),s(e,h),s(e,d),s(d,g),s(d,D),s(e,T),s(e,E),s(E,F),s(E,R),s(E,y),A&&A.m(E,null)},p(te,W){W&2&&u!==(u=te[1].net.ip+"")&&J(c,u),W&2&&_!==(_=te[1].net.mask+"")&&J(v,_),W&2&&w!==(w=te[1].net.gw+"")&&J(D,w),W&2&&O!==(O=te[1].net.dns1+"")&&J(R,O),te[1].net.dns2?A?A.p(te,W):(A=Of(te),A.c(),A.m(E,null)):A&&(A.d(1),A=null)},d(te){te&&S(e),A&&A.d()}}}function Of(t){let e,l=t[1].net.dns2+"",n;return{c(){e=N("/ "),n=N(l)},m(i,o){M(i,e,o),M(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&J(n,l)},d(i){i&&S(e),i&&S(n)}}}function Ff(t){let e,l,n,i=t[1].upgrade.f+"",o,u,c=t[1].upgrade.t+"",a,f,p=Oa(t[1].upgrade.e)+"",_;return{c(){e=m("div"),l=m("div"),n=N("Previous upgrade attempt from "),o=N(i),u=N(" to "),a=N(c),f=N(" failed. "),_=N(p),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(v,h){M(v,e,h),s(e,l),s(l,n),s(l,o),s(l,u),s(l,a),s(l,f),s(l,_)},p(v,h){h&2&&i!==(i=v[1].upgrade.f+"")&&J(o,i),h&2&&c!==(c=v[1].upgrade.t+"")&&J(a,c),h&2&&p!==(p=Oa(v[1].upgrade.e)+"")&&J(_,p)},d(v){v&&S(e)}}}function Bf(t){let e,l,n,i=t[2].tag_name+"",o,u,c,a,f,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&qf(t),v=t[1].fwconsent===2&&Uf();return{c(){e=m("div"),l=N(`Latest version: - `),n=m("a"),o=N(i),c=b(),_&&_.c(),a=b(),v&&v.c(),f=Ke(),r(n,"href",u=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(h,d){M(h,e,d),s(e,l),s(e,n),s(n,o),s(e,c),_&&_.m(e,null),M(h,a,d),v&&v.m(h,d),M(h,f,d),p=!0},p(h,d){(!p||d&4)&&i!==(i=h[2].tag_name+"")&&J(o,i),(!p||d&4&&u!==(u=h[2].html_url))&&r(n,"href",u),(h[1].security==0||h[0].a)&&h[1].fwconsent===1&&h[2]&&h[2].tag_name!=h[1].version?_?(_.p(h,d),d&7&&I(_,1)):(_=qf(h),_.c(),I(_,1),_.m(e,null)):_&&(Ae(),q(_,1,1,()=>{_=null}),Pe()),h[1].fwconsent===2?v||(v=Uf(),v.c(),v.m(f.parentNode,f)):v&&(v.d(1),v=null)},i(h){p||(I(_),p=!0)},o(h){q(_),p=!1},d(h){h&&S(e),_&&_.d(),h&&S(a),v&&v.d(h),h&&S(f)}}}function qf(t){let e,l,n,i,o,u;return n=new s1({}),{c(){e=m("div"),l=m("button"),se(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(c,a){M(c,e,a),s(e,l),ne(n,l,null),i=!0,o||(u=ee(l,"click",t[10]),o=!0)},p:pe,i(c){i||(I(n.$$.fragment,c),i=!0)},o(c){q(n.$$.fragment,c),i=!1},d(c){c&&S(e),ie(n),o=!1,u()}}}function Uf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',r(e,"class","my-2")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function jf(t){let e,l=ks(ve(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=ks(ve(i[1].chip,i[1].board))+"")&&J(n,l)},d(i){i&&S(e)}}}function Hf(t){let e,l,n,i,o,u;function c(p,_){return p[4].length==0?V_:G_}let a=c(t),f=a(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=b(),f.c(),ho(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(p,_){M(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(u=[ee(n,"change",t[13]),ee(l,"submit",t[15])],o=!0)},p(p,_){a===(a=c(p))&&f?f.p(p,_):(f.d(1),f=a(p),f&&(f.c(),f.m(l,null)))},d(p){p&&S(e),t[12](null),f.d(),o=!1,Ge(u)}}}function G_(t){let e=t[4][0].name+"",l,n,i;return{c(){l=N(e),n=b(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,u){M(o,l,u),M(o,n,u),M(o,i,u)},p(o,u){u&16&&e!==(e=o[4][0].name+"")&&J(l,e)},d(o){o&&S(l),o&&S(n),o&&S(i)}}}function V_(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){M(i,e,o),l||(n=ee(e,"click",t[14]),l=!0)},p:pe,d(i){i&&S(e),l=!1,n()}}}function Wf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g=t[9],w=[];for(let O=0;O Include Secrets
(SSID, PSK, passwords and tokens)',a=b(),D&&D.c(),f=b(),p=m("form"),_=m("input"),v=b(),F.c(),r(l,"class","text-sm"),r(c,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),ho(_,"display","none"),r(_,"name","file"),r(_,"type","file"),r(_,"accept",".cfg"),r(p,"action","/configfile"),r(p,"enctype","multipart/form-data"),r(p,"method","post"),r(p,"autocomplete","off"),r(e,"class","cnt")},m(O,R){M(O,e,R),s(e,l),s(e,n),s(e,i),s(i,o);for(let y=0;y{P=null}),Pe());const It={};Te&8388608&&(It.$$scope={dirty:Te,ctx:ae}),te.$set(It),ae[1].meter?L?L.p(ae,Te):(L=Rf(ae),L.c(),L.m(e,K)):L&&(L.d(1),L=null),ae[1].net?X?X.p(ae,Te):(X=If(ae),X.c(),X.m(e,Y)):X&&(X.d(1),X=null),(!$||Te&2)&&ue!==(ue=ae[1].version+"")&&J(re,ue),ae[1].upgrade.t&&ae[1].upgrade.t!=ae[1].version?le?le.p(ae,Te):(le=Ff(ae),le.c(),le.m(G,z)):le&&(le.d(1),le=null),ae[2]?fe?(fe.p(ae,Te),Te&4&&I(fe,1)):(fe=Bf(ae),fe.c(),I(fe,1),fe.m(G,we)):fe&&(Ae(),q(fe,1,1,()=>{fe=null}),Pe()),Te&3&&(He=(ae[1].security==0||ae[0].a)&&li(ae[1].board)),He?de?de.p(ae,Te):(de=jf(ae),de.c(),de.m(G,Ie)):de&&(de.d(1),de=null),ae[1].security==0||ae[0].a?Ce?Ce.p(ae,Te):(Ce=Hf(ae),Ce.c(),Ce.m(G,null)):Ce&&(Ce.d(1),Ce=null),ae[1].security==0||ae[0].a?Oe?Oe.p(ae,Te):(Oe=Wf(ae),Oe.c(),Oe.m(e,null)):Oe&&(Oe.d(1),Oe=null);const st={};Te&32&&(st.active=ae[5]),he.$set(st);const kt={};Te&256&&(kt.active=ae[8]),be.$set(kt)},i(ae){$||(I(w.$$.fragment,ae),I(P),I(te.$$.fragment,ae),I(fe),I(he.$$.fragment,ae),I(be.$$.fragment,ae),$=!0)},o(ae){q(w.$$.fragment,ae),q(P),q(te.$$.fragment,ae),q(fe),q(he.$$.fragment,ae),q(be.$$.fragment,ae),$=!1},d(ae){ae&&S(e),ie(w),P&&P.d(),ie(te),L&&L.d(),X&&X.d(),le&&le.d(),fe&&fe.d(),de&&de.d(),Ce&&Ce.d(),Oe&&Oe.d(),ae&&S(ye),ie(he,ae),ae&&S($e),ie(be,ae),C=!1,k()}}}async function X_(){await(await fetch("reboot",{method:"POST"})).json()}function Z_(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],u={};To.subscribe(y=>{l(2,u=n1(i.version,y)),u||l(2,u=y[0])});function c(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(ks(ve(i.chip,i.board))))&&(Wt.update(y=>(y.upgrading=!0,y)),l1(u.tag_name))}const a=function(){confirm("Are you sure you want to reboot the device?")&&(Wt.update(y=>(y.booting=!0,y)),X_())};let f,p=[],_=!1,v,h=[],d=!1;yo();function g(y){vs[y?"unshift":"push"](()=>{f=y,l(3,f)})}function w(){p=this.files,l(4,p)}const D=()=>{f.click()},T=()=>l(5,_=!0);function E(y){vs[y?"unshift":"push"](()=>{v=y,l(6,v)})}function F(){h=this.files,l(7,h)}const O=()=>{v.click()},R=()=>l(8,d=!0);return t.$$set=y=>{"data"in y&&l(0,n=y.data),"sysinfo"in y&&l(1,i=y.sysinfo)},[n,i,u,f,p,_,v,h,d,o,c,a,g,w,D,T,E,F,O,R]}class J_ extends Re{constructor(e){super(),Le(this,e,Z_,Q_,Ee,{data:0,sysinfo:1})}}function Vf(t){let e,l,n=ve(t[0],7)+"",i,o,u=ve(t[0],5)+"",c,a,f=ve(t[0],4)+"",p,_,v=ve(t[0],3)+"",h,d,g,w,D=ve(t[0],2)+"",T,E,F=ve(t[0],1)+"",O,R,y=ve(t[0],0)+"",A,te,W,j,U=ve(t[0],101)+"",K,Y,G=ve(t[0],100)+"",Z;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),c=N(u),a=m("option"),p=N(f),_=m("option"),h=N(v),d=b(),g=m("optgroup"),w=m("option"),T=N(D),E=m("option"),O=N(F),R=m("option"),A=N(y),te=b(),W=m("optgroup"),j=m("option"),K=N(U),Y=m("option"),Z=N(G),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,a.__value=4,a.value=a.__value,_.__value=3,_.value=_.__value,r(e,"label","amsleser.no"),w.__value=2,w.value=w.__value,E.__value=1,E.value=E.__value,R.__value=0,R.value=R.__value,r(g,"label","Custom hardware"),j.__value=101,j.value=j.__value,Y.__value=100,Y.value=Y.__value,r(W,"label","Generic hardware")},m(V,H){M(V,e,H),s(e,l),s(l,i),s(e,o),s(o,c),s(e,a),s(a,p),s(e,_),s(_,h),M(V,d,H),M(V,g,H),s(g,w),s(w,T),s(g,E),s(E,O),s(g,R),s(R,A),M(V,te,H),M(V,W,H),s(W,j),s(j,K),s(W,Y),s(Y,Z)},p(V,H){H&1&&n!==(n=ve(V[0],7)+"")&&J(i,n),H&1&&u!==(u=ve(V[0],5)+"")&&J(c,u),H&1&&f!==(f=ve(V[0],4)+"")&&J(p,f),H&1&&v!==(v=ve(V[0],3)+"")&&J(h,v),H&1&&D!==(D=ve(V[0],2)+"")&&J(T,D),H&1&&F!==(F=ve(V[0],1)+"")&&J(O,F),H&1&&y!==(y=ve(V[0],0)+"")&&J(A,y),H&1&&U!==(U=ve(V[0],101)+"")&&J(K,U),H&1&&G!==(G=ve(V[0],100)+"")&&J(Z,G)},d(V){V&&S(e),V&&S(d),V&&S(g),V&&S(te),V&&S(W)}}}function Kf(t){let e,l,n=ve(t[0],201)+"",i,o,u=ve(t[0],202)+"",c,a,f=ve(t[0],203)+"",p,_,v=ve(t[0],241)+"",h,d,g=ve(t[0],242)+"",w,D,T=ve(t[0],243)+"",E,F,O=ve(t[0],200)+"",R;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),c=N(u),a=m("option"),p=N(f),_=m("option"),h=N(v),d=m("option"),w=N(g),D=m("option"),E=N(T),F=m("option"),R=N(O),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,a.__value=203,a.value=a.__value,_.__value=241,_.value=_.__value,d.__value=242,d.value=d.__value,D.__value=243,D.value=D.__value,F.__value=200,F.value=F.__value,r(e,"label","Generic hardware")},m(y,A){M(y,e,A),s(e,l),s(l,i),s(e,o),s(o,c),s(e,a),s(a,p),s(e,_),s(_,h),s(e,d),s(d,w),s(e,D),s(D,E),s(e,F),s(F,R)},p(y,A){A&1&&n!==(n=ve(y[0],201)+"")&&J(i,n),A&1&&u!==(u=ve(y[0],202)+"")&&J(c,u),A&1&&f!==(f=ve(y[0],203)+"")&&J(p,f),A&1&&v!==(v=ve(y[0],241)+"")&&J(h,v),A&1&&g!==(g=ve(y[0],242)+"")&&J(w,g),A&1&&T!==(T=ve(y[0],243)+"")&&J(E,T),A&1&&O!==(O=ve(y[0],200)+"")&&J(R,O)},d(y){y&&S(e)}}}function Yf(t){let e,l,n=ve(t[0],7)+"",i,o,u=ve(t[0],6)+"",c,a,f=ve(t[0],5)+"",p,_,v,h,d=ve(t[0],51)+"",g,w,D=ve(t[0],50)+"",T;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),c=N(u),a=m("option"),p=N(f),_=b(),v=m("optgroup"),h=m("option"),g=N(d),w=m("option"),T=N(D),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,a.__value=5,a.value=a.__value,r(e,"label","amsleser.no"),h.__value=51,h.value=h.__value,w.__value=50,w.value=w.__value,r(v,"label","Generic hardware")},m(E,F){M(E,e,F),s(e,l),s(l,i),s(e,o),s(o,c),s(e,a),s(a,p),M(E,_,F),M(E,v,F),s(v,h),s(h,g),s(v,w),s(w,T)},p(E,F){F&1&&n!==(n=ve(E[0],7)+"")&&J(i,n),F&1&&u!==(u=ve(E[0],6)+"")&&J(c,u),F&1&&f!==(f=ve(E[0],5)+"")&&J(p,f),F&1&&d!==(d=ve(E[0],51)+"")&&J(g,d),F&1&&D!==(D=ve(E[0],50)+"")&&J(T,D)},d(E){E&&S(e),E&&S(_),E&&S(v)}}}function Qf(t){let e,l,n=ve(t[0],8)+"",i,o,u,c,a=ve(t[0],71)+"",f,p,_=ve(t[0],70)+"",v;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=b(),u=m("optgroup"),c=m("option"),f=N(a),p=m("option"),v=N(_),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),c.__value=71,c.value=c.__value,p.__value=70,p.value=p.__value,r(u,"label","Generic hardware")},m(h,d){M(h,e,d),s(e,l),s(l,i),M(h,o,d),M(h,u,d),s(u,c),s(c,f),s(u,p),s(p,v)},p(h,d){d&1&&n!==(n=ve(h[0],8)+"")&&J(i,n),d&1&&a!==(a=ve(h[0],71)+"")&&J(f,a),d&1&&_!==(_=ve(h[0],70)+"")&&J(v,_)},d(h){h&&S(e),h&&S(o),h&&S(u)}}}function Xf(t){let e,l,n=ve(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=N(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=ve(o[0],200)+"")&&J(i,n)},d(o){o&&S(e)}}}function Zf(t){let e,l,n=ve(t[0],80)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=N(n),l.__value=80,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=ve(o[0],80)+"")&&J(i,n)},d(o){o&&S(e)}}}function x_(t){let e,l,n,i,o,u,c,a,f=t[0]=="esp8266"&&Vf(t),p=t[0]=="esp32"&&Kf(t),_=t[0]=="esp32s2"&&Yf(t),v=t[0]=="esp32c3"&&Qf(t),h=t[0]=="esp32solo"&&Xf(t),d=t[0]=="esp32s3"&&Zf(t);return{c(){e=m("option"),l=b(),f&&f.c(),n=b(),p&&p.c(),i=b(),_&&_.c(),o=b(),v&&v.c(),u=b(),h&&h.c(),c=b(),d&&d.c(),a=Ke(),e.__value=-1,e.value=e.__value},m(g,w){M(g,e,w),M(g,l,w),f&&f.m(g,w),M(g,n,w),p&&p.m(g,w),M(g,i,w),_&&_.m(g,w),M(g,o,w),v&&v.m(g,w),M(g,u,w),h&&h.m(g,w),M(g,c,w),d&&d.m(g,w),M(g,a,w)},p(g,[w]){g[0]=="esp8266"?f?f.p(g,w):(f=Vf(g),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),g[0]=="esp32"?p?p.p(g,w):(p=Kf(g),p.c(),p.m(i.parentNode,i)):p&&(p.d(1),p=null),g[0]=="esp32s2"?_?_.p(g,w):(_=Yf(g),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),g[0]=="esp32c3"?v?v.p(g,w):(v=Qf(g),v.c(),v.m(u.parentNode,u)):v&&(v.d(1),v=null),g[0]=="esp32solo"?h?h.p(g,w):(h=Xf(g),h.c(),h.m(c.parentNode,c)):h&&(h.d(1),h=null),g[0]=="esp32s3"?d?d.p(g,w):(d=Zf(g),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null)},i:pe,o:pe,d(g){g&&S(e),g&&S(l),f&&f.d(g),g&&S(n),p&&p.d(g),g&&S(i),_&&_.d(g),g&&S(o),v&&v.d(g),g&&S(u),h&&h.d(g),g&&S(c),d&&d.d(g),g&&S(a)}}}function ep(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class tp extends Re{constructor(e){super(),Le(this,e,ep,x_,Ee,{chip:0})}}function Jf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function xf(t){let e,l,n,i,o,u,c;return u=new ao({props:{chip:t[0].chip}}),{c(){e=m("div"),l=N("HAN GPIO"),n=m("br"),i=b(),o=m("select"),se(u.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ne(u,o,null),c=!0},p(a,f){const p={};f&1&&(p.chip=a[0].chip),u.$set(p)},i(a){c||(I(u.$$.fragment,a),c=!0)},o(a){q(u.$$.fragment,a),c=!1},d(a){a&&S(e),ie(u)}}}function lp(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y=t[0].usrcfg&&Jf();d=new tp({props:{chip:t[0].chip}});let G=t[0].board&&t[0].board>20&&xf(t);return W=new gt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),u=m("strong"),u.textContent="Initial configuration",c=b(),Y&&Y.c(),a=b(),f=m("div"),p=N("Board type"),_=m("br"),v=b(),h=m("select"),se(d.$$.fragment),g=b(),G&&G.c(),w=b(),D=m("div"),T=m("label"),E=m("input"),F=N(" Clear all other configuration"),O=b(),R=m("div"),R.innerHTML='',y=b(),A=m("span"),A.textContent="\xA0",te=b(),se(W.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(u,"class","text-sm"),r(h,"name","vb"),r(h,"class","in-s"),t[0].board===void 0&&ze(()=>t[5].call(h)),r(f,"class","my-3"),r(E,"type","checkbox"),r(E,"name","vr"),E.__value="true",E.value=E.__value,r(E,"class","rounded mb-1"),r(D,"class","my-3"),r(R,"class","my-3"),r(A,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Z,V){M(Z,e,V),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,c),Y&&Y.m(n,null),s(n,a),s(n,f),s(f,p),s(f,_),s(f,v),s(f,h),ne(d,h,null),Me(h,t[0].board,!0),s(n,g),G&&G.m(n,null),s(n,w),s(n,D),s(D,T),s(T,E),E.checked=t[2],s(T,F),s(n,O),s(n,R),s(n,y),s(n,A),M(Z,te,V),ne(W,Z,V),j=!0,U||(K=[ee(h,"change",t[5]),ee(E,"change",t[6]),ee(n,"submit",Ci(t[3]))],U=!0)},p(Z,[V]){Z[0].usrcfg?Y||(Y=Jf(),Y.c(),Y.m(n,a)):Y&&(Y.d(1),Y=null);const H={};V&1&&(H.chip=Z[0].chip),d.$set(H),V&1&&Me(h,Z[0].board),Z[0].board&&Z[0].board>20?G?(G.p(Z,V),V&1&&I(G,1)):(G=xf(Z),G.c(),I(G,1),G.m(n,w)):G&&(Ae(),q(G,1,1,()=>{G=null}),Pe()),V&4&&(E.checked=Z[2]);const x={};V&2&&(x.active=Z[1]),W.$set(x)},i(Z){j||(I(d.$$.fragment,Z),I(G),I(W.$$.fragment,Z),j=!0)},o(Z){q(d.$$.fragment,Z),q(G),q(W.$$.fragment,Z),j=!1},d(Z){Z&&S(e),Y&&Y.d(),ie(d),G&&G.d(),Z&&S(te),ie(W,Z),U=!1,Ge(K)}}}function np(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(p){l(1,o=!0);const _=new FormData(p.target),v=new URLSearchParams;for(let g of _){const[w,D]=g;v.append(w,D)}let d=await(await fetch("save",{method:"POST",body:v})).json();l(1,o=!1),Wt.update(g=>(g.vndcfg=d.success,g.booting=d.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),cn(n+(i.usrcfg?"/":"/setup"))}let c=!1;Wt.subscribe(p=>{l(0,i=p),p.fwconsent===1&&l(2,c=!i.usrcfg)});function a(){i.board=tt(this),l(0,i)}function f(){c=this.checked,l(2,c)}return t.$$set=p=>{"basepath"in p&&l(4,n=p.basepath),"sysinfo"in p&&l(0,i=p.sysinfo)},[i,o,c,u,n,a,f]}class ip extends Re{constructor(e){super(),Le(this,e,np,lp,Ee,{basepath:4,sysinfo:0})}}function ec(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function tc(t){let e,l,n,i,o,u,c,a,f,p,_,v,h;return{c(){e=m("div"),l=N("SSID"),n=m("br"),i=b(),o=m("input"),c=b(),a=m("div"),f=N("PSK"),p=m("br"),_=b(),v=m("input"),r(o,"name","ss"),r(o,"type","text"),r(o,"class","in-s"),o.required=u=t[2]==1||t[2]==2,r(e,"class","my-3"),r(v,"name","sp"),r(v,"type","password"),r(v,"class","in-s"),r(v,"autocomplete","off"),v.required=h=t[2]==2,r(a,"class","my-3")},m(d,g){M(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),M(d,c,g),M(d,a,g),s(a,f),s(a,p),s(a,_),s(a,v)},p(d,g){g&4&&u!==(u=d[2]==1||d[2]==2)&&(o.required=u),g&4&&h!==(h=d[2]==2)&&(v.required=h)},d(d){d&&S(e),d&&S(c),d&&S(a)}}}function lc(t){let e,l,n,i,o,u,c,a;return c=new a1({}),{c(){e=m("br"),l=b(),n=m("div"),i=m("input"),o=b(),u=m("select"),se(c.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(u,"name","su"),r(u,"class","in-l"),u.required=t[1],r(n,"class","flex")},m(f,p){M(f,e,p),M(f,l,p),M(f,n,p),s(n,i),s(n,o),s(n,u),ne(c,u,null),a=!0},p(f,p){(!a||p&2)&&(i.required=f[1]),(!a||p&2)&&(u.required=f[1])},i(f){a||(I(c.$$.fragment,f),a=!0)},o(f){q(c.$$.fragment,f),a=!1},d(f){f&&S(e),f&&S(l),f&&S(n),ie(c)}}}function nc(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
+Occurred in: ${i}`:"",u=ko(t),m=Tc(e)?e(u):e;return`<${u}> ${m}${o}`}const Uc=t=>(...e)=>t(V1(...e)),jc=Uc(t=>{throw new Error(t)}),ks=Uc(console.warn),Mr=4,K1=3,Y1=2,Q1=1,X1=1;function Z1(t,e){const l=t.default?0:wl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Mr,F1(i)?o+=X1:B1(i)?o+=Y1:Rc(i)?o-=Mr+Q1:o+=K1,o},0);return{route:t,score:l,index:e}}function J1(t){return t.map(Z1).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Hc(t,e){let l,n;const[i]=e.split("?"),o=wl(i),u=o[0]==="",m=J1(t);for(let r=0,f=m.length;r({...p,params:v,uri:P});if(p.default){n=h(e);continue}const d=wl(p.fullPath),g=Math.max(o.length,d.length);let k=0;for(;k{f===".."?r.pop():f!=="."&&r.push(f)}),Gs(`/${r.join("/")}`,n)}function Tr(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,u=wl(e,!0),m=wl(l,!0);for(;u.length;)u[0]!==m[0]&&jc(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),m.shift();return{pathname:Ni(...m),hash:n,search:i,state:o}}const $r=t=>t.length===1?"":t,wo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?$r(vi(t,l)):"",u=i?vi(t,0,l):t,m=n?$r(vi(u,e)):"";return{pathname:(n?vi(u,0,e):u)||"/",search:m,hash:o}},e0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function t0(t,e,l){return Ni(l,x1(t,e))}function l0(t,e){const l=bo(q1(t)),n=wl(l,!0),i=wl(e,!0).slice(0,n.length),o=Wc({fullPath:l},Ni(...i));return o&&o.uri}const Vs="POP",n0="PUSH",i0="REPLACE";function Ks(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function s0(t){let e=[],l=Ks(t),n=Vs;const i=(o=e)=>o.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const u=()=>{l=Ks(t),n=Vs,i([o])};i([o]);const m=Ec(t,"popstate",u);return()=>{m(),e=e.filter(r=>r!==o)}},navigate(o,u){const{state:m={},replace:r=!1}=u||{};if(n=r?i0:n0,$c(o))u&&ks(qc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Vs,t.history.go(o);else{const f={...m,_key:L1()};try{t.history[r?"replaceState":"pushState"](f,"",o)}catch{t.location[r?"replace":"assign"](o)}}l=Ks(t),i()}}}function Ys(t,e){return{...wo(e),state:t}}function o0(t="/"){let e=0,l=[Ys(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Ys(n,o))},replaceState(n,i,o){l[e]=Ys(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const a0=!!(!Hl&&window.document&&window.document.createElement),r0=!Hl&&window.location.origin==="null",zc=s0(a0&&!r0?window:o0()),{navigate:cn}=zc;let El=null,Gc=!0;function u0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nEl.level||t.level===El.level&&u0(t.routerId,El.routerId))&&(El=t)}function c0(){El=null}function m0(){Gc=!1}function Nr(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Ec(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function _0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function p0(t){return/^H[1-6]$/i.test(t.tagName)}function Er(t,e=document){return e.querySelector(t)}function d0(t){let l=Er(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!_0(l,t);){if(p0(l))return l;const n=Er("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function h0(t){Promise.resolve(ni(t.focusElement)).then(e=>{const l=e||d0(t.id);l||ks(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Cs),!Nr(l)&&Nr(document.documentElement)})}const v0=(t,e,l)=>(n,i)=>N1().then(()=>{if(!El||Gc){m0();return}if(n&&h0(El.route),t.announcements&&i){const{path:o,fullPath:u,meta:m,params:r,uri:f}=El.route,p=t.createAnnouncement({path:o,fullPath:u,meta:m,params:r,uri:f},ni(l));Promise.resolve(p).then(_=>{e.set(_)})}c0()}),b0="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 g0(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Ac(t[6],b0)],i={};for(let o=0;o`Navigated to ${ie.uri}`,announcements:!0,...d},P=p,T=bo(p),E=jl(Js),R=jl(si),j=!E,O=w0(),y=h&&!(R&&!R.manageFocus),A=pt("");gl(t,A,ie=>l(0,m=ie));const ne=R?R.disableInlineStyles:g,B=pt([]);gl(t,B,ie=>l(20,u=ie));const F=pt(null);gl(t,F,ie=>l(18,i=ie));let H=!1;const W=j?0:R.level+1,Y=j?pt((()=>Tr(Hl?wo(_):v.location,T))()):E;gl(t,Y,ie=>l(17,n=ie));const x=pt(n);gl(t,x,ie=>l(19,o=ie));const G=v0(k,A,Y),z=ie=>Q=>Q.filter(V=>V.id!==ie);function ee(ie){if(Hl){if(H)return;const Q=Wc(ie,n.pathname);if(Q)return H=!0,Q}else B.update(Q=>{const V=z(ie.id)(Q);return V.push(ie),V})}function ce(ie){B.update(z(ie))}return!j&&p!==Ar&&ks(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),j&&(wc(()=>v.listen(Q=>{const V=Tr(Q.location,T);x.set(n),Y.set(V)})),yi(Js,Y)),yi(si,{activeRoute:F,registerRoute:ee,unregisterRoute:ce,manageFocus:y,level:W,id:O,history:j?v:R.history,basepath:j?T:R.basepath,disableInlineStyles:ne}),t.$$set=ie=>{"basepath"in ie&&l(11,p=ie.basepath),"url"in ie&&l(12,_=ie.url),"history"in ie&&l(13,v=ie.history),"primary"in ie&&l(14,h=ie.primary),"a11y"in ie&&l(15,d=ie.a11y),"disableInlineStyles"in ie&&l(16,g=ie.disableInlineStyles),"$$scope"in ie&&l(21,f=ie.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==P&&ks(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ie=Hc(u,n.pathname);F.set(ie)}if(t.$$.dirty[0]&655360&&j){const ie=!!n.hash,Q=!ie&&y,V=!ie||n.pathname!==o.pathname;G(Q,V)}t.$$.dirty[0]&262144&&y&&i&&i.primary&&f0({level:W,routerId:O,route:i})},[m,k,j,O,y,A,ne,B,F,Y,x,p,_,v,h,d,g,n,i,o,u,f,r]}class C0 extends je{constructor(e){super(),Ue(this,e,y0,k0,Ie,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Vc=C0;function Ei(t,e,l=si,n=mn){jl(l)||jc(t,o=>`You cannot use ${o} outside of a ${ko(n)}.`,e)}const S0=t=>{const{subscribe:e}=jl(t);return{subscribe:e}};function Kc(){return Ei(Oc),S0(Js)}function Yc(){const{history:t}=jl(si);return t}function Qc(){const t=jl(Dc);return t?R1(t,e=>e.base):pt("/")}function Xc(){Ei(Bc);const t=Qc(),{basepath:e}=jl(si);return n=>t0(n,ni(t),e)}function M0(){Ei(Fc);const t=Xc(),{navigate:e}=Yc();return(n,i)=>{const o=$c(n)?n:t(n);return e(o,i)}}const T0=t=>({params:t&16,location:t&8}),Pr=t=>({params:Hl?ni(t[10]):t[4],location:t[3],navigate:t[11]});function Dr(t){let e,l;return e=new Vc({props:{primary:t[1],$$slots:{default:[E0]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function $0(t){let e;const l=t[18].default,n=mo(l,t,t[19],Pr);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&po(n,l,i,i[19],e?_o(l,i[19],o,T0):ho(i[19]),Pr)},i(i){e||(L(n,i),e=!0)},o(i){U(n,i),e=!1},d(i){n&&n.d(i)}}}function N0(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Hl?ni(t[10]):t[4],t[12]];var o=t[0];function u(m){let r={};for(let f=0;f{oe(p,1)}),Be()}o?(e=wr(o,u()),ae(e.$$.fragment),L(e.$$.fragment,1),se(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(m){n||(e&&L(e.$$.fragment,m),n=!0)},o(m){e&&U(e.$$.fragment,m),n=!1},d(m){m&&C(l),e&&oe(e,m)}}}function E0(t){let e,l,n,i;const o=[N0,$0],u=[];function m(r,f){return r[0]!==null?0:1}return e=m(t),l=u[e]=o[e](t),{c(){l.c(),n=nt()},m(r,f){u[e].m(r,f),S(r,n,f),i=!0},p(r,f){let p=e;e=m(r),e===p?u[e].p(r,f):(Fe(),U(u[p],1,1,()=>{u[p]=null}),Be(),l=u[e],l?l.p(r,f):(l=u[e]=o[e](r),l.c()),L(l,1),l.m(n.parentNode,n))},i(r){i||(L(l),i=!0)},o(r){U(l),i=!1},d(r){u[e].d(r),r&&C(n)}}}function A0(t){let e,l,n,i,o,u=[Zs(t[7]),{"data-svnav-route-start":t[5]}],m={};for(let _=0;_{r=null}),Be())},i(_){o||(L(r),o=!0)},o(_){U(r),o=!1},d(_){_&&C(e),_&&C(l),r&&r.d(_),_&&C(n),_&&C(i)}}}const P0=Nc();function D0(t,e,l){let n;const i=["path","component","meta","primary"];let o=bs(e,i),u,m,r,f,{$$slots:p={},$$scope:_}=e,{path:v=""}=e,{component:h=null}=e,{meta:d={}}=e,{primary:g=!0}=e;Ei(Cs,e);const k=P0(),{registerRoute:P,unregisterRoute:T,activeRoute:E,disableInlineStyles:R}=jl(si);gl(t,E,H=>l(16,u=H));const j=Qc();gl(t,j,H=>l(17,r=H));const O=Kc();gl(t,O,H=>l(3,m=H));const y=pt(null);let A;const ne=pt(),B=pt({});gl(t,B,H=>l(4,f=H)),yi(Dc,ne),yi(I1,B),yi(O1,y);const F=M0();return Hl||T1(()=>T(k)),t.$$set=H=>{l(24,e=fl(fl({},e),vs(H))),l(12,o=bs(e,i)),"path"in H&&l(13,v=H.path),"component"in H&&l(0,h=H.component),"meta"in H&&l(14,d=H.meta),"primary"in H&&l(1,g=H.primary),"$$scope"in H&&l(19,_=H.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const H=v==="",W=Ni(r,v),K={id:k,path:v,meta:d,default:H,fullPath:H?"":W,base:H?r:l0(W,m.pathname),primary:g,focusElement:y};ne.set(K),l(15,A=P(K))}if(t.$$.dirty&98304&&l(2,n=!!(A||u&&u.id===k)),t.$$.dirty&98308&&n){const{params:H}=A||u;B.set(H)}},e=vs(e),[h,g,n,m,f,k,E,R,j,O,B,F,o,v,d,A,u,r,p,_]}class L0 extends je{constructor(e){super(),Ue(this,e,D0,A0,Ie,{path:13,component:0,meta:14,primary:1})}}const vl=L0;function R0(t){let e,l,n,i;const o=t[13].default,u=mo(o,t,t[12],null);let m=[{href:t[0]},t[2],t[1]],r={};for(let f=0;fl(11,_=y));const E=$1(),R=Xc(),{navigate:j}=Yc();function O(y){E("click",y),D1(y)&&(y.preventDefault(),j(n,{state:k,replace:u||g}))}return t.$$set=y=>{l(19,e=fl(fl({},e),vs(y))),l(18,p=bs(e,f)),"to"in y&&l(5,d=y.to),"replace"in y&&l(6,g=y.replace),"state"in y&&l(7,k=y.state),"getProps"in y&&l(8,P=y.getProps),"$$scope"in y&&l(12,h=y.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=R(d,_)),t.$$.dirty&2049&&l(10,i=xs(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(u=wo(n)===e0(_)),t.$$.dirty&512&&l(2,m=o?{"aria-current":"page"}:{}),l(1,r=(()=>{if(Tc(P)){const y=P({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...y}}return p})())},e=vs(e),[n,r,m,T,O,d,g,k,P,o,i,_,h,v]}class O0 extends je{constructor(e){super(),Ue(this,e,I0,R0,Ie,{to:5,replace:6,state:7,getProps:8})}}const el=O0;let Si=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ul(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function F0(t,e){return e?t>218&&t<242?"#32c000":t>212&&t<248?"#b1c000":t>208&&t<252?"#ffa000":"#d90000":t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Zc(t,e){let l;return e?t>90?l="#d90000":t>85?l="#e31000":t>80?l="#ffa900":t>75?l="#dcc300":l="#32c500":t>90?l="#d90000":t>85?l="#e32100":t>80?l="#ffb800":t>75?l="#dcd800":l="#32d900",l}function B0(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function ws(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 Ke(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 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1";case 80:return"Generic ESP32-S3"}}function Lr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Rr(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Ir(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Or(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function li(t){switch(t){case 2:case 4:case 7:return!0}return!1}function at(t,e){return t==1||t==2&&e}function jt(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function Me(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function kl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Fr(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function Br(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function qr(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}async function Al(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let bl={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null,if:{eth:!1}};const Yt=pt(bl);async function yo(){bl=await(await Al("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Yt.set(bl)}let _s=0,Ur=-127,jr=null,q0={};const Jc=Pc(q0,t=>{let e;async function l(){Al("data.json").then(n=>n.json()).then(n=>{t(n),Ur!=n.t&&(Ur=n.t,setTimeout(n1,2e3)),jr==null&&n.pe&&n.p!=null&&(jr=n.p,e1()),bl.upgrading?window.location.reload():(!bl||!bl.chip||bl.booting||_s>1&&!li(bl.board))&&(yo(),an&&clearTimeout(an),an=setTimeout(So,2e3),rn&&clearTimeout(rn),rn=setTimeout(Mo,3e3));let i=5e3;if(li(bl.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),_s=0}).catch(n=>{_s++,_s>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,li(bl.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let eo={},bi;const Co=pt(eo);async function xc(){let t=!1;if(Co.update(e=>{for(var l=0;l<36;l++){if(e[Ke(l)]==null){t=l<12;break}e[Ke(l)]=e[Ke(l+1)]}return e}),t)e1();else{let e=new Date;bi=setTimeout(xc,(60-e.getMinutes())*6e4)}}async function e1(){bi&&(clearTimeout(bi),bi=0),eo=await(await Al("energyprice.json")).json(),Co.set(eo);let e=new Date;bi=setTimeout(xc,(60-e.getMinutes())*6e4)}let to={},an;async function So(){an&&(clearTimeout(an),an=0),to=await(await Al("dayplot.json")).json(),t1.set(to);let e=new Date;an=setTimeout(So,(60-e.getMinutes())*6e4+20)}const t1=pt(to,t=>(So(),function(){}));let lo={},rn;async function Mo(){rn&&(clearTimeout(rn),rn=0),lo=await(await Al("monthplot.json")).json(),l1.set(lo);let e=new Date;rn=setTimeout(Mo,(24-e.getHours())*36e5+40)}const l1=pt(lo,t=>(Mo(),function(){}));let no={};async function n1(){no=await(await Al("temperature.json")).json(),i1.set(no)}const i1=pt(no,t=>(n1(),function(){}));let io={},ps;async function s1(){ps&&(clearTimeout(ps),ps=0),io=await(await Al("tariff.json")).json(),o1.set(io);let e=new Date;ps=setTimeout(s1,(60-e.getMinutes())*6e4+30)}const o1=pt(io,t=>function(){});let so=[];const To=pt(so);async function U0(){so=await(await Al("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),To.set(so)}let oo={};async function j0(){oo=await(await Al("realtime.json")).json(),a1.set(oo)}const a1=pt(oo,t=>(j0(),function(){}));function ys(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function r1(t){await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function u1(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),u=[...e];u.reverse();let m,r,f;for(let p=0;po&&(m=_):g==i+1&&(r=_);else if(d==n+1)if(f){let P=f.tag_name.substring(1).split(".");parseInt(P[0]);let T=parseInt(P[1]);parseInt(P[2]),g==T&&(f=_)}else f=_}return r||f||m||!1}else return e[0]}const Hr="/github.svg";function Wr(t){let e,l;function n(u,m){return u[1]>1?Y0:u[1]>0?K0:u[2]>1?V0:u[2]>0?G0:u[3]>1?z0:u[3]>0?W0:H0}let i=n(t),o=i(t);return{c(){e=N(`Up + `),o.c(),l=nt()},m(u,m){S(u,e,m),o.m(u,m),S(u,l,m)},p(u,m){i===(i=n(u))&&o?o.p(u,m):(o.d(1),o=i(u),o&&(o.c(),o.m(l.parentNode,l)))},d(u){u&&C(e),o.d(u),u&&C(l)}}}function H0(t){let e,l;return{c(){e=N(t[0]),l=N(" seconds")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&1&&Z(e,n[0])},d(n){n&&C(e),n&&C(l)}}}function W0(t){let e,l;return{c(){e=N(t[3]),l=N(" minute")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function z0(t){let e,l;return{c(){e=N(t[3]),l=N(" minutes")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function G0(t){let e,l;return{c(){e=N(t[2]),l=N(" hour")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function V0(t){let e,l;return{c(){e=N(t[2]),l=N(" hours")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function K0(t){let e,l;return{c(){e=N(t[1]),l=N(" day")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function Y0(t){let e,l;return{c(){e=N(t[1]),l=N(" days")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function Q0(t){let e,l=t[0]&&Wr(t);return{c(){l&&l.c(),e=nt()},m(n,i){l&&l.m(n,i),S(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Wr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:he,o:he,d(n){l&&l.d(n),n&&C(e)}}}function X0(t,e,l){let{epoch:n}=e,i=0,o=0,u=0;return t.$$set=m=>{"epoch"in m&&l(0,n=m.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,o,u]}class Z0 extends je{constructor(e){super(),Ue(this,e,X0,Q0,Ie,{epoch:0})}}function J0(t){let e,l,n;return{c(){e=c("span"),l=N(t[2]),a(e,"title",t[1]),a(e,"class",n="bd-"+t[0])},m(i,o){S(i,e,o),s(e,l)},p(i,[o]){o&4&&Z(l,i[2]),o&2&&a(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&a(e,"class",n)},i:he,o:he,d(i){i&&C(e)}}}function x0(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,o=u.text)},[n,i,o]}class un extends je{constructor(e){super(),Ue(this,e,x0,J0,Ie,{color:0,title:1,text:2})}}function em(t){let e,l=`${Ke(t[0].getDate())}.${Ke(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ke(t[0].getHours())}:${Ke(t[0].getMinutes())}`,n;return{c(){e=c("span"),n=N(l),a(e,"class",t[1])},m(i,o){S(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ke(i[0].getDate())}.${Ke(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ke(i[0].getHours())}:${Ke(i[0].getMinutes())}`)&&Z(n,l),o&2&&a(e,"class",i[1])},d(i){i&&C(e)}}}function tm(t){let e=`${Ke(t[0].getDate())}. ${Si[t[0].getMonth()]} ${Ke(t[0].getHours())}:${Ke(t[0].getMinutes())}`,l;return{c(){l=N(e)},m(n,i){S(n,l,i)},p(n,i){i&1&&e!==(e=`${Ke(n[0].getDate())}. ${Si[n[0].getMonth()]} ${Ke(n[0].getHours())}:${Ke(n[0].getMinutes())}`)&&Z(l,e)},d(n){n&&C(l)}}}function lm(t){let e;function l(o,u){return o[2]?tm:em}let n=l(t),i=n(t);return{c(){i.c(),e=nt()},m(o,u){i.m(o,u),S(o,e,u)},p(o,[u]){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:he,o:he,d(o){i.d(o),o&&C(e)}}}function nm(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,u;return t.$$set=m=>{"timestamp"in m&&l(0,n=m.timestamp),"fullTimeColor"in m&&l(1,i=m.fullTimeColor),"offset"in m&&l(3,o=m.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||kl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,o]}class f1 extends je{constructor(e){super(),Ue(this,e,nm,lm,Ie,{timestamp:0,fullTimeColor:1,offset:3})}}function im(t){let e,l,n;return{c(){e=qe("svg"),l=qe("path"),n=qe("path"),a(l,"stroke-linecap","round"),a(l,"stroke-linejoin","round"),a(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"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(i,o){S(i,e,o),s(e,l),s(e,n)},p:he,i:he,o:he,d(i){i&&C(e)}}}class sm extends je{constructor(e){super(),Ue(this,e,null,im,Ie,{})}}function om(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),a(l,"stroke-linecap","round"),a(l,"stroke-linejoin","round"),a(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"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(n,i){S(n,e,i),s(e,l)},p:he,i:he,o:he,d(n){n&&C(e)}}}class am extends je{constructor(e){super(),Ue(this,e,null,om,Ie,{})}}function rm(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),a(l,"stroke-linecap","round"),a(l,"stroke-linejoin","round"),a(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"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(n,i){S(n,e,i),s(e,l)},p:he,i:he,o:he,d(n){n&&C(e)}}}class Ut extends je{constructor(e){super(),Ue(this,e,null,rm,Ie,{})}}function um(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),a(l,"stroke-linecap","round"),a(l,"stroke-linejoin","round"),a(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(n,i){S(n,e,i),s(e,l)},p:he,i:he,o:he,d(n){n&&C(e)}}}class c1 extends je{constructor(e){super(),Ue(this,e,null,um,Ie,{})}}function fm(t){let e,l,n=t[2].version+"",i;return{c(){e=N("AMS reader "),l=c("span"),i=N(n)},m(o,u){S(o,e,u),S(o,l,u),s(l,i)},p(o,u){u&4&&n!==(n=o[2].version+"")&&Z(i,n)},d(o){o&&C(e),o&&C(l)}}}function zr(t){let e,l=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",n,i;return{c(){e=c("div"),n=N(l),i=N("\xB0C"),a(e,"class","flex-none my-auto")},m(o,u){S(o,e,u),s(e,n),s(e,i)},p(o,u){u&2&&l!==(l=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&Z(n,l)},d(o){o&&C(e)}}}function Gr(t){let e,l="HAN: "+Lr(t[1].he),n;return{c(){e=c("div"),n=N(l),a(e,"class","bd-red")},m(i,o){S(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l="HAN: "+Lr(i[1].he))&&Z(n,l)},d(i){i&&C(e)}}}function Vr(t){let e,l="MQTT: "+Rr(t[1].me),n;return{c(){e=c("div"),n=N(l),a(e,"class","bd-red")},m(i,o){S(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l="MQTT: "+Rr(i[1].me))&&Z(n,l)},d(i){i&&C(e)}}}function Kr(t){let e,l="Price service: "+Ir(t[1].ee),n;return{c(){e=c("div"),n=N(l),a(e,"class","bd-red")},m(i,o){S(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l="Price service: "+Ir(i[1].ee))&&Z(n,l)},d(i){i&&C(e)}}}function Yr(t){let e,l,n,i,o,u;return l=new el({props:{to:"/configuration",$$slots:{default:[cm]},$$scope:{ctx:t}}}),o=new el({props:{to:"/status",$$slots:{default:[mm]},$$scope:{ctx:t}}}),{c(){e=c("div"),ae(l.$$.fragment),n=b(),i=c("div"),ae(o.$$.fragment),a(e,"class","flex-none px-1 mt-1"),a(e,"title","Configuration"),a(i,"class","flex-none px-1 mt-1"),a(i,"title","Device information")},m(m,r){S(m,e,r),se(l,e,null),S(m,n,r),S(m,i,r),se(o,i,null),u=!0},i(m){u||(L(l.$$.fragment,m),L(o.$$.fragment,m),u=!0)},o(m){U(l.$$.fragment,m),U(o.$$.fragment,m),u=!1},d(m){m&&C(e),oe(l),m&&C(n),m&&C(i),oe(o)}}}function cm(t){let e,l;return e=new sm({}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function mm(t){let e,l;return e=new am({}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Qr(t){let e,l,n,i,o;const u=[pm,_m],m=[];function r(f,p){return f[2].security==0||f[1].a?0:1}return l=r(t),n=m[l]=u[l](t),{c(){e=c("div"),n.c(),a(e,"class","flex-none mr-3 text-yellow-500"),a(e,"title",i="New version: "+t[3].tag_name)},m(f,p){S(f,e,p),m[l].m(e,null),o=!0},p(f,p){let _=l;l=r(f),l===_?m[l].p(f,p):(Fe(),U(m[_],1,1,()=>{m[_]=null}),Be(),n=m[l],n?n.p(f,p):(n=m[l]=u[l](f),n.c()),L(n,1),n.m(e,null)),(!o||p&8&&i!==(i="New version: "+f[3].tag_name))&&a(e,"title",i)},i(f){o||(L(n),o=!0)},o(f){U(n),o=!1},d(f){f&&C(e),m[l].d()}}}function _m(t){let e,l,n=t[3].tag_name+"",i;return{c(){e=c("span"),l=N("New version: "),i=N(n)},m(o,u){S(o,e,u),s(e,l),s(e,i)},p(o,u){u&8&&n!==(n=o[3].tag_name+"")&&Z(i,n)},i:he,o:he,d(o){o&&C(e)}}}function pm(t){let e,l,n,i=t[3].tag_name+"",o,u,m,r,f,p;return m=new c1({}),{c(){e=c("button"),l=c("span"),n=N("New version: "),o=N(i),u=b(),ae(m.$$.fragment),a(l,"class","mt-1"),a(e,"class","flex")},m(_,v){S(_,e,v),s(e,l),s(l,n),s(l,o),s(e,u),se(m,e,null),r=!0,f||(p=X(e,"click",t[4]),f=!0)},p(_,v){(!r||v&8)&&i!==(i=_[3].tag_name+"")&&Z(o,i)},i(_){r||(L(m.$$.fragment,_),r=!0)},o(_){U(m.$$.fragment,_),r=!1},d(_){_&&C(e),oe(m),f=!1,p()}}}function dm(t){let e,l,n,i,o,u,m,r,f,p,_,v,h=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",d,g,k,P,T,E,R,j,O,y,A,ne,B,F,H,W,K,Y,x,G,z,ee,ce,ie,Q,V,we,Ze,Ne,Ge;i=new el({props:{to:"/",$$slots:{default:[fm]},$$scope:{ctx:t}}}),r=new Z0({props:{epoch:t[1].u}});let Pe=t[1].t>-50&&zr(t);T=new un({props:{title:"ESP",text:t[2].booting?"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":"ESP",color:Ul(t[2].booting?2:t[1].em)}}),R=new un({props:{title:"HAN",text:"HAN",color:Ul(t[2].booting?9:t[1].hm)}}),O=new un({props:{title:"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":"WiFi",color:Ul(t[2].booting?9:t[1].wm)}}),A=new un({props:{title:"MQTT",text:"MQTT",color:Ul(t[2].booting?9:t[1].mm)}});let be=(t[1].he<0||t[1].he>0)&&Gr(t),Le=t[1].me<0&&Vr(t),Ee=(t[1].ee>0||t[1].ee<0)&&Kr(t);ce=new f1({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let $=t[2].vndcfg&&t[2].usrcfg&&Yr(t);Ze=new Ut({});let w=t[2].fwconsent===1&&t[3]&&Qr(t);return{c(){e=c("nav"),l=c("div"),n=c("div"),ae(i.$$.fragment),o=b(),u=c("div"),m=c("div"),ae(r.$$.fragment),f=b(),Pe&&Pe.c(),p=b(),_=c("div"),v=N("Free mem: "),d=N(h),g=N("kb"),k=b(),P=c("div"),ae(T.$$.fragment),E=b(),ae(R.$$.fragment),j=b(),ae(O.$$.fragment),y=b(),ae(A.$$.fragment),ne=b(),be&&be.c(),B=b(),Le&&Le.c(),F=b(),Ee&&Ee.c(),H=b(),W=c("div"),K=c("div"),Y=c("a"),x=c("img"),z=b(),ee=c("div"),ae(ce.$$.fragment),ie=b(),$&&$.c(),Q=b(),V=c("div"),we=c("a"),ae(Ze.$$.fragment),Ne=b(),w&&w.c(),a(n,"class","flex text-lg text-gray-100 p-2"),a(m,"class","flex-none my-auto"),a(_,"class","flex-none my-auto"),a(u,"class","flex-none my-auto p-2 flex space-x-4"),a(P,"class","flex-auto flex-wrap my-auto justify-center p-2"),a(x,"class","gh-logo"),hs(x.src,G=t[0]+Hr)||a(x,"src",G),a(x,"alt","GitHub repo"),a(Y,"class","float-right"),a(Y,"href","https://github.com/UtilitechAS/amsreader-firmware"),a(Y,"target","_blank"),a(Y,"rel","noreferrer"),a(Y,"aria-label","GitHub"),a(K,"class","flex-none"),a(ee,"class","flex-none my-auto px-2"),a(we,"href",jt("")),a(we,"target","_blank"),a(we,"rel","noreferrer"),a(V,"class","flex-none px-1 mt-1"),a(V,"title","Documentation"),a(W,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),a(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),a(e,"class","hdr")},m(M,D){S(M,e,D),s(e,l),s(l,n),se(i,n,null),s(l,o),s(l,u),s(u,m),se(r,m,null),s(u,f),Pe&&Pe.m(u,null),s(u,p),s(u,_),s(_,v),s(_,d),s(_,g),s(l,k),s(l,P),se(T,P,null),s(P,E),se(R,P,null),s(P,j),se(O,P,null),s(P,y),se(A,P,null),s(l,ne),be&&be.m(l,null),s(l,B),Le&&Le.m(l,null),s(l,F),Ee&&Ee.m(l,null),s(l,H),s(l,W),s(W,K),s(K,Y),s(Y,x),s(W,z),s(W,ee),se(ce,ee,null),s(W,ie),$&&$.m(W,null),s(W,Q),s(W,V),s(V,we),se(Ze,we,null),s(W,Ne),w&&w.m(W,null),Ge=!0},p(M,[D]){const I={};D&36&&(I.$$scope={dirty:D,ctx:M}),i.$set(I);const J={};D&2&&(J.epoch=M[1].u),r.$set(J),M[1].t>-50?Pe?Pe.p(M,D):(Pe=zr(M),Pe.c(),Pe.m(u,p)):Pe&&(Pe.d(1),Pe=null),(!Ge||D&2)&&h!==(h=(M[1].m?(M[1].m/1e3).toFixed(1):"-")+"")&&Z(d,h);const le={};D&6&&(le.text=M[2].booting?"Booting":M[1].v>2?M[1].v.toFixed(2)+"V":"ESP"),D&6&&(le.color=Ul(M[2].booting?2:M[1].em)),T.$set(le);const me={};D&6&&(me.color=Ul(M[2].booting?9:M[1].hm)),R.$set(me);const ve={};D&2&&(ve.text=M[1].r?M[1].r.toFixed(0)+"dBm":"WiFi"),D&6&&(ve.color=Ul(M[2].booting?9:M[1].wm)),O.$set(ve);const Te={};D&6&&(Te.color=Ul(M[2].booting?9:M[1].mm)),A.$set(Te),M[1].he<0||M[1].he>0?be?be.p(M,D):(be=Gr(M),be.c(),be.m(l,B)):be&&(be.d(1),be=null),M[1].me<0?Le?Le.p(M,D):(Le=Vr(M),Le.c(),Le.m(l,F)):Le&&(Le.d(1),Le=null),M[1].ee>0||M[1].ee<0?Ee?Ee.p(M,D):(Ee=Kr(M),Ee.c(),Ee.m(l,H)):Ee&&(Ee.d(1),Ee=null),(!Ge||D&1&&!hs(x.src,G=M[0]+Hr))&&a(x,"src",G);const De={};D&2&&(De.timestamp=M[1].c?new Date(M[1].c*1e3):new Date(0)),D&4&&(De.offset=M[2].clock_offset),ce.$set(De),M[2].vndcfg&&M[2].usrcfg?$?D&4&&L($,1):($=Yr(M),$.c(),L($,1),$.m(W,Q)):$&&(Fe(),U($,1,1,()=>{$=null}),Be()),M[2].fwconsent===1&&M[3]?w?(w.p(M,D),D&12&&L(w,1)):(w=Qr(M),w.c(),L(w,1),w.m(W,null)):w&&(Fe(),U(w,1,1,()=>{w=null}),Be())},i(M){Ge||(L(i.$$.fragment,M),L(r.$$.fragment,M),L(T.$$.fragment,M),L(R.$$.fragment,M),L(O.$$.fragment,M),L(A.$$.fragment,M),L(ce.$$.fragment,M),L($),L(Ze.$$.fragment,M),L(w),Ge=!0)},o(M){U(i.$$.fragment,M),U(r.$$.fragment,M),U(T.$$.fragment,M),U(R.$$.fragment,M),U(O.$$.fragment,M),U(A.$$.fragment,M),U(ce.$$.fragment,M),U($),U(Ze.$$.fragment,M),U(w),Ge=!1},d(M){M&&C(e),oe(i),oe(r),Pe&&Pe.d(),oe(T),oe(R),oe(O),oe(A),be&&be.d(),Le&&Le.d(),Ee&&Ee.d(),oe(ce),$&&$.d(),oe(Ze),w&&w.d()}}}function hm(t,e,l){let{basepath:n="/"}=e,{data:i={}}=e,o={},u={};function m(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(!li(o.board)||confirm(ys(ge(o.chip,o.board))))&&(Yt.update(r=>(r.upgrading=!0,r)),r1(u.tag_name))}return Yt.subscribe(r=>{l(2,o=r),r.fwconsent===1&&U0()}),To.subscribe(r=>{l(3,u=u1(o.version,r))}),t.$$set=r=>{"basepath"in r&&l(0,n=r.basepath),"data"in r&&l(1,i=r.data)},[n,i,o,u,m]}class vm extends je{constructor(e){super(),Ue(this,e,hm,dm,Ie,{basepath:0,data:1})}}function bm(t){let e,l,n,i;return{c(){e=qe("svg"),l=qe("path"),n=qe("path"),a(l,"d",Qs(150,150,115,210,510)),a(l,"stroke","rgba(128, 128, 128, 0.15)"),a(l,"fill","none"),a(l,"stroke-width","55"),a(n,"d",i=Qs(150,150,115,210,210+300*t[0]/100)),a(n,"stroke",t[1]),a(n,"fill","none"),a(n,"stroke-width","55"),a(e,"viewBox","0 0 300 300"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"height","100%")},m(o,u){S(o,e,u),s(e,l),s(e,n)},p(o,[u]){u&1&&i!==(i=Qs(150,150,115,210,210+300*o[0]/100))&&a(n,"d",i),u&2&&a(n,"stroke",o[1])},i:he,o:he,d(o){o&&C(e)}}}function Xr(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 Qs(t,e,l,n,i){var o=Xr(t,e,l,i),u=Xr(t,e,l,n),m=i-n<=180?"0":"1",r=["M",o.x,o.y,"A",l,l,0,m,0,u.x,u.y].join(" ");return r}function gm(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class km extends je{constructor(e){super(),Ue(this,e,gm,bm,Ie,{pct:0,color:1})}}function Zr(t){let e,l,n,i,o,u,m,r;return{c(){e=c("br"),l=b(),n=c("span"),i=N(t[3]),o=b(),u=c("span"),m=N(t[4]),r=N("/kWh"),a(n,"class","pl-sub"),a(u,"class","pl-snt")},m(f,p){S(f,e,p),S(f,l,p),S(f,n,p),s(n,i),S(f,o,p),S(f,u,p),s(u,m),s(u,r)},p(f,p){p&8&&Z(i,f[3]),p&16&&Z(m,f[4])},d(f){f&&C(e),f&&C(l),f&&C(n),f&&C(o),f&&C(u)}}}function wm(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k;l=new km({props:{pct:t[6],color:t[5](t[6],document.documentElement.classList.contains("dark"))}});let P=t[3]&&Zr(t);return{c(){e=c("div"),ae(l.$$.fragment),n=b(),i=c("span"),o=c("span"),u=N(t[2]),m=b(),r=c("br"),f=b(),p=c("span"),_=N(t[0]),v=b(),h=c("span"),d=N(t[1]),g=b(),P&&P.c(),a(o,"class","pl-lab"),a(p,"class","pl-val"),a(h,"class","pl-unt"),a(i,"class","pl-ov"),a(e,"class","pl-root")},m(T,E){S(T,e,E),se(l,e,null),s(e,n),s(e,i),s(i,o),s(o,u),s(i,m),s(i,r),s(i,f),s(i,p),s(p,_),s(i,v),s(i,h),s(h,d),s(i,g),P&&P.m(i,null),k=!0},p(T,[E]){const R={};E&64&&(R.pct=T[6]),E&96&&(R.color=T[5](T[6],document.documentElement.classList.contains("dark"))),l.$set(R),(!k||E&4)&&Z(u,T[2]),(!k||E&1)&&Z(_,T[0]),(!k||E&2)&&Z(d,T[1]),T[3]?P?P.p(T,E):(P=Zr(T),P.c(),P.m(i,null)):P&&(P.d(1),P=null)},i(T){k||(L(l.$$.fragment,T),k=!0)},o(T){U(l.$$.fragment,T),k=!1},d(T){T&&C(e),oe(l),P&&P.d()}}}function ym(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:m=""}=e,{subunit:r=""}=e,{colorFn:f}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,u=_.label),"sub"in _&&l(3,m=_.sub),"subunit"in _&&l(4,r=_.subunit),"colorFn"in _&&l(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,u,m,r,f,p,i]}class m1 extends je{constructor(e){super(),Ue(this,e,ym,wm,Ie,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Jr(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function xr(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function eu(t,e,l){const n=t.slice();return n[15]=e[l],n}function tu(t){let e,l,n,i,o,u,m=t[0].title&&lu(t),r=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(o,u){S(o,e,u),s(e,n),i=vo(e,t[9].bind(e))},p(o,u){u&1&&l!==(l=o[0].title+"")&&Z(n,l)},d(o){o&&C(e),i()}}}function nu(t){let e,l,n,i=t[15].label+"",o,u,m,r;return{c(){e=qe("g"),l=qe("line"),n=qe("text"),o=N(i),a(l,"x2","100%"),a(n,"y","-4"),a(n,"x",u=t[15].align=="right"?"85%":""),a(e,"class",m="tick tick-"+t[15].value+" tick-"+t[15].color),a(e,"transform",r="translate(0, "+t[7](t[15].value)+")")},m(f,p){S(f,e,p),s(e,l),s(e,n),s(n,o)},p(f,p){p&1&&i!==(i=f[15].label+"")&&Z(o,i),p&1&&u!==(u=f[15].align=="right"?"85%":"")&&a(n,"x",u),p&1&&m!==(m="tick tick-"+f[15].value+" tick-"+f[15].color)&&a(e,"class",m),p&129&&r!==(r="translate(0, "+f[7](f[15].value)+")")&&a(e,"transform",r)},d(f){f&&C(e)}}}function iu(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&nu(t);return{c(){n&&n.c(),l=nt()},m(i,o){n&&n.m(i,o),S(i,l,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,o):(n=nu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function su(t){let e,l,n=(t[3]>20||t[13]%2==0)&&ou(t);return{c(){e=qe("g"),n&&n.c(),a(e,"class","tick"),a(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){S(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=ou(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&a(e,"transform",l)},d(i){i&&C(e),n&&n.d()}}}function ou(t){let e,l=t[11].label+"",n,i;return{c(){e=qe("text"),n=N(l),a(e,"x",i=t[3]/2),a(e,"y","-4")},m(o,u){S(o,e,u),s(e,n)},p(o,u){u&1&&l!==(l=o[11].label+"")&&Z(n,l),u&8&&i!==(i=o[3]/2)&&a(e,"x",i)},d(o){o&&C(e)}}}function au(t){let e=!isNaN(t[6](t[13])),l,n=e&&su(t);return{c(){n&&n.c(),l=nt()},m(i,o){n&&n.m(i,o),S(i,l,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,o):(n=su(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function ru(t){let e,l,n=t[11].value!==void 0&&uu(t),i=t[11].value2>1e-4&&mu(t);return{c(){e=qe("g"),n&&n.c(),l=qe("g"),i&&i.c()},m(o,u){S(o,e,u),n&&n.m(e,null),S(o,l,u),i&&i.m(l,null)},p(o,u){o[11].value!==void 0?n?n.p(o,u):(n=uu(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[11].value2>1e-4?i?i.p(o,u):(i=mu(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&C(e),n&&n.d(),o&&C(l),i&&i.d()}}}function uu(t){let e,l,n,i,o,u,m,r=t[3]>15&&fu(t);return{c(){e=qe("rect"),r&&r.c(),m=nt(),a(e,"x",l=t[6](t[13])+2),a(e,"y",n=t[7](t[11].value)),a(e,"width",i=t[3]-4),a(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),a(e,"fill",u=t[11].color)},m(f,p){S(f,e,p),r&&r.m(f,p),S(f,m,p)},p(f,p){p&64&&l!==(l=f[6](f[13])+2)&&a(e,"x",l),p&129&&n!==(n=f[7](f[11].value))&&a(e,"y",n),p&8&&i!==(i=f[3]-4)&&a(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&a(e,"height",o),p&1&&u!==(u=f[11].color)&&a(e,"fill",u),f[3]>15?r?r.p(f,p):(r=fu(f),r.c(),r.m(m.parentNode,m)):r&&(r.d(1),r=null)},d(f){f&&C(e),r&&r.d(f),f&&C(m)}}}function fu(t){let e,l=t[11].label+"",n,i,o,u,m,r,f=t[11].title&&cu(t);return{c(){e=qe("text"),n=N(l),f&&f.c(),r=nt(),a(e,"width",i=t[3]-4),a(e,"dominant-baseline","middle"),a(e,"text-anchor",o=t[3]t[7](0)-t[8]?t[11].color:"white"),a(e,"transform",m="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[11].labelAngle?t[11].labelAngle:t[3]p[7](0)-p[8]?p[11].color:"white")&&a(e,"fill",u),_&457&&m!==(m="translate("+(p[6](p[13])+p[3]/2)+" "+(p[7](p[11].value)>p[7](0)-p[8]?p[7](p[11].value)-p[8]:p[7](p[11].value)+10)+") rotate("+(p[11].labelAngle?p[11].labelAngle:p[3]15&&_u(t);return{c(){e=qe("rect"),r&&r.c(),m=nt(),a(e,"x",l=t[6](t[13])+2),a(e,"y",n=t[7](0)),a(e,"width",i=t[3]-4),a(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),a(e,"fill",u=t[11].color2?t[11].color2:t[11].color)},m(f,p){S(f,e,p),r&&r.m(f,p),S(f,m,p)},p(f,p){p&64&&l!==(l=f[6](f[13])+2)&&a(e,"x",l),p&128&&n!==(n=f[7](0))&&a(e,"y",n),p&8&&i!==(i=f[3]-4)&&a(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&a(e,"height",o),p&1&&u!==(u=f[11].color2?f[11].color2:f[11].color)&&a(e,"fill",u),f[3]>15?r?r.p(f,p):(r=_u(f),r.c(),r.m(m.parentNode,m)):r&&(r.d(1),r=null)},d(f){f&&C(e),r&&r.d(f),f&&C(m)}}}function _u(t){let e,l=t[11].label2+"",n,i,o,u,m,r=t[11].title2&&pu(t);return{c(){e=qe("text"),n=N(l),r&&r.c(),m=nt(),a(e,"width",i=t[3]-4),a(e,"dominant-baseline","middle"),a(e,"text-anchor","middle"),a(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(i,o){S(i,e,o),n&&n.m(e,null),l=vo(e,t[10].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=tu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:he,o:he,d(i){i&&C(e),n&&n.d(),l()}}}let fn=30;function Sm(t,e,l){let{config:n}=e,i,o,u,m,r,f,p,_=0;function v(){_=this.clientHeight,l(5,_)}function h(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,f=o-_);let d=i-(n.padding.left+n.padding.right);l(3,u=d/n.points.length),l(8,p=un.y.max?P=n.padding.bottom:kf||P<0?0:P})}},[n,i,o,u,f,_,m,r,p,v,h]}class _n extends je{constructor(e){super(),Ue(this,e,Sm,Cm,Ie,{config:0})}}function Mm(t){let e,l;return e=new _n({props:{config:t[0]}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Tm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,m={};function r(f){return{label:Me(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:F0(f||0,document.documentElement.classList.contains("dark"))}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],p=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),p.push(r(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),p.push(r(i))),o>0&&(f.push({label:u===1?"L2-L3":"L3"}),p.push(r(o))),l(0,m={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:p})}},[m,n,i,o,u]}class $m extends je{constructor(e){super(),Ue(this,e,Tm,Mm,Ie,{u1:1,u2:2,u3:3,ds:4})}}function Nm(t){let e,l;return e=new _n({props:{config:t[0]}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Em(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:u}=e,{i2:m}=e,{i2e:r}=e,{i3:f}=e,{max:p}=e,_={};function v(h){return{label:Me(h)+"A",title:h.toFixed(1)+" A",value:isNaN(h)?0:h,color:Zc(h?h/p*100:0,document.documentElement.classList.contains("dark"))}}return t.$$set=h=>{"u1"in h&&l(1,n=h.u1),"u2"in h&&l(2,i=h.u2),"u3"in h&&l(3,o=h.u3),"i1"in h&&l(4,u=h.i1),"i2"in h&&l(5,m=h.i2),"i2e"in h&&l(6,r=h.i2e),"i3"in h&&l(7,f=h.i3),"max"in h&&l(8,p=h.max)},t.$$.update=()=>{if(t.$$.dirty&510){let h=[],d=[];n>0&&(h.push({label:"L1"}),d.push(v(u))),i>0&&(r?(h.push({label:"L2"}),d.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(h.push({label:"L2"}),d.push(v(m)))),o>0&&(h.push({label:"L3"}),d.push(v(f))),l(0,_={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:p,ticks:[{value:0,label:"0%"},{value:p/4,label:"25%"},{value:p/2,label:"50%"},{value:p/4*3,label:"75%"},{value:p,label:"100%"}]},x:{ticks:h},points:d})}},[_,n,i,o,u,m,r,f,p]}class Am extends je{constructor(e){super(),Ue(this,e,Em,Nm,Ie,{u1:1,u2:2,u3:3,i1:4,i2:5,i2e:6,i3:7,max:8})}}function Pm(t){let e,l,n,i,o,u,m,r=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,p,_,v,h,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",k,P,T,E,R,j,O,y=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",A,ne,B,F,H,W,K=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",Y,x;return{c(){e=c("div"),l=c("strong"),l.textContent="Reactive",n=b(),i=c("div"),o=c("div"),o.textContent="Instant in",u=b(),m=c("div"),f=N(r),p=N(" VAr"),_=b(),v=c("div"),v.textContent="Instant out",h=b(),d=c("div"),k=N(g),P=N(" VAr"),T=b(),E=c("div"),R=c("div"),R.textContent="Total in",j=b(),O=c("div"),A=N(y),ne=N(" kVArh"),B=b(),F=c("div"),F.textContent="Total out",H=b(),W=c("div"),Y=N(K),x=N(" kVArh"),a(m,"class","text-right"),a(d,"class","text-right"),a(i,"class","grid grid-cols-2 mt-4"),a(O,"class","text-right"),a(W,"class","text-right"),a(E,"class","grid grid-cols-2 mt-4"),a(e,"class","mx-2 text-sm")},m(G,z){S(G,e,z),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(i,m),s(m,f),s(m,p),s(i,_),s(i,v),s(i,h),s(i,d),s(d,k),s(d,P),s(e,T),s(e,E),s(E,R),s(E,j),s(E,O),s(O,A),s(O,ne),s(E,B),s(E,F),s(E,H),s(E,W),s(W,Y),s(W,x)},p(G,[z]){z&1&&r!==(r=(typeof G[0]<"u"?G[0].toFixed(0):"-")+"")&&Z(f,r),z&2&&g!==(g=(typeof G[1]<"u"?G[1].toFixed(0):"-")+"")&&Z(k,g),z&4&&y!==(y=(typeof G[2]<"u"?G[2].toFixed(1):"-")+"")&&Z(A,y),z&8&&K!==(K=(typeof G[3]<"u"?G[3].toFixed(1):"-")+"")&&Z(Y,K)},i:he,o:he,d(G){G&&C(e)}}}function Dm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=e;return t.$$set=m=>{"importInstant"in m&&l(0,n=m.importInstant),"exportInstant"in m&&l(1,i=m.exportInstant),"importTotal"in m&&l(2,o=m.importTotal),"exportTotal"in m&&l(3,u=m.exportTotal)},[n,i,o,u]}class Lm extends je{constructor(e){super(),Ue(this,e,Dm,Pm,Ie,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function hu(t){let e;function l(o,u){return o[3]?Im:Rm}let n=l(t),i=n(t);return{c(){i.c(),e=nt()},m(o,u){i.m(o,u),S(o,e,u)},p(o,u){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&C(e)}}}function Rm(t){let e,l,n,i,o,u,m=Me(t[1].h.u,2)+"",r,f,p,_,v,h,d=Me(t[1].d.u,1)+"",g,k,P,T,E,R,j=Me(t[1].m.u)+"",O,y,A,ne,B,F,H=Me(t[0].last_month.u)+"",W,K,Y,x,G=t[4]&&vu(t);return{c(){e=c("strong"),e.textContent="Consumption",l=b(),n=c("div"),i=c("div"),i.textContent="Hour",o=b(),u=c("div"),r=N(m),f=N(" kWh"),p=b(),_=c("div"),_.textContent="Day",v=b(),h=c("div"),g=N(d),k=N(" kWh"),P=b(),T=c("div"),T.textContent="Month",E=b(),R=c("div"),O=N(j),y=N(" kWh"),A=b(),ne=c("div"),ne.textContent="Last month",B=b(),F=c("div"),W=N(H),K=N(" kWh"),Y=b(),G&&G.c(),x=nt(),a(u,"class","text-right"),a(h,"class","text-right"),a(R,"class","text-right"),a(F,"class","text-right"),a(n,"class","grid grid-cols-2 mb-3")},m(z,ee){S(z,e,ee),S(z,l,ee),S(z,n,ee),s(n,i),s(n,o),s(n,u),s(u,r),s(u,f),s(n,p),s(n,_),s(n,v),s(n,h),s(h,g),s(h,k),s(n,P),s(n,T),s(n,E),s(n,R),s(R,O),s(R,y),s(n,A),s(n,ne),s(n,B),s(n,F),s(F,W),s(F,K),S(z,Y,ee),G&&G.m(z,ee),S(z,x,ee)},p(z,ee){ee&2&&m!==(m=Me(z[1].h.u,2)+"")&&Z(r,m),ee&2&&d!==(d=Me(z[1].d.u,1)+"")&&Z(g,d),ee&2&&j!==(j=Me(z[1].m.u)+"")&&Z(O,j),ee&1&&H!==(H=Me(z[0].last_month.u)+"")&&Z(W,H),z[4]?G?G.p(z,ee):(G=vu(z),G.c(),G.m(x.parentNode,x)):G&&(G.d(1),G=null)},d(z){z&&C(e),z&&C(l),z&&C(n),z&&C(Y),G&&G.d(z),z&&C(x)}}}function Im(t){let e,l,n,i,o,u,m=Me(t[1].h.u,2)+"",r,f,p,_,v,h,d,g=Me(t[1].d.u,1)+"",k,P,T,E,R,j,O,y=Me(t[1].m.u)+"",A,ne,B,F,H,W,K,Y=Me(t[0].last_month.u)+"",x,G,z,ee,ce,ie,Q,V,we,Ze,Ne,Ge=Me(t[1].h.p,2)+"",Pe,be,Le,Ee,$,w,M,D=Me(t[1].d.p,1)+"",I,J,le,me,ve,Te,De,fe=Me(t[1].m.p)+"",Se,He,ct,Ve,rt,We,mt,Oe=Me(t[0].last_month.p)+"",$t,_t,dt,et,Ae=t[4]&&bu(t),tt=t[4]&&gu(t),$e=t[4]&&ku(t),Je=t[4]&&wu(t),ot=t[4]&&yu(t),Re=t[4]&&Cu(t),ke=t[4]&&Su(t),de=t[4]&&Mu(t);return{c(){e=c("strong"),e.textContent="Import",l=b(),n=c("div"),i=c("div"),i.textContent="Hour",o=b(),u=c("div"),r=N(m),f=N(" kWh"),p=b(),Ae&&Ae.c(),_=b(),v=c("div"),v.textContent="Day",h=b(),d=c("div"),k=N(g),P=N(" kWh"),T=b(),tt&&tt.c(),E=b(),R=c("div"),R.textContent="Month",j=b(),O=c("div"),A=N(y),ne=N(" kWh"),B=b(),$e&&$e.c(),F=b(),H=c("div"),H.textContent="Last mo.",W=b(),K=c("div"),x=N(Y),G=N(" kWh"),z=b(),Je&&Je.c(),ce=b(),ie=c("strong"),ie.textContent="Export",Q=b(),V=c("div"),we=c("div"),we.textContent="Hour",Ze=b(),Ne=c("div"),Pe=N(Ge),be=N(" kWh"),Le=b(),ot&&ot.c(),Ee=b(),$=c("div"),$.textContent="Day",w=b(),M=c("div"),I=N(D),J=N(" kWh"),le=b(),Re&&Re.c(),me=b(),ve=c("div"),ve.textContent="Month",Te=b(),De=c("div"),Se=N(fe),He=N(" kWh"),ct=b(),ke&&ke.c(),Ve=b(),rt=c("div"),rt.textContent="Last mo.",We=b(),mt=c("div"),$t=N(Oe),_t=N(" kWh"),dt=b(),de&&de.c(),a(u,"class","text-right"),a(d,"class","text-right"),a(O,"class","text-right"),a(K,"class","text-right"),a(n,"class",ee="grid grid-cols-"+t[5]+" mb-3"),a(Ne,"class","text-right"),a(M,"class","text-right"),a(De,"class","text-right"),a(mt,"class","text-right"),a(V,"class",et="grid grid-cols-"+t[5])},m(_e,ze){S(_e,e,ze),S(_e,l,ze),S(_e,n,ze),s(n,i),s(n,o),s(n,u),s(u,r),s(u,f),s(n,p),Ae&&Ae.m(n,null),s(n,_),s(n,v),s(n,h),s(n,d),s(d,k),s(d,P),s(n,T),tt&&tt.m(n,null),s(n,E),s(n,R),s(n,j),s(n,O),s(O,A),s(O,ne),s(n,B),$e&&$e.m(n,null),s(n,F),s(n,H),s(n,W),s(n,K),s(K,x),s(K,G),s(n,z),Je&&Je.m(n,null),S(_e,ce,ze),S(_e,ie,ze),S(_e,Q,ze),S(_e,V,ze),s(V,we),s(V,Ze),s(V,Ne),s(Ne,Pe),s(Ne,be),s(V,Le),ot&&ot.m(V,null),s(V,Ee),s(V,$),s(V,w),s(V,M),s(M,I),s(M,J),s(V,le),Re&&Re.m(V,null),s(V,me),s(V,ve),s(V,Te),s(V,De),s(De,Se),s(De,He),s(V,ct),ke&&ke.m(V,null),s(V,Ve),s(V,rt),s(V,We),s(V,mt),s(mt,$t),s(mt,_t),s(V,dt),de&&de.m(V,null)},p(_e,ze){ze&2&&m!==(m=Me(_e[1].h.u,2)+"")&&Z(r,m),_e[4]?Ae?Ae.p(_e,ze):(Ae=bu(_e),Ae.c(),Ae.m(n,_)):Ae&&(Ae.d(1),Ae=null),ze&2&&g!==(g=Me(_e[1].d.u,1)+"")&&Z(k,g),_e[4]?tt?tt.p(_e,ze):(tt=gu(_e),tt.c(),tt.m(n,E)):tt&&(tt.d(1),tt=null),ze&2&&y!==(y=Me(_e[1].m.u)+"")&&Z(A,y),_e[4]?$e?$e.p(_e,ze):($e=ku(_e),$e.c(),$e.m(n,F)):$e&&($e.d(1),$e=null),ze&1&&Y!==(Y=Me(_e[0].last_month.u)+"")&&Z(x,Y),_e[4]?Je?Je.p(_e,ze):(Je=wu(_e),Je.c(),Je.m(n,null)):Je&&(Je.d(1),Je=null),ze&32&&ee!==(ee="grid grid-cols-"+_e[5]+" mb-3")&&a(n,"class",ee),ze&2&&Ge!==(Ge=Me(_e[1].h.p,2)+"")&&Z(Pe,Ge),_e[4]?ot?ot.p(_e,ze):(ot=yu(_e),ot.c(),ot.m(V,Ee)):ot&&(ot.d(1),ot=null),ze&2&&D!==(D=Me(_e[1].d.p,1)+"")&&Z(I,D),_e[4]?Re?Re.p(_e,ze):(Re=Cu(_e),Re.c(),Re.m(V,me)):Re&&(Re.d(1),Re=null),ze&2&&fe!==(fe=Me(_e[1].m.p)+"")&&Z(Se,fe),_e[4]?ke?ke.p(_e,ze):(ke=Su(_e),ke.c(),ke.m(V,Ve)):ke&&(ke.d(1),ke=null),ze&1&&Oe!==(Oe=Me(_e[0].last_month.p)+"")&&Z($t,Oe),_e[4]?de?de.p(_e,ze):(de=Mu(_e),de.c(),de.m(V,null)):de&&(de.d(1),de=null),ze&32&&et!==(et="grid grid-cols-"+_e[5])&&a(V,"class",et)},d(_e){_e&&C(e),_e&&C(l),_e&&C(n),Ae&&Ae.d(),tt&&tt.d(),$e&&$e.d(),Je&&Je.d(),_e&&C(ce),_e&&C(ie),_e&&C(Q),_e&&C(V),ot&&ot.d(),Re&&Re.d(),ke&&ke.d(),de&&de.d()}}}function vu(t){let e,l,n,i,o,u,m=Me(t[1].h.c,2)+"",r,f,p,_,v,h,d,g=Me(t[1].d.c,1)+"",k,P,T,E,R,j,O,y=Me(t[1].m.c)+"",A,ne,B,F,H,W,K,Y=Me(t[0].last_month.c)+"",x,G,z;return{c(){e=c("strong"),e.textContent="Cost",l=b(),n=c("div"),i=c("div"),i.textContent="Hour",o=b(),u=c("div"),r=N(m),f=b(),p=N(t[2]),_=b(),v=c("div"),v.textContent="Day",h=b(),d=c("div"),k=N(g),P=b(),T=N(t[2]),E=b(),R=c("div"),R.textContent="Month",j=b(),O=c("div"),A=N(y),ne=b(),B=N(t[2]),F=b(),H=c("div"),H.textContent="Last month",W=b(),K=c("div"),x=N(Y),G=b(),z=N(t[2]),a(u,"class","text-right"),a(d,"class","text-right"),a(O,"class","text-right"),a(K,"class","text-right"),a(n,"class","grid grid-cols-2")},m(ee,ce){S(ee,e,ce),S(ee,l,ce),S(ee,n,ce),s(n,i),s(n,o),s(n,u),s(u,r),s(u,f),s(u,p),s(n,_),s(n,v),s(n,h),s(n,d),s(d,k),s(d,P),s(d,T),s(n,E),s(n,R),s(n,j),s(n,O),s(O,A),s(O,ne),s(O,B),s(n,F),s(n,H),s(n,W),s(n,K),s(K,x),s(K,G),s(K,z)},p(ee,ce){ce&2&&m!==(m=Me(ee[1].h.c,2)+"")&&Z(r,m),ce&4&&Z(p,ee[2]),ce&2&&g!==(g=Me(ee[1].d.c,1)+"")&&Z(k,g),ce&4&&Z(T,ee[2]),ce&2&&y!==(y=Me(ee[1].m.c)+"")&&Z(A,y),ce&4&&Z(B,ee[2]),ce&1&&Y!==(Y=Me(ee[0].last_month.c)+"")&&Z(x,Y),ce&4&&Z(z,ee[2])},d(ee){ee&&C(e),ee&&C(l),ee&&C(n)}}}function bu(t){let e,l=Me(t[1].h.c,2)+"",n,i,o;return{c(){e=c("div"),n=N(l),i=b(),o=N(t[2]),a(e,"class","text-right")},m(u,m){S(u,e,m),s(e,n),s(e,i),s(e,o)},p(u,m){m&2&&l!==(l=Me(u[1].h.c,2)+"")&&Z(n,l),m&4&&Z(o,u[2])},d(u){u&&C(e)}}}function gu(t){let e,l=Me(t[1].d.c,1)+"",n,i,o;return{c(){e=c("div"),n=N(l),i=b(),o=N(t[2]),a(e,"class","text-right")},m(u,m){S(u,e,m),s(e,n),s(e,i),s(e,o)},p(u,m){m&2&&l!==(l=Me(u[1].d.c,1)+"")&&Z(n,l),m&4&&Z(o,u[2])},d(u){u&&C(e)}}}function ku(t){let e,l=Me(t[1].m.c)+"",n,i,o;return{c(){e=c("div"),n=N(l),i=b(),o=N(t[2]),a(e,"class","text-right")},m(u,m){S(u,e,m),s(e,n),s(e,i),s(e,o)},p(u,m){m&2&&l!==(l=Me(u[1].m.c)+"")&&Z(n,l),m&4&&Z(o,u[2])},d(u){u&&C(e)}}}function wu(t){let e,l=Me(t[0].last_month.c)+"",n,i,o;return{c(){e=c("div"),n=N(l),i=b(),o=N(t[2]),a(e,"class","text-right")},m(u,m){S(u,e,m),s(e,n),s(e,i),s(e,o)},p(u,m){m&1&&l!==(l=Me(u[0].last_month.c)+"")&&Z(n,l),m&4&&Z(o,u[2])},d(u){u&&C(e)}}}function yu(t){let e,l=Me(t[1].h.i,2)+"",n,i,o;return{c(){e=c("div"),n=N(l),i=b(),o=N(t[2]),a(e,"class","text-right")},m(u,m){S(u,e,m),s(e,n),s(e,i),s(e,o)},p(u,m){m&2&&l!==(l=Me(u[1].h.i,2)+"")&&Z(n,l),m&4&&Z(o,u[2])},d(u){u&&C(e)}}}function Cu(t){let e,l=Me(t[1].d.i,1)+"",n,i,o;return{c(){e=c("div"),n=N(l),i=b(),o=N(t[2]),a(e,"class","text-right")},m(u,m){S(u,e,m),s(e,n),s(e,i),s(e,o)},p(u,m){m&2&&l!==(l=Me(u[1].d.i,1)+"")&&Z(n,l),m&4&&Z(o,u[2])},d(u){u&&C(e)}}}function Su(t){let e,l=Me(t[1].m.i)+"",n,i,o;return{c(){e=c("div"),n=N(l),i=b(),o=N(t[2]),a(e,"class","text-right")},m(u,m){S(u,e,m),s(e,n),s(e,i),s(e,o)},p(u,m){m&2&&l!==(l=Me(u[1].m.i)+"")&&Z(n,l),m&4&&Z(o,u[2])},d(u){u&&C(e)}}}function Mu(t){let e,l=Me(t[0].last_month.i)+"",n,i,o;return{c(){e=c("div"),n=N(l),i=b(),o=N(t[2]),a(e,"class","text-right")},m(u,m){S(u,e,m),s(e,n),s(e,i),s(e,o)},p(u,m){m&1&&l!==(l=Me(u[0].last_month.i)+"")&&Z(n,l),m&4&&Z(o,u[2])},d(u){u&&C(e)}}}function Om(t){let e,l,n,i,o,u,m=t[1]&&hu(t);return{c(){e=c("div"),l=c("strong"),l.textContent="Real time calculation",n=b(),i=c("br"),o=c("br"),u=b(),m&&m.c(),a(e,"class","mx-2 text-sm")},m(r,f){S(r,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,u),m&&m.m(e,null)},p(r,[f]){r[1]?m?m.p(r,f):(m=hu(r),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},i:he,o:he,d(r){r&&C(e),m&&m.d()}}}function Fm(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,m=!1,r=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,m=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,r=m?3:2))},[n,i,o,u,m,r]}class Bm extends je{constructor(e){super(),Ue(this,e,Fm,Om,Ie,{sysinfo:0,data:1,currency:2,hasExport:3})}}function qm(t){let e,l,n=Br(t[0].source)+"",i,o,u,m,r;return m=new _n({props:{config:t[1]}}),{c(){e=c("a"),l=N("Provided by: "),i=N(n),u=b(),ae(m.$$.fragment),a(e,"href",o=qr(t[0].source)),a(e,"target","_blank"),a(e,"class","text-xs float-right z-40")},m(f,p){S(f,e,p),s(e,l),s(e,i),S(f,u,p),se(m,f,p),r=!0},p(f,[p]){(!r||p&1)&&n!==(n=Br(f[0].source)+"")&&Z(i,n),(!r||p&1&&o!==(o=qr(f[0].source)))&&a(e,"href",o);const _={};p&2&&(_.config=f[1]),m.$set(_)},i(f){r||(L(m.$$.fragment,f),r=!0)},o(f){U(m.$$.fragment,f),r=!1},d(f){f&&C(e),f&&C(u),oe(m,f)}}}function Um(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},u,m,r=document.documentElement.classList.contains("dark");return t.$$set=f=>{"json"in f&&l(0,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let f=n.currency,p=new Date().getUTCHours(),_=0,v=0,h=0,d=[],g=[],k=[];l(4,m=l(3,u=0));let P=new Date;for(kl(P,i.clock_offset-(24+P.getHours()-P.getUTCHours())%24),_=p;_<24&&(v=n[Ke(h++)],v!=null);_++)g.push({label:Ke(P.getHours())}),k.push(v*100),l(4,m=Math.min(m,v*100)),l(3,u=Math.max(u,v*100)),kl(P,1);for(_=0;_<24&&(v=n[Ke(h++)],v!=null);_++)g.push({label:Ke(P.getHours())}),k.push(v*100),l(4,m=Math.min(m,v*100)),l(3,u=Math.max(u,v*100)),kl(P,1);if(m>-100&&u<100){switch(f){case"NOK":case"DKK":f="\xF8re";break;case"SEK":f="\xF6re";break;case"EUR":f="cent";break;case"CHF":f="rp.";break;default:f=f+"/100"}for(l(4,m*=100),l(3,u*=100),_=0;_=0?O.toFixed(y):"",title:O>=0?O.toFixed(2)+" "+f:"",value:v>=0?Math.abs(v):0,label2:O<0?O.toFixed(y):"",title2:O<0?O.toFixed(2)+" "+f:"",value2:v<0?Math.abs(v):0,color:r?"#5c2da5":"#7c3aed"})}let E=Math.max(u,Math.abs(m));if(m<0){l(4,m=Math.min(E/4*-1,m));let O=Math.ceil(Math.abs(m)/E*4),y=m/O;for(_=1;_{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],v=[];l(4,m=l(3,u=0));let h=kl(new Date,-24),d=new Date().getUTCHours();for(kl(h,i.clock_offset-(24+h.getHours()-h.getUTCHours())%24),f=d;f<24;f++){let T=n["i"+Ke(f)],E=n["e"+Ke(f)];T===void 0&&(T=0),E===void 0&&(E=0),_.push({label:Ke(h.getHours())}),v.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:E.toFixed(1),title2:E.toFixed(2)+" kWh",value2:E*10,color:r?"#5c2da5":"#7c3aed",color2:r?"#27728e":"#37829e"}),l(4,m=Math.max(m,E*10)),l(3,u=Math.max(u,T*10)),kl(h,1)}for(f=0;f{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],v=[];l(4,m=l(3,u=0));let h=new Date,d=new Date;for(kl(h,i.clock_offset-(24+h.getHours()-h.getUTCHours())%24),kl(d,i.clock_offset-(24+d.getHours()-d.getUTCHours())%24),d.setDate(0),f=h.getDate();f<=d.getDate();f++){let T=n["i"+Ke(f)],E=n["e"+Ke(f)];T===void 0&&(T=0),E===void 0&&(E=0),_.push({label:Ke(f)}),v.push({label:T.toFixed(T<10?1:0),title:T.toFixed(2)+" kWh",value:T,label2:E.toFixed(E<10?1:0),title2:E.toFixed(2)+" kWh",value2:E,color:r?"#5c2da5":"#7c3aed",color2:r?"#27728e":"#37829e"}),l(4,m=Math.max(m,E)),l(3,u=Math.max(u,T))}for(f=1;f{"json"in r&&l(1,n=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,f=0,p=[],_=[],v=[];n.s&&n.s.forEach((g,k)=>{var P=g.n?g.n:g.a;f=g.v,f==-127&&(f=0),_.push({label:P.slice(-4)}),v.push({label:f.toFixed(1),value:f,color:i?"#5c2da5":"#7c3aed"}),l(3,m=Math.min(m,f)),l(2,u=Math.max(u,f))}),l(2,u=Math.ceil(u)),l(3,m=Math.floor(m));let h=u;m<0&&(h+=Math.abs(m));let d=h/4;for(r=0;r<5;r++)f=m+d*r,p.push({value:f,label:f.toFixed(1)});l(0,o={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:m,max:u,ticks:p},x:{ticks:_},points:v})}},[o,n,u,m]}class Xm extends je{constructor(e){super(),Ue(this,e,Qm,Ym,Ie,{json:1})}}function Zm(t){let e,l;return e=new _n({props:{config:t[0]}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}let Jm=0;function xm(t,e,l){let n=document.documentElement.classList.contains("dark"),i={},o=0,u;return o1.subscribe(m=>{l(2,u=m)}),s1(),t.$$.update=()=>{if(t.$$.dirty&6){let m=0,r=[],f=[],p=[];if(r.push({value:0,label:0}),u&&u.p)for(m=0;m0?Ke(_.d)+"."+Si[new Date().getMonth()]:"-"}),l(1,o=Math.max(o,_.v))}if(u&&u.t){for(m=0;m=o)break;r.push({value:_,label:_})}r.push({label:u.m.toFixed(1),align:"right",color:"green",value:u.m})}u&&u.c&&(r.push({label:u.c.toFixed(0),color:"orange",value:u.c}),l(1,o=Math.max(o,u.c))),l(1,o=Math.ceil(o)),l(0,i={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Jm,max:o,ticks:r},x:{ticks:f},points:p})}},[i,o,u]}class e_ extends je{constructor(e){super(),Ue(this,e,xm,Zm,Ie,{})}}function Tu(t,e,l){const n=t.slice();return n[20]=e[l],n[22]=l,n}function $u(t,e,l){const n=t.slice();return n[23]=e[l],n}function Nu(t){let e,l,n,i,o,u=t[7],m=[];for(let p=0;pt[15].call(e))},m(f,p){S(f,e,p),s(e,l),s(l,n),s(l,i),s(l,o),s(e,u),r&&r.m(e,null),m=vo(e,t[15].bind(e))},p(f,[p]){p&1024&&Z(i,f[10]),f[7]?r?r.p(f,p):(r=Nu(f),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},i:he,o:he,d(f){f&&C(e),r&&r.d(),m()}}}let l_=12;function n_(t,e,l){let n=document.documentElement.classList.contains("dark"),i;a1.subscribe(y=>{l(12,i=y)});let o,u=0,m=0;function r(){o&&clearTimeout(o),o=setTimeout(r,1e4),i.data.unshift(m),l(12,i.data=i.data.slice(0,i.size),i),u+=10}Jc.subscribe(y=>{u==0&&(o&&clearTimeout(o),o=setTimeout(r,1e4)),m=y.i-y.e,u=y.u});let f,p,_,v,h,d,g,k,P,T,E,R,j;function O(){_=this.clientWidth,v=this.clientHeight,l(0,_),l(1,v)}return t.$$.update=()=>{if(t.$$.dirty&29183&&(l(2,h=parseInt(v)-50),l(3,d=_-35),l(9,R=d/i.size),l(14,p=0),l(13,f=0),i.data)){for(let A in i.data){let ne=i.data[A];l(13,f=Math.max(Math.ceil(ne/1e3)*1e3,f)),l(14,p=Math.min(Math.ceil(ne/1e3)*1e3,p))}l(10,j=f>2500?"kW":"W"),l(7,T=[]);for(let A=p;A2500?(A/1e3).toFixed(1):A});l(8,E=[]);for(let A=p;A0||t[0].e>0}}),{c(){e=c("div"),ae(l.$$.fragment),a(e,"class","cnt")},m(i,o){S(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(L(l.$$.fragment,i),n=!0)},o(i){U(l.$$.fragment,i),n=!1},d(i){i&&C(e),oe(l)}}}function Uu(t){let e,l,n;return l=new e_({}),{c(){e=c("div"),ae(l.$$.fragment),a(e,"class","cnt h-64")},m(i,o){S(i,e,o),se(l,e,null),n=!0},i(i){n||(L(l.$$.fragment,i),n=!0)},o(i){U(l.$$.fragment,i),n=!1},d(i){i&&C(e),oe(l)}}}function ju(t){let e,l,n;return l=new i_({}),{c(){e=c("div"),ae(l.$$.fragment),a(e,"class","cnt gwf")},m(i,o){S(i,e,o),se(l,e,null),n=!0},i(i){n||(L(l.$$.fragment,i),n=!0)},o(i){U(l.$$.fragment,i),n=!1},d(i){i&&C(e),oe(l)}}}function Hu(t){let e,l,n;return l=new jm({props:{json:t[2],sysinfo:t[1]}}),{c(){e=c("div"),ae(l.$$.fragment),a(e,"class","cnt gwf")},m(i,o){S(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(L(l.$$.fragment,i),n=!0)},o(i){U(l.$$.fragment,i),n=!1},d(i){i&&C(e),oe(l)}}}function Wu(t){let e,l,n;return l=new zm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=c("div"),ae(l.$$.fragment),a(e,"class","cnt gwf")},m(i,o){S(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(L(l.$$.fragment,i),n=!0)},o(i){U(l.$$.fragment,i),n=!1},d(i){i&&C(e),oe(l)}}}function zu(t){let e,l,n;return l=new Km({props:{json:t[4],sysinfo:t[1]}}),{c(){e=c("div"),ae(l.$$.fragment),a(e,"class","cnt gwf")},m(i,o){S(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(L(l.$$.fragment,i),n=!0)},o(i){U(l.$$.fragment,i),n=!1},d(i){i&&C(e),oe(l)}}}function Gu(t){let e,l,n;return l=new Xm({props:{json:t[5]}}),{c(){e=c("div"),ae(l.$$.fragment),a(e,"class","cnt gwf")},m(i,o){S(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&32&&(u.json=i[5]),l.$set(u)},i(i){n||(L(l.$$.fragment,i),n=!0)},o(i){U(l.$$.fragment,i),n=!1},d(i){i&&C(e),oe(l)}}}function s_(t){let e,l=at(t[1].ui.i,t[0].i),n,i=at(t[1].ui.e,t[0].om||t[0].e>0),o,u=at(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),m,r=at(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,p=at(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,v=at(t[1].ui.c,t[0].ea),h,d=at(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),g,k=at(t[1].ui.l),P,T=at(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),E,R=at(t[1].ui.d,t[3]),j,O=at(t[1].ui.m,t[4]),y,A=at(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),ne,B=l&&Ru(t),F=i&&Iu(t),H=u&&Ou(t),W=r&&Fu(t),K=p&&Bu(t),Y=v&&qu(t),x=d&&Uu(),G=k&&ju(),z=T&&Hu(t),ee=R&&Wu(t),ce=O&&zu(t),ie=A&&Gu(t);return{c(){e=c("div"),B&&B.c(),n=b(),F&&F.c(),o=b(),H&&H.c(),m=b(),W&&W.c(),f=b(),K&&K.c(),_=b(),Y&&Y.c(),h=b(),x&&x.c(),g=b(),G&&G.c(),P=b(),z&&z.c(),E=b(),ee&&ee.c(),j=b(),ce&&ce.c(),y=b(),ie&&ie.c(),a(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(Q,V){S(Q,e,V),B&&B.m(e,null),s(e,n),F&&F.m(e,null),s(e,o),H&&H.m(e,null),s(e,m),W&&W.m(e,null),s(e,f),K&&K.m(e,null),s(e,_),Y&&Y.m(e,null),s(e,h),x&&x.m(e,null),s(e,g),G&&G.m(e,null),s(e,P),z&&z.m(e,null),s(e,E),ee&&ee.m(e,null),s(e,j),ce&&ce.m(e,null),s(e,y),ie&&ie.m(e,null),ne=!0},p(Q,[V]){V&3&&(l=at(Q[1].ui.i,Q[0].i)),l?B?(B.p(Q,V),V&3&&L(B,1)):(B=Ru(Q),B.c(),L(B,1),B.m(e,n)):B&&(Fe(),U(B,1,1,()=>{B=null}),Be()),V&3&&(i=at(Q[1].ui.e,Q[0].om||Q[0].e>0)),i?F?(F.p(Q,V),V&3&&L(F,1)):(F=Iu(Q),F.c(),L(F,1),F.m(e,o)):F&&(Fe(),U(F,1,1,()=>{F=null}),Be()),V&3&&(u=at(Q[1].ui.v,Q[0].u1>100||Q[0].u2>100||Q[0].u3>100)),u?H?(H.p(Q,V),V&3&&L(H,1)):(H=Ou(Q),H.c(),L(H,1),H.m(e,m)):H&&(Fe(),U(H,1,1,()=>{H=null}),Be()),V&3&&(r=at(Q[1].ui.a,Q[0].i1>.01||Q[0].i2>.01||Q[0].i3>.01)),r?W?(W.p(Q,V),V&3&&L(W,1)):(W=Fu(Q),W.c(),L(W,1),W.m(e,f)):W&&(Fe(),U(W,1,1,()=>{W=null}),Be()),V&3&&(p=at(Q[1].ui.r,Q[0].ri>0||Q[0].re>0||Q[0].ric>0||Q[0].rec>0)),p?K?(K.p(Q,V),V&3&&L(K,1)):(K=Bu(Q),K.c(),L(K,1),K.m(e,_)):K&&(Fe(),U(K,1,1,()=>{K=null}),Be()),V&3&&(v=at(Q[1].ui.c,Q[0].ea)),v?Y?(Y.p(Q,V),V&3&&L(Y,1)):(Y=qu(Q),Y.c(),L(Y,1),Y.m(e,h)):Y&&(Fe(),U(Y,1,1,()=>{Y=null}),Be()),V&3&&(d=at(Q[1].ui.t,Q[0].pr&&(Q[0].pr.startsWith("10YNO")||Q[0].pr.startsWith("10Y1001A1001A4")))),d?x?V&3&&L(x,1):(x=Uu(),x.c(),L(x,1),x.m(e,g)):x&&(Fe(),U(x,1,1,()=>{x=null}),Be()),V&2&&(k=at(Q[1].ui.l)),k?G?V&2&&L(G,1):(G=ju(),G.c(),L(G,1),G.m(e,P)):G&&(Fe(),U(G,1,1,()=>{G=null}),Be()),V&3&&(T=at(Q[1].ui.p,Q[0].pe&&!Number.isNaN(Q[0].p))),T?z?(z.p(Q,V),V&3&&L(z,1)):(z=Hu(Q),z.c(),L(z,1),z.m(e,E)):z&&(Fe(),U(z,1,1,()=>{z=null}),Be()),V&10&&(R=at(Q[1].ui.d,Q[3])),R?ee?(ee.p(Q,V),V&10&&L(ee,1)):(ee=Wu(Q),ee.c(),L(ee,1),ee.m(e,j)):ee&&(Fe(),U(ee,1,1,()=>{ee=null}),Be()),V&18&&(O=at(Q[1].ui.m,Q[4])),O?ce?(ce.p(Q,V),V&18&&L(ce,1)):(ce=zu(Q),ce.c(),L(ce,1),ce.m(e,y)):ce&&(Fe(),U(ce,1,1,()=>{ce=null}),Be()),V&35&&(A=at(Q[1].ui.s,Q[0].t&&Q[0].t!=-127&&Q[5].c>1)),A?ie?(ie.p(Q,V),V&35&&L(ie,1)):(ie=Gu(Q),ie.c(),L(ie,1),ie.m(e,null)):ie&&(Fe(),U(ie,1,1,()=>{ie=null}),Be())},i(Q){ne||(L(B),L(F),L(H),L(W),L(K),L(Y),L(x),L(G),L(z),L(ee),L(ce),L(ie),ne=!0)},o(Q){U(B),U(F),U(H),U(W),U(K),U(Y),U(x),U(G),U(z),U(ee),U(ce),U(ie),ne=!1},d(Q){Q&&C(e),B&&B.d(),F&&F.d(),H&&H.d(),W&&W.d(),K&&K.d(),Y&&Y.d(),x&&x.d(),G&&G.d(),z&&z.d(),ee&&ee.d(),ce&&ce.d(),ie&&ie.d()}}}function o_(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},u={},m={},r={};return Co.subscribe(f=>{l(2,o=f)}),t1.subscribe(f=>{l(3,u=f)}),l1.subscribe(f=>{l(4,m=f)}),i1.subscribe(f=>{l(5,r=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,u,m,r]}class a_ extends je{constructor(e){super(),Ue(this,e,o_,s_,Ie,{data:0,sysinfo:1})}}let ao={};const gi=pt(ao);async function r_(){ao=await(await fetch("configuration.json")).json(),gi.set(ao)}let ro={};const _1=pt(ro);async function u_(){ro=await(await fetch("priceconfig.json")).json(),_1.set(ro)}function Vu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function f_(t){let e;return{c(){e=c("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function c_(t){let e;return{c(){e=c("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function Ku(t){let e;return{c(){e=c("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function Yu(t){let e,l,n;return{c(){e=c("option"),e.textContent="UART1",l=b(),n=c("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){S(i,e,o),S(i,l,o),S(i,n,o)},d(i){i&&C(e),i&&C(l),i&&C(n)}}}function Qu(t){let e;return{c(){e=c("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function Xu(t){let e,l,n;return{c(){e=c("option"),l=N("GPIO"),n=N(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){S(i,e,o),s(e,l),s(e,n)},d(i){i&&C(e)}}}function Zu(t){let e,l=t[4]>1&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!((t[0]=="esp32s2"||t[0]=="esp32s3")&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Xu(t);return{c(){l&&l.c(),e=nt()},m(n,i){l&&l.m(n,i),S(n,e,i)},p(n,i){n[4]>1&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!((n[0]=="esp32s2"||n[0]=="esp32s3")&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Xu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&C(e)}}}function m_(t){let e,l,n,i,o;function u(d,g){return d[0]=="esp32c3"?c_:f_}let m=u(t),r=m(t),f=t[0]=="esp8266"&&Ku(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&Yu(),_=(t[0]=="esp32s2"||t[0]=="esp32s3")&&Qu(),v={length:t[1]+1},h=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32s3":l(1,i=46);break;case"esp32c3":l(1,i=19);break}},[n,i]}class uo extends je{constructor(e){super(),Ue(this,e,__,m_,Ie,{chip:0})}}function Ju(t){let e,l,n=t[1]&&xu(t);return{c(){e=c("div"),l=c("div"),n&&n.c(),a(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),a(e,"class","z-50"),a(e,"aria-modal","true")},m(i,o){S(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=xu(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&C(e),n&&n.d()}}}function xu(t){let e,l;return{c(){e=c("div"),l=N(t[1]),a(e,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(n,i){S(n,e,i),s(e,l)},p(n,i){i&2&&Z(l,n[1])},d(n){n&&C(e)}}}function p_(t){let e,l=t[0]&&Ju(t);return{c(){l&&l.c(),e=nt()},m(n,i){l&&l.m(n,i),S(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ju(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:he,o:he,d(n){l&&l.d(n),n&&C(e)}}}function d_(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class Tt extends je{constructor(e){super(),Ue(this,e,d_,p_,Ie,{active:0,message:1})}}function ef(t,e,l){const n=t.slice();return n[1]=e[l],n}function tf(t){let e,l,n=t[1]+"",i;return{c(){e=c("option"),l=N("Europe/"),i=N(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){S(o,e,u),s(e,l),s(e,i)},p:he,d(o){o&&C(e)}}}function h_(t){let e,l,n,i=t[0],o=[];for(let u=0;u>1&1,D=0;D0;w--)D[w]=D[w]?D[w-1]^j.EXPONENT[A._modN(j.LOG[D[w]]+$)]:D[w-1];D[0]=j.EXPONENT[A._modN(j.LOG[D[0]]+$)]}for($=0;$<=M;$++)D[$]=j.LOG[D[$]]},_checkBadness:function(){var $,w,M,D,I,J=0,le=this._badness,me=this.buffer,ve=this.width;for(I=0;Ive*ve;)fe-=ve*ve,De++;for(J+=De*A.N4,D=0;D=le-2&&($=le-2,I>9&&$--);var me=$;if(I>9){for(J[me+2]=0,J[me+3]=0;me--;)w=J[me],J[me+3]|=255&w<<4,J[me+2]=w>>4;J[2]|=255&$<<4,J[1]=$>>4,J[0]=64|$>>12}else{for(J[me+1]=0,J[me+2]=0;me--;)w=J[me],J[me+2]|=255&w<<4,J[me+1]=w>>4;J[1]|=255&$<<4,J[0]=64|$>>4}for(me=$+3-(I<10);me=5&&(M+=A.N1+D[w]-5);for(w=3;w<$-1;w+=2)D[w-2]===D[w+2]&&D[w+2]===D[w-1]&&D[w-1]===D[w+1]&&D[w-1]*3===D[w]&&(D[w-3]===0||w+3>$||D[w-3]*3>=D[w]*4||D[w+3]*3>=D[w]*4)&&(M+=A.N3);return M},_finish:function(){this._stringBuffer=this.buffer.slice();var $,w,M=0,D=3e4;for(w=0;w<8&&(this._applyMask(w),$=this._checkBadness(),$>=1)D&1&&(I[J-1-w+J*8]=1,w<6?I[8+J*w]=1:I[8+J*(w+1)]=1);for(w=0;w<7;w++,D>>=1)D&1&&(I[8+J*(J-7+w)]=1,w?I[6-w+J*8]=1:I[7+J*8]=1)},_interleaveBlocks:function(){var $,w,M=this._dataBlock,D=this._ecc,I=this._eccBlock,J=0,le=this._calculateMaxLength(),me=this._neccBlock1,ve=this._neccBlock2,Te=this._stringBuffer;for($=0;$1)for($=P.BLOCK[D],M=I-7;;){for(w=I-7;w>$-3&&(this._addAlignment(w,M),!(w<$));)w-=$;if(M<=$+9)break;M-=$,this._addAlignment(6,M),this._addAlignment(M,6)}},_insertFinders:function(){var $,w,M,D,I=this.buffer,J=this.width;for($=0;$<3;$++){for(w=0,D=0,$===1&&(w=J-7),$===2&&(D=J-7),I[D+3+J*(w+3)]=1,M=0;M<6;M++)I[D+M+J*w]=1,I[D+J*(w+M+1)]=1,I[D+6+J*(w+M)]=1,I[D+M+1+J*(w+6)]=1;for(M=1;M<5;M++)this._setMask(D+M,w+1),this._setMask(D+1,w+M+1),this._setMask(D+5,w+M),this._setMask(D+M+1,w+5);for(M=2;M<4;M++)I[D+M+J*(w+2)]=1,I[D+2+J*(w+M+1)]=1,I[D+4+J*(w+M)]=1,I[D+M+1+J*(w+4)]=1}},_insertTimingGap:function(){var $,w,M=this.width;for(w=0;w<7;w++)this._setMask(7,w),this._setMask(M-8,w),this._setMask(7,w+M-7);for($=0;$<8;$++)this._setMask($,7),this._setMask($+M-8,7),this._setMask($,M-8)},_insertTimingRowAndColumn:function(){var $,w=this.buffer,M=this.width;for($=0;$6)for($=y.BLOCK[J-7],w=17,M=0;M<6;M++)for(D=0;D<3;D++,w--)1&(w>11?J>>w-12:$>>w)?(I[5-M+le*(2-D+le-11)]=1,I[2-D+le-11+le*(5-M)]=1):(this._setMask(5-M,2-D+le-11),this._setMask(2-D+le-11,5-M))},_isMasked:function($,w){var M=A._getMaskBit($,w);return this._mask[M]===1},_pack:function(){var $,w,M,D=1,I=1,J=this.width,le=J-1,me=J-1,ve=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(w=0;ww&&(M=$,$=w,w=M),M=w,M+=w*w,M>>=1,M+=$,M},_modN:function($){for(;$>=255;)$-=255,$=($>>8)+($&255);return $},N1:3,N2:3,N3:40,N4:10}),ne=A,B=h.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var $=this.element;$.width=$.height=this.qrious.size}}),F=B,H=_.extend(function($,w,M,D){this.name=$,this.modifiable=Boolean(w),this.defaultValue=M,this._valueTransformer=D},{transform:function($){var w=this._valueTransformer;return typeof w=="function"?w($,this):$}}),W=H,K=_.extend(null,{abs:function($){return $!=null?Math.abs($):null},hasOwn:function($,w){return Object.prototype.hasOwnProperty.call($,w)},noop:function(){},toUpperCase:function($){return $!=null?$.toUpperCase():null}}),Y=K,x=_.extend(function($){this.options={},$.forEach(function(w){this.options[w.name]=w},this)},{exists:function($){return this.options[$]!=null},get:function($,w){return x._get(this.options[$],w)},getAll:function($){var w,M=this.options,D={};for(w in M)Y.hasOwn(M,w)&&(D[w]=x._get(M[w],$));return D},init:function($,w,M){typeof M!="function"&&(M=Y.noop);var D,I;for(D in this.options)Y.hasOwn(this.options,D)&&(I=this.options[D],x._set(I,I.defaultValue,w),x._createAccessor(I,w,M));this._setAll($,w,!0)},set:function($,w,M){return this._set($,w,M)},setAll:function($,w){return this._setAll($,w)},_set:function($,w,M,D){var I=this.options[$];if(!I)throw new Error("Invalid option: "+$);if(!I.modifiable&&!D)throw new Error("Option cannot be modified: "+$);return x._set(I,w,M)},_setAll:function($,w,M){if(!$)return!1;var D,I=!1;for(D in $)Y.hasOwn($,D)&&this._set(D,$[D],w,M)&&(I=!0);return I}},{_createAccessor:function($,w,M){var D={get:function(){return x._get($,w)}};$.modifiable&&(D.set=function(I){x._set($,I,w)&&M(I,$)}),Object.defineProperty(w,$.name,D)},_get:function($,w){return w["_"+$.name]},_set:function($,w,M){var D="_"+$.name,I=M[D],J=$.transform(w!=null?w:$.defaultValue);return M[D]=J,J!==I}}),G=x,z=_.extend(function(){this._services={}},{getService:function($){var w=this._services[$];if(!w)throw new Error("Service is not being managed with name: "+$);return w},setService:function($,w){if(this._services[$])throw new Error("Service is already managed with name: "+$);w&&(this._services[$]=w)}}),ee=z,ce=new G([new W("background",!0,"white"),new W("backgroundAlpha",!0,1,Y.abs),new W("element"),new W("foreground",!0,"black"),new W("foregroundAlpha",!0,1,Y.abs),new W("level",!0,"L",Y.toUpperCase),new W("mime",!0,"image/png"),new W("padding",!0,null,Y.abs),new W("size",!0,100,Y.abs),new W("value",!0,"")]),ie=new ee,Q=_.extend(function($){ce.init($,this,this.update.bind(this));var w=ce.get("element",this),M=ie.getService("element"),D=w&&M.isCanvas(w)?w:M.createCanvas(),I=w&&M.isImage(w)?w:M.createImage();this._canvasRenderer=new g(this,D,!0),this._imageRenderer=new F(this,I,I===w),this.update()},{get:function(){return ce.getAll(this)},set:function($){ce.setAll($,this)&&this.update()},toDataURL:function($){return this.canvas.toDataURL($||this.mime)},update:function(){var $=new ne({level:this.level,value:this.value});this._canvasRenderer.render($),this._imageRenderer.render($)}},{use:function($){ie.setService($.getName(),$)}});Object.defineProperties(Q.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var V=Q,we=V,Ze=_.extend({getName:function(){}}),Ne=Ze,Ge=Ne.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function($){},isImage:function($){}}),Pe=Ge,be=Pe.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function($){return $ instanceof HTMLCanvasElement},isImage:function($){return $ instanceof HTMLImageElement}}),Le=be;we.use(new Le);var Ee=we;return Ee})})(d1);const y_=d1.exports;function C_(t){let e,l;return{c(){e=c("img"),hs(e.src,l=t[2])||a(e,"src",l),a(e,"alt",t[0]),a(e,"class",t[1])},m(n,i){S(n,e,i)},p(n,[i]){i&4&&!hs(e.src,l=n[2])&&a(e,"src",l),i&1&&a(e,"alt",n[0]),i&2&&a(e,"class",n[1])},i:he,o:he,d(n){n&&C(e)}}}function S_(t,e,l){const n=new y_;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:m="200"}=e,{value:r=""}=e,{padding:f=0}=e,{className:p="qrcode"}=e,_="";function v(){n.set({background:o,foreground:u,level:i,padding:f,size:m,value:r}),l(2,_=n.toDataURL("image/jpeg"))}return wc(()=>{v()}),t.$$set=h=>{"errorCorrection"in h&&l(3,i=h.errorCorrection),"background"in h&&l(4,o=h.background),"color"in h&&l(5,u=h.color),"size"in h&&l(6,m=h.size),"value"in h&&l(0,r=h.value),"padding"in h&&l(7,f=h.padding),"className"in h&&l(1,p=h.className)},t.$$.update=()=>{t.$$.dirty&1&&r&&v()},[r,p,_,i,o,u,m,f]}class M_ extends je{constructor(e){super(),Ue(this,e,S_,C_,Ie,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function lf(t,e,l){const n=t.slice();return n[101]=e[l],n[102]=e,n[103]=l,n}function nf(t,e,l){const n=t.slice();return n[104]=e[l],n[105]=e,n[106]=l,n}function T_(t,e,l){const n=t.slice();return n[107]=e[l],n}function $_(t,e,l){const n=t.slice();return n[110]=e[l],n}function N_(t){let e,l;return{c(){e=c("option"),l=N(t[110]),e.__value=t[110],e.value=e.__value},m(n,i){S(n,e,i),s(e,l)},p:he,d(n){n&&C(e)}}}function E_(t){let e;return{c(){e=N("Configure price")},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function sf(t){let e,l,n,i;return{c(){e=c("br"),l=c("input"),a(l,"name","pt"),a(l,"type","text"),a(l,"class","in-s"),a(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){S(o,e,u),S(o,l,u),ue(l,t[3].p.t),n||(i=X(l,"input",t[21]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].p.t&&ue(l,o[3].p.t)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function of(t){let e,l,n,i,o,u,m,r,f,p,_,v,h;return{c(){e=c("div"),l=N("Username"),n=c("br"),i=b(),o=c("input"),u=b(),m=c("div"),r=N("Password"),f=c("br"),p=b(),_=c("input"),a(o,"name","gu"),a(o,"type","text"),a(o,"class","in-s"),a(o,"maxlength","36"),a(e,"class","my-1"),a(_,"name","gp"),a(_,"type","password"),a(_,"class","in-s"),a(_,"maxlength","36"),a(m,"class","my-1")},m(d,g){S(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),ue(o,t[3].g.u),S(d,u,g),S(d,m,g),s(m,r),s(m,f),s(m,p),s(m,_),ue(_,t[3].g.p),v||(h=[X(o,"input",t[23]),X(_,"input",t[24])],v=!0)},p(d,g){g[0]&8&&o.value!==d[3].g.u&&ue(o,d[3].g.u),g[0]&8&&_.value!==d[3].g.p&&ue(_,d[3].g.p)},d(d){d&&C(e),d&&C(u),d&&C(m),v=!1,lt(h)}}}function A_(t){let e,l=t[107]*100+"",n;return{c(){e=c("option"),n=N(l),e.__value=t[107]*100,e.value=e.__value},m(i,o){S(i,e,o),s(e,n)},p:he,d(i){i&&C(e)}}}function af(t){let e,l,n,i;return{c(){e=c("br"),l=c("input"),a(l,"name","mek"),a(l,"type","text"),a(l,"class","in-s")},m(o,u){S(o,e,u),S(o,l,u),ue(l,t[3].m.e.k),n||(i=X(l,"input",t[35]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].m.e.k&&ue(l,o[3].m.e.k)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function rf(t){let e,l,n,i,o,u,m;return{c(){e=c("div"),l=N("Authentication key"),n=c("br"),i=b(),o=c("input"),a(o,"name","mea"),a(o,"type","text"),a(o,"class","in-s"),a(e,"class","my-1")},m(r,f){S(r,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ue(o,t[3].m.e.a),u||(m=X(o,"input",t[36]),u=!0)},p(r,f){f[0]&8&&o.value!==r[3].m.e.a&&ue(o,r[3].m.e.a)},d(r){r&&C(e),u=!1,m()}}}function uf(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P,T,E,R,j,O,y,A,ne,B;return{c(){e=c("div"),l=c("div"),n=N("Watt"),i=c("br"),o=b(),u=c("input"),m=b(),r=c("div"),f=N("Volt"),p=c("br"),_=b(),v=c("input"),h=b(),d=c("div"),g=N("Amp"),k=c("br"),P=b(),T=c("input"),E=b(),R=c("div"),j=N("kWh"),O=c("br"),y=b(),A=c("input"),a(u,"name","mmw"),a(u,"type","number"),a(u,"min","0.00"),a(u,"max","1000"),a(u,"step","0.001"),a(u,"class","in-f tr w-full"),a(l,"class","w-1/4"),a(v,"name","mmv"),a(v,"type","number"),a(v,"min","0.00"),a(v,"max","1000"),a(v,"step","0.001"),a(v,"class","in-m tr w-full"),a(r,"class","w-1/4"),a(T,"name","mma"),a(T,"type","number"),a(T,"min","0.00"),a(T,"max","1000"),a(T,"step","0.001"),a(T,"class","in-m tr w-full"),a(d,"class","w-1/4"),a(A,"name","mmc"),a(A,"type","number"),a(A,"min","0.00"),a(A,"max","1000"),a(A,"step","0.001"),a(A,"class","in-l tr w-full"),a(R,"class","w-1/4"),a(e,"class","flex my-1")},m(F,H){S(F,e,H),s(e,l),s(l,n),s(l,i),s(l,o),s(l,u),ue(u,t[3].m.m.w),s(e,m),s(e,r),s(r,f),s(r,p),s(r,_),s(r,v),ue(v,t[3].m.m.v),s(e,h),s(e,d),s(d,g),s(d,k),s(d,P),s(d,T),ue(T,t[3].m.m.a),s(e,E),s(e,R),s(R,j),s(R,O),s(R,y),s(R,A),ue(A,t[3].m.m.c),ne||(B=[X(u,"input",t[38]),X(v,"input",t[39]),X(T,"input",t[40]),X(A,"input",t[41])],ne=!0)},p(F,H){H[0]&8&&ye(u.value)!==F[3].m.m.w&&ue(u,F[3].m.m.w),H[0]&8&&ye(v.value)!==F[3].m.m.v&&ue(v,F[3].m.m.v),H[0]&8&&ye(T.value)!==F[3].m.m.a&&ue(T,F[3].m.m.a),H[0]&8&&ye(A.value)!==F[3].m.m.c&&ue(A,F[3].m.m.c)},d(F){F&&C(e),ne=!1,lt(B)}}}function ff(t){let e;return{c(){e=c("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function cf(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P,T,E,R,j,O,y,A,ne,B,F,H,W,K,Y,x,G,z,ee,ce,ie,Q;return{c(){e=c("div"),l=N("SSID"),n=c("br"),i=b(),o=c("input"),u=b(),m=c("div"),r=N("Password"),f=c("br"),p=b(),_=c("input"),v=b(),h=c("div"),d=c("div"),g=N("Power saving"),k=c("br"),P=b(),T=c("select"),E=c("option"),E.textContent="Default",R=c("option"),R.textContent="Off",j=c("option"),j.textContent="Minimum",O=c("option"),O.textContent="Maximum",y=b(),A=c("div"),ne=N("Power"),B=c("br"),F=b(),H=c("div"),W=c("input"),K=b(),Y=c("span"),Y.textContent="dBm",x=b(),G=c("div"),z=c("label"),ee=c("input"),ce=N(" Allow 802.11b legacy rates"),a(o,"name","ws"),a(o,"type","text"),a(o,"class","in-s"),a(e,"class","my-1"),a(_,"name","wp"),a(_,"type","password"),a(_,"class","in-s"),a(m,"class","my-1"),E.__value=255,E.value=E.__value,R.__value=0,R.value=R.__value,j.__value=1,j.value=j.__value,O.__value=2,O.value=O.__value,a(T,"name","wz"),a(T,"class","in-s"),t[3].w.z===void 0&&Xe(()=>t[45].call(T)),a(d,"class","w-1/2"),a(W,"name","ww"),a(W,"type","number"),a(W,"min","0"),a(W,"max","20.5"),a(W,"step","0.5"),a(W,"class","in-f tr w-full"),a(Y,"class","in-post"),a(H,"class","flex"),a(A,"class","ml-2 w-1/2"),a(h,"class","my-1 flex"),a(ee,"type","checkbox"),a(ee,"name","wb"),ee.__value="true",ee.value=ee.__value,a(ee,"class","rounded mb-1"),a(G,"class","my-3")},m(V,we){S(V,e,we),s(e,l),s(e,n),s(e,i),s(e,o),ue(o,t[3].w.s),S(V,u,we),S(V,m,we),s(m,r),s(m,f),s(m,p),s(m,_),ue(_,t[3].w.p),S(V,v,we),S(V,h,we),s(h,d),s(d,g),s(d,k),s(d,P),s(d,T),s(T,E),s(T,R),s(T,j),s(T,O),Ce(T,t[3].w.z,!0),s(h,y),s(h,A),s(A,ne),s(A,B),s(A,F),s(A,H),s(H,W),ue(W,t[3].w.w),s(H,K),s(H,Y),S(V,x,we),S(V,G,we),s(G,z),s(z,ee),ee.checked=t[3].w.b,s(z,ce),ie||(Q=[X(o,"input",t[43]),X(_,"input",t[44]),X(T,"change",t[45]),X(W,"input",t[46]),X(ee,"change",t[47])],ie=!0)},p(V,we){we[0]&8&&o.value!==V[3].w.s&&ue(o,V[3].w.s),we[0]&8&&_.value!==V[3].w.p&&ue(_,V[3].w.p),we[0]&8&&Ce(T,V[3].w.z),we[0]&8&&ye(W.value)!==V[3].w.w&&ue(W,V[3].w.w),we[0]&8&&(ee.checked=V[3].w.b)},d(V){V&&C(e),V&&C(u),V&&C(m),V&&C(v),V&&C(h),V&&C(x),V&&C(G),ie=!1,lt(Q)}}}function mf(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k;return{c(){e=c("div"),l=N("Gateway"),n=c("br"),i=b(),o=c("input"),u=b(),m=c("div"),r=N("DNS"),f=c("br"),p=b(),_=c("div"),v=c("input"),h=b(),d=c("input"),a(o,"name","ng"),a(o,"type","text"),a(o,"class","in-s"),a(e,"class","my-1"),a(v,"name","nd1"),a(v,"type","text"),a(v,"class","in-f w-full"),a(d,"name","nd2"),a(d,"type","text"),a(d,"class","in-l w-full"),a(_,"class","flex"),a(m,"class","my-1")},m(P,T){S(P,e,T),s(e,l),s(e,n),s(e,i),s(e,o),ue(o,t[3].n.g),S(P,u,T),S(P,m,T),s(m,r),s(m,f),s(m,p),s(m,_),s(_,v),ue(v,t[3].n.d1),s(_,h),s(_,d),ue(d,t[3].n.d2),g||(k=[X(o,"input",t[51]),X(v,"input",t[52]),X(d,"input",t[53])],g=!0)},p(P,T){T[0]&8&&o.value!==P[3].n.g&&ue(o,P[3].n.g),T[0]&8&&v.value!==P[3].n.d1&&ue(v,P[3].n.d1),T[0]&8&&d.value!==P[3].n.d2&&ue(d,P[3].n.d2)},d(P){P&&C(e),P&&C(u),P&&C(m),g=!1,lt(k)}}}function _f(t){let e,l,n,i,o;return{c(){e=c("label"),l=c("input"),n=N(" SSL"),a(l,"type","checkbox"),a(l,"name","qs"),l.__value="true",l.value=l.__value,a(l,"class","rounded mb-1"),a(e,"class","float-right mr-3")},m(u,m){S(u,e,m),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[X(l,"change",t[57]),X(l,"change",t[14])],i=!0)},p(u,m){m[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&C(e),i=!1,lt(o)}}}function pf(t){let e,l,n,i,o,u,m,r,f,p,_,v,h;const d=[D_,P_],g=[];function k(y,A){return y[3].q.s.c?0:1}n=k(t),i=g[n]=d[n](t);const P=[O_,I_],T=[];function E(y,A){return y[3].q.s.r?0:1}m=E(t),r=T[m]=P[m](t);const R=[U_,q_],j=[];function O(y,A){return y[3].q.s.k?0:1}return _=O(t),v=j[_]=R[_](t),{c(){e=c("div"),l=c("span"),i.c(),o=b(),u=c("span"),r.c(),f=b(),p=c("span"),v.c(),a(l,"class","flex pr-2"),a(u,"class","flex pr-2"),a(p,"class","flex pr-2"),a(e,"class","my-1 flex")},m(y,A){S(y,e,A),s(e,l),g[n].m(l,null),s(e,o),s(e,u),T[m].m(u,null),s(e,f),s(e,p),j[_].m(p,null),h=!0},p(y,A){let ne=n;n=k(y),n===ne?g[n].p(y,A):(Fe(),U(g[ne],1,1,()=>{g[ne]=null}),Be(),i=g[n],i?i.p(y,A):(i=g[n]=d[n](y),i.c()),L(i,1),i.m(l,null));let B=m;m=E(y),m===B?T[m].p(y,A):(Fe(),U(T[B],1,1,()=>{T[B]=null}),Be(),r=T[m],r?r.p(y,A):(r=T[m]=P[m](y),r.c()),L(r,1),r.m(u,null));let F=_;_=O(y),_===F?j[_].p(y,A):(Fe(),U(j[F],1,1,()=>{j[F]=null}),Be(),v=j[_],v?v.p(y,A):(v=j[_]=R[_](y),v.c()),L(v,1),v.m(p,null))},i(y){h||(L(i),L(r),L(v),h=!0)},o(y){U(i),U(r),U(v),h=!1},d(y){y&&C(e),g[n].d(),T[m].d(),j[_].d()}}}function P_(t){let e,l;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[L_]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function D_(t){let e,l,n,i,o,u,m,r;return l=new el({props:{to:"/mqtt-ca",$$slots:{default:[R_]},$$scope:{ctx:t}}}),o=new Ss({}),{c(){e=c("span"),ae(l.$$.fragment),n=b(),i=c("span"),ae(o.$$.fragment),a(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),a(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){S(f,e,p),se(l,e,null),S(f,n,p),S(f,i,p),se(o,i,null),u=!0,m||(r=[X(i,"click",t[11]),X(i,"keypress",t[11])],m=!0)},p(f,p){const _={};p[3]&1048576&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(L(l.$$.fragment,f),L(o.$$.fragment,f),u=!0)},o(f){U(l.$$.fragment,f),U(o.$$.fragment,f),u=!1},d(f){f&&C(e),oe(l),f&&C(n),f&&C(i),oe(o),m=!1,lt(r)}}}function L_(t){let e,l;return e=new un({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:he,i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function R_(t){let e;return{c(){e=N("CA OK")},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function I_(t){let e,l;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[F_]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function O_(t){let e,l,n,i,o,u,m,r;return l=new el({props:{to:"/mqtt-cert",$$slots:{default:[B_]},$$scope:{ctx:t}}}),o=new Ss({}),{c(){e=c("span"),ae(l.$$.fragment),n=b(),i=c("span"),ae(o.$$.fragment),a(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),a(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){S(f,e,p),se(l,e,null),S(f,n,p),S(f,i,p),se(o,i,null),u=!0,m||(r=[X(i,"click",t[12]),X(i,"keypress",t[12])],m=!0)},p(f,p){const _={};p[3]&1048576&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(L(l.$$.fragment,f),L(o.$$.fragment,f),u=!0)},o(f){U(l.$$.fragment,f),U(o.$$.fragment,f),u=!1},d(f){f&&C(e),oe(l),f&&C(n),f&&C(i),oe(o),m=!1,lt(r)}}}function F_(t){let e,l;return e=new un({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:he,i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function B_(t){let e;return{c(){e=N("Cert OK")},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function q_(t){let e,l;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[j_]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function U_(t){let e,l,n,i,o,u,m,r;return l=new el({props:{to:"/mqtt-key",$$slots:{default:[H_]},$$scope:{ctx:t}}}),o=new Ss({}),{c(){e=c("span"),ae(l.$$.fragment),n=b(),i=c("span"),ae(o.$$.fragment),a(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),a(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){S(f,e,p),se(l,e,null),S(f,n,p),S(f,i,p),se(o,i,null),u=!0,m||(r=[X(i,"click",t[13]),X(i,"keypress",t[13])],m=!0)},p(f,p){const _={};p[3]&1048576&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(L(l.$$.fragment,f),L(o.$$.fragment,f),u=!0)},o(f){U(l.$$.fragment,f),U(o.$$.fragment,f),u=!1},d(f){f&&C(e),oe(l),f&&C(n),f&&C(i),oe(o),m=!1,lt(r)}}}function j_(t){let e,l;return e=new un({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:he,i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function H_(t){let e;return{c(){e=N("Key OK")},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function df(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P,T,E,R,j,O,y,A,ne,B,F,H,W,K,Y,x;return o=new Ut({}),{c(){e=c("div"),l=c("strong"),l.textContent="Domoticz",n=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("input"),r=b(),f=c("div"),p=c("div"),_=N("Electricity IDX"),v=c("br"),h=b(),d=c("input"),g=b(),k=c("div"),P=N("Current IDX"),T=c("br"),E=b(),R=c("input"),j=b(),O=c("div"),y=N(`Voltage IDX: L1, L2 & L3 + `),A=c("div"),ne=c("input"),B=b(),F=c("input"),H=b(),W=c("input"),a(l,"class","text-sm"),a(i,"href",jt("MQTT-configuration#domoticz")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"type","hidden"),a(m,"name","o"),m.value="true",a(d,"name","oe"),a(d,"type","text"),a(d,"class","in-f tr w-full"),a(p,"class","w-1/2"),a(R,"name","oc"),a(R,"type","text"),a(R,"class","in-l tr w-full"),a(k,"class","w-1/2"),a(f,"class","my-1 flex"),a(ne,"name","ou1"),a(ne,"type","text"),a(ne,"class","in-f tr w-1/3"),a(F,"name","ou2"),a(F,"type","text"),a(F,"class","in-m tr w-1/3"),a(W,"name","ou3"),a(W,"type","text"),a(W,"class","in-l tr w-1/3"),a(A,"class","flex"),a(O,"class","my-1"),a(e,"class","cnt")},m(G,z){S(G,e,z),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(p,_),s(p,v),s(p,h),s(p,d),ue(d,t[3].o.e),s(f,g),s(f,k),s(k,P),s(k,T),s(k,E),s(k,R),ue(R,t[3].o.c),s(e,j),s(e,O),s(O,y),s(O,A),s(A,ne),ue(ne,t[3].o.u1),s(A,B),s(A,F),ue(F,t[3].o.u2),s(A,H),s(A,W),ue(W,t[3].o.u3),K=!0,Y||(x=[X(d,"input",t[65]),X(R,"input",t[66]),X(ne,"input",t[67]),X(F,"input",t[68]),X(W,"input",t[69])],Y=!0)},p(G,z){z[0]&8&&d.value!==G[3].o.e&&ue(d,G[3].o.e),z[0]&8&&R.value!==G[3].o.c&&ue(R,G[3].o.c),z[0]&8&&ne.value!==G[3].o.u1&&ue(ne,G[3].o.u1),z[0]&8&&F.value!==G[3].o.u2&&ue(F,G[3].o.u2),z[0]&8&&W.value!==G[3].o.u3&&ue(W,G[3].o.u3)},i(G){K||(L(o.$$.fragment,G),K=!0)},o(G){U(o.$$.fragment,G),K=!1},d(G){G&&C(e),oe(o),Y=!1,lt(x)}}}function hf(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P,T,E,R,j,O,y,A,ne,B,F,H,W;return o=new Ut({}),{c(){e=c("div"),l=c("strong"),l.textContent="Home-Assistant",n=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("input"),r=b(),f=c("div"),p=N("Discovery topic prefix"),_=c("br"),v=b(),h=c("input"),d=b(),g=c("div"),k=N("Hostname for URL"),P=c("br"),T=b(),E=c("input"),j=b(),O=c("div"),y=N("Name tag"),A=c("br"),ne=b(),B=c("input"),a(l,"class","text-sm"),a(i,"href",jt("MQTT-configuration#home-assistant")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"type","hidden"),a(m,"name","h"),m.value="true",a(h,"name","ht"),a(h,"type","text"),a(h,"class","in-s"),a(h,"placeholder","homeassistant"),a(f,"class","my-1"),a(E,"name","hh"),a(E,"type","text"),a(E,"class","in-s"),a(E,"placeholder",R=t[3].g.h+".local"),a(g,"class","my-1"),a(B,"name","hn"),a(B,"type","text"),a(B,"class","in-s"),a(O,"class","my-1"),a(e,"class","cnt")},m(K,Y){S(K,e,Y),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(f,_),s(f,v),s(f,h),ue(h,t[3].h.t),s(e,d),s(e,g),s(g,k),s(g,P),s(g,T),s(g,E),ue(E,t[3].h.h),s(e,j),s(e,O),s(O,y),s(O,A),s(O,ne),s(O,B),ue(B,t[3].h.n),F=!0,H||(W=[X(h,"input",t[70]),X(E,"input",t[71]),X(B,"input",t[72])],H=!0)},p(K,Y){Y[0]&8&&h.value!==K[3].h.t&&ue(h,K[3].h.t),(!F||Y[0]&8&&R!==(R=K[3].g.h+".local"))&&a(E,"placeholder",R),Y[0]&8&&E.value!==K[3].h.h&&ue(E,K[3].h.h),Y[0]&8&&B.value!==K[3].h.n&&ue(B,K[3].h.n)},i(K){F||(L(o.$$.fragment,K),F=!0)},o(K){U(o.$$.fragment,K),F=!1},d(K){K&&C(e),oe(o),H=!1,lt(W)}}}function vf(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P,T,E,R,j;o=new Ut({});let O=t[3].c.es&&bf(t);return{c(){e=c("div"),l=c("strong"),l.textContent="Cloud connections",n=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("input"),r=b(),f=c("div"),p=c("label"),_=c("input"),v=N(" AMSreader cloud"),h=b(),d=c("div"),g=c("label"),k=c("input"),P=N(" Energy Speedometer"),T=b(),O&&O.c(),a(l,"class","text-sm"),a(i,"href",jt("Cloud")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"type","hidden"),a(m,"name","c"),m.value="true",a(_,"type","checkbox"),a(_,"name","ce"),_.__value="true",_.value=_.__value,a(_,"class","rounded mb-1"),a(f,"class","my-1"),a(k,"type","checkbox"),a(k,"class","rounded mb-1"),a(k,"name","ces"),k.__value="true",k.value=k.__value,a(d,"class","my-1"),a(e,"class","cnt")},m(y,A){S(y,e,A),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(p,_),_.checked=t[3].c.e,s(p,v),s(e,h),s(e,d),s(d,g),s(g,k),k.checked=t[3].c.es,s(g,P),s(d,T),O&&O.m(d,null),E=!0,R||(j=[X(_,"change",t[73]),X(k,"change",t[74])],R=!0)},p(y,A){A[0]&8&&(_.checked=y[3].c.e),A[0]&8&&(k.checked=y[3].c.es),y[3].c.es?O?(O.p(y,A),A[0]&8&&L(O,1)):(O=bf(y),O.c(),L(O,1),O.m(d,null)):O&&(Fe(),U(O,1,1,()=>{O=null}),Be())},i(y){E||(L(o.$$.fragment,y),L(O),E=!0)},o(y){U(o.$$.fragment,y),U(O),E=!1},d(y){y&&C(e),oe(o),O&&O.d(),R=!1,lt(j)}}}function bf(t){let e,l,n=t[0].mac+"",i,o,u,m,r=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,p,_,v,h=t[0].mac&&t[0].meter.id&&gf(t);return{c(){e=c("div"),l=N("MAC: "),i=N(n),o=b(),u=c("div"),m=N("Meter ID: "),f=N(r),p=b(),h&&h.c(),_=nt(),a(e,"class","pl-5"),a(u,"class","pl-5")},m(d,g){S(d,e,g),s(e,l),s(e,i),S(d,o,g),S(d,u,g),s(u,m),s(u,f),S(d,p,g),h&&h.m(d,g),S(d,_,g),v=!0},p(d,g){(!v||g[0]&1)&&n!==(n=d[0].mac+"")&&Z(i,n),(!v||g[0]&1)&&r!==(r=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&Z(f,r),d[0].mac&&d[0].meter.id?h?(h.p(d,g),g[0]&1&&L(h,1)):(h=gf(d),h.c(),L(h,1),h.m(_.parentNode,_)):h&&(Fe(),U(h,1,1,()=>{h=null}),Be())},i(d){v||(L(h),v=!0)},o(d){U(h),v=!1},d(d){d&&C(e),d&&C(o),d&&C(u),d&&C(p),h&&h.d(d),d&&C(_)}}}function gf(t){let e,l,n;return l=new M_({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=c("div"),ae(l.$$.fragment),a(e,"class","pl-2")},m(i,o){S(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(L(l.$$.fragment,i),n=!0)},o(i){U(l.$$.fragment,i),n=!1},d(i){i&&C(e),oe(l)}}}function kf(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P,T,E;o=new Ut({});let R={length:9},j=[];for(let O=0;O20&&Sf(t),_=t[3].i.d.d>0&&$f(t),v=t[0].chip=="esp8266"&&Nf(t);return{c(){e=c("div"),l=c("strong"),l.textContent="Hardware",n=b(),i=c("a"),ae(o.$$.fragment),u=b(),p&&p.c(),m=b(),_&&_.c(),r=b(),v&&v.c(),a(l,"class","text-sm"),a(i,"href",jt("GPIO-configuration")),a(i,"target","_blank"),a(i,"class","float-right"),a(e,"class","cnt")},m(h,d){S(h,e,d),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),p&&p.m(e,null),s(e,m),_&&_.m(e,null),s(e,r),v&&v.m(e,null),f=!0},p(h,d){h[0].board>20?p?(p.p(h,d),d[0]&1&&L(p,1)):(p=Sf(h),p.c(),L(p,1),p.m(e,m)):p&&(Fe(),U(p,1,1,()=>{p=null}),Be()),h[3].i.d.d>0?_?_.p(h,d):(_=$f(h),_.c(),_.m(e,r)):_&&(_.d(1),_=null),h[0].chip=="esp8266"?v?v.p(h,d):(v=Nf(h),v.c(),v.m(e,null)):v&&(v.d(1),v=null)},i(h){f||(L(o.$$.fragment,h),L(p),f=!0)},o(h){U(o.$$.fragment,h),U(p),f=!1},d(h){h&&C(e),oe(o),p&&p.d(),_&&_.d(),v&&v.d()}}}function Sf(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P,T,E,R,j,O,y,A,ne,B,F,H,W,K,Y,x,G,z,ee,ce,ie,Q,V,we,Ze,Ne,Ge,Pe,be,Le,Ee,$,w,M,D,I,J,le,me,ve,Te,De,fe,Se,He,ct,Ve,rt,We,mt,Oe,$t,_t,dt,et,Ae,tt,$e,Je,ot;f=new uo({props:{chip:t[0].chip}}),k=new uo({props:{chip:t[0].chip}});let Re=t[0].chip!="esp8266"&&Mf(t),ke=t[3].i.v.p>0&&Tf(t);return{c(){e=c("input"),l=b(),n=c("div"),i=c("div"),o=N("HAN RX"),u=c("br"),m=b(),r=c("select"),ae(f.$$.fragment),p=b(),_=c("div"),v=N("HAN TX"),h=c("br"),d=b(),g=c("select"),ae(k.$$.fragment),P=b(),T=c("div"),E=c("label"),R=c("input"),j=N(" pullup"),O=b(),y=c("div"),A=c("div"),ne=N("AP button"),B=c("br"),F=b(),H=c("input"),W=b(),K=c("div"),Y=N("LED"),x=c("br"),G=b(),z=c("div"),ee=c("input"),ce=b(),ie=c("div"),Q=c("label"),V=c("input"),we=N(" inverted"),Ze=b(),Ne=c("div"),Ge=N("RGB"),Pe=c("label"),be=c("input"),Le=N(" inverted"),Ee=c("br"),$=b(),w=c("div"),M=c("input"),D=b(),I=c("input"),J=b(),le=c("input"),me=b(),ve=c("div"),Te=c("div"),De=N(`LED dis. GPIO + `),fe=c("input"),Se=b(),He=c("div"),ct=N("Temperature"),Ve=c("br"),rt=b(),We=c("input"),mt=b(),Oe=c("div"),$t=N("Analog temp"),_t=c("br"),dt=b(),et=c("input"),Ae=b(),Re&&Re.c(),tt=b(),ke&&ke.c(),a(e,"type","hidden"),a(e,"name","i"),e.value="true",a(r,"name","ihp"),a(r,"class","in-f w-full"),t[3].i.h.p===void 0&&Xe(()=>t[78].call(r)),a(i,"class","w-1/3"),a(g,"name","iht"),a(g,"class","in-l w-full"),t[3].i.h.t===void 0&&Xe(()=>t[79].call(g)),a(_,"class","w-1/3"),a(R,"name","ihu"),R.__value="true",R.value=R.__value,a(R,"type","checkbox"),a(R,"class","rounded mb-1"),a(E,"class","ml-2"),a(T,"class","w-1/3"),a(n,"class","flex flex-wrap"),a(H,"name","ia"),a(H,"type","number"),a(H,"min","0"),a(H,"max",t[6]),a(H,"class","in-f tr w-full"),a(A,"class","w-1/3"),a(ee,"name","ilp"),a(ee,"type","number"),a(ee,"min","0"),a(ee,"max",t[6]),a(ee,"class","in-l tr w-full"),a(z,"class","flex"),a(K,"class","w-1/3"),a(V,"name","ili"),V.__value="true",V.value=V.__value,a(V,"type","checkbox"),a(V,"class","rounded mb-1"),a(Q,"class","ml-4"),a(ie,"class","w-1/3"),a(be,"name","iri"),be.__value="true",be.value=be.__value,a(be,"type","checkbox"),a(be,"class","rounded mb-1"),a(Pe,"class","ml-4"),a(M,"name","irr"),a(M,"type","number"),a(M,"min","0"),a(M,"max",t[6]),a(M,"class","in-f tr w-1/3"),a(I,"name","irg"),a(I,"type","number"),a(I,"min","0"),a(I,"max",t[6]),a(I,"class","in-m tr w-1/3"),a(le,"name","irb"),a(le,"type","number"),a(le,"min","0"),a(le,"max",t[6]),a(le,"class","in-l tr w-1/3"),a(w,"class","flex"),a(Ne,"class","w-full"),a(fe,"name","idd"),a(fe,"type","number"),a(fe,"min","0"),a(fe,"max",t[6]),a(fe,"class","in-s tr"),a(Te,"class","my-1 pr-1 w-1/3"),a(ve,"class","w-full"),a(We,"name","itd"),a(We,"type","number"),a(We,"min","0"),a(We,"max",t[6]),a(We,"class","in-f tr w-full"),a(He,"class","my-1 w-1/3"),a(et,"name","ita"),a(et,"type","number"),a(et,"min","0"),a(et,"max",t[6]),a(et,"class","in-l tr w-full"),a(Oe,"class","my-1 pr-1 w-1/3"),a(y,"class","flex flex-wrap")},m(de,_e){S(de,e,_e),S(de,l,_e),S(de,n,_e),s(n,i),s(i,o),s(i,u),s(i,m),s(i,r),se(f,r,null),Ce(r,t[3].i.h.p,!0),s(n,p),s(n,_),s(_,v),s(_,h),s(_,d),s(_,g),se(k,g,null),Ce(g,t[3].i.h.t,!0),s(n,P),s(n,T),s(T,E),s(E,R),R.checked=t[3].i.h.u,s(E,j),S(de,O,_e),S(de,y,_e),s(y,A),s(A,ne),s(A,B),s(A,F),s(A,H),ue(H,t[3].i.a),s(y,W),s(y,K),s(K,Y),s(K,x),s(K,G),s(K,z),s(z,ee),ue(ee,t[3].i.l.p),s(y,ce),s(y,ie),s(ie,Q),s(Q,V),V.checked=t[3].i.l.i,s(Q,we),s(y,Ze),s(y,Ne),s(Ne,Ge),s(Ne,Pe),s(Pe,be),be.checked=t[3].i.r.i,s(Pe,Le),s(Ne,Ee),s(Ne,$),s(Ne,w),s(w,M),ue(M,t[3].i.r.r),s(w,D),s(w,I),ue(I,t[3].i.r.g),s(w,J),s(w,le),ue(le,t[3].i.r.b),s(y,me),s(y,ve),s(ve,Te),s(Te,De),s(Te,fe),ue(fe,t[3].i.d.d),s(y,Se),s(y,He),s(He,ct),s(He,Ve),s(He,rt),s(He,We),ue(We,t[3].i.t.d),s(y,mt),s(y,Oe),s(Oe,$t),s(Oe,_t),s(Oe,dt),s(Oe,et),ue(et,t[3].i.t.a),s(y,Ae),Re&&Re.m(y,null),s(y,tt),ke&&ke.m(y,null),$e=!0,Je||(ot=[X(r,"change",t[78]),X(g,"change",t[79]),X(R,"change",t[80]),X(H,"input",t[81]),X(ee,"input",t[82]),X(V,"change",t[83]),X(be,"change",t[84]),X(M,"input",t[85]),X(I,"input",t[86]),X(le,"input",t[87]),X(fe,"input",t[88]),X(We,"input",t[89]),X(et,"input",t[90])],Je=!0)},p(de,_e){const ze={};_e[0]&1&&(ze.chip=de[0].chip),f.$set(ze),_e[0]&8&&Ce(r,de[3].i.h.p);const re={};_e[0]&1&&(re.chip=de[0].chip),k.$set(re),_e[0]&8&&Ce(g,de[3].i.h.t),_e[0]&8&&(R.checked=de[3].i.h.u),(!$e||_e[0]&64)&&a(H,"max",de[6]),_e[0]&8&&ye(H.value)!==de[3].i.a&&ue(H,de[3].i.a),(!$e||_e[0]&64)&&a(ee,"max",de[6]),_e[0]&8&&ye(ee.value)!==de[3].i.l.p&&ue(ee,de[3].i.l.p),_e[0]&8&&(V.checked=de[3].i.l.i),_e[0]&8&&(be.checked=de[3].i.r.i),(!$e||_e[0]&64)&&a(M,"max",de[6]),_e[0]&8&&ye(M.value)!==de[3].i.r.r&&ue(M,de[3].i.r.r),(!$e||_e[0]&64)&&a(I,"max",de[6]),_e[0]&8&&ye(I.value)!==de[3].i.r.g&&ue(I,de[3].i.r.g),(!$e||_e[0]&64)&&a(le,"max",de[6]),_e[0]&8&&ye(le.value)!==de[3].i.r.b&&ue(le,de[3].i.r.b),(!$e||_e[0]&64)&&a(fe,"max",de[6]),_e[0]&8&&ye(fe.value)!==de[3].i.d.d&&ue(fe,de[3].i.d.d),(!$e||_e[0]&64)&&a(We,"max",de[6]),_e[0]&8&&ye(We.value)!==de[3].i.t.d&&ue(We,de[3].i.t.d),(!$e||_e[0]&64)&&a(et,"max",de[6]),_e[0]&8&&ye(et.value)!==de[3].i.t.a&&ue(et,de[3].i.t.a),de[0].chip!="esp8266"?Re?Re.p(de,_e):(Re=Mf(de),Re.c(),Re.m(y,tt)):Re&&(Re.d(1),Re=null),de[3].i.v.p>0?ke?ke.p(de,_e):(ke=Tf(de),ke.c(),ke.m(y,null)):ke&&(ke.d(1),ke=null)},i(de){$e||(L(f.$$.fragment,de),L(k.$$.fragment,de),$e=!0)},o(de){U(f.$$.fragment,de),U(k.$$.fragment,de),$e=!1},d(de){de&&C(e),de&&C(l),de&&C(n),oe(f),oe(k),de&&C(O),de&&C(y),Re&&Re.d(),ke&&ke.d(),Je=!1,lt(ot)}}}function Mf(t){let e,l,n,i,o,u,m;return{c(){e=c("div"),l=N("Vcc"),n=c("br"),i=b(),o=c("input"),a(o,"name","ivp"),a(o,"type","number"),a(o,"min","0"),a(o,"max",t[6]),a(o,"class","in-s tr w-full"),a(e,"class","my-1 pl-1 w-1/3")},m(r,f){S(r,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ue(o,t[3].i.v.p),u||(m=X(o,"input",t[91]),u=!0)},p(r,f){f[0]&64&&a(o,"max",r[6]),f[0]&8&&ye(o.value)!==r[3].i.v.p&&ue(o,r[3].i.v.p)},d(r){r&&C(e),u=!1,m()}}}function Tf(t){let e,l,n,i,o,u,m,r,f,p;return{c(){e=c("div"),l=N("Voltage divider"),n=c("br"),i=b(),o=c("div"),u=c("input"),m=b(),r=c("input"),a(u,"name","ivdv"),a(u,"type","number"),a(u,"min","0"),a(u,"max","65535"),a(u,"class","in-f tr w-full"),a(u,"placeholder","VCC"),a(r,"name","ivdg"),a(r,"type","number"),a(r,"min","0"),a(r,"max","65535"),a(r,"class","in-l tr w-full"),a(r,"placeholder","GND"),a(o,"class","flex"),a(e,"class","my-1")},m(_,v){S(_,e,v),s(e,l),s(e,n),s(e,i),s(e,o),s(o,u),ue(u,t[3].i.v.d.v),s(o,m),s(o,r),ue(r,t[3].i.v.d.g),f||(p=[X(u,"input",t[92]),X(r,"input",t[93])],f=!0)},p(_,v){v[0]&8&&ye(u.value)!==_[3].i.v.d.v&&ue(u,_[3].i.v.d.v),v[0]&8&&ye(r.value)!==_[3].i.v.d.g&&ue(r,_[3].i.v.d.g)},d(_){_&&C(e),f=!1,lt(p)}}}function $f(t){let e,l,n,i,o,u,m;return{c(){e=c("div"),l=N(`LED behaviour + `),n=c("select"),i=c("option"),i.textContent="Enabled",o=c("option"),o.textContent="Disabled",i.__value=0,i.value=i.__value,o.__value=1,o.value=o.__value,a(n,"name","idb"),a(n,"class","in-s"),t[3].i.d.b===void 0&&Xe(()=>t[94].call(n)),a(e,"class","my-1 w-full")},m(r,f){S(r,e,f),s(e,l),s(e,n),s(n,i),s(n,o),Ce(n,t[3].i.d.b,!0),u||(m=X(n,"change",t[94]),u=!0)},p(r,f){f[0]&8&&Ce(n,r[3].i.d.b)},d(r){r&&C(e),u=!1,m()}}}function Nf(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P,T=(t[0].board==2||t[0].board==100)&&Ef(t);return{c(){e=c("input"),l=b(),n=c("div"),i=c("div"),o=N("Vcc offset"),u=c("br"),m=b(),r=c("input"),f=b(),p=c("div"),_=N("Multiplier"),v=c("br"),h=b(),d=c("input"),g=b(),T&&T.c(),a(e,"type","hidden"),a(e,"name","iv"),e.value="true",a(r,"name","ivo"),a(r,"type","number"),a(r,"min","0.0"),a(r,"max","3.5"),a(r,"step","0.01"),a(r,"class","in-f tr w-full"),a(i,"class","w-1/3"),a(d,"name","ivm"),a(d,"type","number"),a(d,"min","0.1"),a(d,"max","10"),a(d,"step","0.01"),a(d,"class","in-l tr w-full"),a(p,"class","w-1/3 pr-1"),a(n,"class","my-1 flex flex-wrap")},m(E,R){S(E,e,R),S(E,l,R),S(E,n,R),s(n,i),s(i,o),s(i,u),s(i,m),s(i,r),ue(r,t[3].i.v.o),s(n,f),s(n,p),s(p,_),s(p,v),s(p,h),s(p,d),ue(d,t[3].i.v.m),s(n,g),T&&T.m(n,null),k||(P=[X(r,"input",t[95]),X(d,"input",t[96])],k=!0)},p(E,R){R[0]&8&&ye(r.value)!==E[3].i.v.o&&ue(r,E[3].i.v.o),R[0]&8&&ye(d.value)!==E[3].i.v.m&&ue(d,E[3].i.v.m),E[0].board==2||E[0].board==100?T?T.p(E,R):(T=Ef(E),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(E){E&&C(e),E&&C(l),E&&C(n),T&&T.d(),k=!1,lt(P)}}}function Ef(t){let e,l,n,i,o,u,m;return{c(){e=c("div"),l=N("Boot limit"),n=c("br"),i=b(),o=c("input"),a(o,"name","ivb"),a(o,"type","number"),a(o,"min","2.5"),a(o,"max","3.5"),a(o,"step","0.1"),a(o,"class","in-s tr w-full"),a(e,"class","w-1/3 pl-1")},m(r,f){S(r,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ue(o,t[3].i.v.b),u||(m=X(o,"input",t[97]),u=!0)},p(r,f){f[0]&8&&ye(o.value)!==r[3].i.v.b&&ue(o,r[3].i.v.b)},d(r){r&&C(e),u=!1,m()}}}function Af(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P=t[3].d.t&&Pf();return{c(){e=c("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=b(),n=c("div"),i=c("label"),o=c("input"),u=N(" Enable telnet"),m=b(),P&&P.c(),r=b(),f=c("div"),p=c("select"),_=c("option"),_.textContent="Verbose",v=c("option"),v.textContent="Debug",h=c("option"),h.textContent="Info",d=c("option"),d.textContent="Warning",a(e,"class","bd-red"),a(o,"type","checkbox"),a(o,"name","dt"),o.__value="true",o.value=o.__value,a(o,"class","rounded mb-1"),a(n,"class","my-1"),_.__value=1,_.value=_.__value,v.__value=2,v.value=v.__value,h.__value=3,h.value=h.__value,d.__value=4,d.value=d.__value,a(p,"name","dl"),a(p,"class","in-s"),t[3].d.l===void 0&&Xe(()=>t[100].call(p)),a(f,"class","my-1")},m(T,E){S(T,e,E),S(T,l,E),S(T,n,E),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,u),S(T,m,E),P&&P.m(T,E),S(T,r,E),S(T,f,E),s(f,p),s(p,_),s(p,v),s(p,h),s(p,d),Ce(p,t[3].d.l,!0),g||(k=[X(o,"change",t[99]),X(p,"change",t[100])],g=!0)},p(T,E){E[0]&8&&(o.checked=T[3].d.t),T[3].d.t?P||(P=Pf(),P.c(),P.m(r.parentNode,r)):P&&(P.d(1),P=null),E[0]&8&&Ce(p,T[3].d.l)},d(T){T&&C(e),T&&C(l),T&&C(n),T&&C(m),P&&P.d(T),T&&C(r),T&&C(f),g=!1,lt(k)}}}function Pf(t){let e;return{c(){e=c("div"),e.textContent="Telnet is unsafe and should be off when not in use",a(e,"class","bd-red")},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function W_(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P,T,E,R,j,O,y,A,ne,B,F,H,W,K,Y,x,G,z,ee,ce,ie,Q,V,we,Ze,Ne,Ge,Pe,be,Le,Ee,$,w,M,D,I,J,le,me,ve,Te,De,fe,Se,He,ct,Ve,rt,We,mt,Oe,$t,_t,dt,et,Ae,tt,$e,Je,ot,Re,ke,de,_e,ze,re,Ye,te,it,Ai,oi,yl,Pi,Di,Li,Nt,Ri,Qe,pn,Ii,Pl,Dl,Oi,Wl,Fi,zl,Bi,xe,Et,Gl,Ms,Qt,Xt,Ll,qi,cl,Ui,No,Ts,Eo,ai,tl,Ao,Po,Rl,ml,Il,Do,ji,Lo,St,Ol,Ro,Hi,dn,hn,vn,bn,Wi,Io,Ht,zi,Oo,Vl,Fo,Bo,qo,_l,gn,kn,Uo,wn,Kl,jo,Ho,Wo,yn,ll,zo,Gi,Go,Yl,Vo,Ko,Yo,Cn,nl,Qo,Vi,Xo,$s,Zo,Ql,Ki,il,Jo,xo,ea,Ns,Yi,sl,ta,la,na,Wt,Qi,ia,Sn,Mn,sa,ri,oa,Xl,aa,ra,ua,Zt,Tn,$n,fa,ca,yt,Xi,ma,Nn,En,_a,Zl,pa,da,ha,Fl,pl,An,Pn,va,zt,Zi,Ji,ba,Gt,Dn,xi,es,ga,Es,ts,ls,ol,ka,wa,ui,ya,Bl,Ca,fi,al,Sa,Ma,Ta,ns,Cl,$a,ut,is,Na,Ln,Rn,Ea,ci,Aa,dl,Pa,As,Da,La,In,Sl,Ra,rl,Ia,Ps,Jl,Oa,Fa,Ba,Ml,qa,xl,Ua,ja,Ha,Tl,Wa,On,Fn,za,Ga,Va,$l,Ka,Bn,Ya,Qa,Xa,At,qn,Un,jn,Hn,Wn,zn,Za,en,Ja,xa,er,Nl,tr,Ds,Ls,Rs,Is=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),Os,hl,ss,lr,Gn,Vn,nr,mi,ir,_i,sr,Fs,Vt,os,or,Kn,Yn,ar,pi,rr,as,rs,ul,ur,fr,cr,ql,Bs,Qn,mr,us,Xn,_r,fs,qs,tn,Us,ln,js,nn,Hs,sn,Jt,Ws,pr;m=new Ut({}),A=new b_({});let h1=["NOK","SEK","DKK","EUR","CHF"],di=[];for(let q=0;q<5;q+=1)di[q]=N_($_(t,h1,q));dt=new el({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[E_]},$$scope:{ctx:t}}});let Pt=t[3].p.e&&t[0].chip!="esp8266"&&sf(t),Dt=t[3].g.s>0&&of(t);Dl=new Ut({});let v1=[24,48,96,192,384,576,1152],hi=[];for(let q=0;q<7;q+=1)hi[q]=A_(T_(t,v1,q));let Lt=t[3].m.e.e&&af(t),Rt=t[3].m.e.e&&rf(t),It=t[3].m.m.e&&uf(t);Mn=new Ut({});let Kt=t[0].if&&t[0].if.eth&&ff(),Ot=(t[3].n.c==1||t[3].n.c==2)&&cf(t);En=new Ut({}),Dn=new p1({});let Ft=t[3].n.m=="static"&&mf(t);Rn=new Ut({});let Bt=t[0].chip!="esp8266"&&_f(t),ht=t[3].q.s.e&&pf(t),vt=t[3].q.m==3&&df(t),bt=t[3].q.m==4&&hf(t),gt=t[3].c.es!=null&&vf(t),kt=Is&&kf(t);Vn=new Ut({});let Zn=t[7],Mt=[];for(let q=0;q20||t[0].chip=="esp8266"||t[3].i.d.d>0)&&Cf(t);Yn=new Ut({});let qt=t[3].d.s&&Af(t);return tn=new Tt({props:{active:t[1],message:"Loading configuration"}}),ln=new Tt({props:{active:t[2],message:"Saving configuration"}}),nn=new Tt({props:{active:t[4],message:"Performing factory reset"}}),sn=new Tt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=c("form"),l=c("div"),n=c("div"),i=c("strong"),i.textContent="General",o=b(),u=c("a"),ae(m.$$.fragment),r=b(),f=c("input"),p=b(),_=c("div"),v=c("div"),h=c("div"),d=N("Hostname"),g=c("br"),k=b(),P=c("input"),T=b(),E=c("div"),R=N("Time zone"),j=c("br"),O=b(),y=c("select"),ae(A.$$.fragment),ne=b(),B=c("input"),F=b(),H=c("div"),W=c("div"),K=c("div"),Y=N("Price region"),x=c("br"),G=b(),z=c("select"),ee=c("optgroup"),ce=c("option"),ce.textContent="NO1",ie=c("option"),ie.textContent="NO2",Q=c("option"),Q.textContent="NO3",V=c("option"),V.textContent="NO4",we=c("option"),we.textContent="NO5",Ze=c("optgroup"),Ne=c("option"),Ne.textContent="SE1",Ge=c("option"),Ge.textContent="SE2",Pe=c("option"),Pe.textContent="SE3",be=c("option"),be.textContent="SE4",Le=c("optgroup"),Ee=c("option"),Ee.textContent="DK1",$=c("option"),$.textContent="DK2",w=c("option"),w.textContent="Austria",M=c("option"),M.textContent="Belgium",D=c("option"),D.textContent="Czech Republic",I=c("option"),I.textContent="Estonia",J=c("option"),J.textContent="Finland",le=c("option"),le.textContent="France",me=c("option"),me.textContent="Germany",ve=c("option"),ve.textContent="Great Britain",Te=c("option"),Te.textContent="Latvia",De=c("option"),De.textContent="Lithuania",fe=c("option"),fe.textContent="Netherland",Se=c("option"),Se.textContent="Poland",He=c("option"),He.textContent="Switzerland",ct=b(),Ve=c("div"),rt=N("Currency"),We=c("br"),mt=b(),Oe=c("select");for(let q=0;q<5;q+=1)di[q].c();$t=b(),_t=c("div"),ae(dt.$$.fragment),et=b(),Ae=c("div"),tt=c("label"),$e=c("input"),Je=N(" Enable price fetch from remote server"),ot=b(),Pt&&Pt.c(),Re=b(),ke=c("div"),de=N("Security"),_e=c("br"),ze=b(),re=c("select"),Ye=c("option"),Ye.textContent="None",te=c("option"),te.textContent="Only configuration",it=c("option"),it.textContent="Everything",Ai=b(),Dt&&Dt.c(),oi=b(),yl=c("div"),Pi=N("Context"),Di=c("br"),Li=b(),Nt=c("input"),Ri=b(),Qe=c("div"),pn=c("strong"),pn.textContent="Meter",Ii=b(),Pl=c("a"),ae(Dl.$$.fragment),Oi=b(),Wl=c("input"),Fi=b(),zl=c("input"),Bi=b(),xe=c("div"),Et=N("Communication"),Gl=c("br"),Ms=b(),Qt=c("select"),Xt=c("option"),Xt.textContent="Passive (Push)",Ll=c("option"),Ll.textContent="Kamstrup (Pull)",qi=b(),cl=c("div"),Ui=c("span"),Ui.textContent="Buffer size",No=b(),Ts=c("span"),Ts.textContent="Serial conf.",Eo=b(),ai=c("label"),tl=c("input"),Ao=N(" inverted"),Po=b(),Rl=c("div"),ml=c("select"),Il=c("option"),Do=N("Autodetect");for(let q=0;q<7;q+=1)hi[q].c();Lo=b(),St=c("select"),Ol=c("option"),Ro=N("-"),dn=c("option"),dn.textContent="7N1",hn=c("option"),hn.textContent="8N1",vn=c("option"),vn.textContent="7E1",bn=c("option"),bn.textContent="8E1",Io=b(),Ht=c("input"),Oo=b(),Vl=c("div"),Fo=N("Voltage"),Bo=c("br"),qo=b(),_l=c("select"),gn=c("option"),gn.textContent="400V (TN)",kn=c("option"),kn.textContent="230V (IT/TT)",Uo=b(),wn=c("div"),Kl=c("div"),jo=N("Main fuse"),Ho=c("br"),Wo=b(),yn=c("label"),ll=c("input"),zo=b(),Gi=c("span"),Gi.textContent="A",Go=b(),Yl=c("div"),Vo=N("Production"),Ko=c("br"),Yo=b(),Cn=c("label"),nl=c("input"),Qo=b(),Vi=c("span"),Vi.textContent="kWp",Xo=b(),$s=c("div"),Zo=b(),Ql=c("div"),Ki=c("label"),il=c("input"),Jo=N(" Meter is encrypted"),xo=b(),Lt&&Lt.c(),ea=b(),Rt&&Rt.c(),Ns=b(),Yi=c("label"),sl=c("input"),ta=N(" Multipliers"),la=b(),It&&It.c(),na=b(),Wt=c("div"),Qi=c("strong"),Qi.textContent="Connection",ia=b(),Sn=c("a"),ae(Mn.$$.fragment),sa=b(),ri=c("input"),oa=b(),Xl=c("div"),aa=N("Connection"),ra=c("br"),ua=b(),Zt=c("select"),Tn=c("option"),Tn.textContent="WiFi",$n=c("option"),$n.textContent="Access point",Kt&&Kt.c(),fa=b(),Ot&&Ot.c(),ca=b(),yt=c("div"),Xi=c("strong"),Xi.textContent="Network",ma=b(),Nn=c("a"),ae(En.$$.fragment),_a=b(),Zl=c("div"),pa=N("IP"),da=c("br"),ha=b(),Fl=c("div"),pl=c("select"),An=c("option"),An.textContent="DHCP",Pn=c("option"),Pn.textContent="Static",va=b(),zt=c("input"),ba=b(),Gt=c("select"),ae(Dn.$$.fragment),ga=b(),Ft&&Ft.c(),Es=b(),ts=c("div"),ls=c("label"),ol=c("input"),ka=N(" enable mDNS"),wa=b(),ui=c("input"),ya=b(),Bl=c("div"),Ca=N("NTP "),fi=c("label"),al=c("input"),Sa=N(" obtain from DHCP"),Ma=c("br"),Ta=b(),ns=c("div"),Cl=c("input"),$a=b(),ut=c("div"),is=c("strong"),is.textContent="MQTT",Na=b(),Ln=c("a"),ae(Rn.$$.fragment),Ea=b(),ci=c("input"),Aa=b(),dl=c("div"),Pa=N(`Server + `),Bt&&Bt.c(),As=b(),Da=c("br"),La=b(),In=c("div"),Sl=c("input"),Ra=b(),rl=c("input"),Ia=b(),ht&&ht.c(),Ps=b(),Jl=c("div"),Oa=N("Username"),Fa=c("br"),Ba=b(),Ml=c("input"),qa=b(),xl=c("div"),Ua=N("Password"),ja=c("br"),Ha=b(),Tl=c("input"),Wa=b(),On=c("div"),Fn=c("div"),za=N("Client ID"),Ga=c("br"),Va=b(),$l=c("input"),Ka=b(),Bn=c("div"),Ya=N("Payload"),Qa=c("br"),Xa=b(),At=c("select"),qn=c("option"),qn.textContent="JSON",Un=c("option"),Un.textContent="Raw (minimal)",jn=c("option"),jn.textContent="Raw (full)",Hn=c("option"),Hn.textContent="Domoticz",Wn=c("option"),Wn.textContent="HomeAssistant",zn=c("option"),zn.textContent="HEX dump",Za=b(),en=c("div"),Ja=N("Publish topic"),xa=c("br"),er=b(),Nl=c("input"),tr=b(),vt&&vt.c(),Ds=b(),bt&&bt.c(),Ls=b(),gt&>.c(),Rs=b(),kt&&kt.c(),Os=b(),hl=c("div"),ss=c("strong"),ss.textContent="User interface",lr=b(),Gn=c("a"),ae(Vn.$$.fragment),nr=b(),mi=c("input"),ir=b(),_i=c("div");for(let q=0;qSave',qs=b(),ae(tn.$$.fragment),Us=b(),ae(ln.$$.fragment),js=b(),ae(nn.$$.fragment),Hs=b(),ae(sn.$$.fragment),a(i,"class","text-sm"),a(u,"href",jt("General-configuration")),a(u,"target","_blank"),a(u,"class","float-right"),a(f,"type","hidden"),a(f,"name","g"),f.value="true",a(P,"name","gh"),a(P,"type","text"),a(P,"class","in-f w-full"),a(P,"pattern","[A-Za-z0-9-]+"),a(y,"name","gt"),a(y,"class","in-l w-full"),t[3].g.t===void 0&&Xe(()=>t[17].call(y)),a(v,"class","flex"),a(_,"class","my-1"),a(B,"type","hidden"),a(B,"name","p"),B.value="true",ce.__value="10YNO-1--------2",ce.value=ce.__value,ie.__value="10YNO-2--------T",ie.value=ie.__value,Q.__value="10YNO-3--------J",Q.value=Q.__value,V.__value="10YNO-4--------9",V.value=V.__value,we.__value="10Y1001A1001A48H",we.value=we.__value,a(ee,"label","Norway"),Ne.__value="10Y1001A1001A44P",Ne.value=Ne.__value,Ge.__value="10Y1001A1001A45N",Ge.value=Ge.__value,Pe.__value="10Y1001A1001A46L",Pe.value=Pe.__value,be.__value="10Y1001A1001A47J",be.value=be.__value,a(Ze,"label","Sweden"),Ee.__value="10YDK-1--------W",Ee.value=Ee.__value,$.__value="10YDK-2--------M",$.value=$.__value,a(Le,"label","Denmark"),w.__value="10YAT-APG------L",w.value=w.__value,M.__value="10YBE----------2",M.value=M.__value,D.__value="10YCZ-CEPS-----N",D.value=D.__value,I.__value="10Y1001A1001A39I",I.value=I.__value,J.__value="10YFI-1--------U",J.value=J.__value,le.__value="10YFR-RTE------C",le.value=le.__value,me.__value="10Y1001A1001A83F",me.value=me.__value,ve.__value="10YGB----------A",ve.value=ve.__value,Te.__value="10YLV-1001A00074",Te.value=Te.__value,De.__value="10YLT-1001A0008Q",De.value=De.__value,fe.__value="10YNL----------L",fe.value=fe.__value,Se.__value="10YPL-AREA-----S",Se.value=Se.__value,He.__value="10YCH-SWISSGRIDZ",He.value=He.__value,a(z,"name","pr"),a(z,"class","in-f w-full"),t[3].p.r===void 0&&Xe(()=>t[18].call(z)),a(K,"class","w-full"),a(Oe,"name","pc"),a(Oe,"class","in-l"),t[3].p.c===void 0&&Xe(()=>t[19].call(Oe)),a(W,"class","flex"),a(H,"class","my-1"),a(_t,"class","my-1"),a($e,"type","checkbox"),a($e,"name","pe"),$e.__value="true",$e.value=$e.__value,a($e,"class","rounded mb-1"),a(Ae,"class","my-1"),Ye.__value=0,Ye.value=Ye.__value,te.__value=1,te.value=te.__value,it.__value=2,it.value=it.__value,a(re,"name","gs"),a(re,"class","in-s"),t[3].g.s===void 0&&Xe(()=>t[22].call(re)),a(ke,"class","my-1"),a(Nt,"name","gc"),a(Nt,"type","text"),a(Nt,"pattern","[A-Za-z0-9]+"),a(Nt,"placeholder","[root]"),a(Nt,"class","in-s"),a(Nt,"maxlength","36"),a(yl,"class","my-1"),a(n,"class","cnt"),a(pn,"class","text-sm"),a(Pl,"href",jt("Meter-configuration")),a(Pl,"target","_blank"),a(Pl,"class","float-right"),a(Wl,"type","hidden"),a(Wl,"name","m"),Wl.value="true",a(zl,"type","hidden"),a(zl,"name","mo"),zl.value="1",Xt.__value=0,Xt.value=Xt.__value,Ll.__value=9,Ll.value=Ll.__value,a(Qt,"name","ma"),a(Qt,"class","in-s"),t[3].m.a===void 0&&Xe(()=>t[26].call(Qt)),a(xe,"class","my-1"),a(Ui,"class","float-right"),a(tl,"name","mi"),tl.__value="true",tl.value=tl.__value,a(tl,"type","checkbox"),a(tl,"class","rounded mb-1"),a(ai,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=ji=t[3].m.b!=0,a(ml,"name","mb"),a(ml,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Xe(()=>t[28].call(ml)),Ol.__value=0,Ol.value=Ol.__value,Ol.disabled=Hi=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,hn.__value=3,hn.value=hn.__value,vn.__value=10,vn.value=vn.__value,bn.__value=11,bn.value=bn.__value,a(St,"name","mp"),a(St,"class","in-m"),St.disabled=Wi=t[3].m.b==0,t[3].m.p===void 0&&Xe(()=>t[29].call(St)),a(Ht,"name","ms"),a(Ht,"type","number"),a(Ht,"min",64),a(Ht,"max",zi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),a(Ht,"step",64),a(Ht,"class","in-l tr w-1/2"),a(Rl,"class","flex w-full"),a(cl,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,a(_l,"name","md"),a(_l,"class","in-s"),t[3].m.d===void 0&&Xe(()=>t[31].call(_l)),a(Vl,"class","my-1"),a(ll,"name","mf"),a(ll,"type","number"),a(ll,"min","5"),a(ll,"max","65535"),a(ll,"class","in-f tr w-full"),a(Gi,"class","in-post"),a(yn,"class","flex"),a(Kl,"class","mx-1"),a(nl,"name","mr"),a(nl,"type","number"),a(nl,"min","0"),a(nl,"max","65535"),a(nl,"class","in-f tr w-full"),a(Vi,"class","in-post"),a(Cn,"class","flex"),a(Yl,"class","mx-1"),a(wn,"class","my-1 flex"),a($s,"class","my-1"),a(il,"type","checkbox"),a(il,"name","me"),il.__value="true",il.value=il.__value,a(il,"class","rounded mb-1"),a(Ql,"class","my-1"),a(sl,"type","checkbox"),a(sl,"name","mm"),sl.__value="true",sl.value=sl.__value,a(sl,"class","rounded mb-1"),a(Qe,"class","cnt"),a(Qi,"class","text-sm"),a(Sn,"href",jt("WiFi-configuration")),a(Sn,"target","_blank"),a(Sn,"class","float-right"),a(ri,"type","hidden"),a(ri,"name","w"),ri.value="true",Tn.__value=1,Tn.value=Tn.__value,$n.__value=2,$n.value=$n.__value,a(Zt,"name","nc"),a(Zt,"class","in-s"),t[3].n.c===void 0&&Xe(()=>t[42].call(Zt)),a(Xl,"class","my-1"),a(Wt,"class","cnt"),a(Xi,"class","text-sm"),a(Nn,"href",jt("Network-configuration")),a(Nn,"target","_blank"),a(Nn,"class","float-right"),An.__value="dhcp",An.value=An.__value,Pn.__value="static",Pn.value=Pn.__value,a(pl,"name","nm"),a(pl,"class","in-f"),t[3].n.m===void 0&&Xe(()=>t[48].call(pl)),a(zt,"name","ni"),a(zt,"type","text"),a(zt,"class","in-m w-full"),zt.disabled=Zi=t[3].n.m=="dhcp",zt.required=Ji=t[3].n.m=="static",a(Gt,"name","ns"),a(Gt,"class","in-l"),Gt.disabled=xi=t[3].n.m=="dhcp",Gt.required=es=t[3].n.m=="static",t[3].n.s===void 0&&Xe(()=>t[50].call(Gt)),a(Fl,"class","flex"),a(Zl,"class","my-1"),a(ol,"name","nd"),ol.__value="true",ol.value=ol.__value,a(ol,"type","checkbox"),a(ol,"class","rounded mb-1"),a(ts,"class","my-1"),a(ui,"type","hidden"),a(ui,"name","ntp"),ui.value="true",a(al,"name","ntpd"),al.__value="true",al.value=al.__value,a(al,"type","checkbox"),a(al,"class","rounded mb-1"),a(fi,"class","ml-4"),a(Cl,"name","ntph"),a(Cl,"type","text"),a(Cl,"class","in-s"),a(ns,"class","flex"),a(Bl,"class","my-1"),a(yt,"class","cnt"),a(is,"class","text-sm"),a(Ln,"href",jt("MQTT-configuration")),a(Ln,"target","_blank"),a(Ln,"class","float-right"),a(ci,"type","hidden"),a(ci,"name","q"),ci.value="true",a(Sl,"name","qh"),a(Sl,"type","text"),a(Sl,"class","in-f w-3/4"),a(rl,"name","qp"),a(rl,"type","number"),a(rl,"min","1024"),a(rl,"max","65535"),a(rl,"class","in-l tr w-1/4"),a(In,"class","flex"),a(dl,"class","my-1"),a(Ml,"name","qu"),a(Ml,"type","text"),a(Ml,"class","in-s"),a(Jl,"class","my-1"),a(Tl,"name","qa"),a(Tl,"type","password"),a(Tl,"class","in-s"),a(xl,"class","my-1"),a($l,"name","qc"),a($l,"type","text"),a($l,"class","in-f w-full"),qn.__value=0,qn.value=qn.__value,Un.__value=1,Un.value=Un.__value,jn.__value=2,jn.value=jn.__value,Hn.__value=3,Hn.value=Hn.__value,Wn.__value=4,Wn.value=Wn.__value,zn.__value=255,zn.value=zn.__value,a(At,"name","qm"),a(At,"class","in-l"),t[3].q.m===void 0&&Xe(()=>t[63].call(At)),a(On,"class","my-1 flex"),a(Nl,"name","qb"),a(Nl,"type","text"),a(Nl,"class","in-s"),a(en,"class","my-1"),a(ut,"class","cnt"),a(ss,"class","text-sm"),a(Gn,"href",jt("User-interface")),a(Gn,"target","_blank"),a(Gn,"class","float-right"),a(mi,"type","hidden"),a(mi,"name","u"),mi.value="true",a(_i,"class","flex flex-wrap"),a(hl,"class","cnt"),a(os,"class","text-sm"),a(Kn,"href","https://amsleser.no/blog/post/24-telnet-debug"),a(Kn,"target","_blank"),a(Kn,"class","float-right"),a(pi,"type","hidden"),a(pi,"name","d"),pi.value="true",a(ul,"type","checkbox"),a(ul,"name","ds"),ul.__value="true",ul.value=ul.__value,a(ul,"class","rounded mb-1"),a(as,"class","mt-3"),a(Vt,"class","cnt"),a(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),a(Qn,"type","button"),a(Qn,"class","btn-red"),a(Xn,"type","button"),a(Xn,"class","btn-yellow"),a(us,"class","text-center"),a(fs,"class","text-right"),a(ql,"class","grid grid-cols-3 mt-3"),a(e,"autocomplete","off")},m(q,pe){S(q,e,pe),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),se(m,u,null),s(n,r),s(n,f),s(n,p),s(n,_),s(_,v),s(v,h),s(h,d),s(h,g),s(h,k),s(h,P),ue(P,t[3].g.h),s(v,T),s(v,E),s(E,R),s(E,j),s(E,O),s(E,y),se(A,y,null),Ce(y,t[3].g.t,!0),s(n,ne),s(n,B),s(n,F),s(n,H),s(H,W),s(W,K),s(K,Y),s(K,x),s(K,G),s(K,z),s(z,ee),s(ee,ce),s(ee,ie),s(ee,Q),s(ee,V),s(ee,we),s(z,Ze),s(Ze,Ne),s(Ze,Ge),s(Ze,Pe),s(Ze,be),s(z,Le),s(Le,Ee),s(Le,$),s(z,w),s(z,M),s(z,D),s(z,I),s(z,J),s(z,le),s(z,me),s(z,ve),s(z,Te),s(z,De),s(z,fe),s(z,Se),s(z,He),Ce(z,t[3].p.r,!0),s(W,ct),s(W,Ve),s(Ve,rt),s(Ve,We),s(Ve,mt),s(Ve,Oe);for(let Ct=0;Ct<5;Ct+=1)di[Ct]&&di[Ct].m(Oe,null);Ce(Oe,t[3].p.c,!0),s(n,$t),s(n,_t),se(dt,_t,null),s(n,et),s(n,Ae),s(Ae,tt),s(tt,$e),$e.checked=t[3].p.e,s(tt,Je),s(Ae,ot),Pt&&Pt.m(Ae,null),s(n,Re),s(n,ke),s(ke,de),s(ke,_e),s(ke,ze),s(ke,re),s(re,Ye),s(re,te),s(re,it),Ce(re,t[3].g.s,!0),s(n,Ai),Dt&&Dt.m(n,null),s(n,oi),s(n,yl),s(yl,Pi),s(yl,Di),s(yl,Li),s(yl,Nt),ue(Nt,t[3].g.c),s(l,Ri),s(l,Qe),s(Qe,pn),s(Qe,Ii),s(Qe,Pl),se(Dl,Pl,null),s(Qe,Oi),s(Qe,Wl),s(Qe,Fi),s(Qe,zl),s(Qe,Bi),s(Qe,xe),s(xe,Et),s(xe,Gl),s(xe,Ms),s(xe,Qt),s(Qt,Xt),s(Qt,Ll),Ce(Qt,t[3].m.a,!0),s(Qe,qi),s(Qe,cl),s(cl,Ui),s(cl,No),s(cl,Ts),s(cl,Eo),s(cl,ai),s(ai,tl),tl.checked=t[3].m.i,s(ai,Ao),s(cl,Po),s(cl,Rl),s(Rl,ml),s(ml,Il),s(Il,Do);for(let Ct=0;Ct<7;Ct+=1)hi[Ct]&&hi[Ct].m(ml,null);Ce(ml,t[3].m.b,!0),s(Rl,Lo),s(Rl,St),s(St,Ol),s(Ol,Ro),s(St,dn),s(St,hn),s(St,vn),s(St,bn),Ce(St,t[3].m.p,!0),s(Rl,Io),s(Rl,Ht),ue(Ht,t[3].m.s),s(Qe,Oo),s(Qe,Vl),s(Vl,Fo),s(Vl,Bo),s(Vl,qo),s(Vl,_l),s(_l,gn),s(_l,kn),Ce(_l,t[3].m.d,!0),s(Qe,Uo),s(Qe,wn),s(wn,Kl),s(Kl,jo),s(Kl,Ho),s(Kl,Wo),s(Kl,yn),s(yn,ll),ue(ll,t[3].m.f),s(yn,zo),s(yn,Gi),s(wn,Go),s(wn,Yl),s(Yl,Vo),s(Yl,Ko),s(Yl,Yo),s(Yl,Cn),s(Cn,nl),ue(nl,t[3].m.r),s(Cn,Qo),s(Cn,Vi),s(Qe,Xo),s(Qe,$s),s(Qe,Zo),s(Qe,Ql),s(Ql,Ki),s(Ki,il),il.checked=t[3].m.e.e,s(Ki,Jo),s(Ql,xo),Lt&&Lt.m(Ql,null),s(Qe,ea),Rt&&Rt.m(Qe,null),s(Qe,Ns),s(Qe,Yi),s(Yi,sl),sl.checked=t[3].m.m.e,s(Yi,ta),s(Qe,la),It&&It.m(Qe,null),s(l,na),s(l,Wt),s(Wt,Qi),s(Wt,ia),s(Wt,Sn),se(Mn,Sn,null),s(Wt,sa),s(Wt,ri),s(Wt,oa),s(Wt,Xl),s(Xl,aa),s(Xl,ra),s(Xl,ua),s(Xl,Zt),s(Zt,Tn),s(Zt,$n),Kt&&Kt.m(Zt,null),Ce(Zt,t[3].n.c,!0),s(Wt,fa),Ot&&Ot.m(Wt,null),s(l,ca),s(l,yt),s(yt,Xi),s(yt,ma),s(yt,Nn),se(En,Nn,null),s(yt,_a),s(yt,Zl),s(Zl,pa),s(Zl,da),s(Zl,ha),s(Zl,Fl),s(Fl,pl),s(pl,An),s(pl,Pn),Ce(pl,t[3].n.m,!0),s(Fl,va),s(Fl,zt),ue(zt,t[3].n.i),s(Fl,ba),s(Fl,Gt),se(Dn,Gt,null),Ce(Gt,t[3].n.s,!0),s(yt,ga),Ft&&Ft.m(yt,null),s(yt,Es),s(yt,ts),s(ts,ls),s(ls,ol),ol.checked=t[3].n.d,s(ls,ka),s(yt,wa),s(yt,ui),s(yt,ya),s(yt,Bl),s(Bl,Ca),s(Bl,fi),s(fi,al),al.checked=t[3].n.h,s(fi,Sa),s(Bl,Ma),s(Bl,Ta),s(Bl,ns),s(ns,Cl),ue(Cl,t[3].n.n1),s(l,$a),s(l,ut),s(ut,is),s(ut,Na),s(ut,Ln),se(Rn,Ln,null),s(ut,Ea),s(ut,ci),s(ut,Aa),s(ut,dl),s(dl,Pa),Bt&&Bt.m(dl,null),s(dl,As),s(dl,Da),s(dl,La),s(dl,In),s(In,Sl),ue(Sl,t[3].q.h),s(In,Ra),s(In,rl),ue(rl,t[3].q.p),s(ut,Ia),ht&&ht.m(ut,null),s(ut,Ps),s(ut,Jl),s(Jl,Oa),s(Jl,Fa),s(Jl,Ba),s(Jl,Ml),ue(Ml,t[3].q.u),s(ut,qa),s(ut,xl),s(xl,Ua),s(xl,ja),s(xl,Ha),s(xl,Tl),ue(Tl,t[3].q.a),s(ut,Wa),s(ut,On),s(On,Fn),s(Fn,za),s(Fn,Ga),s(Fn,Va),s(Fn,$l),ue($l,t[3].q.c),s(On,Ka),s(On,Bn),s(Bn,Ya),s(Bn,Qa),s(Bn,Xa),s(Bn,At),s(At,qn),s(At,Un),s(At,jn),s(At,Hn),s(At,Wn),s(At,zn),Ce(At,t[3].q.m,!0),s(ut,Za),s(ut,en),s(en,Ja),s(en,xa),s(en,er),s(en,Nl),ue(Nl,t[3].q.b),s(l,tr),vt&&vt.m(l,null),s(l,Ds),bt&&bt.m(l,null),s(l,Ls),gt&>.m(l,null),s(l,Rs),kt&&kt.m(l,null),s(l,Os),s(l,hl),s(hl,ss),s(hl,lr),s(hl,Gn),se(Vn,Gn,null),s(hl,nr),s(hl,mi),s(hl,ir),s(hl,_i);for(let Ct=0;Ct0?Dt?Dt.p(q,pe):(Dt=of(q),Dt.c(),Dt.m(n,oi)):Dt&&(Dt.d(1),Dt=null),pe[0]&8&&Nt.value!==q[3].g.c&&ue(Nt,q[3].g.c),pe[0]&8&&Ce(Qt,q[3].m.a),pe[0]&8&&(tl.checked=q[3].m.i),(!Jt||pe[0]&8&&ji!==(ji=q[3].m.b!=0))&&(Il.disabled=ji),pe[0]&8&&Ce(ml,q[3].m.b),(!Jt||pe[0]&8&&Hi!==(Hi=q[3].m.b!=0))&&(Ol.disabled=Hi),(!Jt||pe[0]&8&&Wi!==(Wi=q[3].m.b==0))&&(St.disabled=Wi),pe[0]&8&&Ce(St,q[3].m.p),(!Jt||pe[0]&9&&zi!==(zi=q[0].chip=="esp8266"?q[3].i.h.p==3||q[3].i.h.p==113?512:128:4096))&&a(Ht,"max",zi),pe[0]&8&&ye(Ht.value)!==q[3].m.s&&ue(Ht,q[3].m.s),pe[0]&8&&Ce(_l,q[3].m.d),pe[0]&8&&ye(ll.value)!==q[3].m.f&&ue(ll,q[3].m.f),pe[0]&8&&ye(nl.value)!==q[3].m.r&&ue(nl,q[3].m.r),pe[0]&8&&(il.checked=q[3].m.e.e),q[3].m.e.e?Lt?Lt.p(q,pe):(Lt=af(q),Lt.c(),Lt.m(Ql,null)):Lt&&(Lt.d(1),Lt=null),q[3].m.e.e?Rt?Rt.p(q,pe):(Rt=rf(q),Rt.c(),Rt.m(Qe,Ns)):Rt&&(Rt.d(1),Rt=null),pe[0]&8&&(sl.checked=q[3].m.m.e),q[3].m.m.e?It?It.p(q,pe):(It=uf(q),It.c(),It.m(Qe,null)):It&&(It.d(1),It=null),q[0].if&&q[0].if.eth?Kt||(Kt=ff(),Kt.c(),Kt.m(Zt,null)):Kt&&(Kt.d(1),Kt=null),pe[0]&8&&Ce(Zt,q[3].n.c),q[3].n.c==1||q[3].n.c==2?Ot?Ot.p(q,pe):(Ot=cf(q),Ot.c(),Ot.m(Wt,null)):Ot&&(Ot.d(1),Ot=null),pe[0]&8&&Ce(pl,q[3].n.m),(!Jt||pe[0]&8&&Zi!==(Zi=q[3].n.m=="dhcp"))&&(zt.disabled=Zi),(!Jt||pe[0]&8&&Ji!==(Ji=q[3].n.m=="static"))&&(zt.required=Ji),pe[0]&8&&zt.value!==q[3].n.i&&ue(zt,q[3].n.i),(!Jt||pe[0]&8&&xi!==(xi=q[3].n.m=="dhcp"))&&(Gt.disabled=xi),(!Jt||pe[0]&8&&es!==(es=q[3].n.m=="static"))&&(Gt.required=es),pe[0]&8&&Ce(Gt,q[3].n.s),q[3].n.m=="static"?Ft?Ft.p(q,pe):(Ft=mf(q),Ft.c(),Ft.m(yt,Es)):Ft&&(Ft.d(1),Ft=null),pe[0]&8&&(ol.checked=q[3].n.d),pe[0]&8&&(al.checked=q[3].n.h),pe[0]&8&&Cl.value!==q[3].n.n1&&ue(Cl,q[3].n.n1),q[0].chip!="esp8266"?Bt?Bt.p(q,pe):(Bt=_f(q),Bt.c(),Bt.m(dl,As)):Bt&&(Bt.d(1),Bt=null),pe[0]&8&&Sl.value!==q[3].q.h&&ue(Sl,q[3].q.h),pe[0]&8&&ye(rl.value)!==q[3].q.p&&ue(rl,q[3].q.p),q[3].q.s.e?ht?(ht.p(q,pe),pe[0]&8&&L(ht,1)):(ht=pf(q),ht.c(),L(ht,1),ht.m(ut,Ps)):ht&&(Fe(),U(ht,1,1,()=>{ht=null}),Be()),pe[0]&8&&Ml.value!==q[3].q.u&&ue(Ml,q[3].q.u),pe[0]&8&&Tl.value!==q[3].q.a&&ue(Tl,q[3].q.a),pe[0]&8&&$l.value!==q[3].q.c&&ue($l,q[3].q.c),pe[0]&8&&Ce(At,q[3].q.m),pe[0]&8&&Nl.value!==q[3].q.b&&ue(Nl,q[3].q.b),q[3].q.m==3?vt?(vt.p(q,pe),pe[0]&8&&L(vt,1)):(vt=df(q),vt.c(),L(vt,1),vt.m(l,Ds)):vt&&(Fe(),U(vt,1,1,()=>{vt=null}),Be()),q[3].q.m==4?bt?(bt.p(q,pe),pe[0]&8&&L(bt,1)):(bt=hf(q),bt.c(),L(bt,1),bt.m(l,Ls)):bt&&(Fe(),U(bt,1,1,()=>{bt=null}),Be()),q[3].c.es!=null?gt?(gt.p(q,pe),pe[0]&8&&L(gt,1)):(gt=vf(q),gt.c(),L(gt,1),gt.m(l,Rs)):gt&&(Fe(),U(gt,1,1,()=>{gt=null}),Be()),pe[0]&8&&(Is=q[3].p.r.startsWith("10YNO")||q[3].p.r.startsWith("10Y1001A1001A4")),Is?kt?(kt.p(q,pe),pe[0]&8&&L(kt,1)):(kt=kf(q),kt.c(),L(kt,1),kt.m(l,Os)):kt&&(Fe(),U(kt,1,1,()=>{kt=null}),Be()),pe[0]&136){Zn=q[7];let xt;for(xt=0;xt20||q[0].chip=="esp8266"||q[3].i.d.d>0?wt?(wt.p(q,pe),pe[0]&9&&L(wt,1)):(wt=Cf(q),wt.c(),L(wt,1),wt.m(l,Fs)):wt&&(Fe(),U(wt,1,1,()=>{wt=null}),Be()),pe[0]&8&&(ul.checked=q[3].d.s),q[3].d.s?qt?qt.p(q,pe):(qt=Af(q),qt.c(),qt.m(Vt,null)):qt&&(qt.d(1),qt=null);const dr={};pe[0]&2&&(dr.active=q[1]),tn.$set(dr);const hr={};pe[0]&4&&(hr.active=q[2]),ln.$set(hr);const vr={};pe[0]&16&&(vr.active=q[4]),nn.$set(vr);const br={};pe[0]&32&&(br.active=q[5]),sn.$set(br)},i(q){Jt||(L(m.$$.fragment,q),L(A.$$.fragment,q),L(dt.$$.fragment,q),L(Dl.$$.fragment,q),L(Mn.$$.fragment,q),L(En.$$.fragment,q),L(Dn.$$.fragment,q),L(Rn.$$.fragment,q),L(ht),L(vt),L(bt),L(gt),L(kt),L(Vn.$$.fragment,q),L(wt),L(Yn.$$.fragment,q),L(tn.$$.fragment,q),L(ln.$$.fragment,q),L(nn.$$.fragment,q),L(sn.$$.fragment,q),Jt=!0)},o(q){U(m.$$.fragment,q),U(A.$$.fragment,q),U(dt.$$.fragment,q),U(Dl.$$.fragment,q),U(Mn.$$.fragment,q),U(En.$$.fragment,q),U(Dn.$$.fragment,q),U(Rn.$$.fragment,q),U(ht),U(vt),U(bt),U(gt),U(kt),U(Vn.$$.fragment,q),U(wt),U(Yn.$$.fragment,q),U(tn.$$.fragment,q),U(ln.$$.fragment,q),U(nn.$$.fragment,q),U(sn.$$.fragment,q),Jt=!1},d(q){q&&C(e),oe(m),oe(A),ft(di,q),oe(dt),Pt&&Pt.d(),Dt&&Dt.d(),oe(Dl),ft(hi,q),Lt&&Lt.d(),Rt&&Rt.d(),It&&It.d(),oe(Mn),Kt&&Kt.d(),Ot&&Ot.d(),oe(En),oe(Dn),Ft&&Ft.d(),oe(Rn),Bt&&Bt.d(),ht&&ht.d(),vt&&vt.d(),bt&&bt.d(),gt&>.d(),kt&&kt.d(),oe(Vn),ft(Mt,q),wt&&wt.d(),oe(Yn),qt&&qt.d(),q&&C(qs),oe(tn,q),q&&C(Us),oe(ln,q),q&&C(js),oe(nn,q),q&&C(Hs),oe(sn,q),Ws=!1,lt(pr)}}}async function z_(){await(await fetch("reboot",{method:"POST"})).json()}function G_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],u=!0,m=!1,r={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},d:{d:null,b:0},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{e:!1,i:null,es:null}};gi.subscribe(xe=>{xe.version&&(l(3,r=xe),l(1,u=!1))}),r_();let f=!1,p=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,f=!0);const xe=new URLSearchParams;xe.append("perform","true");let Gl=await(await fetch("reset",{method:"POST",body:xe})).json();l(4,f=!1),l(5,p=Gl.success)}}async function v(xe){l(2,m=!0);const Et=new FormData(xe.target),Gl=new URLSearchParams;for(let Xt of Et){const[Ll,qi]=Xt;Gl.append(Ll,qi)}let Qt=await(await fetch("save",{method:"POST",body:Gl})).json();Yt.update(Xt=>(Xt.booting=Qt.reboot,Xt.ui=r.u,Xt)),l(2,m=!1),cn(n)}const h=function(){confirm("Are you sure you want to reboot the device?")&&(Yt.update(xe=>(xe.booting=!0,xe)),z_())};async function d(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),gi.update(Et=>(Et.q.s.c=!1,Et)))}async function g(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),gi.update(Et=>(Et.q.s.r=!1,Et)))}async function k(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),gi.update(Et=>(Et.q.s.k=!1,Et)))}const P=function(){r.q.s.e?r.q.p==1883&&l(3,r.q.p=8883,r):r.q.p==8883&&l(3,r.q.p=1883,r)};let T=44;function E(){r.g.h=this.value,l(3,r)}function R(){r.g.t=st(this),l(3,r)}function j(){r.p.r=st(this),l(3,r)}function O(){r.p.c=st(this),l(3,r)}function y(){r.p.e=this.checked,l(3,r)}function A(){r.p.t=this.value,l(3,r)}function ne(){r.g.s=st(this),l(3,r)}function B(){r.g.u=this.value,l(3,r)}function F(){r.g.p=this.value,l(3,r)}function H(){r.g.c=this.value,l(3,r)}function W(){r.m.a=st(this),l(3,r)}function K(){r.m.i=this.checked,l(3,r)}function Y(){r.m.b=st(this),l(3,r)}function x(){r.m.p=st(this),l(3,r)}function G(){r.m.s=ye(this.value),l(3,r)}function z(){r.m.d=st(this),l(3,r)}function ee(){r.m.f=ye(this.value),l(3,r)}function ce(){r.m.r=ye(this.value),l(3,r)}function ie(){r.m.e.e=this.checked,l(3,r)}function Q(){r.m.e.k=this.value,l(3,r)}function V(){r.m.e.a=this.value,l(3,r)}function we(){r.m.m.e=this.checked,l(3,r)}function Ze(){r.m.m.w=ye(this.value),l(3,r)}function Ne(){r.m.m.v=ye(this.value),l(3,r)}function Ge(){r.m.m.a=ye(this.value),l(3,r)}function Pe(){r.m.m.c=ye(this.value),l(3,r)}function be(){r.n.c=st(this),l(3,r)}function Le(){r.w.s=this.value,l(3,r)}function Ee(){r.w.p=this.value,l(3,r)}function $(){r.w.z=st(this),l(3,r)}function w(){r.w.w=ye(this.value),l(3,r)}function M(){r.w.b=this.checked,l(3,r)}function D(){r.n.m=st(this),l(3,r)}function I(){r.n.i=this.value,l(3,r)}function J(){r.n.s=st(this),l(3,r)}function le(){r.n.g=this.value,l(3,r)}function me(){r.n.d1=this.value,l(3,r)}function ve(){r.n.d2=this.value,l(3,r)}function Te(){r.n.d=this.checked,l(3,r)}function De(){r.n.h=this.checked,l(3,r)}function fe(){r.n.n1=this.value,l(3,r)}function Se(){r.q.s.e=this.checked,l(3,r)}function He(){r.q.h=this.value,l(3,r)}function ct(){r.q.p=ye(this.value),l(3,r)}function Ve(){r.q.u=this.value,l(3,r)}function rt(){r.q.a=this.value,l(3,r)}function We(){r.q.c=this.value,l(3,r)}function mt(){r.q.m=st(this),l(3,r)}function Oe(){r.q.b=this.value,l(3,r)}function $t(){r.o.e=this.value,l(3,r)}function _t(){r.o.c=this.value,l(3,r)}function dt(){r.o.u1=this.value,l(3,r)}function et(){r.o.u2=this.value,l(3,r)}function Ae(){r.o.u3=this.value,l(3,r)}function tt(){r.h.t=this.value,l(3,r)}function $e(){r.h.h=this.value,l(3,r)}function Je(){r.h.n=this.value,l(3,r)}function ot(){r.c.e=this.checked,l(3,r)}function Re(){r.c.es=this.checked,l(3,r)}function ke(xe){r.t.t[xe]=ye(this.value),l(3,r)}function de(){r.t.h=ye(this.value),l(3,r)}function _e(xe){r.u[xe.key]=st(this),l(3,r)}function ze(){r.i.h.p=st(this),l(3,r)}function re(){r.i.h.t=st(this),l(3,r)}function Ye(){r.i.h.u=this.checked,l(3,r)}function te(){r.i.a=ye(this.value),l(3,r)}function it(){r.i.l.p=ye(this.value),l(3,r)}function Ai(){r.i.l.i=this.checked,l(3,r)}function oi(){r.i.r.i=this.checked,l(3,r)}function yl(){r.i.r.r=ye(this.value),l(3,r)}function Pi(){r.i.r.g=ye(this.value),l(3,r)}function Di(){r.i.r.b=ye(this.value),l(3,r)}function Li(){r.i.d.d=ye(this.value),l(3,r)}function Nt(){r.i.t.d=ye(this.value),l(3,r)}function Ri(){r.i.t.a=ye(this.value),l(3,r)}function Qe(){r.i.v.p=ye(this.value),l(3,r)}function pn(){r.i.v.d.v=ye(this.value),l(3,r)}function Ii(){r.i.v.d.g=ye(this.value),l(3,r)}function Pl(){r.i.d.b=st(this),l(3,r)}function Dl(){r.i.v.o=ye(this.value),l(3,r)}function Oi(){r.i.v.m=ye(this.value),l(3,r)}function Wl(){r.i.v.b=ye(this.value),l(3,r)}function Fi(){r.d.s=this.checked,l(3,r)}function zl(){r.d.t=this.checked,l(3,r)}function Bi(){r.d.l=st(this),l(3,r)}return t.$$set=xe=>{"basepath"in xe&&l(15,n=xe.basepath),"sysinfo"in xe&&l(0,i=xe.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,T=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,u,m,r,f,p,T,o,_,v,h,d,g,k,P,n,E,R,j,O,y,A,ne,B,F,H,W,K,Y,x,G,z,ee,ce,ie,Q,V,we,Ze,Ne,Ge,Pe,be,Le,Ee,$,w,M,D,I,J,le,me,ve,Te,De,fe,Se,He,ct,Ve,rt,We,mt,Oe,$t,_t,dt,et,Ae,tt,$e,Je,ot,Re,ke,de,_e,ze,re,Ye,te,it,Ai,oi,yl,Pi,Di,Li,Nt,Ri,Qe,pn,Ii,Pl,Dl,Oi,Wl,Fi,zl,Bi]}class V_ extends je{constructor(e){super(),Ue(this,e,G_,W_,Ie,{basepath:15,sysinfo:0},null,[-1,-1,-1,-1])}}function Df(t,e,l){const n=t.slice();return n[20]=e[l],n}function K_(t){let e=ge(t[1].chip,t[1].board)+"",l;return{c(){l=N(e)},m(n,i){S(n,l,i)},p(n,i){i&2&&e!==(e=ge(n[1].chip,n[1].board)+"")&&Z(l,e)},d(n){n&&C(l)}}}function Lf(t){let e,l,n=t[1].apmac+"",i,o,u,m,r,f,p,_,v,h=Fr(t[1])+"",d,g,k=t[1].boot_reason+"",P,T,E=t[1].ex_cause+"",R,j,O;const y=[Q_,Y_],A=[];function ne(B,F){return B[0].u>0?0:1}return r=ne(t),f=A[r]=y[r](t),{c(){e=c("div"),l=N("AP MAC: "),i=N(n),o=b(),u=c("div"),m=N(`Last boot: + `),f.c(),p=b(),_=c("div"),v=N("Reason: "),d=N(h),g=N(" ("),P=N(k),T=N("/"),R=N(E),j=N(")"),a(e,"class","my-2"),a(u,"class","my-2"),a(_,"class","my-2")},m(B,F){S(B,e,F),s(e,l),s(e,i),S(B,o,F),S(B,u,F),s(u,m),A[r].m(u,null),S(B,p,F),S(B,_,F),s(_,v),s(_,d),s(_,g),s(_,P),s(_,T),s(_,R),s(_,j),O=!0},p(B,F){(!O||F&2)&&n!==(n=B[1].apmac+"")&&Z(i,n);let H=r;r=ne(B),r===H?A[r].p(B,F):(Fe(),U(A[H],1,1,()=>{A[H]=null}),Be(),f=A[r],f?f.p(B,F):(f=A[r]=y[r](B),f.c()),L(f,1),f.m(u,null)),(!O||F&2)&&h!==(h=Fr(B[1])+"")&&Z(d,h),(!O||F&2)&&k!==(k=B[1].boot_reason+"")&&Z(P,k),(!O||F&2)&&E!==(E=B[1].ex_cause+"")&&Z(R,E)},i(B){O||(L(f),O=!0)},o(B){U(f),O=!1},d(B){B&&C(e),B&&C(o),B&&C(u),A[r].d(),B&&C(p),B&&C(_)}}}function Y_(t){let e;return{c(){e=N("-")},m(l,n){S(l,e,n)},p:he,i:he,o:he,d(l){l&&C(e)}}}function Q_(t){let e,l;return e=new f1({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function X_(t){let e;return{c(){e=c("span"),e.textContent="Update consents",a(e,"class","btn-pri-sm")},m(l,n){S(l,e,n)},p:he,d(l){l&&C(e)}}}function Rf(t){let e,l,n,i,o,u=ws(t[1].meter.mfg)+"",m,r,f,p,_=(t[1].meter.model?t[1].meter.model:"unknown")+"",v,h,d,g,k=(t[1].meter.id?t[1].meter.id:"unknown")+"",P;return{c(){e=c("div"),l=c("strong"),l.textContent="Meter",n=b(),i=c("div"),o=N("Manufacturer: "),m=N(u),r=b(),f=c("div"),p=N("Model: "),v=N(_),h=b(),d=c("div"),g=N("ID: "),P=N(k),a(l,"class","text-sm"),a(i,"class","my-2"),a(f,"class","my-2"),a(d,"class","my-2"),a(e,"class","cnt")},m(T,E){S(T,e,E),s(e,l),s(e,n),s(e,i),s(i,o),s(i,m),s(e,r),s(e,f),s(f,p),s(f,v),s(e,h),s(e,d),s(d,g),s(d,P)},p(T,E){E&2&&u!==(u=ws(T[1].meter.mfg)+"")&&Z(m,u),E&2&&_!==(_=(T[1].meter.model?T[1].meter.model:"unknown")+"")&&Z(v,_),E&2&&k!==(k=(T[1].meter.id?T[1].meter.id:"unknown")+"")&&Z(P,k)},d(T){T&&C(e)}}}function If(t){let e,l,n,i,o,u=t[1].net.ip+"",m,r,f,p,_=t[1].net.mask+"",v,h,d,g,k=t[1].net.gw+"",P,T,E,R,j=t[1].net.dns1+"",O,y,A=t[1].net.dns2&&Of(t);return{c(){e=c("div"),l=c("strong"),l.textContent="Network",n=b(),i=c("div"),o=N("IP: "),m=N(u),r=b(),f=c("div"),p=N("Mask: "),v=N(_),h=b(),d=c("div"),g=N("Gateway: "),P=N(k),T=b(),E=c("div"),R=N("DNS: "),O=N(j),y=b(),A&&A.c(),a(l,"class","text-sm"),a(i,"class","my-2"),a(f,"class","my-2"),a(d,"class","my-2"),a(E,"class","my-2"),a(e,"class","cnt")},m(ne,B){S(ne,e,B),s(e,l),s(e,n),s(e,i),s(i,o),s(i,m),s(e,r),s(e,f),s(f,p),s(f,v),s(e,h),s(e,d),s(d,g),s(d,P),s(e,T),s(e,E),s(E,R),s(E,O),s(E,y),A&&A.m(E,null)},p(ne,B){B&2&&u!==(u=ne[1].net.ip+"")&&Z(m,u),B&2&&_!==(_=ne[1].net.mask+"")&&Z(v,_),B&2&&k!==(k=ne[1].net.gw+"")&&Z(P,k),B&2&&j!==(j=ne[1].net.dns1+"")&&Z(O,j),ne[1].net.dns2?A?A.p(ne,B):(A=Of(ne),A.c(),A.m(E,null)):A&&(A.d(1),A=null)},d(ne){ne&&C(e),A&&A.d()}}}function Of(t){let e,l=t[1].net.dns2+"",n;return{c(){e=N("/ "),n=N(l)},m(i,o){S(i,e,o),S(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&Z(n,l)},d(i){i&&C(e),i&&C(n)}}}function Ff(t){let e,l,n,i=t[1].upgrade.f+"",o,u,m=t[1].upgrade.t+"",r,f,p=Or(t[1].upgrade.e)+"",_;return{c(){e=c("div"),l=c("div"),n=N("Previous upgrade attempt from "),o=N(i),u=N(" to "),r=N(m),f=N(" failed. "),_=N(p),a(l,"class","bd-yellow"),a(e,"class","my-2")},m(v,h){S(v,e,h),s(e,l),s(l,n),s(l,o),s(l,u),s(l,r),s(l,f),s(l,_)},p(v,h){h&2&&i!==(i=v[1].upgrade.f+"")&&Z(o,i),h&2&&m!==(m=v[1].upgrade.t+"")&&Z(r,m),h&2&&p!==(p=Or(v[1].upgrade.e)+"")&&Z(_,p)},d(v){v&&C(e)}}}function Bf(t){let e,l,n,i=t[2].tag_name+"",o,u,m,r,f,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&qf(t),v=t[1].fwconsent===2&&Uf();return{c(){e=c("div"),l=N(`Latest version: + `),n=c("a"),o=N(i),m=b(),_&&_.c(),r=b(),v&&v.c(),f=nt(),a(n,"href",u=t[2].html_url),a(n,"class","ml-2 text-blue-600 hover:text-blue-800"),a(n,"target","_blank"),a(n,"rel","noreferrer"),a(e,"class","my-2 flex")},m(h,d){S(h,e,d),s(e,l),s(e,n),s(n,o),s(e,m),_&&_.m(e,null),S(h,r,d),v&&v.m(h,d),S(h,f,d),p=!0},p(h,d){(!p||d&4)&&i!==(i=h[2].tag_name+"")&&Z(o,i),(!p||d&4&&u!==(u=h[2].html_url))&&a(n,"href",u),(h[1].security==0||h[0].a)&&h[1].fwconsent===1&&h[2]&&h[2].tag_name!=h[1].version?_?(_.p(h,d),d&7&&L(_,1)):(_=qf(h),_.c(),L(_,1),_.m(e,null)):_&&(Fe(),U(_,1,1,()=>{_=null}),Be()),h[1].fwconsent===2?v||(v=Uf(),v.c(),v.m(f.parentNode,f)):v&&(v.d(1),v=null)},i(h){p||(L(_),p=!0)},o(h){U(_),p=!1},d(h){h&&C(e),_&&_.d(),h&&C(r),v&&v.d(h),h&&C(f)}}}function qf(t){let e,l,n,i,o,u;return n=new c1({}),{c(){e=c("div"),l=c("button"),ae(n.$$.fragment),a(e,"class","flex-none ml-2 text-green-500"),a(e,"title","Install this version")},m(m,r){S(m,e,r),s(e,l),se(n,l,null),i=!0,o||(u=X(l,"click",t[10]),o=!0)},p:he,i(m){i||(L(n.$$.fragment,m),i=!0)},o(m){U(n.$$.fragment,m),i=!1},d(m){m&&C(e),oe(n),o=!1,u()}}}function Uf(t){let e;return{c(){e=c("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',a(e,"class","my-2")},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function jf(t){let e,l=ys(ge(t[1].chip,t[1].board))+"",n;return{c(){e=c("div"),n=N(l),a(e,"class","bd-red")},m(i,o){S(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=ys(ge(i[1].chip,i[1].board))+"")&&Z(n,l)},d(i){i&&C(e)}}}function Hf(t){let e,l,n,i,o,u;function m(p,_){return p[4].length==0?J_:Z_}let r=m(t),f=r(t);return{c(){e=c("div"),l=c("form"),n=c("input"),i=b(),f.c(),ki(n,"display","none"),a(n,"name","file"),a(n,"type","file"),a(n,"accept",".bin"),a(l,"action","/firmware"),a(l,"enctype","multipart/form-data"),a(l,"method","post"),a(l,"autocomplete","off"),a(e,"class","my-2 flex")},m(p,_){S(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(u=[X(n,"change",t[13]),X(l,"submit",t[15])],o=!0)},p(p,_){r===(r=m(p))&&f?f.p(p,_):(f.d(1),f=r(p),f&&(f.c(),f.m(l,null)))},d(p){p&&C(e),t[12](null),f.d(),o=!1,lt(u)}}}function Z_(t){let e=t[4][0].name+"",l,n,i;return{c(){l=N(e),n=b(),i=c("button"),i.textContent="Upload",a(i,"type","submit"),a(i,"class","btn-pri-sm float-right")},m(o,u){S(o,l,u),S(o,n,u),S(o,i,u)},p(o,u){u&16&&e!==(e=o[4][0].name+"")&&Z(l,e)},d(o){o&&C(l),o&&C(n),o&&C(i)}}}function J_(t){let e,l,n;return{c(){e=c("button"),e.textContent="Select firmware file for upgrade",a(e,"type","button"),a(e,"class","btn-pri-sm float-right")},m(i,o){S(i,e,o),l||(n=X(e,"click",t[14]),l=!0)},p:he,d(i){i&&C(e),l=!1,n()}}}function Wf(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g=t[9],k=[];for(let j=0;j Include Secrets
(SSID, PSK, passwords and tokens)',r=b(),P&&P.c(),f=b(),p=c("form"),_=c("input"),v=b(),R.c(),a(l,"class","text-sm"),a(m,"class","my-1 mx-3 col-span-2"),a(o,"class","grid grid-cols-2"),a(i,"method","get"),a(i,"action","/configfile.cfg"),a(i,"autocomplete","off"),ki(_,"display","none"),a(_,"name","file"),a(_,"type","file"),a(_,"accept",".cfg"),a(p,"action","/configfile"),a(p,"enctype","multipart/form-data"),a(p,"method","post"),a(p,"autocomplete","off"),a(e,"class","cnt")},m(j,O){S(j,e,O),s(e,l),s(e,n),s(e,i),s(i,o);for(let y=0;y{D=null}),Be());const ct={};Se&8388608&&(ct.$$scope={dirty:Se,ctx:fe}),ne.$set(ct),fe[1].meter?I?I.p(fe,Se):(I=Rf(fe),I.c(),I.m(e,W)):I&&(I.d(1),I=null),fe[1].net?J?J.p(fe,Se):(J=If(fe),J.c(),J.m(e,K)):J&&(J.d(1),J=null),(!$||Se&2)&&ce!==(ce=fe[1].version+"")&&Z(ie,ce),fe[1].upgrade.t&&fe[1].upgrade.t!=fe[1].version?le?le.p(fe,Se):(le=Ff(fe),le.c(),le.m(Y,V)):le&&(le.d(1),le=null),fe[2]?me?(me.p(fe,Se),Se&4&&L(me,1)):(me=Bf(fe),me.c(),L(me,1),me.m(Y,we)):me&&(Fe(),U(me,1,1,()=>{me=null}),Be()),Se&3&&(Ze=(fe[1].security==0||fe[0].a)&&li(fe[1].board)),Ze?ve?ve.p(fe,Se):(ve=jf(fe),ve.c(),ve.m(Y,Ne)):ve&&(ve.d(1),ve=null),fe[1].security==0||fe[0].a?Te?Te.p(fe,Se):(Te=Hf(fe),Te.c(),Te.m(Y,null)):Te&&(Te.d(1),Te=null),fe[1].security==0||fe[0].a?De?De.p(fe,Se):(De=Wf(fe),De.c(),De.m(e,null)):De&&(De.d(1),De=null);const Ve={};Se&32&&(Ve.active=fe[5]),be.$set(Ve);const rt={};Se&256&&(rt.active=fe[8]),Ee.$set(rt)},i(fe){$||(L(k.$$.fragment,fe),L(D),L(ne.$$.fragment,fe),L(me),L(be.$$.fragment,fe),L(Ee.$$.fragment,fe),$=!0)},o(fe){U(k.$$.fragment,fe),U(D),U(ne.$$.fragment,fe),U(me),U(be.$$.fragment,fe),U(Ee.$$.fragment,fe),$=!1},d(fe){fe&&C(e),oe(k),D&&D.d(),oe(ne),I&&I.d(),J&&J.d(),le&&le.d(),me&&me.d(),ve&&ve.d(),Te&&Te.d(),De&&De.d(),fe&&C(Pe),oe(be,fe),fe&&C(Le),oe(Ee,fe),w=!1,M()}}}async function lp(){await(await fetch("reboot",{method:"POST"})).json()}function np(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],u={};To.subscribe(y=>{l(2,u=u1(i.version,y)),u||l(2,u=y[0])});function m(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(ys(ge(i.chip,i.board))))&&(Yt.update(y=>(y.upgrading=!0,y)),r1(u.tag_name))}const r=function(){confirm("Are you sure you want to reboot the device?")&&(Yt.update(y=>(y.booting=!0,y)),lp())};let f,p=[],_=!1,v,h=[],d=!1;yo();function g(y){gs[y?"unshift":"push"](()=>{f=y,l(3,f)})}function k(){p=this.files,l(4,p)}const P=()=>{f.click()},T=()=>l(5,_=!0);function E(y){gs[y?"unshift":"push"](()=>{v=y,l(6,v)})}function R(){h=this.files,l(7,h)}const j=()=>{v.click()},O=()=>l(8,d=!0);return t.$$set=y=>{"data"in y&&l(0,n=y.data),"sysinfo"in y&&l(1,i=y.sysinfo)},[n,i,u,f,p,_,v,h,d,o,m,r,g,k,P,T,E,R,j,O]}class ip extends je{constructor(e){super(),Ue(this,e,np,tp,Ie,{data:0,sysinfo:1})}}function Vf(t){let e,l,n=ge(t[0],7)+"",i,o,u=ge(t[0],5)+"",m,r,f=ge(t[0],4)+"",p,_,v=ge(t[0],3)+"",h,d,g,k,P=ge(t[0],2)+"",T,E,R=ge(t[0],1)+"",j,O,y=ge(t[0],0)+"",A,ne,B,F,H=ge(t[0],101)+"",W,K,Y=ge(t[0],100)+"",x;return{c(){e=c("optgroup"),l=c("option"),i=N(n),o=c("option"),m=N(u),r=c("option"),p=N(f),_=c("option"),h=N(v),d=b(),g=c("optgroup"),k=c("option"),T=N(P),E=c("option"),j=N(R),O=c("option"),A=N(y),ne=b(),B=c("optgroup"),F=c("option"),W=N(H),K=c("option"),x=N(Y),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,r.__value=4,r.value=r.__value,_.__value=3,_.value=_.__value,a(e,"label","amsleser.no"),k.__value=2,k.value=k.__value,E.__value=1,E.value=E.__value,O.__value=0,O.value=O.__value,a(g,"label","Custom hardware"),F.__value=101,F.value=F.__value,K.__value=100,K.value=K.__value,a(B,"label","Generic hardware")},m(G,z){S(G,e,z),s(e,l),s(l,i),s(e,o),s(o,m),s(e,r),s(r,p),s(e,_),s(_,h),S(G,d,z),S(G,g,z),s(g,k),s(k,T),s(g,E),s(E,j),s(g,O),s(O,A),S(G,ne,z),S(G,B,z),s(B,F),s(F,W),s(B,K),s(K,x)},p(G,z){z&1&&n!==(n=ge(G[0],7)+"")&&Z(i,n),z&1&&u!==(u=ge(G[0],5)+"")&&Z(m,u),z&1&&f!==(f=ge(G[0],4)+"")&&Z(p,f),z&1&&v!==(v=ge(G[0],3)+"")&&Z(h,v),z&1&&P!==(P=ge(G[0],2)+"")&&Z(T,P),z&1&&R!==(R=ge(G[0],1)+"")&&Z(j,R),z&1&&y!==(y=ge(G[0],0)+"")&&Z(A,y),z&1&&H!==(H=ge(G[0],101)+"")&&Z(W,H),z&1&&Y!==(Y=ge(G[0],100)+"")&&Z(x,Y)},d(G){G&&C(e),G&&C(d),G&&C(g),G&&C(ne),G&&C(B)}}}function Kf(t){let e,l,n=ge(t[0],201)+"",i,o,u=ge(t[0],202)+"",m,r,f=ge(t[0],203)+"",p,_,v=ge(t[0],241)+"",h,d,g=ge(t[0],242)+"",k,P,T=ge(t[0],243)+"",E,R,j=ge(t[0],200)+"",O;return{c(){e=c("optgroup"),l=c("option"),i=N(n),o=c("option"),m=N(u),r=c("option"),p=N(f),_=c("option"),h=N(v),d=c("option"),k=N(g),P=c("option"),E=N(T),R=c("option"),O=N(j),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,r.__value=203,r.value=r.__value,_.__value=241,_.value=_.__value,d.__value=242,d.value=d.__value,P.__value=243,P.value=P.__value,R.__value=200,R.value=R.__value,a(e,"label","Generic hardware")},m(y,A){S(y,e,A),s(e,l),s(l,i),s(e,o),s(o,m),s(e,r),s(r,p),s(e,_),s(_,h),s(e,d),s(d,k),s(e,P),s(P,E),s(e,R),s(R,O)},p(y,A){A&1&&n!==(n=ge(y[0],201)+"")&&Z(i,n),A&1&&u!==(u=ge(y[0],202)+"")&&Z(m,u),A&1&&f!==(f=ge(y[0],203)+"")&&Z(p,f),A&1&&v!==(v=ge(y[0],241)+"")&&Z(h,v),A&1&&g!==(g=ge(y[0],242)+"")&&Z(k,g),A&1&&T!==(T=ge(y[0],243)+"")&&Z(E,T),A&1&&j!==(j=ge(y[0],200)+"")&&Z(O,j)},d(y){y&&C(e)}}}function Yf(t){let e,l,n=ge(t[0],7)+"",i,o,u=ge(t[0],6)+"",m,r,f=ge(t[0],5)+"",p,_,v,h,d=ge(t[0],51)+"",g,k,P=ge(t[0],50)+"",T;return{c(){e=c("optgroup"),l=c("option"),i=N(n),o=c("option"),m=N(u),r=c("option"),p=N(f),_=b(),v=c("optgroup"),h=c("option"),g=N(d),k=c("option"),T=N(P),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,r.__value=5,r.value=r.__value,a(e,"label","amsleser.no"),h.__value=51,h.value=h.__value,k.__value=50,k.value=k.__value,a(v,"label","Generic hardware")},m(E,R){S(E,e,R),s(e,l),s(l,i),s(e,o),s(o,m),s(e,r),s(r,p),S(E,_,R),S(E,v,R),s(v,h),s(h,g),s(v,k),s(k,T)},p(E,R){R&1&&n!==(n=ge(E[0],7)+"")&&Z(i,n),R&1&&u!==(u=ge(E[0],6)+"")&&Z(m,u),R&1&&f!==(f=ge(E[0],5)+"")&&Z(p,f),R&1&&d!==(d=ge(E[0],51)+"")&&Z(g,d),R&1&&P!==(P=ge(E[0],50)+"")&&Z(T,P)},d(E){E&&C(e),E&&C(_),E&&C(v)}}}function Qf(t){let e,l,n=ge(t[0],8)+"",i,o,u,m,r=ge(t[0],71)+"",f,p,_=ge(t[0],70)+"",v;return{c(){e=c("optgroup"),l=c("option"),i=N(n),o=b(),u=c("optgroup"),m=c("option"),f=N(r),p=c("option"),v=N(_),l.__value=8,l.value=l.__value,a(e,"label","Custom hardware"),m.__value=71,m.value=m.__value,p.__value=70,p.value=p.__value,a(u,"label","Generic hardware")},m(h,d){S(h,e,d),s(e,l),s(l,i),S(h,o,d),S(h,u,d),s(u,m),s(m,f),s(u,p),s(p,v)},p(h,d){d&1&&n!==(n=ge(h[0],8)+"")&&Z(i,n),d&1&&r!==(r=ge(h[0],71)+"")&&Z(f,r),d&1&&_!==(_=ge(h[0],70)+"")&&Z(v,_)},d(h){h&&C(e),h&&C(o),h&&C(u)}}}function Xf(t){let e,l,n=ge(t[0],200)+"",i;return{c(){e=c("optgroup"),l=c("option"),i=N(n),l.__value=200,l.value=l.__value,a(e,"label","Generic hardware")},m(o,u){S(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=ge(o[0],200)+"")&&Z(i,n)},d(o){o&&C(e)}}}function Zf(t){let e,l,n=ge(t[0],80)+"",i;return{c(){e=c("optgroup"),l=c("option"),i=N(n),l.__value=80,l.value=l.__value,a(e,"label","Generic hardware")},m(o,u){S(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=ge(o[0],80)+"")&&Z(i,n)},d(o){o&&C(e)}}}function sp(t){let e,l,n,i,o,u,m,r,f=t[0]=="esp8266"&&Vf(t),p=t[0]=="esp32"&&Kf(t),_=t[0]=="esp32s2"&&Yf(t),v=t[0]=="esp32c3"&&Qf(t),h=t[0]=="esp32solo"&&Xf(t),d=t[0]=="esp32s3"&&Zf(t);return{c(){e=c("option"),l=b(),f&&f.c(),n=b(),p&&p.c(),i=b(),_&&_.c(),o=b(),v&&v.c(),u=b(),h&&h.c(),m=b(),d&&d.c(),r=nt(),e.__value=-1,e.value=e.__value},m(g,k){S(g,e,k),S(g,l,k),f&&f.m(g,k),S(g,n,k),p&&p.m(g,k),S(g,i,k),_&&_.m(g,k),S(g,o,k),v&&v.m(g,k),S(g,u,k),h&&h.m(g,k),S(g,m,k),d&&d.m(g,k),S(g,r,k)},p(g,[k]){g[0]=="esp8266"?f?f.p(g,k):(f=Vf(g),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),g[0]=="esp32"?p?p.p(g,k):(p=Kf(g),p.c(),p.m(i.parentNode,i)):p&&(p.d(1),p=null),g[0]=="esp32s2"?_?_.p(g,k):(_=Yf(g),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),g[0]=="esp32c3"?v?v.p(g,k):(v=Qf(g),v.c(),v.m(u.parentNode,u)):v&&(v.d(1),v=null),g[0]=="esp32solo"?h?h.p(g,k):(h=Xf(g),h.c(),h.m(m.parentNode,m)):h&&(h.d(1),h=null),g[0]=="esp32s3"?d?d.p(g,k):(d=Zf(g),d.c(),d.m(r.parentNode,r)):d&&(d.d(1),d=null)},i:he,o:he,d(g){g&&C(e),g&&C(l),f&&f.d(g),g&&C(n),p&&p.d(g),g&&C(i),_&&_.d(g),g&&C(o),v&&v.d(g),g&&C(u),h&&h.d(g),g&&C(m),d&&d.d(g),g&&C(r)}}}function op(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class ap extends je{constructor(e){super(),Ue(this,e,op,sp,Ie,{chip:0})}}function Jf(t){let e;return{c(){e=c("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",a(e,"class","bd-red")},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function xf(t){let e,l,n,i,o,u,m;return u=new uo({props:{chip:t[0].chip}}),{c(){e=c("div"),l=N("HAN GPIO"),n=c("br"),i=b(),o=c("select"),ae(u.$$.fragment),a(o,"name","vh"),a(o,"class","in-s"),a(e,"class","my-3")},m(r,f){S(r,e,f),s(e,l),s(e,n),s(e,i),s(e,o),se(u,o,null),m=!0},p(r,f){const p={};f&1&&(p.chip=r[0].chip),u.$set(p)},i(r){m||(L(u.$$.fragment,r),m=!0)},o(r){U(u.$$.fragment,r),m=!1},d(r){r&&C(e),oe(u)}}}function rp(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P,T,E,R,j,O,y,A,ne,B,F,H,W,K=t[0].usrcfg&&Jf();d=new ap({props:{chip:t[0].chip}});let Y=t[0].board&&t[0].board>20&&xf(t);return B=new Tt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=c("div"),l=c("div"),n=c("form"),i=c("input"),o=b(),u=c("strong"),u.textContent="Initial configuration",m=b(),K&&K.c(),r=b(),f=c("div"),p=N("Board type"),_=c("br"),v=b(),h=c("select"),ae(d.$$.fragment),g=b(),Y&&Y.c(),k=b(),P=c("div"),T=c("label"),E=c("input"),R=N(" Clear all other configuration"),j=b(),O=c("div"),O.innerHTML='',y=b(),A=c("span"),A.textContent="\xA0",ne=b(),ae(B.$$.fragment),a(i,"type","hidden"),a(i,"name","v"),i.value="true",a(u,"class","text-sm"),a(h,"name","vb"),a(h,"class","in-s"),t[0].board===void 0&&Xe(()=>t[5].call(h)),a(f,"class","my-3"),a(E,"type","checkbox"),a(E,"name","vr"),E.__value="true",E.value=E.__value,a(E,"class","rounded mb-1"),a(P,"class","my-3"),a(O,"class","my-3"),a(A,"class","clear-both"),a(n,"autocomplete","off"),a(l,"class","cnt"),a(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(x,G){S(x,e,G),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,m),K&&K.m(n,null),s(n,r),s(n,f),s(f,p),s(f,_),s(f,v),s(f,h),se(d,h,null),Ce(h,t[0].board,!0),s(n,g),Y&&Y.m(n,null),s(n,k),s(n,P),s(P,T),s(T,E),E.checked=t[2],s(T,R),s(n,j),s(n,O),s(n,y),s(n,A),S(x,ne,G),se(B,x,G),F=!0,H||(W=[X(h,"change",t[5]),X(E,"change",t[6]),X(n,"submit",Mi(t[3]))],H=!0)},p(x,[G]){x[0].usrcfg?K||(K=Jf(),K.c(),K.m(n,r)):K&&(K.d(1),K=null);const z={};G&1&&(z.chip=x[0].chip),d.$set(z),G&1&&Ce(h,x[0].board),x[0].board&&x[0].board>20?Y?(Y.p(x,G),G&1&&L(Y,1)):(Y=xf(x),Y.c(),L(Y,1),Y.m(n,k)):Y&&(Fe(),U(Y,1,1,()=>{Y=null}),Be()),G&4&&(E.checked=x[2]);const ee={};G&2&&(ee.active=x[1]),B.$set(ee)},i(x){F||(L(d.$$.fragment,x),L(Y),L(B.$$.fragment,x),F=!0)},o(x){U(d.$$.fragment,x),U(Y),U(B.$$.fragment,x),F=!1},d(x){x&&C(e),K&&K.d(),oe(d),Y&&Y.d(),x&&C(ne),oe(B,x),H=!1,lt(W)}}}function up(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(p){l(1,o=!0);const _=new FormData(p.target),v=new URLSearchParams;for(let g of _){const[k,P]=g;v.append(k,P)}let d=await(await fetch("save",{method:"POST",body:v})).json();l(1,o=!1),Yt.update(g=>(g.vndcfg=d.success,g.booting=d.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),cn(n+(i.usrcfg?"/":"/setup"))}let m=!1;Yt.subscribe(p=>{l(0,i=p),p.fwconsent===1&&l(2,m=!i.usrcfg)});function r(){i.board=st(this),l(0,i)}function f(){m=this.checked,l(2,m)}return t.$$set=p=>{"basepath"in p&&l(4,n=p.basepath),"sysinfo"in p&&l(0,i=p.sysinfo)},[i,o,m,u,n,r,f]}class fp extends je{constructor(e){super(),Ue(this,e,up,rp,Ie,{basepath:4,sysinfo:0})}}function ec(t){let e;return{c(){e=c("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function tc(t){let e,l,n,i,o,u,m,r,f,p,_,v,h;return{c(){e=c("div"),l=N("SSID"),n=c("br"),i=b(),o=c("input"),m=b(),r=c("div"),f=N("PSK"),p=c("br"),_=b(),v=c("input"),a(o,"name","ss"),a(o,"type","text"),a(o,"class","in-s"),o.required=u=t[2]==1||t[2]==2,a(e,"class","my-3"),a(v,"name","sp"),a(v,"type","password"),a(v,"class","in-s"),a(v,"autocomplete","off"),v.required=h=t[2]==2,a(r,"class","my-3")},m(d,g){S(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),S(d,m,g),S(d,r,g),s(r,f),s(r,p),s(r,_),s(r,v)},p(d,g){g&4&&u!==(u=d[2]==1||d[2]==2)&&(o.required=u),g&4&&h!==(h=d[2]==2)&&(v.required=h)},d(d){d&&C(e),d&&C(m),d&&C(r)}}}function lc(t){let e,l,n,i,o,u,m,r;return m=new p1({}),{c(){e=c("br"),l=b(),n=c("div"),i=c("input"),o=b(),u=c("select"),ae(m.$$.fragment),a(i,"name","si"),a(i,"type","text"),a(i,"class","in-f w-full"),i.required=t[1],a(u,"name","su"),a(u,"class","in-l"),u.required=t[1],a(n,"class","flex")},m(f,p){S(f,e,p),S(f,l,p),S(f,n,p),s(n,i),s(n,o),s(n,u),se(m,u,null),r=!0},p(f,p){(!r||p&2)&&(i.required=f[1]),(!r||p&2)&&(u.required=f[1])},i(f){r||(L(m.$$.fragment,f),r=!0)},o(f){U(m.$$.fragment,f),r=!1},d(f){f&&C(e),f&&C(l),f&&C(n),oe(m)}}}function nc(t){let e;return{c(){e=c("div"),e.innerHTML=`
Gateway
DNS
-
`,r(e,"class","my-3 flex")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function sp(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z,V,H=t[0].if&&t[0].if.eth&&ec(),x=(t[2]==1||t[2]==2)&&tc(t),ue=t[1]&&lc(t),re=t[1]&&nc();return Y=new gt({props:{active:t[3],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),u=m("strong"),u.textContent="Setup",c=b(),a=m("div"),f=N("Connection"),p=m("br"),_=b(),v=m("select"),h=m("option"),h.textContent="Connect to WiFi",d=m("option"),d.textContent="Standalone access point",H&&H.c(),g=b(),x&&x.c(),w=b(),D=m("div"),T=N(`Hostname - `),E=m("input"),F=b(),O=m("div"),R=m("label"),y=m("input"),A=N(" Static IP"),te=b(),ue&&ue.c(),W=b(),re&&re.c(),j=b(),U=m("div"),U.innerHTML='',K=b(),se(Y.$$.fragment),r(i,"type","hidden"),r(i,"name","s"),i.value="true",r(u,"class","text-sm"),h.__value=1,h.value=h.__value,d.__value=2,d.value=d.__value,r(v,"name","sc"),r(v,"class","in-s"),t[2]===void 0&&ze(()=>t[5].call(v)),r(a,"class","my-3"),r(E,"name","sh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"maxlength","32"),r(E,"pattern","[a-z0-9_-]+"),r(E,"placeholder","Optional, ex.: ams-reader"),r(E,"autocomplete","off"),r(y,"type","checkbox"),r(y,"name","sm"),y.__value="static",y.value=y.__value,r(y,"class","rounded mb-1"),r(O,"class","my-3"),r(U,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Q,z){M(Q,e,z),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,c),s(n,a),s(a,f),s(a,p),s(a,_),s(a,v),s(v,h),s(v,d),H&&H.m(v,null),Me(v,t[2],!0),s(n,g),x&&x.m(n,null),s(n,w),s(n,D),s(D,T),s(D,E),oe(E,t[0].hostname),s(n,F),s(n,O),s(O,R),s(R,y),y.checked=t[1],s(R,A),s(O,te),ue&&ue.m(O,null),s(n,W),re&&re.m(n,null),s(n,j),s(n,U),M(Q,K,z),ne(Y,Q,z),G=!0,Z||(V=[ee(v,"change",t[5]),ee(E,"input",t[6]),ee(y,"change",t[7]),ee(n,"submit",Ci(t[4]))],Z=!0)},p(Q,[z]){Q[0].if&&Q[0].if.eth?H||(H=ec(),H.c(),H.m(v,null)):H&&(H.d(1),H=null),z&4&&Me(v,Q[2]),Q[2]==1||Q[2]==2?x?x.p(Q,z):(x=tc(Q),x.c(),x.m(n,w)):x&&(x.d(1),x=null),z&1&&E.value!==Q[0].hostname&&oe(E,Q[0].hostname),z&2&&(y.checked=Q[1]),Q[1]?ue?(ue.p(Q,z),z&2&&I(ue,1)):(ue=lc(Q),ue.c(),I(ue,1),ue.m(O,null)):ue&&(Ae(),q(ue,1,1,()=>{ue=null}),Pe()),Q[1]?re||(re=nc(),re.c(),re.m(n,j)):re&&(re.d(1),re=null);const we={};z&8&&(we.active=Q[3]),Y.$set(we)},i(Q){G||(I(ue),I(Y.$$.fragment,Q),G=!0)},o(Q){q(ue),q(Y.$$.fragment,Q),G=!1},d(Q){Q&&S(e),H&&H.d(),x&&x.d(),ue&&ue.d(),re&&re.d(),Q&&S(K),ie(Y,Q),Z=!1,Ge(V)}}}function op(t,e,l){let{sysinfo:n={}}=e,i=!1,o=1,u=!1,c=0;function a(){var h="";c++;var d=function(){setTimeout(a,1e3)};if(n.net.ip&&c%3==0){if(!n.net.ip){d();return}h="http://"+n.net.ip}else n.hostname&&c%3==1?h="http://"+n.hostname:n.hostname&&c%3==2?h="http://"+n.hostname+".local":h="";console&&console.log("Trying url "+h),Wt.update(w=>(w.trying=h,w));var g=new XMLHttpRequest;g.timeout=5e3,g.addEventListener("abort",d),g.addEventListener("error",d),g.addEventListener("timeout",d),g.addEventListener("load",function(w){window.location.href=h||"/"}),g.open("GET",h+"/is-alive",!0),g.send()}async function f(h){l(3,u=!0);const d=new FormData(h.target),g=new URLSearchParams;for(let T of d){const[E,F]=T;g.append(E,F)}let D=await(await fetch("save",{method:"POST",body:g})).json();l(3,u=!1),Wt.update(T=>(T.hostname=d.get("sh"),T.usrcfg=D.success,T.booting=D.reboot,i&&(T.net.ip=d.get("si"),T.net.mask=d.get("su"),T.net.gw=d.get("sg"),T.net.dns1=d.get("sd")),setTimeout(a,5e3),T))}function p(){o=tt(this),l(2,o)}function _(){n.hostname=this.value,l(0,n)}function v(){i=this.checked,l(1,i)}return t.$$set=h=>{"sysinfo"in h&&l(0,n=h.sysinfo)},[n,i,o,u,f,p,_,v]}class rp extends Re{constructor(e){super(),Le(this,e,op,sp,Ee,{sysinfo:0})}}function ap(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D;return d=new gt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=N("Upload "),o=N(t[1]),u=b(),c=m("p"),c.textContent="Select a suitable file and click upload",a=b(),f=m("form"),p=m("input"),_=b(),v=m("div"),v.innerHTML='',h=b(),se(d.$$.fragment),r(c,"class","mb-4"),r(p,"name","file"),r(p,"type","file"),r(v,"class","w-full text-right mt-4"),r(f,"action",t[0]),r(f,"enctype","multipart/form-data"),r(f,"method","post"),r(f,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(T,E){M(T,e,E),s(e,l),s(l,n),s(n,i),s(n,o),s(l,u),s(l,c),s(l,a),s(l,f),s(f,p),s(f,_),s(f,v),M(T,h,E),ne(d,T,E),g=!0,w||(D=ee(f,"submit",t[3]),w=!0)},p(T,[E]){(!g||E&2)&&J(o,T[1]),(!g||E&1)&&r(f,"action",T[0]);const F={};E&4&&(F.active=T[2]),d.$set(F)},i(T){g||(I(d.$$.fragment,T),g=!0)},o(T){q(d.$$.fragment,T),g=!1},d(T){T&&S(e),T&&S(h),ie(d,T),w=!1,D()}}}function up(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const u=()=>l(2,o=!0);return t.$$set=c=>{"action"in c&&l(0,n=c.action),"title"in c&&l(1,i=c.title)},[n,i,o,u]}class $o extends Re{constructor(e){super(),Le(this,e,up,ap,Ee,{action:0,title:1})}}function fp(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G;return U=new gt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=b(),u=m("hr"),c=b(),a=m("div"),f=N("Enable one-click upgrade? (implies data collection)"),p=m("br"),_=b(),v=m("a"),h=N("Read more"),d=m("br"),g=b(),w=m("label"),D=m("input"),E=N(" Yes"),F=m("label"),O=m("input"),y=N(" No"),A=m("br"),te=b(),W=m("div"),W.innerHTML='',j=b(),se(U.$$.fragment),r(v,"href",Rt("Data-collection-on-one-click-firmware-upgrade")),r(v,"target","_blank"),r(v,"class","text-blue-600 hover:text-blue-800"),r(D,"type","radio"),r(D,"name","sf"),D.value=1,D.checked=T=t[0].fwconsent===1,r(D,"class","rounded m-2"),D.required=!0,r(O,"type","radio"),r(O,"name","sf"),O.value=2,O.checked=R=t[0].fwconsent===2,r(O,"class","rounded m-2"),O.required=!0,r(a,"class","my-3"),r(W,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(Z,V){M(Z,e,V),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,c),s(n,a),s(a,f),s(a,p),s(a,_),s(a,v),s(v,h),s(a,d),s(a,g),s(a,w),s(w,D),s(w,E),s(a,F),s(F,O),s(F,y),s(a,A),s(n,te),s(n,W),M(Z,j,V),ne(U,Z,V),K=!0,Y||(G=ee(n,"submit",Ci(t[2])),Y=!0)},p(Z,[V]){(!K||V&1&&T!==(T=Z[0].fwconsent===1))&&(D.checked=T),(!K||V&1&&R!==(R=Z[0].fwconsent===2))&&(O.checked=R);const H={};V&2&&(H.active=Z[1]),U.$set(H)},i(Z){K||(I(U.$$.fragment,Z),K=!0)},o(Z){q(U.$$.fragment,Z),K=!1},d(Z){Z&&S(e),Z&&S(j),ie(U,Z),Y=!1,G()}}}function cp(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(c){l(1,o=!0);const a=new FormData(c.target),f=new URLSearchParams;for(let v of a){const[h,d]=v;f.append(h,d)}let _=await(await fetch("save",{method:"POST",body:f})).json();l(1,o=!1),Wt.update(v=>(v.fwconsent=a.sf===!0?1:a.sf===!1?2:0,v.booting=_.reboot,v)),cn(n)}return t.$$set=c=>{"basepath"in c&&l(3,n=c.basepath),"sysinfo"in c&&l(0,i=c.sysinfo)},[i,o,u,n]}class mp extends Re{constructor(e){super(),Le(this,e,cp,fp,Ee,{basepath:3,sysinfo:0})}}function ic(t,e,l){const n=t.slice();return n[18]=e[l],n[19]=e,n[20]=l,n}function sc(t,e,l){const n=t.slice();return n[21]=e[l],n[23]=l,n}function oc(t,e,l){const n=t.slice();return n[21]=e[l],n[23]=l,n}function rc(t,e,l){const n=t.slice();return n[21]=e[l],n[23]=l,n}function ac(t){let e,l,n=t[0].o,i=[];for(let u=0;uq(i[u],1,1,()=>{i[u]=null});return{c(){for(let u=0;uSave',F=b(),se(O.$$.fragment),R=b(),se(y.$$.fragment),r(l,"class","text-sm"),r(i,"href",Rt("Price-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"class","m-3"),r(p,"type","hidden"),r(p,"name","r"),p.value="true",r(g,"type","button"),r(g,"class","btn-pri"),r(D,"class","text-center"),r(E,"class","text-right"),r(h,"class","grid grid-cols-3"),r(f,"autocomplete","off"),r(e,"class","cnt")},m(U,K){M(U,e,K),s(e,l),s(e,n),s(e,i),ne(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(f,_),j&&j.m(f,null),s(f,v),s(f,h),s(h,d),s(d,g),s(h,w),s(h,D),s(h,T),s(h,E),M(U,F,K),ne(O,U,K),M(U,R,K),ne(y,U,K),A=!0,te||(W=[ee(g,"click",t[6]),ee(f,"submit",Ci(t[4]))],te=!0)},p(U,[K]){U[0].o?j?(j.p(U,K),K&1&&I(j,1)):(j=ac(U),j.c(),I(j,1),j.m(f,v)):j&&(Ae(),q(j,1,1,()=>{j=null}),Pe());const Y={};K&2&&(Y.active=U[1]),O.$set(Y);const G={};K&4&&(G.active=U[2]),y.$set(G)},i(U){A||(I(o.$$.fragment,U),I(j),I(O.$$.fragment,U),I(y.$$.fragment,U),A=!0)},o(U){q(o.$$.fragment,U),q(j),q(O.$$.fragment,U),q(y.$$.fragment,U),A=!1},d(U){U&&S(e),ie(o),j&&j.d(),U&&S(F),ie(O,U),U&&S(R),ie(y,U),te=!1,Ge(W)}}}function pp(t,e,l){let{basepath:n="/"}=e,i=["mo","tu","we","th","fr","sa","su"],o={},u=!0,c=!1;r1.subscribe(O=>{O.o&&(l(0,o=O),l(1,u=!1))}),n_();async function a(O){l(2,c=!0);const R=new URLSearchParams;R.append("r","true"),R.append("rc",o.o.length),o.o.forEach(function(A,te){R.append("rt"+te,A.t),R.append("rn"+te,A.n),R.append("rd"+te,A.d),R.append("ra"+te,A.a),R.append("rh"+te,A.h),R.append("rv"+te,A.v)}),await(await fetch("save",{method:"POST",body:R})).json(),l(2,c=!1),cn(n+"configuration")}let f=function(O,R){return O.includes(R)?O=O.filter(function(y){return y!==R}):O.push(R),O},p=function(){let O=o.o;O.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:.01}),l(0,o.o=O,o)},_=function(O){let R=o.o;R.splice(O,1),l(0,o.o=R,o)};function v(O,R){O[R].n=this.value,l(0,o)}function h(O,R){O[R].d=tt(this),l(0,o)}function d(O,R){O[R].t=tt(this),l(0,o)}function g(O,R){O[R].v=ge(this.value),l(0,o)}const w=(O,R,y,A)=>l(0,y[A].a=f(O.a,R),o),D=(O,R,y,A)=>l(0,y[A].h=f(O.h,R),o),T=(O,R,y,A)=>l(0,y[A].h=f(O.h,R+12),o),E=O=>_(O),F=O=>_(O);return t.$$set=O=>{"basepath"in O&&l(8,n=O.basepath)},[o,u,c,i,a,f,p,_,n,v,h,d,g,w,D,T,E,F]}class dp extends Re{constructor(e){super(),Le(this,e,pp,_p,Ee,{basepath:8})}}function hp(t){let e,l;return e=new t_({props:{data:t[2],sysinfo:t[1]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&4&&(o.data=n[2]),i&2&&(o.sysinfo=n[1]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function vp(t){let e,l;return e=new U_({props:{sysinfo:t[1],basepath:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function bp(t){let e,l;return e=new dp({props:{basepath:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function gp(t){let e,l;return e=new J_({props:{sysinfo:t[1],data:t[2]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&4&&(o.data=n[2]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function kp(t){let e,l;return e=new $o({props:{title:"CA",action:"/mqtt-ca"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function wp(t){let e,l;return e=new $o({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function yp(t){let e,l;return e=new $o({props:{title:"private key",action:"/mqtt-key"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Cp(t){let e,l;return e=new mp({props:{sysinfo:t[1],basepath:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Sp(t){let e,l;return e=new rp({props:{sysinfo:t[1]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Mp(t){let e,l;return e=new ip({props:{sysinfo:t[1],basepath:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Tp(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R;return e=new cm({props:{data:t[2],basepath:t[0]}}),n=new pl({props:{path:"/",$$slots:{default:[hp]},$$scope:{ctx:t}}}),o=new pl({props:{path:"/configuration",$$slots:{default:[vp]},$$scope:{ctx:t}}}),c=new pl({props:{path:"/priceconfig",$$slots:{default:[bp]},$$scope:{ctx:t}}}),f=new pl({props:{path:"/status",$$slots:{default:[gp]},$$scope:{ctx:t}}}),_=new pl({props:{path:"/mqtt-ca",$$slots:{default:[kp]},$$scope:{ctx:t}}}),h=new pl({props:{path:"/mqtt-cert",$$slots:{default:[wp]},$$scope:{ctx:t}}}),g=new pl({props:{path:"/mqtt-key",$$slots:{default:[yp]},$$scope:{ctx:t}}}),D=new pl({props:{path:"/consent",$$slots:{default:[Cp]},$$scope:{ctx:t}}}),E=new pl({props:{path:"/setup",$$slots:{default:[Sp]},$$scope:{ctx:t}}}),O=new pl({props:{path:"/vendor",$$slots:{default:[Mp]},$$scope:{ctx:t}}}),{c(){se(e.$$.fragment),l=b(),se(n.$$.fragment),i=b(),se(o.$$.fragment),u=b(),se(c.$$.fragment),a=b(),se(f.$$.fragment),p=b(),se(_.$$.fragment),v=b(),se(h.$$.fragment),d=b(),se(g.$$.fragment),w=b(),se(D.$$.fragment),T=b(),se(E.$$.fragment),F=b(),se(O.$$.fragment)},m(y,A){ne(e,y,A),M(y,l,A),ne(n,y,A),M(y,i,A),ne(o,y,A),M(y,u,A),ne(c,y,A),M(y,a,A),ne(f,y,A),M(y,p,A),ne(_,y,A),M(y,v,A),ne(h,y,A),M(y,d,A),ne(g,y,A),M(y,w,A),ne(D,y,A),M(y,T,A),ne(E,y,A),M(y,F,A),ne(O,y,A),R=!0},p(y,A){const te={};A&4&&(te.data=y[2]),A&1&&(te.basepath=y[0]),e.$set(te);const W={};A&14&&(W.$$scope={dirty:A,ctx:y}),n.$set(W);const j={};A&11&&(j.$$scope={dirty:A,ctx:y}),o.$set(j);const U={};A&9&&(U.$$scope={dirty:A,ctx:y}),c.$set(U);const K={};A&14&&(K.$$scope={dirty:A,ctx:y}),f.$set(K);const Y={};A&8&&(Y.$$scope={dirty:A,ctx:y}),_.$set(Y);const G={};A&8&&(G.$$scope={dirty:A,ctx:y}),h.$set(G);const Z={};A&8&&(Z.$$scope={dirty:A,ctx:y}),g.$set(Z);const V={};A&11&&(V.$$scope={dirty:A,ctx:y}),D.$set(V);const H={};A&10&&(H.$$scope={dirty:A,ctx:y}),E.$set(H);const x={};A&11&&(x.$$scope={dirty:A,ctx:y}),O.$set(x)},i(y){R||(I(e.$$.fragment,y),I(n.$$.fragment,y),I(o.$$.fragment,y),I(c.$$.fragment,y),I(f.$$.fragment,y),I(_.$$.fragment,y),I(h.$$.fragment,y),I(g.$$.fragment,y),I(D.$$.fragment,y),I(E.$$.fragment,y),I(O.$$.fragment,y),R=!0)},o(y){q(e.$$.fragment,y),q(n.$$.fragment,y),q(o.$$.fragment,y),q(c.$$.fragment,y),q(f.$$.fragment,y),q(_.$$.fragment,y),q(h.$$.fragment,y),q(g.$$.fragment,y),q(D.$$.fragment,y),q(E.$$.fragment,y),q(O.$$.fragment,y),R=!1},d(y){ie(e,y),y&&S(l),ie(n,y),y&&S(i),ie(o,y),y&&S(u),ie(c,y),y&&S(a),ie(f,y),y&&S(p),ie(_,y),y&&S(v),ie(h,y),y&&S(d),ie(g,y),y&&S(w),ie(D,y),y&&S(T),ie(E,y),y&&S(F),ie(O,y)}}}function $p(t){let e,l,n,i;const o=[Ap,Ep],u=[];function c(a,f){return a[1].trying?0:1}return e=c(t),l=u[e]=o[e](t),{c(){l.c(),n=Ke()},m(a,f){u[e].m(a,f),M(a,n,f),i=!0},p(a,f){let p=e;e=c(a),e===p?u[e].p(a,f):(Ae(),q(u[p],1,1,()=>{u[p]=null}),Pe(),l=u[e],l?l.p(a,f):(l=u[e]=o[e](a),l.c()),I(l,1),l.m(n.parentNode,n))},i(a){i||(I(l),i=!0)},o(a){q(l),i=!1},d(a){u[e].d(a),a&&S(n)}}}function Np(t){let e,l;return e=new gt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Ep(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Ap(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[1].trying}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.message="Device is booting, please wait. Trying to reach it on "+n[1].trying),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Pp(t){let e,l,n,i,o,u;l=new Uc({props:{basepath:t[0],$$slots:{default:[Tp]},$$scope:{ctx:t}}});const c=[Np,$p],a=[];function f(p,_){return p[1].upgrading?0:p[1].booting?1:-1}return~(i=f(t))&&(o=a[i]=c[i](t)),{c(){e=m("div"),se(l.$$.fragment),n=b(),o&&o.c(),r(e,"class","container mx-auto m-3")},m(p,_){M(p,e,_),ne(l,e,null),s(e,n),~i&&a[i].m(e,null),u=!0},p(p,[_]){const v={};_&1&&(v.basepath=p[0]),_&15&&(v.$$scope={dirty:_,ctx:p}),l.$set(v);let h=i;i=f(p),i===h?~i&&a[i].p(p,_):(o&&(Ae(),q(a[h],1,1,()=>{a[h]=null}),Pe()),~i?(o=a[i],o?o.p(p,_):(o=a[i]=c[i](p),o.c()),I(o,1),o.m(e,null)):o=null)},i(p){u||(I(l.$$.fragment,p),I(o),u=!0)},o(p){q(l.$$.fragment,p),q(o),u=!1},d(p){p&&S(e),ie(l),~i&&a[i].d()}}}function Dp(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i={};Wt.subscribe(u=>{l(1,i=u),i.vndcfg===!1?cn(n+"vendor"):i.usrcfg===!1?cn(n+"setup"):i.fwconsent===0&&cn(n+"consent"),i.ui.k===1?(console.log("dark"),document.documentElement.classList.add("dark")):i.ui.k===0?(console.log("light"),document.documentElement.classList.remove("dark")):window.matchMedia("(prefers-color-scheme: dark)").matches?(console.log("dark auto"),document.documentElement.classList.add("dark")):(console.log("light auto"),document.documentElement.classList.remove("dark"))}),yo();let o={};return Vc.subscribe(u=>{l(2,o=u)}),[n,i,o]}class Lp extends Re{constructor(e){super(),Le(this,e,Dp,Pp,Ee,{})}}new Lp({target:document.getElementById("app")}); +
`,a(e,"class","my-3 flex")},m(l,n){S(l,e,n)},d(l){l&&C(e)}}}function cp(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P,T,E,R,j,O,y,A,ne,B,F,H,W,K,Y,x,G,z=t[0].if&&t[0].if.eth&&ec(),ee=(t[2]==1||t[2]==2)&&tc(t),ce=t[1]&&lc(t),ie=t[1]&&nc();return K=new Tt({props:{active:t[3],message:"Saving your configuration to the device"}}),{c(){e=c("div"),l=c("div"),n=c("form"),i=c("input"),o=b(),u=c("strong"),u.textContent="Setup",m=b(),r=c("div"),f=N("Connection"),p=c("br"),_=b(),v=c("select"),h=c("option"),h.textContent="Connect to WiFi",d=c("option"),d.textContent="Standalone access point",z&&z.c(),g=b(),ee&&ee.c(),k=b(),P=c("div"),T=N(`Hostname + `),E=c("input"),R=b(),j=c("div"),O=c("label"),y=c("input"),A=N(" Static IP"),ne=b(),ce&&ce.c(),B=b(),ie&&ie.c(),F=b(),H=c("div"),H.innerHTML='',W=b(),ae(K.$$.fragment),a(i,"type","hidden"),a(i,"name","s"),i.value="true",a(u,"class","text-sm"),h.__value=1,h.value=h.__value,d.__value=2,d.value=d.__value,a(v,"name","sc"),a(v,"class","in-s"),t[2]===void 0&&Xe(()=>t[5].call(v)),a(r,"class","my-3"),a(E,"name","sh"),a(E,"type","text"),a(E,"class","in-s"),a(E,"maxlength","32"),a(E,"pattern","[a-z0-9_-]+"),a(E,"placeholder","Optional, ex.: ams-reader"),a(E,"autocomplete","off"),a(y,"type","checkbox"),a(y,"name","sm"),y.__value="static",y.value=y.__value,a(y,"class","rounded mb-1"),a(j,"class","my-3"),a(H,"class","my-3"),a(l,"class","cnt"),a(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Q,V){S(Q,e,V),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,m),s(n,r),s(r,f),s(r,p),s(r,_),s(r,v),s(v,h),s(v,d),z&&z.m(v,null),Ce(v,t[2],!0),s(n,g),ee&&ee.m(n,null),s(n,k),s(n,P),s(P,T),s(P,E),ue(E,t[0].hostname),s(n,R),s(n,j),s(j,O),s(O,y),y.checked=t[1],s(O,A),s(j,ne),ce&&ce.m(j,null),s(n,B),ie&&ie.m(n,null),s(n,F),s(n,H),S(Q,W,V),se(K,Q,V),Y=!0,x||(G=[X(v,"change",t[5]),X(E,"input",t[6]),X(y,"change",t[7]),X(n,"submit",Mi(t[4]))],x=!0)},p(Q,[V]){Q[0].if&&Q[0].if.eth?z||(z=ec(),z.c(),z.m(v,null)):z&&(z.d(1),z=null),V&4&&Ce(v,Q[2]),Q[2]==1||Q[2]==2?ee?ee.p(Q,V):(ee=tc(Q),ee.c(),ee.m(n,k)):ee&&(ee.d(1),ee=null),V&1&&E.value!==Q[0].hostname&&ue(E,Q[0].hostname),V&2&&(y.checked=Q[1]),Q[1]?ce?(ce.p(Q,V),V&2&&L(ce,1)):(ce=lc(Q),ce.c(),L(ce,1),ce.m(j,null)):ce&&(Fe(),U(ce,1,1,()=>{ce=null}),Be()),Q[1]?ie||(ie=nc(),ie.c(),ie.m(n,F)):ie&&(ie.d(1),ie=null);const we={};V&8&&(we.active=Q[3]),K.$set(we)},i(Q){Y||(L(ce),L(K.$$.fragment,Q),Y=!0)},o(Q){U(ce),U(K.$$.fragment,Q),Y=!1},d(Q){Q&&C(e),z&&z.d(),ee&&ee.d(),ce&&ce.d(),ie&&ie.d(),Q&&C(W),oe(K,Q),x=!1,lt(G)}}}function mp(t,e,l){let{sysinfo:n={}}=e,i=!1,o=1,u=!1,m=0;function r(){var h="";m++;var d=function(){setTimeout(r,1e3)};if(n.net.ip&&m%3==0){if(!n.net.ip){d();return}h="http://"+n.net.ip}else n.hostname&&m%3==1?h="http://"+n.hostname:n.hostname&&m%3==2?h="http://"+n.hostname+".local":h="";console&&console.log("Trying url "+h),Yt.update(k=>(k.trying=h,k));var g=new XMLHttpRequest;g.timeout=5e3,g.addEventListener("abort",d),g.addEventListener("error",d),g.addEventListener("timeout",d),g.addEventListener("load",function(k){window.location.href=h||"/"}),g.open("GET",h+"/is-alive",!0),g.send()}async function f(h){l(3,u=!0);const d=new FormData(h.target),g=new URLSearchParams;for(let T of d){const[E,R]=T;g.append(E,R)}let P=await(await fetch("save",{method:"POST",body:g})).json();l(3,u=!1),Yt.update(T=>(T.hostname=d.get("sh"),T.usrcfg=P.success,T.booting=P.reboot,i&&(T.net.ip=d.get("si"),T.net.mask=d.get("su"),T.net.gw=d.get("sg"),T.net.dns1=d.get("sd")),setTimeout(r,5e3),T))}function p(){o=st(this),l(2,o)}function _(){n.hostname=this.value,l(0,n)}function v(){i=this.checked,l(1,i)}return t.$$set=h=>{"sysinfo"in h&&l(0,n=h.sysinfo)},[n,i,o,u,f,p,_,v]}class _p extends je{constructor(e){super(),Ue(this,e,mp,cp,Ie,{sysinfo:0})}}function pp(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P;return d=new Tt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=c("div"),l=c("div"),n=c("strong"),i=N("Upload "),o=N(t[1]),u=b(),m=c("p"),m.textContent="Select a suitable file and click upload",r=b(),f=c("form"),p=c("input"),_=b(),v=c("div"),v.innerHTML='',h=b(),ae(d.$$.fragment),a(m,"class","mb-4"),a(p,"name","file"),a(p,"type","file"),a(v,"class","w-full text-right mt-4"),a(f,"action",t[0]),a(f,"enctype","multipart/form-data"),a(f,"method","post"),a(f,"autocomplete","off"),a(l,"class","cnt"),a(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(T,E){S(T,e,E),s(e,l),s(l,n),s(n,i),s(n,o),s(l,u),s(l,m),s(l,r),s(l,f),s(f,p),s(f,_),s(f,v),S(T,h,E),se(d,T,E),g=!0,k||(P=X(f,"submit",t[3]),k=!0)},p(T,[E]){(!g||E&2)&&Z(o,T[1]),(!g||E&1)&&a(f,"action",T[0]);const R={};E&4&&(R.active=T[2]),d.$set(R)},i(T){g||(L(d.$$.fragment,T),g=!0)},o(T){U(d.$$.fragment,T),g=!1},d(T){T&&C(e),T&&C(h),oe(d,T),k=!1,P()}}}function dp(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const u=()=>l(2,o=!0);return t.$$set=m=>{"action"in m&&l(0,n=m.action),"title"in m&&l(1,i=m.title)},[n,i,o,u]}class $o extends je{constructor(e){super(),Ue(this,e,dp,pp,Ie,{action:0,title:1})}}function hp(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P,T,E,R,j,O,y,A,ne,B,F,H,W,K,Y;return H=new Tt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=c("div"),l=c("div"),n=c("form"),i=c("div"),i.textContent="Various permissions we need to do stuff:",o=b(),u=c("hr"),m=b(),r=c("div"),f=N("Enable one-click upgrade? (implies data collection)"),p=c("br"),_=b(),v=c("a"),h=N("Read more"),d=c("br"),g=b(),k=c("label"),P=c("input"),E=N(" Yes"),R=c("label"),j=c("input"),y=N(" No"),A=c("br"),ne=b(),B=c("div"),B.innerHTML='',F=b(),ae(H.$$.fragment),a(v,"href",jt("Data-collection-on-one-click-firmware-upgrade")),a(v,"target","_blank"),a(v,"class","text-blue-600 hover:text-blue-800"),a(P,"type","radio"),a(P,"name","sf"),P.value=1,P.checked=T=t[0].fwconsent===1,a(P,"class","rounded m-2"),P.required=!0,a(j,"type","radio"),a(j,"name","sf"),j.value=2,j.checked=O=t[0].fwconsent===2,a(j,"class","rounded m-2"),j.required=!0,a(r,"class","my-3"),a(B,"class","my-3"),a(n,"autocomplete","off"),a(l,"class","cnt"),a(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(x,G){S(x,e,G),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,m),s(n,r),s(r,f),s(r,p),s(r,_),s(r,v),s(v,h),s(r,d),s(r,g),s(r,k),s(k,P),s(k,E),s(r,R),s(R,j),s(R,y),s(r,A),s(n,ne),s(n,B),S(x,F,G),se(H,x,G),W=!0,K||(Y=X(n,"submit",Mi(t[2])),K=!0)},p(x,[G]){(!W||G&1&&T!==(T=x[0].fwconsent===1))&&(P.checked=T),(!W||G&1&&O!==(O=x[0].fwconsent===2))&&(j.checked=O);const z={};G&2&&(z.active=x[1]),H.$set(z)},i(x){W||(L(H.$$.fragment,x),W=!0)},o(x){U(H.$$.fragment,x),W=!1},d(x){x&&C(e),x&&C(F),oe(H,x),K=!1,Y()}}}function vp(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(m){l(1,o=!0);const r=new FormData(m.target),f=new URLSearchParams;for(let v of r){const[h,d]=v;f.append(h,d)}let _=await(await fetch("save",{method:"POST",body:f})).json();l(1,o=!1),Yt.update(v=>(v.fwconsent=r.sf===!0?1:r.sf===!1?2:0,v.booting=_.reboot,v)),cn(n)}return t.$$set=m=>{"basepath"in m&&l(3,n=m.basepath),"sysinfo"in m&&l(0,i=m.sysinfo)},[i,o,u,n]}class bp extends je{constructor(e){super(),Ue(this,e,vp,hp,Ie,{basepath:3,sysinfo:0})}}function ic(t,e,l){const n=t.slice();return n[23]=e[l],n[24]=e,n[25]=l,n}function sc(t,e,l){const n=t.slice();return n[26]=e[l],n[28]=l,n}function gp(t,e,l){const n=t.slice();return n[26]=e[l],n[28]=l,n}function oc(t,e,l){const n=t.slice();return n[26]=e[l],n[28]=l,n}function kp(t,e,l){const n=t.slice();return n[26]=e[l],n[28]=l,n}function ac(t,e,l){const n=t.slice();return n[26]=e[l],n[28]=l,n}function rc(t,e,l){const n=t.slice();return n[26]=e[l],n[28]=l,n}function uc(t,e,l){const n=t.slice();return n[26]=e[l],n[28]=l,n}function fc(t,e,l){const n=t.slice();return n[26]=e[l],n[28]=l,n}function cc(t){let e,l,n=t[0].o,i=[];for(let u=0;uU(i[u],1,1,()=>{i[u]=null});return{c(){for(let u=0;uSave',R=b(),ae(j.$$.fragment),O=b(),ae(y.$$.fragment),a(l,"class","text-sm"),a(i,"href",jt("Price-configuration")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"class","m-3"),a(p,"type","hidden"),a(p,"name","r"),p.value="true",a(g,"type","button"),a(g,"class","btn-pri"),a(P,"class","text-center"),a(E,"class","text-right"),a(h,"class","grid grid-cols-3"),a(f,"autocomplete","off"),a(e,"class","cnt")},m(H,W){S(H,e,W),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(f,_),F&&F.m(f,null),s(f,v),s(f,h),s(h,d),s(d,g),s(h,k),s(h,P),s(h,T),s(h,E),S(H,R,W),se(j,H,W),S(H,O,W),se(y,H,W),A=!0,ne||(B=[X(g,"click",t[6]),X(f,"submit",Mi(t[4]))],ne=!0)},p(H,W){H[0].o?F?(F.p(H,W),W[0]&1&&L(F,1)):(F=cc(H),F.c(),L(F,1),F.m(f,v)):F&&(Fe(),U(F,1,1,()=>{F=null}),Be());const K={};W[0]&2&&(K.active=H[1]),j.$set(K);const Y={};W[0]&4&&(Y.active=H[2]),y.$set(Y)},i(H){A||(L(o.$$.fragment,H),L(F),L(j.$$.fragment,H),L(y.$$.fragment,H),A=!0)},o(H){U(o.$$.fragment,H),U(F),U(j.$$.fragment,H),U(y.$$.fragment,H),A=!1},d(H){H&&C(e),oe(o),F&&F.d(),H&&C(R),oe(j,H),H&&C(O),oe(y,H),ne=!1,lt(B)}}}function Sp(t,e,l){let{basepath:n="/"}=e,i=["mo","tu","we","th","fr","sa","su"],o={},u=!0,m=!1;_1.subscribe(B=>{B.o&&(l(0,o=B),l(1,u=!1))}),u_();async function r(B){l(2,m=!0);const F=new URLSearchParams;F.append("r","true"),F.append("rc",o.o.length),o.o.forEach(function(W,K){F.append("rt"+K,W.t),F.append("rn"+K,W.n),F.append("rd"+K,W.d),F.append("ra"+K,W.a),F.append("rh"+K,W.h),F.append("rv"+K,W.v),F.append("rsm"+K,W.s.m),F.append("rsd"+K,W.s.d),F.append("rem"+K,W.e.m),F.append("red"+K,W.e.d)}),await(await fetch("save",{method:"POST",body:F})).json(),l(2,m=!1),cn(n+"configuration")}let f=function(B,F){return B.includes(F)?B=B.filter(function(H){return H!==F}):B.push(F),B},p=function(){let B=o.o;B.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(0,o.o=B,o)},_=function(B){let F=o.o;F.splice(B,1),l(0,o.o=F,o)};function v(B,F){B[F].n=this.value,l(0,o)}function h(B,F){B[F].d=st(this),l(0,o)}function d(B,F){B[F].t=st(this),l(0,o)}function g(B,F){B[F].v=ye(this.value),l(0,o)}const k=(B,F,H,W)=>l(0,H[W].a=f(B.a,F),o),P=(B,F,H,W)=>l(0,H[W].h=f(B.h,F),o),T=(B,F,H,W)=>l(0,H[W].h=f(B.h,F+8),o),E=(B,F,H,W)=>l(0,H[W].h=f(B.h,F+16),o);function R(B,F){B[F].s.m=st(this),l(0,o)}function j(B,F){B[F].s.d=st(this),l(0,o)}function O(B,F){B[F].e.m=st(this),l(0,o)}function y(B,F){B[F].e.d=st(this),l(0,o)}const A=B=>_(B),ne=B=>_(B);return t.$$set=B=>{"basepath"in B&&l(8,n=B.basepath)},[o,u,m,i,r,f,p,_,n,v,h,d,g,k,P,T,E,R,j,O,y,A,ne]}class Mp extends je{constructor(e){super(),Ue(this,e,Sp,Cp,Ie,{basepath:8},null,[-1,-1])}}function Tp(t){let e,l;return e=new a_({props:{data:t[2],sysinfo:t[1]}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&4&&(o.data=n[2]),i&2&&(o.sysinfo=n[1]),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function $p(t){let e,l;return e=new V_({props:{sysinfo:t[1],basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Np(t){let e,l;return e=new Mp({props:{basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Ep(t){let e,l;return e=new ip({props:{sysinfo:t[1],data:t[2]}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&4&&(o.data=n[2]),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Ap(t){let e,l;return e=new $o({props:{title:"CA",action:"/mqtt-ca"}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:he,i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Pp(t){let e,l;return e=new $o({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:he,i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Dp(t){let e,l;return e=new $o({props:{title:"private key",action:"/mqtt-key"}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:he,i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Lp(t){let e,l;return e=new bp({props:{sysinfo:t[1],basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Rp(t){let e,l;return e=new _p({props:{sysinfo:t[1]}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Ip(t){let e,l;return e=new fp({props:{sysinfo:t[1],basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Op(t){let e,l,n,i,o,u,m,r,f,p,_,v,h,d,g,k,P,T,E,R,j,O;return e=new vm({props:{data:t[2],basepath:t[0]}}),n=new vl({props:{path:"/",$$slots:{default:[Tp]},$$scope:{ctx:t}}}),o=new vl({props:{path:"/configuration",$$slots:{default:[$p]},$$scope:{ctx:t}}}),m=new vl({props:{path:"/priceconfig",$$slots:{default:[Np]},$$scope:{ctx:t}}}),f=new vl({props:{path:"/status",$$slots:{default:[Ep]},$$scope:{ctx:t}}}),_=new vl({props:{path:"/mqtt-ca",$$slots:{default:[Ap]},$$scope:{ctx:t}}}),h=new vl({props:{path:"/mqtt-cert",$$slots:{default:[Pp]},$$scope:{ctx:t}}}),g=new vl({props:{path:"/mqtt-key",$$slots:{default:[Dp]},$$scope:{ctx:t}}}),P=new vl({props:{path:"/consent",$$slots:{default:[Lp]},$$scope:{ctx:t}}}),E=new vl({props:{path:"/setup",$$slots:{default:[Rp]},$$scope:{ctx:t}}}),j=new vl({props:{path:"/vendor",$$slots:{default:[Ip]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment),l=b(),ae(n.$$.fragment),i=b(),ae(o.$$.fragment),u=b(),ae(m.$$.fragment),r=b(),ae(f.$$.fragment),p=b(),ae(_.$$.fragment),v=b(),ae(h.$$.fragment),d=b(),ae(g.$$.fragment),k=b(),ae(P.$$.fragment),T=b(),ae(E.$$.fragment),R=b(),ae(j.$$.fragment)},m(y,A){se(e,y,A),S(y,l,A),se(n,y,A),S(y,i,A),se(o,y,A),S(y,u,A),se(m,y,A),S(y,r,A),se(f,y,A),S(y,p,A),se(_,y,A),S(y,v,A),se(h,y,A),S(y,d,A),se(g,y,A),S(y,k,A),se(P,y,A),S(y,T,A),se(E,y,A),S(y,R,A),se(j,y,A),O=!0},p(y,A){const ne={};A&4&&(ne.data=y[2]),A&1&&(ne.basepath=y[0]),e.$set(ne);const B={};A&14&&(B.$$scope={dirty:A,ctx:y}),n.$set(B);const F={};A&11&&(F.$$scope={dirty:A,ctx:y}),o.$set(F);const H={};A&9&&(H.$$scope={dirty:A,ctx:y}),m.$set(H);const W={};A&14&&(W.$$scope={dirty:A,ctx:y}),f.$set(W);const K={};A&8&&(K.$$scope={dirty:A,ctx:y}),_.$set(K);const Y={};A&8&&(Y.$$scope={dirty:A,ctx:y}),h.$set(Y);const x={};A&8&&(x.$$scope={dirty:A,ctx:y}),g.$set(x);const G={};A&11&&(G.$$scope={dirty:A,ctx:y}),P.$set(G);const z={};A&10&&(z.$$scope={dirty:A,ctx:y}),E.$set(z);const ee={};A&11&&(ee.$$scope={dirty:A,ctx:y}),j.$set(ee)},i(y){O||(L(e.$$.fragment,y),L(n.$$.fragment,y),L(o.$$.fragment,y),L(m.$$.fragment,y),L(f.$$.fragment,y),L(_.$$.fragment,y),L(h.$$.fragment,y),L(g.$$.fragment,y),L(P.$$.fragment,y),L(E.$$.fragment,y),L(j.$$.fragment,y),O=!0)},o(y){U(e.$$.fragment,y),U(n.$$.fragment,y),U(o.$$.fragment,y),U(m.$$.fragment,y),U(f.$$.fragment,y),U(_.$$.fragment,y),U(h.$$.fragment,y),U(g.$$.fragment,y),U(P.$$.fragment,y),U(E.$$.fragment,y),U(j.$$.fragment,y),O=!1},d(y){oe(e,y),y&&C(l),oe(n,y),y&&C(i),oe(o,y),y&&C(u),oe(m,y),y&&C(r),oe(f,y),y&&C(p),oe(_,y),y&&C(v),oe(h,y),y&&C(d),oe(g,y),y&&C(k),oe(P,y),y&&C(T),oe(E,y),y&&C(R),oe(j,y)}}}function Fp(t){let e,l,n,i;const o=[Up,qp],u=[];function m(r,f){return r[1].trying?0:1}return e=m(t),l=u[e]=o[e](t),{c(){l.c(),n=nt()},m(r,f){u[e].m(r,f),S(r,n,f),i=!0},p(r,f){let p=e;e=m(r),e===p?u[e].p(r,f):(Fe(),U(u[p],1,1,()=>{u[p]=null}),Be(),l=u[e],l?l.p(r,f):(l=u[e]=o[e](r),l.c()),L(l,1),l.m(n.parentNode,n))},i(r){i||(L(l),i=!0)},o(r){U(l),i=!1},d(r){u[e].d(r),r&&C(n)}}}function Bp(t){let e,l;return e=new Tt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:he,i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function qp(t){let e,l;return e=new Tt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:he,i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Up(t){let e,l;return e=new Tt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[1].trying}}),{c(){ae(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.message="Device is booting, please wait. Trying to reach it on "+n[1].trying),e.$set(o)},i(n){l||(L(e.$$.fragment,n),l=!0)},o(n){U(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function jp(t){let e,l,n,i,o,u;l=new Vc({props:{basepath:t[0],$$slots:{default:[Op]},$$scope:{ctx:t}}});const m=[Bp,Fp],r=[];function f(p,_){return p[1].upgrading?0:p[1].booting?1:-1}return~(i=f(t))&&(o=r[i]=m[i](t)),{c(){e=c("div"),ae(l.$$.fragment),n=b(),o&&o.c(),a(e,"class","container mx-auto m-3")},m(p,_){S(p,e,_),se(l,e,null),s(e,n),~i&&r[i].m(e,null),u=!0},p(p,[_]){const v={};_&1&&(v.basepath=p[0]),_&15&&(v.$$scope={dirty:_,ctx:p}),l.$set(v);let h=i;i=f(p),i===h?~i&&r[i].p(p,_):(o&&(Fe(),U(r[h],1,1,()=>{r[h]=null}),Be()),~i?(o=r[i],o?o.p(p,_):(o=r[i]=m[i](p),o.c()),L(o,1),o.m(e,null)):o=null)},i(p){u||(L(l.$$.fragment,p),L(o),u=!0)},o(p){U(l.$$.fragment,p),U(o),u=!1},d(p){p&&C(e),oe(l),~i&&r[i].d()}}}function Hp(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i={};Yt.subscribe(u=>{l(1,i=u),i.vndcfg===!1?cn(n+"vendor"):i.usrcfg===!1?cn(n+"setup"):i.fwconsent===0&&cn(n+"consent"),i.ui.k===1?(console.log("dark"),document.documentElement.classList.add("dark")):i.ui.k===0?(console.log("light"),document.documentElement.classList.remove("dark")):window.matchMedia("(prefers-color-scheme: dark)").matches?(console.log("dark auto"),document.documentElement.classList.add("dark")):(console.log("light auto"),document.documentElement.classList.remove("dark"))}),yo();let o={};return Jc.subscribe(u=>{l(2,o=u)}),[n,i,o]}class Wp extends je{constructor(e){super(),Ue(this,e,Hp,jp,Ie,{})}}new Wp({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/PriceConfig.svelte b/lib/SvelteUi/app/src/lib/PriceConfig.svelte index 0577ebbc..15535e82 100644 --- a/lib/SvelteUi/app/src/lib/PriceConfig.svelte +++ b/lib/SvelteUi/app/src/lib/PriceConfig.svelte @@ -1,6 +1,6 @@