UNPKG

iobroker.lovelace

Version:

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

9 lines 37.9 kB
/*! For license information please see 67991.f078b44a6719c3e2.js.LICENSE.txt */ export const __webpack_ids__=["67991"];export const __webpack_modules__={96814:function(e,i,t){t(9359),t(31526),e.exports=function e(i){return Object.freeze(i),Object.getOwnPropertyNames(i).forEach((function(t){!i.hasOwnProperty(t)||null===i[t]||"object"!=typeof i[t]&&"function"!=typeof i[t]||Object.isFrozen(i[t])||e(i[t])})),i}},95198:function(e,i,t){var o=t(44249),n=t(57243),a=t(15093);(0,o.Z)([(0,a.Mo)("ha-dialog-header")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"method",key:"render",value:function(){return n.dy` <header class="header"> <div class="header-bar"> <section class="header-navigation-icon"> <slot name="navigationIcon"></slot> </section> <section class="header-content"> <div class="header-title"> <slot name="title"></slot> </div> <div class="header-subtitle"> <slot name="subtitle"></slot> </div> </section> <section class="header-action-items"> <slot name="actionItems"></slot> </section> </div> <slot></slot> </header> `}},{kind:"get",static:!0,key:"styles",value:function(){return[n.iv`:host{display:block}:host([show-border]){border-bottom:1px solid var(--mdc-dialog-scroll-divider-color,rgba(0,0,0,.12))}.header-bar{display:flex;flex-direction:row;align-items:flex-start;padding:4px;box-sizing:border-box}.header-content{flex:1;padding:10px 4px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.header-title{font-size:22px;line-height:28px;font-weight:400}.header-subtitle{font-size:14px;line-height:20px;color:var(--secondary-text-color)}@media all and (min-width:450px) and (min-height:500px){.header-bar{padding:12px}}.header-navigation-icon{flex:none;min-width:8px;height:100%;display:flex;flex-direction:row}.header-action-items{flex:none;min-width:8px;height:100%;display:flex;flex-direction:row}`]}}]}}),n.oi)},73729:function(e,i,t){t.d(i,{i:()=>h});var o=t(44249),n=t(72621),a=t(74966),s=t(51408),r=t(57243),d=t(15093),l=t(76525);t(23334);const c=["button","ha-list-item"],h=(e,i)=>r.dy` <div class="header_title"> <ha-icon-button .label="${e?.localize("ui.common.close")??"Close"}" .path="${"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"}" dialogAction="close" class="header_button"></ha-icon-button> <span>${i}</span> </div> `;(0,o.Z)([(0,d.Mo)("ha-dialog")],(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",key:l.gA,value:void 0},{kind:"method",key:"scrollToPos",value:function(e,i){this.contentElement?.scrollTo(e,i)}},{kind:"method",key:"renderHeading",value:function(){return r.dy`<slot name="heading"> ${(0,n.Z)(t,"renderHeading",this,3)([])} </slot>`}},{kind:"method",key:"firstUpdated",value:function(){(0,n.Z)(t,"firstUpdated",this,3)([]),this.suppressDefaultPressSelector=[this.suppressDefaultPressSelector,c].join(", "),this._updateScrolledAttribute(),this.contentElement?.addEventListener("scroll",this._onScroll,{passive:!0})}},{kind:"method",key:"disconnectedCallback",value:function(){(0,n.Z)(t,"disconnectedCallback",this,3)([]),this.contentElement.removeEventListener("scroll",this._onScroll)}},{kind:"field",key:"_onScroll",value(){return()=>{this._updateScrolledAttribute()}}},{kind:"method",key:"_updateScrolledAttribute",value:function(){this.contentElement&&this.toggleAttribute("scrolled",0!==this.contentElement.scrollTop)}},{kind:"field",static:!0,key:"styles",value:()=>[s.W,r.iv`:host([scrolled]) ::slotted(ha-dialog-header){border-bottom:1px solid var(--mdc-dialog-scroll-divider-color,rgba(0,0,0,.12))}.mdc-dialog{--mdc-dialog-scroll-divider-color:var( --dialog-scroll-divider-color, var(--divider-color) );z-index:var(--dialog-z-index,8);-webkit-backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));--mdc-dialog-box-shadow:var(--dialog-box-shadow, none);--mdc-typography-headline6-font-weight:400;--mdc-typography-headline6-font-size:1.574rem}.mdc-dialog__actions{justify-content:var(--justify-action-buttons,flex-end);padding-bottom:max(env(safe-area-inset-bottom),24px)}.mdc-dialog__actions span:first-child{flex:var(--secondary-action-button-flex,unset)}.mdc-dialog__actions span:nth-child(2){flex:var(--primary-action-button-flex,unset)}.mdc-dialog__container{align-items:var(--vertical-align-dialog,center)}.mdc-dialog__title{padding:24px 24px 0 24px}.mdc-dialog__title:has(span){padding:12px 12px 0}.mdc-dialog__actions{padding:12px 24px 12px 24px}.mdc-dialog__title::before{content:unset}.mdc-dialog .mdc-dialog__content{position:var(--dialog-content-position,relative);padding:var(--dialog-content-padding,24px)}:host([hideactions]) .mdc-dialog .mdc-dialog__content{padding-bottom:max(var(--dialog-content-padding,24px),env(safe-area-inset-bottom))}.mdc-dialog .mdc-dialog__surface{position:var(--dialog-surface-position,relative);top:var(--dialog-surface-top);margin-top:var(--dialog-surface-margin-top);min-height:var(--mdc-dialog-min-height,auto);border-radius:var(--ha-dialog-border-radius,28px);-webkit-backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);background:var(--ha-dialog-surface-background,var(--mdc-theme-surface,#fff))}:host([flexContent]) .mdc-dialog .mdc-dialog__content{display:flex;flex-direction:column}.header_title{display:flex;align-items:center;direction:var(--direction)}.header_title span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;padding-left:4px}.header_button{text-decoration:none;color:inherit;inset-inline-start:initial;inset-inline-end:-12px;direction:var(--direction)}.dialog-actions{inset-inline-start:initial!important;inset-inline-end:0px!important;direction:var(--direction)}`]}]}}),a.M)},17170:function(e,i,t){t.a(e,(async function(e,o){try{t.r(i),t.d(i,{HaSpinner:()=>h});var n=t(44249),a=t(72621),s=t(97677),r=t(43580),d=t(57243),l=t(15093),c=e([s]);s=(c.then?(await c)():c)[0];let h=(0,n.Z)([(0,l.Mo)("ha-spinner")],(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,l.Cb)()],key:"size",value:void 0},{kind:"method",key:"updated",value:function(e){if((0,a.Z)(t,"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:()=>[r.Z,d.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)}}))},16611:function(e,i,t){t.a(e,(async function(e,i){try{var o=t(44249),n=t(72621),a=(t(56820),t(99619),t(57243)),s=t(15093),r=t(27934),d=t(6973),l=(t(94409),e([r,d]));[r,d]=l.then?(await l)():l;const c=["config","visibility"];(0,o.Z)([(0,s.Mo)("hui-badge-element-editor")],(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,s.SB)()],key:"_currTab",value:()=>c[0]},{kind:"method",key:"getConfigElement",value:async function(){const e=await(0,r.Sm)(this.configElementType);if(e&&e.getConfigElement)return e.getConfigElement()}},{kind:"method",key:"getConfigForm",value:async function(){const e=await(0,r.Sm)(this.configElementType);if(e&&e.getConfigForm)return e.getConfigForm()}},{kind:"method",key:"_handleTabChanged",value:function(e){const i=c[e.detail.index];i!==this._currTab&&(this._currTab=i)}},{kind:"method",key:"_configChanged",value:function(e){e.stopPropagation(),this.value=e.detail.value}},{kind:"method",key:"renderConfigElement",value:function(){let e=a.Ld;switch(this._currTab){case"config":e=a.dy`${(0,n.Z)(t,"renderConfigElement",this,3)([])}`;break;case"visibility":e=a.dy` <hui-badge-visibility-editor .hass="${this.hass}" .config="${this.value}" @value-changed="${this._configChanged}"></hui-badge-visibility-editor> `}return a.dy` <mwc-tab-bar .activeIndex="${c.indexOf(this._currTab)}" @MDCTabBar:activated="${this._handleTabChanged}"> ${c.map((e=>a.dy` <mwc-tab .label="${this.hass.localize(`ui.panel.lovelace.editor.edit_badge.tab_${e}`)}"> </mwc-tab> `))} </mwc-tab-bar> ${e} `}},{kind:"get",static:!0,key:"styles",value:function(){return[d.k.styles,a.iv`mwc-tab-bar{text-transform:uppercase;margin-bottom:16px;border-bottom:1px solid var(--divider-color)}`]}}]}}),d.k);i()}catch(e){i(e)}}))},94409:function(e,i,t){var o=t(44249),n=t(57243),a=t(15093),s=t(36522);t(99426),t(32145);(0,o.Z)([(0,a.Mo)("hui-badge-visibility-editor")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"config",value:void 0},{kind:"method",key:"render",value:function(){const e=this.config.visibility??[];return n.dy` <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> `}},{kind:"method",key:"_valueChanged",value:function(e){e.stopPropagation();const i=e.detail.value,t={...this.config,visibility:i};0===t.visibility?.length&&delete t.visibility,(0,s.B)(this,"value-changed",{value:t})}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`.intro{margin:0;color:var(--secondary-text-color);margin-bottom:8px}`}]}}),n.oi)},71586:function(e,i,t){t.a(e,(async function(e,o){try{t.r(i),t.d(i,{HuiDialogEditBadge:()=>$});var n=t(44249),a=t(96814),s=t.n(a),r=t(57243),d=t(15093),l=t(36522),c=t(20172),h=t(17170),u=(t(73729),t(95198),t(23334),t(6671)),g=t(17951),f=t(76131),m=t(28008),p=t(58885),v=t(69040),_=t(80373),y=t(27353),b=t(26197),k=t(2593),x=t(16611),E=e([h,v,_,x]);[h,v,_,x]=E.then?(await E)():E;const w="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",C="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";let $=(0,n.Z)([(0,d.Mo)("hui-dialog-edit-badge")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,d.Cb)({type:Boolean,reflect:!0})],key:"large",value:()=>!1},{kind:"field",decorators:[(0,d.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_badgeConfig",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_containerConfig",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_saving",value:()=>!1},{kind:"field",decorators:[(0,d.SB)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_guiModeAvailable",value:()=>!0},{kind:"field",decorators:[(0,d.IO)("hui-badge-element-editor")],key:"_badgeEditorEl",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_GUImode",value:()=>!0},{kind:"field",decorators:[(0,d.SB)()],key:"_documentationURL",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_dirty",value:()=>!1},{kind:"field",decorators:[(0,d.SB)()],key:"_isEscapeEnabled",value:()=>!0},{kind:"method",key:"showDialog",value:async function(e){this._params=e,this._GUImode=!0,this._guiModeAvailable=!0;const i=(0,k.an)(e.lovelaceConfig,e.path);if("strategy"in i)throw new Error("Can't edit strategy");if(this._containerConfig=i,"badgeConfig"in e)this._badgeConfig=e.badgeConfig,this._dirty=!0;else{const i=this._containerConfig.badges?.[e.badgeIndex];this._badgeConfig=null!=i?(0,u.d)(i):i}this.large=!1,this._badgeConfig&&!Object.isFrozen(this._badgeConfig)&&(this._badgeConfig=s()(this._badgeConfig))}},{kind:"method",key:"closeDialog",value:function(){return this._isEscapeEnabled=!0,window.removeEventListener("dialog-closed",this._enableEscapeKeyClose),window.removeEventListener("hass-more-info",this._disableEscapeKeyClose),this._dirty?(this._confirmCancel(),!1):(this._params=void 0,this._badgeConfig=void 0,this._error=void 0,this._documentationURL=void 0,this._dirty=!1,(0,l.B)(this,"dialog-closed",{dialog:this.localName}),!0)}},{kind:"method",key:"updated",value:function(e){if(!this._badgeConfig||void 0!==this._documentationURL||!e.has("_badgeConfig"))return;const i=e.get("_badgeConfig");i?.type!==this._badgeConfig.type&&(this._documentationURL=this._badgeConfig.type?(0,b.$)(this.hass,this._badgeConfig.type):void 0)}},{kind:"field",key:"_enableEscapeKeyClose",value(){return e=>{"ha-more-info-dialog"===e.detail.dialog&&(this._isEscapeEnabled=!0)}}},{kind:"field",key:"_disableEscapeKeyClose",value(){return()=>{this._isEscapeEnabled=!1}}},{kind:"method",key:"render",value:function(){if(!this._params)return r.Ld;let e;if(this._badgeConfig&&this._badgeConfig.type){let i;(0,g.IT)(this._badgeConfig.type)?(i=(0,g.bm)((0,g.V0)(this._badgeConfig.type))?.name,i?.toLowerCase().endsWith(" badge")&&(i=i.substring(0,i.length-6))):i=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:i})}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.dy` <ha-dialog open scrimClickAction .escapeKeyAction="${this._isEscapeEnabled?void 0:""}" @keydown="${this._ignoreKeydown}" @closed="${this._cancel}" @opened="${this._opened}" .heading="${e}"> <ha-dialog-header slot="heading"> <ha-icon-button slot="navigationIcon" dialogAction="cancel" .label="${this.hass.localize("ui.common.close")}" .path="${w}"></ha-icon-button> <span slot="title" @click="${this._enlarge}">${e}</span> ${void 0!==this._documentationURL?r.dy` <a slot="actionItems" href="${this._documentationURL}" title="${this.hass.localize("ui.panel.lovelace.menu.help")}" target="_blank" rel="noreferrer" dir="${(0,c.Zu)(this.hass)}"> <ha-icon-button .path="${C}"></ha-icon-button> </a> `:r.Ld} </ha-dialog-header> <div class="content"> <div class="element-editor"> <hui-badge-element-editor .hass="${this.hass}" .lovelace="${this._params.lovelaceConfig}" .value="${this._badgeConfig}" @config-changed="${this._handleConfigChanged}" @GUImode-changed="${this._handleGUIModeChanged}" @editor-save="${this._save}" dialogInitialFocus></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.dy` <ha-spinner size="small" aria-label="Can't update badge"></ha-spinner> `:""} </div> </div> ${void 0!==this._badgeConfig?r.dy` <mwc-button 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")} </mwc-button> `:""} <div slot="primaryAction" @click="${this._save}"> <mwc-button @click="${this._cancel}" dialogInitialFocus> ${this.hass.localize("ui.common.cancel")} </mwc-button> ${void 0!==this._badgeConfig&&this._dirty?r.dy` <mwc-button ?disabled="${!this._canSave||this._saving}" @click="${this._save}"> ${this._saving?r.dy` <ha-spinner aria-label="Saving" size="small"></ha-spinner> `:this.hass.localize("ui.common.save")} </mwc-button> `:""} </div> </ha-dialog> `}},{kind:"method",key:"_enlarge",value:function(){this.large=!this.large}},{kind:"method",key:"_ignoreKeydown",value:function(e){e.stopPropagation()}},{kind:"method",key:"_handleConfigChanged",value:function(e){this._badgeConfig=s()(e.detail.config),this._error=e.detail.error,this._guiModeAvailable=e.detail.guiModeAvailable,this._dirty=!0}},{kind:"method",key:"_handleGUIModeChanged",value:function(e){e.stopPropagation(),this._GUImode=e.detail.guiMode,this._guiModeAvailable=e.detail.guiModeAvailable}},{kind:"method",key:"_toggleMode",value:function(){this._badgeEditorEl?.toggleMode()}},{kind:"method",key:"_opened",value:function(){window.addEventListener("dialog-closed",this._enableEscapeKeyClose),window.addEventListener("hass-more-info",this._disableEscapeKeyClose),this._badgeEditorEl?.focusYamlEditor()}},{kind:"get",key:"_canSave",value:function(){return!this._saving&&(void 0!==this._badgeConfig&&(!this._badgeEditorEl||!this._badgeEditorEl.hasError))}},{kind:"method",key:"_confirmCancel",value:async function(){await new Promise((e=>{setTimeout(e,0)}));await(0,f.showConfirmationDialog)(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()}},{kind:"method",key:"_cancel",value:function(e){e&&e.stopPropagation(),this._dirty=!1,this.closeDialog()}},{kind:"method",key:"_save",value:async function(){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,y.ll)(this._params.lovelaceConfig,e,this._badgeConfig):(0,y.kg)(this._params.lovelaceConfig,[...e,this._params.badgeIndex],this._badgeConfig)),this._saving=!1,this._dirty=!1,(0,p.f)(this,this.hass),this.closeDialog()}},{kind:"get",static:!0,key:"styles",value:function(){return[m.yu,r.iv`:host{--code-mirror-max-height:calc(100vh - 176px)}ha-dialog{--mdc-dialog-max-width:100px;--dialog-z-index:6;--dialog-surface-position:fixed;--dialog-surface-top:40px;--mdc-dialog-max-width:90vw;--dialog-content-padding:24px 12px}.content{width:calc(90vw - 48px);max-width:1000px}@media all and (max-width:450px),all and (max-height:500px){ha-dialog{height:100%;--mdc-dialog-max-height:100%;--dialog-surface-top:0px;--mdc-dialog-max-width:100vw}.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:4px;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}.header{display:flex;align-items:center;justify-content:space-between}ha-dialog-header a{color:inherit;text-decoration:none}`]}}]}}),r.oi);o()}catch(e){o(e)}}))},26197:function(e,i,t){t.d(i,{$:()=>s,Q:()=>a});var o=t(17951),n=t(73192);const a=(e,i)=>(0,o.IT)(i)?(0,o.cs)((0,o.V0)(i))?.documentationURL:`${(0,n.R)(e,"/dashboards/")}${i}`,s=(e,i)=>(0,o.IT)(i)?(0,o.bm)((0,o.V0)(i))?.documentationURL:`${(0,n.R)(e,"/dashboards/badges")}`},32012:function(e,i,t){t.d(i,{e:()=>o});class o extends Error{constructor(e,i,t){super(e),this.warnings=void 0,this.errors=void 0,this.name="GUISupportError",this.warnings=i,this.errors=t}}},43299:function(e,i,t){t.a(e,(async function(e,o){try{t.d(i,{O:()=>p});var n=t(44249),a=t(72621),s=(t(9359),t(31526),t(70104),t(57243)),r=t(15093),d=t(67064),l=t(36522),c=t(22381),h=t(41680),u=t(48045),g=(t(99426),t(17170)),f=(t(64889),t(32012)),m=e([g]);g=(m.then?(await m)():m)[0];let p=(0,n.Z)(null,(function(e,i){class o extends i{constructor(...i){super(...i),e(this)}}return{F:o,d:[{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"lovelace",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"context",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_config",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_configElement",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_subElementEditorConfig",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_guiMode",value:()=>!0},{kind:"field",decorators:[(0,r.SB)()],key:"_errors",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_pendingYamlError",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_yamlError",value:()=>!1},{kind:"field",decorators:[(0,r.SB)()],key:"_warnings",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_guiSupported",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_loading",value:()=>!1},{kind:"field",decorators:[(0,r.IO)("ha-yaml-editor")],key:"_yamlEditor",value:void 0},{kind:"get",key:"value",value:function(){return this._config}},{kind:"set",key:"value",value:function(e){this._config&&(0,u.v)(e,this._config)||(this._config=e,this._errors=void 0,this._setConfig())}},{kind:"method",key:"_setConfig",value:function(){if(!this._errors)try{this._updateConfigElement()}catch(e){this._errors=[e.message]}this.updateComplete.then((()=>{(0,l.B)(this,"config-changed",{config:this.value,error:this._errors?.join(", "),guiModeAvailable:!(this.hasWarning||this.hasError||!1===this._guiSupported)})}))}},{kind:"get",key:"hasWarning",value:function(){return void 0!==this._warnings&&this._warnings.length>0}},{kind:"get",key:"hasError",value:function(){return void 0!==this._errors&&this._errors.length>0}},{kind:"get",key:"GUImode",value:function(){return this._guiMode}},{kind:"set",key:"GUImode",value:function(e){this._guiMode=e,this.updateComplete.then((()=>{(0,l.B)(this,"GUImode-changed",{guiMode:e,guiModeAvailable:!(this.hasWarning||this.hasError||!1===this._guiSupported)})}))}},{kind:"method",key:"toggleMode",value:function(){this.GUImode=!this.GUImode}},{kind:"method",key:"focusYamlEditor",value:function(){this._configElement?.focusYamlEditor&&this._configElement.focusYamlEditor(),this._yamlEditor&&this._yamlEditor.focus()}},{kind:"method",key:"getConfigElement",value:async function(){}},{kind:"method",key:"getConfigForm",value:async function(){}},{kind:"method",key:"renderConfigElement",value:function(){return s.dy`${this._configElement}`}},{kind:"method",key:"_renderSubElement",value:function(){return s.dy` <hui-sub-element-editor .hass="${this.hass}" .config="${this._subElementEditorConfig}" @go-back="${this._goBack}" @config-changed="${this._subElementChanged}"> </hui-sub-element-editor> `}},{kind:"method",key:"_subElementChanged",value:function(e){e.stopPropagation();const i=e.detail.config;this._subElementEditorConfig={...this._subElementEditorConfig,elementConfig:i},this._subElementEditorConfig.saveElementConfig?.(i)}},{kind:"method",key:"_goBack",value:function(e){e.stopPropagation(),this._subElementEditorConfig=void 0}},{kind:"method",key:"_editSubElement",value:async function(e){e.stopPropagation(),await Promise.all([t.e("91552"),t.e("78456"),t.e("56898"),t.e("35671"),t.e("92139"),t.e("32146"),t.e("37602"),t.e("18865"),t.e("88975"),t.e("79931"),t.e("44251"),t.e("65005"),t.e("60487"),t.e("3371"),t.e("38326"),t.e("10745"),t.e("16912"),t.e("92368"),t.e("95444"),t.e("8754"),t.e("54291"),t.e("76986")]).then(t.bind(t,50357)),this._subElementEditorConfig={type:e.detail.type,elementConfig:e.detail.config,context:e.detail.context,saveElementConfig:e.detail.saveConfig}}},{kind:"method",key:"render",value:function(){return s.dy` <div class="wrapper"> ${this.GUImode?s.dy` <div class="gui-editor" @edit-sub-element="${this._editSubElement}"> ${this._loading?s.dy` <ha-spinner class="center margin-bot"></ha-spinner> `:(0,d.F)(this._subElementEditorConfig?this._renderSubElement():this.renderConfigElement())} </div> `:s.dy` <div class="yaml-editor"> <ha-yaml-editor .defaultValue="${this._config}" autofocus .hass="${this.hass}" @value-changed="${this._handleYAMLChanged}" @blur="${this._onBlurYaml}" @keydown="${this._ignoreKeydown}" dir="ltr"></ha-yaml-editor> </div> `} ${!1===this._guiSupported&&!1===this._loading?s.dy` <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.Ld} ${this.hasError?s.dy` <ha-alert alert-type="error" .title="${this.hass.localize("ui.errors.config.configuration_error")}"> <ul> ${this._errors.map((e=>s.dy`<li>${e}</li>`))} </ul> </ha-alert> `:s.Ld} ${this.hasWarning?s.dy` <ha-alert alert-type="warning" .title="${this.hass.localize("ui.errors.config.visual_editor_not_supported")}"> <ul> ${this._warnings.map((e=>s.dy`<li>${e}</li>`))} </ul> ${this.hass.localize("ui.errors.config.edit_in_yaml_supported")} </ha-alert> `:s.Ld} </div> `}},{kind:"method",key:"updated",value:function(e){(0,a.Z)(o,"updated",this,3)([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)}},{kind:"method",key:"_handleUIConfigChanged",value:function(e){if(e.stopPropagation(),!this.GUImode)return;const i=e.detail.config;Object.keys(i).forEach((e=>{void 0===i[e]&&delete i[e]})),this.value=i}},{kind:"method",key:"_handleYAMLChanged",value:function(e){e.stopPropagation();const i=e.detail.value;e.detail.isValid?(this._config=i,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())}},{kind:"field",key:"_debounceYamlError",value(){return(0,c.D)((()=>{this._pendingYamlError&&(this._yamlError=!0,this._errors=[this._pendingYamlError],this._pendingYamlError=void 0,this._setConfig())}),2e3)}},{kind:"method",key:"_onBlurYaml",value:function(){this._debounceYamlError.cancel(),this._pendingYamlError&&(this._yamlError=!0,this._errors=[this._pendingYamlError],this._pendingYamlError=void 0,this._setConfig())}},{kind:"method",key:"unloadConfigElement",value:async function(){this._configElement=void 0,this._guiSupported=void 0}},{kind:"method",key:"loadConfigElement",value:async function(){if(this._configElement)return;let e=await this.getConfigElement();if(!e){const i=await this.getConfigForm();if(i){await t.e("10106").then(t.bind(t,66374)),e=document.createElement("hui-form-editor");const{schema:o,assertConfig:n,computeLabel:a,computeHelper:s}=i;e.schema=o,a&&(e.computeLabel=a),s&&(e.computeHelper=s),n&&(e.assertConfig=n)}}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}},{kind:"method",key:"_updateConfigElement",value:async function(){if(this.value)try{if(this._errors=void 0,this._warnings=void 0,await this.loadConfigElement(),this._configElement)try{this._configElement.setConfig(this.value)}catch(e){const i=(0,h.p)(this.hass,e);throw new f.e("Config is not supported",i.warnings,i.errors)}else this._guiSupported=!1,this.GUImode=!1}catch(e){e instanceof f.e?(this._warnings=e.warnings??[e.message],this._errors=e.errors||void 0):this._errors=[e.message],this.GUImode=!1}finally{this._loading=!1}}},{kind:"method",key:"_ignoreKeydown",value:function(e){e.stopPropagation()}},{kind:"field",static:!0,key:"styles",value:()=>s.iv`: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}`}]}}),s.oi);o()}catch(e){o(e)}}))},6973:function(e,i,t){t.a(e,(async function(e,o){try{t.d(i,{k:()=>l});var n=t(44249),a=t(72621),s=t(15093),r=t(43299),d=e([r]);r=(d.then?(await d)():d)[0];let l=(0,n.Z)(null,(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,s.SB)()],key:"_configElementType",value:void 0},{kind:"get",key:"configElementType",value:function(){return this.value?this.value.type:void 0}},{kind:"method",key:"loadConfigElement",value:async function(){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(0,a.Z)(t,"loadConfigElement",this,3)([])}}]}}),r.O);o()}catch(e){o(e)}}))},73192:function(e,i,t){t.d(i,{R:()=>o});const o=(e,i)=>`https://www.iobroker.net/#${e.language&&e.language.split("-")[0]||"en"}/adapters/adapterref/iobroker.lovelace/README.md#`},58885:function(e,i,t){t.d(i,{f:()=>n});var o=t(72473);const n=(e,i)=>(0,o.C)(e,{message:i.localize("ui.common.successfully_saved")})},48734:function(e,i,t){t.a(e,(async function(e,o){try{t.d(i,{P5:()=>u,Ve:()=>f});var n=t(16485),a=(t(9359),t(70104),t(92519),t(42179),t(89256),t(24931),t(88463),t(57449),t(19814),e([n]));n=(a.then?(await a)():a)[0];const s=new Set,r=new Map;let d,l="ltr",c="en";const h="undefined"!=typeof MutationObserver&&"undefined"!=typeof document&&void 0!==document.documentElement;if(h){const m=new MutationObserver(g);l=document.documentElement.dir||"ltr",c=document.documentElement.lang||navigator.language,m.observe(document.documentElement,{attributes:!0,attributeFilter:["dir","lang"]})}function u(...e){e.map((e=>{const i=e.$code.toLowerCase();r.has(i)?r.set(i,Object.assign(Object.assign({},r.get(i)),e)):r.set(i,e),d||(d=e)})),g()}function g(){h&&(l=document.documentElement.dir||"ltr",c=document.documentElement.lang||navigator.language),[...s.keys()].map((e=>{"function"==typeof e.requestUpdate&&e.requestUpdate()}))}class f{constructor(e){this.host=e,this.host.addController(this)}hostConnected(){s.add(this.host)}hostDisconnected(){s.delete(this.host)}dir(){return`${this.host.dir||l}`.toLowerCase()}lang(){return`${this.host.lang||c}`.toLowerCase()}getTranslationData(e){var i,t;const o=new Intl.Locale(e.replace(/_/g,"-")),n=null==o?void 0:o.language.toLowerCase(),a=null!==(t=null===(i=null==o?void 0:o.region)||void 0===i?void 0:i.toLowerCase())&&void 0!==t?t:"";return{locale:o,language:n,region:a,primary:r.get(`${n}-${a}`),secondary:r.get(n)}}exists(e,i){var t;const{primary:o,secondary:n}=this.getTranslationData(null!==(t=i.lang)&&void 0!==t?t:this.lang());return i=Object.assign({includeFallback:!1},i),!!(o&&o[e]||n&&n[e]||i.includeFallback&&d&&d[e])}term(e,...i){const{primary:t,secondary:o}=this.getTranslationData(this.lang());let n;if(t&&t[e])n=t[e];else if(o&&o[e])n=o[e];else{if(!d||!d[e])return console.error(`No translation found for: ${String(e)}`),String(e);n=d[e]}return"function"==typeof n?n(...i):n}date(e,i){return e=new Date(e),new Intl.DateTimeFormat(this.lang(),i).format(e)}number(e,i){return e=Number(e),isNaN(e)?"":new Intl.NumberFormat(this.lang(),i).format(e)}relativeTime(e,i,t){return new Intl.RelativeTimeFormat(this.lang(),t).format(e,i)}}o()}catch(p){o(p)}}))},68783:function(e,i,t){t.a(e,(async function(e,o){try{t.d(i,{A:()=>c});var n=t(64699),a=t(15073),s=t(81048),r=t(31027),d=t(57243),l=e([a]);a=(l.then?(await l)():l)[0];var c=class extends r.P{constructor(){super(...arguments),this.localize=new a.V(this)}render(){return d.dy` <svg part="base" class="spinner" role="progressbar" aria-label="${this.localize.term("loading")}"> <circle class="spinner__track"></circle> <circle class="spinner__indicator"></circle> </svg> `}};c.styles=[s.N,n.D],o()}catch(e){o(e)}}))},31027:function(e,i,t){t.d(i,{P:()=>r});t(9359),t(31526);var o,n=t(52812),a=t(57243),s=t(15093),r=class extends a.oi{constructor(){super(),(0,n.Ko)(this,o,!1),this.initialReflectedProperties=new Map,Object.entries(this.constructor.dependencies).forEach((([e,i])=>{this.constructor.define(e,i)}))}emit(e,i){const t=new CustomEvent(e,(0,n.ih)({bubbles:!0,cancelable:!1,composed:!0,detail:{}},i));return this.dispatchEvent(t),t}static define(e,i=this,t={}){const o=customElements.get(e);if(!o){try{customElements.define(e,i,t)}catch(o){customElements.define(e,class extends i{},t)}return}let n=" (unknown version)",a=n;"version"in i&&i.version&&(n=" v"+i.version),"version"in o&&o.version&&(a=" v"+o.version),n&&a&&n===a||console.warn(`Attempted to register <${e}>${n}, but <${e}>${a} has already been registered.`)}attributeChangedCallback(e,i,t){(0,n.ac)(this,o)||(this.constructor.elementProperties.forEach(((e,i)=>{e.reflect&&null!=this[i]&&this.initialReflectedProperties.set(i,this[i])})),(0,n.qx)(this,o,!0)),super.attributeChangedCallback(e,i,t)}willUpdate(e){super.willUpdate(e),this.initialReflectedProperties.forEach(((i,t)=>{e.has(t)&&null==this[t]&&(this[t]=i)}))}};o=new WeakMap,r.version="2.20.1",r.dependencies={},(0,n.u2)([(0,s.Cb)()],r.prototype,"dir",2),(0,n.u2)([(0,s.Cb)()],r.prototype,"lang",2)},15073:function(e,i,t){t.a(e,(async function(e,o){try{t.d(i,{V:()=>r});var n=t(21262),a=t(48734),s=e([a,n]);[a,n]=s.then?(await s)():s;var r=class extends a.Ve{};(0,a.P5)(n.K),o()}catch(e){o(e)}}))},21262:function(e,i,t){t.a(e,(async function(e,o){try{t.d(i,{K:()=>r});var n=t(48734),a=e([n]);n=(a.then?(await a)():a)[0];var s={$code:"en",$name:"English",$dir:"ltr",carousel:"Carousel",clearEntry:"Clear entry",close:"Close",copied:"Copied",copy:"Copy",currentValue:"Current value",error:"Error",goToSlide:(e,i)=>`Go to slide ${e} of ${i}`,hidePassword:"Hide password",loading:"Loading",nextSlide:"Next slide",numOptionsSelected:e=>0===e?"No options selected":1===e?"1 option selected":`${e} options selected`,previousSlide:"Previous slide",progress:"Progress",remove:"Remove",resize:"Resize",scrollToEnd:"Scroll to end",scrollToStart:"Scroll to start",selectAColorFromTheScreen:"Select a color from the screen",showPassword:"Show password",slideNum:e=>`Slide ${e}`,toggleColorFormat:"Toggle color format"};(0,n.P5)(s);var r=s;o()}catch(e){o(e)}}))},64699:function(e,i,t){t.d(i,{D:()=>o});var o=t(57243).iv`:host{--track-width:2px;--track-color:rgb(128 128 128 / 25%);--indicator-color:var(--sl-color-primary-600);--speed:2s;display:inline-flex;width:1em;height:1em;flex:none}.spinner{flex:1 1 auto;height:100%;width:100%}.spinner__indicator,.spinner__track{fill:none;stroke-width:var(--track-width);r:calc(0.5em - var(--track-width)/ 2);cx:0.5em;cy:0.5em;transform-origin:50% 50%}.spinner__track{stroke:var(--track-color);transform-origin:0% 0%}.spinner__indicator{stroke:var(--indicator-color);stroke-linecap:round;stroke-dasharray:150% 75%;animation:spin var(--speed) linear infinite}@keyframes spin{0%{transform:rotate(0deg);stroke-dasharray:0.05em,3em}50%{transform:rotate(450deg);stroke-dasharray:1.375em,1.375em}100%{transform:rotate(1080deg);stroke-dasharray:0.05em,3em}}`},52812:function(e,i,t){t.d(i,{EZ:()=>g,Ko:()=>v,ac:()=>p,ih:()=>u,qx:()=>_,u2:()=>f});var o=Object.defineProperty,n=Object.defineProperties,a=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,c=e=>{throw TypeError(e)},h=(e,i,t)=>i in e?o(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t,u=(e,i)=>{for(var t in i||(i={}))d.call(i,t)&&h(e,t,i[t]);if(r)for(var t of r(i))l.call(i,t)&&h(e,t,i[t]);return e},g=(e,i)=>n(e,s(i)),f=(e,i,t,n)=>{for(var s,r=n>1?void 0:n?a(i,t):i,d=e.length-1;d>=0;d--)(s=e[d])&&(r=(n?s(i,t,r):s(r))||r);return n&&r&&o(i,t,r),r},m=(e,i,t)=>i.has(e)||c("Cannot "+t),p=(e,i,t)=>(m(e,i,"read from private field"),t?t.call(e):i.get(e)),v=(e,i,t)=>i.has(e)?c("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(e):i.set(e,t),_=(e,i,t,o)=>(m(e,i,"write to private field"),o?o.call(e,t):i.set(e,t),t)},81048:function(e,i,t){t.d(i,{N:()=>o});var o=t(57243).iv`:host{box-sizing:border-box}:host *,:host ::after,:host ::before{box-sizing:inherit}[hidden]{display:none!important}`},97677:function(e,i,t){t.a(e,(async function(e,o){try{t.d(i,{Z:()=>n.A});var n=t(68783),a=(t(64699),t(15073)),s=t(21262),r=(t(81048),t(31027),t(52812),e([a,s,n]));[a,s,n]=r.then?(await r)():r,o()}catch(e){o(e)}}))},43580:function(e,i,t){t.d(i,{Z:()=>o.D});var o=t(64699);t(52812)},67064:function(e,i,t){t.d(i,{F:()=>r});var o=t(2841),n=t(45779),a=t(53232);const s=e=>(0,a.dZ)(e)?e._$litType$.h:e.strings,r=(0,n.XM)(class extends n.Xe{constructor(e){super(e),this.tt=new WeakMap}render(e){return[e]}update(e,[i]){const t=(0,a.hN)(this.et)?s(this.et):null,n=(0,a.hN)(i)?s(i):null;if(null!==t&&(null===n||t!==n)){const i=(0,a.i9)(e).pop();let n=this.tt.get(t);if(void 0===n){const e=document.createDocumentFragment();n=(0,o.sY)(o.Ld,e),n.setConnected(!1),this.tt.set(t,n)}(0,a.hl)(n,[i]),(0,a._Y)(n,void 0,i)}if(null!==n){if(null===t||t!==n){const i=this.tt.get(n);if(void 0!==i){const t=(0,a.i9)(i).pop();(0,a.E_)(e),(0,a._Y)(e,void 0,t),(0,a.hl)(e,[t])}}this.et=i}else this.et=void 0;return this.render(i)}})}}; //# sourceMappingURL=67991.f078b44a6719c3e2.js.map