export const __rspack_esm_id=8119;export const __rspack_esm_ids=[8119];export const __webpack_modules__={79946(e,i,t){t.a(e,async function(e,a){try{t.r(i);t(18111),t(7588);var o=t(15697),s=t(57527),d=t(79224),n=t(148),r=t(98747),l=t(79841),c=t(2285),h=e([r,l]);[r,l]=h.then?(await h)():h;const p="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z",v="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",m="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class g extends s.WF{connectedCallback(){super.connectedCallback(),this._mql=window.matchMedia("(min-width: 760px)"),this._mqlListenerRef=this._createCards.bind(this),this._mql.addListener(this._mqlListenerRef)}disconnectedCallback(){super.disconnectedCallback(),this._mql?.removeListener(this._mqlListenerRef),this._mqlListenerRef=void 0,this._mql=void 0}setConfig(e){this._config=e}willUpdate(e){if(super.willUpdate(e),this.lovelace?.editMode&&t.e(14150).then(t.bind(t,58533)),e.has("cards")&&this._createCards(),!e.has("lovelace")&&!e.has("_config"))return;const i=e.get("lovelace");(!e.has("cards")&&i?.config!==this.lovelace?.config||i&&i?.editMode!==this.lovelace?.editMode)&&this._createCards()}render(){return s.qy` <hui-view-badges .badges=${this.badges} .lovelace=${this.lovelace} .viewIndex=${this.index} show-add-label></hui-view-badges> <div class="container ${this.lovelace?.editMode?"edit-mode":""}"></div> ${this.lovelace?.editMode?s.qy` <ha-button size="l" @click=${this._addCard}> <ha-svg-icon slot="start" .path=${m}></ha-svg-icon> ${this.hass.localize("ui.panel.lovelace.editor.edit_card.add")} </ha-button> `:""} `}_addCard(){(0,n.r)(this,"ll-create-card")}_createCards(){const e=document.createElement("div");let i;if(e.id="main",this._mql?.matches?(i=document.createElement("div"),i.id="sidebar"):i=e,this.hasUpdated){const t=this._container;this._oldMain&&t.removeChild(this._oldMain),this._oldSidebar&&t.removeChild(this._oldSidebar),t.appendChild(e),t.appendChild(i)}else this.updateComplete.then(()=>{const t=this._container;t.appendChild(e),t.appendChild(i)});this.cards.forEach((t,a)=>{const o=this._config?.cards?.[a];let s;if(this.isStrategy||!this.lovelace?.editMode)t.preview=!1,s=t;else{s=document.createElement("hui-card-options"),s.hass=this.hass,s.lovelace=this.lovelace,s.path=[this.index,a],t.preview=!0;const e=document.createElement("ha-icon-button");e.slot="buttons";const i=document.createElement("ha-svg-icon");i.path="sidebar"!==o?.view_layout?.position?v:p,e.appendChild(i),e.addEventListener("click",()=>{this.lovelace.saveConfig((0,c.bn)(this.lovelace.config,[this.index,a],{...o,view_layout:{position:"sidebar"!==o?.view_layout?.position?"sidebar":"main"}}))}),s.appendChild(e),s.appendChild(t)}"sidebar"!==o?.view_layout?.position?e.appendChild(s):i.appendChild(s)})}constructor(...e){super(...e),this.isStrategy=!1,this.cards=[],this.badges=[]}}g.styles=s.AH`:host{padding-top:4px;display:block}hui-view-badges{font-size:var(--ha-font-size-s);margin:4px 8px;display:block}.container{justify-content:center;margin-left:4px;margin-right:4px;display:flex}.container.edit-mode{margin-bottom:72px}#main{flex-grow:2;max-width:1620px}#sidebar{flex-grow:1;flex-shrink:0;max-width:380px}.container>div{box-sizing:border-box;min-width:0}.container>div>:not([hidden]){margin:var(--masonry-view-card-margin,4px 4px 8px);display:block}@media (width<=500px){.container>div>*{margin-left:0;margin-right:0}}ha-button{right:calc(16px + var(--safe-area-inset-right));bottom:calc(16px + var(--safe-area-inset-bottom));z-index:1;--ha-button-box-shadow:var(--ha-box-shadow-l);position:fixed;inset-inline-start:initial;inset-inline-end:calc(16px + var(--safe-area-inset-right))}`,(0,o.Cg)([(0,d.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,o.Cg)([(0,d.MZ)({attribute:!1})],g.prototype,"lovelace",void 0),(0,o.Cg)([(0,d.MZ)({type:Number})],g.prototype,"index",void 0),(0,o.Cg)([(0,d.MZ)({attribute:!1})],g.prototype,"isStrategy",void 0),(0,o.Cg)([(0,d.MZ)({attribute:!1})],g.prototype,"cards",void 0),(0,o.Cg)([(0,d.MZ)({attribute:!1})],g.prototype,"badges",void 0),(0,o.Cg)([(0,d.wk)()],g.prototype,"_config",void 0),(0,o.Cg)([(0,d.P)("#main")],g.prototype,"_oldMain",void 0),(0,o.Cg)([(0,d.P)("#sidebar")],g.prototype,"_oldSidebar",void 0),(0,o.Cg)([(0,d.P)(".container")],g.prototype,"_container",void 0),g=(0,o.Cg)([(0,d.EM)("hui-sidebar-view")],g),t.d(i,{SideBarView:()=>g}),a()}catch(e){a(e)}})}};
//# sourceMappingURL=8119.c8689125bf37c6c0.js.map