"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["33425"],{21288:function(i,e,t){t.a(i,async function(i,a){try{t.r(e);t(18111),t(61701),t(3362),t(62953);var s=t(40445),n=t(96196),o=t(77845),c=t(1087),r=(t(8630),t(28732),t(65829)),d=t(72554),h=t(20559),l=t(65063),_=t(14503),f=i([r,d]);[r,d]=f.then?(await f)():f;let g,p,m,b,v,u=i=>i;const y="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z";class x extends n.WF{async showDialog(i){this.device_id=i.device_id,this._open=!0,this._fetchNodeDetails()}render(){return this.device_id?(0,n.qy)(g||(g=u` <ha-dialog .hass="${0}" .open="${0}" header-title="${0}" @closed="${0}"> <p> ${0} </p> ${0} </ha-dialog> `),this.hass,this._open,this.hass.localize("ui.panel.config.matter.manage_fabrics.title"),this._dialogClosed,this.hass.localize("ui.panel.config.matter.manage_fabrics.fabrics"),this._nodeDiagnostics?(0,n.qy)(p||(p=u`<ha-list> ${0} </ha-list>`),this._nodeDiagnostics.active_fabrics.map(i=>(0,n.qy)(m||(m=u`<ha-list-item noninteractive .hasMeta="${0}">${0} <ha-icon-button @click="${0}" slot="meta" .fabric="${0}" .path="${0}"></ha-icon-button> </ha-list-item>`),this._nodeDiagnostics.available&&i.fabric_index!==this._nodeDiagnostics.active_fabric_index,i.vendor_name||i.fabric_label||i.vendor_id,this._removeFabric,i,y))):(0,n.qy)(b||(b=u`<div class="center"> <ha-spinner></ha-spinner> </div>`))):n.s6}async _fetchNodeDetails(){if(this.device_id)try{this._nodeDiagnostics=await(0,h.eB)(this.hass,this.device_id)}catch(i){this._nodeDiagnostics=void 0}}async _removeFabric(i){const e=i.target.fabric;if(this._nodeDiagnostics.active_fabric_index===e.fabric_index)return;const t=e.vendor_name||e.fabric_label||e.vendor_id.toString();if(await(0,l.dk)(this,{title:this.hass.localize("ui.panel.config.matter.manage_fabrics.remove_fabric_confirm_header",{fabric:t}),text:this.hass.localize("ui.panel.config.matter.manage_fabrics.remove_fabric_confirm_text",{fabric:t}),warning:!0}))try{await(0,h.vX)(this.hass,this.device_id,e.fabric_index),this._fetchNodeDetails()}catch(a){(0,l.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.matter.manage_fabrics.remove_fabric_failed_header",{fabric:t}),text:this.hass.localize("ui.panel.config.matter.manage_fabrics.remove_fabric_failed_text")})}}closeDialog(){this._open=!1}_dialogClosed(){this.device_id=void 0,this._nodeDiagnostics=void 0,(0,c.r)(this,"dialog-closed",{dialog:this.localName})}static get styles(){return[_.nA,(0,n.AH)(v||(v=u`ha-dialog{--dialog-content-padding:0;--mdc-list-side-padding:24px;--mdc-list-side-padding-right:16px;--mdc-list-item-meta-size:48px}p{margin:8px 24px}.center{display:flex;align-items:center;justify-content:center}`))]}constructor(...i){super(...i),this._open=!1}}(0,s.Cg)([(0,o.MZ)({attribute:!1})],x.prototype,"hass",void 0),(0,s.Cg)([(0,o.wk)()],x.prototype,"device_id",void 0),(0,s.Cg)([(0,o.wk)()],x.prototype,"_nodeDiagnostics",void 0),(0,s.Cg)([(0,o.wk)()],x.prototype,"_open",void 0),x=(0,s.Cg)([(0,o.EM)("dialog-matter-manage-fabrics")],x),a()}catch(g){a(g)}})}}]);
//# sourceMappingURL=33425.baabb4f020afe769.js.map