iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
37 lines • 52.4 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[80850],{82286:function(e,t,a){a.d(t,{$:function(){return i}});const i=(e,t)=>s(e.attributes,t),s=(e,t)=>0!==(e.supported_features&t)},34470:function(e,t,a){a.d(t,{E:function(){return s}});let i;const s=(0,a(5124).AH)(i||(i=(e=>e)`ha-state-icon[data-domain=alarm_control_panel][data-state=arming],ha-state-icon[data-domain=alarm_control_panel][data-state=pending],ha-state-icon[data-domain=alarm_control_panel][data-state=triggered],ha-state-icon[data-domain=lock][data-state=jammed]{animation:pulse 1s infinite}@keyframes pulse{0%{opacity:1}50%{opacity:0}100%{opacity:1}}ha-state-icon[data-state=unavailable]{color:var(--state-unavailable-color)}`))},60353:function(e,t,a){a.d(t,{u:function(){return i}});class i{start(e){const t=Date.now();this._startY=e,this._startTime=t,this._lastY=e,this._lastTime=t,this._delta=0}move(e){const t=Date.now();return this._delta=this._startY-e,this._lastY=e,this._lastTime=t,this._delta}end(){const e=this.getVelocity(),t=Math.abs(e)>this._velocityThreshold;return{velocity:e,delta:this._delta,isSwipe:t,isDownwardSwipe:e>0}}getDelta(){return this._delta}getVelocity(){if(Date.now()-this._lastTime>=this._movementTimeThreshold)return 0;const e=this._lastTime-this._startTime;return e>0?(this._lastY-this._startY)/e:0}reset(){this._startY=0,this._delta=0,this._startTime=0,this._lastY=0,this._lastTime=0}constructor(e={}){var t,a;this._startY=0,this._delta=0,this._startTime=0,this._lastY=0,this._lastTime=0,this._velocityThreshold=null!==(t=e.velocitySwipeThreshold)&&void 0!==t?t:.5,this._movementTimeThreshold=null!==(a=e.movementTimeThreshold)&&void 0!==a?a:100}}},3931:function(e,t,a){a.d(t,{U:function(){return i}});a(3362),a(62953);const i=async(e,t,a,i,s,...r)=>{let o=i[e];o||(o=i[e]={});const n=o[s];if(n)return n;const l=a(i,s,...r);return o[s]=l,l.then(()=>setTimeout(()=>{o[s]=void 0},t),()=>{o[s]=void 0}),l}},64481:function(e,t,a){a.d(t,{D:function(){return s},J:function(){return o}});a(16280),a(3362),a(55815),a(64979),a(79739);let i=!1;try{i="true"===window.localStorage.getItem("disableViewTransition")}catch(n){}const s=e=>{i=e},r=e=>{if(!(e=>(e instanceof DOMException||e instanceof Error)&&"AbortError"===e.name)(e))throw e},o=e=>{if(!document.startViewTransition||i)return e(!1),Promise.resolve();let t=!1;try{const a=document.startViewTransition(()=>{t=!0,e(!0)});return a.ready.catch(r),a.finished.catch(r)}catch(a){return console.warn("View transition failed, falling back to direct execution.",a),t?Promise.reject(a):(e(!1),Promise.resolve())}}},74281:function(e,t,a){a.a(e,async function(e,t){try{a(18111),a(7588),a(45367),a(92731),a(62953);var i=a(40445),s=a(5124),r=a(67576),o=a(63672),n=a(89784),l=a(71727),d=a(69093),h=a(52658),c=a(34470),p=a(10897),u=a(38279),g=a(93367),v=e([g]);g=(v.then?(await v)():v)[0];let m,_,f,b=e=>e;const y="M13 14H11V9H13M13 18H11V16H13M1 21H23L12 2L1 21Z";class w extends s.WF{connectedCallback(){var e,t;super.connectedCallback(),this.hasUpdated&&void 0===this.overrideImage&&(null!==(e=this.stateObj)&&void 0!==e&&e.attributes.entity_picture||null!==(t=this.stateObj)&&void 0!==t&&t.attributes.entity_picture_local)&&this.requestUpdate("stateObj")}disconnectedCallback(){var e,t;super.disconnectedCallback(),void 0===this.overrideImage&&(null!==(e=this.stateObj)&&void 0!==e&&e.attributes.entity_picture||null!==(t=this.stateObj)&&void 0!==t&&t.attributes.entity_picture_local)&&(this.style.backgroundImage="")}get _stateColor(){var e;const t=this.stateObj?(0,d.t)(this.stateObj):void 0;return null!==(e=this.stateColor)&&void 0!==e?e:"light"===t}render(){const e=this.stateObj;if(!e&&!this.overrideIcon&&!this.overrideImage)return(0,s.qy)(m||(m=b`<div class="missing"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div>`),y);const t=this.getClass();if(t&&t.forEach((e,t)=>{e?this.classList.add(t):this.classList.remove(t)}),!this.icon)return s.s6;const a=e?(0,d.t)(e):void 0;return(0,s.qy)(_||(_=b`<ha-state-icon style="${0}" data-domain="${0}" data-state="${0}" .icon="${0}" .stateObj="${0}"></ha-state-icon>`),(0,n.W)(this._iconStyle),(0,o.J)(a),(0,o.J)(null==e?void 0:e.state),this.overrideIcon,e)}willUpdate(e){if(super.willUpdate(e),!(e.has("stateObj")||e.has("overrideImage")||e.has("overrideIcon")||e.has("stateColor")||e.has("color")))return;const t=this.stateObj,a={};let i="";if(this.icon=!0,t){const e=(0,l.m)(t.entity_id);if(void 0===this.overrideImage)if(!t.attributes.entity_picture_local&&!t.attributes.entity_picture||this.overrideIcon){if(this.color)a.color=this.color;else if(this._stateColor){const e=(0,h.Se)(t);if(e&&(a.color=e),t.attributes.rgb_color&&(a.color=`rgb(${t.attributes.rgb_color.join(",")})`),t.attributes.brightness){const e=t.attributes.brightness;if("number"!=typeof e){const a=`Type error: state-badge expected number, but type of ${t.entity_id}.attributes.brightness is ${typeof e} (${e})`;console.warn(a)}a.filter=(0,h.mT)(t)}if(t.attributes.hvac_action){const e=t.attributes.hvac_action;e in u.sx?a.color=(0,h.Se)(t,u.sx[e]):delete a.color}}}else{let a=t.attributes.entity_picture_local||t.attributes.entity_picture;this.hass&&(a=this.hass.hassUrl(a)),"camera"===e&&(a=(0,p.su)(a,80,80)),i=`url(${a})`,this.icon=!1}else if(this.overrideImage){let e=this.overrideImage;this.hass&&(e=this.hass.hassUrl(e)),i=`url(${e})`,this.icon=!1}}this._iconStyle=a,this.style.backgroundImage=i}getClass(){const e=new Map(["has-no-radius","has-media-image","has-image"].map(e=>[e,!1]));if(this.stateObj){const t=(0,l.m)(this.stateObj.entity_id);"update"===t?e.set("has-no-radius",!0):"media_player"===t||"camera"===t?e.set("has-media-image",!0):""!==this.style.backgroundImage&&e.set("has-image",!0)}return e}static get styles(){return[c.E,(0,s.AH)(f||(f=b`:host{position:relative;display:inline-flex;width:40px;color:var(--state-icon-color);border-radius:var(--state-badge-border-radius,50%);height:40px;background-size:cover;box-sizing:border-box;--state-inactive-color:initial;align-items:center;justify-content:center}:host(.has-image){border-radius:var(--state-badge-with-image-border-radius,50%)}:host(.has-media-image){border-radius:var(--state-badge-with-media-image-border-radius,8%)}:host(.has-no-radius){border-radius:var(--ha-border-radius-square)}:host(:focus){outline:0}:host(:not([icon]):focus){border:2px solid var(--divider-color)}:host([icon]:focus){background:var(--divider-color)}ha-state-icon{transition:color .3s ease-in-out,filter .3s ease-in-out}.missing{color:#fce588}`))]}constructor(...e){super(...e),this.icon=!0,this._iconStyle={}}}(0,i.Cg)([(0,r.MZ)({attribute:!1})],w.prototype,"stateObj",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],w.prototype,"overrideIcon",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],w.prototype,"overrideImage",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],w.prototype,"stateColor",void 0),(0,i.Cg)([(0,r.MZ)()],w.prototype,"color",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],w.prototype,"icon",void 0),(0,i.Cg)([(0,r.wk)()],w.prototype,"_iconStyle",void 0),w=(0,i.Cg)([(0,r.EM)("state-badge")],w),t()}catch(m){t(m)}})},99611:function(e,t,a){a.a(e,async function(e,t){try{a(18111),a(13579),a(3362),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698),a(62953);var i=a(40445),s=a(1126),r=a(35211),o=a(5124),n=a(67576),l=a(1087),d=a(60353),h=a(22792),c=a(59992),p=a(14503),u=a(22348),g=e([s,c]);[s,c]=g.then?(await g)():g;let v,m,_=e=>e;const f=300,b=new Set(["ha-control-slider","ha-slider","ha-control-switch","ha-control-circular-slider","ha-hs-color-picker","ha-map","ha-more-info-control-select-container","ha-filter-chip"]),y=new Set(["volume-slider-container","forecast"]);class w extends((0,c.V)(o.WF)){get scrollableElement(){return this._bodyElement}connectedCallback(){super.connectedCallback(),this.addEventListener("slider-interaction-start",this._handleSliderInteractionStart,{capture:!0}),this.addEventListener("slider-interaction-stop",this._handleSliderInteractionStop,{capture:!0})}updated(e){super.updated(e),e.has("open")&&(this._drawerOpen=this.open)}render(){return(0,o.qy)(v||(v=_` <wa-drawer id="drawer" placement="bottom" .open="${0}" .lightDismiss="${0}" .ariaLabelledby="${0}" .ariaDescribedby="${0}" @keydown="${0}" @wa-show="${0}" @wa-after-show="${0}" @wa-hide="${0}" @wa-after-hide="${0}" @click="${0}" without-header @touchstart="${0}"> <div class="handle-wrapper" aria-hidden="true"> <div class="handle"></div> </div> <slot name="header"></slot> <div class="content-wrapper"> <div id="body" class="body ha-scrollbar"> <slot></slot> </div> ${0} </div> <slot name="footer"></slot> </wa-drawer> `),this._drawerOpen,!this.preventScrimClose,this.ariaLabelledBy,this.ariaDescribedBy,this._handleKeyDown,this._handleShow,this._handleAfterShow,this._handleHide,this._handleAfterHide,this._handleCloseAction,this._handleTouchStart,this.renderScrollableFades())}_startResizing(e){document.addEventListener("touchmove",this._handleTouchMove,{passive:!1}),document.addEventListener("touchend",this._handleTouchEnd),document.addEventListener("touchcancel",this._handleTouchEnd),this._gestureRecognizer.start(e)}_animateSnapBack(){this.style.setProperty("--dialog-transition",`transform ${f}ms ease-out`),this.style.removeProperty("--dialog-transform"),setTimeout(()=>{this.style.removeProperty("--dialog-transition")},f)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("slider-interaction-start",this._handleSliderInteractionStart,{capture:!0}),this.removeEventListener("slider-interaction-stop",this._handleSliderInteractionStop,{capture:!0}),this._unregisterResizeHandlers(),this._isDragging=!1}static get styles(){return[...super.styles,p.dp,(0,o.AH)(m||(m=_`wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:${0}ms;--hide-duration:${0}ms}wa-drawer::part(dialog){max-height:min(var(--ha-bottom-sheet-max-height,90vh),calc(100vh - max(var(--safe-area-inset-top),48px)));max-height:min(var(--ha-bottom-sheet-max-height,90dvh),calc(100dvh - max(var(--safe-area-inset-top),48px)));align-items:center;transform:var(--dialog-transform);transition:var(--dialog-transition)}@media (prefers-reduced-motion:reduce){wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:1ms;--hide-duration:1ms}wa-drawer::part(dialog){transition:1ms}}wa-drawer::part(dialog)::backdrop{-webkit-backdrop-filter:var(--ha-bottom-sheet-scrim-backdrop-filter,var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none)));backdrop-filter:var(--ha-bottom-sheet-scrim-backdrop-filter,var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none)));background-color:var(--ha-bottom-sheet-scrim-color,var(--mdc-dialog-scrim-color,none))}wa-drawer::part(body){max-width:var(--ha-bottom-sheet-max-width);width:100%;position:relative;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)));background-color:var(--ha-bottom-sheet-surface-background,var(--ha-dialog-surface-background,var(--card-background-color,var(--ha-color-surface-default))));-webkit-backdrop-filter:var(--ha-bottom-sheet-surface-backdrop-filter,var(--ha-dialog-surface-backdrop-filter,none));backdrop-filter:var(--ha-bottom-sheet-surface-backdrop-filter,var(--ha-dialog-surface-backdrop-filter,none));padding:var(--ha-bottom-sheet-padding,0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left))}:host([flexcontent]) wa-drawer::part(body){display:flex;flex-direction:column}:host([prevent-scrim-close]) .handle-wrapper{display:none}.handle-wrapper{position:absolute;top:0;inset-inline-start:0;width:100%;padding-bottom:2px;display:flex;justify-content:center;align-items:center;pointer-events:none;z-index:1}.handle-wrapper .handle{height:16px;width:200px;display:flex;justify-content:center;align-items:center}.handle-wrapper .handle::after{content:"";border-radius:var(--ha-border-radius-md);height:4px;background:var(--ha-bottom-sheet-handle-color,var(--divider-color));width:40px}.content-wrapper{position:relative;flex:1;display:flex;flex-direction:column;min-height:0}.body{padding:var(--ha-bottom-sheet-content-padding,0);box-sizing:border-box}:host([flexcontent]) .body{flex:1;max-width:100%;display:flex;flex-direction:column;padding:var(--ha-bottom-sheet-content-padding,var(--ha-bottom-sheet-padding,0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left)));box-sizing:border-box}slot[name=footer]{display:block;padding:0}::slotted([slot=footer]){display:flex;padding:var(--ha-space-3) var(--ha-space-4) var(--ha-space-4) var(--ha-space-4);gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%;box-sizing:border-box}:host([flexcontent]) slot[name=footer]{flex-shrink:0}`),f,f)]}constructor(...e){super(...e),this.open=!1,this.flexContent=!1,this.preventScrimClose=!1,this._drawerOpen=!1,this._sliderInteractionActive=!1,this._gestureRecognizer=new d.u,this._isDragging=!1,this._escapePressed=!1,this._handleShow=async()=>{this._drawerOpen=!0,this.open=!0,(0,l.r)(this,"opened"),await this.updateComplete,requestAnimationFrame(()=>{var e;const t=this._autofocusElement;null!==(e=this._hassConfig)&&void 0!==e&&e.auth.external&&(0,u.V)(this._hassConfig.auth.external)?t&&(t.id||(t.id="ha-bottom-sheet-autofocus"),this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:t.id}})):null==t||t.focus()})},this._handleAfterShow=()=>{(0,l.r)(this,"after-show")},this._handleSliderInteractionStart=()=>{this._sliderInteractionActive=!0},this._handleSliderInteractionStop=()=>{this._sliderInteractionActive=!1},this._handleAfterHide=e=>{if(this._sliderInteractionActive)return this._drawerOpen=!0,void(this.open=!0);e.eventPhase===Event.AT_TARGET&&(this.open=!1,this._drawerOpen=!1,(0,l.r)(this,"closed"))},this._handleHide=e=>{if(e.eventPhase!==Event.AT_TARGET)return;const t=e.detail.source===e.target.drawer;if(this._sliderInteractionActive)return e.preventDefault(),this._drawerOpen=!0,this.open=!0,void(this._escapePressed=!1);this.preventScrimClose&&this._escapePressed&&t&&e.preventDefault(),this._escapePressed=!1},this._handleKeyDown=e=>{"Escape"===e.key&&(this._escapePressed=!0,this.preventScrimClose&&e.preventDefault(),e.stopPropagation(),e.currentTarget.open=!1)},this._handleCloseAction=e=>{e.composedPath().some(e=>e instanceof HTMLElement&&("close"===e.getAttribute("data-dialog")||"close"===e.getAttribute("data-drawer")))&&(this._drawerOpen=!1)},this._handleTouchStart=e=>{if(this.preventScrimClose)return;const t=e.composedPath();for(const a of t){if(a===this._drawer)break;if(a instanceof HTMLElement&&(a.scrollTop>0||b.has(a.localName)||Array.from(a.classList).some(e=>y.has(e))))return}e.stopPropagation(),this._startResizing(e.touches[0].clientY)},this._handleTouchMove=e=>{const t=e.touches[0].clientY,a=this._gestureRecognizer.move(t);a<0&&(e.preventDefault(),this._isDragging=!0,requestAnimationFrame(()=>{this._isDragging&&this.style.setProperty("--dialog-transform",`translateY(${-1*a}px)`)}))},this._handleTouchEnd=()=>{var e;this._unregisterResizeHandlers(),this._isDragging=!1;const t=this._gestureRecognizer.end();if(t.isSwipe)return void(t.isDownwardSwipe?this._drawerOpen=!1:this._animateSnapBack());const a=null===(e=this._drawer.shadowRoot)||void 0===e?void 0:e.querySelector('[part="body"]'),i=(null==a?void 0:a.offsetHeight)||0;i>0&&t.delta<0&&Math.abs(t.delta)>.5*i?this._drawerOpen=!1:this._animateSnapBack()},this._unregisterResizeHandlers=()=>{document.removeEventListener("touchmove",this._handleTouchMove),document.removeEventListener("touchend",this._handleTouchEnd),document.removeEventListener("touchcancel",this._handleTouchEnd)}}}(0,i.Cg)([(0,n.MZ)({attribute:"aria-labelledby"})],w.prototype,"ariaLabelledBy",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],w.prototype,"ariaDescribedBy",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean})],w.prototype,"open",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],w.prototype,"flexContent",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],w.prototype,"preventScrimClose",void 0),(0,i.Cg)([(0,n.wk)()],w.prototype,"_drawerOpen",void 0),(0,i.Cg)([(0,n.wk)()],w.prototype,"_sliderInteractionActive",void 0),(0,i.Cg)([(0,n.wk)(),(0,r.Fg)({context:h.WF,subscribe:!0})],w.prototype,"_hassConfig",void 0),(0,i.Cg)([(0,n.P)("#drawer")],w.prototype,"_drawer",void 0),(0,i.Cg)([(0,n.P)("#body")],w.prototype,"_bodyElement",void 0),(0,i.Cg)([(0,n.P)("[autofocus]")],w.prototype,"_autofocusElement",void 0),w=(0,i.Cg)([(0,n.EM)("ha-bottom-sheet")],w),t()}catch(v){t(v)}})},93444:function(e,t,a){var i=a(40445),s=a(5124),r=a(67576);let o,n,l=e=>e;class d extends s.WF{render(){return(0,s.qy)(o||(o=l` <footer> <slot name="secondaryAction"></slot> <slot name="primaryAction"></slot> </footer> `))}static get styles(){return[(0,s.AH)(n||(n=l`footer{display:flex;gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%}`))]}}d=(0,i.Cg)([(0,r.EM)("ha-dialog-footer")],d)},76538:function(e,t,a){a(62953);var i=a(40445),s=a(5124),r=a(67576);let o,n,l,d,h,c,p=e=>e;class u extends s.WF{render(){const e=(0,s.qy)(o||(o=p`<div class="header-title"> <slot name="title"></slot> </div>`)),t=(0,s.qy)(n||(n=p`<div class="header-subtitle"> <slot name="subtitle"></slot> </div>`));return(0,s.qy)(l||(l=p` <header class="header"> <div class="header-bar"> <section class="header-navigation-icon"> <slot name="navigationIcon"></slot> </section> <section class="header-content"> ${0} </section> <section class="header-action-items"> <slot name="actionItems"></slot> </section> </div> <slot></slot> </header> `),"above"===this.subtitlePosition?(0,s.qy)(d||(d=p`${0}${0}`),t,e):(0,s.qy)(h||(h=p`${0}${0}`),e,t))}static get styles(){return[(0,s.AH)(c||(c=p`:host{display:block}:host([show-border]){border-bottom:1px solid var(--mdc-dialog-scroll-divider-color,rgba(0,0,0,.12))}.header-bar{display:flex;flex-direction:row;align-items:center;padding:0 var(--ha-space-1);box-sizing:border-box}.header-content{flex:1;padding:10px var(--ha-space-1);display:flex;flex-direction:column;justify-content:center;min-height:var(--ha-space-12);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.header-title{height:var(--ha-dialog-header-title-height,calc(var(--ha-font-size-xl) + var(--ha-space-1)));font-size:var(--ha-font-size-xl);line-height:var(--ha-line-height-condensed);font-weight:var(--ha-font-weight-medium);color:var(--ha-dialog-header-title-color,var(--primary-text-color))}.header-subtitle{font-size:var(--ha-font-size-m);line-height:var(--ha-line-height-normal);color:var(--ha-dialog-header-subtitle-color,var(--secondary-text-color))}@media all and (min-width:450px) and (min-height:500px){.header-bar{padding:0 var(--ha-space-2)}}.header-navigation-icon{flex:none;min-width:var(--ha-space-2);height:100%;display:flex;flex-direction:row}.header-action-items{flex:none;min-width:var(--ha-space-2);height:100%;display:flex;flex-direction:row}`))]}constructor(...e){super(...e),this.subtitlePosition="below",this.showBorder=!1}}(0,i.Cg)([(0,r.MZ)({type:String,attribute:"subtitle-position"})],u.prototype,"subtitlePosition",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"show-border"})],u.prototype,"showBorder",void 0),u=(0,i.Cg)([(0,r.EM)("ha-dialog-header")],u)},72554:function(e,t,a){a.a(e,async function(e,t){try{a(3362),a(62953),a(49255);var i=a(40445),s=a(93900),r=a(35211),o=a(5124),n=a(67576),l=a(63672),d=a(1087),h=a(64481),c=a(22792),p=a(59992),u=a(14503),g=a(22348),v=(a(76538),a(26300)),m=e([s,v,p]);[s,v,p]=m.then?(await m)():m;let _,f,b,y,w,x,k,C=e=>e;const $="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";class S extends((0,p.V)(o.WF)){connectedCallback(){super.connectedCallback(),this.addEventListener("dialog-set-fullscreen",this._handleFullscreenChanged)}get scrollableElement(){return this.bodyContainer}updated(e){super.updated(e),e.has("open")&&(this._open=this.open)}render(){var e,t,a;return(0,o.qy)(_||(_=C` <wa-dialog .open="${0}" .lightDismiss="${0}" without-header aria-labelledby="${0}" aria-describedby="${0}" @keydown="${0}" @wa-hide="${0}" @wa-show="${0}" @wa-after-show="${0}" @wa-after-hide="${0}"> ${0} <div class="content-wrapper"> <div class="body ha-scrollbar" @scroll="${0}"> <slot></slot> </div> ${0} </div> <slot name="footer" slot="footer"></slot> </wa-dialog> `),this._open,!this.preventScrimClose,(0,l.J)(this.ariaLabelledBy||(void 0!==this.headerTitle?"ha-dialog-title":void 0)),(0,l.J)(this.ariaDescribedBy),this._handleKeyDown,this._handleHide,this._handleShow,this._handleAfterShow,this._handleAfterHide,this.withoutHeader?o.s6:(0,o.qy)(f||(f=C`<slot name="header"> <ha-dialog-header .subtitlePosition="${0}" .showBorder="${0}"> <slot name="headerNavigationIcon" slot="navigationIcon"> <ha-icon-button data-dialog="close" .label="${0}" .path="${0}"></ha-icon-button> </slot> ${0} ${0} <slot name="headerActionItems" slot="actionItems"></slot> </ha-dialog-header> </slot>`),this.headerSubtitlePosition,this._bodyScrolled,null!==(e=null===(t=this._i18n)||void 0===t||null===(a=t.localize)||void 0===a?void 0:a.call(t,"ui.common.close"))&&void 0!==e?e:"Close",$,void 0!==this.headerTitle?(0,o.qy)(b||(b=C`<span slot="title" class="title" id="ha-dialog-title"> ${0} </span>`),this.headerTitle):(0,o.qy)(y||(y=C`<slot name="headerTitle" slot="title"></slot>`)),void 0!==this.headerSubtitle?(0,o.qy)(w||(w=C`<span slot="subtitle">${0}</span>`),this.headerSubtitle):(0,o.qy)(x||(x=C`<slot name="headerSubtitle" slot="subtitle"></slot>`))),this._handleBodyScroll,this.renderScrollableFades())}disconnectedCallback(){this.removeEventListener("dialog-set-fullscreen",this._handleFullscreenChanged),this._setFullscreen(!1),super.disconnectedCallback(),this._open=!1}_handleFullscreenChanged(e){this._open?(0,h.J)(()=>{this._setFullscreen(e.detail)}):this._setFullscreen(e.detail)}_setFullscreen(e){this.toggleAttribute("fullscreen",e)}_handleBodyScroll(e){this._bodyScrolled=e.target.scrollTop>0}_handleKeyDown(e){"Escape"===e.key&&(this._escapePressed=!0,this.preventScrimClose&&e.preventDefault(),e.stopPropagation(),e.currentTarget.open=!1)}_handleHide(e){var t;const a=(null===(t=e.detail)||void 0===t?void 0:t.source)===e.target.dialog;this.preventScrimClose&&this._escapePressed&&a&&e.preventDefault(),this._escapePressed=!1}static get styles(){return[...super.styles,u.dp,(0,o.AH)(k||(k=C`wa-dialog{--full-width:var(
--ha-dialog-width-full,
min(95vw, var(--safe-width))
);--width:min(var(--ha-dialog-width-md, 580px), var(--full-width));--spacing:var(--dialog-content-padding, var(--ha-space-6));--show-duration:var(--ha-dialog-show-duration, 200ms);--hide-duration:var(--ha-dialog-hide-duration, 200ms);--wa-color-surface-raised:var(
--ha-dialog-surface-background,
var(--card-background-color, var(--ha-color-surface-default))
);--wa-panel-border-radius:var(
--ha-dialog-border-radius,
var(--ha-border-radius-3xl)
);max-width:var(--ha-dialog-max-width,var(--safe-width))}@media (prefers-reduced-motion:reduce){wa-dialog{--show-duration:0ms;--hide-duration:0ms}}:host([width=small]) wa-dialog{--width:min(var(--ha-dialog-width-sm, 320px), var(--full-width))}:host([width=large]) wa-dialog{--width:min(var(--ha-dialog-width-lg, 1024px), var(--full-width))}:host([fullscreen]) wa-dialog,:host([width=full]) wa-dialog{--width:var(--full-width)}:host([fullscreen]) wa-dialog::part(dialog){min-height:var(--safe-height);max-height:var(--safe-height);margin-top:0;transform:none}:host([fullscreen]) .content-wrapper{overflow:hidden}:host([fullscreen]) .body{overflow:hidden;padding:0}wa-dialog::part(dialog){-webkit-backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);box-shadow:var(--dialog-box-shadow,var(--wa-shadow-l));color:var(--primary-text-color);min-width:var(--width,var(--full-width));max-width:var(--width,var(--full-width));max-height:var(--ha-dialog-max-height,calc(var(--safe-height) - var(--ha-space-20)));min-height:var(--ha-dialog-min-height);margin-top:var(--dialog-surface-margin-top,auto);transform:translate(calc(var(--safe-area-offset-left,0px) - var(--safe-area-offset-right,0px)),calc(var(--safe-area-offset-top,0px) - var(--safe-area-offset-bottom,0px)));display:flex;flex-direction:column;overflow:hidden}wa-dialog::part(dialog)::backdrop{-webkit-backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));background-color:var(--mdc-dialog-scrim-color,none)}@media all and (max-width:450px),all and (max-height:500px){:host([type=standard]){--ha-dialog-border-radius:0}:host([type=standard]) wa-dialog{--full-width:var(--ha-dialog-width-full, 100vw);--width:var(--full-width)}:host([type=standard]) wa-dialog::part(dialog){min-height:var(--ha-dialog-min-height,100vh);min-height:var(--ha-dialog-min-height,100dvh);max-height:var(--ha-dialog-max-height,100vh);max-height:var(--ha-dialog-max-height,100dvh);margin-top:0;margin-bottom:0;padding-top:var(--safe-area-inset-top);padding-bottom:var(--safe-area-inset-bottom);padding-left:var(--safe-area-inset-left);padding-right:var(--safe-area-inset-right);transform:none}}.header-title-container{display:flex;align-items:center}.header-title{margin:0;margin-bottom:0;color:var(--ha-dialog-header-title-color,var(--primary-text-color));font-size:var(
--ha-dialog-header-title-font-size,
var(--ha-font-size-2xl)
);line-height:var(
--ha-dialog-header-title-line-height,
var(--ha-line-height-condensed)
);font-weight:var(--ha-dialog-header-title-font-weight,var(--ha-font-weight-normal));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-right:var(--ha-space-3)}wa-dialog::part(body){padding:0;display:flex;flex-direction:column;max-width:100%;overflow:hidden}.content-wrapper{position:relative;flex:1;display:flex;flex-direction:column;min-height:0}.body{position:var(--dialog-content-position,relative);padding:var(--dialog-content-padding,0 var(--ha-space-6) var(--ha-space-6) var(--ha-space-6));overflow:auto;flex-grow:1}:host([flexcontent]) .body{max-width:100%;flex:1;display:flex;flex-direction:column}wa-dialog::part(footer){padding:0}::slotted([slot=footer]){display:flex;padding:var(--ha-space-3) var(--ha-space-4) var(--ha-space-4) var(--ha-space-4);gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%}`))]}constructor(...e){super(...e),this.open=!1,this.type="standard",this.width="medium",this.preventScrimClose=!1,this.headerSubtitlePosition="below",this.flexContent=!1,this.withoutHeader=!1,this._open=!1,this._bodyScrolled=!1,this._escapePressed=!1,this._handleShow=async e=>{e.eventPhase===Event.AT_TARGET&&(this._open=!0,(0,d.r)(this,"opened"),await this.updateComplete,requestAnimationFrame(()=>{var e,t;if(null!==(e=this._hassConfig)&&void 0!==e&&e.auth.external&&(0,g.V)(this._hassConfig.auth.external)){const e=this.querySelector("[autofocus]");return void(null!==e&&(e.id||(e.id="ha-dialog-autofocus"),this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:e.id}})))}null===(t=this.querySelector("[autofocus]"))||void 0===t||t.focus()}))},this._handleAfterShow=e=>{e.eventPhase===Event.AT_TARGET&&(0,d.r)(this,"after-show")},this._handleAfterHide=e=>{e.eventPhase===Event.AT_TARGET&&(this._open=!1,this._setFullscreen(!1),(0,d.r)(this,"closed"))}}}(0,i.Cg)([(0,n.MZ)({attribute:"aria-labelledby"})],S.prototype,"ariaLabelledBy",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],S.prototype,"ariaDescribedBy",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],S.prototype,"open",void 0),(0,i.Cg)([(0,n.MZ)({reflect:!0})],S.prototype,"type",void 0),(0,i.Cg)([(0,n.MZ)({type:String,reflect:!0,attribute:"width"})],S.prototype,"width",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],S.prototype,"preventScrimClose",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"header-title"})],S.prototype,"headerTitle",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"header-subtitle"})],S.prototype,"headerSubtitle",void 0),(0,i.Cg)([(0,n.MZ)({type:String,attribute:"header-subtitle-position"})],S.prototype,"headerSubtitlePosition",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],S.prototype,"flexContent",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,attribute:"without-header"})],S.prototype,"withoutHeader",void 0),(0,i.Cg)([(0,n.wk)()],S.prototype,"_open",void 0),(0,i.Cg)([(0,n.P)(".body")],S.prototype,"bodyContainer",void 0),(0,i.Cg)([(0,n.wk)(),(0,r.Fg)({context:c.D5,subscribe:!0})],S.prototype,"_i18n",void 0),(0,i.Cg)([(0,n.wk)(),(0,r.Fg)({context:c.WF,subscribe:!0})],S.prototype,"_hassConfig",void 0),(0,i.Cg)([(0,n.wk)()],S.prototype,"_bodyScrolled",void 0),(0,i.Cg)([(0,n.Ls)({passive:!0})],S.prototype,"_handleBodyScroll",null),S=(0,i.Cg)([(0,n.EM)("ha-dialog")],S),t()}catch(_){t(_)}})},34127:function(e,t,a){a.a(e,async function(e,t){try{a(62953);var i=a(40445),s=a(52630),r=a(5124),o=a(67576),n=e([s]);s=(n.then?(await n)():n)[0];let l,d=e=>e;class h extends s.A{static get styles(){return[s.A.styles,(0,r.AH)(l||(l=d`:host{--wa-tooltip-background-color:var(
--ha-tooltip-background-color,
var(--ha-color-surface-default)
);--wa-tooltip-content-color:var(
--ha-tooltip-text-color,
var(--primary-text-color)
);--wa-tooltip-font-family:var(
--ha-tooltip-font-family,
var(--ha-font-family-body)
);--wa-tooltip-font-size:var(
--ha-tooltip-font-size,
var(--ha-font-size-m)
);--wa-tooltip-font-weight:var(
--ha-tooltip-font-weight,
var(--ha-font-weight-medium)
);--wa-tooltip-line-height:var(
--ha-tooltip-line-height,
var(--ha-line-height-condensed)
);--wa-tooltip-padding:var(--ha-tooltip-padding, var(--ha-space-2));--wa-tooltip-border-radius:var(
--ha-tooltip-border-radius,
var(--ha-border-radius-md)
);--wa-tooltip-arrow-size:var(--ha-tooltip-arrow-size, 0px);--wa-tooltip-border-width:0px;--wa-z-index-tooltip:1000}.tooltip::part(popup){animation-duration:var(--ha-tooltip-animation-duration, 0)}.body{box-shadow:var(--ha-tooltip-box-shadow,var(--ha-box-shadow-m))}`))]}constructor(...e){super(...e),this.showDelay=350,this.hideDelay=150}}(0,i.Cg)([(0,o.MZ)({attribute:"show-delay",type:Number})],h.prototype,"showDelay",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"hide-delay",type:Number})],h.prototype,"hideDelay",void 0),h=(0,i.Cg)([(0,o.EM)("ha-tooltip")],h),t()}catch(l){t(l)}})},83892:function(e,t,a){a.d(t,{x:function(){return v}});a(18111),a(13579),a(27495),a(42762),a(62953);var i=a(40445),s=a(92070),r=a(5124),o=a(67576);let n,l,d,h,c,p,u,g=e=>e;class v extends r.WF{_onSlotChange(e){return t=>{const a=t.target.assignedNodes({flatten:!0}).some(e=>{var t;return e.nodeType===Node.ELEMENT_NODE||e.nodeType===Node.TEXT_NODE&&""!==(null===(t=e.textContent)||void 0===t?void 0:t.trim())});"start"===e?this._hasStart=a:this._hasEnd=a}}render(){return this._renderBase(this._renderInner())}_renderBase(e){return(0,r.qy)(n||(n=g`<div part="base" class="base" id="item">${0}</div>`),e)}_renderInner(){const e=this._slotController.test("content");return(0,r.qy)(l||(l=g` <div part="start" class="start" ?hidden="${0}"> <slot name="start" @slotchange="${0}"></slot> </div> <div part="content" class="content"> ${0} </div> <div part="end" class="end" ?hidden="${0}"> <slot name="end" @slotchange="${0}"></slot> </div> `),!this._hasStart,this._onSlotChange("start"),e?(0,r.qy)(d||(d=g`<slot name="content"></slot>`)):this._renderDefaultContent(),!this._hasEnd,this._onSlotChange("end"))}_renderDefaultContent(){var e,t;const a=this._slotController.test("headline"),i=this._slotController.test("supporting-text"),s=a||void 0!==this.headline,o=i||void 0!==this.supportingText;return(0,r.qy)(h||(h=g` ${0} ${0} `),s?(0,r.qy)(c||(c=g`<div part="headline" class="headline"> <slot name="headline">${0}</slot> </div>`),null!==(e=this.headline)&&void 0!==e?e:r.s6):r.s6,o?(0,r.qy)(p||(p=g`<div part="supporting-text" class="supporting"> <slot name="supporting-text">${0}</slot> </div>`),null!==(t=this.supportingText)&&void 0!==t?t:r.s6):r.s6)}constructor(...e){super(...e),this.disabled=!1,this._slotController=new s.X(this,"headline","supporting-text","content"),this._hasStart=!1,this._hasEnd=!1}}v.styles=(0,r.AH)(u||(u=g`:host{display:block;color:var(--primary-text-color);font-size:var(--ha-font-size-m);line-height:var(--ha-line-height-normal)}:host([disabled]){color:var(--disabled-text-color);pointer-events:none}.base{position:relative;display:flex;flex-direction:row;align-items:center;gap:var(--ha-row-item-gap,var(--ha-space-4));padding-block:var(--ha-row-item-padding-block,var(--ha-space-3));padding-inline:var(--ha-row-item-padding-inline,var(--ha-space-4));min-height:var(--ha-row-item-min-height,48px);box-sizing:border-box}.content{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;justify-content:center}.end,.start{display:flex;align-items:center;flex:0 0 auto}.end[hidden],.start[hidden]{display:none}.headline{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.supporting{color:var(--secondary-text-color);font-size:var(--ha-font-size-s);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}`)),(0,i.Cg)([(0,o.MZ)({type:String})],v.prototype,"headline",void 0),(0,i.Cg)([(0,o.MZ)({type:String,attribute:"supporting-text"})],v.prototype,"supportingText",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],v.prototype,"disabled",void 0),(0,i.Cg)([(0,o.wk)()],v.prototype,"_hasStart",void 0),(0,i.Cg)([(0,o.wk)()],v.prototype,"_hasEnd",void 0),v=(0,i.Cg)([(0,o.EM)("ha-row-item")],v)},82e3:function(e,t,a){a.d(t,{D5:function(){return i},Fy:function(){return o},Gk:function(){return d},Hg:function(){return s},Y_:function(){return h},ds:function(){return l},e0:function(){return r},ec:function(){return n}});a(74423),a(18111),a(61701),a(33110),a(3362);const i=14881==a.j?`${location.protocol}//${location.host}`:null,s=e=>e.map(e=>{if("string"!==e.type)return e;switch(e.name){case"username":return Object.assign(Object.assign({},e),{},{autocomplete:"username",autofocus:!0});case"password":return Object.assign(Object.assign({},e),{},{autocomplete:"current-password"});case"code":return Object.assign(Object.assign({},e),{},{autocomplete:"one-time-code",autofocus:!0});default:return e}}),r=(e,t)=>e.callWS({type:"auth/sign_path",path:t}),o=async(e,t,a,i)=>e.callWS({type:"config/auth_provider/homeassistant/create",user_id:t,username:a,password:i}),n=(e,t,a)=>e.callWS({type:"config/auth_provider/homeassistant/change_password",current_password:t,new_password:a}),l=(e,t,a)=>e.callWS({type:"config/auth_provider/homeassistant/admin_change_password",user_id:t,password:a}),d=(e,t,a)=>e.callWS({type:"config/auth_provider/homeassistant/admin_change_username",user_id:t,username:a}),h=(e,t,a)=>e.callWS({type:"auth/delete_all_refresh_tokens",token_type:t,delete_current_token:a})},10897:function(e,t,a){a.d(t,{C4:function(){return d},CK:function(){return l},FX:function(){return v},UC:function(){return u},_Z:function(){return b},bT:function(){return y},j4:function(){return _},sd:function(){return r},su:function(){return n},vc:function(){return f},w8:function(){return p},wv:function(){return c},y3:function(){return g},zS:function(){return o}});a(3362);var i=a(3931),s=a(82e3);const r=[1,2,3,4,6,8],o="web_rtc",n=(e,t,a)=>`${e}&width=${t}&height=${a}`,l=e=>e.attributes.access_token?`/api/camera_proxy_stream/${e.entity_id}?token=${e.attributes.access_token}`:void 0,d=async(e,t,a,s)=>{const r=await(0,i.U)("_cameraTmbUrl",9e3,h,e,t);return n(r,a,s)},h=async(e,t)=>{const a=await(0,s.e0)(e,`/api/camera_proxy/${t}`);return e.hassUrl(a.path)},c=async(e,t,a)=>{const i={type:"camera/stream",entity_id:t};a&&(i.format=a);const s=await e.callWS(i);return s.url=e.hassUrl(s.url),s},p=(e,t,a,i)=>e.connection.subscribeMessage(i,{type:"camera/webrtc/offer",entity_id:t,offer:a}),u=(e,t,a,i)=>e.callWS({type:"camera/webrtc/candidate",entity_id:t,session_id:a,candidate:i}),g=(e,t)=>e.callWS({type:"camera/get_prefs",entity_id:t}),v=(e,t,a)=>e.callWS(Object.assign({type:"camera/update_prefs",entity_id:t},a)),m="media-source://camera/",_=e=>e.startsWith(m),f=e=>e.substring(22),b=async(e,t)=>e.callWS({type:"camera/capabilities",entity_id:t}),y=async(e,t)=>e.callWS({type:"camera/webrtc/get_client_config",entity_id:t})},53756:function(e,t,a){a.d(t,{t:function(){return l},w:function(){return d}});a(74423),a(18111),a(22489),a(61701),a(62953);var i=a(71727),s=a(74705),r=a(28978),o=a(15638),n=a(95350);const l=[{name:"search_labels.entityName",weight:10},{name:"search_labels.friendlyName",weight:8},{name:"search_labels.deviceName",weight:7},{name:"search_labels.areaName",weight:6},{name:"search_labels.domainName",weight:6},{name:"search_labels.entityId",weight:3}],d=(e,t,a,l,d,h,c,p,u,g="")=>{let v,m=Object.keys(e.states);return c&&(m=m.filter(e=>c.includes(e))),p&&(m=m.filter(e=>!p.includes(e))),t&&(m=m.filter(e=>t.includes((0,i.m)(e)))),a&&(m=m.filter(e=>!a.includes((0,i.m)(e)))),v=m.map(t=>{const a=e.states[t],l=(0,r.u)(a),[d,h,c]=(0,s.Cf)(a,[{type:"entity"},{type:"device"},{type:"area"}],e.entities,e.devices,e.areas,e.floors),p=(0,n.p$)(e.localize,(0,i.m)(t)),u=(0,o.qC)(e.language,e.translationMetadata.translations),v=d||h||t,m=[c,d?h:void 0].filter(Boolean).join(u?" ◂ ":" ▸ ");return{id:`${g}${t}`,primary:v,secondary:m,domain_name:p,sorting_label:[v,m].filter(Boolean).join("_"),search_labels:{entityName:d||null,deviceName:h||null,areaName:c||null,domainName:p||null,friendlyName:l||null,entityId:t},stateObj:a}}),d&&(v=v.filter(e=>{var t;return e.id===u||(null===(t=e.stateObj)||void 0===t?void 0:t.attributes.device_class)&&d.includes(e.stateObj.attributes.device_class)})),h&&(v=v.filter(e=>{var t;return e.id===u||(null===(t=e.stateObj)||void 0===t?void 0:t.attributes.unit_of_measurement)&&h.includes(e.stateObj.attributes.unit_of_measurement)})),l&&(v=v.filter(e=>e.id===u||e.stateObj&&l(e.stateObj))),v}},24367:function(e,t,a){a.d(t,{L:function(){return s},z:function(){return r}});var i=a(23832);const s=["input_boolean","input_button","input_text","input_number","input_datetime","input_select","counter","timer","schedule"],r=(0,i.g)(s)},19711:function(e,t,a){a.d(t,{$:function(){return r}});a(3362),a(62953);var i=a(1087);const s=()=>Promise.all([a.e(80131),a.e(70183),a.e(47677)]).then(a.bind(a,79029)),r=(e,t)=>{(0,i.r)(e,"show-dialog",{dialogTag:"dialog-helper-detail",dialogImport:s,dialogParams:t})}},33256:function(e,t,a){a.a(e,async function(e,i){try{a.r(t);a(74423),a(18111),a(20116),a(13579),a(3362),a(42762),a(62953);var s=a(40445),r=a(5124),o=a(67576),n=a(22786),l=a(1087),d=a(77122),h=a(18350),c=a(72554),p=(a(93444),a(26300)),u=a(44002),g=a(91485),v=(a(83892),a(82e3)),m=a(28669),_=a(65063),f=a(14503),b=a(36918),y=a(44191),w=a(12176),x=e([d,h,c,p,u,g]);[d,h,c,p,u,g]=x.then?(await x)():x;let k,C,$,S,T,E,z,A,M,O,I,j,D=e=>e;const L="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",P=["device_tracker"],q={round:!0,quality:.75,aspectRatio:1};class H extends r.WF{async showDialog(e){var t,a,i;(this._params=e,this._error=void 0,this._params.entry)?(this._personExists=!0,this._name=this._params.entry.name||"",this._userId=this._params.entry.user_id||void 0,this._deviceTrackers=this._params.entry.device_trackers||[],this._picture=this._params.entry.picture||null,this._user=this._userId?null===(t=this._params.users)||void 0===t?void 0:t.find(e=>e.id===this._userId):void 0,this._isAdmin=null===(a=this._user)||void 0===a?void 0:a.group_ids.includes(m.wj),this._localOnly=null===(i=this._user)||void 0===i?void 0:i.local_only):(this._personExists=!1,this._name="",this._userId=void 0,this._user=void 0,this._isAdmin=void 0,this._localOnly=void 0,this._deviceTrackers=[],this._picture=null);this._open=!0,await this.updateComplete}closeDialog(){return this._open=!1,!0}_dialogClosed(){if(!this._personExists&&this._userId){var e;const t=null===(e=this._params)||void 0===e?void 0:e.refreshUsers;(0,m.hG)(this.hass,this._userId).then(()=>{null==t||t()}),this._userId=void 0}this._params=void 0,(0,l.r)(this,"dialog-closed",{dialog:this.localName})}render(){var e;if(!this._params)return r.s6;const t=""===this._name.trim();return(0,r.qy)(k||(k=D` <ha-dialog .open="${0}" prevent-scrim-close header-title="${0}" @closed="${0}"> <div> ${0} <div class="form"> <ha-input autofocus .value="${0}" @input="${0}" label="${0}" .validationMessage="${0}" required></ha-input> <ha-picture-upload .hass="${0}" .value="${0}" crop select-media .cropOptions="${0}" @change="${0}"></ha-picture-upload> <ha-row-item> <span slot="headline">${0}</span> <span slot="supporting-text">${0}</span> <ha-switch slot="end" @change="${0}" ?disabled="${0}" .checked="${0}"></ha-switch> </ha-row-item> ${0} ${0} </div> </div> <ha-dialog-footer slot="footer"> ${0} <ha-button slot="primaryAction" @click="${0}" .disabled="${0}"> ${0} </ha-button> </ha-dialog-footer> </ha-dialog> `),this._open,this._params.entry?this._params.entry.name:this.hass.localize("ui.panel.config.person.detail.new_person"),this._dialogClosed,this._error?(0,r.qy)(C||(C=D` <div class="error">${0}</div> `),this._error):"",this._name,this._nameChanged,this.hass.localize("ui.panel.config.person.detail.name"),this.hass.localize("ui.panel.config.person.detail.name_error_msg"),this.hass,this._picture,q,this._pictureChanged,this.hass.localize("ui.panel.config.person.detail.allow_login"),this.hass.localize("ui.panel.config.person.detail.allow_login_description"),this._allowLoginChanged,this._user&&(this._user.id===(null===(e=this.hass.user)||void 0===e?void 0:e.id)||this._user.system_generated||this._user.is_owner),this._userId,this._renderUserFields(),this._deviceTrackersAvailable(this.hass)?(0,r.qy)($||($=D` <p> ${0} </p> <ha-entities-picker .hass="${0}" .value="${0}" .includeDomains="${0}" .pickedEntityLabel="${0}" .pickEntityLabel="${0}" @value-changed="${0}"> </ha-entities-picker> `),this.hass.localize("ui.panel.config.person.detail.device_tracker_intro"),this.hass,this._deviceTrackers,P,this.hass.localize("ui.panel.config.person.detail.device_tracker_picked"),this.hass.localize("ui.panel.config.person.detail.device_tracker_pick"),this._deviceTrackersChanged):(0,r.qy)(S||(S=D` <p> ${0} </p> <ul> <li> <a href="${0}" target="_blank" rel="noreferrer">${0}</a> </li> <li> <a @click="${0}" href="/config/integrations"> ${0}</a> </li> </ul> `),this.hass.localize("ui.panel.config.person.detail.no_device_tracker_available_intro"),(0,b.o)(this.hass,"/integrations/#presence-detection"),this.hass.localize("ui.panel.config.person.detail.link_presence_detection_integrations"),this.closeDialog,this.hass.localize("ui.panel.config.person.detail.link_integrations_page")),this._params.entry?(0,r.qy)(T||(T=D` <ha-button slot="secondaryAction" variant="danger" appearance="plain" @click="${0}" .disabled="${0}"> ${0} </ha-button> `),this._deleteEntry,this._user&&this._user.is_owner||this._submitting,this.hass.localize("ui.panel.config.person.detail.delete")):(0,r.qy)(E||(E=D`<ha-button slot="secondaryAction" appearance="plain" @click="${0}"> ${0} </ha-button>`),this.closeDialog,this.hass.localize("ui.common.cancel")),this._updateEntry,t||this._submitting,this._params.entry?this.hass.localize("ui.common.save"):this.hass.localize("ui.common.add"))}_renderUserFields(){var e,t,a;const i=this._user;return i?(0,r.qy)(z||(z=D` ${0} ${0} <ha-row-item> <span slot="headline">${0}</span> <span slot="supporting-text">${0}</span> <ha-switch slot="end" .disabled="${0}" .checked="${0}" @change="${0}"></ha-switch> </ha-row-item> <ha-row-item> <span slot="headline">${0}</span> <span slot="supporting-text">${0}</span> <ha-switch slot="end" .disabled="${0}" .checked="${0}" @change="${0}"></ha-switch> </ha-row-item> `),i.system_generated?r.s6:(0,r.qy)(A||(A=D` <ha-row-item> <span slot="headline">${0}</span> <span slot="supporting-text">${0}</span> ${0} </ha-row-item> `),this.hass.localize("ui.panel.config.person.detail.username"),i.username,null!==(e=this.hass.user)&&void 0!==e&&e.is_owner?(0,r.qy)(M||(M=D` <ha-icon-button slot="end" .path="${0}" @click="${0}" .label="${0}"> </ha-icon-button> `),L,this._changeUsername,this.hass.localize("ui.panel.config.person.detail.change_username")):r.s6),!i.system_generated&&null!==(t=this.hass.user)&&void 0!==t&&t.is_owner?(0,r.qy)(O||(O=D` <ha-row-item> <span slot="headline">${0}</span> <span slot="supporting-text">************</span> ${0} </ha-row-item> `),this.hass.localize("ui.panel.config.person.detail.password"),null!==(a=this.hass.user)&&void 0!==a&&a.is_owner?(0,r.qy)(I||(I=D` <ha-icon-button slot="end" .path="${0}" @click="${0}" .label="${0}"> </ha-icon-button> `),L,this._changePassword,this.hass.localize("ui.panel.config.person.detail.change_password")):r.s6):r.s6,this.hass.localize("ui.panel.config.person.detail.local_access_only"),this.hass.localize("ui.panel.config.person.detail.local_access_only_description"),i.system_generated,this._localOnly,this._localOnlyChanged,this.hass.localize("ui.panel.config.person.detail.admin"),this.hass.localize("ui.panel.config.person.detail.admin_description"),i.system_generated||i.is_owner,this._isAdmin,this._adminChanged):r.s6}_nameChanged(e){this._error=void 0,this._name=e.target.value}_adminChanged(e){this._isAdmin=e.target.checked}_localOnlyChanged(e){this._localOnly=e.target.checked}async _allowLoginChanged(e){const t=e.target;if(t.checked)t.checked=!1,(0,y.E)(this,{userAddedCallback:async e=>{var a,i;e&&(t.checked=!0,this._params.entry&&this._params.updateEntry&&await this._params.updateEntry({user_id:e.id}),null===(a=this._params)||void 0===a||null===(i=a.refreshUsers)||void 0===i||i.call(a),this._user=e,this._userId=e.id,this._isAdmin=e.group_ids.includes(m.wj),this._localOnly=e.local_only)},name:this._name});else if(this._userId){var a,i;if(!(await(0,_.dk)(this,{title:this.hass.localize("ui.panel.config.person.detail.confirm_delete_user_title"),text:this.hass.localize("ui.panel.config.person.detail.confirm_delete_user_text",{name:this._name}),confirmText:this.hass.localize("ui.common.delete"),dismissText:this.hass.localize("ui.common.cancel"),destructive:!0})))return void(t.checked=!0);await(0,m.hG)(this.hass,this._userId),null===(a=this._params)||void 0===a||null===(i=a.refreshUsers)||void 0===i||i.call(a),this._userId=void 0,this._user=void 0,this._isAdmin=void 0,this._localOnly=void 0}}_deviceTrackersChanged(e){this._error=void 0,this._deviceTrackers=e.detail.value}_pictureChanged(e){this._error=void 0,this._picture=e.target.value}async _changePassword(){if(!this._user)return;this._user.credentials.find(e=>"homeassistant"===e.type)?(0,w.M)(this,{userId:this._user.id}):(0,_.showAlertDialog)(this,{title:"No ioBroker credentials found."})}async _changeUsername(){if(!this._user)return;if(!this._user.credentials.find(e=>"homeassistant"===e.type))return void(0,_.showAlertDialog)(this,{title:"No ioBroker credentials found."});const e=await(0,_.an)(this,{inputLabel:this.hass.localize("ui.panel.config.users.change_username.new_username"),confirmText:this.hass.localize("ui.panel.config.users.change_username.change"),title:this.hass.localize("ui.panel.config.users.change_username.caption"),defaultValue:this._user.username});if(e)try{var t,a;await(0,v.Gk)(this.hass,this._user.id,e),null===(t=this._params)||void 0===t||null===(a=t.refreshUsers)||void 0===a||a.call(t),this._user=Object.assign(Object.assign({},this._user),{},{username:e}),(0,_.showAlertDialog)(this,{text:this.hass.localize("ui.panel.config.users.change_username.username_changed")})}catch(i){(0,_.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.users.change_username.failed"),text:i.message})}}async _updateEntry(){this._submitting=!0;try{var e,t,a,i,s;if(this._userId&&this._name!==(null===(e=this._params.entry)||void 0===e?void 0:e.name)||this._isAdmin!==(null===(t=this._user)||void 0===t?void 0:t.group_ids.includes(m.wj))||this._localOnly!==(null===(a=this._user)||void 0===a?void 0:a.local_only))await(0,m.TK)(this.hass,this._userId,{name:this._name.trim(),group_ids:[this._isAdmin?m.wj:m.eR],local_only:this._localOnly}),null===(i=this._params)||void 0===i||null===(s=i.refreshUsers)||void 0===s||s.call(i);const d={name:this._name.trim(),device_trackers:this._deviceTrackers,user_id:this._userId||null,picture:this._picture};var r,o,n,l;if(this._params.entry)await(null===(r=(o=this._params).updateEntry)||void 0===r?void 0:r.call(o,d));else await(null===(n=(l=this._params).createEntry)||void 0===n?void 0:n.call(l,d)),this._personExists=!0;this.closeDialog()}catch(d){this._error=d?d.message:"Unknown error"}finally{this._submitting=!1}}async _deleteEntry(){this._submitting=!0;try{var e,t;await(null===(e=(t=this._params).removeEntry)||void 0===e?void 0:e.call(t))&&(this._params.entry.user_id&&(0,m.hG)(this.hass,this._params.entry.user_id),this.closeDialog())}finally{this._submitting=!1}}static get styles(){return[f.nA,(0,r.AH)(j||(j=D`ha-picture-upload{display:block}ha-picture-upload{margin-bottom:16px;--file-upload-image-border-radius:var(--ha-border-radius-circle)}ha-row-item{--ha-row-item-padding-inline:0}a{color:var(--primary-color)}p{color:var(--primary-text-color)}`))]}constructor(...e){super(...e),this._submitting=!1,this._personExists=!1,this._open=!1,this._deviceTrackersAvailable=(0,n.A)(e=>Object.keys(e.states).some(e=>"device_tracker"===e.substr(0,e.indexOf("."))))}}(0,s.Cg)([(0,o.MZ)({attribute:!1})],H.prototype,"hass",void 0),(0,s.Cg)([(0,o.wk)()],H.prototype,"_name",void 0),(0,s.Cg)([(0,o.wk)()],H.prototype,"_userId",void 0),(0,s.Cg)([(0,o.wk)()],H.prototype,"_user",void 0),(0,s.Cg)([(0,o.wk)()],H.prototype,"_isAdmin",void 0),(0,s.Cg)([(0,o.wk)()],H.prototype,"_localOnly",void 0),(0,s.Cg)([(0,o.wk)()],H.prototype,"_deviceTrackers",void 0),(0,s.Cg)([(0,o.wk)()],H.prototype,"_picture",void 0),(0,s.Cg)([(0,o.wk)()],H.prototype,"_error",void 0),(0,s.Cg)([(0,o.wk)()],H.prototype,"_params",void 0),(0,s.Cg)([(0,o.wk)()],H.prototype,"_submitting",void 0),(0,s.Cg)([(0,o.wk)()],H.prototype,"_personExists",void 0),(0,s.Cg)([(0,o.wk)()],H.prototype,"_open",void 0),H=(0,s.Cg)([(0,o.EM)("dialog-person-detail")],H),i()}catch(k){i(k)}})},44191:function(e,t,a){a.d(t,{E:function(){return r}});a(3362),a(62953);var i=a(1087);const s=()=>a.e(69304).then(a.bind(a,81131)),r=(e,t)=>{(0,i.r)(e,"show-dialog",{dialogTag:"dialog-add-user",dialogImport:s,dialogParams:t})}},12176:function(e,t,a){a.d(t,{M:function(){return r}});a(3362),a(62953);var i=a(1087);const s=()=>Promise.all([a.e(53480),a.e(39570)]).then(a.bind(a,56660)),r=(e,t)=>{(0,i.r)(e,"show-dialog",{dialogTag:"dialog-admin-change-password",dialogImport:s,dialogParams:t})}},53580:function(e,t,a){a.d(t,{mdiHomeAssistant:function(){return i}});const i="m12.151 1.5882c-.3262 0-.6523.1291-.8996.3867l-8.3848 8.7354c-.0619.0644-.1223.1368-.1807.2154-.0588.0789-.1151.1638-.1688.2534-.2593.4325-.4552.9749-.5232 1.4555-.0026.018-.0076.0369-.0094.0548-.0121.0987-.0184.1944-.0184.2857v8.0124a1.2731 1.2731 0 001.2731 1.2731h7.8313l-3.4484-3.593a1.7399 1.7399 0 111.0803-1.125l2.6847 2.7972v-10.248a1.7399 1.7399 0 111.5276-0v7.187l2.6702-2.782a1.7399 1.7399 0 111.0566 1.1505l-3.7269 3.8831v2.7299h8.174a1.2471 1.2471 0 001.2471-1.2471v-8.0375c0-.0912-.0059-.1868-.0184-.2855-.0603-.4935-.2636-1.0617-.5326-1.5105-.0537-.0896-.1101-.1745-.1684-.253-.0588-.079-.1191-.1513-.181-.2158l-8.3848-8.7363c-.2473-.2577-.5735-.3866-.8995-.3864"},69235:function(e,t,a){a.a(e,async function(e,t){try{a(3362),a(62953);"function"!=typeof window.ResizeObserver&&(window.ResizeObserver=(await a.e(71055).then(a.bind(a,52370))).default),t()}catch(i){t(i)}},1)}}]);