From 8bbe46c5f24a8ff09096d15d0977a3424d4a17a4 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Fri, 29 Aug 2025 13:12:40 +0200 Subject: [PATCH] Maintian "no config" state after vendor config --- lib/AmsConfiguration/src/AmsConfiguration.cpp | 11 ++++++++--- lib/SvelteUi/app/dist/index.js | 2 +- lib/SvelteUi/app/src/lib/VendorPanel.svelte | 2 +- lib/SvelteUi/src/AmsWebServer.cpp | 8 ++++---- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/AmsConfiguration/src/AmsConfiguration.cpp b/lib/AmsConfiguration/src/AmsConfiguration.cpp index b797b9ba..65d12fbb 100644 --- a/lib/AmsConfiguration/src/AmsConfiguration.cpp +++ b/lib/AmsConfiguration/src/AmsConfiguration.cpp @@ -13,13 +13,17 @@ bool AmsConfiguration::getSystemConfig(SystemConfig& config) { EEPROM.begin(EEPROM_SIZE); uint8_t configVersion = EEPROM.read(EEPROM_CONFIG_ADDRESS); - if(configVersion == EEPROM_CHECK_SUM || configVersion == EEPROM_CLEARED_INDICATOR) { + if(configVersion == EEPROM_CHECK_SUM) { EEPROM.get(CONFIG_SYSTEM_START, config); EEPROM.end(); return true; } else { - config.boardType = 0xFF; - config.vendorConfigured = false; + if(configVersion == EEPROM_CLEARED_INDICATOR) { + config.vendorConfigured = true; + } else { + config.vendorConfigured = false; + config.boardType = 0xFF; + } config.userConfigured = false; config.dataCollectionConsent = 0; config.energyspeedometer = 0; @@ -1101,6 +1105,7 @@ bool AmsConfiguration::relocateConfig103() { bool AmsConfiguration::save() { EEPROM.begin(EEPROM_SIZE); + uint8_t configVersion = EEPROM.read(EEPROM_CONFIG_ADDRESS); EEPROM.put(EEPROM_CONFIG_ADDRESS, EEPROM_CHECK_SUM); bool success = EEPROM.commit(); EEPROM.end(); diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index ac424a45..ffe14a10 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -4,4 +4,4 @@ Occurred in: ${i}`:"",a=Qi(t),r=Vf(e)?e(a):e;return`<${a}> ${r}${s}`}const su=t= `),X=p("div"),y=p("input"),K=v(),V=p("input"),U=v(),G=p("input"),u(l,"class","text-sm"),u(a,"href",_l("MQTT-configuration#domoticz")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","o"),f.value="true",u(w,"name","oe"),u(w,"type","text"),u(w,"class","in-f tr w-full"),u(w,"pattern",In),u(_,"class","w-1/2"),u(O,"name","oc"),u(O,"type","text"),u(O,"class","in-l tr w-full"),u(O,"pattern",In),u(R,"class","w-1/2"),u(m,"class","my-1 flex"),u(y,"name","ou1"),u(y,"type","text"),u(y,"class","in-f tr w-1/3"),u(y,"pattern",In),u(V,"name","ou2"),u(V,"type","text"),u(V,"class","in-m tr w-1/3"),u(V,"pattern",In),u(G,"name","ou3"),u(G,"type","text"),u(G,"class","in-l tr w-1/3"),u(G,"pattern",In),u(X,"class","flex"),u(Y,"class","my-1"),u(e,"class","cnt")},m(S,L){P(S,e,L),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,h),o(_,b),o(_,g),o(_,w),H(w,t[6].o.e),o(m,k),o(m,R),o(R,F),o(R,M),o(R,A),o(R,O),H(O,t[6].o.c),o(e,j),o(e,Y),o(Y,T),o(Y,B),o(Y,X),o(X,y),H(y,t[6].o.u1),o(X,K),o(X,V),H(V,t[6].o.u2),o(X,U),o(X,G),H(G,t[6].o.u3),se||(le=[ce(w,"input",t[82]),ce(O,"input",t[83]),ce(y,"input",t[84]),ce(V,"input",t[85]),ce(G,"input",t[86])],se=!0)},p(S,L){var q,z,ee,fe,_e,de,x,he,be,Ae,Pe,Oe;L[0]&4&&n!==(n=(((ee=(z=(q=S[2].conf)==null?void 0:q.mqtt)==null?void 0:z.domoticz)==null?void 0:ee.title)??"Domoticz")+"")&&E(i,n),L[0]&4&&d!==(d=(((de=(_e=(fe=S[2].conf)==null?void 0:fe.mqtt)==null?void 0:_e.domoticz)==null?void 0:de.eidx)??"Electricity IDX")+"")&&E(h,d),L[0]&64&&w.value!==S[6].o.e&&H(w,S[6].o.e),L[0]&4&&I!==(I=(((be=(he=(x=S[2].conf)==null?void 0:x.mqtt)==null?void 0:he.domoticz)==null?void 0:be.cidx)??"Current IDX")+"")&&E(F,I),L[0]&64&&O.value!==S[6].o.c&&H(O,S[6].o.c),L[0]&4&&W!==(W=(((Oe=(Pe=(Ae=S[2].conf)==null?void 0:Ae.mqtt)==null?void 0:Pe.domoticz)==null?void 0:Oe.vidx)??"Voltage IDX")+"")&&E(T,W),L[0]&64&&y.value!==S[6].o.u1&&H(y,S[6].o.u1),L[0]&64&&V.value!==S[6].o.u2&&H(V,S[6].o.u2),L[0]&64&&G.value!==S[6].o.u3&&H(G,S[6].o.u3)},d(S){S&&N(e),se=!1,jt(le)}}}function ua(t){var U,G,se,le,Q,ae,re,ue,ne,pe,oe,J;let e,l,n=(((se=(G=(U=t[2].conf)==null?void 0:U.mqtt)==null?void 0:G.ha)==null?void 0:se.title)??"Home-Assistant")+"",i,s,a,r,f,c,m,_=(((ae=(Q=(le=t[2].conf)==null?void 0:le.mqtt)==null?void 0:Q.ha)==null?void 0:ae.discovery)??"Discovery topic prefix")+"",d,h,b,g,w,k,R=(((ne=(ue=(re=t[2].conf)==null?void 0:re.mqtt)==null?void 0:ue.ha)==null?void 0:ne.hostname)??"Hostname for URL")+"",I,F,M,A,O,j,Y,W=(((J=(oe=(pe=t[2].conf)==null?void 0:pe.mqtt)==null?void 0:oe.ha)==null?void 0:J.tag)??"Name tag")+"",T,B,X,y,K,V;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),d=C(_),h=p("br"),b=v(),g=p("input"),w=v(),k=p("div"),I=C(R),F=p("br"),M=v(),A=p("input"),j=v(),Y=p("div"),T=C(W),B=p("br"),X=v(),y=p("input"),u(l,"class","text-sm"),u(a,"href",_l("MQTT-configuration#home-assistant")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","h"),f.value="true",u(g,"name","ht"),u(g,"type","text"),u(g,"class","in-s"),u(g,"placeholder","homeassistant"),u(g,"pattern",Ll),u(m,"class","my-1"),u(A,"name","hh"),u(A,"type","text"),u(A,"class","in-s"),u(A,"placeholder",O=t[6].g.h+".local"),u(A,"pattern",Ll),u(k,"class","my-1"),u(y,"name","hn"),u(y,"type","text"),u(y,"class","in-s"),u(y,"pattern",Ll),u(Y,"class","my-1"),u(e,"class","cnt")},m($,ke){P($,e,ke),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,d),o(m,h),o(m,b),o(m,g),H(g,t[6].h.t),o(e,w),o(e,k),o(k,I),o(k,F),o(k,M),o(k,A),H(A,t[6].h.h),o(e,j),o(e,Y),o(Y,T),o(Y,B),o(Y,X),o(Y,y),H(y,t[6].h.n),K||(V=[ce(g,"input",t[87]),ce(A,"input",t[88]),ce(y,"input",t[89])],K=!0)},p($,ke){var Ce,D,S,L,q,z,ee,fe,_e,de,x,he;ke[0]&4&&n!==(n=(((S=(D=(Ce=$[2].conf)==null?void 0:Ce.mqtt)==null?void 0:D.ha)==null?void 0:S.title)??"Home-Assistant")+"")&&E(i,n),ke[0]&4&&_!==(_=(((z=(q=(L=$[2].conf)==null?void 0:L.mqtt)==null?void 0:q.ha)==null?void 0:z.discovery)??"Discovery topic prefix")+"")&&E(d,_),ke[0]&64&&g.value!==$[6].h.t&&H(g,$[6].h.t),ke[0]&4&&R!==(R=(((_e=(fe=(ee=$[2].conf)==null?void 0:ee.mqtt)==null?void 0:fe.ha)==null?void 0:_e.hostname)??"Hostname for URL")+"")&&E(I,R),ke[0]&64&&O!==(O=$[6].g.h+".local")&&u(A,"placeholder",O),ke[0]&64&&A.value!==$[6].h.h&&H(A,$[6].h.h),ke[0]&4&&W!==(W=(((he=(x=(de=$[2].conf)==null?void 0:de.mqtt)==null?void 0:x.ha)==null?void 0:he.tag)??"Name tag")+"")&&E(T,W),ke[0]&64&&y.value!==$[6].h.n&&H(y,$[6].h.n)},d($){$&&N(e),K=!1,jt(V)}}}function ra(t){var j,Y,W,T,B,X,y,K;let e,l,n=(((Y=(j=t[2].conf)==null?void 0:j.cloud)==null?void 0:Y.title)??"Cloud connections")+"",i,s,a,r,f,c,m=(T=(W=t[0])==null?void 0:W.features)==null?void 0:T.includes("cloud"),_,d,h,b,g,w=(((X=(B=t[2].conf)==null?void 0:B.cloud)==null?void 0:X.es)??"Energy Speedometer")+"",k,R,I,F,M,A=m&&ca(t),O=((K=(y=t[6])==null?void 0:y.c)==null?void 0:K.es)&&da(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),A&&A.c(),_=v(),d=p("div"),h=p("label"),b=p("input"),g=v(),k=C(w),R=v(),O&&O.c(),u(l,"class","text-sm"),u(a,"href",_l("Cloud")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","c"),f.value="true",u(b,"type","checkbox"),u(b,"class","rounded mb-1"),u(b,"name","ces"),b.__value="true",H(b,b.__value),u(d,"class","my-1"),u(e,"class","cnt")},m(V,U){P(V,e,U),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),A&&A.m(e,null),o(e,_),o(e,d),o(d,h),o(h,b),b.checked=t[6].c.es,o(h,g),o(h,k),o(d,R),O&&O.m(d,null),I=!0,F||(M=ce(b,"change",t[92]),F=!0)},p(V,U){var G,se,le,Q,ae,re,ue,ne;(!I||U[0]&4)&&n!==(n=(((se=(G=V[2].conf)==null?void 0:G.cloud)==null?void 0:se.title)??"Cloud connections")+"")&&E(i,n),U[0]&1&&(m=(Q=(le=V[0])==null?void 0:le.features)==null?void 0:Q.includes("cloud")),m?A?A.p(V,U):(A=ca(V),A.c(),A.m(e,_)):A&&(A.d(1),A=null),U[0]&64&&(b.checked=V[6].c.es),(!I||U[0]&4)&&w!==(w=(((re=(ae=V[2].conf)==null?void 0:ae.cloud)==null?void 0:re.es)??"Energy Speedometer")+"")&&E(k,w),(ne=(ue=V[6])==null?void 0:ue.c)!=null&&ne.es?O?(O.p(V,U),U[0]&64&&Z(O,1)):(O=da(V),O.c(),Z(O,1),O.m(d,null)):O&&(vt(),ie(O,1,1,()=>{O=null}),bt())},i(V){I||(Z(O),I=!0)},o(V){ie(O),I=!1},d(V){V&&N(e),A&&A.d(),O&&O.d(),F=!1,M()}}}function ca(t){var _,d;let e,l,n,i,s=(((d=(_=t[2].conf)==null?void 0:_.cloud)==null?void 0:d.ams)??"AMS reader cloud")+"",a,r,f,c,m=t[6].c.e&&_a(t);return{c(){e=p("div"),l=p("label"),n=p("input"),i=v(),a=C(s),r=v(),m&&m.c(),u(n,"type","checkbox"),u(n,"name","ce"),n.__value="true",H(n,n.__value),u(n,"class","rounded mb-1"),u(e,"class","my-1")},m(h,b){P(h,e,b),o(e,l),o(l,n),n.checked=t[6].c.e,o(l,i),o(l,a),o(e,r),m&&m.m(e,null),f||(c=ce(n,"change",t[90]),f=!0)},p(h,b){var g,w;b[0]&64&&(n.checked=h[6].c.e),b[0]&4&&s!==(s=(((w=(g=h[2].conf)==null?void 0:g.cloud)==null?void 0:w.ams)??"AMS reader cloud")+"")&&E(a,s),h[6].c.e?m?m.p(h,b):(m=_a(h),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},d(h){h&&N(e),m&&m.d(),f=!1,c()}}}function _a(t){let e,l,n,i,s,a,r,f,c,m,_=t[6].c.p==0&&ma(),d=t[5]&&pa(t);return{c(){e=p("div"),l=p("label"),l.textContent="Protocol",n=v(),i=p("select"),_&&_.c(),s=p("option"),s.textContent="TCP",a=p("option"),a.textContent="HTTP",r=v(),d&&d.c(),f=yt(),u(l,"for","cp"),s.__value=1,H(s,s.__value),a.__value=2,H(a,a.__value),u(i,"name","cp"),u(i,"class","in-s"),t[6].c.p===void 0&&At(()=>t[91].call(i)),u(e,"class","ml-6")},m(h,b){P(h,e,b),o(e,l),o(e,n),o(e,i),_&&_.m(i,null),o(i,s),o(i,a),Ke(i,t[6].c.p,!0),P(h,r,b),d&&d.m(h,b),P(h,f,b),c||(m=ce(i,"change",t[91]),c=!0)},p(h,b){h[6].c.p==0?_||(_=ma(),_.c(),_.m(i,s)):_&&(_.d(1),_=null),b[0]&64&&Ke(i,h[6].c.p),h[5]?d?d.p(h,b):(d=pa(h),d.c(),d.m(f.parentNode,f)):d&&(d.d(1),d=null)},d(h){h&&(N(e),N(r),N(f)),_&&_.d(),d&&d.d(h),c=!1,m()}}}function ma(t){let e;return{c(){e=p("option"),e.textContent="UDP",e.__value=0,H(e,e.__value),u(e,"title","No longer recommended")},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function pa(t){let e,l,n;return{c(){e=p("button"),e.textContent="Connect device to my cloud account",u(e,"type","button"),u(e,"class","text-blue-500 ml-6")},m(i,s){P(i,e,s),l||(n=ce(e,"click",t[22]),l=!0)},p:Ye,d(i){i&&N(e),l=!1,n()}}}function da(t){let e,l,n=t[0].mac+"",i,s,a,r,f=(t[0].meter.id?t[0].meter.id:"missing, required")+"",c,m,_,d,h=t[0].mac&&t[0].meter.id&&ha(t);return{c(){e=p("div"),l=C("MAC: "),i=C(n),s=v(),a=p("div"),r=C("Meter ID: "),c=C(f),m=v(),h&&h.c(),_=yt(),u(e,"class","pl-5"),u(a,"class","pl-5")},m(b,g){P(b,e,g),o(e,l),o(e,i),P(b,s,g),P(b,a,g),o(a,r),o(a,c),P(b,m,g),h&&h.m(b,g),P(b,_,g),d=!0},p(b,g){(!d||g[0]&1)&&n!==(n=b[0].mac+"")&&E(i,n),(!d||g[0]&1)&&f!==(f=(b[0].meter.id?b[0].meter.id:"missing, required")+"")&&E(c,f),b[0].mac&&b[0].meter.id?h?(h.p(b,g),g[0]&1&&Z(h,1)):(h=ha(b),h.c(),Z(h,1),h.m(_.parentNode,_)):h&&(vt(),ie(h,1,1,()=>{h=null}),bt())},i(b){d||(Z(h),d=!0)},o(b){ie(h),d=!1},d(b){b&&(N(e),N(s),N(a),N(m),N(_)),h&&h.d(b)}}}function ha(t){let e,l,n;return l=new lc({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=p("div"),Ne(l.$$.fragment),u(e,"class","pl-2")},m(i,s){P(i,e,s),Se(l,e,null),n=!0},p(i,s){const a={};s[0]&1&&(a.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(a)},i(i){n||(Z(l.$$.fragment,i),n=!0)},o(i){ie(l.$$.fragment,i),n=!1},d(i){i&&N(e),Me(l)}}}function va(t){var W,T,B,X,y;let e,l,n=(((T=(W=t[2].conf)==null?void 0:W.thresholds)==null?void 0:T.title)??"Thresholds")+"",i,s,a,r,f,c,m,_,d,h,b=(((X=(B=t[2].conf)==null?void 0:B.thresholds)==null?void 0:X.avg)??"Average of")+"",g,w,k,R,I,F=(((y=t[2].common)==null?void 0:y.hours)??"hours")+"",M,A,O,j=rt({length:9}),Y=[];for(let K=0;Kt[96].call(w)),u(d,"class","w-1/2"),u(m,"class","flex flex-wrap"),u(e,"class","cnt")},m(T,B){P(T,e,B),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m);for(let X=0;X20&&Sa(t),d=((R=(k=(w=t[6])==null?void 0:w.i)==null?void 0:k.d)==null?void 0:R.d)>0&&Pa(t),h=t[0].chip=="esp8266"&&Ta(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),_&&_.c(),f=v(),d&&d.c(),c=v(),h&&h.c(),u(l,"class","text-sm"),u(a,"href",_l("GPIO-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(e,"class","cnt")},m(I,F){P(I,e,F),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),_&&_.m(e,null),o(e,f),d&&d.m(e,null),o(e,c),h&&h.m(e,null),m=!0},p(I,F){var M,A,O,j,Y;(!m||F[0]&4)&&n!==(n=(((A=(M=I[2].conf)==null?void 0:M.hw)==null?void 0:A.title)??"Hardware")+"")&&E(i,n),I[0].board>20?_?(_.p(I,F),F[0]&1&&Z(_,1)):(_=Sa(I),_.c(),Z(_,1),_.m(e,f)):_&&(vt(),ie(_,1,1,()=>{_=null}),bt()),((Y=(j=(O=I[6])==null?void 0:O.i)==null?void 0:j.d)==null?void 0:Y.d)>0?d?d.p(I,F):(d=Pa(I),d.c(),d.m(e,c)):d&&(d.d(1),d=null),I[0].chip=="esp8266"?h?h.p(I,F):(h=Ta(I),h.c(),h.m(e,null)):h&&(h.d(1),h=null)},i(I){m||(Z(_),m=!0)},o(I){ie(_),m=!1},d(I){I&&N(e),_&&_.d(),d&&d.d(),h&&h.d()}}}function Sa(t){var qt,Wt,wt,_t,zt,Xt,Ut,Ht,Yt,$t,Gt,It,Fe,Xe,je,Dt,Bt,$e,st,Et,pt,ge,nt,ze,el,tl,ll,nl,il,sl,Ze,dt,Te;let e,l,n,i,s=(((wt=(Wt=(qt=t[2].conf)==null?void 0:qt.hw)==null?void 0:Wt.han)==null?void 0:wt.rx)??"HAN RX")+"",a,r,f,c,m,_,d,h=(((Xt=(zt=(_t=t[2].conf)==null?void 0:_t.hw)==null?void 0:zt.han)==null?void 0:Xt.tx)??"HAN TX")+"",b,g,w,k,R,I,F,M,A,O,j=(((Yt=(Ht=(Ut=t[2].conf)==null?void 0:Ut.hw)==null?void 0:Ht.han)==null?void 0:Yt.pullup)??"pullup")+"",Y,W,T,B,X=(((Gt=($t=t[2].conf)==null?void 0:$t.hw)==null?void 0:Gt.ap_btn)??"AP button")+"",y,K,V,U,G,se,le=(((Xe=(Fe=(It=t[2].conf)==null?void 0:It.hw)==null?void 0:Fe.led)==null?void 0:Xe.title)??"LED")+"",Q,ae,re,ue,ne,pe,oe,J,$,ke,Ce=(((Bt=(Dt=(je=t[2].conf)==null?void 0:je.hw)==null?void 0:Dt.led)==null?void 0:Bt.inverted)??"inverted")+"",D,S,L,q=(((Et=(st=($e=t[2].conf)==null?void 0:$e.hw)==null?void 0:st.led)==null?void 0:Et.rgb)??"RGB")+"",z,ee,fe,_e,de=(((nt=(ge=(pt=t[2].conf)==null?void 0:pt.hw)==null?void 0:ge.led)==null?void 0:nt.inverted)??"inverted")+"",x,he,be,Ae,Pe,Oe,Le,De,Ue,xe,Ct,tt,ot=(((tl=(el=(ze=t[2].conf)==null?void 0:ze.hw)==null?void 0:el.led)==null?void 0:tl.disable)??"LED dis. GPIO")+"",Mt,ht,at,it,ft,Lt=(((nl=(ll=t[2].conf)==null?void 0:ll.hw)==null?void 0:nl.temp)??"Temperature")+"",We,Re,He,lt,ve,Ee,Qe=(((sl=(il=t[2].conf)==null?void 0:il.hw)==null?void 0:sl.temp_analog)??"Analog temp")+"",me,we,ut,Ge,Ft,gt,Be,kt,ct;m=new Bi({props:{chip:t[0].chip}}),R=new Bi({props:{chip:t[0].chip}});let mt=t[0].chip!="esp8266"&&Ma(t),et=((Te=(dt=(Ze=t[6])==null?void 0:Ze.i)==null?void 0:dt.v)==null?void 0:Te.p)>0&&Na(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=C(s),r=p("br"),f=v(),c=p("select"),Ne(m.$$.fragment),_=v(),d=p("div"),b=C(h),g=p("br"),w=v(),k=p("select"),Ne(R.$$.fragment),I=v(),F=p("div"),M=p("label"),A=p("input"),O=v(),Y=C(j),W=v(),T=p("div"),B=p("div"),y=C(X),K=p("br"),V=v(),U=p("input"),G=v(),se=p("div"),Q=C(le),ae=p("br"),re=v(),ue=p("div"),ne=p("input"),pe=v(),oe=p("div"),J=p("label"),$=p("input"),ke=v(),D=C(Ce),S=v(),L=p("div"),z=C(q),ee=p("label"),fe=p("input"),_e=v(),x=C(de),he=p("br"),be=v(),Ae=p("div"),Pe=p("input"),Oe=v(),Le=p("input"),De=v(),Ue=p("input"),xe=v(),Ct=p("div"),tt=p("div"),Mt=C(ot),ht=v(),at=p("input"),it=v(),ft=p("div"),We=C(Lt),Re=p("br"),He=v(),lt=p("input"),ve=v(),Ee=p("div"),me=C(Qe),we=p("br"),ut=v(),Ge=p("input"),Ft=v(),mt&&mt.c(),gt=v(),et&&et.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(c,"name","ihp"),u(c,"class","in-f w-full"),t[6].i.h.p===void 0&&At(()=>t[97].call(c)),u(i,"class","w-1/3"),u(k,"name","iht"),u(k,"class","in-l w-full"),t[6].i.h.t===void 0&&At(()=>t[98].call(k)),u(d,"class","w-1/3"),u(A,"name","ihu"),A.__value="true",H(A,A.__value),u(A,"type","checkbox"),u(A,"class","rounded mb-1"),u(M,"class","ml-2"),u(F,"class","w-1/3"),u(n,"class","flex flex-wrap"),u(U,"name","ia"),u(U,"type","number"),u(U,"min","0"),u(U,"max",t[12]),u(U,"class","in-f tr w-full"),u(B,"class","w-1/3"),u(ne,"name","ilp"),u(ne,"type","number"),u(ne,"min","0"),u(ne,"max",t[12]),u(ne,"class","in-l tr w-full"),u(ue,"class","flex"),u(se,"class","w-1/3"),u($,"name","ili"),$.__value="true",H($,$.__value),u($,"type","checkbox"),u($,"class","rounded mb-1"),u(J,"class","ml-4"),u(oe,"class","w-1/3"),u(fe,"name","iri"),fe.__value="true",H(fe,fe.__value),u(fe,"type","checkbox"),u(fe,"class","rounded mb-1"),u(ee,"class","ml-4"),u(Pe,"name","irr"),u(Pe,"type","number"),u(Pe,"min","0"),u(Pe,"max",t[12]),u(Pe,"class","in-f tr w-1/3"),u(Le,"name","irg"),u(Le,"type","number"),u(Le,"min","0"),u(Le,"max",t[12]),u(Le,"class","in-m tr w-1/3"),u(Ue,"name","irb"),u(Ue,"type","number"),u(Ue,"min","0"),u(Ue,"max",t[12]),u(Ue,"class","in-l tr w-1/3"),u(Ae,"class","flex"),u(L,"class","w-full"),u(at,"name","idd"),u(at,"type","number"),u(at,"min","0"),u(at,"max",t[12]),u(at,"class","in-s tr"),u(tt,"class","my-1 pr-1 w-1/3"),u(Ct,"class","w-full"),u(lt,"name","itd"),u(lt,"type","number"),u(lt,"min","0"),u(lt,"max",t[12]),u(lt,"class","in-f tr w-full"),u(ft,"class","my-1 w-1/3"),u(Ge,"name","ita"),u(Ge,"type","number"),u(Ge,"min","0"),u(Ge,"max",t[12]),u(Ge,"class","in-l tr w-full"),u(Ee,"class","my-1 pr-1 w-1/3"),u(T,"class","flex flex-wrap")},m(te,Ie){P(te,e,Ie),P(te,l,Ie),P(te,n,Ie),o(n,i),o(i,a),o(i,r),o(i,f),o(i,c),Se(m,c,null),Ke(c,t[6].i.h.p,!0),o(n,_),o(n,d),o(d,b),o(d,g),o(d,w),o(d,k),Se(R,k,null),Ke(k,t[6].i.h.t,!0),o(n,I),o(n,F),o(F,M),o(M,A),A.checked=t[6].i.h.u,o(M,O),o(M,Y),P(te,W,Ie),P(te,T,Ie),o(T,B),o(B,y),o(B,K),o(B,V),o(B,U),H(U,t[6].i.a),o(T,G),o(T,se),o(se,Q),o(se,ae),o(se,re),o(se,ue),o(ue,ne),H(ne,t[6].i.l.p),o(T,pe),o(T,oe),o(oe,J),o(J,$),$.checked=t[6].i.l.i,o(J,ke),o(J,D),o(T,S),o(T,L),o(L,z),o(L,ee),o(ee,fe),fe.checked=t[6].i.r.i,o(ee,_e),o(ee,x),o(L,he),o(L,be),o(L,Ae),o(Ae,Pe),H(Pe,t[6].i.r.r),o(Ae,Oe),o(Ae,Le),H(Le,t[6].i.r.g),o(Ae,De),o(Ae,Ue),H(Ue,t[6].i.r.b),o(T,xe),o(T,Ct),o(Ct,tt),o(tt,Mt),o(tt,ht),o(tt,at),H(at,t[6].i.d.d),o(T,it),o(T,ft),o(ft,We),o(ft,Re),o(ft,He),o(ft,lt),H(lt,t[6].i.t.d),o(T,ve),o(T,Ee),o(Ee,me),o(Ee,we),o(Ee,ut),o(Ee,Ge),H(Ge,t[6].i.t.a),o(T,Ft),mt&&mt.m(T,null),o(T,gt),et&&et.m(T,null),Be=!0,kt||(ct=[ce(c,"change",t[97]),ce(k,"change",t[98]),ce(A,"change",t[99]),ce(U,"input",t[100]),ce(ne,"input",t[101]),ce($,"change",t[102]),ce(fe,"change",t[103]),ce(Pe,"input",t[104]),ce(Le,"input",t[105]),ce(Ue,"input",t[106]),ce(at,"input",t[107]),ce(lt,"input",t[108]),ce(Ge,"input",t[109])],kt=!0)},p(te,Ie){var ml,gl,kl,wl,Cl,Sl,Ml,Il,Rl,Fl,Ve,qe,Rt,al,Ul,Bl,jl,Hl,yl,zl,Wl,Gl,Vl,Kl,Yl,Ql,Xl,Zl,Jl,$l,xl,en,tn;(!Be||Ie[0]&4)&&s!==(s=(((kl=(gl=(ml=te[2].conf)==null?void 0:ml.hw)==null?void 0:gl.han)==null?void 0:kl.rx)??"HAN RX")+"")&&E(a,s);const Zt={};Ie[0]&1&&(Zt.chip=te[0].chip),m.$set(Zt),Ie[0]&64&&Ke(c,te[6].i.h.p),(!Be||Ie[0]&4)&&h!==(h=(((Sl=(Cl=(wl=te[2].conf)==null?void 0:wl.hw)==null?void 0:Cl.han)==null?void 0:Sl.tx)??"HAN TX")+"")&&E(b,h);const fl={};Ie[0]&1&&(fl.chip=te[0].chip),R.$set(fl),Ie[0]&64&&Ke(k,te[6].i.h.t),Ie[0]&64&&(A.checked=te[6].i.h.u),(!Be||Ie[0]&4)&&j!==(j=(((Rl=(Il=(Ml=te[2].conf)==null?void 0:Ml.hw)==null?void 0:Il.han)==null?void 0:Rl.pullup)??"pullup")+"")&&E(Y,j),(!Be||Ie[0]&4)&&X!==(X=(((Ve=(Fl=te[2].conf)==null?void 0:Fl.hw)==null?void 0:Ve.ap_btn)??"AP button")+"")&&E(y,X),(!Be||Ie[0]&4096)&&u(U,"max",te[12]),Ie[0]&64&&ye(U.value)!==te[6].i.a&&H(U,te[6].i.a),(!Be||Ie[0]&4)&&le!==(le=(((al=(Rt=(qe=te[2].conf)==null?void 0:qe.hw)==null?void 0:Rt.led)==null?void 0:al.title)??"LED")+"")&&E(Q,le),(!Be||Ie[0]&4096)&&u(ne,"max",te[12]),Ie[0]&64&&ye(ne.value)!==te[6].i.l.p&&H(ne,te[6].i.l.p),Ie[0]&64&&($.checked=te[6].i.l.i),(!Be||Ie[0]&4)&&Ce!==(Ce=(((jl=(Bl=(Ul=te[2].conf)==null?void 0:Ul.hw)==null?void 0:Bl.led)==null?void 0:jl.inverted)??"inverted")+"")&&E(D,Ce),(!Be||Ie[0]&4)&&q!==(q=(((zl=(yl=(Hl=te[2].conf)==null?void 0:Hl.hw)==null?void 0:yl.led)==null?void 0:zl.rgb)??"RGB")+"")&&E(z,q),Ie[0]&64&&(fe.checked=te[6].i.r.i),(!Be||Ie[0]&4)&&de!==(de=(((Vl=(Gl=(Wl=te[2].conf)==null?void 0:Wl.hw)==null?void 0:Gl.led)==null?void 0:Vl.inverted)??"inverted")+"")&&E(x,de),(!Be||Ie[0]&4096)&&u(Pe,"max",te[12]),Ie[0]&64&&ye(Pe.value)!==te[6].i.r.r&&H(Pe,te[6].i.r.r),(!Be||Ie[0]&4096)&&u(Le,"max",te[12]),Ie[0]&64&&ye(Le.value)!==te[6].i.r.g&&H(Le,te[6].i.r.g),(!Be||Ie[0]&4096)&&u(Ue,"max",te[12]),Ie[0]&64&&ye(Ue.value)!==te[6].i.r.b&&H(Ue,te[6].i.r.b),(!Be||Ie[0]&4)&&ot!==(ot=(((Ql=(Yl=(Kl=te[2].conf)==null?void 0:Kl.hw)==null?void 0:Yl.led)==null?void 0:Ql.disable)??"LED dis. GPIO")+"")&&E(Mt,ot),(!Be||Ie[0]&4096)&&u(at,"max",te[12]),Ie[0]&64&&ye(at.value)!==te[6].i.d.d&&H(at,te[6].i.d.d),(!Be||Ie[0]&4)&&Lt!==(Lt=(((Zl=(Xl=te[2].conf)==null?void 0:Xl.hw)==null?void 0:Zl.temp)??"Temperature")+"")&&E(We,Lt),(!Be||Ie[0]&4096)&&u(lt,"max",te[12]),Ie[0]&64&&ye(lt.value)!==te[6].i.t.d&&H(lt,te[6].i.t.d),(!Be||Ie[0]&4)&&Qe!==(Qe=((($l=(Jl=te[2].conf)==null?void 0:Jl.hw)==null?void 0:$l.temp_analog)??"Analog temp")+"")&&E(me,Qe),(!Be||Ie[0]&4096)&&u(Ge,"max",te[12]),Ie[0]&64&&ye(Ge.value)!==te[6].i.t.a&&H(Ge,te[6].i.t.a),te[0].chip!="esp8266"?mt?mt.p(te,Ie):(mt=Ma(te),mt.c(),mt.m(T,gt)):mt&&(mt.d(1),mt=null),((tn=(en=(xl=te[6])==null?void 0:xl.i)==null?void 0:en.v)==null?void 0:tn.p)>0?et?et.p(te,Ie):(et=Na(te),et.c(),et.m(T,null)):et&&(et.d(1),et=null)},i(te){Be||(Z(m.$$.fragment,te),Z(R.$$.fragment,te),Be=!0)},o(te){ie(m.$$.fragment,te),ie(R.$$.fragment,te),Be=!1},d(te){te&&(N(e),N(l),N(n),N(W),N(T)),Me(m),Me(R),mt&&mt.d(),et&&et.d(),kt=!1,jt(ct)}}}function Ma(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.title)??"Vcc")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","ivp"),u(a,"type","number"),u(a,"min","0"),u(a,"max",t[12]),u(a,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(d,h){P(d,e,h),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].i.v.p),r||(f=ce(a,"input",t[110]),r=!0)},p(d,h){var b,g,w;h[0]&4&&l!==(l=(((w=(g=(b=d[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:w.title)??"Vcc")+"")&&E(n,l),h[0]&4096&&u(a,"max",d[12]),h[0]&64&&ye(a.value)!==d[6].i.v.p&&H(a,d[6].i.v.p)},d(d){d&&N(e),r=!1,f()}}}function Na(t){var b,g,w;let e,l=(((w=(g=(b=t[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:w.divider)??"Voltage divider")+"",n,i,s,a,r,f,c,m,_,d,h;return{c(){var k,R,I,F,M,A;e=p("div"),n=C(l),i=p("br"),s=v(),a=p("div"),r=p("input"),c=v(),m=p("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"placeholder",f=((I=(R=(k=t[2].conf)==null?void 0:k.hw)==null?void 0:R.vcc)==null?void 0:I.div_vcc)??"VCC"),u(m,"name","ivdg"),u(m,"type","number"),u(m,"min","0"),u(m,"max","65535"),u(m,"class","in-l tr w-full"),u(m,"placeholder",_=((A=(M=(F=t[2].conf)==null?void 0:F.hw)==null?void 0:M.vcc)==null?void 0:A.div_gnd)??"GND"),u(a,"class","flex"),u(e,"class","my-1")},m(k,R){P(k,e,R),o(e,n),o(e,i),o(e,s),o(e,a),o(a,r),H(r,t[6].i.v.d.v),o(a,c),o(a,m),H(m,t[6].i.v.d.g),d||(h=[ce(r,"input",t[111]),ce(m,"input",t[112])],d=!0)},p(k,R){var I,F,M,A,O,j,Y,W,T;R[0]&4&&l!==(l=(((M=(F=(I=k[2].conf)==null?void 0:I.hw)==null?void 0:F.vcc)==null?void 0:M.divider)??"Voltage divider")+"")&&E(n,l),R[0]&4&&f!==(f=((j=(O=(A=k[2].conf)==null?void 0:A.hw)==null?void 0:O.vcc)==null?void 0:j.div_vcc)??"VCC")&&u(r,"placeholder",f),R[0]&64&&ye(r.value)!==k[6].i.v.d.v&&H(r,k[6].i.v.d.v),R[0]&4&&_!==(_=((T=(W=(Y=k[2].conf)==null?void 0:Y.hw)==null?void 0:W.vcc)==null?void 0:T.div_gnd)??"GND")&&u(m,"placeholder",_),R[0]&64&&ye(m.value)!==k[6].i.v.d.g&&H(m,k[6].i.v.d.g)},d(k){k&&N(e),d=!1,jt(h)}}}function Pa(t){var b,g,w,k,R,I,F,M,A,O,j,Y;let e,l=(((k=(w=(g=(b=t[2].conf)==null?void 0:b.hw)==null?void 0:g.led)==null?void 0:w.behaviour)==null?void 0:k.title)??"LED behaviour")+"",n,i,s,a,r=(((M=(F=(I=(R=t[2].conf)==null?void 0:R.hw)==null?void 0:I.led)==null?void 0:F.behaviour)==null?void 0:M.enabled)??"Enabled")+"",f,c,m=(((Y=(j=(O=(A=t[2].conf)==null?void 0:A.hw)==null?void 0:O.led)==null?void 0:j.behaviour)==null?void 0:Y.disabled)??"Disabled")+"",_,d,h;return{c(){e=p("div"),n=C(l),i=v(),s=p("select"),a=p("option"),f=C(r),c=p("option"),_=C(m),a.__value=0,H(a,a.__value),c.__value=1,H(c,c.__value),u(s,"name","idb"),u(s,"class","in-s"),t[6].i.d.b===void 0&&At(()=>t[113].call(s)),u(e,"class","my-1 w-full")},m(W,T){P(W,e,T),o(e,n),o(e,i),o(e,s),o(s,a),o(a,f),o(s,c),o(c,_),Ke(s,t[6].i.d.b,!0),d||(h=ce(s,"change",t[113]),d=!0)},p(W,T){var B,X,y,K,V,U,G,se,le,Q,ae,re;T[0]&4&&l!==(l=(((K=(y=(X=(B=W[2].conf)==null?void 0:B.hw)==null?void 0:X.led)==null?void 0:y.behaviour)==null?void 0:K.title)??"LED behaviour")+"")&&E(n,l),T[0]&4&&r!==(r=(((se=(G=(U=(V=W[2].conf)==null?void 0:V.hw)==null?void 0:U.led)==null?void 0:G.behaviour)==null?void 0:se.enabled)??"Enabled")+"")&&E(f,r),T[0]&4&&m!==(m=(((re=(ae=(Q=(le=W[2].conf)==null?void 0:le.hw)==null?void 0:Q.led)==null?void 0:ae.behaviour)==null?void 0:re.disabled)??"Disabled")+"")&&E(_,m),T[0]&64&&Ke(s,W[6].i.d.b)},d(W){W&&N(e),d=!1,h()}}}function Ta(t){var M,A,O,j,Y,W;let e,l,n,i,s=(((O=(A=(M=t[2].conf)==null?void 0:M.hw)==null?void 0:A.vcc)==null?void 0:O.offset)??"Vcc offset")+"",a,r,f,c,m,_,d=(((W=(Y=(j=t[2].conf)==null?void 0:j.hw)==null?void 0:Y.vcc)==null?void 0:W.multiplier)??"Multiplier")+"",h,b,g,w,k,R,I,F=(t[0].board==2||t[0].board==100)&&qa(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=C(s),r=p("br"),f=v(),c=p("input"),m=v(),_=p("div"),h=C(d),b=p("br"),g=v(),w=p("input"),k=v(),F&&F.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(c,"name","ivo"),u(c,"type","number"),u(c,"min","0.0"),u(c,"max","3.5"),u(c,"step","0.01"),u(c,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(w,"name","ivm"),u(w,"type","number"),u(w,"min","0.1"),u(w,"max","10"),u(w,"step","0.01"),u(w,"class","in-l tr w-full"),u(_,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(T,B){P(T,e,B),P(T,l,B),P(T,n,B),o(n,i),o(i,a),o(i,r),o(i,f),o(i,c),H(c,t[6].i.v.o),o(n,m),o(n,_),o(_,h),o(_,b),o(_,g),o(_,w),H(w,t[6].i.v.m),o(n,k),F&&F.m(n,null),R||(I=[ce(c,"input",t[114]),ce(w,"input",t[115])],R=!0)},p(T,B){var X,y,K,V,U,G;B[0]&4&&s!==(s=(((K=(y=(X=T[2].conf)==null?void 0:X.hw)==null?void 0:y.vcc)==null?void 0:K.offset)??"Vcc offset")+"")&&E(a,s),B[0]&64&&ye(c.value)!==T[6].i.v.o&&H(c,T[6].i.v.o),B[0]&4&&d!==(d=(((G=(U=(V=T[2].conf)==null?void 0:V.hw)==null?void 0:U.vcc)==null?void 0:G.multiplier)??"Multiplier")+"")&&E(h,d),B[0]&64&&ye(w.value)!==T[6].i.v.m&&H(w,T[6].i.v.m),T[0].board==2||T[0].board==100?F?F.p(T,B):(F=qa(T),F.c(),F.m(n,null)):F&&(F.d(1),F=null)},d(T){T&&(N(e),N(l),N(n)),F&&F.d(),R=!1,jt(I)}}}function qa(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.boot)??"Boot limit")+"",n,i,s,a,r,f;return{c(){e=p("div"),n=C(l),i=p("br"),s=v(),a=p("input"),u(a,"name","ivb"),u(a,"type","number"),u(a,"min","2.5"),u(a,"max","3.5"),u(a,"step","0.1"),u(a,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(d,h){P(d,e,h),o(e,n),o(e,i),o(e,s),o(e,a),H(a,t[6].i.v.b),r||(f=ce(a,"input",t[116]),r=!0)},p(d,h){var b,g,w;h[0]&4&&l!==(l=(((w=(g=(b=d[2].conf)==null?void 0:b.hw)==null?void 0:g.vcc)==null?void 0:w.boot)??"Boot limit")+"")&&E(n,l),h[0]&64&&ye(a.value)!==d[6].i.v.b&&H(a,d[6].i.v.b)},d(d){d&&N(e),r=!1,f()}}}function Ea(t){var F,M,A,O,j,Y;let e,l,n=(((M=(F=t[2].conf)==null?void 0:F.debug)==null?void 0:M.title)??"Debugging")+"",i,s,a,r,f,c,m,_,d,h,b=(((O=(A=t[2].conf)==null?void 0:A.debug)==null?void 0:O.enable)??"Enable debugging")+"",g,w,k,R,I=((Y=(j=t[6])==null?void 0:j.d)==null?void 0:Y.s)&&Da(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("label"),d=p("input"),h=v(),g=C(b),w=v(),I&&I.c(),u(l,"class","text-sm"),u(a,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","d"),f.value="true",u(d,"type","checkbox"),u(d,"name","ds"),d.__value="true",H(d,d.__value),u(d,"class","rounded mb-1"),u(m,"class","mt-3"),u(e,"class","cnt")},m(W,T){P(W,e,T),o(e,l),o(l,i),o(e,s),o(e,a),o(e,r),o(e,f),o(e,c),o(e,m),o(m,_),o(_,d),d.checked=t[6].d.s,o(_,h),o(_,g),o(e,w),I&&I.m(e,null),k||(R=ce(d,"change",t[117]),k=!0)},p(W,T){var B,X,y,K,V,U;T[0]&4&&n!==(n=(((X=(B=W[2].conf)==null?void 0:B.debug)==null?void 0:X.title)??"Debugging")+"")&&E(i,n),T[0]&64&&(d.checked=W[6].d.s),T[0]&4&&b!==(b=(((K=(y=W[2].conf)==null?void 0:y.debug)==null?void 0:K.enable)??"Enable debugging")+"")&&E(g,b),(U=(V=W[6])==null?void 0:V.d)!=null&&U.s?I?I.p(W,T):(I=Da(W),I.c(),I.m(e,null)):I&&(I.d(1),I=null)},d(W){W&&N(e),I&&I.d(),k=!1,R()}}}function Da(t){var A,O,j,Y;let e,l=(((O=(A=t[2].conf)==null?void 0:A.debug)==null?void 0:O.danger)??"Disable when done")+"",n,i,s,a,r,f,c=(((Y=(j=t[2].conf)==null?void 0:j.debug)==null?void 0:Y.telnet)??"Enable telnet")+"",m,_,d,h,b,g,w,k,R,I,F,M=t[6].d.t&&Aa(t);return{c(){e=p("div"),n=C(l),i=v(),s=p("div"),a=p("label"),r=p("input"),f=v(),m=C(c),_=v(),M&&M.c(),d=v(),h=p("div"),b=p("select"),g=p("option"),g.textContent="Verbose",w=p("option"),w.textContent="Debug",k=p("option"),k.textContent="Info",R=p("option"),R.textContent="Warning",u(e,"class","bd-red"),u(r,"type","checkbox"),u(r,"name","dt"),r.__value="true",H(r,r.__value),u(r,"class","rounded mb-1"),u(s,"class","my-1"),g.__value=1,H(g,g.__value),w.__value=2,H(w,w.__value),k.__value=3,H(k,k.__value),R.__value=4,H(R,R.__value),u(b,"name","dl"),u(b,"class","in-s"),t[6].d.l===void 0&&At(()=>t[119].call(b)),u(h,"class","my-1")},m(W,T){P(W,e,T),o(e,n),P(W,i,T),P(W,s,T),o(s,a),o(a,r),r.checked=t[6].d.t,o(a,f),o(a,m),P(W,_,T),M&&M.m(W,T),P(W,d,T),P(W,h,T),o(h,b),o(b,g),o(b,w),o(b,k),o(b,R),Ke(b,t[6].d.l,!0),I||(F=[ce(r,"change",t[118]),ce(b,"change",t[119])],I=!0)},p(W,T){var B,X,y,K;T[0]&4&&l!==(l=(((X=(B=W[2].conf)==null?void 0:B.debug)==null?void 0:X.danger)??"Disable when done")+"")&&E(n,l),T[0]&64&&(r.checked=W[6].d.t),T[0]&4&&c!==(c=(((K=(y=W[2].conf)==null?void 0:y.debug)==null?void 0:K.telnet)??"Enable telnet")+"")&&E(m,c),W[6].d.t?M?M.p(W,T):(M=Aa(W),M.c(),M.m(d.parentNode,d)):M&&(M.d(1),M=null),T[0]&64&&Ke(b,W[6].d.l)},d(W){W&&(N(e),N(i),N(s),N(_),N(d),N(h)),M&&M.d(W),I=!1,jt(F)}}}function Aa(t){var i,s;let e,l=(((s=(i=t[2].conf)==null?void 0:i.debug)==null?void 0:s.telnet_danger)??"Disable when done")+"",n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.debug)==null?void 0:c.telnet_danger)??"Disable when done")+"")&&E(n,l)},d(a){a&&N(e)}}}function Oa(t){var d,h;let e,l,n=(((d=t[2].conf)==null?void 0:d.btn_reset)??"Factory reset")+"",i,s,a,r,f=(((h=t[2].btn)==null?void 0:h.reboot)??"Reboot")+"",c,m,_;return{c(){e=p("div"),l=p("button"),i=C(n),s=v(),a=p("div"),r=p("button"),c=C(f),u(l,"type","button"),u(l,"class","btn-red"),u(r,"type","button"),u(r,"class","btn-yellow"),u(a,"class","text-center")},m(b,g){P(b,e,g),o(e,l),o(l,i),P(b,s,g),P(b,a,g),o(a,r),o(r,c),m||(_=[ce(l,"click",t[14]),ce(r,"click",t[16])],m=!0)},p(b,g){var w,k;g[0]&4&&n!==(n=(((w=b[2].conf)==null?void 0:w.btn_reset)??"Factory reset")+"")&&E(i,n),g[0]&4&&f!==(f=(((k=b[2].btn)==null?void 0:k.reboot)??"Reboot")+"")&&E(c,f)},d(b){b&&(N(e),N(s),N(a)),m=!1,jt(_)}}}function La(t){var s;let e,l,n=(((s=t[2].btn)==null?void 0:s.save)??"Save")+"",i;return{c(){e=p("div"),l=p("button"),i=C(n),u(l,"type","submit"),u(l,"class","btn-pri"),u(e,"class","text-right")},m(a,r){P(a,e,r),o(e,l),o(l,i)},p(a,r){var f;r[0]&4&&n!==(n=(((f=a[2].btn)==null?void 0:f.save)??"Save")+"")&&E(i,n)},d(a){a&&N(e)}}}function Mc(t){var J,$,ke,Ce,D,S,L,q,z,ee,fe,_e,de,x,he,be,Ae,Pe,Oe,Le,De,Ue,xe,Ct,tt,ot,Mt,ht,at,it,ft,Lt,We,Re,He,lt,ve,Ee,Qe;let e,l,n,i,s,a,r,f,c,m,_=((ke=($=(J=t[6])==null?void 0:J.p)==null?void 0:$.r)==null?void 0:ke.startsWith("NO"))||((S=(D=(Ce=t[6])==null?void 0:Ce.p)==null?void 0:D.r)==null?void 0:S.startsWith("10YNO"))||((z=(q=(L=t[6])==null?void 0:L.p)==null?void 0:q.r)==null?void 0:z.startsWith("10Y1001A1001A4")),d,h,b,g=((ee=t[6])==null?void 0:ee.d)&&((_e=(fe=t[0])==null?void 0:fe.features)==null?void 0:_e.includes("rdebug")),w,k,R,I,F,M,A,O,j,Y,W,T,B,X,y=((de=t[6])==null?void 0:de.g)&&zo(t),K=((x=t[6])==null?void 0:x.m)&&Ko(t),V=((he=t[6])==null?void 0:he.w)&&Jo(t),U=((be=t[6])==null?void 0:be.n)&&na(t),G=((Ae=t[6])==null?void 0:Ae.q)&&sa(t),se=((Oe=(Pe=t[6])==null?void 0:Pe.q)==null?void 0:Oe.m)==3&&fa(t),le=((De=(Le=t[6])==null?void 0:Le.q)==null?void 0:De.m)==4&&ua(t),Q=((Ue=t[6])==null?void 0:Ue.c)&&ra(t),ae=_&&va(t),re=((xe=t[6])==null?void 0:xe.u)&&ga(t),ue=((tt=(Ct=t[6])==null?void 0:Ct.i)==null?void 0:tt.h)&&(((ot=t[0])==null?void 0:ot.board)>20||((Mt=t[0])==null?void 0:Mt.chip)=="esp8266"||((it=(at=(ht=t[6])==null?void 0:ht.i)==null?void 0:at.d)==null?void 0:it.d)>0)&&Ca(t),ne=g&&Ea(t),pe=((ft=t[1])==null?void 0:ft.a)&&Oa(t),oe=t[6]&&La(t);return F=new rl({props:{active:t[3],message:((We=(Lt=t[2].conf)==null?void 0:Lt.mask)==null?void 0:We.loading)??"Loading"}}),A=new rl({props:{active:t[4],message:((He=(Re=t[2].conf)==null?void 0:Re.mask)==null?void 0:He.saving)??"Saving"}}),j=new rl({props:{active:t[10],message:((ve=(lt=t[2].conf)==null?void 0:lt.mask)==null?void 0:ve.reset)??"Factory reset"}}),W=new rl({props:{active:t[11],message:((Qe=(Ee=t[2].conf)==null?void 0:Ee.mask)==null?void 0:Qe.reset_done)??"Done"}}),{c(){e=p("form"),l=p("div"),y&&y.c(),n=v(),K&&K.c(),i=v(),V&&V.c(),s=v(),U&&U.c(),a=v(),G&&G.c(),r=v(),se&&se.c(),f=v(),le&&le.c(),c=v(),Q&&Q.c(),m=v(),ae&&ae.c(),d=v(),re&&re.c(),h=v(),ue&&ue.c(),b=v(),ne&&ne.c(),w=v(),k=p("div"),pe&&pe.c(),R=v(),oe&&oe.c(),I=v(),Ne(F.$$.fragment),M=v(),Ne(A.$$.fragment),O=v(),Ne(j.$$.fragment),Y=v(),Ne(W.$$.fragment),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(k,"class","grid grid-cols-3 mt-3"),u(e,"autocomplete","off")},m(me,we){P(me,e,we),o(e,l),y&&y.m(l,null),o(l,n),K&&K.m(l,null),o(l,i),V&&V.m(l,null),o(l,s),U&&U.m(l,null),o(l,a),G&&G.m(l,null),o(l,r),se&&se.m(l,null),o(l,f),le&&le.m(l,null),o(l,c),Q&&Q.m(l,null),o(l,m),ae&&ae.m(l,null),o(l,d),re&&re.m(l,null),o(l,h),ue&&ue.m(l,null),o(l,b),ne&&ne.m(l,null),o(e,w),o(e,k),pe&&pe.m(k,null),o(k,R),oe&&oe.m(k,null),P(me,I,we),Se(F,me,we),P(me,M,we),Se(A,me,we),P(me,O,we),Se(j,me,we),P(me,Y,we),Se(W,me,we),T=!0,B||(X=ce(e,"submit",pn(t[15])),B=!0)},p(me,we){var Be,kt,ct,mt,et,qt,Wt,wt,_t,zt,Xt,Ut,Ht,Yt,$t,Gt,It,Fe,Xe,je,Dt,Bt,$e,st,Et,pt,ge,nt,ze,el,tl,ll,nl,il,sl,Ze,dt,Te,te;(Be=me[6])!=null&&Be.g?y?(y.p(me,we),we[0]&64&&Z(y,1)):(y=zo(me),y.c(),Z(y,1),y.m(l,n)):y&&(vt(),ie(y,1,1,()=>{y=null}),bt()),(kt=me[6])!=null&&kt.m?K?K.p(me,we):(K=Ko(me),K.c(),K.m(l,i)):K&&(K.d(1),K=null),(ct=me[6])!=null&&ct.w?V?V.p(me,we):(V=Jo(me),V.c(),V.m(l,s)):V&&(V.d(1),V=null),(mt=me[6])!=null&&mt.n?U?(U.p(me,we),we[0]&64&&Z(U,1)):(U=na(me),U.c(),Z(U,1),U.m(l,a)):U&&(vt(),ie(U,1,1,()=>{U=null}),bt()),(et=me[6])!=null&&et.q?G?(G.p(me,we),we[0]&64&&Z(G,1)):(G=sa(me),G.c(),Z(G,1),G.m(l,r)):G&&(vt(),ie(G,1,1,()=>{G=null}),bt()),((Wt=(qt=me[6])==null?void 0:qt.q)==null?void 0:Wt.m)==3?se?se.p(me,we):(se=fa(me),se.c(),se.m(l,f)):se&&(se.d(1),se=null),((_t=(wt=me[6])==null?void 0:wt.q)==null?void 0:_t.m)==4?le?le.p(me,we):(le=ua(me),le.c(),le.m(l,c)):le&&(le.d(1),le=null),(zt=me[6])!=null&&zt.c?Q?(Q.p(me,we),we[0]&64&&Z(Q,1)):(Q=ra(me),Q.c(),Z(Q,1),Q.m(l,m)):Q&&(vt(),ie(Q,1,1,()=>{Q=null}),bt()),we[0]&64&&(_=((Ht=(Ut=(Xt=me[6])==null?void 0:Xt.p)==null?void 0:Ut.r)==null?void 0:Ht.startsWith("NO"))||((Gt=($t=(Yt=me[6])==null?void 0:Yt.p)==null?void 0:$t.r)==null?void 0:Gt.startsWith("10YNO"))||((Xe=(Fe=(It=me[6])==null?void 0:It.p)==null?void 0:Fe.r)==null?void 0:Xe.startsWith("10Y1001A1001A4"))),_?ae?ae.p(me,we):(ae=va(me),ae.c(),ae.m(l,d)):ae&&(ae.d(1),ae=null),(je=me[6])!=null&&je.u?re?re.p(me,we):(re=ga(me),re.c(),re.m(l,h)):re&&(re.d(1),re=null),(Bt=(Dt=me[6])==null?void 0:Dt.i)!=null&&Bt.h&&((($e=me[0])==null?void 0:$e.board)>20||((st=me[0])==null?void 0:st.chip)=="esp8266"||((ge=(pt=(Et=me[6])==null?void 0:Et.i)==null?void 0:pt.d)==null?void 0:ge.d)>0)?ue?(ue.p(me,we),we[0]&65&&Z(ue,1)):(ue=Ca(me),ue.c(),Z(ue,1),ue.m(l,b)):ue&&(vt(),ie(ue,1,1,()=>{ue=null}),bt()),we[0]&65&&(g=((nt=me[6])==null?void 0:nt.d)&&((el=(ze=me[0])==null?void 0:ze.features)==null?void 0:el.includes("rdebug"))),g?ne?ne.p(me,we):(ne=Ea(me),ne.c(),ne.m(l,null)):ne&&(ne.d(1),ne=null),(tl=me[1])!=null&&tl.a?pe?pe.p(me,we):(pe=Oa(me),pe.c(),pe.m(k,R)):pe&&(pe.d(1),pe=null),me[6]?oe?oe.p(me,we):(oe=La(me),oe.c(),oe.m(k,null)):oe&&(oe.d(1),oe=null);const ut={};we[0]&8&&(ut.active=me[3]),we[0]&4&&(ut.message=((nl=(ll=me[2].conf)==null?void 0:ll.mask)==null?void 0:nl.loading)??"Loading"),F.$set(ut);const Ge={};we[0]&16&&(Ge.active=me[4]),we[0]&4&&(Ge.message=((sl=(il=me[2].conf)==null?void 0:il.mask)==null?void 0:sl.saving)??"Saving"),A.$set(Ge);const Ft={};we[0]&1024&&(Ft.active=me[10]),we[0]&4&&(Ft.message=((dt=(Ze=me[2].conf)==null?void 0:Ze.mask)==null?void 0:dt.reset)??"Factory reset"),j.$set(Ft);const gt={};we[0]&2048&&(gt.active=me[11]),we[0]&4&&(gt.message=((te=(Te=me[2].conf)==null?void 0:Te.mask)==null?void 0:te.reset_done)??"Done"),W.$set(gt)},i(me){T||(Z(y),Z(U),Z(G),Z(Q),Z(ue),Z(F.$$.fragment,me),Z(A.$$.fragment,me),Z(j.$$.fragment,me),Z(W.$$.fragment,me),T=!0)},o(me){ie(y),ie(U),ie(G),ie(Q),ie(ue),ie(F.$$.fragment,me),ie(A.$$.fragment,me),ie(j.$$.fragment,me),ie(W.$$.fragment,me),T=!1},d(me){me&&(N(e),N(I),N(M),N(O),N(Y)),y&&y.d(),K&&K.d(),V&&V.d(),U&&U.d(),G&&G.d(),se&&se.d(),le&&le.d(),Q&&Q.d(),ae&&ae.d(),re&&re.d(),ue&&ue.d(),ne&&ne.d(),pe&&pe.d(),oe&&oe.d(),Me(F,me),Me(A,me),Me(j,me),Me(W,me),B=!1,X()}}}async function Nc(){await(await fetch("reboot",{method:"POST"})).json()}function Pc(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,{data:s}=e,a={};bl.subscribe(Ze=>{l(2,a=Ze)});let r=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Per phase",key:"h"},{name:"Power factor",key:"f"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],f=!0,c=!1,m=!1,_,d=[];Un.subscribe(Ze=>{var dt,Te,te;Ze.version&&(l(5,m=(dt=Ze==null?void 0:Ze.c)==null?void 0:dt.e),l(6,_=Ze),l(3,f=!1),l(7,d=[{code:"en",name:"English"}]),(Te=_==null?void 0:_.u)!=null&&Te.lang&&_.u.lang!="en"&&d.push({code:_.u.lang,name:((te=a.language)==null?void 0:te.name)??"Unknown"}),d.push({code:"hub",name:"Load from server"}))}),H0();let h=!0,b={};$i.subscribe(Ze=>{var dt;l(8,h=!0);for(let Te=0;Te(Zt.hostname=dt.get("gh"),Zt.usrcfg=Ie.success,Zt.booting=Ie.reboot,dt.get("nm")=="static"&&(Zt.net.ip=dt.get("ni"),Zt.net.mask=dt.get("nu"),Zt.net.gw=dt.get("ng"),Zt.net.dns1=dt.get("nd")),Zt.ui=_.u,Zt)),l(4,c=!1),sn(n)}const I=function(){confirm("Reboot?")&&(cl.update(Ze=>(Ze.booting=!0,Ze)),Nc())};async function F(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),Un.update(dt=>(dt.q.s.c=!1,dt)))}async function M(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),Un.update(dt=>(dt.q.s.r=!1,dt)))}async function A(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),Un.update(dt=>(dt.q.s.k=!1,dt)))}const O=function(){_.q.s.e?_.q.p==1883&&l(6,_.q.p=8883,_):_.q.p==8883&&l(6,_.q.p=1883,_)};async function j(){if(_.u.lang=="hub"){const Ze=await vl("http://hub.amsleser.no/hub/language/list.json");l(7,d=await Ze.json()),l(6,_.u.lang=a.language.code,_)}}let Y=44;async function W(){const Ze=await vl("cloudkey.json");if(Ze.status==200){let dt=await Ze.json();window.open("https://www.amsleser.cloud/device/"+dt.seed)}else alert("Not able to bind to cloud")}const T=window||global;T.bindToCloud=function(){console.log("BIND CALLED")};function B(){_.g.h=this.value,l(6,_)}function X(){_.g.t=Vt(this),l(6,_)}function y(){_.p.r=Vt(this),l(6,_)}function K(){_.p.c=Vt(this),l(6,_)}function V(){_.p.e=this.checked,l(6,_)}function U(){_.p.t=this.value,l(6,_)}function G(){_.g.s=Vt(this),l(6,_)}function se(){_.g.u=this.value,l(6,_)}function le(){_.g.p=this.value,l(6,_)}function Q(){_.g.c=this.value,l(6,_)}function ae(){_.m.a=Vt(this),l(6,_)}function re(){_.m.b=ye(this.value),l(6,_)}function ue(){_.m.i=this.checked,l(6,_)}function ne(){_.m.b=Vt(this),l(6,_)}function pe(){_.m.p=Vt(this),l(6,_)}function oe(){_.m.s=ye(this.value),l(6,_)}function J(){_.m.d=Vt(this),l(6,_)}function $(){_.m.f=ye(this.value),l(6,_)}function ke(){_.m.r=ye(this.value),l(6,_)}function Ce(){_.m.e.e=this.checked,l(6,_)}function D(){_.m.e.k=this.value,l(6,_)}function S(){_.m.e.a=this.value,l(6,_)}function L(){_.m.m.e=this.checked,l(6,_)}function q(){_.m.m.w=ye(this.value),l(6,_)}function z(){_.m.m.v=ye(this.value),l(6,_)}function ee(){_.m.m.a=ye(this.value),l(6,_)}function fe(){_.m.m.c=ye(this.value),l(6,_)}function _e(){_.n.c=Vt(this),l(6,_)}function de(){h=this.checked,l(8,h)}function x(){_.w.s=this.value,l(6,_)}function he(){_.w.s=Vt(this),l(6,_)}function be(){_.w.p=this.value,l(6,_)}function Ae(){_.w.z=Vt(this),l(6,_)}function Pe(){_.w.w=ye(this.value),l(6,_)}function Oe(){_.w.b=this.checked,l(6,_)}function Le(){_.n.m=Vt(this),l(6,_)}function De(){_.n.i=this.value,l(6,_)}function Ue(){_.n.s=Vt(this),l(6,_)}function xe(){_.n.g=this.value,l(6,_)}function Ct(){_.n.d1=this.value,l(6,_)}function tt(){_.n.d2=this.value,l(6,_)}function ot(){_.n.x=this.checked,l(6,_)}function Mt(){_.n.d=this.checked,l(6,_)}function ht(){_.n.h=this.checked,l(6,_)}function at(){_.n.n1=this.value,l(6,_)}function it(){_.q.s.e=this.checked,l(6,_)}function ft(){_.q.h=this.value,l(6,_)}function Lt(){_.q.p=ye(this.value),l(6,_)}function We(){_.q.u=this.value,l(6,_)}function Re(){_.q.a=this.value,l(6,_)}function He(){_.q.c=this.value,l(6,_)}function lt(){_.q.m=Vt(this),l(6,_)}function ve(){_.q.b=this.value,l(6,_)}function Ee(){_.q.r=this.value,l(6,_)}function Qe(){_.q.t=Vt(this),l(6,_)}function me(){_.q.d=ye(this.value),l(6,_)}function we(){_.q.i=ye(this.value),l(6,_)}function ut(){_.q.k=ye(this.value),l(6,_)}function Ge(){_.o.e=this.value,l(6,_)}function Ft(){_.o.c=this.value,l(6,_)}function gt(){_.o.u1=this.value,l(6,_)}function Be(){_.o.u2=this.value,l(6,_)}function kt(){_.o.u3=this.value,l(6,_)}function ct(){_.h.t=this.value,l(6,_)}function mt(){_.h.h=this.value,l(6,_)}function et(){_.h.n=this.value,l(6,_)}function qt(){_.c.e=this.checked,l(6,_)}function Wt(){_.c.p=Vt(this),l(6,_)}function wt(){_.c.es=this.checked,l(6,_)}function _t(Ze){_.t.t[Ze]=ye(this.value),l(6,_)}function zt(){_.t.h=ye(this.value),l(6,_)}function Xt(Ze){_.u[Ze.key]=Vt(this),l(6,_)}function Ut(){_.u.lang=Vt(this),l(6,_)}function Ht(){_.i.h.p=Vt(this),l(6,_)}function Yt(){_.i.h.t=Vt(this),l(6,_)}function $t(){_.i.h.u=this.checked,l(6,_)}function Gt(){_.i.a=ye(this.value),l(6,_)}function It(){_.i.l.p=ye(this.value),l(6,_)}function Fe(){_.i.l.i=this.checked,l(6,_)}function Xe(){_.i.r.i=this.checked,l(6,_)}function je(){_.i.r.r=ye(this.value),l(6,_)}function Dt(){_.i.r.g=ye(this.value),l(6,_)}function Bt(){_.i.r.b=ye(this.value),l(6,_)}function $e(){_.i.d.d=ye(this.value),l(6,_)}function st(){_.i.t.d=ye(this.value),l(6,_)}function Et(){_.i.t.a=ye(this.value),l(6,_)}function pt(){_.i.v.p=ye(this.value),l(6,_)}function ge(){_.i.v.d.v=ye(this.value),l(6,_)}function nt(){_.i.v.d.g=ye(this.value),l(6,_)}function ze(){_.i.d.b=Vt(this),l(6,_)}function el(){_.i.v.o=ye(this.value),l(6,_)}function tl(){_.i.v.m=ye(this.value),l(6,_)}function ll(){_.i.v.b=ye(this.value),l(6,_)}function nl(){_.d.s=this.checked,l(6,_)}function il(){_.d.t=this.checked,l(6,_)}function sl(){_.d.l=Vt(this),l(6,_)}return t.$$set=Ze=>{"basepath"in Ze&&l(23,n=Ze.basepath),"sysinfo"in Ze&&l(0,i=Ze.sysinfo),"data"in Ze&&l(1,s=Ze.data)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(12,Y=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,s,a,f,c,m,_,d,h,b,g,w,Y,r,k,R,I,F,M,A,O,j,W,n,B,X,y,K,V,U,G,se,le,Q,ae,re,ue,ne,pe,oe,J,$,ke,Ce,D,S,L,q,z,ee,fe,_e,de,x,he,be,Ae,Pe,Oe,Le,De,Ue,xe,Ct,tt,ot,Mt,ht,at,it,ft,Lt,We,Re,He,lt,ve,Ee,Qe,me,we,ut,Ge,Ft,gt,Be,kt,ct,mt,et,qt,Wt,wt,_t,zt,Xt,Ut,Ht,Yt,$t,Gt,It,Fe,Xe,je,Dt,Bt,$e,st,Et,pt,ge,nt,ze,el,tl,ll,nl,il,sl]}class Tc extends Tt{constructor(e){super(),Pt(this,e,Pc,Mc,Nt,{basepath:23,sysinfo:0,data:1},null,[-1,-1,-1,-1,-1])}}function Ia(t,e,l){const n=t.slice();return n[21]=e[l],n}function Ra(t){let e,l=t[1].cpu+"",n,i;return{c(){e=C("("),n=C(l),i=C("MHz)")},m(s,a){P(s,e,a),P(s,n,a),P(s,i,a)},p(s,a){a&2&&l!==(l=s[1].cpu+"")&&E(n,l)},d(s){s&&(N(e),N(n),N(i))}}}function qc(t){let e=Je(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){P(n,l,i)},p(n,i){i&2&&e!==(e=Je(n[1].chip,n[1].board)+"")&&E(l,e)},d(n){n&&N(l)}}}function Fa(t){var V,U,G,se,le,Q,ae,re;let e,l=(((U=(V=t[3].status)==null?void 0:V.device)==null?void 0:U.apmac)??"AP MAC")+"",n,i,s=t[1].apmac+"",a,r,f,c=(((se=(G=t[3].status)==null?void 0:G.device)==null?void 0:se.last_boot)??"Last boot")+"",m,_,d,h,b,g,w=(((Q=(le=t[3].status)==null?void 0:le.device)==null?void 0:Q.reason)??"Reason")+"",k,R,I=(((re=(ae=t[3][ds(t[1].chip)])==null?void 0:ae.reason)==null?void 0:re[t[1].boot_reason])??t[1].boot_reason)+"",F,M,A=t[1].boot_reason+"",O,j,Y=t[1].ex_cause+"",W,T,B;const X=[Dc,Ec],y=[];function K(ue,ne){return ue[0].u>0?0:1}return d=K(t),h=y[d]=X[d](t),{c(){e=p("div"),n=C(l),i=C(": "),a=C(s),r=v(),f=p("div"),m=C(c),_=C(`: `),h.c(),b=v(),g=p("div"),k=C(w),R=C(": "),F=C(I),M=C(" ("),O=C(A),j=C("/"),W=C(Y),T=C(")"),u(e,"class","my-2"),u(f,"class","my-2"),u(g,"class","my-2")},m(ue,ne){P(ue,e,ne),o(e,n),o(e,i),o(e,a),P(ue,r,ne),P(ue,f,ne),o(f,m),o(f,_),y[d].m(f,null),P(ue,b,ne),P(ue,g,ne),o(g,k),o(g,R),o(g,F),o(g,M),o(g,O),o(g,j),o(g,W),o(g,T),B=!0},p(ue,ne){var oe,J,$,ke,Ce,D,S,L;(!B||ne&8)&&l!==(l=(((J=(oe=ue[3].status)==null?void 0:oe.device)==null?void 0:J.apmac)??"AP MAC")+"")&&E(n,l),(!B||ne&2)&&s!==(s=ue[1].apmac+"")&&E(a,s),(!B||ne&8)&&c!==(c=(((ke=($=ue[3].status)==null?void 0:$.device)==null?void 0:ke.last_boot)??"Last boot")+"")&&E(m,c);let pe=d;d=K(ue),d===pe?y[d].p(ue,ne):(vt(),ie(y[pe],1,1,()=>{y[pe]=null}),bt(),h=y[d],h?h.p(ue,ne):(h=y[d]=X[d](ue),h.c()),Z(h,1),h.m(f,null)),(!B||ne&8)&&w!==(w=(((D=(Ce=ue[3].status)==null?void 0:Ce.device)==null?void 0:D.reason)??"Reason")+"")&&E(k,w),(!B||ne&10)&&I!==(I=(((L=(S=ue[3][ds(ue[1].chip)])==null?void 0:S.reason)==null?void 0:L[ue[1].boot_reason])??ue[1].boot_reason)+"")&&E(F,I),(!B||ne&2)&&A!==(A=ue[1].boot_reason+"")&&E(O,A),(!B||ne&2)&&Y!==(Y=ue[1].ex_cause+"")&&E(W,Y)},i(ue){B||(Z(h),B=!0)},o(ue){ie(h),B=!1},d(ue){ue&&(N(e),N(r),N(f),N(b),N(g)),y[d].d()}}}function Ec(t){let e;return{c(){e=C("-")},m(l,n){P(l,e,n)},p:Ye,i:Ye,o:Ye,d(l){l&&N(e)}}}function Dc(t){let e,l;return e=new Tu({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:"",offset:t[1].clock_offset}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),i&2&&(s.offset=n[1].clock_offset),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function Ua(t){var m;let e,l,n,i,s=(((m=t[3].btn)==null?void 0:m.reboot)??"Reboot")+"",a,r,f,c;return l=new pl({props:{to:"/consent",$$slots:{default:[Ac]},$$scope:{ctx:t}}}),{c(){e=p("div"),Ne(l.$$.fragment),n=v(),i=p("button"),a=C(s),u(i,"class","btn-yellow-sm float-right"),u(e,"class","my-2")},m(_,d){P(_,e,d),Se(l,e,null),o(e,n),o(e,i),o(i,a),r=!0,f||(c=ce(i,"click",t[11]),f=!0)},p(_,d){var b;const h={};d&16777224&&(h.$$scope={dirty:d,ctx:_}),l.$set(h),(!r||d&8)&&s!==(s=(((b=_[3].btn)==null?void 0:b.reboot)??"Reboot")+"")&&E(a,s)},i(_){r||(Z(l.$$.fragment,_),r=!0)},o(_){ie(l.$$.fragment,_),r=!1},d(_){_&&N(e),Me(l),f=!1,c()}}}function Ac(t){var i,s;let e,l=(((s=(i=t[3].status)==null?void 0:i.device)==null?void 0:s.btn_consents)??"Consents")+"",n;return{c(){e=p("span"),n=C(l),u(e,"class","btn-pri-sm")},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r&8&&l!==(l=(((c=(f=a[3].status)==null?void 0:f.device)==null?void 0:c.btn_consents)??"Consents")+"")&&E(n,l)},d(a){a&&N(e)}}}function Ba(t){var W,T,B,X,y,K,V,U;let e,l,n=(((T=(W=t[3].status)==null?void 0:W.meter)==null?void 0:T.title)??"Meter")+"",i,s,a,r=(((X=(B=t[3].status)==null?void 0:B.meter)==null?void 0:X.manufacturer)??"Manufacturer")+"",f,c,m=ui(t[1].meter.mfg)+"",_,d,h,b=(((K=(y=t[3].status)==null?void 0:y.meter)==null?void 0:K.model)??"Model")+"",g,w,k=(t[1].meter.model?t[1].meter.model:"unknown")+"",R,I,F,M=(((U=(V=t[3].status)==null?void 0:V.meter)==null?void 0:U.id)??"ID")+"",A,O,j=(t[1].meter.id?t[1].meter.id:"unknown")+"",Y;return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),f=C(r),c=C(": "),_=C(m),d=v(),h=p("div"),g=C(b),w=C(": "),R=C(k),I=v(),F=p("div"),A=C(M),O=C(": "),Y=C(j),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(F,"class","my-2"),u(e,"class","cnt")},m(G,se){P(G,e,se),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(a,c),o(a,_),o(e,d),o(e,h),o(h,g),o(h,w),o(h,R),o(e,I),o(e,F),o(F,A),o(F,O),o(F,Y)},p(G,se){var le,Q,ae,re,ue,ne,pe,oe;se&8&&n!==(n=(((Q=(le=G[3].status)==null?void 0:le.meter)==null?void 0:Q.title)??"Meter")+"")&&E(i,n),se&8&&r!==(r=(((re=(ae=G[3].status)==null?void 0:ae.meter)==null?void 0:re.manufacturer)??"Manufacturer")+"")&&E(f,r),se&2&&m!==(m=ui(G[1].meter.mfg)+"")&&E(_,m),se&8&&b!==(b=(((ne=(ue=G[3].status)==null?void 0:ue.meter)==null?void 0:ne.model)??"Model")+"")&&E(g,b),se&2&&k!==(k=(G[1].meter.model?G[1].meter.model:"unknown")+"")&&E(R,k),se&8&&M!==(M=(((oe=(pe=G[3].status)==null?void 0:pe.meter)==null?void 0:oe.id)??"ID")+"")&&E(A,M),se&2&&j!==(j=(G[1].meter.id?G[1].meter.id:"unknown")+"")&&E(Y,j)},d(G){G&&N(e)}}}function ja(t){var U,G,se,le,Q,ae,re,ue;let e,l,n=(((G=(U=t[3].status)==null?void 0:U.network)==null?void 0:G.title)??"Network")+"",i,s,a,r=(((le=(se=t[3].conf)==null?void 0:se.network)==null?void 0:le.ip)??"IP")+"",f,c,m=t[1].net.ip+"",_,d,h,b=(((ae=(Q=t[3].conf)==null?void 0:Q.network)==null?void 0:ae.mask)??"Mask")+"",g,w,k=t[1].net.mask+"",R,I,F,M=(((ue=(re=t[3].conf)==null?void 0:re.network)==null?void 0:ue.gw)??"Gateway")+"",A,O,j=t[1].net.gw+"",Y,W,T,B,X,y=t[1].net.dns1&&Ha(t),K=t[1].net.dns2&&ya(t),V=t[1].net.ipv6&&za(t);return{c(){e=p("div"),l=p("strong"),i=C(n),s=v(),a=p("div"),f=C(r),c=C(": "),_=C(m),d=v(),h=p("div"),g=C(b),w=C(": "),R=C(k),I=v(),F=p("div"),A=C(M),O=C(": "),Y=C(j),W=v(),T=p("div"),y&&y.c(),B=v(),K&&K.c(),X=v(),V&&V.c(),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(F,"class","my-2"),u(T,"class","my-2"),u(e,"class","cnt")},m(ne,pe){P(ne,e,pe),o(e,l),o(l,i),o(e,s),o(e,a),o(a,f),o(a,c),o(a,_),o(e,d),o(e,h),o(h,g),o(h,w),o(h,R),o(e,I),o(e,F),o(F,A),o(F,O),o(F,Y),o(e,W),o(e,T),y&&y.m(T,null),o(T,B),K&&K.m(T,null),o(e,X),V&&V.m(e,null)},p(ne,pe){var oe,J,$,ke,Ce,D,S,L;pe&8&&n!==(n=(((J=(oe=ne[3].status)==null?void 0:oe.network)==null?void 0:J.title)??"Network")+"")&&E(i,n),pe&8&&r!==(r=(((ke=($=ne[3].conf)==null?void 0:$.network)==null?void 0:ke.ip)??"IP")+"")&&E(f,r),pe&2&&m!==(m=ne[1].net.ip+"")&&E(_,m),pe&8&&b!==(b=(((D=(Ce=ne[3].conf)==null?void 0:Ce.network)==null?void 0:D.mask)??"Mask")+"")&&E(g,b),pe&2&&k!==(k=ne[1].net.mask+"")&&E(R,k),pe&8&&M!==(M=(((L=(S=ne[3].conf)==null?void 0:S.network)==null?void 0:L.gw)??"Gateway")+"")&&E(A,M),pe&2&&j!==(j=ne[1].net.gw+"")&&E(Y,j),ne[1].net.dns1?y?y.p(ne,pe):(y=Ha(ne),y.c(),y.m(T,B)):y&&(y.d(1),y=null),ne[1].net.dns2?K?K.p(ne,pe):(K=ya(ne),K.c(),K.m(T,null)):K&&(K.d(1),K=null),ne[1].net.ipv6?V?V.p(ne,pe):(V=za(ne),V.c(),V.m(e,null)):V&&(V.d(1),V=null)},d(ne){ne&&N(e),y&&y.d(),K&&K.d(),V&&V.d()}}}function Ha(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[1].net.dns1+"",s;return{c(){l=C(e),n=C(": "),s=C(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,s,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&E(l,e),c&2&&i!==(i=f[1].net.dns1+"")&&E(s,i)},d(f){f&&(N(l),N(n),N(s))}}}function ya(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[1].net.dns2+"",s;return{c(){l=C(e),n=C(": "),s=C(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,s,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&E(l,e),c&2&&i!==(i=f[1].net.dns2+"")&&E(s,i)},d(f){f&&(N(l),N(n),N(s))}}}function za(t){let e,l,n,i=t[1].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"",s,a,r,f,c=t[1].net.dns1v6&&Wa(t),m=t[1].net.dns2v6&&Ga(t);return{c(){e=p("div"),l=C("IPv6: "),n=p("span"),s=C(i),a=v(),r=p("div"),c&&c.c(),f=v(),m&&m.c(),nn(n,"font-size","14px"),u(e,"class","my-2"),u(r,"class","my-2")},m(_,d){P(_,e,d),o(e,l),o(e,n),o(n,s),P(_,a,d),P(_,r,d),c&&c.m(r,null),o(r,f),m&&m.m(r,null)},p(_,d){d&2&&i!==(i=_[1].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(s,i),_[1].net.dns1v6?c?c.p(_,d):(c=Wa(_),c.c(),c.m(r,f)):c&&(c.d(1),c=null),_[1].net.dns2v6?m?m.p(_,d):(m=Ga(_),m.c(),m.m(r,null)):m&&(m.d(1),m=null)},d(_){_&&(N(e),N(a),N(r)),c&&c.d(),m&&m.d()}}}function Wa(t){let e,l,n=t[1].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=C("DNSv6: "),l=p("span"),i=C(n),nn(l,"font-size","14px")},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&2&&n!==(n=s[1].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(i,n)},d(s){s&&(N(e),N(l))}}}function Ga(t){let e,l,n=t[1].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=C("DNSv6: "),l=p("span"),i=C(n),nn(l,"font-size","14px")},m(s,a){P(s,e,a),P(s,l,a),o(l,i)},p(s,a){a&2&&n!==(n=s[1].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(i,n)},d(s){s&&(N(e),N(l))}}}function Va(t){var f,c,m,_;let e,l,n=(((c=(f=t[3].status)==null?void 0:f.firmware)==null?void 0:c.failed)??"Upgrade from {0} to {1} failed").replace("{0}",t[1].upgrade.f).replace("{1}",t[1].upgrade.t)+"",i,s,a=(((_=(m=t[3].errors)==null?void 0:m.upgrade)==null?void 0:_[t[1].upgrade.e])??t[1].upgrade.e)+"",r;return{c(){e=p("div"),l=p("div"),i=C(n),s=v(),r=C(a),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(d,h){P(d,e,h),o(e,l),o(l,i),o(l,s),o(l,r)},p(d,h){var b,g,w,k;h&10&&n!==(n=(((g=(b=d[3].status)==null?void 0:b.firmware)==null?void 0:g.failed)??"Upgrade from {0} to {1} failed").replace("{0}",d[1].upgrade.f).replace("{1}",d[1].upgrade.t)+"")&&E(i,n),h&10&&a!==(a=(((k=(w=d[3].errors)==null?void 0:w.upgrade)==null?void 0:k[d[1].upgrade.e])??d[1].upgrade.e)+"")&&E(r,a)},d(d){d&&N(e)}}}function Ka(t){var b,g;let e,l=(((g=(b=t[3].status)==null?void 0:b.firmware)==null?void 0:g.latest)??"Latest")+"",n,i,s,a=t[1].upgrade.n+"",r,f,c,m,_,d=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[1].upgrade.n&&t[1].upgrade.n!=t[1].version&&Ya(t),h=t[1].fwconsent===2&&Qa(t);return{c(){e=p("div"),n=C(l),i=C(`: `),s=p("a"),r=C(a),c=v(),d&&d.c(),m=v(),h&&h.c(),_=yt(),u(s,"href",f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+t[1].upgrade.n),u(s,"class","ml-2 text-blue-600 hover:text-blue-800"),u(s,"target","_blank"),u(s,"rel","noreferrer"),u(e,"class","my-2 flex")},m(w,k){P(w,e,k),o(e,n),o(e,i),o(e,s),o(s,r),o(e,c),d&&d.m(e,null),P(w,m,k),h&&h.m(w,k),P(w,_,k)},p(w,k){var R,I;k&8&&l!==(l=(((I=(R=w[3].status)==null?void 0:R.firmware)==null?void 0:I.latest)??"Latest")+"")&&E(n,l),k&2&&a!==(a=w[1].upgrade.n+"")&&E(r,a),k&2&&f!==(f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+w[1].upgrade.n)&&u(s,"href",f),(w[1].security==0||w[0].a)&&w[1].fwconsent===1&&w[1].upgrade.n&&w[1].upgrade.n!=w[1].version?d?d.p(w,k):(d=Ya(w),d.c(),d.m(e,null)):d&&(d.d(1),d=null),w[1].fwconsent===2?h?h.p(w,k):(h=Qa(w),h.c(),h.m(_.parentNode,_)):h&&(h.d(1),h=null)},d(w){w&&(N(e),N(m),N(_)),d&&d.d(),h&&h.d(w)}}}function Ya(t){let e,l,n,i,s;return{c(){var a,r;e=p("div"),l=p("button"),l.textContent="⇓",u(e,"class","flex-none ml-2 text-green-500"),u(e,"title",n=((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.install)??"Install")},m(a,r){P(a,e,r),o(e,l),i||(s=ce(l,"click",t[10]),i=!0)},p(a,r){var f,c;r&8&&n!==(n=((c=(f=a[3].status)==null?void 0:f.firmware)==null?void 0:c.install)??"Install")&&u(e,"title",n)},d(a){a&&N(e),i=!1,s()}}}function Qa(t){var s,a;let e,l,n=(((a=(s=t[3].status)==null?void 0:s.firmware)==null?void 0:a.no_one_click)??"One-click upgrade disabled")+"",i;return{c(){e=p("div"),l=p("div"),i=C(n),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(r,f){P(r,e,f),o(e,l),o(l,i)},p(r,f){var c,m;f&8&&n!==(n=(((m=(c=r[3].status)==null?void 0:c.firmware)==null?void 0:m.no_one_click)??"One-click upgrade disabled")+"")&&E(i,n)},d(r){r&&N(e)}}}function Xa(t){let e,l=bs(Je(t[1].chip,t[1].board))+"",n;return{c(){e=p("div"),n=C(l),u(e,"class","bd-red")},m(i,s){P(i,e,s),o(e,n)},p(i,s){s&2&&l!==(l=bs(Je(i[1].chip,i[1].board))+"")&&E(n,l)},d(i){i&&N(e)}}}function Za(t){let e,l,n,i,s,a;function r(m,_){return m[5].length==0?Lc:Oc}let f=r(t),c=f(t);return{c(){e=p("div"),l=p("form"),n=p("input"),i=v(),c.c(),nn(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(e,"class","my-2 flex")},m(m,_){P(m,e,_),o(e,l),o(l,n),t[13](n),o(l,i),c.m(l,null),s||(a=[ce(n,"change",t[14]),ce(l,"submit",t[16])],s=!0)},p(m,_){f===(f=r(m))&&c?c.p(m,_):(c.d(1),c=f(m),c&&(c.c(),c.m(l,null)))},d(m){m&&N(e),t[13](null),c.d(),s=!1,jt(a)}}}function Oc(t){var r;let e=t[5][0].name+"",l,n,i,s=(((r=t[3].btn)==null?void 0:r.upload)??"Upload")+"",a;return{c(){l=C(e),n=v(),i=p("button"),a=C(s),u(i,"type","submit"),u(i,"class","btn-pri-sm float-right ml-2")},m(f,c){P(f,l,c),P(f,n,c),P(f,i,c),o(i,a)},p(f,c){var m;c&32&&e!==(e=f[5][0].name+"")&&E(l,e),c&8&&s!==(s=(((m=f[3].btn)==null?void 0:m.upload)??"Upload")+"")&&E(a,s)},d(f){f&&(N(l),N(n),N(i))}}}function Lc(t){var a,r;let e,l=(((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.btn_select_file)??"Select file")+"",n,i,s;return{c(){e=p("button"),n=C(l),u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(f,c){P(f,e,c),o(e,n),i||(s=ce(e,"click",t[15]),i=!0)},p(f,c){var m,_;c&8&&l!==(l=(((_=(m=f[3].status)==null?void 0:m.firmware)==null?void 0:_.btn_select_file)??"Select file")+"")&&E(n,l)},d(f){f&&N(e),i=!1,s()}}}function Ja(t){var K,V,U,G,se,le;let e,l,n=(((V=(K=t[3].status)==null?void 0:K.backup)==null?void 0:V.title)??"Backup")+"",i,s,a,r,f,c,m,_,d=(((G=(U=t[3].status)==null?void 0:U.backup)==null?void 0:G.secrets)??"Include secrets")+"",h,b,g,w=(((le=(se=t[3].status)==null?void 0:se.backup)==null?void 0:le.secrets_desc)??"")+"",k,R,I,F,M,A,O,j,Y=rt(t[9]),W=[];for(let Q=0;Q{_e=null}),bt()),(mt=ve[0])!=null&&mt.a?de?(de.p(ve,Ee),Ee&1&&Z(de,1)):(de=Ua(ve),de.c(),Z(de,1),de.m(l,null)):de&&(vt(),ie(de,1,1,()=>{de=null}),bt()),ve[1].meter?x?x.p(ve,Ee):(x=Ba(ve),x.c(),x.m(e,y)):x&&(x.d(1),x=null),ve[1].net?he?he.p(ve,Ee):(he=ja(ve),he.c(),he.m(e,K)):he&&(he.d(1),he=null),(!ee||Ee&8)&&G!==(G=(((qt=(et=ve[3].status)==null?void 0:et.firmware)==null?void 0:qt.title)??"Firmware")+"")&&E(se,G),(!ee||Ee&8)&&ae!==(ae=(((wt=(Wt=ve[3].status)==null?void 0:Wt.firmware)==null?void 0:wt.installed)??"Installed")+"")&&E(re,ae),(!ee||Ee&2)&&ne!==(ne=ve[1].version+"")&&E(pe,ne),ve[1].upgrade.t&&ve[1].upgrade.t!=ve[1].version&&ve[1].upgrade.e!=0&&ve[1].upgrade.e!=123?be?be.p(ve,Ee):(be=Va(ve),be.c(),be.m(V,J)):be&&(be.d(1),be=null),ve[1].upgrade.n?Ae?Ae.p(ve,Ee):(Ae=Ka(ve),Ae.c(),Ae.m(V,$)):Ae&&(Ae.d(1),Ae=null),Ee&3&&(ke=(ve[1].security==0||ve[0].a)&&Hn(ve[1].board)),ke?Pe?Pe.p(ve,Ee):(Pe=Xa(ve),Pe.c(),Pe.m(V,Ce)):Pe&&(Pe.d(1),Pe=null),ve[1].security==0||ve[0].a?Oe?Oe.p(ve,Ee):(Oe=Za(ve),Oe.c(),Oe.m(V,null)):Oe&&(Oe.d(1),Oe=null),ve[1].security==0||ve[0].a?Le?Le.p(ve,Ee):(Le=Ja(ve),Le.c(),Le.m(e,null)):Le&&(Le.d(1),Le=null);const me={};Ee&64&&(me.active=ve[6]),Ee&8&&(me.message=((zt=(_t=ve[3].status)==null?void 0:_t.mask)==null?void 0:zt.firmware)??"Uploading"),L.$set(me);const we={};Ee&256&&(we.active=ve[8]),Ee&8&&(we.message=((Ut=(Xt=ve[3].status)==null?void 0:Xt.mask)==null?void 0:Ut.config)??"Uploading"),z.$set(we)},i(ve){ee||(Z(I.$$.fragment,ve),Z(_e),Z(de),Z(L.$$.fragment,ve),Z(z.$$.fragment,ve),ee=!0)},o(ve){ie(I.$$.fragment,ve),ie(_e),ie(de),ie(L.$$.fragment,ve),ie(z.$$.fragment,ve),ee=!1},d(ve){ve&&(N(e),N(S),N(q)),fe&&fe.d(),Me(I),_e&&_e.d(),de&&de.d(),x&&x.d(),he&&he.d(),be&&be.d(),Ae&&Ae.d(),Pe&&Pe.d(),Oe&&Oe.d(),Le&&Le.d(),Me(L,ve),Me(z,ve)}}}async function Uc(){await(await fetch("reboot",{method:"POST"})).json()}function Bc(t,e,l){let{data:n}=e,{sysinfo:i}=e,s=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price",key:"is"}],a={};bl.subscribe(j=>{l(3,a=j)});function r(){var j;confirm((((j=a.header)==null?void 0:j.upgrade)??"Upgrade to {0}?").replace("{0}",i.upgrade.n))&&(Pu(i.upgrade.n),cl.update(Y=>(Y.upgrade.t=i.upgrade.n,Y.upgrade.p=0,Y.upgrading=!0,Y)))}const f=function(){var j;confirm(((j=a.device)==null?void 0:j.reboot_confirm)??"Reboot?")&&(cl.update(Y=>(Y.booting=!0,Y)),Uc())};let c,m=[],_=!1,d,h=[],b=!1;ci();let g={hostname:"",ip:""};function w(j){l(8,b=!0);const Y=new FormData;Y.append("file",h[0]),fetch("configfile",{method:"POST",body:Y}).then(W=>W.json()).then(W=>{cl.update(T=>(g&&g.hostname&&(T.hostname=g.hostname),T.booting=W.reboot,g&&g.ip&&(T.net.ip=g.ip),setTimeout(Wn,5e3,i),T))}).catch(W=>{console.error("Error:",W),setTimeout(Wn,5e3,i)})}function k(j){ai[j?"unshift":"push"](()=>{c=j,l(4,c)})}function R(){m=this.files,l(5,m)}const I=()=>{c.click()},F=()=>l(6,_=!0);function M(j){ai[j?"unshift":"push"](()=>{d=j,l(7,d)})}function A(){h=this.files,l(2,h)}const O=()=>{d.click()};return t.$$set=j=>{"data"in j&&l(0,n=j.data),"sysinfo"in j&&l(1,i=j.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&4&&h.length==1){let j=h[0],Y=new FileReader,W=T=>{let B=T.target.result.split(` -`);for(let X in B){let y=B[X];y.startsWith("hostname ")?g.hostname=y.split(" ")[1]:y.startsWith("ip ")&&(g.ip=y.split(" ")[1])}};Y.onload=W,Y.readAsText(j)}},[n,i,h,a,c,m,_,d,b,s,r,f,w,k,R,I,F,M,A,O]}class jc extends Tt{constructor(e){super(),Pt(this,e,Bc,Fc,Nt,{data:0,sysinfo:1})}}function ef(t){let e,l,n=Je(t[0],7)+"",i,s,a=Je(t[0],5)+"",r,f,c=Je(t[0],4)+"",m,_,d=Je(t[0],3)+"",h,b,g,w,k=Je(t[0],2)+"",R,I,F=Je(t[0],1)+"",M,A,O=Je(t[0],0)+"",j,Y,W,T,B=Je(t[0],101)+"",X,y,K=Je(t[0],100)+"",V;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=p("option"),h=C(d),b=v(),g=p("optgroup"),w=p("option"),R=C(k),I=p("option"),M=C(F),A=p("option"),j=C(O),Y=v(),W=p("optgroup"),T=p("option"),X=C(B),y=p("option"),V=C(K),l.__value=7,H(l,l.__value),s.__value=5,H(s,s.__value),f.__value=4,H(f,f.__value),_.__value=3,H(_,_.__value),u(e,"label","amsleser.no"),w.__value=2,H(w,w.__value),I.__value=1,H(I,I.__value),A.__value=0,H(A,A.__value),u(g,"label","Custom hardware"),T.__value=101,H(T,T.__value),y.__value=100,H(y,y.__value),u(W,"label","Generic hardware")},m(U,G){P(U,e,G),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),o(e,_),o(_,h),P(U,b,G),P(U,g,G),o(g,w),o(w,R),o(g,I),o(I,M),o(g,A),o(A,j),P(U,Y,G),P(U,W,G),o(W,T),o(T,X),o(W,y),o(y,V)},p(U,G){G&1&&n!==(n=Je(U[0],7)+"")&&E(i,n),G&1&&a!==(a=Je(U[0],5)+"")&&E(r,a),G&1&&c!==(c=Je(U[0],4)+"")&&E(m,c),G&1&&d!==(d=Je(U[0],3)+"")&&E(h,d),G&1&&k!==(k=Je(U[0],2)+"")&&E(R,k),G&1&&F!==(F=Je(U[0],1)+"")&&E(M,F),G&1&&O!==(O=Je(U[0],0)+"")&&E(j,O),G&1&&B!==(B=Je(U[0],101)+"")&&E(X,B),G&1&&K!==(K=Je(U[0],100)+"")&&E(V,K)},d(U){U&&(N(e),N(b),N(g),N(Y),N(W))}}}function tf(t){let e,l,n=Je(t[0],201)+"",i,s,a=Je(t[0],202)+"",r,f,c=Je(t[0],203)+"",m,_,d=Je(t[0],241)+"",h,b,g=Je(t[0],242)+"",w,k,R=Je(t[0],243)+"",I,F,M=Je(t[0],245)+"",A,O,j=Je(t[0],200)+"",Y;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=p("option"),h=C(d),b=p("option"),w=C(g),k=p("option"),I=C(R),F=p("option"),A=C(M),O=p("option"),Y=C(j),l.__value=201,H(l,l.__value),s.__value=202,H(s,s.__value),f.__value=203,H(f,f.__value),_.__value=241,H(_,_.__value),b.__value=242,H(b,b.__value),k.__value=243,H(k,k.__value),F.__value=245,H(F,F.__value),O.__value=200,H(O,O.__value),u(e,"label","Generic hardware")},m(W,T){P(W,e,T),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),o(e,_),o(_,h),o(e,b),o(b,w),o(e,k),o(k,I),o(e,F),o(F,A),o(e,O),o(O,Y)},p(W,T){T&1&&n!==(n=Je(W[0],201)+"")&&E(i,n),T&1&&a!==(a=Je(W[0],202)+"")&&E(r,a),T&1&&c!==(c=Je(W[0],203)+"")&&E(m,c),T&1&&d!==(d=Je(W[0],241)+"")&&E(h,d),T&1&&g!==(g=Je(W[0],242)+"")&&E(w,g),T&1&&R!==(R=Je(W[0],243)+"")&&E(I,R),T&1&&M!==(M=Je(W[0],245)+"")&&E(A,M),T&1&&j!==(j=Je(W[0],200)+"")&&E(Y,j)},d(W){W&&N(e)}}}function lf(t){let e,l,n=Je(t[0],7)+"",i,s,a=Je(t[0],6)+"",r,f,c=Je(t[0],5)+"",m,_,d,h,b=Je(t[0],51)+"",g,w,k=Je(t[0],50)+"",R;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=v(),d=p("optgroup"),h=p("option"),g=C(b),w=p("option"),R=C(k),l.__value=7,H(l,l.__value),s.__value=6,H(s,s.__value),f.__value=5,H(f,f.__value),u(e,"label","amsleser.no"),h.__value=51,H(h,h.__value),w.__value=50,H(w,w.__value),u(d,"label","Generic hardware")},m(I,F){P(I,e,F),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),P(I,_,F),P(I,d,F),o(d,h),o(h,g),o(d,w),o(w,R)},p(I,F){F&1&&n!==(n=Je(I[0],7)+"")&&E(i,n),F&1&&a!==(a=Je(I[0],6)+"")&&E(r,a),F&1&&c!==(c=Je(I[0],5)+"")&&E(m,c),F&1&&b!==(b=Je(I[0],51)+"")&&E(g,b),F&1&&k!==(k=Je(I[0],50)+"")&&E(R,k)},d(I){I&&(N(e),N(_),N(d))}}}function nf(t){let e,l,n=Je(t[0],8)+"",i,s,a,r,f=Je(t[0],71)+"",c,m,_=Je(t[0],70)+"",d;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=v(),a=p("optgroup"),r=p("option"),c=C(f),m=p("option"),d=C(_),l.__value=8,H(l,l.__value),u(e,"label","Custom hardware"),r.__value=71,H(r,r.__value),m.__value=70,H(m,m.__value),u(a,"label","Generic hardware")},m(h,b){P(h,e,b),o(e,l),o(l,i),P(h,s,b),P(h,a,b),o(a,r),o(r,c),o(a,m),o(m,d)},p(h,b){b&1&&n!==(n=Je(h[0],8)+"")&&E(i,n),b&1&&f!==(f=Je(h[0],71)+"")&&E(c,f),b&1&&_!==(_=Je(h[0],70)+"")&&E(d,_)},d(h){h&&(N(e),N(s),N(a))}}}function sf(t){let e,l,n=Je(t[0],200)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=200,H(l,l.__value),u(e,"label","Generic hardware")},m(s,a){P(s,e,a),o(e,l),o(l,i)},p(s,a){a&1&&n!==(n=Je(s[0],200)+"")&&E(i,n)},d(s){s&&N(e)}}}function of(t){let e,l,n=Je(t[0],80)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=80,H(l,l.__value),u(e,"label","Generic hardware")},m(s,a){P(s,e,a),o(e,l),o(l,i)},p(s,a){a&1&&n!==(n=Je(s[0],80)+"")&&E(i,n)},d(s){s&&N(e)}}}function Hc(t){let e,l,n,i,s,a,r,f,c=t[0]=="esp8266"&&ef(t),m=t[0]=="esp32"&&tf(t),_=t[0]=="esp32s2"&&lf(t),d=t[0]=="esp32c3"&&nf(t),h=t[0]=="esp32solo"&&sf(t),b=t[0]=="esp32s3"&&of(t);return{c(){e=p("option"),l=v(),c&&c.c(),n=v(),m&&m.c(),i=v(),_&&_.c(),s=v(),d&&d.c(),a=v(),h&&h.c(),r=v(),b&&b.c(),f=yt(),e.__value=-1,H(e,e.__value)},m(g,w){P(g,e,w),P(g,l,w),c&&c.m(g,w),P(g,n,w),m&&m.m(g,w),P(g,i,w),_&&_.m(g,w),P(g,s,w),d&&d.m(g,w),P(g,a,w),h&&h.m(g,w),P(g,r,w),b&&b.m(g,w),P(g,f,w)},p(g,[w]){g[0]=="esp8266"?c?c.p(g,w):(c=ef(g),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),g[0]=="esp32"?m?m.p(g,w):(m=tf(g),m.c(),m.m(i.parentNode,i)):m&&(m.d(1),m=null),g[0]=="esp32s2"?_?_.p(g,w):(_=lf(g),_.c(),_.m(s.parentNode,s)):_&&(_.d(1),_=null),g[0]=="esp32c3"?d?d.p(g,w):(d=nf(g),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null),g[0]=="esp32solo"?h?h.p(g,w):(h=sf(g),h.c(),h.m(r.parentNode,r)):h&&(h.d(1),h=null),g[0]=="esp32s3"?b?b.p(g,w):(b=of(g),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i:Ye,o:Ye,d(g){g&&(N(e),N(l),N(n),N(i),N(s),N(a),N(r),N(f)),c&&c.d(g),m&&m.d(g),_&&_.d(g),d&&d.d(g),h&&h.d(g),b&&b.d(g)}}}function yc(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class zc extends Tt{constructor(e){super(),Pt(this,e,yc,Hc,Nt,{chip:0})}}function af(t){let e;return{c(){e=p("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(e,"class","bd-red")},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function ff(t){let e,l,n,i,s,a,r;return a=new Bi({props:{chip:t[0].chip}}),{c(){e=p("div"),l=C("HAN GPIO"),n=p("br"),i=v(),s=p("select"),Ne(a.$$.fragment),u(s,"name","vh"),u(s,"class","in-s"),u(e,"class","my-3")},m(f,c){P(f,e,c),o(e,l),o(e,n),o(e,i),o(e,s),Se(a,s,null),r=!0},p(f,c){const m={};c&1&&(m.chip=f[0].chip),a.$set(m)},i(f){r||(Z(a.$$.fragment,f),r=!0)},o(f){ie(a.$$.fragment,f),r=!1},d(f){f&&N(e),Me(a)}}}function Wc(t){let e,l,n,i,s,a,r,f,c,m,_,d,h,b,g,w,k,R,I,F,M,A,O,j,Y,W,T,B,X,y=t[0].usrcfg&&af();b=new zc({props:{chip:t[0].chip}});let K=t[0].board&&t[0].board>20&&ff(t);return W=new rl({props:{active:t[1],message:"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),s=v(),a=p("strong"),a.textContent="Initial configuration",r=v(),y&&y.c(),f=v(),c=p("div"),m=C("Board type"),_=p("br"),d=v(),h=p("select"),Ne(b.$$.fragment),g=v(),K&&K.c(),w=v(),k=p("div"),R=p("label"),I=p("input"),F=C(" Clear all other configuration"),M=v(),A=p("div"),A.innerHTML='',O=v(),j=p("span"),j.textContent=" ",Y=v(),Ne(W.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(a,"class","text-sm"),u(h,"name","vb"),u(h,"class","in-s"),t[0].board===void 0&&At(()=>t[5].call(h)),u(c,"class","my-3"),u(I,"type","checkbox"),u(I,"name","vr"),I.__value="true",H(I,I.__value),u(I,"class","rounded mb-1"),u(k,"class","my-3"),u(A,"class","my-3"),u(j,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(V,U){P(V,e,U),o(e,l),o(l,n),o(n,i),o(n,s),o(n,a),o(n,r),y&&y.m(n,null),o(n,f),o(n,c),o(c,m),o(c,_),o(c,d),o(c,h),Se(b,h,null),Ke(h,t[0].board,!0),o(n,g),K&&K.m(n,null),o(n,w),o(n,k),o(k,R),o(R,I),I.checked=t[2],o(R,F),o(n,M),o(n,A),o(n,O),o(n,j),P(V,Y,U),Se(W,V,U),T=!0,B||(X=[ce(h,"change",t[5]),ce(I,"change",t[6]),ce(n,"submit",pn(t[3]))],B=!0)},p(V,[U]){V[0].usrcfg?y||(y=af(),y.c(),y.m(n,f)):y&&(y.d(1),y=null);const G={};U&1&&(G.chip=V[0].chip),b.$set(G),U&1&&Ke(h,V[0].board),V[0].board&&V[0].board>20?K?(K.p(V,U),U&1&&Z(K,1)):(K=ff(V),K.c(),Z(K,1),K.m(n,w)):K&&(vt(),ie(K,1,1,()=>{K=null}),bt()),U&4&&(I.checked=V[2]);const se={};U&2&&(se.active=V[1]),W.$set(se)},i(V){T||(Z(b.$$.fragment,V),Z(K),Z(W.$$.fragment,V),T=!0)},o(V){ie(b.$$.fragment,V),ie(K),ie(W.$$.fragment,V),T=!1},d(V){V&&(N(e),N(Y)),y&&y.d(),Me(b),K&&K.d(),Me(W,V),B=!1,jt(X)}}}function Gc(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,s=!1;async function a(m){l(1,s=!0);const _=new FormData(m.target),d=new URLSearchParams;for(let g of _){const[w,k]=g;d.append(w,k)}let b=await(await fetch("save",{method:"POST",body:d})).json();l(1,s=!1),cl.update(g=>(g.vndcfg=b.success,g.booting=b.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),sn(n+(i.usrcfg?"/":"/setup"))}let r=!1;cl.subscribe(m=>{l(0,i=m),m.fwconsent===1&&l(2,r=!i.usrcfg)});function f(){i.board=Vt(this),l(0,i)}function c(){r=this.checked,l(2,r)}return t.$$set=m=>{"basepath"in m&&l(4,n=m.basepath),"sysinfo"in m&&l(0,i=m.sysinfo)},[i,s,r,a,n,f,c]}class Vc extends Tt{constructor(e){super(),Pt(this,e,Gc,Wc,Nt,{basepath:4,sysinfo:0})}}function uf(t,e,l){const n=t.slice();return n[13]=e[l],n}function rf(t){var i,s;let e,l=(((s=(i=t[1].conf)==null?void 0:i.connection)==null?void 0:s.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=C(l),e.__value=3,H(e,e.__value)},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r&2&&l!==(l=(((c=(f=a[1].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&E(n,l)},d(a){a&&N(e)}}}function cf(t){var j,Y,W,T;let e,l=(((Y=(j=t[1].conf)==null?void 0:j.connection)==null?void 0:Y.ssid)??"SSID")+"",n,i,s,a,r,f,c,m,_,d,h=(((T=(W=t[1].conf)==null?void 0:W.connection)==null?void 0:T.psk)??"Password")+"",b,g,w,k,R,I,F;function M(B,X){return B[2]?Yc:Kc}let A=M(t),O=A(t);return{c(){e=p("div"),n=C(l),i=v(),s=p("label"),a=p("input"),r=C(" manual"),f=v(),c=p("br"),m=v(),O.c(),_=v(),d=p("div"),b=C(h),g=p("br"),w=v(),k=p("input"),u(a,"type","checkbox"),a.__value="true",H(a,a.__value),u(a,"class","rounded mb-1"),u(s,"class","float-right mr-3"),u(e,"class","my-3"),u(k,"name","sp"),u(k,"type","password"),u(k,"pattern",Mn),u(k,"class","in-s"),u(k,"autocomplete","off"),k.required=R=t[5]==2,u(d,"class","my-3")},m(B,X){P(B,e,X),o(e,n),o(e,i),o(e,s),o(s,a),a.checked=t[2],o(s,r),o(e,f),o(e,c),o(e,m),O.m(e,null),P(B,_,X),P(B,d,X),o(d,b),o(d,g),o(d,w),o(d,k),I||(F=ce(a,"change",t[9]),I=!0)},p(B,X){var y,K,V,U;X&2&&l!==(l=(((K=(y=B[1].conf)==null?void 0:y.connection)==null?void 0:K.ssid)??"SSID")+"")&&E(n,l),X&4&&(a.checked=B[2]),A===(A=M(B))&&O?O.p(B,X):(O.d(1),O=A(B),O&&(O.c(),O.m(e,null))),X&2&&h!==(h=(((U=(V=B[1].conf)==null?void 0:V.connection)==null?void 0:U.psk)??"Password")+"")&&E(b,h),X&32&&R!==(R=B[5]==2)&&(k.required=R)},d(B){B&&(N(e),N(_),N(d)),O.d(),I=!1,F()}}}function Kc(t){var a,r;let e,l,n,i=((a=t[3])==null?void 0:a.c)==-1&&_f(),s=((r=t[3])==null?void 0:r.n)&&mf(t);return{c(){e=p("select"),i&&i.c(),l=yt(),s&&s.c(),u(e,"name","ss"),u(e,"class","in-s"),e.required=n=t[5]==1||t[5]==2},m(f,c){P(f,e,c),i&&i.m(e,null),o(e,l),s&&s.m(e,null)},p(f,c){var m,_;((m=f[3])==null?void 0:m.c)==-1?i||(i=_f(),i.c(),i.m(e,l)):i&&(i.d(1),i=null),(_=f[3])!=null&&_.n?s?s.p(f,c):(s=mf(f),s.c(),s.m(e,null)):s&&(s.d(1),s=null),c&32&&n!==(n=f[5]==1||f[5]==2)&&(e.required=n)},d(f){f&&N(e),i&&i.d(),s&&s.d()}}}function Yc(t){let e,l;return{c(){e=p("input"),u(e,"name","ss"),u(e,"type","text"),u(e,"pattern",Mn),u(e,"class","in-s"),e.required=l=t[5]==1||t[5]==2},m(n,i){P(n,e,i)},p(n,i){i&32&&l!==(l=n[5]==1||n[5]==2)&&(e.required=l)},d(n){n&&N(e)}}}function _f(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",H(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function mf(t){var i;let e,l=rt((i=t[3])==null?void 0:i.n),n=[];for(let s=0;st[8].call(g)),u(m,"class","my-3"),u(B,"name","sh"),u(B,"type","text"),u(B,"class","in-s"),u(B,"maxlength","32"),u(B,"pattern",Vn),u(B,"placeholder","Optional, ex.: ams-reader"),u(B,"autocomplete","off"),u(V,"type","checkbox"),u(V,"name","sm"),V.__value="static",H(V,V.__value),u(V,"class","rounded mb-1"),u(y,"class","my-3"),u(ue,"type","submit"),u(ue,"class","btn-pri"),u(re,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(De,Ue){P(De,e,Ue),o(e,l),o(l,n),o(n,i),o(n,s),o(n,a),o(a,f),o(n,c),o(n,m),o(m,d),o(m,h),o(m,b),o(m,g),o(g,w),o(w,R),o(g,I),o(I,M),D&&D.m(g,null),Ke(g,t[5],!0),o(n,A),S&&S.m(n,null),o(n,O),o(n,j),o(j,W),o(j,T),o(j,B),H(B,t[0].hostname),o(n,X),o(n,y),o(y,K),o(K,V),V.checked=t[4],o(K,U),o(K,se),o(y,le),L&&L.m(y,null),o(n,Q),q&&q.m(n,null),o(n,ae),o(n,re),o(re,ue),o(ue,pe),P(De,oe,Ue),Se(J,De,Ue),$=!0,ke||(Ce=[ce(g,"change",t[8]),ce(B,"input",t[10]),ce(V,"change",t[11]),ce(n,"submit",pn(t[7]))],ke=!0)},p(De,[Ue]){var Ct,tt,ot,Mt,ht,at,it,ft,Lt,We,Re,He;(!$||Ue&2)&&r!==(r=(((Ct=De[1].setup)==null?void 0:Ct.title)??"Setup")+"")&&E(f,r),(!$||Ue&2)&&_!==(_=(((ot=(tt=De[1].conf)==null?void 0:tt.connection)==null?void 0:ot.title)??"Connection")+"")&&E(d,_),(!$||Ue&2)&&k!==(k=(((ht=(Mt=De[1].conf)==null?void 0:Mt.connection)==null?void 0:ht.wifi)??"Connect to WiFi")+"")&&E(R,k),(!$||Ue&2)&&F!==(F=(((it=(at=De[1].conf)==null?void 0:at.connection)==null?void 0:it.ap)??"Standalone access point")+"")&&E(M,F),De[0].if&&De[0].if.eth?D?D.p(De,Ue):(D=rf(De),D.c(),D.m(g,null)):D&&(D.d(1),D=null),Ue&32&&Ke(g,De[5]),De[5]==1||De[5]==2?S?S.p(De,Ue):(S=cf(De),S.c(),S.m(n,O)):S&&(S.d(1),S=null),(!$||Ue&2)&&Y!==(Y=(((Lt=(ft=De[1].conf)==null?void 0:ft.general)==null?void 0:Lt.hostname)??"Hostname")+"")&&E(W,Y),Ue&1&&B.value!==De[0].hostname&&H(B,De[0].hostname),Ue&16&&(V.checked=De[4]),(!$||Ue&2)&&G!==(G=(((We=De[1].setup)==null?void 0:We.static)??"Static IP")+"")&&E(se,G),De[4]?L?(L.p(De,Ue),Ue&16&&Z(L,1)):(L=df(De),L.c(),Z(L,1),L.m(y,null)):L&&(vt(),ie(L,1,1,()=>{L=null}),bt()),De[4]?q?q.p(De,Ue):(q=hf(De),q.c(),q.m(n,ae)):q&&(q.d(1),q=null),(!$||Ue&2)&&ne!==(ne=(((Re=De[1].btn)==null?void 0:Re.save)??"Save")+"")&&E(pe,ne);const xe={};Ue&64&&(xe.active=De[6]),Ue&2&&(xe.message=((He=De[1].setup)==null?void 0:He.mask)??"Saving"),J.$set(xe)},i(De){$||(Z(L),Z(J.$$.fragment,De),$=!0)},o(De){ie(L),ie(J.$$.fragment,De),$=!1},d(De){De&&(N(e),N(oe)),D&&D.d(),S&&S.d(),L&&L.d(),q&&q.d(),Me(J,De),ke=!1,jt(Ce)}}}function Xc(t,e,l){let n={};bl.subscribe(w=>{l(1,n=w)});let i=!1,s={};$i.subscribe(w=>{l(3,s=w)});let{sysinfo:a={}}=e,r=!1,f=1,c=!1;function m(w){cl.update(k=>(k.trying=w,k))}async function _(w){l(6,c=!0);const k=new FormData(w.target),R=new URLSearchParams;for(let M of k){const[A,O]=M;R.append(A,O)}let F=await(await fetch("save",{method:"POST",body:R})).json();l(6,c=!1),cl.update(M=>(M.hostname=k.get("sh"),M.usrcfg=F.success,M.booting=F.reboot,r&&(M.net.ip=k.get("si"),M.net.mask=k.get("su"),M.net.gw=k.get("sg"),M.net.dns1=k.get("sd")),F.reboot&&setTimeout(Wn,5e3,a,m),M))}function d(){f=Vt(this),l(5,f)}function h(){i=this.checked,l(2,i)}function b(){a.hostname=this.value,l(0,a)}function g(){r=this.checked,l(4,r)}return t.$$set=w=>{"sysinfo"in w&&l(0,a=w.sysinfo)},[a,n,i,s,r,f,c,_,d,h,b,g]}class Zc extends Tt{constructor(e){super(),Pt(this,e,Xc,Qc,Nt,{sysinfo:0})}}function Jc(t){var W,T,B,X;let e,l,n,i=(((W=t[2].upload)==null?void 0:W.title)??"Upload")+"",s,a,r,f,c,m=(((T=t[2].upload)==null?void 0:T.desc)??"")+"",_,d,h,b,g,w,k,R,I=(((B=t[2].btn)==null?void 0:B.upload)??"Upload")+"",F,M,A,O,j,Y;return A=new rl({props:{active:t[3],message:((X=t[2].upload)==null?void 0:X.mask)??"Uploading"}}),{c(){e=p("div"),l=p("div"),n=p("strong"),s=C(i),a=v(),r=C(t[1]),f=v(),c=p("p"),_=C(m),d=v(),h=p("form"),b=p("input"),g=v(),w=p("div"),k=p("button"),R=p("p"),F=C(I),M=v(),Ne(A.$$.fragment),u(c,"class","mb-4"),u(b,"name","file"),u(b,"type","file"),u(R,"class","mb-4"),u(k,"type","submit"),u(k,"class","btn-pri"),u(w,"class","w-full text-right mt-4"),u(h,"action",t[0]),u(h,"enctype","multipart/form-data"),u(h,"method","post"),u(h,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(y,K){P(y,e,K),o(e,l),o(l,n),o(n,s),o(n,a),o(n,r),o(l,f),o(l,c),o(c,_),o(l,d),o(l,h),o(h,b),o(h,g),o(h,w),o(w,k),o(k,R),o(R,F),P(y,M,K),Se(A,y,K),O=!0,j||(Y=ce(h,"submit",t[4]),j=!0)},p(y,[K]){var U,G,se,le;(!O||K&4)&&i!==(i=(((U=y[2].upload)==null?void 0:U.title)??"Upload")+"")&&E(s,i),(!O||K&2)&&E(r,y[1]),(!O||K&4)&&m!==(m=(((G=y[2].upload)==null?void 0:G.desc)??"")+"")&&E(_,m),(!O||K&4)&&I!==(I=(((se=y[2].btn)==null?void 0:se.upload)??"Upload")+"")&&E(F,I),(!O||K&1)&&u(h,"action",y[0]);const V={};K&8&&(V.active=y[3]),K&4&&(V.message=((le=y[2].upload)==null?void 0:le.mask)??"Uploading"),A.$set(V)},i(y){O||(Z(A.$$.fragment,y),O=!0)},o(y){ie(A.$$.fragment,y),O=!1},d(y){y&&(N(e),N(M)),Me(A,y),j=!1,Y()}}}function $c(t,e,l){let{action:n}=e,{title:i}=e,s={};bl.subscribe(f=>{l(2,s=f)});let a=!1;const r=()=>l(3,a=!0);return t.$$set=f=>{"action"in f&&l(0,n=f.action),"title"in f&&l(1,i=f.title)},[n,i,s,a,r]}class ls extends Tt{constructor(e){super(),Pt(this,e,$c,Jc,Nt,{action:0,title:1})}}function xc(t){var J,$,ke,Ce,D,S,L;let e,l,n,i,s=(((J=t[1].consent)==null?void 0:J.title)??"Consents")+"",a,r,f,c,m,_=((($=t[1].consent)==null?void 0:$.one_click)??"One-click")+"",d,h,b,g,w=(((ke=t[1].consent)==null?void 0:ke.read_more)??"Read more")+"",k,R,I,F,M,A,O,j=(((Ce=t[1].consent)==null?void 0:Ce.yes)??"Yes")+"",Y,W,T,B,X,y,K=(((D=t[1].consent)==null?void 0:D.no)??"No")+"",V,U,G,se,le,Q=(((S=t[1].btn)==null?void 0:S.save)??"Save")+"",ae,re,ue,ne,pe,oe;return ue=new rl({props:{active:t[2],message:((L=t[1].consent)==null?void 0:L.mask_saving)??"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("div"),a=C(s),r=v(),f=p("hr"),c=v(),m=p("div"),d=C(_),h=p("br"),b=v(),g=p("a"),k=C(w),R=p("br"),I=v(),F=p("label"),M=p("input"),O=v(),Y=C(j),W=v(),T=p("label"),B=p("input"),y=v(),V=C(K),U=p("br"),G=v(),se=p("div"),le=p("button"),ae=C(Q),re=v(),Ne(ue.$$.fragment),u(g,"href",_l("Data-collection-on-one-click-firmware-upgrade")),u(g,"target","_blank"),u(g,"class","text-blue-600 hover:text-blue-800"),u(M,"type","radio"),u(M,"name","sf"),M.value=1,M.checked=A=t[0].fwconsent===1,u(M,"class","rounded m-2"),M.required=!0,u(B,"type","radio"),u(B,"name","sf"),B.value=2,B.checked=X=t[0].fwconsent===2,u(B,"class","rounded m-2"),B.required=!0,u(m,"class","my-3"),u(le,"type","submit"),u(le,"class","btn-pri"),u(se,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(q,z){P(q,e,z),o(e,l),o(l,n),o(n,i),o(i,a),o(n,r),o(n,f),o(n,c),o(n,m),o(m,d),o(m,h),o(m,b),o(m,g),o(g,k),o(m,R),o(m,I),o(m,F),o(F,M),o(F,O),o(F,Y),o(m,W),o(m,T),o(T,B),o(T,y),o(T,V),o(m,U),o(n,G),o(n,se),o(se,le),o(le,ae),P(q,re,z),Se(ue,q,z),ne=!0,pe||(oe=ce(n,"submit",pn(t[3])),pe=!0)},p(q,[z]){var fe,_e,de,x,he,be,Ae;(!ne||z&2)&&s!==(s=(((fe=q[1].consent)==null?void 0:fe.title)??"Consents")+"")&&E(a,s),(!ne||z&2)&&_!==(_=(((_e=q[1].consent)==null?void 0:_e.one_click)??"One-click")+"")&&E(d,_),(!ne||z&2)&&w!==(w=(((de=q[1].consent)==null?void 0:de.read_more)??"Read more")+"")&&E(k,w),(!ne||z&1&&A!==(A=q[0].fwconsent===1))&&(M.checked=A),(!ne||z&2)&&j!==(j=(((x=q[1].consent)==null?void 0:x.yes)??"Yes")+"")&&E(Y,j),(!ne||z&1&&X!==(X=q[0].fwconsent===2))&&(B.checked=X),(!ne||z&2)&&K!==(K=(((he=q[1].consent)==null?void 0:he.no)??"No")+"")&&E(V,K),(!ne||z&2)&&Q!==(Q=(((be=q[1].btn)==null?void 0:be.save)??"Save")+"")&&E(ae,Q);const ee={};z&4&&(ee.active=q[2]),z&2&&(ee.message=((Ae=q[1].consent)==null?void 0:Ae.mask_saving)??"Saving"),ue.$set(ee)},i(q){ne||(Z(ue.$$.fragment,q),ne=!0)},o(q){ie(ue.$$.fragment,q),ne=!1},d(q){q&&(N(e),N(re)),Me(ue,q),pe=!1,oe()}}}function e_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,s={};bl.subscribe(f=>{l(1,s=f)});let a=!1;async function r(f){l(2,a=!0);const c=new FormData(f.target),m=new URLSearchParams;for(let h of c){const[b,g]=h;m.append(b,g)}let d=await(await fetch("save",{method:"POST",body:m})).json();l(2,a=!1),cl.update(h=>(h.fwconsent=c.sf===!0?1:c.sf===!1?2:0,h.booting=d.reboot,h)),sn(n)}return t.$$set=f=>{"basepath"in f&&l(4,n=f.basepath),"sysinfo"in f&&l(0,i=f.sysinfo)},[i,s,a,r,n]}class t_ extends Tt{constructor(e){super(),Pt(this,e,e_,xc,Nt,{basepath:4,sysinfo:0})}}function vf(t,e,l){const n=t.slice();return n[30]=e[l],n[31]=e,n[32]=l,n}function bf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function l_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function gf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function n_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function kf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function wf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Cf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Sf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Mf(t){let e,l=rt(t[1].o),n=[];for(let i=0;i0?"text-green-600":"text-gray-300"),u(xe,"class",tt=t[32]{l(0,i=U)});let s=["mo","tu","we","th","fr","sa","su"],a={},r=!0,f=!1;Du.subscribe(U=>{U.o&&(l(1,a=U),l(2,r=!1))}),y0();async function c(U){l(3,f=!0);const G=new URLSearchParams;G.append("r","true"),G.append("rc",a.o.length),a.o.forEach(function(le,Q){G.append("rt"+Q,le.t),G.append("rn"+Q,le.n),G.append("rd"+Q,le.d),G.append("ra"+Q,le.a),G.append("rh"+Q,le.h),G.append("rv"+Q,le.v),G.append("rsm"+Q,le.s.m),G.append("rsd"+Q,le.s.d),G.append("rem"+Q,le.e.m),G.append("red"+Q,le.e.d)}),await(await fetch("save",{method:"POST",body:G})).json(),l(3,f=!1),sn(n+"configuration")}let m=function(U,G){return U.includes(G)?U=U.filter(function(se){return se!==G}):U.push(G),U},_=function(){let U=a.o;U.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),l(1,a.o=U,a)},d=function(U){let G=a.o;G.splice(U,1),l(1,a.o=G,a)},h=function(U){if(U<=0)return;let G=a.o;var se=G[U];G[U]=G[U-1],G[U-1]=se,l(1,a.o=G,a)},b=function(U){let G=a.o;if(!(U>=G.length-1)){var se=G[U];G[U]=G[U+1],G[U+1]=se,l(1,a.o=G,a)}};function g(U,G){U[G].n=this.value,l(1,a)}function w(U,G){U[G].d=Vt(this),l(1,a)}function k(U,G){U[G].t=Vt(this),l(1,a)}function R(U,G){U[G].v=ye(this.value),l(1,a)}const I=(U,G,se,le)=>l(1,se[le].a=m(U.a,G),a),F=(U,G,se,le)=>l(1,se[le].h=m(U.h,G),a),M=(U,G,se,le)=>l(1,se[le].h=m(U.h,G+8),a),A=(U,G,se,le)=>l(1,se[le].h=m(U.h,G+16),a);function O(U,G){U[G].s.d=Vt(this),l(1,a)}function j(U,G){U[G].s.m=Vt(this),l(1,a)}function Y(U,G){U[G].e.d=Vt(this),l(1,a)}function W(U,G){U[G].e.m=Vt(this),l(1,a)}const T=U=>h(U),B=U=>h(U),X=U=>b(U),y=U=>b(U),K=U=>d(U),V=U=>d(U);return t.$$set=U=>{"basepath"in U&&l(11,n=U.basepath)},[i,a,r,f,s,c,m,_,d,h,b,n,g,w,k,R,I,F,M,A,O,j,Y,W,T,B,X,y,K,V]}class f_ extends Tt{constructor(e){super(),Pt(this,e,a_,o_,Nt,{basepath:11},null,[-1,-1])}}function Of(t,e,l){const n=t.slice();return n[13]=e[l],n[14]=e,n[15]=l,n}function Lf(t,e,l){const n=t.slice();return n[13]=e[l],n[16]=e,n[17]=l,n}function If(t){let e,l,n,i=rt(t[1]),s=[];for(let a=0;a{l(3,r=w)});let f=!1,c,m;async function _(){if(confirm("Clear all data?"))for(let w in i)(w.startsWith("i")||w.startsWith("e"))&&l(0,i[w]=0,i)}let d=!1;async function h(w){l(5,d=!0);const k=new FormData(w.target),R=new URLSearchParams;for(let F of k){const[M,A]=F;R.append(M,A)}await(await fetch(s,{method:"POST",body:R})).json(),l(5,d=!1),sn(a)}function b(w){i[w.key]=ye(this.value),l(0,i)}function g(w){i[w.key]=ye(this.value),l(0,i)}return t.$$set=w=>{"prefix"in w&&l(8,n=w.prefix),"data"in w&&l(0,i=w.data),"url"in w&&l(9,s=w.url),"basepath"in w&&l(10,a=w.basepath)},t.$$.update=()=>{if(t.$$.dirty&263){l(1,c=[]),l(2,m=[]);for(let w in i){let k=[];w.startsWith("i")?k=c:w.startsWith("e")&&(k=m,i[w]&&l(4,f=!0)),k.push({key:w,name:n+" "+w.substring(1),value:i[w]})}}},[i,c,m,r,f,d,_,h,n,s,a,b,g]}class Lu extends Tt{constructor(e){super(),Pt(this,e,r_,u_,Nt,{prefix:8,data:0,url:9,basepath:10})}}function c_(t){let e,l;return e=new j0({props:{data:t[6],sysinfo:t[7],prices:t[1],dayPlot:t[2],monthPlot:t[3],temperatures:t[4],translations:t[5],tariffData:t[8]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.data=n[6]),i&128&&(s.sysinfo=n[7]),i&2&&(s.prices=n[1]),i&4&&(s.dayPlot=n[2]),i&8&&(s.monthPlot=n[3]),i&16&&(s.temperatures=n[4]),i&32&&(s.translations=n[5]),i&256&&(s.tariffData=n[8]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function __(t){let e,l;return e=new Tc({props:{sysinfo:t[7],basepath:t[0],data:t[6]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&1&&(s.basepath=n[0]),i&64&&(s.data=n[6]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function m_(t){let e,l;return e=new f_({props:{basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function p_(t){let e,l;return e=new jc({props:{sysinfo:t[7],data:t[6]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&64&&(s.data=n[6]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function d_(t){let e,l;return e=new ls({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function h_(t){let e,l;return e=new ls({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function v_(t){let e,l;return e=new ls({props:{title:"private key",action:"/mqtt-key"}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function b_(t){let e,l;return e=new t_({props:{sysinfo:t[7],basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function g_(t){let e,l;return e=new Zc({props:{sysinfo:t[7]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function k_(t){let e,l;return e=new Vc({props:{sysinfo:t[7],basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function w_(t){let e,l;return e=new Lu({props:{prefix:"UTC Hour",data:t[2],url:"/dayplot",basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&4&&(s.data=n[2]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function C_(t){let e,l;return e=new Lu({props:{prefix:"Day",data:t[3],url:"/monthplot",basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&8&&(s.data=n[3]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function S_(t){let e,l,n,i,s,a,r,f,c,m,_,d,h,b,g,w,k,R,I,F,M,A,O,j,Y,W;return e=new z1({props:{data:t[6],basepath:t[0]}}),n=new dl({props:{path:"/",$$slots:{default:[c_]},$$scope:{ctx:t}}}),s=new dl({props:{path:"/configuration",$$slots:{default:[__]},$$scope:{ctx:t}}}),r=new dl({props:{path:"/priceconfig",$$slots:{default:[m_]},$$scope:{ctx:t}}}),c=new dl({props:{path:"/status",$$slots:{default:[p_]},$$scope:{ctx:t}}}),_=new dl({props:{path:"/mqtt-ca",$$slots:{default:[d_]},$$scope:{ctx:t}}}),h=new dl({props:{path:"/mqtt-cert",$$slots:{default:[h_]},$$scope:{ctx:t}}}),g=new dl({props:{path:"/mqtt-key",$$slots:{default:[v_]},$$scope:{ctx:t}}}),k=new dl({props:{path:"/consent",$$slots:{default:[b_]},$$scope:{ctx:t}}}),I=new dl({props:{path:"/setup",$$slots:{default:[g_]},$$scope:{ctx:t}}}),M=new dl({props:{path:"/vendor",$$slots:{default:[k_]},$$scope:{ctx:t}}}),O=new dl({props:{path:"/edit-day",$$slots:{default:[w_]},$$scope:{ctx:t}}}),Y=new dl({props:{path:"/edit-month",$$slots:{default:[C_]},$$scope:{ctx:t}}}),{c(){Ne(e.$$.fragment),l=v(),Ne(n.$$.fragment),i=v(),Ne(s.$$.fragment),a=v(),Ne(r.$$.fragment),f=v(),Ne(c.$$.fragment),m=v(),Ne(_.$$.fragment),d=v(),Ne(h.$$.fragment),b=v(),Ne(g.$$.fragment),w=v(),Ne(k.$$.fragment),R=v(),Ne(I.$$.fragment),F=v(),Ne(M.$$.fragment),A=v(),Ne(O.$$.fragment),j=v(),Ne(Y.$$.fragment)},m(T,B){Se(e,T,B),P(T,l,B),Se(n,T,B),P(T,i,B),Se(s,T,B),P(T,a,B),Se(r,T,B),P(T,f,B),Se(c,T,B),P(T,m,B),Se(_,T,B),P(T,d,B),Se(h,T,B),P(T,b,B),Se(g,T,B),P(T,w,B),Se(k,T,B),P(T,R,B),Se(I,T,B),P(T,F,B),Se(M,T,B),P(T,A,B),Se(O,T,B),P(T,j,B),Se(Y,T,B),W=!0},p(T,B){const X={};B&64&&(X.data=T[6]),B&1&&(X.basepath=T[0]),e.$set(X);const y={};B&2558&&(y.$$scope={dirty:B,ctx:T}),n.$set(y);const K={};B&2241&&(K.$$scope={dirty:B,ctx:T}),s.$set(K);const V={};B&2049&&(V.$$scope={dirty:B,ctx:T}),r.$set(V);const U={};B&2240&&(U.$$scope={dirty:B,ctx:T}),c.$set(U);const G={};B&2048&&(G.$$scope={dirty:B,ctx:T}),_.$set(G);const se={};B&2048&&(se.$$scope={dirty:B,ctx:T}),h.$set(se);const le={};B&2048&&(le.$$scope={dirty:B,ctx:T}),g.$set(le);const Q={};B&2177&&(Q.$$scope={dirty:B,ctx:T}),k.$set(Q);const ae={};B&2176&&(ae.$$scope={dirty:B,ctx:T}),I.$set(ae);const re={};B&2177&&(re.$$scope={dirty:B,ctx:T}),M.$set(re);const ue={};B&2053&&(ue.$$scope={dirty:B,ctx:T}),O.$set(ue);const ne={};B&2057&&(ne.$$scope={dirty:B,ctx:T}),Y.$set(ne)},i(T){W||(Z(e.$$.fragment,T),Z(n.$$.fragment,T),Z(s.$$.fragment,T),Z(r.$$.fragment,T),Z(c.$$.fragment,T),Z(_.$$.fragment,T),Z(h.$$.fragment,T),Z(g.$$.fragment,T),Z(k.$$.fragment,T),Z(I.$$.fragment,T),Z(M.$$.fragment,T),Z(O.$$.fragment,T),Z(Y.$$.fragment,T),W=!0)},o(T){ie(e.$$.fragment,T),ie(n.$$.fragment,T),ie(s.$$.fragment,T),ie(r.$$.fragment,T),ie(c.$$.fragment,T),ie(_.$$.fragment,T),ie(h.$$.fragment,T),ie(g.$$.fragment,T),ie(k.$$.fragment,T),ie(I.$$.fragment,T),ie(M.$$.fragment,T),ie(O.$$.fragment,T),ie(Y.$$.fragment,T),W=!1},d(T){T&&(N(l),N(i),N(a),N(f),N(m),N(d),N(b),N(w),N(R),N(F),N(A),N(j)),Me(e,T),Me(n,T),Me(s,T),Me(r,T),Me(c,T),Me(_,T),Me(h,T),Me(g,T),Me(k,T),Me(I,T),Me(M,T),Me(O,T),Me(Y,T)}}}function Bf(t){let e,l,n,i;const s=[N_,M_],a=[];function r(f,c){return f[7].trying?0:1}return e=r(t),l=a[e]=s[e](t),{c(){l.c(),n=yt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(vt(),ie(a[m],1,1,()=>{a[m]=null}),bt(),l=a[e],l?l.p(f,c):(l=a[e]=s[e](f),l.c()),Z(l,1),l.m(n.parentNode,n))},i(f){i||(Z(l),i=!0)},o(f){ie(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function M_(t){let e,l;return e=new rl({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function N_(t){let e,l;return e=new rl({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[7].trying}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.message="Device is booting, please wait. Trying to reach it on "+n[7].trying),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function P_(t){let e,l,n,i;l=new cu({props:{basepath:t[0],$$slots:{default:[S_]},$$scope:{ctx:t}}});let s=t[7].booting&&Bf(t);return{c(){e=p("div"),Ne(l.$$.fragment),n=v(),s&&s.c(),u(e,"class","container mx-auto m-3")},m(a,r){P(a,e,r),Se(l,e,null),o(e,n),s&&s.m(e,null),i=!0},p(a,[r]){const f={};r&1&&(f.basepath=a[0]),r&2559&&(f.$$scope={dirty:r,ctx:a}),l.$set(f),a[7].booting?s?(s.p(a,r),r&128&&Z(s,1)):(s=Bf(a),s.c(),Z(s,1),s.m(e,null)):s&&(vt(),ie(s,1,1,()=>{s=null}),bt())},i(a){i||(Z(l.$$.fragment,a),Z(s),i=!0)},o(a){ie(l.$$.fragment,a),ie(s),i=!1},d(a){a&&N(e),Me(l),s&&s.d()}}}function T_(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i;Ji.subscribe(b=>{l(1,i=b)});let s;ku.subscribe(b=>{l(2,s=b)});let a;wu.subscribe(b=>{l(3,a=b)});let r;Cu.subscribe(b=>{l(4,r=b)});let f={};bl.subscribe(b=>{l(5,f=b)});let c,m={},_={},d;cl.subscribe(b=>{var g;l(7,_=b),_.vndcfg===!1?sn(n+"vendor"):_.usrcfg===!1?sn(n+"setup"):_.fwconsent===0&&sn(n+"consent"),_.ui.k===1?document.documentElement.classList.add("dark"):_.ui.k===0?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),_.ui.lang&&_.ui.lang!=((g=f==null?void 0:f.language)==null?void 0:g.code)&&Nu(_.ui.lang),_.version&&d&&_.version!=d&&window.location.reload(),d=_.version,c&&clearTimeout(c),c=setTimeout(ci,!m||!m.u||m.u<30||_!=null&&_.upgrading?1e4:3e5)}),f1.subscribe(b=>{l(6,m=b),E0(b)});let h={};return Mu.subscribe(b=>{l(8,h=b)}),Su(),[n,i,s,a,r,f,m,_,h]}class q_ extends Tt{constructor(e){super(),Pt(this,e,T_,P_,Nt,{})}}new q_({target:document.getElementById("app")}); +`);for(let X in B){let y=B[X];y.startsWith("hostname ")?g.hostname=y.split(" ")[1]:y.startsWith("ip ")&&(g.ip=y.split(" ")[1])}};Y.onload=W,Y.readAsText(j)}},[n,i,h,a,c,m,_,d,b,s,r,f,w,k,R,I,F,M,A,O]}class jc extends Tt{constructor(e){super(),Pt(this,e,Bc,Fc,Nt,{data:0,sysinfo:1})}}function ef(t){let e,l,n=Je(t[0],7)+"",i,s,a=Je(t[0],5)+"",r,f,c=Je(t[0],4)+"",m,_,d=Je(t[0],3)+"",h,b,g,w,k=Je(t[0],2)+"",R,I,F=Je(t[0],1)+"",M,A,O=Je(t[0],0)+"",j,Y,W,T,B=Je(t[0],101)+"",X,y,K=Je(t[0],100)+"",V;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=p("option"),h=C(d),b=v(),g=p("optgroup"),w=p("option"),R=C(k),I=p("option"),M=C(F),A=p("option"),j=C(O),Y=v(),W=p("optgroup"),T=p("option"),X=C(B),y=p("option"),V=C(K),l.__value=7,H(l,l.__value),s.__value=5,H(s,s.__value),f.__value=4,H(f,f.__value),_.__value=3,H(_,_.__value),u(e,"label","amsleser.no"),w.__value=2,H(w,w.__value),I.__value=1,H(I,I.__value),A.__value=0,H(A,A.__value),u(g,"label","Custom hardware"),T.__value=101,H(T,T.__value),y.__value=100,H(y,y.__value),u(W,"label","Generic hardware")},m(U,G){P(U,e,G),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),o(e,_),o(_,h),P(U,b,G),P(U,g,G),o(g,w),o(w,R),o(g,I),o(I,M),o(g,A),o(A,j),P(U,Y,G),P(U,W,G),o(W,T),o(T,X),o(W,y),o(y,V)},p(U,G){G&1&&n!==(n=Je(U[0],7)+"")&&E(i,n),G&1&&a!==(a=Je(U[0],5)+"")&&E(r,a),G&1&&c!==(c=Je(U[0],4)+"")&&E(m,c),G&1&&d!==(d=Je(U[0],3)+"")&&E(h,d),G&1&&k!==(k=Je(U[0],2)+"")&&E(R,k),G&1&&F!==(F=Je(U[0],1)+"")&&E(M,F),G&1&&O!==(O=Je(U[0],0)+"")&&E(j,O),G&1&&B!==(B=Je(U[0],101)+"")&&E(X,B),G&1&&K!==(K=Je(U[0],100)+"")&&E(V,K)},d(U){U&&(N(e),N(b),N(g),N(Y),N(W))}}}function tf(t){let e,l,n=Je(t[0],201)+"",i,s,a=Je(t[0],202)+"",r,f,c=Je(t[0],203)+"",m,_,d=Je(t[0],241)+"",h,b,g=Je(t[0],242)+"",w,k,R=Je(t[0],243)+"",I,F,M=Je(t[0],245)+"",A,O,j=Je(t[0],200)+"",Y;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=p("option"),h=C(d),b=p("option"),w=C(g),k=p("option"),I=C(R),F=p("option"),A=C(M),O=p("option"),Y=C(j),l.__value=201,H(l,l.__value),s.__value=202,H(s,s.__value),f.__value=203,H(f,f.__value),_.__value=241,H(_,_.__value),b.__value=242,H(b,b.__value),k.__value=243,H(k,k.__value),F.__value=245,H(F,F.__value),O.__value=200,H(O,O.__value),u(e,"label","Generic hardware")},m(W,T){P(W,e,T),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),o(e,_),o(_,h),o(e,b),o(b,w),o(e,k),o(k,I),o(e,F),o(F,A),o(e,O),o(O,Y)},p(W,T){T&1&&n!==(n=Je(W[0],201)+"")&&E(i,n),T&1&&a!==(a=Je(W[0],202)+"")&&E(r,a),T&1&&c!==(c=Je(W[0],203)+"")&&E(m,c),T&1&&d!==(d=Je(W[0],241)+"")&&E(h,d),T&1&&g!==(g=Je(W[0],242)+"")&&E(w,g),T&1&&R!==(R=Je(W[0],243)+"")&&E(I,R),T&1&&M!==(M=Je(W[0],245)+"")&&E(A,M),T&1&&j!==(j=Je(W[0],200)+"")&&E(Y,j)},d(W){W&&N(e)}}}function lf(t){let e,l,n=Je(t[0],7)+"",i,s,a=Je(t[0],6)+"",r,f,c=Je(t[0],5)+"",m,_,d,h,b=Je(t[0],51)+"",g,w,k=Je(t[0],50)+"",R;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=p("option"),r=C(a),f=p("option"),m=C(c),_=v(),d=p("optgroup"),h=p("option"),g=C(b),w=p("option"),R=C(k),l.__value=7,H(l,l.__value),s.__value=6,H(s,s.__value),f.__value=5,H(f,f.__value),u(e,"label","amsleser.no"),h.__value=51,H(h,h.__value),w.__value=50,H(w,w.__value),u(d,"label","Generic hardware")},m(I,F){P(I,e,F),o(e,l),o(l,i),o(e,s),o(s,r),o(e,f),o(f,m),P(I,_,F),P(I,d,F),o(d,h),o(h,g),o(d,w),o(w,R)},p(I,F){F&1&&n!==(n=Je(I[0],7)+"")&&E(i,n),F&1&&a!==(a=Je(I[0],6)+"")&&E(r,a),F&1&&c!==(c=Je(I[0],5)+"")&&E(m,c),F&1&&b!==(b=Je(I[0],51)+"")&&E(g,b),F&1&&k!==(k=Je(I[0],50)+"")&&E(R,k)},d(I){I&&(N(e),N(_),N(d))}}}function nf(t){let e,l,n=Je(t[0],8)+"",i,s,a,r,f=Je(t[0],71)+"",c,m,_=Je(t[0],70)+"",d;return{c(){e=p("optgroup"),l=p("option"),i=C(n),s=v(),a=p("optgroup"),r=p("option"),c=C(f),m=p("option"),d=C(_),l.__value=8,H(l,l.__value),u(e,"label","Custom hardware"),r.__value=71,H(r,r.__value),m.__value=70,H(m,m.__value),u(a,"label","Generic hardware")},m(h,b){P(h,e,b),o(e,l),o(l,i),P(h,s,b),P(h,a,b),o(a,r),o(r,c),o(a,m),o(m,d)},p(h,b){b&1&&n!==(n=Je(h[0],8)+"")&&E(i,n),b&1&&f!==(f=Je(h[0],71)+"")&&E(c,f),b&1&&_!==(_=Je(h[0],70)+"")&&E(d,_)},d(h){h&&(N(e),N(s),N(a))}}}function sf(t){let e,l,n=Je(t[0],200)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=200,H(l,l.__value),u(e,"label","Generic hardware")},m(s,a){P(s,e,a),o(e,l),o(l,i)},p(s,a){a&1&&n!==(n=Je(s[0],200)+"")&&E(i,n)},d(s){s&&N(e)}}}function of(t){let e,l,n=Je(t[0],80)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=C(n),l.__value=80,H(l,l.__value),u(e,"label","Generic hardware")},m(s,a){P(s,e,a),o(e,l),o(l,i)},p(s,a){a&1&&n!==(n=Je(s[0],80)+"")&&E(i,n)},d(s){s&&N(e)}}}function Hc(t){let e,l,n,i,s,a,r,f,c=t[0]=="esp8266"&&ef(t),m=t[0]=="esp32"&&tf(t),_=t[0]=="esp32s2"&&lf(t),d=t[0]=="esp32c3"&&nf(t),h=t[0]=="esp32solo"&&sf(t),b=t[0]=="esp32s3"&&of(t);return{c(){e=p("option"),l=v(),c&&c.c(),n=v(),m&&m.c(),i=v(),_&&_.c(),s=v(),d&&d.c(),a=v(),h&&h.c(),r=v(),b&&b.c(),f=yt(),e.__value=-1,H(e,e.__value)},m(g,w){P(g,e,w),P(g,l,w),c&&c.m(g,w),P(g,n,w),m&&m.m(g,w),P(g,i,w),_&&_.m(g,w),P(g,s,w),d&&d.m(g,w),P(g,a,w),h&&h.m(g,w),P(g,r,w),b&&b.m(g,w),P(g,f,w)},p(g,[w]){g[0]=="esp8266"?c?c.p(g,w):(c=ef(g),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),g[0]=="esp32"?m?m.p(g,w):(m=tf(g),m.c(),m.m(i.parentNode,i)):m&&(m.d(1),m=null),g[0]=="esp32s2"?_?_.p(g,w):(_=lf(g),_.c(),_.m(s.parentNode,s)):_&&(_.d(1),_=null),g[0]=="esp32c3"?d?d.p(g,w):(d=nf(g),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null),g[0]=="esp32solo"?h?h.p(g,w):(h=sf(g),h.c(),h.m(r.parentNode,r)):h&&(h.d(1),h=null),g[0]=="esp32s3"?b?b.p(g,w):(b=of(g),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i:Ye,o:Ye,d(g){g&&(N(e),N(l),N(n),N(i),N(s),N(a),N(r),N(f)),c&&c.d(g),m&&m.d(g),_&&_.d(g),d&&d.d(g),h&&h.d(g),b&&b.d(g)}}}function yc(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class zc extends Tt{constructor(e){super(),Pt(this,e,yc,Hc,Nt,{chip:0})}}function af(t){let e;return{c(){e=p("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(e,"class","bd-red")},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function ff(t){let e,l,n,i,s,a,r;return a=new Bi({props:{chip:t[0].chip}}),{c(){e=p("div"),l=C("HAN GPIO"),n=p("br"),i=v(),s=p("select"),Ne(a.$$.fragment),u(s,"name","vh"),u(s,"class","in-s"),u(e,"class","my-3")},m(f,c){P(f,e,c),o(e,l),o(e,n),o(e,i),o(e,s),Se(a,s,null),r=!0},p(f,c){const m={};c&1&&(m.chip=f[0].chip),a.$set(m)},i(f){r||(Z(a.$$.fragment,f),r=!0)},o(f){ie(a.$$.fragment,f),r=!1},d(f){f&&N(e),Me(a)}}}function Wc(t){let e,l,n,i,s,a,r,f,c,m,_,d,h,b,g,w,k,R,I,F,M,A,O,j,Y,W,T,B,X,y=t[0].usrcfg&&af();b=new zc({props:{chip:t[0].chip}});let K=t[0].board&&t[0].board>20&&ff(t);return W=new rl({props:{active:t[1],message:"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),s=v(),a=p("strong"),a.textContent="Initial configuration",r=v(),y&&y.c(),f=v(),c=p("div"),m=C("Board type"),_=p("br"),d=v(),h=p("select"),Ne(b.$$.fragment),g=v(),K&&K.c(),w=v(),k=p("div"),R=p("label"),I=p("input"),F=C(" Clear all other configuration"),M=v(),A=p("div"),A.innerHTML='',O=v(),j=p("span"),j.textContent=" ",Y=v(),Ne(W.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(a,"class","text-sm"),u(h,"name","vb"),u(h,"class","in-s"),t[0].board===void 0&&At(()=>t[5].call(h)),u(c,"class","my-3"),u(I,"type","checkbox"),u(I,"name","vr"),I.__value="true",H(I,I.__value),u(I,"class","rounded mb-1"),u(k,"class","my-3"),u(A,"class","my-3"),u(j,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(V,U){P(V,e,U),o(e,l),o(l,n),o(n,i),o(n,s),o(n,a),o(n,r),y&&y.m(n,null),o(n,f),o(n,c),o(c,m),o(c,_),o(c,d),o(c,h),Se(b,h,null),Ke(h,t[0].board,!0),o(n,g),K&&K.m(n,null),o(n,w),o(n,k),o(k,R),o(R,I),I.checked=t[2],o(R,F),o(n,M),o(n,A),o(n,O),o(n,j),P(V,Y,U),Se(W,V,U),T=!0,B||(X=[ce(h,"change",t[5]),ce(I,"change",t[6]),ce(n,"submit",pn(t[3]))],B=!0)},p(V,[U]){V[0].usrcfg?y||(y=af(),y.c(),y.m(n,f)):y&&(y.d(1),y=null);const G={};U&1&&(G.chip=V[0].chip),b.$set(G),U&1&&Ke(h,V[0].board),V[0].board&&V[0].board>20?K?(K.p(V,U),U&1&&Z(K,1)):(K=ff(V),K.c(),Z(K,1),K.m(n,w)):K&&(vt(),ie(K,1,1,()=>{K=null}),bt()),U&4&&(I.checked=V[2]);const se={};U&2&&(se.active=V[1]),W.$set(se)},i(V){T||(Z(b.$$.fragment,V),Z(K),Z(W.$$.fragment,V),T=!0)},o(V){ie(b.$$.fragment,V),ie(K),ie(W.$$.fragment,V),T=!1},d(V){V&&(N(e),N(Y)),y&&y.d(),Me(b),K&&K.d(),Me(W,V),B=!1,jt(X)}}}function Gc(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,s=!1;async function a(m){l(1,s=!0);const _=new FormData(m.target),d=new URLSearchParams;for(let g of _){const[w,k]=g;d.append(w,k)}let b=await(await fetch("save",{method:"POST",body:d})).json();l(1,s=!1),cl.update(g=>(g.vndcfg=b.success,g.booting=b.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),sn(n+(i.usrcfg?"/":"/setup"))}let r=!0;cl.subscribe(m=>{l(0,i=m),m.fwconsent===1&&l(2,r=!i.usrcfg)});function f(){i.board=Vt(this),l(0,i)}function c(){r=this.checked,l(2,r)}return t.$$set=m=>{"basepath"in m&&l(4,n=m.basepath),"sysinfo"in m&&l(0,i=m.sysinfo)},[i,s,r,a,n,f,c]}class Vc extends Tt{constructor(e){super(),Pt(this,e,Gc,Wc,Nt,{basepath:4,sysinfo:0})}}function uf(t,e,l){const n=t.slice();return n[13]=e[l],n}function rf(t){var i,s;let e,l=(((s=(i=t[1].conf)==null?void 0:i.connection)==null?void 0:s.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=C(l),e.__value=3,H(e,e.__value)},m(a,r){P(a,e,r),o(e,n)},p(a,r){var f,c;r&2&&l!==(l=(((c=(f=a[1].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&E(n,l)},d(a){a&&N(e)}}}function cf(t){var j,Y,W,T;let e,l=(((Y=(j=t[1].conf)==null?void 0:j.connection)==null?void 0:Y.ssid)??"SSID")+"",n,i,s,a,r,f,c,m,_,d,h=(((T=(W=t[1].conf)==null?void 0:W.connection)==null?void 0:T.psk)??"Password")+"",b,g,w,k,R,I,F;function M(B,X){return B[2]?Yc:Kc}let A=M(t),O=A(t);return{c(){e=p("div"),n=C(l),i=v(),s=p("label"),a=p("input"),r=C(" manual"),f=v(),c=p("br"),m=v(),O.c(),_=v(),d=p("div"),b=C(h),g=p("br"),w=v(),k=p("input"),u(a,"type","checkbox"),a.__value="true",H(a,a.__value),u(a,"class","rounded mb-1"),u(s,"class","float-right mr-3"),u(e,"class","my-3"),u(k,"name","sp"),u(k,"type","password"),u(k,"pattern",Mn),u(k,"class","in-s"),u(k,"autocomplete","off"),k.required=R=t[5]==2,u(d,"class","my-3")},m(B,X){P(B,e,X),o(e,n),o(e,i),o(e,s),o(s,a),a.checked=t[2],o(s,r),o(e,f),o(e,c),o(e,m),O.m(e,null),P(B,_,X),P(B,d,X),o(d,b),o(d,g),o(d,w),o(d,k),I||(F=ce(a,"change",t[9]),I=!0)},p(B,X){var y,K,V,U;X&2&&l!==(l=(((K=(y=B[1].conf)==null?void 0:y.connection)==null?void 0:K.ssid)??"SSID")+"")&&E(n,l),X&4&&(a.checked=B[2]),A===(A=M(B))&&O?O.p(B,X):(O.d(1),O=A(B),O&&(O.c(),O.m(e,null))),X&2&&h!==(h=(((U=(V=B[1].conf)==null?void 0:V.connection)==null?void 0:U.psk)??"Password")+"")&&E(b,h),X&32&&R!==(R=B[5]==2)&&(k.required=R)},d(B){B&&(N(e),N(_),N(d)),O.d(),I=!1,F()}}}function Kc(t){var a,r;let e,l,n,i=((a=t[3])==null?void 0:a.c)==-1&&_f(),s=((r=t[3])==null?void 0:r.n)&&mf(t);return{c(){e=p("select"),i&&i.c(),l=yt(),s&&s.c(),u(e,"name","ss"),u(e,"class","in-s"),e.required=n=t[5]==1||t[5]==2},m(f,c){P(f,e,c),i&&i.m(e,null),o(e,l),s&&s.m(e,null)},p(f,c){var m,_;((m=f[3])==null?void 0:m.c)==-1?i||(i=_f(),i.c(),i.m(e,l)):i&&(i.d(1),i=null),(_=f[3])!=null&&_.n?s?s.p(f,c):(s=mf(f),s.c(),s.m(e,null)):s&&(s.d(1),s=null),c&32&&n!==(n=f[5]==1||f[5]==2)&&(e.required=n)},d(f){f&&N(e),i&&i.d(),s&&s.d()}}}function Yc(t){let e,l;return{c(){e=p("input"),u(e,"name","ss"),u(e,"type","text"),u(e,"pattern",Mn),u(e,"class","in-s"),e.required=l=t[5]==1||t[5]==2},m(n,i){P(n,e,i)},p(n,i){i&32&&l!==(l=n[5]==1||n[5]==2)&&(e.required=l)},d(n){n&&N(e)}}}function _f(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",H(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function mf(t){var i;let e,l=rt((i=t[3])==null?void 0:i.n),n=[];for(let s=0;st[8].call(g)),u(m,"class","my-3"),u(B,"name","sh"),u(B,"type","text"),u(B,"class","in-s"),u(B,"maxlength","32"),u(B,"pattern",Vn),u(B,"placeholder","Optional, ex.: ams-reader"),u(B,"autocomplete","off"),u(V,"type","checkbox"),u(V,"name","sm"),V.__value="static",H(V,V.__value),u(V,"class","rounded mb-1"),u(y,"class","my-3"),u(ue,"type","submit"),u(ue,"class","btn-pri"),u(re,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(De,Ue){P(De,e,Ue),o(e,l),o(l,n),o(n,i),o(n,s),o(n,a),o(a,f),o(n,c),o(n,m),o(m,d),o(m,h),o(m,b),o(m,g),o(g,w),o(w,R),o(g,I),o(I,M),D&&D.m(g,null),Ke(g,t[5],!0),o(n,A),S&&S.m(n,null),o(n,O),o(n,j),o(j,W),o(j,T),o(j,B),H(B,t[0].hostname),o(n,X),o(n,y),o(y,K),o(K,V),V.checked=t[4],o(K,U),o(K,se),o(y,le),L&&L.m(y,null),o(n,Q),q&&q.m(n,null),o(n,ae),o(n,re),o(re,ue),o(ue,pe),P(De,oe,Ue),Se(J,De,Ue),$=!0,ke||(Ce=[ce(g,"change",t[8]),ce(B,"input",t[10]),ce(V,"change",t[11]),ce(n,"submit",pn(t[7]))],ke=!0)},p(De,[Ue]){var Ct,tt,ot,Mt,ht,at,it,ft,Lt,We,Re,He;(!$||Ue&2)&&r!==(r=(((Ct=De[1].setup)==null?void 0:Ct.title)??"Setup")+"")&&E(f,r),(!$||Ue&2)&&_!==(_=(((ot=(tt=De[1].conf)==null?void 0:tt.connection)==null?void 0:ot.title)??"Connection")+"")&&E(d,_),(!$||Ue&2)&&k!==(k=(((ht=(Mt=De[1].conf)==null?void 0:Mt.connection)==null?void 0:ht.wifi)??"Connect to WiFi")+"")&&E(R,k),(!$||Ue&2)&&F!==(F=(((it=(at=De[1].conf)==null?void 0:at.connection)==null?void 0:it.ap)??"Standalone access point")+"")&&E(M,F),De[0].if&&De[0].if.eth?D?D.p(De,Ue):(D=rf(De),D.c(),D.m(g,null)):D&&(D.d(1),D=null),Ue&32&&Ke(g,De[5]),De[5]==1||De[5]==2?S?S.p(De,Ue):(S=cf(De),S.c(),S.m(n,O)):S&&(S.d(1),S=null),(!$||Ue&2)&&Y!==(Y=(((Lt=(ft=De[1].conf)==null?void 0:ft.general)==null?void 0:Lt.hostname)??"Hostname")+"")&&E(W,Y),Ue&1&&B.value!==De[0].hostname&&H(B,De[0].hostname),Ue&16&&(V.checked=De[4]),(!$||Ue&2)&&G!==(G=(((We=De[1].setup)==null?void 0:We.static)??"Static IP")+"")&&E(se,G),De[4]?L?(L.p(De,Ue),Ue&16&&Z(L,1)):(L=df(De),L.c(),Z(L,1),L.m(y,null)):L&&(vt(),ie(L,1,1,()=>{L=null}),bt()),De[4]?q?q.p(De,Ue):(q=hf(De),q.c(),q.m(n,ae)):q&&(q.d(1),q=null),(!$||Ue&2)&&ne!==(ne=(((Re=De[1].btn)==null?void 0:Re.save)??"Save")+"")&&E(pe,ne);const xe={};Ue&64&&(xe.active=De[6]),Ue&2&&(xe.message=((He=De[1].setup)==null?void 0:He.mask)??"Saving"),J.$set(xe)},i(De){$||(Z(L),Z(J.$$.fragment,De),$=!0)},o(De){ie(L),ie(J.$$.fragment,De),$=!1},d(De){De&&(N(e),N(oe)),D&&D.d(),S&&S.d(),L&&L.d(),q&&q.d(),Me(J,De),ke=!1,jt(Ce)}}}function Xc(t,e,l){let n={};bl.subscribe(w=>{l(1,n=w)});let i=!1,s={};$i.subscribe(w=>{l(3,s=w)});let{sysinfo:a={}}=e,r=!1,f=1,c=!1;function m(w){cl.update(k=>(k.trying=w,k))}async function _(w){l(6,c=!0);const k=new FormData(w.target),R=new URLSearchParams;for(let M of k){const[A,O]=M;R.append(A,O)}let F=await(await fetch("save",{method:"POST",body:R})).json();l(6,c=!1),cl.update(M=>(M.hostname=k.get("sh"),M.usrcfg=F.success,M.booting=F.reboot,r&&(M.net.ip=k.get("si"),M.net.mask=k.get("su"),M.net.gw=k.get("sg"),M.net.dns1=k.get("sd")),F.reboot&&setTimeout(Wn,5e3,a,m),M))}function d(){f=Vt(this),l(5,f)}function h(){i=this.checked,l(2,i)}function b(){a.hostname=this.value,l(0,a)}function g(){r=this.checked,l(4,r)}return t.$$set=w=>{"sysinfo"in w&&l(0,a=w.sysinfo)},[a,n,i,s,r,f,c,_,d,h,b,g]}class Zc extends Tt{constructor(e){super(),Pt(this,e,Xc,Qc,Nt,{sysinfo:0})}}function Jc(t){var W,T,B,X;let e,l,n,i=(((W=t[2].upload)==null?void 0:W.title)??"Upload")+"",s,a,r,f,c,m=(((T=t[2].upload)==null?void 0:T.desc)??"")+"",_,d,h,b,g,w,k,R,I=(((B=t[2].btn)==null?void 0:B.upload)??"Upload")+"",F,M,A,O,j,Y;return A=new rl({props:{active:t[3],message:((X=t[2].upload)==null?void 0:X.mask)??"Uploading"}}),{c(){e=p("div"),l=p("div"),n=p("strong"),s=C(i),a=v(),r=C(t[1]),f=v(),c=p("p"),_=C(m),d=v(),h=p("form"),b=p("input"),g=v(),w=p("div"),k=p("button"),R=p("p"),F=C(I),M=v(),Ne(A.$$.fragment),u(c,"class","mb-4"),u(b,"name","file"),u(b,"type","file"),u(R,"class","mb-4"),u(k,"type","submit"),u(k,"class","btn-pri"),u(w,"class","w-full text-right mt-4"),u(h,"action",t[0]),u(h,"enctype","multipart/form-data"),u(h,"method","post"),u(h,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(y,K){P(y,e,K),o(e,l),o(l,n),o(n,s),o(n,a),o(n,r),o(l,f),o(l,c),o(c,_),o(l,d),o(l,h),o(h,b),o(h,g),o(h,w),o(w,k),o(k,R),o(R,F),P(y,M,K),Se(A,y,K),O=!0,j||(Y=ce(h,"submit",t[4]),j=!0)},p(y,[K]){var U,G,se,le;(!O||K&4)&&i!==(i=(((U=y[2].upload)==null?void 0:U.title)??"Upload")+"")&&E(s,i),(!O||K&2)&&E(r,y[1]),(!O||K&4)&&m!==(m=(((G=y[2].upload)==null?void 0:G.desc)??"")+"")&&E(_,m),(!O||K&4)&&I!==(I=(((se=y[2].btn)==null?void 0:se.upload)??"Upload")+"")&&E(F,I),(!O||K&1)&&u(h,"action",y[0]);const V={};K&8&&(V.active=y[3]),K&4&&(V.message=((le=y[2].upload)==null?void 0:le.mask)??"Uploading"),A.$set(V)},i(y){O||(Z(A.$$.fragment,y),O=!0)},o(y){ie(A.$$.fragment,y),O=!1},d(y){y&&(N(e),N(M)),Me(A,y),j=!1,Y()}}}function $c(t,e,l){let{action:n}=e,{title:i}=e,s={};bl.subscribe(f=>{l(2,s=f)});let a=!1;const r=()=>l(3,a=!0);return t.$$set=f=>{"action"in f&&l(0,n=f.action),"title"in f&&l(1,i=f.title)},[n,i,s,a,r]}class ls extends Tt{constructor(e){super(),Pt(this,e,$c,Jc,Nt,{action:0,title:1})}}function xc(t){var J,$,ke,Ce,D,S,L;let e,l,n,i,s=(((J=t[1].consent)==null?void 0:J.title)??"Consents")+"",a,r,f,c,m,_=((($=t[1].consent)==null?void 0:$.one_click)??"One-click")+"",d,h,b,g,w=(((ke=t[1].consent)==null?void 0:ke.read_more)??"Read more")+"",k,R,I,F,M,A,O,j=(((Ce=t[1].consent)==null?void 0:Ce.yes)??"Yes")+"",Y,W,T,B,X,y,K=(((D=t[1].consent)==null?void 0:D.no)??"No")+"",V,U,G,se,le,Q=(((S=t[1].btn)==null?void 0:S.save)??"Save")+"",ae,re,ue,ne,pe,oe;return ue=new rl({props:{active:t[2],message:((L=t[1].consent)==null?void 0:L.mask_saving)??"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("div"),a=C(s),r=v(),f=p("hr"),c=v(),m=p("div"),d=C(_),h=p("br"),b=v(),g=p("a"),k=C(w),R=p("br"),I=v(),F=p("label"),M=p("input"),O=v(),Y=C(j),W=v(),T=p("label"),B=p("input"),y=v(),V=C(K),U=p("br"),G=v(),se=p("div"),le=p("button"),ae=C(Q),re=v(),Ne(ue.$$.fragment),u(g,"href",_l("Data-collection-on-one-click-firmware-upgrade")),u(g,"target","_blank"),u(g,"class","text-blue-600 hover:text-blue-800"),u(M,"type","radio"),u(M,"name","sf"),M.value=1,M.checked=A=t[0].fwconsent===1,u(M,"class","rounded m-2"),M.required=!0,u(B,"type","radio"),u(B,"name","sf"),B.value=2,B.checked=X=t[0].fwconsent===2,u(B,"class","rounded m-2"),B.required=!0,u(m,"class","my-3"),u(le,"type","submit"),u(le,"class","btn-pri"),u(se,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(q,z){P(q,e,z),o(e,l),o(l,n),o(n,i),o(i,a),o(n,r),o(n,f),o(n,c),o(n,m),o(m,d),o(m,h),o(m,b),o(m,g),o(g,k),o(m,R),o(m,I),o(m,F),o(F,M),o(F,O),o(F,Y),o(m,W),o(m,T),o(T,B),o(T,y),o(T,V),o(m,U),o(n,G),o(n,se),o(se,le),o(le,ae),P(q,re,z),Se(ue,q,z),ne=!0,pe||(oe=ce(n,"submit",pn(t[3])),pe=!0)},p(q,[z]){var fe,_e,de,x,he,be,Ae;(!ne||z&2)&&s!==(s=(((fe=q[1].consent)==null?void 0:fe.title)??"Consents")+"")&&E(a,s),(!ne||z&2)&&_!==(_=(((_e=q[1].consent)==null?void 0:_e.one_click)??"One-click")+"")&&E(d,_),(!ne||z&2)&&w!==(w=(((de=q[1].consent)==null?void 0:de.read_more)??"Read more")+"")&&E(k,w),(!ne||z&1&&A!==(A=q[0].fwconsent===1))&&(M.checked=A),(!ne||z&2)&&j!==(j=(((x=q[1].consent)==null?void 0:x.yes)??"Yes")+"")&&E(Y,j),(!ne||z&1&&X!==(X=q[0].fwconsent===2))&&(B.checked=X),(!ne||z&2)&&K!==(K=(((he=q[1].consent)==null?void 0:he.no)??"No")+"")&&E(V,K),(!ne||z&2)&&Q!==(Q=(((be=q[1].btn)==null?void 0:be.save)??"Save")+"")&&E(ae,Q);const ee={};z&4&&(ee.active=q[2]),z&2&&(ee.message=((Ae=q[1].consent)==null?void 0:Ae.mask_saving)??"Saving"),ue.$set(ee)},i(q){ne||(Z(ue.$$.fragment,q),ne=!0)},o(q){ie(ue.$$.fragment,q),ne=!1},d(q){q&&(N(e),N(re)),Me(ue,q),pe=!1,oe()}}}function e_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,s={};bl.subscribe(f=>{l(1,s=f)});let a=!1;async function r(f){l(2,a=!0);const c=new FormData(f.target),m=new URLSearchParams;for(let h of c){const[b,g]=h;m.append(b,g)}let d=await(await fetch("save",{method:"POST",body:m})).json();l(2,a=!1),cl.update(h=>(h.fwconsent=c.sf===!0?1:c.sf===!1?2:0,h.booting=d.reboot,h)),sn(n)}return t.$$set=f=>{"basepath"in f&&l(4,n=f.basepath),"sysinfo"in f&&l(0,i=f.sysinfo)},[i,s,a,r,n]}class t_ extends Tt{constructor(e){super(),Pt(this,e,e_,xc,Nt,{basepath:4,sysinfo:0})}}function vf(t,e,l){const n=t.slice();return n[30]=e[l],n[31]=e,n[32]=l,n}function bf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function l_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function gf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function n_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function kf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function wf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Cf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Sf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Mf(t){let e,l=rt(t[1].o),n=[];for(let i=0;i0?"text-green-600":"text-gray-300"),u(xe,"class",tt=t[32]{l(0,i=U)});let s=["mo","tu","we","th","fr","sa","su"],a={},r=!0,f=!1;Du.subscribe(U=>{U.o&&(l(1,a=U),l(2,r=!1))}),y0();async function c(U){l(3,f=!0);const G=new URLSearchParams;G.append("r","true"),G.append("rc",a.o.length),a.o.forEach(function(le,Q){G.append("rt"+Q,le.t),G.append("rn"+Q,le.n),G.append("rd"+Q,le.d),G.append("ra"+Q,le.a),G.append("rh"+Q,le.h),G.append("rv"+Q,le.v),G.append("rsm"+Q,le.s.m),G.append("rsd"+Q,le.s.d),G.append("rem"+Q,le.e.m),G.append("red"+Q,le.e.d)}),await(await fetch("save",{method:"POST",body:G})).json(),l(3,f=!1),sn(n+"configuration")}let m=function(U,G){return U.includes(G)?U=U.filter(function(se){return se!==G}):U.push(G),U},_=function(){let U=a.o;U.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),l(1,a.o=U,a)},d=function(U){let G=a.o;G.splice(U,1),l(1,a.o=G,a)},h=function(U){if(U<=0)return;let G=a.o;var se=G[U];G[U]=G[U-1],G[U-1]=se,l(1,a.o=G,a)},b=function(U){let G=a.o;if(!(U>=G.length-1)){var se=G[U];G[U]=G[U+1],G[U+1]=se,l(1,a.o=G,a)}};function g(U,G){U[G].n=this.value,l(1,a)}function w(U,G){U[G].d=Vt(this),l(1,a)}function k(U,G){U[G].t=Vt(this),l(1,a)}function R(U,G){U[G].v=ye(this.value),l(1,a)}const I=(U,G,se,le)=>l(1,se[le].a=m(U.a,G),a),F=(U,G,se,le)=>l(1,se[le].h=m(U.h,G),a),M=(U,G,se,le)=>l(1,se[le].h=m(U.h,G+8),a),A=(U,G,se,le)=>l(1,se[le].h=m(U.h,G+16),a);function O(U,G){U[G].s.d=Vt(this),l(1,a)}function j(U,G){U[G].s.m=Vt(this),l(1,a)}function Y(U,G){U[G].e.d=Vt(this),l(1,a)}function W(U,G){U[G].e.m=Vt(this),l(1,a)}const T=U=>h(U),B=U=>h(U),X=U=>b(U),y=U=>b(U),K=U=>d(U),V=U=>d(U);return t.$$set=U=>{"basepath"in U&&l(11,n=U.basepath)},[i,a,r,f,s,c,m,_,d,h,b,n,g,w,k,R,I,F,M,A,O,j,Y,W,T,B,X,y,K,V]}class f_ extends Tt{constructor(e){super(),Pt(this,e,a_,o_,Nt,{basepath:11},null,[-1,-1])}}function Of(t,e,l){const n=t.slice();return n[13]=e[l],n[14]=e,n[15]=l,n}function Lf(t,e,l){const n=t.slice();return n[13]=e[l],n[16]=e,n[17]=l,n}function If(t){let e,l,n,i=rt(t[1]),s=[];for(let a=0;a{l(3,r=w)});let f=!1,c,m;async function _(){if(confirm("Clear all data?"))for(let w in i)(w.startsWith("i")||w.startsWith("e"))&&l(0,i[w]=0,i)}let d=!1;async function h(w){l(5,d=!0);const k=new FormData(w.target),R=new URLSearchParams;for(let F of k){const[M,A]=F;R.append(M,A)}await(await fetch(s,{method:"POST",body:R})).json(),l(5,d=!1),sn(a)}function b(w){i[w.key]=ye(this.value),l(0,i)}function g(w){i[w.key]=ye(this.value),l(0,i)}return t.$$set=w=>{"prefix"in w&&l(8,n=w.prefix),"data"in w&&l(0,i=w.data),"url"in w&&l(9,s=w.url),"basepath"in w&&l(10,a=w.basepath)},t.$$.update=()=>{if(t.$$.dirty&263){l(1,c=[]),l(2,m=[]);for(let w in i){let k=[];w.startsWith("i")?k=c:w.startsWith("e")&&(k=m,i[w]&&l(4,f=!0)),k.push({key:w,name:n+" "+w.substring(1),value:i[w]})}}},[i,c,m,r,f,d,_,h,n,s,a,b,g]}class Lu extends Tt{constructor(e){super(),Pt(this,e,r_,u_,Nt,{prefix:8,data:0,url:9,basepath:10})}}function c_(t){let e,l;return e=new j0({props:{data:t[6],sysinfo:t[7],prices:t[1],dayPlot:t[2],monthPlot:t[3],temperatures:t[4],translations:t[5],tariffData:t[8]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&64&&(s.data=n[6]),i&128&&(s.sysinfo=n[7]),i&2&&(s.prices=n[1]),i&4&&(s.dayPlot=n[2]),i&8&&(s.monthPlot=n[3]),i&16&&(s.temperatures=n[4]),i&32&&(s.translations=n[5]),i&256&&(s.tariffData=n[8]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function __(t){let e,l;return e=new Tc({props:{sysinfo:t[7],basepath:t[0],data:t[6]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&1&&(s.basepath=n[0]),i&64&&(s.data=n[6]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function m_(t){let e,l;return e=new f_({props:{basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function p_(t){let e,l;return e=new jc({props:{sysinfo:t[7],data:t[6]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&64&&(s.data=n[6]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function d_(t){let e,l;return e=new ls({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function h_(t){let e,l;return e=new ls({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function v_(t){let e,l;return e=new ls({props:{title:"private key",action:"/mqtt-key"}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function b_(t){let e,l;return e=new t_({props:{sysinfo:t[7],basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function g_(t){let e,l;return e=new Zc({props:{sysinfo:t[7]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function k_(t){let e,l;return e=new Vc({props:{sysinfo:t[7],basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.sysinfo=n[7]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function w_(t){let e,l;return e=new Lu({props:{prefix:"UTC Hour",data:t[2],url:"/dayplot",basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&4&&(s.data=n[2]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function C_(t){let e,l;return e=new Lu({props:{prefix:"Day",data:t[3],url:"/monthplot",basepath:t[0]}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&8&&(s.data=n[3]),i&1&&(s.basepath=n[0]),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function S_(t){let e,l,n,i,s,a,r,f,c,m,_,d,h,b,g,w,k,R,I,F,M,A,O,j,Y,W;return e=new z1({props:{data:t[6],basepath:t[0]}}),n=new dl({props:{path:"/",$$slots:{default:[c_]},$$scope:{ctx:t}}}),s=new dl({props:{path:"/configuration",$$slots:{default:[__]},$$scope:{ctx:t}}}),r=new dl({props:{path:"/priceconfig",$$slots:{default:[m_]},$$scope:{ctx:t}}}),c=new dl({props:{path:"/status",$$slots:{default:[p_]},$$scope:{ctx:t}}}),_=new dl({props:{path:"/mqtt-ca",$$slots:{default:[d_]},$$scope:{ctx:t}}}),h=new dl({props:{path:"/mqtt-cert",$$slots:{default:[h_]},$$scope:{ctx:t}}}),g=new dl({props:{path:"/mqtt-key",$$slots:{default:[v_]},$$scope:{ctx:t}}}),k=new dl({props:{path:"/consent",$$slots:{default:[b_]},$$scope:{ctx:t}}}),I=new dl({props:{path:"/setup",$$slots:{default:[g_]},$$scope:{ctx:t}}}),M=new dl({props:{path:"/vendor",$$slots:{default:[k_]},$$scope:{ctx:t}}}),O=new dl({props:{path:"/edit-day",$$slots:{default:[w_]},$$scope:{ctx:t}}}),Y=new dl({props:{path:"/edit-month",$$slots:{default:[C_]},$$scope:{ctx:t}}}),{c(){Ne(e.$$.fragment),l=v(),Ne(n.$$.fragment),i=v(),Ne(s.$$.fragment),a=v(),Ne(r.$$.fragment),f=v(),Ne(c.$$.fragment),m=v(),Ne(_.$$.fragment),d=v(),Ne(h.$$.fragment),b=v(),Ne(g.$$.fragment),w=v(),Ne(k.$$.fragment),R=v(),Ne(I.$$.fragment),F=v(),Ne(M.$$.fragment),A=v(),Ne(O.$$.fragment),j=v(),Ne(Y.$$.fragment)},m(T,B){Se(e,T,B),P(T,l,B),Se(n,T,B),P(T,i,B),Se(s,T,B),P(T,a,B),Se(r,T,B),P(T,f,B),Se(c,T,B),P(T,m,B),Se(_,T,B),P(T,d,B),Se(h,T,B),P(T,b,B),Se(g,T,B),P(T,w,B),Se(k,T,B),P(T,R,B),Se(I,T,B),P(T,F,B),Se(M,T,B),P(T,A,B),Se(O,T,B),P(T,j,B),Se(Y,T,B),W=!0},p(T,B){const X={};B&64&&(X.data=T[6]),B&1&&(X.basepath=T[0]),e.$set(X);const y={};B&2558&&(y.$$scope={dirty:B,ctx:T}),n.$set(y);const K={};B&2241&&(K.$$scope={dirty:B,ctx:T}),s.$set(K);const V={};B&2049&&(V.$$scope={dirty:B,ctx:T}),r.$set(V);const U={};B&2240&&(U.$$scope={dirty:B,ctx:T}),c.$set(U);const G={};B&2048&&(G.$$scope={dirty:B,ctx:T}),_.$set(G);const se={};B&2048&&(se.$$scope={dirty:B,ctx:T}),h.$set(se);const le={};B&2048&&(le.$$scope={dirty:B,ctx:T}),g.$set(le);const Q={};B&2177&&(Q.$$scope={dirty:B,ctx:T}),k.$set(Q);const ae={};B&2176&&(ae.$$scope={dirty:B,ctx:T}),I.$set(ae);const re={};B&2177&&(re.$$scope={dirty:B,ctx:T}),M.$set(re);const ue={};B&2053&&(ue.$$scope={dirty:B,ctx:T}),O.$set(ue);const ne={};B&2057&&(ne.$$scope={dirty:B,ctx:T}),Y.$set(ne)},i(T){W||(Z(e.$$.fragment,T),Z(n.$$.fragment,T),Z(s.$$.fragment,T),Z(r.$$.fragment,T),Z(c.$$.fragment,T),Z(_.$$.fragment,T),Z(h.$$.fragment,T),Z(g.$$.fragment,T),Z(k.$$.fragment,T),Z(I.$$.fragment,T),Z(M.$$.fragment,T),Z(O.$$.fragment,T),Z(Y.$$.fragment,T),W=!0)},o(T){ie(e.$$.fragment,T),ie(n.$$.fragment,T),ie(s.$$.fragment,T),ie(r.$$.fragment,T),ie(c.$$.fragment,T),ie(_.$$.fragment,T),ie(h.$$.fragment,T),ie(g.$$.fragment,T),ie(k.$$.fragment,T),ie(I.$$.fragment,T),ie(M.$$.fragment,T),ie(O.$$.fragment,T),ie(Y.$$.fragment,T),W=!1},d(T){T&&(N(l),N(i),N(a),N(f),N(m),N(d),N(b),N(w),N(R),N(F),N(A),N(j)),Me(e,T),Me(n,T),Me(s,T),Me(r,T),Me(c,T),Me(_,T),Me(h,T),Me(g,T),Me(k,T),Me(I,T),Me(M,T),Me(O,T),Me(Y,T)}}}function Bf(t){let e,l,n,i;const s=[N_,M_],a=[];function r(f,c){return f[7].trying?0:1}return e=r(t),l=a[e]=s[e](t),{c(){l.c(),n=yt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(vt(),ie(a[m],1,1,()=>{a[m]=null}),bt(),l=a[e],l?l.p(f,c):(l=a[e]=s[e](f),l.c()),Z(l,1),l.m(n.parentNode,n))},i(f){i||(Z(l),i=!0)},o(f){ie(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function M_(t){let e,l;return e=new rl({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p:Ye,i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function N_(t){let e,l;return e=new rl({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[7].trying}}),{c(){Ne(e.$$.fragment)},m(n,i){Se(e,n,i),l=!0},p(n,i){const s={};i&128&&(s.message="Device is booting, please wait. Trying to reach it on "+n[7].trying),e.$set(s)},i(n){l||(Z(e.$$.fragment,n),l=!0)},o(n){ie(e.$$.fragment,n),l=!1},d(n){Me(e,n)}}}function P_(t){let e,l,n,i;l=new cu({props:{basepath:t[0],$$slots:{default:[S_]},$$scope:{ctx:t}}});let s=t[7].booting&&Bf(t);return{c(){e=p("div"),Ne(l.$$.fragment),n=v(),s&&s.c(),u(e,"class","container mx-auto m-3")},m(a,r){P(a,e,r),Se(l,e,null),o(e,n),s&&s.m(e,null),i=!0},p(a,[r]){const f={};r&1&&(f.basepath=a[0]),r&2559&&(f.$$scope={dirty:r,ctx:a}),l.$set(f),a[7].booting?s?(s.p(a,r),r&128&&Z(s,1)):(s=Bf(a),s.c(),Z(s,1),s.m(e,null)):s&&(vt(),ie(s,1,1,()=>{s=null}),bt())},i(a){i||(Z(l.$$.fragment,a),Z(s),i=!0)},o(a){ie(l.$$.fragment,a),ie(s),i=!1},d(a){a&&N(e),Me(l),s&&s.d()}}}function T_(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i;Ji.subscribe(b=>{l(1,i=b)});let s;ku.subscribe(b=>{l(2,s=b)});let a;wu.subscribe(b=>{l(3,a=b)});let r;Cu.subscribe(b=>{l(4,r=b)});let f={};bl.subscribe(b=>{l(5,f=b)});let c,m={},_={},d;cl.subscribe(b=>{var g;l(7,_=b),_.vndcfg===!1?sn(n+"vendor"):_.usrcfg===!1?sn(n+"setup"):_.fwconsent===0&&sn(n+"consent"),_.ui.k===1?document.documentElement.classList.add("dark"):_.ui.k===0?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),_.ui.lang&&_.ui.lang!=((g=f==null?void 0:f.language)==null?void 0:g.code)&&Nu(_.ui.lang),_.version&&d&&_.version!=d&&window.location.reload(),d=_.version,c&&clearTimeout(c),c=setTimeout(ci,!m||!m.u||m.u<30||_!=null&&_.upgrading?1e4:3e5)}),f1.subscribe(b=>{l(6,m=b),E0(b)});let h={};return Mu.subscribe(b=>{l(8,h=b)}),Su(),[n,i,s,a,r,f,m,_,h]}class q_ extends Tt{constructor(e){super(),Pt(this,e,T_,P_,Nt,{})}}new q_({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/VendorPanel.svelte b/lib/SvelteUi/app/src/lib/VendorPanel.svelte index 6243012e..72823648 100644 --- a/lib/SvelteUi/app/src/lib/VendorPanel.svelte +++ b/lib/SvelteUi/app/src/lib/VendorPanel.svelte @@ -35,7 +35,7 @@ navigate(basepath + (sysinfo.usrcfg ? "/" : "/setup")); } - let cc = false; + let cc = true; sysinfoStore.subscribe(update => { sysinfo = update; if(update.fwconsent === 1) { diff --git a/lib/SvelteUi/src/AmsWebServer.cpp b/lib/SvelteUi/src/AmsWebServer.cpp index 63fb42ad..18348e62 100644 --- a/lib/SvelteUi/src/AmsWebServer.cpp +++ b/lib/SvelteUi/src/AmsWebServer.cpp @@ -1190,9 +1190,6 @@ void AmsWebServer::handleSave() { if(server.hasArg(F("v")) && server.arg(F("v")) == F("true")) { int boardType = server.arg(F("vb")).toInt(); int hanPin = server.arg(F("vh")).toInt(); - if(server.hasArg(F("vr")) && server.arg(F("vr")) == F("true")) { - config->clear(); - } MeterConfig meterConfig; config->getMeterConfig(meterConfig); @@ -1656,7 +1653,10 @@ void AmsWebServer::handleSave() { #endif debugger->printf_P(PSTR("Saving configuration now...\n")); - if (config->save()) { + // If vendor page and clear all config is selected + if(server.hasArg(F("v")) && server.arg(F("v")) == F("true") && server.hasArg(F("vr")) && server.arg(F("vr")) == F("true")) { + config->clear(); + } else if(config->save()) { #if defined(AMS_REMOTE_DEBUG) if (debugger->isActive(RemoteDebug::INFO)) #endif