UNPKG

iobroker.lovelace

Version:

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

8 lines 24.1 kB
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["10216"],{95198:function(e,i,t){var a=t(61701),n=(t(71695),t(47021),t(57243)),s=t(50778);let d,o,r=e=>e;(0,a.Z)([(0,s.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(0,n.dy)(d||(d=r` <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[(0,n.iv)(o||(o=r`: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:()=>v});var a=t(61701),n=t(72621),s=(t(22152),t(71695),t(47021),t(74966)),d=t(51408),o=t(57243),r=t(50778),l=t(76525);t(23334);let c,h,g,u=e=>e;const p=["button","ha-list-item"],v=(e,i)=>{var t;return(0,o.dy)(c||(c=u` <div class="header_title"> <ha-icon-button .label="${0}" .path="${0}" dialogAction="close" class="header_button"></ha-icon-button> <span>${0}</span> </div> `),null!==(t=null==e?void 0:e.localize("ui.common.close"))&&void 0!==t?t:"Close","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",i)};(0,a.Z)([(0,r.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){var t;null===(t=this.contentElement)||void 0===t||t.scrollTo(e,i)}},{kind:"method",key:"renderHeading",value:function(){return(0,o.dy)(h||(h=u`<slot name="heading"> ${0} </slot>`),(0,n.Z)(t,"renderHeading",this,3)([]))}},{kind:"method",key:"firstUpdated",value:function(){var e;(0,n.Z)(t,"firstUpdated",this,3)([]),this.suppressDefaultPressSelector=[this.suppressDefaultPressSelector,p].join(", "),this._updateScrolledAttribute(),null===(e=this.contentElement)||void 0===e||e.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(){return[d.W,(0,o.iv)(g||(g=u`: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)}`))]}}]}}),s.M)},17170:function(e,i,t){t.a(e,(async function(e,a){try{t.r(i),t.d(i,{HaSpinner:()=>u});var n=t(61701),s=t(72621),d=(t(71695),t(47021),t(97677)),o=t(43580),r=t(57243),l=t(50778),c=e([d]);d=(c.then?(await c)():c)[0];let h,g=e=>e,u=(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,s.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(){return[o.Z,(0,r.iv)(h||(h=g`: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)}`))]}}]}}),d.Z);a()}catch(h){a(h)}}))},279:function(e,i,t){t.d(i,{Qc:()=>l,Xr:()=>r,zJ:()=>o});t(19083),t(71695),t(9359),t(31526),t(92519),t(42179),t(89256),t(24931),t(88463),t(57449),t(19814),t(47021);const a=["zone","persistent_notification"],n=(e,i)=>{var t,a,n,s,d,o,r,l;if(!("call-service"===i.action&&(null!==(t=i.target)&&void 0!==t&&t.entity_id||null!==(a=i.service_data)&&void 0!==a&&a.entity_id||null!==(n=i.data)&&void 0!==n&&n.entity_id)))return;let c=null!==(s=null!==(d=null===(o=i.service_data)||void 0===o?void 0:o.entity_id)&&void 0!==d?d:null===(r=i.data)||void 0===r?void 0:r.entity_id)&&void 0!==s?s:null===(l=i.target)||void 0===l?void 0:l.entity_id;Array.isArray(c)||(c=[c]);for(const h of c)e.add(h)},s=(e,i)=>{i&&("string"!=typeof i?(i.entity&&e.add(i.entity),i.camera_image&&e.add(i.camera_image),i.tap_action&&n(e,i.tap_action),i.hold_action&&n(e,i.hold_action)):e.add(i))},d=(e,i)=>{i.entity&&s(e,i.entity),i.entities&&Array.isArray(i.entities)&&i.entities.forEach((i=>s(e,i))),i.card&&d(e,i.card),i.cards&&Array.isArray(i.cards)&&i.cards.forEach((i=>d(e,i))),i.elements&&Array.isArray(i.elements)&&i.elements.forEach((i=>d(e,i))),i.badges&&Array.isArray(i.badges)&&i.badges.forEach((i=>s(e,i))),i.sections&&Array.isArray(i.sections)&&i.sections.forEach((i=>d(e,i)))},o=e=>{const i=new Set;return e.views.forEach((e=>{d(i,e)})),i},r=(e,i)=>{const t=new Set;for(const n of Object.keys(e.states))i.has(n)||a.includes(n.split(".",1)[0])||t.add(n);return t},l=(e,i)=>{const t=o(i);return r(e,t)}},52263:function(e,i,t){t.a(e,(async function(e,i){try{var a=t(61701),n=(t(63721),t(19083),t(71695),t(61893),t(9359),t(56475),t(70104),t(19423),t(40251),t(19134),t(61006),t(47706),t(47021),t(41298)),s=t(57243),d=t(50778),o=t(35359),r=t(69634),l=t(94571),c=t(27486),h=t(68958),g=t(36522),u=t(1416),p=t(17170),v=(t(36841),t(96194)),m=t(17951),b=t(279),f=t(27934),y=t(67483),_=t(24293),k=e([p,f,y]);[p,f,y]=k.then?(await k)():k;let x,w,$,C,E,z,B,S,L,A,Z,P=e=>e;(0,a.Z)([(0,d.Mo)("hui-badge-picker")],(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)({attribute:!1})],key:"suggestedBadges",value:void 0},{kind:"field",decorators:[(0,h.t)({key:"dashboardBadgeClipboard",state:!0,subscribe:!0,storage:"sessionStorage"})],key:"_clipboard",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_badges",value(){return[]}},{kind:"field",key:"lovelace",value:void 0},{kind:"field",key:"badgePicked",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_filter",value(){return""}},{kind:"field",decorators:[(0,d.SB)()],key:"_width",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_height",value:void 0},{kind:"field",key:"_unusedEntities",value:void 0},{kind:"field",key:"_usedEntities",value:void 0},{kind:"field",key:"_filterBadges",value(){return(0,c.Z)(((e,i)=>{if(!i)return e;let t=e.map((e=>e.badge));const a={keys:["type","name","description"],isCaseSensitive:!1,minMatchCharLength:Math.min(i.length,2),threshold:.2,ignoreDiacritics:!0},s=new n.Z(t,a);return t=s.search(i).map((e=>e.item)),e.filter((e=>t.includes(e.badge)))}))}},{kind:"field",key:"_suggestedBadges",value(){return(0,c.Z)((e=>e.filter((e=>e.badge.isSuggested))))}},{kind:"field",key:"_customBadges",value(){return(0,c.Z)((e=>e.filter((e=>e.badge.isCustom&&!e.badge.isSuggested))))}},{kind:"field",key:"_otherBadges",value(){return(0,c.Z)((e=>e.filter((e=>!e.badge.isSuggested&&!e.badge.isCustom))))}},{kind:"method",key:"render",value:function(){if(!(this.hass&&this.lovelace&&this._unusedEntities&&this._usedEntities))return s.Ld;const e=this._suggestedBadges(this._badges),i=this._otherBadges(this._badges),t=this._customBadges(this._badges);return(0,s.dy)(x||(x=P` <search-input .hass="${0}" .filter="${0}" @value-changed="${0}" .label="${0}"></search-input> <div id="content" style="${0}"> <div class="badges-container"> ${0} </div> <div class="badges-container"> <div class="badge manual" @click="${0}" .config="${0}"> <div class="badge-header"> ${0} </div> <div class="preview description"> ${0} </div> </div> </div> </div> `),this.hass,this._filter,this._handleSearchChange,this.hass.localize("ui.panel.lovelace.editor.edit_badge.search_badgess"),(0,r.V)({width:this._width?`${this._width}px`:"auto",height:this._height?`${this._height}px`:"auto"}),this._filter?this._filterBadges(this._badges,this._filter).map((e=>e.element)):(0,s.dy)(w||(w=P` ${0} ${0} ${0} ${0} ${0} ${0} ${0} `),e.length>0?(0,s.dy)($||($=P` <div class="badges-container-header"> ${0} </div> `),this.hass.localize("ui.panel.lovelace.editor.badge.generic.suggested_badges")):s.Ld,this._renderClipboardBadge(),e.map((e=>e.element)),e.length>0?(0,s.dy)(C||(C=P` <div class="badges-container-header"> ${0} </div> `),this.hass.localize("ui.panel.lovelace.editor.badge.generic.other_badges")):s.Ld,i.map((e=>e.element)),t.length>0?(0,s.dy)(E||(E=P` <div class="badges-container-header"> ${0} </div> `),this.hass.localize("ui.panel.lovelace.editor.badge.generic.custom_badges")):s.Ld,t.map((e=>e.element))),this._badgePicked,{type:""},this.hass.localize("ui.panel.lovelace.editor.badge.generic.manual"),this.hass.localize("ui.panel.lovelace.editor.badge.generic.manual_description"))}},{kind:"method",key:"shouldUpdate",value:function(e){const i=e.get("hass");return!i||i.locale!==this.hass.locale}},{kind:"method",key:"firstUpdated",value:function(){if(!this.hass||!this.lovelace)return;const e=(0,b.zJ)(this.lovelace),i=(0,b.Xr)(this.hass,e);this._usedEntities=[...e].filter((e=>this.hass.states[e]&&!(0,v.rk)(this.hass.states[e].state))),this._unusedEntities=[...i].filter((e=>this.hass.states[e]&&!(0,v.rk)(this.hass.states[e].state))),this._loadBages()}},{kind:"method",key:"_loadBages",value:function(){let e=_.M.map((e=>{var i;return Object.assign({name:this.hass.localize(`ui.panel.lovelace.editor.badge.${e.type}.name`),description:this.hass.localize(`ui.panel.lovelace.editor.badge.${e.type}.description`),isSuggested:(null===(i=this.suggestedBadges)||void 0===i?void 0:i.includes(e.type))||!1},e)}));e=e.sort(((e,i)=>{var t;return e.isSuggested&&!i.isSuggested?-1:!e.isSuggested&&i.isSuggested?1:(0,u.$K)(e.name||e.type,i.name||i.type,null===(t=this.hass)||void 0===t?void 0:t.language)})),m.$.length>0&&(e=e.concat(m.$.map((e=>({type:e.type,name:e.name,description:e.description,showElement:e.preview,isCustom:!0}))).sort(((e,i)=>{var t;return(0,u.$K)(e.name||e.type,i.name||i.type,null===(t=this.hass)||void 0===t?void 0:t.language)})))),this._badges=e.map((e=>({badge:e,element:(0,s.dy)(z||(z=P`${0}`),(0,l.C)(this._renderBadgeElement(e),(0,s.dy)(B||(B=P` <div class="badge spinner"> <ha-spinner></ha-spinner> </div> `))))})))}},{kind:"method",key:"_renderClipboardBadge",value:function(){return this._clipboard?(0,s.dy)(S||(S=P` ${0}`),(0,l.C)(this._renderBadgeElement({type:this._clipboard.type,showElement:!0,isCustom:!1,name:this.hass.localize("ui.panel.lovelace.editor.badge.generic.paste"),description:`${this.hass.localize("ui.panel.lovelace.editor.badge.generic.paste_description",{type:this._clipboard.type})}`},this._clipboard),(0,s.dy)(L||(L=P` <div class="badge spinner"> <ha-spinner></ha-spinner> </div> `)))):s.Ld}},{kind:"method",key:"_handleSearchChange",value:function(e){const i=e.detail.value;if(i){if(!this._width||!this._height){const e=this.shadowRoot.getElementById("content");if(e&&!this._width){const i=e.clientWidth;i&&(this._width=i)}if(e&&!this._height){const i=e.clientHeight;i&&(this._height=i)}}}else this._width=void 0,this._height=void 0;this._filter=i}},{kind:"method",key:"_badgePicked",value:function(e){const i=e.currentTarget.config;(0,g.B)(this,"config-changed",{config:i})}},{kind:"method",key:"_tryCreateBadgeElement",value:function(e){const i=(0,f.t5)(e);return i.hass=this.hass,i.addEventListener("ll-rebuild",(t=>{t.stopPropagation(),this._rebuildBadge(i,e)}),{once:!0}),i}},{kind:"method",key:"_rebuildBadge",value:function(e,i){let t;try{t=this._tryCreateBadgeElement(i)}catch(a){return}e.parentElement&&e.parentElement.replaceChild(t,e)}},{kind:"method",key:"_renderBadgeElement",value:async function(e,i){let{type:t}=e;const{showElement:a,isCustom:n,name:d,description:r}=e,l=n?(0,m.bm)(t):void 0;let c;n&&(t=`${m.Qo}${t}`);let h=null!=i?i:{type:t};if(this.hass&&this.lovelace&&(i||(h=await(0,y.s)(this.hass,t,this._unusedEntities,this._usedEntities)),a))try{c=this._tryCreateBadgeElement(h)}catch(g){c=void 0}return(0,s.dy)(A||(A=P` <div class="badge"> <div class="overlay" @click="${0}" .config="${0}"></div> <div class="badge-header"> ${0} </div> <div class="preview ${0}"> ${0} </div> </div> `),this._badgePicked,h,l?`${this.hass.localize("ui.panel.lovelace.editor.badge_picker.custom_badge")}: ${l.name||l.type}`:d,(0,o.$)({description:!c||"HUI-ERROR-BADGE"===c.tagName}),c&&"HUI-ERROR-BADGE"!==c.tagName?c:l?l.description||this.hass.localize("ui.panel.lovelace.editor.badge_picker.no_description"):r)}},{kind:"get",static:!0,key:"styles",value:function(){return[(0,s.iv)(Z||(Z=P`search-input{display:block;--mdc-shape-small:var(--badge-picker-search-shape);margin:var(--badge-picker-search-margin)}.badges-container-header{font-size:16px;font-weight:500;padding:12px 8px 4px 8px;margin:0;grid-column:1/-1}.badges-container{display:grid;grid-gap:8px 8px;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));margin-top:20px}.badge{height:100%;max-width:500px;display:flex;flex-direction:column;border-radius:var(--ha-card-border-radius,12px);background:var(--primary-background-color,#fafafa);cursor:pointer;position:relative;overflow:hidden;border:var(--ha-card-border-width,1px) solid var(--ha-card-border-color,var(--divider-color))}.badge-header{color:var(--ha-card-header-color,var(--primary-text-color));font-family:var(--ha-card-header-font-family, inherit);font-size:16px;font-weight:700;letter-spacing:-.012em;line-height:20px;padding:12px 16px;display:block;text-align:center;background:var(--ha-card-background,var(--card-background-color,#fff));border-bottom:1px solid var(--divider-color)}.preview{pointer-events:none;margin:20px;flex-grow:1;display:flex;align-items:center;justify-content:center}.description{text-align:center}.spinner{align-items:center;justify-content:center}.overlay{position:absolute;width:100%;height:100%;z-index:1;box-sizing:border-box;border-radius:var(--ha-card-border-radius,12px)}.manual{grid-column:1/-1;max-width:none}.icon{position:absolute;top:8px;right:8px;inset-inline-start:8px;inset-inline-end:8px;border-radius:50%;--mdc-icon-size:16px;line-height:16px;box-sizing:border-box;color:var(--text-primary-color);padding:4px}.icon.custom{background:var(--warning-color)}`))]}}]}}),s.oi);i()}catch(x){i(x)}}))},78254:function(e,i,t){t.a(e,(async function(e,a){try{t.r(i),t.d(i,{HuiCreateDialogBadge:()=>B});var n=t(61701),s=(t(52247),t(19083),t(71695),t(9359),t(70104),t(40251),t(61006),t(47021),t(56820),t(99619),t(57243)),d=t(50778),o=t(67064),r=t(35359),l=t(27486),c=t(36522),h=t(73850),g=t(47194),u=(t(73729),t(95198),t(28008)),p=t(20526),v=t(71971),m=t(2593),b=t(52263),f=t(71152),y=t(1724),_=e([v,b]);[v,b]=_.then?(await _)():_;let k,x,w,$,C,E=e=>e;const z="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";let B=(0,n.Z)([(0,d.Mo)("hui-dialog-create-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.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_containerConfig",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_selectedEntities",value(){return[]}},{kind:"field",decorators:[(0,d.SB)()],key:"_currTabIndex",value(){return 0}},{kind:"method",key:"showDialog",value:async function(e){this._params=e;const i=(0,m.an)(e.lovelaceConfig,e.path);if("strategy"in i)throw new Error("Can't edit strategy");this._containerConfig=i}},{kind:"method",key:"closeDialog",value:function(){return this._params=void 0,this._currTabIndex=0,this._selectedEntities=[],(0,c.B)(this,"dialog-closed",{dialog:this.localName}),!0}},{kind:"method",key:"render",value:function(){if(!this._params)return s.Ld;const e=this._containerConfig.title?this.hass.localize("ui.panel.lovelace.editor.edit_badge.pick_badge_title",{name:this._containerConfig.title}):this.hass.localize("ui.panel.lovelace.editor.edit_badge.pick_badge");return(0,s.dy)(k||(k=E` <ha-dialog open scrimClickAction @keydown="${0}" @closed="${0}" .heading="${0}" class="${0}"> <ha-dialog-header show-border slot="heading"> <ha-icon-button slot="navigationIcon" dialogAction="cancel" .label="${0}" .path="${0}"></ha-icon-button> <span slot="title"> ${0} </span> <mwc-tab-bar .activeIndex="${0}" @MDCTabBar:activated="${0}"> <mwc-tab .label="${0}" dialogInitialFocus></mwc-tab> <mwc-tab .label="${0}"></mwc-tab> </mwc-tab-bar> </ha-dialog-header> ${0} <div slot="primaryAction"> <mwc-button @click="${0}"> ${0} </mwc-button> ${0} </div> </ha-dialog> `),this._ignoreKeydown,this._cancel,e,(0,r.$)({table:1===this._currTabIndex}),this.hass.localize("ui.common.close"),z,e,this._currTabIndex,this._handleTabChanged,this.hass.localize("ui.panel.lovelace.editor.badge_picker.by_badge"),this.hass.localize("ui.panel.lovelace.editor.badge_picker.by_entity"),(0,o.F)(0===this._currTabIndex?(0,s.dy)(x||(x=E` <hui-badge-picker .suggestedBadges="${0}" .lovelace="${0}" .hass="${0}" @config-changed="${0}"></hui-badge-picker> `),this._params.suggestedBadges,this._params.lovelaceConfig,this.hass,this._handleBadgePicked):(0,s.dy)(w||(w=E` <hui-entity-picker-table no-label-float .hass="${0}" .narrow="${0}" .entities="${0}" @selected-changed="${0}"></hui-entity-picker-table> `),this.hass,!0,this._allEntities(this.hass.states),this._handleSelectedChanged)),this._cancel,this.hass.localize("ui.common.cancel"),this._selectedEntities.length?(0,s.dy)($||($=E` <mwc-button @click="${0}"> ${0} </mwc-button> `),this._suggestBadges,this.hass.localize("ui.common.continue")):"")}},{kind:"method",key:"_ignoreKeydown",value:function(e){e.stopPropagation()}},{kind:"get",static:!0,key:"styles",value:function(){return[u.yu,(0,s.iv)(C||(C=E`@media all and (max-width:450px),all and (max-height:500px){ha-dialog{--mdc-dialog-max-height:100%;height:100%}}@media all and (min-width:850px){ha-dialog{--mdc-dialog-min-width:845px}}ha-dialog{--mdc-dialog-max-width:845px;--dialog-content-padding:2px 24px 20px 24px;--dialog-z-index:6}ha-dialog.table{--dialog-content-padding:0}@media (min-width:1200px){ha-dialog{--mdc-dialog-max-width:calc(100vw - 32px);--mdc-dialog-min-width:1000px}}hui-badge-picker{--badge-picker-search-shape:0;--badge-picker-search-margin:-2px -24px 0}hui-entity-picker-table{display:block;height:calc(100vh - 198px);--mdc-shape-small:0}@media all and (max-width:450px),all and (max-height:500px){hui-entity-picker-table{height:calc(100vh - 158px)}}`))]}},{kind:"method",key:"_handleBadgePicked",value:function(e){const i=e.detail.config;this._params.entities&&this._params.entities.length&&(Object.keys(i).includes("entities")?i.entities=this._params.entities:Object.keys(i).includes("entity")&&(i.entity=this._params.entities[0])),(0,f.e)(this,{lovelaceConfig:this._params.lovelaceConfig,saveConfig:this._params.saveConfig,path:this._params.path,badgeConfig:i}),this.closeDialog()}},{kind:"method",key:"_handleTabChanged",value:function(e){e.detail.index!==this._currTabIndex&&(this._currTabIndex=e.detail.index,this._selectedEntities=[])}},{kind:"method",key:"_handleSelectedChanged",value:function(e){this._selectedEntities=e.detail.selectedEntities}},{kind:"method",key:"_cancel",value:function(e){e&&e.stopPropagation(),this.closeDialog()}},{kind:"method",key:"_suggestBadges",value:function(){const e=(0,p.oU)(this.hass.states,this._selectedEntities);(0,y.N)(this,{lovelaceConfig:this._params.lovelaceConfig,saveConfig:this._params.saveConfig,path:this._params.path,entities:this._selectedEntities,badgeConfig:e}),this.closeDialog()}},{kind:"field",key:"_allEntities",value(){return(0,l.Z)((e=>Object.keys(e).map((e=>{const i=this.hass.states[e];return{icon:"",entity_id:e,stateObj:i,name:(0,g.C)(i),domain:(0,h.M)(e),last_changed:i.last_changed}}))))}}]}}),s.oi);a()}catch(k){a(k)}}))},1724:function(e,i,t){t.d(i,{N:()=>s});t(71695),t(40251),t(47021);var a=t(36522);const n=()=>t.e("55966").then(t.bind(t,58064)),s=(e,i)=>{(0,a.B)(e,"show-dialog",{dialogTag:"hui-dialog-suggest-badge",dialogImport:n,dialogParams:i})}},67483:function(e,i,t){t.a(e,(async function(e,a){try{t.d(i,{s:()=>d});t(19423),t(40251);var n=t(27934),s=e([n]);n=(s.then?(await s)():s)[0];const d=async(e,i,t,a)=>{let s={type:i};const d=await(0,n.Sm)(i);if(d&&d.getStubConfig){const i=await d.getStubConfig(e,t,a);s=Object.assign(Object.assign({},s),i)}return s};a()}catch(d){a(d)}}))},24293:function(e,i,t){t.d(i,{M:()=>a});const a=[{type:"entity",showElement:!0}]}}]); //# sourceMappingURL=10216.66585621c8eb3b5b.js.map