"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[58777],{94560:function(t,i,e){e.r(i);var n,o,r=e(28430),s=e(57567),a=e(25979),c=e(12463),l=e(16472),h=(e(16280),e(2008),e(62062),e(18111),e(22489),e(61701),e(26099),e(15697)),u=e(57527),f=e(51209),g=e(6947),_=e(51731),v=e(45602),d=e(81956),p=e(2267),k=(e(75041),e(32878),e(88472),e(51517),e(30941)),y=function(t){function i(){return(0,s.A)(this,i),(0,l.A)(this,i,arguments)}return(0,c.A)(i,t),(0,a.A)(i,[{key:"setConfig",value:function(t){var i;if(null===(i=t.entities)||void 0===i||!i.length)throw new Error("Entities are required");this._config=t}},{key:"getCardSize",value:function(){var t;return null!==(t=this._config)&&void 0!==t&&t.vertical?2:1}},{key:"getGridOptions",value:function(){var t,i=1,e=6;return null!==(t=this._config)&&void 0!==t&&t.vertical&&(i++,e=3),{columns:6,rows:i,min_columns:e,min_rows:i}}},{key:"_getOnEntities",value:function(){var t=this;return this.hass&&this._config?this._config.entities.map(function(i){return t.hass.states[i]}).filter(function(t){return void 0!==t&&(0,d.a)(t)}):[]}},{key:"_computeColor",value:function(){if(this._config&&this.hass){var t=this._getOnEntities();if(0!==t.length)return this._config.color?(0,_.MP)(this._config.color):(0,p.Se)(t[0])}}},{key:"_computeLabel",value:function(){if(!this.hass||!this._config)return"";var t=this._getOnEntities().length,i=this._config.entities.length;return 0===t?this.hass.localize("ui.card.toggle-group.all_off"):t===i?this.hass.localize("ui.card.toggle-group.all_on"):this.hass.localize("ui.card.toggle-group.some_on",{on_count:t,total_count:i})}},{key:"_handleTap",value:function(){if(this.hass&&this._config){var t,i=this._getOnEntities(),e=(0,v.m)(this._config.entities[0]);t="cover"===e?i.length>0?"close_cover":"open_cover":i.length>0?"turn_off":"turn_on",this.hass.callService(e,t,{entity_id:this._config.entities}),(0,k.j)(this,"light")}}},{key:"render",value:function(){if(!this._config||!this.hass)return u.s6;var t={"--tile-color":this._computeColor()},i=this._computeLabel(),e=this._config.title||i,o=this._config.title?i:void 0;return(0,u.qy)(n||(n=(0,r.A)([" <ha-card style=",";> <ha-tile-container .vertical=",'> <ha-tile-icon slot="icon" icon="mdi:power" .interactive='," @action=",'></ha-tile-icon> <ha-tile-info slot="info" .primary='," .secondary=","></ha-tile-info> </ha-tile-container> </ha-card> "])),(0,g.W)(t),Boolean(this._config.vertical),!0,this._handleTap,e,o)}}])}(u.WF);y.styles=(0,u.AH)(o||(o=(0,r.A)([":host{--tile-color:var(--state-inactive-color)}ha-card{-webkit-backdrop-filter:none;box-shadow:none;background:0 0;border:none;height:100%}ha-tile-icon{--tile-icon-color:var(--tile-color)}"]))),(0,h.Cg)([(0,f.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,h.Cg)([(0,f.wk)()],y.prototype,"_config",void 0),y=(0,h.Cg)([(0,f.EM)("hui-toggle-group-card")],y),e.d(i,{HuiToggleGroupCard:function(){return y}})}}]);
//# sourceMappingURL=58777.e92c0fb38d8ebb8a.js.map