iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
8 lines • 32 kB
JavaScript
/*! For license information please see 21780.4aa4c1b745682e9d.js.LICENSE.txt */
(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[21780],{34370:function(e,t,i){i(18111),i(7588),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}},62647:function(e,t,i){"use strict";var o=i(40445),a=i(9866),n=i(5124),s=i(67576);let r,l=e=>e;class d extends a.A{static get styles(){return[a.A.styles,(0,n.AH)(r||(r=l`:host{font-size:var(--ha-font-size-m);--wa-color-brand-on-quiet:var(
--ha-tab-active-text-color,
var(--primary-color)
);--wa-color-neutral-on-quiet:var(--wa-color-brand-on-quiet);opacity:.8;color:inherit;--wa-space-l:16px}:host([active]:not([disabled])){opacity:1} (hover:hover){:host(:hover:not([disabled]):not([active])) .tab{color:var(--wa-color-brand-on-quiet)}}`))]}}d=(0,o.Cg)([(0,s.EM)("ha-tab-group-tab")],d)},66289:function(e,t,i){"use strict";i.a(e,async function(e,t){try{i(62953);var o=i(40445),a=i(42814),n=i(5124),s=i(67576),r=i(36356),l=e([a]);a=(l.then?(await l)():l)[0];let d,h=e=>e;class c extends a.A{connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._handleKeyDown,!0)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeyDown,!0)}handleClick(e){this._dragScrollController.scrolled||super.handleClick(e)}static get styles(){return[a.A.styles,(0,n.AH)(d||(d=h`:host{--track-width:2px;--track-color:var(--ha-tab-track-color, var(--divider-color));--indicator-color:var(
--ha-tab-indicator-color,
var(--primary-color)
);--wa-color-neutral-on-quiet:var(--indicator-color)}.tab-group-top ::slotted(ha-tab-group-tab[active]){border-block-end:solid var(--track-width) var(--indicator-color);margin-block-end:calc(-1 * var(--track-width))}.tab-group-start ::slotted(ha-tab-group-tab[active]){border-inline-end:solid var(--track-width) var(--indicator-color);margin-inline-end:calc(-1 * var(--track-width))}.tab-group-end ::slotted(ha-tab-group-tab[active]){border-inline-start:solid var(--track-width) var(--indicator-color);margin-inline-start:calc(-1 * var(--track-width))}.scroll-button::part(base):hover{background-color:transparent}`))]}constructor(...e){super(...e),this._dragScrollController=new r.q(this,{selector:".nav"}),this.tabTag="ha-tab-group-tab",this.tabOnly=!0,this._handleKeyDown=e=>{(e.altKey||e.metaKey)&&e.stopPropagation()}}}(0,o.Cg)([(0,s.MZ)({attribute:"tab-tag"})],c.prototype,"tabTag",void 0),(0,o.Cg)([(0,s.MZ)({attribute:"tab-only",type:Boolean})],c.prototype,"tabOnly",void 0),c=(0,o.Cg)([(0,s.EM)("ha-tab-group")],c),t()}catch(d){t(d)}})},83892:function(e,t,i){"use strict";i.d(t,{x:function(){return v}});i(18111),i(13579),i(27495),i(42762),i(62953);var o=i(40445),a=i(92070),n=i(5124),s=i(67576);let r,l,d,h,c,g,u,p=e=>e;class v extends n.WF{_onSlotChange(e){return t=>{const i=t.target.assignedNodes({flatten:!0}).some(e=>{var t;return e.nodeType===Node.ELEMENT_NODE||e.nodeType===Node.TEXT_NODE&&""!==(null===(t=e.textContent)||void 0===t?void 0:t.trim())});"start"===e?this._hasStart=i:this._hasEnd=i}}render(){return this._renderBase(this._renderInner())}_renderBase(e){return(0,n.qy)(r||(r=p`<div part="base" class="base" id="item">${0}</div>`),e)}_renderInner(){const e=this._slotController.test("content");return(0,n.qy)(l||(l=p` <div part="start" class="start" ?hidden="${0}"> <slot name="start" ="${0}"></slot> </div> <div part="content" class="content"> ${0} </div> <div part="end" class="end" ?hidden="${0}"> <slot name="end" ="${0}"></slot> </div> `),!this._hasStart,this._onSlotChange("start"),e?(0,n.qy)(d||(d=p`<slot name="content"></slot>`)):this._renderDefaultContent(),!this._hasEnd,this._onSlotChange("end"))}_renderDefaultContent(){var e,t;const i=this._slotController.test("headline"),o=this._slotController.test("supporting-text"),a=i||void 0!==this.headline,s=o||void 0!==this.supportingText;return(0,n.qy)(h||(h=p` ${0} ${0} `),a?(0,n.qy)(c||(c=p`<div part="headline" class="headline"> <slot name="headline">${0}</slot> </div>`),null!==(e=this.headline)&&void 0!==e?e:n.s6):n.s6,s?(0,n.qy)(g||(g=p`<div part="supporting-text" class="supporting"> <slot name="supporting-text">${0}</slot> </div>`),null!==(t=this.supportingText)&&void 0!==t?t:n.s6):n.s6)}constructor(...e){super(...e),this.disabled=!1,this._slotController=new a.X(this,"headline","supporting-text","content"),this._hasStart=!1,this._hasEnd=!1}}v.styles=(0,n.AH)(u||(u=p`:host{display:block;color:var(--primary-text-color);font-size:var(--ha-font-size-m);line-height:var(--ha-line-height-normal)}:host([disabled]){color:var(--disabled-text-color);pointer-events:none}.base{position:relative;display:flex;flex-direction:row;align-items:center;gap:var(--ha-row-item-gap,var(--ha-space-4));padding-block:var(--ha-row-item-padding-block,var(--ha-space-3));padding-inline:var(--ha-row-item-padding-inline,var(--ha-space-4));min-height:var(--ha-row-item-min-height,48px);box-sizing:border-box}.content{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;justify-content:center}.end,.start{display:flex;align-items:center;flex:0 0 auto}.end[hidden],.start[hidden]{display:none}.headline{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.supporting{color:var(--secondary-text-color);font-size:var(--ha-font-size-s);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}`)),(0,o.Cg)([(0,s.MZ)({type:String})],v.prototype,"headline",void 0),(0,o.Cg)([(0,s.MZ)({type:String,attribute:"supporting-text"})],v.prototype,"supportingText",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],v.prototype,"disabled",void 0),(0,o.Cg)([(0,s.wk)()],v.prototype,"_hasStart",void 0),(0,o.Cg)([(0,s.wk)()],v.prototype,"_hasEnd",void 0),v=(0,o.Cg)([(0,s.EM)("ha-row-item")],v)},17596:function(e,t,i){"use strict";i.a(e,async function(e,t){try{i(3362),i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(66289),r=(i(62647),i(42678)),l=i(21018),d=i(63277),h=i(76530),c=e([s,h,l,d]);[s,h,l,d]=c.then?(await c)():c;let g,u,p,v,_,y=e=>e;const f=["config","visibility"];class m extends d.U{async getConfigElement(){const e=await(0,l.ww)(this.configElementType);if(e&&e.getConfigElement)return e.getConfigElement()}async getConfigForm(){const e=await(0,l.ww)(this.configElementType);if(e&&e.getConfigForm)return e.getConfigForm()}_handleTabChanged(e){const t=e.detail.name;t!==this._currTab&&(this._currTab=t)}_configChanged(e){e.stopPropagation(),this.value=e.detail.value}renderConfigElement(){let e=a.s6;switch(this._currTab){case"config":e=(0,a.qy)(g||(g=y`${0}`),super.renderConfigElement());break;case"visibility":e=(0,a.qy)(u||(u=y` <hui-badge-visibility-editor .hass="${0}" .config="${0}" .entityId="${0}" -changed="${0}"></hui-badge-visibility-editor> `),this.hass,this.value,this.value?(0,r.r)(this.value):void 0,this._configChanged)}return(0,a.qy)(p||(p=y` <ha-tab-group -tab-show="${0}"> ${0} </ha-tab-group> ${0} `),this._handleTabChanged,f.map(e=>(0,a.qy)(v||(v=y` <ha-tab-group-tab slot="nav" .panel="${0}" .active="${0}"> ${0} </ha-tab-group-tab> `),e,this._currTab===e,this.hass.localize(`ui.panel.lovelace.editor.edit_badge.tab_${e}`))),e)}static get styles(){return[d.U.styles,(0,a.AH)(_||(_=y`ha-tab-group{margin-bottom:16px}ha-tab-group-tab{flex:1}ha-tab-group-tab::part(base){width:100%;justify-content:center}`))]}constructor(...e){super(...e),this._currTab=f[0]}}(0,o.Cg)([(0,n.wk)()],m.prototype,"_currTab",void 0),m=(0,o.Cg)([(0,n.EM)("hui-badge-element-editor")],m),t()}catch(g){t(g)}})},76530:function(e,t,i){"use strict";i.a(e,async function(e,t){try{i(62953);var o=i(40445),a=i(35211),n=i(5124),s=i(67576),r=i(1087),l=i(82747),d=i(13898),h=i(30461),c=e([d,h]);[d,h]=c.then?(await c)():c;let g,u,p=e=>e;class v extends n.WF{willUpdate(e){e.has("entityId")&&this._contextProvider.setValue(this.entityId?{mode:"current",entityId:this.entityId}:void 0)}render(){var e;const t=null!==(e=this.config.visibility)&&void 0!==e?e:[];return(0,n.qy)(g||(g=p` <ha-visibility-status .hass="${0}" .conditions="${0}"></ha-visibility-status> <ha-card-conditions-editor .hass="${0}" .conditions="${0}" -changed="${0}"> </ha-card-conditions-editor> `),this.hass,t,this.hass,t,this._valueChanged)}_valueChanged(e){var t;e.stopPropagation();const i=e.detail.value,o=Object.assign(Object.assign({},this.config),{},{visibility:i});0===(null===(t=o.visibility)||void 0===t?void 0:t.length)&&delete o.visibility,(0,r.r)(this,"value-changed",{value:o})}constructor(...e){super(...e),this._contextProvider=new a.DT(this,{context:l.$,initialValue:void 0})}}v.styles=(0,n.AH)(u||(u=p`ha-visibility-status{margin-bottom:var(--ha-space-3)}`)),(0,o.Cg)([(0,s.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],v.prototype,"config",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],v.prototype,"entityId",void 0),v=(0,o.Cg)([(0,s.EM)("hui-badge-visibility-editor")],v),t()}catch(g){t(g)}})},36511:function(e,t,i){"use strict";i.a(e,async function(e,o){try{i.r(t),i.d(t,{HuiDialogEditBadge:function(){return Z}});i(16280),i(3362),i(62953);var a=i(40445),n=i(34370),s=i.n(n),r=i(5124),l=i(67576),d=i(1087),h=i(15638),c=i(64481),g=i(18350),u=(i(93444),i(72554)),p=i(26300),v=i(65829),_=i(84970),y=i(45291),f=i(65063),m=i(14503),b=i(92255),C=i(43908),w=i(26004),E=i(82360),$=i(77859),x=i(75196),k=i(17596),M=e([g,u,p,v,C,w,k]);[g,u,p,v,C,w,k]=M.then?(await M)():M;let A,L,z,I,q,U,T=e=>e;const S="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",P="M11,18H13V16H11V18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,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,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z";class Z extends r.WF{async showDialog(e){this._params=e,this._GUImode=!0,this._guiModeAvailable=!0,this._open=!0;const t=(0,x.ys)(e.lovelaceConfig,e.path);if("strategy"in t)throw new Error("Can't edit strategy");if(this._containerConfig=t,"badgeConfig"in e)this._badgeConfig=e.badgeConfig,this._dirty=!0;else{var i;const t=null===(i=this._containerConfig.badges)||void 0===i?void 0:i[e.badgeIndex];this._badgeConfig=null!=t?(0,_.q)(t):t}this.large=!1,this._badgeConfig&&!Object.isFrozen(this._badgeConfig)&&(this._badgeConfig=s()(this._badgeConfig))}closeDialog(){return this._dirty?(this._confirmCancel(),!1):(this._open=!1,!0)}_dialogClosed(){this._open=!1,this._params=void 0,this._badgeConfig=void 0,this._error=void 0,this._documentationURL=void 0,this._dirty=!1,(0,d.r)(this,"dialog-closed",{dialog:this.localName})}updated(e){if(!this._badgeConfig||void 0!==this._documentationURL||!e.has("_badgeConfig"))return;const t=e.get("_badgeConfig");(null==t?void 0:t.type)!==this._badgeConfig.type&&(this._documentationURL=this._badgeConfig.type?(0,$.R)(this.hass,this._badgeConfig.type):void 0)}render(){if(!this._params)return r.s6;let e;if(this._badgeConfig&&this._badgeConfig.type){let o;var t,i;if((0,y.c8)(this._badgeConfig.type))o=null===(t=(0,y.b$)((0,y.Iu)(this._badgeConfig.type)))||void 0===t?void 0:t.name,null!==(i=o)&&void 0!==i&&i.toLowerCase().endsWith(" badge")&&(o=o.substring(0,o.length-6));else o=this.hass.localize(`ui.panel.lovelace.editor.badge.${this._badgeConfig.type}.name`);e=this.hass.localize("ui.panel.lovelace.editor.edit_badge.typed_header",{type:o})}else e=this._badgeConfig?this.hass.localize("ui.panel.lovelace.editor.edit_badge.header"):this._containerConfig.title?this.hass.localize("ui.panel.lovelace.editor.edit_badge.pick_badge_view_title",{name:this._containerConfig.title}):this.hass.localize("ui.panel.lovelace.editor.edit_badge.pick_badge");return(0,r.qy)(A||(A=T` <ha-dialog .open="${0}" .width="${0}" prevent-scrim-close ="${0}" ="${0}" ="${0}"> <ha-icon-button slot="headerNavigationIcon" ="${0}" .label="${0}" .path="${0}"></ha-icon-button> <span slot="headerTitle" class="title-enlargeable" ="${0}">${0}</span> ${0} <div class="content"> <div class="element-editor"> <hui-badge-element-editor autofocus .hass="${0}" .lovelace="${0}" .value="${0}" in-dialog -changed="${0}" -changed="${0}" -save="${0}"></hui-badge-element-editor> </div> <div class="element-preview"> <hui-badge .hass="${0}" .config="${0}" preview class="${0}"></hui-badge> ${0} </div> </div> <ha-dialog-footer slot="footer"> ${0} <ha-button appearance="plain" slot="secondaryAction" ="${0}"> ${0} </ha-button> ${0} </ha-dialog-footer> </ha-dialog> `),this._open,this.large?"full":"large",this._ignoreKeydown,this._dialogClosed,this._opened,this._cancel,this.hass.localize("ui.common.close"),S,this._enlarge,e,void 0!==this._documentationURL?(0,r.qy)(L||(L=T` <ha-icon-button .path="${0}" slot="headerActionItems" .href="${0}" title="${0}" target="_blank" rel="noreferrer" dir="${0}"></ha-icon-button> `),P,this._documentationURL,this.hass.localize("ui.panel.lovelace.menu.help"),(0,h.Vc)(this.hass)):r.s6,this.hass,this._params.lovelaceConfig,this._badgeConfig,this._handleConfigChanged,this._handleGUIModeChanged,this._save,this.hass,this._badgeConfig,this._error?"blur":"",this._error?(0,r.qy)(z||(z=T` <ha-spinner size="small" aria-label="Can't update badge"></ha-spinner> `)):"",void 0!==this._badgeConfig?(0,r.qy)(I||(I=T` <ha-button appearance="plain" slot="secondaryAction" ="${0}" .disabled="${0}" class="gui-mode-button"> ${0} </ha-button> `),this._toggleMode,!this._guiModeAvailable,this.hass.localize(!this._badgeEditorEl||this._GUImode?"ui.panel.lovelace.editor.edit_badge.show_code_editor":"ui.panel.lovelace.editor.edit_badge.show_visual_editor")):r.s6,this._cancel,this.hass.localize("ui.common.cancel"),void 0!==this._badgeConfig&&this._dirty?(0,r.qy)(q||(q=T` <ha-button slot="primaryAction" ?disabled="${0}" ="${0}" .loading="${0}"> ${0} </ha-button> `),!this._canSave||this._saving,this._save,this._saving,this.hass.localize("ui.common.save")):r.s6)}_enlarge(){(0,c.J)(()=>{this.large=!this.large})}_ignoreKeydown(e){e.stopPropagation()}_handleConfigChanged(e){this._badgeConfig=s()(e.detail.config),this._error=e.detail.error,this._guiModeAvailable=e.detail.guiModeAvailable,this._dirty=!0}_handleGUIModeChanged(e){e.stopPropagation(),this._GUImode=e.detail.guiMode,this._guiModeAvailable=e.detail.guiModeAvailable}_toggleMode(){(0,c.J)(()=>{var e;null===(e=this._badgeEditorEl)||void 0===e||e.toggleMode()})}_opened(){var e;null===(e=this._badgeEditorEl)||void 0===e||e.focusYamlEditor()}get _canSave(){return!this._saving&&(void 0!==this._badgeConfig&&(!this._badgeEditorEl||!this._badgeEditorEl.hasError))}async _confirmCancel(){await new Promise(e=>{setTimeout(e,0)});await(0,f.dk)(this,{title:this.hass.localize("ui.panel.lovelace.editor.edit_badge.unsaved_changes"),text:this.hass.localize("ui.panel.lovelace.editor.edit_badge.confirm_cancel"),dismissText:this.hass.localize("ui.common.stay"),confirmText:this.hass.localize("ui.common.leave")})&&this._cancel()}_cancel(e){e&&e.stopPropagation(),this._dirty=!1,this.closeDialog()}async _save(){if(!this._canSave)return;if(!this._dirty)return void this.closeDialog();this._saving=!0;const e=this._params.path;await this._params.saveConfig("badgeConfig"in this._params?(0,E.HQ)(this._params.lovelaceConfig,e,this._badgeConfig):(0,E.M)(this._params.lovelaceConfig,[...e,this._params.badgeIndex],this._badgeConfig)),this._saving=!1,this._dirty=!1,(0,b.f)(this,this.hass),this.closeDialog()}static get styles(){return[m.nA,m.kO,(0,r.AH)(U||(U=T`:host{--code-mirror-max-height:calc(100vh - 176px)}ha-dialog{--dialog-z-index:6;--dialog-content-padding:var(--ha-space-2)}.content{width:100%;max-width:100%} all and (max-width:450px),all and (max-height:500px){.content{width:100%;max-width:100%;gap:var(--ha-space-3)}} all and (min-width:451px) and (min-height:501px){:host([large]) .content{max-width:none}}.center{margin-left:auto;margin-right:auto}.content{display:flex;flex-direction:column}.content .element-editor{margin:0 10px} (min-width:1000px){.content{flex-direction:row}.content>*{flex-basis:0;flex-grow:1;flex-shrink:1;min-width:0}}.hidden{display:none}.element-editor{margin-bottom:8px}.blur{filter:blur(2px) grayscale(100%)}.element-preview{position:relative;height:max-content;background:var(--primary-background-color);padding:10px;border-radius:var(--ha-border-radius-sm);position:sticky;top:0;display:flex;flex-direction:column;justify-content:center;align-items:center}.element-preview ha-spinner{top:calc(50% - 14px);left:calc(50% - 14px);position:absolute;z-index:10}.gui-mode-button{margin-right:auto;margin-inline-end:auto;margin-inline-start:initial}ha-dialog ha-icon-button[slot=headerActionItems]{color:var(--secondary-text-color)}.title-enlargeable{display:block}`))]}constructor(...e){super(...e),this.large=!1,this._open=!1,this._saving=!1,this._guiModeAvailable=!0,this._GUImode=!0,this._dirty=!1}}(0,a.Cg)([(0,l.MZ)({attribute:!1})],Z.prototype,"hass",void 0),(0,a.Cg)([(0,l.MZ)({type:Boolean,reflect:!0})],Z.prototype,"large",void 0),(0,a.Cg)([(0,l.wk)()],Z.prototype,"_params",void 0),(0,a.Cg)([(0,l.wk)()],Z.prototype,"_open",void 0),(0,a.Cg)([(0,l.wk)()],Z.prototype,"_badgeConfig",void 0),(0,a.Cg)([(0,l.wk)()],Z.prototype,"_containerConfig",void 0),(0,a.Cg)([(0,l.wk)()],Z.prototype,"_saving",void 0),(0,a.Cg)([(0,l.wk)()],Z.prototype,"_error",void 0),(0,a.Cg)([(0,l.wk)()],Z.prototype,"_guiModeAvailable",void 0),(0,a.Cg)([(0,l.P)("hui-badge-element-editor")],Z.prototype,"_badgeEditorEl",void 0),(0,a.Cg)([(0,l.wk)()],Z.prototype,"_GUImode",void 0),(0,a.Cg)([(0,l.wk)()],Z.prototype,"_documentationURL",void 0),(0,a.Cg)([(0,l.wk)()],Z.prototype,"_dirty",void 0),Z=(0,a.Cg)([(0,l.EM)("hui-dialog-edit-badge")],Z),o()}catch(A){o(A)}})},30461:function(e,t,i){"use strict";i.a(e,async function(e,t){try{i(62953);var o=i(40445),a=i(35211),n=i(5124),s=i(67576),r=i(87047),l=i(38962),d=(i(67094),i(83892)),h=i(14487),c=i(82747),g=e([l,h,r]);[l,h,r]=g.then?(await g)():g;let u,p,v=e=>e;const _={visible:"M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z",hidden:"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",invalid:"M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"};class y extends n.WF{willUpdate(e){var t;(super.willUpdate(e),e.has("conditions")||e.has("hass"))&&this._listeners.setup(null!==(t=this.conditions)&&void 0!==t?t:[],this.hass,()=>this._evaluate());(e.has("hass")||e.has("conditions")||e.has("_entityContext"))&&this._evaluate()}render(){var e,t,i,o;return(0,n.qy)(u||(u=v` <ha-alert .alertType="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> <div class="headline"> ${0} </div> <div class="supporting"> ${0} </div> </ha-alert> `),"visible"===this.state?"success":"hidden"===this.state?"warning":"error",_[this.state],null===(e=this.hass)||void 0===e?void 0:e.localize(`ui.panel.lovelace.editor.condition-editor.visibility_status.${this.state}.headline`),null===(t=this.hass)||void 0===t?void 0:t.localize(`ui.panel.lovelace.editor.condition-editor.visibility_status.${this.state}.supporting${0===(null!==(i=null===(o=this.conditions)||void 0===o?void 0:o.length)&&void 0!==i?i:0)?"_empty":""}`))}_evaluate(){var e;const t=null!==(e=this.conditions)&&void 0!==e?e:[];let i;if(0===t.length)i="visible";else if((0,h.db)(t)){var o;const e="current"===(null===(o=this._entityContext)||void 0===o?void 0:o.mode)?{entity_id:this._entityContext.entityId}:{};i=(0,h.XH)(t,this.hass,e)?"visible":"hidden"}else i="invalid";i!==this.state&&(this.state=i)}constructor(...e){super(...e),this.conditions=[],this.state="visible",this._listeners=new r.x(this)}}y.styles=[d.x.styles,(0,n.AH)(p||(p=v`ha-alert{display:block;--mdc-icon-size:24px}.headline{font-weight:var(--ha-font-weight-medium);margin-bottom:var(--ha-space-1)}`))],(0,o.Cg)([(0,s.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],y.prototype,"conditions",void 0),(0,o.Cg)([(0,s.wk)(),(0,a.Fg)({context:c.$,subscribe:!0})],y.prototype,"_entityContext",void 0),(0,o.Cg)([(0,s.MZ)()],y.prototype,"state",void 0),y=(0,o.Cg)([(0,s.EM)("ha-visibility-status")],y),t()}catch(u){t(u)}})},77859:function(e,t,i){"use strict";i.d(t,{R:function(){return l},W:function(){return r}});var o=i(45291),a=i(36918);const n={"energy-date-selection":"energy/#energy-date-picker","energy-compare":"energy/#energy-compare-alert","energy-usage-graph":"energy/#energy-usage-graph","energy-solar-graph":"energy/#solar-production-graph","energy-gas-graph":"energy/#gas-consumption-graph","energy-water-graph":"energy/#water-consumption-graph","energy-distribution":"energy/#energy-distribution","energy-sources-table":"energy/#energy-sources-table","energy-grid-balance":"energy/#grid-energy-balance","energy-grid-neutrality-gauge":"energy/#grid-neutrality-gauge","energy-solar-consumed-gauge":"energy/#solar-consumed-gauge","energy-carbon-consumed-gauge":"energy/#carbon-consumed-gauge","energy-self-sufficiency-gauge":"energy/#self-sufficiency-gauge","energy-devices-graph":"energy/#devices-energy-graph","energy-devices-detail-graph":"energy/#detail-devices-energy-graph","energy-sankey":"energy/#sankey-energy-graph","power-sources-graph":"energy/#power-sources-graph"},s={"power-total":"energy/#power-consumption-badge","water-total":"energy/#water-flow-rate-badge","gas-total":"energy/#gas-flow-rate-badge"},r=(e,t)=>{var i;return(0,o.c8)(t)?null===(i=(0,o.wi)((0,o.Iu)(t)))||void 0===i?void 0:i.documentationURL:`${(0,a.o)(e,"/dashboards/")}${n[t]||t}`},l=(e,t)=>{var i;return(0,o.c8)(t)?null===(i=(0,o.b$)((0,o.Iu)(t)))||void 0===i?void 0:i.documentationURL:`${(0,a.o)(e,"/dashboards/")}${s[t]||"badges"}`}},39039:function(e,t,i){"use strict";i.d(t,{r:function(){return o}});i(16280);class o extends Error{constructor(e,t,i){super(e),this.name="GUISupportError",this.warnings=t,this.errors=i}}},91322:function(e,t,i){"use strict";i.a(e,async function(e,o){try{i.d(t,{m:function(){return L}});i(18111),i(7588),i(61701),i(3362),i(62953);var a=i(40445),n=i(5124),s=i(67576),r=i(74985),l=i(1087),d=i(78978),h=i(19459),c=i(38962),g=i(65829),u=i(10763),p=i(39039),v=e([c,g,u]);[c,g,u]=v.then?(await v)():v;let _,y,f,m,b,C,w,E,$,x,k,M,A=e=>e;class L extends n.WF{get value(){return this._config}set value(e){this._config&&(0,h.b)(e,this._config,{compareSymbols:!0})||(this._config=e,this._errors=void 0,this._setConfig())}_setConfig(){if(!this._errors&&!this._yamlError)try{this._updateConfigElement()}catch(e){this._errors=[e.message]}this.updateComplete.then(()=>{var e;(0,l.r)(this,"config-changed",{config:this.value,error:null===(e=this._errors)||void 0===e?void 0:e.join(", "),guiModeAvailable:!(this.hasWarning||this.hasError||!1===this._guiSupported)})})}get hasWarning(){return void 0!==this._warnings&&this._warnings.length>0}get hasError(){return this._yamlError||void 0!==this._errors&&this._errors.length>0}get GUImode(){return this._guiMode}set GUImode(e){this._guiMode=e,this.updateComplete.then(()=>{(0,l.r)(this,"GUImode-changed",{guiMode:e,guiModeAvailable:!(this.hasWarning||this.hasError||!1===this._guiSupported)})})}toggleMode(){var e;this.GUImode||(null===(e=this._yamlEditor)||void 0===e||e.disableCodeEditorFullscreen());this.GUImode=!this.GUImode}focusYamlEditor(){var e;null!==(e=this._configElement)&&void 0!==e&&e.focusYamlEditor&&this._configElement.focusYamlEditor(),this._yamlEditor&&this._yamlEditor.focus()}async getConfigElement(){}async getConfigForm(){}renderConfigElement(){return(0,n.qy)(_||(_=A`${0}`),this._configElement)}_renderSubElement(){return(0,n.qy)(y||(y=A` <hui-sub-element-editor .hass="${0}" .config="${0}" -back="${0}" -changed="${0}"> </hui-sub-element-editor> `),this.hass,this._subElementEditorConfig,this._goBack,this._subElementChanged)}_subElementChanged(e){var t,i;e.stopPropagation();const o=e.detail.config;this._subElementEditorConfig=Object.assign(Object.assign({},this._subElementEditorConfig),{},{elementConfig:o}),null===(t=(i=this._subElementEditorConfig).saveElementConfig)||void 0===t||t.call(i,o)}_goBack(e){e.stopPropagation(),this._subElementEditorConfig=void 0}async _editSubElement(e){e.stopPropagation(),await Promise.all([i.e(92769),i.e(3283),i.e(80131),i.e(70183),i.e(67218),i.e(98470),i.e(99788),i.e(58303),i.e(21543),i.e(66283),i.e(46601),i.e(94956),i.e(26092),i.e(39005),i.e(8851),i.e(59704),i.e(25322),i.e(55392),i.e(71572),i.e(55076),i.e(36332),i.e(77563),i.e(15862),i.e(99143),i.e(97500),i.e(12009),i.e(66990),i.e(20282),i.e(87857),i.e(81804),i.e(92363),i.e(53387)]).then(i.bind(i,81287)),this._subElementEditorConfig={type:e.detail.type,elementConfig:e.detail.config,context:e.detail.context,saveElementConfig:e.detail.saveConfig}}render(){var e;return(0,n.qy)(f||(f=A` <div class="wrapper"> ${0} ${0} ${0} ${0} </div> `),this.GUImode?(0,n.qy)(m||(m=A` <div class="gui-editor" -sub-element="${0}"> ${0} </div> `),this._editSubElement,this._loading?(0,n.qy)(b||(b=A` <ha-spinner class="center margin-bot"></ha-spinner> `)):(0,r.P)(this._subElementEditorConfig?this._renderSubElement():this.renderConfigElement())):(0,n.qy)(C||(C=A` <div class="yaml-editor"> <ha-yaml-editor .defaultValue="${0}" autofocus .inDialog="${0}" -changed="${0}" ="${0}" dir="ltr"></ha-yaml-editor> </div> `),this._config,this.inDialog,this._handleYAMLChanged,this._ignoreKeydown),!1===this._guiSupported&&!1===this._loading?(0,n.qy)(w||(w=A` <ha-alert alert-type="info" .title="${0}"> ${0} <br> ${0} </ha-alert> `),this.hass.localize("ui.errors.config.visual_editor_not_supported"),this.hass.localize("ui.errors.config.visual_editor_not_supported_reason_type"),this.hass.localize("ui.errors.config.edit_in_yaml_supported")):n.s6,null!==(e=this._errors)&&void 0!==e&&e.length?(0,n.qy)(E||(E=A` <ha-alert alert-type="error" .title="${0}"> <ul> ${0} </ul> </ha-alert> `),this.hass.localize("ui.errors.config.configuration_error"),this._errors.map(e=>(0,n.qy)($||($=A`<li>${0}</li>`),e))):n.s6,this.hasWarning?(0,n.qy)(x||(x=A` <ha-alert alert-type="warning" .title="${0}"> <ul> ${0} </ul> ${0} </ha-alert> `),this.hass.localize("ui.errors.config.visual_editor_not_supported"),this._warnings.map(e=>(0,n.qy)(k||(k=A`<li>${0}</li>`),e)),this.hass.localize("ui.errors.config.edit_in_yaml_supported")):n.s6)}updated(e){super.updated(e),this._configElement&&e.has("hass")&&(this._configElement.hass=this.hass),this._configElement&&"lovelace"in this._configElement&&e.has("lovelace")&&(this._configElement.lovelace=this.lovelace),this._configElement&&e.has("context")&&(this._configElement.context=this.context)}_handleUIConfigChanged(e){if(e.stopPropagation(),!this.GUImode)return;const t=e.detail.config;Object.keys(t).forEach(e=>{void 0===t[e]&&delete t[e]}),this.value=t}_handleYAMLChanged(e){e.stopPropagation(),e.detail.isValid?(this._config=e.detail.value,this._errors=void 0,this._yamlError=!1):this._yamlError=!0,this._setConfig()}async unloadConfigElement(){this._configElement=void 0,this._guiSupported=void 0}async loadConfigElement(){if(this._configElement)return;let e=await this.getConfigElement();if(!e){const t=await this.getConfigForm();if(t){await i.e(15106).then(i.bind(i,15737)),e=document.createElement("hui-form-editor");const{schema:o,assertConfig:a,computeLabel:n,computeHelper:s}=t;e.schema=o,n&&(e.computeLabel=n),s&&(e.computeHelper=s),a&&(e.assertConfig=a)}}e?(e.hass=this.hass,"lovelace"in e&&(e.lovelace=this.lovelace),e.context=this.context,e.addEventListener("config-changed",e=>this._handleUIConfigChanged(e)),this._guiSupported=!0):this._guiSupported=!1,this._configElement=e}async _updateConfigElement(){if(!this.value)return;const e=++this._loadCount;try{if(this._errors=void 0,this._warnings=void 0,await this.loadConfigElement(),this._configElement)try{this._configElement.setConfig(this.value)}catch(i){const e=(0,d._)(this.hass,i);throw new p.r("Config is not supported",e.warnings,e.errors)}else this._guiSupported=!1,this.GUImode=!1}catch(i){if(e!==this._loadCount)return;var t;if(i instanceof p.r)this._warnings=null!==(t=i.warnings)&&void 0!==t?t:[i.message],this._errors=i.errors||void 0;else this._errors=[i.message];this.GUImode=!1}finally{this._loading=!1}}_ignoreKeydown(e){e.stopPropagation()}constructor(...e){super(...e),this.inDialog=!1,this._guiMode=!0,this._loading=!1,this._yamlError=!1,this._loadCount=0}}L.styles=(0,n.AH)(M||(M=A`:host{display:flex}.wrapper{width:100%}.gui-editor,.yaml-editor{padding:8px 0px}ha-code-editor{--code-mirror-max-height:calc(100vh - 245px)}ha-spinner{display:block;margin:auto}`)),(0,a.Cg)([(0,s.MZ)({attribute:!1})],L.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],L.prototype,"lovelace",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],L.prototype,"context",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"in-dialog"})],L.prototype,"inDialog",void 0),(0,a.Cg)([(0,s.wk)()],L.prototype,"_config",void 0),(0,a.Cg)([(0,s.wk)()],L.prototype,"_configElement",void 0),(0,a.Cg)([(0,s.wk)()],L.prototype,"_subElementEditorConfig",void 0),(0,a.Cg)([(0,s.wk)()],L.prototype,"_guiMode",void 0),(0,a.Cg)([(0,s.wk)()],L.prototype,"_errors",void 0),(0,a.Cg)([(0,s.wk)()],L.prototype,"_warnings",void 0),(0,a.Cg)([(0,s.wk)()],L.prototype,"_guiSupported",void 0),(0,a.Cg)([(0,s.wk)()],L.prototype,"_loading",void 0),(0,a.Cg)([(0,s.wk)()],L.prototype,"_yamlError",void 0),(0,a.Cg)([(0,s.P)("ha-yaml-editor")],L.prototype,"_yamlEditor",void 0),o()}catch(_){o(_)}})},63277:function(e,t,i){"use strict";i.a(e,async function(e,o){try{i.d(t,{U:function(){return l}});i(16280),i(3362);var a=i(40445),n=i(67576),s=i(91322),r=e([s]);s=(r.then?(await r)():r)[0];class l extends s.m{get configElementType(){return this.value?this.value.type:void 0}async loadConfigElement(){if(this._configElementType!==this.configElementType){if(this.unloadConfigElement(),!this.configElementType)throw new Error(this.hass.localize("ui.errors.config.no_type_provided"));this._configElementType=this.configElementType}return super.loadConfigElement()}}(0,a.Cg)([(0,n.wk)()],l.prototype,"_configElementType",void 0),o()}catch(l){o(l)}})},92255:function(e,t,i){"use strict";i.d(t,{f:function(){return a}});var o=i(81619);const a=(e,t)=>(0,o.P)(e,{message:t.localize("ui.common.successfully_saved")})},74985:function(e,t,i){"use strict";i.d(t,{P:function(){return r}});i(88454),i(29452),i(62953);var o=i(5055),a=i(42017),n=i(63937);const s=e=>(0,n.ps)(e)?e._$litType$.h:e.strings,r=(0,a.u$)(class extends a.WL{render(e){return[e]}update(e,[t]){const i=(0,n.qb)(this.it)?s(this.it):null,a=(0,n.qb)(t)?s(t):null;if(null!==i&&(null===a||i!==a)){const t=(0,n.cN)(e).pop();let a=this.et.get(i);if(void 0===a){const e=document.createDocumentFragment();a=(0,o.XX)(o.s6,e),a.setConnected(!1),this.et.set(i,a)}(0,n.mY)(a,[t]),(0,n.Dx)(a,void 0,t)}if(null!==a){if(null===i||i!==a){const t=this.et.get(a);if(void 0!==t){const i=(0,n.cN)(t).pop();(0,n.Jz)(e),(0,n.Dx)(e,void 0,i),(0,n.mY)(e,[i])}}this.it=t}else this.it=void 0;return this.render(t)}constructor(e){super(e),this.et=new WeakMap}})}}]);