UNPKG

iobroker.lovelace

Version:

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

3 lines 39.1 kB
/*! For license information please see chunk.ffff5d65447416a05d62.js.LICENSE.txt */ (self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[4266],{44285:function(e,t,r){"use strict";r(65233);var n,i,o,a=r(9672),s=r(50856),l=r(42687);(0,a.k)({_template:(0,s.d)(n||(i=['\n <style>\n :host {\n display: inline-block;\n overflow: hidden;\n position: relative;\n }\n\n #baseURIAnchor {\n display: none;\n }\n\n #sizedImgDiv {\n position: absolute;\n top: 0px;\n right: 0px;\n bottom: 0px;\n left: 0px;\n\n display: none;\n }\n\n #img {\n display: block;\n width: var(--iron-image-width, auto);\n height: var(--iron-image-height, auto);\n }\n\n :host([sizing]) #sizedImgDiv {\n display: block;\n }\n\n :host([sizing]) #img {\n display: none;\n }\n\n #placeholder {\n position: absolute;\n top: 0px;\n right: 0px;\n bottom: 0px;\n left: 0px;\n\n background-color: inherit;\n opacity: 1;\n\n @apply --iron-image-placeholder;\n }\n\n #placeholder.faded-out {\n transition: opacity 0.5s linear;\n opacity: 0;\n }\n </style>\n\n <a id="baseURIAnchor" href="#"></a>\n <div id="sizedImgDiv" role="img" hidden$="[[_computeImgDivHidden(sizing)]]" aria-hidden$="[[_computeImgDivARIAHidden(alt)]]" aria-label$="[[_computeImgDivARIALabel(alt, src)]]"></div>\n <img id="img" alt$="[[alt]]" hidden$="[[_computeImgHidden(sizing)]]" crossorigin$="[[crossorigin]]" on-load="_imgOnLoad" on-error="_imgOnError">\n <div id="placeholder" hidden$="[[_computePlaceholderHidden(preload, fade, loading, loaded)]]" class$="[[_computePlaceholderClassName(preload, fade, loading, loaded)]]"></div>\n'],o||(o=i.slice(0)),n=Object.freeze(Object.defineProperties(i,{raw:{value:Object.freeze(o)}})))),is:"iron-image",properties:{src:{type:String,value:""},alt:{type:String,value:null},crossorigin:{type:String,value:null},preventLoad:{type:Boolean,value:!1},sizing:{type:String,value:null,reflectToAttribute:!0},position:{type:String,value:"center"},preload:{type:Boolean,value:!1},placeholder:{type:String,value:null,observer:"_placeholderChanged"},fade:{type:Boolean,value:!1},loaded:{notify:!0,readOnly:!0,type:Boolean,value:!1},loading:{notify:!0,readOnly:!0,type:Boolean,value:!1},error:{notify:!0,readOnly:!0,type:Boolean,value:!1},width:{observer:"_widthChanged",type:Number,value:null},height:{observer:"_heightChanged",type:Number,value:null}},observers:["_transformChanged(sizing, position)","_loadStateObserver(src, preventLoad)"],created:function(){this._resolvedSrc=""},_imgOnLoad:function(){this.$.img.src===this._resolveSrc(this.src)&&(this._setLoading(!1),this._setLoaded(!0),this._setError(!1))},_imgOnError:function(){this.$.img.src===this._resolveSrc(this.src)&&(this.$.img.removeAttribute("src"),this.$.sizedImgDiv.style.backgroundImage="",this._setLoading(!1),this._setLoaded(!1),this._setError(!0))},_computePlaceholderHidden:function(){return!this.preload||!this.fade&&!this.loading&&this.loaded},_computePlaceholderClassName:function(){return this.preload&&this.fade&&!this.loading&&this.loaded?"faded-out":""},_computeImgDivHidden:function(){return!this.sizing},_computeImgDivARIAHidden:function(){return""===this.alt?"true":void 0},_computeImgDivARIALabel:function(){return null!==this.alt?this.alt:""===this.src?"":this._resolveSrc(this.src).replace(/[?|#].*/g,"").split("/").pop()},_computeImgHidden:function(){return!!this.sizing},_widthChanged:function(){this.style.width=isNaN(this.width)?this.width:this.width+"px"},_heightChanged:function(){this.style.height=isNaN(this.height)?this.height:this.height+"px"},_loadStateObserver:function(e,t){var r=this._resolveSrc(e);r!==this._resolvedSrc&&(this._resolvedSrc="",this.$.img.removeAttribute("src"),this.$.sizedImgDiv.style.backgroundImage="",""===e||t?(this._setLoading(!1),this._setLoaded(!1),this._setError(!1)):(this._resolvedSrc=r,this.$.img.src=this._resolvedSrc,this.$.sizedImgDiv.style.backgroundImage='url("'+this._resolvedSrc+'")',this._setLoading(!0),this._setLoaded(!1),this._setError(!1)))},_placeholderChanged:function(){this.$.placeholder.style.backgroundImage=this.placeholder?'url("'+this.placeholder+'")':""},_transformChanged:function(){var e=this.$.sizedImgDiv.style,t=this.$.placeholder.style;e.backgroundSize=t.backgroundSize=this.sizing,e.backgroundPosition=t.backgroundPosition=this.sizing?this.position:"",e.backgroundRepeat=t.backgroundRepeat=this.sizing?"no-repeat":""},_resolveSrc:function(e){var t=(0,l.Kk)(e,this.$.baseURIAnchor.href);return t.length>=2&&"/"===t[0]&&"/"!==t[1]&&(t=(location.origin||location.protocol+"//"+location.host)+t),t}})},52003:function(e,t,r){"use strict";function n(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(c){return void r(c)}s.done?t(l):Promise.resolve(l).then(n,i)}r.d(t,{F:function(){return i},C:function(){return o}});var i=function(){var e,t=(e=regeneratorRuntime.mark((function e(t,n){var i,o,s,l,c,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=u.length>2&&void 0!==u[2]&&u[2],t.parentNode){e.next=3;break}throw new Error("Cannot setup Leaflet map on disconnected element");case 3:return e.next=5,r.e(6085).then(r.t.bind(r,70208,23));case 5:if((o=e.sent.default).Icon.Default.imagePath="/static/images/leaflet/images/",!i){e.next=10;break}return e.next=10,r.e(7716).then(r.t.bind(r,27716,23));case 10:return s=o.map(t),(l=document.createElement("link")).setAttribute("href","/static/images/leaflet/leaflet.css"),l.setAttribute("rel","stylesheet"),t.parentNode.appendChild(l),s.setView([52.3731339,4.8903147],13),c=a(o,Boolean(n)).addTo(s),e.abrupt("return",[s,o,c]);case 18:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(i,o){var a=e.apply(t,r);function s(e){n(a,i,o,s,l,"next",e)}function l(e){n(a,i,o,s,l,"throw",e)}s(void 0)}))});return function(e,r){return t.apply(this,arguments)}}(),o=function(e,t,r,n){return t.removeLayer(r),(r=a(e,n)).addTo(t),r},a=function(e,t){return e.tileLayer("https://{s}.basemaps.cartocdn.com/".concat(t?"dark_all":"light_all","/{z}/{x}/{y}").concat(e.Browser.retina?"@2x.png":".png"),{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>, &copy; <a href="https://carto.com/attributions">CARTO</a>',subdomains:"abcd",minZoom:0,maxZoom:20})}},45841:function(e,t,r){"use strict";r.d(t,{V3:function(){return a},AD:function(){return s},nq:function(){return l},zt:function(){return c},$H:function(){return u},Bf:function(){return d},vp:function(){return f},fT:function(){return p},Pc:function(){return h}});var n,i=r(83849),o=r(38353),a=o.u,s=2143==r.j?o.Q:null,l="#9b9b9b",c=function(e){return e.callWS({type:"zone/list"})},u=function(e,t){return e.callWS(Object.assign({type:"zone/create"},t))},d=function(e,t,r){return e.callWS(Object.assign({type:"zone/update",zone_id:t},r))},f=function(e,t){return e.callWS({type:"zone/delete",zone_id:t})},p=function(e){n=e,(0,i.c)("/config/zone/new")},h=function(){var e=n;return n=void 0,e}},34266:function(e,t,r){"use strict";r.r(t);r(53918);var n,i,o,a=r(50424),s=r(55358),l=r(14516),c=r(47181),u=(r(31811),r(52003)),d=r(22311),f=r(91741),p=r(38346);r(73085),r(10983);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,t){return R(e)||function(e,t){var r=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(l){s=!0,i=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(e,t)||D(e,t)||x()}function y(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(c){return void r(c)}s.done?t(l):Promise.resolve(l).then(n,i)}function v(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=D(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function b(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=T(e);if(t){var i=T(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _(this,r)}}function _(e,t){return!t||"object"!==h(t)&&"function"!=typeof t?E(e):t}function E(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function O(){O=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(n){t.forEach((function(t){var i=t.placement;if(t.kind===n&&("static"===i||"prototype"===i)){var o="static"===i?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var n=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===n?void 0:n.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],n=[],i={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,i)}),this),e.forEach((function(e){if(!P(e))return r.push(e);var t=this.decorateElement(e,i);r.push(t.element),r.push.apply(r,t.extras),n.push.apply(n,t.finishers)}),this),!t)return{elements:r,finishers:n};var o=this.decorateConstructor(r,t);return n.push.apply(n,o.finishers),o.finishers=n,o},addElementPlacement:function(e,t,r){var n=t[e.placement];if(!r&&-1!==n.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");n.push(e.key)},decorateElement:function(e,t){for(var r=[],n=[],i=e.decorators,o=i.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,i[o])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&n.push(l.finisher);var c=l.extras;if(c){for(var u=0;u<c.length;u++)this.addElementPlacement(c[u],t);r.push.apply(r,c)}}return{element:e,finishers:n,extras:r}},decorateConstructor:function(e,t){for(var r=[],n=t.length-1;n>=0;n--){var i=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[n])(i)||i);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,R(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||D(t)||x()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var r=A(e.key),n=String(e.placement);if("static"!==n&&"prototype"!==n&&"own"!==n)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+n+'"');var i=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:n,descriptor:Object.assign({},i)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(i,"get","The property descriptor of a field descriptor"),this.disallowProperty(i,"set","The property descriptor of a field descriptor"),this.disallowProperty(i,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:C(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var r=C(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var n=(0,t[r])(e);if(void 0!==n){if("function"!=typeof n)throw new TypeError("Finishers must return a constructor.");e=n}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function z(e){var t,r=A(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var n={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(n.decorators=e.decorators),"field"===e.kind&&(n.initializer=e.value),n}function S(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function P(e){return e.decorators&&e.decorators.length}function j(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function C(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function A(e){var t=function(e,t){if("object"!==h(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===h(t)?t:String(t)}function x(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function D(e,t){if(e){if("string"==typeof e)return I(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?I(e,t):void 0}}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function R(e){if(Array.isArray(e))return e}function L(e,t,r){return(L="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=T(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,r,n){var i=O();if(n)for(var o=0;o<n.length;o++)i=n[o](i);var a=t((function(e){i.initializeInstanceElements(e,s.elements)}),r),s=i.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},n=0;n<e.length;n++){var i,o=e[n];if("method"===o.kind&&(i=t.find(r)))if(j(o.descriptor)||j(i.descriptor)){if(P(o)||P(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(P(o)){if(P(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}S(o,i)}else t.push(o)}return t}(a.d.map(z)),e);i.initializeClassElements(a.F,s.elements),i.runClassFinishers(a.F,s.finishers)}([(0,s.Mo)("ha-map")],(function(e,t){var r,l,c=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&k(e,t)}(n,t);var r=w(n);function n(){var t;g(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return t=r.call.apply(r,[this].concat(o)),e(E(t)),t}return n}(t);return{F:c,d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)()],key:"entities",value:void 0},{kind:"field",decorators:[(0,s.Cb)()],key:"darkMode",value:void 0},{kind:"field",decorators:[(0,s.Cb)()],key:"zoom",value:void 0},{kind:"field",key:"Leaflet",value:void 0},{kind:"field",key:"_leafletMap",value:void 0},{kind:"field",key:"_tileLayer",value:void 0},{kind:"field",key:"_resizeObserver",value:void 0},{kind:"field",key:"_debouncedResizeListener",value:function(){var e=this;return(0,p.D)((function(){e._leafletMap&&e._leafletMap.invalidateSize()}),100,!1)}},{kind:"field",key:"_mapItems",value:function(){return[]}},{kind:"field",key:"_mapZones",value:function(){return[]}},{kind:"field",key:"_connected",value:function(){return!1}},{kind:"method",key:"connectedCallback",value:function(){L(T(c.prototype),"connectedCallback",this).call(this),this._connected=!0,this.hasUpdated&&(this.loadMap(),this._attachObserver())}},{kind:"method",key:"disconnectedCallback",value:function(){L(T(c.prototype),"disconnectedCallback",this).call(this),this._connected=!1,this._leafletMap&&(this._leafletMap.remove(),this._leafletMap=void 0,this.Leaflet=void 0),this._resizeObserver?this._resizeObserver.unobserve(this._mapEl):window.removeEventListener("resize",this._debouncedResizeListener)}},{kind:"method",key:"render",value:function(){return this.entities?(0,a.dy)(i||(i=b([' <div id="map"></div> ']))):(0,a.dy)(n||(n=b([""])))}},{kind:"method",key:"firstUpdated",value:function(e){L(T(c.prototype),"firstUpdated",this).call(this,e),this.loadMap(),this._connected&&this._attachObserver()}},{kind:"method",key:"shouldUpdate",value:function(e){if(!e.has("hass")||e.size>1)return!0;var t=e.get("hass");if(!t||!this.entities)return!0;var r,n=v(this.entities);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(t.states[i]!==this.hass.states[i])return!0}}catch(o){n.e(o)}finally{n.f()}return!1}},{kind:"method",key:"updated",value:function(e){if(e.has("hass")){this._drawEntities(),this._fitMap();var t=e.get("hass");if(!t||t.themes.darkMode===this.hass.themes.darkMode)return;if(!this.Leaflet||!this._leafletMap||!this._tileLayer)return;this._tileLayer=(0,u.C)(this.Leaflet,this._leafletMap,this._tileLayer,this.hass.themes.darkMode)}}},{kind:"get",key:"_mapEl",value:function(){return this.shadowRoot.getElementById("map")}},{kind:"method",key:"loadMap",value:(r=regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,u.F)(this._mapEl,null!==(t=this.darkMode)&&void 0!==t?t:this.hass.themes.darkMode);case 2:r=e.sent,n=m(r,3),this._leafletMap=n[0],this.Leaflet=n[1],this._tileLayer=n[2],this._drawEntities(),this._leafletMap.invalidateSize(),this._fitMap();case 10:case"end":return e.stop()}}),e,this)})),l=function(){var e=this,t=arguments;return new Promise((function(n,i){var o=r.apply(e,t);function a(e){y(o,n,i,a,s,"next",e)}function s(e){y(o,n,i,a,s,"throw",e)}a(void 0)}))},function(){return l.apply(this,arguments)})},{kind:"method",key:"_fitMap",value:function(){if(this._leafletMap&&this.Leaflet&&this.hass)if(0!==this._mapItems.length){var e=this.Leaflet.latLngBounds(this._mapItems?this._mapItems.map((function(e){return e.getLatLng()})):[]);this._leafletMap.fitBounds(e.pad(.5)),this.zoom&&this._leafletMap.getZoom()>this.zoom&&this._leafletMap.setZoom(this.zoom)}else this._leafletMap.setView(new this.Leaflet.LatLng(this.hass.config.latitude,this.hass.config.longitude),this.zoom||14)}},{kind:"method",key:"_drawEntities",value:function(){var e=this.hass,t=this._leafletMap,r=this.Leaflet;if(e&&t&&r){this._mapItems&&this._mapItems.forEach((function(e){return e.remove()}));var n=this._mapItems=[];this._mapZones&&this._mapZones.forEach((function(e){return e.remove()}));var i,o=this._mapZones=[],a=v(this.entities.concat());try{for(a.s();!(i=a.n()).done;){var s=i.value,l=e.states[s];if(l){var c=(0,f.C)(l),u=l.attributes,p=u.latitude,h=u.longitude,m=u.passive,y=u.icon,b=u.radius,g=u.entity_picture,k=u.gps_accuracy;if(p&&h)if("zone"!==(0,d.N)(l)){var w=c.split(" ").map((function(e){return e[0]})).join("").substr(0,3);n.push(r.marker([p,h],{icon:r.divIcon({html:'\n <ha-entity-marker\n entity-id="'.concat(s,'"\n entity-name="').concat(w,'"\n entity-picture="').concat(g||"",'"\n ></ha-entity-marker>\n '),iconSize:[48,48],className:""}),title:(0,f.C)(l)})),k&&n.push(r.circle([p,h],{interactive:!1,color:"#0288D1",radius:k}))}else{var _;if(m)continue;var E="";if(y){var O=document.createElement("ha-icon");O.setAttribute("icon",y),E=O.outerHTML}else{var z=document.createElement("span");z.innerHTML=c,E=z.outerHTML}o.push(r.marker([p,h],{icon:r.divIcon({html:E,iconSize:[24,24],className:(null!==(_=this.darkMode)&&void 0!==_?_:this.hass.themes.darkMode)?"dark":"light"}),interactive:!1,title:c})),o.push(r.circle([p,h],{interactive:!1,color:"#FF9800",radius:b}))}}}}catch(S){a.e(S)}finally{a.f()}this._mapItems.forEach((function(e){return t.addLayer(e)})),this._mapZones.forEach((function(e){return t.addLayer(e)}))}}},{kind:"method",key:"_attachObserver",value:function(){var e=this;"function"==typeof ResizeObserver?(this._resizeObserver=new ResizeObserver((function(){return e._debouncedResizeListener()})),this._resizeObserver.observe(this._mapEl)):window.addEventListener("resize",this._debouncedResizeListener)}},{kind:"get",static:!0,key:"styles",value:function(){return(0,a.iv)(o||(o=b(["\n :host {\n display: block;\n height: 300px;\n }\n #map {\n height: 100%;\n }\n #map.dark {\n background: #090909;\n }\n\n .dark {\n color: #ffffff;\n }\n\n .light {\n color: #000000;\n }\n "])))}}]}}),a.oi);var M,$,F,B,N,H=r(45841);function Z(e){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function W(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V(e,t){return(V=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function q(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=G(e);if(t){var i=G(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return K(this,r)}}function K(e,t){return!t||"object"!==Z(t)&&"function"!=typeof t?Q(e):t}function Q(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function G(e){return(G=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(){J=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(n){t.forEach((function(t){var i=t.placement;if(t.kind===n&&("static"===i||"prototype"===i)){var o="static"===i?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var n=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===n?void 0:n.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],n=[],i={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,i)}),this),e.forEach((function(e){if(!ee(e))return r.push(e);var t=this.decorateElement(e,i);r.push(t.element),r.push.apply(r,t.extras),n.push.apply(n,t.finishers)}),this),!t)return{elements:r,finishers:n};var o=this.decorateConstructor(r,t);return n.push.apply(n,o.finishers),o.finishers=n,o},addElementPlacement:function(e,t,r){var n=t[e.placement];if(!r&&-1!==n.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");n.push(e.key)},decorateElement:function(e,t){for(var r=[],n=[],i=e.decorators,o=i.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,i[o])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&n.push(l.finisher);var c=l.extras;if(c){for(var u=0;u<c.length;u++)this.addElementPlacement(c[u],t);r.push.apply(r,c)}}return{element:e,finishers:n,extras:r}},decorateConstructor:function(e,t){for(var r=[],n=t.length-1;n>=0;n--){var i=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[n])(i)||i);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return ie(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ie(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var r=ne(e.key),n=String(e.placement);if("static"!==n&&"prototype"!==n&&"own"!==n)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+n+'"');var i=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:n,descriptor:Object.assign({},i)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(i,"get","The property descriptor of a field descriptor"),this.disallowProperty(i,"set","The property descriptor of a field descriptor"),this.disallowProperty(i,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:re(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var r=re(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var n=(0,t[r])(e);if(void 0!==n){if("function"!=typeof n)throw new TypeError("Finishers must return a constructor.");e=n}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function X(e){var t,r=ne(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var n={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(n.decorators=e.decorators),"field"===e.kind&&(n.initializer=e.value),n}function Y(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function ee(e){return e.decorators&&e.decorators.length}function te(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function re(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function ne(e){var t=function(e,t){if("object"!==Z(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Z(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Z(t)?t:String(t)}function ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}!function(e,t,r,n){var i=J();if(n)for(var o=0;o<n.length;o++)i=n[o](i);var a=t((function(e){i.initializeInstanceElements(e,s.elements)}),r),s=i.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},n=0;n<e.length;n++){var i,o=e[n];if("method"===o.kind&&(i=t.find(r)))if(te(o.descriptor)||te(i.descriptor)){if(ee(o)||ee(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(ee(o)){if(ee(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}Y(o,i)}else t.push(o)}return t}(a.d.map(X)),e);i.initializeClassElements(a.F,s.elements),i.runClassFinishers(a.F,s.finishers)}([(0,s.Mo)("more-info-person")],(function(e,t){return{F:function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&V(e,t)}(n,t);var r=q(n);function n(){var t;W(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return t=r.call.apply(r,[this].concat(o)),e(Q(t)),t}return n}(t),d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)()],key:"stateObj",value:void 0},{kind:"field",key:"_entityArray",value:function(){return(0,l.Z)((function(e){return[e]}))}},{kind:"method",key:"render",value:function(){var e;return this.hass&&this.stateObj?(0,a.dy)($||($=U(["\n <ha-attributes\n .hass=","\n .stateObj=",'\n extra-filters="id,user_id,editable"\n ></ha-attributes>\n ',"\n ","\n "])),this.hass,this.stateObj,this.stateObj.attributes.latitude&&this.stateObj.attributes.longitude?(0,a.dy)(F||(F=U(["\n <ha-map\n .hass=","\n .entities=","\n ></ha-map>\n "])),this.hass,this._entityArray(this.stateObj.entity_id)):"",null!==(e=this.hass.user)&&void 0!==e&&e.is_admin&&"not_home"===this.stateObj.state&&this.stateObj.attributes.latitude&&this.stateObj.attributes.longitude?(0,a.dy)(B||(B=U(['\n <div class="actions">\n <mwc-button @click=',">\n ","\n </mwc-button>\n </div>\n "])),this._handleAction,this.hass.localize("ui.dialogs.more_info_control.person.create_zone")):""):(0,a.dy)(M||(M=U([""])))}},{kind:"method",key:"_handleAction",value:function(){(0,H.fT)({latitude:this.stateObj.attributes.latitude,longitude:this.stateObj.attributes.longitude}),(0,c.B)(this,"hass-more-info",{entityId:null})}},{kind:"get",static:!0,key:"styles",value:function(){return(0,a.iv)(N||(N=U(["\n .flex {\n display: flex;\n justify-content: space-between;\n }\n .actions {\n margin: 8px 0;\n text-align: right;\n }\n ha-map {\n margin-top: 16px;\n }\n "])))}}]}}),a.oi)},73085:function(e,t,r){"use strict";r(44285);var n,i=r(50856),o=r(28426);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,r){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p(e);if(t){var i=p(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f(this,r)}}function f(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(f,e);var t,r,o,a=d(f);function f(){return s(this,f),a.apply(this,arguments)}return t=f,o=[{key:"template",get:function(){return(0,i.d)(n||(e=['\n <style include="iron-positioning"></style>\n <style>\n .marker {\n position: relative;\n display: block;\n margin: 0 auto;\n width: 2.5em;\n text-align: center;\n height: 2.5em;\n line-height: 2.5em;\n font-size: 1.5em;\n border-radius: 50%;\n border: 0.1em solid var(--ha-marker-color, var(--primary-color));\n color: var(--primary-text-color);\n background-color: var(--card-background-color);\n }\n iron-image {\n border-radius: 50%;\n }\n </style>\n\n <div class="marker" style$="border-color:{{entityColor}}">\n <template is="dom-if" if="[[entityName]]">[[entityName]]</template>\n <template is="dom-if" if="[[entityPicture]]">\n <iron-image\n sizing="cover"\n class="fit"\n src="[[entityPicture]]"\n ></iron-image>\n </template>\n </div>\n '],t||(t=e.slice(0)),n=Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))));var e,t}},{key:"properties",get:function(){return{hass:{type:Object},entityId:{type:String,value:""},entityName:{type:String,value:null},entityPicture:{type:String,value:null},entityColor:{type:String,value:null}}}}],(r=[{key:"ready",value:function(){var e=this;c(p(f.prototype),"ready",this).call(this),this.addEventListener("click",(function(t){return e.badgeTap(t)}))}},{key:"badgeTap",value:function(e){e.stopPropagation(),this.entityId&&this.fire("hass-more-info",{entityId:this.entityId})}}])&&l(t.prototype,r),o&&l(t,o),f}((0,r(11052).I)(o.H3));customElements.define("ha-entity-marker",h)}}]); //# sourceMappingURL=chunk.ffff5d65447416a05d62.js.map