|
var t="https://github.com/piitaya/lovelace-mushroom"; |
|
function e(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a |
|
}const n=window,r=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),o=new WeakMap;let a=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==i)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(r&&void 0===t){const n=void 0!==e&&1===e.length;n&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&o.set(e,t))}return t}toString(){return this.cssText}};const s=t=>new a("string"==typeof t?t:t+"",void 0,i),l=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,n,r)=>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.")})(n)+t[r+1]),t[0]);return new a(n,t,i)},c=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return s(e)})(t):t |
|
;var u;const d=window,h=d.trustedTypes,m=h?h.emptyScript:"",p=d.reactiveElementPolyfillSupport,g={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 n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},f=(t,e)=>e!==t&&(e==e||t==t),v={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:f},_="finalized";let b=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,n)=>{const r=this._$Ep(n,e);void 0!==r&&(this._$Ev.set(r,n),t.push(r))})),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 n="symbol"==typeof t?Symbol():"__"+t,r=this.getPropertyDescriptor(t,n,e);void 0!==r&&Object.defineProperty(this.prototype,t,r)}}static getPropertyDescriptor(t,e,n){return{get(){return this[e]},set(r){const i=this[t];this[e]=r,this.requestUpdate(t,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty(_))return!1;this[_]=!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 n of e)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(c(t))}else void 0!==t&&e.push(c(t));return e}static _$Ep(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"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,n;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(n=t.hostConnected)||void 0===n||n.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)=>{r?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const r=document.createElement("style"),i=n.litNonce;void 0!==i&&r.setAttribute("nonce",i),r.textContent=e.cssText,t.appendChild(r)}))})(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,n){this._$AK(t,n)}_$EO(t,e,n=v){var r;const i=this.constructor._$Ep(t,n);if(void 0!==i&&!0===n.reflect){const o=(void 0!==(null===(r=n.converter)||void 0===r?void 0:r.toAttribute)?n.converter:g).toAttribute(e,n.type);this._$El=t,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$El=null}}_$AK(t,e){var n;const r=this.constructor,i=r._$Ev.get(t);if(void 0!==i&&this._$El!==i){const t=r.getPropertyOptions(i),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(n=t.converter)||void 0===n?void 0:n.fromAttribute)?t.converter:g;this._$El=i,this[i]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,n){let r=!0;void 0!==t&&(((n=n||this.constructor.getPropertyOptions(t)).hasChanged||f)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===n.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,n))):r=!1),!this.isUpdatePending&&r&&(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 n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),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(n)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(n)}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 y;b[_]=!0,b.elementProperties=new Map,b.elementStyles=[],b.shadowRootOptions={mode:"open"},null==p||p({ReactiveElement:b}),(null!==(u=d.reactiveElementVersions)&&void 0!==u?u:d.reactiveElementVersions=[]).push("1.6.2");const $=window,w=$.trustedTypes,x=w?w.createPolicy("lit-html",{createHTML:t=>t}):void 0,A="$lit$",k=`lit$${(Math.random()+"").slice(9)}$`,E="?"+k,S=`<${E}>`,C=document,z=()=>C.createComment(""),T=t=>null===t||"object"!=typeof t&&"function"!=typeof t,O=Array.isArray,N="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,D=/-->/g,M=/>/g,j=RegExp(`>|${N}(?:([^\\s"'>=/]+)(${N}*=${N}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),U=/'/g,I=/"/g,L=/^(?:script|style|textarea|title)$/i,H=(t=>(e,...n)=>({_$litType$:t,strings:e,values:n}))(1),R=Symbol.for("lit-noChange"),F=Symbol.for("lit-nothing"),B=new WeakMap,V=C.createTreeWalker(C,129,null,!1);function Z(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==x?x.createHTML(e):e}const W=(t,e)=>{const n=t.length-1,r=[];let i,o=2===e?"<svg>":"",a=P;for(let e=0;e<n;e++){const n=t[e];let s,l,c=-1,u=0;for(;u<n.length&&(a.lastIndex=u,l=a.exec(n),null!==l);)u=a.lastIndex,a===P?"!--"===l[1]?a=D:void 0!==l[1]?a=M:void 0!==l[2]?(L.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=j):void 0!==l[3]&&(a=j):a===j?">"===l[0]?(a=null!=i?i:P,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,s=l[1],a=void 0===l[3]?j:'"'===l[3]?I:U):a===I||a===U?a=j:a===D||a===M?a=P:(a=j,i=void 0);const d=a===j&&t[e+1].startsWith("/>")?" ":"";o+=a===P?n+S:c>=0?(r.push(s),n.slice(0,c)+A+n.slice(c)+k+d):n+k+(-2===c?(r.push(void 0),e):d)}return[Z(t,o+(t[n]||"<?>")+(2===e?"</svg>":"")),r]};class Y{constructor({strings:t,_$litType$:e},n){let r;this.parts=[];let i=0,o=0;const a=t.length-1,s=this.parts,[l,c]=W(t,e);if(this.el=Y.createElement(l,n),V.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(r=V.nextNode())&&s.length<a;){if(1===r.nodeType){if(r.hasAttributes()){const t=[];for(const e of r.getAttributeNames())if(e.endsWith(A)||e.startsWith(k)){const n=c[o++];if(t.push(e),void 0!==n){const t=r.getAttribute(n.toLowerCase()+A).split(k),e=/([.?@])?(.*)/.exec(n);s.push({type:1,index:i,name:e[2],strings:t,ctor:"."===e[1]?Q:"?"===e[1]?tt:"@"===e[1]?et:K})}else s.push({type:6,index:i})}for(const e of t)r.removeAttribute(e)}if(L.test(r.tagName)){const t=r.textContent.split(k),e=t.length-1;if(e>0){r.textContent=w?w.emptyScript:"";for(let n=0;n<e;n++)r.append(t[n],z()),V.nextNode(),s.push({type:2,index:++i});r.append(t[e],z())}}}else if(8===r.nodeType)if(r.data===E)s.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(k,t+1));)s.push({type:7,index:i}),t+=k.length-1}i++}}static createElement(t,e){const n=C.createElement("template");return n.innerHTML=t,n}}function q(t,e,n=t,r){var i,o,a,s;if(e===R)return e;let l=void 0!==r?null===(i=n._$Co)||void 0===i?void 0:i[r]:n._$Cl;const c=T(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(o=null==l?void 0:l._$AO)||void 0===o||o.call(l,!1),void 0===c?l=void 0:(l=new c(t),l._$AT(t,n,r)),void 0!==r?(null!==(a=(s=n)._$Co)&&void 0!==a?a:s._$Co=[])[r]=l:n._$Cl=l),void 0!==l&&(e=q(t,l._$AS(t,e.values),l,r)),e}class G{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:n},parts:r}=this._$AD,i=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:C).importNode(n,!0);V.currentNode=i;let o=V.nextNode(),a=0,s=0,l=r[0];for(;void 0!==l;){if(a===l.index){let e;2===l.type?e=new J(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new nt(o,this,t)),this._$AV.push(e),l=r[++s]}a!==(null==l?void 0:l.index)&&(o=V.nextNode(),a++)}return V.currentNode=C,i}v(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class J{constructor(t,e,n,r){var i;this.type=2,this._$AH=F,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=r,this._$Cp=null===(i=null==r?void 0:r.isConnected)||void 0===i||i}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=q(this,t,e),T(t)?t===F||null==t||""===t?(this._$AH!==F&&this._$AR(),this._$AH=F):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!==F&&T(this._$AH)?this._$AA.nextSibling.data=t:this.$(C.createTextNode(t)),this._$AH=t}g(t){var e;const{values:n,_$litType$:r}=t,i="number"==typeof r?this._$AC(t):(void 0===r.el&&(r.el=Y.createElement(Z(r.h,r.h[0]),this.options)),r);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.v(n);else{const t=new G(i,this),e=t.u(this.options);t.v(n),this.$(e),this._$AH=t}}_$AC(t){let e=B.get(t.strings);return void 0===e&&B.set(t.strings,e=new Y(t)),e}T(t){O(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,r=0;for(const i of t)r===e.length?e.push(n=new J(this.k(z()),this.k(z()),this,this.options)):n=e[r],n._$AI(i),r++;r<e.length&&(this._$AR(n&&n._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){var n;for(null===(n=this._$AP)||void 0===n||n.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 K{constructor(t,e,n,r,i){this.type=1,this._$AH=F,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=i,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=F}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,n,r){const i=this.strings;let o=!1;if(void 0===i)t=q(this,t,e,0),o=!T(t)||t!==this._$AH&&t!==R,o&&(this._$AH=t);else{const r=t;let a,s;for(t=i[0],a=0;a<i.length-1;a++)s=q(this,r[n+a],e,a),s===R&&(s=this._$AH[a]),o||(o=!T(s)||s!==this._$AH[a]),s===F?t=F:t!==F&&(t+=(null!=s?s:"")+i[a+1]),this._$AH[a]=s}o&&!r&&this.j(t)}j(t){t===F?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Q extends K{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===F?void 0:t}}const X=w?w.emptyScript:"";class tt extends K{constructor(){super(...arguments),this.type=4}j(t){t&&t!==F?this.element.setAttribute(this.name,X):this.element.removeAttribute(this.name)}}class et extends K{constructor(t,e,n,r,i){super(t,e,n,r,i),this.type=5}_$AI(t,e=this){var n;if((t=null!==(n=q(this,t,e,0))&&void 0!==n?n:F)===R)return;const r=this._$AH,i=t===F&&r!==F||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==F&&(r===F||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,n;"function"==typeof this._$AH?this._$AH.call(null!==(n=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==n?n:this.element,t):this._$AH.handleEvent(t)}}class nt{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){q(this,t)}}const rt=$.litHtmlPolyfillSupport;null==rt||rt(Y,J),(null!==(y=$.litHtmlVersions)&&void 0!==y?y:$.litHtmlVersions=[]).push("2.7.5"); |
|
|
|
var it,ot;class at extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const n=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=n.firstChild),n}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,n)=>{var r,i;const o=null!==(r=null==n?void 0:n.renderBefore)&&void 0!==r?r:e;let a=o._$litPart$;if(void 0===a){const t=null!==(i=null==n?void 0:n.renderBefore)&&void 0!==i?i:null;o._$litPart$=a=new J(e.insertBefore(z(),t),t,void 0,null!=n?n:{})}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===(it=globalThis.litElementHydrateSupport)||void 0===it||it.call(globalThis,{LitElement:at});const st=globalThis.litElementPolyfillSupport;null==st||st({LitElement:at}),(null!==(ot=globalThis.litElementVersions)&&void 0!==ot?ot:globalThis.litElementVersions=[]).push("3.3.2"); |
|
|
|
const lt=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:n,elements:r}=e;return{kind:n,elements:r,finisher(e){customElements.define(t,e)}}})(t,e) |
|
,ct=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(n){n.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(n){n.createProperty(e.key,t)}},ut=(t,e,n)=>{e.constructor.createProperty(n,t)};function dt(t){return(e,n)=>void 0!==n?ut(t,e,n):ct(t,e)} |
|
function ht(t){return dt({...t,state:!0})} |
|
var mt;null===(mt=window.HTMLSlotElement)||void 0===mt||mt.prototype.assignedElements; |
|
|
|
const pt=1,gt=t=>(...e)=>({_$litDirective$:t,values:e});let ft=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}; |
|
const vt=gt(class extends ft{constructor(t){var e;if(super(t),t.type!==pt||"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 n,r;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===(n=this.nt)||void 0===n?void 0:n.has(t))&&this.it.add(t);return this.render(e)}const i=t.element.classList;this.it.forEach((t=>{t in e||(i.remove(t),this.it.delete(t))}));for(const t in e){const n=!!e[t];n===this.it.has(t)||(null===(r=this.nt)||void 0===r?void 0:r.has(t))||(n?(i.add(t),this.it.add(t)):(i.remove(t),this.it.delete(t)))}return R}}),_t="important",bt=" !"+_t,yt=gt(class extends ft{constructor(t){var e;if(super(t),t.type!==pt||"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,n)=>{const r=t[n];return null==r?e:e+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`}),"")}update(t,[e]){const{style:n}=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("-")?n.removeProperty(t):n[t]="")}));for(const t in e){const r=e[t];if(null!=r){this.ut.add(t);const e="string"==typeof r&&r.endsWith(bt);t.includes("-")||e?n.setProperty(t,e?r.slice(0,-11):r,e?_t:""):n[t]=r}}return R}}); |
|
var $t,wt,xt,At,kt,Et=Number.isNaN||function(t){return"number"==typeof t&&t!=t};function St(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(r=t[n],i=e[n],!(r===i||Et(r)&&Et(i)))return!1;var r,i;return!0}function Ct(t,e){void 0===e&&(e=St);var n=null;function r(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];if(n&&n.lastThis===this&&e(r,n.lastArgs))return n.lastResult;var o=t.apply(this,r);return n={lastResult:o,lastArgs:r,lastThis:this},o}return r.clear=function(){n=null},r}!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"}($t||($t={})),function(t){t.language="language",t.system="system",t.am_pm="12",t.twenty_four="24"}(wt||(wt={})),function(t){t.local="local",t.server="server"}(xt||(xt={})),function(t){t.language="language",t.system="system",t.DMY="DMY",t.MDY="MDY",t.YMD="YMD"}(At||(At={})),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"}(kt||(kt={})),Ct(((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",month:"long",day:"numeric",timeZone:"server"===t.time_zone?e:void 0})));const zt=Ct(((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric",timeZone:"server"===t.time_zone?e:void 0})));Ct(((t,e)=>{const n=t.date_format===At.system?void 0:t.language;return t.date_format===At.language||(t.date_format,At.system),new Intl.DateTimeFormat(n,{year:"numeric",month:"numeric",day:"numeric",timeZone:"server"===t.time_zone?e:void 0})})),Ct(((t,e)=>new Intl.DateTimeFormat(t.language,{day:"numeric",month:"short",timeZone:"server"===t.time_zone?e:void 0}))),Ct(((t,e)=>new Intl.DateTimeFormat(t.language,{month:"long",year:"numeric",timeZone:"server"===t.time_zone?e:void 0}))),Ct(((t,e)=>new Intl.DateTimeFormat(t.language,{month:"long",timeZone:"server"===t.time_zone?e:void 0}))),Ct(((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",timeZone:"server"===t.time_zone?e:void 0}))),Ct(((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",timeZone:"server"===t.time_zone?e:void 0}))),Ct(((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"short",timeZone:"server"===t.time_zone?e:void 0})));const Tt=Ct((t=>{if(t.time_format===wt.language||t.time_format===wt.system){const e=t.time_format===wt.language?t.language:void 0,n=(new Date).toLocaleString(e);return n.includes("AM")||n.includes("PM")}return t.time_format===wt.am_pm})),Ot=Ct(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||Tt(t)?t.language:"en-u-hc-h23",{hour:"numeric",minute:"2-digit",hour12:Tt(t),timeZone:"server"===t.time_zone?e:void 0})));Ct(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||Tt(t)?t.language:"en-u-hc-h23",{hour:Tt(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:Tt(t),timeZone:"server"===t.time_zone?e:void 0}))),Ct(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||Tt(t)?t.language:"en-u-hc-h23",{weekday:"long",hour:Tt(t)?"numeric":"2-digit",minute:"2-digit",hour12:Tt(t),timeZone:"server"===t.time_zone?e:void 0}))),Ct(((t,e)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:"server"===t.time_zone?e:void 0})));const Nt=(t,e,n)=>Pt(e,n.time_zone).format(t),Pt=Ct(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||Tt(t)?t.language:"en-u-hc-h23",{year:"numeric",month:"long",day:"numeric",hour:Tt(t)?"numeric":"2-digit",minute:"2-digit",hour12:Tt(t),timeZone:"server"===t.time_zone?e:void 0})));Ct(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||Tt(t)?t.language:"en-u-hc-h23",{year:"numeric",month:"short",day:"numeric",hour:Tt(t)?"numeric":"2-digit",minute:"2-digit",hour12:Tt(t),timeZone:"server"===t.time_zone?e:void 0}))),Ct(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||Tt(t)?t.language:"en-u-hc-h23",{month:"short",day:"numeric",hour:Tt(t)?"numeric":"2-digit",minute:"2-digit",hour12:Tt(t),timeZone:"server"===t.time_zone?e:void 0}))),Ct(((t,e)=>new Intl.DateTimeFormat("en"!==t.language||Tt(t)?t.language:"en-u-hc-h23",{year:"numeric",month:"long",day:"numeric",hour:Tt(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:Tt(t),timeZone:"server"===t.time_zone?e:void 0})));const Dt=(t,e,n,r)=>{r=r||{},n=null==n?{}:n;const i=new Event(e,{bubbles:void 0===r.bubbles||r.bubbles,cancelable:Boolean(r.cancelable),composed:void 0===r.composed||r.composed});return i.detail=n,t.dispatchEvent(i),i},Mt=t=>t.substr(0,t.indexOf(".")),jt="unavailable",Ut="unknown",It=[jt,Ut,"off"];function Lt(t){const e=Mt(t.entity_id),n=t.state;if(["button","input_button","scene"].includes(e))return n!==jt;if(It.includes(n))return!1;switch(e){case"cover":case"valve":return!["closed","closing"].includes(n);case"device_tracker":case"person":return"not_home"!==n;case"media_player":return"standby"!==n;case"vacuum":return!["idle","docked","paused"].includes(n);case"plant":return"problem"===n;default:return!0}}function Ht(t){return t.state!==jt}const Rt=(t,e)=>0!=(t.supported_features&e);Ct((t=>new Intl.Collator(t))),Ct((t=>new Intl.Collator(t,{sensitivity:"accent"})));const Ft=t=>(t=>Rt(t,4)&&"number"==typeof t.in_progress)(t)||!!t.in_progress,Bt=(t,e=2)=>{let n=""+t;for(let t=1;t<e;t++)n=parseInt(n)<10**t?`0${n}`:n;return n};const Vt={ms:1,s:1e3,min:6e4,h:36e5,d:864e5},Zt=(t,e)=>function(t){const e=Math.floor(t/1e3/3600),n=Math.floor(t/1e3%3600/60),r=Math.floor(t/1e3%3600%60),i=Math.floor(t%1e3);return e>0?`${e}:${Bt(n)}:${Bt(r)}`:n>0?`${n}:${Bt(r)}`:r>0||i>0?`${r}${i>0?`.${Bt(i,3)}`:""}`:null}(parseFloat(t)*Vt[e])||"0",Wt=(t,e,n)=>{const r=e?(t=>{switch(t.number_format){case $t.comma_decimal:return["en-US","en"];case $t.decimal_comma:return["de","es","it"];case $t.space_comma:return["fr","sv","cs"];case $t.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)!==$t.none&&!Number.isNaN(Number(t))&&Intl)try{return new Intl.NumberFormat(r,qt(t,n)).format(Number(t))}catch(e){return console.error(e),new Intl.NumberFormat(void 0,qt(t,n)).format(Number(t))}return"string"==typeof t?t:`${((t,e=2)=>Math.round(t*10**e)/10**e)(t,null==n?void 0:n.maximumFractionDigits).toString()}${"currency"===(null==n?void 0:n.style)?` ${n.currency}`:""}`},Yt=(t,e)=>{var n;const r=null==e?void 0:e.display_precision;return null!=r?{maximumFractionDigits:r,minimumFractionDigits:r}:Number.isInteger(Number(null===(n=t.attributes)||void 0===n?void 0:n.step))&&Number.isInteger(Number(t.state))?{maximumFractionDigits:0}:null!=t.attributes.step?{maximumFractionDigits:Math.ceil(Math.log10(1/t.attributes.step))}:void 0},qt=(t,e)=>{const n=Object.assign({maximumFractionDigits:2},e);if("string"!=typeof t)return n;if(!e||void 0===e.minimumFractionDigits&&void 0===e.maximumFractionDigits){const e=t.indexOf(".")>-1?t.split(".")[1].length:0;n.minimumFractionDigits=e,n.maximumFractionDigits=e}return n},Gt=t=>{switch(t.language){case"cz":case"de":case"fi":case"fr":case"sk":case"sv":return" ";default:return""}},Jt=(t,e,n,r,i,o)=>{const a=i[e.entity_id];return Kt(t,n,r,a,e.entity_id,e.attributes,void 0!==o?o:e.state)},Kt=(t,e,n,r,i,o,a)=>{var s;if(a===Ut||a===jt)return t(`state.default.${a}`);if((t=>!!t.unit_of_measurement||!!t.state_class)(o)){if("duration"===o.device_class&&o.unit_of_measurement&&Vt[o.unit_of_measurement])try{return Zt(a,o.unit_of_measurement)}catch(t){}if("monetary"===o.device_class)try{return Wt(a,e,Object.assign({style:"currency",currency:o.unit_of_measurement,minimumFractionDigits:2},Yt({state:a,attributes:o},r)))}catch(t){}const t=o.unit_of_measurement?"%"===o.unit_of_measurement?Gt(e)+"%":` ${o.unit_of_measurement}`:"";return`${Wt(a,e,Yt({state:a,attributes:o},r))}${t}`}const l=Mt(i);if("datetime"===l){const t=new Date(a);return Nt(t,e,n)}if(["date","input_datetime","time"].includes(l))try{const t=a.split(" ");if(2===t.length)return Nt(new Date(t.join("T")),Object.assign(Object.assign({},e),{time_zone:xt.local}),n);if(1===t.length){if(a.includes("-"))return((t,e,n)=>zt(e,n.time_zone).format(t))(new Date(`${a}T00:00`),Object.assign(Object.assign({},e),{time_zone:xt.local}),n);if(a.includes(":")){const t=new Date;return((t,e,n)=>Ot(e,n.time_zone).format(t))(new Date(`${t.toISOString().split("T")[0]}T${a}`),Object.assign(Object.assign({},e),{time_zone:xt.local}),n)}}return a}catch(t){return a}if("counter"===l||"number"===l||"input_number"===l)return Wt(a,e,Yt({state:a,attributes:o},r));if(["button","event","input_button","scene","stt","tts"].includes(l)||"sensor"===l&&"timestamp"===o.device_class)try{return Nt(new Date(a),e,n)}catch(t){return a}return"update"===l?"on"===a?Ft(o)?Rt(o,4)&&"number"==typeof o.in_progress?t("ui.card.update.installing_with_progress",{progress:o.in_progress}):t("ui.card.update.installing"):o.latest_version:o.skipped_version===o.latest_version?null!==(s=o.latest_version)&&void 0!==s?s:t("state.default.unavailable"):t("ui.card.update.up_to_date"):(null==r?void 0:r.translation_key)&&t(`component.${r.platform}.entity.${l}.${r.translation_key}.state.${a}`)||o.device_class&&t(`component.${l}.entity_component.${o.device_class}.state.${a}`)||t(`component.${l}.entity_component._.state.${a}`)||a};class Qt extends TypeError{constructor(t,e){let n;const{message:r,...i}=t,{path:o}=t;super(0===o.length?r:"At path: "+o.join(".")+" -- "+r),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var r;return null!=(r=n)?r:n=[t,...e()]}}}function Xt(t){return"object"==typeof t&&null!=t}function te(t){return"string"==typeof t?JSON.stringify(t):""+t}function ee(t,e,n,r){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});const{path:i,branch:o}=e,{type:a}=n,{refinement:s,message:l="Expected a value of type `"+a+"`"+(s?" with refinement `"+s+"`":"")+", but received: `"+te(r)+"`"}=t;return{value:r,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...t,message:l}}function*ne(t,e,n,r){(function(t){return Xt(t)&&"function"==typeof t[Symbol.iterator]})(t)||(t=[t]);for(const i of t){const t=ee(i,e,n,r);t&&(yield t)}}function*re(t,e,n){void 0===n&&(n={});const{path:r=[],branch:i=[t],coerce:o=!1,mask:a=!1}=n,s={path:r,branch:i};if(o&&(t=e.coercer(t,s),a&&"type"!==e.type&&Xt(e.schema)&&Xt(t)&&!Array.isArray(t)))for(const n in t)void 0===e.schema[n]&&delete t[n];let l=!0;for(const n of e.validator(t,s))l=!1,yield[n,void 0];for(let[n,c,u]of e.entries(t,s)){const e=re(c,u,{path:void 0===n?r:[...r,n],branch:void 0===n?i:[...i,c],coerce:o,mask:a});for(const r of e)r[0]?(l=!1,yield[r[0],void 0]):o&&(c=r[1],void 0===n?t=c:t instanceof Map?t.set(n,c):t instanceof Set?t.add(c):Xt(t)&&(t[n]=c))}if(l)for(const n of e.refiner(t,s))l=!1,yield[n,void 0];l&&(yield[void 0,t])}class ie{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:n,validator:r,refiner:i,coercer:o=(t=>t),entries:a=function*(){}}=t;this.type=e,this.schema=n,this.entries=a,this.coercer=o,this.validator=r?(t,e)=>ne(r(t,e),e,this,t):()=>[],this.refiner=i?(t,e)=>ne(i(t,e),e,this,t):()=>[]}assert(t){return oe(t,this)}create(t){return function(t,e){const n=ae(t,e,{coerce:!0});if(n[0])throw n[0];return n[1]}(t,this)}is(t){return function(t,e){const n=ae(t,e);return!n[0]}(t,this)}mask(t){return function(t,e){const n=ae(t,e,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}(t,this)}validate(t,e){return void 0===e&&(e={}),ae(t,this,e)}}function oe(t,e){const n=ae(t,e);if(n[0])throw n[0]}function ae(t,e,n){void 0===n&&(n={});const r=re(t,e,n),i=function(t){const{done:e,value:n}=t.next();return e?void 0:n}(r);if(i[0]){const t=new Qt(i[0],(function*(){for(const t of r)t[0]&&(yield t[0])}));return[t,void 0]}return[void 0,i[1]]}function se(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];const r="type"===e[0].type,i=e.map((t=>t.schema)),o=Object.assign({},...i);return r?_e(o):ge(o)}function le(t,e){return new ie({type:t,schema:null,validator:e})}function ce(){return le("any",(()=>!0))}function ue(t){return new ie({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[n,r]of e.entries())yield[n,r,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+te(t)})}function de(){return le("boolean",(t=>"boolean"==typeof t))}function he(t){const e={},n=t.map((t=>te(t))).join();for(const n of t)e[n]=n;return new ie({type:"enums",schema:e,validator:e=>t.includes(e)||"Expected one of `"+n+"`, but received: "+te(e)})}function me(t){const e=te(t),n=typeof t;return new ie({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?t:null,validator:n=>n===t||"Expected the literal `"+e+"`, but received: "+te(n)})}function pe(){return le("number",(t=>"number"==typeof t&&!isNaN(t)||"Expected a number, but received: "+te(t)))}function ge(t){const e=t?Object.keys(t):[],n=le("never",(()=>!1));return new ie({type:"object",schema:t||null,*entries(r){if(t&&Xt(r)){const i=new Set(Object.keys(r));for(const n of e)i.delete(n),yield[n,r[n],t[n]];for(const t of i)yield[t,r[t],n]}},validator:t=>Xt(t)||"Expected an object, but received: "+te(t),coercer:t=>Xt(t)?{...t}:t})}function fe(t){return new ie({...t,validator:(e,n)=>void 0===e||t.validator(e,n),refiner:(e,n)=>void 0===e||t.refiner(e,n)})}function ve(){return le("string",(t=>"string"==typeof t||"Expected a string, but received: "+te(t)))}function _e(t){const e=Object.keys(t);return new ie({type:"type",schema:t,*entries(n){if(Xt(n))for(const r of e)yield[r,n[r],t[r]]},validator:t=>Xt(t)||"Expected an object, but received: "+te(t)})}function be(t){const e=t.map((t=>t.type)).join(" | ");return new ie({type:"union",schema:null,coercer(e,n){const r=t.find((t=>{const[n]=t.validate(e,{coerce:!0});return!n}))||le("unknown",(()=>!0));return r.coercer(e,n)},validator(n,r){const i=[];for(const e of t){const[...t]=re(n,e,r),[o]=t;if(!o[0])return[];for(const[e]of t)e&&i.push(e)}return["Expected the value to satisfy a union of `"+e+"`, but received: "+te(n),...i]}})}function ye(t){const e=t.language||"en";return t.translationMetadata.translations[e]&&t.translationMetadata.translations[e].isRTL||!1}const $e=(t,e)=>{const n=(()=>{const t=document.body;if(t.querySelector("action-handler"))return t.querySelector("action-handler");const e=document.createElement("action-handler");return t.appendChild(e),e})();n&&n.bind(t,e)},we=gt(class extends ft{update(t,[e]){return $e(t.element,e),R}render(t){}});function xe(t){return void 0!==t&&"none"!==t.action}const Ae=ge({user:ve()}),ke=be([de(),ge({text:fe(ve()),excemptions:fe(ue(Ae))})]),Ee=ge({action:me("url"),url_path:ve(),confirmation:fe(ke)}),Se=ge({action:me("call-service"),service:ve(),service_data:fe(ge()),data:fe(ge()),target:fe(ge({entity_id:fe(be([ve(),ue(ve())])),device_id:fe(be([ve(),ue(ve())])),area_id:fe(be([ve(),ue(ve())]))})),confirmation:fe(ke)}),Ce=ge({action:me("navigate"),navigation_path:ve(),confirmation:fe(ke)}),ze=_e({action:me("assist"),pipeline_id:fe(ve()),start_listening:fe(de())}),Te=_e({action:me("fire-dom-event")}),Oe=ge({action:he(["none","toggle","more-info","call-service","url","navigate","assist"]),confirmation:fe(ke)}),Ne=(Pe=t=>{if(t&&"object"==typeof t&&"action"in t)switch(t.action){case"call-service":return Se;case"fire-dom-event":return Te;case"navigate":return Ce;case"url":return Ee;case"assist":return ze}return Oe},new ie({type:"dynamic",schema:null,*entries(t,e){const n=Pe(t,e);yield*n.entries(t,e)},validator:(t,e)=>Pe(t,e).validator(t,e),coercer:(t,e)=>Pe(t,e).coercer(t,e),refiner:(t,e)=>Pe(t,e).refiner(t,e)}));var Pe;function De(t){var e,n,r,i,o;return{layout:null!==(e=t.layout)&&void 0!==e?e:Me(t),fill_container:null!==(n=t.fill_container)&&void 0!==n&&n,primary_info:null!==(r=t.primary_info)&&void 0!==r?r:Ue(t),secondary_info:null!==(i=t.secondary_info)&&void 0!==i?i:Ie(t),icon_type:null!==(o=t.icon_type)&&void 0!==o?o:je(t)}}function Me(t){return t.vertical?"vertical":"default"}function je(t){return t.hide_icon?"none":t.use_entity_picture||t.use_media_artwork?"entity-picture":"icon"}function Ue(t){return t.hide_name?"none":"name"}function Ie(t){return t.hide_state?"none":"state"}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; |
|
} |
|
`;var Le={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?",custom_presets:{title:"Custom Presets",remove:"remove preset",add:"add preset"}},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"}}}},He={not_found:"Entity not found"},Re={editor:Le,card:He};const Fe={en:Object.freeze({__proto__:null,card:He,default:Re,editor:Le})};function Be(t,e){try{return t.split(".").reduce(((t,e)=>t[e]),Fe[e])}catch(t){return}}function Ve(t){return function(e){var n;let r=Be(e,null!==(n=null==t?void 0:t.locale.language)&&void 0!==n?n:"en");return r||(r=Be(e,"en")),null!=r?r:e}}const Ze=l` |
|
--default-red: 244, 67, 54; |
|
--default-pink: 233, 30, 99; |
|
--default-purple: 106, 107, 201; |
|
--default-deep-purple: 111, 66, 193; |
|
--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, 111, 0; |
|
--default-brown: 121, 85, 72; |
|
--default-light-grey: 189, 189, 189; |
|
--default-grey: 158, 158, 158; |
|
--default-dark-grey: 96, 96, 96; |
|
--default-blue-grey: 96, 125, 139; |
|
--default-black: 0, 0, 0; |
|
--default-white: 255, 255, 255; |
|
--default-disabled: 189, 189, 189; |
|
`,We=l` |
|
--default-disabled: 111, 111, 111; |
|
`,Ye=l` |
|
--spacing: var(--mush-spacing, 12px); |
|
|
|
/* Title */ |
|
--title-padding: var(--mush-title-padding, 24px 12px 8px); |
|
--title-spacing: var(--mush-title-spacing, 8px); |
|
--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, 32px); |
|
--title-color: var(--mush-title-color, var(--primary-text-color)); |
|
--title-letter-spacing: var(--mush-title-letter-spacing, -0.288px); |
|
--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, 24px); |
|
--subtitle-color: var(--mush-subtitle-color, var(--secondary-text-color)); |
|
--subtitle-letter-spacing: var(--mush-subtitle-letter-spacing, 0px); |
|
|
|
/* 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, 500); |
|
--card-secondary-font-weight: var(--mush-card-secondary-font-weight, 400); |
|
--card-primary-line-height: var(--mush-card-primary-line-height, 20px); |
|
--card-secondary-line-height: var(--mush-card-secondary-line-height, 16px); |
|
--card-primary-color: var(--mush-card-primary-color, var(--primary-text-color)); |
|
--card-secondary-color: var(--mush-card-secondary-color, var(--primary-text-color)); |
|
--card-primary-letter-spacing: var(--mush-card-primary-letter-spacing, 0.1px); |
|
--card-secondary-letter-spacing: var(--mush-card-secondary-letter-spacing, 0.4px); |
|
|
|
/* 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, 40px); |
|
--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, 40px); |
|
--icon-symbol-size: var(--mush-icon-symbol-size, 0.6em); |
|
`,qe=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-light-grey: var(--mush-rgb-light-grey, var(--default-light-grey)); |
|
--rgb-grey: var(--mush-rgb-grey, var(--default-grey)); |
|
--rgb-dark-grey: var(--mush-rgb-dark-grey, var(--default-dark-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)); |
|
`,Ge={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(Ge.pulse)} |
|
`,l` |
|
${s(Ge.spin)} |
|
`,l` |
|
${s(Ge.cleaning)} |
|
`,l` |
|
${s(Ge.returning)} |
|
`;const Je=l` |
|
${s(Object.values(Ge).join("\n"))} |
|
`;function Ke(t){return!!t&&t.themes.darkMode}class Qe extends at{updated(t){if(super.updated(t),t.has("hass")&&this.hass){const e=Ke(t.get("hass")),n=Ke(this.hass);e!==n&&this.toggleAttribute("dark-mode",n)}}static get styles(){return[Je,l` |
|
:host { |
|
${Ze} |
|
} |
|
:host([dark-mode]) { |
|
${We} |
|
} |
|
:host { |
|
${qe} |
|
${Ye} |
|
} |
|
`]}}e([dt({attribute:!1})],Qe.prototype,"hass",void 0);const Xe=["button","input_button","scene"],tn=["name","state","last-changed","last-updated","none"];function en(t,e,n,r,i){switch(t){case"name":return e;case"state":const t=r.entity_id.split(".")[0];return"timestamp"!==r.attributes.device_class&&!Xe.includes(t)||!Ht(r)||function(t){return t.state===Ut}(r)?n:H` |
|
<ha-relative-time |
|
.hass=${i} |
|
.datetime=${r.state} |
|
capitalize |
|
></ha-relative-time> |
|
`;case"last-changed":return H` |
|
<ha-relative-time |
|
.hass=${i} |
|
.datetime=${r.last_changed} |
|
capitalize |
|
></ha-relative-time> |
|
`;case"last-updated":return H` |
|
<ha-relative-time |
|
.hass=${i} |
|
.datetime=${r.last_updated} |
|
capitalize |
|
></ha-relative-time> |
|
`;case"none":return}}class nn extends Qe{constructor(){super(...arguments),this._inGrid=!1}get _stateObj(){if(!this._config||!this.hass||!this._config.entity)return;const t=this._config.entity;return this.hass.states[t]}get hasControls(){return!1}setConfig(t){this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t)}getGridSize(){const{grid_columns:t,grid_rows:e}=this.getLayoutOptions();return[t,e]}getCardSize(){var t;let e=1;if(!this._config)return e;const n=De(this._config);return"vertical"===n.layout&&(e+=1),"horizontal"===(null==n?void 0:n.layout)||!this.hasControls||"collapsible_controls"in this._config&&(null===(t=this._config)||void 0===t?void 0:t.collapsible_controls)||(e+=1),e}getLayoutOptions(){this._inGrid=!0;const t={grid_columns:2,grid_rows:1};if(!this._config)return t;const e=De(this._config);return"vertical"===e.layout&&(t.grid_rows+=1),"horizontal"===e.layout&&(t.grid_columns=4),"horizontal"!==(null==e?void 0:e.layout)&&this.hasControls&&(t.grid_rows+=1),t}renderPicture(t){return H` |
|
<mushroom-shape-avatar |
|
slot="icon" |
|
.picture_url=${this.hass.hassUrl(t)} |
|
></mushroom-shape-avatar> |
|
`}renderNotFound(t){const e=De(t),n=ye(this.hass),r=Ve(this.hass);return H` |
|
<ha-card class=${vt({"fill-container":e.fill_container})}> |
|
<mushroom-card .appearance=${e} ?rtl=${n}> |
|
<mushroom-state-item ?rtl=${n} .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=${r("card.not_found")} |
|
></mushroom-state-info> |
|
</mushroom-state-item> |
|
</mushroom-card> |
|
</ha-card> |
|
`}renderIcon(t,e){const n=Lt(t);return H` |
|
<mushroom-shape-icon slot="icon" .disabled=${!n}> |
|
<ha-state-icon |
|
.hass=${this.hass} |
|
.stateObj=${t} |
|
.state=${t} |
|
.icon=${e} |
|
></ha-state-icon |
|
></mushroom-shape-icon> |
|
`}renderBadge(t){return!Ht(t)?H` |
|
<mushroom-badge-icon |
|
class="unavailable" |
|
slot="badge" |
|
icon="mdi:help" |
|
></mushroom-badge-icon> |
|
`:F}renderStateInfo(t,e,n,r){const i=this.hass.formatEntityState?this.hass.formatEntityState(t):Jt(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities),o=null!=r?r:i,a=en(e.primary_info,n,o,t,this.hass),s=en(e.secondary_info,n,o,t,this.hass);return H` |
|
<mushroom-state-info |
|
slot="info" |
|
.primary=${a} |
|
.secondary=${s} |
|
></mushroom-state-info> |
|
`}}e([ht()],nn.prototype,"_config",void 0),e([dt({attribute:"in-grid",reflect:!0,type:Boolean})],nn.prototype,"_inGrid",void 0);const rn=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%; |
|
} |
|
:host([in-grid]) ha-card { |
|
height: 100%; |
|
} |
|
:host([in-grid]) ha-card mushroom-card { |
|
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; |
|
} |
|
.fill-container .actions { |
|
align-items: center; |
|
} |
|
`;const on="mushroom-fan-card-ex",an=`${on}-editor`,sn=["fan"];function ln(t){return null!=t.attributes.percentage?Math.round(t.attributes.percentage):void 0} |
|
/** |
|
* @license |
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved. |
|
* This code may only be used under the BSD style license found at |
|
* http://polymer.github.io/LICENSE.txt |
|
* The complete set of authors may be found at |
|
* http://polymer.github.io/AUTHORS.txt |
|
* The complete set of contributors may be found at |
|
* http://polymer.github.io/CONTRIBUTORS.txt |
|
* Code distributed by Google as part of the polymer project is also |
|
* subject to an additional IP rights grant found at |
|
* http://polymer.github.io/PATENTS.txt |
|
* This is ripped from lit-elements, needed ifdef, not just def |
|
*/let cn=class extends at{onChange(t){const e=t.detail.value;this.hass.callService("fan","set_percentage",{entity_id:this.entity.entity_id,percentage:e})}onCurrentChange(t){const e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}_onTap(t){var e,n;t.stopPropagation();const r=null===(n=null===(e=this.config.custom_presets)||void 0===e?void 0:e.find((e=>`fan-preset-${e.percentage}`===t.target.id)))||void 0===n?void 0:n.percentage;(0===r||r)&&(this.hass.callService("fan","set_percentage",{entity_id:this.entity.entity_id,percentage:r}),this.dispatchEvent(new CustomEvent("current-change",{detail:{value:r}})))}render(){var t;const e=Lt(this.entity),n=ln(this.entity);return H` |
|
${null===(t=this.config.custom_presets)||void 0===t?void 0:t.map((t=>{const r=e&&t.percentage===n;return H` |
|
<mushroom-button |
|
.disabled=${!Ht(this.entity)} |
|
@click=${this._onTap} |
|
class=${vt({active:r})} |
|
.id=${"fan-preset-"+t.percentage} |
|
> |
|
<ha-icon |
|
.icon=${t.icon||"mdi:fan"} |
|
></ha-icon> |
|
</mushroom-button>`}))} |
|
`}static get styles(){return l` |
|
:host { |
|
display: flex; |
|
} |
|
mushroom-button.active { |
|
--icon-color: rgb(var(--rgb-state-fan)); |
|
--bg-color: rgba(var(--rgb-state-fan), 0.2); |
|
} |
|
mushroom-button { |
|
flex: 1 |
|
} |
|
mushroom-button:not(:last-child) { |
|
margin-right: var(--spacing); |
|
} |
|
`}};var un;e([dt({attribute:!1})],cn.prototype,"hass",void 0),e([dt({attribute:!1})],cn.prototype,"entity",void 0),e([dt({attribute:!1})],cn.prototype,"config",void 0),cn=e([(un="mushroom-fan-preset-control",t=>"function"==typeof t?((t,e)=>(void 0!==window.customElements.get(t)||window.customElements.define(t,e),e))(un,t):((t,e)=>{const{kind:n,elements:r}=e;return{kind:n,elements:r,finisher(e){void 0===window.customElements.get(t)&&window.customElements.define(t,e)}}})(un,t))],cn),function(e){const n=window;n.customCards=n.customCards||[];const r=e.type.replace("-card","").replace("mushroom-","");n.customCards.push(Object.assign(Object.assign({},e),{preview:!0,documentationURL:`${t}/blob/main/docs/cards/${r}.md`}))}({type:on,name:"Mushroom Fan Card Extended",description:"Card for fan entity (with presets)"});let dn=class extends nn{static async getConfigElement(){return await Promise.resolve().then((function(){return wn})),document.createElement(an)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>sn.includes(t.split(".")[0])));return{type:`custom:${on}`,entity:e[0]}}get hasControls(){var t,e;return Boolean(null===(t=this._config)||void 0===t?void 0:t.show_percentage_control)||Boolean(null===(e=this._config)||void 0===e?void 0:e.show_oscillate_control)}setConfig(t){super.setConfig(Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)),this.updatePercentage()}updated(t){super.updated(t),this.hass&&t.has("hass")&&this.updatePercentage()}updatePercentage(){this.percentage=void 0;const t=this._stateObj;this._config&&this.hass&&t&&(this.percentage=ln(t))}onCurrentPercentageChange(t){null!=t.detail.value&&(this.percentage=Math.round(t.detail.value))}_handleAction(t){(async(t,e,n,r)=>{Dt(t,"hass-action",{config:n,action:r})})(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return F;const t=this._stateObj;if(!t)return this.renderNotFound(this._config);const e=this._config.name||t.attributes.friendly_name||"",n=this._config.icon,r=De(this._config),i=function(t,e){return"entity-picture"===e?function(t){return t.attributes.entity_picture_local||t.attributes.entity_picture}(t):void 0}(t,r.icon_type);let o=this.hass.formatEntityState?this.hass.formatEntityState(t):Jt(this.hass.localize,t,this.hass.locale,this.hass.config,this.hass.entities);null!=this.percentage&&"on"===t.state&&(o=`${this.percentage}${Gt(this.hass.locale)}%`);const a=ye(this.hass),s=(!this._config.collapsible_controls||Lt(t))&&(this._config.show_percentage_control||this._config.show_oscillate_control||this._config.custom_presets);return H` |
|
<ha-card class=${vt({"fill-container":r.fill_container})}> |
|
<mushroom-card .appearance=${r} ?rtl=${a}> |
|
<mushroom-state-item |
|
?rtl=${a} |
|
.appearance=${r} |
|
@action=${this._handleAction} |
|
.actionHandler=${we({hasHold:xe(this._config.hold_action),hasDoubleClick:xe(this._config.double_tap_action)})} |
|
> |
|
${i?this.renderPicture(i):this.renderIcon(t,n)} |
|
${this.renderBadge(t)} |
|
${this.renderStateInfo(t,r,e,o)}; |
|
</mushroom-state-item> |
|
${s?H` |
|
<div class="actions" ?rtl=${a}> |
|
${this._config.show_percentage_control?H` |
|
<mushroom-fan-percentage-control |
|
.hass=${this.hass} |
|
.entity=${t} |
|
@current-change=${this.onCurrentPercentageChange} |
|
></mushroom-fan-percentage-control> |
|
`:null} |
|
${this._config.show_oscillate_control?H` |
|
<mushroom-fan-oscillate-control |
|
.hass=${this.hass} |
|
.entity=${t} |
|
></mushroom-fan-oscillate-control> |
|
`:null} |
|
${this._config.custom_presets?H` |
|
<mushroom-fan-preset-control |
|
class="actions" |
|
?rtl=${a} |
|
.hass=${this.hass} |
|
.entity=${t} |
|
.config=${this._config} |
|
@current-change=${this.onCurrentPercentageChange} |
|
></mushroom-fan-preset-control> |
|
`:null} |
|
</div> |
|
`:null} |
|
</mushroom-card> |
|
</ha-card> |
|
`}renderIcon(t,e){var n;let r={};const i=ln(t),o=Lt(t);if(o)if(i){const t=1.5*(i/100)**.5;r["--animation-duration"]=1/t+"s"}else r["--animation-duration"]="1s";return H` |
|
<mushroom-shape-icon |
|
slot="icon" |
|
class=${vt({spin:o&&Boolean(null===(n=this._config)||void 0===n?void 0:n.icon_animation)})} |
|
style=${yt(r)} |
|
.disabled=${!o} |
|
> |
|
<ha-state-icon |
|
.hass=${this.hass} |
|
.stateObj=${t} |
|
.state=${t} |
|
.icon=${e} |
|
></ha-state-icon> |
|
</mushroom-shape-icon> |
|
`}static get styles(){return[super.styles,rn,l` |
|
mushroom-state-item { |
|
cursor: pointer; |
|
} |
|
mushroom-shape-icon { |
|
--icon-color: rgb(var(--rgb-state-fan)); |
|
--shape-color: rgba(var(--rgb-state-fan), 0.2); |
|
} |
|
.spin ha-state-icon { |
|
animation: var(--animation-duration) infinite linear spin; |
|
} |
|
mushroom-fan-percentage-control { |
|
flex: 1; |
|
} |
|
mushroom-fan-preset-control { |
|
flex: 1; |
|
} |
|
ha-card.fill-container { |
|
padding-left: 0; |
|
padding-right: var(--spacing); |
|
--icon-size: 36px; |
|
--spacing: 10px; |
|
} |
|
`]}};e([ht()],dn.prototype,"percentage",void 0),dn=e([lt(on)],dn),console.info("%c🍄 Mushroom-fan-card-ex addon 🍄 - requires Mushroom 3.5.4","color: #ef5350; font-weight: 700;");const hn=ge({tap_action:fe(Ne),hold_action:fe(Ne),double_tap_action:fe(Ne)}),mn=ge({layout:fe(be([me("horizontal"),me("vertical"),me("default")])),fill_container:fe(de()),primary_info:fe(he(tn)),secondary_info:fe(he(tn)),icon_type:fe(he(["icon","entity-picture","none"]))}),pn=["icon_color","layout","fill_container","primary_info","secondary_info","icon_type","content_info","use_entity_picture","collapsible_controls","icon_animation"],gn=ge({entity:fe(ve()),name:fe(ve()),icon:fe(ve())}),fn=se(ge({index:fe(pe()),view_index:fe(pe()),view_layout:ce(),type:ve(),layout_options:ce()}),se(gn,mn,hn),ge({icon_animation:fe(de()),show_percentage_control:fe(de()),show_oscillate_control:fe(de()),collapsible_controls:fe(de()),custom_presets:fe(ue(ge({percentage:le("integer",(t=>"number"==typeof t&&!isNaN(t)&&Number.isInteger(t)||"Expected an integer, but received: "+te(t))),icon:fe(ve())})))})),vn=["icon_animation","show_percentage_control","show_oscillate_control","custom_presets"],_n=[{name:"entity",selector:{entity:{domain:sn}}},{name:"name",selector:{text:{}}},{type:"grid",name:"",schema:[{name:"icon",selector:{icon:{}},context:{icon_entity:"entity"}},{name:"icon_animation",selector:{boolean:{}}}]},{type:"grid",name:"",schema:[{name:"layout",selector:{mush_layout:{}}},{name:"fill_container",selector:{boolean:{}}}]},{type:"grid",name:"",schema:[{name:"primary_info",selector:{mush_info:{}}},{name:"secondary_info",selector:{mush_info:{}}},{name:"icon_type",selector:{mush_icon_type:{}}}]},{type:"grid",name:"",schema:[{name:"show_percentage_control",selector:{boolean:{}}},{name:"show_oscillate_control",selector:{boolean:{}}},{name:"collapsible_controls",selector:{boolean:{}}}]},{name:"tap_action",selector:{"ui-action":{actions:bn}}},{name:"hold_action",selector:{"ui-action":{actions:bn}}},{name:"double_tap_action",selector:{"ui-action":{actions:bn}}}];var bn;const yn=[{type:"grid",name:"",schema:[{name:"icon",selector:{icon:{placeholder:"mdi:fan"}}},{name:"percentage",selector:{number:{min:0,max:100,step:1,mode:"box",unit_of_measurement:"%"}}}]}];let $n=class extends Qe{constructor(){super(...arguments),this._customLocalize=Ve(this.hass),this._computeLabel=t=>{const e=Ve(this.hass);return pn.includes(t.name)?e(`editor.card.generic.${t.name}`):vn.includes(t.name)?e(`editor.card.fan.${t.name}`):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}}connectedCallback(){var t,e,n;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(),customElements.get("ha-card-conditions-editor")||null===(n=customElements.get("hui-conditional-card"))||void 0===n||n.getConfigElement()}setConfig(t){oe(t,fn),this._config=t}render(){var t;return this.hass&&this._config?H` |
|
<ha-form |
|
.hass=${this.hass} |
|
.data=${this._config} |
|
.schema=${_n} |
|
.computeLabel=${this._computeLabel} |
|
@value-changed=${this._valueChanged} |
|
></ha-form> |
|
<div class="root"> |
|
<h3>${this._customLocalize("editor.card.fan.custom_presets.title")}</h3> |
|
${null===(t=this._config.custom_presets)||void 0===t?void 0:t.map(((t,e)=>H` |
|
<div class="custom-preset-row"> |
|
<ha-form |
|
.hass=${this.hass} |
|
.data=${t} |
|
.schema=${yn} |
|
.computeLabel=${this._computeLabel} |
|
@value-changed=${this._presetValueChanged} |
|
.index=${e} |
|
></ha-form> |
|
<ha-icon-button |
|
.label=${this._customLocalize("editor.card.fan.custom_presets.remove")} |
|
.path=${"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"} |
|
class="remove-icon" |
|
.index=${e} |
|
@click=${this._removeRow} |
|
> |
|
</ha-icon-button> |
|
</div> |
|
`))} |
|
<ha-icon-button |
|
.label=${this._customLocalize("editor.card.fan.custom_presets.add")} |
|
.path=${"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"} |
|
class="plus-icon" |
|
@click=${this._addRow} |
|
></ha-icon-button> |
|
</div> |
|
`:F}_removeRow(t){const e=t.currentTarget.index,n=this._config.custom_presets.concat();n.splice(e,1),this._config.custom_presets=0===n.length?void 0:n,Dt(this,"config-changed",{config:this._config})}_addRow(){const t=(this._config.custom_presets||[]).concat();t.push({icon:"mdi:fan",percentage:100}),this._config.custom_presets=t,Dt(this,"config-changed",{config:this._config})}_valueChanged(t){Dt(this,"config-changed",{config:t.detail.value})}_presetValueChanged(t){const e=t.currentTarget.index,n=this._config.custom_presets.concat();n[e]=Object.assign({},t.detail.value),n[e].percentage||(n[e].percentage=0),this._config.custom_presets=n,Dt(this,"config-changed",{config:this._config})}static get styles(){return[l` |
|
.remove-icon, |
|
.plus-icon { |
|
--mdc-icon-button-size: 36px; |
|
color: var(--secondary-text-color); |
|
} |
|
.custom-preset-row { |
|
display: flex; |
|
gap: 8px; |
|
margin-bottom: 16px; |
|
} |
|
.custom-preset-row ha-form { |
|
flex: 1 |
|
} |
|
.custom-preset-row ha-icon-button, |
|
.custom-preset-row button { |
|
flex-shrink: 1; |
|
flex-basis: 0%; |
|
} |
|
`]}};e([ht()],$n.prototype,"_config",void 0),$n=e([lt(an)],$n);var wn=Object.freeze({__proto__:null,get FanCardEditor(){return $n}});export{dn as FanCard}; |