UNPKG

iobroker.lovelace

Version:

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

4 lines 18.1 kB
export const __rspack_esm_id=79767;export const __rspack_esm_ids=[79767];export const __webpack_modules__={62384(e,t,s){s.d(t,{v:()=>i});s(74423);const i=(e,t,s,i)=>{const[r,a,o]=e.split(".",3);return Number(r)>t||Number(r)===t&&(void 0===i?Number(a)>=s:Number(a)>s)||void 0!==i&&Number(r)===t&&Number(a)===s&&Number(o)>=i}},46190(e,t,s){s.d(t,{FD:()=>c,Is:()=>i,JF:()=>r,gt:()=>a,jj:()=>n,oL:()=>l,yd:()=>o});s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698);const i=["alert","button","climate","cover","configurator","event","input_button","input_select","input_number","input_text","humidifier","lawn_mower","lock","media_player","number","scene","script","select","timer","text","update","vacuum","water_heater"],r=["sensor","binary_sensor","calendar","camera","device_tracker","image","weather"],a=["assist_satellite","conversation","stt","tts"],o=["automation","button","cover","date","datetime","fan","group","humidifier","input_boolean","input_button","input_datetime","input_number","input_select","input_text","light","lock","media_player","number","scene","script","select","switch","text","time","vacuum","valve"],n=["closed","locked","off"],c=new Set(["fan","input_boolean","light","switch","group","automation","humidifier","valve"]),l=new Set(["camera","image","media_player"])},93905(e,t,s){s.d(t,{I:()=>a});s(44114),s(18111),s(7588),s(69112),s(33110);class i{addFromStorage(e){if(!this._storage[e]){const t=this.storage.getItem(e);t&&(this._storage[e]=JSON.parse(t))}}subscribeChanges(e,t){return this._listeners[e]?this._listeners[e].push(t):this._listeners[e]=[t],()=>{this.unsubscribeChanges(e,t)}}unsubscribeChanges(e,t){if(!(e in this._listeners))return;const s=this._listeners[e].indexOf(t);-1!==s&&this._listeners[e].splice(s,1)}hasKey(e){return e in this._storage}getValue(e){return this._storage[e]}setValue(e,t){const s=this._storage[e];this._storage[e]=t;try{void 0===t?this.storage.removeItem(e):this.storage.setItem(e,JSON.stringify(t))}catch(e){}finally{this._listeners[e]&&this._listeners[e].forEach(e=>e(s,t))}}constructor(e=window.localStorage){this._storage={},this._listeners={},this.storage=e,this.storage===window.localStorage&&window.addEventListener("storage",e=>{e.key&&this.hasKey(e.key)&&(this._storage[e.key]=e.newValue?JSON.parse(e.newValue):e.newValue,this._listeners[e.key]&&this._listeners[e.key].forEach(t=>t(e.oldValue?JSON.parse(e.oldValue):e.oldValue,this._storage[e.key])))})}}const r={};function a(e){return(t,s)=>{if("object"==typeof s)throw new Error("This decorator does not support this compilation type.");const a=e.storage||"localStorage";let o;a&&a in r?o=r[a]:(o=new i(window[a]),r[a]=o);const n=e.key||String(s);o.addFromStorage(n);const c=!1!==e.subscribe?e=>o.subscribeChanges(n,(t,i)=>{e.requestUpdate(s,t)}):void 0,l=()=>o.hasKey(n)?e.deserializer?e.deserializer(o.getValue(n)):o.getValue(n):void 0,d=(t,i)=>{let r;e.state&&(r=l()),o.setValue(n,e.serializer?e.serializer(i):i),e.state&&t.requestUpdate(s,r)},u=t.performUpdate;if(t.performUpdate=function(){this.__initialized=!0,u.call(this)},e.subscribe){const e=t.connectedCallback,s=t.disconnectedCallback;t.connectedCallback=function(){e.call(this);const t=this;t.__unbsubLocalStorage||(t.__unbsubLocalStorage=c?.(this))},t.disconnectedCallback=function(){s.call(this);this.__unbsubLocalStorage?.(),this.__unbsubLocalStorage=void 0}}const h=Object.getOwnPropertyDescriptor(t,s);let m;if(void 0===h)m={get:()=>l(),set(e){(this.__initialized||void 0===l())&&d(this,e)},configurable:!0,enumerable:!0};else{const e=h.set;m={...h,get:()=>l(),set(t){(this.__initialized||void 0===l())&&d(this,t),e?.call(this,t)}}}Object.defineProperty(t,s,m)}}},68348(e,t,s){s.d(t,{u:()=>i});s(18111),s(13579);const i=e=>{if(e.some(e=>"tagName"in e&&("HA-MENU"===e.tagName||"HA-CODE-EDITOR"===e.tagName)))return!1;const t=e[0];if("TEXTAREA"===t.tagName||"HA-SELECT"===t.parentElement?.tagName||"HA-DROPDOWN"===t.parentElement?.tagName)return!1;if("INPUT"!==t.tagName)return!0;switch(t.type){case"button":case"checkbox":case"hidden":case"radio":case"range":return!0;default:return!1}}},76830(e,t,s){s.d(t,{d:()=>i});s(18111),s(20116);const i=(e,t=!0)=>{if(e.defaultPrevented||0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey)return;const s=e.composedPath().find(e=>"A"===e.tagName);if(!s||s.target||s.hasAttribute("download")||"external"===s.getAttribute("rel"))return;let i=s.href;if(!i||-1!==i.indexOf("mailto:"))return;const r=window.location,a=r.origin||r.protocol+"//"+r.host;return i.startsWith(a)&&(i=i.slice(a.length),"#"!==i)?(t&&e.preventDefault(),i):void 0}},68246(e,t,s){s.d(t,{Y:()=>i});const i=e=>e.slice(e.indexOf(".")+1)},28978(e,t,s){s.d(t,{_:()=>r,u:()=>a});var i=s(68246);const r=(e,t)=>void 0===t.friendly_name?(0,i.Y)(e).replace(/_/g," "):(t.friendly_name??"").toString(),a=e=>r(e.entity_id,e.attributes)},28455(e,t,s){s.d(t,{EX:()=>r,jI:()=>a,ln:()=>i});const i=(e,t,s,i,r)=>{const o=t[e.entity_id];return o?a(o,t,s,i,r):{entity:null,device:null,area:null,floor:null}},r=(e,t,s)=>{const i=t[e];if(!i)return;const r=i.device_id,a=r?s[r]:void 0;return i.area_id||a?.area_id||void 0},a=(e,t,s,i,r)=>{const a=t[e.entity_id],o=e?.device_id,n=o?s[o]:void 0,c=e?.area_id||n?.area_id,l=c?i[c]:void 0,d=l?.floor_id;return{entity:a,device:n||null,area:l||null,floor:(d?r[d]:void 0)||null}}},79461(e,t,s){s.d(t,{p:()=>r});const i=[" ",": "," - "],r=(e,t)=>{const s=e.toLowerCase(),r=t.toLowerCase();for(const t of i){const i=`${r}${t}`;if(s.startsWith(i)){const t=e.substring(i.length);if(t.length)return a(t.substr(0,t.indexOf(" ")))?t:t[0].toUpperCase()+t.slice(1)}}},a=e=>e.toLowerCase()!==e},1974(e,t,s){s.d(t,{l:()=>i});const i=e=>{const t=e.path.indexOf("/",1);return-1===t?{prefix:e.prefix+e.path,path:""}:{prefix:e.prefix+e.path.substring(0,t),path:e.path.substring(t)}}},7553(e,t,s){s.d(t,{h:()=>r});class i extends Error{constructor(e,...t){super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,i),this.name="TimeoutError",this.timeout=e,this.message=`Timed out in ${e} ms.`}}const r=(e,t)=>{const s=new Promise((t,s)=>{setTimeout(()=>{s(new i(e))},e)});return Promise.race([t,s])}},60353(e,t,s){s.d(t,{u:()=>i});class i{start(e){const t=Date.now();this._startY=e,this._startTime=t,this._lastY=e,this._lastTime=t,this._delta=0}move(e){const t=Date.now();return this._delta=this._startY-e,this._lastY=e,this._lastTime=t,this._delta}end(){const e=this.getVelocity(),t=Math.abs(e)>this._velocityThreshold;return{velocity:e,delta:this._delta,isSwipe:t,isDownwardSwipe:e>0}}getDelta(){return this._delta}getVelocity(){if(Date.now()-this._lastTime>=this._movementTimeThreshold)return 0;const e=this._lastTime-this._startTime;return e>0?(this._lastY-this._startY)/e:0}reset(){this._startY=0,this._delta=0,this._startTime=0,this._lastY=0,this._lastTime=0}constructor(e={}){this._startY=0,this._delta=0,this._startTime=0,this._lastY=0,this._lastTime=0,this._velocityThreshold=e.velocitySwipeThreshold??.5,this._movementTimeThreshold=e.movementTimeThreshold??100}}},64481(e,t,s){s.d(t,{D:()=>r,J:()=>o});s(64979);let i=!1;try{i="true"===window.localStorage.getItem("disableViewTransition")}catch{}const r=e=>{i=e},a=e=>{if(!(e=>(e instanceof DOMException||e instanceof Error)&&"AbortError"===e.name)(e))throw e},o=e=>{if(!document.startViewTransition||i)return e(!1),Promise.resolve();let t=!1;try{const s=document.startViewTransition(()=>{t=!0,e(!0)});return s.ready.catch(a),s.finished.catch(a)}catch(s){return console.warn("View transition failed, falling back to direct execution.",s),t?Promise.reject(s):(e(!1),Promise.resolve())}}},65829(e,t,s){s.a(e,async function(e,i){try{s.r(t),s.d(t,{HaSpinner:()=>l});var r=s(62826),a=s(55262),o=s(5124),n=s(22441),c=e([a]);a=(c.then?(await c)():c)[0];class l extends a.A{updated(e){if(super.updated(e),e.has("size"))switch(this.size){case"tiny":this.style.setProperty("--ha-spinner-size","16px");break;case"small":this.style.setProperty("--ha-spinner-size","28px");break;case"medium":this.style.setProperty("--ha-spinner-size","48px");break;case"large":this.style.setProperty("--ha-spinner-size","68px");break;case void 0:this.style.removeProperty("--ha-progress-ring-size")}}static get styles(){return[a.A.styles,o.AH`:host{--indicator-color:var( --ha-spinner-indicator-color, var(--primary-color) );--track-color:var(--ha-spinner-divider-color, var(--divider-color));--track-width:4px;--speed:3.5s;font-size:var(--ha-spinner-size, 48px)}`]}}(0,r.Cg)([(0,n.MZ)()],l.prototype,"size",void 0),l=(0,r.Cg)([(0,n.EM)("ha-spinner")],l),i()}catch(e){i(e)}})},87225(e,t,s){s.d(t,{GS:()=>a,I8:()=>n,YQ:()=>u,bn:()=>l,fg:()=>c,oW:()=>o,ob:()=>d});s(74423);var i=s(71727),r=s(68246);const a=[{groups:{dynamicGroups:{},time_location:{icon:"M15,12H16.5V16.25L19.36,17.94L18.61,19.16L15,17V12M23,16A7,7 0 0,1 16,23C13,23 10.4,21.08 9.42,18.4L8,17.9L2.66,19.97L2.5,20A0.5,0.5 0 0,1 2,19.5V4.38C2,4.15 2.15,3.97 2.36,3.9L8,2L14,4.1L19.34,2H19.5A0.5,0.5 0 0,1 20,2.5V10.25C21.81,11.5 23,13.62 23,16M9,16C9,12.83 11.11,10.15 14,9.29V6.11L8,4V15.89L9,16.24C9,16.16 9,16.08 9,16M16,11A5,5 0 0,0 11,16A5,5 0 0,0 16,21A5,5 0 0,0 21,16A5,5 0 0,0 16,11Z",members:{sun:{},time:{},zone:{}}},helpers:{},template:{},trigger:{},other:{}}},{titleKey:"ui.panel.config.automation.editor.conditions.groups.generic.label",generic:!0,groups:{device:{},entity:{icon:"M11,13.5V21.5H3V13.5H11M12,2L17.5,11H6.5L12,2M17.5,13C20,13 22,15 22,17.5C22,20 20,22 17.5,22C15,22 13,20 13,17.5C13,15 15,13 17.5,13Z",members:{state:{},numeric_state:{}}}}},{titleKey:"ui.panel.config.automation.editor.conditions.groups.custom_integrations.label",groups:{customDynamicGroups:{}}}],o={and:{},or:{},not:{}},n=["and","or","not"],c=["ha-automation-condition-and","ha-automation-condition-not","ha-automation-condition-or"],l=(e,t)=>e.connection.subscribeMessage(t,{type:"condition_platforms/subscribe"}),d=e=>e.includes(".")?(0,i.m)(e):e,u=e=>e.includes(".")?(0,r.Y)(e):"_"},48250(e,t,s){s.d(t,{Bp:()=>r,aI:()=>i,gg:()=>c,oT:()=>a,wE:()=>o,x0:()=>n});const i=async(e,t)=>(await e.sendMessagePromise({type:"frontend/get_user_data",key:t})).value,r=async(e,t,s)=>e.sendMessagePromise({type:"frontend/set_user_data",key:t,value:s}),a=(e,t,s)=>e.subscribeMessage(s,{type:"frontend/subscribe_user_data",key:t}),o=async(e,t)=>(await e.sendMessagePromise({type:"frontend/get_system_data",key:t})).value,n=async(e,t,s)=>e.sendMessagePromise({type:"frontend/set_system_data",key:t,value:s}),c=(e,t,s)=>e.subscribeMessage(s,{type:"frontend/subscribe_system_data",key:t})},88360(e,t,s){s.d(t,{j:()=>r});var i=s(1087);const r=(e,t)=>{(0,i.r)(e,"haptic",t)}},99774(e,t,s){s.d(t,{Dq:()=>c,EN:()=>l,FW:()=>f,JF:()=>a,Oi:()=>i,Q:()=>_,W5:()=>v,Wp:()=>u,hL:()=>h,kO:()=>d,pk:()=>y,qx:()=>o,sn:()=>p,vI:()=>m});s(74423),s(18111),s(20116),s(69112);const i="notfound",r="profile",a="lovelace",o=["_my_redirect",i,"app"],n="home",c=e=>Boolean(e.panels.lovelace?.config),l=e=>{const t=e.userData?.default_panel||e.systemData?.default_panel||(()=>{const e=window.localStorage.getItem("defaultPanel");return e?JSON.parse(e):null})()||n;return t!==a||c(e)?t:n},d=e=>{const t=l(e);return(t?e.panels[t]:void 0)??e.panels[n]??e.panels[i]},u=e=>[r,i].includes(e.url_path)?`panel.${e.url_path}`:`panel.${e.title}`,h=(e,t)=>{const s=u(t);return e.localize(s)||t.title||void 0},m=(e,t)=>{if(!e.panels)return;const s=Object.values(e.panels).find(e=>e.url_path===t);return s?h(e,s):void 0},p=(e,t,s)=>{for(const i of Object.values(s)){const s=i.find(e=>t.startsWith(e.path));if(s){if(s.translationKey){const t=e.localize(s.translationKey);if(t)return t}if(s.name)return s.name}}},_=e=>e.icon||"profile"!==e.component_name?e.icon||void 0:"mdi:account",g={calendar:"M19,19H5V8H19M16,1V3H8V1H6V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H18V1M17,12H12V17H17V12Z",energy:"M11 15H6L13 1V9H18L11 23V15Z",history:"M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M9 17H7V10H9V17M13 17H11V7H13V17M17 17H15V13H17V17Z",logbook:"M5,9.5L7.5,14H2.5L5,9.5M3,4H7V8H3V4M5,20A2,2 0 0,0 7,18A2,2 0 0,0 5,16A2,2 0 0,0 3,18A2,2 0 0,0 5,20M9,5V7H21V5H9M9,19H21V17H9V19M9,13H21V11H9V13Z",map:"M20,2H4A2,2 0 0,0 2,4V16A2,2 0 0,0 4,18H8L12,22L16,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M12,4.3C13.5,4.3 14.7,5.5 14.7,7C14.7,8.5 13.5,9.7 12,9.7C10.5,9.7 9.3,8.5 9.3,7C9.3,5.5 10.5,4.3 12,4.3M18,15H6V14.1C6,12.1 10,11 12,11C14,11 18,12.1 18,14.1V15Z",profile:"M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z","media-browser":"M4,6H2V20A2,2 0 0,0 4,22H18V20H4V6M20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M12,14.5V5.5L18,10L12,14.5Z",todo:"M19 3H14.82C14.4 1.84 13.3 1 12 1S9.6 1.84 9.18 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M7 8H9V12H8V9H7V8M10 17V18H7V17.08L9 15H7V14H9.25C9.66 14 10 14.34 10 14.75C10 14.95 9.92 15.14 9.79 15.27L8.12 17H10M11 4C11 3.45 11.45 3 12 3S13 3.45 13 4 12.55 5 12 5 11 4.55 11 4M17 17H12V15H17V17M17 11H12V9H17V11Z"},f=e=>g[e.url_path],y=59509==s.j?[r,"config",i]:null,v=(e,t,s)=>e.callWS({type:"frontend/update_panel",url_path:t,...s})},71606(e,t,s){s.d(t,{f:()=>r,o:()=>i});s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698);const i=new Set(["automation","script","scene","group"]),r=(e,t,s)=>e.callWS({type:"search/related",item_type:t,item_id:s})},46927(e,t,s){if(s.d(t,{$W:()=>d,Hg:()=>a,Wj:()=>o,Yk:()=>u,jG:()=>r,mo:()=>l,ow:()=>n,zt:()=>c}),66649!=s.j)var i=s(48250);var r=function(e){return e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.quote_decimal="quote_decimal",e.space_comma="space_comma",e.none="none",e}({}),a=function(e){return e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24",e}({}),o=function(e){return e.local="local",e.server="server",e}({}),n=function(e){return e.language="language",e.system="system",e.DMY="DMY",e.MDY="MDY",e.YMD="YMD",e}({}),c=function(e){return e.language="language",e.monday="monday",e.tuesday="tuesday",e.wednesday="wednesday",e.thursday="thursday",e.friday="friday",e.saturday="saturday",e.sunday="sunday",e}({});const l=(e,t)=>(0,i.oT)(e.connection,"language",t),d=(e,t)=>(0,i.Bp)(e.connection,"language",t),u=async(e,t,s,i,r)=>(await e.callWS({type:"frontend/get_translations",language:t,category:s,integration:i,config_flow:r})).resources},324(e,t,s){s.d(t,{a:()=>l});s(18111),s(7588);var i=s(62826),r=s(5124),a=s(22441),o=s(22786),n=s(91926),c=s(1974);class l extends r.mN{createRenderRoot(){return this}update(e){super.update(e);const t=this.routerOptions||{routes:{}};if(t&&t.initialLoad&&!this._initialLoadDone)return;if(!e.has("route"))return void(this.lastChild&&!this._currentLoadProm&&this.updatePageEl(this.lastChild,e));const s=this.route,i=t.defaultPage;if(s&&""===s.path&&void 0!==i){const e=window.location.search;(0,n.oo)(`${s.prefix}/${i}${e}`,{replace:!0})}let r=s?((e,t)=>{if(""===e)return t;const s=e.indexOf("/",1);return-1===s?e.substr(1):e.substr(1,s-1)})(s.path,i||""):"not_found",a=t.routes[r];for(;"string"==typeof a;)r=a,a=t.routes[r];if(t.beforeRender){const e=t.beforeRender(r);if(void 0!==e){for(r=e,a=t.routes[r];"string"==typeof a;)r=a,a=t.routes[r];s&&(0,n.oo)(`${s.prefix}/${e}${location.search}`,{replace:!0})}}if(this._currentPage===r)return void(this.lastChild&&this.route&&this.updatePageEl(this.lastChild,e));if(!a)return this._currentPage="",void(this.lastChild&&this.removeChild(this.lastChild));this._currentPage=r;const o=a.load?a.load():Promise.resolve();if(this._showLoadingScreenTimeout&&(clearTimeout(this._showLoadingScreenTimeout),this._showLoadingScreenTimeout=void 0),o.catch(e=>{console.error("Error loading page",r,e),this._currentPage===r&&(this.lastChild&&this.removeChild(this.lastChild),this._showLoadingScreenTimeout&&(clearTimeout(this._showLoadingScreenTimeout),this._showLoadingScreenTimeout=void 0),this.appendChild(this.createErrorScreen(`Error while loading page ${r}.`)))}),!t.showLoading)return void this._createPanel(t,r,a);let c=!1;this._showLoadingScreenTimeout=window.setTimeout(()=>{c||this._currentPage!==r||(this.lastChild&&this.removeChild(this.lastChild),this.appendChild(this.createLoadingScreen()))},400),this._currentLoadProm=o.then(()=>{this._currentLoadProm=void 0,this._currentPage===r&&(c=!0,this._createPanel(t,r,a))},()=>{this._currentLoadProm=void 0})}firstUpdated(e){super.firstUpdated(e);const t=this.routerOptions;t&&(t.preloadAll&&Object.values(t.routes).forEach(e=>"object"==typeof e&&e.load&&e.load()),t.initialLoad&&(setTimeout(()=>{this._initialLoadDone||this.appendChild(this.createLoadingScreen())},400),t.initialLoad().then(()=>{this._initialLoadDone=!0,this.requestUpdate("route")})))}createLoadingScreen(){return s.e(72057).then(s.bind(s,23296)),document.createElement("hass-loading-screen")}createErrorScreen(e){s.e(31975).then(s.bind(s,28794));const t=document.createElement("hass-error-screen");return t.error=e,t}async rebuild(){const e=this.route;void 0!==e&&(this.route=void 0,await this.updateComplete,void 0===this.route&&(this.route=e))}get pageRendered(){return this.updateComplete.then(()=>this._currentLoadProm)}createElement(e){return document.createElement(e)}updatePageEl(e,t){}get routeTail(){return this._computeTail(this.route)}_createPanel(e,t,s){this.lastChild&&this.removeChild(this.lastChild);const i=this._cache[t]||this.createElement(s.tag);this.updatePageEl(i),this.appendChild(i),(e.cacheAll||s.cache)&&(this._cache[t]=i)}constructor(...e){super(...e),this._currentPage="",this._cache={},this._initialLoadDone=!1,this._computeTail=(0,o.A)(c.l)}}(0,i.Cg)([(0,a.MZ)({attribute:!1})],l.prototype,"route",void 0)},37619(e,t,s){s.d(t,{X:()=>a,s:()=>r});s(69112),s(33110);let i=!1;const r=e=>{i=e},a=(e,t)=>{const s=e.sendMessagePromise(t);return i&&console.log(`⬆️ Sent #${t.id}`,t),i&&s.then(e=>console.log(`⬇️ Received #${t.id}`,e&&"object"==typeof e?JSON.parse(JSON.stringify(e)):e),e=>console.error(`❌ Error #${t.id}`,e)),s}}};