@@ -1100,8 +1108,8 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
.container.vertical .info {
text-align: center;
}
- `}};function Es(t){var e,i,o,n,r;return{layout:null!==(e=t.layout)&&void 0!==e?e:As(t),fill_container:null!==(i=t.fill_container)&&void 0!==i&&i,primary_info:null!==(o=t.primary_info)&&void 0!==o?o:Is(t),secondary_info:null!==(n=t.secondary_info)&&void 0!==n?n:Ts(t),icon_type:null!==(r=t.icon_type)&&void 0!==r?r:Ss(t)}}function As(t){return t.vertical?"vertical":"default"}function Ss(t){return t.hide_icon?"none":t.use_entity_picture||t.use_media_artwork?"entity-picture":"icon"}function Is(t){return t.hide_name?"none":"name"}function Ts(t){return t.hide_state?"none":"state"}n([_t()],$s.prototype,"appearance",void 0),$s=n([pt("mushroom-state-item")],$s);let zs=class extends ht{constructor(){super(...arguments),this.picture_url=""}render(){return Y`
-
+ `}};function As(t){var e,i,o,n,r;return{layout:null!==(e=t.layout)&&void 0!==e?e:Ss(t),fill_container:null!==(i=t.fill_container)&&void 0!==i&&i,primary_info:null!==(o=t.primary_info)&&void 0!==o?o:Ts(t),secondary_info:null!==(n=t.secondary_info)&&void 0!==n?n:zs(t),icon_type:null!==(r=t.icon_type)&&void 0!==r?r:Is(t)}}function Ss(t){return t.vertical?"vertical":"default"}function Is(t){return t.hide_icon?"none":t.use_entity_picture||t.use_media_artwork?"entity-picture":"icon"}function Ts(t){return t.hide_name?"none":"name"}function zs(t){return t.hide_state?"none":"state"}n([_t()],Es.prototype,"appearance",void 0),Es=n([pt("mushroom-state-item")],Es);let Os=class extends ht{constructor(){super(...arguments),this.picture_url=""}render(){return Y`
+
`}static get styles(){return h`
@@ -1126,7 +1134,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
height: 100%;
border-radius: var(--icon-border-radius);
}
- `}};n([_t()],zs.prototype,"picture_url",void 0),zs=n([pt("mushroom-shape-avatar")],zs);const Os=h`
+ `}};n([_t()],Os.prototype,"picture_url",void 0),Os=n([pt("mushroom-shape-avatar")],Os);const Ms=h`
--spacing: var(--mush-spacing, 10px);
/* Title */
@@ -1215,7 +1223,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
--icon-border-radius: var(--mush-icon-border-radius, 50%);
--icon-size: var(--mush-icon-size, 36px);
--icon-symbol-size: var(--mush-icon-symbol-size, 0.6em);
-`,Ms=h`
+`,js=h`
/* RGB */
/* Standard colors */
--rgb-red: var(--mush-rgb-red, var(--default-red));
@@ -1344,16 +1352,16 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
--mush-rgb-state-climate-off,
var(--rgb-disabled)
);
-`;function js(t){return!!t&&t.themes.darkMode}class Ds extends ht{firstUpdated(t){this.toggleAttribute("pre-2024-8",!ai(this.hass.config.version,2024,8))}updated(t){if(super.updated(t),t.has("hass")&&this.hass){const e=js(t.get("hass")),i=js(this.hass);e!==i&&this.toggleAttribute("dark-mode",i)}}static get styles(){return[ws,h`
+`;function Ds(t){return!!t&&t.themes.darkMode}class Ls extends ht{firstUpdated(t){this.toggleAttribute("pre-2024-8",!ai(this.hass.config.version,2024,8))}updated(t){if(super.updated(t),t.has("hass")&&this.hass){const e=Ds(t.get("hass")),i=Ds(this.hass);e!==i&&this.toggleAttribute("dark-mode",i)}}static get styles(){return[ks,h`
:host {
- ${Ja}
- }
- :host([dark-mode]) {
${Qa}
}
+ :host([dark-mode]) {
+ ${ts}
+ }
:host {
+ ${js}
${Ms}
- ${Os}
}
:host([pre-2024-8]) {
--spacing: var(--mush-spacing, 12px);
@@ -1361,14 +1369,14 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
--control-spacing: var(--mush-spacing, 12px);
--icon-size: var(--mush-icon-size, 40px);
}
- `]}}n([_t({attribute:!1})],Ds.prototype,"hass",void 0);class Ls extends Ds{get _stateObj(){if(!this._config||!this.hass||!this._config.entity)return;const t=this._config.entity;return this.hass.states[t]}get hasControls(){return!1}setConfig(t){this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t)}getCardSize(){var t;let e=1;if(!this._config)return e;const i=Es(this._config);return"vertical"===i.layout&&(e+=1),"horizontal"===(null==i?void 0:i.layout)||!this.hasControls||"collapsible_controls"in this._config&&(null===(t=this._config)||void 0===t?void 0:t.collapsible_controls)||(e+=1),e}getLayoutOptions(){const t={grid_columns:2,grid_rows:1};if(!this._config)return t;const e=Es(this._config);return"vertical"===e.layout&&(t.grid_rows+=1),"horizontal"===e.layout&&(t.grid_columns=4),"horizontal"!==(null==e?void 0:e.layout)&&this.hasControls&&(t.grid_rows+=1),t}renderPicture(t){return Y`
+ `]}}n([_t({attribute:!1})],Ls.prototype,"hass",void 0);class Ps extends Ls{get _stateObj(){if(!this._config||!this.hass||!this._config.entity)return;const t=this._config.entity;return this.hass.states[t]}get hasControls(){return!1}setConfig(t){this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t)}getCardSize(){var t;let e=1;if(!this._config)return e;const i=As(this._config);return"vertical"===i.layout&&(e+=1),"horizontal"===(null==i?void 0:i.layout)||!this.hasControls||"collapsible_controls"in this._config&&(null===(t=this._config)||void 0===t?void 0:t.collapsible_controls)||(e+=1),e}getLayoutOptions(){if(!this._config)return{grid_columns:2,grid_rows:1};const t={grid_columns:2,grid_rows:0},e=As(this._config),i="collapsible_controls"in this._config&&Boolean(this._config.collapsible_controls),o="none"!==e.primary_info||"none"!==e.secondary_info,n="none"!==e.icon_type,r=this._stateObj&&Bt(this._stateObj),a=this.hasControls&&(!i||r);return"vertical"===e.layout&&(n&&(t.grid_rows+=1),o&&(t.grid_rows+=1),a&&(t.grid_rows+=1)),"horizontal"===e.layout&&(t.grid_rows=1,t.grid_columns=4),"default"===e.layout&&((o||n)&&(t.grid_rows+=1),a&&(t.grid_rows+=1)),a||o||(t.grid_columns=1,t.grid_rows=1),t.grid_rows=Math.max(t.grid_rows,1),t}renderPicture(t){return Y`
- `}renderNotFound(t){const e=Es(t),i=Ie(this.hass),o=Oo(this.hass);return Y`
+ `}renderNotFound(t){const e=As(t),i=Ie(this.hass),o=Mo(this.hass);return Y`
@@ -1402,13 +1410,13 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
slot="badge"
icon="mdi:help"
>
- `:K}renderStateInfo(t,e,i,o){const n=this.hass.formatEntityState?this.hass.formatEntityState(t):ne(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities),r=null!=o?o:n,a=rs(e.primary_info,i,r,t,this.hass),s=rs(e.secondary_info,i,r,t,this.hass);return Y`
+ `:K}renderStateInfo(t,e,i,o){const n=this.hass.formatEntityState?this.hass.formatEntityState(t):ne(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities),r=null!=o?o:n,a=as(e.primary_info,i,r,t,this.hass),s=as(e.secondary_info,i,r,t,this.hass);return Y`
- `}}n([vt()],Ls.prototype,"_config",void 0),n([_t({reflect:!0,type:String})],Ls.prototype,"layout",void 0);const Ps=h`
+ `}}n([vt()],Ps.prototype,"_config",void 0),n([_t({reflect:!0,type:String})],Ps.prototype,"layout",void 0);const Ns=h`
ha-card {
box-sizing: border-box;
display: flex;
@@ -1451,9 +1459,9 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
mushroom-state-item[disabled] {
cursor: initial;
}
-`;function Ns(e){const i=window;i.customCards=i.customCards||[];const o=e.type.replace("-card","").replace("mushroom-","");i.customCards.push(Object.assign(Object.assign({},e),{preview:!0,documentationURL:`${t}/blob/main/docs/cards/${o}.md`}))}const Rs="mushroom",Fs=`${Rs}-alarm-control-panel-card`,Vs=`${Fs}-editor`,Bs=["alarm_control_panel"],Us={disarmed:"var(--rgb-state-alarm-disarmed)",armed:"var(--rgb-state-alarm-armed)",triggered:"var(--rgb-state-alarm-triggered)",unavailable:"var(--rgb-warning)"};function Hs(t){var e;return null!==(e=Us[t.split("_")[0]])&&void 0!==e?e:"var(--rgb-grey)"}function Ys(t){return["arming","triggered","pending",Nt].indexOf(t)>=0}Ns({type:Fs,name:"Mushroom Alarm Control Panel Card",description:"Card for alarm control panel"});let Ws=class extends Ls{static async getConfigElement(){return await Promise.resolve().then((function(){return Jd})),document.createElement(Vs)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Bs.includes(t.split(".")[0])));return{type:`custom:${Fs}`,entity:e[0],states:["armed_home","armed_away"]}}get hasControls(){var t,e;return Boolean(null===(e=null===(t=this._config)||void 0===t?void 0:t.states)||void 0===e?void 0:e.length)}_onTap(t,e){t.stopPropagation(),(async(t,e,i,o)=>{var n,r;const{service:a}=fs[o];let s;if("disarmed"!==o&&i.attributes.code_arm_required||"disarmed"===o&&i.attributes.code_format){const a=await((t,e)=>t.callWS({type:"config/entity_registry/get",entity_id:e}))(e,i.entity_id).catch((()=>{}));if(!(null===(r=null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.alarm_control_panel)||void 0===r?void 0:r.default_code)){const n="disarmed"===o,r=await window.loadCardHelpers(),a=await r.showEnterCodeDialog(t,{codeFormat:i.attributes.code_format,title:e.localize("ui.card.alarm_control_panel."+(n?"disarm":"arm")),submitText:e.localize("ui.card.alarm_control_panel."+(n?"disarm":"arm"))});if(null==a)throw new Error("Code dialog closed");s=a}}await e.callService("alarm_control_panel",a,{entity_id:i.entity_id,code:s})})(this,this.hass,this._stateObj,e)}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this.hass||!this._config||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=Es(this._config),n=as(t,o.icon_type),r=this._config.states&&this._config.states.length>0?function(t){return"disarmed"===t.state}(t)?this._config.states.map((t=>({mode:t}))):[{mode:"disarmed"}]:[],a=function(t){return Nt!==t.state}(t),s=Ie(this.hass);return Y`
+`;function Rs(e){const i=window;i.customCards=i.customCards||[];const o=e.type.replace("-card","").replace("mushroom-","");i.customCards.push(Object.assign(Object.assign({},e),{preview:!0,documentationURL:`${t}/blob/main/docs/cards/${o}.md`}))}const Fs="mushroom",Vs=`${Fs}-alarm-control-panel-card`,Bs=`${Vs}-editor`,Us=["alarm_control_panel"],Hs={disarmed:"var(--rgb-state-alarm-disarmed)",armed:"var(--rgb-state-alarm-armed)",triggered:"var(--rgb-state-alarm-triggered)",unavailable:"var(--rgb-warning)"};function Ys(t){var e;return null!==(e=Hs[t.split("_")[0]])&&void 0!==e?e:"var(--rgb-grey)"}function Ws(t){return["arming","triggered","pending",Nt].indexOf(t)>=0}Rs({type:Vs,name:"Mushroom Alarm Control Panel Card",description:"Card for alarm control panel"});let Xs=class extends Ps{static async getConfigElement(){return await Promise.resolve().then((function(){return Qd})),document.createElement(Bs)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Us.includes(t.split(".")[0])));return{type:`custom:${Vs}`,entity:e[0],states:["armed_home","armed_away"]}}get hasControls(){var t,e;return Boolean(null===(e=null===(t=this._config)||void 0===t?void 0:t.states)||void 0===e?void 0:e.length)}_onTap(t,e){t.stopPropagation(),(async(t,e,i,o)=>{var n,r;const{service:a}=gs[o];let s;if("disarmed"!==o&&i.attributes.code_arm_required||"disarmed"===o&&i.attributes.code_format){const a=await((t,e)=>t.callWS({type:"config/entity_registry/get",entity_id:e}))(e,i.entity_id).catch((()=>{}));if(!(null===(r=null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.alarm_control_panel)||void 0===r?void 0:r.default_code)){const n="disarmed"===o,r=await window.loadCardHelpers(),a=await r.showEnterCodeDialog(t,{codeFormat:i.attributes.code_format,title:e.localize("ui.card.alarm_control_panel."+(n?"disarm":"arm")),submitText:e.localize("ui.card.alarm_control_panel."+(n?"disarm":"arm"))});if(null==a)throw new Error("Code dialog closed");s=a}}await e.callService("alarm_control_panel",a,{entity_id:i.entity_id,code:s})})(this,this.hass,this._stateObj,e)}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this.hass||!this._config||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=As(this._config),n=ss(t,o.icon_type),r=this._config.states&&this._config.states.length>0?function(t){return"disarmed"===t.state}(t)?this._config.states.map((t=>({mode:t}))):[{mode:"disarmed"}]:[],a=function(t){return Nt!==t.state}(t),s=Ie(this.hass);return Y`
this._onTap(e,t.mode)}
.disabled=${!a}
>
-
+
`))}
@@ -1486,11 +1494,11 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
`:K}
- `}renderIcon(t,e){const i=Hs(t.state),o=Ys(t.state);return Y`
+ `}renderIcon(t,e){const i=Ys(t.state),o=Ws(t.state);return Y`
- `}static get styles(){return[super.styles,Ps,h`
+ `}static get styles(){return[super.styles,Ns,h`
mushroom-state-item {
cursor: pointer;
}
mushroom-shape-icon.pulse {
--shape-animation: 1s ease 0s infinite normal none running pulse;
}
- `]}};Ws=n([pt(Fs)],Ws);let Xs=class extends ht{constructor(){super(...arguments),this.icon="",this.label="",this.avatar="",this.avatarOnly=!1}render(){return Y`
+ `]}};Xs=n([pt(Vs)],Xs);let Ks=class extends ht{constructor(){super(...arguments),this.icon="",this.label="",this.avatar="",this.avatarOnly=!1}render(){return Y`
${this.avatar?Y` `:K}
${this.avatarOnly?K:Y`
@@ -1514,7 +1522,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
`}
- `}static get styles(){return[ws,h`
+ `}static get styles(){return[ks,h`
:host {
--icon-color: var(--primary-text-color);
--text-color: var(--primary-text-color);
@@ -1584,7 +1592,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
margin-right: initial;
margin-left: 0.15em;
}
- `]}};n([_t()],Xs.prototype,"icon",void 0),n([_t()],Xs.prototype,"label",void 0),n([_t()],Xs.prototype,"avatar",void 0),n([_t()],Xs.prototype,"avatarOnly",void 0),Xs=n([pt("mushroom-chip")],Xs);const Ks=t=>{try{const e=Gs(t.type);if(customElements.get(e)){const i=document.createElement(e,t);return i.setConfig(t),i}const i=document.createElement(e);return customElements.whenDefined(e).then((()=>{try{customElements.upgrade(i),i.setConfig(t)}catch(t){}})),i}catch(t){return void console.error(t)}};function Gs(t){return`${Rs}-${t}-chip`}function qs(t){return`${Rs}-${t}-chip-editor`}let Zs=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return eu})),document.createElement(qs("entity"))}static async getStubConfig(t){return{type:"entity",entity:Object.keys(t.states)[0]}}setConfig(t){this._config=t}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){var t;if(!this.hass||!this._config||!this._config.entity)return K;const e=this._config.entity,i=this.hass.states[e];if(!i)return K;const o=this._config.name||i.attributes.friendly_name||"",n=this._config.icon,r=this._config.icon_color,a=this._config.use_entity_picture?Yt(i):void 0,s=this.hass.formatEntityState?this.hass.formatEntityState(i):ne(this.hass.localize,i,this.hass.locale,this.hass.config,this.hass.entities),l=Bt(i),c=rs(null!==(t=this._config.content_info)&&void 0!==t?t:"state",o,s,i,this.hass),d=Ie(this.hass);return Y`
+ `]}};n([_t()],Ks.prototype,"icon",void 0),n([_t()],Ks.prototype,"label",void 0),n([_t()],Ks.prototype,"avatar",void 0),n([_t()],Ks.prototype,"avatarOnly",void 0),Ks=n([pt("mushroom-chip")],Ks);const Gs=t=>{try{const e=qs(t.type);if(customElements.get(e)){const i=document.createElement(e,t);return i.setConfig(t),i}const i=document.createElement(e);return customElements.whenDefined(e).then((()=>{try{customElements.upgrade(i),i.setConfig(t)}catch(t){}})),i}catch(t){return void console.error(t)}};function qs(t){return`${Fs}-${t}-chip`}function Zs(t){return`${Fs}-${t}-chip-editor`}let Js=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return iu})),document.createElement(Zs("entity"))}static async getStubConfig(t){return{type:"entity",entity:Object.keys(t.states)[0]}}setConfig(t){this._config=t}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){var t;if(!this.hass||!this._config||!this._config.entity)return K;const e=this._config.entity,i=this.hass.states[e];if(!i)return K;const o=this._config.name||i.attributes.friendly_name||"",n=this._config.icon,r=this._config.icon_color,a=this._config.use_entity_picture?Yt(i):void 0,s=this.hass.formatEntityState?this.hass.formatEntityState(i):ne(this.hass.localize,i,this.hass.locale,this.hass.config,this.hass.entities),l=Bt(i),c=as(null!==(t=this._config.content_info)&&void 0!==t?t:"state",o,s,i,this.hass),d=Ie(this.hass);return Y`
${c}`:K}
- `}renderIcon(t,e,i,o){const n={};if(i){const t=Za(i);n["--color"]=`rgb(${t})`}return Y`
+ `}renderIcon(t,e,i,o){const n={};if(i){const t=Ja(i);n["--color"]=`rgb(${t})`}return Y`
`}static get styles(){return h`
mushroom-chip {
@@ -1610,7 +1618,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
ha-state-icon.active {
color: var(--color);
}
- `}};n([_t({attribute:!1})],Zs.prototype,"hass",void 0),n([vt()],Zs.prototype,"_config",void 0),Zs=n([pt(Gs("entity"))],Zs);const Js=new Set(["partlycloudy","cloudy","fog","windy","windy-variant","hail","rainy","snowy","snowy-rainy","pouring","lightning","lightning-rainy"]),Qs=new Set(["hail","rainy","pouring"]),tl=new Set(["windy","windy-variant"]),el=new Set(["snowy","snowy-rainy"]),il=new Set(["lightning","lightning-rainy"]),ol=h`
+ `}};n([_t({attribute:!1})],Js.prototype,"hass",void 0),n([vt()],Js.prototype,"_config",void 0),Js=n([pt(qs("entity"))],Js);const Qs=new Set(["partlycloudy","cloudy","fog","windy","windy-variant","hail","rainy","snowy","snowy-rainy","pouring","lightning","lightning-rainy"]),tl=new Set(["hail","rainy","pouring"]),el=new Set(["windy","windy-variant"]),il=new Set(["snowy","snowy-rainy"]),ol=new Set(["lightning","lightning-rainy"]),nl=h`
.rain {
fill: var(--weather-icon-rain-color, #30b3ff);
}
@@ -1626,7 +1634,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
.cloud-front {
fill: var(--weather-icon-cloud-front-color, #f9f9f9);
}
-`,nl=(t,e)=>W`
+`,rl=(t,e)=>W`
`:""}
- ${Js.has(t)?W`
+ ${Qs.has(t)?W`
`:""}
- ${Qs.has(t)?W`
+ ${tl.has(t)?W`
`:""}
- ${tl.has(t)?W`
+ ${el.has(t)?W`
`:""}
- ${el.has(t)?W`
+ ${il.has(t)?W`
`:""}
- ${il.has(t)?W`
+ ${ol.has(t)?W`
`:""}
- `;let rl=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return su})),document.createElement(qs("weather"))}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>"weather"===t.split(".")[0]));return{type:"weather",entity:e[0]}}setConfig(t){this._config=t}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this.hass||!this._config||!this._config.entity)return K;const t=this._config.entity,e=this.hass.states[t];if(!e)return K;const i=nl(e.state,!0),o=[];if(this._config.show_conditions){const t=this.hass.formatEntityState?this.hass.formatEntityState(e):ne(this.hass.localize,e,this.hass.locale,this.hass.config,this.hass.entities);o.push(t)}if(this._config.show_temperature){const t=`${te(e.attributes.temperature,this.hass.locale)} ${this.hass.config.unit_system.temperature}`;o.push(t)}const n=Ie(this.hass);return Y`
+ `;let al=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return lu})),document.createElement(Zs("weather"))}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>"weather"===t.split(".")[0]));return{type:"weather",entity:e[0]}}setConfig(t){this._config=t}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this.hass||!this._config||!this._config.entity)return K;const t=this._config.entity,e=this.hass.states[t];if(!e)return K;const i=rl(e.state,!0),o=[];if(this._config.show_conditions){const t=this.hass.formatEntityState?this.hass.formatEntityState(e):ne(this.hass.localize,e,this.hass.locale,this.hass.config,this.hass.entities);o.push(t)}if(this._config.show_temperature){const t=`${te(e.attributes.temperature,this.hass.locale)} ${this.hass.config.unit_system.temperature}`;o.push(t)}const n=Ie(this.hass);return Y`
0?Y`${o.join(" / ")}`:K}
- `}static get styles(){return[ol,h`
+ `}static get styles(){return[nl,h`
mushroom-chip {
cursor: pointer;
}
- `]}};n([_t({attribute:!1})],rl.prototype,"hass",void 0),n([vt()],rl.prototype,"_config",void 0),rl=n([pt(Gs("weather"))],rl);const al="mdi:arrow-left";let sl=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return du})),document.createElement(qs("back"))}static async getStubConfig(t){return{type:"back"}}setConfig(t){this._config=t}_handleAction(){window.history.back()}render(){if(!this.hass||!this._config)return K;const t=this._config.icon||al,e=Ie(this.hass);return Y`
+ `]}};n([_t({attribute:!1})],al.prototype,"hass",void 0),n([vt()],al.prototype,"_config",void 0),al=n([pt(qs("weather"))],al);const sl="mdi:arrow-left";let ll=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return uu})),document.createElement(Zs("back"))}static async getStubConfig(t){return{type:"back"}}setConfig(t){this._config=t}_handleAction(){window.history.back()}render(){if(!this.hass||!this._config)return K;const t=this._config.icon||sl,e=Ie(this.hass);return Y`
`}static get styles(){return h`
@@ -1766,7 +1774,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
ha-state-icon {
color: var(--color);
}
- `}};n([_t({attribute:!1})],cl.prototype,"hass",void 0),n([vt()],cl.prototype,"_config",void 0),cl=n([pt(Gs("action"))],cl);const dl="mdi:menu";let ul=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return _u})),document.createElement(qs("menu"))}static async getStubConfig(t){return{type:"menu"}}setConfig(t){this._config=t}_handleAction(){Lt(this,"hass-toggle-menu")}render(){if(!this.hass||!this._config)return K;const t=this._config.icon||dl,e=Ie(this.hass);return Y`
+ `}};n([_t({attribute:!1})],dl.prototype,"hass",void 0),n([vt()],dl.prototype,"_config",void 0),dl=n([pt(qs("action"))],dl);const ul="mdi:menu";let hl=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return vu})),document.createElement(Zs("menu"))}static async getStubConfig(t){return{type:"menu"}}setConfig(t){this._config=t}_handleAction(){Lt(this,"hass-toggle-menu")}render(){if(!this.hass||!this._config)return K;const t=this._config.icon||ul,e=Ie(this.hass);return Y`
{if(!t||!t.startsWith("weather-"))return;const e=t.replace("weather-","");return hl.has(e)?nl(e,!0):void 0},pl=["content","icon","icon_color","picture"];let fl=class extends ht{constructor(){super(...arguments),this._templateResults={},this._unsubRenderTemplates=new Map}static async getConfigElement(){return await Promise.resolve().then((function(){return $u})),document.createElement(qs("template"))}static async getStubConfig(t){return{type:"template"}}setConfig(t){pl.forEach((e=>{var i,o;(null===(i=this._config)||void 0===i?void 0:i[e])===t[e]&&(null===(o=this._config)||void 0===o?void 0:o.entity)==t.entity||this._tryDisconnectKey(e)})),this._config=Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)}connectedCallback(){super.connectedCallback(),this._tryConnect()}disconnectedCallback(){this._tryDisconnect()}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}isTemplate(t){var e;const i=null===(e=this._config)||void 0===e?void 0:e[t];return null==i?void 0:i.includes("{")}getValue(t){var e,i,o;return this.isTemplate(t)?null===(i=null===(e=this._templateResults[t])||void 0===e?void 0:e.result)||void 0===i?void 0:i.toString():null===(o=this._config)||void 0===o?void 0:o[t]}render(){if(!this.hass||!this._config)return K;const t=this.getValue("icon"),e=this.getValue("icon_color"),i=this.getValue("content"),o=this.getValue("picture"),n=Ie(this.hass),r=ml(t);return Y`
+ `}};n([_t({attribute:!1})],hl.prototype,"hass",void 0),n([vt()],hl.prototype,"_config",void 0),hl=n([pt(qs("menu"))],hl);const ml=new Set(["clear-night","cloudy","fog","lightning","lightning-rainy","partlycloudy","pouring","rainy","hail","snowy","snowy-rainy","sunny","windy","windy-variant"]),pl=t=>{if(!t||!t.startsWith("weather-"))return;const e=t.replace("weather-","");return ml.has(e)?rl(e,!0):void 0},fl=["content","icon","icon_color","picture"];let gl=class extends ht{constructor(){super(...arguments),this._templateResults={},this._unsubRenderTemplates=new Map}static async getConfigElement(){return await Promise.resolve().then((function(){return Eu})),document.createElement(Zs("template"))}static async getStubConfig(t){return{type:"template"}}setConfig(t){fl.forEach((e=>{var i,o;(null===(i=this._config)||void 0===i?void 0:i[e])===t[e]&&(null===(o=this._config)||void 0===o?void 0:o.entity)==t.entity||this._tryDisconnectKey(e)})),this._config=Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)}connectedCallback(){super.connectedCallback(),this._tryConnect()}disconnectedCallback(){this._tryDisconnect()}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}isTemplate(t){var e;const i=null===(e=this._config)||void 0===e?void 0:e[t];return null==i?void 0:i.includes("{")}getValue(t){var e,i,o;return this.isTemplate(t)?null===(i=null===(e=this._templateResults[t])||void 0===e?void 0:e.result)||void 0===i?void 0:i.toString():null===(o=this._config)||void 0===o?void 0:o[t]}render(){if(!this.hass||!this._config)return K;const t=this.getValue("icon"),e=this.getValue("icon_color"),i=this.getValue("content"),o=this.getValue("picture"),n=Ie(this.hass),r=pl(t);return Y`
- `}renderIcon(t,e){const i={};if(e){const t=Za(e);i["--color"]=`rgb(${t})`}return Y``}renderContent(t){return Y`${t}`}updated(t){super.updated(t),this._config&&this.hass&&this._tryConnect()}async _tryConnect(){pl.forEach((t=>{this._tryConnectKey(t)}))}async _tryConnectKey(t){var e,i;if(void 0===this._unsubRenderTemplates.get(t)&&this.hass&&this._config&&this.isTemplate(t))try{const i=Fe(this.hass.connection,(e=>{this._templateResults=Object.assign(Object.assign({},this._templateResults),{[t]:e})}),{template:null!==(e=this._config[t])&&void 0!==e?e:"",entity_ids:this._config.entity_id,variables:{config:this._config,user:this.hass.user.name,entity:this._config.entity},strict:!0});this._unsubRenderTemplates.set(t,i),await i}catch(e){const o={result:null!==(i=this._config[t])&&void 0!==i?i:"",listeners:{all:!1,domains:[],entities:[],time:!1}};this._templateResults=Object.assign(Object.assign({},this._templateResults),{[t]:o}),this._unsubRenderTemplates.delete(t)}}async _tryDisconnect(){pl.forEach((t=>{this._tryDisconnectKey(t)}))}async _tryDisconnectKey(t){const e=this._unsubRenderTemplates.get(t);if(e)try{(await e)(),this._unsubRenderTemplates.delete(t)}catch(t){if("not_found"!==t.code&&"template_error"!==t.code)throw t}}static get styles(){return h`
+ style=${da(i)}
+ >`}renderContent(t){return Y`${t}`}updated(t){super.updated(t),this._config&&this.hass&&this._tryConnect()}async _tryConnect(){fl.forEach((t=>{this._tryConnectKey(t)}))}async _tryConnectKey(t){var e,i;if(void 0===this._unsubRenderTemplates.get(t)&&this.hass&&this._config&&this.isTemplate(t))try{const i=Fe(this.hass.connection,(e=>{this._templateResults=Object.assign(Object.assign({},this._templateResults),{[t]:e})}),{template:null!==(e=this._config[t])&&void 0!==e?e:"",entity_ids:this._config.entity_id,variables:{config:this._config,user:this.hass.user.name,entity:this._config.entity},strict:!0});this._unsubRenderTemplates.set(t,i),await i}catch(e){const o={result:null!==(i=this._config[t])&&void 0!==i?i:"",listeners:{all:!1,domains:[],entities:[],time:!1}};this._templateResults=Object.assign(Object.assign({},this._templateResults),{[t]:o}),this._unsubRenderTemplates.delete(t)}}async _tryDisconnect(){fl.forEach((t=>{this._tryDisconnectKey(t)}))}async _tryDisconnectKey(t){const e=this._unsubRenderTemplates.get(t);if(e)try{(await e)(),this._unsubRenderTemplates.delete(t)}catch(t){if("not_found"!==t.code&&"template_error"!==t.code)throw t}}static get styles(){return h`
mushroom-chip {
cursor: pointer;
}
ha-state-icon {
color: var(--color);
}
- ${ol}
- `}};n([_t({attribute:!1})],fl.prototype,"hass",void 0),n([vt()],fl.prototype,"_config",void 0),n([vt()],fl.prototype,"_templateResults",void 0),n([vt()],fl.prototype,"_unsubRenderTemplates",void 0),fl=n([pt(Gs("template"))],fl);const gl=()=>{var t,e,i;customElements.get("ha-form")||null===(t=customElements.get("hui-button-card"))||void 0===t||t.getConfigElement(),customElements.get("ha-entity-picker")||null===(e=customElements.get("hui-entities-card"))||void 0===e||e.getConfigElement(),customElements.get("ha-card-conditions-editor")||null===(i=customElements.get("hui-conditional-card"))||void 0===i||i.getConfigElement()},_l=Gs("conditional"),vl=async()=>{if(customElements.get(_l))return;if(!customElements.get("hui-conditional-base")){(await window.loadCardHelpers()).createCardElement({type:"conditional",card:{type:"button"},conditions:[]})}const t=await(async t=>{let e=customElements.get(t);return e||(await customElements.whenDefined(t),customElements.get(t))})("hui-conditional-base");class e extends t{static async getConfigElement(){return await Promise.resolve().then((function(){return Op})),document.createElement(qs("conditional"))}static async getStubConfig(){return{type:"conditional",conditions:[]}}setConfig(t){if(this.validateConfig(t),!t.chip)throw new Error("No chip configured");this._element=Ks(t.chip)}}customElements.get(_l)||customElements.define(_l,e)};function bl(t){return null!=t.attributes.brightness?Math.max(Math.round(100*t.attributes.brightness/255),1):void 0}function yl(t){return null!=t.attributes.rgb_color?t.attributes.rgb_color:void 0}function xl(t){return Ga.rgb(t).l()>96}function wl(t){return Ga.rgb(t).l()>97}function kl(t){return(t=>{var e;return(null===(e=t.attributes.supported_color_modes)||void 0===e?void 0:e.some((t=>De.includes(t))))||!1})(t)}function Cl(t){return(t=>{var e;return(null===(e=t.attributes.supported_color_modes)||void 0===e?void 0:e.some((t=>Le.includes(t))))||!1})(t)}let $l=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return Fp})),document.createElement(qs("light"))}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>"light"===t.split(".")[0]));return{type:"light",entity:e[0]}}setConfig(t){this._config=Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){var t,e;if(!this.hass||!this._config||!this._config.entity)return K;const i=this._config.entity,o=this.hass.states[i];if(!o)return K;const n=this._config.name||o.attributes.friendly_name||"",r=this._config.icon,a=this.hass.formatEntityState?this.hass.formatEntityState(o):ne(this.hass.localize,o,this.hass.locale,this.hass.config,this.hass.entities),s=Bt(o),l=yl(o),c={};if(l&&(null===(t=this._config)||void 0===t?void 0:t.use_light_color)){const t=l.join(",");c["--color"]=`rgb(${t})`,wl(l)&&(c["--color"]="rgba(var(--rgb-primary-text-color), 0.2)")}const d=rs(null!==(e=this._config.content_info)&&void 0!==e?e:"state",n,a,o,this.hass),u=Ie(this.hass);return Y`
+ ${nl}
+ `}};n([_t({attribute:!1})],gl.prototype,"hass",void 0),n([vt()],gl.prototype,"_config",void 0),n([vt()],gl.prototype,"_templateResults",void 0),n([vt()],gl.prototype,"_unsubRenderTemplates",void 0),gl=n([pt(qs("template"))],gl);const _l=()=>{var t,e,i;customElements.get("ha-form")||null===(t=customElements.get("hui-button-card"))||void 0===t||t.getConfigElement(),customElements.get("ha-entity-picker")||null===(e=customElements.get("hui-entities-card"))||void 0===e||e.getConfigElement(),customElements.get("ha-card-conditions-editor")||null===(i=customElements.get("hui-conditional-card"))||void 0===i||i.getConfigElement()},vl=qs("conditional"),bl=async()=>{if(customElements.get(vl))return;if(!customElements.get("hui-conditional-base")){(await window.loadCardHelpers()).createCardElement({type:"conditional",card:{type:"button"},conditions:[]})}const t=await(async t=>{let e=customElements.get(t);return e||(await customElements.whenDefined(t),customElements.get(t))})("hui-conditional-base");class e extends t{static async getConfigElement(){return await Promise.resolve().then((function(){return Mp})),document.createElement(Zs("conditional"))}static async getStubConfig(){return{type:"conditional",conditions:[]}}setConfig(t){if(this.validateConfig(t),!t.chip)throw new Error("No chip configured");this._element=Gs(t.chip)}}customElements.get(vl)||customElements.define(vl,e)};function yl(t){return null!=t.attributes.brightness?Math.max(Math.round(100*t.attributes.brightness/255),1):void 0}function xl(t){return null!=t.attributes.rgb_color?t.attributes.rgb_color:void 0}function wl(t){return qa.rgb(t).l()>96}function kl(t){return qa.rgb(t).l()>97}function Cl(t){return(t=>{var e;return(null===(e=t.attributes.supported_color_modes)||void 0===e?void 0:e.some((t=>De.includes(t))))||!1})(t)}function $l(t){return(t=>{var e;return(null===(e=t.attributes.supported_color_modes)||void 0===e?void 0:e.some((t=>Le.includes(t))))||!1})(t)}let El=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return Vp})),document.createElement(Zs("light"))}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>"light"===t.split(".")[0]));return{type:"light",entity:e[0]}}setConfig(t){this._config=Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){var t,e;if(!this.hass||!this._config||!this._config.entity)return K;const i=this._config.entity,o=this.hass.states[i];if(!o)return K;const n=this._config.name||o.attributes.friendly_name||"",r=this._config.icon,a=this.hass.formatEntityState?this.hass.formatEntityState(o):ne(this.hass.localize,o,this.hass.locale,this.hass.config,this.hass.entities),s=Bt(o),l=xl(o),c={};if(l&&(null===(t=this._config)||void 0===t?void 0:t.use_light_color)){const t=l.join(",");c["--color"]=`rgb(${t})`,kl(l)&&(c["--color"]="rgba(var(--rgb-primary-text-color), 0.2)")}const d=as(null!==(e=this._config.content_info)&&void 0!==e?e:"state",n,a,o,this.hass),u=Ie(this.hass);return Y`
${d?Y`${d}`:K}
@@ -1826,7 +1834,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
ha-state-icon.active {
color: var(--color);
}
- `}};n([_t({attribute:!1})],$l.prototype,"hass",void 0),n([vt()],$l.prototype,"_config",void 0),$l=n([pt(Gs("light"))],$l);let El=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return Hp})),document.createElement(qs("alarm-control-panel"))}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Bs.includes(t.split(".")[0])));return{type:"alarm-control-panel",entity:e[0]}}setConfig(t){this._config=t}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){var t;if(!this.hass||!this._config||!this._config.entity)return K;const e=this._config.entity,i=this.hass.states[e];if(!i)return K;const o=this._config.name||i.attributes.friendly_name||"",n=this._config.icon,r=Hs(i.state),a=Ys(i.state),s=this.hass.formatEntityState?this.hass.formatEntityState(i):ne(this.hass.localize,i,this.hass.locale,this.hass.config,this.hass.entities),l={};if(r){const t=Za(r);l["--color"]=`rgb(${t})`}const c=rs(null!==(t=this._config.content_info)&&void 0!==t?t:"state",o,s,i,this.hass),d=Ie(this.hass);return Y`
+ `}};n([_t({attribute:!1})],El.prototype,"hass",void 0),n([vt()],El.prototype,"_config",void 0),El=n([pt(qs("light"))],El);let Al=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return Yp})),document.createElement(Zs("alarm-control-panel"))}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Us.includes(t.split(".")[0])));return{type:"alarm-control-panel",entity:e[0]}}setConfig(t){this._config=t}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){var t;if(!this.hass||!this._config||!this._config.entity)return K;const e=this._config.entity,i=this.hass.states[e];if(!i)return K;const o=this._config.name||i.attributes.friendly_name||"",n=this._config.icon,r=Ys(i.state),a=Ws(i.state),s=this.hass.formatEntityState?this.hass.formatEntityState(i):ne(this.hass.localize,i,this.hass.locale,this.hass.config,this.hass.entities),l={};if(r){const t=Ja(r);l["--color"]=`rgb(${t})`}const c=as(null!==(t=this._config.content_info)&&void 0!==t?t:"state",o,s,i,this.hass),d=Ie(this.hass);return Y`
${c?Y`${c}`:K}
@@ -1851,18 +1859,18 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
ha-state-icon.pulse {
animation: 1s ease 0s infinite normal none running pulse;
}
- ${xs}
- `}};n([_t({attribute:!1})],El.prototype,"hass",void 0),n([vt()],El.prototype,"_config",void 0),El=n([pt(Gs("alarm-control-panel"))],El);let Al=class extends ht{setConfig(){}static get styles(){return h`
+ ${ws}
+ `}};n([_t({attribute:!1})],Al.prototype,"hass",void 0),n([vt()],Al.prototype,"_config",void 0),Al=n([pt(qs("alarm-control-panel"))],Al);let Sl=class extends ht{setConfig(){}static get styles(){return h`
:host {
flex-grow: 1;
}
- `}};Al=n([pt(Gs("spacer"))],Al);const Sl=`${Rs}-chips-card`,Il=`${Sl}-editor`;Ns({type:Sl,name:"Mushroom Chips Card",description:"Card with chips to display informations"});let Tl=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return df})),document.createElement(Il)}static async getStubConfig(t){const e=await Promise.all([Zs.getStubConfig(t)]);return{type:`custom:${Sl}`,chips:e}}set hass(t){var e;const i=js(this._hass),o=js(t);i!==o&&this.toggleAttribute("dark-mode",o),this._hass=t,null===(e=this.shadowRoot)||void 0===e||e.querySelectorAll("div > *").forEach((e=>{e.hass=t}))}getCardSize(){return 1}setConfig(t){this._config=t}render(){if(!this._config||!this._hass)return K;let t="";this._config.alignment&&(t=`align-${this._config.alignment}`);const e=Ie(this._hass);return Y`
+ `}};Sl=n([pt(qs("spacer"))],Sl);const Il=`${Fs}-chips-card`,Tl=`${Il}-editor`;Rs({type:Il,name:"Mushroom Chips Card",description:"Card with chips to display informations"});let zl=class extends ht{static async getConfigElement(){return await Promise.resolve().then((function(){return uf})),document.createElement(Tl)}static async getStubConfig(t){const e=await Promise.all([Js.getStubConfig(t)]);return{type:`custom:${Il}`,chips:e}}set hass(t){var e;const i=Ds(this._hass),o=Ds(t);i!==o&&this.toggleAttribute("dark-mode",o),this._hass=t,null===(e=this.shadowRoot)||void 0===e||e.querySelectorAll("div > *").forEach((e=>{e.hass=t}))}getCardSize(){return 1}setConfig(t){this._config=t}render(){if(!this._config||!this._hass)return K;let t="";this._config.alignment&&(t=`align-${this._config.alignment}`);const e=Ie(this._hass);return Y`
${this._config.chips.map((t=>this.renderChip(t)))}
- `}renderChip(t){"conditional"===t.type&&vl();const e=Ks(t);return e?(this._hass&&(e.hass=this._hass),e.editMode=this.editMode||this.preview,e.preview=this.preview||this.editMode,Y`${e}`):K}static get styles(){return[Ds.styles,h`
+ `}renderChip(t){"conditional"===t.type&&bl();const e=Gs(t);return e?(this._hass&&(e.hass=this._hass),e.editMode=this.editMode||this.preview,e.preview=this.preview||this.editMode,Y`${e}`):K}static get styles(){return[Ls.styles,h`
ha-card {
background: none;
box-shadow: none;
@@ -1886,20 +1894,20 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
.chip-container.align-justify {
justify-content: space-between;
}
- `]}};n([_t()],Tl.prototype,"preview",void 0),n([_t()],Tl.prototype,"editMode",void 0),n([vt()],Tl.prototype,"_config",void 0),Tl=n([pt(Sl)],Tl);const zl=`${Rs}-climate-card`,Ol=`${zl}-editor`,Ml=["climate"],jl={auto:"var(--rgb-state-climate-auto)",cool:"var(--rgb-state-climate-cool)",dry:"var(--rgb-state-climate-dry)",fan_only:"var(--rgb-state-climate-fan-only)",heat:"var(--rgb-state-climate-heat)",heat_cool:"var(--rgb-state-climate-heat-cool)",off:"var(--rgb-state-climate-off)"},Dl={cooling:"var(--rgb-state-climate-cool)",drying:"var(--rgb-state-climate-dry)",heating:"var(--rgb-state-climate-heat)",idle:"var(--rgb-state-climate-idle)",off:"var(--rgb-state-climate-off)"},Ll={auto:"mdi:calendar-sync",cool:"mdi:snowflake",dry:"mdi:water-percent",fan_only:"mdi:fan",heat:"mdi:fire",heat_cool:"mdi:autorenew",off:"mdi:power"},Pl={cooling:"mdi:snowflake",drying:"mdi:water-percent",heating:"mdi:fire",idle:"mdi:clock-outline",off:"mdi:power"};function Nl(t){var e;return null!==(e=jl[t])&&void 0!==e?e:jl.off}let Rl=class extends ht{constructor(){super(...arguments),this.fill=!1}callService(t){t.stopPropagation();const e=t.target.mode;this.hass.callService("climate","set_hvac_mode",{entity_id:this.entity.entity_id,hvac_mode:e})}render(){const t=Ie(this.hass),e=this.entity.attributes.hvac_modes.filter((t=>{var e;return(null!==(e=this.modes)&&void 0!==e?e:[]).includes(t)})).sort(je);return Y`
+ `]}};n([_t()],zl.prototype,"preview",void 0),n([_t()],zl.prototype,"editMode",void 0),n([vt()],zl.prototype,"_config",void 0),zl=n([pt(Il)],zl);const Ol=`${Fs}-climate-card`,Ml=`${Ol}-editor`,jl=["climate"],Dl={auto:"var(--rgb-state-climate-auto)",cool:"var(--rgb-state-climate-cool)",dry:"var(--rgb-state-climate-dry)",fan_only:"var(--rgb-state-climate-fan-only)",heat:"var(--rgb-state-climate-heat)",heat_cool:"var(--rgb-state-climate-heat-cool)",off:"var(--rgb-state-climate-off)"},Ll={cooling:"var(--rgb-state-climate-cool)",drying:"var(--rgb-state-climate-dry)",heating:"var(--rgb-state-climate-heat)",idle:"var(--rgb-state-climate-idle)",off:"var(--rgb-state-climate-off)"},Pl={auto:"mdi:calendar-sync",cool:"mdi:snowflake",dry:"mdi:water-percent",fan_only:"mdi:fan",heat:"mdi:fire",heat_cool:"mdi:autorenew",off:"mdi:power"},Nl={cooling:"mdi:snowflake",drying:"mdi:water-percent",heating:"mdi:fire",idle:"mdi:clock-outline",off:"mdi:power"};function Rl(t){var e;return null!==(e=Dl[t])&&void 0!==e?e:Dl.off}let Fl=class extends ht{constructor(){super(...arguments),this.fill=!1}callService(t){t.stopPropagation();const e=t.target.mode;this.hass.callService("climate","set_hvac_mode",{entity_id:this.entity.entity_id,hvac_mode:e})}render(){const t=Ie(this.hass),e=this.entity.attributes.hvac_modes.filter((t=>{var e;return(null!==(e=this.modes)&&void 0!==e?e:[]).includes(t)})).sort(je);return Y`
${e.map((t=>this.renderModeButton(t)))}
- `}renderModeButton(t){const e={},i="off"===t?"var(--rgb-grey)":Nl(t);return t===this.entity.state&&(e["--icon-color"]=`rgb(${i})`,e["--bg-color"]=`rgba(${i}, 0.2)`),Y`
+ `}renderModeButton(t){const e={},i="off"===t?"var(--rgb-grey)":Rl(t);return t===this.entity.state&&(e["--icon-color"]=`rgb(${i})`,e["--bg-color"]=`rgba(${i}, 0.2)`),Y`
-
+
- `}};n([_t({attribute:!1})],Rl.prototype,"hass",void 0),n([_t({attribute:!1})],Rl.prototype,"entity",void 0),n([_t({attribute:!1})],Rl.prototype,"modes",void 0),n([_t()],Rl.prototype,"fill",void 0),Rl=n([pt("mushroom-climate-hvac-modes-control")],Rl);let Fl=class extends ht{constructor(){super(...arguments),this.disabled=!1,this.formatOptions={},this.pending=!1,this.dispatchValue=t=>{this.pending=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:t}}))},this.debounceDispatchValue=this.dispatchValue}get _precision(){return Math.ceil(Math.log10(1/this._step))}get _step(){var t;return null!==(t=this.step)&&void 0!==t?t:1}_incrementValue(t){if(t.stopPropagation(),null==this.value)return;const e=Qt(this.value+this._step,this._precision);this._processNewValue(e)}_decrementValue(t){if(t.stopPropagation(),null==this.value)return;const e=Qt(this.value-this._step,this._precision);this._processNewValue(e)}firstUpdated(t){super.firstUpdated(t);const e=(t=>{const e=window.getComputedStyle(t).getPropertyValue("--input-number-debounce"),i=parseFloat(e);return isNaN(i)?2e3:i})(this.container);e&&(this.debounceDispatchValue=Te(this.dispatchValue,e))}_processNewValue(t){const e=((t,e,i)=>{let o;return o=e?Math.max(t,e):t,o=i?Math.min(o,i):o,o})(t,this.min,this.max);this.value!==e&&(this.value=e,this.pending=!0),this.debounceDispatchValue(e)}render(){const t=null!=this.value?te(this.value,this.locale,this.formatOptions):"-";return Y`
+ `}};n([_t({attribute:!1})],Fl.prototype,"hass",void 0),n([_t({attribute:!1})],Fl.prototype,"entity",void 0),n([_t({attribute:!1})],Fl.prototype,"modes",void 0),n([_t()],Fl.prototype,"fill",void 0),Fl=n([pt("mushroom-climate-hvac-modes-control")],Fl);let Vl=class extends ht{constructor(){super(...arguments),this.disabled=!1,this.formatOptions={},this.pending=!1,this.dispatchValue=t=>{this.pending=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:t}}))},this.debounceDispatchValue=this.dispatchValue}get _precision(){return Math.ceil(Math.log10(1/this._step))}get _step(){var t;return null!==(t=this.step)&&void 0!==t?t:1}_incrementValue(t){if(t.stopPropagation(),null==this.value)return;const e=Qt(this.value+this._step,this._precision);this._processNewValue(e)}_decrementValue(t){if(t.stopPropagation(),null==this.value)return;const e=Qt(this.value-this._step,this._precision);this._processNewValue(e)}firstUpdated(t){super.firstUpdated(t);const e=(t=>{const e=window.getComputedStyle(t).getPropertyValue("--input-number-debounce"),i=parseFloat(e);return isNaN(i)?2e3:i})(this.container);e&&(this.debounceDispatchValue=Te(this.dispatchValue,e))}_processNewValue(t){const e=((t,e,i)=>{let o;return o=e?Math.max(t,e):t,o=i?Math.min(o,i):o,o})(t,this.min,this.max);this.value!==e&&(this.value=e,this.pending=!0),this.debounceDispatchValue(e)}render(){const t=null!=this.value?te(this.value,this.locale,this.formatOptions):"-";return Y`
${t}
@@ -1994,7 +2002,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
.value.pending {
opacity: 0.5;
}
- `}};n([_t({attribute:!1})],Fl.prototype,"locale",void 0),n([_t({type:Boolean})],Fl.prototype,"disabled",void 0),n([_t({attribute:!1,type:Number,reflect:!0})],Fl.prototype,"value",void 0),n([_t({type:Number})],Fl.prototype,"step",void 0),n([_t({type:Number})],Fl.prototype,"min",void 0),n([_t({type:Number})],Fl.prototype,"max",void 0),n([_t({attribute:"false"})],Fl.prototype,"formatOptions",void 0),n([vt()],Fl.prototype,"pending",void 0),n([xt("#container")],Fl.prototype,"container",void 0),Fl=n([pt("mushroom-input-number")],Fl);let Vl=class extends ht{constructor(){super(...arguments),this.fill=!1}get _stepSize(){return this.entity.attributes.target_temp_step?this.entity.attributes.target_temp_step:"°F"===this.hass.config.unit_system.temperature?1:.5}onValueChange(t){const e=t.detail.value;this.hass.callService("climate","set_temperature",{entity_id:this.entity.entity_id,temperature:e})}onLowValueChange(t){const e=t.detail.value;this.hass.callService("climate","set_temperature",{entity_id:this.entity.entity_id,target_temp_low:e,target_temp_high:this.entity.attributes.target_temp_high})}onHighValueChange(t){const e=t.detail.value;this.hass.callService("climate","set_temperature",{entity_id:this.entity.entity_id,target_temp_low:this.entity.attributes.target_temp_low,target_temp_high:e})}render(){const t=Ie(this.hass),e=Ut(this.entity),i=1===this._stepSize?{maximumFractionDigits:0}:{minimumFractionDigits:1,maximumFractionDigits:1},o=t=>({"--bg-color":`rgba(var(--rgb-state-climate-${t}), 0.05)`,"--icon-color":`rgb(var(--rgb-state-climate-${t}))`,"--text-color":`rgb(var(--rgb-state-climate-${t}))`});return Y`
+ `}};n([_t({attribute:!1})],Vl.prototype,"locale",void 0),n([_t({type:Boolean})],Vl.prototype,"disabled",void 0),n([_t({attribute:!1,type:Number,reflect:!0})],Vl.prototype,"value",void 0),n([_t({type:Number})],Vl.prototype,"step",void 0),n([_t({type:Number})],Vl.prototype,"min",void 0),n([_t({type:Number})],Vl.prototype,"max",void 0),n([_t({attribute:"false"})],Vl.prototype,"formatOptions",void 0),n([vt()],Vl.prototype,"pending",void 0),n([xt("#container")],Vl.prototype,"container",void 0),Vl=n([pt("mushroom-input-number")],Vl);let Bl=class extends ht{constructor(){super(...arguments),this.fill=!1}get _stepSize(){return this.entity.attributes.target_temp_step?this.entity.attributes.target_temp_step:"°F"===this.hass.config.unit_system.temperature?1:.5}onValueChange(t){const e=t.detail.value;this.hass.callService("climate","set_temperature",{entity_id:this.entity.entity_id,temperature:e})}onLowValueChange(t){const e=t.detail.value;this.hass.callService("climate","set_temperature",{entity_id:this.entity.entity_id,target_temp_low:e,target_temp_high:this.entity.attributes.target_temp_high})}onHighValueChange(t){const e=t.detail.value;this.hass.callService("climate","set_temperature",{entity_id:this.entity.entity_id,target_temp_low:this.entity.attributes.target_temp_low,target_temp_high:e})}render(){const t=Ie(this.hass),e=Ut(this.entity),i=1===this._stepSize?{maximumFractionDigits:0}:{minimumFractionDigits:1,maximumFractionDigits:1},o=t=>({"--bg-color":`rgba(var(--rgb-state-climate-${t}), 0.05)`,"--icon-color":`rgb(var(--rgb-state-climate-${t}))`,"--text-color":`rgb(var(--rgb-state-climate-${t}))`});return Y`
${null!=this.entity.attributes.temperature?Y`
`:K}
- `}};n([_t({attribute:!1})],Vl.prototype,"hass",void 0),n([_t({attribute:!1})],Vl.prototype,"entity",void 0),n([_t()],Vl.prototype,"fill",void 0),Vl=n([pt("mushroom-climate-temperature-control")],Vl);const Bl={temperature_control:"mdi:thermometer",hvac_mode_control:"mdi:thermostat"};Ns({type:zl,name:"Mushroom Climate Card",description:"Card for climate entity"});let Ul=class extends Ls{static async getConfigElement(){return await Promise.resolve().then((function(){return gf})),document.createElement(Ol)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Ml.includes(t.split(".")[0])));return{type:`custom:${zl}`,entity:e[0]}}get _controls(){if(!this._config||!this._stateObj)return[];const t=this._stateObj,e=[];var i;return(null!=(i=t).attributes.temperature||null!=i.attributes.target_temp_low&&null!=i.attributes.target_temp_high)&&this._config.show_temperature_control&&e.push("temperature_control"),((t,e)=>(t.attributes.hvac_modes||[]).some((t=>(null!=e?e:[]).includes(t))))(t,this._config.hvac_modes)&&e.push("hvac_mode_control"),e}get hasControls(){return this._controls.length>0}_onControlTap(t,e){e.stopPropagation(),this._activeControl=t}setConfig(t){super.setConfig(Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)),this.updateActiveControl()}updated(t){super.updated(t),this.hass&&t.has("hass")&&this.updateActiveControl()}updateActiveControl(){const t=!!this._activeControl&&this._controls.includes(this._activeControl);this._activeControl=t?this._activeControl:this._controls[0]}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this.hass||!this._config||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=Es(this._config),n=as(t,o.icon_type);let r=this.hass.formatEntityState?this.hass.formatEntityState(t):ne(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities);if(null!==t.attributes.current_temperature){r+=` - ${te(t.attributes.current_temperature,this.hass.locale)} ${this.hass.config.unit_system.temperature}`}const a=Ie(this.hass),s=(!this._config.collapsible_controls||Bt(t))&&this._controls.length;return Y`
+ `}};n([_t({attribute:!1})],Bl.prototype,"hass",void 0),n([_t({attribute:!1})],Bl.prototype,"entity",void 0),n([_t()],Bl.prototype,"fill",void 0),Bl=n([pt("mushroom-climate-temperature-control")],Bl);const Ul={temperature_control:"mdi:thermometer",hvac_mode_control:"mdi:thermostat"};Rs({type:Ol,name:"Mushroom Climate Card",description:"Card for climate entity"});let Hl=class extends Ps{static async getConfigElement(){return await Promise.resolve().then((function(){return _f})),document.createElement(Ml)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>jl.includes(t.split(".")[0])));return{type:`custom:${Ol}`,entity:e[0]}}get _controls(){if(!this._config||!this._stateObj)return[];const t=this._stateObj,e=[];var i;return(null!=(i=t).attributes.temperature||null!=i.attributes.target_temp_low&&null!=i.attributes.target_temp_high)&&this._config.show_temperature_control&&e.push("temperature_control"),((t,e)=>(t.attributes.hvac_modes||[]).some((t=>(null!=e?e:[]).includes(t))))(t,this._config.hvac_modes)&&e.push("hvac_mode_control"),e}get hasControls(){return this._controls.length>0}_onControlTap(t,e){e.stopPropagation(),this._activeControl=t}setConfig(t){super.setConfig(Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)),this.updateActiveControl()}updated(t){super.updated(t),this.hass&&t.has("hass")&&this.updateActiveControl()}updateActiveControl(){const t=!!this._activeControl&&this._controls.includes(this._activeControl);this._activeControl=t?this._activeControl:this._controls[0]}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this.hass||!this._config||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=As(this._config),n=ss(t,o.icon_type);let r=this.hass.formatEntityState?this.hass.formatEntityState(t):ne(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities);if(null!==t.attributes.current_temperature){r+=` - ${te(t.attributes.current_temperature,this.hass.locale)} ${this.hass.config.unit_system.temperature}`}const a=Ie(this.hass),s=(!this._config.collapsible_controls||Bt(t))&&this._controls.length;return Y`
- `}renderIcon(t,e){const i=Ut(t),o=Nl(t.state),n={};return n["--icon-color"]=`rgb(${o})`,n["--shape-color"]=`rgba(${o}, 0.2)`,Y`
+ `}renderIcon(t,e){const i=Ut(t),o=Rl(t.state),n={};return n["--icon-color"]=`rgb(${o})`,n["--shape-color"]=`rgba(${o}, 0.2)`,Y`
- `}renderBadge(t){return!Ut(t)?super.renderBadge(t):this.renderActionBadge(t)}renderActionBadge(t){const e=t.attributes.hvac_action;if(!e||"off"==e)return K;const i=function(t){var e;return null!==(e=Dl[t])&&void 0!==e?e:Dl.off}(e),o=function(t){var e;return null!==(e=Pl[t])&&void 0!==e?e:""}(e);return o?Y`
+ `}renderBadge(t){return!Ut(t)?super.renderBadge(t):this.renderActionBadge(t)}renderActionBadge(t){const e=t.attributes.hvac_action;if(!e||"off"==e)return K;const i=function(t){var e;return null!==(e=Ll[t])&&void 0!==e?e:Ll.off}(e),o=function(t){var e;return null!==(e=Nl[t])&&void 0!==e?e:""}(e);return o?Y`
`:K}renderOtherControls(){const t=this._controls.filter((t=>t!=this._activeControl));return Y`
${t.map((t=>Y`
this._onControlTap(t,e)}>
-
+
`))}
- `}renderActiveControl(t){var e;const i=null!==(e=this._config.hvac_modes)&&void 0!==e?e:[],o=Es(this._config);switch(this._activeControl){case"temperature_control":return Y`
+ `}renderActiveControl(t){var e;const i=null!==(e=this._config.hvac_modes)&&void 0!==e?e:[],o=As(this._config);switch(this._activeControl){case"temperature_control":return Y`
- `;default:return K}}static get styles(){return[super.styles,Ps,h`
+ `;default:return K}}static get styles(){return[super.styles,Ns,h`
mushroom-state-item {
cursor: pointer;
}
@@ -2101,7 +2109,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
mushroom-climate-hvac-modes-control {
flex: 1;
}
- `]}};n([vt()],Ul.prototype,"_activeControl",void 0),Ul=n([pt(zl)],Ul);const Hl=`${Rs}-cover-card`,Yl=`${Hl}-editor`,Wl=["cover"];let Xl=class extends ht{constructor(){super(...arguments),this.fill=!1}_onOpenTap(t){t.stopPropagation(),this.hass.callService("cover","open_cover",{entity_id:this.entity.entity_id})}_onCloseTap(t){t.stopPropagation(),this.hass.callService("cover","close_cover",{entity_id:this.entity.entity_id})}_onStopTap(t){t.stopPropagation(),this.hass.callService("cover","stop_cover",{entity_id:this.entity.entity_id})}get openDisabled(){const t=!0===this.entity.attributes.assumed_state;return((void 0!==(e=this.entity).attributes.current_position?100===e.attributes.current_position:"open"===e.state)||function(t){return"opening"===t.state}(this.entity))&&!t;var e}get closedDisabled(){const t=!0===this.entity.attributes.assumed_state;return((void 0!==(e=this.entity).attributes.current_position?0===e.attributes.current_position:"closed"===e.state)||function(t){return"closing"===t.state}(this.entity))&&!t;var e}render(){const t=Ie(this.hass);return Y`
+ `]}};n([vt()],Hl.prototype,"_activeControl",void 0),Hl=n([pt(Ol)],Hl);const Yl=`${Fs}-cover-card`,Wl=`${Yl}-editor`,Xl=["cover"];let Kl=class extends ht{constructor(){super(...arguments),this.fill=!1}_onOpenTap(t){t.stopPropagation(),this.hass.callService("cover","open_cover",{entity_id:this.entity.entity_id})}_onCloseTap(t){t.stopPropagation(),this.hass.callService("cover","close_cover",{entity_id:this.entity.entity_id})}_onStopTap(t){t.stopPropagation(),this.hass.callService("cover","stop_cover",{entity_id:this.entity.entity_id})}get openDisabled(){const t=!0===this.entity.attributes.assumed_state;return((void 0!==(e=this.entity).attributes.current_position?100===e.attributes.current_position:"open"===e.state)||function(t){return"opening"===t.state}(this.entity))&&!t;var e}get closedDisabled(){const t=!0===this.entity.attributes.assumed_state;return((void 0!==(e=this.entity).attributes.current_position?0===e.attributes.current_position:"closed"===e.state)||function(t){return"closing"===t.state}(this.entity))&&!t;var e}render(){const t=Ie(this.hass);return Y`
${Wt(this.entity,1)?Y`
`:void 0}
- `}};n([_t({attribute:!1})],Xl.prototype,"hass",void 0),n([_t({attribute:!1})],Xl.prototype,"entity",void 0),n([_t()],Xl.prototype,"fill",void 0),Xl=n([pt("mushroom-cover-buttons-control")],Xl);var Kl;
+ `}};n([_t({attribute:!1})],Kl.prototype,"hass",void 0),n([_t({attribute:!1})],Kl.prototype,"entity",void 0),n([_t()],Kl.prototype,"fill",void 0),Kl=n([pt("mushroom-cover-buttons-control")],Kl);var Gl;
/*! Hammer.JS - v2.0.7 - 2016-04-22
* http://hammerjs.github.io/
*
* Copyright (c) 2016 Jorik Tangelder;
- * Licensed under the MIT license */Kl={exports:{}},function(t,e,i,o){var n,r=["","webkit","Moz","MS","ms","o"],a=e.createElement("div"),s="function",l=Math.round,c=Math.abs,d=Date.now;function u(t,e,i){return setTimeout(v(t,i),e)}function h(t,e,i){return!!Array.isArray(t)&&(m(t,i[e],i),!0)}function m(t,e,i){var n;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==o)for(n=0;n\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=t.console&&(t.console.warn||t.console.log);return r&&r.call(t.console,n,o),e.apply(this,arguments)}}n="function"!=typeof Object.assign?function(t){if(t===o||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i-1}function $(t){return t.trim().split(/\s+/g)}function E(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var o=0;oi[e]})),o}function I(t,e){for(var i,n,a=e[0].toUpperCase()+e.slice(1),s=0;s1&&!i.firstMultiple?i.firstMultiple=Q(e):1===r&&(i.firstMultiple=!1);var a=i.firstInput,s=i.firstMultiple,l=s?s.center:a.center,u=e.center=tt(n);e.timeStamp=d(),e.deltaTime=e.timeStamp-a.timeStamp,e.angle=nt(l,u),e.distance=ot(l,u),function(t,e){var i=e.center,o=t.offsetDelta||{},n=t.prevDelta||{},r=t.prevInput||{};e.eventType!==N&&r.eventType!==R||(n=t.prevDelta={x:r.deltaX||0,y:r.deltaY||0},o=t.offsetDelta={x:i.x,y:i.y}),e.deltaX=n.x+(i.x-o.x),e.deltaY=n.y+(i.y-o.y)}(i,e),e.offsetDirection=it(e.deltaX,e.deltaY);var h,m,p=et(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=p.x,e.overallVelocityY=p.y,e.overallVelocity=c(p.x)>c(p.y)?p.x:p.y,e.scale=s?(h=s.pointers,ot((m=n)[0],m[1],q)/ot(h[0],h[1],q)):1,e.rotation=s?function(t,e){return nt(e[1],e[0],q)+nt(t[1],t[0],q)}(s.pointers,n):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,function(t,e){var i,n,r,a,s=t.lastInterval||e,l=e.timeStamp-s.timeStamp;if(e.eventType!=F&&(l>P||s.velocity===o)){var d=e.deltaX-s.deltaX,u=e.deltaY-s.deltaY,h=et(l,d,u);n=h.x,r=h.y,i=c(h.x)>c(h.y)?h.x:h.y,a=it(d,u),t.lastInterval=e}else i=s.velocity,n=s.velocityX,r=s.velocityY,a=s.direction;e.velocity=i,e.velocityX=n,e.velocityY=r,e.direction=a}(i,e);var f=t.element;k(e.srcEvent.target,f)&&(f=e.srcEvent.target),e.target=f}(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function Q(t){for(var e=[],i=0;i=c(e)?t<0?B:U:e<0?H:Y}function ot(t,e,i){i||(i=G);var o=e[i[0]]-t[i[0]],n=e[i[1]]-t[i[1]];return Math.sqrt(o*o+n*n)}function nt(t,e,i){i||(i=G);var o=e[i[0]]-t[i[0]],n=e[i[1]]-t[i[1]];return 180*Math.atan2(n,o)/Math.PI}Z.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(z(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(z(this.element),this.evWin,this.domHandler)}};var rt={mousedown:N,mousemove:2,mouseup:R},at="mousedown",st="mousemove mouseup";function lt(){this.evEl=at,this.evWin=st,this.pressed=!1,Z.apply(this,arguments)}_(lt,Z,{handler:function(t){var e=rt[t.type];e&N&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=R),this.pressed&&(e&R&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:L,srcEvent:t}))}});var ct={pointerdown:N,pointermove:2,pointerup:R,pointercancel:F,pointerout:F},dt={2:D,3:"pen",4:L,5:"kinect"},ut="pointerdown",ht="pointermove pointerup pointercancel";function mt(){this.evEl=ut,this.evWin=ht,Z.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}t.MSPointerEvent&&!t.PointerEvent&&(ut="MSPointerDown",ht="MSPointerMove MSPointerUp MSPointerCancel"),_(mt,Z,{handler:function(t){var e=this.store,i=!1,o=t.type.toLowerCase().replace("ms",""),n=ct[o],r=dt[t.pointerType]||t.pointerType,a=r==D,s=E(e,t.pointerId,"pointerId");n&N&&(0===t.button||a)?s<0&&(e.push(t),s=e.length-1):n&(R|F)&&(i=!0),s<0||(e[s]=t,this.callback(this.manager,n,{pointers:e,changedPointers:[t],pointerType:r,srcEvent:t}),i&&e.splice(s,1))}});var pt={touchstart:N,touchmove:2,touchend:R,touchcancel:F};function ft(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,Z.apply(this,arguments)}function gt(t,e){var i=A(t.touches),o=A(t.changedTouches);return e&(R|F)&&(i=S(i.concat(o),"identifier")),[i,o]}_(ft,Z,{handler:function(t){var e=pt[t.type];if(e===N&&(this.started=!0),this.started){var i=gt.call(this,t,e);e&(R|F)&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:D,srcEvent:t})}}});var _t={touchstart:N,touchmove:2,touchend:R,touchcancel:F},vt="touchstart touchmove touchend touchcancel";function bt(){this.evTarget=vt,this.targetIds={},Z.apply(this,arguments)}function yt(t,e){var i=A(t.touches),o=this.targetIds;if(e&(2|N)&&1===i.length)return o[i[0].identifier]=!0,[i,i];var n,r,a=A(t.changedTouches),s=[],l=this.target;if(r=i.filter((function(t){return k(t.target,l)})),e===N)for(n=0;n-1&&o.splice(t,1)}),xt)}}function $t(t){for(var e=t.srcEvent.clientX,i=t.srcEvent.clientY,o=0;o-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,i=this.state;function o(i){e.manager.emit(i,t)}i<8&&o(e.options.event+Rt(i)),o(e.options.event),t.additionalEvent&&o(t.additionalEvent),i>=8&&o(e.options.event+Rt(i))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=Pt},canEmit:function(){for(var t=0;te.threshold&&n&e.direction},attrTest:function(t){return Bt.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=Ft(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),_(Ht,Bt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[zt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),_(Yt,Nt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[It]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,o=t.distancee.time;if(this._input=t,!o||!i||t.eventType&(R|F)&&!n)this.reset();else if(t.eventType&N)this.reset(),this._timer=u((function(){this.state=8,this.tryEmit()}),e.time,this);else if(t.eventType&R)return 8;return Pt},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&t.eventType&R?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=d(),this.manager.emit(this.options.event,this._input)))}}),_(Wt,Bt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[zt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),_(Xt,Bt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:W|X,pointers:1},getTouchAction:function(){return Ut.prototype.getTouchAction.call(this)},attrTest:function(t){var e,i=this.options.direction;return i&(W|X)?e=t.overallVelocity:i&W?e=t.overallVelocityX:i&X&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&i&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&c(e)>this.options.velocity&&t.eventType&R},emit:function(t){var e=Ft(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),_(Kt,Nt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Tt]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,o=t.distance{const e=t.center.x,i=t.target.getBoundingClientRect().left,o=t.target.clientWidth;return Math.max(Math.min(1,(e-i)/o),0)};let ql=class extends ht{constructor(){super(...arguments),this.disabled=!1,this.inactive=!1,this.step=1,this.min=0,this.max=100,this.controlled=!1}valueToPercentage(t){return(t-this.min)/(this.max-this.min)}percentageToValue(t){return(this.max-this.min)*t+this.min}firstUpdated(t){super.firstUpdated(t),this.setupListeners()}connectedCallback(){super.connectedCallback(),this.setupListeners()}disconnectedCallback(){super.disconnectedCallback(),this.destroyListeners()}setupListeners(){if(this.slider&&!this._mc){const t=(t=>{const e=window.getComputedStyle(t).getPropertyValue("--slider-threshold"),i=parseFloat(e);return isNaN(i)?10:i})(this.slider);let e;this._mc=new Hammer.Manager(this.slider,{touchAction:"pan-y"}),this._mc.add(new Hammer.Pan({threshold:t,direction:Hammer.DIRECTION_ALL,enable:!0})),this._mc.add(new Hammer.Tap({event:"singletap"})),this._mc.on("panstart",(()=>{this.disabled||(this.controlled=!0,e=this.value)})),this._mc.on("pancancel",(()=>{this.disabled||(this.controlled=!1,this.value=e)})),this._mc.on("panmove",(t=>{if(this.disabled)return;const e=Gl(t);this.value=this.percentageToValue(e),this.dispatchEvent(new CustomEvent("current-change",{detail:{value:Math.round(this.value/this.step)*this.step}}))})),this._mc.on("panend",(t=>{if(this.disabled)return;this.controlled=!1;const e=Gl(t);this.value=Math.round(this.percentageToValue(e)/this.step)*this.step,this.dispatchEvent(new CustomEvent("current-change",{detail:{value:void 0}})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value}}))})),this._mc.on("singletap",(t=>{if(this.disabled)return;const e=Gl(t);this.value=Math.round(this.percentageToValue(e)/this.step)*this.step,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value}}))}))}}destroyListeners(){this._mc&&(this._mc.destroy(),this._mc=void 0)}render(){var t;return Y`
+ * Licensed under the MIT license */Gl={exports:{}},function(t,e,i,o){var n,r=["","webkit","Moz","MS","ms","o"],a=e.createElement("div"),s="function",l=Math.round,c=Math.abs,d=Date.now;function u(t,e,i){return setTimeout(v(t,i),e)}function h(t,e,i){return!!Array.isArray(t)&&(m(t,i[e],i),!0)}function m(t,e,i){var n;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==o)for(n=0;n\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=t.console&&(t.console.warn||t.console.log);return r&&r.call(t.console,n,o),e.apply(this,arguments)}}n="function"!=typeof Object.assign?function(t){if(t===o||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i-1}function $(t){return t.trim().split(/\s+/g)}function E(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var o=0;oi[e]})),o}function I(t,e){for(var i,n,a=e[0].toUpperCase()+e.slice(1),s=0;s1&&!i.firstMultiple?i.firstMultiple=Q(e):1===r&&(i.firstMultiple=!1);var a=i.firstInput,s=i.firstMultiple,l=s?s.center:a.center,u=e.center=tt(n);e.timeStamp=d(),e.deltaTime=e.timeStamp-a.timeStamp,e.angle=nt(l,u),e.distance=ot(l,u),function(t,e){var i=e.center,o=t.offsetDelta||{},n=t.prevDelta||{},r=t.prevInput||{};e.eventType!==N&&r.eventType!==R||(n=t.prevDelta={x:r.deltaX||0,y:r.deltaY||0},o=t.offsetDelta={x:i.x,y:i.y}),e.deltaX=n.x+(i.x-o.x),e.deltaY=n.y+(i.y-o.y)}(i,e),e.offsetDirection=it(e.deltaX,e.deltaY);var h,m,p=et(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=p.x,e.overallVelocityY=p.y,e.overallVelocity=c(p.x)>c(p.y)?p.x:p.y,e.scale=s?(h=s.pointers,ot((m=n)[0],m[1],q)/ot(h[0],h[1],q)):1,e.rotation=s?function(t,e){return nt(e[1],e[0],q)+nt(t[1],t[0],q)}(s.pointers,n):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,function(t,e){var i,n,r,a,s=t.lastInterval||e,l=e.timeStamp-s.timeStamp;if(e.eventType!=F&&(l>P||s.velocity===o)){var d=e.deltaX-s.deltaX,u=e.deltaY-s.deltaY,h=et(l,d,u);n=h.x,r=h.y,i=c(h.x)>c(h.y)?h.x:h.y,a=it(d,u),t.lastInterval=e}else i=s.velocity,n=s.velocityX,r=s.velocityY,a=s.direction;e.velocity=i,e.velocityX=n,e.velocityY=r,e.direction=a}(i,e);var f=t.element;k(e.srcEvent.target,f)&&(f=e.srcEvent.target),e.target=f}(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function Q(t){for(var e=[],i=0;i=c(e)?t<0?B:U:e<0?H:Y}function ot(t,e,i){i||(i=G);var o=e[i[0]]-t[i[0]],n=e[i[1]]-t[i[1]];return Math.sqrt(o*o+n*n)}function nt(t,e,i){i||(i=G);var o=e[i[0]]-t[i[0]],n=e[i[1]]-t[i[1]];return 180*Math.atan2(n,o)/Math.PI}Z.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(z(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(z(this.element),this.evWin,this.domHandler)}};var rt={mousedown:N,mousemove:2,mouseup:R},at="mousedown",st="mousemove mouseup";function lt(){this.evEl=at,this.evWin=st,this.pressed=!1,Z.apply(this,arguments)}_(lt,Z,{handler:function(t){var e=rt[t.type];e&N&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=R),this.pressed&&(e&R&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:L,srcEvent:t}))}});var ct={pointerdown:N,pointermove:2,pointerup:R,pointercancel:F,pointerout:F},dt={2:D,3:"pen",4:L,5:"kinect"},ut="pointerdown",ht="pointermove pointerup pointercancel";function mt(){this.evEl=ut,this.evWin=ht,Z.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}t.MSPointerEvent&&!t.PointerEvent&&(ut="MSPointerDown",ht="MSPointerMove MSPointerUp MSPointerCancel"),_(mt,Z,{handler:function(t){var e=this.store,i=!1,o=t.type.toLowerCase().replace("ms",""),n=ct[o],r=dt[t.pointerType]||t.pointerType,a=r==D,s=E(e,t.pointerId,"pointerId");n&N&&(0===t.button||a)?s<0&&(e.push(t),s=e.length-1):n&(R|F)&&(i=!0),s<0||(e[s]=t,this.callback(this.manager,n,{pointers:e,changedPointers:[t],pointerType:r,srcEvent:t}),i&&e.splice(s,1))}});var pt={touchstart:N,touchmove:2,touchend:R,touchcancel:F};function ft(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,Z.apply(this,arguments)}function gt(t,e){var i=A(t.touches),o=A(t.changedTouches);return e&(R|F)&&(i=S(i.concat(o),"identifier")),[i,o]}_(ft,Z,{handler:function(t){var e=pt[t.type];if(e===N&&(this.started=!0),this.started){var i=gt.call(this,t,e);e&(R|F)&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:D,srcEvent:t})}}});var _t={touchstart:N,touchmove:2,touchend:R,touchcancel:F},vt="touchstart touchmove touchend touchcancel";function bt(){this.evTarget=vt,this.targetIds={},Z.apply(this,arguments)}function yt(t,e){var i=A(t.touches),o=this.targetIds;if(e&(2|N)&&1===i.length)return o[i[0].identifier]=!0,[i,i];var n,r,a=A(t.changedTouches),s=[],l=this.target;if(r=i.filter((function(t){return k(t.target,l)})),e===N)for(n=0;n-1&&o.splice(t,1)}),xt)}}function $t(t){for(var e=t.srcEvent.clientX,i=t.srcEvent.clientY,o=0;o-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,i=this.state;function o(i){e.manager.emit(i,t)}i<8&&o(e.options.event+Rt(i)),o(e.options.event),t.additionalEvent&&o(t.additionalEvent),i>=8&&o(e.options.event+Rt(i))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=Pt},canEmit:function(){for(var t=0;te.threshold&&n&e.direction},attrTest:function(t){return Bt.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=Ft(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),_(Ht,Bt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[zt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),_(Yt,Nt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[It]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,o=t.distancee.time;if(this._input=t,!o||!i||t.eventType&(R|F)&&!n)this.reset();else if(t.eventType&N)this.reset(),this._timer=u((function(){this.state=8,this.tryEmit()}),e.time,this);else if(t.eventType&R)return 8;return Pt},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&t.eventType&R?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=d(),this.manager.emit(this.options.event,this._input)))}}),_(Wt,Bt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[zt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),_(Xt,Bt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:W|X,pointers:1},getTouchAction:function(){return Ut.prototype.getTouchAction.call(this)},attrTest:function(t){var e,i=this.options.direction;return i&(W|X)?e=t.overallVelocity:i&W?e=t.overallVelocityX:i&X&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&i&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&c(e)>this.options.velocity&&t.eventType&R},emit:function(t){var e=Ft(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),_(Kt,Nt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Tt]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,o=t.distance{const e=t.center.x,i=t.target.getBoundingClientRect().left,o=t.target.clientWidth;return Math.max(Math.min(1,(e-i)/o),0)};let Zl=class extends ht{constructor(){super(...arguments),this.disabled=!1,this.inactive=!1,this.step=1,this.min=0,this.max=100,this.controlled=!1}valueToPercentage(t){return(t-this.min)/(this.max-this.min)}percentageToValue(t){return(this.max-this.min)*t+this.min}firstUpdated(t){super.firstUpdated(t),this.setupListeners()}connectedCallback(){super.connectedCallback(),this.setupListeners()}disconnectedCallback(){super.disconnectedCallback(),this.destroyListeners()}setupListeners(){if(this.slider&&!this._mc){const t=(t=>{const e=window.getComputedStyle(t).getPropertyValue("--slider-threshold"),i=parseFloat(e);return isNaN(i)?10:i})(this.slider);let e;this._mc=new Hammer.Manager(this.slider,{touchAction:"pan-y"}),this._mc.add(new Hammer.Pan({threshold:t,direction:Hammer.DIRECTION_ALL,enable:!0})),this._mc.add(new Hammer.Tap({event:"singletap"})),this._mc.on("panstart",(()=>{this.disabled||(this.controlled=!0,e=this.value)})),this._mc.on("pancancel",(()=>{this.disabled||(this.controlled=!1,this.value=e)})),this._mc.on("panmove",(t=>{if(this.disabled)return;const e=ql(t);this.value=this.percentageToValue(e),this.dispatchEvent(new CustomEvent("current-change",{detail:{value:Math.round(this.value/this.step)*this.step}}))})),this._mc.on("panend",(t=>{if(this.disabled)return;this.controlled=!1;const e=ql(t);this.value=Math.round(this.percentageToValue(e)/this.step)*this.step,this.dispatchEvent(new CustomEvent("current-change",{detail:{value:void 0}})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value}}))})),this._mc.on("singletap",(t=>{if(this.disabled)return;const e=ql(t);this.value=Math.round(this.percentageToValue(e)/this.step)*this.step,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value}}))}))}}destroyListeners(){this._mc&&(this._mc.destroy(),this._mc=void 0)}render(){var t;return Y`
${this.showActive?Y`
`:K}
@@ -2233,7 +2241,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
.controlled .slider .slider-track-indicator {
transition: none;
}
- `}};function Zl(t){return null!=t.attributes.current_position?Math.round(t.attributes.current_position):void 0}function Jl(t){const e=t.state;return"open"===e||"opening"===e?"var(--rgb-state-cover-open)":"closed"===e||"closing"===e?"var(--rgb-state-cover-closed)":"var(--rgb-disabled)"}n([_t({type:Boolean})],ql.prototype,"disabled",void 0),n([_t({type:Boolean})],ql.prototype,"inactive",void 0),n([_t({type:Boolean,attribute:"show-active"})],ql.prototype,"showActive",void 0),n([_t({type:Boolean,attribute:"show-indicator"})],ql.prototype,"showIndicator",void 0),n([_t({attribute:!1,type:Number,reflect:!0})],ql.prototype,"value",void 0),n([_t({type:Number})],ql.prototype,"step",void 0),n([_t({type:Number})],ql.prototype,"min",void 0),n([_t({type:Number})],ql.prototype,"max",void 0),n([vt()],ql.prototype,"controlled",void 0),n([xt("#slider")],ql.prototype,"slider",void 0),ql=n([pt("mushroom-slider")],ql);let Ql=class extends ht{onChange(t){const e=t.detail.value;this.hass.callService("cover","set_cover_position",{entity_id:this.entity.entity_id,position:e})}onCurrentChange(t){const e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}render(){const t=Zl(this.entity);return Y`
+ `}};function Jl(t){return null!=t.attributes.current_position?Math.round(t.attributes.current_position):void 0}function Ql(t){const e=t.state;return"open"===e||"opening"===e?"var(--rgb-state-cover-open)":"closed"===e||"closing"===e?"var(--rgb-state-cover-closed)":"var(--rgb-disabled)"}n([_t({type:Boolean})],Zl.prototype,"disabled",void 0),n([_t({type:Boolean})],Zl.prototype,"inactive",void 0),n([_t({type:Boolean,attribute:"show-active"})],Zl.prototype,"showActive",void 0),n([_t({type:Boolean,attribute:"show-indicator"})],Zl.prototype,"showIndicator",void 0),n([_t({attribute:!1,type:Number,reflect:!0})],Zl.prototype,"value",void 0),n([_t({type:Number})],Zl.prototype,"step",void 0),n([_t({type:Number})],Zl.prototype,"min",void 0),n([_t({type:Number})],Zl.prototype,"max",void 0),n([vt()],Zl.prototype,"controlled",void 0),n([xt("#slider")],Zl.prototype,"slider",void 0),Zl=n([pt("mushroom-slider")],Zl);let tc=class extends ht{onChange(t){const e=t.detail.value;this.hass.callService("cover","set_cover_position",{entity_id:this.entity.entity_id,position:e})}onCurrentChange(t){const e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}render(){const t=Jl(this.entity);return Y`
- `}static get styles(){const t=tc.map((([t,e])=>`${e} ${100*t}%`)).join(", ");return h`
+ `}static get styles(){const t=ec.map((([t,e])=>`${e} ${100*t}%`)).join(", ");return h`
mushroom-slider {
--main-color: var(--slider-color);
--bg-color: var(--slider-bg-color);
--gradient: -webkit-linear-gradient(right, ${u(t)});
}
- `}};n([_t({attribute:!1})],ec.prototype,"hass",void 0),n([_t({attribute:!1})],ec.prototype,"entity",void 0),ec=n([pt("mushroom-cover-tilt-position-control")],ec);const ic={buttons_control:"mdi:gesture-tap-button",position_control:"mdi:gesture-swipe-horizontal",tilt_position_control:"mdi:rotate-right"};Ns({type:Hl,name:"Mushroom Cover Card",description:"Card for cover entity"});let oc=class extends Ls{static async getConfigElement(){return await Promise.resolve().then((function(){return xf})),document.createElement(Yl)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Wl.includes(t.split(".")[0])));return{type:`custom:${Hl}`,entity:e[0]}}get hasControls(){return this._controls.length>0}get _nextControl(){var t;if(this._activeControl)return null!==(t=this._controls[this._controls.indexOf(this._activeControl)+1])&&void 0!==t?t:this._controls[0]}_onNextControlTap(t){t.stopPropagation(),this._activeControl=this._nextControl}getCardSize(){return 1}setConfig(t){super.setConfig(Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)),this.updateActiveControl(),this.updatePosition()}get _controls(){if(!this._config||!this._stateObj)return[];const t=[];return this._config.show_buttons_control&&t.push("buttons_control"),this._config.show_position_control&&t.push("position_control"),this._config.show_tilt_position_control&&t.push("tilt_position_control"),t}updateActiveControl(){const t=!!this._activeControl&&this._controls.includes(this._activeControl);this._activeControl=t?this._activeControl:this._controls[0]}updated(t){super.updated(t),this.hass&&t.has("hass")&&(this.updatePosition(),this.updateActiveControl())}updatePosition(){this.position=void 0;const t=this._stateObj;t&&(this.position=Zl(t))}onCurrentPositionChange(t){null!=t.detail.value&&(this.position=t.detail.value)}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this.hass||!this._config||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=Es(this._config),n=as(t,o.icon_type);let r=this.hass.formatEntityState?this.hass.formatEntityState(t):ne(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities);this.position&&(r+=` - ${this.position}${oe(this.hass.locale)}%`);const a=Ie(this.hass);return Y`
+ `}};n([_t({attribute:!1})],ic.prototype,"hass",void 0),n([_t({attribute:!1})],ic.prototype,"entity",void 0),ic=n([pt("mushroom-cover-tilt-position-control")],ic);const oc={buttons_control:"mdi:gesture-tap-button",position_control:"mdi:gesture-swipe-horizontal",tilt_position_control:"mdi:rotate-right"};Rs({type:Yl,name:"Mushroom Cover Card",description:"Card for cover entity"});let nc=class extends Ps{static async getConfigElement(){return await Promise.resolve().then((function(){return wf})),document.createElement(Wl)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Xl.includes(t.split(".")[0])));return{type:`custom:${Yl}`,entity:e[0]}}get hasControls(){return this._controls.length>0}get _nextControl(){var t;if(this._activeControl)return null!==(t=this._controls[this._controls.indexOf(this._activeControl)+1])&&void 0!==t?t:this._controls[0]}_onNextControlTap(t){t.stopPropagation(),this._activeControl=this._nextControl}getCardSize(){return 1}setConfig(t){super.setConfig(Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)),this.updateActiveControl(),this.updatePosition()}get _controls(){if(!this._config||!this._stateObj)return[];const t=[];return this._config.show_buttons_control&&t.push("buttons_control"),this._config.show_position_control&&t.push("position_control"),this._config.show_tilt_position_control&&t.push("tilt_position_control"),t}updateActiveControl(){const t=!!this._activeControl&&this._controls.includes(this._activeControl);this._activeControl=t?this._activeControl:this._controls[0]}updated(t){super.updated(t),this.hass&&t.has("hass")&&(this.updatePosition(),this.updateActiveControl())}updatePosition(){this.position=void 0;const t=this._stateObj;t&&(this.position=Jl(t))}onCurrentPositionChange(t){null!=t.detail.value&&(this.position=t.detail.value)}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this.hass||!this._config||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=As(this._config),n=ss(t,o.icon_type);let r=this.hass.formatEntityState?this.hass.formatEntityState(t):ne(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities);this.position&&(r+=` - ${this.position}${oe(this.hass.locale)}%`);const a=Ie(this.hass);return Y`
- `}renderIcon(t,e){const i={},o=Ut(t),n=Jl(t);return i["--icon-color"]=`rgb(${n})`,i["--shape-color"]=`rgba(${n}, 0.2)`,Y`
+ `}renderIcon(t,e){const i={},o=Ut(t),n=Ql(t);return i["--icon-color"]=`rgb(${n})`,i["--shape-color"]=`rgba(${n}, 0.2)`,Y`
`}renderNextControlButton(){return this._nextControl&&this._nextControl!=this._activeControl?Y`
-
+
`:K}renderActiveControl(t,e){switch(this._activeControl){case"buttons_control":return Y`
- `;case"position_control":{const e=Jl(t),i={};return i["--slider-color"]=`rgb(${e})`,i["--slider-bg-color"]=`rgba(${e}, 0.2)`,Y`
+ `;case"position_control":{const e=Ql(t),i={};return i["--slider-color"]=`rgb(${e})`,i["--slider-bg-color"]=`rgba(${e}, 0.2)`,Y`
- `}case"tilt_position_control":{const e=Jl(t),i={};return i["--slider-color"]=`rgb(${e})`,i["--slider-bg-color"]=`rgba(${e}, 0.2)`,Y`
+ `}case"tilt_position_control":{const e=Ql(t),i={};return i["--slider-color"]=`rgb(${e})`,i["--slider-bg-color"]=`rgba(${e}, 0.2)`,Y`
- `}default:return K}}static get styles(){return[super.styles,Ps,h`
+ `}default:return K}}static get styles(){return[super.styles,Ns,h`
mushroom-state-item {
cursor: pointer;
}
@@ -2333,9 +2341,9 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
mushroom-cover-tilt-position-control {
flex: 1;
}
- `]}};n([vt()],oc.prototype,"_activeControl",void 0),n([vt()],oc.prototype,"position",void 0),oc=n([pt(Hl)],oc);const nc=`${Rs}-entity-card`,rc=`${nc}-editor`;Ns({type:nc,name:"Mushroom Entity Card",description:"Card for all entities"});let ac=class extends Ls{static async getConfigElement(){return await Promise.resolve().then((function(){return $f})),document.createElement(rc)}static async getStubConfig(t){const e=Object.keys(t.states);return{type:`custom:${nc}`,entity:e[0]}}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=Es(this._config),n=as(t,o.icon_type),r=Ie(this.hass);return Y`
+ `]}};n([vt()],nc.prototype,"_activeControl",void 0),n([vt()],nc.prototype,"position",void 0),nc=n([pt(Yl)],nc);const rc=`${Fs}-entity-card`,ac=`${rc}-editor`;Rs({type:rc,name:"Mushroom Entity Card",description:"Card for all entities"});let sc=class extends Ps{static async getConfigElement(){return await Promise.resolve().then((function(){return Ef})),document.createElement(ac)}static async getStubConfig(t){const e=Object.keys(t.states);return{type:`custom:${rc}`,entity:e[0]}}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=As(this._config),n=ss(t,o.icon_type),r=Ie(this.hass);return Y`
- `}renderIcon(t,e){var i;const o=Bt(t),n={},r=null===(i=this._config)||void 0===i?void 0:i.icon_color;if(r){const t=Za(r);n["--icon-color"]=`rgb(${t})`,n["--shape-color"]=`rgba(${t}, 0.2)`}return Y`
+ `}renderIcon(t,e){var i;const o=Bt(t),n={},r=null===(i=this._config)||void 0===i?void 0:i.icon_color;if(r){const t=Ja(r);n["--icon-color"]=`rgb(${t})`,n["--shape-color"]=`rgba(${t}, 0.2)`}return Y`
- `}static get styles(){return[super.styles,Ps,h`
+ `}static get styles(){return[super.styles,Ns,h`
mushroom-state-item {
cursor: pointer;
}
@@ -2370,9 +2378,9 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
--icon-color: rgb(var(--rgb-state-entity));
--shape-color: rgba(var(--rgb-state-entity), 0.2);
}
- `]}};ac=n([pt(nc)],ac);const sc=`${Rs}-fan-card`,lc=`${sc}-editor`,cc=["fan"];function dc(t){return null!=t.attributes.percentage?Math.round(t.attributes.percentage):void 0}function uc(t){return null!=t.attributes.oscillating&&Boolean(t.attributes.oscillating)}let hc=class extends ht{_onTap(t){t.stopPropagation();const e=uc(this.entity);this.hass.callService("fan","oscillate",{entity_id:this.entity.entity_id,oscillating:!e})}render(){const t=uc(this.entity),e=Bt(this.entity);return Y`
+ `]}};sc=n([pt(rc)],sc);const lc=`${Fs}-fan-card`,cc=`${lc}-editor`,dc=["fan"];function uc(t){return null!=t.attributes.percentage?Math.round(t.attributes.percentage):void 0}function hc(t){return null!=t.attributes.oscillating&&Boolean(t.attributes.oscillating)}let mc=class extends ht{_onTap(t){t.stopPropagation();const e=hc(this.entity);this.hass.callService("fan","oscillate",{entity_id:this.entity.entity_id,oscillating:!e})}render(){const t=hc(this.entity),e=Bt(this.entity);return Y`
@@ -2388,7 +2396,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
--icon-color: rgb(var(--rgb-state-fan));
--bg-color: rgba(var(--rgb-state-fan), 0.2);
}
- `}};n([_t({attribute:!1})],hc.prototype,"hass",void 0),n([_t({attribute:!1})],hc.prototype,"entity",void 0),hc=n([pt("mushroom-fan-oscillate-control")],hc);let mc=class extends ht{onChange(t){const e=t.detail.value;this.hass.callService("fan","set_percentage",{entity_id:this.entity.entity_id,percentage:e})}onCurrentChange(t){const e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}render(){const t=dc(this.entity);return Y`
+ `}};n([_t({attribute:!1})],mc.prototype,"hass",void 0),n([_t({attribute:!1})],mc.prototype,"entity",void 0),mc=n([pt("mushroom-fan-oscillate-control")],mc);let pc=class extends ht{onChange(t){const e=t.detail.value;this.hass.callService("fan","set_percentage",{entity_id:this.entity.entity_id,percentage:e})}onCurrentChange(t){const e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}render(){const t=uc(this.entity);return Y`
cc.includes(t.split(".")[0])));return{type:`custom:${sc}`,entity:e[0]}}get hasControls(){var t,e;return Boolean(null===(t=this._config)||void 0===t?void 0:t.show_percentage_control)||Boolean(null===(e=this._config)||void 0===e?void 0:e.show_oscillate_control)}setConfig(t){super.setConfig(Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)),this.updatePercentage()}updated(t){super.updated(t),this.hass&&t.has("hass")&&this.updatePercentage()}updatePercentage(){this.percentage=void 0;const t=this._stateObj;this._config&&this.hass&&t&&(this.percentage=dc(t))}onCurrentPercentageChange(t){null!=t.detail.value&&(this.percentage=Math.round(t.detail.value))}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=Es(this._config),n=as(t,o.icon_type);let r=this.hass.formatEntityState?this.hass.formatEntityState(t):ne(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities);null!=this.percentage&&"on"===t.state&&(r=`${this.percentage}${oe(this.hass.locale)}%`);const a=Ie(this.hass),s=(!this._config.collapsible_controls||Bt(t))&&(this._config.show_percentage_control||this._config.show_oscillate_control);return Y`
+ `}};n([_t({attribute:!1})],pc.prototype,"hass",void 0),n([_t({attribute:!1})],pc.prototype,"entity",void 0),pc=n([pt("mushroom-fan-percentage-control")],pc),Rs({type:lc,name:"Mushroom Fan Card",description:"Card for fan entity"});let fc=class extends Ps{static async getConfigElement(){return await Promise.resolve().then((function(){return zf})),document.createElement(cc)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>dc.includes(t.split(".")[0])));return{type:`custom:${lc}`,entity:e[0]}}get hasControls(){var t,e;return Boolean(null===(t=this._config)||void 0===t?void 0:t.show_percentage_control)||Boolean(null===(e=this._config)||void 0===e?void 0:e.show_oscillate_control)}setConfig(t){super.setConfig(Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)),this.updatePercentage()}updated(t){super.updated(t),this.hass&&t.has("hass")&&this.updatePercentage()}updatePercentage(){this.percentage=void 0;const t=this._stateObj;this._config&&this.hass&&t&&(this.percentage=uc(t))}onCurrentPercentageChange(t){null!=t.detail.value&&(this.percentage=Math.round(t.detail.value))}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=As(this._config),n=ss(t,o.icon_type);let r=this.hass.formatEntityState?this.hass.formatEntityState(t):ne(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities);null!=this.percentage&&"on"===t.state&&(r=`${this.percentage}${oe(this.hass.locale)}%`);const a=Ie(this.hass),s=(!this._config.collapsible_controls||Bt(t))&&(this._config.show_percentage_control||this._config.show_oscillate_control);return Y`
- `}renderIcon(t,e){var i;let o={};const n=dc(t),r=Bt(t);if(r)if(n){const t=1.5*(n/100)**.5;o["--animation-duration"]=1/t+"s"}else o["--animation-duration"]="1s";return Y`
+ `}renderIcon(t,e){var i;let o={};const n=uc(t),r=Bt(t);if(r)if(n){const t=1.5*(n/100)**.5;o["--animation-duration"]=1/t+"s"}else o["--animation-duration"]="1s";return Y`
- `}static get styles(){return[super.styles,Ps,h`
+ `}static get styles(){return[super.styles,Ns,h`
mushroom-state-item {
cursor: pointer;
}
@@ -2464,7 +2472,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
mushroom-fan-percentage-control {
flex: 1;
}
- `]}};n([vt()],pc.prototype,"percentage",void 0),pc=n([pt(sc)],pc);const fc=`${Rs}-humidifier-card`,gc=`${fc}-editor`,_c=["humidifier"];let vc=class extends ht{onChange(t){const e=t.detail.value;this.hass.callService("humidifier","set_humidity",{entity_id:this.entity.entity_id,humidity:e})}onCurrentChange(t){const e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}render(){const t=this.entity.attributes.max_humidity||100,e=this.entity.attributes.min_humidity||0;return Y`_c.includes(t.split(".")[0])));return{type:`custom:${fc}`,entity:e[0]}}get hasControls(){var t;return Boolean(null===(t=this._config)||void 0===t?void 0:t.show_target_humidity_control)}setConfig(t){super.setConfig(Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t))}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}onCurrentHumidityChange(t){null!=t.detail.value&&(this.humidity=t.detail.value)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=Es(this._config),n=as(t,o.icon_type);let r=this.hass.formatEntityState?this.hass.formatEntityState(t):ne(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities);this.humidity&&(r=`${this.humidity}${oe(this.hass.locale)}%`);const a=Ie(this.hass),s=(!this._config.collapsible_controls||Bt(t))&&this._config.show_target_humidity_control;return Y`
+ `}};n([_t({attribute:!1})],bc.prototype,"hass",void 0),n([_t({attribute:!1})],bc.prototype,"entity",void 0),n([_t({attribute:!1})],bc.prototype,"color",void 0),bc=n([pt("mushroom-humidifier-humidity-control")],bc),Rs({type:gc,name:"Mushroom Humidifier Card",description:"Card for humidifier entity"});let yc=class extends Ps{static async getConfigElement(){return await Promise.resolve().then((function(){return Lf})),document.createElement(_c)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>vc.includes(t.split(".")[0])));return{type:`custom:${gc}`,entity:e[0]}}get hasControls(){var t;return Boolean(null===(t=this._config)||void 0===t?void 0:t.show_target_humidity_control)}setConfig(t){super.setConfig(Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t))}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}onCurrentHumidityChange(t){null!=t.detail.value&&(this.humidity=t.detail.value)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=As(this._config),n=ss(t,o.icon_type);let r=this.hass.formatEntityState?this.hass.formatEntityState(t):ne(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities);this.humidity&&(r=`${this.humidity}${oe(this.hass.locale)}%`);const a=Ie(this.hass),s=(!this._config.collapsible_controls||Bt(t))&&this._config.show_target_humidity_control;return Y`
- `}static get styles(){return[super.styles,Ps,h`
+ `}static get styles(){return[super.styles,Ns,h`
mushroom-state-item {
cursor: pointer;
}
@@ -2515,7 +2523,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
mushroom-humidifier-humidity-control {
flex: 1;
}
- `]}};n([vt()],bc.prototype,"humidity",void 0),bc=n([pt(fc)],bc);const yc=`${Rs}-number-card`,xc=`${yc}-editor`,wc=["number","input_number"];let kc=class extends ht{onChange(t){const e=t.detail.value,i=this.entity.entity_id.split(".")[0];this.hass.callService(i,"set_value",{entity_id:this.entity.entity_id,value:e})}onCurrentChange(t){const e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}render(){var t;const e=Number(this.entity.state),i=null!==(t=ee(this.entity,this.hass.entities[this.entity.entity_id]))&&void 0!==t?t:ie(this.entity.state);return"buttons"===this.displayMode?Y`
+ `]}};n([vt()],yc.prototype,"humidity",void 0),yc=n([pt(gc)],yc);const xc=`${Fs}-number-card`,wc=`${xc}-editor`,kc=["number","input_number"];let Cc=class extends ht{onChange(t){const e=t.detail.value,i=this.entity.entity_id.split(".")[0];this.hass.callService(i,"set_value",{entity_id:this.entity.entity_id,value:e})}onCurrentChange(t){const e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}render(){var t;const e=Number(this.entity.state),i=null!==(t=ee(this.entity,this.hass.entities[this.entity.entity_id]))&&void 0!==t?t:ie(this.entity.state);return"buttons"===this.displayMode?Y`
wc.includes(t.split(".")[0])));return{type:`custom:${yc}`,entity:e[0]}}get hasControls(){return!0}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}onCurrentValueChange(t){null!=t.detail.value&&(this.value=t.detail.value)}updated(t){super.updated(t),this.hass&&t.has("hass")&&this.updateValue()}updateValue(){this.value=void 0;const t=this._stateObj;t&&!Number.isNaN(t.state)&&(this.value=Number(t.state))}render(){var t,e,i;if(!this._config||!this.hass||!this._config.entity)return K;const o=this._stateObj;if(!o)return this.renderNotFound(this._config);const n=this._config.name||o.attributes.friendly_name||"",r=this._config.icon,a=Es(this._config),s=as(o,a.icon_type);let l=this.hass.formatEntityState?this.hass.formatEntityState(o):ne(this.hass.localize,o,this.hass.locale,this.hass.config,this.hass.entities);if(void 0!==this.value){l=`${te(this.value,this.hass.locale,null!==(t=ee(o,this.hass.entities[o.entity_id]))&&void 0!==t?t:ie(o.state))} ${null!==(e=o.attributes.unit_of_measurement)&&void 0!==e?e:""}`}const c=Ie(this.hass),d={},u=null===(i=this._config)||void 0===i?void 0:i.icon_color;if(u){const t=Za(u);d["--slider-color"]=`rgb(${t})`,d["--slider-bg-color"]=`rgba(${t}, 0.2)`}return Y`
+ `}};n([_t({attribute:!1})],Cc.prototype,"hass",void 0),n([_t({attribute:!1})],Cc.prototype,"entity",void 0),n([_t({attribute:!1})],Cc.prototype,"displayMode",void 0),Cc=n([pt("mushroom-number-value-control")],Cc),Rs({type:xc,name:"Mushroom Number Card",description:"Card for number and input number entity"});let $c=class extends Ps{static async getConfigElement(){return await Promise.resolve().then((function(){return Bf})),document.createElement(wc)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>kc.includes(t.split(".")[0])));return{type:`custom:${xc}`,entity:e[0]}}get hasControls(){return!0}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}onCurrentValueChange(t){null!=t.detail.value&&(this.value=t.detail.value)}updated(t){super.updated(t),this.hass&&t.has("hass")&&this.updateValue()}updateValue(){this.value=void 0;const t=this._stateObj;t&&!Number.isNaN(t.state)&&(this.value=Number(t.state))}render(){var t,e,i;if(!this._config||!this.hass||!this._config.entity)return K;const o=this._stateObj;if(!o)return this.renderNotFound(this._config);const n=this._config.name||o.attributes.friendly_name||"",r=this._config.icon,a=As(this._config),s=ss(o,a.icon_type);let l=this.hass.formatEntityState?this.hass.formatEntityState(o):ne(this.hass.localize,o,this.hass.locale,this.hass.config,this.hass.entities);if(void 0!==this.value){l=`${te(this.value,this.hass.locale,null!==(t=ee(o,this.hass.entities[o.entity_id]))&&void 0!==t?t:ie(o.state))} ${null!==(e=o.attributes.unit_of_measurement)&&void 0!==e?e:""}`}const c=Ie(this.hass),d={},u=null===(i=this._config)||void 0===i?void 0:i.icon_color;if(u){const t=Ja(u);d["--slider-color"]=`rgb(${t})`,d["--slider-bg-color"]=`rgba(${t}, 0.2)`}return Y`
- `}renderIcon(t,e){var i;const o=Bt(t),n={},r=null===(i=this._config)||void 0===i?void 0:i.icon_color;if(r){const t=Za(r);n["--icon-color"]=`rgb(${t})`,n["--shape-color"]=`rgba(${t}, 0.2)`}return Y`
+ `}renderIcon(t,e){var i;const o=Bt(t),n={},r=null===(i=this._config)||void 0===i?void 0:i.icon_color;if(r){const t=Ja(r);n["--icon-color"]=`rgb(${t})`,n["--shape-color"]=`rgba(${t}, 0.2)`}return Y`
- `}static get styles(){return[super.styles,Ps,h`
+ `}static get styles(){return[super.styles,Ns,h`
mushroom-state-item {
cursor: pointer;
}
@@ -2598,7 +2606,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
mushroom-number-value-control {
flex: 1;
}
- `]}};n([vt()],Cc.prototype,"value",void 0),Cc=n([pt(yc)],Cc);const $c=`${Rs}-light-card`,Ec=`${$c}-editor`,Ac=["light"];let Sc=class extends ht{onChange(t){const e=t.detail.value;this.hass.callService("light","turn_on",{entity_id:this.entity.entity_id,brightness_pct:e})}onCurrentChange(t){const e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}render(){const t=bl(this.entity);return Y`
+ `]}};n([vt()],$c.prototype,"value",void 0),$c=n([pt(xc)],$c);const Ec=`${Fs}-light-card`,Ac=`${Ec}-editor`,Sc=["light"];let Ic=class extends ht{onChange(t){const e=t.detail.value;this.hass.callService("light","turn_on",{entity_id:this.entity.entity_id,brightness_pct:e})}onCurrentChange(t){const e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}render(){const t=yl(this.entity);return Y`
- `}static get styles(){const t=Ic.map((([t,e])=>`${e} ${100*t}%`)).join(", ");return h`
+ `}static get styles(){const t=Tc.map((([t,e])=>`${e} ${100*t}%`)).join(", ");return h`
mushroom-slider {
--gradient: -webkit-linear-gradient(left, ${u(t)});
}
- `}};n([_t({attribute:!1})],Tc.prototype,"hass",void 0),n([_t({attribute:!1})],Tc.prototype,"entity",void 0),Tc=n([pt("mushroom-light-color-control")],Tc);let zc=class extends ht{onChange(t){const e=t.detail.value;this.hass.callService("light","turn_on",{entity_id:this.entity.entity_id,color_temp:e})}render(){var t,e;const i=null!=(o=this.entity).attributes.color_temp?Math.round(o.attributes.color_temp):void 0;var o;return Y`
+ `}};n([_t({attribute:!1})],zc.prototype,"hass",void 0),n([_t({attribute:!1})],zc.prototype,"entity",void 0),zc=n([pt("mushroom-light-color-control")],zc);let Oc=class extends ht{onChange(t){const e=t.detail.value;this.hass.callService("light","turn_on",{entity_id:this.entity.entity_id,color_temp:e})}render(){var t,e;const i=null!=(o=this.entity).attributes.color_temp?Math.round(o.attributes.color_temp):void 0;var o;return Y`
Ac.includes(t.split(".")[0])));return{type:`custom:${$c}`,entity:e[0]}}get _controls(){if(!this._config||!this._stateObj)return[];const t=this._stateObj,e=[];return this._config.show_brightness_control&&Cl(t)&&e.push("brightness_control"),this._config.show_color_temp_control&&function(t){var e,i;return null!==(i=null===(e=t.attributes.supported_color_modes)||void 0===e?void 0:e.some((t=>["color_temp"].includes(t))))&&void 0!==i&&i}(t)&&e.push("color_temp_control"),this._config.show_color_control&&kl(t)&&e.push("color_control"),e}get hasControls(){return this._controls.length>0}setConfig(t){super.setConfig(Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)),this.updateActiveControl(),this.updateBrightness()}_onControlTap(t,e){e.stopPropagation(),this._activeControl=t}updated(t){super.updated(t),this.hass&&t.has("hass")&&(this.updateActiveControl(),this.updateBrightness())}updateBrightness(){this.brightness=void 0;const t=this._stateObj;t&&(this.brightness=bl(t))}onCurrentBrightnessChange(t){null!=t.detail.value&&(this.brightness=t.detail.value)}updateActiveControl(){const t=!!this._activeControl&&this._controls.includes(this._activeControl);this._activeControl=t?this._activeControl:this._controls[0]}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=Es(this._config),n=as(t,o.icon_type);let r=this.hass.formatEntityState?this.hass.formatEntityState(t):ne(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities);null!=this.brightness&&(r=`${this.brightness}${oe(this.hass.locale)}%`);const a=Ie(this.hass),s=(!this._config.collapsible_controls||Bt(t))&&this._controls.length;return Y`
+ `}};n([_t({attribute:!1})],Oc.prototype,"hass",void 0),n([_t({attribute:!1})],Oc.prototype,"entity",void 0),Oc=n([pt("mushroom-light-color-temp-control")],Oc);const Mc={brightness_control:"mdi:brightness-4",color_temp_control:"mdi:thermometer",color_control:"mdi:palette"};Rs({type:Ec,name:"Mushroom Light Card",description:"Card for light entity"});let jc=class extends Ps{static async getConfigElement(){return await Promise.resolve().then((function(){return Np})),document.createElement(Ac)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Sc.includes(t.split(".")[0])));return{type:`custom:${Ec}`,entity:e[0]}}get _controls(){if(!this._config||!this._stateObj)return[];const t=this._stateObj,e=[];return this._config.show_brightness_control&&$l(t)&&e.push("brightness_control"),this._config.show_color_temp_control&&function(t){var e,i;return null!==(i=null===(e=t.attributes.supported_color_modes)||void 0===e?void 0:e.some((t=>["color_temp"].includes(t))))&&void 0!==i&&i}(t)&&e.push("color_temp_control"),this._config.show_color_control&&Cl(t)&&e.push("color_control"),e}get hasControls(){return this._controls.length>0}setConfig(t){super.setConfig(Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)),this.updateActiveControl(),this.updateBrightness()}_onControlTap(t,e){e.stopPropagation(),this._activeControl=t}updated(t){super.updated(t),this.hass&&t.has("hass")&&(this.updateActiveControl(),this.updateBrightness())}updateBrightness(){this.brightness=void 0;const t=this._stateObj;t&&(this.brightness=yl(t))}onCurrentBrightnessChange(t){null!=t.detail.value&&(this.brightness=t.detail.value)}updateActiveControl(){const t=!!this._activeControl&&this._controls.includes(this._activeControl);this._activeControl=t?this._activeControl:this._controls[0]}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=As(this._config),n=ss(t,o.icon_type);let r=this.hass.formatEntityState?this.hass.formatEntityState(t):ne(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities);null!=this.brightness&&(r=`${this.brightness}${oe(this.hass.locale)}%`);const a=Ie(this.hass),s=(!this._config.collapsible_controls||Bt(t))&&this._controls.length;return Y`
- `}renderIcon(t,e){var i,o;const n=yl(t),r=Bt(t),a={},s=null===(i=this._config)||void 0===i?void 0:i.icon_color;if(n&&(null===(o=this._config)||void 0===o?void 0:o.use_light_color)){const t=n.join(",");a["--icon-color"]=`rgb(${t})`,a["--shape-color"]=`rgba(${t}, 0.25)`,xl(n)&&!this.hass.themes.darkMode&&(a["--shape-outline-color"]="rgba(var(--rgb-primary-text-color), 0.05)",wl(n)&&(a["--icon-color"]="rgba(var(--rgb-primary-text-color), 0.2)"))}else if(s){const t=Za(s);a["--icon-color"]=`rgb(${t})`,a["--shape-color"]=`rgba(${t}, 0.2)`}return Y`
+ `}renderIcon(t,e){var i,o;const n=xl(t),r=Bt(t),a={},s=null===(i=this._config)||void 0===i?void 0:i.icon_color;if(n&&(null===(o=this._config)||void 0===o?void 0:o.use_light_color)){const t=n.join(",");a["--icon-color"]=`rgb(${t})`,a["--shape-color"]=`rgba(${t}, 0.25)`,wl(n)&&!this.hass.themes.darkMode&&(a["--shape-outline-color"]="rgba(var(--rgb-primary-text-color), 0.05)",kl(n)&&(a["--icon-color"]="rgba(var(--rgb-primary-text-color), 0.2)"))}else if(s){const t=Ja(s);a["--icon-color"]=`rgb(${t})`,a["--shape-color"]=`rgba(${t}, 0.2)`}return Y`
t!=this._activeControl));return Y`
${t.map((t=>Y`
this._onControlTap(t,e)}>
-
+
`))}
- `}renderActiveControl(t){var e,i;switch(this._activeControl){case"brightness_control":const o=yl(t),n={},r=null===(e=this._config)||void 0===e?void 0:e.icon_color;if(o&&(null===(i=this._config)||void 0===i?void 0:i.use_light_color)){const t=o.join(",");n["--slider-color"]=`rgb(${t})`,n["--slider-bg-color"]=`rgba(${t}, 0.2)`,xl(o)&&!this.hass.themes.darkMode&&(n["--slider-bg-color"]="rgba(var(--rgb-primary-text-color), 0.05)",n["--slider-color"]="rgba(var(--rgb-primary-text-color), 0.15)")}else if(r){const t=Za(r);n["--slider-color"]=`rgb(${t})`,n["--slider-bg-color"]=`rgba(${t}, 0.2)`}return Y`
+ `}renderActiveControl(t){var e,i;switch(this._activeControl){case"brightness_control":const o=xl(t),n={},r=null===(e=this._config)||void 0===e?void 0:e.icon_color;if(o&&(null===(i=this._config)||void 0===i?void 0:i.use_light_color)){const t=o.join(",");n["--slider-color"]=`rgb(${t})`,n["--slider-bg-color"]=`rgba(${t}, 0.2)`,wl(o)&&!this.hass.themes.darkMode&&(n["--slider-bg-color"]="rgba(var(--rgb-primary-text-color), 0.05)",n["--slider-color"]="rgba(var(--rgb-primary-text-color), 0.15)")}else if(r){const t=Ja(r);n["--slider-color"]=`rgb(${t})`,n["--slider-bg-color"]=`rgba(${t}, 0.2)`}return Y`
`;case"color_temp_control":return Y`
@@ -2705,7 +2713,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
/>
`;case"color_control":return Y`
- `;default:return K}}static get styles(){return[super.styles,Ps,h`
+ `;default:return K}}static get styles(){return[super.styles,Ns,h`
mushroom-state-item {
cursor: pointer;
}
@@ -2718,9 +2726,9 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
mushroom-light-color-control {
flex: 1;
}
- `]}};n([vt()],Mc.prototype,"_activeControl",void 0),n([vt()],Mc.prototype,"brightness",void 0),Mc=n([pt($c)],Mc);const jc=`${Rs}-lock-card`,Dc=`${jc}-editor`,Lc=["lock"];function Pc(t){return"unlocked"===t.state}function Nc(t){return"locked"===t.state}function Rc(t){switch(t.state){case"locking":case"unlocking":return!0;default:return!1}}const Fc=[{icon:"mdi:lock",title:"lock",serviceName:"lock",isVisible:t=>Pc(t),isDisabled:()=>!1},{icon:"mdi:lock-open",title:"unlock",serviceName:"unlock",isVisible:t=>Nc(t),isDisabled:()=>!1},{icon:"mdi:lock-clock",isVisible:t=>Rc(t),isDisabled:()=>!0},{icon:"mdi:door-open",title:"open",serviceName:"open",isVisible:t=>Wt(t,1)&&Pc(t),isDisabled:t=>Rc(t)}];let Vc=class extends ht{constructor(){super(...arguments),this.fill=!1}callService(t){t.stopPropagation();const e=t.target.entry;this.hass.callService("lock",e.serviceName,{entity_id:this.entity.entity_id})}render(){const t=Ie(this.hass),e=Oo(this.hass);return Y`
+ `]}};n([vt()],jc.prototype,"_activeControl",void 0),n([vt()],jc.prototype,"brightness",void 0),jc=n([pt(Ec)],jc);const Dc=`${Fs}-lock-card`,Lc=`${Dc}-editor`,Pc=["lock"];function Nc(t){return"unlocked"===t.state}function Rc(t){return"locked"===t.state}function Fc(t){switch(t.state){case"locking":case"unlocking":return!0;default:return!1}}const Vc=[{icon:"mdi:lock",title:"lock",serviceName:"lock",isVisible:t=>Nc(t),isDisabled:()=>!1},{icon:"mdi:lock-open",title:"unlock",serviceName:"unlock",isVisible:t=>Rc(t),isDisabled:()=>!1},{icon:"mdi:lock-clock",isVisible:t=>Fc(t),isDisabled:()=>!0},{icon:"mdi:door-open",title:"open",serviceName:"open",isVisible:t=>Wt(t,1)&&Nc(t),isDisabled:t=>Fc(t)}];let Bc=class extends ht{constructor(){super(...arguments),this.fill=!1}callService(t){t.stopPropagation();const e=t.target.entry;this.hass.callService("lock",e.serviceName,{entity_id:this.entity.entity_id})}render(){const t=Ie(this.hass),e=Mo(this.hass);return Y`
${Fc.filter((t=>t.isVisible(this.entity))).map((t=>Y`
+ >${Vc.filter((t=>t.isVisible(this.entity))).map((t=>Y`
`))}
- `}};n([_t({attribute:!1})],Vc.prototype,"hass",void 0),n([_t({attribute:!1})],Vc.prototype,"entity",void 0),n([_t({type:Boolean})],Vc.prototype,"fill",void 0),Vc=n([pt("mushroom-lock-buttons-control")],Vc),Ns({type:jc,name:"Mushroom Lock Card",description:"Card for all lock entities"});let Bc=class extends Ls{static async getConfigElement(){return await Promise.resolve().then((function(){return Yf})),document.createElement(Dc)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Lc.includes(t.split(".")[0])));return{type:`custom:${jc}`,entity:e[0]}}get hasControls(){return!0}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=Es(this._config),n=as(t,o.icon_type),r=Ie(this.hass);return Y`
+ `}};n([_t({attribute:!1})],Bc.prototype,"hass",void 0),n([_t({attribute:!1})],Bc.prototype,"entity",void 0),n([_t({type:Boolean})],Bc.prototype,"fill",void 0),Bc=n([pt("mushroom-lock-buttons-control")],Bc),Rs({type:Dc,name:"Mushroom Lock Card",description:"Card for all lock entities"});let Uc=class extends Ps{static async getConfigElement(){return await Promise.resolve().then((function(){return Wf})),document.createElement(Lc)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Pc.includes(t.split(".")[0])));return{type:`custom:${Dc}`,entity:e[0]}}get hasControls(){return!0}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=As(this._config),n=ss(t,o.icon_type),r=Ie(this.hass);return Y`
- `}renderIcon(t,e){const i=Ut(t),o={"--icon-color":"rgb(var(--rgb-state-lock))","--shape-color":"rgba(var(--rgb-state-lock), 0.2)"};return Nc(t)?(o["--icon-color"]="rgb(var(--rgb-state-lock-locked))",o["--shape-color"]="rgba(var(--rgb-state-lock-locked), 0.2)"):Pc(t)?(o["--icon-color"]="rgb(var(--rgb-state-lock-unlocked))",o["--shape-color"]="rgba(var(--rgb-state-lock-unlocked), 0.2)"):Rc(t)&&(o["--icon-color"]="rgb(var(--rgb-state-lock-pending))",o["--shape-color"]="rgba(var(--rgb-state-lock-pending), 0.2)"),Y`
+ `}renderIcon(t,e){const i=Ut(t),o={"--icon-color":"rgb(var(--rgb-state-lock))","--shape-color":"rgba(var(--rgb-state-lock), 0.2)"};return Rc(t)?(o["--icon-color"]="rgb(var(--rgb-state-lock-locked))",o["--shape-color"]="rgba(var(--rgb-state-lock-locked), 0.2)"):Nc(t)?(o["--icon-color"]="rgb(var(--rgb-state-lock-unlocked))",o["--shape-color"]="rgba(var(--rgb-state-lock-unlocked), 0.2)"):Fc(t)&&(o["--icon-color"]="rgb(var(--rgb-state-lock-pending))",o["--shape-color"]="rgba(var(--rgb-state-lock-pending), 0.2)"),Y`
- `}static get styles(){return[super.styles,Ps,h`
+ `}static get styles(){return[super.styles,Ns,h`
mushroom-state-item {
cursor: pointer;
}
mushroom-lock-buttons-control {
flex: 1;
}
- `]}};Bc=n([pt(jc)],Bc);const Uc=`${Rs}-media-player-card`,Hc=`${Uc}-editor`,Yc=["media_player"];function Wc(t){return null!=t.attributes.volume_level?100*t.attributes.volume_level:void 0}const Xc=(t,e)=>{if(!t)return[];const i=t.state;if("off"===i)return Wt(t,128)&&e.includes("on_off")?[{icon:"mdi:power",action:"turn_on"}]:[];const o=[];Wt(t,256)&&e.includes("on_off")&&o.push({icon:"mdi:power",action:"turn_off"});const n=!0===t.attributes.assumed_state,r=t.attributes;return("playing"===i||"paused"===i||n)&&Wt(t,32768)&&e.includes("shuffle")&&o.push({icon:!0===r.shuffle?"mdi:shuffle":"mdi:shuffle-disabled",action:"shuffle_set"}),("playing"===i||"paused"===i||n)&&Wt(t,16)&&e.includes("previous")&&o.push({icon:"mdi:skip-previous",action:"media_previous_track"}),!n&&("playing"===i&&(Wt(t,1)||Wt(t,4096))||("paused"===i||"idle"===i)&&Wt(t,Pe)||"on"===i&&(Wt(t,Pe)||Wt(t,1)))&&e.includes("play_pause_stop")&&o.push({icon:"on"===i?"mdi:play-pause":"playing"!==i?"mdi:play":Wt(t,1)?"mdi:pause":"mdi:stop",action:"playing"!==i?"media_play":Wt(t,1)?"media_pause":"media_stop"}),n&&Wt(t,Pe)&&e.includes("play_pause_stop")&&o.push({icon:"mdi:play",action:"media_play"}),n&&Wt(t,1)&&e.includes("play_pause_stop")&&o.push({icon:"mdi:pause",action:"media_pause"}),n&&Wt(t,4096)&&e.includes("play_pause_stop")&&o.push({icon:"mdi:stop",action:"media_stop"}),("playing"===i||"paused"===i||n)&&Wt(t,32)&&e.includes("next")&&o.push({icon:"mdi:skip-next",action:"media_next_track"}),("playing"===i||"paused"===i||n)&&Wt(t,262144)&&e.includes("repeat")&&o.push({icon:"all"===r.repeat?"mdi:repeat":"one"===r.repeat?"mdi:repeat-once":"mdi:repeat-off",action:"repeat_set"}),o.length>0?o:[]},Kc=(t,e,i)=>{let o={};"shuffle_set"===i?o={shuffle:!e.attributes.shuffle}:"repeat_set"===i?o={repeat:"all"===e.attributes.repeat?"one":"off"===e.attributes.repeat?"all":"off"}:"volume_mute"===i&&(o={is_volume_muted:!e.attributes.is_volume_muted}),t.callService("media_player",i,Object.assign({entity_id:e.entity_id},o))};let Gc=class extends ht{constructor(){super(...arguments),this.fill=!1}_handleClick(t){t.stopPropagation();const e=t.target.action;Kc(this.hass,this.entity,e)}render(){const t=Ie(this.hass),e=Xc(this.entity,this.controls);return Y`
+ `]}};Uc=n([pt(Dc)],Uc);const Hc=`${Fs}-media-player-card`,Yc=`${Hc}-editor`,Wc=["media_player"];function Xc(t){return null!=t.attributes.volume_level?100*t.attributes.volume_level:void 0}const Kc=(t,e)=>{if(!t)return[];const i=t.state;if("off"===i)return Wt(t,128)&&e.includes("on_off")?[{icon:"mdi:power",action:"turn_on"}]:[];const o=[];Wt(t,256)&&e.includes("on_off")&&o.push({icon:"mdi:power",action:"turn_off"});const n=!0===t.attributes.assumed_state,r=t.attributes;return("playing"===i||"paused"===i||n)&&Wt(t,32768)&&e.includes("shuffle")&&o.push({icon:!0===r.shuffle?"mdi:shuffle":"mdi:shuffle-disabled",action:"shuffle_set"}),("playing"===i||"paused"===i||n)&&Wt(t,16)&&e.includes("previous")&&o.push({icon:"mdi:skip-previous",action:"media_previous_track"}),!n&&("playing"===i&&(Wt(t,1)||Wt(t,4096))||("paused"===i||"idle"===i)&&Wt(t,Pe)||"on"===i&&(Wt(t,Pe)||Wt(t,1)))&&e.includes("play_pause_stop")&&o.push({icon:"on"===i?"mdi:play-pause":"playing"!==i?"mdi:play":Wt(t,1)?"mdi:pause":"mdi:stop",action:"playing"!==i?"media_play":Wt(t,1)?"media_pause":"media_stop"}),n&&Wt(t,Pe)&&e.includes("play_pause_stop")&&o.push({icon:"mdi:play",action:"media_play"}),n&&Wt(t,1)&&e.includes("play_pause_stop")&&o.push({icon:"mdi:pause",action:"media_pause"}),n&&Wt(t,4096)&&e.includes("play_pause_stop")&&o.push({icon:"mdi:stop",action:"media_stop"}),("playing"===i||"paused"===i||n)&&Wt(t,32)&&e.includes("next")&&o.push({icon:"mdi:skip-next",action:"media_next_track"}),("playing"===i||"paused"===i||n)&&Wt(t,262144)&&e.includes("repeat")&&o.push({icon:"all"===r.repeat?"mdi:repeat":"one"===r.repeat?"mdi:repeat-once":"mdi:repeat-off",action:"repeat_set"}),o.length>0?o:[]},Gc=(t,e,i)=>{let o={};"shuffle_set"===i?o={shuffle:!e.attributes.shuffle}:"repeat_set"===i?o={repeat:"all"===e.attributes.repeat?"one":"off"===e.attributes.repeat?"all":"off"}:"volume_mute"===i&&(o={is_volume_muted:!e.attributes.is_volume_muted}),t.callService("media_player",i,Object.assign({entity_id:e.entity_id},o))};let qc=class extends ht{constructor(){super(...arguments),this.fill=!1}_handleClick(t){t.stopPropagation();const e=t.target.action;Gc(this.hass,this.entity,e)}render(){const t=Ie(this.hass),e=Kc(this.entity,this.controls);return Y`
${e.map((t=>Y`
`))}
- `}};n([_t({attribute:!1})],Gc.prototype,"hass",void 0),n([_t({attribute:!1})],Gc.prototype,"entity",void 0),n([_t({attribute:!1})],Gc.prototype,"controls",void 0),n([_t({type:Boolean})],Gc.prototype,"fill",void 0),Gc=n([pt("mushroom-media-player-media-control")],Gc);let qc=class extends ht{constructor(){super(...arguments),this.fill=!1}handleSliderChange(t){const e=t.detail.value;this.hass.callService("media_player","volume_set",{entity_id:this.entity.entity_id,volume_level:e/100})}handleSliderCurrentChange(t){let e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}handleClick(t){t.stopPropagation();const e=t.target.action;Kc(this.hass,this.entity,e)}render(){var t,e,i;if(!this.entity)return K;const o=Wc(this.entity),n=Ie(this.hass),r=(null===(t=this.controls)||void 0===t?void 0:t.includes("volume_set"))&&Wt(this.entity,4),a=(null===(e=this.controls)||void 0===e?void 0:e.includes("volume_mute"))&&Wt(this.entity,8),s=(null===(i=this.controls)||void 0===i?void 0:i.includes("volume_buttons"))&&Wt(this.entity,1024);return Y`
+ `}};n([_t({attribute:!1})],qc.prototype,"hass",void 0),n([_t({attribute:!1})],qc.prototype,"entity",void 0),n([_t({attribute:!1})],qc.prototype,"controls",void 0),n([_t({type:Boolean})],qc.prototype,"fill",void 0),qc=n([pt("mushroom-media-player-media-control")],qc);let Zc=class extends ht{constructor(){super(...arguments),this.fill=!1}handleSliderChange(t){const e=t.detail.value;this.hass.callService("media_player","volume_set",{entity_id:this.entity.entity_id,volume_level:e/100})}handleSliderCurrentChange(t){let e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}handleClick(t){t.stopPropagation();const e=t.target.action;Gc(this.hass,this.entity,e)}render(){var t,e,i;if(!this.entity)return K;const o=Xc(this.entity),n=Ie(this.hass),r=(null===(t=this.controls)||void 0===t?void 0:t.includes("volume_set"))&&Wt(this.entity,4),a=(null===(e=this.controls)||void 0===e?void 0:e.includes("volume_mute"))&&Wt(this.entity,8),s=(null===(i=this.controls)||void 0===i?void 0:i.includes("volume_buttons"))&&Wt(this.entity,1024);return Y`
Yc.includes(t.split(".")[0])));return{type:`custom:${Uc}`,entity:e[0]}}get hasControls(){var t,e,i,o;return Boolean(null===(e=null===(t=this._config)||void 0===t?void 0:t.media_controls)||void 0===e?void 0:e.length)||Boolean(null===(o=null===(i=this._config)||void 0===i?void 0:i.volume_controls)||void 0===o?void 0:o.length)}get _controls(){if(!this._config||!this._stateObj)return[];const t=this._stateObj,e=[];return((t,e)=>Xc(t,null!=e?e:[]).length>0)(t,this._config.media_controls)&&e.push("media_control"),((t,e)=>(null==e?void 0:e.includes("volume_buttons"))&&Wt(t,1024)||(null==e?void 0:e.includes("volume_mute"))&&Wt(t,8)||(null==e?void 0:e.includes("volume_set"))&&Wt(t,4))(t,this._config.volume_controls)&&e.push("volume_control"),e}_onControlTap(t,e){e.stopPropagation(),this._activeControl=t}setConfig(t){super.setConfig(t),this.updateActiveControl(),this.updateVolume()}updated(t){super.updated(t),this.hass&&t.has("hass")&&(this.updateActiveControl(),this.updateVolume())}updateVolume(){this.volume=void 0;const t=this._stateObj;if(!t)return;const e=Wc(t);this.volume=null!=e?Math.round(e):e}onCurrentVolumeChange(t){null!=t.detail.value&&(this.volume=t.detail.value)}updateActiveControl(){const t=!!this._activeControl&&this._controls.includes(this._activeControl);this._activeControl=t?this._activeControl:this._controls[0]}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=function(t,e){var i,o=t.icon;if(![Nt,Rt,Ft].includes(e.state)&&t.use_media_info)switch(null===(i=e.attributes.app_name)||void 0===i?void 0:i.toLowerCase()){case"spotify":return"mdi:spotify";case"google podcasts":return"mdi:google-podcast";case"plex":return"mdi:plex";case"soundcloud":return"mdi:soundcloud";case"youtube":return"mdi:youtube";case"oto music":return"mdi:music-circle";case"netflix":return"mdi:netflix";default:return}return o}(this._config,t),i=function(t,e){let i=t.name||e.attributes.friendly_name||"";return![Nt,Rt,Ft].includes(e.state)&&t.use_media_info&&e.attributes.media_title&&(i=e.attributes.media_title),i}(this._config,t),o=function(t,e,i){let o=i.formatEntityState?i.formatEntityState(e):ne(i.localize,e,i.locale,i.config,i.entities);return![Nt,Rt,Ft].includes(e.state)&&t.use_media_info&&(t=>{let e;switch(t.attributes.media_content_type){case"music":case"image":e=t.attributes.media_artist;break;case"playlist":e=t.attributes.media_playlist;break;case"tvshow":e=t.attributes.media_series_title,t.attributes.media_season&&(e+=" S"+t.attributes.media_season,t.attributes.media_episode&&(e+="E"+t.attributes.media_episode));break;default:e=t.attributes.app_name||""}return e})(e)||o}(this._config,t,this.hass),n=Es(this._config),r=as(t,n.icon_type),a=null!=this.volume&&this._config.show_volume_level?`${o} - ${this.volume}${oe(this.hass.locale)}%`:o,s=Ie(this.hass),l=(!this._config.collapsible_controls||Bt(t))&&this._controls.length;return Y`
+ `}};n([_t({attribute:!1})],Zc.prototype,"hass",void 0),n([_t({attribute:!1})],Zc.prototype,"entity",void 0),n([_t({type:Boolean})],Zc.prototype,"fill",void 0),n([_t({attribute:!1})],Zc.prototype,"controls",void 0),Zc=n([pt("mushroom-media-player-volume-control")],Zc);const Jc={media_control:"mdi:play-pause",volume_control:"mdi:volume-high"};Rs({type:Hc,name:"Mushroom Media Card",description:"Card for media player entity"});let Qc=class extends Ps{static async getConfigElement(){return await Promise.resolve().then((function(){return Qf})),document.createElement(Yc)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Wc.includes(t.split(".")[0])));return{type:`custom:${Hc}`,entity:e[0]}}get hasControls(){var t,e,i,o;return Boolean(null===(e=null===(t=this._config)||void 0===t?void 0:t.media_controls)||void 0===e?void 0:e.length)||Boolean(null===(o=null===(i=this._config)||void 0===i?void 0:i.volume_controls)||void 0===o?void 0:o.length)}get _controls(){if(!this._config||!this._stateObj)return[];const t=this._stateObj,e=[];return((t,e)=>Kc(t,null!=e?e:[]).length>0)(t,this._config.media_controls)&&e.push("media_control"),((t,e)=>(null==e?void 0:e.includes("volume_buttons"))&&Wt(t,1024)||(null==e?void 0:e.includes("volume_mute"))&&Wt(t,8)||(null==e?void 0:e.includes("volume_set"))&&Wt(t,4))(t,this._config.volume_controls)&&e.push("volume_control"),e}_onControlTap(t,e){e.stopPropagation(),this._activeControl=t}setConfig(t){super.setConfig(t),this.updateActiveControl(),this.updateVolume()}updated(t){super.updated(t),this.hass&&t.has("hass")&&(this.updateActiveControl(),this.updateVolume())}updateVolume(){this.volume=void 0;const t=this._stateObj;if(!t)return;const e=Xc(t);this.volume=null!=e?Math.round(e):e}onCurrentVolumeChange(t){null!=t.detail.value&&(this.volume=t.detail.value)}updateActiveControl(){const t=!!this._activeControl&&this._controls.includes(this._activeControl);this._activeControl=t?this._activeControl:this._controls[0]}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=function(t,e){var i,o=t.icon;if(![Nt,Rt,Ft].includes(e.state)&&t.use_media_info)switch(null===(i=e.attributes.app_name)||void 0===i?void 0:i.toLowerCase()){case"spotify":return"mdi:spotify";case"google podcasts":return"mdi:google-podcast";case"plex":return"mdi:plex";case"soundcloud":return"mdi:soundcloud";case"youtube":return"mdi:youtube";case"oto music":return"mdi:music-circle";case"netflix":return"mdi:netflix";default:return}return o}(this._config,t),i=function(t,e){let i=t.name||e.attributes.friendly_name||"";return![Nt,Rt,Ft].includes(e.state)&&t.use_media_info&&e.attributes.media_title&&(i=e.attributes.media_title),i}(this._config,t),o=function(t,e,i){let o=i.formatEntityState?i.formatEntityState(e):ne(i.localize,e,i.locale,i.config,i.entities);return![Nt,Rt,Ft].includes(e.state)&&t.use_media_info&&(t=>{let e;switch(t.attributes.media_content_type){case"music":case"image":e=t.attributes.media_artist;break;case"playlist":e=t.attributes.media_playlist;break;case"tvshow":e=t.attributes.media_series_title,t.attributes.media_season&&(e+=" S"+t.attributes.media_season,t.attributes.media_episode&&(e+="E"+t.attributes.media_episode));break;default:e=t.attributes.app_name||""}return e})(e)||o}(this._config,t,this.hass),n=As(this._config),r=ss(t,n.icon_type),a=null!=this.volume&&this._config.show_volume_level?`${o} - ${this.volume}${oe(this.hass.locale)}%`:o,s=Ie(this.hass),l=(!this._config.collapsible_controls||Bt(t))&&this._controls.length;return Y`
t!=this._activeControl));return Y`
${t.map((t=>Y`
this._onControlTap(t,e)}>
-
+
`))}
`}renderActiveControl(t,e){var i,o,n,r;const a=null!==(o=null===(i=this._config)||void 0===i?void 0:i.media_controls)&&void 0!==o?o:[],s=null!==(r=null===(n=this._config)||void 0===n?void 0:n.volume_controls)&&void 0!==r?r:[];switch(this._activeControl){case"media_control":return Y`
@@ -2882,7 +2890,7 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
.fill=${"horizontal"!==e}
@current-change=${this.onCurrentVolumeChange}
/>
- `;default:return K}}static get styles(){return[super.styles,Ps,h`
+ `;default:return K}}static get styles(){return[super.styles,Ns,h`
mushroom-state-item {
cursor: pointer;
}
@@ -2894,9 +2902,9 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
mushroom-media-player-volume-control {
flex: 1;
}
- `]}};n([vt()],Jc.prototype,"_activeControl",void 0),n([vt()],Jc.prototype,"volume",void 0),Jc=n([pt(Uc)],Jc);const Qc=`${Rs}-person-card`,td=`${Qc}-editor`,ed=["person","device_tracker"];Ns({type:Qc,name:"Mushroom Person Card",description:"Card for person entity"});let id=class extends Ls{static async getConfigElement(){return await Promise.resolve().then((function(){return og})),document.createElement(td)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>ed.includes(t.split(".")[0])));return{type:`custom:${Qc}`,entity:e[0]}}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=Es(this._config),n=as(t,o.icon_type),r=Ie(this.hass);return Y`
+ `]}};n([vt()],Qc.prototype,"_activeControl",void 0),n([vt()],Qc.prototype,"volume",void 0),Qc=n([pt(Hc)],Qc);const td=`${Fs}-person-card`,ed=`${td}-editor`,id=["person","device_tracker"];Rs({type:td,name:"Mushroom Person Card",description:"Card for person entity"});let od=class extends Ps{static async getConfigElement(){return await Promise.resolve().then((function(){return ng})),document.createElement(ed)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>id.includes(t.split(".")[0])));return{type:`custom:${td}`,entity:e[0]}}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",i=this._config.icon,o=As(this._config),n=ss(t,o.icon_type),r=Ie(this.hass);return Y`
- `}renderBadge(t){return!Ut(t)?super.renderBadge(t):this.renderStateBadge(t)}static get styles(){return[super.styles,Ps,h`
+ `}renderBadge(t){return!Ut(t)?super.renderBadge(t):this.renderStateBadge(t)}static get styles(){return[super.styles,Ns,h`
mushroom-state-item {
cursor: pointer;
}
- `]}};id=n([pt(Qc)],id);const od=`${Rs}-select-card`,nd=`${od}-editor`,rd=["input_select","select"];function ad(t){return null!=t.state?t.state:void 0}let sd=class extends ht{_selectChanged(t){const e=t.target.value,i=ad(this.entity);e&&e!==i&&this._setValue(e)}_setValue(t){const e=this.entity.entity_id.split(".")[0];this.hass.callService(e,"select_option",{entity_id:this.entity.entity_id,option:t})}render(){const t=ad(this.entity),e=this.entity.attributes.options;return Y`
+ `]}};od=n([pt(td)],od);const nd=`${Fs}-select-card`,rd=`${nd}-editor`,ad=["input_select","select"];function sd(t){return null!=t.state?t.state:void 0}let ld=class extends ht{_selectChanged(t){const e=t.target.value,i=sd(this.entity);e&&e!==i&&this._setValue(e)}_setValue(t){const e=this.entity.entity_id.split(".")[0];this.hass.callService(e,"select_option",{entity_id:this.entity.entity_id,option:t})}render(){const t=sd(this.entity),e=this.entity.attributes.options;return Y`
t.stopPropagation()}
@@ -2945,9 +2953,9 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
--select-height: var(--control-height);
width: 100%;
}
- `}};n([_t()],sd.prototype,"hass",void 0),n([_t({attribute:!1})],sd.prototype,"entity",void 0),sd=n([pt("mushroom-select-option-control")],sd),Ns({type:od,name:"Mushroom Select Card",description:"Card for select and input_select entities"});let ld=class extends Ls{static async getConfigElement(){return await Promise.resolve().then((function(){return lg})),document.createElement(nd)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>rd.includes(t.split(".")[0])));return{type:`custom:${od}`,entity:e[0]}}get hasControls(){return!0}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){var t;if(!this._config||!this.hass||!this._config.entity)return K;const e=this._stateObj;if(!e)return this.renderNotFound(this._config);const i=this._config.name||e.attributes.friendly_name||"",o=this._config.icon,n=Es(this._config),r=as(e,n.icon_type),a=Ie(this.hass),s=null===(t=this._config)||void 0===t?void 0:t.icon_color,l={};if(s){const t=Za(s);l["--mdc-theme-primary"]=`rgb(${t})`}return Y`
+ `}};n([_t()],ld.prototype,"hass",void 0),n([_t({attribute:!1})],ld.prototype,"entity",void 0),ld=n([pt("mushroom-select-option-control")],ld),Rs({type:nd,name:"Mushroom Select Card",description:"Card for select and input_select entities"});let cd=class extends Ps{static async getConfigElement(){return await Promise.resolve().then((function(){return cg})),document.createElement(rd)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>ad.includes(t.split(".")[0])));return{type:`custom:${nd}`,entity:e[0]}}get hasControls(){return!0}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){var t;if(!this._config||!this.hass||!this._config.entity)return K;const e=this._stateObj;if(!e)return this.renderNotFound(this._config);const i=this._config.name||e.attributes.friendly_name||"",o=this._config.icon,n=As(this._config),r=ss(e,n.icon_type),a=Ie(this.hass),s=null===(t=this._config)||void 0===t?void 0:t.icon_color,l={};if(s){const t=Ja(s);l["--mdc-theme-primary"]=`rgb(${t})`}return Y`
- `}renderIcon(t,e){var i;const o=Bt(t),n={},r=null===(i=this._config)||void 0===i?void 0:i.icon_color;if(r){const t=Za(r);n["--icon-color"]=`rgb(${t})`,n["--shape-color"]=`rgba(${t}, 0.2)`}return Y`
+ `}renderIcon(t,e){var i;const o=Bt(t),n={},r=null===(i=this._config)||void 0===i?void 0:i.icon_color;if(r){const t=Ja(r);n["--icon-color"]=`rgb(${t})`,n["--shape-color"]=`rgba(${t}, 0.2)`}return Y`
- `}static get styles(){return[super.styles,Ps,h`
+ `}static get styles(){return[super.styles,Ns,h`
.actions {
overflow: visible;
display: block;
@@ -2997,9 +3005,9 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
flex: 1;
--mdc-theme-primary: rgb(var(--rgb-state-entity));
}
- `]}};ld=n([pt(od)],ld);const cd=`${Rs}-template-card`,dd=`${cd}-editor`;Ns({type:cd,name:"Mushroom Template",description:"Build your own mushroom card using templates"});const ud=["icon","icon_color","badge_color","badge_icon","primary","secondary","picture"];let hd=class extends Ds{constructor(){super(...arguments),this._templateResults={},this._unsubRenderTemplates=new Map}static async getConfigElement(){return await Promise.resolve().then((function(){return wu})),document.createElement(dd)}static async getStubConfig(t){return{type:`custom:${cd}`,primary:"Hello, {{user}}",secondary:"How are you?",icon:"mdi:home"}}getCardSize(){let t=1;if(!this._config)return t;return"vertical"===Es(this._config).layout&&(t+=1),t}getLayoutOptions(){var t;const e={grid_columns:2,grid_rows:1};if(!this._config)return e;const i=Es(this._config);return"vertical"===i.layout&&(e.grid_rows+=1),"horizontal"===i.layout&&(e.grid_columns=4),(null===(t=this._config)||void 0===t?void 0:t.multiline_secondary)&&(e.grid_rows=void 0),e}setConfig(t){ud.forEach((e=>{var i,o;(null===(i=this._config)||void 0===i?void 0:i[e])===t[e]&&(null===(o=this._config)||void 0===o?void 0:o.entity)==t.entity||this._tryDisconnectKey(e)})),this._config=Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)}connectedCallback(){super.connectedCallback(),this._tryConnect()}disconnectedCallback(){this._tryDisconnect()}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}isTemplate(t){var e;const i=null===(e=this._config)||void 0===e?void 0:e[t];return null==i?void 0:i.includes("{")}getValue(t){var e,i,o;return this.isTemplate(t)?null===(i=null===(e=this._templateResults[t])||void 0===e?void 0:e.result)||void 0===i?void 0:i.toString():null===(o=this._config)||void 0===o?void 0:o[t]}render(){if(!this._config||!this.hass)return K;const t=this.getValue("icon"),e=this.getValue("icon_color"),i=this.getValue("badge_icon"),o=this.getValue("badge_color"),n=this.getValue("primary"),r=this.getValue("secondary"),a=this.getValue("picture"),s=this._config.multiline_secondary,l=Ie(this.hass),c=Es({fill_container:this._config.fill_container,layout:this._config.layout,icon_type:Boolean(a)?"entity-picture":Boolean(t)?"icon":"none",primary_info:Boolean(n)?"name":"none",secondary_info:Boolean(r)?"state":"none"}),d=ml(t);return Y`
+ `]}};cd=n([pt(nd)],cd);const dd=`${Fs}-template-card`,ud=`${dd}-editor`;Rs({type:dd,name:"Mushroom Template",description:"Build your own mushroom card using templates"});const hd=["icon","icon_color","badge_color","badge_icon","primary","secondary","picture"];let md=class extends Ls{constructor(){super(...arguments),this._templateResults={},this._unsubRenderTemplates=new Map}static async getConfigElement(){return await Promise.resolve().then((function(){return ku})),document.createElement(ud)}static async getStubConfig(t){return{type:`custom:${dd}`,primary:"Hello, {{user}}",secondary:"How are you?",icon:"mdi:home"}}getCardSize(){let t=1;if(!this._config)return t;return"vertical"===As(this._config).layout&&(t+=1),t}getLayoutOptions(){var t;const e={grid_columns:2,grid_rows:1};if(!this._config)return e;const i=As(this._config);return"vertical"===i.layout&&(e.grid_rows+=1),"horizontal"===i.layout&&(e.grid_columns=4),(null===(t=this._config)||void 0===t?void 0:t.multiline_secondary)&&(e.grid_rows=void 0),e}setConfig(t){hd.forEach((e=>{var i,o;(null===(i=this._config)||void 0===i?void 0:i[e])===t[e]&&(null===(o=this._config)||void 0===o?void 0:o.entity)==t.entity||this._tryDisconnectKey(e)})),this._config=Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)}connectedCallback(){super.connectedCallback(),this._tryConnect()}disconnectedCallback(){this._tryDisconnect()}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}isTemplate(t){var e;const i=null===(e=this._config)||void 0===e?void 0:e[t];return null==i?void 0:i.includes("{")}getValue(t){var e,i,o;return this.isTemplate(t)?null===(i=null===(e=this._templateResults[t])||void 0===e?void 0:e.result)||void 0===i?void 0:i.toString():null===(o=this._config)||void 0===o?void 0:o[t]}render(){if(!this._config||!this.hass)return K;const t=this.getValue("icon"),e=this.getValue("icon_color"),i=this.getValue("badge_icon"),o=this.getValue("badge_color"),n=this.getValue("primary"),r=this.getValue("secondary"),a=this.getValue("picture"),s=this._config.multiline_secondary,l=Ie(this.hass),c=As({fill_container:this._config.fill_container,layout:this._config.layout,icon_type:Boolean(a)?"entity-picture":Boolean(t)?"icon":"none",primary_info:Boolean(n)?"name":"none",secondary_info:Boolean(r)?"state":"none"}),d=pl(t);return Y`
- `}renderIcon(t,e){const i={};if(e){const t=Za(e);i["--icon-color"]=`rgb(${t})`,i["--shape-color"]=`rgba(${t}, 0.2)`}return Y`
-
+ `}renderIcon(t,e){const i={};if(e){const t=Ja(e);i["--icon-color"]=`rgb(${t})`,i["--shape-color"]=`rgba(${t}, 0.2)`}return Y`
+
- `}renderBadgeIcon(t,e){const i={};if(e){const t=Za(e);i["--main-color"]=`rgba(${t})`}return Y`
+ `}renderBadgeIcon(t,e){const i={};if(e){const t=Ja(e);i["--main-color"]=`rgba(${t})`}return Y`
- `}updated(t){super.updated(t),this._config&&this.hass&&this._tryConnect()}async _tryConnect(){ud.forEach((t=>{this._tryConnectKey(t)}))}async _tryConnectKey(t){var e,i;if(void 0===this._unsubRenderTemplates.get(t)&&this.hass&&this._config&&this.isTemplate(t))try{const i=Fe(this.hass.connection,(e=>{this._templateResults=Object.assign(Object.assign({},this._templateResults),{[t]:e})}),{template:null!==(e=this._config[t])&&void 0!==e?e:"",entity_ids:this._config.entity_id,variables:{config:this._config,user:this.hass.user.name,entity:this._config.entity},strict:!0});this._unsubRenderTemplates.set(t,i),await i}catch(e){const o={result:null!==(i=this._config[t])&&void 0!==i?i:"",listeners:{all:!1,domains:[],entities:[],time:!1}};this._templateResults=Object.assign(Object.assign({},this._templateResults),{[t]:o}),this._unsubRenderTemplates.delete(t)}}async _tryDisconnect(){ud.forEach((t=>{this._tryDisconnectKey(t)}))}async _tryDisconnectKey(t){const e=this._unsubRenderTemplates.get(t);if(e)try{(await e)(),this._unsubRenderTemplates.delete(t)}catch(t){if("not_found"!==t.code&&"template_error"!==t.code)throw t}}static get styles(){return[super.styles,Ps,h`
+ `}updated(t){super.updated(t),this._config&&this.hass&&this._tryConnect()}async _tryConnect(){hd.forEach((t=>{this._tryConnectKey(t)}))}async _tryConnectKey(t){var e,i;if(void 0===this._unsubRenderTemplates.get(t)&&this.hass&&this._config&&this.isTemplate(t))try{const i=Fe(this.hass.connection,(e=>{this._templateResults=Object.assign(Object.assign({},this._templateResults),{[t]:e})}),{template:null!==(e=this._config[t])&&void 0!==e?e:"",entity_ids:this._config.entity_id,variables:{config:this._config,user:this.hass.user.name,entity:this._config.entity},strict:!0});this._unsubRenderTemplates.set(t,i),await i}catch(e){const o={result:null!==(i=this._config[t])&&void 0!==i?i:"",listeners:{all:!1,domains:[],entities:[],time:!1}};this._templateResults=Object.assign(Object.assign({},this._templateResults),{[t]:o}),this._unsubRenderTemplates.delete(t)}}async _tryDisconnect(){hd.forEach((t=>{this._tryDisconnectKey(t)}))}async _tryDisconnectKey(t){const e=this._unsubRenderTemplates.get(t);if(e)try{(await e)(),this._unsubRenderTemplates.delete(t)}catch(t){if("not_found"!==t.code&&"template_error"!==t.code)throw t}}static get styles(){return[super.styles,Ns,h`
mushroom-state-item {
cursor: pointer;
}
@@ -3047,14 +3055,14 @@ const sa="important",la=" !"+sa,ca=He(class extends Ye{constructor(t){var e;if(s
height: var(--icon-size);
display: flex;
}
- ${ol}
- `]}};n([vt()],hd.prototype,"_config",void 0),n([vt()],hd.prototype,"_templateResults",void 0),n([vt()],hd.prototype,"_unsubRenderTemplates",void 0),n([_t({reflect:!0,type:String})],hd.prototype,"layout",void 0),hd=n([pt(cd)],hd);const md=`${Rs}-title-card`,pd=`${md}-editor`;Ns({type:md,name:"Mushroom Title Card",description:"Title and subtitle to separate sections"});const fd=["title","subtitle"];let gd=class extends Ds{constructor(){super(...arguments),this._templateResults={},this._unsubRenderTemplates=new Map}static async getConfigElement(){return await Promise.resolve().then((function(){return pg})),document.createElement(pd)}static async getStubConfig(t){return{type:`custom:${md}`,title:"Hello, {{ user }} !"}}getCardSize(){return 1}setConfig(t){fd.forEach((e=>{var i;(null===(i=this._config)||void 0===i?void 0:i[e])!==t[e]&&this._tryDisconnectKey(e)})),this._config=Object.assign({title_tap_action:{action:"none"},subtitle_tap_action:{action:"none"}},t)}connectedCallback(){super.connectedCallback(),this._tryConnect()}disconnectedCallback(){this._tryDisconnect()}isTemplate(t){var e;const i=null===(e=this._config)||void 0===e?void 0:e[t];return null==i?void 0:i.includes("{")}getValue(t){var e,i,o;return this.isTemplate(t)?null===(i=null===(e=this._templateResults[t])||void 0===e?void 0:e.result)||void 0===i?void 0:i.toString():null===(o=this._config)||void 0===o?void 0:o[t]}_handleTitleAction(t){const e={tap_action:this._config.title_tap_action};Ke(this,this.hass,e,t.detail.action)}_handleSubtitleAction(t){const e={tap_action:this._config.subtitle_tap_action};Ke(this,this.hass,e,t.detail.action)}render(){if(!this._config||!this.hass)return K;const t=this.getValue("title"),e=this.getValue("subtitle");let i="";this._config.alignment&&(i=`align-${this._config.alignment}`);const o=Boolean(this._config.title_tap_action&&"none"!==this._config.title_tap_action.action),n=Boolean(this._config.subtitle_tap_action&&"none"!==this._config.subtitle_tap_action.action),r=Ie(this.hass);return Y`
+ ${nl}
+ `]}};n([vt()],md.prototype,"_config",void 0),n([vt()],md.prototype,"_templateResults",void 0),n([vt()],md.prototype,"_unsubRenderTemplates",void 0),n([_t({reflect:!0,type:String})],md.prototype,"layout",void 0),md=n([pt(dd)],md);const pd=`${Fs}-title-card`,fd=`${pd}-editor`;Rs({type:pd,name:"Mushroom Title Card",description:"Title and subtitle to separate sections"});const gd=["title","subtitle"];let _d=class extends Ls{constructor(){super(...arguments),this._templateResults={},this._unsubRenderTemplates=new Map}static async getConfigElement(){return await Promise.resolve().then((function(){return fg})),document.createElement(fd)}static async getStubConfig(t){return{type:`custom:${pd}`,title:"Hello, {{ user }} !"}}getCardSize(){return 1}setConfig(t){gd.forEach((e=>{var i;(null===(i=this._config)||void 0===i?void 0:i[e])!==t[e]&&this._tryDisconnectKey(e)})),this._config=Object.assign({title_tap_action:{action:"none"},subtitle_tap_action:{action:"none"}},t)}connectedCallback(){super.connectedCallback(),this._tryConnect()}disconnectedCallback(){this._tryDisconnect()}isTemplate(t){var e;const i=null===(e=this._config)||void 0===e?void 0:e[t];return null==i?void 0:i.includes("{")}getValue(t){var e,i,o;return this.isTemplate(t)?null===(i=null===(e=this._templateResults[t])||void 0===e?void 0:e.result)||void 0===i?void 0:i.toString():null===(o=this._config)||void 0===o?void 0:o[t]}_handleTitleAction(t){const e={tap_action:this._config.title_tap_action};Ke(this,this.hass,e,t.detail.action)}_handleSubtitleAction(t){const e={tap_action:this._config.subtitle_tap_action};Ke(this,this.hass,e,t.detail.action)}render(){if(!this._config||!this.hass)return K;const t=this.getValue("title"),e=this.getValue("subtitle");let i="";this._config.alignment&&(i=`align-${this._config.alignment}`);const o=Boolean(this._config.title_tap_action&&"none"!==this._config.title_tap_action.action),n=Boolean(this._config.subtitle_tap_action&&"none"!==this._config.subtitle_tap_action.action),r=Ie(this.hass);return Y`