"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["29160"],{84334:function(e,t,s){s.d(t,{H:function(){return r},R:function(){return i}});const i=(e,t,s)=>e.subscribeMessage(e=>t(e),Object.assign({type:"render_template"},s)),r=(e,t,s,i,r)=>e.connection.subscribeMessage(r,{type:"template/start_preview",flow_id:t,flow_type:s,user_input:i})},36315:function(e,t,s){s.a(e,async function(e,i){try{s.r(t);s(26910),s(18111),s(61701),s(3362),s(62953);var r=s(40445),o=s(96196),a=s(77845),l=s(9899),n=s(84334),h=s(7986),p=s(1087),_=s(38962),u=e([h,_]);[h,_]=u.then?(await u)():u;let d,c,w,b,v,g,y,f,m=e=>e;class $ extends o.WF{disconnectedCallback(){super.disconnectedCallback(),this._unsub&&(this._unsub.then(e=>e()),this._unsub=void 0)}willUpdate(e){e.has("stepData")&&this._debouncedSubscribePreview()}render(){var e;return this._error?(0,o.qy)(d||(d=m`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):(0,o.qy)(c||(c=m`<entity-preview-row .hass="${0}" .stateObj="${0}"></entity-preview-row> ${0} ${0} `),this.hass,this._preview,null!==(e=this._listeners)&&void 0!==e&&e.time?(0,o.qy)(w||(w=m` <p> ${0} </p> `),this.hass.localize("ui.dialogs.helper_settings.template.time")):o.s6,this._listeners?this._listeners.all?(0,o.qy)(b||(b=m` <p class="all_listeners"> ${0} </p> `),this.hass.localize("ui.dialogs.helper_settings.template.all_listeners")):this._listeners.domains.length||this._listeners.entities.length?(0,o.qy)(v||(v=m` <p> ${0} </p> <ul> ${0} ${0} </ul> `),this.hass.localize("ui.dialogs.helper_settings.template.listeners"),this._listeners.domains.sort().map(e=>(0,o.qy)(g||(g=m` <li> <b>${0}</b>: ${0} </li> `),this.hass.localize("ui.dialogs.helper_settings.template.domain"),e)),this._listeners.entities.sort().map(e=>(0,o.qy)(y||(y=m` <li> <b>${0}</b>: ${0} </li> `),this.hass.localize("ui.dialogs.helper_settings.template.entity"),e))):this._listeners.time?o.s6:(0,o.qy)(f||(f=m`<p class="all_listeners"> ${0} </p>`),this.hass.localize("ui.dialogs.helper_settings.template.no_listeners")):o.s6)}async _subscribePreview(){if(this._unsub&&((await this._unsub)(),this._unsub=void 0),"config_flow"===this.flowType||"options_flow"===this.flowType)try{this._unsub=(0,n.H)(this.hass,this.flowId,this.flowType,this.stepData,this._setPreview),await this._unsub,(0,p.r)(this,"set-flow-errors",{errors:{}})}catch(e){"string"==typeof e.message?this._error=e.message:(this._error=void 0,(0,p.r)(this,"set-flow-errors",e.message)),this._unsub=void 0,this._preview=void 0}}constructor(...e){super(...e),this._setPreview=e=>{if("error"in e)return this._error=e.error,void(this._preview=void 0);this._error=void 0,this._listeners=e.listeners;const t=(new Date).toISOString();this._preview={entity_id:`${this.stepId}.___flow_preview___`,last_changed:t,last_updated:t,context:{id:"",parent_id:null,user_id:null},attributes:e.attributes,state:e.state}},this._debouncedSubscribePreview=(0,l.s)(()=>{this._subscribePreview()},250)}}(0,r.Cg)([(0,a.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,r.Cg)([(0,a.MZ)({attribute:!1})],$.prototype,"flowType",void 0),(0,r.Cg)([(0,a.MZ)({attribute:!1})],$.prototype,"stepId",void 0),(0,r.Cg)([(0,a.MZ)({attribute:!1})],$.prototype,"flowId",void 0),(0,r.Cg)([(0,a.MZ)({attribute:!1})],$.prototype,"stepData",void 0),(0,r.Cg)([(0,a.wk)()],$.prototype,"_preview",void 0),(0,r.Cg)([(0,a.wk)()],$.prototype,"_listeners",void 0),(0,r.Cg)([(0,a.wk)()],$.prototype,"_error",void 0),$=(0,r.Cg)([(0,a.EM)("flow-preview-template")],$),i()}catch(d){i(d)}})}}]);
//# sourceMappingURL=29160.6954c123a27ab1da.js.map