iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
10 lines • 59.9 kB
JavaScript
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["55815"],{57724:function(t,e,i){i.a(t,(async function(t,o){try{i.d(e,{w:()=>d});var a=i(97836),s=i(61985),r=i(64214),n=i(33570),l=t([n,r]);[n,r]=l.then?(await l)():l;const d=(t,e,i,o)=>{const l=null!=o?o:new Date;return(0,a.K)(t,l)?(0,n.mr)(t,e,i):(0,s.F)(t,l)?(0,r.yD)(t,e,i):(0,r.DG)(t,e,i)};o()}catch(d){o(d)}}))},40087:function(t,e,i){i.a(t,(async function(t,e){try{var o=i(61701),a=i(72621),s=(i(71695),i(47021),i(32424)),r=i(7591),n=i(14276),l=i(57243),d=i(50778),c=i(57724),h=t([c]);c=(h.then?(await h)():h)[0];const u=5e3;(0,o.Z)([(0,d.Mo)("ha-absolute-time")],(function(t,e){class i extends e{constructor(...e){super(...e),t(this)}}return{F:i,d:[{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"datetime",value:void 0},{kind:"field",key:"_timeout",value:void 0},{kind:"method",key:"disconnectedCallback",value:function(){(0,a.Z)(i,"disconnectedCallback",this,3)([]),this._clearTimeout()}},{kind:"method",key:"connectedCallback",value:function(){(0,a.Z)(i,"connectedCallback",this,3)([]),this.datetime&&this._updateNextDay()}},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"firstUpdated",value:function(t){(0,a.Z)(i,"firstUpdated",this,3)([t]),this._updateAbsolute()}},{kind:"method",key:"update",value:function(t){(0,a.Z)(i,"update",this,3)([t]),this._updateAbsolute()}},{kind:"method",key:"_clearTimeout",value:function(){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=void 0)}},{kind:"method",key:"_updateNextDay",value:function(){this._clearTimeout();const t=new Date,e=(0,s.E)((0,r.b)(t),1),i=(0,n._)(e,t)+u;this._timeout=window.setTimeout((()=>{this._updateNextDay(),this._updateAbsolute()}),i)}},{kind:"method",key:"_updateAbsolute",value:function(){this.datetime?this.innerHTML=(0,c.w)(new Date(this.datetime),this.hass.locale,this.hass.config):this.innerHTML=this.hass.localize("ui.components.absolute_time.never")}}]}}),l.fl);e()}catch(u){e(u)}}))},12763:function(t,e,i){i.a(t,(async function(t,e){try{var o=i(61701),a=(i(22152),i(71695),i(9359),i(56475),i(70104),i(47021),i(57243)),s=i(50778),r=i(25904),n=i(59519),l=i(28008),d=i(59389),c=(i(41307),t([d,n,r]));[d,n,r]=c.then?(await c)():c;let h,u,b,v,f,p=t=>t;(0,o.Z)([(0,s.Mo)("ha-attributes")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"stateObj",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:"extra-filters"})],key:"extraFilters",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_expanded",value(){return!1}},{kind:"get",key:"_filteredAttributes",value:function(){return this._computeDisplayAttributes(n.wk.concat(this.extraFilters?this.extraFilters.split(","):[]))}},{kind:"method",key:"willUpdate",value:function(t){(t.has("extraFilters")||t.has("stateObj"))&&this.toggleAttribute("empty",0===this._filteredAttributes.length)}},{kind:"method",key:"render",value:function(){if(!this.stateObj)return a.Ld;const t=this._filteredAttributes;return 0===t.length?a.Ld:(0,a.dy)(h||(h=p` <ha-expansion-panel .header="${0}" outlined @expanded-will-change="${0}"> <div class="attribute-container"> ${0} </div> </ha-expansion-panel> ${0} `),this.hass.localize("ui.components.attributes.expansion_header"),this._expandedChanged,this._expanded?(0,a.dy)(u||(u=p` ${0} `),t.map((t=>(0,a.dy)(b||(b=p` <div class="data-entry"> <div class="key"> ${0} </div> <div class="value"> <ha-attribute-value .hass="${0}" .attribute="${0}" .stateObj="${0}"></ha-attribute-value> </div> </div> `),(0,r.computeAttributeNameDisplay)(this.hass.localize,this.stateObj,this.hass.entities,t),this.hass,t,this.stateObj)))):"",this.stateObj.attributes.attribution?(0,a.dy)(v||(v=p` <div class="attribution"> ${0} </div> `),this.stateObj.attributes.attribution):"")}},{kind:"get",static:!0,key:"styles",value:function(){return[l.Qx,(0,a.iv)(f||(f=p`.attribute-container{margin-bottom:8px;direction:ltr}.data-entry{display:flex;flex-direction:row;justify-content:space-between}.data-entry .value{max-width:60%;overflow-wrap:break-word;text-align:right}.key{flex-grow:1}.attribution{color:var(--secondary-text-color);text-align:center;margin-top:16px}hr{border-color:var(--divider-color);border-bottom:none;margin:16px 0}`))]}},{kind:"method",key:"_computeDisplayAttributes",value:function(t){return this.stateObj?Object.keys(this.stateObj.attributes).filter((e=>-1===t.indexOf(e))):[]}},{kind:"method",key:"_expandedChanged",value:function(t){this._expanded=t.detail.expanded}}]}}),a.oi);e()}catch(h){e(h)}}))},45747:function(t,e,i){i.r(e),i.d(e,{HaIconButtonGroup:()=>d});var o=i(61701),a=(i(71695),i(47021),i(57243)),s=i(50778);let r,n,l=t=>t,d=(0,o.Z)([(0,s.Mo)("ha-icon-button-group")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"method",key:"render",value:function(){return(0,a.dy)(r||(r=l`<slot></slot>`))}},{kind:"field",static:!0,key:"styles",value(){return(0,a.iv)(n||(n=l`:host{position:relative;display:flex;flex-direction:row;align-items:center;height:48px;border-radius:28px;background-color:rgba(139,145,151,.1);box-sizing:border-box;width:auto;padding:0}::slotted(.separator){background-color:rgba(var(--rgb-primary-text-color),.15);width:1px;margin:0 1px;height:40px}`))}}]}}),a.oi)},5828:function(t,e,i){i.r(e),i.d(e,{HaIconButtonPrev:()=>d});var o=i(61701),a=(i(71695),i(47021),i(57243)),s=i(50778),r=i(5111);i(23334);let n,l=t=>t;let d=(0,o.Z)([(0,s.Mo)("ha-icon-button-prev")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,s.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_icon",value(){return"rtl"===r.E.document.dir?"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z":"M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z"}},{kind:"method",key:"render",value:function(){var t;return(0,a.dy)(n||(n=l` <ha-icon-button .disabled="${0}" .label="${0}" .path="${0}"></ha-icon-button> `),this.disabled,this.label||(null===(t=this.hass)||void 0===t?void 0:t.localize("ui.common.back"))||"Back",this._icon)}}]}}),a.oi)},79505:function(t,e,i){i.r(e),i.d(e,{HaIconButtonToggle:()=>d});var o=i(61701),a=(i(71695),i(47021),i(57243)),s=i(50778),r=i(23334);let n,l=t=>t,d=(0,o.Z)([(0,s.Mo)("ha-icon-button-toggle")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({type:Boolean,reflect:!0})],key:"selected",value(){return!1}},{kind:"field",static:!0,key:"styles",value(){return(0,a.iv)(n||(n=l`:host{position:relative}mwc-icon-button{position:relative;transition:color 180ms ease-in-out}mwc-icon-button::before{opacity:0;transition:opacity 180ms ease-in-out;background-color:var(--primary-text-color);border-radius:20px;height:40px;width:40px;content:"";position:absolute;top:-10px;left:-10px;bottom:-10px;right:-10px;margin:auto;box-sizing:border-box}:host([border-only]) mwc-icon-button::before{background-color:transparent;border:2px solid var(--primary-text-color)}:host([selected]) mwc-icon-button{color:var(--primary-background-color)}:host([selected]:not([disabled])) mwc-icon-button::before{opacity:1}`))}}]}}),r.HaIconButton)},34363:function(t,e,i){var o=i(61701),a=(i(71695),i(47021),i(57243)),s=i(50778);let r,n,l=t=>t;(0,o.Z)([(0,s.Mo)("ha-input-helper-text")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"method",key:"render",value:function(){return(0,a.dy)(r||(r=l`<slot></slot>`))}},{kind:"field",static:!0,key:"styles",value(){return(0,a.iv)(n||(n=l`:host{display:block;color:var(--mdc-text-field-label-ink-color,rgba(0,0,0,.6));font-size:.75rem;padding-left:16px;padding-right:16px;padding-inline-start:16px;padding-inline-end:16px}`))}}]}}),a.oi)},78614:function(t,e,i){var o=i(61701),a=(i(71695),i(47021),i(57243)),s=i(50778),r=i(36522);i(65981),i(34363),i(74421);let n,l,d,c,h=t=>t;(0,o.Z)([(0,s.Mo)("ha-labeled-slider")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"labeled",value(){return!1}},{kind:"field",decorators:[(0,s.Cb)()],key:"caption",value:void 0},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"required",value(){return!0}},{kind:"field",decorators:[(0,s.Cb)({type:Number})],key:"min",value(){return 0}},{kind:"field",decorators:[(0,s.Cb)({type:Number})],key:"max",value(){return 100}},{kind:"field",decorators:[(0,s.Cb)({type:Number})],key:"step",value(){return 1}},{kind:"field",decorators:[(0,s.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"extra",value(){return!1}},{kind:"field",decorators:[(0,s.Cb)()],key:"icon",value:void 0},{kind:"field",decorators:[(0,s.Cb)({type:Number})],key:"value",value:void 0},{kind:"method",key:"render",value:function(){return(0,a.dy)(n||(n=h` <div class="title">${0}</div> <div class="extra-container"><slot name="extra"></slot></div> <div class="slider-container"> ${0} <ha-slider .min="${0}" .max="${0}" .step="${0}" .labeled="${0}" .disabled="${0}" .value="${0}" @change="${0}"></ha-slider> </div> ${0} `),this._getTitle(),this.icon?(0,a.dy)(l||(l=h`<ha-icon icon="${0}"></ha-icon>`),this.icon):a.Ld,this.min,this.max,this.step,this.labeled,this.disabled,this.value,this._inputChanged,this.helper?(0,a.dy)(d||(d=h`<ha-input-helper-text> ${0} </ha-input-helper-text>`),this.helper):a.Ld)}},{kind:"method",key:"_getTitle",value:function(){return`${this.caption}${this.caption&&this.required?" *":""}`}},{kind:"method",key:"_inputChanged",value:function(t){(0,r.B)(this,"value-changed",{value:Number(t.target.value)})}},{kind:"field",static:!0,key:"styles",value(){return(0,a.iv)(c||(c=h`:host{display:block}.title{margin:5px 0 8px;color:var(--primary-text-color)}.slider-container{display:flex}ha-icon{margin-top:8px;color:var(--secondary-text-color)}ha-slider{flex-grow:1;background-image:var(--ha-slider-background);border-radius:4px}`))}}]}}),a.oi)},62801:function(t,e,i){var o=i(61701),a=i(72621),s=(i(71695),i(9359),i(56475),i(19423),i(40251),i(22139),i(47021),i(57243)),r=i(50778),n=i(36522);let l,d=t=>t;(0,o.Z)([(0,r.Mo)("ha-sortable")],(function(t,e){class o extends e{constructor(...e){super(...e),t(this)}}return{F:o,d:[{kind:"field",key:"_sortable",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,r.Cb)({type:Boolean,attribute:"no-style"})],key:"noStyle",value(){return!1}},{kind:"field",decorators:[(0,r.Cb)({type:String,attribute:"draggable-selector"})],key:"draggableSelector",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:String,attribute:"handle-selector"})],key:"handleSelector",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:String,attribute:"filter"})],key:"filter",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:String})],key:"group",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Boolean,attribute:"invert-swap"})],key:"invertSwap",value(){return!1}},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"options",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"rollback",value(){return!0}},{kind:"method",key:"updated",value:function(t){t.has("disabled")&&(this.disabled?this._destroySortable():this._createSortable())}},{kind:"field",key:"_shouldBeDestroy",value(){return!1}},{kind:"method",key:"disconnectedCallback",value:function(){(0,a.Z)(o,"disconnectedCallback",this,3)([]),this._shouldBeDestroy=!0,setTimeout((()=>{this._shouldBeDestroy&&(this._destroySortable(),this._shouldBeDestroy=!1)}),1)}},{kind:"method",key:"connectedCallback",value:function(){(0,a.Z)(o,"connectedCallback",this,3)([]),this._shouldBeDestroy=!1,this.hasUpdated&&!this.disabled&&this._createSortable()}},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"render",value:function(){return this.noStyle?s.Ld:(0,s.dy)(l||(l=d` <style>.sortable-fallback{display:none!important}.sortable-ghost{box-shadow:0 0 0 2px var(--primary-color);background:rgba(var(--rgb-primary-color),.25);border-radius:4px;opacity:.4}.sortable-drag{border-radius:4px;opacity:1;background:var(--card-background-color);box-shadow:0px 4px 8px 3px #00000026;cursor:grabbing}</style> `))}},{kind:"method",key:"_createSortable",value:async function(){if(this._sortable)return;const t=this.children[0];if(!t)return;const e=(await Promise.all([i.e("34153"),i.e("467")]).then(i.bind(i,59807))).default,o=Object.assign(Object.assign({scroll:!0,forceAutoScrollFallback:!0,scrollSpeed:20,animation:150},this.options),{},{onChoose:this._handleChoose,onStart:this._handleStart,onEnd:this._handleEnd,onUpdate:this._handleUpdate,onAdd:this._handleAdd,onRemove:this._handleRemove});this.draggableSelector&&(o.draggable=this.draggableSelector),this.handleSelector&&(o.handle=this.handleSelector),void 0!==this.invertSwap&&(o.invertSwap=this.invertSwap),this.group&&(o.group=this.group),this.filter&&(o.filter=this.filter),this._sortable=new e(t,o)}},{kind:"field",key:"_handleUpdate",value(){return t=>{(0,n.B)(this,"item-moved",{newIndex:t.newIndex,oldIndex:t.oldIndex})}}},{kind:"field",key:"_handleAdd",value(){return t=>{(0,n.B)(this,"item-added",{index:t.newIndex,data:t.item.sortableData})}}},{kind:"field",key:"_handleRemove",value(){return t=>{(0,n.B)(this,"item-removed",{index:t.oldIndex})}}},{kind:"field",key:"_handleEnd",value(){return async t=>{(0,n.B)(this,"drag-end"),this.rollback&&t.item.placeholder&&(t.item.placeholder.replaceWith(t.item),delete t.item.placeholder)}}},{kind:"field",key:"_handleStart",value(){return()=>{(0,n.B)(this,"drag-start")}}},{kind:"field",key:"_handleChoose",value(){return t=>{this.rollback&&(t.item.placeholder=document.createComment("sort-placeholder"),t.item.after(t.item.placeholder))}}},{kind:"method",key:"_destroySortable",value:function(){this._sortable&&(this._sortable.destroy(),this._sortable=void 0)}}]}}),s.oi)},44732:function(t,e,i){var o=i(61701),a=(i(71695),i(47021),i(57243)),s=i(50778),r=i(35359);let n,l,d=t=>t;(0,o.Z)([(0,s.Mo)("ha-more-info-control-select-container")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"method",key:"render",value:function(){const t=`items-${this.childElementCount}`;return(0,a.dy)(n||(n=d` <div class="controls"> <div class="controls-scroll ${0}"> <slot></slot> </div> </div> `),(0,r.$)({[t]:!0,multiline:this.childElementCount>=4}))}},{kind:"field",static:!0,key:"styles",value(){return(0,a.iv)(l||(l=d`.controls{display:flex;flex-direction:row;justify-content:center}.controls-scroll{display:flex;flex-direction:row;justify-content:flex-start;gap:12px;margin:auto;overflow:auto;-ms-overflow-style:none;scrollbar-width:none;margin:-2px -24px;padding:2px 24px}.controls-scroll::-webkit-scrollbar{display:none}::slotted(*){min-width:120px;max-width:160px;flex:none}@media all and (hover:hover),all and (min-width:600px) and (min-height:501px){.controls-scroll{justify-content:center;flex-wrap:wrap;width:100%;max-width:450px}.controls-scroll.items-4{max-width:300px}.controls-scroll.items-3 ::slotted(*){max-width:140px}.multiline ::slotted(*){width:140px}}`))}}]}}),a.oi)},92947:function(t,e,i){i.a(t,(async function(t,e){try{var o=i(61701),a=(i(71695),i(47021),i(57243)),s=i(50778),r=i(40087),n=i(95975),l=i(96194),d=i(96309),c=i(94333),h=t([r,n,c]);[r,n,c]=h.then?(await h)():h;let u,b,v,f,p,k=t=>t;(0,o.Z)([(0,s.Mo)("ha-more-info-state-header")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"stateObj",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"stateOverride",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"changedOverride",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_absoluteTime",value(){return!1}},{kind:"method",key:"_localizeState",value:function(){return this.stateObj.attributes.device_class!==d.Ft||(0,l.rk)(this.stateObj.state)?this.hass.formatEntityState(this.stateObj):(0,a.dy)(u||(u=k` <hui-timestamp-display .hass="${0}" .ts="${0}" format="relative" capitalize></hui-timestamp-display> `),this.hass,new Date(this.stateObj.state))}},{kind:"method",key:"_toggleAbsolute",value:function(){this._absoluteTime=!this._absoluteTime}},{kind:"method",key:"render",value:function(){var t,e,i;const o=null!==(t=this.stateOverride)&&void 0!==t?t:this._localizeState();return(0,a.dy)(b||(b=k` <p class="state">${0}</p> <p class="last-changed" @click="${0}"> ${0} </p> `),o,this._toggleAbsolute,this._absoluteTime?(0,a.dy)(v||(v=k` <ha-absolute-time .hass="${0}" .datetime="${0}"></ha-absolute-time> `),this.hass,null!==(e=this.changedOverride)&&void 0!==e?e:this.stateObj.last_changed):(0,a.dy)(f||(f=k` <ha-relative-time .hass="${0}" .datetime="${0}" capitalize></ha-relative-time> `),this.hass,null!==(i=this.changedOverride)&&void 0!==i?i:this.stateObj.last_changed))}},{kind:"field",static:!0,key:"styles",value(){return(0,a.iv)(p||(p=k`p{text-align:center;margin:0}.state{font-style:normal;font-weight:400;font-size:36px;line-height:44px}.last-changed{font-style:normal;font-weight:500;font-size:16px;line-height:24px;letter-spacing:.1px;padding:4px 0;margin-bottom:20px;cursor:pointer;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}`))}}]}}),a.oi);e()}catch(u){e(u)}}))},18481:function(t,e,i){var o=i(61701),a=(i(71695),i(47021),i(57243)),s=i(50778),r=i(20552),n=i(69634),l=i(11259),d=i(67180),c=i(37723);i(75138),i(37583);let h,u,b=t=>t;(0,o.Z)([(0,s.Mo)("ha-favorite-color-button")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"method",key:"focus",value:function(){var t;null===(t=this._button)||void 0===t||t.focus()}},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"label",value:void 0},{kind:"field",decorators:[(0,s.Cb)({type:Boolean,reflect:!0})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"stateObj",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"color",value:void 0},{kind:"field",decorators:[(0,s.IO)("ha-outlined-icon-button",!0)],key:"_button",value:void 0},{kind:"get",key:"_rgbColor",value:function(){if(this.color){if("hs_color"in this.color)return(0,l.Mc)([this.color.hs_color[0],this.color.hs_color[1]/100]);if("color_temp_kelvin"in this.color)return(0,d.h0)(this.color.color_temp_kelvin);if("rgb_color"in this.color)return this.color.rgb_color;if("rgbw_color"in this.color)return(0,d.zJ)(this.color.rgbw_color);var t,e;if("rgbww_color"in this.color)return(0,d.Pb)(this.color.rgbww_color,null===(t=this.stateObj)||void 0===t?void 0:t.attributes.min_color_temp_kelvin,null===(e=this.stateObj)||void 0===e?void 0:e.attributes.max_color_temp_kelvin)}return[255,255,255]}},{kind:"method",key:"render",value:function(){const t=(0,l.CO)(this._rgbColor),e=(0,c.T2)(this._rgbColor)>.8?[33,33,33]:[255,255,255],i=(0,l.CO)(e),o=e.join(", ");return(0,a.dy)(h||(h=b` <ha-outlined-icon-button no-ripple .disabled="${0}" title="${0}" aria-label="${0}" style="${0}"></ha-outlined-icon-button> `),this.disabled,(0,r.o)(this.label),(0,r.o)(this.label),(0,n.V)({"background-color":t,"--icon-color":i,"--rgb-icon-color":o}))}},{kind:"get",static:!0,key:"styles",value:function(){return[(0,a.iv)(u||(u=b`:host{display:block}ha-outlined-icon-button{--ha-icon-display:block;--md-sys-color-on-surface:var(
--icon-color,
var(--secondary-text-color)
);--md-sys-color-on-surface-variant:var(
--icon-color,
var(--secondary-text-color)
);--md-sys-color-on-surface-rgb:var(
--rgb-icon-color,
var(--rgb-secondary-text-color)
);--md-sys-color-outline:var(--divider-color);--md-ripple-focus-color:0;--md-ripple-hover-opacity:0;--md-ripple-pressed-opacity:0;border-radius:9999px}:host([disabled]){pointer-events:none}ha-outlined-icon-button[disabled]{filter:grayscale(1) opacity(.5)}`))]}}]}}),a.oi)},23979:function(t,e,i){i.a(t,(async function(t,e){try{var o=i(61701),a=(i(71695),i(9359),i(56475),i(70104),i(19423),i(40251),i(47021),i(57243)),s=i(50778),r=i(35359),n=i(36522),l=i(54250),d=(i(62801),i(96194)),c=i(63318),h=i(90243),u=i(3967),b=i(76131),v=(i(18481),i(84935)),f=t([l]);l=(f.then?(await f)():f)[0];let p,k,y,_,g,m=t=>t;const x="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",w="M19,13H5V11H19V13Z",$="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";(0,o.Z)([(0,s.Mo)("ha-more-info-light-favorite-colors")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"stateObj",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"entry",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"editMode",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_favoriteColors",value(){return[]}},{kind:"method",key:"updated",value:function(t){var e;t.has("entry")&&(this.entry&&(null!==(e=this.entry.options)&&void 0!==e&&null!==(e=e.light)&&void 0!==e&&e.favorite_colors?this._favoriteColors=this.entry.options.light.favorite_colors:this.stateObj&&(this._favoriteColors=(0,h.e4)(this.stateObj))))}},{kind:"method",key:"_colorMoved",value:function(t){t.stopPropagation();const{oldIndex:e,newIndex:i}=t.detail;this._move(e,i)}},{kind:"method",key:"_move",value:function(t,e){const i=this._favoriteColors.concat(),o=i.splice(t,1)[0];i.splice(e,0,o),this._favoriteColors=i,this._save(i)}},{kind:"field",key:"_apply",value(){return t=>{const e=this._favoriteColors[t];this.hass.callService("light","turn_on",Object.assign({entity_id:this.stateObj.entity_id},e))}}},{kind:"method",key:"_save",value:async function(t){const e=await(0,c.Nv)(this.hass,this.entry.entity_id,{options_domain:"light",options:{favorite_colors:t}});(0,n.B)(this,"entity-entry-updated",e.entity_entry)}},{kind:"field",key:"_add",value(){return async()=>{const t=await(0,v.E)(this,{entry:this.entry,title:this.hass.localize("ui.dialogs.more_info_control.light.favorite_color.add_title")});if(t){const e=[...this._favoriteColors,t];this._save(e)}}}},{kind:"field",key:"_edit",value(){return async t=>{(0,n.B)(this,"favorite-color-edit-started"),await this._apply(t);const e=await(0,v.E)(this,{entry:this.entry,initialColor:this._favoriteColors[t],title:this.hass.localize("ui.dialogs.more_info_control.light.favorite_color.edit_title")});if(e){const i=[...this._favoriteColors];i[t]=e,this._save(i)}else this._apply(t)}}},{kind:"field",key:"_delete",value(){return async t=>{if(!(await(0,b.showConfirmationDialog)(this,{destructive:!0,title:this.hass.localize("ui.dialogs.more_info_control.light.favorite_color.delete_confirm_title"),text:this.hass.localize("ui.dialogs.more_info_control.light.favorite_color.delete_confirm_text"),confirmText:this.hass.localize("ui.dialogs.more_info_control.light.favorite_color.delete_confirm_action")})))return;const e=this._favoriteColors.filter(((e,i)=>t!==i));this._save(e)}}},{kind:"field",key:"_handleDeleteButton",value(){return t=>{t.stopPropagation();const e=t.target.index;this._delete(e)}}},{kind:"field",key:"_handleAddButton",value(){return t=>{t.stopPropagation(),this._add()}}},{kind:"field",key:"_handleColorAction",value(){return t=>{var e;if(t.stopPropagation(),"hold"===t.detail.action&&null!==(e=this.hass.user)&&void 0!==e&&e.is_admin)return void(0,n.B)(this,"toggle-edit-mode",!0);const i=t.target.index;this.editMode?this._edit(i):this._apply(i)}}},{kind:"field",key:"_exitEditMode",value(){return t=>{t.stopPropagation(),(0,n.B)(this,"toggle-edit-mode",!1)}}},{kind:"method",key:"render",value:function(){return(0,a.dy)(p||(p=m` <ha-sortable @item-moved="${0}" item=".color" no-style .disabled="${0}"> <div class="container"> ${0} ${0} </div> </ha-sortable> `),this._colorMoved,!this.editMode,this._favoriteColors.map(((t,e)=>{var i;return(0,a.dy)(k||(k=m` <div class="color"> <div class="color-bubble ${0}"> <ha-favorite-color-button .label="${0}" .disabled="${0}" .color="${0}" .index="${0}" .actionHandler="${0}" @action="${0}"> </ha-favorite-color-button> ${0} </div> </div> `),(0,r.$)({shake:!!this.editMode}),this.hass.localize("ui.dialogs.more_info_control.light.favorite_color."+(this.editMode?"edit":"set"),{number:e}),this.stateObj.state===d.nZ,t,e,(0,u.K)({hasHold:!this.editMode&&(null===(i=this.hass.user)||void 0===i?void 0:i.is_admin),disabled:this.stateObj.state===d.nZ}),this._handleColorAction,this.editMode?(0,a.dy)(y||(y=m` <button @click="${0}" class="delete" .index="${0}" aria-label="${0}" .title="${0}"> <ha-svg-icon .path="${0}"></ha-svg-icon> </button> `),this._handleDeleteButton,e,this.hass.localize("ui.dialogs.more_info_control.light.favorite_color.delete",{number:e}),this.hass.localize("ui.dialogs.more_info_control.light.favorite_color.delete",{number:e}),w):a.Ld)})),this.editMode?(0,a.dy)(_||(_=m` <ha-outlined-icon-button class="button" @click="${0}"> <ha-svg-icon .path="${0}"></ha-svg-icon> </ha-outlined-icon-button> <ha-outlined-icon-button @click="${0}" class="button"> <ha-svg-icon .path="${0}"></ha-svg-icon> </ha-outlined-icon-button> `),this._handleAddButton,$,this._exitEditMode,x):a.Ld)}},{kind:"field",static:!0,key:"styles",value(){return(0,a.iv)(g||(g=m`.container{position:relative;display:flex;align-items:center;justify-content:center;margin:-8px;flex-wrap:wrap;max-width:250px;user-select:none}.container>*{margin:8px}.color{display:block}.color .color-bubble.shake{position:relative;display:block;animation:shake .45s linear infinite}.color:nth-child(3n+1) .color-bubble.shake{animation-delay:.15s}.color:nth-child(3n+2) .color-bubble.shake{animation-delay:.3s}.sortable-ghost{opacity:.4}.sortable-fallback{display:none}@keyframes shake{0%{transform:rotateZ(0deg) translateX(-1px) translateY(0) scale(1)}20%{transform:rotateZ(-3deg) translateX(0) translateY()}40%{transform:rotateZ(0deg) translateX(1px) translateY(0)}60%{transform:rotateZ(3deg) translateX(0) translateY(0)}100%{transform:rotateZ(0deg) translateX(-1px) translateY(0)}}.delete{position:absolute;top:-6px;right:-6px;inset-inline-end:-6px;inset-inline-start:initial;width:20px;height:20px;outline:0;background-color:var(--secondary-background-color);padding:0;border-radius:10px;border:none;cursor:pointer;display:block}.delete{--mdc-icon-size:12px;color:var(--primary-text-color)}.delete *{pointer-events:none}`))}}]}}),a.oi);e()}catch(p){e(p)}}))},41025:function(t,e,i){var o=i(61701),a=i(72621),s=(i(71695),i(92745),i(9359),i(68107),i(19423),i(47021),i(31622),i(57243)),r=i(50778),n=i(11259),l=i(36522),d=i(93826),c=i(54380),h=i(35359),u=i(69634),b=i(67180);let v,f,p,k=t=>t;function y(t,e){return[Math.sqrt(t*t+e*e),Math.atan2(e,t)]}function _(t,e){return[Math.cos(e)*t,Math.sin(e)*t]}function g(t){return t/360*2*Math.PI}function m(t,e,i,o,a,s){return null!=e?(0,b.zJ)([...t,e]):null!=i&&null!==o?(0,b.Pb)([...t,i,o],a,s):t}(0,o.Z)([(0,r.Mo)("ha-hs-color-picker")],(function(t,e){class i extends e{constructor(...e){super(...e),t(this)}}return{F:i,d:[{kind:"field",decorators:[(0,r.Cb)({type:Boolean,reflect:!0})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,r.Cb)({type:Number,attribute:!1})],key:"renderSize",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Array})],key:"value",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1,type:Number})],key:"colorBrightness",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Number})],key:"wv",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Number})],key:"cw",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Number})],key:"ww",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1,type:Number})],key:"minKelvin",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1,type:Number})],key:"maxKelvin",value:void 0},{kind:"field",decorators:[(0,r.IO)("#canvas")],key:"_canvas",value:void 0},{kind:"field",key:"_mc",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_pressed",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_cursorPosition",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_localValue",value:void 0},{kind:"method",key:"firstUpdated",value:function(t){(0,a.Z)(i,"firstUpdated",this,3)([t]),this._setupListeners(),this._generateColorWheel()}},{kind:"method",key:"_generateColorWheel",value:function(){!function(t,e,i,o,a,s,r=255){const l=t.canvas.width/2;t.clearRect(0,0,t.canvas.width,t.canvas.height),t.beginPath();const d=t.canvas.width/2,c=t.canvas.width/2;for(let h=0;h<360;h+=1){const u=g(h-.5),b=g(h+1.5);t.beginPath(),t.moveTo(d,c),t.arc(d,c,l,u,b),t.closePath();const v=t.createRadialGradient(d,c,0,d,c,l),f=(0,n.CO)(m((0,n.XG)([h,0,r]),e,i,o,a,s)),p=(0,n.CO)(m((0,n.XG)([h,1,r]),e,i,o,a,s));v.addColorStop(0,f),v.addColorStop(1,p),t.fillStyle=v,t.fill()}}(this._canvas.getContext("2d"),this.wv,this.cw,this.ww,this.minKelvin,this.maxKelvin,this.colorBrightness)}},{kind:"method",key:"connectedCallback",value:function(){(0,a.Z)(i,"connectedCallback",this,3)([]),this._setupListeners()}},{kind:"method",key:"disconnectedCallback",value:function(){(0,a.Z)(i,"disconnectedCallback",this,3)([]),this._destroyListeners()}},{kind:"method",key:"updated",value:function(t){var e,o,s,r;((0,a.Z)(i,"updated",this,3)([t]),(t.has("colorBrightness")||t.has("wv")||t.has("ww")||t.has("cw")||t.has("minKelvin")||t.has("maxKelvin"))&&this._generateColorWheel(),t.has("value"))&&((null===(e=this._localValue)||void 0===e?void 0:e[0])===(null===(o=this.value)||void 0===o?void 0:o[0])&&(null===(s=this._localValue)||void 0===s?void 0:s[1])===(null===(r=this.value)||void 0===r?void 0:r[1])||this._resetPosition())}},{kind:"method",key:"_setupListeners",value:function(){if(this._canvas&&!this._mc){let t;this._mc=new c.dK(this._canvas),this._mc.add(new c.Ce({direction:c.oM,enable:!0})),this._mc.add(new c.Uw({event:"singletap"})),this._mc.on("panstart",(e=>{this.disabled||(this._pressed=e.pointerType,t=this._cursorPosition)})),this._mc.on("pancancel",(()=>{this.disabled||(this._pressed=void 0,this._cursorPosition=t)})),this._mc.on("panmove",(t=>{this.disabled||(this._cursorPosition=this._getPositionFromEvent(t),this._localValue=this._getValueFromCoord(...this._cursorPosition),(0,l.B)(this,"cursor-moved",{value:this._localValue}))})),this._mc.on("panend",(t=>{this.disabled||(this._pressed=void 0,this._cursorPosition=this._getPositionFromEvent(t),this._localValue=this._getValueFromCoord(...this._cursorPosition),(0,l.B)(this,"cursor-moved",{value:void 0}),(0,l.B)(this,"value-changed",{value:this._localValue}))})),this._mc.on("singletap",(t=>{this.disabled||(this._cursorPosition=this._getPositionFromEvent(t),this._localValue=this._getValueFromCoord(...this._cursorPosition),(0,l.B)(this,"value-changed",{value:this._localValue}))}))}}},{kind:"method",key:"_resetPosition",value:function(){if(void 0===this.value)return this._cursorPosition=void 0,void(this._localValue=void 0);this._cursorPosition=this._getCoordsFromValue(this.value),this._localValue=this.value}},{kind:"field",key:"_getCoordsFromValue",value(){return t=>{const e=g(t[0]),i=Math.min(t[1],1),[o,a]=_(i,e);return[o,a]}}},{kind:"field",key:"_getValueFromCoord",value(){return(t,e)=>{const[i,o]=y(t,e);return[(Math.round(o/(2*Math.PI)*360)%360+360)%360,Math.round(100*Math.min(i,1))/100]}}},{kind:"field",key:"_getPositionFromEvent",value(){return t=>{const e=t.center.x,i=t.center.y,o=t.target.getBoundingClientRect(),a=o.left,s=o.top,r=2*(e-a)/t.target.clientWidth-1,n=2*(i-s)/t.target.clientHeight-1,[l,d]=y(r,n),[c,h]=_(Math.min(1,l),d);return[c,h]}}},{kind:"method",key:"_destroyListeners",value:function(){this._mc&&(this._mc.destroy(),this._mc=void 0)}},{kind:"method",key:"render",value:function(){var t,e;const i=this.renderSize||400,o=i*window.devicePixelRatio,a=void 0!==this._localValue?m((0,n.XG)([this._localValue[0],this._localValue[1],null!==(t=this.colorBrightness)&&void 0!==t?t:255]),this.wv,this.cw,this.ww):[255,255,255],[r,l]=null!==(e=this._cursorPosition)&&void 0!==e?e:[0,0],d=`${(r+1)*i/2}px, ${(l+1)*i/2}px`,c=this._pressed?"touch"===this._pressed?"2.5":"1.5":"1",b="touch"===this._pressed?`0px, -${i/16}px`:"0px, 0px";return(0,s.dy)(v||(v=k` <div class="container ${0}"> <canvas id="canvas" .width="${0}" .height="${0}"></canvas> <svg id="interaction" viewBox="0 0 ${0} ${0}" overflow="visible"> <defs>${0}</defs> <g style="${0}" class="cursor"> <circle cx="0" cy="0" r="16" style="${0}"></circle> </g> </svg> </div> `),(0,h.$)({pressed:Boolean(this._pressed)}),o,o,i,i,this.renderSVGFilter(),(0,u.V)({fill:(0,n.CO)(a),transform:`translate(${d})`}),(0,u.V)({fill:(0,n.CO)(a),transform:`translate(${b}) scale(${c})`,visibility:this._cursorPosition?void 0:"hidden"}))}},{kind:"method",key:"renderSVGFilter",value:function(){return(0,s.YP)(f||(f=k` <filter id="marker-shadow" x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox"> <feDropShadow dx="0" dy="1" stdDeviation="2" flood-opacity="0.3" flood-color="rgba(0, 0, 0, 1)"/> <feDropShadow dx="0" dy="1" stdDeviation="3" flood-opacity="0.15" flood-color="rgba(0, 0, 0, 1)"/> </filter> `))}},{kind:"field",static:!0,key:"styles",value(){return(0,s.iv)(p||(p=k`:host{display:block;outline:0}.container{position:relative;width:100%;height:100%;display:flex}canvas{width:100%;height:100%;object-fit:contain;border-radius:50%;cursor:pointer}svg{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}circle{fill:black;stroke:white;stroke-width:2;filter:url(#marker-shadow)}.container:not(.pressed) circle{transition:transform .1s ease-in-out,fill .1s ease-in-out}.container:not(.pressed) .cursor{transition:transform .2s ease-in-out}`))}}]}}),s.oi);i(65981),i(5828),i(78614);var x=i(90243);let w,$,C,O,j,L=t=>t;(0,o.Z)([(0,r.Mo)("light-color-rgb-picker")],(function(t,e){class i extends e{constructor(...e){super(...e),t(this)}}return{F:i,d:[{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"stateObj",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_cwSliderValue",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_wwSliderValue",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_wvSliderValue",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_colorBrightnessSliderValue",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_brightnessAdjusted",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_hsPickerValue",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_isInteracting",value:void 0},{kind:"method",key:"render",value:function(){var t;if(!this.stateObj)return s.Ld;const e=(0,x.Fe)(this.stateObj,x.ZE.RGBWW),i=!e&&(0,x.Fe)(this.stateObj,x.ZE.RGBW),o=this._hsPickerValue?(0,n.CO)((0,n.XG)([this._hsPickerValue[0],this._hsPickerValue[1],(null!==(t=this._colorBrightnessSliderValue)&&void 0!==t?t:100)/100*255])):"";return(0,s.dy)(w||(w=L` <div class="color-container"> <label class="native-color-picker"> <input type="color" .value="${0}" @input="${0}"> <ha-svg-icon .path="${0}"></ha-svg-icon> </label> <ha-hs-color-picker @value-changed="${0}" @cursor-moved="${0}" .value="${0}" .colorBrightness="${0}" .wv="${0}" .ww="${0}" .cw="${0}" .minKelvin="${0}" .maxKelvin="${0}"> </ha-hs-color-picker> </div> ${0} ${0} ${0} `),null!=o?o:"",this._nativeColorChanged,"M19.35,11.72L17.22,13.85L15.81,12.43L8.1,20.14L3.5,22L2,20.5L3.86,15.9L11.57,8.19L10.15,6.78L12.28,4.65L19.35,11.72M16.76,3C17.93,1.83 19.83,1.83 21,3C22.17,4.17 22.17,6.07 21,7.24L19.08,9.16L14.84,4.92L16.76,3M5.56,17.03L4.5,19.5L6.97,18.44L14.4,11L13,9.6L5.56,17.03Z",this._hsColorChanged,this._hsColorCursorMoved,this._hsPickerValue,null!=this._colorBrightnessSliderValue?255*this._colorBrightnessSliderValue/100:void 0,null!=this._wvSliderValue?255*this._wvSliderValue/100:void 0,null!=this._wwSliderValue?255*this._wwSliderValue/100:void 0,null!=this._cwSliderValue?255*this._cwSliderValue/100:void 0,this.stateObj.attributes.min_color_temp_kelvin,this.stateObj.attributes.max_color_temp_kelvin,i||e?(0,s.dy)($||($=L`<ha-labeled-slider labeled .caption="${0}" icon="hass:brightness-7" min="0" max="100" .value="${0}" @value-changed="${0}"></ha-labeled-slider>`),this.hass.localize("ui.card.light.color_brightness"),this._colorBrightnessSliderValue,this._colorBrightnessSliderChanged):s.Ld,i?(0,s.dy)(C||(C=L` <ha-labeled-slider labeled .caption="${0}" icon="hass:file-word-box" min="0" max="100" .name="${0}" .value="${0}" @value-changed="${0}"></ha-labeled-slider> `),this.hass.localize("ui.card.light.white_value"),"wv",this._wvSliderValue,this._wvSliderChanged):s.Ld,e?(0,s.dy)(O||(O=L` <ha-labeled-slider labeled .caption="${0}" icon="hass:file-word-box-outline" min="0" max="100" .name="${0}" .value="${0}" @value-changed="${0}"></ha-labeled-slider> <ha-labeled-slider labeled .caption="${0}" icon="hass:file-word-box" min="0" max="100" .name="${0}" .value="${0}" @value-changed="${0}"></ha-labeled-slider> `),this.hass.localize("ui.card.light.cold_white_value"),"cw",this._cwSliderValue,this._wvSliderChanged,this.hass.localize("ui.card.light.warm_white_value"),"ww",this._wwSliderValue,this._wvSliderChanged):s.Ld)}},{kind:"method",key:"_updateSliderValues",value:function(){const t=this.stateObj;if("on"===t.state){if(this._brightnessAdjusted=void 0,t.attributes.color_mode===x.ZE.RGB&&t.attributes.rgb_color&&!(0,x.Fe)(t,x.ZE.RGBWW)&&!(0,x.Fe)(t,x.ZE.RGBW)){const e=Math.max(...t.attributes.rgb_color);e<255&&(this._brightnessAdjusted=e)}this._wvSliderValue=t.attributes.color_mode===x.ZE.RGBW&&t.attributes.rgbw_color?Math.round(100*t.attributes.rgbw_color[3]/255):void 0,this._cwSliderValue=t.attributes.color_mode===x.ZE.RGBWW&&t.attributes.rgbww_color?Math.round(100*t.attributes.rgbww_color[3]/255):void 0,this._wwSliderValue=t.attributes.color_mode===x.ZE.RGBWW&&t.attributes.rgbww_color?Math.round(100*t.attributes.rgbww_color[4]/255):void 0;const e=(0,x.cE)(t);this._colorBrightnessSliderValue=e?Math.round(100*Math.max(...e.slice(0,3))/255):void 0,this._hsPickerValue=e?(0,n.xV)(e.slice(0,3)):void 0}else this._hsPickerValue=void 0,this._wvSliderValue=void 0,this._cwSliderValue=void 0,this._wwSliderValue=void 0}},{kind:"method",key:"willUpdate",value:function(t){(0,a.Z)(i,"willUpdate",this,3)([t]),this._isInteracting||!t.has("entityId")&&!t.has("hass")||this._updateSliderValues()}},{kind:"method",key:"_hsColorCursorMoved",value:function(t){const e=t.detail.value;this._isInteracting=void 0!==e,void 0!==e&&(this._hsPickerValue=e,this._throttleUpdateColor())}},{kind:"field",key:"_throttleUpdateColor",value(){return(0,d.P)((()=>this._updateColor()),500)}},{kind:"method",key:"_updateColor",value:function(){const t=[this._hsPickerValue[0],100*this._hsPickerValue[1]],e=(0,n.Mc)(this._hsPickerValue);if((0,x.Fe)(this.stateObj,x.ZE.RGBWW)||(0,x.Fe)(this.stateObj,x.ZE.RGBW))this._setRgbWColor(this._colorBrightnessSliderValue?this._adjustColorBrightness(e,255*this._colorBrightnessSliderValue/100):e);else if((0,x.Fe)(this.stateObj,x.ZE.RGB))if(this._brightnessAdjusted){const t=this._brightnessAdjusted/255*100,i=Math.round((this.stateObj.attributes.brightness||0)*t/255),o=this._adjustColorBrightness(e,this._brightnessAdjusted,!0);this._applyColor({rgb_color:o},{brightness_pct:i})}else this._applyColor({rgb_color:e});else this._applyColor({hs_color:t})}},{kind:"method",key:"_nativeColorChanged",value:function(t){const e=(0,n.wK)(t.currentTarget.value),i=(0,n.DM)(e);this._hsPickerValue=[i[0],i[1]],((0,x.Fe)(this.stateObj,x.ZE.RGBW)||(0,x.Fe)(this.stateObj,x.ZE.RGBWW))&&(this._colorBrightnessSliderValue=i[2]/2.55),this._throttleUpdateColor()}},{kind:"method",key:"_hsColorChanged",value:function(t){t.detail.value&&(this._hsPickerValue=t.detail.value,this._updateColor())}},{kind:"method",key:"_wvSliderChanged",value:function(t){const e=t.detail;let i=Number(e.value);const o=t.target.name;if(isNaN(i))return;"wv"===o?this._wvSliderValue=i:"cw"===o?this._cwSliderValue=i:"ww"===o&&(this._wwSliderValue=i),i=Math.min(255,Math.round(255*i/100));const a=(0,x.cE)(this.stateObj);if("wv"===o){const t=a||[0,0,0,0];return t[3]=i,void this._applyColor({rgbw_color:t})}const s=a||[0,0,0,0,0];for(;s.length<5;)s.push(0);s["cw"===o?3:4]=i,this._applyColor({rgbww_color:s})}},{kind:"method",key:"_applyColor",value:function(t,e){(0,l.B)(this,"color-changed",t),this.hass.callService("light","turn_on",Object.assign(Object.assign({entity_id:this.stateObj.entity_id},t),e))}},{kind:"method",key:"_colorBrightnessSliderChanged",value:function(t){var e;const i=t.detail;let o=Number(i.value);if(isNaN(o))return;const a=this._colorBrightnessSliderValue;this._colorBrightnessSliderValue=o,o=255*o/100;const s=(null===(e=(0,x.cE)(this.stateObj))||void 0===e?void 0:e.slice(0,3))||[255,255,255];this._setRgbWColor(this._adjustColorBrightness(a?this._adjustColorBrightness(s,255*a/100,!0):s,o))}},{kind:"method",key:"_adjustColorBrightness",value:function(t,e,i=!1){if(t.every((t=>0===t))&&(t[0]=255,t[1]=255,t[2]=255),void 0!==e&&255!==e){let o=e/255;i&&(o=1/o),t[0]=Math.min(255,Math.round(t[0]*o)),t[1]=Math.min(255,Math.round(t[1]*o)),t[2]=Math.min(255,Math.round(t[2]*o))}return t}},{kind:"method",key:"_setRgbWColor",value:function(t){if((0,x.Fe)(this.stateObj,x.ZE.RGBWW)){const e=this.stateObj.attributes.rgbww_color?[...this.stateObj.attributes.rgbww_color]:[0,0,0,0,0],i=t.concat(e.slice(3));this._applyColor({rgbww_color:i})}else if((0,x.Fe)(this.stateObj,x.ZE.RGBW)){const e=this.stateObj.attributes.rgbw_color?[...this.stateObj.attributes.rgbw_color]:[0,0,0,0],i=t.concat(e.slice(3));this._applyColor({rgbw_color:i})}}},{kind:"get",static:!0,key:"styles",value:function(){return[(0,s.iv)(j||(j=L`:host{display:flex;flex-direction:column}.native-color-picker{position:absolute;top:0;right:0;inset-inline-end:0;inset-inline-start:initial;z-index:1}.native-color-picker ha-svg-icon{pointer-events:none;position:absolute;top:0;left:0;bottom:0;right:0;margin:auto;padding:0}input[type=color]{appearance:none;-webkit-appearance:none;-moz-appearance:none;border:none;outline:0;display:block;width:var(--mdc-icon-button-size,48px);height:var(--mdc-icon-button-size,48px);padding:calc((var(--mdc-icon-button-size,48px) - var(--mdc-icon-size,24px))/ 2);background-color:transparent;border-radius:calc(var(--mdc-icon-button-size,48px)/ 2);overflow:hidden;cursor:pointer;transition:background-color 180ms ease-in-out}input[type=color]:focus-visible,input[type=color]:hover{background-color:rgb(127,127,127,.15)}input[type=color]::-webkit-color-swatch-wrapper{display:none;background:0 0}input[type=color]::-moz-color-swatch{display:none}input[type=color]::-webkit-color-swatch{border:none}.color-container{position:relative}ha-hs-color-picker{height:45vh;max-height:320px;min-height:200px}ha-labeled-slider{width:100%}hr{border-color:var(--divider-color);border-bottom:none;margin:16px 0}`))]}}]}}),s.oi)},84935:function(t,e,i){i.d(e,{E:()=>s});i(71695),i(19423),i(40251),i(47021);var o=i(36522);const a=()=>Promise.all([i.e("7442"),i.e("67704")]).then(i.bind(i,52623)),s=(t,e)=>new Promise((i=>{const s=e.cancel,r=e.submit;(0,o.B)(t,"show-dialog",{dialogTag:"dialog-light-color-favorite",dialogImport:a,dialogParams:Object.assign(Object.assign({},e),{},{cancel:()=>{i(null),s&&s()},submit:t=>{i(t),r&&r(t)}})})}))},12173:function(t,e,i){i.d(e,{b:()=>a});let o;const a=(0,i(57243).iv)(o||(o=(t=>t)`:host{display:flex;flex-direction:column;flex:1;justify-content:space-between}.controls{display:flex;flex-direction:column;align-items:center}.controls:not(:last-child){margin-bottom:24px}.controls>:not(:last-child){margin-bottom:24px}.buttons{display:flex;align-items:center;justify-content:center;margin-bottom:12px}.buttons>*{margin:8px}ha-attributes{display:block;width:100%}ha-more-info-control-select-container+ha-attributes:not([empty]){margin-top:16px}`))},59031:function(t,e,i){i.a(t,(async function(t,o){try{i.r(e);var a=i(61701),s=(i(71695),i(9359),i(70104),i(47021),i(87319),i(57243)),r=i(50778),n=i(49976),l=i(75278),d=i(13642),c=i(12763),h=(i(34058),i(45747),i(79505),i(7285),i(96194)),u=i(13560),b=i(90243),v=(i(37677),i(4112)),f=(i(44732),i(92947)),p=(i(18481),i(23979)),k=(i(41025),i(89187)),y=i(12173),_=t([d,c,v,f,p,k]);[d,c,v,f,p,k]=_.then?(await _)():_;let g,m,x,w,$,C,O,j,L,V,M,S,B,Z,P,F,H,z=t=>t;const A="M12,18V6A6,6 0 0,1 18,12A6,6 0 0,1 12,18M20,15.31L23.31,12L20,8.69V4H15.31L12,0.69L8.69,4H4V8.69L0.69,12L4,15.31V20H8.69L12,23.31L15.31,20H20V15.31Z",E="M19,1L17.74,3.75L15,5L17.74,6.26L19,9L20.25,6.26L23,5L20.25,3.75M9,4L6.5,9.5L1,12L6.5,14.5L9,20L11.5,14.5L17,12L11.5,9.5M19,15L17.74,17.74L15,19L17.74,20.25L19,23L20.25,20.25L23,19L20.25,17.74",N="M15.5,17H14L12,9.5L10,17H8.5L6.1,7H7.8L9.34,14.5L11.3,7H12.7L14.67,14.5L16.2,7H17.9M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z",W="M12,2C9.76,2 7.78,3.05 6.5,4.68L16.31,14.5C17.94,13.21 19,11.24 19,9A7,7 0 0,0 12,2M3.28,4L2,5.27L5.04,8.3C5,8.53 5,8.76 5,9C5,11.38 6.19,13.47 8,14.74V17A1,1 0 0,0 9,18H14.73L18.73,22L20,20.72L3.28,4M9,20V21A1,1 0 0,0 10,22H14A1,1 0 0,0 15,21V20H9Z",R="M12,6A6,6 0 0,1 18,12C18,14.22 16.79,16.16 15,17.2V19A1,1 0 0,1 14,20H10A1,1 0 0,1 9,19V17.2C7.21,16.16 6,14.22 6,12A6,6 0 0,1 12,6M14,21V22A1,1 0 0,1 13,23H11A1,1 0 0,1 10,22V21H14M20,11H23V13H20V11M1,11H4V13H1V11M13,1V4H11V1H13M4.92,3.5L7.05,5.64L5.63,7.05L3.5,4.93L4.92,3.5M16.95,5.63L19.07,3.5L20.5,4.93L18.37,7.05L16.95,5.63Z",D="M16.56,5.44L15.11,6.89C16.84,7.94 18,9.83 18,12A6,6 0 0,1 12,18A6,6 0 0,1 6,12C6,9.83 7.16,7.94 8.88,6.88L7.44,5.44C5.36,6.88 4,9.28 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12C20,9.28 18.64,6.88 16.56,5.44M13,3H11V13H13";(0,a.Z)([(0,r.Mo)("more-info-light")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"stateObj",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"entry",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"editMode",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_effect",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_mainControl",value(){return"brightness"}},{kind:"method",key:"updated",value:function(t){var e;t.has("stateObj")&&(this._effect=null===(e=this.stateObj)||void 0===e?void 0:e.attributes.effect)}},{kind:"method",key:"_setMainControl",value:function(t){t.stopPropagation(),this._mainControl=t.currentTarget.control}},{kind:"method",key:"_resetMainControl",value:function(t){t.stopPropagation(),this._mainControl="brightness"}},{kind:"get",key:"_stateOverride",value:function(){var t;if(null!==(t=this.stateObj)&&void 0!==t&&t.attributes.brightness)return this.hass.formatEntityAttributeValue(this.stateObj,"brightness")}},{kind:"method",key:"render",value:function(){var t,e;if(!this.hass||!this.stateObj)return s.Ld;const i=(0,b.Fe)(this.stateObj,b.ZE.COLOR_TEMP),o=(0,b.Yk)(this.stateObj),a=(0,b.QM)(this.stateObj),r=(0,b.Fe)(this.stateObj,b.ZE.WHITE),d=(0,l.e)(this.stateObj,b.SQ.EFFECT),c=this.entry&&(null==(null===(t=this.entry.options)||void 0===t||null===(t=t.light)||void 0===t?void 0:t.favorite_colors)||this.entry.options.light.favorite_colors.length>0);return(0,s.dy)(g||(g=z` <ha-more-info-state-header .hass="${0}" .stateObj="${0}" .stateOverride="${0}"></ha-more-info-state-header> <div class="controls"> ${0} ${0} </div> <div> <ha-more-info-control-select-container> ${0} </ha-more-info-control-select-container> <ha-attributes .hass="${0}" .stateObj="${0}" extra-filters="brightness,color_temp,color_temp_kelvin,white_value,effect_list,effect,hs_color,rgb_color,rgbw_color,rgbww_color,xy_color,min_mireds,max_mireds,min_color_temp_kelvin,max_color_temp_kelvin,entity_id,supported_color_modes,color_mode"></ha-attributes> </div> `),this.hass,this.stateObj,this._stateOverride,a?s.Ld:(0,s.dy)(m||(m=z` <ha-state-control-toggle .stateObj="${0}" .hass="${0}" .iconPathOn="${0}" .iconPathOff="${0}"></ha-state-control-toggle> `),this.stateObj,this.hass,R,W),i||o||a?(0,s.dy)(x||(x=z` ${0} ${0} ${0} <ha-icon-button-group> ${0} ${0} ${0} ${0} ${0} </ha-icon-button-group> ${0} `),a&&"brightness"===this._mainControl?(0,s.dy)(w||(w=z` <ha-state-control-light-brightness .stateObj="${0}" .hass="${0}"> </ha-state-control-light-brightness> `),this.stateObj,this.hass):s.Ld,o&&"color"===this._mainControl?(0,s.dy)($||($=z` <light-color-rgb-picker .hass="${0}" .stateObj="${0}"> </light-color-rgb-picker> `),this.hass,this.stateObj):s.Ld,i&&"color_temp"===this._mainControl?(0,s.dy)(C||(C=z` <light-color-temp-picker .hass="${0}" .stateObj="${0}"> </light-color-temp-picker> `),this.hass,this.stateObj):s.Ld,a?(0,s.dy)(O||(O=z` <ha-icon-button .disabled="${0}" .label="${0}" @click="${0}"> <ha-svg-icon .path="${0}"></ha-svg-icon> </ha-icon-button> `),this.stateObj.state===h.nZ,this.hass.localize("ui.dialogs.more_info_control.light.toggle"),this._toggle,D):s.Ld,o||i?(0,s.dy)(j||(j=z` <div class="separator"></div> <ha-icon-button-toggle .selected="${0}" .disabled="${0}" .label="${0}" .control="${0}" @click="${0}"> <ha-svg-icon .path="${0}"></ha-svg-icon> </ha-icon-button-toggle> `),"brightness"===this._mainControl,this.stateObj.state===h.nZ,this.hass.formatEntityAttributeName(this.stateObj,"brightness"),"brightness",this._setMainControl,A):s.Ld,o?(0,s.dy)(L||(L=z` <ha-