Files
HomeAssistantVS/www/community/lovelace-multiple-entity-row/multiple-entity-row.js
T

2 lines
101 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*! For license information please see multiple-entity-row.js.LICENSE.txt */
(()=>{"use strict";const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),i=new WeakMap;class r{constructor(t,e,i){if(this._$cssResult$=!0,i!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const n=this.t;if(e&&void 0===t){const e=void 0!==n&&1===n.length;e&&(t=i.get(n)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&i.set(n,t))}return t}toString(){return this.cssText}}const o=(t,...e)=>{const i=1===t.length?t[0]:e.reduce((e,n,i)=>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[i+1],t[0]);return new r(i,t,n)},a=(n,i)=>{if(e)n.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of i){const i=document.createElement("style"),r=t.litNonce;void 0!==r&&i.setAttribute("nonce",r),i.textContent=e.cssText,n.appendChild(i)}},s=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return(t=>new r("string"==typeof t?t:t+"",void 0,n))(e)})(t):t,{is:c,defineProperty:l,getOwnPropertyDescriptor:u,getOwnPropertyNames:f,getOwnPropertySymbols:d,getPrototypeOf:h}=Object,p=globalThis,m=p.trustedTypes,y=m?m.emptyScript:"",v=p.reactiveElementPolyfillSupport,b=(t,e)=>t,g={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let 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}},_=(t,e)=>!c(t,e),w={attribute:!0,type:String,converter:g,reflect:!1,useDefault:!1,hasChanged:_};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;class O extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=w){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(t,n,e);void 0!==i&&l(this.prototype,t,i)}}static getPropertyDescriptor(t,e,n){const{get:i,set:r}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const o=i?.call(this);r?.call(this,e),this.requestUpdate(t,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??w}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const t=h(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const t=this.properties,e=[...f(t),...d(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}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(s(t))}else void 0!==t&&e.push(s(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return a(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$ET(t,e){const n=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==n.converter?.toAttribute?n.converter:g).toAttribute(e,n.type);this._$Em=t,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(t,e){const n=this.constructor,i=n._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=n.getPropertyOptions(i),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:g;this._$Em=i;const o=r.fromAttribute(e,t.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(t,e,n,i=!1,r){if(void 0!==t){const o=this.constructor;if(!1===i&&(r=this[t]),n??=o.getPropertyOptions(t),!((n.hasChanged??_)(r,e)||n.useDefault&&n.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,n))))return;this.C(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:n,reflect:i,wrapped:r},o){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==r||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||n||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t){const{wrapped:t}=n,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,n,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}O.elementStyles=[],O.shadowRootOptions={mode:"open"},O[b("elementProperties")]=new Map,O[b("finalized")]=new Map,v?.({ReactiveElement:O}),(p.reactiveElementVersions??=[]).push("2.1.2");const S=globalThis,A=t=>t,j=S.trustedTypes,$=j?j.createPolicy("lit-html",{createHTML:t=>t}):void 0,x="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,E="?"+k,C=`<${E}>`,P=document,T=()=>P.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,I=Array.isArray,R=t=>I(t)||"function"==typeof t?.[Symbol.iterator],H="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,F=/-->/g,N=/>/g,U=RegExp(`>|${H}(?:([^\\s"'>=/]+)(${H}*=${H}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),L=/'/g,V=/"/g,z=/^(?:script|style|textarea|title)$/i,B=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),W=B(1),q=(B(2),B(3),Symbol.for("lit-noChange")),Z=Symbol.for("lit-nothing"),G=new WeakMap,J=P.createTreeWalker(P,129);function K(t,e){if(!I(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==$?$.createHTML(e):e}const Y=(t,e)=>{const n=t.length-1,i=[];let r,o=2===e?"<svg>":3===e?"<math>":"",a=D;for(let e=0;e<n;e++){const n=t[e];let s,c,l=-1,u=0;for(;u<n.length&&(a.lastIndex=u,c=a.exec(n),null!==c);)u=a.lastIndex,a===D?"!--"===c[1]?a=F:void 0!==c[1]?a=N:void 0!==c[2]?(z.test(c[2])&&(r=RegExp("</"+c[2],"g")),a=U):void 0!==c[3]&&(a=U):a===U?">"===c[0]?(a=r??D,l=-1):void 0===c[1]?l=-2:(l=a.lastIndex-c[2].length,s=c[1],a=void 0===c[3]?U:'"'===c[3]?V:L):a===V||a===L?a=U:a===F||a===N?a=D:(a=U,r=void 0);const f=a===U&&t[e+1].startsWith("/>")?" ":"";o+=a===D?n+C:l>=0?(i.push(s),n.slice(0,l)+x+n.slice(l)+k+f):n+k+(-2===l?e:f)}return[K(t,o+(t[n]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class Q{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let r=0,o=0;const a=t.length-1,s=this.parts,[c,l]=Y(t,e);if(this.el=Q.createElement(c,n),J.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=J.nextNode())&&s.length<a;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(x)){const e=l[o++],n=i.getAttribute(t).split(k),a=/([.?@])?(.*)/.exec(e);s.push({type:1,index:r,name:a[2],strings:n,ctor:"."===a[1]?it:"?"===a[1]?rt:"@"===a[1]?ot:nt}),i.removeAttribute(t)}else t.startsWith(k)&&(s.push({type:6,index:r}),i.removeAttribute(t));if(z.test(i.tagName)){const t=i.textContent.split(k),e=t.length-1;if(e>0){i.textContent=j?j.emptyScript:"";for(let n=0;n<e;n++)i.append(t[n],T()),J.nextNode(),s.push({type:2,index:++r});i.append(t[e],T())}}}else if(8===i.nodeType)if(i.data===E)s.push({type:2,index:r});else{let t=-1;for(;-1!==(t=i.data.indexOf(k,t+1));)s.push({type:7,index:r}),t+=k.length-1}r++}}static createElement(t,e){const n=P.createElement("template");return n.innerHTML=t,n}}function X(t,e,n=t,i){if(e===q)return e;let r=void 0!==i?n._$Co?.[i]:n._$Cl;const o=M(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),void 0===o?r=void 0:(r=new o(t),r._$AT(t,n,i)),void 0!==i?(n._$Co??=[])[i]=r:n._$Cl=r),void 0!==r&&(e=X(t,r._$AS(t,e.values),r,i)),e}class tt{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){const{el:{content:e},parts:n}=this._$AD,i=(t?.creationScope??P).importNode(e,!0);J.currentNode=i;let r=J.nextNode(),o=0,a=0,s=n[0];for(;void 0!==s;){if(o===s.index){let e;2===s.type?e=new et(r,r.nextSibling,this,t):1===s.type?e=new s.ctor(r,s.name,s.strings,this,t):6===s.type&&(e=new at(r,this,t)),this._$AV.push(e),s=n[++a]}o!==s?.index&&(r=J.nextNode(),o++)}return J.currentNode=P,i}p(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 et{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,i){this.type=2,this._$AH=Z,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=X(this,t,e),M(t)?t===Z||null==t||""===t?(this._$AH!==Z&&this._$AR(),this._$AH=Z):t!==this._$AH&&t!==q&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):R(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==Z&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=Q.createElement(K(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new tt(i,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new Q(t)),e}k(t){I(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,i=0;for(const r of t)i===e.length?e.push(n=new et(this.O(T()),this.O(T()),this,this.options)):n=e[i],n._$AI(r),i++;i<e.length&&(this._$AR(n&&n._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=A(t).nextSibling;A(t).remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class nt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,i,r){this.type=1,this._$AH=Z,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Z}_$AI(t,e=this,n,i){const r=this.strings;let o=!1;if(void 0===r)t=X(this,t,e,0),o=!M(t)||t!==this._$AH&&t!==q,o&&(this._$AH=t);else{const i=t;let a,s;for(t=r[0],a=0;a<r.length-1;a++)s=X(this,i[n+a],e,a),s===q&&(s=this._$AH[a]),o||=!M(s)||s!==this._$AH[a],s===Z?t=Z:t!==Z&&(t+=(s??"")+r[a+1]),this._$AH[a]=s}o&&!i&&this.j(t)}j(t){t===Z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class it extends nt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Z?void 0:t}}class rt extends nt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Z)}}class ot extends nt{constructor(t,e,n,i,r){super(t,e,n,i,r),this.type=5}_$AI(t,e=this){if((t=X(this,t,e,0)??Z)===q)return;const n=this._$AH,i=t===Z&&n!==Z||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,r=t!==Z&&(n===Z||i);i&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class at{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){X(this,t)}}const st={M:x,P:k,A:E,C:1,L:Y,R:tt,D:R,V:X,I:et,H:nt,N:rt,U:ot,B:it,F:at},ct=S.litHtmlPolyfillSupport;ct?.(Q,et),(S.litHtmlVersions??=[]).push("3.3.3");const lt=globalThis;class ut extends O{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,n)=>{const i=n?.renderBefore??e;let r=i._$litPart$;if(void 0===r){const t=n?.renderBefore??null;i._$litPart$=r=new et(e.insertBefore(T(),t),t,void 0,n??{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return q}}ut._$litElement$=!0,ut.finalized=!0,lt.litElementHydrateSupport?.({LitElement:ut});const ft=lt.litElementPolyfillSupport;ft?.({LitElement:ut}),(lt.litElementVersions??=[]).push("4.2.2");var dt=["unavailable","unknown"],ht="last-changed",pt="last-updated",mt=["relative","total","date","time","datetime"],yt=["entity-id","last-changed","last-updated","last-triggered","position","tilt-position","brightness"];function vt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o,a,s=[],c=!0,l=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=o.call(n)).done)&&(s.push(i.value),s.length!==e);c=!0);}catch(t){l=!0,r=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw r}}return s}}(t,e)||bt(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bt(t,e){if(t){if("string"==typeof t)return gt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gt(t,e):void 0}}function gt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}var _t=customElements,wt=new Map,Ot=0,St=!1,At=function(t){try{if(customElements===_t)return;var e,n=[],i=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=bt(t))){e&&(t=e);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return o=t.done,t},e:function(t){a=!0,r=t},f:function(){try{o||null==e.return||e.return()}finally{if(a)throw r}}}}(wt);try{for(i.s();!(e=i.n()).done;){var r=vt(e.value,2),o=r[0],a=r[1];if(customElements.get(o))wt.delete(o);else try{customElements.define(o,a),n.push(o),wt.delete(o)}catch(t){console.warn("multiple-entity-row: re-defining ".concat(o," after registry swap failed"),t)}}}catch(t){i.e(t)}finally{i.f()}n.length&&console.info("multiple-entity-row: re-defined ".concat(n.join(", ")," after customElements registry swap, caught by ").concat(t," (frontend#52960)"))}catch(t){console.warn("multiple-entity-row: customElements registry check failed",t)}},jt=function(){wt.size&&(Ot>=30?wt.clear():(Ot+=1,setTimeout(function(){At("fallback poll"),jt()},1e3)))},$t=function(t,e){try{if(_t.get(t))return void console.warn("multiple-entity-row: ".concat(t," is already defined - a duplicate resource entry or stale cached copy loaded first"));_t.define(t,e)}catch(e){return void console.warn("multiple-entity-row: defining ".concat(t," failed"),e)}wt.set(t,e),St||(St=!0,_t.whenDefined("home-assistant").then(function(){return At("ha-boot signal")}).catch(function(){}),jt())};function xt(t){return xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xt(t)}var kt=function(t){return"object"===xt(t)&&!Array.isArray(t)&&!!t},Et=function(t,e){if(kt(t)&&void 0!==e&&Object.prototype.hasOwnProperty.call(t,e)){var n=t[e];return null==n||""===n?void 0:n}},Ct=function(t,e,n){var i=new Event(e,{bubbles:!0,composed:!0});i.detail=n,t.dispatchEvent(i)},Pt=function(t){return!t||dt.includes(t.state)},Tt=function(t,e,n){if(function(t,e){return e.hide_unavailable&&(Pt(t)||e.attribute&&![ht,pt].includes(e.attribute)&&void 0===t.attributes[e.attribute])}(t,e))return!0;if(void 0===e.hide_if)return!1;if("boolean"==typeof e.hide_if)return e.hide_if;var i;if(kt(e.hide_if)&&(e.hide_if.entity||e.hide_if.attribute)){var r=e.hide_if.entity?null==n?void 0:n.states[e.hide_if.entity]:t;i=e.hide_if.attribute?null==r?void 0:r.attributes[e.hide_if.attribute]:null==r?void 0:r.state}else i=e.attribute?t.attributes[e.attribute]:t.state;var o=[];if(kt(e.hide_if)){if(e.hide_if.below&&i<e.hide_if.below)return!0;if(e.hide_if.above&&i>e.hide_if.above)return!0;e.hide_if.value&&(o=o.concat(e.hide_if.value))}else o=o.concat(e.hide_if);return o.some(function(t){return"number"==typeof t?t===+i:t===i})},Mt=["formatEntityName","formatEntityState","formatEntityAttributeValue"],It=new Set(["primary","accent","red","pink","purple","deep-purple","indigo","blue","light-blue","cyan","teal","green","light-green","lime","yellow","amber","orange","deep-orange","brown","light-grey","grey","dark-grey","blue-grey","black","white","primary-text","secondary-text","disabled"]),Rt=function(t){return It.has(t)?"var(--".concat(t,"-color)"):t},Ht=function(t,e){var n=Et(t.state_color,e);return void 0===n?void 0:Rt(String(n))},Dt=function(t){var e;return null!==(e=t.color)&&void 0!==e?e:"boolean"==typeof t.state_color?t.state_color?"state":"none":void 0},Ft=function(t,e,n){var i;if(void 0!==Ht(t,n))return{stateColor:!1};var r=null!==(i=Dt(t))&&void 0!==i?i:t.icon_color||!e?void 0:Dt(e);return void 0===r?t.icon_color?{stateColor:!1}:{stateColor:!0}:"state"===r?{stateColor:!0}:"none"===r?{stateColor:!1}:{cssColor:Rt(r)}},Nt=function(t){return t<10?"0".concat(t):t};function Ut(t){var e=Math.floor(t/3600),n=Math.floor(t%3600/60),i=Math.floor(t%3600%60);return e>0?"".concat(e,":").concat(Nt(n),":").concat(Nt(i)):n>0?"".concat(n,":").concat(Nt(i)):i>0?""+i:null}function Lt(t){return Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lt(t)}function Vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function zt(t,e,n){return(e=function(t){var e=function(t){if("object"!=Lt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Lt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Lt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Bt=function(t,e,n){var i=e?function(t){switch(t.number_format){case"comma_decimal":return["en-US","en"];case"decimal_comma":return["de","es","it"];case"space_comma":return["fr","sv","cs"];case"system":return;default:return t.language}}(e):void 0;if(Number.isNaN=Number.isNaN||function t(e){return"number"==typeof e&&t(e)},"none"!==(null==e?void 0:e.number_format)&&!Number.isNaN(Number(t))&&Intl)try{return new Intl.NumberFormat(i,Wt(t,n)).format(Number(t))}catch(e){return console.error(e),new Intl.NumberFormat(void 0,Wt(t,n)).format(Number(t))}return"string"==typeof t?t:"".concat(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return Math.round(t*Math.pow(10,e))/Math.pow(10,e)}(t,null==n?void 0:n.maximumFractionDigits).toString()).concat("currency"===(null==n?void 0:n.style)?" ".concat(n.currency):"")},Wt=function(t,e){var n=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Vt(Object(n),!0).forEach(function(e){zt(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Vt(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({maximumFractionDigits:2},e);if("string"!=typeof t)return n;if(!e||!e.minimumFractionDigits&&!e.maximumFractionDigits){var i=t.indexOf(".")>-1?t.split(".")[1].length:0;n.minimumFractionDigits=i,n.maximumFractionDigits=i}return n};function qt(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Xt(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Zt(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Yt(i.key),i)}}function Gt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function Jt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Gt(Object(n),!0).forEach(function(e){Kt(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gt(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Kt(t,e,n){return(e=Yt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Yt(t){var e=function(t){if("object"!=ee(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ee(e)?e:e+""}function Qt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o,a,s=[],c=!0,l=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=o.call(n)).done)&&(s.push(i.value),s.length!==e);c=!0);}catch(t){l=!0,r=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw r}}return s}}(t,e)||Xt(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xt(t,e){if(t){if("string"==typeof t)return te(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?te(t,e):void 0}}function te(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function ee(t){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ee(t)}var ne=function(t){return"string"==typeof t&&(t.includes("{{")||t.includes("{%"))},ie=function(t){return!!ne(t)||(Array.isArray(t)?t.some(ie):!!kt(t)&&Object.values(t).some(ie))},re=function(t){return ne(t.hide_if)?t.hide_if:kt(t.hide_if)&&ne(t.hide_if.template)?t.hide_if.template:void 0},oe=["true","yes","on","1"],ae=function(t){return null==t?"":"object"===ee(t)?JSON.stringify(t):String(t)},se=function(t,e){return"".concat(null!=e?e:"","|").concat(t)},ce=/^\{\{((?:(?!\}\})[^])*)\}\}$/,le=function(t){return kt(t)?Object.entries(t).map(function(t){var e=Qt(t,2);return function(t,e){if("string"==typeof e&&ne(e)){var n=ce.exec(e.trim());return n?"{% set ".concat(t," = ").concat(n[1].trim()," %}"):"{% set ".concat(t," %}").concat(e,"{% endset %}")}return"{% set ".concat(t," = ").concat(null==e?"none":JSON.stringify(e)," %}")}(e[0],e[1])}).join(""):""},ue=["tap_action","hold_action","double_tap_action"],fe=function(t,e){ne(t)?e(t):Array.isArray(t)?t.forEach(function(t){return fe(t,e)}):kt(t)&&Object.values(t).forEach(function(t){return fe(t,e)})},de=function(t,e){return Jt(Jt({},kt(t.vars)?t.vars:{}),e&&kt(e.vars)?e.vars:{})},he=function(t,e,n,i){return ae(t.get(se(le(i)+e,n)))},pe=function(){return function(t,e){return e&&Zt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Kt(this,"hass",void 0),Kt(this,"connected",!1),Kt(this,"requests",new Map),Kt(this,"unsubs",new Map),Kt(this,"errors",new Map),Kt(this,"results",new Map),Kt(this,"notify",void 0),this.notify=e},[{key:"setConfig",value:function(t){this.requests=new Map(function(t){var e,n=[],i=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";ne(t)&&n.push({template:i+t,entity:e})},r=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";i(t.name,e,n),i(t.icon,e,n),i(t.icon_color,e,n),i(t.color,e,n),i(t.template,e,n),i(re(t),e,n),kt(t.styles)&&fe(t.styles,function(t){return i(t,e,n)}),ue.forEach(function(r){return fe(t[r],function(t){return i(t,e,n)})})},o=t.entity;if(r(t,o,le(de(t))),"string"==typeof t.secondary_info)i(t.secondary_info,o,le(de(t)));else if(kt(t.secondary_info)){var a,s=t.secondary_info;r(s,null!==(a=s.entity)&&void 0!==a?a:o,le(de(t,s)))}return null===(e=t.entities)||void 0===e||e.forEach(function(e){if(kt(e)){var n,i=e;r(i,null!==(n=i.entity)&&void 0!==n?n:o,le(de(t,i)))}}),n}(t).map(function(t){return[se(t.template,t.entity),t]})),this.sync()}},{key:"setHass",value:function(t){var e,n=!(null===(e=this.hass)||void 0===e||!e.connection);this.hass=t,!n&&null!=t&&t.connection&&this.sync()}},{key:"connect",value:function(){this.connected=!0,this.sync()}},{key:"disconnect",value:function(){this.connected=!1,this.sync()}},{key:"sync",value:function(){var t,e,n=qt(this.unsubs);try{for(n.s();!(e=n.n()).done;){var i=Qt(e.value,2),r=i[0],o=i[1];this.connected&&this.requests.has(r)||(this.unsubs.delete(r),this.requests.has(r)||(this.results.delete(r),this.errors.delete(r)),o.then(function(t){return null==t?void 0:t()}).catch(function(){}))}}catch(t){n.e(t)}finally{n.f()}if(this.connected&&null!==(t=this.hass)&&void 0!==t&&t.connection){var a,s=qt(this.requests);try{for(s.s();!(a=s.n()).done;){var c=Qt(a.value,2),l=c[0],u=c[1];this.unsubs.has(l)||this.unsubs.set(l,this.subscribe(l,u))}}catch(t){s.e(t)}finally{s.f()}}}},{key:"subscribe",value:function(t,e){var n=this;return this.hass.connection.subscribeMessage(function(e){return n.onMessage(t,e)},{type:"render_template",template:e.template,variables:{entity:e.entity},report_errors:!0}).catch(function(t){return console.warn("multiple-entity-row: template subscription failed:",e.template,t),null})}},{key:"onMessage",value:function(t,e){this.unsubs.has(t)&&(void 0!==e.error?(this.errors.get(t)!==e.error&&(this.errors.set(t,e.error),console.warn("multiple-entity-row: template error:",e.error)),this.results.set(t,"")):(this.errors.delete(t),this.results.set(t,e.result)),this.notify(new Map(this.results)))}}])}();function me(t){return me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},me(t)}function ye(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function ve(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ye(Object(n),!0).forEach(function(e){be(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ye(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function be(t,e,n){return(e=function(t){var e=function(t){if("object"!=me(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=me(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==me(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ge(t,e){if(t){if("string"==typeof t)return _e(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_e(t,e):void 0}}function _e(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}var we,Oe=function(t){if("string"==typeof t&&""===t)throw new Error("Entity ID string must not be blank.");if("string"!=typeof t&&!kt(t))throw new Error("Entity config must be a valid entity ID string or entity object.")},Se=function(t){return"string"==typeof t&&t.includes(".")?t.split(".")[1].length:void 0},Ae=["precision","kilo","mega","milli"],je=/^(precision|kilo|mega|milli)(\d+)?$/,$e=function(t){var e=je.exec(t);return!e||"precision"===e[1]&&void 0===e[2]?null:e},xe=/^(brightness|percent|invert|position|celsius_to_fahrenheit|fahrenheit_to_celsius|kilo\d*|mega\d*|milli\d*|precision\d+)$/,ke=["upper","lower","capitalize","title"],Ee=function(t){return t?"--paper-item-icon-color: ".concat(t,"; --mdc-icon-color: ").concat(t,"; --state-icon-color: ").concat(t,";"):""},Ce=function(t){var e=null;if("number"==typeof t&&Number.isFinite(t))e="".concat(t,"px");else if("string"==typeof t&&""!==t.trim()&&!ne(t)){var n=t.trim();e=/^\d+(\.\d+)?$/.test(n)?"".concat(n,"px"):n}return null===e?"":"--multiple-entity-row-name-gap: ".concat(e,";")},Pe=function(t,e){return Et(e.state_icon,t.state)},Te=function(t,e){return!1===e.name?null:e.name||(e.entity?t.attributes.friendly_name||(n=t.entity_id).substr(n.indexOf(".")+1):null)||null;var n},Me=function(t){return"string"==typeof t?t.replace(/(\d)%/,"$1​%"):t},Ie=function(t,e,n){if(Pt(e))return t.formatEntityState(e);var i,r=n.attribute?e.attributes[n.attribute]:e.state,o=!1===n.unit?void 0:void 0!==n.attribute?n.unit:n.unit||e.attributes.unit_of_measurement,a="string"==typeof(i=n.format)?i.split(",").map(function(t){return t.trim()}).filter(Boolean):[];if(a.length>1&&a.every(function(t){return xe.test(t)})){var s=r??0;return!isNaN(parseFloat(s))&&isFinite(s)?function(t,e,n,i){var r,o,a=parseFloat(e),s=Se(e),c=!1,l=function(t){c||(s=void 0,r=t)},u=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=ge(t))){e&&(t=e);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return o=t.done,t},e:function(t){a=!0,r=t},f:function(){try{o||null==e.return||e.return()}finally{if(a)throw r}}}}(t);try{for(u.s();!(o=u.n()).done;){var f=o.value,d=je.exec(f);if(d&&"precision"===d[1])s=parseInt(d[2],10),r=void 0,c=!0;else if(d)a/={kilo:1e3,mega:1e6,milli:.001}[d[1]],void 0!==d[2]?(s=parseInt(d[2],10),r=void 0,c=!0):l(2);else switch(f){case"brightness":a=Math.round(a/255*100),n="%",l(0);break;case"percent":a*=100,n="%",l(2);break;case"invert":a=-a;break;case"position":a=100-a;break;case"celsius_to_fahrenheit":a=1.8*a+32,l(0);break;case"fahrenheit_to_celsius":a=5*(a-32)/9,l(1)}}}catch(t){u.e(t)}finally{u.f()}return"".concat(Bt(a,i,void 0!==s?{minimumFractionDigits:s,maximumFractionDigits:s}:void 0!==r?{maximumFractionDigits:r}:void 0)).concat(n?" ".concat(n):"")}(a,s,o,t.locale):"".concat(s).concat(o?" ".concat(o):"")}if(n.format&&!function(t){return Ae.some(function(e){return null==t?void 0:t.startsWith(e)})&&!$e(t)}(n.format)){if(null==r&&(r=ke.includes(n.format)?"":0),ke.includes(n.format))return"".concat(function(t,e){switch(t){case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();case"capitalize":return e.charAt(0).toUpperCase()+e.slice(1);case"title":return e.split(/(\s+)/).map(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}).join("")}}(n.format,String(r))).concat(o?" ".concat(o):"");if(isNaN(parseFloat(r))||!isFinite(r));else if("brightness"===n.format)r=Math.round(r/255*100),o="%";else if("percent"===n.format)r=Bt(100*r,t.locale,{maximumFractionDigits:2}),o="%";else if("duration"===n.format){var c;r=null!==(c=Ut(r))&&void 0!==c?c:"0",o=void 0}else if("duration-m"===n.format){var l;r=null!==(l=Ut(r/1e3))&&void 0!==l?l:"0",o=void 0}else if("duration-h"===n.format){var u;r=null!==(u=Ut(3600*r))&&void 0!==u?u:"0",o=void 0}else if($e(n.format)){var f=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o,a,s=[],c=!0,l=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=o.call(n)).done)&&(s.push(i.value),s.length!==e);c=!0);}catch(t){l=!0,r=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw r}}return s}}(t,e)||ge(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}($e(n.format),3),d=f[1],h=f[2];if("precision"===d){var p=parseInt(h,10);r=Bt(parseFloat(r),t.locale,{minimumFractionDigits:p,maximumFractionDigits:p})}else r=function(t,e,n,i){if(void 0===n)return Bt(t/e,i,{maximumFractionDigits:2});var r=parseInt(n,10);return Bt(t/e,i,{minimumFractionDigits:r,maximumFractionDigits:r})}(r,{kilo:1e3,mega:1e6,milli:.001}[d],h,t.locale)}else if("invert"===n.format){var m=Se(r);r=Bt(r-2*r,t.locale,void 0!==m?{minimumFractionDigits:m,maximumFractionDigits:m}:void 0)}else if("position"===n.format){var y=Se(r);r=Bt(100-r,t.locale,void 0!==y?{minimumFractionDigits:y,maximumFractionDigits:y}:void 0)}else"celsius_to_fahrenheit"===n.format?r=Bt(1.8*r+32,t.locale,{maximumFractionDigits:0}):"fahrenheit_to_celsius"===n.format&&(r=Bt(5*(r-32)/9,t.locale,{maximumFractionDigits:1}));return"".concat(r).concat(o?" ".concat(o):"")}var v=ve(ve({},e),{},{attributes:ve(ve({},e.attributes),{},{unit_of_measurement:o})});if(void 0!==n.unit&&!n.attribute){if(!isNaN(parseFloat(r))&&isFinite(r)){var b,g=null===(b=t.entities)||void 0===b||null===(b=b[e.entity_id])||void 0===b?void 0:b.display_precision,_=Bt(r,t.locale,null!=g?{minimumFractionDigits:g,maximumFractionDigits:g}:void 0);return"".concat(_).concat(o?" ".concat(o):"")}return"".concat(t.formatEntityState(e)).concat(o?" ".concat(o):"")}if(n.attribute){if(void 0!==n.unit){var w=null==r?"":isNaN(r)?r:Bt(r,t.locale);return"".concat(w).concat(o?" ".concat(o):"")}return Me(t.formatEntityAttributeValue(v,n.attribute))}return Me(t.formatEntityState(v))},Re=function(t){return kt(null==t?void 0:t.styles)?Object.keys(t.styles).filter(function(e){return""!==t.styles[e]&&null!=t.styles[e]}).map(function(e){return"".concat(e,": ").concat(t.styles[e],";")}).join(""):""};class He{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{I:De}=st,Fe={},Ne=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends He{constructor(){super(...arguments),this.key=Z}render(t,e){return this.key=t,e}update(t,[e,n]){return e!==this.key&&(((t,e=Fe)=>{t._$AH=e})(t),this.key=e),n}});var Ue,Le,Ve,ze,Be,We,qe,Ze,Ge,Je,Ke,Ye,Qe,Xe,tn,en,nn,rn="__custom__",on=[{value:"",label:"No format"},{value:"brightness",label:"Brightness (0-255 → %)"},{value:"percent",label:"Percent (value × 100 → x %)"},{value:"duration",label:"Duration (seconds → h:mm:ss)"},{value:"duration-m",label:"Duration (milliseconds)"},{value:"duration-h",label:"Duration (hours)"},{value:"precision0",label:"Precision 0 decimals"},{value:"precision1",label:"Precision 1 decimal"},{value:"precision2",label:"Precision 2 decimals"},{value:"precision3",label:"Precision 3 decimals"},{value:"kilo",label:"Kilo (value / 1,000)"},{value:"mega",label:"Mega (value / 1,000,000)"},{value:"milli",label:"Milli (value × 1,000)"},{value:"invert",label:"Invert (value × -1)"},{value:"position",label:"Position (100 - value)"},{value:"celsius_to_fahrenheit",label:"°C → °F"},{value:"fahrenheit_to_celsius",label:"°F → °C"},{value:"upper",label:"Text: UPPERCASE"},{value:"lower",label:"Text: lowercase"},{value:"capitalize",label:"Text: Capitalize first letter"},{value:"title",label:"Text: Title Case"},{value:"relative",label:"Timestamp: relative"},{value:"total",label:"Timestamp: total"},{value:"date",label:"Timestamp: date"},{value:"time",label:"Timestamp: time"},{value:"datetime",label:"Timestamp: date + time"},{value:rn,label:"Custom…"}],an=new Set(on.map(function(t){return t.value}).filter(function(t){return t&&t!==rn})),sn=[{name:"entity",required:!0,selector:{entity:{}}},{type:"grid",schema:[{name:"name",selector:{text:{}}},{name:"attribute",selector:{text:{}}}]},{type:"grid",schema:[{name:"unit",selector:{text:{}}},{name:"icon",selector:{icon:{}}}]},{name:"icon_color",selector:{text:{}}},{name:"name_gap",selector:{text:{}}},{type:"grid",schema:[{name:"show_state",default:!0,selector:{boolean:{}}},{name:"color",selector:{ui_color:{include_state:!0,include_none:!0}}}]},{type:"grid",schema:[{name:"toggle",selector:{boolean:{}}},{name:"column",selector:{boolean:{}}}]},{type:"grid",schema:[{name:"show_state_first",selector:{boolean:{}}},{name:"hide_unavailable",selector:{boolean:{}}},{name:"wrap",selector:{boolean:{}}}]},{name:"state_header",selector:{text:{}}},{name:"image",selector:{text:{}}},{name:"format",selector:{select:{mode:"dropdown",options:on}}}],cn=[{name:"tap_action",selector:{ui_action:{default_action:"more-info"}}},{name:"hold_action",selector:{ui_action:{default_action:"none"}}},{name:"double_tap_action",selector:{ui_action:{default_action:"none"}}}],ln=[{name:"entity",selector:{entity:{}}},{type:"grid",schema:[{name:"name",selector:{text:{}}},{name:"attribute",selector:{text:{}}}]},{type:"grid",schema:[{name:"unit",selector:{text:{}}},{name:"icon",selector:{icon:{}}}]},{name:"icon_color",selector:{text:{}}},{type:"grid",schema:[{name:"color",selector:{ui_color:{include_state:!0,include_none:!0}}},{name:"toggle",selector:{boolean:{}}}]},{name:"hide_unavailable",selector:{boolean:{}}},{name:"format",selector:{select:{mode:"dropdown",options:on}}}],un={entity:"Entity",attribute:"Attribute",name:"Name override (or false to hide)",unit:"Unit (or false to hide)",icon:"Icon",icon_color:"Icon color (CSS value, e.g. red, #ff0000, var(--my-color))",name_gap:"Icon → name gap (CSS length, e.g. 8px; default 16px)",image:"Image URL",format:"Format",show_state:"Show main entity state",show_state_first:"State before entities",state_header:"State header label",color:"Icon color",state_color:"State color",column:"Column layout",wrap:"Wrap instead of overflowing",toggle:"Show as toggle",hide_unavailable:"Hide if unavailable",tap_action:"Tap action",hold_action:"Hold action",double_tap_action:"Double-tap action"};function fn(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function dn(t){return function(t){if(Array.isArray(t))return An(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Sn(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hn(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,_n(i.key),i)}}function pn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(pn=function(){return!!t})()}function mn(t){return mn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mn(t)}function yn(t,e){return yn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yn(t,e)}function vn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function bn(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?vn(Object(n),!0).forEach(function(e){gn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vn(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function gn(t,e,n){return(e=_n(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _n(t){var e=function(t){if("object"!=jn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=jn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==jn(e)?e:e+""}function wn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Sn(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function On(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o,a,s=[],c=!0,l=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=o.call(n)).done)&&(s.push(i.value),s.length!==e);c=!0);}catch(t){l=!0,r=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw r}}return s}}(t,e)||Sn(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sn(t,e){if(t){if("string"==typeof t)return An(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?An(t,e):void 0}}function An(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function jn(t){return jn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jn(t)}var $n="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",xn="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",kn="M19,20H5V4H7V7H17V4H19M12,2A1,1 0 0,1 13,3A1,1 0 0,1 12,4A1,1 0 0,1 11,3A1,1 0 0,1 12,2M19,2H14.82C14.4,0.84 13.3,0 12,0C10.7,0 9.6,0.84 9.18,2H5A2,2 0 0,0 3,4V20A2,2 0 0,0 5,22H19A2,2 0 0,0 21,20V4A2,2 0 0,0 19,2Z",En=[{name:"mode",selector:{select:{mode:"dropdown",options:[{value:"none",label:"None"},{value:"text",label:"Custom text"},{value:"generic",label:"HA built-in token"},{value:"entity",label:"Entity-based"}]}}}],Cn=[{name:"token",selector:{select:{mode:"dropdown",options:yt.map(function(t){return{value:t,label:t}})}}}],Pn=[{name:"text",selector:{text:{multiline:!0}}}],Tn=[{type:"grid",schema:[{name:"state",selector:{text:{}}},{name:"icon",selector:{icon:{}}}]}],Mn=function(t){return"state"===t.name?"State":"icon"===t.name?"Icon":t.name},In=function(t){var e={};if(!t)return e;var n,i=wn(t.split("\n"));try{for(i.s();!(n=i.n()).done;){var r=n.value.trim();if(r&&!r.startsWith("#")){var o=r.indexOf(":");if(!(o<1)){var a=r.slice(0,o).trim(),s=r.slice(o+1).trim();(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1)),a&&s&&(e[a]=s)}}}}catch(t){i.e(t)}finally{i.f()}return e},Rn=["unit","name"],Hn=function(t){return Rn.reduce(function(t,e){return!1===t[e]?bn(bn({},t),{},gn({},e,"false")):t},t)},Dn=function(t){return Rn.reduce(function(t,e){return"false"===t[e]?bn(bn({},t),{},gn({},e,!1)):t},t)},Fn="multipleEntityRowClipboard",Nn=["entity","name","attribute","unit","icon","icon_color","state_icon","state_color","toggle","hide_unavailable","format","tap_action","styles"],Un=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),gn(t=function(t,e,n){return e=mn(e),function(t,e){if(e&&("object"==jn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,pn()?Reflect.construct(e,n||[],mn(t).constructor):e.apply(t,n))}(this,e),"_keys",new Map),gn(t,"_onEntitiesExpandedChanged",function(e){var n=e.target;"boolean"==typeof(null==n?void 0:n.expanded)&&(t._entitiesExpanded=n.expanded)}),gn(t,"_computeLabel",function(t){var e;return null!==(e=un[t.name])&&void 0!==e?e:t.name}),gn(t,"_onTabShow",function(e){var n,i=null===(n=e.detail)||void 0===n?void 0:n.name;if(null!=i){var r=parseInt(i,10);Number.isNaN(r)||r===t._selectedTab||(t._selectedTab=r)}}),gn(t,"_mainValueChanged",function(e){if(t._config){var n=Dn(bn({},e.detail.value));!0===(n=t._formatFromForm("main",n,t._config.format)).show_state&&delete n.show_state,Ct(t,"config-changed",{config:n})}}),gn(t,"_additionalValueChanged",function(e,n){var i;if(t._config){var r=dn(null!==(i=t._config.entities)&&void 0!==i?i:[]),o=r[n],a=kt(o)?o.format:void 0;r[n]=t._formatFromForm("sub-".concat(n),Dn(e.detail.value),a),t._updateConfig({entities:r})}}),gn(t,"_addEntity",function(){var e;if(t._config){var n=[].concat(dn(null!==(e=t._config.entities)&&void 0!==e?e:[]),[{}]);t._selectedTab=n.length,t._keys.clear(),t._updateConfig({entities:n})}}),gn(t,"_deleteAdditional",function(e){var n;if(t._config){var i=dn(null!==(n=t._config.entities)&&void 0!==n?n:[]);i.splice(e,1),t._selectedTab>i.length&&(t._selectedTab=i.length),t._keys.clear(),t._updateConfig({entities:i.length?i:void 0})}}),gn(t,"_moveAdditional",function(e,n){var i;if(t._config){var r=dn(null!==(i=t._config.entities)&&void 0!==i?i:[]),o=e+n;if(!(o<0||o>=r.length)){var a=[r[o],r[e]];r[e]=a[0],r[o]=a[1],t._selectedTab=o+1,t._keys.clear(),t._updateConfig({entities:r})}}}),gn(t,"_copyAdditional",function(e){var n,i=null===(n=t._config)||void 0===n||null===(n=n.entities)||void 0===n?void 0:n[e];null!=i&&t._writeClipboard("string"==typeof i?{entity:i}:bn({},i))}),gn(t,"_cutAdditional",function(e){t._copyAdditional(e),t._deleteAdditional(e)}),gn(t,"_copyMainAsTemplate",function(){if(t._config){var e,n={},i=wn(Nn);try{for(i.s();!(e=i.n()).done;){var r=e.value,o=t._config[r];void 0!==o&&(n[r]=o)}}catch(t){i.e(t)}finally{i.f()}t._writeClipboard(n)}}),gn(t,"_pasteEntity",function(){var e;if(t._config){var n=t._readClipboard();if(n){var i=[].concat(dn(null!==(e=t._config.entities)&&void 0!==e?e:[]),[n]);t._selectedTab=i.length,t._keys.clear(),t._updateConfig({entities:i})}}}),gn(t,"_secondaryModeChanged",function(e){if(t._config){var n=e.detail.value.mode;if(n!==t._secondaryInfoMode()){var i;switch(n){case"none":i=void 0;break;case"text":i="";break;case"generic":i="last-changed";break;case"entity":i={entity:t._config.entity}}t._updateConfig({secondary_info:i})}}}),gn(t,"_secondaryTextChanged",function(e){t._updateConfig({secondary_info:e.detail.value.text})}),gn(t,"_secondaryTokenChanged",function(e){t._updateConfig({secondary_info:e.detail.value.token})}),gn(t,"_secondaryEntityChanged",function(e){var n,i=kt(null===(n=t._config)||void 0===n?void 0:n.secondary_info)?t._config.secondary_info.format:void 0;t._updateConfig({secondary_info:t._formatFromForm("secondary",Dn(e.detail.value),i)})}),t._selectedTab=0,t._entitiesExpanded=!0,t._stateIconRowsMain=[],t._stateIconRowsAdditional=new Map,t._customFormatScopes=new Set,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&yn(t,e)}(e,t),function(t,e,n){return e&&hn(t.prototype,e),n&&hn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setConfig",value:function(t){var e,n,i,r=this;if(ie(t))throw new Error("This row uses templates - edit it in the code (YAML) editor.");this._config=t;var o,a=null!==(e=null===(n=t.entities)||void 0===n?void 0:n.length)&&void 0!==e?e:0;this._selectedTab>a&&(this._selectedTab=a),this._clipboardEntity=this._readClipboard(),this._stateIconRowsMatch(this._stateIconRowsMain,t.state_icon)||(this._stateIconRowsMain=Object.entries(null!==(o=t.state_icon)&&void 0!==o?o:{}));var s=new Map;null===(i=t.entities)||void 0===i||i.forEach(function(t,e){var n=kt(t)?t.state_icon:void 0,i=r._stateIconRowsAdditional.get(e);i&&r._stateIconRowsMatch(i,n)?s.set(e,i):n&&s.set(e,Object.entries(n))}),this._stateIconRowsAdditional=s}},{key:"_stateIconRowsMatch",value:function(t,e){var n,i={},r=wn(t);try{for(r.s();!(n=r.n()).done;){var o=On(n.value,2),a=o[0],s=o[1];a.trim()&&s.trim()&&(i[a.trim()]=s.trim())}}catch(t){r.e(t)}finally{r.f()}var c=null!=e?e:{},l=Object.keys(i);return l.length===Object.keys(c).length&&l.every(function(t){return i[t]===c[t]})}},{key:"_readClipboard",value:function(){try{var t=sessionStorage.getItem(Fn);if(!t)return;var e=JSON.parse(t);if(e&&"object"===jn(e))return e}catch(t){}}},{key:"_writeClipboard",value:function(t){try{sessionStorage.setItem(Fn,JSON.stringify(t)),this._clipboardEntity=t}catch(t){}}},{key:"_hasNativeTabs",get:function(){return!!customElements.get("ha-tab-group")&&!!customElements.get("ha-tab-group-tab")}},{key:"render",value:function(){return this.hass&&this._config?W(Ue||(Ue=fn(["\n <ha-expansion-panel\n .header=","\n outlined\n ?expanded=","\n @expanded-changed=","\n >\n ",'\n </ha-expansion-panel>\n\n <div class="footer">v'," · ","</div>\n "])),"Entities",this._entitiesExpanded,this._onEntitiesExpandedChanged,this._renderEntitiesPanel(),"4.11.1","2026-09-02T21:15:15.588Z"):Z}},{key:"_isCustomFormat",value:function(t,e){return this._customFormatScopes.has(t)||!!e&&!an.has(e)}},{key:"_setCustomFormatScope",value:function(t,e){if(e!==this._customFormatScopes.has(t)){var n=new Set(this._customFormatScopes);e?n.add(t):n.delete(t),this._customFormatScopes=n}}},{key:"_formatToForm",value:function(t,e){return this._isCustomFormat(t,e.format)?bn(bn({},e),{},{format:rn}):e}},{key:"_formatFromForm",value:function(t,e,n){if(e.format===rn){this._setCustomFormatScope(t,!0);var i=bn({},e);return void 0!==n?i.format=n:delete i.format,i}return this._setCustomFormatScope(t,!1),e}},{key:"_renderCustomFormatField",value:function(t,e,n){return this._isCustomFormat(t,e)?W(Le||(Le=fn(["\n <ha-form\n .hass=","\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n "])),this.hass,{custom_format:null!=e?e:""},[{name:"custom_format",selector:{text:{}}}],function(){return"Custom format (e.g. invert, precision3)"},function(t){var e,i=(null!==(e=t.detail.value.custom_format)&&void 0!==e?e:"").trim();n(i||void 0)}):Z}},{key:"_keyFor",value:function(t){return this._keys.has(t)||this._keys.set(t,"".concat(t,"-").concat(Math.random().toString(36).slice(2,10))),this._keys.get(t)}},{key:"_renderEntitiesPanel",value:function(){var t,e,n=this,i=null!==(t=null===(e=this._config)||void 0===e?void 0:e.entities)&&void 0!==t?t:[],r=Math.min(this._selectedTab,i.length);return W(Ve||(Ve=fn(['\n <div class="panel-content">\n <div class="tabs-row">\n ','\n <ha-icon-button\n class="tabs__add"\n .label=',"\n .path=","\n @click=",'\n ></ha-icon-button>\n </div>\n\n <div id="mer-tab-panel" role="tabpanel">\n ',"\n </div>\n </div>\n "])),this._hasNativeTabs?W(ze||(ze=fn(['\n <ha-tab-group class="tabs" @wa-tab-show=','>\n <ha-tab-group-tab slot="nav" .panel='," .active=",">\n Main\n </ha-tab-group-tab>\n ","\n </ha-tab-group>\n "])),this._onTabShow,0,0===r,i.map(function(t,e){return W(Be||(Be=fn(['\n <ha-tab-group-tab slot="nav" .panel='," .active=",">\n ","\n </ha-tab-group-tab>\n "])),e+1,r===e+1,e+1)})):W(We||(We=fn(['\n <div class="tab-bar--fallback" role="tablist">\n <button\n type="button"\n class=','\n role="tab"\n aria-selected=','\n aria-controls="mer-tab-panel"\n @click=',"\n >\n Main\n </button>\n ","\n </div>\n "])),"tab "+(0===r?"tab--active":""),0===r?"true":"false",function(){return n._selectedTab=0},i.map(function(t,e){return W(qe||(qe=fn(['\n <button\n type="button"\n class=','\n role="tab"\n aria-selected=','\n aria-controls="mer-tab-panel"\n @click=',"\n >\n ","\n </button>\n "])),"tab "+(r===e+1?"tab--active":""),r===e+1?"true":"false",function(){return n._selectedTab=e+1},e+1)})),"Add entity","M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",this._addEntity,Ne(this._keyFor(r),0===r?this._renderMainTab():this._renderAdditionalTab(r-1)))}},{key:"_renderMainTab",value:function(){var t,e,n=this;return W(Ze||(Ze=fn(['\n <div class="child-actions">\n <ha-icon-button\n .label=',"\n .path=","\n @click=","\n ></ha-icon-button>\n <ha-icon-button\n .label=","\n .path=","\n .disabled=","\n @click=",'\n ></ha-icon-button>\n </div>\n <div class="child-editor">\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n ",'\n <div class="section-label">Interactions</div>\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=",'\n ></ha-form>\n <div class="section-label">Secondary info</div>\n ','\n <div class="section-label">State-based icons</div>\n ','\n <div class="section-label">Custom CSS</div>\n ',"\n </div>\n "])),"Copy main as template",xn,this._copyMainAsTemplate,"Paste as new entity",kn,!this._clipboardEntity,this._pasteEntity,this.hass,this._mainFormData(),sn,this._computeLabel,this._mainValueChanged,this._renderCustomFormatField("main",null===(t=this._config)||void 0===t?void 0:t.format,function(t){return n._updateConfig({format:t})}),this.hass,this._mainFormData(),cn,this._computeLabel,this._mainValueChanged,this._renderSecondaryInfoBlock(),this._renderStateIconRows("main"),this._renderStylesBlock(null===(e=this._config)||void 0===e?void 0:e.styles,function(t){return n._mainStylesChanged(t)}))}},{key:"_renderStylesBlock",value:function(t,e){return W(Ge||(Ge=fn(['\n <ha-code-editor\n mode="yaml"\n autocomplete-entities\n autocomplete-icons\n .hass=',"\n .value=","\n @value-changed=","\n ></ha-code-editor>\n "])),this.hass,!(n=t)||"object"!==jn(n)||Array.isArray(n)?"":Object.entries(n).filter(function(t){return null!=On(t,2)[1]}).map(function(t){var e=On(t,2),n=e[0],i=e[1];return"".concat(n,": ").concat(i)}).join("\n"),e);var n}},{key:"_mainStylesChanged",value:function(t){if(this._config){var e=In(t.detail.value);this._updateConfig({styles:Object.keys(e).length>0?e:void 0})}}},{key:"_additionalStylesChanged",value:function(t,e){var n;if(this._config){var i=In(t.detail.value),r=dn(null!==(n=this._config.entities)&&void 0!==n?n:[]),o=r[e],a="string"==typeof o?{entity:o}:bn({},o);Object.keys(i).length>0?a.styles=i:delete a.styles,r[e]=a,this._updateConfig({entities:r})}}},{key:"_stateIconRowsFor",value:function(t){var e;return"main"===t?this._stateIconRowsMain:null!==(e=this._stateIconRowsAdditional.get(t))&&void 0!==e?e:[]}},{key:"_setStateIconRows",value:function(t,e){if("main"===t)this._stateIconRowsMain=e;else{var n=new Map(this._stateIconRowsAdditional);n.set(t,e),this._stateIconRowsAdditional=n}var i,r={},o=wn(e);try{for(o.s();!(i=o.n()).done;){var a=On(i.value,2),s=a[0],c=a[1];s.trim()&&c.trim()&&(r[s.trim()]=c.trim())}}catch(t){o.e(t)}finally{o.f()}var l=Object.keys(r).length>0?r:void 0;if(this._config)if("main"===t)this._updateConfig({state_icon:l});else{var u,f=dn(null!==(u=this._config.entities)&&void 0!==u?u:[]),d=f[t],h="string"==typeof d?{entity:d}:bn({},d);l?h.state_icon=l:delete h.state_icon,f[t]=h,this._updateConfig({entities:f})}}},{key:"_renderStateIconRows",value:function(t){var e=this,n=this._stateIconRowsFor(t);return W(Je||(Je=fn(['\n <div class="state-icon-rows">\n ','\n <button\n type="button"\n class="state-icon-add"\n @click=',"\n >\n + Add state\n </button>\n </div>\n "])),n.map(function(i,r){return W(Ke||(Ke=fn(['\n <div class="state-icon-row">\n <ha-form\n class="state-icon-form"\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n <ha-icon-button\n .label=","\n .path=","\n @click=","\n ></ha-icon-button>\n </div>\n "])),e.hass,{state:i[0],icon:i[1]},Tn,Mn,function(i){var o=i.detail.value,a=n.map(function(t,e){var n,i;return e===r?[null!==(n=o.state)&&void 0!==n?n:"",null!==(i=o.icon)&&void 0!==i?i:""]:t});e._setStateIconRows(t,a)},"Remove",$n,function(){return e._setStateIconRows(t,n.filter(function(t,e){return e!==r}))})}),function(){return e._setStateIconRows(t,[].concat(dn(n),[["",""]]))})}},{key:"_renderAdditionalTab",value:function(t){var e,n,i=this,r=this._config.entities[t],o="string"==typeof r?{entity:r}:r,a=(null!==(e=null===(n=this._config)||void 0===n||null===(n=n.entities)||void 0===n?void 0:n.length)&&void 0!==e?e:1)-1;return W(Ye||(Ye=fn(['\n <div class="child-actions">\n <ha-icon-button\n .label=',"\n .path=","\n .disabled=","\n @click=","\n ></ha-icon-button>\n <ha-icon-button\n .label=","\n .path=","\n .disabled=","\n @click=","\n ></ha-icon-button>\n <ha-icon-button\n .label=","\n .path=","\n @click=","\n ></ha-icon-button>\n <ha-icon-button\n .label=","\n .path=","\n @click=","\n ></ha-icon-button>\n <ha-icon-button\n .label=","\n .path=","\n .disabled=","\n @click=","\n ></ha-icon-button>\n <ha-icon-button\n .label=","\n .path=","\n @click=",'\n ></ha-icon-button>\n </div>\n <div class="child-editor">\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n ",'\n <div class="section-label">Interactions</div>\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=",'\n ></ha-form>\n <div class="section-label">State-based icons</div>\n ','\n <div class="section-label">Custom CSS</div>\n ',"\n </div>\n "])),"Move before","M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",0===t,function(){return i._moveAdditional(t,-1)},"Move after","M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",t===a,function(){return i._moveAdditional(t,1)},"Copy entity",xn,function(){return i._copyAdditional(t)},"Cut entity","M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z",function(){return i._cutAdditional(t)},"Paste from clipboard",kn,!this._clipboardEntity,this._pasteEntity,"Delete entity",$n,function(){return i._deleteAdditional(t)},this.hass,this._formatToForm("sub-".concat(t),Hn(o)),ln,this._computeLabel,function(e){return i._additionalValueChanged(e,t)},this._renderCustomFormatField("sub-".concat(t),o.format,function(e){return i._setAdditionalFormat(t,e)}),this.hass,this._formatToForm("sub-".concat(t),Hn(o)),cn,this._computeLabel,function(e){return i._additionalValueChanged(e,t)},this._renderStateIconRows(t),this._renderStylesBlock(o.styles,function(e){return i._additionalStylesChanged(e,t)}))}},{key:"_mainFormData",value:function(){return this._formatToForm("main",Hn(bn({show_state:!0},this._config)))}},{key:"_setAdditionalFormat",value:function(t,e){var n;if(this._config){var i=dn(null!==(n=this._config.entities)&&void 0!==n?n:[]),r=i[t],o="string"==typeof r?{entity:r}:bn({},r);e?o.format=e:delete o.format,i[t]=o,this._updateConfig({entities:i})}}},{key:"_secondaryInfoMode",value:function(){var t,e=null===(t=this._config)||void 0===t?void 0:t.secondary_info;return null==e?"none":"object"===jn(e)?"entity":yt.includes(e)?"generic":"text"}},{key:"_renderSecondaryInfoBlock",value:function(){var t,e=this,n=this._secondaryInfoMode(),i=null===(t=this._config)||void 0===t?void 0:t.secondary_info;return W(Qe||(Qe=fn(["\n <div>\n <ha-form\n .hass=","\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n ","\n ","\n ","\n </div>\n "])),this.hass,{mode:n},En,function(){return"Mode"},this._secondaryModeChanged,"text"===n?W(Xe||(Xe=fn(['<div class="secondary-sub-form">\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n </div>"])),this.hass,{text:null!=i?i:""},Pn,function(){return"Custom text"},this._secondaryTextChanged):Z,"generic"===n?W(tn||(tn=fn(['<div class="secondary-sub-form">\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n </div>"])),this.hass,{token:i},Cn,function(){return"HA built-in"},this._secondaryTokenChanged):Z,"entity"===n?W(en||(en=fn(['<div class="secondary-sub-form">\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n ","\n </div>"])),this.hass,this._formatToForm("secondary",Hn(i)),ln,this._computeLabel,this._secondaryEntityChanged,this._renderCustomFormatField("secondary",i.format,function(t){return e._updateConfig({secondary_info:bn(bn({},i),{},{format:t})})})):Z)}},{key:"_updateConfig",value:function(t){if(this._config){for(var e=bn({},this._config),n=0,i=Object.entries(t);n<i.length;n++){var r=On(i[n],2),o=r[0],a=r[1];void 0===a?delete e[o]:e[o]=a}Ct(this,"config-changed",{config:e})}}}],[{key:"properties",get:function(){return{hass:{attribute:!1},_config:{state:!0},_selectedTab:{state:!0},_entitiesExpanded:{state:!0},_clipboardEntity:{state:!0},_stateIconRowsMain:{state:!0},_stateIconRowsAdditional:{state:!0},_customFormatScopes:{state:!0}}}}])}(ut);gn(Un,"styles",o(nn||(nn=fn(["\n ha-expansion-panel {\n display: block;\n margin-top: 12px;\n }\n .panel-content {\n padding: 12px 0;\n }\n .tabs-row {\n display: flex;\n align-items: center;\n gap: 4px;\n border-bottom: 1px solid var(--divider-color, #e0e0e0);\n margin-bottom: 8px;\n }\n ha-tab-group.tabs {\n flex: 1;\n min-width: 0;\n }\n .tab-bar--fallback {\n display: flex;\n flex: 1;\n gap: 4px;\n overflow-x: auto;\n }\n .tab-bar--fallback .tab {\n padding: 8px 12px;\n cursor: pointer;\n border: 1px solid transparent;\n border-bottom: none;\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n white-space: nowrap;\n color: var(--secondary-text-color);\n background: transparent;\n font: inherit;\n }\n .tab-bar--fallback .tab--active {\n background: var(--card-background-color);\n border-color: var(--divider-color);\n color: var(--primary-text-color);\n }\n .tabs__add {\n flex: 0 0 auto;\n }\n .child-actions {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 4px 0 8px;\n }\n .child-actions ha-icon-button[disabled] {\n opacity: 0.4;\n pointer-events: none;\n }\n .child-editor {\n border: 1px solid var(--divider-color, #e0e0e0);\n border-radius: 8px;\n padding: 8px;\n background: var(--card-background-color);\n }\n .secondary-sub-form {\n margin-top: 8px;\n }\n .state-icon-rows {\n margin-top: 4px;\n }\n .state-icon-row {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 8px;\n }\n .state-icon-row .state-icon-form {\n flex: 1;\n min-width: 0;\n }\n .state-icon-row ha-icon-button {\n flex: 0 0 auto;\n }\n .state-icon-add {\n margin-top: 4px;\n padding: 6px 14px;\n background: transparent;\n border: 1px dashed var(--divider-color, #e0e0e0);\n border-radius: 4px;\n color: var(--primary-color);\n cursor: pointer;\n font: inherit;\n }\n .state-icon-add:hover {\n background: var(--secondary-background-color);\n }\n .section-label {\n margin-top: 16px;\n margin-bottom: 4px;\n font-size: 12px;\n font-weight: 500;\n color: var(--secondary-text-color);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n }\n .footer {\n margin-top: 16px;\n padding-top: 8px;\n border-top: 1px solid var(--divider-color, #e0e0e0);\n font-size: 11px;\n color: var(--secondary-text-color);\n text-align: right;\n }\n "])))),$t("multiple-entity-row-editor",Un);var Ln,Vn,zn=function(t){if(t.attributes.remaining){if("active"===t.state){var e=new Date(t.attributes.finishes_at).getTime();return Math.max((e-Date.now())/1e3,0)}return 3600*(n=t.attributes.remaining.split(":").map(Number))[0]+60*n[1]+n[2];var n}};function Bn(t){return Bn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bn(t)}function Wn(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function qn(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Zn(i.key),i)}}function Zn(t){var e=function(t){if("object"!=Bn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Bn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Bn(e)?e:e+""}function Gn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Gn=function(){return!!t})()}function Jn(t,e,n,i){var r=Kn(Yn(1&i?t.prototype:t),e,n);return 2&i&&"function"==typeof r?function(t){return r.apply(n,t)}:r}function Kn(){return Kn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var i=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Yn(t)););return t}(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(arguments.length<3?t:n):r.value}},Kn.apply(null,arguments)}function Yn(t){return Yn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yn(t)}function Qn(t,e){return Qn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qn(t,e)}var Xn,ti,ei,ni,ii,ri,oi,ai,si,ci,li,ui,fi,di,hi,pi,mi,yi=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Yn(e),function(t,e){if(e&&("object"==Bn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Gn()?Reflect.construct(e,n||[],Yn(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qn(t,e)}(e,t),function(t,e,n){return e&&qn(t.prototype,e),n&&qn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"createRenderRoot",value:function(){return this}},{key:"connectedCallback",value:function(){Jn(e,"connectedCallback",this,3)([]),this._startInterval()}},{key:"disconnectedCallback",value:function(){Jn(e,"disconnectedCallback",this,3)([]),this._clearInterval()}},{key:"willUpdate",value:function(t){t.has("stateObj")&&this._startInterval()}},{key:"_clearInterval",value:function(){this._interval&&(clearInterval(this._interval),this._interval=void 0)}},{key:"_startInterval",value:function(){var t,e=this;this._clearInterval(),this._remaining=this.stateObj?zn(this.stateObj):void 0,"active"===(null===(t=this.stateObj)||void 0===t?void 0:t.state)&&(this._interval=setInterval(function(){e._remaining=zn(e.stateObj)},1e3))}},{key:"render",value:function(){return this.hass&&this.stateObj?W(Vn||(Vn=Wn(["",""])),function(t,e,n){var i;if("idle"===e.state||0===n)return t.formatEntityState(e);var r=null!==(i=Ut(n||0))&&void 0!==i?i:"0";return"paused"===e.state?"".concat(r," (").concat(t.formatEntityState(e),")"):r}(this.hass,this.stateObj,this._remaining)):W(Ln||(Ln=Wn([""])))}}],[{key:"properties",get:function(){return{hass:{attribute:!1},stateObj:{attribute:!1},_remaining:{state:!0}}}}])}(ut);function vi(t){return vi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vi(t)}function bi(){var t,e,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function o(n,i,r,o){var c=i&&i.prototype instanceof s?i:s,l=Object.create(c.prototype);return gi(l,"_invoke",function(n,i,r){var o,s,c,l=0,u=r||[],f=!1,d={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(e,n){return o=e,s=0,c=t,d.n=n,a}};function h(n,i){for(s=n,c=i,e=0;!f&&l&&!r&&e<u.length;e++){var r,o=u[e],h=d.p,p=o[2];n>3?(r=p===i)&&(c=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=h&&((r=n<2&&h<o[1])?(s=0,d.v=i,d.n=o[1]):h<p&&(r=n<3||o[0]>i||i>p)&&(o[4]=n,o[5]=i,d.n=p,s=0))}if(r||n>1)return a;throw f=!0,i}return function(r,u,p){if(l>1)throw TypeError("Generator is already running");for(f&&1===u&&h(u,p),s=u,c=p;(e=s<2?t:c)||!f;){o||(s?s<3?(s>1&&(d.n=-1),h(s,c)):d.n=c:d.v=c);try{if(l=2,o){if(s||(r="next"),e=o[r]){if(!(e=e.call(o,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),s=1);o=t}else if((e=(f=d.n<0)?c:n.call(i,d))!==a)break}catch(e){o=t,s=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,r,o),!0),l}var a={};function s(){}function c(){}function l(){}e=Object.getPrototypeOf;var u=[][i]?e(e([][i]())):(gi(e={},i,function(){return this}),e),f=l.prototype=s.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,gi(t,r,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,gi(f,"constructor",l),gi(l,"constructor",c),c.displayName="GeneratorFunction",gi(l,r,"GeneratorFunction"),gi(f),gi(f,r,"Generator"),gi(f,i,function(){return this}),gi(f,"toString",function(){return"[object Generator]"}),(bi=function(){return{w:o,m:d}})()}function gi(t,e,n,i){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}gi=function(t,e,n,i){function o(e,n){gi(t,e,function(t){return this._invoke(e,n,t)})}e?r?r(t,e,{value:n,enumerable:!i,configurable:!i,writable:!i}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},gi(t,e,n,i)}function _i(t,e,n,i,r,o,a){try{var s=t[o](a),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(i,r)}function wi(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function Oi(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function Si(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Oi(Object(n),!0).forEach(function(e){Ai(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Oi(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Ai(t,e,n){return(e=$i(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ji(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,$i(i.key),i)}}function $i(t){var e=function(t){if("object"!=vi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=vi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vi(e)?e:e+""}function xi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(xi=function(){return!!t})()}function ki(t,e,n,i){var r=Ei(Ci(1&i?t.prototype:t),e,n);return 2&i&&"function"==typeof r?function(t){return r.apply(n,t)}:r}function Ei(){return Ei="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var i=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Ci(t)););return t}(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(arguments.length<3?t:n):r.value}},Ei.apply(null,arguments)}function Ci(t){return Ci=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ci(t)}function Pi(t,e){return Pi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pi(t,e)}$t("multiple-entity-row-timer",yi);var Ti=function(t){return t.stopPropagation()},Mi=":host(.main-icon-painted) state-badge{".concat(Ee("var(--multiple-entity-row-main-icon-color)"),"}"),Ii=function(t){return"string"==typeof t&&""===t.trim()?null:t},Ri={top:"align-top",bottom:"align-bottom"};console.info("%c MULTIPLE-ENTITY-ROW %c ".concat("4.11.1"," (built ").concat("2026-09-02T21:15:15.588Z",", ").concat("6ccda16",") "),"color: cyan; background: black; font-weight: bold;","color: darkblue; background: white; font-weight: bold;");var Hi=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e,n){return e=Ci(e),function(t,e){if(e&&("object"==vi(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,xi()?Reflect.construct(e,n||[],Ci(t).constructor):e.apply(t,n))}(this,e))._templateResults=new Map,t._mainPainted=!1,t._templates=new pe(function(e){t._templateResults=e}),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pi(t,e)}(e,t),function(t,e,n){return e&&ji(t.prototype,e),n&&ji(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"connectedCallback",value:function(){var t=this;ki(e,"connectedCallback",this,3)([]),this._templates.connect(),customElements.get("hui-generic-entity-row")||customElements.whenDefined("hui-generic-entity-row").then(function(){return t.syncRowStyles()})}},{key:"disconnectedCallback",value:function(){ki(e,"disconnectedCallback",this,3)([]),this._templates.disconnect()}},{key:"setConfig",value:function(t){var e;if(!t||!t.entity)throw new Error("Please define a main entity.");t.entities&&t.entities.forEach(function(t){return Oe(t)}),t.secondary_info&&Oe(t.secondary_info),this.entityIds=function(t){var e,n,i,r;return[t.entity,null===(e=t.hide_if)||void 0===e?void 0:e.entity,null===(n=t.secondary_info)||void 0===n?void 0:n.entity,null===(i=t.secondary_info)||void 0===i||null===(i=i.hide_if)||void 0===i?void 0:i.entity].concat(null===(r=t.entities)||void 0===r?void 0:r.flatMap(function(t){var e;return"string"==typeof t?t:[t.entity,null===(e=t.hide_if)||void 0===e?void 0:e.entity]})).filter(function(t){return t})}(t),this._actionHandlers=new Map,this._nameHidden=!1===t.name,this.config=Si(Si({},t),{},{name:!1===t.name?" ":t.name,format:null!==(e=t.format)&&void 0!==e?e:t.time_format}),this._templates.setConfig(this.config)}},{key:"shouldUpdate",value:function(t){return function(t,e){if(e.has("config"))return!0;if(e.has("_templateResults"))return!0;if(e.has("_hass")){var n=e.get("_hass");return!n||!!Mt.some(function(e){return n[e]!==t._hass[e]})||t.entityIds.some(function(e){return n.states[e]!==t._hass.states[e]})}return!1}(this,t)}},{key:"hass",set:function(t){var e,n,i,r=this;(this._hass=t,this._templates.setHass(t),t&&this.config)&&(this.stateObj=t.states[this.config.entity],kt(this.config.secondary_info)&&(this.info=null!==(i=t.states[this.config.secondary_info.entity])&&void 0!==i?i:this.stateObj),this.entities=null!==(e=null===(n=this.config.entities)||void 0===n?void 0:n.map(function(e){var n="string"==typeof e?{entity:e}:e;return Si(Si({},n),{},{stateObj:n.entity?t.states[n.entity]:r.stateObj})}))&&void 0!==e?e:[])}},{key:"_resolved",value:function(t){var e;return function(t,e,n,i){var r=t,o=function(e,n){r===t&&(r=Jt({},t)),r[e]=n},a=le(i),s=function(t){return e.get(se(a+t,n))};if(ne(t.name)&&o("name",ae(s(t.name))||" "),ne(t.icon)){var c=s(t.icon);o("icon",null==c||""===c||String(c))}if(ne(t.icon_color)){var l=s(t.icon_color);o("icon_color","string"==typeof l?l:"")}if(ne(t.color)){var u=s(t.color);o("color","string"==typeof u&&""!==u?u:"none")}ne(t.template)&&o("template",ae(s(t.template)));var f=re(t);return f&&o("hide_if",function(t){return!0===t||1===t||"string"==typeof t&&oe.includes(t.trim().toLowerCase())}(s(f))),kt(t.styles)&&ie(t.styles)&&o("styles",Object.fromEntries(Object.entries(t.styles).map(function(t){var e=Qt(t,2),n=e[0],i=e[1];return[n,ne(i)?ae(s(i)):i]}))),r}(t,this._templateResults,null!==(e=t.entity)&&void 0!==e?e:this.config.entity,de(this.config,t))}},{key:"render",value:function(){var t,e,n=this;if(!this._hass||!this.config)return W(Xn||(Xn=wi([""])));if(!this.stateObj)return this.renderWarning();var i=this._resolved(this.config);this._rowScope=i;var r=Pe(this.stateObj,i),o=Si({},i);delete o.color,"boolean"!=typeof o.state_color&&delete o.state_color;var a,s,c=Si(Si(Si({},o),r?{icon:r}:{}),"cssColor"in(a=Ft(i,void 0,this.stateObj.state))?{color:a.cssColor}:{state_color:a.stateColor}),l=this._nameHidden&&!this.config.secondary_info,u=null!==(t=Ht(i,this.stateObj.state))&&void 0!==t?t:i.icon_color;return this._mainPainted=!!u,W(ti||(ti=wi(['<hui-generic-entity-row\n class="','"\n style="',"",'"\n .hass="','"\n .config="','"\n .secondaryText="','"\n .hideName=',"\n .catchInteraction=",'\n >\n <div\n class="','"\n >\n ',"\n </div>\n </hui-generic-entity-row>"])),u?"main-icon-painted":"",(s=u)?"--multiple-entity-row-main-icon-color: ".concat(s,";"):"",Ce(i.name_gap),this._hass,c,this.renderSecondaryInfo(),l,!1,[this.config.column?"entities-column":"entities-row",!this.config.column&&this.config.wrap?"wrap":"",null!==(e=Ri[this.config.align])&&void 0!==e?e:"",l?"no-name":""].filter(Boolean).join(" "),this.config.show_state_first?W(ei||(ei=wi(["","",""])),this.renderMainEntity(),this.entities.map(function(t,e){return n.renderEntity(t.stateObj,t,e)})):W(ni||(ni=wi(["","",""])),this.entities.map(function(t,e){return n.renderEntity(t.stateObj,t,e)}),this.renderMainEntity()))}},{key:"updated",value:function(t){var n;null===(n=ki(e,"updated",this,3))||void 0===n||n([t]),this.syncRowStyles()}},{key:"syncRowStyles",value:function(){var t,e,n=Ce(null===(t=this.config)||void 0===t?void 0:t.name_gap);if(n||this._mainPainted){var i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector("hui-generic-entity-row");i&&(n&&this.injectRowStyle(i,"data-mer-name-gap",":host .info{padding-inline-start:var(--multiple-entity-row-name-gap,16px)}"),i.classList.contains("main-icon-painted")&&this.injectRowStyle(i,"data-mer-main-icon",Mi))}}},{key:"injectRowStyle",value:(n=function(t){return function(){var e=this,n=arguments;return new Promise(function(i,r){var o=t.apply(e,n);function a(t){_i(o,i,r,a,s,"next",t)}function s(t){_i(o,i,r,a,s,"throw",t)}a(void 0)})}}(bi().m(function t(e,n,i){var r,o,a;return bi().w(function(t){for(;;)switch(t.p=t.n){case 0:if(null===(r=e.shadowRoot)||void 0===r||!r.querySelector("style[".concat(n,"]"))){t.n=1;break}return t.a(2);case 1:return t.p=1,t.n=2,e.updateComplete;case 2:t.n=4;break;case 3:return t.p=3,t.v,t.a(2);case 4:if(o=e.shadowRoot){t.n=5;break}return t.a(2);case 5:o.querySelector("style[".concat(n,"]"))||((a=document.createElement("style")).setAttribute(n,""),a.textContent=i,o.appendChild(a));case 6:return t.a(2)}},t,null,[[1,3]])})),function(t,e,i){return n.apply(this,arguments)})},{key:"renderSecondaryInfo",value:function(){var t=this.config.secondary_info;if(!t||function(t){return"string"==typeof t&&yt.includes(t)}(t))return null;if("string"==typeof t)return ne(t)?he(this._templateResults,t,this.config.entity,de(this.config))||" ":t;var e=this._resolved(t);if(Tt(this.info,e,this._hass))return null;var n=Te(this.info,e);return W(ii||(ii=wi(['<span style="','">'," ","</span>"])),Re(e),n,this.renderValue(this.info,e))}},{key:"renderMainEntity",value:function(){var t;if(!1===this.config.show_state)return null;var e=null!==(t=this._rowScope)&&void 0!==t?t:this._resolved(this.config);if(Tt(this.stateObj,e,this._hass))return this.config.default?W(ri||(ri=wi(['<div class="state entity" style="','">\n ',"\n <div>","</div>\n </div>"])),Re(e),this.renderMainHeader(),this.config.default):null;var n=this.getGestureHandlers("main",this.config.entity,this.config);return W(oi||(oi=wi(['<div\n class="state entity"\n style="','"\n @pointerdown="','"\n @pointerup="','"\n @pointercancel="','"\n @mousedown="','"\n @click="','"\n @touchstart="','"\n @touchend="','"\n @touchcancel="','"\n @contextmenu="','"\n >\n ',"\n <div>","</div>\n </div>"])),Re(e),null==n?void 0:n.onDown,null==n?void 0:n.onUp,null==n?void 0:n.onCancel,Ti,Ti,Ti,Ti,Ti,Ti,this.renderMainHeader(),this.renderValue(this.stateObj,e))}},{key:"renderEntity",value:function(t,e,n){var i,r,o;if(e=this._resolved(e),!t||Tt(t,e,this._hass))return e.default?W(ai||(ai=wi(['<div class="entity" style="','">\n <span\n >',"</span\n >\n <div>","</div>\n </div>"])),Re(e),null!==(r=Ii(t?Te(t,e):e.name))&&void 0!==r?r:this.headerPlaceholder(),e.default):t||e.hide_unavailable?null:W(si||(si=wi(['<div\n class="entity"\n style="','"\n title="','"\n >\n <span>','</span>\n <div><ha-icon class="missing" icon="mdi:alert-circle-outline"></ha-icon></div>\n </div>'])),Re(e),this._hass.localize("ui.panel.lovelace.warning.entity_not_found","entity",null!==(o=e.entity)&&void 0!==o?o:""),Ii(e.name));var a=this.getGestureHandlers("sub-".concat(n),t.entity_id,e);return W(ci||(ci=wi(['<div\n class="entity"\n style="','"\n @pointerdown="','"\n @pointerup="','"\n @pointercancel="','"\n @mousedown="','"\n @click="','"\n @touchstart="','"\n @touchend="','"\n @touchcancel="','"\n @contextmenu="','"\n >\n <span\n >',"</span\n >\n <div>\n ","\n </div>\n </div>"])),Re(e),null==a?void 0:a.onDown,null==a?void 0:a.onUp,null==a?void 0:a.onCancel,Ti,Ti,Ti,Ti,Ti,Ti,null!==(i=Ii(Te(t,e)))&&void 0!==i?i:function(t){return!0===t.toggle||!!t.icon||kt(t.state_icon)}(e)?null:this.headerPlaceholder(),e.icon||kt(e.state_icon)?this.renderIcon(t,e):this.renderValue(t,e))}},{key:"renderMainHeader",value:function(){var t,e=null!==(t=Ii(this.config.state_header))&&void 0!==t?t:!0===this.config.toggle?null:this.headerPlaceholder();return e?W(li||(li=wi(["<span>","</span>"])),e):null}},{key:"headerPlaceholder",value:function(){return null!=Ii(this.config.state_header)||this.entities.some(function(t){return!1!==(e=t).name&&null!==Ii(e.name)&&!(!e.name&&!e.entity);var e})?" ":null}},{key:"renderValue",value:function(t,e){var n;if(!0===e.toggle)return this.renderToggle(t,e);if(void 0!==e.template){var i=ne(e.template)?"":e.template;return"".concat(i).concat(e.unit?" ".concat(e.unit):"")}if(!e.attribute&&null!==(n=t.entity_id)&&void 0!==n&&n.startsWith("timer."))return W(ui||(ui=wi(["<multiple-entity-row-timer\n .hass=","\n .stateObj=","\n ></multiple-entity-row-timer>"])),this._hass,t);var r=e.attribute&&[ht,pt].includes(e.attribute);if(e.format&&mt.includes(e.format)){var o,a=r?t[e.attribute.replace("-","_")]:e.attribute?null!==(o=t.attributes[e.attribute])&&void 0!==o?o:t[e.attribute]:t.state,s=new Date(a);return s instanceof Date&&!isNaN(s.getTime())?W(fi||(fi=wi(["<hui-timestamp-display\n .hass=","\n .ts=","\n .format=","\n capitalize\n ></hui-timestamp-display>"])),this._hass,s,e.format):a}return r?W(di||(di=wi(["<ha-relative-time\n .hass=","\n .datetime=","\n capitalize\n ></ha-relative-time>"])),this._hass,t[e.attribute.replace("-","_")]):Ie(this._hass,t,e)}},{key:"renderToggle",value:function(t,e){var n,i=this,r=null===(n=e.tap_action)||void 0===n?void 0:n.confirmation,o=r?{handleEvent:function(n){var o,a,s;n.stopPropagation(),n.preventDefault();var c=kt(r)&&(null===(o=r.exemptions)||void 0===o?void 0:o.some(function(t){var e;return t.user===(null===(e=i._hass.user)||void 0===e?void 0:e.id)})),l=kt(r)&&r.text,u=ne(l)?he(i._templateResults,l,null!==(a=e.entity)&&void 0!==a?a:i.config.entity,de(i.config,e)):l||"Are you sure you want to toggle ".concat(null!==(s=Te(t,e))&&void 0!==s?s:t.entity_id,"?");(c||confirm(u))&&i._hass.callService("homeassistant","toggle",{entity_id:t.entity_id})},capture:!0}:void 0;return W(hi||(hi=wi(["<span\n @pointerdown=","\n @pointerup=","\n @pointercancel=","\n @click=",'\n >\n <ha-entity-toggle .stateObj="','" .hass="','"></ha-entity-toggle>\n </span>'])),Ti,Ti,Ti,o,t,this._hass)}},{key:"renderIcon",value:function(t,e){var n,i,r,o,a=null!==(n=Pe(t,e))&&void 0!==n?n:!0===e.icon?t.attributes.icon||null:e.icon,s=null!==(i=this._rowScope)&&void 0!==i?i:this._resolved(this.config),c="cssColor"in(o=Ft(e,s,t.state))?{color:o.cssColor}:{stateColor:o.stateColor},l=c.stateColor,u=c.color,f=!(a||!t.attributes.entity_picture&&!t.attributes.entity_picture_local);return W(pi||(pi=wi(['<state-badge\n class="icon-small','"\n style="','"\n .hass=','\n .stateObj="','"\n .overrideIcon="','"\n .stateColor="','"\n .color="','"\n ></state-badge>'])),f?" has-picture":"",Ee(null!==(r=Ht(e,t.state))&&void 0!==r?r:e.icon_color),this._hass,t,a,l,u)}},{key:"renderWarning",value:function(){return W(mi||(mi=wi(["<hui-warning>\n ","\n </hui-warning>"])),this._hass.localize("ui.panel.lovelace.warning.entity_not_found","entity",this.config.entity))}},{key:"getGestureHandlers",value:function(t,e,n){var i,r,o,a,s,c,l,u=this;return this._actionHandlers.has(t)||this._actionHandlers.set(t,(i=function(t,i){return u.dispatchAction(e,n,t,i)},r={hasHold:!!n.hold_action,hasDoubleTap:!!n.double_tap_action},s=r.hasHold,c=r.hasDoubleTap,l=!1,{onDown:function(){l=!1,s&&(o=setTimeout(function(){l=!0},500))},onUp:function(){if(clearTimeout(o),l)return l=!1,void i(!0,!1);c?a?(clearTimeout(a),a=void 0,i(!1,!0)):a=setTimeout(function(){a=void 0,i(!1,!1)},250):i(!1,!1)},onCancel:function(){clearTimeout(o)}})),this._actionHandlers.get(t)}},{key:"dispatchAction",value:function(t,e,n,i){var r,o,a=i?e.double_tap_action:n?e.hold_action:null!==(r=e.tap_action)&&void 0!==r?r:{action:"more-info"};if(a&&"none"!==a.action){var s,c,l,u,f,d,h=(s=a,c=this._templateResults,l=null!==(o=e.entity)&&void 0!==o?o:this.config.entity,u=de(this.config,e),f=le(u),d=function(t){if(ne(t)){var e=c.get(se(f+t,l));return void 0===e?"":e}return Array.isArray(t)?t.map(d):kt(t)?Object.fromEntries(Object.entries(t).map(function(t){var e=Qt(t,2),n=e[0],i=e[1];return[n,d(i)]})):t},d(s)),p=i?"double_tap":n?"hold":"tap";Ct(this,"hass-action",{config:Ai({entity:h.entity||t},"".concat(p,"_action"),h),action:p})}}}],[{key:"getConfigElement",value:function(){return document.createElement("multiple-entity-row-editor")}},{key:"getStubConfig",value:function(t,e){var n,i,r=null!==(n=null!==(i=null==e?void 0:e.find(function(t){return t.startsWith("sensor.")}))&&void 0!==i?i:null==e?void 0:e[0])&&void 0!==n?n:"";return{entity:r}}},{key:"properties",get:function(){return{_hass:Object,config:Object,stateObj:Object,_templateResults:Object}}},{key:"styles",get:function(){return o(we||(we=function(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}(["\n /* state-badge is a fixed 40px box, which leaves an odd gap under a headered icon - let it\n shrink to the icon's natural size instead (see #425). */\n .icon-small {\n width: auto;\n height: auto;\n }\n /* ...except when it is showing a picture: state-badge then hides the icon and paints the\n image as a background, so the host has no in-flow content and would collapse to nothing.\n The class is set in renderIcon rather than reusing state-badge's own has-image. */\n .icon-small.has-picture {\n width: 40px;\n height: 40px;\n }\n .entity {\n text-align: center;\n cursor: pointer;\n }\n /* Marker for an entity id that resolves to nothing (see #364). */\n .entity .missing {\n color: var(--error-color, #db4437);\n }\n .entity span {\n font-size: 10px;\n color: var(--multiple-entity-row-header-color, var(--secondary-text-color));\n }\n .entities-row {\n flex-direction: row;\n display: inline-flex;\n justify-content: space-between;\n align-items: center;\n }\n /* HA's name box is what pushes the entities to the right: it grows at flex: 1 1 30%. Hiding\n it removes that push too, leaving them against the icon, so take over the job here - the\n point of hiding the name is more room, not a different alignment (see #341, #365). */\n .entities-row.no-name,\n .entities-column.no-name {\n margin-left: auto;\n }\n /* The 'styles' option reaches one entity's div, which is a flex item - so vertical-align\n there does nothing and alignment has to be set on the container instead (see #261). */\n .entities-row.align-top,\n .entities-column.align-top {\n align-items: flex-start;\n }\n .entities-row.align-bottom,\n .entities-column.align-bottom {\n align-items: flex-end;\n }\n /* The 16px gap must be margin, not padding: users tune spacing with their own margins in\n the 'styles' option, which replace this margin but would stack on top of a padding - 4.10.1 did\n padding and widened every tuned row into overflowing on phones (see #432). The gap still\n has to be clickable though: the row's cursor:pointer inherits into it, but HA stops\n slotted clicks at the bare slot (catchInteraction=false), so bare margin is dead space\n that looks clickable. The ::after extension puts the gap inside the entity's hit area\n without affecting layout. position:relative on every entity keeps hit-testing fair: a\n positioned later sibling beats its neighbor's ::after wherever a user's zero/negative\n margin makes them overlap, so no entity steals its neighbor's clicks. */\n .entities-row .entity {\n margin-right: 16px;\n position: relative;\n }\n .entities-row .entity:last-of-type {\n margin-right: 0;\n }\n .entities-row .entity:not(:last-of-type)::after {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n right: -16px;\n width: 16px;\n }\n /* HA's ha-entity-toggle host is display:flex with no horizontal alignment, so in a slot\n wider than the switch it hugs the left edge while everything else centers. Outer styles\n out-rank :host rules, so it can be centered from here; keeping the host's flex box (vs\n display:contents) preserves the full-width tap strip and HA's box assumptions (#436). */\n .entity ha-entity-toggle {\n justify-content: center;\n }\n /* Opt-in, because it trades a taller row for not overflowing: nothing between HA's .row and\n our entities can shrink, so a row needing more width than the card has just spills past\n the edge (worst on narrow phone screens - see #411). Wrapping reflows instead. */\n .entities-row.wrap {\n flex-wrap: wrap;\n justify-content: flex-end;\n row-gap: 4px;\n }\n .entities-column {\n flex-direction: column;\n display: flex;\n align-items: flex-end;\n justify-content: space-evenly;\n }\n .entities-column .entity div {\n display: inline-block;\n vertical-align: middle;\n }\n"])))}}]);var n}(ut);$t("multiple-entity-row",Hi),window.customCards=window.customCards||[],window.customCards.some(function(t){return"multiple-entity-row"===t.type})||window.customCards.push({type:"multiple-entity-row",name:"Multiple Entity Row",description:"Show multiple entity states and attributes on a single entity row"})})();