/*! 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,v=m?m.emptyScript:"",y=p.reactiveElementPolyfillSupport,b=(t,e)=>t,_={toAttribute(t,e){switch(e){case Boolean:t=t?v: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}},g=(t,e)=>!c(t,e),w={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:g};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:_).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:_;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??g)(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,y?.({ReactiveElement:O}),(p.reactiveElementVersions??=[]).push("2.1.2");const A=globalThis,S=t=>t,$=A.trustedTypes,j=$?$.createPolicy("lit-html",{createHTML:t=>t}):void 0,x="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,k="?"+E,C=`<${k}>`,P=document,T=()=>P.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,I=Array.isArray,H=t=>I(t)||"function"==typeof t?.[Symbol.iterator],R="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,F=/-->/g,N=/>/g,U=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \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"),J=new WeakMap,G=P.createTreeWalker(P,129);function K(t,e){if(!I(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==j?j.createHTML(e):e}const Y=(t,e)=>{const n=t.length-1,i=[];let r,o=2===e?"":3===e?"":"",a=D;for(let e=0;e"===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)+E+f):n+E+(-2===l?e:f)}return[K(t,o+(t[n]||"")+(2===e?"":3===e?"":"")),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),G.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=G.nextNode())&&s.length0){i.textContent=$?$.emptyScript:"";for(let n=0;n2||""!==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{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"],vt=["entity-id","last-changed","last-updated","last-triggered","position","tilt-position","brightness"],yt=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"]),bt=function(t){return yt.has(t)?"var(--".concat(t,"-color)"):t},_t=function(t){var e,n=null!==(e=t.color)&&void 0!==e?e:void 0===t.state_color?void 0:t.state_color?"state":"none";return void 0===n?t.icon_color?{stateColor:!1}:{stateColor:!0}:"state"===n?{stateColor:!0}:"none"===n?{stateColor:!1}:{cssColor:bt(n)}},gt=function(t){return t<10?"0".concat(t):t};function wt(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(gt(n),":").concat(gt(i)):n>0?"".concat(n,":").concat(gt(i)):i>0?""+i:null}function Ot(t){return Ot="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},Ot(t)}function At(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 St(t,e,n){return(e=function(t){var e=function(t){if("object"!=Ot(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ot(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ot(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var $t=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,jt(t,n)).format(Number(t))}catch(e){return console.error(e),new Intl.NumberFormat(void 0,jt(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):"")},jt=function(t,e){var n=function(t){for(var e=1;e-1?t.split(".")[1].length:0;n.minimumFractionDigits=i,n.maximumFractionDigits=i}return n};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 Et=function(t){return"object"===xt(t)&&!Array.isArray(t)&&!!t},kt=function(t,e,n){var i=new Event(e,{bubbles:!0,composed:!0});i.detail=n,t.dispatchEvent(i)},Ct=function(t){return!t||dt.includes(t.state)},Pt=function(t,e,n){if(function(t,e){return e.hide_unavailable&&(Ct(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(Et(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(Et(e.hide_if)){if(e.hide_if.below&&ie.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})},Tt=["formatEntityName","formatEntityState","formatEntityAttributeValue"];function Mt(t){return Mt="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},Mt(t)}function It(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 Ht(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,i=Array(e);n1&&a.every(function(t){return Bt.test(t)})){var s=r??0;return!isNaN(parseFloat(s))&&isFinite(s)?function(t,e,n,i){var r,o,a=parseFloat(e),s=Ut(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=Dt(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=Vt.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($t(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 Lt.some(function(e){return null==t?void 0:t.startsWith(e)})&&!zt(t)}(n.format)){if(null==r&&(r=Wt.includes(n.format)?"":0),Wt.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=$t(100*r,t.locale,{maximumFractionDigits:2}),o="%";else if("duration"===n.format){var c;r=null!==(c=wt(r))&&void 0!==c?c:"0",o=void 0}else if("duration-m"===n.format){var l;r=null!==(l=wt(r/1e3))&&void 0!==l?l:"0",o=void 0}else if("duration-h"===n.format){var u;r=null!==(u=wt(3600*r))&&void 0!==u?u:"0",o=void 0}else if(zt(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)||Dt(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.")}()}(zt(n.format),3),d=f[1],h=f[2];if("precision"===d){var p=parseInt(h,10);r=$t(parseFloat(r),t.locale,{minimumFractionDigits:p,maximumFractionDigits:p})}else r=function(t,e,n,i){if(void 0===n)return $t(t/e,i,{maximumFractionDigits:2});var r=parseInt(n,10);return $t(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=Ut(r);r=$t(r-2*r,t.locale,void 0!==m?{minimumFractionDigits:m,maximumFractionDigits:m}:void 0)}else if("position"===n.format){var v=Ut(r);r=$t(100-r,t.locale,void 0!==v?{minimumFractionDigits:v,maximumFractionDigits:v}:void 0)}else"celsius_to_fahrenheit"===n.format?r=$t(1.8*r+32,t.locale,{maximumFractionDigits:0}):"fahrenheit_to_celsius"===n.format&&(r=$t(5*(r-32)/9,t.locale,{maximumFractionDigits:1}));return"".concat(r).concat(o?" ".concat(o):"")}var y=Ht(Ht({},e),{},{attributes:Ht(Ht({},e.attributes),{},{unit_of_measurement:o})});if(void 0!==n.unit&&!n.attribute){if(!isNaN(parseFloat(r))&&isFinite(r)){var b,_=null===(b=t.entities)||void 0===b||null===(b=b[e.entity_id])||void 0===b?void 0:b.display_precision,g=$t(r,t.locale,null!=_?{minimumFractionDigits:_,maximumFractionDigits:_}:void 0);return"".concat(g).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:$t(r,t.locale);return"".concat(w).concat(o?" ".concat(o):"")}return Gt(t.formatEntityAttributeValue(y,n.attribute))}return Gt(t.formatEntityState(y))},Yt=function(t){return Et(null==t?void 0:t.styles)?Object.keys(t.styles).map(function(e){return"".concat(e,": ").concat(t.styles[e],";")}).join(""):""};function Qt(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=oe(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 Xt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,i=Array(e);n2&&void 0!==arguments[2]?arguments[2]:"";le(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(fe(t),e,n),ye.forEach(function(r){return be(t[r],function(t){return i(t,e,n)})})},o=t.entity;if(r(t,o,ve(_e(t))),"string"==typeof t.secondary_info)i(t.secondary_info,o,ve(_e(t)));else if(Et(t.secondary_info)){var a,s=t.secondary_info;r(s,null!==(a=s.entity)&&void 0!==a?a:o,ve(_e(t,s)))}return null===(e=t.entities)||void 0===e||e.forEach(function(e){if(Et(e)){var n,i=e;r(i,null!==(n=i.entity)&&void 0!==n?n:o,ve(_e(t,i)))}}),n}(t).map(function(t){return[pe(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=re(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=re(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)))}}])}();class Oe{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:Ae}=st,Se={},$e=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends Oe{constructor(){super(...arguments),this.key=Z}render(t,e){return this.key=t,e}update(t,[e,n]){return e!==this.key&&(((t,e=Se)=>{t._$AH=e})(t),this.key=e),n}});var je,xe,Ee,ke,Ce,Pe,Te,Me,Ie,He,Re,De,Fe,Ne,Ue,Le,Ve,ze="__custom__",Be=[{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:ze,label:"Custom…"}],We=new Set(Be.map(function(t){return t.value}).filter(function(t){return t&&t!==ze})),qe=[{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:{}}},{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:Be}}}],Ze=[{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"}}}],Je=[{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:Be}}}],Ge={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))",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 Ke(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function Ye(t){return function(t){if(Array.isArray(t))return un(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ln(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 Qe(t,e){for(var n=0;n=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 cn(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)||ln(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 ln(t,e){if(t){if("string"==typeof t)return un(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)?un(t,e):void 0}}function un(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);ni.length&&(t._selectedTab=i.length),t._keys.clear(),t._updateConfig({entities:i.length?i:void 0})}}),on(t,"_moveAdditional",function(e,n){var i;if(t._config){var r=Ye(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})}}}),on(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}:rn({},i))}),on(t,"_cutAdditional",function(e){t._copyAdditional(e),t._deleteAdditional(e)}),on(t,"_copyMainAsTemplate",function(){if(t._config){var e,n={},i=sn($n);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)}}),on(t,"_pasteEntity",function(){var e;if(t._config){var n=t._readClipboard();if(n){var i=[].concat(Ye(null!==(e=t._config.entities)&&void 0!==e?e:[]),[n]);t._selectedTab=i.length,t._keys.clear(),t._updateConfig({entities:i})}}}),on(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})}}}),on(t,"_secondaryTextChanged",function(e){t._updateConfig({secondary_info:e.detail.value.text})}),on(t,"_secondaryTokenChanged",function(e){t._updateConfig({secondary_info:e.detail.value.token})}),on(t,"_secondaryEntityChanged",function(e){var n,i=Et(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",An(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&&en(t,e)}(e,t),function(t,e,n){return e&&Qe(t.prototype,e),n&&Qe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setConfig",value:function(t){var e,n,i,r=this;if(ue(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=Et(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=sn(t);try{for(r.s();!(n=r.n()).done;){var o=cn(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(Sn);if(!t)return;var e=JSON.parse(t);if(e&&"object"===fn(e))return e}catch(t){}}},{key:"_writeClipboard",value:function(t){try{sessionStorage.setItem(Sn,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(je||(je=Ke(["\n \n ",'\n \n\n \n "])),"Entities",this._entitiesExpanded,this._onEntitiesExpandedChanged,this._renderEntitiesPanel(),"4.10.0","2026-08-09T15:16:44.393Z"):Z}},{key:"_isCustomFormat",value:function(t,e){return this._customFormatScopes.has(t)||!!e&&!We.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)?rn(rn({},e),{},{format:ze}):e}},{key:"_formatFromForm",value:function(t,e,n){if(e.format===ze){this._setCustomFormatScope(t,!0);var i=rn({},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(xe||(xe=Ke(["\n \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(Ee||(Ee=Ke(['\n
\n
\n ','\n \n
\n\n
\n ',"\n
\n
\n "])),this._hasNativeTabs?W(ke||(ke=Ke(['\n \n \n \n \n \n
\n
\n \n \n ','\n \n ','\n \n ',"\n \n "])),"Copy main as template",hn,this._copyMainAsTemplate,"Paste as new entity",pn,!this._clipboardEntity,this._pasteEntity,this.hass,this._mainFormData(),qe,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(),Ze,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(Ie||(Ie=Ke(['\n \n ','\n \n \n \n \n
\n
\n \n \n ','\n \n ',"\n \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",hn,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",pn,!this._clipboardEntity,this._pasteEntity,"Delete entity",dn,function(){return i._deleteAdditional(t)},this.hass,this._formatToForm("sub-".concat(t),On(o)),Je,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),On(o)),Ze,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",On(rn({show_state:!0},this._config)))}},{key:"_setAdditionalFormat",value:function(t,e){var n;if(this._config){var i=Ye(null!==(n=this._config.entities)&&void 0!==n?n:[]),r=i[t],o="string"==typeof r?{entity:r}:rn({},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"===fn(e)?"entity":vt.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(Fe||(Fe=Ke(["\n
\n \n ","\n ","\n ","\n
\n "])),this.hass,{mode:n},mn,function(){return"Mode"},this._secondaryModeChanged,"text"===n?W(Ne||(Ne=Ke(['
\n \n \n \n \n ',"\n
\n "])),qt(i.icon_color),this._hass,o,this.renderSecondaryInfo(),a,!1,[this.config.column?"entities-column":"entities-row",!this.config.column&&this.config.wrap?"wrap":"",null!==(t=bi[this.config.align])&&void 0!==t?t:"",a?"no-name":""].filter(Boolean).join(" "),this.config.show_state_first?W(Ln||(Ln=oi(["","",""])),this.renderMainEntity(),this.entities.map(function(t,n){return e.renderEntity(t.stateObj,t,n)})):W(Vn||(Vn=oi(["","",""])),this.entities.map(function(t,n){return e.renderEntity(t.stateObj,t,n)}),this.renderMainEntity()))}},{key:"renderSecondaryInfo",value:function(){var t=this.config.secondary_info;if(!t||function(t){return"string"==typeof t&&vt.includes(t)}(t))return null;if("string"==typeof t)return W(zn||(zn=oi(["",""])),le(t)?ge(this._templateResults,t,this.config.entity,_e(this.config)):t);var e=this._resolved(t);if(Pt(this.info,e,this._hass))return null;var n=Jt(this.info,e);return W(Bn||(Bn=oi([""," ",""])),n,this.renderValue(this.info,e))}},{key:"renderMainEntity",value:function(){if(!1===this.config.show_state)return null;var t=this._resolved(this.config);if(Pt(this.stateObj,t,this._hass))return this.config.default?W(Wn||(Wn=oi(['
\n ',"\n
","
\n
"])),Yt(this.config),this.renderMainHeader(),this.config.default):null;var e=this.getGestureHandlers("main",this.config.entity,this.config);return W(qn||(qn=oi(['\n ',"\n
","
\n "])),Yt(this.config),null==e?void 0:e.onDown,null==e?void 0:e.onUp,null==e?void 0:e.onCancel,vi,vi,vi,vi,vi,vi,this.renderMainHeader(),this.renderValue(this.stateObj,t))}},{key:"renderEntity",value:function(t,e,n){var i,r,o;if(e=this._resolved(e),!t||Pt(t,e,this._hass))return e.default?W(Zn||(Zn=oi(['
\n ',"\n
","
\n
"])),Yt(e),null!==(r=yi(t?Jt(t,e):e.name))&&void 0!==r?r:this.headerPlaceholder(),e.default):t||e.hide_unavailable?null:W(Jn||(Jn=oi(['\n ','\n
\n '])),Yt(e),this._hass.localize("ui.panel.lovelace.warning.entity_not_found","entity",null!==(o=e.entity)&&void 0!==o?o:""),yi(e.name));var a=this.getGestureHandlers("sub-".concat(n),t.entity_id,e);return W(Gn||(Gn=oi(['\n ',"\n
\n ","\n
\n "])),Yt(e),null==a?void 0:a.onDown,null==a?void 0:a.onUp,null==a?void 0:a.onCancel,vi,vi,vi,vi,vi,vi,null!==(i=yi(Jt(t,e)))&&void 0!==i?i:function(t){return!0===t.toggle||!!t.icon||Et(t.state_icon)}(e)?null:this.headerPlaceholder(),e.icon||Et(e.state_icon)?this.renderIcon(t,e):this.renderValue(t,e))}},{key:"renderMainHeader",value:function(){var t,e=null!==(t=yi(this.config.state_header))&&void 0!==t?t:!0===this.config.toggle?null:this.headerPlaceholder();return e?W(Kn||(Kn=oi(["",""])),e):null}},{key:"headerPlaceholder",value:function(){return null!=yi(this.config.state_header)||this.entities.some(function(t){return!1!==(e=t).name&&null!==yi(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=le(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(Yn||(Yn=oi([""])),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(Qn||(Qn=oi([""])),this._hass,s,e.format):a}return r?W(Xn||(Xn=oi([""])),this._hass,t[e.attribute.replace("-","_")]):Kt(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=Et(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=Et(r)&&r.text,u=le(l)?ge(i._templateResults,l,null!==(a=e.entity)&&void 0!==a?a:i.config.entity,_e(i.config,e)):l||"Are you sure you want to toggle ".concat(null!==(s=Jt(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(ti||(ti=oi(["\n '])),vi,vi,vi,o,t,this._hass)}},{key:"renderIcon",value:function(t,e){var n,i,r=null!==(n=Zt(t,e))&&void 0!==n?n:!0===e.icon?t.attributes.icon||null:e.icon,o="cssColor"in(i=_t(e))?{color:i.cssColor}:{stateColor:i.stateColor},a=o.stateColor,s=o.color,c=!(r||!t.attributes.entity_picture&&!t.attributes.entity_picture_local);return W(ei||(ei=oi([''])),c?" has-picture":"",qt(e.icon_color),this._hass,t,r,a,s)}},{key:"renderWarning",value:function(){return W(ni||(ni=oi(["\n ","\n "])),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=_e(this.config,e),f=ve(u),d=function(t){if(le(t)){var e=c.get(pe(f+t,l));return void 0===e?"":e}return Array.isArray(t)?t.map(d):Et(t)?Object.fromEntries(Object.entries(t).map(function(t){var e=re(t,2),n=e[0],i=e[1];return[n,d(i)]})):t},d(s)),p=i?"double_tap":n?"hold":"tap";kt(this,"hass-action",{config:ci({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(ce||(ce=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 .entities-row .entity {\n margin-right: 16px;\n }\n .entities-row .entity:last-of-type {\n margin-right: 0;\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"])))}}])}(ut);customElements.define("multiple-entity-row",_i),window.customCards=window.customCards||[],window.customCards.push({type:"multiple-entity-row",name:"Multiple Entity Row",description:"Show multiple entity states and attributes on a single entity row"})})();