"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}});s(69085);var i=function(e,t,s){return e.subscribeMessage(function(e){return t(e)},Object.assign({type:"render_template"},s))},r=function(e,t,s,i,r){return 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);var r,n,a,o,l,u,p,h,_=s(61397),c=s(50264),d=s(72153),v=s(44734),f=s(43080),b=s(69683),w=s(6454),y=s(25460),g=(s(28706),s(62062),s(26910),s(18111),s(61701),s(26099),s(40445)),m=s(96196),A=s(77845),k=s(9899),C=s(84334),q=s(7986),M=s(1087),z=(s(38962),e([q]));q=(z.then?(await z)():z)[0];var P=function(e){function t(){var e;(0,v.A)(this,t);for(var s=arguments.length,i=new Array(s),r=0;r<s;r++)i[r]=arguments[r];return(e=(0,b.A)(this,t,[].concat(i)))._setPreview=function(t){if("error"in t)return e._error=t.error,void(e._preview=void 0);e._error=void 0,e._listeners=t.listeners;var s=(new Date).toISOString();e._preview={entity_id:"".concat(e.stepId,".___flow_preview___"),last_changed:s,last_updated:s,context:{id:"",parent_id:null,user_id:null},attributes:t.attributes,state:t.state}},e._debouncedSubscribePreview=(0,k.s)(function(){e._subscribePreview()},250),e}return(0,w.A)(t,e),(0,f.A)(t,[{key:"disconnectedCallback",value:function(){(0,y.A)(t,"disconnectedCallback",this,3)([]),this._unsub&&(this._unsub.then(function(e){return e()}),this._unsub=void 0)}},{key:"willUpdate",value:function(e){e.has("stepData")&&this._debouncedSubscribePreview()}},{key:"render",value:function(){var e,t=this;return this._error?(0,m.qy)(r||(r=(0,d.A)(['<ha-alert alert-type="error">',"</ha-alert>"])),this._error):(0,m.qy)(n||(n=(0,d.A)(['<entity-preview-row .hass="','" .stateObj="','"></entity-preview-row> '," "," "])),this.hass,this._preview,null!==(e=this._listeners)&&void 0!==e&&e.time?(0,m.qy)(a||(a=(0,d.A)([" <p> "," </p> "])),this.hass.localize("ui.dialogs.helper_settings.template.time")):m.s6,this._listeners?this._listeners.all?(0,m.qy)(o||(o=(0,d.A)([' <p class="all_listeners"> '," </p> "])),this.hass.localize("ui.dialogs.helper_settings.template.all_listeners")):this._listeners.domains.length||this._listeners.entities.length?(0,m.qy)(l||(l=(0,d.A)([" <p> "," </p> <ul> "," "," </ul> "])),this.hass.localize("ui.dialogs.helper_settings.template.listeners"),this._listeners.domains.sort().map(function(e){return(0,m.qy)(u||(u=(0,d.A)([" <li> <b>","</b>: "," </li> "])),t.hass.localize("ui.dialogs.helper_settings.template.domain"),e)}),this._listeners.entities.sort().map(function(e){return(0,m.qy)(p||(p=(0,d.A)([" <li> <b>","</b>: "," </li> "])),t.hass.localize("ui.dialogs.helper_settings.template.entity"),e)})):this._listeners.time?m.s6:(0,m.qy)(h||(h=(0,d.A)(['<p class="all_listeners"> '," </p>"])),this.hass.localize("ui.dialogs.helper_settings.template.no_listeners")):m.s6)}},{key:"_subscribePreview",value:(s=(0,c.A)((0,_.A)().m(function e(){var t;return(0,_.A)().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!this._unsub){e.n=2;break}return e.n=1,this._unsub;case 1:(0,e.v)(),this._unsub=void 0;case 2:if("config_flow"===this.flowType||"options_flow"===this.flowType){e.n=3;break}return e.a(2);case 3:return e.p=3,this._unsub=(0,C.H)(this.hass,this.flowId,this.flowType,this.stepData,this._setPreview),e.n=4,this._unsub;case 4:(0,M.r)(this,"set-flow-errors",{errors:{}}),e.n=6;break;case 5:e.p=5,"string"==typeof(t=e.v).message?this._error=t.message:(this._error=void 0,(0,M.r)(this,"set-flow-errors",t.message)),this._unsub=void 0,this._preview=void 0;case 6:return e.a(2)}},e,this,[[3,5]])})),function(){return s.apply(this,arguments)})}]);var s}(m.WF);(0,g.Cg)([(0,A.MZ)({attribute:!1})],P.prototype,"hass",void 0),(0,g.Cg)([(0,A.MZ)({attribute:!1})],P.prototype,"flowType",void 0),(0,g.Cg)([(0,A.MZ)({attribute:!1})],P.prototype,"stepId",void 0),(0,g.Cg)([(0,A.MZ)({attribute:!1})],P.prototype,"flowId",void 0),(0,g.Cg)([(0,A.MZ)({attribute:!1})],P.prototype,"stepData",void 0),(0,g.Cg)([(0,A.wk)()],P.prototype,"_preview",void 0),(0,g.Cg)([(0,A.wk)()],P.prototype,"_listeners",void 0),(0,g.Cg)([(0,A.wk)()],P.prototype,"_error",void 0),P=(0,g.Cg)([(0,A.EM)("flow-preview-template")],P),i()}catch(I){i(I)}})}}]);
//# sourceMappingURL=29160.68d4052d3a5e2fd4.js.map