=5&&(k+=A.N1+P[y]-5);for(y=3;y<$-1;y+=2)P[y-2]===P[y+2]&&P[y+2]===P[y-1]&&P[y-1]===P[y+1]&&P[y-1]*3===P[y]&&(P[y-3]===0||y+3>$||P[y-3]*3>=P[y]*4||P[y+3]*3>=P[y]*4)&&(k+=A.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var $,y,k=0,P=3e4;for(y=0;y<8&&(this._applyMask(y),$=this._checkBadness(),$>=1)P&1&&(L[Z-1-y+Z*8]=1,y<6?L[8+Z*y]=1:L[8+Z*(y+1)]=1);for(y=0;y<7;y++,P>>=1)P&1&&(L[8+Z*(Z-7+y)]=1,y?L[6-y+Z*8]=1:L[7+Z*8]=1)},_interleaveBlocks:function(){var $,y,k=this._dataBlock,P=this._ecc,L=this._eccBlock,Z=0,ne=this._calculateMaxLength(),fe=this._neccBlock1,de=this._neccBlock2,Ce=this._stringBuffer;for($=0;$1)for($=D.BLOCK[P],k=L-7;;){for(y=L-7;y>$-3&&(this._addAlignment(y,k),!(y<$));)y-=$;if(k<=$+9)break;k-=$,this._addAlignment(6,k),this._addAlignment(k,6)}},_insertFinders:function(){var $,y,k,P,L=this.buffer,Z=this.width;for($=0;$<3;$++){for(y=0,P=0,$===1&&(y=Z-7),$===2&&(P=Z-7),L[P+3+Z*(y+3)]=1,k=0;k<6;k++)L[P+k+Z*y]=1,L[P+Z*(y+k+1)]=1,L[P+6+Z*(y+k)]=1,L[P+k+1+Z*(y+6)]=1;for(k=1;k<5;k++)this._setMask(P+k,y+1),this._setMask(P+1,y+k+1),this._setMask(P+5,y+k),this._setMask(P+k+1,y+5);for(k=2;k<4;k++)L[P+k+Z*(y+2)]=1,L[P+2+Z*(y+k+1)]=1,L[P+4+Z*(y+k)]=1,L[P+k+1+Z*(y+4)]=1}},_insertTimingGap:function(){var $,y,k=this.width;for(y=0;y<7;y++)this._setMask(7,y),this._setMask(k-8,y),this._setMask(7,y+k-7);for($=0;$<8;$++)this._setMask($,7),this._setMask($+k-8,7),this._setMask($,k-8)},_insertTimingRowAndColumn:function(){var $,y=this.buffer,k=this.width;for($=0;$6)for($=C.BLOCK[Z-7],y=17,k=0;k<6;k++)for(P=0;P<3;P++,y--)1&(y>11?Z>>y-12:$>>y)?(L[5-k+ne*(2-P+ne-11)]=1,L[2-P+ne-11+ne*(5-k)]=1):(this._setMask(5-k,2-P+ne-11),this._setMask(2-P+ne-11,5-k))},_isMasked:function($,y){var k=A._getMaskBit($,y);return this._mask[k]===1},_pack:function(){var $,y,k,P=1,L=1,Z=this.width,ne=Z-1,fe=Z-1,de=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(y=0;yy&&(k=$,$=y,y=k),k=y,k+=y*y,k>>=1,k+=$,k},_modN:function($){for(;$>=255;)$-=255,$=($>>8)+($&255);return $},N1:3,N2:3,N3:40,N4:10}),le=A,H=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var $=this.element;$.width=$.height=this.qrious.size}}),z=H,U=_.extend(function($,y,k,P){this.name=$,this.modifiable=Boolean(y),this.defaultValue=k,this._valueTransformer=P},{transform:function($){var y=this._valueTransformer;return typeof y=="function"?y($,this):$}}),K=U,Q=_.extend(null,{abs:function($){return $!=null?Math.abs($):null},hasOwn:function($,y){return Object.prototype.hasOwnProperty.call($,y)},noop:function(){},toUpperCase:function($){return $!=null?$.toUpperCase():null}}),G=Q,X=_.extend(function($){this.options={},$.forEach(function(y){this.options[y.name]=y},this)},{exists:function($){return this.options[$]!=null},get:function($,y){return X._get(this.options[$],y)},getAll:function($){var y,k=this.options,P={};for(y in k)G.hasOwn(k,y)&&(P[y]=X._get(k[y],$));return P},init:function($,y,k){typeof k!="function"&&(k=G.noop);var P,L;for(P in this.options)G.hasOwn(this.options,P)&&(L=this.options[P],X._set(L,L.defaultValue,y),X._createAccessor(L,y,k));this._setAll($,y,!0)},set:function($,y,k){return this._set($,y,k)},setAll:function($,y){return this._setAll($,y)},_set:function($,y,k,P){var L=this.options[$];if(!L)throw new Error("Invalid option: "+$);if(!L.modifiable&&!P)throw new Error("Option cannot be modified: "+$);return X._set(L,y,k)},_setAll:function($,y,k){if(!$)return!1;var P,L=!1;for(P in $)G.hasOwn($,P)&&this._set(P,$[P],y,k)&&(L=!0);return L}},{_createAccessor:function($,y,k){var P={get:function(){return X._get($,y)}};$.modifiable&&(P.set=function(L){X._set($,L,y)&&k(L,$)}),Object.defineProperty(y,$.name,P)},_get:function($,y){return y["_"+$.name]},_set:function($,y,k){var P="_"+$.name,L=k[P],Z=$.transform(y!=null?y:$.defaultValue);return k[P]=Z,Z!==L}}),Y=X,j=_.extend(function(){this._services={}},{getService:function($){var y=this._services[$];if(!y)throw new Error("Service is not being managed with name: "+$);return y},setService:function($,y){if(this._services[$])throw new Error("Service is already managed with name: "+$);y&&(this._services[$]=y)}}),x=j,ae=new Y([new K("background",!0,"white"),new K("backgroundAlpha",!0,1,G.abs),new K("element"),new K("foreground",!0,"black"),new K("foregroundAlpha",!0,1,G.abs),new K("level",!0,"L",G.toUpperCase),new K("mime",!0,"image/png"),new K("padding",!0,null,G.abs),new K("size",!0,100,G.abs),new K("value",!0,"")]),te=new x,V=_.extend(function($){ae.init($,this,this.update.bind(this));var y=ae.get("element",this),k=te.getService("element"),P=y&&k.isCanvas(y)?y:k.createCanvas(),L=y&&k.isImage(y)?y:k.createImage();this._canvasRenderer=new g(this,P,!0),this._imageRenderer=new z(this,L,L===y),this.update()},{get:function(){return ae.getAll(this)},set:function($){ae.setAll($,this)&&this.update()},toDataURL:function($){return this.canvas.toDataURL($||this.mime)},update:function(){var $=new le({level:this.level,value:this.value});this._canvasRenderer.render($),this._imageRenderer.render($)}},{use:function($){te.setService($.getName(),$)}});Object.defineProperties(V.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var W=V,we=W,He=_.extend({getName:function(){}}),Ie=He,Se=Ie.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function($){},isImage:function($){}}),ye=Se,ve=ye.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function($){return $ instanceof HTMLCanvasElement},isImage:function($){return $ instanceof HTMLImageElement}}),$e=ve;we.use(new $e);var be=we;return be})})(u1);const v_=u1.exports;function h_(t){let e,l;return{c(){e=m("img"),ds(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){M(n,e,i)},p(n,[i]){i&4&&!ds(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:pe,o:pe,d(n){n&&S(e)}}}function b_(t,e,l){const n=new v_;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:c="200"}=e,{value:a=""}=e,{padding:f=0}=e,{className:p="qrcode"}=e,_="";function h(){n.set({background:o,foreground:u,level:i,padding:f,size:c,value:a}),l(2,_=n.toDataURL("image/jpeg"))}return dc(()=>{h()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,o=v.background),"color"in v&&l(5,u=v.color),"size"in v&&l(6,c=v.size),"value"in v&&l(0,a=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,p=v.className)},t.$$.update=()=>{t.$$.dirty&1&&a&&h()},[a,p,_,i,o,u,c,f]}class g_ extends Re{constructor(e){super(),Le(this,e,b_,h_,Ee,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function lf(t,e,l){const n=t.slice();return n[103]=e[l],n[104]=e,n[105]=l,n}function nf(t,e,l){const n=t.slice();return n[106]=e[l],n[107]=e,n[108]=l,n}function k_(t,e,l){const n=t.slice();return n[109]=e[l],n}function w_(t,e,l){const n=t.slice();return n[112]=e[l],n}function y_(t){let e,l;return{c(){e=m("option"),l=N(t[112]),e.__value=t[112],e.value=e.__value},m(n,i){M(n,e,i),s(e,l)},p:pe,d(n){n&&S(e)}}}function C_(t){let e;return{c(){e=N("Configure price")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function sf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){M(o,e,u),M(o,l,u),ie(l,t[3].p.t),n||(i=ee(l,"input",t[21]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].p.t&&ie(l,o[3].p.t)},d(o){o&&S(e),o&&S(l),n=!1,i()}}}function of(t){let e,l,n,i,o,u,c,a,f,p,_,h,v;return{c(){e=m("div"),l=N("Username"),n=m("br"),i=b(),o=m("input"),u=b(),c=m("div"),a=N("Password"),f=m("br"),p=b(),_=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(o,"maxlength","36"),r(e,"class","my-1"),r(_,"name","gp"),r(_,"type","password"),r(_,"class","in-s"),r(_,"maxlength","36"),r(c,"class","my-1")},m(d,g){M(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),ie(o,t[3].g.u),M(d,u,g),M(d,c,g),s(c,a),s(c,f),s(c,p),s(c,_),ie(_,t[3].g.p),h||(v=[ee(o,"input",t[23]),ee(_,"input",t[24])],h=!0)},p(d,g){g[0]&8&&o.value!==d[3].g.u&&ie(o,d[3].g.u),g[0]&8&&_.value!==d[3].g.p&&ie(_,d[3].g.p)},d(d){d&&S(e),d&&S(u),d&&S(c),h=!1,ze(v)}}}function S_(t){let e,l=t[109]*100+"",n;return{c(){e=m("option"),n=N(l),e.__value=t[109]*100,e.value=e.__value},m(i,o){M(i,e,o),s(e,n)},p:pe,d(i){i&&S(e)}}}function rf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,u){M(o,e,u),M(o,l,u),ie(l,t[3].m.e.k),n||(i=ee(l,"input",t[35]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].m.e.k&&ie(l,o[3].m.e.k)},d(o){o&&S(e),o&&S(l),n=!1,i()}}}function af(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N("Authentication key"),n=m("br"),i=b(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ie(o,t[3].m.e.a),u||(c=ee(o,"input",t[36]),u=!0)},p(a,f){f[0]&8&&o.value!==a[3].m.e.a&&ie(o,a[3].m.e.a)},d(a){a&&S(e),u=!1,c()}}}function uf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H;return{c(){e=m("div"),l=m("div"),n=N("Watt"),i=m("br"),o=b(),u=m("input"),c=b(),a=m("div"),f=N("Volt"),p=m("br"),_=b(),h=m("input"),v=b(),d=m("div"),g=N("Amp"),w=m("br"),D=b(),T=m("input"),E=b(),F=m("div"),I=N("kWh"),O=m("br"),C=b(),A=m("input"),r(u,"name","mmw"),r(u,"type","number"),r(u,"min","0.00"),r(u,"max","1000"),r(u,"step","0.001"),r(u,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(h,"name","mmv"),r(h,"type","number"),r(h,"min","0.00"),r(h,"max","1000"),r(h,"step","0.001"),r(h,"class","in-m tr w-full"),r(a,"class","w-1/4"),r(T,"name","mma"),r(T,"type","number"),r(T,"min","0.00"),r(T,"max","1000"),r(T,"step","0.001"),r(T,"class","in-m tr w-full"),r(d,"class","w-1/4"),r(A,"name","mmc"),r(A,"type","number"),r(A,"min","0.00"),r(A,"max","1000"),r(A,"step","0.001"),r(A,"class","in-l tr w-full"),r(F,"class","w-1/4"),r(e,"class","flex my-1")},m(z,U){M(z,e,U),s(e,l),s(l,n),s(l,i),s(l,o),s(l,u),ie(u,t[3].m.m.w),s(e,c),s(e,a),s(a,f),s(a,p),s(a,_),s(a,h),ie(h,t[3].m.m.v),s(e,v),s(e,d),s(d,g),s(d,w),s(d,D),s(d,T),ie(T,t[3].m.m.a),s(e,E),s(e,F),s(F,I),s(F,O),s(F,C),s(F,A),ie(A,t[3].m.m.c),le||(H=[ee(u,"input",t[38]),ee(h,"input",t[39]),ee(T,"input",t[40]),ee(A,"input",t[41])],le=!0)},p(z,U){U[0]&8&&ge(u.value)!==z[3].m.m.w&&ie(u,z[3].m.m.w),U[0]&8&&ge(h.value)!==z[3].m.m.v&&ie(h,z[3].m.m.v),U[0]&8&&ge(T.value)!==z[3].m.m.a&&ie(T,z[3].m.m.a),U[0]&8&&ge(A.value)!==z[3].m.m.c&&ie(A,z[3].m.m.c)},d(z){z&&S(e),le=!1,ze(H)}}}function ff(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function cf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q,G,X,Y,j,x,ae,te,V;return{c(){e=m("div"),l=N("SSID"),n=m("br"),i=b(),o=m("input"),u=b(),c=m("div"),a=N("Password"),f=m("br"),p=b(),_=m("input"),h=b(),v=m("div"),d=m("div"),g=N("Power saving"),w=m("br"),D=b(),T=m("select"),E=m("option"),E.textContent="Default",F=m("option"),F.textContent="Off",I=m("option"),I.textContent="Minimum",O=m("option"),O.textContent="Maximum",C=b(),A=m("div"),le=N("Power"),H=m("br"),z=b(),U=m("div"),K=m("input"),Q=b(),G=m("span"),G.textContent="dBm",X=b(),Y=m("div"),j=m("label"),x=m("input"),ae=N(" Allow 802.11b legacy rates"),r(o,"name","ws"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(_,"name","wp"),r(_,"type","password"),r(_,"class","in-s"),r(c,"class","my-1"),E.__value=255,E.value=E.__value,F.__value=0,F.value=F.__value,I.__value=1,I.value=I.__value,O.__value=2,O.value=O.__value,r(T,"name","wz"),r(T,"class","in-s"),t[3].w.z===void 0&&We(()=>t[45].call(T)),r(d,"class","w-1/2"),r(K,"name","ww"),r(K,"type","number"),r(K,"min","0"),r(K,"max","20.5"),r(K,"step","0.5"),r(K,"class","in-f tr w-full"),r(G,"class","in-post"),r(U,"class","flex"),r(A,"class","ml-2 w-1/2"),r(v,"class","my-1 flex"),r(x,"type","checkbox"),r(x,"name","wb"),x.__value="true",x.value=x.__value,r(x,"class","rounded mb-1"),r(Y,"class","my-3")},m(W,we){M(W,e,we),s(e,l),s(e,n),s(e,i),s(e,o),ie(o,t[3].w.s),M(W,u,we),M(W,c,we),s(c,a),s(c,f),s(c,p),s(c,_),ie(_,t[3].w.p),M(W,h,we),M(W,v,we),s(v,d),s(d,g),s(d,w),s(d,D),s(d,T),s(T,E),s(T,F),s(T,I),s(T,O),Me(T,t[3].w.z,!0),s(v,C),s(v,A),s(A,le),s(A,H),s(A,z),s(A,U),s(U,K),ie(K,t[3].w.w),s(U,Q),s(U,G),M(W,X,we),M(W,Y,we),s(Y,j),s(j,x),x.checked=t[3].w.b,s(j,ae),te||(V=[ee(o,"input",t[43]),ee(_,"input",t[44]),ee(T,"change",t[45]),ee(K,"input",t[46]),ee(x,"change",t[47])],te=!0)},p(W,we){we[0]&8&&o.value!==W[3].w.s&&ie(o,W[3].w.s),we[0]&8&&_.value!==W[3].w.p&&ie(_,W[3].w.p),we[0]&8&&Me(T,W[3].w.z),we[0]&8&&ge(K.value)!==W[3].w.w&&ie(K,W[3].w.w),we[0]&8&&(x.checked=W[3].w.b)},d(W){W&&S(e),W&&S(u),W&&S(c),W&&S(h),W&&S(v),W&&S(X),W&&S(Y),te=!1,ze(V)}}}function mf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w;return{c(){e=m("div"),l=N("Gateway"),n=m("br"),i=b(),o=m("input"),u=b(),c=m("div"),a=N("DNS"),f=m("br"),p=b(),_=m("div"),h=m("input"),v=b(),d=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(h,"name","nd1"),r(h,"type","text"),r(h,"class","in-f w-full"),r(d,"name","nd2"),r(d,"type","text"),r(d,"class","in-l w-full"),r(_,"class","flex"),r(c,"class","my-1")},m(D,T){M(D,e,T),s(e,l),s(e,n),s(e,i),s(e,o),ie(o,t[3].n.g),M(D,u,T),M(D,c,T),s(c,a),s(c,f),s(c,p),s(c,_),s(_,h),ie(h,t[3].n.d1),s(_,v),s(_,d),ie(d,t[3].n.d2),g||(w=[ee(o,"input",t[51]),ee(h,"input",t[52]),ee(d,"input",t[53])],g=!0)},p(D,T){T[0]&8&&o.value!==D[3].n.g&&ie(o,D[3].n.g),T[0]&8&&h.value!==D[3].n.d1&&ie(h,D[3].n.d1),T[0]&8&&d.value!==D[3].n.d2&&ie(d,D[3].n.d2)},d(D){D&&S(e),D&&S(u),D&&S(c),g=!1,ze(w)}}}function _f(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=N(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(u,c){M(u,e,c),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[ee(l,"change",t[57]),ee(l,"change",t[14])],i=!0)},p(u,c){c[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&S(e),i=!1,ze(o)}}}function pf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v;const d=[T_,M_],g=[];function w(C,A){return C[3].q.s.c?0:1}n=w(t),i=g[n]=d[n](t);const D=[A_,E_],T=[];function E(C,A){return C[3].q.s.r?0:1}c=E(t),a=T[c]=D[c](t);const F=[R_,L_],I=[];function O(C,A){return C[3].q.s.k?0:1}return _=O(t),h=I[_]=F[_](t),{c(){e=m("div"),l=m("span"),i.c(),o=b(),u=m("span"),a.c(),f=b(),p=m("span"),h.c(),r(l,"class","flex pr-2"),r(u,"class","flex pr-2"),r(p,"class","flex pr-2"),r(e,"class","my-1 flex")},m(C,A){M(C,e,A),s(e,l),g[n].m(l,null),s(e,o),s(e,u),T[c].m(u,null),s(e,f),s(e,p),I[_].m(p,null),v=!0},p(C,A){let le=n;n=w(C),n===le?g[n].p(C,A):(Ae(),B(g[le],1,1,()=>{g[le]=null}),Pe(),i=g[n],i?i.p(C,A):(i=g[n]=d[n](C),i.c()),R(i,1),i.m(l,null));let H=c;c=E(C),c===H?T[c].p(C,A):(Ae(),B(T[H],1,1,()=>{T[H]=null}),Pe(),a=T[c],a?a.p(C,A):(a=T[c]=D[c](C),a.c()),R(a,1),a.m(u,null));let z=_;_=O(C),_===z?I[_].p(C,A):(Ae(),B(I[z],1,1,()=>{I[z]=null}),Pe(),h=I[_],h?h.p(C,A):(h=I[_]=F[_](C),h.c()),R(h,1),h.m(p,null))},i(C){v||(R(i),R(a),R(h),v=!0)},o(C){B(i),B(a),B(h),v=!1},d(C){C&&S(e),g[n].d(),T[c].d(),I[_].d()}}}function M_(t){let e,l;return e=new Xt({props:{to:"/mqtt-ca",$$slots:{default:[$_]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function T_(t){let e,l,n,i,o,u,c,a;return l=new Xt({props:{to:"/mqtt-ca",$$slots:{default:[N_]},$$scope:{ctx:t}}}),o=new Cs({}),{c(){e=m("span"),re(l.$$.fragment),n=b(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(l,e,null),M(f,n,p),M(f,i,p),se(o,i,null),u=!0,c||(a=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],c=!0)},p(f,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(R(l.$$.fragment,f),R(o.$$.fragment,f),u=!0)},o(f){B(l.$$.fragment,f),B(o.$$.fragment,f),u=!1},d(f){f&&S(e),oe(l),f&&S(n),f&&S(i),oe(o),c=!1,ze(a)}}}function $_(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:pe,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function N_(t){let e;return{c(){e=N("CA OK")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function E_(t){let e,l;return e=new Xt({props:{to:"/mqtt-cert",$$slots:{default:[P_]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function A_(t){let e,l,n,i,o,u,c,a;return l=new Xt({props:{to:"/mqtt-cert",$$slots:{default:[D_]},$$scope:{ctx:t}}}),o=new Cs({}),{c(){e=m("span"),re(l.$$.fragment),n=b(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(l,e,null),M(f,n,p),M(f,i,p),se(o,i,null),u=!0,c||(a=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],c=!0)},p(f,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(R(l.$$.fragment,f),R(o.$$.fragment,f),u=!0)},o(f){B(l.$$.fragment,f),B(o.$$.fragment,f),u=!1},d(f){f&&S(e),oe(l),f&&S(n),f&&S(i),oe(o),c=!1,ze(a)}}}function P_(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:pe,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function D_(t){let e;return{c(){e=N("Cert OK")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function L_(t){let e,l;return e=new Xt({props:{to:"/mqtt-key",$$slots:{default:[I_]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function R_(t){let e,l,n,i,o,u,c,a;return l=new Xt({props:{to:"/mqtt-key",$$slots:{default:[O_]},$$scope:{ctx:t}}}),o=new Cs({}),{c(){e=m("span"),re(l.$$.fragment),n=b(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(l,e,null),M(f,n,p),M(f,i,p),se(o,i,null),u=!0,c||(a=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],c=!0)},p(f,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(R(l.$$.fragment,f),R(o.$$.fragment,f),u=!0)},o(f){B(l.$$.fragment,f),B(o.$$.fragment,f),u=!1},d(f){f&&S(e),oe(l),f&&S(n),f&&S(i),oe(o),c=!1,ze(a)}}}function I_(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:pe,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function O_(t){let e;return{c(){e=N("Key OK")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function df(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q,G,X;return o=new Rt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=b(),i=m("a"),re(o.$$.fragment),u=b(),c=m("input"),a=b(),f=m("div"),p=m("div"),_=N("Electricity IDX"),h=m("br"),v=b(),d=m("input"),g=b(),w=m("div"),D=N("Current IDX"),T=m("br"),E=b(),F=m("input"),I=b(),O=m("div"),C=N(`Voltage IDX: L1, L2 & L3
+ `),A=m("div"),le=m("input"),H=b(),z=m("input"),U=b(),K=m("input"),r(l,"class","text-sm"),r(i,"href",It("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"type","hidden"),r(c,"name","o"),c.value="true",r(d,"name","oe"),r(d,"type","text"),r(d,"class","in-f tr w-full"),r(p,"class","w-1/2"),r(F,"name","oc"),r(F,"type","text"),r(F,"class","in-l tr w-full"),r(w,"class","w-1/2"),r(f,"class","my-1 flex"),r(le,"name","ou1"),r(le,"type","text"),r(le,"class","in-f tr w-1/3"),r(z,"name","ou2"),r(z,"type","text"),r(z,"class","in-m tr w-1/3"),r(K,"name","ou3"),r(K,"type","text"),r(K,"class","in-l tr w-1/3"),r(A,"class","flex"),r(O,"class","my-1"),r(e,"class","cnt")},m(Y,j){M(Y,e,j),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(p,_),s(p,h),s(p,v),s(p,d),ie(d,t[3].o.e),s(f,g),s(f,w),s(w,D),s(w,T),s(w,E),s(w,F),ie(F,t[3].o.c),s(e,I),s(e,O),s(O,C),s(O,A),s(A,le),ie(le,t[3].o.u1),s(A,H),s(A,z),ie(z,t[3].o.u2),s(A,U),s(A,K),ie(K,t[3].o.u3),Q=!0,G||(X=[ee(d,"input",t[65]),ee(F,"input",t[66]),ee(le,"input",t[67]),ee(z,"input",t[68]),ee(K,"input",t[69])],G=!0)},p(Y,j){j[0]&8&&d.value!==Y[3].o.e&&ie(d,Y[3].o.e),j[0]&8&&F.value!==Y[3].o.c&&ie(F,Y[3].o.c),j[0]&8&&le.value!==Y[3].o.u1&&ie(le,Y[3].o.u1),j[0]&8&&z.value!==Y[3].o.u2&&ie(z,Y[3].o.u2),j[0]&8&&K.value!==Y[3].o.u3&&ie(K,Y[3].o.u3)},i(Y){Q||(R(o.$$.fragment,Y),Q=!0)},o(Y){B(o.$$.fragment,Y),Q=!1},d(Y){Y&&S(e),oe(o),G=!1,ze(X)}}}function vf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K;return o=new Rt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=b(),i=m("a"),re(o.$$.fragment),u=b(),c=m("input"),a=b(),f=m("div"),p=N("Discovery topic prefix"),_=m("br"),h=b(),v=m("input"),d=b(),g=m("div"),w=N("Hostname for URL"),D=m("br"),T=b(),E=m("input"),I=b(),O=m("div"),C=N("Name tag"),A=m("br"),le=b(),H=m("input"),r(l,"class","text-sm"),r(i,"href",It("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"type","hidden"),r(c,"name","h"),c.value="true",r(v,"name","ht"),r(v,"type","text"),r(v,"class","in-s"),r(v,"placeholder","homeassistant"),r(f,"class","my-1"),r(E,"name","hh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"placeholder",F=t[3].g.h+".local"),r(g,"class","my-1"),r(H,"name","hn"),r(H,"type","text"),r(H,"class","in-s"),r(O,"class","my-1"),r(e,"class","cnt")},m(Q,G){M(Q,e,G),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(f,_),s(f,h),s(f,v),ie(v,t[3].h.t),s(e,d),s(e,g),s(g,w),s(g,D),s(g,T),s(g,E),ie(E,t[3].h.h),s(e,I),s(e,O),s(O,C),s(O,A),s(O,le),s(O,H),ie(H,t[3].h.n),z=!0,U||(K=[ee(v,"input",t[70]),ee(E,"input",t[71]),ee(H,"input",t[72])],U=!0)},p(Q,G){G[0]&8&&v.value!==Q[3].h.t&&ie(v,Q[3].h.t),(!z||G[0]&8&&F!==(F=Q[3].g.h+".local"))&&r(E,"placeholder",F),G[0]&8&&E.value!==Q[3].h.h&&ie(E,Q[3].h.h),G[0]&8&&H.value!==Q[3].h.n&&ie(H,Q[3].h.n)},i(Q){z||(R(o.$$.fragment,Q),z=!0)},o(Q){B(o.$$.fragment,Q),z=!1},d(Q){Q&&S(e),oe(o),U=!1,ze(K)}}}function hf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q,G,X,Y,j,x,ae;o=new Rt({});let te=t[3].c.es&&bf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Cloud connections",n=b(),i=m("a"),re(o.$$.fragment),u=b(),c=m("input"),a=b(),f=m("div"),p=m("label"),_=m("input"),h=N(" Enable cloud upload"),v=b(),d=m("div"),g=N("Client ID"),w=m("br"),D=b(),T=m("input"),I=b(),O=m("div"),C=N("Client secret"),A=m("br"),le=b(),H=m("input"),U=b(),K=m("div"),Q=m("label"),G=m("input"),X=N(" Energy Speedometer"),Y=b(),te&&te.c(),r(l,"class","text-sm"),r(i,"href",It("Cloud")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"type","hidden"),r(c,"name","c"),c.value="true",r(_,"type","checkbox"),r(_,"name","ce"),_.__value="true",_.value=_.__value,r(_,"class","rounded mb-1"),r(f,"class","my-1"),r(T,"name","ci"),r(T,"type","text"),r(T,"class","in-s"),r(T,"pattern",E=t[3].c.e?"[A-Z0-9]{16}":".*"),T.required=F=t[3].c.e,r(d,"class","my-1"),r(H,"name","cs"),r(H,"type","text"),r(H,"class","in-s"),r(H,"pattern",z=t[3].c.e&&t[3].c.s!="***"?"[A-Z0-9]{16}":".*"),r(O,"class","my-1"),r(G,"type","checkbox"),r(G,"class","rounded mb-1"),r(G,"name","ces"),G.__value="true",G.value=G.__value,r(K,"class","my-1"),r(e,"class","cnt")},m(V,W){M(V,e,W),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(p,_),_.checked=t[3].c.e,s(p,h),s(e,v),s(e,d),s(d,g),s(d,w),s(d,D),s(d,T),ie(T,t[3].c.i),s(e,I),s(e,O),s(O,C),s(O,A),s(O,le),s(O,H),ie(H,t[3].c.s),s(e,U),s(e,K),s(K,Q),s(Q,G),G.checked=t[3].c.es,s(Q,X),s(K,Y),te&&te.m(K,null),j=!0,x||(ae=[ee(_,"change",t[73]),ee(T,"input",t[74]),ee(H,"input",t[75]),ee(G,"change",t[76])],x=!0)},p(V,W){W[0]&8&&(_.checked=V[3].c.e),(!j||W[0]&8&&E!==(E=V[3].c.e?"[A-Z0-9]{16}":".*"))&&r(T,"pattern",E),(!j||W[0]&8&&F!==(F=V[3].c.e))&&(T.required=F),W[0]&8&&T.value!==V[3].c.i&&ie(T,V[3].c.i),(!j||W[0]&8&&z!==(z=V[3].c.e&&V[3].c.s!="***"?"[A-Z0-9]{16}":".*"))&&r(H,"pattern",z),W[0]&8&&H.value!==V[3].c.s&&ie(H,V[3].c.s),W[0]&8&&(G.checked=V[3].c.es),V[3].c.es?te?(te.p(V,W),W[0]&8&&R(te,1)):(te=bf(V),te.c(),R(te,1),te.m(K,null)):te&&(Ae(),B(te,1,1,()=>{te=null}),Pe())},i(V){j||(R(o.$$.fragment,V),R(te),j=!0)},o(V){B(o.$$.fragment,V),B(te),j=!1},d(V){V&&S(e),oe(o),te&&te.d(),x=!1,ze(ae)}}}function bf(t){let e,l,n=t[0].mac+"",i,o,u,c,a=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,p,_,h,v=t[0].mac&&t[0].meter.id&&gf(t);return{c(){e=m("div"),l=N("MAC: "),i=N(n),o=b(),u=m("div"),c=N("Meter ID: "),f=N(a),p=b(),v&&v.c(),_=Ve(),r(e,"class","pl-5"),r(u,"class","pl-5")},m(d,g){M(d,e,g),s(e,l),s(e,i),M(d,o,g),M(d,u,g),s(u,c),s(u,f),M(d,p,g),v&&v.m(d,g),M(d,_,g),h=!0},p(d,g){(!h||g[0]&1)&&n!==(n=d[0].mac+"")&&J(i,n),(!h||g[0]&1)&&a!==(a=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&J(f,a),d[0].mac&&d[0].meter.id?v?(v.p(d,g),g[0]&1&&R(v,1)):(v=gf(d),v.c(),R(v,1),v.m(_.parentNode,_)):v&&(Ae(),B(v,1,1,()=>{v=null}),Pe())},i(d){h||(R(v),h=!0)},o(d){B(v),h=!1},d(d){d&&S(e),d&&S(o),d&&S(u),d&&S(p),v&&v.d(d),d&&S(_)}}}function gf(t){let e,l,n;return l=new g_({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","pl-2")},m(i,o){M(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&S(e),oe(l)}}}function kf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E;o=new Rt({});let F={length:9},I=[];for(let O=0;O20&&Sf(t),_=t[3].i.d.d>0&&$f(t),h=t[0].chip=="esp8266"&&Nf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=b(),i=m("a"),re(o.$$.fragment),u=b(),p&&p.c(),c=b(),_&&_.c(),a=b(),h&&h.c(),r(l,"class","text-sm"),r(i,"href",It("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),p&&p.m(e,null),s(e,c),_&&_.m(e,null),s(e,a),h&&h.m(e,null),f=!0},p(v,d){v[0].board>20?p?(p.p(v,d),d[0]&1&&R(p,1)):(p=Sf(v),p.c(),R(p,1),p.m(e,c)):p&&(Ae(),B(p,1,1,()=>{p=null}),Pe()),v[3].i.d.d>0?_?_.p(v,d):(_=$f(v),_.c(),_.m(e,a)):_&&(_.d(1),_=null),v[0].chip=="esp8266"?h?h.p(v,d):(h=Nf(v),h.c(),h.m(e,null)):h&&(h.d(1),h=null)},i(v){f||(R(o.$$.fragment,v),R(p),f=!0)},o(v){B(o.$$.fragment,v),B(p),f=!1},d(v){v&&S(e),oe(o),p&&p.d(),_&&_.d(),h&&h.d()}}}function Sf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q,G,X,Y,j,x,ae,te,V,W,we,He,Ie,Se,ye,ve,$e,be,$,y,k,P,L,Z,ne,fe,de,Ce,Oe,ue,Te,Je,Ot,st,wt,nt,Ft,Qe,Zt,Gt,vt,xe,Ge,Ke,Ne,Ze,et;f=new ao({props:{chip:t[0].chip}}),w=new ao({props:{chip:t[0].chip}});let qe=t[0].chip!="esp8266"&&Mf(t),Fe=t[3].i.v.p>0&&Tf(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=N("HAN RX"),u=m("br"),c=b(),a=m("select"),re(f.$$.fragment),p=b(),_=m("div"),h=N("HAN TX"),v=m("br"),d=b(),g=m("select"),re(w.$$.fragment),D=b(),T=m("div"),E=m("label"),F=m("input"),I=N(" pullup"),O=b(),C=m("div"),A=m("div"),le=N("AP button"),H=m("br"),z=b(),U=m("input"),K=b(),Q=m("div"),G=N("LED"),X=m("br"),Y=b(),j=m("div"),x=m("input"),ae=b(),te=m("div"),V=m("label"),W=m("input"),we=N(" inverted"),He=b(),Ie=m("div"),Se=N("RGB"),ye=m("label"),ve=m("input"),$e=N(" inverted"),be=m("br"),$=b(),y=m("div"),k=m("input"),P=b(),L=m("input"),Z=b(),ne=m("input"),fe=b(),de=m("div"),Ce=m("div"),Oe=N(`LED dis. GPIO
+ `),ue=m("input"),Te=b(),Je=m("div"),Ot=N("Temperature"),st=m("br"),wt=b(),nt=m("input"),Ft=b(),Qe=m("div"),Zt=N("Analog temp"),Gt=m("br"),vt=b(),xe=m("input"),Ge=b(),qe&&qe.c(),Ke=b(),Fe&&Fe.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(a,"name","ihp"),r(a,"class","in-f w-full"),t[3].i.h.p===void 0&&We(()=>t[80].call(a)),r(i,"class","w-1/3"),r(g,"name","iht"),r(g,"class","in-l w-full"),t[3].i.h.t===void 0&&We(()=>t[81].call(g)),r(_,"class","w-1/3"),r(F,"name","ihu"),F.__value="true",F.value=F.__value,r(F,"type","checkbox"),r(F,"class","rounded mb-1"),r(E,"class","ml-2"),r(T,"class","w-1/3"),r(n,"class","flex flex-wrap"),r(U,"name","ia"),r(U,"type","number"),r(U,"min","0"),r(U,"max",t[6]),r(U,"class","in-f tr w-full"),r(A,"class","w-1/3"),r(x,"name","ilp"),r(x,"type","number"),r(x,"min","0"),r(x,"max",t[6]),r(x,"class","in-l tr w-full"),r(j,"class","flex"),r(Q,"class","w-1/3"),r(W,"name","ili"),W.__value="true",W.value=W.__value,r(W,"type","checkbox"),r(W,"class","rounded mb-1"),r(V,"class","ml-4"),r(te,"class","w-1/3"),r(ve,"name","iri"),ve.__value="true",ve.value=ve.__value,r(ve,"type","checkbox"),r(ve,"class","rounded mb-1"),r(ye,"class","ml-4"),r(k,"name","irr"),r(k,"type","number"),r(k,"min","0"),r(k,"max",t[6]),r(k,"class","in-f tr w-1/3"),r(L,"name","irg"),r(L,"type","number"),r(L,"min","0"),r(L,"max",t[6]),r(L,"class","in-m tr w-1/3"),r(ne,"name","irb"),r(ne,"type","number"),r(ne,"min","0"),r(ne,"max",t[6]),r(ne,"class","in-l tr w-1/3"),r(y,"class","flex"),r(Ie,"class","w-full"),r(ue,"name","idd"),r(ue,"type","number"),r(ue,"min","0"),r(ue,"max",t[6]),r(ue,"class","in-s tr"),r(Ce,"class","my-1 pr-1 w-1/3"),r(de,"class","w-full"),r(nt,"name","itd"),r(nt,"type","number"),r(nt,"min","0"),r(nt,"max",t[6]),r(nt,"class","in-f tr w-full"),r(Je,"class","my-1 w-1/3"),r(xe,"name","ita"),r(xe,"type","number"),r(xe,"min","0"),r(xe,"max",t[6]),r(xe,"class","in-l tr w-full"),r(Qe,"class","my-1 pr-1 w-1/3"),r(C,"class","flex flex-wrap")},m(_e,ce){M(_e,e,ce),M(_e,l,ce),M(_e,n,ce),s(n,i),s(i,o),s(i,u),s(i,c),s(i,a),se(f,a,null),Me(a,t[3].i.h.p,!0),s(n,p),s(n,_),s(_,h),s(_,v),s(_,d),s(_,g),se(w,g,null),Me(g,t[3].i.h.t,!0),s(n,D),s(n,T),s(T,E),s(E,F),F.checked=t[3].i.h.u,s(E,I),M(_e,O,ce),M(_e,C,ce),s(C,A),s(A,le),s(A,H),s(A,z),s(A,U),ie(U,t[3].i.a),s(C,K),s(C,Q),s(Q,G),s(Q,X),s(Q,Y),s(Q,j),s(j,x),ie(x,t[3].i.l.p),s(C,ae),s(C,te),s(te,V),s(V,W),W.checked=t[3].i.l.i,s(V,we),s(C,He),s(C,Ie),s(Ie,Se),s(Ie,ye),s(ye,ve),ve.checked=t[3].i.r.i,s(ye,$e),s(Ie,be),s(Ie,$),s(Ie,y),s(y,k),ie(k,t[3].i.r.r),s(y,P),s(y,L),ie(L,t[3].i.r.g),s(y,Z),s(y,ne),ie(ne,t[3].i.r.b),s(C,fe),s(C,de),s(de,Ce),s(Ce,Oe),s(Ce,ue),ie(ue,t[3].i.d.d),s(C,Te),s(C,Je),s(Je,Ot),s(Je,st),s(Je,wt),s(Je,nt),ie(nt,t[3].i.t.d),s(C,Ft),s(C,Qe),s(Qe,Zt),s(Qe,Gt),s(Qe,vt),s(Qe,xe),ie(xe,t[3].i.t.a),s(C,Ge),qe&&qe.m(C,null),s(C,Ke),Fe&&Fe.m(C,null),Ne=!0,Ze||(et=[ee(a,"change",t[80]),ee(g,"change",t[81]),ee(F,"change",t[82]),ee(U,"input",t[83]),ee(x,"input",t[84]),ee(W,"change",t[85]),ee(ve,"change",t[86]),ee(k,"input",t[87]),ee(L,"input",t[88]),ee(ne,"input",t[89]),ee(ue,"input",t[90]),ee(nt,"input",t[91]),ee(xe,"input",t[92])],Ze=!0)},p(_e,ce){const Be={};ce[0]&1&&(Be.chip=_e[0].chip),f.$set(Be),ce[0]&8&&Me(a,_e[3].i.h.p);const pt={};ce[0]&1&&(pt.chip=_e[0].chip),w.$set(pt),ce[0]&8&&Me(g,_e[3].i.h.t),ce[0]&8&&(F.checked=_e[3].i.h.u),(!Ne||ce[0]&64)&&r(U,"max",_e[6]),ce[0]&8&&ge(U.value)!==_e[3].i.a&&ie(U,_e[3].i.a),(!Ne||ce[0]&64)&&r(x,"max",_e[6]),ce[0]&8&&ge(x.value)!==_e[3].i.l.p&&ie(x,_e[3].i.l.p),ce[0]&8&&(W.checked=_e[3].i.l.i),ce[0]&8&&(ve.checked=_e[3].i.r.i),(!Ne||ce[0]&64)&&r(k,"max",_e[6]),ce[0]&8&&ge(k.value)!==_e[3].i.r.r&&ie(k,_e[3].i.r.r),(!Ne||ce[0]&64)&&r(L,"max",_e[6]),ce[0]&8&&ge(L.value)!==_e[3].i.r.g&&ie(L,_e[3].i.r.g),(!Ne||ce[0]&64)&&r(ne,"max",_e[6]),ce[0]&8&&ge(ne.value)!==_e[3].i.r.b&&ie(ne,_e[3].i.r.b),(!Ne||ce[0]&64)&&r(ue,"max",_e[6]),ce[0]&8&&ge(ue.value)!==_e[3].i.d.d&&ie(ue,_e[3].i.d.d),(!Ne||ce[0]&64)&&r(nt,"max",_e[6]),ce[0]&8&&ge(nt.value)!==_e[3].i.t.d&&ie(nt,_e[3].i.t.d),(!Ne||ce[0]&64)&&r(xe,"max",_e[6]),ce[0]&8&&ge(xe.value)!==_e[3].i.t.a&&ie(xe,_e[3].i.t.a),_e[0].chip!="esp8266"?qe?qe.p(_e,ce):(qe=Mf(_e),qe.c(),qe.m(C,Ke)):qe&&(qe.d(1),qe=null),_e[3].i.v.p>0?Fe?Fe.p(_e,ce):(Fe=Tf(_e),Fe.c(),Fe.m(C,null)):Fe&&(Fe.d(1),Fe=null)},i(_e){Ne||(R(f.$$.fragment,_e),R(w.$$.fragment,_e),Ne=!0)},o(_e){B(f.$$.fragment,_e),B(w.$$.fragment,_e),Ne=!1},d(_e){_e&&S(e),_e&&S(l),_e&&S(n),oe(f),oe(w),_e&&S(O),_e&&S(C),qe&&qe.d(),Fe&&Fe.d(),Ze=!1,ze(et)}}}function Mf(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N("Vcc"),n=m("br"),i=b(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ie(o,t[3].i.v.p),u||(c=ee(o,"input",t[93]),u=!0)},p(a,f){f[0]&64&&r(o,"max",a[6]),f[0]&8&&ge(o.value)!==a[3].i.v.p&&ie(o,a[3].i.v.p)},d(a){a&&S(e),u=!1,c()}}}function Tf(t){let e,l,n,i,o,u,c,a,f,p;return{c(){e=m("div"),l=N("Voltage divider"),n=m("br"),i=b(),o=m("div"),u=m("input"),c=b(),a=m("input"),r(u,"name","ivdv"),r(u,"type","number"),r(u,"min","0"),r(u,"max","65535"),r(u,"class","in-f tr w-full"),r(u,"placeholder","VCC"),r(a,"name","ivdg"),r(a,"type","number"),r(a,"min","0"),r(a,"max","65535"),r(a,"class","in-l tr w-full"),r(a,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(_,h){M(_,e,h),s(e,l),s(e,n),s(e,i),s(e,o),s(o,u),ie(u,t[3].i.v.d.v),s(o,c),s(o,a),ie(a,t[3].i.v.d.g),f||(p=[ee(u,"input",t[94]),ee(a,"input",t[95])],f=!0)},p(_,h){h[0]&8&&ge(u.value)!==_[3].i.v.d.v&&ie(u,_[3].i.v.d.v),h[0]&8&&ge(a.value)!==_[3].i.v.d.g&&ie(a,_[3].i.v.d.g)},d(_){_&&S(e),f=!1,ze(p)}}}function $f(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N(`LED behaviour
+ `),n=m("select"),i=m("option"),i.textContent="Enabled",o=m("option"),o.textContent="Disabled",i.__value=0,i.value=i.__value,o.__value=1,o.value=o.__value,r(n,"name","idb"),r(n,"class","in-s"),t[3].i.d.b===void 0&&We(()=>t[96].call(n)),r(e,"class","my-1 w-full")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(n,i),s(n,o),Me(n,t[3].i.d.b,!0),u||(c=ee(n,"change",t[96]),u=!0)},p(a,f){f[0]&8&&Me(n,a[3].i.d.b)},d(a){a&&S(e),u=!1,c()}}}function Nf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T=(t[0].board==2||t[0].board==100)&&Ef(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=N("Vcc offset"),u=m("br"),c=b(),a=m("input"),f=b(),p=m("div"),_=N("Multiplier"),h=m("br"),v=b(),d=m("input"),g=b(),T&&T.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(a,"name","ivo"),r(a,"type","number"),r(a,"min","0.0"),r(a,"max","3.5"),r(a,"step","0.01"),r(a,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(d,"name","ivm"),r(d,"type","number"),r(d,"min","0.1"),r(d,"max","10"),r(d,"step","0.01"),r(d,"class","in-l tr w-full"),r(p,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(E,F){M(E,e,F),M(E,l,F),M(E,n,F),s(n,i),s(i,o),s(i,u),s(i,c),s(i,a),ie(a,t[3].i.v.o),s(n,f),s(n,p),s(p,_),s(p,h),s(p,v),s(p,d),ie(d,t[3].i.v.m),s(n,g),T&&T.m(n,null),w||(D=[ee(a,"input",t[97]),ee(d,"input",t[98])],w=!0)},p(E,F){F[0]&8&&ge(a.value)!==E[3].i.v.o&&ie(a,E[3].i.v.o),F[0]&8&&ge(d.value)!==E[3].i.v.m&&ie(d,E[3].i.v.m),E[0].board==2||E[0].board==100?T?T.p(E,F):(T=Ef(E),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(E){E&&S(e),E&&S(l),E&&S(n),T&&T.d(),w=!1,ze(D)}}}function Ef(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N("Boot limit"),n=m("br"),i=b(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ie(o,t[3].i.v.b),u||(c=ee(o,"input",t[99]),u=!0)},p(a,f){f[0]&8&&ge(o.value)!==a[3].i.v.b&&ie(o,a[3].i.v.b)},d(a){a&&S(e),u=!1,c()}}}function Af(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D=t[3].d.t&&Pf();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=b(),n=m("div"),i=m("label"),o=m("input"),u=N(" Enable telnet"),c=b(),D&&D.c(),a=b(),f=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",h=m("option"),h.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),_.__value=1,_.value=_.__value,h.__value=2,h.value=h.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,r(p,"name","dl"),r(p,"class","in-s"),t[3].d.l===void 0&&We(()=>t[102].call(p)),r(f,"class","my-1")},m(T,E){M(T,e,E),M(T,l,E),M(T,n,E),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,u),M(T,c,E),D&&D.m(T,E),M(T,a,E),M(T,f,E),s(f,p),s(p,_),s(p,h),s(p,v),s(p,d),Me(p,t[3].d.l,!0),g||(w=[ee(o,"change",t[101]),ee(p,"change",t[102])],g=!0)},p(T,E){E[0]&8&&(o.checked=T[3].d.t),T[3].d.t?D||(D=Pf(),D.c(),D.m(a.parentNode,a)):D&&(D.d(1),D=null),E[0]&8&&Me(p,T[3].d.l)},d(T){T&&S(e),T&&S(l),T&&S(n),T&&S(c),D&&D.d(T),T&&S(a),T&&S(f),g=!1,ze(w)}}}function Pf(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function F_(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q,G,X,Y,j,x,ae,te,V,W,we,He,Ie,Se,ye,ve,$e,be,$,y,k,P,L,Z,ne,fe,de,Ce,Oe,ue,Te,Je,Ot,st,wt,nt,Ft,Qe,Zt,Gt,vt,xe,Ge,Ke,Ne,Ze,et,qe,Fe,_e,ce,Be,pt,Nl,El,Al,Ai,ai,bl,Pi,Di,Li,yt,Ri,je,dn,Ii,Pl,Dl,Oi,zl,Fi,Gl,qi,gl,Bi,Ye,Ct,ht,Vl,Ll,Rl,Vt,vn,No,Ss,Eo,ui,Jt,Ao,Po,Il,al,Ol,Do,Ui,Lo,bt,Fl,Ro,ji,hn,bn,gn,kn,Hi,Io,qt,Wi,Oo,Kl,Fo,qo,Bo,ul,wn,yn,Uo,Cn,Yl,jo,Ho,Wo,Sn,xt,zo,zi,Go,Ql,Vo,Ko,Yo,Mn,el,Qo,Gi,Xo,Ms,Zo,Xl,Vi,tl,Jo,xo,er,Ts,Ki,ll,tr,lr,nr,Bt,Yi,ir,Tn,$n,sr,fi,or,Zl,rr,ar,ur,Kt,Nn,En,fr,cr,mt,Qi,mr,An,Pn,_r,Jl,pr,dr,vr,ql,fl,Dn,Ln,hr,Ut,Xi,Zi,br,jt,Rn,Ji,xi,gr,$s,es,ts,nl,kr,wr,ci,yr,Bl,Cr,mi,il,Sr,Mr,Tr,ls,kl,$r,lt,ns,Nr,In,On,Er,_i,Ar,cl,Pr,Ns,Dr,Lr,Fn,wl,Rr,sl,Ir,Es,xl,Or,Fr,qr,yl,Br,en,Ur,jr,Hr,Cl,Wr,qn,Bn,zr,Gr,Vr,Sl,Kr,Un,Yr,Qr,Xr,St,jn,Hn,Wn,zn,Gn,Vn,Zr,tn,Jr,xr,ea,Ml,ta,As,Ps,Ds,Ls=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),Rs,ml,is,la,Kn,Yn,na,pi,ia,di,sa,Is,Ht,ss,oa,Qn,Xn,ra,vi,aa,os,rs,ol,ua,fa,ca,Ul,Os,Zn,ma,as,Jn,_a,us,Fs,ln,qs,nn,Bs,sn,Us,on,Yt,js,pa;c=new Rt({}),A=new m_({});let f1=["NOK","SEK","DKK","EUR","CHF"],hi=[];for(let q=0;q<5;q+=1)hi[q]=y_(w_(t,f1,q));vt=new Xt({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[C_]},$$scope:{ctx:t}}});let Mt=t[3].p.e&&t[0].chip!="esp8266"&&sf(t),Tt=t[3].g.s>0&&of(t);Dl=new Rt({});let c1=[24,48,96,192,384,576,1152],bi=[];for(let q=0;q<7;q+=1)bi[q]=S_(k_(t,c1,q));let $t=t[3].m.e.e&&rf(t),Nt=t[3].m.e.e&&af(t),Et=t[3].m.m.e&&uf(t);$n=new Rt({});let Wt=t[0].if&&t[0].if.eth&&ff(),At=(t[3].n.c==1||t[3].n.c==2)&&cf(t);Pn=new Rt({}),Rn=new a1({});let Pt=t[3].n.m=="static"&&mf(t);On=new Rt({});let Dt=t[0].chip!="esp8266"&&_f(t),ot=t[3].q.s.e&&pf(t),rt=t[3].q.m==3&&df(t),at=t[3].q.m==4&&vf(t),ut=t[3].c.es!=null&&hf(t),ft=Ls&&kf(t);Yn=new Rt({});let xn=t[7],gt=[];for(let q=0;q20||t[0].chip=="esp8266"||t[3].i.d.d>0)&&Cf(t);Xn=new Rt({});let Lt=t[3].d.s&&Af(t);return ln=new kt({props:{active:t[1],message:"Loading configuration"}}),nn=new kt({props:{active:t[2],message:"Saving configuration"}}),sn=new kt({props:{active:t[4],message:"Performing factory reset"}}),on=new kt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=b(),u=m("a"),re(c.$$.fragment),a=b(),f=m("input"),p=b(),_=m("div"),h=m("div"),v=m("div"),d=N("Hostname"),g=m("br"),w=b(),D=m("input"),T=b(),E=m("div"),F=N("Time zone"),I=m("br"),O=b(),C=m("select"),re(A.$$.fragment),le=b(),H=m("input"),z=b(),U=m("div"),K=m("div"),Q=m("div"),G=N("Price region"),X=m("br"),Y=b(),j=m("select"),x=m("optgroup"),ae=m("option"),ae.textContent="NO1",te=m("option"),te.textContent="NO2",V=m("option"),V.textContent="NO3",W=m("option"),W.textContent="NO4",we=m("option"),we.textContent="NO5",He=m("optgroup"),Ie=m("option"),Ie.textContent="SE1",Se=m("option"),Se.textContent="SE2",ye=m("option"),ye.textContent="SE3",ve=m("option"),ve.textContent="SE4",$e=m("optgroup"),be=m("option"),be.textContent="DK1",$=m("option"),$.textContent="DK2",y=m("option"),y.textContent="Austria",k=m("option"),k.textContent="Belgium",P=m("option"),P.textContent="Czech Republic",L=m("option"),L.textContent="Estonia",Z=m("option"),Z.textContent="Finland",ne=m("option"),ne.textContent="France",fe=m("option"),fe.textContent="Germany",de=m("option"),de.textContent="Great Britain",Ce=m("option"),Ce.textContent="Latvia",Oe=m("option"),Oe.textContent="Lithuania",ue=m("option"),ue.textContent="Netherland",Te=m("option"),Te.textContent="Poland",Je=m("option"),Je.textContent="Switzerland",Ot=b(),st=m("div"),wt=N("Currency"),nt=m("br"),Ft=b(),Qe=m("select");for(let q=0;q<5;q+=1)hi[q].c();Zt=b(),Gt=m("div"),re(vt.$$.fragment),xe=b(),Ge=m("div"),Ke=m("label"),Ne=m("input"),Ze=N(" Enable price fetch from remote server"),et=b(),Mt&&Mt.c(),qe=b(),Fe=m("div"),_e=N("Security"),ce=m("br"),Be=b(),pt=m("select"),Nl=m("option"),Nl.textContent="None",El=m("option"),El.textContent="Only configuration",Al=m("option"),Al.textContent="Everything",Ai=b(),Tt&&Tt.c(),ai=b(),bl=m("div"),Pi=N("Context"),Di=m("br"),Li=b(),yt=m("input"),Ri=b(),je=m("div"),dn=m("strong"),dn.textContent="Meter",Ii=b(),Pl=m("a"),re(Dl.$$.fragment),Oi=b(),zl=m("input"),Fi=b(),Gl=m("input"),qi=b(),gl=m("div"),Bi=N("Communication"),Ye=m("br"),Ct=b(),ht=m("select"),Vl=m("option"),Vl.textContent="Passive (Push)",Ll=m("option"),Ll.textContent="Kamstrup (Pull)",Rl=b(),Vt=m("div"),vn=m("span"),vn.textContent="Buffer size",No=b(),Ss=m("span"),Ss.textContent="Serial conf.",Eo=b(),ui=m("label"),Jt=m("input"),Ao=N(" inverted"),Po=b(),Il=m("div"),al=m("select"),Ol=m("option"),Do=N("Autodetect");for(let q=0;q<7;q+=1)bi[q].c();Lo=b(),bt=m("select"),Fl=m("option"),Ro=N("-"),hn=m("option"),hn.textContent="7N1",bn=m("option"),bn.textContent="8N1",gn=m("option"),gn.textContent="7E1",kn=m("option"),kn.textContent="8E1",Io=b(),qt=m("input"),Oo=b(),Kl=m("div"),Fo=N("Voltage"),qo=m("br"),Bo=b(),ul=m("select"),wn=m("option"),wn.textContent="400V (TN)",yn=m("option"),yn.textContent="230V (IT/TT)",Uo=b(),Cn=m("div"),Yl=m("div"),jo=N("Main fuse"),Ho=m("br"),Wo=b(),Sn=m("label"),xt=m("input"),zo=b(),zi=m("span"),zi.textContent="A",Go=b(),Ql=m("div"),Vo=N("Production"),Ko=m("br"),Yo=b(),Mn=m("label"),el=m("input"),Qo=b(),Gi=m("span"),Gi.textContent="kWp",Xo=b(),Ms=m("div"),Zo=b(),Xl=m("div"),Vi=m("label"),tl=m("input"),Jo=N(" Meter is encrypted"),xo=b(),$t&&$t.c(),er=b(),Nt&&Nt.c(),Ts=b(),Ki=m("label"),ll=m("input"),tr=N(" Multipliers"),lr=b(),Et&&Et.c(),nr=b(),Bt=m("div"),Yi=m("strong"),Yi.textContent="Connection",ir=b(),Tn=m("a"),re($n.$$.fragment),sr=b(),fi=m("input"),or=b(),Zl=m("div"),rr=N("Connection"),ar=m("br"),ur=b(),Kt=m("select"),Nn=m("option"),Nn.textContent="WiFi",En=m("option"),En.textContent="Access point",Wt&&Wt.c(),fr=b(),At&&At.c(),cr=b(),mt=m("div"),Qi=m("strong"),Qi.textContent="Network",mr=b(),An=m("a"),re(Pn.$$.fragment),_r=b(),Jl=m("div"),pr=N("IP"),dr=m("br"),vr=b(),ql=m("div"),fl=m("select"),Dn=m("option"),Dn.textContent="DHCP",Ln=m("option"),Ln.textContent="Static",hr=b(),Ut=m("input"),br=b(),jt=m("select"),re(Rn.$$.fragment),gr=b(),Pt&&Pt.c(),$s=b(),es=m("div"),ts=m("label"),nl=m("input"),kr=N(" enable mDNS"),wr=b(),ci=m("input"),yr=b(),Bl=m("div"),Cr=N("NTP "),mi=m("label"),il=m("input"),Sr=N(" obtain from DHCP"),Mr=m("br"),Tr=b(),ls=m("div"),kl=m("input"),$r=b(),lt=m("div"),ns=m("strong"),ns.textContent="MQTT",Nr=b(),In=m("a"),re(On.$$.fragment),Er=b(),_i=m("input"),Ar=b(),cl=m("div"),Pr=N(`Server
+ `),Dt&&Dt.c(),Ns=b(),Dr=m("br"),Lr=b(),Fn=m("div"),wl=m("input"),Rr=b(),sl=m("input"),Ir=b(),ot&&ot.c(),Es=b(),xl=m("div"),Or=N("Username"),Fr=m("br"),qr=b(),yl=m("input"),Br=b(),en=m("div"),Ur=N("Password"),jr=m("br"),Hr=b(),Cl=m("input"),Wr=b(),qn=m("div"),Bn=m("div"),zr=N("Client ID"),Gr=m("br"),Vr=b(),Sl=m("input"),Kr=b(),Un=m("div"),Yr=N("Payload"),Qr=m("br"),Xr=b(),St=m("select"),jn=m("option"),jn.textContent="JSON",Hn=m("option"),Hn.textContent="Raw (minimal)",Wn=m("option"),Wn.textContent="Raw (full)",zn=m("option"),zn.textContent="Domoticz",Gn=m("option"),Gn.textContent="HomeAssistant",Vn=m("option"),Vn.textContent="HEX dump",Zr=b(),tn=m("div"),Jr=N("Publish topic"),xr=m("br"),ea=b(),Ml=m("input"),ta=b(),rt&&rt.c(),As=b(),at&&at.c(),Ps=b(),ut&&ut.c(),Ds=b(),ft&&ft.c(),Rs=b(),ml=m("div"),is=m("strong"),is.textContent="User interface",la=b(),Kn=m("a"),re(Yn.$$.fragment),na=b(),pi=m("input"),ia=b(),di=m("div");for(let q=0;qSave',Fs=b(),re(ln.$$.fragment),qs=b(),re(nn.$$.fragment),Bs=b(),re(sn.$$.fragment),Us=b(),re(on.$$.fragment),r(i,"class","text-sm"),r(u,"href",It("General-configuration")),r(u,"target","_blank"),r(u,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r(D,"name","gh"),r(D,"type","text"),r(D,"class","in-f w-full"),r(D,"pattern","[A-Za-z0-9-]+"),r(C,"name","gt"),r(C,"class","in-l w-full"),t[3].g.t===void 0&&We(()=>t[17].call(C)),r(h,"class","flex"),r(_,"class","my-1"),r(H,"type","hidden"),r(H,"name","p"),H.value="true",ae.__value="10YNO-1--------2",ae.value=ae.__value,te.__value="10YNO-2--------T",te.value=te.__value,V.__value="10YNO-3--------J",V.value=V.__value,W.__value="10YNO-4--------9",W.value=W.__value,we.__value="10Y1001A1001A48H",we.value=we.__value,r(x,"label","Norway"),Ie.__value="10Y1001A1001A44P",Ie.value=Ie.__value,Se.__value="10Y1001A1001A45N",Se.value=Se.__value,ye.__value="10Y1001A1001A46L",ye.value=ye.__value,ve.__value="10Y1001A1001A47J",ve.value=ve.__value,r(He,"label","Sweden"),be.__value="10YDK-1--------W",be.value=be.__value,$.__value="10YDK-2--------M",$.value=$.__value,r($e,"label","Denmark"),y.__value="10YAT-APG------L",y.value=y.__value,k.__value="10YBE----------2",k.value=k.__value,P.__value="10YCZ-CEPS-----N",P.value=P.__value,L.__value="10Y1001A1001A39I",L.value=L.__value,Z.__value="10YFI-1--------U",Z.value=Z.__value,ne.__value="10YFR-RTE------C",ne.value=ne.__value,fe.__value="10Y1001A1001A83F",fe.value=fe.__value,de.__value="10YGB----------A",de.value=de.__value,Ce.__value="10YLV-1001A00074",Ce.value=Ce.__value,Oe.__value="10YLT-1001A0008Q",Oe.value=Oe.__value,ue.__value="10YNL----------L",ue.value=ue.__value,Te.__value="10YPL-AREA-----S",Te.value=Te.__value,Je.__value="10YCH-SWISSGRIDZ",Je.value=Je.__value,r(j,"name","pr"),r(j,"class","in-f w-full"),t[3].p.r===void 0&&We(()=>t[18].call(j)),r(Q,"class","w-full"),r(Qe,"name","pc"),r(Qe,"class","in-l"),t[3].p.c===void 0&&We(()=>t[19].call(Qe)),r(K,"class","flex"),r(U,"class","my-1"),r(Gt,"class","my-1"),r(Ne,"type","checkbox"),r(Ne,"name","pe"),Ne.__value="true",Ne.value=Ne.__value,r(Ne,"class","rounded mb-1"),r(Ge,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,El.__value=1,El.value=El.__value,Al.__value=2,Al.value=Al.__value,r(pt,"name","gs"),r(pt,"class","in-s"),t[3].g.s===void 0&&We(()=>t[22].call(pt)),r(Fe,"class","my-1"),r(yt,"name","gc"),r(yt,"type","text"),r(yt,"pattern","[A-Za-z0-9]+"),r(yt,"placeholder","[root]"),r(yt,"class","in-s"),r(yt,"maxlength","36"),r(bl,"class","my-1"),r(n,"class","cnt"),r(dn,"class","text-sm"),r(Pl,"href",It("Meter-configuration")),r(Pl,"target","_blank"),r(Pl,"class","float-right"),r(zl,"type","hidden"),r(zl,"name","m"),zl.value="true",r(Gl,"type","hidden"),r(Gl,"name","mo"),Gl.value="1",Vl.__value=0,Vl.value=Vl.__value,Ll.__value=9,Ll.value=Ll.__value,r(ht,"name","ma"),r(ht,"class","in-s"),t[3].m.a===void 0&&We(()=>t[26].call(ht)),r(gl,"class","my-1"),r(vn,"class","float-right"),r(Jt,"name","mi"),Jt.__value="true",Jt.value=Jt.__value,r(Jt,"type","checkbox"),r(Jt,"class","rounded mb-1"),r(ui,"class","mt-2 ml-3 whitespace-nowrap"),Ol.__value=0,Ol.value=Ol.__value,Ol.disabled=Ui=t[3].m.b!=0,r(al,"name","mb"),r(al,"class","in-f tr w-1/2"),t[3].m.b===void 0&&We(()=>t[28].call(al)),Fl.__value=0,Fl.value=Fl.__value,Fl.disabled=ji=t[3].m.b!=0,hn.__value=2,hn.value=hn.__value,bn.__value=3,bn.value=bn.__value,gn.__value=10,gn.value=gn.__value,kn.__value=11,kn.value=kn.__value,r(bt,"name","mp"),r(bt,"class","in-m"),bt.disabled=Hi=t[3].m.b==0,t[3].m.p===void 0&&We(()=>t[29].call(bt)),r(qt,"name","ms"),r(qt,"type","number"),r(qt,"min",64),r(qt,"max",Wi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),r(qt,"step",64),r(qt,"class","in-l tr w-1/2"),r(Il,"class","flex w-full"),r(Vt,"class","my-1"),wn.__value=2,wn.value=wn.__value,yn.__value=1,yn.value=yn.__value,r(ul,"name","md"),r(ul,"class","in-s"),t[3].m.d===void 0&&We(()=>t[31].call(ul)),r(Kl,"class","my-1"),r(xt,"name","mf"),r(xt,"type","number"),r(xt,"min","5"),r(xt,"max","65535"),r(xt,"class","in-f tr w-full"),r(zi,"class","in-post"),r(Sn,"class","flex"),r(Yl,"class","mx-1"),r(el,"name","mr"),r(el,"type","number"),r(el,"min","0"),r(el,"max","65535"),r(el,"class","in-f tr w-full"),r(Gi,"class","in-post"),r(Mn,"class","flex"),r(Ql,"class","mx-1"),r(Cn,"class","my-1 flex"),r(Ms,"class","my-1"),r(tl,"type","checkbox"),r(tl,"name","me"),tl.__value="true",tl.value=tl.__value,r(tl,"class","rounded mb-1"),r(Xl,"class","my-1"),r(ll,"type","checkbox"),r(ll,"name","mm"),ll.__value="true",ll.value=ll.__value,r(ll,"class","rounded mb-1"),r(je,"class","cnt"),r(Yi,"class","text-sm"),r(Tn,"href",It("WiFi-configuration")),r(Tn,"target","_blank"),r(Tn,"class","float-right"),r(fi,"type","hidden"),r(fi,"name","w"),fi.value="true",Nn.__value=1,Nn.value=Nn.__value,En.__value=2,En.value=En.__value,r(Kt,"name","nc"),r(Kt,"class","in-s"),t[3].n.c===void 0&&We(()=>t[42].call(Kt)),r(Zl,"class","my-1"),r(Bt,"class","cnt"),r(Qi,"class","text-sm"),r(An,"href",It("Network-configuration")),r(An,"target","_blank"),r(An,"class","float-right"),Dn.__value="dhcp",Dn.value=Dn.__value,Ln.__value="static",Ln.value=Ln.__value,r(fl,"name","nm"),r(fl,"class","in-f"),t[3].n.m===void 0&&We(()=>t[48].call(fl)),r(Ut,"name","ni"),r(Ut,"type","text"),r(Ut,"class","in-m w-full"),Ut.disabled=Xi=t[3].n.m=="dhcp",Ut.required=Zi=t[3].n.m=="static",r(jt,"name","ns"),r(jt,"class","in-l"),jt.disabled=Ji=t[3].n.m=="dhcp",jt.required=xi=t[3].n.m=="static",t[3].n.s===void 0&&We(()=>t[50].call(jt)),r(ql,"class","flex"),r(Jl,"class","my-1"),r(nl,"name","nd"),nl.__value="true",nl.value=nl.__value,r(nl,"type","checkbox"),r(nl,"class","rounded mb-1"),r(es,"class","my-1"),r(ci,"type","hidden"),r(ci,"name","ntp"),ci.value="true",r(il,"name","ntpd"),il.__value="true",il.value=il.__value,r(il,"type","checkbox"),r(il,"class","rounded mb-1"),r(mi,"class","ml-4"),r(kl,"name","ntph"),r(kl,"type","text"),r(kl,"class","in-s"),r(ls,"class","flex"),r(Bl,"class","my-1"),r(mt,"class","cnt"),r(ns,"class","text-sm"),r(In,"href",It("MQTT-configuration")),r(In,"target","_blank"),r(In,"class","float-right"),r(_i,"type","hidden"),r(_i,"name","q"),_i.value="true",r(wl,"name","qh"),r(wl,"type","text"),r(wl,"class","in-f w-3/4"),r(sl,"name","qp"),r(sl,"type","number"),r(sl,"min","1024"),r(sl,"max","65535"),r(sl,"class","in-l tr w-1/4"),r(Fn,"class","flex"),r(cl,"class","my-1"),r(yl,"name","qu"),r(yl,"type","text"),r(yl,"class","in-s"),r(xl,"class","my-1"),r(Cl,"name","qa"),r(Cl,"type","password"),r(Cl,"class","in-s"),r(en,"class","my-1"),r(Sl,"name","qc"),r(Sl,"type","text"),r(Sl,"class","in-f w-full"),jn.__value=0,jn.value=jn.__value,Hn.__value=1,Hn.value=Hn.__value,Wn.__value=2,Wn.value=Wn.__value,zn.__value=3,zn.value=zn.__value,Gn.__value=4,Gn.value=Gn.__value,Vn.__value=255,Vn.value=Vn.__value,r(St,"name","qm"),r(St,"class","in-l"),t[3].q.m===void 0&&We(()=>t[63].call(St)),r(qn,"class","my-1 flex"),r(Ml,"name","qb"),r(Ml,"type","text"),r(Ml,"class","in-s"),r(tn,"class","my-1"),r(lt,"class","cnt"),r(is,"class","text-sm"),r(Kn,"href",It("User-interface")),r(Kn,"target","_blank"),r(Kn,"class","float-right"),r(pi,"type","hidden"),r(pi,"name","u"),pi.value="true",r(di,"class","flex flex-wrap"),r(ml,"class","cnt"),r(ss,"class","text-sm"),r(Qn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(Qn,"target","_blank"),r(Qn,"class","float-right"),r(vi,"type","hidden"),r(vi,"name","d"),vi.value="true",r(ol,"type","checkbox"),r(ol,"name","ds"),ol.__value="true",ol.value=ol.__value,r(ol,"class","rounded mb-1"),r(os,"class","mt-3"),r(Ht,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(Zn,"type","button"),r(Zn,"class","btn-red"),r(Jn,"type","button"),r(Jn,"class","btn-yellow"),r(as,"class","text-center"),r(us,"class","text-right"),r(Ul,"class","grid grid-cols-3 mt-3"),r(e,"autocomplete","off")},m(q,me){M(q,e,me),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),se(c,u,null),s(n,a),s(n,f),s(n,p),s(n,_),s(_,h),s(h,v),s(v,d),s(v,g),s(v,w),s(v,D),ie(D,t[3].g.h),s(h,T),s(h,E),s(E,F),s(E,I),s(E,O),s(E,C),se(A,C,null),Me(C,t[3].g.t,!0),s(n,le),s(n,H),s(n,z),s(n,U),s(U,K),s(K,Q),s(Q,G),s(Q,X),s(Q,Y),s(Q,j),s(j,x),s(x,ae),s(x,te),s(x,V),s(x,W),s(x,we),s(j,He),s(He,Ie),s(He,Se),s(He,ye),s(He,ve),s(j,$e),s($e,be),s($e,$),s(j,y),s(j,k),s(j,P),s(j,L),s(j,Z),s(j,ne),s(j,fe),s(j,de),s(j,Ce),s(j,Oe),s(j,ue),s(j,Te),s(j,Je),Me(j,t[3].p.r,!0),s(K,Ot),s(K,st),s(st,wt),s(st,nt),s(st,Ft),s(st,Qe);for(let _t=0;_t<5;_t+=1)hi[_t]&&hi[_t].m(Qe,null);Me(Qe,t[3].p.c,!0),s(n,Zt),s(n,Gt),se(vt,Gt,null),s(n,xe),s(n,Ge),s(Ge,Ke),s(Ke,Ne),Ne.checked=t[3].p.e,s(Ke,Ze),s(Ge,et),Mt&&Mt.m(Ge,null),s(n,qe),s(n,Fe),s(Fe,_e),s(Fe,ce),s(Fe,Be),s(Fe,pt),s(pt,Nl),s(pt,El),s(pt,Al),Me(pt,t[3].g.s,!0),s(n,Ai),Tt&&Tt.m(n,null),s(n,ai),s(n,bl),s(bl,Pi),s(bl,Di),s(bl,Li),s(bl,yt),ie(yt,t[3].g.c),s(l,Ri),s(l,je),s(je,dn),s(je,Ii),s(je,Pl),se(Dl,Pl,null),s(je,Oi),s(je,zl),s(je,Fi),s(je,Gl),s(je,qi),s(je,gl),s(gl,Bi),s(gl,Ye),s(gl,Ct),s(gl,ht),s(ht,Vl),s(ht,Ll),Me(ht,t[3].m.a,!0),s(je,Rl),s(je,Vt),s(Vt,vn),s(Vt,No),s(Vt,Ss),s(Vt,Eo),s(Vt,ui),s(ui,Jt),Jt.checked=t[3].m.i,s(ui,Ao),s(Vt,Po),s(Vt,Il),s(Il,al),s(al,Ol),s(Ol,Do);for(let _t=0;_t<7;_t+=1)bi[_t]&&bi[_t].m(al,null);Me(al,t[3].m.b,!0),s(Il,Lo),s(Il,bt),s(bt,Fl),s(Fl,Ro),s(bt,hn),s(bt,bn),s(bt,gn),s(bt,kn),Me(bt,t[3].m.p,!0),s(Il,Io),s(Il,qt),ie(qt,t[3].m.s),s(je,Oo),s(je,Kl),s(Kl,Fo),s(Kl,qo),s(Kl,Bo),s(Kl,ul),s(ul,wn),s(ul,yn),Me(ul,t[3].m.d,!0),s(je,Uo),s(je,Cn),s(Cn,Yl),s(Yl,jo),s(Yl,Ho),s(Yl,Wo),s(Yl,Sn),s(Sn,xt),ie(xt,t[3].m.f),s(Sn,zo),s(Sn,zi),s(Cn,Go),s(Cn,Ql),s(Ql,Vo),s(Ql,Ko),s(Ql,Yo),s(Ql,Mn),s(Mn,el),ie(el,t[3].m.r),s(Mn,Qo),s(Mn,Gi),s(je,Xo),s(je,Ms),s(je,Zo),s(je,Xl),s(Xl,Vi),s(Vi,tl),tl.checked=t[3].m.e.e,s(Vi,Jo),s(Xl,xo),$t&&$t.m(Xl,null),s(je,er),Nt&&Nt.m(je,null),s(je,Ts),s(je,Ki),s(Ki,ll),ll.checked=t[3].m.m.e,s(Ki,tr),s(je,lr),Et&&Et.m(je,null),s(l,nr),s(l,Bt),s(Bt,Yi),s(Bt,ir),s(Bt,Tn),se($n,Tn,null),s(Bt,sr),s(Bt,fi),s(Bt,or),s(Bt,Zl),s(Zl,rr),s(Zl,ar),s(Zl,ur),s(Zl,Kt),s(Kt,Nn),s(Kt,En),Wt&&Wt.m(Kt,null),Me(Kt,t[3].n.c,!0),s(Bt,fr),At&&At.m(Bt,null),s(l,cr),s(l,mt),s(mt,Qi),s(mt,mr),s(mt,An),se(Pn,An,null),s(mt,_r),s(mt,Jl),s(Jl,pr),s(Jl,dr),s(Jl,vr),s(Jl,ql),s(ql,fl),s(fl,Dn),s(fl,Ln),Me(fl,t[3].n.m,!0),s(ql,hr),s(ql,Ut),ie(Ut,t[3].n.i),s(ql,br),s(ql,jt),se(Rn,jt,null),Me(jt,t[3].n.s,!0),s(mt,gr),Pt&&Pt.m(mt,null),s(mt,$s),s(mt,es),s(es,ts),s(ts,nl),nl.checked=t[3].n.d,s(ts,kr),s(mt,wr),s(mt,ci),s(mt,yr),s(mt,Bl),s(Bl,Cr),s(Bl,mi),s(mi,il),il.checked=t[3].n.h,s(mi,Sr),s(Bl,Mr),s(Bl,Tr),s(Bl,ls),s(ls,kl),ie(kl,t[3].n.n1),s(l,$r),s(l,lt),s(lt,ns),s(lt,Nr),s(lt,In),se(On,In,null),s(lt,Er),s(lt,_i),s(lt,Ar),s(lt,cl),s(cl,Pr),Dt&&Dt.m(cl,null),s(cl,Ns),s(cl,Dr),s(cl,Lr),s(cl,Fn),s(Fn,wl),ie(wl,t[3].q.h),s(Fn,Rr),s(Fn,sl),ie(sl,t[3].q.p),s(lt,Ir),ot&&ot.m(lt,null),s(lt,Es),s(lt,xl),s(xl,Or),s(xl,Fr),s(xl,qr),s(xl,yl),ie(yl,t[3].q.u),s(lt,Br),s(lt,en),s(en,Ur),s(en,jr),s(en,Hr),s(en,Cl),ie(Cl,t[3].q.a),s(lt,Wr),s(lt,qn),s(qn,Bn),s(Bn,zr),s(Bn,Gr),s(Bn,Vr),s(Bn,Sl),ie(Sl,t[3].q.c),s(qn,Kr),s(qn,Un),s(Un,Yr),s(Un,Qr),s(Un,Xr),s(Un,St),s(St,jn),s(St,Hn),s(St,Wn),s(St,zn),s(St,Gn),s(St,Vn),Me(St,t[3].q.m,!0),s(lt,Zr),s(lt,tn),s(tn,Jr),s(tn,xr),s(tn,ea),s(tn,Ml),ie(Ml,t[3].q.b),s(l,ta),rt&&rt.m(l,null),s(l,As),at&&at.m(l,null),s(l,Ps),ut&&ut.m(l,null),s(l,Ds),ft&&ft.m(l,null),s(l,Rs),s(l,ml),s(ml,is),s(ml,la),s(ml,Kn),se(Yn,Kn,null),s(ml,na),s(ml,pi),s(ml,ia),s(ml,di);for(let _t=0;_t0?Tt?Tt.p(q,me):(Tt=of(q),Tt.c(),Tt.m(n,ai)):Tt&&(Tt.d(1),Tt=null),me[0]&8&&yt.value!==q[3].g.c&&ie(yt,q[3].g.c),me[0]&8&&Me(ht,q[3].m.a),me[0]&8&&(Jt.checked=q[3].m.i),(!Yt||me[0]&8&&Ui!==(Ui=q[3].m.b!=0))&&(Ol.disabled=Ui),me[0]&8&&Me(al,q[3].m.b),(!Yt||me[0]&8&&ji!==(ji=q[3].m.b!=0))&&(Fl.disabled=ji),(!Yt||me[0]&8&&Hi!==(Hi=q[3].m.b==0))&&(bt.disabled=Hi),me[0]&8&&Me(bt,q[3].m.p),(!Yt||me[0]&9&&Wi!==(Wi=q[0].chip=="esp8266"?q[3].i.h.p==3||q[3].i.h.p==113?512:128:4096))&&r(qt,"max",Wi),me[0]&8&&ge(qt.value)!==q[3].m.s&&ie(qt,q[3].m.s),me[0]&8&&Me(ul,q[3].m.d),me[0]&8&&ge(xt.value)!==q[3].m.f&&ie(xt,q[3].m.f),me[0]&8&&ge(el.value)!==q[3].m.r&&ie(el,q[3].m.r),me[0]&8&&(tl.checked=q[3].m.e.e),q[3].m.e.e?$t?$t.p(q,me):($t=rf(q),$t.c(),$t.m(Xl,null)):$t&&($t.d(1),$t=null),q[3].m.e.e?Nt?Nt.p(q,me):(Nt=af(q),Nt.c(),Nt.m(je,Ts)):Nt&&(Nt.d(1),Nt=null),me[0]&8&&(ll.checked=q[3].m.m.e),q[3].m.m.e?Et?Et.p(q,me):(Et=uf(q),Et.c(),Et.m(je,null)):Et&&(Et.d(1),Et=null),q[0].if&&q[0].if.eth?Wt||(Wt=ff(),Wt.c(),Wt.m(Kt,null)):Wt&&(Wt.d(1),Wt=null),me[0]&8&&Me(Kt,q[3].n.c),q[3].n.c==1||q[3].n.c==2?At?At.p(q,me):(At=cf(q),At.c(),At.m(Bt,null)):At&&(At.d(1),At=null),me[0]&8&&Me(fl,q[3].n.m),(!Yt||me[0]&8&&Xi!==(Xi=q[3].n.m=="dhcp"))&&(Ut.disabled=Xi),(!Yt||me[0]&8&&Zi!==(Zi=q[3].n.m=="static"))&&(Ut.required=Zi),me[0]&8&&Ut.value!==q[3].n.i&&ie(Ut,q[3].n.i),(!Yt||me[0]&8&&Ji!==(Ji=q[3].n.m=="dhcp"))&&(jt.disabled=Ji),(!Yt||me[0]&8&&xi!==(xi=q[3].n.m=="static"))&&(jt.required=xi),me[0]&8&&Me(jt,q[3].n.s),q[3].n.m=="static"?Pt?Pt.p(q,me):(Pt=mf(q),Pt.c(),Pt.m(mt,$s)):Pt&&(Pt.d(1),Pt=null),me[0]&8&&(nl.checked=q[3].n.d),me[0]&8&&(il.checked=q[3].n.h),me[0]&8&&kl.value!==q[3].n.n1&&ie(kl,q[3].n.n1),q[0].chip!="esp8266"?Dt?Dt.p(q,me):(Dt=_f(q),Dt.c(),Dt.m(cl,Ns)):Dt&&(Dt.d(1),Dt=null),me[0]&8&&wl.value!==q[3].q.h&&ie(wl,q[3].q.h),me[0]&8&&ge(sl.value)!==q[3].q.p&&ie(sl,q[3].q.p),q[3].q.s.e?ot?(ot.p(q,me),me[0]&8&&R(ot,1)):(ot=pf(q),ot.c(),R(ot,1),ot.m(lt,Es)):ot&&(Ae(),B(ot,1,1,()=>{ot=null}),Pe()),me[0]&8&&yl.value!==q[3].q.u&&ie(yl,q[3].q.u),me[0]&8&&Cl.value!==q[3].q.a&&ie(Cl,q[3].q.a),me[0]&8&&Sl.value!==q[3].q.c&&ie(Sl,q[3].q.c),me[0]&8&&Me(St,q[3].q.m),me[0]&8&&Ml.value!==q[3].q.b&&ie(Ml,q[3].q.b),q[3].q.m==3?rt?(rt.p(q,me),me[0]&8&&R(rt,1)):(rt=df(q),rt.c(),R(rt,1),rt.m(l,As)):rt&&(Ae(),B(rt,1,1,()=>{rt=null}),Pe()),q[3].q.m==4?at?(at.p(q,me),me[0]&8&&R(at,1)):(at=vf(q),at.c(),R(at,1),at.m(l,Ps)):at&&(Ae(),B(at,1,1,()=>{at=null}),Pe()),q[3].c.es!=null?ut?(ut.p(q,me),me[0]&8&&R(ut,1)):(ut=hf(q),ut.c(),R(ut,1),ut.m(l,Ds)):ut&&(Ae(),B(ut,1,1,()=>{ut=null}),Pe()),me[0]&8&&(Ls=q[3].p.r.startsWith("10YNO")||q[3].p.r.startsWith("10Y1001A1001A4")),Ls?ft?(ft.p(q,me),me[0]&8&&R(ft,1)):(ft=kf(q),ft.c(),R(ft,1),ft.m(l,Rs)):ft&&(Ae(),B(ft,1,1,()=>{ft=null}),Pe()),me[0]&136){xn=q[7];let Qt;for(Qt=0;Qt20||q[0].chip=="esp8266"||q[3].i.d.d>0?ct?(ct.p(q,me),me[0]&9&&R(ct,1)):(ct=Cf(q),ct.c(),R(ct,1),ct.m(l,Is)):ct&&(Ae(),B(ct,1,1,()=>{ct=null}),Pe()),me[0]&8&&(ol.checked=q[3].d.s),q[3].d.s?Lt?Lt.p(q,me):(Lt=Af(q),Lt.c(),Lt.m(Ht,null)):Lt&&(Lt.d(1),Lt=null);const da={};me[0]&2&&(da.active=q[1]),ln.$set(da);const va={};me[0]&4&&(va.active=q[2]),nn.$set(va);const ha={};me[0]&16&&(ha.active=q[4]),sn.$set(ha);const ba={};me[0]&32&&(ba.active=q[5]),on.$set(ba)},i(q){Yt||(R(c.$$.fragment,q),R(A.$$.fragment,q),R(vt.$$.fragment,q),R(Dl.$$.fragment,q),R($n.$$.fragment,q),R(Pn.$$.fragment,q),R(Rn.$$.fragment,q),R(On.$$.fragment,q),R(ot),R(rt),R(at),R(ut),R(ft),R(Yn.$$.fragment,q),R(ct),R(Xn.$$.fragment,q),R(ln.$$.fragment,q),R(nn.$$.fragment,q),R(sn.$$.fragment,q),R(on.$$.fragment,q),Yt=!0)},o(q){B(c.$$.fragment,q),B(A.$$.fragment,q),B(vt.$$.fragment,q),B(Dl.$$.fragment,q),B($n.$$.fragment,q),B(Pn.$$.fragment,q),B(Rn.$$.fragment,q),B(On.$$.fragment,q),B(ot),B(rt),B(at),B(ut),B(ft),B(Yn.$$.fragment,q),B(ct),B(Xn.$$.fragment,q),B(ln.$$.fragment,q),B(nn.$$.fragment,q),B(sn.$$.fragment,q),B(on.$$.fragment,q),Yt=!1},d(q){q&&S(e),oe(c),oe(A),dt(hi,q),oe(vt),Mt&&Mt.d(),Tt&&Tt.d(),oe(Dl),dt(bi,q),$t&&$t.d(),Nt&&Nt.d(),Et&&Et.d(),oe($n),Wt&&Wt.d(),At&&At.d(),oe(Pn),oe(Rn),Pt&&Pt.d(),oe(On),Dt&&Dt.d(),ot&&ot.d(),rt&&rt.d(),at&&at.d(),ut&&ut.d(),ft&&ft.d(),oe(Yn),dt(gt,q),ct&&ct.d(),oe(Xn),Lt&&Lt.d(),q&&S(Fs),oe(ln,q),q&&S(qs),oe(nn,q),q&&S(Bs),oe(sn,q),q&&S(Us),oe(on,q),js=!1,ze(pa)}}}async function q_(){await(await fetch("reboot",{method:"POST"})).json()}function B_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],u=!0,c=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},d:{d:null,b:0},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{e:!1,i:null,s:null,es:null}};wi.subscribe(Ye=>{Ye.version&&(l(3,a=Ye),l(1,u=!1))}),l_();let f=!1,p=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,f=!0);const Ye=new URLSearchParams;Ye.append("perform","true");let ht=await(await fetch("reset",{method:"POST",body:Ye})).json();l(4,f=!1),l(5,p=ht.success)}}async function h(Ye){l(2,c=!0);const Ct=new FormData(Ye.target),ht=new URLSearchParams;for(let Rl of Ct){const[Vt,vn]=Rl;ht.append(Vt,vn)}let Ll=await(await fetch("save",{method:"POST",body:ht})).json();zt.update(Rl=>(Rl.booting=Ll.reboot,Rl.ui=a.u,Rl)),l(2,c=!1),mn(n)}const v=function(){confirm("Are you sure you want to reboot the device?")&&(zt.update(Ye=>(Ye.booting=!0,Ye)),q_())};async function d(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),wi.update(Ct=>(Ct.q.s.c=!1,Ct)))}async function g(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),wi.update(Ct=>(Ct.q.s.r=!1,Ct)))}async function w(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),wi.update(Ct=>(Ct.q.s.k=!1,Ct)))}const D=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let T=44;function E(){a.g.h=this.value,l(3,a)}function F(){a.g.t=tt(this),l(3,a)}function I(){a.p.r=tt(this),l(3,a)}function O(){a.p.c=tt(this),l(3,a)}function C(){a.p.e=this.checked,l(3,a)}function A(){a.p.t=this.value,l(3,a)}function le(){a.g.s=tt(this),l(3,a)}function H(){a.g.u=this.value,l(3,a)}function z(){a.g.p=this.value,l(3,a)}function U(){a.g.c=this.value,l(3,a)}function K(){a.m.a=tt(this),l(3,a)}function Q(){a.m.i=this.checked,l(3,a)}function G(){a.m.b=tt(this),l(3,a)}function X(){a.m.p=tt(this),l(3,a)}function Y(){a.m.s=ge(this.value),l(3,a)}function j(){a.m.d=tt(this),l(3,a)}function x(){a.m.f=ge(this.value),l(3,a)}function ae(){a.m.r=ge(this.value),l(3,a)}function te(){a.m.e.e=this.checked,l(3,a)}function V(){a.m.e.k=this.value,l(3,a)}function W(){a.m.e.a=this.value,l(3,a)}function we(){a.m.m.e=this.checked,l(3,a)}function He(){a.m.m.w=ge(this.value),l(3,a)}function Ie(){a.m.m.v=ge(this.value),l(3,a)}function Se(){a.m.m.a=ge(this.value),l(3,a)}function ye(){a.m.m.c=ge(this.value),l(3,a)}function ve(){a.n.c=tt(this),l(3,a)}function $e(){a.w.s=this.value,l(3,a)}function be(){a.w.p=this.value,l(3,a)}function $(){a.w.z=tt(this),l(3,a)}function y(){a.w.w=ge(this.value),l(3,a)}function k(){a.w.b=this.checked,l(3,a)}function P(){a.n.m=tt(this),l(3,a)}function L(){a.n.i=this.value,l(3,a)}function Z(){a.n.s=tt(this),l(3,a)}function ne(){a.n.g=this.value,l(3,a)}function fe(){a.n.d1=this.value,l(3,a)}function de(){a.n.d2=this.value,l(3,a)}function Ce(){a.n.d=this.checked,l(3,a)}function Oe(){a.n.h=this.checked,l(3,a)}function ue(){a.n.n1=this.value,l(3,a)}function Te(){a.q.s.e=this.checked,l(3,a)}function Je(){a.q.h=this.value,l(3,a)}function Ot(){a.q.p=ge(this.value),l(3,a)}function st(){a.q.u=this.value,l(3,a)}function wt(){a.q.a=this.value,l(3,a)}function nt(){a.q.c=this.value,l(3,a)}function Ft(){a.q.m=tt(this),l(3,a)}function Qe(){a.q.b=this.value,l(3,a)}function Zt(){a.o.e=this.value,l(3,a)}function Gt(){a.o.c=this.value,l(3,a)}function vt(){a.o.u1=this.value,l(3,a)}function xe(){a.o.u2=this.value,l(3,a)}function Ge(){a.o.u3=this.value,l(3,a)}function Ke(){a.h.t=this.value,l(3,a)}function Ne(){a.h.h=this.value,l(3,a)}function Ze(){a.h.n=this.value,l(3,a)}function et(){a.c.e=this.checked,l(3,a)}function qe(){a.c.i=this.value,l(3,a)}function Fe(){a.c.s=this.value,l(3,a)}function _e(){a.c.es=this.checked,l(3,a)}function ce(Ye){a.t.t[Ye]=ge(this.value),l(3,a)}function Be(){a.t.h=ge(this.value),l(3,a)}function pt(Ye){a.u[Ye.key]=tt(this),l(3,a)}function Nl(){a.i.h.p=tt(this),l(3,a)}function El(){a.i.h.t=tt(this),l(3,a)}function Al(){a.i.h.u=this.checked,l(3,a)}function Ai(){a.i.a=ge(this.value),l(3,a)}function ai(){a.i.l.p=ge(this.value),l(3,a)}function bl(){a.i.l.i=this.checked,l(3,a)}function Pi(){a.i.r.i=this.checked,l(3,a)}function Di(){a.i.r.r=ge(this.value),l(3,a)}function Li(){a.i.r.g=ge(this.value),l(3,a)}function yt(){a.i.r.b=ge(this.value),l(3,a)}function Ri(){a.i.d.d=ge(this.value),l(3,a)}function je(){a.i.t.d=ge(this.value),l(3,a)}function dn(){a.i.t.a=ge(this.value),l(3,a)}function Ii(){a.i.v.p=ge(this.value),l(3,a)}function Pl(){a.i.v.d.v=ge(this.value),l(3,a)}function Dl(){a.i.v.d.g=ge(this.value),l(3,a)}function Oi(){a.i.d.b=tt(this),l(3,a)}function zl(){a.i.v.o=ge(this.value),l(3,a)}function Fi(){a.i.v.m=ge(this.value),l(3,a)}function Gl(){a.i.v.b=ge(this.value),l(3,a)}function qi(){a.d.s=this.checked,l(3,a)}function gl(){a.d.t=this.checked,l(3,a)}function Bi(){a.d.l=tt(this),l(3,a)}return t.$$set=Ye=>{"basepath"in Ye&&l(15,n=Ye.basepath),"sysinfo"in Ye&&l(0,i=Ye.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,T=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,u,c,a,f,p,T,o,_,h,v,d,g,w,D,n,E,F,I,O,C,A,le,H,z,U,K,Q,G,X,Y,j,x,ae,te,V,W,we,He,Ie,Se,ye,ve,$e,be,$,y,k,P,L,Z,ne,fe,de,Ce,Oe,ue,Te,Je,Ot,st,wt,nt,Ft,Qe,Zt,Gt,vt,xe,Ge,Ke,Ne,Ze,et,qe,Fe,_e,ce,Be,pt,Nl,El,Al,Ai,ai,bl,Pi,Di,Li,yt,Ri,je,dn,Ii,Pl,Dl,Oi,zl,Fi,Gl,qi,gl,Bi]}class U_ extends Re{constructor(e){super(),Le(this,e,B_,F_,Ee,{basepath:15,sysinfo:0},null,[-1,-1,-1,-1])}}function Df(t,e,l){const n=t.slice();return n[20]=e[l],n}function j_(t){let e=he(t[1].chip,t[1].board)+"",l;return{c(){l=N(e)},m(n,i){M(n,l,i)},p(n,i){i&2&&e!==(e=he(n[1].chip,n[1].board)+"")&&J(l,e)},d(n){n&&S(l)}}}function Lf(t){let e,l,n=t[1].apmac+"",i,o,u,c,a,f,p,_,h,v=Fa(t[1])+"",d,g,w=t[1].boot_reason+"",D,T,E=t[1].ex_cause+"",F,I,O;const C=[W_,H_],A=[];function le(H,z){return H[0].u>0?0:1}return a=le(t),f=A[a]=C[a](t),{c(){e=m("div"),l=N("AP MAC: "),i=N(n),o=b(),u=m("div"),c=N(`Last boot:
+ `),f.c(),p=b(),_=m("div"),h=N("Reason: "),d=N(v),g=N(" ("),D=N(w),T=N("/"),F=N(E),I=N(")"),r(e,"class","my-2"),r(u,"class","my-2"),r(_,"class","my-2")},m(H,z){M(H,e,z),s(e,l),s(e,i),M(H,o,z),M(H,u,z),s(u,c),A[a].m(u,null),M(H,p,z),M(H,_,z),s(_,h),s(_,d),s(_,g),s(_,D),s(_,T),s(_,F),s(_,I),O=!0},p(H,z){(!O||z&2)&&n!==(n=H[1].apmac+"")&&J(i,n);let U=a;a=le(H),a===U?A[a].p(H,z):(Ae(),B(A[U],1,1,()=>{A[U]=null}),Pe(),f=A[a],f?f.p(H,z):(f=A[a]=C[a](H),f.c()),R(f,1),f.m(u,null)),(!O||z&2)&&v!==(v=Fa(H[1])+"")&&J(d,v),(!O||z&2)&&w!==(w=H[1].boot_reason+"")&&J(D,w),(!O||z&2)&&E!==(E=H[1].ex_cause+"")&&J(F,E)},i(H){O||(R(f),O=!0)},o(H){B(f),O=!1},d(H){H&&S(e),H&&S(o),H&&S(u),A[a].d(),H&&S(p),H&&S(_)}}}function H_(t){let e;return{c(){e=N("-")},m(l,n){M(l,e,n)},p:pe,i:pe,o:pe,d(l){l&&S(e)}}}function W_(t){let e,l;return e=new i1({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function z_(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){M(l,e,n)},p:pe,d(l){l&&S(e)}}}function Rf(t){let e,l,n,i,o,u=ks(t[1].meter.mfg)+"",c,a,f,p,_=(t[1].meter.model?t[1].meter.model:"unknown")+"",h,v,d,g,w=(t[1].meter.id?t[1].meter.id:"unknown")+"",D;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=b(),i=m("div"),o=N("Manufacturer: "),c=N(u),a=b(),f=m("div"),p=N("Model: "),h=N(_),v=b(),d=m("div"),g=N("ID: "),D=N(w),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(e,"class","cnt")},m(T,E){M(T,e,E),s(e,l),s(e,n),s(e,i),s(i,o),s(i,c),s(e,a),s(e,f),s(f,p),s(f,h),s(e,v),s(e,d),s(d,g),s(d,D)},p(T,E){E&2&&u!==(u=ks(T[1].meter.mfg)+"")&&J(c,u),E&2&&_!==(_=(T[1].meter.model?T[1].meter.model:"unknown")+"")&&J(h,_),E&2&&w!==(w=(T[1].meter.id?T[1].meter.id:"unknown")+"")&&J(D,w)},d(T){T&&S(e)}}}function If(t){let e,l,n,i,o,u=t[1].net.ip+"",c,a,f,p,_=t[1].net.mask+"",h,v,d,g,w=t[1].net.gw+"",D,T,E,F,I=t[1].net.dns1+"",O,C,A=t[1].net.dns2&&Of(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=b(),i=m("div"),o=N("IP: "),c=N(u),a=b(),f=m("div"),p=N("Mask: "),h=N(_),v=b(),d=m("div"),g=N("Gateway: "),D=N(w),T=b(),E=m("div"),F=N("DNS: "),O=N(I),C=b(),A&&A.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(E,"class","my-2"),r(e,"class","cnt")},m(le,H){M(le,e,H),s(e,l),s(e,n),s(e,i),s(i,o),s(i,c),s(e,a),s(e,f),s(f,p),s(f,h),s(e,v),s(e,d),s(d,g),s(d,D),s(e,T),s(e,E),s(E,F),s(E,O),s(E,C),A&&A.m(E,null)},p(le,H){H&2&&u!==(u=le[1].net.ip+"")&&J(c,u),H&2&&_!==(_=le[1].net.mask+"")&&J(h,_),H&2&&w!==(w=le[1].net.gw+"")&&J(D,w),H&2&&I!==(I=le[1].net.dns1+"")&&J(O,I),le[1].net.dns2?A?A.p(le,H):(A=Of(le),A.c(),A.m(E,null)):A&&(A.d(1),A=null)},d(le){le&&S(e),A&&A.d()}}}function Of(t){let e,l=t[1].net.dns2+"",n;return{c(){e=N("/ "),n=N(l)},m(i,o){M(i,e,o),M(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&J(n,l)},d(i){i&&S(e),i&&S(n)}}}function Ff(t){let e,l,n,i=t[1].upgrade.f+"",o,u,c=t[1].upgrade.t+"",a,f,p=Oa(t[1].upgrade.e)+"",_;return{c(){e=m("div"),l=m("div"),n=N("Previous upgrade attempt from "),o=N(i),u=N(" to "),a=N(c),f=N(" failed. "),_=N(p),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(h,v){M(h,e,v),s(e,l),s(l,n),s(l,o),s(l,u),s(l,a),s(l,f),s(l,_)},p(h,v){v&2&&i!==(i=h[1].upgrade.f+"")&&J(o,i),v&2&&c!==(c=h[1].upgrade.t+"")&&J(a,c),v&2&&p!==(p=Oa(h[1].upgrade.e)+"")&&J(_,p)},d(h){h&&S(e)}}}function qf(t){let e,l,n,i=t[2].tag_name+"",o,u,c,a,f,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Bf(t),h=t[1].fwconsent===2&&Uf();return{c(){e=m("div"),l=N(`Latest version:
+ `),n=m("a"),o=N(i),c=b(),_&&_.c(),a=b(),h&&h.c(),f=Ve(),r(n,"href",u=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(n,o),s(e,c),_&&_.m(e,null),M(v,a,d),h&&h.m(v,d),M(v,f,d),p=!0},p(v,d){(!p||d&4)&&i!==(i=v[2].tag_name+"")&&J(o,i),(!p||d&4&&u!==(u=v[2].html_url))&&r(n,"href",u),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[2]&&v[2].tag_name!=v[1].version?_?(_.p(v,d),d&7&&R(_,1)):(_=Bf(v),_.c(),R(_,1),_.m(e,null)):_&&(Ae(),B(_,1,1,()=>{_=null}),Pe()),v[1].fwconsent===2?h||(h=Uf(),h.c(),h.m(f.parentNode,f)):h&&(h.d(1),h=null)},i(v){p||(R(_),p=!0)},o(v){B(_),p=!1},d(v){v&&S(e),_&&_.d(),v&&S(a),h&&h.d(v),v&&S(f)}}}function Bf(t){let e,l,n,i,o,u;return n=new s1({}),{c(){e=m("div"),l=m("button"),re(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(c,a){M(c,e,a),s(e,l),se(n,l,null),i=!0,o||(u=ee(l,"click",t[10]),o=!0)},p:pe,i(c){i||(R(n.$$.fragment,c),i=!0)},o(c){B(n.$$.fragment,c),i=!1},d(c){c&&S(e),oe(n),o=!1,u()}}}function Uf(t){let e;return{c(){e=m("div"),e.innerHTML='You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',r(e,"class","my-2")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function jf(t){let e,l=ws(he(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=ws(he(i[1].chip,i[1].board))+"")&&J(n,l)},d(i){i&&S(e)}}}function Hf(t){let e,l,n,i,o,u;function c(p,_){return p[4].length==0?V_:G_}let a=c(t),f=a(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=b(),f.c(),vo(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(p,_){M(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(u=[ee(n,"change",t[13]),ee(l,"submit",t[15])],o=!0)},p(p,_){a===(a=c(p))&&f?f.p(p,_):(f.d(1),f=a(p),f&&(f.c(),f.m(l,null)))},d(p){p&&S(e),t[12](null),f.d(),o=!1,ze(u)}}}function G_(t){let e=t[4][0].name+"",l,n,i;return{c(){l=N(e),n=b(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,u){M(o,l,u),M(o,n,u),M(o,i,u)},p(o,u){u&16&&e!==(e=o[4][0].name+"")&&J(l,e)},d(o){o&&S(l),o&&S(n),o&&S(i)}}}function V_(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){M(i,e,o),l||(n=ee(e,"click",t[14]),l=!0)},p:pe,d(i){i&&S(e),l=!1,n()}}}function Wf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g=t[9],w=[];for(let I=0;I Include Secrets
(SSID, PSK, passwords and tokens)',a=b(),D&&D.c(),f=b(),p=m("form"),_=m("input"),h=b(),F.c(),r(l,"class","text-sm"),r(c,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),vo(_,"display","none"),r(_,"name","file"),r(_,"type","file"),r(_,"accept",".cfg"),r(p,"action","/configfile"),r(p,"enctype","multipart/form-data"),r(p,"method","post"),r(p,"autocomplete","off"),r(e,"class","cnt")},m(I,O){M(I,e,O),s(e,l),s(e,n),s(e,i),s(i,o);for(let C=0;C{P=null}),Pe());const Ot={};Te&8388608&&(Ot.$$scope={dirty:Te,ctx:ue}),le.$set(Ot),ue[1].meter?L?L.p(ue,Te):(L=Rf(ue),L.c(),L.m(e,K)):L&&(L.d(1),L=null),ue[1].net?Z?Z.p(ue,Te):(Z=If(ue),Z.c(),Z.m(e,Q)):Z&&(Z.d(1),Z=null),(!$||Te&2)&&ae!==(ae=ue[1].version+"")&&J(te,ae),ue[1].upgrade.t&&ue[1].upgrade.t!=ue[1].version?ne?ne.p(ue,Te):(ne=Ff(ue),ne.c(),ne.m(G,W)):ne&&(ne.d(1),ne=null),ue[2]?fe?(fe.p(ue,Te),Te&4&&R(fe,1)):(fe=qf(ue),fe.c(),R(fe,1),fe.m(G,we)):fe&&(Ae(),B(fe,1,1,()=>{fe=null}),Pe()),Te&3&&(He=(ue[1].security==0||ue[0].a)&&ii(ue[1].board)),He?de?de.p(ue,Te):(de=jf(ue),de.c(),de.m(G,Ie)):de&&(de.d(1),de=null),ue[1].security==0||ue[0].a?Ce?Ce.p(ue,Te):(Ce=Hf(ue),Ce.c(),Ce.m(G,null)):Ce&&(Ce.d(1),Ce=null),ue[1].security==0||ue[0].a?Oe?Oe.p(ue,Te):(Oe=Wf(ue),Oe.c(),Oe.m(e,null)):Oe&&(Oe.d(1),Oe=null);const st={};Te&32&&(st.active=ue[5]),ve.$set(st);const wt={};Te&256&&(wt.active=ue[8]),be.$set(wt)},i(ue){$||(R(w.$$.fragment,ue),R(P),R(le.$$.fragment,ue),R(fe),R(ve.$$.fragment,ue),R(be.$$.fragment,ue),$=!0)},o(ue){B(w.$$.fragment,ue),B(P),B(le.$$.fragment,ue),B(fe),B(ve.$$.fragment,ue),B(be.$$.fragment,ue),$=!1},d(ue){ue&&S(e),oe(w),P&&P.d(),oe(le),L&&L.d(),Z&&Z.d(),ne&&ne.d(),fe&&fe.d(),de&&de.d(),Ce&&Ce.d(),Oe&&Oe.d(),ue&&S(ye),oe(ve,ue),ue&&S($e),oe(be,ue),y=!1,k()}}}async function X_(){await(await fetch("reboot",{method:"POST"})).json()}function Z_(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],u={};To.subscribe(C=>{l(2,u=n1(i.version,C)),u||l(2,u=C[0])});function c(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(ws(he(i.chip,i.board))))&&(zt.update(C=>(C.upgrading=!0,C)),l1(u.tag_name))}const a=function(){confirm("Are you sure you want to reboot the device?")&&(zt.update(C=>(C.booting=!0,C)),X_())};let f,p=[],_=!1,h,v=[],d=!1;yo();function g(C){bs[C?"unshift":"push"](()=>{f=C,l(3,f)})}function w(){p=this.files,l(4,p)}const D=()=>{f.click()},T=()=>l(5,_=!0);function E(C){bs[C?"unshift":"push"](()=>{h=C,l(6,h)})}function F(){v=this.files,l(7,v)}const I=()=>{h.click()},O=()=>l(8,d=!0);return t.$$set=C=>{"data"in C&&l(0,n=C.data),"sysinfo"in C&&l(1,i=C.sysinfo)},[n,i,u,f,p,_,h,v,d,o,c,a,g,w,D,T,E,F,I,O]}class J_ extends Re{constructor(e){super(),Le(this,e,Z_,Q_,Ee,{data:0,sysinfo:1})}}function Vf(t){let e,l,n=he(t[0],7)+"",i,o,u=he(t[0],5)+"",c,a,f=he(t[0],4)+"",p,_,h=he(t[0],3)+"",v,d,g,w,D=he(t[0],2)+"",T,E,F=he(t[0],1)+"",I,O,C=he(t[0],0)+"",A,le,H,z,U=he(t[0],101)+"",K,Q,G=he(t[0],100)+"",X;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),c=N(u),a=m("option"),p=N(f),_=m("option"),v=N(h),d=b(),g=m("optgroup"),w=m("option"),T=N(D),E=m("option"),I=N(F),O=m("option"),A=N(C),le=b(),H=m("optgroup"),z=m("option"),K=N(U),Q=m("option"),X=N(G),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,a.__value=4,a.value=a.__value,_.__value=3,_.value=_.__value,r(e,"label","amsleser.no"),w.__value=2,w.value=w.__value,E.__value=1,E.value=E.__value,O.__value=0,O.value=O.__value,r(g,"label","Custom hardware"),z.__value=101,z.value=z.__value,Q.__value=100,Q.value=Q.__value,r(H,"label","Generic hardware")},m(Y,j){M(Y,e,j),s(e,l),s(l,i),s(e,o),s(o,c),s(e,a),s(a,p),s(e,_),s(_,v),M(Y,d,j),M(Y,g,j),s(g,w),s(w,T),s(g,E),s(E,I),s(g,O),s(O,A),M(Y,le,j),M(Y,H,j),s(H,z),s(z,K),s(H,Q),s(Q,X)},p(Y,j){j&1&&n!==(n=he(Y[0],7)+"")&&J(i,n),j&1&&u!==(u=he(Y[0],5)+"")&&J(c,u),j&1&&f!==(f=he(Y[0],4)+"")&&J(p,f),j&1&&h!==(h=he(Y[0],3)+"")&&J(v,h),j&1&&D!==(D=he(Y[0],2)+"")&&J(T,D),j&1&&F!==(F=he(Y[0],1)+"")&&J(I,F),j&1&&C!==(C=he(Y[0],0)+"")&&J(A,C),j&1&&U!==(U=he(Y[0],101)+"")&&J(K,U),j&1&&G!==(G=he(Y[0],100)+"")&&J(X,G)},d(Y){Y&&S(e),Y&&S(d),Y&&S(g),Y&&S(le),Y&&S(H)}}}function Kf(t){let e,l,n=he(t[0],201)+"",i,o,u=he(t[0],202)+"",c,a,f=he(t[0],203)+"",p,_,h=he(t[0],241)+"",v,d,g=he(t[0],242)+"",w,D,T=he(t[0],243)+"",E,F,I=he(t[0],200)+"",O;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),c=N(u),a=m("option"),p=N(f),_=m("option"),v=N(h),d=m("option"),w=N(g),D=m("option"),E=N(T),F=m("option"),O=N(I),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,a.__value=203,a.value=a.__value,_.__value=241,_.value=_.__value,d.__value=242,d.value=d.__value,D.__value=243,D.value=D.__value,F.__value=200,F.value=F.__value,r(e,"label","Generic hardware")},m(C,A){M(C,e,A),s(e,l),s(l,i),s(e,o),s(o,c),s(e,a),s(a,p),s(e,_),s(_,v),s(e,d),s(d,w),s(e,D),s(D,E),s(e,F),s(F,O)},p(C,A){A&1&&n!==(n=he(C[0],201)+"")&&J(i,n),A&1&&u!==(u=he(C[0],202)+"")&&J(c,u),A&1&&f!==(f=he(C[0],203)+"")&&J(p,f),A&1&&h!==(h=he(C[0],241)+"")&&J(v,h),A&1&&g!==(g=he(C[0],242)+"")&&J(w,g),A&1&&T!==(T=he(C[0],243)+"")&&J(E,T),A&1&&I!==(I=he(C[0],200)+"")&&J(O,I)},d(C){C&&S(e)}}}function Yf(t){let e,l,n=he(t[0],7)+"",i,o,u=he(t[0],6)+"",c,a,f=he(t[0],5)+"",p,_,h,v,d=he(t[0],51)+"",g,w,D=he(t[0],50)+"",T;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),c=N(u),a=m("option"),p=N(f),_=b(),h=m("optgroup"),v=m("option"),g=N(d),w=m("option"),T=N(D),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,a.__value=5,a.value=a.__value,r(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,w.__value=50,w.value=w.__value,r(h,"label","Generic hardware")},m(E,F){M(E,e,F),s(e,l),s(l,i),s(e,o),s(o,c),s(e,a),s(a,p),M(E,_,F),M(E,h,F),s(h,v),s(v,g),s(h,w),s(w,T)},p(E,F){F&1&&n!==(n=he(E[0],7)+"")&&J(i,n),F&1&&u!==(u=he(E[0],6)+"")&&J(c,u),F&1&&f!==(f=he(E[0],5)+"")&&J(p,f),F&1&&d!==(d=he(E[0],51)+"")&&J(g,d),F&1&&D!==(D=he(E[0],50)+"")&&J(T,D)},d(E){E&&S(e),E&&S(_),E&&S(h)}}}function Qf(t){let e,l,n=he(t[0],8)+"",i,o,u,c,a=he(t[0],71)+"",f,p,_=he(t[0],70)+"",h;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=b(),u=m("optgroup"),c=m("option"),f=N(a),p=m("option"),h=N(_),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),c.__value=71,c.value=c.__value,p.__value=70,p.value=p.__value,r(u,"label","Generic hardware")},m(v,d){M(v,e,d),s(e,l),s(l,i),M(v,o,d),M(v,u,d),s(u,c),s(c,f),s(u,p),s(p,h)},p(v,d){d&1&&n!==(n=he(v[0],8)+"")&&J(i,n),d&1&&a!==(a=he(v[0],71)+"")&&J(f,a),d&1&&_!==(_=he(v[0],70)+"")&&J(h,_)},d(v){v&&S(e),v&&S(o),v&&S(u)}}}function Xf(t){let e,l,n=he(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=N(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=he(o[0],200)+"")&&J(i,n)},d(o){o&&S(e)}}}function Zf(t){let e,l,n=he(t[0],80)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=N(n),l.__value=80,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=he(o[0],80)+"")&&J(i,n)},d(o){o&&S(e)}}}function x_(t){let e,l,n,i,o,u,c,a,f=t[0]=="esp8266"&&Vf(t),p=t[0]=="esp32"&&Kf(t),_=t[0]=="esp32s2"&&Yf(t),h=t[0]=="esp32c3"&&Qf(t),v=t[0]=="esp32solo"&&Xf(t),d=t[0]=="esp32s3"&&Zf(t);return{c(){e=m("option"),l=b(),f&&f.c(),n=b(),p&&p.c(),i=b(),_&&_.c(),o=b(),h&&h.c(),u=b(),v&&v.c(),c=b(),d&&d.c(),a=Ve(),e.__value=-1,e.value=e.__value},m(g,w){M(g,e,w),M(g,l,w),f&&f.m(g,w),M(g,n,w),p&&p.m(g,w),M(g,i,w),_&&_.m(g,w),M(g,o,w),h&&h.m(g,w),M(g,u,w),v&&v.m(g,w),M(g,c,w),d&&d.m(g,w),M(g,a,w)},p(g,[w]){g[0]=="esp8266"?f?f.p(g,w):(f=Vf(g),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),g[0]=="esp32"?p?p.p(g,w):(p=Kf(g),p.c(),p.m(i.parentNode,i)):p&&(p.d(1),p=null),g[0]=="esp32s2"?_?_.p(g,w):(_=Yf(g),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),g[0]=="esp32c3"?h?h.p(g,w):(h=Qf(g),h.c(),h.m(u.parentNode,u)):h&&(h.d(1),h=null),g[0]=="esp32solo"?v?v.p(g,w):(v=Xf(g),v.c(),v.m(c.parentNode,c)):v&&(v.d(1),v=null),g[0]=="esp32s3"?d?d.p(g,w):(d=Zf(g),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null)},i:pe,o:pe,d(g){g&&S(e),g&&S(l),f&&f.d(g),g&&S(n),p&&p.d(g),g&&S(i),_&&_.d(g),g&&S(o),h&&h.d(g),g&&S(u),v&&v.d(g),g&&S(c),d&&d.d(g),g&&S(a)}}}function ep(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class tp extends Re{constructor(e){super(),Le(this,e,ep,x_,Ee,{chip:0})}}function Jf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function xf(t){let e,l,n,i,o,u,c;return u=new ao({props:{chip:t[0].chip}}),{c(){e=m("div"),l=N("HAN GPIO"),n=m("br"),i=b(),o=m("select"),re(u.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),se(u,o,null),c=!0},p(a,f){const p={};f&1&&(p.chip=a[0].chip),u.$set(p)},i(a){c||(R(u.$$.fragment,a),c=!0)},o(a){B(u.$$.fragment,a),c=!1},d(a){a&&S(e),oe(u)}}}function lp(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q=t[0].usrcfg&&Jf();d=new tp({props:{chip:t[0].chip}});let G=t[0].board&&t[0].board>20&&xf(t);return H=new kt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),u=m("strong"),u.textContent="Initial configuration",c=b(),Q&&Q.c(),a=b(),f=m("div"),p=N("Board type"),_=m("br"),h=b(),v=m("select"),re(d.$$.fragment),g=b(),G&&G.c(),w=b(),D=m("div"),T=m("label"),E=m("input"),F=N(" Clear all other configuration"),I=b(),O=m("div"),O.innerHTML='',C=b(),A=m("span"),A.textContent="\xA0",le=b(),re(H.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(u,"class","text-sm"),r(v,"name","vb"),r(v,"class","in-s"),t[0].board===void 0&&We(()=>t[5].call(v)),r(f,"class","my-3"),r(E,"type","checkbox"),r(E,"name","vr"),E.__value="true",E.value=E.__value,r(E,"class","rounded mb-1"),r(D,"class","my-3"),r(O,"class","my-3"),r(A,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(X,Y){M(X,e,Y),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,c),Q&&Q.m(n,null),s(n,a),s(n,f),s(f,p),s(f,_),s(f,h),s(f,v),se(d,v,null),Me(v,t[0].board,!0),s(n,g),G&&G.m(n,null),s(n,w),s(n,D),s(D,T),s(T,E),E.checked=t[2],s(T,F),s(n,I),s(n,O),s(n,C),s(n,A),M(X,le,Y),se(H,X,Y),z=!0,U||(K=[ee(v,"change",t[5]),ee(E,"change",t[6]),ee(n,"submit",Mi(t[3]))],U=!0)},p(X,[Y]){X[0].usrcfg?Q||(Q=Jf(),Q.c(),Q.m(n,a)):Q&&(Q.d(1),Q=null);const j={};Y&1&&(j.chip=X[0].chip),d.$set(j),Y&1&&Me(v,X[0].board),X[0].board&&X[0].board>20?G?(G.p(X,Y),Y&1&&R(G,1)):(G=xf(X),G.c(),R(G,1),G.m(n,w)):G&&(Ae(),B(G,1,1,()=>{G=null}),Pe()),Y&4&&(E.checked=X[2]);const x={};Y&2&&(x.active=X[1]),H.$set(x)},i(X){z||(R(d.$$.fragment,X),R(G),R(H.$$.fragment,X),z=!0)},o(X){B(d.$$.fragment,X),B(G),B(H.$$.fragment,X),z=!1},d(X){X&&S(e),Q&&Q.d(),oe(d),G&&G.d(),X&&S(le),oe(H,X),U=!1,ze(K)}}}function np(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(p){l(1,o=!0);const _=new FormData(p.target),h=new URLSearchParams;for(let g of _){const[w,D]=g;h.append(w,D)}let d=await(await fetch("save",{method:"POST",body:h})).json();l(1,o=!1),zt.update(g=>(g.vndcfg=d.success,g.booting=d.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),mn(n+(i.usrcfg?"/":"/setup"))}let c=!1;zt.subscribe(p=>{l(0,i=p),p.fwconsent===1&&l(2,c=!i.usrcfg)});function a(){i.board=tt(this),l(0,i)}function f(){c=this.checked,l(2,c)}return t.$$set=p=>{"basepath"in p&&l(4,n=p.basepath),"sysinfo"in p&&l(0,i=p.sysinfo)},[i,o,c,u,n,a,f]}class ip extends Re{constructor(e){super(),Le(this,e,np,lp,Ee,{basepath:4,sysinfo:0})}}function ec(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function tc(t){let e,l,n,i,o,u,c,a,f,p,_,h,v;return{c(){e=m("div"),l=N("SSID"),n=m("br"),i=b(),o=m("input"),c=b(),a=m("div"),f=N("PSK"),p=m("br"),_=b(),h=m("input"),r(o,"name","ss"),r(o,"type","text"),r(o,"class","in-s"),o.required=u=t[2]==1||t[2]==2,r(e,"class","my-3"),r(h,"name","sp"),r(h,"type","password"),r(h,"class","in-s"),r(h,"autocomplete","off"),h.required=v=t[2]==2,r(a,"class","my-3")},m(d,g){M(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),M(d,c,g),M(d,a,g),s(a,f),s(a,p),s(a,_),s(a,h)},p(d,g){g&4&&u!==(u=d[2]==1||d[2]==2)&&(o.required=u),g&4&&v!==(v=d[2]==2)&&(h.required=v)},d(d){d&&S(e),d&&S(c),d&&S(a)}}}function lc(t){let e,l,n,i,o,u,c,a;return c=new a1({}),{c(){e=m("br"),l=b(),n=m("div"),i=m("input"),o=b(),u=m("select"),re(c.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(u,"name","su"),r(u,"class","in-l"),u.required=t[1],r(n,"class","flex")},m(f,p){M(f,e,p),M(f,l,p),M(f,n,p),s(n,i),s(n,o),s(n,u),se(c,u,null),a=!0},p(f,p){(!a||p&2)&&(i.required=f[1]),(!a||p&2)&&(u.required=f[1])},i(f){a||(R(c.$$.fragment,f),a=!0)},o(f){B(c.$$.fragment,f),a=!1},d(f){f&&S(e),f&&S(l),f&&S(n),oe(c)}}}function nc(t){let e;return{c(){e=m("div"),e.innerHTML=`Gateway
DNS
-
`,r(e,"class","my-3 flex")},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function x_(t){let e,l,n,i,o,u,a,m,f,p,_,h,v,d,g,w,D,M,E,R,O,F,y,P,ne,H,z,U,K,Q,G,X,Y,j=t[0].if&&t[0].if.eth&&Kf(),x=(t[2]==1||t[2]==2)&&Yf(t),ae=t[1]&&Qf(t),ee=t[1]&&Xf();return Q=new kt({props:{active:t[3],message:"Saving your configuration to the device"}}),{c(){e=c("div"),l=c("div"),n=c("form"),i=c("input"),o=b(),u=c("strong"),u.textContent="Setup",a=b(),m=c("div"),f=N("Connection"),p=c("br"),_=b(),h=c("select"),v=c("option"),v.textContent="Connect to WiFi",d=c("option"),d.textContent="Standalone access point",j&&j.c(),g=b(),x&&x.c(),w=b(),D=c("div"),M=N(`Hostname
- `),E=c("input"),R=b(),O=c("div"),F=c("label"),y=c("input"),P=N(" Static IP"),ne=b(),ae&&ae.c(),H=b(),ee&&ee.c(),z=b(),U=c("div"),U.innerHTML='',K=b(),re(Q.$$.fragment),r(i,"type","hidden"),r(i,"name","s"),i.value="true",r(u,"class","text-sm"),v.__value=1,v.value=v.__value,d.__value=2,d.value=d.__value,r(h,"name","sc"),r(h,"class","in-s"),t[2]===void 0&&We(()=>t[5].call(h)),r(m,"class","my-3"),r(E,"name","sh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"maxlength","32"),r(E,"pattern","[a-z0-9_-]+"),r(E,"placeholder","Optional, ex.: ams-reader"),r(E,"autocomplete","off"),r(y,"type","checkbox"),r(y,"name","sm"),y.__value="static",y.value=y.__value,r(y,"class","rounded mb-1"),r(O,"class","my-3"),r(U,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(V,W){S(V,e,W),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),s(n,m),s(m,f),s(m,p),s(m,_),s(m,h),s(h,v),s(h,d),j&&j.m(h,null),$e(h,t[2],!0),s(n,g),x&&x.m(n,null),s(n,w),s(n,D),s(D,M),s(D,E),oe(E,t[0].hostname),s(n,R),s(n,O),s(O,F),s(F,y),y.checked=t[1],s(F,P),s(O,ne),ae&&ae.m(O,null),s(n,H),ee&&ee.m(n,null),s(n,z),s(n,U),S(V,K,W),ie(Q,V,W),G=!0,X||(Y=[te(h,"change",t[5]),te(E,"input",t[6]),te(y,"change",t[7]),te(n,"submit",wi(t[4]))],X=!0)},p(V,[W]){V[0].if&&V[0].if.eth?j||(j=Kf(),j.c(),j.m(h,null)):j&&(j.d(1),j=null),W&4&&$e(h,V[2]),V[2]==1||V[2]==2?x?x.p(V,W):(x=Yf(V),x.c(),x.m(n,w)):x&&(x.d(1),x=null),W&1&&E.value!==V[0].hostname&&oe(E,V[0].hostname),W&2&&(y.checked=V[1]),V[1]?ae?(ae.p(V,W),W&2&&I(ae,1)):(ae=Qf(V),ae.c(),I(ae,1),ae.m(O,null)):ae&&(Ae(),q(ae,1,1,()=>{ae=null}),Pe()),V[1]?ee||(ee=Xf(),ee.c(),ee.m(n,z)):ee&&(ee.d(1),ee=null);const we={};W&8&&(we.active=V[3]),Q.$set(we)},i(V){G||(I(ae),I(Q.$$.fragment,V),G=!0)},o(V){q(ae),q(Q.$$.fragment,V),G=!1},d(V){V&&$(e),j&&j.d(),x&&x.d(),ae&&ae.d(),ee&&ee.d(),V&&$(K),se(Q,V),X=!1,ze(Y)}}}function ep(t,e,l){let{sysinfo:n={}}=e,i=!1,o=1,u=!1,a=0;function m(){var v="";a++;var d=function(){setTimeout(m,1e3)};if(n.net.ip&&a%3==0){if(!n.net.ip){d();return}v="http://"+n.net.ip}else n.hostname&&a%3==1?v="http://"+n.hostname:n.hostname&&a%3==2?v="http://"+n.hostname+".local":v="";console&&console.log("Trying url "+v),Wt.update(w=>(w.trying=v,w));var g=new XMLHttpRequest;g.timeout=5e3,g.addEventListener("abort",d),g.addEventListener("error",d),g.addEventListener("timeout",d),g.addEventListener("load",function(w){window.location.href=v||"/"}),g.open("GET",v+"/is-alive",!0),g.send()}async function f(v){l(3,u=!0);const d=new FormData(v.target),g=new URLSearchParams;for(let M of d){const[E,R]=M;g.append(E,R)}let D=await(await fetch("/save",{method:"POST",body:g})).json();l(3,u=!1),Wt.update(M=>(M.hostname=d.get("sh"),M.usrcfg=D.success,M.booting=D.reboot,i&&(M.net.ip=d.get("si"),M.net.mask=d.get("su"),M.net.gw=d.get("sg"),M.net.dns1=d.get("sd")),setTimeout(m,5e3),M))}function p(){o=tt(this),l(2,o)}function _(){n.hostname=this.value,l(0,n)}function h(){i=this.checked,l(1,i)}return t.$$set=v=>{"sysinfo"in v&&l(0,n=v.sysinfo)},[n,i,o,u,f,p,_,h]}class tp extends Re{constructor(e){super(),Le(this,e,ep,x_,Ee,{sysinfo:0})}}function lp(t){let e,l,n,i,o,u,a,m,f,p,_,h,v,d,g,w,D;return d=new kt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=c("div"),l=c("div"),n=c("strong"),i=N("Upload "),o=N(t[1]),u=b(),a=c("p"),a.textContent="Select a suitable file and click upload",m=b(),f=c("form"),p=c("input"),_=b(),h=c("div"),h.innerHTML='',v=b(),re(d.$$.fragment),r(a,"class","mb-4"),r(p,"name","file"),r(p,"type","file"),r(h,"class","w-full text-right mt-4"),r(f,"action",t[0]),r(f,"enctype","multipart/form-data"),r(f,"method","post"),r(f,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(M,E){S(M,e,E),s(e,l),s(l,n),s(n,i),s(n,o),s(l,u),s(l,a),s(l,m),s(l,f),s(f,p),s(f,_),s(f,h),S(M,v,E),ie(d,M,E),g=!0,w||(D=te(f,"submit",t[3]),w=!0)},p(M,[E]){(!g||E&2)&&J(o,M[1]),(!g||E&1)&&r(f,"action",M[0]);const R={};E&4&&(R.active=M[2]),d.$set(R)},i(M){g||(I(d.$$.fragment,M),g=!0)},o(M){q(d.$$.fragment,M),g=!1},d(M){M&&$(e),M&&$(v),se(d,M),w=!1,D()}}}function np(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const u=()=>l(2,o=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,o,u]}class Co extends Re{constructor(e){super(),Le(this,e,np,lp,Ee,{action:0,title:1})}}function ip(t){let e,l,n,i,o,u,a,m,f,p,_,h,v,d,g,w,D,M,E,R,O,F,y,P,ne,H,z,U,K,Q,G;return U=new kt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=c("div"),l=c("div"),n=c("form"),i=c("div"),i.textContent="Various permissions we need to do stuff:",o=b(),u=c("hr"),a=b(),m=c("div"),f=N("Enable one-click upgrade? (implies data collection)"),p=c("br"),_=b(),h=c("a"),v=N("Read more"),d=c("br"),g=b(),w=c("label"),D=c("input"),E=N(" Yes"),R=c("label"),O=c("input"),y=N(" No"),P=c("br"),ne=b(),H=c("div"),H.innerHTML='',z=b(),re(U.$$.fragment),r(h,"href",Rt("Data-collection-on-one-click-firmware-upgrade")),r(h,"target","_blank"),r(h,"class","text-blue-600 hover:text-blue-800"),r(D,"type","radio"),r(D,"name","sf"),D.value=1,D.checked=M=t[0].fwconsent===1,r(D,"class","rounded m-2"),D.required=!0,r(O,"type","radio"),r(O,"name","sf"),O.value=2,O.checked=F=t[0].fwconsent===2,r(O,"class","rounded m-2"),O.required=!0,r(m,"class","my-3"),r(H,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(X,Y){S(X,e,Y),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),s(n,m),s(m,f),s(m,p),s(m,_),s(m,h),s(h,v),s(m,d),s(m,g),s(m,w),s(w,D),s(w,E),s(m,R),s(R,O),s(R,y),s(m,P),s(n,ne),s(n,H),S(X,z,Y),ie(U,X,Y),K=!0,Q||(G=te(n,"submit",wi(t[2])),Q=!0)},p(X,[Y]){(!K||Y&1&&M!==(M=X[0].fwconsent===1))&&(D.checked=M),(!K||Y&1&&F!==(F=X[0].fwconsent===2))&&(O.checked=F);const j={};Y&2&&(j.active=X[1]),U.$set(j)},i(X){K||(I(U.$$.fragment,X),K=!0)},o(X){q(U.$$.fragment,X),K=!1},d(X){X&&$(e),X&&$(z),se(U,X),Q=!1,G()}}}function sp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(u){l(1,i=!0);const a=new FormData(u.target),m=new URLSearchParams;for(let _ of a){const[h,v]=_;m.append(h,v)}let p=await(await fetch("/save",{method:"POST",body:m})).json();l(1,i=!1),Wt.update(_=>(_.fwconsent=a.sf===!0?1:a.sf===!1?2:0,_.booting=p.reboot,_)),fn("/")}return t.$$set=u=>{"sysinfo"in u&&l(0,n=u.sysinfo)},[n,i,o]}class op extends Re{constructor(e){super(),Le(this,e,sp,ip,Ee,{sysinfo:0})}}function Zf(t,e,l){const n=t.slice();return n[17]=e[l],n[18]=e,n[19]=l,n}function Jf(t,e,l){const n=t.slice();return n[20]=e[l],n[22]=l,n}function xf(t,e,l){const n=t.slice();return n[20]=e[l],n[22]=l,n}function ec(t,e,l){const n=t.slice();return n[20]=e[l],n[22]=l,n}function tc(t){let e,l,n=t[0].o,i=[];for(let u=0;uq(i[u],1,1,()=>{i[u]=null});return{c(){for(let u=0;uSave',R=b(),re(O.$$.fragment),F=b(),re(y.$$.fragment),r(l,"class","text-sm"),r(i,"href",Rt("Price-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"class","m-3"),r(p,"type","hidden"),r(p,"name","r"),p.value="true",r(g,"type","button"),r(g,"class","btn-pri"),r(D,"class","text-center"),r(E,"class","text-right"),r(v,"class","grid grid-cols-3"),r(f,"autocomplete","off"),r(e,"class","cnt")},m(U,K){S(U,e,K),s(e,l),s(e,n),s(e,i),ie(o,i,null),s(e,u),s(e,a),s(e,m),s(e,f),s(f,p),s(f,_),z&&z.m(f,null),s(f,h),s(f,v),s(v,d),s(d,g),s(v,w),s(v,D),s(v,M),s(v,E),S(U,R,K),ie(O,U,K),S(U,F,K),ie(y,U,K),P=!0,ne||(H=[te(g,"click",t[6]),te(f,"submit",wi(t[4]))],ne=!0)},p(U,[K]){U[0].o?z?(z.p(U,K),K&1&&I(z,1)):(z=tc(U),z.c(),I(z,1),z.m(f,h)):z&&(Ae(),q(z,1,1,()=>{z=null}),Pe());const Q={};K&2&&(Q.active=U[1]),O.$set(Q);const G={};K&4&&(G.active=U[2]),y.$set(G)},i(U){P||(I(o.$$.fragment,U),I(z),I(O.$$.fragment,U),I(y.$$.fragment,U),P=!0)},o(U){q(o.$$.fragment,U),q(z),q(O.$$.fragment,U),q(y.$$.fragment,U),P=!1},d(U){U&&$(e),se(o),z&&z.d(),U&&$(R),se(O,U),U&&$(F),se(y,U),ne=!1,ze(H)}}}function ap(t,e,l){let n=["mo","tu","we","th","fr","sa","su"],i={},o=!0,u=!1;e1.subscribe(R=>{R.o&&(l(0,i=R),l(1,o=!1))}),Zm();async function a(R){l(2,u=!0);const O=new URLSearchParams;O.append("r","true"),O.append("rc",i.o.length),i.o.forEach(function(y,P){O.append("rt"+P,y.t),O.append("rn"+P,y.n),O.append("rd"+P,y.d),O.append("ra"+P,y.a),O.append("rh"+P,y.h),O.append("rv"+P,y.v)}),await(await fetch("/save",{method:"POST",body:O})).json(),l(2,u=!1),fn("/configuration")}let m=function(R,O){return R.includes(O)?R=R.filter(function(F){return F!==O}):R.push(O),R},f=function(){let R=i.o;R.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.01}),l(0,i.o=R,i)},p=function(R){let O=i.o;O.splice(R,1),l(0,i.o=O,i)};function _(R,O){R[O].n=this.value,l(0,i)}function h(R,O){R[O].d=tt(this),l(0,i)}function v(R,O){R[O].t=tt(this),l(0,i)}function d(R,O){R[O].v=ge(this.value),l(0,i)}return[i,o,u,n,a,m,f,p,_,h,v,d,(R,O,F,y)=>l(0,F[y].a=m(R.a,O),i),(R,O,F,y)=>l(0,F[y].h=m(R.h,O),i),(R,O,F,y)=>l(0,F[y].h=m(R.h,O+12),i),R=>p(R),R=>p(R)]}class up extends Re{constructor(e){super(),Le(this,e,ap,rp,Ee,{})}}function fp(t){let e,l;return e=new Qm({props:{data:t[1],sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function cp(t){let e,l;return e=new R_({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function mp(t){let e,l;return e=new up({}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function _p(t){let e,l;return e=new V_({props:{sysinfo:t[0],data:t[1]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function pp(t){let e,l;return e=new Co({props:{title:"CA",action:"/mqtt-ca"}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function dp(t){let e,l;return e=new Co({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function vp(t){let e,l;return e=new Co({props:{title:"private key",action:"/mqtt-key"}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function hp(t){let e,l;return e=new op({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function bp(t){let e,l;return e=new tp({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function gp(t){let e,l;return e=new J_({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function kp(t){let e,l,n,i,o,u,a,m,f,p,_,h,v,d,g,w,D,M,E,R,O,F;return e=new sm({props:{data:t[1]}}),n=new ml({props:{path:"/",$$slots:{default:[fp]},$$scope:{ctx:t}}}),o=new ml({props:{path:"/configuration",$$slots:{default:[cp]},$$scope:{ctx:t}}}),a=new ml({props:{path:"/priceconfig",$$slots:{default:[mp]},$$scope:{ctx:t}}}),f=new ml({props:{path:"/status",$$slots:{default:[_p]},$$scope:{ctx:t}}}),_=new ml({props:{path:"/mqtt-ca",$$slots:{default:[pp]},$$scope:{ctx:t}}}),v=new ml({props:{path:"/mqtt-cert",$$slots:{default:[dp]},$$scope:{ctx:t}}}),g=new ml({props:{path:"/mqtt-key",$$slots:{default:[vp]},$$scope:{ctx:t}}}),D=new ml({props:{path:"/consent",$$slots:{default:[hp]},$$scope:{ctx:t}}}),E=new ml({props:{path:"/setup",$$slots:{default:[bp]},$$scope:{ctx:t}}}),O=new ml({props:{path:"/vendor",$$slots:{default:[gp]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment),l=b(),re(n.$$.fragment),i=b(),re(o.$$.fragment),u=b(),re(a.$$.fragment),m=b(),re(f.$$.fragment),p=b(),re(_.$$.fragment),h=b(),re(v.$$.fragment),d=b(),re(g.$$.fragment),w=b(),re(D.$$.fragment),M=b(),re(E.$$.fragment),R=b(),re(O.$$.fragment)},m(y,P){ie(e,y,P),S(y,l,P),ie(n,y,P),S(y,i,P),ie(o,y,P),S(y,u,P),ie(a,y,P),S(y,m,P),ie(f,y,P),S(y,p,P),ie(_,y,P),S(y,h,P),ie(v,y,P),S(y,d,P),ie(g,y,P),S(y,w,P),ie(D,y,P),S(y,M,P),ie(E,y,P),S(y,R,P),ie(O,y,P),F=!0},p(y,P){const ne={};P&2&&(ne.data=y[1]),e.$set(ne);const H={};P&7&&(H.$$scope={dirty:P,ctx:y}),n.$set(H);const z={};P&5&&(z.$$scope={dirty:P,ctx:y}),o.$set(z);const U={};P&4&&(U.$$scope={dirty:P,ctx:y}),a.$set(U);const K={};P&7&&(K.$$scope={dirty:P,ctx:y}),f.$set(K);const Q={};P&4&&(Q.$$scope={dirty:P,ctx:y}),_.$set(Q);const G={};P&4&&(G.$$scope={dirty:P,ctx:y}),v.$set(G);const X={};P&4&&(X.$$scope={dirty:P,ctx:y}),g.$set(X);const Y={};P&5&&(Y.$$scope={dirty:P,ctx:y}),D.$set(Y);const j={};P&5&&(j.$$scope={dirty:P,ctx:y}),E.$set(j);const x={};P&5&&(x.$$scope={dirty:P,ctx:y}),O.$set(x)},i(y){F||(I(e.$$.fragment,y),I(n.$$.fragment,y),I(o.$$.fragment,y),I(a.$$.fragment,y),I(f.$$.fragment,y),I(_.$$.fragment,y),I(v.$$.fragment,y),I(g.$$.fragment,y),I(D.$$.fragment,y),I(E.$$.fragment,y),I(O.$$.fragment,y),F=!0)},o(y){q(e.$$.fragment,y),q(n.$$.fragment,y),q(o.$$.fragment,y),q(a.$$.fragment,y),q(f.$$.fragment,y),q(_.$$.fragment,y),q(v.$$.fragment,y),q(g.$$.fragment,y),q(D.$$.fragment,y),q(E.$$.fragment,y),q(O.$$.fragment,y),F=!1},d(y){se(e,y),y&&$(l),se(n,y),y&&$(i),se(o,y),y&&$(u),se(a,y),y&&$(m),se(f,y),y&&$(p),se(_,y),y&&$(h),se(v,y),y&&$(d),se(g,y),y&&$(w),se(D,y),y&&$(M),se(E,y),y&&$(R),se(O,y)}}}function wp(t){let e,l,n,i;const o=[$p,Cp],u=[];function a(m,f){return m[0].trying?0:1}return e=a(t),l=u[e]=o[e](t),{c(){l.c(),n=Ke()},m(m,f){u[e].m(m,f),S(m,n,f),i=!0},p(m,f){let p=e;e=a(m),e===p?u[e].p(m,f):(Ae(),q(u[p],1,1,()=>{u[p]=null}),Pe(),l=u[e],l?l.p(m,f):(l=u[e]=o[e](m),l.c()),I(l,1),l.m(n.parentNode,n))},i(m){i||(I(l),i=!0)},o(m){q(l),i=!1},d(m){u[e].d(m),m&&$(n)}}}function yp(t){let e,l;return e=new kt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function Cp(t){let e,l;return e=new kt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function $p(t){let e,l;return e=new kt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function Sp(t){let e,l,n,i,o,u;l=new Lc({props:{$$slots:{default:[kp]},$$scope:{ctx:t}}});const a=[yp,wp],m=[];function f(p,_){return p[0].upgrading?0:p[0].booting?1:-1}return~(i=f(t))&&(o=m[i]=a[i](t)),{c(){e=c("div"),re(l.$$.fragment),n=b(),o&&o.c(),r(e,"class","container mx-auto m-3")},m(p,_){S(p,e,_),ie(l,e,null),s(e,n),~i&&m[i].m(e,null),u=!0},p(p,[_]){const h={};_&7&&(h.$$scope={dirty:_,ctx:p}),l.$set(h);let v=i;i=f(p),i===v?~i&&m[i].p(p,_):(o&&(Ae(),q(m[v],1,1,()=>{m[v]=null}),Pe()),~i?(o=m[i],o?o.p(p,_):(o=m[i]=a[i](p),o.c()),I(o,1),o.m(e,null)):o=null)},i(p){u||(I(l.$$.fragment,p),I(o),u=!0)},o(p){q(l.$$.fragment,p),q(o),u=!1},d(p){p&&$(e),se(l),~i&&m[i].d()}}}function Mp(t,e,l){let n={};Wt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?fn("/vendor"):n.usrcfg===!1?fn("/setup"):n.fwconsent===0&&fn("/consent"),n.ui.k===1?(console.log("dark"),document.documentElement.classList.add("dark")):n.ui.k===0?(console.log("light"),document.documentElement.classList.remove("dark")):window.matchMedia("(prefers-color-scheme: dark)").matches?(console.log("dark auto"),document.documentElement.classList.add("dark")):(console.log("light auto"),document.documentElement.classList.remove("dark"))}),bo();let i={};return Bc.subscribe(o=>{l(1,i=o)}),[n,i]}class Tp extends Re{constructor(e){super(),Le(this,e,Mp,Sp,Ee,{})}}new Tp({target:document.getElementById("app")});
+