iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 28.7 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[95309],{82474:function(t,e,s){s.a(t,async function(t,e){try{s(13609),s(18111),s(20116),s(61701),s(3362),s(62953);var i=s(40445),a=s(5124),o=s(67576),n=s(22786),r=s(1087),h=s(74705),l=s(78649),d=s(53756),c=s(95350),p=s(24367),u=s(19711),g=(s(75064),s(38508)),m=(s(47680),s(67094),s(74281)),v=t([g,m]);[g,m]=v.then?(await v)():v;let y,_,b,f,$,w,x,C,M,k,I,H,O,Z,z,q=t=>t;const E="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",j="M11,13.5V21.5H3V13.5H11M12,2L17.5,11H6.5L12,2M17.5,13C20,13 22,15 22,17.5C22,20 20,22 17.5,22C15,22 13,20 13,17.5C13,15 15,13 17.5,13Z",L="___create-new-entity___";class V extends a.WF{willUpdate(t){var e;this._pendingEntityId&&t.has("hass")&&this.hass.states!==(null===(e=t.get("hass"))||void 0===e?void 0:e.states)&&this.hass.states[this._pendingEntityId]&&(this._setValue(this._pendingEntityId),this._pendingEntityId=void 0)}firstUpdated(t){super.firstUpdated(t),this.hass.loadBackendTranslation("title")}_findExtraOption(t){var e;return t?null===(e=this.extraOptions)||void 0===e?void 0:e.find(e=>e.id===t):void 0}_renderExtraOptionStart(t){const e=t.entity_id?this.hass.states[t.entity_id]:void 0;return e?(0,a.qy)(y||(y=q` <state-badge slot="start" .stateObj="${0}" .hass="${0}"></state-badge> `),e,this.hass):t.icon_path?(0,a.qy)(_||(_=q` <ha-svg-icon slot="start" .path="${0}" style="margin:0 4px"></ha-svg-icon> `),t.icon_path):t.icon?(0,a.qy)(b||(b=q`<ha-icon slot="start" .icon="${0}"></ha-icon>`),t.icon):a.s6}get _showEntityId(){var t;return this.showEntityId||(null===(t=this.hass.userData)||void 0===t?void 0:t.showEntityIdPicker)}_shouldHideClearIcon(){var t;return!(null===(t=this._findExtraOption(this.value))||void 0===t||!t.hide_clear)}render(){var t,e;const s=null!==(t=this.placeholder)&&void 0!==t?t:this.hass.localize("ui.components.entity.entity-picker.placeholder");return(0,a.qy)(f||(f=q` <ha-generic-picker .hass="${0}" .disabled="${0}" .autofocus="${0}" .allowCustomValue="${0}" .required="${0}" .label="${0}" .placeholder="${0}" .helper="${0}" .value="${0}" .searchLabel="${0}" .notFoundLabel="${0}" .rowRenderer="${0}" .getItems="${0}" .getAdditionalItems="${0}" .hideClearIcon="${0}" .searchFn="${0}" .valueRenderer="${0}" .searchKeys="${0}" use-top-label .addButtonLabel="${0}" .unknownItemText="${0}" -changed="${0}"> </ha-generic-picker> `),this.hass,this.disabled,this.autofocus,this.allowCustomEntity,this.required,this.label,s,this.helper,this.addButton?void 0:this.value,this.searchLabel,this._notFoundLabel,this._rowRenderer,this._getItems,this._getAdditionalItems,this.hideClearIcon||this._shouldHideClearIcon(),this._searchFn,this._valueRenderer,d.t,this.addButton?null!==(e=this.addButtonLabel)&&void 0!==e?e:this.hass.localize("ui.components.entity.entity-picker.add"):void 0,this.hass.localize("ui.components.entity.entity-picker.unknown"),this._valueChanged)}async open(){var t;await this.updateComplete,await(null===(t=this._picker)||void 0===t?void 0:t.open())}_valueChanged(t){t.stopPropagation();const e=t.detail.value;if(e){if(e.startsWith(L)){const t=e.substring(L.length);return void(0,u.$)(this,{domain:t,dialogClosedCallback:t=>{t.entityId&&(this.hass.states[t.entityId]?this._setValue(t.entityId):this._pendingEntityId=t.entityId)}})}((0,l.n)(e)||this._findExtraOption(e))&&this._setValue(e)}else this._setValue(void 0)}_setValue(t){this.value=t,(0,r.r)(this,"value-changed",{value:t}),(0,r.r)(this,"change")}constructor(...t){super(...t),this.autofocus=!1,this.disabled=!1,this.required=!1,this.showEntityId=!1,this.hideClearIcon=!1,this.addButton=!1,this._valueRenderer=t=>{const e=t||"",s=this._findExtraOption(e);if(s)return(0,a.qy)($||($=q` ${0} <span slot="headline">${0}</span> ${0} `),this._renderExtraOptionStart(s),s.primary,s.secondary?(0,a.qy)(w||(w=q`<span slot="supporting-text">${0}</span>`),s.secondary):a.s6);const i=this.hass.states[e];if(!i)return(0,a.qy)(x||(x=q` <ha-svg-icon slot="start" .path="${0}" style="margin:0 4px"></ha-svg-icon> <span slot="headline">${0}</span> `),j,e);const{primary:o,secondary:n}=(0,h.Bj)(this.hass,i);return(0,a.qy)(C||(C=q` <state-badge .hass="${0}" .stateObj="${0}" slot="start"></state-badge> <span slot="headline">${0}</span> <span slot="supporting-text">${0}</span> `),this.hass,i,o,n)},this._rowRenderer=(t,e)=>{const s=this._showEntityId;return(0,a.qy)(M||(M=q` <ha-combo-box-item type="button" compact="compact" .borderTop="${0}"> ${0} <span slot="headline">${0}</span> ${0} ${0} ${0} </ha-combo-box-item> `),0!==e,t.icon_path?(0,a.qy)(k||(k=q` <ha-svg-icon slot="start" style="margin:0 4px" .path="${0}"></ha-svg-icon> `),t.icon_path):(0,a.qy)(I||(I=q` <state-badge slot="start" .stateObj="${0}" .hass="${0}"></state-badge> `),t.stateObj,this.hass),t.primary,t.secondary?(0,a.qy)(H||(H=q`<span slot="supporting-text">${0}</span>`),t.secondary):a.s6,t.stateObj&&s?(0,a.qy)(O||(O=q` <span slot="supporting-text" class="code"> ${0} </span> `),t.stateObj.entity_id):a.s6,t.domain_name&&!s?(0,a.qy)(Z||(Z=q` <div slot="trailing-supporting-text" class="domain"> ${0} </div> `),t.domain_name):a.s6)},this._getAdditionalItems=()=>this._getCreateItems(this.hass.localize,this.createDomains),this._getCreateItems=(0,n.A)((t,e)=>null!=e&&e.length?(this.hass.loadFragmentTranslation("config"),e.map(e=>{const s=t("ui.components.entity.entity-picker.create_helper",{domain:(0,p.z)(e)?t(`ui.panel.config.helpers.types.${e}`)||e:(0,c.p$)(t,e)});return{id:L+e,primary:s,secondary:t("ui.components.entity.entity-picker.new_entity"),icon_path:E}})):[]),this._getEntitiesMemoized=(0,n.A)(d.w),this._getItems=()=>{var t;const e=this._getEntitiesMemoized(this.hass,this.includeDomains,this.excludeDomains,this.entityFilter,this.includeDeviceClasses,this.includeUnitOfMeasurement,this.includeEntities,this.excludeEntities,this.value);if(null!==(t=this.extraOptions)&&void 0!==t&&t.length){return[...this.extraOptions.map(t=>Object.assign(Object.assign({},t),{},{stateObj:t.entity_id?this.hass.states[t.entity_id]:void 0})),...e]}return e},this._searchFn=(t,e)=>{const s=e.findIndex(e=>{var s;return(null===(s=e.stateObj)||void 0===s?void 0:s.entity_id)===t});if(-1===s)return e;const[i]=e.splice(s,1);return e.unshift(i),e},this._notFoundLabel=t=>this.hass.localize("ui.components.entity.entity-picker.no_match",{term:(0,a.qy)(z||(z=q`<b>‘${0}’</b>`),t)})}}(0,i.Cg)([(0,o.MZ)({attribute:!1})],V.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],V.prototype,"autofocus",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],V.prototype,"disabled",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],V.prototype,"required",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean,attribute:"allow-custom-entity"})],V.prototype,"allowCustomEntity",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean,attribute:"show-entity-id"})],V.prototype,"showEntityId",void 0),(0,i.Cg)([(0,o.MZ)()],V.prototype,"label",void 0),(0,i.Cg)([(0,o.MZ)()],V.prototype,"value",void 0),(0,i.Cg)([(0,o.MZ)()],V.prototype,"helper",void 0),(0,i.Cg)([(0,o.MZ)()],V.prototype,"placeholder",void 0),(0,i.Cg)([(0,o.MZ)({type:String,attribute:"search-label"})],V.prototype,"searchLabel",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],V.prototype,"createDomains",void 0),(0,i.Cg)([(0,o.MZ)({type:Array,attribute:"include-domains"})],V.prototype,"includeDomains",void 0),(0,i.Cg)([(0,o.MZ)({type:Array,attribute:"exclude-domains"})],V.prototype,"excludeDomains",void 0),(0,i.Cg)([(0,o.MZ)({type:Array,attribute:"include-device-classes"})],V.prototype,"includeDeviceClasses",void 0),(0,i.Cg)([(0,o.MZ)({type:Array,attribute:"include-unit-of-measurement"})],V.prototype,"includeUnitOfMeasurement",void 0),(0,i.Cg)([(0,o.MZ)({type:Array,attribute:"include-entities"})],V.prototype,"includeEntities",void 0),(0,i.Cg)([(0,o.MZ)({type:Array,attribute:"exclude-entities"})],V.prototype,"excludeEntities",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],V.prototype,"entityFilter",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],V.prototype,"extraOptions",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"hide-clear-icon",type:Boolean})],V.prototype,"hideClearIcon",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"add-button",type:Boolean})],V.prototype,"addButton",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"add-button-label"})],V.prototype,"addButtonLabel",void 0),(0,i.Cg)([(0,o.P)("ha-generic-picker")],V.prototype,"_picker",void 0),(0,i.Cg)([(0,o.wk)()],V.prototype,"_pendingEntityId",void 0),V=(0,i.Cg)([(0,o.EM)("ha-entity-picker")],V),e()}catch(y){e(y)}})},53756:function(t,e,s){s.d(e,{t:function(){return h},w:function(){return l}});s(74423),s(18111),s(22489),s(61701),s(62953);var i=s(71727),a=s(74705),o=s(28978),n=s(15638),r=s(95350);const h=[{name:"search_labels.entityName",weight:10},{name:"search_labels.friendlyName",weight:8},{name:"search_labels.deviceName",weight:7},{name:"search_labels.areaName",weight:6},{name:"search_labels.domainName",weight:6},{name:"search_labels.entityId",weight:3}],l=(t,e,s,h,l,d,c,p,u,g="")=>{let m,v=Object.keys(t.states);return c&&(v=v.filter(t=>c.includes(t))),p&&(v=v.filter(t=>!p.includes(t))),e&&(v=v.filter(t=>e.includes((0,i.m)(t)))),s&&(v=v.filter(t=>!s.includes((0,i.m)(t)))),m=v.map(e=>{const s=t.states[e],h=(0,o.u)(s),[l,d,c]=(0,a.Cf)(s,[{type:"entity"},{type:"device"},{type:"area"}],t.entities,t.devices,t.areas,t.floors),p=(0,r.p$)(t.localize,(0,i.m)(e)),u=(0,n.qC)(t.language,t.translationMetadata.translations),m=l||d||e,v=[c,l?d:void 0].filter(Boolean).join(u?" ◂ ":" ▸ ");return{id:`${g}${e}`,primary:m,secondary:v,domain_name:p,sorting_label:[m,v].filter(Boolean).join("_"),search_labels:{entityName:l||null,deviceName:d||null,areaName:c||null,domainName:p||null,friendlyName:h||null,entityId:e},stateObj:s}}),l&&(m=m.filter(t=>{var e;return t.id===u||(null===(e=t.stateObj)||void 0===e?void 0:e.attributes.device_class)&&l.includes(t.stateObj.attributes.device_class)})),d&&(m=m.filter(t=>{var e;return t.id===u||(null===(e=t.stateObj)||void 0===e?void 0:e.attributes.unit_of_measurement)&&d.includes(t.stateObj.attributes.unit_of_measurement)})),h&&(m=m.filter(t=>t.id===u||t.stateObj&&h(t.stateObj))),m}},28949:function(t,e,s){s.d(e,{r:function(){return o}});s(44114),s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698),s(62953);const i=["light","climate","security","media_players","maintenance","weather","energy"],a=new Set(i);function o(t){const e=[],s=new Set;for(const i of t||[]){if("summary"===i.type){if(!a.has(i.key))continue;if(s.has(i.key))continue;s.add(i.key)}e.push(i)}for(const a of i)s.has(a)||e.push({type:"summary",key:a});return e}},96779:function(t,e,s){s.d(e,{q:function(){return a}});var i=s(45435);class a{get info(){return this._info}update(t,e){var s;this._hass=t,e!==this._subscribedPath&&(null===(s=this._unsub)||void 0===s||s.call(this),this._unsub=void 0,this._subscribedPath=e,e?this._unsub=(0,i.sy)(t,e,t=>{this._info=t,this._host.requestUpdate()}):this._info=i.Mw)}hostConnected(){if(this._hass&&this._subscribedPath&&!this._unsub){const t=this._subscribedPath;this._subscribedPath=void 0,this.update(this._hass,t)}}hostDisconnected(){var t;null===(t=this._unsub)||void 0===t||t.call(this),this._unsub=void 0}constructor(t){this._info=i.Mw,this._host=t,t.addController(this)}}},19711:function(t,e,s){s.d(e,{$:function(){return o}});s(3362),s(62953);var i=s(1087);const a=()=>Promise.all([s.e(80131),s.e(70183),s.e(47677)]).then(s.bind(s,79029)),o=(t,e)=>{(0,i.r)(t,"show-dialog",{dialogTag:"dialog-helper-detail",dialogImport:a,dialogParams:e})}},11197:function(t,e,s){s.a(t,async function(t,e){try{s(62953);var i=s(40445),a=s(5124),o=s(67576),n=s(74705),r=s(1087),h=s(74281),l=s(26300),d=(s(8034),t([h,l]));[h,l]=d.then?(await d)():d;let c,p,u,g=t=>t;const m="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z";class v extends a.WF{render(){const t=this.hass.states[this.entityId],{primary:e,secondary:s}=t?(0,n.Bj)(this.hass,t):{primary:this.entityId,secondary:void 0};return(0,a.qy)(c||(c=g` <ha-settings-row slim> <state-badge slot="prefix" .hass="${0}" .stateObj="${0}"></state-badge> <span slot="heading">${0}</span> ${0} <ha-icon-button .path="${0}" .label="${0}" ="${0}"></ha-icon-button> </ha-settings-row> `),this.hass,t,e,s?(0,a.qy)(p||(p=g`<span slot="description">${0}</span>`),s):a.s6,m,this.hass.localize("ui.common.delete"),this._delete)}_delete(){(0,r.r)(this,"delete-favorite-entity",{index:this.index})}constructor(...t){super(...t),this.index=0}}v.styles=(0,a.AH)(u||(u=g`:host{display:block}ha-settings-row{padding:0;gap:var(--ha-space-3);min-height:40px;--settings-row-prefix-display:contents;--settings-row-content-display:contents;--settings-row-body-padding-top:var(--ha-space-1);--settings-row-body-padding-bottom:var(--ha-space-1)}state-badge{flex-shrink:0;width:24px;height:24px;--state-icon-color:var(--secondary-text-color)}[slot=description],[slot=heading]{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}ha-icon-button{--ha-icon-button-size:40px}`)),(0,i.Cg)([(0,o.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"entity-id"})],v.prototype,"entityId",void 0),(0,i.Cg)([(0,o.MZ)({type:Number})],v.prototype,"index",void 0),v=(0,i.Cg)([(0,o.EM)("home-favorite-entity-list-item")],v),e()}catch(c){e(c)}})},69843:function(t,e,s){s.a(t,async function(t,e){try{s(74423),s(62953);var i=s(40445),a=s(5124),o=s(67576),n=s(75751),r=s(1087),h=s(82474),l=(s(85938),s(67094),s(11197)),d=t([h,l]);[h,l]=d.then?(await d)():d;let c,p,u,g,m,v=t=>t;const y="M21 11H3V9H21V11M21 13H3V15H21V13Z";class _ extends a.WF{render(){return(0,a.qy)(c||(c=v` ${0} ${0} <ha-sortable handle-selector=".handle" -moved="${0}"> <div class="home-list"> ${0} </div> </ha-sortable> <ha-entity-picker add-button .hass="${0}" .addButtonLabel="${0}" .excludeEntities="${0}" -changed="${0}"></ha-entity-picker> `),this.label?(0,a.qy)(p||(p=v`<p class="field-label">${0}</p>`),this.label):a.s6,this.helper?(0,a.qy)(u||(u=v`<p class="field-helper">${0}</p>`),this.helper):a.s6,this._moved,(0,n.u)(this.favorites,t=>t,(t,e)=>(0,a.qy)(g||(g=v` <div class="home-list-item favorite-row"> <div class="handle"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div> <home-favorite-entity-list-item class="favorite-content" .hass="${0}" .entityId="${0}" .index="${0}" -favorite-entity="${0}"></home-favorite-entity-list-item> </div> `),y,this.hass,t,e,this._remove)),this.hass,this.hass.localize("ui.panel.lovelace.editor.strategy.home.add_favorite_entity"),this.favorites,this._add)}_update(t){(0,r.r)(this,"value-changed",{value:t})}_add(t){t.stopPropagation();const e=t.detail.value;e&&(t.currentTarget.value="",this.favorites.includes(e)||this._update([...this.favorites,e]))}_remove(t){const{index:e}=t.detail,s=[...this.favorites];s.splice(e,1),this._update(s)}_moved(t){t.stopPropagation();const{oldIndex:e,newIndex:s}=t.detail,i=[...this.favorites],[a]=i.splice(e,1);i.splice(s,0,a),this._update(i)}constructor(...t){super(...t),this.favorites=[]}}_.styles=(0,a.AH)(m||(m=v`.field-label{margin:0 0 var(--ha-space-1) 0;font-size:14px;color:var(--primary-text-color)}.field-helper{margin:0 0 var(--ha-space-2) 0;color:var(--secondary-text-color);font-size:12px}.home-list{display:flex;flex-direction:column}.favorite-row{display:flex;align-items:center;gap:var(--ha-space-2)}.favorite-content{flex:1;min-width:0}.handle{cursor:grab;color:var(--secondary-text-color);flex-shrink:0;display:flex;align-items:center}ha-entity-picker{display:block;padding-top:var(--ha-space-2)}`)),(0,i.Cg)([(0,o.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],_.prototype,"favorites",void 0),(0,i.Cg)([(0,o.MZ)()],_.prototype,"label",void 0),(0,i.Cg)([(0,o.MZ)()],_.prototype,"helper",void 0),_=(0,i.Cg)([(0,o.EM)("home-favorites-editor")],_),e()}catch(c){e(c)}})},61485:function(t,e,s){s.a(t,async function(t,e){try{s(62953);var i=s(40445),a=s(5124),o=s(67576),n=s(89784),r=s(78870),h=s(1087),l=(s(47680),s(26300)),d=(s(8034),s(67094),s(96779)),c=t([l]);l=(c.then?(await c)():c)[0];let p,u,g,m,v=t=>t;const y="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",_="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 b extends a.WF{willUpdate(t){(t.has("hass")||t.has("item"))&&this.hass&&this.item&&this._navInfo.update(this.hass,this.item.path)}render(){if(!this.item)return a.s6;const t=this._navInfo.info,e=this.item.label||t.label||this.item.path,s=this.item.icon||t.icon,i=s?void 0:t.iconPath,o={"--mdc-icon-size":"24px",color:this.item.color?(0,r.MP)(this.item.color):"var(--primary-color)"};return(0,a.qy)(p||(p=v` <ha-settings-row slim> ${0} <span slot="heading">${0}</span> <ha-icon-button .path="${0}" .label="${0}" ="${0}"></ha-icon-button> <ha-icon-button .path="${0}" .label="${0}" ="${0}"></ha-icon-button> </ha-settings-row> `),s?(0,a.qy)(u||(u=v`<ha-icon slot="prefix" .icon="${0}" style="${0}"></ha-icon>`),s,(0,n.W)(o)):(0,a.qy)(g||(g=v`<ha-svg-icon slot="prefix" .path="${0}" style="${0}"></ha-svg-icon>`),i,(0,n.W)(o)),e,_,this.hass.localize("ui.common.edit"),this._edit,y,this.hass.localize("ui.common.delete"),this._delete)}_edit(){(0,h.r)(this,"edit-shortcut",{index:this.index})}_delete(){(0,h.r)(this,"delete-shortcut",{index:this.index})}constructor(...t){super(...t),this.index=0,this._navInfo=new d.q(this)}}b.styles=(0,a.AH)(m||(m=v`:host{display:block}ha-settings-row{padding:0;gap:var(--ha-space-3);min-height:40px;--settings-row-prefix-display:contents;--settings-row-content-display:contents;--settings-row-body-padding-top:var(--ha-space-1);--settings-row-body-padding-bottom:var(--ha-space-1)}ha-icon,ha-svg-icon{--mdc-icon-size:24px;flex-shrink:0}[slot=heading]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}ha-icon-button{--ha-icon-button-size:40px}`)),(0,i.Cg)([(0,o.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],b.prototype,"item",void 0),(0,i.Cg)([(0,o.MZ)({type:Number})],b.prototype,"index",void 0),b=(0,i.Cg)([(0,o.EM)("home-shortcut-list-item")],b),e()}catch(p){e(p)}})},925:function(t,e,s){s.a(t,async function(t,e){try{s(18111),s(22489),s(61701),s(13579),s(62953);var i=s(40445),a=s(5124),o=s(67576),n=s(75751),r=s(89784),h=s(22786),l=s(78870),d=s(1087),c=(s(47680),s(30879)),p=(s(8034),s(85938),s(67094),s(59646)),u=s(28949),g=s(8537),m=s(7094),v=s(61485),y=t([c,p,v,g]);[c,p,v,g]=y.then?(await y)():y;let _,b,f,$,w=t=>t;const x="M21 11H3V9H21V11M21 13H3V15H21V13Z",C="mdi:weather-partly-cloudy",M="teal";class k extends a.WF{get _resolved(){return this._resolveShortcuts(this.shortcuts)}_itemKey(t){return"summary"===t.type?`summary:${t.key}`:`custom:${t.path}`}render(){const t=this._resolved,e=t.filter(t=>"custom"===t.type).map(t=>t.path);return(0,a.qy)(_||(_=w` <ha-sortable handle-selector=".handle" -moved="${0}"> <div class="list"> ${0} </div> </ha-sortable> <ha-navigation-picker .hass="${0}" .addButtonLabel="${0}" .excludePaths="${0}" -changed="${0}"></ha-navigation-picker> `),this._moved,(0,n.u)(t,t=>this._itemKey(t),(t,e)=>{if("summary"===t.type){const e=this._summaryMeta(t.key);if(!e)return a.s6;const s=this._getSummaryLabel(t.key),i=(0,l.MP)(e.color);return(0,a.qy)(b||(b=w` <div class="row"> <div class="handle"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div> <ha-settings-row slim> <ha-icon slot="prefix" .icon="${0}" style="${0}"></ha-icon> <span slot="heading">${0}</span> <ha-switch .checked="${0}" .summaryKey="${0}" ="${0}"></ha-switch> </ha-settings-row> </div> `),x,e.icon,(0,r.W)({"--mdc-icon-size":"24px",color:i}),s,!t.hidden,t.key,this._summaryToggleChanged)}return(0,a.qy)(f||(f=w` <div class="row"> <div class="handle"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div> <home-shortcut-list-item class="row-content" .hass="${0}" .item="${0}" .index="${0}" -shortcut="${0}" -shortcut="${0}"></home-shortcut-list-item> </div> `),x,this.hass,t,e,this._editShortcut,this._deleteShortcut)}),this.hass,this.hass.localize("ui.panel.home.editor.add_custom_shortcut"),e,this._addShortcut)}_getSummaryLabel(t){return"weather"===t?this.hass.localize("ui.panel.lovelace.strategy.home.summary_list.weather"):(0,g.rh)(this.hass.localize,t)}_summaryMeta(t){if("weather"===t)return{icon:C,color:M};if(t in g.It){const e=t;return{icon:g.It[e],color:g.uN[e]}}}_valueChanged(t){(0,d.r)(this,"value-changed",{value:t})}_moved(t){t.stopPropagation();const{oldIndex:e,newIndex:s}=t.detail,i=[...this._resolved],[a]=i.splice(e,1);i.splice(s,0,a),this._valueChanged(i)}_summaryToggleChanged(t){const{checked:e,summaryKey:s}=t.target,i=this._resolved.map(t=>"summary"===t.type&&t.key===s?Object.assign(Object.assign({},t),{},{hidden:!e||void 0}):t);this._valueChanged(i)}_addShortcut(t){t.stopPropagation();const e=t.detail.value;e&&(t.currentTarget.value="",this._resolved.some(t=>"custom"===t.type&&t.path===e)||this._valueChanged([...this._resolved,{type:"custom",path:e}]))}_editShortcut(t){const{index:e}=t.detail,s=this._resolved[e];s&&"custom"===s.type&&(0,m.q)(this,{item:s,saveCallback:t=>{const s=[...this._resolved];s[e]=t,this._valueChanged(s)}})}_deleteShortcut(t){const{index:e}=t.detail,s=[...this._resolved];s.splice(e,1),this._valueChanged(s)}constructor(...t){super(...t),this.shortcuts=[],this._resolveShortcuts=(0,h.A)(u.r)}}k.styles=(0,a.AH)($||($=w`:host{display:block}.list{display:flex;flex-direction:column}.row{display:flex;align-items:center;gap:var(--ha-space-2)}.row-content{flex:1;min-width:0}ha-settings-row{flex:1;min-width:0;padding:0;gap:var(--ha-space-3);min-height:40px;--settings-row-prefix-display:contents;--settings-row-content-display:contents;--settings-row-body-padding-top:var(--ha-space-1);--settings-row-body-padding-bottom:var(--ha-space-1)}[slot=heading]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.handle{cursor:grab;color:var(--secondary-text-color);flex-shrink:0;display:flex;align-items:center}ha-navigation-picker{display:block;padding-top:var(--ha-space-2)}`)),(0,i.Cg)([(0,o.MZ)({attribute:!1})],k.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],k.prototype,"shortcuts",void 0),k=(0,i.Cg)([(0,o.EM)("home-shortcuts-editor")],k),e()}catch(_){e(_)}})},284:function(t,e,s){s.a(t,async function(t,i){try{s.r(e),s.d(e,{DialogEditHome:function(){return x}});s(3362),s(62953);var a=s(40445),o=s(5124),n=s(67576),r=s(22786),h=s(1087),l=s(38962),d=s(18350),c=(s(93444),s(72554)),p=(s(11382),s(52763)),u=(s(47680),s(14503)),g=s(69843),m=s(925),v=t([l,d,c,p,g,m]);[l,d,c,p,g,m]=v.then?(await v)():v;let y,_,b,f=t=>t;const $=8,w=[{name:"show_welcome_message",selector:{boolean:{}}}];class x extends o.WF{showDialog(t){this._params=t,this._state={favorite_entities:t.config.favorite_entities?[...t.config.favorite_entities]:[],show_suggested_entities:!t.config.hide_suggested_entities,show_welcome_message:!t.config.hide_welcome_message,shortcuts:t.config.shortcuts?[...t.config.shortcuts]:[]},this._open=!0}closeDialog(){return this._open=!1,!0}_dialogClosed(){this._params=void 0,this._state=void 0,this._submitting=!1,(0,h.r)(this,"dialog-closed",{dialog:this.localName})}render(){return this._params&&this._state?(0,o.qy)(y||(y=f` <ha-dialog .open="${0}" .headerTitle="${0}" .headerSubtitle="${0}" prevent-scrim-close ="${0}"> <ha-alert alert-type="info"> ${0} </ha-alert> <ha-expansion-panel outlined expanded .header="${0}" .secondary="${0}"> <ha-icon slot="leading-icon" icon="mdi:palette-outline"></ha-icon> <div class="expansion-content"> <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" .computeHelper="${0}" -changed="${0}"></ha-form> <home-favorites-editor .hass="${0}" .favorites="${0}" .label="${0}" -changed="${0}"></home-favorites-editor> <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" .computeHelper="${0}" -changed="${0}"></ha-form> </div> </ha-expansion-panel> <ha-expansion-panel outlined expanded .header="${0}" .secondary="${0}"> <ha-icon slot="leading-icon" icon="mdi:view-dashboard-outline"></ha-icon> <div class="expansion-content"> <home-shortcuts-editor .hass="${0}" .shortcuts="${0}" -changed="${0}"></home-shortcuts-editor> </div> </ha-expansion-panel> <ha-dialog-footer slot="footer"> <ha-button appearance="plain" slot="secondaryAction" ="${0}" .disabled="${0}"> ${0} </ha-button> <ha-button slot="primaryAction" ="${0}" .disabled="${0}"> ${0} </ha-button> </ha-dialog-footer> </ha-dialog> `),this._open,this.hass.localize("ui.panel.home.editor.title"),this.hass.localize("ui.panel.home.editor.description"),this._dialogClosed,this.hass.localize("ui.panel.home.editor.areas_hint",{areas_page:(0,o.qy)(_||(_=f`<a href="/config/areas?historyBack=1" ="${0}">${0}</a>`),this.closeDialog,this.hass.localize("ui.panel.home.editor.areas_page"))}),this.hass.localize("ui.panel.home.editor.personalize"),this.hass.localize("ui.panel.home.editor.personalize_description"),this.hass,{show_welcome_message:this._state.show_welcome_message},w,this._computeWelcomeLabel,this._computeWelcomeHelper,this._welcomeChanged,this.hass,this._state.favorite_entities,this.hass.localize("ui.panel.lovelace.editor.strategy.home.favorite_entities"),this._favoriteEntitiesChanged,this.hass,{show_suggested_entities:this._state.show_suggested_entities},this._suggestedSchema(this._state.favorite_entities.length>=$),this._computeSuggestedLabel,this._computeSuggestedHelper,this._suggestedChanged,this.hass.localize("ui.panel.home.editor.summaries"),this.hass.localize("ui.panel.home.editor.summaries_description"),this.hass,this._state.shortcuts,this._shortcutsChanged,this.closeDialog,this._submitting,this.hass.localize("ui.common.cancel"),this._save,this._submitting,this.hass.localize("ui.common.save")):o.s6}_favoriteEntitiesChanged(t){this._state=Object.assign(Object.assign({},this._state),{},{favorite_entities:t.detail.value})}_welcomeChanged(t){this._state=Object.assign(Object.assign({},this._state),{},{show_welcome_message:t.detail.value.show_welcome_message})}_suggestedChanged(t){this._state=Object.assign(Object.assign({},this._state),{},{show_suggested_entities:t.detail.value.show_suggested_entities})}_shortcutsChanged(t){this._state=Object.assign(Object.assign({},this._state),{},{shortcuts:t.detail.value})}async _save(){if(!this._params||!this._state)return;this._submitting=!0;const t=this._state,e=Object.assign(Object.assign({},this._params.config),{},{favorite_entities:t.favorite_entities.length>0?t.favorite_entities:void 0,hide_suggested_entities:!t.show_suggested_entities||void 0,hide_welcome_message:!t.show_welcome_message||void 0,shortcuts:t.shortcuts.length>0?t.shortcuts:void 0});try{await this._params.saveConfig(e),this.closeDialog()}finally{this._submitting=!1}}constructor(...t){super(...t),this._open=!1,this._submitting=!1,this._suggestedSchema=(0,r.A)(t=>[{name:"show_suggested_entities",selector:{boolean:{}},disabled:t}]),this._computeWelcomeLabel=()=>this.hass.localize("ui.panel.home.editor.welcome_message"),this._computeWelcomeHelper=()=>this.hass.localize("ui.panel.home.editor.welcome_message_helper"),this._computeSuggestedLabel=()=>this.hass.localize("ui.panel.home.editor.suggested_entities"),this._computeSuggestedHelper=()=>{var t,e;const s=(null!==(t=null===(e=this._state)||void 0===e?void 0:e.favorite_entities.length)&&void 0!==t?t:0)>=$;return this.hass.localize(s?"ui.panel.home.editor.suggested_entities_disabled_description":"ui.panel.home.editor.suggested_entities_description")}}}x.styles=[u.nA,(0,o.AH)(b||(b=f`ha-dialog{--dialog-content-padding:var(--ha-space-6)}ha-expansion-panel{display:block;--expansion-panel-content-padding:0;border-radius:var(--ha-border-radius-md);--ha-card-border-radius:var(--ha-border-radius-md)}ha-expansion-panel+ha-expansion-panel{margin-top:var(--ha-space-2)}.expansion-content{padding:var(--ha-space-3)}ha-form{display:block}home-favorites-editor{display:block;margin-top:var(--ha-space-2);margin-bottom:var(--ha-space-4)}ha-alert{display:block;margin:calc(-1 * var(--dialog-content-padding));margin-bottom:var(--ha-space-4)}`))],(0,a.Cg)([(0,n.MZ)({attribute:!1})],x.prototype,"hass",void 0),(0,a.Cg)([(0,n.wk)()],x.prototype,"_params",void 0),(0,a.Cg)([(0,n.wk)()],x.prototype,"_state",void 0),(0,a.Cg)([(0,n.wk)()],x.prototype,"_open",void 0),(0,a.Cg)([(0,n.wk)()],x.prototype,"_submitting",void 0),x=(0,a.Cg)([(0,n.EM)("dialog-edit-home")],x),i()}catch(y){i(y)}})},7094:function(t,e,s){s.d(e,{q:function(){return o}});s(3362),s(62953);var i=s(1087);const a=()=>s.e(19910).then(s.bind(s,20325)),o=(t,e)=>{(0,i.r)(t,"show-dialog",{dialogTag:"dialog-edit-shortcut",dialogImport:a,dialogParams:e})}}}]);