"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["1926"],{40741:function(e,a,t){t.a(e,async function(e,s){try{t.r(a);t(35748),t(95013);var i=t(69868),o=t(84922),r=t(65940),l=t(11991),h=t(44017),c=t(68940),d=(t(60921),t(17372)),n=t(50809),_=e([d]);d=(_.then?(await _)():_)[0];let u,p=e=>e;class m extends o.WF{showDialog(e){var a;this._params=e,this._error=void 0,this._data=e.block,this._expand=!(null===(a=e.block)||void 0===a||!a.data)}closeDialog(){this._params=void 0,this._data=void 0,(0,h.r)(this,"dialog-closed",{dialog:this.localName})}render(){return this._params&&this._data?(0,o.qy)(u||(u=p` <ha-dialog open @closed="${0}" .heading="${0}"> <div> <ha-form .hass="${0}" .schema="${0}" .data="${0}" .error="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> </div> <ha-button slot="secondaryAction" @click="${0}" appearance="plain" variant="danger"> ${0} </ha-button> <ha-button slot="primaryAction" @click="${0}"> ${0} </ha-button> </ha-dialog> `),this.closeDialog,(0,c.l)(this.hass,this.hass.localize("ui.dialogs.helper_settings.schedule.edit_schedule_block")),this.hass,this._schema(this._expand),this._data,this._error,this._computeLabelCallback,this._valueChanged,this._deleteBlock,this.hass.localize("ui.common.delete"),this._updateBlock,this.hass.localize("ui.common.save")):o.s6}_valueChanged(e){this._error=void 0,this._data=e.detail.value}_updateBlock(){try{this._params.updateBlock(this._data),this.closeDialog()}catch(e){this._error={base:e?e.message:"Unknown error"}}}_deleteBlock(){try{this._params.deleteBlock(),this.closeDialog()}catch(e){this._error={base:e?e.message:"Unknown error"}}}static get styles(){return[n.nA]}constructor(...e){super(...e),this._expand=!1,this._schema=(0,r.A)(e=>[{name:"from",required:!0,selector:{time:{no_second:!0}}},{name:"to",required:!0,selector:{time:{no_second:!0}}},{name:"advanced_settings",type:"expandable",flatten:!0,expanded:e,schema:[{name:"data",required:!1,selector:{object:{}}}]}]),this._computeLabelCallback=e=>{switch(e.name){case"from":return this.hass.localize("ui.dialogs.helper_settings.schedule.start");case"to":return this.hass.localize("ui.dialogs.helper_settings.schedule.end");case"data":return this.hass.localize("ui.dialogs.helper_settings.schedule.data");case"advanced_settings":return this.hass.localize("ui.dialogs.helper_settings.generic.advanced_settings")}return""}}}(0,i.__decorate)([(0,l.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,i.__decorate)([(0,l.wk)()],m.prototype,"_error",void 0),(0,i.__decorate)([(0,l.wk)()],m.prototype,"_data",void 0),(0,i.__decorate)([(0,l.wk)()],m.prototype,"_params",void 0),customElements.define("dialog-schedule-block-info",m),s()}catch(u){s(u)}})}}]);
//# sourceMappingURL=1926.e9fa4ea5efb3b682.js.map