iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
4 lines • 21.8 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[30424],{93421:function(t,e,i){i.d(e,{IW:function(){return h},dH:function(){return c},fI:function(){return l}});i(44114),i(62953);var o=i(35211),a=i(22792),s=i(32172);const r=(t,e)=>{let i=t;for(const o of e){if(null==i)return;i=i[o]}return i},n=(t,e,i)=>{const a=(0,s.p)({transformer:function(t){return i.call(this,t)},watch:e?[e]:[]}),r=(0,o.Fg)({context:t,subscribe:!0});return(t,e)=>{a(t,e),r(t,e)}},l=t=>n(a.iN,t.entityIdPath[0],function(e){const i=r(this,t.entityIdPath);return"string"==typeof i?null==e?void 0:e[i]:void 0}),c=t=>n(a.X1,t.entityIdPath[0],function(e){const i=r(this,t.entityIdPath);return"string"==typeof i?null==e?void 0:e[i]:void 0}),h=()=>n(a.D5,void 0,({localize:t})=>t)},32172:function(t,e,i){i.d(e,{p:function(){return o}});i(16280),i(18111),i(7588),i(45367),i(92731),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);function o(t){return(e,i)=>{if("object"==typeof i)throw new Error("This decorator does not support this compilation type.");const o=String(i),a=e;if(a._transformers){if(!a.hasOwnProperty("_transformers")){const t=a._transformers;a._transformers=new Map,t.forEach((t,e)=>a._transformers.set(e,t))}}else{a._transformers=new Map,a._watching=new Map;const t=a.willUpdate;a.willUpdate=function(e){t.call(this,e);const i=new Set;e.forEach((t,e)=>{const o=this._watching.get(e);void 0!==o&&o.forEach(t=>i.add(t))}),i.forEach(t=>{this[t]=this[`__original_${String(t)}`]})}}a._transformers.set(i,t.transformer),t.watch&&t.watch.forEach(t=>{let e=a._watching.get(t);e||(e=new Set,a._watching.set(t,e)),e.add(i)});const s=Object.getOwnPropertyDescriptor(e,i);let r;if(void 0===s)r={get(){return this[`__transform_${o}`]},set(t){const e=this[`__transform_${o}`],i=this._transformers.get(o);this[`__transform_${o}`]=i?i.call(this,t):t,this[`__original_${o}`]=t,this.requestUpdate(o,e)},configurable:!0,enumerable:!0};else{const t=s.set;r=Object.assign(Object.assign({},s),{},{set(e){const i=this[`__transform_${o}`],a=this._transformers.get(o);this[`__transform_${o}`]=a?a.call(this,e):e,this[`__original_${o}`]=e,this.requestUpdate(o,i),null==t||t.call(this,e)}})}Object.defineProperty(e,i,r)}}},38962:function(t,e,i){i.a(t,async function(t,o){try{i.r(e);i(62953);var a=i(40445),s=i(5124),r=i(67576),n=i(6412),l=i(93421),c=i(1087),h=i(26300),d=(i(67094),t([h]));h=(d.then?(await d)():d)[0];let p,u,g,v,f=t=>t;const y="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",b={info:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z",warning:"M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16",error:"M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z",success:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2,4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"};class w extends s.WF{render(){var t;return(0,s.qy)(p||(p=f` <div class="issue-type ${0}" role="alert"> <div class="icon ${0}"> <slot name="icon"> <ha-svg-icon .path="${0}"></ha-svg-icon> </slot> </div> <div class="${0}"> <div class="main-content"> ${0} <slot></slot> </div> <div class="action"> <slot name="action"> ${0} </slot> </div> </div> </div> `),(0,n.H)({[this.alertType]:!0}),this.title?"":"no-title",b[this.alertType],(0,n.H)({content:!0,narrow:this.narrow}),this.title?(0,s.qy)(u||(u=f`<div class="title">${0}</div>`),this.title):s.s6,this.dismissable?(0,s.qy)(g||(g=f`<ha-icon-button ="${0}" .label="${0}" .path="${0}"></ha-icon-button>`),this._dismissClicked,null===(t=this._localize)||void 0===t?void 0:t.call(this,"ui.common.dismiss_alert"),y):s.s6)}_dismissClicked(){(0,c.r)(this,"alert-dismissed-clicked")}constructor(...t){super(...t),this.title="",this.alertType="info",this.dismissable=!1,this.narrow=!1}}w.styles=(0,s.AH)(v||(v=f`.issue-type{position:relative;padding:8px;display:flex}.icon{height:var(--ha-alert-icon-size,24px);width:var(--ha-alert-icon-size,24px)}.issue-type::after{position:absolute;top:0;right:0;bottom:0;left:0;opacity:.12;pointer-events:none;content:"";border-radius:var(--ha-border-radius-sm)}.icon.no-title{align-self:center}.content{display:flex;justify-content:space-between;align-items:center;width:100%;text-align:var(--float-start)}.content.narrow{flex-direction:column;align-items:flex-end}.action{z-index:1;width:min-content;--mdc-theme-primary:var(--primary-text-color)}.main-content{overflow-wrap:anywhere;word-break:break-word;line-height:normal;margin-left:8px;margin-right:0;margin-inline-start:8px;margin-inline-end:8px}.title{margin-top:2px;font-weight:var(--ha-font-weight-bold)}.action ha-icon-button{--mdc-theme-primary:var(--primary-text-color);--ha-icon-button-size:36px}.issue-type.info>.icon{color:var(--info-color)}.issue-type.info::after{background-color:var(--info-color)}.issue-type.warning>.icon{color:var(--warning-color)}.issue-type.warning::after{background-color:var(--warning-color)}.issue-type.error>.icon{color:var(--error-color)}.issue-type.error::after{background-color:var(--error-color)}.issue-type.success>.icon{color:var(--success-color)}.issue-type.success::after{background-color:var(--success-color)}:host ::slotted(ul){margin:0;padding-inline-start:20px}`)),(0,a.Cg)([(0,r.MZ)()],w.prototype,"title",void 0),(0,a.Cg)([(0,r.MZ)({attribute:"alert-type"})],w.prototype,"alertType",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],w.prototype,"dismissable",void 0),(0,a.Cg)([(0,r.wk)(),(0,l.IW)()],w.prototype,"_localize",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],w.prototype,"narrow",void 0),w=(0,a.Cg)([(0,r.EM)("ha-alert")],w),o()}catch(p){o(p)}})},90248:function(t,e,i){i.a(t,async function(t,o){try{i.r(e),i.d(e,{HaIconButtonArrowPrev:function(){return g}});i(62953);var a=i(40445),s=i(5124),r=i(67576),n=i(63091),l=i(26300),c=t([l]);l=(c.then?(await c)():c)[0];let h,d=t=>t;const p="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z",u="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z";class g extends s.WF{render(){var t;return(0,s.qy)(h||(h=d` <ha-icon-button .disabled="${0}" .label="${0}" .path="${0}" .href="${0}" .target="${0}" .rel="${0}" .download="${0}"></ha-icon-button> `),this.disabled,this.label||(null===(t=this.hass)||void 0===t?void 0:t.localize("ui.common.back"))||"Back",this._icon,this.href,this.target,this.rel,this.download)}constructor(...t){super(...t),this.disabled=!1,this._icon="rtl"===n.G.document.dir?u:p}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],g.prototype,"disabled",void 0),(0,a.Cg)([(0,r.MZ)()],g.prototype,"label",void 0),(0,a.Cg)([(0,r.MZ)()],g.prototype,"href",void 0),(0,a.Cg)([(0,r.MZ)()],g.prototype,"target",void 0),(0,a.Cg)([(0,r.MZ)()],g.prototype,"rel",void 0),(0,a.Cg)([(0,r.MZ)()],g.prototype,"download",void 0),(0,a.Cg)([(0,r.wk)()],g.prototype,"_icon",void 0),g=(0,a.Cg)([(0,r.EM)("ha-icon-button-arrow-prev")],g),o()}catch(h){o(h)}})},26300:function(t,e,i){i.a(t,async function(t,o){try{i.r(e),i.d(e,{HaIconButton:function(){return v}});i(62953);var a=i(40445),s=i(5124),r=i(67576),n=i(63672),l=i(18350),c=(i(67094),t([l]));l=(c.then?(await c)():c)[0];let h,d,p,u,g=t=>t;class v extends s.WF{render(){return(0,s.qy)(h||(h=g` <ha-button appearance="plain" variant="neutral" aria-label="${0}" title="${0}" aria-haspopup="${0}" .disabled="${0}" .iconTag="${0}" .href="${0}" .target="${0}" .rel="${0}" .download="${0}"> ${0} </ha-button> `),(0,n.J)(this.label),(0,n.J)(this.hideTitle?void 0:this.label),(0,n.J)(this.ariaHasPopup),this.disabled,this.path?"ha-svg-icon":"span",this.href,this.target,this.rel,this.download,this.path?(0,s.qy)(d||(d=g`<ha-svg-icon aria-hidden="true" .path="${0}"></ha-svg-icon>`),this.path):(0,s.qy)(p||(p=g`<span><slot></slot></span>`)))}constructor(...t){super(...t),this.disabled=!1,this.hideTitle=!1,this.selected=!1}}v.shadowRootOptions={mode:"open",delegatesFocus:!0},v.styles=(0,s.AH)(u||(u=g`:host{display:inline-block;outline:0;--ha-button-height:var(--ha-icon-button-size, 48px)}ha-button{position:relative;isolation:isolate;--wa-form-control-padding-inline:var(
--ha-icon-button-padding-inline,
--ha-space-2
);--wa-color-on-normal:currentColor;--wa-color-fill-quiet:transparent;--ha-button-label-overflow:visible}ha-button::after{content:"";position:absolute;inset:0;z-index:-1;border-radius:50%;background-color:currentColor;opacity:0;pointer-events:none}ha-button::part(base){width:var(--wa-form-control-height);aspect-ratio:1;outline-offset:-4px}ha-button::part(label){display:flex}:host([selected]) ha-button::after{opacity:.1} (hover:hover){:host(:hover:not([disabled])) ha-button::after{opacity:.1}}`)),(0,a.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],v.prototype,"disabled",void 0),(0,a.Cg)([(0,r.MZ)({type:String})],v.prototype,"path",void 0),(0,a.Cg)([(0,r.MZ)({type:String})],v.prototype,"label",void 0),(0,a.Cg)([(0,r.MZ)({type:String,attribute:"aria-haspopup"})],v.prototype,"ariaHasPopup",void 0),(0,a.Cg)([(0,r.MZ)({attribute:"hide-title",type:Boolean})],v.prototype,"hideTitle",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],v.prototype,"selected",void 0),(0,a.Cg)([(0,r.MZ)()],v.prototype,"href",void 0),(0,a.Cg)([(0,r.MZ)()],v.prototype,"target",void 0),(0,a.Cg)([(0,r.MZ)()],v.prototype,"rel",void 0),(0,a.Cg)([(0,r.MZ)()],v.prototype,"download",void 0),v=(0,a.Cg)([(0,r.EM)("ha-icon-button")],v),o()}catch(h){o(h)}})},2054:function(t,e,i){i.a(t,async function(t,e){try{i(16280),i(62953);var o=i(40445),a=i(5124),s=i(67576),r=i(1087),n=i(44249),l=i(26300),c=t([l]);l=(c.then?(await c)():c)[0];let h,d,p,u=t=>t;const g="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z";class v extends a.WF{connectedCallback(){super.connectedCallback(),this._attachNotifOnConnect&&(this._attachNotifOnConnect=!1,this._subscribeNotifications())}disconnectedCallback(){super.disconnectedCallback(),this._unsubNotifications&&(this._attachNotifOnConnect=!0,this._unsubNotifications(),this._unsubNotifications=void 0)}render(){if(!this._show)return a.s6;const t=this._hasNotifications&&(this.narrow||"always_hidden"===this.hass.dockedSidebar);return(0,a.qy)(h||(h=u` <ha-icon-button .label="${0}" .path="${0}" ="${0}"></ha-icon-button> ${0} `),this.hass.localize("ui.sidebar.sidebar_toggle"),g,this._toggleMenu,t?(0,a.qy)(d||(d=u`<div class="dot"></div>`)):"")}willUpdate(t){if(super.willUpdate(t),!t.has("narrow")&&!t.has("hass"))return;const e=t.has("hass")?t.get("hass"):this.hass,i=t.has("narrow")?t.get("narrow"):this.narrow,o=!1===(null==e?void 0:e.kioskMode)&&(i||"always_hidden"===(null==e?void 0:e.dockedSidebar)),a=!1===this.hass.kioskMode&&(this.narrow||"always_hidden"===this.hass.dockedSidebar);this.hasUpdated&&o===a||(this._show=a||this._alwaysVisible,a?this._subscribeNotifications():this._unsubNotifications&&(this._unsubNotifications(),this._unsubNotifications=void 0))}_subscribeNotifications(){if(this._unsubNotifications)throw new Error("Already subscribed");this._unsubNotifications=(0,n.V)(this.hass.connection,t=>{this._hasNotifications=t.length>0})}_toggleMenu(){(0,r.r)(this,"hass-toggle-menu")}constructor(...t){super(...t),this.narrow=!1,this._hasNotifications=!1,this._show=!1,this._alwaysVisible=!1,this._attachNotifOnConnect=!1}}v.styles=(0,a.AH)(p||(p=u`:host{position:relative}.dot{pointer-events:none;position:absolute;background-color:var(--accent-color);width:12px;height:12px;top:9px;right:7px;inset-inline-end:7px;inset-inline-start:initial;border-radius:var(--ha-border-radius-circle);border:2px solid var(--app-header-background-color)}`)),(0,o.Cg)([(0,s.MZ)({type:Boolean})],v.prototype,"narrow",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,o.Cg)([(0,s.wk)()],v.prototype,"_hasNotifications",void 0),(0,o.Cg)([(0,s.wk)()],v.prototype,"_show",void 0),v=(0,o.Cg)([(0,s.EM)("ha-menu-button")],v),e()}catch(h){e(h)}})},67094:function(t,e,i){i.r(e),i.d(e,{HaSvgIcon:function(){return d}});var o=i(40445),a=i(5124),s=i(67576);let r,n,l,c,h=t=>t;class d extends a.WF{render(){return(0,a.JW)(r||(r=h` <svg viewBox="${0}" preserveAspectRatio="xMidYMid meet" focusable="false" role="img" aria-hidden="true"> <g> ${0} ${0} </g> </svg>`),this.viewBox||"0 0 24 24",this.path?(0,a.JW)(n||(n=h`<path class="primary-path" d="${0}"></path>`),this.path):a.s6,this.secondaryPath?(0,a.JW)(l||(l=h`<path class="secondary-path" d="${0}"></path>`),this.secondaryPath):a.s6)}}d.styles=(0,a.AH)(c||(c=h`:host{display:var(--ha-icon-display,inline-flex);align-items:center;justify-content:center;position:relative;vertical-align:middle;fill:var(--icon-primary-color,currentcolor);width:var(--mdc-icon-size,24px);height:var(--mdc-icon-size,24px)}svg{width:100%;height:100%;pointer-events:none;display:block}path.primary-path{opacity:var(--icon-primary-opactity, 1)}path.secondary-path{fill:var(--icon-secondary-color,currentcolor);opacity:var(--icon-secondary-opactity, .5)}`)),(0,o.Cg)([(0,s.MZ)()],d.prototype,"path",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],d.prototype,"secondaryPath",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],d.prototype,"viewBox",void 0),d=(0,o.Cg)([(0,s.EM)("ha-svg-icon")],d)},27330:function(t,e,i){i.d(e,{L:function(){return b},p:function(){return y}});i(62953);var o=i(40445),a=i(5124),s=i(67576),r=i(6412);let n,l,c,h,d,p,u,g,v=t=>t;const f={passive:!0},y=(0,a.AH)(n||(n=v`:host{display:block}.top-app-bar{box-sizing:border-box;color:var(--app-header-text-color,#fff);background-color:var(--app-header-background-color,var(--primary-color));position:fixed;top:0;inset-inline-end:0;width:var(--ha-top-app-bar-width,100%);z-index:4;padding-top:var(--safe-area-inset-top);padding-right:var(--safe-area-inset-right);transition:box-shadow var(--ha-animation-duration-normal) ease,width var(--ha-animation-duration-normal) ease,padding-left var(--ha-animation-duration-normal) ease,padding-right var(--ha-animation-duration-normal) ease}:host([narrow]) .top-app-bar{padding-left:var(--safe-area-inset-left)}.top-app-bar.scrolled:not(.pane-header){box-shadow:var(--ha-box-shadow-s)}.row{display:flex;align-items:center;box-sizing:border-box;width:100%;height:var(--header-height);border-bottom:var(--app-header-border-bottom)}.section{display:flex;align-items:center;box-sizing:border-box;min-width:0;height:100%;padding:0 var(--ha-space-3)}#navigation{flex:1 1 auto}.section.center{flex:1 1 auto;justify-content:center;text-align:center}.section.end{flex:none;justify-content:flex-end}.title{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-normal);line-height:var(--header-height);padding-inline-start:var(--ha-space-6)}:host([narrow]) .title{padding-inline-start:var(--ha-space-2)}.top-app-bar-fixed-adjust{padding-top:calc(var(--header-height,0px) + var(--safe-area-inset-top,0px));padding-bottom:var(--safe-area-inset-bottom);padding-right:var(--safe-area-inset-right)}:host([narrow]) .top-app-bar-fixed-adjust{padding-left:var(--safe-area-inset-left)}`));class b extends a.WF{get scrollTarget(){return this._scrollTarget||window}set scrollTarget(t){const e=this.scrollTarget;this._unregisterListeners(),this._scrollTarget=t,this._updateBarPosition(),this.requestUpdate("scrollTarget",e),this.isConnected&&(this._registerListeners(),this._syncScrollState())}_isPaneHeader(){return!1}render(){return(0,a.qy)(l||(l=v`${0}${0}`),this._renderHeader(),this._renderContent())}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this._updateBarPosition(),this._registerListeners(),this._syncScrollState())}_renderHeader(){const t=(0,a.qy)(c||(c=v`<span class="title"> <slot name="title"></slot> </span>`)),e=this._isPaneHeader();return(0,a.qy)(h||(h=v` <header class="top-app-bar ${0}"> <div class="row"> ${0} <section class="section" id="navigation"> ${0} </section> ${0} <section class="section end" id="actions" role="toolbar"> <slot name="actionItems"></slot> </section> </div> </header> `),(0,r.H)({"pane-header":e}),e?(0,a.qy)(d||(d=v`<section class="section" id="title"> <slot name="navigationIcon"></slot> ${0} </section>`),t):a.s6,e?a.s6:(0,a.qy)(p||(p=v`<slot name="navigationIcon"></slot> ${0}`),this.centerTitle?a.s6:t),!e&&this.centerTitle?(0,a.qy)(u||(u=v`<section class="section center">${0}</section>`),t):a.s6)}_renderContent(){return(0,a.qy)(g||(g=v`<div class="top-app-bar-fixed-adjust"> <slot></slot> </div>`))}firstUpdated(t){super.firstUpdated(t),this._updateBarPosition(),this._registerListeners(),this._syncScrollState()}disconnectedCallback(){super.disconnectedCallback(),this._unregisterListeners()}_updateBarPosition(){this._barElement&&(this._barElement.style.position=this.scrollTarget===window?"":"absolute")}_registerListeners(){this.scrollTarget.addEventListener("scroll",this._syncScrollState,f)}_unregisterListeners(){this.scrollTarget.removeEventListener("scroll",this._syncScrollState)}constructor(...t){super(...t),this.narrow=!1,this.centerTitle=!1,this._syncScrollState=()=>{var t;const e=this.scrollTarget instanceof Window?this.scrollTarget.pageYOffset:this.scrollTarget.scrollTop;null===(t=this._barElement)||void 0===t||t.classList.toggle("scrolled",e>0)}}}b.styles=y,(0,o.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],b.prototype,"narrow",void 0),(0,o.Cg)([(0,s.MZ)({attribute:"center-title",type:Boolean})],b.prototype,"centerTitle",void 0),(0,o.Cg)([(0,s.P)(".top-app-bar")],b.prototype,"_barElement",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],b.prototype,"scrollTarget",null),b=(0,o.Cg)([(0,s.EM)("ha-top-app-bar-fixed")],b)},44249:function(t,e,i){i.d(e,{V:function(){return o}});i(62953);const o=(t,e)=>{const i=new a,o=t.subscribeMessage(t=>e(i.processMessage(t)),{type:"persistent_notification/subscribe"});return()=>{o.then(t=>null==t?void 0:t())}};class a{processMessage(t){if("removed"===t.type)for(const e of Object.keys(t.notifications))delete this.notifications[e];else this.notifications=Object.assign(Object.assign({},this.notifications),t.notifications);return Object.values(this.notifications)}constructor(){this.notifications={}}}},4203:function(t,e,i){i.a(t,async function(t,o){try{i.r(e);i(74423),i(18111),i(61701),i(3362),i(27495),i(62953),i(48408),i(14603),i(47566),i(98721);var a=i(40445),s=i(5124),r=i(67576),n=i(91926),l=i(38962),c=i(90248),h=i(2054),d=(i(27330),i(14503)),p=i(15656),u=i(29994),g=i(75400),v=(i(87778),t([l,c,h,u,g]));[l,c,h,u,g]=v.then?(await v)():v;let f,y,b,w,_=t=>t;class m extends s.WF{willUpdate(t){if(super.willUpdate(t),!this.hasUpdated)return void this._setup();if(!t.has("hass"))return;const e=t.get("hass");this._lovelace&&e&&e.localize!==this.hass.localize&&this._setLovelace()}async _setup(){await Promise.all([this.hass.loadFragmentTranslation("lovelace"),this.hass.loadFragmentTranslation("energy")]),this._loadConfig()}async _loadConfig(){var t;try{this._error=void 0,await this._setLovelace()}catch(o){return console.error("Failed to load energy config:",o),void(this._error=o.message||"Unknown error")}const e=((null===(t=this._lovelace.config)||void 0===t?void 0:t.views)||[]).map(t=>t.path),i=this.route.path.split("/")[1];i&&e.includes(i)?this.route=Object.assign({},this.route):(0,n.oo)(`${this.route.prefix}/${e[0]}`,{replace:!0})}async _setLovelace(){const t=await(0,p.uN)({strategy:{type:"energy"}},this.hass);this._lovelace={config:t,rawConfig:t,editMode:!1,urlPath:"energy",mode:"generated",locale:this.hass.locale,enableFullEditMode:()=>{},saveConfig:async()=>{},deleteConfig:async()=>{},setEditMode:()=>this._navigateConfig(),showToast:()=>{}}}render(){return this._error?(0,s.qy)(f||(f=_` <div class="centered"> <ha-alert alert-type="error"> ${0} </ha-alert> </div> `),this.hass.localize("ui.panel.energy.error_loading_preferences",{error:this._error})):this._lovelace?(0,s.qy)(b||(b=_` <hui-root .hass="${0}" .narrow="${0}" .lovelace="${0}" .route="${0}" .panel="${0}" .backButton="${0}" .backPath="${0}" -energy-panel="${0}"> </hui-root> `),this.hass,this.narrow,this._lovelace,this.route,this.panel,this._searchParms.has("historyBack"),this._searchParms.get("backPath")||"/",this._reloadConfig):(0,s.qy)(y||(y=_` <div class="centered"> <ha-spinner size="large"></ha-spinner> </div> `))}_navigateConfig(t){var e;null==t||t.stopPropagation();const i={overview:"electricity",electricity:"electricity",gas:"gas",water:"water",now:"electricity"}[(null===(e=this.route)||void 0===e||null===(e=e.path)||void 0===e?void 0:e.split("/")[1])||""]||"electricity";(0,n.oo)(`/config/energy/${i}?historyBack=1`)}_reloadConfig(){this._loadConfig()}static get styles(){return[d.RF,(0,s.AH)(w||(w=_`:host{--ha-view-sections-column-max-width:100%;-ms-user-select:none;-webkit-user-select:none;-moz-user-select:none}.centered{width:100%;height:100%;display:flex;align-items:center;justify-content:center}`))]}constructor(...t){super(...t),this.narrow=!1,this._searchParms=new URLSearchParams(window.location.search)}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],m.prototype,"narrow",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],m.prototype,"panel",void 0),(0,a.Cg)([(0,r.wk)()],m.prototype,"_lovelace",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],m.prototype,"route",void 0),(0,a.Cg)([(0,r.wk)()],m.prototype,"_searchParms",void 0),(0,a.Cg)([(0,r.wk)()],m.prototype,"_error",void 0),m=(0,a.Cg)([(0,r.EM)("ha-panel-energy")],m),o()}catch(f){o(f)}})}}]);