From c96d97d6f867f01203346b49df02bd0e3710591f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Sun, 11 Feb 2024 21:11:44 +0000 Subject: [PATCH] Update and clean dependencies --- README.md | 12 +- card-mod.js | 1 + package-lock.json | 3370 ++++++++++++++++++++++++-------- package.json | 24 +- rollup.config.js | 8 +- src/helpers/action.ts | 11 + src/helpers/browser_id.ts | 6 + src/helpers/hass.ts | 20 + src/{ => helpers}/templates.ts | 16 +- src/main.ts | 30 +- template-entity-row.js | 50 +- test/lovelace.yaml | 6 +- tsconfig.json | 17 +- 13 files changed, 2654 insertions(+), 917 deletions(-) create mode 100644 card-mod.js create mode 100644 src/helpers/action.ts create mode 100644 src/helpers/browser_id.ts create mode 100644 src/helpers/hass.ts rename src/{ => helpers}/templates.ts (86%) diff --git a/README.md b/README.md index 6877060..d7f4a46 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ entities: - `active` if this evaluates to "true" or "false", the icon gets will always look active or inactive respectively. - `entity` if this evaluates to an entity id, `icon`, `name`, `state` and `image` will be taken from that entity unless manually overridden. Specifying an `entity` will also let you use [`action`](https://www.home-assistant.io/lovelace/entities/#options-for-entities). - `condition` if this is set but does not evaluate to "true", the row is not displayed. -- `toggle` if this evaluates to "true" a toggle is shown instead of the state. The toggle is connected to the `entity`. +- `toggle` if this evaluates to "true" a toggle is shown instead of the state. The toggle is connected to the `entity`. This will only show a toggle, nothing else. No sliders, no dropdowns, no media controls. `toggle` means Toggle. - `tap_action`, `hold_action`, `double_tap_action`: see below. - `color` the CSS color of the icon. @@ -98,6 +98,16 @@ double_tap_action: Because you're not using it correctly. This is **not** a card. It's an entity row, and is meant to be used _inside_ the [entities card](https://www.home-assistant.io/lovelace/entities/) +### Why doesn't toggle: true make buttons appear to control my blinds? + +Because "toggle" means a toggle. It's the simplest possible way to control an entity, and anything beyond that is not in the scope of this row and will not be added. + +### Why is my log flooded with template errors? + +This may happen if you use the GUI editor to edit a template based value. Since Home Assistant redraws the row every time you make any change to the configuration in the GUI editor, it will try to render the template every time you push a key. +Since the template will be invalid for most of the time while you're editing it, you will get a lot of errors. \ +There's unfortunately nothing I can easily do about this behavior. + --- Buy Me A Coffee diff --git a/card-mod.js b/card-mod.js new file mode 100644 index 0000000..d2bc605 --- /dev/null +++ b/card-mod.js @@ -0,0 +1 @@ +var t,e,n,r,i,o,a,s,u;function l(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function h(t){for(var e=1;e=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;j(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:T(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function g(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function m(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){g(o,r,i,a,s,"next",t)}function s(t){g(o,r,i,a,s,"throw",t)}a(void 0)}))}}function b(t,e,n){return e=S(e),_(t,k()?Reflect.construct(e,n||[],S(t).constructor):e.apply(t,n))}function _(t,e){if(e&&("object"===L(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return w(t)}function w(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}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&&E(t,e)}function A(t){var e="function"==typeof Map?new Map:void 0;return A=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(k())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&E(i,n.prototype),i}(t,arguments,S(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),E(n,t)},A(t)}function k(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(k=function(){return!!t})()}function E(t,e){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},E(t,e)}function S(t){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},S(t)}function O(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=x(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},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 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 x(t,e){if(t){if("string"==typeof t)return P(t,e);var n=Object.prototype.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)?P(t,e):void 0}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}"function"==typeof SuppressedError&&SuppressedError;var N=globalThis,M=N.ShadowRoot&&(void 0===N.ShadyCSS||N.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,H=Symbol(),D=new WeakMap,I=function(){function t(e,n,r){if(j(this,t),this._$cssResult$=!0,r!==H)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}return T(t,[{key:"styleSheet",get:function(){var t=this.o,e=this.t;if(M&&void 0===t){var n=void 0!==e&&1===e.length;n&&(t=D.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&D.set(e,t))}return t}},{key:"toString",value:function(){return this.cssText}}]),t}(),z=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r0&&(this._$Ep=e)}},{key:"createRenderRoot",value:function(){var t,e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return function(t,e){if(M)t.adoptedStyleSheets=e.map((function(t){return t instanceof CSSStyleSheet?t:t.styleSheet}));else{var n,r=O(e);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=document.createElement("style"),a=N.litNonce;void 0!==a&&o.setAttribute("nonce",a),o.textContent=i.cssText,t.appendChild(o)}}catch(t){r.e(t)}finally{r.f()}}}(e,this.constructor.elementStyles),e}},{key:"connectedCallback",value:function(){var t,e;null!==(t=this.renderRoot)&&void 0!==t||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$EO)||void 0===e||e.forEach((function(t){var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}},{key:"enableUpdating",value:function(t){}},{key:"disconnectedCallback",value:function(){var t;null===(t=this._$EO)||void 0===t||t.forEach((function(t){var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}},{key:"attributeChangedCallback",value:function(t,e,n){this._$AK(t,n)}},{key:"_$EC",value:function(t,e){var n=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,n);if(void 0!==r&&!0===n.reflect){var i,o=(void 0!==(null===(i=n.converter)||void 0===i?void 0:i.toAttribute)?n.converter:tt).toAttribute(e,n.type);this._$Em=t,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}},{key:"_$AK",value:function(t,e){var n=this.constructor,r=n._$Eh.get(t);if(void 0!==r&&this._$Em!==r){var i,o=n.getPropertyOptions(r),a="function"==typeof o.converter?{fromAttribute:o.converter}:void 0!==(null===(i=o.converter)||void 0===i?void 0:i.fromAttribute)?o.converter:tt;this._$Em=r,this[r]=a.fromAttribute(e,o.type),this._$Em=null}}},{key:"requestUpdate",value:function(t,e,n){if(void 0!==t){var r,i;if(null!==(r=n)&&void 0!==r||(n=this.constructor.getPropertyOptions(t)),!(null!==(i=n.hasChanged)&&void 0!==i?i:et)(this[t],e))return;this.P(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}},{key:"P",value:function(t,e,n){var r;this._$AL.has(t)||this._$AL.set(t,e),!0===n.reflect&&this._$Em!==t&&(null!==(r=this._$Ej)&&void 0!==r?r:this._$Ej=new Set).add(t)}},{key:"_$ET",value:(n=m(y().mark((function t(){var e;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isUpdatePending=!0,t.prev=1,t.next=4,this._$ES;case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),Promise.reject(t.t0);case 9:if(e=this.scheduleUpdate(),t.t1=null!=e,!t.t1){t.next=14;break}return t.next=14,e;case 14:return t.abrupt("return",!this.isUpdatePending);case 15:case"end":return t.stop()}}),t,this,[[1,6]])}))),function(){return n.apply(this,arguments)})},{key:"scheduleUpdate",value:function(){return this.performUpdate()}},{key:"performUpdate",value:function(){if(this.isUpdatePending){if(!this.hasUpdated){var t;if(null!==(t=this.renderRoot)&&void 0!==t||(this.renderRoot=this.createRenderRoot()),this._$Ep){var e,n=O(this._$Ep);try{for(n.s();!(e=n.n()).done;){var r=p(e.value,2),i=r[0],o=r[1];this[i]=o}}catch(t){n.e(t)}finally{n.f()}this._$Ep=void 0}var a=this.constructor.elementProperties;if(a.size>0){var s,u=O(a);try{for(u.s();!(s=u.n()).done;){var l=p(s.value,2),c=l[0],h=l[1];!0!==h.wrapped||this._$AL.has(c)||void 0===this[c]||this.P(c,this[c],h)}}catch(t){u.e(t)}finally{u.f()}}}var f=!1,d=this._$AL;try{var v;(f=this.shouldUpdate(d))?(this.willUpdate(d),null!==(v=this._$EO)&&void 0!==v&&v.forEach((function(t){var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(d)):this._$EU()}catch(d){throw f=!1,this._$EU(),d}f&&this._$AE(d)}}},{key:"willUpdate",value:function(t){}},{key:"_$AE",value:function(t){var e;null!==(e=this._$EO)&&void 0!==e&&e.forEach((function(t){var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}},{key:"_$EU",value:function(){this._$AL=new Map,this.isUpdatePending=!1}},{key:"updateComplete",get:function(){return this.getUpdateComplete()}},{key:"getUpdateComplete",value:function(){return this._$ES}},{key:"shouldUpdate",value:function(t){return!0}},{key:"update",value:function(t){var e=this;this._$Ej&&(this._$Ej=this._$Ej.forEach((function(t){return e._$EC(t,e[t])}))),this._$EU()}},{key:"updated",value:function(t){}},{key:"firstUpdated",value:function(t){}}],[{key:"addInitializer",value:function(t){var e;this._$Ei(),(null!==(e=this.l)&&void 0!==e?e:this.l=[]).push(t)}},{key:"observedAttributes",get:function(){return this.finalize(),this._$Eh&&v(this._$Eh.keys())}},{key:"createProperty",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nt;if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){var n=Symbol(),r=this.getPropertyDescriptor(t,n,e);void 0!==r&&V(this.prototype,t,r)}}},{key:"getPropertyDescriptor",value:function(t,e,n){var r,i=null!==(r=W(this.prototype,t))&&void 0!==r?r:{get:function(){return this[e]},set:function(t){this[e]=t}},o=i.get,a=i.set;return{get:function(){return null==o?void 0:o.call(this)},set:function(e){var r=null==o?void 0:o.call(this);a.call(this,e),this.requestUpdate(t,r,n)},configurable:!0,enumerable:!0}}},{key:"getPropertyOptions",value:function(t){var e;return null!==(e=this.elementProperties.get(t))&&void 0!==e?e:nt}},{key:"_$Ei",value:function(){if(!this.hasOwnProperty(X("elementProperties"))){var t=J(this);t.finalize(),void 0!==t.l&&(this.l=v(t.l)),this.elementProperties=new Map(t.elementProperties)}}},{key:"finalize",value:function(){if(!this.hasOwnProperty(X("finalized"))){if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(X("properties"))){var t,e=this.properties,n=O([].concat(v(G(e)),v(F(e))));try{for(n.s();!(t=n.n()).done;){var r=t.value;this.createProperty(r,e[r])}}catch(t){n.e(t)}finally{n.f()}}var i=this[Symbol.metadata];if(null!==i){var o=litPropertyMetadata.get(i);if(void 0!==o){var a,s=O(o);try{for(s.s();!(a=s.n()).done;){var u=p(a.value,2),l=u[0],c=u[1];this.elementProperties.set(l,c)}}catch(t){s.e(t)}finally{s.f()}}}this._$Eh=new Map;var h,f=O(this.elementProperties);try{for(f.s();!(h=f.n()).done;){var d=p(h.value,2),y=d[0],g=d[1],m=this._$Eu(y,g);void 0!==m&&this._$Eh.set(m,y)}}catch(t){f.e(t)}finally{f.f()}this.elementStyles=this.finalizeStyles(this.styles)}}},{key:"finalizeStyles",value:function(t){var e=[];if(Array.isArray(t)){var n,r=O(new Set(t.flat(1/0).reverse()));try{for(r.s();!(n=r.n()).done;){var i=n.value;e.unshift(B(i))}}catch(t){r.e(t)}finally{r.f()}}else void 0!==t&&e.push(B(t));return e}},{key:"_$Eu",value:function(t,e){var n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}}]),e}();rt.elementStyles=[],rt.shadowRootOptions={mode:"open"},rt[X("elementProperties")]=new Map,rt[X("finalized")]=new Map,null!=Q&&Q({ReactiveElement:rt}),(null!==(n=Y.reactiveElementVersions)&&void 0!==n?n:Y.reactiveElementVersions=[]).push("2.0.4");var it=globalThis,ot=it.trustedTypes,at=ot?ot.createPolicy("lit-html",{createHTML:function(t){return t}}):void 0,st="$lit$",ut="lit$".concat((Math.random()+"").slice(9),"$"),lt="?"+ut,ct="<".concat(lt,">"),ht=document,ft=function(){return ht.createComment("")},dt=function(t){return null===t||"object"!=L(t)&&"function"!=typeof t},vt=Array.isArray,pt="[ \t\n\f\r]",yt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gt=/-->/g,mt=/>/g,bt=RegExp(">|".concat(pt,"(?:([^\\s\"'>=/]+)(").concat(pt,"*=").concat(pt,"*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)"),"g"),_t=/'/g,wt=/"/g,$t=/^(?:script|style|textarea|title)$/i,At=function(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i":"",a=yt,s=0;s"===c[0]?(a=null!==(d=n)&&void 0!==d?d:yt,h=-1):void 0===c[1]?h=-2:(h=a.lastIndex-c[2].length,l=c[1],a=void 0===c[3]?bt:'"'===c[3]?wt:_t):a===wt||a===_t?a=bt:a===gt||a===mt?a=yt:(a=bt,n=void 0)}var v=a===bt&&t[s+1].startsWith("/>")?" ":"";o+=a===yt?u+ct:h>=0?(i.push(l),u.slice(0,h)+st+u.slice(h)+ut+v):u+ut+(-2===h?s:v)}return[xt(t,o+(t[r]||"")+(2===e?"":"")),i]},jt=function(){function t(e,n){var r,i=e.strings,o=e._$litType$;j(this,t),this.parts=[];var a=0,s=0,u=i.length-1,l=this.parts,c=p(Pt(i,o),2),h=c[0],f=c[1];if(this.el=t.createElement(h,n),Ot.currentNode=this.el.content,2===o){var d=this.el.content.firstChild;d.replaceWith.apply(d,v(d.childNodes))}for(;null!==(r=Ot.nextNode())&&l.length0){r.textContent=ot?ot.emptyScript:"";for(var k=0;k2&&void 0!==arguments[2]?arguments[2]:t,u=arguments.length>3?arguments[3]:void 0;if(e===kt)return e;var l=void 0!==u?null===(n=s._$Co)||void 0===n?void 0:n[u]:s._$Cl,c=dt(e)?void 0:e._$litDirective$;return(null===(r=l)||void 0===r?void 0:r.constructor)!==c&&(null!==(i=l)&&void 0!==i&&null!==(o=i._$AO)&&void 0!==o&&o.call(i,!1),void 0===c?l=void 0:(l=new c(t))._$AT(t,s,u),void 0!==u?(null!==(a=s._$Co)&&void 0!==a?a:s._$Co=[])[u]=l:s._$Cl=l),void 0!==l&&(e=Ct(t,l._$AS(t,e.values),l,u)),e}var Tt=function(){function t(e,n){j(this,t),this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}return T(t,[{key:"parentNode",get:function(){return this._$AM.parentNode}},{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"u",value:function(t){var e,n=this._$AD,r=n.el.content,i=n.parts,o=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:ht).importNode(r,!0);Ot.currentNode=o;for(var a=Ot.nextNode(),s=0,u=0,l=i[0];void 0!==l;){var c;if(s===l.index){var h=void 0;2===l.type?h=new Ut(a,a.nextSibling,this,t):1===l.type?h=new l.ctor(a,l.name,l.strings,this,t):6===l.type&&(h=new Ht(a,this,t)),this._$AV.push(h),l=i[++u]}s!==(null===(c=l)||void 0===c?void 0:c.index)&&(a=Ot.nextNode(),s++)}return Ot.currentNode=ht,o}},{key:"p",value:function(t){var e,n=0,r=O(this._$AV);try{for(r.s();!(e=r.n()).done;){var i=e.value;void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,n),n+=i.strings.length-2):i._$AI(t[n])),n++}}catch(t){r.e(t)}finally{r.f()}}}]),t}(),Ut=function(){function t(e,n,r,i){var o;j(this,t),this.type=2,this._$AH=Et,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=r,this.options=i,this._$Cv=null===(o=null==i?void 0:i.isConnected)||void 0===o||o}return T(t,[{key:"_$AU",get:function(){var t,e;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cv}},{key:"parentNode",get:function(){var t,e=this._$AA.parentNode,n=this._$AM;return void 0!==n&&11===(null===(t=e)||void 0===t?void 0:t.nodeType)&&(e=n.parentNode),e}},{key:"startNode",get:function(){return this._$AA}},{key:"endNode",get:function(){return this._$AB}},{key:"_$AI",value:function(t){t=Ct(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this),dt(t)?t===Et||null==t||""===t?(this._$AH!==Et&&this._$AR(),this._$AH=Et):t!==this._$AH&&t!==kt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):function(t){return vt(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator])}(t)?this.k(t):this._(t)}},{key:"S",value:function(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}},{key:"T",value:function(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}},{key:"_",value:function(t){this._$AH!==Et&&dt(this._$AH)?this._$AA.nextSibling.data=t:this.T(ht.createTextNode(t)),this._$AH=t}},{key:"$",value:function(t){var e,n=t.values,r=t._$litType$,i="number"==typeof r?this._$AC(t):(void 0===r.el&&(r.el=jt.createElement(xt(r.h,r.h[0]),this.options)),r);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.p(n);else{var o=new Tt(i,this),a=o.u(this.options);o.p(n),this.T(a),this._$AH=o}}},{key:"_$AC",value:function(t){var e=St.get(t.strings);return void 0===e&&St.set(t.strings,e=new jt(t)),e}},{key:"k",value:function(e){vt(this._$AH)||(this._$AH=[],this._$AR());var n,r,i=this._$AH,o=0,a=O(e);try{for(a.s();!(r=a.n()).done;){var s=r.value;o===i.length?i.push(n=new t(this.S(ft()),this.S(ft()),this,this.options)):n=i[o],n._$AI(s),o++}}catch(t){a.e(t)}finally{a.f()}o0&&void 0!==arguments[0]?arguments[0]:this._$AA.nextSibling,e=arguments.length>1?arguments[1]:void 0;for(null===(n=this._$AP)||void 0===n||n.call(this,!1,!0,e);t&&t!==this._$AB;){var n,r=t.nextSibling;t.remove(),t=r}}},{key:"setConnected",value:function(t){var e;void 0===this._$AM&&(this._$Cv=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}]),t}(),Lt=function(){function t(e,n,r,i,o){j(this,t),this.type=1,this._$AH=Et,this._$AN=void 0,this.element=e,this.name=n,this._$AM=i,this.options=o,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Et}return T(t,[{key:"tagName",get:function(){return this.element.tagName}},{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"_$AI",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=this.strings,o=!1;if(void 0===i)t=Ct(this,t,e,0),(o=!dt(t)||t!==this._$AH&&t!==kt)&&(this._$AH=t);else{var a,s,u=t;for(t=i[0],a=0;a1&&void 0!==arguments[1]?arguments[1]:this,0))&&void 0!==e?e:Et)!==kt){var n=this._$AH,r=t===Et&&n!==Et||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==Et&&(n===Et||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}}},{key:"handleEvent",value:function(t){var e,n;"function"==typeof this._$AH?this._$AH.call(null!==(e=null===(n=this.options)||void 0===n?void 0:n.host)&&void 0!==e?e:this.element,t):this._$AH.handleEvent(t)}}]),e}(),Ht=function(){function t(e,n,r){j(this,t),this.element=e,this.type=6,this._$AN=void 0,this._$AM=n,this.options=r}return T(t,[{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"_$AI",value:function(t){Ct(this,t)}}]),t}(),Dt=it.litHtmlPolyfillSupport;null!=Dt&&Dt(jt,Ut),(null!==(r=it.litHtmlVersions)&&void 0!==r?r:it.litHtmlVersions=[]).push("3.1.2");var It=function(t){function e(){var t;return j(this,e),(t=b(this,e,arguments)).renderOptions={host:w(t)},t._$Do=void 0,t}return $(e,rt),T(e,[{key:"createRenderRoot",value:function(){var t,n,r=d(S(e.prototype),"createRenderRoot",this).call(this);return null!==(n=(t=this.renderOptions).renderBefore)&&void 0!==n||(t.renderBefore=r.firstChild),r}},{key:"update",value:function(t){var n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),d(S(e.prototype),"update",this).call(this,t),this._$Do=function(t,e,n){var r,i=null!==(r=null==n?void 0:n.renderBefore)&&void 0!==r?r:e,o=i._$litPart$;if(void 0===o){var a,s=null!==(a=null==n?void 0:n.renderBefore)&&void 0!==a?a:null;i._$litPart$=o=new Ut(e.insertBefore(ft(),s),s,void 0,null!=n?n:{})}return o._$AI(t),o}(n,this.renderRoot,this.renderOptions)}},{key:"connectedCallback",value:function(){var t;d(S(e.prototype),"connectedCallback",this).call(this),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}},{key:"disconnectedCallback",value:function(){var t;d(S(e.prototype),"disconnectedCallback",this).call(this),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}},{key:"render",value:function(){return kt}}]),e}();It._$litElement$=!0,It.finalized=!0,null===(i=globalThis.litElementHydrateSupport)||void 0===i||i.call(globalThis,{LitElement:It});var zt=globalThis.litElementPolyfillSupport;null==zt||zt({LitElement:It}),(null!==(o=globalThis.litElementVersions)&&void 0!==o?o:globalThis.litElementVersions=[]).push("4.0.4");var Bt={attribute:!0,type:String,converter:tt,reflect:!1,hasChanged:et},qt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Bt,e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=n.kind,i=n.metadata,o=globalThis.litPropertyMetadata.get(i);if(void 0===o&&globalThis.litPropertyMetadata.set(i,o=new Map),o.set(n.name,t),"accessor"===r){var a=n.name;return{set:function(n){var r=e.get.call(this);e.set.call(this,n),this.requestUpdate(a,r,t)},init:function(e){return void 0!==e&&this.P(a,void 0,t),e}}}if("setter"===r){var s=n.name;return function(n){var r=this[s];e.call(this,n),this.requestUpdate(s,r,t)}}throw Error("Unsupported decorator location: "+r)};function Vt(t){return function(e,n){return"object"==L(n)?qt(t,e,n):function(t,e,n){var r=e.hasOwnProperty(n);return e.constructor.createProperty(n,r?h(h({},t),{},{wrapped:!0}):t),r?Object.getOwnPropertyDescriptor(e,n):void 0}(t,e,n)}}var Wt=1,Gt=function(){function t(e){j(this,t)}return T(t,[{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"_$AT",value:function(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}},{key:"_$AS",value:function(t,e){return this.update(t,e)}},{key:"update",value:function(t,e){return this.render.apply(this,v(e))}}]),t}(),Ft=function(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");return _(r)}return $(e,Gt),T(e,[{key:"render",value:function(t){return" "+Object.keys(t).filter((function(e){return t[e]})).join(" ")+" "}},{key:"update",value:function(t,e){var n=p(e,1)[0];if(void 0===this.st){for(var r in this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((function(t){return""!==t})))),n){var i;n[r]&&(null===(i=this.nt)||void 0===i||!i.has(r))&&this.st.add(r)}return this.render(n)}var o,a=t.element.classList,s=O(this.st);try{for(s.s();!(o=s.n()).done;){var u=o.value;u in n||(a.remove(u),this.st.delete(u))}}catch(t){s.e(t)}finally{s.f()}for(var l in n){var c,h=!!n[l];h===this.st.has(l)||(null===(c=this.nt)||void 0===c?void 0:c.has(l))||(h?(a.add(l),this.st.add(l)):(a.remove(l),this.st.delete(l)))}return kt}}]),e}());function Jt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return customElements.whenDefined("long-press").then((function(){var e,n=document.body.querySelector("long-press");null===(e=n.bind)||void 0===e||e.call(n,t)})),customElements.whenDefined("action-handler").then((function(){var n,r=document.body.querySelector("action-handler");null===(n=r.bind)||void 0===n||n.call(r,t,e)})),t}var Yt="1.3.3";function Kt(){return Zt.apply(this,arguments)}function Zt(){return Zt=m(y().mark((function t(){var e;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.race([customElements.whenDefined("home-assistant"),customElements.whenDefined("hc-main")]);case 2:e=customElements.get("home-assistant")?"home-assistant":"hc-main";case 3:if(document.querySelector(e)){t.next=8;break}return t.next=6,new Promise((function(t){return window.setTimeout(t,100)}));case 6:t.next=3;break;case 8:return t.abrupt("return",document.querySelector(e));case 9:case"end":return t.stop()}}),t)}))),Zt.apply(this,arguments)}function Qt(){return Xt.apply(this,arguments)}function Xt(){return Xt=m(y().mark((function t(){var e;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Kt();case 2:e=t.sent;case 3:if(e.hass){t.next=8;break}return t.next=6,new Promise((function(t){return window.setTimeout(t,100)}));case 6:t.next=3;break;case 8:return t.abrupt("return",e.hass);case 9:case"end":return t.stop()}}),t)}))),Xt.apply(this,arguments)}var te="browser_mod-browser-id";function ee(){return document.querySelector("hc-main")?"CAST":localStorage[te]?localStorage[te]:""}window.cardMod_template_cache=window.cardMod_template_cache||{};var ne=window.cardMod_template_cache;function re(t,e){var n=ne[t];n&&(n.value=e.result,n.callbacks.forEach((function(t){return t(e.result)})))}function ie(){return(ie=m(y().mark((function t(e,n,r){var i,o,a,s;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Qt();case 2:i=t.sent,o=i.connection,a=JSON.stringify([n,r]),(s=ne[a])?(s.callbacks.has(e)||oe(e),e(s.value),s.callbacks.add(e)):(oe(e),e(""),r=Object.assign({user:i.user.name,browser:ee,hash:location.hash.substr(1)||""},r),ne[a]=s={template:n,variables:r,value:"",callbacks:new Set([e]),unsubscribe:o.subscribeMessage((function(t){return re(a,t)}),{type:"render_template",template:n,variables:r})});case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function oe(t){return ae.apply(this,arguments)}function ae(){return(ae=m(y().mark((function t(e){var n,r,i,o,a,s;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=0,i=Object.entries(ne);case 1:if(!(r\n \n ','\n
','
\n \n
\n ','\n
\n \n
\n t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,s))(e)})(t):t;var a;const h=window,c=h.trustedTypes,d=c?c.emptyScript:"",u=h.reactiveElementPolyfillSupport,p={toAttribute(t,e){switch(e){case Boolean:t=t?d:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},v=(t,e)=>e!==t&&(e==e||t==t),f={attribute:!0,type:String,converter:p,reflect:!1,hasChanged:v};let g=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const s=this._$Ep(i,e);void 0!==s&&(this._$Ev.set(s,i),t.push(s))})),t}static createProperty(t,e=f){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const n=this[t];this[e]=s,this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||f}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const s=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,s)=>{i?t.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):s.forEach((i=>{const s=document.createElement("style"),n=e.litNonce;void 0!==n&&s.setAttribute("nonce",n),s.textContent=i.cssText,t.appendChild(s)}))})(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=f){var s;const n=this.constructor._$Ep(t,i);if(void 0!==n&&!0===i.reflect){const o=(void 0!==(null===(s=i.converter)||void 0===s?void 0:s.toAttribute)?i.converter:p).toAttribute(e,i.type);this._$El=t,null==o?this.removeAttribute(n):this.setAttribute(n,o),this._$El=null}}_$AK(t,e){var i;const s=this.constructor,n=s._$Ev.get(t);if(void 0!==n&&this._$El!==n){const t=s.getPropertyOptions(n),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:p;this._$El=n,this[n]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||v)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};var _;g.finalized=!0,g.elementProperties=new Map,g.elementStyles=[],g.shadowRootOptions={mode:"open"},null==u||u({ReactiveElement:g}),(null!==(a=h.reactiveElementVersions)&&void 0!==a?a:h.reactiveElementVersions=[]).push("1.6.1");const $=window,y=$.trustedTypes,m=y?y.createPolicy("lit-html",{createHTML:t=>t}):void 0,A="$lit$",b=`lit$${(Math.random()+"").slice(9)}$`,S="?"+b,E=`<${S}>`,w=document,C=()=>w.createComment(""),x=t=>null===t||"object"!=typeof t&&"function"!=typeof t,P=Array.isArray,O="[ \t\n\f\r]",U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,H=/-->/g,T=/>/g,k=RegExp(`>|${O}(?:([^\\s"'>=/]+)(${O}*=${O}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),M=/'/g,N=/"/g,R=/^(?:script|style|textarea|title)$/i,j=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),D=Symbol.for("lit-noChange"),I=Symbol.for("lit-nothing"),L=new WeakMap,z=w.createTreeWalker(w,129,null,!1),B=(t,e)=>{const i=t.length-1,s=[];let n,o=2===e?"":"",r=U;for(let e=0;e"===a[0]?(r=null!=n?n:U,h=-1):void 0===a[1]?h=-2:(h=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?k:'"'===a[3]?N:M):r===N||r===M?r=k:r===H||r===T?r=U:(r=k,n=void 0);const d=r===k&&t[e+1].startsWith("/>")?" ":"";o+=r===U?i+E:h>=0?(s.push(l),i.slice(0,h)+A+i.slice(h)+b+d):i+b+(-2===h?(s.push(void 0),e):d)}const l=o+(t[i]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==m?m.createHTML(l):l,s]};class q{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const r=t.length-1,l=this.parts,[a,h]=B(t,e);if(this.el=q.createElement(a,i),z.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=z.nextNode())&&l.length0){s.textContent=y?y.emptyScript:"";for(let i=0;iP(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}g(t){this._$AH!==I&&x(this._$AH)?this._$AA.nextSibling.data=t:this.T(w.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=q.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===n)this._$AH.p(i);else{const t=new W(n,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=L.get(t.strings);return void 0===e&&L.set(t.strings,e=new q(t)),e}k(t){P(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new J(this.S(C()),this.S(C()),this,this.options)):i=e[s],i._$AI(n),s++;s2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=I}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(void 0===n)t=V(this,t,e,0),o=!x(t)||t!==this._$AH&&t!==D,o&&(this._$AH=t);else{const s=t;let r,l;for(t=n[0],r=0;r{var s,n;const o=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let r=o._$litPart$;if(void 0===r){const t=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:null;o._$litPart$=r=new J(e.insertBefore(C(),t),t,void 0,null!=i?i:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return D}}it.finalized=!0,it._$litElement$=!0,null===(tt=globalThis.litElementHydrateSupport)||void 0===tt||tt.call(globalThis,{LitElement:it});const st=globalThis.litElementPolyfillSupport;null==st||st({LitElement:it}),(null!==(et=globalThis.litElementVersions)&&void 0!==et?et:globalThis.litElementVersions=[]).push("3.3.0");const nt=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};function ot(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):nt(t,e)}var rt;null===(rt=window.HTMLSlotElement)||void 0===rt||rt.prototype.assignedElements;const lt=1;class at{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const ht=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends at{constructor(t){var e;if(super(t),t.type!==lt||"class"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){var i,s;if(void 0===this.nt){this.nt=new Set,void 0!==t.strings&&(this.st=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!(null===(i=this.st)||void 0===i?void 0:i.has(t))&&this.nt.add(t);return this.render(e)}const n=t.element.classList;this.nt.forEach((t=>{t in e||(n.remove(t),this.nt.delete(t))}));for(const t in e){const i=!!e[t];i===this.nt.has(t)||(null===(s=this.st)||void 0===s?void 0:s.has(t))||(i?(n.add(t),this.nt.add(t)):(n.remove(t),this.nt.delete(t)))}return D}});function ct(){return document.querySelector("hc-main")?document.querySelector("hc-main").hass:document.querySelector("home-assistant")?document.querySelector("home-assistant").hass:void 0}const dt="lovelace-player-device-id";function ut(){if(!localStorage[dt]){const t=()=>Math.floor(1e5*(1+Math.random())).toString(16).substring(1);window.fully&&"function"==typeof fully.getDeviceId?localStorage[dt]=fully.getDeviceId():localStorage[dt]=`${t()}${t()}-${t()}${t()}`}return localStorage[dt]}let pt=ut();const vt=new URLSearchParams(window.location.search);var ft;function gt(t,e={}){return customElements.whenDefined("long-press").then((()=>{document.body.querySelector("long-press").bind(t)})),customElements.whenDefined("action-handler").then((()=>{document.body.querySelector("action-handler").bind(t,e)})),t}vt.get("deviceID")&&null!==(ft=vt.get("deviceID"))&&("clear"===ft?localStorage.removeItem(dt):localStorage[dt]=ft,pt=ut());var _t="1.3.2";window.cardMod_template_cache=window.cardMod_template_cache||{};const $t=window.cardMod_template_cache;async function yt(t,e,i){const s=ct().connection,n=JSON.stringify([e,i]);let o=$t[n];o?(o.callbacks.has(t)||mt(t),t(o.value),o.callbacks.add(t)):(mt(t),t(""),i=Object.assign({user:ct().user.name,browser:pt,hash:location.hash.substr(1)||""},i),$t[n]=o={template:e,variables:i,value:"",callbacks:new Set([t]),unsubscribe:s.subscribeMessage((t=>function(t,e){const i=$t[t];i&&(i.value=e.result,i.callbacks.forEach((t=>t(e.result))))}(n,t)),{type:"render_template",template:e,variables:i})})}async function mt(t){let e;for(const[i,s]of Object.entries($t))if(s.callbacks.has(t)){s.callbacks.delete(t),0==s.callbacks.size&&(e=s.unsubscribe,delete $t[i]);break}e&&await(await e)()}const At=["icon","active","name","secondary","state","condition","image","entity","color","toggle","tap_action","hold_action","double_tap_action"],bt=/_\([^)]*\)/g,St=(t,e)=>e.replace(bt,(e=>t.localize(e.substring(2,e.length-1))||e));class Et extends it{setConfig(t){this._config=Object.assign({},t),this.config=Object.assign({},this._config);for(const i of At)this._config[i]&&(e=this._config[i],String(e).includes("{%")||String(e).includes("{{")?yt((t=>{const e=Object.assign({},this.config);"string"==typeof t&&(t=St(ct(),t)),e[i]=t,this.config=e}),this._config[i],{config:t}):"string"==typeof this._config[i]&&(this.config[i]=St(ct(),this._config[i])));var e}async firstUpdated(){const t=this.shadowRoot.querySelector("#staging hui-generic-entity-row");if(!t)return;await t.updateComplete,this._action=t._handleAction;const e={hasHold:void 0!==this._config.hold_action,hasDoubleClick:void 0!==this._config.hold_action};(this.config.entity||this.config.tap_action||this.config.hold_action||this.config.double_tap_action)&&(gt(this.shadowRoot.querySelector("state-badge"),e),gt(this.shadowRoot.querySelector(".info"),e))}_actionHandler(t){var e;return null===(e=this._action)||void 0===e?void 0:e.call(this,t)}render(){var t,e,i,s,n;const o=this.hass.states[this.config.entity],r=o&&JSON.parse(JSON.stringify(o))||{entity_id:"light.",attributes:{icon:"no:icon",friendly_name:""},state:"off"},l=void 0!==this.config.icon?this.config.icon||"no:icon":void 0,a=this.config.image;let h=this.config.color;const c=null!==(i=null!==(t=this.config.name)&&void 0!==t?t:null===(e=null==r?void 0:r.attributes)||void 0===e?void 0:e.friendly_name)&&void 0!==i?i:null==r?void 0:r.entity_id,d=this.config.secondary,u=null!==(s=this.config.state)&&void 0!==s?s:null==r?void 0:r.state;null!==(n=this.config.active)&&void 0!==n&&n&&(r.attributes.brightness=255,r.state="on"),!1===this.config.active&&(r.state="off",h=null!=h?h:"var(--paper-item-icon-color, #44739e)");const p=void 0!==this.config.condition&&"true"!==String(this.config.condition).toLowerCase(),v=this.config.toggle&&this.config.entity,f=this.config.entity||this.config.tap_action||this.config.hold_action||this.config.double_tap_action;return j` -
- -
- ${c} -
${d}
-
-
- ${v?j` - `:u} -
-
-
- - -
- `}static get styles(){var t;return[null===(t=customElements.get("hui-generic-entity-row"))||void 0===t?void 0:t.styles,r` - :host { - display: inline; - } - #wrapper { - display: flex; - align-items: center; - flex-direction: row; - } - .state { - text-align: right; - } - #wrapper { - min-height: 40px; - } - #wrapper.hidden { - display: none; - } - #staging { - display: none; - } - `]}}t([ot()],Et.prototype,"_config",void 0),t([ot()],Et.prototype,"hass",void 0),t([ot()],Et.prototype,"config",void 0),t([ot()],Et.prototype,"_action",void 0),customElements.get("template-entity-row")||(customElements.define("template-entity-row",Et),console.info(`%cTEMPLATE-ENTITY-ROW ${_t} IS INSTALLED`,"color: green; font-weight: bold","")); +var t,e,n,r,i,o,a,s,u;function l(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function h(t){for(var e=1;e=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;j(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:T(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function g(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function m(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){g(o,r,i,a,s,"next",t)}function s(t){g(o,r,i,a,s,"throw",t)}a(void 0)}))}}function b(t,e,n){return e=S(e),_(t,k()?Reflect.construct(e,n||[],S(t).constructor):e.apply(t,n))}function _(t,e){if(e&&("object"===L(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return w(t)}function w(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}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&&E(t,e)}function A(t){var e="function"==typeof Map?new Map:void 0;return A=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(k())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&E(i,n.prototype),i}(t,arguments,S(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),E(n,t)},A(t)}function k(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(k=function(){return!!t})()}function E(t,e){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},E(t,e)}function S(t){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},S(t)}function O(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=x(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},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 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 x(t,e){if(t){if("string"==typeof t)return P(t,e);var n=Object.prototype.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)?P(t,e):void 0}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}"function"==typeof SuppressedError&&SuppressedError;var N=globalThis,M=N.ShadowRoot&&(void 0===N.ShadyCSS||N.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,H=Symbol(),D=new WeakMap,I=function(){function t(e,n,r){if(j(this,t),this._$cssResult$=!0,r!==H)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}return T(t,[{key:"styleSheet",get:function(){var t=this.o,e=this.t;if(M&&void 0===t){var n=void 0!==e&&1===e.length;n&&(t=D.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&D.set(e,t))}return t}},{key:"toString",value:function(){return this.cssText}}]),t}(),z=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r0&&(this._$Ep=e)}},{key:"createRenderRoot",value:function(){var t,e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return function(t,e){if(M)t.adoptedStyleSheets=e.map((function(t){return t instanceof CSSStyleSheet?t:t.styleSheet}));else{var n,r=O(e);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=document.createElement("style"),a=N.litNonce;void 0!==a&&o.setAttribute("nonce",a),o.textContent=i.cssText,t.appendChild(o)}}catch(t){r.e(t)}finally{r.f()}}}(e,this.constructor.elementStyles),e}},{key:"connectedCallback",value:function(){var t,e;null!==(t=this.renderRoot)&&void 0!==t||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$EO)||void 0===e||e.forEach((function(t){var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}},{key:"enableUpdating",value:function(t){}},{key:"disconnectedCallback",value:function(){var t;null===(t=this._$EO)||void 0===t||t.forEach((function(t){var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}},{key:"attributeChangedCallback",value:function(t,e,n){this._$AK(t,n)}},{key:"_$EC",value:function(t,e){var n=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,n);if(void 0!==r&&!0===n.reflect){var i,o=(void 0!==(null===(i=n.converter)||void 0===i?void 0:i.toAttribute)?n.converter:tt).toAttribute(e,n.type);this._$Em=t,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}},{key:"_$AK",value:function(t,e){var n=this.constructor,r=n._$Eh.get(t);if(void 0!==r&&this._$Em!==r){var i,o=n.getPropertyOptions(r),a="function"==typeof o.converter?{fromAttribute:o.converter}:void 0!==(null===(i=o.converter)||void 0===i?void 0:i.fromAttribute)?o.converter:tt;this._$Em=r,this[r]=a.fromAttribute(e,o.type),this._$Em=null}}},{key:"requestUpdate",value:function(t,e,n){if(void 0!==t){var r,i;if(null!==(r=n)&&void 0!==r||(n=this.constructor.getPropertyOptions(t)),!(null!==(i=n.hasChanged)&&void 0!==i?i:et)(this[t],e))return;this.P(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}},{key:"P",value:function(t,e,n){var r;this._$AL.has(t)||this._$AL.set(t,e),!0===n.reflect&&this._$Em!==t&&(null!==(r=this._$Ej)&&void 0!==r?r:this._$Ej=new Set).add(t)}},{key:"_$ET",value:(n=m(y().mark((function t(){var e;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isUpdatePending=!0,t.prev=1,t.next=4,this._$ES;case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),Promise.reject(t.t0);case 9:if(e=this.scheduleUpdate(),t.t1=null!=e,!t.t1){t.next=14;break}return t.next=14,e;case 14:return t.abrupt("return",!this.isUpdatePending);case 15:case"end":return t.stop()}}),t,this,[[1,6]])}))),function(){return n.apply(this,arguments)})},{key:"scheduleUpdate",value:function(){return this.performUpdate()}},{key:"performUpdate",value:function(){if(this.isUpdatePending){if(!this.hasUpdated){var t;if(null!==(t=this.renderRoot)&&void 0!==t||(this.renderRoot=this.createRenderRoot()),this._$Ep){var e,n=O(this._$Ep);try{for(n.s();!(e=n.n()).done;){var r=p(e.value,2),i=r[0],o=r[1];this[i]=o}}catch(t){n.e(t)}finally{n.f()}this._$Ep=void 0}var a=this.constructor.elementProperties;if(a.size>0){var s,u=O(a);try{for(u.s();!(s=u.n()).done;){var l=p(s.value,2),c=l[0],h=l[1];!0!==h.wrapped||this._$AL.has(c)||void 0===this[c]||this.P(c,this[c],h)}}catch(t){u.e(t)}finally{u.f()}}}var f=!1,d=this._$AL;try{var v;(f=this.shouldUpdate(d))?(this.willUpdate(d),null!==(v=this._$EO)&&void 0!==v&&v.forEach((function(t){var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(d)):this._$EU()}catch(d){throw f=!1,this._$EU(),d}f&&this._$AE(d)}}},{key:"willUpdate",value:function(t){}},{key:"_$AE",value:function(t){var e;null!==(e=this._$EO)&&void 0!==e&&e.forEach((function(t){var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}},{key:"_$EU",value:function(){this._$AL=new Map,this.isUpdatePending=!1}},{key:"updateComplete",get:function(){return this.getUpdateComplete()}},{key:"getUpdateComplete",value:function(){return this._$ES}},{key:"shouldUpdate",value:function(t){return!0}},{key:"update",value:function(t){var e=this;this._$Ej&&(this._$Ej=this._$Ej.forEach((function(t){return e._$EC(t,e[t])}))),this._$EU()}},{key:"updated",value:function(t){}},{key:"firstUpdated",value:function(t){}}],[{key:"addInitializer",value:function(t){var e;this._$Ei(),(null!==(e=this.l)&&void 0!==e?e:this.l=[]).push(t)}},{key:"observedAttributes",get:function(){return this.finalize(),this._$Eh&&v(this._$Eh.keys())}},{key:"createProperty",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nt;if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){var n=Symbol(),r=this.getPropertyDescriptor(t,n,e);void 0!==r&&V(this.prototype,t,r)}}},{key:"getPropertyDescriptor",value:function(t,e,n){var r,i=null!==(r=W(this.prototype,t))&&void 0!==r?r:{get:function(){return this[e]},set:function(t){this[e]=t}},o=i.get,a=i.set;return{get:function(){return null==o?void 0:o.call(this)},set:function(e){var r=null==o?void 0:o.call(this);a.call(this,e),this.requestUpdate(t,r,n)},configurable:!0,enumerable:!0}}},{key:"getPropertyOptions",value:function(t){var e;return null!==(e=this.elementProperties.get(t))&&void 0!==e?e:nt}},{key:"_$Ei",value:function(){if(!this.hasOwnProperty(X("elementProperties"))){var t=J(this);t.finalize(),void 0!==t.l&&(this.l=v(t.l)),this.elementProperties=new Map(t.elementProperties)}}},{key:"finalize",value:function(){if(!this.hasOwnProperty(X("finalized"))){if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(X("properties"))){var t,e=this.properties,n=O([].concat(v(G(e)),v(F(e))));try{for(n.s();!(t=n.n()).done;){var r=t.value;this.createProperty(r,e[r])}}catch(t){n.e(t)}finally{n.f()}}var i=this[Symbol.metadata];if(null!==i){var o=litPropertyMetadata.get(i);if(void 0!==o){var a,s=O(o);try{for(s.s();!(a=s.n()).done;){var u=p(a.value,2),l=u[0],c=u[1];this.elementProperties.set(l,c)}}catch(t){s.e(t)}finally{s.f()}}}this._$Eh=new Map;var h,f=O(this.elementProperties);try{for(f.s();!(h=f.n()).done;){var d=p(h.value,2),y=d[0],g=d[1],m=this._$Eu(y,g);void 0!==m&&this._$Eh.set(m,y)}}catch(t){f.e(t)}finally{f.f()}this.elementStyles=this.finalizeStyles(this.styles)}}},{key:"finalizeStyles",value:function(t){var e=[];if(Array.isArray(t)){var n,r=O(new Set(t.flat(1/0).reverse()));try{for(r.s();!(n=r.n()).done;){var i=n.value;e.unshift(B(i))}}catch(t){r.e(t)}finally{r.f()}}else void 0!==t&&e.push(B(t));return e}},{key:"_$Eu",value:function(t,e){var n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}}]),e}();rt.elementStyles=[],rt.shadowRootOptions={mode:"open"},rt[X("elementProperties")]=new Map,rt[X("finalized")]=new Map,null!=Q&&Q({ReactiveElement:rt}),(null!==(n=Y.reactiveElementVersions)&&void 0!==n?n:Y.reactiveElementVersions=[]).push("2.0.4");var it=globalThis,ot=it.trustedTypes,at=ot?ot.createPolicy("lit-html",{createHTML:function(t){return t}}):void 0,st="$lit$",ut="lit$".concat((Math.random()+"").slice(9),"$"),lt="?"+ut,ct="<".concat(lt,">"),ht=document,ft=function(){return ht.createComment("")},dt=function(t){return null===t||"object"!=L(t)&&"function"!=typeof t},vt=Array.isArray,pt="[ \t\n\f\r]",yt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gt=/-->/g,mt=/>/g,bt=RegExp(">|".concat(pt,"(?:([^\\s\"'>=/]+)(").concat(pt,"*=").concat(pt,"*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)"),"g"),_t=/'/g,wt=/"/g,$t=/^(?:script|style|textarea|title)$/i,At=function(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i":"",a=yt,s=0;s"===c[0]?(a=null!==(d=n)&&void 0!==d?d:yt,h=-1):void 0===c[1]?h=-2:(h=a.lastIndex-c[2].length,l=c[1],a=void 0===c[3]?bt:'"'===c[3]?wt:_t):a===wt||a===_t?a=bt:a===gt||a===mt?a=yt:(a=bt,n=void 0)}var v=a===bt&&t[s+1].startsWith("/>")?" ":"";o+=a===yt?u+ct:h>=0?(i.push(l),u.slice(0,h)+st+u.slice(h)+ut+v):u+ut+(-2===h?s:v)}return[xt(t,o+(t[r]||"")+(2===e?"":"")),i]},jt=function(){function t(e,n){var r,i=e.strings,o=e._$litType$;j(this,t),this.parts=[];var a=0,s=0,u=i.length-1,l=this.parts,c=p(Pt(i,o),2),h=c[0],f=c[1];if(this.el=t.createElement(h,n),Ot.currentNode=this.el.content,2===o){var d=this.el.content.firstChild;d.replaceWith.apply(d,v(d.childNodes))}for(;null!==(r=Ot.nextNode())&&l.length0){r.textContent=ot?ot.emptyScript:"";for(var k=0;k2&&void 0!==arguments[2]?arguments[2]:t,u=arguments.length>3?arguments[3]:void 0;if(e===kt)return e;var l=void 0!==u?null===(n=s._$Co)||void 0===n?void 0:n[u]:s._$Cl,c=dt(e)?void 0:e._$litDirective$;return(null===(r=l)||void 0===r?void 0:r.constructor)!==c&&(null!==(i=l)&&void 0!==i&&null!==(o=i._$AO)&&void 0!==o&&o.call(i,!1),void 0===c?l=void 0:(l=new c(t))._$AT(t,s,u),void 0!==u?(null!==(a=s._$Co)&&void 0!==a?a:s._$Co=[])[u]=l:s._$Cl=l),void 0!==l&&(e=Ct(t,l._$AS(t,e.values),l,u)),e}var Tt=function(){function t(e,n){j(this,t),this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}return T(t,[{key:"parentNode",get:function(){return this._$AM.parentNode}},{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"u",value:function(t){var e,n=this._$AD,r=n.el.content,i=n.parts,o=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:ht).importNode(r,!0);Ot.currentNode=o;for(var a=Ot.nextNode(),s=0,u=0,l=i[0];void 0!==l;){var c;if(s===l.index){var h=void 0;2===l.type?h=new Ut(a,a.nextSibling,this,t):1===l.type?h=new l.ctor(a,l.name,l.strings,this,t):6===l.type&&(h=new Ht(a,this,t)),this._$AV.push(h),l=i[++u]}s!==(null===(c=l)||void 0===c?void 0:c.index)&&(a=Ot.nextNode(),s++)}return Ot.currentNode=ht,o}},{key:"p",value:function(t){var e,n=0,r=O(this._$AV);try{for(r.s();!(e=r.n()).done;){var i=e.value;void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,n),n+=i.strings.length-2):i._$AI(t[n])),n++}}catch(t){r.e(t)}finally{r.f()}}}]),t}(),Ut=function(){function t(e,n,r,i){var o;j(this,t),this.type=2,this._$AH=Et,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=r,this.options=i,this._$Cv=null===(o=null==i?void 0:i.isConnected)||void 0===o||o}return T(t,[{key:"_$AU",get:function(){var t,e;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cv}},{key:"parentNode",get:function(){var t,e=this._$AA.parentNode,n=this._$AM;return void 0!==n&&11===(null===(t=e)||void 0===t?void 0:t.nodeType)&&(e=n.parentNode),e}},{key:"startNode",get:function(){return this._$AA}},{key:"endNode",get:function(){return this._$AB}},{key:"_$AI",value:function(t){t=Ct(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this),dt(t)?t===Et||null==t||""===t?(this._$AH!==Et&&this._$AR(),this._$AH=Et):t!==this._$AH&&t!==kt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):function(t){return vt(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator])}(t)?this.k(t):this._(t)}},{key:"S",value:function(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}},{key:"T",value:function(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}},{key:"_",value:function(t){this._$AH!==Et&&dt(this._$AH)?this._$AA.nextSibling.data=t:this.T(ht.createTextNode(t)),this._$AH=t}},{key:"$",value:function(t){var e,n=t.values,r=t._$litType$,i="number"==typeof r?this._$AC(t):(void 0===r.el&&(r.el=jt.createElement(xt(r.h,r.h[0]),this.options)),r);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.p(n);else{var o=new Tt(i,this),a=o.u(this.options);o.p(n),this.T(a),this._$AH=o}}},{key:"_$AC",value:function(t){var e=St.get(t.strings);return void 0===e&&St.set(t.strings,e=new jt(t)),e}},{key:"k",value:function(e){vt(this._$AH)||(this._$AH=[],this._$AR());var n,r,i=this._$AH,o=0,a=O(e);try{for(a.s();!(r=a.n()).done;){var s=r.value;o===i.length?i.push(n=new t(this.S(ft()),this.S(ft()),this,this.options)):n=i[o],n._$AI(s),o++}}catch(t){a.e(t)}finally{a.f()}o0&&void 0!==arguments[0]?arguments[0]:this._$AA.nextSibling,e=arguments.length>1?arguments[1]:void 0;for(null===(n=this._$AP)||void 0===n||n.call(this,!1,!0,e);t&&t!==this._$AB;){var n,r=t.nextSibling;t.remove(),t=r}}},{key:"setConnected",value:function(t){var e;void 0===this._$AM&&(this._$Cv=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}]),t}(),Lt=function(){function t(e,n,r,i,o){j(this,t),this.type=1,this._$AH=Et,this._$AN=void 0,this.element=e,this.name=n,this._$AM=i,this.options=o,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Et}return T(t,[{key:"tagName",get:function(){return this.element.tagName}},{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"_$AI",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=this.strings,o=!1;if(void 0===i)t=Ct(this,t,e,0),(o=!dt(t)||t!==this._$AH&&t!==kt)&&(this._$AH=t);else{var a,s,u=t;for(t=i[0],a=0;a1&&void 0!==arguments[1]?arguments[1]:this,0))&&void 0!==e?e:Et)!==kt){var n=this._$AH,r=t===Et&&n!==Et||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==Et&&(n===Et||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}}},{key:"handleEvent",value:function(t){var e,n;"function"==typeof this._$AH?this._$AH.call(null!==(e=null===(n=this.options)||void 0===n?void 0:n.host)&&void 0!==e?e:this.element,t):this._$AH.handleEvent(t)}}]),e}(),Ht=function(){function t(e,n,r){j(this,t),this.element=e,this.type=6,this._$AN=void 0,this._$AM=n,this.options=r}return T(t,[{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"_$AI",value:function(t){Ct(this,t)}}]),t}(),Dt=it.litHtmlPolyfillSupport;null!=Dt&&Dt(jt,Ut),(null!==(r=it.litHtmlVersions)&&void 0!==r?r:it.litHtmlVersions=[]).push("3.1.2");var It=function(t){function e(){var t;return j(this,e),(t=b(this,e,arguments)).renderOptions={host:w(t)},t._$Do=void 0,t}return $(e,rt),T(e,[{key:"createRenderRoot",value:function(){var t,n,r=d(S(e.prototype),"createRenderRoot",this).call(this);return null!==(n=(t=this.renderOptions).renderBefore)&&void 0!==n||(t.renderBefore=r.firstChild),r}},{key:"update",value:function(t){var n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),d(S(e.prototype),"update",this).call(this,t),this._$Do=function(t,e,n){var r,i=null!==(r=null==n?void 0:n.renderBefore)&&void 0!==r?r:e,o=i._$litPart$;if(void 0===o){var a,s=null!==(a=null==n?void 0:n.renderBefore)&&void 0!==a?a:null;i._$litPart$=o=new Ut(e.insertBefore(ft(),s),s,void 0,null!=n?n:{})}return o._$AI(t),o}(n,this.renderRoot,this.renderOptions)}},{key:"connectedCallback",value:function(){var t;d(S(e.prototype),"connectedCallback",this).call(this),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}},{key:"disconnectedCallback",value:function(){var t;d(S(e.prototype),"disconnectedCallback",this).call(this),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}},{key:"render",value:function(){return kt}}]),e}();It._$litElement$=!0,It.finalized=!0,null===(i=globalThis.litElementHydrateSupport)||void 0===i||i.call(globalThis,{LitElement:It});var zt=globalThis.litElementPolyfillSupport;null==zt||zt({LitElement:It}),(null!==(o=globalThis.litElementVersions)&&void 0!==o?o:globalThis.litElementVersions=[]).push("4.0.4");var Bt={attribute:!0,type:String,converter:tt,reflect:!1,hasChanged:et},qt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Bt,e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=n.kind,i=n.metadata,o=globalThis.litPropertyMetadata.get(i);if(void 0===o&&globalThis.litPropertyMetadata.set(i,o=new Map),o.set(n.name,t),"accessor"===r){var a=n.name;return{set:function(n){var r=e.get.call(this);e.set.call(this,n),this.requestUpdate(a,r,t)},init:function(e){return void 0!==e&&this.P(a,void 0,t),e}}}if("setter"===r){var s=n.name;return function(n){var r=this[s];e.call(this,n),this.requestUpdate(s,r,t)}}throw Error("Unsupported decorator location: "+r)};function Vt(t){return function(e,n){return"object"==L(n)?qt(t,e,n):function(t,e,n){var r=e.hasOwnProperty(n);return e.constructor.createProperty(n,r?h(h({},t),{},{wrapped:!0}):t),r?Object.getOwnPropertyDescriptor(e,n):void 0}(t,e,n)}}var Wt=1,Gt=function(){function t(e){j(this,t)}return T(t,[{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"_$AT",value:function(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}},{key:"_$AS",value:function(t,e){return this.update(t,e)}},{key:"update",value:function(t,e){return this.render.apply(this,v(e))}}]),t}(),Ft=function(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");return _(r)}return $(e,Gt),T(e,[{key:"render",value:function(t){return" "+Object.keys(t).filter((function(e){return t[e]})).join(" ")+" "}},{key:"update",value:function(t,e){var n=p(e,1)[0];if(void 0===this.st){for(var r in this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((function(t){return""!==t})))),n){var i;n[r]&&(null===(i=this.nt)||void 0===i||!i.has(r))&&this.st.add(r)}return this.render(n)}var o,a=t.element.classList,s=O(this.st);try{for(s.s();!(o=s.n()).done;){var u=o.value;u in n||(a.remove(u),this.st.delete(u))}}catch(t){s.e(t)}finally{s.f()}for(var l in n){var c,h=!!n[l];h===this.st.has(l)||(null===(c=this.nt)||void 0===c?void 0:c.has(l))||(h?(a.add(l),this.st.add(l)):(a.remove(l),this.st.delete(l)))}return kt}}]),e}());function Jt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return customElements.whenDefined("long-press").then((function(){var e,n=document.body.querySelector("long-press");null===(e=n.bind)||void 0===e||e.call(n,t)})),customElements.whenDefined("action-handler").then((function(){var n,r=document.body.querySelector("action-handler");null===(n=r.bind)||void 0===n||n.call(r,t,e)})),t}var Yt="1.4.0";function Kt(){return Zt.apply(this,arguments)}function Zt(){return Zt=m(y().mark((function t(){var e;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.race([customElements.whenDefined("home-assistant"),customElements.whenDefined("hc-main")]);case 2:e=customElements.get("home-assistant")?"home-assistant":"hc-main";case 3:if(document.querySelector(e)){t.next=8;break}return t.next=6,new Promise((function(t){return window.setTimeout(t,100)}));case 6:t.next=3;break;case 8:return t.abrupt("return",document.querySelector(e));case 9:case"end":return t.stop()}}),t)}))),Zt.apply(this,arguments)}function Qt(){return Xt.apply(this,arguments)}function Xt(){return Xt=m(y().mark((function t(){var e;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Kt();case 2:e=t.sent;case 3:if(e.hass){t.next=8;break}return t.next=6,new Promise((function(t){return window.setTimeout(t,100)}));case 6:t.next=3;break;case 8:return t.abrupt("return",e.hass);case 9:case"end":return t.stop()}}),t)}))),Xt.apply(this,arguments)}var te="browser_mod-browser-id";function ee(){return document.querySelector("hc-main")?"CAST":localStorage[te]?localStorage[te]:""}window.cardMod_template_cache=window.cardMod_template_cache||{};var ne=window.cardMod_template_cache;function re(t,e){var n=ne[t];n&&(n.value=e.result,n.callbacks.forEach((function(t){return t(e.result)})))}function ie(){return(ie=m(y().mark((function t(e,n,r){var i,o,a,s;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Qt();case 2:i=t.sent,o=i.connection,a=JSON.stringify([n,r]),(s=ne[a])?(s.callbacks.has(e)||oe(e),e(s.value),s.callbacks.add(e)):(oe(e),e(""),r=Object.assign({user:i.user.name,browser:ee,hash:location.hash.substr(1)||""},r),ne[a]=s={template:n,variables:r,value:"",callbacks:new Set([e]),unsubscribe:o.subscribeMessage((function(t){return re(a,t)}),{type:"render_template",template:n,variables:r})});case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function oe(t){return ae.apply(this,arguments)}function ae(){return(ae=m(y().mark((function t(e){var n,r,i,o,a,s;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=0,i=Object.entries(ne);case 1:if(!(r\n \n ','\n
','
\n
\n
\n ','\n
\n \n
\n