Skip to content

Instantly share code, notes, and snippets.

@JuzzWuzz
Last active September 30, 2023 13:53
Show Gist options
  • Save JuzzWuzz/bfea1a35020687ae1bfa111936b57ccf to your computer and use it in GitHub Desktop.
Save JuzzWuzz/bfea1a35020687ae1bfa111936b57ccf to your computer and use it in GitHub Desktop.
Mushroom Bar Card Addon v3.1.0

Bar dark

Requires Lovelace Mushroom already installed.

Based on v3.1.0

This addon does include some Lit Element JS again unfortunately so a bit larger, but for my local instance I don't mind

Installation

  1. Download mushroom-countdown-card-addon.js from the Gist below
  2. Put mushroom-countdown-card-addon.js file into your config/www folder
  3. Add reference to mushroom-countdown-card-addon.js in Dashboard. There's two way to do that:
    • Using UI: SettingsDashboardsMore Options iconResourcesAdd Resource → Set Url as /local/mushroom-countdown-card-addon.js → Set Resource type as JavaScript Module. Note: If you do not see the Resources menu, you will need to enable Advanced Mode in your User Profile
    • Using YAML: Add following code to lovelace section.
      resources:
          - url: /local/mushroom-countdown-card-addon.js
            type: module

Configuration

See the Readme for configuration options

var t="https://github.com/piitaya/lovelace-mushroom";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function e(t,e,r,n){var o,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/}const r=window,n=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),i=new WeakMap;let a=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==o)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(n&&void 0===t){const r=void 0!==e&&1===e.length;r&&(t=i.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&i.set(e,t))}return t}toString(){return this.cssText}};const s=t=>new a("string"==typeof t?t:t+"",void 0,o),l=(t,...e)=>{const r=1===t.length?t[0]:e.reduce(((e,r,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[n+1]),t[0]);return new a(r,t,o)},c=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return s(e)})(t):t
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/;var u;const h=window,d=h.trustedTypes,m=d?d.emptyScript:"",g=h.reactiveElementPolyfillSupport,p={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},f=(t,e)=>e!==t&&(e==e||t==t),v={attribute:!0,type:String,converter:p,reflect:!1,hasChanged:f},b="finalized";let y=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,r)=>{const n=this._$Ep(r,e);void 0!==n&&(this._$Ev.set(n,r),t.push(n))})),t}static createProperty(t,e=v){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const r="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,r,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){return{get(){return this[e]},set(n){const o=this[t];this[e]=n,this.requestUpdate(t,o,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty(b))return!1;this[b]=!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 r of e)this.createProperty(r,t[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(c(t))}else void 0!==t&&e.push(c(t));return e}static _$Ep(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"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,r;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(r=t.hostConnected)||void 0===r||r.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)=>{n?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const n=document.createElement("style"),o=r.litNonce;void 0!==o&&n.setAttribute("nonce",o),n.textContent=e.cssText,t.appendChild(n)}))})(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,r){this._$AK(t,r)}_$EO(t,e,r=v){var n;const o=this.constructor._$Ep(t,r);if(void 0!==o&&!0===r.reflect){const i=(void 0!==(null===(n=r.converter)||void 0===n?void 0:n.toAttribute)?r.converter:p).toAttribute(e,r.type);this._$El=t,null==i?this.removeAttribute(o):this.setAttribute(o,i),this._$El=null}}_$AK(t,e){var r;const n=this.constructor,o=n._$Ev.get(t);if(void 0!==o&&this._$El!==o){const t=n.getPropertyOptions(o),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(r=t.converter)||void 0===r?void 0:r.fromAttribute)?t.converter:p;this._$El=o,this[o]=i.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,r){let n=!0;void 0!==t&&(((r=r||this.constructor.getPropertyOptions(t)).hasChanged||f)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===r.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,r))):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 r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),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(r)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(r)}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 _;y[b]=!0,y.elementProperties=new Map,y.elementStyles=[],y.shadowRootOptions={mode:"open"},null==g||g({ReactiveElement:y}),(null!==(u=h.reactiveElementVersions)&&void 0!==u?u:h.reactiveElementVersions=[]).push("1.6.2");const w=window,$=w.trustedTypes,k=$?$.createPolicy("lit-html",{createHTML:t=>t}):void 0,x="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,E="?"+A,S=`<${E}>`,M=document,C=()=>M.createComment(""),z=t=>null===t||"object"!=typeof t&&"function"!=typeof t,O=Array.isArray,j="[ \t\n\f\r]",N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,P=/>/g,D=RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),U=/'/g,I=/"/g,F=/^(?:script|style|textarea|title)$/i,H=(t=>(e,...r)=>({_$litType$:t,strings:e,values:r}))(1),R=Symbol.for("lit-noChange"),L=Symbol.for("lit-nothing"),B=new WeakMap,Z=M.createTreeWalker(M,129,null,!1);function V(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==k?k.createHTML(e):e}const q=(t,e)=>{const r=t.length-1,n=[];let o,i=2===e?"<svg>":"",a=N;for(let e=0;e<r;e++){const r=t[e];let s,l,c=-1,u=0;for(;u<r.length&&(a.lastIndex=u,l=a.exec(r),null!==l);)u=a.lastIndex,a===N?"!--"===l[1]?a=T:void 0!==l[1]?a=P:void 0!==l[2]?(F.test(l[2])&&(o=RegExp("</"+l[2],"g")),a=D):void 0!==l[3]&&(a=D):a===D?">"===l[0]?(a=null!=o?o:N,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,s=l[1],a=void 0===l[3]?D:'"'===l[3]?I:U):a===I||a===U?a=D:a===T||a===P?a=N:(a=D,o=void 0);const h=a===D&&t[e+1].startsWith("/>")?" ":"";i+=a===N?r+S:c>=0?(n.push(s),r.slice(0,c)+x+r.slice(c)+A+h):r+A+(-2===c?(n.push(void 0),e):h)}return[V(t,i+(t[r]||"<?>")+(2===e?"</svg>":"")),n]};class W{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let o=0,i=0;const a=t.length-1,s=this.parts,[l,c]=q(t,e);if(this.el=W.createElement(l,r),Z.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=Z.nextNode())&&s.length<a;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const e of n.getAttributeNames())if(e.endsWith(x)||e.startsWith(A)){const r=c[i++];if(t.push(e),void 0!==r){const t=n.getAttribute(r.toLowerCase()+x).split(A),e=/([.?@])?(.*)/.exec(r);s.push({type:1,index:o,name:e[2],strings:t,ctor:"."===e[1]?Q:"?"===e[1]?tt:"@"===e[1]?et:G})}else s.push({type:6,index:o})}for(const e of t)n.removeAttribute(e)}if(F.test(n.tagName)){const t=n.textContent.split(A),e=t.length-1;if(e>0){n.textContent=$?$.emptyScript:"";for(let r=0;r<e;r++)n.append(t[r],C()),Z.nextNode(),s.push({type:2,index:++o});n.append(t[e],C())}}}else if(8===n.nodeType)if(n.data===E)s.push({type:2,index:o});else{let t=-1;for(;-1!==(t=n.data.indexOf(A,t+1));)s.push({type:7,index:o}),t+=A.length-1}o++}}static createElement(t,e){const r=M.createElement("template");return r.innerHTML=t,r}}function Y(t,e,r=t,n){var o,i,a,s;if(e===R)return e;let l=void 0!==n?null===(o=r._$Co)||void 0===o?void 0:o[n]:r._$Cl;const c=z(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(i=null==l?void 0:l._$AO)||void 0===i||i.call(l,!1),void 0===c?l=void 0:(l=new c(t),l._$AT(t,r,n)),void 0!==n?(null!==(a=(s=r)._$Co)&&void 0!==a?a:s._$Co=[])[n]=l:r._$Cl=l),void 0!==l&&(e=Y(t,l._$AS(t,e.values),l,n)),e}class J{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:r},parts:n}=this._$AD,o=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:M).importNode(r,!0);Z.currentNode=o;let i=Z.nextNode(),a=0,s=0,l=n[0];for(;void 0!==l;){if(a===l.index){let e;2===l.type?e=new K(i,i.nextSibling,this,t):1===l.type?e=new l.ctor(i,l.name,l.strings,this,t):6===l.type&&(e=new rt(i,this,t)),this._$AV.push(e),l=n[++s]}a!==(null==l?void 0:l.index)&&(i=Z.nextNode(),a++)}return Z.currentNode=M,o}v(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class K{constructor(t,e,r,n){var o;this.type=2,this._$AH=L,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cp=null===(o=null==n?void 0:n.isConnected)||void 0===o||o}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Y(this,t,e),z(t)?t===L||null==t||""===t?(this._$AH!==L&&this._$AR(),this._$AH=L):t!==this._$AH&&t!==R&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>O(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==L&&z(this._$AH)?this._$AA.nextSibling.data=t:this.$(M.createTextNode(t)),this._$AH=t}g(t){var e;const{values:r,_$litType$:n}=t,o="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=W.createElement(V(n.h,n.h[0]),this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===o)this._$AH.v(r);else{const t=new J(o,this),e=t.u(this.options);t.v(r),this.$(e),this._$AH=t}}_$AC(t){let e=B.get(t.strings);return void 0===e&&B.set(t.strings,e=new W(t)),e}T(t){O(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,n=0;for(const o of t)n===e.length?e.push(r=new K(this.k(C()),this.k(C()),this,this.options)):r=e[n],r._$AI(o),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var r;for(null===(r=this._$AP)||void 0===r||r.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class G{constructor(t,e,r,n,o){this.type=1,this._$AH=L,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=o,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=L}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,r,n){const o=this.strings;let i=!1;if(void 0===o)t=Y(this,t,e,0),i=!z(t)||t!==this._$AH&&t!==R,i&&(this._$AH=t);else{const n=t;let a,s;for(t=o[0],a=0;a<o.length-1;a++)s=Y(this,n[r+a],e,a),s===R&&(s=this._$AH[a]),i||(i=!z(s)||s!==this._$AH[a]),s===L?t=L:t!==L&&(t+=(null!=s?s:"")+o[a+1]),this._$AH[a]=s}i&&!n&&this.j(t)}j(t){t===L?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Q extends G{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===L?void 0:t}}const X=$?$.emptyScript:"";class tt extends G{constructor(){super(...arguments),this.type=4}j(t){t&&t!==L?this.element.setAttribute(this.name,X):this.element.removeAttribute(this.name)}}class et extends G{constructor(t,e,r,n,o){super(t,e,r,n,o),this.type=5}_$AI(t,e=this){var r;if((t=null!==(r=Y(this,t,e,0))&&void 0!==r?r:L)===R)return;const n=this._$AH,o=t===L&&n!==L||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==L&&(n===L||o);o&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;"function"==typeof this._$AH?this._$AH.call(null!==(r=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==r?r:this.element,t):this._$AH.handleEvent(t)}}class rt{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Y(this,t)}}const nt=w.litHtmlPolyfillSupport;null==nt||nt(W,K),(null!==(_=w.litHtmlVersions)&&void 0!==_?_:w.litHtmlVersions=[]).push("2.7.5");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var ot,it;class at extends y{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const r=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=r.firstChild),r}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,r)=>{var n,o;const i=null!==(n=null==r?void 0:r.renderBefore)&&void 0!==n?n:e;let a=i._$litPart$;if(void 0===a){const t=null!==(o=null==r?void 0:r.renderBefore)&&void 0!==o?o:null;i._$litPart$=a=new K(e.insertBefore(C(),t),t,void 0,null!=r?r:{})}return a._$AI(t),a})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return R}}at.finalized=!0,at._$litElement$=!0,null===(ot=globalThis.litElementHydrateSupport)||void 0===ot||ot.call(globalThis,{LitElement:at});const st=globalThis.litElementPolyfillSupport;null==st||st({LitElement:at}),(null!==(it=globalThis.litElementVersions)&&void 0!==it?it:globalThis.litElementVersions=[]).push("3.3.2");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const lt=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:r,elements:n}=e;return{kind:r,elements:n,finisher(e){customElements.define(t,e)}}})(t,e)
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,ct=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(r){r.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(r){r.createProperty(e.key,t)}},ut=(t,e,r)=>{e.constructor.createProperty(r,t)};function ht(t){return(e,r)=>void 0!==r?ut(t,e,r):ct(t,e)}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function dt(t){return ht({...t,state:!0})}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var mt;null===(mt=window.HTMLSlotElement)||void 0===mt||mt.prototype.assignedElements;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const gt=1,pt=t=>(...e)=>({_$litDirective$:t,values:e});let ft=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const vt=pt(class extends ft{constructor(t){var e;if(super(t),t.type!==gt||"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 r,n;if(void 0===this.it){this.it=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!(null===(r=this.nt)||void 0===r?void 0:r.has(t))&&this.it.add(t);return this.render(e)}const o=t.element.classList;this.it.forEach((t=>{t in e||(o.remove(t),this.it.delete(t))}));for(const t in e){const r=!!e[t];r===this.it.has(t)||(null===(n=this.nt)||void 0===n?void 0:n.has(t))||(r?(o.add(t),this.it.add(t)):(o.remove(t),this.it.delete(t)))}return R}}),bt="important",yt=" !"+bt,_t=pt(class extends ft{constructor(t){var e;if(super(t),t.type!==gt||"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,r)=>{const n=t[r];return null==n?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`}),"")}update(t,[e]){const{style:r}=t.element;if(void 0===this.ut){this.ut=new Set;for(const t in e)this.ut.add(t);return this.render(e)}this.ut.forEach((t=>{null==e[t]&&(this.ut.delete(t),t.includes("-")?r.removeProperty(t):r[t]="")}));for(const t in e){const n=e[t];if(null!=n){this.ut.add(t);const e="string"==typeof n&&n.endsWith(yt);t.includes("-")||e?r.setProperty(t,e?n.slice(0,-11):n,e?bt:""):r[t]=n}}return R}});
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/var wt,$t,kt,xt,At,Et=Number.isNaN||function(t){return"number"==typeof t&&t!=t};function St(t,e){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(n=t[r],o=e[r],!(n===o||Et(n)&&Et(o)))return!1;var n,o;return!0}function Mt(t,e){void 0===e&&(e=St);var r=null;function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(r&&r.lastThis===this&&e(n,r.lastArgs))return r.lastResult;var i=t.apply(this,n);return r={lastResult:i,lastArgs:n,lastThis:this},i}return n.clear=function(){r=null},n}!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"}(wt||(wt={})),function(t){t.language="language",t.system="system",t.am_pm="12",t.twenty_four="24"}($t||($t={})),function(t){t.local="local",t.server="server"}(kt||(kt={})),function(t){t.language="language",t.system="system",t.DMY="DMY",t.MDY="MDY",t.YMD="YMD"}(xt||(xt={})),function(t){t.language="language",t.monday="monday",t.tuesday="tuesday",t.wednesday="wednesday",t.thursday="thursday",t.friday="friday",t.saturday="saturday",t.sunday="sunday"}(At||(At={})),Mt(((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",month:"long",day:"numeric",timeZone:"server"===t.time_zone?e:void 0})));const Ct=Mt(((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric",timeZone:"server"===t.time_zone?e:void 0})));Mt(((t,e)=>{const r=t.date_format===xt.system?void 0:t.language;return t.date_format===xt.language||(t.date_format,xt.system),new Intl.DateTimeFormat(r,{year:"numeric",month:"numeric",day:"numeric",timeZone:"server"===t.time_zone?e:void 0})})),Mt(((t,e)=>new Intl.DateTimeFormat(t.language,{day:"numeric",month:"short",timeZone:"server"===t.time_zone?e:void 0}))),Mt(((t,e)=>new Intl.DateTimeFormat(t.language,{month:"long",year:"numeric",timeZone:"server"===t.time_zone?e:void 0}))),Mt(((t,e)=>new Intl.DateTimeFormat(t.language,{month:"long",timeZone:"server"===t.time_zone?e:void 0}))),Mt(((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",timeZone:"server"===t.time_zone?e:void 0}))),Mt(((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",timeZone:"server"===t.time_zone?e:void 0}))),Mt(((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"short",timeZone:"server"===t.time_zone?e:void 0})));const zt=Mt((t=>{if(t.time_format===$t.language||t.time_format===$t.system){const e=t.time_format===$t.language?t.language:void 0,r=(new Date).toLocaleString(e);return r.includes("AM")||r.includes("PM")}return t.time_format===$t.am_pm})),Ot=Mt(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||zt(t)?t.language:"en-u-hc-h23",{hour:"numeric",minute:"2-digit",hour12:zt(t),timeZone:"server"===t.time_zone?e:void 0})));Mt(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||zt(t)?t.language:"en-u-hc-h23",{hour:zt(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:zt(t),timeZone:"server"===t.time_zone?e:void 0}))),Mt(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||zt(t)?t.language:"en-u-hc-h23",{weekday:"long",hour:zt(t)?"numeric":"2-digit",minute:"2-digit",hour12:zt(t),timeZone:"server"===t.time_zone?e:void 0}))),Mt(((t,e)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:"server"===t.time_zone?e:void 0})));const jt=(t,e,r)=>Nt(e,r.time_zone).format(t),Nt=Mt(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||zt(t)?t.language:"en-u-hc-h23",{year:"numeric",month:"long",day:"numeric",hour:zt(t)?"numeric":"2-digit",minute:"2-digit",hour12:zt(t),timeZone:"server"===t.time_zone?e:void 0})));Mt(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||zt(t)?t.language:"en-u-hc-h23",{year:"numeric",month:"short",day:"numeric",hour:zt(t)?"numeric":"2-digit",minute:"2-digit",hour12:zt(t),timeZone:"server"===t.time_zone?e:void 0}))),Mt(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||zt(t)?t.language:"en-u-hc-h23",{month:"short",day:"numeric",hour:zt(t)?"numeric":"2-digit",minute:"2-digit",hour12:zt(t),timeZone:"server"===t.time_zone?e:void 0}))),Mt(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||zt(t)?t.language:"en-u-hc-h23",{year:"numeric",month:"long",day:"numeric",hour:zt(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:zt(t),timeZone:"server"===t.time_zone?e:void 0})));const Tt=t=>t.substr(0,t.indexOf(".")),Pt="unavailable",Dt="unknown",Ut=[Pt,Dt,"off"];function It(t){const e=Tt(t.entity_id),r=t.state;if(["button","input_button","scene"].includes(e))return r!==Pt;if(Ut.includes(r))return!1;switch(e){case"cover":return!["closed","closing"].includes(r);case"device_tracker":case"person":return"not_home"!==r;case"media_player":return"standby"!==r;case"vacuum":return!["idle","docked","paused"].includes(r);case"plant":return"problem"===r;default:return!0}}function Ft(t){return t.state!==Pt}const Ht=(t,e)=>0!=(t.supported_features&e);Mt((t=>new Intl.Collator(t))),Mt((t=>new Intl.Collator(t,{sensitivity:"accent"})));const Rt=t=>(t=>Ht(t,4)&&"number"==typeof t.in_progress)(t)||!!t.in_progress,Lt=(t,e=2)=>{let r=""+t;for(let t=1;t<e;t++)r=parseInt(r)<10**t?`0${r}`:r;return r};const Bt={ms:1,s:1e3,min:6e4,h:36e5,d:864e5},Zt=(t,e)=>function(t){const e=Math.floor(t/1e3/3600),r=Math.floor(t/1e3%3600/60),n=Math.floor(t/1e3%3600%60),o=Math.floor(t%1e3);return e>0?`${e}:${Lt(r)}:${Lt(n)}`:r>0?`${r}:${Lt(n)}`:n>0||o>0?`${n}${o>0?`.${Lt(o,3)}`:""}`:null}(parseFloat(t)*Bt[e])||"0",Vt=(t,e,r)=>{const n=e?(t=>{switch(t.number_format){case wt.comma_decimal:return["en-US","en"];case wt.decimal_comma:return["de","es","it"];case wt.space_comma:return["fr","sv","cs"];case wt.system:return;default:return t.language}})(e):void 0;if(Number.isNaN=Number.isNaN||function t(e){return"number"==typeof e&&t(e)},(null==e?void 0:e.number_format)!==wt.none&&!Number.isNaN(Number(t))&&Intl)try{return new Intl.NumberFormat(n,Wt(t,r)).format(Number(t))}catch(e){return console.error(e),new Intl.NumberFormat(void 0,Wt(t,r)).format(Number(t))}return"string"==typeof t?t:`${((t,e=2)=>Math.round(t*10**e)/10**e)(t,null==r?void 0:r.maximumFractionDigits).toString()}${"currency"===(null==r?void 0:r.style)?` ${r.currency}`:""}`},qt=(t,e)=>{var r;const n=null==e?void 0:e.display_precision;return null!=n?{maximumFractionDigits:n,minimumFractionDigits:n}:Number.isInteger(Number(null===(r=t.attributes)||void 0===r?void 0:r.step))&&Number.isInteger(Number(t.state))?{maximumFractionDigits:0}:null!=t.attributes.step?{maximumFractionDigits:Math.ceil(Math.log10(1/t.attributes.step))}:void 0},Wt=(t,e)=>{const r=Object.assign({maximumFractionDigits:2},e);if("string"!=typeof t)return r;if(!e||void 0===e.minimumFractionDigits&&void 0===e.maximumFractionDigits){const e=t.indexOf(".")>-1?t.split(".")[1].length:0;r.minimumFractionDigits=e,r.maximumFractionDigits=e}return r},Yt=(t,e,r,n,o,i)=>{const a=o[e.entity_id];return Jt(t,r,n,a,e.entity_id,e.attributes,void 0!==i?i:e.state)},Jt=(t,e,r,n,o,i,a)=>{var s;if(a===Dt||a===Pt)return t(`state.default.${a}`);if((t=>!!t.unit_of_measurement||!!t.state_class)(i)){if("duration"===i.device_class&&i.unit_of_measurement&&Bt[i.unit_of_measurement])try{return Zt(a,i.unit_of_measurement)}catch(t){}if("monetary"===i.device_class)try{return Vt(a,e,Object.assign({style:"currency",currency:i.unit_of_measurement,minimumFractionDigits:2},qt({state:a,attributes:i},n)))}catch(t){}const t=i.unit_of_measurement?"%"===i.unit_of_measurement?(t=>{switch(t.language){case"cz":case"de":case"fi":case"fr":case"sk":case"sv":return" ";default:return""}})(e)+"%":` ${i.unit_of_measurement}`:"";return`${Vt(a,e,qt({state:a,attributes:i},n))}${t}`}const l=Tt(o);if("datetime"===l){const t=new Date(a);return jt(t,e,r)}if(["date","input_datetime","time"].includes(l))try{const t=a.split(" ");if(2===t.length)return jt(new Date(t.join("T")),Object.assign(Object.assign({},e),{time_zone:kt.local}),r);if(1===t.length){if(a.includes("-"))return((t,e,r)=>Ct(e,r.time_zone).format(t))(new Date(`${a}T00:00`),Object.assign(Object.assign({},e),{time_zone:kt.local}),r);if(a.includes(":")){const t=new Date;return((t,e,r)=>Ot(e,r.time_zone).format(t))(new Date(`${t.toISOString().split("T")[0]}T${a}`),Object.assign(Object.assign({},e),{time_zone:kt.local}),r)}}return a}catch(t){return a}if("counter"===l||"number"===l||"input_number"===l)return Vt(a,e,qt({state:a,attributes:i},n));if(["button","event","input_button","scene","stt","tts"].includes(l)||"sensor"===l&&"timestamp"===i.device_class)try{return jt(new Date(a),e,r)}catch(t){return a}return"update"===l?"on"===a?Rt(i)?Ht(i,4)&&"number"==typeof i.in_progress?t("ui.card.update.installing_with_progress",{progress:i.in_progress}):t("ui.card.update.installing"):i.latest_version:i.skipped_version===i.latest_version?null!==(s=i.latest_version)&&void 0!==s?s:t("state.default.unavailable"):t("ui.card.update.up_to_date"):(null==n?void 0:n.translation_key)&&t(`component.${n.platform}.entity.${l}.${n.translation_key}.state.${a}`)||i.device_class&&t(`component.${l}.entity_component.${i.device_class}.state.${a}`)||t(`component.${l}.entity_component._.state.${a}`)||a};class Kt extends TypeError{constructor(t,e){let r;const{message:n,...o}=t,{path:i}=t;super(0===i.length?n:"At path: "+i.join(".")+" -- "+n),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>{var n;return null!=(n=r)?n:r=[t,...e()]}}}function Gt(t){return"object"==typeof t&&null!=t}function Qt(t){return"string"==typeof t?JSON.stringify(t):""+t}function Xt(t,e,r,n){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});const{path:o,branch:i}=e,{type:a}=r,{refinement:s,message:l="Expected a value of type `"+a+"`"+(s?" with refinement `"+s+"`":"")+", but received: `"+Qt(n)+"`"}=t;return{value:n,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...t,message:l}}function*te(t,e,r,n){(function(t){return Gt(t)&&"function"==typeof t[Symbol.iterator]})(t)||(t=[t]);for(const o of t){const t=Xt(o,e,r,n);t&&(yield t)}}function*ee(t,e,r){void 0===r&&(r={});const{path:n=[],branch:o=[t],coerce:i=!1,mask:a=!1}=r,s={path:n,branch:o};if(i&&(t=e.coercer(t,s),a&&"type"!==e.type&&Gt(e.schema)&&Gt(t)&&!Array.isArray(t)))for(const r in t)void 0===e.schema[r]&&delete t[r];let l=!0;for(const r of e.validator(t,s))l=!1,yield[r,void 0];for(let[r,c,u]of e.entries(t,s)){const e=ee(c,u,{path:void 0===r?n:[...n,r],branch:void 0===r?o:[...o,c],coerce:i,mask:a});for(const n of e)n[0]?(l=!1,yield[n[0],void 0]):i&&(c=n[1],void 0===r?t=c:t instanceof Map?t.set(r,c):t instanceof Set?t.add(c):Gt(t)&&(t[r]=c))}if(l)for(const r of e.refiner(t,s))l=!1,yield[r,void 0];l&&(yield[void 0,t])}class re{constructor(t){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:e,schema:r,validator:n,refiner:o,coercer:i=(t=>t),entries:a=function*(){}}=t;this.type=e,this.schema=r,this.entries=a,this.coercer=i,this.validator=n?(t,e)=>te(n(t,e),e,this,t):()=>[],this.refiner=o?(t,e)=>te(o(t,e),e,this,t):()=>[]}assert(t){return ne(t,this)}create(t){return function(t,e){const r=oe(t,e,{coerce:!0});if(r[0])throw r[0];return r[1]}(t,this)}is(t){return function(t,e){const r=oe(t,e);return!r[0]}(t,this)}mask(t){return function(t,e){const r=oe(t,e,{coerce:!0,mask:!0});if(r[0])throw r[0];return r[1]}(t,this)}validate(t,e){return void 0===e&&(e={}),oe(t,this,e)}}function ne(t,e){const r=oe(t,e);if(r[0])throw r[0]}function oe(t,e,r){void 0===r&&(r={});const n=ee(t,e,r),o=function(t){const{done:e,value:r}=t.next();return e?void 0:r}(n);if(o[0]){const t=new Kt(o[0],(function*(){for(const t of n)t[0]&&(yield t[0])}));return[t,void 0]}return[void 0,o[1]]}function ie(t,e){return new re({type:t,schema:null,validator:e})}function ae(t){return new re({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+Qt(t)})}function se(){return ie("boolean",(t=>"boolean"==typeof t))}function le(t){const e=Qt(t),r=typeof t;return new re({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?t:null,validator:r=>r===t||"Expected the literal `"+e+"`, but received: "+Qt(r)})}function ce(){return ie("number",(t=>"number"==typeof t&&!isNaN(t)||"Expected a number, but received: "+Qt(t)))}function ue(t){const e=t?Object.keys(t):[],r=ie("never",(()=>!1));return new re({type:"object",schema:t||null,*entries(n){if(t&&Gt(n)){const o=new Set(Object.keys(n));for(const r of e)o.delete(r),yield[r,n[r],t[r]];for(const t of o)yield[t,n[t],r]}},validator:t=>Gt(t)||"Expected an object, but received: "+Qt(t),coercer:t=>Gt(t)?{...t}:t})}function he(t){return new re({...t,validator:(e,r)=>void 0===e||t.validator(e,r),refiner:(e,r)=>void 0===e||t.refiner(e,r)})}function de(){return ie("string",(t=>"string"==typeof t||"Expected a string, but received: "+Qt(t)))}function me(t){const e=Object.keys(t);return new re({type:"type",schema:t,*entries(r){if(Gt(r))for(const n of e)yield[n,r[n],t[n]]},validator:t=>Gt(t)||"Expected an object, but received: "+Qt(t)})}function ge(t){const e=t.map((t=>t.type)).join(" | ");return new re({type:"union",schema:null,coercer(e,r){const n=t.find((t=>{const[r]=t.validate(e,{coerce:!0});return!r}))||ie("unknown",(()=>!0));return n.coercer(e,r)},validator(r,n){const o=[];for(const e of t){const[...t]=ee(r,e,n),[i]=t;if(!i[0])return[];for(const[e]of t)e&&o.push(e)}return["Expected the value to satisfy a union of `"+e+"`, but received: "+Qt(r),...o]}})}function pe(t){const e=t.language||"en";return t.translationMetadata.translations[e]&&t.translationMetadata.translations[e].isRTL||!1}const fe=ue({user:de()}),ve=ge([se(),ue({text:he(de()),excemptions:he(ae(fe))})]),be=ue({action:le("url"),url_path:de(),confirmation:he(ve)}),ye=ue({action:le("call-service"),service:de(),service_data:he(ue()),data:he(ue()),target:he(ue({entity_id:he(ge([de(),ae(de())])),device_id:he(ge([de(),ae(de())])),area_id:he(ge([de(),ae(de())]))})),confirmation:he(ve)}),_e=ue({action:le("navigate"),navigation_path:de(),confirmation:he(ve)}),we=me({action:le("assist"),pipeline_id:he(de()),start_listening:he(se())}),$e=me({action:le("fire-dom-event")}),ke=ue({action:function(t){const e={},r=t.map((t=>Qt(t))).join();for(const r of t)e[r]=r;return new re({type:"enums",schema:e,validator:e=>t.includes(e)||"Expected one of `"+r+"`, but received: "+Qt(e)})}(["none","toggle","more-info","call-service","url","navigate","assist"]),confirmation:he(ve)});var xe;xe=t=>{if(t&&"object"==typeof t&&"action"in t)switch(t.action){case"call-service":return ye;case"fire-dom-event":return $e;case"navigate":return _e;case"url":return be;case"assist":return we}return ke},new re({type:"dynamic",schema:null,*entries(t,e){const r=xe(t,e);yield*r.entries(t,e)},validator:(t,e)=>xe(t,e).validator(t,e),coercer:(t,e)=>xe(t,e).coercer(t,e),refiner:(t,e)=>xe(t,e).refiner(t,e)}),l`
#sortable a:nth-of-type(2n) paper-icon-item {
animation-name: keyframes1;
animation-iteration-count: infinite;
transform-origin: 50% 10%;
animation-delay: -0.75s;
animation-duration: 0.25s;
}
#sortable a:nth-of-type(2n-1) paper-icon-item {
animation-name: keyframes2;
animation-iteration-count: infinite;
animation-direction: alternate;
transform-origin: 30% 5%;
animation-delay: -0.5s;
animation-duration: 0.33s;
}
#sortable a {
height: 48px;
display: flex;
}
#sortable {
outline: none;
display: block !important;
}
.hidden-panel {
display: flex !important;
}
.sortable-fallback {
display: none;
}
.sortable-ghost {
opacity: 0.4;
}
.sortable-fallback {
opacity: 0;
}
@keyframes keyframes1 {
0% {
transform: rotate(-1deg);
animation-timing-function: ease-in;
}
50% {
transform: rotate(1.5deg);
animation-timing-function: ease-out;
}
}
@keyframes keyframes2 {
0% {
transform: rotate(1deg);
animation-timing-function: ease-in;
}
50% {
transform: rotate(-1.5deg);
animation-timing-function: ease-out;
}
}
.show-panel,
.hide-panel {
display: none;
position: absolute;
top: 0;
right: 4px;
--mdc-icon-button-size: 40px;
}
:host([rtl]) .show-panel {
right: initial;
left: 4px;
}
.hide-panel {
top: 4px;
right: 8px;
}
:host([rtl]) .hide-panel {
right: initial;
left: 8px;
}
:host([expanded]) .hide-panel {
display: block;
}
:host([expanded]) .show-panel {
display: inline-flex;
}
paper-icon-item.hidden-panel,
paper-icon-item.hidden-panel span,
paper-icon-item.hidden-panel ha-icon[slot="item-icon"] {
color: var(--secondary-text-color);
cursor: pointer;
}
`;const Ae=t=>{const e=t.center.x,r=t.target.getBoundingClientRect().left,n=t.target.clientWidth;return Math.max(Math.min(1,(e-r)/n),0)};let Ee=class extends at{constructor(){super(...arguments),this.controllable=!1,this.disabled=!1,this.inactive=!1,this.step=1,this.min=0,this.max=100,this.controlled=!1}valueToPercentage(t){return(t-this.min)/(this.max-this.min)}percentageToValue(t){return(this.max-this.min)*t+this.min}firstUpdated(t){super.firstUpdated(t),this.setupListeners()}connectedCallback(){super.connectedCallback(),this.setupListeners()}disconnectedCallback(){super.disconnectedCallback(),this.destroyListeners()}setupListeners(){if(this.slider&&!this._mc){const t=(t=>{const e=window.getComputedStyle(t).getPropertyValue("--slider-threshold"),r=parseFloat(e);return isNaN(r)?10:r})(this.slider);let e;this._mc=new Hammer.Manager(this.slider,{touchAction:"pan-y"}),this._mc.add(new Hammer.Pan({threshold:t,direction:Hammer.DIRECTION_ALL,enable:!0})),this._mc.add(new Hammer.Tap({event:"singletap"})),this._mc.on("panstart",(()=>{this.controllable&&!this.disabled&&(this.controlled=!0,e=this.value)})),this._mc.on("pancancel",(()=>{this.controllable&&!this.disabled&&(this.controlled=!1,this.value=e)})),this._mc.on("panmove",(t=>{if(!this.controllable||this.disabled)return;const e=Ae(t);this.value=this.percentageToValue(e),this.dispatchEvent(new CustomEvent("current-change",{detail:{value:Math.round(this.value/this.step)*this.step}}))})),this._mc.on("panend",(t=>{if(!this.controllable||this.disabled)return;this.controlled=!1;const e=Ae(t);this.value=Math.round(this.percentageToValue(e)/this.step)*this.step,this.dispatchEvent(new CustomEvent("current-change",{detail:{value:void 0}})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value}}))})),this._mc.on("singletap",(t=>{if(!this.controllable||this.disabled)return;const e=Ae(t);this.value=Math.round(this.percentageToValue(e)/this.step)*this.step,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value}}))}))}}destroyListeners(){this._mc&&(this._mc.destroy(),this._mc=void 0)}render(){var t;return H`
<div
class=${vt({container:!0,inactive:this.inactive||this.disabled,controlled:this.controlled})}
>
<div
id="slider"
class="slider"
style=${_t({"--value":`${this.valueToPercentage(null!==(t=this.value)&&void 0!==t?t:0)}`,cursor:this.controllable?"pointer":"default"})}
>
<div class="slider-track-background"></div>
${this.showActive?H`<div class="slider-track-active"></div>`:L}
${this.showIndicator?H`<div class="slider-track-indicator"></div>`:L}
</div>
</div>
`}static get styles(){return l`
:host {
--main-color: rgba(var(--rgb-secondary-text-color), 1);
--bg-gradient: none;
--bg-color: rgba(var(--rgb-secondary-text-color), 0.2);
--main-color-inactive: rgb(var(--rgb-disabled));
--bg-color-inactive: rgba(var(--rgb-disabled), 0.2);
}
.container {
display: flex;
flex-direction: row;
height: var(--control-height);
}
.slider {
position: relative;
height: 100%;
width: 100%;
border-radius: var(--control-border-radius);
transform: translateZ(0);
overflow: hidden;
cursor: pointer;
}
.slider * {
pointer-events: none;
}
.slider .slider-track-background {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: var(--bg-color);
background-image: var(--gradient);
}
.slider .slider-track-active {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
transform: scale3d(var(--value, 0), 1, 1);
transform-origin: left;
background-color: var(--main-color);
transition: transform 180ms ease-in-out;
}
.slider .slider-track-indicator {
position: absolute;
top: 0;
bottom: 0;
left: calc(var(--value, 0) * (100% - 10px));
width: 10px;
border-radius: 3px;
background-color: white;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
transition: left 180ms ease-in-out;
}
.slider .slider-track-indicator:after {
display: block;
content: "";
background-color: var(--main-color);
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
height: 20px;
width: 2px;
border-radius: 1px;
}
.inactive .slider .slider-track-background {
background-color: var(--bg-color-inactive);
background-image: none;
}
.inactive .slider .slider-track-indicator:after {
background-color: var(--main-color-inactive);
}
.inactive .slider .slider-track-active {
background-color: var(--main-color-inactive);
}
.controlled .slider .slider-track-active {
transition: none;
}
.controlled .slider .slider-track-indicator {
transition: none;
}
`}};e([ht({type:Boolean})],Ee.prototype,"controllable",void 0),e([ht({type:Boolean})],Ee.prototype,"disabled",void 0),e([ht({type:Boolean})],Ee.prototype,"inactive",void 0),e([ht({type:Boolean,attribute:"show-active"})],Ee.prototype,"showActive",void 0),e([ht({type:Boolean,attribute:"show-indicator"})],Ee.prototype,"showIndicator",void 0),e([ht({attribute:!1,type:Number,reflect:!0})],Ee.prototype,"value",void 0),e([ht({type:Number})],Ee.prototype,"step",void 0),e([ht({type:Number})],Ee.prototype,"min",void 0),e([ht({type:Number})],Ee.prototype,"max",void 0),e([dt()],Ee.prototype,"controlled",void 0),e([
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function(t,e){return(({finisher:t,descriptor:e})=>(r,n)=>{var o;if(void 0===n){const n=null!==(o=r.originalKey)&&void 0!==o?o:r.key,i=null!=e?{kind:"method",placement:"prototype",key:n,descriptor:e(r.key)}:{...r,key:n};return null!=t&&(i.finisher=function(e){t(e,n)}),i}{const o=r.constructor;void 0!==e&&Object.defineProperty(r,n,e(n)),null==t||t(o,n)}})({descriptor:r=>{const n={get(){var e,r;return null!==(r=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==r?r:null},enumerable:!0,configurable:!0};if(e){const e="symbol"==typeof r?Symbol():"__"+r;n.get=function(){var r,n;return void 0===this[e]&&(this[e]=null!==(n=null===(r=this.renderRoot)||void 0===r?void 0:r.querySelector(t))&&void 0!==n?n:null),this[e]}}return n}})}("#slider")],Ee.prototype,"slider",void 0),Ee=e([lt("mushroom-slider-ex")],Ee);var Se={form:{color_picker:{values:{default:"Default color"}},info_picker:{values:{default:"Default information",name:"Name",state:"State","last-changed":"Last Changed","last-updated":"Last Updated",none:"None"}},icon_type_picker:{values:{default:"Default type",icon:"Icon","entity-picture":"Entity picture",none:"None"}},layout_picker:{values:{default:"Default layout",vertical:"Vertical layout",horizontal:"Horizontal layout"}},alignment_picker:{values:{default:"Default alignment",start:"Start",end:"End",center:"Center",justify:"Justify"}}},card:{generic:{icon_color:"Icon color",layout:"Layout",fill_container:"Fill container",primary_info:"Primary information",secondary_info:"Secondary information",icon_type:"Icon type",content_info:"Content",use_entity_picture:"Use entity picture?",collapsible_controls:"Collapse controls when off",icon_animation:"Animate icon when active?"},light:{show_brightness_control:"Brightness control?",use_light_color:"Use light color",show_color_temp_control:"Temperature color control?",show_color_control:"Color control?",incompatible_controls:"Some controls may not be displayed if your light does not support the feature."},fan:{show_percentage_control:"Percentage control?",show_oscillate_control:"Oscillate control?"},cover:{show_buttons_control:"Control buttons?",show_position_control:"Position control?",show_tilt_position_control:"Tilt control?"},alarm_control_panel:{show_keypad:"Show keypad"},template:{primary:"Primary information",secondary:"Secondary information",multiline_secondary:"Multiline secondary?",entity_extra:"Used in templates and actions",content:"Content",badge_icon:"Badge icon",badge_color:"Badge color",picture:"Picture (will replace the icon)"},title:{title:"Title",subtitle:"Subtitle",title_tap_action:"Title tap action",subtitle_tap_action:"Subtitle tap action"},chips:{alignment:"Alignment"},weather:{show_conditions:"Conditions?",show_temperature:"Temperature?"},update:{show_buttons_control:"Control buttons?"},vacuum:{commands:"Commands",commands_list:{on_off:"Turn on/off"}},"media-player":{use_media_info:"Use media info",use_media_artwork:"Use media artwork",show_volume_level:"Show volume level",media_controls:"Media controls",media_controls_list:{on_off:"Turn on/off",shuffle:"Shuffle",previous:"Previous track",play_pause_stop:"Play/pause/stop",next:"Next track",repeat:"Repeat mode"},volume_controls:"Volume controls",volume_controls_list:{volume_buttons:"Volume buttons",volume_set:"Volume level",volume_mute:"Mute"}},lock:{lock:"Lock",unlock:"Unlock",open:"Open"},humidifier:{show_target_humidity_control:"Humidity control?"},climate:{show_temperature_control:"Temperature control?",hvac_modes:"HVAC Modes"},number:{display_mode:"Display Mode",display_mode_list:{default:"Default (slider)",slider:"Slider",buttons:"Buttons"}}},chip:{sub_element_editor:{title:"Chip editor"},conditional:{chip:"Chip"},"chip-picker":{chips:"Chips",add:"Add chip",edit:"Edit",clear:"Clear",select:"Select chip",types:{action:"Action","alarm-control-panel":"Alarm",back:"Back",conditional:"Conditional",entity:"Entity",light:"Light",menu:"Menu",spacer:"Spacer",template:"Template",weather:"Weather"}}}},Me={not_found:"Entity not found"},Ce={editor:Se,card:Me};const ze={en:Object.freeze({__proto__:null,card:Me,default:Ce,editor:Se})};function Oe(t,e){try{return t.split(".").reduce(((t,e)=>t[e]),ze[e])}catch(t){return}}function je(t){return function(e){var r;let n=Oe(e,null!==(r=null==t?void 0:t.locale.language)&&void 0!==r?r:"en");return n||(n=Oe(e,"en")),null!=n?n:e}}function Ne(t){return t.vertical?"vertical":"default"}function Te(t){return t.hide_icon?"none":t.use_entity_picture||t.use_media_artwork?"entity-picture":"icon"}function Pe(t){return t.hide_name?"none":"name"}function De(t){return t.hide_state?"none":"state"}const Ue={pulse:"@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }",spin:"@keyframes spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n }",cleaning:"@keyframes cleaning {\n 0% {\n transform: rotate(0) translate(0);\n }\n 5% {\n transform: rotate(0) translate(0, -3px);\n }\n 10% {\n transform: rotate(0) translate(0, 1px);\n }\n 15% {\n transform: rotate(0) translate(0);\n }\n\n 20% {\n transform: rotate(30deg) translate(0);\n }\n 25% {\n transform: rotate(30deg) translate(0, -3px);\n }\n 30% {\n transform: rotate(30deg) translate(0, 1px);\n }\n 35% {\n transform: rotate(30deg) translate(0);\n }\n 40% {\n transform: rotate(0) translate(0);\n }\n\n 45% {\n transform: rotate(-30deg) translate(0);\n }\n 50% {\n transform: rotate(-30deg) translate(0, -3px);\n }\n 55% {\n transform: rotate(-30deg) translate(0, 1px);\n }\n 60% {\n transform: rotate(-30deg) translate(0);\n }\n 70% {\n transform: rotate(0deg) translate(0);\n }\n 100% {\n transform: rotate(0deg);\n }\n }",returning:"@keyframes returning {\n 0% {\n transform: rotate(0);\n }\n 25% {\n transform: rotate(20deg);\n }\n 50% {\n transform: rotate(0);\n }\n 75% {\n transform: rotate(-20deg);\n }\n 100% {\n transform: rotate(0);\n }\n }"};l`
${s(Ue.pulse)}
`,l`
${s(Ue.spin)}
`,l`
${s(Ue.cleaning)}
`,l`
${s(Ue.returning)}
`;const Ie=l`
${s(Object.values(Ue).join("\n"))}
`;var Fe={exports:{}},He={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Re={exports:{}},Le=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},Be=Array.prototype.concat,Ze=Array.prototype.slice,Ve=Re.exports=function(t){for(var e=[],r=0,n=t.length;r<n;r++){var o=t[r];Le(o)?e=Be.call(e,Ze.call(o)):e.push(o)}return e};Ve.wrap=function(t){return function(){return t(Ve(arguments))}};var qe=Re.exports,We=He,Ye=qe,Je=Object.hasOwnProperty,Ke={};for(var Ge in We)Je.call(We,Ge)&&(Ke[We[Ge]]=Ge);var Qe=Fe.exports={to:{},get:{}};function Xe(t,e,r){return Math.min(Math.max(e,t),r)}function tr(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}Qe.get=function(t){var e,r;switch(t.substring(0,3).toLowerCase()){case"hsl":e=Qe.get.hsl(t),r="hsl";break;case"hwb":e=Qe.get.hwb(t),r="hwb";break;default:e=Qe.get.rgb(t),r="rgb"}return e?{model:r,value:e}:null},Qe.get.rgb=function(t){if(!t)return null;var e,r,n,o=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(n=e[2],e=e[1],r=0;r<3;r++){var i=2*r;o[r]=parseInt(e.slice(i,i+2),16)}n&&(o[3]=parseInt(n,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(n=(e=e[1])[3],r=0;r<3;r++)o[r]=parseInt(e[r]+e[r],16);n&&(o[3]=parseInt(n+n,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(r=0;r<3;r++)o[r]=parseInt(e[r+1],0);e[4]&&(e[5]?o[3]=.01*parseFloat(e[4]):o[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:Je.call(We,e[1])?((o=We[e[1]])[3]=1,o):null:null;for(r=0;r<3;r++)o[r]=Math.round(2.55*parseFloat(e[r+1]));e[4]&&(e[5]?o[3]=.01*parseFloat(e[4]):o[3]=parseFloat(e[4]))}for(r=0;r<3;r++)o[r]=Xe(o[r],0,255);return o[3]=Xe(o[3],0,1),o},Qe.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var r=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,Xe(parseFloat(e[2]),0,100),Xe(parseFloat(e[3]),0,100),Xe(isNaN(r)?1:r,0,1)]}return null},Qe.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var r=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,Xe(parseFloat(e[2]),0,100),Xe(parseFloat(e[3]),0,100),Xe(isNaN(r)?1:r,0,1)]}return null},Qe.to.hex=function(){var t=Ye(arguments);return"#"+tr(t[0])+tr(t[1])+tr(t[2])+(t[3]<1?tr(Math.round(255*t[3])):"")},Qe.to.rgb=function(){var t=Ye(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},Qe.to.rgb.percent=function(){var t=Ye(arguments),e=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+r+"%, "+n+"%)":"rgba("+e+"%, "+r+"%, "+n+"%, "+t[3]+")"},Qe.to.hsl=function(){var t=Ye(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},Qe.to.hwb=function(){var t=Ye(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},Qe.to.keyword=function(t){return Ke[t.slice(0,3)]};var er=Fe.exports;const rr=He,nr={};for(const t of Object.keys(rr))nr[rr[t]]=t;const or={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var ir=or;for(const t of Object.keys(or)){if(!("channels"in or[t]))throw new Error("missing channels property: "+t);if(!("labels"in or[t]))throw new Error("missing channel labels property: "+t);if(or[t].labels.length!==or[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:r}=or[t];delete or[t].channels,delete or[t].labels,Object.defineProperty(or[t],"channels",{value:e}),Object.defineProperty(or[t],"labels",{value:r})}function ar(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}or.rgb.hsl=function(t){const e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=i-o;let s,l;i===o?s=0:e===i?s=(r-n)/a:r===i?s=2+(n-e)/a:n===i&&(s=4+(e-r)/a),s=Math.min(60*s,360),s<0&&(s+=360);const c=(o+i)/2;return l=i===o?0:c<=.5?a/(i+o):a/(2-i-o),[s,100*l,100*c]},or.rgb.hsv=function(t){let e,r,n,o,i;const a=t[0]/255,s=t[1]/255,l=t[2]/255,c=Math.max(a,s,l),u=c-Math.min(a,s,l),h=function(t){return(c-t)/6/u+.5};return 0===u?(o=0,i=0):(i=u/c,e=h(a),r=h(s),n=h(l),a===c?o=n-r:s===c?o=1/3+e-n:l===c&&(o=2/3+r-e),o<0?o+=1:o>1&&(o-=1)),[360*o,100*i,100*c]},or.rgb.hwb=function(t){const e=t[0],r=t[1];let n=t[2];const o=or.rgb.hsl(t)[0],i=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[o,100*i,100*n]},or.rgb.cmyk=function(t){const e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(1-e,1-r,1-n);return[100*((1-e-o)/(1-o)||0),100*((1-r-o)/(1-o)||0),100*((1-n-o)/(1-o)||0),100*o]},or.rgb.keyword=function(t){const e=nr[t];if(e)return e;let r,n=1/0;for(const e of Object.keys(rr)){const o=ar(t,rr[e]);o<n&&(n=o,r=e)}return r},or.keyword.rgb=function(t){return rr[t]},or.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;return[100*(.4124*e+.3576*r+.1805*n),100*(.2126*e+.7152*r+.0722*n),100*(.0193*e+.1192*r+.9505*n)]},or.rgb.lab=function(t){const e=or.rgb.xyz(t);let r=e[0],n=e[1],o=e[2];r/=95.047,n/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;return[116*n-16,500*(r-n),200*(n-o)]},or.hsl.rgb=function(t){const e=t[0]/360,r=t[1]/100,n=t[2]/100;let o,i,a;if(0===r)return a=255*n,[a,a,a];o=n<.5?n*(1+r):n+r-n*r;const s=2*n-o,l=[0,0,0];for(let t=0;t<3;t++)i=e+1/3*-(t-1),i<0&&i++,i>1&&i--,a=6*i<1?s+6*(o-s)*i:2*i<1?o:3*i<2?s+(o-s)*(2/3-i)*6:s,l[t]=255*a;return l},or.hsl.hsv=function(t){const e=t[0];let r=t[1]/100,n=t[2]/100,o=r;const i=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,o*=i<=1?i:2-i;return[e,100*(0===n?2*o/(i+o):2*r/(n+r)),100*((n+r)/2)]},or.hsv.rgb=function(t){const e=t[0]/60,r=t[1]/100;let n=t[2]/100;const o=Math.floor(e)%6,i=e-Math.floor(e),a=255*n*(1-r),s=255*n*(1-r*i),l=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,l,a];case 1:return[s,n,a];case 2:return[a,n,l];case 3:return[a,s,n];case 4:return[l,a,n];case 5:return[n,a,s]}},or.hsv.hsl=function(t){const e=t[0],r=t[1]/100,n=t[2]/100,o=Math.max(n,.01);let i,a;a=(2-r)*n;const s=(2-r)*o;return i=r*o,i/=s<=1?s:2-s,i=i||0,a/=2,[e,100*i,100*a]},or.hwb.rgb=function(t){const e=t[0]/360;let r=t[1]/100,n=t[2]/100;const o=r+n;let i;o>1&&(r/=o,n/=o);const a=Math.floor(6*e),s=1-n;i=6*e-a,0!=(1&a)&&(i=1-i);const l=r+i*(s-r);let c,u,h;switch(a){default:case 6:case 0:c=s,u=l,h=r;break;case 1:c=l,u=s,h=r;break;case 2:c=r,u=s,h=l;break;case 3:c=r,u=l,h=s;break;case 4:c=l,u=r,h=s;break;case 5:c=s,u=r,h=l}return[255*c,255*u,255*h]},or.cmyk.rgb=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100,o=t[3]/100;return[255*(1-Math.min(1,e*(1-o)+o)),255*(1-Math.min(1,r*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o))]},or.xyz.rgb=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100;let o,i,a;return o=3.2406*e+-1.5372*r+-.4986*n,i=-.9689*e+1.8758*r+.0415*n,a=.0557*e+-.204*r+1.057*n,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),[255*o,255*i,255*a]},or.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;return[116*r-16,500*(e-r),200*(r-n)]},or.lab.xyz=function(t){let e,r,n;r=(t[0]+16)/116,e=t[1]/500+r,n=r-t[2]/200;const o=r**3,i=e**3,a=n**3;return r=o>.008856?o:(r-16/116)/7.787,e=i>.008856?i:(e-16/116)/7.787,n=a>.008856?a:(n-16/116)/7.787,e*=95.047,r*=100,n*=108.883,[e,r,n]},or.lab.lch=function(t){const e=t[0],r=t[1],n=t[2];let o;o=360*Math.atan2(n,r)/2/Math.PI,o<0&&(o+=360);return[e,Math.sqrt(r*r+n*n),o]},or.lch.lab=function(t){const e=t[0],r=t[1],n=t[2]/360*2*Math.PI;return[e,r*Math.cos(n),r*Math.sin(n)]},or.rgb.ansi16=function(t,e=null){const[r,n,o]=t;let i=null===e?or.rgb.hsv(t)[2]:e;if(i=Math.round(i/50),0===i)return 30;let a=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return 2===i&&(a+=60),a},or.hsv.ansi16=function(t){return or.rgb.ansi16(or.hsv.rgb(t),t[2])},or.rgb.ansi256=function(t){const e=t[0],r=t[1],n=t[2];if(e===r&&r===n)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;return 16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},or.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const r=.5*(1+~~(t>50));return[(1&e)*r*255,(e>>1&1)*r*255,(e>>2&1)*r*255]},or.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;t-=16;return[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},or.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},or.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];3===e[0].length&&(r=r.split("").map((t=>t+t)).join(""));const n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},or.rgb.hcg=function(t){const e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.max(Math.max(e,r),n),i=Math.min(Math.min(e,r),n),a=o-i;let s,l;return s=a<1?i/(1-a):0,l=a<=0?0:o===e?(r-n)/a%6:o===r?2+(n-e)/a:4+(e-r)/a,l/=6,l%=1,[360*l,100*a,100*s]},or.hsl.hcg=function(t){const e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r);let o=0;return n<1&&(o=(r-.5*n)/(1-n)),[t[0],100*n,100*o]},or.hsv.hcg=function(t){const e=t[1]/100,r=t[2]/100,n=e*r;let o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],100*n,100*o]},or.hcg.rgb=function(t){const e=t[0]/360,r=t[1]/100,n=t[2]/100;if(0===r)return[255*n,255*n,255*n];const o=[0,0,0],i=e%1*6,a=i%1,s=1-a;let l=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=a,o[2]=0;break;case 1:o[0]=s,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=a;break;case 3:o[0]=0,o[1]=s,o[2]=1;break;case 4:o[0]=a,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=s}return l=(1-r)*n,[255*(r*o[0]+l),255*(r*o[1]+l),255*(r*o[2]+l)]},or.hcg.hsv=function(t){const e=t[1]/100,r=e+t[2]/100*(1-e);let n=0;return r>0&&(n=e/r),[t[0],100*n,100*r]},or.hcg.hsl=function(t){const e=t[1]/100,r=t[2]/100*(1-e)+.5*e;let n=0;return r>0&&r<.5?n=e/(2*r):r>=.5&&r<1&&(n=e/(2*(1-r))),[t[0],100*n,100*r]},or.hcg.hwb=function(t){const e=t[1]/100,r=e+t[2]/100*(1-e);return[t[0],100*(r-e),100*(1-r)]},or.hwb.hcg=function(t){const e=t[1]/100,r=1-t[2]/100,n=r-e;let o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],100*n,100*o]},or.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},or.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},or.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},or.gray.hsl=function(t){return[0,0,t[0]]},or.gray.hsv=or.gray.hsl,or.gray.hwb=function(t){return[0,100,t[0]]},or.gray.cmyk=function(t){return[0,0,0,t[0]]},or.gray.lab=function(t){return[t[0],0,0]},or.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),r=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(r.length)+r},or.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};const sr=ir;function lr(t){const e=function(){const t={},e=Object.keys(sr);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}(),r=[t];for(e[t].distance=0;r.length;){const t=r.pop(),n=Object.keys(sr[t]);for(let o=n.length,i=0;i<o;i++){const o=n[i],a=e[o];-1===a.distance&&(a.distance=e[t].distance+1,a.parent=t,r.unshift(o))}}return e}function cr(t,e){return function(r){return e(t(r))}}function ur(t,e){const r=[e[t].parent,t];let n=sr[e[t].parent][t],o=e[t].parent;for(;e[o].parent;)r.unshift(e[o].parent),n=cr(sr[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}const hr=ir,dr=function(t){const e=lr(t),r={},n=Object.keys(e);for(let t=n.length,o=0;o<t;o++){const t=n[o];null!==e[t].parent&&(r[t]=ur(t,e))}return r},mr={};Object.keys(hr).forEach((t=>{mr[t]={},Object.defineProperty(mr[t],"channels",{value:hr[t].channels}),Object.defineProperty(mr[t],"labels",{value:hr[t].labels});const e=dr(t);Object.keys(e).forEach((r=>{const n=e[r];mr[t][r]=function(t){const e=function(...e){const r=e[0];if(null==r)return r;r.length>1&&(e=r);const n=t(e);if("object"==typeof n)for(let t=n.length,e=0;e<t;e++)n[e]=Math.round(n[e]);return n};return"conversion"in t&&(e.conversion=t.conversion),e}(n),mr[t][r].raw=function(t){const e=function(...e){const r=e[0];return null==r?r:(r.length>1&&(e=r),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(n)}))}));const gr=er,pr=mr,fr=["keyword","gray","hex"],vr={};for(const t of Object.keys(pr))vr[[...pr[t].labels].sort().join("")]=t;const br={};function yr(t,e){if(!(this instanceof yr))return new yr(t,e);if(e&&e in fr&&(e=null),e&&!(e in pr))throw new Error("Unknown model: "+e);let r,n;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof yr)this.model=t.model,this.color=[...t.color],this.valpha=t.valpha;else if("string"==typeof t){const e=gr.get(t);if(null===e)throw new Error("Unable to parse color from string: "+t);this.model=e.model,n=pr[this.model].channels,this.color=e.value.slice(0,n),this.valpha="number"==typeof e.value[n]?e.value[n]:1}else if(t.length>0){this.model=e||"rgb",n=pr[this.model].channels;const r=Array.prototype.slice.call(t,0,n);this.color=kr(r,n),this.valpha="number"==typeof t[n]?t[n]:1}else if("number"==typeof t)this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;const e=Object.keys(t);"alpha"in t&&(e.splice(e.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);const n=e.sort().join("");if(!(n in vr))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=vr[n];const{labels:o}=pr[this.model],i=[];for(r=0;r<o.length;r++)i.push(t[o[r]]);this.color=kr(i)}if(br[this.model])for(n=pr[this.model].channels,r=0;r<n;r++){const t=br[this.model][r];t&&(this.color[r]=t(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}yr.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(t){let e=this.model in gr.to?this:this.rgb();e=e.round("number"==typeof t?t:1);const r=1===e.valpha?e.color:[...e.color,this.valpha];return gr.to[e.model](r)},percentString(t){const e=this.rgb().round("number"==typeof t?t:1),r=1===e.valpha?e.color:[...e.color,this.valpha];return gr.to.rgb.percent(r)},array(){return 1===this.valpha?[...this.color]:[...this.color,this.valpha]},object(){const t={},{channels:e}=pr[this.model],{labels:r}=pr[this.model];for(let n=0;n<e;n++)t[r[n]]=this.color[n];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray(){const t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject(){const t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round(t){return t=Math.max(t||0,0),new yr([...this.color.map(_r(t)),this.valpha],this.model)},alpha(t){return void 0!==t?new yr([...this.color,Math.max(0,Math.min(1,t))],this.model):this.valpha},red:wr("rgb",0,$r(255)),green:wr("rgb",1,$r(255)),blue:wr("rgb",2,$r(255)),hue:wr(["hsl","hsv","hsl","hwb","hcg"],0,(t=>(t%360+360)%360)),saturationl:wr("hsl",1,$r(100)),lightness:wr("hsl",2,$r(100)),saturationv:wr("hsv",1,$r(100)),value:wr("hsv",2,$r(100)),chroma:wr("hcg",1,$r(100)),gray:wr("hcg",2,$r(100)),white:wr("hwb",1,$r(100)),wblack:wr("hwb",2,$r(100)),cyan:wr("cmyk",0,$r(100)),magenta:wr("cmyk",1,$r(100)),yellow:wr("cmyk",2,$r(100)),black:wr("cmyk",3,$r(100)),x:wr("xyz",0,$r(95.047)),y:wr("xyz",1,$r(100)),z:wr("xyz",2,$r(108.833)),l:wr("lab",0,$r(100)),a:wr("lab",1),b:wr("lab",2),keyword(t){return void 0!==t?new yr(t):pr[this.model].keyword(this.color)},hex(t){return void 0!==t?new yr(t):gr.to.hex(this.rgb().round().color)},hexa(t){if(void 0!==t)return new yr(t);const e=this.rgb().round().color;let r=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===r.length&&(r="0"+r),gr.to.hex(e)+r},rgbNumber(){const t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity(){const t=this.rgb().color,e=[];for(const[r,n]of t.entries()){const t=n/255;e[r]=t<=.04045?t/12.92:((t+.055)/1.055)**2.4}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(t){const e=this.luminosity(),r=t.luminosity();return e>r?(e+.05)/(r+.05):(r+.05)/(e+.05)},level(t){const e=this.contrast(t);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){const t=this.rgb().color;return(2126*t[0]+7152*t[1]+722*t[2])/1e4<128},isLight(){return!this.isDark()},negate(){const t=this.rgb();for(let e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten(t){const e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken(t){const e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate(t){const e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate(t){const e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten(t){const e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken(t){const e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale(){const t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return yr.rgb(e,e,e)},fade(t){return this.alpha(this.valpha-this.valpha*t)},opaquer(t){return this.alpha(this.valpha+this.valpha*t)},rotate(t){const e=this.hsl();let r=e.color[0];return r=(r+t)%360,r=r<0?360+r:r,e.color[0]=r,e},mix(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);const r=t.rgb(),n=this.rgb(),o=void 0===e?.5:e,i=2*o-1,a=r.alpha()-n.alpha(),s=((i*a==-1?i:(i+a)/(1+i*a))+1)/2,l=1-s;return yr.rgb(s*r.red()+l*n.red(),s*r.green()+l*n.green(),s*r.blue()+l*n.blue(),r.alpha()*o+n.alpha()*(1-o))}};for(const t of Object.keys(pr)){if(fr.includes(t))continue;const{channels:e}=pr[t];yr.prototype[t]=function(...e){return this.model===t?new yr(this):e.length>0?new yr(e,t):new yr([...(r=pr[this.model][t].raw(this.color),Array.isArray(r)?r:[r]),this.valpha],t);var r},yr[t]=function(...r){let n=r[0];return"number"==typeof n&&(n=kr(r,e)),new yr(n,t)}}function _r(t){return function(e){return function(t,e){return Number(t.toFixed(e))}(e,t)}}function wr(t,e,r){t=Array.isArray(t)?t:[t];for(const n of t)(br[n]||(br[n]=[]))[e]=r;return t=t[0],function(n){let o;return void 0!==n?(r&&(n=r(n)),o=this[t](),o.color[e]=n,o):(o=this[t]().color[e],r&&(o=r(o)),o)}}function $r(t){return function(e){return Math.max(0,Math.min(t,e))}}function kr(t,e){for(let r=0;r<e;r++)"number"!=typeof t[r]&&(t[r]=0);return t}var xr=yr;const Ar=["primary","accent","red","pink","purple","deep-purple","indigo","blue","light-blue","cyan","teal","green","light-green","lime","yellow","amber","orange","deep-orange","brown","grey","blue-grey","black","white","disabled"];function Er(t){if("primary"===t||"accent"===t)return`var(--rgb-${t}-color)`;if(Ar.includes(t))return`var(--rgb-${t})`;if(t.startsWith("#"))try{return xr.rgb(t).rgb().array().join(", ")}catch(t){return""}return t}const Sr=l`
--default-red: 244, 67, 54;
--default-pink: 233, 30, 99;
--default-purple: 156, 39, 176;
--default-deep-purple: 103, 58, 183;
--default-indigo: 63, 81, 181;
--default-blue: 33, 150, 243;
--default-light-blue: 3, 169, 244;
--default-cyan: 0, 188, 212;
--default-teal: 0, 150, 136;
--default-green: 76, 175, 80;
--default-light-green: 139, 195, 74;
--default-lime: 205, 220, 57;
--default-yellow: 255, 235, 59;
--default-amber: 255, 193, 7;
--default-orange: 255, 152, 0;
--default-deep-orange: 255, 87, 34;
--default-brown: 121, 85, 72;
--default-grey: 158, 158, 158;
--default-blue-grey: 96, 125, 139;
--default-black: 0, 0, 0;
--default-white: 255, 255, 255;
--default-disabled: 189, 189, 189;
`,Mr=l`
--default-disabled: 111, 111, 111;
`,Cr=l`
--spacing: var(--mush-spacing, 12px);
/* Title */
--title-padding: var(--mush-title-padding, 24px 12px 16px);
--title-spacing: var(--mush-title-spacing, 12px);
--title-font-size: var(--mush-title-font-size, 24px);
--title-font-weight: var(--mush-title-font-weight, normal);
--title-line-height: var(--mush-title-line-height, 1.2);
--subtitle-font-size: var(--mush-subtitle-font-size, 16px);
--subtitle-font-weight: var(--mush-subtitle-font-weight, normal);
--subtitle-line-height: var(--mush-subtitle-line-height, 1.2);
/* Card */
--card-primary-font-size: var(--mush-card-primary-font-size, 14px);
--card-secondary-font-size: var(--mush-card-secondary-font-size, 12px);
--card-primary-font-weight: var(--mush-card-primary-font-weight, bold);
--card-secondary-font-weight: var(--mush-card-secondary-font-weight, bolder);
--card-primary-line-height: var(--mush-card-primary-line-height, 1.5);
--card-secondary-line-height: var(--mush-card-secondary-line-height, 1.5);
/* Chips */
--chip-spacing: var(--mush-chip-spacing, 8px);
--chip-padding: var(--mush-chip-padding, 0 0.25em);
--chip-height: var(--mush-chip-height, 36px);
--chip-border-radius: var(--mush-chip-border-radius, 19px);
--chip-border-width: var(--mush-chip-border-width, var(--ha-card-border-width, 1px));
--chip-border-color: var(
--mush-chip-border-color,
var(--ha-card-border-color, var(--divider-color))
);
--chip-box-shadow: var(--mush-chip-box-shadow, var(--ha-card-box-shadow, "none"));
--chip-font-size: var(--mush-chip-font-size, 0.3em);
--chip-font-weight: var(--mush-chip-font-weight, bold);
--chip-icon-size: var(--mush-chip-icon-size, 0.5em);
--chip-avatar-padding: var(--mush-chip-avatar-padding, 0.1em);
--chip-avatar-border-radius: var(--mush-chip-avatar-border-radius, 50%);
--chip-background: var(
--mush-chip-background,
var(--ha-card-background, var(--card-background-color, white))
);
/* Controls */
--control-border-radius: var(--mush-control-border-radius, 12px);
--control-height: var(--mush-control-height, 42px);
--control-button-ratio: var(--mush-control-button-ratio, 1);
--control-icon-size: var(--mush-control-icon-size, 0.5em);
/* Slider */
--slider-threshold: var(--mush-slider-threshold);
/* Input Number */
--input-number-debounce: var(--mush-input-number-debounce);
/* Layout */
--layout-align: var(--mush-layout-align, center);
/* Badge */
--badge-size: var(--mush-badge-size, 16px);
--badge-icon-size: var(--mush-badge-icon-size, 0.75em);
--badge-border-radius: var(--mush-badge-border-radius, 50%);
/* Icon */
--icon-border-radius: var(--mush-icon-border-radius, 50%);
--icon-size: var(--mush-icon-size, 42px);
--icon-symbol-size: var(--mush-icon-symbol-size, 0.5em);
`,zr=l`
/* RGB */
/* Standard colors */
--rgb-red: var(--mush-rgb-red, var(--default-red));
--rgb-pink: var(--mush-rgb-pink, var(--default-pink));
--rgb-purple: var(--mush-rgb-purple, var(--default-purple));
--rgb-deep-purple: var(--mush-rgb-deep-purple, var(--default-deep-purple));
--rgb-indigo: var(--mush-rgb-indigo, var(--default-indigo));
--rgb-blue: var(--mush-rgb-blue, var(--default-blue));
--rgb-light-blue: var(--mush-rgb-light-blue, var(--default-light-blue));
--rgb-cyan: var(--mush-rgb-cyan, var(--default-cyan));
--rgb-teal: var(--mush-rgb-teal, var(--default-teal));
--rgb-green: var(--mush-rgb-green, var(--default-green));
--rgb-light-green: var(--mush-rgb-light-green, var(--default-light-green));
--rgb-lime: var(--mush-rgb-lime, var(--default-lime));
--rgb-yellow: var(--mush-rgb-yellow, var(--default-yellow));
--rgb-amber: var(--mush-rgb-amber, var(--default-amber));
--rgb-orange: var(--mush-rgb-orange, var(--default-orange));
--rgb-deep-orange: var(--mush-rgb-deep-orange, var(--default-deep-orange));
--rgb-brown: var(--mush-rgb-brown, var(--default-brown));
--rgb-grey: var(--mush-rgb-grey, var(--default-grey));
--rgb-blue-grey: var(--mush-rgb-blue-grey, var(--default-blue-grey));
--rgb-black: var(--mush-rgb-black, var(--default-black));
--rgb-white: var(--mush-rgb-white, var(--default-white));
--rgb-disabled: var(--mush-rgb-disabled, var(--default-disabled));
/* Action colors */
--rgb-info: var(--mush-rgb-info, var(--rgb-blue));
--rgb-success: var(--mush-rgb-success, var(--rgb-green));
--rgb-warning: var(--mush-rgb-warning, var(--rgb-orange));
--rgb-danger: var(--mush-rgb-danger, var(--rgb-red));
/* State colors */
--rgb-state-vacuum: var(--mush-rgb-state-vacuum, var(--rgb-teal));
--rgb-state-fan: var(--mush-rgb-state-fan, var(--rgb-green));
--rgb-state-light: var(--mush-rgb-state-light, var(--rgb-orange));
--rgb-state-entity: var(--mush-rgb-state-entity, var(--rgb-blue));
--rgb-state-media-player: var(--mush-rgb-state-media-player, var(--rgb-indigo));
--rgb-state-lock: var(--mush-rgb-state-lock, var(--rgb-blue));
--rgb-state-number: var(--mush-rgb-state-number, var(--rgb-blue));
--rgb-state-humidifier: var(--mush-rgb-state-humidifier, var(--rgb-purple));
/* State alarm colors */
--rgb-state-alarm-disarmed: var(--mush-rgb-state-alarm-disarmed, var(--rgb-info));
--rgb-state-alarm-armed: var(--mush-rgb-state-alarm-armed, var(--rgb-success));
--rgb-state-alarm-triggered: var(--mush-rgb-state-alarm-triggered, var(--rgb-danger));
/* State person colors */
--rgb-state-person-home: var(--mush-rgb-state-person-home, var(--rgb-success));
--rgb-state-person-not-home: var(--mush-rgb-state-person-not-home, var(--rgb-danger));
--rgb-state-person-zone: var(--mush-rgb-state-person-zone, var(--rgb-info));
--rgb-state-person-unknown: var(--mush-rgb-state-person-unknown, var(--rgb-grey));
/* State update colors */
--rgb-state-update-on: var(--mush-rgb-state-update-on, var(--rgb-orange));
--rgb-state-update-off: var(--mush-rgb-update-off, var(--rgb-green));
--rgb-state-update-installing: var(--mush-rgb-update-installing, var(--rgb-blue));
/* State lock colors */
--rgb-state-lock-locked: var(--mush-rgb-state-lock-locked, var(--rgb-green));
--rgb-state-lock-unlocked: var(--mush-rgb-state-lock-unlocked, var(--rgb-red));
--rgb-state-lock-pending: var(--mush-rgb-state-lock-pending, var(--rgb-orange));
/* State cover colors */
--rgb-state-cover-open: var(--mush-rgb-state-cover-open, var(--rgb-blue));
--rgb-state-cover-closed: var(--mush-rgb-state-cover-closed, var(--rgb-disabled));
/* State climate colors */
--rgb-state-climate-auto: var(--mush-rgb-state-climate-auto, var(--rgb-green));
--rgb-state-climate-cool: var(--mush-rgb-state-climate-cool, var(--rgb-blue));
--rgb-state-climate-dry: var(--mush-rgb-state-climate-dry, var(--rgb-orange));
--rgb-state-climate-fan-only: var(--mush-rgb-state-climate-fan-only, var(--rgb-teal));
--rgb-state-climate-heat: var(--mush-rgb-state-climate-heat, var(--rgb-deep-orange));
--rgb-state-climate-heat-cool: var(--mush-rgb-state-climate-heat-cool, var(--rgb-green));
--rgb-state-climate-idle: var(--mush-rgb-state-climate-idle, var(--rgb-disabled));
--rgb-state-climate-off: var(--mush-rgb-state-climate-off, var(--rgb-disabled));
`;function Or(t){return!!t&&t.themes.darkMode}class jr extends at{updated(t){if(super.updated(t),t.has("hass")&&this.hass){const e=Or(t.get("hass")),r=Or(this.hass);e!==r&&this.toggleAttribute("dark-mode",r)}}static get styles(){return[Ie,l`
:host {
${Sr}
}
:host([dark-mode]) {
${Mr}
}
:host {
${zr}
${Cr}
}
`]}}e([ht({attribute:!1})],jr.prototype,"hass",void 0);const Nr=["button","input_button","scene"];function Tr(t,e,r,n,o){switch(t){case"name":return e;case"state":const t=n.entity_id.split(".")[0];return"timestamp"!==n.attributes.device_class&&!Nr.includes(t)||!Ft(n)||function(t){return t.state===Dt}(n)?r:H`
<ha-relative-time
.hass=${o}
.datetime=${n.state}
capitalize
></ha-relative-time>
`;case"last-changed":return H`
<ha-relative-time
.hass=${o}
.datetime=${n.last_changed}
capitalize
></ha-relative-time>
`;case"last-updated":return H`
<ha-relative-time
.hass=${o}
.datetime=${n.last_updated}
capitalize
></ha-relative-time>
`;case"none":return}}class Pr extends jr{renderPicture(t){return H`
<mushroom-shape-avatar
slot="icon"
.picture_url=${this.hass.hassUrl(t)}
></mushroom-shape-avatar>
`}renderNotFound(t){const e=function(t){var e,r,n,o,i;return{layout:null!==(e=t.layout)&&void 0!==e?e:Ne(t),fill_container:null!==(r=t.fill_container)&&void 0!==r&&r,primary_info:null!==(n=t.primary_info)&&void 0!==n?n:Pe(t),secondary_info:null!==(o=t.secondary_info)&&void 0!==o?o:De(t),icon_type:null!==(i=t.icon_type)&&void 0!==i?i:Te(t)}}(t),r=pe(this.hass),n=je(this.hass);return H`
<ha-card class=${vt({"fill-container":e.fill_container})}>
<mushroom-card .appearance=${e} ?rtl=${r}>
<mushroom-state-item ?rtl=${r} .appearance=${e} disabled>
<mushroom-shape-icon slot="icon" disabled>
<ha-icon icon="mdi:help"></ha-icon>
</mushroom-shape-icon>
<mushroom-badge-icon
slot="badge"
class="not-found"
icon="mdi:exclamation-thick"
></mushroom-badge-icon>
<mushroom-state-info
slot="info"
.primary=${t.entity}
secondary=${n("card.not_found")}
></mushroom-state-info>
</mushroom-state-item>
</mushroom-card>
</ha-card>
`}renderIcon(t,e){const r=It(t);return H`
<mushroom-shape-icon slot="icon" .disabled=${!r}>
<ha-state-icon .state=${t} .icon=${e}></ha-state-icon
></mushroom-shape-icon>
`}renderBadge(t){return!Ft(t)?H`
<mushroom-badge-icon
class="unavailable"
slot="badge"
icon="mdi:help"
></mushroom-badge-icon>
`:L}renderStateInfo(t,e,r,n){const o=this.hass.formatEntityState?this.hass.formatEntityState(t):Yt(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities),i=null!=n?n:o,a=Tr(e.primary_info,r,i,t,this.hass),s=Tr(e.secondary_info,r,i,t,this.hass);return H`
<mushroom-state-info
slot="info"
.primary=${a}
.secondary=${s}
></mushroom-state-info>
`}}const Dr=l`
ha-card {
box-sizing: border-box;
padding: var(--spacing);
display: flex;
flex-direction: column;
justify-content: var(--layout-align);
height: auto;
}
ha-card.fill-container {
height: 100%;
}
.actions {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
overflow-x: auto;
overflow-y: hidden;
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE 10+ */
}
.actions::-webkit-scrollbar {
background: transparent; /* Chrome/Safari/Webkit */
height: 0px;
}
.actions *:not(:last-child) {
margin-right: var(--spacing);
}
.actions[rtl] *:not(:last-child) {
margin-right: initial;
margin-left: var(--spacing);
}
.unavailable {
--main-color: rgb(var(--rgb-warning));
}
.not-found {
--main-color: rgb(var(--rgb-danger));
}
mushroom-state-item[disabled] {
cursor: initial;
}
`;const Ur="mushroom-bar-card",Ir=`${Ur}-editor`,Fr=ue({entity:he(de()),name:he(de()),icon:he(de())}),Hr=ue({index:he(ce()),view_index:he(ce()),view_layout:ie("any",(()=>!0)),type:de()}),Rr=ge([le("horizontal"),le("vertical"),le("default")]),Lr=!0,Br=!0,Zr=!0,Vr=ue({from:ce(),color:de()}),qr=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];const n="type"===e[0].type,o=e.map((t=>t.schema)),i=Object.assign({},...o);return n?me(i):ue(i)}(Hr,Fr,ue({icon_color:he(de()),layout:he(Rr),fill_container:he(se()),show_name:he(se()),show_state:he(se()),show_icon:he(se()),min:ce(),max:ce(),segments:he(ae(Vr))}));!function(e){const r=window;r.customCards=r.customCards||[];const n=e.type.replace("-card","").replace("mushroom-","");r.customCards.push(Object.assign(Object.assign({},e),{preview:!0,documentationURL:`${t}/blob/main/docs/cards/${n}.md`}))}({type:Ur,name:"Mushroom Bar Card",description:"Card for numeric sensor entities to be represented as a horizontal bar gauge"});let Wr=class extends Pr{static async getConfigElement(){return await Promise.resolve().then((function(){return Gr})),document.createElement(Ir)}static async getStubConfig(t){const e=Object.keys(t.states).filter((e=>"sensor"===e.split(".")[0]&&t.states[e]&&!isNaN(Number(t.states[e].state))));return{type:`custom:${Ur}`,entity:e[0],min:0,max:100}}getCardSize(){return 1}setConfig(t){this._config=Object.assign({show_name:Lr,show_state:Br,show_icon:Zr},t)}computeSeverity(t,e){var r,n,o,i,a;return null!==(i=null===(o=null===(n=null===(r=t.segments)||void 0===r?void 0:r.filter((t=>e>=t.from)))||void 0===n?void 0:n.sort(((t,e)=>e.from-t.from)).shift())||void 0===o?void 0:o.color)&&void 0!==i?i:null===(a=this._config)||void 0===a?void 0:a.icon_color}render(){var t,e,r,n,o;if(!this._config||!this.hass||!this._config.entity)return L;const i=this._config.entity,a=this.hass.states[i];if(!a)return this.renderNotFound(this._config);const s=Ft(a),l=this._config.name||a.attributes.friendly_name||"",c=this._config.icon,u={layout:null!==(t=this._config.layout)&&void 0!==t?t:"default",fill_container:null!==(e=this._config.fill_container)&&void 0!==e&&e,primary_info:(null!==(r=this._config.show_name)&&void 0!==r?r:Lr)?"name":"none",secondary_info:(null!==(n=this._config.show_state)&&void 0!==n?n:Br)?"state":"none",icon_type:(null!==(o=this._config.show_icon)&&void 0!==o?o:Zr)?"icon":"none"},h=this.hass.formatEntityState?this.hass.formatEntityState(a):Yt(this.hass.localize,a,this.hass.locale,this.hass.config,this.hass.entities),d=pe(this.hass),m=Number(s?a.state:0),g={},p=this.computeSeverity(this._config,m);if(p){const t=Er(p);g["--main-color"]=`rgb(${t})`,g["--bg-color"]=`rgba(${t}, 0.2)`}return H`
<ha-card class=${vt({"fill-container":u.fill_container})}>
<mushroom-card .appearance=${u} ?rtl=${d}>
<mushroom-state-item ?rtl=${d} .appearance=${u}>
${this.renderIcon(a,c)} ${this.renderBadge(a)}
${this.renderStateInfo(a,u,l,h)};
</mushroom-state-item>
<mushroom-slider-ex
.value=${m}
.controllable=${!1}
.disabled=${!s}
.inactive=${!It(a)}
.showActive=${!0}
.min=${this._config.min}
.max=${this._config.max}
style=${_t(g)}
></mushroom-slider-ex>
</mushroom-card>
</ha-card>
`}renderIcon(t,e){var r;const n=It(t),o={},i=null===(r=this._config)||void 0===r?void 0:r.icon_color;if(i){const t=Er(i);o["--icon-color"]=`rgb(${t})`,o["--shape-color"]=`rgba(${t}, 0.2)`}return H`
<mushroom-shape-icon slot="icon" .disabled=${!n} style=${_t(o)}>
<ha-state-icon .state=${t} .icon=${e}></ha-state-icon>
</mushroom-shape-icon>
`}static get styles(){return[super.styles,Dr,l`
mushroom-shape-icon {
--icon-color: rgb(var(--rgb-state-number));
--shape-color: rgba(var(--rgb-state-number), 0.2);
}
mushroom-slider-ex {
--main-color: rgb(var(--rgb-state-number));
--bg-color: rgba(var(--rgb-state-number), 0.2);
}
`]}};e([dt()],Wr.prototype,"_config",void 0),Wr=e([lt(Ur)],Wr),console.info("%c🍄 Mushroom-bar-card Addon 🍄 - requires lovelace-mushroom based on Mushroom 3.1.0","color: #ef5350; font-weight: 700;");const Yr=["icon_color","layout","fill_container","primary_info","secondary_info","icon_type","content_info","use_entity_picture","collapsible_controls","icon_animation"],Jr=[{name:"entity",selector:{entity:{domain:"sensor"}}},{name:"name",selector:{text:{}}},{type:"grid",name:"",schema:[{name:"icon",selector:{icon:{}},context:{icon_entity:"entity"}},{name:"icon_color",selector:{mush_color:{}}}]},{type:"grid",name:"",schema:[{name:"layout",selector:{mush_layout:{}}},{name:"fill_container",selector:{boolean:{}}}]},{type:"grid",name:"",schema:[{name:"show_name",selector:{boolean:{}}},{name:"show_state",selector:{boolean:{}}},{name:"show_icon",selector:{boolean:{}}}]},{type:"grid",name:"",schema:[{name:"min",selector:{number:{mode:"box"}}},{name:"max",selector:{number:{mode:"box"}}}]}];let Kr=class extends jr{constructor(){super(...arguments),this._computeLabel=t=>{const e=je(this.hass);return Yr.includes(t.name)?e(`editor.card.generic.${t.name}`):"min"===t.name?this.hass.localize("ui.panel.lovelace.editor.card.generic.minimum"):"max"===t.name?this.hass.localize("ui.panel.lovelace.editor.card.generic.maximum"):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}}connectedCallback(){var t,e;super.connectedCallback(),customElements.get("ha-form")||null===(t=customElements.get("hui-button-card"))||void 0===t||t.getConfigElement(),customElements.get("ha-entity-picker")||null===(e=customElements.get("hui-entities-card"))||void 0===e||e.getConfigElement()}setConfig(t){ne(t,qr),this._config=t}render(){var t,e,r;if(!this.hass||!this._config)return L;const n=Object.assign({},this._config);return n.show_name=null!==(t=n.show_name)&&void 0!==t?t:Lr,n.show_state=null!==(e=n.show_state)&&void 0!==e?e:Br,n.show_icon=null!==(r=n.show_icon)&&void 0!==r?r:Zr,H`
<ha-form
.hass=${this.hass}
.data=${n}
.schema=${Jr}
.computeLabel=${this._computeLabel}
@value-changed=${this._valueChanged}
></ha-form>
`}_valueChanged(t){((t,e,r,n)=>{n=n||{},r=null==r?{}:r;const o=new Event(e,{bubbles:void 0===n.bubbles||n.bubbles,cancelable:Boolean(n.cancelable),composed:void 0===n.composed||n.composed});o.detail=r,t.dispatchEvent(o)})(this,"config-changed",{config:t.detail.value})}};e([dt()],Kr.prototype,"_config",void 0),Kr=e([lt(Ir)],Kr);var Gr=Object.freeze({__proto__:null,get BarCardEditor(){return Kr}});export{Wr as BarCard};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment