iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
7 lines • 95.9 kB
JavaScript
export const __rspack_esm_id=30513;export const __rspack_esm_ids=[30513];export const __webpack_modules__={42778(t,e,i){i.a(t,async function(t,e){try{var o=i(62826),a=i(22441),s=i(10139),n=i(17062),r=t([n]);n=(r.then?(await r)():r)[0];class l extends n.V{get NO_AUTOMATION_TEXT(){return this.hass.localize("ui.panel.config.devices.automation.actions.no_actions")}get UNKNOWN_AUTOMATION_TEXT(){return this.hass.localize("ui.panel.config.devices.automation.actions.unknown_action")}constructor(){super(s.PV,s.am,t=>({device_id:t||"",domain:"",entity_id:""}))}}l=(0,o.Cg)([(0,a.EM)("ha-device-action-picker")],l),e()}catch(t){e(t)}})},6(t,e,i){var o=i(62826),a=i(68462),s=i(38627),n=i(5124),r=i(22441),l=i(6412),c=i(1087);class h extends a.M{render(){const t={"mdc-form-field--align-end":this.alignEnd,"mdc-form-field--space-between":this.spaceBetween,"mdc-form-field--nowrap":this.nowrap};return n.qy` <div class="mdc-form-field ${(0,l.H)(t)}"> <slot></slot> <label class="mdc-label" @click="${this._labelClick}"> <slot name="label">${this.label}</slot> </label> </div>`}_labelClick(){const t=this.input;if(t&&(t.focus(),!t.disabled))if("HA-CHECKBOX"===t.tagName)t.checked=!t.checked,(0,c.r)(t,"change");else t.click()}constructor(...t){super(...t),this.disabled=!1}}h.styles=[s.R,n.AH`:host(:not([alignEnd])) ::slotted(ha-switch){margin-right:10px;margin-inline-end:10px;margin-inline-start:initial}.mdc-form-field{align-items:var(--ha-formfield-align-items,center);gap:var(--ha-space-1)}.mdc-form-field>label{direction:var(--direction);margin-inline-start:0;margin-inline-end:auto;padding:0}:host([disabled]) label{color:var(--disabled-text-color)}`],(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],h.prototype,"disabled",void 0),h=(0,o.Cg)([(0,r.EM)("ha-formfield")],h)},59646(t,e,i){i.a(t,async function(t,e){try{var o=i(62826),a=i(29344),s=i(5124),n=i(22441),r=i(88360),l=t([a]);a=(l.then?(await l)():l)[0];class c extends a.A{updated(t){super.updated(t),t.has("haptic")&&(this.haptic?this.addEventListener("change",this._forwardHaptic):this.removeEventListener("change",this._forwardHaptic))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",this._forwardHaptic)}static get styles(){return[a.A.styles,s.AH`:host{--wa-form-control-toggle-size:var(--ha-switch-size, 24px);--wa-form-control-required-content:var(
--ha-switch-required-marker,
var(--ha-input-required-marker, "*")
);--wa-form-control-required-content-offset:var(
--ha-switch-required-marker-offset,
0.1rem
);--thumb-size:var(--ha-switch-thumb-size, 18px);--width:var(--ha-switch-width, 48px)}label{position:relative;height:max(var(--thumb-size),var(--wa-form-control-toggle-size))}label::before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;min-width:var(--ha-switch-min-touch-size,40px);min-height:var(--ha-switch-min-touch-size,40px)}label.disabled::before{pointer-events:none}.switch{background-color:var(--ha-switch-background-color,var(--ha-color-fill-disabled-quiet-resting));border-color:var(--ha-switch-border-color,var(--ha-color-border-neutral-normal))}label:not(.disabled) .input:focus-visible~.switch,label:not(.disabled):hover .switch{background-color:var(--ha-switch-background-color-hover,var(--ha-switch-background-color,var(--ha-color-fill-disabled-quiet-hover)))}.checked .switch{background-color:var(--ha-switch-checked-background-color,var(--ha-color-fill-primary-normal-resting));border-color:var(--ha-switch-checked-border-color,var(--ha-color-border-primary-loud))}label:not(.disabled).checked .input:focus-visible~.switch,label:not(.disabled).checked:hover .switch{background-color:var(--ha-switch-checked-background-color-hover,var(--ha-switch-checked-background-color,var(--ha-color-fill-primary-normal-hover)));border-color:var(--ha-switch-checked-border-color-hover,var(--ha-switch-checked-border-color,var(--ha-color-border-primary-loud)))}.switch .thumb{background-color:var(--ha-switch-thumb-background-color,var(--ha-color-on-neutral-normal));border-color:var(--ha-switch-thumb-border-color,var(--ha-color-on-neutral-normal));border-style:var(--wa-form-control-border-style);border-width:var(--wa-form-control-border-width);box-shadow:var(--ha-switch-thumb-box-shadow,var(--ha-box-shadow-s))}label:not(.disabled) .input:focus-visible~.switch .thumb,label:not(.disabled):hover .switch .thumb{background-color:var(--ha-switch-thumb-background-color-hover,var(--ha-switch-thumb-background-color,var(--ha-color-on-neutral-normal)));border-color:var(--ha-switch-thumb-border-color-hover,var(--ha-switch-thumb-border-color,var(--ha-color-on-neutral-normal)))}.checked .switch .thumb{background-color:var(--ha-switch-checked-thumb-background-color,var(--ha-color-on-primary-normal));border-color:var(--ha-switch-checked-thumb-border-color,var(--ha-color-on-primary-normal))}label:not(.disabled).checked .input:focus-visible~.switch .thumb,label:not(.disabled).checked:hover .switch .thumb{background-color:var(--ha-switch-checked-thumb-background-color-hover,var(--ha-switch-checked-thumb-background-color,var(--ha-color-on-primary-normal)));border-color:var(--ha-switch-checked-thumb-border-color-hover,var(--ha-switch-checked-thumb-border-color,var(--ha-color-on-primary-normal)))}label.disabled{opacity:var(--ha-switch-disabled-opacity, .3);cursor:not-allowed}label:not(.disabled) .input:focus-visible~.switch .thumb{outline:0;outline-offset:none}label:not(.disabled) .input:focus-visible~.switch{outline:var(--wa-focus-ring);outline-offset:var(--wa-focus-ring-offset)}:host(:empty) slot.label{display:none}`]}constructor(...t){super(...t),this.haptic=!1,this._forwardHaptic=()=>{(0,r.j)(this,"light")}}}(0,o.Cg)([(0,n.MZ)({type:Boolean})],c.prototype,"haptic",void 0),c=(0,o.Cg)([(0,n.EM)("ha-switch")],c),e()}catch(t){e(t)}})},30780(t,e,i){i.d(e,{EN:()=>l,I8:()=>d,L_:()=>h,MC:()=>c,O$:()=>a,bM:()=>r,ix:()=>s,rP:()=>n});i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698);const o="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z",a={condition:"M4 2A2 2 0 0 0 2 4V12H4V8H6V12H8V4A2 2 0 0 0 6 2H4M4 4H6V6H4M22 15.5V14A2 2 0 0 0 20 12H16V22H20A2 2 0 0 0 22 20V18.5A1.54 1.54 0 0 0 20.5 17A1.54 1.54 0 0 0 22 15.5M20 20H18V18H20V20M20 16H18V14H20M5.79 21.61L4.21 20.39L18.21 2.39L19.79 3.61Z",delay:"M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M19.03,7.39L20.45,5.97C20,5.46 19.55,5 19.04,4.56L17.62,6C16.07,4.74 14.12,4 12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22C17,22 21,17.97 21,13C21,10.88 20.26,8.93 19.03,7.39M11,14H13V8H11M15,1H9V3H15V1Z",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",play_media:"M8,5.14V19.14L19,12.14L8,5.14Z",service:"M12,5A2,2 0 0,1 14,7C14,7.24 13.96,7.47 13.88,7.69C17.95,8.5 21,11.91 21,16H3C3,11.91 6.05,8.5 10.12,7.69C10.04,7.47 10,7.24 10,7A2,2 0 0,1 12,5M22,19H2V17H22V19Z",wait_template:"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",wait_for_trigger:"M12,9A2,2 0 0,1 10,7C10,5.89 10.9,5 12,5C13.11,5 14,5.89 14,7A2,2 0 0,1 12,9M12,14A2,2 0 0,1 10,12C10,10.89 10.9,10 12,10C13.11,10 14,10.89 14,12A2,2 0 0,1 12,14M12,19A2,2 0 0,1 10,17C10,15.89 10.9,15 12,15C13.11,15 14,15.89 14,17A2,2 0 0,1 12,19M20,10H17V8.86C18.72,8.41 20,6.86 20,5H17V4A1,1 0 0,0 16,3H8A1,1 0 0,0 7,4V5H4C4,6.86 5.28,8.41 7,8.86V10H4C4,11.86 5.28,13.41 7,13.86V15H4C4,16.86 5.28,18.41 7,18.86V20A1,1 0 0,0 8,21H16A1,1 0 0,0 17,20V18.86C18.72,18.41 20,16.86 20,15H17V13.86C18.72,13.41 20,11.86 20,10Z",repeat:o,repeat_count:o,repeat_while:o,repeat_until:o,repeat_for_each:o,choose:"M11,5H8L12,1L16,5H13V9.43C12.25,9.89 11.58,10.46 11,11.12V5M22,11L18,7V10C14.39,9.85 11.31,12.57 11,16.17C9.44,16.72 8.62,18.44 9.17,20C9.72,21.56 11.44,22.38 13,21.83C14.56,21.27 15.38,19.56 14.83,18C14.53,17.14 13.85,16.47 13,16.17C13.47,12.17 17.47,11.97 17.95,11.97V14.97L22,11M10.63,11.59C9.3,10.57 7.67,10 6,10V7L2,11L6,15V12C7.34,12.03 8.63,12.5 9.64,13.4C9.89,12.76 10.22,12.15 10.63,11.59Z",if:"M14,4L16.29,6.29L13.41,9.17L14.83,10.59L17.71,7.71L20,10V4M10,4H4V10L6.29,7.71L11,12.41V20H13V11.59L7.71,6.29",device_id:"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",stop:"M13 24C9.74 24 6.81 22 5.6 19L2.57 11.37C2.26 10.58 3 9.79 3.81 10.05L4.6 10.31C5.16 10.5 5.62 10.92 5.84 11.47L7.25 15H8V3.25C8 2.56 8.56 2 9.25 2S10.5 2.56 10.5 3.25V12H11.5V1.25C11.5 .56 12.06 0 12.75 0S14 .56 14 1.25V12H15V2.75C15 2.06 15.56 1.5 16.25 1.5C16.94 1.5 17.5 2.06 17.5 2.75V12H18.5V5.75C18.5 5.06 19.06 4.5 19.75 4.5S21 5.06 21 5.75V16C21 20.42 17.42 24 13 24Z",sequence:"M7,13V11H21V13H7M7,19V17H21V19H7M7,7V5H21V7H7M3,8V5H2V4H4V8H3M2,17V16H5V20H2V19H4V18.5H3V17.5H4V17H2M4.25,10A0.75,0.75 0 0,1 5,10.75C5,10.95 4.92,11.14 4.79,11.27L3.12,13H5V14H2V13.08L4,11H2V10H4.25Z",parallel:"M16,4.5V7H5V9H16V11.5L19.5,8M16,12.5V15H5V17H16V19.5L19.5,16",variables:"M21 2H3C1.9 2 1 2.9 1 4V20C1 21.1 1.9 22 3 22H21C22.1 22 23 21.1 23 20V4C23 2.9 22.1 2 21 2M21 20H3V6H21V20M16.6 8C18.1 9.3 19 11.1 19 13C19 14.9 18.1 16.7 16.6 18L15 17.4C16.3 16.4 17 14.7 17 13S16.3 9.6 15 8.6L16.6 8M7.4 8L9 8.6C7.7 9.6 7 11.3 7 13S7.7 16.4 9 17.4L7.4 18C5.9 16.7 5 14.9 5 13S5.9 9.3 7.4 8M12.1 12L13.5 10H15L12.8 13L14.1 16H12.8L12 14L10.6 16H9L11.3 12.9L10 10H11.3L12.1 12Z",set_conversation_response:"M12,8H4A2,2 0 0,0 2,10V14A2,2 0 0,0 4,16H5V20A1,1 0 0,0 6,21H8A1,1 0 0,0 9,20V16H12L17,20V4L12,8M21.5,12C21.5,13.71 20.54,15.26 19,16V8C20.53,8.75 21.5,10.3 21.5,12Z"},s=new Set(["variables"]),n=[{groups:{device_id:{},dynamicGroups:{}}},{titleKey:"ui.panel.config.automation.editor.actions.groups.helpers.label",groups:{helpers:{}}},{titleKey:"ui.panel.config.automation.editor.actions.groups.other.label",groups:{event:{},service:{},set_conversation_response:{},other:{}}}],r={condition:{},delay:{},wait_template:{},wait_for_trigger:{},repeat_count:{},repeat_while:{},repeat_until:{},repeat_for_each:{},choose:{},if:{},stop:{},sequence:{},parallel:{},variables:{}},l={repeat_count:{repeat:{count:2,sequence:[]}},repeat_while:{repeat:{while:[],sequence:[]}},repeat_until:{repeat:{until:[],sequence:[]}},repeat_for_each:{repeat:{for_each:{},sequence:[]}}},c=["ha-automation-action-choose","ha-automation-action-condition","ha-automation-action-if","ha-automation-action-parallel","ha-automation-action-repeat","ha-automation-action-sequence"],h=["choose","if","parallel","sequence","repeat_while","repeat_until"],d=["repeat_count","repeat_for_each","wait_for_trigger"]},45464(t,e,i){i.a(t,async function(t,o){try{i.d(e,{u:()=>_});i(44114),i(18111),i(61701),i(33110);var a=i(44537),s=i(82591),n=i(27167),r=i(28978),l=i(8185),c=i(24790),h=i(79800),d=i(10139),p=i(95350),u=i(84025),g=t([s,l,h]);[s,l,h]=g.then?(await g)():g;const v="ui.panel.config.automation.editor.actions.type",m=(t,e)=>{if(!e)return!0;const i=e[t];return!i||("entity"!==i.integration_type||!i.is_built_in)},_=(t,e,i,o,a=!1,s)=>{try{const n=b(t,e,i,o,a,s);if("string"!=typeof n)throw new Error(String(n));return n}catch(t){console.error(t);let e="Error in describing action";return t.message&&(e+=": "+t.message),e}},b=(t,e,i,o,g=!1,_)=>{if(i.alias&&!g)return i.alias;if(o||(o=(0,u.pq)(i)),"service"===o){const e=i,o=[],a=e.target||e.data;if("string"==typeof a&&(0,c.F)(a)&&o.push(t.localize(`${v}.service.description.target_template`,{name:"target"})),e.service_template||e.action&&(0,c.F)(e.action))return t.localize(o.length?`${v}.service.description.service_based_on_template`:`${v}.service.description.service_based_on_template_no_targets`,{targets:(0,l.c)(t.locale,o)});if(e.action){const[i,o]=e.action.split(".",2),a=t.services[i]?.[o]?.description_placeholders,s=t.localize(`component.${i}.services.${o}.name`,a)||t.services[i]?.[o]?.name;return e.metadata?s&&m(i,_)?`${(0,p.p$)(t.localize,i)}: ${s}`:s||e.action:t.localize(`${v}.service.description.service_based_on_name_no_targets`,{name:s?m(i,_)?`${(0,p.p$)(t.localize,i)}: ${s}`:s:e.action})}return t.localize(`${v}.service.description.service`)}if("delay"===o){const e=i;let o;return o="number"==typeof e.delay?t.localize(`${v}.delay.description.duration_string`,{string:(0,n.A)(e.delay)}):"string"==typeof e.delay?(0,c.F)(e.delay)?t.localize(`${v}.delay.description.duration_template`):t.localize(`${v}.delay.description.duration_string`,{string:e.delay||t.localize(`${v}.delay.description.duration_unknown`)}):e.delay?t.localize(`${v}.delay.description.duration_string`,{string:(0,s.nR)(t.locale,e.delay)}):t.localize(`${v}.delay.description.duration_string`,{string:t.localize(`${v}.delay.description.duration_unknown`)}),t.localize(`${v}.delay.description.full`,{duration:o})}if("wait_for_trigger"===o){const e=i,o=(0,a.e)(e.wait_for_trigger);return o&&0!==o.length?t.localize(`${v}.wait_for_trigger.description.wait_for_triggers`,{count:o.length}):t.localize(`${v}.wait_for_trigger.description.wait_for_a_trigger`)}if("variables"===o){const e=i;return t.localize(`${v}.variables.description.full`,{names:(0,l.c)(t.locale,Object.keys(e.variables))})}if("fire_event"===o){const e=i;return(0,c.F)(e.event)?t.localize(`${v}.event.description.full`,{name:t.localize(`${v}.event.description.template`)}):t.localize(`${v}.event.description.full`,{name:e.event})}if("wait_template"===o)return t.localize(`${v}.wait_template.description.full`);if("stop"===o){const e=i;return t.localize(`${v}.stop.description.full`,{hasReason:void 0!==e.stop?"true":"false",reason:e.stop})}if("if"===o){return void 0!==i.else?t.localize(`${v}.if.description.if_else`):t.localize(`${v}.if.description.if`)}if("choose"===o){const e=i;if(e.choose){const i=(0,a.e)(e.choose).length+(e.default?1:0);return t.localize(`${v}.choose.description.full`,{number:i})}return t.localize(`${v}.choose.description.no_action`)}if("repeat"===o){const e=i;let o="";if("count"in e.repeat){const i=e.repeat.count;o=t.localize(`${v}.repeat.description.count`,{count:i})}else if("while"in e.repeat){const i=(0,a.e)(e.repeat.while);o=t.localize(`${v}.repeat.description.while_count`,{count:i.length})}else if("until"in e.repeat){const i=(0,a.e)(e.repeat.until);o=t.localize(`${v}.repeat.description.until_count`,{count:i.length})}else if("for_each"in e.repeat){const i=(0,a.e)(e.repeat.for_each).map(t=>JSON.stringify(t));o=t.localize(`${v}.repeat.description.for_each`,{items:(0,l.c)(t.locale,i)})}return t.localize(`${v}.repeat.description.full`,{chosenAction:o})}if("check_condition"===o)return t.localize(`${v}.check_condition.description.full`,{condition:(0,h.p)(i,t,e)});if("device_action"===o){const o=i;if(!o.device_id)return t.localize(`${v}.device_id.description.no_device`);const a=(0,d.PV)(t.localize,t.states,e,o);if(a)return a;const s=t.states[o.entity_id];return o.type?`${o.type} ${s?(0,r.u)(s):o.entity_id}`:t.localize(`${v}.device_id.description.perform_device_action`,{device:s?(0,r.u)(s):o.entity_id})}if("sequence"===o){const e=i,o=(0,a.e)(e.sequence).length;return t.localize(`${v}.sequence.description.full`,{number:o})}if("parallel"===o){const e=i,o=(0,a.e)(e.parallel).length;return t.localize(`${v}.parallel.description.full`,{number:o})}if("set_conversation_response"===o){const e=i;return(0,c.F)(e.set_conversation_response)?t.localize(`${v}.set_conversation_response.description.template`):t.localize(`${v}.set_conversation_response.description.full`,{response:e.set_conversation_response})}return o};o()}catch(t){o(t)}})},24423(t,e,i){i.a(t,async function(t,e){try{var o=i(62826),a=i(5124),s=i(22441),n=i(6412),r=i(69558),l=i(1087),c=i(10763),h=i(30780),d=i(84025),p=i(15702),u=i(57116),g=i(60232),v=t([c,p,g]);[c,p,g]=v.then?(await v)():v;class m extends a.WF{render(){const t=this.yamlMode||!this.uiSupported,e=(0,g.MS)(this.action);return a.qy` <div class="${(0,n.H)({"card-content":!0,disabled:!this.indent&&(this.disabled||!1===this.action.enabled&&!this.yamlMode),yaml:t,indent:this.indent,card:!this.inSidebar})}"> ${t?a.qy` ${this.uiSupported?a.s6:a.qy` <ha-automation-editor-warning .alertTitle="${this.hass.localize("ui.panel.config.automation.editor.actions.unsupported_action")}" .localize="${this.hass.localize}"></ha-automation-editor-warning> `} <ha-yaml-editor .defaultValue="${this.action}" @value-changed="${this._onYamlChange}" .readOnly="${this.disabled}"></ha-yaml-editor> `:a.qy` <div @value-changed="${this._onUiChanged}"> ${(0,r._)(`ha-automation-action-${e}`,{hass:this.hass,action:this.action,disabled:this.disabled,narrow:this.narrow,optionsInSidebar:this.indent,indent:this.indent,inSidebar:this.inSidebar})} </div> `} </div> `}_onYamlChange(t){t.stopPropagation(),t.detail.isValid&&(0,l.r)(this,this.inSidebar?"yaml-changed":"value-changed",{value:(0,d.Rn)(t.detail.value)})}_onUiChanged(t){t.stopPropagation();const e={...this.action.alias?{alias:this.action.alias}:{},...this.action.note?{note:this.action.note}:{},...t.detail.value};(0,l.r)(this,"value-changed",{value:e})}expandAll(){this._collapsibleElement?.expandAll?.()}collapseAll(){this._collapsibleElement?.collapseAll?.()}constructor(...t){super(...t),this.disabled=!1,this.yamlMode=!1,this.indent=!1,this.selected=!1,this.narrow=!1,this.inSidebar=!1,this.uiSupported=!1}}m.styles=[u.yj,u.aM],(0,o.Cg)([(0,s.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],m.prototype,"action",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],m.prototype,"yamlMode",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"indent",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],m.prototype,"selected",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"narrow",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,attribute:"sidebar"})],m.prototype,"inSidebar",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,attribute:"supported"})],m.prototype,"uiSupported",void 0),(0,o.Cg)([(0,s.P)("ha-yaml-editor")],m.prototype,"yamlEditor",void 0),(0,o.Cg)([(0,s.P)(h.MC.join(", "))],m.prototype,"_collapsibleElement",void 0),m=(0,o.Cg)([(0,s.EM)("ha-automation-action-editor")],m),e()}catch(t){e(t)}})},60232(t,e,i){i.a(t,async function(t,o){try{i.d(e,{MS:()=>Ct,Pb:()=>At});i(74423),i(18111),i(20116),i(13579);var a=i(62826),s=(i(68825),i(35211)),n=i(34271),r=i(53289),l=i(5124),c=i(22441),h=i(22786),d=i(44537),p=i(93905),u=i(1087),g=i(99124),v=i(57237),m=i(71727),_=i(68246),b=i(52943),y=i(53516),$=i(78978),f=i(63130),w=i(56214),C=i(20543),A=i(7822),M=(i(76776),i(29823)),V=(i(70947),i(11382),i(26300)),H=i(65329),L=i(34127),k=i(30780),x=i(87225),S=i(12596),z=i(22792),Z=i(84025),q=i(45464),E=i(38859),I=i(65063),R=i(41570),O=i(49053),D=i(15702),B=i(57116),P=i(62711),F=i(24423),T=i(35877),N=i(49707),j=i(67909),U=i(83108),W=i(57826),Y=i(75107),Q=i(23063),K=i(49063),G=i(85933),X=i(19809),J=i(66710),tt=i(11864),et=i(88166),it=i(21446),ot=t([w,C,A,M,V,H,L,D,P,F,T,N,j,U,W,Y,Q,G,X,J,tt,et,it,K,q]);[w,C,A,M,V,H,L,D,P,F,T,N,j,U,W,Y,Q,G,X,J,tt,et,it,K,q]=ot.then?(await ot)():ot;const at="M18.75 22.16L16 19.16L17.16 18L18.75 19.59L22.34 16L23.5 17.41L18.75 22.16M13 13V7H11V13H13M13 17V15H11V17H13M12 2C17.5 2 22 6.5 22 12L21.91 13.31C21.31 13.11 20.67 13 20 13C16.69 13 14 15.69 14 19C14 19.95 14.22 20.85 14.62 21.65C13.78 21.88 12.91 22 12 22C6.5 22 2 17.5 2 12C2 6.5 6.5 2 12 2Z",st="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",nt="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",rt="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",lt="M19,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,3M19,5V19H5V5H19Z",ct="M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M19,5V19H5V5H19M10,17L6,13L7.41,11.58L10,14.17L16.59,7.58L18,9",ht="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",dt="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",pt="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",ut="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",gt="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",vt="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",mt="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",_t="M8,5.14V19.14L19,12.14L8,5.14Z",bt="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",yt="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",$t="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",ft="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",wt="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",Ct=(0,h.A)(t=>{if(t)return"action"in t?(0,Z.pq)(t):x.I8.some(e=>e in t)?"condition":Object.keys(k.O$).find(e=>e in t)}),At=(t,e)=>{e.stopPropagation();const i=e.target?.name;if(!i)return;const o=e.detail?.value||e.target.value;if((t.action[i]||"")===o)return;let a;o?a={...t.action,[i]:o}:(a={...t.action},delete a[i]),(0,u.r)(t,"value-changed",{value:a})};class Mt extends l.WF{get selected(){return this._selected}firstUpdated(t){super.firstUpdated(t),this.root&&(this._collapsed=!1)}willUpdate(t){if(t.has("yamlMode")&&(this._warnings=void 0),!t.has("action"))return;const e=Ct(this.action);this._uiModeAvailable=void 0!==e&&!k.ix.has(e),this._uiModeAvailable||this._yamlMode||(this._yamlMode=!0)}disconnectedCallback(){super.disconnectedCallback(),this._runResultTimeout&&clearTimeout(this._runResultTimeout)}_renderOverflowLabel(t,e){return l.qy` <div class="overflow-label"> ${t} ${this.optionsInSidebar&&!this.narrow?e||l.qy`<span class="shortcut-placeholder ${R.c?"mac":""}"></span>`:l.s6} </div> `}_renderRow(){const t=Ct(this.action),e="service"===t&&this.action.action,i=e&&"target"in(this.hass.services?.[(0,m.m)(e)]?.[(0,_.Y)(e)]||{})&&("homeassistant.reload_config_entry"!==this.action.action||!this.action.data?.entry_id),o=i?this._extractTargets(this.action):"device_id"===t&&this.action.device_id?{device_id:this.action.device_id}:void 0,a="service"===t&&e?this.hass.services?.[(0,m.m)(e)]?.[(0,_.Y)(e)]?.target:void 0,s=(0,y.C)(this.action.note?.trim()||"",250);return l.qy` ${"service"===t&&"action"in this.action&&this.action.action?l.qy` <ha-service-icon slot="leading-icon" class="action-icon" .hass="${this.hass}" .service="${this.action.action}"></ha-service-icon> `:"condition"===t&&this.optionsInSidebar&&"trigger"!==this.action.condition?l.qy`<ha-automation-condition-live-test id="condition-icon" slot="leading-icon" .hass="${this.hass}" .condition="${this.action}"> <ha-svg-icon class="action-icon" .path="${k.O$[t]}"></ha-svg-icon> </ha-automation-condition-live-test>`:l.qy` <ha-svg-icon slot="leading-icon" class="action-icon" .path="${k.O$[t]}"></ha-svg-icon> `} <h3 slot="header"> ${(0,b.Z)((0,q.u)(this.hass,this._entityReg,this.action,void 0,!1,this._manifests))} ${void 0!==o||i&&!this._isNew?this._renderTargets(o,i&&!this._isNew,a,"device_id"!==t):l.s6} ${s?l.qy` <ha-svg-icon id="note-icon" tabindex="0" .path="${dt}" .label="${this.hass.localize("ui.panel.config.automation.editor.note.label")}" class="note-indicator"></ha-svg-icon><ha-tooltip for="note-icon"><p>${s}</p></ha-tooltip> `:l.s6} ${"condition"!==t&&!0===this.action.continue_on_error?l.qy`<ha-svg-icon id="svg-icon" .path="${at}"></ha-svg-icon> <ha-tooltip for="svg-icon"> ${this.hass.localize("ui.panel.config.automation.editor.actions.continue_on_error_description")} </ha-tooltip>`:l.s6} </h3> <ha-automation-row-event-chip .show="${this._running}" .variant="${this._runResult?.variant}" slot="event" aria-live="polite" .interactive="${!!this._runResult?.details}" class="event-chip" @click="${this._showRunResultDetails}" @keydown="${this._showRunResultDetails}"> ${this._runResult?.title} </ha-automation-row-event-chip> <slot name="icons" slot="icons"></slot> <ha-dropdown slot="icons" @click="${g.C}" @keydown="${v.d}" @wa-select="${this._handleDropdownSelect}" placement="bottom-end"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.common.menu")}" .path="${mt}"></ha-icon-button> <ha-dropdown-item value="run"> <ha-svg-icon slot="icon" .path="${_t}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.run"))} </ha-dropdown-item> <ha-dropdown-item value="rename" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${ft}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.triggers.rename"))} </ha-dropdown-item> <ha-dropdown-item value="edit_note"> <ha-svg-icon slot="icon" .path="${ht}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.note."+(this.action.note?"edit":"add")))} </ha-dropdown-item> <wa-divider></wa-divider> <ha-dropdown-item value="duplicate" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${$t}"></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="${pt}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.triggers.copy"),l.qy`<span class="shortcut"> <span>${R.c?l.qy`<ha-svg-icon .path="${st}"></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="${ut}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.triggers.cut"),l.qy`<span class="shortcut"> <span>${R.c?l.qy`<ha-svg-icon .path="${st}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>X</span> </span>`)} </ha-dropdown-item> ${this._pasteAvailable()?l.qy` <ha-dropdown-item value="paste"> <ha-svg-icon slot="icon" .path="${gt}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.paste"),l.qy`<span class="shortcut"> <span>${R.c?l.qy`<ha-svg-icon .path="${st}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>V</span> </span>`)} </ha-dropdown-item> `:l.s6} ${this.optionsInSidebar?l.s6:l.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="${rt}"></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="${nt}"></ha-svg-icon></ha-dropdown-item> `} <ha-dropdown-item value="toggle_yaml_mode" .disabled="${!this._uiModeAvailable||!!this._warnings}"> <ha-svg-icon slot="icon" .path="${yt}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.edit_"+(this._yamlMode?"ui":"yaml")))} </ha-dropdown-item> <wa-divider></wa-divider> <ha-dropdown-item value="disable" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${!1===this.action.enabled?bt:wt}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions."+(!1===this.action.enabled?"enable":"disable")))} </ha-dropdown-item> ${"condition"!==t?l.qy`<ha-dropdown-item value="continue_on_error" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${this.action.continue_on_error?ct:lt}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.continue_on_error"))} </ha-dropdown-item> <wa-divider></wa-divider>`:l.s6} <ha-dropdown-item value="delete" variant="danger" .disabled="${this.disabled}"> <ha-svg-icon class="warning" slot="icon" .path="${vt}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.delete"),l.qy`<span class="shortcut"> <span>${R.c?l.qy`<ha-svg-icon .path="${st}"></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?l.s6:l.qy`${this._warnings?l.qy`<ha-automation-editor-warning .localize="${this.hass.localize}" .warnings="${this._warnings}"> </ha-automation-editor-warning>`:l.s6} <ha-automation-action-editor .hass="${this.hass}" .action="${this.action}" .disabled="${this.disabled}" .yamlMode="${this._yamlMode}" .narrow="${this.narrow}" .uiSupported="${this._uiSupported(t)}" @ui-mode-not-available="${this._handleUiModeNotAvailable}"></ha-automation-action-editor>`} `}render(){if(!this.action)return l.s6;const t=Ct(this.action),e="repeat"===t?`repeat_${(0,K.m)(this.action.repeat)}`:t;return l.qy` <ha-card outlined> ${!1===this.action.enabled?l.qy` <div class="disabled-bar"> ${this.hass.localize("ui.panel.config.automation.editor.actions.disabled")} </div> `:l.s6} ${this.optionsInSidebar?l.qy`<ha-automation-row .disabled="${!1===this.action.enabled}" .leftChevron="${[...k.L_,...k.I8].includes(e)||"condition"===e&&x.I8.includes(this.action.condition)}" .collapsed="${this._collapsed}" .selected="${this._selected}" .highlight="${this.highlight}" .buildingBlock="${[...k.L_,...k.I8].includes(e)}" .sortSelected="${this.sortSelected}" .dim="${this._running}" @click="${this._toggleSidebar}" @toggle-collapsed="${this._toggleCollapse}">${this._renderRow()}</ha-automation-row>`:l.qy` <ha-expansion-panel left-chevron @expanded-changed="${this._expansionPanelChanged}"> ${this._renderRow()} </ha-expansion-panel> `} </ha-card> ${this.optionsInSidebar&&([...k.L_,...k.I8].includes(e)||"condition"===e&&x.I8.includes(this.action.condition))?l.qy`<ha-automation-action-editor class="${this._collapsed?"hidden":""}" .hass="${this.hass}" .action="${this.action}" .narrow="${this.narrow}" .disabled="${this.disabled}" .uiSupported="${this._uiSupported(t)}" indent .selected="${this._selected}" @value-changed="${this._onValueChange}"></ha-automation-action-editor>`:l.s6} `}_extractTargets(t){return t.target?t.target:t.entity_id?{entity_id:t.entity_id}:{}}_onValueChange(t){this._selected&&this.optionsInSidebar&&this.openSidebar(t.detail.value)}_setClipboard(){this._clipboard={...this._clipboard,action:(0,n.A)(this.action)};let t=this.action;"sequence"in t&&(t={...this.action,metadata:{}}),(0,f.l)((0,r.dump)(t))}_switchUiMode(){this._yamlMode=!1}_switchYamlMode(){this._yamlMode=!0}_handleUiModeNotAvailable(t){this._warnings=(0,$._)(this.hass,t.detail).warnings,this._yamlMode||(this._yamlMode=!0)}_expansionPanelChanged(t){t.detail.expanded||(this._isNew=!1)}_toggleSidebar(t){t?.stopPropagation(),this._selected?(0,u.r)(this,"request-close-sidebar"):this.openSidebar()}markAsNew(){this._isNew=!0}openSidebar(t){const e=t??this.action,i=Ct(e);(0,u.r)(this,"open-sidebar",{save:t=>{(0,u.r)(this,"value-changed",{value:t})},close:t=>{this._selected=!1,this._isNew=!1,(0,u.r)(this,"close-sidebar"),t&&this.focus()},rename:()=>{this._renameAction()},editNote:this._editNoteAction,toggleYamlMode:()=>{this._toggleYamlMode(),this.openSidebar()},disable:this._onDisable,continueOnError:this._continueOnError,delete:this._onDelete,copy:this._copyAction,cut:this._cutAction,paste:this._pasteAction,pasteAvailable:this._pasteAvailable,duplicate:this._duplicateAction,insertAfter:this._insertAfter,run:this._runAction,config:{action:e},uiSupported:!!i&&this._uiSupported(i),yamlMode:this._yamlMode}),this._selected=!0,this._collapsed=!1,this.narrow&&window.setTimeout(()=>{this.scrollIntoView({block:"start",behavior:"smooth"})},180)}expand(){this.optionsInSidebar?this._collapsed=!1:this.updateComplete.then(()=>{this.shadowRoot.querySelector("ha-expansion-panel").expanded=!0})}collapse(){this.optionsInSidebar?this._collapsed=!0:this.updateComplete.then(()=>{this.shadowRoot.querySelector("ha-expansion-panel").expanded=!1})}expandAll(){this.expand(),this._actionEditor?.expandAll()}collapseAll(){this.collapse(),this._actionEditor?.collapseAll()}_toggleCollapse(){this._collapsed=!this._collapsed}focus(){this._automationRowElement?.focus()}_handleDropdownSelect(t){t.stopPropagation();const e=t.detail?.item?.value;if(e)switch(e){case"run":this._runAction();break;case"rename":this._renameAction();break;case"edit_note":this._editNoteAction();break;case"duplicate":this._duplicateAction();break;case"copy":this._copyAction();break;case"cut":this._cutAction();break;case"paste":this._pasteAction();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"continue_on_error":this._continueOnError();break;case"delete":this._onDelete()}}constructor(...t){super(...t),this.narrow=!1,this.disabled=!1,this.root=!1,this.optionsInSidebar=!1,this.sortSelected=!1,this._entityReg=[],this._uiModeAvailable=!0,this._yamlMode=!1,this._selected=!1,this._collapsed=!0,this._isNew=!1,this._running=!1,this._renderTargets=(0,h.A)((t,e=!1,i,o=!1)=>l.qy`<ha-automation-row-targets .target="${t}" .targetRequired="${e}" .selector="${i?{target:i}:void 0}" .interactive="${o}"></ha-automation-row-targets>`),this._onDisable=()=>{const t=!(this.action.enabled??1),e={...this.action,enabled:t};(0,u.r)(this,"value-changed",{value:e}),this._selected&&this.optionsInSidebar&&this.openSidebar(e),this._yamlMode&&!this.optionsInSidebar&&this._actionEditor?.yamlEditor?.setValue(e)},this._continueOnError=()=>{const t={...this.action};t.continue_on_error?delete t.continue_on_error:t.continue_on_error=!0,(0,u.r)(this,"value-changed",{value:t}),this._selected&&this.optionsInSidebar&&this.openSidebar(t),this._yamlMode&&!this.optionsInSidebar&&this._actionEditor?.yamlEditor?.setValue(t)},this._runAction=async()=>{this._runResultTimeout&&clearTimeout(this._runResultTimeout),requestAnimationFrame(()=>{this.scrollIntoViewIfNeeded?this.scrollIntoViewIfNeeded():this.scrollIntoView()}),this._running=!1,this._runResult=void 0;const t=await(0,S.$)(this.hass,{actions:this.action});if(t.actions.valid){const t=setTimeout(()=>{this._runResult={variant:"neutral",title:`${this.hass.localize("ui.panel.config.automation.editor.actions.running_action")}...`},this._running=!0},500);try{await(0,E.d)(this.hass,this.action),clearTimeout(t)}catch(e){clearTimeout(t),this._runResult={variant:"danger",title:this.hass.localize("ui.panel.config.automation.editor.actions.run_action_error"),details:e.message||e}}}else this._runResult={variant:"danger",title:this.hass.localize("ui.panel.config.automation.editor.actions.invalid_action"),details:t.actions.error};this._runResult&&"neutral"!==this._runResult.variant||(this._runResult={variant:"success",title:this.hass.localize("ui.panel.config.automation.editor.actions.run_action_success")}),this._running=!0,this._runResultTimeout=window.setTimeout(()=>{this._running=!1},2500)},this._showRunResultDetails=t=>{this._runResult?.details&&(t instanceof KeyboardEvent&&"Enter"!==t.key&&" "!==t.key||(t.stopPropagation(),(0,I.showAlertDialog)(this,{title:this._runResult.title,text:this._runResult.details})))},this._onDelete=()=>{(0,u.r)(this,"value-changed",{value:null}),this._selected&&(0,u.r)(this,"close-sidebar"),(0,O.c)(this,{message:this.hass.localize("ui.common.successfully_deleted"),duration:4e3,action:{text:this.hass.localize("ui.common.undo"),action:()=>{(0,u.r)(window,"undo-change")}}})},this._renameAction=async()=>{const t=await(0,I.an)(this,{title:this.hass.localize("ui.panel.config.automation.editor.actions.change_alias"),inputLabel:this.hass.localize("ui.panel.config.automation.editor.actions.alias"),inputType:"string",placeholder:(0,b.Z)((0,q.u)(this.hass,this._entityReg,this.action,void 0,!0,this._manifests)),defaultValue:this.action.alias,confirmText:this.hass.localize("ui.common.submit")});if(null!==t){const e={...this.action};""===t?delete e.alias:e.alias=t,(0,u.r)(this,"value-changed",{value:e}),this._selected&&this.optionsInSidebar?this.openSidebar(e):this._yamlMode&&this._actionEditor?.yamlEditor?.setValue(e)}},this._editNoteAction=async()=>{const t=await(0,I.an)(this,{title:this.hass.localize("ui.panel.config.automation.editor.note."+(this.action.note?"edit":"add")),inputLabel:this.hass.localize("ui.panel.config.automation.editor.note.label"),inputType:"string",defaultValue:this.action.note,confirmText:this.hass.localize("ui.common.submit"),multiline:!0});if(null!==t){const e={...this.action};""===t?delete e.note:e.note=t,(0,u.r)(this,"value-changed",{value:e}),this._selected&&this.optionsInSidebar?this.openSidebar(e):this._yamlMode&&this._actionEditor?.yamlEditor?.setValue(e)}},this._duplicateAction=()=>{(0,u.r)(this,"duplicate")},this._insertAfter=t=>!(0,d.e)(t).some(t=>!(0,Z.ve)(t))&&((0,u.r)(this,"insert-after",{value:t}),!0),this._copyAction=()=>{this._setClipboard(),this._selected&&this.optionsInSidebar&&this.openSidebar(),(0,O.c)(this,{message:this.hass.localize("ui.panel.config.automation.editor.actions.copied_to_clipboard"),duration:2e3})},this._cutAction=()=>{this._setClipboard(),(0,u.r)(this,"value-changed",{value:null}),this._selected&&(0,u.r)(this,"close-sidebar"),(0,O.c)(this,{message:this.hass.localize("ui.panel.config.automation.editor.actions.cut_to_clipboard"),duration:2e3})},this._pasteAction=()=>{const t=this._clipboard?.action;t&&(0,u.r)(this,"paste",{item:t})},this._pasteAvailable=()=>!!this._clipboard?.action,this._moveUp=()=>{(0,u.r)(this,"move-up")},this._moveDown=()=>{(0,u.r)(this,"move-down")},this._toggleYamlMode=t=>{this._yamlMode?this._switchUiMode():this._switchYamlMode(),this.optionsInSidebar?t&&this.openSidebar():this.expand()},this._uiSupported=(0,h.A)(t=>void 0!==customElements.get(`ha-automation-action-${t}`))}}Mt.styles=[B.bH,B.Lt,l.AH`ha-svg-icon#svg-icon{--icon-primary-color:var(--ha-color-fill-neutral-loud-active)}ha-svg-icon#svg-icon:hover{--icon-primary-color:var(--ha-color-fill-neutral-loud-hover)}`],(0,a.Cg)([(0,c.MZ)({attribute:!1})],Mt.prototype,"hass",void 0),(0,a.Cg)([(0,c.MZ)({attribute:!1})],Mt.prototype,"action",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean})],Mt.prototype,"narrow",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean})],Mt.prototype,"disabled",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean})],Mt.prototype,"root",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean})],Mt.prototype,"first",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean})],Mt.prototype,"last",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean})],Mt.prototype,"highlight",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean,attribute:"sidebar"})],Mt.prototype,"optionsInSidebar",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean,attribute:"sort-selected"})],Mt.prototype,"sortSelected",void 0),(0,a.Cg)([(0,p.I)({key:"automationClipboard",state:!1,subscribe:!0,storage:"sessionStorage"})],Mt.prototype,"_clipboard",void 0),(0,a.Cg)([(0,c.wk)(),(0,s.Fg)({context:z.ih,subscribe:!0})],Mt.prototype,"_entityReg",void 0),(0,a.Cg)([(0,c.wk)()],Mt.prototype,"_uiModeAvailable",void 0),(0,a.Cg)([(0,c.wk)()],Mt.prototype,"_yamlMode",void 0),(0,a.Cg)([(0,c.wk)()],Mt.prototype,"_selected",void 0),(0,a.Cg)([(0,c.wk)()],Mt.prototype,"_collapsed",void 0),(0,a.Cg)([(0,c.wk)()],Mt.prototype,"_isNew",void 0),(0,a.Cg)([(0,c.wk)()],Mt.prototype,"_warnings",void 0),(0,a.Cg)([(0,c.wk)(),(0,s.Fg)({context:z.uW,subscribe:!0})],Mt.prototype,"_manifests",void 0),(0,a.Cg)([(0,c.wk)()],Mt.prototype,"_running",void 0),(0,a.Cg)([(0,c.wk)()],Mt.prototype,"_runResult",void 0),(0,a.Cg)([(0,c.P)("ha-automation-action-editor")],Mt.prototype,"_actionEditor",void 0),(0,a.Cg)([(0,c.P)("ha-automation-row")],Mt.prototype,"_automationRowElement",void 0),Mt=(0,a.Cg)([(0,c.EM)("ha-automation-action-row")],Mt),o()}catch(t){o(t)}})},68469(t,e,i){i.a(t,async function(t,e){try{i(74423),i(18111),i(7588);var o=i(62826),a=i(34271),s=i(5124),n=i(22441),r=i(75751),l=i(1087),c=i(57237),h=i(18350),d=(i(85938),i(67094),i(30780)),p=i(88249),u=(i(49053),i(82405)),g=i(41175),v=i(57116),m=i(60232),_=t([h,m]);[h,m]=_.then?(await _)():_;const b="M21 11H3V9H21V11M21 13H3V15H21V13Z",y="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class $ extends((0,g.j)(s.WF)){get items(){return this.actions}set items(t){this.actions=t}setHighlightedItems(t){this.highlightedActions=t}render(){return s.qy` <ha-sortable handle-selector=".handle" draggable-selector="ha-automation-action-row" .disabled="${this.disabled}" group="actions" invert-swap @item-moved="${this.itemMoved}" @item-added="${this.itemAdded}" @item-removed="${this.itemRemoved}"> <div class="rows ${this.optionsInSidebar?"":"no-sidebar"}"> ${(0,r.u)(this.actions,t=>this.getKey(t),(t,e)=>s.qy` <ha-automation-action-row .root="${this.root}" .sortableData="${t}" .index="${e}" .first="${0===e}" .last="${e===this.actions.length-1}" .action="${t}" .narrow="${this.narrow}" .disabled="${this.disabled}" @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}" .highlight="${this.highlightedActions?.includes(t)}" .optionsInSidebar="${this.optionsInSidebar}" .sortSelected="${this.rowSortSelected===e}" @stop-sort-selection="${this.stopSortSelection}"> ${this.disabled?s.s6:s.qy` <div tabindex="0" class="handle ${this.rowSortSelected===e?"active":""}" slot="icons" @keydown="${this.handleDragKeydown}" @click="${c.d}" .index="${e}"> <ha-svg-icon .path="${b}"></ha-svg-icon> </div> `} </ha-automation-action-row> `)} <div class="buttons"> <ha-button .disabled="${this.disabled}" @click="${this._addActionDialog}" .appearance="${this.root?"accent":"filled"}" .size="${this.root?"medium":"small"}"> <ha-svg-icon .path="${y}" slot="start"></ha-svg-icon> ${this.hass.localize("ui.panel.config.automation.editor.actions.add")} </ha-button> </div> </div> </ha-sortable> `}updated(t){if(super.updated(t),!this.hass)return;const e=(0,u.II)(this.hass.states,this.hass.devices,this.hass.areas,"action");if(t.has("actions")&&e&&(this._openedAddDialogFromQuery=!1),!this._openedAddDialogFromQuery&&this.root&&!this.disabled&&0===this.actions.length&&e?(this._openedAddDialogFromQuery=!0,queueMicrotask(()=>this._addActionDialog())):this._openedAddDialogFromQuery&&!e&&(this._openedAddDialogFromQuery=!1),t.has("actions")&&(this.focusLastItemOnChange||void 0!==this.focusItemIndexOnChange)){const t=this.focusLastItemOnChange?"new":"moved",e=this.shadowRoot.querySelector("ha-automation-action-row:"+("new"===t?"last-of-type":`nth-of-type(${this.focusItemIndexOnChange+1})`));this.focusLastItemOnChange=!1,this.focusItemIndexOnChange=void 0,e.updateComplete.then(()=>{const i=(0,m.MS)(e.action);!i||!this.optionsInSidebar||d.L_.includes(i)&&"moved"!==t||(e.openSidebar(),this.narrow&&e.scrollIntoView({block:"start",behavior:"smooth"})),"new"===t&&(e.expand(),e.markAsNew()),this.optionsInSidebar||e.focus()})}}expandAll(){this._actionRowElements?.forEach(t=>{t.expandAll()})}collapseAll(){this._actionRowElements?.forEach(t=>{t.collapseAll()})}_addActionDialog(){this.narrow&&(0,l.r)(this,"request-close-sidebar"),(0,u.gZ)(this,{type:"action",add:this._addAction,clipboardItem:(0,m.MS)(this._clipboard?.action),clipboardPasteToastBottomOffset:this.editorDirty?60:void 0})}constructor(...t){super(...t),this.root=!1,this.editorDirty=!1,this._openedAddDialogFromQuery=!1,this._addAction=(t,e)=>{let i;if(t===u.uV)i=this.actions.concat((0,a.A)(this._clipboard.action));else if(t in d.EN)i=this.actions.concat(d.EN[t]);else if((0,p.Q)(t))i=this.actions.concat({action:(0,p.Dt)(t),metadata:{},target:e});else{const e=customElements.get(`ha-automation-action-${t}`);i=this.actions.concat(e?{...e.defaultConfig}:{[t]:{}})}this.focusLastItemOnChange=!0,(0,l.r)(this,"value-changed",{value:i})}}}$.styles=v.Ju,(0,o.Cg)([(0,n.MZ)({type:Boolean})],$.prototype,"root",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:!1})],$.prototype,"editorDirty",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],$.prototype,"actions",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],$.prototype,"highlightedActions",void 0),(0,o.Cg)([(0,n.YG)("ha-automation-action-row")],$.prototype,"_actionRowElements",void 0),$=(0,o.Cg)([(0,n.EM)("ha-automation-action")],$),e()}catch(t){e(t)}})},35877(t,e,i){i.a(t,async function(t,e){try{var o=i(62826),a=i(5124),s=i(22441),n=i(44537),r=i(1087),l=i(14503),c=i(83307),h=i(6650),d=i(57116),p=i(68469),u=t([c,h,p]);[c,h,p]=u.then?(await u)():u;class g extends a.WF{static get defaultConfig(){return{choose:[{conditions:[],sequence:[]}]}}render(){const t=this.action,e=t.choose?(0,n.e)(t.choose):[];return a.qy` <ha-automation-option .options="${e}" .disabled="${this.disabled}" @value-changed="${this._optionsChanged}" .hass="${this.hass}" .narrow="${this.narrow}" .optionsInSidebar="${this.indent}" .showDefaultActions="${this._showDefault||!!t.default}" @show-default-actions="${this._addDefault}"></ha-automation-option> ${this._showDefault||t.default?a.qy` <ha-automation-option-row .defaultActions="${(0,n.e)(t.default)||[]}" .narrow="${this.narrow}" .disabled="${this.disabled}" .hass="${this.hass}" .optionsInSidebar="${this.indent}" @value-changed="${this._defaultChanged}"></ha-automation-option-row> `:a.s6} `}async _addDefault(){this._showDefault=!0,await(this._defaultOptionRowElement?.updateComplete),this._defaultOptionRowElement?.expand()}_optionsChanged(t){t.stopPropagation();const e=t.detail.value;(0,r.r)(this,"value-changed",{value:{...this.action,choose:e}})}_defaultChanged(t){t.stopPropagation(),this._showDefault=!0;const e=t.detail.value,i={...this.action,default:e};0===e.length&&delete i.default,(0,r.r)(this,"value-changed",{value:i})}expandAll(){this._optionElement?.expandAll(),this._defaultOptionRowElement?.expandAll()}collapseAll(){this._optionElement?.collapseAll(),this._defaultOptionRowElement?.collapseAll()}static get styles(){return[l.RF,d.aM,a.AH`ha-automation-option-row{display:block;margin-top:24px}h3{font-size:inherit;font-weight:inherit}`]}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.indent=!1,this._showDefault=!1}}(0,o.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],g.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"action",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],g.prototype,"narrow",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],g.prototype,"indent",void 0),(0,o.Cg)([(0,s.wk)()],g.prototype,"_showDefault",void 0),(0,o.Cg)([(0,s.P)("ha-automation-option")],g.prototype,"_optionElement",void 0),(0,o.Cg)([(0,s.P)("ha-automation-option-row")],g.prototype,"_defaultOptionRowElement",void 0),g=(0,o.Cg)([(0,s.EM)("ha-automation-action-choose")],g),e()}catch(t){e(t)}})},49707(t,e,i){i.a(t,async function(t,e){try{i(74423),i(18111),i(61701);var o=i(62826),a=i(5124),s=i(22441),n=i(22786),r=i(1087),l=i(76623),c=(i(70947),i(606)),h=i(88249),d=i(87225),p=i(95350),u=i(54706),g=i(49313),v=i(80081),m=i(30356),_=i(4601),b=i(97681),y=i(4519),$=i(93977),f=i(40998),w=i(60092),C=i(1103),A=i(52128),M=i(56860),V=t([c,g,v,m,_,b,y,$,f,w,C,A,M,l]);[c,g,v,m,_,b,y,$,f,w,C,A,M,l]=V.then?(await V)():V;class H extends((0,u.E)(a.WF)){static get defaultConfig(){return{condition:"state"}}hassSubscribe(){return[(0,d.bn)(this.hass,t=>this._addConditions(t))]}_addConditions(t){this._conditionDescriptions={...this._conditionDescriptions,...t}}render(){const t=d.I8.includes(this.action.condition),e=this.action.condition in this._conditionDescriptions?`${h.VH}${this.action.condition}`:this.action.condition;return a.qy` ${this.inSidebar||!this.inSidebar&&!this.indent?a.qy` <ha-generic-picker .hass="${this.hass}" .label="${this.hass.localize("ui.panel.config.automation.editor.conditions.type_select")}" .disabled="${this.disabled}" .value="${e}" .getItems="${this._processedTypes(this._conditionDescriptions,this.hass.localize)}" .rowRenderer="${this._rowRenderer}" .valueRenderer="${this._valueRenderer}" @value-changed="${this._typeChanged}"></ha-generic-picker> `:a.s6} ${this.indent&&t||this.inSidebar&&!t||!this.indent&&!this.inSidebar?a.qy` <ha-automation-condition-editor .condition="${this.action}" .description="${this._conditionDescriptions[this.action.condition]}" .disabled="${this.disabled}" .hass="${this.hass}" @value-changed="${this._conditionChanged}" .narrow="${this.narrow}" .uiSupported="${this._uiSupported(this._getType(this.action,this._conditionDescriptions))}" .indent="${this.indent}" action></ha-automation-condition-editor> `:a.s6} `}_conditionChanged(t){t.stopPropagation(),(0,r.r)(this,"value-changed",{value:t.detail.value})}_typeChanged(t){t.stopPropagation();const e=t.detail.value;if(!e)return;if((0,h.Q)(e)){const t=(0,h.Dt)(e);return void(t!==this.action.condition&&(0,r.r)(this,"value-changed",{value:{condition:t}}))}const i=customElements.get(`ha-automation-condition-${e}`);e!==this.action.condition&&(0,r.r)(this,"value-changed",{value:{...i.defaultConfig}})}expandAll(){this._conditionEditor?.expandAll()}collapseAll(){this._conditionEditor?.collapseAll()}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.inSidebar=!1,this.indent=!1,this._conditionDescriptions={},this._valueRenderer=t=>{const e=(0,h.Q)(t),i=e?(0,h.Dt)(t):t;let o;if(e){const t=(0,d.ob)(i),e=(0,d.YQ)(i);o=this.hass.localize(`component.${t}.conditions.${e}.name`)||i}else o=this.hass.localize(`ui.panel.config.automation.editor.conditions.type.${i}.label`)||i;return a.qy`<ha-condition-icon slot="start" .hass="${this.hass}" .condition="${i}"></ha-condition-icon><span slot="headline">${o}</span>`},this._rowRenderer=t=>a.qy` <ha-combo-box-item type="button"> <ha-condition-icon slot="start" .hass="${this.hass}" .condition="${t.search_labels.condition||void 0}"></ha-condition-icon> <span slot="headline">${t.primary}</span> ${t.secondary?a.qy`<span slot="supporting-text">${t.secondary}</span>`:a.s6} </ha-combo-box-item> `,this._processedTypes=(0,n.A)((t,e)=>{const i=Object.keys(l.D).map(t=>{const i=e(`ui.panel.config.automation.editor.conditions.type.${t}.label`);return{id:t,primary:i,sorting_label:i,search_labels:{condition:t}}}),o=Object.keys(t).map(t=>{const i=(0,d.ob)(t),o=(0,d.YQ)(t),a=e(`component.${i}.conditions.${o}.name`)||t;return{id:`${h.VH}${t}`,primary:a,secondary:(0,p.p$)(this.hass.localize,i),sorting_label:a,search_labels:{condition:t,domain:i}}});return()=>[...i,...o]}),this._getType=(0,n.A)((t,e)=>t.condition in e?"platform":t.condition),this._uiSupported=(0,n.A)(t=>void 0!==customElements.get(`ha-automation-condition-${t}`))}}H.styles=a.AH`ha-generic-picker{margin-bottom:24px;display:block}`,(0,o.Cg)([(0,s.MZ)({attribute:!1})],H.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],H.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],H.prototype,"action",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],H.prototype,"narrow",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,attribute:"sidebar"})],H.prototype,"inSidebar",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,attribute:"indent"})],H.prototype,"indent",void 0),(0,o.Cg)([(0,s.wk)()],H.prototype,"_conditionDescriptions",void 0),(0,o.Cg)([(0,s.P)("ha-automation-condition-editor")],H.prototype,"_conditionEditor",void 0),H=(0,o.Cg)([(0,s.EM)("ha-automation-action-condition")],H),e()}catch(t){e(t)}})},67909(t,e,i){i.a(t,async function(t,e){try{var o=i(62826),a=i(5124),s=i(22441),n=i(1087),r=i(24790),l=i(39927),c=i(57673),h=t([l]);l=(h.then?(await h)():h)[0];class d extends a.WF{static get defaultConfig(){return{delay:""}}willUpdate(t){t.has("action")&&(this.action&&(0,r.r)(this.action)?(0,n.r)(this,"ui-mode-not-available",Error(this.hass.localize("ui.errors.config.no_template_editor_support"))):this._timeData=(0,c.z)(this.action.delay))}render(){return a.qy`<ha-duration-input .label="${this.hass.localize("ui.panel.config.automation.editor.actions.type.delay.delay")}" .disabled="${this.disabled}" .data="${this._timeData}" enable-millisecond required @value-changed="${this._valueChanged}"></ha-duration-input>`}_valueChanged(t){t.stopPropagation();const e=t.detail.value;e&&(0,n.r)(this,"value-changed",{value:{...this.action,delay:e}})}constructor(...t){super(...t),this.disabled=!1}}(0,o.Cg)([(0,s.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],d.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],d.prototype,"action",void 0),(0,o.Cg)([(0,s.wk)()],d.prototype,"_timeData",void 0),d=(0,o.Cg)([(0,s.EM)("ha-automation-action-delay")],d),e()}catch(t){e(t)}})},83108(t,e,i){i.a(t,async function(t,e){try{i(18111),i(7588);var o=i(62826),a=i(35211),s=i(5124),n=i(22441),r=i(22786),l=i(1087),c=i(42778),h=i(1798),d=i(52763),p=i(22792),u=i(10139),g=t([c,h,d]);[c,h,d]=g.then?(await g)():g;class v extends s.WF{static get defaultConfig(){return{device_id:"",domain:"",entity_id:""}}shouldUpdate(t){return!t.has("action")||(!this.action.device_id||this.action.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.action.device_id;return s.qy` <ha-device-picker .value="${t}" .disabled="${this.disabled}" @value-changed="${this._devicePicked}" .hass="${this.hass}" label="${this.hass.localize("ui.panel.config.automation.editor.actions.type.device_id.label")}"></ha-device-picker> <ha-device-action-picker .value="${this.action}" .deviceId="${t}" .disabled="${this.disabled}" @value-changed="${this._deviceActionPicked}" .hass="${this.hass}" label="${this.hass.localize("ui.panel.config.automation.editor.actions.type.device_id.action")}"></ha-device-action-picker> ${this._capabilities?.extra_fields?.length?s.qy` <ha-form .hass="${this.hass}" .data="${this._extraFieldsData(this.action,this._capabilities)}" .schema="${this._capabilities.extra_fields}" .disabled="${this.disabled}" .computeLabel="${(0,u.T_)(this.hass.localize,this.action)}" .computeHelper="${(0,u.TH)(this.hass.localize,this.action)}" @value-changed="${this._extraFieldsChanged}"></ha-form> `:""} `}firstUpdated(){this.hass.loadBackendTranslation("device_automation"),this._capabilities||this._getCapabilities(),this.action&&(this._origAction=this.action)}updated(t){const e=t.get("action");e&&!(0,u.Po)(this._entityReg,e,this.action)&&(this._deviceId=void 0,this._getCapabilities())}async _getCapabilities(){this._capabilities=this.action.domain?await(0,u.jR)(this.hass.callWS,this.action):void 0}_devicePicked(t){t.stopPropagation(),this._deviceId=t.target.value,void 0===this._deviceId&&(0,l.r)(this,"value-changed",{value:v.defaultConfig})}_deviceActionPicked(t){t.stopPropagation();let e=t.detail.value;this._origAction&&(0,u.Po)(this._entityReg,this._origAction,e)&&(e=this._origAction),(0,l.r)(this,"value-changed",{value:e})}_extraFieldsChanged(t){t.stopPropagation(),(0,l.r)(this,"value-changed",{value:{...this.action,...t.detail.value}})}constructor(...t){super(...t),this.disabled=!1,this._entityReg=[],this._extraFieldsData=(0,r.A)((t,e)=>{const i={};return e.extra_fields.forEach(e=>{void 0!==t[e.name]&&(i[e.name]=t[e.name])}),i})}}v.styles=s.AH`:host{display:block;margin-bottom:var(--ha-space-3)}ha-device-picker{display:block;margin-bottom:24px}ha-device-action-picker{display:block}ha-form{display:block;margin-top:24px}`,(0,o.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],v.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({type:Object})],v.prototype,"action",void 0),(0,o.Cg)([(0,n.wk)()],v.prototype,"_deviceId",void 0),(0,o.Cg)([(0,n.wk)()],v.prototype,"_capabilities",void 0),(0,o.Cg)([(0,n.wk)(),(0,a.Fg)({context:p.ih,subscribe:!0})],v.prototype,"_entityReg",void 0),v=(0,o.Cg)([(0,n.EM)("ha-automation-action-device_id")],v),e()}catch(t){e(t)}})},57826(t,e,i){i.a(t,async function(t,e){try{var o=i(62826),a=i(5124),s=i(22441),n=i(1087),r=i(82474),l=i(99766),c=i(10763),h=i(91485),d=i(60232),p=t([r,l,c,h,d]);[r,l,c,h,d]=p.then?(await p)():p;class u extends a.WF{static get defaultConfig(){return{event:"",event_data:{}}}updated(t){t.has("action")&&(this._actionData&&this._actionData!==this.action.event_data&&this._yamlEditor&&this._yamlEditor.setValue(this.action.event_data),this._actionData=this.action.event_data)}render(){const{event:t,event_data:e}=this.action;return a.qy` <ha-input .label="${this.hass.localize("ui.panel.config.automation.editor.actions.type.event.event")}" .value="${t}" .disabled="${this.disabled}" @change="${this._eventChanged}"></ha-input> <ha-yaml-editor .label="${this.hass.localize("ui.panel.config.automation.editor.actions.type.event.event_data")}" .name="${"event_data"}" .readOnly="${this.disabled}" .defaultValue="${e}" @value-changed="${this._dataChanged}"></ha-yaml-editor> `}_dataChanged(t){t.stopPropagation(),t.detail.isValid&&(this._actionData=t.detail.value,(0,d.Pb)(this,t))}_eventChanged(t){t.stopPropagation(),(0,n.r)(this,"value-changed",{value:{...this.action,event:t.target.value}})}constructor(...t){super(...t),this.disabled=!1}}(0,o.Cg)([(0,s.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],u.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],u.prototype,"action",void 0),(0,o.Cg)([(0,s.P)("ha-yaml-editor",!0)],u.prototype,"_yamlEditor",void 0),u=(0,o.Cg)([(0,s.EM)("ha-automation-action-event")],u),e()}catch(t){e(t)}})},75107(t,e,i){i.a(t,async function(t,e){try{i(18111),i(7588);var o=i(62826),a=i(5124),s=i(22441),n=i(1087),r=i(14503),l=i(68469),c=t([l]);l=(c.then?(await c)():c)[0];class h extends a.WF{static get defaultConfig(){return{if:[],then:[]}}render(){const t=this.action;return a.qy` <h4> ${this.hass.localize("ui.panel.config.automation.editor.actions.type.if.if")}: </h4> <ha-automation-condition .conditions="${t.if??[]}" .disabled="${this.disabled}" @value-changed="${this._ifChanged}" .hass="${this.hass}" .narrow="${this.narrow}" .optionsInSidebar="${this.indent}"></ha-automation-condition> <h4> ${this.hass.localize("ui.panel.config.automation.editor.actions.type.if.then")}: </h4> <ha-automation-action .actions="${t.then??[]}" .disabled="${this.disabled}" @value-changed="${this._thenChanged}" .hass="${this.hass}" .narrow="${this.narrow}" .optionsInSidebar="${this.indent}"></ha-automation-action> <h4> ${this.hass.localize("ui.panel.config.automation.editor.actions.type.if.else")}: </h4> <ha-automation-action .actions="${t.else||[]}" .disabled="${this.disabled}" @value-changed="${this._elseChanged}" .hass="${this.hass}" .narrow="${this.narrow}" .optionsInSidebar="${this.indent}"></ha-automation-action> `}_ifChanged(t){t.stopPropagation();const e=t.detail.value;(0,n.r)(this,"value-changed",{value:{...this.action,if:e}})}_thenChanged(t){t.stopPropagation();const e=t.detail.value;(0,n.r)(this,"value-changed",{value:{...this.action,then:e}})}_elseChanged(t){t.stopPropagation();const e=t.detail.value,i={...this.action,else:e};0===e.length&&delete i.else,(0,n.r)(this,"value-changed",{value:i})}expandAll(){this._conditionElement?.expandAll(),this._actionElements?.forEach(t=>t.expandAll?.())}collapseAll(){this._conditionElement?.collapseAll(),this._actionElements?.forEach(t=>t.collapseAll?.())}static get styles(){return[r.RF,a.AH`h4{color:var(--secondary-text-color);margin-bottom:8px}h4:first-child{margin-top:0}`]}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.indent=!1}}(0,o.Cg)([(0,s.MZ)({attribute:!1})],h.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],h.prototype,"action",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"narrow",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"indent",void 0),(0,o.Cg)([(0,s.P)("ha-automation-condition")],h.prototype,"_conditionElement",void 0),(0,o.Cg)([(0,s.YG)("ha-automation-action")],h.prototype,"_actionElements",void 0),h=(0,o.Cg)([(0,s.EM)("ha-automation-action-if")],h),e()}catch(t){e(t)}})},23063(t,e,i){i.a(t,async function(t,e){try{var o=i(62826),a=i(5124),s=i(22441),n=i(1087),r=i(14503),l=i(68469),c=t([l]);l=(c.then?(await c)():c)[0];class h extends a.WF{static get defaultConfig(){return{parallel:[]}}render(){const t=this.action;return a.qy` <ha-automation-action .actions="${t.parallel}" .narrow="${this.narrow}" .disabled="${this.disabled}" @value-changed="${this._actionsChanged}" .hass="${this.hass}" .optionsInSidebar="${this.indent}"></ha-automation-action> `}_actionsChanged(t){t.stopPropagation();const e=t.detail.value;(0,n.r)(this,"value-changed",{value:{...this.action,parallel:e}})}expandAll(){this._actionElement?.expandAll()}collapseAll(){this._actionElement?.collapseAll()}static get styles(){return r.RF}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.indent=!1}}(0,o.Cg)([(0,s.MZ)({attribute:!1})],h.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"narrow",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],h.prototype,"action",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"indent",void 0),(0,o.Cg)([(0,s.P)("ha-automation-action")],h.prototype,"_actionElement",void 0),h=(0,o.Cg)([(0,s.EM)("ha-automation-action-parallel")],h),e()}catch(t){e(t)}})},49063(t,e,i){i.a(t,async function(t,o){try{i.d(e,{m:()=>v});i(44114),i(18111),i(7588);var a=i(62826),s=i(5124),n=i(22441),r=i(22786),l=i(1087),c=i(14503),h=i(68469),d=i(24790),p=i(52763),u=t([h,p]);[h,p]=u.then?(await u)():u;const g=["count","while","until","for_each"],v=t=>g.find(e=>e in t);class m extends s.WF{static get defaultConfig(){return{repeat:{count:2,sequence:[]}}}render(){const t=this.action.repeat,e=v(t),i=this._schema(e??"count","count"in t&&"string"==typeof t.count&&(0,d.F)(t.count),this.inSidebar,this.indent),o={...t,type:e};return s.qy`<ha-form .hass="${this.hass}" .data="${o}" .schema="${i}" .disabled="${this.disabled}" @value-changed="${this._valueChanged}" .computeLabel="${this._computeLabelCallback}" .narrow="${this.narrow}"></ha-form>`}_valueChanged(t){t.stopPropagation();const e=t.detail.value,i=e.type;delete e.type;i!==v(this.action.repeat)&&("count"===i&&(e.count=2,delete e.while,delete e.until,delete e.for_each),"while"===i&&(e.while=e.until??[],delete e.count,delete e.until,delete e.for_each),"until"===i&&(e.until=e.while??[],delete e.count,delete e.while,delete e.for_each),"for_each"===i&&(e.for_each={},delete e.count,delete e.while,delete e.until)),(0,l.r)(this,"value-changed",{value:{...this.action,repeat:{...e}}})}static get styles(){return[c.RF]}_getSelectorElements(){if(this._formElement){const t=this._formElement.shadowRoot?.querySelectorAll("ha-selector"),e=[];return t?.forEach(t=>{e.push(...Array.from(t.shadowRoot?.querySelectorAll("ha-selector-condition, ha-selector-action")||[]))}),e}return[]}expandAll(){this._getSelectorElements().forEach(t=>{t.expandAll?.()})}collapseAll(){this._getSelectorElements().forEach(t=>{t.collapseAll?.()})}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.inSidebar=!1,this.indent=!1,this._schema=(0,r.A)((t,e,i,o)=>[..."count"!==t||!i&&(i||o)?[]:[{name:"count",required:!0,selector:e?{template:{}}:{number:{mode:"box",min:1}}}],..."until"!==t&&"while"!==t||!o&&(i||o)?[]:[{name:t,selector:{condition:{optionsInSidebar:o}}}],..."for_each"!==t||!i&&(i||o)?[]:[{name:"for_each",required:!0,selector:{object:{}}}],...o||!i&&!o?[{name:"sequence",selector:{action:{optionsInSidebar:o}}}]:[]]),this._computeLabelCallback=t=>{switch(t.name){case"count":return this.hass.localize("ui.panel.config.automation.editor.actions.type.repeat.type.count.label");case"while":return this.hass.localize("ui.panel.config.automation.editor.actions.type.repeat.type.while.conditions")+":";case"until":return this.hass.localize("ui.panel.config.automation.editor.actions.type.repeat.type.until.conditions")+":";case"for_each":return this.hass.localize("ui.panel.config.automation.editor.actions.type.repeat.type.for_each.items")+":";case"sequence":return this.hass.localize("ui.panel.config.automation.editor.actions.type.repeat.sequence")+":"}return""}}}(0,a.Cg)([(0,n.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],m.prototype,"disabled",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],m.prototype,"narrow",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],m.prototype,"action",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,attribute:"sidebar"})],m.prototype,"inSidebar",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,attribute:"indent"})],m.prototype,"indent",void 0),(0,a.Cg)([(0,n.P)("ha-form")],m.prototype,"_formElement",void 0),m=(0,a.Cg)([(0,n.EM)("ha-automation-action-repeat")],m),o()}catch(t){o(t)}})},85933(t,e,i){i.a(t,async function(t,e){try{var o=i(62826),a=i(5124),s=i(22441),n=i(1087),r=i(14503),l=i(68469),c=t([l]);l=(c.then?(await c)():c)[0];class h extends a.WF{static get defaultConfig(){return{sequence:[]}}render(){const{action:t}=this;return a.qy` <ha-automation-action .actions="${t.sequence}" .narrow="${this.narrow}" .disabled="${this.disabled}" @value-changed="${this._actionsChanged}" .hass="${this.hass}" .optionsInSidebar="${this.indent}"></ha-automation-action> `}_actionsChanged(t){t.stopPropagation();const e=t.detail.value;(0,n.r)(this,"value-changed",{value:{...this.action,sequence:e}})}expandAll(){this._actionElement?.expandAll()}collapseAll(){this._actionElement?.collapseAll()}static get styles(){return r.RF}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.indent=!1}}(0,o.Cg)([(0,s.MZ)({attribute:!1})],h.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"narrow",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],h.prototype,"action",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"indent",void 0),(0,o.Cg)([(0,s.P)("ha-automation-action")],h.prototype,"_actionElement",void 0),h=(0,o.Cg)([(0,s.EM)("ha-automation-action-sequence")],h),e()}catch(t){e(t)}})},19809(t,e,i){i.a(t,async function(t,e){try{i(74423),i(18111),i(13579);var o=i(62826),a=i(5124),s=i(22441),n=i(63533),r=i(1087),l=i(24790),c=(i(9503),i(67431)),h=i(91485),d=i(84025),p=t([c,h]);[c,h]=p.then?(await p)():p;class u extends a.WF{static get defaultConfig(){return{action:"",data:{}}}willUpdate(t){if(t.has("action")){try{(0,n.vA)(this.action,d.BD)}catch(t){return void(0,r.r)(this,"ui-mode-not-available",t)}this.action&&Object.entries(this.action).some(([t,e])=>!["data","target"].includes(t)&&(0,l.r)(e))?(0,r.r)(this,"ui-mode-not-available",Error(this.hass.localize("ui.errors.config.no_template_editor_support"))):this.action.entity_id?(this._action={...this.action,data:{...this.action.data,entity_id:this.action.entity_id}},delete this._action.entity_id):this._action=this.action}}render(){if(!this._action)return a.s6;const[t,e]=this._action.action?this._action.action.split(".",2):[void 0,void 0],i=!(!t||!e)&&!!this.hass.services[t]?.[e]?.response?.optional;return a.qy` <ha-service-control .narrow="${this.narrow}" .hass="${this.hass}" .value="${this._action}" .disabled="${this.disabled}" .hidePicker="${!!this._action.metadata}" @value-changed="${this._actionChanged}"></ha-service-control> ${t&&e&&this.hass.services[t]?.[e]?.response?a.qy`<ha-settings-row .narrow="${this.narrow}"> ${i?a.qy`<ha-checkbox .checked="${!!this._action.response_variable||this._responseChecked}" .disabled="${this.disabled}" @change="${this._responseCheckboxChanged}" slot="prefix"></ha-checkbox>`:a.qy`<div slot="prefix" class="checkbox-spacer"></div>`} <span slot="heading" class="${i?"clickable":""}" @click="${i?this._toggleCheckbox:void 0}">${this.hass.localize("ui.panel.config.automation.editor.actions.type.service.response_variable")}</span> <span slot="description" class="${i?"clickable":""}" @click="${i?this._toggleCheckbox:void 0}"> ${i?this.hass.localize("ui.panel.config.automation.editor.actions.type.service.has_optional_response"):this.hass.localize("ui.panel.config.automation.editor.actions.type.service.has_response")} </span> <ha-input .value="${this._action.response_variable||""}" .required="${!i}" .disabled="${this.disabled||i&&!this._action.response_variable&&!this._responseChecked}" @change="${this._responseVariableChanged}"></ha-input> </ha-settings-row>`:a.s6} `}_actionChanged(t){t.detail.value===this._action&&t.stopPropagation();const e={...this.action,...t.detail.value};if("response_variable"in this.action){const[t,i]=this._action.action?this._action.action.split(".",2):[void 0,void 0];t&&i&&this.hass.services[t]?.[i]&&!("response"in this.hass.services[t][i])&&(delete e.response_variable,this._responseChecked=!1)}(0,r.r)(this,"value-changed",{value:e})}_responseVariableChanged(t){const e={...this.action,response_variable:t.target.value};t.target.value||delete e.response_variable,(0,r.r)(this,"value-changed",{value:e})}_toggleCheckbox(t){const e=t.currentTarget?.parentElement?.querySelector("ha-checkbox");e?.click()}_responseCheckboxChanged(t){if(this._responseChecked=t.target.checked,!this._responseChecked){const t={...this.action};delete t.response_variable,(0,r.r)(this,"value-changed",{value:t})}}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this._responseChecked=!1}}u.styles=a.AH`ha-service-control{display:block;margin:0 -16px}ha-settings-row{margin:0 -16px;padding:var(--service-control-padding,0 16px)}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))}.checkbox-spacer{width:32px}.clickable{cursor:pointer}`,(0,o.Cg)([(0,s.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],u.prototype,"action",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],u.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],u.prototype,"narrow",void 0),(0,o.Cg)([(0,s.wk)()],u.prototype,"_action",void 0),(0,o.Cg)([(0,s.wk)()],u.prototype,"_responseChecked",void 0),u=(0,o.Cg)([(0,s.EM)("ha-automation-action-service")],u),e()}catch(t){e(t)}})},66710(t,e,i){i.a(t,async function(t,e){try{var o=i(62826),a=i(5124),s=i(22441),n=i(52763),r=t([n]);n=(r.then?(await r)():r)[0];const l=[{name:"set_conversation_response",selector:{template:{}}}];class c extends a.WF{static get defaultConfig(){return{set_conversation_response:""}}render(){return a.qy` <ha-form .hass="${this.hass}" .data="${this.action}" .schema="${l}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}"></ha-form> `}constructor(...t){super(...t),this.disabled=!1,this._computeLabelCallback=()=>this.hass.localize("ui.panel.config.automation.editor.actions.type.set_conversation_response.label")}}(0,o.Cg)([(0,s.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],c.prototype,"action",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],c.prototype,"disabled",void 0),c=(0,o.Cg)([(0,s.EM)("ha-automation-action-set_conversation_response")],c),e()}catch(t){e(t)}})},11864(t,e,i){i.a(t,async function(t,e){try{var o=i(62826),a=i(35211),s=i(5124),n=i(22441),r=i(1087),l=(i(6),i(59646)),c=i(91485),h=i(22792),d=t([l,c]);[l,c]=d.then?(await d)():d;class p extends s.WF{static get defaultConfig(){return{stop:""}}render(){const{error:t,stop:e,response_variable:i}=this.action;return s.qy` <ha-input .label="${this._i18n.localize("ui.panel.config.automation.editor.actions.type.stop.stop")}" .value="${e}" .disabled="${this.disabled}" @change="${this._stopChanged}"></ha-input> <ha-input .label="${this._i18n.localize("ui.panel.config.automation.editor.actions.type.stop.response_variable")}" .value="${i||""}" .disabled="${this.disabled}" @change="${this._responseChanged}"></ha-input> <ha-formfield .disabled="${this.disabled}" .label="${this._i18n.localize("ui.panel.config.automation.editor.actions.type.stop.error")}"> <ha-switch .disabled="${this.disabled}" .checked="${t??!1}" @change="${this._errorChanged}"></ha-switch> </ha-formfield> `}_stopChanged(t){t.stopPropagation(),(0,r.r)(this,"value-changed",{value:{...this.action,stop:t.target.value}})}_responseChanged(t){t.stopPropagation();const e={...this.action},i=t.target.value;i?e.response_variable=i:delete e.response_variable,(0,r.r)(this,"value-changed",{value:e})}_errorChanged(t){t.stopPropagation(),(0,r.r)(this,"value-changed",{value:{...this.action,error:t.target.checked}})}constructor(...t){super(...t),this.disabled=!1}}p.styles=s.AH`ha-input{margin-bottom:var(--ha-space-6)}`,(0,o.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"action",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],p.prototype,"disabled",void 0),(0,o.Cg)([(0,n.wk)(),(0,a.Fg)({context:h.D5,subscribe:!0})],p.prototype,"_i18n",void 0),p=(0,o.Cg)([(0,n.EM)("ha-automation-action-stop")],p),e()}catch(t){e(t)}})},88166(t,e,i){i.a(t,async function(t,e){try{i(18111),i(13579);var o=i(62826),a=i(5124),s=i(22441),n=i(22786),r=i(44537),l=i(24790),c=i(52763),h=i(53723),d=i(60232),p=t([c,h,d]);[c,h,d]=p.then?(await p)():p;class u extends a.WF{static get defaultConfig(){return{wait_for_trigger:[]}}render(){const t=this.action.timeout,e="string"==typeof t&&(0,l.F)(t)?"string_template":"object"==typeof t&&null!==t&&Object.values(t).some(t=>"string"==typeof t&&(0,l.F)(t))?"object_template":"duration";return a.qy` ${this.inSidebar||!this.inSidebar&&!this.indent?a.qy` <ha-form .hass="${this.hass}" .data="${this.action}" .schema="${this._schema(e)}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}"></ha-form> `:a.s6} ${this.indent||!this.inSidebar&&!this.indent?a.qy`<ha-automation-trigger class="${this.inSidebar||this.indent?"":"expansion-panel"}" .triggers="${(0,r.e)(this.action.wait_for_trigger)}" .hass="${this.hass}" .disabled="${this.disabled}" .name="${"wait_for_trigger"}" @value-changed="${this._valueChanged}" .optionsInSidebar="${this.indent}" .narrow="${this.narrow}"></ha-automation-trigger>`:a.s6} `}_valueChanged(t){(0,d.Pb)(this,t)}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.inSidebar=!1,this.indent=!1,this._schema=(0,n.A)(t=>[{name:"timeout",required:!1,selector:"string_template"===t?{template:{}}:"object_template"===t?{object:{}}:{duration:{enable_millisecond:!0}}},{name:"continue_on_timeout",selector:{boolean:{}}}]),this._computeLabelCallback=t=>this.hass.localize(`ui.panel.config.automation.editor.actions.type.wait_for_trigger.${"continue_on_timeout"===t.name?"continue_timeout":t.name}`)}}u.styles=a.AH`ha-automation-trigger.expansion-panel{display:block;margin-top:24px}`,(0,o.Cg)([(0,s.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],u.prototype,"action",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],u.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],u.prototype,"narrow",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,attribute:"sidebar"})],u.prototype,"inSidebar",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,attribute:"indent"})],u.prototype,"indent",void 0),u=(0,o.Cg)([(0,s.EM)("ha-automation-action-wait_for_trigger")],u),e()}catch(t){e(t)}})},21446(t,e,i){i.a(t,async function(t,e){try{i(18111),i(13579);var o=i(62826),a=i(5124),s=i(22441),n=i(22786),r=i(24790),l=i(52763),c=t([l]);l=(c.then?(await c)():c)[0];class h extends a.WF{static get defaultConfig(){return{wait_template:"",continue_on_timeout:!0}}render(){const t=this.action.timeout,e="string"==typeof t&&(0,r.F)(t)?"string_template":"object"==typeof t&&null!==t&&Object.values(t).some(t=>"string"==typeof t&&(0,r.F)(t))?"object_template":"duration";return a.qy` <ha-form .hass="${this.hass}" .data="${this.action}" .schema="${this._schema(e)}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}"></ha-form> `}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,n.A)(t=>[{name:"wait_template",selector:{template:{}}},{name:"timeout",required:!1,selector:"string_template"===t?{template:{}}:"object_template"===t?{object:{}}:{duration:{enable_millisecond:!0}}},{name:"continue_on_timeout",selector:{boolean:{}}}]),this._computeLabelCallback=t=>this.hass.localize(`ui.panel.config.automation.editor.actions.type.wait_template.${"continue_on_timeout"===t.name?"continue_timeout":t.name}`)}}(0,o.Cg)([(0,s.MZ)({attribute:!1})],h.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],h.prototype,"action",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"disabled",void 0),h=(0,o.Cg)([(0,s.EM)("ha-automation-action-wait_template")],h),e()}catch(t){e(t)}})},6650(t,e,i){i.a(t,async function(t,e){try{var o=i(62826),a=i(35211),s=i(5124),n=i(22441),r=i(6412),l=i(44537),c=i(1087),h=i(99124),d=i(57237),p=i(52943),u=i(53516),g=i(56214),v=(i(76776),i(29823)),m=(i(70947),i(11382),i(26300)),_=(i(67094),i(79800)),b=i(22792),y=i(65063),$=i(41570),f=i(68469),w=i(40219),C=i(49053),A=i(57116),M=t([g,v,m,f,w,_]);[g,v,m,f,w,_]=M.then?(await M)():M;const V="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",H="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",L="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",k="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",x="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",S="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",z="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",Z="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",q="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";class E extends s.WF{get selected(){return this._selected}_expandedChanged(t){"option"===t.currentTarget.id&&(this._expanded=t.detail.expanded)}_getDescription(){const t=(0,l.e)(this.option.conditions);if(!t||0===t.length)return this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.no_conditions");let e="";return"string"==typeof t[0]?e+=t[0]:e+=(0,_.p)(t[0],this.hass,this._entityReg),t.length>1&&(e+=this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.option_description_additional",{numberOfAdditionalConditions:t.length-1})),e}_renderOverflowLabel(t,e){return s.qy` <div class="overflow-label"> ${t} ${this.optionsInSidebar&&!this.narrow?e||s.qy`<span class="shortcut-placeholder ${$.c?"mac":""}"></span>`:s.s6} </div> `}_renderRow(){const t=(0,u.C)(this.option?.note?.trim()||"",250);return s.qy` <h3 slot="header"> ${this.option?`${this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.option",{number:this.index+1})}: ${this.option.alias||(this._expanded?"":this._getDescription())}`:this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.default")} ${this.option?.note?.trim()?s.qy` <ha-svg-icon id="note-icon" tabindex="0" .path="${x}" .label="${this.hass.localize("ui.panel.config.automation.editor.note.label")}" class="note-indicator"></ha-svg-icon> <ha-tooltip for="note-icon"><p>${t}</p></ha-tooltip> `:s.s6} </h3> <slot name="icons" slot="icons"></slot> ${this.option?s.qy` <ha-dropdown slot="icons" @click="${h.C}" @keydown="${d.d}" @wa-select="${this._handleDropdownSelect}" placement="bottom-end"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.common.menu")}" .path="${z}"></ha-icon-button> <ha-dropdown-item value="rename" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${q}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.triggers.rename"))} </ha-dropdown-item> <ha-dropdown-item value="edit_note"> <ha-svg-icon slot="icon" .path="${k}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.note."+(this.option?.note?"edit":"add")))} </ha-dropdown-item> <ha-dropdown-item value="duplicate" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${Z}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.duplicate"))} </ha-dropdown-item> ${this.optionsInSidebar?s.s6:s.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="${L}"></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="${H}"></ha-svg-icon></ha-dropdown-item> `} <ha-dropdown-item value="delete" variant="danger" .disabled="${this.disabled}"> <ha-svg-icon class="warning" slot="icon" .path="${S}"></ha-svg-icon> ${this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.remove_option"),s.qy`<span class="shortcut"> <span>${$.c?s.qy`<ha-svg-icon .path="${V}"></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> `:s.s6} ${this.optionsInSidebar?s.s6:this._renderContent()} `}_renderContent(){return s.qy`<div class="${(0,r.H)({"card-content":!0,card:!this.optionsInSidebar,indent:this.optionsInSidebar,selected:this._selected,hidden:this.optionsInSidebar&&this._collapsed})}"> ${this.option?s.qy` <h4 class="top"> ${this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.conditions")}: </h4> <ha-automation-condition .conditions="${(0,l.e)(this.option.conditions)}" .disabled="${this.disabled}" .hass="${this.hass}" .narrow="${this.narrow}" @value-changed="${this._conditionChanged}" .optionsInSidebar="${this.optionsInSidebar}"></ha-automation-condition> `:s.s6} <h4 class="${this.option?"":"top"}"> ${this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.sequence")}: </h4> <ha-automation-action .actions="${this.option?(0,l.e)(this.option.sequence)||[]:this.defaultActions&&(0,l.e)(this.defaultActions)||[]}" .disabled="${this.disabled}" .hass="${this.hass}" .narrow="${this.narrow}" @value-changed="${this._actionChanged}" .optionsInSidebar="${this.optionsInSidebar}"></ha-automation-action> </div>`}render(){return this.option||this.defaultActions?s.qy` <ha-card outlined class="${this._selected?"selected":""}"> ${this.optionsInSidebar?s.qy`<ha-automation-row left-chevron .collapsed="${this._collapsed}" .selected="${this._selected}" .sortSelected="${this.sortSelected}" @click="${this._toggleSidebar}" @toggle-collapsed="${this._toggleCollapse}" @delete-row="${this._removeOption}">${this._renderRow()}</ha-automation-row>`:s.qy` <ha-expansion-panel left-chevron @expanded-changed="${this._expandedChanged}" id="option"> ${this._renderRow()} </ha-expansion-panel> `} </ha-card> ${this.optionsInSidebar?this._renderContent():s.s6} `:s.s6}_moveUp(){(0,c.r)(this,"move-up")}_moveDown(){(0,c.r)(this,"move-down")}_handleDropdownSelect(t){t.stopPropagation();const e=t.detail?.item?.value;if(e)switch(e){case"rename":this._renameOption();break;case"edit_note":this._editNoteOption();break;case"delete":this._removeOption();break;case"duplicate":this._duplicateOption();break;case"move_up":this._moveUp();break;case"move_down":this._moveDown()}}_conditionChanged(t){t.stopPropagation();const e=t.detail.value,i={...this.option,conditions:e};(0,c.r)(this,"value-changed",{value:i})}_actionChanged(t){if(this.defaultActions)return;t.stopPropagation();const e=t.detail.value,i={...this.option,sequence:e};(0,c.r)(this,"value-changed",{value:i})}_toggleSidebar(t){t?.stopPropagation(),this._selected?(0,c.r)(this,"request-close-sidebar"):this.openSidebar()}openSidebar(t){const e=t??this.option;(0,c.r)(this,"open-sidebar",{close:t=>{this._selected=!1,(0,c.r)(this,"close-sidebar"),t&&this.focus()},rename:()=>{this._renameOption()},editNote:this._editNoteOption,delete:this._removeOption,duplicate:this._duplicateOption,defaultOption:!!this.defaultActions,note:e?.note}),this._selected=!0,this._collapsed=!1,this.narrow&&window.setTimeout(()=>{this.scrollIntoView({block:"start",behavior:"smooth"})},180)}expand(){this.optionsInSidebar?this._collapsed=!1:this.updateComplete.then(()=>{this.shadowRoot.querySelector("ha-expansion-panel").expanded=!0})}collapse(){this._collapsed=!0}expandAll(){this.expand(),this._conditionElement?.expandAll(),this._actionElement?.expandAll()}collapseAll(){this.collapse(),this._conditionElement?.collapseAll(),this._actionElement?.collapseAll()}_toggleCollapse(){this._collapsed=!this._collapsed}focus(){this._automationRowElement?.focus()}static get styles(){return[A.bH,A.yj,A.Lt,A.aM,s.AH`h4{color:var(--ha-color-text-secondary)}h4{margin-bottom:8px}h4.top{margin-top:0}`]}constructor(...t){super(...t),this.narrow=!1,this.disabled=!1,this.first=!1,this.last=!1,this.optionsInSidebar=!1,this.sortSelected=!1,this._expanded=!1,this._selected=!1,this._collapsed=!0,this._entityReg=[],this._duplicateOption=()=>{(0,c.r)(this,"duplicate")},this._removeOption=()=>{this.option&&((0,c.r)(this,"value-changed",{value:null}),this._selected&&(0,c.r)(this,"close-sidebar"),(0,C.c)(this,{message:this.hass.localize("ui.common.successfully_deleted"),duration:4e3,action:{text:this.hass.localize("ui.common.undo"),action:()=>{(0,c.r)(window,"undo-change")}}}))},this._renameOption=async()=>{const t=await(0,y.an)(this,{title:this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.change_alias"),inputLabel:this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.alias"),inputType:"string",placeholder:(0,p.Z)(this._getDescription()),defaultValue:this.option.alias,confirmText:this.hass.localize("ui.common.submit")});if(null!==t){const e={...this.option};""===t?delete e.alias:e.alias=t,(0,c.r)(this,"value-changed",{value:e})}},this._editNoteOption=async()=>{if(!this.option)return;const t=await(0,y.an)(this,{title:this.hass.localize("ui.panel.config.automation.editor.note."+(this.option.note?"edit":"add")),inputLabel:this.hass.localize("ui.panel.config.automation.editor.note.label"),inputType:"string",defaultValue:this.option.note,confirmText:this.hass.localize("ui.common.submit"),multiline:!0});if(null!==t){const e={...this.option};""===t?delete e.note:e.note=t,(0,c.r)(this,"value-changed",{value:e}),this._selected&&this.openSidebar(e)}}}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],E.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],E.prototype,"option",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],E.prototype,"defaultActions",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],E.prototype,"narrow",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],E.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({type:Number})],E.prototype,"index",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],E.prototype,"first",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],E.prototype,"last",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"sidebar"})],E.prototype,"optionsInSidebar",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"sort-selected"})],E.prototype,"sortSelected",void 0),(0,o.Cg)([(0,n.wk)()],E.prototype,"_expanded",void 0),(0,o.Cg)([(0,n.wk)()],E.prototype,"_selected",void 0),(0,o.Cg)([(0,n.wk)()],E.prototype,"_collapsed",void 0),(0,o.Cg)([(0,n.wk)(),(0,a.Fg)({context:b.ih,subscribe:!0})],E.prototype,"_entityReg",void 0),(0,o.Cg)([(0,n.P)("ha-automation-condition")],E.prototype,"_conditionElement",void 0),(0,o.Cg)([(0,n.P)("ha-automation-action")],E.prototype,"_actionElement",void 0),(0,o.Cg)([(0,n.P)("ha-automation-row")],E.prototype,"_automationRowElement",void 0),E=(0,o.Cg)([(0,n.EM)("ha-automation-option-row")],E),e()}catch(t){e(t)}})},83307(t,e,i){i.a(t,async function(t,e){try{i(18111),i(7588);var o=i(62826),a=i(5124),s=i(22441),n=i(75751),r=i(1087),l=i(57237),c=i(18350),h=(i(85938),i(67094),i(41175)),d=i(57116),p=i(6650),u=t([c,p]);[c,p]=u.then?(await u)():u;const g="M21 11H3V9H21V11M21 13H3V15H21V13Z",v="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class m extends((0,h.j)(a.WF)){get items(){return this.options}set items(t){this.options=t}render(){return a.qy` <ha-sortable handle-selector=".handle" draggable-selector="ha-automation-option-row" .disabled="${this.disabled}" group="options" 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.options,t=>this.getKey(t),(t,e)=>a.qy` <ha-automation-option-row .sortableData="${t}" .index="${e}" .first="${0===e}" .last="${e===this.options.length-1}" .option="${t}" .narrow="${this.narrow}" .disabled="${this.disabled}" @duplicate="${this.duplicateItem}" @move-down="${this.moveDown}" @move-up="${this.moveUp}" @value-changed="${this.itemChanged}" .hass="${this.hass}" .optionsInSidebar="${this.optionsInSidebar}" .sortSelected="${this.rowSortSelected===e}" @stop-sort-selection="${this.stopSortSelection}"> ${this.disabled?a.s6:a.qy` <div tabindex="0" class="handle ${this.rowSortSelected===e?"active":""}" slot="icons" @keydown="${this.handleDragKeydown}" @click="${l.d}" .index="${e}"> <ha-svg-icon .path="${g}"></ha-svg-icon> </div> `} </ha-automation-option-row> `)} <div class="buttons"> <ha-button appearance="filled" size="small" .disabled="${this.disabled}" @click="${this._addOption}"> <ha-svg-icon .path="${v}" slot="start"></ha-svg-icon> ${this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.add_option")} </ha-button> ${this.showDefaultActions?a.s6:a.qy`<ha-button appearance="plain" size="small" .disabled="${this.disabled}" @click="${this._showDefaultActions}"> <ha-svg-icon .path="${v}" slot="start"></ha-svg-icon> ${this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.add_default")} </ha-button>`} </div> </div> </ha-sortable> `}updated(t){if(super.updated(t),t.has("options")&&(this.focusLastItemOnChange||void 0!==this.focusItemIndexOnChange)){const t=this.focusLastItemOnChange?"new":"moved",e=this.shadowRoot.querySelector("ha-automation-option-row:"+("new"===t?"last-of-type":`nth-of-type(${this.focusItemIndexOnChange+1})`));this.focusLastItemOnChange=!1,this.focusItemIndexOnChange=void 0,e.updateComplete.then(()=>{this.narrow&&e.scrollIntoView({block:"start",behavior:"smooth"}),"new"===t&&e.expand(),this.optionsInSidebar?e.openSidebar():e.focus()})}}expandAll(){this._optionRowElements?.forEach(t=>t.expandAll())}collapseAll(){this._optionRowElements?.forEach(t=>t.collapseAll())}constructor(...t){super(...t),this.showDefaultActions=!1,this._addOption=()=>{const t=this.options.concat({conditions:[],sequence:[]});this.focusLastItemOnChange=!0,(0,r.r)(this,"value-changed",{value:t})},this._showDefaultActions=()=>{(0,r.r)(this,"show-default-actions")}}}m.styles=[d.Ju,a.AH`:host([root]) .rows{padding-inline-end:8px}`],(0,o.Cg)([(0,s.MZ)({attribute:!1})],m.prototype,"options",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,attribute:"show-default"})],m.prototype,"showDefaultActions",void 0),(0,o.Cg)([(0,s.YG)("ha-automation-option-row")],m.prototype,"_optionRowElements",void 0),m=(0,o.Cg)([(0,s.EM)("ha-automation-option")],m),e()}catch(t){e(t)}})}};