"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["8441"],{60931:function(t,a,o){o.a(t,async function(t,i){try{o.r(a);o(35748),o(5934),o(95013);var e=o(69868),r=o(84922),n=o(11991),s=o(65940),c=o(44017),l=(o(68940),o(17372)),u=(o(60921),o(63625)),h=o(51203),d=o(50809),p=t([l]);l=(p.then?(await p)():p)[0];let _,m,g,f=t=>t;const v=(0,s.A)(()=>[{name:"default_backup_mount",required:!0,selector:{backup_location:{}}}]);class b extends r.WF{async showDialog(t){this._dialogParams=t}closeDialog(){this._data=void 0,this._error=void 0,this._waiting=void 0,this._dialogParams=void 0,(0,c.r)(this,"dialog-closed",{dialog:this.localName})}render(){return this._dialogParams?(0,r.qy)(_||(_=f` <ha-dialog open scrimClickAction escapeKeyAction .heading="${0}" @closed="${0}"> ${0} <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" .computeHelper="${0}" @value-changed="${0}" dialogInitialFocus></ha-form> <ha-button appearance="plain" slot="secondaryAction" @click="${0}" dialogInitialFocus> ${0} </ha-button> <ha-button .disabled="${0}" slot="primaryAction" @click="${0}"> ${0} </ha-button> </ha-dialog> `),this._dialogParams.supervisor.localize("dialog.backup_location.title"),this.closeDialog,this._error?(0,r.qy)(m||(m=f`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):r.s6,this.hass,this._data,v(),this._computeLabelCallback,this._computeHelperCallback,this._valueChanged,this.closeDialog,this._dialogParams.supervisor.localize("common.cancel"),this._waiting||!this._data,this._changeMount,this._dialogParams.supervisor.localize("common.save")):r.s6}_valueChanged(t){const a=t.detail.value.default_backup_mount;this._data={default_backup_mount:"/backup"===a?null:a}}async _changeMount(){if(this._data){this._error=void 0,this._waiting=!0;try{await(0,h.Su)(this.hass,this._data)}catch(t){return this._error=(0,u.VR)(t),void(this._waiting=!1)}this.closeDialog()}}static get styles(){return[d.RF,d.nA,(0,r.AH)(g||(g=f`.delete-btn{--mdc-theme-primary:var(--error-color)}`))]}constructor(...t){super(...t),this._computeLabelCallback=t=>this._dialogParams.supervisor.localize(`dialog.backup_location.options.${t.name}.name`)||t.name,this._computeHelperCallback=t=>this._dialogParams.supervisor.localize(`dialog.backup_location.options.${t.name}.description`)}}(0,e.__decorate)([(0,n.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,e.__decorate)([(0,n.wk)()],b.prototype,"_dialogParams",void 0),(0,e.__decorate)([(0,n.wk)()],b.prototype,"_data",void 0),(0,e.__decorate)([(0,n.wk)()],b.prototype,"_waiting",void 0),(0,e.__decorate)([(0,n.wk)()],b.prototype,"_error",void 0),b=(0,e.__decorate)([(0,n.EM)("dialog-hassio-backup-location")],b),i()}catch(_){i(_)}})},51203:function(t,a,o){o.d(a,{Su:function(){return n},Wu:function(){return i},bK:function(){return r},h1:function(){return e}});o(5934);var i=function(t){return t.BIND="bind",t.CIFS="cifs",t.NFS="nfs",t}({}),e=function(t){return t.BACKUP="backup",t.MEDIA="media",t.SHARE="share",t}({});const r=async t=>t.callWS({type:"supervisor/api",endpoint:"/mounts",method:"get",timeout:null}),n=async(t,a)=>t.callWS({type:"supervisor/api",endpoint:"/mounts/options",method:"post",timeout:null,data:a})},19370:function(t,a,o){var i=o(36233),e=o(38707),r=o(78923),n=o(19799);t.exports=function(t,a){a&&"string"==typeof t||e(t);var o=n(t);return r(e(void 0!==o?i(o,t):t))}},43114:function(t,a,o){var i=o(87642),e=o(53319),r=o(33358),n=o(77977),s=o(30354),c=o(88721);i({target:"Array",proto:!0},{flatMap:function(t){var a,o=n(this),i=s(o);return r(t),(a=c(o,0)).length=e(a,o,o,i,0,1,t,arguments.length>1?arguments[1]:void 0),a}})},93225:function(t,a,o){o(93017)("flatMap")},12791:function(t,a,o){var i=o(87642),e=o(36233),r=o(33358),n=o(38707),s=o(78923),c=o(19370),l=o(49866),u=o(25727),h=o(55319),d=o(25008),p=o(66337),_=!h&&!d("flatMap",function(){}),m=!h&&!_&&p("flatMap",TypeError),g=h||_||m,f=l(function(){for(var t,a,o=this.iterator,i=this.mapper;;){if(a=this.inner)try{if(!(t=n(e(a.next,a.iterator))).done)return t.value;this.inner=null}catch(r){u(o,"throw",r)}if(t=n(e(this.next,o)),this.done=!!t.done)return;try{this.inner=c(i(t.value,this.counter++),!1)}catch(r){u(o,"throw",r)}}});i({target:"Iterator",proto:!0,real:!0,forced:g},{flatMap:function(t){n(this);try{r(t)}catch(a){u(this,"throw",a)}return m?e(m,this,t):new f(s(this),{mapper:t,inner:null})}})}}]);
//# sourceMappingURL=8441.616006e68df40519.js.map