iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
48 lines • 18.3 kB
JavaScript
export const __rspack_esm_id=48531;export const __rspack_esm_ids=[48531];export const __webpack_modules__={62371(t,e,a){a.d(e,{E:()=>i,T:()=>o});a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);const o=(t,e,a=true)=>{if(!t||t===document.body)return null;if((t=t.assignedSlot??t).parentElement)t=t.parentElement;else{const e=t.getRootNode();t=e instanceof ShadowRoot?e.host:null}return(a?Object.prototype.hasOwnProperty.call(t,e):t&&e in t)?t:o(t,e,a)},i=(t,e,a=true)=>{const i=new Set;for(;t;)i.add(t),t=o(t,e,a);return i}},50248(t,e,a){a.d(e,{n:()=>o});const o=(t=document)=>t.activeElement?.shadowRoot?.activeElement?o(t.activeElement.shadowRoot):t.activeElement},37981(t,e,a){a.d(e,{xn:()=>r,T:()=>n,Kh:()=>l});a(18111),a(22489),a(61701);var o=a(22786);a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);var i=a(28978);const r=t=>(t.name_by_user||t.name)?.trim(),n=(t,e,a,o)=>r(t)||o&&s(a,o)||e("ui.panel.config.devices.unnamed_device",{type:e(`ui.panel.config.devices.type.${t.entry_type||"device"}`)}),s=(t,e)=>{for(const a of e||[]){const e=t["string"==typeof a?a:a.entity_id];if(e)return(0,i.u)(e)}},l=(0,o.A)(t=>function(t){const e=new Set,a=new Set;for(const o of t)a.has(o)?e.add(o):a.add(o);return e}(Object.values(t).map(t=>r(t)).filter(t=>void 0!==t)))},91926(t,e,a){a.d(e,{OE:()=>d,Te:()=>n,oo:()=>l});var o=a(96126),i=a(1087),r=a(63091);const n=t=>{r.G.history.replaceState({...r.G.history.state,refreshUrl:t},"")},s=async t=>{const{history:e}=r.G;if(!e.state?.dialog||Date.now()-t>=500)return!0;return await(0,o.Jh)()?(await new Promise(t=>{setTimeout(t)}),s(t)):(console.warn("Navigation blocked, because dialog refused to close"),!1)},l=async(t,e)=>{if(!await s(Date.now()))return!1;const a=e?.replace||!1;return a?r.G.history.replaceState(r.G.history.state?.root?{root:!0}:e?.data??null,"",t):r.G.history.pushState(e?.data??null,"",t),(0,i.r)(r.G,"location-changed",{replace:a}),!0},d=async t=>{if(!await s(Date.now()))return;const{history:e}=r.G;if(e.length>1)return void e.back();l(t||"/",{replace:!0})}},12587(t,e,a){a.d(e,{E:()=>i,m:()=>o});const o=t=>{requestAnimationFrame(()=>setTimeout(t,0))},i=()=>new Promise(t=>{o(t)})},8129(t,e,a){a.d(e,{l:()=>o});const o=t=>new Promise(e=>{setTimeout(e,t)})},54276(t,e,a){var o=a(62826),i=a(76482),r=a(91382),n=a(96245),s=a(5124),l=a(22441);class d extends r.n{attach(t){super.attach(t),this.attachableTouchController.attach(t)}disconnectedCallback(){super.disconnectedCallback(),this.hovered=!1,this.pressed=!1}detach(){super.detach(),this.attachableTouchController.detach()}_onTouchControlChange(t,e){t?.removeEventListener("touchend",this._handleTouchEnd),e?.addEventListener("touchend",this._handleTouchEnd)}constructor(...t){super(...t),this.attachableTouchController=new i.i(this,this._onTouchControlChange.bind(this)),this._handleTouchEnd=()=>{this.disabled||super.endPressAnimation()}}}d.styles=[n.R,s.AH`:host{--md-ripple-hover-opacity:var(--ha-ripple-hover-opacity, 0.08);--md-ripple-pressed-opacity:var(--ha-ripple-pressed-opacity, 0.12);--md-ripple-hover-color:var(
--ha-ripple-hover-color,
var(--ha-ripple-color, var(--secondary-text-color))
);--md-ripple-pressed-color:var(
--ha-ripple-pressed-color,
var(--ha-ripple-color, var(--secondary-text-color))
)}`],d=(0,o.Cg)([(0,l.EM)("ha-ripple")],d)},34127(t,e,a){a.a(t,async function(t,e){try{var o=a(62826),i=a(52630),r=a(5124),n=a(22441),s=t([i]);i=(s.then?(await s)():s)[0];class l extends i.A{static get styles(){return[i.A.styles,r.AH`:host{--wa-tooltip-background-color:var(
--ha-tooltip-background-color,
var(--ha-color-surface-default)
);--wa-tooltip-content-color:var(
--ha-tooltip-text-color,
var(--primary-text-color)
);--wa-tooltip-font-family:var(
--ha-tooltip-font-family,
var(--ha-font-family-body)
);--wa-tooltip-font-size:var(
--ha-tooltip-font-size,
var(--ha-font-size-m)
);--wa-tooltip-font-weight:var(
--ha-tooltip-font-weight,
var(--ha-font-weight-medium)
);--wa-tooltip-line-height:var(
--ha-tooltip-line-height,
var(--ha-line-height-condensed)
);--wa-tooltip-padding:var(--ha-tooltip-padding, var(--ha-space-2));--wa-tooltip-border-radius:var(
--ha-tooltip-border-radius,
var(--ha-border-radius-md)
);--wa-tooltip-arrow-size:var(--ha-tooltip-arrow-size, 0px);--wa-tooltip-border-width:0px;--wa-z-index-tooltip:1000}.tooltip::part(popup){animation-duration:var(--ha-tooltip-animation-duration, 0)}.body{box-shadow:var(--ha-tooltip-box-shadow,var(--ha-box-shadow-m))}`]}constructor(...t){super(...t),this.showDelay=350,this.hideDelay=150}}(0,o.Cg)([(0,n.MZ)({attribute:"show-delay",type:Number})],l.prototype,"showDelay",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"hide-delay",type:Number})],l.prototype,"hideDelay",void 0),l=(0,o.Cg)([(0,n.EM)("ha-tooltip")],l),e()}catch(t){e(t)}})},77423(t,e,a){a.d(e,{A:()=>i,Cm:()=>r,Fs:()=>y,JW:()=>u,TC:()=>l,VN:()=>d,Vx:()=>c,XQ:()=>m,eM:()=>g,iH:()=>h,k3:()=>f,m4:()=>n,qf:()=>s,t0:()=>o,yv:()=>p});a(44114),a(18111),a(22489),a(20116),a(7588),a(61701);const o=(t,e)=>t.callWS({type:"config_entries/subentries/list",entry_id:e}),i=(t,e,a,o)=>t.callWS({type:"config_entries/subentries/update",entry_id:e,subentry_id:a,...o}),r=(t,e,a)=>t.callWS({type:"config_entries/subentries/delete",entry_id:e,subentry_id:a}),n=66649!=a.j?["migration_error","setup_error","setup_retry"]:null,s=66649!=a.j?["not_loaded","loaded","setup_error","setup_retry"]:null,l=(t,e,a)=>{const o={type:"config_entries/subscribe"};return a&&a.type&&(o.type_filter=a.type),t.connection.subscribeMessage(t=>{e(t)},o)},d=(t,e)=>{const a={};return e&&(e.type&&(a.type_filter=e.type),e.domain&&(a.domain=e.domain)),t.callWS({type:"config_entries/get",...a})},c=(t,e)=>t.callWS({type:"config_entries/get_single",entry_id:e}),h=(t,e,a)=>t.callWS({type:"config_entries/update",entry_id:e,...a}),g=(t,e)=>t.callApi("DELETE",`config/config_entries/entry/${e}`),p=(t,e)=>t.callApi("POST",`config/config_entries/entry/${e}/reload`),m=(t,e)=>t.callWS({type:"config_entries/disable",entry_id:e,disabled_by:"user"}),f=(t,e)=>t.callWS({type:"config_entries/disable",entry_id:e,disabled_by:null}),u=(t,e)=>{if(!e)return t;const a=t.find(t=>t.entry_id===e);if(!a)return t;return[a,...t.filter(t=>t.entry_id!==e)]};class y{processMessage(t){return t.forEach(t=>{if(null!==t.type&&"added"!==t.type)if("removed"!==t.type){if("updated"===t.type){const e=t.entry;this._entries=this._entries.map(t=>t.entry_id===e.entry_id?e:t)}}else this._entries=this._entries.filter(e=>e.entry_id!==t.entry.entry_id);else this._entries.push(t.entry)}),this._entries}constructor(){this._entries=[]}}},59241(t,e,a){a.d(e,{BM:()=>A,Bz:()=>k,DW:()=>f,Er:()=>m,G3:()=>v,G_:()=>w,Ox:()=>S,P9:()=>z,RP:()=>x,bg:()=>_,fs:()=>h,jh:()=>u,n4:()=>T,oY:()=>c,v:()=>y,z0:()=>g});a(74423),a(18111),a(22489),a(20116);var o=a(35518),i=a(22786),r=a(71727);if(66649!=a.j)var n=a(28978);var s=a(52220),l=a(9899);const d=66649!=a.j?["light","cover","valve"]:null,c=t=>d.includes(t),h=t=>null==t||t.length>0,g=t=>null!=t,p=["sensor","binary_sensor"],m=(t,e)=>{const a=e.filter(e=>t.states[e.entity_id]&&"battery"===t.states[e.entity_id].attributes.device_class&&p.includes((0,r.m)(e.entity_id))).sort((t,e)=>p.indexOf((0,r.m)(t.entity_id))-p.indexOf((0,r.m)(e.entity_id)));if(a.length>0)return a[0]},f=(t,e)=>e.find(e=>t.states[e.entity_id]&&"battery_charging"===t.states[e.entity_id].attributes.device_class),u=(t,e)=>{if(e.name)return e.name;const a=t.states[e.entity_id];return a?(0,n.u)(a):e.original_name?e.original_name:e.entity_id},y=(t,e)=>t.callWS({type:"config/entity_registry/get",entity_id:e}),v=(t,e)=>t.callWS({type:"config/entity_registry/get_entries",entity_ids:e}),w=(t,e,a)=>t.callWS({type:"config/entity_registry/update",entity_id:e,...a}),_=(t,e)=>t.callWS({type:"config/entity_registry/remove",entity_id:e}),b=t=>t.sendMessagePromise({type:"config/entity_registry/list"}),x=t=>t.sendMessagePromise({type:"config/entity_registry/list_for_display"}),E=(t,e)=>t.subscribeEvents((0,l.s)(()=>b(t).then(t=>e.setState(t,!0)),500,!0),"entity_registry_updated"),k=(t,e)=>(0,o.N)("_entityRegistry",b,E,t,e),T=(t,e)=>t.sort((t,a)=>(0,s.SH)(t.name||"",a.name||"",e)),S=(0,i.A)(t=>{const e={};for(const a of t)e[a.entity_id]=a;return e}),z=(0,i.A)(t=>{const e={};for(const a of t)e[a.id]=a;return e}),A=(t,e)=>t.callWS({type:"config/entity_registry/get_automatic_entity_ids",entity_ids:e})},65063(t,e,a){a.d(e,{an:()=>l,dk:()=>s,showAlertDialog:()=>n});var o=a(1087);const i=()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(29962),a.e(32188)]).then(a.bind(a,26683)),r=(t,e,a)=>new Promise(r=>{const n=e.cancel,s=e.confirm;(0,o.r)(t,"show-dialog",{dialogTag:"dialog-box",dialogImport:i,dialogParams:{...e,...a,cancel:()=>{r(!!a?.prompt&&null),n&&n()},confirm:t=>{r(!a?.prompt||t),s&&s(t)}}})}),n=(t,e)=>r(t,e),s=(t,e)=>r(t,e,{confirmation:!0}),l=(t,e)=>r(t,e,{prompt:!0})},96126(t,e,a){a.d(e,{Jh:()=>p,oO:()=>f,t3:()=>g,ui:()=>c,zU:()=>h});a(44114);var o=a(62371);if(66649!=a.j)var i=a(50248);var r=a(63091);if(66649!=a.j)var n=a(12587);const s={},l=[],d=Symbol.for("HA focus target"),c=async(t,e,a,n,h,g=!0,p)=>{if(!(e in s)){if(!n)return!1;s[e]={element:n().then(()=>{const a=document.createElement(e);return"showDialog"in a&&t.provideHass(a),a.addEventListener("dialog-closed",m),a.addEventListener("dialog-closed",u),a})}}if(g){const{history:o}=r.G;if(o.state?.dialog&&!l.length)return await new Promise(t=>{setTimeout(t)}),c(t,e,a,n,h,g,p);const i=l.findIndex(t=>t.dialogTag===e);-1!==i&&l.splice(i,1),l.push({element:t,dialogTag:e,dialogParams:a,dialogImport:n,addHistory:g});const s={dialog:e};o.state?.dialog?o.replaceState(s,""):(o.replaceState({...o.state,opensDialog:!0},""),o.pushState(s,""))}let f;if(s[e].closedFocusTargets=(0,o.E)((0,i.n)(),d),s[e]&&null===s[e].element?(f=document.createElement(e),f.addEventListener("dialog-closed",m),f.addEventListener("dialog-closed",u),s[e].element=Promise.resolve(f)):f=await s[e].element,"dialogNext"in f&&f.dialogNext)f.dialogAnchor=p,f.params=a;else{if(!("showDialog"in f))throw new Error("Unknown dialog type loaded");f.dialogAnchor=p,f.showDialog(a)}const y=(h||t).shadowRoot;return f.parentNode!==y&&y.appendChild(f),!0},h=async(t,e)=>{if(!(t in s))return!0;const a=await s[t].element;return!a||!a.closeDialog||!1!==a.closeDialog(e)},g=async t=>{if(l.length){const e=l.pop(),a=await h(e.dialogTag,t);return a?l.length&&r.G.history.state?.opensDialog&&r.G.history.pushState({dialog:l[l.length-1].dialogTag},""):l.push(e),a}return!0},p=async()=>{for(let t=l.length-1;t>=0;t--){if(!(!l[t]||await h(l[t].dialogTag)))return!1}return!0},m=t=>{const e=l.findIndex(e=>e.dialogTag===t.detail.dialog);if(-1!==e&&l.splice(e,1),r.G.history.state?.dialog===t.detail.dialog&&(l.length?r.G.history.replaceState({dialog:l[l.length-1].dialogTag},""):-1!==e&&r.G.history.back()),t.currentTarget&&"params"in t.currentTarget){const e=t.currentTarget;e.removeEventListener("dialog-closed",m),e.removeEventListener("dialog-closed",u),s[t.detail.dialog].element=null}},f=t=>{t.addEventListener("show-dialog",e=>{const{dialogTag:a,dialogImport:o,dialogParams:i,dialogAnchor:r,addHistory:n,parentElement:s}=e.detail;c(t,a,i,o,s,n,r)})},u=async t=>{if(!s[t.detail.dialog])return;const e=s[t.detail.dialog].closedFocusTargets;if(delete s[t.detail.dialog].closedFocusTargets,!e)return;let a=(0,i.n)();a instanceof HTMLElement&&a.blur(),await(0,n.E)();for(const t of e)if(t instanceof HTMLElement&&(t.focus(),a=(0,i.n)(),a&&a!==document.body))return}},14503(t,e,a){a.d(e,{RF:()=>r,dp:()=>l,kO:()=>s,nA:()=>n,og:()=>i});var o=a(5124);const i=o.AH`button.link{background:0 0;color:inherit;border:none;padding:0;font:inherit;text-align:left;text-decoration:underline;cursor:pointer;outline:0}`,r=o.AH`:host{font-family:var(--ha-font-family-body);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-size:var(--ha-font-size-m);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal)}app-header div[sticky]{height:48px}app-toolbar [main-title]{margin-left:20px;margin-inline-start:20px;margin-inline-end:initial}.header{transition:box-shadow .2s linear,width var(--ha-animation-duration-normal) ease,padding-left var(--ha-animation-duration-normal) ease,padding-right var(--ha-animation-duration-normal) ease}@media (prefers-reduced-motion:reduce){.header{transition:box-shadow .2s linear}}h1{font-family:var(--ha-font-family-heading);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-size:var(--ha-font-size-2xl);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed)}h2{font-family:var(--ha-font-family-body);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-medium);line-height:var(--ha-line-height-normal)}h3{font-family:var(--ha-font-family-body);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-size:var(--ha-font-size-l);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal)}a{color:var(--primary-color)}.secondary{color:var(--secondary-text-color)}.error{color:var(--error-color)}.warning{color:var(--error-color)}${i} .card-actions a{text-decoration:none}.card-actions .warning{--mdc-theme-primary:var(--error-color)}.layout.horizontal,.layout.vertical{display:flex}.layout.inline{display:inline-flex}.layout.horizontal{flex-direction:row}.layout.vertical{flex-direction:column}.layout.wrap{flex-wrap:wrap}.layout.no-wrap{flex-wrap:nowrap}.layout.center,.layout.center-center{align-items:center}.layout.bottom{align-items:flex-end}.layout.center-center,.layout.center-justified{justify-content:center}.flex{flex:1;flex-basis:0.000000001px}.flex-auto{flex:1 1 auto}.flex-none{flex:none}.layout.justified{justify-content:space-between}`,n=o.AH`ha-adaptive-dialog,ha-dialog{--mdc-dialog-min-width:400px;--mdc-dialog-max-width:600px;--mdc-dialog-max-width:min(600px, 95vw);--justify-action-buttons:space-between;--dialog-container-padding:var(--safe-area-inset-top, 0) var(--safe-area-inset-right, 0) var(--safe-area-inset-bottom, 0) var(--safe-area-inset-left, 0);--dialog-surface-padding:0px}ha-adaptive-dialog .form,ha-dialog .form{color:var(--primary-text-color)}a{color:var(--primary-color)}@media all and (max-width:450px),all and (max-height:500px){ha-adaptive-dialog,ha-dialog{--mdc-dialog-min-width:100vw;--mdc-dialog-max-width:100vw;--mdc-dialog-min-height:100vh;--mdc-dialog-min-height:100svh;--mdc-dialog-max-height:100vh;--mdc-dialog-max-height:100svh;--dialog-container-padding:0px;--dialog-surface-padding:var(--safe-area-inset-top, 0) var(--safe-area-inset-right, 0) var(--safe-area-inset-bottom, 0) var(--safe-area-inset-left, 0);--vertical-align-dialog:flex-end}ha-dialog{--ha-dialog-border-radius:var(--ha-border-radius-square)}}.error{color:var(--error-color)}`,s=o.AH`ha-adaptive-dialog,ha-dialog{--vertical-align-dialog:flex-start;--dialog-surface-margin-top:var(--ha-space-10);--mdc-dialog-max-height:calc(
100vh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var(
--safe-area-inset-y,
0px
)
);--mdc-dialog-max-height:calc(
100svh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var(
--safe-area-inset-y,
0px
)
);--ha-dialog-max-height:calc(
100vh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var(
--safe-area-inset-y,
0px
)
);--ha-dialog-max-height:calc(
100svh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var(
--safe-area-inset-y,
0px
)
)}@media all and (max-width:450px),all and (max-height:500px){ha-adaptive-dialog,ha-dialog{--dialog-surface-margin-top:0px;--mdc-dialog-min-height:100vh;--mdc-dialog-min-height:100svh;--mdc-dialog-max-height:100vh;--mdc-dialog-max-height:100svh;--ha-dialog-max-height:100vh;--ha-dialog-max-height:100svh}}`,l=o.AH`.ha-scrollbar::-webkit-scrollbar{width:.4rem;height:.4rem}.ha-scrollbar::-webkit-scrollbar-thumb{border-radius:var(--ha-border-radius-sm);background:var(--scrollbar-thumb-color)}.ha-scrollbar{overflow-y:auto;scrollbar-color:var(--scrollbar-thumb-color) transparent;scrollbar-width:thin}`;o.AH`body{background-color:var(--primary-background-color);color:var(--primary-text-color);height:calc(100vh - 32px);width:100vw}`},44144(t,e,a){a.d(e,{Cv:()=>l,MR:()=>g,QR:()=>p,_c:()=>h,a_:()=>f,bg:()=>u,yM:()=>m});a(18111),a(22489),a(14603),a(47566),a(98721);if(66649!=a.j)var o=a(8129);let i,r;const n=66649!=a.j?18e5:null,s=66649!=a.j?[0,500,1e3,2e3,5e3,1e4,15e3]:null,l=async t=>{const e=i;for(const a of s){a&&await(0,o.l)(a);try{return await d(t),c(t),i!==e}catch{}}return!1},d=async t=>{const e=await t.callWS({type:"brands/access_token"});i=e.token},c=t=>{h(),r=setInterval(()=>{d(t).catch(()=>{})},n)},h=()=>{r&&(clearInterval(r),r=void 0)},g=(t,e)=>{if(!i)return"";e=e??location.origin;const a=`/api/brands/integration/${t.domain}/${t.darkOptimized?"dark_":""}${t.type}.png`,o=new URL(a,e);return o.searchParams.set("token",i),o.toString()},p=(t,e)=>{if(!i)return"";e=e??location.origin;const a=`/api/brands/hardware/${t.category}/${t.darkOptimized?"dark_":""}${t.manufacturer}${t.model?`_${t.model}`:""}.png`,o=new URL(a,e);return o.searchParams.set("token",i),o.toString()},m=(t,e)=>{let a;e=e??location.origin;try{a=new URL(t,e)}catch{return t}return a.pathname.startsWith("/api/brands/")?i?(a.searchParams.set("token",i),a.toString()):"":t},f=t=>{const e=new URL(t,location.origin);if(e.pathname.startsWith("/api/brands/"))return e.pathname.split("/")[4];const a=e.pathname.split("/").filter(t=>t.length>0),o=a.indexOf("_");return-1!==o&&o+1<a.length?a[o+1]:a[1]??""},u=t=>{try{return new URL(t,location.origin).pathname.startsWith("/api/brands/")||t.startsWith("https://brands.home-assistant.io/")}catch{return!1}}},89429(t){t.exports=function(){}}};