!function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1)}([function(e){e.exports=JSON.parse('{"name":"fold-entity-row","private":true,"version":"19.0.0","description":"","scripts":{"build":"webpack","watch":"webpack --watch --mode=development","update-card-tools":"npm uninstall card-tools && npm install thomasloven/lovelace-card-tools"},"keywords":[],"author":"Thomas Lovén","license":"MIT","devDependencies":{"webpack":"^4.42.0","webpack-cli":"^3.3.11"},"dependencies":{"card-tools":"github:thomasloven/lovelace-card-tools"}}')},function(e,t,o){"use strict";o.r(t);const n=customElements.get("home-assistant-main")?Object.getPrototypeOf(customElements.get("home-assistant-main")):Object.getPrototypeOf(customElements.get("hui-view")),i=n.prototype.html,r=n.prototype.css;function s(){return document.querySelector("hc-main")?document.querySelector("hc-main").hass:document.querySelector("home-assistant")?document.querySelector("home-assistant").hass:void 0}function a(e,t,o=null){if((e=new Event(e,{bubbles:!0,cancelable:!1,composed:!0})).detail=t||{},o)o.dispatchEvent(e);else{var n=function(){var e=document.querySelector("hc-main");return e=e?(e=(e=(e=e&&e.shadowRoot)&&e.querySelector("hc-lovelace"))&&e.shadowRoot)&&e.querySelector("hui-view")||e.querySelector("hui-panel-view"):(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=document.querySelector("home-assistant"))&&e.shadowRoot)&&e.querySelector("home-assistant-main"))&&e.shadowRoot)&&e.querySelector("app-drawer-layout partial-panel-resolver"))&&e.shadowRoot||e)&&e.querySelector("ha-panel-lovelace"))&&e.shadowRoot)&&e.querySelector("hui-root"))&&e.shadowRoot)&&e.querySelector("ha-app-layout #view"))&&e.firstElementChild}();n&&n.dispatchEvent(e)}}const l=["input_number","input_select","input_text","scene","weblink"];let c=window.cardHelpers;const d=new Promise(async(e,t)=>{c&&e();const o=async()=>{c=await window.loadCardHelpers(),window.cardHelpers=c,e()};window.loadCardHelpers?o():window.addEventListener("load",async()=>{!function(){if(customElements.get("hui-view"))return!0;const e=document.createElement("partial-panel-resolver");if(e.hass=s(),!e.hass||!e.hass.panels)return!1;e.route={path:"/lovelace/"},e._updateRoutes();try{document.querySelector("home-assistant").appendChild(e)}catch(e){}finally{document.querySelector("home-assistant").removeChild(e)}customElements.get("hui-view")}(),window.loadCardHelpers&&o()})});function u(e,t){const o={type:"error",error:e,origConfig:t},n=document.createElement("hui-error-card");return customElements.whenDefined("hui-error-card").then(()=>{const e=document.createElement("hui-error-card");e.setConfig(o),n.parentElement&&n.parentElement.replaceChild(e,n)}),d.then(()=>{a("ll-rebuild",{},n)}),n}function h(e,t){if(!t||"object"!=typeof t||!t.type)return u(`No ${e} type configured`,t);let o=t.type;if(o=o.startsWith("custom:")?o.substr("custom:".length):`hui-${o}-${e}`,customElements.get(o))return function(e,t){let o=document.createElement(e);try{o.setConfig(JSON.parse(JSON.stringify(t)))}catch(e){o=u(e,t)}return d.then(()=>{a("ll-rebuild",{},o)}),o}(o,t);const n=u(`Custom element doesn't exist: ${o}.`,t);n.style.display="None";const i=setTimeout(()=>{n.style.display=""},2e3);return customElements.whenDefined(o).then(()=>{clearTimeout(i),a("ll-rebuild",{},n)}),n}function p(e){if(c)return c.createRowElement(e);const t=new Set(["call-service","cast","conditional","divider","section","select","weblink"]),o={alert:"toggle",automation:"toggle",climate:"climate",cover:"cover",fan:"toggle",group:"group",input_boolean:"toggle",input_number:"input-number",input_select:"input-select",input_text:"input-text",light:"toggle",lock:"lock",media_player:"media-player",remote:"toggle",scene:"scene",script:"script",sensor:"sensor",timer:"timer",switch:"toggle",vacuum:"toggle",water_heater:"climate",input_datetime:"input-datetime",none:void 0};if(!e)return u("Invalid configuration given.",e);if("string"==typeof e&&(e={entity:e}),"object"!=typeof e||!e.entity&&!e.type)return u("Invalid configuration given.",e);const n=e.type||"default";return t.has(n)||n.startsWith("custom:")?h("row",e):h("entity-row",{type:o[e.entity?e.entity.split(".",1)[0]:"none"]||"text",...e})}class m extends n{static get properties(){return{open:Boolean,rows:{}}}setConfig(e){this._config=Object.assign({},{open:!1,padding:20,group_config:{}},e),this.open=this.open||this._config.open;let t=this._config.head;if(this._config.entity&&(t=this._config.entity),!t)throw new Error("No fold head specified");"string"==typeof t&&(t={entity:t});let o=this._config.items;if(void 0!==this._config.entities&&(o=this._config.entities),t.entity&&t.entity.startsWith("group.")&&void 0===o)o=s().states[t.entity].attributes.entity_id;else{if(void 0===o)throw new Error("No entities specified.");if(!o||void 0===o.length)throw new Error("Entities must be a list.")}const n=e=>("string"==typeof e&&(e={entity:e}),Object.assign({},this._config.group_config,e));this.head=p(t),this.head.hass=s(),this.head.addEventListener("click",e=>{this.hasMoreInfo(t)||t.tap_action||this.toggle(e)}),this.head.setAttribute("head","head"),this.applyStyle(this.head,t),"HUI-SECTION-ROW"===this.head.tagName&&customElements.whenDefined(this.head.localName).then(async()=>{await this.updateComplete,await this.head.updateComplete,this.head.shadowRoot.querySelector(".divider").style.marginRight="-56px"}),this.rows=o.map(e=>{const t=p(n(e));return t.hass=s(),this.hasMoreInfo(e)&&t.classList.add("state-card-dialog"),this.applyStyle(t,n(e)),t})}async applyStyle(e,t){if(!t.style)return;e.updateComplete&&await e.updateComplete;const o=document.createElement("card-mod");o.template={template:t.style,variables:{config:t},entity_ids:t.entity_ids},customElements.whenDefined(e.localName).then(()=>{e.shadowRoot&&e.shadowRoot.appendChild(o)})}toggle(e){e&&e.stopPropagation(),this.open=!this.open}hasMoreInfo(e){const t=e.entity||("string"==typeof e?e:null);return!(!t||l.includes(t.split(".",1)[0]))}set hass(e){this.rows.forEach(t=>t.hass=e),this.head.hass=e}render(){return i`