export const __rspack_esm_id="18673";export const __rspack_esm_ids=["18673"];export const __webpack_modules__={51687(t,s,i){i.a(t,async function(t,a){try{i.r(s),i.d(s,{HuiHomeSummaryCard:()=>$});i(18111),i(22489),i(61701);var e=i(62826),o=i(35932),r=i(73983),n=i(96196),c=i(97735),h=i(29485),l=i(78870),m=i(91069),u=i(71727),_=i(4423),g=i(20058),d=(i(76776),i(22573),i(80933),i(32248),i(38114)),y=i(54706),f=i(37544),p=i(97176),b=i(8537),v=i(51989),D=t([m,g,d,b]);[m,g,d,b]=D.then?(await D)():D;const k={light:"amber",climate:"deep-orange",security:"blue-grey",media_players:"blue",energy:"amber"};class $ extends((0,y.E)(n.WF)){hassSubscribe(){if("energy"!==this._config?.summary)return[];const t=(0,d.tb)(this.hass,{key:"energy_home_dashboard"});return t.setPeriod((0,m.ol)(new Date,o.o,this.hass.locale,this.hass.config),(0,m.ol)(new Date,r.D,this.hass.locale,this.hass.config)),[t.subscribe(t=>{this._energyData=t})]}setConfig(t){this._config=t}getCardSize(){return this._config?.vertical?2:1}getGridOptions(){let t=6,s=1;return this._config?.vertical&&(s++,t=3),{columns:6,rows:s,min_columns:t,min_rows:s}}_handleAction(t){(0,f.$)(this,this.hass,this._config,t.detail.action)}get _hasCardAction(){return(0,p.h)(this._config?.tap_action)||(0,p.h)(this._config?.hold_action)||(0,p.h)(this._config?.double_tap_action)}_computeSummaryState(){if(!this._config||!this.hass)return"";const t=Object.keys(this.hass.states),s=Object.values(this.hass.areas);switch(this._config.summary){case"light":{const s=b.vV.light.map(t=>(0,_.r)(this.hass,t)),i=(0,_.B)(t,s).filter(t=>{const s=this.hass.states[t]?.state;return"on"===s});return i.length?this.hass.localize("ui.card.home-summary.count_lights_on",{count:i.length}):this.hass.localize("ui.card.home-summary.all_lights_off")}case"climate":{const t=s.map(t=>t.temperature_entity_id).filter(Boolean).map(t=>parseFloat(this.hass.states[t]?.state)||NaN).filter(t=>!isNaN(t));if(0===t.length)return"";const i=Math.min(...t),a=Math.max(...t);if(isNaN(i)||isNaN(a))return"";const e=(0,g.ZV)(i,this.hass?.locale,{minimumFractionDigits:1,maximumFractionDigits:1}),o=(0,g.ZV)(a,this.hass?.locale,{minimumFractionDigits:1,maximumFractionDigits:1});return e===o?`${e}°`:`${e} - ${o}°`}case"security":{const s=b.vV.security.map(t=>(0,_.r)(this.hass,t)),i=(0,_.B)(t,s),a=i.filter(t=>"lock"===(0,u.m)(t)),e=i.filter(t=>"alarm_control_panel"===(0,u.m)(t)),o=e.filter(t=>{const s=this.hass.states[t]?.state;return"disarmed"===s});if(!a.length&&!e.length)return"";const r=a.filter(t=>{const s=this.hass.states[t]?.state;return"unlocked"===s||"jammed"===s||"open"===s});return r.length?this.hass.localize("ui.card.home-summary.count_locks_unlocked",{count:r.length}):o.length?this.hass.localize("ui.card.home-summary.count_alarms_disarmed",{count:o.length}):this.hass.localize("ui.card.home-summary.all_secure")}case"media_players":{const s=b.vV.media_players.map(t=>(0,_.r)(this.hass,t)),i=(0,_.B)(t,s).filter(t=>{const s=this.hass.states[t]?.state;return"playing"===s});return i.length?this.hass.localize("ui.card.home-summary.count_media_playing",{count:i.length}):this.hass.localize("ui.card.home-summary.no_media_playing")}case"energy":{if(!this._energyData)return"";const{summedData:t}=(0,d.gv)(this._energyData),{consumption:s}=(0,d.DR)(t,void 0),i=s.total.used_total;return(0,d.n3)(this.hass,i,"kWh")}}return""}render(){if(!this._config||!this.hass)return n.s6;const t={"--tile-color":(0,l.MP)(k[this._config.summary])},s=this._computeSummaryState(),i=(0,b.rh)(this.hass.localize,this._config.summary),a=b.It[this._config.summary];return n.qy` <ha-card style="${(0,h.W)(t)}"> <ha-tile-container .vertical="${Boolean(this._config.vertical)}" .interactive="${this._hasCardAction}" .actionHandlerOptions="${{hasHold:(0,p.h)(this._config.hold_action),hasDoubleClick:(0,p.h)(this._config.double_tap_action)}}" @action="${this._handleAction}"> <ha-tile-icon slot="icon" .icon="${a}"></ha-tile-icon> <ha-tile-info slot="info" .primary="${i}" .secondary="${s}"></ha-tile-info> </ha-tile-container> </ha-card> `}constructor(...t){super(...t),this.hassSubscribeRequiredHostProps=["_config"]}}$.styles=[v.c,n.AH`:host{--tile-color:var(--state-inactive-color)}`],(0,e.Cg)([(0,c.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,e.Cg)([(0,c.wk)()],$.prototype,"_config",void 0),(0,e.Cg)([(0,c.wk)()],$.prototype,"_energyData",void 0),$=(0,e.Cg)([(0,c.EM)("hui-home-summary-card")],$),a()}catch(t){a(t)}})},56434(t,s,i){i.d(s,{e:()=>e});var a=i(81977);function e(t,s,i){return(0,a.P)(t,12*s,i)}}};
//# sourceMappingURL=18673.d93c5acf586db5dd.js.map