iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
38 lines • 184 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[61864],{66639:function(e,t,i){i.d(t,{Vu:function(){return o},Xz:function(){return a},cs:function(){return s}});i(44114),i(18111),i(61701),i(45367),i(92731),i(62953);const s=(e,t)=>{const i=new Map,s=[];for(const a of t)a.floor_id?(i.has(a.floor_id)||i.set(a.floor_id,[]),i.get(a.floor_id).push(a.area_id)):s.push(a.area_id);return{floors:e.map(e=>({id:e.floor_id,areas:i.get(e.floor_id)||[]})),areas:s}},a=e=>{const t=[];for(const i of e.floors)t.push(...i.areas);return t.push(...e.areas),t},o=e=>e.floors.map(e=>e.id)},68348:function(e,t,i){i.d(t,{u:function(){return s}});i(18111),i(13579);const s=e=>{var t,i;if(e.some(e=>"tagName"in e&&("HA-MENU"===e.tagName||"HA-CODE-EDITOR"===e.tagName)))return!1;const s=e[0];if("TEXTAREA"===s.tagName||"HA-SELECT"===(null===(t=s.parentElement)||void 0===t?void 0:t.tagName)||"HA-DROPDOWN"===(null===(i=s.parentElement)||void 0===i?void 0:i.tagName))return!1;if("INPUT"!==s.tagName)return!0;switch(s.type){case"button":case"checkbox":case"hidden":case"radio":case"range":return!0;default:return!1}}},76774:function(e,t,i){i.d(t,{q:function(){return s}});const s=(e,t)=>{const i=e.area_id;return i?t[i]:void 0}},51758:function(e,t,i){i.d(t,{Z:function(){return s}});const s=e=>{const t=window.location.pathname;return e?t+"?"+e:t}},19459:function(e,t,i){i.d(t,{b:function(){return s}});i(45367),i(92731),i(84864),i(57465),i(27495),i(69479),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);const s=(e,t,i)=>{if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;let a,o;if(Array.isArray(e)){if(o=e.length,o!==t.length)return!1;for(a=o;0!==a--;)if(!s(e[a],t[a],i))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(a of e.entries())if(!t.has(a[0]))return!1;for(a of e.entries())if(!s(a[1],t.get(a[0]),i))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(a of e.entries())if(!t.has(a[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(o=e.length,o!==t.length)return!1;for(a=o;0!==a--;)if(e[a]!==t[a])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();const r=Object.keys(e);if(o=r.length,o!==Object.keys(t).length)return!1;for(a=o;0!==a--;)if(!Object.prototype.hasOwnProperty.call(t,r[a]))return!1;for(a=o;0!==a--;){const o=r[a];if(!s(e[o],t[o],i))return!1}if(null!=i&&i.compareSymbols){const a=Object.getOwnPropertySymbols(e),o=Object.getOwnPropertySymbols(t);if(a.length!==o.length)return!1;for(const r of a){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!s(e[r],t[r],i))return!1}}return!0}return e!=e&&t!=t}},60353:function(e,t,i){i.d(t,{u:function(){return s}});class s{start(e){const t=Date.now();this._startY=e,this._startTime=t,this._lastY=e,this._lastTime=t,this._delta=0}move(e){const t=Date.now();return this._delta=this._startY-e,this._lastY=e,this._lastTime=t,this._delta}end(){const e=this.getVelocity(),t=Math.abs(e)>this._velocityThreshold;return{velocity:e,delta:this._delta,isSwipe:t,isDownwardSwipe:e>0}}getDelta(){return this._delta}getVelocity(){if(Date.now()-this._lastTime>=this._movementTimeThreshold)return 0;const e=this._lastTime-this._startTime;return e>0?(this._lastY-this._startY)/e:0}reset(){this._startY=0,this._delta=0,this._startTime=0,this._lastY=0,this._lastTime=0}constructor(e={}){var t,i;this._startY=0,this._delta=0,this._startTime=0,this._lastY=0,this._lastTime=0,this._velocityThreshold=null!==(t=e.velocitySwipeThreshold)&&void 0!==t?t:.5,this._movementTimeThreshold=null!==(i=e.movementTimeThreshold)&&void 0!==i?i:100}}},64481:function(e,t,i){i.d(t,{D:function(){return a},J:function(){return r}});i(16280),i(3362),i(55815),i(64979),i(79739);let s=!1;try{s="true"===window.localStorage.getItem("disableViewTransition")}catch(n){}const a=e=>{s=e},o=e=>{if(!(e=>(e instanceof DOMException||e instanceof Error)&&"AbortError"===e.name)(e))throw e},r=e=>{if(!document.startViewTransition||s)return e(!1),Promise.resolve();let t=!1;try{const i=document.startViewTransition(()=>{t=!0,e(!0)});return i.ready.catch(o),i.finished.catch(o)}catch(i){return console.warn("View transition failed, falling back to direct execution.",i),t?Promise.reject(i):(e(!1),Promise.resolve())}}},5745:function(e,t,i){var s=i(40445),a=i(99731),o=i(67576);class r extends a.Y{}r=(0,s.Cg)([(0,o.EM)("ha-chip-set")],r)},32023:function(e,t,i){i(62953);var s=i(40445),a=i(42034),o=i(20832),r=i(63374),n=i(75640),l=i(91735),c=i(43826),h=i(5124),d=i(67576);let u,p,v=e=>e;class g extends o.${renderLeadingIcon(){return this.noLeadingIcon?(0,h.qy)(u||(u=v``)):super.renderLeadingIcon()}constructor(...e){super(...e),this.noLeadingIcon=!1}}g.styles=[l.R,a.R,c.R,n.R,r.R,(0,h.AH)(p||(p=v`:host{--md-sys-color-primary:var(--primary-text-color);--md-sys-color-on-surface:var(--primary-text-color);--md-sys-color-on-surface-variant:var(--primary-text-color);--md-sys-color-on-secondary-container:var(--primary-text-color);--md-filter-chip-container-shape:var(--ha-border-radius-md);--md-filter-chip-outline-color:var(--outline-color);--md-filter-chip-selected-container-color:rgba(
var(--rgb-primary-text-color),
0.15
);--_label-text-font:var(--ha-font-family-body)}`))],(0,s.Cg)([(0,d.MZ)({type:Boolean,reflect:!0,attribute:"no-leading-icon"})],g.prototype,"noLeadingIcon",void 0),g=(0,s.Cg)([(0,d.EM)("ha-filter-chip")],g)},99611:function(e,t,i){i.a(e,async function(e,t){try{i(18111),i(13579),i(3362),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);var s=i(40445),a=i(1126),o=i(35211),r=i(5124),n=i(67576),l=i(1087),c=i(60353),h=i(22792),d=i(59992),u=i(14503),p=i(22348),v=e([a,d]);[a,d]=v.then?(await v)():v;let g,_,m=e=>e;const f=300,b=new Set(["ha-control-slider","ha-slider","ha-control-switch","ha-control-circular-slider","ha-hs-color-picker","ha-map","ha-more-info-control-select-container","ha-filter-chip"]),y=new Set(["volume-slider-container","forecast"]);class w extends((0,d.V)(r.WF)){get scrollableElement(){return this._bodyElement}connectedCallback(){super.connectedCallback(),this.addEventListener("slider-interaction-start",this._handleSliderInteractionStart,{capture:!0}),this.addEventListener("slider-interaction-stop",this._handleSliderInteractionStop,{capture:!0})}updated(e){super.updated(e),e.has("open")&&(this._drawerOpen=this.open)}render(){return(0,r.qy)(g||(g=m` <wa-drawer id="drawer" placement="bottom" .open="${0}" .lightDismiss="${0}" .ariaLabelledby="${0}" .ariaDescribedby="${0}" @keydown="${0}" @wa-show="${0}" @wa-after-show="${0}" @wa-hide="${0}" @wa-after-hide="${0}" @click="${0}" without-header @touchstart="${0}"> <div class="handle-wrapper" aria-hidden="true"> <div class="handle"></div> </div> <slot name="header"></slot> <div class="content-wrapper"> <div id="body" class="body ha-scrollbar"> <slot></slot> </div> ${0} </div> <slot name="footer"></slot> </wa-drawer> `),this._drawerOpen,!this.preventScrimClose,this.ariaLabelledBy,this.ariaDescribedBy,this._handleKeyDown,this._handleShow,this._handleAfterShow,this._handleHide,this._handleAfterHide,this._handleCloseAction,this._handleTouchStart,this.renderScrollableFades())}_startResizing(e){document.addEventListener("touchmove",this._handleTouchMove,{passive:!1}),document.addEventListener("touchend",this._handleTouchEnd),document.addEventListener("touchcancel",this._handleTouchEnd),this._gestureRecognizer.start(e)}_animateSnapBack(){this.style.setProperty("--dialog-transition",`transform ${f}ms ease-out`),this.style.removeProperty("--dialog-transform"),setTimeout(()=>{this.style.removeProperty("--dialog-transition")},f)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("slider-interaction-start",this._handleSliderInteractionStart,{capture:!0}),this.removeEventListener("slider-interaction-stop",this._handleSliderInteractionStop,{capture:!0}),this._unregisterResizeHandlers(),this._isDragging=!1}static get styles(){return[...super.styles,u.dp,(0,r.AH)(_||(_=m`wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:${0}ms;--hide-duration:${0}ms}wa-drawer::part(dialog){max-height:min(var(--ha-bottom-sheet-max-height,90vh),calc(100vh - max(var(--safe-area-inset-top),48px)));max-height:min(var(--ha-bottom-sheet-max-height,90dvh),calc(100dvh - max(var(--safe-area-inset-top),48px)));align-items:center;transform:var(--dialog-transform);transition:var(--dialog-transition)}@media (prefers-reduced-motion:reduce){wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:1ms;--hide-duration:1ms}wa-drawer::part(dialog){transition:1ms}}wa-drawer::part(dialog)::backdrop{-webkit-backdrop-filter:var(--ha-bottom-sheet-scrim-backdrop-filter,var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none)));backdrop-filter:var(--ha-bottom-sheet-scrim-backdrop-filter,var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none)));background-color:var(--ha-bottom-sheet-scrim-color,var(--mdc-dialog-scrim-color,none))}wa-drawer::part(body){max-width:var(--ha-bottom-sheet-max-width);width:100%;position:relative;border-top-left-radius:var(--ha-bottom-sheet-border-radius,var(--ha-dialog-border-radius,var(--ha-border-radius-2xl)));border-top-right-radius:var(--ha-bottom-sheet-border-radius,var(--ha-dialog-border-radius,var(--ha-border-radius-2xl)));background-color:var(--ha-bottom-sheet-surface-background,var(--ha-dialog-surface-background,var(--card-background-color,var(--ha-color-surface-default))));-webkit-backdrop-filter:var(--ha-bottom-sheet-surface-backdrop-filter,var(--ha-dialog-surface-backdrop-filter,none));backdrop-filter:var(--ha-bottom-sheet-surface-backdrop-filter,var(--ha-dialog-surface-backdrop-filter,none));padding:var(--ha-bottom-sheet-padding,0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left))}:host([flexcontent]) wa-drawer::part(body){display:flex;flex-direction:column}:host([prevent-scrim-close]) .handle-wrapper{display:none}.handle-wrapper{position:absolute;top:0;inset-inline-start:0;width:100%;padding-bottom:2px;display:flex;justify-content:center;align-items:center;pointer-events:none;z-index:1}.handle-wrapper .handle{height:16px;width:200px;display:flex;justify-content:center;align-items:center}.handle-wrapper .handle::after{content:"";border-radius:var(--ha-border-radius-md);height:4px;background:var(--ha-bottom-sheet-handle-color,var(--divider-color));width:40px}.content-wrapper{position:relative;flex:1;display:flex;flex-direction:column;min-height:0}.body{padding:var(--ha-bottom-sheet-content-padding,0);box-sizing:border-box}:host([flexcontent]) .body{flex:1;max-width:100%;display:flex;flex-direction:column;padding:var(--ha-bottom-sheet-content-padding,var(--ha-bottom-sheet-padding,0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left)));box-sizing:border-box}slot[name=footer]{display:block;padding:0}::slotted([slot=footer]){display:flex;padding:var(--ha-space-3) var(--ha-space-4) var(--ha-space-4) var(--ha-space-4);gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%;box-sizing:border-box}:host([flexcontent]) slot[name=footer]{flex-shrink:0}`),f,f)]}constructor(...e){super(...e),this.open=!1,this.flexContent=!1,this.preventScrimClose=!1,this._drawerOpen=!1,this._sliderInteractionActive=!1,this._gestureRecognizer=new c.u,this._isDragging=!1,this._escapePressed=!1,this._handleShow=async()=>{this._drawerOpen=!0,this.open=!0,(0,l.r)(this,"opened"),await this.updateComplete,requestAnimationFrame(()=>{var e;const t=this._autofocusElement;null!==(e=this._hassConfig)&&void 0!==e&&e.auth.external&&(0,p.V)(this._hassConfig.auth.external)?t&&(t.id||(t.id="ha-bottom-sheet-autofocus"),this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:t.id}})):null==t||t.focus()})},this._handleAfterShow=()=>{(0,l.r)(this,"after-show")},this._handleSliderInteractionStart=()=>{this._sliderInteractionActive=!0},this._handleSliderInteractionStop=()=>{this._sliderInteractionActive=!1},this._handleAfterHide=e=>{if(this._sliderInteractionActive)return this._drawerOpen=!0,void(this.open=!0);e.eventPhase===Event.AT_TARGET&&(this.open=!1,this._drawerOpen=!1,(0,l.r)(this,"closed"))},this._handleHide=e=>{if(e.eventPhase!==Event.AT_TARGET)return;const t=e.detail.source===e.target.drawer;if(this._sliderInteractionActive)return e.preventDefault(),this._drawerOpen=!0,this.open=!0,void(this._escapePressed=!1);this.preventScrimClose&&this._escapePressed&&t&&e.preventDefault(),this._escapePressed=!1},this._handleKeyDown=e=>{"Escape"===e.key&&(this._escapePressed=!0,this.preventScrimClose&&e.preventDefault(),e.stopPropagation(),e.currentTarget.open=!1)},this._handleCloseAction=e=>{e.composedPath().some(e=>e instanceof HTMLElement&&("close"===e.getAttribute("data-dialog")||"close"===e.getAttribute("data-drawer")))&&(this._drawerOpen=!1)},this._handleTouchStart=e=>{if(this.preventScrimClose)return;const t=e.composedPath();for(const i of t){if(i===this._drawer)break;if(i instanceof HTMLElement&&(i.scrollTop>0||b.has(i.localName)||Array.from(i.classList).some(e=>y.has(e))))return}e.stopPropagation(),this._startResizing(e.touches[0].clientY)},this._handleTouchMove=e=>{const t=e.touches[0].clientY,i=this._gestureRecognizer.move(t);i<0&&(e.preventDefault(),this._isDragging=!0,requestAnimationFrame(()=>{this._isDragging&&this.style.setProperty("--dialog-transform",`translateY(${-1*i}px)`)}))},this._handleTouchEnd=()=>{var e;this._unregisterResizeHandlers(),this._isDragging=!1;const t=this._gestureRecognizer.end();if(t.isSwipe)return void(t.isDownwardSwipe?this._drawerOpen=!1:this._animateSnapBack());const i=null===(e=this._drawer.shadowRoot)||void 0===e?void 0:e.querySelector('[part="body"]'),s=(null==i?void 0:i.offsetHeight)||0;s>0&&t.delta<0&&Math.abs(t.delta)>.5*s?this._drawerOpen=!1:this._animateSnapBack()},this._unregisterResizeHandlers=()=>{document.removeEventListener("touchmove",this._handleTouchMove),document.removeEventListener("touchend",this._handleTouchEnd),document.removeEventListener("touchcancel",this._handleTouchEnd)}}}(0,s.Cg)([(0,n.MZ)({attribute:"aria-labelledby"})],w.prototype,"ariaLabelledBy",void 0),(0,s.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],w.prototype,"ariaDescribedBy",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean})],w.prototype,"open",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],w.prototype,"flexContent",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],w.prototype,"preventScrimClose",void 0),(0,s.Cg)([(0,n.wk)()],w.prototype,"_drawerOpen",void 0),(0,s.Cg)([(0,n.wk)()],w.prototype,"_sliderInteractionActive",void 0),(0,s.Cg)([(0,n.wk)(),(0,o.Fg)({context:h.WF,subscribe:!0})],w.prototype,"_hassConfig",void 0),(0,s.Cg)([(0,n.P)("#drawer")],w.prototype,"_drawer",void 0),(0,s.Cg)([(0,n.P)("#body")],w.prototype,"_bodyElement",void 0),(0,s.Cg)([(0,n.P)("[autofocus]")],w.prototype,"_autofocusElement",void 0),w=(0,s.Cg)([(0,n.EM)("ha-bottom-sheet")],w),t()}catch(g){t(g)}})},89865:function(e,t,i){i.a(e,async function(e,t){try{i(18111),i(61701),i(62953);var s=i(40445),a=(i(22395),i(5124)),o=i(67576),r=i(1087),n=i(18350),l=(i(67094),e([n]));n=(l.then?(await l)():l)[0];let c,h,d,u,p=e=>e;class v extends a.WF{render(){return(0,a.qy)(c||(c=p` <wa-button-group childSelector="ha-button"> ${0} </wa-button-group> `),this.buttons.map(e=>(0,a.qy)(h||(h=p`<ha-button iconTag="ha-svg-icon" class="icon" .variant="${0}" .size="${0}" .value="${0}" @click="${0}" .title="${0}" .appearance="${0}"> ${0} </ha-button>`),this.active===e.value&&this.activeVariant?this.activeVariant:this.variant,this.size,e.value,this._handleClick,e.label,this.active===e.value?"accent":"filled",e.iconPath?(0,a.qy)(d||(d=p`<ha-svg-icon aria-label="${0}" .path="${0}"></ha-svg-icon>`),e.label,e.iconPath):e.label)))}_handleClick(e){this.active=e.currentTarget.value,(0,r.r)(this,"value-changed",{value:this.active})}constructor(...e){super(...e),this.size="medium",this.nowrap=!1,this.fullWidth=!1,this.variant="brand"}}v.styles=(0,a.AH)(u||(u=p`:host{--mdc-icon-size:var(--button-toggle-icon-size, 20px)}:host([no-wrap]) wa-button-group::part(base){flex-wrap:nowrap}wa-button-group{padding:var(--ha-button-toggle-group-padding)}:host([full-width]) wa-button-group,:host([full-width]) wa-button-group::part(base){width:100%}:host([full-width]) ha-button{flex:1}`)),(0,s.Cg)([(0,o.MZ)({attribute:!1})],v.prototype,"buttons",void 0),(0,s.Cg)([(0,o.MZ)()],v.prototype,"active",void 0),(0,s.Cg)([(0,o.MZ)({reflect:!0})],v.prototype,"size",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean,reflect:!0,attribute:"no-wrap"})],v.prototype,"nowrap",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean,reflect:!0,attribute:"full-width"})],v.prototype,"fullWidth",void 0),(0,s.Cg)([(0,o.MZ)()],v.prototype,"variant",void 0),(0,s.Cg)([(0,o.MZ)({attribute:"active-variant"})],v.prototype,"activeVariant",void 0),v=(0,s.Cg)([(0,o.EM)("ha-button-toggle-group")],v),t()}catch(c){t(c)}})},75064:function(e,t,i){i(62953);var s=i(40445),a=i(5124),o=i(67576),r=i(2846);let n;class l extends r.G{constructor(...e){super(...e),this.borderTop=!1}}l.styles=[...r.J,(0,a.AH)(n||(n=(e=>e)`:host{--md-list-item-one-line-container-height:48px;--md-list-item-two-line-container-height:64px}:host([border-top]) md-item{border-top:1px solid var(--divider-color)}[slot=start]{--state-icon-color:var(--secondary-text-color)}[slot=overline]{line-height:1.15rem;font-size:calc(var(--mdc-typography-subtitle1-font-size, 1rem) * .75);font-weight:var(--mdc-typography-subtitle1-font-weight,400);font-family:var(
--mdc-typography-subtitle1-font-family,
var(--mdc-typography-font-family)
);color:var(--mdc-select-label-ink-color,rgba(0,0,0,.6))}[slot=headline]{line-height:var(--ha-line-height-normal);font-size:var(--ha-font-size-m);white-space:nowrap}[slot=supporting-text]{line-height:var(--ha-line-height-normal);font-size:var(--ha-font-size-s);white-space:nowrap}::slotted(img),::slotted(state-badge){width:32px;height:32px}::slotted(.code){font-family:var(--ha-font-family-code);font-size:var(--ha-font-size-xs)}::slotted(.domain){font-size:var(--ha-font-size-s);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal);align-self:flex-end;max-width:30%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}`))],(0,s.Cg)([(0,o.MZ)({type:Boolean,reflect:!0,attribute:"border-top"})],l.prototype,"borderTop",void 0),l=(0,s.Cg)([(0,o.EM)("ha-combo-box-item")],l)},76623:function(e,t,i){i.a(e,async function(e,s){try{i.d(t,{D:function(){return _}});var a=i(40445),o=i(5124),r=i(67576),n=i(91450),l=i(71727),c=i(85694),h=(i(47680),i(67094),e([c]));c=(h.then?(await h)():h)[0];let d,u,p,v,g=e=>e;const _={device:"M3 6H21V4H3C1.9 4 1 4.9 1 6V18C1 19.1 1.9 20 3 20H7V18H3V6M13 12H9V13.78C8.39 14.33 8 15.11 8 16C8 16.89 8.39 17.67 9 18.22V20H13V18.22C13.61 17.67 14 16.88 14 16S13.61 14.33 13 13.78V12M11 17.5C10.17 17.5 9.5 16.83 9.5 16S10.17 14.5 11 14.5 12.5 15.17 12.5 16 11.83 17.5 11 17.5M22 8H16C15.5 8 15 8.5 15 9V19C15 19.5 15.5 20 16 20H22C22.5 20 23 19.5 23 19V9C23 8.5 22.5 8 22 8M21 18H17V10H21V18Z",and:"M4.4,16.5C4.4,15.6 4.7,14.7 5.2,13.9C5.7,13.1 6.7,12.2 8.2,11.2C7.3,10.1 6.8,9.3 6.5,8.7C6.1,8 6,7.4 6,6.7C6,5.2 6.4,4.1 7.3,3.2C8.2,2.3 9.4,2 10.9,2C12.2,2 13.3,2.4 14.2,3.2C15.1,4 15.5,5 15.5,6.1C15.5,6.9 15.3,7.6 14.9,8.3C14.5,9 13.8,9.7 12.8,10.4L11.4,11.5L15.7,16.7C16.3,15.5 16.6,14.3 16.6,12.8H18.8C18.8,15.1 18.3,17 17.2,18.5L20,21.8H17L15.7,20.3C15,20.9 14.3,21.3 13.4,21.6C12.5,21.9 11.6,22.1 10.7,22.1C8.8,22.1 7.3,21.6 6.1,20.6C5,19.5 4.4,18.2 4.4,16.5M10.7,20C12,20 13.2,19.5 14.3,18.5L9.6,12.8L9.2,13.1C7.7,14.2 7,15.3 7,16.5C7,17.6 7.3,18.4 8,19C8.7,19.6 9.5,20 10.7,20M8.5,6.7C8.5,7.6 9,8.6 10.1,9.9L11.7,8.8C12.3,8.4 12.7,8 12.9,7.6C13.1,7.2 13.2,6.7 13.2,6.2C13.2,5.6 13,5.1 12.5,4.7C12.1,4.3 11.5,4.1 10.8,4.1C10.1,4.1 9.5,4.3 9.1,4.8C8.7,5.3 8.5,5.9 8.5,6.7Z",or:"M2,4C5,10 5,14 2,20H8C13,20 19,16 22,12C19,8 13,4 8,4H2M5,6H8C11.5,6 16.3,9 19.3,12C16.3,15 11.5,18 8,18H5C6.4,13.9 6.4,10.1 5,6Z",not:"M14.08,4.61L15.92,5.4L14.8,8H19V10H13.95L12.23,14H19V16H11.38L9.92,19.4L8.08,18.61L9.2,16H5V14H10.06L11.77,10H5V8H12.63L14.08,4.61Z",state:"M6.27 17.05C6.72 17.58 7 18.25 7 19C7 20.66 5.66 22 4 22S1 20.66 1 19 2.34 16 4 16C4.18 16 4.36 16 4.53 16.05L7.6 10.69L5.86 9.7L9.95 8.58L11.07 12.67L9.33 11.68L6.27 17.05M20 16C18.7 16 17.6 16.84 17.18 18H11V16L8 19L11 22V20H17.18C17.6 21.16 18.7 22 20 22C21.66 22 23 20.66 23 19S21.66 16 20 16M12 8C12.18 8 12.36 8 12.53 7.95L15.6 13.31L13.86 14.3L17.95 15.42L19.07 11.33L17.33 12.32L14.27 6.95C14.72 6.42 15 5.75 15 5C15 3.34 13.66 2 12 2S9 3.34 9 5 10.34 8 12 8Z",numeric_state:"M4,17V9H2V7H6V17H4M22,15C22,16.11 21.1,17 20,17H16V15H20V13H18V11H20V9H16V7H20A2,2 0 0,1 22,9V10.5A1.5,1.5 0 0,1 20.5,12A1.5,1.5 0 0,1 22,13.5V15M14,15V17H8V13C8,11.89 8.9,11 10,11H12V9H8V7H12A2,2 0 0,1 14,9V11C14,12.11 13.1,13 12,13H10V15H14Z",sun:"M12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7M12,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,2L14.39,5.42C13.65,5.15 12.84,5 12,5C11.16,5 10.35,5.15 9.61,5.42L12,2M3.34,7L7.5,6.65C6.9,7.16 6.36,7.78 5.94,8.5C5.5,9.24 5.25,10 5.11,10.79L3.34,7M3.36,17L5.12,13.23C5.26,14 5.53,14.78 5.95,15.5C6.37,16.24 6.91,16.86 7.5,17.37L3.36,17M20.65,7L18.88,10.79C18.74,10 18.47,9.23 18.05,8.5C17.63,7.78 17.1,7.15 16.5,6.64L20.65,7M20.64,17L16.5,17.36C17.09,16.85 17.62,16.22 18.04,15.5C18.46,14.77 18.73,14 18.87,13.21L20.64,17M12,22L9.59,18.56C10.33,18.83 11.14,19 12,19C12.82,19 13.63,18.83 14.37,18.56L12,22Z",template:"M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",time:"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z",trigger:"M10 7V9H9V15H10V17H6V15H7V9H6V7H10M16 7C17.11 7 18 7.9 18 9V15C18 16.11 17.11 17 16 17H12V7M16 9H14V15H16V9Z",zone:"M12,2C15.31,2 18,4.66 18,7.95C18,12.41 12,19 12,19C12,19 6,12.41 6,7.95C6,4.66 8.69,2 12,2M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M20,19C20,21.21 16.42,23 12,23C7.58,23 4,21.21 4,19C4,17.71 5.22,16.56 7.11,15.83L7.75,16.74C6.67,17.19 6,17.81 6,18.5C6,19.88 8.69,21 12,21C15.31,21 18,19.88 18,18.5C18,17.81 17.33,17.19 16.25,16.74L16.89,15.83C18.78,16.56 20,17.71 20,19Z"};class m extends o.WF{render(){if(this.icon)return(0,o.qy)(d||(d=g`<ha-icon .icon="${0}"></ha-icon>`),this.icon);if(!this.condition)return o.s6;if(!this.hass)return this._renderFallback();const e=(0,c.r)(this.hass.connection,this.hass.config,this.condition).then(e=>e?(0,o.qy)(u||(u=g`<ha-icon .icon="${0}"></ha-icon>`),e):this._renderFallback());return(0,o.qy)(p||(p=g`${0}`),(0,n.T)(e))}_renderFallback(){const e=(0,l.m)(this.condition);return(0,o.qy)(v||(v=g` <ha-svg-icon .path="${0}"></ha-svg-icon> `),_[this.condition]||c.l[e])}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)()],m.prototype,"condition",void 0),(0,a.Cg)([(0,r.MZ)()],m.prototype,"icon",void 0),m=(0,a.Cg)([(0,r.EM)("ha-condition-icon")],m),s()}catch(d){s(d)}})},76538:function(e,t,i){i(62953);var s=i(40445),a=i(5124),o=i(67576);let r,n,l,c,h,d,u=e=>e;class p extends a.WF{render(){const e=(0,a.qy)(r||(r=u`<div class="header-title"> <slot name="title"></slot> </div>`)),t=(0,a.qy)(n||(n=u`<div class="header-subtitle"> <slot name="subtitle"></slot> </div>`));return(0,a.qy)(l||(l=u` <header class="header"> <div class="header-bar"> <section class="header-navigation-icon"> <slot name="navigationIcon"></slot> </section> <section class="header-content"> ${0} </section> <section class="header-action-items"> <slot name="actionItems"></slot> </section> </div> <slot></slot> </header> `),"above"===this.subtitlePosition?(0,a.qy)(c||(c=u`${0}${0}`),t,e):(0,a.qy)(h||(h=u`${0}${0}`),e,t))}static get styles(){return[(0,a.AH)(d||(d=u`: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:center;padding:0 var(--ha-space-1);box-sizing:border-box}.header-content{flex:1;padding:10px var(--ha-space-1);display:flex;flex-direction:column;justify-content:center;min-height:var(--ha-space-12);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.header-title{height:var(--ha-dialog-header-title-height,calc(var(--ha-font-size-xl) + var(--ha-space-1)));font-size:var(--ha-font-size-xl);line-height:var(--ha-line-height-condensed);font-weight:var(--ha-font-weight-medium);color:var(--ha-dialog-header-title-color,var(--primary-text-color))}.header-subtitle{font-size:var(--ha-font-size-m);line-height:var(--ha-line-height-normal);color:var(--ha-dialog-header-subtitle-color,var(--secondary-text-color))}@media all and (min-width:450px) and (min-height:500px){.header-bar{padding:0 var(--ha-space-2)}}.header-navigation-icon{flex:none;min-width:var(--ha-space-2);height:100%;display:flex;flex-direction:row}.header-action-items{flex:none;min-width:var(--ha-space-2);height:100%;display:flex;flex-direction:row}`))]}constructor(...e){super(...e),this.subtitlePosition="below",this.showBorder=!1}}(0,s.Cg)([(0,o.MZ)({type:String,attribute:"subtitle-position"})],p.prototype,"subtitlePosition",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean,reflect:!0,attribute:"show-border"})],p.prototype,"showBorder",void 0),p=(0,s.Cg)([(0,o.EM)("ha-dialog-header")],p)},72554:function(e,t,i){i.a(e,async function(e,t){try{i(3362),i(62953),i(49255);var s=i(40445),a=i(93900),o=i(35211),r=i(5124),n=i(67576),l=i(63672),c=i(1087),h=i(64481),d=i(22792),u=i(59992),p=i(14503),v=i(22348),g=(i(76538),i(26300)),_=e([a,g,u]);[a,g,u]=_.then?(await _)():_;let m,f,b,y,w,C,$,x=e=>e;const A="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";class H extends((0,u.V)(r.WF)){connectedCallback(){super.connectedCallback(),this.addEventListener("dialog-set-fullscreen",this._handleFullscreenChanged)}get scrollableElement(){return this.bodyContainer}updated(e){super.updated(e),e.has("open")&&(this._open=this.open)}render(){var e,t,i;return(0,r.qy)(m||(m=x` <wa-dialog .open="${0}" .lightDismiss="${0}" without-header aria-labelledby="${0}" aria-describedby="${0}" @keydown="${0}" @wa-hide="${0}" @wa-show="${0}" @wa-after-show="${0}" @wa-after-hide="${0}"> ${0} <div class="content-wrapper"> <div class="body ha-scrollbar" @scroll="${0}"> <slot></slot> </div> ${0} </div> <slot name="footer" slot="footer"></slot> </wa-dialog> `),this._open,!this.preventScrimClose,(0,l.J)(this.ariaLabelledBy||(void 0!==this.headerTitle?"ha-dialog-title":void 0)),(0,l.J)(this.ariaDescribedBy),this._handleKeyDown,this._handleHide,this._handleShow,this._handleAfterShow,this._handleAfterHide,this.withoutHeader?r.s6:(0,r.qy)(f||(f=x`<slot name="header"> <ha-dialog-header .subtitlePosition="${0}" .showBorder="${0}"> <slot name="headerNavigationIcon" slot="navigationIcon"> <ha-icon-button data-dialog="close" .label="${0}" .path="${0}"></ha-icon-button> </slot> ${0} ${0} <slot name="headerActionItems" slot="actionItems"></slot> </ha-dialog-header> </slot>`),this.headerSubtitlePosition,this._bodyScrolled,null!==(e=null===(t=this._i18n)||void 0===t||null===(i=t.localize)||void 0===i?void 0:i.call(t,"ui.common.close"))&&void 0!==e?e:"Close",A,void 0!==this.headerTitle?(0,r.qy)(b||(b=x`<span slot="title" class="title" id="ha-dialog-title"> ${0} </span>`),this.headerTitle):(0,r.qy)(y||(y=x`<slot name="headerTitle" slot="title"></slot>`)),void 0!==this.headerSubtitle?(0,r.qy)(w||(w=x`<span slot="subtitle">${0}</span>`),this.headerSubtitle):(0,r.qy)(C||(C=x`<slot name="headerSubtitle" slot="subtitle"></slot>`))),this._handleBodyScroll,this.renderScrollableFades())}disconnectedCallback(){this.removeEventListener("dialog-set-fullscreen",this._handleFullscreenChanged),this._setFullscreen(!1),super.disconnectedCallback(),this._open=!1}_handleFullscreenChanged(e){this._open?(0,h.J)(()=>{this._setFullscreen(e.detail)}):this._setFullscreen(e.detail)}_setFullscreen(e){this.toggleAttribute("fullscreen",e)}_handleBodyScroll(e){this._bodyScrolled=e.target.scrollTop>0}_handleKeyDown(e){"Escape"===e.key&&(this._escapePressed=!0,this.preventScrimClose&&e.preventDefault(),e.stopPropagation(),e.currentTarget.open=!1)}_handleHide(e){var t;const i=(null===(t=e.detail)||void 0===t?void 0:t.source)===e.target.dialog;this.preventScrimClose&&this._escapePressed&&i&&e.preventDefault(),this._escapePressed=!1}static get styles(){return[...super.styles,p.dp,(0,r.AH)($||($=x`wa-dialog{--full-width:var(
--ha-dialog-width-full,
min(95vw, var(--safe-width))
);--width:min(var(--ha-dialog-width-md, 580px), var(--full-width));--spacing:var(--dialog-content-padding, var(--ha-space-6));--show-duration:var(--ha-dialog-show-duration, 200ms);--hide-duration:var(--ha-dialog-hide-duration, 200ms);--wa-color-surface-raised:var(
--ha-dialog-surface-background,
var(--card-background-color, var(--ha-color-surface-default))
);--wa-panel-border-radius:var(
--ha-dialog-border-radius,
var(--ha-border-radius-3xl)
);max-width:var(--ha-dialog-max-width,var(--safe-width))}@media (prefers-reduced-motion:reduce){wa-dialog{--show-duration:0ms;--hide-duration:0ms}}:host([width=small]) wa-dialog{--width:min(var(--ha-dialog-width-sm, 320px), var(--full-width))}:host([width=large]) wa-dialog{--width:min(var(--ha-dialog-width-lg, 1024px), var(--full-width))}:host([fullscreen]) wa-dialog,:host([width=full]) wa-dialog{--width:var(--full-width)}:host([fullscreen]) wa-dialog::part(dialog){min-height:var(--safe-height);max-height:var(--safe-height);margin-top:0;transform:none}:host([fullscreen]) .content-wrapper{overflow:hidden}:host([fullscreen]) .body{overflow:hidden;padding:0}wa-dialog::part(dialog){-webkit-backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);box-shadow:var(--dialog-box-shadow,var(--wa-shadow-l));color:var(--primary-text-color);min-width:var(--width,var(--full-width));max-width:var(--width,var(--full-width));max-height:var(--ha-dialog-max-height,calc(var(--safe-height) - var(--ha-space-20)));min-height:var(--ha-dialog-min-height);margin-top:var(--dialog-surface-margin-top,auto);transform:translate(calc(var(--safe-area-offset-left,0px) - var(--safe-area-offset-right,0px)),calc(var(--safe-area-offset-top,0px) - var(--safe-area-offset-bottom,0px)));display:flex;flex-direction:column;overflow:hidden}wa-dialog::part(dialog)::backdrop{-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));background-color:var(--mdc-dialog-scrim-color,none)}@media all and (max-width:450px),all and (max-height:500px){:host([type=standard]){--ha-dialog-border-radius:0}:host([type=standard]) wa-dialog{--full-width:var(--ha-dialog-width-full, 100vw);--width:var(--full-width)}:host([type=standard]) wa-dialog::part(dialog){min-height:var(--ha-dialog-min-height,100vh);min-height:var(--ha-dialog-min-height,100dvh);max-height:var(--ha-dialog-max-height,100vh);max-height:var(--ha-dialog-max-height,100dvh);margin-top:0;margin-bottom:0;padding-top:var(--safe-area-inset-top);padding-bottom:var(--safe-area-inset-bottom);padding-left:var(--safe-area-inset-left);padding-right:var(--safe-area-inset-right);transform:none}}.header-title-container{display:flex;align-items:center}.header-title{margin:0;margin-bottom:0;color:var(--ha-dialog-header-title-color,var(--primary-text-color));font-size:var(
--ha-dialog-header-title-font-size,
var(--ha-font-size-2xl)
);line-height:var(
--ha-dialog-header-title-line-height,
var(--ha-line-height-condensed)
);font-weight:var(--ha-dialog-header-title-font-weight,var(--ha-font-weight-normal));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-right:var(--ha-space-3)}wa-dialog::part(body){padding:0;display:flex;flex-direction:column;max-width:100%;overflow:hidden}.content-wrapper{position:relative;flex:1;display:flex;flex-direction:column;min-height:0}.body{position:var(--dialog-content-position,relative);padding:var(--dialog-content-padding,0 var(--ha-space-6) var(--ha-space-6) var(--ha-space-6));overflow:auto;flex-grow:1}:host([flexcontent]) .body{max-width:100%;flex:1;display:flex;flex-direction:column}wa-dialog::part(footer){padding:0}::slotted([slot=footer]){display:flex;padding:var(--ha-space-3) var(--ha-space-4) var(--ha-space-4) var(--ha-space-4);gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%}`))]}constructor(...e){super(...e),this.open=!1,this.type="standard",this.width="medium",this.preventScrimClose=!1,this.headerSubtitlePosition="below",this.flexContent=!1,this.withoutHeader=!1,this._open=!1,this._bodyScrolled=!1,this._escapePressed=!1,this._handleShow=async e=>{e.eventPhase===Event.AT_TARGET&&(this._open=!0,(0,c.r)(this,"opened"),await this.updateComplete,requestAnimationFrame(()=>{var e,t;if(null!==(e=this._hassConfig)&&void 0!==e&&e.auth.external&&(0,v.V)(this._hassConfig.auth.external)){const e=this.querySelector("[autofocus]");return void(null!==e&&(e.id||(e.id="ha-dialog-autofocus"),this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:e.id}})))}null===(t=this.querySelector("[autofocus]"))||void 0===t||t.focus()}))},this._handleAfterShow=e=>{e.eventPhase===Event.AT_TARGET&&(0,c.r)(this,"after-show")},this._handleAfterHide=e=>{e.eventPhase===Event.AT_TARGET&&(this._open=!1,this._setFullscreen(!1),(0,c.r)(this,"closed"))}}}(0,s.Cg)([(0,n.MZ)({attribute:"aria-labelledby"})],H.prototype,"ariaLabelledBy",void 0),(0,s.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],H.prototype,"ariaDescribedBy",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],H.prototype,"open",void 0),(0,s.Cg)([(0,n.MZ)({reflect:!0})],H.prototype,"type",void 0),(0,s.Cg)([(0,n.MZ)({type:String,reflect:!0,attribute:"width"})],H.prototype,"width",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],H.prototype,"preventScrimClose",void 0),(0,s.Cg)([(0,n.MZ)({attribute:"header-title"})],H.prototype,"headerTitle",void 0),(0,s.Cg)([(0,n.MZ)({attribute:"header-subtitle"})],H.prototype,"headerSubtitle",void 0),(0,s.Cg)([(0,n.MZ)({type:String,attribute:"header-subtitle-position"})],H.prototype,"headerSubtitlePosition",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],H.prototype,"flexContent",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,attribute:"without-header"})],H.prototype,"withoutHeader",void 0),(0,s.Cg)([(0,n.wk)()],H.prototype,"_open",void 0),(0,s.Cg)([(0,n.P)(".body")],H.prototype,"bodyContainer",void 0),(0,s.Cg)([(0,n.wk)(),(0,o.Fg)({context:d.D5,subscribe:!0})],H.prototype,"_i18n",void 0),(0,s.Cg)([(0,n.wk)(),(0,o.Fg)({context:d.WF,subscribe:!0})],H.prototype,"_hassConfig",void 0),(0,s.Cg)([(0,n.wk)()],H.prototype,"_bodyScrolled",void 0),(0,s.Cg)([(0,n.Ls)({passive:!0})],H.prototype,"_handleBodyScroll",null),H=(0,s.Cg)([(0,n.EM)("ha-dialog")],H),t()}catch(m){t(m)}})},59174:function(e,t,i){i.a(e,async function(e,t){try{var s=i(40445),a=i(35211),o=i(5124),r=i(67576),n=i(91450),l=i(22792),c=i(85694),h=i(44144),d=(i(47680),e([c]));c=(d.then?(await d)():d)[0];let u,p,v,g,_,m,f,b=e=>e;class y extends o.WF{render(){if(this.icon)return(0,o.qy)(u||(u=b`<ha-icon .icon="${0}"></ha-icon>`),this.icon);if(!this.domain)return o.s6;if(!this._connection||!this._hassConfig)return this._renderFallback();const e=(0,c._4)(this._connection.connection,this._hassConfig.config,this.domain,this.deviceClass,this.state).then(e=>e?(0,o.qy)(p||(p=b`<ha-icon .icon="${0}"></ha-icon>`),e):this._renderFallback());return(0,o.qy)(v||(v=b`${0}`),(0,n.T)(e))}_renderFallback(){if(this.domain&&this.domain in c.l)return(0,o.qy)(g||(g=b` <ha-svg-icon .path="${0}"></ha-svg-icon> `),c.l[this.domain]);if(this.brandFallback){var e,t;const i=(0,h.MR)({domain:this.domain,type:"icon",darkOptimized:null===(e=this._hassUi)||void 0===e?void 0:e.themes.darkMode},null===(t=this._hassConfig)||void 0===t?void 0:t.auth.data.hassUrl);return(0,o.qy)(_||(_=b` <img alt="" src="${0}" crossorigin="anonymous" referrerpolicy="no-referrer"> `),i)}return(0,o.qy)(m||(m=b`<ha-svg-icon .path="${0}"></ha-svg-icon>`),c.lW)}}y.styles=(0,o.AH)(f||(f=b`img{width:var(--mdc-icon-size,24px)}`)),(0,s.Cg)([(0,r.MZ)()],y.prototype,"domain",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],y.prototype,"deviceClass",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],y.prototype,"state",void 0),(0,s.Cg)([(0,r.MZ)()],y.prototype,"icon",void 0),(0,s.Cg)([(0,r.MZ)({attribute:"brand-fallback",type:Boolean})],y.prototype,"brandFallback",void 0),(0,s.Cg)([(0,r.wk)(),(0,a.Fg)({context:l.WF,subscribe:!0})],y.prototype,"_hassConfig",void 0),(0,s.Cg)([(0,r.wk)(),(0,a.Fg)({context:l.Wq,subscribe:!0})],y.prototype,"_connection",void 0),(0,s.Cg)([(0,r.wk)(),(0,a.Fg)({context:l.EK,subscribe:!0})],y.prototype,"_hassUi",void 0),y=(0,s.Cg)([(0,r.EM)("ha-domain-icon")],y),t()}catch(u){t(u)}})},18198:function(e,t,i){i.d(t,{Dc:function(){return h},Si:function(){return c}});var s=i(40445),a=i(5124),o=i(67576);i(47680),i(67094);let r,n,l=e=>e;const c=e=>{switch(e.level){case 0:return"M11,10H13V16H11V10M22,12H19V20H5V12H2L12,3L22,12M15,10A2,2 0 0,0 13,8H11A2,2 0 0,0 9,10V16A2,2 0 0,0 11,18H13A2,2 0 0,0 15,16V10Z";case 1:return"M12,3L2,12H5V20H19V12H22L12,3M10,8H14V18H12V10H10V8Z";case 2:return"M12,3L2,12H5V20H19V12H22L12,3M9,8H13A2,2 0 0,1 15,10V12A2,2 0 0,1 13,14H11V16H15V18H9V14A2,2 0 0,1 11,12H13V10H9V8Z";case 3:return"M12,3L22,12H19V20H5V12H2L12,3M15,11.5V10C15,8.89 14.1,8 13,8H9V10H13V12H11V14H13V16H9V18H13A2,2 0 0,0 15,16V14.5A1.5,1.5 0 0,0 13.5,13A1.5,1.5 0 0,0 15,11.5Z";case-1:return"M12,3L2,12H5V20H19V12H22L12,3M11,15H7V13H11V15M15,18H13V10H11V8H15V18Z"}return"M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z"},h=e=>{switch(e.level){case 0:return"mdi:home-floor-0";case 1:return"mdi:home-floor-1";case 2:return"mdi:home-floor-2";case 3:return"mdi:home-floor-3";case-1:return"mdi:home-floor-negative-1"}return"mdi:home"};class d extends a.WF{render(){if(!this.floor)return a.s6;if(this.floor.icon)return(0,a.qy)(r||(r=l`<ha-icon .icon="${0}"></ha-icon>`),this.floor.icon);const e=c(this.floor);return(0,a.qy)(n||(n=l`<ha-svg-icon .path="${0}"></ha-svg-icon>`),e)}}(0,s.Cg)([(0,o.MZ)({attribute:!1})],d.prototype,"floor",void 0),(0,s.Cg)([(0,o.MZ)()],d.prototype,"icon",void 0),d=(0,s.Cg)([(0,o.EM)("ha-floor-icon")],d)},45100:function(e,t,i){i.a(e,async function(e,s){try{i.r(t),i.d(t,{HaIconButtonPrev:function(){return v}});i(62953);var a=i(40445),o=i(5124),r=i(67576),n=i(63091),l=i(26300),c=e([l]);l=(c.then?(await c)():c)[0];let h,d=e=>e;const u="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",p="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z";class v extends o.WF{render(){var e;return(0,o.qy)(h||(h=d` <ha-icon-button .disabled="${0}" .label="${0}" .path="${0}" .href="${0}" .target="${0}" .rel="${0}" .download="${0}"></ha-icon-button> `),this.disabled,this.label||(null===(e=this.hass)||void 0===e?void 0:e.localize("ui.common.back"))||"Back",this._icon,this.href,this.target,this.rel,this.download)}constructor(...e){super(...e),this.disabled=!1,this._icon="rtl"===n.G.document.dir?p:u}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],v.prototype,"disabled",void 0),(0,a.Cg)([(0,r.MZ)()],v.prototype,"label",void 0),(0,a.Cg)([(0,r.MZ)()],v.prototype,"href",void 0),(0,a.Cg)([(0,r.MZ)()],v.prototype,"target",void 0),(0,a.Cg)([(0,r.MZ)()],v.prototype,"rel",void 0),(0,a.Cg)([(0,r.MZ)()],v.prototype,"download",void 0),(0,a.Cg)([(0,r.wk)()],v.prototype,"_icon",void 0),v=(0,a.Cg)([(0,r.EM)("ha-icon-button-prev")],v),s()}catch(h){s(h)}})},43661:function(e,t,i){i.r(t),i.d(t,{HaIconNext:function(){return n}});i(62953);var s=i(40445),a=i(67576),o=i(63091),r=i(67094);class n extends r.HaSvgIcon{constructor(...e){super(...e),this.path="rtl"===o.G.document.dir?"M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z":"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"}}(0,s.Cg)([(0,a.MZ)()],n.prototype,"path",void 0),n=(0,s.Cg)([(0,a.EM)("ha-icon-next")],n)},2846:function(e,t,i){i.d(t,{G:function(){return u},J:function(){return d}});var s=i(40445),a=i(58168),o=i(82553),r=i(5124),n=i(67576);i(54276);let l,c,h=e=>e;const d=[o.R,(0,r.AH)(l||(l=h`:host{--ha-icon-display:block;--md-sys-color-primary:var(--primary-text-color);--md-sys-color-secondary:var(--secondary-text-color);--md-sys-color-surface:var(--card-background-color);--md-sys-color-on-surface:var(--primary-text-color);--md-sys-color-on-surface-variant:var(--secondary-text-color)}md-item{overflow:var(--md-item-overflow,hidden);align-items:var(--md-item-align-items,center);gap:var(--ha-md-list-item-gap,16px)}`))];class u extends a.n{renderRipple(){return"text"===this.type?r.s6:(0,r.qy)(c||(c=h`<ha-ripple part="ripple" for="item" ?disabled="${0}"></ha-ripple>`),this.disabled&&"link"!==this.type)}}u.styles=d,u=(0,s.Cg)([(0,n.EM)("ha-md-list-item")],u)},69464:function(e,t,i){var s=i(40445),a=i(5124),o=i(67576);let r,n,l=e=>e;class c extends a.WF{render(){return(0,a.qy)(r||(r=l`<slot></slot>`))}}c.styles=(0,a.AH)(n||(n=l`:host{background-color:var(--ha-color-fill-neutral-quiet-resting);padding:var(--ha-space-2) var(--ha-space-3);font-weight:var(--ha-font-weight-bold);color:var(--secondary-text-color);min-height:var(--ha-space-6);display:flex;align-items:center;box-sizing:border-box}`)),c=(0,s.Cg)([(0,o.EM)("ha-section-title")],c)},65329:function(e,t,i){i.a(e,async function(e,t){try{var s=i(40445),a=i(5124),o=i(67576),r=i(91450),n=i(71727),l=i(85694),c=(i(47680),i(67094),e([l]));l=(c.then?(await c)():c)[0];let h,d,u,p,v=e=>e;class g extends a.WF{render(){if(this.icon)return(0,a.qy)(h||(h=v`<ha-icon .icon="${0}"></ha-icon>`),this.icon);if(!this.service)return a.s6;if(!this.hass)return this._renderFallback();const e=(0,l.f$)(this.hass.connection,this.hass.config,this.service).then(e=>e?(0,a.qy)(d||(d=v`<ha-icon .icon="${0}"></ha-icon>`),e):this._renderFallback());return(0,a.qy)(u||(u=v`${0}`),(0,r.T)(e))}_renderFallback(){const e=(0,n.m)(this.service);return(0,a.qy)(p||(p=v` <ha-svg-icon .path="${0}"></ha-svg-icon> `),l.l[e]||l.Gn)}}(0,s.Cg)([(0,o.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,s.Cg)([(0,o.MZ)()],g.prototype,"service",void 0),(0,s.Cg)([(0,o.MZ)()],g.prototype,"icon",void 0),g=(0,s.Cg)([(0,o.EM)("ha-service-icon")],g),t()}catch(h){t(h)}})},73150:function(e,t,i){i(62953);var s=i(40445),a=i(5124),o=i(67576);let r,n,l=e=>e;class c extends a.WF{render(){return(0,a.qy)(r||(r=l` <svg width="100%" height="100%" viewBox="0 0 48 48"> <line x1="24" y1="0" x2="24" y2="${0}"></line> <line x1="24" y1="24" x2="36" y2="24"></line> </svg> `),this.end?"24":"48")}constructor(...e){super(...e),this.end=!1}}c.styles=(0,a.AH)(n||(n=l`:host{display:block;width:48px;height:48px}line{stroke:var(--divider-color);stroke-width:2;stroke-dasharray:2}`)),(0,s.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],c.prototype,"end",void 0),c=(0,s.Cg)([(0,o.EM)("ha-tree-indicator")],c)},14404:function(e,t,i){i.a(e,async function(e,s){try{i.d(t,{S:function(){return M}});var a=i(40445),o=i(5124),r=i(67576),n=i(91450),l=i(71727),c=i(85694),h=i(53580),d=(i(47680),i(67094),e([c]));c=(d.then?(await d)():d)[0];let u,p,v,g,_=e=>e;const m="M11,17A1,1 0 0,0 12,18A1,1 0 0,0 13,17A1,1 0 0,0 12,16A1,1 0 0,0 11,17M11,3V7H13V5.08C16.39,5.57 19,8.47 19,12A7,7 0 0,1 12,19A7,7 0 0,1 5,12C5,10.32 5.59,8.78 6.58,7.58L12,13L13.41,11.59L6.61,4.79V4.81C4.42,6.45 3,9.05 3,12A9,9 0 0,0 12,21A9,9 0 0,0 21,12A9,9 0 0,0 12,3M18,12A1,1 0 0,0 17,11A1,1 0 0,0 16,12A1,1 0 0,0 17,13A1,1 0 0,0 18,12M6,12A1,1 0 0,0 7,13A1,1 0 0,0 8,12A1,1 0 0,0 7,11A1,1 0 0,0 6,12Z",f="M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z",b="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",y="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z",w="M12,2C15.31,2 18,4.66 18,7.95C18,12.41 12,19 12,19C12,19 6,12.41 6,7.95C6,4.66 8.69,2 12,2M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M20,19C20,21.21 16.42,23 12,23C7.58,23 4,21.21 4,19C4,17.71 5.22,16.56 7.11,15.83L7.75,16.74C6.67,17.19 6,17.81 6,18.5C6,19.88 8.69,21 12,21C15.31,21 18,19.88 18,18.5C18,17.81 17.33,17.19 16.25,16.74L16.89,15.83C18.78,16.56 20,17.71 20,19Z",C="M13 11H11V5H13M13 15H11V13H13M20 2H4C2.9 2 2 2.9 2 4V22L6 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2Z",$="M8,7A2,2 0 0,1 10,9V14A2,2 0 0,1 8,16A2,2 0 0,1 6,14V9A2,2 0 0,1 8,7M14,14C14,16.97 11.84,19.44 9,19.92V22H7V19.92C4.16,19.44 2,16.97 2,14H4A4,4 0 0,0 8,18A4,4 0 0,0 12,14H14M21.41,9.41L17.17,13.66L18.18,10H14A2,2 0 0,1 12,8V4A2,2 0 0,1 14,2H20A2,2 0 0,1 22,4V8C22,8.55 21.78,9.05 21.41,9.41Z",x="M18,6H13A2,2 0 0,0 11,8V10.28C10.41,10.62 10,11.26 10,12A2,2 0 0,0 12,14C13.11,14 14,13.1 14,12C14,11.26 13.6,10.62 13,10.28V8H16V16H8V8H10V6H8L6,6V18H18M20,20H4V4H20M20,2H4A2,2 0 0,0 2,4V20A2,2 0 0,0 4,22H20C21.11,22 22,21.1 22,20V4C22,2.89 21.11,2 20,2Z",A="M4,17V9H2V7H6V17H4M22,15C22,16.11 21.1,17 20,17H16V15H20V13H18V11H20V9H16V7H20A2,2 0 0,1 22,9V10.5A1.5,1.5 0 0,1 20.5,12A1.5,1.5 0 0,1 22,13.5V15M14,15V17H8V13C8,11.89 8.9,11 10,11H12V9H8V7H12A2,2 0 0,1 14,9V11C14,12.11 13.1,13 12,13H10V15H14Z",H="M21,9L17,5V8H10V10H17V13M7,11L3,15L7,19V16H14V14H7V11Z",L="M12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7M12,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,2L14.39,5.42C13.65,5.15 12.84,5 12,5C11.16,5 10.35,5.15 9.61,5.42L12,2M3.34,7L7.5,6.65C6.9,7.16 6.36,7.78 5.94,8.5C5.5,9.24 5.25,10 5.11,10.79L3.34,7M3.36,17L5.12,13.23C5.26,14 5.53,14.78 5.95,15.5C6.37,16.24 6.91,16.86 7.5,17.37L3.36,17M20.65,7L18.88,10.79C18.74,10 18.47,9.23 18.05,8.5C17.63,7.78 17.1,7.15 16.5,6.64L20.65,7M20.64,17L16.5,17.36C17.09,16.85 17.62,16.22 18.04,15.5C18.46,14.77 18.73,14 18.87,13.21L20.64,17M12,22L9.59,18.56C10.33,18.83 11.14,19 12,19C12.82,19 13.63,18.83 14.37,18.56L12,22Z",V="M10.46,19C9,21.07 6.15,21.59 4.09,20.15C2.04,18.71 1.56,15.84 3,13.75C3.87,12.5 5.21,11.83 6.58,11.77L6.63,13.2C5.72,13.27 4.84,13.74 4.27,14.56C3.27,16 3.58,17.94 4.95,18.91C6.33,19.87 8.26,19.5 9.26,18.07C9.57,17.62 9.75,17.13 9.82,16.63V15.62L15.4,15.58L15.47,15.47C16,14.55 17.15,14.23 18.05,14.75C18.95,15.27 19.26,16.43 18.73,17.35C18.2,18.26 17.04,18.58 16.14,18.06C15.73,17.83 15.44,17.46 15.31,17.04L11.24,17.06C11.13,17.73 10.87,18.38 10.46,19M17.74,11.86C20.27,12.17 22.07,14.44 21.76,16.93C21.45,19.43 19.15,21.2 16.62,20.89C15.13,20.71 13.9,19.86 13.19,18.68L14.43,17.96C14.92,18.73 15.75,19.28 16.75,19.41C18.5,19.62 20.05,18.43 20.26,16.76C20.47,15.09 19.23,13.56 17.5,13.35C16.96,13.29 16.44,13.36 15.97,13.53L15.12,13.97L12.54,9.2H12.32C11.26,9.16 10.44,8.29 10.47,7.25C10.5,6.21 11.4,5.4 12.45,5.44C13.5,5.5 14.33,6.35 14.3,7.39C14.28,7.83 14.11,8.23 13.84,8.54L15.74,12.05C16.36,11.85 17.04,11.78 17.74,11.86M8.25,9.14C7.25,6.79 8.31,4.1 10.62,3.12C12.94,2.14 15.62,3.25 16.62,5.6C17.21,6.97 17.09,8.47 16.42,9.67L15.18,8.95C15.6,8.14 15.67,7.15 15.27,6.22C14.59,4.62 12.78,3.85 11.23,4.5C9.67,5.16 8.97,7 9.65,8.6C9.93,9.26 10.4,9.77 10.97,10.11L11.36,10.32L8.29,15.31C8.32,15.36 8.36,15.42 8.39,15.5C8.88,16.41 8.54,17.56 7.62,18.05C6.71,18.54 5.56,18.18 5.06,17.24C4.57,16.31 4.91,15.16 5.83,14.67C6.22,14.46 6.65,14.41 7.06,14.5L9.37,10.73C8.9,10.3 8.5,9.76 8.25,9.14Z",M={calendar:"M19,19H5V8H19M16,1V3H8V1H6V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H18V1M17,12H12V17H17V12Z",device:"M3 6H21V4H3C1.9 4 1 4.9 1 6V18C1 19.1 1.9 20 3 20H7V18H3V6M13 12H9V13.78C8.39 14.33 8 15.11 8 16C8 16.89 8.39 17.67 9 18.22V20H13V18.22C13.61 17.67 14 16.88 14 16S13.61 14.33 13 13.78V12M11 17.5C10.17 17.5 9.5 16.83 9.5 16S10.17 14.5 11 14.5 12.5 15.17 12.5 16 11.83 17.5 11 17.5M22 8H16C15.5 8 15 8.5 15 9V19C15 19.5 15.5 20 16 20H22C22.5 20 23 19.5 23 19V9C23 8.5 22.5 8 22 8M21 18H17V10H21V18Z",event:"M10,9A1,1 0 0,1 11,8A1,1 0 0,1 12,9V13.47L13.21,13.6L18.15,15.79C18.68,16.03 19,16.56 19,17.14V21.5C18.97,22.32 18.32,22.97 17.5,23H11C10.62,23 10.26,22.85 10,22.57L5.1,18.37L5.84,17.6C6.03,17.39 6.3,17.28 6.58,17.28H6.8L10,19V9M11,5A4,4 0 0,1 15,9C15,10.5 14.2,11.77 13,12.46V11.24C13.61,10.69 14,9.89 14,9A3,3 0 0,0 11,6A3,3 0 0,0 8,9C8,9.89 8.39,10.69 9,11.24V12.46C7.8,11.77 7,10.5 7,9A4,4 0 0,1 11,5M11,3A6,6 0 0,1 17,9C17,10.7 16.29,12.23 15.16,13.33L14.16,12.88C15.28,11.96 16,10.56 16,9A5,5 0 0,0 11,4A5,5 0 0,0 6,9C6,11.05 7.23,12.81 9,13.58V14.66C6.67,13.83 5,11.61 5,9A6,6 0 0,1 11,3Z",state:"M6.27 17.05C6.72 17.58 7 18.25 7 19C7 20.66 5.66 22 4 22S1 20.66 1 19 2.34 16 4 16C4.18 16 4.36 16 4.53 16.05L7.6 10.69L5.86 9.7L9.95 8.58L11.07 12.67L9.33 11.68L6.27 17.05M20 16C18.7 16 17.6 16.84 17.18 18H11V16L8 19L11 22V20H17.18C17.6 21.16 18.7 22 20 22C21.66 22 23 20.66 23 19S21.66 16 20 16M12 8C12.18 8 12.36 8 12.53 7.95L15.6 13.31L13.86 14.3L17.95 15.42L19.07 11.33L17.33 12.32L14.27 6.95C14.72 6.42 15 5.75 15 5C15 3.34 13.66 2 12 2S9 3.34 9 5 10.34 8 12 8Z",geo_location:"M12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5M12,2A7,7 0 0,0 5,9C5,14.25 12,22 12,22C12,22 19,14.25 19,9A7,7 0 0,0 12,2Z",homeassistant:h.mdiHomeAssistant,mqtt:H,numeric_state:A,sun:L,conversation:$,tag:x,template:b,time:f,time_pattern:m,webhook:V,persistent_notification:C,zone:w,list:y};class k extends o.WF{render(){if(this.icon)return(0,o.qy)(u||(u=_`<ha-icon .icon="${0}"></ha-icon>`),this.icon);if(!this.trigger)return o.s6;if(!this.hass)return this._renderFallback();const e=(0,c.ab)(this.hass.connection,this.hass.config,this.trigger).then(e=>e?(0,o.qy)(p||(p=_`<ha-icon .icon="${0}"></ha-icon>`),e):this._renderFallback());return(0,o.qy)(v||(v=_`${0}`),(0,n.T)(e))}_renderFallback(){const e=(0,l.m)(this.trigger);return(0,o.qy)(g||(g=_` <ha-svg-icon .path="${0}"></ha-svg-icon> `),M[this.trigger]||c.l[e])}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],k.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)()],k.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)()],k.prototype,"icon",void 0),k=(0,a.Cg)([(0,r.EM)("ha-trigger-icon")],k),s()}catch(u){s(u)}})},36866:function(e,t,i){i.a(e,async function(e,t){try{i(62953);var s=i(40445),a=i(5124),o=i(67576),r=i(91485),n=e([r]);r=(n.then?(await n)():n)[0];let l,c,h=e=>e;const d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z";class u extends r.U{willUpdate(e){var t,i;(super.willUpdate(e),this.label||this.placeholder||this.hasUpdated&&!e.has("_i18n"))||(this.placeholder=(null===(t=this.i18n)||void 0===t||null===(i=t.localize)||void 0===i?void 0:i.call(t,"ui.common.search"))||"Search")}renderStartDefault(){return(0,a.qy)(l||(l=h`<ha-svg-icon slot="start" .path="${0}"></ha-svg-icon>`),d)}constructor(){super(),this.withClear=!0,this.autocomplete=this.autocomplete||"off"}}u.styles=[...r.U.styles,(0,a.AH)(c||(c=h`:host([appearance=outlined]) wa-input.no-label::part(base){height:40px}`))],u=(0,s.Cg)([(0,o.EM)("ha-input-search")],u),t()}catch(l){t(l)}})},28170:function(e,t,i){i.d(t,{o:function(){return c}});i(62953);var s=i(40445),a=i(5124),o=i(67576),r=i(1087),n=i(83892);let l;class c extends n.x{connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role",this.defaultRole),(0,r.r)(this,"ha-list-item-register",{item:this})}disconnectedCallback(){super.disconnectedCallback(),(0,r.r)(this,"ha-list-item-unregister",{item:this})}activate(){this.click()}constructor(...e){super(...e),this.interactive=!1,this.defaultRole="listitem"}}c.styles=[n.x.styles,(0,a.AH)(l||(l=(e=>e)`:host{--ha-list-item-focus-radius:var(--ha-border-radius-sm);--ha-list-item-focus-width:2px;--ha-list-item-focus-width-start:var(--ha-space-2);--ha-list-item-focus-offset:-2px;--ha-list-item-focus-background:var(--ha-color-fill-neutral-quiet-hover)}:host(:focus){outline:0}.base{border-radius:var(--ha-list-item-focus-radius);outline:var(--ha-list-item-focus-width) solid transparent;outline-offset:var(--ha-list-item-focus-offset);transition:outline-color var(--ha-animation-duration-fast) ease-out,background-color var(--ha-animation-duration-fast) ease-out}@keyframes ha-list-item-focus-in{from{outline-width:var(--ha-list-item-focus-width-start);outline-offset:calc(-1 * var(--ha-list-item-focus-width-start))}to{outline-width:var(--ha-list-item-focus-width);outline-offset:var(--ha-list-item-focus-offset)}}:host(:focus-visible) .base{outline-color:var(--ha-color-focus);background-color:var(--ha-list-item-focus-background);animation:ha-list-item-focus-in var(--ha-animation-duration-normal) ease-in}`))],(0,s.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],c.prototype,"interactive",void 0),c=(0,s.Cg)([(0,o.EM)("ha-list-item-base")],c)},1671:function(e,t,i){i(62953);var s=i(40445),a=i(5124),o=i(67576),r=i(63672),n=(i(54276),i(28170));let l,c,h,d,u=e=>e;class p extends n.o{activate(){var e;null===(e=this._item)||void 0===e||e.click()}_renderBase(e){return void 0!==this.href?(0,a.qy)(l||(l=u`<a part="base" class="base interactive" id="item" href="${0}" target="${0}" rel="${0}" download="${0}" tabindex="-1" aria-disabled="${0}"> ${0}${0} </a>`),(0,r.J)(this.disabled?void 0:this.href),(0,r.J)(this.target),(0,r.J)(this.rel),(0,r.J)(this.download),this.disabled?"true":"false",this._renderRipple(),e):(0,a.qy)(c||(c=u`<button part="base" class="base interactive" id="item" type="button" ?disabled="${0}" tabindex="-1"> ${0}${0} </button>`),this.disabled,this._renderRipple(),e)}_renderRipple(){return(0,a.qy)(h||(h=u`<ha-ripple part="ripple" for="item" ?disabled="${0}"></ha-ripple>`),this.disabled)}constructor(...e){super(...e),this.interactive=!0}}p.styles=[n.o.styles,(0,a.AH)(d||(d=u`:host{cursor:pointer;--ha-ripple-color:var(--primary-text-color)}:host([disabled]){cursor:default}.base.interactive{width:100%;border:none;background:0 0;color:inherit;font:inherit;text-align:inherit;text-decoration:none;appearance:none;cursor:inherit}:host([disabled]) .base.interactive{color:var(--disabled-text-color)}`))],(0,s.Cg)([(0,o.MZ)({type:String})],p.prototype,"href",void 0),(0,s.Cg)([(0,o.MZ)({type:String})],p.prototype,"target",void 0),(0,s.Cg)([(0,o.MZ)({type:String})],p.prototype,"rel",void 0),(0,s.Cg)([(0,o.MZ)({type:String})],p.prototype,"download",void 0),(0,s.Cg)([(0,o.P)("#item")],p.prototype,"_item",void 0),p=(0,s.Cg)([(0,o.EM)("ha-list-item-button")],p)},83892:function(e,t,i){i.d(t,{x:function(){return g}});i(18111),i(13579),i(27495),i(42762),i(62953);var s=i(40445),a=i(92070),o=i(5124),r=i(67576);let n,l,c,h,d,u,p,v=e=>e;class g extends o.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,o.qy)(n||(n=v`<div part="base" class="base" id="item">${0}</div>`),e)}_renderInner(){const e=this._slotController.test("content");return(0,o.qy)(l||(l=v` <div part="start" class="start" ?hidden="${0}"> <slot name="start" @slotchange="${0}"></slot> </div> <div part="content" class="content"> ${0} </div> <div part="end" class="end" ?hidden="${0}"> <slot name="end" @slotchange="${0}"></slot> </div> `),!this._hasStart,this._onSlotChange("start"),e?(0,o.qy)(c||(c=v`<slot name="content"></slot>`)):this._renderDefaultContent(),!this._hasEnd,this._onSlotChange("end"))}_renderDefaultContent(){var e,t;const i=this._slotController.test("headline"),s=this._slotController.test("supporting-text"),a=i||void 0!==this.headline,r=s||void 0!==this.supportingText;return(0,o.qy)(h||(h=v` ${0} ${0} `),a?(0,o.qy)(d||(d=v`<div part="headline" class="headline"> <slot name="headline">${0}</slot> </div>`),null!==(e=this.headline)&&void 0!==e?e:o.s6):o.s6,r?(0,o.qy)(u||(u=v`<div part="supporting-text" class="supporting"> <slot name="supporting-text">${0}</slot> </div>`),null!==(t=this.supportingText)&&void 0!==t?t:o.s6):o.s6)}constructor(...e){super(...e),this.disabled=!1,this._slotController=new a.X(this,"headline","supporting-text","content"),this._hasStart=!1,this._hasEnd=!1}}g.styles=(0,o.AH)(p||(p=v`: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,s.Cg)([(0,r.MZ)({type:String})],g.prototype,"headline",void 0),(0,s.Cg)([(0,r.MZ)({type:String,attribute:"supporting-text"})],g.prototype,"supportingText",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],g.prototype,"disabled",void 0),(0,s.Cg)([(0,r.wk)()],g.prototype,"_hasStart",void 0),(0,s.Cg)([(0,r.wk)()],g.prototype,"_hasEnd",void 0),g=(0,s.Cg)([(0,r.EM)("ha-row-item")],g)},50723:function(e,t,i){i.d(t,{N:function(){return p}});i(74423),i(26910),i(18111),i(22489),i(7588),i(62953);var s=i(40445),a=i(5124),o=i(67576),r=i(91335);i(44114),i(94490);const n=e=>{const t=[];let i=e;for(;i;){t.push(i);const e=i.parentNode;if(e instanceof ShadowRoot)i=e.host;else if(e)i=e;else{const e=i.getRootNode();i=e instanceof ShadowRoot?e.host:null}}return t.reverse()},l=(e,t)=>{if(e===t)return 0;const i=n(e),s=n(t);let a=0;for(;a<i.length&&a<s.length&&i[a]===s[a];)a++;return 0===a?0:a===i.length?-1:a===s.length?1:i[a].compareDocumentPosition(s[a])&Node.DOCUMENT_POSITION_FOLLOWING?-1:1};var c=i(1087);let h,d,u=e=>e;class p extends a.WF{connectedCallback(){super.connectedCallback(),this.hasAttribute("ha-list")||this.setAttribute("ha-list",""),!this.hasAttribute("role")&&this.hostRole&&this.setAttribute("role",this.hostRole),this._unbindKeys=(0,r.Tc)(this,{ArrowDown:this._onForward,ArrowUp:this._onBack,Home:this._onHome,End:this._onEnd,Enter:this._onActivate,Space:this._onActivate}),this.addEventListener("focusin",this._onFocusIn),this.addEventListener("ha-list-item-register",this._onItemRegister),this.addEventListener("ha-list-item-unregister",this._onItemUnregister)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._unbindKeys)||void 0===e||e.call(this),this._unbindKeys=void 0,this.removeEventListener("focusin",this._onFocusIn),this.removeEventListener("ha-list-item-register",this._onItemRegister),this.removeEventListener("ha-list-item-unregister",this._onItemUnregister)}focus(e){this.items.length?this.focusItemAtIndex(this._activeItemIndex>=0?this._activeItemIndex:0):super.focus(e)}focusItemAtIndex(e){e<0||this.setActiveItemIndex(e,!0)}getActiveItemIndex(){return this._activeItemIndex}setActiveItemIndex(e,t=!1){this._hasFocusableItem?(this._activeItemIndex=Math.max(0,Math.min(this.items.length-1,e)),this._isFocusable(this._activeItemIndex)||(this._activeItemIndex=this._firstFocusableIndex),this._applyActive(t)):this._activeItemIndex=-1}updateListItems(){this._recomputeFocusableIndexes(),(this._activeItemIndex>=this.items.length||!this._hasFocusableItem||this._activeItemIndex<0)&&(this._activeItemIndex=this._firstFocusableIndex),this._applyActive(!1)}_recomputeFocusableIndexes(){let e=-1,t=-1;for(let i=0;i<this.items.length;i++)this._isFocusable(i)&&(-1===e&&(e=i),t=i);this._firstFocusableIndex=e,this._lastFocusableIndex=t,this._hasFocusableItem=-1!==e}render(){return(0,a.qy)(h||(h=u`<div part="base" class="base"> <slot></slot> </div>`))}_isFocusable(e){const t=this.items[e];return!!t&&t.interactive&&!t.disabled}_applyActive(e){var t;(this.items.forEach((e,t)=>{e.interactive&&!e.disabled?e.tabIndex=t===this._activeItemIndex?0:-1:e.removeAttribute("tabindex")}),e&&this._activeItemIndex>=0)&&(null===(t=this.items[this._activeItemIndex])||void 0===t||t.focus())}_moveFocus(e,t){!this._hasFocusableItem||t<0||t===this._activeItemIndex||(e.preventDefault(),this._activeItemIndex=t,this._applyActive(!0))}_stepIndex(e,t){const i=this.items.length;if(!i||!this._hasFocusableItem)return e;let s=e;for(let a=0;a<i;a++){if(s+=t,s<0||s>=i){if(!this.wrapFocus)return e;s=(s+i)%i}if(this._isFocusable(s))return s}return e}constructor(...e){super(...e),this.wrapFocus=!1,this.ariaLabel=null,this.items=[],this.hostRole="list",this._activeItemIndex=-1,this._firstFocusableIndex=-1,this._lastFocusableIndex=-1,this._hasFocusableItem=!1,this._onItemRegister=e=>{e.stopPropagation();const t=e.detail.item;if(this.items.includes(t))return;const i=[...this.items,t];i.sort(l),this.items=i,this.updateListItems()},this._onItemUnregister=e=>{e.stopPropagation();const t=e.detail.item;this.items.includes(t)&&(this.items=this.items.filter(e=>e!==t),this.updateListItems())},this._onFocusIn=e=>{const t=e.composedPath();for(let i=0;i<this.items.length;i++)if(t.includes(this.items[i]))return void(i!==this._activeItemIndex&&(this._activeItemIndex=i,this._applyActive(!1)))},this._onForward=e=>{this._moveFocus(e,this._stepIndex(this._activeItemIndex,1))},this._onBack=e=>{this._moveFocus(e,this._stepIndex(this._activeItemIndex,-1))},this._onHome=e=>{this._moveFocus(e,this._firstFocusableIndex)},this._onEnd=e=>{this._moveFocus(e,this._lastFocusableIndex)},this._onActivate=e=>{if(!this._isFocusable(this._activeItemIndex))return;e.preventDefault();const t=this.items[this._activeItemIndex];t.activate(),(0,c.r)(this,"ha-list-activated",{index:this._activeItemIndex,item:t})}}}p.styles=(0,a.AH)(d||(d=u`:host{display:block}.base{display:flex;flex-direction:column;gap:var(--ha-list-gap,0);padding:var(--ha-list-padding,0);margin:0;list-style:none}`)),(0,s.Cg)([(0,o.MZ)({type:Boolean,attribute:"wrap-focus"})],p.prototype,"wrapFocus",void 0),(0,s.Cg)([(0,o.MZ)({type:String,attribute:"aria-label",reflect:!0})],p.prototype,"ariaLabel",void 0),p=(0,s.Cg)([(0,o.EM)("ha-list-base")],p)},30780:function(e,t,i){i.d(t,{EN:function(){return l},I8:function(){return d},L_:function(){return h},MC:function(){return c},O$:function(){return a},bM:function(){return n},ix:function(){return o},rP:function(){return r}});i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);const s="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z",a={condition:"M4 2A2 2 0 0 0 2 4V12H4V8H6V12H8V4A2 2 0 0 0 6 2H4M4 4H6V6H4M22 15.5V14A2 2 0 0 0 20 12H16V22H20A2 2 0 0 0 22 20V18.5A1.54 1.54 0 0 0 20.5 17A1.54 1.54 0 0 0 22 15.5M20 20H18V18H20V20M20 16H18V14H20M5.79 21.61L4.21 20.39L18.21 2.39L19.79 3.61Z",delay:"M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M19.03,7.39L20.45,5.97C20,5.46 19.55,5 19.04,4.56L17.62,6C16.07,4.74 14.12,4 12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22C17,22 21,17.97 21,13C21,10.88 20.26,8.93 19.03,7.39M11,14H13V8H11M15,1H9V3H15V1Z",event:"M10,9A1,1 0 0,1 11,8A1,1 0 0,1 12,9V13.47L13.21,13.6L18.15,15.79C18.68,16.03 19,16.56 19,17.14V21.5C18.97,22.32 18.32,22.97 17.5,23H11C10.62,23 10.26,22.85 10,22.57L5.1,18.37L5.84,17.6C6.03,17.39 6.3,17.28 6.58,17.28H6.8L10,19V9M11,5A4,4 0 0,1 15,9C15,10.5 14.2,11.77 13,12.46V11.24C13.61,10.69 14,9.89 14,9A3,3 0 0,0 11,6A3,3 0 0,0 8,9C8,9.89 8.39,10.69 9,11.24V12.46C7.8,11.77 7,10.5 7,9A4,4 0 0,1 11,5M11,3A6,6 0 0,1 17,9C17,10.7 16.29,12.23 15.16,13.33L14.16,12.88C15.28,11.96 16,10.56 16,9A5,5 0 0,0 11,4A5,5 0 0,0 6,9C6,11.05 7.23,12.81 9,13.58V14.66C6.67,13.83 5,11.61 5,9A6,6 0 0,1 11,3Z",play_media:"M8,5.14V19.14L19,12.14L8,5.14Z",service:"M12,5A2,2 0 0,1 14,7C14,7.24 13.96,7.47 13.88,7.69C17.95,8.5 21,11.91 21,16H3C3,11.91 6.05,8.5 10.12,7.69C10.04,7.47 10,7.24 10,7A2,2 0 0,1 12,5M22,19H2V17H22V19Z",wait_template:"M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",wait_for_trigger:"M12,9A2,2 0 0,1 10,7C10,5.89 10.9,5 12,5C13.11,5 14,5.89 14,7A2,2 0 0,1 12,9M12,14A2,2 0 0,1 10,12C10,10.89 10.9,10 12,10C13.11,10 14,10.89 14,12A2,2 0 0,1 12,14M12,19A2,2 0 0,1 10,17C10,15.89 10.9,15 12,15C13.11,15 14,15.89 14,17A2,2 0 0,1 12,19M20,10H17V8.86C18.72,8.41 20,6.86 20,5H17V4A1,1 0 0,0 16,3H8A1,1 0 0,0 7,4V5H4C4,6.86 5.28,8.41 7,8.86V10H4C4,11.86 5.28,13.41 7,13.86V15H4C4,16.86 5.28,18.41 7,18.86V20A1,1 0 0,0 8,21H16A1,1 0 0,0 17,20V18.86C18.72,18.41 20,16.86 20,15H17V13.86C18.72,13.41 20,11.86 20,10Z",repeat:s,repeat_count:s,repeat_while:s,repeat_until:s,repeat_for_each:s,choose:"M11,5H8L12,1L16,5H13V9.43C12.25,9.89 11.58,10.46 11,11.12V5M22,11L18,7V10C14.39,9.85 11.31,12.57 11,16.17C9.44,16.72 8.62,18.44 9.17,20C9.72,21.56 11.44,22.38 13,21.83C14.56,21.27 15.38,19.56 14.83,18C14.53,17.14 13.85,16.47 13,16.17C13.47,12.17 17.47,11.97 17.95,11.97V14.97L22,11M10.63,11.59C9.3,10.57 7.67,10 6,10V7L2,11L6,15V12C7.34,12.03 8.63,12.5 9.64,13.4C9.89,12.76 10.22,12.15 10.63,11.59Z",if:"M14,4L16.29,6.29L13.41,9.17L14.83,10.59L17.71,7.71L20,10V4M10,4H4V10L6.29,7.71L11,12.41V20H13V11.59L7.71,6.29",device_id:"M3 6H21V4H3C1.9 4 1 4.9 1 6V18C1 19.1 1.9 20 3 20H7V18H3V6M13 12H9V13.78C8.39 14.33 8 15.11 8 16C8 16.89 8.39 17.67 9 18.22V20H13V18.22C13.61 17.67 14 16.88 14 16S13.61 14.33 13 13.78V12M11 17.5C10.17 17.5 9.5 16.83 9.5 16S10.17 14.5 11 14.5 12.5 15.17 12.5 16 11.83 17.5 11 17.5M22 8H16C15.5 8 15 8.5 15 9V19C15 19.5 15.5 20 16 20H22C22.5 20 23 19.5 23 19V9C23 8.5 22.5 8 22 8M21 18H17V10H21V18Z",stop:"M13 24C9.74 24 6.81 22 5.6 19L2.57 11.37C2.26 10.58 3 9.79 3.81 10.05L4.6 10.31C5.16 10.5 5.62 10.92 5.84 11.47L7.25 15H8V3.25C8 2.56 8.56 2 9.25 2S10.5 2.56 10.5 3.25V12H11.5V1.25C11.5 .56 12.06 0 12.75 0S14 .56 14 1.25V12H15V2.75C15 2.06 15.56 1.5 16.25 1.5C16.94 1.5 17.5 2.06 17.5 2.75V12H18.5V5.75C18.5 5.06 19.06 4.5 19.75 4.5S21 5.06 21 5.75V16C21 20.42 17.42 24 13 24Z",sequence:"M7,13V11H21V13H7M7,19V17H21V19H7M7,7V5H21V7H7M3,8V5H2V4H4V8H3M2,17V16H5V20H2V19H4V18.5H3V17.5H4V17H2M4.25,10A0.75,0.75 0 0,1 5,10.75C5,10.95 4.92,11.14 4.79,11.27L3.12,13H5V14H2V13.08L4,11H2V10H4.25Z",parallel:"M16,4.5V7H5V9H16V11.5L19.5,8M16,12.5V15H5V17H16V19.5L19.5,16",variables:"M21 2H3C1.9 2 1 2.9 1 4V20C1 21.1 1.9 22 3 22H21C22.1 22 23 21.1 23 20V4C23 2.9 22.1 2 21 2M21 20H3V6H21V20M16.6 8C18.1 9.3 19 11.1 19 13C19 14.9 18.1 16.7 16.6 18L15 17.4C16.3 16.4 17 14.7 17 13S16.3 9.6 15 8.6L16.6 8M7.4 8L9 8.6C7.7 9.6 7 11.3 7 13S7.7 16.4 9 17.4L7.4 18C5.9 16.7 5 14.9 5 13S5.9 9.3 7.4 8M12.1 12L13.5 10H15L12.8 13L14.1 16H12.8L12 14L10.6 16H9L11.3 12.9L10 10H11.3L12.1 12Z",set_conversation_response:"M12,8H4A2,2 0 0,0 2,10V14A2,2 0 0,0 4,16H5V20A1,1 0 0,0 6,21H8A1,1 0 0,0 9,20V16H12L17,20V4L12,8M21.5,12C21.5,13.71 20.54,15.26 19,16V8C20.53,8.75 21.5,10.3 21.5,12Z"},o=new Set(["variables"]),r=[{groups:{device_id:{},dynamicGroups:{}}},{titleKey:"ui.panel.config.automation.editor.actions.groups.helpers.label",groups:{helpers:{}}},{titleKey:"ui.panel.config.automation.editor.actions.groups.other.label",groups:{event:{},service:{},set_conversation_response:{},other:{}}}],n={condition:{},delay:{},wait_template:{},wait_for_trigger:{},repeat_count:{},repeat_while:{},repeat_until:{},repeat_for_each:{},choose:{},if:{},stop:{},sequence:{},parallel:{},variables:{}},l={repeat_count:{repeat:{count:2,sequence:[]}},repeat_while:{repeat:{while:[],sequence:[]}},repeat_until:{repeat:{until:[],sequence:[]}},repeat_for_each:{repeat:{for_each:{},sequence:[]}}},c=["ha-automation-action-choose","ha-automation-action-condition","ha-automation-action-if","ha-automation-action-parallel","ha-automation-action-repeat","ha-automation-action-sequence"],h=["choose","if","parallel","sequence","repeat_while","repeat_until"],d=["repeat_count","repeat_for_each","wait_for_trigger"]},53641:function(e,t,i){i.d(t,{L3:function(){return a},QI:function(){return c},WT:function(){return n},bQ:function(){return l},ft:function(){return s.f},gs:function(){return o},uG:function(){return r}});i(44114),i(62953);var s=i(29908);const a=(e,t)=>e.callWS(Object.assign({type:"config/area_registry/create"},t)),o=(e,t,i)=>e.callWS(Object.assign({type:"config/area_registry/update",area_id:t},i)),r=(e,t)=>e.callWS({type:"config/area_registry/delete",area_id:t}),n=(e,t)=>e.callWS({type:"config/area_registry/reorder",area_ids:t}),l=e=>{const t={};for(const i of e)i.area_id&&(i.area_id in t||(t[i.area_id]=[]),t[i.area_id].push(i));return t},c=e=>{const t={};for(const i of e)i.area_id&&(i.area_id in t||(t[i.area_id]=[]),t[i.area_id].push(i));return t}},28223:function(e,t,i){i.d(t,{Z2:function(){return h},bi:function(){return c},g3:function(){return l}});i(46449),i(74423),i(44114),i(93514),i(18111),i(81148),i(22489),i(7588),i(61701),i(13579),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);var s=i(66639),a=i(65522),o=i(71727),r=i(55931),n=i(58594);const l=(e,t,i,s,a,o,r,n,l,c,h,u,p)=>d(e,t,i,s,a,o,r,n,l,c,h,u,p,!0),c=(e,t,i,s,a,o,r,n,l,c,h,u,p)=>d(e,t,i,s,a,o,r,n,l,c,h,u,p),h=[{name:"search_labels.name",weight:10},{name:"search_labels.aliases",weight:8},{name:"search_labels.floorName",weight:6},{name:"search_labels.relatedAreas",weight:4},{name:"search_labels.id",weight:3}],d=(e,t,i,l,c,h,d,u,p,v,g,_,m,f=!1)=>{const b=Object.values(t),y=Object.values(i),w=Object.values(l),C=Object.values(c);let $,x,A={};(d||u||p||v||g)&&(A=(0,n.g2)(C),$=w,x=C.filter(e=>e.area_id),d&&($=$.filter(e=>{const t=A[e.id];return!(!t||!t.length)&&A[e.id].some(e=>d.includes((0,o.m)(e.entity_id)))}),x=x.filter(e=>d.includes((0,o.m)(e.entity_id)))),u&&($=$.filter(e=>{const t=A[e.id];return!t||!t.length||C.every(e=>!u.includes((0,o.m)(e.entity_id)))}),x=x.filter(e=>!u.includes((0,o.m)(e.entity_id)))),p&&($=$.filter(t=>{const i=A[t.id];return!(!i||!i.length)&&A[t.id].some(t=>{const i=e[t.entity_id];return!!i&&(i.attributes.device_class&&p.includes(i.attributes.device_class))})}),x=x.filter(t=>{const i=e[t.entity_id];return i.attributes.device_class&&p.includes(i.attributes.device_class)})),v&&($=$.filter(e=>v(e))),g&&($=$.filter(t=>{const i=A[t.id];return!(!i||!i.length)&&A[t.id].some(t=>{const i=e[t.entity_id];return!!i&&g(i)})}),x=x.filter(t=>{const i=e[t.entity_id];return!!i&&g(i)})));let H,L=y,V=b;if($&&(H=$.filter(e=>e.area_id).map(e=>e.area_id)),x&&(H=(null!=H?H:[]).concat(x.filter(e=>e.area_id).map(e=>e.area_id))),H&&(L=L.filter(e=>H.includes(e.area_id))),_&&(L=L.filter(e=>!_.includes(e.area_id))),m&&(L=L.filter(e=>!e.floor_id||!m.includes(e.floor_id)),V=V.filter(e=>!m.includes(e.floor_id))),g||v||d||u||p){const e=new Set(L.map(e=>e.floor_id).filter(e=>e));V=V.filter(t=>e.has(t.floor_id))}const M=(0,s.cs)(V,L),k=[];M.floors.forEach(e=>{const s=t[e.id],o=e.areas.map(e=>i[e]),n=(0,r.X)(s),l=o.map(e=>{const t=(0,a.A)(e);return[e.area_id,...t?[t]:[],...e.aliases]}).flat(),c={id:h({id:s.floor_id,type:"floor"}),type:"floor",primary:n,floor:s,icon:s.icon||void 0,search_labels:{id:s.floor_id,name:n||null,aliases:s.aliases.join(", ")||null,relatedAreas:l.join(" ")||null}};k.push(c);const d=o.map(e=>{const t=(0,a.A)(e);return{id:h({id:e.area_id,type:"area"}),type:"area",primary:t||e.area_id,area:e,icon:e.icon||void 0,search_labels:{id:e.area_id,name:t||null,aliases:e.aliases.join(", ")||null,floorName:n||null}}});f&&s?c.areas=d:k.push(...d)});const S=M.areas.map(e=>{const t=i[e],s=(0,a.A)(t);return{id:h({id:t.area_id,type:"area"}),type:"area",primary:s||t.area_id,area:t,icon:t.icon||void 0,search_labels:{id:t.area_id,name:s||null,aliases:t.aliases.join(", ")||null}}});return f&&S.length?k.push({id:void 0,areas:S}):k.push(...S),k}},31422:function(e,t,i){i.d(t,{_o:function(){return d},oG:function(){return u},pq:function(){return h}});i(74423),i(18111),i(81148),i(22489),i(61701),i(13579);var s=i(65522),a=i(37981),o=i(71727),r=i(76774),n=i(15638),l=i(95350),c=i(58594);const h=(e,t,i,o,l,c,h,d)=>{const u=(0,r.q)(e,t),p=e.via_device_id?i[e.via_device_id]:void 0,v=p?(0,a.T)(p,l,o,d):void 0,g=p?(0,r.q)(p,t):void 0,_=g?(0,s.A)(g):void 0,m=(0,n.qC)(c,h.translations);return{areaName:u?(0,s.A)(u):_?`${_}${m?" ◂ ":" ▸ "}${v}`:v||void 0,viaDeviceName:v,viaDeviceAreaName:_}},d=[{name:"search_labels.deviceName",weight:10},{name:"search_labels.areaName",weight:8},{name:"search_labels.domainName",weight:4},{name:"search_labels.domain",weight:4},{name:"search_labels.viaDeviceName",weight:3},{name:"search_labels.viaDeviceArea",weight:3}],u=(e,t,i,s,r,n,d,u,p,v="")=>{const g=Object.values(e.devices),_=Object.values(e.entities);let m={};(i||s||r||d)&&(m=(0,c.g2)(_));let f=g.filter(e=>e.id===p||!e.disabled_by);i&&(f=f.filter(e=>{const t=m[e.id];return!(!t||!t.length)&&m[e.id].some(e=>i.includes((0,o.m)(e.entity_id)))})),s&&(f=f.filter(e=>{const t=m[e.id];return!t||!t.length||_.every(e=>!s.includes((0,o.m)(e.entity_id)))})),u&&(f=f.filter(e=>!u.includes(e.id))),r&&(f=f.filter(t=>{const i=m[t.id];return!(!i||!i.length)&&m[t.id].some(t=>{const i=e.states[t.entity_id];return!!i&&(i.attributes.device_class&&r.includes(i.attributes.device_class))})})),d&&(f=f.filter(t=>{const i=m[t.id];return!(!i||!i.length)&&i.some(t=>{const i=e.states[t.entity_id];return!!i&&d(i)})})),n&&(f=f.filter(e=>e.id===p||n(e)));return f.map(i=>{const s=(0,a.T)(i,e.localize,e.states,m[i.id]),{areaName:o,viaDeviceName:r,viaDeviceAreaName:n}=h(i,e.areas,e.devices,e.states,e.localize,e.language,e.translationMetadata,i.via_device_id?m[i.via_device_id]:void 0),c=i.primary_config_entry?null==t?void 0:t[i.primary_config_entry]:void 0,d=null==c?void 0:c.domain,u=d?(0,l.p$)(e.localize,d):void 0,p=s||e.localize("ui.components.device-picker.unnamed_device");return{id:`${v}${i.id}`,label:"",primary:p,secondary:o,domain:null==c?void 0:c.domain,domain_name:u,search_labels:{deviceName:s,areaName:o||null,domain:d||null,domainName:u||null,viaDeviceName:r||null,viaDeviceArea:n||null},sorting_label:[p,o,u].filter(Boolean).join("_")}})}},53756:function(e,t,i){i.d(t,{t:function(){return l},w:function(){return c}});i(74423),i(18111),i(22489),i(61701),i(62953);var s=i(71727),a=i(74705),o=i(28978),r=i(15638),n=i(95350);const l=[{name:"search_labels.entityName",weight:10},{name:"search_labels.friendlyName",weight:8},{name:"search_labels.deviceName",weight:7},{name:"search_labels.areaName",weight:6},{name:"search_labels.domainName",weight:6},{name:"search_labels.entityId",weight:3}],c=(e,t,i,l,c,h,d,u,p,v="")=>{let g,_=Object.keys(e.states);return d&&(_=_.filter(e=>d.includes(e))),u&&(_=_.filter(e=>!u.includes(e))),t&&(_=_.filter(e=>t.includes((0,s.m)(e)))),i&&(_=_.filter(e=>!i.includes((0,s.m)(e)))),g=_.map(t=>{const i=e.states[t],l=(0,o.u)(i),[c,h,d]=(0,a.Cf)(i,[{type:"entity"},{type:"device"},{type:"area"}],e.entities,e.devices,e.areas,e.floors),u=(0,n.p$)(e.localize,(0,s.m)(t)),p=(0,r.qC)(e.language,e.translationMetadata.translations),g=c||h||t,_=[d,c?h:void 0].filter(Boolean).join(p?" ◂ ":" ▸ ");return{id:`${v}${t}`,primary:g,secondary:_,domain_name:u,sorting_label:[g,_].filter(Boolean).join("_"),search_labels:{entityName:c||null,deviceName:h||null,areaName:d||null,domainName:u||null,friendlyName:l||null,entityId:t},stateObj:i}}),c&&(g=g.filter(e=>{var t;return e.id===p||(null===(t=e.stateObj)||void 0===t?void 0:t.attributes.device_class)&&c.includes(e.stateObj.attributes.device_class)})),h&&(g=g.filter(e=>{var t;return e.id===p||(null===(t=e.stateObj)||void 0===t?void 0:t.attributes.unit_of_measurement)&&h.includes(e.stateObj.attributes.unit_of_measurement)})),l&&(g=g.filter(e=>e.id===p||e.stateObj&&l(e.stateObj))),g}},32250:function(e,t,i){i.d(t,{KD:function(){return s},NL:function(){return a},Rj:function(){return r},_o:function(){return n},ls:function(){return o}});i(44114),i(62953),i(29908);const s=(e,t)=>e.callWS(Object.assign({type:"config/floor_registry/create"},t)),a=(e,t,i)=>e.callWS(Object.assign({type:"config/floor_registry/update",floor_id:t},i)),o=(e,t)=>e.callWS({type:"config/floor_registry/delete",floor_id:t}),r=(e,t)=>e.callWS({type:"config/floor_registry/reorder",floor_ids:t}),n=e=>{const t={};for(const i of e)i.floor_id&&(i.floor_id in t||(t[i.floor_id]=[]),t[i.floor_id].push(i));return t}},5904:function(e,t,i){i.d(t,{I:function(){return r},u:function(){return o}});i(89463),i(74423),i(18111),i(81148),i(22489),i(7588),i(61701),i(13579),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);var s=i(71727),a=i(58594);const o=[{name:"search_labels.name",weight:10},{name:"search_labels.description",weight:5},{name:"search_labels.id",weight:4}],r=(e,t,i,o,r,n,l,c,h,d,u,p="")=>{if(!r||0===r.length)return[];const v=Object.values(i),g=Object.values(o);let _,m,f={};(n||l||c||h||d)&&(f=(0,a.g2)(g),_=v,m=g.filter(e=>e.labels.length>0),n&&(_=_.filter(e=>{const t=f[e.id];return!(!t||!t.length)&&f[e.id].some(e=>n.includes((0,s.m)(e.entity_id)))}),m=m.filter(e=>n.includes((0,s.m)(e.entity_id)))),l&&(_=_.filter(e=>{const t=f[e.id];return!t||!t.length||g.every(e=>!l.includes((0,s.m)(e.entity_id)))}),m=m.filter(e=>!l.includes((0,s.m)(e.entity_id)))),c&&(_=_.filter(t=>{const i=f[t.id];return!(!i||!i.length)&&f[t.id].some(t=>{const i=e[t.entity_id];return!!i&&(i.attributes.device_class&&c.includes(i.attributes.device_class))})}),m=m.filter(t=>{const i=e[t.entity_id];return i&&i.attributes.device_class&&c.includes(i.attributes.device_class)})),h&&(_=_.filter(e=>h(e))),d&&(_=_.filter(t=>{const i=f[t.id];return!(!i||!i.length)&&f[t.id].some(t=>{const i=e[t.entity_id];return!!i&&d(i)})}),m=m.filter(t=>{const i=e[t.entity_id];return!!i&&d(i)})));let b=r;const y=new Set;let w;_&&(w=_.filter(e=>e.area_id).map(e=>e.area_id),_.forEach(e=>{e.labels.forEach(e=>y.add(e))})),m&&(w=(null!=w?w:[]).concat(m.filter(e=>e.area_id).map(e=>e.area_id)),m.forEach(e=>{e.labels.forEach(e=>y.add(e))})),w&&w.forEach(e=>{const i=t[e];null==i||i.labels.forEach(e=>y.add(e))}),u&&(b=b.filter(e=>!u.includes(e.label_id))),(_||m)&&(b=b.filter(e=>y.has(e.label_id)));return b.map(e=>{var t;return{id:`${p}${e.label_id}`,primary:e.name,secondary:null!==(t=e.description)&&void 0!==t?t:"",icon:e.icon||void 0,icon_path:e.icon?void 0:"M17.63,5.84C17.27,5.33 16.67,5 16,5H5A2,2 0 0,0 3,7V17A2,2 0 0,0 5,19H16C16.67,19 17.27,18.66 17.63,18.15L22,12L17.63,5.84Z",sorting_label:e.name,search_labels:{name:e.name,description:e.description,id:e.label_id},color:e.color||void 0}})}},95311:function(e,t,i){i.d(t,{DF:function(){return _},Lo:function(){return C},MH:function(){return u},MM:function(){return m},Qz:function(){return g},Ru:function(){return b},UU:function(){return y},_7:function(){return v},bZ:function(){return p},m0:function(){return d},tD:function(){return w},vX:function(){return f},wY:function(){return $}});var s=i(86518),a=(i(78350),i(74423),i(44114),i(30237),i(18111),i(22489),i(30531),i(7588),i(13579),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953),i(44537)),o=i(69093),r=i(82286),n=i(24367),l=i(58594);const c=["domain","integration","device_class"],h=["integration","manufacturer","model"],d=(e,t,i,s,a,o,r)=>{const n=[],l=[],c=[];return Object.values(i).forEach(i=>{i.labels.includes(t)&&g(e,a,s,i.area_id,o,r)&&c.push(i.area_id)}),Object.values(s).forEach(i=>{i.labels.includes(t)&&_(e.states,Object.values(a),i,o,r)&&l.push(i.id)}),Object.values(a).forEach(i=>{i.labels.includes(t)&&m(e.states[i.entity_id],o,r)&&n.push(i.entity_id)}),{areas:c,devices:l,entities:n}},u=(e,t,i,s,a)=>{const o=[];return Object.values(i).forEach(i=>{i.floor_id===t&&g(e,e.entities,e.devices,i.area_id,s,a)&&o.push(i.area_id)}),{areas:o}},p=(e,t,i,s,a,o)=>{const r=[],n=[];return Object.values(i).forEach(i=>{i.area_id===t&&_(e.states,Object.values(s),i,a,o)&&n.push(i.id)}),Object.values(s).forEach(i=>{i.area_id===t&&m(e.states[i.entity_id],a,o)&&r.push(i.entity_id)}),{devices:n,entities:r}},v=(e,t,i,s,a)=>{const o=[];return Object.values(i).forEach(i=>{i.device_id===t&&m(e.states[i.entity_id],s,a)&&o.push(i.entity_id)}),{entities:o}},g=(e,t,i,s,a,o)=>!!Object.values(i).some(i=>!(i.area_id!==s||!_(e.states,Object.values(t),i,a,o)))||Object.values(t).some(t=>!(t.area_id!==s||!m(e.states[t.entity_id],a,o))),_=(e,t,i,s,o)=>{var r,n;const c=o?(0,l.fk)(o,t):void 0;if(null!==(r=s.target)&&void 0!==r&&r.device&&!(0,a.e)(s.target.device).some(e=>f(e,i,c)))return!1;if(null!==(n=s.target)&&void 0!==n&&n.entity){return t.filter(e=>e.device_id===i.id).some(t=>{const i=e[t.entity_id];return m(i,s,o)})}return!0},m=(e,t,i)=>{var s;return!!e&&(null===(s=t.target)||void 0===s||!s.entity||(0,a.e)(t.target.entity).some(t=>b(t,e,i)))},f=(e,t,i)=>{const{manufacturer:s,model:a,model_id:o,integration:r}=e;if(s&&t.manufacturer!==s)return!1;if(a&&t.model!==a)return!1;if(o&&t.model_id!==o)return!1;var n;if(r&&i&&(null==i||null===(n=i[t.id])||void 0===n||!n.has(r)))return!1;return!0},b=(e,t,i)=>{var s;const{domain:n,device_class:l,supported_features:c,unit_of_measurement:h,integration:d}=e;if(n){const e=(0,o.t)(t);if(Array.isArray(n)?!n.includes(e):e!==n)return!1}if(l){const e=t.attributes.device_class;if(e&&Array.isArray(l)?!l.includes(e):e!==l)return!1}if(c&&!(0,a.e)(c).some(e=>(0,r.$)(t,e)))return!1;if(h){const e=t.attributes.unit_of_measurement;if(!e||(Array.isArray(h)?!h.includes(e):e!==h))return!1}return!d||(null==i||null===(s=i[t.entity_id])||void 0===s?void 0:s.domain)===d},y=e=>{if(!e.entity)return{entity:null};if("filter"in e.entity)return e;const t=e.entity,{domain:i,integration:a,device_class:o}=t,r=(0,s.A)(t,c);return i||a||o?{entity:Object.assign(Object.assign({},r),{},{filter:{domain:i,integration:a,device_class:o}})}:{entity:r}},w=e=>{if(!e.device)return{device:null};if("filter"in e.device)return e;const t=e.device,{integration:i,manufacturer:a,model:o}=t,r=(0,s.A)(t,h);return i||a||o?{device:Object.assign(Object.assign({},r),{},{filter:{integration:i,manufacturer:a,model:o}})}:{device:r}},C=e=>{let t;var i;if("target"in e)t=(0,a.e)(null===(i=e.target)||void 0===i?void 0:i.entity);else if("entity"in e){var s,o;if(null!==(s=e.entity)&&void 0!==s&&s.include_entities)return;t=(0,a.e)(null===(o=e.entity)||void 0===o?void 0:o.filter)}if(!t)return;const r=t.flatMap(e=>e.integration||e.device_class||e.supported_features||!e.domain?[]:(0,a.e)(e.domain).filter(e=>(0,n.z)(e)));return[...new Set(r)]},$=(e,t,i,s,o,r={target:{}})=>{if(!t)return[];const n=new Set((0,a.e)(t.entity_id)),l=new Set((0,a.e)(t.device_id)),c=new Set((0,a.e)(t.area_id)),h=new Set((0,a.e)(t.floor_id));return new Set((0,a.e)(t.label_id)).forEach(t=>{const a=d(e,t,o,s,i,r);a.devices.forEach(e=>l.add(e)),a.entities.forEach(e=>n.add(e)),a.areas.forEach(e=>c.add(e))}),h.forEach(t=>{u(e,t,o,r).areas.forEach(e=>c.add(e))}),c.forEach(t=>{const a=p(e,t,s,i,r);a.devices.forEach(e=>l.add(e)),a.entities.forEach(e=>n.add(e))}),l.forEach(t=>{v(e,t,i,r).entities.forEach(e=>n.add(e))}),Array.from(n)}},88555:function(e,t,i){i.d(t,{F7:function(){return r},G_:function(){return o},Kx:function(){return d},Ly:function(){return u},OJ:function(){return v},YK:function(){return p},aW:function(){return n},j_:function(){return h},oV:function(){return l},vN:function(){return c}});i(74423),i(18111),i(22489),i(13579),i(3362);var s=i(44537),a=i(71727);const o="________",r=async(e,t,i=!1,s=!0)=>e({type:"extract_from_target",target:t,expand_group:i,primary_entities_only:s}),n=e=>{var t,i,a,o,r;const n={entity_id:null!=e&&e.entity_id?(0,s.e)(null==e?void 0:e.entity_id):[],device_id:null!=e&&e.device_id?(0,s.e)(null==e?void 0:e.device_id):[],area_id:null!=e&&e.area_id?(0,s.e)(null==e?void 0:e.area_id):[],floor_id:null!=e&&e.floor_id?(0,s.e)(null==e?void 0:e.floor_id):[],label_id:null!=e&&e.label_id?(0,s.e)(null==e?void 0:e.label_id):[]};return(null==n||null===(t=n.device_id)||void 0===t?void 0:t.length)>0||(null==n||null===(i=n.area_id)||void 0===i?void 0:i.length)>0||(null==n||null===(a=n.floor_id)||void 0===a?void 0:a.length)>0||(null==n||null===(o=n.label_id)||void 0===o?void 0:o.length)>0?1/0:null==n||null===(r=n.entity_id)||void 0===r?void 0:r.length},l=async(e,t,i=!0)=>e({type:"get_triggers_for_target",target:t,expand_group:i}),c=async(e,t,i=!0)=>e({type:"get_conditions_for_target",target:t,expand_group:i}),h=async(e,t,i=!0)=>e({type:"get_services_for_target",target:t,expand_group:i}),d=(e,t,i,s,a,o,r,n,l=!1)=>{if(Object.values(t).filter(t=>t.area_id===e.area_id).some(e=>u(e,i,s,a,o,r,n,l)))return!0;return!!Object.values(i).filter(t=>t.area_id===e.area_id).some(e=>p(e,l,a,o,r,n))},u=(e,t,i,s,a,o,r,n=!1)=>!!Object.values(t).filter(t=>t.device_id===e.id).some(e=>p(e,n,s,a,o,r))&&(!i||i(e)),p=(e,t=!1,i,s,o,r)=>{if(e.hidden||e.entity_category&&!t)return!1;if(i&&!i.includes((0,a.m)(e.entity_id)))return!1;if(s){const t=null==o?void 0:o[e.entity_id];if(!t)return!1;if(!t.attributes.device_class||!s.includes(t.attributes.device_class))return!1}if(r){const t=null==o?void 0:o[e.entity_id];return!!t&&r(t)}return!0},v=e=>"area"===e.type||"floor"===e.type?e.type:"domain"in e?"device":"stateObj"in e?"entity":"___EMPTY_SEARCH___"===e.id?"empty":"label"},29908:function(e,t,i){i.d(t,{f:function(){return n}});var s=i(90889),a=i(9899);const o=e=>e.sendMessagePromise({type:"config/area_registry/list"}),r=(e,t)=>e.subscribeEvents((0,a.s)(()=>o(e).then(e=>t.setState(e,!0)),500,!0),"area_registry_updated"),n=(e,t)=>(0,s.N)("_areaRegistry",o,r,e,t)},79172:function(e,t,i){i.d(t,{b:function(){return a}});i(62953);var s=i(68348);const a=e=>class extends e{connectedCallback(){super.connectedCallback(),this.addKeyboardShortcuts()}disconnectedCallback(){this.removeKeyboardShortcuts(),super.disconnectedCallback()}addKeyboardShortcuts(){this._listenersAdded||(this._listenersAdded=!0,window.addEventListener("keydown",this._keydownEvent))}removeKeyboardShortcuts(){this._listenersAdded=!1,window.removeEventListener("keydown",this._keydownEvent)}supportedShortcuts(){return{}}supportedSingleKeyShortcuts(){return{}}constructor(...e){super(...e),this._keydownEvent=e=>{const t=this.supportedShortcuts(),i=e.shiftKey?e.key.toUpperCase():e.key;if((e.ctrlKey||e.metaKey)&&!e.altKey&&i in t){var a;if(!(0,s.u)(e.composedPath()))return;if(null!==(a=window.getSelection())&&void 0!==a&&a.toString())return;return e.preventDefault(),void t[i]()}const o=this.supportedSingleKeyShortcuts();i in o&&(e.preventDefault(),o[i]())},this._listenersAdded=!1}}},59992:function(e,t,i){i.a(e,async function(e,s){try{i.d(t,{V:function(){return v}});i(62953);var a=i(40445),o=i(88696),r=i(5124),n=i(6412),l=i(67576),c=e([o]);o=(c.then?(await c)():c)[0];let h,d,u=e=>e;const p=e=>void 0===e?[]:Array.isArray(e)?e:[e],v=e=>{class t extends e{get scrollableElement(){return t.DEFAULT_SCROLLABLE_ELEMENT}firstUpdated(e){var t;null===(t=super.firstUpdated)||void 0===t||t.call(this,e),this.scrollableElement&&this._updateScrollableState(this.scrollableElement),this._attachScrollableElement()}updated(e){var t;null===(t=super.updated)||void 0===t||t.call(this,e),this._attachScrollableElement()}disconnectedCallback(){this._detachScrollableElement(),this._contentScrolled=!1,this._contentScrollable=!1,super.disconnectedCallback()}renderScrollableFades(e=!1){return(0,r.qy)(h||(h=u` <div class="${0}"></div> <div class="${0}"></div> `),(0,n.H)({"fade-top":!0,rounded:e,visible:this._contentScrolled}),(0,n.H)({"fade-bottom":!0,rounded:e,visible:this._contentScrollable}))}static get styles(){var e;const t=Object.getPrototypeOf(this);return[...p(null!==(e=null==t?void 0:t.styles)&&void 0!==e?e:[]),(0,r.AH)(d||(d=u`.fade-bottom,.fade-top{position:absolute;left:0;right:0;height:var(--ha-space-2);pointer-events:none;transition:opacity 180ms ease-in-out;border-radius:var(--ha-border-radius-square);opacity:0;background:linear-gradient(to bottom,var(--ha-color-shadow-scrollable-fade),transparent)}.fade-top{top:0}.fade-bottom{bottom:0;transform:rotate(180deg)}.fade-bottom.visible,.fade-top.visible{opacity:1}.fade-bottom.rounded,.fade-top.rounded{border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg));border-bottom-left-radius:var(--ha-border-radius-square);border-bottom-right-radius:var(--ha-border-radius-square)}.fade-top.rounded{border-top-left-radius:var(--ha-border-radius-square);border-top-right-radius:var(--ha-border-radius-square)}.fade-bottom.rounded{border-bottom-left-radius:var(--ha-border-radius-square);border-bottom-right-radius:var(--ha-border-radius-square)}`))]}_attachScrollableElement(){const e=this.scrollableElement;e!==this._scrollTarget&&(this._detachScrollableElement(),e&&(this._scrollTarget=e,e.addEventListener("scroll",this._onScroll,{passive:!0}),this._resize.observe(e),this._updateScrollableState(e)))}_detachScrollableElement(){var e,t;this._scrollTarget&&(this._scrollTarget.removeEventListener("scroll",this._onScroll),null===(e=(t=this._resize).unobserve)||void 0===e||e.call(t,this._scrollTarget),this._scrollTarget=void 0)}_updateScrollableState(e){const t=parseFloat(getComputedStyle(e).getPropertyValue("--safe-area-inset-bottom"))||0,{scrollHeight:i=0,clientHeight:s=0,scrollTop:a=0}=e;this._contentScrollable=i-s>a+t+this.scrollFadeSafeAreaPadding}constructor(...e){super(...e),this._contentScrolled=!1,this._contentScrollable=!1,this._onScroll=e=>{var t;const i=e.currentTarget;this._contentScrolled=(null!==(t=i.scrollTop)&&void 0!==t?t:0)>this.scrollFadeThreshold,this._updateScrollableState(i)},this._resize=new o.P(this,{target:null,callback:e=>{var t;const i=null===(t=e[0])||void 0===t?void 0:t.target;i&&this._updateScrollableState(i)}}),this.scrollFadeSafeAreaPadding=4,this.scrollFadeThreshold=4}}return t.DEFAULT_SCROLLABLE_ELEMENT=null,(0,a.Cg)([(0,l.wk)()],t.prototype,"_contentScrolled",void 0),(0,a.Cg)([(0,l.wk)()],t.prototype,"_contentScrollable",void 0),t};s()}catch(h){s(h)}})},65467:function(e,t,i){i.a(e,async function(e,s){try{i.r(t);i(89463),i(46449),i(74423),i(44114),i(72712),i(26910),i(93514),i(13609),i(18111),i(22489),i(20116),i(7588),i(61701),i(18237),i(13579),i(45367),i(92731),i(53921),i(3362),i(27495),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(25440),i(46058),i(62953),i(48408),i(14603),i(47566),i(98721);var a=i(40445),o=(i(68825),i(35211)),r=i(5124),n=i(67576),l=i(6412),c=i(75751),h=i(22786),d=i(44537),u=i(1087),p=i(63091),v=i(65522),g=i(71727),_=i(74705),m=i(55931),f=i(20058),b=i(52220),y=i(51758),w=i(15638),C=i(9899),$=i(19459),x=i(74281),A=i(99611),H=i(18350),L=i(89865),V=(i(75064),i(76623)),M=i(72554),k=(i(76538),i(59174)),S=(i(18198),i(47680),i(26300)),I=i(45100),O=(i(43661),i(69464),i(65329)),E=i(34127),T=i(14404),j=i(36866),z=(i(1671),i(50723),i(30780)),q=i(53641),D=i(88249),G=i(87225),Z=i(77423),F=i(22792),P=i(58594),B=i(32250),N=i(85694),R=i(95350),W=i(93758),U=i(95311),K=i(88555),J=i(3496),Q=i(79172),Y=i(14503),X=i(36918),ee=i(41570),te=i(81619),ie=i(70897),se=i(2491),ae=i(25871),oe=i(82405),re=i(69070),ne=e([x,A,H,L,M,k,S,I,O,E,j,ie,se,ae,T,V,N,f]);[x,A,H,L,M,k,S,I,O,E,j,ie,se,ae,T,V,N,f]=ne.then?(await ne)():ne;let le,ce,he,de,ue,pe,ve,ge,_e,me,fe,be,ye,we,Ce,$e,xe,Ae,He,Le,Ve,Me,ke,Se,Ie,Oe,Ee,Te,je,ze,qe,De,Ge,Ze=e=>e;const Fe="M6,2A4,4 0 0,1 10,6V8H14V6A4,4 0 0,1 18,2A4,4 0 0,1 22,6A4,4 0 0,1 18,10H16V14H18A4,4 0 0,1 22,18A4,4 0 0,1 18,22A4,4 0 0,1 14,18V16H10V18A4,4 0 0,1 6,22A4,4 0 0,1 2,18A4,4 0 0,1 6,14H8V10H6A4,4 0 0,1 2,6A4,4 0 0,1 6,2M16,18A2,2 0 0,0 18,20A2,2 0 0,0 20,18A2,2 0 0,0 18,16H16V18M14,10H10V14H14V10M6,16A2,2 0 0,0 4,18A2,2 0 0,0 6,20A2,2 0 0,0 8,18V16H6M8,6A2,2 0 0,0 6,4A2,2 0 0,0 4,6A2,2 0 0,0 6,8H8V6M18,8A2,2 0 0,0 20,6A2,2 0 0,0 18,4A2,2 0 0,0 16,6V8H18Z",Pe="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",Be="M19,20H5V4H7V7H17V4H19M12,2A1,1 0 0,1 13,3A1,1 0 0,1 12,4A1,1 0 0,1 11,3A1,1 0 0,1 12,2M19,2H14.82C14.4,0.84 13.3,0 12,0C10.7,0 9.6,0.84 9.18,2H5A2,2 0 0,0 3,4V20A2,2 0 0,0 5,22H19A2,2 0 0,0 21,20V4A2,2 0 0,0 19,2Z",Ne="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",Re="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",We={trigger:{collections:J.NI,icons:T.S},condition:{collections:G.GS,icons:V.D},action:{collections:z.rP,icons:z.O$}},Ue=new Set(["date","datetime","device_tracker","text","time","tts","update","weather","image_processing"]),Ke=new Set(["notify"]),Je=["dynamicGroups","helpers","other","customDynamicGroups"],Qe=new Set([`${D.VH}event`]);class Ye extends((0,Q.b)(r.WF)){willUpdate(e){var t;e.has("hass")&&(null===(t=e.get("hass"))||void 0===t?void 0:t.states)!==this.hass.states&&this._calculateUsedDomains(),e.has("_newTriggersAndConditions")&&this._subscribeDescriptions()}_subscribeDescriptions(){var e,t;this._unsubscribe(),"trigger"===(null===(e=this._params)||void 0===e?void 0:e.type)?(this._triggerDescriptions={},this._unsub=(0,J.Wv)(this.hass,e=>{this._triggerDescriptions=Object.assign(Object.assign({},this._triggerDescriptions),e)})):"condition"===(null===(t=this._params)||void 0===t?void 0:t.type)&&(this._conditionDescriptions={},this._unsub=(0,G.bn)(this.hass,e=>{this._conditionDescriptions=Object.assign(Object.assign({},this._conditionDescriptions),e)}))}showDialog(e){var t,i,s;this._params=e,this._resetVariables();const a=(0,oe.II)(this.hass.states,this.hass.devices,this.hass.areas,e.type);if(this._openedFromQuery=!!a,a){const e=new URLSearchParams(p.G.location.search);e.delete(oe.Ku),e.delete(oe.jJ),e.delete(oe.yz),e.delete(oe.ve),p.G.history.replaceState(p.G.history.state,"",(0,y.Z)(e.toString()))}this.addKeyboardShortcuts(),this._loadConfigEntries(),this._unsubscribe(),this._fetchManifests(),this._calculateUsedDomains(),this._unsubscribeLabFeatures=(0,W.CO)(this.hass.connection,"automation","new_triggers_conditions",e=>{this._newTriggersAndConditions=e.enabled,this._tab=this._newTriggersAndConditions?"targets":"groups",a&&this._newTriggersAndConditions&&!this._selectedTarget&&(this._selectedTarget=a,this._getItemsByTarget())}),a||p.G.history.pushState({dialogData:{}},""),"action"===(null===(t=this._params)||void 0===t?void 0:t.type)?(this.hass.loadBackendTranslation("services"),(0,N.Yd)(this.hass.connection,this.hass.config)):"trigger"===(null===(i=this._params)||void 0===i?void 0:i.type)?(this.hass.loadBackendTranslation("triggers"),(0,N.Dl)(this.hass.connection,this.hass.config),this._subscribeDescriptions()):"condition"===(null===(s=this._params)||void 0===s?void 0:s.type)&&(this.hass.loadBackendTranslation("conditions"),(0,N.mX)(this.hass.connection,this.hass.config),this._subscribeDescriptions()),window.addEventListener("resize",this._updateNarrow),this._updateNarrow(),this._bottomSheetMode=this._narrow,a&&this._newTriggersAndConditions&&!this._selectedTarget&&(this._selectedTarget=a,this._tab="targets",this._getItemsByTarget())}closeDialog(e){var t;if(this._open&&e&&(this._selectedTarget||this._selectedGroup)){var i,s;if(null!==(i=e.dialogData)&&void 0!==i&&i.target)return this._selectedTarget=e.dialogData.target,this._getItemsByTarget(),this._tab="targets",!1;if(null!==(s=e.dialogData)&&void 0!==s&&s.group)return this._selectedCollectionIndex=e.dialogData.collectionIndex,this._selectedGroup=e.dialogData.group,this._tab="groups",!1;if(this._narrow)return this._selectedTarget=void 0,this._selectedGroup=void 0,!1}return this._closing=!0,null!==(t=p.G.history.state)&&void 0!==t&&t.dialogData?(this._open=!1,p.G.history.back(),!1):(this.removeKeyboardShortcuts(),this._unsubscribe(),this._params&&(0,u.r)(this,"dialog-closed",{dialog:this.localName}),this._params=void 0,this._resetVariables(),!0)}_resetVariables(){this._open=!0,this._closing=!1,this._selectedCollectionIndex=void 0,this._selectedGroup=void 0,this._selectedTarget=void 0,this._tab=this._newTriggersAndConditions?"targets":"groups",this._filter="",this._manifests=void 0,this._domains=void 0,this._bottomSheetMode=!1,this._narrow=!1,this._targetItems=void 0,this._loadItemsError=!1,this._openedFromQuery=!1}_calculateUsedDomains(){const e=new Set(Object.keys(this.hass.states).map(g.m));(0,$.b)(e,this._domains)||(this._domains=e)}get _systemDomains(){var e,t;if(!this._manifests)return;const i="trigger"===(null===(e=this._params)||void 0===e?void 0:e.type)?this._triggerDescriptions:this._conditionDescriptions;return this._calculateActiveSystemDomains(i,this._manifests,"trigger"===(null===(t=this._params)||void 0===t?void 0:t.type)?J.zz:G.ob)}async _loadConfigEntries(){const e=await(0,Z.VN)(this.hass);this._configEntryLookup=Object.fromEntries(e.map(e=>[e.entry_id,e]))}async _fetchManifests(){const e={},t=await(0,R.fK)(this.hass);for(const i of t)e[i.domain]=i;this._manifests=e,this._selectedTarget&&this._targetItems&&this._getItemsByTarget()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._updateNarrow),this._unsubscribe()}supportedShortcuts(){return{v:()=>this._addClipboard()}}_unsubscribe(){this._unsub&&(this._unsub.then(e=>e()),this._unsub=void 0),this._unsubscribeLabFeatures&&(this._unsubscribeLabFeatures.then(e=>e()),this._unsubscribeLabFeatures=void 0)}_getEmptyNote(e){if("trigger"===e||"condition"===e)return this.hass.localize(`ui.panel.config.automation.editor.${e}s.no_items_for_target_note`,{labs_link:(0,r.qy)(le||(le=Ze`<a href="/config/labs" @click="${0}">${0}</a>`),this._close,this.hass.localize("ui.panel.config.labs.caption"))})}render(){return this._params?this._bottomSheetMode?(0,r.qy)(ce||(ce=Ze` <ha-bottom-sheet .open="${0}" @closed="${0}" flexcontent> ${0} </ha-bottom-sheet> `),this._open,this._handleClosed,this._renderContent()):(0,r.qy)(he||(he=Ze` <ha-dialog width="large" .open="${0}" @closed="${0}" flexcontent> ${0} </ha-dialog> `),this._open,this._handleClosed,this._renderContent()):r.s6}_renderContent(){var e;const t=this._params.type,i=[{label:this.hass.localize("ui.panel.config.automation.editor.tabs.type"),value:"groups"}];this._newTriggersAndConditions&&i.unshift({label:this.hass.localize("ui.panel.config.automation.editor.tabs.target"),value:"targets"}),"trigger"!==(null===(e=this._params)||void 0===e?void 0:e.type)&&i.push({label:this.hass.localize("ui.panel.config.automation.editor.blocks"),value:"blocks"});const s=this._filter||"blocks"===this._tab||"targets"===this._tab||this._narrow&&this._selectedGroup,a=s?[]:this._getCollections(t,We[t].collections,this._domains,this.hass.localize,this.hass.services,this._triggerDescriptions,this._conditionDescriptions,this._manifests);return(0,r.qy)(de||(de=Ze` <div slot="header"> ${0} ${0} ${0} </div> <div class="${0}"> ${0} ${0} </div> `),this._renderHeader(),this._narrow&&(this._selectedGroup||this._selectedTarget)?r.s6:(0,r.qy)(ue||(ue=Ze` <ha-input-search appearance="outlined" ?autofocus="${0}" .value="${0}" @input="${0}"></ha-input-search> `),!this._narrow,this._filter,this._handleFilterInput),this._filter||!(i.length>1)||this._narrow&&(this._selectedGroup||this._selectedTarget)?r.s6:(0,r.qy)(pe||(pe=Ze`<ha-button-toggle-group variant="neutral" active-variant="brand" .buttons="${0}" .active="${0}" size="small" full-width @value-changed="${0}"></ha-button-toggle-group>`),i,this._tab,this._switchTab),(0,l.H)({content:!0,column:this._filter||this._narrow&&this._selectedTarget&&Object.values(this._selectedTarget)[0]&&!this._getAddFromTargetHidden(this._narrow,this._selectedTarget)}),this._filter?(0,r.qy)(ve||(ve=Ze`<ha-automation-add-search .hass="${0}" .filter="${0}" .configEntryLookup="${0}" .manifests="${0}" .narrow="${0}" .addElementType="${0}" .items="${0}" .convertToItem="${0}" .newTriggersAndConditions="${0}" @search-element-picked="${0}"> </ha-automation-add-search>`),this.hass,this._filter,this._configEntryLookup,this._manifests,this._narrow,this._params.type,this._items(t,this.hass.localize,this.hass.services,this._manifests),this._convertToItem,this._newTriggersAndConditions,this._searchItemSelected):"targets"===this._tab?(0,r.qy)(ge||(ge=Ze`<ha-automation-add-from-target .hass="${0}" .value="${0}" @value-changed="${0}" .narrow="${0}" class="${0}" .manifests="${0}"></ha-automation-add-from-target>`),this.hass,this._selectedTarget,this._handleTargetSelected,this._narrow,(0,l.H)({"ha-scrollbar":!0,hidden:!!this._getAddFromTargetHidden(this._narrow,this._selectedTarget)}),this._manifests):(0,r.qy)(_e||(_e=Ze` <ha-list-base class="${0}"> ${0} ${0} </ha-list-base> `),(0,l.H)({groups:!0,hidden:s,"ha-scrollbar":!0}),this._params.clipboardItem?(0,r.qy)(me||(me=Ze`<ha-list-item-button class="paste" @click="${0}"> <div slot="headline" class="label"> ${0} </div> <div slot="supporting-text"> ${0} </div> ${0} <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon><ha-svg-icon class="plus" slot="end" .path="${0}"></ha-svg-icon> </ha-list-item-button> <wa-divider></wa-divider>`),this._paste,this.hass.localize(`ui.panel.config.automation.editor.${t}s.paste`),this.hass.localize(`ui.panel.config.automation.editor.${t}s.type.${this._params.clipboardItem}.label`),this._narrow?r.s6:(0,r.qy)(fe||(fe=Ze`<span slot="end" class="shortcut"> <span>${0}</span> <span>+</span> <span>V</span> </span>`),ee.c?(0,r.qy)(be||(be=Ze`<ha-svg-icon slot="start" .path="${0}"></ha-svg-icon>`),Fe):this.hass.localize("ui.panel.config.automation.editor.ctrl")),Be,Re):r.s6,a.map(e=>(0,r.qy)(ye||(ye=Ze` ${0} ${0} `),e.titleKey&&e.groups.length?(0,r.qy)(we||(we=Ze`<ha-section-title> ${0} </ha-section-title>`),this.hass.localize(e.titleKey)):r.s6,(0,c.u)(e.groups,e=>e.key,t=>(0,r.qy)(Ce||(Ce=Ze` <ha-list-item-button .value="${0}" .index="${0}" @click="${0}" class="${0}"> <div slot="headline">${0}</div> ${0} ${0} </ha-list-item-button> `),t.key,e.collectionIndex,this._groupSelected,t.key===this._selectedGroup?"selected":"",t.name,t.icon?(0,r.qy)($e||($e=Ze`<span slot="start">${0}</span>`),t.icon):t.iconPath?(0,r.qy)(xe||(xe=Ze`<ha-svg-icon slot="start" .path="${0}"></ha-svg-icon>`),t.iconPath):r.s6,this._narrow?(0,r.qy)(Ae||(Ae=Ze`<ha-icon-next slot="end"></ha-icon-next>`)):r.s6))))),this._filter?r.s6:(0,r.qy)(He||(He=Ze` <ha-automation-add-items .hass="${0}" .items="${0}" .scrollable="${0}" .error="${0}" .selectLabel="${0}" .emptyLabel="${0}" .emptyNote="${0}" .tooltipDescription="${0}" .target="${0}" .getLabel="${0}" .configEntryLookup="${0}" class="${0}" @value-changed="${0}"> </ha-automation-add-items> `),this.hass,this._getItems(),!this._narrow,"targets"===this._tab&&this._loadItemsError?this.hass.localize("ui.panel.config.automation.editor.load_target_items_failed"):void 0,this.hass.localize("ui.panel.config.automation.editor."+("groups"===this._tab?`${t}s.select`:"select_target")),this.hass.localize(`ui.panel.config.automation.editor.${t}s.no_items_for_target`),this._getEmptyNote(t),"targets"===this._tab,"targets"===this._tab&&this._selectedTarget&&[...this._extractTypeAndIdFromTarget(this._selectedTarget),this._getSelectedTargetLabel(this._selectedTarget)]||void 0,this._getLabel,this._configEntryLookup,!this._narrow||this._selectedGroup||this._selectedTarget&&(!this._selectedTarget||Object.values(this._selectedTarget)[0])||"blocks"===this._tab?"":"hidden",this._selected))}_renderHeader(){const e=this._getDocumentationUrl(this._params.type);return(0,r.qy)(Le||(Le=Ze` <ha-dialog-header subtitle-position="above"> <span slot="title">${0}</span> ${0} ${0} ${0} </ha-dialog-header> `),this._getDialogTitle(),this._renderDialogSubtitle(),this._narrow&&(this._selectedGroup||this._selectedTarget)?r.s6:(0,r.qy)(Ve||(Ve=Ze` <ha-icon-button .path="${0}" .label="${0}" slot="actionItems" href="${0}" target="_blank" rel="noreferrer"></ha-icon-button> `),Ne,this.hass.localize(`ui.panel.config.automation.editor.${this._params.type}s.learn_more`),e),this._narrow&&(this._selectedGroup||this._selectedTarget)&&!this._openedFromQuery?(0,r.qy)(Me||(Me=Ze`<ha-icon-button-prev slot="navigationIcon" @click="${0}"></ha-icon-button-prev>`),this._back):(0,r.qy)(ke||(ke=Ze`<ha-icon-button .path="${0}" @click="${0}" slot="navigationIcon"></ha-icon-button>`),Pe,this._close))}_renderDialogSubtitle(){if(!this._narrow)return r.s6;if(this._selectedGroup)return(0,r.qy)(Se||(Se=Ze`<span slot="subtitle">${0}</span>`),this.hass.localize(`ui.panel.config.automation.editor.${this._params.type}s.add`));if(this._selectedTarget){let s;const[a,o]=this._extractTypeAndIdFromTarget(this._selectedTarget);if(o){if("area"===a){var e;const t=null===(e=this.hass.areas[o])||void 0===e?void 0:e.floor_id;s=t?(0,m.X)(this.hass.floors[t])||t:this.hass.localize("ui.panel.config.automation.editor.other_areas")}else if("device"===a){var t;const e=null===(t=this.hass.devices[o])||void 0===t?void 0:t.area_id;if(e)s=(0,v.A)(this.hass.areas[e])||e;else{const e=this.hass.devices[o];s=this.hass.localize("ui.panel.config.automation.editor."+("service"===(null==e?void 0:e.entry_type)?"services":"unassigned_devices"))}}else if("entity"===a&&this.hass.states[o]){const e=this.hass.entities[o];if(!e||e.device_id||e.area_id){const e=this.hass.states[o],[t,i,a]=(0,_.Cf)(e,[{type:"entity"},{type:"device"},{type:"area"}],this.hass.entities,this.hass.devices,this.hass.areas,this.hass.floors);s=[a,t?i:void 0].filter(Boolean).join((0,w.qC)(this.hass.language,this.hass.translationMetadata.translations)?" ◂ ":" ▸ ")}else{var i;const e=o.split(".",2)[0];s=(0,R.p$)(this.hass.localize,e,null===(i=this._manifests)||void 0===i?void 0:i[e])}}if(s)return(0,r.qy)(Ie||(Ie=Ze`<span slot="subtitle">${0}</span>`),s)}}return r.s6}_domainMatchesGroupType(e,t,i,s){var a,o,r,n,l;const c=(s.includes("dynamic")&&(!t||t.is_built_in)||s.includes("customDynamic")&&!(null===(a=null==t?void 0:t.is_built_in)||void 0===a||a))&&(Ke.has(e)||"entity"===(null==t?void 0:t.integration_type)&&!Ue.has(e)&&(i||null!==(o=null===(r=this._systemDomains)||void 0===r?void 0:r.active.has(e))&&void 0!==o&&o)||"system"===(null==t?void 0:t.integration_type)&&null!==(n=null===(l=this._systemDomains)||void 0===l?void 0:l.active.has(e))&&void 0!==n&&n),h=s.includes("helper")&&"helper"===(null==t?void 0:t.integration_type),d=s.includes("other")&&!Ke.has(e)&&(Ue.has(e)||!["helper","entity","system"].includes((null==t?void 0:t.integration_type)||""));return c||h||d}_getDomainType(e){var t,i,s,a,o,r,n;return Ke.has(e)||"entity"===(null===(t=this._manifests)||void 0===t||null===(t=t[e])||void 0===t?void 0:t.integration_type)&&!Ue.has(e)&&(null!==(i=this._domains)&&void 0!==i&&i.has(e)||null!==(s=null===(a=this._systemDomains)||void 0===a?void 0:a.active.has(e))&&void 0!==s&&s)?"dynamicGroups":"helper"===(null===(o=this._manifests)||void 0===o||null===(o=o[e])||void 0===o?void 0:o.integration_type)?"helpers":"system"===(null===(r=this._manifests)||void 0===r||null===(r=r[e])||void 0===r?void 0:r.integration_type)&&null!==(n=this._systemDomains)&&void 0!==n&&n.active.has(e)?"dynamicGroups":"other"}_sortDomainsByCollection(e,t){const i=[];return We[e].collections.forEach(e=>{i.push(...Object.keys(e.groups))}),t.sort((e,t)=>{const s=e[0],a=t[0];if(i.includes(s)&&i.includes(a))return i.indexOf(s)-i.indexOf(a);let o=s,r=a;return i.includes(s)||(o=this._getDomainType(s)),i.includes(a)||(r=this._getDomainType(a)),o===r?(0,b.xL)(e[1].title,t[1].title,this.hass.locale.language):i.indexOf(o)-i.indexOf(r)}).map(e=>e[1])}_getDomainGroupedListItems(e,t,i,s){var a,o;const r={},n=null===(a=this._selectedTarget)||void 0===a?void 0:a.entity_id,l=n&&"system"!==(null===(o=this._manifests)||void 0===o||null===(o=o[(0,g.m)(n)])||void 0===o?void 0:o.integration_type)?(0,g.m)(n):void 0;return t.forEach(t=>{var a;const o=i(t),n="system"===(null===(a=this._manifests)||void 0===a||null===(a=a[o])||void 0===a?void 0:a.integration_type)&&l?l:o;var c;r[n]||(r[n]={title:(0,R.p$)(e,n,null===(c=this._manifests)||void 0===c?void 0:c[n]),items:[]});r[n].items.push(s(e,o,t)),r[n].items.sort((e,t)=>(0,b.xL)(e.name,t.name,this.hass.locale.language))}),this._sortDomainsByCollection(this._params.type,Object.entries(r))}_getTriggerListItems(e,t){return t.map(t=>{const i=(0,J.zz)(t);return this._getTriggerListItem(e,i,t)}).sort((e,t)=>(0,b.xL)(e.name,t.name,this.hass.locale.language))}_getTriggerListItem(e,t,i){const s=(0,J.hN)(i);return{icon:(0,r.qy)(Oe||(Oe=Ze` <ha-trigger-icon .hass="${0}" .trigger="${0}"></ha-trigger-icon> `),this.hass,i),key:`${D.VH}${i}`,name:e(`component.${t}.triggers.${s}.name`)||i,description:e(`component.${t}.triggers.${s}.description`)||i}}_getConditionListItem(e,t,i){const s=(0,G.YQ)(i);return{icon:(0,r.qy)(Ee||(Ee=Ze` <ha-condition-icon .hass="${0}" .condition="${0}"></ha-condition-icon> `),this.hass,i),key:`${D.VH}${i}`,name:e(`component.${t}.conditions.${s}.name`)||i,description:e(`component.${t}.conditions.${s}.description`)||i}}_getDomainGroupedActionListItems(e,t){const i={};return t.forEach(t=>{var s,a;const[o,n]=t.split(".",2);var l;i[o]||(i[o]={title:(0,R.p$)(e,o,null===(l=this._manifests)||void 0===l?void 0:l[o]),items:[]});i[o].items.push({icon:(0,r.qy)(Te||(Te=Ze` <ha-service-icon .hass="${0}" .service="${0}"></ha-service-icon> `),this.hass,`${o}.${n}`),key:`${D.VH}${o}.${n}`,name:`${o?"":`${(0,R.p$)(e,o)}: `}${this.hass.localize(`component.${o}.services.${n}.name`)||(null===(s=this.hass.services[o][n])||void 0===s?void 0:s.name)||n}`,description:this.hass.localize(`component.${o}.services.${n}.description`)||(null===(a=this.hass.services[o][n])||void 0===a?void 0:a.description)||""}),i[o].items.sort((e,t)=>(0,b.xL)(e.name,t.name,this.hass.locale.language))}),this._sortDomainsByCollection(this._params.type,Object.entries(i))}_back(){p.G.history.back()}_groupSelected(e){const t=e.currentTarget;if(this._selectedGroup===t.value)return this._selectedGroup=void 0,void(this._selectedCollectionIndex=void 0);this._selectedGroup=t.value,this._selectedCollectionIndex=e.currentTarget.index,p.G.history.pushState({dialogData:{group:this._selectedGroup,collectionIndex:this._selectedCollectionIndex}},""),requestAnimationFrame(()=>{var e;null===(e=this._itemsListElement)||void 0===e||e.scrollTo(0,0)})}_paste(){this._params.add(oe.uV),this.closeDialog()}_selected(e){let t;"targets"===this._tab&&this._selectedTarget&&Object.values(this._selectedTarget)[0]&&(t=this._selectedTarget),this._params.add(e.detail.value,t),this.closeDialog()}_getDefaultStateItems(e){var t;const i=[this._convertToItem("state",{},e,this.hass.localize)],s=null===(t=this._selectedTarget)||void 0===t?void 0:t.entity_id;if(s){const t=["counter","input_number","number","sensor"],a=(0,g.m)(s),o=this.hass.states[s];(t.includes(a)||o&&(0,f.x)(o))&&i.push(this._convertToItem("numeric_state",{},e,this.hass.localize))}return i}async _getItemsByTarget(){if(this._selectedTarget)try{if("trigger"===this._params.type){const e=await(0,K.oV)(this.hass.callWS,this._selectedTarget),t=this._getDomainGroupedListItems(this.hass.localize,e,J.zz,(e,t,i)=>this._getTriggerListItem(e,t,i));return this._selectedTarget.entity_id&&t.push({title:this.hass.localize("ui.panel.config.automation.editor.triggers.groups.entity.label"),items:this._getDefaultStateItems("trigger")}),void(this._targetItems=t)}if("condition"===this._params.type){const e=await(0,K.vN)(this.hass.callWS,this._selectedTarget),t=this._getDomainGroupedListItems(this.hass.localize,e,G.ob,(e,t,i)=>this._getConditionListItem(e,t,i));return this._selectedTarget.entity_id&&t.push({title:this.hass.localize("ui.panel.config.automation.editor.conditions.groups.entity.label"),items:this._getDefaultStateItems("condition")}),void(this._targetItems=t)}if("action"===this._params.type){const e=(await(0,K.j_)(this.hass.callWS,this._selectedTarget)).filter(e=>!e.startsWith("homeassistant."));this._targetItems=this._getDomainGroupedActionListItems(this.hass.localize,e)}}catch(e){this._loadItemsError=!0,console.error(`Error fetching ${this._params.type}s for target`,e)}}_switchTab(e){this._tab=e.detail.value}_searchItemSelected(e){const t=e.detail;if(t.type&&!["floor","area"].includes(t.type))return this._params.add(t.id),void this.closeDialog();const i=(0,K.OJ)(t);this._filter="",this._selectedTarget={[`${i}_id`]:t.id.split(K.G_,2)[1]},this._tab="targets"}_handleClosed(){this._closing||this.closeDialog()}_getDialogTitle(){var e;if(this._narrow&&this._selectedGroup)return(0,D.Q)(this._selectedGroup)?(0,R.p$)(this.hass.localize,(0,D.Dt)(this._selectedGroup),null===(e=this._manifests)||void 0===e?void 0:e[(0,D.Dt)(this._selectedGroup)]):this.hass.localize(`ui.panel.config.automation.editor.${this._params.type}s.groups.${this._selectedGroup}.label`)||this.hass.localize(`ui.panel.config.automation.editor.${this._params.type}s.type.${this._selectedGroup}.label`);if(this._narrow&&this._selectedTarget){const e=this._getSelectedTargetLabel(this._selectedTarget);if(e)return e}return this.hass.localize(`ui.panel.config.automation.editor.${this._params.type}s.add`)}static get styles(){return[Y.dp,(0,r.AH)(je||(je=Ze`ha-bottom-sheet{--ha-bottom-sheet-height:90vh;--ha-bottom-sheet-height:calc(100dvh - var(--ha-space-12));--ha-bottom-sheet-max-height:var(--ha-bottom-sheet-height);--ha-bottom-sheet-max-width:888px;--ha-bottom-sheet-padding:0;--ha-bottom-sheet-surface-background:var(--card-background-color)}ha-dialog{--dialog-content-padding:0;--ha-dialog-min-height:min(
920px,
calc(
100vh - max(
var(--safe-area-inset-bottom),
var(--ha-space-4)
) - max(var(--safe-area-inset-top), var(--ha-space-4))
)
);--ha-dialog-min-height:min(
920px,
calc(
100dvh - max(
var(--safe-area-inset-bottom),
var(--ha-space-4)
) - max(var(--safe-area-inset-top), var(--ha-space-4))
)
);--ha-dialog-max-height:var(--ha-dialog-min-height)}ha-dialog ha-icon-button[slot=actionItems]{color:var(--secondary-text-color)}ha-input-search{display:block;--ha-input-padding-bottom:0;margin:0 var(--ha-space-4)}ha-button-toggle-group{--ha-button-toggle-group-padding:var(--ha-space-3) var(--ha-space-4) 0}.content{flex:1;min-height:0;height:100%;display:flex}.content.column{flex-direction:column;gap:var(--ha-space-3)}ha-list-item-button{--ha-row-item-padding-block:var(--ha-space-1);--ha-row-item-padding-inline:var(--ha-space-3);--ha-row-item-min-height:40px}ha-list-item-button::part(end),ha-list-item-button::part(start){color:var(--ha-color-on-neutral-quiet)}.groups,ha-automation-add-from-target{border-radius:var(--ha-border-radius-xl);border:1px solid var(--ha-color-border-neutral-quiet);margin:var(--ha-space-3)}.groups,ha-automation-add-from-target{overflow:auto;flex:4;margin-inline-end:0}ha-automation-add-from-target.hidden{display:none}.groups{--md-list-item-leading-space:var(--ha-space-3);--md-list-item-trailing-space:var(--md-list-item-leading-space);--md-list-item-bottom-space:var(--ha-space-1);--md-list-item-top-space:var(--md-list-item-bottom-space);--md-list-item-supporting-text-font:var(--ha-font-family-body);--md-list-item-one-line-container-height:var(--ha-space-10)}ha-bottom-sheet .groups,ha-bottom-sheet ha-automation-add-from-target{margin:var(--ha-space-3)}.groups .selected{background-color:var(--ha-color-fill-primary-normal-active);--md-list-item-label-text-color:var(--ha-color-on-primary-normal);--icon-primary-color:var(--ha-color-on-primary-normal)}.groups .selected ha-svg-icon{color:var(--ha-color-on-primary-normal)}ha-section-title{top:0;position:sticky;z-index:1}ha-automation-add-items{flex:6}.content.column ha-automation-add-from-target,.content.column ha-automation-add-items{flex:none}.content.column ha-automation-add-items{min-height:160px}.content.column ha-automation-add-from-target{overflow:clip}ha-dialog ha-automation-add-items{margin-top:var(--ha-space-3)}ha-bottom-sheet .groups{padding-bottom:max(var(--safe-area-inset-bottom),var(--ha-space-4))}.groups.hidden,ha-automation-add-items.hidden{display:none}.groups{padding-bottom:max(var(--safe-area-inset-bottom),var(--ha-space-3))}ha-icon-next{width:var(--ha-space-6)}wa-divider{--spacing:0}ha-svg-icon.plus{color:var(--primary-color)}.shortcut{--mdc-icon-size:var(--ha-space-3);display:inline-flex;flex-direction:row;align-items:center;gap:2px;margin-right:var(--ha-space-4)}.shortcut span{font-size:var(--ha-font-size-s);font-family:var(--ha-font-family-code);color:var(--ha-color-text-secondary)}.section-title-wrapper{height:0;position:relative}.section-title-wrapper ha-section-title{position:absolute;top:0;width:calc(100% - var(--ha-space-4));z-index:1}ha-automation-add-search{flex:1}`))]}constructor(...e){super(...e),this._open=!0,this._tab="targets",this._filter="",this._bottomSheetMode=!1,this._narrow=!1,this._triggerDescriptions={},this._loadItemsError=!1,this._newTriggersAndConditions=!1,this._openedFromQuery=!1,this._conditionDescriptions={},this._configEntryLookup={},this._closing=!1,this._updateNarrow=()=>{this._narrow=window.matchMedia("(max-width: 870px)").matches||window.matchMedia("(max-height: 500px)").matches},this._calculateActiveSystemDomains=(0,h.A)((e,t,i)=>{const s=new Set,a={},o={};for(const[h,u]of Object.entries(e)){var r,n;const e=i(h),s=null===(r=t[e])||void 0===r?void 0:r.integration_type;if("system"!==s&&"entity"!==s)continue;if("entity"===s&&Object.keys(this.hass.states).some(t=>(0,g.m)(t)===e))continue;a[e]||(a[e]=[],o[e]=new Set);const c=(0,d.e)(null===(n=u.target)||void 0===n?void 0:n.entity);if(c)for(const t of c){const i=(0,d.e)(t);a[e].push(...i);for(const t of i)for(const i of null!==(l=(0,d.e)(t.domain))&&void 0!==l?l:[]){var l;o[e].add(i)}}}for(const h of Object.values(this.hass.states))for(const[e,t]of Object.entries(a))s.has(e)||t.some(e=>(0,U.Ru)(e,h))&&s.add(e);const c=new Map;for(const[h,d]of Object.entries(o))for(const e of d)c.has(e)||c.set(e,new Set),c.get(e).add(h);return{active:s,byEntityDomain:c}}),this._getItems=()=>{var e,t;return this._filter||"blocks"!==this._tab?!this._filter&&"groups"===this._tab&&this._selectedGroup?[{title:this.hass.localize(`ui.panel.config.automation.editor.${this._params.type}s.name`),items:this._getGroupItems(this._params.type,this._selectedGroup,null!==(e=this._selectedCollectionIndex)&&void 0!==e?e:0,this._domains,this.hass.localize,this.hass.services,this._manifests,null===(t=this._systemDomains)||void 0===t?void 0:t.byEntityDomain)}]:!this._filter&&"targets"===this._tab&&this._selectedTarget&&this._targetItems?this._targetItems:void 0:[{title:this.hass.localize("ui.panel.config.automation.editor.blocks"),items:this._getBlockItems(this._params.type,this.hass.localize)}]},this._getGroups=(e,t,i)=>{if(t&&void 0!==i){var s,a,o;const r=null!==(s=null===(a=We[e].collections[i])||void 0===a?void 0:a.groups[t])&&void 0!==s?s:null===(o=We[e].collections.find(e=>t in e.groups))||void 0===o?void 0:o.groups[t];return(null==r?void 0:r.members)||{[t]:r||{}}}return We[e].collections.reduce((e,t)=>Object.assign(Object.assign({},e),t.groups),{})},this._items=(0,h.A)((e,t,i,s)=>{const a=this._getGroups(e),o=i=>Object.entries(i).map(([i,s])=>s.members?o(s.members):this._convertToItem(i,s,e,t)),r=o(a).flat();return"trigger"===e?r.push(...this._triggers(t,this._triggerDescriptions,void 0)):"condition"===e?r.push(...this._conditions(t,this._conditionDescriptions,s,void 0)):"action"===e&&r.push(...this._services(t,i,s)),r.filter(({name:e})=>e)}),this._getCollections=(0,h.A)((e,t,i,s,a,o,r,n)=>{const l=[];let c=-1,h=-1;if(t.forEach((t,d)=>{let u=Object.entries(t.groups);const p=[],v=[];t.groups.dynamicGroups&&v.push("dynamic"),t.groups.helpers&&v.push("helper"),t.groups.other&&v.push("other"),t.groups.customDynamicGroups&&v.push("customDynamic"),"trigger"===e&&Object.keys(t.groups).some(e=>Je.includes(e))?(p.push(...this._triggerGroups(s,o,n,i,v)),u=u.filter(([e])=>!Je.includes(e))):"condition"===e&&Object.keys(t.groups).some(e=>Je.includes(e))?(p.push(...this._conditionGroups(s,r,n,i,v)),u=u.filter(([e])=>!Je.includes(e))):"action"===e&&Object.keys(t.groups).some(e=>Je.includes(e))&&(p.push(...this._serviceGroups(s,a,n,i,t.groups.dynamicGroups?void 0:t.groups.helpers?"helper":"other")),u=u.filter(([e])=>!Je.includes(e))),p.push(...u.map(([t,i])=>this._convertToItem(t,i,e,s))),p.length&&(t.generic&&(c=d),t.groups.dynamicGroups&&(h=d),l.push({collectionIndex:d,titleKey:t.titleKey,generic:t.generic,groups:p.sort((e,t)=>(0,b.xL)(e.name,t.name,this.hass.locale.language))}))}),-1!==c&&-1!==h){const e=l[h].groups.filter(e=>Qe.has(e.key))||[];l[h].groups=l[h].groups.filter(e=>!Qe.has(e.key))||[],l[c].groups=[...l[c].groups||[],...e].sort((e,t)=>(0,b.xL)(e.name,t.name,this.hass.locale.language))}return l}),this._getBlockItems=(0,h.A)((e,t)=>{const i="action"===e?z.bM:G.oW;return Object.entries(i).map(([i,s])=>this._convertToItem(i,s,e,t)).sort((e,t)=>(0,b.xL)(e.name,t.name,this.hass.locale.language))}),this._getGroupItems=(0,h.A)((e,t,i,s,a,o,r,n)=>{if("trigger"===e&&(0,D.Q)(t))return this._triggers(a,this._triggerDescriptions,n,t);if("condition"===e&&(0,D.Q)(t))return this._conditions(a,this._conditionDescriptions,r,n,t);if("action"===e&&(0,D.Q)(t))return this._services(a,o,r,t);const l=this._getGroups(e,t,i),c=Object.entries(l).map(([t,i])=>this._convertToItem(t,i,e,a));return"action"===e&&(this._selectedGroup?"helpers"===this._selectedGroup?c.unshift(...this._serviceGroups(a,o,r,s,"helper")):"other"===this._selectedGroup&&c.unshift(...this._serviceGroups(a,o,r,s,"other")):c.unshift(...this._serviceGroups(a,o,r,s,void 0))),c.sort((e,t)=>(0,b.xL)(e.name,t.name,this.hass.locale.language))}),this._serviceGroups=(e,t,i,s,a)=>{if(!t||!i)return[];const o=[];return Object.keys(t).forEach(t=>{const n=i[t],l=!s||s.has(t);(void 0===a&&(Ke.has(t)||"entity"===(null==n?void 0:n.integration_type)&&l&&!Ue.has(t))||"helper"===a&&"helper"===(null==n?void 0:n.integration_type)||"other"===a&&!Ke.has(t)&&(Ue.has(t)||!l&&"entity"===(null==n?void 0:n.integration_type)||!["helper","entity"].includes((null==n?void 0:n.integration_type)||"")))&&o.push({icon:(0,r.qy)(ze||(ze=Ze` <ha-domain-icon .domain="${0}" brand-fallback></ha-domain-icon> `),t),key:`${D.VH}${t}`,name:(0,R.p$)(e,t,n),description:""})}),o.sort((e,t)=>(0,b.xL)(e.name,t.name,this.hass.locale.language))},this._triggerGroups=(e,t,i,s,a)=>{if(!t||!i)return[];const o=[],n=new Set;return Object.keys(t).forEach(t=>{const l=(0,J.zz)(t);if(n.has(l))return;n.add(l);const c=i[l],h=!s||s.has(l);this._domainMatchesGroupType(l,c,h,a)&&o.push({icon:(0,r.qy)(qe||(qe=Ze` <ha-domain-icon .domain="${0}" brand-fallback></ha-domain-icon> `),l),key:`${D.VH}${l}`,name:(0,R.p$)(e,l,c),description:""})}),o.sort((e,t)=>(0,b.xL)(e.name,t.name,this.hass.locale.language))},this._triggers=(0,h.A)((e,t,i,s)=>{if(!t)return[];const a=s&&(0,D.Q)(s)?(0,D.Dt)(s):void 0,o=a?null==i?void 0:i.get(a):void 0;return this._getTriggerListItems(e,Object.keys(t).filter(e=>{var t;const i=(0,J.zz)(e);return!s||s===`${D.VH}${i}`||null!==(t=null==o?void 0:o.has(i))&&void 0!==t&&t}))}),this._conditionGroups=(e,t,i,s,a)=>{if(!t||!i)return[];const o=[],n=new Set;return Object.keys(t).forEach(t=>{const l=(0,G.ob)(t);if(n.has(l))return;n.add(l);const c=i[l],h=!s||s.has(l);this._domainMatchesGroupType(l,c,h,a)&&o.push({icon:(0,r.qy)(De||(De=Ze` <ha-domain-icon .domain="${0}" brand-fallback></ha-domain-icon> `),l),key:`${D.VH}${l}`,name:(0,R.p$)(e,l,c),description:""})}),o.sort((e,t)=>(0,b.xL)(e.name,t.name,this.hass.locale.language))},this._conditions=(0,h.A)((e,t,i,s,a)=>{if(!t)return[];const o=[],r=a&&(0,D.Q)(a)?(0,D.Dt)(a):void 0,n=r?null==s?void 0:s.get(r):void 0;for(const c of Object.keys(t)){var l;const t=(0,G.ob)(c);(!a||a===`${D.VH}${t}`||null!==(l=null==n?void 0:n.has(t))&&void 0!==l&&l)&&o.push(this._getConditionListItem(e,t,c))}return o}),this._services=(0,h.A)((e,t,i,s)=>{if(!t)return[];const a=[];let o;(0,D.Q)(s)&&(o=(0,D.Dt)(s));const n=s=>{const o=Object.keys(t[s]),n=null==i?void 0:i[s],l=!n||"entity"!==n.integration_type||!n.is_built_in;for(const i of o){var c,h;const o=e(`component.${s}.services.${i}.name`,this.hass.services[s][i].description_placeholders)||(null===(c=t[s][i])||void 0===c?void 0:c.name)||i;a.push({icon:(0,r.qy)(Ge||(Ge=Ze` <ha-service-icon .hass="${0}" .service="${0}"></ha-service-icon> `),this.hass,`${s}.${i}`),key:`${D.VH}${s}.${i}`,name:l?`${(0,R.p$)(e,s)}: ${o}`:o,description:e(`component.${s}.services.${i}.description`,this.hass.services[s][i].description_placeholders)||(null===(h=t[s][i])||void 0===h?void 0:h.description)||""})}};return o?(n(o),a.sort((e,t)=>(0,b.xL)(e.name,t.name,this.hass.locale.language))):s&&!["helpers","other"].includes(s)?[]:(Object.keys(t).sort().forEach(e=>{const t=null==i?void 0:i[e];"helpers"===s&&"helper"!==(null==t?void 0:t.integration_type)||"other"===s&&(Ue.has(e)||["helper","entity"].includes((null==t?void 0:t.integration_type)||""))||n(e)}),a)}),this._getLabel=(0,h.A)(e=>{var t;return null===(t=this._labelRegistry)||void 0===t?void 0:t.find(({label_id:t})=>t===e)}),this._getFloorAreaLookupMemoized=(0,h.A)(e=>(0,B._o)(Object.values(e))),this._getAreaDeviceLookupMemoized=(0,h.A)(e=>(0,q.QI)(Object.values(e))),this._getAreaEntityLookupMemoized=(0,h.A)(e=>(0,q.bQ)(Object.values(e))),this._getDeviceEntityLookupMemoized=(0,h.A)(e=>(0,P.I3)(Object.values(e))),this._extractTypeAndIdFromTarget=(0,h.A)(e=>{const[t,i]=Object.entries(e)[0];return[t.replace("_id",""),i]}),this._convertToItem=(e,t,i,s)=>({key:e,name:s(`ui.panel.config.automation.editor.${i}s.${t.members?"groups":"type"}.${e}.label`),description:s(`ui.panel.config.automation.editor.${i}s.${t.members?"groups":"type"}.${e}.description${t.members?"":".picker"}`),iconPath:t.icon||We[i].icons[e]}),this._close=()=>{this._open=!1},this._getDocumentationUrl=(0,h.A)(e=>(0,X.o)(this.hass,"trigger"===e?"/docs/automation/trigger/":"condition"===e?"/docs/automation/condition/":"/docs/automation/action/")),this._handleTargetSelected=e=>{this._targetItems=void 0,this._loadItemsError=!1,this._selectedTarget=e.detail.value,p.G.history.pushState({dialogData:{target:this._selectedTarget}},""),requestAnimationFrame(()=>{var e,t;this._narrow?null===(e=this._contentElement)||void 0===e||e.scrollTo(0,0):null===(t=this._itemsListElement)||void 0===t||t.scrollTo(0,0)}),this._getItemsByTarget()},this._handleFilterInput=e=>{var t;this._debounceFilterChanged(null!==(t=e.target.value)&&void 0!==t?t:"")},this._debounceFilterChanged=(0,C.s)(e=>{this._filter=e},200),this._addClipboard=()=>{var e;null!==(e=this._params)&&void 0!==e&&e.clipboardItem&&(this._params.add(oe.uV),(0,te.P)(this,Object.assign({message:this.hass.localize("ui.panel.config.automation.editor.item_pasted",{item:this.hass.localize(`ui.panel.config.automation.editor.${this._params.type}s.type.${this._params.clipboardItem}.label`)}),dismissable:!0},null!=this._params.clipboardPasteToastBottomOffset?{bottomOffset:this._params.clipboardPasteToastBottomOffset}:{})),this.closeDialog())},this._getSelectedTargetLabel=(0,h.A)(e=>{const[t,i]=this._extractTypeAndIdFromTarget(e);if(void 0===i&&"floor"===t)return this.hass.localize("ui.panel.config.automation.editor.other_areas");if(void 0===i&&"area"===t)return this.hass.localize("ui.panel.config.automation.editor.unassigned_devices");if(void 0===i&&"service"===t)return this.hass.localize("ui.panel.config.automation.editor.services");if(void 0===i&&"device"===t)return this.hass.localize("ui.panel.config.automation.editor.unassigned_entities");if(void 0===i&&"helper"===t)return this.hass.localize("ui.panel.config.automation.editor.helpers");if(void 0===i&&(t.startsWith("entity_")||t.startsWith("helper_"))){var s;const e=t.substring(7);return(0,R.p$)(this.hass.localize,e,null===(s=this._manifests)||void 0===s?void 0:s[e])}return i?(0,re.N)({entities:this.hass.entities,devices:this.hass.devices,areas:this.hass.areas,floors:this.hass.floors},this.hass.states,this.hass.localize,t,i,this._getLabel):void 0}),this._getAddFromTargetHidden=(0,h.A)((e,t)=>{if(e&&t){var i,s,a,o;const[e,r]=this._extractTypeAndIdFromTarget(t);if(r&&("floor"===e&&!((null===(i=this._getFloorAreaLookupMemoized(this.hass.areas)[r])||void 0===i?void 0:i.length)>0)||"area"===e&&!((null===(s=this._getAreaDeviceLookupMemoized(this.hass.devices)[r])||void 0===s?void 0:s.length)>0)&&!((null===(a=this._getAreaEntityLookupMemoized(this.hass.entities)[r])||void 0===a?void 0:a.length)>0)||"device"===e&&!((null===(o=this._getDeviceEntityLookupMemoized(this.hass.entities)[r])||void 0===o?void 0:o.length)>0)||"entity"===e||"label"===e))return"hidden"}return""})}}(0,a.Cg)([(0,n.MZ)({attribute:!1})],Ye.prototype,"hass",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_open",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_params",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_selectedCollectionIndex",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_selectedGroup",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_selectedTarget",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_tab",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_filter",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_manifests",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_domains",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_bottomSheetMode",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_narrow",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_triggerDescriptions",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_targetItems",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_loadItemsError",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_newTriggersAndConditions",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_openedFromQuery",void 0),(0,a.Cg)([(0,n.wk)()],Ye.prototype,"_conditionDescriptions",void 0),(0,a.Cg)([(0,n.wk)(),(0,o.Fg)({context:F.HD,subscribe:!0})],Ye.prototype,"_labelRegistry",void 0),(0,a.Cg)([(0,n.P)("ha-automation-add-items")],Ye.prototype,"_itemsListElement",void 0),(0,a.Cg)([(0,n.P)(".content")],Ye.prototype,"_contentElement",void 0),Ye=(0,a.Cg)([(0,n.EM)("add-automation-element-dialog")],Ye),s()}catch(le){s(le)}})},70897:function(e,t,i){i.a(e,async function(e,t){try{i(44114),i(26910),i(18111),i(22489),i(7588),i(61701),i(53921),i(3362),i(27495),i(25440),i(62953);var s=i(40445),a=i(99222),o=i(73984),r=i(35211),n=i(5124),l=i(67576),c=i(63672),h=i(22786),d=i(1087),u=i(65522),p=i(37981),v=i(74705),g=i(52220),_=(i(18198),i(47680),i(43661),i(69464),i(93367)),m=(i(67094),i(1671),i(83892),i(50723),i(53641)),f=i(28223),b=i(77423),y=i(22792),w=i(58594),C=i(95350),$=i(5904),x=i(88555),A=i(44144),H=e([a,o,_]);[a,o,_]=H.then?(await H)():H;let L,V,M,k,S,I,O,E,T,j,z,q,D,G,Z,F,P,B,N,R,W,U,K,J,Q,Y,X,ee,te,ie,se,ae=e=>e;const oe="M20 2H4C2.9 2 2 2.9 2 4V20C2 21.11 2.9 22 4 22H20C21.11 22 22 21.11 22 20V4C22 2.9 21.11 2 20 2M4 6L6 4H10.9L4 10.9V6M4 13.7L13.7 4H18.6L4 18.6V13.7M20 18L18 20H13.1L20 13.1V18M20 10.3L10.3 20H5.4L20 5.4V10.3Z";class re extends n.WF{willUpdate(e){super.willUpdate(e),this.hasUpdated||this._initialDataLoad(),(e.has("value")||e.has("narrow"))&&(this._fullHeight=!this.narrow||!this.value||!Object.values(this.value)[0],this.style.setProperty("--max-height",this._fullHeight?"none":"50%"))}updated(e){(e.has("value")||e.has("narrow")||void 0===this._showShowMoreButton)&&this._setShowTargetShowMoreButton()}async _initialDataLoad(){await this._loadConfigEntries(),this._getTreeData()}async _setShowTargetShowMoreButton(){await this.updateComplete,this._showShowMoreButton=this.narrow&&this.value&&!!Object.values(this.value)[0]&&this.scrollHeight>this.clientHeight}render(){return this.manifests&&this._configEntryLookup?(0,n.qy)(L||(L=ae` ${0} ${0} `),this.narrow&&this.value?this._renderNarrow(this._entries,this.value):(0,n.qy)(V||(V=ae` ${0} ${0} ${0} `),this._renderFloors(this.narrow,this._entries,this.value),this._renderUnassigned(this.narrow,this._entries,this.value),this._renderLabels(this.narrow,this.value)),this.narrow&&this._showShowMoreButton&&!this._fullHeight?(0,n.qy)(M||(M=ae` <div class="targets-show-more"> <ha-button appearance="filled" @click="${0}"> ${0} </ha-button> </div> `),this._expandHeight,this._i18n.localize("ui.panel.config.automation.editor.show_more")):n.s6):n.s6}_renderAreas(e){const t=Object.keys(e).filter(e=>{const[,t]=e.split(x.G_,2);return this._registries.areas[t]}).map(e=>{const[,t]=e.split(x.G_,2),i=this._registries.areas[t];return[e,(0,u.A)(i)||i.area_id,i.floor_id||void 0,i.icon]}).map(([e,t,i,s])=>{const{open:a,devices:o,entities:r}=this._entries[`floor${x.G_}${i||""}`].areas[e],l=Object.keys(o).length,c=l+r.length;return this._renderItem(t,e,!1,this._getSelectedTargetId(this.value)===e,!a&&!!c,a,this._renderAreaIcon(s),a?(0,n.qy)(k||(k=ae` ${0} ${0} `),l?this._renderDevices(o):n.s6,r.length?this._renderEntities(r):n.s6):void 0)});return this.narrow?(0,n.qy)(S||(S=ae`<ha-section-title>${0}</ha-section-title> <ha-list-base>${0}</ha-list-base>`),this._i18n.localize("ui.components.target-picker.type.areas"),t):t}_renderDevices(e){const t=Object.keys(e).filter(e=>this._registries.devices[e]).map(e=>{var t;const i=this._registries.devices[e],s=i.primary_config_entry?null===(t=this._configEntryLookup)||void 0===t?void 0:t[i.primary_config_entry]:void 0,a=null==s?void 0:s.domain;return[e,(0,p.xn)(i)||e,a]}).sort(([,e="zzz"],[,t="zzz"])=>(0,g.xL)(e,t,this.hass.locale.language)).map(([t,i,s])=>{const{open:a,entities:o}=e[t];return this._renderItem(i||t,`device${x.G_}${t}`,!1,this._getSelectedTargetId(this.value)===`device${x.G_}${t}`,!a&&!!o.length,a,s?this._renderDomainIcon(s):void 0,a?this._renderEntities(o):void 0)});return this.narrow?(0,n.qy)(I||(I=ae`<ha-section-title>${0}</ha-section-title> <ha-list-base>${0}</ha-list-base>`),this._i18n.localize("ui.components.target-picker.type.devices"),t):t}_renderDomains(e,t){const i=Object.keys(e).map(e=>{const i=e.substring(t.length,e.length-x.G_.length);return[e,(0,C.p$)(this._i18n.localize,i,this.manifests[i]),i]}).sort(([,e="zzz"],[,t="zzz"])=>(0,g.xL)(e,t,this.hass.locale.language)).map(([t,i,s])=>{const{open:a,entities:o}=e[t];return this._renderItem(i,t,!0,!1,!a&&!!o.length,a,this._renderDomainIcon(s),a?this._renderEntities(o):void 0)});return this.narrow?(0,n.qy)(O||(O=ae`<ha-section-title>${0}</ha-section-title> <ha-list-base>${0}</ha-list-base>`),this._i18n.localize("ui.components.target-picker.type.devices"),i):i}_renderEntities(e=[]){if(!e.length)return n.s6;const t=e.filter(e=>this.states[e]).map(e=>{var t;const i=this.states[e],[s,a]=(0,v.Cf)(i,[{type:"entity"},{type:"device"},{type:"area"}],this._registries.entities,this._registries.devices,this._registries.areas,this._registries.floors);let o=s||a||e;return null!==(t=this._registries.entities[e])&&void 0!==t&&t.hidden&&(o+=` (${this._i18n.localize("ui.panel.config.automation.editor.entity_hidden")})`),[e,o,i]}).sort(([,e],[,t])=>(0,g.xL)(e,t,this.hass.locale.language)).map(([e,t,i])=>this._renderItem(t,`entity${x.G_}${e}`,!1,this._getSelectedTargetId(this.value)===`entity${x.G_}${e}`,!1,!1,this._renderEntityIcon(i)));return this.narrow?(0,n.qy)(E||(E=ae`<ha-section-title>${0}</ha-section-title> <ha-list-base>${0}</ha-list-base>`),this._i18n.localize("ui.components.target-picker.type.entities"),t):t}_renderItem(e,t,i=!1,s=!1,a=!1,o=!1,r,l){return this.narrow?(0,n.qy)(T||(T=ae`<ha-list-item-button .target="${0}" @click="${0}"> ${0} <div slot="headline">${0}</div> <ha-icon-next slot="end"></ha-icon-next> </ha-list-item-button>`),t,this._selectItem,null==r?void 0:r("start"),e):(0,n.qy)(j||(j=ae` <wa-tree-item .preventSelection="${0}" .target="${0}" .selected="${0}" .lazy="${0}" @wa-lazy-load="${0}" @wa-collapse="${0}" .expanded="${0}" .title="${0}"> ${0} ${0} ${0} </wa-tree-item> `),i,t,s,a,this._expandItem,this._collapseItem,o,e,null==r?void 0:r(),e,l||n.s6)}_getTreeData(){this._floorAreas=(0,f.g3)(this.states,this._registries.floors,this._registries.areas,this._registries.devices,this._registries.entities,this._formatId,void 0,void 0,void 0,void 0,void 0,void 0,void 0);const e=this._floorAreas.filter(({id:e,areas:t})=>void 0!==e&&t.length);this._floorAreas.forEach(t=>{this._entries[t.id||`floor${x.G_}`]={open:1===e.length&&e[0].id===t.id,areas:{}},t.areas.forEach(e=>{this._entries[t.id||`floor${x.G_}`].areas[e.id]=this._loadArea(e)})}),this._loadUnassignedDevices(),this._loadUnassignedEntities(),this._entries=Object.assign({},this._entries),this.value&&this._valueChanged(this._getSelectedTargetId(this.value),!this.narrow)}_loadUnassignedDevices(){const e=Object.values(this._registries.devices).filter(e=>!e.area_id),t={},i={};e.forEach(({id:e,entry_type:s})=>{var a;const o=this._registries.devices[e];if(!o||o.disabled_by)return;const r={open:!1,entities:(null===(a=this._getDeviceEntityLookupMemoized(this._registries.entities)[e])||void 0===a?void 0:a.map(e=>e.entity_id))||[]};"service"!==s?t[e]=r:i[e]=r}),Object.keys(t).length&&(this._entries=Object.assign(Object.assign({},this._entries),{},{[`area${x.G_}`]:{open:!1,devices:t}})),Object.keys(i).length&&(this._entries=Object.assign(Object.assign({},this._entries),{},{[`service${x.G_}`]:{open:!1,devices:i}}))}_loadUnassignedEntities(){Object.values(this._registries.entities).filter(e=>!e.area_id&&!e.device_id).forEach(({entity_id:e})=>{const t=e.split(".",2)[0],i=this.manifests?this.manifests[t]:void 0;if("helper"===(null==i?void 0:i.integration_type))return this._entries[`helper${x.G_}`]||(this._entries[`helper${x.G_}`]={open:!1,devices:{}}),this._entries[`helper${x.G_}`].devices[`helper_${t}${x.G_}`]||(this._entries[`helper${x.G_}`].devices[`helper_${t}${x.G_}`]={open:!1,entities:[]}),void this._entries[`helper${x.G_}`].devices[`helper_${t}${x.G_}`].entities.push(e);this._entries[`device${x.G_}`]||(this._entries[`device${x.G_}`]={open:!1,devices:{}}),this._entries[`device${x.G_}`].devices[`entity_${t}${x.G_}`]||(this._entries[`device${x.G_}`].devices[`entity_${t}${x.G_}`]={open:!1,entities:[]}),this._entries[`device${x.G_}`].devices[`entity_${t}${x.G_}`].entities.push(e)})}_loadArea(e){const[,t]=e.id.split(x.G_,2),i=this._getAreaDeviceLookupMemoized(this._registries.devices)[t]||[],s=this._getAreaEntityLookupMemoized(this._registries.entities)[t]||[],a={};i.forEach(({id:e})=>{var t;const i=this._registries.devices[e];i&&!i.disabled_by&&(a[e]={open:!1,entities:(null===(t=this._getDeviceEntityLookupMemoized(this._registries.entities)[e])||void 0===t?void 0:t.map(e=>e.entity_id))||[]})});const o=[];return s.forEach(e=>{e.device_id&&a[e.device_id]||o.push(e.entity_id)}),{open:!1,devices:a,entities:o}}_expandTreeToItem(e,t){if("floor"!==e&&"label"!==e){if("entity"===e){var i,s;const e=null===(i=this._registries.entities[t])||void 0===i?void 0:i.device_id,r=e?this._registries.devices[e]:void 0,n=e&&(null==r?void 0:r.area_id)||void 0;if(!n){let i,s;const n=this._registries.entities[t];var a;if(!e&&n.area_id)i=`floor${x.G_}${(null===(a=this._registries.areas[n.area_id])||void 0===a?void 0:a.floor_id)||""}`,s=`area${x.G_}${n.area_id}`;else if(e)i=`${"service"===r.entry_type?"service":"area"}${x.G_}`,s=e;else{var o;const e=t.split(".",1)[0],a="helper"===(null===(o=this.manifests[e])||void 0===o?void 0:o.integration_type);i=a?`helper${x.G_}`:`device${x.G_}`,s=`${a?"helper_":"entity_"}${e}${x.G_}`}return void(this._entries=Object.assign(Object.assign({},this._entries),{},{[i]:Object.assign(Object.assign({},this._entries[i]),{},{open:!0,devices:Object.assign(Object.assign({},this._entries[i].devices),{},{[s]:Object.assign(Object.assign({},this._entries[i].devices[s]),{},{open:!0})})})}))}const l=`floor${x.G_}${(null===(s=this._registries.areas[n])||void 0===s?void 0:s.floor_id)||""}`,c=`area${x.G_}${n}`;return void(this._entries=Object.assign(Object.assign({},this._entries),{},{[l]:Object.assign(Object.assign({},this._entries[l]),{},{open:!0,areas:Object.assign(Object.assign({},this._entries[l].areas),{},{[c]:Object.assign(Object.assign({},this._entries[l].areas[c]),{},{open:!0,devices:Object.assign(Object.assign({},this._entries[l].areas[c].devices),{},{[e]:Object.assign(Object.assign({},this._entries[l].areas[c].devices[e]),{},{open:!0})})})})})}))}if("device"===e){var r,n;const e=null===(r=this._registries.devices[t])||void 0===r?void 0:r.area_id;if(!e){const e=`${"service"===this._registries.devices[t].entry_type?"service":"area"}${x.G_}`;return void(this._entries=Object.assign(Object.assign({},this._entries),{},{[e]:Object.assign(Object.assign({},this._entries[e]),{},{open:!0})}))}const i=`floor${x.G_}${(null===(n=this._registries.areas[e])||void 0===n?void 0:n.floor_id)||""}`,s=`area${x.G_}${e}`;return void(this._entries=Object.assign(Object.assign({},this._entries),{},{[i]:Object.assign(Object.assign({},this._entries[i]),{},{open:!0,areas:Object.assign(Object.assign({},this._entries[i].areas),{},{[s]:Object.assign(Object.assign({},this._entries[i].areas[s]),{},{open:!0})})})}))}if("area"===e){var l;const e=`floor${x.G_}${(null===(l=this._registries.areas[t])||void 0===l?void 0:l.floor_id)||""}`;this._entries=Object.assign(Object.assign({},this._entries),{},{[e]:Object.assign(Object.assign({},this._entries[e]),{},{open:!0})})}}}_handleSelectionChange(e){const t=e.detail.selection[0];null!=t&&t.target&&this._valueChanged(t.target)}_selectItem(e){const t=e.currentTarget.target;t&&this._valueChanged(t)}async _valueChanged(e,t=!1){const[i,s]=e.split(x.G_,2);var a,o;((0,d.r)(this,"value-changed",{value:{[`${i}_id`]:s||void 0}}),t&&s)&&(this._expandTreeToItem(i,s),await this.updateComplete,"label"===i?null===(a=this.shadowRoot.querySelector("ha-list-item-button.selected"))||void 0===a||a.scrollIntoView({block:"center"}):null===(o=this.shadowRoot.querySelector("wa-tree-item[selected]"))||void 0===o||o.scrollIntoView({block:"center"}))}_toggleItem(e,t){const[i,s]=e.split(x.G_,2);if("floor"!==i){if("area"===i&&s){var a;const i=`floor${x.G_}${(null===(a=this._registries.areas[s])||void 0===a?void 0:a.floor_id)||""}`;return void(this._entries=Object.assign(Object.assign({},this._entries),{},{[i]:Object.assign(Object.assign({},this._entries[i]),{},{areas:Object.assign(Object.assign({},this._entries[i].areas),{},{[e]:Object.assign(Object.assign({},this._entries[i].areas[e]),{},{open:t})})})}))}if("area"!==i)if("service"!==i){if("device"===i&&s){var o,r;const e=null===(o=this._registries.devices[s])||void 0===o?void 0:o.area_id;if(e){var n,l,c;const i=`area${x.G_}${null!==(n=null===(l=this._registries.devices[s])||void 0===l?void 0:l.area_id)&&void 0!==n?n:""}`,a=`floor${x.G_}${e&&(null===(c=this._registries.areas[e])||void 0===c?void 0:c.floor_id)||""}`;return void(this._entries=Object.assign(Object.assign({},this._entries),{},{[a]:Object.assign(Object.assign({},this._entries[a]),{},{areas:Object.assign(Object.assign({},this._entries[a].areas),{},{[i]:Object.assign(Object.assign({},this._entries[a].areas[i]),{},{devices:Object.assign(Object.assign({},this._entries[a].areas[i].devices),{},{[s]:Object.assign(Object.assign({},this._entries[a].areas[i].devices[s]),{},{open:t})})})})})}))}const i=`${"service"===(null===(r=this._registries.devices[s])||void 0===r?void 0:r.entry_type)?"service":"area"}${x.G_}`;return void(this._entries=Object.assign(Object.assign({},this._entries),{},{[i]:Object.assign(Object.assign({},this._entries[i]),{},{devices:Object.assign(Object.assign({},this._entries[i].devices),{},{[s]:Object.assign(Object.assign({},this._entries[i].devices[s]),{},{open:t})})})}))}"device"!==i?"helper"!==i?i.startsWith("entity_")?this._entries=Object.assign(Object.assign({},this._entries),{},{[`device${x.G_}`]:Object.assign(Object.assign({},this._entries[`device${x.G_}`]),{},{devices:Object.assign(Object.assign({},this._entries[`device${x.G_}`].devices),{},{[e]:Object.assign(Object.assign({},this._entries[`device${x.G_}`].devices[e]),{},{open:t})})})}):i.startsWith("helper_")&&(this._entries=Object.assign(Object.assign({},this._entries),{},{[`helper${x.G_}`]:Object.assign(Object.assign({},this._entries[`helper${x.G_}`]),{},{devices:Object.assign(Object.assign({},this._entries[`helper${x.G_}`].devices),{},{[e]:Object.assign(Object.assign({},this._entries[`helper${x.G_}`].devices[e]),{},{open:t})})})})):this._entries=Object.assign(Object.assign({},this._entries),{},{[e]:Object.assign(Object.assign({},this._entries[e]),{},{open:t})}):this._entries=Object.assign(Object.assign({},this._entries),{},{[e]:Object.assign(Object.assign({},this._entries[e]),{},{open:t})})}else this._entries=Object.assign(Object.assign({},this._entries),{},{[e]:Object.assign(Object.assign({},this._entries[e]),{},{open:t})});else this._entries=Object.assign(Object.assign({},this._entries),{},{[e]:Object.assign(Object.assign({},this._entries[e]),{},{open:t})})}else this._entries=Object.assign(Object.assign({},this._entries),{},{[e]:Object.assign(Object.assign({},this._entries[e]),{},{open:t})})}_expandItem(e){const t=e.target.target;this._toggleItem(t,!0)}_collapseItem(e){const t=e.target.target;this._toggleItem(t,!1)}async _loadConfigEntries(){const e=await(0,b.VN)(this.hass);this._configEntryLookup=Object.fromEntries(e.map(e=>[e.entry_id,e]))}_expandHeight(){this._fullHeight=!0,this.style.setProperty("--max-height","none")}constructor(...e){super(...e),this.narrow=!1,this._floorAreas=[],this._entries={},this._fullHeight=!1,this._configEntryLookup={},this._renderNarrow=(0,h.A)((e,t)=>{const[i,s]=Object.entries(t)[0],a=i.replace("_id","");if(!a||"label"===a)return n.s6;if("floor"===a)return this._renderAreas(e[`floor${x.G_}${null!=s?s:""}`].areas);if("area"===a&&s){var o;const t=e[`floor${x.G_}${(null===(o=this._registries.areas[s])||void 0===o?void 0:o.floor_id)||""}`],{devices:i,entities:a}=t.areas[`area${x.G_}${s}`],r=Object.keys(i).length;return(0,n.qy)(z||(z=ae` ${0} ${0} `),r?this._renderDevices(i):n.s6,a.length?this._renderEntities(a):n.s6)}if(!s&&"area"===a||"service"===a){const t=e[`${a}${x.G_}`].devices;return this._renderDevices(t)}if(s&&"device"===a){var r;const t=null===(r=this._registries.devices[s])||void 0===r?void 0:r.area_id;if(t){var l;const i=(null===(l=this._registries.areas[t])||void 0===l?void 0:l.floor_id)||"",{entities:a}=e[`floor${x.G_}${i}`].areas[`area${x.G_}${t}`].devices[s];return a.length?this._renderEntities(a):n.s6}const i="service"===this._registries.devices[s].entry_type,{entities:a}=e[`${i?"service":"area"}${x.G_}`].devices[s];return a.length?this._renderEntities(a):n.s6}if("device"===a||"helper"===a){const{devices:t}=e[`${a}${x.G_}`];return this._renderDomains(t,"device"===a?"entity_":"helper_")}if(!s&&(a.startsWith("entity")||a.startsWith("helper"))){const{entities:t}=e[`${a.startsWith("entity")?"device":"helper"}${x.G_}`].devices[`${a}${x.G_}`];return this._renderEntities(t)}return n.s6}),this._renderFloors=(0,h.A)((e,t,i)=>{const s=!this._floorAreas.length||!this._floorAreas[0].id&&!this._floorAreas[0].areas.length,a=s?void 0:this._floorAreas.map((e,s)=>0!==s||e.id?this._renderItem(e.id?e.primary:this._i18n.localize("ui.panel.config.automation.editor.other_areas"),e.id||`floor${x.G_}`,!e.id,!!e.id&&this._getSelectedTargetId(i)===e.id,!t[e.id||`floor${x.G_}`].open&&!!Object.keys(t[e.id||`floor${x.G_}`].areas).length,t[e.id||`floor${x.G_}`].open,this._renderFloorIcon(e),t[e.id||`floor${x.G_}`].open?this._renderAreas(t[e.id||`floor${x.G_}`].areas):void 0):this._renderAreas(t[e.id||`floor${x.G_}`].areas));return(0,n.qy)(q||(q=ae`<ha-section-title>${0}</ha-section-title> ${0}`),this._i18n.localize("ui.panel.config.automation.editor.home"),s?(0,n.qy)(D||(D=ae`<ha-row-item> <div slot="headline"> ${0} </div> </ha-row-item>`),this._i18n.localize("ui.components.area-picker.no_areas")):(0,n.qy)(G||(G=ae`${0}`),e?(0,n.qy)(Z||(Z=ae`<ha-list-base>${0}</ha-list-base>`),a):(0,n.qy)(F||(F=ae`<wa-tree @wa-selection-change="${0}">${0}</wa-tree>`),this._handleSelectionChange,a)))}),this._renderLabels=(0,h.A)((e,t)=>{const i=this._getLabelsMemoized(this.states,this._registries.areas,this._registries.devices,this._registries.entities,this._labelRegistry,void 0,void 0,void 0,void 0,void 0,void 0,`label${x.G_}`);return i.length?(0,n.qy)(P||(P=ae`<ha-section-title>${0}</ha-section-title> <ha-list-base> ${0} </ha-list-base>`),this._i18n.localize("ui.components.label-picker.labels"),i.map(i=>(0,n.qy)(B||(B=ae`<ha-list-item-button .target="${0}" @click="${0}" class="${0}">${0} <div slot="headline">${0}</div> ${0} </ha-list-item-button>`),i.id,this._selectItem,this._getSelectedTargetId(t)===i.id?"selected":"",i.icon?(0,n.qy)(N||(N=ae`<ha-icon slot="start" .icon="${0}"></ha-icon>`),i.icon):i.icon_path?(0,n.qy)(R||(R=ae`<ha-svg-icon slot="start" .path="${0}"></ha-svg-icon>`),i.icon_path):n.s6,i.primary,e?(0,n.qy)(W||(W=ae`<ha-icon-next slot="end"></ha-icon-next> `)):n.s6))):n.s6}),this._renderUnassigned=(0,h.A)((e,t,i)=>{var s,a,o,r;const l=Object.keys((null===(s=t[`area${x.G_}`])||void 0===s?void 0:s.devices)||{}).length,c=Object.keys((null===(a=t[`service${x.G_}`])||void 0===a?void 0:a.devices)||{}).length,h=Object.keys((null===(o=t[`device${x.G_}`])||void 0===o?void 0:o.devices)||{}).length,d=Object.keys((null===(r=t[`helper${x.G_}`])||void 0===r?void 0:r.devices)||{}).length;if(!(l||c||h||d))return n.s6;const u=[];if(h){const e=t[`device${x.G_}`].open;u.push(this._renderItem(this._i18n.localize("ui.components.target-picker.type.entities"),`device${x.G_}`,!0,!1,!e,e,void 0,t[`device${x.G_}`].open?this._renderDomains(t[`device${x.G_}`].devices,"entity_"):void 0))}if(d){const e=t[`helper${x.G_}`].open;u.push(this._renderItem(this._i18n.localize("ui.panel.config.automation.editor.helpers"),`helper${x.G_}`,!0,!1,!e,e,void 0,t[`helper${x.G_}`].open?this._renderDomains(t[`helper${x.G_}`].devices,"helper_"):void 0))}if(l){const e=t[`area${x.G_}`].open;u.push(this._renderItem(this._i18n.localize("ui.components.target-picker.type.devices"),`area${x.G_}`,!0,!1,!e,e,void 0,t[`area${x.G_}`].open?this._renderDevices(t[`area${x.G_}`].devices):void 0))}if(c){const e=t[`service${x.G_}`].open;u.push(this._renderItem(this._i18n.localize("ui.panel.config.automation.editor.services"),`service${x.G_}`,!0,!1,!e,e,void 0,t[`service${x.G_}`].open?this._renderDevices(t[`service${x.G_}`].devices):void 0))}return(0,n.qy)(U||(U=ae`<ha-section-title>${0}</ha-section-title>${0} `),this._i18n.localize("ui.panel.config.automation.editor.unassigned"),e?(0,n.qy)(K||(K=ae`<ha-list-base>${0}</ha-list-base>`),u):(0,n.qy)(J||(J=ae`<wa-tree @wa-selection-change="${0}"> ${0} </wa-tree>`),this._handleSelectionChange,u))}),this._renderFloorIcon=e=>t=>e.id&&e.floor?(0,n.qy)(Q||(Q=ae`<ha-floor-icon slot="${0}" .floor="${0}"></ha-floor-icon>`),(0,c.J)(t),e.floor):(0,n.qy)(Y||(Y=ae`<ha-svg-icon slot="${0}" .path="${0}"></ha-svg-icon>`),(0,c.J)(t),oe),this._renderAreaIcon=e=>t=>e?(0,n.qy)(X||(X=ae`<ha-icon slot="${0}" .icon="${0}"></ha-icon>`),(0,c.J)(t),e):(0,n.qy)(ee||(ee=ae`<ha-svg-icon slot="${0}" .path="${0}"></ha-svg-icon>`),(0,c.J)(t),oe),this._renderDomainIcon=e=>t=>{var i;return(0,n.qy)(te||(te=ae` <img slot="${0}" alt="" crossorigin="anonymous" referrerpolicy="no-referrer" src="${0}"> `),(0,c.J)(t),(0,A.MR)({domain:e,type:"icon",darkOptimized:null===(i=this.hass.themes)||void 0===i?void 0:i.darkMode},this.hass.auth.data.hassUrl))},this._renderEntityIcon=e=>t=>(0,n.qy)(ie||(ie=ae`<ha-state-icon slot="${0}" .stateObj="${0}"></ha-state-icon>`),(0,c.J)(t),e),this._getAreaDeviceLookupMemoized=(0,h.A)(e=>(0,m.QI)(Object.values(e))),this._getAreaEntityLookupMemoized=(0,h.A)(e=>(0,m.bQ)(Object.values(e))),this._getDeviceEntityLookupMemoized=(0,h.A)(e=>(0,w.I3)(Object.values(e))),this._getSelectedTargetId=(0,h.A)(e=>e&&Object.keys(e).length?`${Object.keys(e)[0].replace("_id","")}${x.G_}${Object.values(e)[0]}`:void 0),this._getLabelsMemoized=(0,h.A)($.I),this._formatId=(0,h.A)(e=>[e.type,e.id].join(x.G_))}}re.styles=(0,n.AH)(se||(se=ae`:host{--wa-color-neutral-fill-quiet:var(--ha-color-fill-primary-normal-active);position:relative}ha-section-title{top:0;position:sticky;z-index:1}wa-tree-item::part(item){height:var(--ha-space-10);padding:var(--ha-space-1) var(--ha-space-3);cursor:pointer;border-inline-start:0}wa-tree-item::part(label){gap:var(--ha-space-3);font-family:var(--ha-font-family-heading);font-weight:var(--ha-font-weight-medium);overflow:hidden}ha-list-item-button::part(label){font-weight:var(--ha-font-weight-medium);font-family:var(--ha-font-family-heading)}.item-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}ha-floor-icon,ha-icon,ha-state-icon,ha-svg-icon{padding:var(--ha-space-1);color:var(--ha-color-on-neutral-quiet)}wa-tree-item::part(item):hover{background-color:var(--ha-color-fill-neutral-quiet-hover)}img{width:24px;height:24px;padding:var(--ha-space-1)}img.domain-icon{filter:grayscale(100%)}state-badge{width:24px;height:24px}wa-tree-item[selected]::part(item):hover{background-color:var(--ha-color-fill-primary-normal-hover)}wa-tree-item::part(base).tree-item-selected .item{background-color:#ff0}ha-list-base{--ha-row-item-padding-inline:var(--ha-space-3);--ha-row-item-padding-block:var(--ha-space-1);--ha-row-item-min-height:40px}ha-list-item-button::part(end){color:var(--ha-color-on-neutral-quiet)}ha-list-item-button.selected{background-color:var(--ha-color-fill-primary-normal-active);--md-list-item-label-text-color:var(--ha-color-on-primary-normal);--icon-primary-color:var(--ha-color-on-primary-normal)}ha-list-item-button.selected::part(headline){color:var(--ha-color-on-primary-normal)}ha-list-item-button.selected ha-icon,ha-list-item-button.selected ha-svg-icon,wa-tree-item[selected],wa-tree-item[selected]>ha-floor-icon,wa-tree-item[selected]>ha-icon,wa-tree-item[selected]>ha-state-icon,wa-tree-item[selected]>ha-svg-icon{color:var(--ha-color-on-primary-normal)}.targets-show-more{display:flex;justify-content:center;position:absolute;bottom:0;width:100%;padding-bottom:var(--ha-space-2);box-shadow:inset 0 -8px 12px 0 rgba(0,0,0,.06);z-index:2}@media all and (max-width:870px),all and (max-height:500px){:host{max-height:var(--max-height,50%);overflow:hidden}}`)),(0,s.Cg)([(0,l.MZ)({attribute:!1})],re.prototype,"hass",void 0),(0,s.Cg)([(0,l.MZ)({attribute:!1})],re.prototype,"value",void 0),(0,s.Cg)([(0,l.MZ)({type:Boolean})],re.prototype,"narrow",void 0),(0,s.Cg)([(0,l.MZ)({attribute:!1})],re.prototype,"manifests",void 0),(0,s.Cg)([(0,l.wk)(),(0,r.Fg)({context:y.D5,subscribe:!0})],re.prototype,"_i18n",void 0),(0,s.Cg)([(0,r.Fg)({context:y.iN,subscribe:!0})],re.prototype,"states",void 0),(0,s.Cg)([(0,r.Fg)({context:y.Hd,subscribe:!0})],re.prototype,"_registries",void 0),(0,s.Cg)([(0,l.wk)(),(0,r.Fg)({context:y.HD,subscribe:!0})],re.prototype,"_labelRegistry",void 0),(0,s.Cg)([(0,l.wk)()],re.prototype,"_floorAreas",void 0),(0,s.Cg)([(0,l.wk)()],re.prototype,"_entries",void 0),(0,s.Cg)([(0,l.wk)()],re.prototype,"_showShowMoreButton",void 0),(0,s.Cg)([(0,l.wk)()],re.prototype,"_fullHeight",void 0),re=(0,s.Cg)([(0,l.EM)("ha-automation-add-from-target")],re),t()}catch(L){t(L)}})},2491:function(e,t,i){i.a(e,async function(e,t){try{i(89463),i(62953);var s=i(40445),a=i(5124),o=i(67576),r=i(6412),n=i(75751),l=i(22786),c=i(1087),h=i(57237),d=(i(67094),i(34127)),u=(i(1671),i(50723),i(14503)),p=i(14440),v=e([d,p]);[d,p]=v.then?(await v)():v;let g,_,m,f,b,y,w,C,$,x,A,H,L,V=e=>e;const M="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z",k="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class S extends a.WF{render(){return(0,a.qy)(g||(g=V`<div class="${0}" @scroll="${0}"> ${0} </div>`),(0,r.H)({items:!0,blank:this.error||!this.items||!this.items.length,error:this.error,scrolled:this._itemsScrolled,"ha-scrollbar":this.scrollable}),this._onItemsScroll,this.items||this.error?this.error?(0,a.qy)(_||(_=V`${0} <div>${0}</div>`),this.error,this._renderTarget(this.target)):this.items&&!this.items.length?(0,a.qy)(m||(m=V`${0} ${0} ${0}`),this.emptyLabel,this.target?(0,a.qy)(f||(f=V`<div>${0}</div>`),this._renderTarget(this.target)):a.s6,this.emptyNote?(0,a.qy)(b||(b=V`<div class="empty-note">${0}</div>`),this.emptyNote):a.s6):(0,n.u)(this.items,(e,t)=>`item-group-${t}`,e=>this._renderItemList(e.title,e.items)):this.selectLabel)}_renderItemList(e,t){return t&&t.length?(0,a.qy)(y||(y=V` <div class="items-title">${0}</div> <ha-list-base> ${0} </ha-list-base> `),e,(0,n.u)(t,e=>e.key,e=>(0,a.qy)(w||(w=V` <ha-list-item-button .value="${0}" @click="${0}"> <div slot="headline" class="${0}"> ${0}${0} </div> ${0} ${0} ${0} <ha-svg-icon slot="end" class="plus" .path="${0}"></ha-svg-icon> </ha-list-item-button> `),e.key,this._selected,this.target?"item-headline":"",e.name,this._renderTarget(this.target),!this.tooltipDescription&&e.description?(0,a.qy)(C||(C=V`<div slot="supporting-text">${0}</div>`),e.description):a.s6,e.icon?(0,a.qy)($||($=V`<span slot="start">${0}</span>`),e.icon):e.iconPath?(0,a.qy)(x||(x=V`<ha-svg-icon slot="start" .path="${0}"></ha-svg-icon>`),e.iconPath):a.s6,this.tooltipDescription&&e.description?(0,a.qy)(A||(A=V`<ha-svg-icon tabindex="0" id="${0}" slot="end" .path="${0}" @click="${0}"></ha-svg-icon> <ha-tooltip slot="end" .for="${0}" @wa-show="${0}" @wa-hide="${0}" @wa-after-hide="${0}" @wa-after-show="${0}">${0}</ha-tooltip> `),`description-tooltip-${e.key}`,M,h.d,`description-tooltip-${e.key}`,h.d,h.d,h.d,h.d,e.description):a.s6,k))):a.s6}_selected(e){const t=e.currentTarget;(0,c.r)(this,"value-changed",{value:t.value})}_onItemsScroll(e){var t;const i=null!==(t=e.target.scrollTop)&&void 0!==t?t:0;this._itemsScrolled=i>0}scrollTo(e,t){var i,s;"number"==typeof e?null===(i=this._itemsDiv)||void 0===i||i.scrollTo(e,t):null===(s=this._itemsDiv)||void 0===s||s.scrollTo(e)}constructor(...e){super(...e),this.configEntryLookup={},this.tooltipDescription=!1,this.scrollable=!1,this._itemsScrolled=!1,this._renderTarget=(0,l.A)(e=>e?(0,a.qy)(H||(H=V`<div class="selected-target"> ${0} <div class="label">${0}</div> </div>`),(0,p.B)({entities:this.hass.entities,devices:this.hass.devices,areas:this.hass.areas,floors:this.hass.floors},this.hass.states,e[0],e[1],this.configEntryLookup,this.getLabel),e[2]):a.s6)}}S.styles=[u.dp,(0,a.AH)(L||(L=V`:host{display:flex;flex-grow:1}:host([scrollable]) .items{overflow:auto}.items{display:flex;flex-direction:column;flex:1}.items.blank{border-radius:var(--ha-border-radius-xl);background-color:var(--ha-color-surface-default);align-items:center;color:var(--ha-color-text-secondary);padding:var(--ha-space-4);margin:0 var(--ha-space-4) max(var(--safe-area-inset-bottom),var(--ha-space-3));line-height:var(--ha-line-height-expanded);justify-content:center}.empty-note{color:var(--ha-color-text-secondary);margin-top:var(--ha-space-2);text-align:center}.empty-note a{color:currentColor;text-decoration:underline}.items.error{background-color:var(--ha-color-fill-danger-quiet-resting);color:var(--ha-color-on-danger-normal)}.items ha-list-base{--ha-row-item-padding-inline:var(--ha-space-3);--ha-row-item-padding-block:var(--ha-space-2);--ha-list-gap:var(--ha-space-3);gap:var(--ha-space-2);padding:0 var(--ha-space-4);padding-bottom:max(var(--safe-area-inset-bottom),var(--ha-space-3))}.items ha-list-base ha-list-item-button{border-radius:var(--ha-border-radius-lg);border:1px solid var(--ha-color-border-neutral-quiet);overflow:hidden}.items ha-list-base ha-list-item-button::part(end),.items ha-list-base ha-list-item-button::part(start){color:var(--ha-color-on-neutral-quiet)}.items ha-list-base ha-list-item-button::part(end){gap:var(--ha-space-3)}.items .item-headline{display:flex;align-items:center;gap:var(--ha-space-2);min-height:var(--ha-space-9);flex-wrap:wrap}.items-title{position:sticky;display:flex;align-items:center;font-weight:var(--ha-font-weight-medium);padding-top:var(--ha-space-2);padding-bottom:var(--ha-space-2);padding-inline-start:var(--ha-space-8);padding-inline-end:var(--ha-space-3);top:0;z-index:1;background-color:var(--card-background-color)}ha-bottom-sheet .items-title{padding-top:var(--ha-space-3)}.scrolled .items-title:first-of-type{box-shadow:var(--bar-box-shadow);border-bottom:1px solid var(--ha-color-border-neutral-quiet)}ha-svg-icon.plus{color:var(--primary-color)}.selected-target{display:inline-flex;gap:var(--ha-space-1);justify-content:center;align-items:center;border-radius:var(--ha-border-radius-md);background:var(--ha-color-fill-neutral-normal-resting);padding:0 var(--ha-space-2) 0 var(--ha-space-1);border:var(--ha-border-width-sm) solid var(--ha-color-border-neutral-quiet);color:var(--ha-color-on-neutral-normal);overflow:hidden}.selected-target .label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.selected-target ha-domain-icon,.selected-target ha-icon,.selected-target ha-svg-icon{display:flex;padding:var(--ha-space-1) 0}.selected-target ha-floor-icon{display:flex;height:32px;width:32px;align-items:center}.selected-target ha-domain-icon{filter:grayscale(100%)}`))],(0,s.Cg)([(0,o.MZ)({attribute:!1})],S.prototype,"hass",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],S.prototype,"items",void 0),(0,s.Cg)([(0,o.MZ)()],S.prototype,"error",void 0),(0,s.Cg)([(0,o.MZ)({attribute:"select-label"})],S.prototype,"selectLabel",void 0),(0,s.Cg)([(0,o.MZ)({attribute:"empty-label"})],S.prototype,"emptyLabel",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],S.prototype,"emptyNote",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],S.prototype,"target",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],S.prototype,"getLabel",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],S.prototype,"configEntryLookup",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean,attribute:"tooltip-description"})],S.prototype,"tooltipDescription",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],S.prototype,"scrollable",void 0),(0,s.Cg)([(0,o.wk)()],S.prototype,"_itemsScrolled",void 0),(0,s.Cg)([(0,o.P)(".items")],S.prototype,"_itemsDiv",void 0),(0,s.Cg)([(0,o.Ls)({passive:!0})],S.prototype,"_onItemsScroll",null),S=(0,s.Cg)([(0,o.EM)("ha-automation-add-items")],S),t()}catch(g){t(g)}})},25871:function(e,t,i){i.a(e,async function(e,t){try{i(89463),i(74423),i(44114),i(18111),i(22489),i(61701),i(62953);var s=i(40445),a=i(35211),o=(i(32308),i(78648)),r=i(5124),n=i(67576),l=i(89784),c=i(22786),h=i(91335),d=i(1087),u=i(15638),p=(i(5745),i(32023),i(74281)),v=i(89865),g=(i(75064),i(59174)),_=(i(18198),i(43661),i(69464),i(73150),i(30780)),m=i(28223),f=i(87225),b=i(22792),y=i(31422),w=i(53756),C=i(5904),$=i(88555),x=i(59653),A=i(85614),H=e([p,v,g]);[p,v,g]=H.then?(await H)():H;let L,V,M,k,S,I,O,E,T,j,z,q,D,G,Z,F,P,B,N,R,W,U,K,J=e=>e;const Q="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",Y="M20 2H4C2.9 2 2 2.9 2 4V20C2 21.11 2.9 22 4 22H20C21.11 22 22 21.11 22 20V4C22 2.9 21.11 2 20 2M4 6L6 4H10.9L4 10.9V6M4 13.7L13.7 4H18.6L4 18.6V13.7M20 18L18 20H13.1L20 13.1V18M20 10.3L10.3 20H5.4L20 5.4V10.3Z",X=["separator","entity","device","area","separator","label"],ee=[{name:"primary",weight:10},{name:"secondary",weight:7}];class te extends r.WF{get _showEntityId(){var e;return null===(e=this.hass.userData)||void 0===e?void 0:e.showEntityIdPicker}willUpdate(e){if(this.hasUpdated||(0,A.i)(),!this.hasUpdated||e.has("filter")){if(this._removeKeyboardShortcuts)return void(this.filter||(this._removeKeyboardShortcuts(),this._removeKeyboardShortcuts=void 0));this._removeKeyboardShortcuts=(0,h.Tc)(window,{ArrowUp:this._selectPreviousSearchItem,ArrowDown:this._selectNextSearchItem,Home:this._selectFirstSearchItem,End:this._selectLastSearchItem,Enter:this._pickSelectedSearchItem})}}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._removeKeyboardShortcuts)||void 0===e||e.call(this)}render(){const e=this._getFilteredItems(this.addElementType,this.hass.localize,this.filter,this.configEntryLookup,this.items,this.newTriggersAndConditions,this._selectedSearchSection);let t;return e.length||(t=this._selectedSearchSection?"item"===this._selectedSearchSection?`ui.panel.config.automation.editor.${this.addElementType}s.empty_search.item`:`ui.panel.config.automation.editor.empty_section_search.${this._selectedSearchSection}`:`ui.panel.config.automation.editor.${this.addElementType}s.empty_search.global`),(0,r.qy)(L||(L=J` ${0} ${0} `),this._renderSections(),t?(0,r.qy)(V||(V=J`<div class="empty-search"> ${0} </div>`),this.hass.localize(t,{term:(0,r.qy)(M||(M=J`<b>‘${0}’</b>`),this.filter)})):(0,r.qy)(k||(k=J` <div class="search-results"> <div class="section-title-wrapper"> ${0} </div> <lit-virtualizer .keyFunction="${0}" tabindex="0" scroller .items="${0}" .renderItem="${0}" style="min-height:36px" class="${0}" @scroll="${0}" @focus="${0}" @visibilityChanged="${0}"> </lit-virtualizer> </div> `),!this._selectedSearchSection&&this._searchSectionTitle?(0,r.qy)(S||(S=J`<ha-section-title> ${0} </ha-section-title>`),this._searchSectionTitle):r.s6,this._keyFunction,e,this._renderSearchResultRow,this._searchListScrolled?"scrolled":"",this._onScrollSearchList,this._focusSearchList,this._visibilityChanged))}_renderSections(){if("trigger"===this.addElementType&&!this.newTriggersAndConditions)return r.s6;const e=["item"];return"trigger"!==this.addElementType&&e.push("block"),this.newTriggersAndConditions&&e.push(...X),(0,r.qy)(I||(I=J` <ha-chip-set class="sections"> ${0} </ha-chip-set> `),e.map(e=>"separator"===e?(0,r.qy)(O||(O=J`<div class="separator"></div>`)):(0,r.qy)(E||(E=J`<ha-filter-chip @click="${0}" .section-id="${0}" .selected="${0}" .label="${0}"> </ha-filter-chip>`),this._toggleSection,e,this._selectedSearchSection===e,this._getSearchSectionLabel(e))))}_onScrollSearchList(e){var t;const i=null!==(t=e.target.scrollTop)&&void 0!==t?t:0;this._searchListScrolled=i>0}_visibilityChanged(e){if(this._virtualizerElement){const t=this._virtualizerElement.items[e.first],i=this._virtualizerElement.items[e.first+1];if(void 0===t||void 0===i||"string"==typeof t||"string"==typeof i||0===e.first||0===e.first&&e.last===this._virtualizerElement.items.length-1)return void(this._searchSectionTitle=void 0);let s;s=t.type&&!["area","floor"].includes(t.type)?t.type:(0,$.OJ)(t),this._searchSectionTitle=this._getSearchSectionLabel(s)}}_filterGroup(e,t,i,s,a=!0){const o=this._fuseIndexes[e](t);return a?(0,x.x)(t,i,s,e=>e.id,o):(0,x.C)(t,i,s,o,{ignoreLocation:!0})}_toggleSection(e){e.stopPropagation(),this._searchSectionTitle=void 0;const t=e.target["section-id"];t&&(this._selectedSearchSection===t?this._selectedSearchSection=void 0:this._selectedSearchSection=t,this._virtualizerElement&&this._virtualizerElement.scrollToIndex(0))}_getSearchSectionLabel(e){return"block"===e?this.hass.localize("ui.panel.config.automation.editor.blocks"):"item"===e||["trigger","condition","action"].includes(e)?this.hass.localize(`ui.panel.config.automation.editor.${this.addElementType}s.name`):this.hass.localize("ui.components.target-picker.type."+("entity"===e?"entities":`${e}s`))}_resetSelectedSearchItem(){var e;null===(e=this._virtualizerElement)||void 0===e||null===(e=e.querySelector(".selected"))||void 0===e||e.classList.remove("selected"),this._selectedSearchItemIndex=-1}_selectSearchItem(e){(0,d.r)(this,"search-element-picked",e)}constructor(...e){super(...e),this.configEntryLookup={},this.narrow=!1,this.newTriggersAndConditions=!1,this._searchListScrolled=!1,this._getDevicesMemoized=(0,c.A)(y.oG),this._getLabelsMemoized=(0,c.A)(C.I),this._getEntitiesMemoized=(0,c.A)(w.w),this._getAreasAndFloorsMemoized=(0,c.A)(m.bi),this._selectedSearchItemIndex=-1,this._renderSearchResultRow=(e,t)=>{var i;if(!e)return r.s6;if("string"==typeof e)return(0,r.qy)(T||(T=J`<ha-section-title>${0}</ha-section-title>`),e);const s=["trigger","condition","action","block"].includes(e.type)?"item":(0,$.OJ)(e);let a=!1,o=!1,n=!1;var c;"area"!==s&&"floor"!==s||(o=(0,u.qC)(this.hass.language,this.hass.translationMetadata.translations),a="area"===s&&!(null===(c=e.area)||void 0===c||!c.floor_id));return"entity"===s&&(n=!!this._showEntityId),(0,r.qy)(j||(j=J` <ha-combo-box-item id="${0}" tabindex="-1" .type="${0}" class="${0}" style="${0}" .value="${0}" @click="${0}"> ${0} ${0} <span slot="headline">${0}</span> ${0} ${0} ${0} ${0} </ha-combo-box-item> `),`search-list-item-${t}`,"empty"===s?"text":"button","empty"===s?"empty":"","area"===e.type&&a?"--md-list-item-leading-space: var(--ha-space-12);":"",e,this._selectSearchResult,"area"===e.type&&a?(0,r.qy)(z||(z=J` <ha-tree-indicator style="${0}" .end="${0}" slot="start"></ha-tree-indicator> `),(0,l.W)({width:"var(--ha-space-12)",position:"absolute",top:"0",left:o?void 0:"var(--ha-space-1)",right:o?"var(--ha-space-1)":void 0,transform:o?"scaleX(-1)":""}),e.last):r.s6,e.renderedIcon?(0,r.qy)(q||(q=J`<div slot="start"> ${0} </div>`),e.renderedIcon):e.icon?(0,r.qy)(D||(D=J`<ha-icon slot="start" .icon="${0}"></ha-icon>`),e.icon):e.icon_path||"area"===s?(0,r.qy)(G||(G=J`<ha-svg-icon slot="start" .path="${0}"></ha-svg-icon>`),e.icon_path||Y):"entity"===s&&e.stateObj?(0,r.qy)(Z||(Z=J` <state-badge slot="start" .stateObj="${0}" .hass="${0}"></state-badge> `),e.stateObj,this.hass):"device"===s&&e.domain?(0,r.qy)(F||(F=J` <ha-domain-icon slot="start" .domain="${0}" brand-fallback></ha-domain-icon> `),e.domain):"floor"===s?(0,r.qy)(P||(P=J`<ha-floor-icon slot="start" .floor="${0}"></ha-floor-icon>`),e.floor):r.s6,e.primary,e.secondary?(0,r.qy)(B||(B=J`<span slot="supporting-text">${0}</span>`),e.secondary):r.s6,e.stateObj&&n?(0,r.qy)(N||(N=J` <span slot="supporting-text" class="code"> ${0} </span> `),null===(i=e.stateObj)||void 0===i?void 0:i.entity_id):r.s6,!e.domain_name||"entity"===s&&n?r.s6:(0,r.qy)(R||(R=J` <div slot="trailing-supporting-text" class="domain"> ${0} </div> `),e.domain_name),"item"===s?(0,r.qy)(W||(W=J`<ha-svg-icon class="plus" slot="end" .path="${0}"></ha-svg-icon>`),Q):this.narrow?(0,r.qy)(U||(U=J`<ha-icon-next slot="end"></ha-icon-next>`)):r.s6)},this._keyFunction=e=>"string"==typeof e?e:e.id,this._createFuseIndex=(e,t)=>o.A.createIndex(t,e),this._fuseIndexes={area:(0,c.A)(e=>this._createFuseIndex(e,m.Z2)),entity:(0,c.A)(e=>this._createFuseIndex(e,w.t)),device:(0,c.A)(e=>this._createFuseIndex(e,y._o)),label:(0,c.A)(e=>this._createFuseIndex(e,C.u)),item:(0,c.A)(e=>this._createFuseIndex(e,ee)),block:(0,c.A)(e=>this._createFuseIndex(e,ee))},this._getFilteredItems=(0,c.A)((e,t,i,s,a,o,r)=>{const n=[];if(!r||"item"===r){let s=this._convertItemsToComboBoxItems(a,e);i&&(s=this._filterGroup("item",s,i,ee)),!r&&s.length&&n.push(t(`ui.panel.config.automation.editor.${e}s.name`)),n.push(...s)}if("trigger"!==e&&(!r||"block"===r)){const s="action"===e?_.bM:"condition"===e?f.oW:{};let a=this._convertItemsToComboBoxItems(Object.keys(s).map(i=>this.convertToItem(i,{},e,t)),"block");i&&(a=this._filterGroup("block",a,i,ee)),!r&&a.length&&n.push(t("ui.panel.config.automation.editor.blocks")),n.push(...a)}if(o){if(!r||"entity"===r){let e=this._getEntitiesMemoized(this.hass,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,`entity${$.G_}`);i&&(e=this._filterGroup("entity",e,i,w.t)),!r&&e.length&&n.push(t("ui.components.target-picker.type.entities")),n.push(...e)}if(!r||"device"===r){let e=this._getDevicesMemoized(this.hass,s,void 0,void 0,void 0,void 0,void 0,void 0,void 0,`device${$.G_}`);i&&(e=this._filterGroup("device",e,i,y._o)),!r&&e.length&&n.push(t("ui.components.target-picker.type.devices")),n.push(...e)}if(!r||"area"===r){let e=this._getAreasAndFloorsMemoized(this.hass.states,this.hass.floors,this.hass.areas,this.hass.devices,this.hass.entities,(0,c.A)(e=>[e.type,e.id].join($.G_)),void 0,void 0,void 0,void 0,void 0,void 0,void 0);i&&(e=this._filterGroup("area",e,i,m.Z2,!1)),!r&&e.length&&n.push(t("ui.components.target-picker.type.areas")),n.push(...e.map((t,i)=>{const s=e[i+1];return!s||"area"===t.type&&"floor"===s.type?Object.assign(Object.assign({},t),{},{last:!0}):t}))}if(!r||"label"===r){let e=this._getLabelsMemoized(this.hass.states,this.hass.areas,this.hass.devices,this.hass.entities,this._labelRegistry,void 0,void 0,void 0,void 0,void 0,void 0,`label${$.G_}`);i&&(e=this._filterGroup("label",e,i,C.u)),!r&&e.length&&n.push(t("ui.components.target-picker.type.labels")),n.push(...e)}}return n}),this._convertItemsToComboBoxItems=(e,t)=>e.map(({key:e,name:i,description:s,iconPath:a,icon:o})=>({id:e,primary:i,secondary:s,icon_path:a,renderedIcon:o,type:t,search_labels:{key:e,name:i,description:s}})),this._focusSearchList=()=>{-1===this._selectedSearchItemIndex&&this._selectNextSearchItem()},this._selectSearchResult=e=>{e.stopPropagation();const t=e.currentTarget.value;t&&this._selectSearchItem(t)},this._selectNextSearchItem=e=>{if(null==e||e.stopPropagation(),null==e||e.preventDefault(),!this._virtualizerElement)return;const t=this._virtualizerElement.items,i=t.length-1;if(-1===i)return void this._resetSelectedSearchItem();const s=i===this._selectedSearchItemIndex?this._selectedSearchItemIndex:this._selectedSearchItemIndex+1;if(t[s]){if("string"==typeof t[s]){if(s===i)return;this._selectedSearchItemIndex=s+1}else this._selectedSearchItemIndex=s;this._scrollToSelectedSearchItem()}},this._scrollToSelectedSearchItem=()=>{var e,t;null===(e=this._virtualizerElement)||void 0===e||null===(e=e.querySelector(".selected"))||void 0===e||e.classList.remove("selected"),null===(t=this._virtualizerElement)||void 0===t||t.scrollToIndex(this._selectedSearchItemIndex,"end"),requestAnimationFrame(()=>{var e;null===(e=this._virtualizerElement)||void 0===e||null===(e=e.querySelector(`#search-list-item-${this._selectedSearchItemIndex}`))||void 0===e||e.classList.add("selected")})},this._selectPreviousSearchItem=e=>{if(e.stopPropagation(),e.preventDefault(),this._virtualizerElement&&this._selectedSearchItemIndex>0){const e=this._selectedSearchItemIndex-1,t=this._virtualizerElement.items;if(!t[e])return;if("string"==typeof t[e]){if(0===e)return;this._selectedSearchItemIndex=e-1}else this._selectedSearchItemIndex=e;this._scrollToSelectedSearchItem()}},this._selectFirstSearchItem=e=>{if(e.stopPropagation(),!this._virtualizerElement||!this._virtualizerElement.items.length)return;"string"==typeof this._virtualizerElement.items[0]?this._selectedSearchItemIndex=1:this._selectedSearchItemIndex=0,this._scrollToSelectedSearchItem()},this._selectLastSearchItem=e=>{if(e.stopPropagation(),!this._virtualizerElement||!this._virtualizerElement.items.length)return;const t=this._virtualizerElement.items.length-1;"string"==typeof this._virtualizerElement.items[t]?this._selectedSearchItemIndex=t-1:this._selectedSearchItemIndex=t,this._scrollToSelectedSearchItem()},this._pickSelectedSearchItem=e=>{var t,i;e.stopPropagation();const s=null===(t=this._virtualizerElement)||void 0===t?void 0:t.items.filter(e=>"string"!=typeof e);if(s&&1===s.length){const e=s[0];return void this._selectSearchItem(e)}if(-1===this._selectedSearchItemIndex)return;e.preventDefault();const a=null===(i=this._virtualizerElement)||void 0===i?void 0:i.items[this._selectedSearchItemIndex];a&&this._selectSearchItem(a)}}}te.styles=(0,r.AH)(K||(K=J`:host{display:flex;flex-direction:column}.empty-search{display:flex;flex-direction:column;flex:1;padding:var(--ha-space-3);border-radius:var(--ha-border-radius-xl);background-color:var(--ha-color-surface-default);align-items:center;color:var(--ha-color-text-secondary);margin:var(--ha-space-3) var(--ha-space-4) max(var(--safe-area-inset-bottom),var(--ha-space-3));line-height:var(--ha-line-height-expanded);padding-top:var(--ha-space-6);justify-content:start}.sections{display:flex;flex-wrap:nowrap;gap:var(--ha-space-2);padding:var(--ha-space-3);margin-bottom:calc(var(--ha-space-3) * -1);overflow:auto;overflow-x:auto;overflow-y:hidden}.sections ha-filter-chip{flex-shrink:0;--md-filter-chip-selected-container-color:var(--ha-color-fill-primary-normal-hover);color:var(--primary-color)}.sections .separator{height:var(--ha-space-8);width:0;border:1px solid var(--ha-color-border-neutral-quiet)}.search-results{border-radius:var(--ha-border-radius-xl);border:1px solid var(--ha-color-border-neutral-quiet);margin:var(--ha-space-3);overflow:hidden;flex:1;display:flex;flex-direction:column}lit-virtualizer ha-section-title{width:100%}lit-virtualizer{flex:1}lit-virtualizer:focus-visible{outline:0}ha-combo-box-item{width:100%}ha-combo-box-item.selected{background-color:var(--ha-color-fill-neutral-quiet-hover)}@media (prefers-color-scheme:dark){ha-combo-box-item.selected{background-color:var(--ha-color-fill-neutral-normal-hover)}}ha-svg-icon.plus{color:var(--primary-color)}`)),(0,s.Cg)([(0,n.MZ)({attribute:!1})],te.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)()],te.prototype,"filter",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],te.prototype,"configEntryLookup",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],te.prototype,"manifests",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],te.prototype,"items",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean})],te.prototype,"narrow",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,attribute:"new-triggers-and-conditions"})],te.prototype,"newTriggersAndConditions",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],te.prototype,"convertToItem",void 0),(0,s.Cg)([(0,n.MZ)({attribute:"add-element-type"})],te.prototype,"addElementType",void 0),(0,s.Cg)([(0,n.wk)()],te.prototype,"_searchSectionTitle",void 0),(0,s.Cg)([(0,n.wk)()],te.prototype,"_selectedSearchSection",void 0),(0,s.Cg)([(0,n.wk)()],te.prototype,"_searchListScrolled",void 0),(0,s.Cg)([(0,n.wk)(),(0,a.Fg)({context:b.HD,subscribe:!0})],te.prototype,"_labelRegistry",void 0),(0,s.Cg)([(0,n.P)("lit-virtualizer")],te.prototype,"_virtualizerElement",void 0),(0,s.Cg)([(0,n.Ls)({passive:!0})],te.prototype,"_onScrollSearchList",null),(0,s.Cg)([(0,n.Ls)({passive:!0})],te.prototype,"_visibilityChanged",null),te=(0,s.Cg)([(0,n.EM)("ha-automation-add-search")],te),t()}catch(L){t(L)}})},14440:function(e,t,i){i.a(e,async function(e,s){try{i.d(t,{B:function(){return f}});var a=i(5124),o=i(59174),r=(i(18198),i(47680),i(93367)),n=(i(67094),e([o,r]));[o,r]=n.then?(await n)():n;let l,c,h,d,u,p,v,g=e=>e;const _="M17.63,5.84C17.27,5.33 16.67,5 16,5H5A2,2 0 0,0 3,7V17A2,2 0 0,0 5,19H16C16.67,19 17.27,18.66 17.63,18.15L22,12L17.63,5.84Z",m="M20 2H4C2.9 2 2 2.9 2 4V20C2 21.11 2.9 22 4 22H20C21.11 22 22 21.11 22 20V4C22 2.9 21.11 2 20 2M4 6L6 4H10.9L4 10.9V6M4 13.7L13.7 4H18.6L4 18.6V13.7M20 18L18 20H13.1L20 13.1V18M20 10.3L10.3 20H5.4L20 5.4V10.3Z",f=(e,t,i,s,o,r,n)=>{if(!s)return a.s6;if("floor"===i&&e.floors[s])return(0,a.qy)(l||(l=g`<ha-floor-icon .slot="${0}" .floor="${0}"></ha-floor-icon>`),n,e.floors[s]);if("area"===i){const t=e.areas[s];return null!=t&&t.icon?(0,a.qy)(c||(c=g`<ha-icon .slot="${0}" .icon="${0}"></ha-icon>`),n,t.icon):(0,a.qy)(h||(h=g`<ha-svg-icon .slot="${0}" .path="${0}"></ha-svg-icon>`),n,m)}if("device"===i&&e.devices[s]){const t=e.devices[s],i=t.primary_config_entry?o[t.primary_config_entry]:void 0,r=null==i?void 0:i.domain;if(r)return(0,a.qy)(d||(d=g`<ha-domain-icon .domain="${0}" brand-fallback .slot="${0}"></ha-domain-icon>`),r,n)}if("entity"===i&&t[s])return(0,a.qy)(u||(u=g`<ha-state-icon .stateObj="${0}" .slot="${0}"></ha-state-icon>`),t[s],n);if("label"===i&&r){const e=r(s);return null!=e&&e.icon?(0,a.qy)(p||(p=g`<ha-icon .slot="${0}" .icon="${0}"></ha-icon>`),n,e.icon):(0,a.qy)(v||(v=g`<ha-svg-icon .slot="${0}" .path="${0}"></ha-svg-icon>`),n,_)}return a.s6};s()}catch(l){s(l)}})},69070:function(e,t,i){i.d(t,{N:function(){return n}});i(62953);var s=i(65522),a=i(37981),o=i(74705),r=i(55931);const n=(e,t,i,n,l,c)=>{if("floor"===n)return e.floors[l]&&(0,r.X)(e.floors[l])||i("ui.panel.config.automation.editor.actions.type.service.description.target_unknown_floor");if("area"===n)return e.areas[l]&&(0,s.A)(e.areas[l])||i("ui.panel.config.automation.editor.actions.type.service.description.target_unknown_area");if("device"===n)return e.devices[l]&&(0,a.xn)(e.devices[l])||i("ui.panel.config.automation.editor.actions.type.service.description.target_unknown_device");if("entity"===n&&t[l]){const i=t[l],[s,a]=(0,o.Cf)(i,[{type:"entity"},{type:"device"},{type:"area"}],e.entities,e.devices,e.areas,e.floors);return s||a||l}if("entity"===n)return i("ui.panel.config.automation.editor.actions.type.service.description.target_unknown_entity");if("label"===n&&c){const e=c(l);return(null==e?void 0:e.name)||i("ui.panel.config.automation.editor.actions.type.service.description.target_unknown_label")}return l}},59653:function(e,t,i){i.d(t,{C:function(){return n},x:function(){return l}});i(26910),i(18111),i(22489),i(20116),i(7588),i(61701),i(27495),i(42762),i(62953);var s=i(78648);const a={ignoreDiacritics:!0,isCaseSensitive:!1,threshold:.3,minMatchCharLength:2,ignoreLocation:!0},o=2;function r(e,t,i,r,n){return new s.A(e,Object.assign(Object.assign({},a),{},{minMatchCharLength:null!=n?n:"string"==typeof t&&t.length<o?t.length:o},r||{}),i).search(t)}function n(e,t,i,s,a={}){const n=t.toLowerCase().split(" ").filter(e=>e.trim());if(!n.length)return e;let l=o;n.forEach(e=>{e.length<l&&(l=e.length)});return r(e,{$and:n.map(e=>({$or:i.map(t=>({$path:"string"==typeof t?t:Array.isArray(t)?t.join("."):"string"==typeof t.name?t.name:t.name.join("."),$val:e}))}))},s,Object.assign(Object.assign({},a),{},{shouldSort:!1}),l).map(e=>e.item)}function l(e,t,i,s,a,o={}){const n=t.toLowerCase().split(" ").filter(e=>e.trim());if(!n.length)return e;if(1===n.length)return r(e,n[0],a,o).map(e=>e.item);const l={};let c=0;if(n.forEach(t=>{if(!t.trim())return;const n=r(e,t,a,Object.assign(Object.assign({},o),{},{shouldSort:!1,includeScore:!0,includeMatches:!0}));n.length&&(c++,n.forEach(e=>{const t=s(e.item);l[t]||(l[t]={item:e.item,hits:0,score:0}),l[t].hits+=1;const a=function(e,t){if(!e.matches||0===e.matches.length)return 1;let i=1;for(const s of e.matches){const e=t.find(e=>"string"==typeof e.name?e.name===s.key:e.name.join(".")===s.key);e&&e.weight&&e.weight>i&&(i=e.weight)}return i}(e,i),o=(e.score?1-e.score:0)*a;l[t].score+=o}))}),c!==n.length)return[];const h=Object.values(l).filter(({hits:e})=>e===n.length);return h.sort((e,t)=>t.score-e.score),h.map(({item:e})=>e)}},36918:function(e,t,i){i.d(t,{o:function(){return s}});const s=(e,t)=>`https://www.iobroker.net/#${e.language&&e.language.split("-")[0]||"en"}/adapters/adapterref/iobroker.lovelace/README.md#`},22348:function(e,t,i){i.d(t,{V:function(){return a}});var s=i(37177);const a=e=>!!e&&s.n},41570:function(e,t,i){i.d(t,{c:function(){return s}});i(27495);const s=/Mac/i.test(navigator.userAgent)},37177:function(e,t,i){i.d(t,{n:function(){return s}});i(27495);const s=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}}]);