iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 23.4 kB
JavaScript
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["95077"],{50875:function(t,e,i){i.d(e,{Eu:()=>r,hZ:()=>a,o9:()=>c});var s=i(27486),n=i(11259);const o=["#4269d0","#f4bd4a","#ff725c","#6cc5b0","#a463f2","#ff8ab7","#9c6b4e","#97bbf5","#01ab63","#9498a0","#094bad","#c99000","#d84f3e","#49a28f","#048732","#d96895","#8043ce","#7599d1","#7a4c31","#74787f","#6989f4","#ffd444","#ff957c","#8fe9d3","#62cc71","#ffadda","#c884ff","#badeff","#bf8b6d","#b6bac2","#927acc","#97ee3f","#bf3947","#9f5b00","#f48758","#8caed6","#f2b94f","#eff26e","#e43872","#d9b100","#9d7a00","#698cff","#d9d9d9","#00d27e","#d06800","#009f82","#c49200","#cbe8ff","#fecddf","#c27eb6","#8cd2ce","#c4b8d9","#f883b0","#a49100","#f48800","#27d0df","#a04a9b"];function r(t){return o[t%o.length]}function a(t,e){const i=e.getPropertyValue(`--graph-color-${t+1}`)||r(t);return(0,n.Rq)(i)}const c=(0,s.Z)((t=>o.map(((e,i)=>a(i,t)))),((t,e)=>t[0].getPropertyValue("--graph-color-1")===e[0].getPropertyValue("--graph-color-1")))},97547:function(t,e,i){i.a(t,(async function(t,s){try{i.d(e,{c:()=>m,computeStateDisplay:()=>_});i(19083),i(19423),i(61006);var n=i(96194),o=i(20382),r=i(54363),a=i(46467),c=i(64214),l=i(33570),u=i(50602),d=i(87974),h=i(73850),f=t([r,u,a,l,c]);[r,u,a,l,c]=f.then?(await f)():f;const _=(t,e,i,s,n,o,r)=>{const a=null==o?void 0:o[e.entity_id];return m(t,i,s,n,a,e.entity_id,e.attributes,void 0!==r?r:e.state)},m=(t,e,i,s,f,_,m,g)=>{if(g===n.lz||g===n.nZ)return t(`state.default.${g}`);const b=(0,h.M)(_),v="counter"===b||"number"===b||"input_number"===b;if((0,u.sJ)(m,"sensor"===b?i:[])||v){if("duration"===m.device_class&&m.unit_of_measurement&&r.a_.includes(m.unit_of_measurement))try{return(0,r.LU)(e,g,m.unit_of_measurement,null==f?void 0:f.display_precision)}catch(y){}if("monetary"===m.device_class)try{return(0,u.uf)(g,e,Object.assign({style:"currency",currency:m.unit_of_measurement,minimumFractionDigits:2},(0,u.l4)({state:g,attributes:m},f)))}catch(y){}const i=(0,u.uf)(g,e,(0,u.l4)({state:g,attributes:m},f)),s=(null==f?void 0:f.translation_key)&&t(`component.${f.platform}.entity.${b}.${f.translation_key}.unit_of_measurement`)||m.unit_of_measurement;return s?`${i}${(0,d.L)(s,e)}${s}`:i}if(["date","input_datetime","time"].includes(b))try{const t=g.split(" ");if(2===t.length)return(0,c.o0)(new Date(t.join("T")),Object.assign(Object.assign({},e),{},{time_zone:o.c_.local}),s);if(1===t.length){if(g.includes("-"))return(0,a.p6)(new Date(`${g}T00:00`),Object.assign(Object.assign({},e),{},{time_zone:o.c_.local}),s);if(g.includes(":")){const t=new Date;return(0,l.mr)(new Date(`${t.toISOString().split("T")[0]}T${g}`),Object.assign(Object.assign({},e),{},{time_zone:o.c_.local}),s)}}return g}catch(p){return g}if(["button","conversation","event","image","input_button","notify","scene","stt","tag","tts","wake_word","datetime"].includes(b)||"sensor"===b&&"timestamp"===m.device_class)try{return(0,c.o0)(new Date(g),e,s)}catch(y){return g}return(null==f?void 0:f.translation_key)&&t(`component.${f.platform}.entity.${b}.${f.translation_key}.state.${g}`)||m.device_class&&t(`component.${b}.entity_component.${m.device_class}.state.${g}`)||t(`component.${b}.entity_component._.state.${g}`)||g};s()}catch(_){s(_)}}))},74564:function(t,e,i){i.d(e,{Z:()=>n});i(52247),i(95078),i(19134),i(97499),i(97003);const s=t=>{const e=parseFloat(t);if(isNaN(e))throw new Error(`${t} is not a number`);return e};function n(t){if(!t)return null;try{if(t.endsWith("%"))return{w:100,h:s(t.substr(0,t.length-1))};const e=t.replace(":","x").split("x");return 0===e.length?null:1===e.length?{w:s(e[0]),h:1}:{w:s(e[0]),h:s(e[1])}}catch(e){}return null}},6280:function(t,e,i){i.a(t,(async function(t,s){try{i.d(e,{Nu:()=>M,V3:()=>H,Vk:()=>h,YA:()=>E,xS:()=>_,zP:()=>$});i(19083),i(71695),i(92745),i(61893),i(84283),i(9359),i(56475),i(1331),i(31526),i(70104),i(52924),i(19423),i(11740),i(92519),i(42179),i(89256),i(24931),i(88463),i(57449),i(19814),i(61006),i(47021);var n=i(73850),o=i(97547),r=i(47194),a=t([o]);o=(a.then?(await a)():a)[0];const c=["climate","humidifier","water_heater"],l=["climate","humidifier","input_datetime","water_heater","person","device_tracker"],u=["temperature","current_temperature","target_temp_low","target_temp_high","hvac_action","humidity","mode","action","current_humidity"],d=(t,e)=>!t.states[e]||l.includes((0,n.M)(e)),h=(t,e,i,s,n)=>{const o={type:"history/stream",entity_ids:n,start_time:i.toISOString(),end_time:s.toISOString(),minimal_response:!0,no_attributes:!n.some((e=>d(t,e)))},r=new f(t);return t.connection.subscribeMessage((t=>e(r.processMessage(t))),o)};class f{constructor(t,e){this.hass=void 0,this.hoursToShow=void 0,this.combinedHistory=void 0,this.hass=t,this.hoursToShow=e,this.combinedHistory={}}processMessage(t){if(!this.combinedHistory||!Object.keys(this.combinedHistory).length)return this.combinedHistory=t.states,this.combinedHistory;if(!Object.keys(t.states).length)return this.combinedHistory;const e=this.hoursToShow?((new Date).getTime()-3600*this.hoursToShow*1e3)/1e3:void 0,i={};for(const s of Object.keys(this.combinedHistory))i[s]=[];for(const s of Object.keys(t.states))i[s]=[];for(const s of Object.keys(i)){if(s in this.combinedHistory&&s in t.states){const e=this.combinedHistory[s],n=e[e.length-1];i[s]=e.concat(t.states[s]),t.states[s][0].lu<n.lu&&(i[s]=i[s].sort(((t,e)=>t.lu-e.lu)))}else s in this.combinedHistory?i[s]=this.combinedHistory[s]:i[s]=t.states[s];if(e&&s in this.combinedHistory){const t=i[s].filter((t=>t.lu<e));if(!t.length)continue;if(i[s]=i[s].filter((t=>t.lu>=e)),i[s].length&&i[s][0].lu===e)continue;const n=t[t.length-1];n.lu=e,i[s].unshift(n)}}return this.combinedHistory=i,this.combinedHistory}}const _=(t,e,i,s,n,o=!0,r=!0)=>{const a={type:"history/stream",entity_ids:s,start_time:new Date((new Date).getTime()-3600*i*1e3).toISOString(),minimal_response:o,significant_changes_only:r,no_attributes:null!=n?n:!s.some((e=>d(t,e)))},c=new f(t,i);return t.connection.subscribeMessage((t=>e(c.processMessage(t))),a)},m=(t,e)=>t.state===e.state&&(!t.attributes||!e.attributes||u.every((i=>t.attributes[i]===e.attributes[i]))),g=(t,e,i,s,n,a,c)=>{const l=[],u=a[0];for(const r of a){if(l.length>0&&r.s===l[l.length-1].state)continue;const a={};null!=c&&c.attributes.device_class&&(a.device_class=null==c?void 0:c.attributes.device_class),l.push({state_localize:(0,o.c)(t,e,[],i,s[n],n,Object.assign(Object.assign({},r.a||u.a),a),r.s),state:r.s,last_changed:1e3*(r.lc?r.lc:r.lu)})}return{name:(0,r.a)(n,(null==c?void 0:c.attributes)||u.a),entity_id:n,data:l}},b=(t,e,i,s)=>{const o=[];return Object.keys(i).forEach((t=>{const e=i[t],a=e[0],l=(0,n.M)(t),d=[];for(const i of e){let t;if(c.includes(l)){t={state:i.s,last_changed:1e3*i.lu,attributes:{}};for(const e of u)e in i.a&&(t.attributes[e]=i.a[e])}else t={state:i.s,last_changed:1e3*(i.lc?i.lc:i.lu),attributes:{}};d.length>1&&m(t,d[d.length-1])&&m(t,d[d.length-2])||d.push(t)}const h=t in s?s[t].attributes:"friendly_name"in a.a?a.a:void 0;o.push({domain:l,name:(0,r.a)(t,h||{}),entity_id:t,states:d})})),{unit:t,device_class:e,identifier:Object.keys(i).join(""),data:o}},v=["counter","input_number","number"],y=t=>v.includes(t),p=t=>"unit_of_measurement"in t||"state_class"in t,k=(t,e)=>null!=t.attributes.device_class&&e.includes(t.attributes.device_class),w=" ",E=(t,e,i,s,n=!1)=>{const o={};i.forEach((t=>{t in e&&(o[t]=e[t])}));const r={};Object.entries(o).forEach((([t,e])=>{const i=e.map((t=>({s:null!=t.mean?t.mean.toString():t.state.toString(),lc:t.start/1e3,a:{},lu:t.start/1e3})));r[t]=i}));const a=M(t,r,[],t.localize,s,n,!0);return((null==a?void 0:a.line)||[]).forEach((t=>{t.data.forEach((t=>{t.statistics=t.states,t.states=[]}))})),a},M=(t,e,i,s,o,r=!1,a=!1)=>{const c={},l=[],u={};if(new Set([...i,...Object.keys(e)]).forEach((i=>{i in e?u[i]=e[i]:t.states[i]&&(u[i]=[{s:t.states[i].state,a:t.states[i].attributes,lu:new Date(t.states[i].last_updated).getTime()/1e3}])})),!u)return{line:[],timeline:[]};Object.keys(u).forEach((e=>{var i;const d=u[e];if(0===d.length)return;const h=(0,n.M)(e),f=e in t.states?t.states[e]:void 0,_=f||y(h)?void 0:d.find((t=>t.a&&p(t.a)));let m;m=$(h,f,_,o,a)?(null==f?void 0:f.attributes.unit_of_measurement)||(null==_?void 0:_.a.unit_of_measurement)||w:{zone:s("ui.dialogs.more_info_control.zone.graph_unit"),climate:t.config.unit_system.temperature,humidifier:"%",water_heater:t.config.unit_system.temperature}[h];const b={climate:"temperature",humidifier:"humidity",water_heater:"temperature"}[h]||(null===(i=(null==f?void 0:f.attributes)||(null==_?void 0:_.a))||void 0===i?void 0:i.device_class),v=O(m,b,r);m?v&&v in c&&e in c[v]?c[v][e].push(...d):v&&(v in c||(c[v]={}),c[v][e]=d):l.push(g(s,t.locale,t.config,t.entities,e,d,f))}));return{line:Object.keys(c).map((e=>{const i=e.split("_"),s=i[0],n=i[1]||void 0;return b(s,n,c[e],t.states)})),timeline:l}},O=(t,e,i)=>i?`${t}_${e||""}`:t,$=(t,e,i,s,n=!1)=>n||y(t)||null!=e&&p(e.attributes)||null!=e&&"sensor"===t&&k(e,s)||null!=i,H=(t,e,i=!0)=>{if(!e)return t;const s=Object.assign(Object.assign({},t),{},{line:[]}),n={};for(const r of t.line){const t=O(r.unit,r.device_class,i);t&&(n[t]={historyItem:r})}for(const r of e.line){const t=O(r.unit,r.device_class,i);t&&(t in n?n[t].ltsItem=r:n[t]={ltsItem:r})}for(const{historyItem:r,ltsItem:a}of Object.values(n)){if(!r||!a){s.line.push(r||a);continue}const t=Object.assign(Object.assign({},r),{},{data:[]}),e=new Set([...r.data.map((t=>t.entity_id)),...a.data.map((t=>t.entity_id))]);for(const i of e){var o;const e=r.data.find((t=>t.entity_id===i)),s=a.data.find((t=>t.entity_id===i));if(!e||!s){t.data.push(e||s);continue}const n=(null===(o=e.states[0])||void 0===o?void 0:o.last_changed)||s.statistics[s.statistics.length-1].last_changed+1,c=[];for(const t of s.statistics){if(t.last_changed>=n)break;c.push(t)}t.data.push(0===c.length?e:Object.assign(Object.assign({},e),{},{statistics:c}))}s.line.push(t)}return s};s()}catch(c){s(c)}}))},11823:function(t,e,i){i.a(t,(async function(t,s){try{i.r(e),i.d(e,{DEFAULT_HOURS_TO_SHOW:()=>j,DEFAULT_ZOOM:()=>A});var n=i(61701),o=i(72621),r=(i(52247),i(71695),i(92745),i(9359),i(1331),i(31526),i(70104),i(49278),i(19423),i(40251),i(92519),i(42179),i(89256),i(24931),i(88463),i(57449),i(19814),i(47021),i(57243)),a=i(50778),c=i(27486),l=i(50875),u=i(72344),d=i(73850),h=i(59847),f=i(47194),_=i(48045),m=i(74564),g=(i(99426),i(54977),i(23334),i(65986)),b=i(6280),v=i(69223),y=i(93331),p=i(29401),k=t([g,b]);[g,b]=k.then?(await k)():k;let w,E,M,O=t=>t;const $="M16 12C16 10.9 16.9 10 18 10S20 10.9 20 12 19.1 14 18 14 16 13.1 16 12M10 12C10 10.9 10.9 10 12 10S14 10.9 14 12 13.1 14 12 14 10 13.1 10 12M4 12C4 10.9 4.9 10 6 10S8 10.9 8 12 7.1 14 6 14 4 13.1 4 12M13 18C13 16.9 13.9 16 15 16S17 16.9 17 18 16.1 20 15 20 13 19.1 13 18M7 18C7 16.9 7.9 16 9 16S11 16.9 11 18 10.1 20 9 20 7 19.1 7 18M13 6C13 4.9 13.9 4 15 4S17 4.9 17 6 16.1 8 15 8 13 7.1 13 6M7 6C7 4.9 7.9 4 9 4S11 4.9 11 6 10.1 8 9 8 7 7.1 7 6",H="M15,12C13.89,12 13,12.89 13,14A2,2 0 0,0 15,16A2,2 0 0,0 17,14C17,12.89 16.1,12 15,12M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M14,9C14,7.89 13.1,7 12,7C10.89,7 10,7.89 10,9A2,2 0 0,0 12,11A2,2 0 0,0 14,9M9,12A2,2 0 0,0 7,14A2,2 0 0,0 9,16A2,2 0 0,0 11,14C11,12.89 10.1,12 9,12Z",S="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M19,19H15V21H19A2,2 0 0,0 21,19V15H19M19,3H15V5H19V9H21V5A2,2 0 0,0 19,3M5,5H9V3H5A2,2 0 0,0 3,5V9H5M5,15H3V19A2,2 0 0,0 5,21H9V19H5V15Z",j=0,A=14;(0,n.Z)([(0,a.Mo)("hui-map-card")],(function(t,e){class s extends e{constructor(...e){super(...e),t(this)}}return{F:s,d:[{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"layout",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_stateHistory",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_config",value:void 0},{kind:"field",decorators:[(0,a.IO)("ha-map")],key:"_map",value:void 0},{kind:"field",key:"_configEntities",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_mapEntities",value(){return[]}},{kind:"field",key:"_colorDict",value(){return{}}},{kind:"field",key:"_colorIndex",value(){return 0}},{kind:"field",decorators:[(0,a.SB)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_clusterMarkers",value(){return!0}},{kind:"field",key:"_subscribed",value:void 0},{kind:"method",key:"_getAllEntities",value:function(){const t=this.hass,e=new Set,i=[];return Object.values(t.states).forEach((t=>{"latitude"in t.attributes&&"longitude"in t.attributes&&(i.push(t.entity_id),"person"===(0,h.N)(t)&&t.attributes.source&&e.add(t.attributes.source))})),i.filter((t=>!e.has(t)))}},{kind:"method",key:"setConfig",value:function(t){var e;if(!t)throw new Error("Error in card configuration.");if(!(t.show_all||null!==(e=t.entities)&&void 0!==e&&e.length||t.geo_location_sources))throw new Error("Either show_all, entities, or geo_location_sources must be specified");if(t.entities&&!Array.isArray(t.entities))throw new Error("Entities need to be an array");if(t.geo_location_sources&&!Array.isArray(t.geo_location_sources))throw new Error("Parameter geo_location_sources needs to be an array");if(t.show_all&&(t.entities||t.geo_location_sources))throw new Error("Cannot specify show_all and entities or geo_location_sources");this._config=Object.assign({},t),this.hass&&t.show_all&&(this._config.entities=this._getAllEntities()),this._configEntities=this._config.entities?(0,p.A)(this._config.entities):[],this._mapEntities=this._getMapEntities()}},{kind:"method",key:"getCardSize",value:function(){var t;if(null===(t=this._config)||void 0===t||!t.aspect_ratio)return 7;const e=(0,m.Z)(this._config.aspect_ratio),i=e&&e.w>0&&e.h>0?`${(100*e.h/e.w).toFixed(2)}`:"100";return 1+Math.floor(Number(i)/25)||3}},{kind:"method",static:!0,key:"getConfigElement",value:async function(){return await Promise.all([i.e("46379"),i.e("24199"),i.e("41258"),i.e("78943"),i.e("7010"),i.e("62524"),i.e("27090"),i.e("3049"),i.e("47818"),i.e("98815")]).then(i.bind(i,96216)),document.createElement("hui-map-card-editor")}},{kind:"method",static:!0,key:"getStubConfig",value:function(t,e,i){return{type:"map",entities:(0,v.j)(t,2,e,i,["device_tracker"]),theme_mode:"auto"}}},{kind:"method",key:"render",value:function(){var t;if(!this._config)return r.Ld;if(this._error)return(0,r.dy)(w||(w=O`<ha-alert alert-type="error"> ${0}: ${0} (${0}) </ha-alert>`),this.hass.localize("ui.components.map.error"),this._error.message,this._error.code);const e=!(!this._config.dark_mode&&"dark"!==this._config.theme_mode)||"light"!==this._config.theme_mode&&this.hass.themes.darkMode,i=this._config.theme_mode||(this._config.dark_mode?"dark":"auto");return(0,r.dy)(E||(E=O` <ha-card id="card" .header="${0}"> <div id="root"> <ha-map .hass="${0}" .entities="${0}" .zoom="${0}" .paths="${0}" .autoFit="${0}" .fitZones="${0}" .themeMode="${0}" .clusterMarkers="${0}" interactive-zones render-passive></ha-map> <div id="buttons"> <ha-icon-button .label="${0}" .path="${0}" style="${0}" ="${0}" tabindex="0"></ha-icon-button> <ha-icon-button .label="${0}" .path="${0}" style="${0}" ="${0}" tabindex="0"></ha-icon-button> </div> </div> </ha-card> `),this._config.title,this.hass,this._mapEntities,null!==(t=this._config.default_zoom)&&void 0!==t?t:A,this._getHistoryPaths(this._config,this._stateHistory),this._config.auto_fit||!1,this._config.fit_zones,i,this._clusterMarkers,this.hass.localize("ui.panel.lovelace.cards.map.toggle_grouping"),this._clusterMarkers?H:$,e?"color:#ffffff":"color:#000000",this._toggleClusterMarkers,this.hass.localize("ui.panel.lovelace.cards.map.reset_focus"),S,e?"color:#ffffff":"color:#000000",this._fitMap)}},{kind:"method",key:"shouldUpdate",value:function(t){var e,i;if(!t.has("hass")||t.size>1)return!0;const s=t.get("hass");return!s||!this._configEntities||(s.themes.darkMode!==this.hass.themes.darkMode||(!!t.has("_stateHistory")||(!(null===(e=this._config)||void 0===e||!e.geo_location_sources||s.states===this.hass.states)||(null!==(i=this._config)&&void 0!==i&&i.entities?(0,y.Wh)(this,t):(0,y.SN)(this,t)))))}},{kind:"method",key:"willUpdate",value:function(t){var e,i,n,r;(0,o.Z)(s,"willUpdate",this,3)([t]),null!==(e=this._config)&&void 0!==e&&e.show_all&&(null===(i=this._config)||void 0===i||!i.entities)&&this.hass&&t.has("hass")&&(this._config.entities=this._getAllEntities(),this._configEntities=(0,p.A)(this._config.entities),this._mapEntities=this._getMapEntities()),t.has("hass")&&null!==(n=this._config)&&void 0!==n&&n.geo_location_sources&&!(0,_.v)(this._getSourceEntities(null===(r=t.get("hass"))||void 0===r?void 0:r.states),this._getSourceEntities(this.hass.states))&&(this._mapEntities=this._getMapEntities())}},{kind:"method",key:"connectedCallback",value:function(){var t;(0,o.Z)(s,"connectedCallback",this,3)([]),this.hasUpdated&&null!==(t=this._configEntities)&&void 0!==t&&t.length&&this._subscribeHistory()}},{kind:"method",key:"disconnectedCallback",value:function(){(0,o.Z)(s,"disconnectedCallback",this,3)([]),this._unsubscribeHistory()}},{kind:"method",key:"_subscribeHistory",value:function(){var t,e,i;(0,u.p)(this.hass,"history")&&!this._subscribed&&(null!==(t=null===(e=this._config)||void 0===e?void 0:e.hours_to_show)&&void 0!==t?t:j)&&(this._subscribed=(0,b.xS)(this.hass,(t=>{this._subscribed&&(this._stateHistory=t)}),null!==(i=this._config.hours_to_show)&&void 0!==i?i:j,(this._configEntities||[]).map((t=>t.entity)),!1,!1,!1).catch((t=>{this._subscribed=void 0,this._error=t})))}},{kind:"method",key:"_unsubscribeHistory",value:function(){this._subscribed&&(this._subscribed.then((t=>null==t?void 0:t())),this._subscribed=void 0)}},{kind:"method",key:"updated",value:function(t){var e;null!==(e=this._configEntities)&&void 0!==e&&e.length?this._subscribed&&!t.has("_config")||(this._unsubscribeHistory(),this._subscribeHistory()):this._unsubscribeHistory(),t.has("_config")&&this._computePadding()}},{kind:"method",key:"_computePadding",value:function(){const t=this.shadowRoot.getElementById("root"),e="panel"===this.layout||"grid"===this.layout;if(!this._config||e||!t)return;if(!this._config.aspect_ratio)return void(t.style.paddingBottom="100%");t.style.height="auto";const i=(0,m.Z)(this._config.aspect_ratio);t.style.paddingBottom=i&&i.w>0&&i.h>0?`${(100*i.h/i.w).toFixed(2)}%`:t.style.paddingBottom="100%"}},{kind:"method",key:"_fitMap",value:function(){var t;null===(t=this._map)||void 0===t||t.fitMap()}},{kind:"method",key:"_toggleClusterMarkers",value:function(){this._clusterMarkers=!this._clusterMarkers}},{kind:"method",key:"_getColor",value:function(t){let e=this._colorDict[t];return e||(e=(0,l.Eu)(this._colorIndex),this._colorIndex++,this._colorDict[t]=e,e)}},{kind:"method",key:"_getSourceEntities",value:function(t){var e;if(!t||null===(e=this._config)||void 0===e||!e.geo_location_sources)return[];const i=this._config.geo_location_sources.map((t=>"string"==typeof t?{source:t}:t)),s=[],n=i.find((t=>"all"===t.source));for(const l of Object.values(t)){const t=i.find((t=>t.source===l.attributes.source));var o,r,a,c;if("geo_location"===(0,d.M)(l.entity_id)&&(n||t))s.push({entity_id:l.entity_id,label_mode:null!==(o=null==t?void 0:t.label_mode)&&void 0!==o?o:null==n?void 0:n.label_mode,attribute:null!==(r=null==t?void 0:t.attribute)&&void 0!==r?r:null==n?void 0:n.attribute,focus:t?null===(a=t.focus)||void 0===a||a:null===(c=null==n?void 0:n.focus)||void 0===c||c})}return s}},{kind:"method",key:"_getMapEntities",value:function(){var t;return[...(this._configEntities||[]).map((t=>({entity_id:t.entity,color:this._getColor(t.entity),label_mode:t.label_mode,attribute:t.attribute,focus:t.focus,name:t.name}))),...this._getSourceEntities(null===(t=this.hass)||void 0===t?void 0:t.states).map((t=>Object.assign(Object.assign({},t),{},{color:this._getColor(t.entity_id)})))]}},{kind:"field",key:"_getHistoryPaths",value(){return(0,c.Z)(((t,e)=>{var i;if(!e||!(null!==(i=t.hours_to_show)&&void 0!==i?i:j))return;const s=[];for(const a of Object.keys(e)){var n,o,r;if("zone"===(0,d.M)(a))continue;const i=e[a];if(null==i||!i.length)continue;const c=[];for(const t of i){const e=t.a.latitude,i=t.a.longitude;if(!e||!i)continue;const s={};s.point=[e,i],s.timestamp=new Date(1e3*t.lu),c.push(s)}const l=null===(n=this._configEntities)||void 0===n?void 0:n.find((t=>t.entity===a)),u=null!==(o=null==l?void 0:l.name)&&void 0!==o?o:a in this.hass.states?(0,f.C)(this.hass.states[a]):a;s.push({points:c,name:u,fullDatetime:(null!==(r=t.hours_to_show)&&void 0!==r?r:j)>144,color:this._getColor(a),gradualOpacity:.8})}return s}))}},{kind:"method",key:"getGridOptions",value:function(){return{columns:"full",rows:4,min_columns:6,min_rows:2}}},{kind:"field",static:!0,key:"styles",value(){return(0,r.iv)(M||(M=O`ha-card{overflow:hidden;width:100%;height:100%;display:flex;flex-direction:column}ha-map{z-index:0;border:none;position:absolute;top:0;left:0;width:100%;height:100%;background:inherit;border-radius:var(--ha-card-border-radius,12px);overflow:hidden}#buttons{position:absolute;top:75px;left:3px;display:flex;flex-direction:column}#root{position:relative;height:100%}`))}}]}}),r.oi);s()}catch(w){s(w)}}))},86256:function(t,e,i){var s=i(88045),n=i(72616),o=i(95011),r=RangeError;t.exports=function(t){var e=n(o(this)),i="",a=s(t);if(a<0||a===1/0)throw new r("Wrong number of repetitions");for(;a>0;(a>>>=1)&&(e+=e))1&a&&(i+=e);return i}},35638:function(t,e,i){var s=i(72878);t.exports=s(1..valueOf)},49278:function(t,e,i){var s=i(40810),n=i(72878),o=i(88045),r=i(35638),a=i(86256),c=i(29660),l=RangeError,u=String,d=Math.floor,h=n(a),f=n("".slice),_=n(1..toFixed),m=function(t,e,i){return 0===e?i:e%2==1?m(t,e-1,i*t):m(t*t,e/2,i)},g=function(t,e,i){for(var s=-1,n=i;++s<6;)n+=e*t[s],t[s]=n%1e7,n=d(n/1e7)},b=function(t,e){for(var i=6,s=0;--i>=0;)s+=t[i],t[i]=d(s/e),s=s%e*1e7},v=function(t){for(var e=6,i="";--e>=0;)if(""!==i||0===e||0!==t[e]){var s=u(t[e]);i=""===i?s:i+h("0",7-s.length)+s}return i};s({target:"Number",proto:!0,forced:c((function(){return"0.000"!==_(8e-5,3)||"1"!==_(.9,0)||"1.25"!==_(1.255,2)||"1000000000000000128"!==_(0xde0b6b3a7640080,0)}))||!c((function(){_({})}))},{toFixed:function(t){var e,i,s,n,a=r(this),c=o(t),d=[0,0,0,0,0,0],_="",y="0";if(c<0||c>20)throw new l("Incorrect fraction digits");if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return u(a);if(a<0&&(_="-",a=-a),a>1e-21)if(i=(e=function(t){for(var e=0,i=t;i>=4096;)e+=12,i/=4096;for(;i>=2;)e+=1,i/=2;return e}(a*m(2,69,1))-69)<0?a*m(2,-e,1):a/m(2,e,1),i*=4503599627370496,(e=52-e)>0){for(g(d,0,i),s=c;s>=7;)g(d,1e7,0),s-=7;for(g(d,m(10,s,1),0),s=e-1;s>=23;)b(d,1<<23),s-=23;b(d,1<<s),g(d,1,1),b(d,2),y=v(d)}else g(d,0,i),g(d,1<<-e,0),y=v(d)+h("0",c);return y=c>0?_+((n=y.length)<=c?"0."+h("0",c-n)+y:f(y,0,n-c)+"."+f(y,n-c)):_+y}})},68289:function(t,e,i){var s=i(40810),n=i(1569),o=i(27803),r=i(85779),a=TypeError,c=Object.defineProperty,l=n.self!==n;try{if(r){var u=Object.getOwnPropertyDescriptor(n,"self");!l&&u&&u.get&&u.enumerable||o(n,"self",{get:function(){return n},set:function(t){if(this!==n)throw new a("Illegal invocation");c(n,"self",{value:t,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}else s({global:!0,simple:!0,forced:l},{self:n})}catch(d){}}}]);
//# sourceMappingURL=95077.450831696559f02a.js.map