diff --git a/dist/advanced-tile-card.js b/dist/advanced-tile-card.js index 055bbea..30a908e 100644 --- a/dist/advanced-tile-card.js +++ b/dist/advanced-tile-card.js @@ -17,18 +17,18 @@ PERFORMANCE OF THIS SOFTWARE. * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */}const d=window,u=d.ShadowRoot&&(void 0===d.ShadyCSS||d.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,h=Symbol(),m=new WeakMap;let p=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==h)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(u&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=m.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&m.set(e,t))}return t}toString(){return this.cssText}};const g=t=>new p("string"==typeof t?t:t+"",void 0,h),v=u?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return g(e)})(t):t + */}const d=window,u=d.ShadowRoot&&(void 0===d.ShadyCSS||d.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,h=Symbol(),m=new WeakMap;let p=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==h)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(u&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=m.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&m.set(e,t))}return t}toString(){return this.cssText}};const v=t=>new p("string"==typeof t?t:t+"",void 0,h),g=u?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return v(e)})(t):t /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */;var _;const f=window,b=f.trustedTypes,y=b?b.emptyScript:"",w=f.reactiveElementPolyfillSupport,$={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},k=(t,e)=>e!==t&&(e==e||t==t),A={attribute:!0,type:String,converter:$,reflect:!1,hasChanged:k};let S=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=A){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const a=this[t];this[e]=n,this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||A}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(v(t))}else void 0!==t&&e.push(v(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{u?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),n=d.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=A){var n;const a=this.constructor._$Ep(t,i);if(void 0!==a&&!0===i.reflect){const r=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:$).toAttribute(e,i.type);this._$El=t,null==r?this.removeAttribute(a):this.setAttribute(a,r),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,a=n._$Ev.get(t);if(void 0!==a&&this._$El!==a){const t=n.getPropertyOptions(a),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:$;this._$El=a,this[a]=r.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||k)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}; + */;var _;const f=window,b=f.trustedTypes,y=b?b.emptyScript:"",w=f.reactiveElementPolyfillSupport,$={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},k=(t,e)=>e!==t&&(e==e||t==t),A={attribute:!0,type:String,converter:$,reflect:!1,hasChanged:k};let S=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=A){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const a=this[t];this[e]=n,this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||A}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(g(t))}else void 0!==t&&e.push(g(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{u?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),n=d.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=A){var n;const a=this.constructor._$Ep(t,i);if(void 0!==a&&!0===i.reflect){const r=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:$).toAttribute(e,i.type);this._$El=t,null==r?this.removeAttribute(a):this.setAttribute(a,r),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,a=n._$Ev.get(t);if(void 0!==a&&this._$El!==a){const t=n.getPropertyOptions(a),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:$;this._$El=a,this[a]=r.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||k)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -var C;S.finalized=!0,S.elementProperties=new Map,S.elementStyles=[],S.shadowRootOptions={mode:"open"},null==w||w({ReactiveElement:S}),(null!==(_=f.reactiveElementVersions)&&void 0!==_?_:f.reactiveElementVersions=[]).push("1.6.1");const E=window,x=E.trustedTypes,T=x?x.createPolicy("lit-html",{createHTML:t=>t}):void 0,O=`lit$${(Math.random()+"").slice(9)}$`,P="?"+O,z=`<${P}>`,U=document,j=(t="")=>U.createComment(t),H=t=>null===t||"object"!=typeof t&&"function"!=typeof t,M=Array.isArray,N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,D=/>/g,I=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),R=/'/g,V=/"/g,q=/^(?:script|style|textarea|title)$/i,B=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),F=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,K=U.createTreeWalker(U,129,null,!1);class J{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let a=0,r=0;const s=t.length-1,o=this.parts,[c,l]=((t,e)=>{const i=t.length-1,n=[];let a,r=2===e?"":"",s=N;for(let e=0;e"===c[0]?(s=null!=a?a:N,l=-1):void 0===c[1]?l=-2:(l=s.lastIndex-c[2].length,o=c[1],s=void 0===c[3]?I:'"'===c[3]?V:R):s===V||s===R?s=I:s===L||s===D?s=N:(s=I,a=void 0);const u=s===I&&t[e+1].startsWith("/>")?" ":"";r+=s===N?i+z:l>=0?(n.push(o),i.slice(0,l)+"$lit$"+i.slice(l)+O+u):i+O+(-2===l?(n.push(void 0),e):u)}const o=r+(t[i]||">")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==T?T.createHTML(o):o,n]})(t,e);if(this.el=J.createElement(c,i),K.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=K.nextNode())&&o.length0){n.textContent=x?x.emptyScript:"";for(let i=0;iM(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==W&&H(this._$AH)?this._$AA.nextSibling.data=t:this.T(U.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:n}=t,a="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=J.createElement(n.h,this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===a)this._$AH.p(i);else{const t=new class{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:i},parts:n}=this._$AD,a=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:U).importNode(i,!0);K.currentNode=a;let r=K.nextNode(),s=0,o=0,c=n[0];for(;void 0!==c;){if(s===c.index){let e;2===c.type?e=new Y(r,r.nextSibling,this,t):1===c.type?e=new c.ctor(r,c.name,c.strings,this,t):6===c.type&&(e=new nt(r,this,t)),this.u.push(e),c=n[++o]}s!==(null==c?void 0:c.index)&&(r=K.nextNode(),s++)}return a}p(t){let e=0;for(const i of this.u)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}(a,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=Z.get(t.strings);return void 0===e&&Z.set(t.strings,e=new J(t)),e}k(t){M(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const a of t)n===e.length?e.push(i=new Y(this.O(j()),this.O(j()),this,this.options)):i=e[n],i._$AI(a),n++;n2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=W}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const a=this.strings;let r=!1;if(void 0===a)t=X(this,t,e,0),r=!H(t)||t!==this._$AH&&t!==F,r&&(this._$AH=t);else{const n=t;let s,o;for(t=a[0],s=0;st}):void 0,O=`lit$${(Math.random()+"").slice(9)}$`,P="?"+O,z=`<${P}>`,U=document,j=(t="")=>U.createComment(t),H=t=>null===t||"object"!=typeof t&&"function"!=typeof t,M=Array.isArray,N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,D=/>/g,R=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),I=/'/g,V=/"/g,q=/^(?:script|style|textarea|title)$/i,B=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),F=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,K=U.createTreeWalker(U,129,null,!1);class J{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let a=0,r=0;const s=t.length-1,o=this.parts,[c,l]=((t,e)=>{const i=t.length-1,n=[];let a,r=2===e?"":"",s=N;for(let e=0;e"===c[0]?(s=null!=a?a:N,l=-1):void 0===c[1]?l=-2:(l=s.lastIndex-c[2].length,o=c[1],s=void 0===c[3]?R:'"'===c[3]?V:I):s===V||s===I?s=R:s===L||s===D?s=N:(s=R,a=void 0);const u=s===R&&t[e+1].startsWith("/>")?" ":"";r+=s===N?i+z:l>=0?(n.push(o),i.slice(0,l)+"$lit$"+i.slice(l)+O+u):i+O+(-2===l?(n.push(void 0),e):u)}const o=r+(t[i]||">")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==T?T.createHTML(o):o,n]})(t,e);if(this.el=J.createElement(c,i),K.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=K.nextNode())&&o.length0){n.textContent=x?x.emptyScript:"";for(let i=0;iM(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==W&&H(this._$AH)?this._$AA.nextSibling.data=t:this.T(U.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:n}=t,a="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=J.createElement(n.h,this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===a)this._$AH.p(i);else{const t=new class{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:i},parts:n}=this._$AD,a=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:U).importNode(i,!0);K.currentNode=a;let r=K.nextNode(),s=0,o=0,c=n[0];for(;void 0!==c;){if(s===c.index){let e;2===c.type?e=new Y(r,r.nextSibling,this,t):1===c.type?e=new c.ctor(r,c.name,c.strings,this,t):6===c.type&&(e=new nt(r,this,t)),this.u.push(e),c=n[++o]}s!==(null==c?void 0:c.index)&&(r=K.nextNode(),s++)}return a}p(t){let e=0;for(const i of this.u)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}(a,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=Z.get(t.strings);return void 0===e&&Z.set(t.strings,e=new J(t)),e}k(t){M(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const a of t)n===e.length?e.push(i=new Y(this.O(j()),this.O(j()),this,this.options)):i=e[n],i._$AI(a),n++;n2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=W}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const a=this.strings;let r=!1;if(void 0===a)t=X(this,t,e,0),r=!H(t)||t!==this._$AH&&t!==F,r&&(this._$AH=t);else{const n=t;let s,o;for(t=a[0],s=0;se=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e) * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */var mt;null===(mt=window.HTMLSlotElement)||void 0===mt||mt.prototype.assignedElements;var pt,gt,vt=function(t,e){return _t(e).format(t)},_t=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric"})};!function(t){t.language="language",t.system="system",t.comma_decimal="comma_decimal",t.decimal_comma="decimal_comma",t.space_comma="space_comma",t.none="none"}(pt||(pt={})),function(t){t.language="language",t.system="system",t.am_pm="12",t.twenty_four="24"}(gt||(gt={}));var ft=function(t){if(t.time_format===gt.language||t.time_format===gt.system){var e=t.time_format===gt.language?t.language:void 0,i=(new Date).toLocaleString(e);return i.includes("AM")||i.includes("PM")}return t.time_format===gt.am_pm},bt=function(t,e){return yt(e).format(t)},yt=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric",hour:ft(t)?"numeric":"2-digit",minute:"2-digit",hour12:ft(t)})},wt=function(t,e){return $t(e).format(t)},$t=function(t){return new Intl.DateTimeFormat(t.language,{hour:"numeric",minute:"2-digit",hour12:ft(t)})};function kt(){return(kt=Object.assign||function(t){for(var e=1;e-1?t.split(".")[1].length:0;i.minimumFractionDigits=n,i.maximumFractionDigits=n}return i},Et=function(t,e,i,n){var a=void 0!==n?n:e.state;if("unknown"===a||"unavailable"===a)return t("state.default."+a);if(function(t){return!!t.attributes.unit_of_measurement||!!t.attributes.state_class}(e)){if("monetary"===e.attributes.device_class)try{return St(a,i,{style:"currency",currency:e.attributes.unit_of_measurement})}catch(t){}return St(a,i)+(e.attributes.unit_of_measurement?" "+e.attributes.unit_of_measurement:"")}var r=function(t){return At(t.entity_id)}(e);if("input_datetime"===r){var s;if(void 0===n)return e.attributes.has_date&&e.attributes.has_time?(s=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day,e.attributes.hour,e.attributes.minute),bt(s,i)):e.attributes.has_date?(s=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day),vt(s,i)):e.attributes.has_time?((s=new Date).setHours(e.attributes.hour,e.attributes.minute),wt(s,i)):e.state;try{var o=n.split(" ");if(2===o.length)return bt(new Date(o.join("T")),i);if(1===o.length){if(n.includes("-"))return vt(new Date(n+"T00:00"),i);if(n.includes(":")){var c=new Date;return wt(new Date(c.toISOString().split("T")[0]+"T"+n),i)}}return n}catch(t){return n}}return"humidifier"===r&&"on"===a&&e.attributes.humidity?e.attributes.humidity+" %":"counter"===r||"number"===r||"input_number"===r?St(a,i):e.attributes.device_class&&t("component."+r+".state."+e.attributes.device_class+"."+a)||t("component."+r+".state._."+a)||a},xt=["closed","locked","off"],Tt=function(t,e,i,n){n=n||{},i=null==i?{}:i;var a=new Event(e,{bubbles:void 0===n.bubbles||n.bubbles,cancelable:Boolean(n.cancelable),composed:void 0===n.composed||n.composed});return a.detail=i,t.dispatchEvent(a),a},Ot={alert:"mdi:alert",automation:"mdi:playlist-play",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:settings",conversation:"mdi:text-to-speech",device_tracker:"mdi:account",fan:"mdi:fan",group:"mdi:google-circles-communities",history_graph:"mdi:chart-line",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_boolean:"mdi:drawing",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:google-pages",script:"mdi:file-document",sensor:"mdi:eye",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",switch:"mdi:flash",timer:"mdi:timer",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weblink:"mdi:open-in-new"};function Pt(t,e){if(t in Ot)return Ot[t];switch(t){case"alarm_control_panel":switch(e){case"armed_home":return"mdi:bell-plus";case"armed_night":return"mdi:bell-sleep";case"disarmed":return"mdi:bell-outline";case"triggered":return"mdi:bell-ring";default:return"mdi:bell"}case"binary_sensor":return e&&"off"===e?"mdi:radiobox-blank":"mdi:checkbox-marked-circle";case"cover":return"closed"===e?"mdi:window-closed":"mdi:window-open";case"lock":return e&&"unlocked"===e?"mdi:lock-open":"mdi:lock";case"media_player":return e&&"off"!==e&&"idle"!==e?"mdi:cast-connected":"mdi:cast";case"zwave":switch(e){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}default:return console.warn("Unable to find icon for domain "+t+" ("+e+")"),"mdi:bookmark"}}var zt=function(t){Tt(window,"haptic",t)},Ut=function(t,e){return function(t,e,i){void 0===i&&(i=!0);var n,a=At(e),r="group"===a?"homeassistant":a;switch(a){case"lock":n=i?"unlock":"lock";break;case"cover":n=i?"open_cover":"close_cover";break;default:n=i?"turn_on":"turn_off"}return t.callService(r,n,{entity_id:e})}(t,e,xt.includes(t.states[e].state))},jt=function(t,e,i,n){if(n||(n={action:"more-info"}),!n.confirmation||n.confirmation.exemptions&&n.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||(zt("warning"),confirm(n.confirmation.text||"Are you sure you want to "+n.action+"?")))switch(n.action){case"more-info":(i.entity||i.camera_image)&&Tt(t,"hass-more-info",{entityId:i.entity?i.entity:i.camera_image});break;case"navigate":n.navigation_path&&function(t,e,i){void 0===i&&(i=!1),i?history.replaceState(null,"",e):history.pushState(null,"",e),Tt(window,"location-changed",{replace:i})}(0,n.navigation_path);break;case"url":n.url_path&&window.open(n.url_path);break;case"toggle":i.entity&&(Ut(e,i.entity),zt("success"));break;case"call-service":if(!n.service)return void zt("failure");var a=n.service.split(".",2);e.callService(a[0],a[1],n.service_data,n.target),zt("success");break;case"fire-dom-event":Tt(t,"ll-custom",n)}},Ht=function(t,e,i,n){var a;"double_tap"===n&&i.double_tap_action?a=i.double_tap_action:"hold"===n&&i.hold_action?a=i.hold_action:"tap"===n&&i.tap_action&&(a=i.tap_action),jt(t,e,i,a)};function Mt(t){return void 0!==t&&"none"!==t.action}var Nt={humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",temperature:"mdi:thermometer",pressure:"mdi:gauge",power:"mdi:flash",signal_strength:"mdi:wifi"},Lt={binary_sensor:function(t,e){var i="off"===t;switch(null==e?void 0:e.attributes.device_class){case"battery":return i?"mdi:battery":"mdi:battery-outline";case"battery_charging":return i?"mdi:battery":"mdi:battery-charging";case"cold":return i?"mdi:thermometer":"mdi:snowflake";case"connectivity":return i?"mdi:server-network-off":"mdi:server-network";case"door":return i?"mdi:door-closed":"mdi:door-open";case"garage_door":return i?"mdi:garage":"mdi:garage-open";case"power":case"plug":return i?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return i?"mdi:check-circle":"mdi:alert-circle";case"smoke":return i?"mdi:check-circle":"mdi:smoke";case"heat":return i?"mdi:thermometer":"mdi:fire";case"light":return i?"mdi:brightness-5":"mdi:brightness-7";case"lock":return i?"mdi:lock":"mdi:lock-open";case"moisture":return i?"mdi:water-off":"mdi:water";case"motion":return i?"mdi:walk":"mdi:run";case"occupancy":case"presence":return i?"mdi:home-outline":"mdi:home";case"opening":return i?"mdi:square":"mdi:square-outline";case"running":return i?"mdi:stop":"mdi:play";case"sound":return i?"mdi:music-note-off":"mdi:music-note";case"update":return i?"mdi:package":"mdi:package-up";case"vibration":return i?"mdi:crop-portrait":"mdi:vibrate";case"window":return i?"mdi:window-closed":"mdi:window-open";default:return i?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},cover:function(t){var e="closed"!==t.state;switch(t.attributes.device_class){case"garage":return e?"mdi:garage-open":"mdi:garage";case"door":return e?"mdi:door-open":"mdi:door-closed";case"shutter":return e?"mdi:window-shutter-open":"mdi:window-shutter";case"blind":return e?"mdi:blinds-open":"mdi:blinds";case"window":return e?"mdi:window-open":"mdi:window-closed";default:return Pt("cover",t.state)}},sensor:function(t){var e=t.attributes.device_class;if(e&&e in Nt)return Nt[e];if("battery"===e){var i=Number(t.state);if(isNaN(i))return"mdi:battery-unknown";var n=10*Math.round(i/10);return n>=100?"mdi:battery":n<=0?"mdi:battery-alert":"hass:battery-"+n}var a=t.attributes.unit_of_measurement;return"°C"===a||"°F"===a?"mdi:thermometer":Pt("sensor")},input_datetime:function(t){return t.attributes.has_date?t.attributes.has_time?Pt("input_datetime"):"mdi:calendar":"mdi:clock"}}; + */var mt;null===(mt=window.HTMLSlotElement)||void 0===mt||mt.prototype.assignedElements;var pt,vt,gt=function(t,e){return _t(e).format(t)},_t=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric"})};!function(t){t.language="language",t.system="system",t.comma_decimal="comma_decimal",t.decimal_comma="decimal_comma",t.space_comma="space_comma",t.none="none"}(pt||(pt={})),function(t){t.language="language",t.system="system",t.am_pm="12",t.twenty_four="24"}(vt||(vt={}));var ft=function(t){if(t.time_format===vt.language||t.time_format===vt.system){var e=t.time_format===vt.language?t.language:void 0,i=(new Date).toLocaleString(e);return i.includes("AM")||i.includes("PM")}return t.time_format===vt.am_pm},bt=function(t,e){return yt(e).format(t)},yt=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric",hour:ft(t)?"numeric":"2-digit",minute:"2-digit",hour12:ft(t)})},wt=function(t,e){return $t(e).format(t)},$t=function(t){return new Intl.DateTimeFormat(t.language,{hour:"numeric",minute:"2-digit",hour12:ft(t)})};function kt(){return(kt=Object.assign||function(t){for(var e=1;e-1?t.split(".")[1].length:0;i.minimumFractionDigits=n,i.maximumFractionDigits=n}return i},Et=function(t,e,i,n){var a=void 0!==n?n:e.state;if("unknown"===a||"unavailable"===a)return t("state.default."+a);if(function(t){return!!t.attributes.unit_of_measurement||!!t.attributes.state_class}(e)){if("monetary"===e.attributes.device_class)try{return St(a,i,{style:"currency",currency:e.attributes.unit_of_measurement})}catch(t){}return St(a,i)+(e.attributes.unit_of_measurement?" "+e.attributes.unit_of_measurement:"")}var r=function(t){return At(t.entity_id)}(e);if("input_datetime"===r){var s;if(void 0===n)return e.attributes.has_date&&e.attributes.has_time?(s=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day,e.attributes.hour,e.attributes.minute),bt(s,i)):e.attributes.has_date?(s=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day),gt(s,i)):e.attributes.has_time?((s=new Date).setHours(e.attributes.hour,e.attributes.minute),wt(s,i)):e.state;try{var o=n.split(" ");if(2===o.length)return bt(new Date(o.join("T")),i);if(1===o.length){if(n.includes("-"))return gt(new Date(n+"T00:00"),i);if(n.includes(":")){var c=new Date;return wt(new Date(c.toISOString().split("T")[0]+"T"+n),i)}}return n}catch(t){return n}}return"humidifier"===r&&"on"===a&&e.attributes.humidity?e.attributes.humidity+" %":"counter"===r||"number"===r||"input_number"===r?St(a,i):e.attributes.device_class&&t("component."+r+".state."+e.attributes.device_class+"."+a)||t("component."+r+".state._."+a)||a},xt=["closed","locked","off"],Tt=function(t,e,i,n){n=n||{},i=null==i?{}:i;var a=new Event(e,{bubbles:void 0===n.bubbles||n.bubbles,cancelable:Boolean(n.cancelable),composed:void 0===n.composed||n.composed});return a.detail=i,t.dispatchEvent(a),a},Ot={alert:"mdi:alert",automation:"mdi:playlist-play",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:settings",conversation:"mdi:text-to-speech",device_tracker:"mdi:account",fan:"mdi:fan",group:"mdi:google-circles-communities",history_graph:"mdi:chart-line",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_boolean:"mdi:drawing",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:google-pages",script:"mdi:file-document",sensor:"mdi:eye",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",switch:"mdi:flash",timer:"mdi:timer",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weblink:"mdi:open-in-new"};function Pt(t,e){if(t in Ot)return Ot[t];switch(t){case"alarm_control_panel":switch(e){case"armed_home":return"mdi:bell-plus";case"armed_night":return"mdi:bell-sleep";case"disarmed":return"mdi:bell-outline";case"triggered":return"mdi:bell-ring";default:return"mdi:bell"}case"binary_sensor":return e&&"off"===e?"mdi:radiobox-blank":"mdi:checkbox-marked-circle";case"cover":return"closed"===e?"mdi:window-closed":"mdi:window-open";case"lock":return e&&"unlocked"===e?"mdi:lock-open":"mdi:lock";case"media_player":return e&&"off"!==e&&"idle"!==e?"mdi:cast-connected":"mdi:cast";case"zwave":switch(e){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}default:return console.warn("Unable to find icon for domain "+t+" ("+e+")"),"mdi:bookmark"}}var zt=function(t){Tt(window,"haptic",t)},Ut=function(t,e){return function(t,e,i){void 0===i&&(i=!0);var n,a=At(e),r="group"===a?"homeassistant":a;switch(a){case"lock":n=i?"unlock":"lock";break;case"cover":n=i?"open_cover":"close_cover";break;default:n=i?"turn_on":"turn_off"}return t.callService(r,n,{entity_id:e})}(t,e,xt.includes(t.states[e].state))},jt=function(t,e,i,n){if(n||(n={action:"more-info"}),!n.confirmation||n.confirmation.exemptions&&n.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||(zt("warning"),confirm(n.confirmation.text||"Are you sure you want to "+n.action+"?")))switch(n.action){case"more-info":(i.entity||i.camera_image)&&Tt(t,"hass-more-info",{entityId:i.entity?i.entity:i.camera_image});break;case"navigate":n.navigation_path&&function(t,e,i){void 0===i&&(i=!1),i?history.replaceState(null,"",e):history.pushState(null,"",e),Tt(window,"location-changed",{replace:i})}(0,n.navigation_path);break;case"url":n.url_path&&window.open(n.url_path);break;case"toggle":i.entity&&(Ut(e,i.entity),zt("success"));break;case"call-service":if(!n.service)return void zt("failure");var a=n.service.split(".",2);e.callService(a[0],a[1],n.service_data,n.target),zt("success");break;case"fire-dom-event":Tt(t,"ll-custom",n)}},Ht=function(t,e,i,n){var a;"double_tap"===n&&i.double_tap_action?a=i.double_tap_action:"hold"===n&&i.hold_action?a=i.hold_action:"tap"===n&&i.tap_action&&(a=i.tap_action),jt(t,e,i,a)};function Mt(t){return void 0!==t&&"none"!==t.action}var Nt={humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",temperature:"mdi:thermometer",pressure:"mdi:gauge",power:"mdi:flash",signal_strength:"mdi:wifi"},Lt={binary_sensor:function(t,e){var i="off"===t;switch(null==e?void 0:e.attributes.device_class){case"battery":return i?"mdi:battery":"mdi:battery-outline";case"battery_charging":return i?"mdi:battery":"mdi:battery-charging";case"cold":return i?"mdi:thermometer":"mdi:snowflake";case"connectivity":return i?"mdi:server-network-off":"mdi:server-network";case"door":return i?"mdi:door-closed":"mdi:door-open";case"garage_door":return i?"mdi:garage":"mdi:garage-open";case"power":case"plug":return i?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return i?"mdi:check-circle":"mdi:alert-circle";case"smoke":return i?"mdi:check-circle":"mdi:smoke";case"heat":return i?"mdi:thermometer":"mdi:fire";case"light":return i?"mdi:brightness-5":"mdi:brightness-7";case"lock":return i?"mdi:lock":"mdi:lock-open";case"moisture":return i?"mdi:water-off":"mdi:water";case"motion":return i?"mdi:walk":"mdi:run";case"occupancy":case"presence":return i?"mdi:home-outline":"mdi:home";case"opening":return i?"mdi:square":"mdi:square-outline";case"running":return i?"mdi:stop":"mdi:play";case"sound":return i?"mdi:music-note-off":"mdi:music-note";case"update":return i?"mdi:package":"mdi:package-up";case"vibration":return i?"mdi:crop-portrait":"mdi:vibrate";case"window":return i?"mdi:window-closed":"mdi:window-open";default:return i?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},cover:function(t){var e="closed"!==t.state;switch(t.attributes.device_class){case"garage":return e?"mdi:garage-open":"mdi:garage";case"door":return e?"mdi:door-open":"mdi:door-closed";case"shutter":return e?"mdi:window-shutter-open":"mdi:window-shutter";case"blind":return e?"mdi:blinds-open":"mdi:blinds";case"window":return e?"mdi:window-open":"mdi:window-closed";default:return Pt("cover",t.state)}},sensor:function(t){var e=t.attributes.device_class;if(e&&e in Nt)return Nt[e];if("battery"===e){var i=Number(t.state);if(isNaN(i))return"mdi:battery-unknown";var n=10*Math.round(i/10);return n>=100?"mdi:battery":n<=0?"mdi:battery-alert":"hass:battery-"+n}var a=t.attributes.unit_of_measurement;return"°C"===a||"°F"===a?"mdi:thermometer":Pt("sensor")},input_datetime:function(t){return t.attributes.has_date?t.attributes.has_time?Pt("input_datetime"):"mdi:calendar":"mdi:clock"}}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const Dt=1,It=t=>(...e)=>({_$litDirective$:t,values:e});let Rt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};const Vt="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.maxTouchPoints>0;class qt extends HTMLElement{constructor(){super(),this.holdTime=500,this.held=!1,this.ripple=document.createElement("mwc-ripple")}connectedCallback(){Object.assign(this.style,{position:"absolute",width:Vt?"100px":"50px",height:Vt?"100px":"50px",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:"999"}),this.appendChild(this.ripple),this.ripple.primary=!0,["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((t=>{document.addEventListener(t,(()=>{clearTimeout(this.timer),this.stopAnimation(),this.timer=void 0}),{passive:!0})}))}bind(t,e){if(t.actionHandler)return;t.actionHandler=!0,t.addEventListener("contextmenu",(t=>{const e=t||window.event;return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0,e.returnValue=!1,!1}));const i=t=>{let e,i;this.held=!1,t.touches?(e=t.touches[0].pageX,i=t.touches[0].pageY):(e=t.pageX,i=t.pageY),this.timer=window.setTimeout((()=>{this.startAnimation(e,i),this.held=!0}),this.holdTime)},n=i=>{i.preventDefault(),["touchend","touchcancel"].includes(i.type)&&void 0===this.timer||(clearTimeout(this.timer),this.stopAnimation(),this.timer=void 0,this.held?Tt(t,"action",{action:"hold"}):(null==e?void 0:e.hasDoubleClick)?"click"===i.type&&i.detail<2||!this.dblClickTimeout?this.dblClickTimeout=window.setTimeout((()=>{this.dblClickTimeout=void 0,Tt(t,"action",{action:"tap"})}),250):(clearTimeout(this.dblClickTimeout),this.dblClickTimeout=void 0,Tt(t,"action",{action:"double_tap"})):Tt(t,"action",{action:"tap"}))};t.addEventListener("touchstart",i,{passive:!0}),t.addEventListener("touchend",n),t.addEventListener("touchcancel",n),t.addEventListener("mousedown",i,{passive:!0}),t.addEventListener("click",n),t.addEventListener("keyup",(t=>{13===t.keyCode&&n(t)}))}startAnimation(t,e){Object.assign(this.style,{left:`${t}px`,top:`${e}px`,display:null}),this.ripple.disabled=!1,this.ripple.active=!0,this.ripple.unbounded=!0}stopAnimation(){this.ripple.active=!1,this.ripple.disabled=!0,this.style.display="none"}}const Bt="action-handler-advanced-tile-card";customElements.define(Bt,qt);const Ft=(t,e)=>{const i=(()=>{const t=document.body;if(t.querySelector(Bt))return t.querySelector(Bt);const e=document.createElement(Bt);return t.appendChild(e),e})();i&&i.bind(t,e)},Wt=It(class extends Rt{update(t,[e]){return Ft(t.element,e),F}render(t){}}),Zt=It(class extends Rt{constructor(t){var e;if(super(t),t.type!==Dt||"class"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){var i,n;if(void 0===this.nt){this.nt=new Set,void 0!==t.strings&&(this.st=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!(null===(i=this.st)||void 0===i?void 0:i.has(t))&&this.nt.add(t);return this.render(e)}const a=t.element.classList;this.nt.forEach((t=>{t in e||(a.remove(t),this.nt.delete(t))}));for(const t in e){const i=!!e[t];i===this.nt.has(t)||(null===(n=this.st)||void 0===n?void 0:n.has(t))||(i?(a.add(t),this.nt.add(t)):(a.remove(t),this.nt.delete(t)))}return F}}),Kt=It(class extends Rt{constructor(t){var e;if(super(t),t.type!==Dt||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,i)=>{const n=t[i];return null==n?e:e+`${i=i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`}),"")}update(t,[e]){const{style:i}=t.element;if(void 0===this.vt){this.vt=new Set;for(const t in e)this.vt.add(t);return this.render(e)}this.vt.forEach((t=>{null==e[t]&&(this.vt.delete(t),t.includes("-")?i.removeProperty(t):i[t]="")}));for(const t in e){const n=e[t];null!=n&&(this.vt.add(t),t.includes("-")?i.setProperty(t,n):i[t]=n)}return F}});const Jt=t=>i.includes(t.state),Xt=t=>At(t.entity_id),Yt=(t,e)=>Et(e.localize,t,e.locale),Gt=(t,e)=>!(!t.use_attribute_as_state||!e.attributes[t.attribute_to_show])&&e.attributes[t.attribute_to_show],Qt=({entity:t,hass:e,config:i},{domainClasses:n={},domainStyles:a={}}={})=>{const r=Xt(t);let s=!1;return i.show_state_string&&(i.conditional_state?i.if_state===t.state&&(s=Gt(i,t)||Yt(t,e)):s=Gt(i,t)||Yt(t,e)),{domainClasses:Object.assign({[`domain-${r}`]:!0},n),domainStyles:a,domainStateString:s}};let te=class extends ot{constructor(){super(...arguments),this.isClicked=!1,this.isDragging=!1,this.entityUsesEntityPictureAsIcon=!1,this.entityUsesEntityPictureAsBackground=!1,this.showStateString=!1,this.entityIsActive=!1,this.entityClasses={},this.entityStyles={}}static async getConfigElement(){return await Promise.resolve().then((function(){return se})),document.createElement(e)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>["light"].includes(t.split(".")[0])));return{entity:e[0]}}getCardSize(){return 1}setConfig(t){if(!t)throw new Error(c("common.invalid_configuration"));t.test_gui&&function(){var t=document.querySelector("home-assistant");if(t=(t=(t=(t=(t=(t=(t=(t=t&&t.shadowRoot)&&t.querySelector("home-assistant-main"))&&t.shadowRoot)&&t.querySelector("app-drawer-layout partial-panel-resolver"))&&t.shadowRoot||t)&&t.querySelector("ha-panel-lovelace"))&&t.shadowRoot)&&t.querySelector("hui-root")){var e=t.lovelace;return e.current_view=t.___curView,e}return null}().setEditMode(!0),this.className+=t.is_square?" square":"",this.config=t}shouldUpdate(t){return!!this.config&&function(t,e,i){if(e.has("config")||i)return!0;if(t.config.entity){var n=e.get("hass");return!n||n.states[t.config.entity]!==t.hass.states[t.config.entity]}return!1}(this,t,!1)}render(){var t,e,i;if(!this.config.entity)return this._showWarning(c("common.missing_entity"));this.entity=this.hass.states[this.config.entity],this.entityIcon=this.config.icon||function(t){if(!t)return"mdi:bookmark";if(t.attributes.icon)return t.attributes.icon;var e=At(t.entity_id);return e in Lt?Lt[e](t):Pt(e,t.state)}(this.entity),this.entityDomain=null===(t=this.entity)||void 0===t?void 0:t.entity_id.split(".")[0],this.entityUsesEntityPictureAsIcon=this.config.use_entity_picture_as_icon||!1,this.entityUsesEntityPictureAsBackground=this.config.use_entity_picture_as_background||!1,this.showStateString=this.config.show_state_string||!1,this.attributeToShow=this.config.attribute_to_show||null,this.entityIsActive=Jt(this.entity);const{domainClasses:n,domainStyles:a,domainStateString:r}=((t,e,i)=>{const n={};switch(Xt(t)){case"light":if(Jt(t)){const e=`${(t=>t.attributes.rgb_color.join(",")||void 0)(t)||"var(--rgb-primary-color)"}`;n["--atc-icon-color-active"]=`rgb(${e})`,n["--atc-icon-background-active"]=`rgba(${e}, 0.2)`}return Qt({entity:t,hass:e,config:i},{domainStyles:n});case"person":return i.use_entity_picture_as_icon&&t.attributes.entity_picture&&(n["--atc-icon-background"]=`url(${t.attributes.entity_picture})`,n["--atc-icon-background-active"]=`url(${t.attributes.entity_picture})`),Qt({entity:t,hass:e,config:i},{domainStyles:n});case"lock":return Qt({entity:t,hass:e,config:i},{domainStateString:"locked"!==t.state&&Yt(t,e)});default:return Qt({entity:t,hass:e,config:i});case"media_player":return Qt({entity:t,hass:e,config:i},{domainStateString:"playing"===t.state&&(t.attributes.media_title?t.attributes.media_title:Yt(t,e))});case"sensor":return Qt({entity:t,hass:e,config:i},{domainStateString:!!t.attributes.unit_of_measurement&&`${t.state} ${t.attributes.unit_of_measurement}`});case"binary_sensor":return Qt({entity:t,hass:e,config:i},{domainStateString:"on"===t.state&&Yt(t,e)})}})(this.entity,this.hass,this.config);return this.entityStyles=Object.assign({},a),this.entityClasses=Object.assign(Object.assign(Object.assign({},this.entityClasses),n),{clicked:this.isClicked,active:this.entityIsActive}),B` + */const Dt=1,Rt=t=>(...e)=>({_$litDirective$:t,values:e});let It=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};const Vt="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.maxTouchPoints>0;class qt extends HTMLElement{constructor(){super(),this.holdTime=500,this.held=!1,this.ripple=document.createElement("mwc-ripple")}connectedCallback(){Object.assign(this.style,{position:"absolute",width:Vt?"100px":"50px",height:Vt?"100px":"50px",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:"999"}),this.appendChild(this.ripple),this.ripple.primary=!0,["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((t=>{document.addEventListener(t,(()=>{clearTimeout(this.timer),this.stopAnimation(),this.timer=void 0}),{passive:!0})}))}bind(t,e){if(t.actionHandler)return;t.actionHandler=!0,t.addEventListener("contextmenu",(t=>{const e=t||window.event;return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0,e.returnValue=!1,!1}));const i=t=>{let e,i;this.held=!1,t.touches?(e=t.touches[0].pageX,i=t.touches[0].pageY):(e=t.pageX,i=t.pageY),this.timer=window.setTimeout((()=>{this.startAnimation(e,i),this.held=!0}),this.holdTime)},n=i=>{i.preventDefault(),["touchend","touchcancel"].includes(i.type)&&void 0===this.timer||(clearTimeout(this.timer),this.stopAnimation(),this.timer=void 0,this.held?Tt(t,"action",{action:"hold"}):(null==e?void 0:e.hasDoubleClick)?"click"===i.type&&i.detail<2||!this.dblClickTimeout?this.dblClickTimeout=window.setTimeout((()=>{this.dblClickTimeout=void 0,Tt(t,"action",{action:"tap"})}),250):(clearTimeout(this.dblClickTimeout),this.dblClickTimeout=void 0,Tt(t,"action",{action:"double_tap"})):Tt(t,"action",{action:"tap"}))};t.addEventListener("touchstart",i,{passive:!0}),t.addEventListener("touchend",n),t.addEventListener("touchcancel",n),t.addEventListener("mousedown",i,{passive:!0}),t.addEventListener("click",n),t.addEventListener("keyup",(t=>{13===t.keyCode&&n(t)}))}startAnimation(t,e){Object.assign(this.style,{left:`${t}px`,top:`${e}px`,display:null}),this.ripple.disabled=!1,this.ripple.active=!0,this.ripple.unbounded=!0}stopAnimation(){this.ripple.active=!1,this.ripple.disabled=!0,this.style.display="none"}}const Bt="action-handler-advanced-tile-card";customElements.define(Bt,qt);const Ft=(t,e)=>{const i=(()=>{const t=document.body;if(t.querySelector(Bt))return t.querySelector(Bt);const e=document.createElement(Bt);return t.appendChild(e),e})();i&&i.bind(t,e)},Wt=Rt(class extends It{update(t,[e]){return Ft(t.element,e),F}render(t){}}),Zt=Rt(class extends It{constructor(t){var e;if(super(t),t.type!==Dt||"class"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){var i,n;if(void 0===this.nt){this.nt=new Set,void 0!==t.strings&&(this.st=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!(null===(i=this.st)||void 0===i?void 0:i.has(t))&&this.nt.add(t);return this.render(e)}const a=t.element.classList;this.nt.forEach((t=>{t in e||(a.remove(t),this.nt.delete(t))}));for(const t in e){const i=!!e[t];i===this.nt.has(t)||(null===(n=this.st)||void 0===n?void 0:n.has(t))||(i?(a.add(t),this.nt.add(t)):(a.remove(t),this.nt.delete(t)))}return F}}),Kt=Rt(class extends It{constructor(t){var e;if(super(t),t.type!==Dt||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,i)=>{const n=t[i];return null==n?e:e+`${i=i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`}),"")}update(t,[e]){const{style:i}=t.element;if(void 0===this.vt){this.vt=new Set;for(const t in e)this.vt.add(t);return this.render(e)}this.vt.forEach((t=>{null==e[t]&&(this.vt.delete(t),t.includes("-")?i.removeProperty(t):i[t]="")}));for(const t in e){const n=e[t];null!=n&&(this.vt.add(t),t.includes("-")?i.setProperty(t,n):i[t]=n)}return F}});const Jt=t=>i.includes(t.state),Xt=t=>At(t.entity_id),Yt=(t,e)=>Et(e.localize,t,e.locale),Gt=(t,e)=>!(!t.use_attribute_as_state||!e.attributes[t.attribute_to_show])&&e.attributes[t.attribute_to_show],Qt=({entity:t,hass:e,config:i},{domainClasses:n={},domainStyles:a={}}={})=>{const r=Xt(t);let s=!1;return i.show_state_string&&(i.conditional_state?i.if_state===t.state&&(s=Gt(i,t)||Yt(t,e)):s=Gt(i,t)||Yt(t,e)),{domainClasses:Object.assign({[`domain-${r}`]:!0},n),domainStyles:a,domainStateString:s}};let te=class extends ot{constructor(){super(...arguments),this.isClicked=!1,this.isAvailable=!1,this.isActive=!1,this.isDragging=!1,this.entityUsesEntityPictureAsIcon=!1,this.entityUsesEntityPictureAsBackground=!1,this.showStateString=!1,this.entityClasses={},this.entityStyles={}}static async getConfigElement(){return await Promise.resolve().then((function(){return se})),document.createElement(e)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>["light"].includes(t.split(".")[0])));return{entity:e[0]}}getCardSize(){return 1}setConfig(t){if(!t)throw new Error(c("common.invalid_configuration"));t.test_gui&&function(){var t=document.querySelector("home-assistant");if(t=(t=(t=(t=(t=(t=(t=(t=t&&t.shadowRoot)&&t.querySelector("home-assistant-main"))&&t.shadowRoot)&&t.querySelector("app-drawer-layout partial-panel-resolver"))&&t.shadowRoot||t)&&t.querySelector("ha-panel-lovelace"))&&t.shadowRoot)&&t.querySelector("hui-root")){var e=t.lovelace;return e.current_view=t.___curView,e}return null}().setEditMode(!0),this.className+=t.is_square?" square":"",this.config=t}shouldUpdate(t){return!!this.config&&function(t,e,i){if(e.has("config")||i)return!0;if(t.config.entity){var n=e.get("hass");return!n||n.states[t.config.entity]!==t.hass.states[t.config.entity]}return!1}(this,t,!1)}render(){var t,e,i;if(!this.config.entity)return this._showWarning(c("common.missing_entity"));this.entity=this.hass.states[this.config.entity],this.entityIcon=this.config.icon||function(t){if(!t)return"mdi:bookmark";if(t.attributes.icon)return t.attributes.icon;var e=At(t.entity_id);return e in Lt?Lt[e](t):Pt(e,t.state)}(this.entity),this.entityDomain=null===(t=this.entity)||void 0===t?void 0:t.entity_id.split(".")[0],this.entityUsesEntityPictureAsIcon=this.config.use_entity_picture_as_icon||!1,this.entityUsesEntityPictureAsBackground=this.config.use_entity_picture_as_background||!1,this.showStateString=this.config.show_state_string||!1,this.attributeToShow=this.config.attribute_to_show||null,this.isActive=Jt(this.entity),this.isAvailable=void 0!==this.entity&&"unavailable"!==this.entity.state;const{domainClasses:n,domainStyles:a,domainStateString:r}=((t,e,i)=>{const n={};switch(Xt(t)){case"light":if(Jt(t)){const e=`${(t=>t.attributes.rgb_color.join(",")||void 0)(t)||"var(--rgb-primary-color)"}`;n["--atc-icon-color-active"]=`rgb(${e})`,n["--atc-icon-background-active"]=`rgba(${e}, 0.2)`}return Qt({entity:t,hass:e,config:i},{domainStyles:n});case"person":return i.use_entity_picture_as_icon&&t.attributes.entity_picture&&(n["--atc-icon-background"]=`url(${t.attributes.entity_picture})`,n["--atc-icon-background-active"]=`url(${t.attributes.entity_picture})`),Qt({entity:t,hass:e,config:i},{domainStyles:n});case"lock":return Qt({entity:t,hass:e,config:i},{domainStateString:"locked"!==t.state&&Yt(t,e)});default:return Qt({entity:t,hass:e,config:i});case"media_player":return Qt({entity:t,hass:e,config:i},{domainStateString:"playing"===t.state&&(t.attributes.media_title?t.attributes.media_title:Yt(t,e))});case"sensor":return Qt({entity:t,hass:e,config:i},{domainStateString:!!t.attributes.unit_of_measurement&&`${t.state} ${t.attributes.unit_of_measurement}`});case"binary_sensor":return Qt({entity:t,hass:e,config:i},{domainStateString:"on"===t.state&&Yt(t,e)})}})(this.entity,this.hass,this.config);return this.entityStyles=Object.assign({},a),this.entityClasses=Object.assign(Object.assign(Object.assign({},this.entityClasses),n),{isClicked:this.isClicked,isActive:this.isActive,isUnavailable:!this.isAvailable}),B` - ${this.entityUsesEntityPictureAsBackground&&(null===(e=this.entity)||void 0===e?void 0:e.attributes.entity_picture)?B` - - - `:""} + ${this.entityUsesEntityPictureAsBackground&&(null===(e=this.entity)||void 0===e?void 0:e.attributes.entity_picture)?B` + + `:""} - e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e) @touchmove=${this._handleIconTouchMove} > - ${this.entityUsesEntityPictureAsIcon?"":B` - - - `} + ${this.entityUsesEntityPictureAsIcon?"":B` `} - - ${this.config.name||this.entity.attributes.friendly_name} - - ${this.showStateString?B` - ${r||""} - `:""} + ${this.config.name||this.entity.attributes.friendly_name} + ${this.showStateString?B` ${r||""} `:""} - - `}_handleTap(t){this.toggleClickClass(),zt("light"),Ht(this,this.hass,this.config,t.detail.action)}_handleIconTouchMove(){this.isDragging=!0}_handleIconTap(t){if(this.isDragging)return void(this.isDragging=!1);t.preventDefault(),t.stopPropagation(),this.toggleClickClass(),zt("success");const e={entity:this.config.entity,tap_action:this.config.icon_tap_action};Ht(this,this.hass,e,"tap")}toggleClickClass(){this.isClicked=!0,setTimeout((()=>{this.isClicked=!1}),500)}_showWarning(t){return B` ${t} `}static get styles(){return g('* {\n box-sizing: border-box;\n}\n\n:host {\n aspect-ratio: 2/1;\n}\n\n:host(.square) {\n aspect-ratio: 1/1;\n}\n\nha-card {\n /*** \n * Variables START\n ***/\n --atc-default-card-background: var(--ha-card-background, var(--card-background-color, white));\n --atc-default-icon-color: rgb(var(--rgb-state-inactive-color));\n --atc-default-icon-color-active: rgb(var(--rgb-state-switch-color));\n --atc-default-icon-background: rgba(var(--rgb-state-inactive-color), 0.2);\n --atc-default-icon-background-active: rgba(var(--rgb-state-switch-color), 0.2);\n --atc-default-card-border-radius: var(--ha-card-border-radius, 12px);\n --atc-card-spacing: 1vw;\n --atc-card-spacing-small: 12px;\n --atc-card-border-radius: var(--atc-theme-card-border-radius, var(--atc-default-card-border-radius));\n --atc-card-background: var(--atc-theme-card-background, var(--atc-default-card-background));\n --atc-card-background-active: var(--atc-theme-card-background-active, var(--atc-default-card-background));\n --atc-card-background-mask: linear-gradient(0deg, transparent 0%, black 100%);\n --atc-icon-color: var(--atc-theme-icon-color, var(--atc-default-icon-color));\n --atc-icon-color-active: var(--atc-theme-icon-color-active, var(--atc-default-icon-color-active));\n --atc-icon-background: var(--atc-theme-icon-background, var(--atc-default-icon-background));\n --atc-icon-background-active: var(--atc-theme-icon-background-active, var(--atc-default-icon-background-active));\n --atc-name-font-size: var(--atc-theme-name-font-size, 16px);\n --atc-name-font-weight: var(--atc-theme-name-font-weight, 500);\n --atc-state-font-size: var(--atc-theme-state-font-size, 14px);\n --atc-state-font-weight: var(--atc-theme-state-font-weight, 400);\n --atc-text-color: var(--primary-text-color);\n --atc-text-color-active: var(--primary-text-color-active);\n /*** \n * Variables END\n ***/\n width: 100%;\n height: 100%;\n background: var(--atc-card-background);\n background-size: cover;\n background-position: center;\n border-radius: var(--atc-card-border-radius);\n cursor: pointer;\n /*** \n * Elements\n ***/\n /*** \n * Clicked State \n ***/\n /*** \n * Active State \n ***/\n}\nha-card .background-image {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 33%;\n left: 0;\n mask-image: var(--atc-card-background-mask);\n -webkit-mask-image: var(--atc-card-background-mask);\n border-top-right-radius: var(--atc-card-border-radius);\n border-top-left-radius: var(--atc-card-border-radius);\n}\nha-card .background-image img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n@media screen and (max-width: 800px) {\n ha-card {\n --atc-card-spacing: 3vw;\n }\n}\nha-card .container {\n display: grid;\n flex: 1;\n grid-template-columns: 50% 50%;\n grid-template-rows: 50% 50%;\n grid-template-areas: "icon-area additional-state-icon-area" "name-area name-area";\n width: 100%;\n height: 100%;\n}\nha-card .container .icon-area {\n padding-top: var(--atc-card-spacing);\n padding-right: calc(var(--atc-card-spacing) / 2);\n padding-bottom: calc(var(--atc-card-spacing) / 2);\n padding-left: var(--atc-card-spacing);\n grid-area: icon-area;\n --mdc-icon-size: 100%;\n}\nha-card .container .icon-area .icon-wrapper {\n border-radius: 100%;\n padding: 20%;\n width: 100%;\n height: 100%;\n position: relative;\n display: flex;\n align-items: center;\n background: var(--atc-icon-background);\n border: var(--atc-icon-border);\n justify-content: center;\n background-size: cover;\n transition: background-color 180ms ease-in-out 0s, border 180ms ease-in-out 0s;\n}\nha-card .container .icon-area .icon-wrapper .icon {\n transition: color 180ms ease-in-out 0s;\n color: var(--atc-icon-color);\n}\nha-card .container .state-icon-area {\n padding-top: var(--atc-card-spacing);\n padding-right: var(--atc-card-spacing);\n padding-bottom: calc(var(--atc-card-spacing) / 2);\n padding-left: calc(var(--atc-card-spacing) / 2);\n grid-area: additional-state-icon-area;\n display: flex;\n align-items: center;\n justify-content: center;\n}\nha-card .container .name-area {\n grid-area: name-area;\n color: var(--atc-text-color);\n padding-right: var(--atc-card-spacing);\n padding-bottom: var(--atc-card-spacing);\n padding-left: var(--atc-card-spacing);\n display: flex;\n flex-direction: column;\n justify-content: end;\n}\nha-card .container .name-area .entity-state {\n font-size: var(--atc-state-font-size);\n font-weight: var(--atc-state-font-weight);\n line-height: normal;\n max-width: 100%;\n}\nha-card .container .name-area .entity-name {\n font-size: var(--atc-name-font-size);\n font-weight: var(--atc-name-font-weight);\n line-height: normal;\n max-width: 100%;\n}\nha-card.clicked {\n animation: var(--atc-theme-click-animation);\n}\nha-card.active {\n background: var(--atc-card-background-active);\n background-size: cover;\n background-position: center;\n}\nha-card.active .container .icon-area .icon-wrapper {\n border: var(--atc-icon-border-active);\n background: var(--atc-icon-background-active);\n background-size: cover;\n background-position: center;\n}\nha-card.active .container .icon-area .icon-wrapper .icon {\n color: var(--atc-icon-color-active);\n}\nha-card.active .container .name-area {\n color: var(--atc-text-color-active);\n}\n\n/*** \n* Helper Classes \n***/\n.ellipsis {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n}\n\n@keyframes card_bounce {\n 0% {\n transform: scale(1);\n }\n 15% {\n transform: scale(0.9);\n }\n 25% {\n transform: scale(1);\n }\n 30% {\n transform: scale(0.98);\n }\n 100% {\n transform: scale(1);\n }\n}')}};l([ut()],te.prototype,"hass",void 0),l([ht()],te.prototype,"isClicked",void 0),l([ht()],te.prototype,"entityIsActive",void 0),l([ht()],te.prototype,"config",void 0),te=l([lt("advanced-tile-card")],te);var ee=te;window.customCards=window.customCards||[],window.customCards.push(t),console.info(`%c ${t.name} \n%c ${c("common.version")} 1.0.0 `,"color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray");const ie=(t,e,i,n)=>{const a=((t,e,i,n)=>{const a=((t,e,i,n)=>({entity:()=>({condition:()=>!0,name:"entity",label:n.localize("ui.components.entity.entity-picker.entity"),selector:{entity:{}}}),name:()=>({condition:()=>!0,name:"name",label:n.localize("ui.dialogs.helper_settings.generic.name"),type:"string"}),icon:()=>({condition:()=>!0,name:"icon",label:n.localize("ui.dialogs.helper_settings.generic.icon"),selector:{icon:{placeholder:t}}}),is_square:()=>({condition:()=>!0,name:"is_square",label:n.localize("ui.panel.lovelace.editor.card.grid.square"),selector:{boolean:{}}}),icon_tap_action:()=>({condition:()=>!0,name:"icon_tap_action",label:n.localize("ui.panel.lovelace.editor.card.tile.icon_tap_action"),selector:{"ui-action":{}}}),tap_action:()=>({condition:()=>!0,name:"tap_action",label:n.localize("ui.panel.lovelace.editor.card.generic.tap_action"),selector:{"ui-action":{}}}),show_state_string:()=>({condition:()=>!0,name:"show_state_string",label:n.localize("ui.panel.lovelace.editor.card.generic.show_state"),selector:{boolean:{}}}),conditional_state:()=>({condition:()=>!!i.show_state_string,name:"conditional_state",label:`${n.localize("ui.panel.lovelace.editor.card.conditional.name")}?`,selector:{boolean:{}}}),if_state:()=>({condition:()=>!!i.conditional_state,name:"if_state",label:n.localize("ui.panel.lovelace.editor.card.conditional.state_equal"),selector:{text:{}}}),use_attribute_as_state:()=>({condition:()=>!!i.show_state_string,name:"use_attribute_as_state",label:"Use attribute as state",selector:{boolean:{}}}),attribute_to_show:()=>({condition:()=>!!i.use_attribute_as_state,name:"attribute_to_show",label:n.localize("ui.panel.lovelace.editor.card.generic.attribute"),selector:{attribute:{entity_id:i.entity}}}),use_entity_picture_as_icon:()=>({condition:()=>"person"===e,name:"use_entity_picture_as_icon",label:`${n.localize("ui.dialogs.helper_settings.generic.icon")}: ${n.localize("ui.panel.lovelace.editor.card.tile.show_entity_picture")}`,selector:{boolean:{}}}),use_entity_picture_as_background:()=>({condition:()=>"person"===e||"camera"===e||"media_player"===e,name:"use_entity_picture_as_background",label:`Background: ${n.localize("ui.panel.lovelace.editor.card.tile.show_entity_picture")}`,selector:{boolean:{}}}),grid:t=>({condition:()=>!0,name:"",type:"grid",schema:t}),expandable_appearance:t=>({condition:()=>!!(null==t?void 0:t.length),name:"",type:"expandable",iconPath:"M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z",title:n.localize("ui.panel.lovelace.editor.card.tile.appearance"),schema:t}),expandable_actions:t=>({condition:()=>!!(null==t?void 0:t.length),name:"",type:"expandable",title:n.localize("ui.panel.lovelace.editor.card.tile.actions"),iconPath:"M10,9A1,1 0 0,1 11,8A1,1 0 0,1 12,9V13.47L13.21,13.6L18.15,15.79C18.68,16.03 19,16.56 19,17.14V21.5C18.97,22.32 18.32,22.97 17.5,23H11C10.62,23 10.26,22.85 10,22.57L5.1,18.37L5.84,17.6C6.03,17.39 6.3,17.28 6.58,17.28H6.8L10,19V9M11,5A4,4 0 0,1 15,9C15,10.5 14.2,11.77 13,12.46V11.24C13.61,10.69 14,9.89 14,9A3,3 0 0,0 11,6A3,3 0 0,0 8,9C8,9.89 8.39,10.69 9,11.24V12.46C7.8,11.77 7,10.5 7,9A4,4 0 0,1 11,5Z",schema:t}),expandable_state:t=>({condition:()=>!0,name:"",type:"expandable",title:n.localize("ui.panel.lovelace.editor.card.generic.state"),iconPath:"M6.27 17.05C6.72 17.58 7 18.25 7 19C7 20.66 5.66 22 4 22S1 20.66 1 19 2.34 16 4 16C4.18 16 4.36 16 4.53 16.05L7.6 10.69L5.86 9.7L9.95 8.58L11.07 12.67L9.33 11.68L6.27 17.05M20 16C18.7 16 17.6 16.84 17.18 18H11V16L8 19L11 22V20H17.18C17.6 21.16 18.7 22 20 22C21.66 22 23 20.66 23 19S21.66 16 20 16M12 8C12.18 8 12.36 8 12.53 7.95L15.6 13.31L13.86 14.3L17.95 15.42L19.07 11.33L17.33 12.32L14.27 6.95C14.72 6.42 15 5.75 15 5C15 3.34 13.66 2 12 2S9 3.34 9 5 10.34 8 12 8Z",schema:t})}))(t,e,i,n),r={};return Object.keys(a).forEach((t=>{r[t]=e=>{const i=a[t](e);return i.condition()?i:{}}})),r})(t,e,i,n);console.log(n);return[a.entity(),a.expandable_appearance([a.grid([a.name(),a.icon(),a.is_square()]),a.use_entity_picture_as_icon(),a.use_entity_picture_as_background()]),a.expandable_state([a.show_state_string(),a.grid([a.conditional_state(),a.if_state()]),a.grid([a.use_attribute_as_state(),a.attribute_to_show()])]),a.expandable_actions([a.tap_action(),a.icon_tap_action()])]};let ne;const ae=(t,e)=>{var i;const n=e&&ne!==t.entity,a=At(null!==(i=t.entity)&&void 0!==i?i:"");if(Object.keys(t).includes("is_square")||(t.is_square=!0),!Object.keys(t).includes("tap_action")||!t.tap_action||n)switch(a){case"person":case"alarm_control_panel":case"camera":case"sensor":case"binary_sensor":case"sun":t.tap_action={action:"more-info"};break;case"scene":t.tap_action={action:"call-service",service:"scene.turn_on",target:{entity_id:t.entity}};break;case"media_player":t.tap_action={action:"call-service",service:"media_player.media_play_pause",target:{entity_id:t.entity}};break;case"cover":t.tap_action={action:"call-service",service:"cover.toggle",target:{entity_id:t.entity}};break;default:t.tap_action={action:"toggle"}}return Object.keys(t).includes("use_entity_picture_as_icon")&&!n||(t.use_entity_picture_as_icon="person"===a),Object.keys(t).includes("use_entity_picture_as_background")||(t.use_entity_picture_as_background="camera"===a||"media_player"===a),Object.keys(t).includes("show_state_string")&&!n||(t.show_state_string="sensor"===a),ne=t.entity,t};let re=class extends ot{constructor(){super(...arguments),this._initialized=!1}setConfig(t){this._config=ae(t),this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}})),this.loadCardHelpers()}shouldUpdate(){return this._initialized||this._initialize(),!0}get _name(){var t;return(null===(t=this._config)||void 0===t?void 0:t.name)||""}get _entity(){var t;return(null===(t=this._config)||void 0===t?void 0:t.entity)||""}get _icon(){var t,e,i,n,a;return(null===(t=this._config)||void 0===t?void 0:t.icon)||(null===(e=this._config)||void 0===e?void 0:e.entity)&&(null===(i=this.hass)||void 0===i?void 0:i.states[this._config.entity].attributes.icon)||Pt(At(null!==(a=null===(n=this._config)||void 0===n?void 0:n.entity)&&void 0!==a?a:""))||""}_handleChange(t){if(!this._config)return;const e=ae(t.detail.value,!0);this._config=Object.assign(Object.assign({},this._config),e),this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}}))}render(){var t,e;return this.hass&&this._helpers&&this._config?B` + `}_handleTap(t){this.toggleClickClass(),zt("light"),Ht(this,this.hass,this.config,t.detail.action)}_handleIconTouchMove(){this.isDragging=!0}_handleIconTap(t){if(this.isDragging)return void(this.isDragging=!1);t.preventDefault(),t.stopPropagation(),this.toggleClickClass(),zt("success");const e={entity:this.config.entity,tap_action:this.config.icon_tap_action};Ht(this,this.hass,e,"tap")}toggleClickClass(){this.isClicked=!0,setTimeout((()=>{this.isClicked=!1}),500)}_showWarning(t){return B` ${t} `}static get styles(){return v('* {\n box-sizing: border-box;\n}\n\n:host {\n aspect-ratio: 2/1;\n}\n\n:host(.square) {\n aspect-ratio: 1/1;\n}\n\nha-card {\n /*** \n * Variables START\n ***/\n --atc-default-card-background: var(--ha-card-background, var(--card-background-color, white));\n --atc-default-icon-color: rgb(var(--rgb-state-inactive-color));\n --atc-default-icon-color-active: rgb(var(--rgb-state-switch-color));\n --atc-default-icon-background: rgba(var(--rgb-state-inactive-color), 0.2);\n --atc-default-icon-background-active: rgba(var(--rgb-state-switch-color), 0.2);\n --atc-default-card-border-radius: var(--ha-card-border-radius, 12px);\n --atc-card-spacing: 1vw;\n --atc-card-spacing-small: 12px;\n --atc-card-border-radius: var(--atc-theme-card-border-radius, var(--atc-default-card-border-radius));\n --atc-card-background: var(--atc-theme-card-background, var(--atc-default-card-background));\n --atc-card-background-active: var(--atc-theme-card-background-active, var(--atc-default-card-background));\n --atc-card-background-unavailable: var(--atc-theme-card-background-unavailable, transparent);\n --atc-card-background-mask: linear-gradient(0deg, transparent 0%, black 100%);\n --atc-icon-color: var(--atc-theme-icon-color, var(--atc-default-icon-color));\n --atc-icon-color-active: var(--atc-theme-icon-color-active, var(--atc-default-icon-color-active));\n --atc-icon-color-unavailable: var(--primary-text-color-unavailable);\n --atc-icon-background: var(--atc-theme-icon-background, var(--atc-default-icon-background));\n --atc-icon-background-active: var(--atc-theme-icon-background-active, var(--atc-default-icon-background-active));\n --atc-icon-background-unavailable: var(\n --atc-theme-icon-background-unavailable,\n var(var(--atc-default-card-background))\n );\n --atc-name-font-size: var(--atc-theme-name-font-size, 16px);\n --atc-name-font-weight: var(--atc-theme-name-font-weight, 500);\n --atc-state-font-size: var(--atc-theme-state-font-size, 14px);\n --atc-state-font-weight: var(--atc-theme-state-font-weight, 400);\n --atc-text-color: var(--primary-text-color);\n --atc-text-color-active: var(--primary-text-color-active);\n --atc-text-color-unavailable: var(--primary-text-color-unavailable);\n /*** \n * Variables END\n ***/\n width: 100%;\n height: 100%;\n background: var(--atc-card-background);\n background-size: cover;\n background-position: center;\n border-radius: var(--atc-card-border-radius);\n cursor: pointer;\n /*** \n * Elements\n ***/\n /*** \n * Available State \n ***/\n /*** \n * Clicked State \n ***/\n /*** \n * Active State \n ***/\n}\nha-card .background-image {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 33%;\n left: 0;\n mask-image: var(--atc-card-background-mask);\n -webkit-mask-image: var(--atc-card-background-mask);\n border-top-right-radius: var(--atc-card-border-radius);\n border-top-left-radius: var(--atc-card-border-radius);\n}\nha-card .background-image img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n@media screen and (max-width: 800px) {\n ha-card {\n --atc-card-spacing: 3vw;\n }\n}\nha-card .container {\n display: grid;\n flex: 1;\n grid-template-columns: 50% 50%;\n grid-template-rows: 50% 50%;\n grid-template-areas: "icon-area additional-state-icon-area" "name-area name-area";\n width: 100%;\n height: 100%;\n}\nha-card .container .icon-area {\n padding-top: var(--atc-card-spacing);\n padding-right: calc(var(--atc-card-spacing) / 2);\n padding-bottom: calc(var(--atc-card-spacing) / 2);\n padding-left: var(--atc-card-spacing);\n grid-area: icon-area;\n --mdc-icon-size: 100%;\n}\nha-card .container .icon-area .icon-wrapper {\n border-radius: 100%;\n padding: 20%;\n width: 100%;\n height: 100%;\n position: relative;\n display: flex;\n align-items: center;\n background: var(--atc-icon-background);\n border: var(--atc-icon-border);\n justify-content: center;\n background-size: cover;\n transition: background-color 180ms ease-in-out 0s, border 180ms ease-in-out 0s;\n}\nha-card .container .icon-area .icon-wrapper .icon {\n transition: color 180ms ease-in-out 0s;\n color: var(--atc-icon-color);\n}\nha-card .container .state-icon-area {\n padding-top: var(--atc-card-spacing);\n padding-right: var(--atc-card-spacing);\n padding-bottom: calc(var(--atc-card-spacing) / 2);\n padding-left: calc(var(--atc-card-spacing) / 2);\n grid-area: additional-state-icon-area;\n display: flex;\n align-items: center;\n justify-content: center;\n}\nha-card .container .name-area {\n grid-area: name-area;\n color: var(--atc-text-color);\n padding-right: var(--atc-card-spacing);\n padding-bottom: var(--atc-card-spacing);\n padding-left: var(--atc-card-spacing);\n display: flex;\n flex-direction: column;\n justify-content: end;\n}\nha-card .container .name-area .entity-state {\n font-size: var(--atc-state-font-size);\n font-weight: var(--atc-state-font-weight);\n line-height: normal;\n max-width: 100%;\n}\nha-card .container .name-area .entity-name {\n font-size: var(--atc-name-font-size);\n font-weight: var(--atc-name-font-weight);\n line-height: normal;\n max-width: 100%;\n}\nha-card.isUnavailable {\n background: var(--atc-card-background-unavailable);\n}\nha-card.isUnavailable .container .name-area {\n color: var(--atc-text-color-unavailable);\n}\nha-card.isUnavailable .container .icon-area .icon-wrapper {\n background: var(--atc-icon-background-unavailable);\n}\nha-card.isUnavailable .container .icon-area .icon-wrapper .icon {\n color: var(--atc-icon-color-unavailable);\n}\nha-card.isClicked {\n animation: var(--atc-theme-click-animation);\n}\nha-card.isActive {\n background: var(--atc-card-background-active);\n background-size: cover;\n background-position: center;\n}\nha-card.isActive .container .icon-area .icon-wrapper {\n border: var(--atc-icon-border-active);\n background: var(--atc-icon-background-active);\n background-size: cover;\n background-position: center;\n}\nha-card.isActive .container .icon-area .icon-wrapper .icon {\n color: var(--atc-icon-color-active);\n}\nha-card.isActive .container .name-area {\n color: var(--atc-text-color-active);\n}\n\n/*** \n* Helper Classes \n***/\n.ellipsis {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n}\n\n@keyframes card_bounce {\n 0% {\n transform: scale(1);\n }\n 15% {\n transform: scale(0.9);\n }\n 25% {\n transform: scale(1);\n }\n 30% {\n transform: scale(0.98);\n }\n 100% {\n transform: scale(1);\n }\n}')}};l([ut()],te.prototype,"hass",void 0),l([ht()],te.prototype,"isClicked",void 0),l([ht()],te.prototype,"isAvailable",void 0),l([ht()],te.prototype,"isActive",void 0),l([ht()],te.prototype,"config",void 0),te=l([lt("advanced-tile-card")],te);var ee=te;window.customCards=window.customCards||[],window.customCards.push(t),console.info(`%c ${t.name} \n%c ${c("common.version")} 1.0.0 `,"color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray");const ie=(t,e,i,n)=>{const a=((t,e,i,n)=>{const a=((t,e,i,n)=>({entity:()=>({condition:()=>!0,name:"entity",label:n.localize("ui.components.entity.entity-picker.entity"),selector:{entity:{}}}),name:()=>({condition:()=>!0,name:"name",label:n.localize("ui.dialogs.helper_settings.generic.name"),type:"string"}),icon:()=>({condition:()=>!0,name:"icon",label:n.localize("ui.dialogs.helper_settings.generic.icon"),selector:{icon:{placeholder:t}}}),is_square:()=>({condition:()=>!0,name:"is_square",label:n.localize("ui.panel.lovelace.editor.card.grid.square"),selector:{boolean:{}}}),icon_tap_action:()=>({condition:()=>!0,name:"icon_tap_action",label:n.localize("ui.panel.lovelace.editor.card.tile.icon_tap_action"),selector:{"ui-action":{}}}),tap_action:()=>({condition:()=>!0,name:"tap_action",label:n.localize("ui.panel.lovelace.editor.card.generic.tap_action"),selector:{"ui-action":{}}}),show_state_string:()=>({condition:()=>!0,name:"show_state_string",label:n.localize("ui.panel.lovelace.editor.card.generic.show_state"),selector:{boolean:{}}}),conditional_state:()=>({condition:()=>!!i.show_state_string,name:"conditional_state",label:`${n.localize("ui.panel.lovelace.editor.card.conditional.name")}?`,selector:{boolean:{}}}),if_state:()=>({condition:()=>!!i.conditional_state,name:"if_state",label:n.localize("ui.panel.lovelace.editor.card.conditional.state_equal"),selector:{text:{}}}),use_attribute_as_state:()=>({condition:()=>!!i.show_state_string,name:"use_attribute_as_state",label:"Use attribute as state",selector:{boolean:{}}}),attribute_to_show:()=>({condition:()=>!!i.use_attribute_as_state,name:"attribute_to_show",label:n.localize("ui.panel.lovelace.editor.card.generic.attribute"),selector:{attribute:{entity_id:i.entity}}}),use_entity_picture_as_icon:()=>({condition:()=>"person"===e,name:"use_entity_picture_as_icon",label:`${n.localize("ui.dialogs.helper_settings.generic.icon")}: ${n.localize("ui.panel.lovelace.editor.card.tile.show_entity_picture")}`,selector:{boolean:{}}}),use_entity_picture_as_background:()=>({condition:()=>"person"===e||"camera"===e||"media_player"===e,name:"use_entity_picture_as_background",label:`Background: ${n.localize("ui.panel.lovelace.editor.card.tile.show_entity_picture")}`,selector:{boolean:{}}}),grid:t=>({condition:()=>!0,name:"",type:"grid",schema:t}),expandable_appearance:t=>({condition:()=>!!(null==t?void 0:t.length),name:"",type:"expandable",iconPath:"M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z",title:n.localize("ui.panel.lovelace.editor.card.tile.appearance"),schema:t}),expandable_actions:t=>({condition:()=>!!(null==t?void 0:t.length),name:"",type:"expandable",title:n.localize("ui.panel.lovelace.editor.card.tile.actions"),iconPath:"M10,9A1,1 0 0,1 11,8A1,1 0 0,1 12,9V13.47L13.21,13.6L18.15,15.79C18.68,16.03 19,16.56 19,17.14V21.5C18.97,22.32 18.32,22.97 17.5,23H11C10.62,23 10.26,22.85 10,22.57L5.1,18.37L5.84,17.6C6.03,17.39 6.3,17.28 6.58,17.28H6.8L10,19V9M11,5A4,4 0 0,1 15,9C15,10.5 14.2,11.77 13,12.46V11.24C13.61,10.69 14,9.89 14,9A3,3 0 0,0 11,6A3,3 0 0,0 8,9C8,9.89 8.39,10.69 9,11.24V12.46C7.8,11.77 7,10.5 7,9A4,4 0 0,1 11,5Z",schema:t}),expandable_state:t=>({condition:()=>!0,name:"",type:"expandable",title:n.localize("ui.panel.lovelace.editor.card.generic.state"),iconPath:"M6.27 17.05C6.72 17.58 7 18.25 7 19C7 20.66 5.66 22 4 22S1 20.66 1 19 2.34 16 4 16C4.18 16 4.36 16 4.53 16.05L7.6 10.69L5.86 9.7L9.95 8.58L11.07 12.67L9.33 11.68L6.27 17.05M20 16C18.7 16 17.6 16.84 17.18 18H11V16L8 19L11 22V20H17.18C17.6 21.16 18.7 22 20 22C21.66 22 23 20.66 23 19S21.66 16 20 16M12 8C12.18 8 12.36 8 12.53 7.95L15.6 13.31L13.86 14.3L17.95 15.42L19.07 11.33L17.33 12.32L14.27 6.95C14.72 6.42 15 5.75 15 5C15 3.34 13.66 2 12 2S9 3.34 9 5 10.34 8 12 8Z",schema:t})}))(t,e,i,n),r={};return Object.keys(a).forEach((t=>{r[t]=e=>{const i=a[t](e);return i.condition()?i:{}}})),r})(t,e,i,n);console.log(n);return[a.entity(),a.expandable_appearance([a.grid([a.name(),a.icon(),a.is_square()]),a.use_entity_picture_as_icon(),a.use_entity_picture_as_background()]),a.expandable_state([a.show_state_string(),a.grid([a.conditional_state(),a.if_state()]),a.grid([a.use_attribute_as_state(),a.attribute_to_show()])]),a.expandable_actions([a.tap_action(),a.icon_tap_action()])]};let ne;const ae=(t,e)=>{var i;const n=e&&ne!==t.entity,a=At(null!==(i=t.entity)&&void 0!==i?i:"");if(Object.keys(t).includes("is_square")||(t.is_square=!0),!Object.keys(t).includes("tap_action")||!t.tap_action||n)switch(a){case"person":case"alarm_control_panel":case"camera":case"sensor":case"binary_sensor":case"sun":t.tap_action={action:"more-info"};break;case"scene":t.tap_action={action:"call-service",service:"scene.turn_on",target:{entity_id:t.entity}};break;case"media_player":t.tap_action={action:"call-service",service:"media_player.media_play_pause",target:{entity_id:t.entity}};break;case"cover":t.tap_action={action:"call-service",service:"cover.toggle",target:{entity_id:t.entity}};break;default:t.tap_action={action:"toggle"}}return Object.keys(t).includes("use_entity_picture_as_icon")&&!n||(t.use_entity_picture_as_icon="person"===a),Object.keys(t).includes("use_entity_picture_as_background")||(t.use_entity_picture_as_background="camera"===a||"media_player"===a),Object.keys(t).includes("show_state_string")&&!n||(t.show_state_string="sensor"===a),ne=t.entity,t};let re=class extends ot{constructor(){super(...arguments),this._initialized=!1}setConfig(t){this._config=ae(t),this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}})),this.loadCardHelpers()}shouldUpdate(){return this._initialized||this._initialize(),!0}get _name(){var t;return(null===(t=this._config)||void 0===t?void 0:t.name)||""}get _entity(){var t;return(null===(t=this._config)||void 0===t?void 0:t.entity)||""}get _icon(){var t,e,i,n,a;return(null===(t=this._config)||void 0===t?void 0:t.icon)||(null===(e=this._config)||void 0===e?void 0:e.entity)&&(null===(i=this.hass)||void 0===i?void 0:i.states[this._config.entity].attributes.icon)||Pt(At(null!==(a=null===(n=this._config)||void 0===n?void 0:n.entity)&&void 0!==a?a:""))||""}_handleChange(t){if(!this._config)return;const e=ae(t.detail.value,!0);this._config=Object.assign(Object.assign({},this._config),e),this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}}))}render(){var t,e;return this.hass&&this._helpers&&this._config?B` { @@ -37,13 +37,15 @@ export default class Card extends LitElement { public static async getStubConfig(hass: HomeAssistant): Promise> { const entities = Object.keys(hass.states); // Pick first light entity for preview - const lights = entities.filter((e) => ['light'].includes(e.split(".")[0])); + const lights = entities.filter((e) => ['light'].includes(e.split('.')[0])); return { entity: lights[0], }; } @state() private isClicked = false; + @state() private isAvailable = false; + @state() private isActive = false; private isDragging = false; @@ -54,18 +56,14 @@ export default class Card extends LitElement { private entityUsesEntityPictureAsBackground = false; private showStateString = false; private attributeToShow?: string | null; - @state() private entityIsActive = false; private entityClasses: Record = {}; - private entityStyles: Record = {}; - - - + private entityStyles: Record = {}; @state() private config!: AdvancedTileCardConfig; getCardSize(): number | Promise { return 1; -} + } // https://lit.dev/docs/components/properties/#accessors-custom public setConfig(config: AdvancedTileCardConfig): void { @@ -76,9 +74,9 @@ export default class Card extends LitElement { if (config.test_gui) { getLovelace().setEditMode(true); } - + this.className += config.is_square ? ' square' : ''; - + this.config = config; } @@ -93,7 +91,7 @@ export default class Card extends LitElement { // https://lit.dev/docs/components/rendering/ protected render(): TemplateResult | void { - if(!this.config.entity) { + if (!this.config.entity) { return this._showWarning(localize('common.missing_entity')); } @@ -105,22 +103,24 @@ export default class Card extends LitElement { this.entityUsesEntityPictureAsBackground = this.config.use_entity_picture_as_background || false; this.showStateString = this.config.show_state_string || false; this.attributeToShow = this.config.attribute_to_show || null; - this.entityIsActive = isEntityActive(this.entity); - - const { - domainClasses, - domainStyles, - domainStateString, - } = computeDomainOptions(this.entity, this.hass, this.config); - + this.isActive = isEntityActive(this.entity); + this.isAvailable = this.entity !== undefined && this.entity.state !== 'unavailable'; + + const { domainClasses, domainStyles, domainStateString } = computeDomainOptions( + this.entity, + this.hass, + this.config, + ); + this.entityStyles = { - ...domainStyles + ...domainStyles, }; this.entityClasses = { ...this.entityClasses, ...domainClasses, - clicked: this.isClicked, - active: this.entityIsActive + isClicked: this.isClicked, + isActive: this.isActive, + isUnavailable: !this.isAvailable, }; return html` @@ -131,17 +131,16 @@ export default class Card extends LitElement { hasHold: hasAction(this.config.hold_action), hasDoubleClick: hasAction(this.config.double_tap_action), })} - style="${styleMap(this.entityStyles)}" + style="${styleMap(this.entityStyles)}" tabindex="0" > - ${this.entityUsesEntityPictureAsBackground && this.entity?.attributes.entity_picture ? html` - - - ` : '' - } + ${this.entityUsesEntityPictureAsBackground && this.entity?.attributes.entity_picture + ? html` + + ` + : ''} - - ${!this.entityUsesEntityPictureAsIcon ? html` - - - ` : ''} + ${!this.entityUsesEntityPictureAsIcon + ? html` ` + : ''} - - ${this.config.name || this.entity.attributes.friendly_name} - - ${this.showStateString ? html` - ${domainStateString || ''} - ` : '' - } + ${this.config.name || this.entity.attributes.friendly_name} + ${this.showStateString ? html` ${domainStateString || ''} ` : ''} - `; @@ -201,14 +193,14 @@ export default class Card extends LitElement { tap_action: this.config.icon_tap_action, }; - handleAction(this, this.hass, config, "tap"); + handleAction(this, this.hass, config, 'tap'); } private toggleClickClass(): void { this.isClicked = true; setTimeout(() => { - this.isClicked = false + this.isClicked = false; }, 500); } diff --git a/src/Card/styles.scss b/src/Card/styles.scss index cf6f846..84a70aa 100644 --- a/src/Card/styles.scss +++ b/src/Card/styles.scss @@ -26,19 +26,25 @@ ha-card { --atc-card-spacing: 1vw; --atc-card-spacing-small: 12px; --atc-card-border-radius: var(--atc-theme-card-border-radius, var(--atc-default-card-border-radius)); - + // Card background variables --atc-card-background: var(--atc-theme-card-background, var(--atc-default-card-background)); --atc-card-background-active: var(--atc-theme-card-background-active, var(--atc-default-card-background)); + --atc-card-background-unavailable: var(--atc-theme-card-background-unavailable, transparent); --atc-card-background-mask: linear-gradient(0deg, transparent 0%, black 100%); // Card Icon variables --atc-icon-color: var(--atc-theme-icon-color, var(--atc-default-icon-color)); --atc-icon-color-active: var(--atc-theme-icon-color-active, var(--atc-default-icon-color-active)); + --atc-icon-color-unavailable: var(--primary-text-color-unavailable); --atc-icon-background: var(--atc-theme-icon-background, var(--atc-default-icon-background)); --atc-icon-background-active: var(--atc-theme-icon-background-active, var(--atc-default-icon-background-active)); + --atc-icon-background-unavailable: var( + --atc-theme-icon-background-unavailable, + var(var(--atc-default-card-background)) + ); // Font sizes --atc-name-font-size: var(--atc-theme-name-font-size, 16px); @@ -49,12 +55,12 @@ ha-card { // Card text variables --atc-text-color: var(--primary-text-color); --atc-text-color-active: var(--primary-text-color-active); - + --atc-text-color-unavailable: var(--primary-text-color-unavailable); + /*** * Variables END ***/ - width: 100%; height: 100%; @@ -103,8 +109,8 @@ ha-card { grid-template-columns: 50% 50%; grid-template-rows: 50% 50%; grid-template-areas: - "icon-area additional-state-icon-area" - "name-area name-area"; + 'icon-area additional-state-icon-area' + 'name-area name-area'; width: 100%; height: 100%; @@ -146,7 +152,7 @@ ha-card { align-items: center; justify-content: center; } - + .name-area { grid-area: name-area; color: var(--atc-text-color); @@ -171,11 +177,31 @@ ha-card { } } + /*** + * Available State + ***/ + &.isUnavailable { + background: var(--atc-card-background-unavailable); + .container { + .name-area { + color: var(--atc-text-color-unavailable); + } + .icon-area { + .icon-wrapper { + background: var(--atc-icon-background-unavailable); + .icon { + color: var(--atc-icon-color-unavailable); + } + } + } + } + } + /*** * Clicked State ***/ - &.clicked { + &.isClicked { animation: var(--atc-theme-click-animation); } @@ -183,7 +209,7 @@ ha-card { * Active State ***/ - &.active{ + &.isActive { background: var(--atc-card-background-active); background-size: cover; // if it's an image background-position: center; // if it's an image @@ -199,14 +225,13 @@ ha-card { } } - .name-area{ + .name-area { color: var(--atc-text-color-active); } } } } - /*** * Helper Classes ***/ @@ -217,7 +242,6 @@ ha-card { overflow: hidden; } - @keyframes card_bounce { 0% { transform: scale(1); @@ -234,4 +258,4 @@ ha-card { 100% { transform: scale(1); } -} \ No newline at end of file +} diff --git a/src/Editor/rawSchema.ts b/src/Editor/rawSchema.ts index 4d93c3e..34c6723 100644 --- a/src/Editor/rawSchema.ts +++ b/src/Editor/rawSchema.ts @@ -1,6 +1,6 @@ -import { mdiGestureTap, mdiPalette, mdiStateMachine } from "@mdi/js"; -import { HomeAssistant } from "custom-card-helpers"; -import { AdvancedTileCardConfig } from "../types"; +import { mdiGestureTap, mdiPalette, mdiStateMachine } from '@mdi/js'; +import { HomeAssistant } from 'custom-card-helpers'; +import { AdvancedTileCardConfig } from '../types'; type SchemaObjectType = { condition: () => boolean; @@ -19,143 +19,145 @@ export type SchemaType = { }; const rawSchema = (icon: string, domain: string, config: AdvancedTileCardConfig, hass: HomeAssistant): SchemaType => ({ - entity: () => ({ - condition: () => true, - name: 'entity', - label: hass.localize('ui.components.entity.entity-picker.entity'), - selector: { - entity: {}, + entity: () => ({ + condition: () => true, + name: 'entity', + label: hass.localize('ui.components.entity.entity-picker.entity'), + selector: { + entity: {}, + }, + }), + name: () => ({ + condition: () => true, + name: 'name', + label: hass.localize('ui.dialogs.helper_settings.generic.name'), + type: 'string', + }), + icon: () => ({ + condition: () => true, + name: 'icon', + label: hass.localize('ui.dialogs.helper_settings.generic.icon'), + selector: { + icon: { + placeholder: icon, }, - }), - name: () => ({ - condition: () => true, - name: 'name', - label: hass.localize('ui.dialogs.helper_settings.generic.name'), - type: 'string', - }), - icon: () => ({ - condition: () => true, - name: 'icon', - label: hass.localize('ui.dialogs.helper_settings.generic.icon'), - selector: { - icon: { - placeholder: icon - }, + }, + }), + is_square: () => ({ + condition: () => true, + name: 'is_square', + label: hass.localize('ui.panel.lovelace.editor.card.grid.square'), + selector: { + boolean: {}, + }, + }), + icon_tap_action: () => ({ + condition: () => true, + name: 'icon_tap_action', + label: hass.localize('ui.panel.lovelace.editor.card.tile.icon_tap_action'), + selector: { + 'ui-action': {}, + }, + }), + tap_action: () => ({ + condition: () => true, + name: 'tap_action', + label: hass.localize('ui.panel.lovelace.editor.card.generic.tap_action'), + selector: { + 'ui-action': {}, + }, + }), + show_state_string: () => ({ + condition: () => true, + name: 'show_state_string', + label: hass.localize('ui.panel.lovelace.editor.card.generic.show_state'), + selector: { + boolean: {}, + }, + }), + conditional_state: () => ({ + condition: () => !!config.show_state_string, + name: 'conditional_state', + label: `${hass.localize('ui.panel.lovelace.editor.card.conditional.name')}?`, + selector: { + boolean: {}, + }, + }), + if_state: () => ({ + condition: () => !!config.conditional_state, + name: 'if_state', + label: hass.localize('ui.panel.lovelace.editor.card.conditional.state_equal'), + selector: { + text: {}, + }, + }), + use_attribute_as_state: () => ({ + condition: () => !!config.show_state_string, + name: 'use_attribute_as_state', + label: 'Use attribute as state', + selector: { + boolean: {}, + }, + }), + attribute_to_show: () => ({ + condition: () => !!config.use_attribute_as_state, + name: 'attribute_to_show', + label: hass.localize('ui.panel.lovelace.editor.card.generic.attribute'), + selector: { + attribute: { + entity_id: config.entity, }, - }), - is_square: () => ({ - condition: () => true, - name: 'is_square', - label: hass.localize('ui.panel.lovelace.editor.card.grid.square'), - selector: { - boolean: {} - } - }), - icon_tap_action: () => ({ - condition: () => true, - name: 'icon_tap_action', - label: hass.localize('ui.panel.lovelace.editor.card.tile.icon_tap_action'), - selector: { - "ui-action": {} - } - }), - tap_action: () => ({ - condition: () => true, - name: 'tap_action', - label: hass.localize('ui.panel.lovelace.editor.card.generic.tap_action'), - selector: { - "ui-action": {} - } - }), - show_state_string: () => ({ - condition: () => true, - name: 'show_state_string', - label: hass.localize('ui.panel.lovelace.editor.card.generic.show_state'), - selector: { - boolean: {} - } - }), - conditional_state: () => ({ - condition: () => !!config.show_state_string, - name: 'conditional_state', - label: `${hass.localize('ui.panel.lovelace.editor.card.conditional.name')}?`, - selector: { - boolean: {} - }, - }), - if_state: () => ({ - condition: () => !!config.conditional_state, - name: 'if_state', - label: hass.localize('ui.panel.lovelace.editor.card.conditional.state_equal'), - selector: { - text: {} - } - }), - use_attribute_as_state: () => ({ - condition: () => !!config.show_state_string, - name: 'use_attribute_as_state', - label: 'Use attribute as state', - selector: { - boolean: {} - }, - }), - attribute_to_show: () => ({ - condition: () => !!config.use_attribute_as_state, - name: 'attribute_to_show', - label: hass.localize('ui.panel.lovelace.editor.card.generic.attribute'), - selector: { - attribute: { - entity_id: config.entity - } - } - }), - use_entity_picture_as_icon: () => ({ - condition: () => domain === 'person', - name: 'use_entity_picture_as_icon', - label: `${hass.localize('ui.dialogs.helper_settings.generic.icon')}: ${hass.localize('ui.panel.lovelace.editor.card.tile.show_entity_picture')}`, - selector: { - boolean: {} - } - }), - use_entity_picture_as_background: () => ({ - condition: () => domain === 'person' || domain === 'camera' || domain === 'media_player', - name: 'use_entity_picture_as_background', - label: `Background: ${hass.localize('ui.panel.lovelace.editor.card.tile.show_entity_picture')}`, - selector: { - boolean: {} - } - }), + }, + }), + use_entity_picture_as_icon: () => ({ + condition: () => domain === 'person', + name: 'use_entity_picture_as_icon', + label: `${hass.localize('ui.dialogs.helper_settings.generic.icon')}: ${hass.localize( + 'ui.panel.lovelace.editor.card.tile.show_entity_picture', + )}`, + selector: { + boolean: {}, + }, + }), + use_entity_picture_as_background: () => ({ + condition: () => domain === 'person' || domain === 'camera' || domain === 'media_player', + name: 'use_entity_picture_as_background', + label: `Background: ${hass.localize('ui.panel.lovelace.editor.card.tile.show_entity_picture')}`, + selector: { + boolean: {}, + }, + }), - grid: (childs) => ({ - condition: () => true, - name: "", - type: "grid", - schema: childs, - }), - expandable_appearance: (childs) => ({ - condition: () => !!childs?.length, - name: "", - type: "expandable", - iconPath: mdiPalette, - title: hass.localize('ui.panel.lovelace.editor.card.tile.appearance'), - schema: childs, - }), - expandable_actions: (childs) => ({ - condition: () => !!childs?.length, - name: "", - type: "expandable", - title: hass.localize('ui.panel.lovelace.editor.card.tile.actions'), - iconPath: mdiGestureTap, - schema: childs, - }), - expandable_state: (childs) => ({ - condition: () => true, - name: "", - type: "expandable", - title: hass.localize('ui.panel.lovelace.editor.card.generic.state'), - iconPath: mdiStateMachine, - schema: childs, - }), + grid: (childs) => ({ + condition: () => true, + name: '', + type: 'grid', + schema: childs, + }), + expandable_appearance: (childs) => ({ + condition: () => !!childs?.length, + name: '', + type: 'expandable', + iconPath: mdiPalette, + title: hass.localize('ui.panel.lovelace.editor.card.tile.appearance'), + schema: childs, + }), + expandable_actions: (childs) => ({ + condition: () => !!childs?.length, + name: '', + type: 'expandable', + title: hass.localize('ui.panel.lovelace.editor.card.tile.actions'), + iconPath: mdiGestureTap, + schema: childs, + }), + expandable_state: (childs) => ({ + condition: () => true, + name: '', + type: 'expandable', + title: hass.localize('ui.panel.lovelace.editor.card.generic.state'), + iconPath: mdiStateMachine, + schema: childs, + }), }); const schema = (icon: string, domain: string, config: AdvancedTileCardConfig, hass: HomeAssistant) => { @@ -165,10 +167,10 @@ const schema = (icon: string, domain: string, config: AdvancedTileCardConfig, ha validatedSchema[key] = (childs) => { const currentSchemaObject = schemaObject[key](childs); // Only add the schema object if the condition is true - return currentSchemaObject.condition() ? currentSchemaObject : {} - } + return currentSchemaObject.condition() ? currentSchemaObject : {}; + }; }); return validatedSchema as SchemaType; }; -export default schema; \ No newline at end of file +export default schema; diff --git a/theme.yaml b/theme.yaml index 09d7e19..4872238 100644 --- a/theme.yaml +++ b/theme.yaml @@ -13,29 +13,36 @@ Gugg iis: # Card variables atc-theme-card-background: rgba(115, 115, 115, 0.2) atc-theme-card-background-active: rgba(255, 255, 255, 0.9) + atc-theme-card-background-unavailable: rgba(115, 115, 115, 0.1) atc-theme-card-border-radius: 16px atc-theme-click-animation: "card_bounce 900ms cubic-bezier(0.22, 1, 0.36, 1)" + atc-theme-name-font-size: 16px + atc-theme-name-font-weight: 500 + atc-theme-state-font-size: 14px + atc-theme-state-font-weight: 400 # Icon variables atc-theme-icon-color: var(--primary-text-color) atc-theme-icon-color-active: var(--primary-color) atc-theme-icon-background: "#626a6f" atc-theme-icon-background-active: var(--light-primary-color) - atc-theme-icon-border: "1px solid #9da0a2" - atc-theme-icon-border-active: "2px solid var(--primary-color)" + atc-theme-icon-background-unavailable: var(--atc-theme-card-background-unavailable) + atc-theme-card-gap: 16px + # hassio vars lovelace-background: url('/local/lovelace/background.png') primary-text-color: "#e1e1e1" primary-text-color-active: rgba(0, 0, 0, 0.6) + primary-text-color-unavailable: "#717171" ha-card-border-width: 0 #default dark mode primary-color: "#03a9f4" card-background-color: var(--atc-theme-card-background) - grid-card-gap: 16px - masonry-view-card-margin: 4px 5% 8px + grid-card-gap: var(--atc-theme-card-gap) + masonry-view-card-margin: 4px 16px 8px ha-card-header-color: rgba(255, 255, 255, 0.8) # secondary-background-color: "#202020" @@ -71,6 +78,11 @@ Gugg iis: # background: url('/local/background.png'); # background-size: cover; # } + card-mod-more-info-yaml: | + $: | + ha-dialog { + --card-background-color: red; + } card-mod-view-yaml: | .: | hui-view { @@ -83,33 +95,49 @@ Gugg iis: #main { order: 2 } - - hui-grid-card: - $: | - #root#root { - grid-gap: calc(2 * var(--grid-card-gap, 8px)) - } - /* default */ - h1 { - font-size: 2.4vw !important; - line-height: 0 !important; - font-family: Roboto !important; - font-weight: 500 !important; - color: rgba(255, 255, 255, 0.8) !important; - padding: 1vw 0 2vw 0 !important; + #sidebar#sidebar { + max-width: 300px; + width: 300px; + } + /* phone */ + @media screen and (max-width: 800px) { + #sidebar#sidebar { + display: none; } - /* portrait */ - @media screen and (max-width: 1200px) { - h1 { - font-size: 3.3vw !important; - line-height: 1.1vw !important; - } + hui-grid-card { + --grid-card-column-count: 1 !important; } - /* phone */ - @media screen and (max-width: 800px) { - h1 { - font-size: 5.5vw !important; - line-height: 6vw !important; - margin: 2vw 0 0 0 !important; + } + hui-grid-card: + $: + .: | + #root { + --grid-card-gap: calc(2 * var(--atc-theme-card-gap, 16px)); } - } + hui-grid-card: + $: | + #root { + --grid-card-gap: var(--atc-theme-card-gap, 16px); + } + /* default */ + h1.card-header { + padding-left: 0; + padding-right: 0; + font-size: 25px; + font-weight: 400; + } + /* portrait */ + @media screen and (max-width: 1200px) { + h1 { + /* font-size: 1.3vw !important; */ + /* !include line-height: 1.1vw !important; */ + } + } + /* phone */ + @media screen and (max-width: 800px) { + h1 { + /* font-size: 5.5vw !important; + line-height: 6vw !important; + margin: 2vw 0 0 0 !important; */ + } + }