"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["35905"],{93048:function(e,t,n){n.a(e,async function(e,a){try{n.r(t),n.d(t,{HuiEntityBadgeEditor:function(){return j}});n(74423),n(44114),n(62953);var s=n(40445),i=n(96196),o=n(77845),l=n(22786),c=n(63533),d=n(1087),r=n(52763),_=n(67066),h=n(999),p=n(91408),m=n(45031),u=n(44155),y=n(7382),f=n(16161),b=e([r,f,_,h]);[r,f,_,h]=b.then?(await b)():b;let g,C,v=e=>e;const q="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,5Z",w="M4,9H20V11H4V9M4,13H14V15H4V13Z",k=(0,c.kp)(m.y,(0,c.Ik)({entity:(0,c.lq)((0,c.Yj)()),display_type:(0,c.lq)((0,c.vP)(_.rU)),name:(0,c.lq)(u.q),icon:(0,c.lq)((0,c.Yj)()),state_content:(0,c.lq)((0,c.KC)([(0,c.Yj)(),(0,c.YO)((0,c.Yj)())])),color:(0,c.lq)((0,c.Yj)()),show_name:(0,c.lq)((0,c.zM)()),show_state:(0,c.lq)((0,c.zM)()),show_icon:(0,c.lq)((0,c.zM)()),show_entity_picture:(0,c.lq)((0,c.zM)()),tap_action:(0,c.lq)(p.kn),hold_action:(0,c.lq)(p.kn),double_tap_action:(0,c.lq)(p.kn),image:(0,c.lq)((0,c.Yj)())}));class j extends i.WF{setConfig(e){(0,c.vA)(e,k),this._config=Object.assign(Object.assign({},_.PV),(0,_.P8)(e))}render(){if(!this.hass||!this._config)return i.s6;const e=this._schema(this.hass.localize),t=Object.assign(Object.assign({},this._config),{},{displayed_elements:this._displayedElements(this._config)});return(0,i.qy)(g||(g=v` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" .computeHelper="${0}" @value-changed="${0}"></ha-form> `),this.hass,t,e,this._computeLabelCallback,this._computeHelperCallback,this._valueChanged)}_valueChanged(e){if(e.stopPropagation(),!this._config||!this.hass)return;const t=Object.assign({},e.detail.value);t.state_content||delete t.state_content,t.displayed_elements&&(t.show_name=t.displayed_elements.includes("name"),t.show_state=t.displayed_elements.includes("state"),t.show_icon=t.displayed_elements.includes("icon"),delete t.displayed_elements),(0,d.r)(this,"config-changed",{config:t})}static get styles(){return[y.U,(0,i.AH)(C||(C=v`.container{display:flex;flex-direction:column}ha-form{display:block;margin-bottom:24px}`))]}constructor(...e){super(...e),this._schema=(0,l.A)(e=>[{name:"entity",selector:{entity:{}}},{name:"content",type:"expandable",flatten:!0,iconPath:w,schema:[{name:"name",selector:{entity_name:{}},context:{entity:"entity"}},{name:"",type:"grid",schema:[{name:"color",selector:{ui_color:{default_color:"state",include_state:!0}}},{name:"icon",selector:{icon:{}},context:{icon_entity:"entity"}},{name:"show_entity_picture",selector:{boolean:{}}}]},{name:"displayed_elements",selector:{select:{mode:"list",multiple:!0,options:[{value:"name",label:e("ui.panel.lovelace.editor.badge.entity.displayed_elements_options.name")},{value:"state",label:e("ui.panel.lovelace.editor.badge.entity.displayed_elements_options.state")},{value:"icon",label:e("ui.panel.lovelace.editor.badge.entity.displayed_elements_options.icon")}]}}},{name:"state_content",selector:{ui_state_content:{allow_name:!0}},context:{filter_entity:"entity"}}]},{name:"interactions",type:"expandable",flatten:!0,iconPath:q,schema:[{name:"tap_action",selector:{ui_action:{default_action:"more-info"}},context:h.Tq},{name:"",type:"optional_actions",flatten:!0,schema:["hold_action","double_tap_action"].map(e=>({name:e,selector:{ui_action:{default_action:"none"}},context:h.Tq}))}]}]),this._displayedElements=(0,l.A)(e=>{const t=[];return e.show_name&&t.push("name"),e.show_state&&t.push("state"),e.show_icon&&t.push("icon"),t}),this._computeLabelCallback=e=>{switch(e.name){case"color":case"state_content":case"show_entity_picture":case"displayed_elements":return this.hass.localize(`ui.panel.lovelace.editor.badge.entity.${e.name}`);default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)}},this._computeHelperCallback=e=>{if("color"===e.name)return this.hass.localize(`ui.panel.lovelace.editor.badge.entity.${e.name}_helper`)}}}(0,s.Cg)([(0,o.MZ)({attribute:!1})],j.prototype,"hass",void 0),(0,s.Cg)([(0,o.wk)()],j.prototype,"_config",void 0),j=(0,s.Cg)([(0,o.EM)("hui-entity-badge-editor")],j),a()}catch(g){a(g)}})},45031:function(e,t,n){n.d(t,{y:function(){return s}});var a=n(63533);const s=(0,a.Ik)({type:(0,a.Yj)(),visibility:(0,a.bz)(),disabled:(0,a.lq)((0,a.zM)())})}}]);
//# sourceMappingURL=35905.cf04b7471659d218.js.map