UNPKG

iobroker.lovelace

Version:

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

1 lines 31.6 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[92348],{69558:function(e,t,i){i.d(t,{_:function(){return n}});i(16280),i(18111),i(7588),i(62953);var a=i(5124),r=i(54495);const n=(0,r.u$)(class extends r.WL{update(e,[t,i]){return this._element&&this._element.localName===t?(i&&Object.entries(i).forEach(([e,t])=>{this._element[e]=t}),a.c0):this.render(t,i)}render(e,t){return this._element=document.createElement(e),t&&Object.entries(t).forEach(([e,t])=>{this._element[e]=t}),this._element}constructor(e){if(super(e),e.type!==r.OA.CHILD)throw new Error("dynamicElementDirective can only be used in content bindings")}})},69093:function(e,t,i){i.d(t,{t:function(){return r}});var a=i(71727);const r=e=>(0,a.m)(e.entity_id)},82286:function(e,t,i){i.d(t,{$:function(){return a}});const a=(e,t)=>r(e.attributes,t),r=(e,t)=>0!==(e.supported_features&t)},80880:function(e,t,i){i.d(t,{Y:function(){return a}});i(84864),i(57465),i(27495),i(25440);const a=(e,t="_")=>{const i="àáâäæãåāăąабçćčđďдèéêëēėęěеёэфğǵгḧхîïíīįìıİийкłлḿмñńǹňнôöòóœøōõőоṕпŕřрßśšşșсťțтûüùúūǘůűųувẃẍÿýыžźżз·",a=`aaaaaaaaaaabcccdddeeeeeeeeeeefggghhiiiiiiiiijkllmmnnnnnoooooooooopprrrsssssstttuuuuuuuuuuvwxyyyzzzz${t}`,r=new RegExp(i.split("").join("|"),"g"),n={"ж":"zh","х":"kh","ц":"ts","ч":"ch","ш":"sh","щ":"shch","ю":"iu","я":"ia"};let o;return""===e?o="":(o=e.toString().toLowerCase().replace(r,e=>a.charAt(i.indexOf(e))).replace(/[а-я]/g,e=>n[e]||"").replace(/(\d),(?=\d)/g,"$1").replace(/[^a-z0-9]+/g,t).replace(new RegExp(`(${t})\\1+`,"g"),"$1").replace(new RegExp(`^${t}+`),"").replace(new RegExp(`${t}+$`),""),""===o&&(o="unknown")),o}},52763:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{U:function(){return E}});i(74423),i(18111),i(7588),i(61701),i(3362),i(62953);var r=i(40445),n=i(5124),o=i(67576),s=i(69558),l=i(1087),d=i(38962),h=(i(11399),e([d]));d=(h.then?(await h)():h)[0];let c,u,p,m,_,b,v,f,g,y=e=>e;const P={boolean:()=>i.e(81347).then(i.bind(i,46990)),constant:()=>i.e(65733).then(i.bind(i,90820)),float:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(51868),i.e(62574),i.e(16113)]).then(i.bind(i,20676)),grid:()=>i.e(60761).then(i.bind(i,70208)),expandable:()=>i.e(45001).then(i.bind(i,40003)),integer:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(21543),i.e(86712),i.e(62574),i.e(12145)]).then(i.bind(i,20036)),multi_select:()=>Promise.all([i.e(72850),i.e(39763),i.e(46095),i.e(34995),i.e(80131),i.e(58303),i.e(71739),i.e(78219)]).then(i.bind(i,36182)),positive_time_period_dict:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(34995),i.e(67943),i.e(62574),i.e(16508),i.e(21486)]).then(i.bind(i,89422)),select:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(34995),i.e(3283),i.e(81034),i.e(99463),i.e(62574),i.e(26092),i.e(39005),i.e(35873),i.e(63577)]).then(i.bind(i,63804)),string:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(84725),i.e(62574),i.e(6762)]).then(i.bind(i,54753)),optional_actions:()=>Promise.all([i.e(72850),i.e(39763),i.e(34995),i.e(67395)]).then(i.bind(i,8456))},$=(e,t)=>e?!t.name||t.flatten?e:e[t.name]:void 0,w=(e,t)=>e&&t.name?e[t.name]:null,C=(e,t)=>e&&t.name?e[t.name]:null;class E extends n.WF{getFormProperties(){return{}}reportValidity(){const e=this._root;if(!e)return!0;const t=[...e.children].filter(e=>"ha-alert"!==e.localName);let i,a=!0;var r,n;(this.schema.forEach((e,r)=>{var n;const o=t[r];if(!o)return;let s=!0;if("reportValidity"in o&&"function"==typeof o.reportValidity)s=o.reportValidity();else if(e.required&&(!("type"in e)||!["boolean","constant"].includes(null!==(n=e.type)&&void 0!==n?n:""))&&(!("selector"in e)||!("boolean"in e.selector)&&!("constant"in e.selector))){const t=$(this.data,e);s=null!=t&&""!==t}s||(a=!1,i||(i=o))}),i)&&(null===(r=(n=i).focus)||void 0===r||r.call(n));return a}willUpdate(e){e.has("schema")&&this.schema&&this.schema.forEach(e=>{var t;"selector"in e||null===(t=P[e.type])||void 0===t||t.call(P)})}render(){return(0,n.qy)(c||(c=y` <div class="root" part="root"> ${0} ${0} </div> `),this.error&&this.error.base?(0,n.qy)(u||(u=y` <ha-alert alert-type="error"> ${0} </ha-alert> `),this._computeError(this.error.base,this.schema)):"",this.schema.map(e=>{var t;const i=w(this.error,e),a=C(this.warning,e);return(0,n.qy)(p||(p=y` ${0} ${0} `),i?(0,n.qy)(m||(m=y` <ha-alert own-margin alert-type="error"> ${0} </ha-alert> `),this._computeError(i,e)):a?(0,n.qy)(_||(_=y` <ha-alert own-margin alert-type="warning"> ${0} </ha-alert> `),this._computeWarning(a,e)):"","selector"in e?(0,n.qy)(b||(b=y`<ha-selector .schema="${0}" .hass="${0}" .narrow="${0}" .name="${0}" .selector="${0}" .value="${0}" .label="${0}" .disabled="${0}" .placeholder="${0}" .helper="${0}" .localizeValue="${0}" .required="${0}" .context="${0}"></ha-selector>`),e,this.hass,this.narrow,e.name,e.selector,$(this.data,e),this._computeLabel(e,this.data),e.disabled||this.disabled||!1,e.required?void 0:e.default,this._computeHelper(e),this.localizeValue,e.required||!1,this._generateContext(e)):(0,s._)(this.fieldElementName(e.type),Object.assign({schema:e,data:$(this.data,e),label:this._computeLabel(e,this.data),helper:this._computeHelper(e),disabled:this.disabled||e.disabled||!1,hass:this.hass,localize:null===(t=this.hass)||void 0===t?void 0:t.localize,computeLabel:this.computeLabel,computeHelper:this.computeHelper,localizeValue:this.localizeValue,context:this._generateContext(e)},this.getFormProperties())))}))}fieldElementName(e){return`ha-form-${e}`}_generateContext(e){if(!e.context&&!this.context)return;const t=Object.assign({},this.context);if(e.context)for(const[i,a]of Object.entries(e.context))t[i]=this.data[a];return t}createRenderRoot(){const e=super.createRenderRoot();return this.addValueChangedListener(e),e}addValueChangedListener(e){e.addEventListener("value-changed",e=>{e.stopPropagation();const t=e.target.schema;if(e.target===this)return;const i=!t.name||"flatten"in t&&t.flatten?e.detail.value:{[t.name]:e.detail.value};this.data=Object.assign(Object.assign({},this.data),i),(0,l.r)(this,"value-changed",{value:this.data})})}_computeLabel(e,t){return this.computeLabel?this.computeLabel(e,t):e?e.name:""}_computeHelper(e){return this.computeHelper?this.computeHelper(e):""}_computeError(e,t){return Array.isArray(e)?(0,n.qy)(v||(v=y`<ul> ${0} </ul>`),e.map(e=>(0,n.qy)(f||(f=y`<li> ${0} </li>`),this.computeError?this.computeError(e,t):e))):this.computeError?this.computeError(e,t):e}_computeWarning(e,t){return this.computeWarning?this.computeWarning(e,t):e}constructor(...e){super(...e),this.narrow=!1,this.disabled=!1}}E.shadowRootOptions={mode:"open",delegatesFocus:!0},E.styles=(0,n.AH)(g||(g=y`.root>*{display:block}.root>:not([own-margin]):not(:last-child){margin-bottom:24px}ha-alert[own-margin]{margin-bottom:4px}`)),(0,r.Cg)([(0,o.MZ)({attribute:!1})],E.prototype,"hass",void 0),(0,r.Cg)([(0,o.MZ)({type:Boolean})],E.prototype,"narrow",void 0),(0,r.Cg)([(0,o.MZ)({attribute:!1})],E.prototype,"data",void 0),(0,r.Cg)([(0,o.MZ)({attribute:!1})],E.prototype,"schema",void 0),(0,r.Cg)([(0,o.MZ)({attribute:!1})],E.prototype,"error",void 0),(0,r.Cg)([(0,o.MZ)({attribute:!1})],E.prototype,"warning",void 0),(0,r.Cg)([(0,o.MZ)({type:Boolean})],E.prototype,"disabled",void 0),(0,r.Cg)([(0,o.MZ)({attribute:!1})],E.prototype,"computeError",void 0),(0,r.Cg)([(0,o.MZ)({attribute:!1})],E.prototype,"computeWarning",void 0),(0,r.Cg)([(0,o.MZ)({attribute:!1})],E.prototype,"computeLabel",void 0),(0,r.Cg)([(0,o.MZ)({attribute:!1})],E.prototype,"computeHelper",void 0),(0,r.Cg)([(0,o.MZ)({attribute:!1})],E.prototype,"localizeValue",void 0),(0,r.Cg)([(0,o.MZ)({attribute:!1})],E.prototype,"context",void 0),(0,r.Cg)([(0,o.P)(".root")],E.prototype,"_root",void 0),E=(0,r.Cg)([(0,o.EM)("ha-form")],E),a()}catch(c){a(c)}})},11399:function(e,t,i){i(3362),i(27495),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(25440),i(62953);var a=i(40445),r=i(5124),n=i(67576),o=i(22786),s=i(69558),l=i(95311);let d,h=e=>e;const c={action:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(34995),i.e(3283),i.e(80131),i.e(72130),i.e(85010),i.e(67218),i.e(98470),i.e(58303),i.e(81034),i.e(23659),i.e(54066),i.e(25950),i.e(64006),i.e(79185),i.e(62574),i.e(26092),i.e(39005),i.e(8851),i.e(34310),i.e(55392),i.e(12009),i.e(20282),i.e(13628),i.e(16508),i.e(28501),i.e(84207),i.e(31863),i.e(283),i.e(30513),i.e(33547)]).then(i.bind(i,6274)),addon:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(26787),i.e(62574),i.e(26092),i.e(39005),i.e(71625),i.e(43305)]).then(i.bind(i,36784)),automation_behavior:()=>Promise.all([i.e(72850),i.e(81034),i.e(99220)]).then(i.bind(i,66034)),app:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(26787),i.e(62574),i.e(26092),i.e(39005),i.e(71625)]).then(i.bind(i,48585)),area:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(83523),i.e(62574),i.e(26092),i.e(39005),i.e(13905)]).then(i.bind(i,81857)),areas_display:()=>Promise.all([i.e(46095),i.e(64657),i.e(68273),i.e(64280),i.e(47956)]).then(i.bind(i,38235)),attribute:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(49168),i.e(62574),i.e(26092),i.e(39005),i.e(58072)]).then(i.bind(i,71498)),assist_pipeline:()=>Promise.all([i.e(72850),i.e(39763),i.e(46095),i.e(34995),i.e(43048),i.e(63071)]).then(i.bind(i,83642)),boolean:()=>Promise.all([i.e(93282),i.e(19623)]).then(i.bind(i,30714)),choose:()=>i.e(93934).then(i.bind(i,58141)),color_rgb:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(7106),i.e(62574),i.e(21332)]).then(i.bind(i,34931)),condition:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(34995),i.e(3283),i.e(72130),i.e(85010),i.e(67218),i.e(23659),i.e(54066),i.e(25950),i.e(48106),i.e(62574),i.e(26092),i.e(39005),i.e(8851),i.e(34310),i.e(12009),i.e(20282),i.e(13628),i.e(28501),i.e(84207),i.e(283),i.e(77190)]).then(i.bind(i,81539)),config_entry:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(8706),i.e(62574),i.e(26092),i.e(39005),i.e(8851),i.e(81594)]).then(i.bind(i,49347)),conversation_agent:()=>Promise.all([i.e(72850),i.e(39763),i.e(46095),i.e(34995),i.e(20667),i.e(44770)]).then(i.bind(i,94215)),constant:()=>i.e(77057).then(i.bind(i,39032)),country:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(84887),i.e(65799),i.e(62574),i.e(26092),i.e(39005),i.e(64157),i.e(47352)]).then(i.bind(i,94164)),date:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(81178),i.e(62574),i.e(36553)]).then(i.bind(i,94351)),datetime:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(34995),i.e(62574),i.e(12466)]).then(i.bind(i,39045)),device:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(23659),i.e(33246),i.e(62574),i.e(26092),i.e(39005),i.e(83128)]).then(i.bind(i,2270)),duration:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(34995),i.e(90324),i.e(62574),i.e(16508),i.e(24858)]).then(i.bind(i,79488)),entity:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(69923),i.e(62574),i.e(26092),i.e(39005),i.e(8851),i.e(1535),i.e(34435)]).then(i.bind(i,73863)),entity_name:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(80607),i.e(62574),i.e(26092),i.e(39005),i.e(3067)]).then(i.bind(i,7563)),statistic:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(72224),i.e(62574),i.e(26092),i.e(39005),i.e(8851),i.e(54884),i.e(88493)]).then(i.bind(i,28072)),file:()=>Promise.all([i.e(72850),i.e(49224)]).then(i.bind(i,25078)),floor:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(89100),i.e(54192),i.e(62574),i.e(26092),i.e(39005),i.e(33790),i.e(94628)]).then(i.bind(i,9040)),label:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(79808),i.e(62574),i.e(26092),i.e(39005),i.e(66201),i.e(40231)]).then(i.bind(i,99560)),language:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(82025),i.e(62574),i.e(26092),i.e(39005),i.e(59324)]).then(i.bind(i,15430)),navigation:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(34995),i.e(3283),i.e(83113),i.e(99788),i.e(54066),i.e(83502),i.e(62574),i.e(26092),i.e(39005),i.e(8851),i.e(19112),i.e(30002),i.e(59704),i.e(25322),i.e(89747),i.e(71572),i.e(12009),i.e(20282),i.e(28501),i.e(46152),i.e(33173)]).then(i.bind(i,58350)),number:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(21543),i.e(62574),i.e(64809)]).then(i.bind(i,31157)),numeric_threshold:()=>Promise.all([i.e(72850),i.e(39763),i.e(46095),i.e(34995),i.e(88992),i.e(99386)]).then(i.bind(i,18719)),object:()=>Promise.all([i.e(72850),i.e(39763),i.e(46095),i.e(72130),i.e(85010),i.e(42981),i.e(34310),i.e(87352)]).then(i.bind(i,97951)),period:()=>i.e(54234).then(i.bind(i,40929)),qr_code:()=>Promise.all([i.e(72850),i.e(51343),i.e(90791)]).then(i.bind(i,35313)),select:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(34995),i.e(3283),i.e(81034),i.e(62574),i.e(26092),i.e(39005),i.e(35873),i.e(99457)]).then(i.bind(i,856)),selector:()=>i.e(77810).then(i.bind(i,13897)),serial_port:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(68432),i.e(62574),i.e(26092),i.e(39005),i.e(87464)]).then(i.bind(i,82178)),state:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(19269),i.e(62574),i.e(26092),i.e(39005),i.e(48007)]).then(i.bind(i,12995)),backup_location:()=>Promise.all([i.e(72850),i.e(39763),i.e(46095),i.e(34995),i.e(80131),i.e(83241),i.e(72777)]).then(i.bind(i,16360)),stt:()=>Promise.all([i.e(72850),i.e(39763),i.e(46095),i.e(34995),i.e(98286),i.e(87890)]).then(i.bind(i,42999)),target:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(40420),i.e(62574),i.e(26092),i.e(39005),i.e(8851),i.e(13628),i.e(14351),i.e(24891),i.e(45862)]).then(i.bind(i,84909)),template:()=>Promise.all([i.e(72850),i.e(39763),i.e(72130),i.e(33387),i.e(34310),i.e(15732)]).then(i.bind(i,62166)),text:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(37694),i.e(62574),i.e(55844)]).then(i.bind(i,47971)),time:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(34995),i.e(92351),i.e(62574),i.e(17066)]).then(i.bind(i,42945)),icon:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(86325),i.e(62574),i.e(26092),i.e(39005),i.e(8851),i.e(82568)]).then(i.bind(i,14885)),media:()=>Promise.all([i.e(72850),i.e(33887),i.e(91845),i.e(22308)]).then(i.bind(i,59422)),theme:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(4406),i.e(62574),i.e(26092),i.e(39005),i.e(5127)]).then(i.bind(i,77655)),timezone:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(56253),i.e(12727),i.e(62574),i.e(26092),i.e(39005),i.e(78464),i.e(41460)]).then(i.bind(i,6719)),button_toggle:()=>i.e(7774).then(i.bind(i,79949)),trigger:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(34995),i.e(3283),i.e(80131),i.e(72130),i.e(85010),i.e(67218),i.e(58303),i.e(81034),i.e(23659),i.e(54066),i.e(25950),i.e(4379),i.e(62574),i.e(26092),i.e(39005),i.e(8851),i.e(34310),i.e(12009),i.e(20282),i.e(13628),i.e(28501),i.e(84207),i.e(31863),i.e(155)]).then(i.bind(i,45078)),tts:()=>Promise.all([i.e(72850),i.e(39763),i.e(46095),i.e(34995),i.e(75905),i.e(56146)]).then(i.bind(i,59447)),tts_voice:()=>Promise.all([i.e(72850),i.e(39763),i.e(46095),i.e(34995),i.e(53524),i.e(58485)]).then(i.bind(i,41188)),location:()=>Promise.all([i.e(72850),i.e(66139),i.e(70622),i.e(73512),i.e(8851),i.e(12122),i.e(76696),i.e(83462)]).then(i.bind(i,21160)),color_temp:()=>Promise.all([i.e(72850),i.e(39763),i.e(99788),i.e(21543),i.e(29628),i.e(59704),i.e(20282),i.e(68611)]).then(i.bind(i,90780)),ui_action:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(34995),i.e(3283),i.e(72130),i.e(85010),i.e(83113),i.e(98470),i.e(99788),i.e(54066),i.e(25950),i.e(31746),i.e(62574),i.e(26092),i.e(39005),i.e(8851),i.e(19112),i.e(34310),i.e(30002),i.e(59704),i.e(25322),i.e(55392),i.e(89747),i.e(71572),i.e(36332),i.e(12009),i.e(20282),i.e(28501),i.e(46152),i.e(59800)]).then(i.bind(i,38389)),ui_color:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(46051),i.e(62574),i.e(26092),i.e(39005),i.e(80651)]).then(i.bind(i,52744)),ui_state_content:()=>Promise.all([i.e(72850),i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(3283),i.e(67493),i.e(62574),i.e(26092),i.e(39005),i.e(48408)]).then(i.bind(i,96074))},u=new Set(["ui-action","ui-color"]);class p extends r.WF{reportValidity(){var e,t;return this._selectorElement&&"reportValidity"in this._selectorElement&&"function"==typeof this._selectorElement.reportValidity?null===(e=null===(t=this._selectorElement)||void 0===t?void 0:t.reportValidity())||void 0===e||e:!this.required||void 0!==this.value&&null!==this.value&&""!==this.value}async focus(){var e;await this.updateComplete,null===(e=this._selectorElement)||void 0===e||e.focus()}get _type(){const e=Object.keys(this.selector)[0];return u.has(e)?e.replace("-","_"):e}willUpdate(e){var t;e.has("selector")&&this.selector&&(null===(t=c[this._type])||void 0===t||t.call(c))}render(){return(0,r.qy)(d||(d=h` ${0} `),(0,s._)(`ha-selector-${this._type}`,{hass:this.hass,narrow:this.narrow,name:this.name,selector:this._handleLegacySelector(this.selector),value:this.value,label:this.label,placeholder:this.placeholder,disabled:this.disabled,required:this.required,helper:this.helper,context:this.context,localizeValue:this.localizeValue,id:"selector"}))}constructor(...e){super(...e),this.narrow=!1,this.disabled=!1,this.required=!0,this._handleLegacySelector=(0,o.A)(e=>{if("entity"in e)return(0,l.UU)(e);if("device"in e)return(0,l.tD)(e);const t=Object.keys(this.selector)[0];return u.has(t)?{[t.replace("-","_")]:e[t]}:e})}}(0,a.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],p.prototype,"narrow",void 0),(0,a.Cg)([(0,n.MZ)()],p.prototype,"name",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"selector",void 0),(0,a.Cg)([(0,n.MZ)()],p.prototype,"value",void 0),(0,a.Cg)([(0,n.MZ)()],p.prototype,"label",void 0),(0,a.Cg)([(0,n.MZ)()],p.prototype,"helper",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"localizeValue",void 0),(0,a.Cg)([(0,n.MZ)()],p.prototype,"placeholder",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],p.prototype,"disabled",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],p.prototype,"required",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"context",void 0),(0,a.Cg)([(0,n.P)("#selector",!0)],p.prototype,"_selectorElement",void 0),p=(0,a.Cg)([(0,n.EM)("ha-selector")],p)},95311:function(e,t,i){i.d(t,{DF:function(){return b},Lo:function(){return $},MH:function(){return u},MM:function(){return v},Qz:function(){return _},Ru:function(){return g},UU:function(){return y},_7:function(){return m},bZ:function(){return p},m0:function(){return c},tD:function(){return P},vX:function(){return f},wY:function(){return w}});var a=i(86518),r=(i(78350),i(74423),i(44114),i(30237),i(18111),i(22489),i(30531),i(7588),i(13579),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953),i(44537)),n=i(69093),o=i(82286),s=i(24367),l=i(58594);const d=["domain","integration","device_class"],h=["integration","manufacturer","model"],c=(e,t,i,a,r,n,o)=>{const s=[],l=[],d=[];return Object.values(i).forEach(i=>{i.labels.includes(t)&&_(e,r,a,i.area_id,n,o)&&d.push(i.area_id)}),Object.values(a).forEach(i=>{i.labels.includes(t)&&b(e.states,Object.values(r),i,n,o)&&l.push(i.id)}),Object.values(r).forEach(i=>{i.labels.includes(t)&&v(e.states[i.entity_id],n,o)&&s.push(i.entity_id)}),{areas:d,devices:l,entities:s}},u=(e,t,i,a,r)=>{const n=[];return Object.values(i).forEach(i=>{i.floor_id===t&&_(e,e.entities,e.devices,i.area_id,a,r)&&n.push(i.area_id)}),{areas:n}},p=(e,t,i,a,r,n)=>{const o=[],s=[];return Object.values(i).forEach(i=>{i.area_id===t&&b(e.states,Object.values(a),i,r,n)&&s.push(i.id)}),Object.values(a).forEach(i=>{i.area_id===t&&v(e.states[i.entity_id],r,n)&&o.push(i.entity_id)}),{devices:s,entities:o}},m=(e,t,i,a,r)=>{const n=[];return Object.values(i).forEach(i=>{i.device_id===t&&v(e.states[i.entity_id],a,r)&&n.push(i.entity_id)}),{entities:n}},_=(e,t,i,a,r,n)=>!!Object.values(i).some(i=>!(i.area_id!==a||!b(e.states,Object.values(t),i,r,n)))||Object.values(t).some(t=>!(t.area_id!==a||!v(e.states[t.entity_id],r,n))),b=(e,t,i,a,n)=>{var o,s;const d=n?(0,l.fk)(n,t):void 0;if(null!==(o=a.target)&&void 0!==o&&o.device&&!(0,r.e)(a.target.device).some(e=>f(e,i,d)))return!1;if(null!==(s=a.target)&&void 0!==s&&s.entity){return t.filter(e=>e.device_id===i.id).some(t=>{const i=e[t.entity_id];return v(i,a,n)})}return!0},v=(e,t,i)=>{var a;return!!e&&(null===(a=t.target)||void 0===a||!a.entity||(0,r.e)(t.target.entity).some(t=>g(t,e,i)))},f=(e,t,i)=>{const{manufacturer:a,model:r,model_id:n,integration:o}=e;if(a&&t.manufacturer!==a)return!1;if(r&&t.model!==r)return!1;if(n&&t.model_id!==n)return!1;var s;if(o&&i&&(null==i||null===(s=i[t.id])||void 0===s||!s.has(o)))return!1;return!0},g=(e,t,i)=>{var a;const{domain:s,device_class:l,supported_features:d,unit_of_measurement:h,integration:c}=e;if(s){const e=(0,n.t)(t);if(Array.isArray(s)?!s.includes(e):e!==s)return!1}if(l){const e=t.attributes.device_class;if(e&&Array.isArray(l)?!l.includes(e):e!==l)return!1}if(d&&!(0,r.e)(d).some(e=>(0,o.$)(t,e)))return!1;if(h){const e=t.attributes.unit_of_measurement;if(!e||(Array.isArray(h)?!h.includes(e):e!==h))return!1}return!c||(null==i||null===(a=i[t.entity_id])||void 0===a?void 0:a.domain)===c},y=e=>{if(!e.entity)return{entity:null};if("filter"in e.entity)return e;const t=e.entity,{domain:i,integration:r,device_class:n}=t,o=(0,a.A)(t,d);return i||r||n?{entity:Object.assign(Object.assign({},o),{},{filter:{domain:i,integration:r,device_class:n}})}:{entity:o}},P=e=>{if(!e.device)return{device:null};if("filter"in e.device)return e;const t=e.device,{integration:i,manufacturer:r,model:n}=t,o=(0,a.A)(t,h);return i||r||n?{device:Object.assign(Object.assign({},o),{},{filter:{integration:i,manufacturer:r,model:n}})}:{device:o}},$=e=>{let t;var i;if("target"in e)t=(0,r.e)(null===(i=e.target)||void 0===i?void 0:i.entity);else if("entity"in e){var a,n;if(null!==(a=e.entity)&&void 0!==a&&a.include_entities)return;t=(0,r.e)(null===(n=e.entity)||void 0===n?void 0:n.filter)}if(!t)return;const o=t.flatMap(e=>e.integration||e.device_class||e.supported_features||!e.domain?[]:(0,r.e)(e.domain).filter(e=>(0,s.z)(e)));return[...new Set(o)]},w=(e,t,i,a,n,o={target:{}})=>{if(!t)return[];const s=new Set((0,r.e)(t.entity_id)),l=new Set((0,r.e)(t.device_id)),d=new Set((0,r.e)(t.area_id)),h=new Set((0,r.e)(t.floor_id));return new Set((0,r.e)(t.label_id)).forEach(t=>{const r=c(e,t,n,a,i,o);r.devices.forEach(e=>l.add(e)),r.entities.forEach(e=>s.add(e)),r.areas.forEach(e=>d.add(e))}),h.forEach(t=>{u(e,t,n,o).areas.forEach(e=>d.add(e))}),d.forEach(t=>{const r=p(e,t,a,i,o);r.devices.forEach(e=>l.add(e)),r.entities.forEach(e=>s.add(e))}),l.forEach(t=>{m(e,t,i,o).entities.forEach(e=>s.add(e))}),Array.from(s)}},24367:function(e,t,i){i.d(t,{L:function(){return r},z:function(){return n}});var a=i(23832);const r=["input_boolean","input_button","input_text","input_number","input_datetime","input_select","counter","timer","schedule"],n=(0,a.g)(r)},3863:function(e,t,i){i.a(e,async function(e,a){try{i.r(t),i.d(t,{DialogLovelaceDashboardDetail:function(){return w}});i(74423),i(3362),i(27495),i(42762),i(62953);var r=i(40445),n=i(5124),o=i(67576),s=i(22786),l=i(1087),d=i(80880),h=i(18350),c=(i(93444),i(52763)),u=i(72554),p=i(14503),m=i(41550),_=e([h,c,u]);[h,c,u]=_.then?(await _)():_;let b,v,f,g,y,P,$=e=>e;class w extends n.WF{showDialog(e){if(this._params=e,this._error=void 0,this._urlPathChanged=!1,this._open=!0,this._params.dashboard)this._data=this._params.dashboard;else{var t;const e=this._params.suggestions;this._data={show_in_sidebar:!0,icon:null==e?void 0:e.icon,title:null!==(t=null==e?void 0:e.title)&&void 0!==t?t:"",require_admin:!1,mode:"storage"},null!=e&&e.title&&this._fillUrlPath(e.title)}}closeDialog(){this._open=!1}_dialogClosed(){this._params=void 0,this._data=void 0,(0,l.r)(this,"dialog-closed",{dialog:this.localName})}render(){var e,t,i,a,r;if(!this._params||!this._data)return n.s6;const o=!this._data.title||!this._data.title.trim(),s=(0,n.qy)(b||(b=$` <ha-button appearance="plain" slot="secondaryAction" @click="${0}"> ${0} </ha-button> `),this.closeDialog,this.hass.localize("ui.common.cancel"));return(0,n.qy)(v||(v=$` <ha-dialog .open="${0}" header-title="${0}" prevent-scrim-close @closed="${0}"> <div> ${0} </div> <ha-dialog-footer slot="footer"> ${0} <ha-button slot="primaryAction" @click="${0}" .disabled="${0}" ?autofocus="${0}"> ${0} </ha-button> </ha-dialog-footer> </ha-dialog> `),this._open,this._params.urlPath?this._data.title||this.hass.localize("ui.panel.config.lovelace.dashboards.detail.edit_dashboard"):this.hass.localize("ui.panel.config.lovelace.dashboards.detail.new_dashboard"),this._dialogClosed,"yaml"===(null===(e=this._params.dashboard)||void 0===e?void 0:e.mode)?this.hass.localize("ui.panel.config.lovelace.dashboards.cant_edit_yaml"):(0,n.qy)(f||(f=$` <ha-form autofocus .schema="${0}" .data="${0}" .hass="${0}" .error="${0}" .computeLabel="${0}" .computeHelper="${0}" @value-changed="${0}"></ha-form> `),this._schema(this._params,null===(t=this._data)||void 0===t?void 0:t.require_admin),this._data,this.hass,this._error,this._computeLabel,this._computeHelper,this._valueChanged),this._params.urlPath?(0,n.qy)(g||(g=$` ${0} `),"storage"===(null===(i=this._params.dashboard)||void 0===i?void 0:i.mode)?(0,n.qy)(y||(y=$` <ha-button slot="secondaryAction" variant="danger" appearance="plain" @click="${0}" .disabled="${0}"> ${0} </ha-button> `),this._deleteDashboard,this._submitting,this.hass.localize("ui.panel.config.lovelace.dashboards.detail.delete")):s):s,this._updateDashboard,this._error&&"url_path"in this._error||o||this._submitting,"yaml"===(null===(a=this._params.dashboard)||void 0===a?void 0:a.mode),this._params.urlPath?"storage"===(null===(r=this._params.dashboard)||void 0===r?void 0:r.mode)?this.hass.localize("ui.panel.config.lovelace.dashboards.detail.update"):this.hass.localize("ui.common.close"):this.hass.localize("ui.panel.config.lovelace.dashboards.detail.create"))}_valueChanged(e){var t,i;this._error=void 0;const a=e.detail.value;a.url_path!==(null===(t=this._data)||void 0===t?void 0:t.url_path)&&(this._urlPathChanged=!0,a.url_path&&"lovelace"!==a.url_path&&/^[a-zA-Z0-9_-]+-[a-zA-Z0-9_-]+$/.test(a.url_path)||(this._error={url_path:this.hass.localize("ui.panel.config.lovelace.dashboards.detail.url_error_msg")})),a.title!==(null===(i=this._data)||void 0===i?void 0:i.title)?(this._data=a,this._fillUrlPath(a.title)):this._data=a}_fillUrlPath(e){var t;if(this._urlPathChanged||!e)return;const i=(0,d.Y)(e,"-"),a=i.includes("-")?i:`dashboard-${i}`,r=null===(t=this._params)||void 0===t?void 0:t.takenUrlPaths;this._data=Object.assign(Object.assign({},this._data),{},{url_path:void 0!==r?(0,m.L)(a,r):a})}async _updateDashboard(){var e,t;if(null!==(e=this._params)&&void 0!==e&&e.urlPath&&"yaml"===(null===(t=this._params.dashboard)||void 0===t?void 0:t.mode))this.closeDialog();else{this._submitting=!0;try{if(this._params.dashboard){const e={require_admin:this._data.require_admin,show_in_sidebar:this._data.show_in_sidebar,icon:this._data.icon||void 0,title:this._data.title};await this._params.updateDashboard(e)}else this._params.createDashboard&&await this._params.createDashboard(this._data);this.closeDialog()}catch(i){let e;if(null!=i&&i.translation_domain&&null!=i&&i.translation_key){e=(await this.hass.loadBackendTranslation("exceptions",i.translation_domain))(`component.${i.translation_domain}.exceptions.${i.translation_key}.message`,i.translation_placeholders)}this._error={base:e||(null==i?void 0:i.message)||"Unknown error"}}finally{this._submitting=!1}}}async _deleteDashboard(){this._submitting=!0;try{await this._params.removeDashboard()&&this.closeDialog()}finally{this._submitting=!1}}static get styles(){return[p.nA,(0,n.AH)(P||(P=$``))]}constructor(...e){super(...e),this._open=!1,this._urlPathChanged=!1,this._submitting=!1,this._schema=(0,s.A)((e,t)=>[{name:"title",required:!0,selector:{text:{}}},{name:"icon",required:!1,selector:{icon:{}}},...e.dashboard?[]:[{name:"url_path",required:!0,selector:{text:{}}}],{name:"require_admin",required:!0,disabled:e.isDefault&&!t,selector:{boolean:{}}},{name:"show_in_sidebar",required:!0,selector:{boolean:{}}}]),this._computeLabel=e=>this.hass.localize(`ui.panel.config.lovelace.dashboards.detail.${"show_in_sidebar"===e.name?"show_sidebar":"url_path"===e.name?"url":e.name}`),this._computeHelper=e=>"require_admin"===e.name&&e.disabled?this.hass.localize("ui.panel.config.lovelace.dashboards.panel_detail.require_admin_helper"):""}}(0,r.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"hass",void 0),(0,r.Cg)([(0,o.wk)()],w.prototype,"_params",void 0),(0,r.Cg)([(0,o.wk)()],w.prototype,"_open",void 0),(0,r.Cg)([(0,o.wk)()],w.prototype,"_urlPathChanged",void 0),(0,r.Cg)([(0,o.wk)()],w.prototype,"_data",void 0),(0,r.Cg)([(0,o.wk)()],w.prototype,"_error",void 0),(0,r.Cg)([(0,o.wk)()],w.prototype,"_submitting",void 0),w=(0,r.Cg)([(0,o.EM)("dialog-lovelace-dashboard-detail")],w),a()}catch(b){a(b)}})},41550:function(e,t,i){function a(e,t){if(!t.has(e))return e;let i=2;for(;t.has(`${e}-${i}`);)i+=1;return`${e}-${i}`}i.d(t,{L:function(){return a}})},48646:function(e,t,i){var a=i(69565),r=i(28551),n=i(1767),o=i(50851);e.exports=function(e,t){t&&"string"==typeof e||r(e);var i=o(e);return n(r(void 0!==i?a(i,e):e))}},78350:function(e,t,i){var a=i(46518),r=i(70259),n=i(79306),o=i(48981),s=i(26198),l=i(1469);a({target:"Array",proto:!0},{flatMap:function(e){var t,i=o(this),a=s(i);return n(e),t=l(i,0),r(t,i,i,a,0,1,e,arguments.length>1?arguments[1]:void 0),t}})},30237:function(e,t,i){i(6469)("flatMap")},30531:function(e,t,i){var a=i(46518),r=i(69565),n=i(79306),o=i(28551),s=i(1767),l=i(48646),d=i(19462),h=i(9539),c=i(96395),u=i(30684),p=i(84549);var m=!c&&!u("flatMap",function(){}),_=!c&&!m&&p("flatMap",TypeError),b=c||m||_||function(){try{var e=Iterator.prototype.flatMap.call(new Map([[4,5]]).entries(),function(e){return e});e.next(),e.return()}catch(t){return!0}}(),v=d(function(){for(var e,t,i=this.iterator,a=this.mapper;;){if(t=this.inner)try{if(!(e=o(r(t.next,t.iterator))).done)return e.value;this.inner=null}catch(n){h(i,"throw",n)}if(e=o(r(this.next,i)),this.done=!!e.done)return;try{this.inner=l(a(e.value,this.counter++),!1)}catch(n){h(i,"throw",n)}}});a({target:"Iterator",proto:!0,real:!0,forced:b},{flatMap:function(e){o(this);try{n(e)}catch(t){h(this,"throw",t)}return _?r(_,this,e):new v(s(this),{mapper:e,inner:null})}})},54495:function(e,t,i){i.d(t,{OA:function(){return a.OA},WL:function(){return a.WL},u$:function(){return a.u$}});var a=i(42017)}}]);