"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["84813"],{72828:function(t,e,s){s.a(t,async function(t,i){try{s.r(e),s.d(e,{FlowPreviewGeneric:function(){return v}});s(3362),s(62953);var r=s(40445),o=s(96196),n=s(77845),a=s(51840),h=s(7986),u=s(9899),_=s(1087),p=s(38962),d=t([h,p]);[h,p]=d.then?(await d)():d;let w,c,l=t=>t;class v extends o.WF{disconnectedCallback(){super.disconnectedCallback(),this._unsub&&(this._unsub.then(t=>t()),this._unsub=void 0)}willUpdate(t){t.has("stepData")&&this._debouncedSubscribePreview()}render(){return this._error?(0,o.qy)(w||(w=l`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):(0,o.qy)(c||(c=l`<entity-preview-row .hass="${0}" .stateObj="${0}"></entity-preview-row>`),this.hass,this._preview)}async _subscribePreview(){if(this._unsub&&((await this._unsub)(),this._unsub=void 0),"config_flow"===this.flowType||"options_flow"===this.flowType||"config_subentries_flow"===this.flowType){this._error=void 0;try{this._unsub=(0,a.Q)(this.hass,this.domain,this.flowId,this.flowType,this.stepData,this._setPreview),await this._unsub,(0,_.r)(this,"set-flow-errors",{errors:{}})}catch(t){"string"==typeof t.message?this._error=t.message:(this._error=void 0,(0,_.r)(this,"set-flow-errors",t.message)),this._unsub=void 0,this._preview=void 0}}}constructor(...t){super(...t),this._setPreview=t=>{if(t.error)return this._error=t.error,void(this._preview=void 0);const e=(new Date).toISOString();this._preview=Object.assign({entity_id:`${this.stepId}.___flow_preview___`,last_changed:e,last_updated:e,context:{id:"",parent_id:null,user_id:null}},t)},this._debouncedSubscribePreview=(0,u.s)(()=>{this._subscribePreview()},250)}}(0,r.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,r.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"flowType",void 0),(0,r.Cg)([(0,n.MZ)()],v.prototype,"domain",void 0),(0,r.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"stepId",void 0),(0,r.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"flowId",void 0),(0,r.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"stepData",void 0),(0,r.Cg)([(0,n.wk)()],v.prototype,"_preview",void 0),(0,r.Cg)([(0,n.wk)()],v.prototype,"_error",void 0),v=(0,r.Cg)([(0,n.EM)("flow-preview-generic")],v),i()}catch(w){i(w)}})}}]);
//# sourceMappingURL=84813.1adbfa3b44eaacb3.js.map