iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 28.1 kB
JavaScript
export const __rspack_esm_id=92348;export const __rspack_esm_ids=[92348];export const __webpack_modules__={69558(e,t,a){a.d(t,{_:()=>o});a(18111),a(7588);var i=a(5124),r=a(42017);const o=(0,r.u$)(class extends r.WL{update(e,[t,a]){return this._element&&this._element.localName===t?(a&&Object.entries(a).forEach(([e,t])=>{this._element[e]=t}),i.c0):this.render(t,a)}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(e,t,a){a.d(t,{t:()=>r});var i=a(71727);const r=e=>(0,i.m)(e.entity_id)},82286(e,t,a){a.d(t,{$:()=>i});const i=(e,t)=>r(e.attributes,t),r=(e,t)=>0!==(e.supported_features&t)},80880(e,t,a){a.d(t,{Y:()=>i});const i=(e,t="_")=>{const a="àáâäæãåāăąабçćčđďдèéêëēėęěеёэфğǵгḧхîïíīįìıİийкłлḿмñńǹňнôöòóœøōõőоṕпŕřрßśšşșсťțтûüùúūǘůűųувẃẍÿýыžźżз·",i=`aaaaaaaaaaabcccdddeeeeeeeeeeefggghhiiiiiiiiijkllmmnnnnnoooooooooopprrrsssssstttuuuuuuuuuuvwxyyyzzzz${t}`,r=new RegExp(a.split("").join("|"),"g"),o={ж:"zh",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ю:"iu",я:"ia"};let s;return""===e?s="":(s=e.toString().toLowerCase().replace(r,e=>i.charAt(a.indexOf(e))).replace(/[а-я]/g,e=>o[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}+$`),""),""===s&&(s="unknown")),s}},52763(e,t,a){a.a(e,async function(e,i){try{a.d(t,{U:()=>_});a(74423),a(18111),a(7588),a(61701);var r=a(62826),o=a(5124),s=a(22441),n=a(69558),l=a(1087),d=a(38962),h=(a(11399),e([d]));d=(h.then?(await h)():h)[0];const c={boolean:()=>a.e(81347).then(a.bind(a,46990)),constant:()=>a.e(65733).then(a.bind(a,90820)),float:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(51868),a.e(27585)]).then(a.bind(a,20676)),grid:()=>a.e(60761).then(a.bind(a,70208)),expandable:()=>a.e(45001).then(a.bind(a,40003)),integer:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(21543),a.e(86712),a.e(49985)]).then(a.bind(a,20036)),multi_select:()=>Promise.all([a.e(4801),a.e(39763),a.e(46095),a.e(34995),a.e(80131),a.e(58303),a.e(71739),a.e(24407)]).then(a.bind(a,36182)),positive_time_period_dict:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(34995),a.e(67943),a.e(16508),a.e(85462)]).then(a.bind(a,89422)),select:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(34995),a.e(3283),a.e(81034),a.e(99463),a.e(26092),a.e(4809)]).then(a.bind(a,63804)),string:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(84725),a.e(95926)]).then(a.bind(a,54753)),optional_actions:()=>Promise.all([a.e(4801),a.e(39763),a.e(34995),a.e(85351)]).then(a.bind(a,8456))},u=(e,t)=>e?!t.name||t.flatten?e:e[t.name]:void 0,p=(e,t)=>e&&t.name?e[t.name]:null,m=(e,t)=>e&&t.name?e[t.name]:null;class _ extends o.WF{getFormProperties(){return{}}reportValidity(){const e=this._root;if(!e)return!0;const t=[...e.children].filter(e=>"ha-alert"!==e.localName);let a,i=!0;return this.schema.forEach((e,r)=>{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(e.type??""))&&(!("selector"in e)||!("boolean"in e.selector)&&!("constant"in e.selector))){const t=u(this.data,e);s=null!=t&&""!==t}s||(i=!1,a||(a=o))}),a&&a.focus?.(),i}willUpdate(e){e.has("schema")&&this.schema&&this.schema.forEach(e=>{"selector"in e||c[e.type]?.()})}render(){return o.qy` <div class="root" part="root"> ${this.error&&this.error.base?o.qy` <ha-alert alert-type="error"> ${this._computeError(this.error.base,this.schema)} </ha-alert> `:""} ${this.schema.map(e=>{const t=p(this.error,e),a=m(this.warning,e);return o.qy` ${t?o.qy` <ha-alert own-margin alert-type="error"> ${this._computeError(t,e)} </ha-alert> `:a?o.qy` <ha-alert own-margin alert-type="warning"> ${this._computeWarning(a,e)} </ha-alert> `:""} ${"selector"in e?o.qy`<ha-selector .schema="${e}" .hass="${this.hass}" .narrow="${this.narrow}" .name="${e.name}" .selector="${e.selector}" .value="${u(this.data,e)}" .label="${this._computeLabel(e,this.data)}" .disabled="${e.disabled||this.disabled||!1}" .placeholder="${e.required?void 0:e.default}" .helper="${this._computeHelper(e)}" .localizeValue="${this.localizeValue}" .required="${e.required||!1}" .context="${this._generateContext(e)}"></ha-selector>`:(0,n._)(this.fieldElementName(e.type),{schema:e,data:u(this.data,e),label:this._computeLabel(e,this.data),helper:this._computeHelper(e),disabled:this.disabled||e.disabled||!1,hass:this.hass,localize:this.hass?.localize,computeLabel:this.computeLabel,computeHelper:this.computeHelper,localizeValue:this.localizeValue,context:this._generateContext(e),...this.getFormProperties()})} `})} </div> `}fieldElementName(e){return`ha-form-${e}`}_generateContext(e){if(!e.context&&!this.context)return;const t={...this.context};if(e.context)for(const[a,i]of Object.entries(e.context))t[a]=this.data[i];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 a=!t.name||"flatten"in t&&t.flatten?e.detail.value:{[t.name]:e.detail.value};this.data={...this.data,...a},(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)?o.qy`<ul> ${e.map(e=>o.qy`<li> ${this.computeError?this.computeError(e,t):e} </li>`)} </ul>`: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}}_.shadowRootOptions={mode:"open",delegatesFocus:!0},_.styles=o.AH`.root>*{display:block}.root>:not([own-margin]):not(:last-child){margin-bottom:24px}ha-alert[own-margin]{margin-bottom:4px}`,(0,r.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,r.Cg)([(0,s.MZ)({type:Boolean})],_.prototype,"narrow",void 0),(0,r.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"data",void 0),(0,r.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"schema",void 0),(0,r.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"error",void 0),(0,r.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"warning",void 0),(0,r.Cg)([(0,s.MZ)({type:Boolean})],_.prototype,"disabled",void 0),(0,r.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"computeError",void 0),(0,r.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"computeWarning",void 0),(0,r.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"computeLabel",void 0),(0,r.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"computeHelper",void 0),(0,r.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"localizeValue",void 0),(0,r.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"context",void 0),(0,r.Cg)([(0,s.P)(".root")],_.prototype,"_root",void 0),_=(0,r.Cg)([(0,s.EM)("ha-form")],_),i()}catch(e){i(e)}})},11399(e,t,a){a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);var i=a(62826),r=a(5124),o=a(22441),s=a(22786),n=a(69558),l=a(95311);const d={action:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(34995),a.e(3283),a.e(80131),a.e(72130),a.e(85010),a.e(67218),a.e(58416),a.e(58303),a.e(81034),a.e(16787),a.e(54066),a.e(25950),a.e(14421),a.e(86475),a.e(26092),a.e(8851),a.e(34310),a.e(90790),a.e(12009),a.e(20282),a.e(90577),a.e(16508),a.e(48531),a.e(91123),a.e(31863),a.e(283),a.e(30513),a.e(86618)]).then(a.bind(a,6274)),addon:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(26787),a.e(26092),a.e(45386),a.e(43305)]).then(a.bind(a,36784)),automation_behavior:()=>Promise.all([a.e(4801),a.e(81034),a.e(82416)]).then(a.bind(a,66034)),app:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(26787),a.e(26092),a.e(45386)]).then(a.bind(a,48585)),area:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(83523),a.e(26092),a.e(40404)]).then(a.bind(a,81857)),areas_display:()=>Promise.all([a.e(46095),a.e(64657),a.e(68273),a.e(64280),a.e(32838)]).then(a.bind(a,38235)),attribute:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(49168),a.e(26092),a.e(67471)]).then(a.bind(a,71498)),assist_pipeline:()=>Promise.all([a.e(4801),a.e(39763),a.e(46095),a.e(34995),a.e(43048),a.e(30195)]).then(a.bind(a,83642)),boolean:()=>Promise.all([a.e(93282),a.e(19623)]).then(a.bind(a,30714)),choose:()=>a.e(93934).then(a.bind(a,58141)),color_rgb:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(7106),a.e(31524)]).then(a.bind(a,34931)),condition:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(34995),a.e(3283),a.e(72130),a.e(85010),a.e(67218),a.e(16787),a.e(54066),a.e(25950),a.e(91095),a.e(26092),a.e(8851),a.e(34310),a.e(12009),a.e(20282),a.e(90577),a.e(48531),a.e(91123),a.e(283),a.e(60066)]).then(a.bind(a,81539)),config_entry:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(8706),a.e(26092),a.e(8851),a.e(36830)]).then(a.bind(a,49347)),conversation_agent:()=>Promise.all([a.e(4801),a.e(39763),a.e(46095),a.e(34995),a.e(20667),a.e(66896)]).then(a.bind(a,94215)),constant:()=>a.e(77057).then(a.bind(a,39032)),country:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(84887),a.e(65799),a.e(26092),a.e(40489),a.e(45262)]).then(a.bind(a,94164)),date:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(81484),a.e(93993)]).then(a.bind(a,94351)),datetime:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(34995),a.e(95366),a.e(78229)]).then(a.bind(a,39045)),device:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(16787),a.e(93162),a.e(26092),a.e(90577),a.e(90606)]).then(a.bind(a,2270)),duration:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(34995),a.e(90324),a.e(16508),a.e(21082)]).then(a.bind(a,79488)),entity:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(69923),a.e(26092),a.e(8851),a.e(1535),a.e(34682)]).then(a.bind(a,73863)),entity_name:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(80607),a.e(26092),a.e(85852)]).then(a.bind(a,7563)),statistic:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(7390),a.e(26092),a.e(8851),a.e(54884),a.e(98206)]).then(a.bind(a,28072)),file:()=>Promise.all([a.e(4801),a.e(80764)]).then(a.bind(a,25078)),floor:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(89100),a.e(54192),a.e(26092),a.e(93e3),a.e(55619)]).then(a.bind(a,9040)),label:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(79808),a.e(26092),a.e(66201),a.e(58397)]).then(a.bind(a,99560)),language:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(82025),a.e(26092),a.e(60293)]).then(a.bind(a,15430)),navigation:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(34995),a.e(3283),a.e(83113),a.e(99788),a.e(66716),a.e(54066),a.e(68077),a.e(26092),a.e(8851),a.e(19112),a.e(30002),a.e(59704),a.e(25322),a.e(89747),a.e(59532),a.e(52487),a.e(12009),a.e(20282),a.e(48531),a.e(79767),a.e(74942)]).then(a.bind(a,58350)),number:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(21543),a.e(4162)]).then(a.bind(a,31157)),numeric_threshold:()=>Promise.all([a.e(4801),a.e(39763),a.e(46095),a.e(34995),a.e(88992),a.e(50616)]).then(a.bind(a,18719)),object:()=>Promise.all([a.e(4801),a.e(39763),a.e(46095),a.e(72130),a.e(85010),a.e(42981),a.e(34310),a.e(46660)]).then(a.bind(a,97951)),period:()=>a.e(54234).then(a.bind(a,40929)),qr_code:()=>Promise.all([a.e(4801),a.e(51343),a.e(15251)]).then(a.bind(a,35313)),select:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(34995),a.e(3283),a.e(81034),a.e(26092),a.e(56629)]).then(a.bind(a,856)),selector:()=>a.e(77810).then(a.bind(a,13897)),serial_port:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(68432),a.e(26092),a.e(90587)]).then(a.bind(a,82178)),state:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(38809),a.e(26092),a.e(42684)]).then(a.bind(a,12995)),backup_location:()=>Promise.all([a.e(4801),a.e(39763),a.e(46095),a.e(34995),a.e(80131),a.e(83241),a.e(61757)]).then(a.bind(a,16360)),stt:()=>Promise.all([a.e(4801),a.e(39763),a.e(46095),a.e(34995),a.e(98286),a.e(15424)]).then(a.bind(a,42999)),target:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(35040),a.e(26092),a.e(8851),a.e(33758),a.e(8697),a.e(8955),a.e(17509)]).then(a.bind(a,84909)),template:()=>Promise.all([a.e(4801),a.e(39763),a.e(72130),a.e(33387),a.e(34310),a.e(82770)]).then(a.bind(a,62166)),text:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(37694),a.e(67988)]).then(a.bind(a,47971)),time:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(34995),a.e(92351),a.e(67766)]).then(a.bind(a,42945)),icon:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(86325),a.e(26092),a.e(8851),a.e(79768)]).then(a.bind(a,14885)),media:()=>Promise.all([a.e(4801),a.e(26295),a.e(91845),a.e(32376)]).then(a.bind(a,59422)),theme:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(4406),a.e(26092),a.e(76696)]).then(a.bind(a,77655)),timezone:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(56253),a.e(12727),a.e(26092),a.e(49386)]).then(a.bind(a,6719)),button_toggle:()=>a.e(7774).then(a.bind(a,79949)),trigger:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(34995),a.e(3283),a.e(80131),a.e(72130),a.e(85010),a.e(67218),a.e(58303),a.e(81034),a.e(16787),a.e(54066),a.e(25950),a.e(24906),a.e(26092),a.e(8851),a.e(34310),a.e(12009),a.e(20282),a.e(90577),a.e(48531),a.e(91123),a.e(31863),a.e(60597)]).then(a.bind(a,45078)),tts:()=>Promise.all([a.e(4801),a.e(39763),a.e(46095),a.e(34995),a.e(75905),a.e(85344)]).then(a.bind(a,59447)),tts_voice:()=>Promise.all([a.e(4801),a.e(39763),a.e(46095),a.e(34995),a.e(53524),a.e(98913)]).then(a.bind(a,41188)),location:()=>Promise.all([a.e(4801),a.e(87451),a.e(46146),a.e(8851),a.e(12122),a.e(78146),a.e(8740)]).then(a.bind(a,21160)),color_temp:()=>Promise.all([a.e(4801),a.e(39763),a.e(99788),a.e(21543),a.e(29628),a.e(59704),a.e(20282),a.e(42655)]).then(a.bind(a,90780)),ui_action:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(34995),a.e(3283),a.e(72130),a.e(85010),a.e(83113),a.e(58416),a.e(99788),a.e(66716),a.e(54066),a.e(25950),a.e(96529),a.e(26092),a.e(8851),a.e(19112),a.e(34310),a.e(30002),a.e(59704),a.e(25322),a.e(90790),a.e(89747),a.e(59532),a.e(52487),a.e(36332),a.e(12009),a.e(20282),a.e(48531),a.e(79767),a.e(80014)]).then(a.bind(a,38389)),ui_color:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(46051),a.e(26092),a.e(78043)]).then(a.bind(a,52744)),ui_state_content:()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(8282),a.e(26092),a.e(52481)]).then(a.bind(a,96074))},h=new Set(["ui-action","ui-color"]);class c extends r.WF{reportValidity(){return this._selectorElement&&"reportValidity"in this._selectorElement&&"function"==typeof this._selectorElement.reportValidity?this._selectorElement?.reportValidity()??!0:!this.required||void 0!==this.value&&null!==this.value&&""!==this.value}async focus(){await this.updateComplete,this._selectorElement?.focus()}get _type(){const e=Object.keys(this.selector)[0];return h.has(e)?e.replace("-","_"):e}willUpdate(e){e.has("selector")&&this.selector&&d[this._type]?.()}render(){return r.qy` ${(0,n._)(`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,s.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 h.has(t)?{[t.replace("-","_")]:e[t]}:e})}}(0,i.Cg)([(0,o.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],c.prototype,"narrow",void 0),(0,i.Cg)([(0,o.MZ)()],c.prototype,"name",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],c.prototype,"selector",void 0),(0,i.Cg)([(0,o.MZ)()],c.prototype,"value",void 0),(0,i.Cg)([(0,o.MZ)()],c.prototype,"label",void 0),(0,i.Cg)([(0,o.MZ)()],c.prototype,"helper",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],c.prototype,"localizeValue",void 0),(0,i.Cg)([(0,o.MZ)()],c.prototype,"placeholder",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],c.prototype,"disabled",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],c.prototype,"required",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],c.prototype,"context",void 0),(0,i.Cg)([(0,o.P)("#selector",!0)],c.prototype,"_selectorElement",void 0),c=(0,i.Cg)([(0,o.EM)("ha-selector")],c)},95311(e,t,a){a.d(t,{DF:()=>p,Lo:()=>f,MH:()=>d,MM:()=>m,Qz:()=>u,Ru:()=>b,UU:()=>g,_7:()=>c,bZ:()=>h,m0:()=>l,tD:()=>y,vX:()=>_,wY:()=>v});a(74423),a(44114),a(18111),a(22489),a(30531),a(7588),a(13579),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);var i=a(44537),r=a(69093),o=a(82286),s=a(24367),n=a(58594);const l=(e,t,a,i,r,o,s)=>{const n=[],l=[],d=[];return Object.values(a).forEach(a=>{a.labels.includes(t)&&u(e,r,i,a.area_id,o,s)&&d.push(a.area_id)}),Object.values(i).forEach(a=>{a.labels.includes(t)&&p(e.states,Object.values(r),a,o,s)&&l.push(a.id)}),Object.values(r).forEach(a=>{a.labels.includes(t)&&m(e.states[a.entity_id],o,s)&&n.push(a.entity_id)}),{areas:d,devices:l,entities:n}},d=(e,t,a,i,r)=>{const o=[];return Object.values(a).forEach(a=>{a.floor_id===t&&u(e,e.entities,e.devices,a.area_id,i,r)&&o.push(a.area_id)}),{areas:o}},h=(e,t,a,i,r,o)=>{const s=[],n=[];return Object.values(a).forEach(a=>{a.area_id===t&&p(e.states,Object.values(i),a,r,o)&&n.push(a.id)}),Object.values(i).forEach(a=>{a.area_id===t&&m(e.states[a.entity_id],r,o)&&s.push(a.entity_id)}),{devices:n,entities:s}},c=(e,t,a,i,r)=>{const o=[];return Object.values(a).forEach(a=>{a.device_id===t&&m(e.states[a.entity_id],i,r)&&o.push(a.entity_id)}),{entities:o}},u=(e,t,a,i,r,o)=>!!Object.values(a).some(a=>!(a.area_id!==i||!p(e.states,Object.values(t),a,r,o)))||Object.values(t).some(t=>!(t.area_id!==i||!m(e.states[t.entity_id],r,o))),p=(e,t,a,r,o)=>{const s=o?(0,n.fk)(o,t):void 0;if(r.target?.device&&!(0,i.e)(r.target.device).some(e=>_(e,a,s)))return!1;if(r.target?.entity){return t.filter(e=>e.device_id===a.id).some(t=>{const a=e[t.entity_id];return m(a,r,o)})}return!0},m=(e,t,a)=>!!e&&(!t.target?.entity||(0,i.e)(t.target.entity).some(t=>b(t,e,a))),_=(e,t,a)=>{const{manufacturer:i,model:r,model_id:o,integration:s}=e;return(!i||t.manufacturer===i)&&((!r||t.model===r)&&((!o||t.model_id===o)&&!(s&&a&&!a?.[t.id]?.has(s))))},b=(e,t,a)=>{const{domain:s,device_class:n,supported_features:l,unit_of_measurement:d,integration:h}=e;if(s){const e=(0,r.t)(t);if(Array.isArray(s)?!s.includes(e):e!==s)return!1}if(n){const e=t.attributes.device_class;if(e&&Array.isArray(n)?!n.includes(e):e!==n)return!1}if(l&&!(0,i.e)(l).some(e=>(0,o.$)(t,e)))return!1;if(d){const e=t.attributes.unit_of_measurement;if(!e||(Array.isArray(d)?!d.includes(e):e!==d))return!1}return!h||a?.[t.entity_id]?.domain===h},g=e=>{if(!e.entity)return{entity:null};if("filter"in e.entity)return e;const{domain:t,integration:a,device_class:i,...r}=e.entity;return t||a||i?{entity:{...r,filter:{domain:t,integration:a,device_class:i}}}:{entity:r}},y=e=>{if(!e.device)return{device:null};if("filter"in e.device)return e;const{integration:t,manufacturer:a,model:i,...r}=e.device;return t||a||i?{device:{...r,filter:{integration:t,manufacturer:a,model:i}}}:{device:r}},f=e=>{let t;if("target"in e)t=(0,i.e)(e.target?.entity);else if("entity"in e){if(e.entity?.include_entities)return;t=(0,i.e)(e.entity?.filter)}if(!t)return;const a=t.flatMap(e=>e.integration||e.device_class||e.supported_features||!e.domain?[]:(0,i.e)(e.domain).filter(e=>(0,s.z)(e)));return[...new Set(a)]},v=(e,t,a,r,o,s={target:{}})=>{if(!t)return[];const n=new Set((0,i.e)(t.entity_id)),u=new Set((0,i.e)(t.device_id)),p=new Set((0,i.e)(t.area_id)),m=new Set((0,i.e)(t.floor_id));return new Set((0,i.e)(t.label_id)).forEach(t=>{const i=l(e,t,o,r,a,s);i.devices.forEach(e=>u.add(e)),i.entities.forEach(e=>n.add(e)),i.areas.forEach(e=>p.add(e))}),m.forEach(t=>{d(e,t,o,s).areas.forEach(e=>p.add(e))}),p.forEach(t=>{const i=h(e,t,r,a,s);i.devices.forEach(e=>u.add(e)),i.entities.forEach(e=>n.add(e))}),u.forEach(t=>{c(e,t,a,s).entities.forEach(e=>n.add(e))}),Array.from(n)}},24367(e,t,a){a.d(t,{L:()=>r,z:()=>o});var i=a(23832);const r=["input_boolean","input_button","input_text","input_number","input_datetime","input_select","counter","timer","schedule"],o=(0,i.g)(r)},3863(e,t,a){a.a(e,async function(e,i){try{a.r(t),a.d(t,{DialogLovelaceDashboardDetail:()=>b});a(74423);var r=a(62826),o=a(5124),s=a(22441),n=a(22786),l=a(1087),d=a(80880),h=a(18350),c=(a(93444),a(52763)),u=a(72554),p=a(14503),m=a(41550),_=e([h,c,u]);[h,c,u]=_.then?(await _)():_;class b extends o.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{const e=this._params.suggestions;this._data={show_in_sidebar:!0,icon:e?.icon,title:e?.title??"",require_admin:!1,mode:"storage"},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(){if(!this._params||!this._data)return o.s6;const e=!this._data.title||!this._data.title.trim(),t=o.qy` <ha-button appearance="plain" slot="secondaryAction" ="${this.closeDialog}"> ${this.hass.localize("ui.common.cancel")} </ha-button> `;return o.qy` <ha-dialog .open="${this._open}" header-title="${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")}" prevent-scrim-close ="${this._dialogClosed}"> <div> ${"yaml"===this._params.dashboard?.mode?this.hass.localize("ui.panel.config.lovelace.dashboards.cant_edit_yaml"):o.qy` <ha-form autofocus .schema="${this._schema(this._params,this._data?.require_admin)}" .data="${this._data}" .hass="${this.hass}" .error="${this._error}" .computeLabel="${this._computeLabel}" .computeHelper="${this._computeHelper}" -changed="${this._valueChanged}"></ha-form> `} </div> <ha-dialog-footer slot="footer"> ${this._params.urlPath?o.qy` ${"storage"===this._params.dashboard?.mode?o.qy` <ha-button slot="secondaryAction" variant="danger" appearance="plain" ="${this._deleteDashboard}" .disabled="${this._submitting}"> ${this.hass.localize("ui.panel.config.lovelace.dashboards.detail.delete")} </ha-button> `:t} `:t} <ha-button slot="primaryAction" ="${this._updateDashboard}" .disabled="${this._error&&"url_path"in this._error||e||this._submitting}" ?autofocus="${"yaml"===this._params.dashboard?.mode}"> ${this._params.urlPath?"storage"===this._params.dashboard?.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")} </ha-button> </ha-dialog-footer> </ha-dialog> `}_valueChanged(e){this._error=void 0;const t=e.detail.value;t.url_path!==this._data?.url_path&&(this._urlPathChanged=!0,t.url_path&&"lovelace"!==t.url_path&&/^[a-zA-Z0-9_-]+-[a-zA-Z0-9_-]+$/.test(t.url_path)||(this._error={url_path:this.hass.localize("ui.panel.config.lovelace.dashboards.detail.url_error_msg")})),t.title!==this._data?.title?(this._data=t,this._fillUrlPath(t.title)):this._data=t}_fillUrlPath(e){if(this._urlPathChanged||!e)return;const t=(0,d.Y)(e,"-"),a=t.includes("-")?t:`dashboard-${t}`,i=this._params?.takenUrlPaths;this._data={...this._data,url_path:void 0!==i?(0,m.L)(a,i):a}}async _updateDashboard(){if(this._params?.urlPath&&"yaml"===this._params.dashboard?.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(e){let t;if(e?.translation_domain&&e?.translation_key){t=(await this.hass.loadBackendTranslation("exceptions",e.translation_domain))(`component.${e.translation_domain}.exceptions.${e.translation_key}.message`,e.translation_placeholders)}this._error={base:t||e?.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,o.AH``]}constructor(...e){super(...e),this._open=!1,this._urlPathChanged=!1,this._submitting=!1,this._schema=(0,n.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,s.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,r.Cg)([(0,s.wk)()],b.prototype,"_params",void 0),(0,r.Cg)([(0,s.wk)()],b.prototype,"_open",void 0),(0,r.Cg)([(0,s.wk)()],b.prototype,"_urlPathChanged",void 0),(0,r.Cg)([(0,s.wk)()],b.prototype,"_data",void 0),(0,r.Cg)([(0,s.wk)()],b.prototype,"_error",void 0),(0,r.Cg)([(0,s.wk)()],b.prototype,"_submitting",void 0),b=(0,r.Cg)([(0,s.EM)("dialog-lovelace-dashboard-detail")],b),i()}catch(e){i(e)}})},41550(e,t,a){function i(e,t){if(!t.has(e))return e;let a=2;for(;t.has(`${e}-${a}`);)a+=1;return`${e}-${a}`}a.d(t,{L:()=>i})},48646(e,t,a){var i=a(69565),r=a(28551),o=a(1767),s=a(50851);e.exports=function(e,t){t&&"string"==typeof e||r(e);var a=s(e);return o(r(void 0!==a?i(a,e):e))}},30531(e,t,a){var i=a(46518),r=a(69565),o=a(79306),s=a(28551),n=a(1767),l=a(48646),d=a(19462),h=a(9539),c=a(96395),u=a(30684),p=a(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(e){return!0}}(),g=d(function(){for(var e,t,a=this.iterator,i=this.mapper;;){if(t=this.inner)try{if(!(e=s(r(t.next,t.iterator))).done)return e.value;this.inner=null}catch(e){h(a,"throw",e)}if(e=s(r(this.next,a)),this.done=!!e.done)return;try{this.inner=l(i(e.value,this.counter++),!1)}catch(e){h(a,"throw",e)}}});i({target:"Iterator",proto:!0,real:!0,forced:b},{flatMap:function(e){s(this);try{o(e)}catch(e){h(this,"throw",e)}return _?r(_,this,e):new g(n(this),{mapper:e,inner:null})}})}};