1/*! For license information please see 21780.d275424b4fbbbd4e.js.LICENSE.txt */ 2export const __rspack_esm_id="21780";export const __rspack_esm_ids=["21780"];export const __webpack_modules__={34370(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}},36356(e,t,i){i.d(t,{q:()=>o});class o{get enabled(){return this._enabled}set enabled(e){e!==this._enabled&&(this._enabled=e,this._enabled?this._attach():this._detach(),this._host.requestUpdate())}hostUpdated(){this.enabled&&!this._scrollContainer&&this._attach()}hostDisconnected(){this._detach()}_attach(){this._scrollContainer=this._host.renderRoot?.querySelector(this._selector),this._scrollContainer&&this._scrollContainer.addEventListener("mousedown",this._mouseDown)}_detach(){window.removeEventListener("mousemove",this._mouseMove),window.removeEventListener("mouseup",this._mouseUp),this._scrollContainer&&(this._scrollContainer.removeEventListener("mousedown",this._mouseDown),this._scrollContainer=void 0),this.scrolled=!1,this.scrolling=!1,this.mouseIsDown=!1,this.scrollStartX=0,this.scrollLeft=0}constructor(e,{selector:t,enabled:i}){this.mouseIsDown=!1,this.scrolled=!1,this.scrolling=!1,this.scrollStartX=0,this.scrollLeft=0,this._enabled=!0,this._mouseDown=e=>{const t=this._scrollContainer;t&&(this.scrollStartX=e.pageX-t.offsetLeft,this.scrollLeft=t.scrollLeft,this.mouseIsDown=!0,this.scrolled=!1,window.addEventListener("mousemove",this._mouseMove),window.addEventListener("mouseup",this._mouseUp,{once:!0}))},this._mouseUp=()=>{this.mouseIsDown=!1,this.scrolling=!1,this._host.requestUpdate(),window.removeEventListener("mousemove",this._mouseMove)},this._mouseMove=e=>{if(!this.mouseIsDown)return;const t=this._scrollContainer;if(!t)return;const i=e.pageX-t.offsetLeft-this.scrollStartX;this.scrolled||(this.scrolled=Math.abs(i)>1,this.scrolling=this.scrolled,this._host.requestUpdate()),t.scrollLeft=this.scrollLeft-i},this._selector=t,this._host=e,this.enabled=i??!0,e.addController(this)}}},62647(e,t,i){var o=i(62826),a=i(37195),s=i(96196),n=i(97735);class r extends a.A{static get styles(){return[a.A.styles,s.AH`:host{font-size:var(--ha-font-size-m);--wa-color-brand-on-quiet:var( 3 --ha-tab-active-text-color, 4 var(--primary-color) 5 );--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}@media (hover:hover){:host(:hover:not([disabled]):not([active])) .tab{color:var(--wa-color-brand-on-quiet)}}`]}}r=(0,o.Cg)([(0,n.EM)("ha-tab-group-tab")],r)},66289(e,t,i){i.a(e,async function(e,t){try{var o=i(62826),a=i(42814),s=i(96196),n=i(97735),r=i(36356),l=e([a]);a=(l.then?(await l)():l)[0];class h extends a.A{handleClick(e){this._dragScrollController.scrolled||super.handleClick(e)}static get styles(){return[a.A.styles,s.AH`:host{--track-width:2px;--track-color:var(--ha-tab-track-color, var(--divider-color));--indicator-color:var( 6 --ha-tab-indicator-color, 7 var(--primary-color) 8 );--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}}(0,o.Cg)([(0,n.MZ)({attribute:"tab-tag"})],h.prototype,"tabTag",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"tab-only",type:Boolean})],h.prototype,"tabOnly",void 0),h=(0,o.Cg)([(0,n.EM)("ha-tab-group")],h),t()}catch(e){t(e)}})},17596(e,t,i){i.a(e,async function(e,t){try{var o=i(62826),a=i(96196),s=i(97735),n=i(66289),r=(i(62647),i(21018)),l=i(63277),h=i(76530),d=e([n,h,r,l]);[n,h,r,l]=d.then?(await d)():d;const g=["config","visibility"];class c extends l.U{async getConfigElement(){const e=await(0,r.ww)(this.configElementType);if(e&&e.getConfigElement)return e.getConfigElement()}async getConfigForm(){const e=await(0,r.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=a.qy`${super.renderConfigElement()}`;break;case"visibility":e=a.qy` <hui-badge-visibility-editor .hass="${this.hass}" .config="${this.value}" @value-changed="${this._configChanged}"></hui-badge-visibility-editor> `}return a.qy` <ha-tab-group @wa-tab-show="${this._handleTabChanged}"> ${g.map(e=>a.qy` <ha-tab-group-tab slot="nav" .panel="${e}" .active="${this._currTab===e}"> ${this.hass.localize(`ui.panel.lovelace.editor.edit_badge.tab_${e}`)} </ha-tab-group-tab> `)} </ha-tab-group> ${e} `}static get styles(){return[l.U.styles,a.AH`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=g[0]}}(0,o.Cg)([(0,s.wk)()],c.prototype,"_currTab",void 0),c=(0,o.Cg)([(0,s.EM)("hui-badge-element-editor")],c),t()}catch(e){t(e)}})},76530(e,t,i){i.a(e,async function(e,t){try{var o=i(62826),a=i(96196),s=i(97735),n=i(1087),r=i(38962),l=i(13898),h=e([r,l]);[r,l]=h.then?(await h)():h;class d extends a.WF{render(){const e=this.config.visibility??[];return a.qy` <p class="intro"> ${this.hass.localize("ui.panel.lovelace.editor.edit_badge.visibility.explanation")} </p> <ha-card-conditions-editor .hass="${this.hass}" .conditions="${e}" @value-changed="${this._valueChanged}"> </ha-card-conditions-editor> `}_valueChanged(e){e.stopPropagation();const t=e.detail.value,i={...this.config,visibility:t};0===i.visibility?.length&&delete i.visibility,(0,n.r)(this,"value-changed",{value:i})}}d.styles=a.AH`.intro{margin:0;color:var(--secondary-text-color);margin-bottom:8px}`,(0,o.Cg)([(0,s.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],d.prototype,"config",void 0),d=(0,o.Cg)([(0,s.EM)("hui-badge-visibility-editor")],d),t()}catch(e){t(e)}})},36511(e,t,i){i.a(e,async function(e,o){try{i.r(t),i.d(t,{HuiDialogEditBadge:()=>A});var a=i(62826),s=i(34370),n=i.n(s),r=i(96196),l=i(97735),h=i(1087),d=i(15638),g=i(64481),c=i(18350),u=(i(93444),i(72554)),p=i(26300),_=i(65829),m=i(84970),v=i(45291),b=i(65063),f=i(14503),y=i(9225
85),C=i(43908),w=i(26004),E=i(82360),$=i(77859),x=i(75196),k=i(17596),M=e([c,u,p,_,C,w,k]);[c,u,p,_,C,w,k]=M.then?(await M)():M;const L="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",U="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 A 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{const t=this._containerConfig.badges?.[e.badgeIndex];this._badgeConfig=null!=t?(0,m.q)(t):t}this.large=!1,this._badgeConfig&&!Object.isFrozen(this._badgeConfig)&&(this._badgeConfig=n()(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,h.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");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 t;(0,v.c8)(this._badgeConfig.type)?(t=(0,v.b$)((0,v.Iu)(this._badgeConfig.type))?.name,t?.toLowerCase().endsWith(" badge")&&(t=t.substring(0,t.length-6))):t=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:t})}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 r.qy` <ha-dialog .hass="${this.hass}" .open="${this._open}" .width="${this.large?"full":"large"}" prevent-scrim-close @keydown="${this._ignoreKeydown}" @closed="${this._dialogClosed}" @opened="${this._opened}"> <ha-icon-button slot="headerNavigationIcon" @click="${this._cancel}" .label="${this.hass.localize("ui.common.close")}" .path="${L}"></ha-icon-button> <span slot="headerTitle" @click="${this._enlarge}">${e}</span> ${void 0!==this._documentationURL?r.qy` <ha-icon-button .path="${U}" slot="headerActionItems" .href="${this._documentationURL}" title="${this.hass.localize("ui.panel.lovelace.menu.help")}" target="_blank" rel="noreferrer" dir="${(0,d.Vc)(this.hass)}"></ha-icon-button> `:r.s6} <div class="content"> <div class="element-editor"> <hui-badge-element-editor autofocus .hass="${this.hass}" .lovelace="${this._params.lovelaceConfig}" .value="${this._badgeConfig}" in-dialog @config-changed="${this._handleConfigChanged}" @GUImode-changed="${this._handleGUIModeChanged}" @editor-save="${this._save}"></hui-badge-element-editor> </div> <div class="element-preview"> <hui-badge .hass="${this.hass}" .config="${this._badgeConfig}" preview class="${this._error?"blur":""}"></hui-badge> ${this._error?r.qy` <ha-spinner size="small" aria-label="Can't update badge"></ha-spinner> `:""} </div> </div> <ha-dialog-footer slot="footer"> ${void 0!==this._badgeConfig?r.qy` <ha-button appearance="plain" slot="secondaryAction" @click="${this._toggleMode}" .disabled="${!this._guiModeAvailable}" class="gui-mode-button"> ${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")} </ha-button> `:r.s6} <ha-button appearance="plain" slot="secondaryAction" @click="${this._cancel}"> ${this.hass.localize("ui.common.cancel")} </ha-button>
8 ${void 0!==this._badgeConfig&&this._dirty?r.qy` <ha-button slot="primaryAction" ?disabled="${!this._canSave||this._saving}" @click="${this._save}" .loading="${this._saving}"> ${this.hass.localize("ui.common.save")} </ha-button> `:r.s6} </ha-dialog-footer> </ha-dialog> `}_enlarge(){(0,g.J)(()=>{this.large=!this.large})}_ignoreKeydown(e){e.stopPropagation()}_handleConfigChanged(e){this._badgeConfig=n()(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,g.J)(()=>{this._badgeEditorEl?.toggleMode()})}_opened(){this._badgeEditorEl?.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,b.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,y.f)(this,this.hass),this.closeDialog()}static get styles(){return[f.nA,f.kO,r.AH`: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%}@media all and (max-width:450px),all and (max-height:500px){.content{width:100%;max-width:100%}}@media 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}@media (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)}`]}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})],A.prototype,"hass",void 0),(0,a.Cg)([(0,l.MZ)({type:Boolean,reflect:!0})],A.prototype,"large",void 0),(0,a.Cg)([(0,l.wk)()],A.prototype,"_params",void 0),(0,a.Cg)([(0,l.wk)()],A.prototype,"_open",void 0),(0,a.Cg)([(0,l.wk)()],A.prototype,"_badgeConfig",void 0),(0,a.Cg)([(0,l.wk)()],A.prototype,"_containerConfig",void 0),(0,a.Cg)([(0,l.wk)()],A.prototype,"_saving",void 0),(0,a.Cg)([(0,l.wk)()],A.prototype,"_error",void 0),(0,a.Cg)([(0,l.wk)()],A.prototype,"_guiModeAvailable",void 0),(0,a.Cg)([(0,l.P)("hui-badge-element-editor")],A.prototype,"_badgeEditorEl",void 0),(0,a.Cg)([(0,l.wk)()],A.prototype,"_GUImode",void 0),(0,a.Cg)([(0,l.wk)()],A.prototype,"_documentationURL",void 0),(0,a.Cg)([(0,l.wk)()],A.prototype,"_dirty",void 0),A=(0,a.Cg)([(0,l.EM)("hui-dialog-edit-badge")],A),o()}catch(e){o(e)}})},77859(e,t,i){i.d(t,{R:()=>r,W:()=>n});var o=i(45291),a=i(36918);const s={"energy-date-selection":"energy/#energy-date-picker","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-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"},n=(e,t)=>(0,o.c8)(t)?(0,o.wi)((0,o.Iu)(t))?.documentationURL:`${(0,a.o)(e,"/dashboards/")}${s[t]||t}`,r=(e,t)=>(0,o.c8)(t)?(0,o.b$)((0,o.Iu)(t))?.documentationURL:`${(0,a.o)(e,"/dashboards/badges")}`},39039(e,t,i){i.d(t,{r:()=>o});
8class o extends Error{constructor(e,t,i){super(e),this.name="GUISupportError",this.warnings=t,this.errors=i}}},91322(e,t,i){i.a(e,async function(e,o){try{i.d(t,{m:()=>v});i(18111),i(7588),i(61701);var a=i(62826),s=i(96196),n=i(97735),r=i(57378),l=i(1087),h=i(78978),d=i(9899),g=i(19459),c=i(38962),u=i(65829),p=i(10763),_=i(39039),m=e([c,u,p]);[c,u,p]=m.then?(await m)():m;class v extends s.WF{get value(){return this._config}set value(e){this._config&&(0,g.b)(e,this._config,{compareSymbols:!0})||(this._config=e,this._errors=void 0,this._setConfig())}_setConfig(){if(!this._errors)try{this._updateConfigElement()}catch(e){this._errors=[e.message]}this.updateComplete.then(()=>{(0,l.r)(this,"config-changed",{config:this.value,error:this._errors?.join(", "),guiModeAvailable:!(this.hasWarning||this.hasError||!1===this._guiSupported)})})}get hasWarning(){return void 0!==this._warnings&&this._warnings.length>0}get hasError(){return 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(){this.GUImode||this._yamlEditor?.disableCodeEditorFullscreen(),this.GUImode=!this.GUImode}focusYamlEditor(){this._configElement?.focusYamlEditor&&this._configElement.focusYamlEditor(),this._yamlEditor&&this._yamlEditor.focus()}async getConfigElement(){}async getConfigForm(){}renderConfigElement(){return s.qy`${this._configElement}`}_renderSubElement(){return s.qy` <hui-sub-element-editor .hass="${this.hass}" .config="${this._subElementEditorConfig}" @go-back="${this._goBack}" @config-changed="${this._subElementChanged}"> </hui-sub-element-editor> `}_subElementChanged(e){e.stopPropagation();const t=e.detail.config;this._subElementEditorConfig={...this._subElementEditorConfig,elementConfig:t},this._subElementEditorConfig.saveElementConfig?.(t)}_goBack(e){e.stopPropagation(),this._subElementEditorConfig=void 0}async _editSubElement(e){e.stopPropagation(),await Promise.all([i.e("92769"),i.e("62453"),i.e("26767"),i.e("39607"),i.e("99788"),i.e("21543"),i.e("86909"),i.e("78398"),i.e("8851"),i.e("21519"),i.e("25322"),i.e("12009"),i.e("94860"),i.e("55076"),i.e("36332"),i.e("15862"),i.e("40069"),i.e("99143"),i.e("66990"),i.e("67577"),i.e("96000")]).then(i.bind(i,81287)),this._subElementEditorConfig={type:e.detail.type,elementConfig:e.detail.config,context:e.detail.context,saveElementConfig:e.detail.saveConfig}}render(){return s.qy` <div class="wrapper"> ${this.GUImode?s.qy` <div class="gui-editor" @edit-sub-element="${this._editSubElement}"> ${this._loading?s.qy` <ha-spinner class="center margin-bot"></ha-spinner> `:(0,r.P)(this._subElementEditorConfig?this._renderSubElement():this.renderConfigElement())} </div> `:s.qy` <div class="yaml-editor"> <ha-yaml-editor .defaultValue="${this._config}" autofocus .hass="${this.hass}" .inDialog="${this.inDialog}" @value-changed="${this._handleYAMLChanged}" @blur="${this._onBlurYaml}" @keydown="${this._ignoreKeydown}" dir="ltr" .showErrors="${!1}"></ha-yaml-editor> </div> `} ${!1===this._guiSupported&&!1===this._loading?s.qy` <ha-alert alert-type="info" .title="${this.hass.localize("ui.errors.config.visual_editor_not_supported")}"> ${this.hass.localize("ui.errors.config.visual_editor_not_supported_reason_type")} <br> ${this.hass.localize("ui.errors.config.edit_in_yaml_supported")} </ha-alert> `:s.s6} ${this.hasError?s.qy` <ha-alert alert-type="error" .title="${this.hass.localize("ui.errors.config.configuration_error")}"> <ul> ${this._errors.map(e=>s.qy`<li>${e}</li>`)} </ul> </ha-alert> `:s.s6} ${this.hasWarning?s.qy` <ha-alert alert-type="warning" .title="${this.hass.localize("ui.errors.config.visual_editor_not_supported")}"> <ul> ${this._warnings.map(e=>s.qy`<li>${e}</li>`)} </ul> ${this.hass.localize("ui.errors.config.edit_in_yaml_supported")} </ha-alert> `:s.s6} </div> `}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;
8Object.keys(t).forEach(e=>{void 0===t[e]&&delete t[e]}),this.value=t}_handleYAMLChanged(e){e.stopPropagation();const t=e.detail.value;e.detail.isValid?(this._config=t,this._errors=void 0,this._pendingYamlError=void 0,this._yamlError=!1,this._debounceYamlError.cancel(),this._setConfig()):this._yamlError?this._errors=[e.detail.errorMsg]:(this._pendingYamlError=e.detail.errorMsg,this._debounceYamlError())}_onBlurYaml(){this._debounceYamlError.cancel(),this._pendingYamlError&&(this._yamlError=!0,this._errors=[this._pendingYamlError],this._pendingYamlError=void 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:s,computeHelper:n}=t;e.schema=o,s&&(e.computeLabel=s),n&&(e.computeHelper=n),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(e){const t=(0,h._)(this.hass,e);throw new _.r("Config is not supported",t.warnings,t.errors)}else this._guiSupported=!1,this.GUImode=!1}catch(t){if(e!==this._loadCount)return;t instanceof _.r?(this._warnings=t.warnings??[t.message],this._errors=t.errors||void 0):this._errors=[t.message],this.GUImode=!1}finally{this._loading=!1}}_ignoreKeydown(e){e.stopPropagation()}constructor(...e){super(...e),this.inDialog=!1,this._guiMode=!0,this._yamlError=!1,this._loading=!1,this._loadCount=0,this._debounceYamlError=(0,d.s)(()=>{this._pendingYamlError&&(this._yamlError=!0,this._errors=[this._pendingYamlError],this._pendingYamlError=void 0,this._setConfig())},2e3)}}v.styles=s.AH`: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,n.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"lovelace",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"context",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,attribute:"in-dialog"})],v.prototype,"inDialog",void 0),(0,a.Cg)([(0,n.wk)()],v.prototype,"_config",void 0),(0,a.Cg)([(0,n.wk)()],v.prototype,"_configElement",void 0),(0,a.Cg)([(0,n.wk)()],v.prototype,"_subElementEditorConfig",void 0),(0,a.Cg)([(0,n.wk)()],v.prototype,"_guiMode",void 0),(0,a.Cg)([(0,n.wk)()],v.prototype,"_errors",void 0),(0,a.Cg)([(0,n.wk)()],v.prototype,"_pendingYamlError",void 0),(0,a.Cg)([(0,n.wk)()],v.prototype,"_yamlError",void 0),(0,a.Cg)([(0,n.wk)()],v.prototype,"_warnings",void 0),(0,a.Cg)([(0,n.wk)()],v.prototype,"_guiSupported",void 0),(0,a.Cg)([(0,n.wk)()],v.prototype,"_loading",void 0),(0,a.Cg)([(0,n.P)("ha-yaml-editor")],v.prototype,"_yamlEditor",void 0),o()}catch(e){o(e)}})},63277(e,t,i){i.a(e,async function(e,o){try{i.d(t,{U:()=>l});var a=i(62826),s=i(97735),n=i(91322),r=e([n]);n=(r.then?(await r)():r)[0];class l extends n.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,s.wk)()],l.prototype,"_configElementType",void 0),o()}catch(e){o(e)}})},92255(e,t,i){i.d(t,{f:()=>a});var o=i(81619);const a=(e,t)=>(0,o.P)(e,{message:t.localize("ui.common.successfully_saved")})},57378(e,t,i){i.d(t,{P:()=>r});i(88454),i(29452);var o=i(5055),a=i(42017),s=i(63937);const n=e=>(0,s.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,s.qb)(this.it)?n(this.it):null,a=(0,s.qb)(t)?n(t):null;if(null!==i&&(null===a||i!==a)){const t=(0,s.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,s.mY)(a,[t]),(0,s.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,s.cN)(t).pop();(0,s.Jz)(e),(0,s.Dx)(e,void 0,i),(0,s.mY)(e,[i])}}this.it=t}else this.it=void 0;return this.render(t)}constructor(e){super(e),this.et=new WeakMap}})}}; 9//# sourceMappingURL=21780.d275424b4fbbbd4e.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.