Files
haos_config/custom_components/hacs/hacs_frontend/frontend_latest/1854.f49891761050f15f.js
2026-01-30 23:31:00 -06:00

5 lines
16 KiB
JavaScript

export const ids=["1854"];export const modules={73386:function(e,t,i){i.d(t,{I:function(){return a},k:function(){return s}});i(92519),i(42179),i(89256),i(24931),i(88463),i(57449),i(19814);const s=new Set(["primary","accent","disabled","red","pink","purple","deep-purple","indigo","blue","light-blue","cyan","teal","green","light-green","lime","yellow","amber","orange","deep-orange","brown","light-grey","grey","dark-grey","blue-grey","black","white"]);function a(e){return s.has(e)?`var(--${e}-color)`:e}},56587:function(e,t,i){i.d(t,{D:function(){return s}});const s=(e,t,i=!1)=>{let s;const a=(...a)=>{const l=i&&!s;clearTimeout(s),s=window.setTimeout((()=>{s=void 0,e(...a)}),t),l&&e(...a)};return a.cancel=()=>{clearTimeout(s)},a}},84573:function(e,t,i){var s=i(44249),a=i(74763),l=i(50778);(0,s.Z)([(0,l.Mo)("ha-chip-set")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[]}}),a.l)},13978:function(e,t,i){var s=i(44249),a=i(72621),l=i(74514),o=i(57243),n=i(50778);(0,s.Z)([(0,n.Mo)("ha-input-chip")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",static:!0,key:"styles",value(){return[...(0,a.Z)(i,"styles",this),o.iv`:host{--md-sys-color-primary:var(--primary-text-color);--md-sys-color-on-surface:var(--primary-text-color);--md-sys-color-on-surface-variant:var(--primary-text-color);--md-sys-color-on-secondary-container:var(--primary-text-color);--md-input-chip-container-shape:16px;--md-input-chip-outline-color:var(--outline-color);--md-input-chip-selected-container-color:rgba(
var(--rgb-primary-text-color),
0.15
);--ha-input-chip-selected-container-opacity:1;--md-input-chip-label-text-font:Roboto,sans-serif}::slotted([slot=icon]){display:flex;--mdc-icon-size:var(--md-input-chip-icon-size, 18px)}.selected::before{opacity:var(--ha-input-chip-selected-container-opacity)}`]}}]}}),l.W)},92687:function(e,t,i){var s=i("44249"),a=(i("39527"),i("99790"),i("41360"),i("57243")),l=i("50778"),o=i("91583"),n=i("27486"),d=i("73386"),r=i("11297"),c=i("32770"),u=i("11960"),h=i("44573");const b=()=>Promise.all([i.e("1552"),i.e("686"),i.e("6898"),i.e("513"),i.e("7420"),i.e("3693")]).then(i.bind(i,57834)),v=(e,t)=>{(0,r.B)(e,"show-dialog",{dialogTag:"dialog-label-detail",dialogImport:b,dialogParams:t})};i("84573"),i("13978"),i("92519"),i("42179"),i("89256"),i("24931"),i("88463"),i("57449"),i("19814"),i("92181"),i("13334"),i("36993");var p=i("35359"),f=i("79575"),k=i("59848"),y=i("99523");i("69484"),i("59897"),i("74064"),i("10508");const m="___ADD_NEW___",_="___NO_LABELS___",g="___ADD_NEW_SUGGESTION___",C=e=>a.dy`<ha-list-item graphic="icon" class="${(0,p.$)({"add-new":e.label_id===m})}"> ${e.icon?a.dy`<ha-icon slot="graphic" .icon="${e.icon}"></ha-icon>`:a.Ld} ${e.name} </ha-list-item>`;(0,s.Z)([(0,l.Mo)("ha-label-picker")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"placeholder",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean,attribute:"no-add"})],key:"noAdd",value:()=>!1},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"exclude-label"})],key:"excludeLabels",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"deviceFilter",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"required",value:()=>!1},{kind:"field",decorators:[(0,l.SB)()],key:"_opened",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_labels",value:void 0},{kind:"field",decorators:[(0,l.IO)("ha-combo-box",!0)],key:"comboBox",value:void 0},{kind:"field",key:"_suggestion",value:void 0},{kind:"field",key:"_init",value:()=>!1},{kind:"method",key:"open",value:async function(){await this.updateComplete,await(this.comboBox?.open())}},{kind:"method",key:"focus",value:async function(){await this.updateComplete,await(this.comboBox?.focus())}},{kind:"method",key:"hassSubscribe",value:function(){return[(0,u.f4)(this.hass.connection,(e=>{this._labels=e}))]}},{kind:"field",key:"_getLabels",value(){return(0,n.Z)(((e,t,i,s,a,l,o,n,d,r,c)=>{let u,h,b={};(a||l||o||n||d)&&(b=(0,y.R6)(s),u=i,h=s.filter((e=>e.labels.length>0)),a&&(u=u.filter((e=>{const t=b[e.id];return!(!t||!t.length)&&b[e.id].some((e=>a.includes((0,f.M)(e.entity_id))))})),h=h.filter((e=>a.includes((0,f.M)(e.entity_id))))),l&&(u=u.filter((e=>{const t=b[e.id];return!t||!t.length||s.every((e=>!l.includes((0,f.M)(e.entity_id))))})),h=h.filter((e=>!l.includes((0,f.M)(e.entity_id))))),o&&(u=u.filter((e=>{const t=b[e.id];return!(!t||!t.length)&&b[e.id].some((e=>{const t=this.hass.states[e.entity_id];return!!t&&(t.attributes.device_class&&o.includes(t.attributes.device_class))}))})),h=h.filter((e=>{const t=this.hass.states[e.entity_id];return t.attributes.device_class&&o.includes(t.attributes.device_class)}))),n&&(u=u.filter((e=>n(e)))),d&&(u=u.filter((e=>{const t=b[e.id];return!(!t||!t.length)&&b[e.id].some((e=>{const t=this.hass.states[e.entity_id];return!!t&&d(t)}))})),h=h.filter((e=>{const t=this.hass.states[e.entity_id];return!!t&&d(t)}))));let v=e;const p=new Set;let k;return u&&(k=u.filter((e=>e.area_id)).map((e=>e.area_id)),u.forEach((e=>{e.labels.forEach((e=>p.add(e)))}))),h&&(k=(k??[]).concat(h.filter((e=>e.area_id)).map((e=>e.area_id))),h.forEach((e=>{e.labels.forEach((e=>p.add(e)))}))),k&&k.forEach((e=>{t[e].labels.forEach((e=>p.add(e)))})),c&&(v=v.filter((e=>!c.includes(e.label_id)))),(u||h)&&(v=v.filter((e=>p.has(e.label_id)))),v.length||(v=[{label_id:_,name:this.hass.localize("ui.components.label-picker.no_match"),icon:null,color:null,description:null,created_at:0,modified_at:0}]),r?v:[...v,{label_id:m,name:this.hass.localize("ui.components.label-picker.add_new"),icon:"mdi:plus",color:null,description:null,created_at:0,modified_at:0}]}))}},{kind:"method",key:"updated",value:function(e){if(!this._init&&this.hass&&this._labels||this._init&&e.has("_opened")&&this._opened){this._init=!0;const e=this._getLabels(this._labels,this.hass.areas,Object.values(this.hass.devices),Object.values(this.hass.entities),this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.noAdd,this.excludeLabels).map((e=>({...e,strings:[e.label_id,e.name]})));this.comboBox.items=e,this.comboBox.filteredItems=e}}},{kind:"method",key:"render",value:function(){return a.dy` <ha-combo-box .hass="${this.hass}" .helper="${this.helper}" item-value-path="label_id" item-id-path="label_id" item-label-path="name" .value="${this._value}" .disabled="${this.disabled}" .required="${this.required}" .label="${void 0===this.label&&this.hass?this.hass.localize("ui.components.label-picker.label"):this.label}" .placeholder="${this.placeholder?this._labels?.find((e=>e.label_id===this.placeholder))?.name:void 0}" .renderer="${C}" @filter-changed="${this._filterChanged}" @opened-changed="${this._openedChanged}" @value-changed="${this._labelChanged}"> </ha-combo-box> `}},{kind:"method",key:"_filterChanged",value:function(e){const t=e.target,i=e.detail.value;if(!i)return void(this.comboBox.filteredItems=this.comboBox.items);const s=(0,k.q)(i,t.items?.filter((e=>![_,m].includes(e.label_id)))||[]);0===s.length?this.noAdd?this.comboBox.filteredItems=[{label_id:_,name:this.hass.localize("ui.components.label-picker.no_match"),icon:null,color:null}]:(this._suggestion=i,this.comboBox.filteredItems=[{label_id:g,name:this.hass.localize("ui.components.label-picker.add_new_sugestion",{name:this._suggestion}),icon:"mdi:plus",color:null}]):this.comboBox.filteredItems=s}},{kind:"get",key:"_value",value:function(){return this.value||""}},{kind:"method",key:"_openedChanged",value:function(e){this._opened=e.detail.value}},{kind:"method",key:"_labelChanged",value:function(e){e.stopPropagation();let t=e.detail.value;if(t===_)return t="",void this.comboBox.setInputValue("");[g,m].includes(t)?(e.target.value=this._value,this.hass.loadFragmentTranslation("config"),v(this,{entry:void 0,suggestedName:t===g?this._suggestion:"",createEntry:async e=>{const t=await(0,u.jo)(this.hass,e),i=[...this._labels,t];return this.comboBox.filteredItems=this._getLabels(i,this.hass.areas,Object.values(this.hass.devices),Object.values(this.hass.entities),this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.noAdd,this.excludeLabels),await this.updateComplete,await this.comboBox.updateComplete,this._setValue(t.label_id),t}}),this._suggestion=void 0,this.comboBox.setInputValue("")):t!==this._value&&this._setValue(t)}},{kind:"method",key:"_setValue",value:function(e){this.value=e,setTimeout((()=>{(0,r.B)(this,"value-changed",{value:e}),(0,r.B)(this,"change")}),0)}}]}}),(0,h.f)(a.oi)),(0,s.Z)([(0,l.Mo)("ha-labels-picker")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"value",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"placeholder",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean,attribute:"no-add"})],key:"noAdd",value:()=>!1},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"exclude-label"})],key:"excludeLabels",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"deviceFilter",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"required",value:()=>!1},{kind:"field",decorators:[(0,l.SB)()],key:"_labels",value:void 0},{kind:"field",decorators:[(0,l.IO)("ha-label-picker",!0)],key:"labelPicker",value:void 0},{kind:"method",key:"open",value:async function(){await this.updateComplete,await(this.labelPicker?.open())}},{kind:"method",key:"focus",value:async function(){await this.updateComplete,await(this.labelPicker?.focus())}},{kind:"method",key:"hassSubscribe",value:function(){return[(0,u.f4)(this.hass.connection,(e=>{const t={};e.forEach((e=>{t[e.label_id]=e})),this._labels=t}))]}},{kind:"field",key:"_sortedLabels",value:()=>(0,n.Z)(((e,t,i)=>e?.map((e=>t?.[e])).sort(((e,t)=>(0,c.$)(e?.name||"",t?.name||"",i)))))},{kind:"method",key:"render",value:function(){const e=this._sortedLabels(this.value,this._labels,this.hass.locale.language);return a.dy` ${e?.length?a.dy`<ha-chip-set> ${(0,o.r)(e,(e=>e?.label_id),(e=>{const t=e?.color?(0,d.I)(e.color):void 0;return a.dy` <ha-input-chip .item="${e}" @remove="${this._removeItem}" @click="${this._openDetail}" .label="${e?.name}" selected="selected" style="${t?`--color: ${t}`:""}"> ${e?.icon?a.dy`<ha-icon slot="icon" .icon="${e.icon}"></ha-icon>`:a.Ld} </ha-input-chip> `}))} </ha-chip-set>`:a.Ld} <ha-label-picker .hass="${this.hass}" .helper="${this.helper}" .disabled="${this.disabled}" .required="${this.required}" .label="${void 0===this.label&&this.hass?this.hass.localize("ui.components.label-picker.add_label"):this.label}" .placeholder="${this.placeholder}" .excludeLabels="${this.value}" @value-changed="${this._labelChanged}"> </ha-label-picker> `}},{kind:"get",key:"_value",value:function(){return this.value||[]}},{kind:"method",key:"_removeItem",value:function(e){const t=e.currentTarget.item;this._setValue(this._value.filter((e=>e!==t.label_id)))}},{kind:"method",key:"_openDetail",value:function(e){const t=e.currentTarget.item;v(this,{entry:t,updateEntry:async e=>await(0,u.$0)(this.hass,t.label_id,e)})}},{kind:"method",key:"_labelChanged",value:function(e){e.stopPropagation();const t=e.detail.value;t&&!this._value.includes(t)&&(this._setValue([...this._value,t]),this.labelPicker.value="")}},{kind:"method",key:"_setValue",value:function(e){this.value=e,setTimeout((()=>{(0,r.B)(this,"value-changed",{value:e}),(0,r.B)(this,"change")}),0)}},{kind:"field",static:!0,key:"styles",value:()=>a.iv`ha-chip-set{margin-bottom:8px}ha-input-chip{--md-input-chip-selected-container-color:var(--color, var(--grey-color));--ha-input-chip-selected-container-opacity:0.5;--md-input-chip-selected-outline-width:1px}`}]}}),(0,h.f)(a.oi))},11960:function(e,t,i){i.d(t,{$0:function(){return c},f4:function(){return d},jo:function(){return r}});var s=i(94787),a=i(32770),l=i(56587);const o=e=>e.sendMessagePromise({type:"config/label_registry/list"}).then((e=>e.sort(((e,t)=>(0,a.$)(e.name,t.name))))),n=(e,t)=>e.subscribeEvents((0,l.D)((()=>o(e).then((e=>t.setState(e,!0)))),500,!0),"label_registry_updated"),d=(e,t)=>(0,s.B)("_labelRegistry",o,n,e,t),r=(e,t)=>e.callWS({type:"config/label_registry/create",...t}),c=(e,t,i)=>e.callWS({type:"config/label_registry/update",label_id:t,...i})},44573:function(e,t,i){i.d(t,{f:function(){return o}});var s=i(44249),a=i(72621),l=i(50778);const o=e=>(0,s.Z)(null,(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",key:"hassSubscribeRequiredHostProps",value:void 0},{kind:"field",key:"__unsubs",value:void 0},{kind:"method",key:"connectedCallback",value:function(){(0,a.Z)(i,"connectedCallback",this,3)([]),this._checkSubscribed()}},{kind:"method",key:"disconnectedCallback",value:function(){if((0,a.Z)(i,"disconnectedCallback",this,3)([]),this.__unsubs){for(;this.__unsubs.length;){const e=this.__unsubs.pop();e instanceof Promise?e.then((e=>e())):e()}this.__unsubs=void 0}}},{kind:"method",key:"updated",value:function(e){if((0,a.Z)(i,"updated",this,3)([e]),e.has("hass"))this._checkSubscribed();else if(this.hassSubscribeRequiredHostProps)for(const t of e.keys())if(this.hassSubscribeRequiredHostProps.includes(t))return void this._checkSubscribed()}},{kind:"method",key:"hassSubscribe",value:function(){return[]}},{kind:"method",key:"_checkSubscribed",value:function(){void 0===this.__unsubs&&this.isConnected&&void 0!==this.hass&&!this.hassSubscribeRequiredHostProps?.some((e=>void 0===this[e]))&&(this.__unsubs=this.hassSubscribe())}}]}}),e)},94787:function(e,t,i){i.d(t,{B:()=>l});i("92745");const s=e=>{let t=[];function i(i,s){e=s?i:Object.assign(Object.assign({},e),i);let a=t;for(let t=0;t<a.length;t++)a[t](e)}return{get state(){return e},action(t){function s(e){i(e,!1)}return function(){let i=[e];for(let e=0;e<arguments.length;e++)i.push(arguments[e]);let a=t.apply(this,i);if(null!=a)return a instanceof Promise?a.then(s):s(a)}},setState:i,clearState(){e=void 0},subscribe:e=>(t.push(e),()=>{!function(e){let i=[];for(let s=0;s<t.length;s++)t[s]===e?e=null:i.push(t[s]);t=i}(e)})}},a=(e,t,i,a,l={unsubGrace:!0})=>{if(e[t])return e[t];let o,n,d=0,r=s();const c=()=>{if(!i)throw new Error("Collection does not support refresh");return i(e).then((e=>r.setState(e,!0)))},u=()=>c().catch((t=>{if(e.connected)throw t})),h=()=>{n=void 0,o&&o.then((e=>{e()})),r.clearState(),e.removeEventListener("ready",c),e.removeEventListener("disconnected",b)},b=()=>{n&&(clearTimeout(n),h())};return e[t]={get state(){return r.state},refresh:c,subscribe(t){d++,1===d&&(()=>{if(void 0!==n)return clearTimeout(n),void(n=void 0);a&&(o=a(e,r)),i&&(e.addEventListener("ready",u),u()),e.addEventListener("disconnected",b)})();const s=r.subscribe(t);return void 0!==r.state&&setTimeout((()=>t(r.state)),0),()=>{s(),d--,d||(l.unsubGrace?n=setTimeout(h,5e3):h())}}},e[t]},l=(e,t,i,s,l)=>a(s,e,t,i).subscribe(l)}};
//# sourceMappingURL=1854.f49891761050f15f.js.map