"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["806"],{40101:function(i,e,s){s.a(i,async function(i,a){try{s.r(e);s(35748),s(65315),s(37089),s(5934),s(95013);var t=s(69868),o=s(84922),l=s(11991),d=s(65940),c=s(44017),r=(s(68940),s(17372)),h=(s(77510),s(53312),s(96635)),n=s(63625),v=s(72274),g=s(15241),m=s(50809),p=i([r,h]);[r,h]=p.then?(await p)():p;let _,u,k,y,$,P,D=i=>i;const b=(0,d.A)(i=>{const e=1e3*i.host.disk_used/60/30,s=4*i.host.startup_time/60;return 10*Math.ceil((e+s)/10)});class z extends o.WF{showDialog(i){this.dialogParams=i,(0,v.xY)(this.hass).then(i=>{this.devices=i.devices})}closeDialog(){this.dialogParams=void 0,this.selectedDevice=void 0,this.devices=void 0,this.moving=!1,(0,c.r)(this,"dialog-closed",{dialog:this.localName})}render(){var i;return this.dialogParams?(0,o.qy)(_||(_=D` <ha-dialog open scrimClickAction escapeKeyAction .heading="${0}" @closed="${0}" ?hideActions="${0}"> ${0} </ha-dialog> `),this.moving?this.dialogParams.supervisor.localize("dialog.datadisk_move.moving"):this.dialogParams.supervisor.localize("dialog.datadisk_move.title"),this.closeDialog,this.moving,this.moving?(0,o.qy)(u||(u=D`<ha-spinner aria-label="Moving" size="large"></ha-spinner> <p class="progress-text"> ${0} </p>`),this.dialogParams.supervisor.localize("dialog.datadisk_move.moving_desc")):(0,o.qy)(k||(k=D` ${0} <ha-button appearance="plain" slot="primaryAction" @click="${0}" dialogInitialFocus> ${0} </ha-button> <ha-button .disabled="${0}" slot="primaryAction" @click="${0}"> ${0} </ha-button>`),null!==(i=this.devices)&&void 0!==i&&i.length?(0,o.qy)(y||(y=D` ${0} <br><br> <ha-select .label="${0}" @selected="${0}" dialogInitialFocus> ${0} </ha-select> `),this.dialogParams.supervisor.localize("dialog.datadisk_move.description",{current_path:this.dialogParams.supervisor.os.data_disk,time:b(this.dialogParams.supervisor)}),this.dialogParams.supervisor.localize("dialog.datadisk_move.select_device"),this._selectDevice,this.devices.map(i=>(0,o.qy)($||($=D`<ha-list-item .value="${0}">${0}</ha-list-item>`),i,i))):void 0===this.devices?this.dialogParams.supervisor.localize("dialog.datadisk_move.loading_devices"):this.dialogParams.supervisor.localize("dialog.datadisk_move.no_devices"),this.closeDialog,this.dialogParams.supervisor.localize("dialog.datadisk_move.cancel"),!this.selectedDevice,this._moveDatadisk,this.dialogParams.supervisor.localize("dialog.datadisk_move.move"))):o.s6}_selectDevice(i){this.selectedDevice=i.target.value}async _moveDatadisk(){this.moving=!0;try{await(0,v.v9)(this.hass,this.selectedDevice)}catch(i){this.hass.connection.connected&&!(0,n.Tv)(i)&&((0,g.K$)(this,{title:this.dialogParams.supervisor.localize("system.host.failed_to_move"),text:(0,n.VR)(i)}),this.closeDialog())}}static get styles(){return[m.RF,m.nA,(0,o.AH)(P||(P=D`ha-select{width:100%}ha-spinner{display:block;margin:32px;text-align:center}.progress-text{text-align:center}`))]}constructor(...i){super(...i),this.moving=!1}}(0,t.__decorate)([(0,l.MZ)({attribute:!1})],z.prototype,"hass",void 0),(0,t.__decorate)([(0,l.wk)()],z.prototype,"dialogParams",void 0),(0,t.__decorate)([(0,l.wk)()],z.prototype,"selectedDevice",void 0),(0,t.__decorate)([(0,l.wk)()],z.prototype,"devices",void 0),(0,t.__decorate)([(0,l.wk)()],z.prototype,"moving",void 0),z=(0,t.__decorate)([(0,l.EM)("dialog-hassio-datadisk")],z),a()}catch(_){a(_)}})}}]);
//# sourceMappingURL=806.4c25d6dd33c369fe.js.map