/*! For license information please see bubble-card.js.LICENSE.txt */ (()=>{"use strict";var e={134:(e,t,n)=>{n.r(t),n.d(t,{deleteFile:()=>h,deleteModuleFile:()=>C,ensureBCTProviderAvailable:()=>c,getAllModulesLastModified:()=>T,getCachedAggregatedModules:()=>E,getModuleLastModified:()=>M,isBCTAvailableSync:()=>d,isMigrationDone:()=>v,listFiles:()=>u,readAllModules:()=>w,readConfig:()=>g,readFile:()=>p,setMigrationDone:()=>y,writeConfig:()=>f,writeFile:()=>b,writeModuleYaml:()=>k});var o=n(382);const i=5e3,a=3e4,r=6e4,s={checked:!1,available:!1,lastChecked:0,retryAt:0,pendingPromise:null};function l(e){try{window.__bubble_bct_available=!!e}catch(e){}}async function c(e){const t=Date.now();if(!e){if(s.checked&&s.available&&t-s.lastChecked{try{const t=await e.callWS({type:"bubble_card_tools/list_modules"}),n=!!t&&Array.isArray(t.files);s.checked=!0,s.available=n,s.lastChecked=Date.now(),s.retryAt=n?0:Date.now()+a,l(n);const o=e?.user?.is_admin||e?.user?.is_owner;if(n&&"function"==typeof e?.connection?.subscribeEvents&&!S&&o)try{e.connection.subscribeEvents(()=>{!function(){try{localStorage.removeItem(A())}catch(e){}}();try{document.dispatchEvent(new CustomEvent("yaml-modules-updated"))}catch(e){}},"bubble_card_tools.updated"),S=!0}catch(e){}return n}catch(e){return s.checked&&s.available?(s.checked=!1,s.available=!1,s.lastChecked=Date.now(),s.retryAt=Date.now()+i,l(!1)):(s.lastChecked=Date.now(),s.retryAt=Date.now()+i),!1}finally{s.pendingPromise=null}})(),s.pendingPromise}function d(){const e=Date.now();return!!(s.checked&&s.available&&e-s.lastChecked<3e5)||!(s.checked&&!s.available&&s.retryAt&&e{const o=n[t];o&&o.updated_at===e?r.push({name:t,updated_at:e,modules:o.modules||{}}):a.push({name:t,updated_at:e})});const s=a.map(async t=>{const n=await p(e,t.name);if(!n||!n.content)return{name:t.name,updated_at:t.updated_at,modules:{}};let i=null;try{i=o.Ay.load(n.content)}catch(e){i=null}const a={};if(i&&"object"==typeof i){const e=Object.keys(i);if(1===e.length){const t=e[0],n=i[t];if(n&&(n.name||n.code)){const e=_(t,n);a[t]=e}}else for(const t of e){const e=i[t];if(e&&"object"==typeof e&&(e.name||e.code)){const n=_(t,e);a[t]=n}}}return{name:t.name,updated_at:t.updated_at,modules:a}}),l=await Promise.all(s),c={};for(const e of r)c[e.name]={updated_at:e.updated_at,modules:e.modules};for(const e of l)c[e.name]={updated_at:e.updated_at,modules:e.modules};const d=new Map;Object.values(c).forEach(e=>{const t=e?.modules||{};Object.keys(t).forEach(e=>{d.set(e,t[e])})});const b={};return d.forEach((e,t)=>{b[t]=e}),function(e){try{localStorage.setItem(A(),JSON.stringify(e))}catch(e){}}({version:$,files:c,aggregatedModules:b,updatedAt:(new Date).toISOString()}),d}async function x(e){try{await w(e)}catch(e){}}async function k(e,t,n){let i="";if("string"==typeof n)i=n;else if(n&&"object"==typeof n){const e={},a={...n};delete a.id,delete a.yaml,delete a.editor_raw,Array.isArray(a.supported)&&Array.isArray(a.unsupported)&&delete a.unsupported,e[t]=a,i=o.Ay.dump(e,{indent:2,lineWidth:-1,noRefs:!0,noCompatMode:!0})}const a=`modules/${t}.yaml`,r=await b(e,a,i);return r&&"error"===r.status||await x(e),r}async function C(e,t){const n=`modules/${t}.yaml`,o=await h(e,n);return o&&"error"===o.status||await x(e),o}const $=1;let S=!1;function A(){try{const e="undefined"!=typeof location?location.host:"default";return`bubble-card-bct-cache-v${$}:${e}`}catch(e){return`bubble-card-bct-cache-v${$}:default`}}function L(){try{const e=localStorage.getItem(A());if(!e)return null;const t=JSON.parse(e);return t&&"object"==typeof t?t:null}catch(e){return null}}function E(){const e=L(),t=e?.aggregatedModules;return t&&"object"==typeof t&&Object.keys(t).length>0?t:null}function M(e){try{const t=L();if(!t||!t.files)return null;const n=`modules/${e}.yaml`,o=t.files[n];return o&&o.updated_at?o.updated_at:null}catch(e){return null}}function T(){try{const e=L();if(!e||!e.files)return new Map;const t=new Map;return Object.keys(e.files).forEach(n=>{if(n.startsWith("modules/")&&n.endsWith(".yaml")){const o=n.replace("modules/","").replace(".yaml",""),i=e.files[n];i&&i.updated_at&&t.set(o,i.updated_at)}}),t}catch(e){return new Map}}},140:(e,t,n)=>{n.d(t,{$i:()=>r,Bz:()=>a,qd:()=>i});var o=n(716);function i(e,t=40){if(Array.isArray(e)&&3===e.length){for(let t=0;t<3;t++)if(e[t]<0||e[t]>255)return;return e.every(e=>Math.abs(e-255)<=t)}}function a(e,t,n=1){if(!e||"string"!=typeof e)return`rgba(0, 0, 0, ${t})`;let o;if(e.startsWith("#"))o=4===e.length?"rgba("+Math.min(255,parseInt(e.charAt(1).repeat(2),16)*n)+", "+Math.min(255,parseInt(e.charAt(2).repeat(2),16)*n)+", "+Math.min(255,parseInt(e.charAt(3).repeat(2),16)*n)+", "+t+")":"rgba("+Math.min(255,parseInt(e.slice(1,3),16)*n)+", "+Math.min(255,parseInt(e.slice(3,5),16)*n)+", "+Math.min(255,parseInt(e.slice(5,7),16)*n)+", "+t+")";else if(e.startsWith("rgb")){let i=e.match(/\d+/g);i&&i.length>=3&&(o="rgba("+Math.min(255,i[0]*n)+", "+Math.min(255,i[1]*n)+", "+Math.min(255,i[2]*n)+", "+t+")")}else if(e.startsWith("var(--")){let i=e.slice(4,-1),r=window.getComputedStyle(document.documentElement).getPropertyValue(i);r&&(r.startsWith("#")||r.startsWith("rgb"))&&(o=a(r,t,n))}return o??`rgba(0, 0, 0, ${t})`}function r(e=!0){const t=(0,o.qL)("var(--primary-background-color, #ffffff)");let n=(0,o.E2)(t)||(0,o.rY)(t)||[255,255,255];const i=[0,145,255].map((e,t)=>Math.round(.7*e+.3*n[t])),a=`rgb(${i[0]}, ${i[1]}, ${i[2]})`;return e&&document.documentElement.style.setProperty("--bubble-default-color",a),a}},175:(e,t,n)=>{n.d(t,{H2:()=>l,L:()=>m,NH:()=>c,Y1:()=>p,Zu:()=>h,gQ:()=>f,lc:()=>v,m_:()=>u,mg:()=>w,nu:()=>d,pZ:()=>y,rz:()=>b,uH:()=>g,zD:()=>_});var o=n(716),i=n(388),a=n(642),r=n(315);function s(e,t,n){return t.force_icon||t.icon?"":(0,i.Qp)(e,n,!0)}function l(e,t,n){const a=t.entity??e.config.entity,r=a?.startsWith("input_select")||a?.startsWith("select")||t.select_attribute,l=t.sub_button_type,c=null!=l?"select"===l:r,d=l??(r?"select":"default");return{index:n,entity:a,context:e,state:e._hass.states[a],name:t.name??(0,o.D$)(e,"friendly_name",a)??"",attributeType:t.attribute??"",attribute:(0,o.D$)(e,t.attribute??"",a),isOn:(0,o.$C)(e,a),showName:t.show_name??!1,showState:t.show_state??!1,showAttribute:t.show_attribute??!1,showLastChanged:t.show_last_changed??!1,showLastUpdated:t.show_last_updated??!1,showIcon:t.show_icon??!0,showBackground:t.show_background??!0,stateBackground:t.state_background??!0,lightBackground:t.light_background??!0,showArrow:t.show_arrow??!0,isSelect:c,icon:(0,i.sW)(e,a,t.icon??""),image:s(e,t,a),subButtonType:d,alwaysVisible:t.always_visible??!1,subButton:t}}function c(e,t,n,i){if(!t||!n)return;const a=i?.scrolling_effect??e.config?.scrolling_effect??!0,r={...e,config:{...e.config,scrolling_effect:a}};(0,o.Nl)(r,t,n)}function d(e,t,n=null){const{state:i,name:a,attribute:r,attributeType:s,showName:l,showState:u,showAttribute:p,showLastChanged:b,showLastUpdated:h,entity:m}=e,g=[];if(l&&a&&"unknown"!==a&&g.push(a),i&&u&&"unknown"!==i.state){const a=(0,o.Vw)(m);if(a){const r=(0,o.ls)(i),s=(0,o.PF)(t._hass,i,r);s&&g.push(s),n&&"active"===i.state?(0,o.df)(n,t,m,()=>{if(n.isConnected&&t._hass?.states?.[m]){const i=t._hass.states[m];if(i&&"active"===i.state){const o=d({...e,state:i},t,n);n.nameContainer&&c(t,n.nameContainer,o,e.subButton)}else(0,o.j9)(n)}else(0,o.j9)(n)}):n&&a&&(0,o.j9)(n)}else g.push(t._hass.formatEntityState(i)),n&&(0,o.j9)(n)}else n&&(0,o.j9)(n);if(i&&b&&"unknown"!==i.last_changed&&g.push((0,o.r6)(i.last_changed,t._hass.locale.language)),i&&h&&"unknown"!==i.last_updated&&g.push((0,o.r6)(i.last_updated,t._hass.locale.language)),i&&p)if(s.includes("forecast")){const e="km"===t._hass.config.unit_system.length,n=t._hass?.locale?.language||"en-US";if(s.includes("temperature")&&null!=r){const e=parseFloat(r),i=(0,o.$z)(t._hass),a=0===e||0===e?0:1;g.push((0,o.IU)(e,a,i,n))}else if(s.includes("humidity")&&null!=r)g.push((0,o.IU)(parseFloat(r),0,"%",n));else if(s.includes("precipitation")&&null!=r)g.push((0,o.IU)(parseFloat(r),1,"mm",n));else if(s.includes("wind_speed")&&null!=r){const t=e?"km/h":"mph";g.push((0,o.IU)(parseFloat(r),1,t,n))}else null!=r&&"unknown"!==r&&g.push(r)}else{const e=t._hass.formatEntityAttributeValue(i,s),n=i.attributes?.[s],o=e&&"string"==typeof e&&e.trim().startsWith("0")&&e.trim().length>1;(0!==r&&"unknown"!==r&&null!=r||o)&&"unknown"!==n&&null!=n&&g.push(e??r)}return g.length?g.join(" · ").charAt(0).toUpperCase()+g.join(" · ").slice(1):""}function u(e,t,n){const{showIcon:o,isSelect:i}=t;if(!e._hasVisibilityConditions){const t=!n&&!o&&!i;e.classList.toggle("hidden",t)}e.dropdownContainer&&(e.dropdownContainer.classList.toggle("no-icon-select-container",!n&&!o&&i),e.dropdownArrow.classList.toggle("no-icon-select-arrow",!n&&!o&&i))}function p(e,t){const{showBackground:n,isOn:a,stateBackground:r,lightBackground:s,entity:l,context:c}=t;if(!n)return(e.classList.contains("background-on")||e.classList.contains("background-off"))&&e.classList.remove("background-on","background-off"),void(e.style.getPropertyValue("--bubble-sub-button-light-background-color")&&e.style.removeProperty("--bubble-sub-button-light-background-color"));const d=(0,i.S1)(t.state,l),u=e._previousColorSignature!==d;if(e._previousColorSignature=d,a&&r){let t;if((0,o.m_)(c,l))t="var(--red-color, var(--error-color))";else{const e=c.config.card_type;if("slider"===c.config.button_type){let e=null;if(c.elements?.rangeFill)try{e=getComputedStyle(c.elements.rangeFill).backgroundColor}catch(e){}t=(0,o.C$)(c,l,s,e,null)}else{const n="button"===e?c.card?.style.getPropertyValue("--bubble-button-background-color"):c.popUp?.style.getPropertyValue("--bubble-button-background-color");t=(0,o.C$)(c,l,s,n||null)}}(e.style.getPropertyValue("--bubble-sub-button-light-background-color")!==t||u)&&e.style.setProperty("--bubble-sub-button-light-background-color",t),e.classList.contains("background-on")||(e.classList.add("background-on"),e.classList.remove("background-off"))}else e.classList.contains("background-off")||(e.classList.add("background-off"),e.classList.remove("background-on")),e.style.getPropertyValue("--bubble-sub-button-light-background-color")&&e.style.removeProperty("--bubble-sub-button-light-background-color")}function b(e,t){const{subButton:n,isSelect:i,entity:r}=t;if(("none"!==n.tap_action?.action||"none"!==n.double_tap_action?.action||"none"!==n.hold_action?.action)&&!e.actionAdded){const o={tap_action:{action:i?"none":"more-info"},double_tap_action:{action:"none"},hold_action:{action:"none"}};if("slider"!==t.subButtonType||t.alwaysVisible)if(i){const t={...n,tap_action:{action:"none"}};(0,a.dN)(e,t,r),e.setAttribute("no-slide","")}else(0,a.dN)(e,n,r,o);else{const t={...n,tap_action:{action:"none"}};(0,a.dN)(e,t,r),e.setAttribute("no-slide","")}(0,a.pd)(e,e.feedback),i&&(e.style.pointerEvents="auto",e.style.cursor="pointer"),e.actionAdded=!0}if("slider"===t.subButtonType&&!t.alwaysVisible&&(e.classList.add("bubble-action"),e.style.cursor="pointer",e.style.pointerEvents="auto",!e.haRipple))try{e.haRipple=(0,o.n)("ha-ripple"),e.appendChild(e.haRipple)}catch(e){}}function h(e,t,n,o=null){const i=t.visibility,a=t=>{e?.sliderAlwaysVisible&&e.sliderWrapper&&(t?(e.sliderWrapper.style.removeProperty("display"),e.sliderWrapper.removeAttribute("aria-hidden")):(e.sliderWrapper.style.display="none",e.sliderWrapper.setAttribute("aria-hidden","true")))};if(null!=i){e._hasVisibilityConditions=!0;const t=(0,r.eC)(i);if((0,r.db)(t)){const i=(0,r.XH)(t,n);void 0!==e._previousVisibilityState&&e._previousVisibilityState===i||(e.classList.toggle("hidden",!i),e._previousVisibilityState=i,(t=>{if(!t&&e.sliderOpen&&!e.sliderAlwaysVisible&&e.sliderWrapper&&o){e.sliderWrapper.classList.add("is-hidden"),e.sliderOpen=!1,e.sliderCloseBtn&&e.sliderCloseBtn.classList.add("is-hidden");const t=e._parentGroupContainer;if(t&&t.classList&&t.classList.remove("group-slider-open"),!t&&o.elements){const e=(e,t)=>{e&&e.classList.toggle("is-hidden",t)};e(o.elements?.nameContainer,!1),e(o.elements?.iconContainer,!1),e(o.elements?.image,!1),e(o.elements?.buttonsContainer,!1),o.elements?.subButtonContainer&&(o.elements.subButtonContainer.style.opacity="",o.elements.subButtonContainer.style.pointerEvents="")}if(e._globalBlockerAdded&&e._globalBlockerHandler){try{(e._globalBlockerEvents||["pointerdown","pointerup","click","touchstart","touchend","mousedown","mouseup"]).forEach(t=>document.removeEventListener(t,e._globalBlockerHandler,!0))}catch(e){}try{delete e._globalBlockerHandler,delete e._globalBlockerEvents}catch(e){}e._globalBlockerAdded=!1}try{e._blockerPointerDownInside=!1}catch(e){}}})(i)),a(i)}else a(!0)}else e._hasVisibilityConditions=!1,a(!0)}function m(e,t,n="main",o=null){try{const i=t.width;if(t.fill_width||null==i||""===i)t.fill_width?(e.style.removeProperty("width"),e.style.removeProperty("flex")):null!=i&&""!==i||(e.style.removeProperty("width"),e.style.removeProperty("flex"));else{const t=Number(i);if(!Number.isNaN(t)&&t>0){let i="main"===n;if("bottom"===n&&o)if(o.classList.contains("alignment-start")||o.classList.contains("alignment-end")||o.classList.contains("alignment-center"))i=!0;else{const e=o.style.getPropertyValue("--bubble-sub-button-group-justify-content");if(e){const t=e.trim().toLowerCase();i=["start","end","center"].includes(t)}}const a=i?"px":"%";let r=`${t}${a}`;if("%"===a&&o&&o.classList.contains("display-inline")){const e=8,n=parseInt(o.dataset.totalButtonsWithWidth||"0",10);n>0&&(r=`calc(${t}% - ${(n-1)*e/n}px)`)}e.style.width=r,e.style.flex="0 0 auto"}else if("string"==typeof i){let t=i;if(i.includes("%")&&o&&o.classList.contains("display-inline")){const e=i.match(/(\d+(?:\.\d+)?)%/);if(e){const n=parseFloat(e[1]),i=8,a=parseInt(o.dataset.totalButtonsWithWidth||"0",10);a>0&&(t=`calc(${n}% - ${(a-1)*i/a}px)`)}}e.style.width=t,e.style.flex="0 0 auto"}}}catch(e){}}function g(e,t){try{const n=t.custom_height;if(null!=n&&""!==n){const t=Number(n);!Number.isNaN(t)&&t>0&&e.style.setProperty("--bubble-sub-button-height",`${t}px`)}else e.style.removeProperty("--bubble-sub-button-height")}catch(e){}}function f(e,t){if(!e||!e.classList)return;const n=!!t?.fill_width;e.classList.toggle("fill-width",n)}function y(e,t,n){if(t.hide_when_parent_unavailable&&n.config.entity&&!n.detectedEditor){if("unavailable"===(0,o.Gu)(n,n.config.entity))return e.style.display="none",!0;"none"===e.style.display&&(e.style.display="")}return!1}function v(e){return!!e&&!Array.isArray(e)&&(Array.isArray(e.main)||Array.isArray(e.bottom))}function _(e){if(!Array.isArray(e))return{main:[],bottom:[]};const t=[];return e.forEach(e=>{e&&t.push({...e})}),{main:t,bottom:[]}}function w(e){if(!e)return{main:[],bottom:[]};const t=e.sub_button;return v(t)?{main:Array.isArray(t.main)?[...t.main]:[],bottom:Array.isArray(t.bottom)?[...t.bottom]:[]}:_(t||[])}},241:(e,t,n)=>{function o(){try{const e=localStorage.getItem("bubble-card-module-store");if(!e)return null;const t=JSON.parse(e);if(localStorage.getItem("bubble-card-api-failure-timestamp")&&t&&t.expirationDate.now()?t:t||null}catch(e){return console.error("Error reading cache:",e),null}}function i(e){if(e&&0!==Object.keys(e).length)try{const t=Date.now()+864e5;localStorage.setItem("bubble-card-module-store",JSON.stringify({modules:e,expiration:t,lastFetchedAt:Date.now()})),console.log("Module data cached until",new Date(t))}catch(e){console.error("Error saving to cache:",e)}}function a(e,t,n="info"){if(e.hass){const o=new CustomEvent("hass-notification",{detail:{message:t,severity:n},bubbles:!0,composed:!0});e.dispatchEvent(o)}else console.log(`[${n}] ${t}`)}n.d(t,{TJ:()=>o,aN:()=>i,qk:()=>a})},264:(e,t,n)=>{n.d(t,{N5:()=>d,extractYamlFromMarkdown:()=>c,oV:()=>l,tF:()=>u});var o=n(382),i=n(933),a=n(937);function r(e){if(!e||"string"!=typeof e)return null;const t=e.trim().toLowerCase().replace(/['"]/g,""),n=(0,a.n$)(),o=n.find(e=>e.id.toLowerCase()===t||e.name.toLowerCase()===t);if(o)return o.id;const i=t.replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""),r=n.find(e=>e.id.replace(/-/g,"")===i.replace(/-/g,"")||e.name.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")===i);return r?r.id:t}function s(e){if(!e||"string"!=typeof e)return[];const t=[...(0,a.n$)()].sort((e,t)=>{const n=(e?.name||e?.id||"").length;return(t?.name||t?.id||"").length-n});let n=e.trim();n=n.replace(/^[\[\(\{]\s*/,"").replace(/\s*[\]\)\}]\s*$/,""),n=n.split("|")[0]||n,n=n.split("**")[0]||n;const o=[],i=(e,t)=>{if(!t)return null;const n=e.trimStart(),o=n.toLowerCase(),i=t.toLowerCase();if(!o.startsWith(i))return null;return(a=o[i.length])&&!/\s|,|;|\||\/|&|\+|\]|\)|\}/.test(a)?null:{length:e.length-n.length+i.length};var a};for(let e=0;e<10;e++){let e=null,a=null;n=n.replace(/^\s*(?:-|\*|•)\s*/g,"");for(const o of t){const t=i(n,o.name),r=i(n,o.id);if(e=t||r,e){a=o;break}}if(!e||!a)break;if(o.includes(a.id)||o.push(a.id),n=n.slice(e.length),n=n.replace(/^\s*(?:,|;|\||\/|&|\+|\band\b|\bor\b)\s*/i,""),!n.trim())break}return o}function l(e){if(!e)return null;try{const t=o.Ay.load(e);if(t&&"object"==typeof t){const e=Object.keys(t);if(e.length>0){if(t[e[0]]?.name)return e[0];for(const n of e)if(t[n]?.name)return n;return e[0]}}}catch(e){console.warn("Error during YAML parsing for key extraction:",e)}try{const t=/^([a-zA-Z0-9_-]+)(?:\s*:|:)/m,n=e.match(t);if(n&&n[1])return n[1]}catch(e){console.warn("Error during key extraction by regex:",e)}return null}function c(e,t=null){if(!e)return"";const n=[...e.matchAll(/```(?:yaml|yml)\s+([\s\S]*?)```/g)];if(n.length>0){for(const e of n){let n=e[1].trim();try{const e=o.Ay.load(n);if(e&&"object"==typeof e){const i=Object.keys(e)[0];if(e[i]?.name||e[i]?.code||e[i]?.description||e[i]?.version)return t&&"object"==typeof e[i]&&!e[i].link&&(e[i].link=t,n=o.Ay.dump(e,{indent:2,lineWidth:-1,noRefs:!0,noCompatMode:!0})),n}}catch(e){}}let e=n[0][1].trim();if(t)try{const n=o.Ay.load(e);if(n&&"object"==typeof n){const i=Object.keys(n)[0];i&&"object"==typeof n[i]&&!n[i].link&&(n[i].link=t,e=o.Ay.dump(n,{indent:2,lineWidth:-1,noRefs:!0,noCompatMode:!0}))}}catch(e){}return e}const i=[...e.matchAll(/```\s*([\s\S]*?)```/g)];if(i.length>0){let e="";for(const t of i){const n=t[1].trim();n.length>e.length&&(e=n)}if(t&&e)try{const n=o.Ay.load(e);if(n&&"object"==typeof n){const i=Object.keys(n)[0];i&&"object"==typeof n[i]&&!n[i].link&&(n[i].link=t,e=o.Ay.dump(n,{indent:2,lineWidth:-1,noRefs:!0,noCompatMode:!0}))}}catch(e){}return e}return""}function d(e){return e&&Array.isArray(e)?e.filter(e=>e&&e.title).map(e=>{try{const t=e.title.match(/\[(.*?)\]/);let n=t?(0,i.TL)(t[1]):`discussion-${e.number}`,o="",a=e.html_url;if(e.body&&(o=c(e.body,a),o)){const e=l(o);e&&(n=e)}const r=u(o,n,{bodyText:e.body,title:e.title,defaultCreator:e.user?.login||""});return{id:r.id,name:r.name,description:r.description,creator:r.creator,version:r.version,moduleLink:e.html_url,type:r.type,imageUrl:r.imageUrl,supportedCards:void 0===r.supported?void 0:Array.isArray(r.supported)?r.supported:r.supported?[r.supported]:[],unsupportedCards:Array.isArray(r.unsupported)?r.unsupported:r.unsupported?[r.unsupported]:[],createdAt:e.created_at,updated_at:e.updated_at,userAvatar:e.user?.avatar_url,comments:e.comments,reactions:e.reactions,yamlContent:o}}catch(t){return console.error(`Error parsing discussion #${e.number}:`,t),{id:`discussion-${e.number}`,name:e.title||`Discussion #${e.number}`,description:"Error parsing the discussion",creator:e.user?.login||"",version:"",moduleLink:e.html_url,type:"",supportedCards:[],unsupportedCards:[],createdAt:e.created_at,updated_at:e.updated_at,userAvatar:e.user?.avatar_url,comments:e.comments,reactions:e.reactions}}}).filter(e=>e.id&&e.name):[]}function u(e,t,n={}){const{bodyText:a,title:l,defaultCreator:c}=n;let d={id:t,name:t,version:"1.0",author:"",description:"",type:"Module",editor:[],supported:["button","climate","cover","horizontal-buttons-stack","media-player","pop-up","select","separator","sub-buttons"],unsupported:[],creator:c||"",link:"",imageUrl:"",yaml:e};const u={name:!1,version:!1,author:!1,creator:!1,description:!1,type:!1,link:!1,supported:!1,unsupported:!1,editor:!1,code:!1,imageUrl:!1,is_global:!1},p=(e,t,n=t,o=[])=>{if(void 0!==e[t])return d[n]=e[t],u[n]=!0,!0;for(const t of o)if(void 0!==e[t]&&!u[n])return d[n]=e[t],u[n]=!0,!0;return!1},b=e=>"string"==typeof e?e:Array.isArray(e)?e.join("\n"):"object"==typeof e?JSON.stringify(e):"";if(e)try{const n=o.Ay.load(e);if(n&&"object"==typeof n){if(1===Object.keys(n).length){const e=Object.keys(n)[0],o=n[e];if(d.id===t&&(d.id=e),o&&"object"==typeof o){if(p(o,"name"),p(o,"version"),p(o,"author"),p(o,"type"),p(o,"code"),p(o,"editor"),p(o,"link"),p(o,"creator"),p(o,"is_global"),p(o,"form_schema","editor"),p(o,"supported","supported",["supported_card","supported_cards"]),p(o,"unsupported","unsupported",["unsupported_card","unsupported_cards"]),o.unsupported&&!o.supported&&!u.supported){const e=["button","climate","cover","horizontal-buttons-stack","media-player","pop-up","select","separator","sub-buttons"];d.supported=e.filter(e=>!o.unsupported.includes(e)),u.supported=!0}void 0!==o.description&&(d.description=b(o.description),u.description=!0),o.info&&"object"==typeof o.info&&(p(o.info,"name"),p(o.info,"version"),p(o.info,"author"),p(o.info,"type"),p(o.info,"creator"),p(o.info,"link"),p(o.info,"supported","supported",["supported_card","supported_cards"]),p(o.info,"unsupported","unsupported",["unsupported_card","unsupported_cards"]),void 0===o.info.description||u.description||(d.description=b(o.info.description),u.description=!0))}}else{if(p(n,"name"),p(n,"version"),p(n,"author"),p(n,"type"),p(n,"code"),p(n,"editor"),p(n,"link"),p(n,"creator"),p(n,"is_global"),p(n,"form_schema","editor"),p(n,"supported","supported",["supported_card","supported_cards"]),p(n,"unsupported","unsupported",["unsupported_card","unsupported_cards"]),n.unsupported&&!n.supported&&!u.supported){const e=["button","climate","cover","horizontal-buttons-stack","media-player","pop-up","select","separator","sub-buttons"];d.supported=e.filter(e=>!n.unsupported.includes(e)),u.supported=!0}void 0!==n.description&&(d.description=b(n.description),u.description=!0)}if(!(u.editor||d.editor&&d.editor.length)){const e=JSON.stringify(n);if(e.includes('"type":')&&e.includes('"name":')&&1===Object.keys(n).length){const e=Object.keys(n)[0],t=n[e];if(t&&"object"==typeof t){const e=Object.keys(t).filter(e=>"object"==typeof t[e]&&(t[e].type||t[e].name||t[e].field));e.length>0&&(d.editor=e.map(e=>({name:e,type:t[e].type||"input",...t[e]})),u.editor=!0)}}}}}catch(e){console.error("Error during YAML analysis:",e)}if(!d.author&&d.creator?d.author=d.creator:!d.creator&&d.author&&(d.creator=d.author),a){if(!u.version){const e=[/\*\*Version:\*\*\s*(v?[\d\.]+)/i,/\|\s*(?:Version|v):\s*(v?[\d\.]+)\s*\|/i,/version\s+(v?[\d\.]+)/i];for(const t of e){const e=a.match(t);if(e&&e[1]){d.version=e[1];break}}}if(!u.description&&!d.description){const e=a.match(/\*\*Description\s*:\*\*\s*(.*?)(?=\n\s*\*\*|\n\s*#|$)/is);if(e&&e[1])d.description=(0,i.yh)(e[1].trim());else{const e=(0,i.yh)(a).split(/\n{2,}/);for(const t of e){const e=t.trim();if(e&&!e.startsWith("#")&&!e.match(/^[a-z_]+\s*:/i)&&e.length>15){d.description=e;break}}}}if(!u.supported){const e=function(e){if(!e||"string"!=typeof e)return null;const t=e.split(/\r?\n/),n=e=>{if(!e||"string"!=typeof e)return!1;const t=e.trim();return/^all(?:\s+cards?)?\b/i.test(t)},o=e=>(e||"").replace(/^\s*>\s*/g,"").trim(),i=e=>{const t=o(e);return!(!t||!/^\[!\w+\]/.test(t)&&!/^#{1,6}\s+/.test(t)&&!/^\*\*[^*]+:\*\*/.test(t))};for(let e=0;er(e.trim())).filter(Boolean);if(t.length)return[...new Set(t)]}const u=[];for(let a=e+1;ar(e.trim())).filter(Boolean);if(p.length)return[...new Set(p)];break}if(u.length){if(u.some(e=>n(e)))return;const e=u.map(e=>s(e)).flat().filter(Boolean);if(e.length)return[...new Set(e)];const t=u.map(e=>r(e.trim())).filter(Boolean);if(t.length)return[...new Set(t)]}}return null}(a);if(void 0===e?(d.supported=void 0,u.supported=!0):Array.isArray(e)&&e.length>0&&(d.supported=e,u.supported=!0),!u.supported)if(a.match(/\*\*Supported\s*(?:Cards|Card)?\s*:\*\*\s*(?:-\s*)?(?:All|all\s+cards?)/i))d.supported=void 0,u.supported=!0;else{const e=a.match(/\*\*Supported\s*(?:Cards|Card)?\s*:\*\*\s*\[(.*?)\]/i);if(e){const t=e[1].split(",").map(e=>r(e.trim())).filter(e=>e&&e.length>0);t.length>0&&(d.supported=t,u.supported=!0)}else{const e=a.match(/\*\*Supported\s*(?:Cards|Card)?\s*:\*\*\s*([^\n\r]+?)(?=\||\n|$)/i);if(e){const t=e[1].trim();if(!/^(?:All|all\s+cards?)$/i.test(t)){const e=s(t);if(e.length>0)d.supported=e,u.supported=!0;else{const e=t.split(",").map(e=>r(e.trim())).filter(e=>e&&e.length>0);e.length>0&&(d.supported=e,u.supported=!0)}}}}}}if(!(u.creator||d.creator&&d.creator!==c)){const e=a.match(/\*\*Creator\s*:\*\*\s*\[?([^\]\n\r]+)(?:\]|\n|$)/i);e&&(d.creator=e[1].trim(),d.author||(d.author=d.creator))}if(!u.imageUrl&&!d.imageUrl){const e={Screenshot:a.match(/Screenshot:([^#]*?)(?=#|\n\s*\n\s*\*\*|$)/is)?.[1]||"",GetThisModule:a.match(/Get this Module([^#]*?)(?=#|\n\s*\n\s*\*\*|$)/is)?.[1]||""},t=[{regex:/!\[.*?\]\((https:\/\/[^)]+)\)/g,isGlobal:!0},{regex:/]*src=["'](https:\/\/[^"']+)["'][^>]*>/i,isGlobal:!1},{regex:/src="(https:\/\/github\.com\/user-attachments\/assets\/[^"]+)"/i,isGlobal:!1}];for(const n of Object.values(e))if(n){for(const e of t)if(e.isGlobal){const t=[...n.matchAll(e.regex)];if(t.length>0){d.imageUrl=t[0][1];break}}else{const t=n.match(e.regex);if(t){d.imageUrl=t[1];break}}if(d.imageUrl)break}if(!d.imageUrl){const e=[...a.matchAll(/!\[.*?\]\((https:\/\/[^)]+)\)/g)];if(e.length>0){const t=e.filter(e=>e[1].includes("user-images.githubusercontent.com")||e[1].includes("github.com/user-attachments"));d.imageUrl=t.length>0?t[0][1]:e[0][1]}else{const e=a.match(/]*src=["'](https:\/\/[^"']+)["'][^>]*>/i);e&&(d.imageUrl=e[1])}}}}if(l){if(!u.type){const e=l.match(/\[(.*?) Module\]/i);e&&(d.type=e[1].toLowerCase())}if(!u.version&&"1.0"===d.version){const e=l.match(/(v?[\d\.]+)/);e&&(d.version=e[1])}if(!u.name){let e=l.replace(/\[.*?\]\s*/,"").trim();e=e.replace(/\s*-\s*v?[\d\.]+$/,"").trim(),d.name=e}}return d}},314:(e,t,n)=>{n.d(t,{Uk:()=>r,iJ:()=>d,m9:()=>l,wd:()=>s,zQ:()=>c});var o=n(716),i=n(388),a=n(880);function r(e){const t=e.config?.entity,n=e.card,i=e._hass.states[t],a=(0,o.D$)(e,e.config.attribute,t),s=i?.last_changed,l=i?.last_updated,c="state"===e.config.button_type,d=e.config.show_name??!0,u=e.config.show_icon??!0,p=e.config.show_state??c,b=e.config.show_attribute??c,h=e.config.show_last_changed??!1,m=e.config.show_last_updated??!1,g=e.config.scrolling_effect??!0,f=e.previousConfig||{};if(e.previousState===i&&e.previousAttribute===a&&e.previousLastChanged===s&&e.previousLastUpdated===l&&f.showName===d&&f.showIcon===u&&f.showState===p&&f.showAttribute===b&&f.showLastChanged===h&&f.showLastUpdated===m&&f.scrollingEffect===g)return;const y=(0,o.Vw)(t);let v="";if(i&&p)if(y){const n=(0,o.ls)(i);v=(0,o.PF)(e._hass,i,n)||"","active"===i.state?(0,o.HD)(e,t,()=>{const n=e._hass.states[t];n&&"active"===n.state?(e.previousState=null,r(e)):(0,o.bE)(e)}):(0,o.bE)(e)}else v=e._hass.formatEntityState(i),(0,o.bE)(e);else y&&(0,o.bE)(e);let _="",w="",x="",k="";function C(e){return e.charAt(0).toUpperCase()+e.slice(1)}function $(e,t,n,o=!0){if(null==e)return"";const i=parseFloat(e);if(isNaN(i))return e;let a=0===i?"0":i.toFixed(t);return o&&(a=a.replace(/\.0$/,"")),a+" "+n}if(b&&a)if(e.config.attribute.includes("forecast")){const t="°C"===e._hass.config.unit_system.temperature,n="km"===e._hass.config.unit_system.length;_=e.config.attribute.includes("temperature")?i?$(a,1,t?"°C":"°F"):"":e.config.attribute.includes("humidity")?i?$(a,0,"%",!1):"":e.config.attribute.includes("precipitation")?i?$(a,1,"mm"):"":e.config.attribute.includes("wind_speed")?i?$(a,1,n?"km/h":"mph"):"":i?a:""}else _=i?e.config.attribute.includes("[")?a:e._hass.formatEntityAttributeValue(i,e.config.attribute)??a:"";h&&i&&(w=i?C((0,o.r6)(s,e._hass.locale.language)):""),m&&i&&(x=i?C((0,o.r6)(l,e._hass.locale.language)):""),k=[v,_,w,x].filter(Boolean).join(" • "),e.elements.name.classList.toggle("hidden",!d),e.elements.iconContainer.classList.toggle("hidden",!u),e.elements.nameContainer.classList.toggle("name-without-icon",!u),e.elements.state.classList.toggle("state-without-name",(p||h||m||b)&&!d),e.elements.state.classList.toggle("display-state",p||h||m||b),e.elements.state.classList.toggle("hidden",!(p||h||m||b)),(0,o.Nl)(e,e.elements.state,k),t===e.config.entity&&!i?.attributes?.unit_of_measurement?.includes("°")&&i&&((0,o.$C)(e,t)?n.classList.contains("is-on")||(n.classList.remove("is-off"),n.classList.add("is-on")):n.classList.contains("is-off")||(n.classList.remove("is-on"),n.classList.add("is-off"))),e.previousState=i,e.previousAttribute=a,e.previousConfig={showName:d,showIcon:u,showState:p,showAttribute:b,showLastChanged:h,showLastUpdated:m,scrollingEffect:g}}function s(e){const t=e.config.card_type,n=e.config.button_type,r=(0,o.$C)(e),s=(0,o.md)(e,"climate"),l=(0,i.sW)(e),c=(0,i.Qp)(e),d=e.elements.iconContainer?.style.color,u=e.elements.image?.style.backgroundImage,p=e.elements.icon?.icon,b=e.elements.icon?.style.display,h=e.elements.image?.style.display;let m="inherit";if(r&&!("name"===n||"pop-up"===t&&!n)&&(m=s?(0,a.R)(e):`var(--bubble-icon-color, ${(0,i.VA)(e)})`),e.elements.iconContainer&&("inherit"!==m?d!==m&&(e.elements.iconContainer.style.color=m):""!==d&&(e.elements.iconContainer.style.color="")),""!==c){const t=`url(${c})`;u!==t&&(e.elements.image.style.backgroundImage=t),"none"!==b&&(e.elements.icon.style.display="none"),""!==h&&(e.elements.image.style.display="")}else""!==l?(p!==l&&(e.elements.icon.icon=l),e.elements.icon.style.color!==m&&(e.elements.icon.style.color=m),""!==b&&(e.elements.icon.style.display=""),"none"!==h&&(e.elements.image.style.display="none")):("none"!==b&&(e.elements.icon.style.display="none"),"none"!==h&&(e.elements.image.style.display="none"));e.elements.icon?.getAttribute("icon")!==e.elements.icon?.icon&&e.elements.icon.setAttribute("icon",e.elements.icon.icon)}function l(e,t=!0){const n="name"!==e.config.button_type?(0,o.mG)(e):e.config.name;e.elements.name&&(t?(0,o.Nl)(e,e.elements.name,n):n!==e.previousName&&(e.elements.name.innerText=n),e.previousName=n)}function c(e){"unavailable"===(0,o.Gu)(e)?e.card.classList.add("is-unavailable"):e.card.classList.remove("is-unavailable")}function d(e){const t=e?.elements?.cardWrapper,n=e?.elements?.subButtonContainer;if(!t&&!n)return;const o=e?.config?.sub_button,i=e?.config?.main_buttons_position||"default";let a=!1,r=!1;if(o)if(Array.isArray(o))for(const e of o){if(e&&Array.isArray(e.buttons)){const t=e.position||"top";"bottom"===t?a=!0:"top"===t&&(r=!0)}if(a&&r)break}else{const e=Array.isArray(o.main)?o.main:[],t=Array.isArray(o.bottom)?o.bottom:[];for(const t of e)if(t&&Array.isArray(t.group)){r=!0;break}for(const e of t)if(e){if(Array.isArray(e.group)){a=!0;break}a=!0;break}}const s="bottom"===i;a||s?(t&&t.classList.add("fixed-top"),n&&n.classList.add("fixed-top")):(t&&t.classList.remove("fixed-top"),n&&n.classList.remove("fixed-top"));const l=e?.elements?.bottomSubButtonContainer;if(l&&s){const t=e?.elements?.buttonsContainer;t?t.classList.contains("hidden")||"none"===t.style.display||"none"===getComputedStyle(t).display?l.classList.remove("with-main-buttons-bottom"):l.classList.add("with-main-buttons-bottom"):l.classList.remove("with-main-buttons-bottom")}}},315:(e,t,n)=>{n.d(t,{XH:()=>s,db:()=>c,eC:()=>r});var o=n(748);function i(e,t){try{if(e.states[t])return e.states[t]?.state}catch{}}function a(e,t){const n=e.entity_id||e.entity,o=n&&t.states[n]?t.states[n]:null,a=o?e.attribute&&o.attributes?o.attributes[e.attribute]:o.state:"unavailable";let s=e.state??e.state_not;if(Array.isArray(s)){const e=s.map(e=>i(t,e)).filter(e=>void 0!==e);s=[...s,...e]}else if("string"==typeof s){const e=i(t,s);s=[s],e&&s.push(e)}return null!=e.state?r(s).includes(a):null!=e.state_not&&!r(s).includes(a)}function r(e){return void 0===e||Array.isArray(e)?e:[e]}function s(e,t){return e.every(e=>{if(e&&!1===e.enabled)return!0;if("condition"in e)switch(e.condition){case"screen":return!!(n=e).media_query&&matchMedia(n.media_query).matches;case"user":return function(e,t){return!(!e.users||!t.user?.id)&&e.users.includes(t.user.id)}(e,t);case"numeric_state":return function(e,t){const n=(a=e.entity_id||e.entity,Array.isArray(a)?a.filter(Boolean):a?[a]:[]);var a;if(!n.length)return!1;let r=e.above,s=e.below;"string"==typeof r&&(r=i(t,r)??r),"string"==typeof s&&(s=i(t,s)??s);const l=Number(r),c=Number(s);return n.some(n=>{const i=t.states[n];if(!i)return!1;let a=e.attribute&&i.attributes?i.attributes[e.attribute]:i.state;if(e.value_template){const r=(0,o.sl)(t,e.value_template,{value:a,entity:i,entity_id:n});void 0!==r&&(a=r)}const r=Number(a);return!isNaN(r)&&(null==e.above||isNaN(l)||lr)})}(e,t);case"template":return function(e,t){if(!e.value_template)return!1;const n=(0,o.sl)(t,e.value_template);return!0===n||"true"===n||1===n||"1"===n||"True"===n}(e,t);case"and":return function(e,t){return!e.conditions||s(e.conditions,t)}(e,t);case"or":return function(e,t){return!e.conditions||e.conditions.some(e=>s([e],t))}(e,t);case"not":return function(e,t){return!e.conditions||!e.conditions.some(e=>s([e],t))}(e,t);default:return a(e,t)}var n;return a(e,t)})}function l(e){return null!=(e.entity_id||e.entity)&&(null!=e.state||null!=e.state_not)}function c(e){return e.every(e=>{if(e&&!1===e.enabled)return!0;if("condition"in e)switch(e.condition){case"screen":return null!=e.media_query;case"user":return null!=e.users;case"numeric_state":return function(e){const t=e.entity_id||e.entity;return(Array.isArray(t)?t.length>0:null!=t)&&(null!=e.above||null!=e.below)}(e);case"template":return function(e){return null!=e.value_template}(e);case"and":case"or":case"not":return function(e){return null!=e.conditions}(e);default:return l(e)}return l(e)})}},345:(e,t,n)=>{n.d(t,{H:()=>s,K:()=>l});var o=n(716),i=n(459);const a='.bubble-range-fill {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n left: -100%;\n transition: all .5s ease-in-out;\n z-index: 0;\n background-color: var(--bubble-accent-color, var(--bubble-default-color));\n}\n\n.bubble-range-fill.fill-orientation-left {\n left: -100%;\n right: auto;\n top: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n}\n\n.bubble-range-fill.fill-orientation-right {\n left: auto;\n right: -100%;\n top: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n}\n\n.bubble-range-fill.fill-orientation-top {\n top: -100%;\n bottom: auto;\n left: 0;\n right: 0;\n width: 100%;\n height: 100%;\n}\n\n.bubble-range-fill.fill-orientation-bottom {\n top: auto;\n bottom: -100%;\n left: 0;\n right: 0;\n width: 100%;\n height: 100%;\n}\n\n.slider-use-light-color {\n background-color: var(--bubble-slider-fill-color, var(--bubble-light-color, rgb(225, 225, 210))) !important;\n opacity: 0.7;\n}\n\n.slider-use-accent-color {\n background-color: var(--bubble-button-accent-color, var(--bubble-accent-color, var(--bubble-default-color))) !important;\n opacity: 1;\n}\n\n.is-light .bubble-range-fill {\n background-color: var(--bubble-light-color, rgb(225, 225, 210));\n opacity: 0.7;\n}\n\n.is-dragging .bubble-range-fill {\n transition: none !important;\n}\n\n.bubble-range-value {\n position: absolute;\n display: none;\n top: 50%;\n right: 14px;\n left: auto;\n transform: translateY(-50%);\n padding: 0 6px;\n pointer-events: none;\n white-space: nowrap;\n align-items: center;\n z-index: 1;\n}\n\n.bubble-range-value.is-visible {\n display: flex;\n}\n\n.bubble-range-slider.value-position-left .bubble-range-value,\n.bubble-range-slider.value-position-inline-start .bubble-range-value {\n left: 14px;\n right: auto;\n justify-content: flex-start;\n}\n\n.bubble-range-slider.value-position-right .bubble-range-value,\n.bubble-range-slider.value-position-inline-end .bubble-range-value {\n right: 14px;\n left: auto;\n justify-content: flex-end;\n}\n\n.bubble-range-slider.value-position-center .bubble-range-value {\n left: 50%;\n right: auto;\n transform: translate(-50%, -50%);\n justify-content: center;\n text-align: center;\n}\n\n\n.is-unavailable .bubble-range-slider {\n cursor: not-allowed;\n}\n\n/* Ensure touch drag is recognized on mobile for slider track */\n.bubble-range-slider {\n touch-action: pan-y;\n backface-visibility: hidden;\n height: 100%;\n}\n\n/* Vertical sliders: allow horizontal scroll, block vertical */\n.bubble-range-slider.fill-orientation-top,\n.bubble-range-slider.fill-orientation-bottom {\n touch-action: pan-x;\n}\n\n/* Slider container styles */\n.slider-container {\n cursor: ew-resize;\n touch-action: pan-y;\n}\n\n/* Vertical slider containers: allow horizontal scroll, block vertical */\n.slider-container:has(.fill-orientation-top),\n.slider-container:has(.fill-orientation-bottom) {\n cursor: ns-resize;\n touch-action: pan-x;\n}\n\n.slider-container.is-touching,\n.slider-container.is-touching .bubble-range-slider,\n.bubble-range-slider.is-touching {\n touch-action: none;\n}\n\nhtml.bubble-slider-dragging,\nbody.bubble-slider-dragging {\n touch-action: none;\n overscroll-behavior: contain;\n overflow: hidden;\n}\n\n/* When dragging, disable all touch actions to prevent conflicts */\n.is-dragging .bubble-range-slider,\n.is-dragging.slider-container {\n touch-action: none;\n}\n\n.slider-container.slider-hold-focus > :not(.bubble-range-slider):not(style) {\n transition: opacity 0.3s ease-in-out;\n}\n\n.slider-container.slider-hold-focus.is-dragging > :not(.bubble-range-slider):not(style) {\n opacity: 0;\n pointer-events: none;\n}\n\n.slider-appear-animation {\n transition: none;\n animation: sliderAppear 0.2s ease-in-out;\n transform-origin: center;\n}\n\n@keyframes sliderAppear {\n 0% {\n transform: scale(0.96);\n opacity: 0.8;\n }\n 100% {\n transform: scale(1);\n opacity: 1;\n }\n}\n\n/* Color slider specific */\n.is-color-slider .bubble-range-fill { \n background: transparent !important; \n opacity: 0 !important; \n}\n\n.bubble-color-track {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 0;\n}\n\n.bubble-color-cursor {\n position: absolute;\n top: 50%;\n left: 0;\n transform: translate(-50%, -50%);\n width: 8px;\n height: 90%;\n border-radius: 999px;\n background: var(--bubble-color-cursor-background, #fff);\n z-index: 1;\n transition: transform .15s ease, left .15s ease, top .15s ease;\n box-shadow: 0 2px 6px rgba(0,0,0,0.35);\n}\n\n.bubble-color-cursor::before {\n content: "";\n position: absolute;\n top: var(--bubble-color-cursor-indicator-top, 18%);\n bottom: var(--bubble-color-cursor-indicator-bottom, 18%);\n left: 50%;\n transform: translateX(-50%);\n width: 2px;\n background: var(--bubble-color-cursor-indicator-color, var(--primary-text-color));\n border-radius: 2px;\n opacity: var(--bubble-color-cursor-indicator-opacity, 0.7);\n transition: background-color .15s ease, top .15s ease, bottom .15s ease;\n}\n\n.is-dragging .bubble-color-cursor {\n transition: none !important;\n}\n\n.is-dragging .bubble-color-cursor::before {\n opacity: var(--bubble-color-cursor-indicator-active-opacity, 0.9);\n top: var(--bubble-color-cursor-indicator-active-top, 12%);\n bottom: var(--bubble-color-cursor-indicator-active-bottom, 12%);\n width: 4px;\n}\n\n.fill-orientation-right .bubble-color-track,\n.fill-orientation-left .bubble-color-track,\n.fill-orientation-top .bubble-color-track,\n.fill-orientation-bottom .bubble-color-track {\n pointer-events: none;\n}\n\n.fill-orientation-right .bubble-color-cursor,\n.fill-orientation-left .bubble-color-cursor {\n height: 90%;\n width: 8px;\n}\n\n.fill-orientation-top .bubble-color-cursor,\n.fill-orientation-bottom .bubble-color-cursor {\n width: 90%;\n height: 8px;\n}\n\n.fill-orientation-top .bubble-color-cursor::before,\n.fill-orientation-bottom .bubble-color-cursor::before {\n top: 50%;\n bottom: auto;\n left: 5%;\n right: 5%;\n height: 2px;\n width: auto;\n transform: translateY(-50%);\n}';var r=n(371);function s(e,t={}){const n={...l,targetElement:e.elements.mainContainer,insertBefore:e.elements.cardWrapper,sliderLiveUpdate:e.config.slider_live_update,relativeSlide:e.config.relative_slide,holdToSlide:!1,readOnlySlider:!1,styles:a,...t},s=[...r.BK.map(e=>`value-position-${e}`),"value-position-inline-end","value-position-inline-start"],c=e._hass.states[e.config.entity],d=e.config.entity?.split(".")[0];if(c?(e.sliderMinValue=(0,r.nZ)(e,c),e.sliderMaxValue=(0,r.BJ)(e,c),e.sliderStep=(0,r.et)(e,c)):(e.sliderMinValue=e.config.min_value??0,e.sliderMaxValue=e.config.max_value??100,e.sliderStep=e.config.step??1),e.sliderMaxValue<=e.sliderMinValue&&(e.sliderMaxValue="climate"===d?e.sliderMinValue+1:e.sliderMinValue+100),e.elements.rangeFill=(0,o.n)("div","bubble-range-fill range-fill"),e.elements.rangeSlider=(0,o.n)("div","bubble-range-slider range-slider"),n.styles){const Z=(0,o.n)("style");Z.textContent=n.styles,e.elements.rangeSlider.appendChild(Z)}const u=e?.config?.light_slider_type,p="light"===d&&["hue","saturation","white_temp"].includes(u);e._isColorSlider=p,e._currentSliderValuePosition=null,e._shouldDisplaySliderValue=!1,e.syncSliderValuePosition=()=>{if(!e.elements?.rangeSlider)return;const t=e.elements.rangeSlider,n=(0,r._W)(e);if(e._isColorSlider||"hidden"===n)return s.forEach(e=>t.classList.remove(e)),e._currentSliderValuePosition=null,e._shouldDisplaySliderValue=!1,void(e.elements.rangeValue&&e.elements.rangeValue.classList.remove("is-visible"));e._shouldDisplaySliderValue=!0,e._currentSliderValuePosition!==n&&(e._currentSliderValuePosition&&t.classList.remove(`value-position-${e._currentSliderValuePosition}`),t.classList.add(`value-position-${n}`),e._currentSliderValuePosition=n),e.elements.rangeValue||(e.elements.rangeValue=(0,o.n)("div","bubble-range-value"),t.appendChild(e.elements.rangeValue),e.elements.rangeValue.textContent=(0,r.aJ)(e))};let b=null;if(p){e.elements.rangeSlider.classList.add("is-color-slider"),e.elements.rangeSlider.classList.add(`is-color-${u}`),e.elements.colorTrack=(0,o.n)("div","bubble-color-track"),e.elements.colorCursor=(0,o.n)("div","bubble-color-cursor"),e.elements.rangeSlider.appendChild(e.elements.colorTrack),e.elements.rangeSlider.appendChild(e.elements.colorCursor);const ee=["left","right","top","bottom"];function te(t){e?.elements?.colorTrack&&e?.elements?.colorCursor&&(ee.forEach(t=>{e.elements.colorTrack.classList.remove(`fill-orientation-${t}`),e.elements.colorCursor.classList.remove(`fill-orientation-${t}`)}),e.elements.colorTrack.classList.add(`fill-orientation-${t}`),e.elements.colorCursor.classList.add(`fill-orientation-${t}`))}function ne(){if(!e?.elements?.colorTrack)return;const t=(0,r.oR)(e),n="right"===t?"270deg":"left"===t?"90deg":"top"===t?"180deg":"0deg";if("hue"===u){const t=e._hass.states[e.config.entity]?.attributes?.hs_color||[],o=Number(t[1]??100),i=o<10?100:o;e.elements.colorTrack.style.background=`linear-gradient(${n}, hsl(0 ${i}% 50%), hsl(60 ${i}% 50%), hsl(120 ${i}% 50%), hsl(180 ${i}% 50%), hsl(240 ${i}% 50%), hsl(300 ${i}% 50%), hsl(360 ${i}% 50%))`}else if("saturation"===u){const t=e._hass.states[e.config.entity]?.attributes?.hs_color||[],o=Number(t[0]??180);e.elements.colorTrack.style.background=`linear-gradient(${n}, hsl(${o} 0% 50%), hsl(${o} 100% 50%))`}else"white_temp"===u&&(e.elements.colorTrack.style.background=`linear-gradient(${n}, #d2e7ff, #f3f7ff 35%, #fff1e0 65%, #ffb56b)`)}function oe(t){if(!e?.elements?.colorCursor)return;let n="#000000";if("hue"===u){const o=e._hass.states[e.config.entity]?.attributes?.hs_color||[],i=Number(o[1]??100);n=`hsl(${t/100*360}, ${i<10?100:i}%, 50%)`}else if("saturation"===u){const o=e._hass.states[e.config.entity]?.attributes?.hs_color||[];n=`hsl(${Number(o[0]??180)}, ${t}%, 50%)`}else if("white_temp"===u){const e=t/100;n=e<.35?"#d2e7ff":e<.65?"#fff1e0":"#ffb56b"}e.elements.colorCursor.style.setProperty("--bubble-color-cursor-indicator-color",n)}te((0,r.oR)(e)),b=t=>{if(!e?.elements?.colorCursor)return;const n=(0,r.YX)(e,t);e._lastVisualFillPercentage=n;const o=(0,r.oR)(e),i="right"===o||"bottom"===o?100-n:n,a=e.elements.colorCursor;a.style.removeProperty("right"),a.style.removeProperty("bottom"),"left"===o||"right"===o?(a.style.left=`${i}%`,a.style.top="50%"):(a.style.top=`${i}%`,a.style.left="50%")},e.setColorCursorPosition=b,ne(),e.updateColorTrackBackground=ne,e.updateColorCursorIndicator=oe}function h(){return(0,r.uo)(e)}function m(t){return(0,r.YX)(e,t)}function g(t){e.elements.rangeValue&&(e.elements.rangeValue.textContent=(0,r.BG)(e,t))}const f=m(h());e.syncSliderValuePosition(),n.withValueDisplay&&e._shouldDisplaySliderValue&&e.elements.rangeValue&&(e.elements.rangeValue.classList.add("is-visible"),e.elements.rangeValue.textContent=(0,r.aJ)(e));const y=(0,r.oR)(e),v="top"===y||"bottom"===y;e.elements.rangeFill.classList.add(`fill-orientation-${y}`),e.elements.rangeSlider.classList.add(`fill-orientation-${y}`),p&&e.elements.colorCursor?(b?.(f),"function"==typeof e.updateColorCursorIndicator&&e.updateColorCursorIndicator(f)):(0,r.lt)(e,f),e.elements.rangeSlider.appendChild(e.elements.rangeFill),n.insertBefore&&n.targetElement.contains(n.insertBefore)?n.targetElement.insertBefore(e.elements.rangeSlider,n.insertBefore):n.targetElement.appendChild(e.elements.rangeSlider),n.targetElement&&(n.targetElement.classList.add("slider-container"),n.holdToSlide&&!e.config.tap_to_slide&&n.targetElement.classList.add("slider-hold-focus"));const _={passive:!1};let w=0,x=0,k=0,C=0,$=null,S=!1,A=null,L=!1,E=!1,M=0;function T(){return A||(A=e.elements.rangeSlider.getBoundingClientRect()),A}function B(){A=null}function P(){S=!1,L=!1}function I(){E||(E=!0,n.targetElement.classList.add("is-touching"),e.elements.rangeSlider&&e.elements.rangeSlider.classList.add("is-touching"))}function O(){E&&(E=!1,n.targetElement.classList.remove("is-touching"),e.elements.rangeSlider&&e.elements.rangeSlider.classList.remove("is-touching"))}function q(e){return void 0!==e.pageX?e.pageX:e.changedTouches&&e.changedTouches[0]?e.changedTouches[0].pageX:e.touches&&e.touches[0]?e.touches[0].pageX:void 0!==e.clientX?e.clientX:0}function j(e){return void 0!==e.pageY?e.pageY:e.changedTouches&&e.changedTouches[0]?e.changedTouches[0].pageY:e.touches&&e.touches[0]?e.touches[0].pageY:void 0!==e.clientY?e.clientY:0}function z(e){return void 0!==e.clientX?e.clientX:e.changedTouches&&e.changedTouches[0]?e.changedTouches[0].clientX:e.touches&&e.touches[0]?e.touches[0].clientX:q(e)-(window.scrollX||window.pageXOffset||0)}function D(e){return void 0!==e.clientY?e.clientY:e.changedTouches&&e.changedTouches[0]?e.changedTouches[0].clientY:e.touches&&e.touches[0]?e.touches[0].clientY:j(e)-(window.scrollY||window.pageYOffset||0)}function N(e){return v?j(e):q(e)}function U(e){return v?q(e):j(e)}function R(e){if("number"==typeof e?.pointerId)try{"function"==typeof n.targetElement.hasPointerCapture&&n.targetElement.hasPointerCapture(e.pointerId)&&n.targetElement.releasePointerCapture(e.pointerId)}catch(e){}}function V(){n.targetElement.removeEventListener("pointermove",Y,_),n.targetElement.removeEventListener("touchmove",Y,_),n.targetElement.removeEventListener("touchend",J,_),window.removeEventListener("pointermove",Y,_),window.removeEventListener("pointerup",J,_),window.removeEventListener("pointercancel",X,_),window.removeEventListener("touchmove",Y,_),window.removeEventListener("touchend",J,_),window.removeEventListener("touchcancel",X,_),window.removeEventListener("blur",X),document.removeEventListener("visibilitychange",F)}function F(){document.hidden&&e.dragging&&X()}function H(){n.targetElement.addEventListener("pointermove",Y,_),n.targetElement.addEventListener("touchmove",Y,_),n.targetElement.addEventListener("touchend",J,_),window.addEventListener("pointermove",Y,_),window.addEventListener("pointerup",J,_),window.addEventListener("pointercancel",X,_),window.addEventListener("touchmove",Y,_),window.addEventListener("touchend",J,_),window.addEventListener("touchcancel",X,_),window.addEventListener("blur",X),document.addEventListener("visibilitychange",F)}function W(e){try{const t="function"==typeof e.composedPath?e.composedPath():[];if(t&&t.some(e=>e?.tagName&&"ha-sidebar"===e.tagName.toLowerCase()))return!0}catch(e){}let t=e.clientX;return void 0===t&&(t=e.changedTouches&&e.changedTouches[0]?e.changedTouches[0].clientX:e.touches&&e.touches[0]?e.touches[0].clientX:0),("touch"===e.pointerType||!!e.touches||!!e.changedTouches)&&t<=30}function Y(t){if(function(e){if(L)return!1;const t=N(e),n=U(e),o=v?x:w,i=v?w:x,a=Math.abs(t-o),r=Math.abs(n-i);return a>=4?(L=!0,!1):r>10&&a<4}(t))return O(),S=!0,L=!1,R(t),V(),n.targetElement.classList.remove("is-dragging"),e.dragging=!1,window.isScrolling=!1,void B();if(t.stopPropagation(),t.touches&&t.touches.length>1||!t.cancelable||t.preventDefault(),t.target.closest(".bubble-action"))return;window.isScrolling=!0;const o=(0,i.P9)(e,K(t),!1,T());p&&e.elements.colorCursor&&(b?.(o),"saturation"===u&&"function"==typeof e.updateColorTrackBackground&&e.updateColorTrackBackground(),"function"==typeof e.updateColorCursorIndicator&&e.updateColorCursorIndicator(o)),n.sliderLiveUpdate&&Q(e,o),g(o)}function K(e){const t=function(e){return v?D(e):z(e)}(e),o=N(e);return n.relativeSlide?(v?C:k)+(o-(v?x:w)):t}function X(t){if(!e.dragging)return;if(Date.now()-M<150)return;R(t),$&&clearTimeout($),n.targetElement.classList.remove("is-dragging"),V(),P(),B(),O();const o=m(h());p&&e.elements.colorCursor?(b?.(o),"function"==typeof e.updateColorCursorIndicator&&e.updateColorCursorIndicator(o)):(0,r.lt)(e,o),e._shouldDisplaySliderValue&&e.elements.rangeValue&&(e.elements.rangeValue.textContent=(0,r.aJ)(e),!n.holdToSlide||e.config.tap_to_slide||n.persistentValueDisplay||e.elements.rangeValue.classList.remove("is-visible")),e.dragging=!1,window.isScrolling=!1}function J(t){if(S)return O(),P(),void B();t.stopPropagation(),t.touches&&t.touches.length>1||t.preventDefault(),R(t),$&&clearTimeout($);const a=N(t),r=(0,i.P9)(e,K(t),!0,T()),s=v?x:w;Math.abs(a-s)>5&&(t.preventDefault(),t.stopImmediatePropagation()),n.targetElement.classList.remove("is-dragging"),V(),P(),B(),O(),p&&e.elements.colorCursor&&(b?.(r),"function"==typeof e.updateColorCursorIndicator&&e.updateColorCursorIndicator(r)),(0,o.md)(e,"climate",e.config.entity)&&!(0,o.$C)(e,e.config.entity)?e._hass.callService("climate","turn_on",{entity_id:e.config.entity}).then(()=>{Q(e,r)}).catch(e=>{console.error("Error turning on climate entity:",e)}):Q(e,r),(0,o.jp)("selection"),g(r),n.holdToSlide&&!e.config.tap_to_slide&&e._shouldDisplaySliderValue&&e.elements.rangeValue&&!n.persistentValueDisplay&&e.elements.rangeValue.classList.remove("is-visible"),$=setTimeout(()=>{e&&(e.dragging=!1,window.isScrolling=!1)},100)}const G=(()=>{const t=e.config.entity;if(!t)return!0;const n=t?.split(".")[0];return"sensor"===n||!["light","media_player","cover","input_number","number","fan","climate"].includes(n)})();if(e.config.read_only_slider||G)return;if(!n.holdToSlide||n.readOnlySlider||e.config.tap_to_slide)n.readOnlySlider||n.targetElement.addEventListener("pointerdown",t=>{if(W(t))return;const o=!!t.target.closest(".bubble-main-icon-container"),i=t.target.closest(".bubble-sub-button"),a=i?.hasAttribute("no-slide");if(!(o||i||a)){try{n.targetElement.setPointerCapture(t.pointerId)}catch(e){}if(!e.card||!e.card.classList.contains("is-unavailable")){if(I(),e.dragging=!0,window.isScrolling=!0,w=q(t),x=j(t),P(),B(),n.relativeSlide){const e=m(h()),t=T();if(v){const n="bottom"===y?100-e:e;C=t.top+t.height*n/100}else k=t.left+t.width*e/100}else T();n.targetElement.classList.add("is-dragging"),H()}}},_);else{let ie;const ae=200,re=6;let se=null,le=null,ce=!1;const de=()=>{se&&(n.targetElement.removeEventListener("pointermove",se),se=null),le&&(n.targetElement.removeEventListener("pointerup",le),n.targetElement.removeEventListener("pointercancel",le),le=null)},ue=t=>{ce||(ce=!0,clearTimeout(ie),de(),function(t){if(W(t))return void O();try{n.targetElement.setPointerCapture(t.pointerId)}catch(e){}if(e.card&&e.card.classList.contains("is-unavailable"))return void O();e.dragging=!0,window.isScrolling=!0,M=Date.now(),w=q(t),x=j(t),P(),L=!0,B();let a=0;(0,o.md)(e,"climate")&&!(0,o.$C)(e,e.config.entity)?(a=0,p&&e.elements.colorCursor?(b?.(a),"function"==typeof e.updateColorCursorIndicator&&e.updateColorCursorIndicator(a)):(0,r.lt)(e,a)):a=(0,i.P9)(e,function(e){if(w=q(e),x=j(e),P(),!n.relativeSlide)return v?D(e):z(e);const t=m(h()),o=T();if(v){const e="bottom"===y?100-t:t;return C=o.top+o.height*e/100,C}return k=o.left+o.width*t/100,k}(t),!1,T()),function(t){e._isColorSlider||(e.syncSliderValuePosition?.(),e._shouldDisplaySliderValue&&e.elements.rangeValue&&(g(t),e.elements.rangeValue.classList.add("is-visible")))}(a),g(a),n.sliderLiveUpdate&&Q(e,a),n.targetElement.classList.add("slider-appear-animation"),(0,o.jp)("selection"),setTimeout(()=>{n.targetElement.classList.remove("slider-appear-animation")},300),n.targetElement.classList.add("is-dragging"),H(),n.targetElement.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation()},{capture:!0,once:!0})}(t))};n.targetElement.addEventListener("pointerdown",t=>{if(W(t))return;const o=t.target.closest(".bubble-action"),i=t.target.closest(".bubble-sub-button")?.hasAttribute("no-slide");if(i||o&&'{"action":"none"}'!==o.getAttribute("data-hold-action"))return;if(ce=!1,clearTimeout(ie),de(),e.card&&e.card.classList.contains("is-unavailable"))return;I(),w=q(t),x=j(t),P();const a=e=>{const t=N(e),n=U(e),o=v?x:w,i=v?w:x,a=Math.abs(t-o),s=Math.abs(n-i);if(!(a>=2&&s<=4))return s>10&&s>a+4?(S=!0,void r()):void(a>re&&a>=s&&ue(e));ue(e)},r=()=>{clearTimeout(ie),de(),S&&O()};se=a,le=r,n.targetElement.addEventListener("pointermove",a,{passive:!1}),n.targetElement.addEventListener("pointerup",r),n.targetElement.addEventListener("pointercancel",r),ie=setTimeout(()=>ue(t),ae)},{passive:!1}),n.targetElement.addEventListener("pointerup",()=>{ce||(clearTimeout(ie),de(),S=!1,O())}),n.targetElement.addEventListener("pointercancel",()=>{ce||(clearTimeout(ie),de(),S=!1,O())})}const Q=(0,o.nF)(i.zU,200)}const l={targetElement:null,insertBefore:null,sliderLiveUpdate:!1,withValueDisplay:!1,initialValue:null,persistentValueDisplay:!1}},361:(e,t,n)=>{n.d(t,{XO:()=>d,Fi:()=>c});var o=n(716),i=n(531);const a="mwc-list-item {\n border-radius: var(--bubble-select-list-border-radius, var(--bubble-border-radius, 24px));\n margin: 0 8px;\n}\n\nmwc-list-item[selected] {\n color: var(--primary-text-color) !important;\n background-color: var(--bubble-select-list-item-accent-color, var(--bubble-list-item-accent-color, var(--bubble-accent-color, var(--bubble-default-color)))); /* Added the missing 'select' in the first var without removing the previous one for compatibilty */ \n}\n\nha-select {\n --mdc-shape-medium: var(--bubble-select-list-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n --mdc-theme-surface: var(--bubble-select-list-background-color, var(--bubble-select-main-background-color, var(--bubble-main-background-color, var(--card-background-color, var(--secondary-background-color)))));\n --mdc-shape-large: 32px;\n --mdc-shape-small: 64px;\n --mdc-menu-max-width: min-content;\n --mdc-menu-min-width: var(--bubble-select-list-width, 200px);\n --mdc-select-max-width: min-content;\n --mdc-select-outlined-hover-border-color: transparent;\n --mdc-select-outlined-idle-border-color: transparent;\n --mdc-theme-primary: transparent;\n --right-value: calc(var(--mdc-menu-min-width) - 160px);\n}\n\n.bubble-sub-button ha-select {\n --right-value: calc(var(--mdc-menu-min-width) - 168px);\n}\n\n.mdc-select {\n color: transparent !important;\n width: 150px !important;\n position: absolute !important;\n pointer-events: none;\n right: var(--right-value, 46px);\n height: 0px !important;\n}\n\n.mdc-select.bubble-open-right {\n right: auto;\n left: calc(var(--right-value, 46px) - 58px);\n}\n\n.mdc-menu, mwc-list, .mdc-list-item {\n pointer-events: auto;\n}\n\n.mdc-select__dropdown-icon {\n display: none !important;\n}\n\n.mdc-select__selected-text {\n color: transparent !important;\n}\n\n.mdc-select__anchor {\n width: 100%;\n pointer-events: none;\n top: -14px !important;\n height: 28px !important;\n}\n\n.bubble-dropdown-container {\n display: flex !important;\n width: auto;\n height: 100%;\n align-items: center;\n justify-content: center;\n}\n\n.bubble-dropdown-arrow {\n display: flex;\n position: absolute;\n background: var(--bubble-select-arrow-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n height: 36px;\n width: 36px;\n pointer-events: none;\n border-radius: var(--bubble-select-button-border-radius, var(--bubble-border-radius, 20px));\n align-items: center;\n justify-content: center;\n transition: background 0.2s, transform 0.2s;\n pointer-events: none;\n}\n\n.bubble-dropdown-select {\n position: relative;\n width: 36px;\n}\n\n.bubble-dropdown-inner-border {\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: var(--bubble-select-border, solid 2px var(--bubble-accent-color, var(--bubble-default-color)));\n border-radius: var(--bubble-border-radius, 28px);\n box-sizing: border-box;\n pointer-events: none;\n}\n\n.bubble-sub-button .bubble-dropdown-inner-border,\n.bubble-sub-button-group .bubble-dropdown-inner-border {\n border-radius: var(--bubble-border-radius, 18px);\n}",r=200,s=40;function l(e,t){if(!e?.shadowRoot||!t)return;const n=e.shadowRoot.querySelector(".mdc-select");!function(e){if(!e)return!1;const t=e.getBoundingClientRect().left,n=function(e){let t=e;for(;t;){const e=t.closest?.(".bubble-pop-up-container");if(e)return e;const n=t.getRootNode?.();if(!(n instanceof ShadowRoot))break;t=n.host}return null}(e);if(!n)return t{!function(){if(t.dropdownSelect.shadowRoot){const n=t.dropdownSelect.shadowRoot;t.dropdownStyleElement&&!t.dropdownStyleElement.isConnected&&n.appendChild(t.dropdownStyleElement),t.dropdownCustomStyleElement&&!t.dropdownCustomStyleElement.isConnected&&n.appendChild(t.dropdownCustomStyleElement),(e=n.querySelector("ha-menu.mdc-select__menu"))&&(e.addEventListener("opened",()=>{setTimeout(()=>{e.removeAttribute("open"),e.style.display=""},0)},{once:!0}),e.style.display="none",e.setAttribute("open",""))}var e}()}),t===e.elements?t.buttonsContainer.appendChild(t.dropdownContainer):t.appendChild(t.dropdownContainer)}function d(e,t=e.elements,n=e.config.entity,a=e.config){const{dropdownArrow:r,dropdownSelect:s,mainContainer:c,background:d}=t,u=t===e.elements?c:t,p=t===e.elements?d:t;"function"==typeof t.dropdownCleanup&&t.dropdownCleanup(),t.innerBorderElement?t.innerBorderElement.isConnected||u.appendChild(t.innerBorderElement):(t.innerBorderElement=(0,o.n)("div"),t.innerBorderElement.classList.add("bubble-dropdown-inner-border"),u.appendChild(t.innerBorderElement)),u.haRipple||(u.haRipple=(0,o.n)("ha-ripple")),u.haRipple.isConnected||(t===e.elements?t.background.appendChild(u.haRipple):u.appendChild(u.haRipple));const b=e.elements.mainContainer;b&&void 0===b.openDropdowns&&(b.openDropdowns=0);let h=!1,m=null,g=0;const f=t===e.elements?!!(a&&a.button_action&&a.button_action.double_tap_action&&a.button_action.double_tap_action.action&&"none"!==a.button_action.double_tap_action.action):!!(a&&a.double_tap_action&&a.double_tap_action.action&&"none"!==a.double_tap_action.action),y=()=>{r.style.transform="rotate(180deg)",t.dropdownArrow.style.background="var(--bubble-accent-color, var(--bubble-default-color))",t.innerBorderElement&&(t.innerBorderElement.style.display="block"),e.elements&&e.elements.mainContainer&&(h||(h=!0,b&&b.openDropdowns++),e.elements.mainContainer.style.overflow="visible")},v=new AbortController,{signal:_}=v;u.addEventListener("hass-action",e=>{const t=e?.detail?.action;"double_tap"!==t&&"hold"!==t||("function"==typeof e.composedPath?e.composedPath():[]).includes(p)&&(m&&(clearTimeout(m),m=null),g=Date.now()+300)},{signal:_}),p.addEventListener("click",e=>{if("mwc-list-item"===e.target.tagName.toLowerCase())return;const n=s.shadowRoot.querySelector("ha-menu.mdc-select__menu");if(!n){const e=s.shadowRoot.querySelector("mwc-menu");return void(e&&(l(s,t.dropdownContainer),e.setAttribute("open",""),y()))}if(h)return m&&(clearTimeout(m),m=null),void(g=Date.now()+200);Date.now(){Date.now(){n.stopPropagation(),r.style.transform="rotate(0deg)",t.innerBorderElement&&(t.innerBorderElement.style.display="none"),t.dropdownArrow.style.background="",e.elements&&e.elements.mainContainer&&(h&&(h=!1,b&&b.openDropdowns--),b&&0===b.openDropdowns&&(e.elements.mainContainer.style.overflow=""))},{signal:_}),t.dropdownSelect.addEventListener("click",t=>{const o=t.target.value;(0,i.Ab)(e,n,o,a)},{signal:_}),t.dropdownCleanup=()=>{m&&(clearTimeout(m),m=null),v.abort(),t.dropdownArrow&&(t.dropdownArrow.style.transform="rotate(0deg)",t.dropdownArrow.style.background=""),t.innerBorderElement&&(t.innerBorderElement.style.display="none"),b&&"number"==typeof b.openDropdowns&&h&&(b.openDropdowns=Math.max(0,b.openDropdowns-1),h=!1)}}},371:(e,t,n)=>{n.d(t,{BG:()=>$,BJ:()=>w,BK:()=>a,QN:()=>d,YX:()=>p,_W:()=>m,aJ:()=>S,el:()=>b,et:()=>x,lY:()=>v,lt:()=>g,nZ:()=>_,oR:()=>h,uo:()=>C,y$:()=>f,zD:()=>k});var o=n(716);const i=["left","right","top","bottom"],a=["right","left","center"],r={"inline-end":"right","inline-start":"left"},s=new Set([...a,...Object.keys(r)]);function l(e){return e?.split(".")[0]}function c(e,t,n){return void 0===t||void 0===n?e:n<=t?t:Math.max(t,Math.min(n,e))}function d(e){return Math.max(0,Math.min(100,e))}function u(e){if(!e?.config?.invert_slider_value)return!1;if("light"===l(e?.config?.entity)){const t=e?.config?.light_slider_type;if(["hue","saturation","white_temp"].includes(t))return!1}return!0}function p(e,t){const n=d(Number(t)||0);return u(e)?100-n:n}function b(e,t){const n=d(Number(t)||0);return u(e)?100-n:n}function h(e){const t=e?.config?.slider_fill_orientation;return i.includes(t)?t:"left"}function m(e){const t=e?.config?.slider_value_position;return"hidden"===t?"hidden":t?r[t]?r[t]:s.has(t)?t:"right":"right"}function g(e,t){if(!e?.elements?.rangeFill)return;const n=p(e,t),o=h(e),i=function(e,t){switch(e){case"right":return`translateX(-${t}%)`;case"top":return`translateY(${t}%)`;case"bottom":return`translateY(-${t}%)`;default:return`translateX(${t}%)`}}(o,n);e.elements.rangeFill.style.transform!==i&&(e.elements.rangeFill.style.transform=i),e._lastVisualFillPercentage=n,e._lastFillOrientation=o}function f(e,t){return!isFinite(t)||t<=0?e:Math.round(e/t)*t}function y(e,t,n){return void 0===t||void 0===n||n<=t?0:100*(c(e,t,n)-t)/(n-t)}function v(e,t,n){return void 0===t||void 0===n||n<=t?0:t+e/100*(n-t)}function _(e,t){if(void 0!==e.config.min_value)return parseFloat(e.config.min_value);const n=t.entity_id.split(".")[0];return"media_player"===n&&void 0!==e.config.min_volume?parseFloat(e.config.min_volume):"climate"===n?t.attributes.min_temp??0:t.attributes.min??0}function w(e,t){if(void 0!==e.config.max_value)return parseFloat(e.config.max_value);const n=t.entity_id.split(".")[0];return"media_player"===n&&void 0!==e.config.max_volume?parseFloat(e.config.max_volume):"climate"===n?t.attributes.max_temp??100:t.attributes.max??100}function x(e,t){if(void 0!==e.config.step)return parseFloat(e.config.step);switch(t.entity_id.split(".")[0]){case"input_number":case"number":return t.attributes.step??1;case"fan":return t.attributes.percentage_step??1;case"climate":{const n="°C"===e._hass.config.unit_system.temperature;return t.attributes.target_temp_step??(n?.5:1)}case"media_player":return.01;default:return 1}}function k(e){if(!e)return!0;const t=l(e);return"sensor"===t||!["light","media_player","cover","input_number","number","fan","climate"].includes(t)}function C(e,t=e.config.entity){const n=l(t);if("sensor"===n&&"%"===(0,o.D$)(e,"unit_of_measurement",t))return d(parseFloat((0,o.Gu)(e,t))||0);const i=e._hass.states[t];if(!i)return 0;const a=_(e,i),r=w(e,i);switch(n){case"light":{const n=e?.config?.light_slider_type||"brightness";if("hue"===n){const n=(0,o.D$)(e,"hs_color",t)||[];return d(((Array.isArray(n)&&parseFloat(n[0])||0)%360+360)%360/360*100)}if("saturation"===n){const n=(0,o.D$)(e,"hs_color",t)||[];return d(Array.isArray(n)&&parseFloat(n[1])||0)}if("white_temp"===n){const n=parseFloat((0,o.D$)(e,"color_temp",t)),i=parseFloat((0,o.D$)(e,"min_mireds",t))||153,a=parseFloat((0,o.D$)(e,"max_mireds",t))||500;return isFinite(n)?y(c(n,Math.min(i,a),Math.max(i,a)),i,a):0}const i=100*((0,o.D$)(e,"brightness",t)??0)/255;return void 0!==e.config.min_value||void 0!==e.config.max_value?y(i,a,r):d(i)}case"media_player":{const n=(0,o.D$)(e,"volume_level",t),i=null!=n?100*n:0;return void 0!==e.config.min_value||void 0!==e.config.max_value||void 0!==e.config.min_volume||void 0!==e.config.max_volume?y(i,a,r):d(i)}case"cover":{const n=(0,o.D$)(e,"current_position",t),i=null!=n?n:0;return void 0!==e.config.min_value||void 0!==e.config.max_value?y(i,a,r):d(i)}case"input_number":case"number":{const n=parseFloat((0,o.Gu)(e,t));return isNaN(n)?0:y(c(n,a,r),a,r)}case"fan":if((0,o.$C)(e,t)){const n=(0,o.D$)(e,"percentage",t)??0;return void 0!==e.config.min_value||void 0!==e.config.max_value?y(c(parseFloat(n),a,r),a,r):d(n)}return 0;case"climate":if((0,o.$C)(e,t)){const n=parseFloat((0,o.D$)(e,"temperature",t));return isNaN(n)?0:y(c(n,a,r),a,r)}return 0;default:if(void 0!==e.config.min_value&&void 0!==e.config.max_value){const n=parseFloat((0,o.Gu)(e,t));return isNaN(n)?0:y(c(n,a,r),a,r)}return 0}}function $(e,t){const n=e.config.entity,o=l(n),i=e._hass,a=e.sliderMinValue??e.config?.min_value,r=e.sliderMaxValue??e.config?.max_value,s=e.sliderStep??e.config?.step??1;let u=Number(a),p=Number(r),b=Number(s);Number.isFinite(u)||(u=0),Number.isFinite(p)||(p="climate"===o?u+1:100),p<=u&&(p="climate"===o?u+1:u+100),(!Number.isFinite(b)||b<=0)&&(b=1);const h=d(Number(t)||0),m=p-u;return A(e,c(f(u+(m>0?h/100*m:0),b),u,p),o,n,i)}function S(e){const t=e.config.entity,n=l(t),i=e._hass,a=i?.states?.[t];if(!a)return i?.localize?.("state.default.unavailable")||"0%";let r=0;switch(n){case"climate":if(!(0,o.$C)(e,t))return i?.localize?.("state.default.off")||"0%";r=parseFloat((0,o.D$)(e,"temperature",t))||0;break;case"input_number":case"number":default:r=parseFloat((0,o.Gu)(e,t))||0;break;case"light":r=100*((0,o.D$)(e,"brightness",t)??0)/255;break;case"media_player":{const n=(0,o.D$)(e,"volume_level",t);r=null!=n?100*n:0;break}case"cover":{const n=(0,o.D$)(e,"current_position",t);r=null!=n?n:0;break}case"fan":r=(0,o.$C)(e,t)?(0,o.D$)(e,"percentage",t)??0:0}return A(e,r,n,t,i)}function A(e,t,n,i,a){const r=a?.locale?.language||"en-US",s=(e,t,n)=>(0,o.IU)(e,t,n,r);switch(n){case"climate":{if(!(0,o.$C)(e,i))return a?.localize?.("state.default.off")||"0%";const n=(0,o.$z)(a);return s(t,Number.isInteger(t)?0:1,n)}case"input_number":case"number":{const n=(0,o.D$)(e,"unit_of_measurement",i)||"";return s(t,a?.states?.[i]?.attributes?.precision??(Number.isInteger(t)?0:1),n)}case"light":case"media_player":case"cover":case"fan":return s(Math.round(t),0,"%");default:{const n=(0,o.D$)(e,"unit_of_measurement",i)||"";return n?s(t,a?.states?.[i]?.attributes?.precision??(Number.isInteger(t)?0:1),n):s(Math.round(t),0,"%")}}}},382:(e,t,n)=>{function o(e){return null==e}n.d(t,{Ay:()=>gt,Hh:()=>lt,ZU:()=>nt,my:()=>st});var i={isNothing:o,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:o(e)?[]:[e]},repeat:function(e,t){var n,o="";for(n=0;ns&&(t=o-s+(a=" ... ").length),n-o>s&&(n=o+s-(r=" ...").length),{str:a+e.slice(t,n).replace(/\t/g,"→")+r,pos:o-t+a.length}}function c(e,t){return i.repeat(" ",t-e.length)+e}var d=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],u=["scalar","sequence","mapping"],p=function(e,t){if(t=t||{},Object.keys(t).forEach(function(t){if(-1===d.indexOf(t))throw new s('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}(t.styleAliases||null),-1===u.indexOf(this.kind))throw new s('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function b(e,t){var n=[];return e[t].forEach(function(e){var t=n.length;n.forEach(function(n,o){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=o)}),n[t]=e}),n}function h(e){return this.extend(e)}h.prototype.extend=function(e){var t=[],n=[];if(e instanceof p)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new s("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach(function(e){if(!(e instanceof p))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new s("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new s("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(e){if(!(e instanceof p))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var o=Object.create(h.prototype);return o.implicit=(this.implicit||[]).concat(t),o.explicit=(this.explicit||[]).concat(n),o.compiledImplicit=b(o,"implicit"),o.compiledExplicit=b(o,"explicit"),o.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function o(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),S=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),A=/^[-+]?[0-9]+e/,L=new p("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!S.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||i.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i.isNegativeZero(e))return"-0.0";return n=e.toString(10),A.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),E=v.extend({implicit:[_,w,$,L]}),M=E,T=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),B=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"),P=new p("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==T.exec(e)||null!==B.exec(e))},construct:function(e){var t,n,o,i,a,r,s,l,c=0,d=null;if(null===(t=T.exec(e))&&(t=B.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],o=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,o,i));if(a=+t[4],r=+t[5],s=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),l=new Date(Date.UTC(n,o,i,a,r,s,c)),d&&l.setTime(l.getTime()-d),l},instanceOf:Date,represent:function(e){return e.toISOString()}}),I=new p("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r",q=new p("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,o=0,i=e.length,a=O;for(n=0;n64)){if(t<0)return!1;o+=6}return o%8==0},construct:function(e){var t,n,o=e.replace(/[\r\n=]/g,""),i=o.length,a=O,r=0,s=[];for(t=0;t>16&255),s.push(r>>8&255),s.push(255&r)),r=r<<6|a.indexOf(o.charAt(t));return 0==(n=i%4*6)?(s.push(r>>16&255),s.push(r>>8&255),s.push(255&r)):18===n?(s.push(r>>10&255),s.push(r>>2&255)):12===n&&s.push(r>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,o="",i=0,a=e.length,r=O;for(t=0;t>18&63],o+=r[i>>12&63],o+=r[i>>6&63],o+=r[63&i]),i=(i<<8)+e[t];return 0==(n=a%3)?(o+=r[i>>18&63],o+=r[i>>12&63],o+=r[i>>6&63],o+=r[63&i]):2===n?(o+=r[i>>10&63],o+=r[i>>4&63],o+=r[i<<2&63],o+=r[64]):1===n&&(o+=r[i>>2&63],o+=r[i<<4&63],o+=r[64],o+=r[64]),o}}),j=Object.prototype.hasOwnProperty,z=Object.prototype.toString,D=new p("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,o,i,a,r=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var se=new Array(256),le=new Array(256),ce=0;ce<256;ce++)se[ce]=ae(ce)?1:0,le[ce]=ae(ce);function de(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||F,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function ue(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,o=/\r?\n|\r|\0/g,a=[0],r=[],s=-1;n=o.exec(e.buffer);)r.push(n.index),a.push(n.index+n[0].length),e.position<=n.index&&s<0&&(s=a.length-2);s<0&&(s=a.length-1);var d,u,p="",b=Math.min(e.line+t.linesAfter,r.length).toString().length,h=t.maxLength-(t.indent+b+3);for(d=1;d<=t.linesBefore&&!(s-d<0);d++)u=l(e.buffer,a[s-d],r[s-d],e.position-(a[s]-a[s-d]),h),p=i.repeat(" ",t.indent)+c((e.line-d+1).toString(),b)+" | "+u.str+"\n"+p;for(u=l(e.buffer,a[s],r[s],e.position,h),p+=i.repeat(" ",t.indent)+c((e.line+1).toString(),b)+" | "+u.str+"\n",p+=i.repeat("-",t.indent+b+3+u.pos)+"^\n",d=1;d<=t.linesAfter&&!(s+d>=r.length);d++)u=l(e.buffer,a[s+d],r[s+d],e.position-(a[s]-a[s+d]),h),p+=i.repeat(" ",t.indent)+c((e.line+d+1).toString(),b)+" | "+u.str+"\n";return p.replace(/\n$/,"")}(n),new s(t,n)}function pe(e,t){throw ue(e,t)}function be(e,t){e.onWarning&&e.onWarning.call(null,ue(e,t))}var he={YAML:function(e,t,n){var o,i,a;null!==e.version&&pe(e,"duplication of %YAML directive"),1!==n.length&&pe(e,"YAML directive accepts exactly one argument"),null===(o=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&pe(e,"ill-formed argument of the YAML directive"),i=parseInt(o[1],10),a=parseInt(o[2],10),1!==i&&pe(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=a<2,1!==a&&2!==a&&be(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var o,i;2!==n.length&&pe(e,"TAG directive accepts exactly two arguments"),o=n[0],i=n[1],X.test(o)||pe(e,"ill-formed tag handle (first argument) of the TAG directive"),H.call(e.tagMap,o)&&pe(e,'there is a previously declared suffix for "'+o+'" tag handle'),J.test(i)||pe(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){pe(e,"tag prefix is malformed: "+i)}e.tagMap[o]=i}};function me(e,t,n,o){var i,a,r,s;if(t1&&(e.result+=i.repeat("\n",t-1))}function xe(e,t){var n,o,i=e.tag,a=e.anchor,r=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=r),o=e.input.charCodeAt(e.position);0!==o&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,pe(e,"tab characters must not be used in indentation")),45===o)&&ee(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,ve(e,!0,-1)&&e.lineIndent<=t)r.push(null),o=e.input.charCodeAt(e.position);else if(n=e.line,$e(e,t,3,!1,!0),r.push(e.result),ve(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==o)pe(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(f&&(r=e.line,s=e.lineStart,l=e.position),$e(e,t,4,!0,i)&&(f?m=e.result:g=e.result),f||(fe(e,p,b,h,m,g,r,s,l),h=m=g=null),ve(e,!0,-1),c=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&0!==c)pe(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===a?pe(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?pe(e,"repeat of an indentation width identifier"):(d=t+a-1,c=!0)}if(Z(r)){do{r=e.input.charCodeAt(++e.position)}while(Z(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!Q(r)&&0!==r)}for(;0!==r;){for(ye(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentd&&(d=e.lineIndent),Q(r))u++;else{if(e.lineIndent0){for(i=r,a=0;i>0;i--)(r=ne(s=e.input.charCodeAt(++e.position)))>=0?a=(a<<4)+r:pe(e,"expected hexadecimal character");e.result+=re(a),e.position++}else pe(e,"unknown escape sequence");n=o=e.position}else Q(s)?(me(e,n,o,!0),we(e,ve(e,!1,t)),n=o=e.position):e.position===e.lineStart&&_e(e)?pe(e,"unexpected end of the document within a double quoted scalar"):(e.position++,o=e.position)}pe(e,"unexpected end of the stream within a double quoted scalar")}(e,b)?f=!0:function(e){var t,n,o;if(42!==(o=e.input.charCodeAt(e.position)))return!1;for(o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!ee(o)&&!te(o);)o=e.input.charCodeAt(++e.position);return e.position===t&&pe(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),H.call(e.anchorMap,n)||pe(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],ve(e,!0,-1),!0}(e)?(f=!0,null===e.tag&&null===e.anchor||pe(e,"alias node should not have any properties")):function(e,t,n){var o,i,a,r,s,l,c,d,u=e.kind,p=e.result;if(ee(d=e.input.charCodeAt(e.position))||te(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(ee(o=e.input.charCodeAt(e.position+1))||n&&te(o)))return!1;for(e.kind="scalar",e.result="",i=a=e.position,r=!1;0!==d;){if(58===d){if(ee(o=e.input.charCodeAt(e.position+1))||n&&te(o))break}else if(35===d){if(ee(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&_e(e)||n&&te(d))break;if(Q(d)){if(s=e.line,l=e.lineStart,c=e.lineIndent,ve(e,!1,-1),e.lineIndent>=t){r=!0,d=e.input.charCodeAt(e.position);continue}e.position=a,e.line=s,e.lineStart=l,e.lineIndent=c;break}}r&&(me(e,i,a,!1),we(e,e.line-s),i=a=e.position,r=!1),Z(d)||(a=e.position+1),d=e.input.charCodeAt(++e.position)}return me(e,i,a,!1),!!e.result||(e.kind=u,e.result=p,!1)}(e,b,1===n)&&(f=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=l&&xe(e,h))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&pe(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,d=e.implicitTypes.length;c"),null!==e.result&&p.kind!==e.kind&&pe(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result,e.tag)?(e.result=p.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):pe(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function Se(e){var t,n,o,i,a=e.position,r=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(ve(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(r=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!ee(i);)i=e.input.charCodeAt(++e.position);for(o=[],(n=e.input.slice(t,e.position)).length<1&&pe(e,"directive name must not be less than one character in length");0!==i;){for(;Z(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!Q(i));break}if(Q(i))break;for(t=e.position;0!==i&&!ee(i);)i=e.input.charCodeAt(++e.position);o.push(e.input.slice(t,e.position))}0!==i&&ye(e),H.call(he,n)?he[n](e,n,o):be(e,'unknown document directive "'+n+'"')}ve(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,ve(e,!0,-1)):r&&pe(e,"directives end mark is expected"),$e(e,e.lineIndent-1,4,!1,!0),ve(e,!0,-1),e.checkLineBreaks&&Y.test(e.input.slice(a,e.position))&&be(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&_e(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,ve(e,!0,-1)):e.position=55296&&o<=56319&&t+1=56320&&n<=57343?1024*(o-55296)+n-56320+65536:o}function He(e){return/^\n* /.test(e)}function We(e,t,n,o,i){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==Ie.indexOf(t)||Oe.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,n),r=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),l=o||e.flowLevel>-1&&n>=e.flowLevel;switch(function(e,t,n,o,i,a,r,s){var l,c,d=0,u=null,p=!1,b=!1,h=-1!==o,m=-1,g=Ue(c=Fe(e,0))&&c!==Be&&!Ne(c)&&45!==c&&63!==c&&58!==c&&44!==c&&91!==c&&93!==c&&123!==c&&125!==c&&35!==c&&38!==c&&42!==c&&33!==c&&124!==c&&61!==c&&62!==c&&39!==c&&34!==c&&37!==c&&64!==c&&96!==c&&function(e){return!Ne(e)&&58!==e}(Fe(e,e.length-1));if(t||r)for(l=0;l=65536?l+=2:l++){if(!Ue(d=Fe(e,l)))return 5;g=g&&Ve(d,u,s),u=d}else{for(l=0;l=65536?l+=2:l++){if(10===(d=Fe(e,l)))p=!0,h&&(b=b||l-m-1>o&&" "!==e[m+1],m=l);else if(!Ue(d))return 5;g=g&&Ve(d,u,s),u=d}b=b||h&&l-m-1>o&&" "!==e[m+1]}return p||b?n>9&&He(e)?5:r?2===a?5:2:b?4:3:!g||r||i(e)?2===a?5:2:1}(t,l,e.indent,r,function(t){return function(e,t){var n,o;for(n=0,o=e.implicitTypes.length;n"+Ye(t,e.indent)+Ke(ze(function(e,t){for(var n,o,i,a=/(\n+)([^\n]*)/g,r=(i=-1!==(i=e.indexOf("\n"))?i:e.length,a.lastIndex=i,Xe(e.slice(0,i),t)),s="\n"===e[0]||" "===e[0];o=a.exec(e);){var l=o[1],c=o[2];n=" "===c[0],r+=l+(s||n||""===c?"":"\n")+Xe(c,t),s=n}return r}(t,r),a));case 5:return'"'+function(e){for(var t,n="",o=0,i=0;i=65536?i+=2:i++)o=Fe(e,i),!(t=Pe[o])&&Ue(o)?(n+=e[i],o>=65536&&(n+=e[i+1])):n+=t||qe(o);return n}(t)+'"';default:throw new s("impossible error: invalid scalar style")}}()}function Ye(e,t){var n=He(e)?String(t):"",o="\n"===e[e.length-1];return n+(!o||"\n"!==e[e.length-2]&&"\n"!==e?o?"":"-":"+")+"\n"}function Ke(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function Xe(e,t){if(""===e||" "===e[0])return e;for(var n,o,i=/ [^ ]/g,a=0,r=0,s=0,l="";n=i.exec(e);)(s=n.index)-a>t&&(o=r>a?r:s,l+="\n"+e.slice(a,o),a=o+1),r=s;return l+="\n",e.length-a>t&&r>a?l+=e.slice(a,r)+"\n"+e.slice(r+1):l+=e.slice(a),l.slice(1)}function Je(e,t,n,o){var i,a,r,s="",l=e.tag;for(i=0,a=n.length;i tag resolver accepts not "'+c+'" style');o=l.represent[c](t,c)}e.dump=o}return!0}return!1}function Qe(e,t,n,o,i,a,r){e.tag=null,e.dump=n,Ge(e,n,!1)||Ge(e,n,!0);var l,c=Me.call(e.dump),d=o;o&&(o=e.flowLevel<0||e.flowLevel>t);var u,p,b="[object Object]"===c||"[object Array]"===c;if(b&&(p=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||p||2!==e.indent&&t>0)&&(i=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(b&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===c)o&&0!==Object.keys(e.dump).length?(function(e,t,n,o){var i,a,r,l,c,d,u="",p=e.tag,b=Object.keys(n);if(!0===e.sortKeys)b.sort();else if("function"==typeof e.sortKeys)b.sort(e.sortKeys);else if(e.sortKeys)throw new s("sortKeys must be a boolean or a function");for(i=0,a=b.length;i1024)&&(e.dump&&10===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,c&&(d+=De(e,t)),Qe(e,t+1,l,!0,c)&&(e.dump&&10===e.dump.charCodeAt(0)?d+=":":d+=": ",u+=d+=e.dump));e.tag=p,e.dump=u||"{}"}(e,t,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var o,i,a,r,s,l="",c=e.tag,d=Object.keys(n);for(o=0,i=d.length;o1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Qe(e,t,r,!1,!1)&&(l+=s+=e.dump));e.tag=c,e.dump="{"+l+"}"}(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===c)o&&0!==e.dump.length?(e.noArrayIndent&&!r&&t>0?Je(e,t-1,e.dump,i):Je(e,t,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var o,i,a,r="",s=e.tag;for(o=0,i=n.length;o",e.dump=l+" "+e.dump)}return!0}function Ze(e,t){var n,o,i=[],a=[];for(et(e,i,a),n=0,o=a.length;n{n.d(t,{DK:()=>u,Qp:()=>c,S1:()=>a,VA:()=>l,jA:()=>d,sW:()=>r,w1:()=>s});var o=n(716),i=n(140);function a(e,t){if(!e||!t||!t.startsWith("light."))return"";const n=e.attributes||{},o=[];return n.rgb_color&&o.push(`rgb:${n.rgb_color.join(",")}`),n.hs_color&&o.push(`hs:${n.hs_color.join(",")}`),n.xy_color&&o.push(`xy:${n.xy_color.join(",")}`),null!=n.color_temp&&o.push(`ct:${n.color_temp}`),null!=n.color_temp_kelvin&&o.push(`ctk:${n.color_temp_kelvin}`),null!=n.brightness&&o.push(`br:${n.brightness}`),n.color_mode&&o.push(`cm:${n.color_mode}`),o.join("|")}function r(e,t=e.config.entity,n=e.config.icon){const i=t?.split(".")[0],a=(0,o.D$)(e,"device_class",t),r=(0,o.D$)(e,"icon",t),s=n,l=(0,o.Gu)(e,t),c={alarm_control_panel:"mdi:shield",alert:"mdi:alert",automation:"mdi:playlist-play",binary_sensor:function(){const n="off"===l;switch((0,o.D$)(e,"device_class",t)){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness-5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"plug":case"power":return n?"mdi:power-plug-off":"mdi:power-plug";case"running":return n?"mdi:stop":"mdi:play";case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}}(),calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:settings",conversation:"mdi:text-to-speech",cover:function(){const n="closed"!==l;switch((0,o.D$)(e,"device_class",t)){case"awning":return n?"mdi:awning-outline":"mdi:awning";case"blind":return n?"mdi:blinds-open":"mdi:blinds";case"curtain":return n?"mdi:curtains":"mdi:curtains-closed";case"damper":case"shutter":default:return n?"mdi:window-shutter-open":"mdi:window-shutter";case"door":return n?"mdi:door-open":"mdi:door-closed";case"garage":return n?"mdi:garage-open":"mdi:garage";case"gate":return n?"mdi:gate-open":"mdi:gate";case"shade":return n?"mdi:roller-shade":"mdi:roller-shade-closed";case"window":return n?"mdi:window-open":"mdi:window-closed"}}(),device_tracker:"mdi:account",fan:"mdi:fan",group:"mdi:google-circles-communities",history_graph:"mdi:chart-line",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_boolean:"mdi:drawing",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:textbox",light:"mdi:lightbulb",lock:"unlocked"===l.toLowerCase()?"mdi:lock-open":"mdi:lock",mailbox:"mdi:mailbox",media_player:"mdi:speaker",mower:"mdi:robot-mower",notify:"mdi:comment-alert",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:file-document",sensor:function(){switch((0,o.D$)(e,"device_class",t)){case"battery":return 100==l?"mdi:battery":l>=90?"mdi:battery-90":l>=80?"mdi:battery-80":l>=70?"mdi:battery-70":l>=60?"mdi:battery-60":l>=50?"mdi:battery-50":l>=40?"mdi:battery-40":l>=30?"mdi:battery-30":l>=20?"mdi:battery-20":l>=10?"mdi:battery-10":"mdi:battery-alert";case"humidity":return"mdi:water-percent";case"illuminance":return"mdi:brightness-5";case"temperature":return"mdi:thermometer";case"pressure":return"mdi:gauge";case"power":return"mdi:flash";case"signal_strength":return"mdi:wifi";case"energy":return"mdi:lightning-bolt";default:return"mdi:eye"}}(),simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",switch:"mdi:flash",timer:"mdi:timer",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:function(n=(0,o.Gu)(e,t)){switch(n){case"cloudy":default:return"mdi:weather-cloudy";case"partlycloudy":return"mdi:weather-partly-cloudy";case"rainy":return"mdi:weather-rainy";case"snowy":return"mdi:weather-snowy";case"sunny":return"mdi:weather-sunny";case"clear-night":return"mdi:weather-night";case"fog":return"mdi:weather-fog";case"hail":return"mdi:weather-hail";case"lightning":return"mdi:weather-lightning";case"lightning-rainy":return"mdi:weather-lightning-rainy";case"pouring":return"mdi:weather-pouring";case"windy":return"mdi:weather-windy";case"windy-variant":return"mdi:weather-windy-variant";case"exceptional":return"mdi:alert-circle-outline"}}(),weblink:"mdi:open-in-new"};return s||r||(c[i]?c[i]:c[a]?c[a]:"")}function s(e){switch(e){case"cloudy":default:return"mdi:weather-cloudy";case"partlycloudy":return"mdi:weather-partly-cloudy";case"rainy":return"mdi:weather-rainy";case"snowy":return"mdi:weather-snowy";case"sunny":return"mdi:weather-sunny";case"clear-night":return"mdi:weather-night";case"fog":return"mdi:weather-fog";case"hail":return"mdi:weather-hail";case"lightning":return"mdi:weather-lightning";case"lightning-rainy":return"mdi:weather-lightning-rainy";case"pouring":return"mdi:weather-pouring";case"windy":return"mdi:weather-windy";case"windy-variant":return"mdi:weather-windy-variant";case"exceptional":return"mdi:alert-circle-outline"}}function l(e,t=e.config.entity,n=1){const{card_type:a,use_accent_color:r}=e.config,s=(0,o.D$)(e,"rgb_color",t),l=(0,o.GM)("var(--bubble-button-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))))")?n-.2:n,c=t===e.config.entity&&(0,o.D$)(e,"unit_of_measurement",t)?.includes("°"),d=t===e.config.entity&&e._hass.states[t]?.state?.match(/\d+/);if(!t||c||d)return"var(--bubble-icon-color)";if((0,o.md)(e,"light")&&!r?"button"===a?e.card.classList.add("is-light"):"pop-up"===a&&e.elements.headerContainer.classList.add("is-light"):"button"===a?e.card.classList.remove("is-light"):"pop-up"===a&&e.elements.headerContainer.classList.remove("is-light"),!t.startsWith("light.")||r)return"var(--bubble-accent-color, var(--bubble-default-color))";const u=(0,o.f9)([225,225,210],l);if(!s)return`var(--bubble-light-color, var(--bubble-light-white-color, rgba(${u.join(", ")})))`;const p=(0,o.f9)(s,l);return(0,i.qd)(s)?`var(--bubble-light-color, var(--bubble-light-white-color, rgba(${u.join(", ")})))`:`var(--bubble-light-color, rgba(${p.join(", ")}))`}function c(e,t=e.config.entity,n=!1){if(!n&&(e.config.force_icon||e.config.icon))return"";const i=(0,o.D$)(e,"entity_picture_local",t)||(0,o.D$)(e,"entity_picture",t);return i?e._hass.hassUrl(i):""}function d(e,t){e&&(e.classList.remove("hidden"),e.classList.add("bubble-sub-button-icon","show-icon"),e.classList.toggle("icon-with-state",!!t),e.classList.toggle("icon-without-state",!t))}function u(e,t,n,o={}){const{beforeIconUpdate:i}=o,a=t.image;let r=t.icon;const s=t.showIcon,l=!!n,c=t.isSelect&&t.showArrow,u=!l&&!c;if(s&&a){let t=e.image;t||(t=document.createElement("div"),t.classList.add("bubble-sub-button-image"),t.classList.add("show-icon"),e.appendChild(t),e.image=t);const o=`url(${a})`;return t.style.backgroundImage!==o&&(t.style.backgroundImage=o),t.classList.remove("hidden"),t.classList.add("show-icon"),d(t,n),t.classList.toggle("image-full",u),e.classList.toggle("has-image-full",u),e.icon&&(e.icon.classList.remove("show-icon"),e.icon.classList.add("hidden")),t}if(s&&r){let o=e.icon;if(o||(o=document.createElement("ha-icon"),o.classList.add("bubble-sub-button-icon"),o.classList.add("show-icon"),e.appendChild(o),e.icon=o),i){const n=i(o,t);null!=n&&n instanceof HTMLElement&&n!==o&&(e.icon=n,o=n)}else o.icon!==r&&o.setAttribute("icon",r);return o.classList.remove("hidden"),o.classList.add("bubble-sub-button-icon","show-icon"),d(o,n),e.classList.remove("has-image-full"),e.image&&(e.image.classList.remove("show-icon","image-full"),e.image.classList.add("hidden")),o}return e.classList.remove("has-image-full"),e.icon&&(e.icon.classList.remove("show-icon"),e.icon.classList.add("hidden")),e.image&&(e.image.classList.remove("show-icon","image-full"),e.image.classList.add("hidden")),null}},391:(e,t,n)=>{n.d(t,{nE:()=>w,gS:()=>u,mp:()=>_,cj:()=>y});var o=n(716),i=n(361),a=n(653),r=n(175);const s='.bubble-sub-button-container {\n position: relative;\n display: flex;\n justify-content: var(--bubble-sub-button-justify-content, end);\n right: 8px;\n align-content: center;\n gap: 8px;\n align-items: center;\n}\n\n.bubble-sub-button-container.fixed-top {\n align-self: flex-start;\n}\n\n.fixed-top .bubble-sub-button-container {\n margin-top: 10px;\n}\n\n/* Group containers */\n.bubble-sub-button-group {\n display: flex;\n position: relative;\n gap: 8px;\n align-items: center;\n}\n\n.bubble-sub-button-group.position-top,\n.bubble-sub-button-group.position-bottom {\n margin-top: 0;\n}\n\n.bubble-sub-button-bottom-container {\n position: absolute;\n display: flex;\n justify-content: var(--bubble-sub-button-justify-content, end);\n bottom: 0;\n width: calc(100% - 16px);\n margin: 0 8px 8px 8px;\n gap: 8px;\n pointer-events: none;\n flex-wrap: nowrap;\n /* Allow bottom inline sliders to shrink without affecting top sliders */\n --slider-container-min-width: 36px;\n}\n\n.bubble-sub-button-bottom-container.alignment-lanes-active {\n justify-content: flex-start;\n}\n\n.bubble-sub-button-bottom-container.with-main-buttons-bottom {\n bottom: 44px;\n}\n\n.bubble-sub-button-bottom-container > * {\n pointer-events: auto;\n}\n\n.bubble-sub-button-alignment-lane {\n display: flex;\n flex-wrap: nowrap;\n gap: 8px;\n align-items: center;\n}\n\n.bubble-sub-button-alignment-lane.lane-start,\n.bubble-sub-button-alignment-lane.lane-center,\n.bubble-sub-button-alignment-lane.lane-end {\n flex: 0 0 auto;\n min-width: 0;\n}\n\n.bubble-sub-button-alignment-lane.lane-start {\n justify-content: flex-start;\n}\n\n.bubble-sub-button-alignment-lane.lane-center {\n justify-content: center;\n flex: 1 1 0%;\n}\n\n.bubble-sub-button-alignment-lane.lane-end {\n justify-content: flex-end;\n margin-left: auto;\n}\n\n.bubble-sub-button-alignment-lane.lane-expand {\n flex: 1 1 0%;\n min-width: 0;\n}\n\n.bubble-sub-button-alignment-lane.lane-fill {\n flex: 1 1 100%;\n width: 100%;\n min-width: 0;\n justify-content: flex-start;\n}\n\n.bubble-sub-button-bottom-container .bubble-sub-button-group {\n flex: 0 0 auto;\n min-width: 0;\n}\n\n.bubble-sub-button-bottom-container .bubble-sub-button-group.alignment-fill,\n.bubble-sub-button-bottom-container .bubble-sub-button-group.alignment-fill-auto {\n flex: 1 1 0%;\n}\n\n/* Display styles for groups */\n.bubble-sub-button-group.display-inline {\n flex-direction: row;\n justify-content: var(--bubble-sub-button-group-justify-content, end);\n}\n\n.bubble-sub-button-group.display-column {\n flex-direction: column;\n align-items: var(--bubble-sub-button-group-justify-content, end);\n gap: 8px;\n}\n\n.bubble-sub-button-group.display-column > .bubble-sub-button,\n.bubble-sub-button-group.group-layout-inline > .bubble-sub-button {\n width: auto;\n}\n\n/* Group placement layout (rows vs inline) */\n.bubble-sub-button-container.groups-layout-rows,\n.bubble-sub-button-bottom-container.groups-layout-rows {\n flex-direction: column;\n}\n\n.bubble-sub-button-container.groups-layout-inline,\n.bubble-sub-button-bottom-container.groups-layout-inline {\n flex-direction: row;\n}\n\n/* When groups-layout-rows is active, each group spans full width by default */\n.groups-layout-rows .bubble-sub-button-group {\n width: 100%;\n}\n\n.bubble-sub-button {\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row-reverse;\n align-items: center;\n justify-content: center;\n position: relative;\n right: 0;\n box-sizing: border-box;\n width: max-content;\n min-width: 36px;\n height: var(--bubble-sub-button-height, 36px);\n vertical-align: middle;\n font-size: 12px;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 18px));\n padding: 0 8px;\n white-space: nowrap;\n transition: all 0.5s ease-in-out;\n color: var(--primary-text-color);\n}\n\n.bubble-sub-button.fill-width {\n flex: 1 1 0%;\n}\n\n.bubble-sub-button-group.display-column > .bubble-sub-button.fill-width {\n width: 100%;\n flex: 0 0 auto;\n}\n\n/* When a slider is inline, allow it to expand to fill width when requested */\n.bubble-sub-slider-wrapper.inline.fill-width,\n.bubble-sub-button-slider.inline.fill-width {\n flex: 1 1 0%;\n width: 100%;\n min-width: 0;\n}\n\n/* Hide only the host button content (icon + text) when inline slider is shown */\n.bubble-sub-button.inline-slider-host {\n padding: 0;\n min-width: 0;\n display: none;\n}\n\n.bubble-sub-button.inline-slider-host > .bubble-sub-button-name-container,\n.bubble-sub-button.inline-slider-host > .bubble-sub-button-icon,\n.bubble-sub-button.inline-slider-host > .bubble-feedback-container,\n.bubble-sub-button.inline-slider-host > .bubble-dropdown-arrow {\n display: none !important;\n}\n\n.bubble-sub-button-name-container {\n display: flex;\n overflow: auto;\n}\n\n/* Lower line-height when scrolling effect is disabled (multi-line mode) */\n.bubble-sub-button-name-container[style*="-webkit-box"] {\n line-height: 1.1;\n}\n\n/* Content layout styles */\n.bubble-sub-button.content-icon-top,\n.bubble-sub-button.content-icon-bottom,\n.bubble-sub-button.content-icon-right,\n.bubble-sub-button.content-icon-left {\n justify-content: center;\n}\n\n.bubble-sub-button.content-icon-top {\n flex-direction: column-reverse;\n}\n\n.bubble-sub-button.content-icon-bottom {\n flex-direction: column;\n}\n\n.bubble-sub-button.content-icon-right {\n flex-direction: row;\n}\n\n.bubble-sub-button.content-icon-left {\n flex-direction: row-reverse;\n}\n\n.content-icon-right .icon-with-state {\n margin: 0 0 0 4px;\n}\n\n.content-icon-top .icon-with-state,\n.content-icon-bottom .icon-with-state {\n margin: 0;\n}\n\n.show-icon {\n display: flex;\n --mdc-icon-size: 16px;\n}\n\n.bubble-sub-button-image {\n background-size: cover;\n background-position: center;\n min-width: 20px;\n min-height: 20px;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n\n.bubble-sub-button-image.icon-with-state {\n margin-right: 4px;\n}\n\n.bubble-sub-button-image.icon-without-state,\n.content-icon-top .bubble-sub-button-image.icon-with-state,\n.content-icon-bottom .bubble-sub-button-image.icon-with-state {\n margin: 0;\n}\n\n.content-icon-right .bubble-sub-button-image.icon-with-state {\n margin: 0 0 0 4px;\n}\n\n/* Full-size entity picture when only the icon is displayed */\n.bubble-sub-button.has-image-full {\n padding: 0;\n overflow: hidden;\n}\n\n.bubble-sub-button-image.image-full {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n min-width: unset;\n min-height: unset;\n border-radius: inherit;\n margin: 0;\n}\n\n.bright-background {\n color: var(--bubble-sub-button-dark-text-color, rgb(0, 0, 0));\n}\n\n.background-on {\n background-color: var(--bubble-sub-button-light-background-color, var(--bubble-accent-color, var(--bubble-default-color)));\n}\n\n.background-off {\n background-color: var(--bubble-sub-button-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n}\n\n.icon-with-state {\n margin-right: 4px;\n --mdc-icon-size: 16px;\n}\n\n.icon-without-state {\n margin-right: 0;\n --mdc-icon-size: 20px;\n}\n\n.no-icon-select-arrow {\n width: 24px !important;\n height: 24px !important;\n --mdc-icon-size: 24px;\n}\n\n.no-icon-select-container {\n width: 16px !important;\n}\n\n.bubble-sub-button .bubble-dropdown-container {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n.bubble-sub-button .bubble-dropdown-arrow {\n background: none !important;\n inset: 0;\n margin: auto -4px;\n}\n\n.bubble-sub-button.is-select.background-on {\n background-color: var(--bubble-select-arrow-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n}\n\n.sub-buttons-grid .bubble-sub-button-container {\n display: grid;\n row-gap: calc( ( ( var(--row-height,56px) - 36px ) * var(--row-size,1) + var(--row-gap, 8px) * ( var(--row-size,1) - 1 ) ) / ( var(--row-size,1) + 1 ));\n grid-template-rows: repeat(var(--row-size,1), 1fr);\n grid-template-columns: repeat(1, 1fr);\n grid-auto-flow: column;\n}\n\n.sub-buttons-grid .bubble-sub-button-container:has(> :last-child:nth-child(2)) :nth-child(2) {\n grid-row: 1 / calc(var(--row-size,1) + 1);\n}\n\n.rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n row-gap: calc( ( ( var(--row-height,56px) - 40px ) * var(--row-size,1) + var(--row-gap, 8px) * ( var(--row-size,1) - 1 ) ) / ( 2*var(--row-size,1) + 2 ));\n column-gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(1, 1fr);\n grid-template-rows: repeat(calc(2*var(--row-size,1)), minmax(auto, max-content));\n grid-auto-flow: column;\n width: auto;\n}\n\n.rows-2 .bubble-sub-button {\n height: 20px;\n justify-content: left;\n}\n\n.large.rows-2 .bubble-sub-button-container:has(> :last-child:nth-child(2)) :nth-child(2) {\n grid-row: 1 / calc(2*var(--row-size,1) + 1);\n}\n\n/* Slider overlay wrapper: holds slider + close button and positions them relatively to card/group */\n.bubble-sub-slider-wrapper {\n position: absolute;\n display: flex;\n align-items: center;\n gap: 8px;\n height: 36px;\n width: calc(100% - 16px);\n left: 8px;\n right: 8px;\n z-index: 2;\n opacity: 1;\n transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;\n transform: translateX(0);\n /* Prevent browser from handling horizontal pan on mobile during drag */\n touch-action: none;\n}\n\n/* The actual slider surface in overlay mode fills remaining space inside wrapper */\n.bubble-sub-slider-wrapper > .bubble-sub-button-slider {\n position: relative;\n flex: 1 1 auto;\n height: 100%;\n overflow: hidden;\n border-radius: var(--bubble-sub-slider-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n background-color: var(--bubble-sub-slider-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n}\n\n/* Align wrapper vertically when overlay is card-level at top */\n.bubble-sub-slider-wrapper.top-aligned {\n top: 7px;\n bottom: auto;\n}\n\n/* Specific positioning for bottom containers to maintain existing behavior */\n.bubble-sub-button-bottom-container .bubble-sub-slider-wrapper {\n width: 100%;\n left: 0;\n right: auto;\n}\n\n.bubble-sub-slider-close {\n display: flex;\n position: relative;\n right: auto;\n height: 36px;\n width: 36px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n z-index: 3;\n overflow: hidden;\n box-sizing: border-box;\n border-radius: var(--bubble-media-player-buttons-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n background-color: var(--bubble-media-player-button-background-color);\n transition: all 0.3s ease;\n touch-action: none;\n -webkit-user-select: none;\n user-select: none;\n}\n\n.bubble-sub-slider-close ha-icon {\n --mdc-icon-size: 20px;\n color: var(--primary-text-color);\n line-height: normal;\n}\n\n.bubble-sub-button-slider .bubble-range-value {\n display: flex;\n justify-content: flex-end;\n height: 36px;\n align-items: center;\n font-size: 12px;\n opacity: 0.8;\n z-index: 1;\n}\n\n.is-hidden {\n opacity: 0 !important;\n pointer-events: none;\n transform: translateX(14px);\n}\n\n.bubble-icon-container.is-hidden,\n.bubble-main-icon-container.is-hidden,\n.bubble-sub-slider-close.is-hidden {\n transform: none;\n}\n\n.bubble-icon-container.is-hidden,\n.bubble-main-icon-container.is-hidden {\n transition: opacity 0.15s ease-in-out;\n}\n\n/* Allow overlay sliders to translate out without extending card width */\n.bubble-sub-slider-wrapper:not(.inline).is-hidden {\n right: calc(8px + 14px);\n}\n\n/* Bottom-aligned overlays rely on explicit width instead of right offsets */\n.bubble-sub-button-bottom-container .bubble-sub-slider-wrapper:not(.inline).is-hidden {\n width: calc(100% - 14px);\n}\n\n.bubble-sub-button-slider .bubble-range-fill {\n height: 101%; /* Ensure the fill is not glitching */\n}\n\n.bubble-sub-button-slider .bubble-range-fill.slider-use-light-color {\n opacity: 1;\n}\n\n.large .bubble-sub-slider-wrapper,\n.large .bubble-sub-button-slider .bubble-range-value {\n height: 36px;\n}\n\n.large .bubble-sub-slider-wrapper > .bubble-sub-button-slider {\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 18px));\n}\n\n.large .bubble-sub-button-slider .bubble-range-value {\n place-items: center;\n}\n\n/* Inline sub-slider mode (alwaysVisible): wrapper + slider sit inside sub-buttons row */\n.bubble-sub-slider-wrapper.inline {\n position: relative;\n left: 0;\n width: auto;\n height: var(--bubble-sub-slider-height, 36px);\n transform: none;\n z-index: 1;\n touch-action: pan-y pinch-zoom;\n flex-shrink: 0;\n box-sizing: border-box;\n}\n\n/* Vertical inline sliders: allow horizontal scroll, block vertical initially */\n.bubble-sub-slider-wrapper.inline:has(.fill-orientation-top),\n.bubble-sub-slider-wrapper.inline:has(.fill-orientation-bottom) {\n touch-action: pan-x pinch-zoom;\n}\n\n/* Custom width wrapper styles */\n.bubble-sub-slider-wrapper.inline.has-custom-width {\n flex: 0 0 auto;\n}\n\n/* Slider container inline styles */\n.bubble-sub-button-slider.inline {\n position: relative;\n left: 0;\n width: auto;\n min-width: var(--slider-container-min-width, 96px);\n height: var(--bubble-sub-slider-height, 36px);\n transform: none;\n opacity: 1;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 18px));\n}\n\n/* Bottom section: container fills wrapper width */\n.bubble-sub-button-bottom-container .bubble-sub-button-slider.inline.has-custom-width,\n.bubble-sub-button-group.position-bottom .bubble-sub-button-slider.inline.has-custom-width {\n width: 100%;\n min-width: 0;\n}\n\n/* Main section: container respects wrapper width when custom width is small */\n.bubble-sub-button-container .bubble-sub-button-slider.inline.has-custom-width,\n.bubble-sub-button-group.position-top .bubble-sub-button-slider.inline.has-custom-width,\n.bubble-sub-button-group:not(.position-bottom) .bubble-sub-button-slider.inline.has-custom-width {\n min-width: var(--slider-container-min-width, 96px);\n}\n/* Horizontal inline sliders: allow vertical scroll, block horizontal */\n.bubble-sub-button-slider.inline.slider-container,\n.bubble-sub-button-slider.inline .bubble-range-slider {\n touch-action: pan-y pinch-zoom;\n}\n\n/* Vertical inline sliders: allow horizontal scroll, block vertical */\n.bubble-sub-button-slider.inline.slider-container:has(.fill-orientation-top),\n.bubble-sub-button-slider.inline.slider-container:has(.fill-orientation-bottom),\n.bubble-sub-button-slider.inline .bubble-range-slider.fill-orientation-top,\n.bubble-sub-button-slider.inline .bubble-range-slider.fill-orientation-bottom {\n touch-action: pan-x pinch-zoom;\n}\n\n/* When touching or dragging any inline slider, block all touch actions */\n.bubble-sub-button-slider.inline.slider-container.is-touching,\n.bubble-sub-button-slider.inline.slider-container.is-dragging,\n.bubble-sub-button-slider.inline.slider-container.is-touching .bubble-range-slider,\n.bubble-sub-button-slider.inline.slider-container.is-dragging .bubble-range-slider,\n.bubble-sub-button-slider.inline .bubble-range-slider.is-touching {\n touch-action: none;\n}\n\n.bubble-sub-button-slider > .bubble-range-slider {\n overflow: visible; /* Fix a slight visual glitch when border-radius is applied to the slider */\n}\n\n.bubble-sub-button-slider.inline .bubble-range-value {\n height: var(--bubble-sub-slider-height, 36px);\n}\n\n/* Fade only group content when a group-owned slider is open */\n.bubble-sub-button-group.group-slider-open > *:not(.bubble-sub-slider-wrapper),\n.bubble-sub-button-group.group-slider-open > .bubble-sub-slider-wrapper.inline {\n opacity: 0;\n pointer-events: none;\n transition: opacity .2s ease;\n}\n\n.element-actions {\n display: flex;\n justify-content: flex-end;\n}\n\n/* Slider with button info container - same structure as normal sub-button */\n.bubble-sub-button-info-wrapper {\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n align-items: center;\n justify-content: flex-end;\n padding: 0 12px 0 12px;\n font-size: 12px;\n color: var(--primary-text-color);\n z-index: 1;\n pointer-events: none;\n min-width: 0;\n width: 100%;\n height: var(--bubble-sub-slider-height, 36px);\n position: relative;\n white-space: nowrap;\n}\n\n/* When with-button-info is active, use row-reverse for proper icon/name/value order */\n.bubble-sub-button-slider.inline.with-button-info .bubble-sub-button-info-wrapper {\n flex-direction: row-reverse;\n justify-content: flex-start;\n}\n\n/* When with-button-info is active, value should always be on the right (forced) */\n.bubble-sub-button-slider.inline.with-button-info .bubble-sub-button-info-wrapper .bubble-range-value.in-info-wrapper {\n margin-left: auto;\n}\n\n.bubble-sub-button-info-wrapper .bubble-sub-button-name-container {\n overflow: auto;\n min-width: 0;\n flex-shrink: 1;\n margin-right: 16px;\n}\n\n.bubble-sub-button-info-wrapper .bubble-sub-button-icon {\n flex-shrink: 0;\n}\n\n.bubble-sub-button-info-wrapper .bubble-sub-button-icon.icon-with-state {\n margin-right: 4px;\n}\n\n.bubble-sub-button-info-wrapper .bubble-sub-button-icon.icon-without-state {\n margin-right: 0;\n}\n\n.bubble-sub-button-info-wrapper .bubble-range-value.in-info-wrapper {\n position: static;\n transform: none;\n padding: 0;\n flex-shrink: 0;\n display: flex;\n opacity: 0.8;\n pointer-events: auto;\n}\n\n/* Respect value-position classes from rangeSlider (only when show_button_info is false) */\n.bubble-sub-button-slider.inline:not(.with-button-info):has(.bubble-range-slider.value-position-right) .bubble-sub-button-info-wrapper,\n.bubble-sub-button-slider.inline:not(.with-button-info):has(.bubble-range-slider.value-position-inline-end) .bubble-sub-button-info-wrapper {\n justify-content: flex-end;\n}\n\n.bubble-sub-button-slider.inline:not(.with-button-info):has(.bubble-range-slider.value-position-left) .bubble-sub-button-info-wrapper,\n.bubble-sub-button-slider.inline:not(.with-button-info):has(.bubble-range-slider.value-position-inline-start) .bubble-sub-button-info-wrapper {\n justify-content: flex-start;\n}\n\n.bubble-sub-button-slider.inline:not(.with-button-info):has(.bubble-range-slider.value-position-center) .bubble-sub-button-info-wrapper {\n justify-content: center;\n}\n\n/* Reset margin-left for all value positions except when with-button-info is active */\n.bubble-sub-button-slider.inline:not(.with-button-info) .bubble-sub-button-info-wrapper .bubble-range-value.in-info-wrapper {\n margin-left: 0;\n}\n\n/* Hidden value position works for both modes */\n.bubble-sub-button-slider.inline:has(.bubble-range-slider.value-position-hidden) .bubble-sub-button-info-wrapper .bubble-range-value.in-info-wrapper {\n display: none;\n}\n\n/* During drag: keep rangeValue visible, hide other info elements */\n.bubble-sub-button-slider.inline.is-dragging .bubble-range-value.in-info-wrapper,\n.bubble-sub-button-slider.inline.is-touching .bubble-range-value.in-info-wrapper {\n opacity: 1 !important;\n visibility: visible !important;\n}\n\n.bubble-sub-button-slider.inline.slider-hold-focus.is-dragging .bubble-sub-button-info-wrapper {\n opacity: 1;\n pointer-events: none;\n}\n\n.bubble-sub-button-slider.inline.slider-hold-focus.is-dragging .bubble-sub-button-info-wrapper .bubble-sub-button-name-container,\n.bubble-sub-button-slider.inline.slider-hold-focus.is-dragging .bubble-sub-button-info-wrapper .bubble-sub-button-icon {\n opacity: 0;\n}\n\n/* Ensure slider container has proper layout when info wrapper is present */\n.bubble-sub-button-slider.inline.has-info-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n}\n\n.bubble-sub-button-slider.inline.has-info-wrapper .bubble-range-slider {\n position: absolute;\n inset: 0;\n z-index: 0;\n}',l={start:1,center:2,fill:3,end:4},c="alignment-",d="bubble-sub-button-alignment-lane";function u(e,t={}){const{container:n=e.content,appendTo:i=n.firstChild?.firstChild,before:l=!1}=t;e.elements=e.elements||{},e.elements.groups=e.elements.groups||{};const c=(0,r.mg)(e.config),d=Array.isArray(c.main)?c.main:[],u=Array.isArray(c.bottom)?c.bottom:[],m=e.config?.sub_button?.main_layout??"inline",g=e.config?.sub_button?.bottom_layout??"inline";let y=e.elements.subButtonContainer;if(!y&&e.config.sub_button){y=(0,o.n)("div","bubble-sub-button-container");const t=(0,o.n)("style");t.textContent=s,y.appendChild(t),l&&i?i.prepend(y):i&&i.appendChild(y),e.elements.subButtonContainer=y,e.config.sub_button_justify_content&&y.style.setProperty("--bubble-sub-button-justify-content",e.config.sub_button_justify_content)}let v=e.elements.bottomSubButtonContainer;if(!v&&u.length>0){v=(0,o.n)("div","bubble-sub-button-bottom-container");const t=e.elements.cardWrapper||i;t&&t.appendChild(v),e.elements.bottomSubButtonContainer=v}else v&&0===u.length&&(v.remove(),delete e.elements.bottomSubButtonContainer,delete e.elements.bottomAlignmentLanes);(0,a.iJ)(e),v&&("inline"!==g?(function(e){const t=e.elements.bottomAlignmentLanes,n=e.elements.bottomSubButtonContainer;t&&n&&Object.keys(t).forEach(e=>{const o=t[e];if(o){for(;o.firstChild;){const e=o.firstChild;f(e),n.appendChild(e)}o.remove(),delete t[e]}})}(e),h(e,!1)):e.elements.bottomAlignmentLanes=e.elements.bottomAlignmentLanes||{});const _=d.map((e,t)=>({key:`g_main_${t}`,item:e,idx:t,position:"top"})).filter(({item:e})=>e&&Array.isArray(e.group)&&e.group.length>0),w=u.map((e,t)=>({key:`g_bottom_${t}`,item:e,idx:t,position:"bottom"})).filter(({item:e})=>e&&Array.isArray(e.group)&&e.group.length>0),x=[..._,...w],k=d.filter(e=>e&&!Array.isArray(e.group)),C=_.length>0,$="rows"===m||C||u.length>0;k.length>0&&$&&x.push({key:"g_main_auto",item:{group:k,buttons_layout:"inline"},idx:-1,position:"top"});const S=u.filter(e=>e&&!Array.isArray(e.group)),A=u.filter(e=>e&&Array.isArray(e.group)&&e.group.length>0);if(S.length>0&&(A.length>0?S.forEach((e,t)=>{x.push({key:`g_bottom_individual_${t}`,item:{group:[e],buttons_layout:"inline"},idx:-1,position:"bottom"})}):x.push({key:"g_bottom_auto",item:{group:S,buttons_layout:"inline"},idx:-1,position:"bottom"})),x.length>0){const t=new Set(x.map(({key:e})=>e));Object.keys(e.elements.groups).forEach(n=>{if((n.startsWith("g_main_")||n.startsWith("g_bottom_"))&&!t.has(n)&&e.elements.groups[n]?.container){const t=e.elements.groups[n].container;f(t),t.remove(),delete e.elements.groups[n]}}),x.forEach(({item:t,key:n,position:i})=>{e.elements.groups[n]||(e.elements.groups[n]={});const a="bottom"===i?g:m,r="bottom"===i?function(e){if(!e)return"fill";const t=String(e).toLowerCase().trim();return"fill"===t?"fill":["start","flex-start","left"].includes(t)?"start":["end","flex-end","right"].includes(t)?"end":"center"===t?"center":(["space-between","space-around","space-evenly","stretch"].includes(t),"fill")}(t.justify_content):null,s=e.elements.groups[n].alignmentKey;if(e.elements.groups[n].container){const o=e.elements.groups[n].container,l=o.className.match(/position-(\w+)/);l&&l[1]!==i&&(f(o),o.classList.remove(`position-${l[1]}`),o.classList.add(`position-${i}`));const c=o.className.match(/display-(\w+)/);c&&c[1]!==(t.buttons_layout||"inline")&&(o.classList.remove(`display-${c[1]}`),o.classList.add(`display-${t.buttons_layout||"inline"}`));const d=o.className.match(/group-layout-(\w+)/);d&&d[1]!==a&&(o.classList.remove(`group-layout-${d[1]}`),o.classList.add(`group-layout-${a}`)),o.style.setProperty("--bubble-sub-button-group-justify-content",t.justify_content||"end"),"bottom"===i&&s!==r&&b(o,r),p(e,o,i,a,r),e.elements.groups[n].alignmentKey=r}else{const s=(0,o.n)("div",`bubble-sub-button-group position-${i} display-${t.buttons_layout||"inline"} group-layout-${a}`);s.setAttribute("data-group-id",n),t.justify_content&&s.style.setProperty("--bubble-sub-button-group-justify-content",t.justify_content),"bottom"===i&&b(s,r),p(e,s,i,a,r),e.elements.groups[n].container=s,e.elements.groups[n].alignmentKey=r}}),v&&"inline"===g&&(function(e){const t=e.elements.bottomAlignmentLanes;t&&Object.keys(t).forEach(e=>{const n=t[e];n&&0===n.childElementCount&&(n.remove(),delete t[e])})}(e),h(e,!0)),function(e){const t=e?.elements?.bottomSubButtonContainer,n=e?.elements?.subButtonContainer,o=e.config?.sub_button?.main_layout??"inline",i=e.config?.sub_button?.bottom_layout??"inline";t&&(t.classList.remove("groups-layout-rows","groups-layout-inline"),t.classList.add("rows"===i?"groups-layout-rows":"groups-layout-inline")),n&&(n.classList.remove("groups-layout-rows","groups-layout-inline"),n.classList.add("rows"===o?"groups-layout-rows":"groups-layout-inline"))}(e)}return(0,a.iJ)(e),y}function p(e,t,n,i,a){if("bottom"===n)return void function(e,t,n,i){const a=e.elements.bottomSubButtonContainer;if(!a)return;if("inline"!==n)return f(t),void(t.parentElement!==a&&a.appendChild(t));const r=function(e,t){const n=e.elements.bottomSubButtonContainer;if(!n)return null;e.elements.bottomAlignmentLanes=e.elements.bottomAlignmentLanes||{};let i=e.elements.bottomAlignmentLanes[t];return i?i.isConnected||n.appendChild(i):(i=(0,o.n)("div",`bubble-sub-button-alignment-lane lane-${t}`),i.dataset.lane=t,i.style.order=`${l[t]??l.fill}`,e.elements.bottomAlignmentLanes[t]=i,n.appendChild(i)),i}(e,i||"fill");r&&t.parentElement!==r&&r.appendChild(t),g(t,!1)}(e,t,i,a);const r=e.elements.subButtonContainer;r&&t.parentElement!==r&&r.appendChild(t)}function b(e,t){if(!e)return;["start","center","fill","end"].forEach(t=>{e.classList.remove(`${c}${t}`)});const n=t||"fill";e.classList.add(`${c}${n}`)}function h(e,t){const n=e.elements.bottomSubButtonContainer;if(!n)return;const o=t&&function(e){const t=e.elements.bottomAlignmentLanes;return!!t&&Object.keys(t).length>0}(e);o?n.classList.add("alignment-lanes-active"):n.classList.remove("alignment-lanes-active")}function m(e){if(!e||!e.parentElement)return null;const t=e.parentElement;return t.classList&&t.classList.contains(d)?t:null}function g(e,t){const n=m(e);if(n){if(null===t)try{delete e.dataset.laneNeedsFill}catch(e){}else e.dataset.laneNeedsFill=t?"true":"false";v(n)}}function f(e){e?.classList?.remove("alignment-fill-auto"),g(e,null)}function y(e){const t=m(e);if(!t)return;const n=e.classList.contains(`${c}fill`)||!!e.querySelector(".bubble-sub-slider-wrapper.inline.fill-width, .bubble-sub-button-slider.inline.fill-width, .bubble-sub-button.fill-width"),o=e.classList.contains(`${c}fill`),i=n&&!o;e.classList.toggle("alignment-fill-auto",i),e.dataset.laneNeedsFill=n?"true":"false",v(t)}function v(e){e&&(e.classList.contains("lane-fill")||e.classList.contains("lane-center")||Array.from(e.children||[]).some(e=>"true"===e?.dataset?.laneNeedsFill)?e.classList.add("lane-expand"):e.classList.remove("lane-expand"))}function _(e){return e&&"string"==typeof e?e.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""):null}function w(e,t,n,a,s,l,c,d={}){e.elements.subButtonContainer||c||u(e);const{attachToDom:p=!0}=d,b=["bubble-sub-button",`bubble-sub-button-${String(t).replace(/_/g,"-")}`];if(l?.name){const e=_(l.name);e&&b.push(e)}const h=(0,o.n)("div",b.join(" "));h.nameContainer=(0,o.n)("div","bubble-sub-button-name-container"),h.feedbackContainer=(0,o.n)("div","bubble-feedback-container"),h.feedback=(0,o.n)("div","bubble-feedback-element feedback-element"),h.appendChild(h.feedbackContainer),h.feedbackContainer.appendChild(h.feedback),n&&(h.classList.add("is-select"),(0,i.Fi)(e,h,a),h.dropdownContainer.style.display="none",(0,i.XO)(e,h,s,l)),(0,r.gQ)(h,l);const m=c&&c.classList&&c.classList.contains("bubble-sub-button-group");return(0,r.L)(h,l,"main",m?c:null),(0,r.uH)(h,l),l.content_layout&&h.classList.add(`content-${l.content_layout}`),h.appendChild(h.nameContainer),c?p&&c.appendChild(h):(p&&e.elements.subButtonContainer.appendChild(h),e.elements[t]=h),h}},397:(e,t,n)=>{n.d(t,{Ac:()=>d,Hs:()=>l,generateYamlExport:()=>s,lW:()=>c});var o=n(382),i=n(241),a=n(937);function r(e){const{id:t,name:n,version:o,creator:i,link:r,supported:s,description:l,code:c,editor:d,is_global:u}={...e},p=(0,a.n$)().map(e=>e.id);let b=s;s&&Array.isArray(s)&&s.length===p.length&&p.every(e=>s.includes(e))&&(b=void 0);const h={name:n,version:o,creator:i,link:r,supported:b,description:l,code:c,editor:d};return!0===u&&(h.is_global=!0),Object.keys(h).forEach(e=>{const t=h[e];(null==t||"link"===e&&""===t)&&delete h[e]}),{id:t,cleanData:h}}function s(e){try{const{id:t,cleanData:n}=r(e),i={[t]:n};return o.Ay.dump(i,{indent:2,lineWidth:-1,noRefs:!0,noCompatMode:!0,sortKeys:!1})}catch(e){return console.error("Error generating YAML export:",e),"# Error generating YAML export"}}function l(e){try{const{id:t,cleanData:n}=r(e),{name:i,version:s,creator:l,description:c,code:d,editor:u,supported:p}=n,b=(0,a.n$)().map(e=>e.id),h=!p||Array.isArray(p)&&p.length===b.length&&b.every(e=>p.includes(e));let m=`# ${i}\n\n`;if(m+=`**Version:** ${s} \n`,m+=`**Creator:** ${l}\n\n`,m+="> [!IMPORTANT] \n",m+="> **Supported cards:**\n",h?m+="> - All cards are supported\n":p&&p.length>0&&p.forEach(e=>{m+=`> - ${e.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}\n`}),m+="\n",c&&(m+=`${c}\n`,m+="Configure this module via the editor or in YAML, for example:\n\n"),m+="```yaml\n",m+=`${t}: \n`,u&&Array.isArray(u)&&u.length>0){const e=u[0];e&&e.name&&(m+=` ${e.name}: YOUR_VALUE\n`)}else m+=" # Your configuration here\n";if(m+="```\n\n",m+="---\n\n",m+="
\n\n",m+="🧩 Get this Module\n\n",m+="
\n\n",m+=`> To use this module, simply install it from the Module Store (from the editor of any card > Modules), or copy and paste the following configuration into a \`/www/bubble/modules/${t}.yaml\` file.\n\n`,m+="```yaml\n",m+=`${t}:\n`,m+=` name: "${i}"\n`,m+=` version: "${s}"\n`,m+=` creator: "${l}"\n`,m+=' link: "https://github.com/Clooos/Bubble-Card/discussions/XXXX"\n\n',p&&p.length>0&&!h&&(m+=" supported:\n",p.forEach(e=>{m+=` - ${e}\n`}),m+="\n"),m+=" description: |\n",c){const e=c.split("\n").map(e=>` ${e}`).join("\n");if(m+=`${e}\n`,m+="

\n",m+="
\n",m+=`        ${t}: \n`,u&&Array.isArray(u)&&u.length>0){const e=u[0];e&&e.name?m+=`            ${e.name}: YOUR_VALUE\n`:m+="            # Your configuration here\n"}else m+="            # Your configuration here\n";m+="        
\n\n"}if(m+=" code: |\n",d){const e=d.split("\n").map(e=>` ${e}`).join("\n");m+=`${e}\n\n`}else m+=" # Your code here\n\n";if(u){const e="object"==typeof u?o.Ay.dump(u,{indent:2}):u;m+=" editor:\n";const t=e.split("\n").map(e=>` ${e}`).join("\n");m+=`${t}`,m+="\n```"}else m+="```";return m+="\n\n
\n\n",m+="---\n\n",m+="### Screenshot:\n\n",m+="Important: The first screenshot here will be used on the Module Store, so please provide one.\n",m}catch(e){return console.error("Error generating GitHub export:",e),"# Error generating GitHub export format"}}function c(e,t,n,o){try{const a=document.createElement("textarea");a.value=t,a.style.position="fixed",a.style.opacity="0",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a),(0,i.qk)(e,n,"success"),"function"==typeof o&&o(t)}catch(n){console.error("Clipboard copy failed:",n),(0,i.qk)(e,"Could not copy to clipboard. Please copy manually from the preview below.","error"),"function"==typeof o&&o(t)}}function d(e,t,n){try{const o=s(t),a=new Blob([o],{type:"text/yaml"}),r=URL.createObjectURL(a),l=document.createElement("a");return l.href=r,l.download=`${t.id}.yaml`,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(r),(0,i.qk)(e,"Module downloaded as YAML file!","success"),"function"==typeof n&&n(o),!0}catch(t){return console.error("Error downloading module:",t),(0,i.qk)(e,"Error downloading module: "+t.message,"error"),!1}}},459:(e,t,n)=>{n.d(t,{P9:()=>d,VM:()=>u,zU:()=>p});var o=n(716),i=n(388),a=n(371);function r(e,t){if(!e||!e.elements)return;if(e.dragging)return;const n=e.config.entity?.split?.(".")[0],o=e?.config?.light_slider_type||"brightness",i="light"===n&&["hue","saturation","white_temp"].includes(o),r=(0,a.QN)(Math.round(t)),s=function(e){try{if(Number.isFinite(e._lastVisualFillPercentage))return(0,a.el)(e,e._lastVisualFillPercentage);if(e.elements?.rangeFill){const t=function(e){const t=/translate([XY])\(([-\d.]+)%\)/.exec(e||"");if(!t)return null;const[,n,o]=t,i=parseFloat(o);return Number.isFinite(i)?{axis:n,value:i}:null}(e.elements.rangeFill.style.transform);if(t){const n=(0,a.oR)(e),o="top"===n||"bottom"===n?"Y":"X";if(t.axis===o)return(0,a.el)(e,Math.abs(t.value))}}}catch(e){}try{return Math.round((0,a.uo)(e,e.config.entity))}catch(e){return 0}}(e);if(!Number.isFinite(s)||Math.abs(s-r)<.5){if(d(r),u(r,!0),i&&("hue"===o||"saturation"===o)&&"function"==typeof e.updateColorTrackBackground)try{e.updateColorTrackBackground()}catch(e){}return}try{e._sliderAnimRaf&&cancelAnimationFrame(e._sliderAnimRaf)}catch(e){}const l=performance.now(),c=t=>{if(e.dragging)return;const n=Math.min(1,(t-l)/250),a=s+(r-s)*(e=>1-Math.pow(1-e,3))(n);if(d(a),u(a),n<1)e._sliderAnimRaf=requestAnimationFrame(c);else{if(d(r),u(r,!0),i&&("hue"===o||"saturation"===o)&&"function"==typeof e.updateColorTrackBackground)try{e.updateColorTrackBackground()}catch(e){}try{e._sliderAnimRaf=null}catch(e){}}};function d(t){const n=Math.round((0,a.QN)(t));try{if(i&&"function"==typeof e.setColorCursorPosition&&(e.setColorCursorPosition(n),"function"==typeof e.updateColorCursorIndicator))try{e.updateColorCursorIndicator(n)}catch(e){}(0,a.lt)(e,n)}catch(e){}}function u(t,n=!1){if(e.elements?.rangeValue)try{const o=n?(0,a.aJ)(e):(0,a.BG)(e,(0,a.QN)(t));e.elements.rangeValue.textContent!==o&&(e.elements.rangeValue.textContent=o)}catch(e){}}e._sliderAnimRaf=requestAnimationFrame(c)}let s=0,l=!1;function c(){s++,l=!1}function d(e,t,n=!1,o=null){let i=o;i||(e._sliderRectCache&&e._sliderRectCache.frameId===s?i=e._sliderRectCache.rect:(i=e.elements.rangeSlider.getBoundingClientRect(),e._sliderRectCache||(e._sliderRectCache={}),e._sliderRectCache.rect=i,e._sliderRectCache.frameId=s,l||(requestAnimationFrame(c),l=!0)));const r=(0,a.oR)(e),d="top"===r||"bottom"===r,u=d?i?.height??0:i?.width??0;if(u<=0)return(0,a.QN)((0,a.uo)(e,e.config.entity));let p=(t-(d?i.top:i.left))/u*100;p=(0,a.QN)(p),"right"!==r&&"bottom"!==r||(p=100-p);let b=(0,a.el)(e,p);const h=e.config.entity?.split(".")[0];return"light"!==h||!1!==e.config.tap_to_slide&&void 0!==e.config.tap_to_slide||!0===e.config.allow_light_slider_to_0||b<1&&(b=1),b=(0,a.QN)(b),(0,a.lt)(e,b),b}function u(e,t=e.elements.rangeFill,n=e.config.entity){if(e.dragging)return;const s=(0,a.uo)(e,n),l=e._lastSliderPercentage;if(function(e){if(!e.elements?.rangeFill)return;const t=e.config.entity?.split(".")[0],n="light"===t,a=(0,o.$C)(e,e.config.entity),r=n&&"brightness"===(e?.config?.light_slider_type||"brightness"),s=e.config.use_accent_color,l=e._hass?.states?.[e.config.entity],c=(0,i.S1)(l,e.config.entity);e._previousSliderColorSignature,e._previousSliderColorSignature=c;const d=e.elements.rangeFill,u=d.classList.contains("slider-use-light-color"),p=d.classList.contains("slider-use-accent-color"),b=Date.now();if(e._lastSliderStyleChange,e._lastSliderStyleChange=b,a)if(r&&!s){const t="button"===e.config.card_type?e.card?.style.getPropertyValue("--bubble-button-background-color"):e.popUp?.style.getPropertyValue("--bubble-button-background-color"),n=(0,o.C$)(e,e.config.entity,!0,t||null,null);u||(d.classList.remove("slider-use-accent-color"),d.classList.add("slider-use-light-color")),d.style.setProperty("--bubble-slider-fill-color",n)}else p||(d.classList.remove("slider-use-light-color"),d.style.removeProperty("--bubble-slider-fill-color"),d.classList.add("slider-use-accent-color"));else(u||p)&&(d.classList.remove("slider-use-light-color","slider-use-accent-color"),d.style.removeProperty("--bubble-slider-fill-color"));if("function"==typeof e.syncSliderValuePosition)try{e.syncSliderValuePosition()}catch(e){}}(e),void 0!==l&&Math.abs(l-s)<.01)return;e._lastSliderPercentage=s;const c=n?.split?.(".")[0];if("light"===c&&["hue","saturation","white_temp"].includes(e?.config?.light_slider_type||"brightness")&&e.elements?.colorCursor)return void r(e,s);const d=void 0===l,u=void 0!==l&&Math.abs(l-s)>5;if(d||u){const t=Math.round((0,a.QN)(s));try{if((0,a.lt)(e,t),e.elements?.rangeValue){const t=(0,a.aJ)(e);e.elements.rangeValue.textContent!==t&&(e.elements.rangeValue.textContent=t)}}catch(e){}}else r(e,s)}function p(e,t){const n=e._hass.states[e.config.entity];if(!n)return;const i=e.config.entity.split(".")[0],r=(0,a.nZ)(e,n),s=(0,a.BJ)(e,n),l=(0,a.et)(e,n);let c=(0,a.lY)(t,r,s),d=(0,a.y$)(c,l);d=Math.max(r,Math.min(s,d));const u=s-r,p=u>0?(0,a.QN)((d-r)/u*100):0;switch(i){case"light":{const n=e?.config?.light_slider_type||"brightness";if("hue"===n||"saturation"===n){const t=e._hass.states[e.config.entity]?.attributes?.hs_color||[],o=parseFloat(t[0])||0,i=parseFloat(t[1])||0,a="hue"===n?Math.round(p/100*360):o,r=10,s=!0===e.config?.hue_force_saturation,l=Number(e.config?.hue_force_saturation_value),c=Number.isFinite(l)?Math.max(0,Math.min(100,l)):100,d="saturation"===n?Math.round(p):s?c:i{e._hass.callService("climate","set_temperature",{entity_id:e.config.entity,temperature:t})}).catch(n=>{console.error("Error turning on climate entity:",n),e._hass.callService("climate","set_temperature",{entity_id:e.config.entity,temperature:t})});break}case"number":e._hass.callService("number","set_value",{entity_id:e.config.entity,value:d})}}},531:(e,t,n)=>{function o(e,t,n,o){function i(e){const t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}switch(n){case"fan_modes":return e._hass.formatEntityAttributeValue(t,"fan_mode",o);case"hvac_modes":return e._hass.formatEntityState(t,o);case"swing_modes":return e._hass.formatEntityAttributeValue(t,"swing_mode",o);case"preset_modes":return e._hass.formatEntityAttributeValue(t,"preset_mode",o);default:return i(e._hass.formatEntityState(t,o))??i(o)}}function i(e,t){switch(t){case"fan_modes":return e.attributes.fan_mode||null;case"swing_modes":return e.attributes.swing_mode||null;case"preset_modes":return e.attributes.preset_mode||null;case"effect_list":return e.attributes.effect||null;case"source_list":return e.attributes.source||null;case"sound_mode_list":return e.attributes.sound_mode||null;default:return e.state}}function a(e,t,n,o){let i;switch(n){case"hvac_modes":i=document.createElement("ha-icon"),i.slot="graphic",i.icon=function(e){switch(e){case"auto":return"mdi:thermostat-auto";case"cool":return"mdi:snowflake";case"heat":return"mdi:fire";case"heat_cool":return"mdi:sun-snowflake-variant";case"dry":return"mdi:water-percent";case"fan_only":default:return"mdi:fan";case"off":return"mdi:power"}}(o);break;case"fan_modes":if(!t.attributes.fan_modes)return null;i=document.createElement("ha-attribute-icon"),i.slot="graphic",i.attribute="fan_mode",i.attributeValue=o,i.hass=e._hass,i.stateObj=t;break;case"swing_modes":i=document.createElement("ha-attribute-icon"),i.slot="graphic",i.attribute="swing_mode",i.attributeValue=o,i.hass=e._hass,i.stateObj=t;break;case"preset_modes":i=document.createElement("ha-attribute-icon"),i.slot="graphic",i.attribute="preset_mode",i.attributeValue=o,i.hass=e._hass,i.stateObj=t;break;default:i=!1}return i}function r(e,t,n,o){const i=t?.split(".")[0];switch(i){case"input_select":e._hass.callService("input_select","select_option",{entity_id:t,option:n});break;case"select":e._hass.callService("select","select_option",{entity_id:t,option:n});break;case"climate":switch(o.select_attribute){case"hvac_modes":e._hass.callService("climate","set_hvac_mode",{entity_id:t,hvac_mode:n});break;case"fan_modes":e._hass.callService("climate","set_fan_mode",{entity_id:t,fan_mode:n});break;case"swing_modes":e._hass.callService("climate","set_swing_mode",{entity_id:t,swing_mode:n});break;case"preset_modes":e._hass.callService("climate","set_preset_mode",{entity_id:t,preset_mode:n})}break;case"fan":"preset_modes"===o.select_attribute&&e._hass.callService("fan","set_preset_mode",{entity_id:t,preset_mode:n});break;case"light":"effect_list"===o.select_attribute&&e._hass.callService("light","turn_on",{entity_id:t,effect:n});break;case"media_player":switch(o.select_attribute){case"source_list":e._hass.callService("media_player","select_source",{entity_id:t,source:n});break;case"sound_mode_list":e._hass.callService("media_player","select_sound_mode",{entity_id:t,sound_mode:n})}break;default:console.warn(`Unsupported entity type: ${i}`)}}n.d(t,{Ab:()=>r,PW:()=>o,aX:()=>i,z_:()=>a})},642:(e,t,n)=>{n.d(t,{VR:()=>u,Xs:()=>g,dN:()=>p,pd:()=>m});var o=n(716);let i;window.isScrolling=!1;let a=!1;function r(){i&&(i.style.transform="translate(-50%, -50%) scale(0)",setTimeout(()=>{i&&(i.style.display="none")},180))}function s(){window.isScrolling=!0,setTimeout(()=>{window.isScrolling=!1},300)}window.__bubbleTapActionsInitialized||(document.addEventListener("scroll",s,{passive:!0}),document.addEventListener("contextmenu",function(e){const t=e.composedPath().find(e=>e.classList?.contains("bubble-action"));if(t&&t.dataset.holdAction)try{"none"!==JSON.parse(t.dataset.holdAction).action&&(e.preventDefault(),e.stopPropagation())}catch(e){}}),document.body.addEventListener("pointerdown",d,{passive:!0}),document.body.addEventListener("touchstart",d,{passive:!0}),window.__bubbleTapActionsInitialized=!0);const l=new WeakMap,c=new Set;function d(e){if(window.isScrolling)return;if(e.touches&&e.touches.length>1||"touch"===e.pointerType&&!1===e.isPrimary)return;const t=e.composedPath().find(e=>e.classList?.contains("bubble-action"));if(e.composedPath().find(e=>e.classList?.contains("close-pop-up")||e.classList?.contains("bubble-close-button")))return;if(!t)return;let n=l.get(t);if(n)n.resetState();else{const e={tap_action:JSON.parse(t.dataset.tapAction),double_tap_action:JSON.parse(t.dataset.doubleTapAction),hold_action:JSON.parse(t.dataset.holdAction),entity:t.dataset.entity};n=new b(t,e,h),l.set(t,n)}try{"pointerdown"===e.type&&t.haRipple&&"function"==typeof t.haRipple.startPress&&t.haRipple.startPress(e)}catch(e){}if(n.handleStart(e),!n.isInteractionInProgress())return;c.add(n);const o=e=>{"none"!==(n.config.hold_action||{action:"none"}).action&&(e.preventDefault(),e.stopPropagation())},i=()=>{t.removeEventListener("pointerup",a),t.removeEventListener("pointercancel",a),t.removeEventListener("touchend",a),t.removeEventListener("touchcancel",a),t.removeEventListener("contextmenu",o),document.removeEventListener("pointerup",a),document.removeEventListener("touchend",a),document.removeEventListener("scroll",r);try{t.haRipple&&"function"==typeof t.haRipple.endPress&&t.haRipple.endPress()}catch(e){}c.delete(n)},a=e=>{n.handleEnd(e),i()},r=()=>{n.handleScroll(),i()};t.addEventListener("pointerup",a,{once:!0}),t.addEventListener("pointercancel",a,{once:!0}),t.addEventListener("touchend",a,{once:!0}),t.addEventListener("touchcancel",a,{once:!0}),t.addEventListener("contextmenu",o),document.addEventListener("pointerup",a,{once:!0}),document.addEventListener("touchend",a,{once:!0}),document.addEventListener("scroll",r,{once:!0})}function u(e,t,n){const o=new Event("hass-action",{bubbles:!0,composed:!0}),i={...t};i.entity&&!i.entity_id&&(i.entity_id=i.entity),"tap"===n||"double_tap"===n||"hold"===n?o.detail={config:i,action:n}:(e.modifiedConfig={...i,tap_action:{...i[n]}},delete e.modifiedConfig[n],o.detail={config:e.modifiedConfig,action:"tap"}),e.dispatchEvent(o)}function p(e,t,n,i={}){e.classList.add("bubble-action");const a=t?.tap_action||i?.tap_action||{action:"none"},r=t?.double_tap_action||i?.double_tap_action||{action:"none"},s=t?.hold_action||i?.hold_action||{action:"none"};e.dataset.entity=t?.entity||n,e.dataset.tapAction=JSON.stringify(a),e.dataset.doubleTapAction=JSON.stringify(r),e.dataset.holdAction=JSON.stringify(s);const l="none"!==a.action||"none"!==r.action||"none"!==s.action;return l&&(e.classList.add("bubble-action-enabled"),e.haRipple=(0,o.n)("ha-ripple"),e.appendChild(e.haRipple)),{tap_action:a,double_tap_action:r,hold_action:s,has_action:l}}class b{constructor(e,t,n){this.element=e,this.config=t,this.sendActionEvent=n,this.tapTimeout=null,this.holdTimeout=null,this.startX=0,this.startY=0,this.lastX=0,this.lastY=0,this.holdFired=!1,this.pointerMoveListener=this.detectScrollLikeMove.bind(this),this.touchMoveListener=this.detectScrollLikeMove.bind(this),this.isDisconnected=!1,this.hasMoved=!1,this.interactionStarted=!1,this.justEndedTouchEventTime=0,this.currentInteractionType=null,this.interactionStartTime=0,this.preventDefaultCalled=!1}isInteractionInProgress(){return this.interactionStarted}resetState(){clearTimeout(this.tapTimeout),clearTimeout(this.holdTimeout),document.removeEventListener("pointermove",this.pointerMoveListener),document.removeEventListener("touchmove",this.touchMoveListener),this.tapTimeout=null,this.holdTimeout=null,this.holdFired=!1,this.hasMoved=!1,this.interactionStarted=!1,this.isDisconnected=!1,this.justEndedTouchEventTime=0,this.currentInteractionType=null,this.interactionStartTime=0,this.preventDefaultCalled=!1,this.startX=0,this.startY=0,this.lastX=0,this.lastY=0}cleanup(){this.isDisconnected=!0,clearTimeout(this.tapTimeout),clearTimeout(this.holdTimeout),document.removeEventListener("pointermove",this.pointerMoveListener),document.removeEventListener("touchmove",this.touchMoveListener),this.tapTimeout=null,this.holdTimeout=null,this.interactionStarted=!1}handleStart(e){const t=Date.now();"pointerdown"===e.type&&t-this.justEndedTouchEventTime<50||window.isScrolling||this.isDisconnected||(this.interactionStarted?"touchstart"===e.type&&"pointerdown"===this.currentInteractionType&&this.interactionStartTime:(this.interactionStarted=!0,this.currentInteractionType=e.type,this.interactionStartTime=t,e.touches&&e.touches.length>1?this.interactionStarted=!1:(this.holdFired=!1,this.hasMoved=!1,e.touches&&e.touches[0]?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY,this.lastX=this.startX,this.lastY=this.startY):(this.startX=e.clientX,this.startY=e.clientY,this.lastX=this.startX,this.lastY=this.startY),document.addEventListener("pointermove",this.pointerMoveListener,{passive:!0}),document.addEventListener("touchmove",this.touchMoveListener,{passive:!0}),this.holdTimeout=setTimeout(()=>{if("none"!==(this.config.hold_action||{action:"none"}).action&&!window.isScrolling){const e=Math.abs(this.lastX-this.startX),t=Math.abs(this.lastY-this.startY);if(Math.sqrt(e*e+t*t)<=15){this.holdFired=!0;const e="touchstart"===this.currentInteractionType;!function(e,t,n){const o=function(e){if(!i){const e=document.createElement("div");i=e,document.body.appendChild(e)}const t=e?100:50;return Object.assign(i.style,{position:"fixed",width:`${t}px`,height:`${t}px`,transform:"translate(-50%, -50%) scale(0)",pointerEvents:"none",zIndex:"999",background:"var(--primary-color)",display:"none",opacity:"0.4",borderRadius:"50%",transition:"transform 180ms ease-in-out"}),a||(["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll","pointercancel"].forEach(e=>{document.addEventListener(e,()=>{r()},{passive:!0})}),a=!0),i}(n),s=n?100:50;o.style.width=`${s}px`,o.style.height=`${s}px`,o.style.left=`${Math.round(e)}px`,o.style.top=`${Math.round(t)}px`,o.style.display="block",o.offsetWidth,o.style.transform="translate(-50%, -50%) scale(1)"}(this.startX,this.startY,e)}}},500))))}detectScrollLikeMove(e){let t,n;e.touches&&e.touches[0]?(t=e.touches[0].clientX,n=e.touches[0].clientY):(t=e.clientX,n=e.clientY),this.lastX=t,this.lastY=n;const o=Math.abs(t-this.startX),i=Math.abs(n-this.startY),a=Math.sqrt(o*o+i*i);(o>5||i>5)&&(this.hasMoved=!0,s(),a>15&&(clearTimeout(this.holdTimeout),this.holdTimeout=null,document.removeEventListener("pointermove",this.pointerMoveListener),document.removeEventListener("touchmove",this.touchMoveListener)))}handleEnd(e){if("touchend"!==e.type&&"touchcancel"!==e.type||(this.justEndedTouchEventTime=Date.now()),!this.interactionStarted)return;let t,n;e.changedTouches&&e.changedTouches[0]?(t=e.changedTouches[0].clientX,n=e.changedTouches[0].clientY):(t=e.clientX,n=e.clientY);const o=Math.abs(t-this.startX),i=Math.abs(n-this.startY),a=Math.sqrt(o*o+i*i),s=this.holdFired&&a<=15;if(window.isScrolling||this.isDisconnected||this.hasMoved&&!s)return this.interactionStarted=!1,void r();clearTimeout(this.holdTimeout),this.holdTimeout=null,document.removeEventListener("pointermove",this.pointerMoveListener),document.removeEventListener("touchmove",this.touchMoveListener);const l=this.holdFired,c=Date.now(),d=this.config.double_tap_action||{action:"none"},u=this.config.tap_action||{action:"none"};let p=!1;if(l?this.sendActionEvent(this.element,this.config,"hold"):this.lastTap&&c-this.lastTap<200&&"none"!==d.action?(clearTimeout(this.tapTimeout),this.sendActionEvent(this.element,this.config,"double_tap"),p=!0):"none"!==u.action&&("none"!==d.action?(this.tapTimeout=setTimeout(()=>{this.isDisconnected||this.holdFired||this.hasMoved||this.sendActionEvent(this.element,this.config,"tap")},200),p=!0):(this.sendActionEvent(this.element,this.config,"tap"),p=!0)),p||l){e.cancelable&&e.preventDefault();const t=e=>{const t=e.composedPath().find(e=>e.classList&&e.classList.contains("bubble-pop-up"));let n=!0;t&&"true"===t.dataset.closeOnClick&&(n=!1),n&&e.stopPropagation(),l&&e.preventDefault()};document.body.addEventListener("click",t,{capture:!0,once:!0}),setTimeout(()=>{document.body.removeEventListener("click",t,{capture:!0})},350)}this.lastTap=c,this.interactionStarted=!1,r()}handleScroll(){this.hasMoved=!0,clearTimeout(this.holdTimeout),this.holdTimeout=null,document.removeEventListener("pointermove",this.pointerMoveListener),document.removeEventListener("touchmove",this.touchMoveListener),this.interactionStarted=!1}}function h(e,t,n){const o=t.tap_action||{action:"more-info"},i=t.double_tap_action||{action:"none"},a=t.hold_action||{action:"none"},r=t.entity||this.config?.entity,s=e=>e.service&&"entity"===e.target?.entity_id&&r?{...e,target:{...e.target,entity_id:r}}:e,l=s(o),c=s(i),d=s(a);let p;switch(n){case"tap":default:p=l;break;case"double_tap":p=c;break;case"hold":p=d}u(e,{entity:r,tap_action:l,double_tap_action:c,hold_action:d},n)}function m(e,t){e.addEventListener("pointerup",e=>{e.cancelable&&e.preventDefault(),(0,o.jp)("selection")})}function g(){for(const e of c)e.cleanup();c.clear()}},653:(e,t,n)=>{n.d(t,{N0:()=>d,KQ:()=>p,iJ:()=>u.iJ});var o=n(716),i=n(642),a=n(345),r=n(391);n(772);var s=n(175);const l="/* 'card-type' in CSS variables is replaced with the real card type \n in card-structure.js for easier maintenance */\n\n* {\n -webkit-tap-highlight-color: transparent !important;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n\n -webkit-user-select: none; /* Safari */\n -ms-user-select: none; /* IE 10 and IE 11 */\n user-select: none; /* Standard syntax */\n}\n\n*::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n}\n\nha-card {\n background: none;\n opacity: 1;\n}\n\n.scrolling-container {\n width: 100%;\n white-space: nowrap;\n mask-image: linear-gradient(to right, transparent, black 8px, black calc(100% - 8px), transparent);\n -webkit-mask-image: linear-gradient(to right, transparent, black 8px, black calc(100% - 8px), transparent);\n overflow: hidden;\n}\n\n.scrolling-container span {\n display: inline-block;\n animation-name: bubble-scroll;\n animation-timing-function: linear;\n animation-iteration-count: infinite;\n}\n\n.bubble-scroll-separator {\n opacity: .3;\n margin: 0 6px 0 8px;\n}\n\n@keyframes bubble-scroll {\n from { transform: translateX(0); }\n to { transform: translateX(-50%); }\n}\n/* End of scrolling styles */\n\n.bubble-container {\n position: relative;\n width: 100%;\n height: 50px;\n background-color: var(--bubble-card-type-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n border-radius: var(--bubble-card-type-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n box-shadow: var(--bubble-card-type-box-shadow, var(--bubble-box-shadow, none));\n overflow: scroll;\n touch-action: auto;\n border: var(--bubble-card-type-border, var(--bubble-border, none));\n box-sizing: border-box;\n}\n\n.bubble-wrapper {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n transition: all 1.5s;\n border-radius: var(--bubble-card-type-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n background-color: rgba(0,0,0,0);\n overflow: visible;\n /* z-index: 1; */\n}\n\n.bubble-wrapper.fixed-top {\n align-items: baseline;\n}\n\n.bubble-content-container {\n display: contents;\n}\n\n.bubble-wrapper.fixed-top .bubble-content-container {\n display: flex;\n align-items: center;\n align-self: flex-start;\n overflow: hidden;\n flex-grow: 1;\n margin-top: 1px;\n min-height: 54px;\n}\n\n.bubble-content-container.fixed-bottom {\n display: flex;\n align-self: flex-end;\n}\n\n.bubble-buttons-container {\n --icon-primary-color: var(--primary-text-color);\n display: flex;\n margin-right: 8px;\n gap: 4px;\n}\n\n.fixed-top .bubble-buttons-container {\n margin-top: 10px;\n}\n\n.bubble-buttons-container.bottom-fixed {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 8px;\n padding: 0 8px;\n box-sizing: border-box;\n width: 100%;\n}\n\n.full-width > .bubble-button,\n.full-width > .bubble-media-button {\n width: 100% !important;\n background-color: var(--bubble-main-buttons-background-color, var(--bubble-sub-button-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background))))));\n}\n\n.bubble-buttons-container.bottom-fixed.align-start {\n justify-content: flex-start;\n}\n\n.bubble-buttons-container.bottom-fixed.align-center {\n justify-content: center;\n}\n\n.bubble-buttons-container.bottom-fixed.align-end {\n justify-content: flex-end;\n}\n\n.bubble-buttons-container.bottom-fixed.align-space-between {\n justify-content: space-between;\n}\n\n.bubble-background {\n display: flex;\n position: absolute;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n border-radius: var(--bubble-card-type-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n -webkit-mask-image: radial-gradient(circle, rgba(0, 0, 0, 1) 100%, rgba(0, 0, 0, 0) 100%);\n mask-image: radial-gradient(circle, rgba(0, 0, 0, 1) 100%, rgba(0, 0, 0, 0) 100%);\n /* Optimize repaints on Safari for color transitions */\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n}\n\n.bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-content: center;\n min-width: 38px;\n min-height: 38px;\n margin: 6px;\n border-radius: var(--bubble-card-type-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-card-type-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n overflow: hidden;\n position: relative;\n}\n\n.bubble-icon-feedback-container {\n border-radius: var(--bubble-card-type-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n overflow: hidden !important;\n}\n\n.bubble-main-icon {\n transition: all .3s ease-in-out;\n}\n\n.is-off .bubble-main-icon {\n opacity: 0.6;\n}\n\n.is-on .bubble-main-icon {\n /* filter: brightness(1.1); */\n opacity: 1;\n}\n\n.bubble-entity-picture {\n background-size: cover;\n background-position: center;\n height: 100%;\n width: 100%;\n position: absolute;\n}\n\n.bubble-name,\n.bubble-state {\n display: flex;\n position: relative;\n white-space: nowrap;\n}\n\n.bubble-name-container {\n display: flex;\n line-height: 18px;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n margin: 0 16px 0 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n}\n\n.bubble-name {\n font-size: 13px;\n font-weight: 600;\n}\n\n.bubble-state {\n font-size: 12px;\n font-weight: normal;\n opacity: 0.7;\n}\n\n.is-unavailable .bubble-wrapper {\n cursor: not-allowed;\n}\n\n.is-unavailable .bubble-buttons-container {\n display: none;\n}\n\n.is-unavailable {\n opacity: 0.5;\n}\n\n.hidden {\n display: none !important;\n}\n\n.state-without-name {\n opacity: 1;\n font-size: 14px;\n}\n\n.name-without-icon {\n margin-left: 16px;\n}\n\n.display-state {\n display: flex;\n}\n\n.bubble-action-enabled {\n cursor: pointer;\n}\n\n.large .bubble-container {\n height: calc( var(--row-height,56px) * var(--row-size,1) + var(--row-gap,8px) * ( var(--row-size,1) - 1 ));\n border-radius: var(--bubble-card-type-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n}\n\n.large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px;\n min-height: 42px;\n margin-left: 8px;\n} ",c={};function d(e,t={}){e.elements=e.elements||{};const n={...p,appendTo:e.content,iconDefaultActions:{tap_action:{action:"more-info"},double_tap_action:{action:"none"},hold_action:{action:"none"}},buttonDefaultActions:{tap_action:{action:"none"},double_tap_action:{action:"none"},hold_action:{action:"none"}},baseCardStyles:l,...t};if(n.withMainContainer&&(e.elements.mainContainer=(0,o.n)("div",`bubble-${n.type}-container bubble-container`)),n.withBaseElements&&(e.elements.cardWrapper=(0,o.n)("div",`bubble-${n.type} bubble-wrapper`),e.elements.contentContainer=(0,o.n)("div","bubble-content-container"),e.elements.buttonsContainer=(0,o.n)("div","bubble-buttons-container"),e.elements.iconContainer=(0,o.n)("div","bubble-main-icon-container bubble-icon-container icon-container"),e.elements.icon=(0,o.n)("ha-icon","bubble-main-icon bubble-icon icon"),e.elements.image=(0,o.n)("div","bubble-entity-picture entity-picture"),e.elements.nameContainer=(0,o.n)("div","bubble-name-container name-container"),e.elements.name=(0,o.n)("div","bubble-name name"),e.elements.state=(0,o.n)("div","bubble-state state"),e.elements.iconContainer.append(e.elements.icon,n.withImage?e.elements.image:null),e.elements.nameContainer.append(e.elements.name,n.withState?e.elements.state:null),e.elements.contentContainer.append(e.elements.iconContainer,e.elements.nameContainer),e.elements.cardWrapper.append(e.elements.contentContainer,e.elements.buttonsContainer),n.withBackground&&(e.elements.background=(0,o.n)("div","bubble-background"),e.elements.cardWrapper.prepend(e.elements.background)),e.elements.mainContainer.appendChild(e.elements.cardWrapper),n.withSlider&&(0,a.H)(e,{holdToSlide:n.holdToSlide,readOnlySlider:n.readOnlySlider})),n.styles&&(c[n.type]||(c[n.type]=n.baseCardStyles.replace(/card-type/g,n.type)),e.elements.style=(0,o.n)("style"),e.elements.style.innerText=c[n.type]+n.styles,e.elements.mainContainer.appendChild(e.elements.style)),n.withCustomStyle&&(e.elements.customStyle=(0,o.n)("style"),e.elements.mainContainer.appendChild(e.elements.customStyle)),n.withSubButtons&&((0,r.gS)(e,{container:n.appendTo,appendTo:e.elements.cardWrapper??e.elements.mainContainer,before:!1}),e.elements.buttonsContainer&&e.elements.cardWrapper.appendChild(e.elements.buttonsContainer)),e.elements.mainContainer){const t=(0,s.mg)(e.config),n=Array.isArray(t.bottom)&&t.bottom.length>0,o="bottom"===e.config?.main_buttons_position;(n||o)&&e.elements.mainContainer.classList.add("with-bottom-buttons")}let d,u;!0===n.iconActions?d=n.iconDefaultActions:"object"==typeof n.iconActions&&(d=n.iconActions),!0===n.buttonActions?u=n.buttonDefaultActions:"object"==typeof n.buttonActions&&(u=n.buttonActions);let b={has_action:!1};e.elements.iconContainer&&(b=(0,i.dN)(e.elements.iconContainer,e.config,e.config.entity,d));let h={has_action:!1};return!1!==n.buttonActions&&e.elements.background&&(h=(0,i.dN)(e.elements.background,e.config.button_action,e.config.entity,u)),b.has_action&&e.elements.iconContainer&&(e.elements.iconFeedbackContainer=(0,o.n)("div","bubble-icon-feedback-container bubble-feedback-container"),e.elements.iconContainer.appendChild(e.elements.iconFeedbackContainer),e.elements.iconFeedback=(0,o.n)("div","bubble-icon-feedback bubble-feedback-element feedback-element"),e.elements.iconFeedback.style.display="none",e.elements.iconFeedbackContainer.appendChild(e.elements.iconFeedback),(0,i.pd)(e.elements.iconContainer,e.elements.iconFeedback)),n.withFeedback&&h.has_action&&e.elements.background&&(e.elements.feedbackContainer=(0,o.n)("div","bubble-feedback-container feedback-container"),e.elements.feedback=(0,o.n)("div","bubble-feedback-element feedback-element"),e.elements.feedback.style.display="none",e.elements.feedbackContainer.append(e.elements.feedback),e.elements.cardWrapper.append(e.elements.feedbackContainer),(0,i.pd)(e.elements.background,e.elements.feedback)),n.appendTo===e.content?e.content.appendChild(e.elements.mainContainer):n.appendTo.appendChild(e.elements.mainContainer),e.elements}var u=n(314);const p={type:"base",appendTo:null,baseCardStyles:null,styles:"",withMainContainer:!0,withBaseElements:!0,withFeedback:!0,withImage:!0,withSlider:!1,holdToSlide:!1,readOnlySlider:!1,withCustomStyle:!0,withState:!0,withBackground:!0,withSubButtons:!1,iconActions:!0,buttonActions:!1}},716:(e,t,n)=>{n.d(t,{$C:()=>E,$z:()=>pe,C$:()=>C,D$:()=>A,E2:()=>y,GM:()=>w,Gu:()=>S,HD:()=>W,IU:()=>ue,Iz:()=>de,JK:()=>te,Nl:()=>D,PF:()=>V,Vw:()=>U,bE:()=>Y,df:()=>K,f9:()=>x,j9:()=>X,jp:()=>r,ls:()=>R,mG:()=>$,m_:()=>M,md:()=>L,n:()=>T,nF:()=>ne,qL:()=>f,qo:()=>ce,r6:()=>N,rC:()=>a,rY:()=>v}),n(140);var o=n(653),i=n(388);const a=(e,t,n,o)=>{o=o||{},n=null==n?{}:n;const i=new Event(t,{bubbles:void 0===o.bubbles||o.bubbles,cancelable:Boolean(o.cancelable),composed:void 0===o.composed||o.composed});return i.detail=n,e.dispatchEvent(i),i},r=e=>{a(window,"haptic",e)},s=new Map;let l=null,c=null,d=0,u=!1;function p(){l=null,c=null,d++,u=!1}function b(){u||(requestAnimationFrame(p),u=!0)}function h(){return l||(l=getComputedStyle(document.documentElement),b()),l}const m=new Map;let g=-1;function f(e){if(!e)return"";if(g!==d&&(m.clear(),g=d),m.has(e))return m.get(e);let t=e;if(!t.startsWith("var("))return m.set(e,t),t;const n=(c||(c=getComputedStyle(document.body),b()),c);let o=0;for(;t&&t.startsWith("var(")&&o<10;){const e=t.match(/var\((--[^,]+),?\s*(.*)?\)/);if(!e)break;const[,i,a]=e;t=n.getPropertyValue(i).trim()||a&&a.trim()||"",o++}return m.set(e,t),t}function y(e){const t=e.match(/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:null}function v(e){const t=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/i);return t?[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)]:null}function _(e,t,n){return(.2126*e+.7152*t+.0722*n)/255}function w(e,t=.5){const n=f(e);if(!n)return!1;if(s.has(n))return s.get(n);let o=y(n)||v(n);if(!o)return s.set(n,!1),!1;const i=_(...o)>t;return s.set(n,i),i}function x(e,t){return e.map(e=>Math.min(255,Math.round(e*t)))}function k(e,t,n=15){return!(!e||!t||3!==e.length||3!==t.length)&&Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])+Math.abs(e[2]-t[2])<=n}function C(e,t=e.config.entity,n=!0,o=null,a=null){const r=e.config.use_accent_color;!n&&t?.startsWith("light.")&&(e.config.use_accent_color=!0);const s=(0,i.VA)(e,t);!n&&t?.startsWith("light.")&&(e.config.use_accent_color=r);try{let i=f(s);if(i&&i.startsWith("var(")){const e=i.match(/var\((--[^,]+),?\s*(.*)?\)/);if(e){const[,t]=e,n=h().getPropertyValue(t).trim();n&&(i=n)}}const r=y(i)||v(i);if(!r)return s;const l=n&&t?.startsWith("light.")&&!e.config.use_accent_color;let c=!1;if(a){let e=f(a);if(e&&e.startsWith("var(")){const t=e.match(/var\((--[^,]+),?\s*(.*)?\)/);if(t){const[,n]=t,o=h().getPropertyValue(n).trim();o&&(e=o)}}const t=y(e)||v(e);t&&k(r,t)&&(c=!0)}if(!l&&o){let e=f(o);if(e&&e.startsWith("var(")){const t=e.match(/var\((--[^,]+),?\s*(.*)?\)/);if(t){const[,n]=t,o=h().getPropertyValue(n).trim();o&&(e=o)}}const t=y(e)||v(e);t&&k(r,t)&&(c=!0)}if(!l&&!c)return s;const d=f("var(--primary-text-color, #ffffff)"),u=y(d)||v(d),p=!u||_(...u)>.5,b=x(r,l?p?.84:1.16:p?.92:1.08);return`rgb(${b[0]}, ${b[1]}, ${b[2]})`}catch(e){return s}}function $(e){const t=e.config.name,n=A(e,"friendly_name");return e.name||t||n||""}function S(e,t=e.config.entity){return e._hass.states[t]?.state??""}function A(e,t,n=e.config.entity){if(!t)return"";try{const o=e?._hass?.states?.[n]?.attributes;if(!o)return"";if(t.includes(" ")){const e=o[t];return 0===e?"0":e??""}const i=function(e,t){if(!e||!t||"string"!=typeof t)return;const n=/[^.\[\]]+|\[(?:'([^']+)'|"([^"]+)"|(\d+))\]/g;let o,i=e;for(;(o=n.exec(t))&&null!=i;){const[,e,t,n]=o,a=void 0!==n?Number(n):void 0!==e?e:void 0!==t?t:o[0],r=void 0!==e||void 0!==t||void 0!==n?a:o[0];i=i?.[r]}return i}(o,t);return 0===i?"0":i??""}catch(e){return console.warn(`Error accessing attribute '${t}' for entity '${n}':`,e),""}}function L(e,t,n){return void 0===n&&(n=e?.config?.entity),n&&"string"==typeof n&&n.startsWith(t+".")||!1}function E(e,t=e.config.entity){const n=S(e,t).toLowerCase(),o=A(e,"unit_of_measurement",t)?.includes("°"),i=Number(n);return!!(["on","open","opening","closing","cleaning","true","home","playing","locked","unlocked","occupied","available","running","active","connected","online","mowing","edgecut","starting","heat","cool","dry","heat_cool","fan_only","auto","alarm","error"].includes(n)||i||o)}function M(e,t=e.config.entity){const n=S(e,t).toLowerCase();return["unlocked","error"].includes(n)}function T(e,t=""){const n=document.createElement(e);return""!==t&&t.split(" ").forEach(e=>{n.classList.add(e)}),n}const B=new WeakMap,P=16;function I(e){e.offsetWidth}function O(){return window.bubbleScrollResizeObserver||(window.bubbleScrollResizeObserver=new ResizeObserver(e=>{e.forEach(e=>{const t=e.target,n=B.get(t);if(n)if(t.isConnected)z(t,n);else{try{window.bubbleScrollResizeObserver.unobserve(t)}catch(e){}if(window.bubbleScrollObserver)try{window.bubbleScrollObserver.unobserve(t)}catch(e){}B.delete(t)}})})),window.bubbleScrollResizeObserver}function q(){return window.bubbleScrollObserver||(window.bubbleScrollObserver=new IntersectionObserver(e=>{e.forEach(e=>{const t=e.target.querySelector(".scrolling-container span");t&&(t.style.animationPlayState=e.isIntersecting?"running":"paused")})},{threshold:.1})),window.bubbleScrollObserver}function j(e){const t=Math.max(1,e/2);return Math.max(1,t/P)}function z(e,t){const n=t.text;if(!n||!e.isConnected)return;const o=e.clientWidth;if("true"===e.getAttribute("data-animated")){const i=e.querySelector(".scrolling-container span");if(!i)return;if(I(i),Math.max(1,i.scrollWidth/2)<=o+2){if(e.removeAttribute("data-animated"),e.innerHTML=n,t.observed&&window.bubbleScrollObserver){try{window.bubbleScrollObserver.unobserve(e)}catch(e){}t.observed=!1}return}const a=j(i.scrollWidth);i.style.animationDuration=`${a.toFixed(2)}s`}else if(e.scrollWidth>o+2){const o=' | ',i=`${n+o+n+o}`;e.innerHTML=`
${i}
`,e.setAttribute("data-animated","true");const a=e.querySelector(".scrolling-container span");if(a&&(I(a),a.scrollWidth>0)){const e=j(a.scrollWidth);a.style.animationDuration=`${e.toFixed(2)}s`}const r=q();try{r.observe(e)}catch(e){}t.observed=!0}else if(t.observed&&window.bubbleScrollObserver){try{window.bubbleScrollObserver.unobserve(e)}catch(e){}t.observed=!1}}function D(e,t,n){const{scrolling_effect:o=!0}=e.config;if(!o){if(function(e,t){e.innerHTML=t,e.previousText=t,Object.assign(e.style,{whiteSpace:"normal",display:"-webkit-box",WebkitLineClamp:"2",WebkitBoxOrient:"vertical",textOverflow:"ellipsis",overflow:"hidden"})}(t,n),window.bubbleScrollResizeObserver)try{window.bubbleScrollResizeObserver.unobserve(t)}catch(e){}if(window.bubbleScrollObserver)try{window.bubbleScrollObserver.unobserve(t)}catch(e){}return void B.delete(t)}const i=t.previousText!==n,a=B.has(t);if(!i&&a)return;t.previousText=n;const r=!a&&"true"===t.getAttribute("data-animated");let s=B.get(t);s?s.text=n:(s={text:n,observed:!1},B.set(t,s));const l="true"===t.getAttribute("data-animated"),c=t.querySelector(".scrolling-container span");if(l&&c){const e=' | ';c.innerHTML=`${n+e+n+e}`,I(c);const o=t.clientWidth;if(Math.max(1,c.scrollWidth/2)<=o+2){if(t.removeAttribute("data-animated"),t.innerHTML=n,s.observed&&window.bubbleScrollObserver){try{window.bubbleScrollObserver.unobserve(t)}catch(e){}s.observed=!1}return}const i=j(c.scrollWidth);if(c.style.animationDuration=`${i.toFixed(2)}s`,r){c.style.animation="none",I(c),c.style.animation="",c.style.animationDuration=`${i.toFixed(2)}s`,c.style.animationPlayState="running";const e=q();try{e.observe(t)}catch(e){}s.observed=!0}const a=O();try{a.observe(t)}catch(e){}return}t.innerHTML=n,t.style="",t.removeAttribute("data-animated");const d=O();try{d.observe(t)}catch(e){}z(t,s)}function N(e,t){if(!e)return"";const n=new Date(e),o=new Date;let i,a,r=Math.floor((o-n)/1e3);return isNaN(r)?"":(r<60?(i="second",a=r+1):r<3600?(i="minute",a=Math.round(r/60)):r<86400?(i="hour",a=Math.round(r/3600)):(i="day",a=Math.round(r/86400)),new Intl.RelativeTimeFormat(t,{numeric:"auto"}).format(-a,i))}function U(e){return e&&"string"==typeof e&&e.startsWith("timer.")}function R(e){if(!e||!e.attributes)return;if(!e.attributes.remaining)return;let t=function(e){if(!e)return 0;if("number"==typeof e)return e;if("string"==typeof e){let t=0;const n=e.match(/PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?/);if(n)return t+=3600*parseInt(n[1]||0,10),t+=60*parseInt(n[2]||0,10),t+=parseInt(n[3]||0,10),t;const o=e.split(":").map(e=>parseInt(e,10));if(3===o.length)return 3600*o[0]+60*o[1]+o[2];if(2===o.length)return 60*o[0]+o[1]}return 0}(e.attributes.remaining);if("active"===e.state&&e.attributes.finishes_at){const n=(new Date).getTime(),o=new Date(e.attributes.finishes_at).getTime();t=Math.max((o-n)/1e3,0)}return t}function V(e,t,n){if(!t)return null;if("idle"===t.state||0===n)return e.formatEntityState(t);let o=function(e){if(null==e||isNaN(e))return null;const t=Math.floor(e);if(t<0)return"0";const n=Math.floor(t/3600),o=Math.floor(t%3600/60),i=t%60;return n>0?`${n}:${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}`:o>0?`${o}:${String(i).padStart(2,"0")}`:`0:${String(i).padStart(2,"0")}`}(n||0)||"0";return"paused"===t.state&&(o=`${o} (${e.formatEntityState(t)})`),o}const F=new WeakMap,H=new WeakMap;function W(e,t,n){Y(e);const o=e._hass?.states?.[t];if(!o||"active"!==o.state)return;const i=setInterval(()=>{if(!e._hass?.states?.[t])return void Y(e);const o=e._hass.states[t];o&&"active"===o.state?n&&n():Y(e)},1e3);F.set(e,i)}function Y(e){const t=F.get(e);t&&(clearInterval(t),F.delete(e))}function K(e,t,n,o){X(e);const i=t._hass?.states?.[n];if(!i||"active"!==i.state)return;const a=setInterval(()=>{if(!e.isConnected)return void X(e);if(!t._hass?.states?.[n])return void X(e);const i=t._hass.states[n];i&&"active"===i.state?o&&o():X(e)},1e3);H.set(e,a)}function X(e){const t=H.get(e);t&&(clearInterval(t),H.delete(e))}let J=null,G=null,Q=null,Z=null,ee=!1;function te(e,t=null,n=null){const i=t||e.content;if(!i)return;let a;if(n)a=e.config.card_layout??n;else{ee||(J=document.querySelector("body > home-assistant"),G=J?.shadowRoot?.querySelector("home-assistant-main"),Q=G?.shadowRoot?.querySelector("ha-drawer > partial-panel-resolver > ha-panel-lovelace"),Z=Q?.shadowRoot?.querySelector("hui-root"),J&&G&&Q&&Z?ee=!0:(J=null,G=null,Q=null,Z=null,ee=!1)),Z&&!Z.isConnected&&(ee=!1,J=null,G=null,Q=null,Z=null);let t="normal";if(Z?.shadowRoot){const e=Z.shadowRoot.querySelector("#view > hui-view > hui-masonry-view");window.isSectionView=!e,t=window.isSectionView?"large":"normal"}a=e.config.card_layout??t;try{const t=e?.config?.sub_button;if(!!t&&!Array.isArray(t)&&(Array.isArray(t.bottom)?t.bottom:[]).some(e=>!!e)){const t=Boolean(window.isSectionView),n=e?.config?.card_layout,o=Object.prototype.hasOwnProperty.call(e?.config,"card_layout"),i=null==n||"normal"===n;if(t&&o&&"normal"===n)try{delete e.config.card_layout}catch(t){const n={...e.config};delete n.card_layout,e.config=n}else!t&&i&&(a="large",e.config.card_layout="large")}}catch(e){}}if(e.previousLayout===a)return;e.previousLayout=a;const r="large"===a||"large-2-rows"===a||"large-sub-buttons-grid"===a,s="large-2-rows"===a,l="large-sub-buttons-grid"===a;i.classList.toggle("large",r),i.classList.toggle("rows-2",s),i.classList.toggle("sub-buttons-grid",l),(()=>{const t=e.elements?.buttonsContainer,n=e.elements?.cardWrapper,o=e.elements?.bottomSubButtonContainer;if(!t||!n)return;const i=e.config?.main_buttons_position||"default",a=e.config?.main_buttons_alignment||"end",r=e.config?.main_buttons_full_width??"bottom"===i;if(t.classList.remove("bottom-fixed","full-width","align-start","align-center","align-end","align-space-between"),n.classList.remove("has-bottom-buttons"),o?.classList.remove("with-main-buttons-bottom"),"bottom"!==i)return;const s={start:"align-start",center:"align-center",end:"align-end","space-between":"align-space-between"}[a]||"align-end";t.classList.add("bottom-fixed",s),r&&t.classList.add("full-width"),n.classList.add("has-bottom-buttons"),!t.classList.contains("hidden")&&"none"!==t.style.display&&"none"!==getComputedStyle(t).display&&o?.classList.add("with-main-buttons-bottom")})(),(0,o.iJ)(e),i===e.content&&e.elements?.mainContainer&&(e.config.rows||e.config.grid_options?.rows)?"auto"===e.config.rows||"auto"===e.config.grid_options?.rows||e.elements.mainContainer.style.setProperty("--row-size",e.config.rows||e.config.grid_options?.rows):"separator"===e.config.card_type&&e.elements.mainContainer.style.setProperty("--row-size",.8)}function ne(e,t=300){let n,o,i=new Date(0);return(...a)=>{o=a;const r=Date.now()-i;r>=t?(i=Date.now(),e(...o)):n||(n=setTimeout(()=>{n=void 0,i=Date.now(),e(...o)},t-r))}}let oe=0,ie=0;const ae="bubble-html-scroll-locked",re="bubble-body-scroll-locked",se="bubbleScrollLockInline",le=["position","width","top","left","right"];function ce(e){!function(){const e="bubble-card-no-scroll-styles",t=`\n body.${re} {\n overflow: hidden !important;\n overscroll-behavior: none;\n }\n `;let n=document.getElementById(e);n||(n=document.createElement("style"),n.id=e,document.head.appendChild(n)),n.textContent!==t&&(n.textContent=t)}();const t=document.documentElement,n=document.body;if(n){if(e){if(n.classList.contains(re))return;return oe=void 0!==window.scrollY?window.scrollY:(t||document.body.parentNode||document.body).scrollTop,ie=void 0!==window.scrollX?window.scrollX:(t||document.body.parentNode||document.body).scrollLeft,function(e){const t={};le.forEach(n=>{const o=e.style[n];o&&(t[n]=o)}),e.dataset[se]=JSON.stringify(t)}(n),n.classList.add(re),n.style.position="fixed",n.style.width="100%",n.style.top=`-${oe}px`,n.style.left="0",void(n.style.right="0")}t&&t.classList.remove(ae),n.classList.contains(re)&&(n.classList.remove(re),function(e){const t=e.dataset[se];if(delete e.dataset[se],t)try{const n=JSON.parse(t);le.forEach(t=>{n[t]?e.style[t]=n[t]:e.style.removeProperty(t)})}catch(t){le.forEach(t=>e.style.removeProperty(t))}else le.forEach(t=>e.style.removeProperty(t))}(n),window.scrollTo({top:oe,left:ie,behavior:"auto"}))}}function de(e){try{e.querySelectorAll("*").forEach(e=>{if(e._bubbleResizeListener&&(window.removeEventListener("resize",e._bubbleResizeListener),e._bubbleResizeListener=null,e.eventAdded=!1),window.bubbleScrollObserver)try{window.bubbleScrollObserver.unobserve(e)}catch(e){}})}catch(e){}}function ue(e,t=0,n="",o="en-US"){const i=Number(e);if(Number.isNaN(i))return"";const a=i.toLocaleString(o,{minimumFractionDigits:t,maximumFractionDigits:t,useGrouping:!1});return n?`${a} ${n}`:a}function pe(e){return"°C"===e?.config?.unit_system?.temperature?"°C":"°F"}},748:(e,t,n)=>{n.d(t,{eX:()=>r,sl:()=>l});const o=new Map,i=new Set;let a=!1;const r=e=>(i.add(e),()=>i.delete(e)),s=(e,t,n)=>e.subscribeMessage(e=>t(e),{type:"render_template",...n});function l(e,t,n={}){if(!e?.connection||!t)return;const r=JSON.stringify({template:t,variables:n});if(o.has(r)){const e=o.get(r);return e.lastAccess=Date.now(),e.result}o.set(r,{result:void 0,unsubscribe:void 0,lastAccess:Date.now()}),s(e.connection,e=>{const t=o.get(r);if(!t)return;const n=t.result;e.error?(console.error("Bubble Card - Template Error:",e.error),t.result=void 0):t.result=e.result,n!==t.result&&(a||(a=!0,requestAnimationFrame(()=>{a=!1;for(const e of i)try{e()}catch(e){console.error("Error in template change subscriber:",e)}})))},{template:t,variables:n,strict:!0}).then(e=>{const t=o.get(r);t?t.unsubscribe=e:e()})}},752:(e,t,n)=>{n.d(t,{O:()=>i});var o=n(531);function i(e,t=e.elements,n=e.config.entity,i){if(t.currentState=e._hass.states[n]?.state,!t.currentState)return;t.currentList=n?.startsWith("input_select")||n?.startsWith("select")?e._hass.states[n].attributes.options:e._hass.states[n].attributes[i.select_attribute],t.currentSelectedAttribute=(0,o.aX)(e._hass.states[n],i.select_attribute);const a=function(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let n=0;n{e.value===t.currentSelectedAttribute?e.setAttribute("selected",""):e.removeAttribute("selected")}),t.previousSelectedAttribute=t.currentSelectedAttribute,void(t.previousState=t.currentState)}for(;t.dropdownSelect.firstChild;)t.dropdownSelect.removeChild(t.dropdownSelect.firstChild);Array.isArray(r)&&r.forEach(a=>{const r=document.createElement("mwc-list-item");r.value=a;const s=(0,o.z_)(e,e._hass.states[n],i.select_attribute,a);s&&(r.graphic="icon",r.appendChild(s));const l=(0,o.PW)(e,e._hass.states[n],i.select_attribute,a);r.appendChild(document.createTextNode(l)),a===t.currentSelectedAttribute&&r.setAttribute("selected",""),t.dropdownSelect.appendChild(r)}),t.previousList=Array.isArray(t.currentList)?t.currentList.slice():t.currentList,t.previousState=t.currentState,t.previousSelectedAttribute=t.currentSelectedAttribute,t.dropdownSelect.isConnected||t.dropdownContainer.appendChild(t.dropdownSelect)}},766:(e,t,n)=>{n.d(t,{Xe:()=>_,_e:()=>m,dn:()=>v});var o=n(957),i=n(888),a=n(933),r=n(264),s=n(241),l=n(868),c=n(382),d=n(134);const u=5e3,p="bubble-card-rate-limit-warning";function b(e){try{const t="number"==typeof e&&Number.isFinite(e)?e:Date.now()+36e5;localStorage.setItem(p,JSON.stringify({resetTime:t}))}catch(e){console.warn("Failed to persist rate limit warning to localStorage",e)}}function h(){try{localStorage.removeItem(p)}catch(e){console.warn("Failed to clear rate limit warning from localStorage",e)}}function m(e){const t=e.hass&&e.hass.states&&e.hass.states["sensor.bubble_card_modules"];if(void 0===e._storeShowOnlyCompatible&&(e._storeShowOnlyCompatible=!0),void 0===e._rankingInfoDismissed)try{e._rankingInfoDismissed="true"===localStorage.getItem("bubble-card-ranking-info-dismissed")}catch(t){e._rankingInfoDismissed=!1}if(void 0===e._rateLimitWarning){const t=function(){try{const e=localStorage.getItem(p);if(!e)return null;const t=JSON.parse(e);return t&&"object"==typeof t?t:null}catch(e){return null}}(),n=t?.resetTime;"number"==typeof n&&n>Date.now()?(e._rateLimitWarning=!0,e._rateLimitResetTime=n):(e._rateLimitWarning=!1,t&&h())}e._dismissRankingInfo=()=>{e._rankingInfoDismissed=!0;try{localStorage.setItem("bubble-card-ranking-info-dismissed","true")}catch(e){console.warn("Failed to save ranking info dismiss state to localStorage",e)}e.requestUpdate()};const n=(0,d.isBCTAvailableSync)();if(e._storeBctRetryHandle&&n&&(clearTimeout(e._storeBctRetryHandle),e._storeBctRetryHandle=null),!e.hass||n||e._storeBctCheckAttempted)e.hass&&n&&!e._storeBctCheckAttempted&&(e._storeBctCheckInFlight||(e._storeBctCheckInFlight=!0,e._storeBctCheckAttempted=!0,(0,d.ensureBCTProviderAvailable)(e.hass).finally(()=>{e._storeBctCheckInFlight=!1,(0,d.isBCTAvailableSync)()!==n&&e.requestUpdate()})));else{const t=Date.now(),n=e._storeLastBctCheckAt??0,o=n?t-n:1/0,i=n&&o{e._storeBctRetryHandle=null,e.requestUpdate()},t)}}else e._storeBctRetryHandle&&(clearTimeout(e._storeBctRetryHandle),e._storeBctRetryHandle=null),e._storeBctCheckInFlight=!0,e._storeBctCheckAttempted=!0,e._storeLastBctCheckAt=t,(0,d.ensureBCTProviderAvailable)(e.hass).finally(()=>{e._storeBctCheckInFlight=!1,e.requestUpdate()})}if(!n){const e=i.Ki&&i.Ki.size>0||t;return o.qy`

Bubble Card Tools required

${e?o.qy`

To use the Module Store and to install/edit modules, install Bubble Card Tools.

Existing modules will still be read from legacy sources for compatibility.

`:o.qy`

No modules detected yet. To install or edit modules and use the Module Store, install Bubble Card Tools.

`}
`}if(!e._storeModules){const t=(0,s.TJ)();if(t){e._storeModules=t.modules,e._isLoadingStore=!1;const n=Date.now(),o=n-(t.lastFetchedAt||(t.expiration?t.expiration-864e5:0))>216e5,i=t.expiration{k(e,!0)},216e5)),e._isLoadingStore){const t=e._loadingProgress||0,n=e._loadingStatus||"Loading modules";return o.qy`
${n} ${Math.round(t)}%
`}return e._storeError?o.qy`

Loading error

Could not load modules from GitHub: ${e._storeError}

k(e)}> Retry
`:([...new Set(e._storeModules.filter(e=>e.type).map(e=>e.type.toLowerCase()))].sort(),void 0===e._zoomedImage&&(e._zoomedImage=null),e._toggleImageZoom=t=>{e._zoomedImage===t?e._zoomedImage=null:e._zoomedImage=t,e.requestUpdate()},o.qy`
Module Store
{e._isApiCallInProgress=!1,k(e,!1)}} title="Refresh module list" >
{e._storeShowOnlyCompatible=t.target.checked,e.requestUpdate()}} >
${e._rankingInfoDismissed?"":o.qy`

How modules are ranked
Dismiss

Due to a limitation in GitHub's API, only top-level reactions like ❤️ 👍 🚀 on the main discussion post are counted for popularity, along with other factors like recent activity, number of comments, updates...

Click the "More info" button and show some love there if you find a module useful!

`} ${e._rateLimitWarning?o.qy`

API rate limit reached
{e._rateLimitWarning=!1,h(),e.requestUpdate()}} title="Dismiss" style=" display: inline-flex; align-items: center; position: absolute; right: 16px; padding: 0 8px; cursor: pointer;" > Dismiss

GitHub API rate limit was reached. The module list is loaded from cache. ${e._rateLimitResetTime?`Please try again in ${function(e){const t=e-Date.now();if(t<=0)return"now";const n=Math.ceil(t/6e4);if(n<60)return`${n} minute${n>1?"s":""}`;const o=Math.floor(n/60),i=n%60;return 0===i?`${o} hour${o>1?"s":""}`:`${o} hour${o>1?"s":""} and ${i} minute${i>1?"s":""}`}(e._rateLimitResetTime)}.`:"Please try again later."}

`:""}
${g(e).map(t=>{const n=y(t.id),i=v(t.id),r=w(t.id,t.version),s=e._config.card_type??"";let c=!0;return c=Array.isArray(t.supportedCards)?t.supportedCards.includes(s):!t.unsupportedCards||!t.unsupportedCards.includes(s),o.qy`

${t.name}

${t.userAvatar?o.qy` ${t.creator|| `:""} by ${t.creator||"Anonymous"}
${f(t)?o.qy` New`:""} ${c?"":o.qy`Incompatible`} ${r?o.qy`Update available`:""} ${i?o.qy`YAML`:""} ${t.version||""}
${t.description?o.qy`

`:o.qy`

No description

`} ${t.imageUrl?o.qy`
${t.name}
{n.stopPropagation(),e._toggleImageZoom(t.imageUrl)}}>
`:""}
${n?o.qy` ${r?o.qy` ${x(t)?o.qy` Update (Manual install) `:o.qy`
(0,l.G)(e,t)} class="bubble-badge update-button hoverable" style="cursor: pointer;" > Update
`} `:o.qy`
${i?"Installed via YAML":"Installed"}
`} `:o.qy` ${x(t)?o.qy` Manual install `:o.qy`
(0,l.G)(e,t)} class="bubble-badge install-button hoverable" style="cursor: pointer;" > Install
`} `} More info / Issue report
`})}
${0===g(e).length?o.qy`

No modules found

No modules match your search criteria. Try modifying your search or filters.

`:""}
(0,a.XY)(e)}>
${e._zoomedImage?o.qy`
e._toggleImageZoom(null)}> Fullscreen preview
`:""} `)}function g(e){if(!e._storeModules)return[];let t=[...e._storeModules];const n=new Map([["smart_icons"]]);if(t=t.filter(e=>{const t=e&&e.id;return!t||!n.has(t)||y(t)}),e._storeSearchQuery){const n=e._storeSearchQuery.toLowerCase();t=t.filter(e=>e.name&&e.name.toLowerCase().includes(n)||e.description&&e.description.toLowerCase().includes(n)||e.creator&&e.creator.toLowerCase().includes(n)||e.type&&e.type.toLowerCase().includes(n))}if(e._storeShowOnlyCompatible){const n=e._config.card_type??"";t=t.filter(e=>e.supportedCards&&Array.isArray(e.supportedCards)?e.supportedCards.includes(n):!e.unsupportedCards||!e.unsupportedCards.includes(n))}return e._storeSelectedType&&"all"!==e._storeSelectedType&&(t=t.filter(t=>t.type&&t.type.toLowerCase()===e._storeSelectedType.toLowerCase())),t=(o=t)&&Array.isArray(o)?o.map(e=>{let t=0,n=!1,o=!1;if(e.comments&&(t+=Math.min(e.comments,8),n=!0),e.reactions?.total_count&&(t+=5*e.reactions.total_count,n=!0),e.reactions?.heart&&(t+=10*e.reactions.total_count,n=!0),e.createdAt){const n=new Date(e.createdAt),i=(new Date-n)/864e5;i<=7?(t+=30,o=!0):i<=30?(t+=15,o=!0):i<=90&&(t+=5)}if(e.updated_at){const n=new Date(e.updated_at),i=(new Date-n)/864e5;i<=7?(t+=25,o=!0):i<=30?(t+=15,o=!0):i<=90&&(t+=8)}return n||o||(t-=30),n&&o&&(t+=20),"Clooos"===e.creator&&(t+=100),f(e)&&(t+=1e4),{...e,relevanceScore:t}}).sort((e,t)=>t.relevanceScore-e.relevanceScore):[],t;var o}function f(e){if(!e.createdAt)return!1;const t=new Date(e.createdAt);return(new Date-t)/864e5<=14}function y(e){return i.Ki.has(e)}function v(e){if(!y(e))return!1;if(i.sq.has(e))return"yaml"===i.sq.get(e);try{return!JSON.parse(localStorage.getItem("bubble-card-modules")||"{}")[e]}catch(e){return console.warn("Error checking module installation source:",e),!1}}function _(){const e=Array.from(i.Ki.keys()),t=[];let n=0;const o=(0,s.TJ)();return o&&o.modules&&o.modules.length?(e.forEach(e=>{const a=o.modules.find(t=>t.id===e);a&&w(e,a.version)&&(n++,t.push({id:e,name:a.name||i.Ki.get(e).name||e,currentVersion:i.Ki.get(e).version||"0",newVersion:a.version}))}),{hasUpdates:n>0,updateCount:n,modules:t}):{hasUpdates:!1,updateCount:0,modules:[]}}function w(e,t){if(!y(e)||!t)return!1;const n=(i.Ki.get(e)||{}).version||"0";return(0,a._O)(t,n)>0}function x(e){if(!e||!e.yamlContent)return!0;const t=e.yamlContent.trim();if(!t)return!0;try{const e=c.Ay.load(t);if(!e||"object"!=typeof e)return!0;const n=Object.keys(e);if(n.length>1){let t=0;for(const o of n){const n=e[o];n&&"object"==typeof n&&(n.name||n.code)&&t++}if(t>1)return!0}if(1===n.length){const t=e[n[0]];if(t&&"object"==typeof t){const e=Object.keys(t);let n=0;for(const o of e){const e=t[o];e&&"object"==typeof e&&(e.name||e.code)&&n++}if(n>1)return!0}}if(1===n.length){const t=e[n[0]];if(!t||"object"!=typeof t)return!0;if(!t.name||!t.code)return!0}}catch(e){return console.warn("Error checking module YAML compatibility:",e),!0}return!1}async function k(e,t=!1){if(e._isApiCallInProgress)return;e._isApiCallInProgress=!0;const n=!t&&void 0!==e._storeModules;if(!t){e._isLoadingStore=!0,e._storeError=null,e._loadingProgress=5,e._loadingStatus="Connecting to GitHub",e.requestUpdate();let t=setInterval(()=>{if(!e._isLoadingStore)return void clearInterval(t);const n=e._loadingProgress||0;let o=0;n<40?o=2.5*Math.random():n<60?o=1.5*Math.random():n<75?o=.8*Math.random():n<90&&(o=.3*Math.random()),n<90&&(e._loadingProgress=n+o,e.requestUpdate())},200);e._progressInterval=t}try{if(!n){const n=localStorage.getItem("bubble-card-api-failure-timestamp");if(n){const o=parseInt(n),i=18e5;if(Date.now()-o=400&&n.status<500)break;if(!(rsetTimeout(e,500*(r+1))),r++}catch(e){if(!(r0){console.warn(`Using ${o.length} discussions from previous pages`),l=!0,a=!1,n=null;break}throw e}console.warn(`⚠️ Network error on page ${i}, retrying in ${500*(r+1)}ms...`),await new Promise(e=>setTimeout(e,500*(r+1))),r++}if(!n)continue;if(t||(e._loadingStatus=`Processing page ${i}`,e._loadingProgress=Math.max(e._loadingProgress,Math.min(50+5*i,80)),e.requestUpdate()),!n.ok){const t=n.headers.get("x-ratelimit-remaining"),r=n.headers.get("x-ratelimit-reset"),s=null!==t?Number(t):null,c=r?1e3*parseInt(r,10):null;if(403===n.status&&0===s&&(c&&(e._rateLimitResetTime=c),e._rateLimitWarning=!0,b(e._rateLimitResetTime)),o.length>0&&n.status>=500){console.warn(`⚠️ Server error on page ${i}, using ${o.length} discussions from previous pages`),l=!0,a=!1;continue}throw localStorage.setItem("bubble-card-api-failure-timestamp",Date.now().toString()),new Error(`REST API Error: ${n.status}`)}const c=await n.json();0===c.length?a=!1:(o=[...o,...c],i++,a&&await new Promise(e=>setTimeout(e,1e3)));const d=n.headers.get("x-ratelimit-remaining"),u=n.headers.get("x-ratelimit-reset");d<=5&&(console.warn("⚠️ API limit approaching, stopping pagination"),l=!0,a=!1,u&&(e._rateLimitResetTime=1e3*parseInt(u)))}t||(e._loadingStatus="Filtering modules",e._loadingProgress=Math.max(e._loadingProgress,85),e.requestUpdate());const c=o.filter(e=>{const t=e.category?.name;return"Share your Modules"===t}),d=(0,r.N5)(c),u=(0,s.TJ)(),p=d.length>0;if(l&&u&&u.modules&&u.modules.length>d.length)return console.warn("⚠️ Rate limit reached with incomplete data, preserving existing cache"),e._rateLimitWarning=!0,b(e._rateLimitResetTime),t||(e._loadingStatus="Rate limit reached - Using cached data",e._loadingProgress=Math.max(e._loadingProgress,95),e.requestUpdate()),await new Promise(e=>setTimeout(e,300)),t||(e._loadingProgress=100,e._loadingStatus="Loaded from cache (API limit reached)",e.requestUpdate()),e._storeModules=u.modules,e._isLoadingStore=!1,e._progressInterval&&(clearInterval(e._progressInterval),e._progressInterval=null),void e.requestUpdate();e._rateLimitWarning=!1,h(),t||(e._loadingStatus="Saving to cache",e._loadingProgress=Math.max(e._loadingProgress,95),e.requestUpdate()),p&&(0,s.aN)(d),t||(await new Promise(e=>setTimeout(e,300)),e._loadingProgress=100,e._loadingStatus="Complete",e.requestUpdate()),t&&e._storeModules||(e._storeModules=p?d:u?.modules||[],e._isLoadingStore=!1,e._progressInterval&&(clearInterval(e._progressInterval),e._progressInterval=null),e.requestUpdate()),t&&e._storeModules&&p&&(e._storeModules=d,e.requestUpdate())}catch(n){if(console.error("Error loading modules:",n),!t){e._loadingStatus="Error - Loading from cache",e._loadingProgress=Math.max(e._loadingProgress,85),e.requestUpdate();const t=(0,s.TJ)();t?(await new Promise(e=>setTimeout(e,300)),e._storeModules=t.modules,e._isLoadingStore=!1,e._loadingProgress=100,e._loadingStatus="Loaded from cache",e.requestUpdate()):(e._storeError=n.message,e._isLoadingStore=!1,e.requestUpdate()),e._progressInterval&&(clearInterval(e._progressInterval),e._progressInterval=null)}}finally{e._isApiCallInProgress=!1,t||e.requestUpdate()}}},772:(e,t,n)=>{n.d(t,{Kr:()=>w,AQ:()=>_});var o=n(716),i=n(391),a=n(653),r=n(175),s=n(388),l=n(752),c=n(531);var d=n(345),u=n(459);function p(e,t){const n=!(!t.alwaysVisible||!t.subButton?.show_button_info);return{entity:t.entity,...void 0!==t.subButton?.min_value?{min_value:t.subButton.min_value}:{},...void 0!==t.subButton?.max_value?{max_value:t.subButton.max_value}:{},...void 0!==t.subButton?.step?{step:t.subButton.step}:{},...void 0!==t.subButton?.tap_to_slide?{tap_to_slide:t.subButton.tap_to_slide}:{},...void 0!==t.subButton?.relative_slide?{relative_slide:t.subButton.relative_slide}:{},...void 0!==t.subButton?.read_only_slider?{read_only_slider:t.subButton.read_only_slider}:{},...void 0!==t.subButton?.slider_live_update?{slider_live_update:t.subButton.slider_live_update}:{},...void 0!==t.subButton?.invert_slider_value?{invert_slider_value:t.subButton.invert_slider_value}:{},...void 0!==t.subButton?.slider_fill_orientation?{slider_fill_orientation:t.subButton.slider_fill_orientation}:{},slider_value_position:n?"right":t.subButton?.slider_value_position??"right",...void 0!==t.subButton?.use_accent_color?{use_accent_color:t.subButton.use_accent_color}:{},...void 0!==t.subButton?.allow_light_slider_to_0?{allow_light_slider_to_0:t.subButton.allow_light_slider_to_0}:{},...void 0!==t.subButton?.light_transition?{light_transition:t.subButton.light_transition}:{},...void 0!==t.subButton?.light_transition_time?{light_transition_time:t.subButton.light_transition_time}:{},...void 0!==t.subButton?.light_slider_type?{light_slider_type:t.subButton.light_slider_type}:{},...void 0!==t.subButton?.hue_force_saturation?{hue_force_saturation:t.subButton.hue_force_saturation}:{},...void 0!==t.subButton?.hue_force_saturation_value?{hue_force_saturation_value:t.subButton.hue_force_saturation_value}:{}}}function b(e,t){try{const n="function"==typeof t.composedPath?t.composedPath():[];return!(!Array.isArray(n)||0===n.length)&&(n.includes(e.sliderWrapper)||n.includes(e.sliderContainer)||n.includes(e.sliderCloseBtn))}catch(e){return!1}}function h(e){if(e&&e._globalBlockerAdded&&e._globalBlockerHandler){try{(e._globalBlockerEvents||["pointerdown","pointerup","click","touchstart","touchend","mousedown","mouseup"]).forEach(t=>document.removeEventListener(t,e._globalBlockerHandler,!0))}catch(e){}try{delete e._globalBlockerHandler,delete e._globalBlockerEvents}catch(e){}e._globalBlockerAdded=!1}}function m(e,t){e&&(e.sliderAlwaysVisible||e.sliderCloseBtn&&e.sliderCloseBtn.classList.toggle("is-hidden",!t))}function g(e,t){const n=e=>{e&&e.classList.toggle("is-hidden",t)};n(e.elements?.nameContainer),n(e.elements?.iconContainer),n(e.elements?.image),n(e.elements?.buttonsContainer),e.elements?.subButtonContainer&&(e.elements.subButtonContainer.style.opacity=t?"0":"",e.elements.subButtonContainer.style.pointerEvents=t?"none":"")}function f(e,t){if(!t.sliderWrapper)return;t.sliderWrapper.classList.add("is-hidden");const n=t._parentGroupContainer;n&&n.classList?n.classList.remove("group-slider-open"):(function(e){g(e,!1)}(e),function(e){if(e.elements&&e.elements.cardWrapper){try{e.elements.cardWrapper.style.removeProperty("--bubble-sub-slider-left-offset")}catch(e){}try{e.elements.cardWrapper.style.removeProperty("--bubble-sub-slider-width")}catch(e){}}}(e)),t.sliderOpen=!1,m(t,!1),h(t);try{t._blockerPointerDownInside=!1}catch(e){}}function y(e,t,n){if(!t.sliderWrapper){const n=(0,o.n)("div","bubble-sub-slider-wrapper is-hidden");(e.elements.cardWrapper||e.elements.mainContainer||e.content).appendChild(n),t.sliderWrapper=n;const i=(0,o.n)("div","bubble-sub-button-slider");n.appendChild(i),t.sliderContainer=i;const a=(0,o.n)("div","bubble-sub-slider-close"),r=(0,o.n)("ha-icon");r.setAttribute("icon","mdi:close");try{a.haRipple=(0,o.n)("ha-ripple"),a.appendChild(a.haRipple)}catch(e){}a.appendChild(r),n.appendChild(a),t.sliderCloseBtn=a}const a=["pointerdown","pointermove","touchstart","touchmove","mousedown","mousemove","click"];if(!t._stopPropAdded&&t.sliderContainer){const e=e=>e.stopPropagation();a.forEach(n=>{t.sliderContainer.addEventListener(n,e,{passive:!1})}),t._stopPropAdded=!0,t._stopPropHandler=e}if(t.sliderContext)t.sliderContext.config=p(0,n);else{const o={_hass:e._hass,config:p(0,n),elements:{mainContainer:t.sliderContainer,cardWrapper:e.elements.cardWrapper||e.elements.mainContainer||e.content},content:e.content,card:e.card};(0,d.H)(o,{targetElement:t.sliderContainer,sliderLiveUpdate:!!n.subButton?.slider_live_update,withValueDisplay:!0,persistentValueDisplay:!0,holdToSlide:!0,readOnlySlider:!!n.subButton?.read_only_slider}),t.sliderContext=o}if(n.alwaysVisible){t.sliderAlwaysVisible=!0;const i=n.groupContainer||e.elements.subButtonContainer;if(t.sliderWrapper.parentNode!==i){try{t.sliderWrapper.parentNode?.removeChild(t.sliderWrapper)}catch(e){}i.appendChild(t.sliderWrapper)}t.sliderWrapper.classList.add("inline"),t.sliderContainer.classList.add("inline");const a=!!n.subButton?.show_button_info;if(t.sliderContext?.elements?.rangeValue){t.sliderInfoWrapper||(t.sliderInfoWrapper=(0,o.n)("div","bubble-sub-button-info-wrapper"),t.sliderContainer.insertBefore(t.sliderInfoWrapper,t.sliderContainer.firstChild));const e=t.sliderContext.elements.rangeValue;e&&e.parentNode!==t.sliderInfoWrapper&&(t.sliderInfoWrapper.appendChild(e),e.classList.add("in-info-wrapper")),t.sliderContainer.classList.add("has-info-wrapper"),t.sliderWrapper.classList.add("has-info-wrapper"),a?(t.nameContainer&&t.nameContainer.parentNode!==t.sliderInfoWrapper&&t.sliderInfoWrapper.appendChild(t.nameContainer),t.sliderContainer.classList.add("with-button-info"),t.sliderWrapper.classList.add("with-button-info")):(t.nameContainer&&t.nameContainer.parentNode===t.sliderInfoWrapper&&t.appendChild(t.nameContainer),t.sliderContainer.classList.remove("with-button-info"),t.sliderWrapper.classList.remove("with-button-info"))}n.subButton?.fill_width?(t.sliderWrapper.classList.add("fill-width"),t.sliderContainer.classList.add("fill-width")):(t.sliderWrapper.classList.remove("fill-width"),t.sliderContainer.classList.remove("fill-width"));try{const e=n.subButton?.width;if(n.subButton?.fill_width||null==e||""===e)n.subButton?.fill_width?(t.sliderWrapper.style.removeProperty("width"),t.sliderWrapper.classList.remove("has-custom-width"),t.sliderContainer&&(t.sliderContainer.classList.remove("has-custom-width"),t.sliderContainer.style.removeProperty("--slider-container-min-width"))):null!=e&&""!==e||(t.sliderWrapper.style.removeProperty("width"),t.sliderWrapper.classList.remove("has-custom-width"),t.sliderContainer&&(t.sliderContainer.classList.remove("has-custom-width"),t.sliderContainer.style.removeProperty("--slider-container-min-width")));else{const o=Number(e);if(!Number.isNaN(o)&&o>0){const e="main"===n.section?"px":"%";t.sliderWrapper.style.setProperty("width",`${o}${e}`),t.sliderWrapper.classList.add("has-custom-width"),t.sliderContainer&&(t.sliderContainer.classList.add("has-custom-width"),"main"===n.section&&(o<96?t.sliderContainer.style.setProperty("--slider-container-min-width",`${o}px`):t.sliderContainer.style.removeProperty("--slider-container-min-width")))}else"string"==typeof e&&(t.sliderWrapper.style.setProperty("width",e),t.sliderWrapper.classList.add("has-custom-width"),t.sliderContainer&&t.sliderContainer.classList.add("has-custom-width"))}}catch(e){}try{const e=n.subButton?.custom_height;if(null!=e&&""!==e){const n=Number(e);!Number.isNaN(n)&&n>0&&(t.sliderWrapper.style.setProperty("--bubble-sub-slider-height",`${n}px`),t.sliderWrapper.style.setProperty("height",`${n}px`),t.sliderContainer&&t.sliderContainer.style.setProperty("height",`${n}px`))}else t.sliderWrapper.style.removeProperty("--bubble-sub-slider-height"),t.sliderWrapper.style.removeProperty("height"),t.sliderContainer&&t.sliderContainer.style.removeProperty("height")}catch(e){}t.sliderWrapper.classList.remove("is-hidden"),t.classList.add("inline-slider-host"),t.sliderOpen=!0;try{t.classList.remove("bubble-action","bubble-action-enabled")}catch(e){}if(t.haRipple){try{t.removeChild(t.haRipple)}catch(e){}try{delete t.haRipple}catch(e){}}if(t.sliderCloseBtn&&(t.sliderCloseBtn.style.display="none"),t._outsideClickListenerAdded&&t._outsideClickHandler){try{document.removeEventListener("click",t._outsideClickHandler,!1)}catch(e){}try{delete t._outsideClickHandler}catch(e){}t._outsideClickListenerAdded=!1}h(t)}else{if(t.sliderAlwaysVisible=!1,t.setAttribute("no-slide",""),t.classList.remove("inline-slider-host"),!t.sliderToggleAdded){if(t.addEventListener("click",n=>{n.stopPropagation(),t.sliderOpen?f(e,t):function(e,t){if(!t.sliderWrapper)return;const n=t._parentGroupContainer;n&&n.classList?n.classList.add("group-slider-open"):g(e,!0),t.sliderWrapper.classList.remove("is-hidden"),t.sliderOpen=!0,m(t,!0),function(e,t){if(!t||t._globalBlockerAdded)return;const n=n=>{if(!t.sliderOpen||t.sliderAlwaysVisible)return;const o=n.target,i=function(e,t){return e.sliderWrapper&&e.sliderWrapper.contains(t)||e.sliderContainer&&e.sliderContainer.contains(t)||e.sliderCloseBtn&&e.sliderCloseBtn.contains(t)}(t,o)||b(t,n),a=n.type;if("pointerdown"!==a&&"touchstart"!==a&&"mousedown"!==a){if("pointerup"===a||"touchend"===a||"mouseup"===a||"click"===a){const o=!0===t._blockerPointerDownInside,a=!(!t.sliderContext||!t.sliderContext.dragging);if(i||o||a)return;try{n.preventDefault()}catch(e){}n.stopPropagation();try{n.stopImmediatePropagation()}catch(e){}return void f(e,t)}}else if(t._blockerPointerDownInside=!!i,!i){try{n.preventDefault()}catch(e){}n.stopPropagation();try{n.stopImmediatePropagation()}catch(e){}}},o=["pointerdown","pointerup","click","touchstart","touchend","mousedown","mouseup"];o.forEach(e=>document.addEventListener(e,n,!0)),t._globalBlockerAdded=!0,t._globalBlockerHandler=n,t._globalBlockerEvents=o}(e,t)}(e,t)}),t.sliderCloseBtn){const n=n=>{n.preventDefault(),n.stopPropagation();try{n.stopImmediatePropagation()}catch(e){}f(e,t)};try{t.sliderCloseBtn.removeEventListener("click",t._closeHandler),t.sliderCloseBtn.removeEventListener("touchend",t._closeHandler)}catch(e){}t.sliderCloseBtn.addEventListener("click",n),t.sliderCloseBtn.addEventListener("touchend",n),t.sliderCloseBtn.addEventListener("touchstart",e=>{e.preventDefault(),e.stopPropagation()},{passive:!1}),t._closeHandler=n}t.sliderToggleAdded=!0}const o=!!n.overlayAtCardLevel,i=e.elements.cardWrapper||e.elements.mainContainer||e.content,a=o?i:n.groupContainer||i;if(t.sliderWrapper.parentNode!==a){try{t.sliderWrapper.parentNode?.removeChild(t.sliderWrapper)}catch(e){}a.appendChild(t.sliderWrapper)}t.sliderWrapper.classList.remove("inline"),t.sliderContainer.classList.remove("inline"),t.sliderWrapper.classList.remove("fill-width"),t.sliderContainer.classList.remove("fill-width");try{t._parentGroupContainer=o?null:n.groupContainer||null}catch(e){}}if(n.alwaysVisible){if(t._outsideClickListenerAdded&&t._outsideClickHandler){try{document.removeEventListener("click",t._outsideClickHandler,!1)}catch(e){}try{delete t._outsideClickHandler}catch(e){}t._outsideClickListenerAdded=!1}}else if(!t._outsideClickListenerAdded){const n=n=>{if(!t.sliderOpen||t.sliderAlwaysVisible)return;const o=n.target,i=t.sliderContainer&&t.sliderContainer.contains(o)||b(t,n),a=!0===t._blockerPointerDownInside,r=!(!t.sliderContext||!t.sliderContext.dragging);i||t.contains&&t.contains(o)||a||r||f(e,t)};document.addEventListener("click",n,{passive:!0}),t._outsideClickListenerAdded=!0,t._outsideClickHandler=n}try{t.sliderCloseBtn&&(n.overlayAtCardLevel?t.sliderCloseBtn.classList.add("top-aligned"):t.sliderCloseBtn.classList.remove("top-aligned")),t.sliderWrapper&&(n.overlayAtCardLevel?t.sliderWrapper.classList.add("top-aligned"):t.sliderWrapper.classList.remove("top-aligned"))}catch(e){}!function(e,t){if(!e||!t)return;const n=null!=t.index?String(t.index).replace(/_/g,"-"):null,o=e.dataset?.sliderIndexClass;if(n){const t=`bubble-sub-button-slider-${n}`;o&&o!==t&&e.classList.remove(o),e.classList.add(t),e.dataset.sliderIndexClass=t}else o&&(e.classList.remove(o),delete e.dataset.sliderIndexClass);const a=(0,i.mp)(t.subButton?.name),r=e.dataset?.sliderNameClass;r&&r!==a&&e.classList.remove(r),a?(e.classList.add(a),e.dataset.sliderNameClass=a):r&&delete e.dataset.sliderNameClass}(t.sliderContainer,n)}function v(e,t,n){(0,r.gQ)(t,n.subButton),(0,r.L)(t,n.subButton,n.section||"main",n.groupContainer||null),(0,r.uH)(t,n.subButton),"slider"===n.subButtonType?function(e,t,n){const o=(0,r.nu)(n,e,t);(0,r.Y1)(t,n);const i=t._previousDisplayedState,a=t._previousState,l=n.state?.state,c=i!==o,d=a!==l;t._previousDisplayedState=o,t._previousState=l,(c||d||void 0===i)&&((0,r.rz)(t,n),(0,r.m_)(t,n,o),t.nameContainer&&(0,r.NH)(e,t.nameContainer,o,n.subButton));const p=n.subButton?.light_slider_type??n.light_slider_type;let b;if(b="hue"===p?n.subButton?.icon||"mdi:palette":"saturation"===p?n.subButton?.icon||"mdi:contrast-circle":"white_temp"===p?n.subButton?.icon||"mdi:thermometer":n.icon,n.showIcon&&b){let e=t.icon;if(e||(e=document.createElement("ha-icon"),e.classList.add("bubble-sub-button-icon"),e.classList.add("show-icon"),t.appendChild(e),t.icon=e),e.icon!==b){e.setAttribute("icon",b);try{e.icon=b}catch(e){}}(0,s.jA)(e,o)}else t.icon&&(t.icon.classList.remove("show-icon"),t.icon.classList.add("hidden"));if(t.icon?.getAttribute("icon")!==t.icon?.icon)try{t.icon.icon=t.icon.getAttribute("icon")}catch(e){}y(e,t,n);const h=!(!n.alwaysVisible||!n.subButton?.show_button_info);h&&t.icon&&t.sliderInfoWrapper?t.icon.parentNode!==t.sliderInfoWrapper&&t.sliderInfoWrapper.appendChild(t.icon):t.icon&&!h&&t.icon.parentNode!==t&&t.appendChild(t.icon),t.sliderContext&&(t.sliderContext._hass=e._hass,(0,u.VM)(t.sliderContext))}(e,t,n):"select"===n.subButtonType||!n.subButton?.sub_button_type&&n.isSelect?function(e,t,n){const{isSelect:o,showArrow:i,entity:a,subButton:d}=n;o&&t.dropdownSelect&&(function(e,t,n){const o=e._hass.states[n]?.state,i=e.previousValues[n]?.state;o!==i&&(o&&t.dropdownSelect&&t.dropdownSelect.value!==o&&(t.dropdownSelect.value=o,t.dropdownSelect.dispatchEvent(new Event("change",{bubbles:!0}))),e.previousValues[n]={state:o})}(e,t,a),(0,l.O)(e,t,a,d),function(e,t){e.style.removeProperty("padding"),t?(e.dropdownArrow.style.display="",e.dropdownContainer.style.width="24px"):(e.dropdownArrow.style.display="none",e.dropdownContainer.style.width="0px")}(t,i));const u=(0,r.nu)(n,e,t);(0,r.Y1)(t,n);const p=t._previousDisplayedState,b=t._previousState,h=n.state?.state,m=p!==u,g=b!==h;t._previousDisplayedState=u,t._previousState=h,(m||g||void 0===p)&&((0,r.rz)(t,n),(0,r.m_)(t,n,u),t.nameContainer&&(0,r.NH)(e,t.nameContainer,u,n.subButton));const f=!(!o||!t.dropdownSelect)&&Array.from(t.dropdownSelect.children).find(e=>e.hasAttribute("selected"))?.value,y=t._prevSelectedOption,v=t._prevConfigIcon,_=y!==f,w=v!==n.icon;t._prevSelectedOption=f,t._prevConfigIcon=n.icon,(0,s.DK)(t,n,u,{beforeIconUpdate:(n,o)=>{if(_||w||void 0===y)if(f){const i=(0,c.z_)(e,o.state,o.subButton.select_attribute,f);if(i&&!o.subButton.icon)return n.tagName!==i.tagName||n.icon!==i.icon||n.getAttribute?.("attribute")!==i.getAttribute?.("attribute")||n.getAttribute?.("attributeValue")!==i.getAttribute?.("attributeValue")?(t.replaceChild(i,n),t.icon=i,i):n;n.icon!==o.icon&&n.setAttribute("icon",o.icon)}else n.icon!==o.icon&&n.setAttribute("icon",o.icon);return n}}),t.icon?.getAttribute("icon")!==t.icon?.icon&&t.icon.setAttribute("icon",t.icon.icon)}(e,t,n):function(e,t,n){const o=(0,r.nu)(n,e,t);(0,r.Y1)(t,n);const i=t._previousDisplayedState,a=t._previousState,l=n.state?.state,c=i!==o,d=a!==l;t._previousDisplayedState=o,t._previousState=l,(c||d||void 0===i)&&((0,r.rz)(t,n),(0,r.m_)(t,n,o),t.nameContainer&&(0,r.NH)(e,t.nameContainer,o,n.subButton)),(0,s.DK)(t,n,o),t.icon?.getAttribute("icon")!==t.icon?.icon&&t.icon.setAttribute("icon",t.icon.icon)}(e,t,n)}function _(e){const t=(0,r.mg)(e.config),n=Array.isArray(t.main)?t.main:[],o=Array.isArray(t.bottom)?t.bottom:[],i=[];return n.filter(e=>e&&!Array.isArray(e.group)).forEach(t=>{const n=t.entity??e.config.entity,o=e._hass.states[n];i.push(o?.state??"unknown")}),[...n.filter(e=>e&&Array.isArray(e.group)).map(e=>e.group),...o.filter(e=>e&&Array.isArray(e.group)).map(e=>e.group)].forEach(t=>{t.forEach(t=>{if(t){const n=t.entity??e.config.entity,o=e._hass.states[n];i.push(o?.state??"unknown")}})}),i}function w(e,t=e.config.sub_button){!function(e){e.elements&&Object.keys(e.elements).forEach(t=>{const n=e.elements[t];n&&n.sliderContext&&n.sliderContext.config&&(n.sliderContext._hass=e._hass,(0,u.VM)(n.sliderContext))}),e.elements&&e.elements.groups&&Object.values(e.elements.groups).forEach(t=>{t.buttons&&Object.values(t.buttons).forEach(t=>{t&&t.sliderContext&&t.sliderContext.config&&(t.sliderContext._hass=e._hass,(0,u.VM)(t.sliderContext))})})}(e),function(e,t){if(!t)return;let n;n=Array.isArray(t)?{main:t,bottom:[]}:(0,r.lc)(t)?t:(0,r.zD)(t||[]),e.previousValues=e.previousValues||{},(Array.isArray(n.main)?n.main:[]).filter(e=>e&&!Array.isArray(e.group)),e.previousValues.mainSubButtons;const s=Array.isArray(n.bottom)?n.bottom:[],l=e.config?.sub_button?.main_layout??"inline",c=(Array.isArray(n.main)?n.main:[]).some(e=>e&&Array.isArray(e.group)&&e.group.length>0),d=s.some(e=>e&&Array.isArray(e.group)&&e.group.length>0),u=s.some(e=>e&&!Array.isArray(e.group));let p=1;"rows"===l||c||u||d||(Array.isArray(n.main)?n.main:[]).forEach(t=>{if(!t||Array.isArray(t.group))return;const n=(0,r.H2)(e,t,p);if("fan_modes"===n.attributeType&&null==n.attribute){let a=e.elements[n.index];if(!a){const e=["bubble-sub-button",`bubble-sub-button-${n.index}`];if(t?.name){const n=(0,i.mp)(t.name);n&&e.push(n)}a=(0,o.n)("div",e.join(" "))}return a.classList.add("hidden"),void p++}let a=e.elements[n.index];const s="slider"===n.subButtonType&&n.alwaysVisible;a?s&&a.parentElement&&a.parentElement.removeChild(a):a=(0,i.nE)(e,n.index,n.isSelect,n.showArrow,n.entity,t,null,{attachToDom:!s}),s||a.isConnected||!e.elements.subButtonContainer||e.elements.subButtonContainer.appendChild(a),(0,r.pZ)(a,t,e)||(v(e,a,{...n,subButton:t,groupContainer:null,section:"main"}),(0,r.Zu)(a,t,e._hass,e)),p++}),function(e,t){let n;e.elements.groups=e.elements.groups||{},e.previousValues=e.previousValues||{},e.previousValues.groupButtons=e.previousValues.groupButtons||{},n=Array.isArray(t)?{main:t,bottom:[]}:t&&(Array.isArray(t.main)||Array.isArray(t.bottom))?t:(0,r.mg)(e.config);const o=(Array.isArray(n.main)?n.main:[]).filter(e=>e&&!Array.isArray(e.group)),a=(Array.isArray(n.bottom)?n.bottom:[]).filter(e=>e&&!Array.isArray(e.group)),s=(Array.isArray(n.main)?n.main:[]).map((e,t)=>({key:`g_main_${t}`,position:"top",item:e})).filter(({item:e})=>e&&Array.isArray(e.group)&&e.group.length>0),l=(Array.isArray(n.bottom)?n.bottom:[]).map((e,t)=>({key:`g_bottom_${t}`,position:"bottom",item:e})).filter(({item:e})=>e&&Array.isArray(e.group)&&e.group.length>0),c=e.config?.sub_button?.main_layout??"inline",d=e.config?.sub_button?.bottom_layout??"inline",u=o,p=s.length>0,b="rows"===c||p||a.length>0||l.length>0;let h=[];u.length>0&&b&&(h=[{key:"g_main_auto",position:"top",item:{group:u,buttons_layout:"inline"}}]);const m=(Array.isArray(n.bottom)?n.bottom:[]).filter(e=>e&&Array.isArray(e.group)&&e.group.length>0);let g=[];a.length>0&&(m.length>0?a.forEach((e,t)=>{g.push({key:`g_bottom_individual_${t}`,position:"bottom",item:{group:[e],buttons_layout:"inline"}})}):g=[{key:"g_bottom_auto",position:"bottom",item:{group:a,buttons_layout:"inline"}}]);const f=[...s,...h,...l,...g].map(({key:e,position:t,item:n})=>({key:e,group:{buttons:n.group,position:t,justify_content:n.justify_content,group_layout:"bottom"===t?d:c,display:n.buttons_layout}}));let y=h.length>0?1:o.length+1;f.forEach(({key:t,group:n})=>{if(!n||!Array.isArray(n.buttons))return;e.elements.groups[t]||(e.elements.groups[t]={buttons:{}}),e.previousValues.groupButtons[t]||(e.previousValues.groupButtons[t]=[]);const o=e.elements.groups[t],a=o.container;if(!a)return;const s=n.buttons.filter(e=>e&&!e.fill_width&&null!=e.width&&""!==e.width).length;s>0&&a.classList.contains("display-inline")?a.dataset.totalButtonsWithWidth=s.toString():delete a.dataset.totalButtonsWithWidth,n.buttons.forEach((s,l)=>{if(!s)return;const c=y;y++;const d=`${t}_button_${l}`,u=(0,r.H2)(e,s,c),p="slider"===u.subButtonType&&u.alwaysVisible;let b=o.buttons?o.buttons[d]:null;if(b){const e=`bubble-sub-button-${String(c).replace(/_/g,"-")}`,t=Array.from(b.classList).find(e=>e.startsWith("bubble-sub-button-")&&"bubble-sub-button"!==e);t!==e&&(t&&b.classList.remove(t),b.classList.add(e))}else b=(0,i.nE)(e,c,u.isSelect,u.showArrow,u.entity,s,a,{attachToDom:!p}),o.buttons||(o.buttons={}),o.buttons[d]=b;if(p&&b.parentElement?b.parentElement.removeChild(b):p||b.isConnected||!a||a.appendChild(b),(0,r.pZ)(b,s,e))return;const h="top"===(n.position||"top")&&"slider"===s.sub_button_type&&!s.always_visible,m="bottom"===(n.position||"top"),g=m?{...s,fill_width:null==s.fill_width||s.fill_width}:s,f=m?"bottom":"main";v(e,b,{...u,subButton:g,groupContainer:a,overlayAtCardLevel:h,section:f}),(0,r.Zu)(b,s,e._hass,e)}),function(e){if(!e)return;const t=Array.from(e.querySelectorAll(".bubble-sub-button")),n=Array.from(e.querySelectorAll(".bubble-sub-slider-wrapper.inline")),o=0===t.length||t.every(e=>e.classList.contains("hidden")||"none"===e.style.display),i=n.some(e=>"none"!==e.style.display&&!e.classList.contains("hidden")),a=o&&!i;e.classList.toggle("hidden",a)}(a),(0,i.cj)(a)})}(e,n),(0,a.iJ)(e)}(e,t),function(e){Array.isArray(e.subButtonIcon)||(e.subButtonIcon=[]);("pop-up"===e.config.card_type?e.popUp:e.content).querySelectorAll(".bubble-sub-button-icon").forEach((t,n)=>{e.subButtonIcon[n]=t}),e.elements&&e.elements.groups&&Object.values(e.elements.groups).forEach(t=>{t.container&&t.container.querySelectorAll(".bubble-sub-button-icon").forEach(t=>{e.subButtonIcon.push(t)})})}(e)}},868:(e,t,n)=>{n.d(t,{G:()=>c,m:()=>d});var o=n(888),i=n(241),a=n(264),r=n(716),s=n(382);function l(e){try{e._processedSchemas&&(e._processedSchemas={}),e._schemaCache?Object.keys(e._schemaCache).forEach(t=>{delete e._schemaCache[t]}):e._schemaCache={},e.lastEvaluatedStyles="",e.card&&"function"==typeof e.handleCustomStyles&&e.handleCustomStyles(e,e.card),(0,r.rC)(e,"editor-refresh",{}),e.requestUpdate(),setTimeout(()=>{e.card&&"function"==typeof e.handleCustomStyles&&e.handleCustomStyles(e,e.card),e.requestUpdate(),setTimeout(()=>{if(e._config){const t={...e._config};e.stylesYAML&&(e.stylesYAML=null,document.dispatchEvent(new CustomEvent("yaml-modules-updated"))),(0,r.rC)(e,"config-changed",{config:t}),e.card&&"function"==typeof e.handleCustomStyles&&e.handleCustomStyles(e,e.card)}e.requestUpdate()},100)},50)}catch(e){}}async function c(e,t){try{let c="";if(t.yamlContent&&""!==t.yamlContent.trim()?c=t.yamlContent:t.description&&""!==t.description.trim()&&(c=t.description),!c)throw new Error("No YAML content found for this module");const d=(0,a.oV)(c)||t.id,u=(0,a.tF)(c,d,{title:t.name,defaultCreator:t.creator});let p=c;try{const e=s.Ay.load(c);if(e&&"object"==typeof e){const n=Object.keys(e);if(1===n.length){const o=n[0],i=e[o];if(i&&"object"==typeof i)if(i[d]){t.moduleLink&&"object"==typeof i[d]&&(i[d].link=t.moduleLink);const e={};e[d]=i[d],p=s.Ay.dump(e,{indent:2,lineWidth:-1,noRefs:!0,noCompatMode:!0})}else if(o===d&&Object.keys(i).some(e=>"object"==typeof i[e]&&i[e].name&&i[e].code)){const e={};Object.entries(i).forEach(([t,n])=>{"object"==typeof n&&"unsupported"!==t&&"editor"!==t&&n.name||(e[t]=n)}),t.moduleLink&&(e.link=t.moduleLink),e.code&&"string"==typeof e.code&&(e.code=e.code.replace(/\n/g,"\n "));const n={};n[d]=e,p=s.Ay.dump(n,{indent:2,lineWidth:-1,noRefs:!0,noCompatMode:!0,flowLevel:-1})}else if(o===d)t.moduleLink&&!e[d].link&&(e[d].link=t.moduleLink),p=s.Ay.dump(e,{indent:2,lineWidth:-1,noRefs:!0,noCompatMode:!0,flowLevel:-1});else{t.moduleLink&&(i.link=t.moduleLink);const e={};e[d]=i,p=s.Ay.dump(e,{indent:2,lineWidth:-1,noRefs:!0,noCompatMode:!0,flowLevel:-1})}}else{t.moduleLink&&(e.link=t.moduleLink);const n={};n[d]=e,p=s.Ay.dump(n,{indent:2,lineWidth:-1,noRefs:!0,noCompatMode:!0,flowLevel:-1})}p=p.replace(/code: \|/g,"code: |").replace(/description: \|/g,"description: |").replace(/(\|\n)(\s+)/g,(e,t,n)=>t+" ");try{const e=s.Ay.load(p);e&&e[d]||console.warn("Warning: YAML formatting may have issues")}catch(e){console.warn("Error validating formatted YAML:",e),p=c}}}catch(e){console.warn("Error processing YAML structure:",e)}const b=p;o.Ki.set(d,u);try{o.sq.set(d,"entity")}catch(e){}document.dispatchEvent(new CustomEvent("yaml-modules-updated")),function(e,t){try{window.dispatchEvent(new CustomEvent("bubble-card-module-updated",{detail:{moduleId:e,moduleData:t}}))}catch(e){}}(d,u);try{const t=await Promise.resolve().then(n.bind(n,134));return await t.ensureBCTProviderAvailable(e.hass)?(await t.writeModuleYaml(e.hass,d,b),document.dispatchEvent(new CustomEvent("yaml-modules-updated")),(0,i.qk)(e,"Module installed successfully")):(0,i.qk)(e,"Install Bubble Card Tools to save modules persistently","warning"),(0,r.rC)(e,"config-changed",{config:e._config}),l(e),e.requestUpdate(),{success:!0,moduleId:d}}catch(t){return console.error("Persistence error:",t),(0,i.qk)(e,"Module saved locally only","warning"),l(e),{success:!0,storage:"local_only",moduleId:d}}}catch(t){throw console.error("Installation error:",t),(0,i.qk)(e,"Installation error: "+t.message,"error"),t}}async function d(e,t,o){try{if(!t||""===t.trim())throw new Error("No YAML content provided");if(o)try{const{extractYamlFromMarkdown:e}=await Promise.resolve().then(n.bind(n,264)),i=e("```yaml\n"+t+"\n```",o);i&&i!==t&&(t=i)}catch(e){console.warn("Could not add link directly to YAML:",e)}const i={yamlContent:t,description:t,moduleLink:o};return await c(e,i)}catch(t){throw console.error("Manual module installation error:",t),(0,i.qk)(e,"Installation error: "+t.message,"error"),t}}},880:(e,t,n)=>{n.d(t,{N$:()=>a,R:()=>i,cH:()=>r});var o=n(716);function i(e){let t="";const n=e._hass.states[e.config.entity],o=n.attributes.hvac_action,i=n.state,a="heating"===o||"heat"===i&&e.config.state_color,r="cooling"===o||"cool"===i&&e.config.state_color,s="off"!==i&&"unknown"!==i;switch(i){case"fan_only":t="var(--bubble-state-climate-fan-only-color, var(--state-climate-fan-only-color, var(--state-climate-active-color, var(--state-active-color))))";break;case"dry":t="var(--bubble-state-climate-dry-color, var(--state-climate-dry-color, var(--state-climate-active-color, var(--state-active-color))))";break;default:t=r?"var(--bubble-state-climate-cool-color, var(--state-climate-cool-color, var(--state-climate-active-color, var(--state-active-color))))":a?"var(--bubble-state-climate-heat-color, var(--state-climate-heat-color, var(--state-climate-active-color, var(--state-active-color))))":s&&e.config.state_color?"auto"===i?"var(--bubble-state-climate-auto-color, var(--state-climate-auto-color, var(--state-climate-active-color, var(--state-active-color))))":"heat_cool"===i?"var(--bubble-state-climate-heat-cool-color, var(--state-climate-heat-cool-color, var(--state-climate-active-color, var(--state-active-color))))":"var(--bubble-climate-accent-color, var(--bubble-accent-color, var(--accent-color)))":""}return t}function a(e,t){const n=e._hass,o=n?.states?.[e.config.entity],i="°C"===n?.config?.unit_system?.temperature,a=t??e.config.step??o?.attributes?.target_temp_step??(i?.5:1);return Number.isInteger(Number(a))?0:1}function r(e,t,n){const i=a(t,n),r=(0,o.$z)(t._hass),s=t._hass?.locale?.language||"en-US";return(0,o.IU)(e,i,r,s)}},888:(e,t,n)=>{n.d(t,{wv:()=>x,sq:()=>g,nO:()=>w,Ki:()=>f});var o=n(134),i=n(382);const a="/local/bubble/";let r=null;function s(){if(r)return r;const e=new i.ZU("!include",{kind:"scalar",resolve:e=>"string"==typeof e&&e.trim().length>0,construct:e=>{const t=function(e){if("undefined"==typeof XMLHttpRequest)return console.warn("Bubble Card - XMLHttpRequest is unavailable, skipping !include resolution."),null;const t=(n=e)&&"string"==typeof n?n.trim().replace(/^\.\/+/,"").replace(/^\/+/,""):"";var n;if(!t)return null;const o=`${a}${t}`;try{const e=new XMLHttpRequest;if(e.open("GET",o,!1),e.send(null),200===e.status)return e.responseText;console.error(`Bubble Card - Unable to resolve !include (${o}): HTTP ${e.status}`)}catch(e){console.error(`Bubble Card - Error while loading included YAML (${o}):`,e)}return null}(e);if(!t||!t.trim())return null;try{return i.Hh(t,{schema:s()})}catch(t){return console.error(`Bubble Card - Error parsing included YAML (${e}):`,t),null}}});return r=i.my.extend([e]),r}function l(e){if(!e||"string"!=typeof e)return null;try{return i.Hh(e,{schema:s()})}catch(e){return console.error("Bubble Card - YAML parsing error:",e),null}}const c=["modules","friendly_name","last_updated"],d=["name","code","description","editor","version","creator","link","supported","unsupported","is_global"];function u(e,t,n){var o;t&&"string"==typeof t&&n&&"object"==typeof n&&(o=n)&&"object"==typeof o&&d.some(e=>e in o)&&e.set(t,{id:t,...n})}async function p(e){try{if(!await(0,o.ensureBCTProviderAvailable)(e))return!1;if(await(0,o.isMigrationDone)(e))return!1;try{if((await(0,o.listFiles)(e)).filter(e=>e?.name&&e.name.startsWith("modules/")&&/\.ya?ml$/i.test(e.name)).length>0)return await(0,o.setMigrationDone)(e,{detected:"files_exist"}),document.dispatchEvent(new CustomEvent("yaml-modules-updated")),!0}catch(e){}const t=await async function(e){try{const t="sensor.bubble_card_modules",n=e?.states?.[t];if(!n)return new Map;const o=n.attributes?.modules;if(!o||"object"!=typeof o)return new Map;const i=new Map;return Object.values(o).forEach(e=>{if(!e)return;const t=e.id||null;let n=null;try{if("string"==typeof e.yaml&&e.yaml.trim()){const o=l(e.yaml);if(o&&"object"==typeof o){const e=Object.keys(o);if(1===e.length){const t=e[0];n={id:t,...o[t]||{}}}else t&&o[t]&&"object"==typeof o[t]&&(n={id:t,...o[t]})}}}catch(e){}if(!n){const o={};["name","version","creator","description","supported","unsupported","code","editor","link","is_global"].forEach(t=>{t in e&&(o[t]=e[t])}),t&&(o.id=t),Object.keys(o).length>0&&(n=o)}if(n&&(n.id||t)){const e=n.id||t;i.set(e,{...n,id:e})}}),i}catch(e){return new Map}}(e),n=await async function(){try{const e=`/local/bubble/bubble-modules.yaml?v=${Date.now()}`,t=await fetch(e,{cache:"no-store"});if(!t.ok)return new Map;const n=await t.text();if(!n||!n.trim())return new Map;const o=l(n);return o&&"object"==typeof o?function(e){const t=new Map;return e&&"object"==typeof e?(Object.keys(e).forEach(n=>{c.includes(n)||u(t,n,e[n])}),e.modules&&"object"==typeof e.modules&&Object.keys(e.modules).forEach(n=>{u(t,n,e.modules[n])}),t):t}(o):new Map}catch(e){return new Map}}(),i=new Map(n);t.forEach((e,t)=>{i.set(t,e)});let a=0;for(const[t,n]of i.entries()){if(!t||"string"!=typeof t)continue;try{const n=await(0,o.readFile)(e,`modules/${t}.yaml`);if(n&&"string"==typeof n.content)continue}catch(e){}const i={...n};delete i.id,await(0,o.writeModuleYaml)(e,t,i),a++}return await(0,o.setMigrationDone)(e,{entity_count:t.size,yaml_count:n.size,written_count:a}),document.dispatchEvent(new CustomEvent("yaml-modules-updated")),!0}catch(e){return!1}}let b=null,h=!1,m=null,g=new Map,f=new Map,y=new Map;document.addEventListener("yaml-modules-updated",()=>{h=!1,b=null,m=null;try{window.dispatchEvent(new CustomEvent("bubble-card-modules-changed"))}catch(e){}}),window.addEventListener("bubble-card-module-updated",e=>{if(e?.detail?.moduleId&&e?.detail?.moduleData){f.set(e.detail.moduleId,e.detail.moduleData),g.has(e.detail.moduleId)||g.set(e.detail.moduleId,"editor");try{window.dispatchEvent(new CustomEvent("bubble-card-modules-changed"))}catch(e){}}});const v=e=>l(e),_=async e=>{for(const t of e){const e=`${t}?v=${Date.now()}`;try{const n=await fetch(e,{cache:"no-store"});if(!n.ok){try{window.bubbleYamlWarning=!0}catch(e){}continue}const o=await n.text(),i=v(o);return!f.size&&i&&Object.entries(i).forEach(([e,t])=>{"modules"!==e&&"friendly_name"!==e&&"last_updated"!==e&&f.set(e,t)}),y.set(t,i),i}catch(t){console.warn(`Error fetching 'bubble-modules.yaml' from ${e}:`,t);try{window.bubbleYamlWarning=!0}catch(e){}}}return null};function w(e){e.config?.card_type&&!e.stylesYAML&&(e.stylesYAML=h&&b?Promise.resolve(b):x(e))}async function x(e){return h&&b?b:m||(m=(async()=>{try{const t=(0,o.getCachedAggregatedModules)();if(t&&Object.keys(t).length>0)return g.clear(),f.clear(),b={},Object.keys(t).forEach(e=>{"modules"!==e&&"friendly_name"!==e&&"last_updated"!==e&&(b[e]=t[e],f.set(e,t[e]),g.set(e,"file"))}),h=!0,(async()=>{try{if(!await(0,o.ensureBCTProviderAvailable)(e?._hass))return;try{await p(e?._hass)}catch(e){}const t=await(0,o.readAllModules)(e?._hass),n={};if(t.forEach((e,t)=>{"modules"!==t&&"friendly_name"!==t&&"last_updated"!==t&&(n[t]=e)}),JSON.stringify(n)!==JSON.stringify(b)){g.clear(),f.clear(),b={},Object.keys(n).forEach(e=>{b[e]=n[e],f.set(e,n[e]),g.set(e,"file")});try{document.dispatchEvent(new CustomEvent("yaml-modules-updated"))}catch(e){}}}catch(e){}})(),b}catch(e){}if(await(0,o.ensureBCTProviderAvailable)(e?._hass)){try{await p(e?._hass)}catch(e){console.warn("Bubble Card - Migration check failed:",e)}const t=(0,o.getCachedAggregatedModules)();if(t&&Object.keys(t).length>0)return g.clear(),f.clear(),b={},Object.keys(t).forEach(e=>{"modules"!==e&&"friendly_name"!==e&&"last_updated"!==e&&(b[e]=t[e],f.set(e,t[e]),g.set(e,"file"))}),h=!0,(async()=>{try{const t=await(0,o.readAllModules)(e?._hass),n={};if(t.forEach((e,t)=>{"modules"!==t&&"friendly_name"!==t&&"last_updated"!==t&&(n[t]=e)}),JSON.stringify(n)!==JSON.stringify(b)){g.clear(),f.clear(),b={},Object.keys(n).forEach(e=>{b[e]=n[e],f.set(e,n[e]),g.set(e,"file")});try{document.dispatchEvent(new CustomEvent("yaml-modules-updated"))}catch(e){}}}catch(e){}})(),b;const n=await(0,o.readAllModules)(e?._hass);return g.clear(),f.clear(),b={},n.forEach((e,t)=>{"modules"!==t&&"friendly_name"!==t&&"last_updated"!==t&&(b[t]=e,f.set(t,e),g.set(t,"file"))}),h=!0,b}const t=await _(["/local/bubble/bubble-modules.yaml"]),n=e?._hass?await async function(e){const t=e?.states?.["sensor.bubble_card_modules"];if(!t)return{};if(!t.attributes?.modules)return{};const n={};try{Object.values(t.attributes.modules).forEach(e=>{try{if(!e.yaml&&(e.code||e.description))return void(n[e.id]=e);if(!e.yaml)return}catch(t){console.error(`❌ YAML parsing error for module ${e.id}:`,t),"string"==typeof e.yaml?console.error("Problematic YAML content:",e.yaml.substring(0,100)+"..."):console.error("Problematic YAML content type:",typeof e.yaml)}})}catch(e){console.error("Error while processing modules from text entity:",e)}return n}(e._hass):{};return g.clear(),t&&Object.keys(t).forEach(e=>{"modules"!==e&&"friendly_name"!==e&&"last_updated"!==e&&g.set(e,"yaml")}),n&&Object.keys(n).forEach(e=>{"modules"!==e&&"friendly_name"!==e&&"last_updated"!==e&&g.set(e,"entity")}),b={...t||{},...n||{}},f.clear(),Object.entries(b).forEach(([e,t])=>{"modules"!==e&&"friendly_name"!==e&&"last_updated"!==e&&f.set(e,t)}),h=!0,b})(),m)}},933:(e,t,n)=>{n.d(t,{TL:()=>l,XY:()=>u,_O:()=>d,a7:()=>i,bx:()=>a,yh:()=>s});var o=n(888);function i(e){const t=o.Ki.get(e)||{};let n=t.name||e,i=t.description||"",a=t.editor||[],r=t.supported||[],s=t.unsupported||[],l=t.creator||t.author||"",c=t.link||"",d=t.version||"";return"string"==typeof a&&(a=o.Ki.get(a)?.editor||[]),Array.isArray(a)||(a=[a]),Array.isArray(r)||(r=[r]),Array.isArray(s)||(s=[s]),s.length>0&&0===r.length&&(r=["button","climate","cover","horizontal-buttons-stack","media-player","pop-up","select","separator","sub-buttons"].filter(e=>!s.includes(e))),{name:n,description:i,formSchema:a,supportedCards:r,unsupportedCard:s,moduleVersion:d,creator:l,moduleLink:c}}function a(e){if(!e)return"No description available";try{const t=/Description:\s*([^\n]+)/i,n=e.match(t);if(n&&n[1]){const e=s(n[1].trim());if(e&&e.length>5)return r(e)}const o=/description:\s*\|([\s\S]*?)(?=\n\s*\w+:|$)/i,i=e.match(o);if(i&&i[1]){const e=i[1].trim().split(/\n{2,}/)[0].trim();if(e&&e.length>5)return r(s(e))}const a=/description:\s*["']([^"']+)["']/i,l=e.match(a);if(l&&l[1]){const e=s(l[1].trim());if(e&&e.length>5)return r(e)}const c=/description:\s*([^\n\r]+)/i,d=e.match(c);if(d&&d[1]){const e=s(d[1].trim());if(e&&e.length>5)return r(e)}const u=e.split("\n");let p=!1,b=[];for(let e=0;e")||t.includes("yaml")||t.match(/^\s*[a-z_]+:/i))continue;if(t.length>10&&!t.includes("Supported")&&(b.push(t),b.join(" ").length>40))break}}return b.length>0?r(s(b.join(" ").trim())):"string"!=typeof e||e.includes("description:")?"No description available":r(s(e))}catch(e){return console.warn("Error during description formatting:",e),"No description available"}}function r(e){if(!e)return e;const t=e.trim(),n=(e,t)=>e>=0&&(-1===o||e|/i);n(r)&&(o=r,i="html");const s=t.search(/\n|\r\n/);if(n(s)&&(o=s,i="break"),o>=0){let e=t.substring(0,o).trim();if(e.length<5&&t.length>30){const n=t.substring(o+1).search(/[.!?]|\n|
0&&(e=t.substring(0,o+1+n).trim())}return e=e.replace(/<[^>]*>/g,"").trim(),"punct"===i||e.endsWith(".")?e:e+"."}const l=t.replace(/<[^>]*>/g,"").trim();return l.endsWith(".")?l:l+"."}function s(e){return e?e.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/`(.*?)`/g,"$1").replace(/~~(.*?)~~/g,"$1").replace(/\[(.*?)\]\(.*?\)/g,"$1").replace(/<\/?[^>]+(>|$)/g,"").replace(/^#+\s+/gm,"").replace(/\n{3,}/g,"\n\n").trim():""}function l(e){return e.toString().toLowerCase().replace(/\s+/g,"-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}function c(e){return null==e?"":"string"==typeof e?e.trim().replace(/^[vV]/,""):"number"==typeof e?String(e):Array.isArray(e)?e.map(e=>c(e)).filter(Boolean).join("."):"object"==typeof e?"string"==typeof e.version||"number"==typeof e.version?c(e.version):"string"==typeof e.value||"number"==typeof e.value?c(e.value):"":""}function d(e,t){const n=c(e),o=c(t);if(!n||!o)return 0;const i=n.split(".").map(Number),a=o.split(".").map(Number);for(let e=0;en)return 1;if(t{n.d(t,{cu:()=>g,dK:()=>v,kA:()=>w,n$:()=>f,s:()=>_});var o=n(957),i=n(716),a=n(888),r=n(264),s=n(382),l=n(397),c=n(134),d=n(766),u=n(933);function p(e,t,n=null){if(!e._config||!e._config.modules)return;let o=[...e._config.modules];n&&n!==t&&(o=o.filter(e=>e!==n)),o.includes(t)||(o=[...o,t]),e._config.modules=o,e._previousModuleId=t,(0,i.rC)(e,"config-changed",{config:e._config})}function b(e){e.lastEvaluatedStyles="",e.stylesYAML=null,e.handleCustomStyles&&e.card&&e.handleCustomStyles(e,e.card),e.requestUpdate()}function h(e,t){window.dispatchEvent(new CustomEvent("bubble-card-module-updated",{detail:{moduleId:e,moduleData:t}}))}function m(e){try{const t=document.querySelector("body > home-assistant")?.shadowRoot?.querySelector("hui-dialog-edit-card")?.shadowRoot?.querySelector("ha-dialog > div:nth-child(4)");t&&(t.style.display=e?"none":"")}catch(e){}}function g(e){if(!e._editingModule)return m(!1),o.qy``;m(!0);const t=!!d.dn&&(0,d.dn)(e._editingModule.id),g=!!e._yamlErrorMessage,f="string"==typeof e.errorMessage&&e.errorMessage.trim().length>0&&!!e._editingModule,v=g||f,_=t=>{const n=e.shadowRoot?.querySelector("#export-preview-content");if(n){n.textContent=t;const o=e.shadowRoot?.querySelector(".export-preview ha-expansion-panel");o&&!o.expanded&&(o.expanded=!0);const i=e.shadowRoot?.querySelector(".export-preview");i&&(i.style.animation="none",setTimeout(()=>{i.style.animation="highlight 1s ease"},10))}};return o.qy`

${e._showNewModuleForm?"Create new Module":"default"===e._editingModule.id?"Edit Default Module":"Edit Module"}

${t?o.qy`

Read-only Module

This Module is installed from a YAML file. You need to modify the bubble-modules.yaml file directly, or remove it from your YAML file then import it here.

`:""} {const n=e._editingModule.id;e._editingModule.id=t.target.value,e._showNewModuleForm&&e._config.modules&&(p(e,t.target.value,n),(0,i.rC)(e,"config-changed",{config:e._config}))}} ?disabled=${!e._showNewModuleForm||t} > Must be unique and cannot be changed after the Module is created. {e._editingModule.name=t.target.value}} ?disabled=${t} > {e._editingModule.version=t.target.value}} ?disabled=${t} > {e._editingModule.creator=t.target.value}} ?disabled=${t} > Supported cards `} @expanded-changed=${e=>e.stopPropagation()} >
${function(e,t=!1){const n=[{id:"button",name:"Button"},{id:"calendar",name:"Calendar"},{id:"climate",name:"Climate"},{id:"cover",name:"Cover"},{id:"horizontal-buttons-stack",name:"Horizontal buttons stack"},{id:"media-player",name:"Media player"},{id:"pop-up",name:"Pop-up"},{id:"select",name:"Select"},{id:"separator",name:"Separator"},{id:"sub-buttons",name:"Sub-buttons"}],i=n.map(e=>e.id);void 0===e._editingModule.supported&&(e._editingModule.unsupported&&e._editingModule.unsupported.length>0?e._editingModule.supported=i.filter(t=>!e._editingModule.unsupported.includes(t)):e._editingModule.supported=void 0);const a=!e._editingModule.supported||Array.isArray(e._editingModule.supported)&&e._editingModule.supported.length===i.length&&i.every(t=>e._editingModule.supported.includes(t));return o.qy`
{t||(n.target.checked?delete e._editingModule.supported:e._editingModule.supported=[],e.requestUpdate())}} ?disabled=${t} > ${n.map(n=>o.qy` {t||(e._editingModule.supported||(e._editingModule.supported=i.slice()),o.target.checked?(e._editingModule.supported.includes(n.id)||e._editingModule.supported.push(n.id),e._editingModule.supported.length===i.length&&i.every(t=>e._editingModule.supported.includes(t))&&delete e._editingModule.supported):e._editingModule.supported=e._editingModule.supported.filter(e=>e!==n.id),e.requestUpdate())}} ?disabled=${t} > `)}
Select the card types that this module supports.
`}(e,t)}
Description `} @expanded-changed=${e=>e.stopPropagation()} >
{e._editingModule.description=t.detail.value}} >
This description appears in your module and in the Module Store (if you share it), so make sure it's clear and concise. You can use HTML and inline CSS, but note that it will only be rendered in your module, the Module Store will not display it.
Code (CSS/JS template) `} @expanded-changed=${e=>e.stopPropagation()} >
(n=>{if(!e._editingModule||!e._config||t)return;const o=e._editingModule.id;if("function"==typeof e._clearCurrentModuleError&&e._clearCurrentModuleError(o),!e._originalModuleState){const t=a.Ki.get(o);t&&(e._originalModuleState=JSON.parse(JSON.stringify(t)))}e._editingModule.code=n;try{e._moduleCodeDebounce&&clearTimeout(e._moduleCodeDebounce)}catch(e){}e._moduleCodeDebounce=setTimeout(()=>{e.stylesYAML&&(e.stylesYAML=null);const t={...a.Ki.get(o)||{},code:e._editingModule.code,id:o};a.Ki.set(o,t),p(e,o,e._previousModuleId),h(o,t)},140)})(n.detail.value)} >
${e.createErrorConsole(e)} More information and examples about the CSS and JS template possibilities can be found in the Styling and Templates documentation. Tip: You can enlarge the editor by clicking on the panel title (Bubble Card configuration).
Optional: Editor schema (YAML) `} @expanded-changed=${e=>e.stopPropagation()} >
{e._editingModule.editor_raw=n.detail.value,clearTimeout(e._editorSchemaDebounce),e._editorSchemaDebounce=setTimeout(()=>{try{const o=s.Ay.load(n.detail.value);null!==o&&"object"==typeof o&&((n=>{if(e._editingModule&&e._config&&!t)try{const t=e._editingModule.id;if(!e._originalModuleState){const n=a.Ki.get(t);n&&(e._originalModuleState=JSON.parse(JSON.stringify(n)))}const o=e._editingModule.editor_raw;e._editingModule.editor=n,o&&(e._editingModule.editor_raw=o);const r=a.Ki.get(t);if(r){const o={...r,editor:n};a.Ki.set(t,o),e._schemaCache&&delete e._schemaCache[t],e._processedSchemas&&delete e._processedSchemas[t],e.requestUpdate(),setTimeout(()=>{(0,i.rC)(e,"editor-refresh",{}),e.requestUpdate()},50)}}catch(e){console.warn("Error applying live editor schema:",e)}})(o),e._yamlErrorMessage&&(e._yamlErrorMessage=null,e.requestUpdate()))}catch(t){console.warn("Invalid YAML for editor schema:",t),e._editingModule.editor=e._editingModule.editor_raw||n.detail.value,e._yamlErrorMessage=t.message,e.requestUpdate()}},100)}} >

Error in YAML schema

${e._yamlErrorMessage?e._yamlErrorMessage.charAt(0).toUpperCase()+e._yamlErrorMessage.slice(1):""}
This allows you to add a visual editor to your module. Learn about all available editor schema options in the editor schema documentation. ${e._editingModule.editor&&Array.isArray(e._editingModule.editor)&&e._editingModule.editor.length>0?o.qy`

Editor preview

e.label||e.name)} >
`:""}
${!t&&v?o.qy`

Save disabled

${g?o.qy`Fix the error(s) in the Editor schema (YAML) above to enable saving.`:""} ${g&&f?o.qy`
`:""} ${f?o.qy`Fix the error(s) in the CSS/JS template above to enable saving.`:""}

`:""}
Export Module `} @expanded-changed=${e=>e.stopPropagation()} >
e.stopPropagation()} >
Click on a button above to generate the preview

Sharing your Module to the Store

To share your Module to the Module Store, click on Copy for GitHub and paste the content in a new discussion in the Share your Modules category. Edit the description (if needed), the example (for YAML users), and remember to include at least one screenshot for the Module Store.

Your Module becomes available right after that (after a Store refresh), so double-check that everything is correctly written and the Module is working as expected. You can of course edit/update the Module after it is shared.

`}function f(){return[{id:"button",name:"Button"},{id:"calendar",name:"Calendar"},{id:"climate",name:"Climate"},{id:"cover",name:"Cover"},{id:"horizontal-buttons-stack",name:"Horizontal buttons stack"},{id:"media-player",name:"Media player"},{id:"pop-up",name:"Pop-up"},{id:"select",name:"Select"},{id:"separator",name:"Separator"},{id:"sub-buttons",name:"Sub-buttons"}]}function y(e){e._processedSchemas&&(e._processedSchemas={}),e._selectedModuleTab=0,"function"==typeof e._getProcessedSchema&&(e._schemaCache?Object.keys(e._schemaCache).forEach(t=>{delete e._schemaCache[t]}):e._schemaCache={}),e.lastEvaluatedStyles="",e.card&&"function"==typeof e.handleCustomStyles&&e.handleCustomStyles(e,e.card),(0,i.rC)(e,"editor-refresh",{}),e.requestUpdate(),setTimeout(()=>{e.card&&"function"==typeof e.handleCustomStyles&&e.handleCustomStyles(e,e.card),e.requestUpdate(),setTimeout(()=>{if(e._config){const t={...e._config};e.stylesYAML&&(e.stylesYAML=null,document.dispatchEvent(new CustomEvent("yaml-modules-updated"))),(0,i.rC)(e,"config-changed",{config:t}),e.card&&"function"==typeof e.handleCustomStyles&&e.handleCustomStyles(e,e.card)}e.requestUpdate()},100)},50)}function v(e,t){e._originalModuleState=null;const n=a.Ki.get(t);n?(e._editingModule={id:t,...n},m(!0),e._editingModule.code||(e._editingModule.code=""),e._editingModule.editor&&"string"==typeof e._editingModule.editor&&(e._editingModule.editorReference=e._editingModule.editor,e._editingModule.editor=[]),"object"==typeof e._editingModule.editor?e._editingModule.editor_raw=s.Ay.dump(e._editingModule.editor):e._editingModule.editor_raw=e._editingModule.editor||"",e.requestUpdate(),setTimeout(()=>(0,u.XY)(e),0)):console.error(`Module ${t} not found`)}async function _(e,t){if(confirm(`Are you sure you want to delete module "${t}"?`))try{a.Ki.delete(t);try{a.sq.delete(t)}catch(e){}document.dispatchEvent(new CustomEvent("yaml-modules-updated"));let n=!1;try{await(0,c.ensureBCTProviderAvailable)(e.hass)&&(await(0,c.deleteModuleFile)(e.hass,t),document.dispatchEvent(new CustomEvent("yaml-modules-updated")),n=!0)}catch(e){console.warn("File-based deletion failed; keeping changes local only:",e)}e._config&&e._config.modules&&(e._config.modules=e._config.modules.filter(e=>e!==t),(0,i.rC)(e,"config-changed",{config:e._config}),b(e)),y(e),m(!1)}catch(e){console.error("Error deleting module:",e)}finally{m(!1)}}function w(e){if(!e._editingModuleInitialized){e._editingModule=null,e._showNewModuleForm=!1,e._showManualImportForm=!1,e._manualYamlContent="",e._exportContent=null,e._exportType=null,e._exportStep=0,e._schemaCache={},e._processedSchemas={},e._originalModuleState=null,e._previousModuleId=null,e._generateUniqueModuleId=(e="my_module")=>{if(!a.Ki.has(e))return e;let t=1,n=`${e}_${t}`;for(;a.Ki.has(n);)t++,n=`${e}_${t}`;return n};const t=e._generateUniqueModuleId("my_module");e._newModuleTemplate={id:t,name:"My Module",description:"",creator:"",version:"1.0",code:"",editor:""},e._editingModuleInitialized=!0}}},957:(e,t,n)=>{n.d(t,{WF:()=>pe,AH:()=>c,qy:()=>Y,s6:()=>X,XX:()=>de,iz:()=>l});const o=globalThis,i=o.ShadowRoot&&(void 0===o.ShadyCSS||o.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),r=new WeakMap;class s{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(i&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=r.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&r.set(t,e))}return e}toString(){return this.cssText}}const l=e=>new s("string"==typeof e?e:e+"",void 0,a),c=(e,...t)=>{const n=1===e.length?e[0]:t.reduce((t,n,o)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[o+1],e[0]);return new s(n,e,a)},d=(e,t)=>{if(i)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const n of t){const t=document.createElement("style"),i=o.litNonce;void 0!==i&&t.setAttribute("nonce",i),t.textContent=n.cssText,e.appendChild(t)}},u=i?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return l(t)})(e):e,{is:p,defineProperty:b,getOwnPropertyDescriptor:h,getOwnPropertyNames:m,getOwnPropertySymbols:g,getPrototypeOf:f}=Object,y=globalThis,v=y.trustedTypes,_=v?v.emptyScript:"",w=y.reactiveElementPolyfillSupport,x=(e,t)=>e,k={toAttribute(e,t){switch(t){case Boolean:e=e?_:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},C=(e,t)=>!p(e,t),$={attribute:!0,type:String,converter:k,reflect:!1,useDefault:!1,hasChanged:C};Symbol.metadata??=Symbol("metadata"),y.litPropertyMetadata??=new WeakMap;class S extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=$){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),o=this.getPropertyDescriptor(e,n,t);void 0!==o&&b(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){const{get:o,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:o,set(t){const a=o?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??$}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;const e=f(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){const e=this.properties,t=[...m(e),...g(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(u(e))}else void 0!==e&&t.push(u(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return d(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,n);if(void 0!==o&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:k).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(o):this.setAttribute(o,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,o=n._$Eh.get(e);if(void 0!==o&&this._$Em!==o){const e=n.getPropertyOptions(o),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:k;this._$Em=o,this[o]=i.fromAttribute(t,e.type)??this._$Ej?.get(o)??null,this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){const o=this.constructor,i=this[e];if(n??=o.getPropertyOptions(e),!((n.hasChanged??C)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:o,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||void 0!==a)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===o&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e){const{wrapped:e}=n,o=this[t];!0!==e||this._$AL.has(t)||void 0===o||this.C(t,void 0,n,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}}S.elementStyles=[],S.shadowRootOptions={mode:"open"},S[x("elementProperties")]=new Map,S[x("finalized")]=new Map,w?.({ReactiveElement:S}),(y.reactiveElementVersions??=[]).push("2.1.0");const A=globalThis,L=A.trustedTypes,E=L?L.createPolicy("lit-html",{createHTML:e=>e}):void 0,M="$lit$",T=`lit$${Math.random().toFixed(9).slice(2)}$`,B="?"+T,P=`<${B}>`,I=document,O=()=>I.createComment(""),q=e=>null===e||"object"!=typeof e&&"function"!=typeof e,j=Array.isArray,z="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,N=/-->/g,U=/>/g,R=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,F=/"/g,H=/^(?:script|style|textarea|title)$/i,W=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),Y=W(1),K=(W(2),W(3),Symbol.for("lit-noChange")),X=Symbol.for("lit-nothing"),J=new WeakMap,G=I.createTreeWalker(I,129);function Q(e,t){if(!j(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Z=(e,t)=>{const n=e.length-1,o=[];let i,a=2===t?"":3===t?"":"",r=D;for(let t=0;t"===l[0]?(r=i??D,c=-1):void 0===l[1]?c=-2:(c=r.lastIndex-l[2].length,s=l[1],r=void 0===l[3]?R:'"'===l[3]?F:V):r===F||r===V?r=R:r===N||r===U?r=D:(r=R,i=void 0);const u=r===R&&e[t+1].startsWith("/>")?" ":"";a+=r===D?n+P:c>=0?(o.push(s),n.slice(0,c)+M+n.slice(c)+T+u):n+T+(-2===c?t:u)}return[Q(e,a+(e[n]||"")+(2===t?"":3===t?"":"")),o]};class ee{constructor({strings:e,_$litType$:t},n){let o;this.parts=[];let i=0,a=0;const r=e.length-1,s=this.parts,[l,c]=Z(e,t);if(this.el=ee.createElement(l,n),G.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(o=G.nextNode())&&s.length0){o.textContent=L?L.emptyScript:"";for(let n=0;nj(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==X&&q(this._$AH)?this._$AA.nextSibling.data=e:this.T(I.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,o="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=ee.createElement(Q(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(t);else{const e=new ne(o,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=J.get(e.strings);return void 0===t&&J.set(e.strings,t=new ee(e)),t}k(e){j(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,o=0;for(const i of e)o===t.length?t.push(n=new oe(this.O(O()),this.O(O()),this,this.options)):n=t[o],n._$AI(i),o++;o2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=X}_$AI(e,t=this,n,o){const i=this.strings;let a=!1;if(void 0===i)e=te(this,e,t,0),a=!q(e)||e!==this._$AH&&e!==K,a&&(this._$AH=e);else{const o=e;let r,s;for(e=i[0],r=0;r{const o=n?.renderBefore??t;let i=o._$litPart$;if(void 0===i){const e=n?.renderBefore??null;o._$litPart$=i=new oe(t.insertBefore(O(),e),e,void 0,n??{})}return i._$AI(e),i},ue=globalThis;class pe extends S{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=de(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return K}}pe._$litElement$=!0,pe.finalized=!0,ue.litElementHydrateSupport?.({LitElement:pe});const be=ue.litElementPolyfillSupport;be?.({LitElement:pe}),(ue.litElementVersions??=[]).push("4.2.0")}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};let o="v3.1.0";var i=n(642),a=n(888),r=n(140),s=n(716),l=n(957);class c extends l.WF{static properties={hass:{attribute:!1},selector:{attribute:!1},value:{attribute:!1},label:{},helper:{},disabled:{type:Boolean},required:{type:Boolean},localizeValue:{attribute:!1}};constructor(){super(),this.disabled=!1,this.required=!1}_generateSchema(e,t){if(!e)return[];const n=Array.isArray(e)?e.map((e,t)=>[e.name||t,e]):Object.entries(e);let o=null;for(const[e,t]of n)if(t.selector&&t.selector.entity){o=e;break}return n.map(([e,t])=>{const n={name:e,selector:t.selector,required:t.required??!1};return t.selector&&t.selector.attribute&&o&&(n.context={filter_entity:o}),n})}_computeLabel(e){const t=this.selector?.bc_object?.fields?.[e.name];if(t?.label)return t.label;const n=this.selector?.bc_object?.translation_key;if(this.localizeValue&&n){const t=this.localizeValue(`${n}.fields.${e.name}.name`)||this.localizeValue(`${n}.fields.${e.name}`);if(t)return t}return e.name}_computeHelper(e){const t=this.selector?.bc_object?.fields?.[e.name];if(t?.description)return t.description;const n=this.selector?.bc_object?.translation_key;if(this.localizeValue&&n){const t=this.localizeValue(`${n}.fields.${e.name}.description`);if(t)return t}return""}_formatValue(e,t){if(!e||!this.hass)return"";const n=this.selector?.bc_object?.label_field||Object.keys(this.selector?.bc_object?.fields||{})[0];if(!n)return"";const o=e[n];if(!o)return"";if(this.selector?.bc_object?.fields?.[n]?.selector?.entity){const e=this.hass.states[o];if(e)return e.attributes.friendly_name||o}return String(o)}_getDescription(e){const t=this.selector?.bc_object?.description_field;return t&&e&&e[t]||""}render(){const e=this.selector?.bc_object?.multiple||!1,t=this.selector?.bc_object?.fields;return t?e?this._renderMultiple():this._renderSingle():l.qy`
No fields defined
`}_renderMultiple(){const e=Array.isArray(this.value)?this.value:[];return l.qy` ${this.label?l.qy``:l.s6}
${e.map((e,t)=>this._renderItem(e,t))} ${this.hass?.localize?.("ui.common.add")||"Add"}
${this.helper?l.qy`${this.helper}`:l.s6} `}_renderSingle(){return this.value?l.qy` ${this.label?l.qy``:l.s6}
${this._renderItem(this.value,0)}
${this.helper?l.qy`${this.helper}`:l.s6} `:l.qy` ${this.label?l.qy``:l.s6} ${this.hass?.localize?.("ui.common.add")||"Add"} ${this.helper?l.qy`${this.helper}`:l.s6} `}_renderItem(e,t){const n=this._formatValue(e,this.selector)||`Item ${t+1}`,o=this._getDescription(e),i=this.selector?.bc_object?.multiple||!1;return l.qy`

${n} ${o?l.qy`${o}`:l.s6}
e.stopPropagation()} @mousedown=${e=>e.stopPropagation()} @touchstart=${e=>e.stopPropagation()}> this._deleteItem(t)} ?disabled=${this.disabled} .label="${this.hass?.localize?.("ui.common.delete")||"Delete"}" >

this._computeLabel(e)} .computeHelper=${e=>this._computeHelper(e)} .localizeValue=${this.localizeValue} @value-changed=${e=>this._itemChanged(e,t)} >
`}_addItem(){if(this.selector?.bc_object?.multiple){const e=[...Array.isArray(this.value)?this.value:[],{}];(0,s.rC)(this,"value-changed",{value:e})}else(0,s.rC)(this,"value-changed",{value:{}})}_deleteItem(e){if(this.selector?.bc_object?.multiple){const t=[...this.value||[]];t.splice(e,1),(0,s.rC)(this,"value-changed",{value:t})}else(0,s.rC)(this,"value-changed",{value:void 0})}_itemChanged(e,t){if(e.stopPropagation(),this.selector?.bc_object?.multiple){const n=[...this.value||[]];n[t]=e.detail.value,(0,s.rC)(this,"value-changed",{value:n})}else(0,s.rC)(this,"value-changed",{value:e.detail.value})}static styles=l.AH` :host { display: block; } .bc-object-label { display: block; margin-bottom: 8px; font-weight: var(--ha-font-weight-medium, 500); } .bc-object-items { display: flex; flex-direction: column; gap: 8px; } .bc-object-item { --expansion-panel-summary-padding: 0 16px; width: 100% !important; max-width: 100% !important; } .bc-object-item-header { display: flex; align-items: center; margin: 0; width: 100%; justify-content: space-between; } .bc-object-item-title-container { display: flex; flex-direction: column; flex: 1; padding: 12px 0; overflow: hidden; } .bc-object-item-label { font-weight: var(--ha-font-weight-medium, 500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .bc-object-item-description { font-size: 0.9em; color: var(--secondary-text-color); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .bc-object-item-content { padding: 16px; width: 100% !important; box-sizing: border-box; } .button-container { display: flex; align-items: center; margin-left: 8px; } .delete-icon { color: var(--secondary-text-color); } .delete-icon ha-icon { display: flex; align-items: center; justify-content: center; } .delete-icon[disabled] { color: var(--disabled-text-color); opacity: 0.5; } .bc-object-add-button { align-self: flex-start; } ha-input-helper-text { display: block; margin-top: 4px; } `}customElements.define("ha-selector-bc_object",c);var d=n(371);function u(e){const t=e._config.entity;return(0,d.zD)(t)}function p({hass:e,data:t={},entity:n,computeLabel:o,onFormChange:i,onToggleChange:a,isReadOnly:r,showEntityFilterToggle:s=!1,entityFilterValue:c=!1,onEntityFilterToggle:d,showEntityFilterInfo:u=c,rangeFormDisabled:p=!1,forceValuePositionRight:b=!1}){const h=n?.startsWith("light")&&["hue","saturation","white_temp"].includes(t.light_slider_type),m=h,g=(e,t,n={})=>{"function"==typeof a&&a(e,t,n)},f=(e,t)=>({control:e,eventType:t});return l.qy`

Slider behavior

${s?l.qy`
{return t=e.target.checked,void("function"==typeof d&&d(t));var t}} >

Custom slider

To create a custom slider (read only), select an entity with a numeric state above, then define the min and max values below.

For example, this allows you to display your solar production within a specific range.

`:""}
g("tap_to_slide",e.target.checked,f("ha-switch","change"))} .disabled=${t.relative_slide||r} >
g("relative_slide",e.target.checked,f("ha-switch","change"))} .disabled=${t.tap_to_slide||r} >
g("read_only_slider",e.target.checked,f("ha-switch","change"))} .disabled=${r} >
g("slider_live_update",e.target.checked,f("ha-switch","change"))} .disabled=${r} >

Slider live update

By default, sliders are updated only on release. When this option is enabled, the slider will update the entity state while sliding. This feature is not recommended for all entities, disable it if you encounter issues.

Slider layout

Fill from left (default) Fill from right Fill from top Fill from bottom

Vertical slider behavior

When using vertical fill orientation (top or bottom), swiping over the card on mobile will activate the slider. This is because there's no way to distinguish between scrolling and slider interaction.

${h?"":l.qy` Right (default) Left Center Hidden ${b?l.qy`

Value position locked

Value position is forced to "Right" because "Show button info" is enabled. Disable it to change this setting.

`:""} `} g("invert_slider_value",e.target.checked,f("ha-switch","change"))} >
${n?.startsWith("light")?l.qy`

Light options

Brightness (default) Color (Hue) Saturation White temperature ${"hue"===t.light_slider_type?l.qy` g("hue_force_saturation",e.target.checked,f("ha-switch","change"))} >
${t.hue_force_saturation?l.qy` g("hue_force_saturation_value",e.target.value,f("ha-textfield","input"))} > `:""} `:""} ${["hue","saturation","white_temp"].includes(t.light_slider_type)?l.qy``:l.qy` g("use_accent_color",e.target.checked,f("ha-switch","change"))} >
`} ${t.tap_to_slide?"":l.qy` g("allow_light_slider_to_0",e.target.checked,f("ha-switch","change"))} >
`} g("light_transition",e.target.checked,f("ha-switch","change"))} >
${t.light_transition?l.qy`

Light transition

Important: This feature only works for lights that support the light.turn_on transition attribute.

Enabling this for lights that do not support transitions will unfortunately have no effect. Defaults to 500ms unless overridden below.

g("light_transition_time",e.target.value,f("ha-textfield","input"))} > `:""}
`:""} `}function b(e){let t={};"slider"!==e._config.button_type||e._disableEntityFilter||(t={filter:[{domain:["light","media_player","cover","input_number","number","climate","fan"]},{domain:"sensor",device_class:"battery"}]});const n="pop-up"===e._config.card_type;let o=e._config.button_action||"";e._config.button_type||(e._config.button_type=n?"name":"switch");let i=e._config.button_type;return l.qy`
${n?"":e.makeDropdown("Card type","card_type",e.cardTypeList)} ${e.makeDropdown("Button type","button_type",[{label:"Switch",value:"switch"},{label:"Slider",value:"slider"},{label:"State",value:"state"},{label:"Name / Text (No entity required)",value:"name"}])}

${n?"Header card settings":"Card settings"}

${e.makeDropdown("Optional - Icon","icon")} ${e.makeShowState()}
${function(e){void 0===e._disableEntityFilter&&(e._disableEntityFilter=!1);const t="slider"===e._config.button_type;return l.qy`

Slider settings

${p({hass:e.hass,data:e._config,entity:e._config.entity,computeLabel:e._computeLabelCallback,onFormChange:e._valueChanged,onToggleChange:(t,n,o={})=>{if(!t)return;const i=(o.control||"").toUpperCase(),a=o.eventType||("HA-TEXTFIELD"===i?"input":"HA-COMBO-BOX"===i?"value-changed":"change"),r={configValue:t,tagName:i||"INPUT"};"HA-SWITCH"===i?r.checked=n:r.value=n;const s={type:a,target:r,detail:"value-changed"===a||"selected"===a?{value:n}:void 0};e._valueChanged(s)},isReadOnly:u(e),showEntityFilterToggle:!0,entityFilterValue:e._disableEntityFilter,onEntityFilterToggle:t=>{e._disableEntityFilter=t,e.requestUpdate()},showEntityFilterInfo:e._disableEntityFilter,rangeFormDisabled:"name"===e._config.button_type})}
`}(e)}

Tap action on icon

${e.makeActionPanel("Tap action")} ${e.makeActionPanel("Double tap action")} ${e.makeActionPanel("Hold action")}

Tap action on card

${e.makeActionPanel("Tap action",o,"name"===e._config.button_type?"none":"state"===e._config.button_type||"slider"===e._config.button_type&&(0,s.md)(e,"sensor",e._config.entity)?"more-info":"toggle","button_action")} ${e.makeActionPanel("Double tap action",o,"none","button_action")} ${e.makeActionPanel("Hold action",o,"name"===e._config.button_type||"slider"===e._config.button_type?"none":"more-info","button_action")}
${e.makeSubButtonPanel()}

Styling and layout options

${e.makeLayoutPanel()} ${n?"":e.makeStyleEditor()}
${n?"":e.makeModulesEditor()}

Button card ${n?"(as pop-up header)":""}

This card is very versatile. It can be used as a switch, a slider, a state or a name/text button. Select the type of button you want to get more information about it.

${"switch"!==e._config.button_type&&e._config.button_type?"":l.qy`

Switch button: This is the default button type. By default, it toggles an entity and its background color changes based on the entity's state or the color of a light. You can change its action in the Tap action on card section.

`} ${"slider"===e._config.button_type?l.qy`

Slider button: This button type lets you control entities with adjustable ranges. It's ideal for dimming lights, and its fill color will adapt to the light's color. You can also use it to display values, such as a battery level.

Supported entities for sliders:

  • Light (brightness)
  • Media player (volume)
  • Cover (position)
  • Fan (percentage)
  • Climate (temperature)
  • Input number and number (value)
  • Battery sensor (percentage, read only)

You can also use any entity with a numeric state by disabling the entity filter in Slider settings, then define the min and max values. This option is read only.

`:""} ${"state"===e._config.button_type?l.qy`

State button: Perfect for displaying information from a sensor or any entity. When you press it, it will show the "More info" panel of the entity. Its background color does not change.

`:""} ${"name"===e._config.button_type?l.qy`

Name/Text button: The only button type that doesn't need an entity. It allows you to display a short text, a name or a title. You can also add actions to it. Its background color does not change.

`:""}
${n?"":e.makeVersion()}
`}function h(e,t){delete e._config[t+"_name"],delete e._config[t+"_icon"],delete e._config[t+"_link"],delete e._config[t+"_entity"],delete e._config[t+"_pir_sensor"];for(let n=t;nt.charCodeAt(0)+((e<<5)-e),0)}function w(e){const t=(16777215&e).toString(16).toUpperCase();return"#"+"00000".substring(0,6-t.length)+t}function x(e){if(e.date){const t=e.date.split("-"),n=parseInt(t[0],10),o=parseInt(t[1],10)-1,i=parseInt(t[2],10);return new Date(n,o,i)}return new Date(e.dateTime)}function k(e,t){const n=x(e.start),o=x(t.start),i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),a=new Date(o.getFullYear(),o.getMonth(),o.getDate()),r=i.getTime()-a.getTime();if(0!==r)return r;const s=void 0!==e.start.date,l=void 0!==t.start.date;return s&&!l?-1:!s&&l?1:s||l?0:n.getTime()-o.getTime()}const C=e=>e.title||e.label;class $ extends l.WF{getSchema(e){const t=v(this.hass);return[{type:"expandable",name:"",title:e?this.hass.states[e].attributes.friendly_name||e:t("editor.calendar.new_calendar"),schema:[{name:"entity",title:t("editor.calendar.entity"),selector:{entity:{domain:["calendar"]}}},{name:"color",title:t("editor.calendar.color"),selector:{ui_color:{}}}]}]}static properties={hass:{},value:{type:Array},label:{}};constructor(){super(),this.value=[]}render(){const e=v(this.hass),t=e=>()=>{const t=[...this.value||[]];t.splice(e,1),this.valueChanged({detail:{value:t}})},n=this.value??[];return l.qy`

 ${e("editor.calendar.list_of_calendars")}

${n.map((n,o)=>l.qy`
{e.stopPropagation();const t=[...this.value||[]];t[o]=e.detail.value,this.valueChanged({detail:{value:t}})}} style="flex-grow: 1;" >   ${e("editor.calendar.remove_calendar")}
`)} {const e=[...this.value||[]];e.push({entity:"",color:""}),this.valueChanged({detail:{value:e}})}} style="margin: 12px 4px 14px 4px;">   ${e("editor.calendar.new_calendar")}
`}valueChanged(e){const t=e.detail.value.map(e=>{const t=e.entity?w(_(e.entity)):"";return{entity:e.entity,color:e.color||t}});(0,s.rC)(this,"value-changed",{value:t},void 0)}}function S(e,t,n,o){if(void 0===e._lazyContentLoadedFlags&&(e._lazyContentLoadedFlags={}),n&&!e._lazyContentLoadedFlags[t]&&(e._lazyContentLoadedFlags[t]=!0),e._lazyContentLoadedFlags[t])return o()}function A(){return"undefined"!=typeof customElements&&void 0!==customElements.get("ha-dropdown")}function L({trigger:e,items:t}){const n=t.map(e=>"divider"===e.type?A()?l.qy``:l.qy`
  • `:function({icon:e,label:t,disabled:n=!1,onClick:o,variant:i=null,type:a="item",checked:r=!1}){return A()?l.qy` ${e?l.qy``:""} ${t} `:l.qy` ${e?l.qy``:""} ${t} `}(e));return A()?l.qy` ${e} ${n} `:l.qy` e.stopPropagation()} @click=${e=>e.stopPropagation()}> ${e} ${n} `}function E(e,t,n,o,i,a,r,s,c,u={}){const{panelKeyPrefix:b="sub_button",buttonTitle:h=`Button ${n+1}${t.name?` - ${t.name}`:""}`,arrayLength:m=null}=u;void 0===e._expandedPanelStates&&(e._expandedPanelStates={});const g=t.entity??e._config.entity,f=(0,d.zD)(g),y=g?.startsWith("input_select")||g?.startsWith("select")||t.select_attribute;if(!t.sub_button_type&&y)try{setTimeout(()=>i({sub_button_type:"select"}))}catch(e){}const v=e.hass.states[g]?.attributes,_=e._selectable_attributes.some(e=>v?.[e]),w=Object.keys(e.hass.states[g]?.attributes||{}).map(t=>{let n=e.hass.states[g];return{label:e.hass.formatEntityAttributeName(n,t),value:t}}).filter(t=>e._selectable_attributes.includes(t.value)),x=t.visibility??[],k=[{label:"Default (button)",value:"default"},...f?[]:[{label:"Slider",value:"slider"}],...y||_?[{label:"Dropdown / Select",value:"select"}]:[]],C=`${b}_main_${n}`,$=`${b}_settings_${n}`,A=`${b}_actions_${n}`,E=`${b}_visibility_${n}`,M=`${b}_layout_${n}`,T=`${b}_type_slider_${n}`,B="slider"===t.sub_button_type&&t.always_visible,P="select"===t.sub_button_type||!t.sub_button_type&&y||B,I="string"==typeof o&&o.startsWith("sub_button.bottom"),O=null==t.fill_width?!!I:t.fill_width;let q=!1;if("string"==typeof o&&o.includes(".group")){const t=o.match(/^sub_button\.(main|bottom)\.(\d+)\.group$/);if(t){const[,n,o]=t,i=e._config.sub_button;if(i&&i[n]){const e=i[n][parseInt(o,10)];if(e&&e.justify_content){const t=e.justify_content.toLowerCase();q=["end","start","center"].includes(t)}}}}const j=null===m||n>0,z=null===m||n{e._expandedPanelStates[C]=t.target.expanded,e.requestUpdate()}} >

    ${h}
    e.stopPropagation()} @mousedown=${e=>e.stopPropagation()} @touchstart=${e=>e.stopPropagation()}> ${L({trigger:l.qy` `,items:[{type:"item",icon:"mdi:arrow-left",label:"Move left",disabled:!j,onClick:e=>{e.stopPropagation(),j&&r(-1)}},{type:"item",icon:"mdi:arrow-right",label:"Move right",disabled:!z,onClick:e=>{e.stopPropagation(),z&&r(1)}},{type:"divider"},{type:"item",icon:"mdi:content-copy",label:"Copy",onClick:e=>{e.stopPropagation(),s(e)}},{type:"item",icon:"mdi:content-cut",label:"Cut",onClick:e=>{e.stopPropagation(),c(e)}},{type:"divider"},{type:"item",icon:"mdi:delete",label:"Delete",variant:"danger",onClick:e=>{e.stopPropagation(),a(e)}}]})}

    ${S(e,C,!!e._expandedPanelStates[C],()=>l.qy` {e._expandedPanelStates[$]=t.target.expanded,e.requestUpdate()}} >

    Button settings

    ${S(e,$,!!e._expandedPanelStates[$],()=>l.qy` i(e.detail.value)} > "Sub-button type"} @value-changed=${e=>i({sub_button_type:e.detail.value.sub_button_type})} > ${"slider"===t.sub_button_type?l.qy`

    Slider behavior

    By default, you need to tap the sub-button to reveal the slider. To make the slider always visible, enable the "Always show slider" option in the Layout section below.

    `:""} ${("select"===t.sub_button_type||!t.sub_button_type&&y)&&_?l.qy` "Optional - Select menu (from attributes)"} @value-changed=${e=>i({select_attribute:e.detail.value.select_attribute})} > `:""}
    `)} ${e.makeShowState(t,`${o}.${n}.`,o,n)}
    ${"slider"===t.sub_button_type?l.qy` {e._expandedPanelStates[T]=t.target.expanded,e.requestUpdate()}} >

    Slider settings

    ${S(e,T,!!e._expandedPanelStates[T],()=>l.qy` ${p({hass:e.hass,data:t,entity:g,computeLabel:e._computeLabelCallback,onFormChange:e=>i(e.detail.value),onToggleChange:(e,t)=>i({[e]:t}),isReadOnly:f,forceValuePositionRight:!(!t.always_visible||!t.show_button_info)})} `)}
    `:""} {e._expandedPanelStates[A]=t.target.expanded,e.requestUpdate()}} >

    Tap action on button

    ${S(e,A,!!e._expandedPanelStates[A],()=>l.qy` ${B?l.qy`

    Actions disabled

    Tap, double tap, and hold actions are disabled on this sub-button because "Always show slider" is enabled.

    `:""}
    ${e.makeActionPanel("Tap action",t,"more-info",o,n)}
    ${e.makeActionPanel("Double tap action",t,"none",o,n)}
    ${e.makeActionPanel("Hold action",t,"none",o,n)}
    `)}
    {e._expandedPanelStates[E]=t.target.expanded,e.requestUpdate()}} >

    Visibility

    ${S(e,E,!!e._expandedPanelStates[E],()=>l.qy` i({hide_when_parent_unavailable:e.target.checked})} > i({visibility:e.detail.value})} > The sub-button will be shown when ALL conditions are fulfilled. If no conditions are set, the sub-button will always be shown. `)}
    {e._expandedPanelStates[M]=t.target.expanded,e.requestUpdate()}} >

    Layout

    ${S(e,M,!!e._expandedPanelStates[M],()=>l.qy` ${I?l.qy` i({fill_width:e.target.checked})} > `:""} ${"slider"===t.sub_button_type?l.qy` i({always_visible:e.target.checked})} > `:""} ${"slider"===t.sub_button_type&&t.always_visible?l.qy` i({show_button_info:e.target.checked})} > `:""} ${"slider"===t.sub_button_type&&t.always_visible?"":l.qy` Icon on left (default) Icon on top Icon on bottom Icon on right `} `)}
    `)}
    `}function M(e,t,n){return o=>{if(o?.stopPropagation(),t){try{e._clipboardButton=JSON.parse(JSON.stringify(t))}catch(n){e._clipboardButton=t}n&&n(e._clipboardButton),e.requestUpdate()}}}function T(e,t,n,o){return i=>{i?.stopPropagation(),M(e,t,o)(i),n&&n(i)}}function B(e,t){return t===e._config.sub_button?.main?"main":t===e._config.sub_button?.bottom?"bottom":null}function P(e,t,n){try{e._config.sub_button[t]=n(e._config.sub_button[t])}catch(o){try{e._config.sub_button={...e._config.sub_button,[t]:n(e._config.sub_button[t])}}catch(o){e._config={...e._config,sub_button:{...e._config.sub_button,[t]:n(e._config.sub_button[t])}}}}}function I(e,t,n,o){return i=>{i?.stopPropagation();const a=B(e,t);if(!a)return[...t].splice(n,1),o&&o(e),void e.requestUpdate();const r=[...e._config.sub_button[a]];r.splice(n,1),P(e,a,()=>r),o&&o(e),e.requestUpdate()}}function O(e,t,n,o){return i=>{const a=n+i;if(a<0||a>=t.length)return;const r=B(e,t);if(!r){const i=[...t];return[i[n],i[a]]=[i[a],i[n]],o&&o(e),void e.requestUpdate()}const s=[...e._config.sub_button[r]];[s[n],s[a]]=[s[a],s[n]],P(e,r,()=>s),o&&o(e),e.requestUpdate()}}function q(e){const t=e.filter(e=>e&&!Array.isArray(e.group));return 0===t.length?[...e]:[{name:"Automatically grouped",buttons_layout:"inline",group:t},...e.filter(e=>e&&Array.isArray(e.group))]}function j(e,t){const n=e._clipboardButton||(t?t():null);return n?`Paste "${n.name||"sub-button"}"`:"Paste"}customElements.define("ha-selector-calendar_entity",$);const z="bubble-card-subbutton-clipboard";function D(){try{const e=localStorage.getItem(z);if(!e)return null;const t=JSON.parse(e);return t&&"object"==typeof t?t.payload??null:null}catch(e){return null}}function N(e){if(e)try{const t=JSON.parse(JSON.stringify(e)),n={type:t&&Array.isArray(t.buttons)?"group":"sub-button",savedAt:Date.now(),payload:t};localStorage.setItem(z,JSON.stringify(n))}catch(e){}}function U(e,t){if("sub-buttons"===e._config.card_type&&"main"===t)return[];if(Array.isArray(e._config.sub_button)){const t=(0,m.zD)(e._config.sub_button),n={};Array.isArray(t.main)&&t.main.length&&(n.main=t.main.slice()),Array.isArray(t.bottom)&&t.bottom.length&&(n.bottom=t.bottom.slice());try{e._config.sub_button=n}catch(t){e._config={...e._config,sub_button:n}}}if(!e._config.sub_button)try{e._config.sub_button={}}catch(t){e._config={...e._config,sub_button:{}}}if(!Array.isArray(e._config.sub_button[t]))try{e._config.sub_button[t]=[]}catch(n){try{e._config.sub_button={...e._config.sub_button,[t]:[]}}catch(n){e._config={...e._config,sub_button:{...e._config.sub_button,[t]:[]}}}}return e._config.sub_button[t]}function R(e,t,n,o){const i=n([...U(e,t)]);try{e._config.sub_button[t]=i}catch(n){try{e._config.sub_button={...e._config.sub_button,[t]:i}}catch(n){e._config={...e._config,sub_button:{...e._config.sub_button,[t]:i}}}}o&&o(e),e.requestUpdate()}function V(e,t,n,o,i){const a=[...U(e,t)],r=o({...a[n]});a[n]=r;try{e._config.sub_button[t]=a}catch(n){try{e._config.sub_button={...e._config.sub_button,[t]:a}}catch(n){e._config={...e._config,sub_button:{...e._config.sub_button,[t]:a}}}}i&&i(e),e.requestUpdate()}function F(e){const t=e._config.sub_button,n="sub-buttons"===e._config.card_type,o=e=>Array.isArray(e)&&e.some(e=>!!e&&(Array.isArray(e.group),!0)),i=!n&&o(t?.main),a=o(t?.bottom),r=!(!t||void 0===t.main_layout&&void 0===t.bottom_layout);if(!i&&!a&&!r){try{delete e._config.sub_button}catch(t){e._config={...e._config},delete e._config.sub_button}return void e._valueChanged({target:{configValue:"sub_button",value:void 0}})}if(a){e._firstRowsComputation=!0;const t=Boolean(window.isSectionView),n=Object.prototype.hasOwnProperty.call(e._config,"card_layout");if(t&&n&&"normal"===e._config.card_layout){try{delete e._config.card_layout}catch(t){const n={...e._config};delete n.card_layout,e._config=n}e._valueChanged({target:{configValue:"card_layout",value:void 0}})}}const s={};i&&(s.main=(t.main||[]).filter(e=>!!e)),a&&(s.bottom=(t.bottom||[]).filter(e=>!!e)),t&&void 0!==t.main_layout&&!n&&(s.main_layout=t.main_layout),t&&void 0!==t.bottom_layout&&(s.bottom_layout=t.bottom_layout),e._valueChanged({target:{configValue:"sub_button",value:s}})}function H(e,t){const n=(0,m.mg)(e._config),o=Array.isArray(n?.[t])?n[t]:[];return{items:o,hasGroups:o.some(e=>e&&Array.isArray(e.group)),hasIndividualButtons:o.some(e=>e&&!Array.isArray(e.group))}}function W(e,t){let{items:n,hasGroups:o,hasIndividualButtons:i}=H(e,t);o&&i&&(n=q(n),R(e,t,()=>n,F));const{isDismissed:a,dismiss:r}=function(e,t){const n=`bubble-card-groups-info-dismissed-${t}`;if(e._groupsInfoDismissed||(e._groupsInfoDismissed={}),void 0===e._groupsInfoDismissed[t])try{e._groupsInfoDismissed[t]="true"===localStorage.getItem(n)}catch(n){e._groupsInfoDismissed[t]=!1}return{isDismissed:e._groupsInfoDismissed[t],dismiss:()=>{e._groupsInfoDismissed[t]=!0;try{localStorage.setItem(n,"true")}catch(e){}e.requestUpdate()}}}(e,t),s=()=>{R(e,t,e=>{const t=q(e),n=t.filter(e=>e&&Array.isArray(e.group)).length;return[...t,{name:`Group ${n+1}`,buttons_layout:"inline",group:[]}]},F)};return l.qy` ${o&&!a?l.qy`

    Groups mode
    Dismiss

    You are now in groups mode. All sub-buttons must be inside a group to ensure consistent ordering. You can rename, reorder, or delete groups as needed.

    `:""} ${n.map((n,o)=>{if(!n)return null;if(Array.isArray(n.group))return function(e,t,n,o){const i=`${o}_group_${n}`,a="main"===o?e._config.sub_button.main:e._config.sub_button.bottom,r=t=>{V(e,o,n,e=>{const n={...e},i=Array.isArray(e.group)?[...e.group]:[],a=i.some(e=>e&&!0===e.fill_width);if(Object.prototype.hasOwnProperty.call(t,"name")&&(n.name=t.name),Object.prototype.hasOwnProperty.call(t,"buttons_layout")&&(n.buttons_layout=t.buttons_layout),"bottom"===o&&Object.prototype.hasOwnProperty.call(t,"justify_content")){const e=t.justify_content;if("fill"===e){if(Object.prototype.hasOwnProperty.call(n,"justify_content")&&delete n.justify_content,Array.isArray(i)){for(let e=0;e{const a=e._clipboardButton||(i?i():null);if(!a)return;e._clipboardButton=a;const r=B(e,t);if(!r)return;const s=[...e._config.sub_button[r]],l={...s[n]};Array.isArray(l.group)||(l.group=[]);const c="bottom"===r&&l.justify_content&&"fill"!==l.justify_content;if(Array.isArray(a?.buttons)||Array.isArray(a?.group)){let e=JSON.parse(JSON.stringify(a.buttons||a.group||[]));c&&(e=e.map(e=>e?{...e,fill_width:!1}:e)),l.group=[...l.group,...e]}else{let e=JSON.parse(JSON.stringify(a));c&&e&&(e.fill_width=!1),l.group=[...l.group,e]}s[n]=l,P(e,r,()=>s),o&&o(e),e.requestUpdate()}}(e,a,n,F,D),h=n>0,m=n{e._expandedPanelStates[i]=t.target.expanded,e.requestUpdate()}} >

    ${t.name||`Group ${n+1}`}
    e.stopPropagation()} @mousedown=${e=>e.stopPropagation()} @touchstart=${e=>e.stopPropagation()}> ${L({trigger:l.qy` `,items:[{type:"item",icon:"mdi:arrow-up",label:"Move up",disabled:!h,onClick:e=>{e.stopPropagation(),h&&d(-1)}},{type:"item",icon:"mdi:arrow-down",label:"Move down",disabled:!m,onClick:e=>{e.stopPropagation(),m&&d(1)}},{type:"divider"},{type:"item",icon:"mdi:content-copy",label:"Copy group",onClick:e=>{e.stopPropagation(),u(e)}},{type:"item",icon:"mdi:content-cut",label:"Cut group",onClick:e=>{e.stopPropagation(),p(e)}},{type:"divider"},{type:"item",icon:"mdi:delete",label:"Delete",variant:"danger",onClick:e=>{e.stopPropagation(),c(e)}}]})}

    ${S(e,i,!!e._expandedPanelStates[i],()=>l.qy` r(e.detail.value)} >

    Group layout

    {const e=(Array.isArray(t.group)?t.group:[]).some(e=>e&&!0===e.fill_width)?"fill":t.justify_content??"fill";return{buttons_layout:t.buttons_layout??"inline",justify_content:e}})()} .schema=${(()=>{const e=(Array.isArray(t.group)?t.group:[]).some(e=>e&&!0===e.fill_width);let n=[{value:"fill",label:"Fill available width (default)"},{value:"end",label:"Right"},{value:"start",label:"Left"},{value:"center",label:"Center"},{value:"space-between",label:"Space between"},{value:"space-around",label:"Space around"},{value:"space-evenly",label:"Space evenly"}];"column"===t.buttons_layout&&(n=n.filter(e=>!["space-between","space-around","space-evenly"].includes(e.value)));const i=[{name:"buttons_layout",label:"Buttons layout",selector:{select:{options:[{value:"inline",label:"Inline"},{value:"column",label:"Column"}],mode:"dropdown"}}}];return"bottom"===o&&i.push({name:"justify_content",label:"Buttons alignment",selector:{select:{options:n,mode:"dropdown"}},disabled:e}),i})()} .computeLabel=${e._computeLabelCallback} @value-changed=${e=>r(e.detail.value)} > ${"bottom"!==o?"":(Array.isArray(t.group)?t.group:[]).some(e=>e&&!0===e.fill_width)?l.qy`

    Buttons alignment locked by sub-button settings

    One or more sub-buttons explicitly enable "Fill available width". To change alignment, first disable "Fill available width" in those sub-buttons.

    `:""}

    Group sub-buttons

    ${Array.isArray(t.group)?t.group.map((i,a)=>{if(!i)return null;const r=t=>{t?.stopPropagation(),V(e,o,n,e=>{const t={...e},n=Array.isArray(t.group)?[...t.group]:[];return n.splice(a,1),t.group=n,t},F)},s=Array.isArray(t.group)?t.group[a]:null,l=M(e,s,N),c=T(e,s,r,N),d=(Array.isArray(t.group)?t.group:[]).length;return E(e,i,a,`sub_button.${o}.${n}.group`,t=>{V(e,o,n,e=>{const n={...e},o=Array.isArray(n.group)?[...n.group]:[];return o[a]={...o[a]||{},...t},n.group=o,n},F)},r,t=>{const i=a+t,r=U(e,o),s=Array.isArray(r[n]?.group)?r[n].group:[];i<0||i>=s.length||V(e,o,n,e=>{const t={...e},n=Array.isArray(t.group)?[...t.group]:[];return[n[a],n[i]]=[n[i],n[a]],t.group=n,t},F)},l,c,{panelKeyPrefix:`${o}_group_${n}_button`,buttonTitle:i.name||`Button ${a+1}`,arrayLength:d})}):null}
    `)}
    `}(e,n,o,t);const i="main"===t?e._config.sub_button.main:e._config.sub_button.bottom,a=I(e,i,o,F),r=O(e,i,o,F),s=i[o],c=M(e,s,N),d=T(e,s,a,N),u=i.length;return E(e,n,o,`sub_button.${t}`,n=>{R(e,t,e=>{const t=[...e];return t[o]={...t[o]||{},...n},t},F)},a,r,c,d,{panelKeyPrefix:`${t}_button`,buttonTitle:`Button ${o+1}${n.name?` - ${n.name}`:""}`,arrayLength:u})})}
    ${(()=>{const n=U(e,"main"===t?"main":"bottom"),o=function(e,t,n,o){return()=>{const i=e._clipboardButton||(o?o():null);if(!i)return;e._clipboardButton=i;const a=JSON.parse(JSON.stringify(i)),r=B(e,t),s=Array.isArray(a.buttons)||Array.isArray(a.group),l=r?e._config.sub_button[r]:t;let c=s?q(l):[...l];s?c.push({name:a.name,buttons_layout:a.display||a.buttons_layout||"inline",justify_content:a.justify_content,group:a.buttons||a.group||[]}):c.push(a),r&&P(e,r,()=>c),n&&n(e),e.requestUpdate()}}(e,n,F,D);return l.qy` `})()} ${o?l.qy` `:L({trigger:l.qy` `,items:[{type:"item",icon:"mdi:shape-square-rounded-plus",label:"Add sub-button",onClick:()=>{R(e,t,t=>[...t,{entity:e._config.entity}],F)}},{type:"item",icon:"mdi:format-list-group-plus",label:"Add group",onClick:()=>{s()}}]})}
    `}function Y(e,t){if(!H(e,t).hasGroups)return"";const n=`${t}_layout`,o=e._config?.sub_button?.[n]??"inline";return l.qy` {const o=t.detail?.value?.[n];if(!e._config.sub_button)try{e._config.sub_button={}}catch(t){e._config={...e._config,sub_button:{}}}try{e._config.sub_button[n]=o}catch(t){try{e._config.sub_button={...e._config.sub_button,[n]:o}}catch(t){e._config={...e._config,sub_button:{...e._config.sub_button,[n]:o}}}}F(e),e.requestUpdate()}} > `}var K=n(933),X=n(766),J=n(937),G=n(868),Q=n(134);const Z="sensor.bubble_card_modules",ee=["modules","store"],te="bubble-card-force-unsupported-modules";function ne(){return"undefined"!=typeof customElements&&void 0!==customElements.get("ha-tab-group")&&void 0!==customElements.get("ha-tab-group-tab")?"ha-tab-group":"undefined"!=typeof customElements&&void 0!==customElements.get("sl-tab-group")?"sl-tab-group":"ha-tabs"}async function oe(e,t,n){try{if(!e.hass)return!1;if(!await(0,Q.ensureBCTProviderAvailable)(e.hass))return console.warn("Bubble Card Tools is required to change global status."),!1;const o={...a.Ki.get(t)||{}};return!0===n?o.is_global=!0:delete o.is_global,a.Ki.set(t,o),await(0,Q.writeModuleYaml)(e.hass,t,o),document.dispatchEvent(new CustomEvent("yaml-modules-updated")),!0}catch(e){return console.error("Error setting module global status:",e),!1}}function ie(e,t){try{const n=a.Ki.get(e);if(n&&"object"==typeof n&&!0===n.is_global)return!0;if(Q.isBCTAvailableSync&&(0,Q.isBCTAvailableSync)())return!1;if(!t||!t.states||!t.states[Z])return!1;const o=t.states[Z];if(!o.attributes||!o.attributes.modules)return!1;const i=o.attributes.modules[e];return i&&!0===i.is_global}catch(t){return console.warn(`Error checking if module ${e} is global:`,t),!1}}function ae(e,t){const n=e._config?.modules||[],o=Array.isArray(n)?n:[n];return!o.includes(`!${t}`)&&(!!o.includes(t)||ie(t,e.hass))}function re(e){if(!a.Ki||0===a.Ki.size)return[];let t=Array.from(a.Ki.keys());const n=e._myModulesSearchQuery;if(n&&n.trim()){const e=n.toLowerCase().trim();t=t.filter(t=>{const n=(0,K.a7)(t),o=(n.name||t).toLowerCase(),i=(n.description||"").toLowerCase(),a=(n.creator||"").toLowerCase();return o.includes(e)||i.includes(e)||a.includes(e)})}if(!e._myModulesSortOrder)try{const t=localStorage.getItem("bubble-card-modules-sort-order");e._myModulesSortOrder=t||"default"}catch(t){e._myModulesSortOrder="default"}const o=e._myModulesSortOrder||"default",i=(0,Q.getAllModulesLastModified)(),r=e=>{const t=i.get(e);if(!t)return 0;const n=new Date(t).getTime();return isNaN(n)?0:n};return t.sort((t,n)=>{if("default"===t)return-1;if("default"===n)return 1;const i=(0,K.a7)(t),a=(0,K.a7)(n),s=ae(e,t),l=ae(e,n);switch(o){case"alphabetical":return(i.name||t).localeCompare(a.name||n,void 0,{sensitivity:"base"});case"default":if(s!==l)return s?-1:1;const e=r(t),o=r(n);return e!==o&&e>0&&o>0?o-e:(i.name||t).localeCompare(a.name||n,void 0,{sensitivity:"base"});case"recent-first":const c=r(t),d=r(n);return c!==d&&c>0&&d>0?d-c:(i.name||t).localeCompare(a.name||n,void 0,{sensitivity:"base"});default:if(s!==l)return s?-1:1;const u=r(t),p=r(n);return u!==p&&u>0&&p>0?p-u:(i.name||t).localeCompare(a.name||n,void 0,{sensitivity:"base"})}}),t}class se extends l.WF{_previewStyleApplied=!1;_entityCache={};_cachedAttributeList=null;_cachedAttributeListEntity=null;_expandedPanelStates={};_moduleErrorCache={};_moduleCodeEvaluating=null;_rowsAutoMode=void 0;_autoRowsComputeScheduled=!1;_previewCardRoot=null;_previewCardHost=null;_previewCardScore=-1/0;_cardContextListener=null;_lastMeasuredHeights=null;constructor(){super(),this._expandedPanelStates={},this._cardContextListener=e=>this._handleCardContext(e),window.addEventListener("bubble-card-context",this._cardContextListener)}setConfig(e){const t=this._previewCardHost||this._previewCardRoot?.host||null,n=!!t?.isConnected;this._config={...e},n?this._previewCardScore=-1/0:this._resetPreviewCardReference(),void 0===this._rowsAutoMode&&(this._rowsAutoMode=!0),void 0!==this._config?.grid_options?.rows&&null!==this._config?.grid_options?.rows&&""!==this._config?.grid_options?.rows&&(this._rowsAutoMode=!1)}_deepQuerySelector(e,t,n=6){try{if(!e||n<0)return null;const o=e.querySelector?.(t);if(o)return o;const i=e.querySelectorAll?.("*")||[];for(const e of i)if(e?.shadowRoot){const o=this._deepQuerySelector(e.shadowRoot,t,n-1);if(o)return o}return null}catch(e){return null}}_getEditorPreviewContainer(){try{const e=document.querySelector("body > home-assistant");return e?.shadowRoot?.querySelector("hui-dialog-edit-card")?.shadowRoot?.querySelector("ha-dialog > div.content > div.element-preview")||null}catch(e){return null}}_removeRowsOverrideAndRecalculate=()=>{try{const e={...this._config};if(e.grid_options){const{rows:t,...n}=e.grid_options;Object.keys(n).length>0?e.grid_options=n:delete e.grid_options}delete e.rows,this._rowsAutoMode=!0,this._config=e,(0,s.rC)(this,"config-changed",{config:e}),requestAnimationFrame(()=>{try{this._firstRowsComputation=!0,this._lastMeasuredHeights=null,this._setupAutoRowsObserver();const e=this._getBubbleCardFromPreview();e?this._computeAndApplyRows(e):this._waitForPreviewAndRecompute()}catch(e){}})}catch(e){console.error("Bubble Card Editor: failed to remove rows override",e)}};_waitForPreviewAndRecompute(e=0){try{const e=this._getBubbleCardFromPreview();if(e){this._setupAutoRowsObserver();const t=this._computeAndApplyRows(e);if(t?.applied)return}}catch(e){}e+1>=40||setTimeout(()=>this._waitForPreviewAndRecompute(e+1),50)}_scheduleAutoRowsCompute(){this._autoRowsComputeScheduled||(this._autoRowsComputeScheduled=!0,requestAnimationFrame(()=>{this._autoRowsComputeScheduled=!1;try{if(void 0!==this._config?.grid_options?.rows&&null!==this._config?.grid_options?.rows&&""!==this._config?.grid_options?.rows||!1===this._rowsAutoMode)return;this._setupAutoRowsObserver();const e=this._getBubbleCardFromPreview();e&&this._computeAndApplyRows(e)}catch(e){}}))}static get properties(){return{hass:{},_config:{}}}get _card_type(){return this._config?.card_type||""}get _button_type(){return this._config?.button_type||("pop-up"===this._config?.card_type?"":"switch")}get _entity(){return this._config?.entity||""}get _selectable_attributes(){return["source_list","sound_mode_list","hvac_modes","fan_modes","swing_modes","preset_modes","effect_list"]}updated(e){super.updated(e),e.has("hass")&&(this.listsUpdated=!1,this._entityCache={},this._cachedAttributeList=null,this._cachedAttributeListEntity=null),this._setupAutoRowsObserver()}async firstUpdated(e){if(super.firstUpdated(e),this.hass&&this.hass.loadFragmentTranslation)try{await this.hass.loadFragmentTranslation("config")}catch(e){console.error("Bubble Card Editor: Failed to load 'config' fragment translation",e)}}disconnectedCallback(){super.disconnectedCallback?.();try{this._errorListener&&(window.removeEventListener("bubble-card-error",this._errorListener),this._errorListener=null)}catch(e){}try{this._moduleChangeHandler&&(window.removeEventListener("bubble-card-modules-changed",this._moduleChangeHandler),window.removeEventListener("bubble-card-module-updated",this._moduleChangeHandler),document.removeEventListener("yaml-modules-updated",this._moduleChangeHandler),this._moduleChangeHandler=null,this._moduleChangeListenerAdded=!1)}catch(e){}try{this._storeAutoRefreshTimer&&(clearInterval(this._storeAutoRefreshTimer),this._storeAutoRefreshTimer=null)}catch(e){}try{this._progressInterval&&(clearInterval(this._progressInterval),this._progressInterval=null)}catch(e){}try{this._editorSchemaDebounce&&(clearTimeout(this._editorSchemaDebounce),this._editorSchemaDebounce=null)}catch(e){}try{this._cardContextListener&&(window.removeEventListener("bubble-card-context",this._cardContextListener),this._cardContextListener=null)}catch(e){}se._resizeObserver&&this._observedElements&&(this._observedElements.forEach(e=>{se._resizeObserver.unobserve(e),se._editorInstanceMap.delete(e)}),this._observedElements=[])}render(){if(!this.hass)return l.qy``;const e=v(this.hass);if(!this._previewStyleApplied){const e=document.querySelector("body > home-assistant"),t=e?.shadowRoot?.querySelector("hui-dialog-edit-card")?.shadowRoot?.querySelector("ha-dialog > div.content > div.element-preview");t?.style&&"sticky"!==t.style.position&&(t.style.position="sticky",t.style.top="0",t.style.height="calc(100vh - 224px)",t.style.overflowY="auto",this._previewStyleApplied=!0)}this.listsUpdated||(this._initializeLists(e),this.listsUpdated=!0);const t=this.cardTypeList;switch(this.buttonTypeList,this._config?.card_type){case"pop-up":return function(e){const t=e._config?.trigger??[];if(e._config.button_action,"pop-up"===e._config.card_type&&!e._config.hash){const t={...e._config};let n=!1;return setTimeout(()=>{n=!1===window.popUpError,function(e,t){if(!e.shadowRoot)return;const n=e.shadowRoot.querySelector("#vertical-stack-alert-container");n&&(n.style.display=t?"block":"none");const o=e.shadowRoot.querySelector(".icon-button ha-icon");o&&(o.icon=t?"mdi:content-save":"mdi:plus");const i=e.shadowRoot.querySelector("#button-text");i&&(i.textContent=t?"Update Hash":"Create Pop-up");const a=e.shadowRoot.querySelector("#include-example");a&&(a.disabled=t);const r=e.shadowRoot.querySelector(".mdc-form-field .mdc-label");r&&(r.textContent="Include example configuration"+(t?" (disabled because pop-up is already in a vertical stack)":""))}(e,n)},0),e.createPopUpConfig=()=>function(e,t){try{const t=!1===window.popUpError,n=e.shadowRoot.querySelector("#include-example")?.checked||!1;let o="#pop-up-name";const i=e.shadowRoot.querySelector("#hash-input");if(i&&i.value&&(o=i.value),t)return e._config.hash=o,(0,s.rC)(e,"config-changed",{config:e._config}),void console.info("Pop-up already in a vertical stack. Hash updated. Note that manually creating a vertical stack is no longer required.");if(n){const t=function(e,t="light",n=2){const o=[];return e&&e.states?(Object.keys(e.states).forEach(i=>{if(!(o.length>=n)&&i.startsWith(t+".")){let t=!1;"brightness"in e.states[i].attributes&&(t=!0),o.push({entity:i,supportsBrightness:t})}}),o):o}(e.hass);e._config={type:"vertical-stack",cards:[{type:"custom:bubble-card",card_type:"pop-up",name:"Living room",icon:"mdi:sofa-outline",hash:o},{type:"custom:bubble-card",card_type:"separator",name:"Lights (example)",icon:"mdi:lightbulb-outline"},{type:"horizontal-stack",cards:t.length>0?t.map(e=>({type:"custom:bubble-card",card_type:"button",button_type:e.supportsBrightness?"slider":"switch",entity:e.entity,show_state:!0})):[{type:"custom:bubble-card",card_type:"button",button_type:"name",name:"Floor lamp",icon:"mdi:floor-lamp-outline"}]}]}}else e._config={type:"vertical-stack",cards:[{type:"custom:bubble-card",card_type:"pop-up",hash:o}]},window.bubbleNewlyCreatedHashes=window.bubbleNewlyCreatedHashes||new Set,window.bubbleNewlyCreatedHashes.add(o);(0,s.rC)(e,"config-changed",{config:e._config})}catch(n){console.error("Error creating pop-up:",n),e._config=t,e._config.hash=e.shadowRoot.querySelector("#hash-input")?.value||"#pop-up-name",(0,s.rC)(e,"config-changed",{config:e._config})}}(e,t),l.qy`
    ${e.makeDropdown("Card type","card_type",e.cardTypeList)}

    Pop-up

    Pop-ups are a great way to declutter your dashboard and quickly display more information when you need it.

    If it's your first time creating a pop-up, you can use the example configuration to get started.

    ${e.makeVersion()}
    `}return l.qy`
    ${e.makeDropdown("Card type","card_type",e.cardTypeList)}

    Header settings

    Hidden header

    You can completely hide the pop-up header, including the close button. To close it when hidden, either make a long swipe within the pop-up or click outside of it.


    ${b(e)}

    Pop-up settings

    Background updates

    Background updates are only recommended if you encounter issues with certain cards within your pop-up.

    Pop-up trigger

    e._conditionChanged(t)} >

    About conditions

    The pop-up will be opened when ALL conditions are fulfilled. For example you can open a "Security" pop-up with a camera when a person is in front of your house.

    You can also create a toggle helper (input_boolean) and trigger its opening/closing in an automation.

    Pop-up open/close action

    ${e.makeActionPanel("Open action",e._config,"none")} ${e.makeActionPanel("Close action",e._config,"none")}

    About actions

    This allows you to trigger an action on pop-up open/close.

    Styling and layout options

    ${e.makeLayoutPanel()}

    Pop-up styling

    Hide pop-up backdrop

    This will hide the pop-up backdrop, which is a dark overlay that appears behind the pop-up.

    You can enable this setting for all your pop-ups at once by turning it on in the first pop-up on your dashboard.

    Hiding it is recommended if you encounter performance issues when opening/closing pop-ups.

    ${e.makeStyleEditor()}
    ${e.makeModulesEditor()}

    How to use pop-ups

    Each pop-up is hidden by default and can be opened by targeting its hash (e.g., '#pop-up-name'), with any card that supports the navigate action.

    You can also watch this video that explains how to create your first pop-up (this video is outdated, you don't need to add a vertical stack anymore).

    Important

    To avoid misalignment with your view, place this card after all other dashboard cards. You can't trigger it from a different view.

    If the content of your pop-up appears on the screen during page loading, you can install this fix (recommended).

    ${e.makeVersion()}
    `}(this);case"button":return b(this);case"sub-buttons":return function(e){const t="pop-up"===e._config.card_type;return l.qy`
    ${t?"":e.makeDropdown("Card type","card_type",e.cardTypeList)}

    Card settings

    ${e._config?.footer_mode?l.qy`
    ${e._config?.footer_full_width?"":l.qy`
    Footer will be centered on the page
    `}
    Distance from the bottom of the page (default: 16px)
    `:""}
    ${e.makeSubButtonPanel()}

    Styling and layout options

    ${e.makeLayoutPanel()} ${t?"":e.makeStyleEditor()}
    ${e.makeModulesEditor()}

    Sub-buttons card

    This card can only contain sub-buttons, perfect for displaying information, creating menus, and even a fixed footer menu at the bottom of the page.

    ${t?"":e.makeVersion()}
    `}(this);case"separator":return n=this,l.qy`
    ${n.makeDropdown("Card type","card_type",n.cardTypeList)} ${n.makeDropdown("Icon","icon")} ${n.makeSubButtonPanel()}

    Styling and layout options

    ${n.makeLayoutPanel()} ${n.makeStyleEditor()}
    ${n.makeModulesEditor()}

    Separator card

    This card is a simple separator for dividing your pop-up/dashboard into categories or sections. e.g. Lights, Devices, Covers, Settings, Automations...

    ${n.makeVersion()}
    `;case"horizontal-buttons-stack":return function(e){if(!e.buttonAdded)for(e.buttonAdded=!0,e.buttonIndex=0;e._config[e.buttonIndex+1+"_link"];)e.buttonIndex++;return l.qy`
    ${e.makeDropdown("Card type","card_type",e.cardTypeList)}
    ${function(e){let t=[];for(let n=1;n<=e.buttonIndex;n++)t.push(l.qy`

    Button ${n} ${e._config[n+"_name"]?"- "+e._config[n+"_name"]:""}

    In fact you can also get the auto order with any entity type, for example you can add light groups to these fields and the order will change based on the last changed states.
    `);return t}(e)}

    Styling and layout options

    ${e.makeLayoutPanel()}

    Horizontal buttons stack styling

    ${e.makeStyleEditor()}
    ${e.makeModulesEditor()}

    Horizontal buttons stack card

    This card is a good companion to the pop-up card, allowing you to open pop-ups or any page of your dashboard. In addition, you can add your motion sensors so that the order of the buttons adapts according to the room you just entered. This card is scrollable, remains visible and acts as a footer.

    ${e.makeVersion()}
    `}(this);case"cover":return function(e){let t=e._config.button_action||"";return l.qy`
    ${e.makeDropdown("Card type","card_type",e.cardTypeList)}

    Card settings

    ${e.makeDropdown("Optional - Open icon","icon_open")} ${e.makeDropdown("Optional - Closed icon","icon_close")} ${e.makeShowState()}

    Custom services

    Tap action on icon

    ${e.makeActionPanel("Tap action")} ${e.makeActionPanel("Double tap action")} ${e.makeActionPanel("Hold action")}

    Tap action on card

    ${e.makeActionPanel("Tap action",t,"none","button_action")} ${e.makeActionPanel("Double tap action",t,"none","button_action")} ${e.makeActionPanel("Hold action",t,"none","button_action")}
    ${e.makeSubButtonPanel()}

    Styling and layout options

    ${e.makeLayoutPanel()}

    Cover styling

    ${e.makeDropdown("Optional - Arrow down icon","icon_down")} ${e.makeDropdown("Optional - Arrow up icon","icon_up")}
    ${e.makeStyleEditor()}
    ${e.makeModulesEditor()}

    Cover card

    This card allows you to control your covers.

    ${e.makeVersion()}
    `}(this);case"media-player":return function(e){let t=e._config.button_action||"";return l.qy`
    ${e.makeDropdown("Card type","card_type",e.cardTypeList)}

    Card settings

    ${e.makeDropdown("Optional - Icon","icon")} ${e.makeShowState()}

    Media player settings

    Buttons default behavior

    Outside of the editor, buttons other than the power button only appear if the media player is turned on.

    Tap action on icon

    ${e.makeActionPanel("Tap action")} ${e.makeActionPanel("Double tap action")} ${e.makeActionPanel("Hold action")}

    Tap action on card

    ${e.makeActionPanel("Tap action",t,"none","button_action")} ${e.makeActionPanel("Double tap action",t,"none","button_action")} ${e.makeActionPanel("Hold action",t,"none","button_action")}
    ${e.makeSubButtonPanel()}

    Styling and layout options

    ${e.makeLayoutPanel()}

    Media player styling

    ${e.makeStyleEditor()}
    ${e.makeModulesEditor()}

    Media player card

    This card allows you to control a media player entity.

    ${e.makeVersion()}
    `}(this);case"empty-column":return function(e){return l.qy`
    ${e.makeDropdown("Card type","card_type",e.cardTypeList)}

    Styling and layout options

    ${e.makeLayoutPanel()}

    Empty column card

    Just an empty card to fill any empty column.

    ${e.makeVersion()}
    `}(this);case"select":return function(e){const t=e._config.entity,n=t?.startsWith("input_select")||t?.startsWith("select")||e._config.select_attribute,o=e.hass.states[t]?.attributes,i=e._selectable_attributes.some(e=>o?.[e]),a=Object.keys(e.hass.states[t]?.attributes||{}).map(n=>{let o=e.hass.states[t];return{label:e.hass.formatEntityAttributeName(o,n),value:n}}).filter(t=>e._selectable_attributes.includes(t.value));let r=e._config.button_action||"";return l.qy`
    ${e.makeDropdown("Card type","card_type",e.cardTypeList)} ${i?l.qy` "Select menu (from attributes)"} @value-changed=${t=>{e._valueChanged({target:{configValue:"select_attribute"},detail:{value:t.detail.value.select_attribute}})}} > `:""}

    Card settings

    ${e.makeDropdown("Optional - Icon","icon")} ${e.makeShowState()}

    Tap action on icon

    ${e.makeActionPanel("Tap action")} ${e.makeActionPanel("Double tap action")} ${e.makeActionPanel("Hold action")}

    Tap action on button

    ${e.makeActionPanel("Tap action",r,"none","button_action")}
    ${e.makeActionPanel("Double tap action",r,"none","button_action")} ${e.makeActionPanel("Hold action",r,"none","button_action")}
    ${e.makeSubButtonPanel()}

    Styling and layout options

    ${e.makeLayoutPanel()} ${e.makeStyleEditor()}
    ${e.makeModulesEditor()}

    Select card

    This card allows you to have a select menu for your entities with selectable options:

    • Input Select entities
    • Select entities
    • Media players with source list
    • Media players with sound mode list
    • Climate entities with hvac modes
    • Climate/Fan entities with fan modes
    • Climate entities with swing modes
    • Climate entities with preset modes
    • Light entities with effect list
    ${e.makeVersion()}
    `}(this);case"climate":return function(e){let t=e._config.button_action||"";if("climate"===e._config.card_type&&!e.climateSubButtonsAdded&&e._config.entity){const t=e.hass.states[e._config.entity]?.attributes?.hvac_modes;if(t){const t=(0,m.mg)(e._config);if(!(Array.isArray(t.main)&&t.main.length>0)){const n={name:"HVAC modes menu",select_attribute:"hvac_modes",state_background:!1,show_arrow:!1};t.main.push(n),e._config.sub_button=t,e._firstRowsComputation=!0}}e.climateSubButtonsAdded=!0}return l.qy`
    ${e.makeDropdown("Card type","card_type",e.cardTypeList)}

    Card settings

    ${e.makeDropdown("Optional - Icon","icon")} ${e.makeShowState()}

    Climate settings

    ${e.hass.states[e._config.entity]?.attributes?.target_temp_low?l.qy`
    `:""} ${e.hass.states[e._config.entity]?.attributes?.target_temp_high?l.qy`
    `:""}

    Tap action on icon

    ${e.makeActionPanel("Tap action")} ${e.makeActionPanel("Double tap action")} ${e.makeActionPanel("Hold action")}

    Tap action on card

    ${e.makeActionPanel("Tap action",t,"none","button_action")} ${e.makeActionPanel("Double tap action",t,"none","button_action")} ${e.makeActionPanel("Hold action",t,"none","button_action")}
    ${e.makeSubButtonPanel()}

    Styling and layout options

    ${e.makeLayoutPanel()} ${e.makeStyleEditor()}
    ${e.makeModulesEditor()}

    Climate card

    This card allows you to control your climate entities. You can also add a sub-button that display a dropdown menu for your climate modes (check if you have "Select menu" available when you create a new sub-button).

    ${e.makeVersion()}
    `}(this);case"calendar":return function(e){const t=v(e.hass);return e._config.event_action||(e._config.event_action={tap_action:{action:"more-info"},double_tap_action:{action:"none"},hold_action:{action:"none"}}),l.qy`
    ${e.makeDropdown("Card type","card_type",e.cardTypeList)}

    ${t("editor.calendar.settings")}

    Tap action on day

    ${e.makeActionPanel("Tap action",e._config,"none")} ${e.makeActionPanel("Double tap action")} ${e.makeActionPanel("Hold action")}

    Tap action on event

    ${e.makeActionPanel("Tap action",e._config.event_action,"none","event_action")} ${e.makeActionPanel("Double tap action",e._config.event_action,"none","event_action")} ${e.makeActionPanel("Hold action",e._config.event_action,"none","event_action")}
    ${e.makeSubButtonPanel()}

    Styling options

    ${e.makeLayoutOptions()} ${e.makeStyleEditor()}
    ${e.makeModulesEditor()}

    Calendar card

    This card allows you to display a calendar and is scrollable, so you can view additional events.

    ${e.makeVersion()}
    `}(this);case void 0:return l.qy`

    You need to add a card type first

    ${this.makeDropdown("Card type","card_type",t)}

    Bubble Card ${o}

    If you want to know what's new in this version, you can check the changelog here.

    Resources & Help

    If you have an issue or a question you can find more details in the GitHub documentation. You can also find useful resources and help in these links.

    Support the Project

    Hi I'm Clooos the Bubble Card developer. I dedicate most of my spare time to making this project the best it can be. So if you appreciate my work, any donation would be a great way to show your support.

    Also, check out my Patreon for exclusive custom styles, templates, and modules. Subscribing is probably the best way to support me and keep this project going.

    Clooos

    Thank you for being part of this awesome community! Cheers from Belgium! 🍻

    ${this.makeVersion()}
    `}var n}makeLayoutOptions(){const e=window.isSectionView?"large":"normal",t="separator"===this._config.card_type?"0.8":"1",n="pop-up"!==this._config.card_type&&(this._config.card_layout?.includes("large")||window.isSectionView&&!this._config.card_layout);return l.qy` ${this._renderConditionalContent(this._config.grid_options?.rows,l.qy`

    Rows are already set in the "Layout" options

    If you want to change the rows, you can do it in the "Layout" options at the top of this editor. Or remove it from your config in YAML to enable this option.

    `)} ${this._renderConditionalContent(n,l.qy`
    `)}

    Card layout deprecation

    The card layout options are deprecated, but still available for backwards compatibility. Please use the new sub-button groups and layout options instead for better flexibility.

    "pop-up"===this._config.card_type?"Header card layout":"Card layout"} @value-changed=${e=>{this._valueChanged({target:{configValue:"card_layout"},detail:{value:e.detail.value.card_layout}})}} > `}makeLayoutPanel(){return l.qy`

    Layout

    ${this.makeLayoutOptions()}
    `}makeShowState(e=this._config,t="",n=!1,o){const i=e?.entity??this._config.entity??"",a="name"===this._config.button_type,r=i?.startsWith("input_select")||i?.startsWith("select")||e.select_attribute,s="sub_button"===n||"string"==typeof n&&n.startsWith("sub_button"),c=s&&("select"===e?.sub_button_type||!e?.sub_button_type&&r),d=e?.show_attribute?Object.keys(this.hass.states[i]?.attributes||{}).map(e=>{let t=this.hass.states[i];return{label:this.hass.formatEntityAttributeName(t,e),value:e}}):[];return l.qy`
    ${this._renderConditionalContent(s,l.qy`
    `)} ${this._renderConditionalContent(s&&(e?.show_background??!0),l.qy`
    `)} ${this._renderConditionalContent(s&&(e?.state_background??!0)&&i.startsWith("light"),l.qy`
    `)} ${this._renderConditionalContent(!s&&i.startsWith("light"),l.qy`
    `)}
    ${this._renderConditionalContent(e?.show_attribute,l.qy` "Attribute to show"} @value-changed=${e=>{const i=e.detail.value.attribute;n?this._arrayValueChange(o,{attribute:i},n):this._valueChanged({target:{configValue:t+"attribute"},detail:{value:i}})}} > `)} ${this._renderConditionalContent(c,l.qy`
    `)} `}makeDropdown(e,t,n,o,i){if(e.includes("icon")||e.includes("Icon"))return l.qy`
    `;if(e.includes("Entity")||e.includes("entity")){let n=[],i=[];switch(this._config.card_type){case"button":default:break;case"cover":n=["cover"];break;case"climate":n=["climate"];break;case"media-player":n=["media_player"];break;case"select":n=["input_select","select"],this._config.select_attribute&&(n=[])}return l.qy` `}return l.qy` e} @value-changed=${e=>{const n=e.detail.value[t];this._valueChanged({target:{configValue:t},detail:{value:n}})}} > `}_renderConditionalContent(e,t){return e?t:l.qy``}makeActionPanel(e,t=this._config,n,o,i=this._config){const a="Tap action"===e?"mdi:gesture-tap":"Double tap action"===e?"mdi:gesture-double-tap":"Hold action"===e?"mdi:gesture-tap-hold":"mdi:gesture-tap",r="Tap action"===e?"tap_action":"Double tap action"===e?"double_tap_action":"Hold action"===e?"hold_action":"Open action"===e?"open_action":"close_action",s=o?`action_panel_${o}_${i}_${r}`:`action_panel_config_${r}`;let c;try{c="Tap action"===e?t.tap_action:"Double tap action"===e?t.double_tap_action:"Hold action"===e?t.hold_action:"Open action"===e?t.open_action:t.close_action}catch{}const d=t===this._config;return n||(n=d&&"Tap action"===e?"name"!==this._config.button_type?"more-info":"none":d?"none":""),l.qy` {this._expandedPanelStates[s]=e.target.expanded,this.requestUpdate()}} >

    ${e}

    ${S(this,s,!!this._expandedPanelStates[s],()=>l.qy` this._ActionChanged(e,o,i)} > ${"call-service"===c?.action||"perform-action"===c?.action?l.qy`
    `:""} `)}
    `}makeSubButtonPanel(){return void 0===(e=this)._expandedPanelStates&&(e._expandedPanelStates={}),void 0!==e._clipboardButton&&null!==e._clipboardButton||(e._clipboardButton=D()||null),function(e){if(Array.isArray(e._config.sub_button)){const t=(0,m.zD)(e._config.sub_button);try{e._config.sub_button=t}catch(n){e._config={...e._config,sub_button:t}}}else if(!e._config.sub_button||!(0,m.lc)(e._config.sub_button)){const t=(0,m.mg)(e._config);try{e._config.sub_button=t}catch(n){e._config={...e._config,sub_button:t}}}const t=(0,m.mg)(e._config);void 0===e._expandedPanelStates&&(e._expandedPanelStates={}),void 0!==e._clipboardButton&&null!==e._clipboardButton||(e._clipboardButton=D()||null);const n="sub-buttons"===e._config.card_type,o="pop-up"===e._config.card_type,i=["cover","media-player","climate"].includes(e._config.card_type),a=e._config.main_buttons_position||"default",r=e._config.main_buttons_alignment||"end",s="bottom"===a,c=e._config.main_buttons_full_width??!!s,d=Boolean(window.isSectionView),u=(e._config.card_layout||"").includes("large"),p=Object.prototype.hasOwnProperty.call(e._config,"card_layout"),b=p&&"normal"===e._config.card_layout,h=Array.isArray(t.bottom)&&t.bottom.some(e=>!!e),g=void 0!==e._config.rows&&null!==e._config.rows&&""!==e._config.rows,f=void 0!==e._config.grid_options?.rows&&null!==e._config.grid_options?.rows&&""!==e._config.grid_options?.rows,y=g&&!1===e._rowsAutoMode,v=f||y;return l.qy`

    Sub-buttons editor

    ${v?l.qy`

    Rows configuration detected

    The card height (rows) is explicitly set in your configuration. This will prevent automatic row adjustments when sub-buttons are added (for example, when adding bottom sub-buttons). Click the button below to remove the override and let Bubble Card auto-calculate the rows.

    `:""} ${i?l.qy`

    Card specific buttons

    "Main buttons position"} @value-changed=${t=>{e._valueChanged({target:{configValue:"main_buttons_position"},detail:{value:t.detail.value.main_buttons_position}})}} > ${e._renderConditionalContent(s,l.qy`
    ${e._renderConditionalContent(!c,l.qy` "Main buttons alignment"} @value-changed=${t=>{e._valueChanged({target:{configValue:"main_buttons_alignment"},detail:{value:t.detail.value.main_buttons_alignment}})}} > `)} `)}
    `:""} ${o?l.qy` ${Y(e,"main")} ${W(e,"main")} `:n?"":l.qy`

    Main sub-buttons (top)

    ${Y(e,"main")} ${W(e,"main")}
    `} ${n?l.qy` ${Y(e,"bottom")} ${W(e,"bottom")} `:o?"":l.qy`

    Bottom sub-buttons

    ${Y(e,"bottom")} ${e._renderConditionalContent(!u&&!h&&(b||!d&&!p),l.qy`

    Bottom sub-buttons and layout

    Adding bottom sub-buttons will automatically switch this card to the "Large" layout (this is the new recommended layout). This notice will disappear once you add bottom sub-buttons.

    `)} ${W(e,"bottom")}
    `} ${l.qy`

    Sub-buttons

    This editor allows you to add customized sub-buttons to your card. Sub-buttons support three types:

    • Default (button) - Standard button with tap actions

    • Slider - Control or display numeric values (brightness, volume, temperature, etc.)

    • Dropdown / Select - Dropdown menu for selectable entities

    Use Slider sub-buttons to control light brightness, media player volume, or climate temperature. Use Dropdown sub-buttons to select media sources, HVAC modes, or light effects. Use Default buttons for simple on/off controls or custom actions.

    You can organize sub-buttons individually or group them together. Groups can be arranged inline (side by side) or in rows (stacked vertically), and buttons within groups can be displayed inline or in a column layout.

    `}
    `}(e);var e}makeVersion(){return l.qy`

    Bubble Card ${o}

    `}makeStyleEditor(){const e="style_editor_panel";return l.qy`

    Custom styles & JS templates

    ${S(this,e,!!this._expandedPanelStates[e],()=>l.qy`
    {this._valueChanged(e),this._clearCurrentCardError()}} >
    ${this.createErrorConsole()} `)}

    Custom styles & JS templates

    For advanced users, you can edit the CSS style of this card in the above code editor. More information and examples here. You don't need to add styles: | (only used in YAML mode). You can also add JS templates (Jinja is not supported).

    Check out my Patreon for more custom styles, templates, and modules. This is also the best way to show your support to my project.

    `}_clearCurrentCardError(){if(!window.bubbleCardErrorRegistry)return;const e=this._config?.card_type,t=this._config?.entity;if(!e||!t)return;const n=`${e}_${t}`;window.bubbleCardErrorRegistry[n]&&(delete window.bubbleCardErrorRegistry[n],this.errorMessage="",this.errorSource="",this.requestUpdate())}_clearCurrentModuleError(e){this._moduleCodeEvaluating=e;try{window.bubbleCardErrorRegistry&&e&&Object.keys(window.bubbleCardErrorRegistry).forEach(t=>{window.bubbleCardErrorRegistry[t]?.moduleId===e&&delete window.bubbleCardErrorRegistry[t]})}catch(e){}this.errorMessage="",this.errorSource="",this.requestUpdate()}createErrorConsole(e=this){window.bubbleCardErrorRegistry||(window.bubbleCardErrorRegistry={});const t=()=>{if(void 0!==e._editingModule&&e._editingModule){const t=e._editingModule.id;if(!t)return e.errorMessage="",void(e.errorSource="");let n=!1;window.bubbleCardErrorRegistry&&Object.values(window.bubbleCardErrorRegistry).forEach(o=>{o.moduleId===t&&(e.errorMessage=o.message,e.errorSource=o.source,n=!0)}),n||(e.errorMessage="",e.errorSource="")}else{const t=e._config?.card_type,n=e._config?.entity;if(!t||!n)return e.errorMessage="",void(e.errorSource="");const o=`${t}_${n}`;if(window.bubbleCardErrorRegistry&&window.bubbleCardErrorRegistry[o]){const t=window.bubbleCardErrorRegistry[o];e.errorMessage=t.message,e.errorSource=t.source}else e.errorMessage="",e.errorSource=""}e.requestUpdate()};return e._errorListener||(e._errorListener=e=>{const n=e.detail;if(n&&"object"==typeof n&&n.context){const{message:e,context:t}=n;if(e){if(t.cardType&&t.entityId){const n=`${t.cardType}_${t.entityId}`;window.bubbleCardErrorRegistry[n]={message:e,source:"module"===t.sourceType?`Module ('${t.moduleId}')`:"Card Configuration (styles section)",cardType:t.cardType,entityId:t.entityId,moduleId:"module"===t.sourceType?t.moduleId:null}}}else if("module"===t.sourceType&&t.moduleId)Object.keys(window.bubbleCardErrorRegistry).forEach(e=>{window.bubbleCardErrorRegistry[e]?.moduleId===t.moduleId&&delete window.bubbleCardErrorRegistry[e]});else if(t.cardType&&t.entityId){const e=`${t.cardType}_${t.entityId}`;window.bubbleCardErrorRegistry[e]&&delete window.bubbleCardErrorRegistry[e]}}t()},window.addEventListener("bubble-card-error",e._errorListener)),t(),l.qy`

    Error in JS template

    ${e.errorMessage}

    ${e._editingModule&&"object"==typeof e._editingModule&&e._editingModule.id?l.qy`
    JS template errors can sometimes be delayed in the Module Editor. `:""}
    `}_getProcessedSchema(e,t,n){const o=structuredClone(t);return this._updateAttributeSelectors(o,n,e)}_valueChangedInHaForm(e,t,n){let o=e.detail.value;if(o&&"object"==typeof o&&!Array.isArray(o)){const e=Object.keys(o);e.length>0&&e.every(e=>!isNaN(parseInt(e,10)))&&(o=e.sort((e,t)=>parseInt(e,10)-parseInt(t,10)).map(e=>o[e]))}this._workingModuleConfigs&&(this._workingModuleConfigs[t]=o);const i=this._cleanEmpty(o,t);(0,s.rC)(this,"config-changed",{config:{...this._config,[t]:i}}),this.requestUpdate()}_cleanEmpty(e,t){if(Array.isArray(e))return e.map(e=>this._cleanEmpty(e,void 0)).filter(e=>!this._isEmpty(e));if(e&&"object"==typeof e){const t={};return Object.keys(e).forEach(n=>{const o=this._cleanEmpty(e[n],n);this._isEmpty(o)||(t[n]=o)}),Object.keys(t).length>0?t:void 0}return"string"!=typeof e||""!==e||"state"===t?e:void 0}_isEmpty(e){return null==e||(Array.isArray(e)?0===e.length:"object"==typeof e&&0===Object.keys(e).length)}_updateAttributeSelectors=(e,t,n=void 0)=>{const o=(e,t,n)=>{const o=Array.isArray(e)?e:Object.entries(e||{}).map(([e,t])=>({name:e,...t}));if(Array.isArray(t)&&t.length>0){const i=t.find(e=>e&&"object"==typeof e&&e.entity)??t.find(e=>e&&"object"==typeof e)??t[0],a=this._updateAttributeSelectors(o,i,n);return Array.isArray(e)?a:a.reduce((e,t)=>{const{name:n,...o}=t;return e[n]=o,e},{})}const i=this._updateAttributeSelectors(o,t,n);return Array.isArray(e)?i:i.reduce((e,t)=>{const{name:n,...o}=t;return e[n]=o,e},{})};let i=n;return e.map(e=>{const n=((e,t)=>{if(e&&void 0!==t)return Array.isArray(e)?e:e[t]})(t,e.name);if(e.selector&&e.selector.entity&&(i=((e,t)=>{if(!e)return t;if("string"==typeof e)return e||t;if(Array.isArray(e)){const n=e.find(e=>e&&e.entity||"string"==typeof e);return"string"==typeof n?n||t:n?.entity??t}return e.entity??t})(n,void 0)),e.selector&&e.selector.attribute&&(e.selector.attribute.entity_id=i),Array.isArray(e.schema))e.schema=this._updateAttributeSelectors(e.schema,n,i);else if(e.selector&&e.selector.object&&e.selector.object.fields){const t=e.selector.object;e.selector={bc_object:{...t,fields:o(t.fields,n,i)}}}return e})};makeModulesEditor(){return function(e){if(void 0===e._selectedModuleTab&&(e._selectedModuleTab=0),void 0===e._expandedPanelStates&&(e._expandedPanelStates={}),void 0===e._myModulesSortOrder)try{const t=localStorage.getItem("bubble-card-modules-sort-order");e._myModulesSortOrder=t||"default"}catch(t){e._myModulesSortOrder="default"}const t=e._myModulesSortOrder||"default";if(void 0===e._forceUnsupportedModules)try{const t=localStorage.getItem(te);e._forceUnsupportedModules="true"===t}catch(t){e._forceUnsupportedModules=!1}const n="bubble-card-module-editor-tab-group";e._modulesLoaded||(0,a.wv)(e).then(()=>{if(e._modulesLoaded=!0,(!Q.isBCTAvailableSync||!(0,Q.isBCTAvailableSync)())&&function(e){const t={entityFound:!1,hasAttributes:!1,hasModulesAttribute:!1,modulesIsObject:!1,hasLastUpdated:!1,isReady:!1};if(!e||!e.states)return t;const n=e.states[Z];if(!n)return t;t.entityFound=!0;const o=n.attributes||{};return t.hasAttributes=!!n.attributes,"modules"in o&&(t.hasModulesAttribute=!0,t.modulesIsObject=null!==o.modules&&"object"==typeof o.modules),"last_updated"in o&&(t.hasLastUpdated="string"==typeof o.last_updated&&o.last_updated.length>0),t.isReady=t.entityFound&&t.hasModulesAttribute&&t.modulesIsObject&&t.hasLastUpdated,t}(e.hass).isReady){const t=e.hass.states[Z].attributes.modules;t&&t.default&&!0!==t.default.is_global&&oe(e,"default",!0).then(e=>{e?document.dispatchEvent(new CustomEvent("yaml-modules-updated")):console.warn(`Failed to set module 'default' to global in ${Z}.`)})}e.requestUpdate()});const o=(0,Q.isBCTAvailableSync)();if(e._bctRetryHandle&&o&&(clearTimeout(e._bctRetryHandle),e._bctRetryHandle=null),!e.hass||o||e._bctCheckAttempted)e.hass&&o&&!e._bctCheckAttempted&&(e._bctCheckInFlight||(e._bctCheckInFlight=!0,e._bctCheckAttempted=!0,(0,Q.ensureBCTProviderAvailable)(e.hass).finally(()=>{e._bctCheckInFlight=!1,(0,Q.isBCTAvailableSync)()!==o&&e.requestUpdate()})));else{const t=Date.now(),n=e._lastBctCheckAt??0,o=n?t-n:1/0,i=n&&o<5e3;if(e._bctCheckInFlight||i){if(i&&!e._bctRetryHandle){const t=Math.max(50,5e3-o);e._bctRetryHandle=setTimeout(()=>{e._bctRetryHandle=null,e.requestUpdate()},t)}}else e._bctRetryHandle&&(clearTimeout(e._bctRetryHandle),e._bctRetryHandle=null),e._bctCheckInFlight=!0,e._bctCheckAttempted=!0,e._lastBctCheckAt=t,(0,Q.ensureBCTProviderAvailable)(e.hass).finally(()=>{e._bctCheckInFlight=!1,e.requestUpdate()})}if((0,J.kA)(e),e._workingModuleConfigs||(e._workingModuleConfigs={}),e._modulesLoaded&&!a.Ki.has("default")&&o){const t="default:\n name: Default\n version: ''\n description: Empty and enabled by default. Add your custom styles and/or JS templates here to apply them to all cards by pressing the button above.\n code: ''\n is_global: true\n ";(0,G.m)(e,t).then(()=>{console.info("Default module created automatically"),e.requestUpdate()}).catch(e=>{console.error("Error creating default module:",e)})}const i=(0,X.Xe)(),r=t=>{const n=ne();let o;if("sl-tab-group"===n)o=parseInt(t?.detail?.name??t?.target?.activeTab??t?.detail?.value,10);else if("ha-tab-group"===n){const e=t?.detail??{},n=e.tab??e.target??e.item,i=n?.getAttribute?n.getAttribute("panel"):void 0,a=e.panel??e.tabId??i??e.value??t?.target?.activePanel??t?.target?.activeTab;if("number"==typeof a)o=a;else if("string"==typeof a){const e=ee.indexOf(a);o=-1!==e?e:parseInt(a,10)}}else o=t?.detail?.value??t?.target?.selected;Number.isFinite(o)||(o=0),e._selectedModuleTab=o,e.requestUpdate(),requestAnimationFrame(()=>{(0,K.XY)(e,!1)})},c=l.qy`

    Modules ${i.hasUpdates&&o?l.qy` ${i.updateCount} update${i.updateCount>1?"s":""} available `:""}

    ${o?"":l.qy`

    Bubble Card Tools required

    ${a.Ki&&a.Ki.size>0||e.hass&&e.hass.states&&e.hass.states[Z]?l.qy`

    Since v3.1.0, to install, edit or delete modules, and to use the Module Store, please install Bubble Card Tools (everything is explained there).

    Your existing modules will be automatically migrated once Bubble Card Tools is installed.

    `:l.qy`

    No modules detected yet. To create and manage modules and to use the Module Store, please install Bubble Card Tools (everything is explained there).

    `}
    `}
    ${(()=>{const t=ne(),i=e._selectedModuleTab||0,a=ee[i]??i.toString(),s=t=>{const n=ee.indexOf(t);e._selectedModuleTab=-1!==n?n:parseInt(t,10)||0,e.requestUpdate(),requestAnimationFrame(()=>(0,K.XY)(e,!1))};return"ha-tab-group"===t?l.qy` s(ee[0])} > My Modules s(ee[1])} > Module Store `:"sl-tab-group"===t?l.qy` My Modules Module Store `:l.qy` My Modules Module Store `})()} ${0!==e._selectedModuleTab&&o?(0,X._e)(e):l.qy` ${e._showManualImportForm?l.qy`

    Import Module from YAML

    Paste the complete YAML code of the module:

    {e._manualYamlContent=t.detail.value}} >
    `:e._showNewModuleForm||e._editingModule?(0,J.cu)(e):l.qy`
    ${L({trigger:l.qy` `,items:[{type:"checkbox",icon:"mdi:check-circle",label:"Active and recent first",checked:"default"===t,onClick:t=>{t.stopPropagation(),e._myModulesSortOrder="default";try{localStorage.setItem("bubble-card-modules-sort-order","default")}catch(e){}e.requestUpdate()}},{type:"checkbox",icon:"mdi:sort-alphabetical-ascending",label:"Alphabetical",checked:"alphabetical"===t,onClick:t=>{t.stopPropagation(),e._myModulesSortOrder="alphabetical";try{localStorage.setItem("bubble-card-modules-sort-order","alphabetical")}catch(e){}e.requestUpdate()}},{type:"checkbox",icon:"mdi:clock-outline",label:"Recent first",checked:"recent-first"===t,onClick:t=>{t.stopPropagation(),e._myModulesSortOrder="recent-first";try{localStorage.setItem("bubble-card-modules-sort-order","recent-first")}catch(e){}e.requestUpdate()}}]})}
    {const n=t.target.checked;e._forceUnsupportedModules=n;try{localStorage.setItem(te,n?"true":"false")}catch(e){}e.requestUpdate()}} > ${e._forceUnsupportedModules?l.qy`

    Use carefully

    Some modules may work despite being marked as unsupported, while others can fail entirely.

    `:""}
    ${re(e).map(t=>{const{name:n,description:a,formSchema:r,supportedCards:c,unsupportedCard:d,creator:u,moduleLink:p,moduleVersion:b}=(0,K.a7)(t),h=ae(e,t),m=ie(t,e.hass),g=r&&r.length>0,f="default"===t,y=f||g,v=e._config[t];void 0===e._workingModuleConfigs[t]&&(e._workingModuleConfigs[t]=structuredClone(v??{}));const _=e._workingModuleConfigs[t],w=e._config.card_type??"";let x=!1;x=c&&Array.isArray(c)&&c.length>0?!c.includes(w):d.includes(w);const k=!0===e._forceUnsupportedModules,C=x&&!k&&!h&&!m&&!f,$=r&&r.length>0?e._getProcessedSchema(t,r,_):[],A=i.modules.some(e=>e.id===t)&&o,L=A?i.modules.find(e=>e.id===t):null,E=e._recentlyToggledModuleId===t;return l.qy` {n.target.getAttribute("data-module-id")===t&&(e._expandedPanelStates[t]=n.target.expanded,e.requestUpdate())}} >

    ${n} ${A?l.qy` Update: ${L.newVersion} `:""} ${m?l.qy` `:""}

    ${S(e,t,!!e._expandedPanelStates[t],()=>l.qy`
    APPLY TO
    ${y&&!f?l.qy` `:""}
    ${A?l.qy` `:""} ${X.dn&&(0,X.dn)(t)||"default"===t?"":l.qy` `}

    ${e._helpModuleId===t?l.qy`

    Why "All cards" is disabled?

    Modules with custom editors cannot be applied globally. This feature is reserved for modules that only apply styles.

    `:""} ${r.length>0?l.qy`

    Configuration

    e._valueChangedInHaForm(n,t,r)} >
    `:""}

    About this module

    ${l.qy``}
    ${u||p||b?l.qy`

    ${u?`Created by ${u}`:""} ${p?l.qy`Module link • `:""} ${b||""}

    `:""} `)}
    `})} ${0===re(e).length?l.qy`

    No modules found

    No modules match your search criteria. Try modifying your search or sort order.

    `:""} `}
    ${e._showNewModuleForm||e._showManualImportForm||e._editingModule||!o?"":l.qy`
    `} `}

    Modules

    Modules are really powerful and the best way to apply custom styles and/or JS templates to your cards, without having to copy/paste the same code over and over again.

    This makes it easy to change things like the styles of all your cards, and for advanced users, to modify or add features with a real editor.

    If coding isn't your thing, you can also find and install modules made by the community in the Module Store.

    `,d=ne();return"sl-tab-group"===d?requestAnimationFrame(()=>{const t=e.shadowRoot?.getElementById(n);if(t&&"function"==typeof t.show){const n=void 0!==e._selectedModuleTab?e._selectedModuleTab.toString():"0";t.show(n)}}):"ha-tab-group"===d&&requestAnimationFrame(()=>{const t=e.shadowRoot?.getElementById(n);if(!t)return;const o=ee[e._selectedModuleTab??0]??(e._selectedModuleTab??0).toString();"activePanel"in t&&(t.activePanel=o),t.setAttribute("active-panel",o)}),c}(this)}makeModuleStore(){return(0,X._e)(this)}_normalizeConfigValuePath(e){const t=e=>null==e?"":String(e).trim();if("string"==typeof e||"number"==typeof e)return t(e);if(Array.isArray(e))return e.map(e=>t(e)).filter(Boolean).join(".");if(e&&"object"==typeof e){if(Array.isArray(e.path))return e.path.map(e=>t(e)).filter(Boolean).join(".");if(void 0!==e.path)return t(e.path);if(void 0!==e.key)return t(e.key)}return""}_valueChanged(e){const t=e.target,n=e.detail;let o,i=!1;const a=Boolean(t&&t.configValue&&Object.prototype.hasOwnProperty.call(t,"value")&&void 0===t.value);if("HA-SWITCH"===t.tagName?(o=t.checked,i=!0):void 0!==t.value?(o="string"==typeof t.value?t.value.replace(",","."):t.value,i=!0):a?(o=t.value,i=!0):void 0!==n?.value&&(i=!0),!i)return;if("string"==typeof o&&(o.endsWith(".")||"-"===o))return;let r={...this._config};try{const{configValue:i,checked:a}=t;if(i){const a=this._normalizeConfigValuePath(i);if(!a)return void console.warn("Bubble Card Editor: skipped update due to invalid configValue",i);const s=a.split(".").filter(Boolean);if(!s.length)return void console.warn("Bubble Card Editor: empty config path provided",i);if(s.length>1){let i=r,a="";for(let e=0;ethis._arrayValueChange(e,t,n),10);const o=(e,t,n,o)=>{const i=String(t).split(".").filter(Boolean);let a=e;for(let e=0;e{const i=String(t).split(".").filter(Boolean);let a=e;for(let e=0;e=4){const e=n[n.length-3];c=n.slice(0,n.length-3).join(".");const t=parseInt(e,10);d=isNaN(t)?null:t}else if(n.length>=3){c=n[0];const e=parseInt(n[1],10);d=isNaN(e)?null:e}this._ActionChanged(l,c,d)}_computeLabelCallback=e=>e.label;_conditionChanged(e,t,n){if(e.stopPropagation(),n){this._config[n]=this._config[n]||[];let o=[...this._config[n]];o[t]=o[t]||{};const i=e.detail.value;o[t]={...o[t],visibility:i},this._config[n]=o}else if("pop-up"===this._config.card_type){const t=e.detail.value;this._config={...this._config,trigger:t}}(0,s.rC)(this,"config-changed",{config:this._config}),this.requestUpdate()}static get styles(){return l.AH` ${(0,l.iz)('div {\n display: grid;\n grid-gap: 12px;\n}\n\n/* Card type dropdown separator */\n.card-config > ha-form:first-of-type::after {\n content: "";\n position: relative;\n background-color: var(--background-color, var(--secondary-background-color));\n display: block;\n width: 100%;\n height: 1px;\n top: 12px;\n margin-bottom: 12px !important;\n opacity: 0.6;\n}\n\n#add-button {\n margin: 0 0 14px 0;\n color: var(--text-primary-color);\n width: 100%;\n height: 32px;\n border-radius: 16px;\n border: none;\n background-color: var(--accent-color);\n cursor: pointer;\n}\n\np {\n margin-bottom: 4px;\n}\n\nul {\n margin: 0px 14px !important;\n padding-left: 0px !important;\n}\n\nha-icon, a, p, button, h4 {\n color: var(--primary-text-color) !important;\n}\n\nhr {\n display: inline-block;\n width: 100%;\n height: 1px;\n border: none;\n background-color: var(--outline-color);\n margin: 8px 0 0 0;\n}\n\ncode, code-block {\n background: rgba(0,120,180,0.3);\n color: var(--primary-text-color);\n background-blend-mode: darken;\n padding: 1px 3px;\n border-radius: 6px;\n font-size: 13px;\n}\n\ncode-block {\n display: grid;\n width: 100%;\n padding: 0;\n max-height: 285px;\n overflow: auto;\n}\n\ncode-block pre {\n white-space: pre;\n overflow: auto;\n margin: 8px;\n}\n\ncode-block.with-i pre {\n white-space: pre-line;\n overflow: auto;\n margin: 8px;\n}\n\ncode-block.with-i pre > i {\n white-space: pre;\n font-style: normal;\n}\n\nimg {\n max-width: 100%;\n margin: 14px 0;\n}\n\nimg.example {\n padding: 32px;\n box-sizing: border-box;\n background: rgba(0, 120, 180, 0.8);\n border-radius: 6px;\n}\n\n.button-header {\n height: auto;\n width: 100%;\n display: inline-flex;\n align-items: center;\n margin: 0 8px;\n}\n\n.button-number {\n display: inline-flex;\n width: auto;\n}\n\n.remove-button {\n display: inline-flex;\n border-radius: 50%;\n width: 24px;\n height: 24px;\n text-align: center;\n line-height: 24px;\n vertical-align: middle;\n cursor: pointer;\n}\n\n.content {\n margin: 12px 4px 14px 4px;\n}\n\nh4 > ha-icon {\n margin: 8px 12px 8px 8px;\n}\n\nha-expansion-panel h4:not(.version) {\n display: flex;\n align-items: center;\n margin: 10px 0;\n}\n\nha-expansion-panel > .content, ha-expansion-panel .content {\n overflow-x: visible !important;\n display: flex;\n flex-direction: column; \n}\n\nha-form {\n --expansion-panel-summary-padding: 2px 14px;\n}\n\nha-textfield {\n width: 100%;\n}\n\nh3 {\n margin: 4px 0;\n}\n\n.code-editor {\n overflow: scroll;\n}\n\n.icon-button {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 8px 16px;\n background: rgba(0,120,180,0.5);\n border: none;\n cursor: pointer;\n margin: 0;\n border-radius: 32px;\n font-size: 13px;\n font-weight: bold;\n text-align: center;\n text-decoration: none;\n transition: all 0.2s ease;\n}\n\n.icon-button:hover {\n background: rgba(0,120,180,0.7);\n transform: translateY(-1px);\n}\n\n.icon-button:active {\n background: rgba(0,120,180,0.9);\n}\n\n.icon-button.header {\n background: none;\n padding: 0;\n margin: 0 4px;\n}\n\n.button-container {\n display: flex;\n margin-left: auto !important;\n}\n\nha-card-conditions-editor {\n margin-top: -12px;\n}\n\n.disabled {\n opacity: 0.5; \n pointer-events: none;\n}\n\n.version {\n font-size: 12px !important;\n color: #fff;\n background: rgba(0,0,0,0.1);\n padding: 8px 16px;\n border-radius: 32px;\n}\n\n.module-version {\n margin: 0;\n}\n\n.version-number {\n font-size: 10px;\n background: rgba(0,120,180,1);\n padding: 0px 8px;\n border-radius: 12px;\n margin-right: -6px;\n float: right;\n color: white;\n}\n\n.version-number a {\n color: white !important;\n}\n\n.bubble-info-container {\n display: flex;\n flex-direction: column;\n}\n\n.bubble-section-title {\n font-size: 14px;\n font-weight: 600;\n margin-bottom: -6px !important;\n color: var(--primary-text-color) !important;\n display: flex;\n align-items: center;\n position: relative;\n padding-left: 4px;\n}\n\n.bubble-section-title ha-icon {\n color: var(--info-color) !important;\n margin: 8px 8px 8px 0;\n line-height: normal !important;\n}\n\n.bubble-section-title::before {\n content: "";\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 3px;\n background: var(--primary-color);\n border-radius: 2px;\n}\n\n.bubble-info {\n padding: 0 0 14px;\n position: relative;\n overflow: auto;\n}\n\n.bubble-info .content {\n margin: 0;\n padding: 0 18px;\n}\n\n.bubble-info::before {\n content: "";\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n background-color: var(--info-color);\n border-radius: 4px;\n opacity: 0.12;\n pointer-events: none;\n}\n\n.bubble-info.warning::before {\n background-color: var(--warning-color);\n opacity: 0.15;\n}\n\n.bubble-info.warning .bubble-section-title::before {\n background: var(--warning-color);\n}\n\n.bubble-info.warning .bubble-section-title ha-icon {\n color: var(--warning-color) !important;\n}\n\n.bubble-info.error::before {\n background-color: var(--error-color);\n opacity: 0.15;\n}\n\n.bubble-info.error .bubble-section-title::before {\n background: var(--error-color);\n}\n\n.bubble-info.error .bubble-section-title ha-icon {\n color: var(--error-color) !important;\n}\n\n.bubble-info h4 {\n margin: 8px 0 0 0;\n padding: 0 18px;\n}\n\n.bubble-info p {\n margin: 0;\n}\n\n.bubble-info * {\n z-index: 1;\n}\n\n.bubble-section-title + p {\n margin-top: 0;\n padding-top: 0;\n}\n\n.bubble-badges {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin: 4px 0;\n justify-content: flex-start;\n}\n\n.bubble-badge {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 4px 8px;\n text-decoration: none;\n font-size: 13px;\n transition: all 0.2s ease;\n box-shadow: none;\n height: 26px;\n border: none;\n position: relative;\n border-radius: 18px;\n white-space: nowrap;\n background-color: var(--mdc-text-field-disabled-line-color);\n}\n\n.bubble-badge:hover {\n transform: translateY(-1px);\n background: rgba(0, 120, 180, 0.5);\n}\n\n.bubble-badge ha-icon {\n color: var(--primary-text-color) !important;\n --mdc-icon-size: 16px;\n line-height: normal;\n}\n\n.paypal-icon, .bmc-icon, .patreon-icon {\n width: 15px;\n height: 15px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.paypal-icon svg, .bmc-icon svg, .patreon-icon svg {\n width: 100%;\n height: 100%;\n fill: var(--primary-text-color);\n}\n\n.bubble-thank-you {\n margin: 0 !important;\n padding: 8px !important;\n opacity: 0.8;\n}\n\n.creator-message {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n\n.creator-message a {\n display: flex;\n transition: all 0.2s ease;\n}\n\n.creator-message a:hover {\n transform: scale(0.95);\n}\n\n.creator-avatar {\n min-width: 42px;\n height: 42px;\n border-radius: 50%;\n margin: 0;\n}\n\nul.icon-list {\n list-style-type: none;\n padding-left: 0 !important;\n margin-left: 0 !important;\n}\n\nul.icon-list li {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n line-height: 24px;\n}\n\nul.icon-list li ha-icon {\n min-width: 24px;\n margin-right: 8px;\n --mdc-icon-size: 18px;\n}\n\n.layout-subsection {\n display: grid;\n grid-gap: 12px;\n padding: 12px 0 0;\n}\n\n.layout-subtitle {\n display: flex;\n align-items: center;\n margin: 0;\n font-size: 14px;\n font-weight: 600;\n color: var(--primary-text-color);\n}\n\n.layout-subtitle ha-icon {\n margin-right: 8px;\n --mdc-icon-size: 18px;\n}\n\n.element-actions {\n display: flex;\n justify-content: flex-end;\n}\n\n.no-bg {\n background: none;\n box-shadow: none;\n}\n\nmwc-list-item[disabled] ha-icon {\n opacity: 0.38;\n}:root {\n --rgb-primary-color: 3, 169, 244;\n --rgb-info-color: 33, 150, 243;\n --rgb-warning-color: 255, 152, 0;\n --rgb-error-color: 244, 67, 54;\n --rgb-success-color: 76, 175, 80;\n}\n\n/* Module Store Styles */\n.module-store {\n display: flex;\n flex-direction: column;\n gap: 16px;\n position: relative;\n padding-bottom: 40px;\n}\n\n.store-header {\n display: flex;\n flex-direction: column;\n gap: 12px;\n margin-bottom: 16px;\n background-color: var(--card-background-color);\n border-radius: 16px;\n padding: 16px;\n border: 1px solid var(--divider-color);\n box-shadow: var(--shadow-elevation-1dp);\n position: relative;\n overflow: hidden;\n}\n\n.store-header-top {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 8px;\n}\n\n.store-header-title {\n font-size: 16px;\n font-weight: 600;\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.store-header-title ha-icon {\n color: var(--info-color) !important;\n}\n\n.store-refresh-button {\n color: var(--primary-text-color);\n border-radius: 50%;\n width: 36px;\n height: 36px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: all 0.3s ease;\n box-shadow: var(--shadow-elevation-1dp);\n}\n\n.store-refresh-button:hover {\n transform: rotate(180deg);\n box-shadow: var(--shadow-elevation-2dp);\n}\n\n.store-search {\n display: flex;\n align-items: center;\n gap: 8px;\n border-radius: 32px;\n overflow: hidden;\n}\n\n.store-search ha-textfield {\n flex-grow: 1;\n}\n\n.store-filters {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 12px;\n margin-top: 4px;\n}\n\n.store-filter-type {\n flex-grow: 1;\n min-width: 180px;\n}\n\n.store-modules {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.store-module-card {\n display: flex;\n flex-direction: column;\n border-radius: 16px;\n border: 1px solid var(--divider-color);\n overflow: hidden;\n transition: transform 0.3s ease, box-shadow 0.3s ease;\n background-color: var(--card-background-color);\n box-shadow: var(--shadow-elevation-1dp);\n margin-bottom: 16px;\n}\n\n.store-module-card:hover {\n transform: translateY(-3px);\n box-shadow: var(--shadow-elevation-3dp);\n}\n\n.store-module-header {\n position: relative;\n padding: 16px 16px 0 0;\n margin: 0;\n border-radius: 0;\n border-bottom: 1px solid var(--divider-color);\n}\n\n.store-module-header::before {\n content: "";\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n background-color: var(--info-color);\n border-radius: 0;\n opacity: 0.12;\n pointer-events: none;\n}\n\n.store-module-header.warning::before {\n background-color: var(--warning-color);\n opacity: 0.15;\n}\n\n.store-module-header .bubble-section-title {\n display: flex;\n align-items: center;\n gap: 12px;\n padding-left: 0;\n margin-bottom: 0px !important;\n position: relative;\n}\n\n.store-module-header .bubble-section-title::before {\n content: "";\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 3px;\n background: var(--primary-color);\n border-radius: 0 2px 2px 0;\n}\n\n.store-module-header.warning .bubble-section-title::before {\n background: var(--warning-color);\n}\n\n.store-module-header .bubble-section-title ha-icon {\n margin: 0 0 0 19px;\n color: var(--info-color) !important;\n}\n\n.store-module-header.warning .bubble-section-title ha-icon {\n color: var(--warning-color) !important;\n}\n\n.store-module-header h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n\n.store-module-meta {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 0 4px 18px;\n margin-bottom: 0;\n}\n\n.store-module-badges {\n margin: 0;\n justify-content: flex-start;\n}\n\n.store-module-author {\n display: flex;\n align-items: center;\n gap: 12px;\n font-size: 14px;\n color: var(--secondary-text-color);\n}\n\n.author-avatar {\n width: 24px;\n height: 24px;\n border-radius: 50%;\n margin: 0;\n border: 1px solid rgba(0,0,0,0.1);\n}\n\n.store-module-content {\n padding: 0 16px;\n background-color: var(--card-background-color);\n grid-gap: 8px;\n}\n\n.module-description {\n margin: 0 0 -4px;\n font-size: 14px;\n font-weight: 300;\n}\n\n.module-preview-image {\n border-radius: 12px;\n max-height: 220px;\n width: 100%;\n object-fit: contain;\n background-color: var(--secondary-background-color);\n margin: 0;\n transition: all 0.3s ease;\n}\n\n.module-preview-container {\n position: relative;\n margin-top: 8px;\n overflow: hidden;\n border-radius: 12px;\n}\n\n.module-preview-zoom-btn {\n position: absolute;\n bottom: 8px;\n right: 8px;\n width: 32px;\n height: 32px;\n border-radius: 50%;\n background-color: var(--primary-color);\n color: white;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n opacity: 0.8;\n transition: all 0.2s ease;\n z-index: 5;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n}\n\n.module-preview-zoom-btn:hover {\n opacity: 1;\n transform: scale(1.1);\n}\n\n.module-preview-zoom-btn ha-icon {\n color: white !important;\n --mdc-icon-size: 20px;\n}\n\n.module-preview-fullscreen {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.9);\n z-index: 999;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: zoom-out;\n}\n\n.module-preview-fullscreen img {\n max-width: 90%;\n max-height: 90%;\n object-fit: contain;\n margin: 0;\n border-radius: 6px;\n}\n\n.compatibility-warning {\n margin-top: -8px;\n margin-bottom: 12px;\n}\n\n.compatibility-warning ha-icon {\n color: var(--warning-color) !important;\n}\n\n.store-module-actions {\n margin: 12px 0 12px;\n justify-content: flex-start;\n border-top: 1px solid var(--divider-color);\n padding-top: 12px;\n display: flex;\n gap: 8px;\n}\n\n.store-module-card.incompatible .store-module-actions {\n opacity: 0.8;\n}\n\n.bubble-badge.install-button {\n background-color: rgba(33, 150, 243, 0.7);\n color: var(--primary-color);\n font-weight: 500;\n transition: all 0.2s ease;\n display: flex;\n align-items: center;\n gap: 6px;\n cursor: pointer;\n}\n\n.bubble-badge.install-button span {\n color: var(--primary-text-color);\n font-weight: 500;\n transition: color 0.2s ease;\n}\n\n.bubble-badge.install-button ha-icon {\n transition: color 0.2s ease;\n}\n\n.bubble-badge.install-button:hover {\n transform: translateY(-1px);\n background-color: rgba(33, 150, 243, 0.9);\n}\n\n.bubble-badge.install-button:hover span,\n.bubble-badge.install-button:hover ha-icon {\n color: white !important;\n}\n\n.bubble-badge.update-button {\n background-color: rgb(0, 220, 80);\n font-weight: 500;\n transition: all 0.2s ease;\n display: flex;\n align-items: center;\n gap: 6px;\n cursor: pointer;\n color: rgba(0, 0, 0, 0.8) !important;\n}\n\n.bubble-badge.update-button ha-icon {\n color: rgba(0, 0, 0, 0.8) !important;\n}\n\n.bubble-badge.update-button:hover {\n transform: translateY(-1px);\n background-color: rgb(0, 180, 60);\n}\n\n.bubble-badge.clickable {\n cursor: pointer;\n}\n\n.bubble-badge.installed-button {\n background-color: rgba(var(--rgb-success-color, 0, 170, 0), 0.12);\n color: var(--success-color, var(--primary-color));\n opacity: 0.8;\n cursor: default;\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.bubble-badge.installed-button span {\n color: var(--primary-text-color);\n font-weight: 500;\n}\n\n.bubble-badge.installed-button:hover {\n transform: none;\n background: rgba(var(--rgb-success-color, 0, 170, 0), 0.12);\n}\n\n.bubble-badge.link-button {\n background-color: rgba(0, 0, 0, 0.06);\n color: var(--secondary-text-color);\n transition: all 0.2s ease;\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.bubble-badge.link-button:hover {\n background-color: rgba(0, 0, 0, 0.12);\n transform: translateY(-1px);\n}\n\n.bubble-badge.update-badge {\n background-color: rgb(0, 220, 80);\n font-weight: 500;\n font-size: 11px;\n padding: 2px 8px;\n height: 20px;\n margin-left: auto !important;\n color: rgba(0, 0, 0, 0.8);\n}\n\n.bubble-badge.update-badge ha-icon {\n color: rgba(0, 0, 0, 0.8) !important;\n}\n\n.bubble-badge.update-badge:hover {\n transform: none;\n}\n\n.bubble-badge.version-badge {\n background-color: rgba(0, 0, 0, 0.08);\n color: var(--primary-text-color);\n font-weight: 500;\n font-size: 11px;\n padding: 2px 8px;\n height: 20px;\n}\n\n.bubble-badge.incompatible-badge {\n background-color: rgba(var(--rgb-warning-color), 0.12);\n color: var(--warning-color);\n font-weight: 500;\n font-size: 11px;\n padding: 2px 8px;\n height: 20px;\n}\n\n.bubble-badge.incompatible-badge::before {\n background-color: var(--warning-color);\n opacity: 0.3;\n}\n\n.bubble-badge.new-badge {\n background-color: rgba(var(--rgb-success-color, 0, 170, 0), 0.12);\n color: var(--primary-text-color);\n font-weight: 500;\n font-size: 11px;\n padding: 2px 8px;\n height: 20px;\n}\n\n.bubble-badge.new-badge::before {\n background-color: var(--success-color, #28a745);\n opacity: 0.2;\n}\n\n.bubble-badge.yaml-badge {\n background-color: rgba(255, 167, 38, 0.45);\n color: var(--primary-text-color);\n font-weight: 700;\n font-size: 11px;\n padding: 2px 8px;\n height: 20px;\n}\n\n.bubble-badge.yaml-badge::before {\n background-color: #ff9800;\n opacity: 0.5;\n}\n\n.version-container {\n display: flex;\n align-items: center;\n margin-left: auto;\n gap: 8px;\n}\n\n/* Material tabs */\nha-tabs, ha-tab-group, sl-tab-group {\n margin-bottom: 16px;\n --primary-tab-color: var(--primary-color);\n --secondary-tab-color: var(--secondary-text-color);\n border-bottom: 1px solid var(--divider-color);\n top: 0;\n position: sticky;\n background-color: var(--card-background-color);\n z-index: 6;\n padding-top: 16px;\n margin-top: -24px;\n top: -40px;\n}\n\nsl-tab-group {\n border-bottom: none;\n}\n\nha-tab-group {\n display: block;\n}\n\nha-tab-group-tab {\n flex-grow: 1;\n text-align: center;\n}\n\nha-tab-group-tab[active] {\n color: var(--primary-text-color);\n opacity: 1;\n}\n\nha-tab-group-tab[disabled] {\n opacity: 0.4;\n pointer-events: none;\n}\n.module-editor-top-marker {\n display: flex;\n position: relative;\n top: 0;\n}\n\npaper-tab {\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 120px;\n font-weight: 500;\n font-size: 14px;\n transition: all 0.3s ease;\n position: relative;\n color: var(--secondary-tab-color);\n padding: 0 16px;\n opacity: 0.8;\n}\n\npaper-tab[aria-selected="true"] {\n color: var(--primary-text-color);\n opacity: 1;\n}\n\npaper-tab.disabled,\npaper-tab[disabled] {\n opacity: 0.4;\n pointer-events: none;\n}\n\npaper-tab ha-icon {\n margin-right: 8px;\n color: var(--secondary-tab-color);\n}\n\npaper-tab[aria-selected="true"] ha-icon {\n color: var(--primary-tab-color) !important;\n}\n\npaper-tab::after {\n content: \'\';\n position: absolute;\n bottom: 0;\n left: 50%;\n width: 0;\n height: 3px;\n background-color: var(--primary-tab-color);\n transition: all 0.3s ease;\n transform: translateX(-50%);\n border-radius: 3px 3px 0 0;\n opacity: 0;\n}\n\npaper-tab[aria-selected="true"]::after {\n width: 80%;\n opacity: 1;\n}\n\npaper-tab:hover {\n background-color: rgba(var(--rgb-primary-color), 0.05);\n}\n\n/* Tab ripple effect */\npaper-ripple {\n color: var(--primary-tab-color);\n opacity: 0.1;\n}\n\n#tabs {\n border-radius: 8px 8px 0 0;\n overflow: hidden;\n background-color: var(--card-background-color);\n box-shadow: var(--shadow-elevation-1dp);\n}\n\n@media (max-width: 600px) {\n paper-tab {\n min-width: auto;\n padding: 0 12px;\n font-size: 13px;\n }\n}\n\nsl-tab {\n flex: 1;\n text-align: center;\n}\n\n.bubble-badge.hoverable {\n cursor: pointer !important;\n transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;\n}\n\n.bubble-badge.hoverable:active {\n transform: translateY(0);\n}\n\n/* Back to top button */\n.back-to-top-button {\n position: sticky;\n bottom: 0px;\n right: 20px;\n width: 44px;\n height: 44px;\n border-radius: 50%;\n background-color: var(--primary-color);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n box-shadow: 0 2px 6px rgba(0,0,0,0.3);\n transition: all 0.2s ease;\n z-index: 10;\n margin-left: auto;\n margin-top: 16px;\n}\n\n.back-to-top-button:hover {\n transform: translateY(-4px);\n box-shadow: 0 4px 10px rgba(0,0,0,0.3);\n}\n\n.back-to-top-button:active {\n transform: translateY(0);\n box-shadow: 0 1px 3px rgba(0,0,0,0.3);\n}\n\n.back-to-top-button ha-icon {\n color: white !important;\n --mdc-icon-size: 22px;\n}\n\n.store-loading {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 42px;\n gap: 24px;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: 16px;\n border: 1px solid var(--divider-color);\n box-shadow: var(--shadow-elevation-1dp);\n overflow: hidden;\n}\n\n.bubble-loading-icon {\n position: relative;\n width: 64px;\n height: 64px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 8px;\n}\n\n.icon-center-wrapper {\n position: absolute;\n top: 3px;\n left: 6px;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 2;\n}\n\n.bubble-loading-icon ha-icon {\n --mdc-icon-size: 26px;\n color: var(--primary-color);\n opacity: 0.9;\n animation: pulseAnimation 3s ease-in-out infinite;\n margin: 0;\n padding: 0;\n}\n\n.bubble-loading-orbit {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 2px dashed rgba(var(--rgb-primary-color), 0.2);\n border-radius: 50%;\n animation: orbitRotation 8s linear infinite;\n}\n\n.bubble-loading-satellite {\n position: absolute;\n width: 12px;\n height: 12px;\n background-color: var(--info-color);\n border-radius: 50%;\n top: -6px;\n left: calc(50% - 6px);\n box-shadow: 0 0 10px rgba(var(--rgb-info-color), 0.7);\n animation: pulseAnimation 2s ease-in-out infinite;\n transform-origin: center center;\n}\n\n.bubble-progress-container {\n width: 100%;\n max-width: 400px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n position: relative;\n}\n\n.bubble-progress-track {\n height: 10px;\n background-color: rgba(var(--rgb-primary-color), 0.12);\n border-radius: 10px;\n overflow: hidden;\n position: relative;\n backdrop-filter: blur(4px);\n box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);\n transition: all 0.3s ease;\n transform: translateZ(0);\n contain: paint;\n}\n\n.bubble-progress-bar {\n background: var(--info-color);\n border-radius: 10px;\n transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);\n min-width: 10px;\n}\n\n.bubble-progress-glow {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n}\n\n.bubble-progress-percentage {\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-size: 14px;\n color: var(--primary-text-color);\n}\n\n.bubble-progress-text {\n font-weight: 500;\n}\n\n.bubble-progress-value {\n font-weight: 600;\n color: var(--primary-color);\n font-variant-numeric: tabular-nums;\n}\n\n.bubble-progress-dots {\n display: flex;\n gap: 4px;\n}\n\n.bubble-progress-dots .dot {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background-color: var(--primary-color);\n opacity: 0.5;\n}\n\n.bubble-progress-dots .dot:nth-child(1) {\n animation: dotAnimation 1.4s ease-in-out infinite;\n}\n\n.bubble-progress-dots .dot:nth-child(2) {\n animation: dotAnimation 1.4s ease-in-out 0.2s infinite;\n}\n\n.bubble-progress-dots .dot:nth-child(3) {\n animation: dotAnimation 1.4s ease-in-out 0.4s infinite;\n}\n\n@keyframes orbitRotation {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n@keyframes pulseAnimation {\n 0%, 100% {\n transform: scale(1);\n opacity: 0.9;\n }\n 50% {\n transform: scale(1.1);\n opacity: 1;\n }\n}\n\n@keyframes glowAnimation {\n 0% {\n --x: 0%;\n opacity: 0.5;\n }\n 50% {\n --x: 100%;\n opacity: 1;\n }\n 100% {\n --x: 0%;\n opacity: 0.5;\n }\n}\n\n@keyframes dotAnimation {\n 0%, 100% {\n transform: translateY(0);\n opacity: 0.5;\n }\n 50% {\n transform: translateY(-4px);\n opacity: 1;\n }\n}\n\n/* Styles for the supported cards selector */\n.checkbox-grid {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: 12px;\n margin-bottom: 8px;\n}\n\n@media (max-width: 600px) {\n .checkbox-grid {\n grid-template-columns: repeat(2, 1fr);\n }\n}\n\n/* Module Editor Styles */\n.module-actions {\n display: flex;\n gap: 8px;\n margin-left: auto;\n}\n\n.module-editor-form .card-content {\n display: grid;\n grid-gap: 16px;\n padding: 0;\n}\n\n.module-editor-form h3 {\n margin: 8px 0;\n color: var(--primary-text-color);\n font-size: 18px;\n font-weight: 500;\n}\n\n.module-editor-form h4:not(.bubble-section-title) {\n margin: 0 !important;\n font-size: 16px;\n}\n\n.module-editor-form ha-code-editor {\n max-height: 600px;\n width: 100%;\n max-width: 100%;\n border: 1px solid var(--divider-color);\n border-radius: 4px;\n overflow: scroll !important;\n box-sizing: border-box;\n display: block;\n}\n\n.module-editor-form ha-code-editor::part(editor) {\n width: 100%;\n max-width: 100%;\n overflow-x: auto;\n overflow-y: auto;\n}\n\n.module-editor-form ha-code-editor .monaco-editor {\n width: 100% !important;\n max-width: 100% !important;\n}\n\n.module-editor-form ha-code-editor .monaco-editor .monaco-editor-background {\n width: 100% !important;\n}\n\n.module-editor-form ha-code-editor .monaco-editor .overflow-guard {\n width: 100% !important;\n max-width: 100% !important;\n overflow-x: auto !important;\n}\n\n.module-editor-form ha-code-editor .monaco-editor .monaco-scrollable-element {\n width: 100% !important;\n max-width: 100% !important;\n overflow-x: auto !important;\n}\n\n.css-editor-container {\n width: 100%;\n max-width: 100%;\n max-height: 500px;\n overflow-x: auto;\n overflow-y: auto;\n box-sizing: border-box;\n}\n\n.css-editor-container ha-code-editor {\n width: 100%;\n max-width: 100%;\n overflow: hidden;\n box-sizing: border-box;\n display: block;\n}\n\n.css-editor-container ha-code-editor::part(editor) {\n width: 100%;\n max-width: 100%;\n overflow-x: auto;\n overflow-y: auto;\n}\n\n.css-editor-container ha-code-editor .monaco-editor {\n width: 100% !important;\n max-width: 100% !important;\n}\n\n.css-editor-container ha-code-editor .monaco-editor .monaco-editor-background {\n width: 100% !important;\n}\n\n.css-editor-container ha-code-editor .monaco-editor .overflow-guard {\n width: 100% !important;\n max-width: 100% !important;\n overflow-x: auto !important;\n}\n\n.css-editor-container ha-code-editor .monaco-editor .monaco-scrollable-element {\n width: 100% !important;\n max-width: 100% !important;\n overflow-x: auto !important;\n}\n\n.module-editor-form ha-textarea {\n width: 100%;\n}\n\n.module-actions .icon-button {\n width: 36px;\n height: 36px;\n border-radius: 18px;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n}\n\n.module-actions .icon-button {\n background: none;\n}\n\n.module-actions .icon-button ha-icon {\n --mdc-icon-size: 18px;\n}\n\n.code-editor-container, .editor-schema-container {\n position: relative;\n margin-bottom: 8px;\n overflow-x: auto;\n overflow-y: visible;\n width: 100%;\n max-width: 100%;\n box-sizing: border-box;\n}\n\n.code-editor-container ha-code-editor,\n.editor-schema-container ha-code-editor {\n height: auto; \n width: 100%;\n max-width: 100%;\n border: 1px solid var(--divider-color);\n border-radius: 4px;\n overflow: hidden;\n box-sizing: border-box;\n display: block;\n}\n\n.code-editor-container ha-code-editor::part(editor),\n.editor-schema-container ha-code-editor::part(editor) {\n width: 100%;\n max-width: 100%;\n overflow-x: auto;\n overflow-y: auto;\n}\n\n.code-editor-container ha-code-editor .monaco-editor,\n.editor-schema-container ha-code-editor .monaco-editor {\n width: 100% !important;\n max-width: 100% !important;\n}\n\n.code-editor-container ha-code-editor .monaco-editor .monaco-editor-background,\n.editor-schema-container ha-code-editor .monaco-editor .monaco-editor-background {\n width: 100% !important;\n}\n\n.code-editor-container ha-code-editor .monaco-editor .overflow-guard,\n.editor-schema-container ha-code-editor .monaco-editor .overflow-guard {\n width: 100% !important;\n max-width: 100% !important;\n overflow-x: auto !important;\n}\n\n.code-editor-container ha-code-editor .monaco-scrollable-element,\n.editor-schema-container ha-code-editor .monaco-scrollable-element {\n width: 100% !important;\n max-width: 100% !important;\n overflow-x: auto !important;\n}\n\n.form-preview {\n border: 1px solid var(--divider-color);\n border-radius: 8px;\n padding: 16px;\n}\n\n.form-preview h4 {\n margin-top: 0;\n margin-bottom: 16px;\n color: var(--primary-color);\n display: flex;\n align-items: center;\n}\n\n.form-preview-container {\n padding: 8px;\n border-radius: 4px;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 0.7;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.7;\n }\n}\n\n.export-section {\n margin-top: 12px;\n}\n\n.export-buttons {\n display: flex;\n flex-wrap: wrap;\n gap: 12px;\n margin-top: 8px;\n margin-bottom: 16px;\n}\n\n.export-buttons .icon-button {\n flex: 1;\n min-width: 160px;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 10px 16px;\n}\n\n.export-preview {\n margin-top: 12px;\n padding: 8px;\n border: 1px solid var(--divider-color);\n border-radius: 8px;\n max-height: 300px;\n overflow: auto;\n background: var(--secondary-background-color);\n}\n\n.export-preview pre {\n margin: 0;\n white-space: pre-wrap;\n font-family: monospace;\n font-size: 12px;\n line-height: 1.4;\n padding: 8px;\n}\n\nha-expansion-panel {\n --input-fill-color: none;\n scroll-margin-top: 64px;\n contain: inline-size;\n overflow: clip;\n}\n\nha-expansion-panel > .content,\nha-expansion-panel .content {\n min-width: 0;\n max-width: 100%;\n overflow-x: auto;\n overflow-y: visible;\n box-sizing: border-box;\n}\n\nha-yaml-editor,\nha-code-editor {\n min-width: 0;\n max-width: 100%;\n width: 100%;\n display: block;\n box-sizing: border-box;\n contain: inline-size;\n}\n\n@keyframes highlight {\n 0% { background-color: var(--primary-color); }\n 100% { background-color: transparent; }\n}\n\nha-expansion-panel.recently-toggled {\n animation: highlight 2s;\n}\n\n.helper-text {\n display: block;\n color: var(--secondary-text-color);\n font-size: 12px;\n margin-top: -4px;\n margin-bottom: 8px;\n}\n\n.helper-text a {\n color: var(--primary-color);\n}\n\n.helper-text a:hover {\n opacity: 0.8;\n}\n\n.bubble-info > div {\n --mdc-icon-size: 18px;\n}\n\nha-formfield.apply-module-button {\n height: 40px;\n border-radius: 32px;\n padding: 0 16px;\n background-color: rgba(0, 0, 0, 0.1);;\n}\n\n.module-editor-buttons-container {\n display: flex; \n gap: 8px; \n justify-content: flex-end;\n position: sticky;\n bottom: -24px;\n background-color: var(--card-background-color);\n padding: 8px 0;\n z-index: 1;\n}\n\n.module-toggles-container {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.module-toggles-label {\n font-size: 0.85em;\n font-weight: 500;\n color: var(--secondary-text-color);\n padding-left: 4px;\n margin-bottom: -4px;\n}\n\n.module-toggles {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 8px;\n}\n\n.module-badges {\n display: inline-flex;\n margin-left: auto;\n gap: 4px;\n}\n\n/* Module status icon */\n.module-status-icon {\n opacity: 0.3;\n transition: opacity 0.2s ease, color 0.2s ease;\n}\n\n.module-status-icon--opaque {\n opacity: 1;\n}\n\n.module-status-icon--active {\n color: var(--info-color) !important;\n}\n\n.module-badges .update-badge {\n margin-left: 0 !important;\n}\n\n.global-badge {\n background-color: transparent !important;\n border: 1px solid rgb(0, 220, 80);\n padding: 1px 3px !important;\n}\n\n.update-badge + .global-badge {\n margin-left: 4px !important;\n}\n\n.toggle-badge {\n cursor: pointer !important;\n border: 1px solid var(--primary-text-color);\n}\n\n/* My Modules Search and Sort Controls */\n.my-modules-controls {\n display: flex;\n flex-direction: column;\n gap: 12px;\n margin-bottom: 16px;\n background-color: var(--card-background-color);\n border-radius: 16px;\n padding: 16px;\n border: 1px solid var(--divider-color);\n box-shadow: var(--shadow-elevation-1dp);\n}\n\n.my-modules-top-row {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n\n.my-modules-search {\n flex: 1;\n display: flex;\n align-items: center;\n border-radius: 32px;\n overflow: hidden;\n}\n\n.my-modules-search ha-textfield {\n flex-grow: 1;\n width: 100%;\n}\n\n.my-modules-sort-menu {\n display: flex;\n align-items: center;\n}\n\n\n.unsupported-modules-warning {\n margin: 0;\n}\n\n.my-modules-sort-menu .sort-trigger {\n background: none;\n padding: 0;\n margin: 0 4px;\n}\n\n.my-modules-sort-menu mwc-list-item[selected] {\n background-color: rgba(var(--rgb-primary-color), 0.12) !important;\n}\n\n.my-modules-sort-menu mwc-list-item[selected]:hover {\n background-color: rgba(var(--rgb-primary-color), 0.18) !important;\n}\n\nmwc-icon-button ha-icon {\n line-height: 100% !important;\n}\n')} `}static _resizeObserver=null;static _editorInstanceMap=new WeakMap;_getBubbleCardFromPreview(){try{if(this._previewCardRoot){const e=this._previewCardRoot.host||this._previewCardHost;if(e?.isConnected||this._previewCardRoot.isConnected)return this._previewCardRoot}if(this._previewCardHost?.isConnected)return this._previewCardHost.shadowRoot||this._previewCardHost.getRootNode?.()||null;const e=this._getEditorPreviewContainer();if(e){const t=this._deepQuerySelector(e,"bubble-card"),n=t?.shadowRoot||null;if(n)return this._previewCardHost=t,this._previewCardRoot=n,n}}catch(e){return null}}_setupAutoRowsObserver(){const e=void 0!==this._config?.grid_options?.rows&&null!==this._config?.grid_options?.rows&&""!==this._config?.grid_options?.rows;if(!this._config||e||!1===this._rowsAutoMode)return;const t=this._getBubbleCardFromPreview();if(!t)return;const n=[t.querySelector(".bubble-sub-button-bottom-container"),t.querySelector(".bubble-buttons-container.bottom-fixed"),t.querySelector(".bubble-sub-button-container")].filter(Boolean);se._resizeObserver||(se._resizeObserver=new ResizeObserver(e=>{for(const t of e){const e=se._editorInstanceMap.get(t.target);if(e){const t=e._getBubbleCardFromPreview();t&&e._computeAndApplyRows(t)}}})),this._observedElements&&this._observedElements.forEach(e=>{n.includes(e)||(se._resizeObserver.unobserve(e),se._editorInstanceMap.delete(e))}),n.forEach(e=>{this._observedElements?.includes(e)||(se._resizeObserver.observe(e),se._editorInstanceMap.set(e,this))}),this._observedElements=n,requestAnimationFrame(()=>{const e=this._getBubbleCardFromPreview();e&&this._computeAndApplyRows(e)})}_hasCustomHeightStyles(){const e=[/\.bubble-container[^{]*\{[^}]*aspect-ratio\s*:/i,/\.bubble-container[^{]*\{[^}]*height\s*:\s*100%/i,/\.bubble-container[^{]*\{[^}]*height\s*:\s*\d+(\.\d+)?\s*(px|em|rem|vh|vw|%)/i],t=t=>!(!t||"string"!=typeof t)&&e.some(e=>e.test(t));if(this._config?.styles&&t(this._config.styles))return!0;try{if(a.Ki&&a.Ki.size>0){const e=new Set,n=new Set;Array.isArray(this._config?.modules)?this._config.modules.forEach(t=>{"string"==typeof t&&t.startsWith("!")?n.add(t.substring(1)):"string"==typeof t&&e.add(t)}):this._config?.modules&&"string"==typeof this._config.modules&&(this._config.modules.startsWith("!")?n.add(this._config.modules.substring(1)):e.add(this._config.modules)),a.Ki.has("default")&&!n.has("default")&&e.add("default"),a.Ki.forEach((t,o)=>{t&&"object"==typeof t&&!0===t.is_global&&!n.has(o)&&e.add(o)});for(const n of e){const e=a.Ki.get(n);if(e&&t("object"==typeof e?e.code:e))return!0}}}catch(e){}return!1}_computeAndApplyRows(e){try{if(!e||!1===this._rowsAutoMode||!this._config)return{applied:!1};if(this._hasCustomHeightStyles()){if(void 0!==this._config.rows&&!1!==this._rowsAutoMode){const e={...this._config};delete e.rows,this._config=e,(0,s.rC)(this,"config-changed",{config:e})}return{applied:!1}}const t="calendar"===this._config.card_type,n="separator"===this._config.card_type,o=e.querySelector(".bubble-sub-button-bottom-container"),i=e.querySelector(".bubble-buttons-container.bottom-fixed"),a=e.querySelector(".bubble-sub-button-container"),r=e.querySelector(".bubble-content-container"),l=o?o.getBoundingClientRect().height:0,c=i?i.getBoundingClientRect().height:0,d=a?a.getBoundingClientRect().height:0,u={bottomSub:Math.round(l),bottomMain:Math.round(c),mainSub:Math.round(d)};if(this._lastMeasuredHeights){const e=1,t=Math.abs(u.bottomSub-this._lastMeasuredHeights.bottomSub),n=Math.abs(u.bottomMain-this._lastMeasuredHeights.bottomMain),o=Math.abs(u.mainSub-this._lastMeasuredHeights.mainSub);if(t0||c>0)){if(this._firstRowsComputation=!0,1!==this._config.rows){const e={...this._config,rows:1};this._config=e,(0,s.rC)(this,"config-changed",{config:e})}return}const p=e.querySelector(".bubble-container");p&&p.getBoundingClientRect();let b=!1;r&&(b=Array.from(r.children||[]).some(e=>{const t=e.getBoundingClientRect(),n=getComputedStyle(e);return t.width>0&&t.height>0&&"none"!==n.display&&"hidden"!==n.visibility&&"0"!==n.opacity}));const h=d>0,m=(()=>{const e=this._config?.sub_button;return!!e&&(!Array.isArray(e)&&(Array.isArray(e.bottom)?e.bottom:[]).some(e=>!!e))})();let g=l+c;g<=0&&m&&(g=46);const f=e=>{if(!e)return 0;try{const t=getComputedStyle(e),n=parseFloat(t.bottom);return Number.isFinite(n)?Math.max(0,n):0}catch(e){return 0}};i&&l>0&&(g+=f(i));let y=0;if(h){y=d;const e=getComputedStyle(a),t=parseFloat(e.marginTop)||0,n=parseFloat(e.marginBottom)||0;y+=t+n+(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}const v=g>0,_=v?46:36;y>0&&(y=Math.max(y,_));const w=p||e?getComputedStyle(p||e):null,x=w?w.getPropertyValue("--row-height"):"",k=parseFloat(x)||56,C=w?w.getPropertyValue("--row-gap"):"",$=k+(parseFloat(C)||8),S="separator"===this._config.card_type?.8:1;let A;const L=v&&!h&&(b||t||n),E=g+y;if(E>0||L){const e=Number.isFinite($)&&$>0?$:k,t=(L?46:0)-36+("sub-buttons"===this._config.card_type?-4:0);A=S+Math.ceil((E||0)+t)/e,A=Math.max(.1,Math.round(1e3*A)/1e3)}else A=void 0;const M=this._config.rows;if(A===M||void 0===A&&void 0===M)return this._firstRowsComputation=!0,{applied:!1};if("number"==typeof A&&"number"==typeof M&&Math.abs(A-M)<.01)return{applied:!1};if(A===S&&void 0===M)return{applied:!1};if(!1===this._rowsAutoMode)return{applied:!1};const T={...this._config};return void 0===A?delete T.rows:T.rows=A,this._config=T,this._firstRowsComputation?((0,s.rC)(this,"config-changed",{config:T}),{applied:!0,rows:T.rows}):(this._firstRowsComputation=!0,{applied:!1,skippedFirst:!0})}catch(e){}return{applied:!1}}_initializeLists(e){let t=[];0===Object.keys(this._entityCache).length?Object.keys(this.hass.states).forEach(e=>{const n=this.hass.states[e],o=e.split(".")[0];this._entityCache[o]||(this._entityCache[o]=[]),this._entityCache[o].push(e),this._selectable_attributes.some(e=>n.attributes?.[e])&&(t.includes(e)||t.push(e))}):(["input_select","select"].forEach(e=>{this._entityCache[e]&&(t=[...t,...this._entityCache[e]])}),Object.keys(this.hass.states).forEach(e=>{const n=this.hass.states[e];this._selectable_attributes.some(e=>n.attributes?.[e])&&(t.includes(e)||t.push(e))})),["input_select","select"].forEach(e=>{this._entityCache[e]&&this._entityCache[e].forEach(e=>{t.includes(e)||t.push(e)})}),t=[...new Set(t)];const n={};t.forEach(e=>{this.hass.states[e]&&(n[e]=this.hass.states[e])}),this.inputSelectList={...this.hass},this.inputSelectList.states=n,this._entity?this._entity===this._cachedAttributeListEntity&&this._cachedAttributeList?this.attributeList=this._cachedAttributeList:(this.attributeList=Object.keys(this.hass.states[this._entity]?.attributes||{}).map(e=>{let t=this.hass.states[this._entity];return{label:this.hass.formatEntityAttributeName(t,e),value:e}}),this._cachedAttributeList=this.attributeList,this._cachedAttributeListEntity=this._entity):(this.attributeList=[],this._cachedAttributeList=null,this._cachedAttributeListEntity=null);const o=e("editor.calendar.name");(!this.cardTypeList||this._cachedCalendarLabel&&this._cachedCalendarLabel!==o)&&(this.cardTypeList=[{label:"Button (Switch, slider, ...)",value:"button"},{label:o,value:"calendar"},{label:"Cover",value:"cover"},{label:"Climate",value:"climate"},{label:"Empty column",value:"empty-column"},{label:"Horizontal buttons stack",value:"horizontal-buttons-stack"},{label:"Media player",value:"media-player"},{label:"Pop-up",value:"pop-up"},{label:"Select",value:"select"},{label:"Separator",value:"separator"},{label:"Sub-buttons only",value:"sub-buttons"}],this._cachedCalendarLabel=o)}_handleCardContext(e){try{const t=e?.detail;if(!t)return;const n=this._scoreCardContext(t);if(n<=this._previewCardScore)return;const o=t.context||t.card?.closest?.("bubble-card")||t.card?.getRootNode?.()?.host||null,i=t.context?.shadowRoot||o?.shadowRoot||t.card?.getRootNode?.()||null;if(!i)return;this._previewCardScore=n,this._previewCardRoot=i,this._previewCardHost=o||i.host||null,this._setupAutoRowsObserver()}catch(e){}}_scoreCardContext(e){const t=e?.config||{},n=this._config||{};let o=0;return(e?.isEditor||e?.editMode)&&(o+=5),t.card_type&&t.card_type===n.card_type&&(o+=4),t.entity&&t.entity===n.entity&&(o+=3),t.hash&&t.hash===n.hash&&(o+=2),t.button_type&&t.button_type===n.button_type&&(o+=1),o}_resetPreviewCardReference(){this._previewCardRoot=null,this._previewCardHost=null,this._previewCardScore=-1/0,this._lastMeasuredHeights=null}}customElements.define("bubble-card-editor",se);const le={hashRecentlyAdded:!1,scrollY:0,currentHash:null,hashChangeProtection:!1,isAnimating:!1,animationDuration:300,activePopups:new Set,entityTriggeredPopup:null};if(!window.__bubbleLocationDeduperAdded)try{let e=null,t=0,n=!1,o="",i=window.location.hash||"";window.addEventListener("location-changed",()=>{const a=window.location.href,r=!!window.location.hash,s=a.split("#")[0];if(r)return e=s,t=Date.now(),n=!1,o=i||"",void(i=window.location.hash);if(n)return n=!1,e=null,o="",void(i=window.location.hash||"");if(e&&s===e&&Date.now()-t<1500&&!o)try{n=!0,history.back()}catch(e){}e=null,o="",i=window.location.hash||""}),window.__bubbleLocationDeduperAdded=!0}catch(e){}const ce=new Set(["HA-DIALOG","HA-MORE-INFO-DIALOG","HA-DIALOG-DATE-PICKER"]),de={recentlyClosedTimestamp:0,protectionWindow:500};function ue(){return!(le.hashRecentlyAdded||!location.hash||le.hashChangeProtection||(setTimeout(()=>{if(le.hashChangeProtection)return;const e=window.location.href.split("#")[0];history.replaceState(null,"",e),window.dispatchEvent(new Event("location-changed"))},50),0))}function pe(e){le.hashChangeProtection=!0;const t=e.startsWith("#")?window.location.href.split("#")[0]+e:e;history.pushState(null,"",t),window.dispatchEvent(new Event("location-changed")),setTimeout(()=>{le.hashChangeProtection=!1},200)}function be(e,t){e.config.background_update?e.popUp.style.display="none":e.editor||(e.hideContentTimeout=setTimeout(()=>{const{sectionRow:t,sectionRowContainer:n}=e;"hui-card"===t?.tagName.toLowerCase()&&(t.hidden=!0,t.style.display="none",n?.classList.contains("card")&&(n.style.display="none",n.style.position=""))},t))}function he(e,t){const{showBackdrop:n,hideBackdrop:o}=Je(e);t?n():o()}function me(e,t){e.config.background_update||(t?e.verticalStack.contains(e.popUp)||e.verticalStack.appendChild(e.popUp):t||e.config.background_update||e.verticalStack.contains(e.popUp)&&e.verticalStack.removeChild(e.popUp))}function ge(e,t){le.isAnimating=!0,e.classList.add(t?"is-opening":"is-closing"),requestAnimationFrame(()=>{e.classList.toggle("is-popup-opened",t),e.classList.toggle("is-popup-closed",!t),setTimeout(()=>{le.isAnimating=!1,e.classList.remove("is-opening","is-closing")},le.animationDuration)})}function fe(e,t){if(e.boundClickOutside||(e.boundClickOutside=t=>function(e,t){(t.config.close_by_clicking_outside??1)&&(Date.now()-de.recentlyClosedTimestamp!(!e.classList&&!e.nodeName)&&(e.classList?.contains("bubble-pop-up")||ce.has(e.nodeName)))||ue())}(t,e)),e.resetCloseTimeout||(e.resetCloseTimeout=()=>function(e){e.config.auto_close&&e.closeTimeout&&(clearTimeout(e.closeTimeout),e.closeTimeout=setTimeout(ue,e.config.auto_close))}(e)),!e.touchHandlersInitialized){const{handleTouchStart:t,handleTouchMove:n,handleTouchEnd:o}=function(e){if(!e.handleTouchStart){let t=0,n=0,o=!1;e.handleTouchStart=e=>{t=e.touches[0].clientY,n=t,o=!1},e.handleTouchMove=i=>{if(1!==i.touches.length)return;n=i.touches[0].clientY;const a=n-t;Math.abs(a)>10&&(o=!0,a>0&&(e.popUp.style.transform=`translateY(${a}px)`,i.preventDefault()))},e.handleTouchEnd=i=>{o&&(n-t>100?ue():e.popUp.style.transform="",o=!1)}}return{handleTouchStart:e.handleTouchStart,handleTouchMove:e.handleTouchMove,handleTouchEnd:e.handleTouchEnd}}(e);e.handleTouchStart=t,e.handleTouchMove=n,e.handleTouchEnd=o,e.touchHandlersInitialized=!0}t&&!e.editor?(e.listenersAdded||(e.config.auto_close&&(e.popUp.addEventListener("touchstart",e.resetCloseTimeout,{passive:!0}),e.popUp.addEventListener("click",e.resetCloseTimeout,{passive:!0})),e.popUp&&(e.handleTouchStart&&e.popUp.addEventListener("touchstart",e.handleTouchStart,{passive:!0}),e.handleTouchMove&&e.popUp.addEventListener("touchmove",e.handleTouchMove,{passive:!1}),e.handleTouchEnd&&e.popUp.addEventListener("touchend",e.handleTouchEnd,{passive:!0}),e.handleHeaderTouchMove&&e.elements?.header&&e.elements.header.addEventListener("touchmove",e.handleHeaderTouchMove,{passive:!0}),e.handleHeaderTouchEnd&&e.elements?.header&&e.elements.header.addEventListener("touchend",e.handleHeaderTouchEnd,{passive:!0}),e.closeOnEscape&&window.addEventListener("keydown",e.closeOnEscape,{passive:!0}),e.config.close_on_click?(e.popUp.addEventListener("click",ue,{passive:!0}),e.popUp.dataset.closeOnClick="true"):delete e.popUp.dataset.closeOnClick),e.listenersAdded=!0),e.clickOutsideListenerAdded||(window.addEventListener("click",e.boundClickOutside,{passive:!0}),e.clickOutsideListenerAdded=!0)):(e.listenersAdded&&((0,s.qo)(!1),e.config.auto_close&&(e.popUp.removeEventListener("touchstart",e.resetCloseTimeout),e.popUp.removeEventListener("click",e.resetCloseTimeout)),e.popUp&&(e.handleTouchStart&&e.popUp.removeEventListener("touchstart",e.handleTouchStart),e.handleTouchMove&&e.popUp.removeEventListener("touchmove",e.handleTouchMove),e.handleTouchEnd&&e.popUp.removeEventListener("touchend",e.handleTouchEnd),e.handleHeaderTouchMove&&e.elements?.header&&e.elements.header.removeEventListener("touchmove",e.handleHeaderTouchMove),e.handleHeaderTouchEnd&&e.elements?.header&&e.elements.header.removeEventListener("touchend",e.handleHeaderTouchEnd),e.closeOnEscape&&window.removeEventListener("keydown",e.closeOnEscape),e.config.close_on_click&&(e.popUp.removeEventListener("click",ue),delete e.popUp.dataset.closeOnClick)),e.listenersAdded=!1),e.clickOutsideListenerAdded&&(window.removeEventListener("click",e.boundClickOutside),e.clickOutsideListenerAdded=!1))}function ye(e){["hideContentTimeout","removeDomTimeout","closeTimeout"].forEach(t=>{e[t]&&(clearTimeout(e[t]),e[t]=null)})}function ve(e,t=!1){(e.popUp.classList.contains("is-popup-opened")||t)&&(ye(e),le.activePopups.delete(e),le.entityTriggeredPopup===e&&(le.entityTriggeredPopup=null),ge(e.popUp,!1),he(e,!1),e.removeDomTimeout=setTimeout(()=>{me(e,!1),be(e,0),void 0!==le.scrollY&&window.scrollTo(0,le.scrollY)},le.animationDuration),fe(e,!1),(0,s.qo)(!1),e.config.close_action&&(0,i.VR)(e,e.config,"close_action"))}window.__bubbleDialogListenerAdded||(window.addEventListener("dialog-closed",()=>{de.recentlyClosedTimestamp=Date.now()},{capture:!0}),window.addEventListener("iron-overlay-closed",()=>{de.recentlyClosedTimestamp=Date.now()},{capture:!0}),window.__bubbleDialogListenerAdded=!0);const _e=".bubble-backdrop {\n position: fixed;\n background-color: var(--bubble-backdrop-background-color, var(--bubble-default-backdrop-background-color));\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 4;\n opacity: 0;\n transition: opacity 0.3s;\n}\n\n.bubble-backdrop.is-visible {\n opacity: 1;\n}\n\n.bubble-backdrop.is-hidden {\n opacity: 0;\n pointer-events: none;\n}\n\n.bubble-backdrop.has-blur {\n backdrop-filter: var(--bubble-backdrop-filter, var(--custom-backdrop-filter));\n -webkit-backdrop-filter: var(--bubble-backdrop-filter, var(--custom-backdrop-filter));\n}\n";var we=n(388),xe=n(772),ke=n(315),Ce=n(748);const $e=new Map,Se=new Map,Ae=/\/\*[\s\S]*?\*\//g,Le=/\s+/g,Ee=/\s*([{};,])\s*/g,Me=/([a-zA-Z0-9_-]+)\s*:\s*;/g,Te=/undefined(?=(?:(?:[^"]*"){2})*[^"]*$)/g,Be=/[^{};]+\s*{\s*}/g,Pe=/,(?=\s*[}\n])/g,Ie=/(@[^{}]*?\{(?:[^{}]*?\{[^{}]*?\})*?[^{}]*?\}|[^{}]*?\{[^{}]*?\})/g,Oe=/,\s*(\/\*.*\*\/)?$/,qe=/^[.:#&\[*]/,je=/^[>+~]/,ze=/^[a-zA-Z][a-zA-Z0-9-_]*$/,De=/::?[a-zA-Z_-][a-zA-Z0-9_-]*/,Ne=/^[()\[\]]+,?$/,Ue=async(e,t=e.card)=>{const n="STYLE"===t.tagName,o=n?null:t,i="pop-up"===e.cardType&&t===e.popUp,r=i&&(e.elements?.popUpContainer||("function"==typeof t.querySelector?t.querySelector(".bubble-pop-up-container"):null))||o,s=i?"visibility":"display",l=e.config.styles;if(void 0===e.cardLoaded&&!n&&(e.lastEvaluatedStyles="",e.initialLoad=!0,!e._moduleChangeListenerAdded)){const t=()=>{e.lastEvaluatedStyles="",e.stylesYAML=null,a.Ki.forEach((t,n)=>{e._processedSchemas?.[n]&&delete e._processedSchemas[n]});const t="pop-up"===e.cardType&&e.popUp?e.popUp:e.card;Ue(e,t)},n=()=>{e.lastEvaluatedStyles="",e._templateResultVersion=(e._templateResultVersion||0)+1,e._bb_cache&&(e._bb_cache.lastStateSignature="");const t="pop-up"===e.cardType&&e.popUp?e.popUp:e.card;Ue(e,t)};window.addEventListener("bubble-card-modules-changed",t),window.addEventListener("bubble-card-module-updated",t),(0,Ce.eX)(n),document.addEventListener("yaml-modules-updated",t),e._moduleChangeListenerAdded=!0,e._moduleChangeHandler=t,e._templateChangeHandler=n}e.initialLoad&&r?.style&&!r.dataset.bubbleStyleHideMode&&("visibility"===s?r.style.visibility="hidden":r.style.display="none",r.dataset.bubbleStyleHideMode=s);const c=function(e,t){if("STYLE"===t.tagName)return t;if(!e.styleElement||e.styleElement.parentElement!==t){const n=document.createElement("style");n.id="bubble-styles",t.appendChild(n),e.styleElement=n}return e.styleElement}(e,t);try{let t={};a.Ki.size>0?a.Ki.forEach((e,n)=>{t[n]=e}):t=await e.stylesYAML||{};let o=[];const i=new Set,s=[],d=new Set;Array.isArray(e.config.modules)?e.config.modules.forEach(e=>{"string"==typeof e&&e.startsWith("!")?d.add(e.substring(1)):"string"==typeof e&&s.push(e)}):e.config.modules&&"string"==typeof e.config.modules&&(e.config.modules.startsWith("!")?d.add(e.config.modules.substring(1)):s.push(e.config.modules)),a.Ki.has("default")&&!d.has("default")&&i.add("default");const u=e=>{if(!e||!e.states||!e.states["sensor.bubble_card_modules"])return;const t=e.states["sensor.bubble_card_modules"].attributes.modules;if(t)for(const e in t)!0===t[e].is_global&&a.Ki.has(e)&&!d.has(e)&&i.add(e)};(()=>{try{a.Ki.forEach((e,t)=>{e&&"object"==typeof e&&!0===e.is_global&&!d.has(t)&&i.add(t)})}catch(e){}})(),Q.isBCTAvailableSync&&(0,Q.isBCTAvailableSync)()||!e._hass||u(e._hass),s.forEach(e=>{a.Ki.has(e)&&!d.has(e)&&i.add(e)}),o=Array.from(i);let p="";o.length>0&&(p=o.map(n=>{try{let o=t[n]??"";if("object"==typeof o&&""===o.code||""===o)return"{}";const i="object"==typeof o&&o.code?o.code:o;return Re(e,i,{type:"module",id:n})}catch(e){return console.error(`Bubble Card - Error processing module "${n}" before evaluation:`,e),"{}"}}).join("\n"));let b="";try{b=Re(e,l,{type:"custom_styles"})}catch(e){console.error("Bubble Card - Error processing custom styles before evaluation:",e)}const h=`${p}\n${b}`.trim();let m=!0;n?h===c.textContent&&(m=!1):h===e.lastEvaluatedStyles?m=!1:e.lastEvaluatedStyles=h,m&&(c.textContent=h),e.initialLoad&&r?.style&&("visibility"===r.dataset.bubbleStyleHideMode?r.style.visibility="":r.style.display="",delete r.dataset.bubbleStyleHideMode,n||(e.initialLoad=!1,e.cardLoaded=!0))}catch(t){console.error("Error applying styles:",t),e.initialLoad&&o?.style&&(o.style.display="")}};function Re(e,t="",n={type:"unknown"}){if(!t)return"";if(e.editor&&e.templateEvaluationBlocked)return"";const o=["innerText","textContent","innerHTML"];["state","name"].forEach(n=>{o.map(e=>`card.querySelector('.bubble-${n}').${e} =`).some(e=>t.includes(e))&&!e.elements[n].templateDetected&&(e.elements[n].templateDetected=!0)});try{let n=$e.get(t);if(!n&&(n=Function("hass","entity","state","icon","subButtonState","subButtonIcon","getWeatherIcon","card","name","checkConditionsMet",`return \`${t}\`;`),$e.set(t,n),$e.size>500)){const e=$e.keys().next().value;$e.delete(e)}const o="pop-up"===e.config.card_type?e.popUp:e.card,i=n.call(e,e._hass,e.config.entity,(0,s.Gu)(e),e.elements.icon,(0,xe.AQ)(e),e.subButtonIcon,we.w1,o,o.name,ke.XH);e._localStyleCache||(e._localStyleCache=new Map);const a=e._localStyleCache.get(t);if(a&&a.raw===i)return a.cleaned;const r=function(e){if(!e||"string"!=typeof e)return"";if(Se.has(e)){const t=Se.get(e);return Se.delete(e),Se.set(e,t),t}let t=e;if(t.includes("/*")&&(t=t.replace(Ae,"")),t.includes("\n")){let e=0;const n=[],o=t.split("\n");for(let t=0;t0;l||(l=r>0||s>0||a.startsWith("@")||a.startsWith("--")||Oe.test(a)||qe.test(a)||je.test(a)||ze.test(a)||De.test(a)||Ne.test(a)),l&&n.push(i),e+=r-s,e<0&&(e=0)}t=n.join("\n")}t=t.replace(Le," "),t=t.replace(Ee,"$1"),(t.includes(":;")||t.includes(": "))&&(t=t.replace(Me,"")),t.includes("undefined")&&(t=t.replace(Te,"")),t.includes("{")&&(t=t.replace(Be,"")),t.includes(",")&&(t=t.replace(Pe,""));const n=t.match(Ie);if(t=n?n.join("\n"):"",Se.set(e,t),Se.size>300){const e=Se.keys().next().value;Se.delete(e)}return t}(i);return e._localStyleCache.set(t,{raw:i,cleaned:r}),r}catch(t){let o="Unknown source";"module"===n.type&&n.id?o=`Module ('${n.id}')`:"custom_styles"===n.type?o="Card Configuration (styles section)":"unknown"===n.type&&(o="Direct call or unspecified source");const i=e.config?.card_type||"N/A",a=e.config?.entity||"N/A",r=`Bubble Card - Template Error:\n Card Type: ${i}\n Entity: ${a}\n Source: ${o}\n Error: ${t.message}`;if(e.editor){const o=t.message;e.lastEmittedEditorError=o;const r={cardType:i,entityId:a,sourceType:n.type,moduleId:n.id};requestAnimationFrame(()=>function(e,t){window.dispatchEvent(new CustomEvent("bubble-card-error",{detail:{message:e,context:t}}))}(o,r)),e.templateEvaluationBlocked=!0,e.templateErrorClearTimeout&&clearTimeout(e.templateErrorClearTimeout),e.templateErrorClearTimeout=setTimeout(()=>{e.templateEvaluationBlocked=!1;try{"function"==typeof e.handleCustomStyles&&(e.lastEvaluatedStyles="",e.stylesYAML=null,requestAnimationFrame(()=>e.handleCustomStyles(e,e.card)))}catch(e){}},900)}return console.error(r),""}}let Ve,Fe,He,We,Ye=!1;const Ke=window.matchMedia("(prefers-color-scheme: dark)");function Xe(){We=getComputedStyle(document.body).getPropertyValue("--ha-card-background")||getComputedStyle(document.body).getPropertyValue("--card-background-color"),document.body.style.setProperty("--bubble-default-backdrop-background-color",(0,r.Bz)(We,.8,.6))}function Je(e){const t=e.config.hide_backdrop??!1;if(Ve)return Ve;const n=(0,s.n)("div","bubble-backdrop-host"),o=n.attachShadow({mode:"open"}),i=(0,s.n)("div","bubble-backdrop backdrop is-hidden");o.appendChild(i);const a=(0,s.n)("style");a.innerHTML=_e,o.appendChild(a);const r=(0,s.n)("style");r.dataset.bubbleTarget="backdrop",o.appendChild(r),t&&(n.style.display="none",n.style.pointerEvents="none"),document.body.appendChild(n);const l=e.config.backdrop_blur??0,c=parseFloat(l)>0;i.classList.toggle("has-blur",c),c?i.style.setProperty("--custom-backdrop-filter",`blur(${l}px)`):i.style.removeProperty("--custom-backdrop-filter");let d=!1;function u(){d||(d=!0,(e=>{try{if("function"==typeof window.requestIdleCallback)return void window.requestIdleCallback(e,{timeout:500})}catch(e){}setTimeout(e,350)})(()=>{d=!1;try{Ue(e,r)}catch(e){}}))}return u(),Ve={hideBackdrop:function(){i.classList.contains("is-hidden")||i.classList.add("is-hidden"),i.classList.remove("is-visible")},showBackdrop:function(){requestAnimationFrame(()=>{i.classList.contains("is-visible")||i.classList.add("is-visible"),i.classList.remove("is-hidden"),t||(n.style.display="",n.style.pointerEvents="")})},backdropElement:i,backdropCustomStyle:r,updateBackdropStyles:u},Ve}function Ge(e){if(!e.elements?.popUpContainer||!e.storedContent)return;const t=e.elements.popUpContainer;t.classList.remove("has-placeholder"),t.querySelector(".bubble-editor-placeholder")?.remove(),t.appendChild(e.storedContent),e.storedContent=null}function Qe(e){if(!e.verticalStack||!e.popUp)return;const{popUp:t,sectionRow:n,sectionRowContainer:o,elements:i,config:a}=e,r=e.editor||e.detectedEditor,l=function(e){if(!e.editor&&!e.detectedEditor)return!1;const t=["hui-card-preview","hui-section-preview","element-preview"];try{let n=e.popUp;for(;n;){if(n.tagName&&t.includes(n.tagName.toLowerCase()))return!0;if(n.classList?.contains("element-preview"))return!0;if(n.parentNode)n=n.parentNode;else{if(!(n.getRootNode()instanceof ShadowRoot))break;n=n.getRootNode().host}}}catch(e){}return!1}(e),c="hui-card"===n?.tagName?.toLowerCase();e.bubbleInstanceId=e.bubbleInstanceId||Math.random().toString(36).slice(2,15),window.bubbleNewlyCreatedInstances=window.bubbleNewlyCreatedInstances||new Set;const d=window.bubbleNewlyCreatedInstances.has(e.bubbleInstanceId)||window.bubbleNewlyCreatedHashes?.has(a.hash)&&l;if(d&&l&&window.bubbleNewlyCreatedInstances.add(e.bubbleInstanceId),r&&c&&o&&"none"===o.style.display&&(o.style.display="",o.style.position=""),r)e.editorAccess||((0,s.qo)(!1),t.classList.remove("is-popup-opened"),t.classList.add("is-popup-closed","editor"),i?.content?.classList.add("popup-content-in-editor-mode"),me(e,!0),e.editorAccess=!0,function(e){const{hideBackdrop:t}=Je(e),n=e.detectedEditor;e.editor||n?(t(),clearTimeout(e.removeDomTimeout),n||function(e){if(e.observer&&(e.observer.disconnect(),e.observer=null),e.sectionRow){const t=new IntersectionObserver(t=>{t.forEach(t=>{const n=e.editor||e.detectedEditor;t.isIntersecting&&!e.verticalStack.contains(e.popUp)&&n&&e.verticalStack.appendChild(e.popUp)})},{rootMargin:"100px",threshold:.01});t.observe(e.sectionRow),e.observer=t}}(e)):e.observer&&(e.observer.disconnect(),e.observer=null)}(e)),window.bubbleDialogListenerAdded||(window.addEventListener("dialog-closed",()=>{setTimeout(()=>{window.bubbleNewlyCreatedInstances?.clear(),window.bubbleNewlyCreatedHashes?.clear(),window.dispatchEvent(new Event("location-changed"))},100)},{capture:!0}),window.bubbleDialogListenerAdded=!0),l||d?Ge(e):function(e){if(!e.elements?.popUpContainer||e.storedContent)return;const t=e.elements.popUpContainer,n=document.createDocumentFragment();[...t.children].filter(e=>"STYLE"!==e.tagName).forEach(e=>n.appendChild(e)),e.storedContent=n,t.appendChild(function(e){const t=(0,s.n)("div","bubble-editor-placeholder"),n=(0,s.n)("ha-icon");n.icon="mdi:information-outline";const o=(0,s.n)("div","bubble-editor-placeholder-info"),i=(0,s.n)("div","bubble-editor-placeholder-hash");i.textContent=e.config.hash||"No hash defined";const a=(0,s.n)("div","bubble-editor-placeholder-hint");return a.textContent="Content hidden in edit mode for performance",o.appendChild(i),o.appendChild(a),t.appendChild(n),t.appendChild(o),t}(e)),t.classList.add("has-placeholder")}(e);else if(e.editorAccess){i?.content?.classList.remove("popup-content-in-editor-mode"),Ge(e),e.observer&&(e.observer.disconnect(),e.observer=null);const n=a.hash?a.hash.startsWith("#")?a.hash:"#"+a.hash:"";n&&location.hash===n?(t.classList.remove("editor","is-popup-closed"),t.classList.add("is-popup-opened"),(0,s.qo)(!0)):(me(e,!1),be(e,0),t.classList.remove("editor")),e.editorAccess=!1}}function Ze(e){const{backdropCustomStyle:t,updateBackdropStyles:n}=Je(e);(0,s.JK)(e,e.popUp),Ue(e,e.popUp),"function"==typeof n?n():requestAnimationFrame(()=>Ue(e,t));const o=e.config.show_header??!0;e.popUp.classList.contains("no-header")===o&&e.popUp.classList.toggle("no-header",!o)}Ke.addEventListener("change",Xe),Xe();var et=n(314);function tt(e){let t=e.config.button_type;return"custom"===t&&(console.error('Buttons "custom" have been removed. Use either "switch", "slider", "state" or "name"'),t=""),e.config.entity?t||"switch":t||"name"}function nt(e){const t=e.config.entity;return(0,s.md)(e,"sensor",t)&&"%"===(0,s.D$)(e,"unit_of_measurement",t)}var ot=n(459);new WeakMap;var it=n(653);function at(e,t=e.content){const n=tt(e);"button"!==e.cardType&&e.buttonType!==n&&function(e,t=e.container){const n="button",o=tt(e),i="slider"===o,a={};a.slider={icon:!0,button:{tap_action:{action:(0,s.md)(e,"sensor")?"more-info":"toggle"},double_tap_action:{action:"none"},hold_action:{action:"none"}}},a.switch={icon:!0,button:{tap_action:{action:"toggle"},double_tap_action:{action:"none"},hold_action:{action:"more-info"}}},a.state={icon:{tap_action:{action:"more-info"},double_tap_action:{action:"none"},hold_action:{action:"more-info"}},button:{tap_action:{action:"more-info"},double_tap_action:{action:"none"},hold_action:{action:"more-info"}}},a.name={icon:{tap_action:{action:"none"},double_tap_action:{action:"none"},hold_action:{action:"none"}},button:{tap_action:{action:"none"},double_tap_action:{action:"none"},hold_action:{action:"none"}}};const r=(0,it.N0)(e,{type:n,appendTo:t,styles:".bubble-range-slider {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n cursor: ew-resize;\n border-radius: calc(var(--bubble-button-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2))));\n overflow: hidden;\n}\n\n.bubble-background {\n background-color: var(--bubble-button-background-color);\n border-radius: calc(var(--bubble-button-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2))));\n}\n\n.bubble-buttons-container {\n display: contents;\n}",withSlider:i,holdToSlide:i,readOnlySlider:nt(e),withFeedback:!e.config.tap_to_slide,withSubButtons:!0,iconActions:a[o]?.icon,buttonActions:!e.config.tap_to_slide&&a[o]?.button});r.background.classList.add("bubble-button-background"),r.mainContainer.classList.add("bubble-button-card-container"),r.cardWrapper.classList.add("bubble-button-card"),i&&r.mainContainer.classList.add("bubble-button-slider-container"),t!==e.container?e.buttonType=o:e.cardType=n}(e,t),"name"!==n&&(function(e){const t=(0,s.Gu)(e),n=e.config.card_type;"unavailable"===t?"button"===n?e.card.classList.add("is-unavailable"):"pop-up"===n&&e.elements.headerContainer.classList.add("is-unavailable"):"button"===n?e.card.classList.remove("is-unavailable"):"pop-up"===n&&e.elements.headerContainer.classList.remove("is-unavailable")}(e),function(e){const t=e.config.card_type,n=tt(e),o=(0,s.md)(e,"light"),i=(0,s.$C)(e),a=(0,s.m_)(e),r=(0,we.VA)(e),l="button"===t?e.card.style.getPropertyValue("--bubble-button-background-color"):e.popUp.style.getPropertyValue("--bubble-button-background-color"),c=e.elements.background?.style.opacity;let d="",u="";const p=e.config.use_accent_color;"switch"===n&&i?a?(d="var(--red-color, var(--error-color))",u="1"):r&&o&&!p?(d=(0,s.C$)(e,e.config.entity,!0,null,null),u=".7"):(d="var(--bubble-button-accent-color, var(--bubble-accent-color, var(--bubble-default-color)))",u="1"):(d="rgba(0, 0, 0, 0)",u=".5"),"slider"===n&&(0,ot.VM)(e),l===d&&c===u||function(e,t,n,o){const i=e.elements?.background;if(!i)return;const a="button"===o?e.card:e.popUp;a&&(a.style.setProperty("--bubble-button-background-color",t),i.style.opacity=n)}(e,d,u,t)}(e)),(0,et.wd)(e),(0,et.m9)(e),(0,et.Uk)(e),(0,xe.Kr)(e),"pop-up"!==e.cardType&&function(e){(0,s.JK)(e),Ue(e)}(e)}function rt(e){return e.cardContainer||e.card.parentNode?.host?.parentNode?.parentNode}function st(e){e.cardContainer&&(e.cardContainer.style.position="")}function lt(e,t){return function(e,t){return!(!e||void 0===e.supported_features)&&0!==(e.supported_features&t)}(e.attributes,t)}let ct=!1;function dt(e,t){const n=e.config[`${t}_name`]??"",o=e.config[`${t}_icon`]??"",i=e.config[`${t}_pir_sensor`],a=e.config[`${t}_link`],r=e.config[`${t}_entity`];ct=ct||location.hash===a;const l=(0,s.n)("ha-icon","bubble-icon icon");l.icon=o;const c=(0,s.n)("div","bubble-name name");c.innerText=n;const d=(0,s.n)("div","bubble-background-color background-color"),u=(0,s.n)("div","bubble-background background"),p=(0,s.n)("div",`bubble-button bubble-button-${t} button ${a.substring(1)}`);let b=localStorage.getItem(`bubbleButtonWidth-${a}`);return p.style.width=`${b}px`,p.appendChild(l),p.appendChild(c),p.appendChild(d),p.appendChild(u),p.addEventListener("click",()=>{location.hash!==a&&(ct=!1),ct?ue():pe(a),ct=!ct,(0,s.jp)("light")}),p.icon=l,p.name=c,p.backgroundColor=d,p.background=u,p.pirSensor=i,p.lightEntity=r,p.link=a,p.index=t,p.haRipple=(0,s.n)("ha-ripple"),p.appendChild(p.haRipple),window.addEventListener("location-changed",function(){e.config.highlight_current_view&&(location.pathname===a||location.hash===a?p.classList.add("highlight"):p.classList.remove("highlight"))}),e.elements.buttons.push(p),p}function ut(e,t){return Math.floor((t-e)/6e4)}function pt(e){const t=e.elements.calendarCardContent;if(!t)return;const n=t.scrollTop>0,o=t.scrollHeight>t.clientHeight&&t.scrollTop{t.cachedUrl="",t.resolvedUrl="",function(e){const t=vt(e);if(t.iconDisplayedUrl){const n=wt(e,"icon");n&&n.currentValue?(e.elements.icon&&(e.elements.icon.style.display=""),e.elements.image&&(e.elements.image.style.display=""),xt(n,"",()=>{t.iconDisplayedUrl="",e.elements.image&&(e.elements.image.style.display="none")})):(t.iconDisplayedUrl="",e.elements.icon&&(e.elements.icon.style.display=""),e.elements.image&&(e.elements.image.style.display="none"))}if(t.backgroundDisplayedUrl){const n=wt(e,"background");n&&n.currentValue?xt(n,"",()=>{t.backgroundDisplayedUrl=""}):t.backgroundDisplayedUrl=""}}(e)},2e3)),t.lastState=i),o&&o!==t.cachedUrl?(t.idleTimeout&&(clearTimeout(t.idleTimeout),t.idleTimeout=null),t.cachedUrl=o):a&&!o&&t.cachedUrl&&(t.idleTimeout&&(clearTimeout(t.idleTimeout),t.idleTimeout=null),t.cachedUrl=""),t.resolvedUrl=!r||o?o||(a?"":t.cachedUrl):t.cachedUrl,t}function wt(e,t){if(e._mediaCoverLayers=e._mediaCoverLayers||{},e._mediaCoverLayers[t])return e._mediaCoverLayers[t];const n="icon"===t?e.elements?.image:e.elements?.background;if(!n)return null;n.style.backgroundImage="",n.classList.add("icon"===t?"bubble-cover-icon-crossfade":"bubble-cover-background-crossfade");const o="icon"===t?"bubble-cover-crossfade-layer bubble-cover-crossfade-layer--icon":"bubble-cover-crossfade-layer bubble-cover-crossfade-layer--background",i=document.createElement("div");i.className=`${o} is-visible`;const a=document.createElement("div");for(a.className=o;n.firstChild;)n.removeChild(n.firstChild);n.append(i,a);const r={container:n,layers:[i,a],visibleIndex:0,currentValue:""};return e._mediaCoverLayers[t]=r,r}function xt(e,t,n){if(!e)return;if(e.currentValue===t)return void(n&&n());const o=0===e.visibleIndex?1:0,i=e.layers[e.visibleIndex],a=e.layers[o],r=()=>{a.classList.add("is-visible"),"function"==typeof requestAnimationFrame?requestAnimationFrame(()=>{setTimeout(()=>{i.classList.remove("is-visible"),e.visibleIndex=o,e.currentValue=t,n&&setTimeout(n,1e3)},50)}):setTimeout(()=>{i.classList.remove("is-visible"),e.visibleIndex=o,e.currentValue=t,n&&setTimeout(n,1e3)},50)};if(t){const o=`url(${t})`;if(a.style.backgroundImage===o)a.classList.remove("is-empty"),r();else{const i=new Image;i.onload=()=>{a.style.backgroundImage=o,a.classList.remove("is-empty"),r()},i.onerror=()=>{a.style.backgroundImage="",a.classList.add("is-empty"),e.currentValue="",n&&n()},i.src=t}}else a.style.backgroundImage="",a.classList.add("is-empty"),r()}var kt=n(345),Ct=n(361),$t=n(752);const St={"pop-up":async function(e){if("pop-up"!==e.cardType){if(e.getRootNode()instanceof ShadowRoot==0)return;if(function(e){try{if(e.cardType="pop-up",e.verticalStack=e.getRootNode(),!e.verticalStack||!e.verticalStack.host)throw new Error("Vertical stack not found, don't panic, it will be added automatically to your pop-up.");if(e.sectionRow=e.verticalStack.host.parentElement,e.sectionRowContainer=e.sectionRow?.parentElement,e.popUp=e.verticalStack.querySelector("#root"),!e.popUp)throw new Error("Vertical stack not found, don't panic, it will be added automatically to your pop-up.");e.popUp.classList.add("bubble-pop-up","pop-up","is-popup-closed"),e.cardTitle=e.verticalStack.querySelector(".card-header"),e.editor||e.config.background_update||e.verticalStack.removeChild(e.popUp),e.elements={},Je(e),e.cardTitle&&(e.cardTitle.style.display="none"),Ye=Ye||(e.config.hide_backdrop??!0),e.popUp.style.setProperty("--custom-height-offset-desktop",e.config.margin_top_desktop??"0px"),e.popUp.style.setProperty("--custom-height-offset-mobile",e.config.margin_top_mobile??"0px"),e.popUp.style.setProperty("--custom-margin",`-${e.config.margin??"7px"}`),e.popUp.style.setProperty("--custom-popup-filter",e.config.backdrop_blur&&"0"!==e.config.backdrop_blur?"none":`blur(${e.config.bg_blur??10}px)`),e.popUp.style.setProperty("--custom-shadow-opacity",(e.config.shadow_opacity??0)/100),e.boundOnUrlChange=function(e){let t=location.hash;return()=>{const n=location.hash,o=n!==t;if(t=n,Array.from(le.activePopups).filter(e=>e.config.hash&&e.config.hash!==n&&e.popUp.classList.contains("is-popup-opened")).forEach(e=>ve(e)),e.config.hash===n){const t=e.popUp.classList.contains("is-popup-opened"),a=Date.now()-de.recentlyClosedTimestamp{le.hashRecentlyAdded=!1,setTimeout(()=>{le.hashChangeProtection=!1},100)},100),requestAnimationFrame(()=>{!function(e){if(e.popUp.classList.contains("is-popup-opened"))return;if(le.activePopups.size>0&&le.entityTriggeredPopup)return;ye(e),le.scrollY=window.scrollY;const{popUp:t}=e;le.activePopups.add(e),requestAnimationFrame(()=>{le.activePopups.has(e)&&(e.verticalStack.contains(t)||me(e,!0),ge(t,!0),function(e){if(e.config.background_update)return void(e.popUp.style.display="");const{sectionRow:t,sectionRowContainer:n,popUp:o}=e;o.style.transform="","hui-card"===t?.tagName.toLowerCase()&&(t.hidden=!1,t.style.display="",n?.classList.contains("card")&&(n.style.display="",n.style.position="absolute"))}(e),he(e,!0),setTimeout(()=>{t.classList.contains("is-popup-opened")&&le.activePopups.has(e)&&((0,s.qo)(!0),fe(e,!0),e.config.auto_close>0&&(e.closeTimeout&&clearTimeout(e.closeTimeout),e.closeTimeout=setTimeout(()=>{!le.activePopups.has(e)||e.config.hash!==location.hash&&e.config.hash?le.activePopups.has(e)&&ve(e):ue()},e.config.auto_close)),e.config.open_action&&(0,i.VR)(e.popUp,e.config,"open_action"))},le.animationDuration))})}(e)})}else requestAnimationFrame(()=>{e.popUp.classList.contains("is-popup-opened")&&e.config.hash&&e.config.hash!==n&&ve(e)})}}(e),window.addEventListener("location-changed",e.boundOnUrlChange),window.addEventListener("popstate",e.boundOnUrlChange),window.popUpError=!1}catch(t){if(console.warn(t),!window.popUpError){window.popUpError=!0;const t=(0,s.n)("div","bubble-error-text"),n=l.qy`

    Once created and saved, this pop-up will be hidden by default and can be opened by targeting its hash. You can trigger it using any card that supports the navigate action (check the example), or with the included horizontal buttons stack card.

    `;(0,l.XX)(n,t),e.content.appendChild(t)}}}(e),!e.popUp)return;if(function(e){e.elements={closeIcon:(0,s.n)("ha-icon","bubble-close-icon"),closeButton:(0,s.n)("div","bubble-close-button close-pop-up"),buttonContainer:(0,s.n)("div","bubble-button-container"),header:(0,s.n)("div","bubble-header")};const t=(0,s.n)("div","bubble-feedback-container"),n=(0,s.n)("div","bubble-feedback-element feedback-element");t.appendChild(n),e.elements.closeButton.appendChild(t),e.elements.closeIcon.icon="mdi:close",e.elements.closeButton.appendChild(e.elements.closeIcon),e.elements.closeButton.feedback=n;const o=t=>{t&&(t.stopPropagation(),t.preventDefault());const n=()=>{if(location.hash){const e=window.location.href.split("#")[0];history.replaceState(null,"",e),window.dispatchEvent(new Event("location-changed"))}};try{ue(),setTimeout(()=>{location.hash===e.config.hash&&n()},100)}catch(e){n()}(0,s.jp)("selection")};e.elements.closeButton.addEventListener("click",o),e.elements.closeButton.addEventListener("touchend",o),e.elements.closeButton.addEventListener("pointerdown",e=>{e.stopPropagation()}),e.elements.closeButton.haRipple=(0,s.n)("ha-ripple"),e.elements.closeButton.appendChild(e.elements.closeButton.haRipple);const i=e.popUp?.querySelector(".bubble-header-container");i?Object.assign(e.elements,{headerContainer:i,closeIcon:i.querySelector(".bubble-close-icon"),closeButton:i.querySelector(".bubble-close-button"),buttonContainer:i.querySelector(".bubble-button-container"),header:i.querySelector(".bubble-header")}):(e.elements.headerContainer=(0,s.n)("div","bubble-header-container"),e.elements.headerContainer.setAttribute("id","header-container"),e.elements.headerContainer.appendChild(e.elements.header),e.elements.headerContainer.appendChild(e.elements.closeButton),e.elements.header.appendChild(e.elements.buttonContainer)),e.handleTouchStart=e=>{Fe=e.touches[0].clientY},e.handleHeaderTouchMove=t=>{const n=t.touches[0].clientY-Fe;n>0&&(e.popUp.style.transform=`translateY(${n}px)`)},e.handleHeaderTouchEnd=t=>{const n=t.changedTouches[0].clientY-Fe;n>50?(e.popUp.style.transform=`translateY(calc(${n}px + (100% - ${n}px)))`,ue()):e.popUp.style.transform=""}}(e),function(e){try{if(!e.popUp)return;e.elements.style=(0,s.n)("style"),e.elements.style.innerText=".bubble-pop-up-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n margin-top: -50px;\n max-width: 100%;\n padding-top: 40px;\n padding-bottom: 80px;\n grid-gap: var(--bubble-pop-up-gap, 14px);\n gap: var(--bubble-pop-up-gap, 14px);\n column-gap: var(--bubble-pop-up-gap, 14px);\n --grid-gap: var(--bubble-pop-up-gap, 14px);\n --vertical-stack-card-gap: var(--bubble-pop-up-gap, 14px);\n --horizontal-stack-card-gap: var(--bubble-pop-up-gap, 14px);\n --stack-card-gap: var(--bubble-pop-up-gap, 14px);\n --row-size: 1;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n overflow: auto; \n grid-auto-rows: min-content;\n padding: 18px 18px calc(140px + var(--custom-height-offset-mobile)) 18px;\n mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 40px), transparent 100%);\n -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 40px), transparent 100%);\n touch-action: pan-y;\n}\n\n.bubble-pop-up-container > * {\n flex-shrink: 0 !important;\n}\n\n.bubble-pop-up.card-content {\n width: 100% !important;\n padding: 0 !important;\n}\n\n.bubble-pop-up {\n transition: transform 0.3s ease;\n position: fixed;\n width: 100%;\n max-width: 100%;\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) 0 0;\n box-sizing: border-box;\n margin-left: var(--custom-margin);\n left: 7px;\n z-index: 5 !important;\n bottom: calc(-56px - var(--custom-height-offset-mobile));\n}\n\n.bubble-pop-up-background {\n width: 100%;\n height: 100%;\n display: flex;\n top: 0;\n left: 0;\n position: absolute;\n background-color: var(--bubble-pop-up-main-background-color, var(--bubble-pop-up-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color)))));\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) 0 0;\n backdrop-filter: var(--custom-popup-filter);\n -webkit-backdrop-filter: var(--custom-popup-filter);\n border: var(--bubble-pop-up-border, var(--bubble-border, none));\n contain: layout paint;\n pointer-events: none;\n}\n\n.bubble-pop-up-container::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n}\n\n.is-popup-opened {\n box-shadow: 0px 0px 50px rgba(0, 0, 0, var(--custom-shadow-opacity));\n}\n\n.is-popup-opened .bubble-pop-up-container > * {\n contain: style;\n}\n\n.is-popup-closed { \n transform: translateY(100%);\n box-shadow: none !important;\n contain: layout paint;\n}\n\n@media only screen and (min-width: 600px) {\n .bubble-pop-up {\n margin-left: 0 !important;\n min-width: var(--desktop-width, 540px);\n max-width: var(--desktop-width, 540px);\n left: calc(50% - (var(--desktop-width, 540px) / 2));\n }\n .bubble-pop-up-container {\n padding: 18px 18px calc(140px + var(--custom-height-offset-desktop)) 18px;\n }\n}\n\n@media only screen and (min-width: 768px) {\n .bubble-pop-up {\n bottom: calc(-56px - var(--custom-height-offset-desktop));\n left: calc(var(--mdc-drawer-width, 0px) / 2 + 50% - (var(--desktop-width, 540px) / 2));\n }\n}\n\n.bubble-pop-up.editor {\n transition: none !important;\n position: relative !important;\n top: 0;\n left: 0;\n width: 100% !important;\n backdrop-filter: none !important;\n display: flex !important;\n transform: none !important;\n height: auto !important;\n min-width: auto;\n z-index: 0 !important;\n}\n\n.bubble-pop-up.is-opening,\n.bubble-pop-up.is-closing {\n will-change: transform;\n}\n\n/* Optimize performance during open/close transitions */\n.bubble-pop-up.is-opening .bubble-pop-up-container,\n.bubble-pop-up.is-closing .bubble-pop-up-container {\n transform: translateZ(0);\n}\n\n.bubble-pop-up.is-opening .bubble-pop-up-background,\n.bubble-pop-up.is-closing .bubble-pop-up-background {\n transform: translateZ(0);\n contain: layout paint;\n}\n\n.bubble-header-container {\n display: inline-flex;\n height: 50px;\n margin: 0;\n padding: 0;\n z-index: 3;\n padding: 18px 18px 22px;\n position: sticky;\n top: 0;\n background: none !important;\n overflow: visible;\n}\n\n.bubble-header {\n display: inline-flex;\n flex-grow: 1;\n margin-right: 14px;\n color: var(--primary-text-color);\n}\n\n.bubble-name {\n font-size: 14px;\n font-weight: heavy;\n}\n\n.bubble-close-button {\n display: flex;\n position: relative;\n height: 50px;\n width: 50px;\n border: var(--bubble-pop-up-close-button-border, var(--bubble-pop-up-border, var(--bubble-border, none)));\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px));\n z-index: 1;\n background: var(--bubble-pop-up-main-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color))));\n color: var(--primary-text-color);\n flex-shrink: 0;\n cursor: pointer;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n transition: all 0.3s ease;\n box-sizing: border-box;\n}\n\n.bubble-close-icon {\n --mdc-icon-size: 24px;\n color: var(--primary-text-color);\n line-height: normal;\n}\n\n.bubble-button-card-container {\n background: var(--bubble-pop-up-main-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color))));\n}\n\n/* Container with placeholder - ensure proper sizing */\n.bubble-pop-up-container.has-placeholder {\n min-height: 80px;\n padding-top: 18px !important;\n padding-bottom: 18px !important;\n height: 72px !important;\n}\n\n/* Editor placeholder styling */\n.bubble-editor-placeholder {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 8px 16px;\n margin-top: 20px;\n background: var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)));\n border-radius: var(--bubble-border-radius, 32px);\n color: var(--primary-text-color);\n font-size: 16px;\n opacity: 0.8;\n min-height: 56px;\n box-sizing: border-box;\n border: 1px dashed var(--divider-color, rgba(127, 127, 127, 0.3));\n width: 100%;\n}\n\n.bubble-editor-placeholder ha-icon {\n --mdc-icon-size: 24px;\n color: var(--primary-text-color);\n opacity: 0.6;\n flex-shrink: 0;\n}\n\n.bubble-editor-placeholder-info {\n display: flex;\n flex-direction: column;\n gap: 2px;\n overflow: hidden;\n}\n\n.bubble-editor-placeholder-hash {\n font-weight: 500;\n font-size: 14px;\n color: var(--primary-text-color);\n}\n\n.bubble-editor-placeholder-hint {\n font-size: 11px;\n color: var(--secondary-text-color);\n opacity: 0.7;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n}\n\n.bubble-pop-up.editor > .bubble-pop-up-container {\n padding-bottom: 18px !important;\n mask-image: none;\n -webkit-mask-image: none; \n overflow: hidden; \n}\n\n.editor .bubble-pop-up-background {\n width: 100%;\n height: 100%;\n left: 0px;\n top: 0px;\n z-index: -1;\n display: flex;\n position: absolute;\n background-color: var(--bubble-pop-up-main-background-color, var(--bubble-pop-up-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color)))));\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) !important;\n backdrop-filter: none;\n -webkit-backdrop-filter: none;\n}\n\n.editor * {\n transition: none !important;\n}\n\n.no-header .bubble-header-container {\n visibility: hidden !important;\n height: 0px !important;\n opacity: 0 !important;\n}\n\n.no-header .bubble-pop-up-container {\n padding-top: 4px !important;\n}\n\n.no-header .bubble-pop-up-container.is-scrollable {\n mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 24px), transparent 100%) !important;\n -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 24px), transparent 100%) !important;\n}\n\n.large .bubble-header-container {\n height: calc( var(--row-height,56px) * var(--row-size,1) + var(--row-gap,8px) * ( var(--row-size,1) - 1 ));\n}\n\n.large .bubble-close-button {\n height: var(--row-height,56px);\n width: var(--row-height,56px);\n --mdc-icon-size: 28px !important;\n} ";let t,n=e.popUp.querySelector("style");function o(){t=getComputedStyle(document.body).getPropertyValue("--ha-card-background")||getComputedStyle(document.body).getPropertyValue("--card-background-color");const n=e.config.bg_color?e.config.bg_color:t,o=Math.min(1,Math.max(0,(e.config.bg_opacity??88)/100)),i=(0,r.Bz)(n,o,1.02),a=Math.min(1,.65*o),s=(0,r.Bz)(n,a,1.02);e.popUp.style.setProperty("--bubble-pop-up-background-color",i),e.popUp.style.setProperty("--bubble-pop-up-fade-color",s)}e.stylesAdded&&n?e.elements.customStyle=n:(e.elements.customStyle=(0,s.n)("style"),e.popUp.appendChild(e.elements.customStyle),e.popUp.appendChild(e.elements.style),e.stylesAdded=!0),e.updatePopupColorListener=()=>{o()},Ke.addEventListener("change",e.updatePopupColorListener,{passive:!0}),o(),e.popUp.style.setProperty("--desktop-width",e.config.width_desktop??"540px"),e.closeOnEscape=t=>{"Escape"===t.key&&e.config.hash===location.hash&&ue()};let i=e.config.slide_to_close_distance??400;e.handleTouchMove=e=>{e.touches[0].clientY-Fe>i&&e.touches[0].clientY>He&&ue(),He=e.touches[0].clientY};const a=e.popUp.querySelector(".bubble-pop-up-container");if(null===a){e.elements.popUpContainer=(0,s.n)("div"),e.elements.popUpContainer.classList.add("bubble-pop-up-container");let l=e.popUp.firstChild;for(;l;)e.elements.popUpContainer.appendChild(l),l=e.popUp.firstChild}else e.elements.popUpContainer=a;e.elements.popUpContainer,e.popUpBackground=(0,s.n)("div","bubble-pop-up-background"),e.popUp.appendChild(e.popUpBackground),e.popUp.appendChild(e.elements.headerContainer),e.popUp.appendChild(e.elements.popUpContainer),e.config.background_update?e.popUp.style.display="none":e.config.hash!==location.hash&&be(e,0),window.dispatchEvent(new Event("location-changed"))}catch(c){console.error(c)}}(e),e.config.background_update&&!e.headerInitialized){if(e.config.entity||e.config.name||e.config.icon){const t=e.config.sub_button;if(t){const t=(0,m.mg)(e.config);e.config.sub_button={main:t.main||[],bottom:[]}}at(e,e.elements.header),e.config.sub_button=t}Ze(e),e.headerInitialized=!0}}else if(e.popUp&&e.elements){if(e.config.hash===location.hash||e.editor||e.config.background_update&&!e.headerInitialized){if(e.config.entity||e.config.name||e.config.icon){const t=e.config.sub_button;if(t){const t=(0,m.mg)(e.config);e.config.sub_button={main:t.main||[],bottom:[]}}at(e,e.elements.header),e.config.sub_button=t}Ze(e),e.config.background_update&&(e.headerInitialized=!0)}e.editor||function(e){const t=e.config.trigger,n=e.config.trigger_close??!0;if(t){const o=!e.hasPageLoaded;e.hasPageLoaded=!0;const i=(0,ke.eC)(t);if(0===i.length)return void(e.previousTrigger=!1);if((0,ke.db)(i)){const t=(0,ke.XH)(i,e._hass);if(t===e.previousTrigger)return;e.config.hash===location.hash?t||o||!n||ue():t&&pe(e.config.hash),e.previousTrigger=t}}else{let t=e.config.trigger_entity??"";if(""===t)return;let n=e.config.trigger_state??"",o=e.config.trigger_close??!1,i=e._hass.states[t]?.state;if(!t)return;if(!n)return;if(e.oldTriggerEntityState===i)return;const a=!e.hasPageLoaded;e.hasPageLoaded=!0,e.config.hash===location.hash?o&&n!==i&&(a||ue()):i===n&&pe(e.config.hash),e.oldTriggerEntityState=i}}(e),Qe(e)}},button:at,"sub-buttons":function(e,t=e.content){"sub-buttons"!==e.cardType&&function(e,t=e.container){const n="sub-buttons",o=(0,it.N0)(e,{type:n,appendTo:t,styles:".bubble-container.no-background,\n.bubble-container.no-background::after,\n.bubble-container.no-background::before {\n background-color: transparent !important;\n border-radius: 0 !important;\n overflow: visible !important;\n border: none !important;\n box-shadow: none !important;\n}\n\n.no-background .bubble-sub-button-container {\n right: 0;\n}\n\n.bubble-sub-button-container.space-between-justify {\n justify-content: space-between !important;\n}\n\n.bubble-sub-button-container {\n height: auto;\n min-height: auto;\n max-height: none;\n}\n\nha-card.footer-mode {\n bottom: var(--bubble-footer-bottom, 16px);\n height: auto;\n margin-top: 0;\n position: fixed;\n width: calc(100% - var(--mdc-drawer-width, 0px) - 8px);\n left: calc(var(--mdc-drawer-width, 0px) + 4px);\n z-index: 5;\n}\n\nha-card.footer-mode:not(.footer-full-width) {\n width: var(--bubble-footer-width, 500px);\n left: calc(var(--mdc-drawer-width, 0px) + (100% - var(--mdc-drawer-width, 0px) - var(--bubble-footer-width, 500px)) / 2);\n}\n\n@media only screen and (max-width: 600px) {\n ha-card.footer-mode {\n width: calc(100% - 16px);\n left: 8px;\n }\n \n ha-card.footer-mode:not(.footer-full-width) {\n width: calc(100% - 16px);\n left: 8px;\n }\n}\n\nha-card.footer-mode .bubble-container {\n margin: 0;\n box-shadow: var(--bubble-footer-box-shadow, 2px 2px 40px rgba(0, 0, 0, 0.4));\n}\n\nha-card.footer-mode .bubble-container::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: 0.2;\n background: var(--bubble-pop-up-main-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color))));\n}\n\nha-card.footer-mode.editor {\n position: relative;\n width: 100%;\n left: 0;\n bottom: 0;\n}\n\n.editor {\n transition: none !important;\n}",withBaseElements:!1,withBackground:!0,withFeedback:!1,withSubButtons:!0});if(e.config.hide_main_background&&o.mainContainer.classList.add("no-background"),e.config.menu_style&&o.subButtonContainer.classList.add("menu-style"),e.config.menu_style&&e.config.labels_below&&o.subButtonContainer.classList.add("labels-below"),e.config.space_between_buttons&&o.subButtonContainer.classList.add("space-between-buttons"),e.config.hide_button_labels&&o.subButtonContainer.classList.add("hide-labels"),e.config.compact_mode&&o.subButtonContainer.classList.add("compact-mode"),e.config.footer_mode){e.card.classList.add("footer-mode"),e.config.footer_full_width?e.card.classList.add("footer-full-width"):e.config.footer_width&&e.card.style.setProperty("--bubble-footer-width",`${e.config.footer_width}px`);const t=e.config.footer_bottom_offset||16;e.card.style.setProperty("--bubble-footer-bottom",`${t}px`)}e.config.footer_mode&&!e.editor&&(e.cardContainer=e.card.parentNode.host?.parentNode?.parentNode,e.cardContainer,e.cardContainer.classList.contains("card")&&(e.cardContainer.style.position="absolute")),e.cardType=n}(e,t);const n=e.config.sub_button;if(n){const t=(0,m.mg)(e.config);e.config.sub_button={main:[],bottom:t.bottom||[]}}(0,xe.Kr)(e),e.config.sub_button=n,function(e){(0,s.JK)(e),Ue(e),e.config.footer_mode&&(function(e){const t=e.config.footer_bottom_offset||16;e.card.style.setProperty("--bubble-footer-bottom",`${t}px`)}(e),e.editor||function(e){const t=function(e){const t=document.querySelector("body > home-assistant");if(!t?.shadowRoot)return e?.parentNode;const n=t.shadowRoot.querySelector("home-assistant-main");if(!n?.shadowRoot)return e?.parentNode;const o=n.shadowRoot.querySelector("ha-drawer > partial-panel-resolver > ha-panel-lovelace");if(!o?.shadowRoot)return e?.parentNode;const i=o.shadowRoot.querySelector("hui-root");return i?.shadowRoot&&i.shadowRoot.querySelector("#view > hui-view > hui-sections-view")||e?.parentNode}(rt(e));t&&function(e,t,n){const o=()=>{const o=(Number(e.offsetHeight||e.getBoundingClientRect().height)||0)+(Number(n?.config?.footer_bottom_offset)||16)+16;t.style.paddingBottom=`${o}px`};requestAnimationFrame(()=>{requestAnimationFrame(o)})}(e.card,t,e)}(e))}(e),function(e){const t=e.editor||e.detectedEditor,n=e.card.classList.contains("editor");t?n||(st(e),e.card.classList.add("editor")):n&&(e.card.classList.remove("editor"),e.config.footer_mode?function(e){const t=rt(e);t&&""!==t.style.position||function(e){const t=rt(e);t?.classList.contains("card")&&(t.style.position="absolute",e.cardContainer=t)}(e)}(e):st(e))}(e)},separator:function(e){"separator"!==e.cardType&&function(e){const t="separator";e.elements={},e.elements.mainContainer=(0,s.n)("div","bubble-container bubble-separator separator-container"),e.elements.icon=(0,s.n)("ha-icon","bubble-icon"),e.elements.name=(0,s.n)("h4","bubble-name"),e.elements.line=(0,s.n)("div","bubble-line"),e.elements.mainContainer.appendChild(e.elements.icon),e.elements.mainContainer.appendChild(e.elements.name),e.elements.mainContainer.appendChild(e.elements.line),(0,it.N0)(e,{type:t,styles:".bubble-container {\n display: flex;\n background: none;\n align-items: center;\n height: 40px;\n overflow: visible;\n --bubble-separator-border: none;\n}\n.bubble-icon {\n display: inline-flex;\n height: auto;\n width: auto;\n margin: 0 22px 0 8px;\n}\n.bubble-name {\n margin: 0 30px 0 0;\n font-size: 16px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.bubble-name:empty {\n display: none;\n}\n\n.bubble-line {\n border-radius: 6px;\n margin-right: 14px;\n opacity: 0.6;\n flex-grow: 1;\n height: 6px;\n background-color: var(--bubble-line-background-color, var(--ha-card-background-color, var(--secondary-background-color)));\n}\n\n.bubble-sub-button-container {\n margin-left: 8px;\n}\n\n.rows-2 .bubble-sub-button-container {\n margin-left: 14px;\n}\n\n.large .bubble-container {\n height: calc( var(--row-height,44px) * var(--row-size,0.8) + var(--row-gap,8px) * ( var(--row-size,0.8) - 1 ))\n}\n\n.bubble-container.with-bottom-buttons {\n align-items: flex-start;\n}\n\n.with-bottom-buttons .bubble-line {\n margin-top: 15px;\n}\n\n.with-bottom-buttons .bubble-icon,\n.with-bottom-buttons .bubble-name,\n.with-bottom-buttons .bubble-line {\n display: initial;\n line-height: 36px;\n}",withMainContainer:!1,withBaseElements:!1,withSubButtons:!0,iconActions:!1,buttonActions:!1}),e.cardType=t}(e),function(e){e.elements.icon.icon=(0,we.sW)(e),""===e.elements.icon.icon&&""===e.elements.icon.style.margin?(e.elements.icon.style.margin="0px 8px",e.elements.icon.style.width="0px"):""!==e.elements.icon.icon&&"0px 8px"===e.elements.icon.style.margin&&(e.elements.icon.style.margin="",e.elements.icon.style.width="")}(e),(0,et.m9)(e,!1),(0,xe.Kr)(e),function(e){(0,s.JK)(e),Ue(e)}(e)},cover:function(e){"cover"!==e.cardType&&function(e){const t="cover",n=(0,it.N0)(e,{type:t,styles:".bubble-cover-button {\n display: flex;\n position: relative;\n height: 36px;\n width: 36px;\n border-radius: var(--bubble-cover-buttons-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n background-color: var(--bubble-cover-button-background-color);\n cursor: pointer;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n transition: all 0.3s ease;\n box-sizing: border-box;\n}\n\n.bubble-cover-button-icon {\n --mdc-icon-size: 20px;\n color: var(--primary-text-color);\n line-height: normal;\n}\n\n.bubble-buttons-container {\n align-items: center;\n gap: 8px;\n}\n\n.bubble-button.disabled {\n opacity: 0.3 !important;\n pointer-events: none !important;\n cursor: none !important;\n}\n\n.large .bubble-cover-button-icon {\n --mdc-icon-size: 24px;\n}",withSubButtons:!0,iconActions:!0,buttonActions:!0});function o(e,t,n){const o=(0,s.n)("div",`bubble-cover-button ${t}`),i=(0,s.n)("ha-icon",`bubble-cover-button-icon ${n}`);i.setAttribute("icon",e);const a=(0,s.n)("div","bubble-feedback-container"),r=(0,s.n)("div","bubble-feedback-element feedback-element");return a.appendChild(r),o.appendChild(a),o.appendChild(i),o.icon=i,o.feedback=r,o.haRipple=(0,s.n)("ha-ripple"),o.appendChild(o.haRipple),o}n.buttonsContainer.classList.add("bubble-buttons","buttons-container"),n.buttonOpen=o("mdi:arrow-up","bubble-button bubble-open button open","bubble-icon-open"),n.buttonStop=o("mdi:stop","bubble-button bubble-stop button stop","bubble-icon-stop"),n.buttonClose=o("mdi:arrow-down","bubble-button bubble-close button close","bubble-icon-close"),n.buttonsContainer.append(n.buttonOpen,n.buttonStop,n.buttonClose),n.buttonOpen.addEventListener("click",()=>{(0,s.jp)("selection");const t=e.config.open_service??"cover.open_cover",[n,o]=t.split(".");e._hass.callService(n,o,{entity_id:e.config.entity})}),n.buttonStop.addEventListener("click",()=>{(0,s.jp)("selection");const t=e.config.stop_service??"cover.stop_cover",[n,o]=t.split(".");e._hass.callService(n,o,{entity_id:e.config.entity})}),n.buttonClose.addEventListener("click",()=>{(0,s.jp)("selection");const t=e.config.close_service??"cover.close_cover",[n,o]=t.split(".");e._hass.callService(n,o,{entity_id:e.config.entity})}),e.cardType=t}(e),(0,et.zQ)(e),(0,et.wd)(e),(0,et.m9)(e),(0,et.Uk)(e),function(e){const t=e._hass.states[e.config.entity],{current_position:n,assumed_state:o}=t.attributes,i=lt(t,1),a=lt(t,2),r=lt(t,8),l=function(e){return void 0!==e.attributes.current_position?100===e.attributes.current_position:"open"===e.state}(t),c=function(e){return void 0!==e.attributes.current_position?0===e.attributes.current_position:"closed"===e.state}(t),d="curtain"===(0,s.D$)(e,"device_class");e.elements.icon.icon=l?(0,we.sW)(e,e.config.entity,e.config.icon_open):(0,we.sW)(e,e.config.entity,e.config.icon_close);const u=e.config.icon_up||(d?"mdi:arrow-expand-horizontal":"mdi:arrow-up"),p=e.config.icon_down||(d?"mdi:arrow-collapse-horizontal":"mdi:arrow-down");e.elements.buttonOpen.icon.setAttribute("icon",u),e.elements.buttonClose.icon.setAttribute("icon",p),void 0!==n?(l?e.elements.buttonOpen.classList.add("disabled"):i&&e.elements.buttonOpen.classList.remove("disabled"),c?e.elements.buttonClose.classList.add("disabled"):a&&e.elements.buttonClose.classList.remove("disabled")):(e.elements.buttonOpen.classList.remove("disabled"),e.elements.buttonClose.classList.remove("disabled")),e.elements.buttonStop.style.display=r?"":"none"}(e),(0,xe.Kr)(e),function(e){(0,s.JK)(e),Ue(e)}(e)},"empty-column":function(e){"empty-column"!==e.cardType&&function(e){e.elements={},e.elements.emptyColumnCard=(0,s.n)("div","bubble-empty-column empty-column"),e.elements.style=(0,s.n)("style"),e.elements.style.innerText=".empty-column {\n display: flex;\n width: 100%;\n}\n",e.elements.customStyle=(0,s.n)("style"),e.content.innerHTML="",e.content.appendChild(e.elements.emptyColumnCard),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),e.cardType="empty-column"}(e)},"horizontal-buttons-stack":function(e){"horizontal-buttons-stack"!==e.cardType&&function(e){e.elements={},e.elements.buttons=[],e.elements.cardContainer=(0,s.n)("div","bubble-horizontal-buttons-stack-card-container horizontal-buttons-stack-container");let t=1;for(;e.config[t+"_link"];)e.elements.cardContainer.appendChild(dt(e,t)),t++;e.elements.style=(0,s.n)("style"),e.elements.style.innerText="@keyframes from-bottom {\n 0% { transform: translate(-50%, 100px); }\n 26% { transform: translate(-50%, -8px); }\n 46% { transform: translate(-50%, 1px); }\n 62% { transform: translate(-50%, -2px); }\n 70% { transform: translate(-50%, 0); }\n 100% { transform: translate(-50%, 0); }\n}\n@keyframes pulse {\n 0% { filter: brightness(0.7); }\n 100% { filter: brightness(1.3); }\n}\nha-card {\n border-radius: 0;\n}\n.horizontal-buttons-stack-card {\n bottom: 16px;\n height: 51px;\n margin-top: 0;\n position: fixed;\n width: calc(100% - var(--mdc-drawer-width, 0px) - 8px);\n left: calc(var(--mdc-drawer-width, 0px) + 4px);\n z-index: 6; /* Higher value hide the more-info panel */\n}\n@media only screen and (max-width: 870px) {\n .horizontal-buttons-stack-card {\n width: calc(100% - 16px);\n left: 8px;\n }\n\n .horizontal-buttons-stack-card::before {\n left: -10px;\n }\n}\n.horizontal-buttons-stack-card::before {\n content: '';\n position: absolute;\n top: -32px;\n display: none;\n background: linear-gradient(0deg, var(--bubble-horizontal-buttons-stack-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--primary-background-color)))) 50%, transparent);\n width: 200%;\n height: 100px;\n pointer-events: none;\n}\n.has-gradient.horizontal-buttons-stack-card::before {\n display: block;\n}\n\n.card-content {\n width: calc(100% + 36px);\n padding: 0 !important;\n max-width: calc(var(--desktop-width) - 8px);\n box-sizing: border-box;\n overflow: scroll;\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n -ms-overflow-style: none;\n scrollbar-width: none;\n mask-image: linear-gradient(\n 90deg,\n #000000 0%,\n #000000 calc(0% + 28px),\n #000000 calc(100% - 28px),\n transparent 100%\n );\n}\n.is-scrollable.card-content {\n padding: 0 !important;\n width: 100%;\n}\n.is-scrolled.card-content {\n padding: 0 !important;\n width: 100%;\n mask-image: linear-gradient(\n 90deg,\n transparent 0%,\n #000000 calc(0% + 28px),\n #000000 calc(100% - 28px),\n transparent 100%\n );\n}\n.is-maxed-scroll.card-content {\n mask-image: linear-gradient(\n 90deg,\n transparent 0%,\n #000000 calc(0% + 28px),\n #000000 calc(100% - 28px),\n #000000 100%\n );\n}\n.card-content::-webkit-scrollbar {\n display: none;\n}\n\n.bubble-horizontal-buttons-stack-card-container {\n height: 51px;\n position: relative;\n margin: auto;\n}\n\n.bubble-button {\n align-items: center;\n border-radius: var(--bubble-horizontal-buttons-stack-border-radius, var(--bubble-border-radius, 32px));\n color: var(--primary-text-color);\n cursor: pointer;\n display: inline-flex;\n height: 50px;\n left: 0;\n padding: 0 16px;\n position: absolute;\n white-space: nowrap;\n z-index: 1;\n transition: transform 1s;\n box-sizing: border-box;\n}\n.bubble-button.highlight {\n animation: pulse 1.4s infinite alternate;\n}\n.bubble-background-color {\n border: 1px solid var(--primary-text-color);\n border-radius: var(--bubble-horizontal-buttons-stack-border-radius, var(--bubble-border-radius, 32px));\n box-sizing: border-box;\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n transition: background-color 1s;\n width: 100%;\n z-index: 1;\n}\n.bubble-background {\n opacity: 0.8;\n border-radius: var(--bubble-horizontal-buttons-stack-border-radius, var(--bubble-border-radius, 32px));\n width: 100%;\n height: 100%;\n box-sizing: border-box !important;\n position: absolute;\n left: 0;\n z-index: 0;\n background-color: var(--bubble-horizontal-buttons-stack-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color))));\n}\n.bubble-icon {\n height: 24px;\n width: 24px;\n z-index: 2;\n}\n.bubble-icon + .bubble-name {\n margin-left: 8px;\n z-index: 2;\n}\n\n.horizontal-buttons-stack-card.editor {\n position: relative;\n width: 100%;\n left: 0;\n bottom: 0;\n}\n.horizontal-buttons-stack-card.editor::before {\n background: none;\n}",e.elements.customStyle=(0,s.n)("style"),e.card.classList.add("horizontal-buttons-stack-card"),e.card.style.marginLeft=e.config.margin??"",e.config.hide_gradient||e.card.classList.add("has-gradient"),e.card.style.setProperty("--desktop-width",e.config.width_desktop??"500px"),e.elements.cardContainer.appendChild(e.elements.style),e.elements.cardContainer.appendChild(e.elements.customStyle),e.content.appendChild(e.elements.cardContainer),e.content.addEventListener("scroll",()=>{e.content.scrollLeft>0?e.content.classList.add("is-scrolled"):e.content.classList.remove("is-scrolled"),e.content.scrollWidth-12{e.content.style.animation="none"},1500));let n=e.card.parentNode.host;n?.parentElement&&!e.editor&&"hui-card"===n?.parentElement?.tagName.toLowerCase()&&(n.parentElement.style.padding="0 0 80px"),e.cardType="horizontal-buttons-stack"}(e),function(e){Ue(e)}(e),function(e){if(!e.config.auto_order)return;const t=e._hass.states;e.elements.buttons.sort((e,n)=>{if(!t[e.pirSensor])return 1;if(!t[n.pirSensor])return-1;const o=t[e.pirSensor]?.last_updated,i=t[n.pirSensor]?.last_updated;return"on"===t[e.pirSensor]?.state&&"on"===t[n.pirSensor]?.state?o>i?-1:o===i?0:1:"on"===t[e.pirSensor]?.state?-1:"on"===t[n.pirSensor]?.state?1:o>i?-1:o===i?0:1})}(e),function(e){e.elements.buttons.forEach(t=>{const n=t.index,o=e.config[`${n}_name`]??"",i=e.config[`${n}_icon`]??"",a=e.config[`${n}_pir_sensor`],r=e.config[`${n}_link`],s=e.config[`${n}_entity`];t.pirSensor=a,t.lightEntity=s,t.link=r,o?(t.name.innerText=o,t.name.style.display=""):t.name.style.display="none",i?(t.icon.icon=i,t.icon.style.display=""):t.icon.style.display="none",void 0===r&&(t.remove(),e.elements.buttons=e.elements.buttons.filter(e=>e!==t),e.elements.buttons.forEach((e,t)=>{e.index=t+1}))});let t=e.elements.buttons.length+1;for(;void 0!==e.config[`${t}_link`];){if(!e.elements.buttons.find(e=>e.index===t)){const n=dt(e,t);e.elements.buttons.push(n)}t++}}(e),function(e){e.editor||e.detectedEditor?(e.elements.cardContainer.classList.add("editor"),e.card.classList.add("editor")):(e.elements.cardContainer.classList.remove("editor"),e.card.classList.remove("editor"))}(e),function(e){let t=0;for(let n=0;n0&&(o=i,localStorage.setItem(`bubbleButtonWidth-${e.elements.buttons[n].link}`,`${i}`)),null!==o&&(e.elements.buttons[n].style.transform=`translateX(${t}px)`,e.elements.buttons[n].style.width="",t+=+o+12)}e.elements.cardContainer.style.width=`${t}px`}(e),function(e){e.elements.buttons.forEach(t=>{const n=e._hass.states[t.lightEntity],o=n?.attributes.rgb_color,i=n?.state;if(o){const e=(0,r.qd)(o)?"rgba(255, 220, 200, 0.5)":`rgba(${o}, 0.5)`;t.backgroundColor.style.backgroundColor=e,t.backgroundColor.style.borderColor="rgba(0, 0, 0, 0)"}else"on"==i?(t.backgroundColor.style.backgroundColor="rgba(255, 255, 255, 0.5)",t.backgroundColor.style.borderColor="rgba(0, 0, 0, 0)"):(t.backgroundColor.style.backgroundColor="rgba(0, 0, 0, 0)",t.backgroundColor.style.borderColor="var(--primary-text-color)")})}(e),function(e){e.content.scrollWidth>=e.content.offsetWidth?e.content.classList.add("is-scrollable"):e.content.classList.remove("is-scrollable")}(e)},calendar:function(e){"calendar"!==e.cardType&&function(e){const t="calendar",n=(0,it.N0)(e,{type:t,styles:'.bubble-container {\n height: var(--bubble-calendar-height, 56px);\n display: flex;\n gap: 8px;\n}\n.bubble-calendar-content {\n flex-grow: 1;\n min-width: 0;\n height: 100%;\n overflow: scroll;\n}\n.bubble-calendar-content.can-scroll-top {\n mask-image: linear-gradient(to bottom, transparent 0%, black var(--bubble-calendar-mask-size, 16px), black 100%);\n -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black var(--bubble-calendar-mask-size, 16px), black 100%);\n}\n.bubble-calendar-content.can-scroll-bottom {\n mask-image: linear-gradient(to bottom, black 0%, black calc(100% - var(--bubble-calendar-mask-size, 16px)), transparent 100%);\n -webkit-mask-image: linear-gradient(to bottom, black 0%, black calc(100% - var(--bubble-calendar-mask-size, 16px)), transparent 100%);\n}\n.bubble-calendar-content.can-scroll-top.can-scroll-bottom {\n mask-image: linear-gradient(to bottom, transparent 0%, black var(--bubble-calendar-mask-size, 16px), black calc(100% - var(--bubble-calendar-mask-size, 16px)), transparent 100%);\n -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black var(--bubble-calendar-mask-size, 16px), black calc(100% - var(--bubble-calendar-mask-size, 16px)), transparent 100%);\n}\n.card-content::after {\n border-radius: 0 0 var(--bubble-calendar-border-radius, var(--bubble-border-radius, 32px)) var(--bubble-calendar-border-radius, var(--bubble-border-radius, 32px));\n content: "";\n display: flex;\n height: 32px;\n width: 100%;\n position: absolute;\n bottom: 0;\n pointer-events: none;\n transition: opacity .2s, transform .2s;\n z-index: 1;\n}\n.bubble-sub-button-container {\n flex-shrink: 0;\n position: sticky !important;\n top: 0;\n}\n.bubble-day-wrapper {\n display: flex;\n align-items: flex-start;\n justify-content: center;\n width: 100%;\n gap: 8px;\n padding: 7px 16px 7px 8px;\n position: relative;\n box-sizing: border-box;\n}\n.bubble-day-wrapper + .bubble-day-wrapper::before {\n content: "";\n position: absolute;\n top: -1px;\n left: 62px;\n right: 16px;\n height: 2px;\n background-color: var(--bubble-button-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n}\n.bubble-day-chip {\n display: flex;\n flex-grow: 0;\n flex-shrink: 0;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 42px;\n height: 42px;\n border-radius: var(--bubble-button-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-button-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n position: relative;\n}\n.bubble-day-number {\n font-size: 24px;\n line-height: 20px;\n font-weight: 600;\n opacity: 0.6;\n}\n.is-active .bubble-day-number {\n filter: brightness(1.1);\n opacity: 1;\n}\n.bubble-day-month {\n font-size: 12px;\n line-height: 12px;\n font-weight: 400;\n opacity: 0.6;\n}\n.is-active .bubble-day-month {\n filter: brightness(1.1);\n opacity: 1;\n}\n.bubble-day-events {\n width: 100%;\n border-radius: var(--bubble-calendar-border-radius, var(--bubble-border-radius, 32px));\n min-width: 0;\n}\n.bubble-event {\n background-color: var(--bubble-event-background-color);\n background-image: var(--bubble-event-background-image);\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 4px 6px;\n border-radius: var(--bubble-calendar-border-radius, var(--bubble-border-radius, 32px));\n margin-left: -6px;\n position: relative;\n line-height: 1em;\n}\n.bubble-event-time {\n font-size: 12px;\n font-weight: 400;\n white-space: nowrap;\n flex-shrink: 0;\n flex-grow: 0;\n opacity: 0.7;\n}\n.bubble-event-color {\n height: 12px;\n width: 12px;\n border-radius: var(--bubble-calendar-border-radius, var(--bubble-border-radius, 32px));\n flex-shrink: 0;\n flex-grow: 0;\n}\n.bubble-event-name-wrapper {\n width: 10px;\n flex: 1;\n}\n.bubble-event-name {\n font-size: 13px;\n font-weight: 600;\n max-width: 100%;\n min-width: 0;\n flex-shrink: 1;\n flex-grow: 1;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.bubble-event-place {\n opacity: 0.6;\n display: flex;\n align-items: center;\n margin-top: 2px;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n min-width: 0;\n flex-shrink: 1;\n flex-grow: 1;\n}\n.bubble-event-place-icon {\n display: inline-flex;\n --mdc-icon-size: 12px;\n margin-right: 4px;\n}\n\n.bubble-sub-button-container.fixed-top {\n margin-top: 10px;\n}\n\n.with-bottom-buttons .bubble-calendar-content {\n height: 52px;\n}',withBaseElements:!1,withSubButtons:!0,iconActions:!1,buttonActions:!1});n.calendarCardContent=(0,s.n)("div","bubble-calendar-content"),n.mainContainer.style.setProperty("--bubble-calendar-height",56*(e.config.rows??1)+"px"),n.mainContainer.prepend(n.calendarCardContent),e.cardType=t}(e);const t=JSON.stringify(e.config.entities.map(t=>e._hass.states[t.entity]));e.cacheKey!==t&&(e.cacheKey=t,setTimeout(()=>{e.cacheKey=""},9e5),async function(e){const t=Math.max(1,e.config.days??7),n=new Date,o=n.toISOString(),i=new Date(n);i.setDate(i.getDate()+(t-1)),i.setHours(23,59,59,999);const a=`start=${o}&end=${i.toISOString()}`,r=e.config.entities.map(async t=>{const n=`calendars/${t.entity}?${a}`;return(await e._hass.callApi("get",n)).map(e=>({...e,entity:t}))}),s=await Promise.all(r);e.events=s.flat().sort(k).slice(0,e.config.limit??void 0)}(e).then(()=>{!async function(e){const t=v(e._hass),n=e.events.reduce((e,t)=>{const n=(e=>{const t=x(e);return`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,"0")}-${t.getDate().toString().padStart(2,"0")}`})(t.start);return e[n]||(e[n]=[]),e[n].push(t),e},{});if(0===Object.keys(n).length){const e=(new Date).toISOString().split("T")[0];n[e]=[{start:{date:e},end:{date:e},summary:"No events",entity:{color:"transparent"}}]}const o=new DocumentFragment;Object.keys(n).sort().forEach(a=>{const r=x({date:a}),l=new Date,c=(0,s.n)("div","bubble-day-number"),d=e._hass.locale.language,u=e._hass.locale.time_format;c.innerHTML=`${r.getDate()}`;const p=(0,s.n)("div","bubble-day-month");p.innerHTML=r.toLocaleString(d,{month:"short"});const b=(0,s.n)("div","bubble-day-chip");b.appendChild(c),b.appendChild(p),r.getDate()===l.getDate()&&r.getMonth()===l.getMonth()&&b.classList.add("is-active"),(0,i.dN)(b,{...e.config},null);const h=(0,s.n)("div","bubble-day-events");n[a].forEach(n=>{const o=void 0!==n.start.date,a=new Date,r=x(n.start),l=x(n.end),c=(0,s.n)("div","bubble-event-time");c.innerHTML=o?t("cards.calendar.all_day"):r.toLocaleTimeString(d,{hour:"numeric",minute:"numeric",hour12:"12"===u}),o||!0!==e.config.show_end||(c.innerHTML+=` – ${l.toLocaleTimeString(d,{hour:"numeric",minute:"numeric",hour12:"12"===u})}`);const p=(0,s.n)("div","bubble-event-name-wrapper"),b=(0,s.n)("div","bubble-event-name"),m=n.summary||t("cards.calendar.busy");(0,s.Nl)(e,b,m),p.appendChild(b);const g=(0,s.n)("div","bubble-event-color");if(g.style.backgroundColor=n.entity.color?n.entity.color.startsWith("#")?n.entity.color:`var(--${n.entity.color}-color)`:w(_(n.entity.entity)),"transparent"===n.entity.color&&(g.style.display="none"),!0===e.config.show_place&&null!==n.location){const t=(0,s.n)("div","bubble-event-place");(0,s.Nl)(e,t,n.location),p.appendChild(t)}const f=(0,s.n)("div","bubble-event");f.appendChild(g),f.appendChild(c),f.appendChild(p),(0,i.dN)(f,e.config.event_action,n.entity.entity,{tap_action:{action:"none"},double_tap_action:{action:"none"},hold_action:{action:"none"}});const y="var(--bubble-event-accent-color, var(--bubble-accent-color, var(--bubble-default-color)))";if(!0===e.config.show_progress&&o&&re.elements.mainContainer.offsetHeight&&e.content.classList.add("is-overflowing")}),e.elements.calendarCardContent.innerHTML="",e.elements.calendarCardContent.appendChild(o),setTimeout(()=>pt(e),0)}(e)})),function(e){if((0,s.JK)(e),Ue(e),e.elements?.calendarCardContent){pt(e);const t=e.elements.calendarCardContent;t&&!t._scrollListener&&(t._scrollListener=()=>pt(e),t.addEventListener("scroll",t._scrollListener))}}(e),(0,xe.Kr)(e)},"media-player":function(e){"media-player"!==e.cardType&&function(e){const t="media-player",n=(0,it.N0)(e,{type:t,styles:".bubble-media-button {\n display: flex;\n position: relative;\n height: 36px;\n width: 36px;\n border-radius: var(--bubble-media-player-buttons-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n background-color: var(--bubble-media-player-button-background-color);\n cursor: pointer;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n transition: all 0.3s ease;\n box-sizing: border-box;\n}\n\n.bubble-media-player .bubble-entity-picture {\n inset: 0;\n pointer-events: none;\n}\n\n.bubble-cover-icon-crossfade,\n.bubble-cover-background-crossfade {\n position: absolute;\n inset: 0;\n overflow: hidden;\n}\n\n.bubble-cover-crossfade-layer {\n position: absolute;\n inset: 0;\n background-size: cover;\n background-position: center;\n opacity: 0;\n transition: opacity 2s ease;\n pointer-events: none;\n}\n\n.bubble-cover-crossfade-layer.is-visible {\n opacity: 1;\n}\n\n.bubble-cover-crossfade-layer.is-empty {\n opacity: 0;\n}\n\n.bubble-cover-crossfade-layer--icon {\n z-index: 0;\n}\n\n.bubble-media-player .bubble-cover-background {\n overflow: hidden;\n}\n\n.bubble-button-container {\n align-items: center;\n gap: 8px;\n }\n\n.bubble-media-button-icon {\n --mdc-icon-size: 20px;\n color: var(--primary-text-color);\n line-height: normal;\n}\n\n.bubble-play-pause-button,\n.full-width > .bubble-play-pause-button {\n background-color: var(--bubble-accent-color, var(--bubble-default-color));\n}\n\n.bubble-play-pause-button .bubble-media-button-icon {\n color: var(--bubble-media-player-play-pause-icon-color, var(--bubble-button-active-icon-color, var(--primary-background-color, white)));\n}\n\n.bubble-play-pause-button:not(.large) {\n height: 36px;\n width: 36px;\n}\n\n/* Volume slider wrapper (similar to sub-button slider) */\n.bubble-volume-slider-wrapper {\n position: absolute;\n display: flex;\n align-items: center;\n gap: 8px;\n height: 38px;\n width: calc(100% - 16px);\n left: 8px;\n right: 8px;\n z-index: 1;\n opacity: 1;\n transition: opacity .2s, transform .2s;\n transform: translateX(0);\n touch-action: none;\n}\n\n.bubble-volume-slider {\n position: relative;\n flex: 1 1 auto;\n height: 100%;\n overflow: hidden;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n background-color: var(--bubble-media-player-slider-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n}\n\n.bubble-range-value {\n display: flex;\n justify-content: flex-end;\n height: 38px;\n align-items: center;\n font-size: 12px;\n opacity: 0.8;\n z-index: 1;\n}\n\n.bubble-mute-button {\n opacity: 1;\n transition: opacity .2s, transform .2s;\n transform: translateX(0);\n}\n\n.is-hidden {\n opacity: 0 !important;\n pointer-events: none;\n transform: translateX(14px);\n}\n\n/* Keep hidden volume slider overlays inside card width */\n.bubble-volume-slider-wrapper.is-hidden {\n right: calc(8px + 14px);\n}\n\n/* Position volume slider at bottom when buttons are in bottom-fixed mode */\n.bubble-wrapper.has-bottom-buttons .bubble-volume-slider-wrapper {\n bottom: 8px;\n top: auto;\n width: 100%;\n left: 0;\n right: auto;\n padding: 0px 8px;\n box-sizing: border-box;\n}\n\n/* Bottom-fixed layout uses explicit width reduction to absorb the translateX */\n.bubble-wrapper.has-bottom-buttons .bubble-volume-slider-wrapper.is-hidden {\n width: calc(100% - 14px);\n}\n\n.bubble-range-fill {\n background-color: var(--bubble-accent-color, var(--bubble-default-color));\n height: 101%; /* Ensure the fill covers the entire slider */\n}\n\n/* Original mute button (in icon container, normal mode) */\n.bubble-mute-button {\n display: flex;\n position: absolute;\n height: 38px;\n width: 38px;\n justify-content: center;\n align-items: center;\n}\n\n/* Mute button in volume slider wrapper */\n.bubble-volume-slider-mute-button {\n display: flex;\n position: relative;\n height: 36px;\n width: 36px;\n border-radius: var(--bubble-media-player-buttons-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n background-color: var(--bubble-media-player-button-background-color);\n cursor: pointer;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n transition: all 0.3s ease;\n box-sizing: border-box;\n flex-shrink: 0;\n touch-action: none;\n}\n\n/* Close button in volume slider wrapper */\n.bubble-volume-slider-close-button {\n display: flex;\n position: relative;\n height: 36px;\n width: 36px;\n border-radius: var(--bubble-media-player-buttons-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n background-color: var(--bubble-media-player-button-background-color);\n cursor: pointer;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n transition: all 0.3s ease;\n box-sizing: border-box;\n flex-shrink: 0;\n touch-action: none;\n}\n\n.bubble-media-info-container {\n display: flex;\n line-height: 14px;\n font-size: 12px;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n margin: 0 16px 0 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n}\n\n.bubble-title,\n.bubble-artist {\n display: flex;\n margin: 2px 0;\n position: relative;\n white-space: nowrap;\n}\n\n.bubble-title {\n font-weight: 600;\n}\n\n.bubble-background {\n background-size: cover;\n background-position: center;\n filter: blur(50px);\n opacity: 0.5;\n}\n\n.bubble-media-info-container.name-without-icon {\n margin-left: 16px;\n}\n\n@media screen and (max-width: 250px) {\n .bubble-previous-button {\n display: none;\n }\n}\n\n@media screen and (max-width: 206px) {\n .bubble-next-button {\n display: none;\n }\n}\n\n@media screen and (max-width: 160px) {\n .bubble-volume-button {\n display: none;\n }\n}\n\n.large .bubble-mute-button {\n height: 42px;\n width: 42px;\n}\n\n.large .bubble-volume-slider-wrapper {\n height: 42px;\n}\n\n.large .bubble-volume-slider {\n height: 42px;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n}\n\n.large .bubble-volume-slider-mute-button,\n.large .bubble-volume-slider-close-button {\n height: 42px;\n width: 42px;\n}\n\n.large .bubble-range-value {\n place-items: center;\n height: 42px;\n}\n\n.full-width > .bubble-play-pause-button,\n.large .full-width > .bubble-play-pause-button {\n height: 36px;\n}\n\n.large .bubble-play-pause-button {\n height: 42px;\n width: 42px;\n}\n\n/* Ensure volume slider + its wrapper buttons match sub-buttons size when bottom-fixed */\n.bubble-wrapper.has-bottom-buttons .bubble-volume-slider-wrapper {\n height: 36px;\n}\n\n.bubble-wrapper.has-bottom-buttons .bubble-volume-slider,\n.bubble-wrapper.has-bottom-buttons .bubble-range-value {\n height: 36px;\n}\n\n.bubble-wrapper.has-bottom-buttons .bubble-volume-slider-mute-button,\n.bubble-wrapper.has-bottom-buttons .bubble-volume-slider-close-button {\n height: 36px;\n width: 36px;\n}\n\n.fixed-top .bubble-buttons-container {\n margin-top: 7px;\n}\n\n.fixed-top .bubble-buttons-container:not(.bottom-fixed) {\n height: 42px;\n}\n\n.fixed-top .bubble-volume-slider-wrapper {\n margin-top: 7px;\n}",iconActions:!0,buttonActions:!0,withSubButtons:!0});function o(e,t){const n=(0,s.n)("div",`bubble-media-button ${t}`),o=(0,s.n)("ha-icon","bubble-media-button-icon");o.setAttribute("icon",e);const i=(0,s.n)("div","bubble-feedback-container"),a=(0,s.n)("div","bubble-feedback-element feedback-element");return i.appendChild(a),n.appendChild(i),n.appendChild(o),n.icon=o,n.feedback=a,n.haRipple=(0,s.n)("ha-ripple"),n.appendChild(n.haRipple),n}if(n.mediaInfoContainer=(0,s.n)("div","bubble-media-info-container"),n.playPauseButton=o("mdi:play","bubble-play-pause-button"),n.previousButton=o("mdi:skip-previous","bubble-previous-button"),n.nextButton=o("mdi:skip-next","bubble-next-button"),n.volumeButton=o("mdi:volume-high","bubble-volume-button"),n.powerButton=o("mdi:power","bubble-power-button"),n.muteButton=o("mdi:volume-off","bubble-mute-button is-hidden"),n.volumeSliderMuteButton=o("mdi:volume-high","bubble-volume-slider-mute-button"),n.volumeSliderCloseButton=o("mdi:close","bubble-volume-slider-close-button"),n.title=(0,s.n)("div","bubble-title"),n.artist=(0,s.n)("div","bubble-artist"),n.background.classList.add("bubble-cover-background"),n.buttonsContainer.classList.add("bubble-button-container"),n.iconContainer.appendChild(n.muteButton),n.mediaInfoContainer.append(n.title,n.artist),n.contentContainer.append(n.mediaInfoContainer),n.buttonsContainer.append(n.powerButton,n.previousButton,n.nextButton,n.volumeButton,n.playPauseButton),n.volumeSliderWrapper=(0,s.n)("div","bubble-volume-slider-wrapper is-hidden"),n.volumeSliderContainer=(0,s.n)("div","bubble-volume-slider"),(0,kt.H)(e,{targetElement:n.volumeSliderContainer,sliderLiveUpdate:!1,withValueDisplay:!0,holdToSlide:!1}),n.volumeSliderWrapper.appendChild(n.volumeSliderMuteButton),n.volumeSliderWrapper.appendChild(n.volumeSliderContainer),n.volumeSliderWrapper.appendChild(n.volumeSliderCloseButton),n.cardWrapper.appendChild(n.volumeSliderWrapper),!n._volumeStopPropAdded){const e=e=>e.stopPropagation();["pointerdown","pointermove","touchstart","touchmove","mousedown","mousemove","click"].forEach(t=>{n.volumeSliderWrapper.addEventListener(t,e,{passive:!1})}),n._volumeStopPropAdded=!0}function a(){if(n.volumeSliderWrapper.classList.contains("is-hidden"))return;const t=n.buttonsContainer?.classList.contains("bottom-fixed");n.volumeSliderWrapper.classList.add("is-hidden"),t?n.buttonsContainer.classList.remove("is-hidden"):(n.muteButton.classList.add("is-hidden"),yt(e))}if(n.volumeButton.addEventListener("click",t=>{t.stopPropagation();const o=n.buttonsContainer?.classList.contains("bottom-fixed");n.volumeSliderWrapper.classList.toggle("is-hidden"),o?n.buttonsContainer.classList.toggle("is-hidden"):(n.muteButton.classList.toggle("is-hidden"),yt(e))}),(0,i.pd)(n.volumeButton,n.volumeButton.feedback),!n._volumeOutsideListenerAdded){const e=e=>{if(n.volumeSliderWrapper.classList.contains("is-hidden"))return;const t=e.target;n.volumeSliderWrapper.contains(t)||n.volumeButton&&n.volumeButton.contains(t)||a()};document.addEventListener("click",e,{passive:!0}),n._volumeOutsideListenerAdded=!0,n._volumeOutsideHandler=e}n.powerButton.addEventListener("click",()=>{const t=(0,s.Gu)(e),n="off"!==t&&"unknown"!==t;e._hass.callService("media_player",n?"turn_off":"turn_on",{entity_id:e.config.entity})}),(0,i.pd)(n.powerButton,n.powerButton.feedback);const r=t=>{t.addEventListener("pointerdown",n=>{n.stopPropagation();const o=!0===(0,s.D$)(e,"is_volume_muted");e._hass.callService("media_player","volume_mute",{entity_id:e.config.entity,is_volume_muted:!o}),t.clicked=!0}),["click","touchstart","touchend","pointerup","pointercancel"].forEach(e=>{t.addEventListener(e,e=>{e.stopPropagation()})}),(0,i.pd)(t,t.feedback)};r(n.muteButton),r(n.volumeSliderMuteButton),n.previousButton.addEventListener("click",()=>{e._hass.callService("media_player","media_previous_track",{entity_id:e.config.entity})}),(0,i.pd)(n.previousButton,n.previousButton.feedback),n.nextButton.addEventListener("click",()=>{e._hass.callService("media_player","media_next_track",{entity_id:e.config.entity})}),(0,i.pd)(n.nextButton,n.nextButton.feedback),n.playPauseButton.addEventListener("click",()=>{const{service:t}=mt(e);e._hass.callService("media_player",t,{entity_id:e.config.entity}),n.playPauseButton.clicked=!0}),(0,i.pd)(n.playPauseButton,n.playPauseButton.feedback),n.volumeSliderCloseButton.addEventListener("click",e=>{e.stopPropagation(),a()}),(0,i.pd)(n.volumeSliderCloseButton,n.volumeSliderCloseButton.feedback),n.mainContainer.addEventListener("click",()=>(0,s.jp)("selection")),e.cardType=t}(e),(0,et.zQ)(e),(0,et.m9)(e),function(e){const t=(0,s.D$)(e,"media_title"),n=(0,s.D$)(e,"media_artist"),o=t+n;o!==e.previousMediaState&&(e.elements.artist.style.display=""===n?"none":"flex",e.previousMediaState=o),(0,s.Nl)(e,e.elements.title,t),(0,s.Nl)(e,e.elements.artist,n)}(e),function(e){const t=e=>null==e?"":String(e).trim(),n=t((0,s.D$)(e,"media_title")),o=t((0,s.D$)(e,"media_artist")),i=t((0,s.D$)(e,"source")),a=n+o===""||""!==n&&""!==i&&n===i,r=e.config.show_icon??!0,l="idle"===(0,s.Gu)(e);e.elements.mediaInfoContainer.style.display=a||l?"none":"",e.elements.nameContainer.style.display=a||l?"":"none",e.elements.mediaInfoContainer.classList.toggle("name-without-icon",!r)}(e),function(e){const t=e.elements.icon,n=e.elements.image,o=e.elements.iconContainer;if(!t||!o)return;const i=e.config.card_type,a=e.config.button_type,r=e.config.use_accent_color,l=(0,s.md)(e),c=(0,s.$C)(e),d=_t(e),u=Boolean(d.resolvedUrl)&&Boolean(n),p=(0,we.sW)(e),b=t.icon,h="name"===a||"pop-up"===i&&!a;let m="inherit";c&&((0,s.md)(e,"light")&&!r||!h?m=`var(--bubble-icon-color, ${(0,we.VA)(e)})`:"climate"===l&&(m=(0,gt.R)(e)));const g=o.style.color;"inherit"!==m?g!==m&&(o.style.color=m):""!==g&&(o.style.color=""),p&&b!==p&&(t.icon=p),t.style.color!==m&&(t.style.color=m);const f=()=>{if(n){const t=wt(e,"icon");t&&d.iconDisplayedUrl?xt(t,"",()=>{n&&(n.style.display="none")}):n&&(n.style.display="none")}t&&(t.style.display=""),d.iconDisplayedUrl=""};if(u){const o=wt(e,"icon");o?d.resolvedUrl!==d.iconDisplayedUrl?(t&&(t.style.display=""),n&&(n.style.display=""),xt(o,d.resolvedUrl),d.iconDisplayedUrl=d.resolvedUrl):(t&&(t.style.display=""),n&&(n.style.display="")):f()}else f();t.getAttribute("icon")!==t.icon&&t.setAttribute("icon",t.icon)}(e),function(e){if(!e.elements.background)return;const t=_t(e),n=Boolean(e.config.cover_background),o=n?t.resolvedUrl:"";if(n){if(o&&o!==t.backgroundDisplayedUrl){const n=wt(e,"background");n&&(xt(n,o),t.backgroundDisplayedUrl=o)}else if(!o&&t.backgroundDisplayedUrl){const n=wt(e,"background");n&&xt(n,""),t.backgroundDisplayedUrl=""}}else if(t.backgroundDisplayedUrl){const n=wt(e,"background");n&&xt(n,""),t.backgroundDisplayedUrl=""}}(e),(0,et.Uk)(e),function(e){e.elements.rangeFill&&(0,ot.VM)(e)}(e),function(e){const{icon:t}=mt(e);e.elements.playPauseButton.icon.setAttribute("icon",t),e.elements.playPauseButton.clicked=!1}(e),function(e){const t=1==(0,s.D$)(e,"is_volume_muted");"var(--primary-text-color)"!==e.elements.muteButton.icon.style.color&&(e.elements.muteButton.icon.style.color="var(--primary-text-color)"),t?e.elements.muteButton.icon.setAttribute("icon","mdi:volume-off"):e.elements.muteButton.icon.setAttribute("icon","mdi:volume-high"),e.elements.muteButton.clicked=!1,e.elements.volumeSliderMuteButton&&("var(--primary-text-color)"!==e.elements.volumeSliderMuteButton.icon.style.color&&(e.elements.volumeSliderMuteButton.icon.style.color="var(--primary-text-color)"),t?e.elements.volumeSliderMuteButton.icon.setAttribute("icon","mdi:volume-off"):e.elements.volumeSliderMuteButton.icon.setAttribute("icon","mdi:volume-high"),e.elements.volumeSliderMuteButton.clicked=!1)}(e),function(e){const t=(0,s.Gu)(e),n="off"!==t&&"unknown"!==t;e.elements.powerButton.icon.style.color=n?"var(--accent-color)":""}(e),(0,xe.Kr)(e),function(e){(0,s.JK)(e),Ue(e);const t=(0,s.Gu)(e),n="off"!==t&&"unknown"!==t,o="playing"===t,i="paused"===t,a="idle"===t,r=function(e){const t=e?._hass?.states?.[e?.config?.entity]?.state??"";return"playing"===t||"paused"===t||"unknown"===t||"on"===t}(e),l=function(e){const t=bt(e);return{canPrevious:ht(t,16),canNext:ht(t,32),canPlay:ht(t,16384),canPause:ht(t,1),canStop:ht(t,4096),canTurnOn:ht(t,128),canTurnOff:ht(t,256),canVolumeSet:ht(t,4),canVolumeStep:ht(t,1024),canMute:ht(t,8),canPlayMedia:ht(t,512),canSelectSource:ht(t,2048),canSelectSoundMode:ht(t,65536)}}(e),c=!e.config.hide?.power_button&&(l.canTurnOn||l.canTurnOff),d=!e.config.hide?.previous_button&&l.canPrevious&&(e.editor||r),u=!e.config.hide?.next_button&&l.canNext&&(e.editor||r),p=!e.config.hide?.volume_button&&(l.canVolumeSet||l.canVolumeStep||l.canMute)&&(e.editor||r||n),b=!e.config.hide?.play_pause_button&&(e.editor||r||n||a||i||o),h=!(c||d||u||p||b);(!n&&e.config.hide?.power_button||h)&&"none"!==e.elements.buttonsContainer.style.display?(e.elements.buttonsContainer.classList.add("hidden"),(0,et.iJ)(e)):h&&e.config.hide?.power_button||!e.elements.buttonsContainer.classList.contains("hidden")||(e.elements.buttonsContainer.classList.remove("hidden"),(0,et.iJ)(e)),c||"none"===e.elements.powerButton.style.display?c&&e.elements.powerButton.classList.contains("hidden")&&e.elements.powerButton.classList.remove("hidden"):e.elements.powerButton.classList.add("hidden"),d||"none"===e.elements.previousButton.style.display?d&&e.elements.previousButton.classList.contains("hidden")&&e.elements.previousButton.classList.remove("hidden"):e.elements.previousButton.classList.add("hidden"),u||"none"===e.elements.nextButton.style.display?u&&e.elements.nextButton.classList.contains("hidden")&&e.elements.nextButton.classList.remove("hidden"):e.elements.nextButton.classList.add("hidden"),p||"none"===e.elements.volumeButton.style.display?p&&e.elements.volumeButton.classList.contains("hidden")&&e.elements.volumeButton.classList.remove("hidden"):e.elements.volumeButton.classList.add("hidden"),b||"none"===e.elements.playPauseButton.style.display?b&&e.elements.playPauseButton.classList.contains("hidden")&&e.elements.playPauseButton.classList.remove("hidden"):e.elements.playPauseButton.classList.add("hidden"),e.elements.muteButton&&(p&&l.canMute||"none"===e.elements.muteButton.style.display?p&&l.canMute&&e.elements.muteButton.classList.contains("hidden")&&e.elements.muteButton.classList.remove("hidden"):e.elements.muteButton.classList.add("hidden")),function(e){let t=50,n=146;e.content.classList.contains("large")&&(t=58,n=160);const o=(0,s.Gu)(e),i="off"!==o&&"unknown"!==o;(e.config.hide?.play_pause_button||!e.editor&&!i)&&(e.content.classList.contains("large")?n-=42:n-=36),e.elements.cardWrapper.style.setProperty("--volume-slider-left-offset",`${t}px`),e.elements.cardWrapper.style.setProperty("--volume-slider-width-calc",`calc(100% - ${n}px)`)}(e)}(e)},select:function(e){e.cardType,"select"!==e.cardType&&(function(e){try{const t=e.config?.button_action||{};e.config.button_action={...t,tap_action:{action:"none"}}}catch(e){}(0,it.N0)(e,{type:"select",styles:".bubble-container {\n overflow: inherit;\n transition: border 0.3s ease;\n}\n\n.bubble-background {\n cursor: pointer;\n}\n\n.with-bottom-buttons .bubble-dropdown-container {\n display: initial !important;\n}",withFeedback:!0,withSubButtons:!0,withIconActions:!0,buttonActions:!0}).mainContainer.classList.add("bubble-select-card-container"),e.cardType="select"}(e),(0,Ct.Fi)(e),(0,Ct.XO)(e)),(0,$t.O)(e,e.elements,e.config.entity,e.config),(0,et.zQ)(e),(0,et.wd)(e),(0,et.m9)(e),(0,et.Uk)(e),(0,xe.Kr)(e),function(e){(0,s.JK)(e),Ue(e)}(e)},climate:function(e){"climate"!==e.cardType&&function(e){const t="climate",n=(0,it.N0)(e,{type:t,styles:".bubble-temperature-container, .bubble-low-temp-container, .bubble-high-temp-container {\n display: inline-flex;\n position: relative;\n font-size: 12px;\n white-space: nowrap;\n justify-content: center;\n align-items: center;\n width: auto;\n height: 36px;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n background-color: var(--bubble-climate-button-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background))));\n}\n\n.bubble-low-temp-container {\n color: var(--state-climate-heat-color, var(--state-climate-active-color, var(--state-active-color)));\n}\n\n.bubble-high-temp-container {\n color: var(--state-climate-cool-color, var(--state-climate-active-color, var(--state-active-color)));\n}\n\n.bubble-target-temperature-container {\n display: flex;\n gap: 10px;\n}\n\n.bubble-climate-minus-button,\n.bubble-climate-plus-button {\n display: flex;\n position: relative;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 34px;\n height: 34px;\n margin: 2px;\n vertical-align: middle;\n font-size: 18px;\n color: var(--primary-text-color);\n cursor: pointer;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, calc(var(--row-height,56px)/2)));\n}\n\n.bubble-climate-minus-button-icon,\n.bubble-climate-plus-button-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n --mdc-icon-size: 16px;\n}\n\n.bubble-climate-temp-display {\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n white-space: nowrap;\n padding: 0 4px;\n box-sizing: border-box;\n}\n\n@keyframes tap-warning {\n 10%, 90% { transform: translateX(-1px); }\n 20%, 80% { transform: translateX(1px); }\n 30%, 50%, 70% { transform: translateX(-2px); }\n 40%, 60% { transform: translateX(2px); }\n}\n\n/* Full width styles for climate buttons when in bottom position */\n\n.full-width > .bubble-temperature-container,\n.full-width > .bubble-target-temperature-container,\n.full-width .bubble-low-temp-container,\n.full-width .bubble-high-temp-container {\n background-color: transparent;\n gap: 8px;\n flex: 1;\n}\n\n.full-width > .bubble-target-temperature-container {\n display: flex;\n}\n\n.full-width .bubble-climate-minus-button,\n.full-width .bubble-climate-plus-button {\n flex: 1;\n width: 36px;\n height: 36px;\n margin: 0;\n background-color: var(--bubble-main-buttons-background-color, var(--bubble-sub-button-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background))))));\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 18px));\n}\n\n.full-width .bubble-climate-minus-button-icon,\n.full-width .bubble-climate-plus-button-icon {\n --mdc-icon-size: 20px;\n}\n\n.full-width .bubble-climate-temp-display {\n flex: 1;\n height: 36px;\n background-color: var(--bubble-main-buttons-background-color, var(--bubble-sub-button-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background))))));\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 18px));\n padding: 0;\n}",withSubButtons:!0,iconActions:!0,buttonActions:!0});function o(t,o,a){const r=(0,gt.N$)(e,a),l=(0,s.n)("div","bubble-climate-minus-button"),c=(0,s.n)("div","bubble-climate-plus-button"),d=(0,s.n)("ha-icon","bubble-climate-minus-button-icon");d.setAttribute("icon","mdi:minus"),l.appendChild(d),l.haRipple=(0,s.n)("ha-ripple"),l.appendChild(l.haRipple),(0,i.pd)(l);const u=(0,s.n)("ha-icon","bubble-climate-plus-button-icon");let p,b;u.setAttribute("icon","mdi:plus"),c.appendChild(u),c.haRipple=(0,s.n)("ha-ripple"),c.appendChild(c.haRipple),(0,i.pd)(c),"temperature"===o?(n.tempDisplay=(0,s.n)("div","bubble-temperature-display bubble-climate-temp-display"),p=n.tempDisplay):"target_temp_low"===o?(n.lowTempDisplay=(0,s.n)("div","bubble-low-temperature-display bubble-climate-temp-display"),p=n.lowTempDisplay):"target_temp_high"===o&&(n.highTempDisplay=(0,s.n)("div","bubble-high-temperature-display bubble-climate-temp-display"),p=n.highTempDisplay),t.appendChild(l),t.appendChild(p),t.appendChild(c);let h=parseFloat((0,s.D$)(e,o))||0,m=h;function g(){const t=parseFloat((0,s.D$)(e,o))||0;t!==m&&(h=t,m=t)}function f(){g();const t={entity_id:e.config.entity};"target_temp_low"===o?(t.target_temp_low=h,t.target_temp_high=(0,s.D$)(e,"target_temp_high")):"target_temp_high"===o?(t.target_temp_high=h,t.target_temp_low=(0,s.D$)(e,"target_temp_low")):t[o]=h,e._hass.callService("climate","set_temperature",t)}function y(t){g();const i=e._hass.states[e.config.entity],l=e.config.min_temp??i?.attributes?.min_temp??0,c=e.config.max_temp??i?.attributes?.max_temp??1e3;let d=parseFloat((h+t).toFixed(r));if(d=Math.min(c,Math.max(l,d)),dc&&(d=c),d!==h)h=d,function(t){"temperature"===o?n.tempDisplay.innerText=(0,gt.cH)(t,e,a):"target_temp_low"===o?n.lowTempDisplay.innerText=(0,gt.cH)(t,e,a):"target_temp_high"===o&&(n.highTempDisplay.innerText=(0,gt.cH)(t,e,a))}(h),clearTimeout(b),b=setTimeout(f,700);else{(0,s.jp)("failure");const t=e.elements.mainContainer;t.style.animation="tap-warning 0.4s cubic-bezier(.36,.07,.19,.97) both",setTimeout(()=>{t.style.animation=""},500)}}l.addEventListener("click",()=>y(-a)),c.addEventListener("click",()=>y(a))}n.temperatureContainer=(0,s.n)("div","bubble-temperature-container"),n.targetTemperatureContainer=(0,s.n)("div","bubble-target-temperature-container"),n.background.classList.add("bubble-color-background"),n.buttonsContainer.append(n.temperatureContainer,n.targetTemperatureContainer);const a=e._hass.states[e.config.entity],r="°C"===e._hass.config.unit_system.temperature,l=e.config.step??(a.attributes.target_temp_step?a.attributes.target_temp_step:r?.5:1);o(n.temperatureContainer,"temperature",l),n.lowTempContainer=(0,s.n)("div","bubble-low-temp-container"),o(n.lowTempContainer,"target_temp_low",l),n.targetTemperatureContainer.appendChild(n.lowTempContainer),n.highTempContainer=(0,s.n)("div","bubble-high-temp-container"),o(n.highTempContainer,"target_temp_high",l),n.targetTemperatureContainer.appendChild(n.highTempContainer),e.cardType=t}(e),(0,et.zQ)(e),(0,et.m9)(e),(0,et.wd)(e),(0,et.Uk)(e),function(e){const t=(0,s.D$)(e,"temperature"),n=(0,s.Gu)(e);(0,gt.N$)(e),e.config.hide_temperature||"unavailable"===n||""===t||void 0===t?e.elements.temperatureContainer?.classList.add("hidden"):e.elements.temperatureContainer?.classList.remove("hidden"),t!==e.previousTemp&&(e.previousTemp=t,e.elements.tempDisplay&&""!==t&&void 0!==t&&(e.elements.tempDisplay.innerText=(0,gt.cH)(t,e)))}(e),function(e){const t=(0,s.D$)(e,"target_temp_low"),n=e.config.hide_target_temp_low,o=(0,s.Gu)(e);(0,gt.N$)(e),"unavailable"===o||""===t||void 0===t||n?(e.elements.targetTemperatureContainer?.classList.add("hidden"),e.elements.lowTempContainer?.classList.add("hidden")):(e.elements.targetTemperatureContainer?.classList.remove("hidden"),e.elements.lowTempContainer?.classList.remove("hidden")),t!==e.previousTargetTempLow&&(e.previousTargetTempLow=t,e.elements.lowTempDisplay&&""!==t&&void 0!==t&&(e.elements.lowTempDisplay.innerText=(0,gt.cH)(t,e)))}(e),function(e){const t=(0,s.D$)(e,"target_temp_high"),n=e.config.hide_target_temp_high,o=(0,s.Gu)(e);(0,gt.N$)(e),"unavailable"===o||""===t||void 0===t||n?e.elements.highTempContainer?.classList.add("hidden"):(e.elements.highTempContainer?.classList.remove("hidden"),e.elements.targetTemperatureContainer?.classList.remove("hidden")),t!==e.previousTargetTempHigh&&(e.previousTargetTempHigh=t,e.elements.highTempDisplay&&""!==t&&void 0!==t&&(e.elements.highTempDisplay.innerText=(0,gt.cH)(t,e)))}(e),(0,xe.Kr)(e),function(e){(0,s.JK)(e),Ue(e);const t=(0,s.Gu)(e);e.previousState!==t&&(e.previousState=t,e.elements.background.style.backgroundColor=`var(--bubble-climate-background-color, ${(0,gt.R)(e)})`),e.config.card_layout,e.elements.hvacModeDropdown}(e)}};class At extends HTMLElement{editor=!1;isConnected=!1;_editorUpdateTimeout=null;connectedCallback(){this.isConnected=!0,function(e){if(!e.content){let t=e.shadowRoot||e.attachShadow({mode:"open"}),n=document.createElement("ha-card");n.style.cssText="background: none; border: none; box-shadow: none; border-radius: 16px;";let o=document.createElement("div");o.className="card-content",o.style.padding="0",n.appendChild(o),t.appendChild(n),e.card=n,e.content=o}}(this),(0,a.nO)(this),(0,r.$i)(),this._hass&&this.updateBubbleCard()}disconnectedCallback(){this.isConnected=!1,(0,i.Xs)();try{this.content&&(0,s.Iz)(this.content)}catch(e){}try{this.context&&(0,s.bE)(this.context)}catch(e){}try{this._moduleChangeHandler&&(window.removeEventListener("bubble-card-modules-changed",this._moduleChangeHandler),window.removeEventListener("bubble-card-module-updated",this._moduleChangeHandler),document.removeEventListener("yaml-modules-updated",this._moduleChangeHandler),this._moduleChangeHandler=null,this._moduleChangeListenerAdded=!1)}catch(e){}clearTimeout(this._editorUpdateTimeout)}get detectedEditor(){return!!this.editor&&"hui-dialog-edit-card"===window.history?.state?.dialog}set editMode(e){this.editor!==e&&(this.editor=e,["pop-up","horizontal-buttons-stack","sub-buttons"].includes(this.config.card_type)&&this.updateBubbleCard())}set hass(e){this._hass=e,this.updateBubbleCard()}updateBubbleCard(){if(!this.isConnected&&"pop-up"!==this.config.card_type)return;const e=this.config.card_type;St[e]&&(St[e](this),this._notifyEditorContext())}setConfig(e){if(e.error)throw new Error(e.error);const t={...e};if(!t.card_type)throw new Error("You need to define a card type");if(void 0!==t.grid_options?.rows&&(t.rows=t.grid_options.rows),"pop-up"===t.card_type){if(t.hash&&t.button_type&&"name"!==t.button_type&&!t.entity&&t.modules)throw new Error("You need to define an entity")}else if("horizontal-buttons-stack"===t.card_type){const e={};for(const n in t)if(/^\d+_icon$/.test(n)){const o=n.replace("_icon","_link");if(void 0===t[o])throw new Error("You need to define "+o);if(e[t[o]])throw new Error("You can't use "+t[o]+" twice");e[t[o]]=!0}}else if(["button","cover","climate","select","media-player"].includes(t.card_type)){if(!t.entity&&"name"!==t.button_type)throw new Error("You need to define an entity")}else if("calendar"===t.card_type&&!t.entities)throw new Error("You need to define an entity list");if("select"===t.card_type&&t.entity&&!t.select_attribute&&!t.entity.startsWith("input_select")&&!t.entity.startsWith("select"))throw new Error('"Select menu (from attributes)" missing');this.config=t}getCardSize(){switch(this.config.card_type){case"pop-up":return-1e5;case"button":case"sub-buttons":case"separator":case"empty-column":case"horizontal-buttons-stack":case"calendar":case"media-player":case"select":case"climate":return 1;case"cover":return 2}}getGridOptions(){const e=this.config.columns;let t={columns:e?3*e:12,rows:this.config.rows??"auto"};return"horizontal-buttons-stack"===this.config.card_type?t.rows=1.3:"separator"===this.config.card_type&&void 0===this.config.grid_options?.rows&&(t.rows=this.config.rows?"auto":.8),t}getLayoutOptions(){let e=1;"pop-up"===this.config.card_type?e=0:"horizontal-buttons-stack"===this.config.card_type?e=1:"cover"===this.config.card_type&&(e=2);let t=4;return"pop-up"===this.config.card_type?t=0:"horizontal-buttons-stack"===this.config.card_type&&(t=4),{grid_columns:this.config.columns??t,grid_rows:this.config.rows??e}}static getConfigElement(){return document.createElement("bubble-card-editor")}_notifyEditorContext(){try{if(!this.config||!this.card)return;const e={context:this,card:this.card,config:this.config,card_type:this.config.card_type,entity:this.config.entity,hash:this.config.hash,isEditor:this.detectedEditor,editMode:this.editor};window.dispatchEvent(new CustomEvent("bubble-card-context",{detail:e}))}catch(e){}}}customElements.define("bubble-card",At),window.customCards=window.customCards||[],window.customCards.push({type:"bubble-card",name:"Bubble Card",preview:!1,description:"A minimalist card collection with a nice pop-up touch.",documentationURL:"https://github.com/Clooos/Bubble-Card/"}),console.info(`%c Bubble Card %c ${o} `,"background-color: #555;color: #fff;padding: 3px 2px 3px 3px;border-radius: 14px 0 0 14px;font-family: DejaVu Sans,Verdana,Geneva,sans-serif;text-shadow: 0 1px 0 rgba(1, 1, 1, 0.3)","background-color: #506eac;color: #fff;padding: 3px 3px 3px 2px;border-radius: 0 14px 14px 0;font-family: DejaVu Sans,Verdana,Geneva,sans-serif;text-shadow: 0 1px 0 rgba(1, 1, 1, 0.3)")})();