UNPKG

iobroker.lovelace

Version:

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

18 lines 63.4 kB
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["93025"],{50875:function(e,t,i){i.d(t,{Eu:()=>s,hZ:()=>o,o9:()=>c});var a=i(27486),r=i(11259);const n=["#4269d0","#f4bd4a","#ff725c","#6cc5b0","#a463f2","#ff8ab7","#9c6b4e","#97bbf5","#01ab63","#9498a0","#094bad","#c99000","#d84f3e","#49a28f","#048732","#d96895","#8043ce","#7599d1","#7a4c31","#74787f","#6989f4","#ffd444","#ff957c","#8fe9d3","#62cc71","#ffadda","#c884ff","#badeff","#bf8b6d","#b6bac2","#927acc","#97ee3f","#bf3947","#9f5b00","#f48758","#8caed6","#f2b94f","#eff26e","#e43872","#d9b100","#9d7a00","#698cff","#d9d9d9","#00d27e","#d06800","#009f82","#c49200","#cbe8ff","#fecddf","#c27eb6","#8cd2ce","#c4b8d9","#f883b0","#a49100","#f48800","#27d0df","#a04a9b"];function s(e){return n[e%n.length]}function o(e,t){const i=t.getPropertyValue(`--graph-color-${e+1}`)||s(e);return(0,r.Rq)(i)}const c=(0,a.Z)((e=>n.map(((t,i)=>o(i,e)))),((e,t)=>e[0].getPropertyValue("--graph-color-1")===t[0].getPropertyValue("--graph-color-1")))},85746:function(e,t,i){i.d(t,{V:()=>r});var a=i(87733);const r=(e,t)=>(e=>{switch(e){case"de":case"lb":return!0;default:return!1}})(t)?(0,a.f)(e):e.toLocaleLowerCase(t)},13928:function(e,t,i){i.r(t),i.d(t,{HaIconNext:()=>o});var a=i(61701),r=(i(71695),i(47021),i(50778)),n=i(5111),s=i(37583);let o=(0,a.Z)([(0,r.Mo)("ha-icon-next")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,r.Cb)()],key:"path",value(){return"rtl"===n.E.document.dir?"M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z":"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"}}]}}),s.HaSvgIcon)},95975:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(61701),r=i(72621),n=(i(71695),i(47021),i(74760)),s=i(57243),o=i(50778),c=i(94947),d=i(87733),l=e([c]);c=(l.then?(await l)():l)[0];(0,a.Z)([(0,o.Mo)("ha-relative-time")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"datetime",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"capitalize",value(){return!1}},{kind:"field",key:"_interval",value:void 0},{kind:"method",key:"disconnectedCallback",value:function(){(0,r.Z)(i,"disconnectedCallback",this,3)([]),this._clearInterval()}},{kind:"method",key:"connectedCallback",value:function(){(0,r.Z)(i,"connectedCallback",this,3)([]),this.datetime&&this._startInterval()}},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"firstUpdated",value:function(e){(0,r.Z)(i,"firstUpdated",this,3)([e]),this._updateRelative()}},{kind:"method",key:"update",value:function(e){(0,r.Z)(i,"update",this,3)([e]),this._updateRelative()}},{kind:"method",key:"_clearInterval",value:function(){this._interval&&(window.clearInterval(this._interval),this._interval=void 0)}},{kind:"method",key:"_startInterval",value:function(){this._clearInterval(),this._interval=window.setInterval((()=>this._updateRelative()),6e4)}},{kind:"method",key:"_updateRelative",value:function(){if(this.datetime){const e="string"==typeof this.datetime?(0,n.D)(this.datetime):this.datetime,t=(0,c.G)(e,this.hass.locale);this.innerHTML=this.capitalize?(0,d.f)(t):t}else this.innerHTML=this.hass.localize("ui.components.relative_time.never")}}]}}),s.fl);t()}catch(h){t(h)}}))},12994:function(e,t,i){var a=i(61701),r=(i(71695),i(47021),i(57243)),n=i(50778),s=i(28008);i(37583);let o,c,d,l,h,u,g=e=>e;(0,a.Z)([(0,n.Mo)("ha-timeline")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"label",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"raised",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({attribute:!1,reflect:!0,type:Boolean})],key:"notEnabled",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({attribute:"last-item",type:Boolean})],key:"lastItem",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:String})],key:"icon",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"moreItems",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_showMore",value(){return!1}},{kind:"method",key:"render",value:function(){return(0,r.dy)(o||(o=g` <div class="timeline-start"> ${0} ${0} </div> <div class="content"> <slot></slot> ${0} </div> `),this.label?"":(0,r.dy)(c||(c=g` <ha-svg-icon .path="${0}"></ha-svg-icon> `),this.icon||"M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 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,2Z"),this.lastItem?"":(0,r.dy)(d||(d=g`<div class="line"></div>`)),this.moreItems?(0,r.dy)(l||(l=g` <div> ${0} </div> `),this._showMore||1===this.moreItems.length?this.moreItems:(0,r.dy)(h||(h=g` <button class="link" @click="${0}"> Show ${0} more items </button> `),this._handleShowMore,this.moreItems.length)):"")}},{kind:"method",key:"_handleShowMore",value:function(){this._showMore=!0}},{kind:"get",static:!0,key:"styles",value:function(){return[(0,r.iv)(u||(u=g`:host{display:flex;flex-direction:row}:host(:not([lastItem])){min-height:50px}:host([label]){margin-top:-8px;font-style:italic;color:var(--timeline-label-color,var(--secondary-text-color))}.timeline-start{display:flex;flex-direction:column;align-items:center;margin-right:8px;margin-inline-end:8px;margin-inline-start:initial;width:24px}:host([notEnabled]) ha-svg-icon{opacity:.5}ha-svg-icon{color:var(--timeline-ball-color,var(--timeline-color,var(--secondary-text-color)));border-radius:50%}:host([raised]) ha-svg-icon{transform:scale(1.3)}.line{flex:1;width:2px;background-color:var(--timeline-line-color,var(--timeline-color,var(--secondary-text-color)));margin:4px 0}.content{margin-top:2px}:host(:not([lastItem])) .content{padding-bottom:16px}:host([label]) .content{margin-top:0;padding-top:6px}`)),s.k1]}}]}}),r.oi)},81025:function(e,t,i){var a=i(61701),r=(i(71695),i(52128),i(47021),i(76848)),n=i(57243),s=i(50778);i(68325),i(23334);let o,c=e=>e;(0,a.Z)([(0,s.Mo)("ha-trace-blueprint-config")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"method",key:"render",value:function(){return(0,n.dy)(o||(o=c` <ha-code-editor .value="${0}" read-only dir="ltr"></ha-code-editor> `),(0,r.dump)(this.trace.blueprint_inputs||"").trimRight())}}]}}),n.oi)},79315:function(e,t,i){var a=i(61701),r=(i(71695),i(52128),i(47021),i(76848)),n=i(57243),s=i(50778);i(68325),i(23334);let o,c,d=e=>e;(0,a.Z)([(0,s.Mo)("ha-trace-config")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"method",key:"render",value:function(){return(0,n.dy)(o||(o=d` <ha-code-editor .value="${0}" read-only dir="ltr"></ha-code-editor> `),(0,r.dump)(this.trace.config).trimRight())}},{kind:"get",static:!0,key:"styles",value:function(){return[(0,n.iv)(c||(c=d``))]}}]}}),n.oi)},5327:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(61701),r=(i(71695),i(47021),i(57243)),n=i(50778),s=(i(81929),i(82480)),o=e([s]);s=(o.then?(await o)():o)[0];let c,d,l,h=e=>e;(0,a.Z)([(0,n.Mo)("ha-trace-logbook")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"narrow",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"logbookEntries",value:void 0},{kind:"method",key:"render",value:function(){return this.logbookEntries.length?(0,r.dy)(c||(c=h` <ha-logbook-renderer relative-time .hass="${0}" .entries="${0}" .narrow="${0}"></ha-logbook-renderer> <hat-logbook-note .hass="${0}" .domain="${0}"></hat-logbook-note> `),this.hass,this.logbookEntries,this.narrow,this.hass,this.trace.domain):(0,r.dy)(d||(d=h`<div class="padded-box"> No Logbook entries found for this step. </div>`))}},{kind:"get",static:!0,key:"styles",value:function(){return[(0,r.iv)(l||(l=h`.padded-box{padding:16px}`))]}}]}}),r.oi);t()}catch(c){t(c)}}))},81097:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(58814),r=i(61701),n=(i(19083),i(71695),i(92745),i(9359),i(70104),i(61006),i(52128),i(47021),i(76848)),s=i(60738),o=i(57243),c=i(50778),d=i(35359),l=i(64214),h=(i(68325),i(23334),i(81929),i(75244)),u=i(82480),g=i(43770),p=i(17551),v=i(30635),f=e([u,p,l]);[u,p,l]=f.then?(await f)():f;const k=["path","timestamp","result","error","changed_variables"];let m,b,y,_,$,x,L,C,N,w,V,H,M,E,A,I,P,T,R,Z,z,D,B=e=>e;const S=["step_config","changed_variables","logbook"];(0,r.Z)([(0,c.Mo)("ha-trace-path-details")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,c.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,c.Cb)({type:Boolean,reflect:!0})],key:"narrow",value(){return!1}},{kind:"field",decorators:[(0,c.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"field",decorators:[(0,c.Cb)({attribute:!1})],key:"logbookEntries",value:void 0},{kind:"field",decorators:[(0,c.Cb)({attribute:!1})],key:"selected",value:void 0},{kind:"field",decorators:[(0,c.Cb)({attribute:!1})],key:"renderedNodes",value(){return{}}},{kind:"field",decorators:[(0,c.Cb)({attribute:!1})],key:"trackedNodes",value:void 0},{kind:"field",decorators:[(0,c.SB)()],key:"_view",value(){return"step_config"}},{kind:"field",decorators:[(0,c.SB)(),(0,s.F_)({context:v.we,subscribe:!0})],key:"_entityReg",value:void 0},{kind:"method",key:"render",value:function(){return(0,o.dy)(m||(m=B` <div class="padded-box trace-info"> ${0} </div> <div class="tabs top"> ${0} </div> ${0} `),this._renderSelectedTraceInfo(),S.map((e=>(0,o.dy)(b||(b=B` <button .view="${0}" class="${0}" @click="${0}"> ${0} </button> `),e,(0,d.$)({active:this._view===e}),this._showTab,this.hass.localize(`ui.panel.config.automation.trace.tabs.${e}`)))),"step_config"===this._view?this._renderSelectedConfig():"changed_variables"===this._view?this._renderChangedVars():this._renderLogbook())}},{kind:"method",key:"_renderSelectedTraceInfo",value:function(){var e;const t=this.trace.trace;if(null===(e=this.selected)||void 0===e||!e.path)return this.hass.localize("ui.panel.config.automation.trace.path.choose");const i=this.selected.path.split("/");if("default"===i[i.length-1]){var r;const e=t[i.slice(0,i.length-1).join("/")];if(e&&"default"===(null===(r=e[0])||void 0===r||null===(r=r.result)||void 0===r?void 0:r.choice))return this.hass.localize("ui.panel.config.automation.trace.path.default_action_executed")}if(!(this.selected.path in t))return this.hass.localize("ui.panel.config.automation.trace.path.no_further_execution");const s=[];let c=!1;for(const d of Object.keys(this.trace.trace)){if(c){if(d in this.renderedNodes)break}else{if(d!==this.selected.path)continue;c=!0}const e=t[d],i=d.substring(this.selected.path.length+1).split("/");let r=this.selected.config;for(const t of i)["undefined","string"].includes(typeof r[t])||(r=r[t]);s.push(e.map(((t,i)=>{const s=t,{path:c,timestamp:h,result:u,error:g,changed_variables:v}=s,f=(0,a.Z)(s,k);return!1===(null==u?void 0:u.enabled)?(0,o.dy)(y||(y=B`${0}`),this.hass.localize("ui.panel.config.automation.trace.path.disabled_step")):(0,o.dy)(_||(_=B` ${0} ${0} ${0} ${0} <br> ${0} ${0} ${0} ${0} `),d===this.selected.path?r.alias?(0,o.dy)($||($=B`<h2>${0}</h2>`),r.alias):o.Ld:(0,o.dy)(x||(x=B`<h2> ${0} </h2>`),d.substring(this.selected.path.length+1)),1===e.length?o.Ld:(0,o.dy)(L||(L=B`<h3> ${0} </h3>`),this.hass.localize("ui.panel.config.automation.trace.path.iteration",{number:i+1})),d.substring(this.selected.path.length+1).includes("condition")?(0,o.dy)(C||(C=B`[${0}]<br>`),(0,p.m)(r,this.hass,this._entityReg)):o.Ld,this.hass.localize("ui.panel.config.automation.trace.path.executed",{time:(0,l.E8)(new Date(h),this.hass.locale,this.hass.config)}),g?(0,o.dy)(N||(N=B`<div class="error"> ${0} </div>`),this.hass.localize("ui.panel.config.automation.trace.path.error",{error:g})):o.Ld,u?(0,o.dy)(w||(w=B`${0} <pre>${0}</pre>`),this.hass.localize("ui.panel.config.automation.trace.path.result"),(0,n.dump)(u)):o.Ld,0===Object.keys(f).length?o.Ld:(0,o.dy)(V||(V=B`<pre>${0}</pre>`),(0,n.dump)(f)),r.entity_id&&d.substring(this.selected.path.length+1).includes("entity_id")?(0,o.dy)(H||(H=B`<pre>entity: ${0}</pre>`),r.entity_id):o.Ld)})))}return s}},{kind:"method",key:"_renderSelectedConfig",value:function(){var e;if(null===(e=this.selected)||void 0===e||!e.path)return o.Ld;const t=(0,h.nV)(this.trace.config,this.selected.path);return t?(0,o.dy)(M||(M=B`<ha-code-editor .value="${0}" read-only dir="ltr"></ha-code-editor>`),(0,n.dump)(t).trimEnd()):this.hass.localize("ui.panel.config.automation.trace.path.unable_to_find_config")}},{kind:"method",key:"_renderChangedVars",value:function(){const e=this.trace.trace[this.selected.path];return void 0===e?(0,o.dy)(E||(E=B`<div class="padded-box"> ${0} </div>`),this.hass.localize("ui.panel.config.automation.trace.path.step_not_executed")):(0,o.dy)(A||(A=B` <div class="padded-box"> ${0} </div> `),e.map(((t,i)=>(0,o.dy)(I||(I=B` ${0} ${0} `),e.length>1?(0,o.dy)(P||(P=B`<p> ${0} </p>`),this.hass.localize("ui.panel.config.automation.trace.path.iteration",{number:i+1})):"",0===Object.keys(t.changed_variables||{}).length?this.hass.localize("ui.panel.config.automation.trace.path.no_variables_changed"):(0,o.dy)(T||(T=B`<pre>${0}</pre>`),(0,n.dump)(t.changed_variables).trimEnd())))))}},{kind:"method",key:"_renderLogbook",value:function(){const e=this.trace.trace,t=e[this.selected.path],i=Object.keys(this.trackedNodes),a=i.indexOf(this.selected.path);if(-1===a)return(0,o.dy)(R||(R=B`<div class="padded-box"> ${0} </div>`),this.hass.localize("ui.panel.config.automation.trace.path.step_not_executed"));let r;if(a===i.length-1){const e=new Date(t[0].timestamp),i=this.logbookEntries.findIndex((t=>new Date(1e3*t.when)>=e));r=-1===i?[]:this.logbookEntries.slice(i)}else{const n=e[i[a+1]],s=new Date(t[0].timestamp),o=new Date(n[0].timestamp);r=[];for(const e of this.logbookEntries||[]){const t=new Date(1e3*e.when);if(t>=s){if(!(t<o))break;r.push(e)}}}return r.length?(0,o.dy)(Z||(Z=B` <ha-logbook-renderer relative-time .hass="${0}" .entries="${0}" .narrow="${0}"></ha-logbook-renderer> <hat-logbook-note .hass="${0}" .domain="${0}"></hat-logbook-note> `),this.hass,r,this.narrow,this.hass,this.trace.domain):(0,o.dy)(z||(z=B`<div class="padded-box"> ${0} </div>`),this.hass.localize("ui.panel.config.automation.trace.path.no_logbook_entries"))}},{kind:"method",key:"_showTab",value:function(e){this._view=e.target.view}},{kind:"get",static:!0,key:"styles",value:function(){return[g.b,(0,o.iv)(D||(D=B`.padded-box{margin:16px}:host(:not([narrow])) .trace-info{min-height:250px}pre{margin:0}.error{color:var(--error-color)}`))]}}]}}),o.oi);t()}catch(k){t(k)}}))},57119:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(61701),r=(i(71695),i(47021),i(57243)),n=i(50778),s=(i(81929),i(18156)),o=e([s]);s=(o.then?(await o)():o)[0];let c,d,l=e=>e;(0,a.Z)([(0,n.Mo)("ha-trace-timeline")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"logbookEntries",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"selected",value:void 0},{kind:"method",key:"render",value:function(){return(0,r.dy)(c||(c=l` <hat-trace-timeline .hass="${0}" .trace="${0}" .logbookEntries="${0}" .selectedPath="${0}" allow-pick> </hat-trace-timeline> <hat-logbook-note .hass="${0}" .domain="${0}"></hat-logbook-note> `),this.hass,this.trace,this.logbookEntries,this.selected.path,this.hass,this.trace.domain)}},{kind:"get",static:!0,key:"styles",value:function(){return[(0,r.iv)(d||(d=l`:host{display:block;padding:16px}`))]}}]}}),r.oi);t()}catch(c){t(c)}}))},91298:function(e,t,i){var a=i(61701),r=(i(71695),i(92745),i(61893),i(9359),i(31526),i(70104),i(47021),i(57243)),n=i(50778),s=i(35359),o=i(65786);let c,d,l,h,u,g,p,v=e=>e;(0,a.Z)([(0,n.Mo)("hat-graph-branch")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"selected",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"start",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"short",value(){return!1}},{kind:"field",decorators:[(0,n.SB)()],key:"_branches",value(){return[]}},{kind:"field",key:"_totalWidth",value(){return 0}},{kind:"field",key:"_maxHeight",value(){return 0}},{kind:"method",key:"_updateBranches",value:function(e){let t=0;const i=[],a=[];e.target.assignedElements().forEach((e=>{const r=e.clientWidth,n=e.clientHeight;a.push({x:r/2+t,height:n,start:e.hasAttribute("graph-start"),end:e.hasAttribute("graph-end"),track:e.hasAttribute("track")}),t+=r,i.push(n)})),this._totalWidth=t,this._maxHeight=Math.max(...i),this._branches=a.sort(((e,t)=>e.track&&!t.track?1:e.track&&t.track?0:-1))}},{kind:"method",key:"render",value:function(){return(0,r.dy)(c||(c=v` <slot name="head"></slot> ${0} <div id="branches"> <svg id="lines" width="${0}" height="${0}"> ${0} </svg> <slot @slotchange="${0}"></slot> </div> ${0} `),this.start?r.Ld:(0,r.dy)(d||(d=v` <svg id="top" width="${0}"> ${0} </svg> `),this._totalWidth,this._branches.map((e=>e.start?"":(0,r.YP)(l||(l=v` <path class="${0}" d="
                      M ${0} 0
                      L ${0} ${0}
                      "/> `),(0,s.$)({track:e.track}),this._totalWidth/2,e.x,o.Qs)))),this._totalWidth,this._maxHeight,this._branches.map((e=>e.end?"":(0,r.YP)(h||(h=v` <path class="${0}" d="
                        M ${0} ${0}
                        v ${0}
                        "/> `),(0,s.$)({track:e.track}),e.x,e.height,this._maxHeight-e.height))),this._updateBranches,this.short?r.Ld:(0,r.dy)(u||(u=v` <svg id="bottom" width="${0}"> ${0} </svg> `),this._totalWidth,this._branches.map((e=>e.end?"":(0,r.YP)(g||(g=v` <path class="${0}" d="
                      M ${0} 0
                      V ${0}
                      L ${0} ${0}
                      "/> `),(0,s.$)({track:e.track}),e.x,o.N_,this._totalWidth/2,o.Qs+o.N_)))))}},{kind:"field",static:!0,key:"styles",value(){return(0,r.iv)(p||(p=v`:host{position:relative;display:flex;flex-direction:column;align-items:center}:host(:focus){outline:0}#branches{position:relative;display:flex;flex-direction:row;align-items:start}::slotted(*){z-index:1}::slotted([slot=head]){margin-bottom:calc(var(--hat-graph-branch-height)/ -2)}#lines{position:absolute}#top{height:var(--hat-graph-branch-height)}#bottom{height:calc(var(--hat-graph-branch-height) + var(--hat-graph-spacing))}path{stroke:var(--stroke-clr);stroke-width:2;fill:none}path.track{stroke:var(--track-clr)}:host([disabled]) path{stroke:var(--disabled-clr)}`))}}]}}),r.oi)},65786:function(e,t,i){i.d(t,{N_:()=>a,Qs:()=>n,TB:()=>r});const a=10,r=30,n=20},3953:function(e,t,i){var a=i(61701),r=(i(71695),i(47021),i(57243)),n=i(50778),s=i(18117),o=i(65786);let c,d,l,h,u,g,p,v=e=>e;(0,a.Z)([(0,n.Mo)("hat-graph-node")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"iconPath",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"error",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({attribute:!1,reflect:!0,type:Boolean})],key:"notEnabled",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({attribute:"graph-start",reflect:!0,type:Boolean})],key:"graphStart",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"nofocus"})],key:"noFocus",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({reflect:!0,type:Number})],key:"badge",value:void 0},{kind:"method",key:"updated",value:function(e){e.has("noFocus")&&(this.hasAttribute("tabindex")||this.noFocus?void 0!==e.get("noFocus")&&this.noFocus&&this.removeAttribute("tabindex"):this.setAttribute("tabindex","0"))}},{kind:"method",key:"render",value:function(){const e=o.TB+(this.graphStart?2:o.N_+1),t=o.N_+o.TB;return(0,r.dy)(c||(c=v` <svg class="${0}" width="${0}px" height="${0}px" viewBox="-${0} -${0} ${0} ${0}"> ${0} <g class="node"> <circle cx="0" cy="0" r="${0}"/> ${0} ${0} <g style="pointer-events:none" transform="translate(-12 -12)"> ${0} </g> </g> </svg> `),s.G?"safari":"",t,e,Math.ceil(t/2),this.graphStart?Math.ceil(e/2):Math.ceil((o.TB+2*o.N_)/2),t,e,this.graphStart?r.Ld:(0,r.YP)(d||(d=v` <path class="connector" d="
              M 0 ${0}
              L 0 0
            " line-caps="round"/> `),-o.N_-o.TB/2),o.TB/2,this.error?(0,r.YP)(l||(l=v` <g class="error"> <circle cx="-12" cy="${0}" r="8"></circle> <path transform="translate(-18 -21) scale(.5)" class="exclamation" d="${0}/"> </path></g> `),-o.TB/2,"M10 3H14V14H10V3M10 21V17H14V21H10Z"):r.Ld,this.badge?(0,r.YP)(h||(h=v` <g class="number"> <circle cx="12" cy="${0}" r="8"></circle> <text x="12" y="${0}" text-anchor="middle" alignment-baseline="middle">${0}</text> </g> `),-o.TB/2,-o.TB/2,this.badge>9?"9+":this.badge):r.Ld,this.iconPath?(0,r.YP)(u||(u=v`<path class="icon" d="${0}/"></path>`),this.iconPath):(0,r.YP)(g||(g=v`<foreignObject><span class="icon"><slot name="icon"></slot></span></foreignObject>`)))}},{kind:"field",static:!0,key:"styles",value(){return(0,r.iv)(p||(p=v`:host{display:flex;flex-direction:column;min-width:calc(var(--hat-graph-node-size) + var(--hat-graph-spacing));height:calc(var(--hat-graph-node-size) + var(--hat-graph-spacing) + 1px)}:host([graph-start]){height:calc(var(--hat-graph-node-size) + 2px)}:host([track]){--stroke-clr:var(--track-clr);--icon-clr:var(--default-icon-clr)}:host([active]) circle{--stroke-clr:var(--active-clr);--icon-clr:var(--default-icon-clr)}:host(:focus){outline:0}:host(:hover) circle{--stroke-clr:var(--hover-clr);--icon-clr:var(--default-icon-clr)}:host([notEnabled]) circle{--stroke-clr:var(--disabled-clr)}:host([notEnabled][active]) circle{--stroke-clr:var(--disabled-active-clr)}:host([notEnabled]:hover) circle{--stroke-clr:var(--disabled-hover-clr)}svg:not(.safari){width:100%;height:100%}circle,path.connector{stroke:var(--stroke-clr);stroke-width:2;fill:none}circle{fill:var(--background-clr);stroke:var(--circle-clr,var(--stroke-clr))}.error circle{fill:var(--error-color);stroke:none;stroke-width:0}.error .exclamation{fill:var(--text-primary-color)}.number circle{fill:var(--track-clr);stroke:none;stroke-width:0}.number text{font-size:10px;fill:var(--text-primary-color)}path.icon{fill:var(--icon-clr)}foreignObject{width:24px;height:24px}.icon{color:var(--icon-clr)}`))}}]}}),r.oi)},34936:function(e,t,i){var a=i(61701),r=(i(71695),i(47021),i(57243)),n=i(50778),s=i(65786);let o,c,d=e=>e;(0,a.Z)([(0,n.Mo)("hat-graph-spacer")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({reflect:!0,type:Boolean})],key:"disabled",value(){return!1}},{kind:"method",key:"render",value:function(){return(0,r.dy)(o||(o=d` <svg viewBox="-${0} 0 10 ${0}"> <path d="
              M 0 ${0}
              V 0
            " line-caps="round"/> } </svg> `),s.N_/2,s.N_+s.TB+1,s.N_+s.TB+1)}},{kind:"field",static:!0,key:"styles",value(){return(0,r.iv)(c||(c=d`:host{display:flex;flex-direction:column;align-items:center}svg{width:var(--hat-graph-spacing);height:calc(var(--hat-graph-spacing) + var(--hat-graph-node-size) + 1px)}:host([track]){--stroke-clr:var(--track-clr)}:host-context([disabled]){--stroke-clr:var(--disabled-clr)}path{stroke:var(--stroke-clr);stroke-width:2;fill:none}`))}}]}}),r.oi)},81929:function(e,t,i){var a=i(61701),r=(i(71695),i(47021),i(57243)),n=i(50778);let s,o=e=>e;(0,a.Z)([(0,n.Mo)("hat-logbook-note")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"domain",value(){return"automation"}},{kind:"method",key:"render",value:function(){return"script"===this.domain?this.hass.localize("ui.panel.config.automation.trace.messages.not_all_entries_are_related_script_note"):this.hass.localize("ui.panel.config.automation.trace.messages.not_all_entries_are_related_automation_note")}},{kind:"field",static:!0,key:"styles",value(){return(0,r.iv)(s||(s=o`:host{display:block;text-align:center;font-style:italic;padding:16px;margin-top:8px}`))}}]}}),r.oi)},28639:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(61701),r=i(72621),n=(i(19083),i(71695),i(61893),i(9359),i(1331),i(70104),i(52924),i(61006),i(47021),i(57243)),s=i(50778),o=i(95262),c=i(36522),d=i(14473),l=i(68418),h=(i(23334),i(19467)),u=(i(91298),i(65786)),g=(i(3953),i(34936),i(41422)),p=e([h]);h=(p.then?(await p)():p)[0];let v,f,k,m,b,y,_,$,x,L,C,N,w,V,H,M,E,A,I,P,T,R,Z=e=>e;const z="M4 2A2 2 0 0 0 2 4V12H4V8H6V12H8V4A2 2 0 0 0 6 2H4M4 4H6V6H4M22 15.5V14A2 2 0 0 0 20 12H16V22H20A2 2 0 0 0 22 20V18.5A1.54 1.54 0 0 0 20.5 17A1.54 1.54 0 0 0 22 15.5M20 20H18V18H20V20M20 16H18V14H20M5.79 21.61L4.21 20.39L18.21 2.39L19.79 3.61Z",D="M11,5H8L12,1L16,5H13V9.43C12.25,9.89 11.58,10.46 11,11.12V5M22,11L18,7V10C14.39,9.85 11.31,12.57 11,16.17C9.44,16.72 8.62,18.44 9.17,20C9.72,21.56 11.44,22.38 13,21.83C14.56,21.27 15.38,19.56 14.83,18C14.53,17.14 13.85,16.47 13,16.17C13.47,12.17 17.47,11.97 17.95,11.97V14.97L22,11M10.63,11.59C9.3,10.57 7.67,10 6,10V7L2,11L6,15V12C7.34,12.03 8.63,12.5 9.64,13.4C9.89,12.76 10.22,12.15 10.63,11.59Z",B="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",S="M21 13H14.4L19.1 17.7L17.7 19.1L13 14.4V21H11V14.3L6.3 19L4.9 17.6L9.4 13H3V11H9.6L4.9 6.3L6.3 4.9L11 9.6V3H13V9.4L17.6 4.8L19 6.3L14.3 11H21V13Z",F="M19.59,7L12,14.59L6.41,9H11V7H3V15H5V10.41L12,17.41L21,8.41",q="M20,5.41L18.59,4L7,15.59V9H5V19H15V17H8.41",O="M14,4L16.29,6.29L13.41,9.17L14.83,10.59L17.71,7.71L20,10V4M10,4H4V10L6.29,7.71L11,12.41V20H13V11.59L7.71,6.29",j="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",U="M19,19H5V5H15V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V11H19M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z",Y="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",W="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",Q="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",G="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",J="M15,4V6H18V18H15V20H20V4M4,4V20H9V18H6V6H9V4H4Z",K="M7,13V11H21V13H7M7,19V17H21V19H7M7,7V5H21V7H7M3,8V5H2V4H4V8H3M2,17V16H5V20H2V19H4V18.5H3V17.5H4V17H2M4.25,10A0.75,0.75 0 0,1 5,10.75C5,10.95 4.92,11.14 4.79,11.27L3.12,13H5V14H2V13.08L4,11H2V10H4.25Z",X="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z",ee="M12,5A2,2 0 0,1 14,7C14,7.24 13.96,7.47 13.88,7.69C17.95,8.5 21,11.91 21,16H3C3,11.91 6.05,8.5 10.12,7.69C10.04,7.47 10,7.24 10,7A2,2 0 0,1 12,5M22,19H2V17H22V19Z",te="M16,4.5V7H5V9H16V11.5L19.5,8M16,12.5V15H5V17H16V19.5L19.5,16";(0,a.Z)([(0,s.Mo)("hat-script-graph")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"selected",value:void 0},{kind:"field",key:"hass",value:void 0},{kind:"field",key:"renderedNodes",value(){return{}}},{kind:"field",key:"trackedNodes",value(){return{}}},{kind:"method",key:"_selectNode",value:function(e,t){return()=>{(0,c.B)(this,"graph-node-selected",{config:e,path:t})}}},{kind:"method",key:"_renderTrigger",value:function(e,t){var i;const a=`trigger/${t}`,r=this.trace&&a in this.trace.trace;return this.renderedNodes[a]={config:e,path:a},r&&(this.trackedNodes[a]=this.renderedNodes[a]),(0,n.dy)(v||(v=Z` <hat-graph-node graph-start ?track="${0}" @focus="${0}" ?active="${0}" .iconPath="${0}" .notEnabled="${0}" .error="${0}" tabindex="${0}"></hat-graph-node> `),r,this._selectNode(e,a),this.selected===a,S,"enabled"in e&&!1===e.enabled,null===(i=this.trace.trace[a])||void 0===i?void 0:i.some((e=>e.error)),r?"0":"-1")}},{kind:"method",key:"_renderCondition",value:function(e,t){const i=`condition/${t}`;return this.renderedNodes[i]={config:e,path:i},this.trace&&i in this.trace.trace&&(this.trackedNodes[i]=this.renderedNodes[i]),this._renderConditionNode(e,i)}},{kind:"field",key:"_typeRenderers",value(){return{condition:this._renderConditionNode,and:this._renderConditionNode,or:this._renderConditionNode,not:this._renderConditionNode,service:this._renderServiceNode,wait_template:this._renderWaitNode,wait_for_trigger:this._renderWaitNode,repeat:this._renderRepeatNode,choose:this._renderChooseNode,if:this._renderIfNode,sequence:this._renderSequenceNode,parallel:this._renderParallelNode,other:this._renderOtherNode}}},{kind:"method",key:"_renderActionNode",value:function(e,t,i=!1,a=!1){const r=Object.keys(this._typeRenderers).find((t=>t in e))||"other";return this.renderedNodes[t]={config:e,path:t},this.trace&&t in this.trace.trace&&(this.trackedNodes[t]=this.renderedNodes[t]),this._typeRenderers[r].bind(this)(e,t,i,a)}},{kind:"method",key:"_renderChooseNode",value:function(e,t,i=!1,a=!1){var r,s,c;const d=this.trace.trace[t],l=d?d.map((e=>void 0===e.result||"default"===e.result.choice?"default":e.result.choice)):[],h=l.includes("default");return(0,n.dy)(f||(f=Z` <hat-graph-branch tabindex="${0}" @focus="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}"> <hat-graph-node .graphStart="${0}" .iconPath="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}" .error="${0}" slot="head" nofocus></hat-graph-node> ${0} <div ?track="${0}"> <hat-graph-spacer ?track="${0}"></hat-graph-spacer> ${0} </div> </hat-graph-branch> `),void 0===d?"-1":"0",this._selectNode(e,t),void 0!==d,this.selected===t,a||!1===e.enabled,i,D,void 0!==d,this.selected===t,a||!1===e.enabled,null===(r=this.trace.trace[t])||void 0===r?void 0:r.some((e=>e.error)),e.choose?null===(s=(0,o.r)(e.choose))||void 0===s?void 0:s.map(((i,r)=>{const s=`${t}/choose/${r}`,c=l.includes(r);return this.renderedNodes[s]={config:i,path:s},c&&(this.trackedNodes[s]=this.renderedNodes[s]),(0,n.dy)(k||(k=Z` <div class="graph-container" ?track="${0}"> <hat-graph-node .iconPath="${0}" @focus="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}"></hat-graph-node> ${0} </div> `),c,!d||c?U:j,this._selectNode(i,s),c,this.selected===s,a||!1===e.enabled,null!==i.sequence?(0,o.r)(i.sequence).map(((t,i)=>this._renderActionNode(t,`${s}/sequence/${i}`,!1,a||!1===e.enabled))):"")})):"",h,h,null!==e.default?null===(c=(0,o.r)(e.default))||void 0===c?void 0:c.map(((i,r)=>this._renderActionNode(i,`${t}/default/${r}`,!1,a||!1===e.enabled))):"")}},{kind:"method",key:"_renderIfNode",value:function(e,t,i=!1,a=!1){var r;const s=this.trace.trace[t];let c=!1,d=!1;for(const n of s||[]){var l,h;if(c||"then"!==(null===(l=n.result)||void 0===l?void 0:l.choice)||(c=!0),(d||"else"!==(null===(h=n.result)||void 0===h?void 0:h.choice))&&n.result||(d=!0),d&&c)break}return(0,n.dy)(m||(m=Z` <hat-graph-branch tabindex="${0}" @focus="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}"> <hat-graph-node .graphStart="${0}" .iconPath="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}" slot="head" nofocus></hat-graph-node> ${0} <div class="graph-container" ?track="${0}"> <hat-graph-node .iconPath="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}" nofocus></hat-graph-node> ${0} </div> </hat-graph-branch> `),void 0===s?"-1":"0",this._selectNode(e,t),void 0!==s,this.selected===t,a||!1===e.enabled,i,O,void 0!==s,this.selected===t,a||!1===e.enabled,e.else?(0,n.dy)(b||(b=Z`<div class="graph-container" ?track="${0}"> <hat-graph-node .iconPath="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}" nofocus></hat-graph-node>${0} </div>`),d,F,d,this.selected===t,a||!1===e.enabled,(0,o.r)(e.else).map(((i,r)=>this._renderActionNode(i,`${t}/else/${r}`,!1,a||!1===e.enabled)))):(0,n.dy)(y||(y=Z`<hat-graph-spacer ?track="${0}"></hat-graph-spacer>`),d),c,q,c,this.selected===t,a||!1===e.enabled,(0,o.r)(null!==(r=e.then)&&void 0!==r?r:[]).map(((i,r)=>this._renderActionNode(i,`${t}/then/${r}`,!1,a||!1===e.enabled))))}},{kind:"method",key:"_renderConditionNode",value:function(e,t,i=!1,a=!1){const r=this.trace.trace[t];let s=!1,o=!1,c=!1;if(r)for(const n of r)if(n.result&&(s=!0,n.result.result?o=!0:c=!0),o&&c)break;return(0,n.dy)(_||(_=Z` <hat-graph-branch @focus="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}" tabindex="${0}" short> <hat-graph-node .graphStart="${0}" slot="head" ?track="${0}" ?active="${0}" .notEnabled="${0}" .iconPath="${0}" nofocus></hat-graph-node> <div style="${0}" graph-start graph-end></div> <div ?track="${0}"></div> <hat-graph-node .iconPath="${0}" nofocus ?track="${0}" ?active="${0}" .notEnabled="${0}"></hat-graph-node> </hat-graph-branch> `),this._selectNode(e,t),s,this.selected===t,a||!1===e.enabled,void 0===r?"-1":"0",i,s,this.selected===t,a||!1===e.enabled,z,`width: ${u.TB+u.N_}px;`,o,Q,c,this.selected===t,a||!1===e.enabled)}},{kind:"method",key:"_renderRepeatNode",value:function(e,t,i=!1,a=!1){var r;const s=this.trace.trace[t],c=null===(r=this.trace)||void 0===r||null===(r=r.trace[`${t}/repeat/sequence/0`])||void 0===r?void 0:r.length;return(0,n.dy)($||($=Z` <hat-graph-branch tabindex="${0}" @focus="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}"> <hat-graph-node .graphStart="${0}" .iconPath="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}" slot="head" nofocus></hat-graph-node> <hat-graph-node .iconPath="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}" nofocus .badge="${0}"></hat-graph-node> <div ?track="${0}"> ${0} </div> </hat-graph-branch> `),void 0===s?"-1":"0",this._selectNode(e,t),t in this.trace.trace,this.selected===t,a||!1===e.enabled,i,X,t in this.trace.trace,this.selected===t,a||!1===e.enabled,B,c>1,this.selected===t,a||!1===e.enabled,c>1?c:void 0,s,(0,o.r)(e.repeat.sequence).map(((i,r)=>this._renderActionNode(i,`${t}/repeat/sequence/${r}`,!1,a||!1===e.enabled))))}},{kind:"method",key:"_renderServiceNode",value:function(e,t,i=!1,a=!1){var r;return(0,n.dy)(x||(x=Z` <hat-graph-node .graphStart="${0}" .iconPath="${0}" @focus="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}" .error="${0}" tabindex="${0}"> ${0} </hat-graph-node> `),i,e.action?void 0:ee,this._selectNode(e,t),t in this.trace.trace,this.selected===t,a||!1===e.enabled,null===(r=this.trace.trace[t])||void 0===r?void 0:r.some((e=>e.error)),this.trace&&t in this.trace.trace?"0":"-1",e.action?(0,n.dy)(L||(L=Z`<ha-service-icon slot="icon" .hass="${0}" .service="${0}"></ha-service-icon>`),this.hass,e.action):n.Ld)}},{kind:"method",key:"_renderWaitNode",value:function(e,t,i=!1,a=!1){var r;return(0,n.dy)(C||(C=Z` <hat-graph-node .graphStart="${0}" .iconPath="${0}" @focus="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}" .error="${0}" tabindex="${0}"></hat-graph-node> `),i,G,this._selectNode(e,t),t in this.trace.trace,this.selected===t,a||!1===e.enabled,null===(r=this.trace.trace[t])||void 0===r?void 0:r.some((e=>e.error)),this.trace&&t in this.trace.trace?"0":"-1")}},{kind:"method",key:"_renderSequenceNode",value:function(e,t,i=!1,a=!1){const r=this.trace.trace[t];return(0,n.dy)(N||(N=Z` <hat-graph-branch tabindex="${0}" @focus="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}"> <div class="graph-container" ?track="${0}"> <hat-graph-node .graphStart="${0}" .iconPath="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}" slot="head" nofocus></hat-graph-node> ${0} </div> </hat-graph-branch> `),void 0===r?"-1":"0",this._selectNode(e,t),t in this.trace.trace,this.selected===t,a||!1===e.enabled,t in this.trace.trace,i,K,t in this.trace.trace,this.selected===t,a||!1===e.enabled,(0,o.r)(e.sequence).map(((i,r)=>this._renderActionNode(i,`${t}/sequence/${r}`,!1,a||!1===e.enabled))))}},{kind:"method",key:"_renderParallelNode",value:function(e,t,i=!1,a=!1){const r=this.trace.trace[t];return(0,n.dy)(w||(w=Z` <hat-graph-branch tabindex="${0}" @focus="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}"> <hat-graph-node .graphStart="${0}" .iconPath="${0}" ?track="${0}" ?active="${0}" .notEnabled="${0}" slot="head" nofocus></hat-graph-node> ${0} </hat-graph-branch> `),void 0===r?"-1":"0",this._selectNode(e,t),t in this.trace.trace,this.selected===t,a||!1===e.enabled,i,te,t in this.trace.trace,this.selected===t,a||!1===e.enabled,(0,o.r)(e.parallel).map(((i,r)=>"sequence"in i?(0,n.dy)(V||(V=Z`<div ?track="${0}"> ${0} </div>`),t in this.trace.trace,(0,o.r)(i.sequence).map(((i,n)=>this._renderActionNode(i,`${t}/parallel/${r}/sequence/${n}`,!1,a||!1===e.enabled)))):this._renderActionNode(i,`${t}/parallel/${r}/sequence/0`,!1,a||!1===e.enabled))))}},{kind:"method",key:"_renderOtherNode",value:function(e,t,i=!1,a=!1){var r;return(0,n.dy)(H||(H=Z` <hat-graph-node .graphStart="${0}" .iconPath="${0}" @focus="${0}" ?track="${0}" ?active="${0}" .error="${0}" .notEnabled="${0}"></hat-graph-node> `),i,g.du[(0,l.Pw)(e)]||J,this._selectNode(e,t),t in this.trace.trace,this.selected===t,null===(r=this.trace.trace[t])||void 0===r?void 0:r.some((e=>e.error)),a||!1===e.enabled)}},{kind:"method",key:"render",value:function(){const e="triggers"in this.trace.config?"triggers":"trigger",t="conditions"in this.trace.config?"conditions":"condition",i="actions"in this.trace.config?"actions":"action",a=Object.keys(this.trackedNodes),r=e in this.trace.config?(0,d.Kc)((0,o.r)(this.trace.config[e])).map(((e,t)=>this._renderTrigger(e,t))):void 0;try{var s;return(0,n.dy)(M||(M=Z` <div class="parent graph-container"> ${0} ${0} ${0} ${0} </div> <div class="actions"> <ha-icon-button .disabled="${0}" @click="${0}" .path="${0}"></ha-icon-button> <ha-icon-button .disabled="${0}" @click="${0}" .path="${0}"></ha-icon-button> </div> `),r?(0,n.dy)(E||(E=Z`<hat-graph-branch start .short="${0}"> ${0} </hat-graph-branch>`),r.length<2,r):"",t in this.trace.config?(0,n.dy)(A||(A=Z`${0}`),null===(s=(0,o.r)(this.trace.config[t]))||void 0===s?void 0:s.map(((e,t)=>this._renderCondition(e,t)))):"",i in this.trace.config?(0,n.dy)(I||(I=Z`${0}`),(0,o.r)(this.trace.config[i]).map(((e,t)=>this._renderActionNode(e,`action/${t}`)))):"","sequence"in this.trace.config?(0,n.dy)(P||(P=Z`${0}`),(0,o.r)(this.trace.config.sequence).map(((e,t)=>this._renderActionNode(e,`sequence/${t}`,0===t)))):"",0===a.length||a[0]===this.selected,this._previousTrackedNode,W,0===a.length||a[a.length-1]===this.selected,this._nextTrackedNode,Y)}catch(c){return(0,n.dy)(T||(T=Z` <div class="error"> Error rendering graph. Please download trace and share with the developers. </div> `))}}},{kind:"method",key:"willUpdate",value:function(e){(0,r.Z)(i,"willUpdate",this,3)([e]),e.has("trace")&&(this.renderedNodes={},this.trackedNodes={})}},{kind:"method",key:"updated",value:function(e){if((0,r.Z)(i,"updated",this,3)([e]),e.has("trace")){if(!this.selected||!(this.selected in this.trackedNodes)){const e=this.trackedNodes[Object.keys(this.trackedNodes)[0]];e&&(0,c.B)(this,"graph-node-selected",e)}if(this.trace){const e=Object.keys(this.trace.trace),t=Object.keys(this.renderedNodes).sort(((t,i)=>e.indexOf(t)-e.indexOf(i))),i={},a={};for(const r of t)a[r]=this.renderedNodes[r],r in this.trackedNodes&&(i[r]=this.trackedNodes[r]);this.renderedNodes=a,this.trackedNodes=i}}}},{kind:"method",key:"_previousTrackedNode",value:function(){const e=Object.keys(this.trackedNodes),t=e.indexOf(this.selected)-1;t>=0&&(0,c.B)(this,"graph-node-selected",this.trackedNodes[e[t]])}},{kind:"method",key:"_nextTrackedNode",value:function(){const e=Object.keys(this.trackedNodes),t=e.indexOf(this.selected)+1;t<e.length&&(0,c.B)(this,"graph-node-selected",this.trackedNodes[e[t]])}},{kind:"get",static:!0,key:"styles",value:function(){return(0,n.iv)(R||(R=Z`:host{display:flex;--stroke-clr:var(--stroke-color, var(--secondary-text-color));--active-clr:var(--active-color, var(--primary-color));--track-clr:var(--track-color, var(--accent-color));--hover-clr:var(--hover-color, var(--primary-color));--disabled-clr:var(--disabled-color, var(--disabled-text-color));--disabled-active-clr:rgba(var(--rgb-primary-color), 0.5);--disabled-hover-clr:rgba(var(--rgb-primary-color), 0.7);--default-trigger-color:3,169,244;--rgb-trigger-color:var(--trigger-color, var(--default-trigger-color));--background-clr:var(--background-color, white);--default-icon-clr:var(--icon-color, black);--icon-clr:var(--stroke-clr);--hat-graph-spacing:${0}px;--hat-graph-node-size:${0}px;--hat-graph-branch-height:${0}px}.graph-container{display:flex;flex-direction:column;align-items:center}.actions{display:flex;flex-direction:column}.parent{margin-left:8px;margin-top:16px}.error{padding:16px;max-width:300px}`),u.N_,u.TB,u.Qs)}}]}}),n.oi);t()}catch(v){t(v)}}))},18156:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(61701),r=i(72621),n=(i(63721),i(71695),i(92745),i(9359),i(31526),i(49278),i(19134),i(97003),i(47021),i(60738)),s=i(57243),o=i(50778),c=i(20552),d=i(64214),l=i(94947),h=i(36522),u=i(90122),g=i(30635),p=i(68418),v=i(56707),f=i(75244),k=(i(12994),e([l,v,d]));[l,v,d]=k.then?(await k)():k;let m,b,y,_,$,x,L,C,N,w,V=e=>e;const H="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",M="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,2Z",E="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 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,2Z",A="M13,2.03V2.05L13,4.05C17.39,4.59 20.5,8.58 19.96,12.97C19.5,16.61 16.64,19.5 13,19.93V21.93C18.5,21.38 22.5,16.5 21.95,11C21.5,6.25 17.73,2.5 13,2.03M11,2.06C9.05,2.25 7.19,3 5.67,4.26L7.1,5.74C8.22,4.84 9.57,4.26 11,4.06V2.06M4.26,5.67C3,7.19 2.25,9.04 2.05,11H4.05C4.24,9.58 4.8,8.23 5.69,7.1L4.26,5.67M2.06,13C2.26,14.96 3.03,16.81 4.27,18.33L5.69,16.9C4.81,15.77 4.24,14.42 4.06,13H2.06M7.1,18.37L5.67,19.74C7.18,21 9.04,21.79 11,22V20C9.58,19.82 8.23,19.25 7.1,18.37M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z",I="M13,2.03V2.05L13,4.05C17.39,4.59 20.5,8.58 19.96,12.97C19.5,16.61 16.64,19.5 13,19.93V21.93C18.5,21.38 22.5,16.5 21.95,11C21.5,6.25 17.73,2.5 13,2.03M11,2.06C9.05,2.25 7.19,3 5.67,4.26L7.1,5.74C8.22,4.84 9.57,4.26 11,4.06V2.06M4.26,5.67C3,7.19 2.25,9.04 2.05,11H4.05C4.24,9.58 4.8,8.23 5.69,7.1L4.26,5.67M2.06,13C2.26,14.96 3.03,16.81 4.27,18.33L5.69,16.9C4.81,15.77 4.24,14.42 4.06,13H2.06M7.1,18.37L5.67,19.74C7.18,21 9.04,21.79 11,22V20C9.58,19.82 8.23,19.25 7.1,18.37M16.82,15.19L12.71,11.08C13.12,10.04 12.89,8.82 12.03,7.97C11.13,7.06 9.78,6.88 8.69,7.38L10.63,9.32L9.28,10.68L7.29,8.73C6.75,9.82 7,11.17 7.88,12.08C8.74,12.94 9.96,13.16 11,12.76L15.11,16.86C15.29,17.05 15.56,17.05 15.74,16.86L16.78,15.83C17,15.65 17,15.33 16.82,15.19Z",P="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,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9Z",T=2,R=1e3,Z=(e,t)=>Math.abs(t.getTime()-e.getTime())>R;class z{constructor(e,t,i){this.hass=e,this.entries=t,this.lastReportedTime=void 0,this.lastReportedTime=new Date(i.timestamp.start)}setLastReportedTime(e){this.lastReportedTime=e}renderTime(e,t){this.entries.push((0,s.dy)(m||(m=V` <ha-timeline label> ${0} later </ha-timeline> `),(0,l.G)(e,this.hass.locale,t,!1))),this.lastReportedTime=t}maybeRenderTime(e){return Z(e,this.lastReportedTime)?(this.renderTime(this.lastReportedTime,e),!0):(this.lastReportedTime=e,!1)}}class D{constructor(e,t,i){this.entries=e,this.timeTracker=t,this.logbookEntries=i,this.curIndex=void 0,this.pendingItems=[],this.curIndex=i.length>0&&"automation"===i[0].domain?1:0}get curItem(){return this.logbookEntries[this.curIndex]}get hasNext(){return this.curIndex<this.logbookEntries.length}maybeRenderItem(){const e=this.curItem;this.curIndex++;const t=new Date(1e3*e.when);if(0===this.pendingItems.length)return void this.pendingItems.push([t,e]);const i=this.pendingItems[this.pendingItems.length-1][0];Z(i,t)&&(this._renderLogbookEntries(),this.timeTracker.renderTime(i,t)),this.pendingItems.push([t,e])}flush(){this.pendingItems.length>0&&this._renderLogbookEntries()}_renderLogbookEntries(){this.timeTracker.maybeRenderTime(this.pendingItems[0][0]);const e=[];let t,i;for(t=0;t<Math.min(this.pendingItems.length,T);t++)e.push(this._renderLogbookEntryHelper(this.pendingItems[t][1]));if(t<this.pendingItems.length)for(i=[];t<this.pendingItems.length;t++)i.push(this._renderLogbookEntryHelper(this.pendingItems[t][1]));this.entries.push((0,s.dy)(b||(b=V` <ha-timeline .icon="${0}" .moreItems="${0}"> ${0} </ha-timeline> `),E,i,e)),this.timeTracker.setLastReportedTime(this.pendingItems[this.pendingItems.length-1][0]),this.pendingItems=[]}_renderLogbookEntryHelper(e){return(0,s.dy)(y||(y=V`${0} (${0}) ${0}<br>`),e.name,e.entity_id,e.message||`turned ${e.state}`)}}class B{constructor(e,t,i,a,r,n,s,o){this.hass=e,this.entityReg=t,this.labelReg=i,this.floorReg=a,this.entries=r,this.trace=n,this.logbookRenderer=s,this.timeTracker=o,this.curIndex=0,this.keys=void 0,this.keys=Object.keys(n.trace)}get curItem(){return this._getItem(this.curIndex)}get hasNext(){return this.curIndex<this.keys.length}renderItem(){this.curIndex=this._renderItem(this.curIndex)}_getItem(e){return this.trace.trace[this.keys[e]]}_renderItem(e,t,i){const a=this._getItem(e);if(i){let i=0;return a.forEach((a=>{i=this._renderIteration(e,a,t)})),i}return this._renderIteration(e,a[0],t)}_renderIteration(e,t,i){if((0,f.Zm)(t.path))return this._handleTrigger(e,t);const a=new Date(t.timestamp);for(;this.logbookRenderer.hasNext&&new Date(1e3*this.logbookRenderer.curItem.when)<a;)this.logbookRenderer.maybeRenderItem();this.logbookRenderer.flush(),this.timeTracker.maybeRenderTime(a);const r=t.path;let n;try{n=(0,f.nV)(this.trace.config,r)}catch(c){return this._renderEntry(r,this.hass.localize("ui.panel.config.automation.trace.messages.path_error",{path:r})),e+1}const s=r.split("/");if(!(2===s.length)&&!i)return this._renderEntry(r,r.replace(/\//g," ")),e+1;if(i||(i=(0,p.Pw)(n)),"choose"===i)return this._handleChoose(e);if("repeat"===i)return this._handleRepeat(e);if("if"===i)return this._handleIf(e);if("sequence"===i)return this._handleSequence(e);if("parallel"===i)return this._handleParallel(e);this._renderEntry(r,(0,v.Q)(this.hass,this.entityReg,this.labelReg,this.floorReg,n,i),void 0,!1===n.enabled);let o=e+1;for(;o<this.keys.length&&this.keys[o].split("/").length!==s.length;o++);return o}_handleTrigger(e,t){var i,a;return this._renderEntry(t.path,this.hass.localize("ui.panel.config.automation.trace.messages.triggered_by",{triggeredBy:null!==(i=t.changed_variables.trigger)&&void 0!==i&&i.alias?"alias":"other",alias:null===(a=t.changed_variables.trigger)||void 0===a?void 0:a.alias,triggeredPath:"trigger"===t.path?"manual":"trigger",trigger:this.trace.trigger,time:(0,d.E8)(new Date(t.timestamp),this.hass.locale,this.hass.config)}),M),e+1}_handleChoose(e){var t;const i=this.keys[e],a=i.split("/").length,r=this._getItem(e)[0],n="default"===(null===(t=r.result)||void 0===t?void 0:t.choice),s=this._getDataFromPath(this.keys[e]),o=!1===s.enabled,c=s.alias||this.hass.localize("ui.panel.config.automation.trace.messages.choose");if(n)this._renderEntry(i,this.hass.localize("ui.panel.config.automation.trace.messages.default_action_executed",{name:c}),void 0,o);else if(r.result){const t="default"!==r.result.choice?r.result.choice+1:void 0,a=this._getDataFromPath(`${this.keys[e]}/choose/${r.result.choice}`),n=a?`${a.alias||this.hass.localize("ui.panel.config.automation.trace.messages.option_executed",{option:t})}`:this.hass.localize("ui.panel.config.automation.trace.messages.error",{error:r.error});this._renderEntry(i,`${c}: ${n}`,void 0,o)}else this._renderEntry(i,this.hass.localize("ui.panel.config.automation.trace.messages.no_action_executed",{name:c}),void 0,o);let d;for(d=e+1;d<this.keys.length;d++){const e=this.keys[d].split("/");if(e.length<=a)return d;if(n&&"default"===e[a+1]||!n&&"sequence"===e[a+3])break}for(;d<this.keys.length;){const e=this.keys[d];if(e.split("/").length<=a)return d;d=this._renderItem(d,(0,p.Pw)(this._getDataFromPath(e)))}return d}_handleRepeat(e){const t=this.keys[e],i=t.split("/").length,a=this._getDataFromPath(this.keys[e]),r=!1===a.enabled,n=a.alias||(0,v.Q)(this.hass,this.entityReg,this.labelReg,this.floorReg,a);let s;for(this._renderEntry(t,n,void 0,r),s=e+1;s<this.keys.length;s++){const e=this.keys[s];if(e.split("/").length<=i)return s;s=this._renderItem(s,(0,p.Pw)(this._getDataFromPath(e)),!0)}return s}_handleIf(e){var t;const i=this.keys[e],a=i.split("/").length,r=this._getItem(e)[0],n=this._getDataFromPath(this.keys[e]),s=!1===n.enabled,o=n.alias||this.hass.localize("ui.panel.config.automation.trace.messages.if");if(null!==(t=r.result)&&void 0!==t&&t.choice){const t=this._getDataFromPath(`${this.keys[e]}/${r.result.choice}/`),a=t?t.alias||this.hass.localize("ui.panel.config.automation.trace.messages.action_executed",{action:r.result.choice}):this.hass.localize("ui.panel.config.automation.trace.messages.error",{error:r.error});this._renderEntry(i,`${o}: ${a}`,void 0,s)}else this._renderEntry(i,this.hass.localize("ui.panel.config.automation.trace.messages.no_action_executed",{name:o}),void 0,s);let c;for(c=e+1;c<this.keys.length;c++){const e=this.keys[c],t=this.keys[c].split("/");if(t.length<=a)return c;"condition"===t[a+1]||t.length<a+2||(c=this._renderItem(c,(0,p.Pw)(this._getDataFromPath(e))))}return c}_handleSequence(e){const t=this.keys[e],i=this._getDataFromPath(this.keys[e]);let a;for(this._renderEntry(t,i.alias||(0,v.Q)(this.hass,this.entityReg,this.labelReg,this.floorReg,i,"sequence"),void 0,!1===i.enabled),a=e+1;a<this.keys.length;a++){const e=this.keys[a];this._renderItem(a,(0,p.Pw)(this._getDataFromPath(e)))}return a}_handleParallel(e){const t=this.keys[e],i=t.split("/").length,a=this._getDataFromPath(this.keys[e]),r=!1===a.enabled,n=a.alias||this.hass.localize("ui.panel.config.automation.trace.messages.execute_in_parallel");let s;for(this._renderEntry(t,n,void 0,r),s=e+1;s<this.keys.length;s++){const e=this.keys[s];if(e.split("/").length<=i)return s;s=this._renderItem(s,(0,p.Pw)(this._getDataFromPath(e)))}return s}_renderEntry(e,t,i=P,a=!1){this.entries.push((0,s.dy)(_||(_=V` <ha-timeline .icon="${0}" data-path="${0}" .notEnabled="${0}"> ${0}${0} </ha-timeline> `),i,e,a,t,a?(0,s.dy)($||($=V`<span class="disabled"> ${0}</span>`),this.hass.localize("ui.panel.config.automation.trace.messages.disabled")):""))}_getDataFromPath(e){return(0,f.nV)(this.trace.config,e)}}(0,a.Z)([(0,o.Mo)("hat-trace-timeline")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"logbookEntries",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"selectedPath",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:"allow-pick",type:Boolean})],key:"allowPick",value(){return!1}},{kind:"field",decorators:[(0,o.SB)(),(0,n.F_)({context:g.we,subscribe:!0})],key:"_entityReg",value:void 0},{kind:"field",decorators:[(0,o.SB)(),(0,n.F_)({context:g.TD,subscribe:!0})],key:"_labelReg",value:void 0},{kind:"field",decorators:[(0,o.SB)(),(0,n.F_)({context:g.WC,subscribe:!0})],key:"_floorReg",value:void 0},{kind:"method",key:"render",value:function(){if(!this.trace)return s.Ld;const e=[],t=new z(this.hass,e,this.trace),i=new D(e,t,this.logbookEntries||[]),a=new B(this.hass,this._entityReg,this._labelReg,this._floorReg,e,this.trace,i,t);for(;a.hasNext;)a.renderItem();for(;i.hasNext;)i.maybeRenderItem();i.flush();const r=()=>(0,d.E8)(new Date(this.trace.timestamp.finish),this.hass.locale,this.hass.config),n=()=>((new Date(this.trace.timestamp.finish).getTime()-new Date(this.trace.timestamp.start).getTime())/1e3).toFixed(2);let o;if("running"===this.trace.state)o={description:this.hass.localize("ui.panel.config.automation.trace.messages.still_running"),icon:A};else if("debugged"===this.trace.state)o={description:this.hass.localize("ui.panel.config.automation.trace.messages.debugged"),icon:I};else if("finished"===this.trace.script_execution)o={description:this.hass.localize("ui.panel.config.automation.trace.messages.finished",{time:r(),executiontime:n()}),icon:M};else if("aborted"===this.trace.script_execution)o={description:this.hass.localize("ui.panel.config.automation.trace.messages.aborted",{time:r(),executiontime:n()}),icon:H};else if("cancelled"===this.trace.script_execution)o={description:this.hass.localize("ui.panel.config.automation.trace.messages.cancelled",{time:r(),executiontime:n()}),icon:H};else{let e,t,i=!1;switch(this.trace.script_execution){case"failed_conditions":e="stopped_failed_conditions";break;case"failed_single":e="stopped_failed_single";break;case"failed_max_runs":e="stopped_failed_max_runs";break;case"error":i=!0,e="stopped_error",t=(0,s.dy)(x||(x=V`<br><br>${0}`),this.trace.error);break;default:i=!0,e="stopped_unknown_reason"}o={description:(0,s.dy)(L||(L=V`${0} ${0}`),this.hass.localize(`ui.panel.config.automation.trace.messages.${e}`,{reason:this.trace.script_execution,time:r(),executiontime:n()}),t||""),icon:H,className:i?"error":void 0}}return e.push((0,s.dy)(C||(C=V` <ha-timeline last-item .icon="${0}" class="${0}"> ${0} </ha-timeline> `),o.icon,(0,c.o)(o.className),o.description)),(0,s.dy)(N||(N=V`${0}`),e)}},{kind:"method",key:"updated",value:function(e){if((0,r.Z)(i,"updated",this,3)([e]),this.allowPick&&e.has("trace")&&this.trace&&this.selectedPath&&!(this.selectedPath in this.trace.trace)){const e=this.shadowRoot.querySelector("ha-timeline[data-path]");e&&((0,h.B)(this,"value-changed",{value:e.dataset.path}),this.selectedPath=e.dataset.path)}(e.has("trace")||e.has("selectedPath"))&&this.shadowRoot.querySelectorAll("ha-timeline[data-path]").forEach((e=>{if((0,u.X)(e,"selected",this.selectedPath===e.dataset.path),!this.allowPick||0===e.tabIndex)return;e.tabIndex=0;const t=()=>{this.selectedPath=e.dataset.path,(0,h.B)(this,"value-changed",{value:e.dataset.path})};e.addEventListener("click",t),e.addEventListener("keydown",(e=>{"Enter"!==e.key&&" "!==e.key||t()})),e.addEventListener("mouseover",(()=>{e.raised=!0})),e.addEventListener("mouseout",(()=>{e.raised=!1}))}))}},{kind:"get",static:!0,key:"styles",value:function(){return[(0,s.iv)(w||(w=V`ha-timeline[lastItem].condition{--timeline-ball-color:var(--error-color)}ha-timeline[data-path]{cursor:pointer}ha-timeline[selected]{--timeline-ball-color:var(--primary-color)}ha-timeline:focus{outline:0;--timeline-ball-color:var(--accent-color)}.error{--timeline-ball-color:var(--error-color);color:var(--error-color)}`))]}}]}}),s.oi);t()}catch(m){t(m)}}))},43770:function(e,t,i){i.d(t,{b:()=>r});let a;const r=(0,i(57243).iv)(a||(a=(e=>e)`.tabs{background-color:var(--primary-background-color);border-top:1px solid var(--divider-color);border-bottom:1px solid var(--divider-color);display:flex;padding-left:4px;padding-inline-start:4px;padding-inline-end:initial}.tabs.top{border-top:none}.tabs>*{padding:2px 16px;cursor:pointer;position:relative;bottom:-1px;border:none;border-bottom:2px solid transparent;user-select:none;background:0 0;color:var(--primary-text-color);outline:0;transition:background 15ms linear}.tabs>.active{border-bottom-color:var(--primary-color)}.tabs>:focus,.tabs>:hover{background:var(--secondary-background-color)}`))},25433:function(e,t,i){i.d(t,{MY:()=>k,Yc:()=>g,hb:()=>v,jV:()=>d,o1:()=>p,ri:()=>f,sS:()=>h});i(71695),i(40251),i(19134),i(11740),i(97003),i(88044),i(47021);var a=i(73358),r=i(73850),n=i(59847),s=i(85746),o=i(96194);const c="ui.components.logbook.messages",d=["counter","proximity","sensor","zone"],l={triggered_by_numeric_state_of:"numeric state of",triggered_by_state_of:"state of",triggered_by_event:"event",triggered_by_time_pattern:"time pattern",triggered_by_time:"time",triggered_by_homeassistant_stopping:"ioBroker stopping",triggered_by_homeassistant_starting:"ioBroker starting"},h=async(e,t,i)=>u(e,t,void 0,void 0,i),u=(e,t,i,a,r,n)=>{if((a||n)&&(!a||0===a.length)&&(!n||0===n.length))return Promise.resolve([]);const s={type:"logbook/get_events",start_time:t};return i&&(s.end_time=i),null!=a&&a.length&&(s.entity_ids=a),null!=n&&n.length&&(s.device_ids=n),r&&(s.context_id=r),e.callWS(s)},g=(e,t,i,a,r,n)=>{if((r||n)&&(!r||0===r.length)&&(!n||0===n.length))return Promise.reject("No entities or devices");const s={type:"logbook/event_stream",start_time:i,end_time:a};return null!=r&&r.length&&(s.entity_ids=r),null!=n&&n.length&&(s.device_ids=n),e.connection.subscribeMessage((e=>t(e)),s)},p=(e,t)=>({entity_id:e.entity_id,state:t,attributes:{device_class:null==e?void 0:e.attributes.device_class,source_type:null==e?void 0:e.attributes.source_type,has_date:null==e?void 0:e.attributes.has_date,has_time:null==e?void 0:e.attributes.has_time,entity_picture_local:a.iY.has((0,r.M)(e.entity_id))||null==e?void 0:e.attributes.entity_picture_local,entity_picture:a.iY.has((0,r.M)(e.entity_id))||null==e?void 0:e.attributes.entity_picture}}),v=(e,t)=>{for(const i of Object.keys(l)){const a=l[i];if(t.startsWith(a))return t.replace(a,`${e(`ui.components.logbook.${i}`)}`)}return t},f=(e,t,i,r,n)=>{switch(n){case"device_tracker":case"person":return"not_home"===i?t(`${c}.was_away`):"home"===i?t(`${c}.was_at_home`):t(`${c}.was_at_state`,{state:i});case"sun":return t("above_horizon"===i?`${c}.rose`:`${c}.set`);case"binary_sensor":{const n=i===a.uo,o=i===a.lC,d=r.attributes.device_class;if(d&&(n||o))return t(`${c}.${n?"detected_device_classes":"cleared_device_classes"}.${d}`,{device_class:(0,s.V)(t(`component.binary_sensor.entity_component.${d}.name`)||d,e.language)})||t(`${c}.${n?"detected_device_class":"cleared_device_class"}`,{device_class:(0,s.V)(t(`component.binary_sensor.entity_component.${d}.name`)||d,e.language)});break}case"cover":switch(i){case"open":return t(`${c}.was_opened`);case"opening":return t(`${c}.is_opening`);case"closing":return t(`${c}.is_closing`);case"closed":return t(`${c}.was_closed`)}break;case"event":return t(`${c}.detected_event_no_type`);case"lock":switch(i){case"unlocked":return t(`${c}.was_unlocked`);case"locking":return t(`${c}.is_locking`);case"unlocking":return t(`${c}.is_unlocking`);case"opening":return t(`${c}.is_opening`);case"open":return t(`${c}.is_opened`);case"locked":return t(`${c}.was_locked`);case"jammed":return t(`${c}.is_jammed`)}}return i===a.uo?t(`${c}.turned_on`):i===a.lC?t(`${c}.turned_off`):i===o.lz?t(`${c}.became_unknown`):i===o.nZ?t(`${c}.became_unavailable`):e.localize(`${c}.changed_to_state`,{state:r?e.formatEntityState(r,i):i})},k=e=>"sensor"!==(0,n.N)(e)||void 0===e.attributes.unit_of_measurement&&void 0===e.attributes.state_class},18117:function(e,t,i){i.d(t,{G:()=>a});i(19134),i(5740);const a=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},72183:function(e,t,i){var a=i(36888).end,r=i(37588);e.exports=r("trimEnd")?function(){return a(this)}:"".trimEnd},52128:function(e,t,i){i(85284);var a=i(40810),r=i(72183);a({target:"String",proto:!0,name:"trimEnd",forced:"".trimEnd!==r},{trimEnd:r})},85284:function(e,t,i){var a=i(40810),r=i(72183);a({target:"String",proto:!0,name:"trimEnd",forced:"".trimRight!==r},{trimRight:r})},74760:function(e,t,i){i.d(t,{D:()=>s});i(95078),i(23669),i(69235),i(12385),i(19134),i(5740),i(11740),i(44495),i(97003),i(32114);var a=i(76808),r=i(53907),n=i(18112);function s(e,t){var i;const s=()=>(0,r.L)(null==t?void 0:t.in,NaN),v=null!==(i=null==t?void 0:t.additionalDigits)&&void 0!==i?i:2,f=function(e){const t={},i=e.split(o.dateTimeDelimiter);let a;if(i.length>2)return t;/:/.test(i[0])?a=i[0]:(t.date=i[0],a=i[1],o.timeZoneDelimiter.test(t.date)&&(t.date=e.split(o.timeZoneDelimiter)[0],a=e.substr(t.date.length,e.length)));if(a){const e=o.timezone.exec(a);e?(t.time=a.replace(e[1],""),t.timezone=e[1]):t.time=a}return t}(e);let k;if(f.date){const e=function(e,t){const i=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),a=e.match(i);if(!a)return{year:NaN,restDateString:""};const r=a[1]?parseInt(a[1]):null,n=a[2]?parseInt(a[2]):null;return{year:null===n?r:100*n,restDateString:e.slice((a[1]||a[2]).length)}}(f.date,v);k=function(e,t){if(null===t)return new Date(NaN);const i=e.match(c);if(!i)return new Date(NaN);const a=!!i[4],r=h(i[1]),n=h(i[2])-1,s=h(i[3]),o=h(i[4]),d=h(i[5])-1;if(a)return function(e,t,i){return t>=1&&t<=53&&i>=0&&i<=6}(0,o,d)?function(e,t,i){const a=new Date(0);a.setUTCFullYear(e,0,4);const r=a.getUTCDay()||7,n=7*(t-1)+i+1-r;return a.setUTCDate(a.getUTCDate()+n),a}(t,o,d):new Date(NaN);{const e=new Date(0);return function(e,t,i){return t>=0&&t<=11&&i>=1&&i<=(g[t]||(p(e)?29:28))}(t,n,s)&&function(e,t){return t>=1&&t<=(p(e)?366:365)}(t,r)?(e.setUTCFullYear(t,n,Math.max(r,s)),e):new Date(NaN)}}(e.restDateString,e.year)}if(!k||isNaN(+k))return s();const m=+k;let b,y=0;if(f.time&&(y=function(e){const t=e.match(d);if(!t)return NaN;const i=u(t[1]),r=u(t[2]),n=u(t[3]);if(!function(e,t,i){if(24===e)return 0===t&&0===i;return i>=0&&i<60&&t>=0&&t<60&&e>=0&&e<25}(i,r,n))return NaN;return i*a.vh+r*a.yJ+1e3*n}(f.time),isNaN(y)))return s();if(!f.timezone){const e=new Date(m+y),i=(0,n.Q)(0,null==t?void 0:t.in);return i.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),i.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),i}return b=function(e){if("Z"===e)return 0;const t=e.match(l);if(!t)return 0;const i="+"===t[1]?-1:1,r=parseInt(t[2]),n=t[3]&&parseInt(t[3])||0;if(!function(e,t){return t>=0&&t<=59}(0,n))return NaN;return i*(r*a.vh+n*a.yJ)}(f.timezone),isNaN(b)?s():(0,n.Q)(m+y+b,null==t?void 0:t.in)}const o={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},c=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,d=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,l=/^([+-])(\d{2})(?::?(\d{2}))?$/;function h(e){return e?parseInt(e):1}function u(e){return e&&parseFloat(e.replace(",","."))||0}const g=[31,null,31,30,31,30,31,31,30,31,30,31];function p(e){return e%400==0||e%4==0&&e%100!=0}}}]);
//# sourceMappingURL=93025.5589c5f552cd2435.js.map