homeassistant/custom_components/hacs/hacs_frontend_experimental/frontend_es5/7145.tZMTrdTXn8Q.js
2025-01-10 21:08:35 -08:00

2 lines
No EOL
15 KiB
JavaScript

"use strict";(self.webpackChunkhacs_frontend=self.webpackChunkhacs_frontend||[]).push([[7145],{27056:function(e,i,t){var n,r,a=t(99312),s=t(81043),d=t(33368),u=t(71650),o=t(68308),l=t(82390),c=t(69205),v=t(91808),h=t(88962),f=(t(22859),t(97393),t(87438),t(46798),t(9849),t(22890),t(13526),t(40271),t(60163),t(49089),t(46349),t(70320),t(37313),t(10733),t(5095)),k=t(95260),y=t(14516),p=t(18394),b=t(36655),m=t(28858),_=t(1913),g=t(16061),C=(t(16591),t(90532),function(e){return(0,f.dy)(n||(n=(0,h.Z)(['<ha-list-item .twoline="','"> <span>','</span> <span slot="secondary">',"</span> </ha-list-item>"])),!!e.area,e.name,e.area)});(0,v.Z)([(0,k.Mo)("ha-device-picker")],(function(e,i){var t,n,v=function(i){function t(){var i;(0,u.Z)(this,t);for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return i=(0,o.Z)(this,t,[].concat(r)),e((0,l.Z)(i)),i}return(0,c.Z)(t,i),(0,d.Z)(t)}(i);return{F:v,d:[{kind:"field",decorators:[(0,k.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,k.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,k.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,k.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,k.Cb)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,k.Cb)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,k.Cb)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,k.Cb)({type:Array,attribute:"exclude-devices"})],key:"excludeDevices",value:void 0},{kind:"field",decorators:[(0,k.Cb)()],key:"deviceFilter",value:void 0},{kind:"field",decorators:[(0,k.Cb)()],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,k.Cb)({type:Boolean})],key:"disabled",value:function(){return!1}},{kind:"field",decorators:[(0,k.Cb)({type:Boolean})],key:"required",value:function(){return!1}},{kind:"field",decorators:[(0,k.SB)()],key:"_opened",value:void 0},{kind:"field",decorators:[(0,k.IO)("ha-combo-box",!0)],key:"comboBox",value:void 0},{kind:"field",key:"_init",value:function(){return!1}},{kind:"field",key:"_getDevices",value:function(){var e=this;return(0,y.Z)((function(i,t,n,r,a,s,d,u,o){if(!i.length)return[{id:"no_devices",area:"",name:e.hass.localize("ui.components.device-picker.no_devices"),strings:[]}];var l={};(r||a||s||u)&&(l=(0,g.R6)(n));var c=i.filter((function(i){return i.id===e.value||!i.disabled_by}));r&&(c=c.filter((function(e){var i=l[e.id];return!(!i||!i.length)&&l[e.id].some((function(e){return r.includes((0,b.M)(e.entity_id))}))}))),a&&(c=c.filter((function(e){var i=l[e.id];return!i||!i.length||n.every((function(e){return!a.includes((0,b.M)(e.entity_id))}))}))),o&&(c=c.filter((function(e){return!o.includes(e.id)}))),s&&(c=c.filter((function(i){var t=l[i.id];return!(!t||!t.length)&&l[i.id].some((function(i){var t=e.hass.states[i.entity_id];return!!t&&(t.attributes.device_class&&s.includes(t.attributes.device_class))}))}))),u&&(c=c.filter((function(i){var t=l[i.id];return!(!t||!t.length)&&t.some((function(i){var t=e.hass.states[i.entity_id];return!!t&&u(t)}))}))),d&&(c=c.filter((function(i){return i.id===e.value||d(i)})));var v=c.map((function(i){var n=(0,g.jL)(i,e.hass,l[i.id]);return{id:i.id,name:n,area:i.area_id&&t[i.area_id]?t[i.area_id].name:e.hass.localize("ui.components.device-picker.no_area"),strings:[n||""]}}));return v.length?1===v.length?v:v.sort((function(i,t){return(0,m.$)(i.name||"",t.name||"",e.hass.locale.language)})):[{id:"no_devices",area:"",name:e.hass.localize("ui.components.device-picker.no_match"),strings:[]}]}))}},{kind:"method",key:"open",value:(n=(0,s.Z)((0,a.Z)().mark((function e(){var i;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateComplete;case 2:return e.next=4,null===(i=this.comboBox)||void 0===i?void 0:i.open();case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{kind:"method",key:"focus",value:(t=(0,s.Z)((0,a.Z)().mark((function e(){var i;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateComplete;case 2:return e.next=4,null===(i=this.comboBox)||void 0===i?void 0:i.focus();case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{kind:"method",key:"updated",value:function(e){if(!this._init&&this.hass||this._init&&e.has("_opened")&&this._opened){this._init=!0;var i=this._getDevices(Object.values(this.hass.devices),this.hass.areas,Object.values(this.hass.entities),this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.excludeDevices);this.comboBox.items=i,this.comboBox.filteredItems=i}}},{kind:"method",key:"render",value:function(){return(0,f.dy)(r||(r=(0,h.Z)([' <ha-combo-box .hass="','" .label="','" .value="','" .helper="','" .renderer="','" .disabled="','" .required="','" item-id-path="id" item-value-path="id" item-label-path="name" @opened-changed="','" @value-changed="','" @filter-changed="','"></ha-combo-box> '])),this.hass,void 0===this.label&&this.hass?this.hass.localize("ui.components.device-picker.device"):this.label,this._value,this.helper,C,this.disabled,this.required,this._openedChanged,this._deviceChanged,this._filterChanged)}},{kind:"get",key:"_value",value:function(){return this.value||""}},{kind:"method",key:"_filterChanged",value:function(e){var i=e.target,t=e.detail.value.toLowerCase();i.filteredItems=t.length?(0,_.q)(t,i.items||[]):i.items}},{kind:"method",key:"_deviceChanged",value:function(e){e.stopPropagation();var i=e.detail.value;"no_devices"===i&&(i=""),i!==this._value&&this._setValue(i)}},{kind:"method",key:"_openedChanged",value:function(e){this._opened=e.detail.value}},{kind:"method",key:"_setValue",value:function(e){var i=this;this.value=e,setTimeout((function(){(0,p.B)(i,"value-changed",{value:e}),(0,p.B)(i,"change")}),0)}}]}}),f.oi)},72722:function(e,i,t){t.r(i),t.d(i,{HaDeviceSelector:function(){return A}});var n,r,a,s,d,u,o=t(88962),l=t(33368),c=t(71650),v=t(68308),h=t(82390),f=t(69205),k=t(91808),y=t(34541),p=t(47838),b=(t(97393),t(87438),t(46798),t(9849),t(22890),t(13526),t(10733),t(5095)),m=t(95260),_=t(14516),g=t(4771),C=t(18394),D=t(16061),Z=t(92794),x=t(29934),w=(t(27056),t(46097)),F=t(99312),B=t(81043),A=(t(46349),t(70320),t(40271),t(60163),(0,k.Z)([(0,m.Mo)("ha-devices-picker")],(function(e,i){var t,s,d=function(i){function t(){var i;(0,c.Z)(this,t);for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return i=(0,v.Z)(this,t,[].concat(r)),e((0,h.Z)(i)),i}return(0,f.Z)(t,i),(0,l.Z)(t)}(i);return{F:d,d:[{kind:"field",decorators:[(0,m.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,m.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,m.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,m.Cb)({type:Boolean})],key:"disabled",value:function(){return!1}},{kind:"field",decorators:[(0,m.Cb)({type:Boolean})],key:"required",value:function(){return!1}},{kind:"field",decorators:[(0,m.Cb)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,m.Cb)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,m.Cb)({attribute:"picked-device-label"}),(0,m.Cb)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",key:"pickedDeviceLabel",value:void 0},{kind:"field",decorators:[(0,m.Cb)({attribute:"pick-device-label"})],key:"pickDeviceLabel",value:void 0},{kind:"field",decorators:[(0,m.Cb)()],key:"deviceFilter",value:void 0},{kind:"field",decorators:[(0,m.Cb)()],key:"entityFilter",value:void 0},{kind:"method",key:"render",value:function(){var e=this;if(!this.hass)return b.Ld;var i=this._currentDevices;return(0,b.dy)(n||(n=(0,o.Z)([" ",' <div> <ha-device-picker allow-custom-entity .hass="','" .helper="','" .deviceFilter="','" .entityFilter="','" .includeDomains="','" .excludeDomains="','" .excludeDevices="','" .includeDeviceClasses="','" .label="','" .disabled="','" .required="','" @value-changed="','"></ha-device-picker> </div> '])),i.map((function(i){return(0,b.dy)(r||(r=(0,o.Z)([' <div> <ha-device-picker allow-custom-entity .curValue="','" .hass="','" .deviceFilter="','" .entityFilter="','" .includeDomains="','" .excludeDomains="','" .includeDeviceClasses="','" .value="','" .label="','" .disabled="','" @value-changed="','"></ha-device-picker> </div> '])),i,e.hass,e.deviceFilter,e.entityFilter,e.includeDomains,e.excludeDomains,e.includeDeviceClasses,i,e.pickedDeviceLabel,e.disabled,e._deviceChanged)})),this.hass,this.helper,this.deviceFilter,this.entityFilter,this.includeDomains,this.excludeDomains,i,this.includeDeviceClasses,this.pickDeviceLabel,this.disabled,this.required&&!i.length,this._addDevice)}},{kind:"get",key:"_currentDevices",value:function(){return this.value||[]}},{kind:"method",key:"_updateDevices",value:(s=(0,B.Z)((0,F.Z)().mark((function e(i){return(0,F.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(0,C.B)(this,"value-changed",{value:i}),this.value=i;case 2:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{kind:"method",key:"_deviceChanged",value:function(e){e.stopPropagation();var i=e.currentTarget.curValue,t=e.detail.value;t!==i&&(void 0===t?this._updateDevices(this._currentDevices.filter((function(e){return e!==i}))):this._updateDevices(this._currentDevices.map((function(e){return e===i?t:e}))))}},{kind:"method",key:"_addDevice",value:(t=(0,B.Z)((0,F.Z)().mark((function e(i){var t,n;return(0,F.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i.stopPropagation(),t=i.detail.value,i.currentTarget.value="",t){e.next=5;break}return e.abrupt("return");case 5:if(!(n=this._currentDevices).includes(t)){e.next=8;break}return e.abrupt("return");case 8:this._updateDevices([].concat((0,w.Z)(n),[t]));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{kind:"field",static:!0,key:"styles",value:function(){return(0,b.iv)(a||(a=(0,o.Z)(["div{margin-top:8px}"])))}}]}}),b.oi),(0,k.Z)([(0,m.Mo)("ha-selector-device")],(function(e,i){var t=function(i){function t(){var i;(0,c.Z)(this,t);for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return i=(0,v.Z)(this,t,[].concat(r)),e((0,h.Z)(i)),i}return(0,f.Z)(t,i),(0,l.Z)(t)}(i);return{F:t,d:[{kind:"field",decorators:[(0,m.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,m.Cb)({attribute:!1})],key:"selector",value:void 0},{kind:"field",decorators:[(0,m.SB)()],key:"_entitySources",value:void 0},{kind:"field",decorators:[(0,m.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,m.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,m.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,m.Cb)({type:Boolean})],key:"disabled",value:function(){return!1}},{kind:"field",decorators:[(0,m.Cb)({type:Boolean})],key:"required",value:function(){return!0}},{kind:"field",key:"_deviceIntegrationLookup",value:function(){return(0,_.Z)(D.HP)}},{kind:"method",key:"_hasIntegration",value:function(e){var i,t;return(null===(i=e.device)||void 0===i?void 0:i.filter)&&(0,g.r)(e.device.filter).some((function(e){return e.integration}))||(null===(t=e.device)||void 0===t?void 0:t.entity)&&(0,g.r)(e.device.entity).some((function(e){return e.integration}))}},{kind:"method",key:"willUpdate",value:function(e){var i,t;e.has("selector")&&void 0!==this.value&&(null!==(i=this.selector.device)&&void 0!==i&&i.multiple&&!Array.isArray(this.value)?(this.value=[this.value],(0,C.B)(this,"value-changed",{value:this.value})):null!==(t=this.selector.device)&&void 0!==t&&t.multiple||!Array.isArray(this.value)||(this.value=this.value[0],(0,C.B)(this,"value-changed",{value:this.value})))}},{kind:"method",key:"updated",value:function(e){var i=this;(0,y.Z)((0,p.Z)(t.prototype),"updated",this).call(this,e),e.has("selector")&&this._hasIntegration(this.selector)&&!this._entitySources&&(0,Z.m)(this.hass).then((function(e){i._entitySources=e}))}},{kind:"method",key:"render",value:function(){var e,i,t;return this._hasIntegration(this.selector)&&!this._entitySources?b.Ld:null!==(e=this.selector.device)&&void 0!==e&&e.multiple?(0,b.dy)(d||(d=(0,o.Z)([" ",' <ha-devices-picker .hass="','" .value="','" .helper="','" .deviceFilter="','" .entityFilter="','" .disabled="','" .required="','"></ha-devices-picker> '])),this.label?(0,b.dy)(u||(u=(0,o.Z)(["<label>","</label>"])),this.label):"",this.hass,this.value,this.helper,this._filterDevices,null!==(i=this.selector.device)&&void 0!==i&&i.entity?this._filterEntities:void 0,this.disabled,this.required):(0,b.dy)(s||(s=(0,o.Z)([' <ha-device-picker .hass="','" .value="','" .label="','" .helper="','" .deviceFilter="','" .entityFilter="','" .disabled="','" .required="','" allow-custom-entity></ha-device-picker> '])),this.hass,this.value,this.label,this.helper,this._filterDevices,null!==(t=this.selector.device)&&void 0!==t&&t.entity?this._filterEntities:void 0,this.disabled,this.required)}},{kind:"field",key:"_filterDevices",value:function(){var e=this;return function(i){var t;if(null===(t=e.selector.device)||void 0===t||!t.filter)return!0;var n=e._entitySources?e._deviceIntegrationLookup(e._entitySources,Object.values(e.hass.entities)):void 0;return(0,g.r)(e.selector.device.filter).some((function(e){return(0,x.lE)(e,i,n)}))}}},{kind:"field",key:"_filterEntities",value:function(){var e=this;return function(i){return(0,g.r)(e.selector.device.entity).some((function(t){return(0,x.lV)(t,i,e._entitySources)}))}}}]}}),b.oi))},92794:function(e,i,t){t.d(i,{m:function(){return d}});t(65974);var n=t(99312),r=t(81043),a=(t(97393),t(46798),t(47084),function(){var e=(0,r.Z)((0,n.Z)().mark((function e(i,t,r,s,d){var u,o,l,c,v,h,f,k=arguments;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(u=k.length,o=new Array(u>5?u-5:0),l=5;l<u;l++)o[l-5]=k[l];if(v=(c=d)[i],h=function(e){return s&&s(d,e.result)!==e.cacheKey?(c[i]=void 0,a.apply(void 0,[i,t,r,s,d].concat(o))):e.result},!v){e.next=6;break}return e.abrupt("return",v instanceof Promise?v.then(h):h(v));case 6:return f=r.apply(void 0,[d].concat(o)),c[i]=f,f.then((function(e){c[i]={result:e,cacheKey:null==s?void 0:s(d,e)},setTimeout((function(){c[i]=void 0}),t)}),(function(){c[i]=void 0})),e.abrupt("return",f);case 10:case"end":return e.stop()}}),e)})));return function(i,t,n,r,a){return e.apply(this,arguments)}}()),s=function(e){return e.callWS({type:"entity/source"})},d=function(e){return a("_entitySources",3e4,s,(function(e){return Object.keys(e.states).length}),e)}},95818:function(e,i,t){t(68077)({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MIN_SAFE_INTEGER:-9007199254740991})},49089:function(e,i,t){var n=t(68077),r=t(72208),a=t(9160),s=t(22933),d=t(73177);n({target:"Iterator",proto:!0,real:!0},{every:function(e){s(this),a(e);var i=d(this),t=0;return!r(i,(function(i,n){if(!e(i,t++))return n()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}}]);
//# sourceMappingURL=7145.tZMTrdTXn8Q.js.map