"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["34328"],{54283:function(s,i,e){e.a(s,async function(s,t){try{e.r(i);e(18111),e(61701),e(3362),e(62953);var a=e(40445),n=e(96196),o=e(77845),h=e(1087),r=e(65829),c=e(18350),l=(e(93444),e(72554)),d=e(72001),v=e(14503),_=s([r,c,l]);[r,c,l]=_.then?(await _)():_;let g,p,u,w,f,b,$,y,m,z,L=s=>s;const x="M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41 10.59L10 14.17L17.59 6.58L19 8L10 17Z",C="M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z";class k extends n.WF{async showDialog(s){this._stages=void 0,this.device_id=s.device_id,this._open=!0}render(){return this.device_id?(0,n.qy)(g||(g=L` <ha-dialog .hass="${0}" .open="${0}" header-title="${0}" @closed="${0}"> ${0} ${0} ${0} ${0} ${0} <ha-dialog-footer slot="footer"> ${0} </ha-dialog-footer> </ha-dialog> `),this.hass,this._open,this.hass.localize("ui.panel.config.zwave_js.reinterview_node.title"),this._dialogClosed,this._status?"":(0,n.qy)(p||(p=L` <p> ${0} </p> <p> <em> ${0} </em> </p> `),this.hass.localize("ui.panel.config.zwave_js.reinterview_node.introduction"),this.hass.localize("ui.panel.config.zwave_js.reinterview_node.battery_device_warning")),"started"===this._status?(0,n.qy)(u||(u=L` <div class="flex-container"> <ha-spinner></ha-spinner> <div class="status"> <p> <b> ${0} </b> </p> <p> ${0} </p> </div> </div> `),this.hass.localize("ui.panel.config.zwave_js.reinterview_node.in_progress"),this.hass.localize("ui.panel.config.zwave_js.reinterview_node.run_in_background")):"","failed"===this._status?(0,n.qy)(w||(w=L` <div class="flex-container"> <ha-svg-icon .path="${0}" class="failed"></ha-svg-icon> <div class="status"> <p> ${0} </p> </div> </div> `),C,this.hass.localize("ui.panel.config.zwave_js.reinterview_node.interview_failed")):"","finished"===this._status?(0,n.qy)(f||(f=L` <div class="flex-container"> <ha-svg-icon .path="${0}" class="success"></ha-svg-icon> <div class="status"> <p> ${0} </p> </div> </div> `),x,this.hass.localize("ui.panel.config.zwave_js.reinterview_node.interview_complete")):"",this._stages?(0,n.qy)(b||(b=L` <div class="stages"> ${0} </div> `),this._stages.map(s=>(0,n.qy)($||($=L` <span class="stage"> <ha-svg-icon .path="${0}" class="success"></ha-svg-icon> ${0} </span> `),x,s))):"",this._status?(0,n.qy)(m||(m=L` <ha-button slot="primaryAction" @click="${0}"> ${0} </ha-button> `),this.closeDialog,this.hass.localize("ui.common.close")):(0,n.qy)(y||(y=L` <ha-button slot="primaryAction" @click="${0}"> ${0} </ha-button> `),this._startReinterview,this.hass.localize("ui.panel.config.zwave_js.reinterview_node.start_reinterview"))):n.s6}_startReinterview(){this.hass&&(this._subscribed=(0,d.Eo)(this.hass,this.device_id,this._handleMessage.bind(this)))}_handleMessage(s){"interview started"===s.event&&(this._status="started"),"interview stage completed"===s.event&&(void 0===this._stages?this._stages=[s.stage]:this._stages=[...this._stages,s.stage]),"interview failed"===s.event&&(this._unsubscribe(),this._status="failed"),"interview completed"===s.event&&(this._unsubscribe(),this._status="finished")}_unsubscribe(){this._subscribed&&(this._subscribed.then(s=>s()),this._subscribed=void 0)}closeDialog(){this._open=!1}_dialogClosed(){this.device_id=void 0,this._status=void 0,this._stages=void 0,this._unsubscribe(),(0,h.r)(this,"dialog-closed",{dialog:this.localName})}static get styles(){return[v.nA,(0,n.AH)(z||(z=L`.success{color:var(--success-color)}.failed{color:var(--error-color)}.flex-container{display:flex;align-items:center}.stages{margin-top:16px}.stage ha-svg-icon{width:16px;height:16px}.stage{padding:8px}ha-svg-icon{width:68px;height:48px}.flex-container ha-spinner,.flex-container ha-svg-icon{margin-right:20px;margin-inline-end:20px;margin-inline-start:initial}`))]}constructor(...s){super(...s),this._open=!1}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],k.prototype,"hass",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"device_id",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_status",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_stages",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_open",void 0),k=(0,a.Cg)([(0,o.EM)("dialog-zwave_js-reinterview-node")],k),t()}catch(g){t(g)}})}}]);
//# sourceMappingURL=34328.d39b2b9f49ad7633.js.map