forked from andrey-git/home-assistant-custom-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
state-card-custom-ui-es5.html
3 lines (3 loc) · 83.4 KB
/
state-card-custom-ui-es5.html
1
2
3
<script>/*! For license information please see scripts-es5.js.LICENSE */
!function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t._themes||(t._themes={});var o=e.default_theme;("default"===n||n&&e.themes[n])&&(o=n);var a=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){i(t,e,n[e])})}return t}({},t._themes);if("default"!==o){var s=e.themes[o];Object.keys(s).forEach(function(e){var n="--"+e;t._themes[n]="",a[n]=s[e]})}if(t.updateStyles?t.updateStyles(a):window.ShadyCSS&&window.ShadyCSS.styleSubtree(t,a),r){var u=document.querySelector("meta[name=theme-color]");if(u){u.hasAttribute("default-content")||u.setAttribute("default-content",u.getAttribute("content"));var l=a["--primary-color"]||u.getAttribute("default-content");u.setAttribute("content",l)}}}function o(t){return t.substr(0,t.indexOf("."))}function a(t){return o(t.entity_id)}function s(t,e,n){var i,r=t;r.lastChild&&r.lastChild.tagName===e?i=r.lastChild:(r.lastChild&&r.removeChild(r.lastChild),i=document.createElement(e.toLowerCase())),i.setProperties?i.setProperties(n):Object.keys(n).forEach(function(t){i[t]=n[t]}),null===i.parentNode&&r.appendChild(i)}n.r(e);var u=function(t,e){return 0!=(t.attributes.supported_features&e)},l=["climate","cover","configurator","input_select","input_number","input_text","lock","media_player","scene","script","timer","vacuum","water_heater","weblink"];new Set(["fan","input_boolean","light","switch","group","automation"]);var c=new WeakMap,p=function(t){return"function"==typeof t&&c.has(t)},f=void 0!==window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,h=function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=e;i!==n;){var r=i.nextSibling;t.removeChild(i),i=r}},d={},m={},y="{{lit-".concat(String(Math.random()).slice(2),"}}"),b="\x3c!--".concat(y,"--\x3e"),v=new RegExp("".concat(y,"|").concat(b)),g=function t(e,n){var i=this;!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.parts=[],this.element=n;var r=-1,o=0,a=[];!function t(n){for(var s=n.content,u=document.createTreeWalker(s,133,null,!1),l=0;u.nextNode();){r++;var c=u.currentNode;if(1===c.nodeType){if(c.hasAttributes()){for(var p=c.attributes,f=0,h=0;h<p.length;h++)p[h].value.indexOf(y)>=0&&f++;for(;f-- >0;){var d=e.strings[o],m=O.exec(d)[2],b=m.toLowerCase()+"$lit$",g=c.getAttribute(b).split(v);i.parts.push({type:"attribute",index:r,name:m,strings:g}),c.removeAttribute(b),o+=g.length-1}}"TEMPLATE"===c.tagName&&t(c)}else if(3===c.nodeType){var _=c.data;if(_.indexOf(y)>=0){for(var S=c.parentNode,k=_.split(v),E=k.length-1,j=0;j<E;j++)S.insertBefore(""===k[j]?w():document.createTextNode(k[j]),c),i.parts.push({type:"node",index:++r});""===k[E]?(S.insertBefore(w(),c),a.push(c)):c.data=k[E],o+=E}}else if(8===c.nodeType)if(c.data===y){var C=c.parentNode;null!==c.previousSibling&&r!==l||(r++,C.insertBefore(w(),c)),l=r,i.parts.push({type:"node",index:r}),null===c.nextSibling?c.data="":(a.push(c),r--),o++}else for(var x=-1;-1!==(x=c.data.indexOf(y,x+1));)i.parts.push({type:"node",index:-1})}}(n);for(var s=0;s<a.length;s++){var u=a[s];u.parentNode.removeChild(u)}},_=function(t){return-1!==t.index},w=function(){return document.createComment("")},O=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F \x09\x0a\x0c\x0d"'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function S(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var k=function(){function t(e,n,i){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this._parts=[],this.template=e,this.processor=n,this.options=i}var e,n;return e=t,(n=[{key:"update",value:function(t){var e=0,n=!0,i=!1,r=void 0;try{for(var o,a=this._parts[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value;void 0!==s&&s.setValue(t[e]),e++}}catch(t){i=!0,r=t}finally{try{n||null==a.return||a.return()}finally{if(i)throw r}}var u=!0,l=!1,c=void 0;try{for(var p,f=this._parts[Symbol.iterator]();!(u=(p=f.next()).done);u=!0){var h=p.value;void 0!==h&&h.commit()}}catch(t){l=!0,c=t}finally{try{u||null==f.return||f.return()}finally{if(l)throw c}}}},{key:"_clone",value:function(){var t=this,e=f?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),n=this.template.parts,i=0,r=0;return function e(o){for(var a=document.createTreeWalker(o,133,null,!1),s=a.nextNode();i<n.length&&null!==s;){var u=n[i];if(_(u))if(r===u.index){if("node"===u.type){var l=t.processor.handleTextExpression(t.options);l.insertAfterNode(s.previousSibling),t._parts.push(l)}else{var c;(c=t._parts).push.apply(c,function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(p=t.processor.handleAttributeExpressions(s,u.name,u.strings,t.options))||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(p)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}())}i++}else r++,"TEMPLATE"===s.nodeName&&e(s.content),s=a.nextNode();else t._parts.push(void 0),i++}var p}(e),f&&(document.adoptNode(e),customElements.upgrade(e)),e}}])&&S(e.prototype,n),t}();function E(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var j=function(){function t(e,n,i,r){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),this.strings=e,this.values=n,this.type=i,this.processor=r}return e=t,(n=[{key:"getHTML",value:function(){for(var t=this.strings.length-1,e="",n=0;n<t;n++){var i=this.strings[n],r=O.exec(i);e+=r?i.substr(0,r.index)+r[1]+r[2]+"$lit$"+r[3]+y:i+b}return e+this.strings[t]}},{key:"getTemplateElement",value:function(){var t=document.createElement("template");return t.innerHTML=this.getHTML(),t}}])&&E(e.prototype,n),i&&E(e,i),t;var e,n,i}();function C(t,e){return!e||"object"!==N(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function x(t,e,n){return(x="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=P(t)););return t}(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(n):r.value}})(t,e,n||t)}function P(t){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function T(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");var n,i;t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&(n=t,i=e,(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(n,i))}function A(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function I(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function U(t,e,n){return e&&I(t.prototype,e),n&&I(t,n),t}function N(t){return(N="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})(t)}var R=function(t){return null===t||!("object"===N(t)||"function"==typeof t)},D=function(){function t(e,n,i){A(this,t),this.dirty=!0,this.element=e,this.name=n,this.strings=i,this.parts=[];for(var r=0;r<i.length-1;r++)this.parts[r]=this._createPart()}return U(t,[{key:"_createPart",value:function(){return new L(this)}},{key:"_getValue",value:function(){for(var t=this.strings,e=t.length-1,n="",i=0;i<e;i++){n+=t[i];var r=this.parts[i];if(void 0!==r){var o=r.value;if(null!=o&&(Array.isArray(o)||"string"!=typeof o&&o[Symbol.iterator])){var a=!0,s=!1,u=void 0;try{for(var l,c=o[Symbol.iterator]();!(a=(l=c.next()).done);a=!0){var p=l.value;n+="string"==typeof p?p:String(p)}}catch(t){s=!0,u=t}finally{try{a||null==c.return||c.return()}finally{if(s)throw u}}}else n+="string"==typeof o?o:String(o)}}return n+t[e]}},{key:"commit",value:function(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}]),t}(),L=function(){function t(e){A(this,t),this.value=void 0,this.committer=e}return U(t,[{key:"setValue",value:function(t){t===d||R(t)&&t===this.value||(this.value=t,p(t)||(this.committer.dirty=!0))}},{key:"commit",value:function(){for(;p(this.value);){var t=this.value;this.value=d,t(this)}this.value!==d&&this.committer.commit()}}]),t}(),M=function(){function t(e){A(this,t),this.value=void 0,this._pendingValue=void 0,this.options=e}return U(t,[{key:"appendInto",value:function(t){this.startNode=t.appendChild(w()),this.endNode=t.appendChild(w())}},{key:"insertAfterNode",value:function(t){this.startNode=t,this.endNode=t.nextSibling}},{key:"appendIntoPart",value:function(t){t._insert(this.startNode=w()),t._insert(this.endNode=w())}},{key:"insertAfterPart",value:function(t){t._insert(this.startNode=w()),this.endNode=t.endNode,t.endNode=this.startNode}},{key:"setValue",value:function(t){this._pendingValue=t}},{key:"commit",value:function(){for(;p(this._pendingValue);){var t=this._pendingValue;this._pendingValue=d,t(this)}var e=this._pendingValue;e!==d&&(R(e)?e!==this.value&&this._commitText(e):e instanceof j?this._commitTemplateResult(e):e instanceof Node?this._commitNode(e):Array.isArray(e)||e[Symbol.iterator]?this._commitIterable(e):e===m?(this.value=m,this.clear()):this._commitText(e))}},{key:"_insert",value:function(t){this.endNode.parentNode.insertBefore(t,this.endNode)}},{key:"_commitNode",value:function(t){this.value!==t&&(this.clear(),this._insert(t),this.value=t)}},{key:"_commitText",value:function(t){var e=this.startNode.nextSibling;t=null==t?"":t,e===this.endNode.previousSibling&&3===e.nodeType?e.data=t:this._commitNode(document.createTextNode("string"==typeof t?t:String(t))),this.value=t}},{key:"_commitTemplateResult",value:function(t){var e=this.options.templateFactory(t);if(this.value instanceof k&&this.value.template===e)this.value.update(t.values);else{var n=new k(e,t.processor,this.options),i=n._clone();n.update(t.values),this._commitNode(i),this.value=n}}},{key:"_commitIterable",value:function(e){Array.isArray(this.value)||(this.value=[],this.clear());var n,i=this.value,r=0,o=!0,a=!1,s=void 0;try{for(var u,l=e[Symbol.iterator]();!(o=(u=l.next()).done);o=!0){var c=u.value;void 0===(n=i[r])&&(n=new t(this.options),i.push(n),0===r?n.appendIntoPart(this):n.insertAfterPart(i[r-1])),n.setValue(c),n.commit(),r++}}catch(t){a=!0,s=t}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}r<i.length&&(i.length=r,this.clear(n&&n.endNode))}},{key:"clear",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.startNode;h(this.startNode.parentNode,t.nextSibling,this.endNode)}}]),t}(),z=function(){function t(e,n,i){if(A(this,t),this.value=void 0,this._pendingValue=void 0,2!==i.length||""!==i[0]||""!==i[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=n,this.strings=i}return U(t,[{key:"setValue",value:function(t){this._pendingValue=t}},{key:"commit",value:function(){for(;p(this._pendingValue);){var t=this._pendingValue;this._pendingValue=d,t(this)}if(this._pendingValue!==d){var e=!!this._pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name)),this.value=e,this._pendingValue=d}}}]),t}(),B=function(t){function e(t,n,i){var r;return A(this,e),(r=C(this,P(e).call(this,t,n,i))).single=2===i.length&&""===i[0]&&""===i[1],r}return T(e,D),U(e,[{key:"_createPart",value:function(){return new V(this)}},{key:"_getValue",value:function(){return this.single?this.parts[0].value:x(P(e.prototype),"_getValue",this).call(this)}},{key:"commit",value:function(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}]),e}(),V=function(t){function e(){return A(this,e),C(this,P(e).apply(this,arguments))}return T(e,L),e}(),H=!1;try{var W={get capture(){return H=!0,!1}};window.addEventListener("test",W,W),window.removeEventListener("test",W,W)}catch(t){}var F=function(){function t(e,n,i){var r=this;A(this,t),this.value=void 0,this._pendingValue=void 0,this.element=e,this.eventName=n,this.eventContext=i,this._boundHandleEvent=function(t){return r.handleEvent(t)}}return U(t,[{key:"setValue",value:function(t){this._pendingValue=t}},{key:"commit",value:function(){for(;p(this._pendingValue);){var t=this._pendingValue;this._pendingValue=d,t(this)}if(this._pendingValue!==d){var e=this._pendingValue,n=this.value,i=null==e||null!=n&&(e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive),r=null!=e&&(null==n||i);i&&this.element.removeEventListener(this.eventName,this._boundHandleEvent,this._options),r&&(this._options=q(e),this.element.addEventListener(this.eventName,this._boundHandleEvent,this._options)),this.value=e,this._pendingValue=d}}},{key:"handleEvent",value:function(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}]),t}(),q=function(t){return t&&(H?{capture:t.capture,passive:t.passive,once:t.once}:t.capture)};function G(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var $=new(function(){function t(){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this)}var e,n;return e=t,(n=[{key:"handleAttributeExpressions",value:function(t,e,n,i){var r=e[0];return"."===r?new B(t,e.slice(1),n).parts:"@"===r?[new F(t,e.slice(1),i.eventContext)]:"?"===r?[new z(t,e.slice(1),n)]:new D(t,e,n).parts}},{key:"handleTextExpression",value:function(t){return new M(t)}}])&&G(e.prototype,n),t}());function J(t){var e=K.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},K.set(t.type,e));var n=e.stringsArray.get(t.strings);if(void 0!==n)return n;var i=t.strings.join(y);return void 0===(n=e.keyString.get(i))&&(n=new g(t,t.getTemplateElement()),e.keyString.set(i,n)),e.stringsArray.set(t.strings,n),n}var K=new Map,Y=new WeakMap;(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.0.0");var Q=133;function X(t,e){for(var n=t.element.content,i=t.parts,r=document.createTreeWalker(n,Q,null,!1),o=tt(i),a=i[o],s=-1,u=0,l=[],c=null;r.nextNode();){s++;var p=r.currentNode;for(p.previousSibling===c&&(c=null),e.has(p)&&(l.push(p),null===c&&(c=p)),null!==c&&u++;void 0!==a&&a.index===s;)a.index=null!==c?-1:a.index-u,a=i[o=tt(i,o)]}l.forEach(function(t){return t.parentNode.removeChild(t)})}var Z=function(t){for(var e=11===t.nodeType?0:1,n=document.createTreeWalker(t,Q,null,!1);n.nextNode();)e++;return e},tt=function(t){for(var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1)+1;e<t.length;e++){var n=t[e];if(_(n))return e}return-1},et=function(t,e){return"".concat(t,"--").concat(e)},nt=!0;void 0===window.ShadyCSS?nt=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected.Please update to at least @webcomponents/[email protected] and@webcomponents/[email protected]."),nt=!1);var it=["html","svg"],rt=new Set;function ot(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function at(t){return(at="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})(t)}function st(t,e,n,i,r,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(i,r)}function ut(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function lt(t){var e="function"==typeof Map?new Map:void 0;return(lt=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;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,i)}function i(){return function(t,e,n){return(function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);var r=new(Function.bind.apply(t,i));return n&&ct(r,n.prototype),r}).apply(null,arguments)}(t,arguments,pt(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ct(i,t)})(t)}function ct(t,e){return(ct=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function pt(t){return(pt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}window.JSCompiler_renameProperty=function(t,e){return t};var ft={toAttribute:function(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return null==t?t:JSON.stringify(t)}return t},fromAttribute:function(t,e){switch(e){case Boolean:return null!==t;case Number:return null===t?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},ht=function(t,e){return e!==t&&(e==e||t==t)},dt={attribute:!0,type:String,converter:ft,reflect:!1,hasChanged:ht},mt=Promise.resolve(!0),yt=function(t){function e(){var t,n,i;return function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),(n=this,i=pt(e).call(this),t=!i||"object"!==at(i)&&"function"!=typeof i?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n):i)._updateState=0,t._instanceProperties=void 0,t._updatePromise=mt,t._hasConnectedResolver=void 0,t._changedProperties=new Map,t._reflectingProperties=void 0,t.initialize(),t}var n,i,r,o,a;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}}),e&&ct(t,e)}(e,lt(HTMLElement)),n=e,r=[{key:"_ensureClassProperties",value:function(){var t=this;if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;var e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach(function(e,n){return t._classProperties.set(n,e)})}}},{key:"createProperty",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dt;if(this._ensureClassProperties(),this._classProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){var n="symbol"===at(t)?Symbol():"__".concat(t);Object.defineProperty(this.prototype,t,{get:function(){return this[n]},set:function(e){var i=this[t];this[n]=e,this._requestUpdate(t,i)},configurable:!0,enumerable:!0})}}},{key:"finalize",value:function(){if(!this.hasOwnProperty(JSCompiler_renameProperty("finalized",this))||!this.finalized){var t=Object.getPrototypeOf(this);if("function"==typeof t.finalize&&t.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){var e=this.properties,n=[].concat(ot(Object.getOwnPropertyNames(e)),ot("function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[])),i=!0,r=!1,o=void 0;try{for(var a,s=n[Symbol.iterator]();!(i=(a=s.next()).done);i=!0){var u=a.value;this.createProperty(u,e[u])}}catch(t){r=!0,o=t}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}}}}},{key:"_attributeNameForProperty",value:function(t,e){var n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}},{key:"_valueHasChanged",value:function(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ht)(t,e)}},{key:"_propertyValueFromAttribute",value:function(t,e){var n=e.type,i=e.converter||ft,r="function"==typeof i?i:i.fromAttribute;return r?r(t,n):t}},{key:"_propertyValueToAttribute",value:function(t,e){if(void 0!==e.reflect){var n=e.type,i=e.converter;return(i&&i.toAttribute||ft.toAttribute)(t,n)}}},{key:"observedAttributes",get:function(){var t=this;this.finalize();var e=[];return this._classProperties.forEach(function(n,i){var r=t._attributeNameForProperty(i,n);void 0!==r&&(t._attributeToPropertyMap.set(r,i),e.push(r))}),e}}],(i=[{key:"initialize",value:function(){this._saveInstanceProperties(),this._requestUpdate()}},{key:"_saveInstanceProperties",value:function(){var t=this;this.constructor._classProperties.forEach(function(e,n){if(t.hasOwnProperty(n)){var i=t[n];delete t[n],t._instanceProperties||(t._instanceProperties=new Map),t._instanceProperties.set(n,i)}})}},{key:"_applyInstanceProperties",value:function(){var t=this;this._instanceProperties.forEach(function(e,n){return t[n]=e}),this._instanceProperties=void 0}},{key:"connectedCallback",value:function(){this._updateState=32|this._updateState,this._hasConnectedResolver&&(this._hasConnectedResolver(),this._hasConnectedResolver=void 0)}},{key:"disconnectedCallback",value:function(){}},{key:"attributeChangedCallback",value:function(t,e,n){e!==n&&this._attributeToProperty(t,n)}},{key:"_propertyToAttribute",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:dt,i=this.constructor,r=i._attributeNameForProperty(t,n);if(void 0!==r){var o=i._propertyValueToAttribute(e,n);if(void 0===o)return;this._updateState=8|this._updateState,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._updateState=-9&this._updateState}}},{key:"_attributeToProperty",value:function(t,e){if(!(8&this._updateState)){var n=this.constructor,i=n._attributeToPropertyMap.get(t);if(void 0!==i){var r=n._classProperties.get(i)||dt;this._updateState=16|this._updateState,this[i]=n._propertyValueFromAttribute(e,r),this._updateState=-17&this._updateState}}}},{key:"_requestUpdate",value:function(t,e){var n=!0;if(void 0!==t){var i=this.constructor,r=i._classProperties.get(t)||dt;i._valueHasChanged(this[t],e,r.hasChanged)?(this._changedProperties.has(t)||this._changedProperties.set(t,e),!0!==r.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(t,r))):n=!1}!this._hasRequestedUpdate&&n&&this._enqueueUpdate()}},{key:"requestUpdate",value:function(t,e){return this._requestUpdate(t,e),this.updateComplete}},{key:"_enqueueUpdate",value:(o=regeneratorRuntime.mark(function t(){var e,n,i,r,o=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this._updateState=4|this._updateState,i=this._updatePromise,this._updatePromise=new Promise(function(t,i){e=t,n=i}),t.prev=3,t.next=6,i;case 6:t.next=10;break;case 8:t.prev=8,t.t0=t.catch(3);case 10:if(this._hasConnected){t.next=13;break}return t.next=13,new Promise(function(t){return o._hasConnectedResolver=t});case 13:if(t.prev=13,null==(r=this.performUpdate())){t.next=18;break}return t.next=18,r;case 18:t.next=23;break;case 20:t.prev=20,t.t1=t.catch(13),n(t.t1);case 23:e(!this._hasRequestedUpdate);case 24:case"end":return t.stop()}},t,this,[[3,8],[13,20]])}),a=function(){var t=this,e=arguments;return new Promise(function(n,i){var r=o.apply(t,e);function a(t){st(r,n,i,a,s,"next",t)}function s(t){st(r,n,i,a,s,"throw",t)}a(void 0)})},function(){return a.apply(this,arguments)})},{key:"performUpdate",value:function(){this._instanceProperties&&this._applyInstanceProperties();var t=!1,e=this._changedProperties;try{(t=this.shouldUpdate(e))&&this.update(e)}catch(e){throw t=!1,e}finally{this._markUpdated()}t&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(e)),this.updated(e))}},{key:"_markUpdated",value:function(){this._changedProperties=new Map,this._updateState=-5&this._updateState}},{key:"shouldUpdate",value:function(t){return!0}},{key:"update",value:function(t){var e=this;void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(function(t,n){return e._propertyToAttribute(n,e[n],t)}),this._reflectingProperties=void 0)}},{key:"updated",value:function(t){}},{key:"firstUpdated",value:function(t){}},{key:"_hasConnected",get:function(){return 32&this._updateState}},{key:"_hasRequestedUpdate",get:function(){return 4&this._updateState}},{key:"hasUpdated",get:function(){return 1&this._updateState}},{key:"updateComplete",get:function(){return this._updatePromise}}])&&ut(n.prototype,i),r&&ut(n,r),e}();yt.finalized=!0;var bt="adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;function vt(t){return(vt="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})(t)}function gt(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function _t(t,e,n){return(_t="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=wt(t)););return t}(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(n):r.value}})(t,e,n||t)}function wt(t){return(wt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ot(t,e){return(Ot=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}Symbol(),(window.litElementVersions||(window.litElementVersions=[])).push("2.0.1");var St=function(t){function e(){return function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),t=this,!(n=wt(e).apply(this,arguments))||"object"!==vt(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n;var t,n}var n,i,r;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}}),e&&Ot(t,e)}(e,yt),n=e,r=[{key:"finalize",value:function(){_t(wt(e),"finalize",this).call(this),this._styles=this.hasOwnProperty(JSCompiler_renameProperty("styles",this))?this._getUniqueStyles():this._styles||[]}},{key:"_getUniqueStyles",value:function(){var t=this.styles,e=[];return Array.isArray(t)?function(t){return t.flat?t.flat(1/0):function t(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=0,r=e.length;i<r;i++){var o=e[i];Array.isArray(o)?t(o,n):n.push(o)}return n}(t)}(t).reduceRight(function(t,e){return t.add(e),t},new Set).forEach(function(t){return e.unshift(t)}):t&&e.push(t),e}}],(i=[{key:"initialize",value:function(){_t(wt(e.prototype),"initialize",this).call(this),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}},{key:"createRenderRoot",value:function(){return this.attachShadow({mode:"open"})}},{key:"adoptStyles",value:function(){var t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?bt?this.renderRoot.adoptedStyleSheets=t.map(function(t){return t.styleSheet}):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map(function(t){return t.cssText}),this.localName))}},{key:"connectedCallback",value:function(){_t(wt(e.prototype),"connectedCallback",this).call(this),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}},{key:"update",value:function(t){var n=this;_t(wt(e.prototype),"update",this).call(this,t);var i=this.render();i instanceof j&&this.constructor.render(i,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(function(t){var e=document.createElement("style");e.textContent=t.cssText,n.renderRoot.appendChild(e)}))}},{key:"render",value:function(){}}])&>(n.prototype,i),r&>(n,r),e}();function kt(t){return(kt="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})(t)}function Et(){var t,e,n=(t=['\n <style include="ha-style"></style>\n <app-header-layout has-scrolling-region>\n <app-header slot="header" fixed>\n <app-toolbar>\n <paper-icon-button\n icon=\'hass:arrow-left\'\n @click="','"\n ></paper-icon-button>\n <div main-title>Custom UI settings</div>\n </app-toolbar>\n </app-header>\n\n <ha-config-section .is-wide="',"\">\n <paper-card heading='Device name'>\n <div class='card-content'>\n Set device name so that you can reference it in per-device settings\n <paper-input\n label='Name'\n .value=\"@{this.name}\"\n ></paper-input>\n </div>\n </paper-card>\n </ha-config-section>\n </app-header-layout>\n "],e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}})));return Et=function(){return n},n}function jt(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Ct(t,e,n){return(Ct="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=xt(t)););return t}(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(n):r.value}})(t,e,n||t)}function xt(t){return(xt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Pt(t,e){return(Pt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}St.finalized=!0,St.render=function(t,e,n){var i=n.scopeName,r=Y.has(e),o=e instanceof ShadowRoot&&nt&&t instanceof j,a=o&&!rt.has(i),s=a?document.createDocumentFragment():e;if(function(t,e,n){var i=Y.get(e);void 0===i&&(h(e,e.firstChild),Y.set(e,i=new M(Object.assign({templateFactory:J},n))),i.appendInto(e)),i.setValue(t),i.commit()}(t,s,Object.assign({templateFactory:function(t){return function(e){var n=et(e.type,t),i=K.get(n);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},K.set(n,i));var r=i.stringsArray.get(e.strings);if(void 0!==r)return r;var o=e.strings.join(y);if(void 0===(r=i.keyString.get(o))){var a=e.getTemplateElement();nt&&window.ShadyCSS.prepareTemplateDom(a,t),r=new g(e,a),i.keyString.set(o,r)}return i.stringsArray.set(e.strings,r),r}}(i)},n)),a){var u=Y.get(s);Y.delete(s),u.value instanceof k&&function(t,e,n){rt.add(n);var i=t.querySelectorAll("style");if(0!==i.length){for(var r=document.createElement("style"),o=0;o<i.length;o++){var a=i[o];a.parentNode.removeChild(a),r.textContent+=a.textContent}if(function(t){it.forEach(function(e){var n=K.get(et(e,t));void 0!==n&&n.keyString.forEach(function(t){var e=t.element.content,n=new Set;Array.from(e.querySelectorAll("style")).forEach(function(t){n.add(t)}),X(t,n)})})}(n),function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=t.element.content,r=t.parts;if(null!==n&&void 0!==n)for(var o=document.createTreeWalker(i,Q,null,!1),a=tt(r),s=0,u=-1;o.nextNode();)for(u++,o.currentNode===n&&(s=Z(e),n.parentNode.insertBefore(e,n));-1!==a&&r[a].index===u;){if(s>0){for(;-1!==a;)r[a].index+=s,a=tt(r,a);return}a=tt(r,a)}else i.appendChild(e)}(e,r,e.element.content.firstChild),window.ShadyCSS.prepareTemplateStyles(e.element,n),window.ShadyCSS.nativeShadow){var s=e.element.content.querySelector("style");t.insertBefore(s.cloneNode(!0),t.firstChild)}else{e.element.content.insertBefore(r,e.element.content.firstChild);var u=new Set;u.add(r),X(e,u)}}else window.ShadyCSS.prepareTemplateStyles(e.element,n)}(s,u.value.template,i),h(e,e.firstChild),e.appendChild(s),Y.set(e,u)}!r&&o&&window.ShadyCSS.styleElement(e.host)};var Tt=function(t){function e(){return function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),t=this,!(n=xt(e).apply(this,arguments))||"object"!==kt(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n;var t,n}var n,i,r;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}}),e&&Pt(t,e)}(e,St),n=e,r=[{key:"properties",get:function(){return{isWide:{type:Boolean,attribute:"is-wide"},name:{type:String,reflect:!0,observer:"nameChanged"}}}}],(i=[{key:"render",value:function(){return function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return new j(t,n,"html",$)}(Et(),this._backHandler,this.isWide)}},{key:"attributeChangedCallback",value:function(t,n,i){"name"===t&&this.nameChanged(i),Ct(xt(e.prototype),"attributeChangedCallback",this).call(this,t,n,i)}},{key:"connectedCallback",value:function(){Ct(xt(e.prototype),"connectedCallback",this).call(this),this.name=window.customUI.getName()}},{key:"nameChanged",value:function(t){window.customUI.setName(t)}},{key:"_backHandler",value:function(){window.history.back();var t=new CustomEvent("location-changed");this.dispatchEvent(t)}}])&&jt(n.prototype,i),r&&jt(n,r),e}();customElements.define("ha-config-custom-ui",Tt);var At={DOMAIN_DEVICE_CLASS:{binary_sensor:["battery","cold","connectivity","door","garage_door","gas","heat","light","lock","moisture","motion","moving","occupancy","opening","plug","power","presence","problem","safety","smoke","sound","vibration","window"],cover:["awning","blind","curtain","damper","door","garage","shade","shutter","window"],sensor:["battery","humidity","illuminance","temperature","pressure","power","signal_strength"],switch:["switch","outlet"]},UNKNOWN_TYPE:"json",ADD_TYPE:"key-value",TYPE_TO_TAG:{string:"ha-customize-string",json:"ha-customize-string",icon:"ha-customize-icon",boolean:"ha-customize-boolean",array:"ha-customize-array","key-value":"ha-customize-key-value"}};At.LOGIC_STATE_ATTRIBUTES=At.LOGIC_STATE_ATTRIBUTES||{entity_picture:void 0,friendly_name:{type:"string",description:"Name"},icon:{type:"icon"},emulated_hue:{type:"boolean",domains:["emulated_hue"]},emulated_hue_name:{type:"string",domains:["emulated_hue"]},haaska_hidden:void 0,haaska_name:void 0,homebridge_hidden:{type:"boolean"},homebridge_name:{type:"string"},supported_features:void 0,attribution:void 0,custom_ui_more_info:{type:"string"},custom_ui_state_card:{type:"string"},device_class:{type:"array",options:At.DOMAIN_DEVICE_CLASS,description:"Device class",domains:["binary_sensor","cover","sensor","switch"]},hidden:{type:"boolean",description:"Hide from UI"},assumed_state:{type:"boolean",domains:["switch","light","cover","climate","fan","group","water_heater"]},initial_state:{type:"string",domains:["automation"]},unit_of_measurement:{type:"string"}};var It=At;window.hassAttributeUtil=window.hassAttributeUtil||{};var Ut=["single-line","break-slider","break-slider-toggle","hide-slider","no-slider"],Nt={group:void 0,device:void 0,templates:void 0,state:void 0,_stateDisplay:void 0,control_element:{type:"string"},state_card_mode:{type:"array",options:{light:Ut.concat("badges"),cover:Ut.concat("badges"),climate:Ut.concat("badges"),"*":["badges"]}},state_card_custom_ui_secondary:{type:"string"},badges_list:{type:"json"},show_last_changed:{type:"boolean"},hide_control:{type:"boolean"},extra_data_template:{type:"string"},extra_badge:{type:"json"},stretch_slider:{type:"boolean"},slider_theme:{type:"json"},theme:{type:"string"},confirm_controls:{type:"boolean"},confirm_controls_show_lock:{type:"boolean"},hide_in_default_view:{type:"boolean"},icon_color:{type:"string"}};function Rt(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES=It.LOGIC_STATE_ATTRIBUTES,window.hassAttributeUtil.UNKNOWN_TYPE=It.UNKNOWN_TYPE,Object.assign(window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES,Nt),window.customUI=window.customUI||{SUPPORTED_SLIDER_MODES:["single-line","break-slider","break-slider-toggle","hide-slider","no-slider"],domHost:function(t){if(t===document)return null;var e=t.getRootNode();return e instanceof DocumentFragment?e.host:e},lightOrShadow:function(t,e){return t.shadowRoot?t.shadowRoot.querySelector(e):t.querySelector(e)},getElementHierarchy:function(t,e){if(null===t)return null;var n=e.shift();return n?window.customUI.getElementHierarchy(window.customUI.lightOrShadow(t,n),e):t},getContext:function(t){if(void 0===t._context){t._context=[];for(var e="HA-ENTITIES-CARD"===t.tagName?window.customUI.domHost(t):t;e;e=window.customUI.domHost(e))switch(e.tagName){case"HA-ENTITIES-CARD":e.groupEntity?t._context.push(e.groupEntity.entity_id):!1===e.groupEntity&&e.states&&e.states.length&&t._context.push("group.".concat(a(e.states[0])));break;case"MORE-INFO-GROUP":case"STATE-CARD-CONTENT":e.stateObj&&t._context.push(e.stateObj.entity_id);break;case"HA-CARDS":t._context.push(e.getAttribute("data-view")||"default_view")}t._context.reverse()}return t._context},findMatch:function(t,e){return e?e[t]?t:Object.keys(e).find(function(e){return t.match("^".concat(e,"$"))}):null},maybeChangeObjectByDevice:function(t){var e=window.customUI.getName();if(!e)return t;var n=this.findMatch(e,t.attributes.device);if(!n)return t;var i=Object.assign({},t.attributes.device[n]);return Object.keys(i).length?window.customUI.applyAttributes(t,i):t},maybeChangeObjectByGroup:function(t,e){var n=this,i=window.customUI.getContext(t);if(!i)return e;if(!e.attributes.group)return e;var r={};return i.forEach(function(t){var i=n.findMatch(t,e.attributes.group);e.attributes.group[i]&&Object.assign(r,e.attributes.group[i])}),Object.keys(r).length?window.customUI.applyAttributes(e,r):e},_setKeep:function(t,e){void 0===t._cui_keep?t._cui_keep=e:t._cui_keep=t._cui_keep&&e},maybeApplyTemplateAttributes:function(t,e,n,i){if(!i.templates)return window.customUI._setKeep(n,!0),n;var r={},o=!1,a=!1;if(Object.keys(i.templates).forEach(function(s){var u=i.templates[s];u.match(/\b(entities|hass)\b/)&&(o=!0);var l=window.customUI.computeTemplate(u,t,e,n,i,n.untemplated_attributes&&n.untemplated_attributes[s]||i[s],n.untemplated_state||n.state);null!==l&&(r[s]=l,"state"===s?l!==n.state&&(a=!0):"_stateDisplay"===s?l!==n._stateDisplay&&(a=!0):l!==i[s]&&(a=!0))}),window.customUI._setKeep(n,!o),!a)return n;if(n.attributes===i){var s=window.customUI.applyAttributes(n,r);return Object.prototype.hasOwnProperty.call(r,"state")&&null!==r.state&&(s.state=String(r.state),s.untemplated_state=n.state),Object.prototype.hasOwnProperty.call(r,"_stateDisplay")&&(s._stateDisplay=r._stateDisplay,s.untemplated_stateDisplay=n._stateDisplay),window.customUI._setKeep(s,!o),s}return Object.assign({},n)},maybeApplyTemplates:function(t,e,n){var i=window.customUI.maybeApplyTemplateAttributes(t,e,n,n.attributes),r=i!==n;function o(n){n&&(Object.values(n).forEach(function(n){var o=window.customUI.maybeApplyTemplateAttributes(t,e,i,n);r|=o!==i}),o(n.device),o(n.group))}return o(n.attributes.device),o(n.attributes.group),i!==n?i:r?Object.assign({},n):n},applyAttributes:function(t,e){return{entity_id:t.entity_id,state:t.state,attributes:Object.assign({},t.attributes,e),untemplated_attributes:t.attributes,last_changed:t.last_changed}},maybeChangeObject:function(t,e,n,i){if(n)return e;var r=window.customUI.maybeChangeObjectByDevice(e);return r=window.customUI.maybeChangeObjectByGroup(t,r),(r=window.customUI.maybeApplyTemplateAttributes(t.hass,t.hass.states,r,r.attributes))!==e&&r.attributes.hidden&&i?null:r},fixGroupTitles:function(){var t=window.customUI.getElementHierarchy(document,["home-assistant","home-assistant-main"]);if(null!==t){var e=window.customUI.getElementHierarchy(t,["partial-cards","ha-cards[view-visible]"]);null!==e&&(window.customUI.lightOrShadow(e,".main")||e.$.main).querySelectorAll("ha-entities-card").forEach(function(t){if(t.groupEntity){var e=window.customUI.maybeChangeObject(t,t.groupEntity,!1,!1);e!==t.groupEntity&&e.attributes.friendly_name&&(window.customUI.lightOrShadow(t,".name").textContent=e.attributes.friendly_name)}})}else window.setTimeout(window.customUI.fixGroupTitles,1e3)},controlColumns:function(t){var e=window.customUI.getElementHierarchy(document,["home-assistant","home-assistant-main","partial-cards"]);if(null!==e){var n=e.handleWindowChange||e._updateColumns;e.mqls.forEach(function(t){t.removeListener(n)}),e.mqls=t.map(function(t){var e=window.matchMedia("(min-width: ".concat(t,"px)"));return e.addListener(n),e}),n()}else window.setTimeout(window.customUI.controlColumns.bind(null,t),1e3)},useCustomizer:function(){var t=window.customUI.lightOrShadow(document,"home-assistant").hass.states["customizer.customizer"];t&&(t.attributes.columns&&window.customUI.controlColumns(t.attributes.columns),t.attributes.hide_attributes&&window.hassAttributeUtil&&window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES&&t.attributes.hide_attributes.forEach(function(t){Object.prototype.hasOwnProperty.call(window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES,t)||(window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES[t]=void 0)}))},updateConfigPanel:function(){if(window.location.pathname.startsWith("/config")){var t=window.customUI.getElementHierarchy(document,["home-assistant","home-assistant-main","partial-panel-resolver","ha-panel-config"]);if(t){var e=window.customUI.getElementHierarchy(t,["ha-config-dashboard","ha-config-navigation"]);e&&(e.localize&&!e.cuiPatch&&(e.cuiPatch=!0,e._originalComputeLoaded=e._computeLoaded,e._originalComputeCaption=e._computeCaption,e._originalComputeDescription=e._computeDescription,e._computeLoaded=function(t,n){return"customui"===n||e._originalComputeLoaded(t,n)},e._computeCaption=function(t,n){return"customui"===t?"Custom UI":e._originalComputeCaption(t,n)},e._computeDescription=function(t,n){return"customui"===t?"SetUI tweaks":e._originalComputeDescription(t,n)}),e.pages.some(function(t){return"customui"===t||"customui"===t.domain})||e.push("pages",e.localize?"customui":{domain:"customui",caption:"Custom UI",description:"Set UI tweaks.",loaded:!0}));var n=function(){var e=document.createElement("ha-config-custom-ui");return e.isWide=t.isWide,e.setAttribute("page-name","customui"),e},i=window.customUI.lightOrShadow(t,"iron-pages");if(i){if("HA-CONFIG-CUSTOM-UI"!==i.lastElementChild.tagName){var r=n();i.appendChild(r),i.addEventListener("iron-items-changed",function(){window.location.pathname.startsWith("/config/customui")&&i.select("customui")})}}else if(t.shadowRoot){var o=t.shadowRoot||t;if("HA-CONFIG-CUSTOM-UI"!==o.lastElementChild.tagName){var a=n();o.appendChild(a)}var s=window.location.pathname.startsWith("/config/customui");o.lastElementChild.style.display=s?"":"none"}else t.routerOptions&&t.routerOptions.routes&&(t.routerOptions.routes.customui||(t.routerOptions.routes.customui={tag:"ha-config-custom-ui",load:function(){return Promise.resolve()}},window.location.pathname.startsWith("/config/customui")&&t.update(new Map([["route",void 0]]))))}else window.setTimeout(window.customUI.updateConfigPanel,100)}},installStatesHook:function(){customElements.whenDefined("home-assistant").then(function(){var t=customElements.get("home-assistant");if(t&&t.prototype._updateHass){var e=t.prototype._updateHass;t.prototype._updateHass=function(t){var n=this.hass;t.states&&Object.keys(t.states).forEach(function(e){var i=t.states[e];if(!i._cui_keep){var r=window.customUI.maybeApplyTemplates(n,t.states,i);n.states&&i!==n.states[e]?t.states[e]=r:i!==r&&(t.states[e]=r)}}),e.call(this,t),t.themes&&n._themeWaiters&&(n._themeWaiters.forEach(function(t){return t.stateChanged(t.state)}),n._themeWaiters=void 0)};var n=window.customUI.lightOrShadow(document,"home-assistant");n.hass&&n.hass.states&&n._updateHass({states:n.hass.states})}})},installPartialCards:function(){customElements.whenDefined("partial-cards").then(function(){var t=customElements.get("partial-cards");t&&t.prototype._defaultViewFilter&&(t.prototype._defaultViewFilter=function(t,e){if(t.states[e].attributes.hidden)return!1;var n={};return Object.values(t.states).forEach(function(e){if(e.attributes&&e.attributes.hide_in_default_view){var i=e.entity_id;if(n[i])return;if(n[i]=e,e.attributes.view){var r=function(t,n){var i={};return e.attributes.entity_id.forEach(function(e){var n=t[e];if(n&&!n.attributes.hidden&&(i[n.entity_id]=n,"group"===o(n.entity_id))){var r=function(t,e){var i={};return n.attributes.entity_id.forEach(function(e){var n=t[e];n&&(i[n.entity_id]=n)}),i}(t);Object.keys(r).forEach(function(t){var e=r[t];e.attributes.hidden||(i[t]=e)})}}),i}(t.states);Object.keys(r).filter(function(t){return!1!==r[t].attributes.hide_in_default_view}).forEach(function(t){n[t]=r[t]})}}}),!n[e]})})},installActionName:function(t){customElements.whenDefined(t).then(function(){var e=customElements.get(t);e&&e.prototype&&Object.defineProperty(e.prototype,"localize",{get:function(){return function(t){return this.stateObj&&this.stateObj.attributes&&this.stateObj.attributes.action_name?this.stateObj.attributes.action_name:this.__data.localize(t)}},set:function(){}})})},installHaStateLabelBadge:function(){customElements.whenDefined("ha-state-label-badge").then(function(){var t=customElements.get("ha-state-label-badge");t&&t.prototype.stateChanged&&(t.prototype.stateChanged=function(t){t.attributes.theme&&(null===this.hass.themes?(this.hass._themeWaiters=this.hass._themeWaiters||[],this.hass._themeWaiters.push(this)):r(this,this.hass.themes||{default_theme:"default",themes:{}},t.attributes.theme||"default")),this.updateStyles(),this.startInterval&&this.startInterval(t)})})},installStateBadge:function(){customElements.whenDefined("state-badge").then(function(){var t=customElements.get("state-badge");if(t)if(t.prototype._updateIconAppearance){var e=t.prototype._updateIconAppearance;t.prototype._updateIconAppearance=function(t){t.attributes.icon_color&&!t.attributes.entity_picture?(this.style.backgroundImage="",Object.assign(this.$.icon.style,{color:t.attributes.icon_color,filter:""})):e.call(this,t)}}else if(t.prototype.updated){var n=t.prototype.updated;t.prototype.updated=function(t){if(t.has("stateObj")){var e=this.stateObj;e.attributes.icon_color&&!e.attributes.entity_picture?(this.style.backgroundImage="",Object.assign(this._icon.style,{color:e.attributes.icon_color,filter:""})):n.call(this,t)}}}})},installHaAttributes:function(){customElements.whenDefined("ha-attributes").then(function(){var t=customElements.get("ha-attributes");t&&t.prototype.computeFiltersArray&&window.hassAttributeUtil&&(t.prototype.computeFiltersArray=function(t){return Object.keys(window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES).concat(t?t.split(","):[])})})},installHaFormCustomize:function(){window.location.pathname.startsWith("/config")&&customElements.whenDefined("ha-form-customize").then(function(){var t=customElements.get("ha-form-customize");t?window.customUI.haFormCustomizeInitDone||(window.customUI.haFormCustomizeInitDone=!0,window.hassAttributeUtil&&(t.prototype._computeSingleAttribute&&(t.prototype._computeSingleAttribute=function(t,e,n){var i=window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES[t]||{type:window.hassAttributeUtil.UNKNOWN_TYPE};return this._initOpenObject(t,"json"===i.type?JSON.stringify(e):e,n,i)}),t.prototype.getNewAttributesOptions&&(t.prototype.getNewAttributesOptions=function(t,e,n,i){var r=this;return Object.keys(window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES).filter(function(t){var e=window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES[t];return e&&(!e.domains||!r.entity||e.domains.includes(a(r.entity)))}).filter(this.filterFromAttributes(t)).filter(this.filterFromAttributes(e)).filter(this.filterFromAttributes(n)).filter(this.filterFromAttributes(i)).sort().concat("Other")}))):window.setTimeout(window.customUI.installHaFormCustomize,100)})},installClassHooks:function(){window.customUI.classInitDone||(window.customUI.classInitDone=!0,window.customUI.installPartialCards(),window.customUI.installStatesHook(),window.customUI.installHaStateLabelBadge(),window.customUI.installStateBadge(),window.customUI.installHaAttributes(),window.customUI.installActionName("state-card-scene"),window.customUI.installActionName("state-card-script"))},init:function(){if(!window.customUI.initDone){window.customUI.installClassHooks();var t=window.customUI.lightOrShadow(document,"home-assistant");t.hass&&t.hass.states?(window.customUI.initDone=!0,window.customUI.useCustomizer(),window.customUI.runHooks(),window.addEventListener("location-changed",window.setTimeout.bind(null,window.customUI.runHooks,100)),console.log("Loaded CustomUI ".concat("20190518")),window.CUSTOM_UI_LIST||(window.CUSTOM_UI_LIST=[]),window.CUSTOM_UI_LIST.push({name:"CustomUI",version:"20190518",url:"https://github.com/andrey-git/home-assistant-custom-ui"})):window.setTimeout(window.customUI.init,1e3)}},runHooks:function(){window.customUI.fixGroupTitles(),window.customUI.updateConfigPanel(),window.customUI.installHaFormCustomize()},getName:function(){return window.localStorage.getItem("ha-device-name")||""},setName:function(t){window.localStorage.setItem("ha-device-name",t||"")},computeTemplate:function(t,e,n,i,r,o,a){var s=t.indexOf("return")>=0?t:"return `".concat(t,"`;");try{return new Function("hass","entities","entity","attributes","attribute","state",s)(e,n,i,r,o,a)}catch(t){if(t instanceof SyntaxError||t instanceof ReferenceError)return console.warn("".concat(t.name,": ").concat(t.message," in template ").concat(s)),null;throw t}}},window.customUI.init(),n(1);var Dt=function(){function t(e){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.value=e.toString()}var e,n;return e=t,(n=[{key:"toString",value:function(){return this.value}}])&&Rt(e.prototype,n),t}();var Lt=function(t){for(var e=document.createElement("template"),n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return e.innerHTML=i.reduce(function(e,n,i){return e+function(t){if(t instanceof HTMLTemplateElement)return t.innerHTML;if(t instanceof Dt)return function(t){if(t instanceof Dt)return t.value;throw new Error("non-literal value passed to Polymer's htmlLiteral function: ".concat(t))}(t);throw new Error("non-template value passed to Polymer's html function: ".concat(t))}(n)+t[i+1]},t[0]),e};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})(t)}function zt(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Bt(t){return(Bt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Vt(t,e){return(Vt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var Ht=function(t){return function(e){function n(){return function(t,e){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this),t=this,!(e=Bt(n).apply(this,arguments))||"object"!==Mt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e;var t,e}var i,r,o;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}}),e&&Vt(t,e)}(n,t),i=n,o=[{key:"properties",get:function(){return{hass:Object,inDialog:{type:Boolean,value:!1},stateObj:Object,controlElement:String,extra:{type:Array,computed:"computeExtra(hass, stateObj)"}}}}],(r=[{key:"computeExtra",value:function(t,e){var n=e.attributes.extra_data_template;return n?(Array.isArray(n)||(n=[n]),n.map(function(n){return window.customUI.computeTemplate(n,t,t.states,e,e.attributes,void 0,e.state)}).filter(function(t){return null!==t})):[]}},{key:"showLastChanged",value:function(t,e,n){return!!e||!n.length&&!!t.attributes.show_last_changed}},{key:"hasExtra",value:function(t){return t.length>0}}])&&zt(i.prototype,r),o&&zt(i,o),n}()};function Wt(t){return(Wt="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})(t)}function Ft(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function qt(t){return(qt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Gt(t,e){return(Gt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function $t(){var t=function(t){function e(){return function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),t=this,!(n=qt(e).apply(this,arguments))||"object"!==Wt(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n;var t,n}var n,i,r;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}}),e&&Gt(t,e)}(e,Polymer.Element),n=e,r=[{key:"properties",get:function(){return{hass:Object,stateObj:Object,elementName:String,inDialog:{type:Boolean,value:!1}}}},{key:"observers",get:function(){return["observerFunc(hass, stateObj, elementName, inDialog)"]}}],(i=[{key:"observerFunc",value:function(t,e,n,i){s(this,n?n.toUpperCase():"DIV",{hass:t,stateObj:e,inDialog:i})}}])&&Ft(n.prototype,i),r&&Ft(n,r),e}();customElements.define("dynamic-element",t)}function Jt(t){return(Jt="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})(t)}function Kt(){var t,e,n=(t=["\n <style is=\"custom-style\" include=\"iron-flex iron-flex-alignment iron-flex-factors\"></style>\n <style>\n :host {\n display: inline-block;\n }\n .control-wrapper {\n margin: -4px -16px -4px 0;\n padding: 4px 16px;\n }\n ha-state-label-badge {\n margin-left: 8px;\n }\n dynamic-element {\n display: block;\n text-align: right;\n }\n #overlay {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n text-align: right;\n z-index: 1;\n }\n #lock {\n margin-top: 8px;\n opacity: 0.3;\n margin-right: 7px;\n }\n #lock.ha-cover-controls {\n margin-right: 52px;\n background-color: white;\n }\n .extra {\n margin-bottom: -16px;\n --ha-label-badge-size: 36px;\n --ha-label-badge-font-size: 1.2em;\n }\n .state {\n @apply --paper-font-body1;\n color: var(--primary-text-color);\n margin-left: 16px;\n text-align: right;\n line-height: 40px;\n }\n </style>\n <div class$='[[extraClass(extraObjVisible)]] horizontal layout'>\n <template is='dom-if' if='[[extraObjVisible]]'>\n <template is='dom-repeat'\n items='[[extraObj]]'\n on-dom-change='extraDomChanged'>\n <ha-state-label-badge hass='[[hass]]' state='[[item]]'></ha-state-label-badge>\n </template>\n </template>\n <template is='dom-if' if='[[_showControl(inDialog, stateObj)]]'>\n <template is='dom-if' if='[[controlElement]]'>\n <div class=\"control-wrapper\">\n <dynamic-element\n class='flex'\n state-obj=\"[[stateObj]]\"\n hass='[[hass]]'\n element-name='[[controlElement]]'>\n </dynamic-element>\n <template is='dom-if' if='[[isConfirmControls(stateObj)]]'>\n <div id=\"overlay\" on-click='clickHandler'>\n <template is='dom-if' if='[[stateObj.attributes.confirm_controls_show_lock]]'>\n <iron-icon id=\"lock\" class$=\"[[controlElement]]\" icon=\"mdi:lock-outline\"></iron-icon>\n </template>\n </div>\n </template>\n </div>\n </template>\n <template is='dom-if' if='[[!controlElement]]'>\n <div class='state'>[[computeStateDisplay(stateObj)]]</div>\n </template>\n </template>\n </div>\n "],e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}})));return Kt=function(){return n},n}function Yt(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Qt(t,e,n){return(Qt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Xt(t)););return t}(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(n):r.value}})(t,e,n||t)}function Xt(t){return(Xt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Zt(t,e){return(Zt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function te(t){return(te="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})(t)}function ee(){var t,e,n=(t=["\n <style>\n :host {\n margin: var(--ha-themed-slider-margin, initial);\n }\n .disable-off-when-min {\n --paper-slider-pin-start-color: var(--paper-slider-pin-color);\n }\n\n .disable-off-when-min.is-on {\n --paper-slider-knob-start-color: var(--paper-slider-knob-color);\n --paper-slider-knob-start-border-color: var(--paper-slider-knob-color);\n }\n paper-slider {\n margin: 4px 0;\n max-width: 100%;\n min-width: 100px;\n width: var(--ha-paper-slider-width, 200px);\n }\n </style>\n\n <paper-slider\n id='slider'\n min='[[_themedMin]]'\n max='[[_computeAttribute(theme, \"max\", max)]]'\n pin='[[_computeAttribute(theme, \"pin\", pin)]]'\n class$='[[computeClass(theme, isOn, _themedMin)]]' value='[[value]]'\n on-change='valueChanged'>\n </paper-slider>\n "],e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}})));return ee=function(){return n},n}function ne(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function ie(t,e,n){return(ie="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=re(t)););return t}(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(n):r.value}})(t,e,n||t)}function re(t){return(re=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function oe(t,e){return(oe=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ae(){var t=function(t){function e(){return function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),t=this,!(n=re(e).apply(this,arguments))||"object"!==te(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n;var t,n}var n,i,r;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}}),e&&oe(t,e)}(e,Polymer.Element),n=e,r=[{key:"template",get:function(){return Lt(ee())}},{key:"properties",get:function(){return{min:{type:Number,value:0},max:{type:Number,value:100},pin:{type:Boolean,value:!1},isOn:{type:Boolean,value:!1},disableOffWhenMin:{type:Boolean,value:!1,notify:!0},disableReportWhenNotChanged:{type:Boolean,value:!1},theme:Object,value:{type:Number,notify:!0},_themedMin:{type:Number,computed:'_computeAttribute(theme, "min", min)'}}}},{key:"observers",get:function(){return["computeEnabledThemedReportWhenNotChanged(theme, disableReportWhenNotChanged)"]}}],(i=[{key:"ready",value:function(){ie(re(e.prototype),"ready",this).call(this),this.disableOffWhenMin=!this._computeAttribute(this.theme,"off_when_min",!this.disableOffWhenMin),this.computeEnabledThemedReportWhenNotChanged(this.theme,this.disableReportWhenNotChanged)}},{key:"connectedCallback",value:function(){ie(re(e.prototype),"connectedCallback",this).call(this),this.$.slider._keyBindings=this.$.slider._keyBindings||{}}},{key:"computeEnabledThemedReportWhenNotChanged",value:function(t,e){this._enabledThemedReportWhenNotChanged=this._computeAttribute(t,"report_when_not_changed",!e)}},{key:"_computeAttribute",value:function(t,e,n){return t&&e in t?t[e]:n}},{key:"computeClass",value:function(t,e,n){var i="";return e&&(i+="is-on "),this._computeAttribute(t,"off_when_min",!this.disableOffWhenMin)||0===n?"":"".concat(i,"disable-off-when-min")}},{key:"valueChanged",value:function(t){this._enabledThemedReportWhenNotChanged||this.value!==t.target.value?this.value=t.target.value:t.stopPropagation()}}])&&ne(n.prototype,i),r&&ne(n,r),e}();customElements.define("ha-themed-slider",t)}function se(t){return(se="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})(t)}function ue(){var t,e,n=(t=["\n <style is=\"custom-style\" include=\"iron-flex iron-flex-alignment iron-flex-factors\"></style>\n <style>\n #container {\n position: relative;\n }\n .second-line, .state-and-toggle, .state-info {\n max-width: 100%;\n }\n .nowrap .state-and-toggle {\n overflow: hidden;\n flex-grow: 0;\n }\n .nowrap .second-line {\n overflow: hidden;\n }\n\n .second-line {\n padding-top: 20px;\n padding-bottom: 16px;\n margin-top: -20px;\n margin-bottom: -16px;\n }\n .stretch .second-line, .stretch ha-themed-slider {\n width: 100%;\n --ha-paper-slider-width: 100%;\n }\n .nowrap .state-info {\n min-width: initial;\n }\n ha-themed-slider, .top-wrapper {\n min-width: 100px;\n max-width: 100%;\n }\n .top-wrapper.stretch {\n display: block;\n }\n\n .hidden {\n display: none;\n }\n </style>\n\n <div id='container' class$='horizontal layout flex top-wrapper [[_computeWrapClass(mode, stretchSlider, lineTooLong, inDialog)]]'>\n <div class='horizontal layout justified flex-auto state-and-toggle'>\n <state-info\n class='state-info flex-auto'\n hass='[[hass]]'\n state-obj='[[stateObj]]'\n in-dialog='[[showLastChanged(stateObj, inDialog, extra)]]'\n secondary-line$='[[hasExtra(extra)]]'\n >\n <template is='dom-repeat' items='[[extra]]'>\n <div>[[item]]</div>\n </template>\n </state-info>\n <template is='dom-if' if='[[breakSlider]]' class='hidden'>\n <dynamic-with-extra hass='[[hass]]' state-obj='[[stateObj]]' control-element='[[controlElement]]' in-dialog='[[inDialog]]'></dynamic-with-extra>\n </template>\n </div>\n <template is='dom-if' if='[[showSlider]]' restamp>\n <div class='horizontal layout flex-auto end-justified second-line'>\n <ha-themed-slider\n id='slider'\n max=[[max]]\n min=[[min]]\n theme='[[stateObj.attributes.slider_theme]]'\n is-on='[[isOn(stateObj, nameOn)]]'\n value='{{sliderValue}}'\n disable-off-when-min='{{disableOffWhenMin}}'\n on-change='sliderChanged'\n on-click='stopPropagation'>\n </ha-themed-slider>\n <template is='dom-if' if='[[!breakSlider]]'>\n <dynamic-with-extra hass='[[hass]]' state-obj='[[stateObj]]' control-element='[[controlElement]]' in-dialog='[[inDialog]]'></dynamic-with-extra>\n </template>\n </div>\n </template>\n </div>\n "],e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}})));return ue=function(){return n},n}function le(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ce(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function pe(t,e,n){return(pe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=fe(t)););return t}(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(n):r.value}})(t,e,n||t)}function fe(t){return(fe=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function he(t,e){return(he=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function de(){var t=function(t){function e(){return function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),t=this,!(n=fe(e).apply(this,arguments))||"object"!==se(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n;var t,n}var n,i,r;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}}),e&&he(t,e)}(e,Ht(Polymer.Element)),n=e,r=[{key:"template",get:function(){return Lt(ue())}},{key:"properties",get:function(){return{domain:String,serviceMin:String,serviceMax:String,valueName:String,setValueName:String,nameOn:{type:String,value:"on"},min:{type:Number,value:0},max:{type:Number,value:255},sliderValue:{type:Number,value:0},disableOffWhenMin:Boolean,mode:String,stretchSlider:{type:Boolean,value:!1},breakSlider:{type:Boolean,value:!1},hideSlider:{type:Boolean,value:!1},lineTooLong:{type:Boolean,value:!1},minLineBreak:Number,maxLineBreak:Number,showSlider:{type:Number,computed:"_showSlider(inDialog, stateObj, hideSlider)"}}}},{key:"observers",get:function(){return["stateObjChanged(stateObj, nameOn, valueName)"]}}],(i=[{key:"ready",value:function(){pe(fe(e.prototype),"ready",this).call(this),this._onIronResize=this._onIronResize.bind(this)}},{key:"connectedCallback",value:function(){pe(fe(e.prototype),"connectedCallback",this).call(this),this._isConnected=!0,window.addEventListener("resize",this._onIronResize),this._waitForLayout()}},{key:"disconnectedCallback",value:function(){window.removeEventListener("resize",this._onIronResize),this._isConnected=!1,pe(fe(e.prototype),"disconnectedCallback",this).call(this)}},{key:"_waitForLayout",value:function(){var t=this;this._isConnected&&(this._setMode(),this._frameId||(this.readyToCompute=!1,this._frameId=window.requestAnimationFrame(function(){t._frameId=null,t.readyToCompute=!0,t._onIronResize()})))}},{key:"_setMode",value:function(){var t={hideSlider:"hide-slider"===this.mode&&this.lineTooLong,breakSlider:("break-slider"===this.mode||"hide-slider"===this.mode)&&this.lineTooLong};this.showSlider||(t.breakSlider=!0),this.setProperties(t)}},{key:"_onIronResize",value:function(){if(this.readyToCompute)if("no-slider"!==this.mode){var t=this.breakSlider,e=this.hideSlider;this.setProperties({lineTooLong:!1,hideSlider:!1,breakSlider:!1});var n=this.$.container,i=n.clientWidth;if(0!==i){if(i<=this.minLineBreak)this.lineTooLong=!0;else if(i>=this.maxLineBreak)this.lineTooLong=!1;else{if(e&&"hide-slider"===this.mode)return void this._waitForLayout();var r=n.clientHeight,o=this.root.querySelector(".state-info").clientHeight;this.lineTooLong=r>1.5*o,this.lineTooLong?this.minLineBreak=i:t||(this.maxLineBreak=i)}this._setMode()}}else this.setProperties({hideSlider:!0,breakSlider:!0})}},{key:"_computeWrapClass",value:function(t,e,n,i){return i?"":"single-line"===t?"nowrap":e&&n?"stretch wrap":"wrap"}},{key:"_showSlider",value:function(t,e,n){return!t&&!n}},{key:"sliderChanged",value:function(t){var e=parseInt(t.target.value,10),n={entity_id:this.stateObj.entity_id};if(!Number.isNaN(e)){var i=this.root.querySelector("#slider");t.target!==i?i=t.target:t.path?i=le(t.path,1)[0]:t.composedPath&&(i=le(t.composedPath(),1)[0]),0===e||e<=i.min&&!this.disableOffWhenMin?this.hass.callService(this.domain,this.serviceMin,n):(n[this.setValueName||this.valueName]=e,this.hass.callService(this.domain,this.serviceMax,n))}}},{key:"stateObjChanged",value:function(t,e,n){var i={sliderValue:this.isOn(t,e)?t.attributes[n]:0};t&&Object.assign(i,{minLineBreak:0,maxLineBreak:999,hideSlider:!1,breakSlider:!1,lineTooLong:!1,mode:t.attributes.state_card_mode,stretchSlider:!!t.attributes.stretch_slider}),this.setProperties(i),t&&this._waitForLayout()}},{key:"isOn",value:function(t,e){return t&&(!e||t.state===e)}},{key:"stopPropagation",value:function(t){t.stopPropagation()}}])&&ce(n.prototype,i),r&&ce(n,r),e}();customElements.define("state-card-with-slider",t)}function me(t){return(me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ye(){var t,e,n=(t=["\n <style is=\"custom-style\" include=\"iron-flex iron-flex-alignment\"></style>\n <style>\n #container {\n position: relative;\n }\n </style>\n\n <div id='container' class='horizontal layout justified'>\n <state-info\n hass='[[hass]]'\n class='state-info'\n state-obj='[[stateObj]]'\n in-dialog='[[showLastChanged(stateObj, inDialog, extra)]]'\n secondary-line$='[[hasExtra(extra)]]'>\n <template is='dom-repeat' items='[[extra]]'>\n <div>[[item]]</div>\n </template>\n </state-info>\n <dynamic-with-extra\n hass='[[hass]]'\n state-obj='[[stateObj]]'\n control-element='[[controlElement]]'\n in-dialog='[[inDialog]]'>\n </dynamic-with-extra>\n </div>\n "],e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}})));return ye=function(){return n},n}function be(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function ve(t){return(ve=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ge(t,e){return(ge=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _e(){var t=function(t){function e(){return function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),t=this,!(n=ve(e).apply(this,arguments))||"object"!==me(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n;var t,n}var n,i;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}}),e&&ge(t,e)}(e,Ht(Polymer.Element)),n=e,i=[{key:"template",get:function(){return Lt(ye())}}],null&&be(n.prototype,null),i&&be(n,i),e}();customElements.define("state-card-without-slider",t)}function we(t){return(we="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})(t)}function Oe(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Se(t,e,n){return(Se="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=ke(t)););return t}(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(n):r.value}})(t,e,n||t)}function ke(t){return(ke=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ee(t,e){return(Ee=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function je(){var t=["configurator"],e={light:1,cover:4,climate:1},n={toggle:"ha-entity-toggle",display:"",cover:"ha-cover-controls"},i=function(i){function o(){return function(t,e){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}(this),t=this,!(e=ke(o).apply(this,arguments))||"object"!==we(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e;var t,e}var c,p,f;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}}),e&&Ee(t,e)}(o,Polymer.Element),c=o,f=[{key:"properties",get:function(){return{hass:Object,inDialog:{type:Boolean,value:!1},stateObj:Object}}},{key:"observers",get:function(){return["inputChanged(hass, inDialog, stateObj)"]}}],(p=[{key:"connectedCallback",value:function(){Se(ke(o.prototype),"connectedCallback",this).call(this);var t=this.parentNode.parentNode;"DIV"===t.tagName&&(t.classList.contains("state")||t.classList.contains("child-card"))&&(this._container=t,t.style.setProperty("background-color","var(--paper-card-background-color, inherit)"),t.updateStyles||(t.updateStyles=function(e){Object.keys(e).forEach(function(n){t.style.setProperty(n,e[n])})})),this._isAttached=!0,this.inputChanged(this.hass,this.inDialog,this.stateObj)}},{key:"disconnectedCallback",value:function(){this._isAttached=!1,this._container&&(this._container.updateStyles({display:"",margin:"",padding:""}),r(this._container,this.hass.themes||{default_theme:"default",themes:{}},"default"),this._container=null),Se(ke(o.prototype),"disconnectedCallback",this).call(this)}},{key:"badgeMode",value:function(t,e,n){var i=this,r=[];if("group"===n)e.attributes.entity_id.forEach(function(n){var o=t.states[n];o?e.attributes.badges_list&&!e.attributes.badges_list.includes(o.entity_id)||r.push(window.customUI.maybeChangeObject(i,o,!1,!1)):console.warn("Unknown ID ".concat(n," in group ").concat(e.entity_id))});else if(r.push(e),this._container){this._container.style.display="inline-block";var o={display:"inline-block"};this._container.classList.contains("state")&&(o.margin="var(--ha-badges-card-margin, 0)"),this.updateStyles(o)}s(this,"HA-BADGES-CARD",{hass:t,states:r}),this._container&&this._container.updateStyles({width:"var(--ha-badges-card-width, initial)","text-align":"var(--ha-badges-card-text-align, initial)"}),this.lastChild.style.fontSize="85%",this.style.setProperty("--ha-state-label-badge-margin-bottom","0")}},{key:"cleanBadgeStyle",value:function(){this._container&&this._container.updateStyles({display:"",width:"","text-align":""}),this.updateStyles({display:"",margin:""})}},{key:"applyThemes",value:function(t,e){var n=this,i="default";this._container&&(n=this._container),e.attributes.theme&&(i=e.attributes.theme),r(n,t.themes||{default_theme:"default",themes:{}},i)}},{key:"maybeHideEntity",value:function(t){return t?(this._container&&this._container.updateStyles({margin:"",padding:""}),!1):(this.lastChild&&this.removeChild(this.lastChild),this._container&&this._container.updateStyles({margin:"0",padding:"0"}),!0)}},{key:"sliderEligible_",value:function(t,n,i){return!i&&e[t]&&e[t]&n.attributes.supported_features&&n.attributes.state_card_mode&&"no-slider"!==n.attributes.state_card_mode}},{key:"inputChanged",value:function(t,e,n){if(n&&t&&this._isAttached){var i=a(n),r=window.customUI.maybeChangeObject(this,n,e,!0);this.maybeHideEntity(r)||(this.applyThemes(t,r),e||"badges"!==r.attributes.state_card_mode?this.regularMode_(t,e,r,i):this.badgeMode(t,r,i))}}},{key:"regularMode_",value:function(e,i,r,o){this.cleanBadgeStyle();var c,p={hass:e,stateObj:r,inDialog:i},f=function(t,e){if("unavailable"===e.state)return"display";var n=a(e);return l.includes(n)?n:function(t,e){var n=a(e);return"group"===n?"on"===e.state||"off"===e.state:"climate"===n?u(e,4096):function(t,e){var n=t.services[e];return!!n&&("lock"===e?"lock"in n:"cover"===e?"open_cover"in n:"turn_on"in n)}(t,n)}(t,e)&&"hidden"!==e.attributes.control?"toggle":"display"}(e,r),h=r.attributes.state_card_custom_ui_secondary;"light"===o&&this.sliderEligible_(o,r,i)?(Object.assign(p,{controlElement:"ha-entity-toggle",serviceMin:"turn_off",serviceMax:"turn_on",valueName:"brightness",domain:o}),c="state-card-with-slider"):"cover"===o&&this.sliderEligible_(o,r,i)?(Object.assign(p,{controlElement:"ha-cover-controls",max:100,serviceMin:"close_cover",serviceMax:"set_cover_position",setValueName:"position",valueName:"current_position",nameOn:"open",domain:o}),c="state-card-with-slider"):"climate"===o&&this.sliderEligible_(o,r,i)?(Object.assign(p,{controlElement:"ha-climate-state",min:r.attributes.min_temp||-100,max:r.attributes.max_temp||200,serviceMin:"set_temperature",serviceMax:"set_temperature",valueName:"temperature",nameOn:"",domain:o}),c="state-card-with-slider"):void 0!==n[f]?(p.controlElement=n[f],c="state-card-without-slider"):r.attributes.show_last_changed&&!t.includes(f)&&(p.inDialog=!0),"unavailable"===r.state&&(p.controlElement=""),void 0!==r.attributes.control_element&&(p.controlElement=r.attributes.control_element),s(this,(h||c||"STATE-CARD-".concat(f)).toUpperCase(),p)}}])&&Oe(c.prototype,p),f&&Oe(c,f),o}();customElements.define("state-card-custom-ui",i)}Polymer&&Polymer.Element&&customElements.get("home-assistant")?$t():customElements.whenDefined("home-assistant").then(function(){return $t()}),customElements.whenDefined("state-card-display").then(function(){var t=function(t){function e(){return function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),t=this,!(n=Xt(e).apply(this,arguments))||"object"!==Jt(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n;var t,n}var n,i,o;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}}),e&&Zt(t,e)}(e,customElements.get("state-card-display")),n=e,o=[{key:"template",get:function(){return Lt(Kt())}},{key:"properties",get:function(){return{hass:Object,inDialog:{type:Boolean,value:!1},stateObj:Object,controlElement:String,extraObj:{type:Array,computed:"computeExtra(hass, stateObj, _attached)"},_attached:Boolean,extraObjVisible:{type:Boolean,computed:"computeExtraVisible(extraObj, inDialog)"}}}}],(i=[{key:"connectedCallback",value:function(){Qt(Xt(e.prototype),"connectedCallback",this).call(this),this._attached=!0}},{key:"disconnectedCallback",value:function(){this._isAttached=!1,Qt(Xt(e.prototype),"disconnectedCallback",this).call(this)}},{key:"computeExtra",value:function(t,e,n){var i=this;if(!e.attributes.extra_badge||!n)return[];var r=e.attributes.extra_badge;return Array.isArray(r)||(r=[r]),r.map(function(n){var r=null;if(n.entity_id&&t.states[n.entity_id]?r=Object.assign({},window.customUI.maybeChangeObject(i,t.states[n.entity_id],i.inDialog,!1)):n.attribute&&void 0!==e.attributes[n.attribute]&&(r={state:String(e.attributes[n.attribute]),entity_id:"none.none",attributes:{unit_of_measurement:n.unit}}),!r)return null;var o=n.blacklist_states;return void 0!==o&&(Array.isArray(o)||(o=[o]),o.some(function(t){return RegExp(t).test(r.state.toString())}))?null:(r._entityDisplay="",r.attributes=Object.assign({},{friendly_name:""}),r)}).filter(function(t){return null!=t})}},{key:"computeExtraVisible",value:function(t,e){return!(e||!t)&&0!==t.length}},{key:"extraClass",value:function(t){return t?"extra":""}},{key:"_showControl",value:function(t,e){return!!t||!e.attributes.hide_control}},{key:"computeStateDisplay",value:function(t){return Qt(Xt(e.prototype),"computeStateDisplay",this).call(this,this.haLocalize||this.localize,t)}},{key:"isConfirmControls",value:function(t){return t.attributes.confirm_controls||t.attributes.confirm_controls_show_lock}},{key:"clickHandler",value:function(t){var e=this;this.root.querySelector("#overlay").style.pointerEvents="none";var n=this.root.querySelector("#lock");n&&(n.icon="mdi:lock-open-outline",n.style.opacity="0.1"),window.setTimeout(function(){e.root.querySelector("#overlay").style.pointerEvents="",n&&(n.icon="mdi:lock-outline",n.style.opacity="")},5e3),t.stopPropagation()}},{key:"applyThemes",value:function(t,e,n){var i=n.attributes.theme||"default";r(e,t.themes||{default_theme:"default",themes:{}},i)}},{key:"extraDomChanged",value:function(){var t=this;this.root.querySelectorAll("ha-state-label-badge").forEach(function(e){t.applyThemes(t.hass,e,e.state)})}}])&&Yt(n.prototype,i),o&&Yt(n,o),e}();customElements.define("dynamic-with-extra",t)}),Polymer&&Polymer.Element&&customElements.get("home-assistant")?ae():customElements.whenDefined("home-assistant").then(function(){return ae()}),Polymer&&Polymer.Element&&customElements.get("home-assistant")?de():customElements.whenDefined("home-assistant").then(function(){return de()}),Polymer&&Polymer.Element&&customElements.get("home-assistant")?_e():customElements.whenDefined("home-assistant").then(function(){return _e()}),Polymer&&Polymer.Element&&customElements.get("home-assistant")?je():customElements.whenDefined("home-assistant").then(function(){return je()})},function(t,e){window.JSCompiler_renameProperty=function(t){return t}}]);
//# sourceMappingURL=scripts-es5.js.map</script>