UNPKG

iobroker.lovelace

Version:

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

25 lines 66.4 kB
export const __rspack_esm_id=18965;export const __rspack_esm_ids=[18965];export const __webpack_modules__={93421(e,t,a){a.d(t,{IW:()=>d,dH:()=>h,fI:()=>l});a(44114);var o=a(35211),i=a(22792),r=a(32172);const s=(e,t)=>{let a=e;for(const e of t){if(null==a)return;a=a[e]}return a},n=(e,t,a)=>{const i=(0,r.p)({transformer:function(e){return a.call(this,e)},watch:t?[t]:[]}),s=(0,o.Fg)({context:e,subscribe:!0});return(e,t)=>{i(e,t),s(e,t)}},l=e=>n(i.iN,e.entityIdPath[0],function(t){const a=s(this,e.entityIdPath);return"string"==typeof a?t?.[a]:void 0}),h=e=>n(i.X1,e.entityIdPath[0],function(t){const a=s(this,e.entityIdPath);return"string"==typeof a?t?.[a]:void 0}),d=()=>n(i.D5,void 0,({localize:e})=>e)},32172(e,t,a){a.d(t,{p:()=>o});a(18111),a(7588),a(45367),a(92731),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);function o(e){return(t,a)=>{if("object"==typeof a)throw new Error("This decorator does not support this compilation type.");const o=String(a),i=t;if(i._transformers){if(!i.hasOwnProperty("_transformers")){const e=i._transformers;i._transformers=new Map,e.forEach((e,t)=>i._transformers.set(t,e))}}else{i._transformers=new Map,i._watching=new Map;const e=i.willUpdate;i.willUpdate=function(t){e.call(this,t);const a=new Set;t.forEach((e,t)=>{const o=this._watching.get(t);void 0!==o&&o.forEach(e=>a.add(e))}),a.forEach(e=>{this[e]=this[`__original_${String(e)}`]})}}i._transformers.set(a,e.transformer),e.watch&&e.watch.forEach(e=>{let t=i._watching.get(e);t||(t=new Set,i._watching.set(e,t)),t.add(a)});const r=Object.getOwnPropertyDescriptor(t,a);let s;if(void 0===r)s={get(){return this[`__transform_${o}`]},set(e){const t=this[`__transform_${o}`],a=this._transformers.get(o);this[`__transform_${o}`]=a?a.call(this,e):e,this[`__original_${o}`]=e,this.requestUpdate(o,t)},configurable:!0,enumerable:!0};else{const e=r.set;s={...r,set(t){const a=this[`__transform_${o}`],i=this._transformers.get(o);this[`__transform_${o}`]=i?i.call(this,t):t,this[`__original_${o}`]=t,this.requestUpdate(o,a),e?.call(this,t)}}}Object.defineProperty(t,a,s)}}},60353(e,t,a){a.d(t,{u:()=>o});class o{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={}){this._startY=0,this._delta=0,this._startTime=0,this._lastY=0,this._lastTime=0,this._velocityThreshold=e.velocitySwipeThreshold??.5,this._movementTimeThreshold=e.movementTimeThreshold??100}}},64481(e,t,a){a.d(t,{D:()=>i,J:()=>s});a(64979);let o=!1;try{o="true"===window.localStorage.getItem("disableViewTransition")}catch{}const i=e=>{o=e},r=e=>{if(!(e=>(e instanceof DOMException||e instanceof Error)&&"AbortError"===e.name)(e))throw e},s=e=>{if(!document.startViewTransition||o)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())}}},38962(e,t,a){a.a(e,async function(e,o){try{a.r(t);var i=a(62826),r=a(5124),s=a(22441),n=a(6412),l=a(93421),h=a(1087),d=a(26300),c=(a(67094),e([d]));d=(c.then?(await c)():c)[0];const p="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",u={info:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z",warning:"M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16",error:"M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z",success:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2,4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"};class v extends r.WF{render(){return r.qy` <div class="issue-type ${(0,n.H)({[this.alertType]:!0})}" role="alert"> <div class="icon ${this.title?"":"no-title"}"> <slot name="icon"> <ha-svg-icon .path="${u[this.alertType]}"></ha-svg-icon> </slot> </div> <div class="${(0,n.H)({content:!0,narrow:this.narrow})}"> <div class="main-content"> ${this.title?r.qy`<div class="title">${this.title}</div>`:r.s6} <slot></slot> </div> <div class="action"> <slot name="action"> ${this.dismissable?r.qy`<ha-icon-button @click="${this._dismissClicked}" .label="${this._localize?.("ui.common.dismiss_alert")}" .path="${p}"></ha-icon-button>`:r.s6} </slot> </div> </div> </div> `}_dismissClicked(){(0,h.r)(this,"alert-dismissed-clicked")}constructor(...e){super(...e),this.title="",this.alertType="info",this.dismissable=!1,this.narrow=!1}}v.styles=r.AH`.issue-type{position:relative;padding:8px;display:flex}.icon{height:var(--ha-alert-icon-size,24px);width:var(--ha-alert-icon-size,24px)}.issue-type::after{position:absolute;top:0;right:0;bottom:0;left:0;opacity:.12;pointer-events:none;content:"";border-radius:var(--ha-border-radius-sm)}.icon.no-title{align-self:center}.content{display:flex;justify-content:space-between;align-items:center;width:100%;text-align:var(--float-start)}.content.narrow{flex-direction:column;align-items:flex-end}.action{z-index:1;width:min-content;--mdc-theme-primary:var(--primary-text-color)}.main-content{overflow-wrap:anywhere;word-break:break-word;line-height:normal;margin-left:8px;margin-right:0;margin-inline-start:8px;margin-inline-end:8px}.title{margin-top:2px;font-weight:var(--ha-font-weight-bold)}.action ha-icon-button{--mdc-theme-primary:var(--primary-text-color);--ha-icon-button-size:36px}.issue-type.info>.icon{color:var(--info-color)}.issue-type.info::after{background-color:var(--info-color)}.issue-type.warning>.icon{color:var(--warning-color)}.issue-type.warning::after{background-color:var(--warning-color)}.issue-type.error>.icon{color:var(--error-color)}.issue-type.error::after{background-color:var(--error-color)}.issue-type.success>.icon{color:var(--success-color)}.issue-type.success::after{background-color:var(--success-color)}:host ::slotted(ul){margin:0;padding-inline-start:20px}`,(0,i.Cg)([(0,s.MZ)()],v.prototype,"title",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"alert-type"})],v.prototype,"alertType",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],v.prototype,"dismissable",void 0),(0,i.Cg)([(0,s.wk)(),(0,l.IW)()],v.prototype,"_localize",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],v.prototype,"narrow",void 0),v=(0,i.Cg)([(0,s.EM)("ha-alert")],v),o()}catch(e){o(e)}})},99611(e,t,a){a.a(e,async function(e,t){try{a(18111),a(13579),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);var o=a(62826),i=a(1126),r=a(35211),s=a(5124),n=a(22441),l=a(1087),h=a(60353),d=a(22792),c=a(59992),p=a(14503),u=a(22348),v=e([i]);i=(v.then?(await v)():v)[0];const g=300,m=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"]),b=new Set(["volume-slider-container","forecast"]);class f extends((0,c.V)(s.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 s.qy` <wa-drawer id="drawer" placement="bottom" .open="${this._drawerOpen}" .lightDismiss="${!this.preventScrimClose}" .ariaLabelledby="${this.ariaLabelledBy}" .ariaDescribedby="${this.ariaDescribedBy}" @keydown="${this._handleKeyDown}" @wa-show="${this._handleShow}" @wa-after-show="${this._handleAfterShow}" @wa-hide="${this._handleHide}" @wa-after-hide="${this._handleAfterHide}" @click="${this._handleCloseAction}" without-header @touchstart="${this._handleTouchStart}"> <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> ${this.renderScrollableFades()} </div> <slot name="footer"></slot> </wa-drawer> `}_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 ${g}ms ease-out`),this.style.removeProperty("--dialog-transform"),setTimeout(()=>{this.style.removeProperty("--dialog-transition")},g)}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,s.AH`wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:${g}ms;--hide-duration:${g}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}`]}constructor(...e){super(...e),this.open=!1,this.flexContent=!1,this.preventScrimClose=!1,this._drawerOpen=!1,this._sliderInteractionActive=!1,this._gestureRecognizer=new h.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(()=>{const e=this._autofocusElement;this._hassConfig?.auth.external&&(0,u.V)(this._hassConfig.auth.external)?e&&(e.id||(e.id="ha-bottom-sheet-autofocus"),this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:e.id}})):e?.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 e of t){if(e===this._drawer)break;if(e instanceof HTMLElement&&(e.scrollTop>0||m.has(e.localName)||Array.from(e.classList).some(e=>b.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=()=>{this._unregisterResizeHandlers(),this._isDragging=!1;const e=this._gestureRecognizer.end();if(e.isSwipe)return void(e.isDownwardSwipe?this._drawerOpen=!1:this._animateSnapBack());const t=this._drawer.shadowRoot?.querySelector('[part="body"]'),a=t?.offsetHeight||0;a>0&&e.delta<0&&Math.abs(e.delta)>.5*a?this._drawerOpen=!1:this._animateSnapBack()},this._unregisterResizeHandlers=()=>{document.removeEventListener("touchmove",this._handleTouchMove),document.removeEventListener("touchend",this._handleTouchEnd),document.removeEventListener("touchcancel",this._handleTouchEnd)}}}(0,o.Cg)([(0,n.MZ)({attribute:"aria-labelledby"})],f.prototype,"ariaLabelledBy",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],f.prototype,"ariaDescribedBy",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],f.prototype,"open",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],f.prototype,"flexContent",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],f.prototype,"preventScrimClose",void 0),(0,o.Cg)([(0,n.wk)()],f.prototype,"_drawerOpen",void 0),(0,o.Cg)([(0,n.wk)()],f.prototype,"_sliderInteractionActive",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:d.WF,subscribe:!0})],f.prototype,"_hassConfig",void 0),(0,o.Cg)([(0,n.P)("#drawer")],f.prototype,"_drawer",void 0),(0,o.Cg)([(0,n.P)("#body")],f.prototype,"_bodyElement",void 0),(0,o.Cg)([(0,n.P)("[autofocus]")],f.prototype,"_autofocusElement",void 0),f=(0,o.Cg)([(0,n.EM)("ha-bottom-sheet")],f),t()}catch(e){t(e)}})},986(e,t,a){a.a(e,async function(e,t){try{a(44114),a(18111),a(20116),a(7588),a(45367),a(92731),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);var o=a(62826),i=a(35211),r=a(5124),s=a(22441),n=a(89784),l=a(22786),h=a(78870),d=a(1087),c=a(22792),p=(a(75064),a(38508)),u=(a(47680),a(67094),e([p]));p=(u.then?(await u)():u)[0];const v="M20.65,20.87L18.3,18.5L12,12.23L8.44,8.66L7,7.25L4.27,4.5L3,5.77L5.78,8.55C3.23,11.69 3.42,16.31 6.34,19.24C7.9,20.8 9.95,21.58 12,21.58C13.79,21.58 15.57,21 17.03,19.8L19.73,22.5L21,21.23L20.65,20.87M12,19.59C10.4,19.59 8.89,18.97 7.76,17.83C6.62,16.69 6,15.19 6,13.59C6,12.27 6.43,11 7.21,10L12,14.77V19.59M12,5.1V9.68L19.25,16.94C20.62,14 20.09,10.37 17.65,7.93L12,2.27L8.3,5.97L9.71,7.38L12,5.1Z",g="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z";class m extends r.WF{render(){const e=this.value??this.defaultColor??"";return r.qy` <ha-generic-picker .disabled="${this.disabled}" .required="${this.required}" .hideClearIcon="${!this.value&&!!this.defaultColor}" .label="${this.label}" .helper="${this.helper}" .value="${e}" .getItems="${this._getItems}" .rowRenderer="${this._rowRenderer}" .valueRenderer="${this._valueRenderer}" @value-changed="${this._valueChanged}" .notFoundLabel="${this._i18n?.localize?.("ui.components.color-picker.no_colors_found")}" .getAdditionalItems="${this._getAdditionalItems}"> </ha-generic-picker> `}_renderItemIcon(e){if(e.icon_path)return r.qy`<ha-svg-icon slot="start" .path="${e.icon_path}"></ha-svg-icon>`;if(e.icon)return r.qy`<ha-icon slot="start" .icon="${e.icon}"></ha-icon>`;const t=this._extraOptionsColorMap(this.extraOptions)?.get(e.id)??e.id;return r.qy`<span slot="start">${this._renderColorCircle(t)}</span>`}_renderColorCircle(e){return r.qy` <span style="${(0,n.W)({"--circle-color":(0,h.MP)(e),display:"block","background-color":"var(--circle-color, var(--divider-color))",border:"1px solid var(--outline-color)","border-radius":"var(--ha-border-radius-pill)",width:"20px",height:"20px","box-sizing":"border-box"})}"></span> `}_valueChanged(e){e.stopPropagation();const t=e.detail.value,a=t&&t===this.defaultColor?void 0:t??void 0;this.value=a,(0,d.r)(this,"value-changed",{value:this.value})}constructor(...e){super(...e),this.includeState=!1,this.includeNone=!1,this.disabled=!1,this._extraOptionsColorMap=(0,l.A)(e=>{if(!e)return;const t=new Map;for(const a of e)a.display_color&&t.set(a.value,a.display_color);return t.size>0?t:void 0}),this.required=!1,this._getAdditionalItems=e=>{if(!e||""===e.trim())return[];return this._getColors(this.includeNone,this.includeState,this.extraOptions,this.defaultColor,this.value).find(t=>t.id===e)?[]:[{id:e,primary:this._i18n?.localize?.("ui.components.color-picker.custom_color")||"Custom color",secondary:e}]},this._getItems=()=>this._getColors(this.includeNone,this.includeState,this.extraOptions,this.defaultColor,this.value),this._getColors=(0,l.A)((e,t,a,o,i)=>{const r=[],s=this._i18n?.localize?.("ui.components.color-picker.default")||"Default",n=(e,t)=>t&&s?`${e} (${s})`:e;if(e){const e=this._i18n?.localize?.("ui.components.color-picker.none")||"None";r.push({id:"none",primary:n(e,"none"===o),icon_path:v})}if(t){const e=this._i18n?.localize?.("ui.components.color-picker.state")||"State";r.push({id:"state",primary:n(e,"state"===o),icon_path:g})}a&&a.forEach(e=>{r.push({id:e.value,primary:n(e.label,o===e.value),...e.icon?{icon:e.icon}:{}})}),Array.from(h.lt).forEach(e=>{const t=this._i18n?.localize?.(`ui.components.color-picker.colors.${e}`)||e;r.push({id:e,primary:n(t,o===e)})});const l=new Set(r.map(e=>e.id));return i&&i.length>0&&!l.has(i)&&r.push({id:i,primary:i}),r}),this._rowRenderer=e=>r.qy` <ha-combo-box-item type="button" compact="compact"> ${this._renderItemIcon(e)} <span slot="headline">${e.primary}</span> ${e.secondary?r.qy`<span slot="supporting-text">${e.secondary}</span>`:r.s6} </ha-combo-box-item> `,this._valueRenderer=e=>{if("none"===e)return r.qy` <ha-svg-icon slot="start" .path="${v}"></ha-svg-icon> <span slot="headline"> ${this._i18n?.localize?.("ui.components.color-picker.none")||"None"} </span> `;if("state"===e)return r.qy` <ha-svg-icon slot="start" .path="${g}"></ha-svg-icon> <span slot="headline"> ${this._i18n?.localize?.("ui.components.color-picker.state")||"State"} </span> `;const t=this.extraOptions?.find(t=>t.value===e),a=t?.label||this._i18n?.localize?.(`ui.components.color-picker.colors.${e}`)||e,o=this._extraOptionsColorMap(this.extraOptions)?.get(e)??e,i=t?.icon?r.qy`<ha-icon slot="start" .icon="${t.icon}"></ha-icon>`:r.qy`<span slot="start">${this._renderColorCircle(o)}</span>`;return r.qy` ${i} <span slot="headline">${a}</span> `}}}(0,o.Cg)([(0,s.MZ)()],m.prototype,"label",void 0),(0,o.Cg)([(0,s.MZ)()],m.prototype,"helper",void 0),(0,o.Cg)([(0,s.MZ)()],m.prototype,"value",void 0),(0,o.Cg)([(0,s.MZ)({type:String,attribute:"default_color"})],m.prototype,"defaultColor",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,attribute:"include_state"})],m.prototype,"includeState",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,attribute:"include_none"})],m.prototype,"includeNone",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],m.prototype,"extraOptions",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"required",void 0),(0,o.Cg)([(0,s.wk)(),(0,i.Fg)({context:c.D5,subscribe:!0})],m.prototype,"_i18n",void 0),m=(0,o.Cg)([(0,s.EM)("ha-color-picker")],m),t()}catch(e){t(e)}})},93444(e,t,a){var o=a(62826),i=a(5124),r=a(22441);class s extends i.WF{render(){return i.qy` <footer> <slot name="secondaryAction"></slot> <slot name="primaryAction"></slot> </footer> `}static get styles(){return[i.AH`footer{display:flex;gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%}`]}}s=(0,o.Cg)([(0,r.EM)("ha-dialog-footer")],s)},76538(e,t,a){var o=a(62826),i=a(5124),r=a(22441);class s extends i.WF{render(){const e=i.qy`<div class="header-title"> <slot name="title"></slot> </div>`,t=i.qy`<div class="header-subtitle"> <slot name="subtitle"></slot> </div>`;return i.qy` <header class="header"> <div class="header-bar"> <section class="header-navigation-icon"> <slot name="navigationIcon"></slot> </section> <section class="header-content"> ${"above"===this.subtitlePosition?i.qy`${t}${e}`:i.qy`${e}${t}`} </section> <section class="header-action-items"> <slot name="actionItems"></slot> </section> </div> <slot></slot> </header> `}static get styles(){return[i.AH`: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,o.Cg)([(0,r.MZ)({type:String,attribute:"subtitle-position"})],s.prototype,"subtitlePosition",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"show-border"})],s.prototype,"showBorder",void 0),s=(0,o.Cg)([(0,r.EM)("ha-dialog-header")],s)},72554(e,t,a){a.a(e,async function(e,t){try{var o=a(62826),i=a(93900),r=a(35211),s=a(5124),n=a(22441),l=a(63672),h=a(1087),d=a(64481),c=a(22792),p=a(59992),u=a(14503),v=a(22348),g=(a(76538),a(26300)),m=e([i,g]);[i,g]=m.then?(await m)():m;const b="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 f extends((0,p.V)(s.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(){return s.qy` <wa-dialog .open="${this._open}" .lightDismiss="${!this.preventScrimClose}" without-header aria-labelledby="${(0,l.J)(this.ariaLabelledBy||(void 0!==this.headerTitle?"ha-dialog-title":void 0))}" aria-describedby="${(0,l.J)(this.ariaDescribedBy)}" @keydown="${this._handleKeyDown}" @wa-hide="${this._handleHide}" @wa-show="${this._handleShow}" @wa-after-show="${this._handleAfterShow}" @wa-after-hide="${this._handleAfterHide}"> ${this.withoutHeader?s.s6:s.qy`<slot name="header"> <ha-dialog-header .subtitlePosition="${this.headerSubtitlePosition}" .showBorder="${this._bodyScrolled}"> <slot name="headerNavigationIcon" slot="navigationIcon"> <ha-icon-button data-dialog="close" .label="${this._i18n?.localize?.("ui.common.close")??"Close"}" .path="${b}"></ha-icon-button> </slot> ${void 0!==this.headerTitle?s.qy`<span slot="title" class="title" id="ha-dialog-title"> ${this.headerTitle} </span>`:s.qy`<slot name="headerTitle" slot="title"></slot>`} ${void 0!==this.headerSubtitle?s.qy`<span slot="subtitle">${this.headerSubtitle}</span>`:s.qy`<slot name="headerSubtitle" slot="subtitle"></slot>`} <slot name="headerActionItems" slot="actionItems"></slot> </ha-dialog-header> </slot>`} <div class="content-wrapper"> <div class="body ha-scrollbar" @scroll="${this._handleBodyScroll}"> <slot></slot> </div> ${this.renderScrollableFades()} </div> <slot name="footer" slot="footer"></slot> </wa-dialog> `}disconnectedCallback(){this.removeEventListener("dialog-set-fullscreen",this._handleFullscreenChanged),this._setFullscreen(!1),super.disconnectedCallback(),this._open=!1}_handleFullscreenChanged(e){this._open?(0,d.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){const t=e.detail?.source===e.target.dialog;this.preventScrimClose&&this._escapePressed&&t&&e.preventDefault(),this._escapePressed=!1}static get styles(){return[...super.styles,u.dp,s.AH`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,h.r)(this,"opened"),await this.updateComplete,requestAnimationFrame(()=>{if(this._hassConfig?.auth.external&&(0,v.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}})))}this.querySelector("[autofocus]")?.focus()}))},this._handleAfterShow=e=>{e.eventPhase===Event.AT_TARGET&&(0,h.r)(this,"after-show")},this._handleAfterHide=e=>{e.eventPhase===Event.AT_TARGET&&(this._open=!1,this._setFullscreen(!1),(0,h.r)(this,"closed"))}}}(0,o.Cg)([(0,n.MZ)({attribute:"aria-labelledby"})],f.prototype,"ariaLabelledBy",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],f.prototype,"ariaDescribedBy",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],f.prototype,"open",void 0),(0,o.Cg)([(0,n.MZ)({reflect:!0})],f.prototype,"type",void 0),(0,o.Cg)([(0,n.MZ)({type:String,reflect:!0,attribute:"width"})],f.prototype,"width",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],f.prototype,"preventScrimClose",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"header-title"})],f.prototype,"headerTitle",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"header-subtitle"})],f.prototype,"headerSubtitle",void 0),(0,o.Cg)([(0,n.MZ)({type:String,attribute:"header-subtitle-position"})],f.prototype,"headerSubtitlePosition",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],f.prototype,"flexContent",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"without-header"})],f.prototype,"withoutHeader",void 0),(0,o.Cg)([(0,n.wk)()],f.prototype,"_open",void 0),(0,o.Cg)([(0,n.P)(".body")],f.prototype,"bodyContainer",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:c.D5,subscribe:!0})],f.prototype,"_i18n",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:c.WF,subscribe:!0})],f.prototype,"_hassConfig",void 0),(0,o.Cg)([(0,n.wk)()],f.prototype,"_bodyScrolled",void 0),(0,o.Cg)([(0,n.Ls)({passive:!0})],f.prototype,"_handleBodyScroll",null),f=(0,o.Cg)([(0,n.EM)("ha-dialog")],f),t()}catch(e){t(e)}})},38508(e,t,a){a.a(e,async function(e,t){try{a(18111),a(13579);var o=a(62826),i=a(61366),r=a(35211),s=a(5124),n=a(22441),l=a(63672),h=a(91335),d=a(1087),c=a(22792),p=a(17894),u=a(22348),v=a(99611),g=a(18350),m=(a(75064),a(3449),a(49639)),b=a(88285),f=(a(67094),e([i,v,g,m,b]));[i,v,g,m,b]=f.then?(await f)():f;const w="M3 16H10V14H3M18 14V10H16V14H12V16H16V20H18V16H22V14M14 6H3V8H14M14 10H3V12H14V10Z";class y extends((0,p.c)(s.WF)){willUpdate(e){e.has("value")&&this._setUnknownValue()}setFieldValue(e){this._comboBox?this._comboBox.setFieldValue(e):this._initialFieldValue=e}render(){const e=this.useTopLabel&&this.value?void 0:this.label;return s.qy`<div class="container"> ${this.useTopLabel&&this.label?s.qy`<label ?disabled="${this.disabled}">${this.label}</label>`:s.s6} <div id="picker"> <slot name="field"> ${this.addButtonLabel&&!this.value?s.qy`<ha-button size="small" appearance="filled" @click="${this.open}" .disabled="${this.disabled}"> <ha-svg-icon .path="${w}" slot="start"></ha-svg-icon> ${this.addButtonLabel} </ha-button>`:s.qy`<ha-picker-field type="button" class="${this._opened?"opened":""}" compact="compact" .unknown="${this._unknownValue}" .unknownItemText="${this.unknownItemText}" aria-label="${(0,l.J)(this.label)}" @click="${this.open}" @clear="${this._clear}" .icon="${this.icon}" .image="${this.image}" .label="${e}" .placeholder="${this.placeholder}" .value="${this.value}" .valueRenderer="${this.valueRenderer}" .required="${this.required}" .disabled="${this.disabled}" .invalid="${this.invalid}" .hideClearIcon="${this.hideClearIcon}"> <slot name="start"></slot> </ha-picker-field>`} </slot> </div> ${this._pickerWrapperOpen||this._opened?this._openedNarrow?s.qy` <ha-bottom-sheet flexcontent .open="${this._pickerWrapperOpen}" @wa-after-show="${this._dialogOpened}" @closed="${this._hidePicker}" role="dialog" aria-modal="true" aria-label="${this.label||"Select option"}"> ${this._renderComboBox(!0)} </ha-bottom-sheet> `:s.qy` <wa-popover .open="${this._pickerWrapperOpen}" style="--body-width:${this._popoverWidth}px" without-arrow distance="-4" .placement="${this.popoverPlacement}" .for="${this.popoverAnchor?null:"picker"}" .anchor="${this.popoverAnchor??null}" auto-size="vertical" auto-size-padding="16" @wa-after-show="${this._dialogOpened}" @wa-after-hide="${this._hidePicker}" trap-focus role="dialog" aria-modal="true" aria-label="${this.label||"Select option"}"> ${this._renderComboBox()} </wa-popover> `:s.s6} </div> ${this._renderHelper()}`}_renderComboBox(e=!1){return this._opened?s.qy` <ha-picker-combo-box id="combo-box" .allowCustomValue="${this.allowCustomValue}" .label="${this.searchLabel}" .value="${this._selectedValue??this.value}" @value-changed="${this._valueChanged}" .rowRenderer="${this.rowRenderer}" .notFoundLabel="${this.notFoundLabel}" .emptyLabel="${this.emptyLabel}" .getItems="${this.getItems}" .getAdditionalItems="${this.getAdditionalItems}" .searchFn="${this.searchFn}" .mode="${e?"dialog":"popover"}" .sections="${this.sections}" .sectionTitleFunction="${this.sectionTitleFunction}" .selectedSection="${this.selectedSection}" .searchKeys="${this.searchKeys}" .customValueLabel="${this.customValueLabel}" .noSort="${this.noSort}"></ha-picker-combo-box> `:s.s6}_renderHelper(){const e=this.invalid&&this.errorMessage,t=!e&&this.helper;return e||t?s.qy`<ha-input-helper-text .disabled="${this.disabled}"> ${e?this.errorMessage:this.helper} </ha-input-helper-text>`:s.s6}refreshItems(){this._comboBox?.refreshItems()}_hidePicker(e){e.stopPropagation(),this._newValue&&((0,d.r)(this,"value-changed",{value:this._newValue}),this._newValue=void 0),this._opened=!1,this._pickerWrapperOpen=!1,this._selectedValue=void 0,this._unsubscribeTinyKeys?.(),(0,d.r)(this,"picker-closed")}_valueChanged(e){e.stopPropagation();const t=e.detail.value;t&&(this._pickerWrapperOpen=!1,this._newValue=t)}_clear(e){e.stopPropagation(),this._setValue(void 0)}_setValue(e){this.value=e,(0,d.r)(this,"value-changed",{value:e})}async open(e,t){e?.stopPropagation(),this.disabled||(this._selectedValue=t?.selectedValue,this._openedNarrow=this._narrow,this._popoverWidth=this._containerElement?.offsetWidth||250,this._pickerWrapperOpen=!0,this._unsubscribeTinyKeys=(0,h.Tc)(this,{Escape:this._handleEscClose}))}connectedCallback(){super.connectedCallback(),this._handleResize(),window.addEventListener("resize",this._handleResize)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._handleResize),this._unsubscribeTinyKeys?.()}static get styles(){return[s.AH`.container{position:relative;display:block;max-width:100%}label[disabled]{color:var(--mdc-text-field-disabled-ink-color,rgba(0,0,0,.6))}label{display:block;margin:0 0 8px}ha-input-helper-text{display:block;margin:var(--ha-space-2) 0 0}:host([invalid]) ha-input-helper-text{color:var(--mdc-theme-error,var(--error-color,#b00020))}wa-popover{--wa-space-l:0}wa-popover::part(dialog)::backdrop{background:0 0}wa-popover::part(body){width:var(--ha-generic-picker-width,max(var(--body-width),250px));max-width:var(--ha-generic-picker-max-width,var(--ha-generic-picker-width,max(var(--body-width),250px)));max-height:500px;height:70vh;overflow:hidden}@media (max-height:1000px){wa-popover::part(body){max-height:400px}}ha-bottom-sheet{--ha-bottom-sheet-height:90vh;--ha-bottom-sheet-height:calc(100dvh - var(--ha-space-12));--ha-bottom-sheet-max-height:var(--ha-bottom-sheet-height);--ha-bottom-sheet-max-width:600px;--ha-bottom-sheet-padding:0;--ha-bottom-sheet-surface-background:var(--card-background-color);--ha-bottom-sheet-border-radius:var(--ha-border-radius-2xl);--ha-bottom-sheet-content-padding:0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left)}ha-picker-field.opened{--mdc-text-field-idle-line-color:var(--primary-color)}`]}constructor(...e){super(...e),this.popoverPlacement="bottom",this.useTopLabel=!1,this.noSort=!1,this._opened=!1,this._pickerWrapperOpen=!1,this._popoverWidth=0,this._openedNarrow=!1,this._unknownValue=!1,this._narrow=!1,this.invalid=!1,this._setUnknownValue=()=>{const e=this.getItems();!this.allowCustomValue&&void 0!==this.value&&null!==this.value&&""!==this.value&&e?this._unknownValue=!e.some(e=>"string"!=typeof e&&e.id===this.value):this._unknownValue=!1},this._dialogOpened=()=>{this._opened=!0,(0,d.r)(this,"picker-opened"),requestAnimationFrame(()=>{this._initialFieldValue&&(this._comboBox?.setFieldValue(this._initialFieldValue),this._initialFieldValue=void 0),this._hassConfig?.auth.external&&(0,u.V)(this._hassConfig.auth.external)?this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:"combo-box"}}):this._comboBox?.focus()})},this._handleResize=()=>{this._narrow=window.matchMedia("(max-width: 870px)").matches||window.matchMedia("(max-height: 500px)").matches,!this._openedNarrow&&this._pickerWrapperOpen&&(this._popoverWidth=this._containerElement?.offsetWidth||250)},this._handleEscClose=e=>{e.stopPropagation()}}}y.shadowRootOptions={...s.WF.shadowRootOptions,delegatesFocus:!0},(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"allow-custom-value"})],y.prototype,"allowCustomValue",void 0),(0,o.Cg)([(0,n.MZ)({type:String,attribute:"search-label"})],y.prototype,"searchLabel",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"getItems",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"getAdditionalItems",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"rowRenderer",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"searchFn",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"searchKeys",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"notFoundLabel",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"empty-label"})],y.prototype,"emptyLabel",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"popover-placement"})],y.prototype,"popoverPlacement",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"add-button-label"})],y.prototype,"addButtonLabel",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"sections",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"sectionTitleFunction",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"selected-section"})],y.prototype,"selectedSection",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"popoverAnchor",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"use-top-label"})],y.prototype,"useTopLabel",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"custom-value-label"})],y.prototype,"customValueLabel",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"no-sort"})],y.prototype,"noSort",void 0),(0,o.Cg)([(0,n.P)(".container")],y.prototype,"_containerElement",void 0),(0,o.Cg)([(0,n.P)("ha-picker-combo-box")],y.prototype,"_comboBox",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:c.WF,subscribe:!0})],y.prototype,"_hassConfig",void 0),(0,o.Cg)([(0,n.wk)()],y.prototype,"_opened",void 0),(0,o.Cg)([(0,n.wk)()],y.prototype,"_pickerWrapperOpen",void 0),(0,o.Cg)([(0,n.wk)()],y.prototype,"_popoverWidth",void 0),(0,o.Cg)([(0,n.wk)()],y.prototype,"_openedNarrow",void 0),(0,o.Cg)([(0,n.wk)()],y.prototype,"_unknownValue",void 0),(0,o.Cg)([(0,n.wk)()],y.prototype,"_selectedValue",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"error-message"})],y.prototype,"errorMessage",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],y.prototype,"invalid",void 0),y=(0,o.Cg)([(0,n.EM)("ha-generic-picker")],y),t()}catch(e){t(e)}})},64138(e,t,a){a.a(e,async function(e,o){try{a.r(t),a.d(t,{HaIconPicker:()=>f});a(74423),a(44114),a(18111),a(22489),a(7588),a(61701),a(13579);var i=a(62826),r=a(5124),s=a(22441),n=a(22786),l=a(1087),h=a(700),d=(a(75064),a(38508)),c=(a(47680),e([d]));d=(c.then?(await c)():c)[0];let p=[],u=!1;const v=(e,t)=>{const a=`${t}:${e.name}`,o=e.name,i=o.split("-"),r=e.keywords??[],s={iconName:o};return i.forEach((e,t)=>{s[`part${t}`]=e}),r.forEach((e,t)=>{s[`keyword${t}`]=e}),{id:a,primary:a,icon:a,search_labels:s,sorting_label:a}},g=async()=>{u=!0;const e=await a.e(81340).then(a.t.bind(a,25143,19));p=e.default.map(e=>v(e,"mdi"));const t=[];Object.keys(h.y).forEach(e=>{t.push(m(e))}),(await Promise.all(t)).forEach(e=>{p.push(...e)})},m=async e=>{try{const t=h.y[e].getIconList;if("function"!=typeof t)return[];return(await t()).map(t=>v(t,e))}catch(t){return console.warn(`Unable to load icon list for ${e} iconset`),[]}},b=e=>r.qy` <ha-combo-box-item type="button"> <ha-icon .icon="${e.id}" slot="start"></ha-icon> ${e.id} </ha-combo-box-item> `;class f extends r.WF{render(){return r.qy` <ha-generic-picker allow-custom-value .getItems="${this._getIconPickerItems}" .helper="${this.helper}" .disabled="${this.disabled}" .required="${this.required}" .errorMessage="${this.errorMessage}" .invalid="${this.invalid}" .rowRenderer="${b}" .icon="${this._icon}" .label="${this.label}" .value="${this._value}" .searchFn="${this._filterIcons}" @value-changed="${this._valueChanged}"> <slot name="start"></slot> </ha-generic-picker> `}firstUpdated(){u||g().then(()=>{this._getIconPickerItems=()=>p,this.requestUpdate()})}_valueChanged(e){e.stopPropagation(),this._setValue(e.detail.value)}_setValue(e){this.value=e,(0,l.r)(this,"value-changed",{value:this._value},{bubbles:!1,composed:!1})}get _icon(){return this.value?.length?this.value:this.placeholder}get _value(){return this.value||""}constructor(...e){super(...e),this.disabled=!1,this.required=!1,this.invalid=!1,this._getIconPickerItems=()=>p,this._filterIcons=(0,n.A)((e,t,a)=>{const o=e.toLowerCase().replace(/\s+/g,"-"),i=a?.length?a:t;if(!o.length)return i;const r=[];for(const e of i){const t=(e.id.split(":")[1]||e.id).toLowerCase().split("-"),a=e.search_labels?Object.values(e.search_labels).filter(e=>null!==e).map(e=>e.toLowerCase()):[],i=e.id.toLowerCase();t.includes(o)?r.push({item:e,rank:1}):a.includes(o)?r.push({item:e,rank:2}):i.includes(o)?r.push({item:e,rank:3}):a.some(e=>e.includes(o))&&r.push({item:e,rank:4})}return r.sort((e,t)=>e.rank-t.rank).map(e=>e.item)})}}f.styles=r.AH`ha-generic-picker{width:100%;display:block}`,(0,i.Cg)([(0,s.MZ)()],f.prototype,"value",void 0),(0,i.Cg)([(0,s.MZ)()],f.prototype,"label",void 0),(0,i.Cg)([(0,s.MZ)()],f.prototype,"helper",void 0),(0,i.Cg)([(0,s.MZ)()],f.prototype,"placeholder",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"error-message"})],f.prototype,"errorMessage",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],f.prototype,"disabled",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],f.prototype,"required",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],f.prototype,"invalid",void 0),f=(0,i.Cg)([(0,s.EM)("ha-icon-picker")],f),o()}catch(e){o(e)}})},3449(e,t,a){var o=a(62826),i=a(5124),r=a(22441);class s extends i.WF{render(){return i.qy`<slot></slot>`}constructor(...e){super(...e),this.disabled=!1}}s.styles=i.AH`:host{display:block;color:var(--mdc-text-field-label-ink-color,rgba(0,0,0,.6));font-size:var(--ha-font-size-s);padding-left:16px;padding-right:16px;padding-inline-start:16px;padding-inline-end:16px;letter-spacing:var(
        --mdc-typography-caption-letter-spacing,
        .0333333333em
      );line-height:normal}:host([disabled]){color:var(--mdc-text-field-disabled-ink-color,rgba(0,0,0,.6))}`,(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],s.prototype,"disabled",void 0),s=(0,o.Cg)([(0,r.EM)("ha-input-helper-text")],s)},88285(e,t,a){a.a(e,async function(e,t){try{var o=a(62826),i=a(35211),r=a(5124),s=a(22441),n=a(63672),l=a(1087),h=a(22792),d=a(17894),c=(a(75064),a(47680),a(26300)),p=e([c]);c=(p.then?(await p)():p)[0];const u="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",v="M7,10L12,15L17,10H7Z";class g extends((0,d.c)(r.WF)){async focus(){await this.updateComplete,await(this.item?.focus())}render(){const e=!!this.value,t=!(!this.value||this.required||this.disabled||this.hideClearIcon),a=this.placeholder??this.label,o=this.label&&e?r.qy`<span slot="overline">${this.label}${this.required?" *":""}</span>`:r.s6,i=e?this.valueRenderer?this.valueRenderer(this.value??""):r.qy`<span slot="headline">${this.value}</span>`:a?r.qy`<span slot="headline" class="placeholder"> ${a}${this.required?" *":""} </span>`:r.s6;return r.qy` <ha-combo-box-item aria-label="${(0,n.J)(this.label||this.placeholder)}" .disabled="${this.disabled}" type="button" compact="compact"> ${this.image?r.qy`<img alt="${this.label??""}" slot="start" .src="${this.image}" crossorigin="anonymous" referrerpolicy="no-referrer">`:this.icon?r.qy`<ha-icon slot="start" .icon="${this.icon}"></ha-icon>`:r.qy`<slot name="start"></slot>`} ${o}${i} ${this.unknown?r.qy`<div slot="supporting-text" class="unknown"> ${this.unknownItemText||this._i18n?.localize("ui.components.combo-box.unknown_item")} </div>`:r.s6} ${t?r.qy` <ha-icon-button class="clear" slot="end" @click="${this._clear}" .path="${u}"></ha-icon-button> `:r.s6} <ha-svg-icon class="arrow" slot="end" .path="${v}"></ha-svg-icon> </ha-combo-box-item> `}_clear(e){e.stopPropagation(),(0,l.r)(this,"clear")}static get styles(){return[r.AH`ha-combo-box-item[disabled]{background-color:var(--ha-color-form-background-disabled);--md-list-item-disabled-opacity:0.5;opacity:.5;cursor:not-allowed}ha-combo-box-item{position:relative;background-color:var(--ha-color-form-background);border-radius:var(--ha-border-radius-sm);border-end-end-radius:0;border-end-start-radius:0;--md-list-item-one-line-container-height:56px;--md-list-item-two-line-container-height:56px;--md-list-item-top-space:0px;--md-list-item-bottom-space:0px;--md-list-item-leading-space:var(--ha-space-4);--md-list-item-trailing-space:var(--ha-space-2);--ha-md-list-item-gap:var(--ha-space-2);--md-focus-ring-width:0px;--md-focus-ring-duration:0s}ha-combo-box-item:after{display:block;content:"";position:absolute;pointer-events:none;bottom:0;left:0;right:0;height:1px;width:100%;background-color:var(--ha-color-border-neutral-loud);transform:height 180ms ease-in-out,background-color 180ms ease-in-out}ha-combo-box-item:focus:after{height:2px;background-color:var(--mdc-theme-primary)}:host([unknown]) ha-combo-box-item{background-color:var(--ha-color-fill-warning-quiet-resting)}:host([invalid]) ha-combo-box-item:after{height:2px;background-color:var(--mdc-theme-error,var(--error-color,#b00020))}.clear{margin:0 -8px;--ha-icon-button-size:32px;--ha-icon-button-padding-inline:var(--ha-space-1)}.arrow{--mdc-icon-size:20px;width:32px}.placeholder{color:var(--secondary-text-color)}:host([invalid]) .placeholder{color:var(--mdc-theme-error,var(--error-color,#b00020))}.unknown{color:var(--ha-color-on-warning-normal)}`]}constructor(...e){super(...e),this.invalid=!1}}(0,o.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],g.prototype,"invalid",void 0),(0,o.Cg)([(0,s.P)("ha-combo-box-item",!0)],g.prototype,"item",void 0),(0,o.Cg)([(0,s.wk)(),(0,i.Fg)({context:h.D5,subscribe:!0})],g.prototype,"_i18n",void 0),g=(0,o.Cg)([(0,s.EM)("ha-picker-field")],g),t()}catch(e){t(e)}})},59646(e,t,a){a.a(e,async function(e,t){try{var o=a(62826),i=a(29344),r=a(5124),s=a(22441),n=a(88360),l=e([i]);i=(l.then?(await l)():l)[0];class h extends i.A{updated(e){super.updated(e),e.has("haptic")&&(this.haptic?this.addEventListener("change",this._forwardHaptic):this.removeEventListener("change",this._forwardHaptic))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",this._forwardHaptic)}static get styles(){return[i.A.styles,r.AH`:host{--wa-form-control-toggle-size:var(--ha-switch-size, 24px);--wa-form-control-required-content:var(
            --ha-switch-required-marker,
            var(--ha-input-required-marker, "*")
          );--wa-form-control-required-content-offset:var(
            --ha-switch-required-marker-offset,
            0.1rem
          );--thumb-size:var(--ha-switch-thumb-size, 18px);--width:var(--ha-switch-width, 48px)}label{position:relative;height:max(var(--thumb-size),var(--wa-form-control-toggle-size))}label::before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;min-width:var(--ha-switch-min-touch-size,40px);min-height:var(--ha-switch-min-touch-size,40px)}label.disabled::before{pointer-events:none}.switch{background-color:var(--ha-switch-background-color,var(--ha-color-fill-disabled-quiet-resting));border-color:var(--ha-switch-border-color,var(--ha-color-border-neutral-normal))}label:not(.disabled) .input:focus-visible~.switch,label:not(.disabled):hover .switch{background-color:var(--ha-switch-background-color-hover,var(--ha-switch-background-color,var(--ha-color-fill-disabled-quiet-hover)))}.checked .switch{background-color:var(--ha-switch-checked-background-color,var(--ha-color-fill-primary-normal-resting));border-color:var(--ha-switch-checked-border-color,var(--ha-color-border-primary-loud))}label:not(.disabled).checked .input:focus-visible~.switch,label:not(.disabled).checked:hover .switch{background-color:var(--ha-switch-checked-background-color-hover,var(--ha-switch-checked-background-color,var(--ha-color-fill-primary-normal-hover)));border-color:var(--ha-switch-checked-border-color-hover,var(--ha-switch-checked-border-color,var(--ha-color-border-primary-loud)))}.switch .thumb{background-color:var(--ha-switch-thumb-background-color,var(--ha-color-on-neutral-normal));border-color:var(--ha-switch-thumb-border-color,var(--ha-color-on-neutral-normal));border-style:var(--wa-form-control-border-style);border-width:var(--wa-form-control-border-width);box-shadow:var(--ha-switch-thumb-box-shadow,var(--ha-box-shadow-s))}label:not(.disabled) .input:focus-visible~.switch .thumb,label:not(.disabled):hover .switch .thumb{background-color:var(--ha-switch-thumb-background-color-hover,var(--ha-switch-thumb-background-color,var(--ha-color-on-neutral-normal)));border-color:var(--ha-switch-thumb-border-color-hover,var(--ha-switch-thumb-border-color,var(--ha-color-on-neutral-normal)))}.checked .switch .thumb{background-color:var(--ha-switch-checked-thumb-background-color,var(--ha-color-on-primary-normal));border-color:var(--ha-switch-checked-thumb-border-color,var(--ha-color-on-primary-normal))}label:not(.disabled).checked .input:focus-visible~.switch .thumb,label:not(.disabled).checked:hover .switch .thumb{background-color:var(--ha-switch-checked-thumb-background-color-hover,var(--ha-switch-checked-thumb-background-color,var(--ha-color-on-primary-normal)));border-color:var(--ha-switch-checked-thumb-border-color-hover,var(--ha-switch-checked-thumb-border-color,var(--ha-color-on-primary-normal)))}label.disabled{opacity:var(--ha-switch-disabled-opacity, .3);cursor:not-allowed}label:not(.disabled) .input:focus-visible~.switch .thumb{outline:0;outline-offset:none}label:not(.disabled) .input:focus-visible~.switch{outline:var(--wa-focus-ring);outline-offset:var(--wa-focus-ring-offset)}:host(:empty) slot.label{display:none}`]}constructor(...e){super(...e),this.haptic=!1,this._forwardHaptic=()=>{(0,n.j)(this,"light")}}}(0,o.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"haptic",void 0),h=(0,o.Cg)([(0,s.EM)("ha-switch")],h),t()}catch(e){t(e)}})},56304(e,t,a){a.a(e,async function(e,t){try{var o=a(62826),i=a(99324),r=a(92070),s=a(5124),n=a(22441),l=a(6412),h=a(63672),d=a(57237),c=a(53305),p=e([i]);i=(p.then?(await p)():p)[0];class u extends((0,c.w)(s.WF)){get _formControl(){return this._textarea}setFocused(e){e?this.toggleAttribute("focused",!0):this.removeAttribute("focused")}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",d.d)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",d.d)}async firstUpdated(e){super.firstUpdated(e),this.autofocus&&(await(this._textarea?.updateComplete),this._textarea?.focus())}focus(e){this._textarea?.focus(e)}render(){const e=!this.label&&this._hasSlotController.test("label"),t=!this.hint&&this._hasSlotController.test("hint");return s.qy` <wa-textarea .value="${this.value??null}" .placeholder="${this.placeholder}" .readonly="${this.readonly}" .required="${this.required}" .rows="${this.rows??4}" .resize="${this.resize}" .disabled="${this.disabled}" name="${(0,h.J)(this.name)}" autocapitalize="${(0,h.J)(this.autocapitalize||void 0)}" autocomplete="${(0,h.J)(this.autocomplete)}" .autofocus="${this.autofocus}" .spellcheck="${this.spellcheck}" inputmode="${(0,h.J)(this.inputmode||void 0)}" enterkeyhint="${(0,h.J)(this.enterkeyhint||void 0)}" minlength="${(0,h.J)(this.minlength)}" maxlength="${(0,h.J)(this.maxlength)}" class="${(0,l.H)({input:!0,invalid:this.invalid||this._invalid,"label-raised":void 0!==this.value&&""!==this.value||this.label&&this.placeholder,"no-label":!this.label,"hint-hidden":!(this.hint||t||this.required||this._invalid||this.invalid)})}" @input="${this._handleInput}" @change="${this._handleChange}" @blur="${this._handleBlur}" @wa-invalid="${this._handleInvalid}" exportparts="base:wa-base, hint:wa-hint, textarea:wa-textarea"> ${this.label||e?s.qy`<slot name="label" slot="label">${this.label?this._renderLabel(this.label,this.required):s.s6}</slot>`:s.s6} <div slot="hint" class="${(0,l.H)({error:this.invalid||this._invalid})}" role="${(0,h.J)(this.invalid||this._invalid?"alert":void 0)}" aria-live="polite"> ${this._invalid||this.invalid?this.validationMessage||this._textarea?.validationMessage:this.hint||(t?s.qy`<slot name="hint"></slot>`:s.s6)} </div> </wa-textarea> `}constructor(...e){super(...e),this.resize="none",this._hasSlotController=new r.X(this,"label","hint"),this._requiredMarkerCSSVar="--ha-textarea-required-marker"}}u.styles=[c.N,s.AH`:host{display:flex;align-items:flex-start;padding-bottom:var(--ha-textarea-padding-bottom)}wa-textarea::part(label){width:calc(100% - var(--ha-space-2));background-color:var(--ha-color-form-background);transition:all var(--wa-transition-normal) ease-in-out,background-color var(--wa-transition-normal) ease-in-out;padding-inline-start:var(--ha-space-3);padding-inline-end:var(--ha-space-3);margin:var(--ha-space-1) var(--ha-space-1) 0;padding-top:var(--ha-space-4);white-space:nowrap;overflow:hidden}:host(:focus-within) wa-textarea::part(label),:host([focused]) wa-textarea::part(label){color:var(--primary-color)}:host(:focus-within) wa-textarea::part(label),:host([focused]) wa-textarea::part(label),wa-textarea.label-raised::part(label){padding-top:var(--ha-space-2);font-size:var(--ha-font-size-xs)}wa-textarea.no-label::part(label){height:0;padding:0}wa-textarea::part(base){min-height:56px;padding-top:var(--ha-space-6);padding-bottom:var(--ha-space-2)}wa-textarea.no-label::part(base){padding-top:var(--ha-space-3)}wa-textarea::part(base)::after{content:"";position:absolute;bottom:0;left:0;right:0;height:1px;background-color:var(--ha-color-border-neutral-loud);transition:height var(--wa-transition-normal) ease-in-out,background-color var(--wa-transition-normal) ease-in-out}:host(:focus-within) wa-textarea::part(base)::after,:host([focused]) wa-textarea::part(base)::after{height:2px;background-color:var(--primary-color)}:host(:focus-within) wa-textarea.invalid::part(base)::after,wa-textarea.invalid:not([disabled])::part(base)::after{background-color:var(--ha-color-border-danger-normal)}wa-textarea::part(textarea){padding:0 var(--ha-space-4);font-family:var(--ha-font-family-body);font-size:var(--ha-font-size-m)}:host([resize=auto]) wa-textarea::part(textarea){max-height:var(--ha-textarea-max-height,200px);overflow-y:auto}wa-textarea:hover::part(base),wa-textarea:hover::part(label){background-color:var(--ha-color-form-background-hover)}wa-textarea[disabled]::part(textarea){cursor:not-allowed}wa-textarea[disabled]::part(base),wa-textarea[disabled]::part(label){background-color:var(--ha-color-form-background-disabled)}`],(0,o.Cg)([(0,n.MZ)({type:Number})],u.prototype,"rows",void 0),(0,o.Cg)([(0,n.MZ)()],u.prototype,"resize",void 0),(0,o.Cg)([(0,n.P)("wa-textarea")],u.prototype,"_textarea",void 0),u=(0,o.Cg)([(0,n.EM)("ha-textarea")],u),t()}catch(e){t(e)}})},88360(e,t,a){a.d(t,{j:()=>i});var o=a(1087);const i=(e,t)=>{(0,o.r)(e,"haptic",t)}},89441(e,t,a){a.d(t,{O:()=>i});var o=a(1087);const i=e=>class extends e{closeDialog(e){if(this._closePromise)return this._closePromise;const t=this.shadowRoot?.querySelector("ha-adaptive-popover, ha-adaptive-dialog, ha-dialog, ha-bottom-sheet");return t&&(this._closePromise=new Promise(e=>{this._closeResolve=e}),t.open=!1),this._closePromise||!0}connectedCallback(){super.connectedCallback(),this.addEventListener("closed",this._removeDialog,{once:!0})}disconnectedCallback(){this._dialogClosedFired||(0,o.r)(this,"dialog-closed",{dialog:this.localName}),this.removeEventListener("closed",this._removeDialog),super.disconnectedCallback()}constructor(...e){super(...e),this.dialogNext=!0,this._dialogClosedFired=!1,this._removeDialog=e=>{e.stopPropagation(),this._closeResolve?.(!0),this._closePromise=void 0,this._closeResolve=void 0,this._dialogClosedFired=!0,(0,o.r)(this,"dialog-closed",{dialog:this.localName}),this.remove()}}}},17894(e,t,a){a.d(t,{c:()=>r});var o=a(62826),i=a(22441);const r=e=>{class t extends e{constructor(...e){super(...e),this.disabled=!1,this.required=!1,this.unknown=!1,this.hideClearIcon=!1}}return(0,o.Cg)([(0,i.MZ)({type:Boolean})],t.prototype,"disabled",void 0),(0,o.Cg)([(0,i.MZ)({type:Boolean})],t.prototype,"required",void 0),(0,o.Cg)([(0,i.MZ)()],t.prototype,"icon",void 0),(0,o.Cg)([(0,i.MZ)()],t.prototype,"image",void 0),(0,o.Cg)([(0,i.MZ)()],t.prototype,"label",void 0),(0,o.Cg)([(0,i.MZ)()],t.prototype,"placeholder",void 0),(0,o.Cg)([(0,i.MZ)()],t.prototype,"helper",void 0),(0,o.Cg)([(0,i.MZ)()],t.prototype,"value",void 0),(0,o.Cg)([(0,i.MZ)({type:Boolean,reflect:!0})],t.prototype,"unknown",void 0),(0,o.Cg)([(0,i.MZ)({attribute:"unknown-item-text"})],t.prototype,"unknownItemText",void 0),(0,o.Cg)([(0,i.MZ)({attribute:"hide-clear-icon",type:Boolean})],t.prototype,"hideClearIcon",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],t.prototype,"valueRenderer",void 0),t}},427(e,t,a){a.a(e,async function(e,o){try{a.r(t);var i=a(62826),r=a(35211),s=a(5124),n=a(22441),l=a(38962),h=a(18350),d=a(986),c=a(72554),p=(a(93444),a(64138)),u=a(59646),v=a(56304),g=a(91485),m=a(22792),b=a(89441),f=a(14503),w=e([l,h,d,c,p,u,v,g]);[l,h,d,c,p,u,v,g]=w.then?(await w)():w;class y extends((0,b.O)(s.WF)){connectedCallback(){super.connectedCallback(),this.params?.entry?(this._name=this.params.entry.name||"",this._icon=this.params.entry.icon||"",this._color=this.params.entry.color||"",this._description=this.params.entry.description||""):(this._name=this.params?.suggestedName||"",this._icon="",this._color="",this._description="")}render(){return this.params?s.qy` <ha-dialog open header-title="${this.params.entry?this.params.entry.name||this.params.entry.label_id:this._i18n.localize("ui.dialogs.label-detail.new_label")}" prevent-scrim-close> <div> ${this._error?s.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:""} <div class="form"> <ha-input autofocus .value="${this._name}" .configValue="${"name"}" @input="${this._input}" .label="${this._i18n.localize("ui.dialogs.label-detail.name")}" .validationMessage="${this._i18n.localize("ui.dialogs.label-detail.required_error_msg")}" required></ha-input> <ha-icon-picker .value="${this._icon}" .configValue="${"icon"}" @value-changed="${this._valueChanged}" .label="${this._i18n.localize("ui.dialogs.label-detail.icon")}"></ha-icon-picker> <ha-color-picker .value="${this._color}" .configValue="${"color"}" @value-changed="${this._valueChanged}" .label="${this._i18n.localize("ui.dialogs.label-detail.color")}"></ha-color-picker> <ha-textarea .value="${this._description}" .configValue="${"description"}" @input="${this._input}" .label="${this._i18n.localize("ui.dialogs.label-detail.description")}"></ha-textarea> </div> </div> <ha-dialog-footer slot="footer"> ${this.params.entry&&this.params.removeEntry?s.qy` <ha-button slot="secondaryAction" variant="danger" appearance="plain" @click="${this._deleteEntry}" .disabled="${this._submitting}"> ${this._i18n.localize("ui.common.delete")} </ha-button> `:s.qy` <ha-button appearance="plain" slot="secondaryAction" @click="${this.closeDialog}"> ${this._i18n.localize("ui.common.cancel")} </ha-button> `} <ha-button slot="primaryAction" @click="${this._updateEntry}" .disabled="${this._submitting||!this._name}"> ${this.params.entry?this._i18n.localize("ui.common.update"):this._i18n.localize("ui.common.create")} </ha-button> </ha-dialog-footer> </ha-dialog> `:s.s6}_input(e){const t=e.target,a=t.configValue;this._error=void 0,this[`_${a}`]=t.value}_valueChanged(e){const t=e.target.configValue;this._error=void 0,this[`_${t}`]=e.detail.value||""}async _updateEntry(){this._submitting=!0;try{const e={name:this._name.trim(),icon:this._icon.trim()||null,color:this._color.trim()||null,description:this._description.trim()||null};this.params.entry?await this.params.updateEntry(e):await this.params.createEntry(e),this.closeDialog()}catch(e){this._error=e?e.message:"Unknown error"}finally{this._submitting=!1}}async _deleteEntry(){this._submitting=!0;try{await this.params.removeEntry()&&(this.params=void 0)}finally{this._submitting=!1}}static get styles(){return[f.nA,s.AH`a{color:var(--primary-color)}ha-color-picker,ha-icon-picker,ha-textarea{display:block;margin-bottom:var(--ha-space-5)}ha-input{--ha-input-padding-bottom:0}`]}constructor(...e){super(...e),this._submitting=!1}}(0,i.Cg)([(0,n.wk)(),(0,r.Fg)({context:m.D5,subscribe:!0})],y.prototype,"_i18n",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_name",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_icon",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_color",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_description",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_error",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_submitting",void 0),y=(0,i.Cg)([(0,n.EM)("dialog-label-detail")],y),o()}catch(e){o(e)}})},88438(e,t,a){a.d(t,{C:()=>o});const o="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}};