"use strict";(self.webpackChunkplugin_store_frontend=self.webpackChunkplugin_store_frontend||[]).push([[1044],{41044:function(e,t,r){var i=r(22858).A,n=r(33994).A;r.a(e,function(){var e=i(n().mark((function e(i,s){var a,o,u,d,c,l,v,h,f,k,_,p,w,b,y,A,g,m,x,M;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,r.r(t),a=r(33994),o=r(22858),u=r(64599),d=r(35806),c=r(71008),l=r(62193),v=r(2816),h=r(27927),f=r(35890),k=r(81027),_=r(26098),p=r(50289),w=r(29818),b=r(36552),y=r(85386),A=r(51011),g=r(47575),!(m=i([y])).then){e.next=29;break}return e.next=25,m;case 25:e.t1=e.sent,e.t0=(0,e.t1)(),e.next=30;break;case 29:e.t0=m;case 30:y=e.t0[0],(0,h.A)([(0,w.EM)("flow-preview-generic")],(function(e,t){var r,i=function(t){function r(){var t;(0,c.A)(this,r);for(var i=arguments.length,n=new Array(i),s=0;s<i;s++)n[s]=arguments[s];return t=(0,l.A)(this,r,[].concat(n)),e(t),t}return(0,v.A)(r,t),(0,d.A)(r)}(t);return{F:i,d:[{kind:"field",decorators:[(0,w.MZ)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,w.MZ)()],key:"flowType",value:void 0},{kind:"field",key:"handler",value:void 0},{kind:"field",decorators:[(0,w.MZ)()],key:"domain",value:void 0},{kind:"field",decorators:[(0,w.MZ)()],key:"stepId",value:void 0},{kind:"field",decorators:[(0,w.MZ)()],key:"flowId",value:void 0},{kind:"field",decorators:[(0,w.MZ)()],key:"stepData",value:void 0},{kind:"field",decorators:[(0,w.wk)()],key:"_preview",value:void 0},{kind:"field",decorators:[(0,w.wk)()],key:"_error",value:void 0},{kind:"field",key:"_unsub",value:void 0},{kind:"method",key:"disconnectedCallback",value:function(){(0,f.A)(i,"disconnectedCallback",this,3)([]),this._unsub&&(this._unsub.then((function(e){return e()})),this._unsub=void 0)}},{kind:"method",key:"willUpdate",value:function(e){e.has("stepData")&&this._debouncedSubscribePreview()}},{kind:"method",key:"render",value:function(){return this._error?(0,p.qy)(x||(x=(0,u.A)(['<ha-alert alert-type="error">',"</ha-alert>"])),this._error):(0,p.qy)(M||(M=(0,u.A)(['<entity-preview-row .hass="','" .stateObj="','"></entity-preview-row>'])),this.hass,this._preview)}},{kind:"field",key:"_setPreview",value:function(){var e=this;return function(t){var r=(new Date).toISOString();e._preview=Object.assign({entity_id:"".concat(e.stepId,".___flow_preview___"),last_changed:r,last_updated:r,context:{id:"",parent_id:null,user_id:null}},t)}}},{kind:"field",key:"_debouncedSubscribePreview",value:function(){var e=this;return(0,A.s)((function(){e._subscribePreview()}),250)}},{kind:"method",key:"_subscribePreview",value:(r=(0,o.A)((0,a.A)().mark((function e(){return(0,a.A)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._unsub){e.next=6;break}return e.next=3,this._unsub;case 3:e.t0=e.sent,(0,e.t0)(),this._unsub=void 0;case 6:if("repair_flow"!==this.flowType){e.next=8;break}return e.abrupt("return");case 8:try{this._unsub=(0,b.Q)(this.hass,this.domain,this.flowId,this.flowType,this.stepData,this._setPreview),(0,g.r)(this,"set-flow-errors",{errors:{}})}catch(t){"string"==typeof t.message?this._error=t.message:(this._error=void 0,(0,g.r)(this,"set-flow-errors",t.message)),this._unsub=void 0,this._preview=void 0}case 9:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})}]}}),p.WF),s(),e.next=38;break;case 35:e.prev=35,e.t2=e.catch(0),s(e.t2);case 38:case"end":return e.stop()}}),e,null,[[0,35]])})));return function(t,r){return e.apply(this,arguments)}}())}}]);
//# sourceMappingURL=1044.ycJ_S_A2-kU.js.map