export const id=7280;export const ids=[7280];export const modules={8873:(e,t,i)=>{i.d(t,{a:()=>s});var n=i(6601),a=i(9263);function s(e,t){const i=(0,a.m)(e.entity_id),s=void 0!==t?t:e?.state;if(["button","event","input_button","scene"].includes(i))return s!==n.Hh;if((0,n.g0)(s))return!1;if(s===n.KF&&"alert"!==i)return!1;switch(i){case"alarm_control_panel":return"disarmed"!==s;case"alert":return"idle"!==s;case"cover":case"valve":return"closed"!==s;case"device_tracker":case"person":return"not_home"!==s;case"lawn_mower":return["mowing","error"].includes(s);case"lock":return"locked"!==s;case"media_player":return"standby"!==s;case"vacuum":return!["idle","docked","paused"].includes(s);case"plant":return"problem"===s;case"group":return["on","home","open","locked","problem"].includes(s);case"timer":return"active"===s;case"camera":return"streaming"===s}return!0}},8889:(e,t,i)=>{i.d(t,{n:()=>a});const n=/^(\w+)\.(\w+)$/,a=e=>n.test(e)},5067:(e,t,i)=>{var n=i(5461),a=(i(9484),i(8597)),s=i(196),l=i(5081),r=i(3167),d=i(9263),o=i(1330),u=i(8848),c=(i(6442),i(6396),i(9222),i(185),i(6412));const h=()=>i.e(2882).then(i.bind(i,2882));var y=i(1238),m=i(3135);const p="___create-new-entity___";(0,n.A)([(0,s.EM)("ha-entity-picker")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,s.MZ)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.MZ)({type:Boolean})],key:"autofocus",value(){return!1}},{kind:"field",decorators:[(0,s.MZ)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,s.MZ)({type:Boolean})],key:"required",value(){return!1}},{kind:"field",decorators:[(0,s.MZ)({type:Boolean,attribute:"allow-custom-entity"})],key:"allowCustomEntity",value:void 0},{kind:"field",decorators:[(0,s.MZ)()],key:"label",value:void 0},{kind:"field",decorators:[(0,s.MZ)()],key:"value",value:void 0},{kind:"field",decorators:[(0,s.MZ)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,s.MZ)({type:Array})],key:"createDomains",value:void 0},{kind:"field",decorators:[(0,s.MZ)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,s.MZ)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,s.MZ)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,s.MZ)({type:Array,attribute:"include-unit-of-measurement"})],key:"includeUnitOfMeasurement",value:void 0},{kind:"field",decorators:[(0,s.MZ)({type:Array,attribute:"include-entities"})],key:"includeEntities",value:void 0},{kind:"field",decorators:[(0,s.MZ)({type:Array,attribute:"exclude-entities"})],key:"excludeEntities",value:void 0},{kind:"field",decorators:[(0,s.MZ)({attribute:!1})],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,s.MZ)({type:Boolean})],key:"hideClearIcon",value(){return!1}},{kind:"field",decorators:[(0,s.MZ)({attribute:"item-label-path"})],key:"itemLabelPath",value(){return"friendly_name"}},{kind:"field",decorators:[(0,s.wk)()],key:"_opened",value(){return!1}},{kind:"field",decorators:[(0,s.P)("ha-combo-box",!0)],key:"comboBox",value:void 0},{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:"_initedStates",value(){return!1}},{kind:"field",key:"_states",value(){return[]}},{kind:"field",key:"_rowRenderer",value(){return e=>a.qy`<ha-list-item graphic="avatar" .twoline=${!!e.entity_id}>
      ${e.state?a.qy`<state-badge
            slot="graphic"
            .stateObj=${e}
            .hass=${this.hass}
          ></state-badge>`:""}
      <span>${e.friendly_name}</span>
      <span slot="secondary"
        >${e.entity_id.startsWith(p)?this.hass.localize("ui.components.entity.entity-picker.new_entity"):e.entity_id}</span
      >
    </ha-list-item>`}},{kind:"field",key:"_getStates",value(){return(0,l.A)(((e,t,i,n,a,s,l,r,u,h)=>{let _=[];if(!t)return[];let v=Object.keys(t.states);const f=h?.length?h.map((e=>{const i=t.localize("ui.components.entity.entity-picker.create_helper",{domain:(0,m.z)(e)?t.localize(`ui.panel.config.helpers.types.${e}`):(0,y.p$)(t.localize,e)});return{entity_id:p+e,state:"on",last_changed:"",last_updated:"",context:{id:"",user_id:null,parent_id:null},friendly_name:i,attributes:{icon:"mdi:plus"},strings:[e,i]}})):[];return v.length?r?(v=v.filter((e=>this.includeEntities.includes(e))),v.map((e=>{const i=(0,o.u)(t.states[e])||e;return{...t.states[e],friendly_name:i,strings:[e,i]}})).sort(((e,t)=>(0,c.S)(e.friendly_name,t.friendly_name,this.hass.locale.language)))):(u&&(v=v.filter((e=>!u.includes(e)))),i&&(v=v.filter((e=>i.includes((0,d.m)(e))))),n&&(v=v.filter((e=>!n.includes((0,d.m)(e))))),_=v.map((e=>{const i=(0,o.u)(t.states[e])||e;return{...t.states[e],friendly_name:i,strings:[e,i]}})).sort(((e,t)=>(0,c.S)(e.friendly_name,t.friendly_name,this.hass.locale.language))),s&&(_=_.filter((e=>e.entity_id===this.value||e.attributes.device_class&&s.includes(e.attributes.device_class)))),l&&(_=_.filter((e=>e.entity_id===this.value||e.attributes.unit_of_measurement&&l.includes(e.attributes.unit_of_measurement)))),a&&(_=_.filter((e=>e.entity_id===this.value||a(e)))),_.length?(f?.length&&_.push(...f),_):[{entity_id:"",state:"",last_changed:"",last_updated:"",context:{id:"",user_id:null,parent_id:null},friendly_name:this.hass.localize("ui.components.entity.entity-picker.no_match"),attributes:{friendly_name:this.hass.localize("ui.components.entity.entity-picker.no_match"),icon:"mdi:magnify"},strings:[]},...f]):[{entity_id:"",state:"",last_changed:"",last_updated:"",context:{id:"",user_id:null,parent_id:null},friendly_name:this.hass.localize("ui.components.entity.entity-picker.no_entities"),attributes:{friendly_name:this.hass.localize("ui.components.entity.entity-picker.no_entities"),icon:"mdi:magnify"},strings:[]},...f]}))}},{kind:"method",key:"shouldUpdate",value:function(e){return!!(e.has("value")||e.has("label")||e.has("disabled"))||!(!e.has("_opened")&&this._opened)}},{kind:"method",key:"willUpdate",value:function(e){(!this._initedStates||e.has("_opened")&&this._opened)&&(this._states=this._getStates(this._opened,this.hass,this.includeDomains,this.excludeDomains,this.entityFilter,this.includeDeviceClasses,this.includeUnitOfMeasurement,this.includeEntities,this.excludeEntities,this.createDomains),this._initedStates&&(this.comboBox.filteredItems=this._states),this._initedStates=!0),e.has("createDomains")&&this.createDomains?.length&&this.hass.loadFragmentTranslation("config")}},{kind:"method",key:"render",value:function(){return a.qy`
      <ha-combo-box
        item-value-path="entity_id"
        .itemLabelPath=${this.itemLabelPath}
        .hass=${this.hass}
        .value=${this._value}
        .label=${void 0===this.label?this.hass.localize("ui.components.entity.entity-picker.entity"):this.label}
        .helper=${this.helper}
        .allowCustomValue=${this.allowCustomEntity}
        .filteredItems=${this._states}
        .renderer=${this._rowRenderer}
        .required=${this.required}
        .disabled=${this.disabled}
        @opened-changed=${this._openedChanged}
        @value-changed=${this._valueChanged}
        @filter-changed=${this._filterChanged}
      >
      </ha-combo-box>
    `}},{kind:"get",key:"_value",value:function(){return this.value||""}},{kind:"method",key:"_openedChanged",value:function(e){this._opened=e.detail.value}},{kind:"method",key:"_valueChanged",value:function(e){e.stopPropagation();const t=e.detail.value?.trim();if(t&&t.startsWith(p)){const e=t.substring(23);return i=this,n={domain:e,dialogClosedCallback:e=>{e.entityId&&this._setValue(e.entityId)}},void(0,r.r)(i,"show-dialog",{dialogTag:"dialog-helper-detail",dialogImport:h,dialogParams:n})}var i,n;t!==this._value&&this._setValue(t)}},{kind:"method",key:"_filterChanged",value:function(e){const t=e.target,i=e.detail.value.trim().toLowerCase();t.filteredItems=i.length?(0,u.H)(i,this._states):this._states}},{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)}}]}}),a.WF)},6601:(e,t,i)=>{i.d(t,{Hh:()=>a,KF:()=>l,g0:()=>o,s7:()=>r});var n=i(9592);const a="unavailable",s="unknown",l="off",r=[a,s],d=[a,s,l],o=(0,n.g)(r);(0,n.g)(d)},8502:(e,t,i)=>{i.d(t,{c:()=>s});const n=async(e,t,i,a,s,...l)=>{const r=s,d=r[e],o=d=>a&&a(s,d.result)!==d.cacheKey?(r[e]=void 0,n(e,t,i,a,s,...l)):d.result;if(d)return d instanceof Promise?d.then(o):o(d);const u=i(s,...l);return r[e]=u,u.then((i=>{r[e]={result:i,cacheKey:a?.(s,i)},setTimeout((()=>{r[e]=void 0}),t)}),(()=>{r[e]=void 0})),u},a=e=>e.callWS({type:"entity/source"}),s=e=>n("_entitySources",3e4,a,(e=>Object.keys(e.states).length),e)},1238:(e,t,i)=>{i.d(t,{QC:()=>s,fK:()=>a,p$:()=>n});const n=(e,t,i)=>e(`component.${t}.title`)||i?.name||t,a=(e,t)=>{const i={type:"manifest/list"};return t&&(i.integrations=t),e.callWS(i)},s=(e,t)=>e.callWS({type:"manifest/get",integration:t})}};
//# sourceMappingURL=hX78hZDU.js.map