iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
7 lines • 35.9 kB
JavaScript
export const __rspack_esm_id=88020;export const __rspack_esm_ids=[88020];export const __webpack_modules__={51857(e,i,t){t.a(e,async function(e,i){try{var a=t(62826),o=(t(68825),t(5124)),s=t(22441),r=t(29823),n=(t(70947),t(26300)),d=(t(67094),t(65063)),c=t(14503),l=t(82360),h=t(75196),p=t(75244),g=e([r,n]);[r,n]=g.then?(await g)():g;const v="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",u="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",b="M21 11H3V9H21V11M21 13H3V15H21V13Z",m="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",f="M16,8H14V11H11V13H14V16H16V13H19V11H16M2,12C2,9.21 3.64,6.8 6,5.68V3.5C2.5,4.76 0,8.09 0,12C0,15.91 2.5,19.24 6,20.5V18.32C3.64,17.2 2,14.79 2,12M15,3C10.04,3 6,7.04 6,12C6,16.96 10.04,21 15,21C19.96,21 24,16.96 24,12C24,7.04 19.96,3 15,3M15,19C11.14,19 8,15.86 8,12C8,8.14 11.14,5 15,5C18.86,5 22,8.14 22,12C22,15.86 18.86,19 15,19Z";class x extends o.WF{render(){return o.qy` <div class="section-header"> <div class="section-actions"> <ha-svg-icon aria-hidden="true" class="handle" .path="${b}"></ha-svg-icon> <ha-dropdown placement="bottom-end" -select="${this._handleDropdownSelect}"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.common.menu")}" .path="${u}"></ha-icon-button> <ha-dropdown-item value="edit"> <ha-svg-icon slot="icon" .path="${m}"></ha-svg-icon> ${this.hass.localize("ui.common.edit")} </ha-dropdown-item> <ha-dropdown-item value="duplicate"> <ha-svg-icon slot="icon" .path="${f}"></ha-svg-icon> ${this.hass.localize("ui.common.duplicate")} </ha-dropdown-item> <wa-divider></wa-divider> <ha-dropdown-item value="delete" variant="danger"> <ha-svg-icon slot="icon" .path="${v}"></ha-svg-icon> ${this.hass.localize("ui.common.delete")} </ha-dropdown-item> </ha-dropdown> </div> </div> <div class="section-wrapper"> <slot></slot> </div> `}_handleDropdownSelect(e){const i=e.detail?.item?.value;if(i)switch(i){case"edit":this._editSection();break;case"duplicate":this._duplicateSection();break;case"delete":this._deleteSection()}}async _editSection(){(0,p.P)(this,{lovelace:this.lovelace,lovelaceConfig:this.lovelace.config,saveConfig:e=>{this.lovelace.saveConfig(e)},viewIndex:this.viewIndex,sectionIndex:this.index})}_duplicateSection(){const e=(0,l.pk)(this.lovelace.config,this.viewIndex,this.index);this.lovelace.saveConfig(e)}async _deleteSection(){const e=[this.viewIndex,this.index],i=(0,h.ys)(this.lovelace.config,e);if("cards"in i&&i.cards?.length){if(!await(0,d.dk)(this,{title:this.hass.localize("ui.panel.lovelace.editor.delete_section.title"),text:this.hass.localize("ui.panel.lovelace.editor.delete_section.text"),confirmText:this.hass.localize("ui.common.delete"),destructive:!0}))return}const t=(0,l.tA)(this.lovelace.config,this.viewIndex,this.index);this.lovelace.saveConfig(t)}static get styles(){return[c.RF,o.AH`.section-header{position:relative;height:34px;display:flex;flex-direction:column;justify-content:flex-end}.section-actions{position:absolute;height:36px;bottom:-2px;right:0;inset-inline-end:0;inset-inline-start:initial;opacity:1;display:flex;align-items:center;justify-content:center;transition:opacity .2s ease-in-out;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border-bottom-left-radius:0px;border-bottom-right-radius:0px;background:var(--secondary-background-color);--ha-icon-button-size:36px;--mdc-icon-size:20px;color:var(--primary-text-color)}.handle{cursor:grab;padding:8px}.section-wrapper{padding:8px;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border-start-end-radius:0;border:2px dashed var(--divider-color);min-height:var(--row-height)}`]}}(0,a.Cg)([(0,s.MZ)({attribute:!1})],x.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],x.prototype,"lovelace",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],x.prototype,"index",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],x.prototype,"viewIndex",void 0),x=(0,a.Cg)([(0,s.EM)("hui-section-edit-mode")],x),i()}catch(e){i(e)}})},75244(e,i,t){t.d(i,{P:()=>s});var a=t(1087);const o=()=>Promise.all([t.e(66432),t.e(62612)]).then(t.bind(t,70559)),s=(e,i)=>{(0,a.r)(e,"show-dialog",{dialogTag:"hui-dialog-edit-section",dialogImport:o,dialogParams:i})}},20728(e,i,t){t.d(i,{U:()=>o});var a=t(1087);const o=(e,i)=>{(0,a.r)(e,"show-dialog",{dialogTag:"hui-dialog-edit-view-header",dialogImport:()=>t.e(2540).then(t.bind(t,44423)),dialogParams:i})}},30981(e,i,t){var a=t(62826),o=t(5124),s=t(22441),r=t(42372),n=t(78870),d=t(28918);class c extends o.WF{render(){return o.s6}willUpdate(e){if(super.willUpdate(e),e.has("background")){const e=(0,d.o)(this.background);if(e){const i=e.color?(0,n.MP)(e.color):null;this.style.setProperty("--section-background-color",i);const t=void 0!==e.opacity?`${e.opacity}%`:null;this.style.setProperty("--section-background-opacity",t)}}if(!this.hass)return;const i=e.get("hass");!e.has("theme")&&i&&this.hass.themes===i.themes&&this.hass.selectedTheme===i.selectedTheme||(0,r.Q)(this,this.hass.themes,this.theme)}}c.styles=o.AH`:host{position:absolute;inset:0;border-radius:inherit;background-color:var(--section-background-color,var(--ha-section-background-color,var(--secondary-background-color)));opacity:var(
--section-background-opacity,
${(0,o.iz)(50)}%
);z-index:0;pointer-events:none}`,(0,a.Cg)([(0,s.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],c.prototype,"background",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],c.prototype,"theme",void 0),c=(0,a.Cg)([(0,s.EM)("hui-section-background")],c)},31481(e,i,t){t.d(i,{Y:()=>a});const a=(e,i)=>({type:"grid",cards:i?[{type:"heading",heading:e("ui.panel.lovelace.editor.section.default_section_title")}]:[]})},18911(e,i,t){t.a(e,async function(e,a){try{t.r(i),t.d(i,{DEFAULT_MAX_COLUMNS:()=>H,SectionsView:()=>z});t(18111),t(22489),t(61701),t(18237),t(88454),t(29452);var o=t(62826),s=t(88696),r=t(35211),n=t(5124),d=t(22441),c=t(6412),l=t(75751),h=t(89784),p=t(22786),g=t(63004),v=t(26300),u=(t(54276),t(85938),t(67094),t(29478)),b=t(80173),m=t(51857),f=t(82360),x=t(75196),w=(t(30981),t(31481)),y=(t(66048),t(98440)),_=t(16401),C=t(94629),$=e([v,b,m,y,_]);[v,b,m,y,_]=$.then?(await $)():$;const k="M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z",M="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z",H=4,V=e=>parseInt(e.replace("px",""));class z extends n.WF{setConfig(e){this._config=e}_getSectionKey(e){return this._sectionConfigKeys.has(e)||this._sectionConfigKeys.set(e,Math.random().toString()),this._sectionConfigKeys.get(e)}_computeSectionsCount(){this._sectionColumnCount=this.sections.filter(e=>!e.hidden).map(e=>e.config.column_span??1).reduce((e,i)=>e+i,0)}connectedCallback(){super.connectedCallback(),this.addEventListener("section-visibility-changed",this._sectionVisibilityChanged),this._sidebarTabActive=Boolean(window.history.state?.sidebar)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("section-visibility-changed",this._sectionVisibilityChanged)}willUpdate(e){e.has("sections")&&this._computeSectionsCount(),this._updateMaxColumnCount()}_updateMaxColumnCount(){const e=this._columnsController.value??1;e!==this._maxColumns&&(this._maxColumns=e,this._maxColumnsProvider.setValue(e))}render(){if(!this.lovelace)return n.s6;const e=this.sections,i=this.lovelace.editMode,t=this._config?.sidebar&&(this._sidebarVisible||i),a=this._sectionColumnCount+(i?1:0)+(t?1:0),o=Math.max(Math.min(this._maxColumns,a),1),s=t&&!this.narrow?Math.max(1,o-1):o,r=(0,C.z)(e,s);return n.qy` <div class="wrapper ${(0,c.H)({"top-margin":Boolean(this._config?.top_margin),"has-sidebar":Boolean(t),narrow:this.narrow})}" style="${(0,h.W)({"--column-count":o,"--content-column-count":s})}"> <hui-view-header .hass="${this.hass}" .badges="${this.badges}" .lovelace="${this.lovelace}" .viewIndex="${this.index}" .config="${this._config?.header}"></hui-view-header> ${this.narrow&&t?n.qy` <div class="mobile-tabs"> <ha-control-select .value="${this._sidebarTabActive?"sidebar":"content"}" -changed="${this._viewChanged}" .options="${[{value:"content",label:this._config.sidebar.content_label},{value:"sidebar",label:this._config.sidebar.sidebar_label}]}"> </ha-control-select> </div> `:n.s6} <div class="container"> <ha-sortable .disabled="${!i}" -moved="${this._sectionMoved}" group="section" handle-selector=".handle" draggable-selector=".section" .rollback="${!1}"> <div class="content ${(0,c.H)({dense:Boolean(this._config?.dense_section_placement),"mobile-hidden":this.narrow&&this._sidebarTabActive})}"> ${(0,l.u)(e,e=>this._getSectionKey(e),(e,t)=>{const a=Math.min(e.config.column_span||1,s),o=e.config.row_span||1;return n.qy` <div class="section" style="${(0,h.W)({"--column-span":a,"--row-span":o})}"> ${i?n.qy` <hui-section-edit-mode .hass="${this.hass}" .lovelace="${this.lovelace}" .index="${t}" .viewIndex="${this.index}"> ${this._renderSection(e,r.has(t))} </hui-section-edit-mode> `:this._renderSection(e,r.has(t))} </div> `})} ${i?n.qy` <ha-sortable group="card" -added="${this._handleCardAdded}" draggable-selector=".card" .rollback="${!1}"> <div class="create-section-container"> <div class="drop-helper" aria-hidden="true"> <p> ${this.hass.localize("ui.panel.lovelace.editor.section.drop_card_create_section")} </p> </div> <button class="create-section" ="${this._createSection}" aria-label="${this.hass.localize("ui.panel.lovelace.editor.section.create_section")}" .title="${this.hass.localize("ui.panel.lovelace.editor.section.create_section")}"> <ha-ripple></ha-ripple> <ha-svg-icon .path="${M}"></ha-svg-icon> </button> </div> </ha-sortable> `:n.s6} </div> </ha-sortable> ${this._config?.sidebar?n.qy` <hui-view-sidebar class="${(0,c.H)({"mobile-hidden":!t||this.narrow&&!this._sidebarTabActive})}" .hass="${this.hass}" .badges="${this.badges}" .lovelace="${this.lovelace}" .viewIndex="${this.index}" .config="${this._config.sidebar}" -visibility-changed="${this._handleSidebarVisibilityChanged}"></hui-view-sidebar> `:n.s6} </div> <hui-view-footer .hass="${this.hass}" .lovelace="${this.lovelace}" .viewIndex="${this.index}" .config="${this._config?.footer}"></hui-view-footer> <div class="imported-cards-section"> ${i&&this._config?.cards?.length?n.qy` <div class="section imported-cards"> <div class="imported-card-header"> <p class="title"> <ha-svg-icon .path="${k}"></ha-svg-icon> ${this.hass.localize("ui.panel.lovelace.editor.section.imported_cards_title")} </p> <p class="subtitle"> ${this.hass.localize("ui.panel.lovelace.editor.section.imported_cards_description")} </p> </div> <hui-section .lovelace="${this.lovelace}" .hass="${this.hass}" .config="${this._importedCardSectionConfig(this._config.cards)}" .viewIndex="${this.index}" preview import-only></hui-section> </div> `:n.s6} </div> </div> `}_handleCardAdded(e){const{data:i}=e.detail,t=i,{cardIndex:a}=(0,x.gO)(t),o=(0,x.S2)(t),s=(0,x.jW)("cards",this.lovelace.config,o)[a],r=(0,f.Bn)(this.lovelace.config,this.index,(0,w.Y)(this.hass.localize,"heading"!==s.type)),n=r.views[this.index],d=[this.index,n.sections.length-1,1],c=(0,f.sQ)(r,t,d);this.lovelace.saveConfig(c)}_renderSection(e,i){const t=void 0!==e.config.background;return n.qy` <div class="section-container ${(0,c.H)({"has-background":t,"align-background":i})}"> ${t?n.qy`<hui-section-background .hass="${this.hass}" .background="${e.config.background}" .theme="${e.config.theme}"></hui-section-background>`:n.s6} ${e} </div> `}_createSection(){const e=(0,f.Bn)(this.lovelace.config,this.index,(0,w.Y)(this.hass.localize,!0));this.lovelace.saveConfig(e)}_sectionMoved(e){e.stopPropagation();const{oldIndex:i,newIndex:t}=e.detail,a=(0,f.hB)(this.lovelace.config,[this.index,i],[this.index,t]);this.lovelace.saveConfig(a)}_viewChanged(e){"sidebar"===e.detail.value!==this._sidebarTabActive&&this._toggleView()}_toggleView(){this._sidebarTabActive?this._sidebarScrollTop=window.scrollY:this._contentScrollTop=window.scrollY,this._sidebarTabActive=!this._sidebarTabActive,window.history.replaceState({...window.history.state,sidebar:this._sidebarTabActive},""),this.updateComplete.then(()=>{const e=this._sidebarTabActive?this._sidebarScrollTop:this._contentScrollTop;window.scrollTo(0,e)})}constructor(...e){super(...e),this.isStrategy=!1,this.narrow=!1,this.sections=[],this.cards=[],this.badges=[],this._sectionColumnCount=0,this._maxColumns=0,this._maxColumnsProvider=new r.DT(this,{context:u.V}),this._dragging=!1,this._sidebarTabActive=!1,this._sidebarVisible=!0,this._contentScrollTop=0,this._sidebarScrollTop=0,this._columnsController=new s.P(this,{callback:e=>{const i=e[0]?.contentRect.width;if(!i)return 1;const t=getComputedStyle(this),a=this.shadowRoot.querySelector(".container"),o=getComputedStyle(a),s=V(o.paddingLeft)+V(o.paddingRight),r=V(t.getPropertyValue("--column-min-width")),n=V(o.columnGap),d=Math.floor((i-s+n)/(r+n)),c=this._config?.max_columns??H;return(0,g.q)(d,1,c)}}),this._sectionConfigKeys=new WeakMap,this._sectionVisibilityChanged=()=>{this._computeSectionsCount()},this._importedCardSectionConfig=(0,p.A)(e=>({type:"grid",cards:e})),this._handleSidebarVisibilityChanged=e=>{this._sidebarVisible=e.detail.visible,e.detail.visible||(this._sidebarTabActive=!1)}}}z.styles=n.AH`:host{--row-height:var(--ha-view-sections-row-height, 56px);--row-gap:var(--ha-view-sections-row-gap, 24px);--column-gap:var(--ha-view-sections-column-gap, 32px);--column-max-width:var(--ha-view-sections-column-max-width, 500px);--column-min-width:var(--ha-view-sections-column-min-width, 320px);--narrow-column-gap:var(--ha-view-sections-narrow-column-gap, 8px);--top-margin:var(--ha-view-sections-extra-top-margin, 80px);display:block;flex:1} (max-width:600px){:host{--column-gap:var(--narrow-column-gap)}}.wrapper{display:flex;flex-direction:column;min-height:100%;padding:0 var(--column-gap);box-sizing:content-box;margin:0 auto;max-width:calc(var(--column-count) * var(--column-max-width) + (var(--column-count) - 1) * var(--column-gap))}.wrapper.top-margin{margin-top:var(--top-margin)}.section{border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));grid-column:span var(--column-span);grid-row:span var(--row-span)}.section:has(hui-section[hidden]){display:none}.section-container{position:relative}.section-container.has-background{padding:var(--ha-space-2);border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl))}.section-container.align-background{margin-top:var(--ha-space-2);margin-bottom:var(--ha-space-2)}.container{display:grid;grid-template-columns:[content-start] repeat(var(--content-column-count),1fr);gap:var(--row-gap) var(--column-gap);padding:var(--row-gap) 0;align-items:flex-start;flex:1 0 auto}.wrapper.has-sidebar .container{grid-template-columns:[content-start] repeat(var(--content-column-count),1fr) [sidebar-start] 1fr}.wrapper.narrow.has-sidebar .container{grid-template-columns:1fr}hui-view-sidebar{grid-column:sidebar-start/-1}.wrapper.narrow hui-view-sidebar{grid-column:1/-1;padding-bottom:calc(var(--ha-space-14) + var(--ha-space-3) + var(--safe-area-inset-bottom))}.mobile-hidden{display:none!important}.mobile-tabs{position:fixed;bottom:calc(var(--ha-space-3) + var(--safe-area-inset-bottom));left:50%;transform:translateX(-50%);padding:0;z-index:1}.mobile-tabs ha-control-select{width:max-content;min-width:280px;max-width:90%;--control-select-thickness:var(--ha-space-14);--control-select-border-radius:var(--ha-border-radius-pill);--control-select-background:var(--card-background-color);--control-select-background-opacity:1;--control-select-color:var(--primary-color);--control-select-padding:6px;box-shadow:rgba(0,0,0,.3) 0px 4px 10px 0px}ha-sortable{display:contents}.content{grid-column:content-start/sidebar-start;grid-row:1/-1;display:grid;align-items:start;justify-content:center;grid-template-columns:repeat(var(--content-column-count),1fr);grid-auto-flow:row;gap:var(--row-gap) var(--column-gap)}.wrapper.narrow .content{grid-column:1/-1}.wrapper.narrow.has-sidebar .content{padding-bottom:calc(var(--ha-space-14) + var(--ha-space-3) + var(--safe-area-inset-bottom))}.content.dense{grid-auto-flow:row dense}.create-section-container{position:relative;display:flex;flex-direction:column;margin-top:36px}.create-section-container .card{display:none}.create-section-container:has(.card) .drop-helper{display:flex}.create-section-container:has(.card) .create-section{display:none}.drop-helper{display:none;flex-direction:column;align-items:center;justify-content:center;position:relative;outline:0;background:0 0;cursor:pointer;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border:2px dashed var(--primary-color);height:calc(var(--row-height) + 2 * (var(--row-gap) + 2px));padding:8px;box-sizing:border-box;width:100%;--ha-ripple-color:var(--primary-color);--ha-ripple-hover-opacity:0.04;--ha-ripple-pressed-opacity:0.12}.drop-helper p{color:var(--primary-text-color);font-size:var(--ha-font-size-l);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal);text-align:center}.create-section{display:block;position:relative;outline:0;background:0 0;cursor:pointer;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border:2px dashed var(--primary-color);order:1;height:calc(var(--row-height) + 2 * (var(--row-gap) + 2px));padding:8px;box-sizing:border-box;width:100%;--ha-ripple-color:var(--primary-color);--ha-ripple-hover-opacity:0.04;--ha-ripple-pressed-opacity:0.12}.create-section:focus{border:2px solid var(--primary-color)}.sortable-ghost{border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl))}hui-view-header{display:block;padding-top:var(--row-gap)}hui-view-footer{display:block}.imported-cards{--column-span:var(--column-count);--row-span:1;order:2}.imported-card-header{margin-top:36px;padding:32px 0 16px 0;border-top:4px dotted var(--divider-color)}.imported-card-header .title{margin:0;color:var(--primary-text-color);font-size:var(--ha-font-size-l);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal);--mdc-icon-size:18px;display:flex;align-items:center;gap:var(--ha-space-3);margin-bottom:8px}.imported-card-header .subtitle{margin:0;color:var(--secondary-text-color);font-size:var(--ha-font-size-m);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed)}`,(0,o.Cg)([(0,d.MZ)({attribute:!1})],z.prototype,"hass",void 0),(0,o.Cg)([(0,d.MZ)({attribute:!1})],z.prototype,"lovelace",void 0),(0,o.Cg)([(0,d.MZ)({type:Number})],z.prototype,"index",void 0),(0,o.Cg)([(0,d.MZ)({attribute:!1})],z.prototype,"isStrategy",void 0),(0,o.Cg)([(0,d.MZ)({type:Boolean})],z.prototype,"narrow",void 0),(0,o.Cg)([(0,d.MZ)({attribute:!1})],z.prototype,"sections",void 0),(0,o.Cg)([(0,d.MZ)({attribute:!1})],z.prototype,"cards",void 0),(0,o.Cg)([(0,d.MZ)({attribute:!1})],z.prototype,"badges",void 0),(0,o.Cg)([(0,d.wk)()],z.prototype,"_config",void 0),(0,o.Cg)([(0,d.wk)()],z.prototype,"_sectionColumnCount",void 0),(0,o.Cg)([(0,d.wk)()],z.prototype,"_dragging",void 0),(0,o.Cg)([(0,d.wk)()],z.prototype,"_sidebarTabActive",void 0),(0,o.Cg)([(0,d.wk)()],z.prototype,"_sidebarVisible",void 0),z=(0,o.Cg)([(0,d.EM)("hui-sections-view")],z),a()}catch(e){a(e)}})},66048(e,i,t){var a=t(62826),o=t(5124),s=t(22441),r=t(6412),n=t(89784),d=(t(54276),t(67094),t(76760)),c=t(21146),l=t(15950),h=t(82360),p=t(1087);class g extends o.WF{connectedCallback(){super.connectedCallback(),this.addEventListener("card-visibility-changed",this._checkHidden)}willUpdate(e){if(e.has("config"))return this.config?.card?this.card=this._createCardElement(this.config.card):this.card=void 0,void this._checkHidden();this.card&&(e.has("hass")&&(this.card.hass=this.hass),e.has("lovelace")&&(this.card.preview=this.lovelace.editMode)),(e.has("lovelace")||e.has("card"))&&this._checkHidden()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("card-visibility-changed",this._checkHidden)}_checkHidden(){const e=!this.lovelace?.editMode&&(!this.card||this.card.hasAttribute("hidden"));this.toggleAttribute("hidden",e),this.toggleAttribute("sticky",Boolean(this.card))}_createCardElement(e){const i=document.createElement("hui-card");return i.hass=this.hass,i.preview=this.lovelace.editMode,i.layout="grid",i.config=e,i.addEventListener("card-updated",e=>{e.stopPropagation(),this.requestUpdate()}),i.load(),i}_addCard(){(0,c.u)(this,{lovelaceConfig:this.lovelace.config,saveConfig:this.lovelace.saveConfig,path:[this.viewIndex],saveCard:e=>{this._saveFooterConfig({...this.config,card:e})}})}_deleteCard(e){e.stopPropagation();const i={...this.config};delete i.card,this._saveFooterConfig(i)}_configure(){var e,i;e=this,i={config:this.config||{},saveConfig:e=>{this._saveFooterConfig(e)}},(0,p.r)(e,"show-dialog",{dialogTag:"hui-dialog-edit-view-footer",dialogImport:()=>t.e(42364).then(t.bind(t,94039)),dialogParams:i})}_editCard(e){e.stopPropagation();const i=this.config?.card;i&&(0,l.O)(this,{cardConfig:i,lovelaceConfig:this.lovelace.config,saveCardConfig:e=>{this._saveFooterConfig({...this.config,card:e})}})}_saveFooterConfig(e){const i={...this.lovelace.config.views[this.viewIndex],footer:e},t=(0,h.Iq)(this.hass,this.lovelace.config,this.viewIndex,i);this.lovelace.saveConfig(t)}_renderCard(e,i){const t=e.getGridOptions(),{rows:a}=(0,d.Ns)(t);return o.qy` <div class="card ${(0,r.H)({"fit-rows":"number"==typeof a})}" style="${(0,n.W)({"--row-size":"number"==typeof a?String(a):void 0})}"> ${i?o.qy` <hui-card-edit-mode -edit-card="${this._editCard}" -delete-card="${this._deleteCard}" .hass="${this.hass}" .lovelace="${this.lovelace}" .path="${[0]}" no-duplicate no-move> ${e} </hui-card-edit-mode> `:e} </div> `}render(){if(!this.lovelace)return o.s6;const e=Boolean(this.lovelace?.editMode),i=this.card;return e||i?o.qy` <div class="${(0,r.H)({wrapper:!0,"edit-mode":e})}" style="${(0,n.W)({"--footer-max-width":`${this.config?.max_width||600}px`})}"> ${e?o.qy` <div class="actions-container"> <div class="actions"> <ha-icon-button .label="${this.hass.localize("ui.common.edit")}" ="${this._configure}" .path="${"M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"}"></ha-icon-button> </div> </div> `:o.s6} <div class="${(0,r.H)({container:!0,"edit-mode":e})}"> ${i?this._renderCard(i,e):e?o.qy` <button class="add" ="${this._addCard}"> <ha-ripple></ha-ripple> <ha-svg-icon .path="${"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"}"></ha-svg-icon> ${this.hass.localize("ui.panel.lovelace.editor.edit_view_footer.add")} </button> `:o.s6} </div> </div> `:o.s6}}g.styles=o.AH`:host([hidden]){display:none!important}:host([sticky]){position:sticky;bottom:var(--row-gap);z-index:4}.wrapper{padding:var(--ha-space-2) 0;padding-bottom:calc(max(var(--ha-space-2),var(--safe-area-inset-bottom,0px)));box-sizing:content-box;margin:0 auto;max-width:var(--footer-max-width,600px)}.wrapper:not(.edit-mode){--ha-card-box-shadow:var(
--ha-view-footer-box-shadow,
var(--ha-box-shadow-l)
)}.container{--row-height:var(--ha-section-grid-row-height, 56px);--row-gap:var(--ha-section-grid-row-gap, 8px);--column-gap:var(--ha-section-grid-column-gap, 8px);position:relative;display:grid;grid-template-columns:repeat(12,minmax(0,1fr));grid-auto-rows:auto;row-gap:var(--row-gap);column-gap:var(--column-gap)}.container.edit-mode{padding:var(--ha-space-2);border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border:2px dashed var(--divider-color);border-start-end-radius:0}.card{position:relative;grid-column:1/-1;grid-row:span var(--row-size,1);max-height:25vh;max-height:25dvh}.card.fit-rows{height:calc((var(--row-size,1) * (var(--row-height) + var(--row-gap))) - var(--row-gap))}.actions-container{position:relative;height:34px;display:flex;flex-direction:column;justify-content:flex-end}.actions{z-index:1;position:absolute;height:36px;bottom:-2px;right:0;inset-inline-end:0;inset-inline-start:initial;opacity:1;display:flex;align-items:center;justify-content:center;transition:opacity .2s ease-in-out;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border-bottom-left-radius:0px;border-bottom-right-radius:0px;background:var(--secondary-background-color);--ha-icon-button-size:36px;--mdc-icon-size:20px;color:var(--primary-text-color)}.add{grid-column:1/-1;margin:0 auto;position:relative;display:flex;flex-direction:row;align-items:center;justify-content:center;outline:0;gap:var(--ha-space-2);height:36px;padding:6px 20px 6px 20px;box-sizing:border-box;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));background-color:transparent;border-width:2px;border-style:dashed;border-color:var(--primary-color);--mdc-icon-size:18px;cursor:pointer;font-size:var(--ha-font-size-m);color:var(--primary-text-color);--ha-ripple-color:var(--primary-color);--ha-ripple-hover-opacity:0.04;--ha-ripple-pressed-opacity:0.12}.add:focus{border-style:solid}`,(0,a.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"lovelace",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"card",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"config",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"viewIndex",void 0),g=(0,a.Cg)([(0,s.EM)("hui-view-footer")],g)},98440(e,i,t){t.a(e,async function(e,i){try{t(18111),t(81148);var a=t(62826),o=t(5124),s=t(22441),r=t(6412),n=t(36356),d=(t(54276),t(85938),t(67094),t(52667)),c=t(80173),l=t(15950),h=t(82360),p=t(20728),g=e([d,c]);[d,c]=g.then?(await g)():g;const v="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",u="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",b="center",m="bottom",f="wrap";class x extends o.WF{_checkHidden(){const e=!this.card&&!this.lovelace.editMode&&this.badges.every(e=>e.hidden);this.toggleAttribute("hidden",e)}connectedCallback(){super.connectedCallback(),this.addEventListener("badge-visibility-changed",this._badgeVisibilityChanged)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("badge-visibility-changed",this._badgeVisibilityChanged)}willUpdate(e){if((e.has("badges")||e.has("lovelace")||e.has("card"))&&this._checkHidden(),(e.has("config")||e.has("lovelace"))&&(this._dragScrollController.enabled=!this.lovelace.editMode&&"scroll"===this.config?.badges_wrap),e.has("config"))return this.config?.card?this.card=this._createCardElement(this.config.card):this.card=void 0,void this._checkHidden();this.card&&(e.has("hass")&&(this.card.hass=this.hass),e.has("lovelace")&&(this.card.preview=this.lovelace.editMode))}_createCardElement(e){const i=document.createElement("hui-card");return i.hass=this.hass,i.preview=this.lovelace.editMode,i.config=e,i.load(),i}_addCard(){const e={type:"markdown",text_only:!0,content:this.hass.localize("ui.panel.lovelace.editor.edit_view_header.default_title",{user:"{{ user }}"})};(0,l.O)(this,{cardConfig:e,lovelaceConfig:this.lovelace.config,saveCardConfig:e=>{const i={...this.config};i.card=e,this._saveHeaderConfig(i)},isNew:!0})}_deleteCard(e){e.stopPropagation();const i={...this.config};delete i.card,this._saveHeaderConfig(i)}_editCard(e){e.stopPropagation();const i=this.config.card;i&&(0,l.O)(this,{cardConfig:i,lovelaceConfig:this.lovelace.config,saveCardConfig:e=>{const i={...this.config};i.card=e,this._saveHeaderConfig(i)}})}_saveHeaderConfig(e){const i={...this.lovelace.config.views[this.viewIndex]};i.header=e;const t=(0,h.Iq)(this.hass,this.lovelace.config,this.viewIndex,i);this.lovelace.saveConfig(t)}render(){if(!this.lovelace)return o.s6;const e=Boolean(this.lovelace?.editMode),i=this.card,t=this.config?.layout??b,a=this.config?.badges_position??m,s=this.config?.badges_wrap??f,n=this._dragScrollController.scrolling?"dragging":"",d=void 0!==i,c=this.badges.length>0;return o.qy` ${e?o.qy` <div class="actions-container"> <div class="actions"> <ha-icon-button .label="${this.hass.localize("ui.common.edit")}" ="${this._configure}" .path="${v}"></ha-icon-button> </div> </div> `:o.s6} <div class="container ${e?"edit-mode":""}"> <div class="layout ${(0,r.H)({[t]:!0,[`badges-${a}`]:!0,[`badges-${s}`]:!0,"has-heading":d,"has-badges":c})}"> ${i||e?o.qy` <div class="heading"> ${e?i?o.qy` <hui-card-edit-mode -edit-card="${this._editCard}" -delete-card="${this._deleteCard}" .hass="${this.hass}" .lovelace="${this.lovelace}" .path="${[0]}" no-duplicate no-move> ${i} </hui-card-edit-mode> `:o.qy` <button class="add" ="${this._addCard}"> <ha-ripple></ha-ripple> <ha-svg-icon .path="${u}"></ha-svg-icon> ${this.hass.localize("ui.panel.lovelace.editor.edit_view_header.add_title")} </button> `:i} </div> `:o.s6} ${this.lovelace&&(e||this.badges.length>0)?o.qy` <div class="badges ${a} ${s} ${n}"> <hui-view-badges .badges="${this.badges}" .hass="${this.hass}" .lovelace="${this.lovelace}" .viewIndex="${this.viewIndex}" .showAddLabel="${0===this.badges.length}"></hui-view-badges> </div> `:o.s6} </div> </div> `}constructor(...e){super(...e),this.badges=[],this._badgeVisibilityChanged=()=>{this._checkHidden()},this._dragScrollController=new n.q(this,{selector:".scroll",enabled:!1}),this._configure=()=>{(0,p.U)(this,{config:this.config,saveConfig:e=>{this._saveHeaderConfig(e)}})}}}x.styles=o.AH`:host([hidden]){display:none!important}.container{position:relative}.actions-container{position:relative;height:34px;display:flex;flex-direction:column;justify-content:flex-end}.actions{z-index:1;position:absolute;height:36px;bottom:-2px;right:0;inset-inline-end:0;inset-inline-start:initial;opacity:1;display:flex;align-items:center;justify-content:center;transition:opacity .2s ease-in-out;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border-bottom-left-radius:0px;border-bottom-right-radius:0px;background:var(--secondary-background-color);--ha-icon-button-size:36px;--mdc-icon-size:20px;color:var(--primary-text-color)}.layout{position:relative;display:flex;flex-direction:column;gap:16px 8px;--spacing:8px}.heading{position:relative;flex:1;width:100%;max-width:700px;display:flex}.heading>*{width:100%;height:100%}.badges{position:relative;flex:1;display:flex}.container:not(.edit-mode) .badges.scroll{overflow:auto;max-width:100%;scrollbar-color:var(--scrollbar-thumb-color) transparent;scrollbar-width:none;mask-image:linear-gradient(90deg,transparent 0%,black 16px,black calc(100% - 16px),transparent 100%)}hui-view-badges{width:100%;display:flex;flex-direction:column;justify-content:flex-end;--badges-aligmnent:flex-start}.layout{align-items:flex-start}.layout.center{align-items:center}.layout .heading{--card-text-align:start}.layout.center .heading{--card-text-align:center;display:flex;flex-direction:column;align-items:center}.layout.center hui-view-badges{--badges-aligmnent:center}.container:not(.edit-mode) .layout.badges-scroll hui-view-badges{--badges-wrap:nowrap;--badges-aligmnent:flex-start;--badge-padding:16px}.container:not(.edit-mode) .layout.center.badges-scroll hui-view-badges{--badges-aligmnent:space-around} (min-width:768px){.layout.responsive.has-heading{flex-direction:row;align-items:flex-end}.layout.responsive.has-heading .badges.scroll{mask-image:none;padding:0}.container:not(.edit-mode) .layout.responsive.badges-scroll.has-heading hui-view-badges{--badges-wrap:wrap;--badges-aligmnent:flex-end;--badge-padding:0}.layout.responsive.has-heading hui-view-badges{--badges-aligmnent:flex-end}}.layout.badges-top{flex-direction:column-reverse} (min-width:768px){.layout.responsive.badges-top.has-heading{flex-direction:row;align-items:flex-start}}.container.edit-mode{padding:8px;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border:2px dashed var(--divider-color);border-start-end-radius:0}.container.edit-mode .content{min-height:36px}.add{position:relative;display:flex;flex-direction:row;align-items:center;outline:0;gap:var(--ha-space-2);height:36px;padding:6px 20px 6px 20px;box-sizing:border-box;width:auto;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));background-color:transparent;border-width:2px;border-style:dashed;border-color:var(--primary-color);--mdc-icon-size:18px;cursor:pointer;font-size:var(--ha-font-size-m);color:var(--primary-text-color);--ha-ripple-color:var(--primary-color);--ha-ripple-hover-opacity:0.04;--ha-ripple-pressed-opacity:0.12}.add:focus{border-style:solid}.dragging{pointer-events:none}`,(0,a.Cg)([(0,s.MZ)({attribute:!1})],x.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],x.prototype,"lovelace",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],x.prototype,"card",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],x.prototype,"badges",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],x.prototype,"config",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],x.prototype,"viewIndex",void 0),x=(0,a.Cg)([(0,s.EM)("hui-view-header")],x),i()}catch(e){i(e)}})},16401(e,i,t){t.a(e,async function(e,i){try{t(88454),t(29452);var a=t(62826),o=t(5124),s=t(22441),r=t(75751),n=t(1087),d=t(91263),c=t(14487),l=t(26004),h=e([l,d,c]);[l,d,c]=h.then?(await h)():h;class p extends((0,d.M)(o.WF)){updated(e){super.updated(e),(e.has("hass")||e.has("config"))&&this._updateVisibility()}_updateVisibility(e){if(!this.hass||!this.config)return;const i=e??(!this.config.visibility||(0,c.XH)(this.config.visibility,this.hass,this._conditionContext));i!==this._visible&&(this._visible=i,(0,n.r)(this,"sidebar-visibility-changed",{visible:i}))}_getSectionKey(e){return this._sectionConfigKeys.has(e)||this._sectionConfigKeys.set(e,Math.random().toString()),this._sectionConfigKeys.get(e)}render(){return this.lovelace?o.qy` <div class="container"> ${(0,r.u)(this.config?.sections??[],e=>this._getSectionKey(e),e=>o.qy` <hui-section .config="${e}" .hass="${this.hass}" .preview="${this.lovelace.editMode}" .viewIndex="${this.viewIndex}"></hui-section> `)} </div> `:o.s6}constructor(...e){super(...e),this._visible=!0,this._sectionConfigKeys=new WeakMap}}p.styles=o.AH`.container{display:flex;flex-direction:column;gap:var(--row-gap,8px);width:100%}`,(0,a.Cg)([(0,s.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],p.prototype,"lovelace",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],p.prototype,"config",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],p.prototype,"viewIndex",void 0),p=(0,a.Cg)([(0,s.EM)("hui-view-sidebar")],p),i()}catch(e){i(e)}})},94629(e,i,t){t.d(i,{z:()=>a});t(44114),t(17642),t(58004),t(33853),t(45876),t(32475),t(15024),t(31698);function a(e,i){const t=new Set;if(i<=1)return t;const a=[];let o={indices:[],hasBackground:!1},s=0;for(let t=0;t<e.length;t++){const r=e[t];if(r.hidden)continue;const n=Math.min(r.config.column_span||1,i);s+n>i&&(a.push(o),o={indices:[],hasBackground:!1},s=0),s+=n,o.indices.push(t),void 0!==r.config.background&&(o.hasBackground=!0)}a.push(o);for(const i of a)if(i.hasBackground)for(const a of i.indices)void 0===e[a].config.background&&t.add(a);return t}}};