${this.value.length?this.value.map(e=>this.items.find(t=>t.value==e)).filter(Ge).map(e=>N`
@@ -1184,20 +1185,20 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
align-items: center;
margin-right: -6px !important;
}
- `}};t([ae()],no.prototype,"items",void 0),t([ae({type:Array})],no.prototype,"value",void 0),t([ae()],no.prototype,"label",void 0),t([ae({type:Boolean})],no.prototype,"invalid",void 0),no=t([ie("scheduler-selector")],no);const ro=(e,t)=>{let i={};return(null==t?void 0:t.length)&&!t.includes(bt.Above)||(i=Object.assign(Object.assign({},i),{[bt.Above]:{value:bt.Above,name:e.localize("ui.panel.config.automation.editor.triggers.type.numeric_state.above"),icon:"mdi:greater-than"}})),(null==t?void 0:t.length)&&!t.includes(bt.Below)||(i=Object.assign(Object.assign({},i),{[bt.Below]:{value:bt.Below,name:e.localize("ui.panel.config.automation.editor.triggers.type.numeric_state.below"),icon:"mdi:less-than"}})),(null==t?void 0:t.length)&&!t.includes(bt.Equal)||(i=Object.assign(Object.assign({},i),{[bt.Equal]:{value:bt.Equal,name:Ps("ui.panel.conditions.equal_to",it(e)),icon:"mdi:equal"}})),(null==t?void 0:t.length)&&!t.includes(bt.Unequal)||(i=Object.assign(Object.assign({},i),{[bt.Unequal]:{value:bt.Unequal,name:Ps("ui.panel.conditions.unequal_to",it(e)),icon:"mdi:not-equal-variant"}})),i};let lo=class extends ee{constructor(){super(...arguments),this.editItem=!1,this.addCondition=!1,this.tags=[],this.startDate="",this.endDate=""}async firstUpdated(){var e,t,i;if(null===(e=this.config)||void 0===e?void 0:e.tags){(async()=>{await eo()})();const e=(await vt(this.hass)).map(e=>e.name),t=st(this.config.tags);this.tags=[...e,...t.filter(t=>!e.includes(t)&&!["none","disabled","enabled"].includes(t))]}(await window.loadCardHelpers()).importMoreInfoControl("input_datetime"),this.startDate=(null===(t=this.schedule)||void 0===t?void 0:t.start_date)||ao(new Date,it(this.hass),!0),this.endDate=(null===(i=this.schedule)||void 0===i?void 0:i.end_date)||ao(new Date,it(this.hass),!0)}shouldUpdate(e){return e.get("schedule")&&this.dispatchEvent(new CustomEvent("change",{detail:{schedule:this.schedule}})),!0}render(){var e,t;if(!this.hass||!this.config||!this.schedule)return N``;let i=[{name:this.hass.localize("ui.panel.config.automation.editor.actions.type.repeat.label"),value:ft.Repeat,icon:"refresh"},{name:this.hass.localize("ui.dialogs.more_info_control.vacuum.stop"),value:ft.Pause,icon:"stop"},{name:this.hass.localize("ui.common.delete"),value:ft.Single,icon:"trash-can-outline"}];return Ge(this.schedule.start_date)&&(i=i.filter(e=>e.value!=ft.Repeat)),N`
+ `}};t([se()],mo.prototype,"items",void 0),t([se({type:Array})],mo.prototype,"value",void 0),t([se()],mo.prototype,"label",void 0),t([se({type:Boolean})],mo.prototype,"invalid",void 0),mo=t([ie("scheduler-selector")],mo);const ho=(e,t)=>{let i={};return(null==t?void 0:t.length)&&!t.includes(bt.Above)||(i=Object.assign(Object.assign({},i),{[bt.Above]:{value:bt.Above,name:e.localize("ui.panel.config.automation.editor.triggers.type.numeric_state.above"),icon:"mdi:greater-than"}})),(null==t?void 0:t.length)&&!t.includes(bt.Below)||(i=Object.assign(Object.assign({},i),{[bt.Below]:{value:bt.Below,name:e.localize("ui.panel.config.automation.editor.triggers.type.numeric_state.below"),icon:"mdi:less-than"}})),(null==t?void 0:t.length)&&!t.includes(bt.Equal)||(i=Object.assign(Object.assign({},i),{[bt.Equal]:{value:bt.Equal,name:Ua("ui.panel.conditions.equal_to",it(e)),icon:"mdi:equal"}})),(null==t?void 0:t.length)&&!t.includes(bt.Unequal)||(i=Object.assign(Object.assign({},i),{[bt.Unequal]:{value:bt.Unequal,name:Ua("ui.panel.conditions.unequal_to",it(e)),icon:"mdi:not-equal-variant"}})),i};let po=class extends ee{constructor(){super(...arguments),this.editItem=!1,this.addCondition=!1,this.tags=[],this.startDate="",this.endDate=""}async firstUpdated(){var e,t,i;if(null===(e=this.config)||void 0===e?void 0:e.tags){(async()=>{await oo()})();const e=(await vt(this.hass)).map(e=>e.name),t=at(this.config.tags);this.tags=[...e,...t.filter(t=>!e.includes(t)&&!["none","disabled","enabled"].includes(t))]}(await window.loadCardHelpers()).importMoreInfoControl("input_datetime"),this.startDate=(null===(t=this.schedule)||void 0===t?void 0:t.start_date)||co(new Date,it(this.hass),!0),this.endDate=(null===(i=this.schedule)||void 0===i?void 0:i.end_date)||co(new Date,it(this.hass),!0)}shouldUpdate(e){return e.get("schedule")&&this.dispatchEvent(new CustomEvent("change",{detail:{schedule:this.schedule}})),!0}render(){var e,t;if(!this.hass||!this.config||!this.schedule)return N``;let i=[{name:this.hass.localize("ui.panel.config.automation.editor.actions.type.repeat.label"),value:ft.Repeat,icon:"refresh"},{name:this.hass.localize("ui.dialogs.more_info_control.vacuum.stop"),value:ft.Pause,icon:"stop"},{name:this.hass.localize("ui.common.delete"),value:ft.Single,icon:"trash-can-outline"}];return Ge(this.schedule.start_date)&&(i=i.filter(e=>e.value!=ft.Repeat)),N`
${this.addCondition?this.renderAddCondition():N`
@@ -1220,13 +1221,13 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
this.shadowRoot.querySelector("#track_conditions").click()}
>
- ${Ps("ui.panel.conditions.track_conditions",it(this.hass))}
+ ${Ua("ui.panel.conditions.track_conditions",it(this.hass))}
`:""}
- ${Qe((null===(e=Ps("ui.components.date.days_range",it(this.hass)).split("{").shift())||void 0===e?void 0:e.trim())||"")}
+ ${Qe((null===(e=Ua("ui.components.date.days_range",it(this.hass)).split("{").shift())||void 0===e?void 0:e.trim())||"")}
- ${Qe((null===(t=Ps("ui.components.date.days_range",it(this.hass)).split("}")[1].split("{").shift())||void 0===t?void 0:t.trim())||"")}
+ ${Qe((null===(t=Ua("ui.components.date.days_range",it(this.hass)).split("}")[1].split("{").shift())||void 0===t?void 0:t.trim())||"")}
`:""}
-
+
- `}renderAddCondition(){if(!this.addCondition||!this.hass||!this.config)return N``;if(this.selectedEntity){const e=this.selectedEntity,t=Ra(e.id,this.hass,this.config);let i;if((null==t?void 0:t.type)==yt.Level)i=[bt.Above,bt.Below];else if((null==t?void 0:t.type)==yt.List)i=[bt.Equal,bt.Unequal];else{const t=e.id in this.hass.states?this.hass.states[e.id].state:null;i=!t||["unavailable","unknown"].includes(t)?[bt.Equal,bt.Unequal,bt.Above,bt.Below]:isNaN(Number(t))?[bt.Equal,bt.Unequal]:[bt.Above,bt.Below]}const s=ro(this.hass,i);return N`
+ `}renderAddCondition(){if(!this.addCondition||!this.hass||!this.config)return N``;if(this.selectedEntity){const e=this.selectedEntity,t=Fs(e.id,this.hass,this.config);let i;if((null==t?void 0:t.type)==yt.Level)i=[bt.Above,bt.Below];else if((null==t?void 0:t.type)==yt.List)i=[bt.Equal,bt.Unequal];else{const t=e.id in this.hass.states?this.hass.states[e.id].state:null;i=!t||["unavailable","unknown"].includes(t)?[bt.Equal,bt.Unequal,bt.Above,bt.Below]:isNaN(Number(t))?[bt.Equal,bt.Unequal]:[bt.Above,bt.Below]}const a=ho(this.hass,i);return N`
@@ -1334,7 +1335,7 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
${Qe(e.name)}
{this.selectedEntity=void 0}}
>
@@ -1345,7 +1346,7 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
${this.hass.localize("ui.panel.config.automation.editor.conditions.type.device.condition")}
this.conditionMatchType=e.target.value}
>
@@ -1358,7 +1359,7 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
@value-changed=${e=>this.conditionValue=e.detail.value}
>
- `}{const e=Ca(Ua(this.hass,this.config,{filterActions:!1,filterStates:!0}),this.config,this.hass);e.sort((e,t)=>e.name.trim().toLowerCase()Ke(e,this.selectedGroup)).entities.map(e=>lt(e,this.hass,this.config)),t.sort((e,t)=>e.name.trim().toLowerCase()e.name.trim().toLowerCase()Ke(e,this.selectedGroup)).entities.map(e=>lt(e,this.hass,this.config)),t.sort((e,t)=>e.name.trim().toLowerCase()
Ke(e,this.selectedGroup))}
@change=${this.selectGroup}
>
- ${Ps("ui.panel.entity_picker.no_groups_defined",it(this.hass))}
+ ${Ua("ui.panel.entity_picker.no_groups_defined",it(this.hass))}
@@ -1375,25 +1376,25 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
.value=${t.findIndex(e=>Ke(e,this.selectedEntity))}
@change=${this.selectEntity}
>
- ${this.selectedGroup?Ps("ui.panel.entity_picker.no_entities_for_group",it(this.hass)):Ps("ui.panel.entity_picker.no_group_selected",it(this.hass))}
+ ${this.selectedGroup?Ua("ui.panel.entity_picker.no_entities_for_group",it(this.hass)):Ua("ui.panel.entity_picker.no_group_selected",it(this.hass))}
- `}}selectGroup(e){this.selectedGroup=e.detail,this.selectedEntity=void 0}selectEntity(e){this.selectedEntity=e.detail,this.conditionMatchType=void 0,this.conditionValue=void 0}renderConditions(){if(!this.hass||!this.schedule)return N``;const e=this.schedule.timeslots[0].conditions||[];return e.length?e.map((e,t)=>{const i=lt(e.entity_id,this.hass,this.config),s=Ra(e.entity_id,this.hass,this.config);return N`
+ `}}selectGroup(e){this.selectedGroup=e.detail,this.selectedEntity=void 0}selectEntity(e){this.selectedEntity=e.detail,this.conditionMatchType=void 0,this.conditionValue=void 0}renderConditions(){if(!this.hass||!this.schedule)return N``;const e=this.schedule.timeslots[0].conditions||[];return e.length?e.map((e,t)=>{const i=lt(e.entity_id,this.hass,this.config),a=Fs(e.entity_id,this.hass,this.config);return N`
- ${Qe(i.name)} ${ro(this.hass)[e.match_type].name.toLowerCase()}
- ${s?s.type==yt.List?Ut(e.value,s):s.type==yt.Level?Mt(e.value,s):e.value:""}
+ ${Qe(i.name)} ${ho(this.hass)[e.match_type].name.toLowerCase()}
+ ${a?a.type==yt.List?Vt(e.value,a):a.type==yt.Level?Mt(e.value,a):e.value:""}
{this.editConditionClick(t)}}
>
`}):N`
- ${Ps("ui.panel.conditions.no_conditions_defined",it(this.hass))}
- `}addConditionClick(){this.addCondition=!0,this.selectedEntity=void 0,this.selectedGroup=void 0}confirmConditionClick(){var e;if(!(this.selectedEntity&&this.config&&this.hass&&this.schedule&&this.conditionMatchType&&Ge(this.conditionValue)))return;const t={entity_id:this.selectedEntity.id,match_type:this.conditionMatchType,value:this.conditionValue,attribute:"state"},i=(null===(e=this.schedule.timeslots[0].conditions)||void 0===e?void 0:e.length)?[...this.schedule.timeslots[0].conditions]:[],s=this.schedule.timeslots[0].condition_type?this.schedule.timeslots[0].condition_type:kt.Any;void 0===this.editConditionItem?i.push(t):i.splice(this.editConditionItem,1,t),this.schedule=Object.assign(Object.assign({},this.schedule),{timeslots:this.schedule.timeslots.map(e=>Object.assign(e,{conditions:i,condition_type:s}))}),this.addCondition=!1,this.editConditionItem=void 0}cancelConditionClick(){this.addCondition=!1,this.editConditionItem=void 0}editConditionClick(e){if(!(this.schedule&&this.schedule.timeslots[0].conditions&&this.hass&&this.config))return;const t=this.schedule.timeslots[0].conditions[e];if(!t)return;this.editConditionItem=e;const i=Ca(Ua(this.hass,this.config,{filterActions:!1,filterStates:!0}),this.config,this.hass);this.selectedGroup=i.find(e=>e.entities.includes(t.entity_id)),this.selectedEntity=lt(t.entity_id,this.hass,this.config),this.conditionMatchType=t.match_type,this.conditionValue=t.value,this.addCondition=!0}deleteConditionClick(){var e;if(!this.config||!this.hass||!this.schedule||void 0===this.editConditionItem)return;const t=(null===(e=this.schedule.timeslots[0].conditions)||void 0===e?void 0:e.length)?[...this.schedule.timeslots[0].conditions]:[];t.splice(this.editConditionItem,1),this.schedule=Object.assign(Object.assign({},this.schedule),{timeslots:this.schedule.timeslots.map(e=>Object.assign(e,{conditions:t}))}),this.addCondition=!1,this.editConditionItem=void 0}conditionTypeSwitchClick(e){if(!this.schedule)return;const t=e.target.checked?kt.All:kt.Any;this.schedule=Object.assign(Object.assign({},this.schedule),{timeslots:this.schedule.timeslots.map(e=>Object.assign(e,{condition_type:t}))})}trackConditionsClick(e){if(!this.schedule)return;const t=e.target.checked;this.schedule=Object.assign(Object.assign({},this.schedule),{timeslots:this.schedule.timeslots.map(e=>Object(Object.assign(Object.assign({},e),{track_conditions:t})))})}_setStartDate(e){const t=String(e.detail.value);if(!t)return;pa(t)>pa(this.endDate)&&(this.schedule=Object.assign(Object.assign({},this.schedule),{end_date:t}),this.endDate=t),this.schedule=Object.assign(Object.assign({},this.schedule),{start_date:t}),this.startDate=t}_setEndDate(e){const t=String(e.detail.value);if(!t)return;pa(this.startDate)>pa(t)&&(this.schedule=Object.assign(Object.assign({},this.schedule),{start_date:t}),this.startDate=t),this.schedule=Object.assign(Object.assign({},this.schedule),{end_date:t}),this.endDate=t}toggleEnableDateRange(e){const t=e.target.checked;this.shadowRoot.querySelectorAll("ha-date-input");this.schedule=Object.assign(Object.assign({},this.schedule),{start_date:t?this.startDate:void 0,end_date:t?this.endDate:void 0,repeat_type:t?this.schedule.repeat_type==ft.Repeat?ft.Pause:this.schedule.repeat_type:this.schedule.repeat_type==ft.Pause?ft.Repeat:this.schedule.repeat_type})}updateName(e){const t=e.target.value;this.schedule=Object.assign(Object.assign({},this.schedule),{name:t})}updateRepeatType(e){const t=e.target.value;this.schedule=Object.assign(Object.assign({},this.schedule),{repeat_type:t})}getTagOptions(){var e;let t=[...this.tags];return(null===(e=this.schedule)||void 0===e?void 0:e.tags.length)&&(t=[...t,...this.schedule.tags.filter(e=>!t.includes(e))]),t.sort(Je),t.map(e=>Object({name:e,value:e}))}updateTags(e){let t=e.target.value;t=t.map(e=>e.trim()),t=t.filter(e=>!["none","disabled","enabled"].includes(e)),t.sort(Je),this.schedule=Object.assign(Object.assign({},this.schedule),{tags:t})}saveClick(){const e=new CustomEvent("saveClick",{detail:this.schedule});this.dispatchEvent(e)}deleteClick(){const e=new CustomEvent("deleteClick",{detail:this.schedule});this.dispatchEvent(e)}};lo.styles=r`
- ${ja}
+ ${Ua("ui.panel.conditions.no_conditions_defined",it(this.hass))}
+ `}addConditionClick(){this.addCondition=!0,this.selectedEntity=void 0,this.selectedGroup=void 0}confirmConditionClick(){var e;if(!(this.selectedEntity&&this.config&&this.hass&&this.schedule&&this.conditionMatchType&&Ge(this.conditionValue)))return;const t={entity_id:this.selectedEntity.id,match_type:this.conditionMatchType,value:this.conditionValue,attribute:"state"},i=(null===(e=this.schedule.timeslots[0].conditions)||void 0===e?void 0:e.length)?[...this.schedule.timeslots[0].conditions]:[],a=this.schedule.timeslots[0].condition_type?this.schedule.timeslots[0].condition_type:kt.Any;void 0===this.editConditionItem?i.push(t):i.splice(this.editConditionItem,1,t),this.schedule=Object.assign(Object.assign({},this.schedule),{timeslots:this.schedule.timeslots.map(e=>Object.assign(e,{conditions:i,condition_type:a}))}),this.addCondition=!1,this.editConditionItem=void 0}cancelConditionClick(){this.addCondition=!1,this.editConditionItem=void 0}editConditionClick(e){if(!(this.schedule&&this.schedule.timeslots[0].conditions&&this.hass&&this.config))return;const t=this.schedule.timeslots[0].conditions[e];if(!t)return;this.editConditionItem=e;const i=Ps(Ys(this.hass,this.config,{filterActions:!1,filterStates:!0}),this.config,this.hass);this.selectedGroup=i.find(e=>e.entities.includes(t.entity_id)),this.selectedEntity=lt(t.entity_id,this.hass,this.config),this.conditionMatchType=t.match_type,this.conditionValue=t.value,this.addCondition=!0}deleteConditionClick(){var e;if(!this.config||!this.hass||!this.schedule||void 0===this.editConditionItem)return;const t=(null===(e=this.schedule.timeslots[0].conditions)||void 0===e?void 0:e.length)?[...this.schedule.timeslots[0].conditions]:[];t.splice(this.editConditionItem,1),this.schedule=Object.assign(Object.assign({},this.schedule),{timeslots:this.schedule.timeslots.map(e=>Object.assign(e,{conditions:t}))}),this.addCondition=!1,this.editConditionItem=void 0}conditionTypeSwitchClick(e){if(!this.schedule)return;const t=e.target.checked?kt.All:kt.Any;this.schedule=Object.assign(Object.assign({},this.schedule),{timeslots:this.schedule.timeslots.map(e=>Object.assign(e,{condition_type:t}))})}trackConditionsClick(e){if(!this.schedule)return;const t=e.target.checked;this.schedule=Object.assign(Object.assign({},this.schedule),{timeslots:this.schedule.timeslots.map(e=>Object(Object.assign(Object.assign({},e),{track_conditions:t})))})}_setStartDate(e){const t=String(e.detail.value);if(!t)return;ys(t)>ys(this.endDate)&&(this.schedule=Object.assign(Object.assign({},this.schedule),{end_date:t}),this.endDate=t),this.schedule=Object.assign(Object.assign({},this.schedule),{start_date:t}),this.startDate=t}_setEndDate(e){const t=String(e.detail.value);if(!t)return;ys(this.startDate)>ys(t)&&(this.schedule=Object.assign(Object.assign({},this.schedule),{start_date:t}),this.startDate=t),this.schedule=Object.assign(Object.assign({},this.schedule),{end_date:t}),this.endDate=t}toggleEnableDateRange(e){const t=e.target.checked;this.shadowRoot.querySelectorAll("ha-date-input");this.schedule=Object.assign(Object.assign({},this.schedule),{start_date:t?this.startDate:void 0,end_date:t?this.endDate:void 0,repeat_type:t?this.schedule.repeat_type==ft.Repeat?ft.Pause:this.schedule.repeat_type:this.schedule.repeat_type==ft.Pause?ft.Repeat:this.schedule.repeat_type})}updateName(e){const t=e.target.value;this.schedule=Object.assign(Object.assign({},this.schedule),{name:t})}updateRepeatType(e){const t=e.target.value;this.schedule=Object.assign(Object.assign({},this.schedule),{repeat_type:t})}getTagOptions(){var e;let t=[...this.tags];return(null===(e=this.schedule)||void 0===e?void 0:e.tags.length)&&(t=[...t,...this.schedule.tags.filter(e=>!t.includes(e))]),t.sort(Je),t.map(e=>Object({name:e,value:e}))}updateTags(e){let t=e.target.value;t=t.map(e=>e.trim()),t=t.filter(e=>!["none","disabled","enabled"].includes(e)),t.sort(Je),this.schedule=Object.assign(Object.assign({},this.schedule),{tags:t})}saveClick(){const e=new CustomEvent("saveClick",{detail:this.schedule});this.dispatchEvent(e)}deleteClick(){const e=new CustomEvent("deleteClick",{detail:this.schedule});this.dispatchEvent(e)}};po.styles=r`
+ ${As}
div.summary {
display: flex;
flex-direction: row;
@@ -1455,17 +1456,17 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
ha-textfield {
width: 100%;
}
- `,t([ae()],lo.prototype,"hass",void 0),t([ae()],lo.prototype,"config",void 0),t([ae()],lo.prototype,"schedule",void 0),t([ae()],lo.prototype,"selectedGroup",void 0),t([ae()],lo.prototype,"selectedEntity",void 0),t([ae()],lo.prototype,"conditionMatchType",void 0),t([ae()],lo.prototype,"conditionValue",void 0),t([ae()],lo.prototype,"editConditionItem",void 0),t([ae({type:Boolean})],lo.prototype,"editItem",void 0),t([ae()],lo.prototype,"addCondition",void 0),t([ae()],lo.prototype,"tags",void 0),t([oe()],lo.prototype,"startDate",void 0),t([oe()],lo.prototype,"endDate",void 0),lo=t([ie("scheduler-editor-options")],lo);let co=class extends ee{constructor(){super(...arguments),this.actions=[],this.editItem=null,this.large=!1,this._currTab=qe.Entity,this._tabs=[qe.Entity,qe.Time,qe.Options]}provideHass(e){e.hass=this.hass}async showDialog(e){this._params=e,this._config=e.config,this.entities=e.entities,this.actions=e.actions,this.schedule=e.schedule,this.editItem=e.editItem,this.cardEmbeddedInPopup=e.cardEmbeddedInPopup,this._currTab=null!==this.editItem?qe.Time:qe.Entity,await this.updateComplete}async closeDialog(){this._params=void 0,this.large=!1}render(){var e,t,i,s;const a=null===(e=this.schedule)||void 0===e?void 0:e.timeslots.every(e=>e.stop),o=e=>e==qe.Entity?this.hass.localize("ui.components.entity.entity-picker.entity"):e==qe.Time?this.hass.localize("ui.dialogs.helper_settings.input_datetime.time"):e==qe.Options?this.hass.localize("ui.dialogs.helper_settings.input_select.options"):e;return this._params?N`
+ `,t([se()],po.prototype,"hass",void 0),t([se()],po.prototype,"config",void 0),t([se()],po.prototype,"schedule",void 0),t([se()],po.prototype,"selectedGroup",void 0),t([se()],po.prototype,"selectedEntity",void 0),t([se()],po.prototype,"conditionMatchType",void 0),t([se()],po.prototype,"conditionValue",void 0),t([se()],po.prototype,"editConditionItem",void 0),t([se({type:Boolean})],po.prototype,"editItem",void 0),t([se()],po.prototype,"addCondition",void 0),t([se()],po.prototype,"tags",void 0),t([oe()],po.prototype,"startDate",void 0),t([oe()],po.prototype,"endDate",void 0),po=t([ie("scheduler-editor-options")],po);let _o=class extends ee{constructor(){super(...arguments),this.actions=[],this.editItem=null,this.large=!1,this._currTab=qe.Entity,this._tabs=[qe.Entity,qe.Time,qe.Options]}provideHass(e){e.hass=this.hass}async showDialog(e){this._params=e,this._config=e.config,this.entities=e.entities,this.actions=e.actions,this.schedule=e.schedule,this.editItem=e.editItem,this.cardEmbeddedInPopup=e.cardEmbeddedInPopup,this._currTab=null!==this.editItem?qe.Time:qe.Entity,await this.updateComplete}async closeDialog(){this._params=void 0,this.large=!1}render(){var e,t,i,a;const s=null===(e=this.schedule)||void 0===e?void 0:e.timeslots.every(e=>e.stop),o=e=>e==qe.Entity?this.hass.localize("ui.components.entity.entity-picker.entity"):e==qe.Time?this.hass.localize("ui.dialogs.helper_settings.input_datetime.time"):e==qe.Options?this.hass.localize("ui.dialogs.helper_settings.input_select.options"):e;return this._params?N`
- ${this.editItem?(null===(t=this.schedule)||void 0===t?void 0:t.name)?null===(i=this.schedule)||void 0===i?void 0:i.name:Ps("ui.panel.common.default_name",it(this.hass),"{id}",this.editItem):Ps("ui.panel.common.new_schedule",it(this.hass))}
+ ${this.editItem?(null===(t=this.schedule)||void 0===t?void 0:t.name)?null===(i=this.schedule)||void 0===i?void 0:i.name:Ua("ui.panel.common.default_name",it(this.hass),"{id}",this.editItem):Ua("ui.panel.common.new_schedule",it(this.hass))}
@@ -1477,7 +1478,7 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
e.id)}
+ .entities=${null===(a=this.entities)||void 0===a?void 0:a.map(e=>e.id)}
.schedule=${this.schedule}
.actions=${this.actions}
.cardEmbeddedInPopup=${this.cardEmbeddedInPopup}
@@ -1494,7 +1495,7 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
.schedule=${this.schedule}
.entities=${this.entities}
.actions=${this.actions}
- ?timeslots=${a}
+ ?timeslots=${s}
?editItem=${null!==this.editItem}
.large=${this.large}
@change=${this._handleUpdateParams}
@@ -1515,8 +1516,8 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
`:""}
- `:N``}_handleUpdateParams(e){const t=e.detail;t.schedule&&(this.schedule=t.schedule),t.actions&&(this.actions=t.actions),t.entities&&(this.entities=t.entities),t.tab&&(this._currTab=t.tab)}_handleTabChanged(e){const t=this._currTab,i=this._tabs[e.detail.selected];if(i!=qe.Time&&!this.schedule)return e.preventDefault(),void(e.target.activeIndex=0);i!==t&&(this._currTab=i)}_enlarge(){this.large=!this.large}async _handleSaveClick(){if(!this.hass)return;let e=Object.assign({},this.schedule);if(e=Object.assign(Object.assign({},e),{timeslots:e.timeslots.map(e=>{var t;return e.actions&&e.actions.length?(e.actions.some(e=>!e.entity_id||"notify"==Ce(e.entity_id||""))&&(e=Object.assign(Object.assign({},e),{actions:e.actions.map(e=>e.entity_id&&"notify"!=Ce(e.entity_id||"")?e:Ye(e,"entity_id"))})),e.stop||(e=Ye(e,"stop")),(null===(t=e.conditions)||void 0===t?void 0:t.length)||(e=Ye(e,"conditions","condition_type")),e):null}).filter(Ge)}),this.editItem){const s=await pt(this.hass,this.editItem);if(Ke(Ye(e,"timeslots"),Ye(Fe(s,Object.keys(e)),"timeslots"))&&e.timeslots.length==s.timeslots.length&&e.timeslots.every((e,t)=>Ke(e,s.timeslots[t])));else{if(!s.enabled){await new Promise(e=>{const t={title:Ps("ui.dialog.enable_schedule.title",it(this.hass)),description:Ps("ui.dialog.enable_schedule.description",it(this.hass)),primaryButtonLabel:this.hass.localize("ui.common.yes"),secondaryButtonLabel:this.hass.localize("ui.common.no"),cancel:()=>{e(!1)},confirm:()=>{e(!0)}};ht(this,{dialogTag:"generic-dialog",dialogImport:()=>Promise.resolve().then((function(){return Za})),dialogParams:t},this.cardEmbeddedInPopup)})&&this.hass.callService("switch","turn_on",{entity_id:s.entity_id})}(function(e){return!!e&&null!==e.match(/^Schedule\ #[a-f0-9]{6}/)})(e.name)&&(e=Object.assign(Object.assign({},e),{name:""})),(t=this.hass,i=Object.assign(Object.assign({},e),{schedule_id:this.editItem}),t.callApi("POST","scheduler/edit",i)).catch(e=>gt(e,this,this.hass,this.cardEmbeddedInPopup)).then(()=>{this.closeDialog()})}}else((e,t)=>e.callApi("POST","scheduler/add",t))(this.hass,e).catch(e=>gt(e,this,this.hass,this.cardEmbeddedInPopup)).then(()=>{this.closeDialog()});var t,i}async _handleDeleteClick(e){if(!this.editItem)return;e.target;await new Promise(e=>{const t={title:Ps("ui.dialog.confirm_delete.title",it(this.hass)),description:Ps("ui.dialog.confirm_delete.description",it(this.hass)),primaryButtonLabel:this.hass.localize("ui.dialogs.generic.ok"),secondaryButtonLabel:this.hass.localize("ui.dialogs.generic.cancel"),cancel:()=>{e(!1)},confirm:()=>{e(!0)}};ht(this,{dialogTag:"generic-dialog",dialogImport:()=>Promise.resolve().then((function(){return Za})),dialogParams:t},this.cardEmbeddedInPopup)})&&_t(this.hass,this.editItem).catch(e=>gt(e,this,this.hass,this.cardEmbeddedInPopup)).then(()=>{this.closeDialog()})}static get styles(){return r`
- ${za}
+ `:N``}_handleUpdateParams(e){const t=e.detail;t.schedule&&(this.schedule=t.schedule),t.actions&&(this.actions=t.actions),t.entities&&(this.entities=t.entities),t.tab&&(this._currTab=t.tab)}_handleTabChanged(e){const t=this._currTab,i=this._tabs[e.detail.selected];if(i!=qe.Time&&!this.schedule)return e.preventDefault(),void(e.target.activeIndex=0);i!==t&&(this._currTab=i)}_enlarge(){this.large=!this.large}async _handleSaveClick(){if(!this.hass)return;let e=Object.assign({},this.schedule);if(e=Object.assign(Object.assign({},e),{timeslots:e.timeslots.map(e=>{var t;return e.actions&&e.actions.length?(e.actions.some(e=>!e.entity_id||"notify"==Ce(e.entity_id||""))&&(e=Object.assign(Object.assign({},e),{actions:e.actions.map(e=>e.entity_id&&"notify"!=Ce(e.entity_id||"")?e:Ye(e,"entity_id"))})),e.stop||(e=Ye(e,"stop")),(null===(t=e.conditions)||void 0===t?void 0:t.length)||(e=Ye(e,"conditions","condition_type")),e):null}).filter(Ge)}),this.editItem){const a=await pt(this.hass,this.editItem);if(Ke(Ye(e,"timeslots"),Ye(Fe(a,Object.keys(e)),"timeslots"))&&e.timeslots.length==a.timeslots.length&&e.timeslots.every((e,t)=>Ke(e,a.timeslots[t])));else{if(!a.enabled){await new Promise(e=>{const t={title:Ua("ui.dialog.enable_schedule.title",it(this.hass)),description:Ua("ui.dialog.enable_schedule.description",it(this.hass)),primaryButtonLabel:this.hass.localize("ui.common.yes"),secondaryButtonLabel:this.hass.localize("ui.common.no"),cancel:()=>{e(!1)},confirm:()=>{e(!0)}};mt(this,{dialogTag:"generic-dialog",dialogImport:()=>Promise.resolve().then((function(){return Xs})),dialogParams:t},this.cardEmbeddedInPopup)})&&this.hass.callService("switch","turn_on",{entity_id:a.entity_id})}(function(e){return!!e&&null!==e.match(/^Schedule\ #[a-f0-9]{6}/)})(e.name)&&(e=Object.assign(Object.assign({},e),{name:""})),(t=this.hass,i=Object.assign(Object.assign({},e),{schedule_id:this.editItem}),t.callApi("POST","scheduler/edit",i)).catch(e=>gt(e,this,this.hass,this.cardEmbeddedInPopup)).then(()=>{this.closeDialog()})}}else((e,t)=>e.callApi("POST","scheduler/add",t))(this.hass,e).catch(e=>gt(e,this,this.hass,this.cardEmbeddedInPopup)).then(()=>{this.closeDialog()});var t,i}async _handleDeleteClick(e){if(!this.editItem)return;e.target;await new Promise(e=>{const t={title:Ua("ui.dialog.confirm_delete.title",it(this.hass)),description:Ua("ui.dialog.confirm_delete.description",it(this.hass)),primaryButtonLabel:this.hass.localize("ui.dialogs.generic.ok"),secondaryButtonLabel:this.hass.localize("ui.dialogs.generic.cancel"),cancel:()=>{e(!1)},confirm:()=>{e(!0)}};mt(this,{dialogTag:"generic-dialog",dialogImport:()=>Promise.resolve().then((function(){return Xs})),dialogParams:t},this.cardEmbeddedInPopup)})&&_t(this.hass,this.editItem).catch(e=>gt(e,this,this.hass,this.cardEmbeddedInPopup)).then(()=>{this.closeDialog()})}static get styles(){return r`
+ ${Cs}
paper-tabs {
--paper-tabs-selection-bar-color: var(--primary-color);
@@ -1527,34 +1528,34 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
paper-tab.iron-selected {
color: var(--primary-color);
}
- `}};t([ae()],co.prototype,"_config",void 0),t([oe()],co.prototype,"_params",void 0),t([ae()],co.prototype,"editItem",void 0),t([ae({type:Boolean,reflect:!0})],co.prototype,"large",void 0),t([oe()],co.prototype,"_currTab",void 0),co=t([ie("scheduler-editor-dialog")],co);var uo=Object.freeze({__proto__:null,get SchedulerEditorDialog(){return co}});let ho=class extends ee{constructor(){super(...arguments),this.scheduleEntities=[],this._cardTab=!1,this.selectedDomain=""}setConfig(e){this._config=e}async firstUpdated(){await eo(),this.scheduleEntities=(await mt(this.hass)).map(e=>e.entity_id);const e=(await vt(this.hass)).map(e=>e.name);e.sort(Je),this.tagOptions=e}render(){return this.hass&&this._config?N`
+ `}};t([se()],_o.prototype,"_config",void 0),t([oe()],_o.prototype,"_params",void 0),t([se()],_o.prototype,"editItem",void 0),t([se({type:Boolean,reflect:!0})],_o.prototype,"large",void 0),t([oe()],_o.prototype,"_currTab",void 0),_o=t([ie("scheduler-editor-dialog")],_o);var vo=Object.freeze({__proto__:null,get SchedulerEditorDialog(){return _o}});let go=class extends ee{constructor(){super(...arguments),this.scheduleEntities=[],this._cardTab=!1,this.selectedDomain=""}setConfig(e){this._config=e}async firstUpdated(){await oo(),this.scheduleEntities=(await ht(this.hass)).map(e=>e.entity_id);const e=(await vt(this.hass)).map(e=>e.name);e.sort(Je),this.tagOptions=e}render(){return this.hass&&this._config?N`
- ${Ps("ui.panel.card_editor.tabs.entities",it(this.hass))}
- ${Ps("ui.panel.card_editor.tabs.other",it(this.hass))}
+ ${Ua("ui.panel.card_editor.tabs.entities",it(this.hass))}
+ ${Ua("ui.panel.card_editor.tabs.other",it(this.hass))}
${this._cardTab?N`
-
+
this._setTitleFormatOption(e.target.value)}
>
${"string"==typeof this._config.title?N`
{this._updateConfig({title:String(e.target.value)})}}
>
`:""}
- ${Ps("ui.panel.card_editor.fields.discover_existing.description",it(this.hass))}
+ ${Ua("ui.panel.card_editor.fields.discover_existing.description",it(this.hass))}
- ${Ps("ui.panel.card_editor.fields.time_step.description",it(this.hass))}
+ ${Ua("ui.panel.card_editor.fields.time_step.description",it(this.hass))}
- ${Ps("ui.panel.card_editor.fields.sort_by.description",it(this.hass))}
+ ${Ua("ui.panel.card_editor.fields.sort_by.description",it(this.hass))}
@@ -1612,10 +1613,10 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
@@ -1623,14 +1624,14 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
- ${Ps("ui.panel.card_editor.fields.display_format_primary.description",it(this.hass))}
+ ${Ua("ui.panel.card_editor.fields.display_format_primary.description",it(this.hass))}
- ${Ps("ui.panel.card_editor.fields.display_format_secondary.description",it(this.hass))}
+ ${Ua("ui.panel.card_editor.fields.display_format_secondary.description",it(this.hass))}
- ${Ps("ui.panel.card_editor.fields.show_header_toggle.description",it(this.hass))}
+ ${Ua("ui.panel.card_editor.fields.show_header_toggle.description",it(this.hass))}
- ${Ps("ui.panel.card_editor.fields.tags.heading",it(this.hass))}
+ ${Ua("ui.panel.card_editor.fields.tags.heading",it(this.hass))}
- ${Ps("ui.panel.card_editor.fields.tags.description",it(this.hass))}
+ ${Ua("ui.panel.card_editor.fields.tags.description",it(this.hass))}
@@ -1726,35 +1727,35 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
`:""}
`:N`
- ${Ps("ui.panel.card_editor.fields.entities.description",it(this.hass))}
+ ${Ua("ui.panel.card_editor.fields.entities.description",it(this.hass))}
${this.getDomainSwitches()}
`}
- `:N``}_selectTab(e){this._cardTab=1===e.detail.selected}_updateConfig(e){this._config&&(this._config=Object.assign(Object.assign({},this._config),e),Te(this,"config-changed",{config:this._config}))}_setTitleFormatOption(e){var t;this.hass&&("standard"==e?this._updateConfig({title:!0}):"hidden"==e?this._updateConfig({title:!1}):this._updateConfig({title:"string"==typeof(null===(t=this._config)||void 0===t?void 0:t.title)?this._config.title:Ps("ui.panel.common.title",it(this.hass))}))}getTitleOption(){return this.hass&&this._config?"string"==typeof this._config.title?"custom":this._config.title?"standard":"hidden":""}updateTags(e){if(!this._config||!this.hass)return;let t=e.target.value;t=t.map(e=>e.trim()),t.sort(Je),this._updateConfig({tags:t})}getTagOptions(){if(!this._config||!this.hass)return[];let e=this.tagOptions||[];if(this._config.tags){const t=st(this._config.tags);e=[...e,...t.filter(t=>!e.includes(t))]}return e.map(e=>Object({name:e,value:e}))}_setSortBy(e){var t;const i=e.target.checked,s=e.target.value;let a=st((null===(t=this._config)||void 0===t?void 0:t.sort_by)||Re.sort_by);"state"!=s&&i&&(a=a.filter(e=>"state"==e)),!a.includes(s)&&i&&(a=[...a,s]),a.includes(s)&&!i&&(a=a.filter(e=>e!=s)),this._updateConfig({sort_by:a})}_setDisplayOptionsPrimary(e){var t;const i=e.target.value,s=Object.assign(Object.assign({},(null===(t=this._config)||void 0===t?void 0:t.display_options)||Re.display_options),{primary_info:i});this._updateConfig({display_options:s})}_setDisplayOptionsSecondary(e){var t;const i=e.target.value,s=e.target.checked;let a=Object.assign({},(null===(t=this._config)||void 0===t?void 0:t.display_options)||Re.display_options),o=st(a.secondary_info||[]);o=s?Array.from(new Set([...o,i])):o.filter(e=>e!==i),o.sort((e,t)=>{const i={"relative-time":1,time:o.includes("relative-time")?3:2,days:o.includes("relative-time")?2:3,"additional-tasks":4},s=Object.keys(i).includes(e)?i[e]:5,a=Object.keys(i).includes(t)?i[t]:5;return s>a?1:s"switch"!==Ce(e)||!this.scheduleEntities.includes(e)).map(e=>lt(e,this.hass,{include:["*"]})).filter(e=>Ia(e.id,this.hass)||oa(e.id,this.hass,Re)),t=e.map(e=>Ce(e.id)).filter((e,t,i)=>i.indexOf(e)===t);return t.sort((e,t)=>e.trim().toLowerCase(){var i;const s=e.filter(e=>Ce(e.id)==t).length,a=e.filter(e=>Ce(e.id)==t),o=a.filter(e=>ra(e.id,this._config)).length;return s?N`
+ `:N``}_selectTab(e){this._cardTab=1===e.detail.selected}_updateConfig(e){this._config&&(this._config=Object.assign(Object.assign({},this._config),e),Te(this,"config-changed",{config:this._config}))}_setTitleFormatOption(e){var t;this.hass&&("standard"==e?this._updateConfig({title:!0}):"hidden"==e?this._updateConfig({title:!1}):this._updateConfig({title:"string"==typeof(null===(t=this._config)||void 0===t?void 0:t.title)?this._config.title:Ua("ui.panel.common.title",it(this.hass))}))}getTitleOption(){return this.hass&&this._config?"string"==typeof this._config.title?"custom":this._config.title?"standard":"hidden":""}updateTags(e){if(!this._config||!this.hass)return;let t=e.target.value;t=t.map(e=>e.trim()),t.sort(Je),this._updateConfig({tags:t})}getTagOptions(){if(!this._config||!this.hass)return[];let e=this.tagOptions||[];if(this._config.tags){const t=at(this._config.tags);e=[...e,...t.filter(t=>!e.includes(t))]}return e.map(e=>Object({name:e,value:e}))}_setSortBy(e){var t;const i=e.target.checked,a=e.target.value;let s=at((null===(t=this._config)||void 0===t?void 0:t.sort_by)||Re.sort_by);"state"!=a&&i&&(s=s.filter(e=>"state"==e)),!s.includes(a)&&i&&(s=[...s,a]),s.includes(a)&&!i&&(s=s.filter(e=>e!=a)),this._updateConfig({sort_by:s})}_setDisplayOptionsPrimary(e){var t;const i=e.target.value,a=Object.assign(Object.assign({},(null===(t=this._config)||void 0===t?void 0:t.display_options)||Re.display_options),{primary_info:i});this._updateConfig({display_options:a})}_setDisplayOptionsSecondary(e){var t;const i=e.target.value,a=e.target.checked;let s=Object.assign({},(null===(t=this._config)||void 0===t?void 0:t.display_options)||Re.display_options),o=at(s.secondary_info||[]);o=a?Array.from(new Set([...o,i])):o.filter(e=>e!==i),o.sort((e,t)=>{const i={"relative-time":1,time:o.includes("relative-time")?3:2,days:o.includes("relative-time")?2:3,"additional-tasks":4},a=Object.keys(i).includes(e)?i[e]:5,s=Object.keys(i).includes(t)?i[t]:5;return a>s?1:a"switch"!==Ce(e)||!this.scheduleEntities.includes(e)).map(e=>lt(e,this.hass,{include:["*"]})).filter(e=>Hs(e.id,this.hass)||cs(e.id,this.hass,Re)),t=e.map(e=>Ce(e.id)).filter((e,t,i)=>i.indexOf(e)===t);return t.sort((e,t)=>e.trim().toLowerCase(){var i;const a=e.filter(e=>Ce(e.id)==t).length,s=e.filter(e=>Ce(e.id)==t),o=s.filter(e=>ms(e.id,this._config)).length;return a?N`
this.toggleShowDomain(t)}>
${t}
- ${Ps("ui.panel.card_editor.fields.entities.included_number",it(this.hass),["{number}","{total}"],[o,s])}
+ ${Ua("ui.panel.card_editor.fields.entities.included_number",it(this.hass),["{number}","{total}"],[o,a])}
e.stopPropagation()}
@change=${e=>this.toggleSelectEntity(t,e.target.checked)}
- ?checked=${ra(t,this._config)}
- ?disabled=${ra(t,{groups:null===(i=this._config)||void 0===i?void 0:i.groups})}
+ ?checked=${ms(t,this._config)}
+ ?disabled=${ms(t,{groups:null===(i=this._config)||void 0===i?void 0:i.groups})}
>
${this.selectedDomain==t?N`
- ${a.map(e=>{var i,s;return N`
+ ${s.map(e=>{var i,a;return N`
this.toggleSelectEntity(e.id)}>
@@ -1764,15 +1765,15 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
`})}
`:""}
- `:""})}toggleShowDomain(e){this._config&&this.hass&&(this.selectedDomain!=e?this.selectedDomain=e:this.selectedDomain="")}toggleSelectEntity(e,t){if(!this._config||!this.hass)return;const i=ra(e,this._config);void 0===t&&(t=!i);const s=Ce(e);let a=[...this._config.include||[]],o=[...this._config.exclude||[]];if(!i&&t)o.includes(e)&&(o=o.filter(t=>t!=e)),a.includes(e)||(a=[...a,e]);else{if(!i||t)return;(s&&a.includes(s)||ra(e,{customize:this._config.customize})||s&&ra(s,{customize:this._config.customize}))&&(o=[...o,e]),a.includes(e)&&(a=a.filter(t=>t!=e))}a.sort(Je),o.sort(Je),this._updateConfig({include:a,exclude:o})}static get styles(){return r`
- ${ja}
+ `:""})}toggleShowDomain(e){this._config&&this.hass&&(this.selectedDomain!=e?this.selectedDomain=e:this.selectedDomain="")}toggleSelectEntity(e,t){if(!this._config||!this.hass)return;const i=ms(e,this._config);void 0===t&&(t=!i);const a=Ce(e);let s=[...this._config.include||[]],o=[...this._config.exclude||[]];if(!i&&t)o.includes(e)&&(o=o.filter(t=>t!=e)),s.includes(e)||(s=[...s,e]);else{if(!i||t)return;(a&&s.includes(a)||ms(e,{customize:this._config.customize})||a&&ms(a,{customize:this._config.customize}))&&(o=[...o,e]),s.includes(e)&&(s=s.filter(t=>t!=e))}s.sort(Je),o.sort(Je),this._updateConfig({include:s,exclude:o})}static get styles(){return r`
+ ${As}
paper-tabs {
--paper-tabs-selection-bar-color: var(--primary-color);
@@ -1821,13 +1822,13 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
ha-textfield {
width: 100%;
}
- `}};t([ae()],ho.prototype,"hass",void 0),t([ae()],ho.prototype,"_config",void 0),t([ae()],ho.prototype,"scheduleEntities",void 0),t([ae()],ho.prototype,"tagOptions",void 0),t([oe()],ho.prototype,"_cardTab",void 0),t([ae()],ho.prototype,"selectedDomain",void 0),ho=t([ie("scheduler-card-editor")],ho);let mo=class extends ee{constructor(){super(...arguments),this.updateInterval=60,this.timer=0}startRefreshTimer(e){clearInterval(this.timer),this.timer=window.setInterval(()=>{this.requestUpdate()},1e3*e),this.updateInterval=e}set hass(e){this._hass=e,this.startRefreshTimer(this.updateInterval)}relativeTime(e){if(!this._hass)return"";const t=new Date;let i=(t.getTime()-e.getTime())/1e3;const s=i>=0?"past":"future";i=Math.abs(i);const a=Math.round(i);if("future"==s&&a>0){if(i/3600>=6){const i=t.setHours(0,0,0,0),s=Math.floor((e.valueOf()-i.valueOf())/864e5);let a="";s>14?a=ao(e,it(this._hass)):s>7?a=Ps("ui.components.date.next_week_day",it(this._hass),"{weekday}",da(e,it(this._hass))):1==s?a=Ps("ui.components.date.tomorrow",it(this._hass)):s>0&&(a=da(e,it(this._hass)));let o=Ps("ui.components.time.absolute",it(this._hass),"{time}",ma(e,it(this._hass)));return 12==e.getHours()&&0==e.getMinutes()?o=Ps("ui.components.time.at_noon",it(this._hass)):0==e.getHours()&&0==e.getMinutes()&&(o=Ps("ui.components.time.at_midnight",it(this._hass))),String(a+" "+o).trim()}if(Math.round(i/60)>60&&Math.round(i/60)<120){const e=Math.round(i/60-60),t=this._hass.localize("ui.common.and");return`${new Intl.RelativeTimeFormat(it(this._hass).language,{numeric:"auto"}).format(1,"hour")} ${t} ${Intl.NumberFormat(it(this._hass).language,{style:"unit",unit:"minute",unitDisplay:"long"}).format(e)}`}if(Math.round(i)>60&&Math.round(i)<120){const e=Math.round(i-60),t=this._hass.localize("ui.common.and");return`${new Intl.RelativeTimeFormat(it(this._hass).language,{numeric:"auto"}).format(1,"minute")} ${t} ${Intl.NumberFormat(it(this._hass).language,{style:"unit",unit:"second",unitDisplay:"long"}).format(e)}`}}const o=function(e,t,i){void 0===t&&(t=Date.now()),void 0===i&&(i={});var s=Dt(Dt({},Nt),i||{}),a=(+e-+t)/1e3;if(Math.abs(a)
0)return{value:Math.round(c),unit:"year"};var u=12*c+l.getMonth()-d.getMonth();if(Math.round(Math.abs(u))>0)return{value:Math.round(u),unit:"month"};var h=a/604800;return{value:Math.round(h),unit:"week"}}(e);return new Intl.RelativeTimeFormat(it(this._hass).language,{numeric:"auto"}).format(o.value,o.unit)}render(){if(!this._hass||!this.datetime)return N``;const e=new Date,t=Math.round((this.datetime.valueOf()-e.valueOf())/1e3);let i=60;return Math.abs(t)<=150&&(i=Math.max(Math.ceil(Math.abs(t))/10,2)),this.updateInterval!=i&&this.startRefreshTimer(i),N`
+ `}};t([se()],go.prototype,"hass",void 0),t([se()],go.prototype,"_config",void 0),t([se()],go.prototype,"scheduleEntities",void 0),t([se()],go.prototype,"tagOptions",void 0),t([oe()],go.prototype,"_cardTab",void 0),t([se()],go.prototype,"selectedDomain",void 0),go=t([ie("scheduler-card-editor")],go);let fo=class extends ee{constructor(){super(...arguments),this.updateInterval=60,this.timer=0}startRefreshTimer(e){clearInterval(this.timer),this.timer=window.setInterval(()=>{this.requestUpdate()},1e3*e),this.updateInterval=e}set hass(e){this._hass=e,this.startRefreshTimer(this.updateInterval)}relativeTime(e){if(!this._hass)return"";const t=new Date;let i=(t.getTime()-e.getTime())/1e3;const a=i>=0?"past":"future";i=Math.abs(i);const s=Math.round(i);if("future"==a&&s>0){if(i/3600>=6){const i=t.setHours(0,0,0,0),a=Math.floor((e.valueOf()-i.valueOf())/864e5);let s="";a>14?s=co(e,it(this._hass)):a>7?s=Ua("ui.components.date.next_week_day",it(this._hass),"{weekday}",ps(e,it(this._hass))):1==a?s=Ua("ui.components.date.tomorrow",it(this._hass)):a>0&&(s=ps(e,it(this._hass)));let o=Ua("ui.components.time.absolute",it(this._hass),"{time}",fs(e,it(this._hass)));return 12==e.getHours()&&0==e.getMinutes()?o=Ua("ui.components.time.at_noon",it(this._hass)):0==e.getHours()&&0==e.getMinutes()&&(o=Ua("ui.components.time.at_midnight",it(this._hass))),String(s+" "+o).trim()}if(Math.round(i/60)>60&&Math.round(i/60)<120){const e=Math.round(i/60-60),t=this._hass.localize("ui.common.and");return`${new Intl.RelativeTimeFormat(it(this._hass).language,{numeric:"auto"}).format(1,"hour")} ${t} ${Intl.NumberFormat(it(this._hass).language,{style:"unit",unit:"minute",unitDisplay:"long"}).format(e)}`}if(Math.round(i)>60&&Math.round(i)<120){const e=Math.round(i-60),t=this._hass.localize("ui.common.and");return`${new Intl.RelativeTimeFormat(it(this._hass).language,{numeric:"auto"}).format(1,"minute")} ${t} ${Intl.NumberFormat(it(this._hass).language,{style:"unit",unit:"second",unitDisplay:"long"}).format(e)}`}}const o=function(e,t,i){void 0===t&&(t=Date.now()),void 0===i&&(i={});var a=Dt(Dt({},Nt),i||{}),s=(+e-+t)/1e3;if(Math.abs(s)0)return{value:Math.round(c),unit:"year"};var u=12*c+l.getMonth()-d.getMonth();if(Math.round(Math.abs(u))>0)return{value:Math.round(u),unit:"month"};var m=s/604800;return{value:Math.round(m),unit:"week"}}(e);return new Intl.RelativeTimeFormat(it(this._hass).language,{numeric:"auto"}).format(o.value,o.unit)}render(){if(!this._hass||!this.datetime)return N``;const e=new Date,t=Math.round((this.datetime.valueOf()-e.valueOf())/1e3);let i=60;return Math.abs(t)<=150&&(i=Math.max(Math.ceil(Math.abs(t))/10,2)),this.updateInterval!=i&&this.startRefreshTimer(i),N`
${Xe(this.relativeTime(this.datetime))}
- `}};t([ae()],mo.prototype,"_hass",void 0),t([ae()],mo.prototype,"datetime",void 0),mo=t([ie("my-relative-time")],mo),window.customCards=window.customCards||[],window.customCards.push({type:"scheduler-card",name:"Scheduler Card",description:"Card to manage schedule entities made with scheduler-component."}),console.info("%c SCHEDULER-CARD \n%c Version: "+"v3.2.12".padEnd(7," "),"color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray");const po=e=>new Date(e.timestamps[e.next_entries[0]]).valueOf(),_o=(e,t)=>{var i,s;if(!e.timeslots.every(e=>e.actions.every(e=>ra(e.entity_id||e.service,t))))return!1;let a=!0;const o=st(t.tags);o.length&&(a=!1,((e.tags||[]).some(e=>o.includes(e))||o.includes("none")&&!(null===(i=e.tags)||void 0===i?void 0:i.length)||o.includes("enabled")&&e.enabled||o.includes("disabled")&&!e.enabled)&&(a=!0));const n=st(t.exclude_tags);return n.length&&a&&((e.tags||[]).some(e=>n.includes(e))||n.includes("none")&&!(null===(s=e.tags)||void 0===s?void 0:s.length)||n.includes("enabled")&&e.enabled||n.includes("disabled")&&!e.enabled)&&(a=!1),a},vo=(e,t)=>!!t.discover_existing||!!e&&_o(e,t),go=(e,t,i)=>({primaryInfo:_a(e,t,i),secondaryInfo:va(e,t,i),icon:ga(e,t,i)});e.SchedulerCard=class extends(ka(ee)){constructor(){super(...arguments),this.showDiscovered=!1,this.translationsLoaded=!1,this.scheduleDisplayInfo={},this.connectionError=!1}static getConfigElement(){return document.createElement("scheduler-card-editor")}hassSubscribe(){return this.loadSchedules(),[this.hass.connection.subscribeMessage(e=>this.updateScheduleItem(e),{type:"scheduler_updated"})]}firstUpdated(){const e=this.hass;if(e.localize("ui.panel.config.automation.editor.actions.type.device_id.action"))this.translationsLoaded=!0;else{document.querySelector("home-assistant")._loadFragmentTranslations(e.language,"config").then(()=>{this.hass.localize})}}provideHass(e){e.hass=this.hass}async updateScheduleItem(e){var t;"scheduler_item_removed"!=e.event?pt(this.hass,e.schedule_id).then(t=>{var i;const s=null===(i=this.schedules)||void 0===i?void 0:i.find(t=>t.schedule_id==e.schedule_id);let a=[...this.schedules||[]];try{this.scheduleDisplayInfo=Object.assign(Object.assign({},this.scheduleDisplayInfo),{[t.schedule_id]:go(t,this._config,this.hass)})}catch(e){}t&&vo(t,this._config)?a=s?po(s)==po(t)?a.map(e=>e.schedule_id==t.schedule_id?t:e):this.sortSchedules(a.map(e=>e.schedule_id==t.schedule_id?t:e)):this.sortSchedules([...a,t]):s&&(a=a.filter(t=>t.schedule_id!=e.schedule_id)),this.schedules=[...a]}):this.schedules=null===(t=this.schedules)||void 0===t?void 0:t.filter(t=>t.schedule_id!=e.schedule_id)}async loadSchedules(){mt(this.hass).then(e=>{const t=e.filter(e=>vo(e,this._config));let i={};Object.keys(t).forEach(e=>{try{i=Object.assign(Object.assign({},i),{[t[e].schedule_id]:go(t[e],this._config,this.hass)})}catch(e){}}),this.scheduleDisplayInfo=i,this.schedules=this.sortSchedules(t)}).catch(e=>{this.schedules=[],this.connectionError=!0})}shouldUpdate(e){const t=e.get("hass"),i=e.get("_config");if(t&&1==e.size&&!this.translationsLoaded&&(t.localize("ui.panel.config.automation.editor.actions.type.device_id.action")||(this.translationsLoaded=!0)),i&&this._config){Object.keys(i).filter(e=>i[e]!==this._config[e]).some(e=>["tags","discover_existing","sort_by","display_options"].includes(e))&&(async()=>{await this.loadSchedules()})()}return!t||1!=e.size||!this.schedules||this.schedules.some(e=>JSON.stringify(t.states[e.entity_id])!==JSON.stringify(this.hass.states[e.entity_id]))}setConfig(e){at(e);const t=Object.assign(Object.assign({},Re),e);this._config=t}async getCardSize(){return new Promise(e=>{let t=0;const i=setInterval(()=>{if(t++,!this._config||!this.schedules&&!this.connectionError&&t<50)return;let s=this._config.title||this._config.show_header_toggle?3:1;this._config.show_add_button&&(s+=1);const a=((st(this._config.display_options.secondary_info||[]).length||2)+1)/2;this.schedules&&(s+=this.showDiscovered?this.schedules.length*a:this.schedules.filter(e=>_o(e,this._config)).length*a),clearInterval(i),e(Math.round(s))},50)})}render(){return this.hass&&this._config&&this.schedules?N`
+ `}};t([se()],fo.prototype,"_hass",void 0),t([se()],fo.prototype,"datetime",void 0),fo=t([ie("my-relative-time")],fo),window.customCards=window.customCards||[],window.customCards.push({type:"scheduler-card",name:"Scheduler Card",description:"Card to manage schedule entities made with scheduler-component."}),console.info("%c SCHEDULER-CARD \n%c Version: "+"v3.2.13".padEnd(7," "),"color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray");const yo=e=>new Date(e.timestamps[e.next_entries[0]]).valueOf(),bo=(e,t)=>{var i,a;if(!e.timeslots.every(e=>e.actions.every(e=>ms(e.entity_id||e.service,t))))return!1;let s=!0;const o=at(t.tags);o.length&&(s=!1,((e.tags||[]).some(e=>o.includes(e))||o.includes("none")&&!(null===(i=e.tags)||void 0===i?void 0:i.length)||o.includes("enabled")&&e.enabled||o.includes("disabled")&&!e.enabled)&&(s=!0));const n=at(t.exclude_tags);return n.length&&s&&((e.tags||[]).some(e=>n.includes(e))||n.includes("none")&&!(null===(a=e.tags)||void 0===a?void 0:a.length)||n.includes("enabled")&&e.enabled||n.includes("disabled")&&!e.enabled)&&(s=!1),s},ko=(e,t)=>!!t.discover_existing||!!e&&bo(e,t),wo=(e,t,i)=>({primaryInfo:bs(e,t,i),secondaryInfo:ks(e,t,i),icon:ws(e,t,i)});e.SchedulerCard=class extends(zs(ee)){constructor(){super(...arguments),this.showDiscovered=!1,this.translationsLoaded=!1,this.scheduleDisplayInfo={},this.connectionError=!1}static getConfigElement(){return document.createElement("scheduler-card-editor")}hassSubscribe(){return this.loadSchedules(),[this.hass.connection.subscribeMessage(e=>this.updateScheduleItem(e),{type:"scheduler_updated"})]}firstUpdated(){const e=this.hass;if(e.localize("ui.panel.config.automation.editor.actions.type.device_id.action"))this.translationsLoaded=!0;else{document.querySelector("home-assistant")._loadFragmentTranslations(e.language,"config").then(()=>{this.hass.localize})}}provideHass(e){e.hass=this.hass}async updateScheduleItem(e){var t;"scheduler_item_removed"!=e.event?pt(this.hass,e.schedule_id).then(t=>{var i;const a=null===(i=this.schedules)||void 0===i?void 0:i.find(t=>t.schedule_id==e.schedule_id);let s=[...this.schedules||[]];try{this.scheduleDisplayInfo=Object.assign(Object.assign({},this.scheduleDisplayInfo),{[t.schedule_id]:wo(t,this._config,this.hass)})}catch(e){}t&&ko(t,this._config)?s=a?yo(a)==yo(t)?s.map(e=>e.schedule_id==t.schedule_id?t:e):this.sortSchedules(s.map(e=>e.schedule_id==t.schedule_id?t:e)):this.sortSchedules([...s,t]):a&&(s=s.filter(t=>t.schedule_id!=e.schedule_id)),this.schedules=[...s]}):this.schedules=null===(t=this.schedules)||void 0===t?void 0:t.filter(t=>t.schedule_id!=e.schedule_id)}async loadSchedules(){ht(this.hass).then(e=>{const t=e.filter(e=>ko(e,this._config));let i={};Object.keys(t).forEach(e=>{try{i=Object.assign(Object.assign({},i),{[t[e].schedule_id]:wo(t[e],this._config,this.hass)})}catch(e){}}),this.scheduleDisplayInfo=i,this.schedules=this.sortSchedules(t)}).catch(e=>{this.schedules=[],this.connectionError=!0})}shouldUpdate(e){const t=e.get("hass"),i=e.get("_config");if(t&&1==e.size&&!this.translationsLoaded&&(t.localize("ui.panel.config.automation.editor.actions.type.device_id.action")||(this.translationsLoaded=!0)),i&&this._config){Object.keys(i).filter(e=>i[e]!==this._config[e]).some(e=>["tags","discover_existing","sort_by","display_options"].includes(e))&&(async()=>{await this.loadSchedules()})()}return!t||1!=e.size||!this.schedules||this.schedules.some(e=>JSON.stringify(t.states[e.entity_id])!==JSON.stringify(this.hass.states[e.entity_id]))}setConfig(e){st(e);const t=Object.assign(Object.assign({},Re),e);this._config=t}async getCardSize(){return new Promise(e=>{let t=0;const i=setInterval(()=>{if(t++,!this._config||!this.schedules&&!this.connectionError&&t<50)return;let a=this._config.title||this._config.show_header_toggle?3:1;this._config.show_add_button&&(a+=1);const s=((at(this._config.display_options.secondary_info||[]).length||2)+1)/2;this.schedules&&(a+=this.showDiscovered?this.schedules.length*s:this.schedules.filter(e=>bo(e,this._config)).length*s),clearInterval(i),e(Math.round(a))},50)})}render(){return this.hass&&this._config&&this.schedules?N`
@@ -1853,14 +1854,14 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
`:N``}renderRows(){if(!this._config||!this.hass||!this.schedules)return N``;if(this.connectionError)return N`
- ${Ps("ui.panel.overview.backend_error",it(this.hass))}
+ ${Ua("ui.panel.overview.backend_error",it(this.hass))}
`;if(!Object.keys(this.schedules).length)return N`
- ${Ps("ui.panel.overview.no_entries",it(this.hass))}
+ ${Ua("ui.panel.overview.no_entries",it(this.hass))}
- `;const e=this.schedules.filter(e=>_o(e,this._config)),t=this.schedules.filter(e=>!_o(e,this._config));return N`
+ `;const e=this.schedules.filter(e=>bo(e,this._config)),t=this.schedules.filter(e=>!bo(e,this._config));return N`
${e.map(e=>this.renderScheduleRow(e))}
${Object.keys(t).length?this.showDiscovered?N`
${t.map(e=>this.renderScheduleRow(e))}
@@ -1869,7 +1870,7 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
class="show-more"
@click=${()=>{this.showDiscovered=!1}}
>
- ${Xe(Ps("ui.panel.overview.hide_excluded",it(this.hass)))}
+ ${Xe(Ua("ui.panel.overview.hide_excluded",it(this.hass)))}
`:N`
@@ -1879,11 +1880,11 @@ class xa extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
@click=${()=>{this.showDiscovered=!0}}
>
+
- ${Ps("ui.panel.overview.excluded_items",it(this.hass),"{number}",t.length)}
+ ${Ua("ui.panel.overview.excluded_items",it(this.hass),"{number}",t.length)}