Skip to content

Instantly share code, notes, and snippets.

@RickeyWard
Last active February 18, 2024 16:52
Show Gist options
  • Save RickeyWard/f44f1e5adc5086b785658ad7cd515ecc to your computer and use it in GitHub Desktop.
Save RickeyWard/f44f1e5adc5086b785658ad7cd515ecc to your computer and use it in GitHub Desktop.
Mushroom Countdown Card Addon

Mushroom Countdown Card Addon

Requires you have lovelace-mushroom already loaded (known compatible with 2.6.3)

upload mushroom-countdown-card-addon.js to your home assistant /www/ folder /www/mushroom-countdown-card-addon.js

Add to dashboard resources go to settings, dashboard, click ••• button in top right corner, choose resources, then add new resource that points to /local/mushroom-countdown-card-addon.js of type module.

Then go to any dashboard and add a new card, you'll see Custom:Mushroom Countdown Card

*note this unnecessarily reincludes lit-elements library, I'm not concerned about the 30kb on my local network but ymmv.

var e="https://github.com/RickeyWard/lovelace-mushroom";
function t(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/}const r=window,n=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),a=new WeakMap;let o=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=a.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&a.set(t,e))}return e}toString(){return this.cssText}};const s=(e,...t)=>{const r=1===e.length?e[0]:t.reduce(((t,r,n)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[n+1]),e[0]);return new o(r,e,i)},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return(e=>new o("string"==typeof e?e:e+"",void 0,i))(t)})(e):e
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/;var c;const u=window,d=u.trustedTypes,h=d?d.emptyScript:"",m=u.reactiveElementPolyfillSupport,p={toAttribute(e,t){switch(t){case Boolean:e=e?h:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},g=(e,t)=>t!==e&&(t==t||e==e),f={attribute:!0,type:String,converter:p,reflect:!1,hasChanged:g};let b=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,r)=>{const n=this._$Ep(r,t);void 0!==n&&(this._$Ev.set(n,r),e.push(n))})),e}static createProperty(e,t=f){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const r="symbol"==typeof e?Symbol():"__"+e,n=this.getPropertyDescriptor(e,r,t);void 0!==n&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(n){const i=this[e];this[t]=n,this.requestUpdate(e,i,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||f}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const r of t)this.createProperty(r,e[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Ep(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,r;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(r=e.hostConnected)||void 0===r||r.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{n?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),i=r.litNonce;void 0!==i&&n.setAttribute("nonce",i),n.textContent=t.cssText,e.appendChild(n)}))})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EO(e,t,r=f){var n;const i=this.constructor._$Ep(e,r);if(void 0!==i&&!0===r.reflect){const a=(void 0!==(null===(n=r.converter)||void 0===n?void 0:n.toAttribute)?r.converter:p).toAttribute(t,r.type);this._$El=e,null==a?this.removeAttribute(i):this.setAttribute(i,a),this._$El=null}}_$AK(e,t){var r;const n=this.constructor,i=n._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=n.getPropertyOptions(i),a="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(r=e.converter)||void 0===r?void 0:r.fromAttribute)?e.converter:p;this._$El=i,this[i]=a.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,r){let n=!0;void 0!==e&&(((r=r||this.constructor.getPropertyOptions(e)).hasChanged||g)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,r))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(r)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(r)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var v;b.finalized=!0,b.elementProperties=new Map,b.elementStyles=[],b.shadowRootOptions={mode:"open"},null==m||m({ReactiveElement:b}),(null!==(c=u.reactiveElementVersions)&&void 0!==c?c:u.reactiveElementVersions=[]).push("1.6.0");const y=window,_=y.trustedTypes,w=_?_.createPolicy("lit-html",{createHTML:e=>e}):void 0,$=`lit$${(Math.random()+"").slice(9)}$`,k="?"+$,x=`<${k}>`,A=document,S=(e="")=>A.createComment(e),E=e=>null===e||"object"!=typeof e&&"function"!=typeof e,M=Array.isArray,C=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,z=/-->/g,O=/>/g,N=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),T=/'/g,j=/"/g,P=/^(?:script|style|textarea|title)$/i,U=(e=>(t,...r)=>({_$litType$:e,strings:t,values:r}))(1),D=Symbol.for("lit-noChange"),I=Symbol.for("lit-nothing"),H=new WeakMap,F=A.createTreeWalker(A,129,null,!1),R=(e,t)=>{const r=e.length-1,n=[];let i,a=2===t?"<svg>":"",o=C;for(let t=0;t<r;t++){const r=e[t];let s,l,c=-1,u=0;for(;u<r.length&&(o.lastIndex=u,l=o.exec(r),null!==l);)u=o.lastIndex,o===C?"!--"===l[1]?o=z:void 0!==l[1]?o=O:void 0!==l[2]?(P.test(l[2])&&(i=RegExp("</"+l[2],"g")),o=N):void 0!==l[3]&&(o=N):o===N?">"===l[0]?(o=null!=i?i:C,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,s=l[1],o=void 0===l[3]?N:'"'===l[3]?j:T):o===j||o===T?o=N:o===z||o===O?o=C:(o=N,i=void 0);const d=o===N&&e[t+1].startsWith("/>")?" ":"";a+=o===C?r+x:c>=0?(n.push(s),r.slice(0,c)+"$lit$"+r.slice(c)+$+d):r+$+(-2===c?(n.push(void 0),t):d)}const s=a+(e[r]||"<?>")+(2===t?"</svg>":"");if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==w?w.createHTML(s):s,n]};class L{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let i=0,a=0;const o=e.length-1,s=this.parts,[l,c]=R(e,t);if(this.el=L.createElement(l,r),F.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(n=F.nextNode())&&s.length<o;){if(1===n.nodeType){if(n.hasAttributes()){const e=[];for(const t of n.getAttributeNames())if(t.endsWith("$lit$")||t.startsWith($)){const r=c[a++];if(e.push(t),void 0!==r){const e=n.getAttribute(r.toLowerCase()+"$lit$").split($),t=/([.?@])?(.*)/.exec(r);s.push({type:1,index:i,name:t[2],strings:e,ctor:"."===t[1]?J:"?"===t[1]?K:"@"===t[1]?Z:W})}else s.push({type:6,index:i})}for(const t of e)n.removeAttribute(t)}if(P.test(n.tagName)){const e=n.textContent.split($),t=e.length-1;if(t>0){n.textContent=_?_.emptyScript:"";for(let r=0;r<t;r++)n.append(e[r],S()),F.nextNode(),s.push({type:2,index:++i});n.append(e[t],S())}}}else if(8===n.nodeType)if(n.data===k)s.push({type:2,index:i});else{let e=-1;for(;-1!==(e=n.data.indexOf($,e+1));)s.push({type:7,index:i}),e+=$.length-1}i++}}static createElement(e,t){const r=A.createElement("template");return r.innerHTML=e,r}}function B(e,t,r=e,n){var i,a,o,s;if(t===D)return t;let l=void 0!==n?null===(i=r._$Co)||void 0===i?void 0:i[n]:r._$Cl;const c=E(t)?void 0:t._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(a=null==l?void 0:l._$AO)||void 0===a||a.call(l,!1),void 0===c?l=void 0:(l=new c(e),l._$AT(e,r,n)),void 0!==n?(null!==(o=(s=r)._$Co)&&void 0!==o?o:s._$Co=[])[n]=l:r._$Cl=l),void 0!==l&&(t=B(e,l._$AS(e,t.values),l,n)),t}class q{constructor(e,t){this.u=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(e){var t;const{el:{content:r},parts:n}=this._$AD,i=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:A).importNode(r,!0);F.currentNode=i;let a=F.nextNode(),o=0,s=0,l=n[0];for(;void 0!==l;){if(o===l.index){let t;2===l.type?t=new V(a,a.nextSibling,this,e):1===l.type?t=new l.ctor(a,l.name,l.strings,this,e):6===l.type&&(t=new Y(a,this,e)),this.u.push(t),l=n[++s]}o!==(null==l?void 0:l.index)&&(a=F.nextNode(),o++)}return i}p(e){let t=0;for(const r of this.u)void 0!==r&&(void 0!==r.strings?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class V{constructor(e,t,r,n){var i;this.type=2,this._$AH=I,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cm=null===(i=null==n?void 0:n.isConnected)||void 0===i||i}get _$AU(){var e,t;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cm}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=B(this,e,t),E(e)?e===I||null==e||""===e?(this._$AH!==I&&this._$AR(),this._$AH=I):e!==this._$AH&&e!==D&&this.g(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>M(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]))(e)?this.k(e):this.g(e)}O(e,t=this._$AB){return this._$AA.parentNode.insertBefore(e,t)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}g(e){this._$AH!==I&&E(this._$AH)?this._$AA.nextSibling.data=e:this.T(A.createTextNode(e)),this._$AH=e}$(e){var t;const{values:r,_$litType$:n}=e,i="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=L.createElement(n.h,this.options)),n);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===i)this._$AH.p(r);else{const e=new q(i,this),t=e.v(this.options);e.p(r),this.T(t),this._$AH=e}}_$AC(e){let t=H.get(e.strings);return void 0===t&&H.set(e.strings,t=new L(e)),t}k(e){M(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,n=0;for(const i of e)n===t.length?t.push(r=new V(this.O(S()),this.O(S()),this,this.options)):r=t[n],r._$AI(i),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var r;for(null===(r=this._$AP)||void 0===r||r.call(this,!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){var t;void 0===this._$AM&&(this._$Cm=e,null===(t=this._$AP)||void 0===t||t.call(this,e))}}class W{constructor(e,t,r,n,i){this.type=1,this._$AH=I,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=I}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,r,n){const i=this.strings;let a=!1;if(void 0===i)e=B(this,e,t,0),a=!E(e)||e!==this._$AH&&e!==D,a&&(this._$AH=e);else{const n=e;let o,s;for(e=i[0],o=0;o<i.length-1;o++)s=B(this,n[r+o],t,o),s===D&&(s=this._$AH[o]),a||(a=!E(s)||s!==this._$AH[o]),s===I?e=I:e!==I&&(e+=(null!=s?s:"")+i[o+1]),this._$AH[o]=s}a&&!n&&this.j(e)}j(e){e===I?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}class J extends W{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===I?void 0:e}}const G=_?_.emptyScript:"";class K extends W{constructor(){super(...arguments),this.type=4}j(e){e&&e!==I?this.element.setAttribute(this.name,G):this.element.removeAttribute(this.name)}}class Z extends W{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){var r;if((e=null!==(r=B(this,e,t,0))&&void 0!==r?r:I)===D)return;const n=this._$AH,i=e===I&&n!==I||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,a=e!==I&&(n===I||i);i&&this.element.removeEventListener(this.name,this,n),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;"function"==typeof this._$AH?this._$AH.call(null!==(r=null===(t=this.options)||void 0===t?void 0:t.host)&&void 0!==r?r:this.element,e):this._$AH.handleEvent(e)}}class Y{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){B(this,e)}}const Q=y.litHtmlPolyfillSupport;null==Q||Q(L,V),(null!==(v=y.litHtmlVersions)&&void 0!==v?v:y.litHtmlVersions=[]).push("2.6.0");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var X,ee;class te extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var e,t;const r=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=r.firstChild),r}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Dt=((e,t,r)=>{var n,i;const a=null!==(n=null==r?void 0:r.renderBefore)&&void 0!==n?n:t;let o=a._$litPart$;if(void 0===o){const e=null!==(i=null==r?void 0:r.renderBefore)&&void 0!==i?i:null;a._$litPart$=o=new V(t.insertBefore(S(),e),e,void 0,null!=r?r:{})}return o._$AI(e),o})(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Dt)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Dt)||void 0===e||e.setConnected(!1)}render(){return D}}te.finalized=!0,te._$litElement$=!0,null===(X=globalThis.litElementHydrateSupport)||void 0===X||X.call(globalThis,{LitElement:te});const re=globalThis.litElementPolyfillSupport;null==re||re({LitElement:te}),(null!==(ee=globalThis.litElementVersions)&&void 0!==ee?ee:globalThis.litElementVersions=[]).push("3.2.0");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const ne=e=>t=>"function"==typeof t?((e,t)=>(customElements.define(e,t),t))(e,t):((e,t)=>{const{kind:r,elements:n}=t;return{kind:r,elements:n,finisher(t){customElements.define(e,t)}}})(e,t)
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,ie=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(r){r.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(r){r.createProperty(t.key,e)}};function ae(e){return(t,r)=>void 0!==r?((e,t,r)=>{t.constructor.createProperty(r,e)})(e,t,r):ie(e,t)}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function oe(e){return ae({...e,state:!0})}
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/var se;null===(se=window.HTMLSlotElement)||void 0===se||se.prototype.assignedElements;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const le=1,ce=e=>(...t)=>({_$litDirective$:e,values:t});let ue=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const de=ce(class extends ue{constructor(e){var t;if(super(e),e.type!==le||"class"!==e.name||(null===(t=e.strings)||void 0===t?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){var r,n;if(void 0===this.nt){this.nt=new Set,void 0!==e.strings&&(this.st=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!(null===(r=this.st)||void 0===r?void 0:r.has(e))&&this.nt.add(e);return this.render(t)}const i=e.element.classList;this.nt.forEach((e=>{e in t||(i.remove(e),this.nt.delete(e))}));for(const e in t){const r=!!t[e];r===this.nt.has(e)||(null===(n=this.st)||void 0===n?void 0:n.has(e))||(r?(i.add(e),this.nt.add(e)):(i.remove(e),this.nt.delete(e)))}return D}}),he=ce(class extends ue{constructor(e){var t;if(super(e),e.type!==le||"style"!==e.name||(null===(t=e.strings)||void 0===t?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,r)=>{const n=e[r];return null==n?t:t+`${r=r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`}),"")}update(e,[t]){const{style:r}=e.element;if(void 0===this.vt){this.vt=new Set;for(const e in t)this.vt.add(e);return this.render(t)}this.vt.forEach((e=>{null==t[e]&&(this.vt.delete(e),e.includes("-")?r.removeProperty(e):r[e]="")}));for(const e in t){const n=t[e];null!=n&&(this.vt.add(e),e.includes("-")?r.setProperty(e,n):r[e]=n)}return D}}),me=["closed","locked","off"];
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/var pe=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function ge(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(n=e[r],i=t[r],!(n===i||pe(n)&&pe(i)))return!1;var n,i;return!0}function fe(e,t){void 0===t&&(t=ge);var r=null;function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(r&&r.lastThis===this&&t(n,r.lastArgs))return r.lastResult;var a=e.apply(this,n);return r={lastResult:a,lastArgs:n,lastThis:this},a}return n.clear=function(){r=null},n}fe((e=>new Intl.DateTimeFormat(e.language,{weekday:"long",month:"long",day:"numeric"})));const be=(e,t)=>ve(t).format(e),ve=fe((e=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric"})));var ye,_e;fe((e=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"numeric",day:"numeric"}))),fe((e=>new Intl.DateTimeFormat(e.language,{day:"numeric",month:"short"}))),fe((e=>new Intl.DateTimeFormat(e.language,{month:"long",year:"numeric"}))),fe((e=>new Intl.DateTimeFormat(e.language,{month:"long"}))),fe((e=>new Intl.DateTimeFormat(e.language,{year:"numeric"}))),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(ye||(ye={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(_e||(_e={}));const we=fe((e=>{if(e.time_format===_e.language||e.time_format===_e.system){const t=e.time_format===_e.language?e.language:void 0,r=(new Date).toLocaleString(t);return r.includes("AM")||r.includes("PM")}return e.time_format===_e.am_pm})),$e=(e,t)=>ke(t).format(e),ke=fe((e=>new Intl.DateTimeFormat("en"!==e.language||we(e)?e.language:"en-u-hc-h23",{year:"numeric",month:"long",day:"numeric",hour:we(e)?"numeric":"2-digit",minute:"2-digit",hour12:we(e)})));fe((e=>new Intl.DateTimeFormat("en"!==e.language||we(e)?e.language:"en-u-hc-h23",{year:"numeric",month:"long",day:"numeric",hour:we(e)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:we(e)}))),fe((e=>new Intl.DateTimeFormat("en"!==e.language||we(e)?e.language:"en-u-hc-h23",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",hour12:we(e)})));const xe=(e,t)=>Ae(t).format(e),Ae=fe((e=>new Intl.DateTimeFormat("en"!==e.language||we(e)?e.language:"en-u-hc-h23",{hour:"numeric",minute:"2-digit",hour12:we(e)})));fe((e=>new Intl.DateTimeFormat("en"!==e.language||we(e)?e.language:"en-u-hc-h23",{hour:we(e)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:we(e)}))),fe((e=>new Intl.DateTimeFormat("en"!==e.language||we(e)?e.language:"en-u-hc-h23",{weekday:"long",hour:we(e)?"numeric":"2-digit",minute:"2-digit",hour12:we(e)})));const Se=(e,t,r,n)=>{n=n||{},r=null==r?{}:r;const i=new Event(t,{bubbles:void 0===n.bubbles||n.bubbles,cancelable:Boolean(n.cancelable),composed:void 0===n.composed||n.composed});return i.detail=r,e.dispatchEvent(i),i},Ee="ha-main-window"===window.name?window:"ha-main-window"===parent.name?parent:top,Me=e=>e.substr(0,e.indexOf(".")),Ce=["unavailable","unknown","off"];function ze(e){const t=Me(e.entity_id),r=e.state;if(["button","input_button","scene"].includes(t))return"unavailable"!==r;if(Ce.includes(r))return!1;switch(t){case"cover":return!["closed","closing"].includes(r);case"device_tracker":case"person":return"not_home"!==r;case"media_player":return"standby"!==r;case"vacuum":return!["idle","docked","paused"].includes(r);case"plant":return"problem"===r;default:return!0}}function Oe(e){return"unavailable"!==e.state}function Ne(e){return"unknown"===e.state}const Te=(e,t)=>0!=(e.supported_features&t);fe((e=>new Intl.Collator(e))),fe((e=>new Intl.Collator(e,{sensitivity:"accent"})));const je=e=>Te(e,4)&&"number"==typeof e.in_progress,Pe=e=>(e=>je(e.attributes))(e)||!!e.attributes.in_progress,Ue=(e,t,r,n)=>{const[i,a,o]=e.split(".",3);return Number(i)>t||Number(i)===t&&(void 0===n?Number(a)>=r:Number(a)>r)||void 0!==n&&Number(i)===t&&Number(a)===r&&Number(o)>=n},De=e=>e<10?`0${e}`:e;const Ie={s:1,min:60,h:3600,d:86400},He=(e,t)=>function(e){const t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%3600%60);return t>0?`${t}:${De(r)}:${De(n)}`:r>0?`${r}:${De(n)}`:n>0?""+n:null}(parseFloat(e)*Ie[t])||"0",Fe=(e,t,r)=>{const n=t?(e=>{switch(e.number_format){case ye.comma_decimal:return["en-US","en"];case ye.decimal_comma:return["de","es","it"];case ye.space_comma:return["fr","sv","cs"];case ye.system:return;default:return e.language}})(t):void 0;if(Number.isNaN=Number.isNaN||function e(t){return"number"==typeof t&&e(t)},(null==t?void 0:t.number_format)!==ye.none&&!Number.isNaN(Number(e))&&Intl)try{return new Intl.NumberFormat(n,Le(e,r)).format(Number(e))}catch(t){return console.error(t),new Intl.NumberFormat(void 0,Le(e,r)).format(Number(e))}return"string"==typeof e?e:`${((e,t=2)=>Math.round(e*10**t)/10**t)(e,null==r?void 0:r.maximumFractionDigits).toString()}${"currency"===(null==r?void 0:r.style)?` ${r.currency}`:""}`},Re=(e,t)=>{var r;const n=null==t?void 0:t.display_precision;return null!=n?{maximumFractionDigits:n,minimumFractionDigits:n}:Number.isInteger(Number(null===(r=e.attributes)||void 0===r?void 0:r.step))&&Number.isInteger(Number(e.state))?{maximumFractionDigits:0}:void 0},Le=(e,t)=>{const r=Object.assign({maximumFractionDigits:2},t);if("string"!=typeof e)return r;if(!t||void 0===t.minimumFractionDigits&&void 0===t.maximumFractionDigits){const t=e.indexOf(".")>-1?e.split(".")[1].length:0;r.minimumFractionDigits=t,r.maximumFractionDigits=t}return r},Be=e=>{switch(e.language){case"cz":case"de":case"fi":case"fr":case"sk":case"sv":return" ";default:return""}},qe=(e,t,r,n,i,a)=>Ve(e,r,n,i,t.entity_id,t.attributes,void 0!==a?a:t.state),Ve=(e,t,r,n,i,a,o)=>{var s;if("unknown"===o||"unavailable"===o)return e(`state.default.${o}`);const l=r[i];if((e=>!!e.unit_of_measurement||!!e.state_class)(a)){if("duration"===a.device_class&&a.unit_of_measurement&&Ie[a.unit_of_measurement])try{return He(o,a.unit_of_measurement)}catch(e){}if("monetary"===a.device_class)try{return Fe(o,t,{style:"currency",currency:a.unit_of_measurement,minimumFractionDigits:2})}catch(e){}const e=a.unit_of_measurement?"%"===a.unit_of_measurement?Be(t)+"%":` ${a.unit_of_measurement}`:"";return`${Fe(o,t,Re({state:o,attributes:a},l))}${e}`}const c=Me(i);if("input_datetime"===c){if(void 0===o){let e;return a.has_date&&a.has_time?(e=new Date(a.year,a.month-1,a.day,a.hour,a.minute),$e(e,t)):a.has_date?(e=new Date(a.year,a.month-1,a.day),be(e,t)):a.has_time?(e=new Date,e.setHours(a.hour,a.minute),xe(e,t)):o}try{const e=o.split(" ");if(2===e.length)return $e(new Date(e.join("T")),t);if(1===e.length){if(o.includes("-"))return be(new Date(`${o}T00:00`),t);if(o.includes(":")){const e=new Date;return xe(new Date(`${e.toISOString().split("T")[0]}T${o}`),t)}}return o}catch(e){return o}}if("humidifier"===c&&"on"===o&&a.humidity)return`${a.humidity}${Be(t)}%`;if("counter"===c||"number"===c||"input_number"===c)return Fe(o,t,Re({state:o,attributes:a},l));if("button"===c||"input_button"===c||"scene"===c||"sensor"===c&&"timestamp"===a.device_class)try{return $e(new Date(o),t)}catch(e){return o}return"update"===c?"on"===o?(e=>je(e)||!!e.in_progress)(a)?Te(a,4)&&"number"==typeof a.in_progress?e("ui.card.update.installing_with_progress",{progress:a.in_progress}):e("ui.card.update.installing"):a.latest_version:a.skipped_version===a.latest_version?null!==(s=a.latest_version)&&void 0!==s?s:e("state.default.unavailable"):e("ui.card.update.up_to_date"):(null==l?void 0:l.translation_key)&&e(`component.${l.platform}.entity.${c}.${l.translation_key}.state.${o}`)||a.device_class&&e(Ue(n,2023,4)?`component.${c}.entity_component.${a.device_class}.state.${o}`:`component.${c}.state.${a.device_class}.${o}`)||e(Ue(n,2023,4)?`component.${c}.entity_component._.state.${o}`:`component.${c}.state._.${o}`)||o};class We extends TypeError{constructor(e,t){let r;const{message:n,...i}=e,{path:a}=e;super(0===a.length?n:"At path: "+a.join(".")+" -- "+n),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var n;return null!=(n=r)?n:r=[e,...t()]}}}function Je(e){return"object"==typeof e&&null!=e}function Ge(e){return"string"==typeof e?JSON.stringify(e):""+e}function Ke(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:a}=t,{type:o}=r,{refinement:s,message:l="Expected a value of type `"+o+"`"+(s?" with refinement `"+s+"`":"")+", but received: `"+Ge(n)+"`"}=e;return{value:n,type:o,refinement:s,key:i[i.length-1],path:i,branch:a,...e,message:l}}function*Ze(e,t,r,n){(function(e){return Je(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const i of e){const e=Ke(i,t,r,n);e&&(yield e)}}function*Ye(e,t,r){void 0===r&&(r={});const{path:n=[],branch:i=[e],coerce:a=!1,mask:o=!1}=r,s={path:n,branch:i};if(a&&(e=t.coercer(e,s),o&&"type"!==t.type&&Je(t.schema)&&Je(e)&&!Array.isArray(e)))for(const r in e)void 0===t.schema[r]&&delete e[r];let l=!0;for(const r of t.validator(e,s))l=!1,yield[r,void 0];for(let[r,c,u]of t.entries(e,s)){const t=Ye(c,u,{path:void 0===r?n:[...n,r],branch:void 0===r?i:[...i,c],coerce:a,mask:o});for(const n of t)n[0]?(l=!1,yield[n[0],void 0]):a&&(c=n[1],void 0===r?e=c:e instanceof Map?e.set(r,c):e instanceof Set?e.add(c):Je(e)&&(e[r]=c))}if(l)for(const r of t.refiner(e,s))l=!1,yield[r,void 0];l&&(yield[void 0,e])}class Qe{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:t,schema:r,validator:n,refiner:i,coercer:a=(e=>e),entries:o=function*(){}}=e;this.type=t,this.schema=r,this.entries=o,this.coercer=a,this.validator=n?(e,t)=>Ze(n(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>Ze(i(e,t),t,this,e):()=>[]}assert(e){return Xe(e,this)}create(e){return function(e,t){const r=et(e,t,{coerce:!0});if(r[0])throw r[0];return r[1]}(e,this)}is(e){return function(e,t){return!et(e,t)[0]}(e,this)}mask(e){return function(e,t){const r=et(e,t,{coerce:!0,mask:!0});if(r[0])throw r[0];return r[1]}(e,this)}validate(e,t){return void 0===t&&(t={}),et(e,this,t)}}function Xe(e,t){const r=et(e,t);if(r[0])throw r[0]}function et(e,t,r){void 0===r&&(r={});const n=Ye(e,t,r),i=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);if(i[0]){const e=new We(i[0],(function*(){for(const e of n)e[0]&&(yield e[0])}));return[e,void 0]}return[void 0,i[1]]}function tt(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n="type"===t[0].type,i=t.map((e=>e.schema)),a=Object.assign({},...i);return n?dt(a):lt(a)}function rt(e,t){return new Qe({type:e,schema:null,validator:t})}function nt(e){return new Qe({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+Ge(e)})}function it(){return rt("boolean",(e=>"boolean"==typeof e))}function at(e){const t={},r=e.map((e=>Ge(e))).join();for(const r of e)t[r]=r;return new Qe({type:"enums",schema:t,validator:t=>e.includes(t)||"Expected one of `"+r+"`, but received: "+Ge(t)})}function ot(e){const t=Ge(e),r=typeof e;return new Qe({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||"Expected the literal `"+t+"`, but received: "+Ge(r)})}function st(){return rt("number",(e=>"number"==typeof e&&!isNaN(e)||"Expected a number, but received: "+Ge(e)))}function lt(e){const t=e?Object.keys(e):[],r=rt("never",(()=>!1));return new Qe({type:"object",schema:e||null,*entries(n){if(e&&Je(n)){const i=new Set(Object.keys(n));for(const r of t)i.delete(r),yield[r,n[r],e[r]];for(const e of i)yield[e,n[e],r]}},validator:e=>Je(e)||"Expected an object, but received: "+Ge(e),coercer:e=>Je(e)?{...e}:e})}function ct(e){return new Qe({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function ut(){return rt("string",(e=>"string"==typeof e||"Expected a string, but received: "+Ge(e)))}function dt(e){const t=Object.keys(e);return new Qe({type:"type",schema:e,*entries(r){if(Je(r))for(const n of t)yield[n,r[n],e[n]]},validator:e=>Je(e)||"Expected an object, but received: "+Ge(e)})}function ht(e){const t=e.map((e=>e.type)).join(" | ");return new Qe({type:"union",schema:null,coercer(t,r){const n=e.find((e=>{const[r]=e.validate(t,{coerce:!0});return!r}))||rt("unknown",(()=>!0));return n.coercer(t,r)},validator(r,n){const i=[];for(const t of e){const[...e]=Ye(r,t,n),[a]=e;if(!a[0])return[];for(const[t]of e)t&&i.push(t)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+Ge(r),...i]}})}const mt=e=>{Se(window,"haptic",e)},pt=(e,t)=>{const r=(()=>{const e=document.body;if(e.querySelector("action-handler"))return e.querySelector("action-handler");const t=document.createElement("action-handler");return e.appendChild(t),t})();r&&r.bind(e,t)},gt=ce(class extends ue{update(e,[t]){return pt(e.element,t),D}render(e){}}),ft=(e,t)=>((e,t,r=!0)=>{const n=Me(t),i="group"===n?"homeassistant":n;let a;switch(n){case"lock":a=r?"unlock":"lock";break;case"cover":a=r?"open_cover":"close_cover";break;case"button":case"input_button":a="press";break;case"scene":a="turn_on";break;default:a=r?"turn_on":"turn_off"}return e.callService(i,a,{entity_id:t})})(e,t,me.includes(e.states[t].state)),bt=async(e,t,r,n)=>{var i;let a;if("double_tap"===n&&r.double_tap_action?a=r.double_tap_action:"hold"===n&&r.hold_action?a=r.hold_action:"tap"===n&&r.tap_action&&(a=r.tap_action),a||(a={action:"more-info"}),a.confirmation&&(!a.confirmation.exemptions||!a.confirmation.exemptions.some((e=>e.user===t.user.id)))){let e;if(mt("warning"),"call-service"===a.action){const[r,n]=a.service.split(".",2),i=t.services;if(r in i&&n in i[r]){e=`${((e,t,r)=>e(`component.${t}.title`)||(null==r?void 0:r.name)||t)(await t.loadBackendTranslation("title"),r)}: ${i[r][n].name||n}`}}if(!confirm(a.confirmation.text||t.localize("ui.panel.lovelace.cards.actions.action_confirmation","action",e||t.localize("ui.panel.lovelace.editor.action-editor.actions."+a.action)||a.action)))return}switch(a.action){case"more-info":r.entity||r.camera_image?Se(e,"hass-more-info",{entityId:r.entity?r.entity:r.camera_image}):(vt(e,{message:t.localize("ui.panel.lovelace.cards.actions.no_entity_more_info")}),mt("failure"));break;case"navigate":a.navigation_path?((e,t)=>{var r;const n=(null==t?void 0:t.replace)||!1;n?Ee.history.replaceState((null===(r=Ee.history.state)||void 0===r?void 0:r.root)?{root:!0}:null,"",e):Ee.history.pushState(null,"",e),Se(Ee,"location-changed",{replace:n})})(a.navigation_path):(vt(e,{message:t.localize("ui.panel.lovelace.cards.actions.no_navigation_path")}),mt("failure"));break;case"url":a.url_path?window.open(a.url_path):(vt(e,{message:t.localize("ui.panel.lovelace.cards.actions.no_url")}),mt("failure"));break;case"toggle":r.entity?(ft(t,r.entity),mt("light")):(vt(e,{message:t.localize("ui.panel.lovelace.cards.actions.no_entity_toggle")}),mt("failure"));break;case"call-service":{if(!a.service)return vt(e,{message:t.localize("ui.panel.lovelace.cards.actions.no_service")}),void mt("failure");const[r,n]=a.service.split(".",2);t.callService(r,n,null!==(i=a.data)&&void 0!==i?i:a.service_data,a.target),mt("light");break}case"fire-dom-event":Se(e,"ll-custom",a)}},vt=(e,t)=>Se(e,"hass-notification",t);function yt(e){return void 0!==e&&"none"!==e.action}const _t=lt({user:ut()}),wt=ht([it(),lt({text:ct(ut()),excemptions:ct(nt(_t))})]),$t=lt({action:ot("url"),url_path:ut(),confirmation:ct(wt)}),kt=lt({action:ot("call-service"),service:ut(),service_data:ct(lt()),data:ct(lt()),target:ct(lt({entity_id:ct(ht([ut(),nt(ut())])),device_id:ct(ht([ut(),nt(ut())])),area_id:ct(ht([ut(),nt(ut())]))})),confirmation:ct(wt)}),xt=lt({action:ot("navigate"),navigation_path:ut(),confirmation:ct(wt)}),At=dt({action:ot("fire-dom-event")}),St=lt({action:at(["none","toggle","more-info","call-service","url","navigate"]),confirmation:ct(wt)}),Et=(Mt=e=>{if(e&&"object"==typeof e&&"action"in e)switch(e.action){case"call-service":return kt;case"fire-dom-event":return At;case"navigate":return xt;case"url":return $t}return St},new Qe({type:"dynamic",schema:null,*entries(e,t){const r=Mt(e,t);yield*r.entries(e,t)},validator:(e,t)=>Mt(e,t).validator(e,t),coercer:(e,t)=>Mt(e,t).coercer(e,t),refiner:(e,t)=>Mt(e,t).refiner(e,t)}));var Mt;s`
#sortable a:nth-of-type(2n) paper-icon-item {
animation-name: keyframes1;
animation-iteration-count: infinite;
transform-origin: 50% 10%;
animation-delay: -0.75s;
animation-duration: 0.25s;
}
#sortable a:nth-of-type(2n-1) paper-icon-item {
animation-name: keyframes2;
animation-iteration-count: infinite;
animation-direction: alternate;
transform-origin: 30% 5%;
animation-delay: -0.5s;
animation-duration: 0.33s;
}
#sortable a {
height: 48px;
display: flex;
}
#sortable {
outline: none;
display: block !important;
}
.hidden-panel {
display: flex !important;
}
.sortable-fallback {
display: none;
}
.sortable-ghost {
opacity: 0.4;
}
.sortable-fallback {
opacity: 0;
}
@keyframes keyframes1 {
0% {
transform: rotate(-1deg);
animation-timing-function: ease-in;
}
50% {
transform: rotate(1.5deg);
animation-timing-function: ease-out;
}
}
@keyframes keyframes2 {
0% {
transform: rotate(1deg);
animation-timing-function: ease-in;
}
50% {
transform: rotate(-1.5deg);
animation-timing-function: ease-out;
}
}
.show-panel,
.hide-panel {
display: none;
position: absolute;
top: 0;
right: 4px;
--mdc-icon-button-size: 40px;
}
:host([rtl]) .show-panel {
right: initial;
left: 4px;
}
.hide-panel {
top: 4px;
right: 8px;
}
:host([rtl]) .hide-panel {
right: initial;
left: 8px;
}
:host([expanded]) .hide-panel {
display: block;
}
:host([expanded]) .show-panel {
display: inline-flex;
}
paper-icon-item.hidden-panel,
paper-icon-item.hidden-panel span,
paper-icon-item.hidden-panel ha-icon[slot="item-icon"] {
color: var(--secondary-text-color);
cursor: pointer;
}
`;let Ct=class extends te{disconnectedCallback(){super.disconnectedCallback(),this._clearTimeout()}connectedCallback(){super.connectedCallback(),this.datetime&&this._updateRelative()}createRenderRoot(){return this}firstUpdated(e){super.firstUpdated(e),this._updateRelative()}update(e){super.update(e),this._updateRelative()}_clearTimeout(){this._timeout&&(window.clearInterval(this._timeout),this._timeout=void 0)}_updateRelative(){this.datetime?(this.innerHTML=this._GetLabel(new Date(this.datetime)),this._timeout=setTimeout((()=>this._updateRelative()),1e3)):this.innerHTML=this.hass.localize("ui.components.relative_time.never")}_GetLabel(e){if(!e)return this.hass.localize("ui.components.relative_time.never");try{const t=e.getTime()-(new Date).getTime();if(t<=0)return this._clearTimeout(),this.timeup_message||"Time's Up!";const r=Math.floor(t/864e5),n=Math.floor(t%864e5/36e5),i=Math.floor(t%36e5/6e4),a=Math.floor(t%6e4/1e3);return`${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(a).padStart(2,"0")}`.replace(/00:/g,"")}catch(e){return""}}};function zt(e){return e.vertical?"vertical":"default"}function Ot(e){return e.hide_icon?"none":e.use_entity_picture||e.use_media_artwork?"entity-picture":"icon"}function Nt(e){return e.hide_name?"none":"name"}function Tt(e){return e.hide_state?"none":"state"}t([ae({attribute:!1})],Ct.prototype,"hass",void 0),t([ae({attribute:!1})],Ct.prototype,"datetime",void 0),t([ae({attribute:!1})],Ct.prototype,"timeup_message",void 0),Ct=t([ne("mushroom-time-countdown")],Ct);var jt={},Pt={get exports(){return jt},set exports(e){jt=e}},Ut={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Dt={},It={get exports(){return Dt},set exports(e){Dt=e}},Ht=function(e){return!(!e||"string"==typeof e)&&(e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&"String"!==e.constructor.name))},Ft=Array.prototype.concat,Rt=Array.prototype.slice,Lt=It.exports=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];Ht(i)?t=Ft.call(t,Rt.call(i)):t.push(i)}return t};Lt.wrap=function(e){return function(){return e(Lt(arguments))}};var Bt=Ut,qt=Dt,Vt=Object.hasOwnProperty,Wt={};for(var Jt in Bt)Vt.call(Bt,Jt)&&(Wt[Bt[Jt]]=Jt);var Gt=Pt.exports={to:{},get:{}};function Kt(e,t,r){return Math.min(Math.max(t,e),r)}function Zt(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}Gt.get=function(e){var t,r;switch(e.substring(0,3).toLowerCase()){case"hsl":t=Gt.get.hsl(e),r="hsl";break;case"hwb":t=Gt.get.hwb(e),r="hwb";break;default:t=Gt.get.rgb(e),r="rgb"}return t?{model:r,value:t}:null},Gt.get.rgb=function(e){if(!e)return null;var t,r,n,i=[0,0,0,1];if(t=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(n=t[2],t=t[1],r=0;r<3;r++){var a=2*r;i[r]=parseInt(t.slice(a,a+2),16)}n&&(i[3]=parseInt(n,16)/255)}else if(t=e.match(/^#([a-f0-9]{3,4})$/i)){for(n=(t=t[1])[3],r=0;r<3;r++)i[r]=parseInt(t[r]+t[r],16);n&&(i[3]=parseInt(n+n,16)/255)}else if(t=e.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(r=0;r<3;r++)i[r]=parseInt(t[r+1],0);t[4]&&(t[5]?i[3]=.01*parseFloat(t[4]):i[3]=parseFloat(t[4]))}else{if(!(t=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(t=e.match(/^(\w+)$/))?"transparent"===t[1]?[0,0,0,0]:Vt.call(Bt,t[1])?((i=Bt[t[1]])[3]=1,i):null:null;for(r=0;r<3;r++)i[r]=Math.round(2.55*parseFloat(t[r+1]));t[4]&&(t[5]?i[3]=.01*parseFloat(t[4]):i[3]=parseFloat(t[4]))}for(r=0;r<3;r++)i[r]=Kt(i[r],0,255);return i[3]=Kt(i[3],0,1),i},Gt.get.hsl=function(e){if(!e)return null;var t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,Kt(parseFloat(t[2]),0,100),Kt(parseFloat(t[3]),0,100),Kt(isNaN(r)?1:r,0,1)]}return null},Gt.get.hwb=function(e){if(!e)return null;var t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,Kt(parseFloat(t[2]),0,100),Kt(parseFloat(t[3]),0,100),Kt(isNaN(r)?1:r,0,1)]}return null},Gt.to.hex=function(){var e=qt(arguments);return"#"+Zt(e[0])+Zt(e[1])+Zt(e[2])+(e[3]<1?Zt(Math.round(255*e[3])):"")},Gt.to.rgb=function(){var e=qt(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},Gt.to.rgb.percent=function(){var e=qt(arguments),t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"},Gt.to.hsl=function(){var e=qt(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},Gt.to.hwb=function(){var e=qt(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},Gt.to.keyword=function(e){return Wt[e.slice(0,3)]};const Yt=Ut,Qt={};for(const e of Object.keys(Yt))Qt[Yt[e]]=e;const Xt={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var er=Xt;for(const e of Object.keys(Xt)){if(!("channels"in Xt[e]))throw new Error("missing channels property: "+e);if(!("labels"in Xt[e]))throw new Error("missing channel labels property: "+e);if(Xt[e].labels.length!==Xt[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:r}=Xt[e];delete Xt[e].channels,delete Xt[e].labels,Object.defineProperty(Xt[e],"channels",{value:t}),Object.defineProperty(Xt[e],"labels",{value:r})}function tr(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}Xt.rgb.hsl=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=a-i;let s,l;a===i?s=0:t===a?s=(r-n)/o:r===a?s=2+(n-t)/o:n===a&&(s=4+(t-r)/o),s=Math.min(60*s,360),s<0&&(s+=360);const c=(i+a)/2;return l=a===i?0:c<=.5?o/(a+i):o/(2-a-i),[s,100*l,100*c]},Xt.rgb.hsv=function(e){let t,r,n,i,a;const o=e[0]/255,s=e[1]/255,l=e[2]/255,c=Math.max(o,s,l),u=c-Math.min(o,s,l),d=function(e){return(c-e)/6/u+.5};return 0===u?(i=0,a=0):(a=u/c,t=d(o),r=d(s),n=d(l),o===c?i=n-r:s===c?i=1/3+t-n:l===c&&(i=2/3+r-t),i<0?i+=1:i>1&&(i-=1)),[360*i,100*a,100*c]},Xt.rgb.hwb=function(e){const t=e[0],r=e[1];let n=e[2];const i=Xt.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(r,n));return n=1-1/255*Math.max(t,Math.max(r,n)),[i,100*a,100*n]},Xt.rgb.cmyk=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.min(1-t,1-r,1-n);return[100*((1-t-i)/(1-i)||0),100*((1-r-i)/(1-i)||0),100*((1-n-i)/(1-i)||0),100*i]},Xt.rgb.keyword=function(e){const t=Qt[e];if(t)return t;let r,n=1/0;for(const t of Object.keys(Yt)){const i=tr(e,Yt[t]);i<n&&(n=i,r=t)}return r},Xt.keyword.rgb=function(e){return Yt[e]},Xt.rgb.xyz=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;return[100*(.4124*t+.3576*r+.1805*n),100*(.2126*t+.7152*r+.0722*n),100*(.0193*t+.1192*r+.9505*n)]},Xt.rgb.lab=function(e){const t=Xt.rgb.xyz(e);let r=t[0],n=t[1],i=t[2];r/=95.047,n/=100,i/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;return[116*n-16,500*(r-n),200*(n-i)]},Xt.hsl.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;let i,a,o;if(0===r)return o=255*n,[o,o,o];i=n<.5?n*(1+r):n+r-n*r;const s=2*n-i,l=[0,0,0];for(let e=0;e<3;e++)a=t+1/3*-(e-1),a<0&&a++,a>1&&a--,o=6*a<1?s+6*(i-s)*a:2*a<1?i:3*a<2?s+(i-s)*(2/3-a)*6:s,l[e]=255*o;return l},Xt.hsl.hsv=function(e){const t=e[0];let r=e[1]/100,n=e[2]/100,i=r;const a=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,i*=a<=1?a:2-a;return[t,100*(0===n?2*i/(a+i):2*r/(n+r)),100*((n+r)/2)]},Xt.hsv.rgb=function(e){const t=e[0]/60,r=e[1]/100;let n=e[2]/100;const i=Math.floor(t)%6,a=t-Math.floor(t),o=255*n*(1-r),s=255*n*(1-r*a),l=255*n*(1-r*(1-a));switch(n*=255,i){case 0:return[n,l,o];case 1:return[s,n,o];case 2:return[o,n,l];case 3:return[o,s,n];case 4:return[l,o,n];case 5:return[n,o,s]}},Xt.hsv.hsl=function(e){const t=e[0],r=e[1]/100,n=e[2]/100,i=Math.max(n,.01);let a,o;o=(2-r)*n;const s=(2-r)*i;return a=r*i,a/=s<=1?s:2-s,a=a||0,o/=2,[t,100*a,100*o]},Xt.hwb.rgb=function(e){const t=e[0]/360;let r=e[1]/100,n=e[2]/100;const i=r+n;let a;i>1&&(r/=i,n/=i);const o=Math.floor(6*t),s=1-n;a=6*t-o,0!=(1&o)&&(a=1-a);const l=r+a*(s-r);let c,u,d;switch(o){default:case 6:case 0:c=s,u=l,d=r;break;case 1:c=l,u=s,d=r;break;case 2:c=r,u=s,d=l;break;case 3:c=r,u=l,d=s;break;case 4:c=l,u=r,d=s;break;case 5:c=s,u=r,d=l}return[255*c,255*u,255*d]},Xt.cmyk.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100,i=e[3]/100;return[255*(1-Math.min(1,t*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i)),255*(1-Math.min(1,n*(1-i)+i))]},Xt.xyz.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100;let i,a,o;return i=3.2406*t+-1.5372*r+-.4986*n,a=-.9689*t+1.8758*r+.0415*n,o=.0557*t+-.204*r+1.057*n,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[255*i,255*a,255*o]},Xt.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;return[116*r-16,500*(t-r),200*(r-n)]},Xt.lab.xyz=function(e){let t,r,n;r=(e[0]+16)/116,t=e[1]/500+r,n=r-e[2]/200;const i=r**3,a=t**3,o=n**3;return r=i>.008856?i:(r-16/116)/7.787,t=a>.008856?a:(t-16/116)/7.787,n=o>.008856?o:(n-16/116)/7.787,t*=95.047,r*=100,n*=108.883,[t,r,n]},Xt.lab.lch=function(e){const t=e[0],r=e[1],n=e[2];let i;i=360*Math.atan2(n,r)/2/Math.PI,i<0&&(i+=360);return[t,Math.sqrt(r*r+n*n),i]},Xt.lch.lab=function(e){const t=e[0],r=e[1],n=e[2]/360*2*Math.PI;return[t,r*Math.cos(n),r*Math.sin(n)]},Xt.rgb.ansi16=function(e,t=null){const[r,n,i]=e;let a=null===t?Xt.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),0===a)return 30;let o=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return 2===a&&(o+=60),o},Xt.hsv.ansi16=function(e){return Xt.rgb.ansi16(Xt.hsv.rgb(e),e[2])},Xt.rgb.ansi256=function(e){const t=e[0],r=e[1],n=e[2];if(t===r&&r===n)return t<8?16:t>248?231:Math.round((t-8)/247*24)+232;return 16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},Xt.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const r=.5*(1+~~(e>50));return[(1&t)*r*255,(t>>1&1)*r*255,(t>>2&1)*r*255]},Xt.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;e-=16;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},Xt.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},Xt.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let r=t[0];3===t[0].length&&(r=r.split("").map((e=>e+e)).join(""));const n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},Xt.rgb.hcg=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.max(Math.max(t,r),n),a=Math.min(Math.min(t,r),n),o=i-a;let s,l;return s=o<1?a/(1-o):0,l=o<=0?0:i===t?(r-n)/o%6:i===r?2+(n-t)/o:4+(t-r)/o,l/=6,l%=1,[360*l,100*o,100*s]},Xt.hsl.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=r<.5?2*t*r:2*t*(1-r);let i=0;return n<1&&(i=(r-.5*n)/(1-n)),[e[0],100*n,100*i]},Xt.hsv.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=t*r;let i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],100*n,100*i]},Xt.hcg.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;if(0===r)return[255*n,255*n,255*n];const i=[0,0,0],a=t%1*6,o=a%1,s=1-o;let l=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return l=(1-r)*n,[255*(r*i[0]+l),255*(r*i[1]+l),255*(r*i[2]+l)]},Xt.hcg.hsv=function(e){const t=e[1]/100,r=t+e[2]/100*(1-t);let n=0;return r>0&&(n=t/r),[e[0],100*n,100*r]},Xt.hcg.hsl=function(e){const t=e[1]/100,r=e[2]/100*(1-t)+.5*t;let n=0;return r>0&&r<.5?n=t/(2*r):r>=.5&&r<1&&(n=t/(2*(1-r))),[e[0],100*n,100*r]},Xt.hcg.hwb=function(e){const t=e[1]/100,r=t+e[2]/100*(1-t);return[e[0],100*(r-t),100*(1-r)]},Xt.hwb.hcg=function(e){const t=e[1]/100,r=1-e[2]/100,n=r-t;let i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],100*n,100*i]},Xt.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},Xt.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},Xt.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},Xt.gray.hsl=function(e){return[0,0,e[0]]},Xt.gray.hsv=Xt.gray.hsl,Xt.gray.hwb=function(e){return[0,100,e[0]]},Xt.gray.cmyk=function(e){return[0,0,0,e[0]]},Xt.gray.lab=function(e){return[e[0],0,0]},Xt.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r},Xt.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};const rr=er;function nr(e){const t=function(){const e={},t=Object.keys(rr);for(let r=t.length,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}(),r=[e];for(t[e].distance=0;r.length;){const e=r.pop(),n=Object.keys(rr[e]);for(let i=n.length,a=0;a<i;a++){const i=n[a],o=t[i];-1===o.distance&&(o.distance=t[e].distance+1,o.parent=e,r.unshift(i))}}return t}function ir(e,t){return function(r){return t(e(r))}}function ar(e,t){const r=[t[e].parent,e];let n=rr[t[e].parent][e],i=t[e].parent;for(;t[i].parent;)r.unshift(t[i].parent),n=ir(rr[t[i].parent][i],n),i=t[i].parent;return n.conversion=r,n}const or=er,sr=function(e){const t=nr(e),r={},n=Object.keys(t);for(let e=n.length,i=0;i<e;i++){const e=n[i];null!==t[e].parent&&(r[e]=ar(e,t))}return r},lr={};Object.keys(or).forEach((e=>{lr[e]={},Object.defineProperty(lr[e],"channels",{value:or[e].channels}),Object.defineProperty(lr[e],"labels",{value:or[e].labels});const t=sr(e);Object.keys(t).forEach((r=>{const n=t[r];lr[e][r]=function(e){const t=function(...t){const r=t[0];if(null==r)return r;r.length>1&&(t=r);const n=e(t);if("object"==typeof n)for(let e=n.length,t=0;t<e;t++)n[t]=Math.round(n[t]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}(n),lr[e][r].raw=function(e){const t=function(...t){const r=t[0];return null==r?r:(r.length>1&&(t=r),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(n)}))}));const cr=jt,ur=lr,dr=["keyword","gray","hex"],hr={};for(const e of Object.keys(ur))hr[[...ur[e].labels].sort().join("")]=e;const mr={};function pr(e,t){if(!(this instanceof pr))return new pr(e,t);if(t&&t in dr&&(t=null),t&&!(t in ur))throw new Error("Unknown model: "+t);let r,n;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof pr)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if("string"==typeof e){const t=cr.get(e);if(null===t)throw new Error("Unable to parse color from string: "+e);this.model=t.model,n=ur[this.model].channels,this.color=t.value.slice(0,n),this.valpha="number"==typeof t.value[n]?t.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=ur[this.model].channels;const r=Array.prototype.slice.call(e,0,n);this.color=vr(r,n),this.valpha="number"==typeof e[n]?e[n]:1}else if("number"==typeof e)this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;const t=Object.keys(e);"alpha"in e&&(t.splice(t.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);const n=t.sort().join("");if(!(n in hr))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=hr[n];const{labels:i}=ur[this.model],a=[];for(r=0;r<i.length;r++)a.push(e[i[r]]);this.color=vr(a)}if(mr[this.model])for(n=ur[this.model].channels,r=0;r<n;r++){const e=mr[this.model][r];e&&(this.color[r]=e(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}pr.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in cr.to?this:this.rgb();t=t.round("number"==typeof e?e:1);const r=1===t.valpha?t.color:[...t.color,this.valpha];return cr.to[t.model](r)},percentString(e){const t=this.rgb().round("number"==typeof e?e:1),r=1===t.valpha?t.color:[...t.color,this.valpha];return cr.to.rgb.percent(r)},array(){return 1===this.valpha?[...this.color]:[...this.color,this.valpha]},object(){const e={},{channels:t}=ur[this.model],{labels:r}=ur[this.model];for(let n=0;n<t;n++)e[r[n]]=this.color[n];return 1!==this.valpha&&(e.alpha=this.valpha),e},unitArray(){const e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,1!==this.valpha&&e.push(this.valpha),e},unitObject(){const e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,1!==this.valpha&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new pr([...this.color.map(gr(e)),this.valpha],this.model)},alpha(e){return void 0!==e?new pr([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:fr("rgb",0,br(255)),green:fr("rgb",1,br(255)),blue:fr("rgb",2,br(255)),hue:fr(["hsl","hsv","hsl","hwb","hcg"],0,(e=>(e%360+360)%360)),saturationl:fr("hsl",1,br(100)),lightness:fr("hsl",2,br(100)),saturationv:fr("hsv",1,br(100)),value:fr("hsv",2,br(100)),chroma:fr("hcg",1,br(100)),gray:fr("hcg",2,br(100)),white:fr("hwb",1,br(100)),wblack:fr("hwb",2,br(100)),cyan:fr("cmyk",0,br(100)),magenta:fr("cmyk",1,br(100)),yellow:fr("cmyk",2,br(100)),black:fr("cmyk",3,br(100)),x:fr("xyz",0,br(95.047)),y:fr("xyz",1,br(100)),z:fr("xyz",2,br(108.833)),l:fr("lab",0,br(100)),a:fr("lab",1),b:fr("lab",2),keyword(e){return void 0!==e?new pr(e):ur[this.model].keyword(this.color)},hex(e){return void 0!==e?new pr(e):cr.to.hex(this.rgb().round().color)},hexa(e){if(void 0!==e)return new pr(e);const t=this.rgb().round().color;let r=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===r.length&&(r="0"+r),cr.to.hex(t)+r},rgbNumber(){const e=this.rgb().color;return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},luminosity(){const e=this.rgb().color,t=[];for(const[r,n]of e.entries()){const e=n/255;t[r]=e<=.04045?e/12.92:((e+.055)/1.055)**2.4}return.2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(2126*e[0]+7152*e[1]+722*e[2])/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return pr.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const r=e.rgb(),n=this.rgb(),i=void 0===t?.5:t,a=2*i-1,o=r.alpha()-n.alpha(),s=((a*o==-1?a:(a+o)/(1+a*o))+1)/2,l=1-s;return pr.rgb(s*r.red()+l*n.red(),s*r.green()+l*n.green(),s*r.blue()+l*n.blue(),r.alpha()*i+n.alpha()*(1-i))}};for(const e of Object.keys(ur)){if(dr.includes(e))continue;const{channels:t}=ur[e];pr.prototype[e]=function(...t){return this.model===e?new pr(this):t.length>0?new pr(t,e):new pr([...(r=ur[this.model][e].raw(this.color),Array.isArray(r)?r:[r]),this.valpha],e);var r},pr[e]=function(...r){let n=r[0];return"number"==typeof n&&(n=vr(r,t)),new pr(n,e)}}function gr(e){return function(t){return function(e,t){return Number(e.toFixed(t))}(t,e)}}function fr(e,t,r){e=Array.isArray(e)?e:[e];for(const n of e)(mr[n]||(mr[n]=[]))[t]=r;return e=e[0],function(n){let i;return void 0!==n?(r&&(n=r(n)),i=this[e](),i.color[t]=n,i):(i=this[e]().color[t],r&&(i=r(i)),i)}}function br(e){return function(t){return Math.max(0,Math.min(e,t))}}function vr(e,t){for(let r=0;r<t;r++)"number"!=typeof e[r]&&(e[r]=0);return e}var yr=pr;const _r=["red","pink","purple","deep-purple","indigo","blue","light-blue","cyan","teal","green","light-green","lime","yellow","amber","orange","deep-orange","brown","grey","blue-grey","black","white","disabled"];const wr=s`
--default-red: 244, 67, 54;
--default-pink: 233, 30, 99;
--default-purple: 156, 39, 176;
--default-deep-purple: 103, 58, 183;
--default-indigo: 63, 81, 181;
--default-blue: 33, 150, 243;
--default-light-blue: 3, 169, 244;
--default-cyan: 0, 188, 212;
--default-teal: 0, 150, 136;
--default-green: 76, 175, 80;
--default-light-green: 139, 195, 74;
--default-lime: 205, 220, 57;
--default-yellow: 255, 235, 59;
--default-amber: 255, 193, 7;
--default-orange: 255, 152, 0;
--default-deep-orange: 255, 87, 34;
--default-brown: 121, 85, 72;
--default-grey: 158, 158, 158;
--default-blue-grey: 96, 125, 139;
--default-black: 0, 0, 0;
--default-white: 255, 255, 255;
--default-disabled: 189, 189, 189;
`,$r=s`
--default-disabled: 111, 111, 111;
`,kr=s`
--spacing: var(--mush-spacing, 12px);
/* Title */
--title-padding: var(--mush-title-padding, 24px 12px 16px);
--title-spacing: var(--mush-title-spacing, 12px);
--title-font-size: var(--mush-title-font-size, 24px);
--title-font-weight: var(--mush-title-font-weight, normal);
--title-line-height: var(--mush-title-line-height, 1.2);
--subtitle-font-size: var(--mush-subtitle-font-size, 16px);
--subtitle-font-weight: var(--mush-subtitle-font-weight, normal);
--subtitle-line-height: var(--mush-subtitle-line-height, 1.2);
/* Card */
--card-primary-font-size: var(--mush-card-primary-font-size, 14px);
--card-secondary-font-size: var(--mush-card-secondary-font-size, 12px);
--card-primary-font-weight: var(--mush-card-primary-font-weight, bold);
--card-secondary-font-weight: var(--mush-card-secondary-font-weight, bolder);
--card-primary-line-height: var(--mush-card-primary-line-height, 1.5);
--card-secondary-line-height: var(--mush-card-secondary-line-height, 1.5);
/* Chips */
--chip-spacing: var(--mush-chip-spacing, 8px);
--chip-padding: var(--mush-chip-padding, 0 0.25em);
--chip-height: var(--mush-chip-height, 36px);
--chip-border-radius: var(--mush-chip-border-radius, 19px);
--chip-border-width: var(--mush-chip-border-width, var(--ha-card-border-width, 1px));
--chip-border-color: var(
--mush-chip-border-color,
var(--ha-card-border-color, var(--divider-color))
);
--chip-box-shadow: var(--mush-chip-box-shadow, var(--ha-card-box-shadow, "none"));
--chip-font-size: var(--mush-chip-font-size, 0.3em);
--chip-font-weight: var(--mush-chip-font-weight, bold);
--chip-icon-size: var(--mush-chip-icon-size, 0.5em);
--chip-avatar-padding: var(--mush-chip-avatar-padding, 0.1em);
--chip-avatar-border-radius: var(--mush-chip-avatar-border-radius, 50%);
--chip-background: var(
--mush-chip-background,
var(--ha-card-background, var(--card-background-color, white))
);
/* Controls */
--control-border-radius: var(--mush-control-border-radius, 12px);
--control-height: var(--mush-control-height, 42px);
--control-button-ratio: var(--mush-control-button-ratio, 1);
--control-icon-size: var(--mush-control-icon-size, 0.5em);
/* Slider */
--slider-threshold: var(--mush-slider-threshold);
/* Input Number */
--input-number-debounce: var(--mush-input-number-debounce);
/* Layout */
--layout-align: var(--mush-layout-align, center);
/* Badge */
--badge-size: var(--mush-badge-size, 16px);
--badge-icon-size: var(--mush-badge-icon-size, 0.75em);
--badge-border-radius: var(--mush-badge-border-radius, 50%);
/* Icon */
--icon-border-radius: var(--mush-icon-border-radius, 50%);
--icon-size: var(--mush-icon-size, 42px);
--icon-symbol-size: var(--mush-icon-symbol-size, 0.5em);
`,xr=s`
/* RGB */
/* Standard colors */
--rgb-red: var(--mush-rgb-red, var(--default-red));
--rgb-pink: var(--mush-rgb-pink, var(--default-pink));
--rgb-purple: var(--mush-rgb-purple, var(--default-purple));
--rgb-deep-purple: var(--mush-rgb-deep-purple, var(--default-deep-purple));
--rgb-indigo: var(--mush-rgb-indigo, var(--default-indigo));
--rgb-blue: var(--mush-rgb-blue, var(--default-blue));
--rgb-light-blue: var(--mush-rgb-light-blue, var(--default-light-blue));
--rgb-cyan: var(--mush-rgb-cyan, var(--default-cyan));
--rgb-teal: var(--mush-rgb-teal, var(--default-teal));
--rgb-green: var(--mush-rgb-green, var(--default-green));
--rgb-light-green: var(--mush-rgb-light-green, var(--default-light-green));
--rgb-lime: var(--mush-rgb-lime, var(--default-lime));
--rgb-yellow: var(--mush-rgb-yellow, var(--default-yellow));
--rgb-amber: var(--mush-rgb-amber, var(--default-amber));
--rgb-orange: var(--mush-rgb-orange, var(--default-orange));
--rgb-deep-orange: var(--mush-rgb-deep-orange, var(--default-deep-orange));
--rgb-brown: var(--mush-rgb-brown, var(--default-brown));
--rgb-grey: var(--mush-rgb-grey, var(--default-grey));
--rgb-blue-grey: var(--mush-rgb-blue-grey, var(--default-blue-grey));
--rgb-black: var(--mush-rgb-black, var(--default-black));
--rgb-white: var(--mush-rgb-white, var(--default-white));
--rgb-disabled: var(--mush-rgb-disabled, var(--default-disabled));
/* Action colors */
--rgb-info: var(--mush-rgb-info, var(--rgb-blue));
--rgb-success: var(--mush-rgb-success, var(--rgb-green));
--rgb-warning: var(--mush-rgb-warning, var(--rgb-orange));
--rgb-danger: var(--mush-rgb-danger, var(--rgb-red));
/* State colors */
--rgb-state-vacuum: var(--mush-rgb-state-vacuum, var(--rgb-teal));
--rgb-state-fan: var(--mush-rgb-state-fan, var(--rgb-green));
--rgb-state-light: var(--mush-rgb-state-light, var(--rgb-orange));
--rgb-state-entity: var(--mush-rgb-state-entity, var(--rgb-blue));
--rgb-state-media-player: var(--mush-rgb-state-media-player, var(--rgb-indigo));
--rgb-state-lock: var(--mush-rgb-state-lock, var(--rgb-blue));
--rgb-state-number: var(--mush-rgb-state-number, var(--rgb-blue));
--rgb-state-humidifier: var(--mush-rgb-state-humidifier, var(--rgb-purple));
/* State alarm colors */
--rgb-state-alarm-disarmed: var(--mush-rgb-state-alarm-disarmed, var(--rgb-info));
--rgb-state-alarm-armed: var(--mush-rgb-state-alarm-armed, var(--rgb-success));
--rgb-state-alarm-triggered: var(--mush-rgb-state-alarm-triggered, var(--rgb-danger));
/* State person colors */
--rgb-state-person-home: var(--mush-rgb-state-person-home, var(--rgb-success));
--rgb-state-person-not-home: var(--mush-rgb-state-person-not-home, var(--rgb-danger));
--rgb-state-person-zone: var(--mush-rgb-state-person-zone, var(--rgb-info));
--rgb-state-person-unknown: var(--mush-rgb-state-person-unknown, var(--rgb-grey));
/* State update colors */
--rgb-state-update-on: var(--mush-rgb-state-update-on, var(--rgb-orange));
--rgb-state-update-off: var(--mush-rgb-update-off, var(--rgb-green));
--rgb-state-update-installing: var(--mush-rgb-update-installing, var(--rgb-blue));
/* State lock colors */
--rgb-state-lock-locked: var(--mush-rgb-state-lock-locked, var(--rgb-green));
--rgb-state-lock-unlocked: var(--mush-rgb-state-lock-unlocked, var(--rgb-red));
--rgb-state-lock-pending: var(--mush-rgb-state-lock-pending, var(--rgb-orange));
/* State cover colors */
--rgb-state-cover-open: var(--mush-rgb-state-cover-open, var(--rgb-blue));
--rgb-state-cover-closed: var(--mush-rgb-state-cover-closed, var(--rgb-disabled));
/* State climate colors */
--rgb-state-climate-auto: var(--mush-rgb-state-climate-auto, var(--rgb-green));
--rgb-state-climate-cool: var(--mush-rgb-state-climate-cool, var(--rgb-blue));
--rgb-state-climate-dry: var(--mush-rgb-state-climate-dry, var(--rgb-orange));
--rgb-state-climate-fan-only: var(--mush-rgb-state-climate-fan-only, var(--rgb-teal));
--rgb-state-climate-heat: var(--mush-rgb-state-climate-heat, var(--rgb-deep-orange));
--rgb-state-climate-heat-cool: var(--mush-rgb-state-climate-heat-cool, var(--rgb-green));
--rgb-state-climate-idle: var(--mush-rgb-state-climate-idle, var(--rgb-disabled));
--rgb-state-climate-off: var(--mush-rgb-state-climate-off, var(--rgb-disabled));
`;function Ar(e){return!!e&&e.themes.darkMode}class Sr extends te{updated(e){if(super.updated(e),e.has("hass")&&this.hass){const t=Ar(e.get("hass")),r=Ar(this.hass);t!==r&&this.toggleAttribute("dark-mode",r)}}static get styles(){return s`
:host {
${wr}
}
:host([dark-mode]) {
${$r}
}
:host {
${xr}
${kr}
}
`}}t([ae({attribute:!1})],Sr.prototype,"hass",void 0);const Er=["button","input_button","scene"],Mr=["name","state","last-changed","last-updated","none"];function Cr(e,t,r,n,i){switch(e){case"name":return t;case"state":const e=n.entity_id.split(".")[0];return"timestamp"!==n.attributes.device_class&&!Er.includes(e)||!Oe(n)||Ne(n)?r:U`
<ha-relative-time
.hass=${i}
.datetime=${n.state}
capitalize
></ha-relative-time>
`;case"last-changed":return U`
<ha-relative-time
.hass=${i}
.datetime=${n.last_changed}
capitalize
></ha-relative-time>
`;case"last-updated":return U`
<ha-relative-time
.hass=${i}
.datetime=${n.last_updated}
capitalize
></ha-relative-time>
`;case"none":return}}class zr extends Sr{renderPicture(e){return U`
<mushroom-shape-avatar
slot="icon"
.picture_url=${this.hass.hassUrl(e)}
></mushroom-shape-avatar>
`}renderIcon(e,t){const r=ze(e);return U`
<mushroom-shape-icon
slot="icon"
.disabled=${!r}
.icon=${t}
></mushroom-shape-icon>
`}renderBadge(e){return!Oe(e)?U`
<mushroom-badge-icon
class="unavailable"
slot="badge"
icon="mdi:help"
></mushroom-badge-icon>
`:null}renderStateInfo(e,t,r,n){const i=qe(this.hass.localize,e,this.hass.locale,this.hass.entities,this.hass.connection.haVersion),a=null!=n?n:i,o=Cr(t.primary_info,r,a,e,this.hass),s=Cr(t.secondary_info,r,a,e,this.hass);return U`
<mushroom-state-info
slot="info"
.primary=${o}
.secondary=${s}
></mushroom-state-info>
`}}const Or=s`
ha-card {
box-sizing: border-box;
padding: var(--spacing);
display: flex;
flex-direction: column;
justify-content: var(--layout-align);
height: auto;
}
ha-card.fill-container {
height: 100%;
}
.actions {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
overflow-x: auto;
overflow-y: hidden;
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE 10+ */
}
.actions::-webkit-scrollbar {
background: transparent; /* Chrome/Safari/Webkit */
height: 0px;
}
.actions *:not(:last-child) {
margin-right: var(--spacing);
}
.actions[rtl] *:not(:last-child) {
margin-right: initial;
margin-left: var(--spacing);
}
.unavailable {
--main-color: var(--warning-color);
}
`;const Nr={apparent_power:"mdi:flash",aqi:"mdi:air-filter",atmospheric_pressure:"mdi:thermometer-lines",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",data_rate:"mdi:transmission-tower",data_size:"mdi:database",date:"mdi:calendar",distance:"mdi:arrow-left-right",duration:"mdi:progress-clock",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:meter-gas",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",irradiance:"mdi:sun-wireless",moisture:"mdi:water-percent",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",precipitation:"mdi:weather-rainy",precipitation_intensity:"mdi:weather-pouring",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sound_pressure:"mdi:ear-hearing",speed:"mdi:speedometer",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave",volume:"mdi:car-coolant-level",water:"mdi:water",weight:"mdi:weight",wind_speed:"mdi:weather-windy"},Tr={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},jr={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},Pr=(e,t)=>{const r=Number(e);if(isNaN(r))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const n=10*Math.round(r/10);return t&&r>=10?jr[n]:t?"mdi:battery-charging-outline":r<=5?"mdi:battery-alert-variant-outline":Tr[n]},Ur=e=>{const t=null==e?void 0:e.attributes.device_class;if(t&&t in Nr)return Nr[t];if("battery"===t)return e?((e,t)=>{const r=e.state,n="on"===(null==t?void 0:t.state);return Pr(r,n)})(e):"mdi:battery";const r=null==e?void 0:e.attributes.unit_of_measurement;return"°C"===r||"°F"===r?"mdi:thermometer":void 0},Dr={"clear-night":"mdi:weather-night",cloudy:"mdi:weather-cloudy",exceptional:"mdi:alert-circle-outline",fog:"mdi:weather-fog",hail:"mdi:weather-hail",lightning:"mdi:weather-lightning","lightning-rainy":"mdi:weather-lightning-rainy",partlycloudy:"mdi:weather-partly-cloudy",pouring:"mdi:weather-pouring",rainy:"mdi:weather-rainy",snowy:"mdi:weather-snowy","snowy-rainy":"mdi:weather-snowy-rainy",sunny:"mdi:weather-sunny",windy:"mdi:weather-windy","windy-variant":"mdi:weather-windy-variant"},Ir={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",zone:"mdi:map-marker-radius"};function Hr(e,t,r){const n=void 0!==r?r:null==t?void 0:t.state;switch(e){case"alarm_control_panel":return(e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}})(n);case"binary_sensor":return((e,t)=>{const r="off"===e;switch(null==t?void 0:t.attributes.device_class){case"battery":return r?"mdi:battery":"mdi:battery-outline";case"battery_charging":return r?"mdi:battery":"mdi:battery-charging";case"carbon_monoxide":return r?"mdi:smoke-detector":"mdi:smoke-detector-alert";case"cold":return r?"mdi:thermometer":"mdi:snowflake";case"connectivity":return r?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return r?"mdi:door-closed":"mdi:door-open";case"garage_door":return r?"mdi:garage":"mdi:garage-open";case"power":case"plug":return r?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return r?"mdi:check-circle":"mdi:alert-circle";case"smoke":return r?"mdi:smoke-detector-variant":"mdi:smoke-detector-variant-alert";case"heat":return r?"mdi:thermometer":"mdi:fire";case"light":return r?"mdi:brightness-5":"mdi:brightness-7";case"lock":return r?"mdi:lock":"mdi:lock-open";case"moisture":return r?"mdi:water-off":"mdi:water";case"motion":return r?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return r?"mdi:home-outline":"mdi:home";case"opening":return r?"mdi:square":"mdi:square-outline";case"running":return r?"mdi:stop":"mdi:play";case"sound":return r?"mdi:music-note-off":"mdi:music-note";case"update":return r?"mdi:package":"mdi:package-up";case"vibration":return r?"mdi:crop-portrait":"mdi:vibrate";case"window":return r?"mdi:window-closed":"mdi:window-open";default:return r?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}})(n,t);case"button":switch(null==t?void 0:t.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return((e,t)=>{const r="closed"!==e;switch(null==t?void 0:t.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return r?"mdi:door-open":"mdi:door-closed";case"damper":return r?"mdi:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds-horizontal-closed";default:return"mdi:blinds-horizontal"}case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:roller-shade-closed";default:return"mdi:roller-shade"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}})(n,t);case"device_tracker":return"router"===(null==t?void 0:t.attributes.source_type)?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(null==t?void 0:t.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"input_datetime":if(!(null==t?void 0:t.attributes.has_date))return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(null==t?void 0:t.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}case"receiver":return"off"===n?"mdi:audio-video-off":"mdi:audio-video";default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"person":return"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"switch":switch(null==t?void 0:t.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch-variant":"mdi:toggle-switch-variant-off";default:return"mdi:toggle-switch-variant"}case"sensor":{const e=Ur(t);if(e)return e;break}case"sun":return"above_horizon"===(null==t?void 0:t.state)?Ir[e]:"mdi:weather-night";case"switch_as_x":return"mdi:swap-horizontal";case"threshold":return"mdi:chart-sankey";case"update":return"on"===(null==t?void 0:t.state)?Pe(t)?"mdi:package-down":"mdi:package-up":"mdi:package";case"weather":return((e,t)=>e?t&&"partlycloudy"===e?"mdiWeatherNightPartlyCloudy":Dr[e]:void 0)(null==t?void 0:t.state)}return e in Ir?Ir[e]:"mdi:bookmark"}function Fr(e){if(e.attributes.icon)return e.attributes.icon;return Hr(Me(e.entity_id),e,e.state)}!function(t){const r=window;r.customCards=r.customCards||[];const n=t.type.replace("-card","").replace("mushroom-","");r.customCards.push(Object.assign(Object.assign({},t),{preview:!0,documentationURL:`${e}/blob/main/docs/cards/${n}.md`}))}({type:"mushroom-countdown-card",name:"Mushroom Countdown Card",description:"Card for entity that's state is a timestamp to count down to"});let Rr=class extends zr{static async getConfigElement(){return await Promise.resolve().then((function(){return tn})),document.createElement("mushroom-countdown-card-editor")}static async getStubConfig(e){return{type:"custom:mushroom-countdown-card",entity:Object.keys(e.states)[0]}}getCardSize(){return 1}setConfig(e){this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},e)}_handleAction(e){bt(this,this.hass,this._config,e.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return U``;const e=this._config.entity,t=this.hass.states[e],r=this._config.name||t.attributes.friendly_name||"",n=this._config.icon||Fr(t),i=(a=this._config,{layout:null!==(o=a.layout)&&void 0!==o?o:zt(a),fill_container:null!==(s=a.fill_container)&&void 0!==s&&s,primary_info:null!==(l=a.primary_info)&&void 0!==l?l:Nt(a),secondary_info:null!==(c=a.secondary_info)&&void 0!==c?c:Tt(a),icon_type:null!==(u=a.icon_type)&&void 0!==u?u:Ot(a)});var a,o,s,l,c,u;const d=function(e,t){return"entity-picture"===t?function(e){return e.attributes.entity_picture_local||e.attributes.entity_picture}(e):void 0}(t,i.icon_type),h=function(e){const t=e.language||"en";return e.translationMetadata.translations[t]&&e.translationMetadata.translations[t].isRTL||!1}(this.hass);return U`
<ha-card class=${de({"fill-container":i.fill_container})}>
<mushroom-card .appearance=${i} ?rtl=${h}>
<mushroom-state-item
?rtl=${h}
.appearance=${i}
@action=${this._handleAction}
.actionHandler=${gt({hasHold:yt(this._config.hold_action),hasDoubleClick:yt(this._config.double_tap_action)})}
>
${d?this.renderPicture(d):this.renderIcon(t,n)}
${this.renderBadge(t)}
${this.renderStateInfo(t,i,r)};
</mushroom-state-item>
</mushroom-card>
</ha-card>
`}renderStateInfo(e,t,r,n){var i,a,o,s,l,c;const u=qe(this.hass.localize,e,this.hass.locale,this.hass.entities,this.hass.connection.haVersion),d=null!=n?n:u;let h,m;return h="state"===t.primary_info&&"timestamp"===e.attributes.device_class&&Oe(e)&&!Ne(e)?U`
<mushroom-time-countdown
.hass=${this.hass}
.datetime=${e.state}
.timeup_message=${null===(i=this._config)||void 0===i?void 0:i.timeup_message}
></mushroom-time-countdown>
`:"state"===t.primary_info&&"timestamp"===e.attributes.device_class&&Oe(e)&&Ne(e)&&(null===(a=this._config)||void 0===a?void 0:a.unknown_message)?(null===(o=this._config)||void 0===o?void 0:o.unknown_message)||d:Cr(t.primary_info,r,d,e,this.hass),m="state"===t.secondary_info&&"timestamp"===e.attributes.device_class&&Oe(e)&&!Ne(e)?U`
<mushroom-time-countdown
.hass=${this.hass}
.datetime=${e.state}
.timeup_message=${null===(s=this._config)||void 0===s?void 0:s.timeup_message}
></mushroom-time-countdown>
`:"state"===t.secondary_info&&"timestamp"===e.attributes.device_class&&Oe(e)&&Ne(e)&&(null===(l=this._config)||void 0===l?void 0:l.unknown_message)?(null===(c=this._config)||void 0===c?void 0:c.unknown_message)||d:Cr(t.secondary_info,r,d,e,this.hass),U`
<mushroom-state-info
slot="info"
.primary=${h}
.secondary=${m}
></mushroom-state-info>
`}renderIcon(e,t){var r;const n=ze(e),i={},a=null===(r=this._config)||void 0===r?void 0:r.icon_color;if(a){const e=function(e){if(_r.includes(e))return`var(--rgb-${e})`;if(e.startsWith("#"))try{return yr.rgb(e).rgb().array().join(", ")}catch(e){return""}return e}(a);i["--icon-color"]=`rgb(${e})`,i["--shape-color"]=`rgba(${e}, 0.2)`}return U`
<mushroom-shape-icon
slot="icon"
.disabled=${!n}
.icon=${t}
style=${he(i)}
></mushroom-shape-icon>
`}static get styles(){return[super.styles,Or,s`
mushroom-state-item {
cursor: pointer;
}
mushroom-shape-icon {
--icon-color: rgb(var(--rgb-state-entity));
--shape-color: rgba(var(--rgb-state-entity), 0.2);
}
`]}};t([oe()],Rr.prototype,"_config",void 0),Rr=t([ne("mushroom-countdown-card")],Rr),console.info("%c🍄 Mushroom-countdown-card Addon 🍄 - requires lovelace-mushroom based on Mushroom 2.6.3","color: #ef5350; font-weight: 700;");var Lr={form:{color_picker:{values:{default:"Default color"}},info_picker:{values:{default:"Default information",name:"Name",state:"State","last-changed":"Last Changed","last-updated":"Last Updated",none:"None"}},icon_type_picker:{values:{default:"Default type",icon:"Icon","entity-picture":"Entity picture",none:"None"}},layout_picker:{values:{default:"Default layout",vertical:"Vertical layout",horizontal:"Horizontal layout"}},alignment_picker:{values:{default:"Default alignment",start:"Start",end:"End",center:"Center",justify:"Justify"}}},card:{generic:{icon_color:"Icon color",layout:"Layout",fill_container:"Fill container",primary_info:"Primary information",secondary_info:"Secondary information",icon_type:"Icon type",content_info:"Content",use_entity_picture:"Use entity picture?",collapsible_controls:"Collapse controls when off",icon_animation:"Animate icon when active?"},light:{show_brightness_control:"Brightness control?",use_light_color:"Use light color",show_color_temp_control:"Temperature color control?",show_color_control:"Color control?",incompatible_controls:"Some controls may not be displayed if your light does not support the feature."},fan:{show_percentage_control:"Percentage control?",show_oscillate_control:"Oscillate control?"},cover:{show_buttons_control:"Control buttons?",show_position_control:"Position control?",show_tilt_position_control:"Tilt control?"},alarm_control_panel:{show_keypad:"Show keypad"},template:{primary:"Primary information",secondary:"Secondary information",multiline_secondary:"Multiline secondary?",entity_extra:"Used in templates and actions",content:"Content",badge_icon:"Badge icon",badge_color:"Badge color",picture:"Picture (will replace the icon)"},title:{title:"Title",subtitle:"Subtitle",title_tap_action:"Title tap action",subtitle_tap_action:"Subtitle tap action"},chips:{alignment:"Alignment"},weather:{show_conditions:"Conditions?",show_temperature:"Temperature?"},update:{show_buttons_control:"Control buttons?"},vacuum:{commands:"Commands",commands_list:{on_off:"Turn on/off"}},"media-player":{use_media_info:"Use media info",use_media_artwork:"Use media artwork",show_volume_level:"Show volume level",media_controls:"Media controls",media_controls_list:{on_off:"Turn on/off",shuffle:"Shuffle",previous:"Previous track",play_pause_stop:"Play/pause/stop",next:"Next track",repeat:"Repeat mode"},volume_controls:"Volume controls",volume_controls_list:{volume_buttons:"Volume buttons",volume_set:"Volume level",volume_mute:"Mute"}},lock:{lock:"Lock",unlock:"Unlock",open:"Open"},humidifier:{show_target_humidity_control:"Humidity control?"},climate:{show_temperature_control:"Temperature control?",hvac_modes:"HVAC Modes"},number:{display_mode:"Display Mode",display_mode_list:{default:"Default (slider)",slider:"Slider",buttons:"Buttons"}},countdown:{timeup_message:"Time's Up Message",unknown_message:"Unknown State Message"}},chip:{sub_element_editor:{title:"Chip editor"},conditional:{chip:"Chip"},"chip-picker":{chips:"Chips",add:"Add chip",edit:"Edit",clear:"Clear",select:"Select chip",types:{action:"Action","alarm-control-panel":"Alarm",back:"Back",conditional:"Conditional",entity:"Entity",light:"Light",menu:"Menu",template:"Template",weather:"Weather"}}}},Br={editor:Lr};const qr={en:Object.freeze({__proto__:null,default:Br,editor:Lr})};function Vr(e,t){try{return e.split(".").reduce(((e,t)=>e[t]),qr[t])}catch(e){return}}const Wr=lt({tap_action:ct(Et),hold_action:ct(Et),double_tap_action:ct(Et)}),Jr=lt({layout:ct(ht([ot("horizontal"),ot("vertical"),ot("default")])),fill_container:ct(it()),primary_info:ct(at(Mr)),secondary_info:ct(at(Mr)),icon_type:ct(at(["icon","entity-picture","none"]))}),Gr=[{type:"grid",name:"",schema:[{name:"layout",selector:{"mush-layout":{}}},{name:"fill_container",selector:{boolean:{}}}]},{type:"grid",name:"",schema:[{name:"primary_info",selector:{"mush-info":{}}},{name:"secondary_info",selector:{"mush-info":{}}},{name:"icon_type",selector:{"mush-icon-type":{}}}]}],Kr=["icon_color","layout","fill_container","primary_info","secondary_info","icon_type","content_info","use_entity_picture","collapsible_controls","icon_animation"],Zr=lt({entity:ct(ut()),name:ct(ut()),icon:ct(ut())}),Yr=tt(lt({index:ct(st()),view_index:ct(st()),view_layout:rt("any",(()=>!0)),type:ut()}),tt(Zr,Jr,Wr),lt({icon_color:ct(ut()),timeup_message:ct(ut()),unknown_message:ct(ut())})),Qr=["timeup_message","unknown_message"],Xr=fe((e=>{return[{name:"entity",selector:{entity:{domain:"sensor"}}},{name:"name",selector:{text:{}}},{type:"grid",name:"",schema:[{name:"icon",selector:{icon:{placeholder:e}}},{name:"icon_color",selector:{"mush-color":{}}}]},{name:"timeup_message",selector:{text:{}}},{name:"unknown_message",selector:{text:{}}},...Gr,{name:"tap_action",selector:{"ui-action":{actions:t}}},{name:"hold_action",selector:{"ui-action":{actions:t}}},{name:"double_tap_action",selector:{"ui-action":{actions:t}}}];var t}));let en=class extends Sr{constructor(){super(...arguments),this._computeLabel=e=>{const t=(r=this.hass,function(e){var t;let n=Vr(e,null!==(t=null==r?void 0:r.locale.language)&&void 0!==t?t:"en");return n||(n=Vr(e,"en")),null!=n?n:e});var r;return Kr.includes(e.name)?t(`editor.card.generic.${e.name}`):Qr.includes(e.name)?t(`editor.card.countdown.${e.name}`):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)}}connectedCallback(){var e,t;super.connectedCallback(),customElements.get("ha-form")||null===(e=customElements.get("hui-button-card"))||void 0===e||e.getConfigElement(),customElements.get("ha-entity-picker")||null===(t=customElements.get("hui-entities-card"))||void 0===t||t.getConfigElement()}setConfig(e){Xe(e,Yr),this._config=e}render(){if(!this.hass||!this._config)return U``;const e=this._config.entity?this.hass.states[this._config.entity]:void 0,t=e?Fr(e):void 0,r=this._config.icon||t,n=Xr(r);return U`
<ha-form
.hass=${this.hass}
.data=${this._config}
.schema=${n}
.computeLabel=${this._computeLabel}
@value-changed=${this._valueChanged}
></ha-form>
`}_valueChanged(e){Se(this,"config-changed",{config:e.detail.value})}};t([oe()],en.prototype,"_config",void 0),en=t([ne("mushroom-countdown-card-editor")],en);var tn=Object.freeze({__proto__:null,get EntityCardEditor(){return en}});export{Rr as CountdownCard};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment