export const __rspack_esm_id="14558";export const __rspack_esm_ids=["14558"];export const __webpack_modules__={34370(i,a,e){e(18111),e(7588),i.exports=function i(a){return Object.freeze(a),Object.getOwnPropertyNames(a).forEach(function(e){!a.hasOwnProperty(e)||null===a[e]||"object"!=typeof a[e]&&"function"!=typeof a[e]||Object.isFrozen(a[e])||i(a[e])}),a}},69293(i,a,e){e.a(i,async function(i,s){try{e.r(a),e.d(a,{HuiDialogSuggestBadge:()=>y});e(18111),e(61701);var t=e(62826),o=e(34370),n=e.n(o),r=e(96196),h=e(97735),g=e(1087),l=e(10763),d=e(18350),p=(e(93444),e(72554)),c=e(14503),_=e(92255),f=e(43908),m=e(82360),u=e(75196),v=i([l,d,p,f]);[l,d,p,f]=v.then?(await v)():v;class y extends r.WF{showDialog(i){this._params=i,this._badgeConfig=i.badgeConfig,this._open=!0,Object.isFrozen(this._badgeConfig)||(this._badgeConfig=n()(this._badgeConfig)),this._yamlEditor&&this._yamlEditor.setValue(this._badgeConfig)}closeDialog(){this._open=!1}_dialogClosed(){this._open=!1,this._params=void 0,this._badgeConfig=void 0,(0,g.r)(this,"dialog-closed",{dialog:this.localName})}_renderPreview(){return this._badgeConfig?r.qy` <div class="element-preview"> ${this._badgeConfig.map(i=>r.qy` <hui-badge .hass="${this.hass}" .config="${i}" preview></hui-badge> `)} </div> `:r.s6}render(){return this._params?r.qy` <ha-dialog .hass="${this.hass}" .open="${this._open}" header-title="${this.hass.localize("ui.panel.lovelace.editor.suggest_badge.header")}" @closed="${this._dialogClosed}"> <div> ${this._renderPreview()} ${this._params.yaml&&this._badgeConfig?r.qy` <div class="editor"> <ha-yaml-editor .hass="${this.hass}" .defaultValue="${this._badgeConfig}" in-dialog></ha-yaml-editor> </div> `:r.s6} </div> <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" appearance="plain" @click="${this.closeDialog}" autofocus> ${this._params.yaml?this.hass.localize("ui.common.close"):this.hass.localize("ui.common.cancel")} </ha-button> ${this._params.yaml?r.s6:r.qy` <ha-button slot="primaryAction" @click="${this._save}" .loading="${this._saving}"> ${this.hass.localize("ui.panel.lovelace.editor.suggest_badge.add")} </ha-button> `} </ha-dialog-footer> </ha-dialog> `:r.s6}static get styles(){return[c.nA,r.AH`ha-dialog{--dialog-z-index:6}.hidden{display:none}.element-preview{position:relative;display:flex;align-items:flex-start;flex-wrap:wrap;justify-content:center;gap:var(--ha-space-2);margin:0}.editor{padding-top:16px}`]}_computeNewConfig(i,a){const{viewIndex:e}=(0,u.$P)(a),s=this._badgeConfig;return(0,m.En)(i,[e],s)}async _save(){if(!(this._params?.lovelaceConfig&&this._params?.path&&this._params?.saveConfig&&this._badgeConfig))return;this._saving=!0;const i=this._computeNewConfig(this._params.lovelaceConfig,this._params.path);await this._params.saveConfig(i),this._saving=!1,(0,_.f)(this,this.hass),this.closeDialog()}constructor(...i){super(...i),this._open=!1,this._saving=!1}}(0,t.Cg)([(0,h.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,t.Cg)([(0,h.wk)()],y.prototype,"_params",void 0),(0,t.Cg)([(0,h.wk)()],y.prototype,"_open",void 0),(0,t.Cg)([(0,h.wk)()],y.prototype,"_badgeConfig",void 0),(0,t.Cg)([(0,h.wk)()],y.prototype,"_saving",void 0),(0,t.Cg)([(0,h.P)("ha-yaml-editor")],y.prototype,"_yamlEditor",void 0),y=(0,t.Cg)([(0,h.EM)("hui-dialog-suggest-badge")],y),s()}catch(i){s(i)}})},92255(i,a,e){e.d(a,{f:()=>t});var s=e(81619);const t=(i,a)=>(0,s.P)(i,{message:a.localize("ui.common.successfully_saved")})}};
//# sourceMappingURL=14558.9d96df8ddf1302dd.js.map