"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[30769],{42984:function(a,t,e){e.a(a,async function(a,o){try{e.r(t);var i,s,n=e(28430),l=e(97058),h=e(57567),r=e(25979),c=e(12463),d=e(40227),u=e(16472),p=(e(28706),e(15697)),_=e(57527),v=e(51209),m=e(90789),f=e(148),g=e(98747),y=(e(90507),e(73651)),k=e(55682),b=e(62672),A=e(19157),C=e(76730),w=a([g,y,k]);[g,y,k]=w.then?(await w)():w;var D=function(a){function t(){var a;(0,h.A)(this,t);for(var e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return(a=(0,u.A)(this,t,[].concat(o)))._open=!1,a._navInfo=new b.q((0,d.A)(a)),a._schema=(0,m.A)(function(a,t){return[{name:"path",required:!0,selector:{navigation:{}}},{name:"label",selector:{text:{placeholder:a}}},{name:"icon",selector:{icon:{placeholder:t}}},{name:"color",selector:{ui_color:{default_color:"primary"}}}]}),a._computeLabel=function(t){return a.hass.localize("ui.panel.home.editor.shortcut.".concat(t.name))||a.hass.localize("ui.panel.lovelace.editor.card.generic.".concat(t.name))},a}return(0,c.A)(t,a),(0,r.A)(t,[{key:"showDialog",value:function(a){this._params=a,this._data=(0,l.A)({},a.item),this._initDirtyTracking({type:"shallow"},this._data),this._open=!0}},{key:"willUpdate",value:function(a){var t;(a.has("_data")||a.has("hass"))&&this.hass&&this._navInfo.update(this.hass,null===(t=this._data)||void 0===t?void 0:t.path)}},{key:"closeDialog",value:function(){return this._open=!1,!0}},{key:"_dialogClosed",value:function(){this._params=void 0,this._data=void 0,(0,f.r)(this,"dialog-closed",{dialog:this.localName})}},{key:"render",value:function(){if(!this._params||!this._data)return _.s6;var a=this._navInfo.info,t=a.label||"",e=a.icon||"mdi:link";return(0,_.qy)(i||(i=(0,n.A)([" <ha-dialog .open="," .headerTitle=",' width="small" .preventScrimClose='," @closed=","> <ha-form .hass="," .data="," .schema="," .computeLabel="," @value-changed=",'></ha-form> <ha-dialog-footer slot="footer"> <ha-button appearance="plain" slot="secondaryAction" @click=',"> ",' </ha-button> <ha-button slot="primaryAction" @click='," .disabled=","> "," </ha-button> </ha-dialog-footer> </ha-dialog> "])),this._open,this.hass.localize("ui.panel.home.editor.edit_shortcut"),this.isDirtyState,this._dialogClosed,this.hass,this._data,this._schema(t,e),this._computeLabel,this._valueChanged,this.closeDialog,this.hass.localize("ui.common.cancel"),this._save,!this.isDirtyState,this.hass.localize("ui.common.save"))}},{key:"_valueChanged",value:function(a){a.stopPropagation(),this._data=a.detail.value,this._updateDirtyState(this._data)}},{key:"_save",value:function(){var a;if(this._params&&null!==(a=this._data)&&void 0!==a&&a.path){var t=this._data,e=t.path,o=t.label,i=t.icon,s=t.color;this._params.saveCallback({type:"custom",path:e,label:o||void 0,icon:i||void 0,color:s||void 0}),this._markDirtyStateClean(),this.closeDialog()}}}])}((0,A.U)()(_.WF));D.styles=[C.nA,(0,_.AH)(s||(s=(0,n.A)(["ha-dialog{--dialog-content-padding:var(--ha-space-6)}ha-form{display:block}"])))],(0,p.Cg)([(0,v.MZ)({attribute:!1})],D.prototype,"hass",void 0),(0,p.Cg)([(0,v.wk)()],D.prototype,"_params",void 0),(0,p.Cg)([(0,v.wk)()],D.prototype,"_data",void 0),(0,p.Cg)([(0,v.wk)()],D.prototype,"_open",void 0),D=(0,p.Cg)([(0,v.EM)("dialog-edit-shortcut")],D),e.d(t,{DialogEditShortcut:function(){return D}}),o()}catch(S){o(S)}})}}]);
//# sourceMappingURL=30769.c8ff875b87411e5c.js.map