iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 23.1 kB
JavaScript
export const __rspack_esm_id=25529;export const __rspack_esm_ids=[25529];export const __webpack_modules__={15090(e,t,i){i.d(t,{nP:()=>c,vB:()=>r});i(44114),i(18111),i(22489),i(61701),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698);var a=i(22675),n=i(52220),o=i(71727),s=i(69093);const r={alarm_control_panel:["armed_away","armed_custom_bypass","armed_home","armed_night","armed_vacation","arming","disarmed","disarming","pending","triggered"],alert:["on","off","idle"],assist_satellite:["idle","listening","responding","processing"],automation:["on","off"],binary_sensor:["on","off"],button:[],calendar:["on","off"],camera:["idle","recording","streaming"],cover:["closed","closing","open","opening"],device_tracker:["home","not_home"],fan:["on","off"],humidifier:["on","off"],infrared:[],input_boolean:["on","off"],input_button:[],lawn_mower:["error","paused","mowing","returning","docked"],light:["on","off"],lock:["jammed","locked","locking","unlocked","unlocking","opening","open"],media_player:["off","on","idle","playing","paused","standby","buffering"],person:["home","not_home"],plant:["ok","problem"],radio_frequency:[],remote:["on","off"],scene:[],schedule:["on","off"],script:["on","off"],siren:["on","off"],sun:["above_horizon","below_horizon"],switch:["on","off"],timer:["active","idle","paused"],update:["on","off"],vacuum:["cleaning","docked","error","idle","paused","returning"],valve:["closed","closing","open","opening"],weather:["clear-night","cloudy","exceptional","fog","hail","lightning-rainy","lightning","partlycloudy","pouring","rainy","snowy-rainy","snowy","sunny","windy-variant","windy"]},l={alarm_control_panel:{code_format:["number","text"]},binary_sensor:{device_class:["battery","battery_charging","co","cold","connectivity","door","garage_door","gas","heat","light","lock","moisture","motion","moving","occupancy","opening","plug","power","presence","problem","running","safety","smoke","sound","tamper","update","vibration","window"]},button:{device_class:["restart","update"]},camera:{frontend_stream_type:["hls","web_rtc"]},climate:{hvac_action:["off","idle","preheating","defrosting","heating","cooling","drying","fan"]},cover:{device_class:["awning","blind","curtain","damper","door","garage","gate","shade","shutter","window"]},device_tracker:{source_type:["bluetooth","bluetooth_le","gps","router"]},fan:{direction:["forward","reverse"]},humidifier:{device_class:["humidifier","dehumidifier"],action:["off","idle","humidifying","drying"]},media_player:{device_class:["tv","speaker","receiver"],media_content_type:["album","app","artist","channel","channels","composer","contributing_artist","episode","game","genre","image","movie","music","playlist","podcast","season","track","tvshow","url","video"],repeat:["off","one","all"]},number:{device_class:["temperature"]},sensor:{device_class:["apparent_power","aqi","battery","carbon_dioxide","carbon_monoxide","current","date","duration","energy","frequency","gas","humidity","illuminance","monetary","nitrogen_dioxide","nitrogen_monoxide","nitrous_oxide","ozone","ph","pm1","pm10","pm25","pm4","power_factor","power","pressure","reactive_power","signal_strength","sulphur_dioxide","temperature","timestamp","uptime","volatile_organic_compounds","volatile_organic_compounds_parts","voltage","volume_flow_rate"],state_class:["measurement","total","total_increasing"]},switch:{device_class:["outlet","switch"]},update:{device_class:["firmware"]},water_heater:{away_mode:["on","off"]}},c=(e,t,i=void 0)=>{const c=(0,s.t)(t),d=[];switch(d.push(...((e,t,i)=>{const s=[];switch(i||s.push(a.Hh,a.HV),!i&&t in r?s.push(...r[t]):i&&t in l&&i in l[t]&&s.push(...l[t][i]),t){case"device_tracker":case"person":i||s.push(...Object.entries(e.states).filter(([e,t])=>"zone"===(0,o.m)(e)&&"zone.home"!==e&&t.attributes.friendly_name).map(([e,t])=>t.attributes.friendly_name).sort((t,i)=>(0,n.xL)(t,i,e.locale.language)))}return s})(e,c,i)),c){case"climate":i?"fan_mode"===i?d.push(...t.attributes.fan_modes):"preset_mode"===i?d.push(...t.attributes.preset_modes):"swing_mode"===i?d.push(...t.attributes.swing_modes):"swing_horizontal_mode"===i&&d.push(...t.attributes.swing_horizontal_modes):d.push(...t.attributes.hvac_modes);break;case"event":"event_type"===i&&d.push(...t.attributes.event_types);break;case"fan":"preset_mode"===i&&d.push(...t.attributes.preset_modes);break;case"humidifier":"mode"===i&&d.push(...t.attributes.available_modes);break;case"input_select":case"select":i||d.push(...t.attributes.options);break;case"light":"effect"===i&&t.attributes.effect_list?d.push(...t.attributes.effect_list):"color_mode"===i&&t.attributes.supported_color_modes&&d.push(...t.attributes.supported_color_modes);break;case"media_player":"sound_mode"===i?d.push(...t.attributes.sound_mode_list):"source"===i&&d.push(...t.attributes.source_list);break;case"remote":"current_activity"===i&&d.push(...t.attributes.activity_list);break;case"sensor":i||"enum"!==t.attributes.device_class||d.push(...t.attributes.options);break;case"vacuum":"fan_speed"===i&&d.push(...t.attributes.fan_speed_list);break;case"water_heater":i&&"operation_mode"!==i||d.push(...t.attributes.operation_list)}return[...new Set(d)]}},90085(e,t,i){i.d(t,{_:()=>o});var a=i(63533),n=i(45291);const o=()=>(0,a.YP)((0,a.Yj)(),"custom element type",n.c8)},58548(e,t,i){i.d(t,{A:()=>n});const a=e=>{const t=parseFloat(e);if(isNaN(t))throw new Error(`${e} is not a number`);return t};function n(e){if(!e)return null;try{if(e.endsWith("%"))return{w:100,h:a(e.slice(0,-1))};const t=e.replace(":","x").split("x");return 0===t.length?null:1===t.length?{w:a(t[0]),h:1}:{w:a(t[0]),h:a(t[1])}}catch(e){}return null}},37532(e,t,i){i.a(e,async function(e,t){try{i(44114),i(18111),i(20116);var a=i(62826),n=i(5124),o=i(22441),s=i(22786),r=i(1087),l=i(52220),c=i(38508),d=e([c]);c=(d.then?(await d)():d)[0];const h="default",u=[{name:"primary",weight:1}];class p extends n.WF{render(){return n.qy` <ha-generic-picker .label="${this.label??this.hass?.localize("ui.components.theme-picker.theme")??"Theme"}" .placeholder="${this.noThemeLabel??this.hass?.localize("ui.components.theme-picker.no_theme")}" .helper="${this.helper}" .value="${this.value}" .valueRenderer="${this._valueRenderer}" .getItems="${this._getItems}" .searchKeys="${u}" .disabled="${this.disabled}" .required="${this.required}" -changed="${this._changed}"></ha-generic-picker> `}_changed(e){e.stopPropagation(),this.value=e.detail.value,(0,r.r)(this,"value-changed",{value:this.value})}constructor(...e){super(...e),this.includeDefault=!1,this.disabled=!1,this.required=!1,this._getThemeOptions=(0,s.A)((e,t,i)=>{const a=[];i&&a.push({id:h,primary:"ioBroker"});const n=Object.keys(e).sort((e,i)=>(0,l.SH)(e,i,t));for(const e of n)a.push({id:e,primary:e});return a}),this._getItems=()=>this._getThemeOptions(this.hass?.themes.themes||{},this.hass?.locale.language||"en",this.includeDefault),this._valueRenderer=e=>n.qy`<span slot="headline">${this._getItems().find(t=>t.id===e)?.primary??e}</span>`}}p.styles=n.AH`ha-generic-picker{width:100%;display:block}`,(0,a.Cg)([(0,o.MZ)()],p.prototype,"value",void 0),(0,a.Cg)([(0,o.MZ)()],p.prototype,"label",void 0),(0,a.Cg)([(0,o.MZ)()],p.prototype,"helper",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"include-default",type:Boolean})],p.prototype,"includeDefault",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],p.prototype,"disabled",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean})],p.prototype,"required",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"no-theme-label"})],p.prototype,"noThemeLabel",void 0),p=(0,a.Cg)([(0,o.EM)("ha-theme-picker")],p),t()}catch(e){t(e)}})},17022(e,t,i){i.d(t,{A1:()=>a,CY:()=>s,Fn:()=>n,Jz:()=>l,St:()=>r,VA:()=>d,WI:()=>h,iY:()=>c,xw:()=>o});const a=(e,t)=>e.callWS({type:"media_source/resolve_media",media_content_id:t}),n=(e,t)=>e.callWS({type:"media_source/browse_media",media_content_id:t}),o="__MANUAL_ENTRY__",s=e=>e.startsWith(o),r=e=>e.startsWith("media-source://"),l=e=>e.startsWith("media-source://media_source"),c=e=>e.startsWith("media-source://image_upload"),d=async(e,t,i)=>{const a=new FormData;a.append("media_content_id",t),a.append("file",i);const n=await e.fetchWithAuth("/api/media_source/local_source/upload",{method:"POST",body:a});if(413===n.status)throw new Error(`Uploaded file is too large (${i.name})`);if(200!==n.status)throw new Error("Unknown error");return n.json()},h=async(e,t)=>e.callWS({type:"media_source/local_source/remove",media_content_id:t})},59927(e,t,i){i.a(e,async function(e,a){try{i.r(t),i.d(t,{HuiEntitiesCardEditor:()=>O});var n=i(62826),o=i(5124),s=i(22441),r=i(22786),l=i(63533),c=i(1087),d=i(90085),h=(i(76776),i(6),i(47680),i(59646)),u=i(37532),p=i(91485),g=i(45291),_=i(97735),m=i(20939),f=i(9169),y=i(30345),v=i(29599),b=i(22357),w=i(81287),k=i(88170),$=i(91408),q=i(84698),C=i(55904),x=i(20507),E=i(7382),z=e([h,u,p,v,b,w,_]);[h,u,p,v,b,w,_]=z.then?(await z)():z;const j=(0,l.Ik)({type:(0,l.eu)("button"),entity:(0,l.lq)((0,l.Yj)()),name:(0,l.lq)((0,l.Yj)()),icon:(0,l.lq)((0,l.Yj)()),action_name:(0,l.lq)((0,l.Yj)()),tap_action:$.kn,hold_action:(0,l.lq)($.kn),double_tap_action:(0,l.lq)($.kn)}),Y=(0,l.Ik)({type:(0,l.eu)("cast"),view:(0,l.lq)((0,l.KC)([(0,l.Yj)(),(0,l.ai)()])),dashboard:(0,l.lq)((0,l.Yj)()),name:(0,l.lq)((0,l.Yj)()),icon:(0,l.lq)((0,l.Yj)()),hide_if_unavailable:(0,l.lq)((0,l.zM)())}),L=(0,l.Ik)({type:(0,l.vP)(["call-service","perform-action"]),name:(0,l.Yj)(),service:(0,l.lq)((0,l.Yj)()),action:(0,l.lq)((0,l.Yj)()),icon:(0,l.lq)((0,l.Yj)()),action_name:(0,l.lq)((0,l.Yj)()),service_data:(0,l.lq)((0,l.bz)()),data:(0,l.lq)((0,l.bz)())}),M=(0,l.Ik)({type:(0,l.eu)("conditional"),row:(0,l.bz)(),conditions:(0,l.YO)((0,l.bz)())}),V=(0,l.Ik)({type:(0,l.eu)("divider"),style:(0,l.lq)((0,l.bz)())}),H=(0,l.Ik)({type:(0,l.eu)("section"),label:(0,l.lq)((0,l.Yj)())}),I=(0,l.Ik)({type:(0,l.eu)("weblink"),url:(0,l.Yj)(),name:(0,l.lq)((0,l.Yj)()),icon:(0,l.lq)((0,l.Yj)())}),Z=(0,l.Ik)({type:(0,l.eu)("buttons"),entities:(0,l.YO)(C.J)}),W=(0,l.Ik)({type:(0,l.eu)("attribute"),entity:(0,l.Yj)(),attribute:(0,l.Yj)(),prefix:(0,l.lq)((0,l.Yj)()),suffix:(0,l.lq)((0,l.Yj)()),name:(0,l.lq)((0,l.Yj)()),icon:(0,l.lq)((0,l.Yj)()),format:(0,l.lq)((0,l.vP)(f.j))}),A=(0,l.Ik)({type:(0,l.eu)("text"),name:(0,l.Yj)(),text:(0,l.Yj)(),icon:(0,l.lq)((0,l.Yj)())}),P=(0,l.NW)({type:(0,d._)()}),S=(0,l.OR)(e=>{if(e&&"object"==typeof e&&"type"in e){if((0,g.c8)(e.type))return P;switch(e.type){case"attribute":return W;case"button":return j;case"buttons":return Z;case"perform-action":case"call-service":return L;case"cast":return Y;case"conditional":return M;case"divider":return V;case"section":return H;case"text":return A;case"weblink":return I}}return x.l}),T=(0,l.kp)(q.H,(0,l.Ik)({title:(0,l.lq)((0,l.KC)([(0,l.Yj)(),(0,l.zM)()])),entity:(0,l.lq)((0,l.Yj)()),theme:(0,l.lq)((0,l.Yj)()),icon:(0,l.lq)((0,l.Yj)()),show_header_toggle:(0,l.lq)((0,l.zM)()),state_color:(0,l.lq)((0,l.zM)()),entities:(0,l.YO)(S),header:(0,l.lq)(y.zb),footer:(0,l.lq)(y.zb)}));class O extends o.WF{setConfig(e){(0,l.vA)(e,T),this._config=e,this._configEntities=(0,k._)(e.entities)}get _title(){return this._config.title||""}get _theme(){return this._config.theme||""}render(){return this.hass&&this._config?this._subElementEditorConfig?o.qy` <hui-sub-element-editor .hass="${this.hass}" .config="${this._subElementEditorConfig}" -back="${this._goBack}" -changed="${this._handleSubElementChanged}"> </hui-sub-element-editor> `:o.qy` <div class="card-config"> <ha-input .label="${this.hass.localize("ui.panel.lovelace.editor.card.generic.title")} (${this.hass.localize("ui.panel.lovelace.editor.card.config.optional")})" .value="${this._title}" .configValue="${"title"}" ="${this._valueChanged}"></ha-input> <ha-theme-picker .hass="${this.hass}" .value="${this._theme}" .label="${`${this.hass.localize("ui.panel.lovelace.editor.card.generic.theme")} (${this.hass.localize("ui.panel.lovelace.editor.card.config.optional")})`}" .configValue="${"theme"}" -changed="${this._valueChanged}"></ha-theme-picker> <div class="side-by-side"> <ha-formfield .label="${this.hass.localize("ui.panel.lovelace.editor.card.entities.show_header_toggle")}"> <ha-switch .checked="${this._showHeaderToggle(this._config)}" .configValue="${"show_header_toggle"}" ="${this._valueChanged}"></ha-switch> </ha-formfield> <ha-formfield .label="${this.hass.localize("ui.panel.lovelace.editor.card.generic.state_color")}"> <ha-switch .checked="${this._config.state_color}" .configValue="${"state_color"}" ="${this._valueChanged}"></ha-switch> </ha-formfield> </div> <hui-header-footer-editor .hass="${this.hass}" .configValue="${"header"}" .config="${this._config.header}" -changed="${this._valueChanged}" -detail-element="${this._editDetailElement}"></hui-header-footer-editor> <hui-header-footer-editor .hass="${this.hass}" .configValue="${"footer"}" .config="${this._config.footer}" -changed="${this._valueChanged}" -detail-element="${this._editDetailElement}"></hui-header-footer-editor> </div> <hui-entities-card-row-editor .hass="${this.hass}" .entities="${this._configEntities}" -changed="${this._valueChanged}" -detail-element="${this._editDetailElement}"></hui-entities-card-row-editor> `:o.s6}_valueChanged(e){if(e.stopPropagation(),!this._config||!this.hass)return;const t=e.target,i=t.configValue||this._subElementEditorConfig?.type,a=void 0!==t.checked?t.checked:t.value||e.detail.config||e.detail.value;if(!("title"===i&&t.value===this._title||"theme"===i&&t.value===this._theme)){if("row"===i||e.detail&&e.detail.entities){const t=e.detail.entities||this._configEntities.concat();"row"===i&&(a?t[this._subElementEditorConfig.index]=a:(t.splice(this._subElementEditorConfig.index,1),this._goBack()),this._subElementEditorConfig.elementConfig=a),this._config={...this._config,entities:t},this._configEntities=(0,k._)(this._config.entities)}else i&&(""===a?(this._config={...this._config},delete this._config[i]):this._config={...this._config,[i]:a});(0,c.r)(this,"config-changed",{config:this._config})}}_handleSubElementChanged(e){if(e.stopPropagation(),!this._config||!this.hass)return;const t=this._subElementEditorConfig?.type,i=e.detail.config;if("row"===t){const e=this._configEntities.concat();i?e[this._subElementEditorConfig.index]=i:(e.splice(this._subElementEditorConfig.index,1),this._goBack()),this._config={...this._config,entities:e},this._configEntities=(0,k._)(this._config.entities)}else t&&(""===i?(this._config={...this._config},delete this._config[t]):this._config={...this._config,[t]:i});this._subElementEditorConfig={...this._subElementEditorConfig,elementConfig:i},(0,c.r)(this,"config-changed",{config:this._config})}_editDetailElement(e){this._subElementEditorConfig=e.detail.subElementConfig}_goBack(){this._subElementEditorConfig=void 0}static get styles(){return[E.U,o.AH`.edit-entity-row-header{display:flex;justify-content:space-between;align-items:center;font-size:var(--ha-font-size-l)}hui-header-footer-editor{padding-top:var(--ha-space-1)}ha-input{--ha-input-padding-bottom:var(--ha-space-4)}`]}constructor(...e){super(...e),this._showHeaderToggle=(0,r.A)(e=>void 0!==e.show_header_toggle?e.show_header_toggle:(0,_.y)(e,(0,m.L)(e.entities)))}}(0,n.Cg)([(0,s.MZ)({attribute:!1})],O.prototype,"hass",void 0),(0,n.Cg)([(0,s.wk)()],O.prototype,"_config",void 0),(0,n.Cg)([(0,s.wk)()],O.prototype,"_configEntities",void 0),(0,n.Cg)([(0,s.wk)()],O.prototype,"_subElementEditorConfig",void 0),O=(0,n.Cg)([(0,s.EM)("hui-entities-card-editor")],O),a()}catch(e){a(e)}})},29599(e,t,i){i.a(e,async function(e,t){try{var a=i(62826),n=i(5124),o=i(22441),s=i(1087),r=i(26300),l=i(9693),c=e([r]);r=(c.then?(await c)():c)[0];const d="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",h="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",u="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class p extends n.WF{render(){return n.qy` <div> <span> ${this.hass.localize(`ui.panel.lovelace.editor.header-footer.${this.configValue}`)}: ${this.config?.type?this.hass.localize(`ui.panel.lovelace.editor.header-footer.types.${this.config?.type}.name`):this.hass.localize("ui.panel.lovelace.editor.common.none")} </span> </div> <div> ${this.config?.type?n.qy` <ha-icon-button .label="${this.hass.localize("ui.panel.lovelace.editor.common.clear")}" .path="${d}" class="remove-icon" ="${this._delete}"></ha-icon-button> <ha-icon-button .label="${this.hass.localize("ui.panel.lovelace.editor.common.edit")}" .path="${h}" class="edit-icon" ="${this._edit}"></ha-icon-button> `:n.qy` <ha-icon-button .label="${this.hass.localize("ui.panel.lovelace.editor.common.add")}" .path="${u}" class="add-icon" ="${this._add}"></ha-icon-button> `} </div> `}_edit(){(0,s.r)(this,"edit-detail-element",{subElementConfig:{elementConfig:this.config,type:this.configValue}})}_add(){(0,l.S)(this,{pickHeaderFooter:e=>this._elementPicked(e),type:this.configValue})}_elementPicked(e){(0,s.r)(this,"value-changed",{value:e}),(0,s.r)(this,"edit-detail-element",{subElementConfig:{elementConfig:e,type:this.configValue}})}_delete(){(0,s.r)(this,"value-changed",{value:""})}}p.styles=n.AH`:host{font-size:var(--ha-font-size-l);display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;padding-bottom:12px}:host>div{display:flex;align-items:center}.header-footer-icon,ha-icon-button{--ha-icon-button-size:36px;color:var(--secondary-text-color)}.header-footer-icon{padding-right:8px;padding-inline-end:8px;padding-inline-start:initial}`,(0,a.Cg)([(0,o.MZ)({attribute:!1})],p.prototype,"config",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],p.prototype,"configValue",void 0),p=(0,a.Cg)([(0,o.EM)("hui-header-footer-editor")],p),t()}catch(e){t(e)}})},9693(e,t,i){i.d(t,{S:()=>o});var a=i(1087);const n=()=>i.e(25897).then(i.bind(i,59152)),o=(e,t)=>{(0,a.r)(e,"show-dialog",{dialogTag:"hui-dialog-create-headerfooter",dialogImport:n,dialogParams:t})}},22357(e,t,i){i.a(e,async function(e,t){try{i(88454),i(29452);var a=i(62826),n=i(5124),o=i(22441),s=i(75751),r=i(1087),l=i(82474),c=i(26300),d=(i(85938),i(67094),e([l,c]));[l,c]=d.then?(await d)():d;const h="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",u="M21 11H3V9H21V11M21 13H3V15H21V13Z",p="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z";class g extends n.WF{_getKey(e){return this._entityKeys.has(e)||this._entityKeys.set(e,Math.random().toString()),this._entityKeys.get(e)}render(){return this.entities&&this.hass?n.qy` <h3> ${this.label||`${this.hass.localize("ui.panel.lovelace.editor.card.generic.entities")} (${this.hass.localize("ui.panel.lovelace.editor.card.config.required")})`} </h3> <ha-sortable handle-selector=".handle" -moved="${this._rowMoved}"> <div class="entities"> ${(0,s.u)(this.entities,e=>this._getKey(e),(e,t)=>n.qy` <div class="entity"> <div class="handle"> <ha-svg-icon .path="${u}"></ha-svg-icon> </div> ${e.type?n.qy` <div class="special-row"> <div> <span> ${this.hass.localize(`ui.panel.lovelace.editor.card.entities.entity_row.${e.type}`)} </span> <span class="secondary">${this.hass.localize("ui.panel.lovelace.editor.card.entities.edit_special_row")}</span> </div> </div> `:n.qy` <ha-entity-picker hide-clear-icon .hass="${this.hass}" .value="${e.entity}" .index="${t}" -changed="${this._valueChanged}"></ha-entity-picker> `} <ha-icon-button .label="${this.hass.localize("ui.components.entity.entity-picker.clear")}" .path="${h}" class="remove-icon" .index="${t}" ="${this._removeRow}"></ha-icon-button> <ha-icon-button .label="${this.hass.localize("ui.components.entity.entity-picker.edit")}" .path="${p}" class="edit-icon" .index="${t}" ="${this._editRow}"></ha-icon-button> </div> `)} </div> </ha-sortable> <ha-entity-picker class="add-entity" .hass="${this.hass}" -changed="${this._addEntity}" add-button></ha-entity-picker> `:n.s6}async _addEntity(e){const t=e.detail.value;if(""===t)return;const i=this.entities.concat({entity:t});e.target.value="",(0,r.r)(this,"entities-changed",{entities:i})}_rowMoved(e){e.stopPropagation();const{oldIndex:t,newIndex:i}=e.detail,a=this.entities.concat();a.splice(i,0,a.splice(t,1)[0]),(0,r.r)(this,"entities-changed",{entities:a})}_removeRow(e){const t=e.currentTarget.index,i=this.entities.concat();i.splice(t,1),(0,r.r)(this,"entities-changed",{entities:i})}_valueChanged(e){const t=e.detail.value,i=e.target.index,a=this.entities.concat();""===t||void 0===t?a.splice(i,1):a[i]={...a[i],entity:t},(0,r.r)(this,"entities-changed",{entities:a})}_editRow(e){const t=e.currentTarget.index;(0,r.r)(this,"edit-detail-element",{subElementConfig:{index:t,type:"row",elementConfig:this.entities[t]}})}constructor(...e){super(...e),this._entityKeys=new WeakMap}}g.styles=n.AH`ha-entity-picker{margin-top:var(--ha-space-2)}ha-sortable ha-entity-picker{margin-top:0}.add-entity{display:block;margin-bottom:var(--ha-space-1);margin-left:31px;margin-right:71px;margin-inline-start:31px;margin-inline-end:71px;direction:var(--direction)}.entity{display:flex;align-items:center;margin-top:var(--ha-space-2)}.entity .handle{padding-right:8px;cursor:move;cursor:grab;padding-inline-end:8px;padding-inline-start:initial;direction:var(--direction)}.entity .handle>*{pointer-events:none}.entity ha-entity-picker{flex-grow:1;min-width:0}.special-row{height:60px;font-size:var(--ha-font-size-l);display:flex;align-items:center;justify-content:space-between;flex-grow:1}.special-row div{display:flex;flex-direction:column}.edit-icon,.remove-icon{--ha-icon-button-size:36px;color:var(--secondary-text-color)}.secondary{font-size:var(--ha-font-size-s);color:var(--secondary-text-color)}`,(0,a.Cg)([(0,o.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],g.prototype,"entities",void 0),(0,a.Cg)([(0,o.MZ)()],g.prototype,"label",void 0),g=(0,a.Cg)([(0,o.EM)("hui-entities-card-row-editor")],g),t()}catch(e){t(e)}})},55904(e,t,i){i.d(t,{J:()=>o});var a=i(63533),n=i(91408);const o=(0,a.Ik)({entity:(0,a.Yj)(),name:(0,a.lq)((0,a.Yj)()),icon:(0,a.lq)((0,a.Yj)()),image:(0,a.lq)((0,a.Yj)()),show_name:(0,a.lq)((0,a.zM)()),show_icon:(0,a.lq)((0,a.zM)()),tap_action:(0,a.lq)(n.kn),hold_action:(0,a.lq)(n.kn),double_tap_action:(0,a.lq)(n.kn)})},30345(e,t,i){i.d(t,{oe:()=>l,zb:()=>c});var a=i(63533),n=i(91408),o=i(55904);const s=(0,a.Ik)({type:(0,a.Yj)(),image:(0,a.Yj)(),tap_action:(0,a.lq)(n.kn),hold_action:(0,a.lq)(n.kn),double_tap_action:(0,a.lq)(n.kn),alt_text:(0,a.lq)((0,a.Yj)())}),r=(0,a.Ik)({type:(0,a.Yj)(),entities:(0,a.YO)(o.J)}),l=(0,a.Ik)({type:(0,a.Yj)(),entity:(0,a.Yj)(),detail:(0,a.lq)((0,a.ai)()),hours_to_show:(0,a.lq)((0,a.ai)())}),c=(0,a.OR)(e=>{if(e&&"object"==typeof e&&"type"in e)switch(e.type){case"buttons":return r;case"graph":return l;case"picture":return s}return(0,a.KC)([r,l,s])})}};