export const id=513;export const ids=[513];export const modules={6534:(e,i,t)=>{t.d(i,{M:()=>s,l:()=>a});const a=new Set(["primary","accent","disabled","red","pink","purple","deep-purple","indigo","blue","light-blue","cyan","teal","green","light-green","lime","yellow","amber","orange","deep-orange","brown","light-grey","grey","dark-grey","blue-grey","black","white"]);function s(e){return a.has(e)?`var(--${e}-color)`:e}},7190:(e,i,t)=>{var a=t(5461),s=t(8597),d=t(196),n=t(5081),r=t(3167),o=t(9263),l=t(6412),c=t(8848),h=t(1378);t(6442),t(9484);const u=e=>s.qy`<ha-list-item .twoline=${!!e.area}>
    <span>${e.name}</span>
    <span slot="secondary">${e.area}</span>
  </ha-list-item>`;(0,a.A)([(0,d.EM)("ha-device-picker")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,d.MZ)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,d.MZ)()],key:"label",value:void 0},{kind:"field",decorators:[(0,d.MZ)()],key:"value",value:void 0},{kind:"field",decorators:[(0,d.MZ)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,d.MZ)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,d.MZ)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,d.MZ)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,d.MZ)({type:Array,attribute:"exclude-devices"})],key:"excludeDevices",value:void 0},{kind:"field",decorators:[(0,d.MZ)({attribute:!1})],key:"deviceFilter",value:void 0},{kind:"field",decorators:[(0,d.MZ)({attribute:!1})],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,d.MZ)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,d.MZ)({type:Boolean})],key:"required",value(){return!1}},{kind:"field",decorators:[(0,d.wk)()],key:"_opened",value:void 0},{kind:"field",decorators:[(0,d.P)("ha-combo-box",!0)],key:"comboBox",value:void 0},{kind:"field",key:"_init",value(){return!1}},{kind:"field",key:"_getDevices",value(){return(0,n.A)(((e,i,t,a,s,d,n,r,c)=>{if(!e.length)return[{id:"no_devices",area:"",name:this.hass.localize("ui.components.device-picker.no_devices"),strings:[]}];let u={};(a||s||d||r)&&(u=(0,h.g2)(t));let v=e.filter((e=>e.id===this.value||!e.disabled_by));a&&(v=v.filter((e=>{const i=u[e.id];return!(!i||!i.length)&&u[e.id].some((e=>a.includes((0,o.m)(e.entity_id))))}))),s&&(v=v.filter((e=>{const i=u[e.id];return!i||!i.length||t.every((e=>!s.includes((0,o.m)(e.entity_id))))}))),c&&(v=v.filter((e=>!c.includes(e.id)))),d&&(v=v.filter((e=>{const i=u[e.id];return!(!i||!i.length)&&u[e.id].some((e=>{const i=this.hass.states[e.entity_id];return!!i&&(i.attributes.device_class&&d.includes(i.attributes.device_class))}))}))),r&&(v=v.filter((e=>{const i=u[e.id];return!(!i||!i.length)&&i.some((e=>{const i=this.hass.states[e.entity_id];return!!i&&r(i)}))}))),n&&(v=v.filter((e=>e.id===this.value||n(e))));const p=v.map((e=>{const t=(0,h.xn)(e,this.hass,u[e.id]);return{id:e.id,name:t,area:e.area_id&&i[e.area_id]?i[e.area_id].name:this.hass.localize("ui.components.device-picker.no_area"),strings:[t||""]}}));return p.length?1===p.length?p:p.sort(((e,i)=>(0,l.x)(e.name||"",i.name||"",this.hass.locale.language))):[{id:"no_devices",area:"",name:this.hass.localize("ui.components.device-picker.no_match"),strings:[]}]}))}},{kind:"method",key:"open",value:async function(){await this.updateComplete,await(this.comboBox?.open())}},{kind:"method",key:"focus",value:async function(){await this.updateComplete,await(this.comboBox?.focus())}},{kind:"method",key:"updated",value:function(e){if(!this._init&&this.hass||this._init&&e.has("_opened")&&this._opened){this._init=!0;const e=this._getDevices(Object.values(this.hass.devices),this.hass.areas,Object.values(this.hass.entities),this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.excludeDevices);this.comboBox.items=e,this.comboBox.filteredItems=e}}},{kind:"method",key:"render",value:function(){return s.qy`
      <ha-combo-box
        .hass=${this.hass}
        .label=${void 0===this.label&&this.hass?this.hass.localize("ui.components.device-picker.device"):this.label}
        .value=${this._value}
        .helper=${this.helper}
        .renderer=${u}
        .disabled=${this.disabled}
        .required=${this.required}
        item-id-path="id"
        item-value-path="id"
        item-label-path="name"
        @opened-changed=${this._openedChanged}
        @value-changed=${this._deviceChanged}
        @filter-changed=${this._filterChanged}
      ></ha-combo-box>
    `}},{kind:"get",key:"_value",value:function(){return this.value||""}},{kind:"method",key:"_filterChanged",value:function(e){const i=e.target,t=e.detail.value.toLowerCase();i.filteredItems=t.length?(0,c.H)(t,i.items||[]):i.items}},{kind:"method",key:"_deviceChanged",value:function(e){e.stopPropagation();let i=e.detail.value;"no_devices"===i&&(i=""),i!==this._value&&this._setValue(i)}},{kind:"method",key:"_openedChanged",value:function(e){this._opened=e.detail.value}},{kind:"method",key:"_setValue",value:function(e){this.value=e,setTimeout((()=>{(0,r.r)(this,"value-changed",{value:e}),(0,r.r)(this,"change")}),0)}}]}}),s.WF)},3350:(e,i,t)=>{t.d(i,{S:()=>n});var a=t(5461),s=t(8597),d=t(196);t(9222);const n=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"};(0,a.A)([(0,d.EM)("ha-floor-icon")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,d.MZ)({attribute:!1})],key:"floor",value:void 0},{kind:"field",decorators:[(0,d.MZ)()],key:"icon",value:void 0},{kind:"method",key:"render",value:function(){if(this.floor.icon)return s.qy`<ha-icon .icon=${this.floor.icon}></ha-icon>`;const e=n(this.floor);return s.qy`<ha-svg-icon .path=${e}></ha-svg-icon>`}}]}}),s.WF)},513:(e,i,t)=>{t.r(i),t.d(i,{HaTargetSelector:()=>Z});var a=t(5461),s=t(9534),d=t(8597),n=t(196),r=t(5081),o=t(6041),l=t(1378),c=t(8502),h=t(6831),u=(t(7777),t(4454)),v=(t(8068),t(4667),t(9760)),p=t(6534),_=t(6709),m=t(3167),y=t(4517),k=t(9263),f=t(1330),g=t(8889),b=t(3018),$=t(7878),x=t(5845),M=(t(7190),t(5067),t(2506)),H=t(6412),V=t(8848),C=t(7222),F=(t(6442),t(3350));t(6396),t(9484),t(9222);(0,a.A)([(0,n.EM)("ha-tree-indicator")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,n.MZ)({type:Boolean,reflect:!0})],key:"end",value(){return!1}},{kind:"method",key:"render",value:function(){return d.qy`
      <svg width="100%" height="100%" viewBox="0 0 48 48">
        <line x1="24" y1="0" x2="24" y2=${this.end?"24":"48"}></line>
        <line x1="24" y1="24" x2="36" y2="24"></line>
      </svg>
    `}},{kind:"field",static:!0,key:"styles",value(){return d.AH`
    :host {
      display: block;
      width: 48px;
      height: 48px;
    }
    line {
      stroke: var(--divider-color);
      stroke-width: 2;
      stroke-dasharray: 2;
    }
  `}}]}}),d.WF);(0,a.A)([(0,n.EM)("ha-area-floor-picker")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,n.MZ)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.MZ)()],key:"label",value:void 0},{kind:"field",decorators:[(0,n.MZ)()],key:"value",value:void 0},{kind:"field",decorators:[(0,n.MZ)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,n.MZ)()],key:"placeholder",value:void 0},{kind:"field",decorators:[(0,n.MZ)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,n.MZ)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,n.MZ)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,n.MZ)({type:Array,attribute:"exclude-areas"})],key:"excludeAreas",value:void 0},{kind:"field",decorators:[(0,n.MZ)({type:Array,attribute:"exclude-floors"})],key:"excludeFloors",value:void 0},{kind:"field",decorators:[(0,n.MZ)({attribute:!1})],key:"deviceFilter",value:void 0},{kind:"field",decorators:[(0,n.MZ)({attribute:!1})],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,n.MZ)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,n.MZ)({type:Boolean})],key:"required",value(){return!1}},{kind:"field",decorators:[(0,n.wk)()],key:"_floors",value:void 0},{kind:"field",decorators:[(0,n.wk)()],key:"_opened",value:void 0},{kind:"field",decorators:[(0,n.P)("ha-combo-box",!0)],key:"comboBox",value:void 0},{kind:"field",key:"_init",value(){return!1}},{kind:"method",key:"hassSubscribe",value:function(){return[(0,b.eg)(this.hass.connection,(e=>{this._floors=e}))]}},{kind:"method",key:"open",value:async function(){await this.updateComplete,await(this.comboBox?.open())}},{kind:"method",key:"focus",value:async function(){await this.updateComplete,await(this.comboBox?.focus())}},{kind:"field",key:"_rowRenderer",value(){return e=>{const i=(0,C.qC)(this.hass);return d.qy`
      <ha-list-item
        graphic="icon"
        style=${"area"===e.type&&e.hasFloor?i?"--mdc-list-side-padding-right: 48px;":"--mdc-list-side-padding-left: 48px;":""}
      >
        ${"area"===e.type&&e.hasFloor?d.qy`<ha-tree-indicator
              style=${(0,M.W)({width:"48px",position:"absolute",top:"0px",left:i?void 0:"8px",right:i?"8px":void 0,transform:i?"scaleX(-1)":""})}
              .end=${e.lastArea}
              slot="graphic"
            ></ha-tree-indicator>`:d.s6}
        ${"floor"===e.type?d.qy`<ha-floor-icon slot="graphic" .floor=${e}></ha-floor-icon>`:e.icon?d.qy`<ha-icon slot="graphic" .icon=${e.icon}></ha-icon>`:d.qy`<ha-svg-icon
                slot="graphic"
                .path=${"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"}
              ></ha-svg-icon>`}
        ${e.name}
      </ha-list-item>
    `}}},{kind:"field",key:"_getAreas",value(){return(0,r.A)(((e,i,t,a,s,d,n,r,o,c,h)=>{if(!i.length&&!e.length)return[{id:"no_areas",type:"area",name:this.hass.localize("ui.components.area-picker.no_areas"),icon:null,strings:[],level:null}];let u,v,p={};(s||d||n||r||o)&&(p=(0,l.g2)(a),u=t,v=a.filter((e=>e.area_id)),s&&(u=u.filter((e=>{const i=p[e.id];return!(!i||!i.length)&&p[e.id].some((e=>s.includes((0,k.m)(e.entity_id))))})),v=v.filter((e=>s.includes((0,k.m)(e.entity_id))))),d&&(u=u.filter((e=>{const i=p[e.id];return!i||!i.length||a.every((e=>!d.includes((0,k.m)(e.entity_id))))})),v=v.filter((e=>!d.includes((0,k.m)(e.entity_id))))),n&&(u=u.filter((e=>{const i=p[e.id];return!(!i||!i.length)&&p[e.id].some((e=>{const i=this.hass.states[e.entity_id];return!!i&&(i.attributes.device_class&&n.includes(i.attributes.device_class))}))})),v=v.filter((e=>{const i=this.hass.states[e.entity_id];return i.attributes.device_class&&n.includes(i.attributes.device_class)}))),r&&(u=u.filter((e=>r(e)))),o&&(u=u.filter((e=>{const i=p[e.id];return!(!i||!i.length)&&p[e.id].some((e=>{const i=this.hass.states[e.entity_id];return!!i&&o(i)}))})),v=v.filter((e=>{const i=this.hass.states[e.entity_id];return!!i&&o(i)}))));let _,m=i;if(u&&(_=u.filter((e=>e.area_id)).map((e=>e.area_id))),v&&(_=(_??[]).concat(v.filter((e=>e.area_id)).map((e=>e.area_id)))),_&&(m=m.filter((e=>_.includes(e.area_id)))),c&&(m=m.filter((e=>!c.includes(e.area_id)))),h&&(m=m.filter((e=>!e.floor_id||!h.includes(e.floor_id)))),!m.length)return[{id:"no_areas",type:"area",name:this.hass.localize("ui.components.area-picker.no_match"),icon:null,strings:[],level:null}];const y=(0,b._o)(m),f=Object.values(m).filter((e=>!e.floor_id||!y[e.floor_id])),g=Object.entries(y).map((([i,t])=>[e.find((e=>e.floor_id===i)),t])).sort((([e],[i])=>e.level!==i.level?(e.level??0)-(i.level??0):(0,H.x)(e.name,i.name))),$=[];return g.forEach((([e,i])=>{e&&$.push({id:e.floor_id,type:"floor",name:e.name,icon:e.icon,strings:[e.floor_id,...e.aliases,e.name],level:e.level}),$.push(...i.map(((e,i,t)=>({id:e.area_id,type:"area",name:e.name,icon:e.icon,strings:[e.area_id,...e.aliases,e.name],hasFloor:!0,level:null,lastArea:i===t.length-1}))))})),$.length||f.length||$.push({id:"no_areas",type:"area",name:this.hass.localize("ui.components.area-picker.unassigned_areas"),icon:null,strings:[],level:null}),$.push(...f.map((e=>({id:e.area_id,type:"area",name:e.name,icon:e.icon,strings:[e.area_id,...e.aliases,e.name],level:null})))),$}))}},{kind:"method",key:"updated",value:function(e){if(!this._init&&this.hass&&this._floors||this._init&&e.has("_opened")&&this._opened){this._init=!0;const e=this._getAreas(this._floors,Object.values(this.hass.areas),Object.values(this.hass.devices),Object.values(this.hass.entities),this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.excludeAreas,this.excludeFloors);this.comboBox.items=e,this.comboBox.filteredItems=e}}},{kind:"method",key:"render",value:function(){return d.qy`
      <ha-combo-box
        .hass=${this.hass}
        .helper=${this.helper}
        item-value-path="id"
        item-id-path="id"
        item-label-path="name"
        .value=${this._value}
        .disabled=${this.disabled}
        .required=${this.required}
        .label=${void 0===this.label&&this.hass?this.hass.localize("ui.components.area-picker.area"):this.label}
        .placeholder=${this.placeholder?this.hass.areas[this.placeholder]?.name:void 0}
        .renderer=${this._rowRenderer}
        @filter-changed=${this._filterChanged}
        @opened-changed=${this._openedChanged}
        @value-changed=${this._areaChanged}
      >
      </ha-combo-box>
    `}},{kind:"method",key:"_filterChanged",value:function(e){const i=e.target,t=e.detail.value;if(!t)return void(this.comboBox.filteredItems=this.comboBox.items);const a=(0,V.H)(t,i.items||[]);this.comboBox.filteredItems=a}},{kind:"get",key:"_value",value:function(){return this.value||""}},{kind:"method",key:"_openedChanged",value:function(e){this._opened=e.detail.value}},{kind:"method",key:"_areaChanged",value:async function(e){e.stopPropagation();if("no_areas"===e.detail.value)return;const i=this.comboBox.selectedItem;(0,m.r)(this,"value-changed",{value:{id:i.id,type:i.type}})}}]}}),(0,x.E)(d.WF));t(3689);const L="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";(0,a.A)([(0,n.EM)("ha-target-picker")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,n.MZ)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.MZ)({attribute:!1})],key:"value",value:void 0},{kind:"field",decorators:[(0,n.MZ)()],key:"label",value:void 0},{kind:"field",decorators:[(0,n.MZ)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,n.MZ)({type:Array})],key:"createDomains",value:void 0},{kind:"field",decorators:[(0,n.MZ)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,n.MZ)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,n.MZ)({attribute:!1})],key:"deviceFilter",value:void 0},{kind:"field",decorators:[(0,n.MZ)({attribute:!1})],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,n.MZ)({type:Boolean,reflect:!0})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,n.MZ)({type:Boolean})],key:"addOnTop",value(){return!1}},{kind:"field",decorators:[(0,n.wk)()],key:"_addMode",value:void 0},{kind:"field",decorators:[(0,n.P)("#input")],key:"_inputElement",value:void 0},{kind:"field",decorators:[(0,n.P)(".add-container",!0)],key:"_addContainer",value:void 0},{kind:"field",decorators:[(0,n.wk)()],key:"_floors",value:void 0},{kind:"field",decorators:[(0,n.wk)()],key:"_labels",value:void 0},{kind:"field",key:"_opened",value(){return!1}},{kind:"method",key:"hassSubscribe",value:function(){return[(0,b.eg)(this.hass.connection,(e=>{this._floors=e})),(0,$.o5)(this.hass.connection,(e=>{this._labels=e}))]}},{kind:"method",key:"render",value:function(){return this.addOnTop?d.qy` ${this._renderChips()} ${this._renderItems()} `:d.qy` ${this._renderItems()} ${this._renderChips()} `}},{kind:"method",key:"_renderItems",value:function(){return d.qy`
      <div class="mdc-chip-set items">
        ${this.value?.floor_id?(0,o.e)(this.value.floor_id).map((e=>{const i=this._floors?.find((i=>i.floor_id===e));return this._renderChip("floor_id",e,i?.name||e,void 0,i?.icon,i?(0,F.S)(i):"M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z")})):""}
        ${this.value?.area_id?(0,o.e)(this.value.area_id).map((e=>{const i=this.hass.areas[e];return this._renderChip("area_id",e,i?.name||e,void 0,i?.icon,"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")})):d.s6}
        ${this.value?.device_id?(0,o.e)(this.value.device_id).map((e=>{const i=this.hass.devices[e];return this._renderChip("device_id",e,i?(0,l.xn)(i,this.hass):e,void 0,void 0,"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")})):d.s6}
        ${this.value?.entity_id?(0,o.e)(this.value.entity_id).map((e=>{const i=this.hass.states[e];return this._renderChip("entity_id",e,i?(0,f.u)(i):e,i)})):d.s6}
        ${this.value?.label_id?(0,o.e)(this.value.label_id).map((e=>{const i=this._labels?.find((i=>i.label_id===e));let t=i?.color?(0,p.M)(i.color):void 0;if(t?.startsWith("var(")){t=getComputedStyle(this).getPropertyValue(t.substring(4,t.length-1))}return t?.startsWith("#")&&(t=(0,_.xp)(t).join(",")),this._renderChip("label_id",e,i?i.name:e,void 0,i?.icon,"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",t)})):d.s6}
      </div>
    `}},{kind:"method",key:"_renderChips",value:function(){return d.qy`
      <div class="mdc-chip-set add-container">
        <div
          class="mdc-chip area_id add"
          .type=${"area_id"}
          @click=${this._showPicker}
        >
          <div class="mdc-chip__ripple"></div>
          <ha-svg-icon
            class="mdc-chip__icon mdc-chip__icon--leading"
            .path=${L}
          ></ha-svg-icon>
          <span role="gridcell">
            <span role="button" tabindex="0" class="mdc-chip__primary-action">
              <span class="mdc-chip__text"
                >${this.hass.localize("ui.components.target-picker.add_area_id")}</span
              >
            </span>
          </span>
        </div>
        <div
          class="mdc-chip device_id add"
          .type=${"device_id"}
          @click=${this._showPicker}
        >
          <div class="mdc-chip__ripple"></div>
          <ha-svg-icon
            class="mdc-chip__icon mdc-chip__icon--leading"
            .path=${L}
          ></ha-svg-icon>
          <span role="gridcell">
            <span role="button" tabindex="0" class="mdc-chip__primary-action">
              <span class="mdc-chip__text"
                >${this.hass.localize("ui.components.target-picker.add_device_id")}</span
              >
            </span>
          </span>
        </div>
        <div
          class="mdc-chip entity_id add"
          .type=${"entity_id"}
          @click=${this._showPicker}
        >
          <div class="mdc-chip__ripple"></div>
          <ha-svg-icon
            class="mdc-chip__icon mdc-chip__icon--leading"
            .path=${L}
          ></ha-svg-icon>
          <span role="gridcell">
            <span role="button" tabindex="0" class="mdc-chip__primary-action">
              <span class="mdc-chip__text"
                >${this.hass.localize("ui.components.target-picker.add_entity_id")}</span
              >
            </span>
          </span>
        </div>
        <div
          class="mdc-chip label_id add"
          .type=${"label_id"}
          @click=${this._showPicker}
        >
          <div class="mdc-chip__ripple"></div>
          <ha-svg-icon
            class="mdc-chip__icon mdc-chip__icon--leading"
            .path=${L}
          ></ha-svg-icon>
          <span role="gridcell">
            <span role="button" tabindex="0" class="mdc-chip__primary-action">
              <span class="mdc-chip__text"
                >${this.hass.localize("ui.components.target-picker.add_label_id")}</span
              >
            </span>
          </span>
        </div>
        ${this._renderPicker()}
      </div>
      ${this.helper?d.qy`<ha-input-helper-text>${this.helper}</ha-input-helper-text>`:""}
    `}},{kind:"method",key:"_showPicker",value:function(e){this._addMode=e.currentTarget.type}},{kind:"method",key:"_renderChip",value:function(e,i,t,a,s,n,r){return d.qy`
      <div
        class="mdc-chip ${(0,v.H)({[e]:!0})}"
        style=${r?`--color: rgb(${r}); --background-color: rgba(${r}, .5)`:""}
      >
        ${s?d.qy`<ha-icon
              class="mdc-chip__icon mdc-chip__icon--leading"
              .icon=${s}
            ></ha-icon>`:n?d.qy`<ha-svg-icon
                class="mdc-chip__icon mdc-chip__icon--leading"
                .path=${n}
              ></ha-svg-icon>`:""}
        ${a?d.qy`<ha-state-icon
              class="mdc-chip__icon mdc-chip__icon--leading"
              .hass=${this.hass}
              .stateObj=${a}
            ></ha-state-icon>`:""}
        <span role="gridcell">
          <span role="button" tabindex="0" class="mdc-chip__primary-action">
            <span class="mdc-chip__text">${t}</span>
          </span>
        </span>
        ${"entity_id"===e?"":d.qy`<span role="gridcell">
              <ha-icon-button
                class="expand-btn mdc-chip__icon mdc-chip__icon--trailing"
                .label=${this.hass.localize("ui.components.target-picker.expand")}
                .path=${"M18.17,12L15,8.83L16.41,7.41L21,12L16.41,16.58L15,15.17L18.17,12M5.83,12L9,15.17L7.59,16.59L3,12L7.59,7.42L9,8.83L5.83,12Z"}
                hideTooltip
                .id=${i}
                .type=${e}
                @click=${this._handleExpand}
              ></ha-icon-button>
              <simple-tooltip class="expand" animation-delay="0"
                >${this.hass.localize(`ui.components.target-picker.expand_${e}`)}</simple-tooltip
              >
            </span>`}
        <span role="gridcell">
          <ha-icon-button
            class="mdc-chip__icon mdc-chip__icon--trailing"
            .label=${this.hass.localize("ui.components.target-picker.remove")}
            .path=${"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"}
            hideTooltip
            .id=${i}
            .type=${e}
            @click=${this._handleRemove}
          ></ha-icon-button>
          <simple-tooltip animation-delay="0"
            >${this.hass.localize(`ui.components.target-picker.remove_${e}`)}</simple-tooltip
          >
        </span>
      </div>
    `}},{kind:"method",key:"_renderPicker",value:function(){return this._addMode?d.qy`<mwc-menu-surface
      open
      .anchor=${this._addContainer}
      @closed=${this._onClosed}
      @opened=${this._onOpened}
      @opened-changed=${this._openedChanged}
      @input=${y.d}
      >${"area_id"===this._addMode?d.qy`
            <ha-area-floor-picker
              .hass=${this.hass}
              id="input"
              .type=${"area_id"}
              .label=${this.hass.localize("ui.components.target-picker.add_area_id")}
              no-add
              .deviceFilter=${this.deviceFilter}
              .entityFilter=${this.entityFilter}
              .includeDeviceClasses=${this.includeDeviceClasses}
              .includeDomains=${this.includeDomains}
              .excludeAreas=${(0,o.e)(this.value?.area_id)}
              .excludeFloors=${(0,o.e)(this.value?.floor_id)}
              @value-changed=${this._targetPicked}
              @click=${this._preventDefault}
            ></ha-area-floor-picker>
          `:"device_id"===this._addMode?d.qy`
              <ha-device-picker
                .hass=${this.hass}
                id="input"
                .type=${"device_id"}
                .label=${this.hass.localize("ui.components.target-picker.add_device_id")}
                .deviceFilter=${this.deviceFilter}
                .entityFilter=${this.entityFilter}
                .includeDeviceClasses=${this.includeDeviceClasses}
                .includeDomains=${this.includeDomains}
                .excludeDevices=${(0,o.e)(this.value?.device_id)}
                @value-changed=${this._targetPicked}
                @click=${this._preventDefault}
              ></ha-device-picker>
            `:"label_id"===this._addMode?d.qy`
                <ha-label-picker
                  .hass=${this.hass}
                  id="input"
                  .type=${"label_id"}
                  .label=${this.hass.localize("ui.components.target-picker.add_label_id")}
                  no-add
                  .deviceFilter=${this.deviceFilter}
                  .entityFilter=${this.entityFilter}
                  .includeDeviceClasses=${this.includeDeviceClasses}
                  .includeDomains=${this.includeDomains}
                  .excludeLabels=${(0,o.e)(this.value?.label_id)}
                  @value-changed=${this._targetPicked}
                  @click=${this._preventDefault}
                ></ha-label-picker>
              `:d.qy`
                <ha-entity-picker
                  .hass=${this.hass}
                  id="input"
                  .type=${"entity_id"}
                  .label=${this.hass.localize("ui.components.target-picker.add_entity_id")}
                  .entityFilter=${this.entityFilter}
                  .includeDeviceClasses=${this.includeDeviceClasses}
                  .includeDomains=${this.includeDomains}
                  .excludeEntities=${(0,o.e)(this.value?.entity_id)}
                  .createDomains=${this.createDomains}
                  @value-changed=${this._targetPicked}
                  @click=${this._preventDefault}
                  allow-custom-entity
                ></ha-entity-picker>
              `}</mwc-menu-surface
    >`:d.s6}},{kind:"method",key:"_targetPicked",value:function(e){if(e.stopPropagation(),!e.detail.value)return;let i=e.detail.value;const t=e.currentTarget;let a=t.type;("entity_id"!==a||(0,g.n)(i))&&("area_id"===a&&(i=e.detail.value.id,a=`${e.detail.value.type}_id`),t.value="",this.value&&this.value[a]&&(0,o.e)(this.value[a]).includes(i)||(0,m.r)(this,"value-changed",{value:this.value?{...this.value,[a]:this.value[a]?[...(0,o.e)(this.value[a]),i]:i}:{[a]:i}}))}},{kind:"method",key:"_handleExpand",value:function(e){const i=e.currentTarget,t=[],a=[],s=[];if("floor_id"===i.type)Object.values(this.hass.areas).forEach((e=>{e.floor_id===i.id&&!this.value.area_id?.includes(e.area_id)&&this._areaMeetsFilter(e)&&t.push(e.area_id)}));else if("area_id"===i.type)Object.values(this.hass.devices).forEach((e=>{e.area_id===i.id&&!this.value.device_id?.includes(e.id)&&this._deviceMeetsFilter(e)&&a.push(e.id)})),Object.values(this.hass.entities).forEach((e=>{e.area_id===i.id&&!this.value.entity_id?.includes(e.entity_id)&&this._entityRegMeetsFilter(e)&&s.push(e.entity_id)}));else if("device_id"===i.type)Object.values(this.hass.entities).forEach((e=>{e.device_id===i.id&&!this.value.entity_id?.includes(e.entity_id)&&this._entityRegMeetsFilter(e)&&s.push(e.entity_id)}));else{if("label_id"!==i.type)return;Object.values(this.hass.areas).forEach((e=>{e.labels.includes(i.id)&&!this.value.area_id?.includes(e.area_id)&&this._areaMeetsFilter(e)&&t.push(e.area_id)})),Object.values(this.hass.devices).forEach((e=>{e.labels.includes(i.id)&&!this.value.device_id?.includes(e.id)&&this._deviceMeetsFilter(e)&&a.push(e.id)})),Object.values(this.hass.entities).forEach((e=>{e.labels.includes(i.id)&&!this.value.entity_id?.includes(e.entity_id)&&this._entityRegMeetsFilter(e)&&s.push(e.entity_id)}))}let d=this.value;s.length&&(d=this._addItems(d,"entity_id",s)),a.length&&(d=this._addItems(d,"device_id",a)),t.length&&(d=this._addItems(d,"area_id",t)),d=this._removeItem(d,i.type,i.id),(0,m.r)(this,"value-changed",{value:d})}},{kind:"method",key:"_handleRemove",value:function(e){const i=e.currentTarget;(0,m.r)(this,"value-changed",{value:this._removeItem(this.value,i.type,i.id)})}},{kind:"method",key:"_addItems",value:function(e,i,t){return{...e,[i]:e[i]?(0,o.e)(e[i]).concat(t):t}}},{kind:"method",key:"_removeItem",value:function(e,i,t){const a=(0,o.e)(e[i]).filter((e=>String(e)!==t));if(a.length)return{...e,[i]:a};const s={...e};return delete s[i],Object.keys(s).length?s:void 0}},{kind:"method",key:"_onClosed",value:function(e){e.stopPropagation(),e.target.open=!0}},{kind:"method",key:"_onOpened",value:async function(){this._addMode&&(await(this._inputElement?.focus()),await(this._inputElement?.open()),this._opened=!0)}},{kind:"method",key:"_openedChanged",value:function(e){this._opened&&!e.detail.value&&(this._opened=!1,this._addMode=void 0)}},{kind:"method",key:"_preventDefault",value:function(e){e.preventDefault()}},{kind:"method",key:"_areaMeetsFilter",value:function(e){if(Object.values(this.hass.devices).filter((i=>i.area_id===e.area_id)).some((e=>this._deviceMeetsFilter(e))))return!0;return!!Object.values(this.hass.entities).filter((i=>i.area_id===e.area_id)).some((e=>this._entityRegMeetsFilter(e)))}},{kind:"method",key:"_deviceMeetsFilter",value:function(e){return!!Object.values(this.hass.entities).filter((i=>i.device_id===e.id)).some((e=>this._entityRegMeetsFilter(e)))&&!(this.deviceFilter&&!this.deviceFilter(e))}},{kind:"method",key:"_entityRegMeetsFilter",value:function(e){if(e.entity_category)return!1;if(this.includeDomains&&!this.includeDomains.includes((0,k.m)(e.entity_id)))return!1;if(this.includeDeviceClasses){const i=this.hass.states[e.entity_id];if(!i)return!1;if(!i.attributes.device_class||!this.includeDeviceClasses.includes(i.attributes.device_class))return!1}if(this.entityFilter){const i=this.hass.states[e.entity_id];if(!i)return!1;if(!this.entityFilter(i))return!1}return!0}},{kind:"get",static:!0,key:"styles",value:function(){return d.AH`
      ${(0,d.iz)(u)}
      .mdc-chip {
        color: var(--primary-text-color);
      }
      .items {
        z-index: 2;
      }
      .mdc-chip-set {
        padding: 4px 0;
      }
      .mdc-chip.add {
        color: rgba(0, 0, 0, 0.87);
      }
      .add-container {
        position: relative;
        display: inline-flex;
      }
      .mdc-chip:not(.add) {
        cursor: default;
      }
      .mdc-chip ha-icon-button {
        --mdc-icon-button-size: 24px;
        display: flex;
        align-items: center;
        outline: none;
      }
      .mdc-chip ha-icon-button ha-svg-icon {
        border-radius: 50%;
        background: var(--secondary-text-color);
      }
      .mdc-chip__icon.mdc-chip__icon--trailing {
        width: 16px;
        height: 16px;
        --mdc-icon-size: 14px;
        color: var(--secondary-text-color);
        margin-inline-start: 4px !important;
        margin-inline-end: -4px !important;
        direction: var(--direction);
      }
      .mdc-chip__icon--leading {
        display: flex;
        align-items: center;
        justify-content: center;
        --mdc-icon-size: 20px;
        border-radius: 50%;
        padding: 6px;
        margin-left: -13px !important;
        margin-inline-start: -13px !important;
        margin-inline-end: 4px !important;
        direction: var(--direction);
      }
      .expand-btn {
        margin-right: 0;
        margin-inline-end: 0;
        margin-inline-start: initial;
      }
      .mdc-chip.area_id:not(.add),
      .mdc-chip.floor_id:not(.add) {
        border: 1px solid #fed6a4;
        background: var(--card-background-color);
      }
      .mdc-chip.area_id:not(.add) .mdc-chip__icon--leading,
      .mdc-chip.area_id.add,
      .mdc-chip.floor_id:not(.add) .mdc-chip__icon--leading,
      .mdc-chip.floor_id.add {
        background: #fed6a4;
      }
      .mdc-chip.device_id:not(.add) {
        border: 1px solid #a8e1fb;
        background: var(--card-background-color);
      }
      .mdc-chip.device_id:not(.add) .mdc-chip__icon--leading,
      .mdc-chip.device_id.add {
        background: #a8e1fb;
      }
      .mdc-chip.entity_id:not(.add) {
        border: 1px solid #d2e7b9;
        background: var(--card-background-color);
      }
      .mdc-chip.entity_id:not(.add) .mdc-chip__icon--leading,
      .mdc-chip.entity_id.add {
        background: #d2e7b9;
      }
      .mdc-chip.label_id:not(.add) {
        border: 1px solid var(--color, #e0e0e0);
        background: var(--card-background-color);
      }
      .mdc-chip.label_id:not(.add) .mdc-chip__icon--leading,
      .mdc-chip.label_id.add {
        background: var(--background-color, #e0e0e0);
      }
      .mdc-chip:hover {
        z-index: 5;
      }
      simple-tooltip.expand {
        min-width: 200px;
      }
      :host([disabled]) .mdc-chip {
        opacity: var(--light-disabled-opacity);
        pointer-events: none;
      }
      mwc-menu-surface {
        --mdc-menu-min-width: 100%;
      }
      ha-entity-picker,
      ha-device-picker,
      ha-area-floor-picker {
        display: block;
        width: 100%;
      }
    `}}]}}),(0,x.E)(d.WF));let Z=(0,a.A)([(0,n.EM)("ha-selector-target")],(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,n.MZ)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.MZ)({attribute:!1})],key:"selector",value:void 0},{kind:"field",decorators:[(0,n.MZ)({type:Object})],key:"value",value:void 0},{kind:"field",decorators:[(0,n.MZ)()],key:"label",value:void 0},{kind:"field",decorators:[(0,n.MZ)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,n.MZ)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,n.wk)()],key:"_entitySources",value:void 0},{kind:"field",decorators:[(0,n.wk)()],key:"_createDomains",value:void 0},{kind:"field",key:"_deviceIntegrationLookup",value(){return(0,r.A)(l.fk)}},{kind:"method",key:"_hasIntegration",value:function(e){return e.target?.entity&&(0,o.e)(e.target.entity).some((e=>e.integration))||e.target?.device&&(0,o.e)(e.target.device).some((e=>e.integration))}},{kind:"method",key:"updated",value:function(e){(0,s.A)(t,"updated",this,3)([e]),e.has("selector")&&this._hasIntegration(this.selector)&&!this._entitySources&&(0,c.c)(this.hass).then((e=>{this._entitySources=e})),e.has("selector")&&(this._createDomains=(0,h.Lo)(this.selector))}},{kind:"method",key:"render",value:function(){return this._hasIntegration(this.selector)&&!this._entitySources?d.s6:d.qy` ${this.label?d.qy`<label>${this.label}</label>`:d.s6}
      <ha-target-picker
        .hass=${this.hass}
        .value=${this.value}
        .helper=${this.helper}
        .deviceFilter=${this._filterDevices}
        .entityFilter=${this._filterEntities}
        .disabled=${this.disabled}
        .createDomains=${this._createDomains}
      ></ha-target-picker>`}},{kind:"field",key:"_filterEntities",value(){return e=>!this.selector.target?.entity||(0,o.e)(this.selector.target.entity).some((i=>(0,h.Ru)(i,e,this._entitySources)))}},{kind:"field",key:"_filterDevices",value(){return e=>{if(!this.selector.target?.device)return!0;const i=this._entitySources?this._deviceIntegrationLookup(this._entitySources,Object.values(this.hass.entities)):void 0;return(0,o.e)(this.selector.target.device).some((t=>(0,h.vX)(t,e,i)))}}},{kind:"get",static:!0,key:"styles",value:function(){return d.AH`
      ha-target-picker {
        display: block;
      }
    `}}]}}),d.WF)},3018:(e,i,t)=>{t.d(i,{KD:()=>l,_o:()=>c,eg:()=>o});var a=t(4856),s=t(6412),d=t(1355);t(9812);const n=e=>e.sendMessagePromise({type:"config/floor_registry/list"}).then((e=>e.sort(((e,i)=>e.level!==i.level?(e.level??9999)-(i.level??9999):(0,s.x)(e.name,i.name))))),r=(e,i)=>e.subscribeEvents((0,d.s)((()=>n(e).then((e=>i.setState(e,!0)))),500,!0),"floor_registry_updated"),o=(e,i)=>(0,a.N)("_floorRegistry",n,r,e,i),l=(e,i)=>e.callWS({type:"config/floor_registry/create",...i}),c=e=>{const i={};for(const t of e)t.floor_id&&(t.floor_id in i||(i[t.floor_id]=[]),i[t.floor_id].push(t));return i}},7878:(e,i,t)=>{t.d(i,{Rp:()=>c,_9:()=>l,o5:()=>o});var a=t(4856),s=t(6412),d=t(1355);const n=e=>e.sendMessagePromise({type:"config/label_registry/list"}).then((e=>e.sort(((e,i)=>(0,s.x)(e.name,i.name))))),r=(e,i)=>e.subscribeEvents((0,d.s)((()=>n(e).then((e=>i.setState(e,!0)))),500,!0),"label_registry_updated"),o=(e,i)=>(0,a.N)("_labelRegistry",n,r,e,i),l=(e,i)=>e.callWS({type:"config/label_registry/create",...i}),c=(e,i,t)=>e.callWS({type:"config/label_registry/update",label_id:i,...t})},5845:(e,i,t)=>{t.d(i,{E:()=>n});var a=t(5461),s=t(9534),d=t(196);const n=e=>(0,a.A)(null,(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,d.MZ)({attribute:!1})],key:"hass",value:void 0},{kind:"field",key:"hassSubscribeRequiredHostProps",value:void 0},{kind:"field",key:"__unsubs",value:void 0},{kind:"method",key:"connectedCallback",value:function(){(0,s.A)(t,"connectedCallback",this,3)([]),this.__checkSubscribed()}},{kind:"method",key:"disconnectedCallback",value:function(){if((0,s.A)(t,"disconnectedCallback",this,3)([]),this.__unsubs){for(;this.__unsubs.length;){const e=this.__unsubs.pop();e instanceof Promise?e.then((e=>e())):e()}this.__unsubs=void 0}}},{kind:"method",key:"updated",value:function(e){if((0,s.A)(t,"updated",this,3)([e]),e.has("hass"))this.__checkSubscribed();else if(this.hassSubscribeRequiredHostProps)for(const i of e.keys())if(this.hassSubscribeRequiredHostProps.includes(i))return void this.__checkSubscribed()}},{kind:"method",key:"hassSubscribe",value:function(){return[]}},{kind:"method",key:"__checkSubscribed",value:function(){void 0===this.__unsubs&&this.isConnected&&void 0!==this.hass&&!this.hassSubscribeRequiredHostProps?.some((e=>void 0===this[e]))&&(this.__unsubs=this.hassSubscribe())}}]}}),e)}};
//# sourceMappingURL=SeoCtifH.js.map