"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["440"],{15163:function(e,t,a){a.r(t),a.d(t,{HaSelectorSelector:function(){return u}});a(35748),a(65315),a(37089),a(12977),a(95013);var o=a(69868),l=a(84922),n=a(11991),s=a(65940),i=a(44017);a(60921);let r,c,m=e=>e;const p={number:{min:1,max:100}},d={action:[],area:[{name:"multiple",selector:{boolean:{}}}],attribute:[{name:"entity_id",selector:{entity:{}}}],boolean:[],color_temp:[{name:"unit",selector:{select:{options:["kelvin","mired"]}}},{name:"min",selector:{number:{mode:"box"}}},{name:"max",selector:{number:{mode:"box"}}}],condition:[],date:[],datetime:[],device:[{name:"multiple",selector:{boolean:{}}}],duration:[{name:"enable_day",selector:{boolean:{}}},{name:"enable_millisecond",selector:{boolean:{}}}],entity:[{name:"multiple",selector:{boolean:{}}}],floor:[{name:"multiple",selector:{boolean:{}}}],icon:[],location:[],media:[{name:"accept",selector:{text:{multiple:!0}}}],number:[{name:"min",selector:{number:{mode:"box",step:"any"}}},{name:"max",selector:{number:{mode:"box",step:"any"}}},{name:"step",selector:{number:{mode:"box",step:"any"}}}],object:[],color_rgb:[],select:[{name:"options",selector:{object:{}}},{name:"multiple",selector:{boolean:{}}}],state:[{name:"entity_id",selector:{entity:{}}},{name:"multiple",selector:{boolean:{}}}],target:[],template:[],text:[{name:"multiple",selector:{boolean:{}}},{name:"multiline",selector:{boolean:{}}},{name:"prefix",selector:{text:{}}},{name:"suffix",selector:{text:{}}}],theme:[],time:[]};class u extends l.WF{shouldUpdate(e){return 1!==e.size||!e.has("hass")}render(){let e,t;if(this._yamlMode)t="manual",e={type:t,manual:this.value};else{t=Object.keys(this.value)[0];const a=Object.values(this.value)[0];e=Object.assign({type:t},"object"==typeof a?a:[])}const a=this._schema(t,this.hass.localize);return(0,l.qy)(r||(r=m`<div> <p>${0}</p> <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}" .narrow="${0}"></ha-form> </div>`),this.label?this.label:"",this.hass,e,a,this._computeLabelCallback,this._valueChanged,this.narrow)}_valueChanged(e){e.stopPropagation();const t=e.detail.value,a=t.type;if(!a||"object"!=typeof t||0===Object.keys(t).length)return;const o=Object.keys(this.value)[0];if("manual"===a&&!this._yamlMode)return this._yamlMode=!0,void this.requestUpdate();if("manual"===a&&void 0===t.manual)return;let l;"manual"!==a&&(this._yamlMode=!1),delete t.type,l="manual"===a?t.manual:a===o?{[a]:Object.assign({},t.manual?t.manual[o]:t)}:{[a]:Object.assign({},p[a])},(0,i.r)(this,"value-changed",{value:l})}constructor(...e){super(...e),this.disabled=!1,this.narrow=!1,this.required=!0,this._yamlMode=!1,this._schema=(0,s.A)((e,t)=>[{name:"type",required:!0,selector:{select:{mode:"dropdown",options:Object.keys(d).concat("manual").map(e=>({label:t(`ui.components.selectors.selector.types.${e}`)||e,value:e}))}}},..."manual"===e?[{name:"manual",selector:{object:{}}}]:[],...d[e]?d[e].length>1?[{name:"",type:"expandable",title:t("ui.components.selectors.selector.options"),schema:d[e]}]:d[e]:[]]),this._computeLabelCallback=e=>this.hass.localize(`ui.components.selectors.selector.${e.name}`)||e.name}}u.styles=(0,l.AH)(c||(c=m`.title{font-size:var(--ha-font-size-l);padding-top:16px;overflow:hidden;text-overflow:ellipsis;margin-bottom:16px;padding-left:16px;padding-right:4px;padding-inline-start:16px;padding-inline-end:4px;white-space:nowrap}`)),(0,o.__decorate)([(0,n.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,o.__decorate)([(0,n.MZ)({attribute:!1})],u.prototype,"value",void 0),(0,o.__decorate)([(0,n.MZ)()],u.prototype,"label",void 0),(0,o.__decorate)([(0,n.MZ)()],u.prototype,"helper",void 0),(0,o.__decorate)([(0,n.MZ)({type:Boolean,reflect:!0})],u.prototype,"disabled",void 0),(0,o.__decorate)([(0,n.MZ)({type:Boolean})],u.prototype,"narrow",void 0),(0,o.__decorate)([(0,n.MZ)({type:Boolean,reflect:!0})],u.prototype,"required",void 0),u=(0,o.__decorate)([(0,n.EM)("ha-selector-selector")],u)}}]);
//# sourceMappingURL=440.f8ac2c7c93c702c8.js.map