UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

8 lines 46.1 kB
export const __webpack_ids__=["74763"];export const __webpack_modules__={96814:function(e,t,i){i(9359),i(31526),e.exports=function e(t){return Object.freeze(t),Object.getOwnPropertyNames(t).forEach((function(i){!t.hasOwnProperty(i)||null===t[i]||"object"!=typeof t[i]&&"function"!=typeof t[i]||Object.isFrozen(t[i])||e(t[i])})),t}},13245:function(e,t,i){i.d(t,{$y:()=>s,fs:()=>n,j:()=>a});const o=(e,t,i)=>new Promise(((o,a)=>{const n=document.createElement(e);let s="src",l="body";switch(n.onload=()=>o(t),n.onerror=()=>a(t),e){case"script":n.async=!0,i&&(n.type=i);break;case"link":n.type="text/css",n.rel="stylesheet",s="href",l="head"}n[s]=t,document[l].appendChild(n)})),a=e=>o("link",e),n=e=>o("script",e),s=e=>o("script",e,"module")},87707:function(e,t,i){i.d(t,{Q:()=>o});const o=e=>!(!e.detail.selected||"property"!==e.detail.source)&&(e.currentTarget.selected=!1,!0)},35830:function(e,t,i){i.d(t,{q:()=>o});const o=e=>{const t=window.location.pathname;return e?t+"?"+e:t}},54237:function(e,t,i){i.r(t),i.d(t,{HaIconButtonArrowNext:()=>l});var o=i(44249),a=i(57243),n=i(15093),s=i(5111);i(23334);let l=(0,o.Z)([(0,n.Mo)("ha-icon-button-arrow-next")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_icon",value:()=>"rtl"===s.E.document.dir?"M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z":"M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z"},{kind:"method",key:"render",value:function(){return a.dy` <ha-icon-button .disabled="${this.disabled}" .label="${this.label||this.hass?.localize("ui.common.next")||"Next"}" .path="${this._icon}"></ha-icon-button> `}}]}}),a.oi)},54202:function(e,t,i){i.r(t),i.d(t,{HaIconButtonArrowPrev:()=>l});var o=i(44249),a=i(57243),n=i(15093),s=i(5111);i(23334);let l=(0,o.Z)([(0,n.Mo)("ha-icon-button-arrow-prev")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_icon",value:()=>"rtl"===s.E.document.dir?"M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z":"M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"},{kind:"method",key:"render",value:function(){return a.dy` <ha-icon-button .disabled="${this.disabled}" .label="${this.label||this.hass?.localize("ui.common.back")||"Back"}" .path="${this._icon}"></ha-icon-button> `}}]}}),a.oi)},17170:function(e,t,i){i.a(e,(async function(e,o){try{i.r(t),i.d(t,{HaSpinner:()=>h});var a=i(44249),n=i(72621),s=i(97677),l=i(43580),r=i(57243),d=i(15093),c=e([s]);s=(c.then?(await c)():c)[0];let h=(0,a.Z)([(0,d.Mo)("ha-spinner")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,d.Cb)()],key:"size",value:void 0},{kind:"method",key:"updated",value:function(e){if((0,n.Z)(i,"updated",this,3)([e]),e.has("size"))switch(this.size){case"tiny":this.style.setProperty("--ha-spinner-size","16px");break;case"small":this.style.setProperty("--ha-spinner-size","28px");break;case"medium":this.style.setProperty("--ha-spinner-size","48px");break;case"large":this.style.setProperty("--ha-spinner-size","68px");break;case void 0:this.style.removeProperty("--ha-progress-ring-size")}}},{kind:"field",static:!0,key:"styles",value:()=>[l.Z,r.iv`:host{--indicator-color:var( --ha-spinner-indicator-color, var(--primary-color) );--track-color:var(--ha-spinner-divider-color, var(--divider-color));--track-width:4px;--speed:3.5s;font-size:var(--ha-spinner-size, 48px)}`]}]}}),s.Z);o()}catch(e){o(e)}}))},77197:function(e,t,i){var o=i(44249),a=i(72621),n=(i(9359),i(31526),i(89373),i(15093));const s=customElements.get("paper-tabs");let l;(0,o.Z)([(0,n.Mo)("ha-tabs")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",key:"_firstTabWidth",value:()=>0},{kind:"field",key:"_lastTabWidth",value:()=>0},{kind:"field",key:"_lastLeftHiddenState",value:()=>!1},{kind:"field",key:"_lastRightHiddenState",value:()=>!1},{kind:"get",static:!0,key:"template",value:function(){if(!l){l=s.template.cloneNode(!0);const e=l.content.querySelector("style");l.content.querySelectorAll("paper-icon-button").forEach((e=>{e.setAttribute("noink","")})),e.appendChild(document.createTextNode("\n #selectionBar {\n box-sizing: border-box;\n }\n .not-visible {\n display: none;\n }\n paper-icon-button {\n width: 24px;\n height: 48px;\n padding: 0;\n margin: 0;\n }\n "))}return l}},{kind:"method",key:"_tabChanged",value:function(e,t){(0,a.Z)(i,"_tabChanged",this,3)([e,t]);const o=this.querySelectorAll("paper-tab:not(.hide-tab)");o.length>0&&(this._firstTabWidth=o[0].clientWidth,this._lastTabWidth=o[o.length-1].clientWidth);const n=this.querySelector(".iron-selected");n&&(n.scrollIntoView(),this._affectScroll(0))}},{kind:"method",key:"_affectScroll",value:function(e){if(0===this._firstTabWidth||0===this._lastTabWidth)return;this.$.tabsContainer.scrollLeft+=e;const t=this.$.tabsContainer.scrollLeft,i="rtl"===this.dir,o=Math.abs(t)<this._firstTabWidth,a=Math.abs(t)+this._lastTabWidth>this._tabContainerScrollSize;this._leftHidden=i?a:o,this._rightHidden=i?o:a,i?this._lastRightHiddenState!==this._rightHidden&&(this._lastRightHiddenState=this._rightHidden,this.$.tabsContainer.scrollLeft-=this._rightHidden?-23:23):this._lastLeftHiddenState!==this._leftHidden&&(this._lastLeftHiddenState=this._leftHidden,this.$.tabsContainer.scrollLeft+=this._leftHidden?-23:23)}}]}}),s)},61610:function(e,t,i){i.d(t,{Gc:()=>o});const o=(e,t,i)=>e.subscribeEvents((e=>{e.data.url_path===t&&i()}),"lovelace_updated")},6649:function(e,t,i){i.d(t,{JR:()=>a,Y:()=>n,iM:()=>s,j2:()=>o});const o=e=>e.callWS({type:"lovelace/dashboards/list"}),a=(e,t)=>e.callWS({type:"lovelace/dashboards/create",...t}),n=(e,t,i)=>e.callWS({type:"lovelace/dashboards/update",dashboard_id:t,...i}),s=(e,t)=>e.callWS({type:"lovelace/dashboards/delete",dashboard_id:t})},20:function(e,t,i){i.d(t,{SN:()=>a,eL:()=>o,fg:()=>s,id:()=>n});const o=e=>e.sendMessagePromise({type:"lovelace/resources"}),a=(e,t)=>e.callWS({type:"lovelace/resources/create",...t}),n=(e,t,i)=>e.callWS({type:"lovelace/resources/update",resource_id:t,...i}),s=(e,t)=>e.callWS({type:"lovelace/resources/delete",resource_id:t})},34515:function(e,t,i){i.r(t);var o=i(44249),a=(i(31622),i(57243)),n=i(15093);i(54202),i(43344),i(99426);(0,o.Z)([(0,n.Mo)("hass-error-screen")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"toolbar",value:()=>!0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"rootnav",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)()],key:"error",value:void 0},{kind:"method",key:"render",value:function(){return a.dy` ${this.toolbar?a.dy`<div class="toolbar"> ${this.rootnav||history.state?.root?a.dy` <ha-menu-button .hass="${this.hass}" .narrow="${this.narrow}"></ha-menu-button> `:a.dy` <ha-icon-button-arrow-prev .hass="${this.hass}" @click="${this._handleBack}"></ha-icon-button-arrow-prev> `} </div>`:""} <div class="content"> <ha-alert alert-type="error">${this.error}</ha-alert> <slot> <mwc-button @click="${this._handleBack}"> ${this.hass?.localize("ui.common.back")} </mwc-button> </slot> </div> `}},{kind:"method",key:"_handleBack",value:function(){history.back()}},{kind:"get",static:!0,key:"styles",value:function(){return[a.iv`:host{display:block;height:100%;background-color:var(--primary-background-color)}.toolbar{display:flex;align-items:center;font-size:20px;height:var(--header-height);padding:8px 12px;pointer-events:none;background-color:var(--app-header-background-color);font-weight:400;color:var(--app-header-text-color,#fff);border-bottom:var(--app-header-border-bottom,none);box-sizing:border-box}@media (max-width:599px){.toolbar{padding:4px}}ha-icon-button-arrow-prev{pointer-events:auto}.content{color:var(--primary-text-color);height:calc(100% - var(--header-height));display:flex;padding:16px;align-items:center;justify-content:center;flex-direction:column;box-sizing:border-box}a{color:var(--primary-color)}ha-alert{margin-bottom:16px}`]}}]}}),a.oi)},75375:function(e,t,i){i.a(e,(async function(e,o){try{i.r(t);var a=i(44249),n=i(57243),s=i(15093),l=i(17170),r=(i(54202),i(43344),i(28008)),d=e([l]);l=(d.then?(await d)():d)[0];(0,a.Z)([(0,s.Mo)("hass-loading-screen")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)({type:Boolean,attribute:"no-toolbar"})],key:"noToolbar",value:()=>!1},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"rootnav",value:()=>!1},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,s.Cb)()],key:"message",value:void 0},{kind:"method",key:"render",value:function(){return n.dy` ${this.noToolbar?"":n.dy`<div class="toolbar"> ${this.rootnav||history.state?.root?n.dy` <ha-menu-button .hass="${this.hass}" .narrow="${this.narrow}"></ha-menu-button> `:n.dy` <ha-icon-button-arrow-prev .hass="${this.hass}" @click="${this._handleBack}"></ha-icon-button-arrow-prev> `} </div>`} <div class="content"> <ha-spinner></ha-spinner> ${this.message?n.dy`<div id="loading-text">${this.message}</div>`:n.Ld} </div> `}},{kind:"method",key:"_handleBack",value:function(){history.back()}},{kind:"get",static:!0,key:"styles",value:function(){return[r.Qx,n.iv`:host{display:block;height:100%;background-color:var(--primary-background-color)}.toolbar{display:flex;align-items:center;font-size:20px;height:var(--header-height);padding:8px 12px;pointer-events:none;background-color:var(--app-header-background-color);font-weight:400;color:var(--app-header-text-color,#fff);border-bottom:var(--app-header-border-bottom,none);box-sizing:border-box}@media (max-width:599px){.toolbar{padding:4px}}ha-icon-button-arrow-prev,ha-menu-button{pointer-events:auto}.content{height:calc(100% - var(--header-height));display:flex;flex-direction:column;align-items:center;justify-content:center}#loading-text{max-width:350px;margin-top:16px}`]}}]}}),n.oi);o()}catch(e){o(e)}}))},13144:function(e,t,i){i.d(t,{w:()=>n});var o=i(36522);const a=()=>Promise.all([i.e("97983"),i.e("63055"),i.e("42937")]).then(i.bind(i,6827)),n=(e,t)=>{(0,o.B)(e,"show-dialog",{dialogTag:"dialog-lovelace-dashboard-detail",dialogImport:a,dialogParams:t})}},48990:function(e,t,i){i.d(t,{A5:()=>s});i(9359),i(68107),i(56475),i(70104);var o=i(54305),a=i(48977),n=i(10571);const s=e=>{if((0,a.Tx)(e))return e;const t={...e};return t.views&&(t.views=t.views.map(l)),t},l=e=>{if((0,n.s)(e))return e;const t={...e};return t.badges&&!t.badges.every(Boolean)&&(t.badges=t.badges.filter(Boolean)),t.sections&&(t.sections=t.sections.map(r)),t},r=e=>{const t={...e};if(e.title){if(!(0,o.N)(t)){const e={type:"heading",heading:t.title};t.cards=[e,...t.cards||[]]}delete t.title}return t}},34216:function(e,t,i){i.d(t,{k:()=>s});i(9359),i(31526),i(75656),i(50100),i(18084);var o=i(13245);const a={},n={},s=(e,t)=>{e.forEach((e=>{const i=new URL(e.url,t.auth.data.hassUrl).toString();switch(e.type){case"css":if(i in a)break;a[i]=(0,o.j)(i);break;case"js":if(i in n)break;n[i]=(0,o.fs)(i);break;case"module":(0,o.$y)(i);break;default:console.warn(`Unknown resource type specified: ${e.type}`)}}))}},23759:function(e,t,i){i.d(t,{L:()=>n});var o=i(36522);const a=()=>Promise.all([i.e("97983"),i.e("9979")]).then(i.bind(i,86614)),n=(e,t)=>{(0,o.B)(e,"show-dialog",{dialogTag:"dialog-dashboard-strategy-editor",dialogImport:a,dialogParams:t})}},8823:function(e,t,i){i.d(t,{Z:()=>s});var o=i(36522);const a="show-save-config";let n=!1;const s=(e,t)=>{n||(n=!0,(0,o.B)(e,"register-dialog",{dialogShowEvent:a,dialogTag:"hui-dialog-save-config",dialogImport:()=>Promise.all([i.e("97983"),i.e("30247")]).then(i.bind(i,44111))})),(0,o.B)(e,a,t)}},62127:function(e,t,i){i.d(t,{k:()=>s});var o=i(36522);let a=!1;const n="show-edit-view",s=(e,t)=>{a||(a=!0,(e=>{(0,o.B)(e,"register-dialog",{dialogShowEvent:n,dialogTag:"hui-dialog-edit-view",dialogImport:()=>Promise.all([i.e("46379"),i.e("97983"),i.e("27506"),i.e("15722"),i.e("27090"),i.e("3049"),i.e("21876"),i.e("62869"),i.e("20123")]).then(i.bind(i,29809))})})(e)),(0,o.B)(e,n,t)}},45143:function(e,t,i){i.a(e,(async function(e,o){try{i.r(t),i.d(t,{LovelacePanel:()=>M});var a=i(44249),n=i(72621),s=(i(31622),i(96814)),l=i.n(s),r=i(57243),d=i(15093),c=i(35830),h=i(58776),u=i(57816),v=i(61610),f=i(48977),p=i(20),b=(i(34515),i(75375)),g=i(72473),k=i(48990),m=i(34216),y=i(8823),w=i(83257),_=i(28421),x=e([b,w]);[b,w]=x.then?(await x)():x,window.loadCardHelpers=()=>Promise.all([i.e("79931"),i.e("3371"),i.e("72974"),i.e("6108")]).then(i.bind(i,12660));const C={strategy:{type:"original-states"}};let $=!1,V=!1,M=(0,a.Z)([(0,d.Mo)("ha-panel-lovelace")],(function(e,t){class o extends t{constructor(...t){super(...t),e(this)}}return{F:o,d:[{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"panel",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"route",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_panelState",value:()=>"loading"},{kind:"field",decorators:[(0,d.SB)()],key:"_errorMsg",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"lovelace",value:void 0},{kind:"field",key:"_ignoreNextUpdateEvent",value:()=>!1},{kind:"field",key:"_fetchConfigOnConnect",value:()=>!1},{kind:"field",key:"_unsubUpdates",value:void 0},{kind:"field",key:"_loading",value:()=>!1},{kind:"method",key:"connectedCallback",value:function(){(0,n.Z)(o,"connectedCallback",this,3)([]),this.lovelace&&this.hass&&this.lovelace.locale!==this.hass.locale?this._setLovelaceConfig(this.lovelace.config,this.lovelace.rawConfig,this.lovelace.mode):this.lovelace&&"generated"===this.lovelace.mode?(this._panelState="loading",this._regenerateConfig()):this._fetchConfigOnConnect&&this._fetchConfig(!1),window.addEventListener("connection-status",this._handleConnectionStatus)}},{kind:"method",key:"disconnectedCallback",value:function(){(0,n.Z)(o,"disconnectedCallback",this,3)([]),null!==this.urlPath&&this._unsubUpdates&&(this._unsubUpdates.then((e=>e())),this._unsubUpdates=void 0),window.removeEventListener("connection-status",this._handleConnectionStatus)}},{kind:"method",key:"render",value:function(){const e=this._panelState;return"loaded"===e?r.dy` <hui-root .panel="${this.panel}" .hass="${this.hass}" .lovelace="${this.lovelace}" .route="${this.route}" .narrow="${this.narrow}" @config-refresh="${this._forceFetchConfig}"></hui-root> `:"error"===e?r.dy` <hass-error-screen .hass="${this.hass}" title="${(0,u.Lh)(this.hass.localize,"lovelace")}" .error="${this._errorMsg}"> <mwc-button raised @click="${this._forceFetchConfig}"> ${this.hass.localize("ui.panel.lovelace.reload_lovelace")} </mwc-button> </hass-error-screen> `:"yaml-editor"===e?r.dy` <hui-editor .hass="${this.hass}" .lovelace="${this.lovelace}" .closeEditor="${this._closeEditor}"></hui-editor> `:r.dy` <hass-loading-screen rootnav .hass="${this.hass}" .narrow="${this.narrow}"></hass-loading-screen> `}},{kind:"method",key:"willUpdate",value:function(e){(0,n.Z)(o,"willUpdate",this,3)([e]),this.lovelace||"error"===this._panelState||this._loading||this._fetchConfig(!1)}},{kind:"method",key:"firstUpdated",value:function(e){(0,n.Z)(o,"firstUpdated",this,3)([e]),this._unsubUpdates||this._subscribeUpdates()}},{kind:"field",key:"_handleConnectionStatus",value(){return e=>{"connected"===e.detail&&this._fetchConfig(!1)}}},{kind:"method",key:"_regenerateConfig",value:async function(){const e=await(0,_.to)(C,this.hass);this._setLovelaceConfig(e,C,"generated"),this._panelState="loaded"}},{kind:"method",key:"_subscribeUpdates",value:async function(){this._unsubUpdates=(0,v.Gc)(this.hass.connection,this.urlPath,(()=>this._lovelaceChanged()))}},{kind:"field",key:"_closeEditor",value(){return()=>{this._panelState="loaded"}}},{kind:"method",key:"_lovelaceChanged",value:function(){this._ignoreNextUpdateEvent?this._ignoreNextUpdateEvent=!1:this.isConnected?(0,g.C)(this,{message:this.hass.localize("ui.panel.lovelace.changed_toast.message"),action:{action:()=>this._fetchConfig(!1),text:this.hass.localize("ui.common.refresh")},duration:-1,dismissable:!1}):this._fetchConfigOnConnect=!0}},{kind:"get",key:"urlPath",value:function(){return"lovelace"===this.panel.url_path?null:this.panel.url_path}},{kind:"method",key:"_forceFetchConfig",value:function(){this._fetchConfig(!0)}},{kind:"method",key:"_fetchConfig",value:async function(e){let t,i;this._loading=!0;let o,a=this.panel.config.mode;const n=window;n.llConfProm&&(o=n.llConfProm,n.llConfProm=void 0),V||(V=!0,(n.llResProm||(0,p.eL)(this.hass.connection)).then((e=>(0,m.k)(e,this.hass)))),null===this.urlPath&&o||(this.lovelace&&"yaml"===this.lovelace.mode&&(this._ignoreNextUpdateEvent=!0),o=(0,f.Q2)(this.hass.connection,this.urlPath,e));try{if(i=await o,(0,f.Tx)(i)){if(!this.hass?.entities||!this.hass.devices||!this.hass.areas)return;t=await(0,_.to)(i,this.hass)}else t=i}catch(e){if("config_not_found"!==e.code)return console.log(e),this._panelState="error",void(this._errorMsg=e.message);if(!this.hass?.entities||!this.hass.devices||!this.hass.areas)return;t=await(0,_.to)(C,this.hass),i=C,a="generated"}finally{this._loading=!1,this.lovelace&&"yaml"===this.lovelace.mode&&setTimeout((()=>{this._ignoreNextUpdateEvent=!1}),2e3)}this._panelState="yaml-editor"===this._panelState?this._panelState:"loaded",this._setLovelaceConfig(t,i,a)}},{kind:"method",key:"_checkLovelaceConfig",value:function(e){const t=(0,k.A5)(e);return l()(t)}},{kind:"method",key:"_setLovelaceConfig",value:function(e,t,o){e=this._checkLovelaceConfig(e);const a=this.urlPath;this.lovelace={config:e,rawConfig:t,mode:o,urlPath:this.urlPath,editMode:!!this.lovelace&&this.lovelace.editMode,locale:this.hass.locale,enableFullEditMode:()=>{$||($=!0,Promise.all([i.e("94611"),i.e("93505"),i.e("90678")]).then(i.bind(i,59207))),this._panelState="yaml-editor"},setEditMode:e=>{"generated"===this.lovelace.mode&&e?(0,y.Z)(this,{lovelace:this.lovelace,mode:this.panel.config.mode,narrow:this.narrow}):(0,f.Tx)(this.lovelace.rawConfig)&&e?this.lovelace.enableFullEditMode():this._updateLovelace({editMode:e})},saveConfig:async e=>{const{config:t,rawConfig:i,mode:o}=this.lovelace;let n;e=this._checkLovelaceConfig(e),n=(0,f.Tx)(e)?await(0,_.to)(e,this.hass):e;try{this._updateLovelace({config:n,rawConfig:e,mode:"storage"}),this._ignoreNextUpdateEvent=!0,await(0,f.Oh)(this.hass,a,e)}catch(e){throw console.error(e),this._updateLovelace({config:t,rawConfig:i,mode:o}),e}},deleteConfig:async()=>{const{config:e,rawConfig:t,mode:i}=this.lovelace;try{const e=await(0,_.to)(C,this.hass);this._updateLovelace({config:e,rawConfig:C,mode:"generated",editMode:!1}),this._ignoreNextUpdateEvent=!0,await(0,f.vj)(this.hass,a)}catch(o){throw console.error(o),this._updateLovelace({config:e,rawConfig:t,mode:i}),o}},showToast:e=>(0,g.C)(this,e)}}},{kind:"method",key:"_updateLovelace",value:function(e){this.lovelace={...this.lovelace,...e},"editMode"in e&&window.history.replaceState(null,"",(0,c.q)(e.editMode?(0,h.j4)({edit:"1"}):(0,h.pc)("edit")))}}]}}),r.oi);o()}catch(e){o(e)}}))},83257:function(e,t,i){i.a(e,(async function(e,t){try{var o=i(44249),a=i(72621),n=(i(92745),i(9359),i(56475),i(1331),i(31526),i(70104),i(52924),i(31622),i(87319),i(54207),i(89373),i(57243)),s=i(15093),l=i(35359),r=i(20552),d=i(27486),c=i(72344),h=i(36522),u=i(87707),v=i(83523),f=i(35830),p=i(58776),b=i(20172),g=i(22381),k=i(76320),m=(i(34273),i(65981),i(23334),i(54237),i(54202),i(43344),i(37583),i(77197),i(48977)),y=i(6649),w=i(62162),_=i(76131),x=i(85026),C=i(91163),$=i(28008),V=i(73192),M=i(13144),H=i(27353),L=i(23759),A=i(8823),S=i(62127),z=i(28421),E=i(32930),B=i(3166),P=(i(33679),i(62504),i(83716)),T=i(90037),Z=e([B]);B=(Z.then?(await Z)():Z)[0];const U="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",N="M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9M10,16V19.08L13.08,16H20V4H4V16H10M17,11H15V9H17V11M13,11H11V9H13V11M9,11H7V9H9V11Z",R="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",D="M15,7H20.5L15,1.5V7M8,0H16L22,6V18A2,2 0 0,1 20,20H8C6.89,20 6,19.1 6,18V2A2,2 0 0,1 8,0M4,4V22H20V24H4A2,2 0 0,1 2,22V4H4Z",F="M5,15.5L7.5,20H2.5L5,15.5M9,19H21V17H9V19M5,9.5L7.5,14H2.5L5,9.5M9,13H21V11H9V13M5,3.5L7.5,8H2.5L5,3.5M9,7H21V5H9V7Z",I="M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z",W="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z",j="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",Q="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",O="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z",q="M11,13.5V21.5H3V13.5H11M12,2L17.5,11H6.5L12,2M17.5,13C20,13 22,15 22,17.5C22,20 20,22 17.5,22C15,22 13,20 13,17.5C13,15 15,13 17.5,13Z",Y="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z",G="M21,19V20H3V19L5,17V11C5,7.9 7.03,5.17 10,4.29C10,4.19 10,4.1 10,4A2,2 0 0,1 12,2A2,2 0 0,1 14,4C14,4.1 14,4.19 14,4.29C16.97,5.17 19,7.9 19,11V17L21,19M14,21A2,2 0 0,1 12,23A2,2 0 0,1 10,21";(0,o.Z)([(0,s.Mo)("hui-root")],(function(e,t){class o extends t{constructor(){super(),e(this),this._debouncedConfigChanged=(0,g.D)((()=>this._selectView(this._curView,!0)),100,!1)}}return{F:o,d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"panel",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"lovelace",value:void 0},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"route",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_curView",value:void 0},{kind:"field",key:"_viewCache",value:void 0},{kind:"field",key:"_viewScrollPositions",value:()=>({})},{kind:"field",key:"_restoreScroll",value:()=>!1},{kind:"field",key:"_debouncedConfigChanged",value:void 0},{kind:"field",decorators:[(0,s.Cb)()],key:"_persistentNotifications",value:void 0},{kind:"field",key:"_unsubNotifications",value:void 0},{kind:"field",key:"_conversation",value(){return(0,d.Z)((e=>(0,c.p)(this.hass,"conversation")))}},{kind:"method",key:"_renderActionItems",value:function(){const e=[];this._editMode?e.push(n.dy`<mwc-button outlined class="exit-edit-mode" .label="${this.hass.localize("ui.panel.lovelace.menu.exit_edit_mode")}" @click="${this._editModeDisable}"></mwc-button> <a href="${(0,V.R)(this.hass,"/dashboards/")}" rel="noreferrer" class="menu-link" target="_blank"> <ha-icon-button .label="${this.hass.localize("ui.panel.lovelace.menu.help")}" .path="${I}"></ha-icon-button> </a>`):e.push(this._renderNotificationButton());const t=[{icon:F,key:"ui.panel.lovelace.unused_entities.title",overflowAction:this._handleUnusedEntities,visible:this._editMode&&!0,overflow:!0},{icon:U,key:"ui.panel.lovelace.editor.menu.raw_editor",overflowAction:this._handleRawEditor,visible:this._editMode,overflow:!0},{icon:Y,key:"ui.panel.lovelace.editor.menu.manage_dashboards",overflowAction:this._handleManageDashboards,visible:!1,overflow:!0},{icon:D,key:"ui.panel.lovelace.editor.menu.manage_resources",overflowAction:this._handleManageResources,visible:this._editMode&&this.hass.userData?.showAdvanced,overflow:!0},{icon:W,key:"ui.panel.lovelace.menu.search",buttonAction:this._showQuickBar,overflowAction:this._handleShowQuickBar,visible:!this._editMode,overflow:this.narrow},{icon:N,key:"ui.panel.lovelace.menu.assist",buttonAction:this._showVoiceCommandDialog,overflowAction:this._handleShowVoiceCommandDialog,visible:!this._editMode&&this._conversation(this.hass.config.components),overflow:this.narrow},{icon:O,key:"ui.common.refresh",overflowAction:this._handleRefresh,visible:!this._editMode&&this._yamlMode,overflow:!0},{icon:q,key:"ui.panel.lovelace.unused_entities.title",overflowAction:this._handleUnusedEntities,visible:!this._editMode&&this._yamlMode,overflow:!0},{icon:O,key:"ui.panel.lovelace.menu.reload_resources",overflowAction:this._handleReloadResources,visible:!this._editMode&&"yaml"===this.hass.panels.lovelace?.config?.mode,overflow:!0},{icon:j,key:"ui.panel.lovelace.menu.configure_ui",overflowAction:this._handleEnableEditMode,buttonAction:this._enableEditMode,visible:!this._editMode&&this.hass.user?.is_admin&&!this.hass.config.recovery_mode,overflow:!0,overflow_can_promote:!0}],i=t.filter((e=>e.visible&&e.overflow)),o=1===i.length&&i[0].overflow_can_promote;if(t.filter((e=>e.visible&&(!e.overflow||o))).forEach((t=>{e.push(n.dy`<ha-icon-button slot="actionItems" .label="${this.hass.localize(t.key)}" .path="${t.icon}" @click="${t.buttonAction}"></ha-icon-button>`)})),i.length&&!o){const t=[];i.forEach((e=>{t.push(n.dy`<mwc-list-item graphic="icon" @request-selected="${e.overflowAction}"> ${this.hass.localize(e.key)} <ha-svg-icon slot="graphic" .path="${e.icon}"></ha-svg-icon> </mwc-list-item>`)})),e.push(n.dy`<ha-button-menu slot="actionItems"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.panel.lovelace.editor.menu.open")}" .path="${R}"></ha-icon-button> ${t} </ha-button-menu>`)}return n.dy`${e}`}},{kind:"method",key:"render",value:function(){const e=this.lovelace?.config.views??[],t="number"==typeof this._curView?e[this._curView]:void 0,i=this.panel?(0,w._N)(this.hass,this.panel):void 0,o=t?.background||this.config.background;return n.dy` <div class="${(0,l.$)({"edit-mode":this._editMode})}"> <div class="header"> <div class="toolbar"> ${this._editMode?n.dy` <div class="main-title"> ${i||this.hass.localize("ui.panel.lovelace.editor.header")} <ha-icon-button slot="actionItems" .label="${this.hass.localize("ui.panel.lovelace.editor.edit_lovelace.edit_title")}" .path="${j}" class="edit-icon" @click="${this._editDashboard}"></ha-icon-button> </div> <div class="action-items">${this._renderActionItems()}</div> `:n.dy` ${t?.subview?n.dy` <ha-icon-button-arrow-prev slot="navigationIcon" @click="${this._goBack}"></ha-icon-button-arrow-prev> `:n.dy` <ha-menu-button slot="navigationIcon" .hass="${this.hass}" .narrow="${this.narrow}"></ha-menu-button> `} ${t?.subview?n.dy`<div class="main-title">${t.title}</div>`:e.filter((e=>!e.subview)).length>1?n.dy` <ha-tabs slot="title" scrollable .selected="${this._curView}" @iron-activate="${this._handleViewSelected}" dir="${(0,b.Zu)(this.hass)}"> ${e.map((e=>n.dy` <paper-tab aria-label="${(0,r.o)(e.title)}" class="${(0,l.$)({"hide-tab":Boolean(e.subview||void 0!==e.visible&&(Array.isArray(e.visible)&&!e.visible.some((e=>e.user===this.hass.user?.id))||!1===e.visible))})}"> ${e.icon?n.dy` <ha-icon title="${(0,r.o)(e.title)}" .icon="${e.icon}"></ha-icon> `:e.title||"Unnamed view"} </paper-tab> `))} </ha-tabs> `:n.dy` <div class="main-title"> ${e[0]?.title??i} </div> `} <div class="action-items">${this._renderActionItems()}</div> `} </div> ${this._editMode?n.dy` <paper-tabs scrollable .selected="${this._curView}" @iron-activate="${this._handleViewSelected}" dir="${(0,b.Zu)(this.hass)}"> ${e.map((t=>n.dy` <paper-tab aria-label="${(0,r.o)(t.title)}" class="${(0,l.$)({"hide-tab":Boolean(!this._editMode&&void 0!==t.visible&&(Array.isArray(t.visible)&&!t.visible.some((e=>e.user===this.hass.user?.id))||!1===t.visible))})}"> ${this._editMode?n.dy` <ha-icon-button-arrow-prev .hass="${this.hass}" .label="${this.hass.localize("ui.panel.lovelace.editor.edit_view.move_left")}" class="edit-icon view" @click="${this._moveViewLeft}" ?disabled="${0===this._curView}"></ha-icon-button-arrow-prev> `:""} ${t.icon?n.dy` <ha-icon class="${(0,l.$)({"child-view-icon":Boolean(t.subview)})}" title="${(0,r.o)(t.title)}" .icon="${t.icon}"></ha-icon> `:t.title||"Unnamed view"} ${this._editMode?n.dy` <ha-svg-icon title="${this.hass.localize("ui.panel.lovelace.editor.edit_view.edit")}" class="edit-icon view" .path="${j}" @click="${this._editView}"></ha-svg-icon> <ha-icon-button-arrow-next .hass="${this.hass}" .label="${this.hass.localize("ui.panel.lovelace.editor.edit_view.move_right")}" class="edit-icon view" @click="${this._moveViewRight}" ?disabled="${this._curView+1===e.length}"></ha-icon-button-arrow-next> `:""} </paper-tab> `))} ${this._editMode?n.dy` <ha-icon-button id="add-view" @click="${this._addView}" .label="${this.hass.localize("ui.panel.lovelace.editor.edit_view.add")}" .path="${Q}"></ha-icon-button> `:""} </paper-tabs> `:""} </div> <hui-view-container .hass="${this.hass}" .theme="${t?.theme}" id="view" @ll-rebuild="${this._debouncedConfigChanged}"> <hui-view-background .hass="${this.hass}" .background="${o}"> </hui-view-background> </hui-view-container> </div> `}},{kind:"field",key:"_handleWindowScroll",value(){return()=>{this.toggleAttribute("scrolled",0!==window.scrollY)}}},{kind:"field",key:"_handlePopState",value(){return()=>{this._restoreScroll=!0}}},{kind:"field",key:"_isVisible",value(){return e=>Boolean(this._editMode||void 0===e.visible||!0===e.visible||Array.isArray(e.visible)&&e.visible.some((e=>e.user===this.hass.user?.id)))}},{kind:"method",key:"_clearParam",value:function(e){window.history.replaceState(null,"",(0,f.q)((0,p.pc)(e)))}},{kind:"method",key:"firstUpdated",value:function(e){(0,a.Z)(o,"firstUpdated",this,3)([e]);const t=(0,p.Q2)();"1"===t.edit?(this._clearParam("edit"),this.hass.user?.is_admin&&"storage"===this.lovelace.mode&&this.lovelace.setEditMode(!0)):"1"===t.conversation&&(this._clearParam("conversation"),this._showVoiceCommandDialog()),window.addEventListener("scroll",this._handleWindowScroll,{passive:!0})}},{kind:"method",key:"connectedCallback",value:function(){(0,a.Z)(o,"connectedCallback",this,3)([]),window.addEventListener("scroll",this._handleWindowScroll,{passive:!0}),window.addEventListener("popstate",this._handlePopState),window.history.scrollRestoration="manual",this._unsubNotifications=(0,P.r)(this.hass.connection,(e=>{this._persistentNotifications=e?.length||0}))}},{kind:"method",key:"disconnectedCallback",value:function(){(0,a.Z)(o,"disconnectedCallback",this,3)([]),window.removeEventListener("scroll",this._handleWindowScroll),window.removeEventListener("popstate",this._handlePopState),this.toggleAttribute("scrolled",0!==window.scrollY),window.history.scrollRestoration="auto",this._unsubNotifications&&this._unsubNotifications()}},{kind:"method",key:"updated",value:function(e){(0,a.Z)(o,"updated",this,3)([e]);const t=this._viewRoot.lastChild;let i;e.has("hass")&&t&&(t.hass=this.hass),e.has("narrow")&&t&&(t.narrow=this.narrow);let n=!1,s=this.route.path.split("/")[1];if(s=s?decodeURI(s):void 0,e.has("route")){const e=this.config.views;if(!s&&e.length)i=e.findIndex(this._isVisible),this._navigateToView(e[i].path||i,!0);else if("hass-unused-entities"===s)i="hass-unused-entities";else if(s){const t=s,o=Number(t);let a=0;for(let i=0;i<e.length;i++)if(e[i].path===t||i===o){a=i;break}i=a}}if(e.has("lovelace")){const o=e.get("lovelace");if(o&&o.config===this.lovelace.config||(n=!0),!o||o.editMode!==this.lovelace.editMode){const e=this.config&&this.config.views;"storage"===this.lovelace.mode&&"hass-unused-entities"===s&&(i=e.findIndex(this._isVisible),this._navigateToView(e[i].path||i,!0))}!n&&t&&(t.lovelace=this.lovelace)}(void 0!==i||n)&&(n&&void 0===i&&(i=this._curView),(0,k.T)((()=>{if(e.has("route")){const e=this._restoreScroll&&this._viewScrollPositions[i]||0;this._restoreScroll=!1,requestAnimationFrame((()=>scrollTo({behavior:"auto",top:e})))}this._selectView(i,n)})))}},{kind:"method",key:"_renderNotificationButton",value:function(){return n.dy` <mwc-icon-button style="cursor:pointer;position:relative" label="${this.hass.localize("ui.notification_drawer.title")}" @click="${this._handleShowNotificationDrawer}"> <ha-svg-icon path="${G}"></ha-svg-icon> ${this._notificationsCount>0?n.dy` <span style="top:-4px;right:-6px;font-size:1rem;position:absolute;min-width:20px;box-sizing:border-box;border-radius:50%;font-weight:400;background-color:var(--accent-color);line-height:24px;text-align:center;padding:0 6px;color:var(--text-primary-color)"> ${this._notificationsCount} </span> `:""} </mwc-icon-button> `}},{kind:"get",key:"_notificationsCount",value:function(){const e=this.hass.states,t=Object.keys(e).filter((e=>"configurator"===e.substr(0,e.indexOf(".")))).map((t=>e[t])).length;return(this._persistentNotifications||0)+t}},{kind:"method",key:"_handleShowNotificationDrawer",value:function(){(0,T.d)(this,{narrow:this.narrow})}},{kind:"get",key:"config",value:function(){return this.lovelace.config}},{kind:"get",key:"_yamlMode",value:function(){return"yaml"===this.lovelace.mode}},{kind:"get",key:"_editMode",value:function(){return this.lovelace.editMode}},{kind:"get",key:"_viewRoot",value:function(){return this.shadowRoot.getElementById("view")}},{kind:"method",key:"_handleRefresh",value:function(e){(0,u.Q)(e)&&(0,h.B)(this,"config-refresh")}},{kind:"method",key:"_handleReloadResources",value:function(e){(0,u.Q)(e)&&(this.hass.callService("lovelace","reload_resources"),(0,_.showConfirmationDialog)(this,{title:this.hass.localize("ui.panel.lovelace.reload_resources.refresh_header"),text:this.hass.localize("ui.panel.lovelace.reload_resources.refresh_body"),confirmText:this.hass.localize("ui.common.refresh"),dismissText:this.hass.localize("ui.common.not_now"),confirm:()=>location.reload()}))}},{kind:"method",key:"_handleShowQuickBar",value:function(e){(0,u.Q)(e)&&this._showQuickBar()}},{kind:"method",key:"_showQuickBar",value:function(){(0,x.Hk)(this,{mode:x.Ie.Entity,hint:this.hass.enableShortcuts?this.hass.localize("ui.tips.key_e_hint"):void 0})}},{kind:"method",key:"_goBack",value:function(){const e=this.lovelace?.config.views??[],t="number"==typeof this._curView?e[this._curView]:void 0;null!=t?.back_path?(0,v.c)(t.back_path,{replace:!0}):history.length>1?history.back():e[0].subview?(0,v.c)("/"):(0,v.c)(this.route.prefix,{replace:!0})}},{kind:"method",key:"_handleRawEditor",value:function(e){(0,u.Q)(e)&&this.lovelace.enableFullEditMode()}},{kind:"method",key:"_handleManageDashboards",value:function(e){(0,u.Q)(e)&&(0,v.c)("/config/lovelace/dashboards")}},{kind:"method",key:"_handleManageResources",value:function(e){(0,u.Q)(e)&&(0,v.c)("/config/lovelace/resources")}},{kind:"method",key:"_handleUnusedEntities",value:function(e){(0,u.Q)(e)&&(0,v.c)(`${this.route?.prefix}/hass-unused-entities`)}},{kind:"method",key:"_handleShowVoiceCommandDialog",value:function(e){(0,u.Q)(e)&&this._showVoiceCommandDialog()}},{kind:"method",key:"_showVoiceCommandDialog",value:function(){(0,C._)(this,this.hass,{pipeline_id:"last_used"})}},{kind:"method",key:"_handleEnableEditMode",value:function(e){(0,u.Q)(e)&&this._enableEditMode()}},{kind:"method",key:"_enableEditMode",value:async function(){if(this._yamlMode)(0,_.showAlertDialog)(this,{text:this.hass.localize("ui.panel.lovelace.editor.yaml_unsupported")});else if(!(0,m.Tx)(this.lovelace.rawConfig)||(0,E.ug)(this.lovelace.rawConfig.strategy))this.lovelace.setEditMode(!0);else{const e=await(0,z.lN)("dashboard",this.lovelace.rawConfig.strategy.type).catch((e=>{}));if(e?.noEditor)return void(0,A.Z)(this,{lovelace:this.lovelace,mode:"storage",narrow:this.narrow});const t=this.route?.prefix.slice(1);await this.hass.loadFragmentTranslation("config");const i=(await(0,y.j2)(this.hass)).find((e=>e.url_path===t));(0,L.L)(this,{config:this.lovelace.rawConfig,saveConfig:this.lovelace.saveConfig,takeControl:()=>{(0,A.Z)(this,{lovelace:this.lovelace,mode:"storage",narrow:this.narrow})},deleteDashboard:async()=>{if(!await(0,_.showConfirmationDialog)(this,{title:this.hass.localize("ui.panel.config.lovelace.dashboards.confirm_delete_title",{dashboard_title:i.title}),text:this.hass.localize("ui.panel.config.lovelace.dashboards.confirm_delete_text"),confirmText:this.hass.localize("ui.common.delete"),destructive:!0}))return!1;try{return await(0,y.iM)(this.hass,i.id),!0}catch(e){return!1}}})}}},{kind:"method",key:"_editModeDisable",value:function(){this.lovelace.setEditMode(!1)}},{kind:"method",key:"_editDashboard",value:async function(){const e=this.route?.prefix.slice(1);await this.hass.loadFragmentTranslation("config");const t=(await(0,y.j2)(this.hass)).find((t=>t.url_path===e));(0,M.w)(this,{dashboard:t,urlPath:e,updateDashboard:async e=>{await(0,y.Y)(this.hass,t.id,e)},removeDashboard:async()=>{if(!await(0,_.showConfirmationDialog)(this,{title:this.hass.localize("ui.panel.config.lovelace.dashboards.confirm_delete_title",{dashboard_title:t.title}),text:this.hass.localize("ui.panel.config.lovelace.dashboards.confirm_delete_text"),confirmText:this.hass.localize("ui.common.delete"),destructive:!0}))return!1;try{return await(0,y.iM)(this.hass,t.id),!0}catch(e){return!1}}})}},{kind:"method",key:"_navigateToView",value:function(e,t){const i=this.lovelace.editMode?`${this.route.prefix}/${e}?${(0,p.j4)({edit:"1"})}`:`${this.route.prefix}/${e}${location.search}`;`${location.pathname}${location.search}`!==i&&(0,v.c)(i,{replace:t})}},{kind:"method",key:"_editView",value:function(){(0,S.k)(this,{lovelace:this.lovelace,viewIndex:this._curView,saveCallback:(e,t)=>{const i=t.path||e;this._navigateToView(i)}})}},{kind:"method",key:"_moveViewLeft",value:function(e){if(e.stopPropagation(),0===this._curView)return;const t=this.lovelace,i=this._curView,o=this._curView-1;this._curView=o,this.config.views[i].path||this._navigateToView(o,!0),t.saveConfig((0,H.mA)(t.config,i,o))}},{kind:"method",key:"_moveViewRight",value:function(e){if(e.stopPropagation(),this._curView+1===this.lovelace.config.views.length)return;const t=this.lovelace,i=this._curView,o=this._curView+1;this._curView=o,this.config.views[i].path||this._navigateToView(o,!0),t.saveConfig((0,H.mA)(t.config,i,o))}},{kind:"method",key:"_addView",value:function(){(0,S.k)(this,{lovelace:this.lovelace,saveCallback:(e,t)=>{const i=t.path||e;this._navigateToView(i)}})}},{kind:"method",key:"_handleViewSelected",value:function(e){e.preventDefault();const t=e.detail.selected;if(t!==this._curView){const e=this.config.views[t].path||t;this._navigateToView(e)}else this._editMode||scrollTo({behavior:"smooth",top:0})}},{kind:"method",key:"_selectView",value:function(e,t){if(!t&&this._curView===e)return;null!=this._curView&&(this._viewScrollPositions[this._curView]=window.scrollY),e=void 0===e?0:e,this._curView=e,t&&(this._viewCache={},this._viewScrollPositions={});const o=this._viewRoot;if(o.lastChild&&o.removeChild(o.lastChild),"hass-unused-entities"===e){const e=document.createElement("hui-unused-entities");return Promise.all([i.e("46379"),i.e("41103"),i.e("58529"),i.e("52876"),i.e("69642")]).then(i.bind(i,39507)).then((()=>{e.hass=this.hass,e.lovelace=this.lovelace,e.narrow=this.narrow})),void o.appendChild(e)}let a;this.config.views[e]?(!t&&this._viewCache[e]?a=this._viewCache[e]:(a=document.createElement("hui-view"),a.index=e,this._viewCache[e]=a),a.lovelace=this.lovelace,a.hass=this.hass,a.narrow=this.narrow,o.appendChild(a)):this.lovelace.setEditMode(!0)}},{kind:"get",static:!0,key:"styles",value:function(){return[$.Qx,n.iv`:host{-ms-user-select:none;-webkit-user-select:none;-moz-user-select:none}.header{background-color:var(--app-header-background-color);color:var(--app-header-text-color,#fff);border-bottom:var(--app-header-border-bottom,none);position:fixed;top:0;width:var(--mdc-top-app-bar-width,100%);-webkit-backdrop-filter:var(--app-header-backdrop-filter,none);backdrop-filter:var(--app-header-backdrop-filter,none);padding-top:env(safe-area-inset-top);z-index:4;transition:box-shadow .2s linear}:host([scrolled]) .header{box-shadow:var(--mdc-top-app-bar-fixed-box-shadow,0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12))}.edit-mode .header{background-color:var(--app-header-edit-background-color,#455a64);color:var(--app-header-edit-text-color,#fff)}.toolbar{height:var(--header-height);display:flex;align-items:center;font-size:20px;padding:0px 12px;font-weight:400;box-sizing:border-box}@media (max-width:599px){.toolbar{padding:0 4px}}.main-title{margin:var(--margin-title);line-height:20px;flex-grow:1}.action-items{white-space:nowrap;display:flex;align-items:center}ha-tabs{width:100%;height:100%;margin-left:4px;margin-inline-start:4px;margin-inline-end:initial}ha-tabs,paper-tabs{--paper-tabs-selection-bar-color:var( --app-header-selection-bar-color, var(--app-header-text-color, #fff) );text-transform:uppercase}.edit-mode div[main-title]{pointer-events:auto}.edit-mode paper-tabs{background-color:var(--app-header-edit-background-color,#455a64);color:var(--app-header-edit-text-color,#fff)}paper-tab.iron-selected .edit-icon{display:inline-flex}.edit-icon{color:var(--accent-color);padding-left:8px;padding-inline-start:8px;vertical-align:middle;--mdc-theme-text-disabled-on-light:var(--disabled-text-color);direction:var(--direction)}.edit-icon.view{display:none}#add-view{position:absolute;height:44px}#add-view ha-svg-icon{background-color:var(--accent-color);border-radius:4px}a{color:var(--text-primary-color,#fff)}mwc-button.warning:not([disabled]){color:var(--error-color)}hui-view-container{position:relative;display:flex;min-height:100vh;box-sizing:border-box;padding-top:calc(var(--header-height) + env(safe-area-inset-top));padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right);padding-inline-start:env(safe-area-inset-left);padding-inline-end:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom)}hui-view-container>*{flex:1 1 100%;max-width:100%}.edit-mode hui-view-container{padding-top:calc(var(--header-height) + 48px + env(safe-area-inset-top))}.hide-tab{display:none}.menu-link{text-decoration:none}.exit-edit-mode{--mdc-theme-primary:var(--app-header-edit-text-color, #fff);--mdc-button-outline-color:var(--app-header-edit-text-color, #fff);--mdc-typography-button-font-size:14px}.child-view-icon{opacity:.5}`]}}]}}),n.oi);t()}catch(e){t(e)}}))},62504:function(e,t,i){var o=i(44249),a=i(72621),n=i(57243),s=i(15093);(0,o.Z)([(0,s.Mo)("hui-view-background")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"background",value:void 0},{kind:"method",key:"render",value:function(){return n.Ld}},{kind:"method",key:"_applyTheme",value:function(){const e=getComputedStyle(this).getPropertyValue("--lovelace-background"),t=this._isFixedBackground(this.background||e),i=this._computeBackgroundProperty(this.background);this.toggleAttribute("fixed-background",t),this.style.setProperty("--view-background",i);const o=this._computeBackgroundOpacityProperty(this.background);this.style.setProperty("--view-background-opacity",o)}},{kind:"method",key:"_isFixedBackground",value:function(e){return"string"==typeof e?e.split(" ").includes("fixed"):"object"==typeof e&&"fixed"===e.attachment}},{kind:"method",key:"_computeBackgroundProperty",value:function(e){if("object"==typeof e&&e.image){return`${e.alignment??"center"} / ${e.size??"cover"} ${e.repeat??"no-repeat"} url('${this.hass.hassUrl(e.image)}')`}return"string"==typeof e?e:null}},{kind:"method",key:"_computeBackgroundOpacityProperty",value:function(e){return"object"==typeof e&&e.image&&e.opacity?`${e.opacity}%`:null}},{kind:"method",key:"willUpdate",value:function(e){if((0,a.Z)(i,"willUpdate",this,3)([e]),e.has("hass")&&this.hass){const t=e.get("hass");if(!t||this.hass.themes!==t.themes||this.hass.selectedTheme!==t.selectedTheme)return void this._applyTheme()}e.has("background")&&this._applyTheme()}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`:host([fixed-background]){display:block;z-index:-1;position:fixed;background-attachment:scroll!important}:host(:not([fixed-background])){z-index:-1;position:absolute}:host{top:0;left:0;right:0;bottom:0;height:100%;width:100%;background:var(--view-background,var(--lovelace-background,var(--primary-background-color)));opacity:var(--view-background-opacity)}`}]}}),n.oi)},73192:function(e,t,i){i.d(t,{R:()=>o});const o=(e,t)=>`https://www.iobroker.net/#${e.language&&e.language.split("-")[0]||"en"}/adapters/adapterref/iobroker.lovelace/README.md#`}}; //# sourceMappingURL=74763.0c05386f05bde19a.js.map