"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["77547"],{80395:function(t,i,s){s.a(t,async function(t,e){try{s.r(i);s(16280),s(3362);var a=s(40445),n=s(96196),o=s(77845),c=s(94333),h=s(32288),r=s(22675),d=s(43248),l=s(19037),u=s(37642),_=s(37544),f=s(97176),g=s(784),p=s(79757),b=s(85979),v=t([p,b]);[p,b]=v.then?(await v)():v;let y,m,$,x,w,C,k,E=t=>t;class H extends n.WF{_unsubscribeForecastEvents(){this._subscribed&&(this._subscribed.then(t=>t()),this._subscribed=void 0)}async _subscribeForecastEvents(){if(this._unsubscribeForecastEvents(),!this.hass||!this._config||!this.isConnected)return;const t=this.hass.states[this._config.entity],i=(0,d.JM)(t);i&&(this._subscribed=(0,d.Mu)(this.hass,t.entity_id,i,t=>{this._forecastEvent=t}))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this._subscribeForecastEvents()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeForecastEvents()}setConfig(t){if(null==t||!t.entity)throw new Error("Entity must be specified");this._config=t}shouldUpdate(t){return(0,g.LX)(this,t)||t.size>1||!t.has("hass")}updated(t){super.updated(t),!t.has("_config")&&this._subscribed||this._subscribeForecastEvents()}render(){if(!this.hass||!this._config)return n.s6;const t=this.hass.states[this._config.entity];if(!t)return(0,n.qy)(y||(y=E` <hui-warning .hass="${0}"> ${0} </hui-warning> `),this.hass,(0,b.j)(this.hass,this._config.entity));const i=(0,f.A)(this._config),s=this._config.secondary_info,e=(0,d.L8)(t.state,this),a=(0,d.yd)(t.attributes,this._forecastEvent),o=null==a?void 0:a.forecast,_=(0,u.v)(this.hass,t,this._config.name);return(0,n.qy)(m||(m=E` <div class="icon-image ${0}" @action="${0}" .actionHandler="${0}" tabindex="${0}"> ${0} </div> <div class="info ${0}" @action="${0}" .actionHandler="${0}"> ${0} ${0} </div> <div class="attributes ${0}" @action="${0}" .actionHandler="${0}"> <div> ${0} </div> <div class="secondary"> ${0} </div> </div> `),(0,c.H)({pointer:i}),this._handleAction,(0,l.T)({hasHold:(0,f.h)(this._config.hold_action),hasDoubleClick:(0,f.h)(this._config.double_tap_action)}),(0,h.J)(!this._config.tap_action||(0,f.h)(this._config.tap_action)?"0":void 0),e||(0,n.qy)($||($=E` <ha-state-icon class="weather-icon" .stateObj="${0}" .hass="${0}"></ha-state-icon> `),t,this.hass),(0,c.H)({pointer:i,"text-content":!s}),this._handleAction,(0,l.T)({hasHold:(0,f.h)(this._config.hold_action),hasDoubleClick:(0,f.h)(this._config.double_tap_action)}),_,s?(0,n.qy)(x||(x=E` <div class="secondary"> ${0} </div> `),"entity-id"===this._config.secondary_info?t.entity_id:"last-changed"===this._config.secondary_info?(0,n.qy)(w||(w=E` <ha-relative-time .hass="${0}" .datetime="${0}" capitalize></ha-relative-time> `),this.hass,t.last_changed):"last-updated"===this._config.secondary_info?(0,n.qy)(C||(C=E` <ha-relative-time .hass="${0}" .datetime="${0}" capitalize></ha-relative-time> `),this.hass,t.last_updated):""):"",(0,c.H)({pointer:i}),this._handleAction,(0,l.T)({hasHold:(0,f.h)(this._config.hold_action),hasDoubleClick:(0,f.h)(this._config.double_tap_action)}),(0,r.g0)(t.state)||void 0===t.attributes.temperature||null===t.attributes.temperature?this.hass.formatEntityState(t):this.hass.formatEntityAttributeValue(t,"temperature"),(0,d.nO)(this.hass,t,o))}_handleAction(t){(0,_.$)(this,this.hass,this._config,t.detail.action)}static get styles(){return[d.Ry,(0,n.AH)(k||(k=E`:host{display:flex;align-items:center;flex-direction:row}.info{margin-left:16px;margin-inline-start:16px;margin-inline-end:initial;flex:1 0 60px}.info,.info>*{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.icon-image{display:flex;align-items:center;min-width:40px}.icon-image>*{flex:0 0 40px;height:40px}.icon-image:focus{outline:0;background-color:var(--divider-color);border-radius:var(--ha-border-radius-circle)}.weather-icon{--mdc-icon-size:40px}.pointer{cursor:pointer}.attributes{display:flex;flex-direction:column;justify-content:center;text-align:right;margin-left:8px;margin-inline-start:8px;margin-inline-end:initial}.secondary{color:var(--secondary-text-color)}`))]}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],H.prototype,"hass",void 0),(0,a.Cg)([(0,o.wk)()],H.prototype,"_config",void 0),(0,a.Cg)([(0,o.wk)()],H.prototype,"_forecastEvent",void 0),(0,a.Cg)([(0,o.wk)()],H.prototype,"_subscribed",void 0),H=(0,a.Cg)([(0,o.EM)("hui-weather-entity-row")],H),e()}catch(y){e(y)}})}}]);
//# sourceMappingURL=77547.a803c8cd97b3d4fb.js.map