export const __rspack_esm_id="14558";export const __rspack_esm_ids=["14558"];export const __webpack_modules__={34370(a,i,e){e(18111),e(7588),a.exports=function a(i){return Object.freeze(i),Object.getOwnPropertyNames(i).forEach(function(e){!i.hasOwnProperty(e)||null===i[e]||"object"!=typeof i[e]&&"function"!=typeof i[e]||Object.isFrozen(i[e])||a(i[e])}),i}},69293(a,i,e){e.a(a,async function(a,s){try{e.r(i),e.d(i,{HuiDialogSuggestBadge:()=>v});e(18111),e(61701);var t=e(62826),o=e(34370),n=e.n(o),h=e(96196),l=e(44457),d=e(1087),g=e(10763),r=e(18350),c=e(14503),p=e(92255),_=e(43908),m=e(82360),u=e(75196),f=a([g,r,_]);[g,r,_]=f.then?(await f)():f;class v extends h.WF{showDialog(a){this._params=a,this._badgeConfig=a.badgeConfig,Object.isFrozen(this._badgeConfig)||(this._badgeConfig=n()(this._badgeConfig)),this._yamlEditor&&this._yamlEditor.setValue(this._badgeConfig)}closeDialog(){this._params=void 0,this._badgeConfig=void 0,(0,d.r)(this,"dialog-closed",{dialog:this.localName})}_renderPreview(){return this._badgeConfig?h.qy` <div class="element-preview"> ${this._badgeConfig.map(a=>h.qy` <hui-badge .hass="${this.hass}" .config="${a}" preview></hui-badge> `)} </div> `:h.s6}render(){return this._params?h.qy` <ha-dialog open scrimClickAction @closed="${this.closeDialog}" .heading="${this.hass.localize("ui.panel.lovelace.editor.suggest_badge.header")}"> <div> ${this._renderPreview()} ${this._params.yaml&&this._badgeConfig?h.qy` <div class="editor"> <ha-yaml-editor .hass="${this.hass}" .defaultValue="${this._badgeConfig}"></ha-yaml-editor> </div> `:h.s6} </div> <ha-button appearance="plain" slot="primaryAction" @click="${this.closeDialog}" dialogInitialFocus> ${this._params.yaml?this.hass.localize("ui.common.close"):this.hass.localize("ui.common.cancel")} </ha-button> ${this._params.yaml?h.s6:h.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> `:h.s6}static get styles(){return[c.nA,h.AH`@media all and (max-width:450px),all and (max-height:500px){ha-dialog{max-height:100%;height:100%}}@media all and (min-width:850px){ha-dialog{width:845px}}ha-dialog{max-width:845px;--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(a,i){const{viewIndex:e}=(0,u.$P)(i),s=this._badgeConfig;return(0,m.En)(a,[e],s)}async _save(){if(!(this._params?.lovelaceConfig&&this._params?.path&&this._params?.saveConfig&&this._badgeConfig))return;this._saving=!0;const a=this._computeNewConfig(this._params.lovelaceConfig,this._params.path);await this._params.saveConfig(a),this._saving=!1,(0,p.f)(this,this.hass),this.closeDialog()}constructor(...a){super(...a),this._saving=!1}}(0,t.Cg)([(0,l.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,t.Cg)([(0,l.wk)()],v.prototype,"_params",void 0),(0,t.Cg)([(0,l.wk)()],v.prototype,"_badgeConfig",void 0),(0,t.Cg)([(0,l.wk)()],v.prototype,"_saving",void 0),(0,t.Cg)([(0,l.P)("ha-yaml-editor")],v.prototype,"_yamlEditor",void 0),v=(0,t.Cg)([(0,l.EM)("hui-dialog-suggest-badge")],v),s()}catch(a){s(a)}})},92255(a,i,e){e.d(i,{f:()=>t});var s=e(81619);const t=(a,i)=>(0,s.P)(a,{message:i.localize("ui.common.successfully_saved")})}};
//# sourceMappingURL=14558.5a6f5ec5148a8016.js.map