iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
7 lines • 102 kB
JavaScript
export const __rspack_esm_id=51087;export const __rspack_esm_ids=[51087];export const __webpack_modules__={17079(t,e,i){i.d(e,{X:()=>a});i(44114);class a{hostConnected(){window.addEventListener("undo-change",this._onUndoChange)}hostDisconnected(){window.removeEventListener("undo-change",this._onUndoChange)}get canUndo(){return this._undoStack.length>0}get canRedo(){return this._redoStack.length>0}commit(t){this._undoStack.length>=this._stackLimit&&this._undoStack.shift(),this._undoStack.push({...t}),this._redoStack=[]}undo(){if(0===this._undoStack.length)return;this._redoStack.push({...this._currentConfig()});const t=this._undoStack.pop();this._apply(t),this._host.requestUpdate()}redo(){if(0===this._redoStack.length)return;this._undoStack.push({...this._currentConfig()});const t=this._redoStack.pop();this._apply(t),this._host.requestUpdate()}reset(){this._undoStack=[],this._redoStack=[]}constructor(t,e){this._undoStack=[],this._redoStack=[],this._stackLimit=75,this._apply=()=>{throw new Error("No apply function provided")},this._currentConfig=()=>{throw new Error("No currentConfig function provided")},this._onUndoChange=t=>{t.stopPropagation(),this.undo(),this._host.requestUpdate()},void 0!==e.stackLimit&&(this._stackLimit=e.stackLimit),this._apply=e.apply,this._currentConfig=e.currentConfig,this._host=t,t.addController(this)}}},82591(t,e,i){i.a(t,async function(t,a){try{i.d(e,{E2:()=>g,Z8:()=>u,a3:()=>y,i:()=>c,nR:()=>l});var o=i(74487),s=i(22786),n=i(79791),r=t([o]);o=(r.then?(await r)():r)[0];const d=t=>t<10?`0${t}`:t,l=(t,e)=>{const i=e.days||0,a=e.hours||0,o=e.minutes||0,s=e.seconds||0,n=e.milliseconds||0;return i>0?`${Intl.NumberFormat(t.language,{style:"unit",unit:"day",unitDisplay:"long"}).format(i)} ${a}:${d(o)}:${d(s)}`:a>0?`${a}:${d(o)}:${d(s)}`:o>0?`${o}:${d(s)}`:s>0?Intl.NumberFormat(t.language,{style:"unit",unit:"second",unitDisplay:"long"}).format(s):n>0?Intl.NumberFormat(t.language,{style:"unit",unit:"millisecond",unitDisplay:"long"}).format(n):null},h=(0,s.A)(t=>new Intl.DurationFormat(t.language,{style:"long"})),c=(t,e)=>h(t).format(e),p=(0,s.A)(t=>new Intl.DurationFormat(t.language,{style:"digital",hoursDisplay:"auto"})),g=(t,e)=>p(t).format(e),u=["min","h","d"],m=(0,s.A)(t=>new Intl.DurationFormat(t.language,{style:"narrow",daysDisplay:"always"})),v=(0,s.A)(t=>new Intl.DurationFormat(t.language,{style:"narrow",hoursDisplay:"always"})),b=(0,s.A)(t=>new Intl.DurationFormat(t.language,{style:"narrow",minutesDisplay:"always"})),y=(t,e,i,a)=>{const o=void 0!==a?(0,n.L)(parseFloat(e),a):parseFloat(e);switch(i){case"d":{const e=Math.floor(o),i={days:e,hours:Math.floor(24*(o-e))};return m(t).format(i)}case"h":{const e=Math.floor(o),i={hours:e,minutes:Math.floor(60*(o-e))};return v(t).format(i)}case"min":{const e=Math.floor(o),i={minutes:e,seconds:Math.floor(60*(o-e))};return b(t).format(i)}default:throw new Error("Invalid duration unit")}};a()}catch(t){a(t)}})},79791(t,e,i){i.d(e,{L:()=>a});const a=(t,e=2)=>Math.round(t*10**e)/10**e},67258(t,e,i){i.d(e,{d:()=>a});const a=t=>{switch(t.language){case"cs":case"de":case"fi":case"fr":case"sk":case"sv":return" ";default:return""}}},8549(t,e,i){i.d(e,{A:()=>o});var a=i(67258);const o=(t,e)=>"°"===t?"":e&&"%"===t?(0,a.d)(e):" "},51758(t,e,i){i.d(e,{Z:()=>a});const a=t=>{const e=window.location.pathname;return t?e+"?"+t:e}},60734(t,e,i){i.a(t,async function(t,e){try{i(18111),i(22489),i(61701);var a=i(62826),o=i(5124),s=i(22441),n=i(22786),r=i(1087),d=i(52220),l=i(35891),h=i(606),c=t([h]);h=(c.then?(await c)():c)[0];class p extends o.WF{open(){this._select&&(this._select.menuOpen=!0)}render(){return this.hass?o.qy` <ha-select .label="${this.label||this.hass.localize("ui.components.blueprint-picker.select_blueprint")}" .value="${this.value}" .disabled="${this.disabled}" @selected="${this._blueprintChanged}" .options="${this._processedBlueprints(this.blueprints).map(t=>({value:t.path,label:t.name}))}"> </ha-select> `:o.s6}firstUpdated(t){super.firstUpdated(t),void 0===this.blueprints&&(0,l.Xg)(this.hass,this.domain).then(t=>{this.blueprints=t})}_blueprintChanged(t){const e=t.detail.value;e!==this.value&&(this.value=e,setTimeout(()=>{(0,r.r)(this,"value-changed",{value:e}),(0,r.r)(this,"change")},0))}constructor(...t){super(...t),this.value="",this.domain="automation",this.disabled=!1,this._processedBlueprints=(0,n.A)(t=>{if(!t)return[];return Object.entries(t).filter(t=>!("error"in t[1])).map(([t,e])=>({...e.metadata,path:t})).sort((t,e)=>(0,d.xL)(t.name,e.name,this.hass.locale.language))})}}p.styles=o.AH`:host{display:inline-block}ha-select{width:100%;min-width:200px;display:block}`,(0,a.Cg)([(0,s.MZ)()],p.prototype,"label",void 0),(0,a.Cg)([(0,s.MZ)()],p.prototype,"value",void 0),(0,a.Cg)([(0,s.MZ)()],p.prototype,"domain",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],p.prototype,"blueprints",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],p.prototype,"disabled",void 0),(0,a.Cg)([(0,s.P)("ha-select")],p.prototype,"_select",void 0),p=(0,a.Cg)([(0,s.EM)("ha-blueprint-picker")],p),e()}catch(t){e(t)}})},645(t,e,i){i.a(t,async function(t,e){try{i(74423),i(44114),i(18111),i(7588),i(61701),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698);var a=i(62826),o=i(5124),s=i(22441),n=i(1087),r=i(19459),d=i(35891),l=i(71606),h=i(14503),c=(i(30716),i(11382),i(26300)),p=(i(8630),t([c]));c=(p.then?(await p)():p)[0];const g="M21 8H3V6H21V8M13.81 16H10V18H13.09C13.21 17.28 13.46 16.61 13.81 16M18 11H6V13H18V11M21.12 15.46L19 17.59L16.88 15.46L15.47 16.88L17.59 19L15.47 21.12L16.88 22.54L19 20.41L21.12 22.54L22.54 21.12L20.41 19L22.54 16.88L21.12 15.46Z";class u extends o.WF{willUpdate(t){super.willUpdate(t),t.has("value")&&!(0,r.b)(this.value,t.get("value"))&&this._findRelated()}render(){return o.qy` <ha-expansion-panel left-chevron .expanded="${this.expanded}" @expanded-will-change="${this._expandedWillChange}" @expanded-changed="${this._expandedChanged}"> <div slot="header" class="header"> ${this.hass.localize("ui.panel.config.blueprint.caption")} ${this.value?.length?o.qy`<div class="badge">${this.value?.length}</div> <ha-icon-button .path="${g}" @click="${this._clearFilter}"></ha-icon-button>`:o.s6} </div> ${this._blueprints&&this._shouldRender?o.qy` <ha-list @selected="${this._blueprintsSelected}" multi class="ha-scrollbar"> ${Object.entries(this._blueprints).map(([t,e])=>"error"in e?o.s6:o.qy`<ha-check-list-item .value="${t}" .selected="${(this.value||[]).includes(t)}"> ${e.metadata.name||t} </ha-check-list-item>`)} </ha-list> `:o.s6} </ha-expansion-panel> `}async firstUpdated(){this.type&&(this._blueprints=await(0,d.Xg)(this.hass,this.type))}updated(t){t.has("expanded")&&this.expanded&&setTimeout(()=>{!this.narrow&&this.expanded&&(this._list.style.height=this.clientHeight-49+"px")},300)}_expandedWillChange(t){this._shouldRender=t.detail.expanded}_expandedChanged(t){this.expanded=t.detail.expanded}async _blueprintsSelected(t){const e=this._blueprints;if(!t.detail.index.size)return(0,n.r)(this,"data-table-filter-changed",{value:[],items:void 0}),void(this.value=[]);const i=[];for(const a of t.detail.index){const t=Object.keys(e)[a];i.push(t)}this.value=i}async _findRelated(){if(!this.value?.length)return this.value=[],void(0,n.r)(this,"data-table-filter-changed",{value:[],items:void 0});const t=[];for(const e of this.value)this.type&&t.push((0,l.f)(this.hass,`${this.type}_blueprint`,e));const e=await Promise.all(t),i=new Set;for(const t of e)t[this.type]&&t[this.type].forEach(t=>i.add(t));(0,n.r)(this,"data-table-filter-changed",{value:this.value,items:this.type?i:void 0})}_clearFilter(t){t.preventDefault(),this.value=void 0,(0,n.r)(this,"data-table-filter-changed",{value:void 0,items:void 0})}static get styles(){return[h.dp,o.AH`:host{border-bottom:1px solid var(--divider-color)}:host([expanded]){flex:1;height:0}ha-expansion-panel{--ha-card-border-radius:var(--ha-border-radius-square);--expansion-panel-content-padding:0}.header{display:flex;align-items:center}.header ha-icon-button{margin-inline-start:auto;margin-inline-end:8px}.badge{display:inline-block;margin-left:8px;margin-inline-start:8px;margin-inline-end:0;min-width:16px;box-sizing:border-box;border-radius:var(--ha-border-radius-circle);font-size:var(--ha-font-size-xs);font-weight:var(--ha-font-weight-normal);background-color:var(--primary-color);line-height:var(--ha-line-height-normal);text-align:center;padding:0px 2px;color:var(--text-primary-color)}`]}constructor(...t){super(...t),this.narrow=!1,this.expanded=!1,this._shouldRender=!1}}(0,a.Cg)([(0,s.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],u.prototype,"value",void 0),(0,a.Cg)([(0,s.MZ)()],u.prototype,"type",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],u.prototype,"narrow",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],u.prototype,"expanded",void 0),(0,a.Cg)([(0,s.wk)()],u.prototype,"_shouldRender",void 0),(0,a.Cg)([(0,s.wk)()],u.prototype,"_blueprints",void 0),(0,a.Cg)([(0,s.P)("ha-list")],u.prototype,"_list",void 0),u=(0,a.Cg)([(0,s.EM)("ha-filter-blueprints")],u),e()}catch(t){e(t)}})},90771(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),o=i(5124),s=i(22441),n=i(1087),r=i(99611),d=t([r]);r=(d.then?(await d)():d)[0];class l extends o.WF{render(){return o.qy`<dialog open @transitionend="${this._handleTransitionEnd}" style="${`\n --height: ${this._dialogViewportHeight}vh;\n --height: ${this._dialogViewportHeight}dvh;\n --max-height: ${this._dialogMaxViewpointHeight}vh;\n --max-height: ${this._dialogMaxViewpointHeight}dvh;\n --min-height: ${this._dialogMinViewpointHeight}vh;\n --min-height: ${this._dialogMinViewpointHeight}dvh;\n `}"> <div class="handle-wrapper"> <div @mousedown="${this._handleMouseDown}" @touchstart="${this._handleTouchStart}" class="handle"></div> </div> <slot></slot> </dialog>`}firstUpdated(t){super.firstUpdated(t),this._openSheet()}_openSheet(){requestAnimationFrame(()=>{this._dialog.classList.add("show")})}closeSheet(){requestAnimationFrame(()=>{this._dialog.classList.remove("show")})}_handleTransitionEnd(){this._dialog.classList.contains("show")?(this._dialogViewportHeight=this._dialog.offsetHeight/window.innerHeight*100,this._dialogMaxViewpointHeight=90,this._dialogMinViewpointHeight=20):(this._dialog.close(),(0,n.r)(this,"bottom-sheet-closed"))}connectedCallback(){super.connectedCallback(),document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp),document.addEventListener("touchmove",this._handleTouchMove,{passive:!1}),document.addEventListener("touchend",this._handleTouchEnd),document.addEventListener("touchcancel",this._handleTouchEnd)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp),document.removeEventListener("touchmove",this._handleTouchMove),document.removeEventListener("touchend",this._handleTouchEnd),document.removeEventListener("touchcancel",this._handleTouchEnd)}_startDrag(t){this._dragging=!0,this._dragStartY=t,this._initialSize=this._dialog.offsetHeight/window.innerHeight*100,document.body.style.setProperty("cursor","grabbing")}_updateSize(t){const e=this._dragStartY-t,i=e/window.innerHeight*100;let a=this._initialSize+i;if(a=Math.max(10,Math.min(90,a)),a<20&&e<0)return this._endDrag(),void this.closeSheet();this._dialogViewportHeight=a}_endDrag(){this._dragging&&(this._dragging=!1,document.body.style.removeProperty("cursor"))}constructor(...t){super(...t),this._dragging=!1,this._dragStartY=0,this._initialSize=0,this._dialogMaxViewpointHeight=70,this._dialogMinViewpointHeight=55,this._handleMouseDown=t=>{this._startDrag(t.clientY)},this._handleTouchStart=t=>{t.preventDefault(),this._startDrag(t.touches[0].clientY)},this._handleMouseMove=t=>{this._dragging&&this._updateSize(t.clientY)},this._handleTouchMove=t=>{this._dragging&&(t.preventDefault(),this._updateSize(t.touches[0].clientY))},this._handleMouseUp=()=>{this._endDrag()},this._handleTouchEnd=()=>{this._endDrag()}}}l.styles=o.AH`.handle-wrapper{position:absolute;top:0;width:100%;padding-bottom:2px;display:flex;justify-content:center;align-items:center;cursor:grab;touch-action:none}.handle-wrapper .handle{height:20px;width:200px;display:flex;justify-content:center;align-items:center;z-index:7;padding-bottom:76px}.handle-wrapper .handle::after{content:"";border-radius:var(--ha-border-radius-md);height:4px;background:var(--divider-color,#e0e0e0);width:80px}.handle-wrapper .handle:active::after{cursor:grabbing}dialog{height:var(--height,auto);max-height:min(var(--max-height,70vh),calc(100vh - var(--safe-area-inset-top)));max-height:min(var(--max-height,70dvh),calc(100dvh - var(--safe-area-inset-top)));min-height:var(--min-height,30vh);min-height:var(--min-height,30dvh);background-color:var(--ha-bottom-sheet-surface-background,var(--ha-color-surface-default));display:flex;flex-direction:column;top:0;inset-inline-start:0;position:fixed;width:calc(100% - 4px - var(--safe-area-inset-left) - var(--safe-area-inset-right));max-width:100%;border:none;box-shadow:var(--wa-shadow-l);padding:0;margin:0;top:auto;inset-inline-end:auto;bottom:0;inset-inline-start:0;box-shadow:0px -8px 16px rgba(0,0,0,.2);border-top-left-radius:var(--ha-bottom-sheet-border-radius,var(--ha-dialog-border-radius,var(--ha-border-radius-2xl)));border-top-right-radius:var(--ha-bottom-sheet-border-radius,var(--ha-dialog-border-radius,var(--ha-border-radius-2xl)));transform:translateY(100%);transition:transform ${300}ms ease;border-top-width:var(--ha-bottom-sheet-border-width);border-right-width:var(--ha-bottom-sheet-border-width);border-left-width:var(--ha-bottom-sheet-border-width);border-bottom-width:0;border-style:var(--ha-bottom-sheet-border-style);border-color:var(--ha-bottom-sheet-border-color);margin-left:var(--safe-area-inset-left);margin-right:var(--safe-area-inset-right)}dialog.show{transform:translateY(0)}`,(0,a.Cg)([(0,s.P)("dialog")],l.prototype,"_dialog",void 0),(0,a.Cg)([(0,s.wk)()],l.prototype,"_dialogMaxViewpointHeight",void 0),(0,a.Cg)([(0,s.wk)()],l.prototype,"_dialogMinViewpointHeight",void 0),(0,a.Cg)([(0,s.wk)()],l.prototype,"_dialogViewportHeight",void 0),l=(0,a.Cg)([(0,s.EM)("ha-resizable-bottom-sheet")],l),e()}catch(t){e(t)}})},65829(t,e,i){i.a(t,async function(t,a){try{i.r(e),i.d(e,{HaSpinner:()=>l});var o=i(62826),s=i(55262),n=i(5124),r=i(22441),d=t([s]);s=(d.then?(await d)():d)[0];class l extends s.A{updated(t){if(super.updated(t),t.has("size"))switch(this.size){case"tiny":this.style.setProperty("--ha-spinner-size","16px");break;case"small":this.style.setProperty("--ha-spinner-size","28px");break;case"medium":this.style.setProperty("--ha-spinner-size","48px");break;case"large":this.style.setProperty("--ha-spinner-size","68px");break;case void 0:this.style.removeProperty("--ha-progress-ring-size")}}static get styles(){return[s.A.styles,n.AH`:host{--indicator-color:var(
--ha-spinner-indicator-color,
var(--primary-color)
);--track-color:var(--ha-spinner-divider-color, var(--divider-color));--track-width:4px;--speed:3.5s;font-size:var(--ha-spinner-size, 48px)}`]}}(0,o.Cg)([(0,r.MZ)()],l.prototype,"size",void 0),l=(0,o.Cg)([(0,r.EM)("ha-spinner")],l),a()}catch(t){a(t)}})},35891(t,e,i){i.d(e,{Bs:()=>n,Jp:()=>o,Tk:()=>s,Xg:()=>a,oz:()=>d,x1:()=>r});i(74423);const a=(t,e)=>t.callWS({type:"blueprint/list",domain:e}),o=(t,e)=>t.callWS({type:"blueprint/import",url:e}),s=(t,e,i,a,o,s)=>t.callWS({type:"blueprint/save",domain:e,path:i,yaml:a,source_url:o,allow_override:s}),n=(t,e,i)=>t.callWS({type:"blueprint/delete",domain:e,path:i}),r=t=>{const e=t.metadata.source_url;return e?e.includes("github.com/home-assistant")?"homeassistant":"community":"local"},d=(t,e,i,a)=>t.callWS({type:"blueprint/substitute",domain:e,path:i,input:a})},84383(t,e,i){i.d(e,{W:()=>a});const a=["condition","action"]},37325(t,e,i){i.d(e,{e:()=>s});var a=i(1087);const o=()=>i.e(86658).then(i.bind(i,30809)),s=(t,e)=>{(0,a.r)(t,"show-dialog",{dialogTag:"ha-dialog-automation-mode",dialogImport:o,dialogParams:e})}},64265(t,e,i){i.d(e,{_:()=>s});var a=i(1087);const o=()=>Promise.all([i.e(8275),i.e(66201),i.e(52808),i.e(31990)]).then(i.bind(i,23605)),s=(t,e)=>{(0,a.r)(t,"show-dialog",{dialogTag:"ha-dialog-automation-save",dialogImport:o,dialogParams:e})}},12318(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),o=i(35211),s=i(5124),n=i(22441),r=i(1087),d=i(18350),l=(i(8034),i(22792)),h=t([d]);d=(h.then?(await h)():h)[0];class c extends s.WF{render(){return s.qy` <ha-settings-row narrow> <div class="heading" slot="heading"> <span class="title" id="note-label"> ${this._i18n.localize("ui.panel.config.automation.editor.note.label")} </span> <ha-button @click="${this._handleClick}" size="small" appearance="plain"> ${this._i18n.localize("ui.common.edit")} </ha-button> </div> <p aria-labelledby="note-label">${this.note}</p> </ha-settings-row> `}_handleClick(){(0,r.r)(this,"edit-note")}}c.styles=s.AH`ha-settings-row{margin-inline:calc(-1 * var(--ha-space-4))}ha-settings-row::part(heading){padding-inline-end:0;overflow:visible}.heading{display:flex;justify-content:space-between;align-items:center}p{margin:var(--ha-space-2) 0 0;border:var(--ha-border-width-sm) solid var(--ha-color-border-neutral-quiet);padding:var(--ha-space-1) var(--ha-space-3);border-radius:var(--ha-border-radius-lg);background-color:var(--ha-color-fill-neutral-quiet-resting);white-space:pre-wrap}ha-button{margin-inline-end:calc(-1 * var(--ha-space-3))}`,(0,a.Cg)([(0,n.MZ)()],c.prototype,"note",void 0),(0,a.Cg)([(0,n.wk)(),(0,o.Fg)({context:l.D5,subscribe:!0})],c.prototype,"_i18n",void 0),c=(0,a.Cg)([(0,n.EM)("ha-automation-note")],c),e()}catch(t){e(t)}})},70043(t,e,i){i.a(t,async function(t,a){try{i.d(e,{j:()=>b,m:()=>v});i(18111),i(20116);var o=i(62826),s=i(35211),n=i(5124),r=i(22441),d=i(32172),l=i(91926),h=i(12587),c=(i(3109),i(65829)),p=i(22792),g=i(65063),u=i(42269),m=t([c]);c=(m.then?(await m)():m)[0];const v=n.AH`:host{--ha-automation-editor-max-width:var(--ha-automation-editor-width, 1540px)}ha-fade-in{display:flex;justify-content:center;align-items:center;height:100%}.yaml-mode{height:100%;display:flex;flex-direction:column;padding-bottom:0}ha-yaml-editor{flex-grow:1;--actions-border-radius:var(--ha-border-radius-square);--code-mirror-height:100%;min-height:0;display:flex;flex-direction:column}p{margin-bottom:0}ha-button[slot=fab]{position:fixed;right:calc(16px + var(--safe-area-inset-right,0px));bottom:calc(-80px - var(--safe-area-inset-bottom));transition:bottom .3s;--ha-button-box-shadow:var(--ha-box-shadow-l)}ha-button[slot=fab].dirty{bottom:calc(16px + var(--safe-area-inset-bottom,0px))}ha-tooltip ha-svg-icon{width:12px}ha-tooltip .shortcut{display:inline-flex;flex-direction:row;align-items:center;gap:2px}`,b=t=>{class e extends t{renderLoading(){return n.qy` <ha-fade-in .delay="${500}"> <ha-spinner size="large"></ha-spinner> </ha-fade-in> `}showSettings(){(0,u.p)(this,{entityId:this.currentEntityId,view:"settings"})}async switchUiMode(){if(this.yamlErrors){if(!await(0,g.dk)(this,{text:n.qy`${this.hass.localize("ui.panel.config.automation.editor.switch_ui_yaml_error")}<br><br>${this.yamlErrors}`,confirmText:this.hass.localize("ui.common.continue"),destructive:!0,dismissText:this.hass.localize("ui.common.cancel")}))return}this.yamlErrors=void 0,this.mode="gui"}switchYamlMode(){this.mode="yaml"}takeControlSave(){this.readOnly=!1,this.dirty=!0,this.blueprintConfig=void 0}revertBlueprint(){this.config=this.blueprintConfig,"yaml"===this.mode&&this.renderRoot.querySelector("ha-yaml-editor")?.setValue(this.config),this.blueprintConfig=void 0,this.readOnly=!1}get isDirty(){return this.dirty}async promptDiscardChanges(){return this.confirmUnsavedChanged()}confirmUnsavedChanged(){return Promise.resolve(!0)}async loadConfig(t){const e=this.domainHooks,i=e.domain;try{const i=await e.fetchFileConfig(this.hass,t);this.dirty=!1,this.readOnly=!1,this.config=e.normalizeConfig(i),e.checkValidation()}catch(e){if(404!==e.status_code){const t=e.body?.message||e.body||e.error||"Unknown error";return await(0,g.showAlertDialog)(this,{title:this.hass.localize(`ui.panel.config.${i}.editor.load_error_unknown`,{err_no:e.status_code??"unknown"}),text:n.qy`<pre>${t}</pre>`}),void(0,l.OE)("/config")}const a=this.entityRegistry?.find(e=>e.platform===i&&e.unique_id===t);if(a)return void(0,l.oo)(`/config/${i}/show/${a.entity_id}`,{replace:!0});await(0,g.showAlertDialog)(this,{text:this.hass.localize(`ui.panel.config.${i}.editor.load_error_not_editable`)}),(0,l.OE)("/config")}}constructor(...t){super(...t),this.isWide=!1,this.narrow=!1,this.entityId=null,this.dirty=!1,this.mode="gui",this.readOnly=!1,this.saving=!1,this.backTapped=async()=>{await this.confirmUnsavedChanged()&&(0,h.m)(()=>(0,l.OE)("/config"))}}}return(0,o.Cg)([(0,r.MZ)({attribute:!1})],e.prototype,"hass",void 0),(0,o.Cg)([(0,r.MZ)({attribute:"is-wide",type:Boolean})],e.prototype,"isWide",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean})],e.prototype,"narrow",void 0),(0,o.Cg)([(0,r.MZ)({attribute:!1})],e.prototype,"route",void 0),(0,o.Cg)([(0,r.MZ)({attribute:!1})],e.prototype,"entityId",void 0),(0,o.Cg)([(0,r.wk)(),(0,s.Fg)({context:p.ih,subscribe:!0})],e.prototype,"entityRegistry",void 0),(0,o.Cg)([(0,r.wk)()],e.prototype,"dirty",void 0),(0,o.Cg)([(0,r.wk)()],e.prototype,"errors",void 0),(0,o.Cg)([(0,r.wk)()],e.prototype,"yamlErrors",void 0),(0,o.Cg)([(0,r.wk)()],e.prototype,"currentEntityId",void 0),(0,o.Cg)([(0,r.wk)()],e.prototype,"mode",void 0),(0,o.Cg)([(0,r.wk)()],e.prototype,"readOnly",void 0),(0,o.Cg)([(0,r.wk)()],e.prototype,"saving",void 0),(0,o.Cg)([(0,r.wk)()],e.prototype,"validationErrors",void 0),(0,o.Cg)([(0,r.wk)()],e.prototype,"config",void 0),(0,o.Cg)([(0,r.wk)()],e.prototype,"blueprintConfig",void 0),(0,o.Cg)([(0,r.wk)(),(0,s.Fg)({context:p.ih,subscribe:!0}),(0,d.p)({transformer:function(t){return t?.find(({entity_id:t})=>t===this.currentEntityId)},watch:["currentEntityId"]})],e.prototype,"registryEntry",void 0),e};a()}catch(t){a(t)}})},89552(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),o=i(35211),s=i(5124),n=i(22441),r=i(91335),d=i(1087),l=i(15638),h=i(90771),c=i(88249),p=i(22792),g=i(3496),u=i(70178),m=i(82755),v=i(84713),b=i(61970),y=i(71518),f=i(44214),w=t([h,u,m,v,b,y,f]);[h,u,m,v,b,y,f]=w.then?(await w)():w;class $ extends s.WF{updated(t){super.updated(t),(t.has("config")||t.has("narrow"))&&(this.config&&!this.narrow||(this._tinykeysUnsub?.(),this._tinykeysUnsub=void 0))}disconnectedCallback(){super.disconnectedCallback(),this._unregisterResizeHandlers(),this._tinykeysUnsub?.()}_renderContent(){const t=this._getType();return"trigger"===t?s.qy` <ha-automation-sidebar-trigger class="sidebar-content" .hass="${this.hass}" .config="${this.config}" .isWide="${this.isWide}" .narrow="${this.narrow}" .disabled="${this.disabled}" .yamlMode="${this._yamlMode}" .sidebarKey="${this.sidebarKey}" @toggle-yaml-mode="${this._toggleYamlMode}" @close-sidebar="${this.triggerCloseSidebar}"></ha-automation-sidebar-trigger> `:"condition"===t?s.qy` <ha-automation-sidebar-condition class="sidebar-content" .hass="${this.hass}" .config="${this.config}" .isWide="${this.isWide}" .narrow="${this.narrow}" .disabled="${this.disabled}" .yamlMode="${this._yamlMode}" .sidebarKey="${this.sidebarKey}" @toggle-yaml-mode="${this._toggleYamlMode}" @close-sidebar="${this.triggerCloseSidebar}"></ha-automation-sidebar-condition> `:"action"===t?s.qy` <ha-automation-sidebar-action class="sidebar-content" .hass="${this.hass}" .config="${this.config}" .manifests="${this._manifests}" .isWide="${this.isWide}" .narrow="${this.narrow}" .disabled="${this.disabled}" .yamlMode="${this._yamlMode}" .sidebarKey="${this.sidebarKey}" @toggle-yaml-mode="${this._toggleYamlMode}" @close-sidebar="${this.triggerCloseSidebar}"></ha-automation-sidebar-action> `:"option"===t?s.qy` <ha-automation-sidebar-option class="sidebar-content" .hass="${this.hass}" .config="${this.config}" .isWide="${this.isWide}" .narrow="${this.narrow}" .disabled="${this.disabled}" @close-sidebar="${this.triggerCloseSidebar}"></ha-automation-sidebar-option> `:"script-field-selector"===t?s.qy` <ha-automation-sidebar-script-field-selector class="sidebar-content" .hass="${this.hass}" .config="${this.config}" .isWide="${this.isWide}" .narrow="${this.narrow}" .disabled="${this.disabled}" .yamlMode="${this._yamlMode}" .sidebarKey="${this.sidebarKey}" @toggle-yaml-mode="${this._toggleYamlMode}" @close-sidebar="${this.triggerCloseSidebar}"></ha-automation-sidebar-script-field-selector> `:"script-field"===t?s.qy` <ha-automation-sidebar-script-field class="sidebar-content" .hass="${this.hass}" .config="${this.config}" .isWide="${this.isWide}" .narrow="${this.narrow}" .disabled="${this.disabled}" .yamlMode="${this._yamlMode}" .sidebarKey="${this.sidebarKey}" @toggle-yaml-mode="${this._toggleYamlMode}" @close-sidebar="${this.triggerCloseSidebar}"></ha-automation-sidebar-script-field> `:s.s6}render(){return this.config?this.narrow?s.qy` <ha-resizable-bottom-sheet @bottom-sheet-closed="${this._closeSidebar}"> ${this._renderContent()} </ha-resizable-bottom-sheet> `:s.qy` <div class="handle ${this._resizing?"resizing":""}" @mousedown="${this._handleMouseDown}" @touchstart="${this._handleMouseDown}" @dblclick="${this._handleDoubleClick}" @focus="${this._startKeyboardResizing}" @blur="${this._stopKeyboardResizing}" tabindex="0"> <div class="indicator ${this._resizing?"":"hidden"}"></div> </div> ${this._renderContent()} `:s.s6}_getType(){return this.config?.config&&((0,c.fo)(this.config?.config)||(0,g.H4)(this.config?.config))?"trigger":(0,c.G3)(this.config?.config)?"condition":this.config?.config&&(0,c.KH)(this.config?.config)?this.config?.config.selector?"script-field-selector":"script-field":this.config&&!this.config?.config?"option":this.config?.config.action?"action":void 0}triggerCloseSidebar(t){t?.stopPropagation(),this.narrow?this._bottomSheetElement?.closeSheet():this._closeSidebar()}_closeSidebar(){this.config?.close(!0)}_startResizing(t){document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._endResizing),document.addEventListener("touchmove",this._handleMouseMove,{passive:!1}),document.addEventListener("touchend",this._endResizing),document.addEventListener("touchcancel",this._endResizing),this._resizing=!0,this._resizeStartX=t}_updateSize(t){let e=this._resizeStartX-t;(0,l.qC)(this.hass.language,this.hass.translationMetadata.translations)&&(e=-e),requestAnimationFrame(()=>{(0,d.r)(this,"sidebar-resized",{deltaInPx:e})})}_unregisterResizeHandlers(){document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._endResizing),document.removeEventListener("touchmove",this._handleMouseMove),document.removeEventListener("touchend",this._endResizing),document.removeEventListener("touchcancel",this._endResizing)}_keyboardResize(){(0,d.r)(this,"sidebar-resized",{deltaInPx:this._resizeStartX})}constructor(...t){super(...t),this.isWide=!1,this.disabled=!1,this.narrow=!1,this._yamlMode=!1,this._resizing=!1,this._resizeStartX=0,this._toggleYamlMode=()=>{this.config?.toggleYamlMode()},this._handleMouseDown=t=>{t.preventDefault(),this._startResizing(t.touches?.length?t.touches[0].clientX:t.clientX)},this._handleDoubleClick=t=>{t.preventDefault(),t.stopPropagation(),this._unregisterResizeHandlers(),this._tinykeysUnsub?.(),this._tinykeysUnsub=void 0,this._resizing=!1,document.body.style.removeProperty("cursor"),(0,d.r)(this,"sidebar-reset-size")},this._handleMouseMove=t=>{this._updateSize(t.touches?.length?t.touches[0].clientX:t.clientX)},this._endResizing=()=>{this._unregisterResizeHandlers(),this._resizing=!1,document.body.style.removeProperty("cursor"),(0,d.r)(this,"sidebar-resizing-stopped")},this._startKeyboardResizing=t=>{t.stopPropagation(),this._resizing=!0,this._resizeStartX=0,this._tinykeysUnsub=(0,r.Tc)(this._handleElement,{ArrowLeft:this._increaseSize,ArrowRight:this._decreaseSize})},this._stopKeyboardResizing=t=>{t.stopPropagation(),this._resizing=!1,(0,d.r)(this,"sidebar-resizing-stopped"),this._tinykeysUnsub?.(),this._tinykeysUnsub=void 0},this._increaseSize=t=>{t.stopPropagation(),this._resizeStartX-=(0,l.qC)(this.hass.language,this.hass.translationMetadata.translations)?10:-10,this._keyboardResize()},this._decreaseSize=t=>{t.stopPropagation(),this._resizeStartX+=(0,l.qC)(this.hass.language,this.hass.translationMetadata.translations)?10:-10,this._keyboardResize()}}}$.styles=s.AH`:host{z-index:6;outline:0;height:calc(100% - var(--safe-area-inset-top,0px));--ha-card-border-radius:var(
--ha-dialog-border-radius,
var(--ha-border-radius-2xl)
);border-radius:var(--ha-card-border-radius);--ha-bottom-sheet-border-width:2px;--ha-bottom-sheet-border-style:solid;--ha-bottom-sheet-border-color:var(--primary-color);margin-top:var(--safe-area-inset-top);--ha-bottom-sheet-surface-background:var(--card-background-color)}@media all and (max-width:870px){.sidebar-content{max-height:100%}}.handle{position:absolute;margin-inline-start:-11px;height:calc(100% - (2 * var(--ha-card-border-radius)));width:24px;z-index:7;cursor:ew-resize;display:flex;align-items:center;justify-content:center;padding:var(--ha-card-border-radius) var(--ha-border-radius-square)}.handle.resizing{cursor:grabbing}.handle .indicator{background-color:var(--primary-color);height:100%;width:4px;border-radius:var(--ha-border-radius-pill);transform:scale3d(1,1,1);opacity:1;transition:transform 180ms ease-in-out,opacity 180ms ease-in-out}.handle .indicator.hidden{transform:scale3d(0,1,1);opacity:0}.handle:focus-visible{outline:0}`,(0,a.Cg)([(0,n.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],$.prototype,"config",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,attribute:"wide"})],$.prototype,"isWide",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],$.prototype,"disabled",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],$.prototype,"narrow",void 0),(0,a.Cg)([(0,n.MZ)({type:Number,attribute:"sidebar-key"})],$.prototype,"sidebarKey",void 0),(0,a.Cg)([(0,n.wk)()],$.prototype,"_yamlMode",void 0),(0,a.Cg)([(0,n.wk)()],$.prototype,"_resizing",void 0),(0,a.Cg)([(0,n.wk)(),(0,o.Fg)({context:p.uW,subscribe:!0})],$.prototype,"_manifests",void 0),(0,a.Cg)([(0,n.P)("ha-resizable-bottom-sheet")],$.prototype,"_bottomSheetElement",void 0),(0,a.Cg)([(0,n.P)(".handle")],$.prototype,"_handleElement",void 0),$=(0,a.Cg)([(0,n.EM)("ha-automation-sidebar")],$),e()}catch(t){e(t)}})},136(t,e,i){i.a(t,async function(t,a){try{i.d(e,{N:()=>f});i(18111),i(7588);var o=i(62826),s=i(5124),n=i(22441),r=i(6412),d=i(93905),l=i(1087),h=i(51758),c=i(6030),p=i(18350),g=i(26300),u=(i(3587),i(81619)),m=i(89552),v=t([p,g,m]);[p,g,m]=v.then?(await v)():v;const b="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z",y=500,f=t=>{class e extends t{connectedCallback(){super.connectedCallback(),window.addEventListener("paste",this.handlePaste)}disconnectedCallback(){window.removeEventListener("paste",this.handlePaste),super.disconnectedCallback()}renderContent(){throw new Error("Not implemented")}saveConfig(){throw new Error("Not implemented")}render(){return s.qy` <div class="${(0,r.H)({"has-sidebar":this.sidebarConfig&&!this.narrow})}"> <div class="content-wrapper"> <div class="content ${this.sidebarConfig&&this.narrow?"has-bottom-sheet":""}"> <slot name="alerts"></slot> ${this.renderContent()} </div> <div class="fab-positioner"> <ha-button slot="fab" size="large" class="${this.dirty?"dirty":""}" .disabled="${this.saving}" @click="${this.saveConfig}"> <ha-svg-icon slot="start" .path="${b}"></ha-svg-icon> ${this.hass.localize("ui.common.save")} </ha-button> </div> </div> <div class="sidebar-positioner"> <ha-automation-sidebar tabindex="-1" class="${(0,r.H)({hidden:!this.sidebarConfig})}" .isWide="${this.isWide}" .hass="${this.hass}" .narrow="${this.narrow}" .config="${this.sidebarConfig}" .disabled="${this.disabled}" .sidebarKey="${this.sidebarKey}" @value-changed="${this.sidebarConfigChanged}" @sidebar-resized="${this.resizeSidebar}" @sidebar-resizing-stopped="${this.stopResizeSidebar}" @sidebar-reset-size="${this.resetSidebarWidth}"></ha-automation-sidebar> </div> </div> `}firstUpdated(t){super.firstUpdated(t),this.style.setProperty("--sidebar-dynamic-width",`${this.sidebarWidthPx}px`);"1"===(0,c.p9)("expanded")&&(this.clearParam("expanded"),this.expandAll())}clearParam(t){window.history.replaceState(null,"",(0,h.Z)((0,c.s8)(t)))}async openSidebar(t){this.sidebarConfig?.close?.(),this.sidebarConfig=t.detail,this.sidebarKey++,await(this.sidebarElement?.updateComplete),this.sidebarElement?.focus()}sidebarConfigChanged(t){t.stopPropagation(),this.sidebarConfig&&(this.sidebarConfig={...this.sidebarConfig,...t.detail.value})}triggerCloseSidebar(){if(this.sidebarConfig){if(this.sidebarElement)return void this.sidebarElement.triggerCloseSidebar();this.sidebarConfig?.close(),this.sidebarKey=0}}handleCloseSidebar(){this.sidebarConfig=void 0}replaceExistingConfig(t){this.pastedConfig=t,this.showPastedToastWithUndo(),(0,l.r)(this,"value-changed",{value:{...t}})}showPastedToastWithUndo(){}resetPastedConfig(){this.pastedConfig=void 0,(0,u.P)(this,{message:"",duration:0})}expandAll(){this.collapsableElements?.forEach(t=>{t.expandAll()})}collapseAll(){this.collapsableElements?.forEach(t=>{t.collapseAll()})}tryInsertAfterSelected(t){return!(!this.sidebarConfig||!("insertAfter"in this.sidebarConfig))&&this.sidebarConfig.insertAfter(t)}copySelectedRow(){this.sidebarConfig&&"copy"in this.sidebarConfig&&this.sidebarConfig.copy()}cutSelectedRow(){this.sidebarConfig&&"cut"in this.sidebarConfig&&this.sidebarConfig.cut()}deleteSelectedRow(){this.sidebarConfig&&"delete"in this.sidebarConfig&&this.sidebarConfig.delete()}resizeSidebar(t){t.stopPropagation();const e=t.detail.deltaInPx;this._prevSidebarWidthPx||(this._prevSidebarWidthPx=this.sidebarElement?.clientWidth||y);const i=e+this._prevSidebarWidthPx;this.sidebarWidthPx=i,this.style.setProperty("--sidebar-dynamic-width",`${this.sidebarWidthPx}px`)}stopResizeSidebar(t){t.stopPropagation(),this._prevSidebarWidthPx=void 0}resetSidebarWidth(t){t.stopPropagation(),this._prevSidebarWidthPx=void 0,this.sidebarWidthPx=y,this.style.setProperty("--sidebar-dynamic-width",`${this.sidebarWidthPx}px`)}constructor(...t){super(...t),this.isWide=!1,this.narrow=!1,this.disabled=!1,this.saving=!1,this.dirty=!1,this.sidebarKey=0,this.sidebarWidthPx=y,this.handlePaste=async t=>{throw new Error("Not implemented")}}}return(0,o.Cg)([(0,n.MZ)({attribute:!1})],e.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"is-wide",type:Boolean})],e.prototype,"isWide",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:Boolean})],e.prototype,"saving",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],e.prototype,"config",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],e.prototype,"dirty",void 0),(0,o.Cg)([(0,n.wk)()],e.prototype,"pastedConfig",void 0),(0,o.Cg)([(0,n.wk)()],e.prototype,"sidebarConfig",void 0),(0,o.Cg)([(0,n.wk)()],e.prototype,"sidebarKey",void 0),(0,o.Cg)([(0,d.I)({key:"automation-sidebar-width",state:!1,subscribe:!1})],e.prototype,"sidebarWidthPx",void 0),(0,o.Cg)([(0,n.P)("ha-automation-sidebar")],e.prototype,"sidebarElement",void 0),e};a()}catch(t){a(t)}})},84047(t,e,i){i.d(e,{Z:()=>s});var a=i(1087);const o=()=>i.e(50462).then(i.bind(i,47981)),s=(t,e)=>{(0,a.r)(t,"show-dialog",{dialogTag:"ha-dialog-paste-replace",dialogImport:o,dialogParams:e})}},14839(t,e,i){i.d(e,{l:()=>s});var a=i(1087);const o=()=>i.e(58938).then(i.bind(i,59502)),s=(t,e)=>{(0,a.r)(t,"show-dialog",{dialogTag:"ha-dialog-new-automation",dialogImport:o,dialogParams:e})}},70178(t,e,i){i.a(t,async function(t,e){try{i(74423);var a=i(62826),o=(i(68825),i(5124)),s=i(22441),n=i(31479),r=(i(46190),i(1087)),d=i(78978),l=(i(70947),i(30780)),h=i(95350),c=i(41570),p=i(60232),g=i(49063),u=i(12318),m=i(57116),v=i(86818),b=t([u,v,p,g]);[u,v,p,g]=b.then?(await b)():b;const y="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",f="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",w="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",$="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",_="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",C="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",M="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",A="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",H="M8,5.14V19.14L19,12.14L8,5.14Z",V="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",k="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",x="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",L="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",z="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";class S extends o.WF{willUpdate(t){t.has("config")&&(this._warnings=void 0,this.config&&(this.yamlMode=this.config.yamlMode,this.yamlMode&&this.editor?.yamlEditor?.setValue(this.config.config.action)))}render(){const t=this.config.config.action,e="enabled"in t&&!1===t.enabled,i=(0,p.MS)(t),a="repeat"!==i?i:`repeat_${(0,g.m)(t.repeat)}`,s=l.L_.includes(a||""),r=this.hass.localize("ui.panel.config.automation.editor.actions.action");let d=this.hass.localize(`ui.panel.config.automation.editor.actions.type.${a}.label`)||a;if("service"===a&&t.action){const[e,i]=t.action.split(".",2),a=this.hass.localize(`component.${e}.services.${i}.name`,this.hass.services[e]?.[i]?.description_placeholders)||this.hass.services[e]?.[i]?.name||d,o=this.manifests?.[e];d=!this.manifests||!o||"entity"!==o.integration_type||!o.is_built_in?`${(0,h.p$)(this.hass.localize,e)}: ${a}`:a}const u=s?this.hass.localize(`ui.panel.config.automation.editor.actions.type.${a}.description.picker`):"";return o.qy`<ha-automation-sidebar-card .hass="${this.hass}" .isWide="${this.isWide}" .yamlMode="${this.yamlMode}" .warnings="${this._warnings}" .narrow="${this.narrow}" @wa-select="${this._handleDropdownSelect}"> <span slot="title">${d}</span> <span slot="subtitle">${r}${e?o.qy` (${this.hass.localize("ui.panel.config.automation.editor.actions.disabled")})`:""}${"condition"!==a&&this.config.config.action.continue_on_error?` · ${this.hass.localize("ui.panel.config.automation.editor.actions.continue_on_error")}`:o.s6}</span> <ha-dropdown-item slot="menu-items" value="run"> <ha-svg-icon slot="icon" .path="${H}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.run")} <span class="shortcut-placeholder ${c.c?"mac":""}"></span> </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="rename" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${L}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.rename")} <span class="shortcut-placeholder ${c.c?"mac":""}"></span> </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="edit_note"> <ha-svg-icon slot="icon" .path="${$}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.note."+(this.config.config.action.note?"edit":"add"))} <span class="shortcut-placeholder ${c.c?"mac":""}"></span> </div> </ha-dropdown-item> <wa-divider slot="menu-items"></wa-divider> <ha-dropdown-item slot="menu-items" value="duplicate" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${x}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.duplicate")} <span class="shortcut-placeholder ${c.c?"mac":""}"></span> </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="copy"> <ha-svg-icon slot="icon" .path="${_}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.copy")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${c.c?o.qy`<ha-svg-icon .path="${y}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>C</span> </span>`} </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="cut" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${C}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.cut")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${c.c?o.qy`<ha-svg-icon .path="${y}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>X</span> </span>`} </div> </ha-dropdown-item> ${this.config.pasteAvailable()?o.qy` <ha-dropdown-item slot="menu-items" value="paste" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${M}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.paste")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${c.c?o.qy`<ha-svg-icon .path="${y}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>V</span> </span>`} </div> </ha-dropdown-item> `:o.s6} <ha-dropdown-item slot="menu-items" value="toggle_yaml_mode" .disabled="${!this.config.uiSupported||!!this._warnings}"> <ha-svg-icon slot="icon" .path="${k}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.edit_"+(this.yamlMode?"ui":"yaml"))} <span class="shortcut-placeholder ${c.c?"mac":""}"></span> </div> </ha-dropdown-item> <wa-divider slot="menu-items"></wa-divider> <ha-dropdown-item slot="menu-items" value="disable" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${e?V:z}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions."+(e?"enable":"disable"))} <span class="shortcut-placeholder ${c.c?"mac":""}"></span> </div> </ha-dropdown-item> ${"condition"!==a?o.qy`<ha-dropdown-item slot="menu-items" value="continue_on_error" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${this.config.config.action.continue_on_error?w:f}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.continue_on_error")} <span class="shortcut-placeholder ${c.c?"mac":""}"></span> </div> </ha-dropdown-item> <wa-divider slot="menu-items"></wa-divider>`:o.s6} <ha-dropdown-item slot="menu-items" value="delete" variant="danger" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${A}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.delete")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${c.c?o.qy`<ha-svg-icon .path="${y}"></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>`} </div> </ha-dropdown-item> ${u&&!this.yamlMode?o.qy`<div class="description">${u}</div>`:(0,n.D)(this.sidebarKey,o.qy`<ha-automation-action-editor class="sidebar-editor" .hass="${this.hass}" .action="${t}" .yamlMode="${this.yamlMode}" .uiSupported="${this.config.uiSupported}" @value-changed="${this._valueChangedSidebar}" @yaml-changed="${this._yamlChangedSidebar}" sidebar narrow .disabled="${this.disabled}" @ui-mode-not-available="${this._handleUiModeNotAvailable}"></ha-automation-action-editor>`)} ${this.config.config.action.note?.trim()&&!this.yamlMode?o.qy`<ha-automation-note @edit-note="${this.config.editNote}" .note="${this.config.config.action.note}"></ha-automation-note>`:o.s6} </ha-automation-sidebar-card>`}_handleUiModeNotAvailable(t){this._warnings=(0,d._)(this.hass,t.detail).warnings,this.yamlMode||(this.yamlMode=!0)}_valueChangedSidebar(t){t.stopPropagation(),this.config?.save?.(t.detail.value),this.config&&(0,r.r)(this,"value-changed",{value:{...this.config,config:{action:t.detail.value}}})}_yamlChangedSidebar(t){t.stopPropagation(),this.config?.save?.(t.detail.value)}_handleDropdownSelect(t){const e=t.detail?.item?.value;if(e)switch(e){case"rename":this.config.rename();break;case"edit_note":this.config.editNote();break;case"run":this.config.run();break;case"duplicate":this.config.duplicate();break;case"copy":this.config.copy();break;case"cut":this.config.cut();break;case"paste":this.config.paste();break;case"toggle_yaml_mode":this._toggleYamlMode();break;case"disable":this.config.disable();break;case"continue_on_error":this.config.continueOnError();break;case"delete":this.config.delete()}}constructor(...t){super(...t),this.isWide=!1,this.disabled=!1,this.yamlMode=!1,this.narrow=!1,this._toggleYamlMode=()=>{(0,r.r)(this,"toggle-yaml-mode")}}}S.styles=[m.KC,m.Lt],(0,a.Cg)([(0,s.MZ)({attribute:!1})],S.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],S.prototype,"config",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],S.prototype,"manifests",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"wide"})],S.prototype,"isWide",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],S.prototype,"disabled",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"yaml-mode"})],S.prototype,"yamlMode",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],S.prototype,"narrow",void 0),(0,a.Cg)([(0,s.MZ)({type:Number,attribute:"sidebar-key"})],S.prototype,"sidebarKey",void 0),(0,a.Cg)([(0,s.wk)()],S.prototype,"_warnings",void 0),(0,a.Cg)([(0,s.P)(".sidebar-editor")],S.prototype,"editor",void 0),S=(0,a.Cg)([(0,s.EM)("ha-automation-sidebar-action")],S),e()}catch(t){e(t)}})},86818(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),o=i(5124),s=i(22441),n=i(6412),r=i(1087),d=i(99124),l=i(57237),h=(i(76776),i(76538),i(29823)),c=i(26300),p=i(59992),g=i(14503),u=i(15702),m=t([h,c,u]);[h,c,u]=m.then?(await m)():m;const v="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",b="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";class y extends((0,p.V)(o.WF)){get scrollableElement(){return this._contentElement}render(){return o.qy` <ha-card outlined class="${(0,n.H)({mobile:!this.isWide,yaml:this.yamlMode})}"> <ha-dialog-header> <ha-icon-button slot="navigationIcon" .label="${this.hass.localize("ui.common.close")}" .path="${v}" @click="${this._closeSidebar}"></ha-icon-button> <slot slot="title" name="title"></slot> <slot slot="subtitle" name="subtitle"></slot> <slot name="overflow-menu" slot="actionItems"> <ha-dropdown @click="${d.C}" @keydown="${l.d}" placement="bottom-end"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.common.menu")}" .path="${b}"></ha-icon-button> <slot name="menu-items"></slot> </ha-dropdown> </slot> </ha-dialog-header> ${this.warnings?o.qy`<ha-automation-editor-warning .localize="${this.hass.localize}" .warnings="${this.warnings}"> </ha-automation-editor-warning>`:o.s6} <div class="card-content ha-scrollbar"> <slot></slot> ${this.renderScrollableFades(this.isWide)} </div> </ha-card> `}_closeSidebar(){(0,r.r)(this,"close-sidebar")}static get styles(){return[...super.styles,g.dp,o.AH`ha-card{position:relative;height:100%;width:100%;border-color:var(--primary-color);border-width:2px;display:flex;flex-direction:column}@media all and (max-width:870px){ha-card.mobile{border:none;box-shadow:none}ha-card.mobile{border-bottom-right-radius:var(--ha-border-radius-square);border-bottom-left-radius:var(--ha-border-radius-square)}}ha-dialog-header{border-radius:var(--ha-card-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0;position:relative;background-color:var(--ha-dialog-surface-background,var(--mdc-theme-surface,#fff))}.card-content{flex:1 1 auto;min-height:0;overflow:auto;margin-top:0;padding-top:0;padding-bottom:max(var(--safe-area-inset-bottom,0px),32px)}.fade-top{top:var(--ha-space-17)}@media all and (max-width:870px){.card-content{padding-bottom:42px}}`]}constructor(...t){super(...t),this.isWide=!1,this.yamlMode=!1,this.narrow=!1}}(0,a.Cg)([(0,s.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"wide"})],y.prototype,"isWide",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"yaml-mode"})],y.prototype,"yamlMode",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],y.prototype,"warnings",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],y.prototype,"handleDropdownSelect",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],y.prototype,"narrow",void 0),(0,a.Cg)([(0,s.P)(".card-content")],y.prototype,"_contentElement",void 0),y=(0,a.Cg)([(0,s.EM)("ha-automation-sidebar-card")],y),e()}catch(t){e(t)}})},82755(t,e,i){i.a(t,async function(t,e){try{i(74423);var a=i(62826),o=(i(68825),i(5124)),s=i(22441),n=i(6412),r=i(31479),d=i(1087),l=i(78978),h=(i(70947),i(87225)),c=i(41570),p=i(49313),g=i(12318),u=i(57116),m=i(86818),v=t([p,g,m]);[p,g,m]=v.then?(await v)():v;const b="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",y="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",f="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",w="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",$="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",_="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",C="M6,22A3,3 0 0,1 3,19C3,18.4 3.18,17.84 3.5,17.37L9,7.81V6A1,1 0 0,1 8,5V4A2,2 0 0,1 10,2H14A2,2 0 0,1 16,4V5A1,1 0 0,1 15,6V7.81L20.5,17.37C20.82,17.84 21,18.4 21,19A3,3 0 0,1 18,22H6M5,19A1,1 0 0,0 6,20H18A1,1 0 0,0 19,19C19,18.79 18.93,18.59 18.82,18.43L16.53,14.47L14,17L8.93,11.93L5.18,18.43C5.07,18.59 5,18.79 5,19M13,10A1,1 0 0,0 12,11A1,1 0 0,0 13,12A1,1 0 0,0 14,11A1,1 0 0,0 13,10Z",M="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",A="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",H="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",V="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",k="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";class x extends o.WF{willUpdate(t){t.has("config")&&(this._warnings=void 0,this.config&&(this.yamlMode=this.config.yamlMode,this.yamlMode&&this.editor?.yamlEditor?.setValue(this.config.config))),t.has("sidebarKey")&&(this._testing=!1)}render(){const t="enabled"in this.config.config&&!1===this.config.config.enabled,e=this.config.config.condition,i=h.I8.includes(e),a=this.hass.localize("ui.panel.config.automation.editor.conditions.condition"),s="condition"in this.config.config&&(0,h.ob)(this.config.config.condition),d="condition"in this.config.config&&(0,h.YQ)(this.config.config.condition),l=this.hass.localize(`ui.panel.config.automation.editor.conditions.type.${e}.label`)||this.hass.localize(`component.${s}.conditions.${d}.name`)||e,p=i?this.hass.localize(`ui.panel.config.automation.editor.conditions.type.${e}.description.picker`):"";return o.qy`<ha-automation-sidebar-card .hass="${this.hass}" .isWide="${this.isWide}" .yamlMode="${this.yamlMode}" .warnings="${this._warnings}" .narrow="${this.narrow}" @wa-select="${this._handleDropdownSelect}"> <span slot="title">${l}</span> <span slot="subtitle">${a}${t?` (${this.hass.localize("ui.panel.config.automation.editor.actions.disabled")})`:""}</span> <ha-dropdown-item slot="menu-items" value="test"> <ha-svg-icon slot="icon" .path="${C}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.conditions.test")} <span class="shortcut-placeholder ${c.c?"mac":""}"></span> </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="rename" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${V}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.rename")} <span class="shortcut-placeholder ${c.c?"mac":""}"></span> </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="edit_note" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${y}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.note."+(this.config.config.note?"edit":"add"))} <span class="shortcut-placeholder ${c.c?"mac":""}"></span> </div> </ha-dropdown-item> <wa-divider slot="menu-items"></wa-divider> <ha-dropdown-item slot="menu-items" value="duplicate" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${H}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.duplicate")} <span class="shortcut-placeholder ${c.c?"mac":""}"></span> </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="copy"> <ha-svg-icon slot="icon" .path="${f}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.copy")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${c.c?o.qy`<ha-svg-icon .path="${b}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>C</span> </span>`} </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="cut" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${w}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.cut")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${c.c?o.qy`<ha-svg-icon .path="${b}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>X</span> </span>`} </div> </ha-dropdown-item> ${this.config.pasteAvailable()?o.qy` <ha-dropdown-item slot="menu-items" value="paste" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${$}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.paste")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${c.c?o.qy`<ha-svg-icon .path="${b}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>V</span> </span>`} </div> </ha-dropdown-item> `:o.s6} <ha-dropdown-item slot="menu-items" value="toggle_yaml_mode" .disabled="${!this.config.uiSupported||!!this._warnings}"> <ha-svg-icon slot="icon" .path="${A}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.edit_"+(this.yamlMode?"ui":"yaml"))} <span class="shortcut-placeholder ${c.c?"mac":""}"></span> </div> </ha-dropdown-item> <wa-divider slot="menu-items"></wa-divider> <ha-dropdown-item slot="menu-items" value="disable" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${t?M:k}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions."+(t?"enable":"disable"))} <span class="shortcut-placeholder ${c.c?"mac":""}"></span> </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="delete" variant="danger" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${_}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.delete")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${c.c?o.qy`<ha-svg-icon .path="${b}"></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>`} </div> </ha-dropdown-item> ${p&&!this.yamlMode?o.qy`<div class="description">${p}</div>`:(0,r.D)(this.sidebarKey,o.qy`<ha-automation-condition-editor class="sidebar-editor" .hass="${this.hass}" .condition="${this.config.config}" .description="${this.config.description}" .yamlMode="${this.yamlMode}" .uiSupported="${this.config.uiSupported}" @value-changed="${this._valueChangedSidebar}" @yaml-changed="${this._yamlChangedSidebar}" .disabled="${this.disabled}" @ui-mode-not-available="${this._handleUiModeNotAvailable}" sidebar></ha-automation-condition-editor>`)} ${this.config.config.note?.trim()&&!this.yamlMode?o.qy`<ha-automation-note @edit-note="${this.config.editNote}" .note="${this.config.config.note}"></ha-automation-note>`:o.s6} <div class="testing-wrapper"> <div class="testing ${(0,n.H)({active:this._testing,pass:!0===this._testingResult,error:!1===this._testingResult,narrow:this.narrow})}"> ${void 0===this._testingResult?o.s6:this.hass.localize("ui.panel.config.automation.editor.conditions.testing_"+(this._testingResult?"pass":"error"))} </div> </div> </ha-automation-sidebar-card>`}_handleUiModeNotAvailable(t){this._warnings=(0,l._)(this.hass,t.detail).warnings,this.yamlMode||(this.yamlMode=!0)}_valueChangedSidebar(t){t.stopPropagation(),this.config?.save?.(t.detail.value),this.config&&(0,d.r)(this,"value-changed",{value:{...this.config,config:t.detail.value}})}_yamlChangedSidebar(t){t.stopPropagation(),this.config?.save?.(t.detail.value)}_handleDropdownSelect(t){const e=t.detail?.item?.value;if(e)switch(e){case"rename":this.config.rename();break;case"edit_note":this.config.editNote();break;case"test":this.config.test();break;case"duplicate":this.config.duplicate();break;case"copy":this.config.copy();break;case"cut":this.config.cut();break;case"paste":this.config.paste();break;case"toggle_yaml_mode":this._toggleYamlMode();break;case"disable":this.config.disable();break;case"delete":this.config.delete()}}constructor(...t){super(...t),this.isWide=!1,this.disabled=!1,this.yamlMode=!1,this.narrow=!1,this._testing=!1,this._toggleYamlMode=()=>{(0,d.r)(this,"toggle-yaml-mode")}}}x.styles=[u.KC,u.Lt,o.AH`ha-automation-sidebar-card{position:relative}.testing-wrapper{position:absolute;top:0px;right:0px;left:0px;margin:-1px;overflow:hidden;border-top-right-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg));border-top-left-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg));pointer-events:none;height:100px}.testing{--testing-color:var(--divider-color, #e0e0e0);text-transform:uppercase;font-size:var(--ha-font-size-m);font-weight:var(--ha-font-weight-bold);background-color:var(--testing-color);color:var(--text-primary-color);max-height:0px;transition:max-height .3s ease-in-out,padding-top .3s ease-in-out;text-align:center}.testing.active.narrow{padding-top:16px}.testing.active{max-height:100%}.testing.error{--testing-color:var(--accent-color)}.testing.pass{--testing-color:var(--success-color)}`],(0,a.Cg)([(0,s.MZ)({attribute:!1})],x.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],x.prototype,"config",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"wide"})],x.prototype,"isWide",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],x.prototype,"disabled",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"yaml-mode"})],x.prototype,"yamlMode",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],x.prototype,"narrow",void 0),(0,a.Cg)([(0,s.MZ)({type:Number,attribute:"sidebar-key"})],x.prototype,"sidebarKey",void 0),(0,a.Cg)([(0,s.wk)()],x.prototype,"_warnings",void 0),(0,a.Cg)([(0,s.wk)()],x.prototype,"_testing",void 0),(0,a.Cg)([(0,s.wk)()],x.prototype,"_testingResult",void 0),(0,a.Cg)([(0,s.P)(".sidebar-editor")],x.prototype,"editor",void 0),x=(0,a.Cg)([(0,s.EM)("ha-automation-sidebar-condition")],x),e()}catch(t){e(t)}})},84713(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),o=(i(68825),i(5124)),s=i(22441),n=(i(70947),i(67094),i(41570)),r=i(12318),d=i(57116),l=i(86818),h=t([r,l]);[r,l]=h.then?(await h)():h;const c="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",p="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",g="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",u="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",m="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 v extends o.WF{render(){const t=this.disabled,e=this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.label"),i=this.hass.localize(`ui.panel.config.automation.editor.actions.type.choose.${this.config.defaultOption?"default_":""}option_label`),a=this.hass.localize(`ui.panel.config.automation.editor.actions.type.choose.${this.config.defaultOption?"default_":""}option_description`);return o.qy`<ha-automation-sidebar-card .hass="${this.hass}" .isWide="${this.isWide}" .narrow="${this.narrow}" @wa-select="${this._handleDropdownSelect}"> <span slot="title">${i}</span> <span slot="subtitle">${e}</span> ${this.config.defaultOption?o.qy`<span slot="overflow-menu"></span>`:o.qy` <ha-dropdown-item slot="menu-items" value="rename" .disabled="${!!t}"> <ha-svg-icon slot="icon" .path="${m}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.rename")} <span class="shortcut-placeholder ${n.c?"mac":""}"></span> </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="edit_note" .disabled="${!!t}"> <ha-svg-icon slot="icon" .path="${p}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.note."+(this.config.note?"edit":"add"))} <span class="shortcut-placeholder ${n.c?"mac":""}"></span> </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="duplicate" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${u}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.duplicate")} <span class="shortcut-placeholder ${n.c?"mac":""}"></span> </div> </ha-dropdown-item> <wa-divider slot="menu-items"></wa-divider> <ha-dropdown-item slot="menu-items" value="delete" .disabled="${this.disabled}" variant="danger"> <ha-svg-icon slot="icon" .path="${g}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.remove_option")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${n.c?o.qy`<ha-svg-icon slot="start" .path="${c}"></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>`} </div> </ha-dropdown-item> `} <div class="description">${a}</div> ${!this.config.defaultOption&&this.config.note?.trim()?o.qy`<ha-automation-note @edit-note="${this.config.editNote}" .note="${this.config.note}"></ha-automation-note>`:o.s6} </ha-automation-sidebar-card>`}_handleDropdownSelect(t){const e=t.detail?.item?.value;if(e)switch(e){case"rename":this.config.rename();break;case"edit_note":this.config.editNote();break;case"duplicate":this.config.duplicate();break;case"delete":this.config.delete()}}constructor(...t){super(...t),this.isWide=!1,this.disabled=!1,this.narrow=!1}}v.styles=[d.KC,d.Lt],(0,a.Cg)([(0,s.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],v.prototype,"config",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"wide"})],v.prototype,"isWide",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],v.prototype,"disabled",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],v.prototype,"narrow",void 0),(0,a.Cg)([(0,s.P)(".sidebar-editor")],v.prototype,"editor",void 0),v=(0,a.Cg)([(0,s.EM)("ha-automation-sidebar-option")],v),e()}catch(t){e(t)}})},71518(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),o=i(5124),s=i(22441),n=i(31479),r=i(1087),d=(i(70947),i(41570)),l=i(50940),h=i(57116),c=i(86818),p=t([l,c]);[l,c]=p.then?(await p)():p;const g="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",u="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",m="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";class v extends o.WF{willUpdate(t){t.has("config")&&(this._warnings=void 0,this.config&&(this.yamlMode=this.config.yamlMode,this.yamlMode&&this.editor?.yamlEditor?.setValue(this.config.config)))}render(){const t=this.hass.localize("ui.panel.config.script.editor.field.field_selector"),e=this.hass.localize(`ui.components.selectors.selector.types.${Object.keys(this.config.config.field.selector)[0]}`)||Object.keys(this.config.config.field.selector)[0];return o.qy`<ha-automation-sidebar-card .hass="${this.hass}" .isWide="${this.isWide}" .yamlMode="${this.yamlMode}" .warnings="${this._warnings}" .narrow="${this.narrow}" @wa-select="${this._handleDropdownSelect}"> <span slot="title">${e}</span> <span slot="subtitle">${t}</span> <ha-dropdown-item slot="menu-items" value="toggle_yaml_mode" .disabled="${!!this._warnings}"> <ha-svg-icon slot="icon" .path="${m}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.edit_"+(this.yamlMode?"ui":"yaml"))} <span class="shortcut-placeholder ${d.c?"mac":""}"></span> </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="delete" .disabled="${this.disabled}" variant="danger"> <ha-svg-icon slot="icon" .path="${u}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.delete")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${d.c?o.qy`<ha-svg-icon .path="${g}"></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>`} </div> </ha-dropdown-item> ${(0,n.D)(this.sidebarKey,o.qy`<ha-script-field-selector-editor class="sidebar-editor" .hass="${this.hass}" .field="${this.config.config.field}" .disabled="${this.disabled}" @value-changed="${this._valueChangedSidebar}" @yaml-changed="${this._yamlChangedSidebar}" .yamlMode="${this.yamlMode}"></ha-script-field-selector-editor>`)} </ha-automation-sidebar-card>`}_valueChangedSidebar(t){t.stopPropagation(),this.config?.save?.({...this.config.config.field,key:this.config.config.key,...t.detail.value}),this.config&&(0,r.r)(this,"value-changed",{value:{...this.config,config:{field:t.detail.value,key:this.config.config.key,excludeKeys:this.config.config.excludeKeys,selector:!0}}})}_yamlChangedSidebar(t){t.stopPropagation(),this.config?.save?.(t.detail.value)}_handleDropdownSelect(t){const e=t.detail?.item?.value;if(e)switch(e){case"toggle_yaml_mode":this._toggleYamlMode();break;case"delete":this.config.delete()}}constructor(...t){super(...t),this.isWide=!1,this.disabled=!1,this.yamlMode=!1,this.narrow=!1,this._toggleYamlMode=()=>{(0,r.r)(this,"toggle-yaml-mode")}}}v.styles=h.KC,(0,a.Cg)([(0,s.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],v.prototype,"config",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"wide"})],v.prototype,"isWide",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],v.prototype,"disabled",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"yaml-mode"})],v.prototype,"yamlMode",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],v.prototype,"narrow",void 0),(0,a.Cg)([(0,s.MZ)({type:Number,attribute:"sidebar-key"})],v.prototype,"sidebarKey",void 0),(0,a.Cg)([(0,s.wk)()],v.prototype,"_warnings",void 0),(0,a.Cg)([(0,s.P)(".sidebar-editor")],v.prototype,"editor",void 0),v=(0,a.Cg)([(0,s.EM)("ha-automation-sidebar-script-field-selector")],v),e()}catch(t){e(t)}})},61970(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),o=i(5124),s=i(22441),n=i(31479),r=i(1087),d=(i(70947),i(41570)),l=i(1404),h=i(12318),c=i(57116),p=i(86818),g=t([l,h,p]);[l,h,p]=g.then?(await g)():g;const u="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",m="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",v="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",b="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";class y extends o.WF{willUpdate(t){t.has("config")&&(this._warnings=void 0,this.config&&(this.yamlMode=this.config.yamlMode,this.yamlMode&&this.editor?.yamlEditor?.setValue(this.config.config)))}render(){const t=this.hass.localize("ui.panel.config.script.editor.field.label");return o.qy`<ha-automation-sidebar-card .hass="${this.hass}" .isWide="${this.isWide}" .yamlMode="${this.yamlMode}" .warnings="${this._warnings}" .narrow="${this.narrow}" @wa-select="${this._handleDropdownSelect}"> <span slot="title">${t}</span> <ha-dropdown-item slot="menu-items" value="edit_note"> <ha-svg-icon slot="icon" .path="${m}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.note."+(this.config.config.field.description?"edit":"add"))} <span class="shortcut-placeholder ${d.c?"mac":""}"></span> </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="toggle_yaml_mode" .disabled="${!!this._warnings}"> <ha-svg-icon slot="icon" .path="${b}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.edit_"+(this.yamlMode?"ui":"yaml"))} <span class="shortcut-placeholder ${d.c?"mac":""}"></span> </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="delete" .disabled="${this.disabled}" variant="danger"> <ha-svg-icon slot="icon" .path="${v}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.delete")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${d.c?o.qy`<ha-svg-icon .path="${u}"></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>`} </div> </ha-dropdown-item> ${(0,n.D)(this.sidebarKey,o.qy`<ha-script-field-editor class="sidebar-editor" .hass="${this.hass}" .field="${this.config.config.field}" .key="${this.config.config.key}" .excludeKeys="${this.config.config.excludeKeys}" .disabled="${this.disabled}" .yamlMode="${this.yamlMode}" @value-changed="${this._valueChangedSidebar}" @yaml-changed="${this._yamlChangedSidebar}"></ha-script-field-editor>`)} ${this.config.config.field.description?.trim()&&!this.yamlMode?o.qy`<ha-automation-note @edit-note="${this.config.editNote}" .note="${this.config.config.field.description}"></ha-automation-note>`:o.s6} </ha-automation-sidebar-card>`}_valueChangedSidebar(t){t.stopPropagation(),this.config?.save?.({...this.config.config.field,key:t.detail.value.key??this.config.config.key,...t.detail.value}),this.config&&(0,r.r)(this,"value-changed",{value:{...this.config,config:{field:t.detail.value,key:t.detail.value.key??this.config.config.key,excludeKeys:this.config.config.excludeKeys}}})}_yamlChangedSidebar(t){t.stopPropagation(),this.config?.save?.(t.detail.value)}_handleDropdownSelect(t){const e=t.detail?.item?.value;if(e)switch(e){case"toggle_yaml_mode":this._toggleYamlMode();break;case"edit_note":this.config.editNote();break;case"delete":this.config.delete()}}constructor(...t){super(...t),this.isWide=!1,this.disabled=!1,this.yamlMode=!1,this.narrow=!1,this._toggleYamlMode=()=>{(0,r.r)(this,"toggle-yaml-mode")}}}y.styles=[c.KC,c.Lt],(0,a.Cg)([(0,s.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],y.prototype,"config",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"wide"})],y.prototype,"isWide",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],y.prototype,"disabled",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"yaml-mode"})],y.prototype,"yamlMode",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],y.prototype,"narrow",void 0),(0,a.Cg)([(0,s.MZ)({type:Number,attribute:"sidebar-key"})],y.prototype,"sidebarKey",void 0),(0,a.Cg)([(0,s.wk)()],y.prototype,"_warnings",void 0),(0,a.Cg)([(0,s.P)(".sidebar-editor")],y.prototype,"editor",void 0),y=(0,a.Cg)([(0,s.EM)("ha-automation-sidebar-script-field")],y),e()}catch(t){e(t)}})},44214(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),o=(i(68825),i(5124)),s=i(22441),n=i(31479),r=i(1087),d=i(78978),l=(i(70947),i(3496)),h=i(41570),c=i(12318),p=i(57116),g=i(11489),u=i(86818),m=t([c,g,u]);[c,g,u]=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",b="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",y="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",f="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",w="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",$="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",_="M10 7V9H9V15H10V17H6V15H7V9H6V7H10M16 7C17.11 7 18 7.9 18 9V15C18 16.11 17.11 17 16 17H12V7M16 9H14V15H16V9Z",C="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",M="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",A="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",H="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",V="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";class k extends o.WF{willUpdate(t){t.has("config")&&(this._requestShowId=!1,this._warnings=void 0,this.config&&(this.yamlMode=this.config.yamlMode,this.yamlMode&&this.editor?.yamlEditor?.setValue(this.config.config)))}render(){const t="enabled"in this.config.config&&!1===this.config.config.enabled,e=(0,l.H4)(this.config.config)?"list":this.config.config.trigger,i=this.hass.localize("ui.panel.config.automation.editor.triggers.trigger"),a="trigger"in this.config.config&&(0,l.zz)(this.config.config.trigger),s="trigger"in this.config.config&&(0,l.hN)(this.config.config.trigger),r=this.hass.localize(`ui.panel.config.automation.editor.triggers.type.${e}.label`)||this.hass.localize(`component.${a}.triggers.${s}.name`);return o.qy` <ha-automation-sidebar-card .hass="${this.hass}" .isWide="${this.isWide}" .yamlMode="${this.yamlMode}" .warnings="${this._warnings}" .narrow="${this.narrow}" @wa-select="${this._handleDropdownSelect}"> <span slot="title">${r}</span> <span slot="subtitle">${i}${t?` (${this.hass.localize("ui.panel.config.automation.editor.actions.disabled")})`:""}</span> <ha-dropdown-item slot="menu-items" value="rename" .disabled="${this.disabled||"list"===e}"> <ha-svg-icon slot="icon" .path="${H}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.rename")} <span class="shortcut-placeholder ${h.c?"mac":""}"></span> </div> </ha-dropdown-item> ${"list"!==e?o.qy`<ha-dropdown-item slot="menu-items" value="edit_note" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${b}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.note."+(this.config.config.note?"edit":"add"))} <span class="shortcut-placeholder ${h.c?"mac":""}"></span> </div> </ha-dropdown-item>`:o.s6} ${this.yamlMode||"id"in this.config.config||this._requestShowId?o.s6:o.qy`<ha-dropdown-item slot="menu-items" value="show_id" .disabled="${this.disabled||"list"===e}"> <ha-svg-icon slot="icon" .path="${_}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.edit_id")} <span class="shortcut-placeholder ${h.c?"mac":""}"></span> </div> </ha-dropdown-item>`} <wa-divider slot="menu-items"></wa-divider> <ha-dropdown-item slot="menu-items" value="duplicate" .disabled="${this.disabled}"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.duplicate")} <ha-svg-icon slot="icon" .path="${A}"></ha-svg-icon> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="copy"> <ha-svg-icon slot="icon" .path="${y}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.copy")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${h.c?o.qy`<ha-svg-icon .path="${v}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>C</span> </span>`} </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="cut" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${f}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.triggers.cut")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${h.c?o.qy`<ha-svg-icon .path="${v}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>X</span> </span>`} </div> </ha-dropdown-item> ${this.config.pasteAvailable()?o.qy` <ha-dropdown-item slot="menu-items" value="paste" .disabled="${this.disabled}"> <ha-svg-icon slot="icon" .path="${w}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.paste")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${h.c?o.qy`<ha-svg-icon .path="${v}"></ha-svg-icon>`:this.hass.localize("ui.panel.config.automation.editor.ctrl")}</span> <span>+</span> <span>V</span> </span>`} </div> </ha-dropdown-item> `:o.s6} <ha-dropdown-item slot="menu-items" value="toggle_yaml_mode" .disabled="${!this.config.uiSupported||!!this._warnings}"> <ha-svg-icon slot="icon" .path="${M}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.edit_"+(this.yamlMode?"ui":"yaml"))} <span class="shortcut-placeholder ${h.c?"mac":""}"></span> </div> </ha-dropdown-item> <wa-divider slot="menu-items"></wa-divider> <ha-dropdown-item slot="menu-items" value="disable" .disabled="${this.disabled||"list"===e}"> <ha-svg-icon slot="icon" .path="${t?C:V}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions."+(t?"enable":"disable"))} <span class="shortcut-placeholder ${h.c?"mac":""}"></span> </div> </ha-dropdown-item> <ha-dropdown-item slot="menu-items" value="delete" .disabled="${this.disabled}" variant="danger"> <ha-svg-icon slot="icon" .path="${$}"></ha-svg-icon> <div class="overflow-label"> ${this.hass.localize("ui.panel.config.automation.editor.actions.delete")} ${this.narrow?o.s6:o.qy`<span class="shortcut"> <span>${h.c?o.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>`} </div> </ha-dropdown-item> ${(0,n.D)(this.sidebarKey,o.qy`<ha-automation-trigger-editor class="sidebar-editor" .hass="${this.hass}" .trigger="${this.config.config}" .description="${this.config.description}" @value-changed="${this._valueChangedSidebar}" @yaml-changed="${this._yamlChangedSidebar}" .uiSupported="${this.config.uiSupported}" .showId="${this._requestShowId}" .yamlMode="${this.yamlMode}" .disabled="${this.disabled}" @ui-mode-not-available="${this._handleUiModeNotAvailable}" sidebar></ha-automation-trigger-editor>`)} ${(0,l.H4)(this.config.config)||!this.config.config.note?.trim()||this.yamlMode?o.s6:o.qy`<ha-automation-note @edit-note="${this.config.editNote}" .note="${this.config.config.note}"></ha-automation-note>`} </ha-automation-sidebar-card> `}_handleUiModeNotAvailable(t){this._warnings=(0,d._)(this.hass,t.detail).warnings,this.yamlMode||(this.yamlMode=!0)}_valueChangedSidebar(t){t.stopPropagation(),this.config?.save?.(t.detail.value),this.config&&(0,r.r)(this,"value-changed",{value:{...this.config,config:t.detail.value}})}_yamlChangedSidebar(t){t.stopPropagation(),this.config?.save?.(t.detail.value)}_handleDropdownSelect(t){const e=t.detail?.item?.value;if(e)switch(e){case"rename":this.config.rename();break;case"edit_note":this.config.editNote();break;case"show_id":this._showTriggerId();break;case"duplicate":this.config.duplicate();break;case"copy":this.config.copy();break;case"cut":this.config.cut();break;case"paste":this.config.paste();break;case"toggle_yaml_mode":this._toggleYamlMode();break;case"disable":this.config.disable();break;case"delete":this.config.delete()}}constructor(...t){super(...t),this.isWide=!1,this.disabled=!1,this.yamlMode=!1,this.narrow=!1,this._requestShowId=!1,this._toggleYamlMode=()=>{(0,r.r)(this,"toggle-yaml-mode")},this._showTriggerId=()=>{this._requestShowId=!0}}}k.styles=[p.KC,p.Lt],(0,a.Cg)([(0,s.MZ)({attribute:!1})],k.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],k.prototype,"config",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"wide"})],k.prototype,"isWide",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],k.prototype,"disabled",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"yaml-mode"})],k.prototype,"yamlMode",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],k.prototype,"narrow",void 0),(0,a.Cg)([(0,s.MZ)({type:Number,attribute:"sidebar-key"})],k.prototype,"sidebarKey",void 0),(0,a.Cg)([(0,s.wk)()],k.prototype,"_requestShowId",void 0),(0,a.Cg)([(0,s.wk)()],k.prototype,"_warnings",void 0),(0,a.Cg)([(0,s.P)(".sidebar-editor")],k.prototype,"editor",void 0),k=(0,a.Cg)([(0,s.EM)("ha-automation-sidebar-trigger")],k),e()}catch(t){e(t)}})},38119(t,e,i){i.a(t,async function(t,a){try{i.d(e,{D:()=>p});i(18111),i(61701),i(13579);var o=i(62826),s=i(5124),n=i(22441),r=i(1087),d=i(60734),l=(i(76776),i(65829)),h=(i(3587),i(11399),i(8034),i(14503)),c=t([d,l]);[d,l]=c.then?(await c)():c;class p extends s.WF{firstUpdated(t){super.firstUpdated(t),this._getBlueprints()}get _blueprint(){if(this._blueprints)return this._blueprints[this._config.use_blueprint.path]}renderCard(){const t=this._blueprint;let e=!0;return s.qy` <ha-card outlined class="blueprint" .header="${this.hass.localize("ui.panel.config.automation.editor.blueprint.header")}"> <div class="blueprint-picker-container"> ${this._blueprints?Object.keys(this._blueprints).length?s.qy` <ha-blueprint-picker .hass="${this.hass}" .label="${this.hass.localize("ui.panel.config.automation.editor.blueprint.blueprint_to_use")}" .blueprints="${this._blueprints}" .value="${this._config.use_blueprint.path}" .disabled="${this.disabled}" @value-changed="${this._blueprintChanged}"></ha-blueprint-picker> `:this.hass.localize("ui.panel.config.automation.editor.blueprint.no_blueprints"):s.qy`<ha-spinner></ha-spinner>`} </div> ${this._config.use_blueprint.path?t&&"error"in t?s.qy`<p class="warning padding"> There is an error in this Blueprint: ${t.error} </p>`:s.qy`${t?.metadata.description?s.qy`<ha-markdown class="card-content" breaks .content="${t.metadata.description}"></ha-markdown>`:""} ${t?.metadata?.input&&Object.keys(t.metadata.input).length?Object.entries(t.metadata.input).map(([t,i])=>{if(i&&"input"in i){const a=this._renderSection(t,i);return e=!1,a}const a=this._renderSettingRow(t,i,e);return e=!0,a}):s.qy`<p class="padding"> ${this.hass.localize("ui.panel.config.automation.editor.blueprint.no_inputs")} </p>`}`:""} </ha-card> `}_renderSection(t,e){const i=e?.name||t,a=e.input&&Object.values(e.input).some(t=>null===t||void 0===t.default),o=!e.collapsed||a;return s.qy`<ha-expansion-panel outlined .expanded="${o}" .noCollapse="${a}"> ${e?.icon?s.qy` <ha-icon slot="leading-icon" class="section-header" .icon="${e.icon}"></ha-icon> `:s.s6} <div slot="header" role="heading" aria-level="3" class="section-header"> <ha-markdown .content="${i}"></ha-markdown> </div> <div class="content"> ${e?.description?s.qy`<ha-markdown .content="${e.description}"></ha-markdown>`:s.s6} ${e.input?Object.entries(e.input).map(([t,e])=>this._renderSettingRow(t,e,!0)):s.s6} </div> </ha-expansion-panel>`}_renderSettingRow(t,e,i){const a=e?.selector??{text:void 0};return s.qy`<ha-settings-row .narrow="${this.narrow}" class="${i?"border":""}"> <span slot="heading">${e?.name||t}</span> <ha-markdown slot="description" class="card-content" breaks .content="${e?.description}"></ha-markdown> ${s.qy`<ha-selector narrow .hass="${this.hass}" .selector="${a}" .key="${t}" .disabled="${this.disabled}" .required="${void 0===e?.default}" .placeholder="${e?.default}" .value="${this._config.use_blueprint.input&&t in this._config.use_blueprint.input?this._config.use_blueprint.input[t]:e?.default}" @value-changed="${this._inputChanged}"></ha-selector>`} </ha-settings-row>`}_blueprintChanged(t){t.stopPropagation(),this._config.use_blueprint.path!==t.detail.value&&(0,r.r)(this,"value-changed",{value:{...this._config,use_blueprint:{path:t.detail.value}}})}_inputChanged(t){t.stopPropagation();const e=t.target,i=e.key,a=t.detail?t.detail.value:e.value;if(this._config.use_blueprint.input&&this._config.use_blueprint.input[i]===a||!this._config.use_blueprint.input&&""===a)return;const o={...this._config.use_blueprint.input,[i]:a};(0,r.r)(this,"value-changed",{value:{...this._config,use_blueprint:{...this._config.use_blueprint,input:o}}})}static get styles(){return[h.RF,s.AH`:host{display:block}ha-card.blueprint{margin:0 auto;margin-bottom:64px}.padding{padding:16px}.link-button-row{padding:14px}.blueprint-picker-container{padding:0 16px 16px}ha-blueprint-picker{display:block}h3{margin:16px}.introduction{margin-top:0;margin-bottom:12px}.introduction a{color:var(--primary-color)}p{margin-bottom:0}.description{margin-bottom:16px}ha-settings-row{--settings-row-content-width:100%;--settings-row-prefix-display:contents}ha-settings-row.border{border-top:1px solid var(--divider-color)}ha-expansion-panel{margin:8px;margin-left:8px;margin-right:8px}div.section-header{display:flex;vertical-align:middle}ha-icon.section-header{padding-right:10px}ha-alert{display:block;margin-bottom:16px}`]}constructor(...t){super(...t),this.isWide=!1,this.disabled=!1,this.narrow=!1}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"is-wide",type:Boolean})],p.prototype,"isWide",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],p.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],p.prototype,"narrow",void 0),(0,o.Cg)([(0,n.wk)()],p.prototype,"_blueprints",void 0),p=(0,o.Cg)([(0,n.EM)("blueprint-generic-editor")],p),a()}catch(t){a(t)}})},1404(t,e,i){i.a(t,async function(t,e){try{i(74423);var a=i(62826),o=i(5124),s=i(22441),n=i(22786),r=i(1087),d=i(80880),l=i(38962),h=i(52763),c=i(10763),p=i(14503),g=t([l,h,c]);[l,h,c]=g.then?(await g)():g;class u extends o.WF{render(){const t=this._schema(),e={...this.field,key:this._errorKey??this.key},i={[this.key]:this.field};return o.qy` ${this.yamlMode?o.qy`${this._yamlError?o.qy`<ha-alert alert-type="error"> ${this.hass.localize(`ui.panel.config.script.editor.field.${this._yamlError}`)} </ha-alert>`:o.s6} <ha-yaml-editor .defaultValue="${i}" @value-changed="${this._onYamlChange}"></ha-yaml-editor>`:o.qy`<ha-form .schema="${t}" .data="${e}" .error="${this._uiError}" .hass="${this.hass}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}" .computeError="${this._computeError}" @value-changed="${this._valueChanged}"></ha-form>`} `}_maybeSetKey(t){const e=t.name!==this.field.name,i=t.key!==this.key;if(!e||i)return;const a=this.field.name?(0,d.Y)(this.field.name):this.hass.localize("ui.panel.config.script.editor.field.field")||"field";if(new RegExp(`^${a}(_\\d)?$`).test(this.key)){let e=t.name?(0,d.Y)(t.name):this.hass.localize("ui.panel.config.script.editor.field.field")||"field";if(this.excludeKeys.includes(e)){let t,i=2;do{t=`${e}_${i}`,i++}while(this.excludeKeys.includes(t));e=t}t.key=e}}_valueChanged(t){t.stopPropagation();const e={...t.detail.value};if(this._maybeSetKey(e),!e.key||this.excludeKeys.includes(e.key))return this._uiError=e.key?{key:"key_not_unique"}:{key:"key_not_null"},void(this._errorKey=e.key??"");this._errorKey=void 0,this._uiError=void 0,Object.keys(this.field.selector)[0]!==Object.keys(e.selector)[0]&&delete e.default,(0,r.r)(this,"value-changed",{value:e})}_onYamlChange(t){t.stopPropagation();const e={...t.detail.value};if(1!==Object.keys(e).length||!e[Object.keys(e)[0]]||!e[Object.keys(e)[0]].selector)return void(this._yamlError="yaml_error");const i=Object.keys(e)[0];if(this.excludeKeys.includes(i))return void(this._yamlError="key_not_unique");this._yamlError=void 0;const a={...e[i],key:i};(0,r.r)(this,"yaml-changed",{value:a})}constructor(...t){super(...t),this.excludeKeys=[],this.disabled=!1,this.yamlMode=!1,this._schema=(0,n.A)(()=>[{name:"name",selector:{text:{}}},{name:"key",selector:{text:{}}},{name:"required",selector:{boolean:{}}}]),this._computeLabelCallback=t=>this.hass.localize(`ui.panel.config.script.editor.field.${t.name}`),this._computeError=t=>this.hass.localize(`ui.panel.config.script.editor.field.${t}`)||t}}u.styles=p.RF,(0,a.Cg)([(0,s.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)()],u.prototype,"key",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],u.prototype,"excludeKeys",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],u.prototype,"field",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],u.prototype,"disabled",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"yaml-mode"})],u.prototype,"yamlMode",void 0),(0,a.Cg)([(0,s.wk)()],u.prototype,"_uiError",void 0),(0,a.Cg)([(0,s.wk)()],u.prototype,"_yamlError",void 0),u=(0,a.Cg)([(0,s.EM)("ha-script-field-editor")],u),e()}catch(t){e(t)}})},50940(t,e,i){i.a(t,async function(t,e){try{i(74423),i(44114),i(18111),i(7588);var a=i(62826),o=i(5124),s=i(22441),n=i(22786),r=i(1087),d=i(38962),l=i(52763),h=i(10763),c=i(84383),p=i(14503),g=i(57116),u=t([d,l,h]);[d,l,h]=u.then?(await u)():u;class m extends o.WF{render(){const t=this._schema(this.field.selector),e={selector:this.field.selector,default:this.field.default};return o.qy` ${this.yamlMode?o.qy`${this._yamlError?o.qy`<ha-alert alert-type="error"> ${this.hass.localize(`ui.panel.config.script.editor.field.${this._yamlError}`)} </ha-alert>`:o.s6} <ha-yaml-editor .defaultValue="${e}" @value-changed="${this._onYamlChange}"></ha-yaml-editor>`:o.qy`<ha-form .schema="${t}" .data="${e}" .error="${this._uiError}" .hass="${this.hass}" .disabled="${this.disabled}" .computeLabel="${this._computeLabelCallback}" .computeError="${this._computeError}" @value-changed="${this._valueChanged}" .narrow="${this.narrow}"></ha-form>`} `}_valueChanged(t){t.stopPropagation();const e={...t.detail.value};this._uiError=void 0,this.indent||Object.keys(this.field.selector)[0]===Object.keys(e.selector)[0]||(e.default=void 0),(0,r.r)(this,"value-changed",{value:e})}_onYamlChange(t){t.stopPropagation();const e={...t.detail.value};2===Object.keys(e).length?(0,r.r)(this,"yaml-changed",{value:e}):this._yamlError="yaml_error"}_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?.()})}static get styles(){return[p.RF,g.aM,o.AH`:host([indent]) ha-form{display:block;margin-left:12px;padding:12px 20px 16px 16px;margin-right:-4px}`]}constructor(...t){super(...t),this.narrow=!1,this.selected=!1,this.disabled=!1,this.indent=!1,this.yamlMode=!1,this._schema=(0,n.A)(t=>[...this.indent?[]:[{name:"selector",selector:{selector:{}}}],...!t||"object"!=typeof t||!this.indent&&c.W.includes(Object.keys(t)[0])?[]:[{name:"default",selector:this.indent?{[Object.keys(t)[0]]:{...t[Object.keys(t)[0]],optionsInSidebar:!0}}:t}]]),this._computeLabelCallback=t=>this.hass.localize(`ui.panel.config.script.editor.field.${t.name}`)??t.name,this._computeError=t=>this.hass.localize(`ui.panel.config.script.editor.field.${t}`)||t}}(0,a.Cg)([(0,s.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],m.prototype,"field",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"narrow",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],m.prototype,"selected",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"disabled",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"indent",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"yaml-mode"})],m.prototype,"yamlMode",void 0),(0,a.Cg)([(0,s.wk)()],m.prototype,"_uiError",void 0),(0,a.Cg)([(0,s.wk)()],m.prototype,"_yamlError",void 0),(0,a.Cg)([(0,s.P)("ha-form")],m.prototype,"_formElement",void 0),m=(0,a.Cg)([(0,s.EM)("ha-script-field-selector-editor")],m),e()}catch(t){e(t)}})},48646(t,e,i){var a=i(69565),o=i(28551),s=i(1767),n=i(50851);t.exports=function(t,e){e&&"string"==typeof t||o(t);var i=n(t);return s(o(void 0!==i?a(i,t):t))}},30531(t,e,i){var a=i(46518),o=i(69565),s=i(79306),n=i(28551),r=i(1767),d=i(48646),l=i(19462),h=i(9539),c=i(96395),p=i(30684),g=i(84549);var u=!c&&!p("flatMap",function(){}),m=!c&&!u&&g("flatMap",TypeError),v=c||u||m||function(){try{var t=Iterator.prototype.flatMap.call(new Map([[4,5]]).entries(),function(t){return t});t.next(),t.return()}catch(t){return!0}}(),b=l(function(){for(var t,e,i=this.iterator,a=this.mapper;;){if(e=this.inner)try{if(!(t=n(o(e.next,e.iterator))).done)return t.value;this.inner=null}catch(t){h(i,"throw",t)}if(t=n(o(this.next,i)),this.done=!!t.done)return;try{this.inner=d(a(t.value,this.counter++),!1)}catch(t){h(i,"throw",t)}}});a({target:"Iterator",proto:!0,real:!0,forced:v},{flatMap:function(t){n(this);try{s(t)}catch(t){h(this,"throw",t)}return m?o(m,this,t):new b(r(this),{mapper:t,inner:null})}})}};