diff --git a/gui/modals/SensorFormModal.svelte b/gui/modals/SensorFormModal.svelte index cd66a474c..a2e645bd3 100644 --- a/gui/modals/SensorFormModal.svelte +++ b/gui/modals/SensorFormModal.svelte @@ -360,7 +360,10 @@ })}" /> -
+
-
+
t(9,r=B));const y=S({onSubmit:b}),I=(B,V)=>Wt(this,null,function*(){Wt(this,null,function*(){yield P5(Z=>t(4,d=Z.map(ie=>({value:ie.hardware,text:ie.name})))),B&&(yield Xm(B,Z=>Ci(h,n=Z,n)),k(n)),t(2,l=!1)}),E(),Ci(h,n=ha(f),n),t(3,u=!1),t(2,l=!0),s()}),C=()=>{setTimeout(()=>{t(2,l=!1)},1e3),o()};Qi(()=>{f.setAttribute("novalidate","novalidate")});const D=B=>v(B.detail);function R(B){ni[B?"unshift":"push"](()=>{f=B,t(6,f)})}function N(B){s=B,t(0,s)}function F(B){o=B,t(1,o)}return[s,o,l,u,d,c,f,n,a,r,h,v,w,_,y,I,C,D,R,N,F]}class Hle extends Bt{constructor(e){super(),zt(this,e,$le,Ble,Nt,{show:15,hide:16})}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[16]}}function jle(i){var qe;let e,t,n,a,r,s,o,l,u,d,c,h,f,m,g,v,b,w,k,_,S,E,y,I,C,D,R,N,F,B,V,Z,ie,K,J,G,te,re,ae,ce,ke,Le,Ue,Ee,Oe,Ye,Ze,Qe,Ae,de,Me,Ie;return o=new Oi({props:{name:"hardware",value:i[8].hardware,readonly:i[8].id&&i[8].id!=="",required:!0,options:i[4],label:i[9]("relays.settings.hardware.label",{default:"Hardware"}),placeholder:i[9]("relays.settings.hardware.placeholder",{default:"Select hardware"}),help:i[9]("relays.settings.hardware.help",{default:"Select the hardware type for this relay."}),invalid:i[9]("relays.settings.hardware.invalid",{default:"Please select a hardware type."})}}),o.$on("change",i[18]),d=new $t({props:{type:"text",name:"address",min:"1",max:"40",required:!0,readonly:i[6]==="brightpi-dimmer",label:i[9]("relays.settings.address.label",{default:"Address"}),placeholder:i[9]("relays.settings.address.placeholder",{default:"Enter an address"}),help:i[9]("relays.settings.address.help",{default:"For more information see online."}),invalid:i[9]("relays.settings.address.invalid",{default:"The entered address is not valid. It cannot be empty."})}}),f=new $t({props:{type:"text",name:"name",required:!0,label:i[9]("relays.settings.name.label",{default:"Name"}),placeholder:i[9]("relays.settings.name.placeholder",{default:"Enter a name"}),help:i[9]("relays.settings.name.help",{default:"Enter an easy to remember name."}),invalid:i[9]("relays.settings.name.invalid",{default:"The entered name is not valid. It cannot be empty."})}}),w=new $t({props:{type:"number",min:"0",step:"0.001",name:"wattage",required:!0,label:i[9]("relays.settings.wattage.label",{default:"Wattage"}),help:i[9]("relays.settings.wattage.help",{default:"Enter the (max) wattage when switched on."}),invalid:i[9]("relays.settings.wattage.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),S=new $t({props:{type:"number",min:"0",step:"0.001",name:"flow",required:!0,label:i[9]("relays.settings.flow.label",{default:"Water flow"}),help:i[9]("relays.settings.flow.help",{default:"Enter the (max) water flow when switched on."}),invalid:i[9]("relays.settings.flow.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),I=new Pr({props:{name:"notification",value:i[8].notification,label:i[9]("relays.settings.notification.label",{default:"Notification"}),help:i[9]("relays.settings.notification.help",{default:"Toggle to enable notification messages."})}}),R=new $t({props:{type:"text",name:"value",readonly:!0,label:i[9]("relays.settings.current.label",{default:"Current"}),placeholder:i[9]("relays.settings.current.placeholder",{default:"Current value"}),help:i[9]("relays.settings.current.help",{default:"The current state of the relay."})}}),J=new Pr({props:{name:"calibration.inverse",value:(qe=i[8].calibration)==null?void 0:qe.inverse,label:i[9]("relays.settings.calibration.inverse.label",{default:"Inverse"}),help:i[9]("relays.settings.calibration.inverse.help",{default:"Inverse GPIO relay function."})}}),re=new $t({props:{type:"number",name:"calibration.dimmer_frequency",disabled:i[6]==="gpio",step:"1",min:"1",label:i[9]("relays.settings.calibration.dimmer_frequency.label",{default:"Dimmer frequency in Hz"}),help:i[9]("relays.settings.calibration.dimmer_frequency.help",{default:"The frequency on which the dimmer operates."}),invalid:i[9]("relays.settings.calibration.dimmer_frequency.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),ke=new $t({props:{type:"number",name:"calibration.dimmer_max_power",disabled:i[6]==="gpio",step:"1",min:"1",max:"100",label:i[9]("relays.settings.calibration.dimmer_max_power.label",{default:"Max power in %"}),help:i[9]("relays.settings.calibration.dimmer_max_power.help",{default:"The maximum power for this dimmer."}),invalid:i[9]("relays.settings.calibration.dimmer_max_power.invalid",{default:"The entered value is not valid. Enter a valid number between {min} and {max}.",values:{min:1,max:40}})}}),Ee=new $t({props:{type:"number",name:"calibration.dimmer_offset",disabled:i[6]==="gpio",step:"0.1",min:"0",max:"100",label:i[9]("relays.settings.calibration.dimmer_offset.label",{default:"Dimmer offset in %"}),help:i[9]("relays.settings.calibration.dimmer_offset.help",{default:"The dimmer offset."}),invalid:i[9]("relays.settings.calibration.dimmer_offset.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),Ze=new $t({props:{type:"number",name:"calibration.dimmer_max_dim",disabled:i[6]==="gpio",step:"1",min:"0",label:i[9]("relays.settings.calibration.dimmer_max_dim.label",{default:"Maximum dimmer value"}),help:i[9]("relays.settings.calibration.dimmer_max_dim.help",{default:"Maximum dimmer value (Legacy)."}),invalid:i[9]("relays.settings.calibration.dimmer_max_dim.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),{c(){e=M("form"),t=M("input"),a=X(),r=M("div"),s=M("div"),be(o.$$.fragment),l=X(),u=M("div"),be(d.$$.fragment),c=X(),h=M("div"),be(f.$$.fragment),m=X(),g=M("div"),v=M("div"),b=M("div"),be(w.$$.fragment),k=X(),_=M("div"),be(S.$$.fragment),E=X(),y=M("div"),be(I.$$.fragment),C=X(),D=M("div"),be(R.$$.fragment),N=X(),F=M("div"),B=M("a"),B.innerHTML='
',V=X(),Z=M("div"),ie=M("div"),K=M("div"),be(J.$$.fragment),G=X(),te=M("div"),be(re.$$.fragment),ae=X(),ce=M("div"),be(ke.$$.fragment),Le=X(),Ue=M("div"),be(Ee.$$.fragment),Oe=X(),Ye=M("div"),be(Ze.$$.fragment),Qe=X(),Ae=M("button"),Ae.innerHTML="",A(t,"type","hidden"),A(t,"name","id"),t.disabled=n=i[8].id&&i[8].id!==""?null:!0,A(s,"class","col-12 col-sm-12 col-md-6 col-lg-2"),A(u,"class","col-12 col-sm-12 col-md-6 col-lg-2"),A(h,"class","col-12 col-sm-12 col-md-12 col-lg-3"),A(b,"class","col-6"),A(_,"class","col-6"),A(v,"class","row"),A(g,"class","col-12 col-sm-12 col-md-12 col-lg-3"),A(y,"class","col-6 col-sm-6 col-md-6 col-lg-1"),A(D,"class","col-6 col-sm-6 col-md-6 col-lg-1"),A(r,"class","row"),A(B,"data-toggle","collapse"),A(B,"href","#callibration"),A(B,"role","button"),A(B,"aria-expanded","false"),A(B,"aria-controls","callibration"),fe(B,"d-none",!i[5]),A(K,"class","col-6 col-sm-6 col-md-6 col-lg-3"),fe(K,"d-none",i[6]!=="gpio"),A(te,"class","col-6 col-sm-6 col-md-6 col-lg-3"),fe(te,"d-none",["brightpi-dimmer","remote-dimmer","script-dimmer","sonoff_d1-dimmer"].indexOf(i[6])!==-1||i[6]==="gpio"),A(ce,"class","col-6 col-sm-6 col-md-6 col-lg-3"),fe(ce,"d-none",i[6]==="gpio"),A(Ue,"class","col-6 col-sm-6 col-md-6 col-lg-3"),fe(Ue,"d-none",i[6]==="gpio"),A(Ye,"class","col-6 col-sm-6 col-md-6 col-lg-3"),fe(Ye,"d-none",["brightpi-dimmer","PCA9685-dimmer","remote-dimmer","script-dimmer","sonoff_d1-dimmer"].indexOf(i[6])===-1||i[6]==="gpio"),A(ie,"class","collapse row pt-3"),A(ie,"id","callibration"),A(Z,"class","col"),A(F,"class","row button_callibration"),fe(F,"d-block",i[5]),fe(F,"d-none",!i[5]),A(Ae,"type","submit"),pi(Ae,"display","none"),A(e,"class","needs-validation"),fe(e,"was-validated",i[3])},m(Be,$e){j(Be,e,$e),x(e,t),x(e,a),x(e,r),x(r,s),ge(o,s,null),x(r,l),x(r,u),ge(d,u,null),x(r,c),x(r,h),ge(f,h,null),x(r,m),x(r,g),x(g,v),x(v,b),ge(w,b,null),x(v,k),x(v,_),ge(S,_,null),x(r,E),x(r,y),ge(I,y,null),x(r,C),x(r,D),ge(R,D,null),x(e,N),x(e,F),x(F,B),x(F,V),x(F,Z),x(Z,ie),x(ie,K),ge(J,K,null),x(ie,G),x(ie,te),ge(re,te,null),x(ie,ae),x(ie,ce),ge(ke,ce,null),x(ie,Le),x(ie,Ue),ge(Ee,Ue,null),x(ie,Oe),x(ie,Ye),ge(Ze,Ye,null),x(e,Qe),x(e,Ae),i[19](e),de=!0,Me||(Ie=fr(i[13].call(null,e)),Me=!0)},p(Be,$e){var De;(!de||$e&256&&n!==(n=Be[8].id&&Be[8].id!==""?null:!0))&&(t.disabled=n);const Je={};$e&256&&(Je.value=Be[8].hardware),$e&256&&(Je.readonly=Be[8].id&&Be[8].id!==""),$e&16&&(Je.options=Be[4]),$e&512&&(Je.label=Be[9]("relays.settings.hardware.label",{default:"Hardware"})),$e&512&&(Je.placeholder=Be[9]("relays.settings.hardware.placeholder",{default:"Select hardware"})),$e&512&&(Je.help=Be[9]("relays.settings.hardware.help",{default:"Select the hardware type for this relay."})),$e&512&&(Je.invalid=Be[9]("relays.settings.hardware.invalid",{default:"Please select a hardware type."})),o.$set(Je);const Ne={};$e&64&&(Ne.readonly=Be[6]==="brightpi-dimmer"),$e&512&&(Ne.label=Be[9]("relays.settings.address.label",{default:"Address"})),$e&512&&(Ne.placeholder=Be[9]("relays.settings.address.placeholder",{default:"Enter an address"})),$e&512&&(Ne.help=Be[9]("relays.settings.address.help",{default:"For more information see online."})),$e&512&&(Ne.invalid=Be[9]("relays.settings.address.invalid",{default:"The entered address is not valid. It cannot be empty."})),d.$set(Ne);const Pe={};$e&512&&(Pe.label=Be[9]("relays.settings.name.label",{default:"Name"})),$e&512&&(Pe.placeholder=Be[9]("relays.settings.name.placeholder",{default:"Enter a name"})),$e&512&&(Pe.help=Be[9]("relays.settings.name.help",{default:"Enter an easy to remember name."})),$e&512&&(Pe.invalid=Be[9]("relays.settings.name.invalid",{default:"The entered name is not valid. It cannot be empty."})),f.$set(Pe);const Ve={};$e&512&&(Ve.label=Be[9]("relays.settings.wattage.label",{default:"Wattage"})),$e&512&&(Ve.help=Be[9]("relays.settings.wattage.help",{default:"Enter the (max) wattage when switched on."})),$e&512&&(Ve.invalid=Be[9]("relays.settings.wattage.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),w.$set(Ve);const it={};$e&512&&(it.label=Be[9]("relays.settings.flow.label",{default:"Water flow"})),$e&512&&(it.help=Be[9]("relays.settings.flow.help",{default:"Enter the (max) water flow when switched on."})),$e&512&&(it.invalid=Be[9]("relays.settings.flow.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),S.$set(it);const je={};$e&256&&(je.value=Be[8].notification),$e&512&&(je.label=Be[9]("relays.settings.notification.label",{default:"Notification"})),$e&512&&(je.help=Be[9]("relays.settings.notification.help",{default:"Toggle to enable notification messages."})),I.$set(je);const et={};$e&512&&(et.label=Be[9]("relays.settings.current.label",{default:"Current"})),$e&512&&(et.placeholder=Be[9]("relays.settings.current.placeholder",{default:"Current value"})),$e&512&&(et.help=Be[9]("relays.settings.current.help",{default:"The current state of the relay."})),R.$set(et),(!de||$e&32)&&fe(B,"d-none",!Be[5]);const _t={};$e&256&&(_t.value=(De=Be[8].calibration)==null?void 0:De.inverse),$e&512&&(_t.label=Be[9]("relays.settings.calibration.inverse.label",{default:"Inverse"})),$e&512&&(_t.help=Be[9]("relays.settings.calibration.inverse.help",{default:"Inverse GPIO relay function."})),J.$set(_t),(!de||$e&64)&&fe(K,"d-none",Be[6]!=="gpio");const ct={};$e&64&&(ct.disabled=Be[6]==="gpio"),$e&512&&(ct.label=Be[9]("relays.settings.calibration.dimmer_frequency.label",{default:"Dimmer frequency in Hz"})),$e&512&&(ct.help=Be[9]("relays.settings.calibration.dimmer_frequency.help",{default:"The frequency on which the dimmer operates."})),$e&512&&(ct.invalid=Be[9]("relays.settings.calibration.dimmer_frequency.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),re.$set(ct),(!de||$e&64)&&fe(te,"d-none",["brightpi-dimmer","remote-dimmer","script-dimmer","sonoff_d1-dimmer"].indexOf(Be[6])!==-1||Be[6]==="gpio");const ze={};$e&64&&(ze.disabled=Be[6]==="gpio"),$e&512&&(ze.label=Be[9]("relays.settings.calibration.dimmer_max_power.label",{default:"Max power in %"})),$e&512&&(ze.help=Be[9]("relays.settings.calibration.dimmer_max_power.help",{default:"The maximum power for this dimmer."})),$e&512&&(ze.invalid=Be[9]("relays.settings.calibration.dimmer_max_power.invalid",{default:"The entered value is not valid. Enter a valid number between {min} and {max}.",values:{min:1,max:40}})),ke.$set(ze),(!de||$e&64)&&fe(ce,"d-none",Be[6]==="gpio");const Xe={};$e&64&&(Xe.disabled=Be[6]==="gpio"),$e&512&&(Xe.label=Be[9]("relays.settings.calibration.dimmer_offset.label",{default:"Dimmer offset in %"})),$e&512&&(Xe.help=Be[9]("relays.settings.calibration.dimmer_offset.help",{default:"The dimmer offset."})),$e&512&&(Xe.invalid=Be[9]("relays.settings.calibration.dimmer_offset.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),Ee.$set(Xe),(!de||$e&64)&&fe(Ue,"d-none",Be[6]==="gpio");const me={};$e&64&&(me.disabled=Be[6]==="gpio"),$e&512&&(me.label=Be[9]("relays.settings.calibration.dimmer_max_dim.label",{default:"Maximum dimmer value"})),$e&512&&(me.help=Be[9]("relays.settings.calibration.dimmer_max_dim.help",{default:"Maximum dimmer value (Legacy)."})),$e&512&&(me.invalid=Be[9]("relays.settings.calibration.dimmer_max_dim.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),Ze.$set(me),(!de||$e&64)&&fe(Ye,"d-none",["brightpi-dimmer","PCA9685-dimmer","remote-dimmer","script-dimmer","sonoff_d1-dimmer"].indexOf(Be[6])===-1||Be[6]==="gpio"),(!de||$e&32)&&fe(F,"d-block",Be[5]),(!de||$e&32)&&fe(F,"d-none",!Be[5]),(!de||$e&8)&&fe(e,"was-validated",Be[3])},i(Be){de||(W(o.$$.fragment,Be),W(d.$$.fragment,Be),W(f.$$.fragment,Be),W(w.$$.fragment,Be),W(S.$$.fragment,Be),W(I.$$.fragment,Be),W(R.$$.fragment,Be),W(J.$$.fragment,Be),W(re.$$.fragment,Be),W(ke.$$.fragment,Be),W(Ee.$$.fragment,Be),W(Ze.$$.fragment,Be),de=!0)},o(Be){Q(o.$$.fragment,Be),Q(d.$$.fragment,Be),Q(f.$$.fragment,Be),Q(w.$$.fragment,Be),Q(S.$$.fragment,Be),Q(I.$$.fragment,Be),Q(R.$$.fragment,Be),Q(J.$$.fragment,Be),Q(re.$$.fragment,Be),Q(ke.$$.fragment,Be),Q(Ee.$$.fragment,Be),Q(Ze.$$.fragment,Be),de=!1},d(Be){Be&&H(e),ve(o),ve(d),ve(f),ve(w),ve(S),ve(I),ve(R),ve(J),ve(re),ve(ke),ve(Ee),ve(Ze),i[19](null),Me=!1,Ie()}}}function Ule(i){let e,t,n=i[9]("relays.settings.title",{default:"Relay settings"})+"",a,r,s,o;return s=new Ws({props:{moreInfo:"https://theyosh.github.io/TerrariumPI/setup/#relays"}}),{c(){e=M("i"),t=X(),a=Se(n),r=X(),be(s.$$.fragment),A(e,"class","fas fa-thumbtack mr-2")},m(l,u){j(l,e,u),j(l,t,u),j(l,a,u),j(l,r,u),ge(s,l,u),o=!0},p(l,u){(!o||u&512)&&n!==(n=l[9]("relays.settings.title",{default:"Relay settings"})+"")&&Ce(a,n)},i(l){o||(W(s.$$.fragment,l),o=!0)},o(l){Q(s.$$.fragment,l),o=!1},d(l){l&&(H(e),H(t),H(a),H(r)),ve(s,l)}}}function Wle(i){let e,t,n,a=i[9]("modal.general.save",{default:"Save"})+"",r,s,o,l;return{c(){e=M("button"),t=M("span"),n=X(),r=Se(a),A(t,"class","spinner-border spinner-border-sm"),A(t,"role","status"),A(t,"aria-hidden","true"),fe(t,"d-none",!i[10]),A(e,"type","button"),A(e,"class","btn btn-primary"),e.disabled=s=i[2]||i[10]},m(u,d){j(u,e,d),x(e,t),x(e,n),x(e,r),o||(l=Zt(e,"click",i[15]),o=!0)},p(u,d){d&1024&&fe(t,"d-none",!u[10]),d&512&&a!==(a=u[9]("modal.general.save",{default:"Save"})+"")&&Ce(r,a),d&1028&&s!==(s=u[2]||u[10])&&(e.disabled=s)},d(u){u&&H(e),o=!1,l()}}}function Vle(i){let e,t,n,a;function r(l){i[20](l)}function s(l){i[21](l)}let o={loading:i[2],$$slots:{actions:[Wle],header:[Ule],default:[jle]},$$scope:{ctx:i}};return i[0]!==void 0&&(o.show=i[0]),i[1]!==void 0&&(o.hide=i[1]),e=new Yo({props:o}),ni.push(()=>En(e,"show",r)),ni.push(()=>En(e,"hide",s)),{c(){be(e.$$.fragment)},m(l,u){ge(e,l,u),a=!0},p(l,[u]){const d={};u&4&&(d.loading=l[2]),u&268437500&&(d.$$scope={dirty:u,ctx:l}),!t&&u&1&&(t=!0,d.show=l[0],Sn(()=>t=!1)),!n&&u&2&&(n=!0,d.hide=l[1],Sn(()=>n=!1)),e.$set(d)},i(l){a||(W(e.$$.fragment,l),a=!0)},o(l){Q(e.$$.fragment,l),a=!1},d(l){ve(e,l)}}}function Gle(i,e,t){let n,a,r;mt(i,Yi,V=>t(9,a=V));let s,o,l=!1,u=!1,d=[],c=!1,h=null,f=Di({});mt(i,f,V=>t(8,n=V));let m;const g=Ya(),v=()=>{g("save")},b=V=>{t(6,h=V),h==="brightpi-dimmer"&&t(7,m.elements.address.value="fixed",m),t(5,c=h=="gpio"||h.endsWith("-dimmer"))},w=(V,Z)=>Wt(this,null,function*(){if(t(3,u=!0),Z.form.checkValidity()){t(2,l=!0),V=ha(m),V.address+="",delete V.value,delete V.dimmer,Object.values(V.calibration).some(Boolean)||(V.calibration={});try{yield D5(V,ie=>V=ie),wn(a("relays.settings.save.ok.message",{default:"Relay ''{name}'' is updated",values:{name:V.name}}),a("notification.form.save.ok.title",{default:"Save OK"})),D(),v()}catch(ie){t(2,l=!1),Pi(ie.message,a("notification.form.save.error.title",{default:"Save Error"}))}finally{t(3,u=!1)}}else{let ie=a("relays.settings.save.error.required_fields",{default:"Not all required fields are entered correctly."});ie+=` '`+ko(m).join(`' -'`)+"'",Pi(ie,a("notification.form.save.error.title",{default:"Save Error"}))}}),{form:k,setFields:_,isSubmitting:S,createSubmitHandler:E,reset:y}=Us({onSubmit:w});mt(i,S,V=>t(10,r=V));const I=E({onSubmit:w}),C=(V,Z)=>{Wt(this,null,function*(){yield E5(ie=>t(4,d=ie.map(K=>({value:K.hardware,text:K.name})))),V&&(yield Zm(V,ie=>Ci(f,n=ie,n)),_(n)),t(2,l=!1)}),y(),Ci(f,n=ha(m),n),t(3,u=!1),t(2,l=!0),s()},D=()=>{setTimeout(()=>{t(2,l=!1)},1e3),o()};Qi(()=>{m.setAttribute("novalidate","novalidate")});const R=V=>b(V.detail);function N(V){ni[V?"unshift":"push"](()=>{m=V,t(7,m)})}function F(V){s=V,t(0,s)}function B(V){o=V,t(1,o)}return[s,o,l,u,d,c,h,m,n,a,r,f,b,k,S,I,C,D,R,N,F,B]}class qle extends Bt{constructor(e){super(),zt(this,e,Gle,Vle,Nt,{show:16,hide:17})}get show(){return this.$$.ctx[16]}get hide(){return this.$$.ctx[17]}}function Yle(i){let e,t,n,a,r,s,o,l,u,d,c,h,f,m,g,v,b,w,k,_,S,E,y,I,C,D,R,N,F,B,V,Z,ie,K,J,G,te,re,ae,ce,ke,Le,Ue,Ee,Oe,Ye,Ze,Qe,Ae,de,Me,Ie,qe,Be,$e,Je,Ne,Pe,Ve,it,je,et,_t,ct,ze,Xe;return o=new Oi({props:{name:"hardware",value:i[9].hardware,readonly:i[9].id&&i[9].id!=="",required:!0,options:i[4],label:i[10]("sensors.settings.hardware.label",{default:"Hardware"}),placeholder:i[10]("sensors.settings.hardware.placeholder",{default:"Select hardware"}),help:i[10]("sensors.settings.hardware.help",{default:"Select the hardware type for this button."}),invalid:i[10]("sensors.settings.hardware.invalid",{default:"Please select a hardware type."})}}),o.$on("change",i[19]),d=new Oi({props:{name:"type",value:i[9].type,readonly:i[9].id&&i[9].id!=="",required:!0,options:i[6],label:i[10]("sensors.settings.type.label",{default:"Type"}),placeholder:i[10]("sensors.settings.type.placeholder",{default:"Select type"}),help:i[10]("sensors.settings.type.help",{default:"Select the measurement type for this sensor."}),invalid:i[10]("sensors.settings.type.invalid",{default:"Please select a measurement type."})}}),d.$on("change",i[20]),f=new $t({props:{type:"text",name:"address",required:!0,label:i[10]("sensors.settings.address.label",{default:"Address"}),placeholder:i[10]("sensors.settings.address.placeholder",{default:"Enter an address"}),help:i[10]("sensors.settings.address.help",{default:"Enter an address"}),invalid:i[10]("sensors.settings.address.invalid",{default:"The entered address is not valid. It cannot be empty."})}}),v=new $t({props:{type:"text",name:"name",required:!0,label:i[10]("sensors.settings.name.label",{default:"Name"}),placeholder:i[10]("sensors.settings.name.placeholder",{default:"Enter a name"}),help:i[10]("sensors.settings.name.help",{default:"Enter an easy to remember name."}),invalid:i[10]("sensors.settings.name.invalid",{default:"The entered name is not valid. It cannot be empty."})}}),k=new Pr({props:{name:"notification",value:i[9].notification,label:i[10]("sensors.settings.notification.label",{default:"Notification"}),help:i[10]("sensors.settings.notification.help",{default:"Toggle to enable notification messages."})}}),E=new $t({props:{type:"text",name:"value",readonly:!0,label:i[10]("sensors.settings.current.label",{default:"Current"}),placeholder:i[10]("sensors.settings.current.placeholder",{default:"Current value"}),help:i[10]("sensors.settings.current.help",{default:"The current state of the sensor."})}}),D=new $t({props:{type:"number",name:"alarm_min",step:"0.0001",required:!0,label:i[10]("sensors.settings.alarm_min.label",{default:"Alarm min"}),help:i[10]("sensors.settings.alarm_min.help",{default:"Enter the minimum value for the alarm."}),invalid:i[10]("sensors.settings.alarm_min.invalid",{default:"The entered value is not valid. It needs to be number."})}}),F=new $t({props:{type:"number",name:"alarm_max",step:"0.0001",required:!0,label:i[10]("sensors.settings.alarm_max.label",{default:"Alarm max"}),help:i[10]("sensors.settings.alarm_max.help",{default:"Enter the maximum value for the alarm."}),invalid:i[10]("sensors.settings.alarm_max.invalid",{default:"The entered value is not valid. It needs to be number."})}}),Z=new $t({props:{type:"number",name:"limit_min",step:"0.0001",required:!0,label:i[10]("sensors.settings.limit_min.label",{default:"Limit min"}),help:i[10]("sensors.settings.limit_min.help",{default:"Enter the minimum value that is valid."}),invalid:i[10]("sensors.settings.limit_min.invalid",{default:"The entered value is not valid. It needs to be number."})}}),J=new $t({props:{type:"number",name:"limit_max",step:"0.0001",required:!0,label:i[10]("sensors.settings.limit_max.label",{default:"Limit max"}),help:i[10]("sensors.settings.limit_max.help",{default:"Enter the maximum value that is valid."}),invalid:i[10]("sensors.settings.limit_max.invalid",{default:"The entered value is not valid. It needs to be number."})}}),re=new $t({props:{type:"number",name:"max_diff",min:"0",step:"0.0001",required:!0,label:i[10]("sensors.settings.max_diff.label",{default:"Max diff"}),placeholder:i[10]("sensors.settings.max_diff.placeholder",{default:"Max difference"}),help:i[10]("sensors.settings.max_diff.help",{default:"Enter the max difference between two measurements that is valid. Enter '0' to disable."}),invalid:i[10]("sensors.settings.max_diff.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})}}),ke=new Pr({props:{name:"exclude_avg",value:i[9].exclude_avg,horizontal:!1,label:i[10]("sensors.settings.exclude_avg.label",{default:"Excl. avg"}),help:i[10]("sensors.settings.exclude_avg.help",{default:"Exclude this sensors from average calculations."})}}),Ae=new $t({props:{type:"number",name:"calibration.offset",step:"0.0001",horizontal:!1,value:"0.0",label:i[10]("sensors.settings.calibration.offset.label",{default:"Offset"}),help:i[10]("sensors.settings.calibration.offset.help",{default:"Enter offset for this sensor."}),invalid:i[10]("sensors.settings.calibration.offset.invalid",{default:"The entered value is not valid. It needs to be number."})}}),Ie=new $t({props:{type:"number",name:"calibration.chirp_min_moist",step:"0.0001",min:"0",horizontal:!1,label:i[10]("sensors.settings.calibration.chirp_min_moist.label",{default:"Minimum moist value"}),help:i[10]("sensors.settings.calibration.chirp_min_moist.help",{default:"Enter the minimum moist value."}),invalid:i[10]("sensors.settings.calibration.chirp_min_moist.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})}}),$e=new $t({props:{type:"number",name:"calibration.chirp_max_moist",step:"0.0001",min:"0",horizontal:!1,label:i[10]("sensors.settings.calibration.chirp_max_moist.label",{default:"Maximum moist value"}),help:i[10]("sensors.settings.calibration.chirp_max_moist.help",{default:"Enter the maximum moist value."}),invalid:i[10]("sensors.settings.calibration.chirp_max_moist.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})}}),Pe=new Oi({props:{name:"calibration.ccs811_compensation_sensors",multiple:!0,options:i[7],label:i[10]("sensors.settings.calibration.ccs811_compensation_sensors.label",{default:"Compensation sensors"}),placeholder:i[10]("sensors.settings.calibration.ccs811_compensation_sensors.placeholder",{default:"Select compensation sensors"}),help:i[10]("sensors.settings.calibration.ccs811_compensation_sensors.help",{default:"Select the sensors for the compensation calculation."})}}),je=new $t({props:{type:"number",name:"calibration.light_on_off_threshold",step:"0.0001",min:"0",horizontal:!1,label:i[10]("sensors.settings.calibration.light_threshold.label",{default:"Lights on threshold"}),help:i[10]("sensors.settings.calibration.light_threshold.help",{default:"Enter the value when considered the lights are on."}),invalid:i[10]("sensors.settings.calibration.light_threshold.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})}}),{c(){e=M("form"),t=M("input"),a=X(),r=M("div"),s=M("div"),be(o.$$.fragment),l=X(),u=M("div"),be(d.$$.fragment),c=X(),h=M("div"),be(f.$$.fragment),m=X(),g=M("div"),be(v.$$.fragment),b=X(),w=M("div"),be(k.$$.fragment),_=X(),S=M("div"),be(E.$$.fragment),y=X(),I=M("div"),C=M("div"),be(D.$$.fragment),R=X(),N=M("div"),be(F.$$.fragment),B=X(),V=M("div"),be(Z.$$.fragment),ie=X(),K=M("div"),be(J.$$.fragment),G=X(),te=M("div"),be(re.$$.fragment),ae=X(),ce=M("div"),be(ke.$$.fragment),Le=X(),Ue=M("div"),Ee=M("a"),Ee.innerHTML='
',Oe=X(),Ye=M("div"),Ze=M("div"),Qe=M("div"),be(Ae.$$.fragment),de=X(),Me=M("div"),be(Ie.$$.fragment),qe=X(),Be=M("div"),be($e.$$.fragment),Je=X(),Ne=M("div"),be(Pe.$$.fragment),Ve=X(),it=M("div"),be(je.$$.fragment),et=X(),_t=M("button"),_t.innerHTML="",A(t,"type","hidden"),A(t,"name","id"),t.disabled=n=i[9].id&&i[9].id!==""?null:!0,A(s,"class","col-12 col-sm-6 col-md-4 col-lg-2"),A(u,"class","col-12 col-sm-6 col-md-4 col-lg-2"),A(h,"class","col-12 col-sm-12 col-md-4 col-lg-3"),A(g,"class","col-10 col-sm-10 col-md-8 col-lg-3"),A(w,"class","col-6 col-sm-6 col-md-6 col-lg-1"),A(S,"class","col-6 col-sm-6 col-md-6 col-lg-1"),A(r,"class","row"),A(C,"class","col-6 col-sm-6 col-md-6 col-lg-2"),A(N,"class","col-6 col-sm-6 col-md-6 col-lg-2"),A(V,"class","col-6 col-sm-6 col-md-6 col-lg-2"),A(K,"class","col-6 col-sm-6 col-md-6 col-lg-2"),A(te,"class","col-6 col-sm-6 col-md-6 col-lg-2"),A(ce,"class","col-12 col-sm-12 col-md-12 col-lg-2"),A(I,"class","row"),A(Ee,"data-toggle","collapse"),A(Ee,"href","#callibration"),A(Ee,"role","button"),A(Ee,"aria-expanded","false"),A(Ee,"aria-controls","callibration"),fe(Ee,"d-none",!Hy),A(Qe,"class","col-6 col-sm-6 col-md-6 col-lg-2"),A(Me,"class","col-6 col-sm-6 col-md-6 col-lg-2"),fe(Me,"d-none",i[5]!=="chirp"),A(Be,"class","col-6 col-sm-6 col-md-6 col-lg-2"),fe(Be,"d-none",i[5]!=="chirp"),A(Ne,"class","col-6 col-sm-6 col-md-6 col-lg-4"),fe(Ne,"d-none",i[5]!=="css811"),A(it,"class","col-6 col-sm-6 col-md-6 col-lg-2"),fe(it,"d-none",i[5]!=="light"),A(Ze,"class","collapse row pt-3"),A(Ze,"id","callibration"),A(Ye,"class","col"),A(Ue,"class","row button_callibration"),fe(Ue,"d-block",Hy),fe(Ue,"d-none",!Hy),A(_t,"type","submit"),pi(_t,"display","none"),A(e,"class","needs-validation"),fe(e,"was-validated",i[3])},m(me,De){j(me,e,De),x(e,t),x(e,a),x(e,r),x(r,s),ge(o,s,null),x(r,l),x(r,u),ge(d,u,null),x(r,c),x(r,h),ge(f,h,null),x(r,m),x(r,g),ge(v,g,null),x(r,b),x(r,w),ge(k,w,null),x(r,_),x(r,S),ge(E,S,null),x(e,y),x(e,I),x(I,C),ge(D,C,null),x(I,R),x(I,N),ge(F,N,null),x(I,B),x(I,V),ge(Z,V,null),x(I,ie),x(I,K),ge(J,K,null),x(I,G),x(I,te),ge(re,te,null),x(I,ae),x(I,ce),ge(ke,ce,null),x(e,Le),x(e,Ue),x(Ue,Ee),x(Ue,Oe),x(Ue,Ye),x(Ye,Ze),x(Ze,Qe),ge(Ae,Qe,null),x(Ze,de),x(Ze,Me),ge(Ie,Me,null),x(Ze,qe),x(Ze,Be),ge($e,Be,null),x(Ze,Je),x(Ze,Ne),ge(Pe,Ne,null),x(Ze,Ve),x(Ze,it),ge(je,it,null),x(e,et),x(e,_t),i[21](e),ct=!0,ze||(Xe=fr(i[14].call(null,e)),ze=!0)},p(me,De){(!ct||De[0]&512&&n!==(n=me[9].id&&me[9].id!==""?null:!0))&&(t.disabled=n);const bt={};De[0]&512&&(bt.value=me[9].hardware),De[0]&512&&(bt.readonly=me[9].id&&me[9].id!==""),De[0]&16&&(bt.options=me[4]),De[0]&1024&&(bt.label=me[10]("sensors.settings.hardware.label",{default:"Hardware"})),De[0]&1024&&(bt.placeholder=me[10]("sensors.settings.hardware.placeholder",{default:"Select hardware"})),De[0]&1024&&(bt.help=me[10]("sensors.settings.hardware.help",{default:"Select the hardware type for this button."})),De[0]&1024&&(bt.invalid=me[10]("sensors.settings.hardware.invalid",{default:"Please select a hardware type."})),o.$set(bt);const rt={};De[0]&512&&(rt.value=me[9].type),De[0]&512&&(rt.readonly=me[9].id&&me[9].id!==""),De[0]&64&&(rt.options=me[6]),De[0]&1024&&(rt.label=me[10]("sensors.settings.type.label",{default:"Type"})),De[0]&1024&&(rt.placeholder=me[10]("sensors.settings.type.placeholder",{default:"Select type"})),De[0]&1024&&(rt.help=me[10]("sensors.settings.type.help",{default:"Select the measurement type for this sensor."})),De[0]&1024&&(rt.invalid=me[10]("sensors.settings.type.invalid",{default:"Please select a measurement type."})),d.$set(rt);const kt={};De[0]&1024&&(kt.label=me[10]("sensors.settings.address.label",{default:"Address"})),De[0]&1024&&(kt.placeholder=me[10]("sensors.settings.address.placeholder",{default:"Enter an address"})),De[0]&1024&&(kt.help=me[10]("sensors.settings.address.help",{default:"Enter an address"})),De[0]&1024&&(kt.invalid=me[10]("sensors.settings.address.invalid",{default:"The entered address is not valid. It cannot be empty."})),f.$set(kt);const It={};De[0]&1024&&(It.label=me[10]("sensors.settings.name.label",{default:"Name"})),De[0]&1024&&(It.placeholder=me[10]("sensors.settings.name.placeholder",{default:"Enter a name"})),De[0]&1024&&(It.help=me[10]("sensors.settings.name.help",{default:"Enter an easy to remember name."})),De[0]&1024&&(It.invalid=me[10]("sensors.settings.name.invalid",{default:"The entered name is not valid. It cannot be empty."})),v.$set(It);const Xt={};De[0]&512&&(Xt.value=me[9].notification),De[0]&1024&&(Xt.label=me[10]("sensors.settings.notification.label",{default:"Notification"})),De[0]&1024&&(Xt.help=me[10]("sensors.settings.notification.help",{default:"Toggle to enable notification messages."})),k.$set(Xt);const Qt={};De[0]&1024&&(Qt.label=me[10]("sensors.settings.current.label",{default:"Current"})),De[0]&1024&&(Qt.placeholder=me[10]("sensors.settings.current.placeholder",{default:"Current value"})),De[0]&1024&&(Qt.help=me[10]("sensors.settings.current.help",{default:"The current state of the sensor."})),E.$set(Qt);const yi={};De[0]&1024&&(yi.label=me[10]("sensors.settings.alarm_min.label",{default:"Alarm min"})),De[0]&1024&&(yi.help=me[10]("sensors.settings.alarm_min.help",{default:"Enter the minimum value for the alarm."})),De[0]&1024&&(yi.invalid=me[10]("sensors.settings.alarm_min.invalid",{default:"The entered value is not valid. It needs to be number."})),D.$set(yi);const vi={};De[0]&1024&&(vi.label=me[10]("sensors.settings.alarm_max.label",{default:"Alarm max"})),De[0]&1024&&(vi.help=me[10]("sensors.settings.alarm_max.help",{default:"Enter the maximum value for the alarm."})),De[0]&1024&&(vi.invalid=me[10]("sensors.settings.alarm_max.invalid",{default:"The entered value is not valid. It needs to be number."})),F.$set(vi);const sn={};De[0]&1024&&(sn.label=me[10]("sensors.settings.limit_min.label",{default:"Limit min"})),De[0]&1024&&(sn.help=me[10]("sensors.settings.limit_min.help",{default:"Enter the minimum value that is valid."})),De[0]&1024&&(sn.invalid=me[10]("sensors.settings.limit_min.invalid",{default:"The entered value is not valid. It needs to be number."})),Z.$set(sn);const xi={};De[0]&1024&&(xi.label=me[10]("sensors.settings.limit_max.label",{default:"Limit max"})),De[0]&1024&&(xi.help=me[10]("sensors.settings.limit_max.help",{default:"Enter the maximum value that is valid."})),De[0]&1024&&(xi.invalid=me[10]("sensors.settings.limit_max.invalid",{default:"The entered value is not valid. It needs to be number."})),J.$set(xi);const Si={};De[0]&1024&&(Si.label=me[10]("sensors.settings.max_diff.label",{default:"Max diff"})),De[0]&1024&&(Si.placeholder=me[10]("sensors.settings.max_diff.placeholder",{default:"Max difference"})),De[0]&1024&&(Si.help=me[10]("sensors.settings.max_diff.help",{default:"Enter the max difference between two measurements that is valid. Enter '0' to disable."})),De[0]&1024&&(Si.invalid=me[10]("sensors.settings.max_diff.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})),re.$set(Si);const pn={};De[0]&512&&(pn.value=me[9].exclude_avg),De[0]&1024&&(pn.label=me[10]("sensors.settings.exclude_avg.label",{default:"Excl. avg"})),De[0]&1024&&(pn.help=me[10]("sensors.settings.exclude_avg.help",{default:"Exclude this sensors from average calculations."})),ke.$set(pn);const bi={};De[0]&1024&&(bi.label=me[10]("sensors.settings.calibration.offset.label",{default:"Offset"})),De[0]&1024&&(bi.help=me[10]("sensors.settings.calibration.offset.help",{default:"Enter offset for this sensor."})),De[0]&1024&&(bi.invalid=me[10]("sensors.settings.calibration.offset.invalid",{default:"The entered value is not valid. It needs to be number."})),Ae.$set(bi);const ot={};De[0]&1024&&(ot.label=me[10]("sensors.settings.calibration.chirp_min_moist.label",{default:"Minimum moist value"})),De[0]&1024&&(ot.help=me[10]("sensors.settings.calibration.chirp_min_moist.help",{default:"Enter the minimum moist value."})),De[0]&1024&&(ot.invalid=me[10]("sensors.settings.calibration.chirp_min_moist.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})),Ie.$set(ot),(!ct||De[0]&32)&&fe(Me,"d-none",me[5]!=="chirp");const Dt={};De[0]&1024&&(Dt.label=me[10]("sensors.settings.calibration.chirp_max_moist.label",{default:"Maximum moist value"})),De[0]&1024&&(Dt.help=me[10]("sensors.settings.calibration.chirp_max_moist.help",{default:"Enter the maximum moist value."})),De[0]&1024&&(Dt.invalid=me[10]("sensors.settings.calibration.chirp_max_moist.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})),$e.$set(Dt),(!ct||De[0]&32)&&fe(Be,"d-none",me[5]!=="chirp");const zn={};De[0]&128&&(zn.options=me[7]),De[0]&1024&&(zn.label=me[10]("sensors.settings.calibration.ccs811_compensation_sensors.label",{default:"Compensation sensors"})),De[0]&1024&&(zn.placeholder=me[10]("sensors.settings.calibration.ccs811_compensation_sensors.placeholder",{default:"Select compensation sensors"})),De[0]&1024&&(zn.help=me[10]("sensors.settings.calibration.ccs811_compensation_sensors.help",{default:"Select the sensors for the compensation calculation."})),Pe.$set(zn),(!ct||De[0]&32)&&fe(Ne,"d-none",me[5]!=="css811");const qn={};De[0]&1024&&(qn.label=me[10]("sensors.settings.calibration.light_threshold.label",{default:"Lights on threshold"})),De[0]&1024&&(qn.help=me[10]("sensors.settings.calibration.light_threshold.help",{default:"Enter the value when considered the lights are on."})),De[0]&1024&&(qn.invalid=me[10]("sensors.settings.calibration.light_threshold.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})),je.$set(qn),(!ct||De[0]&32)&&fe(it,"d-none",me[5]!=="light"),(!ct||De[0]&8)&&fe(e,"was-validated",me[3])},i(me){ct||(W(o.$$.fragment,me),W(d.$$.fragment,me),W(f.$$.fragment,me),W(v.$$.fragment,me),W(k.$$.fragment,me),W(E.$$.fragment,me),W(D.$$.fragment,me),W(F.$$.fragment,me),W(Z.$$.fragment,me),W(J.$$.fragment,me),W(re.$$.fragment,me),W(ke.$$.fragment,me),W(Ae.$$.fragment,me),W(Ie.$$.fragment,me),W($e.$$.fragment,me),W(Pe.$$.fragment,me),W(je.$$.fragment,me),ct=!0)},o(me){Q(o.$$.fragment,me),Q(d.$$.fragment,me),Q(f.$$.fragment,me),Q(v.$$.fragment,me),Q(k.$$.fragment,me),Q(E.$$.fragment,me),Q(D.$$.fragment,me),Q(F.$$.fragment,me),Q(Z.$$.fragment,me),Q(J.$$.fragment,me),Q(re.$$.fragment,me),Q(ke.$$.fragment,me),Q(Ae.$$.fragment,me),Q(Ie.$$.fragment,me),Q($e.$$.fragment,me),Q(Pe.$$.fragment,me),Q(je.$$.fragment,me),ct=!1},d(me){me&&H(e),ve(o),ve(d),ve(f),ve(v),ve(k),ve(E),ve(D),ve(F),ve(Z),ve(J),ve(re),ve(ke),ve(Ae),ve(Ie),ve($e),ve(Pe),ve(je),i[21](null),ze=!1,Xe()}}}function Kle(i){let e,t,n=i[10]("sensors.settings.title",{default:"Sensor settings"})+"",a,r,s,o;return s=new Ws({props:{moreInfo:"https://theyosh.github.io/TerrariumPI/setup/#sensors"}}),{c(){e=M("i"),t=X(),a=Se(n),r=X(),be(s.$$.fragment),A(e,"class","fas fa-tint mr-2")},m(l,u){j(l,e,u),j(l,t,u),j(l,a,u),j(l,r,u),ge(s,l,u),o=!0},p(l,u){(!o||u[0]&1024)&&n!==(n=l[10]("sensors.settings.title",{default:"Sensor settings"})+"")&&Ce(a,n)},i(l){o||(W(s.$$.fragment,l),o=!0)},o(l){Q(s.$$.fragment,l),o=!1},d(l){l&&(H(e),H(t),H(a),H(r)),ve(s,l)}}}function Zle(i){let e,t,n,a=i[10]("modal.general.save",{default:"Save"})+"",r,s,o,l;return{c(){e=M("button"),t=M("span"),n=X(),r=Se(a),A(t,"class","spinner-border spinner-border-sm"),A(t,"role","status"),A(t,"aria-hidden","true"),fe(t,"d-none",!i[11]),A(e,"type","button"),A(e,"class","btn btn-primary"),e.disabled=s=i[2]||i[11]},m(u,d){j(u,e,d),x(e,t),x(e,n),x(e,r),o||(l=Zt(e,"click",i[16]),o=!0)},p(u,d){d[0]&2048&&fe(t,"d-none",!u[11]),d[0]&1024&&a!==(a=u[10]("modal.general.save",{default:"Save"})+"")&&Ce(r,a),d[0]&2052&&s!==(s=u[2]||u[11])&&(e.disabled=s)},d(u){u&&H(e),o=!1,l()}}}function Xle(i){let e,t,n,a;function r(l){i[22](l)}function s(l){i[23](l)}let o={loading:i[2],$$slots:{actions:[Zle],header:[Kle],default:[Yle]},$$scope:{ctx:i}};return i[0]!==void 0&&(o.show=i[0]),i[1]!==void 0&&(o.hide=i[1]),e=new Yo({props:o}),ni.push(()=>En(e,"show",r)),ni.push(()=>En(e,"hide",s)),{c(){be(e.$$.fragment)},m(l,u){ge(e,l,u),a=!0},p(l,u){const d={};u[0]&4&&(d.loading=l[2]),u[0]&4092|u[1]&2&&(d.$$scope={dirty:u,ctx:l}),!t&&u[0]&1&&(t=!0,d.show=l[0],Sn(()=>t=!1)),!n&&u[0]&2&&(n=!0,d.hide=l[1],Sn(()=>n=!1)),e.$set(d)},i(l){a||(W(e.$$.fragment,l),a=!0)},o(l){Q(e.$$.fragment,l),a=!1},d(l){ve(e,l)}}}let Hy=!0;function Qle(i,e,t){let n,a,r;mt(i,Yi,J=>t(10,a=J));let s,o,l=!1,u=!1,d=[],c=null,h=null,f=[],m=[],g=Di({});mt(i,g,J=>t(9,n=J));let v;const b=Ya(),w=()=>{b("save")},k=J=>{c=J,c==="css811"&&m.length===0&&Nu("temperature",G=>t(7,m=G.map(te=>({value:te.id,text:te.name})))),t(6,f=[]),d.forEach(G=>{G.value===J&&t(6,f=G.types.map(te=>({value:te,text:te})))}),n.id||Ci(g,n.type="",n)},_=(J,G)=>Wt(this,null,function*(){if(t(3,u=!0),G.form.checkValidity()){t(2,l=!0),J=ha(v),J.address+="",delete J.value;try{yield k5(J,te=>J=te),wn(a("sensors.settings.save.ok.message",{default:"Sensor ''{name}'' is updated",values:{name:J.name}}),a("notification.form.save.ok.title",{default:"Save OK"})),F(),w()}catch(te){t(2,l=!1),Pi(te.message,a("notification.form.save.error.title",{default:"Save Error"}))}finally{t(3,u=!1)}}else{let te=a("sensors.settings.fields.error",{default:"Not all required fields are entered correctly."});te+=` +'`)+"'",Pi(ie,a("notification.form.save.error.title",{default:"Save Error"}))}}),{form:k,setFields:_,isSubmitting:S,createSubmitHandler:E,reset:y}=Us({onSubmit:w});mt(i,S,V=>t(10,r=V));const I=E({onSubmit:w}),C=(V,Z)=>{Wt(this,null,function*(){yield E5(ie=>t(4,d=ie.map(K=>({value:K.hardware,text:K.name})))),V&&(yield Zm(V,ie=>Ci(f,n=ie,n)),_(n)),t(2,l=!1)}),y(),Ci(f,n=ha(m),n),t(3,u=!1),t(2,l=!0),s()},D=()=>{setTimeout(()=>{t(2,l=!1)},1e3),o()};Qi(()=>{m.setAttribute("novalidate","novalidate")});const R=V=>b(V.detail);function N(V){ni[V?"unshift":"push"](()=>{m=V,t(7,m)})}function F(V){s=V,t(0,s)}function B(V){o=V,t(1,o)}return[s,o,l,u,d,c,h,m,n,a,r,f,b,k,S,I,C,D,R,N,F,B]}class qle extends Bt{constructor(e){super(),zt(this,e,Gle,Vle,Nt,{show:16,hide:17})}get show(){return this.$$.ctx[16]}get hide(){return this.$$.ctx[17]}}function Yle(i){let e,t,n,a,r,s,o,l,u,d,c,h,f,m,g,v,b,w,k,_,S,E,y,I,C,D,R,N,F,B,V,Z,ie,K,J,G,te,re,ae,ce,ke,Le,Ue,Ee,Oe,Ye,Ze,Qe,Ae,de,Me,Ie,qe,Be,$e,Je,Ne,Pe,Ve,it,je,et,_t,ct,ze,Xe;return o=new Oi({props:{name:"hardware",value:i[10].hardware,readonly:i[10].id&&i[10].id!=="",required:!0,options:i[4],label:i[11]("sensors.settings.hardware.label",{default:"Hardware"}),placeholder:i[11]("sensors.settings.hardware.placeholder",{default:"Select hardware"}),help:i[11]("sensors.settings.hardware.help",{default:"Select the hardware type for this button."}),invalid:i[11]("sensors.settings.hardware.invalid",{default:"Please select a hardware type."})}}),o.$on("change",i[20]),d=new Oi({props:{name:"type",value:i[10].type,readonly:i[10].id&&i[10].id!=="",required:!0,options:i[7],label:i[11]("sensors.settings.type.label",{default:"Type"}),placeholder:i[11]("sensors.settings.type.placeholder",{default:"Select type"}),help:i[11]("sensors.settings.type.help",{default:"Select the measurement type for this sensor."}),invalid:i[11]("sensors.settings.type.invalid",{default:"Please select a measurement type."})}}),d.$on("change",i[21]),f=new $t({props:{type:"text",name:"address",required:!0,label:i[11]("sensors.settings.address.label",{default:"Address"}),placeholder:i[11]("sensors.settings.address.placeholder",{default:"Enter an address"}),help:i[11]("sensors.settings.address.help",{default:"Enter an address"}),invalid:i[11]("sensors.settings.address.invalid",{default:"The entered address is not valid. It cannot be empty."})}}),v=new $t({props:{type:"text",name:"name",required:!0,label:i[11]("sensors.settings.name.label",{default:"Name"}),placeholder:i[11]("sensors.settings.name.placeholder",{default:"Enter a name"}),help:i[11]("sensors.settings.name.help",{default:"Enter an easy to remember name."}),invalid:i[11]("sensors.settings.name.invalid",{default:"The entered name is not valid. It cannot be empty."})}}),k=new Pr({props:{name:"notification",value:i[10].notification,label:i[11]("sensors.settings.notification.label",{default:"Notification"}),help:i[11]("sensors.settings.notification.help",{default:"Toggle to enable notification messages."})}}),E=new $t({props:{type:"text",name:"value",readonly:!0,label:i[11]("sensors.settings.current.label",{default:"Current"}),placeholder:i[11]("sensors.settings.current.placeholder",{default:"Current value"}),help:i[11]("sensors.settings.current.help",{default:"The current state of the sensor."})}}),D=new $t({props:{type:"number",name:"alarm_min",step:"0.0001",required:!0,label:i[11]("sensors.settings.alarm_min.label",{default:"Alarm min"}),help:i[11]("sensors.settings.alarm_min.help",{default:"Enter the minimum value for the alarm."}),invalid:i[11]("sensors.settings.alarm_min.invalid",{default:"The entered value is not valid. It needs to be number."})}}),F=new $t({props:{type:"number",name:"alarm_max",step:"0.0001",required:!0,label:i[11]("sensors.settings.alarm_max.label",{default:"Alarm max"}),help:i[11]("sensors.settings.alarm_max.help",{default:"Enter the maximum value for the alarm."}),invalid:i[11]("sensors.settings.alarm_max.invalid",{default:"The entered value is not valid. It needs to be number."})}}),Z=new $t({props:{type:"number",name:"limit_min",step:"0.0001",required:!0,label:i[11]("sensors.settings.limit_min.label",{default:"Limit min"}),help:i[11]("sensors.settings.limit_min.help",{default:"Enter the minimum value that is valid."}),invalid:i[11]("sensors.settings.limit_min.invalid",{default:"The entered value is not valid. It needs to be number."})}}),J=new $t({props:{type:"number",name:"limit_max",step:"0.0001",required:!0,label:i[11]("sensors.settings.limit_max.label",{default:"Limit max"}),help:i[11]("sensors.settings.limit_max.help",{default:"Enter the maximum value that is valid."}),invalid:i[11]("sensors.settings.limit_max.invalid",{default:"The entered value is not valid. It needs to be number."})}}),re=new $t({props:{type:"number",name:"max_diff",min:"0",step:"0.0001",required:!0,label:i[11]("sensors.settings.max_diff.label",{default:"Max diff"}),placeholder:i[11]("sensors.settings.max_diff.placeholder",{default:"Max difference"}),help:i[11]("sensors.settings.max_diff.help",{default:"Enter the max difference between two measurements that is valid. Enter '0' to disable."}),invalid:i[11]("sensors.settings.max_diff.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})}}),ke=new Pr({props:{name:"exclude_avg",value:i[10].exclude_avg,horizontal:!1,label:i[11]("sensors.settings.exclude_avg.label",{default:"Excl. avg"}),help:i[11]("sensors.settings.exclude_avg.help",{default:"Exclude this sensors from average calculations."})}}),Ae=new $t({props:{type:"number",name:"calibration.offset",step:"0.0001",horizontal:!1,value:"0.0",label:i[11]("sensors.settings.calibration.offset.label",{default:"Offset"}),help:i[11]("sensors.settings.calibration.offset.help",{default:"Enter offset for this sensor."}),invalid:i[11]("sensors.settings.calibration.offset.invalid",{default:"The entered value is not valid. It needs to be number."})}}),Ie=new $t({props:{type:"number",name:"calibration.chirp_min_moist",step:"0.0001",min:"0",horizontal:!1,label:i[11]("sensors.settings.calibration.chirp_min_moist.label",{default:"Minimum moist value"}),help:i[11]("sensors.settings.calibration.chirp_min_moist.help",{default:"Enter the minimum moist value."}),invalid:i[11]("sensors.settings.calibration.chirp_min_moist.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})}}),$e=new $t({props:{type:"number",name:"calibration.chirp_max_moist",step:"0.0001",min:"0",horizontal:!1,label:i[11]("sensors.settings.calibration.chirp_max_moist.label",{default:"Maximum moist value"}),help:i[11]("sensors.settings.calibration.chirp_max_moist.help",{default:"Enter the maximum moist value."}),invalid:i[11]("sensors.settings.calibration.chirp_max_moist.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})}}),Pe=new Oi({props:{name:"calibration.ccs811_compensation_sensors",multiple:!0,options:i[8],label:i[11]("sensors.settings.calibration.ccs811_compensation_sensors.label",{default:"Compensation sensors"}),placeholder:i[11]("sensors.settings.calibration.ccs811_compensation_sensors.placeholder",{default:"Select compensation sensors"}),help:i[11]("sensors.settings.calibration.ccs811_compensation_sensors.help",{default:"Select the sensors for the compensation calculation."})}}),je=new $t({props:{type:"number",name:"calibration.light_on_off_threshold",step:"0.0001",min:"0",horizontal:!1,label:i[11]("sensors.settings.calibration.light_threshold.label",{default:"Lights on threshold"}),help:i[11]("sensors.settings.calibration.light_threshold.help",{default:"Enter the value when considered the lights are on."}),invalid:i[11]("sensors.settings.calibration.light_threshold.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})}}),{c(){e=M("form"),t=M("input"),a=X(),r=M("div"),s=M("div"),be(o.$$.fragment),l=X(),u=M("div"),be(d.$$.fragment),c=X(),h=M("div"),be(f.$$.fragment),m=X(),g=M("div"),be(v.$$.fragment),b=X(),w=M("div"),be(k.$$.fragment),_=X(),S=M("div"),be(E.$$.fragment),y=X(),I=M("div"),C=M("div"),be(D.$$.fragment),R=X(),N=M("div"),be(F.$$.fragment),B=X(),V=M("div"),be(Z.$$.fragment),ie=X(),K=M("div"),be(J.$$.fragment),G=X(),te=M("div"),be(re.$$.fragment),ae=X(),ce=M("div"),be(ke.$$.fragment),Le=X(),Ue=M("div"),Ee=M("a"),Ee.innerHTML='
',Oe=X(),Ye=M("div"),Ze=M("div"),Qe=M("div"),be(Ae.$$.fragment),de=X(),Me=M("div"),be(Ie.$$.fragment),qe=X(),Be=M("div"),be($e.$$.fragment),Je=X(),Ne=M("div"),be(Pe.$$.fragment),Ve=X(),it=M("div"),be(je.$$.fragment),et=X(),_t=M("button"),_t.innerHTML="",A(t,"type","hidden"),A(t,"name","id"),t.disabled=n=i[10].id&&i[10].id!==""?null:!0,A(s,"class","col-12 col-sm-6 col-md-4 col-lg-2"),A(u,"class","col-12 col-sm-6 col-md-4 col-lg-2"),A(h,"class","col-12 col-sm-12 col-md-4 col-lg-3"),A(g,"class","col-10 col-sm-10 col-md-8 col-lg-3"),A(w,"class","col-6 col-sm-6 col-md-6 col-lg-1"),A(S,"class","col-6 col-sm-6 col-md-6 col-lg-1"),A(r,"class","row"),A(C,"class","col-6 col-sm-6 col-md-6 col-lg-2"),A(N,"class","col-6 col-sm-6 col-md-6 col-lg-2"),A(V,"class","col-6 col-sm-6 col-md-6 col-lg-2"),A(K,"class","col-6 col-sm-6 col-md-6 col-lg-2"),A(te,"class","col-6 col-sm-6 col-md-6 col-lg-2"),A(ce,"class","col-12 col-sm-12 col-md-12 col-lg-2"),A(I,"class","row"),A(Ee,"data-toggle","collapse"),A(Ee,"href","#callibration"),A(Ee,"role","button"),A(Ee,"aria-expanded","false"),A(Ee,"aria-controls","callibration"),fe(Ee,"d-none",!Hy),A(Qe,"class","col-6 col-sm-6 col-md-6 col-lg-2"),A(Me,"class","col-6 col-sm-6 col-md-6 col-lg-2"),fe(Me,"d-none",!(i[5]==="chirp"&&i[6]==="moisture")),A(Be,"class","col-6 col-sm-6 col-md-6 col-lg-2"),fe(Be,"d-none",!(i[5]==="chirp"&&i[6]==="moisture")),A(Ne,"class","col-6 col-sm-6 col-md-6 col-lg-4"),fe(Ne,"d-none",i[6]!=="css811"),A(it,"class","col-6 col-sm-6 col-md-6 col-lg-2"),fe(it,"d-none",i[6]!=="light"),A(Ze,"class","collapse row pt-3"),A(Ze,"id","callibration"),A(Ye,"class","col"),A(Ue,"class","row button_callibration"),fe(Ue,"d-block",Hy),fe(Ue,"d-none",!Hy),A(_t,"type","submit"),pi(_t,"display","none"),A(e,"class","needs-validation"),fe(e,"was-validated",i[3])},m(me,De){j(me,e,De),x(e,t),x(e,a),x(e,r),x(r,s),ge(o,s,null),x(r,l),x(r,u),ge(d,u,null),x(r,c),x(r,h),ge(f,h,null),x(r,m),x(r,g),ge(v,g,null),x(r,b),x(r,w),ge(k,w,null),x(r,_),x(r,S),ge(E,S,null),x(e,y),x(e,I),x(I,C),ge(D,C,null),x(I,R),x(I,N),ge(F,N,null),x(I,B),x(I,V),ge(Z,V,null),x(I,ie),x(I,K),ge(J,K,null),x(I,G),x(I,te),ge(re,te,null),x(I,ae),x(I,ce),ge(ke,ce,null),x(e,Le),x(e,Ue),x(Ue,Ee),x(Ue,Oe),x(Ue,Ye),x(Ye,Ze),x(Ze,Qe),ge(Ae,Qe,null),x(Ze,de),x(Ze,Me),ge(Ie,Me,null),x(Ze,qe),x(Ze,Be),ge($e,Be,null),x(Ze,Je),x(Ze,Ne),ge(Pe,Ne,null),x(Ze,Ve),x(Ze,it),ge(je,it,null),x(e,et),x(e,_t),i[22](e),ct=!0,ze||(Xe=fr(i[15].call(null,e)),ze=!0)},p(me,De){(!ct||De[0]&1024&&n!==(n=me[10].id&&me[10].id!==""?null:!0))&&(t.disabled=n);const bt={};De[0]&1024&&(bt.value=me[10].hardware),De[0]&1024&&(bt.readonly=me[10].id&&me[10].id!==""),De[0]&16&&(bt.options=me[4]),De[0]&2048&&(bt.label=me[11]("sensors.settings.hardware.label",{default:"Hardware"})),De[0]&2048&&(bt.placeholder=me[11]("sensors.settings.hardware.placeholder",{default:"Select hardware"})),De[0]&2048&&(bt.help=me[11]("sensors.settings.hardware.help",{default:"Select the hardware type for this button."})),De[0]&2048&&(bt.invalid=me[11]("sensors.settings.hardware.invalid",{default:"Please select a hardware type."})),o.$set(bt);const rt={};De[0]&1024&&(rt.value=me[10].type),De[0]&1024&&(rt.readonly=me[10].id&&me[10].id!==""),De[0]&128&&(rt.options=me[7]),De[0]&2048&&(rt.label=me[11]("sensors.settings.type.label",{default:"Type"})),De[0]&2048&&(rt.placeholder=me[11]("sensors.settings.type.placeholder",{default:"Select type"})),De[0]&2048&&(rt.help=me[11]("sensors.settings.type.help",{default:"Select the measurement type for this sensor."})),De[0]&2048&&(rt.invalid=me[11]("sensors.settings.type.invalid",{default:"Please select a measurement type."})),d.$set(rt);const kt={};De[0]&2048&&(kt.label=me[11]("sensors.settings.address.label",{default:"Address"})),De[0]&2048&&(kt.placeholder=me[11]("sensors.settings.address.placeholder",{default:"Enter an address"})),De[0]&2048&&(kt.help=me[11]("sensors.settings.address.help",{default:"Enter an address"})),De[0]&2048&&(kt.invalid=me[11]("sensors.settings.address.invalid",{default:"The entered address is not valid. It cannot be empty."})),f.$set(kt);const It={};De[0]&2048&&(It.label=me[11]("sensors.settings.name.label",{default:"Name"})),De[0]&2048&&(It.placeholder=me[11]("sensors.settings.name.placeholder",{default:"Enter a name"})),De[0]&2048&&(It.help=me[11]("sensors.settings.name.help",{default:"Enter an easy to remember name."})),De[0]&2048&&(It.invalid=me[11]("sensors.settings.name.invalid",{default:"The entered name is not valid. It cannot be empty."})),v.$set(It);const Xt={};De[0]&1024&&(Xt.value=me[10].notification),De[0]&2048&&(Xt.label=me[11]("sensors.settings.notification.label",{default:"Notification"})),De[0]&2048&&(Xt.help=me[11]("sensors.settings.notification.help",{default:"Toggle to enable notification messages."})),k.$set(Xt);const Qt={};De[0]&2048&&(Qt.label=me[11]("sensors.settings.current.label",{default:"Current"})),De[0]&2048&&(Qt.placeholder=me[11]("sensors.settings.current.placeholder",{default:"Current value"})),De[0]&2048&&(Qt.help=me[11]("sensors.settings.current.help",{default:"The current state of the sensor."})),E.$set(Qt);const yi={};De[0]&2048&&(yi.label=me[11]("sensors.settings.alarm_min.label",{default:"Alarm min"})),De[0]&2048&&(yi.help=me[11]("sensors.settings.alarm_min.help",{default:"Enter the minimum value for the alarm."})),De[0]&2048&&(yi.invalid=me[11]("sensors.settings.alarm_min.invalid",{default:"The entered value is not valid. It needs to be number."})),D.$set(yi);const vi={};De[0]&2048&&(vi.label=me[11]("sensors.settings.alarm_max.label",{default:"Alarm max"})),De[0]&2048&&(vi.help=me[11]("sensors.settings.alarm_max.help",{default:"Enter the maximum value for the alarm."})),De[0]&2048&&(vi.invalid=me[11]("sensors.settings.alarm_max.invalid",{default:"The entered value is not valid. It needs to be number."})),F.$set(vi);const sn={};De[0]&2048&&(sn.label=me[11]("sensors.settings.limit_min.label",{default:"Limit min"})),De[0]&2048&&(sn.help=me[11]("sensors.settings.limit_min.help",{default:"Enter the minimum value that is valid."})),De[0]&2048&&(sn.invalid=me[11]("sensors.settings.limit_min.invalid",{default:"The entered value is not valid. It needs to be number."})),Z.$set(sn);const xi={};De[0]&2048&&(xi.label=me[11]("sensors.settings.limit_max.label",{default:"Limit max"})),De[0]&2048&&(xi.help=me[11]("sensors.settings.limit_max.help",{default:"Enter the maximum value that is valid."})),De[0]&2048&&(xi.invalid=me[11]("sensors.settings.limit_max.invalid",{default:"The entered value is not valid. It needs to be number."})),J.$set(xi);const Si={};De[0]&2048&&(Si.label=me[11]("sensors.settings.max_diff.label",{default:"Max diff"})),De[0]&2048&&(Si.placeholder=me[11]("sensors.settings.max_diff.placeholder",{default:"Max difference"})),De[0]&2048&&(Si.help=me[11]("sensors.settings.max_diff.help",{default:"Enter the max difference between two measurements that is valid. Enter '0' to disable."})),De[0]&2048&&(Si.invalid=me[11]("sensors.settings.max_diff.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})),re.$set(Si);const pn={};De[0]&1024&&(pn.value=me[10].exclude_avg),De[0]&2048&&(pn.label=me[11]("sensors.settings.exclude_avg.label",{default:"Excl. avg"})),De[0]&2048&&(pn.help=me[11]("sensors.settings.exclude_avg.help",{default:"Exclude this sensors from average calculations."})),ke.$set(pn);const bi={};De[0]&2048&&(bi.label=me[11]("sensors.settings.calibration.offset.label",{default:"Offset"})),De[0]&2048&&(bi.help=me[11]("sensors.settings.calibration.offset.help",{default:"Enter offset for this sensor."})),De[0]&2048&&(bi.invalid=me[11]("sensors.settings.calibration.offset.invalid",{default:"The entered value is not valid. It needs to be number."})),Ae.$set(bi);const ot={};De[0]&2048&&(ot.label=me[11]("sensors.settings.calibration.chirp_min_moist.label",{default:"Minimum moist value"})),De[0]&2048&&(ot.help=me[11]("sensors.settings.calibration.chirp_min_moist.help",{default:"Enter the minimum moist value."})),De[0]&2048&&(ot.invalid=me[11]("sensors.settings.calibration.chirp_min_moist.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})),Ie.$set(ot),(!ct||De[0]&96)&&fe(Me,"d-none",!(me[5]==="chirp"&&me[6]==="moisture"));const Dt={};De[0]&2048&&(Dt.label=me[11]("sensors.settings.calibration.chirp_max_moist.label",{default:"Maximum moist value"})),De[0]&2048&&(Dt.help=me[11]("sensors.settings.calibration.chirp_max_moist.help",{default:"Enter the maximum moist value."})),De[0]&2048&&(Dt.invalid=me[11]("sensors.settings.calibration.chirp_max_moist.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})),$e.$set(Dt),(!ct||De[0]&96)&&fe(Be,"d-none",!(me[5]==="chirp"&&me[6]==="moisture"));const zn={};De[0]&256&&(zn.options=me[8]),De[0]&2048&&(zn.label=me[11]("sensors.settings.calibration.ccs811_compensation_sensors.label",{default:"Compensation sensors"})),De[0]&2048&&(zn.placeholder=me[11]("sensors.settings.calibration.ccs811_compensation_sensors.placeholder",{default:"Select compensation sensors"})),De[0]&2048&&(zn.help=me[11]("sensors.settings.calibration.ccs811_compensation_sensors.help",{default:"Select the sensors for the compensation calculation."})),Pe.$set(zn),(!ct||De[0]&64)&&fe(Ne,"d-none",me[6]!=="css811");const qn={};De[0]&2048&&(qn.label=me[11]("sensors.settings.calibration.light_threshold.label",{default:"Lights on threshold"})),De[0]&2048&&(qn.help=me[11]("sensors.settings.calibration.light_threshold.help",{default:"Enter the value when considered the lights are on."})),De[0]&2048&&(qn.invalid=me[11]("sensors.settings.calibration.light_threshold.invalid",{default:"The entered value is not valid. It needs to be number higher then {min}.",values:{min:0}})),je.$set(qn),(!ct||De[0]&64)&&fe(it,"d-none",me[6]!=="light"),(!ct||De[0]&8)&&fe(e,"was-validated",me[3])},i(me){ct||(W(o.$$.fragment,me),W(d.$$.fragment,me),W(f.$$.fragment,me),W(v.$$.fragment,me),W(k.$$.fragment,me),W(E.$$.fragment,me),W(D.$$.fragment,me),W(F.$$.fragment,me),W(Z.$$.fragment,me),W(J.$$.fragment,me),W(re.$$.fragment,me),W(ke.$$.fragment,me),W(Ae.$$.fragment,me),W(Ie.$$.fragment,me),W($e.$$.fragment,me),W(Pe.$$.fragment,me),W(je.$$.fragment,me),ct=!0)},o(me){Q(o.$$.fragment,me),Q(d.$$.fragment,me),Q(f.$$.fragment,me),Q(v.$$.fragment,me),Q(k.$$.fragment,me),Q(E.$$.fragment,me),Q(D.$$.fragment,me),Q(F.$$.fragment,me),Q(Z.$$.fragment,me),Q(J.$$.fragment,me),Q(re.$$.fragment,me),Q(ke.$$.fragment,me),Q(Ae.$$.fragment,me),Q(Ie.$$.fragment,me),Q($e.$$.fragment,me),Q(Pe.$$.fragment,me),Q(je.$$.fragment,me),ct=!1},d(me){me&&H(e),ve(o),ve(d),ve(f),ve(v),ve(k),ve(E),ve(D),ve(F),ve(Z),ve(J),ve(re),ve(ke),ve(Ae),ve(Ie),ve($e),ve(Pe),ve(je),i[22](null),ze=!1,Xe()}}}function Kle(i){let e,t,n=i[11]("sensors.settings.title",{default:"Sensor settings"})+"",a,r,s,o;return s=new Ws({props:{moreInfo:"https://theyosh.github.io/TerrariumPI/setup/#sensors"}}),{c(){e=M("i"),t=X(),a=Se(n),r=X(),be(s.$$.fragment),A(e,"class","fas fa-tint mr-2")},m(l,u){j(l,e,u),j(l,t,u),j(l,a,u),j(l,r,u),ge(s,l,u),o=!0},p(l,u){(!o||u[0]&2048)&&n!==(n=l[11]("sensors.settings.title",{default:"Sensor settings"})+"")&&Ce(a,n)},i(l){o||(W(s.$$.fragment,l),o=!0)},o(l){Q(s.$$.fragment,l),o=!1},d(l){l&&(H(e),H(t),H(a),H(r)),ve(s,l)}}}function Zle(i){let e,t,n,a=i[11]("modal.general.save",{default:"Save"})+"",r,s,o,l;return{c(){e=M("button"),t=M("span"),n=X(),r=Se(a),A(t,"class","spinner-border spinner-border-sm"),A(t,"role","status"),A(t,"aria-hidden","true"),fe(t,"d-none",!i[12]),A(e,"type","button"),A(e,"class","btn btn-primary"),e.disabled=s=i[2]||i[12]},m(u,d){j(u,e,d),x(e,t),x(e,n),x(e,r),o||(l=Zt(e,"click",i[17]),o=!0)},p(u,d){d[0]&4096&&fe(t,"d-none",!u[12]),d[0]&2048&&a!==(a=u[11]("modal.general.save",{default:"Save"})+"")&&Ce(r,a),d[0]&4100&&s!==(s=u[2]||u[12])&&(e.disabled=s)},d(u){u&&H(e),o=!1,l()}}}function Xle(i){let e,t,n,a;function r(l){i[23](l)}function s(l){i[24](l)}let o={loading:i[2],$$slots:{actions:[Zle],header:[Kle],default:[Yle]},$$scope:{ctx:i}};return i[0]!==void 0&&(o.show=i[0]),i[1]!==void 0&&(o.hide=i[1]),e=new Yo({props:o}),ni.push(()=>En(e,"show",r)),ni.push(()=>En(e,"hide",s)),{c(){be(e.$$.fragment)},m(l,u){ge(e,l,u),a=!0},p(l,u){const d={};u[0]&4&&(d.loading=l[2]),u[0]&8188|u[1]&2&&(d.$$scope={dirty:u,ctx:l}),!t&&u[0]&1&&(t=!0,d.show=l[0],Sn(()=>t=!1)),!n&&u[0]&2&&(n=!0,d.hide=l[1],Sn(()=>n=!1)),e.$set(d)},i(l){a||(W(e.$$.fragment,l),a=!0)},o(l){Q(e.$$.fragment,l),a=!1},d(l){ve(e,l)}}}let Hy=!0;function Qle(i,e,t){let n,a,r;mt(i,Yi,J=>t(11,a=J));let s,o,l=!1,u=!1,d=[],c=null,h=null,f=[],m=[],g=Di({});mt(i,g,J=>t(10,n=J));let v;const b=Ya(),w=()=>{b("save")},k=J=>{t(5,c=J),c==="css811"&&m.length===0&&Nu("temperature",G=>t(8,m=G.map(te=>({value:te.id,text:te.name})))),t(7,f=[]),d.forEach(G=>{G.value===J&&t(7,f=G.types.map(te=>({value:te,text:te})))}),n.id||Ci(g,n.type="",n)},_=(J,G)=>Wt(this,null,function*(){if(t(3,u=!0),G.form.checkValidity()){t(2,l=!0),J=ha(v),J.address+="",delete J.value;try{yield k5(J,te=>J=te),wn(a("sensors.settings.save.ok.message",{default:"Sensor ''{name}'' is updated",values:{name:J.name}}),a("notification.form.save.ok.title",{default:"Save OK"})),F(),w()}catch(te){t(2,l=!1),Pi(te.message,a("notification.form.save.error.title",{default:"Save Error"}))}finally{t(3,u=!1)}}else{let te=a("sensors.settings.fields.error",{default:"Not all required fields are entered correctly."});te+=` '`+ko(v).join(`' -'`)+"'",Pi(te,a("notification.form.save.error.title",{default:"Save Error"}))}}),{form:S,data:E,setFields:y,isSubmitting:I,createSubmitHandler:C,reset:D}=Us({onSubmit:_});mt(i,I,J=>t(11,r=J));const R=C({onSubmit:_}),N=(J,G)=>{Wt(this,null,function*(){yield _5(te=>t(4,d=te.map(re=>({value:re.hardware,text:re.name,types:re.types})))),J&&(yield Nu(J,te=>Ci(g,n=te,n)),y(n)),t(2,l=!1)}),D(),Ci(g,n=ha(v),n),t(3,u=!1),t(2,l=!0),s()},F=()=>{setTimeout(()=>{t(2,l=!1)},1e3),o()};Qi(()=>{v.setAttribute("novalidate","novalidate")});const B=J=>k(J.detail),V=J=>t(5,h=J.detail);function Z(J){ni[J?"unshift":"push"](()=>{v=J,t(8,v)})}function ie(J){s=J,t(0,s)}function K(J){o=J,t(1,o)}return[s,o,l,u,d,h,f,m,v,n,a,r,g,k,S,I,R,N,F,B,V,Z,ie,K]}class Jle extends Bt{constructor(e){super(),zt(this,e,Qle,Xle,Nt,{show:17,hide:18},null,[-1,-1])}get show(){return this.$$.ctx[17]}get hide(){return this.$$.ctx[18]}}function eue(i){let e,t,n,a,r,s,o,l,u,d;return r=new Oi({props:{name:"sensors",value:i[5],multiple:!0,required:!0,options:i[4],label:i[7]("webcams.markers.settings.doors.label",{default:"Sensors"}),help:i[7]("webcams.markers.settings.doors.help",{default:"Select the senors you want to show."}),invalid:i[7]("webcams.markers.settings.doors.invalid",{default:"Make a choice."})}}),{c(){e=M("form"),t=M("input"),a=X(),be(r.$$.fragment),s=X(),o=M("button"),o.innerHTML="",A(t,"type","hidden"),A(t,"name","markerid"),t.disabled=n=!i[6],t.value="",A(o,"type","submit"),pi(o,"display","none"),A(e,"class","form-horizontal needs-validation"),fe(e,"was-validated",i[3])},m(c,h){j(c,e,h),x(e,t),x(e,a),ge(r,e,null),x(e,s),x(e,o),i[15](e),l=!0,u||(d=fr(i[10].call(null,e)),u=!0)},p(c,h){(!l||h&64&&n!==(n=!c[6]))&&(t.disabled=n);const f={};h&32&&(f.value=c[5]),h&16&&(f.options=c[4]),h&128&&(f.label=c[7]("webcams.markers.settings.doors.label",{default:"Sensors"})),h&128&&(f.help=c[7]("webcams.markers.settings.doors.help",{default:"Select the senors you want to show."})),h&128&&(f.invalid=c[7]("webcams.markers.settings.doors.invalid",{default:"Make a choice."})),r.$set(f),(!l||h&8)&&fe(e,"was-validated",c[3])},i(c){l||(W(r.$$.fragment,c),l=!0)},o(c){Q(r.$$.fragment,c),l=!1},d(c){c&&H(e),ve(r),i[15](null),u=!1,d()}}}function tue(i){let e,t,n=i[7]("webcams.markers.settings.title",{default:"Sensors"})+"",a,r,s,o;return s=new Ws({}),{c(){e=M("i"),t=X(),a=Se(n),r=X(),be(s.$$.fragment),A(e,"class","fas fa-marker mr-2")},m(l,u){j(l,e,u),j(l,t,u),j(l,a,u),j(l,r,u),ge(s,l,u),o=!0},p(l,u){(!o||u&128)&&n!==(n=l[7]("webcams.markers.settings.title",{default:"Sensors"})+"")&&Ce(a,n)},i(l){o||(W(s.$$.fragment,l),o=!0)},o(l){Q(s.$$.fragment,l),o=!1},d(l){l&&(H(e),H(t),H(a),H(r)),ve(s,l)}}}function yM(i){let e,t=i[7]("webcams.markers.settings.delete",{default:"Delete"})+"",n,a,r;return{c(){e=M("button"),n=Se(t),A(e,"type","button"),A(e,"class","btn btn-danger mr-5")},m(s,o){j(s,e,o),x(e,n),a||(r=Zt(e,"click",i[14]),a=!0)},p(s,o){o&128&&t!==(t=s[7]("webcams.markers.settings.delete",{default:"Delete"})+"")&&Ce(n,t)},d(s){s&&H(e),a=!1,r()}}}function iue(i){let e,t,n=i[7]("modal.general.close",{default:"Close "})+"",a,r,s,o,l,u,d=i[7]("modal.general.save",{default:"Save"})+"",c,h,f,m=i[6]&&yM(i);return{c(){e=M("div"),t=M("button"),a=Se(n),r=X(),m&&m.c(),s=X(),o=M("button"),l=M("span"),u=X(),c=Se(d),A(t,"type","button"),A(t,"class","btn btn-default"),A(l,"class","spinner-border spinner-border-sm"),A(l,"role","status"),A(l,"aria-hidden","true"),fe(l,"d-none",!i[8]),A(o,"type","button"),A(o,"class","btn btn-primary ml-3"),o.disabled=i[8],A(e,"class","d-flex justify-content-between w-100")},m(g,v){j(g,e,v),x(e,t),x(t,a),x(e,r),m&&m.m(e,null),x(e,s),x(e,o),x(o,l),x(o,u),x(o,c),h||(f=[Zt(t,"click",i[0]),Zt(o,"click",i[12])],h=!0)},p(g,v){v&128&&n!==(n=g[7]("modal.general.close",{default:"Close "})+"")&&Ce(a,n),g[6]?m?m.p(g,v):(m=yM(g),m.c(),m.m(e,s)):m&&(m.d(1),m=null),v&256&&fe(l,"d-none",!g[8]),v&128&&d!==(d=g[7]("modal.general.save",{default:"Save"})+"")&&Ce(c,d),v&256&&(o.disabled=g[8])},d(g){g&&H(e),m&&m.d(),h=!1,ga(f)}}}function nue(i){let e,t,n={$$slots:{actions:[iue],header:[tue],default:[eue]},$$scope:{ctx:i}};return e=new qc({props:n}),i[16](e),{c(){be(e.$$.fragment)},m(a,r){ge(e,a,r),t=!0},p(a,[r]){const s={};r&1049084&&(s.$$scope={dirty:r,ctx:a}),e.$set(s)},i(a){t||(W(e.$$.fragment,a),t=!0)},o(a){Q(e.$$.fragment,a),t=!1},d(a){i[16](null),ve(e,a)}}}function aue(i,e,t){let n,a;mt(i,Yi,y=>t(7,n=y));let r,s,o=!1,l=[],u=[],d=!1;const{setMarker:c,deleteMarker:h}=Kn("webcamMarker"),f=(y,I)=>Wt(this,null,function*(){t(3,o=!0),I.form.checkValidity()?(y=ha(s),c(y),k()):Pi("Error saving markers","ERROR")}),{form:m,isSubmitting:g,createSubmitHandler:v}=Us({onSubmit:f});mt(i,g,y=>t(8,a=y));const b=v({onSubmit:f}),w=y=>{t(6,d=!!y),t(5,u=d?y.target.options.sensors:[]),t(2,s.elements.markerid.value=d?y.target._leaflet_id:"",s),Nu(!1,I=>{t(4,l=I.map(C=>(ec(C),{value:C.id,text:C.name})))}),t(3,o=!1),r.show()},k=()=>{r.hide()};Qi(()=>{s.setAttribute("novalidate","novalidate")});const _=()=>h(s.elements.markerid.value);function S(y){ni[y?"unshift":"push"](()=>{s=y,t(2,s)})}function E(y){ni[y?"unshift":"push"](()=>{r=y,t(1,r)})}return[k,r,s,o,l,u,d,n,a,h,m,g,b,w,_,S,E]}class rue extends Bt{constructor(e){super(),zt(this,e,aue,nue,Nt,{show:13,hide:0})}get show(){return this.$$.ctx[13]}get hide(){return this.$$.ctx[0]}}function wM(i){let e,t,n,a={webcam:i[12],edit:!0};return t=new mP({props:a}),i[28](t),{c(){e=M("div"),be(t.$$.fragment),A(e,"class","embed-responsive-item")},m(r,s){j(r,e,s),ge(t,e,null),n=!0},p(r,s){const o={};s[0]&4096&&(o.webcam=r[12]),t.$set(o)},i(r){n||(W(t.$$.fragment,r),n=!0)},o(r){Q(t.$$.fragment,r),n=!1},d(r){r&&H(e),i[28](null),ve(t)}}}function sue(i){let e,t,n,a,r,s,o,l,u,d,c,h,f,m,g,v,b,w,k,_,S,E,y,I,C,D,R,N,F,B,V,Z,ie,K,J,G,te,re,ae,ce,ke,Le,Ue,Ee,Oe,Ye=i[13]("webcams.settings.preview.label",{default:"Preview"})+"",Ze,Qe,Ae,de,Me,Ie,qe,Be,$e,Je,Ne,Pe,Ve,it,je,et,_t,ct,ze,Xe,me,De,bt,rt,kt,It,Xt,Qt,yi,vi,sn,xi,Si,pn;c=new Oi({props:{name:"hardware",value:i[12].hardware,readonly:i[12].id&&i[12].id!=="",required:!0,options:i[4],label:i[13]("webcams.settings.hardware.label",{default:"Hardware"}),placeholder:i[13]("webcams.settings.hardware.placeholder",{default:"Select hardware"}),help:i[13]("webcams.settings.hardware.help",{default:"Select the hardware type for this button."}),invalid:i[13]("webcams.settings.hardware.invalid",{default:"Please select a hardware type."})}}),c.$on("change",i[26]),m=new $t({props:{type:"text",name:"address",required:!0,readonly:["rpicam","rpicam-live"].indexOf(i[9])!==-1,label:i[13]("webcams.settings.address.label",{default:"Address"}),placeholder:i[13]("webcams.settings.address.placeholder",{default:"Enter an address"}),help:i[13]("webcams.settings.address.help",{default:"For more information see online."}),invalid:i[13]("webcams.settings.address.invalid",{default:"The entered address is not valid. It cannot be empty."})}}),b=new $t({props:{type:"text",name:"name",required:!0,label:i[13]("webcams.settings.name.label",{default:"Name"}),placeholder:i[13]("webcams.settings.name.placeholder",{default:"Enter a name"}),help:i[13]("webcams.settings.name.help",{default:"Enter an easy to remember name."}),invalid:i[13]("webcams.settings.name.invalid",{default:"The entered name is not valid. It cannot be empty."})}}),y=new $t({props:{type:"number",min:"0",step:"1",name:"width",required:!0,label:i[13]("webcams.settings.width.label",{default:"Width"}),help:i[13]("webcams.settings.width.help",{default:"Enter the resolution width in pixels."}),invalid:i[13]("webcams.settings.width.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),N=new $t({props:{type:"number",min:"0",step:"1",name:"height",required:!0,label:i[13]("webcams.settings.height.label",{default:"Height"}),help:i[13]("webcams.settings.height.help",{default:"Enter the resolution height in pixels."}),invalid:i[13]("webcams.settings.height.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),V=new Oi({props:{name:"rotation",value:i[12].rotation,required:!0,options:i[16],label:i[13]("webcams.settings.rotation.label",{default:"Rotation"}),placeholder:i[13]("webcams.settings.rotation.placeholder",{default:"Select rotation"}),help:i[13]("webcams.settings.rotation.help",{default:"Select a rotation."}),invalid:i[13]("webcams.settings.rotation.invalid",{default:"Please make a choice."})}}),K=new Oi({props:{name:"awb",value:i[12].awb,required:!0,options:i[17],label:i[13]("webcams.settings.awb.label",{default:"White balance"}),placeholder:i[13]("webcams.settings.awb.placeholder",{default:"Select white balance"}),help:i[13]("webcams.settings.awb.help",{default:"Select a white balance."}),invalid:i[13]("webcams.settings.awb.invalid",{default:"Please make a choice."})}}),re=new Oi({props:{name:"archive.state",value:i[12].archive?i[12].archive.state:null,options:i[18],label:i[13]("webcams.settings.archive.state.label",{default:"Archiving"}),placeholder:i[13]("webcams.settings.archive.state.placeholder",{default:"Select archiving"}),help:i[13]("webcams.settings.archive.state.help",{default:"Select the duration between archived images."}),invalid:i[13]("webcams.settings.archive.state.invalid",{default:"Please make a choice."})}}),re.$on("change",i[27]),ke=new Oi({props:{name:"flash",value:i[12].flash,multiple:!0,options:i[5],label:i[13]("webcams.settings.archive.flash.label",{default:"Flash"}),placeholder:i[13]("webcams.settings.archive.flash.placeholder",{default:"Select optional relay for flash"}),help:i[13]("webcams.settings.archive.flash.help",{default:"Select a relay that will act as a flasher."}),invalid:i[13]("webcams.settings.archive.flash.invalid",{default:"Please make a choice."})}});let bi=i[12].id&&wM(i);return Je=new Oi({props:{name:"archive.light",value:i[12].archive?i[12].archive.light:"",options:[{value:"ignore",text:i[13]("webcams.settings.archive.light.options.ignore",{default:"Ignore"})},{value:"on",text:i[13]("webcams.settings.archive.light.options.on",{default:"When on"})},{value:"off",text:i[13]("webcams.settings.archive.light.options.off",{default:"When off"})}],label:i[13]("webcams.settings.archive.light.label",{default:"Archive light state"}),placeholder:i[13]("webcams.settings.archive.light.placeholder",{default:"Select archive light state"}),help:i[13]("webcams.settings.archive.light.help",{default:"Light status for taking an archive image."}),invalid:i[13]("webcams.settings.archive.light.invalid",{default:"Please make a choice."})}}),Ve=new Oi({props:{name:"archive.door",value:i[12].archive?i[12].archive.door:"",options:[{value:"ignore",text:i[13]("webcams.settings.archive.door.options.ignore",{default:"Ignore"})},{value:"close",text:i[13]("webcams.settings.archive.door.options.close",{default:"Close"})},{value:"open",text:i[13]("webcams.settings.archive.door.options.open",{default:"Open"})}],label:i[13]("webcams.settings.archive.door.label",{default:"Archive door state"}),placeholder:i[13]("webcams.settings.archive.door.placeholder",{default:"Select archive door state"}),help:i[13]("webcams.settings.archive.door.help",{default:"Door status for taking an archive image."}),invalid:i[13]("webcams.settings.archive.door.invalid",{default:"Please make a choice."})}}),et=new $t({props:{type:"number",name:"archive.history",step:"1",min:"0",label:i[13]("webcams.settings.archive.history.label",{default:"Archive history in days"}),placeholder:i[13]("webcams.settings.archive.history.placeholder",{default:"Enter number"}),help:i[13]("webcams.settings.archive.history.help",{default:"Enter the amount of days to keep for history."}),invalid:i[13]("webcams.settings.archive.history.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),Xe=new Oi({props:{name:"motion.boxes",value:i[12].motion?i[12].motion.boxes:"",required:i[7],options:[{value:"-1",text:i[13]("webcams.settings.motion.boxes.options.none",{default:"None"})},{value:"red",text:i[13]("webcams.settings.motion.boxes.options.red",{default:"Red"})},{value:"green",text:i[13]("webcams.settings.motion.boxes.options.green",{default:"Green"})},{value:"blue",text:i[13]("webcams.settings.motion.boxes.options.blue",{default:"Blue"})}],label:i[13]("webcams.settings.motion.boxes.label",{default:"Show motion boxes"}),placeholder:i[13]("webcams.settings.motion.boxes.placeholder",{default:"Show the motion boxes"}),help:i[13]("webcams.settings.motion.boxes.help",{default:"Show motion boxes on the archived images."}),invalid:i[13]("webcams.settings.motion.boxes.invalid",{default:"Please make a choice."})}}),bt=new $t({props:{type:"number",name:"motion.threshold",step:"1",min:"0",required:i[7],label:i[13]("webcams.settings.motion.threshold.label",{default:"Motion delta threshold"}),placeholder:i[13]("webcams.settings.motion.threshold.placeholder",{default:"Enter number"}),help:i[13]("webcams.settings.motion.threshold.help",{default:"Enter the motion threshold."}),invalid:i[13]("webcams.settings.motion.threshold.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),It=new $t({props:{type:"number",name:"motion.area",min:"0",required:i[7],label:i[13]("webcams.settings.motion.area.label",{default:"Motion minimum area"}),placeholder:i[13]("webcams.settings.motion.area.placeholder",{default:"Enter number"}),help:i[13]("webcams.settings.motion.area.help",{default:"Enter an area size."}),invalid:i[13]("webcams.settings.motion.area.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),yi=new Oi({props:{name:"motion.frame",value:i[12].motion?i[12].motion.frame:"",required:i[7],options:[{value:"last",text:i[13]("webcams.settings.motion.frame.options.last",{default:"Last frame"})},{value:"archived",text:i[13]("webcams.settings.motion.frame.options.archived",{default:"Last archived frame"})}],label:i[13]("webcams.settings.motion.frame.label",{default:"Motion comparison frame"}),placeholder:i[13]("webcams.settings.motion.frame.placeholder",{default:"Select which frame to comparison"}),help:i[13]("webcams.settings.motion.frame.help",{default:"Which frame to use for motion detection."}),invalid:i[13]("webcams.settings.motion.frame.invalid",{default:"Please make a choice."})}}),{c(){e=M("form"),t=M("input"),a=X(),r=M("input"),s=X(),o=M("div"),l=M("div"),u=M("div"),d=M("div"),be(c.$$.fragment),h=X(),f=M("div"),be(m.$$.fragment),g=X(),v=M("div"),be(b.$$.fragment),w=X(),k=M("div"),_=M("div"),S=M("div"),E=M("div"),be(y.$$.fragment),I=X(),C=M("div"),C.textContent="X",D=X(),R=M("div"),be(N.$$.fragment),F=X(),B=M("div"),be(V.$$.fragment),Z=X(),ie=M("div"),be(K.$$.fragment),J=X(),G=M("div"),te=M("div"),be(re.$$.fragment),ae=X(),ce=M("div"),be(ke.$$.fragment),Le=X(),Ue=M("div"),Ee=M("div"),Oe=M("label"),Ze=Se(Ye),Qe=X(),Ae=M("div"),de=M("img"),Ie=X(),bi&&bi.c(),qe=X(),Be=M("div"),$e=M("div"),be(Je.$$.fragment),Ne=X(),Pe=M("div"),be(Ve.$$.fragment),it=X(),je=M("div"),be(et.$$.fragment),_t=X(),ct=M("div"),ze=M("div"),be(Xe.$$.fragment),me=X(),De=M("div"),be(bt.$$.fragment),rt=X(),kt=M("div"),be(It.$$.fragment),Xt=X(),Qt=M("div"),be(yi.$$.fragment),vi=X(),sn=M("button"),sn.innerHTML="",A(t,"type","hidden"),A(t,"name","id"),t.disabled=n=i[12].id&&i[12].id!==""?null:!0,A(r,"type","hidden"),A(r,"name","markers"),r.readOnly="readonly",A(d,"class","col-12 col-sm-12 col-md-3 col-lg-4"),A(f,"class","col-12 col-sm-12 col-md-5 col-lg-4"),A(v,"class","col-12 col-sm-12 col-md-4 col-lg-4"),A(u,"class","row"),A(E,"class","col-5"),A(C,"class","col-2 pt-5 text-center text-bold"),A(R,"class","col-5"),A(S,"class","row"),A(_,"class","col-12 col-sm-12 col-md-6 col-lg-6"),A(B,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(ie,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(k,"class","row"),A(te,"class","col-6 col-sm-6 col-md-6 col-lg-6"),A(ce,"class","col-6 col-sm-6 col-md-6 col-lg-6"),A(G,"class","row"),A(l,"class","col-12 col-sm-12 col-md-12 col-lg-7"),A(Oe,"for","button_address"),Ts(de.src,Me=i[12].raw_image?`${Ia}/${i[12].raw_image}`:"img/webcam_offline.png")||A(de,"src",Me),A(de,"class","img-fluid embed-responsive-item"),pi(de,"position","absolute"),A(de,"alt","Offline preview"),A(Ae,"class","embed-responsive embed-responsive-16by9"),A(Ee,"class","form-group"),A(Ue,"class","col-12 col-sm-12 col-md-12 col-lg-5"),A(o,"class","row"),A($e,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(Pe,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(je,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(Be,"class","row"),fe(Be,"d-none",!i[8]),A(ze,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(De,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(kt,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(Qt,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(ct,"class","row"),fe(ct,"d-none",!i[7]),A(sn,"type","submit"),pi(sn,"display","none"),A(e,"class","needs-validation"),fe(e,"was-validated",i[3])},m(ot,Dt){j(ot,e,Dt),x(e,t),x(e,a),x(e,r),x(e,s),x(e,o),x(o,l),x(l,u),x(u,d),ge(c,d,null),x(u,h),x(u,f),ge(m,f,null),x(u,g),x(u,v),ge(b,v,null),x(l,w),x(l,k),x(k,_),x(_,S),x(S,E),ge(y,E,null),x(S,I),x(S,C),x(S,D),x(S,R),ge(N,R,null),x(k,F),x(k,B),ge(V,B,null),x(k,Z),x(k,ie),ge(K,ie,null),x(l,J),x(l,G),x(G,te),ge(re,te,null),x(G,ae),x(G,ce),ge(ke,ce,null),x(o,Le),x(o,Ue),x(Ue,Ee),x(Ee,Oe),x(Oe,Ze),x(Ee,Qe),x(Ee,Ae),x(Ae,de),x(Ae,Ie),bi&&bi.m(Ae,null),x(e,qe),x(e,Be),x(Be,$e),ge(Je,$e,null),x(Be,Ne),x(Be,Pe),ge(Ve,Pe,null),x(Be,it),x(Be,je),ge(et,je,null),x(e,_t),x(e,ct),x(ct,ze),ge(Xe,ze,null),x(ct,me),x(ct,De),ge(bt,De,null),x(ct,rt),x(ct,kt),ge(It,kt,null),x(ct,Xt),x(ct,Qt),ge(yi,Qt,null),x(e,vi),x(e,sn),i[29](e),xi=!0,Si||(pn=fr(i[21].call(null,e)),Si=!0)},p(ot,Dt){(!xi||Dt[0]&4096&&n!==(n=ot[12].id&&ot[12].id!==""?null:!0))&&(t.disabled=n);const zn={};Dt[0]&4096&&(zn.value=ot[12].hardware),Dt[0]&4096&&(zn.readonly=ot[12].id&&ot[12].id!==""),Dt[0]&16&&(zn.options=ot[4]),Dt[0]&8192&&(zn.label=ot[13]("webcams.settings.hardware.label",{default:"Hardware"})),Dt[0]&8192&&(zn.placeholder=ot[13]("webcams.settings.hardware.placeholder",{default:"Select hardware"})),Dt[0]&8192&&(zn.help=ot[13]("webcams.settings.hardware.help",{default:"Select the hardware type for this button."})),Dt[0]&8192&&(zn.invalid=ot[13]("webcams.settings.hardware.invalid",{default:"Please select a hardware type."})),c.$set(zn);const qn={};Dt[0]&512&&(qn.readonly=["rpicam","rpicam-live"].indexOf(ot[9])!==-1),Dt[0]&8192&&(qn.label=ot[13]("webcams.settings.address.label",{default:"Address"})),Dt[0]&8192&&(qn.placeholder=ot[13]("webcams.settings.address.placeholder",{default:"Enter an address"})),Dt[0]&8192&&(qn.help=ot[13]("webcams.settings.address.help",{default:"For more information see online."})),Dt[0]&8192&&(qn.invalid=ot[13]("webcams.settings.address.invalid",{default:"The entered address is not valid. It cannot be empty."})),m.$set(qn);const Qa={};Dt[0]&8192&&(Qa.label=ot[13]("webcams.settings.name.label",{default:"Name"})),Dt[0]&8192&&(Qa.placeholder=ot[13]("webcams.settings.name.placeholder",{default:"Enter a name"})),Dt[0]&8192&&(Qa.help=ot[13]("webcams.settings.name.help",{default:"Enter an easy to remember name."})),Dt[0]&8192&&(Qa.invalid=ot[13]("webcams.settings.name.invalid",{default:"The entered name is not valid. It cannot be empty."})),b.$set(Qa);const Aa={};Dt[0]&8192&&(Aa.label=ot[13]("webcams.settings.width.label",{default:"Width"})),Dt[0]&8192&&(Aa.help=ot[13]("webcams.settings.width.help",{default:"Enter the resolution width in pixels."})),Dt[0]&8192&&(Aa.invalid=ot[13]("webcams.settings.width.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),y.$set(Aa);const Ja={};Dt[0]&8192&&(Ja.label=ot[13]("webcams.settings.height.label",{default:"Height"})),Dt[0]&8192&&(Ja.help=ot[13]("webcams.settings.height.help",{default:"Enter the resolution height in pixels."})),Dt[0]&8192&&(Ja.invalid=ot[13]("webcams.settings.height.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),N.$set(Ja);const fa={};Dt[0]&4096&&(fa.value=ot[12].rotation),Dt[0]&8192&&(fa.label=ot[13]("webcams.settings.rotation.label",{default:"Rotation"})),Dt[0]&8192&&(fa.placeholder=ot[13]("webcams.settings.rotation.placeholder",{default:"Select rotation"})),Dt[0]&8192&&(fa.help=ot[13]("webcams.settings.rotation.help",{default:"Select a rotation."})),Dt[0]&8192&&(fa.invalid=ot[13]("webcams.settings.rotation.invalid",{default:"Please make a choice."})),V.$set(fa);const _n={};Dt[0]&4096&&(_n.value=ot[12].awb),Dt[0]&8192&&(_n.label=ot[13]("webcams.settings.awb.label",{default:"White balance"})),Dt[0]&8192&&(_n.placeholder=ot[13]("webcams.settings.awb.placeholder",{default:"Select white balance"})),Dt[0]&8192&&(_n.help=ot[13]("webcams.settings.awb.help",{default:"Select a white balance."})),Dt[0]&8192&&(_n.invalid=ot[13]("webcams.settings.awb.invalid",{default:"Please make a choice."})),K.$set(_n);const li={};Dt[0]&4096&&(li.value=ot[12].archive?ot[12].archive.state:null),Dt[0]&8192&&(li.label=ot[13]("webcams.settings.archive.state.label",{default:"Archiving"})),Dt[0]&8192&&(li.placeholder=ot[13]("webcams.settings.archive.state.placeholder",{default:"Select archiving"})),Dt[0]&8192&&(li.help=ot[13]("webcams.settings.archive.state.help",{default:"Select the duration between archived images."})),Dt[0]&8192&&(li.invalid=ot[13]("webcams.settings.archive.state.invalid",{default:"Please make a choice."})),re.$set(li);const ra={};Dt[0]&4096&&(ra.value=ot[12].flash),Dt[0]&32&&(ra.options=ot[5]),Dt[0]&8192&&(ra.label=ot[13]("webcams.settings.archive.flash.label",{default:"Flash"})),Dt[0]&8192&&(ra.placeholder=ot[13]("webcams.settings.archive.flash.placeholder",{default:"Select optional relay for flash"})),Dt[0]&8192&&(ra.help=ot[13]("webcams.settings.archive.flash.help",{default:"Select a relay that will act as a flasher."})),Dt[0]&8192&&(ra.invalid=ot[13]("webcams.settings.archive.flash.invalid",{default:"Please make a choice."})),ke.$set(ra),(!xi||Dt[0]&8192)&&Ye!==(Ye=ot[13]("webcams.settings.preview.label",{default:"Preview"})+"")&&Ce(Ze,Ye),(!xi||Dt[0]&4096&&!Ts(de.src,Me=ot[12].raw_image?`${Ia}/${ot[12].raw_image}`:"img/webcam_offline.png"))&&A(de,"src",Me),ot[12].id?bi?(bi.p(ot,Dt),Dt[0]&4096&&W(bi,1)):(bi=wM(ot),bi.c(),W(bi,1),bi.m(Ae,null)):bi&&(Rt(),Q(bi,1,1,()=>{bi=null}),Ft());const Ga={};Dt[0]&4096&&(Ga.value=ot[12].archive?ot[12].archive.light:""),Dt[0]&8192&&(Ga.options=[{value:"ignore",text:ot[13]("webcams.settings.archive.light.options.ignore",{default:"Ignore"})},{value:"on",text:ot[13]("webcams.settings.archive.light.options.on",{default:"When on"})},{value:"off",text:ot[13]("webcams.settings.archive.light.options.off",{default:"When off"})}]),Dt[0]&8192&&(Ga.label=ot[13]("webcams.settings.archive.light.label",{default:"Archive light state"})),Dt[0]&8192&&(Ga.placeholder=ot[13]("webcams.settings.archive.light.placeholder",{default:"Select archive light state"})),Dt[0]&8192&&(Ga.help=ot[13]("webcams.settings.archive.light.help",{default:"Light status for taking an archive image."})),Dt[0]&8192&&(Ga.invalid=ot[13]("webcams.settings.archive.light.invalid",{default:"Please make a choice."})),Je.$set(Ga);const za={};Dt[0]&4096&&(za.value=ot[12].archive?ot[12].archive.door:""),Dt[0]&8192&&(za.options=[{value:"ignore",text:ot[13]("webcams.settings.archive.door.options.ignore",{default:"Ignore"})},{value:"close",text:ot[13]("webcams.settings.archive.door.options.close",{default:"Close"})},{value:"open",text:ot[13]("webcams.settings.archive.door.options.open",{default:"Open"})}]),Dt[0]&8192&&(za.label=ot[13]("webcams.settings.archive.door.label",{default:"Archive door state"})),Dt[0]&8192&&(za.placeholder=ot[13]("webcams.settings.archive.door.placeholder",{default:"Select archive door state"})),Dt[0]&8192&&(za.help=ot[13]("webcams.settings.archive.door.help",{default:"Door status for taking an archive image."})),Dt[0]&8192&&(za.invalid=ot[13]("webcams.settings.archive.door.invalid",{default:"Please make a choice."})),Ve.$set(za);const Mr={};Dt[0]&8192&&(Mr.label=ot[13]("webcams.settings.archive.history.label",{default:"Archive history in days"})),Dt[0]&8192&&(Mr.placeholder=ot[13]("webcams.settings.archive.history.placeholder",{default:"Enter number"})),Dt[0]&8192&&(Mr.help=ot[13]("webcams.settings.archive.history.help",{default:"Enter the amount of days to keep for history."})),Dt[0]&8192&&(Mr.invalid=ot[13]("webcams.settings.archive.history.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),et.$set(Mr),(!xi||Dt[0]&256)&&fe(Be,"d-none",!ot[8]);const Ba={};Dt[0]&4096&&(Ba.value=ot[12].motion?ot[12].motion.boxes:""),Dt[0]&128&&(Ba.required=ot[7]),Dt[0]&8192&&(Ba.options=[{value:"-1",text:ot[13]("webcams.settings.motion.boxes.options.none",{default:"None"})},{value:"red",text:ot[13]("webcams.settings.motion.boxes.options.red",{default:"Red"})},{value:"green",text:ot[13]("webcams.settings.motion.boxes.options.green",{default:"Green"})},{value:"blue",text:ot[13]("webcams.settings.motion.boxes.options.blue",{default:"Blue"})}]),Dt[0]&8192&&(Ba.label=ot[13]("webcams.settings.motion.boxes.label",{default:"Show motion boxes"})),Dt[0]&8192&&(Ba.placeholder=ot[13]("webcams.settings.motion.boxes.placeholder",{default:"Show the motion boxes"})),Dt[0]&8192&&(Ba.help=ot[13]("webcams.settings.motion.boxes.help",{default:"Show motion boxes on the archived images."})),Dt[0]&8192&&(Ba.invalid=ot[13]("webcams.settings.motion.boxes.invalid",{default:"Please make a choice."})),Xe.$set(Ba);const Vn={};Dt[0]&128&&(Vn.required=ot[7]),Dt[0]&8192&&(Vn.label=ot[13]("webcams.settings.motion.threshold.label",{default:"Motion delta threshold"})),Dt[0]&8192&&(Vn.placeholder=ot[13]("webcams.settings.motion.threshold.placeholder",{default:"Enter number"})),Dt[0]&8192&&(Vn.help=ot[13]("webcams.settings.motion.threshold.help",{default:"Enter the motion threshold."})),Dt[0]&8192&&(Vn.invalid=ot[13]("webcams.settings.motion.threshold.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),bt.$set(Vn);const Bn={};Dt[0]&128&&(Bn.required=ot[7]),Dt[0]&8192&&(Bn.label=ot[13]("webcams.settings.motion.area.label",{default:"Motion minimum area"})),Dt[0]&8192&&(Bn.placeholder=ot[13]("webcams.settings.motion.area.placeholder",{default:"Enter number"})),Dt[0]&8192&&(Bn.help=ot[13]("webcams.settings.motion.area.help",{default:"Enter an area size."})),Dt[0]&8192&&(Bn.invalid=ot[13]("webcams.settings.motion.area.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),It.$set(Bn);const sa={};Dt[0]&4096&&(sa.value=ot[12].motion?ot[12].motion.frame:""),Dt[0]&128&&(sa.required=ot[7]),Dt[0]&8192&&(sa.options=[{value:"last",text:ot[13]("webcams.settings.motion.frame.options.last",{default:"Last frame"})},{value:"archived",text:ot[13]("webcams.settings.motion.frame.options.archived",{default:"Last archived frame"})}]),Dt[0]&8192&&(sa.label=ot[13]("webcams.settings.motion.frame.label",{default:"Motion comparison frame"})),Dt[0]&8192&&(sa.placeholder=ot[13]("webcams.settings.motion.frame.placeholder",{default:"Select which frame to comparison"})),Dt[0]&8192&&(sa.help=ot[13]("webcams.settings.motion.frame.help",{default:"Which frame to use for motion detection."})),Dt[0]&8192&&(sa.invalid=ot[13]("webcams.settings.motion.frame.invalid",{default:"Please make a choice."})),yi.$set(sa),(!xi||Dt[0]&128)&&fe(ct,"d-none",!ot[7]),(!xi||Dt[0]&8)&&fe(e,"was-validated",ot[3])},i(ot){xi||(W(c.$$.fragment,ot),W(m.$$.fragment,ot),W(b.$$.fragment,ot),W(y.$$.fragment,ot),W(N.$$.fragment,ot),W(V.$$.fragment,ot),W(K.$$.fragment,ot),W(re.$$.fragment,ot),W(ke.$$.fragment,ot),W(bi),W(Je.$$.fragment,ot),W(Ve.$$.fragment,ot),W(et.$$.fragment,ot),W(Xe.$$.fragment,ot),W(bt.$$.fragment,ot),W(It.$$.fragment,ot),W(yi.$$.fragment,ot),xi=!0)},o(ot){Q(c.$$.fragment,ot),Q(m.$$.fragment,ot),Q(b.$$.fragment,ot),Q(y.$$.fragment,ot),Q(N.$$.fragment,ot),Q(V.$$.fragment,ot),Q(K.$$.fragment,ot),Q(re.$$.fragment,ot),Q(ke.$$.fragment,ot),Q(bi),Q(Je.$$.fragment,ot),Q(Ve.$$.fragment,ot),Q(et.$$.fragment,ot),Q(Xe.$$.fragment,ot),Q(bt.$$.fragment,ot),Q(It.$$.fragment,ot),Q(yi.$$.fragment,ot),xi=!1},d(ot){ot&&H(e),ve(c),ve(m),ve(b),ve(y),ve(N),ve(V),ve(K),ve(re),ve(ke),bi&&bi.d(),ve(Je),ve(Ve),ve(et),ve(Xe),ve(bt),ve(It),ve(yi),i[29](null),Si=!1,pn()}}}function oue(i){let e,t,n=i[13]("webcams.settings.title",{default:"Webcam settings"})+"",a,r,s,o;return s=new Ws({props:{moreInfo:"https://theyosh.github.io/TerrariumPI/setup/#webcams"}}),{c(){e=M("i"),t=X(),a=Se(n),r=X(),be(s.$$.fragment),A(e,"class","fas fa-tint mr-2")},m(l,u){j(l,e,u),j(l,t,u),j(l,a,u),j(l,r,u),ge(s,l,u),o=!0},p(l,u){(!o||u[0]&8192)&&n!==(n=l[13]("webcams.settings.title",{default:"Webcam settings"})+"")&&Ce(a,n)},i(l){o||(W(s.$$.fragment,l),o=!0)},o(l){Q(s.$$.fragment,l),o=!1},d(l){l&&(H(e),H(t),H(a),H(r)),ve(s,l)}}}function lue(i){let e,t,n,a=i[13]("modal.general.save",{default:"Save"})+"",r,s,o,l;return{c(){e=M("button"),t=M("span"),n=X(),r=Se(a),A(t,"class","spinner-border spinner-border-sm"),A(t,"role","status"),A(t,"aria-hidden","true"),fe(t,"d-none",!i[14]),A(e,"type","button"),A(e,"class","btn btn-primary"),e.disabled=s=i[2]||i[14]},m(u,d){j(u,e,d),x(e,t),x(e,n),x(e,r),o||(l=Zt(e,"click",i[23]),o=!0)},p(u,d){d[0]&16384&&fe(t,"d-none",!u[14]),d[0]&8192&&a!==(a=u[13]("modal.general.save",{default:"Save"})+"")&&Ce(r,a),d[0]&16388&&s!==(s=u[2]||u[14])&&(e.disabled=s)},d(u){u&&H(e),o=!1,l()}}}function uue(i){let e,t,n,a,r,s;function o(c){i[30](c)}function l(c){i[31](c)}let u={loading:i[2],$$slots:{actions:[lue],header:[oue],default:[sue]},$$scope:{ctx:i}};i[0]!==void 0&&(u.show=i[0]),i[1]!==void 0&&(u.hide=i[1]),e=new Yo({props:u}),ni.push(()=>En(e,"show",o)),ni.push(()=>En(e,"hide",l));let d={};return r=new rue({props:d}),i[32](r),{c(){be(e.$$.fragment),a=X(),be(r.$$.fragment)},m(c,h){ge(e,c,h),j(c,a,h),ge(r,c,h),s=!0},p(c,h){const f={};h[0]&4&&(f.loading=c[2]),h[0]&31740|h[1]&65536&&(f.$$scope={dirty:h,ctx:c}),!t&&h[0]&1&&(t=!0,f.show=c[0],Sn(()=>t=!1)),!n&&h[0]&2&&(n=!0,f.hide=c[1],Sn(()=>n=!1)),e.$set(f);const m={};r.$set(m)},i(c){s||(W(e.$$.fragment,c),W(r.$$.fragment,c),s=!0)},o(c){Q(e.$$.fragment,c),Q(r.$$.fragment,c),s=!1},d(c){c&&H(a),ve(e,c),i[32](null),ve(r,c)}}}function due(i,e,t){let n,a,r,s;mt(i,Yi,de=>t(13,a=de)),mt(i,ls,de=>t(33,r=de));const o=Ar();let l,u,d=!1,c=!1,h=[],f=[],m=null,g=!1,v=!1,b=null,w=Di({});mt(i,w,de=>t(12,n=de));let k,_;const S=[{value:"0",text:a("webcams.settings.rotation.options.degrees_0",{default:"0 degrees"})},{value:"90",text:a("webcams.settings.rotation.options.degrees_90",{default:"90 degrees"})},{value:"180",text:a("webcams.settings.rotation.options.degrees_180",{default:"180 degrees"})},{value:"270",text:a("webcams.settings.rotation.options.degrees_270",{default:"270 degrees"})},{value:"H",text:a("webcams.settings.rotation.options.flip_h",{default:"Flip horizontal"})},{value:"V",text:a("webcams.settings.rotation.options.flip_v",{default:"Flip vertical"})}],E=[{value:"off",text:a("webcams.settings.awb.options.off",{default:"Off"})},{value:"auto",text:a("webcams.settings.awb.options.auto",{default:"Off"})},{value:"sunlight",text:a("webcams.settings.awb.options.sunlight",{default:"Sunlight"})},{value:"cloudy",text:a("webcams.settings.awb.options.cloudy",{default:"Cloudy"})},{value:"shade",text:a("webcams.settings.awb.options.shade",{default:"Shade"})},{value:"tungsten",text:a("webcams.settings.awb.options.tungsten",{default:"Tungsten"})},{value:"fluorescent",text:a("webcams.settings.awb.options.fluorescent",{default:"Fluorescent"})},{value:"incandescent",text:a("webcams.settings.awb.options.incandescent",{default:"Incandescent"})},{value:"flash",text:a("webcams.settings.awb.options.flash",{default:"Flash"})},{value:"horizon",text:a("webcams.settings.awb.options.horizon",{default:"Horizon"})},{value:"greyworld",text:a("webcams.settings.awb.options.greyworld",{default:"Greyworld"})}],y=[{value:"disabled",text:a("webcams.settings.archive.options.disabled",{default:"Disabled"})},{value:"motion",text:a("webcams.settings.archive.options.motion",{default:"Motion"})},{value:"60",text:a("webcams.settings.archive.options.minute_1",{default:"1 Minute"})},{value:"300",text:a("webcams.settings.archive.options.minute_5",{default:"5 Minutes"})},{value:"900",text:a("webcams.settings.archive.options.minute_15",{default:"15 Minutes"})},{value:"1800",text:a("webcams.settings.archive.options.minute_30",{default:"30 Minutes"})},{value:"3600",text:a("webcams.settings.archive.options.hour_1",{default:"1 Hour"})},{value:"10800",text:a("webcams.settings.archive.options.hour_3",{default:"3 Hours"})},{value:"21600",text:a("webcams.settings.archive.options.hour_6",{default:"6 Hours"})},{value:"43200",text:a("webcams.settings.archive.options.hour_12",{default:"12 Hours"})},{value:"86400",text:a("webcams.settings.archive.options.day_1",{default:"1 Day"})}],{confirmModal:I}=Kn("confirm"),C=Ya(),D=()=>{C("save")};rs("loading",{setLoading:de=>{}});const R=de=>{if(de.markerid){let Me=B(de.markerid);Me.options.sensors=de.sensors,Me._tooltip.setContent(F(de.sensors))}else Pa.marker([0,0],{draggable:!0,icon:Pa.icon(m.iconOptions),sensors:de.sensors}).on("move",V).on("dblclick",k.show).bindTooltip(F(de.sensors),m.toolTipOptions).addTo(m.getWebcamMap());V()},N=de=>{let Me=B(de);Me?I(a("webcams.marker.delete.confirm.message"),()=>Wt(this,null,function*(){try{m.getWebcamMap().removeLayer(Me),k.hide(),V()}catch(Ie){Pi(a("webcams.marker.delete.error.message"),a("notification.delete.error.title"))}})):Pi(a("webcams.marker.delete.invalid.message"),a("notification.delete.invalid.title"))},F=de=>`
${r[de[0]].name}
`+de.map(Me=>`${o.units[r[Me].type].name.toLowerCase().slice(0,4)} ${da(r[Me].value)} ${o.units[r[Me].type].value}`).join("
")+"
",B=de=>{let Me=null;return m.getWebcamMap().eachLayer(Ie=>{Me===null&&Ie instanceof Pa.Marker&&de===Ie._leaflet_id&&(Me=Ie)}),Me},V=()=>{let de=[];m.getWebcamMap().eachLayer(Me=>{Me instanceof Pa.Marker&&de.push({lat:Me.getLatLng().lat,long:Me.getLatLng().lng,sensors:Me.options.sensors})}),t(11,_.elements.markers.value=JSON.stringify(de),_)};rs("webcamMarker",{showModal:de=>k.show(de),setMarker:de=>R(de),deleteMarker:de=>N(de),markerLocations:()=>V()});const Z=de=>{if(t(9,b=de),!!_.elements)switch(de){case"rpicam":t(11,_.elements.address.value="rpicam",_),t(11,_.elements.width.value=3280,_),t(11,_.elements.height.value=2464,_);break;case"rpicam-live":t(11,_.elements.address.value="rpicam_live",_),t(11,_.elements.width.value=1920,_),t(11,_.elements.height.value=1080,_);break}},ie=de=>{t(7,g=de==="motion"),t(8,v=g||de&&de!=="disabled")},K=(de,Me)=>Wt(this,null,function*(){if(t(3,c=!0),Me.form.checkValidity()){t(2,d=!0),de=ha(_),de.address+="",de.rotation+="",delete de.value;try{de.markers=JSON.parse(de.markers)}catch(Ie){de.markers=[]}try{yield B5(de,Ie=>de=Ie),wn(a("webcams.settings.save.ok.message",{default:"Webcam ''{name}'' is updated",values:{name:de.name}}),a("notification.form.save.ok.title",{default:"Save OK"})),Le(),D()}catch(Ie){t(2,d=!1),Pi(Ie.message,a("notification.form.save.error.title",{default:"Save Error"}))}finally{t(3,c=!1)}}else{let Ie=a("webcams.settings.save.error.required_fields",{default:"Not all required fields are entered correctly."});Ie+=` +'`)+"'",Pi(te,a("notification.form.save.error.title",{default:"Save Error"}))}}),{form:S,data:E,setFields:y,isSubmitting:I,createSubmitHandler:C,reset:D}=Us({onSubmit:_});mt(i,I,J=>t(12,r=J));const R=C({onSubmit:_}),N=(J,G)=>{Wt(this,null,function*(){yield _5(te=>t(4,d=te.map(re=>({value:re.hardware,text:re.name,types:re.types})))),J&&(yield Nu(J,te=>Ci(g,n=te,n)),y(n)),t(2,l=!1)}),D(),Ci(g,n=ha(v),n),t(3,u=!1),t(2,l=!0),s()},F=()=>{setTimeout(()=>{t(2,l=!1)},1e3),o()};Qi(()=>{v.setAttribute("novalidate","novalidate")});const B=J=>k(J.detail),V=J=>t(6,h=J.detail);function Z(J){ni[J?"unshift":"push"](()=>{v=J,t(9,v)})}function ie(J){s=J,t(0,s)}function K(J){o=J,t(1,o)}return[s,o,l,u,d,c,h,f,m,v,n,a,r,g,k,S,I,R,N,F,B,V,Z,ie,K]}class Jle extends Bt{constructor(e){super(),zt(this,e,Qle,Xle,Nt,{show:18,hide:19},null,[-1,-1])}get show(){return this.$$.ctx[18]}get hide(){return this.$$.ctx[19]}}function eue(i){let e,t,n,a,r,s,o,l,u,d;return r=new Oi({props:{name:"sensors",value:i[5],multiple:!0,required:!0,options:i[4],label:i[7]("webcams.markers.settings.doors.label",{default:"Sensors"}),help:i[7]("webcams.markers.settings.doors.help",{default:"Select the senors you want to show."}),invalid:i[7]("webcams.markers.settings.doors.invalid",{default:"Make a choice."})}}),{c(){e=M("form"),t=M("input"),a=X(),be(r.$$.fragment),s=X(),o=M("button"),o.innerHTML="",A(t,"type","hidden"),A(t,"name","markerid"),t.disabled=n=!i[6],t.value="",A(o,"type","submit"),pi(o,"display","none"),A(e,"class","form-horizontal needs-validation"),fe(e,"was-validated",i[3])},m(c,h){j(c,e,h),x(e,t),x(e,a),ge(r,e,null),x(e,s),x(e,o),i[15](e),l=!0,u||(d=fr(i[10].call(null,e)),u=!0)},p(c,h){(!l||h&64&&n!==(n=!c[6]))&&(t.disabled=n);const f={};h&32&&(f.value=c[5]),h&16&&(f.options=c[4]),h&128&&(f.label=c[7]("webcams.markers.settings.doors.label",{default:"Sensors"})),h&128&&(f.help=c[7]("webcams.markers.settings.doors.help",{default:"Select the senors you want to show."})),h&128&&(f.invalid=c[7]("webcams.markers.settings.doors.invalid",{default:"Make a choice."})),r.$set(f),(!l||h&8)&&fe(e,"was-validated",c[3])},i(c){l||(W(r.$$.fragment,c),l=!0)},o(c){Q(r.$$.fragment,c),l=!1},d(c){c&&H(e),ve(r),i[15](null),u=!1,d()}}}function tue(i){let e,t,n=i[7]("webcams.markers.settings.title",{default:"Sensors"})+"",a,r,s,o;return s=new Ws({}),{c(){e=M("i"),t=X(),a=Se(n),r=X(),be(s.$$.fragment),A(e,"class","fas fa-marker mr-2")},m(l,u){j(l,e,u),j(l,t,u),j(l,a,u),j(l,r,u),ge(s,l,u),o=!0},p(l,u){(!o||u&128)&&n!==(n=l[7]("webcams.markers.settings.title",{default:"Sensors"})+"")&&Ce(a,n)},i(l){o||(W(s.$$.fragment,l),o=!0)},o(l){Q(s.$$.fragment,l),o=!1},d(l){l&&(H(e),H(t),H(a),H(r)),ve(s,l)}}}function yM(i){let e,t=i[7]("webcams.markers.settings.delete",{default:"Delete"})+"",n,a,r;return{c(){e=M("button"),n=Se(t),A(e,"type","button"),A(e,"class","btn btn-danger mr-5")},m(s,o){j(s,e,o),x(e,n),a||(r=Zt(e,"click",i[14]),a=!0)},p(s,o){o&128&&t!==(t=s[7]("webcams.markers.settings.delete",{default:"Delete"})+"")&&Ce(n,t)},d(s){s&&H(e),a=!1,r()}}}function iue(i){let e,t,n=i[7]("modal.general.close",{default:"Close "})+"",a,r,s,o,l,u,d=i[7]("modal.general.save",{default:"Save"})+"",c,h,f,m=i[6]&&yM(i);return{c(){e=M("div"),t=M("button"),a=Se(n),r=X(),m&&m.c(),s=X(),o=M("button"),l=M("span"),u=X(),c=Se(d),A(t,"type","button"),A(t,"class","btn btn-default"),A(l,"class","spinner-border spinner-border-sm"),A(l,"role","status"),A(l,"aria-hidden","true"),fe(l,"d-none",!i[8]),A(o,"type","button"),A(o,"class","btn btn-primary ml-3"),o.disabled=i[8],A(e,"class","d-flex justify-content-between w-100")},m(g,v){j(g,e,v),x(e,t),x(t,a),x(e,r),m&&m.m(e,null),x(e,s),x(e,o),x(o,l),x(o,u),x(o,c),h||(f=[Zt(t,"click",i[0]),Zt(o,"click",i[12])],h=!0)},p(g,v){v&128&&n!==(n=g[7]("modal.general.close",{default:"Close "})+"")&&Ce(a,n),g[6]?m?m.p(g,v):(m=yM(g),m.c(),m.m(e,s)):m&&(m.d(1),m=null),v&256&&fe(l,"d-none",!g[8]),v&128&&d!==(d=g[7]("modal.general.save",{default:"Save"})+"")&&Ce(c,d),v&256&&(o.disabled=g[8])},d(g){g&&H(e),m&&m.d(),h=!1,ga(f)}}}function nue(i){let e,t,n={$$slots:{actions:[iue],header:[tue],default:[eue]},$$scope:{ctx:i}};return e=new qc({props:n}),i[16](e),{c(){be(e.$$.fragment)},m(a,r){ge(e,a,r),t=!0},p(a,[r]){const s={};r&1049084&&(s.$$scope={dirty:r,ctx:a}),e.$set(s)},i(a){t||(W(e.$$.fragment,a),t=!0)},o(a){Q(e.$$.fragment,a),t=!1},d(a){i[16](null),ve(e,a)}}}function aue(i,e,t){let n,a;mt(i,Yi,y=>t(7,n=y));let r,s,o=!1,l=[],u=[],d=!1;const{setMarker:c,deleteMarker:h}=Kn("webcamMarker"),f=(y,I)=>Wt(this,null,function*(){t(3,o=!0),I.form.checkValidity()?(y=ha(s),c(y),k()):Pi("Error saving markers","ERROR")}),{form:m,isSubmitting:g,createSubmitHandler:v}=Us({onSubmit:f});mt(i,g,y=>t(8,a=y));const b=v({onSubmit:f}),w=y=>{t(6,d=!!y),t(5,u=d?y.target.options.sensors:[]),t(2,s.elements.markerid.value=d?y.target._leaflet_id:"",s),Nu(!1,I=>{t(4,l=I.map(C=>(ec(C),{value:C.id,text:C.name})))}),t(3,o=!1),r.show()},k=()=>{r.hide()};Qi(()=>{s.setAttribute("novalidate","novalidate")});const _=()=>h(s.elements.markerid.value);function S(y){ni[y?"unshift":"push"](()=>{s=y,t(2,s)})}function E(y){ni[y?"unshift":"push"](()=>{r=y,t(1,r)})}return[k,r,s,o,l,u,d,n,a,h,m,g,b,w,_,S,E]}class rue extends Bt{constructor(e){super(),zt(this,e,aue,nue,Nt,{show:13,hide:0})}get show(){return this.$$.ctx[13]}get hide(){return this.$$.ctx[0]}}function wM(i){let e,t,n,a={webcam:i[12],edit:!0};return t=new mP({props:a}),i[28](t),{c(){e=M("div"),be(t.$$.fragment),A(e,"class","embed-responsive-item")},m(r,s){j(r,e,s),ge(t,e,null),n=!0},p(r,s){const o={};s[0]&4096&&(o.webcam=r[12]),t.$set(o)},i(r){n||(W(t.$$.fragment,r),n=!0)},o(r){Q(t.$$.fragment,r),n=!1},d(r){r&&H(e),i[28](null),ve(t)}}}function sue(i){let e,t,n,a,r,s,o,l,u,d,c,h,f,m,g,v,b,w,k,_,S,E,y,I,C,D,R,N,F,B,V,Z,ie,K,J,G,te,re,ae,ce,ke,Le,Ue,Ee,Oe,Ye=i[13]("webcams.settings.preview.label",{default:"Preview"})+"",Ze,Qe,Ae,de,Me,Ie,qe,Be,$e,Je,Ne,Pe,Ve,it,je,et,_t,ct,ze,Xe,me,De,bt,rt,kt,It,Xt,Qt,yi,vi,sn,xi,Si,pn;c=new Oi({props:{name:"hardware",value:i[12].hardware,readonly:i[12].id&&i[12].id!=="",required:!0,options:i[4],label:i[13]("webcams.settings.hardware.label",{default:"Hardware"}),placeholder:i[13]("webcams.settings.hardware.placeholder",{default:"Select hardware"}),help:i[13]("webcams.settings.hardware.help",{default:"Select the hardware type for this button."}),invalid:i[13]("webcams.settings.hardware.invalid",{default:"Please select a hardware type."})}}),c.$on("change",i[26]),m=new $t({props:{type:"text",name:"address",required:!0,readonly:["rpicam","rpicam-live"].indexOf(i[9])!==-1,label:i[13]("webcams.settings.address.label",{default:"Address"}),placeholder:i[13]("webcams.settings.address.placeholder",{default:"Enter an address"}),help:i[13]("webcams.settings.address.help",{default:"For more information see online."}),invalid:i[13]("webcams.settings.address.invalid",{default:"The entered address is not valid. It cannot be empty."})}}),b=new $t({props:{type:"text",name:"name",required:!0,label:i[13]("webcams.settings.name.label",{default:"Name"}),placeholder:i[13]("webcams.settings.name.placeholder",{default:"Enter a name"}),help:i[13]("webcams.settings.name.help",{default:"Enter an easy to remember name."}),invalid:i[13]("webcams.settings.name.invalid",{default:"The entered name is not valid. It cannot be empty."})}}),y=new $t({props:{type:"number",min:"0",step:"1",name:"width",required:!0,label:i[13]("webcams.settings.width.label",{default:"Width"}),help:i[13]("webcams.settings.width.help",{default:"Enter the resolution width in pixels."}),invalid:i[13]("webcams.settings.width.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),N=new $t({props:{type:"number",min:"0",step:"1",name:"height",required:!0,label:i[13]("webcams.settings.height.label",{default:"Height"}),help:i[13]("webcams.settings.height.help",{default:"Enter the resolution height in pixels."}),invalid:i[13]("webcams.settings.height.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),V=new Oi({props:{name:"rotation",value:i[12].rotation,required:!0,options:i[16],label:i[13]("webcams.settings.rotation.label",{default:"Rotation"}),placeholder:i[13]("webcams.settings.rotation.placeholder",{default:"Select rotation"}),help:i[13]("webcams.settings.rotation.help",{default:"Select a rotation."}),invalid:i[13]("webcams.settings.rotation.invalid",{default:"Please make a choice."})}}),K=new Oi({props:{name:"awb",value:i[12].awb,required:!0,options:i[17],label:i[13]("webcams.settings.awb.label",{default:"White balance"}),placeholder:i[13]("webcams.settings.awb.placeholder",{default:"Select white balance"}),help:i[13]("webcams.settings.awb.help",{default:"Select a white balance."}),invalid:i[13]("webcams.settings.awb.invalid",{default:"Please make a choice."})}}),re=new Oi({props:{name:"archive.state",value:i[12].archive?i[12].archive.state:null,options:i[18],label:i[13]("webcams.settings.archive.state.label",{default:"Archiving"}),placeholder:i[13]("webcams.settings.archive.state.placeholder",{default:"Select archiving"}),help:i[13]("webcams.settings.archive.state.help",{default:"Select the duration between archived images."}),invalid:i[13]("webcams.settings.archive.state.invalid",{default:"Please make a choice."})}}),re.$on("change",i[27]),ke=new Oi({props:{name:"flash",value:i[12].flash,multiple:!0,options:i[5],label:i[13]("webcams.settings.archive.flash.label",{default:"Flash"}),placeholder:i[13]("webcams.settings.archive.flash.placeholder",{default:"Select optional relay for flash"}),help:i[13]("webcams.settings.archive.flash.help",{default:"Select a relay that will act as a flasher."}),invalid:i[13]("webcams.settings.archive.flash.invalid",{default:"Please make a choice."})}});let bi=i[12].id&&wM(i);return Je=new Oi({props:{name:"archive.light",value:i[12].archive?i[12].archive.light:"",options:[{value:"ignore",text:i[13]("webcams.settings.archive.light.options.ignore",{default:"Ignore"})},{value:"on",text:i[13]("webcams.settings.archive.light.options.on",{default:"When on"})},{value:"off",text:i[13]("webcams.settings.archive.light.options.off",{default:"When off"})}],label:i[13]("webcams.settings.archive.light.label",{default:"Archive light state"}),placeholder:i[13]("webcams.settings.archive.light.placeholder",{default:"Select archive light state"}),help:i[13]("webcams.settings.archive.light.help",{default:"Light status for taking an archive image."}),invalid:i[13]("webcams.settings.archive.light.invalid",{default:"Please make a choice."})}}),Ve=new Oi({props:{name:"archive.door",value:i[12].archive?i[12].archive.door:"",options:[{value:"ignore",text:i[13]("webcams.settings.archive.door.options.ignore",{default:"Ignore"})},{value:"close",text:i[13]("webcams.settings.archive.door.options.close",{default:"Close"})},{value:"open",text:i[13]("webcams.settings.archive.door.options.open",{default:"Open"})}],label:i[13]("webcams.settings.archive.door.label",{default:"Archive door state"}),placeholder:i[13]("webcams.settings.archive.door.placeholder",{default:"Select archive door state"}),help:i[13]("webcams.settings.archive.door.help",{default:"Door status for taking an archive image."}),invalid:i[13]("webcams.settings.archive.door.invalid",{default:"Please make a choice."})}}),et=new $t({props:{type:"number",name:"archive.history",step:"1",min:"0",label:i[13]("webcams.settings.archive.history.label",{default:"Archive history in days"}),placeholder:i[13]("webcams.settings.archive.history.placeholder",{default:"Enter number"}),help:i[13]("webcams.settings.archive.history.help",{default:"Enter the amount of days to keep for history."}),invalid:i[13]("webcams.settings.archive.history.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),Xe=new Oi({props:{name:"motion.boxes",value:i[12].motion?i[12].motion.boxes:"",required:i[7],options:[{value:"-1",text:i[13]("webcams.settings.motion.boxes.options.none",{default:"None"})},{value:"red",text:i[13]("webcams.settings.motion.boxes.options.red",{default:"Red"})},{value:"green",text:i[13]("webcams.settings.motion.boxes.options.green",{default:"Green"})},{value:"blue",text:i[13]("webcams.settings.motion.boxes.options.blue",{default:"Blue"})}],label:i[13]("webcams.settings.motion.boxes.label",{default:"Show motion boxes"}),placeholder:i[13]("webcams.settings.motion.boxes.placeholder",{default:"Show the motion boxes"}),help:i[13]("webcams.settings.motion.boxes.help",{default:"Show motion boxes on the archived images."}),invalid:i[13]("webcams.settings.motion.boxes.invalid",{default:"Please make a choice."})}}),bt=new $t({props:{type:"number",name:"motion.threshold",step:"1",min:"0",required:i[7],label:i[13]("webcams.settings.motion.threshold.label",{default:"Motion delta threshold"}),placeholder:i[13]("webcams.settings.motion.threshold.placeholder",{default:"Enter number"}),help:i[13]("webcams.settings.motion.threshold.help",{default:"Enter the motion threshold."}),invalid:i[13]("webcams.settings.motion.threshold.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),It=new $t({props:{type:"number",name:"motion.area",min:"0",required:i[7],label:i[13]("webcams.settings.motion.area.label",{default:"Motion minimum area"}),placeholder:i[13]("webcams.settings.motion.area.placeholder",{default:"Enter number"}),help:i[13]("webcams.settings.motion.area.help",{default:"Enter an area size."}),invalid:i[13]("webcams.settings.motion.area.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})}}),yi=new Oi({props:{name:"motion.frame",value:i[12].motion?i[12].motion.frame:"",required:i[7],options:[{value:"last",text:i[13]("webcams.settings.motion.frame.options.last",{default:"Last frame"})},{value:"archived",text:i[13]("webcams.settings.motion.frame.options.archived",{default:"Last archived frame"})}],label:i[13]("webcams.settings.motion.frame.label",{default:"Motion comparison frame"}),placeholder:i[13]("webcams.settings.motion.frame.placeholder",{default:"Select which frame to comparison"}),help:i[13]("webcams.settings.motion.frame.help",{default:"Which frame to use for motion detection."}),invalid:i[13]("webcams.settings.motion.frame.invalid",{default:"Please make a choice."})}}),{c(){e=M("form"),t=M("input"),a=X(),r=M("input"),s=X(),o=M("div"),l=M("div"),u=M("div"),d=M("div"),be(c.$$.fragment),h=X(),f=M("div"),be(m.$$.fragment),g=X(),v=M("div"),be(b.$$.fragment),w=X(),k=M("div"),_=M("div"),S=M("div"),E=M("div"),be(y.$$.fragment),I=X(),C=M("div"),C.textContent="X",D=X(),R=M("div"),be(N.$$.fragment),F=X(),B=M("div"),be(V.$$.fragment),Z=X(),ie=M("div"),be(K.$$.fragment),J=X(),G=M("div"),te=M("div"),be(re.$$.fragment),ae=X(),ce=M("div"),be(ke.$$.fragment),Le=X(),Ue=M("div"),Ee=M("div"),Oe=M("label"),Ze=Se(Ye),Qe=X(),Ae=M("div"),de=M("img"),Ie=X(),bi&&bi.c(),qe=X(),Be=M("div"),$e=M("div"),be(Je.$$.fragment),Ne=X(),Pe=M("div"),be(Ve.$$.fragment),it=X(),je=M("div"),be(et.$$.fragment),_t=X(),ct=M("div"),ze=M("div"),be(Xe.$$.fragment),me=X(),De=M("div"),be(bt.$$.fragment),rt=X(),kt=M("div"),be(It.$$.fragment),Xt=X(),Qt=M("div"),be(yi.$$.fragment),vi=X(),sn=M("button"),sn.innerHTML="",A(t,"type","hidden"),A(t,"name","id"),t.disabled=n=i[12].id&&i[12].id!==""?null:!0,A(r,"type","hidden"),A(r,"name","markers"),r.readOnly="readonly",A(d,"class","col-12 col-sm-12 col-md-3 col-lg-4"),A(f,"class","col-12 col-sm-12 col-md-5 col-lg-4"),A(v,"class","col-12 col-sm-12 col-md-4 col-lg-4"),A(u,"class","row"),A(E,"class","col-5"),A(C,"class","col-2 pt-5 text-center text-bold"),A(R,"class","col-5"),A(S,"class","row"),A(_,"class","col-12 col-sm-12 col-md-6 col-lg-6"),A(B,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(ie,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(k,"class","row"),A(te,"class","col-6 col-sm-6 col-md-6 col-lg-6"),A(ce,"class","col-6 col-sm-6 col-md-6 col-lg-6"),A(G,"class","row"),A(l,"class","col-12 col-sm-12 col-md-12 col-lg-7"),A(Oe,"for","button_address"),Ts(de.src,Me=i[12].raw_image?`${Ia}/${i[12].raw_image}`:"img/webcam_offline.png")||A(de,"src",Me),A(de,"class","img-fluid embed-responsive-item"),pi(de,"position","absolute"),A(de,"alt","Offline preview"),A(Ae,"class","embed-responsive embed-responsive-16by9"),A(Ee,"class","form-group"),A(Ue,"class","col-12 col-sm-12 col-md-12 col-lg-5"),A(o,"class","row"),A($e,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(Pe,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(je,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(Be,"class","row"),fe(Be,"d-none",!i[8]),A(ze,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(De,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(kt,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(Qt,"class","col-6 col-sm-6 col-md-3 col-lg-3"),A(ct,"class","row"),fe(ct,"d-none",!i[7]),A(sn,"type","submit"),pi(sn,"display","none"),A(e,"class","needs-validation"),fe(e,"was-validated",i[3])},m(ot,Dt){j(ot,e,Dt),x(e,t),x(e,a),x(e,r),x(e,s),x(e,o),x(o,l),x(l,u),x(u,d),ge(c,d,null),x(u,h),x(u,f),ge(m,f,null),x(u,g),x(u,v),ge(b,v,null),x(l,w),x(l,k),x(k,_),x(_,S),x(S,E),ge(y,E,null),x(S,I),x(S,C),x(S,D),x(S,R),ge(N,R,null),x(k,F),x(k,B),ge(V,B,null),x(k,Z),x(k,ie),ge(K,ie,null),x(l,J),x(l,G),x(G,te),ge(re,te,null),x(G,ae),x(G,ce),ge(ke,ce,null),x(o,Le),x(o,Ue),x(Ue,Ee),x(Ee,Oe),x(Oe,Ze),x(Ee,Qe),x(Ee,Ae),x(Ae,de),x(Ae,Ie),bi&&bi.m(Ae,null),x(e,qe),x(e,Be),x(Be,$e),ge(Je,$e,null),x(Be,Ne),x(Be,Pe),ge(Ve,Pe,null),x(Be,it),x(Be,je),ge(et,je,null),x(e,_t),x(e,ct),x(ct,ze),ge(Xe,ze,null),x(ct,me),x(ct,De),ge(bt,De,null),x(ct,rt),x(ct,kt),ge(It,kt,null),x(ct,Xt),x(ct,Qt),ge(yi,Qt,null),x(e,vi),x(e,sn),i[29](e),xi=!0,Si||(pn=fr(i[21].call(null,e)),Si=!0)},p(ot,Dt){(!xi||Dt[0]&4096&&n!==(n=ot[12].id&&ot[12].id!==""?null:!0))&&(t.disabled=n);const zn={};Dt[0]&4096&&(zn.value=ot[12].hardware),Dt[0]&4096&&(zn.readonly=ot[12].id&&ot[12].id!==""),Dt[0]&16&&(zn.options=ot[4]),Dt[0]&8192&&(zn.label=ot[13]("webcams.settings.hardware.label",{default:"Hardware"})),Dt[0]&8192&&(zn.placeholder=ot[13]("webcams.settings.hardware.placeholder",{default:"Select hardware"})),Dt[0]&8192&&(zn.help=ot[13]("webcams.settings.hardware.help",{default:"Select the hardware type for this button."})),Dt[0]&8192&&(zn.invalid=ot[13]("webcams.settings.hardware.invalid",{default:"Please select a hardware type."})),c.$set(zn);const qn={};Dt[0]&512&&(qn.readonly=["rpicam","rpicam-live"].indexOf(ot[9])!==-1),Dt[0]&8192&&(qn.label=ot[13]("webcams.settings.address.label",{default:"Address"})),Dt[0]&8192&&(qn.placeholder=ot[13]("webcams.settings.address.placeholder",{default:"Enter an address"})),Dt[0]&8192&&(qn.help=ot[13]("webcams.settings.address.help",{default:"For more information see online."})),Dt[0]&8192&&(qn.invalid=ot[13]("webcams.settings.address.invalid",{default:"The entered address is not valid. It cannot be empty."})),m.$set(qn);const Qa={};Dt[0]&8192&&(Qa.label=ot[13]("webcams.settings.name.label",{default:"Name"})),Dt[0]&8192&&(Qa.placeholder=ot[13]("webcams.settings.name.placeholder",{default:"Enter a name"})),Dt[0]&8192&&(Qa.help=ot[13]("webcams.settings.name.help",{default:"Enter an easy to remember name."})),Dt[0]&8192&&(Qa.invalid=ot[13]("webcams.settings.name.invalid",{default:"The entered name is not valid. It cannot be empty."})),b.$set(Qa);const Aa={};Dt[0]&8192&&(Aa.label=ot[13]("webcams.settings.width.label",{default:"Width"})),Dt[0]&8192&&(Aa.help=ot[13]("webcams.settings.width.help",{default:"Enter the resolution width in pixels."})),Dt[0]&8192&&(Aa.invalid=ot[13]("webcams.settings.width.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),y.$set(Aa);const Ja={};Dt[0]&8192&&(Ja.label=ot[13]("webcams.settings.height.label",{default:"Height"})),Dt[0]&8192&&(Ja.help=ot[13]("webcams.settings.height.help",{default:"Enter the resolution height in pixels."})),Dt[0]&8192&&(Ja.invalid=ot[13]("webcams.settings.height.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),N.$set(Ja);const fa={};Dt[0]&4096&&(fa.value=ot[12].rotation),Dt[0]&8192&&(fa.label=ot[13]("webcams.settings.rotation.label",{default:"Rotation"})),Dt[0]&8192&&(fa.placeholder=ot[13]("webcams.settings.rotation.placeholder",{default:"Select rotation"})),Dt[0]&8192&&(fa.help=ot[13]("webcams.settings.rotation.help",{default:"Select a rotation."})),Dt[0]&8192&&(fa.invalid=ot[13]("webcams.settings.rotation.invalid",{default:"Please make a choice."})),V.$set(fa);const _n={};Dt[0]&4096&&(_n.value=ot[12].awb),Dt[0]&8192&&(_n.label=ot[13]("webcams.settings.awb.label",{default:"White balance"})),Dt[0]&8192&&(_n.placeholder=ot[13]("webcams.settings.awb.placeholder",{default:"Select white balance"})),Dt[0]&8192&&(_n.help=ot[13]("webcams.settings.awb.help",{default:"Select a white balance."})),Dt[0]&8192&&(_n.invalid=ot[13]("webcams.settings.awb.invalid",{default:"Please make a choice."})),K.$set(_n);const li={};Dt[0]&4096&&(li.value=ot[12].archive?ot[12].archive.state:null),Dt[0]&8192&&(li.label=ot[13]("webcams.settings.archive.state.label",{default:"Archiving"})),Dt[0]&8192&&(li.placeholder=ot[13]("webcams.settings.archive.state.placeholder",{default:"Select archiving"})),Dt[0]&8192&&(li.help=ot[13]("webcams.settings.archive.state.help",{default:"Select the duration between archived images."})),Dt[0]&8192&&(li.invalid=ot[13]("webcams.settings.archive.state.invalid",{default:"Please make a choice."})),re.$set(li);const ra={};Dt[0]&4096&&(ra.value=ot[12].flash),Dt[0]&32&&(ra.options=ot[5]),Dt[0]&8192&&(ra.label=ot[13]("webcams.settings.archive.flash.label",{default:"Flash"})),Dt[0]&8192&&(ra.placeholder=ot[13]("webcams.settings.archive.flash.placeholder",{default:"Select optional relay for flash"})),Dt[0]&8192&&(ra.help=ot[13]("webcams.settings.archive.flash.help",{default:"Select a relay that will act as a flasher."})),Dt[0]&8192&&(ra.invalid=ot[13]("webcams.settings.archive.flash.invalid",{default:"Please make a choice."})),ke.$set(ra),(!xi||Dt[0]&8192)&&Ye!==(Ye=ot[13]("webcams.settings.preview.label",{default:"Preview"})+"")&&Ce(Ze,Ye),(!xi||Dt[0]&4096&&!Ts(de.src,Me=ot[12].raw_image?`${Ia}/${ot[12].raw_image}`:"img/webcam_offline.png"))&&A(de,"src",Me),ot[12].id?bi?(bi.p(ot,Dt),Dt[0]&4096&&W(bi,1)):(bi=wM(ot),bi.c(),W(bi,1),bi.m(Ae,null)):bi&&(Rt(),Q(bi,1,1,()=>{bi=null}),Ft());const Ga={};Dt[0]&4096&&(Ga.value=ot[12].archive?ot[12].archive.light:""),Dt[0]&8192&&(Ga.options=[{value:"ignore",text:ot[13]("webcams.settings.archive.light.options.ignore",{default:"Ignore"})},{value:"on",text:ot[13]("webcams.settings.archive.light.options.on",{default:"When on"})},{value:"off",text:ot[13]("webcams.settings.archive.light.options.off",{default:"When off"})}]),Dt[0]&8192&&(Ga.label=ot[13]("webcams.settings.archive.light.label",{default:"Archive light state"})),Dt[0]&8192&&(Ga.placeholder=ot[13]("webcams.settings.archive.light.placeholder",{default:"Select archive light state"})),Dt[0]&8192&&(Ga.help=ot[13]("webcams.settings.archive.light.help",{default:"Light status for taking an archive image."})),Dt[0]&8192&&(Ga.invalid=ot[13]("webcams.settings.archive.light.invalid",{default:"Please make a choice."})),Je.$set(Ga);const za={};Dt[0]&4096&&(za.value=ot[12].archive?ot[12].archive.door:""),Dt[0]&8192&&(za.options=[{value:"ignore",text:ot[13]("webcams.settings.archive.door.options.ignore",{default:"Ignore"})},{value:"close",text:ot[13]("webcams.settings.archive.door.options.close",{default:"Close"})},{value:"open",text:ot[13]("webcams.settings.archive.door.options.open",{default:"Open"})}]),Dt[0]&8192&&(za.label=ot[13]("webcams.settings.archive.door.label",{default:"Archive door state"})),Dt[0]&8192&&(za.placeholder=ot[13]("webcams.settings.archive.door.placeholder",{default:"Select archive door state"})),Dt[0]&8192&&(za.help=ot[13]("webcams.settings.archive.door.help",{default:"Door status for taking an archive image."})),Dt[0]&8192&&(za.invalid=ot[13]("webcams.settings.archive.door.invalid",{default:"Please make a choice."})),Ve.$set(za);const Mr={};Dt[0]&8192&&(Mr.label=ot[13]("webcams.settings.archive.history.label",{default:"Archive history in days"})),Dt[0]&8192&&(Mr.placeholder=ot[13]("webcams.settings.archive.history.placeholder",{default:"Enter number"})),Dt[0]&8192&&(Mr.help=ot[13]("webcams.settings.archive.history.help",{default:"Enter the amount of days to keep for history."})),Dt[0]&8192&&(Mr.invalid=ot[13]("webcams.settings.archive.history.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),et.$set(Mr),(!xi||Dt[0]&256)&&fe(Be,"d-none",!ot[8]);const Ba={};Dt[0]&4096&&(Ba.value=ot[12].motion?ot[12].motion.boxes:""),Dt[0]&128&&(Ba.required=ot[7]),Dt[0]&8192&&(Ba.options=[{value:"-1",text:ot[13]("webcams.settings.motion.boxes.options.none",{default:"None"})},{value:"red",text:ot[13]("webcams.settings.motion.boxes.options.red",{default:"Red"})},{value:"green",text:ot[13]("webcams.settings.motion.boxes.options.green",{default:"Green"})},{value:"blue",text:ot[13]("webcams.settings.motion.boxes.options.blue",{default:"Blue"})}]),Dt[0]&8192&&(Ba.label=ot[13]("webcams.settings.motion.boxes.label",{default:"Show motion boxes"})),Dt[0]&8192&&(Ba.placeholder=ot[13]("webcams.settings.motion.boxes.placeholder",{default:"Show the motion boxes"})),Dt[0]&8192&&(Ba.help=ot[13]("webcams.settings.motion.boxes.help",{default:"Show motion boxes on the archived images."})),Dt[0]&8192&&(Ba.invalid=ot[13]("webcams.settings.motion.boxes.invalid",{default:"Please make a choice."})),Xe.$set(Ba);const Vn={};Dt[0]&128&&(Vn.required=ot[7]),Dt[0]&8192&&(Vn.label=ot[13]("webcams.settings.motion.threshold.label",{default:"Motion delta threshold"})),Dt[0]&8192&&(Vn.placeholder=ot[13]("webcams.settings.motion.threshold.placeholder",{default:"Enter number"})),Dt[0]&8192&&(Vn.help=ot[13]("webcams.settings.motion.threshold.help",{default:"Enter the motion threshold."})),Dt[0]&8192&&(Vn.invalid=ot[13]("webcams.settings.motion.threshold.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),bt.$set(Vn);const Bn={};Dt[0]&128&&(Bn.required=ot[7]),Dt[0]&8192&&(Bn.label=ot[13]("webcams.settings.motion.area.label",{default:"Motion minimum area"})),Dt[0]&8192&&(Bn.placeholder=ot[13]("webcams.settings.motion.area.placeholder",{default:"Enter number"})),Dt[0]&8192&&(Bn.help=ot[13]("webcams.settings.motion.area.help",{default:"Enter an area size."})),Dt[0]&8192&&(Bn.invalid=ot[13]("webcams.settings.motion.area.invalid",{default:"Please enter a minimum value of {value}.",values:{value:0}})),It.$set(Bn);const sa={};Dt[0]&4096&&(sa.value=ot[12].motion?ot[12].motion.frame:""),Dt[0]&128&&(sa.required=ot[7]),Dt[0]&8192&&(sa.options=[{value:"last",text:ot[13]("webcams.settings.motion.frame.options.last",{default:"Last frame"})},{value:"archived",text:ot[13]("webcams.settings.motion.frame.options.archived",{default:"Last archived frame"})}]),Dt[0]&8192&&(sa.label=ot[13]("webcams.settings.motion.frame.label",{default:"Motion comparison frame"})),Dt[0]&8192&&(sa.placeholder=ot[13]("webcams.settings.motion.frame.placeholder",{default:"Select which frame to comparison"})),Dt[0]&8192&&(sa.help=ot[13]("webcams.settings.motion.frame.help",{default:"Which frame to use for motion detection."})),Dt[0]&8192&&(sa.invalid=ot[13]("webcams.settings.motion.frame.invalid",{default:"Please make a choice."})),yi.$set(sa),(!xi||Dt[0]&128)&&fe(ct,"d-none",!ot[7]),(!xi||Dt[0]&8)&&fe(e,"was-validated",ot[3])},i(ot){xi||(W(c.$$.fragment,ot),W(m.$$.fragment,ot),W(b.$$.fragment,ot),W(y.$$.fragment,ot),W(N.$$.fragment,ot),W(V.$$.fragment,ot),W(K.$$.fragment,ot),W(re.$$.fragment,ot),W(ke.$$.fragment,ot),W(bi),W(Je.$$.fragment,ot),W(Ve.$$.fragment,ot),W(et.$$.fragment,ot),W(Xe.$$.fragment,ot),W(bt.$$.fragment,ot),W(It.$$.fragment,ot),W(yi.$$.fragment,ot),xi=!0)},o(ot){Q(c.$$.fragment,ot),Q(m.$$.fragment,ot),Q(b.$$.fragment,ot),Q(y.$$.fragment,ot),Q(N.$$.fragment,ot),Q(V.$$.fragment,ot),Q(K.$$.fragment,ot),Q(re.$$.fragment,ot),Q(ke.$$.fragment,ot),Q(bi),Q(Je.$$.fragment,ot),Q(Ve.$$.fragment,ot),Q(et.$$.fragment,ot),Q(Xe.$$.fragment,ot),Q(bt.$$.fragment,ot),Q(It.$$.fragment,ot),Q(yi.$$.fragment,ot),xi=!1},d(ot){ot&&H(e),ve(c),ve(m),ve(b),ve(y),ve(N),ve(V),ve(K),ve(re),ve(ke),bi&&bi.d(),ve(Je),ve(Ve),ve(et),ve(Xe),ve(bt),ve(It),ve(yi),i[29](null),Si=!1,pn()}}}function oue(i){let e,t,n=i[13]("webcams.settings.title",{default:"Webcam settings"})+"",a,r,s,o;return s=new Ws({props:{moreInfo:"https://theyosh.github.io/TerrariumPI/setup/#webcams"}}),{c(){e=M("i"),t=X(),a=Se(n),r=X(),be(s.$$.fragment),A(e,"class","fas fa-tint mr-2")},m(l,u){j(l,e,u),j(l,t,u),j(l,a,u),j(l,r,u),ge(s,l,u),o=!0},p(l,u){(!o||u[0]&8192)&&n!==(n=l[13]("webcams.settings.title",{default:"Webcam settings"})+"")&&Ce(a,n)},i(l){o||(W(s.$$.fragment,l),o=!0)},o(l){Q(s.$$.fragment,l),o=!1},d(l){l&&(H(e),H(t),H(a),H(r)),ve(s,l)}}}function lue(i){let e,t,n,a=i[13]("modal.general.save",{default:"Save"})+"",r,s,o,l;return{c(){e=M("button"),t=M("span"),n=X(),r=Se(a),A(t,"class","spinner-border spinner-border-sm"),A(t,"role","status"),A(t,"aria-hidden","true"),fe(t,"d-none",!i[14]),A(e,"type","button"),A(e,"class","btn btn-primary"),e.disabled=s=i[2]||i[14]},m(u,d){j(u,e,d),x(e,t),x(e,n),x(e,r),o||(l=Zt(e,"click",i[23]),o=!0)},p(u,d){d[0]&16384&&fe(t,"d-none",!u[14]),d[0]&8192&&a!==(a=u[13]("modal.general.save",{default:"Save"})+"")&&Ce(r,a),d[0]&16388&&s!==(s=u[2]||u[14])&&(e.disabled=s)},d(u){u&&H(e),o=!1,l()}}}function uue(i){let e,t,n,a,r,s;function o(c){i[30](c)}function l(c){i[31](c)}let u={loading:i[2],$$slots:{actions:[lue],header:[oue],default:[sue]},$$scope:{ctx:i}};i[0]!==void 0&&(u.show=i[0]),i[1]!==void 0&&(u.hide=i[1]),e=new Yo({props:u}),ni.push(()=>En(e,"show",o)),ni.push(()=>En(e,"hide",l));let d={};return r=new rue({props:d}),i[32](r),{c(){be(e.$$.fragment),a=X(),be(r.$$.fragment)},m(c,h){ge(e,c,h),j(c,a,h),ge(r,c,h),s=!0},p(c,h){const f={};h[0]&4&&(f.loading=c[2]),h[0]&31740|h[1]&65536&&(f.$$scope={dirty:h,ctx:c}),!t&&h[0]&1&&(t=!0,f.show=c[0],Sn(()=>t=!1)),!n&&h[0]&2&&(n=!0,f.hide=c[1],Sn(()=>n=!1)),e.$set(f);const m={};r.$set(m)},i(c){s||(W(e.$$.fragment,c),W(r.$$.fragment,c),s=!0)},o(c){Q(e.$$.fragment,c),Q(r.$$.fragment,c),s=!1},d(c){c&&H(a),ve(e,c),i[32](null),ve(r,c)}}}function due(i,e,t){let n,a,r,s;mt(i,Yi,de=>t(13,a=de)),mt(i,ls,de=>t(33,r=de));const o=Ar();let l,u,d=!1,c=!1,h=[],f=[],m=null,g=!1,v=!1,b=null,w=Di({});mt(i,w,de=>t(12,n=de));let k,_;const S=[{value:"0",text:a("webcams.settings.rotation.options.degrees_0",{default:"0 degrees"})},{value:"90",text:a("webcams.settings.rotation.options.degrees_90",{default:"90 degrees"})},{value:"180",text:a("webcams.settings.rotation.options.degrees_180",{default:"180 degrees"})},{value:"270",text:a("webcams.settings.rotation.options.degrees_270",{default:"270 degrees"})},{value:"H",text:a("webcams.settings.rotation.options.flip_h",{default:"Flip horizontal"})},{value:"V",text:a("webcams.settings.rotation.options.flip_v",{default:"Flip vertical"})}],E=[{value:"off",text:a("webcams.settings.awb.options.off",{default:"Off"})},{value:"auto",text:a("webcams.settings.awb.options.auto",{default:"Off"})},{value:"sunlight",text:a("webcams.settings.awb.options.sunlight",{default:"Sunlight"})},{value:"cloudy",text:a("webcams.settings.awb.options.cloudy",{default:"Cloudy"})},{value:"shade",text:a("webcams.settings.awb.options.shade",{default:"Shade"})},{value:"tungsten",text:a("webcams.settings.awb.options.tungsten",{default:"Tungsten"})},{value:"fluorescent",text:a("webcams.settings.awb.options.fluorescent",{default:"Fluorescent"})},{value:"incandescent",text:a("webcams.settings.awb.options.incandescent",{default:"Incandescent"})},{value:"flash",text:a("webcams.settings.awb.options.flash",{default:"Flash"})},{value:"horizon",text:a("webcams.settings.awb.options.horizon",{default:"Horizon"})},{value:"greyworld",text:a("webcams.settings.awb.options.greyworld",{default:"Greyworld"})}],y=[{value:"disabled",text:a("webcams.settings.archive.options.disabled",{default:"Disabled"})},{value:"motion",text:a("webcams.settings.archive.options.motion",{default:"Motion"})},{value:"60",text:a("webcams.settings.archive.options.minute_1",{default:"1 Minute"})},{value:"300",text:a("webcams.settings.archive.options.minute_5",{default:"5 Minutes"})},{value:"900",text:a("webcams.settings.archive.options.minute_15",{default:"15 Minutes"})},{value:"1800",text:a("webcams.settings.archive.options.minute_30",{default:"30 Minutes"})},{value:"3600",text:a("webcams.settings.archive.options.hour_1",{default:"1 Hour"})},{value:"10800",text:a("webcams.settings.archive.options.hour_3",{default:"3 Hours"})},{value:"21600",text:a("webcams.settings.archive.options.hour_6",{default:"6 Hours"})},{value:"43200",text:a("webcams.settings.archive.options.hour_12",{default:"12 Hours"})},{value:"86400",text:a("webcams.settings.archive.options.day_1",{default:"1 Day"})}],{confirmModal:I}=Kn("confirm"),C=Ya(),D=()=>{C("save")};rs("loading",{setLoading:de=>{}});const R=de=>{if(de.markerid){let Me=B(de.markerid);Me.options.sensors=de.sensors,Me._tooltip.setContent(F(de.sensors))}else Pa.marker([0,0],{draggable:!0,icon:Pa.icon(m.iconOptions),sensors:de.sensors}).on("move",V).on("dblclick",k.show).bindTooltip(F(de.sensors),m.toolTipOptions).addTo(m.getWebcamMap());V()},N=de=>{let Me=B(de);Me?I(a("webcams.marker.delete.confirm.message"),()=>Wt(this,null,function*(){try{m.getWebcamMap().removeLayer(Me),k.hide(),V()}catch(Ie){Pi(a("webcams.marker.delete.error.message"),a("notification.delete.error.title"))}})):Pi(a("webcams.marker.delete.invalid.message"),a("notification.delete.invalid.title"))},F=de=>`
${r[de[0]].name}
`+de.map(Me=>`${o.units[r[Me].type].name.toLowerCase().slice(0,4)} ${da(r[Me].value)} ${o.units[r[Me].type].value}`).join("
")+"
",B=de=>{let Me=null;return m.getWebcamMap().eachLayer(Ie=>{Me===null&&Ie instanceof Pa.Marker&&de===Ie._leaflet_id&&(Me=Ie)}),Me},V=()=>{let de=[];m.getWebcamMap().eachLayer(Me=>{Me instanceof Pa.Marker&&de.push({lat:Me.getLatLng().lat,long:Me.getLatLng().lng,sensors:Me.options.sensors})}),t(11,_.elements.markers.value=JSON.stringify(de),_)};rs("webcamMarker",{showModal:de=>k.show(de),setMarker:de=>R(de),deleteMarker:de=>N(de),markerLocations:()=>V()});const Z=de=>{if(t(9,b=de),!!_.elements)switch(de){case"rpicam":t(11,_.elements.address.value="rpicam",_),t(11,_.elements.width.value=3280,_),t(11,_.elements.height.value=2464,_);break;case"rpicam-live":t(11,_.elements.address.value="rpicam_live",_),t(11,_.elements.width.value=1920,_),t(11,_.elements.height.value=1080,_);break}},ie=de=>{t(7,g=de==="motion"),t(8,v=g||de&&de!=="disabled")},K=(de,Me)=>Wt(this,null,function*(){if(t(3,c=!0),Me.form.checkValidity()){t(2,d=!0),de=ha(_),de.address+="",de.rotation+="",delete de.value;try{de.markers=JSON.parse(de.markers)}catch(Ie){de.markers=[]}try{yield B5(de,Ie=>de=Ie),wn(a("webcams.settings.save.ok.message",{default:"Webcam ''{name}'' is updated",values:{name:de.name}}),a("notification.form.save.ok.title",{default:"Save OK"})),Le(),D()}catch(Ie){t(2,d=!1),Pi(Ie.message,a("notification.form.save.error.title",{default:"Save Error"}))}finally{t(3,c=!1)}}else{let Ie=a("webcams.settings.save.error.required_fields",{default:"Not all required fields are entered correctly."});Ie+=` '`+ko(_).join(`' '`)+"'",Pi(Ie,a("notification.form.save.error.title",{default:"Save Error"}))}}),{form:J,setFields:G,isSubmitting:te,createSubmitHandler:re,reset:ae}=Us({onSubmit:K});mt(i,te,de=>t(14,s=de));const ce=re({onSubmit:K}),ke=(de,Me)=>{Wt(this,null,function*(){yield Zm(!1,Ie=>t(5,f=Ie.map(qe=>({value:qe.hardware,text:qe.name})))),yield F5(Ie=>t(4,h=Ie.map(qe=>({value:qe.hardware,text:qe.name})))),de&&(yield Zb(de,Ie=>Ci(w,n=Ie,n)),G(n)),t(2,d=!1)}),ae(),Ci(w,n=ha(_),n),t(3,c=!1),t(2,d=!0),l()},Le=()=>{u()};Qi(()=>{_.setAttribute("novalidate","novalidate")});const Ue=de=>Z(de.detail),Ee=de=>ie(de.detail);function Oe(de){ni[de?"unshift":"push"](()=>{m=de,t(6,m)})}function Ye(de){ni[de?"unshift":"push"](()=>{_=de,t(11,_)})}function Ze(de){l=de,t(0,l)}function Qe(de){u=de,t(1,u)}function Ae(de){ni[de?"unshift":"push"](()=>{k=de,t(10,k)})}return[l,u,d,c,h,f,m,g,v,b,k,_,n,a,s,w,S,E,y,Z,ie,J,te,ce,ke,Le,Ue,Ee,Oe,Ye,Ze,Qe,Ae]}class cue extends Bt{constructor(e){super(),zt(this,e,due,uue,Nt,{show:24,hide:25},null,[-1,-1])}get show(){return this.$$.ctx[24]}get hide(){return this.$$.ctx[25]}}function hue(i){let e,t,n,a,r,s,o,l,u,d,c,h,f,m,g,v,b,w,k,_,S,E,y,I;return o=new $t({props:{type:"text",name:"name",required:!0,label:i[8]("enclosures.settings.name.label",{default:"Name"}),placeholder:i[8]("enclosures.settings.name.placeholder",{default:"Enter a name"}),help:i[8]("enclosures.settings.name.help",{default:"Enter an easy to remember name."}),invalid:i[8]("enclosures.settings.name.invalid",{default:"The entered name is not valid. It cannot be empty."})}}),d=new QP({props:{name:"image",value:i[7].image,accept:"image/*",label:i[8]("enclosures.settings.image.label",{default:"Image"}),placeholder:i[8]("enclosures.settings.image.placeholder",{default:"Select an image file"}),help:i[8]("enclosures.settings.image.help",{default:"Upload a JPG or PNG."}),invalid:i[8]("enclosures.settings.image.invalid",{default:"The selected file is not valid. It is not an image file."})}}),m=new TC({props:{name:"description",value:i[7].description,label:i[8]("enclosures.settings.description.label",{default:"Description"}),placeholder:i[8]("enclosures.settings.description.placeholder",{default:"Enter a description"}),help:i[8]("enclosures.settings.description.help",{default:"Enter some description text about this enclosure."})}}),b=new Oi({props:{name:"doors",value:i[7].doors,multiple:!0,options:i[4],label:i[8]("enclosures.settings.doors.label",{default:"Doors"}),help:i[8]("enclosures.settings.doors.help",{default:"Select the door(s) for this enclosure."})}}),k=new Oi({props:{name:"webcams",value:i[7].webcams,multiple:!0,options:i[5],label:i[8]("enclosures.settings.webcams.label",{default:"Webcams"}),help:i[8]("enclosures.settings.webcams.help",{default:"Select the webcam(s) for this enclosure."})}}),{c(){e=M("form"),t=M("input"),a=X(),r=M("div"),s=M("div"),be(o.$$.fragment),l=X(),u=M("div"),be(d.$$.fragment),c=X(),h=M("div"),f=M("div"),be(m.$$.fragment),g=X(),v=M("div"),be(b.$$.fragment),w=X(),be(k.$$.fragment),_=X(),S=M("button"),S.innerHTML="",A(t,"type","hidden"),A(t,"name","id"),t.disabled=n=i[7].id&&i[7].id!==""?null:!0,A(s,"class","col-12 col-sm-6 col-md-6 col-lg-6"),A(u,"class","col-12 col-sm-6 col-md-6 col-lg-6"),A(r,"class","row"),A(f,"class","col-12 col-sm-12 col-md-9 col-lg-9"),A(v,"class","col-12 col-sm-12 col-md-3 col-lg-3"),A(h,"class","row"),A(S,"type","submit"),pi(S,"display","none"),A(e,"class","needs-validation"),fe(e,"was-validated",i[3])},m(C,D){j(C,e,D),x(e,t),x(e,a),x(e,r),x(r,s),ge(o,s,null),x(r,l),x(r,u),ge(d,u,null),x(e,c),x(e,h),x(h,f),ge(m,f,null),x(h,g),x(h,v),ge(b,v,null),x(v,w),ge(k,v,null),x(e,_),x(e,S),i[16](e),E=!0,y||(I=fr(i[11].call(null,e)),y=!0)},p(C,D){(!E||D&128&&n!==(n=C[7].id&&C[7].id!==""?null:!0))&&(t.disabled=n);const R={};D&256&&(R.label=C[8]("enclosures.settings.name.label",{default:"Name"})),D&256&&(R.placeholder=C[8]("enclosures.settings.name.placeholder",{default:"Enter a name"})),D&256&&(R.help=C[8]("enclosures.settings.name.help",{default:"Enter an easy to remember name."})),D&256&&(R.invalid=C[8]("enclosures.settings.name.invalid",{default:"The entered name is not valid. It cannot be empty."})),o.$set(R);const N={};D&128&&(N.value=C[7].image),D&256&&(N.label=C[8]("enclosures.settings.image.label",{default:"Image"})),D&256&&(N.placeholder=C[8]("enclosures.settings.image.placeholder",{default:"Select an image file"})),D&256&&(N.help=C[8]("enclosures.settings.image.help",{default:"Upload a JPG or PNG."})),D&256&&(N.invalid=C[8]("enclosures.settings.image.invalid",{default:"The selected file is not valid. It is not an image file."})),d.$set(N);const F={};D&128&&(F.value=C[7].description),D&256&&(F.label=C[8]("enclosures.settings.description.label",{default:"Description"})),D&256&&(F.placeholder=C[8]("enclosures.settings.description.placeholder",{default:"Enter a description"})),D&256&&(F.help=C[8]("enclosures.settings.description.help",{default:"Enter some description text about this enclosure."})),m.$set(F);const B={};D&128&&(B.value=C[7].doors),D&16&&(B.options=C[4]),D&256&&(B.label=C[8]("enclosures.settings.doors.label",{default:"Doors"})),D&256&&(B.help=C[8]("enclosures.settings.doors.help",{default:"Select the door(s) for this enclosure."})),b.$set(B);const V={};D&128&&(V.value=C[7].webcams),D&32&&(V.options=C[5]),D&256&&(V.label=C[8]("enclosures.settings.webcams.label",{default:"Webcams"})),D&256&&(V.help=C[8]("enclosures.settings.webcams.help",{default:"Select the webcam(s) for this enclosure."})),k.$set(V),(!E||D&8)&&fe(e,"was-validated",C[3])},i(C){E||(W(o.$$.fragment,C),W(d.$$.fragment,C),W(m.$$.fragment,C),W(b.$$.fragment,C),W(k.$$.fragment,C),E=!0)},o(C){Q(o.$$.fragment,C),Q(d.$$.fragment,C),Q(m.$$.fragment,C),Q(b.$$.fragment,C),Q(k.$$.fragment,C),E=!1},d(C){C&&H(e),ve(o),ve(d),ve(m),ve(b),ve(k),i[16](null),y=!1,I()}}}function fue(i){let e,t,n=i[8]("enclosures.settings.title",{default:"Enclosure settings"})+"",a,r,s,o;return s=new Ws({props:{moreInfo:"https://theyosh.github.io/TerrariumPI/setup/#enclosures"}}),{c(){e=M("i"),t=X(),a=Se(n),r=X(),be(s.$$.fragment),A(e,"class","fas fa-globe mr-2")},m(l,u){j(l,e,u),j(l,t,u),j(l,a,u),j(l,r,u),ge(s,l,u),o=!0},p(l,u){(!o||u&256)&&n!==(n=l[8]("enclosures.settings.title",{default:"Enclosure settings"})+"")&&Ce(a,n)},i(l){o||(W(s.$$.fragment,l),o=!0)},o(l){Q(s.$$.fragment,l),o=!1},d(l){l&&(H(e),H(t),H(a),H(r)),ve(s,l)}}}function mue(i){let e,t,n,a=i[8]("modal.general.save",{default:"Save"})+"",r,s,o,l;return{c(){e=M("button"),t=M("span"),n=X(),r=Se(a),A(t,"class","spinner-border spinner-border-sm"),A(t,"role","status"),A(t,"aria-hidden","true"),fe(t,"d-none",!i[9]),A(e,"type","button"),A(e,"class","btn btn-primary"),e.disabled=s=i[2]||i[9]},m(u,d){j(u,e,d),x(e,t),x(e,n),x(e,r),o||(l=Zt(e,"click",i[13]),o=!0)},p(u,d){d&512&&fe(t,"d-none",!u[9]),d&256&&a!==(a=u[8]("modal.general.save",{default:"Save"})+"")&&Ce(r,a),d&516&&s!==(s=u[2]||u[9])&&(e.disabled=s)},d(u){u&&H(e),o=!1,l()}}}function pue(i){let e,t,n,a;function r(l){i[17](l)}function s(l){i[18](l)}let o={loading:i[2],$$slots:{actions:[mue],header:[fue],default:[hue]},$$scope:{ctx:i}};return i[0]!==void 0&&(o.show=i[0]),i[1]!==void 0&&(o.hide=i[1]),e=new Yo({props:o}),ni.push(()=>En(e,"show",r)),ni.push(()=>En(e,"hide",s)),{c(){be(e.$$.fragment)},m(l,u){ge(e,l,u),a=!0},p(l,[u]){const d={};u&4&&(d.loading=l[2]),u&33555452&&(d.$$scope={dirty:u,ctx:l}),!t&&u&1&&(t=!0,d.show=l[0],Sn(()=>t=!1)),!n&&u&2&&(n=!0,d.hide=l[1],Sn(()=>n=!1)),e.$set(d)},i(l){a||(W(e.$$.fragment,l),a=!0)},o(l){Q(e.$$.fragment,l),a=!1},d(l){ve(e,l)}}}function gue(i,e,t){let n,a,r;mt(i,Yi,N=>t(8,a=N));let s,o,l=!1,u=!1,d=[],c=[],h=Di({});mt(i,h,N=>t(7,n=N));let f;const m=Ya(),g=()=>{m("save")};function v(N,F){return Wt(this,null,function*(){if(t(3,u=!0),F.form.checkValidity()){if(t(2,l=!0),N=ha(f),N.file_image)try{N.image=yield eT(F.form.file_image),N.delete_image=!1}catch(B){Pi(B.message,a("notification.form.save.error.title",{default:"Save Error"})),t(2,l=!1),t(3,u=!1);return}delete N.areas,delete N.file_image;try{yield q5(N,B=>N=B),wn(a("enclosures.settings.save.ok.message",{default:"Enclosure ''{name}'' is updated",values:{name:N.name}}),a("notification.form.save.ok.title",{default:"Save OK"})),I(),g()}catch(B){t(2,l=!1),Pi(B.message,a("notification.form.save.error.title",{default:"Save Error"}))}finally{t(3,u=!1)}}else{let B=a("enclosures.settings.save.error.required_fields",{default:"Not all required fields are entered correctly."});B+=` '`+ko(f).join(`' diff --git a/public/main.js.gz b/public/main.js.gz index 75e44febc..4612f21bf 100644 Binary files a/public/main.js.gz and b/public/main.js.gz differ