UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

1 lines 79.4 kB
export const __webpack_ids__=["7193"];export const __webpack_modules__={54e3:function(e,t,i){i.d(t,{J:()=>s,_:()=>n});i(9359),i(52924);const a=/{%|{{/,s=e=>a.test(e),n=e=>{if(!e)return!1;if("string"==typeof e)return s(e);if("object"==typeof e){return(Array.isArray(e)?e:Object.values(e)).some((e=>e&&n(e)))}return!1}},48103:function(e,t,i){var a=i(44249),s=i(72621),n=i(57243),o=i(93958),r=i(97536),d=i(46289),l=i(15093),u=i(36522);(0,a.Z)([(0,l.Mo)("ha-check-list-item")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"method",key:"onChange",value:async function(e){(0,s.Z)(i,"onChange",this,3)([e]),(0,u.B)(this,e.type)}},{kind:"field",static:!0,key:"styles",value:()=>[d.W,r.W,n.iv`:host{--mdc-theme-secondary:var(--primary-color)}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic,:host([graphic=control]) .mdc-deprecated-list-item__graphic,:host([graphic=large]) .mdc-deprecated-list-item__graphic,:host([graphic=medium]) .mdc-deprecated-list-item__graphic{margin-inline-end:var(--mdc-list-item-graphic-margin,16px);margin-inline-start:0px;direction:var(--direction)}.mdc-deprecated-list-item__meta{flex-shrink:0;direction:var(--direction);margin-inline-start:auto;margin-inline-end:0}.mdc-deprecated-list-item__graphic{margin-top:var(--check-list-item-graphic-margin-top)}:host([graphic=icon]) .mdc-deprecated-list-item__graphic{margin-inline-start:0;margin-inline-end:var(--mdc-list-item-graphic-margin,32px)}`]}]}}),o.F)},7520:function(e,t,i){i.d(t,{x:()=>a});i(9359),i(31526);const a=e=>{const t={};return e.forEach((e=>{if(void 0!==e.description?.suggested_value&&null!==e.description?.suggested_value)t[e.name]=e.description.suggested_value;else if("default"in e)t[e.name]=e.default;else if("expandable"===e.type){const i=a(e.schema);(e.required||Object.keys(i).length)&&(t[e.name]=i)}else if(e.required){if("boolean"===e.type)t[e.name]=!1;else if("string"===e.type)t[e.name]="";else if("integer"===e.type)t[e.name]="valueMin"in e?e.valueMin:0;else if("constant"===e.type)t[e.name]=e.value;else if("float"===e.type)t[e.name]=0;else if("select"===e.type){if(e.options.length){const i=e.options[0];t[e.name]=Array.isArray(i)?i[0]:i}}else if("positive_time_period_dict"===e.type)t[e.name]={hours:0,minutes:0,seconds:0};else if("selector"in e){const i=e.selector;if("device"in i)t[e.name]=i.device?.multiple?[]:"";else if("entity"in i)t[e.name]=i.entity?.multiple?[]:"";else if("area"in i)t[e.name]=i.area?.multiple?[]:"";else if("label"in i)t[e.name]=i.label?.multiple?[]:"";else if("boolean"in i)t[e.name]=!1;else if("addon"in i||"attribute"in i||"file"in i||"icon"in i||"template"in i||"text"in i||"theme"in i||"object"in i)t[e.name]="";else if("number"in i)t[e.name]=i.number?.min??0;else if("select"in i){if(i.select?.options.length){const a=i.select.options[0],s="string"==typeof a?a:a.value;t[e.name]=i.select.multiple?[s]:s}}else if("country"in i)i.country?.countries?.length&&(t[e.name]=i.country.countries[0]);else if("language"in i)i.language?.languages?.length&&(t[e.name]=i.language.languages[0]);else if("duration"in i)t[e.name]={hours:0,minutes:0,seconds:0};else if("time"in i)t[e.name]="00:00:00";else if("date"in i||"datetime"in i){const i=(new Date).toISOString().slice(0,10);t[e.name]=`${i}T00:00:00`}else if("color_rgb"in i)t[e.name]=[0,0,0];else if("color_temp"in i)t[e.name]=i.color_temp?.min_mireds??153;else if("action"in i||"trigger"in i||"condition"in i)t[e.name]=[];else{if(!("media"in i)&&!("target"in i))throw new Error(`Selector ${Object.keys(i)[0]} not supported in initial form data`);t[e.name]={}}}}else;})),t}},55486:function(e,t,i){var a=i(44249),s=i(4918),n=i(6394),o=i(57243),r=i(15093),d=i(35359),l=i(36522);(0,a.Z)([(0,r.Mo)("ha-formfield")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,r.Cb)({type:Boolean,reflect:!0})],key:"disabled",value:()=>!1},{kind:"method",key:"render",value:function(){const e={"mdc-form-field--align-end":this.alignEnd,"mdc-form-field--space-between":this.spaceBetween,"mdc-form-field--nowrap":this.nowrap};return o.dy` <div class="mdc-form-field ${(0,d.$)(e)}"> <slot></slot> <label class="mdc-label" @click="${this._labelClick}"> <slot name="label">${this.label}</slot> </label> </div>`}},{kind:"method",key:"_labelClick",value:function(){const e=this.input;if(e&&(e.focus(),!e.disabled))switch(e.tagName){case"HA-CHECKBOX":e.checked=!e.checked,(0,l.B)(e,"change");break;case"HA-RADIO":e.checked=!0,(0,l.B)(e,"change");break;default:e.click()}}},{kind:"field",static:!0,key:"styles",value:()=>[n.W,o.iv`:host(:not([alignEnd])) ::slotted(ha-switch){margin-right:10px;margin-inline-end:10px;margin-inline-start:inline}.mdc-form-field{align-items:var(--ha-formfield-align-items,center);gap:4px}.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)}`]}]}}),s.a)},22655:function(e,t,i){var a=i(44249),s=i(72621),n=(i(9359),i(56475),i(1331),i(70104),i(57243)),o=i(15093),r=i(11722),d=i(27486),l=i(36522),u=i(4242),c=(i(23334),i(87319),i(1416));i(92824),i(45801),i(7285);let h=(0,a.Z)(null,(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"noUserLabel",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"value",value:()=>""},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"users",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",key:"_sortedUsers",value(){return(0,d.Z)((e=>e?e.filter((e=>!e.system_generated)).sort(((e,t)=>(0,c.$K)(e.name,t.name,this.hass.locale.language))):[]))}},{kind:"method",key:"render",value:function(){return n.dy` <ha-select .label="${this.label}" .disabled="${this.disabled}" .value="${this.value}" @selected="${this._userChanged}"> ${0===this.users?.length?n.dy`<mwc-list-item value=""> ${this.noUserLabel||this.hass?.localize("ui.components.user-picker.no_user")} </mwc-list-item>`:""} ${this._sortedUsers(this.users).map((e=>n.dy` <ha-list-item graphic="avatar" .value="${e.id}"> <ha-user-badge .hass="${this.hass}" .user="${e}" slot="graphic"></ha-user-badge> ${e.name} </ha-list-item> `))} </ha-select> `}},{kind:"method",key:"firstUpdated",value:function(e){(0,s.Z)(i,"firstUpdated",this,3)([e]),void 0===this.users&&(0,u.uh)(this.hass).then((e=>{this.users=e}))}},{kind:"method",key:"_userChanged",value:function(e){const t=e.target.value;t!==this.value&&(this.value=t,setTimeout((()=>{(0,l.B)(this,"value-changed",{value:t}),(0,l.B)(this,"change")}),0))}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`:host{display:inline-block}mwc-list{display:block}`}]}}),n.oi);customElements.define("ha-user-picker",h);(0,a.Z)([(0,o.Mo)("ha-users-picker")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"value",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:"picked-user-label"})],key:"pickedUserLabel",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:"pick-user-label"})],key:"pickUserLabel",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"users",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"method",key:"firstUpdated",value:function(e){(0,s.Z)(i,"firstUpdated",this,3)([e]),void 0===this.users&&(0,u.uh)(this.hass).then((e=>{this.users=e}))}},{kind:"method",key:"render",value:function(){if(!this.hass||!this.users)return n.Ld;const e=this._notSelectedUsers(this.users,this.value);return n.dy` ${(0,r.l)([e],(()=>this.value?.map(((t,i)=>n.dy` <div> <ha-user-picker .label="${this.pickedUserLabel}" .noUserLabel="${this.hass.localize("ui.components.user-picker.remove_user")}" .index="${i}" .hass="${this.hass}" .value="${t}" .users="${this._notSelectedUsersAndSelected(t,this.users,e)}" .disabled="${this.disabled}" @value-changed="${this._userChanged}"></ha-user-picker> <ha-icon-button .userId="${t}" .label="${this.hass.localize("ui.components.user-picker.remove_user")}" .path="${"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"}" @click="${this._removeUser}"> ></ha-icon-button> </div> `))))} <ha-user-picker .label="${this.pickUserLabel||this.hass.localize("ui.components.user-picker.add_user")}" .hass="${this.hass}" .users="${e}" .disabled="${this.disabled||!e?.length}" @value-changed="${this._addUser}"></ha-user-picker> `}},{kind:"field",key:"_notSelectedUsers",value:()=>(0,d.Z)(((e,t)=>t?e?.filter((e=>!e.system_generated&&!t.includes(e.id))):e?.filter((e=>!e.system_generated))))},{kind:"field",key:"_notSelectedUsersAndSelected",value:()=>(e,t,i)=>{const a=t?.find((t=>t.id===e));return a?i?[...i,a]:[a]:i}},{kind:"get",key:"_currentUsers",value:function(){return this.value||[]}},{kind:"method",key:"_updateUsers",value:async function(e){this.value=e,(0,l.B)(this,"value-changed",{value:e})}},{kind:"method",key:"_userChanged",value:function(e){e.stopPropagation();const t=e.currentTarget.index,i=e.detail.value,a=[...this._currentUsers];""===i?a.splice(t,1):a.splice(t,1,i),this._updateUsers(a)}},{kind:"method",key:"_addUser",value:async function(e){e.stopPropagation();const t=e.detail.value;if(e.currentTarget.value="",!t)return;const i=this._currentUsers;i.includes(t)||this._updateUsers([...i,t])}},{kind:"method",key:"_removeUser",value:function(e){const t=e.currentTarget.userId;this._updateUsers(this._currentUsers.filter((e=>e!==t)))}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`:host{display:block}div{display:flex;align-items:center}`}]}}),n.oi)},44643:function(e,t,i){i.d(t,{$3:()=>s,AM:()=>a,Lp:()=>o,Pn:()=>r,ln:()=>n});const a="tag_scanned",s=async e=>e.callWS({type:"tag/list"}),n=async(e,t,i)=>e.callWS({type:"tag/create",tag_id:i,...t}),o=async(e,t,i)=>e.callWS({...i,type:"tag/update",tag_id:t}),r=async(e,t)=>e.callWS({type:"tag/delete",tag_id:t})},4242:function(e,t,i){i.d(t,{CE:()=>s,FH:()=>m,Nq:()=>r,Pb:()=>a,fm:()=>l,h8:()=>d,r4:()=>o,uh:()=>n});i(92745),i(9359),i(70104);const a="system-admin",s="system-users",n=async e=>e.callWS({type:"config/auth/list"}),o=async(e,t,i,a)=>e.callWS({type:"config/auth/create",name:t,group_ids:i,local_only:a}),r=async(e,t,i)=>e.callWS({...i,type:"config/auth/update",user_id:t}),d=async(e,t)=>e.callWS({type:"config/auth/delete",user_id:t}),l=e=>e?e.trim().split(" ").slice(0,3).map((e=>e.substring(0,1))).join(""):"?",u=99387==i.j?"M12 2C6.47 2 2 6.5 2 12C2 17.5 6.5 22 12 22S22 17.5 22 12 17.5 2 12 2M12 20C7.58 20 4 16.42 4 12C4 7.58 7.58 4 12 4S20 7.58 20 12C20 16.42 16.42 20 12 20M8 14L7 8L10 10L12 7L14 10L17 8L16 14H8M8.56 16C8.22 16 8 15.78 8 15.44V15H16V15.44C16 15.78 15.78 16 15.44 16H8.56Z":null,c=99387==i.j?"M11,7H15V9H11V11H13A2,2 0 0,1 15,13V15A2,2 0 0,1 13,17H9V15H13V13H11A2,2 0 0,1 9,11V9A2,2 0 0,1 11,7M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z":null,h=99387==i.j?"M12 20C7.6 20 4 16.4 4 12S7.6 4 12 4 20 7.6 20 12 16.4 20 12 20M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M11 14H13V17H16V12H18L12 7L6 12H8V17H11V14":null,g=99387==i.j?"M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22 2 17.5 2 12 6.5 2 12 2M12 4C10.1 4 8.4 4.6 7.1 5.7L18.3 16.9C19.3 15.5 20 13.8 20 12C20 7.6 16.4 4 12 4M16.9 18.3L5.7 7.1C4.6 8.4 4 10.1 4 12C4 16.4 7.6 20 12 20C13.9 20 15.6 19.4 16.9 18.3Z":null,m=(e,t,i)=>{const a=[],s=t=>e.localize(`ui.panel.config.users.${t}`);return t.is_owner&&a.push([u,s("is_owner")]),i&&t.system_generated&&a.push([c,s("is_system")]),t.local_only&&a.push([h,s("is_local")]),t.is_active||a.push([g,s("is_not_active")]),a}},58587:function(e,t,i){i.a(e,(async function(e,a){try{i.d(t,{a:()=>O});var s=i(44249),n=i(72621),o=(i(9359),i(70104),i(60738)),r=i(57243),d=i(15093),l=i(35359),u=i(68958),c=i(29567),h=i(36522),g=i(88128),m=i(49976),p=i(87733),v=i(41680),f=i(22381),_=(i(99426),i(64780),i(7843),i(51868),i(54977),i(41307),i(23334),i(83166),i(7285),i(14473)),y=i(17551),k=i(47805),b=i(30635),$=i(60900),C=i(76131),x=i(28008),w=(i(4593),i(93698),i(31944),i(88070)),L=(i(5205),i(79154),i(98073)),A=(i(90504),i(91964),i(33170),i(75071),i(27470),i(75308),i(6606),i(97318),i(77696),i(96487)),M=i(46307),z=e([w,L,A,M,y]);[w,L,A,M,y]=z.then?(await z)():z;const H="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",V="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",B="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",U="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",Z="M11,17H4A2,2 0 0,1 2,15V3A2,2 0 0,1 4,1H16V3H4V15H11V13L15,16L11,19V17M19,21V7H8V13H6V7A2,2 0 0,1 8,5H19A2,2 0 0,1 21,7V21A2,2 0 0,1 19,23H8A2,2 0 0,1 6,21V19H8V21H19Z",T="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",S="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",I="M10 7V9H9V15H10V17H6V15H7V9H6V7H10M16 7C17.11 7 18 7.9 18 9V15C18 16.11 17.11 17 16 17H12V7M16 9H14V15H16V9Z",E="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",P="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",F="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",q="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",O=(e,t)=>{t.stopPropagation();const i=t.currentTarget?.name;if(!i)return;const a=t.detail?.value||t.currentTarget?.value;if((e.trigger[i]||"")===a)return;let s;void 0===a||""===a?(s={...e.trigger},delete s[i]):s={...e.trigger,[i]:a},(0,h.B)(e,"value-changed",{value:s})};(0,s.Z)([(0,d.Mo)("ha-automation-trigger-row")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"trigger",value:void 0},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"first",value:void 0},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"last",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_warnings",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_yamlMode",value:()=>!1},{kind:"field",decorators:[(0,d.SB)()],key:"_requestShowId",value:()=>!1},{kind:"field",decorators:[(0,d.SB)()],key:"_triggered",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_triggerColor",value:()=>!1},{kind:"field",decorators:[(0,d.IO)("ha-yaml-editor")],key:"_yamlEditor",value:void 0},{kind:"field",decorators:[(0,u.t)({key:"automationClipboard",state:!1,subscribe:!0,storage:"sessionStorage"})],key:"_clipboard",value:void 0},{kind:"field",decorators:[(0,d.SB)(),(0,o.F_)({context:b.we,subscribe:!0})],key:"_entityReg",value:void 0},{kind:"field",key:"_triggerUnsub",value:void 0},{kind:"method",key:"render",value:function(){if(!this.trigger)return r.Ld;const e=(0,$.j2)(this.trigger)?"list":this.trigger.trigger,t=void 0!==customElements.get(`ha-automation-trigger-${e}`),i=this._yamlMode||!t,a="id"in this.trigger||this._requestShowId;return r.dy` <ha-card outlined> ${"enabled"in this.trigger&&!1===this.trigger.enabled?r.dy` <div class="disabled-bar"> ${this.hass.localize("ui.panel.config.automation.editor.actions.disabled")} </div> `:r.Ld} <ha-expansion-panel left-chevron> <ha-svg-icon slot="leading-icon" class="trigger-icon" .path="${$.uW[e]}"></ha-svg-icon> <h3 slot="header"> ${(0,y.R)(this.trigger,this.hass,this._entityReg)} </h3> <slot name="icons" slot="icons"></slot> <ha-md-button-menu slot="icons" @click="${g.P}" @keydown="${m.U}" @closed="${m.U}" positioning="fixed"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.common.menu")}" .path="${S}"></ha-icon-button> <ha-md-menu-item .clickAction="${this._renameTrigger}" .disabled="${this.disabled||"list"===e}"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.rename")} <ha-svg-icon slot="start" .path="${F}"></ha-svg-icon> </ha-md-menu-item> <ha-md-menu-item .clickAction="${this._showTriggerId}" .disabled="${this.disabled||"list"===e}"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.edit_id")} <ha-svg-icon slot="start" .path="${I}"></ha-svg-icon> </ha-md-menu-item> <ha-md-divider role="separator" tabindex="-1"></ha-md-divider> <ha-md-menu-item .clickAction="${this._duplicateTrigger}" .disabled="${this.disabled}"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.duplicate")} <ha-svg-icon slot="start" .path="${Z}"></ha-svg-icon> </ha-md-menu-item> <ha-md-menu-item .clickAction="${this._copyTrigger}" .disabled="${this.disabled}"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.copy")} <ha-svg-icon slot="start" .path="${B}"></ha-svg-icon> </ha-md-menu-item> <ha-md-menu-item .clickAction="${this._cutTrigger}" .disabled="${this.disabled}"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.cut")} <ha-svg-icon slot="start" .path="${U}"></ha-svg-icon> </ha-md-menu-item> <ha-md-menu-item .clickAction="${this._moveUp}" .disabled="${this.disabled||this.first}"> ${this.hass.localize("ui.panel.config.automation.editor.move_up")} <ha-svg-icon slot="start" .path="${V}"></ha-svg-icon></ha-md-menu-item> <ha-md-menu-item .clickAction="${this._moveDown}" .disabled="${this.disabled||this.last}"> ${this.hass.localize("ui.panel.config.automation.editor.move_down")} <ha-svg-icon slot="start" .path="${H}"></ha-svg-icon></ha-md-menu-item> <ha-md-menu-item .clickAction="${this._toggleYamlMode}" .disabled="${!t}"> ${this.hass.localize("ui.panel.config.automation.editor.edit_"+(i?"ui":"yaml"))} <ha-svg-icon slot="start" .path="${P}"></ha-svg-icon> </ha-md-menu-item> <ha-md-divider role="separator" tabindex="-1"></ha-md-divider> <ha-md-menu-item .clickAction="${this._onDisable}" .disabled="${this.disabled||"list"===e}"> ${"enabled"in this.trigger&&!1===this.trigger.enabled?this.hass.localize("ui.panel.config.automation.editor.actions.enable"):this.hass.localize("ui.panel.config.automation.editor.actions.disable")} <ha-svg-icon slot="start" .path="${"enabled"in this.trigger&&!1===this.trigger.enabled?E:q}"></ha-svg-icon> </ha-md-menu-item> <ha-md-menu-item .clickAction="${this._onDelete}" class="warning" .disabled="${this.disabled}"> ${this.hass.localize("ui.panel.config.automation.editor.actions.delete")} <ha-svg-icon class="warning" slot="start" .path="${T}"></ha-svg-icon> </ha-md-menu-item> </ha-md-button-menu> <div class="${(0,l.$)({"card-content":!0,disabled:"enabled"in this.trigger&&!1===this.trigger.enabled})}"> ${this._warnings?r.dy`<ha-alert alert-type="warning" .title="${this.hass.localize("ui.errors.config.editor_not_supported")}"> ${this._warnings.length&&void 0!==this._warnings[0]?r.dy` <ul> ${this._warnings.map((e=>r.dy`<li>${e}</li>`))} </ul>`:""} ${this.hass.localize("ui.errors.config.edit_in_yaml_supported")} </ha-alert>`:""} ${i?r.dy` ${t?"":r.dy` ${this.hass.localize("ui.panel.config.automation.editor.triggers.unsupported_platform",{platform:e})} `} <ha-yaml-editor .hass="${this.hass}" .defaultValue="${this.trigger}" .readOnly="${this.disabled}" @value-changed="${this._onYamlChange}"></ha-yaml-editor> `:r.dy` ${a&&!(0,$.j2)(this.trigger)?r.dy` <ha-textfield .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.id")}" .value="${this.trigger.id||""}" .disabled="${this.disabled}" @change="${this._idChanged}"> </ha-textfield> `:""} <div @ui-mode-not-available="${this._handleUiModeNotAvailable}" @value-changed="${this._onUiChanged}"> ${(0,c.h)(`ha-automation-trigger-${e}`,{hass:this.hass,trigger:this.trigger,disabled:this.disabled})} </div> `} </div> </ha-expansion-panel> <div class="triggered ${(0,l.$)({active:void 0!==this._triggered,accent:this._triggerColor})}" @click="${this._showTriggeredInfo}"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.triggered")} </div> </ha-card> `}},{kind:"method",key:"updated",value:function(e){(0,n.Z)(i,"updated",this,3)([e]),e.has("trigger")&&this._subscribeTrigger()}},{kind:"method",key:"connectedCallback",value:function(){(0,n.Z)(i,"connectedCallback",this,3)([]),this.hasUpdated&&this.trigger&&this._subscribeTrigger()}},{kind:"method",key:"disconnectedCallback",value:function(){(0,n.Z)(i,"disconnectedCallback",this,3)([]),this._triggerUnsub&&(this._triggerUnsub.then((e=>e())),this._triggerUnsub=void 0),this._doSubscribeTrigger.cancel()}},{kind:"method",key:"_subscribeTrigger",value:function(){this._triggerUnsub&&(this._triggerUnsub.then((e=>e())),this._triggerUnsub=void 0),this._doSubscribeTrigger()}},{kind:"field",key:"_doSubscribeTrigger",value(){return(0,f.D)((async()=>{let e;const t=this.trigger;this._triggerUnsub&&(this._triggerUnsub.then((e=>e())),this._triggerUnsub=void 0);if(!(await(0,k.w)(this.hass,{triggers:t})).triggers.valid||this.trigger!==t)return;const i=(0,_.Xm)(this.hass,(t=>{void 0!==e?(clearTimeout(e),this._triggerColor=!this._triggerColor):this._triggerColor=!1,this._triggered=t,e=window.setTimeout((()=>{this._triggered=void 0,e=void 0}),5e3)}),t);i.catch((()=>{this._triggerUnsub===i&&(this._triggerUnsub=void 0)})),this._triggerUnsub=i}),5e3)}},{kind:"method",key:"_handleUiModeNotAvailable",value:function(e){this._warnings=(0,v.p)(this.hass,e.detail).warnings,this._yamlMode||(this._yamlMode=!0)}},{kind:"method",key:"_setClipboard",value:function(){this._clipboard={...this._clipboard,trigger:this.trigger}}},{kind:"field",key:"_onDelete",value(){return()=>{(0,C.showConfirmationDialog)(this,{title:this.hass.localize("ui.panel.config.automation.editor.triggers.delete_confirm_title"),text:this.hass.localize("ui.panel.config.automation.editor.triggers.delete_confirm_text"),dismissText:this.hass.localize("ui.common.cancel"),confirmText:this.hass.localize("ui.common.delete"),destructive:!0,confirm:()=>{(0,h.B)(this,"value-changed",{value:null})}})}}},{kind:"field",key:"_onDisable",value(){return()=>{if((0,$.j2)(this.trigger))return;const e=!(this.trigger.enabled??1),t={...this.trigger,enabled:e};(0,h.B)(this,"value-changed",{value:t}),this._yamlMode&&this._yamlEditor?.setValue(t)}}},{kind:"method",key:"_idChanged",value:function(e){if((0,$.j2)(this.trigger))return;const t=e.target.value;if(t===(this.trigger.id??""))return;this._requestShowId=!0;const i={...this.trigger};t?i.id=t:delete i.id,(0,h.B)(this,"value-changed",{value:i})}},{kind:"method",key:"_onYamlChange",value:function(e){e.stopPropagation(),e.detail.isValid&&(this._warnings=void 0,(0,h.B)(this,"value-changed",{value:(0,_.W9)(e.detail.value)}))}},{kind:"method",key:"_onUiChanged",value:function(e){if((0,$.j2)(this.trigger))return;e.stopPropagation();const t={...this.trigger.alias?{alias:this.trigger.alias}:{},...e.detail.value};(0,h.B)(this,"value-changed",{value:t})}},{kind:"method",key:"_switchUiMode",value:function(){this._warnings=void 0,this._yamlMode=!1}},{kind:"method",key:"_switchYamlMode",value:function(){this._warnings=void 0,this._yamlMode=!0}},{kind:"method",key:"_showTriggeredInfo",value:function(){(0,C.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.automation.editor.triggers.triggering_event_detail"),text:r.dy` <ha-yaml-editor read-only .hass="${this.hass}" .defaultValue="${this._triggered}"></ha-yaml-editor> `})}},{kind:"field",key:"_renameTrigger",value(){return async()=>{if((0,$.j2)(this.trigger))return;const e=await(0,C.showPromptDialog)(this,{title:this.hass.localize("ui.panel.config.automation.editor.triggers.change_alias"),inputLabel:this.hass.localize("ui.panel.config.automation.editor.triggers.alias"),inputType:"string",placeholder:(0,p.f)((0,y.R)(this.trigger,this.hass,this._entityReg,!0)),defaultValue:this.trigger.alias,confirmText:this.hass.localize("ui.common.submit")});if(null!==e){const t={...this.trigger};""===e?delete t.alias:t.alias=e,(0,h.B)(this,"value-changed",{value:t}),this._yamlMode&&this._yamlEditor?.setValue(t)}}}},{kind:"field",key:"_showTriggerId",value(){return()=>{this._requestShowId=!0,this.expand()}}},{kind:"field",key:"_duplicateTrigger",value(){return()=>{(0,h.B)(this,"duplicate")}}},{kind:"field",key:"_copyTrigger",value(){return()=>{this._setClipboard()}}},{kind:"field",key:"_cutTrigger",value(){return()=>{this._setClipboard(),(0,h.B)(this,"value-changed",{value:null})}}},{kind:"field",key:"_moveUp",value(){return()=>{(0,h.B)(this,"move-up")}}},{kind:"field",key:"_moveDown",value(){return()=>{(0,h.B)(this,"move-down")}}},{kind:"field",key:"_toggleYamlMode",value(){return()=>{this._yamlMode?this._switchUiMode():this._switchYamlMode(),this.expand()}}},{kind:"method",key:"expand",value:function(){this.updateComplete.then((()=>{this.shadowRoot.querySelector("ha-expansion-panel").expanded=!0}))}},{kind:"get",static:!0,key:"styles",value:function(){return[x.Qx,r.iv`.disabled{opacity:.5;pointer-events:none}ha-expansion-panel{--expansion-panel-summary-padding:0 0 0 8px;--expansion-panel-content-padding:0}h3{margin:0;font-size:inherit;font-weight:inherit}.trigger-icon{display:none}@media (min-width:870px){.trigger-icon{display:inline-block;color:var(--secondary-text-color);opacity:.9}}.card-content{padding:16px}.disabled-bar{background:var(--divider-color,#e0e0e0);text-align:center;border-top-right-radius:var(--ha-card-border-radius,12px);border-top-left-radius:var(--ha-card-border-radius,12px)}.triggered{cursor:pointer;position:absolute;top:0px;right:0px;left:0px;text-transform:uppercase;font-weight:700;font-size:14px;background-color:var(--primary-color);color:var(--text-primary-color);max-height:0px;overflow:hidden;transition:max-height .3s;text-align:center;border-top-right-radius:var(--ha-card-border-radius,12px);border-top-left-radius:var(--ha-card-border-radius,12px)}.triggered.active{max-height:100px}.triggered:hover{opacity:.8}.triggered.accent{background-color:var(--accent-color);color:var(--text-accent-color,var(--text-primary-color))}ha-textfield{display:block;margin-bottom:24px}ha-md-menu-item>ha-svg-icon{--mdc-icon-size:24px}`]}}]}}),r.oi);a()}catch(e){a(e)}}))},79805:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(44249),s=i(72621),n=(i(9359),i(56475),i(31526),i(12582)),o=i(57243),r=i(15093),d=i(91583),l=i(68958),u=i(36522),c=i(62201),h=i(76320),g=(i(59826),i(34273),i(62801),i(37583),i(60900)),m=i(40159),p=i(58587),v=e([p]);p=(v.then?(await v)():v)[0];const f="M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z",_="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";(0,a.Z)([(0,r.Mo)("ha-automation-trigger")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"triggers",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,r.SB)()],key:"_showReorder",value:()=>!1},{kind:"field",decorators:[(0,l.t)({key:"automationClipboard",state:!0,subscribe:!0,storage:"sessionStorage"})],key:"_clipboard",value:void 0},{kind:"field",key:"_focusLastTriggerOnChange",value:()=>!1},{kind:"field",key:"_triggerKeys",value:()=>new WeakMap},{kind:"field",key:"_unsubMql",value:void 0},{kind:"method",key:"connectedCallback",value:function(){(0,s.Z)(i,"connectedCallback",this,3)([]),this._unsubMql=(0,c.K)("(min-width: 600px)",(e=>{this._showReorder=e}))}},{kind:"method",key:"disconnectedCallback",value:function(){(0,s.Z)(i,"disconnectedCallback",this,3)([]),this._unsubMql?.(),this._unsubMql=void 0}},{kind:"method",key:"render",value:function(){return o.dy` <ha-sortable handle-selector=".handle" draggable-selector="ha-automation-trigger-row" .disabled="${!this._showReorder||this.disabled}" group="triggers" invert-swap @item-moved="${this._triggerMoved}" @item-added="${this._triggerAdded}" @item-removed="${this._triggerRemoved}"> <div class="triggers"> ${(0,d.r)(this.triggers,(e=>this._getKey(e)),((e,t)=>o.dy` <ha-automation-trigger-row .sortableData="${e}" .index="${t}" .first="${0===t}" .last="${t===this.triggers.length-1}" .trigger="${e}" @duplicate="${this._duplicateTrigger}" @move-down="${this._moveDown}" @move-up="${this._moveUp}" @value-changed="${this._triggerChanged}" .hass="${this.hass}" .disabled="${this.disabled}"> ${this._showReorder&&!this.disabled?o.dy` <div class="handle" slot="icons"> <ha-svg-icon .path="${f}"></ha-svg-icon> </div> `:o.Ld} </ha-automation-trigger-row> `))} <div class="buttons"> <ha-button outlined .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.add")}" .disabled="${this.disabled}" @click="${this._addTriggerDialog}"> <ha-svg-icon .path="${_}" slot="icon"></ha-svg-icon> </ha-button> </div> </div> </ha-sortable> `}},{kind:"method",key:"_addTriggerDialog",value:function(){(0,m._)(this,{type:"trigger",add:this._addTrigger,clipboardItem:this._clipboard?.trigger?(0,g.j2)(this._clipboard.trigger)?"list":this._clipboard?.trigger?.trigger:void 0})}},{kind:"field",key:"_addTrigger",value(){return e=>{let t;if(e===m.I)t=this.triggers.concat((0,n.Z)(this._clipboard.trigger));else{const i=e,a=customElements.get(`ha-automation-trigger-${i}`);t=this.triggers.concat({...a.defaultConfig})}this._focusLastTriggerOnChange=!0,(0,u.B)(this,"value-changed",{value:t})}}},{kind:"method",key:"updated",value:function(e){if((0,s.Z)(i,"updated",this,3)([e]),e.has("triggers")&&this._focusLastTriggerOnChange){this._focusLastTriggerOnChange=!1;const e=this.shadowRoot.querySelector("ha-automation-trigger-row:last-of-type");e.updateComplete.then((()=>{e.expand(),e.scrollIntoView(),e.focus()}))}}},{kind:"method",key:"expandAll",value:function(){this.shadowRoot.querySelectorAll("ha-automation-trigger-row").forEach((e=>{e.expand()}))}},{kind:"method",key:"_getKey",value:function(e){return this._triggerKeys.has(e)||this._triggerKeys.set(e,Math.random().toString()),this._triggerKeys.get(e)}},{kind:"method",key:"_moveUp",value:function(e){e.stopPropagation();const t=e.target.index,i=t-1;this._move(t,i)}},{kind:"method",key:"_moveDown",value:function(e){e.stopPropagation();const t=e.target.index,i=t+1;this._move(t,i)}},{kind:"method",key:"_move",value:function(e,t){const i=this.triggers.concat(),a=i.splice(e,1)[0];i.splice(t,0,a),this.triggers=i,(0,u.B)(this,"value-changed",{value:i})}},{kind:"method",key:"_triggerMoved",value:function(e){e.stopPropagation();const{oldIndex:t,newIndex:i}=e.detail;this._move(t,i)}},{kind:"method",key:"_triggerAdded",value:async function(e){e.stopPropagation();const{index:t,data:i}=e.detail,a=[...this.triggers.slice(0,t),i,...this.triggers.slice(t)];this.triggers=a,await(0,h.y)(),(0,u.B)(this,"value-changed",{value:this.triggers})}},{kind:"method",key:"_triggerRemoved",value:async function(e){e.stopPropagation();const{index:t}=e.detail,i=this.triggers[t];this.triggers=this.triggers.filter((e=>e!==i)),await(0,h.y)();const a=this.triggers.filter((e=>e!==i));(0,u.B)(this,"value-changed",{value:a})}},{kind:"method",key:"_triggerChanged",value:function(e){e.stopPropagation();const t=[...this.triggers],i=e.detail.value,a=e.target.index;if(null===i)t.splice(a,1);else{const e=this._getKey(t[a]);this._triggerKeys.set(i,e),t[a]=i}(0,u.B)(this,"value-changed",{value:t})}},{kind:"method",key:"_duplicateTrigger",value:function(e){e.stopPropagation();const t=e.target.index;(0,u.B)(this,"value-changed",{value:this.triggers.concat((0,n.Z)(this.triggers[t]))})}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`.triggers{padding:16px;margin:-16px;display:flex;flex-direction:column;gap:16px}.sortable-ghost{background:0 0;border-radius:var(--ha-card-border-radius,12px)}.sortable-drag{background:0 0}ha-automation-trigger-row{display:block;scroll-margin-top:48px}ha-svg-icon{height:20px}.handle{padding:12px;cursor:move;cursor:grab}.handle ha-svg-icon{pointer-events:none;height:24px}.buttons{display:flex;flex-wrap:wrap;gap:8px;order:1}`}]}}),o.oi);t()}catch(e){t(e)}}))},4593:function(e,t,i){var a=i(44249),s=i(57243),n=i(15093),o=i(27486),r=i(36522),d=(i(29073),i(35392));(0,a.Z)([(0,n.Mo)("ha-automation-trigger-calendar")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"trigger",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",key:"_schema",value:()=>(0,o.Z)((e=>[{name:"entity_id",required:!0,selector:{entity:{domain:"calendar"}}},{name:"event",type:"select",required:!0,options:[["start",e("ui.panel.config.automation.editor.triggers.type.calendar.start")],["end",e("ui.panel.config.automation.editor.triggers.type.calendar.end")]]},{name:"offset",required:!0,selector:{duration:{}}},{name:"offset_type",type:"select",required:!0,options:[["before",e("ui.panel.config.automation.editor.triggers.type.calendar.before")],["after",e("ui.panel.config.automation.editor.triggers.type.calendar.after")]]}]))},{kind:"get",static:!0,key:"defaultConfig",value:function(){return{trigger:"calendar",entity_id:"",event:"start",offset:"0"}}},{kind:"method",key:"render",value:function(){const e=this._schema(this.hass.localize),t=this.trigger.offset,i=(0,d.c)(t);let a="after";("object"==typeof t&&i.hours<0||"string"==typeof t&&t.startsWith("-"))&&(i.hours=Math.abs(i.hours),a="before");const n={...this.trigger,offset:i,offset_type:a};return s.dy` <ha-form .schema="${e}" .data="${n}" .hass="${this.hass}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> `}},{kind:"method",key:"_valueChanged",value:function(e){e.stopPropagation();const t=e.detail.value.offset,i="before"===e.detail.value.offset_type?"-":"",a={...e.detail.value,offset:`${i}${t.hours??0}:${t.minutes??0}:${t.seconds??0}`};delete a.offset_type,(0,r.B)(this,"value-changed",{value:a})}},{kind:"field",key:"_computeLabelCallback",value(){return e=>{switch(e.name){case"entity_id":return this.hass.localize("ui.components.entity.entity-picker.entity");case"event":return this.hass.localize("ui.panel.config.automation.editor.triggers.type.calendar.event")}return""}}}]}}),s.oi)},93698:function(e,t,i){var a=i(44249),s=(i(9359),i(70104),i(57243)),n=i(15093),o=i(95262),r=i(36522),d=(i(83166),i(23334),i(76131));const l="^[^.。,,?¿?؟!!;;::]+$";(0,a.Z)([(0,n.Mo)("ha-automation-trigger-conversation")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"trigger",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,n.IO)("#option_input",!0)],key:"_optionInput",value:void 0},{kind:"get",static:!0,key:"defaultConfig",value:function(){return{trigger:"conversation",command:""}}},{kind:"method",key:"render",value:function(){const{command:e}=this.trigger,t=e?(0,o.r)(e):[];return s.dy`${t.length?t.map(((e,t)=>s.dy` <ha-textfield class="option" iconTrailing .index="${t}" .value="${e}" .validationMessage="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.conversation.no_punctuation")}" autoValidate validateOnInitialRender pattern="${l}" @change="${this._updateOption}"> <ha-icon-button @click="${this._removeOption}" slot="trailingIcon" .path="${"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"}"></ha-icon-button> </ha-textfield> `)):s.Ld} <ha-textfield class="flex-auto" id="option_input" .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.conversation.add_sentence")}" .validationMessage="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.conversation.no_punctuation")}" autoValidate pattern="${l}" @keydown="${this._handleKeyAdd}" @change="${this._addOption}"></ha-textfield>`}},{kind:"method",key:"_handleKeyAdd",value:function(e){e.stopPropagation(),"Enter"===e.key&&this._addOption()}},{kind:"method",key:"_addOption",value:function(){const e=this._optionInput;e?.value&&((0,r.B)(this,"value-changed",{value:{...this.trigger,command:this.trigger.command.length?[...Array.isArray(this.trigger.command)?this.trigger.command:[this.trigger.command],e.value]:e.value}}),e.value="")}},{kind:"method",key:"_updateOption",value:async function(e){const t=e.target.index,i=[...Array.isArray(this.trigger.command)?this.trigger.command:[this.trigger.command]];i.splice(t,1,e.target.value),(0,r.B)(this,"value-changed",{value:{...this.trigger,command:i}})}},{kind:"method",key:"_removeOption",value:async function(e){const t=e.target.parentElement.index;if(!await(0,d.showConfirmationDialog)(this,{title:this.hass.localize("ui.panel.config.automation.editor.triggers.type.conversation.delete"),text:this.hass.localize("ui.panel.config.automation.editor.triggers.type.conversation.confirm_delete"),destructive:!0}))return;let i;Array.isArray(this.trigger.command)?(i=[...this.trigger.command],i.splice(t,1)):i="",(0,r.B)(this,"value-changed",{value:{...this.trigger,command:i}})}},{kind:"field",static:!0,key:"styles",value:()=>s.iv`.layout{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;justify-content:flex-start}.option{margin-top:4px}mwc-button{margin-left:8px;margin-inline-start:8px;margin-inline-end:initial}ha-textfield{display:block;margin-bottom:8px;--textfield-icon-trailing-padding:0}ha-textfield>ha-icon-button{position:relative;right:-8px;--mdc-icon-button-size:36px;--mdc-icon-size:20px;color:var(--secondary-text-color);inset-inline-start:initial;inset-inline-end:-8px;direction:var(--direction)}#option_input{margin-top:8px}.header{margin-top:8px;margin-bottom:8px}`}]}}),s.oi)},31944:function(e,t,i){var a=i(44249),s=(i(9359),i(31526),i(60738)),n=i(57243),o=i(15093),r=i(27486),d=i(36522),l=i(48045),u=(i(98157),i(5318)),c=i(30230);(0,a.Z)([(0,o.Mo)("ha-device-trigger-picker")],(function(e,t){return{F:class extends t{constructor(){super(u.KL,u.r3,(e=>({device_id:e||"",trigger:"device",domain:"",entity_id:""}))),e(this)}},d:[{kind:"get",key:"NO_AUTOMATION_TEXT",value:function(){return this.hass.localize("ui.panel.config.devices.automation.triggers.no_triggers")}},{kind:"get",key:"UNKNOWN_AUTOMATION_TEXT",value:function(){return this.hass.localize("ui.panel.config.devices.automation.triggers.unknown_trigger")}}]}}),c.g);i(29073);var h=i(7520),g=i(30635);(0,a.Z)([(0,o.Mo)("ha-automation-trigger-device")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Object})],key:"trigger",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,o.SB)()],key:"_deviceId",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_capabilities",value:void 0},{kind:"field",decorators:[(0,o.SB)(),(0,s.F_)({context:g.we,subscribe:!0})],key:"_entityReg",value:void 0},{kind:"field",key:"_origTrigger",value:void 0},{kind:"get",static:!0,key:"defaultConfig",value:function(){return{trigger:"device",device_id:"",domain:"",entity_id:""}}},{kind:"field",key:"_extraFieldsData",value:()=>(0,r.Z)(((e,t)=>{const i=(0,h.x)(t.extra_fields);return t.extra_fields.forEach((t=>{void 0!==e[t.name]&&(i[t.name]=e[t.name])})),i}))},{kind:"method",key:"shouldUpdate",value:function(e){return!e.has("trigger")||(!this.trigger.device_id||this.trigger.device_id in this.hass.devices||((0,d.B)(this,"ui-mode-not-available",Error(this.hass.localize("ui.panel.config.automation.editor.edit_unknown_device"))),!1))}},{kind:"method",key:"render",value:function(){const e=this._deviceId||this.trigger.device_id;return n.dy` <ha-device-picker .value="${e}" @value-changed="${this._devicePicked}" .hass="${this.hass}" .disabled="${this.disabled}" .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.device.label")}"></ha-device-picker> <ha-device-trigger-picker .value="${this.trigger}" .deviceId="${e}" @value-changed="${this._deviceTriggerPicked}" .hass="${this.hass}" .disabled="${this.disabled}" .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.device.trigger")}"></ha-device-trigger-picker> ${this._capabilities?.extra_fields?n.dy` <ha-form .hass="${this.hass}" .data="${this._extraFieldsData(this.trigger,this._capabilities)}" .schema="${this._capabilities.extra_fields}" .disabled="${this.disabled}" .computeLabel="${(0,u.kJ)(this.hass,this.trigger)}" .computeHelper="${(0,u.Md)(this.hass,this.trigger)}" @value-changed="${this._extraFieldsChanged}"></ha-form> `:""} `}},{kind:"method",key:"firstUpdated",value:function(){this._capabilities||this._getCapabilities(),this.trigger&&(this._origTrigger=this.trigger)}},{kind:"method",key:"updated",value:function(e){if(!e.has("trigger"))return;const t=e.get("trigger");t&&!(0,u.hH)(this._entityReg,t,this.trigger)&&this._getCapabilities()}},{kind:"method",key:"_getCapabilities",value:async function(){const e=this.trigger;if(this._capabilities=e.domain?await(0,u.hA)(this.hass,e):void 0,this._capabilities){const e={...this.trigger,...this._extraFieldsData(this.trigger,this._capabilities)};(0,l.v)(this.trigger,e)||(0,d.B)(this,"value-changed",{value:e})}}},{kind:"method",key:"_devicePicked",value:function(e){e.stopPropagation(),this._deviceId=e.target.value,void 0===this._deviceId&&(0,d.B)(this,"value-changed",{value:{...i.defaultConfig,trigger:"device"}})}},{kind:"method",key:"_deviceTriggerPicked",value:function(e){e.stopPropagation();let t=e.detail.value;this._origTrigger&&(0,u.hH)(this._entityReg,this._origTrigger,t)&&(t=this._origTrigger),this.trigger.id&&(t.id=this.trigger.id),(0,d.B)(this,"value-changed",{value:t})}},{kind:"method",key:"_extraFieldsChanged",value:function(e){e.stopPropagation(),(0,d.B)(this,"value-changed",{value:{...this.trigger,...e.detail.value}})}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`ha-device-picker{display:block;margin-bottom:24px}ha-form{display:block;margin-top:24px}`}]}}),n.oi)},88070:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(44249),s=i(57243),n=i(15093),o=i(36522),r=(i(83166),i(64889),i(22655),i(58587)),d=e([r]);r=(d.then?(await d)():d)[0];(0,a.Z)([(0,n.Mo)("ha-automation-trigger-event")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"trigger",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"get",static:!0,key:"defaultConfig",value:function(){return{trigger:"event",event_type:""}}},{kind:"method",key:"render",value:function(){const{event_type:e,event_data:t,context:i}=this.trigger;return s.dy` <ha-textfield .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.event.event_type")}" name="event_type" .value="${e}" .disabled="${this.disabled}" @change="${this._valueChanged}"></ha-textfield> <ha-yaml-editor .hass="${this.hass}" .label="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.event.event_data")}" .name="${"event_data"}" .readOnly="${this.disabled}" .defaultValue="${t}" @value-changed="${this._dataChanged}"></ha-yaml-editor> <br> ${this.hass.localize("ui.panel.config.automation.editor.triggers.type.event.context_users")} <ha-users-picker .pickedUserLabel="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.event.context_user_picked")}" .pickUserLabel="${this.hass.localize("ui.panel.config.automation.editor.triggers.type.event.context_user_pick")}" .hass="${this.hass}" .disabled="${this.disabled}" .value="${this._wrapUsersInArray(i?.user_id)}" @value-changed="${this._usersChanged}"></ha-users-picker> `}},{kind:"method",key:"_wrapUsersInArray",value:function(e){return e?"string"==typeof e?[e]:e:[]}},{kind:"method",key:"_valueChanged",value:function(e){e.stopPropagation(),(0,r.a)(this,e)}},{kind:"method",key:"_dataChanged",value:function(e){e.stopPropagation(),e.detail.isValid&&(0,r.a)(this,e)}},{kind:"method",key:"_usersChanged",value:function(e){e.stopPropagation();const t={...this.trigger};!e.detail.value.length&&t.context?delete t.context.user_id:(t.context||(t.context={}),t.context.user_id=e.detail.value),(0,o.B)(this,"value-changed",{value:t})}},{kind:"field",static:!0,key:"styles",value:()=>s.iv`ha-textfield{display:block}`}]}}),s.oi);t()}catch(e){t(e)}}))},5205:function(e,t,i){var a=i(44249),s=(i(29073),i(57243)),n=i(15093),o=i(27486),r=i(36522);(0,a.Z)([(0,n.Mo)("ha-automation-trigger-geo_location")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"trigger",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",key:"_schema",value:()=>(0,o.Z)((e=>[{name:"source",selector:{text:{}}},{name:"zone",selector:{entity:{domain:"zone"}}},{name:"event",type:"select",required:!0,options:[["enter",e("ui.panel.config.automation.editor.triggers.type.geo_location.enter")],["leave",e("ui.panel.config.automation.editor.triggers.type.geo_location.leave")]]}]))},{kind:"get",static:!0,key:"defaultConfig",value:function(){return{trigger:"geo_location",source:"",zone:"",event:"enter"}}},{kind:"method",key:"render",value:function(){return s.dy` <ha-form .schema="${this._schema(this.hass.localize)}" .data="${this.trigger}" .hass="${this.hass}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> `}},{kind:"method",key:"_valueChanged",value:function(e){e.stopPropagation();const t=e.detail.value;(0,r.B)(this,"value-changed",{value:t})}},{kind:"field",key:"_computeLabelCallback",value(){return e=>this.hass.localize(`ui.panel.config.automation.editor.triggers.type.geo_location.${e.name}`)}}]}}),s.oi)},79154:function(e,t,i){var a=i(44249),s=(i(29073),i(57243)),n=i(15093),o=i(27486),r=i(36522);(0,a.Z)([(0,n.Mo)("ha-automation-trigger-homeassistant")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"trigger",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",key:"_schema",value:()=>(0,o.Z)((e=>[{name:"event",type:"select",required:!0,options:[["start",e("ui.panel.config.automation.editor.triggers.type.homeassistant.start")],["shutdown",e("ui.panel.config.automation.editor.triggers.type.homeassistant.shutdown")]]}]))},{kind:"get",static:!0,key:"defaultConfig",value:function(){return{trigger:"homeassistant",event:"start"}}},{kind:"method",key:"render",value:function(){return s.dy` <ha-form .schema="${this._schema(this.hass.localize)}" .data="${this.trigger}" .hass="${this.hass}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> `}},{kind:"method",key:"_valueChanged",value:function(e){e.stopPropagation();const t=e.detail.value;(0,r.B)(this,"value-changed",{value:t})}},{kind:"field",key:"_computeLabelCallback",value(){return e=>this.hass.localize(`ui.panel.config.automation.editor.triggers.type.homeassistant.${e.name}`)}},{kind:"field",static:!0,key:"styles",value:()=>s.iv`label{display:flex;align-items:center}`}]}}),s.oi)},98073:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(44249),s=i(57243),n=i(15093),o=i(95262),r=i(79805),d=i(58587),l=e([r,d]);[r,d]=l.then?(await l)():l;(0,a.Z)([(0,n.Mo)("ha-automation-trigger-list")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"trigger",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"get",static:!0,key:"defaultConfig",value:function(){return{triggers:[]}}},{kind:"method",key:"render",value:function(){const e=(0,o.r)(this.trigger.triggers);return s.dy` <ha-automation-trigger .triggers="${e}" .has