${t}
`:""}\n `,i.hasListener||(i.addEventListener("click",(t=>{t.stopPropagation(),popUpOpen=location.hash+!0;localStorage.getItem("isManuallyClosed_"+e);popUpOpen!==e+!0?(navigate("",e),popUpOpen=e+!0):(history.replaceState(null,null,location.href.split("#")[0]),popUpOpen=e+!1)}),{passive:!0}),i.hasListener=!0),i};if(!this.buttonsAdded){const R=document.createElement("div");R.setAttribute("class","horizontal-buttons-stack-container"),this.content.appendChild(R),this.buttonsContainer=R}const i=(t,e)=>{if(hass.states[e].attributes.rgb_color){const n=hass.states[e].attributes.rgb_color,i=isColorCloseToWhite(n)?"rgba(255,220,200, 0.5)":`rgba(${n}, 0.5)`;t.style.backgroundColor=i,t.style.border="1px solid rgba(0,0,0,0)"}else hass.states[e].attributes.rgb_color||"on"!=hass.states[e].state?(t.style.backgroundColor="rgba(0,0,0,0)",t.style.border="1px solid var(--primary-text-color)"):(t.style.backgroundColor="rgba(255,255,255,0.5)",t.style.border="1px solid rgba(0,0,0,0)")};let o=[],a=1;for(;this.config[a+"_link"];){const U=a+"_",F=this.config[U+"name"]||"",X=this.config[U+"pir_sensor"];icon=this.config[U+"icon"]||"";const j=this.config[U+"link"],N=this.config[U+"entity"];o.push({button:F,pirSensor:X,icon:icon,link:j,lightEntity:N}),a++}if(this.config.auto_order&&o.sort(((t,e)=>{if(t.pirSensor&&e.pirSensor){if("on"===hass.states[t.pirSensor].state&&"on"===hass.states[e.pirSensor].state){return hass.states[t.pirSensor].last_updated${name}
\n ${h?`${formatedState}
`:""}\n `,this.buttonAdded=!0}function A(t){let e=t.querySelector(".feedback-element");e||(e=document.createElement("div"),e.setAttribute("class","feedback-element"),t.appendChild(e)),e.style.animation="tap-feedback .5s",setTimeout((()=>{e.style.animation="none",t.removeChild(e)}),500)}function I(t){f=t.pageX||(t.touches?t.touches[0].pageX:0),y=t.pageY||(t.touches?t.touches[0].pageY:0),v=S.value,t.target!==k&&t.target!==k.querySelector("ha-icon")&&(g=!0,document.addEventListener("mouseup",O,{passive:!0}),document.addEventListener("touchend",O,{passive:!0}),document.addEventListener("mousemove",L,{passive:!0}),document.addEventListener("touchmove",L,{passive:!0}),w=setTimeout((()=>{V(t.pageX||t.touches[0].pageX),D(),w=null}),200))}function L(t){const e=t.pageX||(t.touches?t.touches[0].pageX:0),n=t.pageY||(t.touches?t.touches[0].pageY:0);Math.abs(n-y)>Math.abs(e-f)?(clearTimeout(w),O()):(document.removeEventListener("mousemove",L),document.removeEventListener("touchmove",L),document.addEventListener("mousemove",T,{passive:!0}),document.addEventListener("touchmove",T,{passive:!0}))}function O(){g=!1,_=!1,D(),document.removeEventListener("mouseup",O),document.removeEventListener("touchend",O),document.removeEventListener("mousemove",T),document.removeEventListener("touchmove",T)}function D(){entityId.startsWith("light.")?(p=b,hass.callService("light","turn_on",{entity_id:entityId,brightness:p})):entityId.startsWith("media_player.")&&(u=m,hass.callService("media_player","volume_set",{entity_id:entityId,volume_level:u}))}function T(t){const e=t.pageX||(t.touches?t.touches[0].pageX:0),n=t.pageY||(t.touches?t.touches[0].pageY:0);g&&Math.abs(e-f)>10?V(e):g&&Math.abs(n-y)>10&&(g=!1,S.value=v)}function V(t){const e=S.getBoundingClientRect(),n=Math.min(Math.max(t-e.left,0),e.width)/e.width;entityId.startsWith("light.")?b=Math.round(255*n):entityId.startsWith("media_player.")&&(m=n),E.style.transition="none",E.style.transform=`translateX(${100*n}%)`}if(h&&formatedState&&(this.content.querySelector(".state").textContent=formatedState),this.eventAdded||"switch"!==d?this.eventAdded||"slider"!==d?this.eventAdded||"custom"!==d||($.addEventListener("click",(()=>A(this.switchButton)),{passive:!0}),addActions(this,this.switchButton),this.eventAdded=!0):(S.addEventListener("mousedown",I,{passive:!0}),S.addEventListener("touchstart",I,{passive:!0}),addActions(this,this.iconContainer),this.eventAdded=!0):($.addEventListener("click",(()=>A(this.switchButton)),{passive:!0}),$.addEventListener("click",(function(t){t.target!==k&&t.target!==k.querySelector("ha-icon")&&toggleEntity(entityId)}),{passive:!0}),addActions(this,this.iconContainer),this.eventAdded=!0),this.isDragging||"slider"!==d||(this.rangeFill.style.transition="all .3s",entityId.startsWith("light.")?this.rangeFill.style.transform=`translateX(${p/255*100}%)`:entityId.startsWith("media_player.")&&(this.rangeFill.style.transform=`translateX(${100*u}%)`)),"slider"===d&&(!this.colorAdded||x||this.wasEditing)){if(entityId.startsWith("light.")){const Z=hass.states[entityId].attributes.rgb_color;this.rgbColorOpacity=Z?isColorCloseToWhite(Z)?"rgba(255,220,200,0.5)":`rgba(${Z}, 0.5)`:stateOn?"rgba(255,220,200, 0.5)":"rgba(255, 255, 255, 0.5)",this.rgbColor=Z?isColorCloseToWhite(Z)?"rgb(255,220,200)":`rgb(${Z})`:stateOn?"rgba(255,220,200, 1)":"rgba(255, 255, 255, 1)",this.iconFilter=Z?isColorCloseToWhite(Z)?"none":"brightness(1.1)":"none"}else this.rgbColorOpacity="var(--accent-color)",this.iconFilter="brightness(1.1)";this.colorAdded=!0,this.wasEditing=!1}const B=`\n ha-card {\n margin-top: 0 !important;\n background: none !important;\n opacity: ${"unavailable"!==state?"1":"0.5"};\n }\n \n .button-container {\n position: relative;\n width: 100%;\n height: 50px;\n z-index: 0;\n background-color: var(--background-color-2,var(--secondary-background-color));\n border-radius: 25px;\n mask-image: radial-gradient(white, black);\n -webkit-mask-image: radial-gradient(white, black);\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n -webkit-transform: translateZ(0);\n overflow: hidden;\n }\n \n .switch-button,\n .range-slider {\n display: inline-flex;\n position: absolute;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n background-color: ${stateOn&&["switch","custom"].includes(d)?"var(--accent-color)":"rgba(0,0,0,0)"};\n }\n \n .range-fill {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n background-color: ${this.rgbColorOpacity};\n }\n \n .switch-button {\n cursor: pointer !important;\n }\n \n .range-slider {\n cursor: ew-resize;\n }\n \n .range-fill {\n z-index: 0;\n width: 100%;\n left: -100%;\n }\n \n .icon-container {\n position: absolute;\n display: flex;\n z-index: 1;\n width: 38px;\n height: 38px;\n margin: 6px;\n border-radius: 50%;\n cursor: pointer !important;\n background-color: var(--card-background-color,var(--ha-card-background));\n }\n \n .icon-container::after {\n content: '';\n position: absolute;\n display: block;\n opacity: ${entityId.startsWith("light.")?"0.2":"0"};\n width: 100%;\n height: 100%;\n transition: all 1s;\n border-radius: 50%;\n background-color: ${stateOn?this.rgbColor?this.rgbColor:"var(--accent-color)":"var(--card-background-color,var(--ha-card-background))"};\n }\n \n ha-icon {\n display: flex;\n position: absolute;\n margin: inherit;\n padding: 1px 2px;\n width: 22px; \n height: 22px;\n color: ${stateOn?this.rgbColor?this.rgbColor:"var(--accent-color)":"inherit"};\n opacity: ${stateOn?"1":"0.6"};\n filter: ${stateOn?this.rgbColor?this.iconFilter:"brightness(1.1)":"inherit"};\n }\n \n .entity-picture {\n display: flex;\n height: 38px;\n width: 38px;\n border-radius: 100%;\n }\n \n .name-container {\n position: relative;\n display: ${h?"block":"inline-flex"};\n margin-left: 58px;\n z-index: 1;\n font-weight: 600;\n align-items: center;\n line-height: ${h?"4px":"16px"};\n padding-right: 16px;\n }\n \n .state {\n font-size: 12px;\n opacity: 0.7;\n }\n \n .feedback-element {\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(0,0,0);\n }\n \n @keyframes tap-feedback {\n 0% {transform: translateX(-100%); opacity: 0;}\n 64% {transform: translateX(0); opacity: 0.1;}\n 100% {transform: translateX(100%); opacity: 0;}\n }\n `;addStyles(this,B,customStyles,state,entityId,x);break;case"separator":if(!this.separatorAdded||editor){if(editor&&this.separatorContainer)for(;this.separatorContainer.firstChild;)this.separatorContainer.removeChild(this.separatorContainer.firstChild);this.separatorAdded||(this.separatorContainer=document.createElement("div"),this.separatorContainer.setAttribute("class","separator-container")),this.separatorContainer.innerHTML=`\n${name}
\n${formatedState}
\nAlmost everything is available in the GUI editor, but in the YAML editor you can add your own custom styles, create custom buttons or modify the tap actions of all cards. You can find more details on my GitHub page.
And if you like my project and want to support me, please consider making a donation. Any amount is welcome and very much appreciated! 🍻
${this.makeVersion()}