iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
25 lines • 102 kB
JavaScript
export const __rspack_esm_id=31863;export const __rspack_esm_ids=[31863];export const __webpack_modules__={90329(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(22441),r=i(10139),o=i(17062),n=t([o]);o=(n.then?(await n)():n)[0];class l extends o.V{get NO_AUTOMATION_TEXT(){return this.hass.localize("ui.panel.config.devices.automation.triggers.no_triggers")}get UNKNOWN_AUTOMATION_TEXT(){return this.hass.localize("ui.panel.config.devices.automation.triggers.unknown_trigger")}constructor(){super(r.nx,r.o9,t=>({device_id:t||"",trigger:"device",domain:"",entity_id:""}))}}l=(0,a.Cg)([(0,s.EM)("ha-device-trigger-picker")],l),e()}catch(t){e(t)}})},89849(t,e,i){i.d(e,{x:()=>a});const a="__ANY_STATE_IGNORE_ATTRIBUTES__"},30716(t,e,i){var a=i(62826),s=i(72274),r=i(34875),o=i(7731),n=i(5124),l=i(22441),h=i(1087);const d=t=>t.preventDefault();var c=i(57237);i(9503);class g extends s.h{async onChange(t){t.stopPropagation(),super.onChange(t),(0,h.r)(this,t.type)}render(){const t=this.renderText(),e=this.graphic&&"control"!==this.graphic&&!this.left?this.renderGraphic():n.s6,i=this.hasMeta&&this.left?this.renderMeta():n.s6,a=this.renderRipple();return n.qy` ${a} ${e} ${this.left?"":t} <ha-checkbox tabindex="${this.separateCheckboxClick?this.tabindex:-1}" .checked="${this.selected}" .indeterminate="${this.indeterminate}" ?disabled="${this.disabled||this.checkboxDisabled}" @change="${this.onChange}" @click="${this.separateCheckboxClick?c.d:d}" class="${this.left?"left":""}"> </ha-checkbox> ${this.left?t:""} ${i}`}constructor(...t){super(...t),this.checkboxDisabled=!1,this.indeterminate=!1,this.separateCheckboxClick=!1}}g.styles=[o.R,r.R,n.AH`:host{--mdc-theme-secondary:var(--primary-color)}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic,:host([graphic=control]) .mdc-deprecated-list-item__graphic,:host([graphic=large]) .mdc-deprecated-list-item__graphic,:host([graphic=medium]) .mdc-deprecated-list-item__graphic{margin-inline-end:var(--mdc-list-item-graphic-margin,16px);margin-inline-start:0px;direction:var(--direction)}ha-checkbox{flex-shrink:0;direction:var(--direction);margin-inline-start:auto;margin-inline-end:0;height:100%;justify-content:center}ha-checkbox.left{margin-inline-start:0}.mdc-deprecated-list-item__graphic{margin-top:var(--check-list-item-graphic-margin-top)}:host([graphic=icon]) .mdc-deprecated-list-item__graphic{margin-inline-start:0;margin-inline-end:var(--mdc-list-item-graphic-margin,32px)}`],(0,a.Cg)([(0,l.MZ)({type:Boolean,attribute:"checkbox-disabled"})],g.prototype,"checkboxDisabled",void 0),(0,a.Cg)([(0,l.MZ)({type:Boolean})],g.prototype,"indeterminate",void 0),(0,a.Cg)([(0,l.MZ)({type:Boolean,attribute:"separate-checkbox-click"})],g.prototype,"separateCheckboxClick",void 0),g=(0,a.Cg)([(0,l.EM)("ha-check-list-item")],g)},50043(t,e,i){i.d(e,{$:()=>s});i(18111),i(7588);const a=(t,e)=>{if("selector"in t&&"choose"in t.selector){const i=Object.keys(t.selector.choose.choices)[0];if(i)return{active_choice:i,[i]:e}}return e},s=t=>{const e={};return t.forEach(t=>{if(void 0!==t.description?.suggested_value&&null!==t.description?.suggested_value)e[t.name]=a(t,t.description.suggested_value);else if("default"in t)e[t.name]=a(t,t.default);else if("expandable"===t.type){const i=s(t.schema);(t.required||Object.keys(i).length)&&(e[t.name]=i)}else if(t.required){if("boolean"===t.type)e[t.name]=!1;else if("string"===t.type)e[t.name]="";else if("integer"===t.type)e[t.name]="valueMin"in t?t.valueMin:0;else if("constant"===t.type)e[t.name]=t.value;else if("float"===t.type)e[t.name]=0;else if("select"===t.type){if(t.options.length){const i=t.options[0];e[t.name]=Array.isArray(i)?i[0]:i}}else if("positive_time_period_dict"===t.type)e[t.name]={hours:0,minutes:0,seconds:0};else if("selector"in t){const i=t.selector;if("device"in i)e[t.name]=i.device?.multiple?[]:"";else if("entity"in i)e[t.name]=i.entity?.multiple?[]:"";else if("area"in i)e[t.name]=i.area?.multiple?[]:"";else if("label"in i)e[t.name]=i.label?.multiple?[]:"";else if("boolean"in i)e[t.name]=!1;else if("addon"in i||"attribute"in i||"file"in i||"icon"in i||"serial_port"in i||"template"in i||"text"in i||"theme"in i||"object"in i)e[t.name]="";else if("number"in i)e[t.name]=i.number?.min??0;else if("select"in i){if(i.select?.options.length){const a=i.select.options[0],s="string"==typeof a?a:a.value;e[t.name]=i.select.multiple?[s]:s}}else if("country"in i)i.country?.countries?.length&&(e[t.name]=i.country.countries[0]);else if("language"in i)i.language?.languages?.length&&(e[t.name]=i.language.languages[0]);else if("duration"in i)e[t.name]={hours:0,minutes:0,seconds:0};else if("time"in i)e[t.name]="00:00:00";else if("date"in i||"datetime"in i){const i=(new Date).toISOString().slice(0,10);e[t.name]=`${i}T00:00:00`}else if("color_rgb"in i)e[t.name]=[0,0,0];else if("color_temp"in i)e[t.name]=i.color_temp?.min_mireds??153;else if("action"in i||"trigger"in i||"condition"in i)e[t.name]=[];else if("media"in i||"target"in i)e[t.name]={};else if("state"in i)e[t.name]=i.state?.multiple?[]:"";else if("choose"in i){const a=Object.keys(i.choose.choices)[0];e[t.name]=a?{active_choice:a,[a]:s([{name:a,selector:i.choose.choices[a].selector}])[a]}:{}}else{if(!("numeric_threshold"in i))throw new Error(`Selector ${Object.keys(i)[0]} not supported in initial form data`);{const a="changed"===(i.numeric_threshold?.mode??"crossed")?"any":"above";e[t.name]="any"===a?{type:a}:{type:a,value:{number:i.numeric_threshold?.number?.min??0,active_choice:"number"}}}}}}else;}),e}},14404(t,e,i){i.a(t,async function(t,a){try{i.d(e,{S:()=>M});var s=i(62826),r=i(5124),o=i(22441),n=i(91450),l=i(71727),h=i(85694),d=i(53580),c=(i(47680),i(67094),t([h]));h=(c.then?(await c)():c)[0];const g="M11,17A1,1 0 0,0 12,18A1,1 0 0,0 13,17A1,1 0 0,0 12,16A1,1 0 0,0 11,17M11,3V7H13V5.08C16.39,5.57 19,8.47 19,12A7,7 0 0,1 12,19A7,7 0 0,1 5,12C5,10.32 5.59,8.78 6.58,7.58L12,13L13.41,11.59L6.61,4.79V4.81C4.42,6.45 3,9.05 3,12A9,9 0 0,0 12,21A9,9 0 0,0 21,12A9,9 0 0,0 12,3M18,12A1,1 0 0,0 17,11A1,1 0 0,0 16,12A1,1 0 0,0 17,13A1,1 0 0,0 18,12M6,12A1,1 0 0,0 7,13A1,1 0 0,0 8,12A1,1 0 0,0 7,11A1,1 0 0,0 6,12Z",p="M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z",u="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",m="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z",_="M12,2C15.31,2 18,4.66 18,7.95C18,12.41 12,19 12,19C12,19 6,12.41 6,7.95C6,4.66 8.69,2 12,2M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M20,19C20,21.21 16.42,23 12,23C7.58,23 4,21.21 4,19C4,17.71 5.22,16.56 7.11,15.83L7.75,16.74C6.67,17.19 6,17.81 6,18.5C6,19.88 8.69,21 12,21C15.31,21 18,19.88 18,18.5C18,17.81 17.33,17.19 16.25,16.74L16.89,15.83C18.78,16.56 20,17.71 20,19Z",v="M13 11H11V5H13M13 15H11V13H13M20 2H4C2.9 2 2 2.9 2 4V22L6 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2Z",y="M8,7A2,2 0 0,1 10,9V14A2,2 0 0,1 8,16A2,2 0 0,1 6,14V9A2,2 0 0,1 8,7M14,14C14,16.97 11.84,19.44 9,19.92V22H7V19.92C4.16,19.44 2,16.97 2,14H4A4,4 0 0,0 8,18A4,4 0 0,0 12,14H14M21.41,9.41L17.17,13.66L18.18,10H14A2,2 0 0,1 12,8V4A2,2 0 0,1 14,2H20A2,2 0 0,1 22,4V8C22,8.55 21.78,9.05 21.41,9.41Z",b="M18,6H13A2,2 0 0,0 11,8V10.28C10.41,10.62 10,11.26 10,12A2,2 0 0,0 12,14C13.11,14 14,13.1 14,12C14,11.26 13.6,10.62 13,10.28V8H16V16H8V8H10V6H8L6,6V18H18M20,20H4V4H20M20,2H4A2,2 0 0,0 2,4V20A2,2 0 0,0 4,22H20C21.11,22 22,21.1 22,20V4C22,2.89 21.11,2 20,2Z",f="M4,17V9H2V7H6V17H4M22,15C22,16.11 21.1,17 20,17H16V15H20V13H18V11H20V9H16V7H20A2,2 0 0,1 22,9V10.5A1.5,1.5 0 0,1 20.5,12A1.5,1.5 0 0,1 22,13.5V15M14,15V17H8V13C8,11.89 8.9,11 10,11H12V9H8V7H12A2,2 0 0,1 14,9V11C14,12.11 13.1,13 12,13H10V15H14Z",C="M21,9L17,5V8H10V10H17V13M7,11L3,15L7,19V16H14V14H7V11Z",$="M12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,2L14.39,5.42C13.65,5.15 12.84,5 12,5C11.16,5 10.35,5.15 9.61,5.42L12,2M3.34,7L7.5,6.65C6.9,7.16 6.36,7.78 5.94,8.5C5.5,9.24 5.25,10 5.11,10.79L3.34,7M3.36,17L5.12,13.23C5.26,14 5.53,14.78 5.95,15.5C6.37,16.24 6.91,16.86 7.5,17.37L3.36,17M20.65,7L18.88,10.79C18.74,10 18.47,9.23 18.05,8.5C17.63,7.78 17.1,7.15 16.5,6.64L20.65,7M20.64,17L16.5,17.36C17.09,16.85 17.62,16.22 18.04,15.5C18.46,14.77 18.73,14 18.87,13.21L20.64,17M12,22L9.59,18.56C10.33,18.83 11.14,19 12,19C12.82,19 13.63,18.83 14.37,18.56L12,22Z",w="M10.46,19C9,21.07 6.15,21.59 4.09,20.15C2.04,18.71 1.56,15.84 3,13.75C3.87,12.5 5.21,11.83 6.58,11.77L6.63,13.2C5.72,13.27 4.84,13.74 4.27,14.56C3.27,16 3.58,17.94 4.95,18.91C6.33,19.87 8.26,19.5 9.26,18.07C9.57,17.62 9.75,17.13 9.82,16.63V15.62L15.4,15.58L15.47,15.47C16,14.55 17.15,14.23 18.05,14.75C18.95,15.27 19.26,16.43 18.73,17.35C18.2,18.26 17.04,18.58 16.14,18.06C15.73,17.83 15.44,17.46 15.31,17.04L11.24,17.06C11.13,17.73 10.87,18.38 10.46,19M17.74,11.86C20.27,12.17 22.07,14.44 21.76,16.93C21.45,19.43 19.15,21.2 16.62,20.89C15.13,20.71 13.9,19.86 13.19,18.68L14.43,17.96C14.92,18.73 15.75,19.28 16.75,19.41C18.5,19.62 20.05,18.43 20.26,16.76C20.47,15.09 19.23,13.56 17.5,13.35C16.96,13.29 16.44,13.36 15.97,13.53L15.12,13.97L12.54,9.2H12.32C11.26,9.16 10.44,8.29 10.47,7.25C10.5,6.21 11.4,5.4 12.45,5.44C13.5,5.5 14.33,6.35 14.3,7.39C14.28,7.83 14.11,8.23 13.84,8.54L15.74,12.05C16.36,11.85 17.04,11.78 17.74,11.86M8.25,9.14C7.25,6.79 8.31,4.1 10.62,3.12C12.94,2.14 15.62,3.25 16.62,5.6C17.21,6.97 17.09,8.47 16.42,9.67L15.18,8.95C15.6,8.14 15.67,7.15 15.27,6.22C14.59,4.62 12.78,3.85 11.23,4.5C9.67,5.16 8.97,7 9.65,8.6C9.93,9.26 10.4,9.77 10.97,10.11L11.36,10.32L8.29,15.31C8.32,15.36 8.36,15.42 8.39,15.5C8.88,16.41 8.54,17.56 7.62,18.05C6.71,18.54 5.56,18.18 5.06,17.24C4.57,16.31 4.91,15.16 5.83,14.67C6.22,14.46 6.65,14.41 7.06,14.5L9.37,10.73C8.9,10.3 8.5,9.76 8.25,9.14Z",M={calendar:"M19,19H5V8H19M16,1V3H8V1H6V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H18V1M17,12H12V17H17V12Z",device:"M3 6H21V4H3C1.9 4 1 4.9 1 6V18C1 19.1 1.9 20 3 20H7V18H3V6M13 12H9V13.78C8.39 14.33 8 15.11 8 16C8 16.89 8.39 17.67 9 18.22V20H13V18.22C13.61 17.67 14 16.88 14 16S13.61 14.33 13 13.78V12M11 17.5C10.17 17.5 9.5 16.83 9.5 16S10.17 14.5 11 14.5 12.5 15.17 12.5 16 11.83 17.5 11 17.5M22 8H16C15.5 8 15 8.5 15 9V19C15 19.5 15.5 20 16 20H22C22.5 20 23 19.5 23 19V9C23 8.5 22.5 8 22 8M21 18H17V10H21V18Z",event:"M10,9A1,1 0 0,1 11,8A1,1 0 0,1 12,9V13.47L13.21,13.6L18.15,15.79C18.68,16.03 19,16.56 19,17.14V21.5C18.97,22.32 18.32,22.97 17.5,23H11C10.62,23 10.26,22.85 10,22.57L5.1,18.37L5.84,17.6C6.03,17.39 6.3,17.28 6.58,17.28H6.8L10,19V9M11,5A4,4 0 0,1 15,9C15,10.5 14.2,11.77 13,12.46V11.24C13.61,10.69 14,9.89 14,9A3,3 0 0,0 11,6A3,3 0 0,0 8,9C8,9.89 8.39,10.69 9,11.24V12.46C7.8,11.77 7,10.5 7,9A4,4 0 0,1 11,5M11,3A6,6 0 0,1 17,9C17,10.7 16.29,12.23 15.16,13.33L14.16,12.88C15.28,11.96 16,10.56 16,9A5,5 0 0,0 11,4A5,5 0 0,0 6,9C6,11.05 7.23,12.81 9,13.58V14.66C6.67,13.83 5,11.61 5,9A6,6 0 0,1 11,3Z",state:"M6.27 17.05C6.72 17.58 7 18.25 7 19C7 20.66 5.66 22 4 22S1 20.66 1 19 2.34 16 4 16C4.18 16 4.36 16 4.53 16.05L7.6 10.69L5.86 9.7L9.95 8.58L11.07 12.67L9.33 11.68L6.27 17.05M20 16C18.7 16 17.6 16.84 17.18 18H11V16L8 19L11 22V20H17.18C17.6 21.16 18.7 22 20 22C21.66 22 23 20.66 23 19S21.66 16 20 16M12 8C12.18 8 12.36 8 12.53 7.95L15.6 13.31L13.86 14.3L17.95 15.42L19.07 11.33L17.33 12.32L14.27 6.95C14.72 6.42 15 5.75 15 5C15 3.34 13.66 2 12 2S9 3.34 9 5 10.34 8 12 8Z",geo_location:"M12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5M12,2A7,7 0 0,0 5,9C5,14.25 12,22 12,22C12,22 19,14.25 19,9A7,7 0 0,0 12,2Z",homeassistant:d.mdiHomeAssistant,mqtt:C,numeric_state:f,sun:$,conversation:y,tag:b,template:u,time:p,time_pattern:g,webhook:w,persistent_notification:v,zone:_,list:m};class A extends r.WF{render(){if(this.icon)return r.qy`<ha-icon .icon="${this.icon}"></ha-icon>`;if(!this.trigger)return r.s6;if(!this.hass)return this._renderFallback();const t=(0,h.ab)(this.hass.connection,this.hass.config,this.trigger).then(t=>t?r.qy`<ha-icon .icon="${t}"></ha-icon>`:this._renderFallback());return r.qy`${(0,n.T)(t)}`}_renderFallback(){const t=(0,l.m)(this.trigger);return r.qy` <ha-svg-icon .path="${M[this.trigger]||h.l[t]}"></ha-svg-icon> `}}(0,s.Cg)([(0,o.MZ)({attribute:!1})],A.prototype,"hass",void 0),(0,s.Cg)([(0,o.MZ)()],A.prototype,"trigger",void 0),(0,s.Cg)([(0,o.MZ)()],A.prototype,"icon",void 0),A=(0,s.Cg)([(0,o.EM)("ha-trigger-icon")],A),a()}catch(t){a(t)}})},64013(t,e,i){var a=i(62826),s=i(97086),r=i(5124),o=i(22441);class n extends s.A{static get styles(){return[s.A.styles,r.AH`:host{--wa-form-control-required-content:var(
--ha-radio-group-required-marker,
var(--ha-input-required-marker, "*")
);--wa-form-control-required-content-offset:var(
--ha-radio-group-required-marker-offset,
0.1rem
)}`]}constructor(){super(),this.radioTag="ha-radio-option"}}n=(0,a.Cg)([(0,o.EM)("ha-radio-group")],n)},92677(t,e,i){var a=i(62826),s=i(17010),r=i(5124),o=i(22441);class n extends s.A{static get styles(){return[s.A.styles,r.AH`:host{--wa-form-control-activated-color:var(
--ha-radio-option-active-color,
var(--ha-color-fill-primary-loud-resting)
);--wa-form-control-height:var(--ha-radio-option-height, 40px);--wa-form-control-toggle-size:var(
--ha-radio-option-toggle-size,
20px
);--wa-form-control-border-width:var(
--ha-radio-option-border-width,
var(--ha-border-width-md)
);--wa-form-control-border-color:var(
--ha-radio-option-border-color,
var(--ha-color-border-neutral-normal)
);--wa-form-control-background-color:var(
--ha-radio-option-background-color,
var(--wa-form-control-background-color)
);--checked-icon-color:var(
--ha-radio-option-checked-icon-color,
var(--wa-form-control-activated-color)
);--checked-icon-scale:var(--ha-radio-option-checked-icon-scale, 0.7)}:host([appearance=default]) .control{margin:var(--ha-radio-option-control-margin,var(--ha-space-3) var(--ha-space-2) var(--ha-space-3) var(--ha-space-3))}:host(:not([aria-checked=true],[aria-disabled=true]):hover) .control{border-color:var(--ha-radio-option-border-color-hover,var(--ha-radio-option-border-color,var(--ha-color-border-neutral-loud)));background-color:var(--ha-radio-option-background-color-hover,var(--ha-color-fill-neutral-quiet-hover))}:host([aria-checked=true]) .control{background-color:var(--ha-radio-option-checked-background-color,var(--ha-color-fill-primary-normal-resting));color:var(--checked-icon-color);border-color:var(--checked-icon-color)}[part~=label]{display:inline-flex;align-items:center;cursor:pointer}:host([disabled]) [part~=label]{cursor:not-allowed}`]}}n=(0,a.Cg)([(0,o.EM)("ha-radio-option")],n)},78673(t,e,i){var a=i(62826),s=i(5124),r=i(22441),o=i(6412),n=i(89784),l=i(69093),h=i(28669);class d extends s.WF{willUpdate(t){if(super.willUpdate(t),t.has("user"))return void this._getPersonPicture();const e=t.get("hass");if(this._personEntityId&&e&&this.hass.states[this._personEntityId]!==e.states[this._personEntityId]){const t=this.hass.states[this._personEntityId];t?this._personPicture=t.attributes.entity_picture:this._getPersonPicture()}else!this._personEntityId&&e&&this._getPersonPicture()}render(){if(!this.hass||!this.user)return s.s6;const t=this._personPicture;if(t)return s.qy`<div style="${(0,n.W)({backgroundImage:`url(${this.hass.hassUrl(t)})`})}" class="picture"></div>`;const e=(0,h._2)(this.user.name);return s.qy`<div class="initials ${(0,o.H)({long:e.length>2})}"> ${e} </div>`}_getPersonPicture(){if(this._personEntityId=void 0,this._personPicture=void 0,this.hass&&this.user)for(const t of Object.values(this.hass.states))if(t.attributes.user_id===this.user.id&&"person"===(0,l.t)(t)){this._personEntityId=t.entity_id,this._personPicture=t.attributes.entity_picture;break}}}d.styles=s.AH`:host{display:block;width:40px;height:40px}.picture{width:100%;height:100%;background-size:cover;border-radius:var(--ha-border-radius-circle)}.initials{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;width:100%;height:100%;border-radius:var(--ha-border-radius-circle);background-color:var(--light-primary-color);text-decoration:none;color:var(--text-light-primary-color,var(--primary-text-color));overflow:hidden}.initials.long{font-size:var(--ha-font-size-s)}`,(0,a.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"user",void 0),(0,a.Cg)([(0,r.wk)()],d.prototype,"_personPicture",void 0),d=(0,a.Cg)([(0,r.EM)("ha-user-badge")],d)},81550(t,e,i){i.a(t,async function(t,e){try{i(18111),i(22489),i(61701),i(45367),i(92731);var a=i(62826),s=i(5124),r=i(22441),o=i(22786),n=i(1087),l=i(28669),h=(i(75064),i(38508)),d=(i(78673),t([h]));h=(d.then?(await d)():d)[0];const c=[{name:"primary",weight:10},{name:"search_labels.username",weight:6},{name:"id",weight:3}];class g extends s.WF{firstUpdated(t){super.firstUpdated(t),this.users||this._fetchUsers()}async _fetchUsers(){this.users=await(0,l.hU)(this.hass)}render(){const t=this.placeholder??this.hass.localize("ui.components.user-picker.user");return s.qy` <ha-generic-picker .hass="${this.hass}" .autofocus="${this.autofocus}" .label="${this.label}" .placeholder="${t}" .value="${this.value}" .notFoundLabel="${this._notFoundLabel}" .getItems="${this._getItems}" .valueRenderer="${this._valueRenderer}" .rowRenderer="${this._rowRenderer}" .searchKeys="${c}" .unknownItemText="${this.hass.localize("ui.components.user-picker.unknown")}" @value-changed="${this._valueChanged}"> </ha-generic-picker> `}_valueChanged(t){const e=t.detail.value;this.value=e,(0,n.r)(this,"value-changed",{value:e}),(0,n.r)(this,"change")}constructor(...t){super(...t),this.value="",this.disabled=!1,this.usersMap=(0,o.A)(t=>t?new Map(t.map(t=>[t.id,t])):new Map),this._valueRenderer=t=>{const e=this.usersMap(this.users).get(t);return e?s.qy` <ha-user-badge slot="start" .hass="${this.hass}" .user="${e}"></ha-user-badge> <span slot="headline">${e.name}</span> `:s.qy` <span slot="headline">${t}</span> `},this._rowRenderer=t=>t.user?s.qy` <ha-combo-box-item type="button" compact="compact"> <ha-user-badge slot="start" .hass="${this.hass}" .user="${t.user}"></ha-user-badge> <span slot="headline">${t.primary}</span> </ha-combo-box-item> `:s.qy`<ha-combo-box-item type="button" compact="compact"> ${t.icon?s.qy`<ha-icon slot="start" .icon="${t.icon}"></ha-icon>`:t.icon_path?s.qy`<ha-svg-icon slot="start" .path="${t.icon_path}"></ha-svg-icon>`:s.s6} <span slot="headline">${t.primary}</span> ${t.secondary?s.qy`<span slot="supporting-text">${t.secondary}</span>`:s.s6} </ha-combo-box-item>`,this._getUsers=(0,o.A)(t=>t?t.filter(t=>!t.system_generated).map(t=>({id:t.id,primary:t.name,domain_name:t.name,search_labels:{username:t.username},sorting_label:t.name,user:t})):[]),this._getItems=()=>this._getUsers(this.users),this._notFoundLabel=t=>this.hass.localize("ui.components.user-picker.no_match",{term:s.qy`<b>‘${t}’</b>`})}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)()],g.prototype,"label",void 0),(0,a.Cg)([(0,r.MZ)()],g.prototype,"placeholder",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],g.prototype,"noUserLabel",void 0),(0,a.Cg)([(0,r.MZ)()],g.prototype,"value",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],g.prototype,"users",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],g.prototype,"disabled",void 0),g=(0,a.Cg)([(0,r.EM)("ha-user-picker")],g),e()}catch(t){e(t)}})},27353(t,e,i){i.a(t,async function(t,e){try{i(74423),i(18111),i(22489),i(20116),i(61701);var a=i(62826),s=i(5124),r=i(22441),o=i(88508),n=i(22786),l=i(1087),h=i(28669),d=i(26300),c=i(81550),g=t([d,c]);[d,c]=g.then?(await g)():g;class p extends s.WF{firstUpdated(t){super.firstUpdated(t),this.users||this._fetchUsers()}async _fetchUsers(){this.users=await(0,h.hU)(this.hass)}render(){if(!this.hass||!this.users)return s.s6;const t=this._notSelectedUsers(this.users,this.value);return s.qy` ${this.label?s.qy`<label>${this.label}</label>`:s.s6} ${(0,o.a)([t],()=>this.value?.map((e,i)=>s.qy` <div> <ha-user-picker .placeholder="${this.pickedUserLabel}" .index="${i}" .hass="${this.hass}" .value="${e}" .users="${this._notSelectedUsersAndSelected(e,this.users,t)}" .disabled="${this.disabled}" @value-changed="${this._userChanged}"></ha-user-picker> </div> `))} <div> <ha-user-picker .placeholder="${this.pickUserLabel||this.hass.localize("ui.components.user-picker.add_user")}" .hass="${this.hass}" .users="${t}" .disabled="${this.disabled||!t?.length}" @value-changed="${this._addUser}"></ha-user-picker> </div> `}get _currentUsers(){return this.value||[]}async _updateUsers(t){this.value=t,(0,l.r)(this,"value-changed",{value:t})}_userChanged(t){t.stopPropagation();const e=t.currentTarget.index,i=t.detail.value,a=[...this._currentUsers];i?a.splice(e,1,i):a.splice(e,1),this._updateUsers(a)}async _addUser(t){t.stopPropagation();const e=t.detail.value;if(t.currentTarget.value="",!e)return;const i=this._currentUsers;i.includes(e)||this._updateUsers([...i,e])}constructor(...t){super(...t),this.disabled=!1,this._notSelectedUsers=(0,n.A)((t,e)=>e?t?.filter(t=>!t.system_generated&&!e.includes(t.id)):t?.filter(t=>!t.system_generated)),this._notSelectedUsersAndSelected=(t,e,i)=>{const a=e?.find(e=>e.id===t);return a?i?[...i,a]:[a]:i}}}p.styles=s.AH`div{margin-top:8px}`,(0,a.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)()],p.prototype,"label",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"value",void 0),(0,a.Cg)([(0,r.MZ)({attribute:"picked-user-label"})],p.prototype,"pickedUserLabel",void 0),(0,a.Cg)([(0,r.MZ)({attribute:"pick-user-label"})],p.prototype,"pickUserLabel",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"users",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],p.prototype,"disabled",void 0),p=(0,a.Cg)([(0,r.EM)("ha-users-picker")],p),e()}catch(t){e(t)}})},79276(t,e,i){i.d(e,{Gw:()=>o,PC:()=>a,VZ:()=>r,_R:()=>n,un:()=>s});const a="tag_scanned",s=async t=>t.callWS({type:"tag/list"}),r=async(t,e,i)=>t.callWS({type:"tag/create",tag_id:i,...e}),o=async(t,e,i)=>t.callWS({...i,type:"tag/update",tag_id:e}),n=async(t,e)=>t.callWS({type:"tag/delete",tag_id:e})},28669(t,e,i){i.d(e,{TK:()=>n,_2:()=>h,eR:()=>s,hG:()=>l,hU:()=>r,kg:()=>o,wj:()=>a,xg:()=>u});i(44114),i(18111),i(61701);const a="system-admin",s="system-users",r=async t=>t.callWS({type:"config/auth/list"}),o=async(t,e,i,a)=>t.callWS({type:"config/auth/create",name:e,group_ids:i,local_only:a}),n=async(t,e,i)=>t.callWS({...i,type:"config/auth/update",user_id:e}),l=async(t,e)=>t.callWS({type:"config/auth/delete",user_id:e}),h=t=>t?t.trim().split(" ").slice(0,3).map(t=>t.substring(0,1)).join(""):"?",d=66649!=i.j?"M12 2C6.47 2 2 6.5 2 12C2 17.5 6.5 22 12 22S22 17.5 22 12 17.5 2 12 2M12 20C7.58 20 4 16.42 4 12C4 7.58 7.58 4 12 4S20 7.58 20 12C20 16.42 16.42 20 12 20M8 14L7 8L10 10L12 7L14 10L17 8L16 14H8M8.56 16C8.22 16 8 15.78 8 15.44V15H16V15.44C16 15.78 15.78 16 15.44 16H8.56Z":null,c=66649!=i.j?"M11,7H15V9H11V11H13A2,2 0 0,1 15,13V15A2,2 0 0,1 13,17H9V15H13V13H11A2,2 0 0,1 9,11V9A2,2 0 0,1 11,7M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z":null,g=66649!=i.j?"M12 20C7.6 20 4 16.4 4 12S7.6 4 12 4 20 7.6 20 12 16.4 20 12 20M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M11 14H13V17H16V12H18L12 7L6 12H8V17H11V14":null,p=66649!=i.j?"M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22 2 17.5 2 12 6.5 2 12 2M12 4C10.1 4 8.4 4.6 7.1 5.7L18.3 16.9C19.3 15.5 20 13.8 20 12C20 7.6 16.4 4 12 4M16.9 18.3L5.7 7.1C4.6 8.4 4 10.1 4 12C4 16.4 7.6 20 12 20C13.9 20 15.6 19.4 16.9 18.3Z":null,u=(t,e,i)=>{const a=[],s=e=>t.localize(`ui.panel.config.users.${e}`);return e.is_owner&&a.push([d,s("is_owner")]),i&&e.system_generated&&a.push([c,s("is_system")]),e.local_only&&a.push([g,s("is_local")]),e.is_active||a.push([p,s("is_not_active")]),a}},11489(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(5124),r=i(22441),o=i(6412),n=i(69558),l=i(1087),h=i(10763),d=i(91485),c=i(88249),g=i(3496),p=i(14503),u=i(15702),m=(i(38333),t([h,d,u]));[h,d,u]=m.then?(await m)():m;class _ extends s.WF{render(){const t=(0,g.H4)(this.trigger)?"list":this.trigger.trigger,e=this.yamlMode||!this.uiSupported,i="id"in this.trigger||this.showId;return s.qy` <div class="${(0,o.H)({"card-content":!0,disabled:this.disabled||"enabled"in this.trigger&&!1===this.trigger.enabled&&!this.yamlMode,yaml:e,card:!this.inSidebar})}"> ${e?s.qy` ${this.uiSupported?s.s6:s.qy` <ha-automation-editor-warning .alertTitle="${this.hass.localize("ui.panel.config.automation.editor.triggers.unsupported_platform",{platform:t})}" .localize="${this.hass.localize}"></ha-automation-editor-warning> `} <ha-yaml-editor .defaultValue="${this.trigger}" .readOnly="${this.disabled}" @value-changed="${this._onYamlChange}"></ha-yaml-editor> `:s.qy` ${i&&!(0,g.H4)(this.trigger)?s.qy` <ha-input .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.id")}" .value="${this.trigger.id||""}" .disabled="${this.disabled}" @change="${this._idChanged}"></ha-input> `:s.s6} <div @value-changed="${this._onUiChanged}"> ${this.description?s.qy`<ha-automation-trigger-platform .hass="${this.hass}" .trigger="${this.trigger}" .description="${this.description}" .disabled="${this.disabled}"></ha-automation-trigger-platform>`:(0,n._)(`ha-automation-trigger-${t}`,{hass:this.hass,trigger:this.trigger,disabled:this.disabled})} </div> `} </div> `}_idChanged(t){if((0,g.H4)(this.trigger))return;const e=t.target.value;if(e===(this.trigger.id??""))return;const i={...this.trigger};e?i.id=e:delete i.id,(0,l.r)(this,"value-changed",{value:i})}_onYamlChange(t){t.stopPropagation(),t.detail.isValid&&(0,l.r)(this,this.inSidebar?"yaml-changed":"value-changed",{value:(0,c.vO)(t.detail.value)})}_onUiChanged(t){if((0,g.H4)(this.trigger))return;t.stopPropagation();const e={...this.trigger.alias?{alias:this.trigger.alias}:{},...this.trigger.note?{note:this.trigger.note}:{},...t.detail.value};(0,l.r)(this,"value-changed",{value:e})}static get styles(){return[p.RF,s.AH`.disabled{pointer-events:none}.card-content.yaml{padding:0 1px;border-top:1px solid var(--divider-color);border-bottom:1px solid var(--divider-color)}ha-input{margin-bottom:var(--ha-space-3)}`]}constructor(...t){super(...t),this.disabled=!1,this.yamlMode=!1,this.uiSupported=!1,this.inSidebar=!1,this.showId=!1}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],_.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],_.prototype,"disabled",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean,attribute:"yaml"})],_.prototype,"yamlMode",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean,attribute:"supported"})],_.prototype,"uiSupported",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean,attribute:"sidebar"})],_.prototype,"inSidebar",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean,attribute:"show-id"})],_.prototype,"showId",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],_.prototype,"description",void 0),(0,a.Cg)([(0,r.P)("ha-yaml-editor")],_.prototype,"yamlEditor",void 0),_=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-editor")],_),e()}catch(t){e(t)}})},71562(t,e,i){i.a(t,async function(t,a){try{i.d(e,{P:()=>vt});i(18111),i(13579);var s=i(62826),r=(i(68825),i(35211)),o=i(53289),n=i(5124),l=i(22441),h=i(22786),d=i(44537),c=i(93905),g=i(1087),p=i(99124),u=i(57237),m=i(52943),_=i(53516),v=i(78978),y=i(63130),b=i(9899),f=i(56214),C=i(7822),$=i(38962),w=(i(76776),i(29823)),M=(i(70947),i(11382),i(26300)),A=(i(67094),i(14404)),k=i(88249),H=i(79800),V=i(12596),x=i(22792),L=i(3496),z=i(65063),Z=i(41570),q=i(49053),S=i(15702),T=i(57116),E=i(62711),I=i(11489),U=i(29016),P=i(39165),O=i(6243),D=i(30248),F=i(99339),B=i(76321),W=i(55186),R=i(62565),j=i(89981),N=(i(38333),i(22629)),Y=i(38650),K=i(5816),G=i(20616),Q=i(40995),X=i(20790),J=i(33461),tt=i(88656),et=t([f,C,$,w,M,S,E,I,U,P,O,D,F,B,W,R,j,N,Y,K,G,Q,X,J,tt,A,H]);[f,C,$,w,M,S,E,I,U,P,O,D,F,B,W,R,j,N,Y,K,G,Q,X,J,tt,A,H]=et.then?(await et)():et;const it="M6,2A4,4 0 0,1 10,6V8H14V6A4,4 0 0,1 18,2A4,4 0 0,1 22,6A4,4 0 0,1 18,10H16V14H18A4,4 0 0,1 22,18A4,4 0 0,1 18,22A4,4 0 0,1 14,18V16H10V18A4,4 0 0,1 6,22A4,4 0 0,1 2,18A4,4 0 0,1 6,14H8V10H6A4,4 0 0,1 2,6A4,4 0 0,1 6,2M16,18A2,2 0 0,0 18,20A2,2 0 0,0 20,18A2,2 0 0,0 18,16H16V18M14,10H10V14H14V10M6,16A2,2 0 0,0 4,18A2,2 0 0,0 6,20A2,2 0 0,0 8,18V16H6M8,6A2,2 0 0,0 6,4A2,2 0 0,0 4,6A2,2 0 0,0 6,8H8V6M18,8A2,2 0 0,0 20,6A2,2 0 0,0 18,4A2,2 0 0,0 16,6V8H18Z",at="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",st="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",rt="M9 22C8.45 22 8 21.55 8 21V18H4C2.9 18 2 17.11 2 16V4C2 2.89 2.9 2 4 2H20C21.11 2 22 2.9 22 4V16C22 17.11 21.11 18 20 18H13.9L10.2 21.71C10 21.9 9.75 22 9.5 22H9M10 16V19.08L13.08 16H20V4H4V16H10M15.84 8.2L14.83 9.21L12.76 7.18L13.77 6.16C13.97 5.95 14.31 5.94 14.55 6.16L15.84 7.41C16.05 7.62 16.06 7.96 15.84 8.2M8 11.91L12.17 7.72L14.24 9.8L10.08 14H8V11.91Z",ot="M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9M10,16V19.08L13.08,16H20V4H4V16H10M6,7H18V9H6V7M6,11H15V13H6V11Z",nt="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",lt="M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z",ht="M19,20H5V4H7V7H17V4H19M12,2A1,1 0 0,1 13,3A1,1 0 0,1 12,4A1,1 0 0,1 11,3A1,1 0 0,1 12,2M19,2H14.82C14.4,0.84 13.3,0 12,0C10.7,0 9.6,0.84 9.18,2H5A2,2 0 0,0 3,4V20A2,2 0 0,0 5,22H19A2,2 0 0,0 21,20V4A2,2 0 0,0 19,2Z",dt="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",ct="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",gt="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M10,16.5L16,12L10,7.5V16.5Z",pt="M3 6V8H14V6H3M3 10V12H14V10H3M20 10.1C19.9 10.1 19.7 10.2 19.6 10.3L18.6 11.3L20.7 13.4L21.7 12.4C21.9 12.2 21.9 11.8 21.7 11.6L20.4 10.3C20.3 10.2 20.2 10.1 20 10.1M18.1 11.9L12 17.9V20H14.1L20.2 13.9L18.1 11.9M3 14V16H10V14H3Z",ut="M16,8H14V11H11V13H14V16H16V13H19V11H16M2,12C2,9.21 3.64,6.8 6,5.68V3.5C2.5,4.76 0,8.09 0,12C0,15.91 2.5,19.24 6,20.5V18.32C3.64,17.2 2,14.79 2,12M15,3C10.04,3 6,7.04 6,12C6,16.96 10.04,21 15,21C19.96,21 24,16.96 24,12C24,7.04 19.96,3 15,3M15,19C11.14,19 8,15.86 8,12C8,8.14 11.14,5 15,5C18.86,5 22,8.14 22,12C22,15.86 18.86,19 15,19Z",mt="M18,17H10.5L12.5,15H18M6,17V14.5L13.88,6.65C14.07,6.45 14.39,6.45 14.59,6.65L16.35,8.41C16.55,8.61 16.55,8.92 16.35,9.12L8.47,17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z",_t="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4M9,9V15H15V9",vt=(t,e)=>{e.stopPropagation();const i=e.currentTarget?.name;if(!i)return;const a=e.detail?.value||e.currentTarget?.value;if((t.trigger[i]||"")===a)return;let s;void 0===a||""===a?(s={...t.trigger},delete s[i]):s={...t.trigger,[i]:a},(0,g.r)(t,"value-changed",{value:s})};class yt extends n.WF{get selected(){return this._selected}_renderOverflowLabel(t,e){return n.qy` <div class="overflow-label"> ${t} ${this.optionsInSidebar&&!this.narrow?e||n.qy`<span class="shortcut-placeholder ${Z.c?"mac":""}"></span>`:n.s6} </div> `}_renderRow(){const t=this._getType(this.trigger,this.triggerDescriptions),e=this._uiSupported(t),i=this._yamlMode||!e,a="platform"===t&&"target"in this.triggerDescriptions[this.trigger.trigger],s=a?this.trigger.target:"device"===t&&this.trigger.device_id?{device_id:this.trigger.device_id}:void 0,r="platform"===t?this.triggerDescriptions[this.trigger.trigger]?.target:void 0,o=(0,_.C)("list"!==t&&this.trigger.note?.trim()||"",250);return n.qy` ${"list"===t?n.qy`<ha-svg-icon slot="leading-icon" class="trigger-icon" .path="${A.S[t]}"></ha-svg-icon>`:n.qy`<ha-trigger-icon slot="leading-icon" .hass="${this.hass}" .trigger="${this.trigger.trigger}"></ha-trigger-icon>`} <h3 slot="header"> ${(0,H.g)(this.trigger,this.hass,this._entityReg)} ${void 0!==s||a&&!this._isNew?this._renderTargets(s,a&&!this._isNew,r,"device"!==t):n.s6} ${"list"!==t&&this.trigger.note?.trim()?n.qy` <ha-svg-icon tabindex="0" id="note-icon" .path="${ot}" .label="${this.hass.localize("ui.panel.config.automation.editor.note.label")}" class="note-indicator"></ha-svg-icon> <ha-tooltip for="note-icon"><p>${o}</p></ha-tooltip> `:n.s6} </h3> <ha-automation-row-event-chip .show="${this._triggered}" slot="event" class="event-chip" interactive aria-live="polite" @click="${this._showTriggeredInfo}" @keydown="${this._showTriggeredInfo}"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.triggered")} </ha-automation-row-event-chip> <slot name="icons" slot="icons"></slot> <ha-dropdown slot="icons" @click="${p.C}" @keydown="${u.d}" @wa-select="${this._handleDropdownSelect}" placement="bottom-end"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.common.menu")}" .path="${ct}"></ha-icon-button> <ha-dropdown-item value="rename" .disabled="${this.disabled||"list"===t}"> <ha-svg-icon slot="icon" .path="${mt}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.triggers.rename"))} </ha-dropdown-item> ${"list"!==t?n.qy`<ha-dropdown-item value="edit_note"> <ha-svg-icon slot="icon" .path="${rt}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.note."+(this.trigger.note?"edit":"add")))} </ha-dropdown-item>`:n.s6} <wa-divider></wa-divider> <ha-dropdown-item value="duplicate" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${ut}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.duplicate"))} </ha-dropdown-item> <ha-dropdown-item value="copy" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${nt}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.triggers.copy"),n.qy`<span class="shortcut"> <span>${Z.c?n.qy`<ha-svg-icon .path="${it}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>C</span> </span>`)} </ha-dropdown-item> <ha-dropdown-item value="cut" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${lt}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.triggers.cut"),n.qy`<span class="shortcut"> <span>${Z.c?n.qy`<ha-svg-icon .path="${it}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>X</span> </span>`)} </ha-dropdown-item> ${this._pasteAvailable()?n.qy` <ha-dropdown-item value="paste"> <ha-svg-icon slot="icon" .path="${ht}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.paste"),n.qy`<span class="shortcut"> <span>${Z.c?n.qy`<ha-svg-icon .path="${it}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>V</span> </span>`)} </ha-dropdown-item> `:n.s6} ${this.optionsInSidebar?n.s6:n.qy` <ha-dropdown-item value="move_up" .disabled="${this.disabled||!!this.first}"> ${this.hass.localize("ui.panel.config.automation.editor.move_up")} <ha-svg-icon slot="icon" .path="${st}"></ha-svg-icon></ha-dropdown-item> <ha-dropdown-item value="move_down" .disabled="${this.disabled||!!this.last}"> ${this.hass.localize("ui.panel.config.automation.editor.move_down")} <ha-svg-icon slot="icon" .path="${at}"></ha-svg-icon></ha-dropdown-item> `} <ha-dropdown-item value="toggle_yaml_mode" .disabled="${!e||!!this._warnings}"> <ha-svg-icon slot="icon" .path="${pt}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.edit_"+(i?"ui":"yaml")))} </ha-dropdown-item> <wa-divider></wa-divider> <ha-dropdown-item value="disable" .disabled="${this.disabled||"list"===t}"> <ha-svg-icon slot="icon" .path="${"enabled"in this.trigger&&!1===this.trigger.enabled?gt:_t}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions."+("enabled"in this.trigger&&!1===this.trigger.enabled?"enable":"disable")))} </ha-dropdown-item> <ha-dropdown-item value="delete" variant="danger" .disabled="${this.disabled}"> <ha-svg-icon class="warning" slot="icon" .path="${dt}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.delete"),n.qy`<span class="shortcut"> <span>${Z.c?n.qy`<ha-svg-icon .path="${it}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>${this.hass.localize("ui.panel.config.automation.editor.del")}</span> </span>`)} </ha-dropdown-item> </ha-dropdown> ${this.optionsInSidebar?n.s6:n.qy`${this._warnings?n.qy`<ha-automation-editor-warning .localize="${this.hass.localize}" .warnings="${this._warnings}"> </ha-automation-editor-warning>`:n.s6} <ha-automation-trigger-editor .hass="${this.hass}" .trigger="${this.trigger}" .description="${"trigger"in this.trigger?this.triggerDescriptions[this.trigger.trigger]:void 0}" .disabled="${this.disabled}" .yamlMode="${this._yamlMode}" .uiSupported="${e}" @ui-mode-not-available="${this._handleUiModeNotAvailable}"></ha-automation-trigger-editor>`} `}render(){return this.trigger?n.qy` <ha-card outlined class="${this._selected?"selected":""}"> ${"enabled"in this.trigger&&!1===this.trigger.enabled?n.qy` <div class="disabled-bar"> ${this.hass.localize("ui.panel.config.automation.editor.actions.disabled")} </div> `:n.s6} ${this.optionsInSidebar?n.qy`<ha-automation-row .disabled="${"enabled"in this.trigger&&!1===this.trigger.enabled}" .selected="${this._selected}" .highlight="${this.highlight}" .sortSelected="${this.sortSelected}" .dim="${this._triggered}" @click="${this._toggleSidebar}">${this._selected?"selected":n.s6}${this._renderRow()}</ha-automation-row>`:n.qy` <ha-expansion-panel left-chevron @expanded-changed="${this._expansionPanelChanged}"> ${this._renderRow()} </ha-expansion-panel> `} </ha-card> `:n.s6}willUpdate(t){t.has("yamlMode")&&(this._warnings=void 0)}updated(t){super.updated(t),t.has("trigger")&&this._subscribeTrigger()}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.trigger&&this._subscribeTrigger()}disconnectedCallback(){super.disconnectedCallback(),this._triggerUnsub&&(this._triggerUnsub.then(t=>t()),this._triggerUnsub=void 0),this._doSubscribeTrigger.cancel()}_subscribeTrigger(){this._triggerUnsub&&(this._triggerUnsub.then(t=>t()),this._triggerUnsub=void 0),this._doSubscribeTrigger()}_handleUiModeNotAvailable(t){this._warnings=(0,v._)(this.hass,t.detail).warnings,this._yamlMode||(this._yamlMode=!0)}_toggleSidebar(t){t?.stopPropagation(),this._selected?(0,g.r)(this,"request-close-sidebar"):this.openSidebar()}markAsNew(){this._isNew=!0}_expansionPanelChanged(t){t.detail.expanded||(this._isNew=!1)}openSidebar(t){t=t||this.trigger,(0,g.r)(this,"open-sidebar",{save:t=>{(0,g.r)(this,"value-changed",{value:t})},close:t=>{this._selected=!1,this._isNew=!1,(0,g.r)(this,"close-sidebar"),t&&this.focus()},rename:()=>{this._renameTrigger()},editNote:this._editNoteTrigger,toggleYamlMode:()=>{this._toggleYamlMode(),this.openSidebar()},disable:this._onDisable,delete:this._onDelete,copy:this._copyTrigger,duplicate:this._duplicateTrigger,cut:this._cutTrigger,paste:this._pasteTrigger,pasteAvailable:this._pasteAvailable,insertAfter:this._insertAfter,config:t,uiSupported:this._uiSupported(this._getType(t,this.triggerDescriptions)),description:"trigger"in t?this.triggerDescriptions[t.trigger]:void 0,yamlMode:this._yamlMode}),this._selected=!0,this.narrow&&window.setTimeout(()=>{this.scrollIntoView({block:"start",behavior:"smooth"})},180)}_setClipboard(){this._clipboard={...this._clipboard,trigger:this.trigger},(0,y.l)((0,o.dump)(this.trigger))}_switchUiMode(){this._yamlMode=!1}_switchYamlMode(){this._yamlMode=!0}_showTriggeredInfo(t){t instanceof KeyboardEvent&&"Enter"!==t.key&&" "!==t.key||(t.stopPropagation(),(0,z.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.automation.editor.triggers.triggering_event_detail"),text:n.qy` <ha-yaml-editor read-only disable-fullscreen .defaultValue="${this._triggeredResult}"></ha-yaml-editor> `}))}expand(){this.updateComplete.then(()=>{this.shadowRoot.querySelector("ha-expansion-panel").expanded=!0})}focus(){this._automationRowElement?.focus()}_handleDropdownSelect(t){t.stopPropagation();const e=t.detail?.item?.value;if(e)switch(e){case"rename":this._renameTrigger();break;case"edit_note":this._editNoteTrigger();break;case"duplicate":this._duplicateTrigger();break;case"copy":this._copyTrigger();break;case"cut":this._cutTrigger();break;case"paste":this._pasteTrigger();break;case"move_up":this._moveUp();break;case"move_down":this._moveDown();break;case"toggle_yaml_mode":this._toggleYamlMode(t.target);break;case"disable":this._onDisable();break;case"delete":this._onDelete()}}static get styles(){return[T.bH,T.Lt]}constructor(...t){super(...t),this.disabled=!1,this.optionsInSidebar=!1,this.sortSelected=!1,this._yamlMode=!1,this._triggered=!1,this._selected=!1,this._isNew=!1,this.triggerDescriptions={},this.narrow=!1,this._entityReg=[],this._renderTargets=(0,h.A)((t,e=!1,i,a=!1)=>n.qy`<ha-automation-row-targets .target="${t}" .targetRequired="${e}" .selector="${i?{target:i}:void 0}" .interactive="${a}"></ha-automation-row-targets>`),this._doSubscribeTrigger=(0,b.s)(async()=>{let t;const e=this.trigger;this._triggerUnsub&&(this._triggerUnsub.then(t=>t()),this._triggerUnsub=void 0);if(!(await(0,V.$)(this.hass,{triggers:e})).triggers.valid||this.trigger!==e)return;const i=(0,k.Dp)(this.hass,e=>{void 0!==t&&(clearTimeout(t),this._eventChipElement?.highlight()),this._triggered=!0,this._triggeredResult=e,t=window.setTimeout(()=>{this._triggered=!1,t=void 0},5e3)},e);i.catch(()=>{this._triggerUnsub===i&&(this._triggerUnsub=void 0)}),this._triggerUnsub=i},5e3),this._onDelete=()=>{(0,g.r)(this,"value-changed",{value:null}),this._selected&&(0,g.r)(this,"close-sidebar"),(0,q.c)(this,{message:this.hass.localize("ui.common.successfully_deleted"),duration:4e3,action:{text:this.hass.localize("ui.common.undo"),action:()=>{(0,g.r)(window,"undo-change")}}})},this._onDisable=()=>{if((0,L.H4)(this.trigger))return;const t=!(this.trigger.enabled??1),e={...this.trigger,enabled:t};(0,g.r)(this,"value-changed",{value:e}),this._selected&&this.optionsInSidebar&&this.openSidebar(e),this._yamlMode&&!this.optionsInSidebar&&this.triggerEditor?.yamlEditor?.setValue(e)},this._renameTrigger=async()=>{if((0,L.H4)(this.trigger))return;const t=await(0,z.an)(this,{title:this.hass.localize("ui.panel.config.automation.editor.triggers.change_alias"),inputLabel:this.hass.localize("ui.panel.config.automation.editor.triggers.alias"),inputType:"string",placeholder:(0,m.Z)((0,H.g)(this.trigger,this.hass,this._entityReg,!0)),defaultValue:this.trigger.alias,confirmText:this.hass.localize("ui.common.submit")});if(null!==t){const e={...this.trigger};""===t?delete e.alias:e.alias=t,(0,g.r)(this,"value-changed",{value:e}),this._selected&&this.optionsInSidebar?this.openSidebar(e):this._yamlMode&&this.triggerEditor?.yamlEditor?.setValue(e)}},this._editNoteTrigger=async()=>{if((0,L.H4)(this.trigger))return;const t=this.trigger,e=await(0,z.an)(this,{title:this.hass.localize("ui.panel.config.automation.editor.note."+(t.note?"edit":"add")),inputLabel:this.hass.localize("ui.panel.config.automation.editor.note.label"),inputType:"string",defaultValue:t.note,confirmText:this.hass.localize("ui.common.submit"),multiline:!0});if(null!==e){const i={...t};""===e?delete i.note:i.note=e,(0,g.r)(this,"value-changed",{value:i}),this._selected&&this.optionsInSidebar?this.openSidebar(i):this._yamlMode&&this.triggerEditor?.yamlEditor?.setValue(i)}},this._duplicateTrigger=()=>{(0,g.r)(this,"duplicate")},this._insertAfter=t=>!(0,d.e)(t).some(t=>!(0,k.fo)(t))&&((0,g.r)(this,"insert-after",{value:t}),!0),this._copyTrigger=()=>{this._setClipboard(),this._selected&&this.optionsInSidebar&&this.openSidebar(),(0,q.c)(this,{message:this.hass.localize("ui.panel.config.automation.editor.triggers.copied_to_clipboard"),duration:2e3})},this._cutTrigger=()=>{this._setClipboard(),(0,g.r)(this,"value-changed",{value:null}),this._selected&&(0,g.r)(this,"close-sidebar"),(0,q.c)(this,{message:this.hass.localize("ui.panel.config.automation.editor.triggers.cut_to_clipboard"),duration:2e3})},this._pasteTrigger=()=>{const t=this._clipboard?.trigger;t&&(0,g.r)(this,"paste",{item:t})},this._pasteAvailable=()=>!!this._clipboard?.trigger,this._moveUp=()=>{(0,g.r)(this,"move-up")},this._moveDown=()=>{(0,g.r)(this,"move-down")},this._toggleYamlMode=t=>{this._yamlMode?this._switchUiMode():this._switchYamlMode(),this.optionsInSidebar?t&&this.openSidebar():this.expand()},this._getType=(0,h.A)((t,e)=>(0,L.H4)(t)?"list":t.trigger in e?"platform":t.trigger),this._uiSupported=(0,h.A)(t=>void 0!==customElements.get(`ha-automation-trigger-${t}`))}}(0,s.Cg)([(0,l.MZ)({attribute:!1})],yt.prototype,"hass",void 0),(0,s.Cg)([(0,l.MZ)({attribute:!1})],yt.prototype,"trigger",void 0),(0,s.Cg)([(0,l.MZ)({type:Boolean})],yt.prototype,"disabled",void 0),(0,s.Cg)([(0,l.MZ)({type:Boolean})],yt.prototype,"first",void 0),(0,s.Cg)([(0,l.MZ)({type:Boolean})],yt.prototype,"last",void 0),(0,s.Cg)([(0,l.MZ)({type:Boolean})],yt.prototype,"highlight",void 0),(0,s.Cg)([(0,l.MZ)({type:Boolean,attribute:"sidebar"})],yt.prototype,"optionsInSidebar",void 0),(0,s.Cg)([(0,l.MZ)({type:Boolean,attribute:"sort-selected"})],yt.prototype,"sortSelected",void 0),(0,s.Cg)([(0,l.wk)()],yt.prototype,"_yamlMode",void 0),(0,s.Cg)([(0,l.wk)()],yt.prototype,"_triggered",void 0),(0,s.Cg)([(0,l.wk)()],yt.prototype,"_selected",void 0),(0,s.Cg)([(0,l.wk)()],yt.prototype,"_isNew",void 0),(0,s.Cg)([(0,l.wk)()],yt.prototype,"_warnings",void 0),(0,s.Cg)([(0,l.MZ)({attribute:!1})],yt.prototype,"triggerDescriptions",void 0),(0,s.Cg)([(0,l.MZ)({type:Boolean})],yt.prototype,"narrow",void 0),(0,s.Cg)([(0,l.P)("ha-automation-trigger-editor")],yt.prototype,"triggerEditor",void 0),(0,s.Cg)([(0,l.P)("ha-automation-row")],yt.prototype,"_automationRowElement",void 0),(0,s.Cg)([(0,l.P)("ha-automation-row-event-chip")],yt.prototype,"_eventChipElement",void 0),(0,s.Cg)([(0,c.I)({key:"automationClipboard",state:!1,subscribe:!0,storage:"sessionStorage"})],yt.prototype,"_clipboard",void 0),(0,s.Cg)([(0,l.wk)(),(0,r.Fg)({context:x.ih,subscribe:!0})],yt.prototype,"_entityReg",void 0),yt=(0,s.Cg)([(0,l.EM)("ha-automation-trigger-row")],yt),a()}catch(t){a(t)}})},53723(t,e,i){i.a(t,async function(t,e){try{i(74423),i(18111),i(7588);var a=i(62826),s=i(34271),r=i(5124),o=i(22441),n=i(75751),l=i(1087),h=i(57237),d=i(18350),c=(i(85938),i(67094),i(88249)),g=i(93758),p=i(3496),u=i(54706),m=(i(49053),i(82405)),_=i(41175),v=i(57116),y=i(71562),b=t([d,y]);[d,y]=b.then?(await b)():b;const f="M21 11H3V9H21V11M21 13H3V15H21V13Z",C="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class $ extends((0,_.j)((0,u.E)(r.WF))){get items(){return this.triggers}set items(t){this.triggers=t}setHighlightedItems(t){this.highlightedTriggers=t}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribe()}hassSubscribe(){return[(0,g.CO)(this.hass.connection,"automation","new_triggers_conditions",t=>{this._newTriggersAndConditions=t.enabled})]}_subscribeDescriptions(){this._unsubscribe(),this._triggerDescriptions={},this._unsub=(0,p.Wv)(this.hass,t=>{this._triggerDescriptions={...this._triggerDescriptions,...t}})}_unsubscribe(){this._unsub&&(this._unsub.then(t=>t()),this._unsub=void 0)}willUpdate(t){super.willUpdate(t),t.has("_newTriggersAndConditions")&&this._subscribeDescriptions()}firstUpdated(t){super.firstUpdated(t),this.hass.loadBackendTranslation("triggers")}render(){return r.qy` <ha-sortable handle-selector=".handle" draggable-selector="ha-automation-trigger-row" .disabled="${this.disabled}" group="triggers" invert-swap @item-moved="${this.itemMoved}" @item-added="${this.itemAdded}" @item-removed="${this.itemRemoved}"> <div class="rows ${this.optionsInSidebar?"":"no-sidebar"}"> ${(0,n.u)(this.triggers,t=>this.getKey(t),(t,e)=>r.qy` <ha-automation-trigger-row .sortableData="${t}" .index="${e}" .first="${0===e}" .last="${e===this.triggers.length-1}" .trigger="${t}" .triggerDescriptions="${this._triggerDescriptions}" @duplicate="${this.duplicateItem}" @paste="${this.pasteItem}" @insert-after="${this.insertAfter}" @move-down="${this.moveDown}" @move-up="${this.moveUp}" @value-changed="${this.itemChanged}" .hass="${this.hass}" .disabled="${this.disabled}" .narrow="${this.narrow}" .highlight="${this.highlightedTriggers?.includes(t)}" .optionsInSidebar="${this.optionsInSidebar}" .sortSelected="${this.rowSortSelected===e}" @stop-sort-selection="${this.stopSortSelection}"> ${this.disabled?r.s6:r.qy` <div tabindex="0" class="handle ${this.rowSortSelected===e?"active":""}" slot="icons" @keydown="${this.handleDragKeydown}" @click="${h.d}" .index="${e}"> <ha-svg-icon .path="${f}"></ha-svg-icon> </div> `} </ha-automation-trigger-row> `)} <div class="buttons"> <ha-button .disabled="${this.disabled}" @click="${this._addTriggerDialog}" .appearance="${this.root?"accent":"filled"}" .size="${this.root?"medium":"small"}"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.add")} <ha-svg-icon .path="${C}" slot="start"></ha-svg-icon> </ha-button> </div> </div> </ha-sortable> `}_addTriggerDialog(){this.narrow&&(0,l.r)(this,"request-close-sidebar"),(0,m.gZ)(this,{type:"trigger",add:this._addTrigger,clipboardItem:this._clipboard?.trigger?(0,p.H4)(this._clipboard.trigger)?"list":this._clipboard?.trigger?.trigger:void 0,clipboardPasteToastBottomOffset:this.editorDirty?60:void 0})}updated(t){if(super.updated(t),!this.hass)return;const e=(0,m.II)(this.hass.states,this.hass.devices,this.hass.areas,"trigger");if(t.has("triggers")&&e&&(this._openedAddDialogFromQuery=!1),!this._openedAddDialogFromQuery&&this.root&&!this.disabled&&0===this.triggers.length&&e?(this._openedAddDialogFromQuery=!0,queueMicrotask(()=>this._addTriggerDialog())):this._openedAddDialogFromQuery&&!e&&(this._openedAddDialogFromQuery=!1),t.has("triggers")&&(this.focusLastItemOnChange||void 0!==this.focusItemIndexOnChange)){const t=this.shadowRoot.querySelector("ha-automation-trigger-row:"+(this.focusLastItemOnChange?"last-of-type":`nth-of-type(${this.focusItemIndexOnChange+1})`));this.focusLastItemOnChange=!1,this.focusItemIndexOnChange=void 0,t.updateComplete.then(()=>{this.optionsInSidebar?(t.openSidebar(),this.narrow&&t.scrollIntoView({block:"start",behavior:"smooth"})):(t.expand(),t.focus()),t.markAsNew()})}}expandAll(){this.shadowRoot.querySelectorAll("ha-automation-trigger-row").forEach(t=>{t.expand()})}constructor(...t){super(...t),this.root=!1,this.editorDirty=!1,this._triggerDescriptions={},this._newTriggersAndConditions=!1,this._openedAddDialogFromQuery=!1,this._addTrigger=(t,e)=>{let i;if(t===m.uV)i=this.triggers.concat((0,s.A)(this._clipboard.trigger));else if((0,c.Q)(t))i=this.triggers.concat({trigger:(0,c.Dt)(t),target:e});else{const a=t,s=customElements.get(`ha-automation-trigger-${a}`);i=this.triggers.concat({...s.defaultConfig,...e?.entity_id?{entity_id:e.entity_id}:{}})}this.focusLastItemOnChange=!0,(0,l.r)(this,"value-changed",{value:i})}}}$.styles=v.Ju,(0,a.Cg)([(0,o.MZ)({attribute:!1})],$.prototype,"triggers",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],$.prototype,"highlightedTriggers",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean})],$.prototype,"root",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean,attribute:!1})],$.prototype,"editorDirty",void 0),(0,a.Cg)([(0,o.wk)()],$.prototype,"_triggerDescriptions",void 0),(0,a.Cg)([(0,o.wk)()],$.prototype,"_newTriggersAndConditions",void 0),$=(0,a.Cg)([(0,o.EM)("ha-automation-trigger")],$),e()}catch(t){e(t)}})},29016(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(5124),r=i(22441),o=i(22786),n=i(1087),l=i(52763),h=i(57673),d=t([l]);l=(d.then?(await d)():d)[0];class c extends s.WF{static get defaultConfig(){return{trigger:"calendar",entity_id:"",event:"start",offset:"0"}}render(){const t=this._schema(this.hass.localize),e=this.trigger.offset,i=(0,h.z)(e);let a="after";("object"==typeof e&&i.hours<0||"string"==typeof e&&e.startsWith("-"))&&(i.hours=Math.abs(i.hours),a="before");const r={...this.trigger,offset:i,offset_type:a};return s.qy` <ha-form .schema="${t}" .data="${r}" .hass="${this.hass}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value.offset,i="before"===t.detail.value.offset_type?"-":"",a={...t.detail.value,offset:`${i}${e.hours??0}:${e.minutes??0}:${e.seconds??0}`};delete a.offset_type,(0,n.r)(this,"value-changed",{value:a})}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,o.A)(t=>[{name:"entity_id",required:!0,selector:{entity:{domain:"calendar"}}},{name:"event",type:"select",required:!0,options:[["start",t("ui.panel.config.automation.editor.triggers.type.calendar.start")],["end",t("ui.panel.config.automation.editor.triggers.type.calendar.end")]]},{name:"offset",required:!0,selector:{duration:{}}},{name:"offset_type",type:"select",required:!0,options:[["before",t("ui.panel.config.automation.editor.triggers.type.calendar.before")],["after",t("ui.panel.config.automation.editor.triggers.type.calendar.after")]]}]),this._computeLabelCallback=t=>{switch(t.name){case"entity_id":return this.hass.localize("ui.components.entity.entity-picker.entity");case"event":return this.hass.localize("ui.panel.config.automation.editor.triggers.type.calendar.event")}return""}}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],c.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],c.prototype,"disabled",void 0),c=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-calendar")],c),e()}catch(t){e(t)}})},39165(t,e,i){i.a(t,async function(t,e){try{i(18111),i(61701);var a=i(62826),s=(i(68825),i(5124)),r=i(22441),o=i(44537),n=i(1087),l=i(26300),h=i(91485),d=i(65063),c=t([l,h]);[l,h]=c.then?(await c)():c;const g="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",p="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",u="^[^.。,,?¿?؟!!;;::]+$";class m extends s.WF{static get defaultConfig(){return{trigger:"conversation",command:""}}render(){const{command:t}=this.trigger,e=t?(0,o.e)(t):[];return s.qy`${e.length?s.qy`${e.map((t,e)=>s.qy` <ha-input class="option" iconTrailing .index="${e}" .value="${t}" .validationMessage="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.conversation.no_punctuation")}" auto-validate validateOnInitialRender pattern="${u}" @change="${this._updateOption}"> <ha-icon-button @click="${this._removeOption}" slot="end" .path="${g}"></ha-icon-button> </ha-input> `)} <wa-divider></wa-divider>`:s.s6} <ha-input class="flex-auto" id="option_input" .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.conversation.add_sentence")}" .validationMessage="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.conversation.no_punctuation")}" auto-validate pattern="${u}" @keydown="${this._handleKeyAdd}" @change="${this._addOption}"> <ha-icon-button @click="${this._addOption}" slot="end" .path="${p}"></ha-icon-button> </ha-input>`}_handleKeyAdd(t){t.stopPropagation(),"Enter"===t.key&&this._addOption()}_addOption(){const t=this._optionInput;t?.value&&((0,n.r)(this,"value-changed",{value:{...this.trigger,command:this.trigger.command.length?[...Array.isArray(this.trigger.command)?this.trigger.command:[this.trigger.command],t.value]:t.value}}),t.value="")}async _updateOption(t){const e=t.target.index,i=[...Array.isArray(this.trigger.command)?this.trigger.command:[this.trigger.command]];i.splice(e,1,t.target.value??""),(0,n.r)(this,"value-changed",{value:{...this.trigger,command:i}})}async _removeOption(t){const e=t.target.parentElement.index;if(!await(0,d.dk)(this,{title:this.hass.localize("ui.panel.config.automation.editor.triggers.type.conversation.delete"),text:this.hass.localize("ui.panel.config.automation.editor.triggers.type.conversation.confirm_delete"),destructive:!0}))return;let i;Array.isArray(this.trigger.command)?(i=[...this.trigger.command],i.splice(e,1)):i="",(0,n.r)(this,"value-changed",{value:{...this.trigger,command:i}})}constructor(...t){super(...t),this.disabled=!1}}m.styles=s.AH`.layout{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;justify-content:flex-start}.option{margin-top:4px}ha-input{margin-bottom:var(--ha-space-1)}#option_input{margin-top:8px}.header{margin-top:8px;margin-bottom:8px}wa-divider{margin-top:var(--ha-space-2);margin-bottom:var(--ha-space-3)}`,(0,a.Cg)([(0,r.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],m.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],m.prototype,"disabled",void 0),(0,a.Cg)([(0,r.P)("#option_input",!0)],m.prototype,"_optionInput",void 0),m=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-conversation")],m),e()}catch(t){e(t)}})},6243(t,e,i){i.a(t,async function(t,e){try{i(18111),i(7588);var a=i(62826),s=i(35211),r=i(5124),o=i(22441),n=i(22786),l=i(1087),h=i(19459),d=i(1798),c=i(90329),g=i(50043),p=i(52763),u=i(22792),m=i(10139),_=t([d,c,p]);[d,c,p]=_.then?(await _)():_;class v extends r.WF{static get defaultConfig(){return{trigger:"device",device_id:"",domain:"",entity_id:""}}shouldUpdate(t){return!t.has("trigger")||(!this.trigger.device_id||this.trigger.device_id in this.hass.devices||((0,l.r)(this,"ui-mode-not-available",Error(this.hass.localize("ui.panel.config.automation.editor.edit_unknown_device"))),!1))}render(){const t=this._deviceId||this.trigger.device_id;return r.qy` <ha-device-picker .value="${t}" @value-changed="${this._devicePicked}" .hass="${this.hass}" .disabled="${this.disabled}" .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.device.label")}"></ha-device-picker> <ha-device-trigger-picker .value="${this.trigger}" .deviceId="${t}" @value-changed="${this._deviceTriggerPicked}" .hass="${this.hass}" .disabled="${this.disabled}" .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.device.trigger")}"></ha-device-trigger-picker> ${this._capabilities?.extra_fields?r.qy` <ha-form .hass="${this.hass}" .data="${this._extraFieldsData(this.trigger,this._capabilities)}" .schema="${this._capabilities.extra_fields}" .disabled="${this.disabled}" .computeLabel="${(0,m.T_)(this.hass.localize,this.trigger)}" .computeHelper="${(0,m.TH)(this.hass.localize,this.trigger)}" @value-changed="${this._extraFieldsChanged}"></ha-form> `:""} `}firstUpdated(){this.hass.loadBackendTranslation("device_automation"),this._capabilities||this._getCapabilities(),this.trigger&&(this._origTrigger=this.trigger)}updated(t){if(!t.has("trigger"))return;const e=t.get("trigger");e&&!(0,m.Po)(this._entityReg,e,this.trigger)&&this._getCapabilities()}async _getCapabilities(){const t=this.trigger;if(this._capabilities=t.domain?await(0,m.TB)(this.hass.callWS,t):void 0,this._capabilities){const t={...this.trigger,...this._extraFieldsData(this.trigger,this._capabilities)};(0,h.b)(this.trigger,t)||(0,l.r)(this,"value-changed",{value:t})}}_devicePicked(t){t.stopPropagation(),this._deviceId=t.target.value,void 0===this._deviceId&&(0,l.r)(this,"value-changed",{value:{...v.defaultConfig,trigger:"device"}})}_deviceTriggerPicked(t){t.stopPropagation();let e=t.detail.value;this._origTrigger&&(0,m.Po)(this._entityReg,this._origTrigger,e)&&(e=this._origTrigger),this.trigger.id&&(e.id=this.trigger.id),(0,l.r)(this,"value-changed",{value:e})}_extraFieldsChanged(t){t.stopPropagation(),(0,l.r)(this,"value-changed",{value:{...this.trigger,...t.detail.value}})}constructor(...t){super(...t),this.disabled=!1,this._entityReg=[],this._extraFieldsData=(0,n.A)((t,e)=>{const i=(0,g.$)(e.extra_fields);return e.extra_fields.forEach(e=>{void 0!==t[e.name]&&(i[e.name]=t[e.name])}),i})}}v.styles=r.AH`:host{display:block;margin-bottom:var(--ha-space-3)}ha-device-picker{display:block;margin-bottom:24px}ha-form{display:block;margin-top:24px}`,(0,a.Cg)([(0,o.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({type:Object})],v.prototype,"trigger",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean})],v.prototype,"disabled",void 0),(0,a.Cg)([(0,o.wk)()],v.prototype,"_deviceId",void 0),(0,a.Cg)([(0,o.wk)()],v.prototype,"_capabilities",void 0),(0,a.Cg)([(0,o.wk)(),(0,s.Fg)({context:u.ih,subscribe:!0})],v.prototype,"_entityReg",void 0),v=(0,a.Cg)([(0,o.EM)("ha-automation-trigger-device")],v),e()}catch(t){e(t)}})},30248(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(5124),r=i(22441),o=i(1087),n=i(10763),l=i(91485),h=i(27353),d=i(71562),c=t([n,l,h,d]);[n,l,h,d]=c.then?(await c)():c;class g extends s.WF{static get defaultConfig(){return{trigger:"event",event_type:""}}render(){const{event_type:t,event_data:e,context:i}=this.trigger;return s.qy` <ha-input .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.event.event_type")}" name="event_type" .value="${t}" .disabled="${this.disabled}" @change="${this._valueChanged}"></ha-input> <ha-yaml-editor .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.event.event_data")}" .name="${"event_data"}" .readOnly="${this.disabled}" .defaultValue="${e}" @value-changed="${this._dataChanged}"></ha-yaml-editor> <br> ${this.hass.localize("ui.panel.config.automation.editor.triggers.type.event.context_users")} <ha-users-picker .hass="${this.hass}" .disabled="${this.disabled}" .value="${this._wrapUsersInArray(i?.user_id)}" @value-changed="${this._usersChanged}"></ha-users-picker> `}_wrapUsersInArray(t){return t?"string"==typeof t?[t]:t:[]}_valueChanged(t){t.stopPropagation(),(0,d.P)(this,t)}_dataChanged(t){t.stopPropagation(),t.detail.isValid&&(0,d.P)(this,t)}_usersChanged(t){t.stopPropagation();const e={...this.trigger};!t.detail.value.length&&e.context?delete e.context.user_id:(e.context||(e.context={}),e.context.user_id=t.detail.value),(0,o.r)(this,"value-changed",{value:e})}constructor(...t){super(...t),this.disabled=!1}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],g.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],g.prototype,"disabled",void 0),g=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-event")],g),e()}catch(t){e(t)}})},99339(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(52763),r=i(5124),o=i(22441),n=i(22786),l=i(1087),h=t([s]);s=(h.then?(await h)():h)[0];class d extends r.WF{static get defaultConfig(){return{trigger:"geo_location",source:"",zone:"",event:"enter"}}render(){return r.qy` <ha-form .schema="${this._schema(this.hass.localize)}" .data="${this.trigger}" .hass="${this.hass}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value;(0,l.r)(this,"value-changed",{value:e})}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,n.A)(t=>[{name:"source",selector:{text:{}}},{name:"zone",selector:{entity:{domain:"zone"}}},{name:"event",type:"select",required:!0,options:[["enter",t("ui.panel.config.automation.editor.triggers.type.geo_location.enter")],["leave",t("ui.panel.config.automation.editor.triggers.type.geo_location.leave")]]}]),this._computeLabelCallback=t=>this.hass.localize(`ui.panel.config.automation.editor.triggers.type.geo_location.${t.name}`)}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],d.prototype,"trigger",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean})],d.prototype,"disabled",void 0),d=(0,a.Cg)([(0,o.EM)("ha-automation-trigger-geo_location")],d),e()}catch(t){e(t)}})},76321(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(52763),r=i(5124),o=i(22441),n=i(22786),l=i(1087),h=t([s]);s=(h.then?(await h)():h)[0];class d extends r.WF{static get defaultConfig(){return{trigger:"homeassistant",event:"start"}}render(){return r.qy` <ha-form .schema="${this._schema(this.hass.localize)}" .data="${this.trigger}" .hass="${this.hass}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value;(0,l.r)(this,"value-changed",{value:e})}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,n.A)(t=>[{name:"event",type:"select",required:!0,options:[["start",t("ui.panel.config.automation.editor.triggers.type.homeassistant.start")],["shutdown",t("ui.panel.config.automation.editor.triggers.type.homeassistant.shutdown")]]}]),this._computeLabelCallback=t=>this.hass.localize(`ui.panel.config.automation.editor.triggers.type.homeassistant.${t.name}`)}}d.styles=r.AH`label{display:flex;align-items:center}`,(0,a.Cg)([(0,o.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],d.prototype,"trigger",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean})],d.prototype,"disabled",void 0),d=(0,a.Cg)([(0,o.EM)("ha-automation-trigger-homeassistant")],d),e()}catch(t){e(t)}})},55186(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(5124),r=i(22441),o=i(44537),n=i(53723),l=i(71562),h=t([n,l]);[n,l]=h.then?(await h)():h;class d extends s.WF{static get defaultConfig(){return{triggers:[]}}render(){const t=(0,o.e)(this.trigger.triggers);return s.qy` <ha-automation-trigger .triggers="${t}" .hass="${this.hass}" .disabled="${this.disabled}" .name="${"triggers"}" @value-changed="${this._valueChanged}"></ha-automation-trigger> `}_valueChanged(t){(0,l.P)(this,t)}constructor(...t){super(...t),this.disabled=!1}}d.styles=s.AH``,(0,a.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],d.prototype,"disabled",void 0),d=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-list")],d),e()}catch(t){e(t)}})},62565(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(5124),r=i(22441),o=i(22786),n=i(44537),l=i(57673),h=i(1087),d=i(24790),c=i(52763),g=t([c]);c=(g.then?(await g)():g)[0];class p extends s.WF{willUpdate(t){this._inputAboveIsEntity=this._inputAboveIsEntity??("string"==typeof this.trigger.above&&(this.trigger.above.startsWith("input_number.")||this.trigger.above.startsWith("number.")||this.trigger.above.startsWith("sensor."))),this._inputBelowIsEntity=this._inputBelowIsEntity??("string"==typeof this.trigger.below&&(this.trigger.below.startsWith("input_number.")||this.trigger.below.startsWith("number.")||this.trigger.below.startsWith("sensor."))),t.has("trigger")&&this.trigger&&(0,d.r)(this.trigger.for)&&(0,h.r)(this,"ui-mode-not-available",Error(this.hass.localize("ui.errors.config.no_template_editor_support")))}static get defaultConfig(){return{trigger:"numeric_state",entity_id:[]}}render(){const t=this._schema(this.hass.localize,this._inputAboveIsEntity,this._inputBelowIsEntity),e=this._data(this._inputAboveIsEntity,this._inputBelowIsEntity,this.trigger);return s.qy` <ha-form .hass="${this.hass}" .data="${e}" .schema="${t}" .disabled="${this.disabled}" @value-changed="${this._valueChanged}" .computeLabel="${this._computeLabelCallback}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e={...t.detail.value};this._inputAboveIsEntity="input"===e.lower_limit,this._inputBelowIsEntity="input"===e.upper_limit,delete e.lower_limit,delete e.upper_limit,""===e.value_template&&delete e.value_template,(0,h.r)(this,"value-changed",{value:e})}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,o.A)((t,e,i)=>[{name:"entity_id",required:!0,selector:{entity:{multiple:!0}}},{name:"attribute",context:{filter_entity:"entity_id"},selector:{attribute:{hide_attributes:["access_token","auto_update","available_modes","away_mode","changed_by","code_arm_required","code_format","color_mode","color_modes","current_activity","device_class","editable","effect_list","effect","entity_id","entity_picture","event_type","event_types","fan_mode","fan_modes","fan_speed_list","forecast","friendly_name","frontend_stream_type","has_date","has_time","hs_color","hvac_mode","hvac_modes","icon","id","latest_version","max_color_temp_kelvin","max_mireds","max_temp","media_album_name","media_artist","media_content_type","media_position_updated_at","media_title","min_color_temp_kelvin","min_mireds","min_temp","mode","next_dawn","next_dusk","next_midnight","next_noon","next_rising","next_setting","operation_list","operation_mode","options","percentage_step","precipitation_unit","preset_mode","preset_modes","pressure_unit","release_notes","release_summary","release_url","restored","rgb_color","rgbw_color","shuffle","skipped_version","sound_mode_list","sound_mode","source_list","source_type","source","state_class","step","supported_color_modes","supported_features","swing_mode","swing_modes","target_temp_step","temperature_unit","title","token","unit_of_measurement","user_id","uuid","visibility_unit","wind_speed_unit","xy_color"]}}},{name:"lower_limit",type:"select",required:!0,options:[["value",t("ui.panel.config.automation.editor.triggers.type.numeric_state.type_value")],["input",t("ui.panel.config.automation.editor.triggers.type.numeric_state.type_input")]]},...e?[{name:"above",selector:{entity:{domain:["input_number","number","sensor"]}}}]:[{name:"above",selector:{number:{mode:"box",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,step:.1}}}],{name:"upper_limit",type:"select",required:!0,options:[["value",t("ui.panel.config.automation.editor.triggers.type.numeric_state.type_value")],["input",t("ui.panel.config.automation.editor.triggers.type.numeric_state.type_input")]]},...i?[{name:"below",selector:{entity:{domain:["input_number","number","sensor"]}}}]:[{name:"below",selector:{number:{mode:"box",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,step:.1}}}],{name:"value_template",selector:{template:{}}},{name:"for",selector:{duration:{}}}]),this._data=(0,o.A)((t,e,i)=>({lower_limit:t?"input":"value",upper_limit:e?"input":"value",...i,entity_id:(0,n.e)(i.entity_id),for:(0,l.z)(i.for)})),this._computeLabelCallback=t=>{switch(t.name){case"entity_id":return this.hass.localize("ui.components.entity.entity-picker.entity");case"attribute":return this.hass.localize("ui.components.entity.entity-attribute-picker.attribute");case"for":return this.hass.localize("ui.panel.config.automation.editor.triggers.type.state.for");default:return this.hass.localize(`ui.panel.config.automation.editor.triggers.type.numeric_state.${t.name}`)}}}}p.styles=s.AH`:host{display:block;margin-bottom:var(--ha-space-3)}`,(0,a.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],p.prototype,"disabled",void 0),(0,a.Cg)([(0,r.wk)()],p.prototype,"_inputAboveIsEntity",void 0),(0,a.Cg)([(0,r.wk)()],p.prototype,"_inputBelowIsEntity",void 0),p=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-numeric_state")],p),e()}catch(t){e(t)}})},89981(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(22786),r=i(5124),o=i(22441),n=i(1087),l=(i(30716),i(52763)),h=i(26300),d=t([l,h]);[l,h]=d.then?(await d)():d;const c=["added","removed"],g="";class p extends r.WF{static get defaultConfig(){return{trigger:"persistent_notification",update_type:[...c],notification_id:g}}render(){const t=this._schema(this.hass.localize);return r.qy` <ha-form .schema="${t}" .data="${this.trigger}" .hass="${this.hass}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value;(0,n.r)(this,"value-changed",{value:e})}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,s.A)(t=>[{name:"notification_id",required:!1,selector:{text:{}}},{name:"update_type",type:"multi_select",required:!1,options:[["added",t("ui.panel.config.automation.editor.triggers.type.persistent_notification.update_types.added")],["removed",t("ui.panel.config.automation.editor.triggers.type.persistent_notification.update_types.removed")],["current",t("ui.panel.config.automation.editor.triggers.type.persistent_notification.update_types.current")],["updated",t("ui.panel.config.automation.editor.triggers.type.persistent_notification.update_types.updated")]]}]),this._computeLabelCallback=t=>this.hass.localize(`ui.panel.config.automation.editor.triggers.type.persistent_notification.${t.name}`)}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],p.prototype,"trigger",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean})],p.prototype,"disabled",void 0),p=(0,a.Cg)([(0,o.EM)("ha-automation-trigger-persistent_notification")],p),e()}catch(t){e(t)}})},38333(t,e,i){i(74423),i(18111),i(20116),i(7588),i(61701),i(13579),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698);var a=i(62826),s=i(5124),r=i(22441),o=i(22786),n=i(1087),l=(i(9503),i(11399),i(8034),i(95350)),h=i(88555),d=i(3496),c=i(36918);const g=t=>t.selector&&!t.required&&!("boolean"in t.selector&&t.default),p=["trigger","target","alias","note","id","variables","enabled","options"];class u extends s.WF{static get defaultConfig(){return{trigger:""}}willUpdate(t){if(super.willUpdate(t),this.hasUpdated||(this.hass.loadBackendTranslation("triggers"),this.hass.loadBackendTranslation("selector")),!t.has("trigger"))return;let e;for(const t in this.trigger)p.includes(t)||(void 0===e?e={...this.trigger,options:{[t]:this.trigger[t]}}:e.options[t]=this.trigger[t],delete e[t]);void 0!==e&&((0,n.r)(this,"value-changed",{value:e}),this.trigger=e);const i=t.get("trigger");if(this.trigger?.trigger){const t=(0,d.zz)(this.trigger.trigger);t!==(0,d.zz)(i?.trigger||"")&&this._fetchManifest(t)}else this._manifest=void 0;if(this.trigger&&i?.trigger!==this.trigger.trigger&&this.description?.fields){const t="options"in this.trigger,e=this.trigger.options?{...this.trigger.options}:{},i=!t;let a=!1;Object.entries(this.description.fields).forEach(([t,s])=>{s.selector&&s.required&&void 0===s.default&&"boolean"in s.selector&&void 0===e[t]?(a=!0,e[t]=!1):!i||!s.selector||void 0===s.default||void 0!==e[t]||s.selector&&"automation_behavior"in s.selector&&this.description?.target&&!this.trigger?.target||(a=!0,e[t]=s.default)}),t&&!a||(0,n.r)(this,"value-changed",{value:{...this.trigger,options:e}})}i?.target!==this.trigger?.target&&this._updateResolvedTargetEntityCount(this.trigger?.target)}render(){const t=(0,d.zz)(this.trigger.trigger),e=(0,d.hN)(this.trigger.trigger),i=this.hass.localize(`component.${t}.triggers.${e}.description`),a=this.description,r=!a?.fields,o=Boolean(a?.fields&&Object.values(a.fields).some(t=>g(t)));return s.qy` <div class="description"> ${i?s.qy`<p>${i}</p>`:s.s6} ${this._manifest?s.qy`<a href="${this._manifest.is_built_in?(0,c.o)(this.hass,`/integrations/${this._manifest.domain}`):this._manifest.documentation}" title="${this.hass.localize("ui.components.service-control.integration_doc")}" target="_blank" rel="noreferrer"> <ha-icon-button .path="${"M11,18H13V16H11V18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z"}" class="help-icon"></ha-icon-button> </a>`:s.s6} </div> ${a&&"target"in a?s.qy`<ha-settings-row narrow> <span slot="heading">${this.hass.localize("ui.components.service-control.target")}</span><ha-selector .hass="${this.hass}" .selector="${this._targetSelector(a.target)}" .disabled="${this.disabled}" @value-changed="${this._targetChanged}" .value="${this.trigger?.target}"></ha-selector></ha-settings-row>`:s.s6} ${r?s.qy`<ha-yaml-editor .label="${this.hass.localize("ui.components.service-control.action_data")}" .name="${"data"}" .readOnly="${this.disabled}" .defaultValue="${this.trigger?.options}" @value-changed="${this._dataChanged}"></ha-yaml-editor>`:Object.entries(a.fields).map(([i,a])=>this._renderField(i,a,o,t,e))} `}_generateContext(t){if(!t.context)return;const e={};for(const[i,a]of Object.entries(t.context))"target"===a&&this.description?.target&&(e.target_selector=this._targetSelector(this.description.target)),e[i]="target"===a?this.trigger.target:this.trigger.options?.[a];return e}_dataChanged(t){if(t.stopPropagation(),!1===t.detail.isValid)return;const e=t.currentTarget.key,i=t.detail.value;if(!(this.trigger?.options?.[e]!==i&&(this.trigger?.options&&e in this.trigger.options||""!==i&&void 0!==i)))return;const a={...this.trigger?.options,[e]:i};(""===i||void 0===i||"object"==typeof i&&!Object.keys(i).length)&&delete a[e],(0,n.r)(this,"value-changed",{value:{...this.trigger,options:a}})}_targetChanged(t){t.stopPropagation(),(0,n.r)(this,"value-changed",{value:{...this.trigger,target:t.detail.value}})}_toggleCheckbox(t){const e=t.currentTarget?.parentElement?.querySelector("ha-checkbox");e?.click()}_checkboxChanged(t){const e=t.currentTarget.checked,i=t.currentTarget.key;let a;if(e){this._checkedKeys.add(i);const t=this.description&&Object.entries(this.description).find(([t,e])=>t===i)?.[1];let e=t?.default;null==e&&t?.selector&&"constant"in t.selector&&(e=t.selector.constant?.value),null==e&&t?.selector&&"boolean"in t.selector&&(e=!1),null!=e&&(a={...this.trigger?.options,[i]:e})}else this._checkedKeys.delete(i),a={...this.trigger?.options},delete a[i];a&&(0,n.r)(this,"value-changed",{value:{...this.trigger,options:a}}),this.requestUpdate("_checkedKeys")}async _fetchManifest(t){this._manifest=void 0;try{this._manifest=await(0,l.QC)(this.hass,t)}catch(e){console.log(`Unable to fetch integration manifest for ${t}`)}}_updateResolvedTargetEntityCount(t){this._resolvedTargetEntityCount=(0,h.aW)(t);const e=Object.entries(this.description?.fields??{}).find(([,t])=>t.selector&&"automation_behavior"in t.selector);if(!e)return;const[i,a]=e;if(t&&this._resolvedTargetEntityCount>1&&void 0===this.trigger.options?.[i]){const t=a.default;void 0!==t&&(0,n.r)(this,"value-changed",{value:{...this.trigger,options:{...this.trigger.options,[i]:t}}})}}constructor(...t){super(...t),this.disabled=!1,this._checkedKeys=new Set,this._targetSelector=(0,o.A)(t=>t?{target:{...t}}:{target:{}}),this._renderField=(t,e,i,a,r)=>{const o=e?.selector??{text:null},n=g(e);if(!e.selector)return s.s6;if("automation_behavior"in o&&this.description?.target&&(!this.trigger?.target||void 0!==this._resolvedTargetEntityCount&&this._resolvedTargetEntityCount<=1))return s.s6;const l=this.hass.localize(`component.${a}.triggers.${r}.fields.${t}.description`);return s.qy`<ha-settings-row narrow> ${n?s.qy`<ha-checkbox .key="${t}" .checked="${this._checkedKeys.has(t)||this.trigger?.options&&void 0!==this.trigger.options[t]}" .disabled="${this.disabled}" @change="${this._checkboxChanged}" slot="prefix"></ha-checkbox>`:i?s.qy`<div slot="prefix" class="checkbox-spacer"></div>`:s.s6} <span slot="heading" class="${n?"clickable":""}" @click="${n?this._toggleCheckbox:void 0}">${this.hass.localize(`component.${a}.triggers.${r}.fields.${t}.name`)||t}</span> ${l?s.qy`<span class="${n?"clickable":""}" @click="${n?this._toggleCheckbox:void 0}" slot="description">${l}</span>`:s.s6} <ha-selector .disabled="${this.disabled||n&&!this._checkedKeys.has(t)&&(!this.trigger?.options||void 0===this.trigger.options[t])}" .hass="${this.hass}" .selector="${o}" .context="${this._generateContext(e)}" .key="${t}" @value-changed="${this._dataChanged}" .value="${this.trigger?.options?this.trigger.options[t]:void 0}" .placeholder="${e.default}" .localizeValue="${this._localizeValueCallback}" .required="${e.required}"></ha-selector> </ha-settings-row>`},this._localizeValueCallback=t=>this.trigger?.trigger?this.hass.localize(`component.${(0,d.zz)(this.trigger.trigger)}.selector.${t}`):""}}u.styles=s.AH`:host{display:block;margin:0px calc(-1 * var(--ha-space-4))}ha-settings-row{padding:0 var(--ha-space-4)}ha-settings-row[narrow]{padding-bottom:var(--ha-space-2)}ha-settings-row{--settings-row-content-width:100%;--settings-row-prefix-display:contents;border-top:var(--service-control-items-border-top,1px solid var(--divider-color))}ha-entity-picker,ha-service-picker,ha-yaml-editor{display:block;margin:0 var(--ha-space-4)}ha-yaml-editor{padding:var(--ha-space-4) 0}p{margin:0 var(--ha-space-4);padding:var(--ha-space-4) 0}:host([hide-picker]) p{padding-top:0}.checkbox-spacer{width:32px}.help-icon{color:var(--secondary-text-color)}.description{justify-content:space-between;display:flex;align-items:center;padding-right:2px;padding-inline-end:2px;padding-inline-start:initial}.description p{direction:ltr}.clickable{cursor:pointer}`,(0,a.Cg)([(0,r.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],u.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],u.prototype,"description",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],u.prototype,"disabled",void 0),(0,a.Cg)([(0,r.wk)()],u.prototype,"_checkedKeys",void 0),(0,a.Cg)([(0,r.wk)()],u.prototype,"_manifest",void 0),(0,a.Cg)([(0,r.wk)()],u.prototype,"_resolvedTargetEntityCount",void 0),u=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-platform")],u)},22629(t,e,i){i.a(t,async function(t,e){try{i(74423),i(18111),i(7588);var a=i(62826),s=i(5124),r=i(22441),o=i(22786),n=i(63533),l=i(44537),h=i(57673),d=i(1087),c=i(24790),g=i(89849),p=i(52763),u=i(67442),m=t([p]);p=(m.then?(await m)():m)[0];const _=(0,n.kp)(u.V,(0,n.Ik)({alias:(0,n.lq)((0,n.Yj)()),trigger:(0,n.eu)("state"),entity_id:(0,n.lq)((0,n.KC)([(0,n.Yj)(),(0,n.YO)((0,n.Yj)())])),attribute:(0,n.lq)((0,n.Yj)()),from:(0,n.lq)((0,n.KC)([(0,n.me)((0,n.Yj)()),(0,n.YO)((0,n.Yj)())])),to:(0,n.lq)((0,n.KC)([(0,n.me)((0,n.Yj)()),(0,n.YO)((0,n.Yj)())])),for:(0,n.lq)((0,n.KC)([(0,n.ai)(),(0,n.Yj)(),u.b]))}));class v extends s.WF{static get defaultConfig(){return{trigger:"state",entity_id:[]}}shouldUpdate(t){if(!t.has("trigger"))return!0;if(this.trigger.for&&"object"==typeof this.trigger.for&&0===this.trigger.for.milliseconds&&delete this.trigger.for.milliseconds,this.trigger&&(0,c.r)(this.trigger))return(0,d.r)(this,"ui-mode-not-available",Error(this.hass.localize("ui.errors.config.no_template_editor_support"))),!1;try{(0,n.vA)(this.trigger,_)}catch(t){return(0,d.r)(this,"ui-mode-not-available",t),!1}return!0}render(){const t=(0,h.z)(this.trigger.for),e={...this.trigger,entity_id:(0,l.e)(this.trigger.entity_id),for:t};e.to=this._normalizeStates(this.trigger.to,e.attribute),e.from=this._normalizeStates(this.trigger.from,e.attribute);const i=this._schema(this.hass.localize,this.trigger.attribute,e.to,e.from);return s.qy` <ha-form .hass="${this.hass}" .data="${e}" .schema="${i}" @value-changed="${this._valueChanged}" .computeLabel="${this._computeLabelCallback}" .disabled="${this.disabled}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value;e.to=this._applyAnyStateExclusive(e.to,e.attribute),Array.isArray(e.to)&&0===e.to.length&&delete e.to,e.from=this._applyAnyStateExclusive(e.from,e.attribute),Array.isArray(e.from)&&0===e.from.length&&delete e.from,Object.keys(e).forEach(t=>{const i=e[t];void 0!==i&&""!==i||delete e[t]}),(0,d.r)(this,"value-changed",{value:e})}_applyAnyStateExclusive(t,e){return(Array.isArray(t)?t.includes(g.x):t===g.x)?e?void 0:null:t}_normalizeStates(t,e){return e||null!==t?null==t?[]:(0,l.e)(t):[g.x]}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,o.A)((t,e,i,a)=>[{name:"entity_id",required:!0,selector:{entity:{multiple:!0}}},{name:"attribute",context:{filter_entity:"entity_id"},selector:{attribute:{hide_attributes:["access_token","available_modes","code_arm_required","code_format","color_modes","device_class","editable","effect_list","entity_id","entity_picture","event_types","fan_modes","fan_speed_list","friendly_name","frontend_stream_type","has_date","has_time","hvac_modes","icon","id","max_color_temp_kelvin","max_mireds","max_temp","max","min_color_temp_kelvin","min_mireds","min_temp","min","mode","operation_list","options","percentage_step","precipitation_unit","preset_modes","pressure_unit","sound_mode_list","source_list","state_class","step","supported_color_modes","supported_features","swing_modes","target_temp_step","temperature_unit","token","unit_of_measurement","visibility_unit","wind_speed_unit"]}}},{name:"from",context:{filter_entity:"entity_id"},selector:{state:{multiple:!0,extra_options:e?[]:[{label:t("ui.panel.config.automation.editor.triggers.type.state.any_state_ignore_attributes"),value:g.x}],attribute:e,hide_states:i}}},{name:"to",context:{filter_entity:"entity_id"},selector:{state:{multiple:!0,extra_options:e?[]:[{label:t("ui.panel.config.automation.editor.triggers.type.state.any_state_ignore_attributes"),value:g.x}],attribute:e,hide_states:a}}},{name:"for",selector:{duration:{}}}]),this._computeLabelCallback=t=>this.hass.localize("entity_id"===t.name?"ui.components.entity.entity-picker.entity":`ui.panel.config.automation.editor.triggers.type.state.${t.name}`)}}v.styles=s.AH`:host{display:block;margin-bottom:var(--ha-space-3)}`,(0,a.Cg)([(0,r.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],v.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],v.prototype,"disabled",void 0),v=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-state")],v),e()}catch(t){e(t)}})},38650(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(5124),r=i(22441),o=i(22786),n=i(1087),l=i(52763),h=t([l]);l=(h.then?(await h)():h)[0];class d extends s.WF{static get defaultConfig(){return{trigger:"sun",event:"sunrise",offset:0}}render(){const t=this._schema(this.hass.localize);return s.qy` <ha-form .schema="${t}" .data="${this.trigger}" .hass="${this.hass}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value;(0,n.r)(this,"value-changed",{value:e})}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,o.A)(t=>[{name:"event",type:"select",required:!0,options:[["sunrise",t("ui.panel.config.automation.editor.triggers.type.sun.sunrise")],["sunset",t("ui.panel.config.automation.editor.triggers.type.sun.sunset")]]},{name:"offset",selector:{text:{}}}]),this._computeLabelCallback=t=>this.hass.localize(`ui.panel.config.automation.editor.triggers.type.sun.${t.name}`)}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],d.prototype,"disabled",void 0),d=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-sun")],d),e()}catch(t){e(t)}})},5816(t,e,i){i.a(t,async function(t,e){try{i(18111),i(61701);var a=i(62826),s=i(5124),r=i(22441),o=i(1087),n=i(52220),l=i(606),h=i(79276),d=t([l]);l=(d.then?(await d)():d)[0];class c extends s.WF{static get defaultConfig(){return{trigger:"tag",tag_id:""}}firstUpdated(t){super.firstUpdated(t),this._fetchTags()}render(){return this._tags?s.qy` <ha-select .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.tag.label")}" .disabled="${this.disabled||0===this._tags.length}" .value="${this.trigger.tag_id}" @selected="${this._tagChanged}" .options="${this._tags.map(t=>({value:t.id,label:t.name||t.id}))}"> </ha-select> `:s.s6}async _fetchTags(){this._tags=(await(0,h.un)(this.hass)).sort((t,e)=>(0,n.SH)(t.name||t.id,e.name||e.id,this.hass.locale.language))}_tagChanged(t){t.detail.value&&this._tags&&this.trigger.tag_id!==t.detail.value&&(0,o.r)(this,"value-changed",{value:{...this.trigger,tag_id:t.detail.value}})}constructor(...t){super(...t),this.disabled=!1}}c.styles=s.AH`ha-select{display:block}`,(0,a.Cg)([(0,r.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],c.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],c.prototype,"disabled",void 0),(0,a.Cg)([(0,r.wk)()],c.prototype,"_tags",void 0),c=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-tag")],c),e()}catch(t){e(t)}})},20616(t,e,i){i.a(t,async function(t,e){try{i(18111),i(81148);var a=i(62826),s=i(5124),r=i(22441),o=i(52763),n=i(57673),l=i(1087),h=i(24790),d=t([o]);o=(d.then?(await d)():d)[0];const c=[{name:"value_template",required:!0,selector:{template:{}}},{name:"for",selector:{duration:{}}}];class g extends s.WF{static get defaultConfig(){return{trigger:"template",value_template:""}}willUpdate(t){t.has("trigger")&&this.trigger&&(0,h.r)(this.trigger.for)&&(0,l.r)(this,"ui-mode-not-available",Error(this.hass.localize("ui.errors.config.no_template_editor_support")))}render(){const t=(0,n.z)(this.trigger.for),e={...this.trigger,for:t};return s.qy` <ha-form .hass="${this.hass}" .data="${e}" .schema="${c}" @value-changed="${this._valueChanged}" .computeLabel="${this._computeLabelCallback}" .disabled="${this.disabled}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value;e.for&&Object.values(e.for).every(t=>0===t)&&delete e.for,(0,l.r)(this,"value-changed",{value:e})}constructor(...t){super(...t),this.disabled=!1,this._computeLabelCallback=t=>this.hass.localize(`ui.panel.config.automation.editor.triggers.type.template.${t.name}`)}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],g.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],g.prototype,"disabled",void 0),g=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-template")],g),e()}catch(t){e(t)}})},40995(t,e,i){i.a(t,async function(t,e){try{i(74423),i(18111),i(61701);var a=i(62826),s=i(5124),r=i(22441),o=i(22786),n=i(380),l=i(1087),h=i(71727),d=i(52763),c=t([d]);d=(c.then?(await c)():c)[0];const g="time",p="entity",u=["sensor","input_datetime"],m=["sun","mon","tue","wed","thu","fri","sat"];class _ extends s.WF{static get defaultConfig(){return{trigger:"time",at:""}}willUpdate(t){t.has("trigger")&&this.trigger&&Array.isArray(this.trigger.at)&&(0,l.r)(this,"ui-mode-not-available",Error(this.hass.localize("ui.errors.config.editor_not_supported")))}render(){const t=this.trigger.at;if(Array.isArray(t))return s.s6;const e=this._data(this._inputMode,t,this.trigger.weekday),i=this._schema(this.hass.localize,this.hass.locale,e.mode);return s.qy` <ha-form .hass="${this.hass}" .data="${e}" .schema="${i}" .disabled="${this.disabled}" @value-changed="${this._valueChanged}" .computeLabel="${this._computeLabelCallback}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e={...t.detail.value};this._inputMode=e.mode;const i=e.weekday;delete e.weekday,e.mode===g?(delete e.entity,delete e.offset):delete e.time;const a={...this.trigger,at:e.offset?{entity_id:e.entity,offset:e.offset}:e.entity||e.time};i&&i.length>0?a.weekday=i:delete a.weekday,(0,l.r)(this,"value-changed",{value:a})}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,o.A)((t,e,i)=>{const a=(0,n.P)(e),s=m.slice(a,m.length).concat(m.slice(0,a));return[{name:"mode",type:"select",required:!0,options:[[g,t("ui.panel.config.automation.editor.triggers.type.time.type_value")],[p,t("ui.panel.config.automation.editor.triggers.type.time.type_input")]]},...i===g?[{name:"time",selector:{time:{}}}]:[{name:"entity",selector:{entity:{filter:[{domain:"input_datetime"},{domain:"sensor",device_class:"timestamp"}]}}},{name:"offset",selector:{text:{}}}],{type:"multi_select",name:"weekday",options:s.map(e=>[e,t(`ui.panel.config.automation.editor.triggers.type.time.weekdays.${e}`)])}]}),this._data=(0,o.A)((t,e,i)=>{const a="object"==typeof e?e.entity_id:e&&u.includes((0,h.m)(e))?e:void 0,s=a?void 0:e,r="object"==typeof e?e.offset:void 0;return{mode:t??(a?p:g),entity:a,time:s,offset:r,weekday:i}}),this._computeLabelCallback=t=>{switch(t.name){case"time":return this.hass.localize("ui.panel.config.automation.editor.triggers.type.time.at");case"weekday":return this.hass.localize("ui.panel.config.automation.editor.triggers.type.time.weekday")}return this.hass.localize(`ui.panel.config.automation.editor.triggers.type.time.${t.name}`)}}}_.styles=s.AH`:host{display:block;margin-bottom:var(--ha-space-3)}`,(0,a.Cg)([(0,r.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],_.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],_.prototype,"disabled",void 0),(0,a.Cg)([(0,r.wk)()],_.prototype,"_inputMode",void 0),_=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-time")],_),e()}catch(t){e(t)}})},20790(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(5124),r=i(22441),o=i(1087),n=i(52763),l=t([n]);n=(l.then?(await l)():l)[0];const h=[{name:"hours",selector:{text:{}}},{name:"minutes",selector:{text:{}}},{name:"seconds",selector:{text:{}}}];class d extends s.WF{static get defaultConfig(){return{trigger:"time_pattern"}}render(){return s.qy` <ha-form .hass="${this.hass}" .schema="${h}" .data="${this.trigger}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}" .computeHelper="${this._computeHelperCallback}" @value-changed="${this._valueChanged}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value;(0,o.r)(this,"value-changed",{value:e})}constructor(...t){super(...t),this.disabled=!1,this._computeLabelCallback=t=>this.hass.localize(`ui.panel.config.automation.editor.triggers.type.time_pattern.${t.name}`),this._computeHelperCallback=t=>this.hass.localize("ui.panel.config.automation.editor.triggers.type.time_pattern.help")}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],d.prototype,"disabled",void 0),d=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-time_pattern")],d),e()}catch(t){e(t)}})},33461(t,e,i){i.a(t,async function(t,e){try{i(74423),i(44114),i(16573),i(78100),i(77936),i(37467),i(44732),i(79577),i(16632),i(34226),i(9486),i(20456),i(64979);var a=i(62826),s=(i(68825),i(5124)),r=i(22441),o=i(1087),n=i(80880),l=i(63130),h=i(29823),d=(i(70947),i(26300)),c=i(91485),g=i(49053),p=i(71562),u=t([h,d,c,p]);[h,d,c,p]=u.then?(await u)():u;const m="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",_="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",v=["GET","HEAD","POST","PUT"],y=["POST","PUT"],b="";class f extends s.WF{static get defaultConfig(){return{trigger:"webhook",allowed_methods:[...y],local_only:!0,webhook_id:b}}connectedCallback(){super.connectedCallback();const t={callback:t=>{this._config=t}};(0,o.r)(this,"subscribe-automation-config",t),this._unsub=t.unsub}disconnectedCallback(){super.disconnectedCallback(),this._unsub&&this._unsub()}_generateWebhookId(){const t=crypto.getRandomValues(new Uint8Array(18)),e=btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_");return`${(0,n.Y)(this._config?.alias||"","-")}-${e}`}willUpdate(t){super.willUpdate(t),t.has("trigger")&&(void 0===this.trigger.allowed_methods&&(this.trigger.allowed_methods=[...y]),void 0===this.trigger.local_only&&(this.trigger.local_only=!0),this.trigger.webhook_id===b&&(this.trigger.webhook_id=this._generateWebhookId()))}render(){const{allowed_methods:t,local_only:e,webhook_id:i}=this.trigger;return s.qy` <div class="flex"> <ha-input name="webhook_id" .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.webhook.webhook_id")}" .hint="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.webhook.webhook_id_helper")}" .disabled="${this.disabled}" .value="${i||""}" @input="${this._valueChanged}"> <ha-icon-button @click="${this._copyUrl}" slot="end" .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.webhook.copy_url")}" .path="${_}"></ha-icon-button> </ha-input> <ha-dropdown @wa-select="${this._handleDropdownSelect}" placement="bottom-end" distance="-24"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.webhook.webhook_settings")}" .path="${m}"></ha-icon-button> ${v.map(e=>s.qy` <ha-dropdown-item .value="${e}" type="checkbox" @request-selected="${this._allowedMethodsChanged}" .checked="${t.includes(e)}"> ${e} </ha-dropdown-item> `)} ${v.length?s.qy`<wa-divider></wa-divider>`:s.s6} <ha-dropdown-item type="checkbox" .checked="${e}" value="local_only"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.type.webhook.local_only")} </ha-dropdown-item> </ha-dropdown> </div> `}_valueChanged(t){(0,p.P)(this,t)}_localOnlyChanged(t){if(this.trigger.local_only===t)return;const e={...this.trigger,local_only:t};(0,o.r)(this,"value-changed",{value:e})}_allowedMethodsChanged(t,e){if(e===this.trigger.allowed_methods?.includes(t))return;const i=[...this.trigger.allowed_methods??[]];e?i.push(t):i.splice(i.indexOf(t),1);const a={...this.trigger,allowed_methods:i};(0,o.r)(this,"value-changed",{value:a})}async _copyUrl(t){const e=t.target.parentElement,i=this.hass.hassUrl(`/api/webhook/${e.value}`);await(0,l.l)(i),(0,g.c)(this,{message:this.hass.localize("ui.common.copied_clipboard")})}_handleDropdownSelect(t){t.preventDefault();const e=t.detail?.item?.value;e&&("local_only"!==e?this._allowedMethodsChanged(t.detail.item.value,t.detail.item.checked):this._localOnlyChanged(t.detail.item.checked))}constructor(...t){super(...t),this.disabled=!1}}f.styles=s.AH`.flex{display:flex}ha-input{flex:1}ha-input>ha-icon-button{--ha-icon-button-size:24px;--mdc-icon-size:18px;color:var(--secondary-text-color)}ha-dropdown ha-icon-button{padding-top:4px}`,(0,a.Cg)([(0,r.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],f.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],f.prototype,"disabled",void 0),(0,a.Cg)([(0,r.wk)()],f.prototype,"_config",void 0),f=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-webhook")],f),e()}catch(t){e(t)}})},88656(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(5124),r=i(22441),o=i(1087),n=i(69093),l=i(3471),h=i(82474),d=(i(64013),i(92677),t([h]));function c(t){return(0,l.e)(t)&&"zone"!==(0,n.t)(t)}h=(d.then?(await d)():d)[0];const g=["zone"];class p extends s.WF{static get defaultConfig(){return{trigger:"zone",entity_id:"",zone:"",event:"enter"}}render(){const{entity_id:t,zone:e,event:i}=this.trigger;return s.qy` <ha-entity-picker .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.zone.entity")}" .value="${t}" .disabled="${this.disabled}" @value-changed="${this._entityPicked}" .hass="${this.hass}" .entityFilter="${c}"></ha-entity-picker> <ha-entity-picker .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.zone.zone")}" .value="${e}" .disabled="${this.disabled}" @value-changed="${this._zonePicked}" .hass="${this.hass}" .includeDomains="${g}"></ha-entity-picker> <ha-radio-group orientation="horizontal" .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.zone.event")}" .value="${i}" .disabled="${this.disabled}" @change="${this._radioGroupPicked}" name="event"> <ha-radio-option value="enter"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.type.zone.enter")} </ha-radio-option> <ha-radio-option value="leave"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.type.zone.leave")} </ha-radio-option> </ha-radio-group> `}_entityPicked(t){t.stopPropagation(),(0,o.r)(this,"value-changed",{value:{...this.trigger,entity_id:t.detail.value}})}_zonePicked(t){t.stopPropagation(),(0,o.r)(this,"value-changed",{value:{...this.trigger,zone:t.detail.value}})}_radioGroupPicked(t){t.stopPropagation(),(0,o.r)(this,"value-changed",{value:{...this.trigger,event:t.currentTarget.value}})}constructor(...t){super(...t),this.disabled=!1}}p.styles=s.AH`ha-entity-picker{display:block;margin-bottom:24px}`,(0,a.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"trigger",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],p.prototype,"disabled",void 0),p=(0,a.Cg)([(0,r.EM)("ha-automation-trigger-zone")],p),e()}catch(u){e(u)}})}};