From a955f3db088acdd021782a892c315d412cb4e1f5 Mon Sep 17 00:00:00 2001 From: pavoni Date: Tue, 2 Feb 2016 19:25:17 +0000 Subject: [PATCH 01/85] WIP commit - template state working, on / off still to do. --- homeassistant/components/switch/template.py | 156 ++++++++++++++++ tests/components/switch/test_template.py | 188 ++++++++++++++++++++ 2 files changed, 344 insertions(+) create mode 100644 homeassistant/components/switch/template.py create mode 100644 tests/components/switch/test_template.py diff --git a/homeassistant/components/switch/template.py b/homeassistant/components/switch/template.py new file mode 100644 index 00000000000..170df067e57 --- /dev/null +++ b/homeassistant/components/switch/template.py @@ -0,0 +1,156 @@ +""" +homeassistant.components.switch.template +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Allows the creation of a switch that integrates other components together + +For more details about this platform, please refer to the documentation at +https://home-assistant.io/components/switch.template/ +""" +import logging + +from homeassistant.helpers.entity import generate_entity_id + +from homeassistant.components.switch import SwitchDevice + +from homeassistant.core import EVENT_STATE_CHANGED +from homeassistant.const import ( + ATTR_FRIENDLY_NAME, + CONF_VALUE_TEMPLATE) + +from homeassistant.util import template, slugify +from homeassistant.exceptions import TemplateError + +from homeassistant.components.switch import DOMAIN + +ENTITY_ID_FORMAT = DOMAIN + '.{}' + +_LOGGER = logging.getLogger(__name__) + +CONF_SWITCHES = 'switches' + +STATE_ERROR = 'error' + +ON_ACTION = 'turn_on' +OFF_ACTION = 'turn_off' + + +# pylint: disable=unused-argument +def setup_platform(hass, config, add_devices, discovery_info=None): + """ Sets up the switches. """ + + switches = [] + if config.get(CONF_SWITCHES) is None: + _LOGGER.error("Missing configuration data for switch platform") + return False + + for device, device_config in config[CONF_SWITCHES].items(): + + if device != slugify(device): + _LOGGER.error("Found invalid key for switch.template: %s. " + "Use %s instead", device, slugify(device)) + continue + + if not isinstance(device_config, dict): + _LOGGER.error("Missing configuration data for switch %s", device) + continue + + friendly_name = device_config.get(ATTR_FRIENDLY_NAME, device) + state_template = device_config.get(CONF_VALUE_TEMPLATE) + on_action = device_config.get(ON_ACTION) + off_action = device_config.get(OFF_ACTION) + if state_template is None: + _LOGGER.error( + "Missing %s for switch %s", CONF_VALUE_TEMPLATE, device) + continue + + if on_action is None or off_action is None: + _LOGGER.error( + "Missing action for switch %s", device) + continue + + switches.append( + SwitchTemplate( + hass, + device, + friendly_name, + state_template, + on_action, + off_action) + ) + if not switches: + _LOGGER.error("No switches added") + return False + add_devices(switches) + return True + + +class SwitchTemplate(SwitchDevice): + """ Represents a Template Switch. """ + + # pylint: disable=too-many-arguments + def __init__(self, + hass, + device_id, + friendly_name, + state_template, + on_action, + off_action): + + self.entity_id = generate_entity_id( + ENTITY_ID_FORMAT, device_id, + hass=hass) + + self.hass = hass + self._name = friendly_name + self._template = state_template + self._on_action = on_action + self._off_action = off_action + self.update() + + def _update_callback(_event): + """ Called when the target device changes state. """ + # This can be called before the entity is properly + # initialised, so check before updating state, + if self.entity_id: + self.update_ha_state(True) + + self.hass.bus.listen(EVENT_STATE_CHANGED, _update_callback) + + @property + def name(self): + """ Returns the name of the device. """ + return self._name + + @property + def state(self): + """ Returns the state of the device. """ + return self._state + + @property + def should_poll(self): + """ Tells Home Assistant not to poll this entity. """ + return False + + def turn_on(self, **kwargs): + _LOGGER.error("TURN ON not implemented yet") + + def turn_off(self, **kwargs): + _LOGGER.error("TURN OFF not implemented yet") + + @property + def should_poll(self): + """ Tells Home Assistant not to poll this entity. """ + return False + + @property + def is_on(self): + """ True if device is on. """ + _LOGGER.error("IS ON CALLED %s", self._state) + return self._state == STATE_ON + + def update(self): + try: + self._state = template.render(self.hass, self._template) + except TemplateError as ex: + self._state = STATE_ERROR + _LOGGER.error(ex) diff --git a/tests/components/switch/test_template.py b/tests/components/switch/test_template.py new file mode 100644 index 00000000000..3dc93c41bf2 --- /dev/null +++ b/tests/components/switch/test_template.py @@ -0,0 +1,188 @@ +""" +tests.components.switch.template +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Tests template switch. +""" + +import homeassistant.core as ha +import homeassistant.components.switch as switch + + +class TestTemplateSwitch: + """ Test the Template switch. """ + + def setup_method(self, method): + self.hass = ha.HomeAssistant() + + def teardown_method(self, method): + """ Stop down stuff we started. """ + self.hass.stop() + + def test_template_state(self): + assert switch.setup(self.hass, { + 'switch': { + 'platform': 'template', + 'switches': { + 'test_template_switch': { + 'value_template': + "{{ states.switch.test_state.state }}", + 'turn_on': { + 'service': 'switch.turn_on', + 'entity_id': 'switch.test_state' + }, + 'turn_off': { + 'service': 'switch.turn_off', + 'entity_id': 'switch.test_state' + }, + } + } + } + }) + + + state = self.hass.states.set('switch.test_state', 'On') + self.hass.pool.block_till_done() + + state = self.hass.states.get('switch.test_template_switch') + assert state.state == 'On' + + state = self.hass.states.set('switch.test_state', 'Off') + self.hass.pool.block_till_done() + + state = self.hass.states.get('switch.test_template_switch') + assert state.state == 'Off' + + + def test_template_syntax_error(self): + assert switch.setup(self.hass, { + 'switch': { + 'platform': 'template', + 'switches': { + 'test_template_switch': { + 'value_template': + "{% if rubbish %}", + 'turn_on': { + 'service': 'switch.turn_on', + 'entity_id': 'switch.test_state' + }, + 'turn_off': { + 'service': 'switch.turn_off', + 'entity_id': 'switch.test_state' + }, + } + } + } + }) + + state = self.hass.states.set('switch.test_state', 'On') + self.hass.pool.block_till_done() + state = self.hass.states.get('switch.test_template_switch') + assert state.state == 'error' + + def test_invalid_name_does_not_create(self): + assert switch.setup(self.hass, { + 'switch': { + 'platform': 'template', + 'switches': { + 'test INVALID switch': { + 'value_template': + "{{ rubbish }", + 'turn_on': { + 'service': 'switch.turn_on', + 'entity_id': 'switch.test_state' + }, + 'turn_off': { + 'service': 'switch.turn_off', + 'entity_id': 'switch.test_state' + }, + } + } + } + }) + assert self.hass.states.all() == [] + + def test_invalid_switch_does_not_create(self): + assert switch.setup(self.hass, { + 'switch': { + 'platform': 'template', + 'switches': { + 'test_template_switch': 'Invalid' + } + } + }) + assert self.hass.states.all() == [] + + def test_no_switches_does_not_create(self): + assert switch.setup(self.hass, { + 'switch': { + 'platform': 'template' + } + }) + assert self.hass.states.all() == [] + + def test_missing_template_does_not_create(self): + assert switch.setup(self.hass, { + 'switch': { + 'platform': 'template', + 'switches': { + 'test_template_switch': { + 'not_value_template': + "{{ states.switch.test_state.state }}", + 'turn_on': { + 'service': 'switch.turn_on', + 'entity_id': 'switch.test_state' + }, + 'turn_off': { + 'service': 'switch.turn_off', + 'entity_id': 'switch.test_state' + }, + } + } + } + }) + assert self.hass.states.all() == [] + + def test_missing_on_does_not_create(self): + assert switch.setup(self.hass, { + 'switch': { + 'platform': 'template', + 'switches': { + 'test_template_switch': { + 'value_template': + "{{ states.switch.test_state.state }}", + 'not_on': { + 'service': 'switch.turn_on', + 'entity_id': 'switch.test_state' + }, + 'turn_off': { + 'service': 'switch.turn_off', + 'entity_id': 'switch.test_state' + }, + } + } + } + }) + assert self.hass.states.all() == [] + + def test_missing_off_does_not_create(self): + assert switch.setup(self.hass, { + 'switch': { + 'platform': 'template', + 'switches': { + 'test_template_switch': { + 'value_template': + "{{ states.switch.test_state.state }}", + 'turn_on': { + 'service': 'switch.turn_on', + 'entity_id': 'switch.test_state' + }, + 'not_off': { + 'service': 'switch.turn_off', + 'entity_id': 'switch.test_state' + }, + } + } + } + }) + assert self.hass.states.all() == [] From 9a9dbcfaeaf5d77b7ef33531d165e90eac1b6abb Mon Sep 17 00:00:00 2001 From: pavoni Date: Wed, 3 Feb 2016 13:16:13 +0000 Subject: [PATCH 02/85] Refactor, support template logic values, add tests. --- homeassistant/components/switch/template.py | 32 +++++++---- tests/components/switch/test_template.py | 64 +++++++++++++++++++-- 2 files changed, 78 insertions(+), 18 deletions(-) diff --git a/homeassistant/components/switch/template.py b/homeassistant/components/switch/template.py index 170df067e57..1747df37d56 100644 --- a/homeassistant/components/switch/template.py +++ b/homeassistant/components/switch/template.py @@ -14,6 +14,8 @@ from homeassistant.components.switch import SwitchDevice from homeassistant.core import EVENT_STATE_CHANGED from homeassistant.const import ( + STATE_ON, + STATE_OFF, ATTR_FRIENDLY_NAME, CONF_VALUE_TEMPLATE) @@ -33,6 +35,8 @@ STATE_ERROR = 'error' ON_ACTION = 'turn_on' OFF_ACTION = 'turn_off' +STATE_TRUE = 'True' +STATE_FALSE = 'False' # pylint: disable=unused-argument def setup_platform(hass, config, add_devices, discovery_info=None): @@ -116,16 +120,12 @@ class SwitchTemplate(SwitchDevice): self.hass.bus.listen(EVENT_STATE_CHANGED, _update_callback) + @property def name(self): """ Returns the name of the device. """ return self._name - @property - def state(self): - """ Returns the state of the device. """ - return self._state - @property def should_poll(self): """ Tells Home Assistant not to poll this entity. """ @@ -137,16 +137,24 @@ class SwitchTemplate(SwitchDevice): def turn_off(self, **kwargs): _LOGGER.error("TURN OFF not implemented yet") - @property - def should_poll(self): - """ Tells Home Assistant not to poll this entity. """ - return False - @property def is_on(self): """ True if device is on. """ - _LOGGER.error("IS ON CALLED %s", self._state) - return self._state == STATE_ON + return self._state == STATE_TRUE or self._state == STATE_ON + + @property + def is_off(self): + """ True if device is on. """ + return self._state == STATE_FALSE or self._state == STATE_OFF + + @property + def state(self): + """ Returns the state. """ + if self.is_on: + return STATE_ON + if self.is_off: + return STATE_OFF + return self._state def update(self): try: diff --git a/tests/components/switch/test_template.py b/tests/components/switch/test_template.py index 3dc93c41bf2..1f9de0fdd3a 100644 --- a/tests/components/switch/test_template.py +++ b/tests/components/switch/test_template.py @@ -8,6 +8,10 @@ Tests template switch. import homeassistant.core as ha import homeassistant.components.switch as switch +from homeassistant.const import ( + STATE_ON, + STATE_OFF) + class TestTemplateSwitch: """ Test the Template switch. """ @@ -19,7 +23,7 @@ class TestTemplateSwitch: """ Stop down stuff we started. """ self.hass.stop() - def test_template_state(self): + def test_template_state_text(self): assert switch.setup(self.hass, { 'switch': { 'platform': 'template', @@ -41,19 +45,67 @@ class TestTemplateSwitch: }) - state = self.hass.states.set('switch.test_state', 'On') + state = self.hass.states.set('switch.test_state', STATE_ON) self.hass.pool.block_till_done() state = self.hass.states.get('switch.test_template_switch') - assert state.state == 'On' + assert state.state == STATE_ON - state = self.hass.states.set('switch.test_state', 'Off') + state = self.hass.states.set('switch.test_state', STATE_OFF) self.hass.pool.block_till_done() state = self.hass.states.get('switch.test_template_switch') - assert state.state == 'Off' + assert state.state == STATE_OFF + def test_template_state_boolean_on(self): + assert switch.setup(self.hass, { + 'switch': { + 'platform': 'template', + 'switches': { + 'test_template_switch': { + 'value_template': + "{{ 1 == 1 }}", + 'turn_on': { + 'service': 'switch.turn_on', + 'entity_id': 'switch.test_state' + }, + 'turn_off': { + 'service': 'switch.turn_off', + 'entity_id': 'switch.test_state' + }, + } + } + } + }) + + state = self.hass.states.get('switch.test_template_switch') + assert state.state == STATE_ON + + def test_template_state_boolean_off(self): + assert switch.setup(self.hass, { + 'switch': { + 'platform': 'template', + 'switches': { + 'test_template_switch': { + 'value_template': + "{{ 1 == 2 }}", + 'turn_on': { + 'service': 'switch.turn_on', + 'entity_id': 'switch.test_state' + }, + 'turn_off': { + 'service': 'switch.turn_off', + 'entity_id': 'switch.test_state' + }, + } + } + } + }) + + state = self.hass.states.get('switch.test_template_switch') + assert state.state == STATE_OFF + def test_template_syntax_error(self): assert switch.setup(self.hass, { 'switch': { @@ -75,7 +127,7 @@ class TestTemplateSwitch: } }) - state = self.hass.states.set('switch.test_state', 'On') + state = self.hass.states.set('switch.test_state', STATE_ON) self.hass.pool.block_till_done() state = self.hass.states.get('switch.test_template_switch') assert state.state == 'error' From 5521096c027aac63737d7c366584dd6c8dbb4149 Mon Sep 17 00:00:00 2001 From: pavoni Date: Wed, 3 Feb 2016 14:29:25 +0000 Subject: [PATCH 03/85] Add actions. --- homeassistant/components/switch/template.py | 7 +- tests/components/switch/test_template.py | 71 +++++++++++++++++++++ 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/switch/template.py b/homeassistant/components/switch/template.py index 1747df37d56..53b4e36055c 100644 --- a/homeassistant/components/switch/template.py +++ b/homeassistant/components/switch/template.py @@ -19,7 +19,10 @@ from homeassistant.const import ( ATTR_FRIENDLY_NAME, CONF_VALUE_TEMPLATE) +from homeassistant.helpers.service import call_from_config + from homeassistant.util import template, slugify + from homeassistant.exceptions import TemplateError from homeassistant.components.switch import DOMAIN @@ -132,10 +135,10 @@ class SwitchTemplate(SwitchDevice): return False def turn_on(self, **kwargs): - _LOGGER.error("TURN ON not implemented yet") + call_from_config(self.hass, self._on_action, True) def turn_off(self, **kwargs): - _LOGGER.error("TURN OFF not implemented yet") + call_from_config(self.hass, self._off_action, True) @property def is_on(self): diff --git a/tests/components/switch/test_template.py b/tests/components/switch/test_template.py index 1f9de0fdd3a..108f9a24f85 100644 --- a/tests/components/switch/test_template.py +++ b/tests/components/switch/test_template.py @@ -6,6 +6,7 @@ Tests template switch. """ import homeassistant.core as ha +import homeassistant.components as core import homeassistant.components.switch as switch from homeassistant.const import ( @@ -19,6 +20,14 @@ class TestTemplateSwitch: def setup_method(self, method): self.hass = ha.HomeAssistant() + self.calls = [] + + def record_call(service): + self.calls.append(service) + + self.hass.services.register('test', 'automation', record_call) + + def teardown_method(self, method): """ Stop down stuff we started. """ self.hass.stop() @@ -238,3 +247,65 @@ class TestTemplateSwitch: } }) assert self.hass.states.all() == [] + + def test_on_action(self): + assert switch.setup(self.hass, { + 'switch': { + 'platform': 'template', + 'switches': { + 'test_template_switch': { + 'value_template': + "{{ states.switch.test_state.state }}", + 'turn_on': { + 'service': 'test.automation' + }, + 'turn_off': { + 'service': 'switch.turn_off', + 'entity_id': 'switch.test_state' + }, + } + } + } + }) + self.hass.states.set('switch.test_state', STATE_OFF) + self.hass.pool.block_till_done() + + state = self.hass.states.get('switch.test_template_switch') + assert state.state == STATE_OFF + + core.switch.turn_on(self.hass, 'switch.test_template_switch') + self.hass.pool.block_till_done() + + assert 1 == len(self.calls) + + + def test_off_action(self): + assert switch.setup(self.hass, { + 'switch': { + 'platform': 'template', + 'switches': { + 'test_template_switch': { + 'value_template': + "{{ states.switch.test_state.state }}", + 'turn_on': { + 'service': 'switch.turn_on', + 'entity_id': 'switch.test_state' + + }, + 'turn_off': { + 'service': 'test.automation' + }, + } + } + } + }) + self.hass.states.set('switch.test_state', STATE_ON) + self.hass.pool.block_till_done() + + state = self.hass.states.get('switch.test_template_switch') + assert state.state == STATE_ON + + core.switch.turn_off(self.hass, 'switch.test_template_switch') + self.hass.pool.block_till_done() + + assert 1 == len(self.calls) From 6e6c3c5cd56cd3a75f054b52db0b8b2c57410a82 Mon Sep 17 00:00:00 2001 From: pavoni Date: Wed, 3 Feb 2016 14:30:58 +0000 Subject: [PATCH 04/85] Tidy. --- homeassistant/components/switch/template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/switch/template.py b/homeassistant/components/switch/template.py index 53b4e36055c..9e231de0299 100644 --- a/homeassistant/components/switch/template.py +++ b/homeassistant/components/switch/template.py @@ -41,6 +41,7 @@ OFF_ACTION = 'turn_off' STATE_TRUE = 'True' STATE_FALSE = 'False' + # pylint: disable=unused-argument def setup_platform(hass, config, add_devices, discovery_info=None): """ Sets up the switches. """ @@ -123,7 +124,6 @@ class SwitchTemplate(SwitchDevice): self.hass.bus.listen(EVENT_STATE_CHANGED, _update_callback) - @property def name(self): """ Returns the name of the device. """ From b20d3f8b3af41a233262175fbdc593be0fb61d9c Mon Sep 17 00:00:00 2001 From: pavoni Date: Wed, 3 Feb 2016 23:23:19 +0000 Subject: [PATCH 05/85] Update docstrings. --- homeassistant/components/switch/template.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/switch/template.py b/homeassistant/components/switch/template.py index 9e231de0299..34524978c84 100644 --- a/homeassistant/components/switch/template.py +++ b/homeassistant/components/switch/template.py @@ -135,9 +135,11 @@ class SwitchTemplate(SwitchDevice): return False def turn_on(self, **kwargs): + """ Fires the on action. """ call_from_config(self.hass, self._on_action, True) def turn_off(self, **kwargs): + """ Fires the off action. """ call_from_config(self.hass, self._off_action, True) @property @@ -147,7 +149,7 @@ class SwitchTemplate(SwitchDevice): @property def is_off(self): - """ True if device is on. """ + """ True if device is off. """ return self._state == STATE_FALSE or self._state == STATE_OFF @property @@ -160,6 +162,7 @@ class SwitchTemplate(SwitchDevice): return self._state def update(self): + """ Updates the state from the template. """ try: self._state = template.render(self.hass, self._template) except TemplateError as ex: From ced380f0cda0566110c6e89eeeba84dcff71dbea Mon Sep 17 00:00:00 2001 From: pavoni Date: Thu, 4 Feb 2016 17:24:38 +0000 Subject: [PATCH 06/85] Remove unneeded entity_id check and blank lines. --- homeassistant/components/sensor/template.py | 5 +---- homeassistant/components/switch/template.py | 8 +------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/sensor/template.py b/homeassistant/components/sensor/template.py index b87e26aa415..6ed4a0256e5 100644 --- a/homeassistant/components/sensor/template.py +++ b/homeassistant/components/sensor/template.py @@ -94,10 +94,7 @@ class SensorTemplate(Entity): def _update_callback(_event): """ Called when the target device changes state. """ - # This can be called before the entity is properly - # initialised, so check before updating state, - if self.entity_id: - self.update_ha_state(True) + self.update_ha_state(True) self.hass.bus.listen(EVENT_STATE_CHANGED, _update_callback) diff --git a/homeassistant/components/switch/template.py b/homeassistant/components/switch/template.py index 34524978c84..12a53ccbcc2 100644 --- a/homeassistant/components/switch/template.py +++ b/homeassistant/components/switch/template.py @@ -20,11 +20,8 @@ from homeassistant.const import ( CONF_VALUE_TEMPLATE) from homeassistant.helpers.service import call_from_config - from homeassistant.util import template, slugify - from homeassistant.exceptions import TemplateError - from homeassistant.components.switch import DOMAIN ENTITY_ID_FORMAT = DOMAIN + '.{}' @@ -117,10 +114,7 @@ class SwitchTemplate(SwitchDevice): def _update_callback(_event): """ Called when the target device changes state. """ - # This can be called before the entity is properly - # initialised, so check before updating state, - if self.entity_id: - self.update_ha_state(True) + self.update_ha_state(True) self.hass.bus.listen(EVENT_STATE_CHANGED, _update_callback) From fc3741911c636b4fedc9c14f75e2f52298b39eb3 Mon Sep 17 00:00:00 2001 From: Philip Lundrigan Date: Wed, 3 Feb 2016 14:54:41 -0700 Subject: [PATCH 07/85] Fix problem with field type conflict in influxdb --- homeassistant/components/influxdb.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/influxdb.py b/homeassistant/components/influxdb.py index 99b5be37556..ab8a2d76e94 100644 --- a/homeassistant/components/influxdb.py +++ b/homeassistant/components/influxdb.py @@ -70,25 +70,22 @@ def setup(hass, config): """ Listen for new messages on the bus and sends them to Influx. """ state = event.data.get('new_state') - - if state is None: + if state is None or state.state in (STATE_UNKNOWN, ''): return if state.state in (STATE_ON, STATE_LOCKED, STATE_ABOVE_HORIZON): _state = 1 - elif state.state in (STATE_OFF, STATE_UNLOCKED, STATE_UNKNOWN, - STATE_BELOW_HORIZON): + elif state.state in (STATE_OFF, STATE_UNLOCKED, STATE_BELOW_HORIZON): _state = 0 else: - _state = state.state - if _state == '': - return try: - _state = float(_state) + _state = float(state.state) except ValueError: - pass + _state = state.state - measurement = state.attributes.get('unit_of_measurement', state.domain) + measurement = state.attributes.get('unit_of_measurement') + if measurement in (None, ''): + measurement = '{}.{}'.format(state.domain, state.object_id) json_body = [ { From c580953bd87132df09867e169d1662a9d778bf7e Mon Sep 17 00:00:00 2001 From: Philip Lundrigan Date: Wed, 3 Feb 2016 16:54:01 -0700 Subject: [PATCH 08/85] Fix MQTT sensor --- homeassistant/components/sensor/mqtt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/sensor/mqtt.py b/homeassistant/components/sensor/mqtt.py index 8cf2569acd5..032462430e0 100644 --- a/homeassistant/components/sensor/mqtt.py +++ b/homeassistant/components/sensor/mqtt.py @@ -7,7 +7,7 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.mqtt/ """ import logging -from homeassistant.const import CONF_VALUE_TEMPLATE +from homeassistant.const import CONF_VALUE_TEMPLATE, STATE_UNKNOWN from homeassistant.helpers.entity import Entity from homeassistant.util import template import homeassistant.components.mqtt as mqtt @@ -42,7 +42,7 @@ class MqttSensor(Entity): """ Represents a sensor that can be updated using MQTT. """ def __init__(self, hass, name, state_topic, qos, unit_of_measurement, value_template): - self._state = "-" + self._state = STATE_UNKNOWN self._hass = hass self._name = name self._state_topic = state_topic From 8be9aaba4f06668fba96e194d0db6b8ebf8ceff3 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 4 Feb 2016 21:36:37 -0800 Subject: [PATCH 09/85] Fix Chromecast discovery --- homeassistant/components/media_player/cast.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/media_player/cast.py b/homeassistant/components/media_player/cast.py index 6b012fe6fbd..4039c95c7fc 100644 --- a/homeassistant/components/media_player/cast.py +++ b/homeassistant/components/media_player/cast.py @@ -56,8 +56,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None): hosts = [(config[CONF_HOST], DEFAULT_PORT)] else: - hosts = [host for host in pychromecast.discover_chromecasts() - if host not in KNOWN_HOSTS] + hosts = [tuple(dev[:2]) for dev in pychromecast.discover_chromecasts() + if tuple(dev[:2]) not in KNOWN_HOSTS] casts = [] From 2622cf2e5352c52085bd68a4cdb39ab9086d5d10 Mon Sep 17 00:00:00 2001 From: pavoni Date: Fri, 5 Feb 2016 11:18:50 +0000 Subject: [PATCH 10/85] Use available, remove state, improve true,false tests. --- homeassistant/components/switch/template.py | 26 ++++++++++----------- tests/components/switch/test_template.py | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/homeassistant/components/switch/template.py b/homeassistant/components/switch/template.py index 12a53ccbcc2..589768db9bd 100644 --- a/homeassistant/components/switch/template.py +++ b/homeassistant/components/switch/template.py @@ -35,9 +35,6 @@ STATE_ERROR = 'error' ON_ACTION = 'turn_on' OFF_ACTION = 'turn_off' -STATE_TRUE = 'True' -STATE_FALSE = 'False' - # pylint: disable=unused-argument def setup_platform(hass, config, add_devices, discovery_info=None): @@ -139,26 +136,27 @@ class SwitchTemplate(SwitchDevice): @property def is_on(self): """ True if device is on. """ - return self._state == STATE_TRUE or self._state == STATE_ON + return self._value.lower() == 'true' or self._value == STATE_ON @property def is_off(self): """ True if device is off. """ - return self._state == STATE_FALSE or self._state == STATE_OFF + return self._value.lower() == 'false' or self._value == STATE_OFF @property - def state(self): - """ Returns the state. """ - if self.is_on: - return STATE_ON - if self.is_off: - return STATE_OFF - return self._state + def available(self): + """Return True if entity is available.""" + return self.is_on or self.is_off def update(self): """ Updates the state from the template. """ try: - self._state = template.render(self.hass, self._template) + self._value = template.render(self.hass, self._template) + if not self.available: + _LOGGER.error( + "`%s` is not a switch state, setting %s to unavailable", + self._value, self.entity_id) + except TemplateError as ex: - self._state = STATE_ERROR + self._value = STATE_ERROR _LOGGER.error(ex) diff --git a/tests/components/switch/test_template.py b/tests/components/switch/test_template.py index 108f9a24f85..aeffe9ff194 100644 --- a/tests/components/switch/test_template.py +++ b/tests/components/switch/test_template.py @@ -139,7 +139,7 @@ class TestTemplateSwitch: state = self.hass.states.set('switch.test_state', STATE_ON) self.hass.pool.block_till_done() state = self.hass.states.get('switch.test_template_switch') - assert state.state == 'error' + assert state.state == 'unavailable' def test_invalid_name_does_not_create(self): assert switch.setup(self.hass, { From 4cf85294dbaba1704fe86b507f9b69aae234e753 Mon Sep 17 00:00:00 2001 From: Flyte Date: Fri, 5 Feb 2016 21:47:27 +0000 Subject: [PATCH 11/85] Add template support to mqtt.publish service payload. --- homeassistant/components/mqtt/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index 2701ccad314..b2e62f720e5 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -131,7 +131,7 @@ def setup(hass, config): def publish_service(call): """Handle MQTT publish service calls.""" msg_topic = call.data.get(ATTR_TOPIC) - payload = call.data.get(ATTR_PAYLOAD) + payload = util.template.render(hass, call.data.get(ATTR_PAYLOAD)) qos = call.data.get(ATTR_QOS, DEFAULT_QOS) retain = call.data.get(ATTR_RETAIN, DEFAULT_RETAIN) if msg_topic is None or payload is None: From b6a32098d1e9b89d166d1be62ead0ecc7e1fdf03 Mon Sep 17 00:00:00 2001 From: Harald Nagel Date: Thu, 4 Feb 2016 20:01:45 +0000 Subject: [PATCH 12/85] Add BloomSky weather station support --- .coveragerc | 3 + homeassistant/components/bloomsky.py | 79 +++++++++++++++ homeassistant/components/camera/bloomsky.py | 60 +++++++++++ homeassistant/components/sensor/bloomsky.py | 104 ++++++++++++++++++++ 4 files changed, 246 insertions(+) create mode 100644 homeassistant/components/bloomsky.py create mode 100644 homeassistant/components/camera/bloomsky.py create mode 100644 homeassistant/components/sensor/bloomsky.py diff --git a/.coveragerc b/.coveragerc index 2fdaa9dff5f..54968d53ed6 100644 --- a/.coveragerc +++ b/.coveragerc @@ -10,6 +10,9 @@ omit = homeassistant/components/arduino.py homeassistant/components/*/arduino.py + homeassistant/components/bloomsky.py + homeassistant/components/*/bloomsky.py + homeassistant/components/insteon_hub.py homeassistant/components/*/insteon_hub.py diff --git a/homeassistant/components/bloomsky.py b/homeassistant/components/bloomsky.py new file mode 100644 index 00000000000..4ec820502b4 --- /dev/null +++ b/homeassistant/components/bloomsky.py @@ -0,0 +1,79 @@ +""" +homeassistant.components.bloomsky +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Support for BloomSky weather station. + +For more details about this component, please refer to the documentation at +https://home-assistant.io/components/bloomsky/ +""" +import logging +from datetime import timedelta +import requests +from homeassistant.util import Throttle +from homeassistant.helpers import validate_config +from homeassistant.const import CONF_API_KEY + +DOMAIN = "bloomsky" +BLOOMSKY = None + +_LOGGER = logging.getLogger(__name__) + +# the BloomSky only updates every 5-8 minutes as per the API spec so there's +# no point in polling the API more frequently +MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=300) + + +# pylint: disable=unused-argument,too-few-public-methods +def setup(hass, config): + """ + Setup BloomSky component. + """ + if not validate_config( + config, + {DOMAIN: [CONF_API_KEY]}, + _LOGGER): + return False + + api_key = config[DOMAIN][CONF_API_KEY] + + global BLOOMSKY + try: + BLOOMSKY = BloomSky(api_key) + except RuntimeError: + return False + + return True + + +class BloomSky(object): + """Handle all communication with the BloomSky API""" + + # API documentation at http://weatherlution.com/bloomsky-api/ + + API_URL = "https://api.bloomsky.com/api/skydata" + + def __init__(self, api_key): + self._api_key = api_key + self.devices = {} + _LOGGER.debug("Initial bloomsky device load...") + self.refresh_devices() + + @Throttle(MIN_TIME_BETWEEN_UPDATES) + def refresh_devices(self): + """ + Uses the API to retreive a list of devices associated with an + account along with all the sensors on the device. + """ + _LOGGER.debug("Fetching bloomsky update") + response = requests.get(self.API_URL, + headers={"Authorization": self._api_key}, + timeout=10) + if response.status_code == 401: + raise RuntimeError("Invalid API_KEY") + elif response.status_code != 200: + _LOGGER.error("Invalid HTTP response: %s", response.status_code) + return + # create dictionary keyed off of the device unique id + self.devices.update({ + device["DeviceID"]: device for device in response.json() + }) diff --git a/homeassistant/components/camera/bloomsky.py b/homeassistant/components/camera/bloomsky.py new file mode 100644 index 00000000000..c57338b9976 --- /dev/null +++ b/homeassistant/components/camera/bloomsky.py @@ -0,0 +1,60 @@ +""" +homeassistant.components.sensor.bloomsky +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Support for BloomSky weather station. + +For more details about this component, please refer to the documentation at +https://home-assistant.io/components/bloomsky/ +""" +import logging +import requests +import homeassistant.components.bloomsky as bloomsky +from homeassistant.components.camera import Camera + +DEPENDENCIES = ["bloomsky"] + + +# pylint: disable=unused-argument +def setup_platform(hass, config, add_devices_callback, discovery_info=None): + """ set up access to BloomSky cameras """ + for device in bloomsky.BLOOMSKY.devices.values(): + add_devices_callback([BloomSkyCamera(bloomsky.BLOOMSKY, device)]) + + +class BloomSkyCamera(Camera): + """ Represents the images published from the BloomSky's camera """ + + def __init__(self, bs, device): + """ set up for access to the BloomSky camera images """ + super(BloomSkyCamera, self).__init__() + self._name = device["DeviceName"] + self._id = device["DeviceID"] + self._bloomsky = bs + self._url = "" + self._last_url = "" + # _last_image will store images as they are downloaded so that the + # frequent updates in home-assistant don't keep poking the server + # to download the same image over and over + self._last_image = "" + self._logger = logging.getLogger(__name__) + + def camera_image(self): + """ update the camera's image if it has changed """ + try: + self._url = self._bloomsky.devices[self._id]["Data"]["ImageURL"] + self._bloomsky.refresh_devices() + # if the url hasn't changed then the image hasn't changed + if self._url != self._last_url: + response = requests.get(self._url, timeout=10) + self._last_url = self._url + self._last_image = response.content + except requests.exceptions.RequestException as error: + self._logger.error("Error getting bloomsky image: %s", error) + return None + + return self._last_image + + @property + def name(self): + """ the name of this BloomSky device """ + return self._name diff --git a/homeassistant/components/sensor/bloomsky.py b/homeassistant/components/sensor/bloomsky.py new file mode 100644 index 00000000000..58a1e5a9799 --- /dev/null +++ b/homeassistant/components/sensor/bloomsky.py @@ -0,0 +1,104 @@ +""" +homeassistant.components.sensor.bloomsky +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Support for BloomSky weather station. + +For more details about this component, please refer to the documentation at +https://home-assistant.io/components/bloomsky/ +""" +import logging +import homeassistant.components.bloomsky as bloomsky +from homeassistant.helpers.entity import Entity + +DEPENDENCIES = ["bloomsky"] + +# these are the available sensors +SENSOR_TYPES = ["Temperature", + "Humidity", + "Rain", + "Pressure", + "Luminance", + "Night", + "UVIndex"] + +# sensor units - these do not currently align with the API documentation +SENSOR_UNITS = {"Temperature": "°F", + "Humidity": "%", + "Pressure": "inHg", + "Luminance": "cd/m²"} + +# which sensors to format numerically +FORMAT_NUMBERS = ["Temperature", "Pressure"] + + +# pylint: disable=unused-argument +def setup_platform(hass, config, add_devices, discovery_info=None): + """ Set up the available BloomSky weather sensors """ + + logger = logging.getLogger(__name__) + + for device_key in bloomsky.BLOOMSKY.devices: + device = bloomsky.BLOOMSKY.devices[device_key] + for variable in config["monitored_conditions"]: + if variable in SENSOR_TYPES: + add_devices([BloomSkySensor(bloomsky.BLOOMSKY, + device, + variable)]) + else: + logger.error("Cannot find definition for device: %s", variable) + + +class BloomSkySensor(Entity): + """ Represents a single sensor in a BloomSky device """ + + def __init__(self, bs, device, sensor_name): + self._bloomsky = bs + self._device_id = device["DeviceID"] + self._client_name = device["DeviceName"] + self._sensor_name = sensor_name + self._state = self.process_state(device) + self._sensor_update = "" + + @property + def name(self): + """ the name of the BloomSky device and this sensor """ + return "{} {}".format(self._client_name, self._sensor_name) + + @property + def state(self): + """ the current state (i.e. value) of this sensor """ + return self._state + + @property + def unit_of_measurement(self): + """ this sensor's units """ + return SENSOR_UNITS.get(self._sensor_name, None) + + def update(self): + """ request an update from the BloomSky API """ + self._bloomsky.refresh_devices() + # TS is a Unix epoch timestamp for the last time the BloomSky servers + # heard from this device. If that value hasn't changed, the value has + # not been updated. + last_ts = self._bloomsky.devices[self._device_id]["Data"]["TS"] + if last_ts != self._sensor_update: + self.process_state(self._bloomsky.devices[self._device_id]) + self._sensor_update = last_ts + + def process_state(self, device): + """ handle the response from the BloomSky API for this sensor""" + data = device["Data"][self._sensor_name] + if self._sensor_name == "Rain": + if data: + self._state = "Raining" + else: + self._state = "Not raining" + elif self._sensor_name == "Night": + if data: + self._state = "Nighttime" + else: + self._state = "Daytime" + elif self._sensor_name in FORMAT_NUMBERS: + self._state = "{0:.2f}".format(data) + else: + self._state = data From 614034d196790047e5164e20c9ecb3c2cef1d3bd Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 6 Feb 2016 08:23:30 +0100 Subject: [PATCH 13/85] Update docstrings --- homeassistant/components/bloomsky.py | 8 +++---- homeassistant/components/camera/bloomsky.py | 14 ++++++------ homeassistant/components/sensor/bloomsky.py | 24 ++++++++++----------- homeassistant/components/splunk.py | 3 +++ 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/homeassistant/components/bloomsky.py b/homeassistant/components/bloomsky.py index 4ec820502b4..fe2ae1cf3ba 100644 --- a/homeassistant/components/bloomsky.py +++ b/homeassistant/components/bloomsky.py @@ -18,16 +18,14 @@ BLOOMSKY = None _LOGGER = logging.getLogger(__name__) -# the BloomSky only updates every 5-8 minutes as per the API spec so there's +# The BloomSky only updates every 5-8 minutes as per the API spec so there's # no point in polling the API more frequently MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=300) # pylint: disable=unused-argument,too-few-public-methods def setup(hass, config): - """ - Setup BloomSky component. - """ + """ Setup BloomSky component. """ if not validate_config( config, {DOMAIN: [CONF_API_KEY]}, @@ -46,7 +44,7 @@ def setup(hass, config): class BloomSky(object): - """Handle all communication with the BloomSky API""" + """ Handle all communication with the BloomSky API. """ # API documentation at http://weatherlution.com/bloomsky-api/ diff --git a/homeassistant/components/camera/bloomsky.py b/homeassistant/components/camera/bloomsky.py index c57338b9976..5c9314963bd 100644 --- a/homeassistant/components/camera/bloomsky.py +++ b/homeassistant/components/camera/bloomsky.py @@ -1,10 +1,10 @@ """ -homeassistant.components.sensor.bloomsky -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Support for BloomSky weather station. +homeassistant.components.camera.bloomsky +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Support for a camera of a BloomSky weather station. For more details about this component, please refer to the documentation at -https://home-assistant.io/components/bloomsky/ +https://home-assistant.io/components/camera.bloomsky/ """ import logging import requests @@ -22,7 +22,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None): class BloomSkyCamera(Camera): - """ Represents the images published from the BloomSky's camera """ + """ Represents the images published from the BloomSky's camera. """ def __init__(self, bs, device): """ set up for access to the BloomSky camera images """ @@ -39,7 +39,7 @@ class BloomSkyCamera(Camera): self._logger = logging.getLogger(__name__) def camera_image(self): - """ update the camera's image if it has changed """ + """ Update the camera's image if it has changed. """ try: self._url = self._bloomsky.devices[self._id]["Data"]["ImageURL"] self._bloomsky.refresh_devices() @@ -56,5 +56,5 @@ class BloomSkyCamera(Camera): @property def name(self): - """ the name of this BloomSky device """ + """ The name of this BloomSky device. """ return self._name diff --git a/homeassistant/components/sensor/bloomsky.py b/homeassistant/components/sensor/bloomsky.py index 58a1e5a9799..3a6ad04b076 100644 --- a/homeassistant/components/sensor/bloomsky.py +++ b/homeassistant/components/sensor/bloomsky.py @@ -1,10 +1,10 @@ """ homeassistant.components.sensor.bloomsky ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Support for BloomSky weather station. +Support the sensor of a BloomSky weather station. For more details about this component, please refer to the documentation at -https://home-assistant.io/components/bloomsky/ +https://home-assistant.io/components/sensor.bloomsky/ """ import logging import homeassistant.components.bloomsky as bloomsky @@ -12,7 +12,7 @@ from homeassistant.helpers.entity import Entity DEPENDENCIES = ["bloomsky"] -# these are the available sensors +# These are the available sensors SENSOR_TYPES = ["Temperature", "Humidity", "Rain", @@ -21,19 +21,19 @@ SENSOR_TYPES = ["Temperature", "Night", "UVIndex"] -# sensor units - these do not currently align with the API documentation +# Sensor units - these do not currently align with the API documentation SENSOR_UNITS = {"Temperature": "°F", "Humidity": "%", "Pressure": "inHg", "Luminance": "cd/m²"} -# which sensors to format numerically +# Which sensors to format numerically FORMAT_NUMBERS = ["Temperature", "Pressure"] # pylint: disable=unused-argument def setup_platform(hass, config, add_devices, discovery_info=None): - """ Set up the available BloomSky weather sensors """ + """ Set up the available BloomSky weather sensors. """ logger = logging.getLogger(__name__) @@ -49,7 +49,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): class BloomSkySensor(Entity): - """ Represents a single sensor in a BloomSky device """ + """ Represents a single sensor in a BloomSky device. """ def __init__(self, bs, device, sensor_name): self._bloomsky = bs @@ -61,21 +61,21 @@ class BloomSkySensor(Entity): @property def name(self): - """ the name of the BloomSky device and this sensor """ + """ The name of the BloomSky device and this sensor. """ return "{} {}".format(self._client_name, self._sensor_name) @property def state(self): - """ the current state (i.e. value) of this sensor """ + """ The current state (i.e. value) of this sensor. """ return self._state @property def unit_of_measurement(self): - """ this sensor's units """ + """ This sensor's units. """ return SENSOR_UNITS.get(self._sensor_name, None) def update(self): - """ request an update from the BloomSky API """ + """ Request an update from the BloomSky API. """ self._bloomsky.refresh_devices() # TS is a Unix epoch timestamp for the last time the BloomSky servers # heard from this device. If that value hasn't changed, the value has @@ -86,7 +86,7 @@ class BloomSkySensor(Entity): self._sensor_update = last_ts def process_state(self, device): - """ handle the response from the BloomSky API for this sensor""" + """ Handle the response from the BloomSky API for this sensor. """ data = device["Data"][self._sensor_name] if self._sensor_name == "Rain": if data: diff --git a/homeassistant/components/splunk.py b/homeassistant/components/splunk.py index 0a030ab8398..f936326b734 100644 --- a/homeassistant/components/splunk.py +++ b/homeassistant/components/splunk.py @@ -3,6 +3,9 @@ homeassistant.components.splunk ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Splunk component which allows you to send data to an Splunk instance utilizing the HTTP Event Collector. + +For more details about this component, please refer to the documentation at +https://home-assistant.io/components/splunk/ """ import json import logging From b700ec4faa4772c2363b4639f393c3b63923cdb8 Mon Sep 17 00:00:00 2001 From: MartinHjelmare Date: Sat, 6 Feb 2016 09:18:12 +0100 Subject: [PATCH 14/85] Fix mysensors version errors * The application of the version check in unit_of_measurement was messed up after the last refactor. Fix that again. * An error could occur in device_state_attributes if there was a mismatch between used value_type in the device and mysensors version in config. Add try... except to handle that. --- homeassistant/components/sensor/mysensors.py | 13 ++++++++----- homeassistant/components/switch/mysensors.py | 8 +++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/sensor/mysensors.py b/homeassistant/components/sensor/mysensors.py index f45fa1d0384..87d99adbd4b 100644 --- a/homeassistant/components/sensor/mysensors.py +++ b/homeassistant/components/sensor/mysensors.py @@ -151,23 +151,26 @@ class MySensorsSensor(Entity): self.gateway.const.SetReq.V_VOLTAGE: 'V', self.gateway.const.SetReq.V_CURRENT: 'A', } - unit_map_v15 = { - self.gateway.const.SetReq.V_PERCENTAGE: '%', - } if float(self.gateway.version) >= 1.5: if self.gateway.const.SetReq.V_UNIT_PREFIX in self._values: return self._values[ self.gateway.const.SetReq.V_UNIT_PREFIX] - unit_map.update(unit_map_v15) + unit_map.update({self.gateway.const.SetReq.V_PERCENTAGE: '%'}) return unit_map.get(self.value_type) @property def device_state_attributes(self): """Return device specific state attributes.""" + set_req = self.gateway.const.SetReq device_attr = {} for value_type, value in self._values.items(): if value_type != self.value_type: - device_attr[self.gateway.const.SetReq(value_type).name] = value + try: + device_attr[set_req(value_type).name] = value + except ValueError: + _LOGGER.error('value_type %s is not valid for mysensors ' + 'version %s', value_type, + self.gateway.version) return device_attr @property diff --git a/homeassistant/components/switch/mysensors.py b/homeassistant/components/switch/mysensors.py index a0355a96ff9..13cdc023248 100644 --- a/homeassistant/components/switch/mysensors.py +++ b/homeassistant/components/switch/mysensors.py @@ -100,10 +100,16 @@ class MySensorsSwitch(SwitchDevice): @property def device_state_attributes(self): """Return device specific state attributes.""" + set_req = self.gateway.const.SetReq device_attr = {} for value_type, value in self._values.items(): if value_type != self.value_type: - device_attr[self.gateway.const.SetReq(value_type).name] = value + try: + device_attr[set_req(value_type).name] = value + except ValueError: + _LOGGER.error('value_type %s is not valid for mysensors ' + 'version %s', value_type, + self.gateway.version) return device_attr @property From 11a2b8888b748b44004a2b0d4bbbbf06e95854d4 Mon Sep 17 00:00:00 2001 From: Ryan Kraus Date: Sat, 6 Feb 2016 09:48:36 -0500 Subject: [PATCH 15/85] Fixes for issue #1114 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Moved RESTART_EXIT_CODE to constants so it can safely be used by __main__.py. 2. Allowed __main__/main to return the desired exit code. 3. Forwarded the child processes exit code to the parent process to be duplicated. 4. Added —debug flag to pass command to force Home Assistant to run in only one process. A warning is printed to STDERR to indicate HASS is in debug mode. Another is printed if HASS requests a restart in debug mode. A restart request in debug mode will quit. 5. Added an argument to __main__/main/setup_and_run_hass to indicate that it is running in the top process. This tells it to return the exit code rather than exiting. --- homeassistant/__main__.py | 47 ++++++++++++++++++++++++++++++--------- homeassistant/const.py | 3 +++ homeassistant/core.py | 6 ++--- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index d7cfd0a2f00..64eca13356a 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -10,7 +10,8 @@ import argparse from homeassistant import bootstrap import homeassistant.config as config_util -from homeassistant.const import __version__, EVENT_HOMEASSISTANT_START +from homeassistant.const import (__version__, EVENT_HOMEASSISTANT_START, + RESTART_EXIT_CODE) def validate_python(): @@ -76,6 +77,11 @@ def get_arguments(): '--demo-mode', action='store_true', help='Start Home Assistant in demo mode') + parser.add_argument( + '--debug', + action='store_true', + help='Start Home Assistant in debug mode. Runs in single process to ' + 'enable use of interactive debuggers.') parser.add_argument( '--open-ui', action='store_true', @@ -207,8 +213,11 @@ def uninstall_osx(): print("Home Assistant has been uninstalled.") -def setup_and_run_hass(config_dir, args): - """ Setup HASS and run. Block until stopped. """ +def setup_and_run_hass(config_dir, args, top_process=False): + """ + Setup HASS and run. Block until stopped. Will assume it is running in a + subprocess unless top_process is set to true. + """ if args.demo_mode: config = { 'frontend': {}, @@ -235,7 +244,11 @@ def setup_and_run_hass(config_dir, args): hass.bus.listen_once(EVENT_HOMEASSISTANT_START, open_browser) hass.start() - sys.exit(int(hass.block_till_stopped())) + exit_code = int(hass.block_till_stopped()) + + if not top_process: + sys.exit(exit_code) + return exit_code def run_hass_process(hass_proc): @@ -262,7 +275,10 @@ def run_hass_process(hass_proc): hass_proc.join() except KeyboardInterrupt: return False - return not requested_stop.isSet() and hass_proc.exitcode == 100 + + return (not requested_stop.isSet() and + hass_proc.exitcode == RESTART_EXIT_CODE, + hass_proc.exitcode) def main(): @@ -277,14 +293,14 @@ def main(): # os x launchd functions if args.install_osx: install_osx() - return + return 0 if args.uninstall_osx: uninstall_osx() - return + return 0 if args.restart_osx: uninstall_osx() install_osx() - return + return 0 # daemon functions if args.pid_file: @@ -294,12 +310,23 @@ def main(): if args.pid_file: write_pid(args.pid_file) + # Run hass in debug mode if requested + if args.debug: + sys.stderr.write('Running in debug mode. ' + 'Home Assistant will not be able to restart.\n') + exit_code = setup_and_run_hass(config_dir, args, top_process=True) + if exit_code == RESTART_EXIT_CODE: + sys.stderr.write('Home Assistant requested a ' + 'restart in debug mode.\n') + return exit_code + # Run hass as child process. Restart if necessary. keep_running = True while keep_running: hass_proc = Process(target=setup_and_run_hass, args=(config_dir, args)) - keep_running = run_hass_process(hass_proc) + keep_running, exit_code = run_hass_process(hass_proc) + return exit_code if __name__ == "__main__": - main() + sys.exit(main()) diff --git a/homeassistant/const.py b/homeassistant/const.py index cd711df44cd..42146895a01 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -197,3 +197,6 @@ HTTP_HEADER_EXPIRES = "Expires" CONTENT_TYPE_JSON = "application/json" CONTENT_TYPE_MULTIPART = 'multipart/x-mixed-replace; boundary={}' CONTENT_TYPE_TEXT_PLAIN = 'text/plain' + +# The exit code to send to request a restart +RESTART_EXIT_CODE = 100 diff --git a/homeassistant/core.py b/homeassistant/core.py index 936a068480f..c4dbd1562a5 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -20,7 +20,8 @@ from homeassistant.const import ( EVENT_TIME_CHANGED, EVENT_STATE_CHANGED, EVENT_CALL_SERVICE, ATTR_NOW, ATTR_DOMAIN, ATTR_SERVICE, MATCH_ALL, EVENT_SERVICE_EXECUTED, ATTR_SERVICE_CALL_ID, EVENT_SERVICE_REGISTERED, - TEMP_CELCIUS, TEMP_FAHRENHEIT, ATTR_FRIENDLY_NAME, ATTR_SERVICE_DATA) + TEMP_CELCIUS, TEMP_FAHRENHEIT, ATTR_FRIENDLY_NAME, ATTR_SERVICE_DATA, + RESTART_EXIT_CODE) from homeassistant.exceptions import ( HomeAssistantError, InvalidEntityFormatError) import homeassistant.util as util @@ -48,9 +49,6 @@ _LOGGER = logging.getLogger(__name__) # Temporary to support deprecated methods _MockHA = namedtuple("MockHomeAssistant", ['bus']) -# The exit code to send to request a restart -RESTART_EXIT_CODE = 100 - class HomeAssistant(object): """Root object of the Home Assistant home automation.""" From 062fe79b3f05e00dc2bb0ccbc20d6e7ef1c77b54 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Sat, 6 Feb 2016 04:09:46 +0000 Subject: [PATCH 16/85] Add Honeywell US thermostat support This adds support for the US variant of the Honeywell connected thermostat. The interface is super simple, so this doesn't add any external dependencies. It supports basic temperature, setpoint, and control. Issue #998 notes that the existing honeywell module doesn't work for US models, which is because they are totally different. In order to indicate to the honeywell platform module that the thermostat is a US-type, we key off of whether or not the thermostat id is provided. This is something that US people have (and require to identify one of potentially multiple thermostats in their account) and EU people will not. --- .../components/thermostat/honeywell.py | 151 ++++++++++++++++-- 1 file changed, 141 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/thermostat/honeywell.py b/homeassistant/components/thermostat/honeywell.py index 5475e1ce306..84c8813405b 100644 --- a/homeassistant/components/thermostat/honeywell.py +++ b/homeassistant/components/thermostat/honeywell.py @@ -9,33 +9,32 @@ https://home-assistant.io/components/thermostat.honeywell/ import logging import socket +import requests + from homeassistant.components.thermostat import ThermostatDevice -from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS) +from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS, + TEMP_FAHRENHEIT) REQUIREMENTS = ['evohomeclient==0.2.4'] _LOGGER = logging.getLogger(__name__) CONF_AWAY_TEMP = "away_temperature" +US_SYSTEM_SWITCH_POSITIONS = {1: 'Heat', + 2: 'Off', + 3: 'Cool'} +US_BASEURL = 'https://mytotalconnectcomfort.com/portal' -# pylint: disable=unused-argument -def setup_platform(hass, config, add_devices, discovery_info=None): - """ Sets up the honeywel thermostat. """ +def _setup_round(username, password, config, add_devices): from evohomeclient import EvohomeClient - username = config.get(CONF_USERNAME) - password = config.get(CONF_PASSWORD) try: away_temp = float(config.get(CONF_AWAY_TEMP, 16)) except ValueError: _LOGGER.error("value entered for item %s should convert to a number", CONF_AWAY_TEMP) return False - if username is None or password is None: - _LOGGER.error("Missing required configuration items %s or %s", - CONF_USERNAME, CONF_PASSWORD) - return False evo_api = EvohomeClient(username, password) @@ -53,6 +52,24 @@ def setup_platform(hass, config, add_devices, discovery_info=None): return False +# pylint: disable=unused-argument +def setup_platform(hass, config, add_devices, discovery_info=None): + """ Sets up the honeywel thermostat. """ + username = config.get(CONF_USERNAME) + password = config.get(CONF_PASSWORD) + thermostat_id = config.get('id') + + if username is None or password is None: + _LOGGER.error("Missing required configuration items %s or %s", + CONF_USERNAME, CONF_PASSWORD) + return False + + if thermostat_id: + add_devices([HoneywellUSThermostat(thermostat_id, username, password)]) + else: + return _setup_round(username, password, config, add_devices) + + class RoundThermostat(ThermostatDevice): """ Represents a Honeywell Round Connected thermostat. """ @@ -135,3 +152,117 @@ class RoundThermostat(ThermostatDevice): else: self._name = data['name'] self._is_dhw = False + + +class HoneywellUSThermostat(ThermostatDevice): + """ Represents a Honeywell US Thermostat. """ + + def __init__(self, ident, username, password): + self._ident = ident + self._username = username + self._password = password + self._session = requests.Session() + # Maybe this should be configurable? + self._timeout = 30 + # Yeah, really. + self._session.headers['X-Requested-With'] = 'XMLHttpRequest' + self._update() + + def _login(self): + self._session.get(US_BASEURL, timeout=self._timeout) + params = {'UserName': self._username, + 'Password': self._password, + 'RememberMe': 'false', + 'timeOffset': 480} + resp = self._session.post(US_BASEURL, params=params, + timeout=self._timeout) + if resp.status_code != 200: + _LOGGER('Login failed for user %(user)s', + dict(user=self._username)) + return False + else: + return True + + def _get_data(self): + if not self._login(): + return + url = '%s/Device/CheckDataSession/%s' % (US_BASEURL, self._ident) + resp = self._session.get(url, timeout=self._timeout) + if resp.status_code < 300: + return resp.json() + else: + return {'error': resp.status_code} + + def _set_data(self, data): + if not self._login(): + return + url = '%s/Device/SubmitControlScreenChanges' % US_BASEURL + data['DeviceID'] = self._ident + resp = self._session.post(url, data=data, timeout=self._timeout) + if resp.status_code < 300: + return resp.json() + else: + return {'error': resp.status_code} + + def _update(self): + self._data = self._get_data()['latestData'] + + @property + def is_fan_on(self): + return self._data['fanData']['fanIsRunning'] + + @property + def name(self): + return 'honeywell' + + @property + def unit_of_measurement(self): + unit = self._data['uiData']['DisplayUnits'] + if unit == 'F': + return TEMP_FAHRENHEIT + else: + return TEMP_CELCIUS + + @property + def current_temperature(self): + self._update() + return self._data['uiData']['DispTemperature'] + + @property + def target_temperature(self): + setpoint = US_SYSTEM_SWITCH_POSITIONS.get( + self._data['uiData']['SystemSwitchPosition'], + 'Off') + return self._data['uiData']['%sSetpoint' % setpoint] + + def set_temperature(self, temperature): + """ Set target temperature. """ + data = {'SystemSwitch': None, + 'HeatSetpoint': None, + 'CoolSetpoint': None, + 'HeatNextPeriod': None, + 'CoolNextPeriod': None, + 'StatusHeat': None, + 'StatusCool': None, + 'FanMode': None} + setpoint = US_SYSTEM_SWITCH_POSITIONS.get( + self._data['uiData']['SystemSwitchPosition'], + 'Off') + data['%sSetpoint' % setpoint] = temperature + self._set_data(data) + + @property + def device_state_attributes(self): + """ Return device specific state attributes. """ + fanmodes = {0: "auto", + 1: "on", + 2: "circulate"} + return {"fan": (self._data['fanData']['fanIsRunning'] and + 'running' or 'idle'), + "fanmode": fanmodes[self._data['fanData']['fanMode']]} + + def turn_away_mode_on(self): + pass + + def turn_away_mode_off(self): + pass From 6e69737e88b4d828a3c74362eede248b781f62c9 Mon Sep 17 00:00:00 2001 From: bradsk88 <7kcwKg60tdcW> Date: Sat, 6 Feb 2016 14:22:46 -0600 Subject: [PATCH 17/85] Updating to python-wink 0.5.0 Major bugfix. ``` get_bulbs ``` and similar methods were always returning empty lists. Better unit tests have been added to https://github.com/bradsk88/python-wink to avoid this regression. --- homeassistant/components/light/wink.py | 2 +- homeassistant/components/lock/wink.py | 2 +- homeassistant/components/sensor/wink.py | 2 +- homeassistant/components/switch/wink.py | 2 +- homeassistant/components/wink.py | 2 +- requirements_all.txt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/light/wink.py b/homeassistant/components/light/wink.py index f9cdfc432f9..9592db9c853 100644 --- a/homeassistant/components/light/wink.py +++ b/homeassistant/components/light/wink.py @@ -12,7 +12,7 @@ from homeassistant.components.light import ATTR_BRIGHTNESS from homeassistant.components.wink import WinkToggleDevice from homeassistant.const import CONF_ACCESS_TOKEN -REQUIREMENTS = ['python-wink==0.4.2'] +REQUIREMENTS = ['python-wink==0.5.0'] def setup_platform(hass, config, add_devices_callback, discovery_info=None): diff --git a/homeassistant/components/lock/wink.py b/homeassistant/components/lock/wink.py index a203a59bf69..9c73c35d130 100644 --- a/homeassistant/components/lock/wink.py +++ b/homeassistant/components/lock/wink.py @@ -11,7 +11,7 @@ import logging from homeassistant.components.lock import LockDevice from homeassistant.const import CONF_ACCESS_TOKEN -REQUIREMENTS = ['python-wink==0.4.2'] +REQUIREMENTS = ['python-wink==0.5.0'] def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/sensor/wink.py b/homeassistant/components/sensor/wink.py index f57f8fdc4cf..48583426d72 100644 --- a/homeassistant/components/sensor/wink.py +++ b/homeassistant/components/sensor/wink.py @@ -11,7 +11,7 @@ import logging from homeassistant.helpers.entity import Entity from homeassistant.const import CONF_ACCESS_TOKEN, STATE_OPEN, STATE_CLOSED -REQUIREMENTS = ['python-wink==0.4.2'] +REQUIREMENTS = ['python-wink==0.5.0'] def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/switch/wink.py b/homeassistant/components/switch/wink.py index 7858029e388..19abc1c4fce 100644 --- a/homeassistant/components/switch/wink.py +++ b/homeassistant/components/switch/wink.py @@ -11,7 +11,7 @@ import logging from homeassistant.components.wink import WinkToggleDevice from homeassistant.const import CONF_ACCESS_TOKEN -REQUIREMENTS = ['python-wink==0.4.2'] +REQUIREMENTS = ['python-wink==0.5.0'] def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/wink.py b/homeassistant/components/wink.py index 29a7a5537d1..0594ce598c1 100644 --- a/homeassistant/components/wink.py +++ b/homeassistant/components/wink.py @@ -16,7 +16,7 @@ from homeassistant.const import ( ATTR_SERVICE, ATTR_DISCOVERED, ATTR_FRIENDLY_NAME) DOMAIN = "wink" -REQUIREMENTS = ['python-wink==0.4.2'] +REQUIREMENTS = ['python-wink==0.5.0'] DISCOVER_LIGHTS = "wink.lights" DISCOVER_SWITCHES = "wink.switches" diff --git a/requirements_all.txt b/requirements_all.txt index 9e0e159a1d2..23a758240a5 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -188,7 +188,7 @@ python-twitch==1.2.0 # homeassistant.components.lock.wink # homeassistant.components.sensor.wink # homeassistant.components.switch.wink -python-wink==0.4.2 +python-wink==0.5.0 # homeassistant.components.keyboard pyuserinput==0.1.9 From 3616d7a7eaf3e17830bec66c13189bd69c238773 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Sat, 6 Feb 2016 20:30:39 +0000 Subject: [PATCH 18/85] Fix alarm service handler state updates This changes the service handler dispatch code to always call update_ha_state(), and cleans up the alarm platforms that were calling it themselves. --- homeassistant/components/alarm_control_panel/__init__.py | 2 ++ homeassistant/components/alarm_control_panel/alarmdotcom.py | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/alarm_control_panel/__init__.py b/homeassistant/components/alarm_control_panel/__init__.py index 3f5e6362fb6..310a65c6184 100644 --- a/homeassistant/components/alarm_control_panel/__init__.py +++ b/homeassistant/components/alarm_control_panel/__init__.py @@ -61,6 +61,8 @@ def setup(hass, config): for alarm in target_alarms: getattr(alarm, method)(code) + if alarm.should_poll: + alarm.update_ha_state(True) descriptions = load_yaml_config_file( os.path.join(os.path.dirname(__file__), 'services.yaml')) diff --git a/homeassistant/components/alarm_control_panel/alarmdotcom.py b/homeassistant/components/alarm_control_panel/alarmdotcom.py index f1b2fe76238..da74c02da54 100644 --- a/homeassistant/components/alarm_control_panel/alarmdotcom.py +++ b/homeassistant/components/alarm_control_panel/alarmdotcom.py @@ -90,7 +90,6 @@ class AlarmDotCom(alarm.AlarmControlPanel): # Open another session to alarm.com to fire off the command _alarm = Alarmdotcom(self._username, self._password, timeout=10) _alarm.disarm() - self.update_ha_state() def alarm_arm_home(self, code=None): """ Send arm home command. """ @@ -100,7 +99,6 @@ class AlarmDotCom(alarm.AlarmControlPanel): # Open another session to alarm.com to fire off the command _alarm = Alarmdotcom(self._username, self._password, timeout=10) _alarm.arm_stay() - self.update_ha_state() def alarm_arm_away(self, code=None): """ Send arm away command. """ @@ -110,7 +108,6 @@ class AlarmDotCom(alarm.AlarmControlPanel): # Open another session to alarm.com to fire off the command _alarm = Alarmdotcom(self._username, self._password, timeout=10) _alarm.arm_away() - self.update_ha_state() def _validate_code(self, code, state): """ Validate given code. """ From cab1100a51e64d1ede7fa3f4e192df2a7f31c9a1 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Sat, 6 Feb 2016 01:24:44 +0000 Subject: [PATCH 19/85] Add Ubiquiti Unifi Video Camera support This adds support for Ubiquiti's UniFi Video cameras via their NVR device (or service). By configuring just the address of the NVR and a valid API key, all cameras are discovered and enabled, including direct-to-camera image snapshot-based video support. --- homeassistant/components/camera/uvc.py | 110 +++++++++++++++++++++++++ requirements_all.txt | 3 + 2 files changed, 113 insertions(+) create mode 100644 homeassistant/components/camera/uvc.py diff --git a/homeassistant/components/camera/uvc.py b/homeassistant/components/camera/uvc.py new file mode 100644 index 00000000000..5185b302c00 --- /dev/null +++ b/homeassistant/components/camera/uvc.py @@ -0,0 +1,110 @@ +""" +Ubiquiti Unifi Video Cameras +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Support for Ubiquiti's UVC cameras + +Configuration: + +camera: + platform: uvc + nvr: ADDRESS + port: PORT + key: APIKEY + +Variable: + +nvr +*Required +ADDRESS should be the IP or hostname of the NVR server + +port +*Optional +PORT is the port number to use for accessing the NVR + +key +*Required +APIKEY should be the API key available from the NVR web interface +""" +import logging +import socket + +import requests + +from homeassistant.helpers import validate_config +from homeassistant.components.camera import DOMAIN, Camera + +REQUIREMENTS = ['uvcclient==0.5'] + +_LOGGER = logging.getLogger(__name__) + + +def setup_platform(hass, config, add_devices, discovery_info=None): + """ Discover cameras on a Unifi NVR. """ + if not validate_config({DOMAIN: config}, {DOMAIN: ['nvr', 'key']}, + _LOGGER): + return None + + addr = config.get('nvr') + port = int(config.get('port', 7080)) + key = config.get('key') + + from uvcclient import nvr + nvrconn = nvr.UVCRemote(addr, port, key) + try: + cameras = nvrconn.index() + except nvr.NotAuthorized: + _LOGGER.error('Authorization failure while connecting to NVR') + return False + except nvr.NvrError: + _LOGGER.error('NVR refuses to talk to me') + return False + except requests.exceptions.ConnectionError as ex: + _LOGGER.error('Unable to connect to NVR: %s', str(ex)) + return False + + for camera in cameras: + add_devices([UnifiVideoCamera(nvrconn, + camera['uuid'], + camera['name'])]) + + +class UnifiVideoCamera(Camera): + """ A Ubiquiti Unifi Video Camera. """ + + def __init__(self, nvr, uuid, name): + super(UnifiVideoCamera, self).__init__() + self._nvr = nvr + self._uuid = uuid + self._name = name + self.is_streaming = False + + @property + def name(self): + return self._name + + @property + def is_recording(self): + caminfo = self._nvr.get_camera(self._uuid) + return caminfo['recordingSettings']['fullTimeRecordEnabled'] + + def camera_image(self): + from uvcclient import camera as uvc_camera + + caminfo = self._nvr.get_camera(self._uuid) + camera = None + for addr in [caminfo['host'], caminfo['internalHost']]: + try: + camera = uvc_camera.UVCCameraClient(addr, + caminfo['username'], + 'ubnt') + _LOGGER.debug('Logged into UVC camera %(name)s via %(addr)s', + dict(name=self._name, addr=addr)) + except socket.error: + pass + + if not camera: + _LOGGER.error('Unable to login to camera') + return None + + camera.login() + return camera.get_snapshot() diff --git a/requirements_all.txt b/requirements_all.txt index 9e0e159a1d2..8697003b2c4 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -228,6 +228,9 @@ tellive-py==0.5.2 # homeassistant.components.switch.transmission transmissionrpc==0.11 +# homeassistant.components.camera.uvc +uvcclient==0.5 + # homeassistant.components.verisure vsure==0.5.0 From d773ad1ecbfc332b5af421c1b782887b5c00360e Mon Sep 17 00:00:00 2001 From: MartinHjelmare Date: Sat, 6 Feb 2016 09:18:12 +0100 Subject: [PATCH 20/85] Fix mysensors version errors * The application of the version check in unit_of_measurement was messed up after the last refactor. Fix that again. * An error could occur in device_state_attributes if there was a mismatch between used value_type in the device and mysensors version in config. Add try... except to handle that. Bump pyvera version. Bump pywemo version. Add unavailable status before properly initialised for maker and insight. --- homeassistant/components/light/vera.py | 2 +- homeassistant/components/sensor/vera.py | 2 +- homeassistant/components/switch/vera.py | 2 +- homeassistant/components/switch/wemo.py | 14 +++++++++++++- requirements_all.txt | 4 ++-- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/light/vera.py b/homeassistant/components/light/vera.py index 46b4e7c7da8..48e84e5cfb4 100644 --- a/homeassistant/components/light/vera.py +++ b/homeassistant/components/light/vera.py @@ -15,7 +15,7 @@ from homeassistant.components.light import ATTR_BRIGHTNESS from homeassistant.const import EVENT_HOMEASSISTANT_STOP, STATE_ON -REQUIREMENTS = ['pyvera==0.2.7'] +REQUIREMENTS = ['pyvera==0.2.8'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index c587764ae2e..fe003030e0c 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -15,7 +15,7 @@ from homeassistant.const import ( ATTR_BATTERY_LEVEL, ATTR_TRIPPED, ATTR_ARMED, ATTR_LAST_TRIP_TIME, TEMP_CELCIUS, TEMP_FAHRENHEIT, EVENT_HOMEASSISTANT_STOP) -REQUIREMENTS = ['pyvera==0.2.7'] +REQUIREMENTS = ['pyvera==0.2.8'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/switch/vera.py b/homeassistant/components/switch/vera.py index 3626175c03c..0655f29bbbf 100644 --- a/homeassistant/components/switch/vera.py +++ b/homeassistant/components/switch/vera.py @@ -21,7 +21,7 @@ from homeassistant.const import ( STATE_ON, STATE_OFF) -REQUIREMENTS = ['pyvera==0.2.7'] +REQUIREMENTS = ['pyvera==0.2.8'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/switch/wemo.py b/homeassistant/components/switch/wemo.py index d828e23464c..c6d92818466 100644 --- a/homeassistant/components/switch/wemo.py +++ b/homeassistant/components/switch/wemo.py @@ -12,7 +12,7 @@ from homeassistant.components.switch import SwitchDevice from homeassistant.const import ( STATE_ON, STATE_OFF, STATE_STANDBY, EVENT_HOMEASSISTANT_STOP) -REQUIREMENTS = ['pywemo==0.3.8'] +REQUIREMENTS = ['pywemo==0.3.9'] _LOGGER = logging.getLogger(__name__) _WEMO_SUBSCRIPTION_REGISTRY = None @@ -153,6 +153,18 @@ class WemoSwitch(SwitchDevice): """ True if switch is on. """ return self.wemo.get_state() + @property + def available(self): + """ True if switch is available. """ + if (self.wemo.model_name == 'Insight' and + self.insight_params is None): + return False + + if (self.wemo.model_name == 'Maker' and + self.maker_params is None): + return False + return True + def turn_on(self, **kwargs): """ Turns the switch on. """ self.wemo.on() diff --git a/requirements_all.txt b/requirements_all.txt index 23a758240a5..29baf410151 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -196,10 +196,10 @@ pyuserinput==0.1.9 # homeassistant.components.light.vera # homeassistant.components.sensor.vera # homeassistant.components.switch.vera -pyvera==0.2.7 +pyvera==0.2.8 # homeassistant.components.switch.wemo -pywemo==0.3.8 +pywemo==0.3.9 # homeassistant.components.thermostat.radiotherm radiotherm==1.2 From 7a00bf869652df90687f77e441e35a353e54296c Mon Sep 17 00:00:00 2001 From: Ryan Kraus Date: Sat, 6 Feb 2016 21:31:07 -0500 Subject: [PATCH 21/85] Fixed time zone conversion with no TZ specified Using .replace to set the current time zone appears to not handle things correctly. The proper way to do this is apparently .localize. --- homeassistant/util/dt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/util/dt.py b/homeassistant/util/dt.py index a2c796c20eb..604777399ec 100644 --- a/homeassistant/util/dt.py +++ b/homeassistant/util/dt.py @@ -48,7 +48,7 @@ def as_utc(dattim): if dattim.tzinfo == UTC: return dattim elif dattim.tzinfo is None: - dattim = dattim.replace(tzinfo=DEFAULT_TIME_ZONE) + dattim = DEFAULT_TIME_ZONE.localize(dattim) return dattim.astimezone(UTC) @@ -58,7 +58,7 @@ def as_local(dattim): if dattim.tzinfo == DEFAULT_TIME_ZONE: return dattim elif dattim.tzinfo is None: - dattim = dattim.replace(tzinfo=UTC) + dattim = UTC.localize(dattim) return dattim.astimezone(DEFAULT_TIME_ZONE) From a001780afb70466fe4386c881ef46a4ccaea7d37 Mon Sep 17 00:00:00 2001 From: Ryan Kraus Date: Sat, 6 Feb 2016 21:50:06 -0500 Subject: [PATCH 22/85] Fix Ctrl+C with Subprocesses Added KeyboardInterrupt handling back to block_till_stopped method. This is because Keyboard Interrupts are sent to both the parent and child process in no particular order so both need to handle the interrupt. --- homeassistant/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/core.py b/homeassistant/core.py index c4dbd1562a5..b9bf49f261c 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -95,7 +95,10 @@ class HomeAssistant(object): 'Could not bind to SIGTERM. Are you running in a thread?') while not request_shutdown.isSet(): - time.sleep(1) + try: + time.sleep(1) + except KeyboardInterrupt: + break self.stop() return RESTART_EXIT_CODE if request_restart.isSet() else 0 From a147304be9be58f1342425a2a68f5fbf07e2d0a3 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Sat, 6 Feb 2016 21:36:41 +0000 Subject: [PATCH 23/85] Add support for Ubiquiti mFi sensors This adds support for sensors based on Ubiquiti's mFi platform. All ports/sensors are detected from the mFi controller and exposed. --- .coveragerc | 1 + homeassistant/components/sensor/mfi.py | 108 +++++++++++++++++++++++++ requirements_all.txt | 3 + 3 files changed, 112 insertions(+) create mode 100644 homeassistant/components/sensor/mfi.py diff --git a/.coveragerc b/.coveragerc index 6401a1dad1e..792da89e4c6 100644 --- a/.coveragerc +++ b/.coveragerc @@ -121,6 +121,7 @@ omit = homeassistant/components/sensor/eliqonline.py homeassistant/components/sensor/forecast.py homeassistant/components/sensor/glances.py + homeassistant/components/sensor/mfi.py homeassistant/components/sensor/netatmo.py homeassistant/components/sensor/onewire.py homeassistant/components/sensor/openweathermap.py diff --git a/homeassistant/components/sensor/mfi.py b/homeassistant/components/sensor/mfi.py new file mode 100644 index 00000000000..8864809e1cb --- /dev/null +++ b/homeassistant/components/sensor/mfi.py @@ -0,0 +1,108 @@ +""" +homeassistant.components.sensor.mfi +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Support for Ubiquiti mFi Sensors. + +Configuration: + +sensor: + platform: mfi + host: ADDRESS + port: PORT + username: USERNAME + password: PASSWORD + +Variable: + +host +*Required +ADDRESS is the IP or hostname of your mFi controller. + +port +*Optional +PORT is the port of your mFi controller (usually 6443) + +username +*Required +USERNAME is the mFi admin username + +password +*Required +PASSWORD is the mFi admin user's password +""" + +import logging + +from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, + TEMP_CELCIUS) +from homeassistant.components.sensor import DOMAIN +from homeassistant.helpers.entity import Entity +from homeassistant.helpers import validate_config + +REQUIREMENTS = ['mficlient==0.2'] + +_LOGGER = logging.getLogger(__name__) + +SENSOR_MODELS = [ + 'Ubiquiti mFi-THS', + 'Ubiquiti mFi-CS', + 'Outlet', +] + + +# pylint: disable=unused-variable +def setup_platform(hass, config, add_devices, discovery_info=None): + """ Sets up mFi sensors. """ + + if not validate_config({DOMAIN: config}, + {DOMAIN: ['host', + CONF_USERNAME, + CONF_PASSWORD]}, + _LOGGER): + _LOGGER.error('A host, username, and password are required') + return False + + host = config.get('host') + port = int(config.get('port', 6443)) + username = config.get(CONF_USERNAME) + password = config.get(CONF_PASSWORD) + + from mficlient.client import MFiClient + + try: + client = MFiClient(host, username, password, port=port) + except client.FailedToLogin as ex: + _LOGGER.error('Unable to connect to mFi: %s', str(ex)) + return False + + add_devices(MfiSensor(port, hass) + for device in client.get_devices() + for port in device.ports.values() + if port.model in SENSOR_MODELS) + + +class MfiSensor(Entity): + """ An mFi sensor that exposes tag=value. """ + + def __init__(self, port, hass): + self._port = port + self._hass = hass + + @property + def name(self): + return self._port.label + + @property + def state(self): + return self._port.value + + @property + def unit_of_measurement(self): + if self._port.tag == 'temperature': + return TEMP_CELCIUS + elif self._port.tag == 'active_pwr': + return 'Watts' + return self._port.tag + + def update(self): + self._port.refresh() diff --git a/requirements_all.txt b/requirements_all.txt index 23a758240a5..d83adfa82a2 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -105,6 +105,9 @@ liffylights==0.9.4 # homeassistant.components.light.limitlessled limitlessled==1.0.0 +# homeassistant.components.sensor.mfi +mficlient==0.2 + # homeassistant.components.discovery netdisco==0.5.2 From ffc4822f506a998e78103ab221b2b1716404c493 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Sat, 6 Feb 2016 21:48:31 +0000 Subject: [PATCH 24/85] Add support for Ubiquiti mFi switchable devices This adds support for mFi devices that are swichable, such as the mFi Outlet device. --- .coveragerc | 1 + homeassistant/components/switch/mfi.py | 121 +++++++++++++++++++++++++ requirements_all.txt | 1 + 3 files changed, 123 insertions(+) create mode 100644 homeassistant/components/switch/mfi.py diff --git a/.coveragerc b/.coveragerc index 792da89e4c6..c0336241e02 100644 --- a/.coveragerc +++ b/.coveragerc @@ -138,6 +138,7 @@ omit = homeassistant/components/switch/arest.py homeassistant/components/switch/edimax.py homeassistant/components/switch/hikvisioncam.py + homeassistant/components/switch/mfi.py homeassistant/components/switch/mystrom.py homeassistant/components/switch/orvibo.py homeassistant/components/switch/rest.py diff --git a/homeassistant/components/switch/mfi.py b/homeassistant/components/switch/mfi.py new file mode 100644 index 00000000000..5007698c156 --- /dev/null +++ b/homeassistant/components/switch/mfi.py @@ -0,0 +1,121 @@ +""" +homeassistant.components.switch.mfi +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Support for Ubiquiti mFi Switches. + +Configuration: + +sensor: + platform: mfi + host: ADDRESS + port: PORT + username: USERNAME + password: PASSWORD + +Variable: + +host +*Required +ADDRESS is the IP or hostname of your mFi controller. + +port +*Optional +PORT is the port of your mFi controller (usually 6443) + +username +*Required +USERNAME is the mFi admin username + +password +*Required +PASSWORD is the mFi admin user's password +""" + +import logging + +from homeassistant.components.switch import DOMAIN, SwitchDevice +from homeassistant.const import CONF_USERNAME, CONF_PASSWORD +from homeassistant.helpers import validate_config + +REQUIREMENTS = ['mficlient==0.2'] + +_LOGGER = logging.getLogger(__name__) + +SWITCH_MODELS = [ + 'Outlet', +] + + +# pylint: disable=unused-variable +def setup_platform(hass, config, add_devices, discovery_info=None): + """ Sets up mFi sensors. """ + + if not validate_config({DOMAIN: config}, + {DOMAIN: ['host', + CONF_USERNAME, + CONF_PASSWORD]}, + _LOGGER): + _LOGGER.error('A host, username, and password are required') + return False + + host = config.get('host') + port = int(config.get('port', 6443)) + username = config.get('username') + password = config.get('password') + + from mficlient.client import MFiClient + + try: + client = MFiClient(host, username, password, port=port) + except client.FailedToLogin as ex: + _LOGGER.error('Unable to connect to mFi: %s', str(ex)) + return False + + add_devices(MfiSwitch(port) + for device in client.get_devices() + for port in device.ports.values() + if port.model in SWITCH_MODELS) + + +class MfiSwitch(SwitchDevice): + """ An mFi switch-able device. """ + def __init__(self, port): + self._port = port + + @property + def should_poll(self): + return True + + @property + def unique_id(self): + return self._port.ident + + @property + def name(self): + return self._port.label + + @property + def is_on(self): + return self._port.output + + def update(self): + self._port.refresh() + + def turn_on(self): + self._port.control(True) + self._port.data['output'] = 1.0 + + def turn_off(self): + self._port.control(False) + self._port.data['output'] = 0.0 + + @property + def current_power_mwh(self): + return int(self._port.data.get('active_pwr', 0) * 1000) + + @property + def state_attributes(self): + attr = super().state_attributes or {} + attr['volts'] = self._port.data.get('v_rms', 0) + attr['amps'] = self._port.data.get('i_rms', 0) + return attr diff --git a/requirements_all.txt b/requirements_all.txt index d83adfa82a2..9332cefdc6f 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -106,6 +106,7 @@ liffylights==0.9.4 limitlessled==1.0.0 # homeassistant.components.sensor.mfi +# homeassistant.components.switch.mfi mficlient==0.2 # homeassistant.components.discovery From 3575ddb6ef292f8cf01c5061fb30a094923ee443 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Fri, 5 Feb 2016 23:11:47 +0000 Subject: [PATCH 25/85] Add Caddx/GE/Interlogix NetworX alarm panel support This adds support for NetworX-based alarm panels and should work for any such panel equipped with a NX584 serial interface module. This includes NX-4/6/8/8E, where the NX8E has this interface built-in. It requires the pynx584 module, and requires running the server component somewhere that has connectivity to the panel via serial, which may include a serial-over-lan connection. --- .coveragerc | 1 + .../components/alarm_control_panel/nx584.py | 109 ++++++++++++++++++ requirements_all.txt | 3 + 3 files changed, 113 insertions(+) create mode 100644 homeassistant/components/alarm_control_panel/nx584.py diff --git a/.coveragerc b/.coveragerc index 611273b5288..b90fd0c9ae9 100644 --- a/.coveragerc +++ b/.coveragerc @@ -6,6 +6,7 @@ omit = # omit pieces of code that rely on external devices being present homeassistant/components/alarm_control_panel/alarmdotcom.py + homeassistant/components/alarm_control_panel/nx584.py homeassistant/components/arduino.py homeassistant/components/*/arduino.py diff --git a/homeassistant/components/alarm_control_panel/nx584.py b/homeassistant/components/alarm_control_panel/nx584.py new file mode 100644 index 00000000000..58747b5eff0 --- /dev/null +++ b/homeassistant/components/alarm_control_panel/nx584.py @@ -0,0 +1,109 @@ +""" +Networx NX584 interface +~~~~~~~~~~~~~~~~~~~~~~~ + +Configuration: + +To use the Example custom component you will need to add the following to +your configuration.yaml file. + +alarm_control_panel: + platform: nx584 + host: localhost:5007 + +Variable: + +host +*Optional +HOST should be a something like "localhost:5007" which is the +connection information for talking to the pynx584 backend server. +""" +import logging +import requests + +from homeassistant.const import (STATE_UNKNOWN, STATE_ALARM_DISARMED, + STATE_ALARM_ARMED_HOME, + STATE_ALARM_ARMED_AWAY) +import homeassistant.components.alarm_control_panel as alarm + +REQUIREMENTS = ['pynx584==0.1'] + +_LOGGER = logging.getLogger(__name__) + + +def setup_platform(hass, config, add_devices, discovery_info=None): + """ Setup nx584. """ + host = config.get('host', 'localhost:5007') + + try: + add_devices([NX584Alarm(hass, host, config.get('name', 'NX584'))]) + except requests.exceptions.ConnectionError as ex: + _LOGGER.error('Unable to connect to NX584: %s', str(ex)) + return False + + +class NX584Alarm(alarm.AlarmControlPanel): + """ NX584-based alarm panel. """ + def __init__(self, hass, host, name): + from nx584 import client + self._hass = hass + self._host = host + self._name = name + self._alarm = client.Client('http://%s' % host) + # Do an initial list operation so that we will try to actually + # talk to the API and trigger a requests exception for setup_platform() + # to catch + self._alarm.list_zones() + + @property + def should_poll(self): + return True + + @property + def name(self): + return self._name + + @property + def code_format(self): + return '[0-9]{4}([0-9]{2})?' + + @property + def state(self): + try: + part = self._alarm.list_partitions()[0] + zones = self._alarm.list_zones() + except requests.exceptions.ConnectionError as ex: + _LOGGER.error('Unable to connect to %(host)s: %(reason)s', + dict(host=self._host, reason=ex)) + return STATE_UNKNOWN + except IndexError: + _LOGGER.error('nx584 reports no partitions') + return STATE_UNKNOWN + + bypassed = False + for zone in zones: + if zone['bypassed']: + _LOGGER.debug('Zone %(zone)s is bypassed, ' + 'assuming HOME', + dict(zone=zone['number'])) + bypassed = True + break + + if not part['armed']: + return STATE_ALARM_DISARMED + elif bypassed: + return STATE_ALARM_ARMED_HOME + else: + return STATE_ALARM_ARMED_AWAY + + def alarm_disarm(self, code=None): + self._alarm.disarm(code) + + def alarm_arm_home(self, code=None): + self._alarm.arm('home') + + def alarm_arm_away(self, code=None): + self._alarm.arm('auto') + + def alarm_trigger(self, code=None): + raise NotImplementedError() diff --git a/requirements_all.txt b/requirements_all.txt index 9e0e159a1d2..71c8bc9ee85 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -153,6 +153,9 @@ pyicloud==0.7.2 # homeassistant.components.device_tracker.netgear pynetgear==0.3.2 +# homeassistant.components.alarm_control_panel.nx584 +pynx584==0.1 + # homeassistant.components.sensor.openweathermap pyowm==2.3.0 From bbdc1961271acf0dd0ad8818d41b84eea4a5aec4 Mon Sep 17 00:00:00 2001 From: Philip Lundrigan Date: Sat, 6 Feb 2016 20:33:43 -0700 Subject: [PATCH 26/85] Use entity_id attribute --- homeassistant/components/influxdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/influxdb.py b/homeassistant/components/influxdb.py index ab8a2d76e94..123cf5bc0e3 100644 --- a/homeassistant/components/influxdb.py +++ b/homeassistant/components/influxdb.py @@ -85,7 +85,7 @@ def setup(hass, config): measurement = state.attributes.get('unit_of_measurement') if measurement in (None, ''): - measurement = '{}.{}'.format(state.domain, state.object_id) + measurement = state.entity_id json_body = [ { From 681b84e1bd09eb2869156cef3e70169a089a5863 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 6 Feb 2016 22:07:30 -0800 Subject: [PATCH 27/85] Update frontend with FF url-sync fix --- homeassistant/components/frontend/version.py | 2 +- homeassistant/components/frontend/www_static/frontend.html | 4 ++-- .../components/frontend/www_static/home-assistant-polymer | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/frontend/version.py b/homeassistant/components/frontend/version.py index 5e7bc01b149..0da063f0ebc 100644 --- a/homeassistant/components/frontend/version.py +++ b/homeassistant/components/frontend/version.py @@ -1,2 +1,2 @@ """ DO NOT MODIFY. Auto-generated by build_frontend script """ -VERSION = "b5daaa4815050f90f6c996a429bfeae1" +VERSION = "5e1da334ca1aa73ee7951d26fbadbdf5" diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index a55f96ac931..1aff78b6b8a 100644 --- a/homeassistant/components/frontend/www_static/frontend.html +++ b/homeassistant/components/frontend/www_static/frontend.html @@ -6398,5 +6398,5 @@ value:function(t,e){if(0===this.__batchDepth){if(h.getOption(this.reactorState," t.registerStores({currentEntityHistoryDate:u["default"],entityHistory:c["default"],isLoadingEntityHistory:f["default"],recentEntityHistory:h["default"],recentEntityHistoryUpdated:_["default"]})}Object.defineProperty(e,"__esModule",{value:!0}),e.getters=e.actions=void 0,e.register=o;var a=n(138),u=i(a),s=n(139),c=i(s),l=n(140),f=i(l),d=n(141),h=i(d),p=n(142),_=i(p),v=n(137),y=r(v),m=n(44),g=r(m);e.actions=y,e.getters=g},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=function(){function t(t,e){for(var n=0;n6e4}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){function r(t,e,n){function r(){y&&clearTimeout(y),h&&clearTimeout(h),g=0,h=y=m=void 0}function s(e,n){n&&clearTimeout(n),h=y=m=void 0,e&&(g=o(),p=t.apply(v,d),y||h||(d=v=void 0))}function c(){var t=e-(o()-_);0>=t||t>e?s(m,h):y=setTimeout(c,t)}function l(){s(S,y)}function f(){if(d=arguments,_=o(),v=this,m=S&&(y||!w),b===!1)var n=w&&!y;else{h||w||(g=_);var r=b-(_-g),i=0>=r||r>b;i?(h&&(h=clearTimeout(h)),g=_,p=t.apply(v,d)):h||(h=setTimeout(l,r))}return i&&y?y=clearTimeout(y):y||e===b||(y=setTimeout(c,e)),n&&(i=!0,p=t.apply(v,d)),!i||y||h||(d=v=void 0),p}var d,h,p,_,v,y,m,g=0,b=!1,S=!0;if("function"!=typeof t)throw new TypeError(a);if(e=0>e?0:+e||0,n===!0){var w=!0;S=!1}else i(n)&&(w=!!n.leading,b="maxWait"in n&&u(+n.maxWait||0,e),S="trailing"in n?!!n.trailing:S);return f.cancel=r,f}var i=n(65),o=n(197),a="Expected a function",u=Math.max;t.exports=r},function(t,e,n){function r(t,e){var n=null==t?void 0:t[e];return i(n)?n:void 0}var i=n(200);t.exports=r},function(t,e){function n(t){return!!t&&"object"==typeof t}t.exports=n},function(t,e,n){function r(t){return i(t)&&u.call(t)==o}var i=n(65),o="[object Function]",a=Object.prototype,u=a.toString;t.exports=r},function(t,e){function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=n},function(t,e,n){(function(t){!function(e,n){t.exports=n()}(this,function(){"use strict";function e(){return Kn.apply(null,arguments)}function n(t){Kn=t}function r(t){return"[object Array]"===Object.prototype.toString.call(t)}function i(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function o(t,e){var n,r=[];for(n=0;n0)for(n in $n)r=$n[n],i=e[r],h(i)||(t[r]=i);return t}function _(t){p(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),Zn===!1&&(Zn=!0,e.updateOffset(this),Zn=!1)}function v(t){return t instanceof _||null!=t&&null!=t._isAMomentObject}function y(t){return 0>t?Math.ceil(t):Math.floor(t)}function m(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=y(e)),n}function g(t,e,n){var r,i=Math.min(t.length,e.length),o=Math.abs(t.length-e.length),a=0;for(r=0;i>r;r++)(n&&t[r]!==e[r]||!n&&m(t[r])!==m(e[r]))&&a++;return a+o}function b(){}function S(t){return t?t.toLowerCase().replace("_","-"):t}function w(t){for(var e,n,r,i,o=0;o0;){if(r=O(i.slice(0,e).join("-")))return r;if(n&&n.length>=e&&g(i,n,!0)>=e-1)break;e--}o++}return null}function O(e){var n=null;if(!Xn[e]&&"undefined"!=typeof t&&t&&t.exports)try{n=Jn._abbr,!function(){var t=new Error('Cannot find module "./locale"');throw t.code="MODULE_NOT_FOUND",t}(),M(n)}catch(r){}return Xn[e]}function M(t,e){var n;return t&&(n=h(e)?E(t):I(t,e),n&&(Jn=n)),Jn._abbr}function I(t,e){return null!==e?(e.abbr=t,Xn[t]=Xn[t]||new b,Xn[t].set(e),M(t),Xn[t]):(delete Xn[t],null)}function E(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return Jn;if(!r(t)){if(e=O(t))return e;t=[t]}return w(t)}function T(t,e){var n=t.toLowerCase();Qn[n]=Qn[n+"s"]=Qn[e]=t}function D(t){return"string"==typeof t?Qn[t]||Qn[t.toLowerCase()]:void 0}function C(t){var e,n,r={};for(n in t)a(t,n)&&(e=D(n),e&&(r[e]=t[n]));return r}function j(t){return t instanceof Function||"[object Function]"===Object.prototype.toString.call(t)}function P(t,n){return function(r){return null!=r?(k(this,t,r),e.updateOffset(this,n),this):A(this,t)}}function A(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function k(t,e,n){t.isValid()&&t._d["set"+(t._isUTC?"UTC":"")+e](n)}function L(t,e){var n;if("object"==typeof t)for(n in t)this.set(n,t[n]);else if(t=D(t),j(this[t]))return this[t](e);return this}function N(t,e,n){var r=""+Math.abs(t),i=e-r.length,o=t>=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}function R(t,e,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),t&&(rr[t]=i),e&&(rr[e[0]]=function(){return N(i.apply(this,arguments),e[1],e[2])}),n&&(rr[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function x(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function H(t){var e,n,r=t.match(tr);for(e=0,n=r.length;n>e;e++)rr[r[e]]?r[e]=rr[r[e]]:r[e]=x(r[e]);return function(i){var o="";for(e=0;n>e;e++)o+=r[e]instanceof Function?r[e].call(i,t):r[e];return o}}function Y(t,e){return t.isValid()?(e=z(e,t.localeData()),nr[e]=nr[e]||H(e),nr[e](t)):t.localeData().invalidDate()}function z(t,e){function n(t){return e.longDateFormat(t)||t}var r=5;for(er.lastIndex=0;r>=0&&er.test(t);)t=t.replace(er,n),er.lastIndex=0,r-=1;return t}function U(t,e,n){Sr[t]=j(e)?e:function(t,r){return t&&n?n:e}}function V(t,e){return a(Sr,t)?Sr[t](e._strict,e._locale):new RegExp(G(t))}function G(t){return F(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,r,i){return e||n||r||i}))}function F(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function B(t,e){var n,r=e;for("string"==typeof t&&(t=[t]),"number"==typeof e&&(r=function(t,n){n[e]=m(t)}),n=0;nr;r++){if(i=s([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===e&&this._longMonthsParse[r].test(t))return r;if(n&&"MMM"===e&&this._shortMonthsParse[r].test(t))return r;if(!n&&this._monthsParse[r].test(t))return r}}function X(t,e){var n;return t.isValid()?"string"==typeof e&&(e=t.localeData().monthsParse(e),"number"!=typeof e)?t:(n=Math.min(t.date(),K(t.year(),e)),t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,n),t):t}function Q(t){return null!=t?(X(this,t),e.updateOffset(this,!0),this):A(this,"Month")}function tt(){return K(this.year(),this.month())}function et(t){return this._monthsParseExact?(a(this,"_monthsRegex")||rt.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex}function nt(t){return this._monthsParseExact?(a(this,"_monthsRegex")||rt.call(this),t?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex}function rt(){function t(t,e){return e.length-t.length}var e,n,r=[],i=[],o=[];for(e=0;12>e;e++)n=s([2e3,e]),r.push(this.monthsShort(n,"")),i.push(this.months(n,"")),o.push(this.months(n,"")),o.push(this.monthsShort(n,""));for(r.sort(t),i.sort(t),o.sort(t),e=0;12>e;e++)r[e]=F(r[e]),i[e]=F(i[e]),o[e]=F(o[e]);this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")$","i"),this._monthsShortStrictRegex=new RegExp("^("+r.join("|")+")$","i")}function it(t){var e,n=t._a;return n&&-2===l(t).overflow&&(e=n[Mr]<0||n[Mr]>11?Mr:n[Ir]<1||n[Ir]>K(n[Or],n[Mr])?Ir:n[Er]<0||n[Er]>24||24===n[Er]&&(0!==n[Tr]||0!==n[Dr]||0!==n[Cr])?Er:n[Tr]<0||n[Tr]>59?Tr:n[Dr]<0||n[Dr]>59?Dr:n[Cr]<0||n[Cr]>999?Cr:-1,l(t)._overflowDayOfYear&&(Or>e||e>Ir)&&(e=Ir),l(t)._overflowWeeks&&-1===e&&(e=jr),l(t)._overflowWeekday&&-1===e&&(e=Pr),l(t).overflow=e),t}function ot(t){e.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function at(t,e){var n=!0;return u(function(){return n&&(ot(t+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),n=!1),e.apply(this,arguments)},e)}function ut(t,e){xr[t]||(ot(e),xr[t]=!0)}function st(t){var e,n,r,i,o,a,u=t._i,s=Hr.exec(u)||Yr.exec(u);if(s){for(l(t).iso=!0,e=0,n=Ur.length;n>e;e++)if(Ur[e][1].exec(s[1])){i=Ur[e][0],r=Ur[e][2]!==!1;break}if(null==i)return void(t._isValid=!1);if(s[3]){for(e=0,n=Vr.length;n>e;e++)if(Vr[e][1].exec(s[3])){o=(s[2]||" ")+Vr[e][0];break}if(null==o)return void(t._isValid=!1)}if(!r&&null!=o)return void(t._isValid=!1);if(s[4]){if(!zr.exec(s[4]))return void(t._isValid=!1);a="Z"}t._f=i+(o||"")+(a||""),Ot(t)}else t._isValid=!1}function ct(t){var n=Gr.exec(t._i);return null!==n?void(t._d=new Date(+n[1])):(st(t),void(t._isValid===!1&&(delete t._isValid,e.createFromInputFallback(t))))}function lt(t,e,n,r,i,o,a){var u=new Date(t,e,n,r,i,o,a);return 100>t&&t>=0&&isFinite(u.getFullYear())&&u.setFullYear(t),u}function ft(t){var e=new Date(Date.UTC.apply(null,arguments));return 100>t&&t>=0&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function dt(t){return ht(t)?366:365}function ht(t){return t%4===0&&t%100!==0||t%400===0}function pt(){return ht(this.year())}function _t(t,e,n){var r=7+e-n,i=(7+ft(t,0,r).getUTCDay()-e)%7;return-i+r-1}function vt(t,e,n,r,i){var o,a,u=(7+n-r)%7,s=_t(t,r,i),c=1+7*(e-1)+u+s;return 0>=c?(o=t-1,a=dt(o)+c):c>dt(t)?(o=t+1,a=c-dt(t)):(o=t,a=c),{year:o,dayOfYear:a}}function yt(t,e,n){var r,i,o=_t(t.year(),e,n),a=Math.floor((t.dayOfYear()-o-1)/7)+1;return 1>a?(i=t.year()-1,r=a+mt(i,e,n)):a>mt(t.year(),e,n)?(r=a-mt(t.year(),e,n),i=t.year()+1):(i=t.year(),r=a),{week:r,year:i}}function mt(t,e,n){var r=_t(t,e,n),i=_t(t+1,e,n);return(dt(t)-r+i)/7}function gt(t,e,n){return null!=t?t:null!=e?e:n}function bt(t){var n=new Date(e.now());return t._useUTC?[n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()]:[n.getFullYear(),n.getMonth(),n.getDate()]}function St(t){var e,n,r,i,o=[];if(!t._d){for(r=bt(t),t._w&&null==t._a[Ir]&&null==t._a[Mr]&&wt(t),t._dayOfYear&&(i=gt(t._a[Or],r[Or]),t._dayOfYear>dt(i)&&(l(t)._overflowDayOfYear=!0),n=ft(i,0,t._dayOfYear),t._a[Mr]=n.getUTCMonth(),t._a[Ir]=n.getUTCDate()),e=0;3>e&&null==t._a[e];++e)t._a[e]=o[e]=r[e];for(;7>e;e++)t._a[e]=o[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[Er]&&0===t._a[Tr]&&0===t._a[Dr]&&0===t._a[Cr]&&(t._nextDay=!0,t._a[Er]=0),t._d=(t._useUTC?ft:lt).apply(null,o),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[Er]=24)}}function wt(t){var e,n,r,i,o,a,u,s;e=t._w,null!=e.GG||null!=e.W||null!=e.E?(o=1,a=4,n=gt(e.GG,t._a[Or],yt(Pt(),1,4).year),r=gt(e.W,1),i=gt(e.E,1),(1>i||i>7)&&(s=!0)):(o=t._locale._week.dow,a=t._locale._week.doy,n=gt(e.gg,t._a[Or],yt(Pt(),o,a).year),r=gt(e.w,1),null!=e.d?(i=e.d,(0>i||i>6)&&(s=!0)):null!=e.e?(i=e.e+o,(e.e<0||e.e>6)&&(s=!0)):i=o),1>r||r>mt(n,o,a)?l(t)._overflowWeeks=!0:null!=s?l(t)._overflowWeekday=!0:(u=vt(n,r,i,o,a),t._a[Or]=u.year,t._dayOfYear=u.dayOfYear)}function Ot(t){if(t._f===e.ISO_8601)return void st(t);t._a=[],l(t).empty=!0;var n,r,i,o,a,u=""+t._i,s=u.length,c=0;for(i=z(t._f,t._locale).match(tr)||[],n=0;n0&&l(t).unusedInput.push(a),u=u.slice(u.indexOf(r)+r.length),c+=r.length),rr[o]?(r?l(t).empty=!1:l(t).unusedTokens.push(o),q(o,r,t)):t._strict&&!r&&l(t).unusedTokens.push(o);l(t).charsLeftOver=s-c,u.length>0&&l(t).unusedInput.push(u),l(t).bigHour===!0&&t._a[Er]<=12&&t._a[Er]>0&&(l(t).bigHour=void 0),t._a[Er]=Mt(t._locale,t._a[Er],t._meridiem),St(t),it(t)}function Mt(t,e,n){var r;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?(r=t.isPM(n),r&&12>e&&(e+=12),r||12!==e||(e=0),e):e}function It(t){var e,n,r,i,o;if(0===t._f.length)return l(t).invalidFormat=!0,void(t._d=new Date(NaN));for(i=0;io)&&(r=o,n=e));u(t,n||e)}function Et(t){if(!t._d){var e=C(t._i);t._a=o([e.year,e.month,e.day||e.date,e.hour,e.minute,e.second,e.millisecond],function(t){return t&&parseInt(t,10)}),St(t)}}function Tt(t){var e=new _(it(Dt(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function Dt(t){var e=t._i,n=t._f;return t._locale=t._locale||E(t._l),null===e||void 0===n&&""===e?d({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),v(e)?new _(it(e)):(r(n)?It(t):n?Ot(t):i(e)?t._d=e:Ct(t),f(t)||(t._d=null),t))}function Ct(t){var n=t._i;void 0===n?t._d=new Date(e.now()):i(n)?t._d=new Date(+n):"string"==typeof n?ct(t):r(n)?(t._a=o(n.slice(0),function(t){return parseInt(t,10)}),St(t)):"object"==typeof n?Et(t):"number"==typeof n?t._d=new Date(n):e.createFromInputFallback(t)}function jt(t,e,n,r,i){var o={};return"boolean"==typeof n&&(r=n,n=void 0),o._isAMomentObject=!0,o._useUTC=o._isUTC=i,o._l=n,o._i=t,o._f=e,o._strict=r,Tt(o)}function Pt(t,e,n,r){return jt(t,e,n,r,!1)}function At(t,e){var n,i;if(1===e.length&&r(e[0])&&(e=e[0]),!e.length)return Pt();for(n=e[0],i=1;it&&(t=-t,n="-"),n+N(~~(t/60),2)+e+N(~~t%60,2)})}function Ht(t,e){var n=(e||"").match(t)||[],r=n[n.length-1]||[],i=(r+"").match(Kr)||["-",0,0],o=+(60*i[1])+m(i[2]);return"+"===i[0]?o:-o}function Yt(t,n){var r,o;return n._isUTC?(r=n.clone(),o=(v(t)||i(t)?+t:+Pt(t))-+r,r._d.setTime(+r._d+o),e.updateOffset(r,!1),r):Pt(t).local()}function zt(t){return 15*-Math.round(t._d.getTimezoneOffset()/15)}function Ut(t,n){var r,i=this._offset||0;return this.isValid()?null!=t?("string"==typeof t?t=Ht(mr,t):Math.abs(t)<16&&(t=60*t),!this._isUTC&&n&&(r=zt(this)),this._offset=t,this._isUTC=!0,null!=r&&this.add(r,"m"),i!==t&&(!n||this._changeInProgress?re(this,Xt(t-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?i:zt(this):null!=t?this:NaN}function Vt(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}function Gt(t){return this.utcOffset(0,t)}function Ft(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(zt(this),"m")),this}function Bt(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ht(yr,this._i)),this}function Wt(t){return this.isValid()?(t=t?Pt(t).utcOffset():0,(this.utcOffset()-t)%60===0):!1}function qt(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Kt(){if(!h(this._isDSTShifted))return this._isDSTShifted;var t={};if(p(t,this),t=Dt(t),t._a){var e=t._isUTC?s(t._a):Pt(t._a);this._isDSTShifted=this.isValid()&&g(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Jt(){return this.isValid()?!this._isUTC:!1}function $t(){return this.isValid()?this._isUTC:!1}function Zt(){return this.isValid()?this._isUTC&&0===this._offset:!1}function Xt(t,e){var n,r,i,o=t,u=null;return Rt(t)?o={ms:t._milliseconds,d:t._days,M:t._months}:"number"==typeof t?(o={},e?o[e]=t:o.milliseconds=t):(u=Jr.exec(t))?(n="-"===u[1]?-1:1,o={y:0,d:m(u[Ir])*n,h:m(u[Er])*n,m:m(u[Tr])*n,s:m(u[Dr])*n,ms:m(u[Cr])*n}):(u=$r.exec(t))?(n="-"===u[1]?-1:1,o={y:Qt(u[2],n),M:Qt(u[3],n),d:Qt(u[4],n),h:Qt(u[5],n),m:Qt(u[6],n),s:Qt(u[7],n),w:Qt(u[8],n)}):null==o?o={}:"object"==typeof o&&("from"in o||"to"in o)&&(i=ee(Pt(o.from),Pt(o.to)),o={},o.ms=i.milliseconds,o.M=i.months),r=new Nt(o),Rt(t)&&a(t,"_locale")&&(r._locale=t._locale),r}function Qt(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function te(t,e){var n={milliseconds:0,months:0};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function ee(t,e){var n;return t.isValid()&&e.isValid()?(e=Yt(e,t),t.isBefore(e)?n=te(t,e):(n=te(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function ne(t,e){return function(n,r){var i,o;return null===r||isNaN(+r)||(ut(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period)."),o=n,n=r,r=o),n="string"==typeof n?+n:n,i=Xt(n,r),re(this,i,t),this}}function re(t,n,r,i){var o=n._milliseconds,a=n._days,u=n._months;t.isValid()&&(i=null==i?!0:i,o&&t._d.setTime(+t._d+o*r),a&&k(t,"Date",A(t,"Date")+a*r),u&&X(t,A(t,"Month")+u*r),i&&e.updateOffset(t,a||u))}function ie(t,e){var n=t||Pt(),r=Yt(n,this).startOf("day"),i=this.diff(r,"days",!0),o=-6>i?"sameElse":-1>i?"lastWeek":0>i?"lastDay":1>i?"sameDay":2>i?"nextDay":7>i?"nextWeek":"sameElse",a=e&&(j(e[o])?e[o]():e[o]);return this.format(a||this.localeData().calendar(o,this,Pt(n)))}function oe(){return new _(this)}function ae(t,e){var n=v(t)?t:Pt(t);return this.isValid()&&n.isValid()?(e=D(h(e)?"millisecond":e),"millisecond"===e?+this>+n:+n<+this.clone().startOf(e)):!1}function ue(t,e){var n=v(t)?t:Pt(t);return this.isValid()&&n.isValid()?(e=D(h(e)?"millisecond":e),"millisecond"===e?+n>+this:+this.clone().endOf(e)<+n):!1}function se(t,e,n){return this.isAfter(t,n)&&this.isBefore(e,n)}function ce(t,e){var n,r=v(t)?t:Pt(t);return this.isValid()&&r.isValid()?(e=D(e||"millisecond"),"millisecond"===e?+this===+r:(n=+r,+this.clone().startOf(e)<=n&&n<=+this.clone().endOf(e))):!1}function le(t,e){return this.isSame(t,e)||this.isAfter(t,e)}function fe(t,e){return this.isSame(t,e)||this.isBefore(t,e)}function de(t,e,n){var r,i,o,a;return this.isValid()?(r=Yt(t,this),r.isValid()?(i=6e4*(r.utcOffset()-this.utcOffset()),e=D(e),"year"===e||"month"===e||"quarter"===e?(a=he(this,r),"quarter"===e?a/=3:"year"===e&&(a/=12)):(o=this-r,a="second"===e?o/1e3:"minute"===e?o/6e4:"hour"===e?o/36e5:"day"===e?(o-i)/864e5:"week"===e?(o-i)/6048e5:o),n?a:y(a)):NaN):NaN}function he(t,e){var n,r,i=12*(e.year()-t.year())+(e.month()-t.month()),o=t.clone().add(i,"months");return 0>e-o?(n=t.clone().add(i-1,"months"),r=(e-o)/(o-n)):(n=t.clone().add(i+1,"months"),r=(e-o)/(n-o)),-(i+r)}function pe(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function _e(){var t=this.clone().utc();return 0o&&(e=o),Ue.call(this,t,e,n,r,i))}function Ue(t,e,n,r,i){var o=vt(t,e,n,r,i),a=ft(o.year,0,o.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}function Ve(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}function Ge(t){return yt(t,this._week.dow,this._week.doy).week}function Fe(){return this._week.dow}function Be(){return this._week.doy}function We(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function qe(t){var e=yt(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function Ke(t,e){return"string"!=typeof t?t:isNaN(t)?(t=e.weekdaysParse(t),"number"==typeof t?t:null):parseInt(t,10)}function Je(t,e){return r(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]}function $e(t){return this._weekdaysShort[t.day()]}function Ze(t){return this._weekdaysMin[t.day()]}function Xe(t,e,n){var r,i,o;for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;7>r;r++){if(i=Pt([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".",".?")+"$","i")),this._weekdaysParse[r]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[r].test(t))return r;if(n&&"ddd"===e&&this._shortWeekdaysParse[r].test(t))return r;if(n&&"dd"===e&&this._minWeekdaysParse[r].test(t))return r;if(!n&&this._weekdaysParse[r].test(t))return r}}function Qe(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=Ke(t,this.localeData()),this.add(t-e,"d")):e}function tn(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function en(t){return this.isValid()?null==t?this.day()||7:this.day(this.day()%7?t:t-7):null!=t?this:NaN; }function nn(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}function rn(){return this.hours()%12||12}function on(t,e){R(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function an(t,e){return e._meridiemParse}function un(t){return"p"===(t+"").toLowerCase().charAt(0)}function sn(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}function cn(t,e){e[Cr]=m(1e3*("0."+t))}function ln(){return this._isUTC?"UTC":""}function fn(){return this._isUTC?"Coordinated Universal Time":""}function dn(t){return Pt(1e3*t)}function hn(){return Pt.apply(null,arguments).parseZone()}function pn(t,e,n){var r=this._calendar[t];return j(r)?r.call(e,n):r}function _n(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t])}function vn(){return this._invalidDate}function yn(t){return this._ordinal.replace("%d",t)}function mn(t){return t}function gn(t,e,n,r){var i=this._relativeTime[n];return j(i)?i(t,e,n,r):i.replace(/%d/i,t)}function bn(t,e){var n=this._relativeTime[t>0?"future":"past"];return j(n)?n(e):n.replace(/%s/i,e)}function Sn(t){var e,n;for(n in t)e=t[n],j(e)?this[n]=e:this["_"+n]=e;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function wn(t,e,n,r){var i=E(),o=s().set(r,e);return i[n](o,t)}function On(t,e,n,r,i){if("number"==typeof t&&(e=t,t=void 0),t=t||"",null!=e)return wn(t,e,n,i);var o,a=[];for(o=0;r>o;o++)a[o]=wn(t,o,n,i);return a}function Mn(t,e){return On(t,e,"months",12,"month")}function In(t,e){return On(t,e,"monthsShort",12,"month")}function En(t,e){return On(t,e,"weekdays",7,"day")}function Tn(t,e){return On(t,e,"weekdaysShort",7,"day")}function Dn(t,e){return On(t,e,"weekdaysMin",7,"day")}function Cn(){var t=this._data;return this._milliseconds=bi(this._milliseconds),this._days=bi(this._days),this._months=bi(this._months),t.milliseconds=bi(t.milliseconds),t.seconds=bi(t.seconds),t.minutes=bi(t.minutes),t.hours=bi(t.hours),t.months=bi(t.months),t.years=bi(t.years),this}function jn(t,e,n,r){var i=Xt(e,n);return t._milliseconds+=r*i._milliseconds,t._days+=r*i._days,t._months+=r*i._months,t._bubble()}function Pn(t,e){return jn(this,t,e,1)}function An(t,e){return jn(this,t,e,-1)}function kn(t){return 0>t?Math.floor(t):Math.ceil(t)}function Ln(){var t,e,n,r,i,o=this._milliseconds,a=this._days,u=this._months,s=this._data;return o>=0&&a>=0&&u>=0||0>=o&&0>=a&&0>=u||(o+=864e5*kn(Rn(u)+a),a=0,u=0),s.milliseconds=o%1e3,t=y(o/1e3),s.seconds=t%60,e=y(t/60),s.minutes=e%60,n=y(e/60),s.hours=n%24,a+=y(n/24),i=y(Nn(a)),u+=i,a-=kn(Rn(i)),r=y(u/12),u%=12,s.days=a,s.months=u,s.years=r,this}function Nn(t){return 4800*t/146097}function Rn(t){return 146097*t/4800}function xn(t){var e,n,r=this._milliseconds;if(t=D(t),"month"===t||"year"===t)return e=this._days+r/864e5,n=this._months+Nn(e),"month"===t?n:n/12;switch(e=this._days+Math.round(Rn(this._months)),t){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return 24*e+r/36e5;case"minute":return 1440*e+r/6e4;case"second":return 86400*e+r/1e3;case"millisecond":return Math.floor(864e5*e)+r;default:throw new Error("Unknown unit "+t)}}function Hn(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*m(this._months/12)}function Yn(t){return function(){return this.as(t)}}function zn(t){return t=D(t),this[t+"s"]()}function Un(t){return function(){return this._data[t]}}function Vn(){return y(this.days()/7)}function Gn(t,e,n,r,i){return i.relativeTime(e||1,!!n,t,r)}function Fn(t,e,n){var r=Xt(t).abs(),i=Ri(r.as("s")),o=Ri(r.as("m")),a=Ri(r.as("h")),u=Ri(r.as("d")),s=Ri(r.as("M")),c=Ri(r.as("y")),l=i=o&&["m"]||o=a&&["h"]||a=u&&["d"]||u=s&&["M"]||s=c&&["y"]||["yy",c];return l[2]=e,l[3]=+t>0,l[4]=n,Gn.apply(null,l)}function Bn(t,e){return void 0===xi[t]?!1:void 0===e?xi[t]:(xi[t]=e,!0)}function Wn(t){var e=this.localeData(),n=Fn(this,!t,e);return t&&(n=e.pastFuture(+this,n)),e.postformat(n)}function qn(){var t,e,n,r=Hi(this._milliseconds)/1e3,i=Hi(this._days),o=Hi(this._months);t=y(r/60),e=y(t/60),r%=60,t%=60,n=y(o/12),o%=12;var a=n,u=o,s=i,c=e,l=t,f=r,d=this.asSeconds();return d?(0>d?"-":"")+"P"+(a?a+"Y":"")+(u?u+"M":"")+(s?s+"D":"")+(c||l||f?"T":"")+(c?c+"H":"")+(l?l+"M":"")+(f?f+"S":""):"P0D"}var Kn,Jn,$n=e.momentProperties=[],Zn=!1,Xn={},Qn={},tr=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,er=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,nr={},rr={},ir=/\d/,or=/\d\d/,ar=/\d{3}/,ur=/\d{4}/,sr=/[+-]?\d{6}/,cr=/\d\d?/,lr=/\d\d\d\d?/,fr=/\d\d\d\d\d\d?/,dr=/\d{1,3}/,hr=/\d{1,4}/,pr=/[+-]?\d{1,6}/,_r=/\d+/,vr=/[+-]?\d+/,yr=/Z|[+-]\d\d:?\d\d/gi,mr=/Z|[+-]\d\d(?::?\d\d)?/gi,gr=/[+-]?\d+(\.\d{1,3})?/,br=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Sr={},wr={},Or=0,Mr=1,Ir=2,Er=3,Tr=4,Dr=5,Cr=6,jr=7,Pr=8;R("M",["MM",2],"Mo",function(){return this.month()+1}),R("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),R("MMMM",0,0,function(t){return this.localeData().months(this,t)}),T("month","M"),U("M",cr),U("MM",cr,or),U("MMM",function(t,e){return e.monthsShortRegex(t)}),U("MMMM",function(t,e){return e.monthsRegex(t)}),B(["M","MM"],function(t,e){e[Mr]=m(t)-1}),B(["MMM","MMMM"],function(t,e,n,r){var i=n._locale.monthsParse(t,r,n._strict);null!=i?e[Mr]=i:l(n).invalidMonth=t});var Ar=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,kr="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Lr="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Nr=br,Rr=br,xr={};e.suppressDeprecationWarnings=!1;var Hr=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,Yr=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,zr=/Z|[+-]\d\d(?::?\d\d)?/,Ur=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Vr=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Gr=/^\/?Date\((\-?\d+)/i;e.createFromInputFallback=at("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),R("Y",0,0,function(){var t=this.year();return 9999>=t?""+t:"+"+t}),R(0,["YY",2],0,function(){return this.year()%100}),R(0,["YYYY",4],0,"year"),R(0,["YYYYY",5],0,"year"),R(0,["YYYYYY",6,!0],0,"year"),T("year","y"),U("Y",vr),U("YY",cr,or),U("YYYY",hr,ur),U("YYYYY",pr,sr),U("YYYYYY",pr,sr),B(["YYYYY","YYYYYY"],Or),B("YYYY",function(t,n){n[Or]=2===t.length?e.parseTwoDigitYear(t):m(t)}),B("YY",function(t,n){n[Or]=e.parseTwoDigitYear(t)}),B("Y",function(t,e){e[Or]=parseInt(t,10)}),e.parseTwoDigitYear=function(t){return m(t)+(m(t)>68?1900:2e3)};var Fr=P("FullYear",!1);e.ISO_8601=function(){};var Br=at("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var t=Pt.apply(null,arguments);return this.isValid()&&t.isValid()?this>t?this:t:d()}),Wr=at("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var t=Pt.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:d()}),qr=function(){return Date.now?Date.now():+new Date};xt("Z",":"),xt("ZZ",""),U("Z",mr),U("ZZ",mr),B(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=Ht(mr,t)});var Kr=/([\+\-]|\d\d)/gi;e.updateOffset=function(){};var Jr=/(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,$r=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Xt.fn=Nt.prototype;var Zr=ne(1,"add"),Xr=ne(-1,"subtract");e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var Qr=at("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});R(0,["gg",2],0,function(){return this.weekYear()%100}),R(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ne("gggg","weekYear"),Ne("ggggg","weekYear"),Ne("GGGG","isoWeekYear"),Ne("GGGGG","isoWeekYear"),T("weekYear","gg"),T("isoWeekYear","GG"),U("G",vr),U("g",vr),U("GG",cr,or),U("gg",cr,or),U("GGGG",hr,ur),U("gggg",hr,ur),U("GGGGG",pr,sr),U("ggggg",pr,sr),W(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,r){e[r.substr(0,2)]=m(t)}),W(["gg","GG"],function(t,n,r,i){n[i]=e.parseTwoDigitYear(t)}),R("Q",0,"Qo","quarter"),T("quarter","Q"),U("Q",ir),B("Q",function(t,e){e[Mr]=3*(m(t)-1)}),R("w",["ww",2],"wo","week"),R("W",["WW",2],"Wo","isoWeek"),T("week","w"),T("isoWeek","W"),U("w",cr),U("ww",cr,or),U("W",cr),U("WW",cr,or),W(["w","ww","W","WW"],function(t,e,n,r){e[r.substr(0,1)]=m(t)});var ti={dow:0,doy:6};R("D",["DD",2],"Do","date"),T("date","D"),U("D",cr),U("DD",cr,or),U("Do",function(t,e){return t?e._ordinalParse:e._ordinalParseLenient}),B(["D","DD"],Ir),B("Do",function(t,e){e[Ir]=m(t.match(cr)[0],10)});var ei=P("Date",!0);R("d",0,"do","day"),R("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),R("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),R("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),R("e",0,0,"weekday"),R("E",0,0,"isoWeekday"),T("day","d"),T("weekday","e"),T("isoWeekday","E"),U("d",cr),U("e",cr),U("E",cr),U("dd",br),U("ddd",br),U("dddd",br),W(["dd","ddd","dddd"],function(t,e,n,r){var i=n._locale.weekdaysParse(t,r,n._strict);null!=i?e.d=i:l(n).invalidWeekday=t}),W(["d","e","E"],function(t,e,n,r){e[r]=m(t)});var ni="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ri="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),ii="Su_Mo_Tu_We_Th_Fr_Sa".split("_");R("DDD",["DDDD",3],"DDDo","dayOfYear"),T("dayOfYear","DDD"),U("DDD",dr),U("DDDD",ar),B(["DDD","DDDD"],function(t,e,n){n._dayOfYear=m(t)}),R("H",["HH",2],0,"hour"),R("h",["hh",2],0,rn),R("hmm",0,0,function(){return""+rn.apply(this)+N(this.minutes(),2)}),R("hmmss",0,0,function(){return""+rn.apply(this)+N(this.minutes(),2)+N(this.seconds(),2)}),R("Hmm",0,0,function(){return""+this.hours()+N(this.minutes(),2)}),R("Hmmss",0,0,function(){return""+this.hours()+N(this.minutes(),2)+N(this.seconds(),2)}),on("a",!0),on("A",!1),T("hour","h"),U("a",an),U("A",an),U("H",cr),U("h",cr),U("HH",cr,or),U("hh",cr,or),U("hmm",lr),U("hmmss",fr),U("Hmm",lr),U("Hmmss",fr),B(["H","HH"],Er),B(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),B(["h","hh"],function(t,e,n){e[Er]=m(t),l(n).bigHour=!0}),B("hmm",function(t,e,n){var r=t.length-2;e[Er]=m(t.substr(0,r)),e[Tr]=m(t.substr(r)),l(n).bigHour=!0}),B("hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[Er]=m(t.substr(0,r)),e[Tr]=m(t.substr(r,2)),e[Dr]=m(t.substr(i)),l(n).bigHour=!0}),B("Hmm",function(t,e,n){var r=t.length-2;e[Er]=m(t.substr(0,r)),e[Tr]=m(t.substr(r))}),B("Hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[Er]=m(t.substr(0,r)),e[Tr]=m(t.substr(r,2)),e[Dr]=m(t.substr(i))});var oi=/[ap]\.?m?\.?/i,ai=P("Hours",!0);R("m",["mm",2],0,"minute"),T("minute","m"),U("m",cr),U("mm",cr,or),B(["m","mm"],Tr);var ui=P("Minutes",!1);R("s",["ss",2],0,"second"),T("second","s"),U("s",cr),U("ss",cr,or),B(["s","ss"],Dr);var si=P("Seconds",!1);R("S",0,0,function(){return~~(this.millisecond()/100)}),R(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),R(0,["SSS",3],0,"millisecond"),R(0,["SSSS",4],0,function(){return 10*this.millisecond()}),R(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),R(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),R(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),R(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),R(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),T("millisecond","ms"),U("S",dr,ir),U("SS",dr,or),U("SSS",dr,ar);var ci;for(ci="SSSS";ci.length<=9;ci+="S")U(ci,_r);for(ci="S";ci.length<=9;ci+="S")B(ci,cn);var li=P("Milliseconds",!1);R("z",0,0,"zoneAbbr"),R("zz",0,0,"zoneName");var fi=_.prototype;fi.add=Zr,fi.calendar=ie,fi.clone=oe,fi.diff=de,fi.endOf=Me,fi.format=ve,fi.from=ye,fi.fromNow=me,fi.to=ge,fi.toNow=be,fi.get=L,fi.invalidAt=ke,fi.isAfter=ae,fi.isBefore=ue,fi.isBetween=se,fi.isSame=ce,fi.isSameOrAfter=le,fi.isSameOrBefore=fe,fi.isValid=Pe,fi.lang=Qr,fi.locale=Se,fi.localeData=we,fi.max=Wr,fi.min=Br,fi.parsingFlags=Ae,fi.set=L,fi.startOf=Oe,fi.subtract=Xr,fi.toArray=De,fi.toObject=Ce,fi.toDate=Te,fi.toISOString=_e,fi.toJSON=je,fi.toString=pe,fi.unix=Ee,fi.valueOf=Ie,fi.creationData=Le,fi.year=Fr,fi.isLeapYear=pt,fi.weekYear=Re,fi.isoWeekYear=xe,fi.quarter=fi.quarters=Ve,fi.month=Q,fi.daysInMonth=tt,fi.week=fi.weeks=We,fi.isoWeek=fi.isoWeeks=qe,fi.weeksInYear=Ye,fi.isoWeeksInYear=He,fi.date=ei,fi.day=fi.days=Qe,fi.weekday=tn,fi.isoWeekday=en,fi.dayOfYear=nn,fi.hour=fi.hours=ai,fi.minute=fi.minutes=ui,fi.second=fi.seconds=si,fi.millisecond=fi.milliseconds=li,fi.utcOffset=Ut,fi.utc=Gt,fi.local=Ft,fi.parseZone=Bt,fi.hasAlignedHourOffset=Wt,fi.isDST=qt,fi.isDSTShifted=Kt,fi.isLocal=Jt,fi.isUtcOffset=$t,fi.isUtc=Zt,fi.isUTC=Zt,fi.zoneAbbr=ln,fi.zoneName=fn,fi.dates=at("dates accessor is deprecated. Use date instead.",ei),fi.months=at("months accessor is deprecated. Use month instead",Q),fi.years=at("years accessor is deprecated. Use year instead",Fr),fi.zone=at("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Vt);var di=fi,hi={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},pi={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},_i="Invalid date",vi="%d",yi=/\d{1,2}/,mi={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},gi=b.prototype;gi._calendar=hi,gi.calendar=pn,gi._longDateFormat=pi,gi.longDateFormat=_n,gi._invalidDate=_i,gi.invalidDate=vn,gi._ordinal=vi,gi.ordinal=yn,gi._ordinalParse=yi,gi.preparse=mn,gi.postformat=mn,gi._relativeTime=mi,gi.relativeTime=gn,gi.pastFuture=bn,gi.set=Sn,gi.months=J,gi._months=kr,gi.monthsShort=$,gi._monthsShort=Lr,gi.monthsParse=Z,gi._monthsRegex=Rr,gi.monthsRegex=nt,gi._monthsShortRegex=Nr,gi.monthsShortRegex=et,gi.week=Ge,gi._week=ti,gi.firstDayOfYear=Be,gi.firstDayOfWeek=Fe,gi.weekdays=Je,gi._weekdays=ni,gi.weekdaysMin=Ze,gi._weekdaysMin=ii,gi.weekdaysShort=$e,gi._weekdaysShort=ri,gi.weekdaysParse=Xe,gi.isPM=un,gi._meridiemParse=oi,gi.meridiem=sn,M("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=1===m(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),e.lang=at("moment.lang is deprecated. Use moment.locale instead.",M),e.langData=at("moment.langData is deprecated. Use moment.localeData instead.",E);var bi=Math.abs,Si=Yn("ms"),wi=Yn("s"),Oi=Yn("m"),Mi=Yn("h"),Ii=Yn("d"),Ei=Yn("w"),Ti=Yn("M"),Di=Yn("y"),Ci=Un("milliseconds"),ji=Un("seconds"),Pi=Un("minutes"),Ai=Un("hours"),ki=Un("days"),Li=Un("months"),Ni=Un("years"),Ri=Math.round,xi={s:45,m:45,h:22,d:26,M:11},Hi=Math.abs,Yi=Nt.prototype;Yi.abs=Cn,Yi.add=Pn,Yi.subtract=An,Yi.as=xn,Yi.asMilliseconds=Si,Yi.asSeconds=wi,Yi.asMinutes=Oi,Yi.asHours=Mi,Yi.asDays=Ii,Yi.asWeeks=Ei,Yi.asMonths=Ti,Yi.asYears=Di,Yi.valueOf=Hn,Yi._bubble=Ln,Yi.get=zn,Yi.milliseconds=Ci,Yi.seconds=ji,Yi.minutes=Pi,Yi.hours=Ai,Yi.days=ki,Yi.weeks=Vn,Yi.months=Li,Yi.years=Ni,Yi.humanize=Wn,Yi.toISOString=qn,Yi.toString=qn,Yi.toJSON=qn,Yi.locale=Se,Yi.localeData=we,Yi.toIsoString=at("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",qn),Yi.lang=Qr,R("X",0,0,"unix"),R("x",0,0,"valueOf"),U("x",vr),U("X",gr),B("X",function(t,e,n){n._d=new Date(1e3*parseFloat(t,10))}),B("x",function(t,e,n){n._d=new Date(m(t))}),e.version="2.11.1",n(Pt),e.fn=di,e.min=kt,e.max=Lt,e.now=qr,e.utc=s,e.unix=dn,e.months=Mn,e.isDate=i,e.locale=M,e.invalid=d,e.duration=Xt,e.isMoment=v,e.weekdays=En,e.parseZone=hn,e.localeData=E,e.isDuration=Rt,e.monthsShort=In,e.weekdaysMin=Dn,e.defineLocale=I,e.weekdaysShort=Tn,e.normalizeUnits=D,e.relativeTimeThreshold=Bn,e.prototype=di;var zi=e;return zi})}).call(e,n(67)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=n(166),u=n(191),s=i(u),c=n(193),l=i(c),f=n(195),d=i(f),h=n(15),p=r(h),_=n(24),v=r(_),y=n(9),m=r(y),g=n(45),b=r(g),S=n(146),w=r(S),O=n(25),M=r(O),I=n(151),E=r(I),T=n(48),D=r(T),C=n(51),j=r(C),P=n(27),A=r(P),k=n(58),L=r(k),N=n(13),R=r(N),x=n(29),H=r(x),Y=n(31),z=r(Y),U=n(182),V=r(U),G=n(188),F=r(G),B=n(10),W=r(B),q=function K(){o(this,K);var t=(0,s["default"])();Object.defineProperties(this,{demo:{value:!1,enumerable:!0},localStoragePreferences:{value:a.localStoragePreferences,enumerable:!0},reactor:{value:t,enumerable:!0},util:{value:d["default"],enumerable:!0},startLocalStoragePreferencesSync:{value:a.localStoragePreferences.startSync.bind(a.localStoragePreferences,t)},startUrlSync:{value:j.urlSync.startSync.bind(null,t)},stopUrlSync:{value:j.urlSync.stopSync.bind(null,t)}}),(0,l["default"])(this,t,{auth:p,config:v,entity:m,entityHistory:b,errorLog:w,event:M,logbook:E,moreInfo:D,navigation:j,notification:A,view:L,service:R,stream:H,sync:z,template:V,voice:F,restApi:W})};e["default"]=q},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(76),e["default"]=new o["default"]({is:"ha-badges-card",properties:{states:{type:Array}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a),s=n(21),c=r(s);n(36),n(35),n(19);var l=u["default"].moreInfoActions;e["default"]=new o["default"]({is:"ha-domain-card",properties:{domain:{type:String},states:{type:Array},groupEntity:{type:Object}},computeDomainTitle:function(t){return t.replace(/_/g," ")},entityTapped:function(t){if(!t.target.classList.contains("paper-toggle-button")&&!t.target.classList.contains("paper-icon-button")){t.stopPropagation();var e=t.model.item.entityId;this.async(function(){return l.selectEntity(e)},1)}},showGroupToggle:function(t,e){return!t||!e||"on"!==t.state&&"off"!==t.state?!1:e.reduce(function(t,e){return t+(0,c["default"])(e.entityId)},0)>1}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(36),e["default"]=new o["default"]({is:"ha-introduction-card",properties:{showInstallInstruction:{type:Boolean,value:!1},showHideInstruction:{type:Boolean,value:!0}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(41),u=r(a);e["default"]=new o["default"]({is:"display-time",properties:{dateObj:{type:Object}},computeTime:function(t){return t?(0,u["default"])(t):""}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s),l=o["default"].entityGetters;e["default"]=new u["default"]({is:"entity-list",behaviors:[c["default"]],properties:{entities:{type:Array,bindNuclear:[l.entityMap,function(t){return t.valueSeq().sortBy(function(t){return t.entityId}).toArray()}]}},entitySelected:function(t){t.preventDefault(),this.fire("entity-selected",{entityId:t.model.entity.entityId})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a);n(17);var s=u["default"].reactor,c=u["default"].entityGetters,l=u["default"].moreInfoActions;e["default"]=new o["default"]({is:"ha-entity-marker",properties:{entityId:{type:String,value:""},state:{type:Object,computed:"computeState(entityId)"},icon:{type:Object,computed:"computeIcon(state)"},image:{type:Object,computed:"computeImage(state)"},value:{type:String,computed:"computeValue(state)"}},listeners:{tap:"badgeTap"},badgeTap:function(t){var e=this;t.stopPropagation(),this.entityId&&this.async(function(){return l.selectEntity(e.entityId)},1)},computeState:function(t){return t&&s.evaluate(c.byId(t))},computeIcon:function(t){return!t&&"home"},computeImage:function(t){return t&&t.attributes.entity_picture},computeValue:function(t){return t&&t.entityDisplay.split(" ").map(function(t){return t.substr(0,1)}).join("")}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(125),u=r(a);e["default"]=new o["default"]({is:"ha-state-icon",properties:{stateObj:{type:Object}},computeIcon:function(t){return(0,u["default"])(t)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a),s=n(22),c=r(s),l=n(21),f=r(l);n(17);var d=u["default"].moreInfoActions,h=u["default"].serviceActions;e["default"]=new o["default"]({is:"ha-state-label-badge",properties:{state:{type:Object,observer:"stateChanged"}},listeners:{tap:"badgeTap"},badgeTap:function(t){var e=this;return t.stopPropagation(),(0,f["default"])(this.state.entityId)?void("scene"===this.state.domain?h.callTurnOn(this.state.entityId):"off"===this.state.state?h.callTurnOn(this.state.entityId):h.callTurnOff(this.state.entityId)):void this.async(function(){return d.selectEntity(e.state.entityId)},1)},computeClasses:function(t){switch(t.domain){case"scene":return"green";case"binary_sensor":case"script":return"on"===t.state?"blue":"grey";case"updater":return"blue";default:return""}},computeValue:function(t){switch(t.domain){case"binary_sensor":case"device_tracker":case"updater":case"sun":case"scene":case"script":case"alarm_control_panel":return;case"sensor":return t.state;default:return t.state}},computeIcon:function(t){switch(t.domain){case"alarm_control_panel":return"pending"===t.state?"mdi:clock-fast":"armed_away"===t.state?"mdi:nature":"armed_home"===t.state?"mdi:home-variant":(0,c["default"])(t.domain,t.state);case"binary_sensor":case"device_tracker":case"scene":case"updater":case"script":return(0,c["default"])(t.domain,t.state);case"sun":return"above_horizon"===t.state?(0,c["default"])(t.domain):"mdi:brightness-3";default:return}},computeImage:function(t){return t.attributes.entity_picture},computeLabel:function(t){switch(t.domain){case"scene":case"script":return t.domain;case"device_tracker":return"not_home"===t.state?"Away":t.state;case"alarm_control_panel":return"pending"===t.state?"pend":"armed_away"===t.state||"armed_home"===t.state?"armed":"disarm";default:return t.attributes.unit_of_measurement}},computeDescription:function(t){return t.entityDisplay},stateChanged:function(){this.updateStyles()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(75),e["default"]=new o["default"]({is:"state-badge",properties:{stateObj:{type:Object,observer:"updateIconColor"}},updateIconColor:function(t){"light"===t.domain&&"on"===t.state&&t.attributes.rgb_color&&t.attributes.rgb_color.reduce(function(t,e){return t+e},0)<730?this.$.icon.style.color="rgb("+t.attributes.rgb_color.join(",")+")":this.$.icon.style.color=null}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s),l=o["default"].eventGetters;e["default"]=new u["default"]({is:"events-list",behaviors:[c["default"]],properties:{events:{type:Array,bindNuclear:[l.entityMap,function(t){return t.valueSeq().sortBy(function(t){return t.event}).toArray()}]}},eventSelected:function(t){t.preventDefault(),this.fire("event-selected",{eventType:t.model.event.event})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return t in f?f[t]:30}function o(t){return"group"===t.domain?t.attributes.order:t.entityDisplay.toLowerCase()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(1),u=r(a),s=n(2),c=r(s);n(81),n(69),n(70),n(71);var l=c["default"].util,f={configurator:-20,group:-10,a:-1,updater:0,sun:1,device_tracker:2,alarm_control_panel:3,camera:4,sensor:5,binary_sensor:6,scene:7,script:8};e["default"]=new u["default"]({is:"ha-cards",properties:{showIntroduction:{type:Boolean,value:!1},columns:{type:Number,value:2},states:{type:Object},cards:{type:Object,computed:"computeCards(columns, states, showIntroduction)"}},computeCards:function(t,e,n){function r(t){return t.filter(function(t){return!(t.entityId in c)})}function a(){var e=h;return h=(h+1)%t,e}function u(t,e){var n=arguments.length<=2||void 0===arguments[2]?!1:arguments[2];0!==e.length&&(f._columns[a()].push(t),f[t]={entities:e,groupEntity:n})}for(var s=e.groupBy(function(t){return t.domain}),c={},f={_demo:!1,_badges:[],_columns:[]},d=0;t>d;d++)f._columns[d]=[];var h=0;return n&&a(),s.keySeq().sortBy(function(t){return i(t)}).forEach(function(t){if("a"===t)return void(f._demo=!0);var n=i(t);n>=0&&10>n?f._badges.push.apply(f._badges,r(s.get(t)).sortBy(o).toArray()):"group"===t?s.get(t).sortBy(o).forEach(function(t){var n=l.expandGroup(t,e);n.forEach(function(t){return c[t.entityId]=!0}),u(t.entityDisplay,n.toArray(),t)}):u(t,r(s.get(t)).sortBy(o).toArray())}),f},computeShouldRenderColumn:function(t,e){return 0===t||e.length},computeShowIntroduction:function(t,e,n){return 0===t&&(e||n._demo)},computeShowHideInstruction:function(t,e){return t.size>0&&!0&&!e._demo},computeGroupEntityOfCard:function(t,e){return e in t&&t[e].groupEntity},computeStatesOfCard:function(t,e){return e in t&&t[e].entities}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"ha-color-picker",properties:{color:{type:Object},width:{type:Number},height:{type:Number}},listeners:{mousedown:"onMouseDown",mouseup:"onMouseUp",touchstart:"onTouchStart",touchend:"onTouchEnd"},onMouseDown:function(t){this.onMouseMove(t),this.addEventListener("mousemove",this.onMouseMove)},onMouseUp:function(){this.removeEventListener("mousemove",this.onMouseMove)},onTouchStart:function(t){this.onTouchMove(t),this.addEventListener("touchmove",this.onTouchMove)},onTouchEnd:function(){this.removeEventListener("touchmove",this.onTouchMove)},onTouchMove:function(t){var e=this;this.mouseMoveIsThrottled&&(this.mouseMoveIsThrottled=!1,this.processColorSelect(t.touches[0]),this.async(function(){return e.mouseMoveIsThrottled=!0},100))},onMouseMove:function(t){var e=this;this.mouseMoveIsThrottled&&(this.mouseMoveIsThrottled=!1,this.processColorSelect(t),this.async(function(){return e.mouseMoveIsThrottled=!0},100))},processColorSelect:function(t){var e=this.canvas.getBoundingClientRect();t.clientX=e.left+e.width||t.clientY=e.top+e.height||this.onColorSelect(t.clientX-e.left,t.clientY-e.top)},onColorSelect:function(t,e){var n=this.context.getImageData(t,e,1,1).data;this.setColor({r:n[0],g:n[1],b:n[2]})},setColor:function(t){this.color=t,this.fire("colorselected",{rgb:this.color})},ready:function(){var t=this;this.setColor=this.setColor.bind(this),this.mouseMoveIsThrottled=!0,this.canvas=this.children[0],this.context=this.canvas.getContext("2d"),this.debounce("drawGradient",function(){var e=getComputedStyle(t),n=parseInt(e.width,10),r=parseInt(e.height,10);t.width=n,t.height=r;var i=t.context.createLinearGradient(0,0,n,0);i.addColorStop(0,"rgb(255,0,0)"),i.addColorStop(.16,"rgb(255,0,255)"),i.addColorStop(.32,"rgb(0,0,255)"),i.addColorStop(.48,"rgb(0,255,255)"),i.addColorStop(.64,"rgb(0,255,0)"),i.addColorStop(.8,"rgb(255,255,0)"),i.addColorStop(1,"rgb(255,0,0)"),t.context.fillStyle=i,t.context.fillRect(0,0,n,r);var o=t.context.createLinearGradient(0,0,0,r);o.addColorStop(0,"rgba(255,255,255,1)"),o.addColorStop(.5,"rgba(255,255,255,0)"),o.addColorStop(.5,"rgba(0,0,0,0)"),o.addColorStop(1,"rgba(0,0,0,1)"),t.context.fillStyle=o,t.context.fillRect(0,0,n,r)},100)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(17),e["default"]=new o["default"]({is:"ha-demo-badge"})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(84),e["default"]=new o["default"]({is:"ha-logbook",properties:{entries:{type:Object,value:[]}},noEntries:function(t){return!t.length}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(88);var l=o["default"].configGetters,f=o["default"].navigationGetters,d=o["default"].authActions,h=o["default"].navigationActions;e["default"]=new u["default"]({is:"ha-sidebar",behaviors:[c["default"]],properties:{menuShown:{type:Boolean},menuSelected:{type:String},selected:{type:String,bindNuclear:f.activePane,observer:"selectedChanged"},hasHistoryComponent:{type:Boolean,bindNuclear:l.isComponentLoaded("history")},hasLogbookComponent:{type:Boolean,bindNuclear:l.isComponentLoaded("logbook")}},selectedChanged:function(t){for(var e=this.querySelectorAll(".menu [data-panel]"),n=0;nnew Date&&(o=new Date);var u=e.map(function(t){function e(t,e){c&&e&&s.push([t[0]].concat(c.slice(1).map(function(t,n){return e[n]?t:null}))),s.push(t),c=t}var n=t[t.length-1],r=n.domain,a=n.entityDisplay,u=new window.google.visualization.DataTable;u.addColumn({type:"datetime",id:"Time"});var s=[],c=void 0;if("thermostat"===r){var l=t.reduce(function(t,e){return t||e.attributes.target_temp_high!==e.attributes.target_temp_low},!1);u.addColumn("number",a+" current temperature");var f=void 0;l?!function(){u.addColumn("number",a+" target temperature high"),u.addColumn("number",a+" target temperature low");var t=[!1,!0,!0];f=function(n){var r=i(n.attributes.current_temperature),o=i(n.attributes.target_temp_high),a=i(n.attributes.target_temp_low);e([n.lastUpdatedAsDate,r,o,a],t)}}():!function(){u.addColumn("number",a+" target temperature");var t=[!1,!0];f=function(n){var r=i(n.attributes.current_temperature),o=i(n.attributes.temperature);e([n.lastUpdatedAsDate,r,o],t)}}(),t.forEach(f)}else!function(){u.addColumn("number",a);var n="sensor"!==r&&[!0];t.forEach(function(t){var r=i(t.state);e([t.lastChangedAsDate,r],n)})}();return e([o].concat(c.slice(1)),!1),u.addRows(s),u}),s=void 0;s=1===u.length?u[0]:u.slice(1).reduce(function(t,e){return window.google.visualization.data.join(t,e,"full",[[0,0]],(0,a["default"])(1,t.getNumberOfColumns()),(0,a["default"])(1,e.getNumberOfColumns()))},u[0]),this.chartEngine.draw(s,n)}}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"state-history-chart-timeline",properties:{data:{type:Object,observer:"dataChanged"},isAttached:{type:Boolean,value:!1,observer:"dataChanged"}},attached:function(){this.isAttached=!0},dataChanged:function(){this.drawChart()},drawChart:function(){function t(t,e,n,r){var o=e.replace(/_/g," ");i.addRow([t,o,n,r])}if(this.isAttached){for(var e=o["default"].dom(this),n=this.data;e.node.lastChild;)e.node.removeChild(e.node.lastChild);if(n&&0!==n.length){var r=new window.google.visualization.Timeline(this),i=new window.google.visualization.DataTable;i.addColumn({type:"string",id:"Entity"}),i.addColumn({type:"string",id:"State"}),i.addColumn({type:"date",id:"Start"}),i.addColumn({type:"date",id:"End"});var a=new Date(n.reduce(function(t,e){return Math.min(t,e[0].lastChangedAsDate)},new Date)),u=new Date(a);u.setDate(u.getDate()+1),u>new Date&&(u=new Date);var s=0;n.forEach(function(e){if(0!==e.length){var n=e[0].entityDisplay,r=void 0,i=null,o=null;e.forEach(function(e){null!==i&&e.state!==i?(r=e.lastChangedAsDate,t(n,i,o,r),i=e.state,o=r):null===i&&(i=e.state,o=e.lastChangedAsDate)}),t(n,i,o,u),s++}}),r.draw(i,{height:55+42*s,timeline:{showRowLabels:n.length>1},hAxis:{format:"H:mm"}})}}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s),l=o["default"].streamGetters,f=o["default"].streamActions;e["default"]=new u["default"]({is:"stream-status",behaviors:[c["default"]],properties:{isStreaming:{type:Boolean,bindNuclear:l.isStreamingEvents},hasError:{type:Boolean,bindNuclear:l.hasStreamingEventsError}},toggleChanged:function(){this.isStreaming?f.stop():f.start()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s),l=o["default"].voiceActions,f=o["default"].voiceGetters;e["default"]=new u["default"]({is:"ha-voice-command-dialog",behaviors:[c["default"]],properties:{dialogOpen:{type:Boolean,value:!1,observer:"dialogOpenChanged"},finalTranscript:{type:String,bindNuclear:f.finalTranscript},interimTranscript:{type:String,bindNuclear:f.extraInterimTranscript},isTransmitting:{type:Boolean,bindNuclear:f.isTransmitting},isListening:{type:Boolean,bindNuclear:f.isListening},showListenInterface:{type:Boolean,computed:"computeShowListenInterface(isListening, isTransmitting)",observer:"showListenInterfaceChanged"}},computeShowListenInterface:function(t,e){return t||e},dialogOpenChanged:function(t){!t&&this.isListening&&l.stop()},showListenInterfaceChanged:function(t){!t&&this.dialogOpen?this.dialogOpen=!1:t&&(this.dialogOpen=!0)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(19),n(38),n(106);var l=o["default"].configGetters,f=o["default"].entityHistoryGetters,d=o["default"].entityHistoryActions,h=o["default"].moreInfoGetters,p=o["default"].moreInfoActions,_=["camera","configurator","scene"];e["default"]=new u["default"]({is:"more-info-dialog",behaviors:[c["default"]],properties:{stateObj:{type:Object,bindNuclear:h.currentEntity,observer:"stateObjChanged"},stateHistory:{type:Object,bindNuclear:[h.currentEntityHistory,function(t){return t?[t]:!1}]},isLoadingHistoryData:{type:Boolean,computed:"computeIsLoadingHistoryData(_delayedDialogOpen, _isLoadingHistoryData)"},_isLoadingHistoryData:{type:Boolean,bindNuclear:f.isLoadingEntityHistory},hasHistoryComponent:{type:Boolean,bindNuclear:l.isComponentLoaded("history"),observer:"fetchHistoryData"},shouldFetchHistory:{type:Boolean,bindNuclear:h.isCurrentEntityHistoryStale,observer:"fetchHistoryData"},showHistoryComponent:{type:Boolean,value:!1},dialogOpen:{type:Boolean,value:!1,observer:"dialogOpenChanged"},_delayedDialogOpen:{type:Boolean,value:!1}},computeIsLoadingHistoryData:function(t,e){return!t||e},fetchHistoryData:function(){this.stateObj&&this.hasHistoryComponent&&this.shouldFetchHistory&&d.fetchRecent(this.stateObj.entityId)},stateObjChanged:function(t){var e=this;return t?(this.showHistoryComponent=this.hasHistoryComponent&&-1===_.indexOf(this.stateObj.domain),void this.async(function(){e.fetchHistoryData(),e.dialogOpen=!0},10)):void(this.dialogOpen=!1)},dialogOpenChanged:function(t){var e=this;t?this.async(function(){return e._delayedDialogOpen=!0},10):!t&&this.stateObj&&(p.deselectEntity(),this._delayedDialogOpen=!1)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a),s=n(4),c=r(s),l=n(42),f=r(l);n(83),n(93),n(100),n(99),n(101),n(94),n(95),n(97),n(98),n(96),n(102),n(90),n(89);var d=u["default"].navigationActions,h=u["default"].navigationGetters,p=u["default"].startUrlSync,_=u["default"].stopUrlSync;e["default"]=new o["default"]({is:"home-assistant-main",behaviors:[c["default"]],properties:{narrow:{type:Boolean,value:!1},activePane:{type:String,bindNuclear:h.activePane,observer:"activePaneChanged"},isSelectedStates:{type:Boolean,bindNuclear:h.isActivePane("states")},isSelectedHistory:{type:Boolean,bindNuclear:h.isActivePane("history")},isSelectedMap:{type:Boolean,bindNuclear:h.isActivePane("map")},isSelectedLogbook:{type:Boolean,bindNuclear:h.isActivePane("logbook")},isSelectedDevEvent:{type:Boolean,bindNuclear:h.isActivePane("devEvent")},isSelectedDevState:{type:Boolean,bindNuclear:h.isActivePane("devState")},isSelectedDevTemplate:{type:Boolean,bindNuclear:h.isActivePane("devTemplate")},isSelectedDevService:{type:Boolean,bindNuclear:h.isActivePane("devService")},isSelectedDevInfo:{type:Boolean,bindNuclear:h.isActivePane("devInfo")},showSidebar:{type:Boolean,bindNuclear:h.showSidebar}},listeners:{"open-menu":"openMenu","close-menu":"closeMenu"},openMenu:function(){this.narrow?this.$.drawer.openDrawer():d.showSidebar(!0)},closeMenu:function(){this.$.drawer.closeDrawer(),this.showSidebar&&d.showSidebar(!1)},activePaneChanged:function(){this.narrow&&this.$.drawer.closeDrawer()},attached:function(){(0,f["default"])(),p()},computeForceNarrow:function(t,e){return t||!e},detached:function(){_()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a),s=n(4),c=r(s),l=n(43),f=r(l),d=n(42),h=r(d),p=u["default"].authGetters;e["default"]=new o["default"]({is:"login-form",behaviors:[c["default"]],properties:{errorMessage:{type:String,bindNuclear:p.attemptErrorMessage},isInvalid:{type:Boolean,bindNuclear:p.isInvalidAttempt},isValidating:{type:Boolean,observer:"isValidatingChanged",bindNuclear:p.isValidating},loadingResources:{type:Boolean,value:!1},forceShowLoading:{type:Boolean,value:!1},showLoading:{type:Boolean,computed:"computeShowSpinner(forceShowLoading, isValidating)"}},listeners:{keydown:"passwordKeyDown","loginButton.tap":"validatePassword"},observers:["validatingChanged(isValidating, isInvalid)"],attached:function(){(0,h["default"])()},computeShowSpinner:function(t,e){return t||e},validatingChanged:function(t,e){t||e||(this.$.passwordInput.value="")},isValidatingChanged:function(t){var e=this;t||this.async(function(){return e.$.passwordInput.focus()},10)},passwordKeyDown:function(t){13===t.keyCode?(this.validatePassword(),t.preventDefault()):this.isInvalid&&(this.isInvalid=!1)},validatePassword:function(){this.$.hideKeyboardOnFocus.focus(),(0,f["default"])(this.$.passwordInput.value,this.$.rememberLogin.checked)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(8),n(79);var l=o["default"].configGetters,f=o["default"].viewActions,d=o["default"].viewGetters,h=o["default"].voiceGetters,p=o["default"].streamGetters,_=o["default"].syncGetters,v=o["default"].syncActions,y=o["default"].voiceActions;e["default"]=new u["default"]({is:"partial-cards",behaviors:[c["default"]],properties:{narrow:{type:Boolean,value:!1},isFetching:{type:Boolean,bindNuclear:_.isFetching},isStreaming:{type:Boolean,bindNuclear:p.isStreamingEvents},canListen:{type:Boolean,bindNuclear:[h.isVoiceSupported,l.isComponentLoaded("conversation"),function(t,e){return t&&e}]},introductionLoaded:{type:Boolean,bindNuclear:l.isComponentLoaded("introduction")},locationName:{type:String,bindNuclear:l.locationName},showMenu:{type:Boolean,value:!1,observer:"windowChange"},currentView:{type:String,bindNuclear:[d.currentView,function(t){return t||""}]},views:{type:Array,bindNuclear:[d.views,function(t){return t.valueSeq().sortBy(function(t){return t.attributes.order}).toArray()}]},hasViews:{type:Boolean,computed:"computeHasViews(views)"},states:{type:Object,bindNuclear:d.currentViewEntities},columns:{type:Number,value:1}},created:function(){var t=this;this.windowChange=this.windowChange.bind(this);for(var e=[],n=0;5>n;n++)e.push(300+300*n);this.mqls=e.map(function(e){var n=window.matchMedia("(min-width: "+e+"px)");return n.addListener(t.windowChange),n})},detached:function(){var t=this;this.mqls.forEach(function(e){return e.removeListener(t.windowChange)})},windowChange:function(){var t=this.mqls.reduce(function(t,e){return t+e.matches},0);this.columns=Math.max(1,t-this.showMenu)},handleRefresh:function(){v.fetchAll()},handleListenClick:function(){y.listen()},computeMenuButtonClass:function(t,e){return!t&&e?"invisible":""},computeRefreshButtonClass:function(t){return t?"ha-spin":void 0},computeShowIntroduction:function(t,e,n){return""===t&&(e||0===n.size)},computeHasViews:function(t){return t.length>0},toggleMenu:function(){this.fire("open-menu")},viewSelected:function(t){var e=t.detail.item.getAttribute("data-entity")||null,n=this.currentView||null;e!==n&&this.async(function(){return f.selectView(e)},0)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a);n(8),n(85);var s=o["default"].reactor,c=o["default"].serviceActions,l=o["default"].serviceGetters;e["default"]=new u["default"]({is:"partial-dev-call-service",properties:{narrow:{type:Boolean,value:!1},showMenu:{type:Boolean,value:!1},domain:{type:String,value:""},service:{type:String,value:""},serviceData:{type:String,value:""},description:{type:String,computed:"computeDescription(domain, service)"}},computeDescription:function(t,e){return s.evaluate([l.entityMap,function(n){return n.has(t)&&n.get(t).get("services").has(e)?JSON.stringify(n.get(t).get("services").get(e).toJS(),null,2):"No description available"}])},serviceSelected:function(t){this.domain=t.detail.domain,this.service=t.detail.service},callService:function(){var t=void 0;try{t=this.serviceData?JSON.parse(this.serviceData):{}}catch(e){return void alert("Error parsing JSON: "+e)}c.callService(this.domain,this.service,t)},computeFormClasses:function(t){return"layout "+(t?"vertical":"horizontal")}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a);n(8),n(78);var s=o["default"].eventActions;e["default"]=new u["default"]({is:"partial-dev-fire-event",properties:{narrow:{type:Boolean,value:!1},showMenu:{type:Boolean,value:!1},eventType:{type:String,value:""},eventData:{type:String,value:""}},eventSelected:function(t){this.eventType=t.detail.eventType},fireEvent:function(){var t=void 0;try{t=this.eventData?JSON.parse(this.eventData):{}}catch(e){return void alert("Error parsing JSON: "+e)}s.fireEvent(this.eventType,t)},computeFormClasses:function(t){return"layout "+(t?"vertical":"horizontal")}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(8);var l=o["default"].configGetters,f=o["default"].errorLogActions;e["default"]=new u["default"]({is:"partial-dev-info",behaviors:[c["default"]],properties:{narrow:{type:Boolean,value:!1},showMenu:{type:Boolean,value:!1},hassVersion:{type:String,bindNuclear:l.serverVersion},polymerVersion:{type:String,value:u["default"].version},nuclearVersion:{type:String,value:"1.3.0"},errorLog:{type:String,value:""}},attached:function(){this.refreshErrorLog()},refreshErrorLog:function(t){var e=this;t&&t.preventDefault(),this.errorLog="Loading error log…",f.fetchErrorLog().then(function(t){return e.errorLog=t||"No errors have been reported."})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a);n(8),n(73);var s=o["default"].reactor,c=o["default"].entityGetters,l=o["default"].entityActions;e["default"]=new u["default"]({is:"partial-dev-set-state",properties:{narrow:{type:Boolean,value:!1},showMenu:{type:Boolean,value:!1},entityId:{type:String,value:""},state:{type:String,value:""},stateAttributes:{type:String,value:""}},setStateData:function(t){var e=t?JSON.stringify(t,null," "):"";this.$.inputData.value=e,this.$.inputDataWrapper.update(this.$.inputData)},entitySelected:function(t){var e=s.evaluate(c.byId(t.detail.entityId));this.entityId=e.entityId,this.state=e.state,this.stateAttributes=JSON.stringify(e.attributes,null," ")},handleSetState:function(){var t=void 0;try{t=this.stateAttributes?JSON.parse(this.stateAttributes):{}}catch(e){return void alert("Error parsing JSON: "+e)}l.save({entityId:this.entityId,state:this.state,attributes:t})},computeFormClasses:function(t){return"layout "+(t?"vertical":"horizontal")}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(8);var l=o["default"].templateActions;e["default"]=new u["default"]({is:"partial-dev-template",behaviors:[c["default"]],properties:{narrow:{type:Boolean,value:!1},showMenu:{type:Boolean,value:!1},error:{type:Boolean,value:!1},rendering:{type:Boolean,value:!1},template:{type:String,value:'{%- if is_state("device_tracker.paulus", "home") and \n is_state("device_tracker.anne_therese", "home") -%}\n\n You are both home, you silly\n\n{%- else -%}\n\n Anne Therese is at {{ states("device_tracker.anne_therese") }} and Paulus is at {{ states("device_tracker.paulus") }}\n\n{%- endif %}\n\nFor loop example:\n\n{% for state in states.sensor -%}\n {%- if loop.first %}The {% elif loop.last %} and the {% else %}, the {% endif -%}\n {{ state.name | lower }} is {{state.state}} {{- state.attributes.unit_of_measurement}}\n{%- endfor -%}.',observer:"templateChanged"},processed:{type:String,value:""}},computeFormClasses:function(t){return"content fit layout "+(t?"vertical":"horizontal")},computeRenderedClasses:function(t){return t?"error rendered":"rendered"},templateChanged:function(){this.error&&(this.error=!1),this.debounce("render-template",this.renderTemplate,500)},renderTemplate:function(){var t=this;this.rendering=!0,l.render(this.template).then(function(e){t.processed=e,t.rendering=!1},function(e){t.processed=e.message,t.error=!0,t.rendering=!1})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(8),n(38);var l=o["default"].entityHistoryGetters,f=o["default"].entityHistoryActions;e["default"]=new u["default"]({is:"partial-history",behaviors:[c["default"]],properties:{narrow:{type:Boolean},showMenu:{type:Boolean,value:!1},isDataLoaded:{type:Boolean,bindNuclear:l.hasDataForCurrentDate,observer:"isDataLoadedChanged"},stateHistory:{type:Object,bindNuclear:l.entityHistoryForCurrentDate},isLoadingData:{type:Boolean,bindNuclear:l.isLoadingEntityHistory},selectedDate:{type:String,value:null,bindNuclear:l.currentDate}},isDataLoadedChanged:function(t){t||this.async(function(){return f.fetchSelectedDate()},1)},handleRefreshClick:function(){f.fetchSelectedDate()},datepickerFocus:function(){this.datePicker.adjustPosition()},attached:function(){this.datePicker=new window.Pikaday({field:this.$.datePicker.inputElement,onSelect:f.changeCurrentDate})},detached:function(){this.datePicker.destroy()},computeContentClasses:function(t){return"flex content "+(t?"narrow":"wide")}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(8),n(82),n(18);var l=o["default"].logbookGetters,f=o["default"].logbookActions;e["default"]=new u["default"]({is:"partial-logbook",behaviors:[c["default"]],properties:{narrow:{type:Boolean,value:!1},showMenu:{type:Boolean,value:!1},selectedDate:{type:String,bindNuclear:l.currentDate},isLoading:{type:Boolean,bindNuclear:l.isLoadingEntries},isStale:{type:Boolean,bindNuclear:l.isCurrentStale,observer:"isStaleChanged"},entries:{type:Array,bindNuclear:[l.currentEntries,function(t){return t.reverse().toArray()}]},datePicker:{type:Object}},isStaleChanged:function(t){var e=this;t&&this.async(function(){return f.fetchDate(e.selectedDate)},1)},handleRefresh:function(){f.fetchDate(this.selectedDate)},datepickerFocus:function(){this.datePicker.adjustPosition()},attached:function(){this.datePicker=new window.Pikaday({field:this.$.datePicker.inputElement,onSelect:f.changeCurrentDate})},detached:function(){this.datePicker.destroy()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(74);var l=o["default"].configGetters,f=o["default"].entityGetters;window.L.Icon.Default.imagePath="/static/images/leaflet",e["default"]=new u["default"]({is:"partial-map",behaviors:[c["default"]],properties:{locationGPS:{type:Number,bindNuclear:l.locationGPS},locationName:{type:String,bindNuclear:l.locationName},locationEntities:{type:Array,bindNuclear:[f.visibleEntityMap,function(t){return t.valueSeq().filter(function(t){return t.attributes.latitude&&"home"!==t.state}).toArray()}]},zoneEntities:{type:Array,bindNuclear:[f.entityMap,function(t){return t.valueSeq().filter(function(t){return"zone"===t.domain&&!t.attributes.passive}).toArray()}]},narrow:{type:Boolean},showMenu:{type:Boolean,value:!1}},attached:function(){var t=this;window.L.Browser.mobileWebkit&&this.async(function(){var e=t.$.map,n=e.style.display;e.style.display="none",t.async(function(){e.style.display=n},1)},1)},computeMenuButtonClass:function(t,e){return!t&&e?"invisible":""},toggleMenu:function(){this.fire("open-menu")}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s),l=o["default"].notificationGetters;e["default"]=new u["default"]({is:"notification-manager",behaviors:[c["default"]],properties:{text:{type:String,bindNuclear:l.lastNotificationMessage,observer:"showNotification"}},showNotification:function(t){t&&this.$.toast.show()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=o["default"].serviceActions;e["default"]=new u["default"]({is:"more-info-alarm_control_panel",handleDisarmTap:function(){this.callService("alarm_disarm",{code:this.enteredCode})},handleHomeTap:function(){this.callService("alarm_arm_home",{code:this.enteredCode})},handleAwayTap:function(){this.callService("alarm_arm_away",{code:this.enteredCode})},properties:{stateObj:{type:Object,observer:"stateObjChanged"},enteredCode:{type:String,value:""},disarmButtonVisible:{type:Boolean,value:!1},armHomeButtonVisible:{type:Boolean,value:!1},armAwayButtonVisible:{type:Boolean,value:!1},codeInputVisible:{type:Boolean,value:!1},codeInputEnabled:{type:Boolean,value:!1},codeFormat:{type:String,value:""},codeValid:{type:Boolean,computed:"validateCode(enteredCode, codeFormat)"}},validateCode:function(t,e){var n=new RegExp(e);return null===e?!0:n.test(t)},stateObjChanged:function(t){var e=this;t&&(this.codeFormat=t.attributes.code_format,this.codeInputVisible=null!==this.codeFormat,this.codeInputEnabled="armed_home"===t.state||"armed_away"===t.state||"disarmed"===t.state||"pending"===t.state||"triggered"===t.state,this.disarmButtonVisible="armed_home"===t.state||"armed_away"===t.state||"pending"===t.state||"triggered"===t.state,this.armHomeButtonVisible="disarmed"===t.state,this.armAwayButtonVisible="disarmed"===t.state),this.async(function(){return e.fire("iron-resize")},500)},callService:function(t,e){var n=e||{};n.entity_id=this.stateObj.entityId,s.callService("alarm_control_panel",t,n)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"more-info-camera",properties:{stateObj:{type:Object},dialogOpen:{type:Boolean}},imageLoaded:function(){this.fire("iron-resize")},computeCameraImageUrl:function(t){return t?"/api/camera_proxy_stream/"+this.stateObj.entityId:"data:image/gif;base64,R0lGODlhAQABAAAAACw="}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(18);var l=o["default"].streamGetters,f=o["default"].syncActions,d=o["default"].serviceActions;e["default"]=new u["default"]({is:"more-info-configurator",behaviors:[c["default"]],properties:{stateObj:{type:Object},action:{type:String,value:"display"},isStreaming:{type:Boolean,bindNuclear:l.isStreamingEvents},isConfigurable:{type:Boolean,computed:"computeIsConfigurable(stateObj)"},isConfiguring:{type:Boolean,value:!1},submitCaption:{type:String,computed:"computeSubmitCaption(stateObj)"},fieldInput:{type:Object,value:{}}},computeIsConfigurable:function(t){return"configure"===t.state},computeSubmitCaption:function(t){return t.attributes.submit_caption||"Set configuration"},fieldChanged:function(t){var e=t.target;this.fieldInput[e.id]=e.value},submitClicked:function(){var t=this;this.isConfiguring=!0;var e={configure_id:this.stateObj.attributes.configure_id,fields:this.fieldInput};d.callService("configurator","configure",e).then(function(){t.isConfiguring=!1,t.isStreaming||f.fetchAll()},function(){t.isConfiguring=!1})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(126),u=r(a);n(107),n(108),n(112),n(105),n(113),n(111),n(109),n(110),n(104),n(114),n(103),e["default"]=new o["default"]({is:"more-info-content",properties:{stateObj:{type:Object,observer:"stateObjChanged"},dialogOpen:{type:Boolean,value:!1,observer:"dialogOpenChanged"}},dialogOpenChanged:function(t){var e=o["default"].dom(this);e.lastChild&&(e.lastChild.dialogOpen=t)},stateObjChanged:function(t,e){var n=o["default"].dom(this);if(!t)return void(n.lastChild&&n.removeChild(n.lastChild));var r=(0,u["default"])(t);if(e&&(0,u["default"])(e)===r)n.lastChild.dialogOpen=this.dialogOpen,n.lastChild.stateObj=t;else{n.lastChild&&n.removeChild(n.lastChild);var i=document.createElement("more-info-"+r);i.stateObj=t,i.dialogOpen=this.dialogOpen,n.appendChild(i)}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=["entity_picture","friendly_name","icon","unit_of_measurement"];e["default"]=new o["default"]({is:"more-info-default",properties:{stateObj:{type:Object}},computeDisplayAttributes:function(t){return t?Object.keys(t.attributes).filter(function(t){return-1===a.indexOf(t)}):[]},getAttributeValue:function(t,e){var n=t.attributes[e];return Array.isArray(n)?n.join(", "):n}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(19);var l=o["default"].entityGetters,f=o["default"].moreInfoGetters;e["default"]=new u["default"]({is:"more-info-group",behaviors:[c["default"]],properties:{stateObj:{type:Object},states:{type:Array,bindNuclear:[f.currentEntity,l.entityMap,function(t,e){return t?t.attributes.entity_id.map(e.get.bind(e)):[]}]}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){f.callService("light","turn_on",{entity_id:t,rgb_color:[e.r,e.g,e.b]})}Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),a=r(o),u=n(1),s=r(u),c=n(20),l=r(c);n(80);var f=a["default"].serviceActions,d=["brightness","rgb_color","color_temp"];e["default"]=new s["default"]({is:"more-info-light",properties:{stateObj:{type:Object,observer:"stateObjChanged"},brightnessSliderValue:{type:Number,value:0},ctSliderValue:{type:Number,value:0}},stateObjChanged:function(t){var e=this;t&&"on"===t.state&&(this.brightnessSliderValue=t.attributes.brightness,this.ctSliderValue=t.attributes.color_temp),this.async(function(){return e.fire("iron-resize")},500)},computeClassNames:function(t){return(0,l["default"])(t,d)},brightnessSliderChanged:function(t){var e=parseInt(t.target.value,10);isNaN(e)||(0===e?f.callTurnOff(this.stateObj.entityId):f.callService("light","turn_on",{entity_id:this.stateObj.entityId,brightness:e}))},ctSliderChanged:function(t){var e=parseInt(t.target.value,10);isNaN(e)||f.callService("light","turn_on",{entity_id:this.stateObj.entityId,color_temp:e})},colorPicked:function(t){var e=this;return this.skipColorPicked?void(this.colorChanged=!0):(this.color=t.detail.rgb,i(this.stateObj.entityId,this.color),this.colorChanged=!1,this.skipColorPicked=!0,void(this.colorDebounce=setTimeout(function(){e.colorChanged&&i(e.stateObj.entityId,e.color),e.skipColorPicked=!1},500)))}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(20),c=r(s),l=o["default"].serviceActions,f=["volume_level"];e["default"]=new u["default"]({is:"more-info-media_player",properties:{stateObj:{type:Object,observer:"stateObjChanged"},isOff:{type:Boolean,value:!1},isPlaying:{type:Boolean,value:!1},isMuted:{type:Boolean,value:!1},volumeSliderValue:{type:Number,value:0},supportsPause:{type:Boolean,value:!1},supportsVolumeSet:{type:Boolean,value:!1},supportsVolumeMute:{type:Boolean,value:!1},supportsPreviousTrack:{type:Boolean,value:!1},supportsNextTrack:{type:Boolean,value:!1},supportsTurnOn:{type:Boolean,value:!1},supportsTurnOff:{type:Boolean,value:!1},supportsVolumeButtons:{type:Boolean,value:!1},hasMediaControl:{type:Boolean,value:!1}},stateObjChanged:function(t){var e=this;if(t){var n=["playing","paused","unknown"];this.isOff="off"===t.state,this.isPlaying="playing"===t.state,this.hasMediaControl=-1!==n.indexOf(t.state),this.volumeSliderValue=100*t.attributes.volume_level,this.isMuted=t.attributes.is_volume_muted,this.supportsPause=0!==(1&t.attributes.supported_media_commands),this.supportsVolumeSet=0!==(4&t.attributes.supported_media_commands),this.supportsVolumeMute=0!==(8&t.attributes.supported_media_commands),this.supportsPreviousTrack=0!==(16&t.attributes.supported_media_commands),this.supportsNextTrack=0!==(32&t.attributes.supported_media_commands),this.supportsTurnOn=0!==(128&t.attributes.supported_media_commands),this.supportsTurnOff=0!==(256&t.attributes.supported_media_commands),this.supportsVolumeButtons=0!==(1024&t.attributes.supported_media_commands)}this.async(function(){return e.fire("iron-resize")},500)},computeClassNames:function(t){return(0,c["default"])(t,f)},computeIsOff:function(t){return"off"===t.state},computeMuteVolumeIcon:function(t){return t?"mdi:volume-off":"mdi:volume-high"},computeHideVolumeButtons:function(t,e){return!e||t},computeShowPlaybackControls:function(t,e){return!t&&e},computePlaybackControlIcon:function(){return this.isPlaying?this.supportsPause?"mdi:pause":"mdi:stop":"mdi:play"},computeHidePowerButton:function(t,e,n){return t?!e:!n},handleTogglePower:function(){this.callService(this.isOff?"turn_on":"turn_off")},handlePrevious:function(){this.callService("media_previous_track")},handlePlaybackControl:function(){this.callService("media_play_pause")},handleNext:function(){this.callService("media_next_track")},handleVolumeTap:function(){this.supportsVolumeMute&&this.callService("volume_mute",{is_volume_muted:!this.isMuted})},handleVolumeUp:function(){var t=this.$.volumeUp;this.handleVolumeWorker("volume_up",t,!0); -},handleVolumeDown:function(){var t=this.$.volumeDown;this.handleVolumeWorker("volume_down",t,!0)},handleVolumeWorker:function(t,e,n){var r=this;(n||void 0!==e&&e.pointerDown)&&(this.callService(t),this.async(function(){return r.handleVolumeWorker(t,e,!1)},500))},volumeSliderChanged:function(t){var e=parseFloat(t.target.value),n=e>0?e/100:0;this.callService("volume_set",{volume_level:n})},callService:function(t,e){var n=e||{};n.entity_id=this.stateObj.entityId,l.callService("media_player",t,n)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"more-info-script",properties:{stateObj:{type:Object}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a),s=n(41),c=r(s),l=u["default"].util.parseDateTime;e["default"]=new o["default"]({is:"more-info-sun",properties:{stateObj:{type:Object},risingDate:{type:Object,computed:"computeRising(stateObj)"},settingDate:{type:Object,computed:"computeSetting(stateObj)"}},computeRising:function(t){return l(t.attributes.next_rising)},computeSetting:function(t){return l(t.attributes.next_setting)},computeOrder:function(t,e){return t>e?["set","ris"]:["ris","set"]},itemCaption:function(t){return"ris"===t?"Rising ":"Setting "},itemDate:function(t){return"ris"===t?this.risingDate:this.settingDate},itemValue:function(t){return(0,c["default"])(this.itemDate(t))}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(20),c=r(s),l=o["default"].serviceActions,f=["away_mode"];e["default"]=new u["default"]({is:"more-info-thermostat",properties:{stateObj:{type:Object,observer:"stateObjChanged"},tempMin:{type:Number},tempMax:{type:Number},targetTemperatureSliderValue:{type:Number},awayToggleChecked:{type:Boolean}},stateObjChanged:function(t){this.targetTemperatureSliderValue=t.attributes.temperature,this.awayToggleChecked="on"===t.attributes.away_mode,this.tempMin=t.attributes.min_temp,this.tempMax=t.attributes.max_temp},computeClassNames:function(t){return(0,c["default"])(t,f)},targetTemperatureSliderChanged:function(t){l.callService("thermostat","set_temperature",{entity_id:this.stateObj.entityId,temperature:t.target.value})},toggleChanged:function(t){var e=t.target.checked;e&&"off"===this.stateObj.attributes.away_mode?this.service_set_away(!0):e||"on"!==this.stateObj.attributes.away_mode||this.service_set_away(!1)},service_set_away:function(t){var e=this;l.callService("thermostat","set_away_mode",{away_mode:t,entity_id:this.stateObj.entityId}).then(function(){return e.stateObjChanged(e.stateObj)})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"more-info-updater",properties:{}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7),n(39),e["default"]=new o["default"]({is:"state-card-configurator",properties:{stateObj:{type:Object}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a);n(7);var s=o["default"].serviceActions;e["default"]=new u["default"]({is:"state-card-input_select",properties:{stateObj:{type:Object},selectedOption:{type:String,observer:"selectedOptionChanged"}},computeSelected:function(t){return t.attributes.options.indexOf(t.state)},selectedOptionChanged:function(t){""!==t&&t!==this.stateObj.state&&s.callService("input_select","select_option",{option:t,entity_id:this.stateObj.entityId})},stopPropagation:function(t){t.stopPropagation()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7);var a=["playing","paused"];e["default"]=new o["default"]({is:"state-card-media_player",properties:{stateObj:{type:Object},isPlaying:{type:Boolean,computed:"computeIsPlaying(stateObj)"}},computeIsPlaying:function(t){return-1!==a.indexOf(t.state)},computePrimaryText:function(t,e){return e?t.attributes.media_title:t.stateDisplay},computeSecondaryText:function(t){var e=void 0;return"music"===t.attributes.media_content_type?t.attributes.media_artist:"tvshow"===t.attributes.media_content_type?(e=t.attributes.media_series_title,t.attributes.media_season&&t.attributes.media_episode&&(e+=" S"+t.attributes.media_season+"E"+t.attributes.media_episode),e):t.attributes.app_name?t.attributes.app_name:""}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a);n(7);var s=o["default"].serviceActions;e["default"]=new u["default"]({is:"state-card-rollershutter",properties:{stateObj:{type:Object}},computeIsFullyOpen:function(t){return 100===t.attributes.current_position},computeIsFullyClosed:function(t){return 0===t.attributes.current_position},onMoveUpTap:function(){s.callService("rollershutter","move_up",{entity_id:this.stateObj.entityId})},onMoveDownTap:function(){s.callService("rollershutter","move_down",{entity_id:this.stateObj.entityId})},onStopTap:function(){s.callService("rollershutter","stop",{entity_id:this.stateObj.entityId})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a);n(7);var s=u["default"].serviceActions;e["default"]=new o["default"]({is:"state-card-scene",properties:{stateObj:{type:Object}},activateScene:function(){s.callTurnOn(this.stateObj.entityId)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7),e["default"]=new o["default"]({is:"state-card-thermostat",properties:{stateObj:{type:Object}},computeTargetTemperature:function(t){return t.attributes.temperature+" "+t.attributes.unit_of_measurement}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7),n(35),e["default"]=new o["default"]({is:"state-card-toggle"})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7),e["default"]=new o["default"]({is:"state-card-weblink",properties:{stateObj:{type:Object}},listeners:{tap:"onTap"},onTap:function(t){t.stopPropagation(),window.open(this.stateObj.state,"_blank")}})},function(t,e){"use strict";function n(t){return{attached:function(){var e=this;this.__unwatchFns=Object.keys(this.properties).reduce(function(n,r){if(!("bindNuclear"in e.properties[r]))return n;var i=e.properties[r].bindNuclear;if(!i)throw new Error("Undefined getter specified for key "+r);return e[r]=t.evaluate(i),n.concat(t.observe(i,function(t){e[r]=t}))},[])},detached:function(){for(;this.__unwatchFns.length;)this.__unwatchFns.shift()()}}}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return-1!==u.indexOf(t.domain)?t.domain:(0,a["default"])(t.entityId)?"toggle":"display"}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var o=n(21),a=r(o),u=["configurator","input_select","media_player","rollershutter","scene","thermostat","weblink"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if(!t)return a["default"];if(t.attributes.icon)return t.attributes.icon;var e=t.attributes.unit_of_measurement;return!e||"sensor"!==t.domain||e!==f.UNIT_TEMP_C&&e!==f.UNIT_TEMP_F?(0,s["default"])(t.domain,t.state):"mdi:thermometer"}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var o=n(40),a=r(o),u=n(22),s=r(u),c=n(2),l=r(c),f=l["default"].util.temperatureUnits},function(t,e){"use strict";function n(t){return-1!==r.indexOf(t.domain)?t.domain:"default"}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n;var r=["light","group","sun","configurator","thermostat","script","media_player","camera","updater","alarm_control_panel"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(196),i=n(15),o=function(t,e,n){var o=arguments.length<=3||void 0===arguments[3]?null:arguments[3],a=t.evaluate(i.getters.authInfo),u=a.host+"/api/"+n;return new r.Promise(function(t,n){var r=new XMLHttpRequest;r.open(e,u,!0),r.setRequestHeader("X-HA-access",a.authToken),r.onload=function(){var e=void 0;try{e="application/json"===r.getResponseHeader("content-type")?JSON.parse(r.responseText):r.responseText}catch(i){e=r.responseText}r.status>199&&r.status<300?t(e):n(e)},r.onerror=function(){return n({})},o?r.send(JSON.stringify(o)):r.send()})};e["default"]=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],r=n.useStreaming,i=void 0===r?t.evaluate(c.getters.isSupported):r,o=n.rememberAuth,a=void 0===o?!1:o,s=n.host,d=void 0===s?"":s;t.dispatch(u["default"].VALIDATING_AUTH_TOKEN,{authToken:e,host:d}),l.actions.fetchAll(t).then(function(){t.dispatch(u["default"].VALID_AUTH_TOKEN,{authToken:e,host:d,rememberAuth:a}),i?c.actions.start(t,{syncOnInitialConnect:!1}):l.actions.start(t,{skipInitialSync:!0})},function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=e.message,r=void 0===n?f:n;t.dispatch(u["default"].INVALID_AUTH_TOKEN,{errorMessage:r})})}function o(t){(0,s.callApi)(t,"POST","log_out"),t.dispatch(u["default"].LOG_OUT,{})}Object.defineProperty(e,"__esModule",{value:!0}),e.validate=i,e.logOut=o;var a=n(14),u=r(a),s=n(5),c=n(29),l=n(31),f="Unexpected result from API"},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=e.isValidating=["authAttempt","isValidating"],r=(e.isInvalidAttempt=["authAttempt","isInvalid"],e.attemptErrorMessage=["authAttempt","errorMessage"],e.rememberAuth=["rememberAuth"],e.attemptAuthInfo=[["authAttempt","authToken"],["authAttempt","host"],function(t,e){return{authToken:t,host:e}}]),i=e.currentAuthToken=["authCurrent","authToken"],o=e.currentAuthInfo=[i,["authCurrent","host"],function(t,e){return{authToken:t,host:e}}];e.authToken=[n,["authAttempt","authToken"],["authCurrent","authToken"],function(t,e,n){return t?e:n}],e.authInfo=[n,r,o,function(t,e,n){return t?e:n}]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if(null==t)throw new TypeError("Cannot destructure undefined")}function o(t,e){var n=e.authToken,r=e.host;return(0,s.toImmutable)({authToken:n,host:r,isValidating:!0,isInvalid:!1,errorMessage:""})}function a(t,e){return i(e),f.getInitialState()}function u(t,e){var n=e.errorMessage;return t.withMutations(function(t){return t.set("isValidating",!1).set("isInvalid",!0).set("errorMessage",n)})}Object.defineProperty(e,"__esModule",{value:!0});var s=n(3),c=n(14),l=r(c),f=new s.Store({getInitialState:function(){return(0,s.toImmutable)({isValidating:!1,authToken:!1,host:null,isInvalid:!1,errorMessage:""})},initialize:function(){this.on(l["default"].VALIDATING_AUTH_TOKEN,o),this.on(l["default"].VALID_AUTH_TOKEN,a),this.on(l["default"].INVALID_AUTH_TOKEN,u)}});e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.authToken,r=e.host;return(0,a.toImmutable)({authToken:n,host:r})}function o(){return c.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(14),s=r(u),c=new a.Store({getInitialState:function(){return(0,a.toImmutable)({authToken:null,host:""})},initialize:function(){this.on(s["default"].VALID_AUTH_TOKEN,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.rememberAuth;return n}Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(14),u=r(a),s=new o.Store({getInitialState:function(){return!0},initialize:function(){this.on(u["default"].VALID_AUTH_TOKEN,i)}});e["default"]=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){t.dispatch(c["default"].SERVER_CONFIG_LOADED,e)}function o(t){(0,u.callApi)(t,"GET","config").then(function(e){return i(t,e)})}function a(t,e){t.dispatch(c["default"].COMPONENT_LOADED,{component:e})}Object.defineProperty(e,"__esModule",{value:!0}),e.configLoaded=i,e.fetchAll=o,e.componentLoaded=a;var u=n(5),s=n(23),c=r(s)},function(t,e){"use strict";function n(t){return[["serverComponent"],function(e){return e.contains(t)}]}Object.defineProperty(e,"__esModule",{value:!0}),e.isComponentLoaded=n,e.locationGPS=[["serverConfig","latitude"],["serverConfig","longitude"],function(t,e){return{latitude:t,longitude:e}}],e.locationName=["serverConfig","location_name"],e.serverVersion=["serverConfig","serverVersion"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.component;return t.push(n)}function o(t,e){var n=e.components;return(0,u.toImmutable)(n)}function a(){return l.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var u=n(3),s=n(23),c=r(s),l=new u.Store({getInitialState:function(){return(0,u.toImmutable)([])},initialize:function(){this.on(c["default"].COMPONENT_LOADED,i),this.on(c["default"].SERVER_CONFIG_LOADED,o),this.on(c["default"].LOG_OUT,a)}});e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.latitude,r=e.longitude,i=e.location_name,o=e.temperature_unit,u=e.time_zone,s=e.version;return(0,a.toImmutable)({latitude:n,longitude:r,location_name:i,temperature_unit:o,time_zone:u,serverVersion:s})}function o(){return c.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(23),s=r(u),c=new a.Store({getInitialState:function(){return(0,a.toImmutable)({latitude:null,longitude:null,location_name:"Home",temperature_unit:"°C",time_zone:"UTC",serverVersion:"unknown"})},initialize:function(){this.on(s["default"].SERVER_CONFIG_LOADED,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=c},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){t.dispatch(f["default"].ENTITY_HISTORY_DATE_SELECTED,{date:e})}function a(t){var e=arguments.length<=1||void 0===arguments[1]?null:arguments[1];t.dispatch(f["default"].RECENT_ENTITY_HISTORY_FETCH_START,{});var n="history/period";return null!==e&&(n+="?filter_entity_id="+e),(0,c.callApi)(t,"GET",n).then(function(e){return t.dispatch(f["default"].RECENT_ENTITY_HISTORY_FETCH_SUCCESS,{stateHistory:e})},function(){return t.dispatch(f["default"].RECENT_ENTITY_HISTORY_FETCH_ERROR,{})})}function u(t,e){return t.dispatch(f["default"].ENTITY_HISTORY_FETCH_START,{date:e}),(0,c.callApi)(t,"GET","history/period/"+e).then(function(n){return t.dispatch(f["default"].ENTITY_HISTORY_FETCH_SUCCESS,{date:e,stateHistory:n})},function(){return t.dispatch(f["default"].ENTITY_HISTORY_FETCH_ERROR,{})})}function s(t){var e=t.evaluate(h.currentDate);return u(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.changeCurrentDate=o,e.fetchRecent=a,e.fetchDate=u,e.fetchSelectedDate=s;var c=n(5),l=n(11),f=i(l),d=n(44),h=r(d)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.date;return(0,s["default"])(n)}function o(){return f.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(32),s=r(u),c=n(11),l=r(c),f=new a.Store({getInitialState:function(){var t=new Date;return t.setDate(t.getDate()-1),(0,s["default"])(t)},initialize:function(){this.on(l["default"].ENTITY_HISTORY_DATE_SELECTED,i),this.on(l["default"].LOG_OUT,o)}});e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.date,r=e.stateHistory;return 0===r.length?t.set(n,(0,a.toImmutable)({})):t.withMutations(function(t){r.forEach(function(e){return t.setIn([n,e[0].entity_id],(0,a.toImmutable)(e.map(l["default"].fromJSON)))})})}function o(){return f.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(11),s=r(u),c=n(16),l=r(c),f=new a.Store({getInitialState:function(){return(0,a.toImmutable)({})},initialize:function(){this.on(s["default"].ENTITY_HISTORY_FETCH_SUCCESS,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(3),o=n(11),a=r(o),u=new i.Store({getInitialState:function(){return!1},initialize:function(){this.on(a["default"].ENTITY_HISTORY_FETCH_START,function(){return!0}),this.on(a["default"].ENTITY_HISTORY_FETCH_SUCCESS,function(){return!1}),this.on(a["default"].ENTITY_HISTORY_FETCH_ERROR,function(){return!1}),this.on(a["default"].RECENT_ENTITY_HISTORY_FETCH_START,function(){return!0}),this.on(a["default"].RECENT_ENTITY_HISTORY_FETCH_SUCCESS,function(){return!1}),this.on(a["default"].RECENT_ENTITY_HISTORY_FETCH_ERROR,function(){return!1}),this.on(a["default"].LOG_OUT,function(){return!1})}});e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.stateHistory;return t.withMutations(function(t){n.forEach(function(e){return t.set(e[0].entity_id,(0,a.toImmutable)(e.map(l["default"].fromJSON)))})})}function o(){return f.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(11),s=r(u),c=n(16),l=r(c),f=new a.Store({getInitialState:function(){return(0,a.toImmutable)({})},initialize:function(){this.on(s["default"].RECENT_ENTITY_HISTORY_FETCH_SUCCESS,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.stateHistory,r=(new Date).getTime();return t.withMutations(function(t){n.forEach(function(e){return t.set(e[0].entity_id,r)}),history.length>1&&t.set(c,r)})}function o(){return l.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(11),s=r(u),c="ALL_ENTRY_FETCH",l=new a.Store({getInitialState:function(){return(0,a.toImmutable)({})},initialize:function(){this.on(s["default"].RECENT_ENTITY_HISTORY_FETCH_SUCCESS,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(10),o=n(16),a=r(o),u=(0,i.createApiActions)(a["default"]);e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.visibleEntityMap=e.byId=e.entityMap=e.hasData=void 0;var i=n(10),o=n(16),a=r(o),u=(e.hasData=(0,i.createHasDataGetter)(a["default"]),e.entityMap=(0,i.createEntityMapGetter)(a["default"]));e.byId=(0,i.createByIdGetter)(a["default"]),e.visibleEntityMap=[u,function(t){return t.filter(function(t){return!t.attributes.hidden})}]},function(t,e,n){"use strict";function r(t){return(0,i.callApi)(t,"GET","error_log")}Object.defineProperty(e,"__esModule",{value:!0}),e.fetchErrorLog=r;var i=n(5)},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}Object.defineProperty(e,"__esModule",{value:!0}),e.actions=void 0;var i=n(145),o=r(i);e.actions=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(5),o=n(10),a=n(27),u=n(46),s=r(u),c=(0,o.createApiActions)(s["default"]);c.fireEvent=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return(0,i.callApi)(t,"POST","events/"+e,n).then(function(){a.actions.createNotification(t,"Event "+e+" successful fired!")})},e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.byId=e.entityMap=e.hasData=void 0;var i=n(10),o=n(46),a=r(o);e.hasData=(0,i.createHasDataGetter)(a["default"]),e.entityMap=(0,i.createEntityMapGetter)(a["default"]),e.byId=(0,i.createByIdGetter)(a["default"])},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){t.dispatch(s["default"].LOGBOOK_DATE_SELECTED,{date:e})}function o(t,e){t.dispatch(s["default"].LOGBOOK_ENTRIES_FETCH_START,{date:e}),(0,a.callApi)(t,"GET","logbook/"+e).then(function(n){return t.dispatch(s["default"].LOGBOOK_ENTRIES_FETCH_SUCCESS,{date:e,entries:n})},function(){return t.dispatch(s["default"].LOGBOOK_ENTRIES_FETCH_ERROR,{})})}Object.defineProperty(e,"__esModule",{value:!0}),e.changeCurrentDate=i,e.fetchDate=o;var a=n(5),u=n(12),s=r(u)},function(t,e,n){"use strict";function r(t){return!t||(new Date).getTime()-t>o}Object.defineProperty(e,"__esModule",{value:!0}),e.isLoadingEntries=e.currentEntries=e.isCurrentStale=e.currentDate=void 0;var i=n(3),o=6e4,a=e.currentDate=["currentLogbookDate"];e.isCurrentStale=[a,["logbookEntriesUpdated"],function(t,e){return r(e.get(t))}],e.currentEntries=[a,["logbookEntries"],function(t,e){return e.get(t)||(0,i.toImmutable)([])}],e.isLoadingEntries=["isLoadingLogbookEntries"]},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t){t.registerStores({currentLogbookDate:u["default"],isLoadingLogbookEntries:c["default"],logbookEntries:f["default"],logbookEntriesUpdated:h["default"]})}Object.defineProperty(e,"__esModule",{value:!0}),e.getters=e.actions=void 0,e.register=o;var a=n(153),u=i(a),s=n(154),c=i(s),l=n(155),f=i(l),d=n(156),h=i(d),p=n(149),_=r(p),v=n(150),y=r(v);e.actions=_,e.getters=y},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=function(){function t(t,e){for(var n=0;n1?r[1]:null,t.batch(function(){(0,h.navigate)(t,e),n&&f.actions.selectView(t,n)})}history.replaceState(i(e,n),_,o(e,n))}function u(t,e){var n=e.state,i=n.pane,o=n.view;t.evaluate(l.getters.hasCurrentEntityId)?(r(t).ignoreNextDeselectEntity=!0,l.actions.deselectEntity(t)):(i!==t.evaluate(d.activePane)||o!==t.evaluate(f.getters.currentView))&&t.batch(function(){(0,h.navigate)(t,i),void 0!==o&&f.actions.selectView(t,o)})}function s(t){if(p){a(t);var e={ignoreNextDeselectEntity:!1,popstateChangeListener:u.bind(null,t),unwatchNavigationObserver:t.observe(d.activePane,function(t){t!==history.state.pane&&history.pushState(i(t,history.state.view),_,o(t,history.state.view))}),unwatchViewObserver:t.observe(f.getters.currentView,function(t){t!==history.state.view&&history.pushState(i(history.state.pane,t),_,o(history.state.pane,t))}),unwatchMoreInfoObserver:t.observe(l.getters.hasCurrentEntityId,function(t){t?history.pushState(history.state,_,window.location.pathname):e.ignoreNextDeselectEntity?e.ignoreNextDeselectEntity=!1:history.back()})};v[t.hassId]=e,window.addEventListener("popstate",e.popstateChangeListener)}}function c(t){if(p){var e=r(t);e&&(e.unwatchNavigationObserver(),e.unwatchViewObserver(),e.unwatchMoreInfoObserver(),window.removeEventListener("popstate",e.popstateChangeListener),v[t.hassId]=!1)}}Object.defineProperty(e,"__esModule",{value:!0}),e.startSync=s,e.stopSync=c;var l=n(48),f=n(58),d=n(50),h=n(49),p=history.pushState&&!0,_="Home Assistant",v={}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){t.dispatch(a["default"].NOTIFICATION_CREATED,{message:e})}Object.defineProperty(e,"__esModule",{value:!0}),e.createNotification=i;var o=n(52),a=r(o)},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=e.notificationMap=["notifications"];e.lastNotificationMessage=[n,function(t){return t.last()}]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.message;return t.set(t.size,n)}function o(){return c.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(52),s=r(u),c=new a.Store({getInitialState:function(){return new a.Immutable.OrderedMap},initialize:function(){this.on(s["default"].NOTIFICATION_CREATED,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.localStoragePreferences=void 0;var i=n(167),o=r(i);e.localStoragePreferences=o["default"]},function(t,e,n){"use strict";function r(){if(!("localStorage"in window))return{};var t=window.localStorage,e="___test";try{return t.setItem(e,e),t.removeItem(e),t}catch(n){return{}}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(15),o=n(29),a=n(51),u=r(),s={authToken:{getter:[i.getters.currentAuthToken,i.getters.rememberAuth,function(t,e){return e?t:null}],defaultValue:null},useStreaming:{getter:o.getters.useStreaming,defaultValue:!0},showSidebar:{getter:a.getters.showSidebar,defaultValue:!1}},c={};Object.keys(s).forEach(function(t){t in u||(u[t]=s[t].defaultValue),Object.defineProperty(c,t,{get:function(){try{return JSON.parse(u[t])}catch(e){return s[t].defaultValue}}})}),c.startSync=function(t){Object.keys(s).forEach(function(e){var n=s[e].getter,r=function(t){u[e]=JSON.stringify(t)};t.observe(n,r),r(t.evaluate(n))})},e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){var e={};return e.incrementData=function(e,n){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2]; -o(e,t,r,n)},e.replaceData=function(e,n){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];o(e,t,f({},r,{replace:!0}),n)},t.fetch&&(e.fetch=function(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return e.dispatch(h["default"].API_FETCH_START,{model:t,params:n,method:"fetch"}),t.fetch(e,n).then(o.bind(null,e,t,n),a.bind(null,e,t,n))}),e.fetchAll=function(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return e.dispatch(h["default"].API_FETCH_START,{model:t,params:n,method:"fetchAll"}),t.fetchAll(e,n).then(o.bind(null,e,t,f({},n,{replace:!0})),a.bind(null,e,t,n))},t.save&&(e.save=function(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return e.dispatch(h["default"].API_SAVE_START,{params:n}),t.save(e,n).then(u.bind(null,e,t,n),s.bind(null,e,t,n))}),t["delete"]&&(e["delete"]=function(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return e.dispatch(h["default"].API_DELETE_START,{params:n}),t["delete"](e,n).then(c.bind(null,e,t,n),l.bind(null,e,t,n))}),e}function o(t,e,n,r){return t.dispatch(h["default"].API_FETCH_SUCCESS,{model:e,params:n,result:r}),r}function a(t,e,n,r){return t.dispatch(h["default"].API_FETCH_FAIL,{model:e,params:n,reason:r}),Promise.reject(r)}function u(t,e,n,r){return t.dispatch(h["default"].API_SAVE_SUCCESS,{model:e,params:n,result:r}),r}function s(t,e,n,r){return t.dispatch(h["default"].API_SAVE_FAIL,{model:e,params:n,reason:r}),Promise.reject(r)}function c(t,e,n,r){return t.dispatch(h["default"].API_DELETE_SUCCESS,{model:e,params:n,result:r}),r}function l(t,e,n,r){return t.dispatch(h["default"].API_DELETE_FAIL,{model:e,params:n,reason:r}),Promise.reject(r)}var f=Object.assign||function(t){for(var e=1;et;t+=2){var e=rt[t],n=rt[t+1];e(n),rt[t]=void 0,rt[t+1]=void 0}$=0}function y(){try{var t=n(212);return W=t.runOnLoop||t.runOnContext,d()}catch(e){return _()}}function m(){}function g(){return new TypeError("You cannot resolve a promise with itself")}function b(){return new TypeError("A promises callback cannot return that same promise.")}function S(t){try{return t.then}catch(e){return ut.error=e,ut}}function w(t,e,n,r){try{t.call(e,n,r)}catch(i){return i}}function O(t,e,n){Z(function(t){var r=!1,i=w(n,e,function(n){r||(r=!0,e!==n?E(t,n):D(t,n))},function(e){r||(r=!0,C(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&i&&(r=!0,C(t,i))},t)}function M(t,e){e._state===ot?D(t,e._result):e._state===at?C(t,e._result):j(e,void 0,function(e){E(t,e)},function(e){C(t,e)})}function I(t,e){if(e.constructor===t.constructor)M(t,e);else{var n=S(e);n===ut?C(t,ut.error):void 0===n?D(t,e):u(n)?O(t,e,n):D(t,e)}}function E(t,e){t===e?C(t,g()):a(e)?I(t,e):D(t,e)}function T(t){t._onerror&&t._onerror(t._result),P(t)}function D(t,e){t._state===it&&(t._result=e,t._state=ot,0!==t._subscribers.length&&Z(P,t))}function C(t,e){t._state===it&&(t._state=at,t._result=e,Z(T,t))}function j(t,e,n,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+ot]=n,i[o+at]=r,0===o&&t._state&&Z(P,t)}function P(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,i,o=t._result,a=0;aa;a++)j(r.resolve(t[a]),void 0,e,n);return i}function Y(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(m);return E(n,t),n}function z(t){var e=this,n=new e(m);return C(n,t),n}function U(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function V(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function G(t){this._id=pt++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==t&&(u(t)||U(),this instanceof G||V(),N(this,t))}function F(){var t;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(t.Promise=_t)}var B;B=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var W,q,K,J=B,$=0,Z=({}.toString,function(t,e){rt[$]=t,rt[$+1]=e,$+=2,2===$&&(q?q(v):K())}),X="undefined"!=typeof window?window:void 0,Q=X||{},tt=Q.MutationObserver||Q.WebKitMutationObserver,et="undefined"!=typeof t&&"[object process]"==={}.toString.call(t),nt="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,rt=new Array(1e3);K=et?f():tt?h():nt?p():void 0===X?y():_();var it=void 0,ot=1,at=2,ut=new A,st=new A;R.prototype._validateInput=function(t){return J(t)},R.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},R.prototype._init=function(){this._result=new Array(this.length)};var ct=R;R.prototype._enumerate=function(){for(var t=this,e=t.length,n=t.promise,r=t._input,i=0;n._state===it&&e>i;i++)t._eachEntry(r[i],i)},R.prototype._eachEntry=function(t,e){var n=this,r=n._instanceConstructor;s(t)?t.constructor===r&&t._state!==it?(t._onerror=null,n._settledAt(t._state,e,t._result)):n._willSettleAt(r.resolve(t),e):(n._remaining--,n._result[e]=t)},R.prototype._settledAt=function(t,e,n){var r=this,i=r.promise;i._state===it&&(r._remaining--,t===at?C(i,n):r._result[e]=n),0===r._remaining&&D(i,r._result)},R.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,function(t){n._settledAt(ot,e,t)},function(t){n._settledAt(at,e,t)})};var lt=x,ft=H,dt=Y,ht=z,pt=0,_t=G;G.all=lt,G.race=ft,G.resolve=dt,G.reject=ht,G._setScheduler=c,G._setAsap=l,G._asap=Z,G.prototype={constructor:G,then:function(t,e){var n=this,r=n._state;if(r===ot&&!t||r===at&&!e)return this;var i=new this.constructor(m),o=n._result;if(r){var a=arguments[r-1];Z(function(){L(r,i,a,o)})}else j(n,i,t,e);return i},"catch":function(t){return this.then(null,t)}};var vt=F,yt={Promise:_t,polyfill:vt};n(210).amd?(r=function(){return yt}.call(e,n,e,o),!(void 0!==r&&(o.exports=r))):"undefined"!=typeof o&&o.exports?o.exports=yt:"undefined"!=typeof this&&(this.ES6Promise=yt),vt()}).call(this)}).call(e,n(211),function(){return this}(),n(67)(t))},function(t,e,n){var r=n(62),i=r(Date,"now"),o=i||function(){return(new Date).getTime()};t.exports=o},function(t,e){function n(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=9007199254740991;t.exports=n},function(t,e,n){var r=n(62),i=n(198),o=n(63),a="[object Array]",u=Object.prototype,s=u.toString,c=r(Array,"isArray"),l=c||function(t){return o(t)&&i(t.length)&&s.call(t)==a};t.exports=l},function(t,e,n){function r(t){return null==t?!1:i(t)?l.test(s.call(t)):o(t)&&a.test(t)}var i=n(64),o=n(63),a=/^\[object .+?Constructor\]$/,u=Object.prototype,s=Function.prototype.toString,c=u.hasOwnProperty,l=RegExp("^"+s.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=r},function(t,e){function n(t){return function(e){return null==e?void 0:e[t]}}t.exports=n},function(t,e,n){var r=n(201),i=r("length");t.exports=i},function(t,e,n){function r(t){return null!=t&&o(i(t))}var i=n(202),o=n(206);t.exports=r},function(t,e){function n(t,e){return t="number"==typeof t||r.test(t)?+t:-1,e=null==e?i:e,t>-1&&t%1==0&&e>t}var r=/^\d+$/,i=9007199254740991;t.exports=n},function(t,e,n){function r(t,e,n){if(!a(n))return!1;var r=typeof e;if("number"==r?i(n)&&o(e,n.length):"string"==r&&e in n){var u=n[e];return t===t?t===u:u!==u}return!1}var i=n(203),o=n(204),a=n(207);t.exports=r},function(t,e){function n(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=9007199254740991;t.exports=n},function(t,e){function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=n},function(t,e,n){function r(t,e,n){n&&i(t,e,n)&&(e=n=void 0),t=+t||0,n=null==n?1:+n||0,null==e?(e=t,t=0):e=+e||0;for(var r=-1,u=a(o((e-t)/(n||1)),0),s=Array(u);++r1)for(var n=1;n \ No newline at end of file +},handleVolumeDown:function(){var t=this.$.volumeDown;this.handleVolumeWorker("volume_down",t,!0)},handleVolumeWorker:function(t,e,n){var r=this;(n||void 0!==e&&e.pointerDown)&&(this.callService(t),this.async(function(){return r.handleVolumeWorker(t,e,!1)},500))},volumeSliderChanged:function(t){var e=parseFloat(t.target.value),n=e>0?e/100:0;this.callService("volume_set",{volume_level:n})},callService:function(t,e){var n=e||{};n.entity_id=this.stateObj.entityId,l.callService("media_player",t,n)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"more-info-script",properties:{stateObj:{type:Object}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a),s=n(41),c=r(s),l=u["default"].util.parseDateTime;e["default"]=new o["default"]({is:"more-info-sun",properties:{stateObj:{type:Object},risingDate:{type:Object,computed:"computeRising(stateObj)"},settingDate:{type:Object,computed:"computeSetting(stateObj)"}},computeRising:function(t){return l(t.attributes.next_rising)},computeSetting:function(t){return l(t.attributes.next_setting)},computeOrder:function(t,e){return t>e?["set","ris"]:["ris","set"]},itemCaption:function(t){return"ris"===t?"Rising ":"Setting "},itemDate:function(t){return"ris"===t?this.risingDate:this.settingDate},itemValue:function(t){return(0,c["default"])(this.itemDate(t))}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(20),c=r(s),l=o["default"].serviceActions,f=["away_mode"];e["default"]=new u["default"]({is:"more-info-thermostat",properties:{stateObj:{type:Object,observer:"stateObjChanged"},tempMin:{type:Number},tempMax:{type:Number},targetTemperatureSliderValue:{type:Number},awayToggleChecked:{type:Boolean}},stateObjChanged:function(t){this.targetTemperatureSliderValue=t.attributes.temperature,this.awayToggleChecked="on"===t.attributes.away_mode,this.tempMin=t.attributes.min_temp,this.tempMax=t.attributes.max_temp},computeClassNames:function(t){return(0,c["default"])(t,f)},targetTemperatureSliderChanged:function(t){l.callService("thermostat","set_temperature",{entity_id:this.stateObj.entityId,temperature:t.target.value})},toggleChanged:function(t){var e=t.target.checked;e&&"off"===this.stateObj.attributes.away_mode?this.service_set_away(!0):e||"on"!==this.stateObj.attributes.away_mode||this.service_set_away(!1)},service_set_away:function(t){var e=this;l.callService("thermostat","set_away_mode",{away_mode:t,entity_id:this.stateObj.entityId}).then(function(){return e.stateObjChanged(e.stateObj)})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"more-info-updater",properties:{}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7),n(39),e["default"]=new o["default"]({is:"state-card-configurator",properties:{stateObj:{type:Object}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a);n(7);var s=o["default"].serviceActions;e["default"]=new u["default"]({is:"state-card-input_select",properties:{stateObj:{type:Object},selectedOption:{type:String,observer:"selectedOptionChanged"}},computeSelected:function(t){return t.attributes.options.indexOf(t.state)},selectedOptionChanged:function(t){""!==t&&t!==this.stateObj.state&&s.callService("input_select","select_option",{option:t,entity_id:this.stateObj.entityId})},stopPropagation:function(t){t.stopPropagation()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7);var a=["playing","paused"];e["default"]=new o["default"]({is:"state-card-media_player",properties:{stateObj:{type:Object},isPlaying:{type:Boolean,computed:"computeIsPlaying(stateObj)"}},computeIsPlaying:function(t){return-1!==a.indexOf(t.state)},computePrimaryText:function(t,e){return e?t.attributes.media_title:t.stateDisplay},computeSecondaryText:function(t){var e=void 0;return"music"===t.attributes.media_content_type?t.attributes.media_artist:"tvshow"===t.attributes.media_content_type?(e=t.attributes.media_series_title,t.attributes.media_season&&t.attributes.media_episode&&(e+=" S"+t.attributes.media_season+"E"+t.attributes.media_episode),e):t.attributes.app_name?t.attributes.app_name:""}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a);n(7);var s=o["default"].serviceActions;e["default"]=new u["default"]({is:"state-card-rollershutter",properties:{stateObj:{type:Object}},computeIsFullyOpen:function(t){return 100===t.attributes.current_position},computeIsFullyClosed:function(t){return 0===t.attributes.current_position},onMoveUpTap:function(){s.callService("rollershutter","move_up",{entity_id:this.stateObj.entityId})},onMoveDownTap:function(){s.callService("rollershutter","move_down",{entity_id:this.stateObj.entityId})},onStopTap:function(){s.callService("rollershutter","stop",{entity_id:this.stateObj.entityId})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a);n(7);var s=u["default"].serviceActions;e["default"]=new o["default"]({is:"state-card-scene",properties:{stateObj:{type:Object}},activateScene:function(){s.callTurnOn(this.stateObj.entityId)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7),e["default"]=new o["default"]({is:"state-card-thermostat",properties:{stateObj:{type:Object}},computeTargetTemperature:function(t){return t.attributes.temperature+" "+t.attributes.unit_of_measurement}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7),n(35),e["default"]=new o["default"]({is:"state-card-toggle"})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7),e["default"]=new o["default"]({is:"state-card-weblink",properties:{stateObj:{type:Object}},listeners:{tap:"onTap"},onTap:function(t){t.stopPropagation(),window.open(this.stateObj.state,"_blank")}})},function(t,e){"use strict";function n(t){return{attached:function(){var e=this;this.__unwatchFns=Object.keys(this.properties).reduce(function(n,r){if(!("bindNuclear"in e.properties[r]))return n;var i=e.properties[r].bindNuclear;if(!i)throw new Error("Undefined getter specified for key "+r);return e[r]=t.evaluate(i),n.concat(t.observe(i,function(t){e[r]=t}))},[])},detached:function(){for(;this.__unwatchFns.length;)this.__unwatchFns.shift()()}}}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return-1!==u.indexOf(t.domain)?t.domain:(0,a["default"])(t.entityId)?"toggle":"display"}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var o=n(21),a=r(o),u=["configurator","input_select","media_player","rollershutter","scene","thermostat","weblink"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if(!t)return a["default"];if(t.attributes.icon)return t.attributes.icon;var e=t.attributes.unit_of_measurement;return!e||"sensor"!==t.domain||e!==f.UNIT_TEMP_C&&e!==f.UNIT_TEMP_F?(0,s["default"])(t.domain,t.state):"mdi:thermometer"}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var o=n(40),a=r(o),u=n(22),s=r(u),c=n(2),l=r(c),f=l["default"].util.temperatureUnits},function(t,e){"use strict";function n(t){return-1!==r.indexOf(t.domain)?t.domain:"default"}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n;var r=["light","group","sun","configurator","thermostat","script","media_player","camera","updater","alarm_control_panel"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(196),i=n(15),o=function(t,e,n){var o=arguments.length<=3||void 0===arguments[3]?null:arguments[3],a=t.evaluate(i.getters.authInfo),u=a.host+"/api/"+n;return new r.Promise(function(t,n){var r=new XMLHttpRequest;r.open(e,u,!0),r.setRequestHeader("X-HA-access",a.authToken),r.onload=function(){var e=void 0;try{e="application/json"===r.getResponseHeader("content-type")?JSON.parse(r.responseText):r.responseText}catch(i){e=r.responseText}r.status>199&&r.status<300?t(e):n(e)},r.onerror=function(){return n({})},o?r.send(JSON.stringify(o)):r.send()})};e["default"]=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],r=n.useStreaming,i=void 0===r?t.evaluate(c.getters.isSupported):r,o=n.rememberAuth,a=void 0===o?!1:o,s=n.host,d=void 0===s?"":s;t.dispatch(u["default"].VALIDATING_AUTH_TOKEN,{authToken:e,host:d}),l.actions.fetchAll(t).then(function(){t.dispatch(u["default"].VALID_AUTH_TOKEN,{authToken:e,host:d,rememberAuth:a}),i?c.actions.start(t,{syncOnInitialConnect:!1}):l.actions.start(t,{skipInitialSync:!0})},function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=e.message,r=void 0===n?f:n;t.dispatch(u["default"].INVALID_AUTH_TOKEN,{errorMessage:r})})}function o(t){(0,s.callApi)(t,"POST","log_out"),t.dispatch(u["default"].LOG_OUT,{})}Object.defineProperty(e,"__esModule",{value:!0}),e.validate=i,e.logOut=o;var a=n(14),u=r(a),s=n(5),c=n(29),l=n(31),f="Unexpected result from API"},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=e.isValidating=["authAttempt","isValidating"],r=(e.isInvalidAttempt=["authAttempt","isInvalid"],e.attemptErrorMessage=["authAttempt","errorMessage"],e.rememberAuth=["rememberAuth"],e.attemptAuthInfo=[["authAttempt","authToken"],["authAttempt","host"],function(t,e){return{authToken:t,host:e}}]),i=e.currentAuthToken=["authCurrent","authToken"],o=e.currentAuthInfo=[i,["authCurrent","host"],function(t,e){return{authToken:t,host:e}}];e.authToken=[n,["authAttempt","authToken"],["authCurrent","authToken"],function(t,e,n){return t?e:n}],e.authInfo=[n,r,o,function(t,e,n){return t?e:n}]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if(null==t)throw new TypeError("Cannot destructure undefined")}function o(t,e){var n=e.authToken,r=e.host;return(0,s.toImmutable)({authToken:n,host:r,isValidating:!0,isInvalid:!1,errorMessage:""})}function a(t,e){return i(e),f.getInitialState()}function u(t,e){var n=e.errorMessage;return t.withMutations(function(t){return t.set("isValidating",!1).set("isInvalid",!0).set("errorMessage",n)})}Object.defineProperty(e,"__esModule",{value:!0});var s=n(3),c=n(14),l=r(c),f=new s.Store({getInitialState:function(){return(0,s.toImmutable)({isValidating:!1,authToken:!1,host:null,isInvalid:!1,errorMessage:""})},initialize:function(){this.on(l["default"].VALIDATING_AUTH_TOKEN,o),this.on(l["default"].VALID_AUTH_TOKEN,a),this.on(l["default"].INVALID_AUTH_TOKEN,u)}});e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.authToken,r=e.host;return(0,a.toImmutable)({authToken:n,host:r})}function o(){return c.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(14),s=r(u),c=new a.Store({getInitialState:function(){return(0,a.toImmutable)({authToken:null,host:""})},initialize:function(){this.on(s["default"].VALID_AUTH_TOKEN,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.rememberAuth;return n}Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(14),u=r(a),s=new o.Store({getInitialState:function(){return!0},initialize:function(){this.on(u["default"].VALID_AUTH_TOKEN,i)}});e["default"]=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){t.dispatch(c["default"].SERVER_CONFIG_LOADED,e)}function o(t){(0,u.callApi)(t,"GET","config").then(function(e){return i(t,e)})}function a(t,e){t.dispatch(c["default"].COMPONENT_LOADED,{component:e})}Object.defineProperty(e,"__esModule",{value:!0}),e.configLoaded=i,e.fetchAll=o,e.componentLoaded=a;var u=n(5),s=n(23),c=r(s)},function(t,e){"use strict";function n(t){return[["serverComponent"],function(e){return e.contains(t)}]}Object.defineProperty(e,"__esModule",{value:!0}),e.isComponentLoaded=n,e.locationGPS=[["serverConfig","latitude"],["serverConfig","longitude"],function(t,e){return{latitude:t,longitude:e}}],e.locationName=["serverConfig","location_name"],e.serverVersion=["serverConfig","serverVersion"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.component;return t.push(n)}function o(t,e){var n=e.components;return(0,u.toImmutable)(n)}function a(){return l.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var u=n(3),s=n(23),c=r(s),l=new u.Store({getInitialState:function(){return(0,u.toImmutable)([])},initialize:function(){this.on(c["default"].COMPONENT_LOADED,i),this.on(c["default"].SERVER_CONFIG_LOADED,o),this.on(c["default"].LOG_OUT,a)}});e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.latitude,r=e.longitude,i=e.location_name,o=e.temperature_unit,u=e.time_zone,s=e.version;return(0,a.toImmutable)({latitude:n,longitude:r,location_name:i,temperature_unit:o,time_zone:u,serverVersion:s})}function o(){return c.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(23),s=r(u),c=new a.Store({getInitialState:function(){return(0,a.toImmutable)({latitude:null,longitude:null,location_name:"Home",temperature_unit:"°C",time_zone:"UTC",serverVersion:"unknown"})},initialize:function(){this.on(s["default"].SERVER_CONFIG_LOADED,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=c},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){t.dispatch(f["default"].ENTITY_HISTORY_DATE_SELECTED,{date:e})}function a(t){var e=arguments.length<=1||void 0===arguments[1]?null:arguments[1];t.dispatch(f["default"].RECENT_ENTITY_HISTORY_FETCH_START,{});var n="history/period";return null!==e&&(n+="?filter_entity_id="+e),(0,c.callApi)(t,"GET",n).then(function(e){return t.dispatch(f["default"].RECENT_ENTITY_HISTORY_FETCH_SUCCESS,{stateHistory:e})},function(){return t.dispatch(f["default"].RECENT_ENTITY_HISTORY_FETCH_ERROR,{})})}function u(t,e){return t.dispatch(f["default"].ENTITY_HISTORY_FETCH_START,{date:e}),(0,c.callApi)(t,"GET","history/period/"+e).then(function(n){return t.dispatch(f["default"].ENTITY_HISTORY_FETCH_SUCCESS,{date:e,stateHistory:n})},function(){return t.dispatch(f["default"].ENTITY_HISTORY_FETCH_ERROR,{})})}function s(t){var e=t.evaluate(h.currentDate);return u(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.changeCurrentDate=o,e.fetchRecent=a,e.fetchDate=u,e.fetchSelectedDate=s;var c=n(5),l=n(11),f=i(l),d=n(44),h=r(d)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.date;return(0,s["default"])(n)}function o(){return f.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(32),s=r(u),c=n(11),l=r(c),f=new a.Store({getInitialState:function(){var t=new Date;return t.setDate(t.getDate()-1),(0,s["default"])(t)},initialize:function(){this.on(l["default"].ENTITY_HISTORY_DATE_SELECTED,i),this.on(l["default"].LOG_OUT,o)}});e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.date,r=e.stateHistory;return 0===r.length?t.set(n,(0,a.toImmutable)({})):t.withMutations(function(t){r.forEach(function(e){return t.setIn([n,e[0].entity_id],(0,a.toImmutable)(e.map(l["default"].fromJSON)))})})}function o(){return f.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(11),s=r(u),c=n(16),l=r(c),f=new a.Store({getInitialState:function(){return(0,a.toImmutable)({})},initialize:function(){this.on(s["default"].ENTITY_HISTORY_FETCH_SUCCESS,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(3),o=n(11),a=r(o),u=new i.Store({getInitialState:function(){return!1},initialize:function(){this.on(a["default"].ENTITY_HISTORY_FETCH_START,function(){return!0}),this.on(a["default"].ENTITY_HISTORY_FETCH_SUCCESS,function(){return!1}),this.on(a["default"].ENTITY_HISTORY_FETCH_ERROR,function(){return!1}),this.on(a["default"].RECENT_ENTITY_HISTORY_FETCH_START,function(){return!0}),this.on(a["default"].RECENT_ENTITY_HISTORY_FETCH_SUCCESS,function(){return!1}),this.on(a["default"].RECENT_ENTITY_HISTORY_FETCH_ERROR,function(){return!1}),this.on(a["default"].LOG_OUT,function(){return!1})}});e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.stateHistory;return t.withMutations(function(t){n.forEach(function(e){return t.set(e[0].entity_id,(0,a.toImmutable)(e.map(l["default"].fromJSON)))})})}function o(){return f.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(11),s=r(u),c=n(16),l=r(c),f=new a.Store({getInitialState:function(){return(0,a.toImmutable)({})},initialize:function(){this.on(s["default"].RECENT_ENTITY_HISTORY_FETCH_SUCCESS,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.stateHistory,r=(new Date).getTime();return t.withMutations(function(t){n.forEach(function(e){return t.set(e[0].entity_id,r)}),history.length>1&&t.set(c,r)})}function o(){return l.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(11),s=r(u),c="ALL_ENTRY_FETCH",l=new a.Store({getInitialState:function(){return(0,a.toImmutable)({})},initialize:function(){this.on(s["default"].RECENT_ENTITY_HISTORY_FETCH_SUCCESS,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(10),o=n(16),a=r(o),u=(0,i.createApiActions)(a["default"]);e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.visibleEntityMap=e.byId=e.entityMap=e.hasData=void 0;var i=n(10),o=n(16),a=r(o),u=(e.hasData=(0,i.createHasDataGetter)(a["default"]),e.entityMap=(0,i.createEntityMapGetter)(a["default"]));e.byId=(0,i.createByIdGetter)(a["default"]),e.visibleEntityMap=[u,function(t){return t.filter(function(t){return!t.attributes.hidden})}]},function(t,e,n){"use strict";function r(t){return(0,i.callApi)(t,"GET","error_log")}Object.defineProperty(e,"__esModule",{value:!0}),e.fetchErrorLog=r;var i=n(5)},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}Object.defineProperty(e,"__esModule",{value:!0}),e.actions=void 0;var i=n(145),o=r(i);e.actions=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(5),o=n(10),a=n(27),u=n(46),s=r(u),c=(0,o.createApiActions)(s["default"]);c.fireEvent=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return(0,i.callApi)(t,"POST","events/"+e,n).then(function(){a.actions.createNotification(t,"Event "+e+" successful fired!")})},e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.byId=e.entityMap=e.hasData=void 0;var i=n(10),o=n(46),a=r(o);e.hasData=(0,i.createHasDataGetter)(a["default"]),e.entityMap=(0,i.createEntityMapGetter)(a["default"]),e.byId=(0,i.createByIdGetter)(a["default"])},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){t.dispatch(s["default"].LOGBOOK_DATE_SELECTED,{date:e})}function o(t,e){t.dispatch(s["default"].LOGBOOK_ENTRIES_FETCH_START,{date:e}),(0,a.callApi)(t,"GET","logbook/"+e).then(function(n){return t.dispatch(s["default"].LOGBOOK_ENTRIES_FETCH_SUCCESS,{date:e,entries:n})},function(){return t.dispatch(s["default"].LOGBOOK_ENTRIES_FETCH_ERROR,{})})}Object.defineProperty(e,"__esModule",{value:!0}),e.changeCurrentDate=i,e.fetchDate=o;var a=n(5),u=n(12),s=r(u)},function(t,e,n){"use strict";function r(t){return!t||(new Date).getTime()-t>o}Object.defineProperty(e,"__esModule",{value:!0}),e.isLoadingEntries=e.currentEntries=e.isCurrentStale=e.currentDate=void 0;var i=n(3),o=6e4,a=e.currentDate=["currentLogbookDate"];e.isCurrentStale=[a,["logbookEntriesUpdated"],function(t,e){return r(e.get(t))}],e.currentEntries=[a,["logbookEntries"],function(t,e){return e.get(t)||(0,i.toImmutable)([])}],e.isLoadingEntries=["isLoadingLogbookEntries"]},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t){t.registerStores({currentLogbookDate:u["default"],isLoadingLogbookEntries:c["default"],logbookEntries:f["default"],logbookEntriesUpdated:h["default"]})}Object.defineProperty(e,"__esModule",{value:!0}),e.getters=e.actions=void 0,e.register=o;var a=n(153),u=i(a),s=n(154),c=i(s),l=n(155),f=i(l),d=n(156),h=i(d),p=n(149),_=r(p),v=n(150),y=r(v);e.actions=_,e.getters=y},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=function(){function t(t,e){for(var n=0;nt;t+=2){var e=rt[t],n=rt[t+1];e(n),rt[t]=void 0,rt[t+1]=void 0}$=0}function y(){try{var t=n(212);return W=t.runOnLoop||t.runOnContext,d()}catch(e){return _()}}function m(){}function g(){return new TypeError("You cannot resolve a promise with itself")}function b(){return new TypeError("A promises callback cannot return that same promise.")}function S(t){try{return t.then}catch(e){return ut.error=e,ut}}function w(t,e,n,r){try{t.call(e,n,r)}catch(i){return i}}function O(t,e,n){Z(function(t){var r=!1,i=w(n,e,function(n){r||(r=!0,e!==n?E(t,n):D(t,n))},function(e){r||(r=!0,C(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&i&&(r=!0,C(t,i))},t)}function M(t,e){e._state===ot?D(t,e._result):e._state===at?C(t,e._result):j(e,void 0,function(e){E(t,e)},function(e){C(t,e)})}function I(t,e){if(e.constructor===t.constructor)M(t,e);else{var n=S(e);n===ut?C(t,ut.error):void 0===n?D(t,e):u(n)?O(t,e,n):D(t,e)}}function E(t,e){t===e?C(t,g()):a(e)?I(t,e):D(t,e)}function T(t){t._onerror&&t._onerror(t._result),P(t)}function D(t,e){t._state===it&&(t._result=e,t._state=ot,0!==t._subscribers.length&&Z(P,t))}function C(t,e){t._state===it&&(t._state=at,t._result=e,Z(T,t))}function j(t,e,n,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+ot]=n,i[o+at]=r,0===o&&t._state&&Z(P,t)}function P(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,i,o=t._result,a=0;aa;a++)j(r.resolve(t[a]),void 0,e,n);return i}function Y(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(m);return E(n,t),n}function z(t){var e=this,n=new e(m);return C(n,t),n}function U(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function V(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function G(t){this._id=pt++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==t&&(u(t)||U(),this instanceof G||V(),N(this,t))}function F(){var t;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(t.Promise=_t)}var B;B=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var W,q,K,J=B,$=0,Z=({}.toString,function(t,e){rt[$]=t,rt[$+1]=e,$+=2,2===$&&(q?q(v):K())}),X="undefined"!=typeof window?window:void 0,Q=X||{},tt=Q.MutationObserver||Q.WebKitMutationObserver,et="undefined"!=typeof t&&"[object process]"==={}.toString.call(t),nt="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,rt=new Array(1e3);K=et?f():tt?h():nt?p():void 0===X?y():_();var it=void 0,ot=1,at=2,ut=new A,st=new A;R.prototype._validateInput=function(t){return J(t)},R.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},R.prototype._init=function(){this._result=new Array(this.length)};var ct=R;R.prototype._enumerate=function(){for(var t=this,e=t.length,n=t.promise,r=t._input,i=0;n._state===it&&e>i;i++)t._eachEntry(r[i],i)},R.prototype._eachEntry=function(t,e){var n=this,r=n._instanceConstructor;s(t)?t.constructor===r&&t._state!==it?(t._onerror=null,n._settledAt(t._state,e,t._result)):n._willSettleAt(r.resolve(t),e):(n._remaining--,n._result[e]=t)},R.prototype._settledAt=function(t,e,n){var r=this,i=r.promise;i._state===it&&(r._remaining--,t===at?C(i,n):r._result[e]=n),0===r._remaining&&D(i,r._result)},R.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,function(t){n._settledAt(ot,e,t)},function(t){n._settledAt(at,e,t)})};var lt=x,ft=H,dt=Y,ht=z,pt=0,_t=G;G.all=lt,G.race=ft,G.resolve=dt,G.reject=ht,G._setScheduler=c,G._setAsap=l,G._asap=Z,G.prototype={constructor:G,then:function(t,e){var n=this,r=n._state;if(r===ot&&!t||r===at&&!e)return this;var i=new this.constructor(m),o=n._result;if(r){var a=arguments[r-1];Z(function(){L(r,i,a,o)})}else j(n,i,t,e);return i},"catch":function(t){return this.then(null,t)}};var vt=F,yt={Promise:_t,polyfill:vt};n(210).amd?(r=function(){return yt}.call(e,n,e,o),!(void 0!==r&&(o.exports=r))):"undefined"!=typeof o&&o.exports?o.exports=yt:"undefined"!=typeof this&&(this.ES6Promise=yt),vt()}).call(this)}).call(e,n(211),function(){return this}(),n(67)(t))},function(t,e,n){var r=n(62),i=r(Date,"now"),o=i||function(){return(new Date).getTime()};t.exports=o},function(t,e){function n(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=9007199254740991;t.exports=n},function(t,e,n){var r=n(62),i=n(198),o=n(63),a="[object Array]",u=Object.prototype,s=u.toString,c=r(Array,"isArray"),l=c||function(t){return o(t)&&i(t.length)&&s.call(t)==a};t.exports=l},function(t,e,n){function r(t){return null==t?!1:i(t)?l.test(s.call(t)):o(t)&&a.test(t)}var i=n(64),o=n(63),a=/^\[object .+?Constructor\]$/,u=Object.prototype,s=Function.prototype.toString,c=u.hasOwnProperty,l=RegExp("^"+s.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=r},function(t,e){function n(t){return function(e){return null==e?void 0:e[t]}}t.exports=n},function(t,e,n){var r=n(201),i=r("length");t.exports=i},function(t,e,n){function r(t){return null!=t&&o(i(t))}var i=n(202),o=n(206);t.exports=r},function(t,e){function n(t,e){return t="number"==typeof t||r.test(t)?+t:-1,e=null==e?i:e,t>-1&&t%1==0&&e>t}var r=/^\d+$/,i=9007199254740991;t.exports=n},function(t,e,n){function r(t,e,n){if(!a(n))return!1;var r=typeof e;if("number"==r?i(n)&&o(e,n.length):"string"==r&&e in n){var u=n[e];return t===t?t===u:u!==u}return!1}var i=n(203),o=n(204),a=n(207);t.exports=r},function(t,e){function n(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=9007199254740991;t.exports=n},function(t,e){function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=n},function(t,e,n){function r(t,e,n){n&&i(t,e,n)&&(e=n=void 0),t=+t||0,n=null==n?1:+n||0,null==e?(e=t,t=0):e=+e||0;for(var r=-1,u=a(o((e-t)/(n||1)),0),s=Array(u);++r1)for(var n=1;n \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/home-assistant-polymer b/homeassistant/components/frontend/www_static/home-assistant-polymer index 8050e086158..700d6d37385 160000 --- a/homeassistant/components/frontend/www_static/home-assistant-polymer +++ b/homeassistant/components/frontend/www_static/home-assistant-polymer @@ -1 +1 @@ -Subproject commit 8050e0861586a65317de27dbfd0ff50ffe209731 +Subproject commit 700d6d37385886852a07b4075787ec219f836158 From f08b77dc4c08619d0177bf3b7e485c50a4d9ac17 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 6 Feb 2016 22:28:29 -0800 Subject: [PATCH 28/85] Clean up state_attributes vs device_state_attributes --- homeassistant/components/light/__init__.py | 10 ------ homeassistant/components/light/vera.py | 10 ++---- homeassistant/components/light/wink.py | 17 +++------- .../components/media_player/__init__.py | 10 ------ homeassistant/components/sensor/cpuspeed.py | 2 +- homeassistant/components/sensor/demo.py | 2 +- homeassistant/components/sensor/mysensors.py | 32 +++++++------------ homeassistant/components/sensor/rfxtrx.py | 2 +- .../sensor/swiss_public_transport.py | 2 +- .../components/sensor/tellduslive.py | 4 +-- homeassistant/components/sensor/twitch.py | 2 +- homeassistant/components/sensor/vera.py | 2 +- homeassistant/components/sensor/yr.py | 2 +- homeassistant/components/sensor/zwave.py | 5 --- homeassistant/components/switch/__init__.py | 10 ------ homeassistant/components/switch/mfi.py | 4 +-- homeassistant/components/switch/mysensors.py | 32 +++++++------------ homeassistant/components/switch/tellstick.py | 9 +----- homeassistant/components/switch/vera.py | 4 +-- homeassistant/components/switch/wemo.py | 4 +-- .../components/thermostat/__init__.py | 10 ------ homeassistant/components/wink.py | 9 +----- homeassistant/helpers/entity.py | 20 +++++++++++- 23 files changed, 66 insertions(+), 138 deletions(-) diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index 8d2ef654282..f823b84d191 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -300,11 +300,6 @@ class Light(ToggleEntity): """ CT color value in mirads. """ return None - @property - def device_state_attributes(self): - """ Returns device specific state attributes. """ - return None - @property def state_attributes(self): """ Returns optional state attributes. """ @@ -322,9 +317,4 @@ class Light(ToggleEntity): data[ATTR_XY_COLOR][0], data[ATTR_XY_COLOR][1], data[ATTR_BRIGHTNESS]) - device_attr = self.device_state_attributes - - if device_attr is not None: - data.update(device_attr) - return data diff --git a/homeassistant/components/light/vera.py b/homeassistant/components/light/vera.py index 48e84e5cfb4..a9f48a0418d 100644 --- a/homeassistant/components/light/vera.py +++ b/homeassistant/components/light/vera.py @@ -71,13 +71,9 @@ class VeraLight(VeraSwitch): """ Represents a Vera Light, including dimmable. """ @property - def state_attributes(self): - attr = super().state_attributes or {} - - if self.vera_device.is_dimmable: - attr[ATTR_BRIGHTNESS] = self.vera_device.get_brightness() - - return attr + def brightness(self): + """Brightness of the light.""" + return self.vera_device.get_brightness() def turn_on(self, **kwargs): if ATTR_BRIGHTNESS in kwargs and self.vera_device.is_dimmable: diff --git a/homeassistant/components/light/wink.py b/homeassistant/components/light/wink.py index 9592db9c853..db545dbe240 100644 --- a/homeassistant/components/light/wink.py +++ b/homeassistant/components/light/wink.py @@ -37,6 +37,11 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None): class WinkLight(WinkToggleDevice): """ Represents a Wink light. """ + @property + def brightness(self): + """Brightness of the light.""" + return int(self.wink.brightness() * 255) + # pylint: disable=too-few-public-methods def turn_on(self, **kwargs): """ Turns the switch on. """ @@ -47,15 +52,3 @@ class WinkLight(WinkToggleDevice): else: self.wink.set_state(True) - - @property - def state_attributes(self): - attr = super().state_attributes - - if self.is_on: - brightness = self.wink.brightness() - - if brightness is not None: - attr[ATTR_BRIGHTNESS] = int(brightness * 255) - - return attr diff --git a/homeassistant/components/media_player/__init__.py b/homeassistant/components/media_player/__init__.py index 7dfb4ede173..d0f3015fb74 100644 --- a/homeassistant/components/media_player/__init__.py +++ b/homeassistant/components/media_player/__init__.py @@ -425,11 +425,6 @@ class MediaPlayerDevice(Entity): """ Flags of media commands that are supported. """ return 0 - @property - def device_state_attributes(self): - """ Extra attributes a device wants to expose. """ - return None - def turn_on(self): """ turn the media player on. """ raise NotImplementedError() @@ -546,9 +541,4 @@ class MediaPlayerDevice(Entity): if self.media_image_url: state_attr[ATTR_ENTITY_PICTURE] = self.media_image_url - device_attr = self.device_state_attributes - - if device_attr: - state_attr.update(device_attr) - return state_attr diff --git a/homeassistant/components/sensor/cpuspeed.py b/homeassistant/components/sensor/cpuspeed.py index 54bb5e3bc2c..68d1857e2b8 100644 --- a/homeassistant/components/sensor/cpuspeed.py +++ b/homeassistant/components/sensor/cpuspeed.py @@ -54,7 +54,7 @@ class CpuSpeedSensor(Entity): return self._unit_of_measurement @property - def state_attributes(self): + def device_state_attributes(self): """ Returns the state attributes. """ if self.info is not None: return { diff --git a/homeassistant/components/sensor/demo.py b/homeassistant/components/sensor/demo.py index 09da6d54f56..a3b9b8a2692 100644 --- a/homeassistant/components/sensor/demo.py +++ b/homeassistant/components/sensor/demo.py @@ -46,7 +46,7 @@ class DemoSensor(Entity): return self._unit_of_measurement @property - def state_attributes(self): + def device_state_attributes(self): """ Returns the state attributes. """ if self._battery: return { diff --git a/homeassistant/components/sensor/mysensors.py b/homeassistant/components/sensor/mysensors.py index 87d99adbd4b..62b68ab41b8 100644 --- a/homeassistant/components/sensor/mysensors.py +++ b/homeassistant/components/sensor/mysensors.py @@ -161,34 +161,24 @@ class MySensorsSensor(Entity): @property def device_state_attributes(self): """Return device specific state attributes.""" - set_req = self.gateway.const.SetReq - device_attr = {} - for value_type, value in self._values.items(): - if value_type != self.value_type: - try: - device_attr[set_req(value_type).name] = value - except ValueError: - _LOGGER.error('value_type %s is not valid for mysensors ' - 'version %s', value_type, - self.gateway.version) - return device_attr - - @property - def state_attributes(self): - """Return the state attributes.""" - data = { + attr = { mysensors.ATTR_PORT: self.gateway.port, mysensors.ATTR_NODE_ID: self.node_id, mysensors.ATTR_CHILD_ID: self.child_id, ATTR_BATTERY_LEVEL: self.battery_level, } - device_attr = self.device_state_attributes + set_req = self.gateway.const.SetReq - if device_attr is not None: - data.update(device_attr) - - return data + for value_type, value in self._values.items(): + if value_type != self.value_type: + try: + attr[set_req(value_type).name] = value + except ValueError: + _LOGGER.error('value_type %s is not valid for mysensors ' + 'version %s', value_type, + self.gateway.version) + return attr def update(self): """Update the controller with the latest values from a sensor.""" diff --git a/homeassistant/components/sensor/rfxtrx.py b/homeassistant/components/sensor/rfxtrx.py index c67810c86eb..049c4e87300 100644 --- a/homeassistant/components/sensor/rfxtrx.py +++ b/homeassistant/components/sensor/rfxtrx.py @@ -87,7 +87,7 @@ class RfxtrxSensor(Entity): return self._name @property - def state_attributes(self): + def device_state_attributes(self): return self.event.values @property diff --git a/homeassistant/components/sensor/swiss_public_transport.py b/homeassistant/components/sensor/swiss_public_transport.py index d74053417fe..5304101900b 100644 --- a/homeassistant/components/sensor/swiss_public_transport.py +++ b/homeassistant/components/sensor/swiss_public_transport.py @@ -75,7 +75,7 @@ class SwissPublicTransportSensor(Entity): return self._state @property - def state_attributes(self): + def device_state_attributes(self): """ Returns the state attributes. """ if self._times is not None: return { diff --git a/homeassistant/components/sensor/tellduslive.py b/homeassistant/components/sensor/tellduslive.py index 1b1edee34c8..fd7679f89bf 100644 --- a/homeassistant/components/sensor/tellduslive.py +++ b/homeassistant/components/sensor/tellduslive.py @@ -113,8 +113,8 @@ class TelldusLiveSensor(Entity): return self._value_as_humidity @property - def state_attributes(self): - attrs = dict() + def device_state_attributes(self): + attrs = {} if self._battery_level is not None: attrs[ATTR_BATTERY_LEVEL] = self._battery_level if self._last_updated is not None: diff --git a/homeassistant/components/sensor/twitch.py b/homeassistant/components/sensor/twitch.py index b2de3f71fa1..7a65211268e 100644 --- a/homeassistant/components/sensor/twitch.py +++ b/homeassistant/components/sensor/twitch.py @@ -67,7 +67,7 @@ class TwitchSensor(Entity): self._state = STATE_OFFLINE @property - def state_attributes(self): + def device_state_attributes(self): """ Returns the state attributes. """ if self._state == STATE_STREAMING: return { diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index fe003030e0c..8839cdc4e1c 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -118,7 +118,7 @@ class VeraSensor(Entity): return '%' @property - def state_attributes(self): + def device_state_attributes(self): attr = {} if self.vera_device.has_battery: attr[ATTR_BATTERY_LEVEL] = self.vera_device.battery_level + '%' diff --git a/homeassistant/components/sensor/yr.py b/homeassistant/components/sensor/yr.py index b284e85e4dd..85d90264462 100644 --- a/homeassistant/components/sensor/yr.py +++ b/homeassistant/components/sensor/yr.py @@ -100,7 +100,7 @@ class YrSensor(Entity): return self._state @property - def state_attributes(self): + def device_state_attributes(self): """ Returns state attributes. """ data = { 'about': "Weather forecast from yr.no, delivered by the" diff --git a/homeassistant/components/sensor/zwave.py b/homeassistant/components/sensor/zwave.py index b4ee9ba24f2..fc3e27b212f 100644 --- a/homeassistant/components/sensor/zwave.py +++ b/homeassistant/components/sensor/zwave.py @@ -111,11 +111,6 @@ class ZWaveSensor(ZWaveDeviceEntity, Entity): """ Returns the state of the sensor. """ return self._value.data - @property - def state_attributes(self): - """ Returns optional state attributes. """ - return self.device_state_attributes - @property def unit_of_measurement(self): return self._value.units diff --git a/homeassistant/components/switch/__init__.py b/homeassistant/components/switch/__init__.py index 944d16cf40b..742de5fb10e 100644 --- a/homeassistant/components/switch/__init__.py +++ b/homeassistant/components/switch/__init__.py @@ -129,11 +129,6 @@ class SwitchDevice(ToggleEntity): """ Is the device in standby. """ return None - @property - def device_state_attributes(self): - """ Returns device specific state attributes. """ - return None - @property def state_attributes(self): """ Returns optional state attributes. """ @@ -144,9 +139,4 @@ class SwitchDevice(ToggleEntity): if value: data[attr] = value - device_attr = self.device_state_attributes - - if device_attr is not None: - data.update(device_attr) - return data diff --git a/homeassistant/components/switch/mfi.py b/homeassistant/components/switch/mfi.py index 5007698c156..d9ee34bc6cb 100644 --- a/homeassistant/components/switch/mfi.py +++ b/homeassistant/components/switch/mfi.py @@ -114,8 +114,8 @@ class MfiSwitch(SwitchDevice): return int(self._port.data.get('active_pwr', 0) * 1000) @property - def state_attributes(self): - attr = super().state_attributes or {} + def device_state_attributes(self): + attr = {} attr['volts'] = self._port.data.get('v_rms', 0) attr['amps'] = self._port.data.get('i_rms', 0) return attr diff --git a/homeassistant/components/switch/mysensors.py b/homeassistant/components/switch/mysensors.py index 13cdc023248..9768f57f23a 100644 --- a/homeassistant/components/switch/mysensors.py +++ b/homeassistant/components/switch/mysensors.py @@ -100,34 +100,24 @@ class MySensorsSwitch(SwitchDevice): @property def device_state_attributes(self): """Return device specific state attributes.""" - set_req = self.gateway.const.SetReq - device_attr = {} - for value_type, value in self._values.items(): - if value_type != self.value_type: - try: - device_attr[set_req(value_type).name] = value - except ValueError: - _LOGGER.error('value_type %s is not valid for mysensors ' - 'version %s', value_type, - self.gateway.version) - return device_attr - - @property - def state_attributes(self): - """Return the state attributes.""" - data = { + attr = { mysensors.ATTR_PORT: self.gateway.port, mysensors.ATTR_NODE_ID: self.node_id, mysensors.ATTR_CHILD_ID: self.child_id, ATTR_BATTERY_LEVEL: self.battery_level, } - device_attr = self.device_state_attributes + set_req = self.gateway.const.SetReq - if device_attr is not None: - data.update(device_attr) - - return data + for value_type, value in self._values.items(): + if value_type != self.value_type: + try: + attr[set_req(value_type).name] = value + except ValueError: + _LOGGER.error('value_type %s is not valid for mysensors ' + 'version %s', value_type, + self.gateway.version) + return attr @property def is_on(self): diff --git a/homeassistant/components/switch/tellstick.py b/homeassistant/components/switch/tellstick.py index 61edbed0af4..934a4024527 100644 --- a/homeassistant/components/switch/tellstick.py +++ b/homeassistant/components/switch/tellstick.py @@ -8,8 +8,7 @@ https://home-assistant.io/components/switch.tellstick/ """ import logging -from homeassistant.const import (EVENT_HOMEASSISTANT_STOP, - ATTR_FRIENDLY_NAME) +from homeassistant.const import EVENT_HOMEASSISTANT_STOP from homeassistant.helpers.entity import ToggleEntity SIGNAL_REPETITIONS = 1 @@ -63,7 +62,6 @@ class TellstickSwitchDevice(ToggleEntity): import tellcore.constants as tellcore_constants self.tellstick_device = tellstick_device - self.state_attr = {ATTR_FRIENDLY_NAME: tellstick_device.name} self.signal_repetitions = signal_repetitions self.last_sent_command_mask = (tellcore_constants.TELLSTICK_TURNON | @@ -79,11 +77,6 @@ class TellstickSwitchDevice(ToggleEntity): """ Returns the name of the switch if any. """ return self.tellstick_device.name - @property - def state_attributes(self): - """ Returns optional state attributes. """ - return self.state_attr - @property def is_on(self): """ True if switch is on. """ diff --git a/homeassistant/components/switch/vera.py b/homeassistant/components/switch/vera.py index 0655f29bbbf..2f6039b1766 100644 --- a/homeassistant/components/switch/vera.py +++ b/homeassistant/components/switch/vera.py @@ -102,8 +102,8 @@ class VeraSwitch(SwitchDevice): return self._name @property - def state_attributes(self): - attr = super().state_attributes or {} + def device_state_attributes(self): + attr = {} if self.vera_device.has_battery: attr[ATTR_BATTERY_LEVEL] = self.vera_device.battery_level + '%' diff --git a/homeassistant/components/switch/wemo.py b/homeassistant/components/switch/wemo.py index c6d92818466..1d569449ff7 100644 --- a/homeassistant/components/switch/wemo.py +++ b/homeassistant/components/switch/wemo.py @@ -95,8 +95,8 @@ class WemoSwitch(SwitchDevice): return self.wemo.name @property - def state_attributes(self): - attr = super().state_attributes or {} + def device_state_attributes(self): + attr = {} if self.maker_params: # Is the maker sensor on or off. if self.maker_params['hassensor']: diff --git a/homeassistant/components/thermostat/__init__.py b/homeassistant/components/thermostat/__init__.py index d92a71ba1f6..5d22fe60a8e 100644 --- a/homeassistant/components/thermostat/__init__.py +++ b/homeassistant/components/thermostat/__init__.py @@ -178,11 +178,6 @@ class ThermostatDevice(Entity): """ Returns the current state. """ return self.target_temperature or STATE_UNKNOWN - @property - def device_state_attributes(self): - """ Returns device specific state attributes. """ - return None - @property def state_attributes(self): """ Returns optional state attributes. """ @@ -211,11 +206,6 @@ class ThermostatDevice(Entity): if is_fan_on is not None: data[ATTR_FAN] = STATE_ON if is_fan_on else STATE_OFF - device_attr = self.device_state_attributes - - if device_attr is not None: - data.update(device_attr) - return data @property diff --git a/homeassistant/components/wink.py b/homeassistant/components/wink.py index 0594ce598c1..88881ad1ab7 100644 --- a/homeassistant/components/wink.py +++ b/homeassistant/components/wink.py @@ -13,7 +13,7 @@ from homeassistant.helpers import validate_config from homeassistant.helpers.entity import ToggleEntity from homeassistant.const import ( EVENT_PLATFORM_DISCOVERED, CONF_ACCESS_TOKEN, - ATTR_SERVICE, ATTR_DISCOVERED, ATTR_FRIENDLY_NAME) + ATTR_SERVICE, ATTR_DISCOVERED) DOMAIN = "wink" REQUIREMENTS = ['python-wink==0.5.0'] @@ -80,13 +80,6 @@ class WinkToggleDevice(ToggleEntity): """ True if light is on. """ return self.wink.state() - @property - def state_attributes(self): - """ Returns optional state attributes. """ - return { - ATTR_FRIENDLY_NAME: self.wink.name() - } - def turn_on(self, **kwargs): """ Turns the switch on. """ self.wink.set_state(True) diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py index e41f7755e9e..0f5ccf78bc7 100644 --- a/homeassistant/helpers/entity.py +++ b/homeassistant/helpers/entity.py @@ -80,7 +80,20 @@ class Entity(object): @property def state_attributes(self): - """Return the state attributes.""" + """ + Return the state attributes. + + Implemented by component base class. + """ + return None + + @property + def device_state_attributes(self): + """ + Return device specific state attributes. + + Implemented by platform classes. + """ return None @property @@ -135,6 +148,11 @@ class Entity(object): state = str(self.state) attr = self.state_attributes or {} + device_attr = self.device_state_attributes + + if device_attr is not None: + attr.update(device_attr) + if ATTR_UNIT_OF_MEASUREMENT not in attr and \ self.unit_of_measurement is not None: attr[ATTR_UNIT_OF_MEASUREMENT] = str(self.unit_of_measurement) From 987be65d559a5465d5f2ab50e6470115087fd993 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 6 Feb 2016 23:01:44 -0800 Subject: [PATCH 29/85] Update frontend to support default_view --- homeassistant/components/frontend/version.py | 2 +- homeassistant/components/frontend/www_static/frontend.html | 4 ++-- .../components/frontend/www_static/home-assistant-polymer | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/frontend/version.py b/homeassistant/components/frontend/version.py index 0da063f0ebc..edaefc6f16d 100644 --- a/homeassistant/components/frontend/version.py +++ b/homeassistant/components/frontend/version.py @@ -1,2 +1,2 @@ """ DO NOT MODIFY. Auto-generated by build_frontend script """ -VERSION = "5e1da334ca1aa73ee7951d26fbadbdf5" +VERSION = "9dc5577716628052687a43f8c1fb24d8" diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index 1aff78b6b8a..eba9325185f 100644 --- a/homeassistant/components/frontend/www_static/frontend.html +++ b/homeassistant/components/frontend/www_static/frontend.html @@ -6396,7 +6396,7 @@ case"touchend":return this.addPointerListenerEnd(t,e,i,n);case"touchmove":return return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},st.prototype.map=function(t,e){var n=this,r=ht(this,t,e);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(t,e)}),r},st.prototype.__iterate=function(t,e){var n,r=this;return this._iter.__iterate(this._useKeys?function(e,n){return t(e,n,r)}:(n=e?Pt(this):0,function(i){return t(i,e?--n:n++,r)}),e)},st.prototype.__iterator=function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var n=this._iter.__iterator(bn,e),r=e?Pt(this):0;return new S(function(){var i=n.next();return i.done?i:w(t,e?--r:r++,i.value,i)})},st.prototype[mn]=!0,t(ct,P),ct.prototype.includes=function(t){return this._iter.includes(t)},ct.prototype.__iterate=function(t,e){var n=this,r=0;return this._iter.__iterate(function(e){return t(e,r++,n)},e)},ct.prototype.__iterator=function(t,e){var n=this._iter.__iterator(bn,e),r=0;return new S(function(){var e=n.next();return e.done?e:w(t,r++,e.value,e)})},t(lt,A),lt.prototype.has=function(t){return this._iter.includes(t)},lt.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate(function(e){return t(e,e,n)},e)},lt.prototype.__iterator=function(t,e){var n=this._iter.__iterator(bn,e);return new S(function(){var e=n.next();return e.done?e:w(t,e.value,e.value,e)})},t(ft,j),ft.prototype.entrySeq=function(){return this._iter.toSeq()},ft.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate(function(e){if(e){jt(e);var r=v(e);return t(r?e.get(1):e[1],r?e.get(0):e[0],n)}},e)},ft.prototype.__iterator=function(t,e){var n=this._iter.__iterator(bn,e);return new S(function(){for(;;){var e=n.next();if(e.done)return e;var r=e.value;if(r){jt(r);var i=v(r);return w(t,i?r.get(0):r[0],i?r.get(1):r[1],e)}}})},ct.prototype.cacheResult=st.prototype.cacheResult=lt.prototype.cacheResult=ft.prototype.cacheResult=Lt,t(xt,W),xt.prototype.toString=function(){return this.__toString("Map {","}")},xt.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},xt.prototype.set=function(t,e){return Jt(this,t,e)},xt.prototype.setIn=function(t,e){return this.updateIn(t,dn,function(){return e})},xt.prototype.remove=function(t){return Jt(this,t,dn)},xt.prototype.deleteIn=function(t){return this.updateIn(t,function(){return dn})},xt.prototype.update=function(t,e,n){return 1===arguments.length?t(this):this.updateIn([t],e,n)},xt.prototype.updateIn=function(t,e,n){n||(n=e,e=void 0);var r=oe(this,Rt(t),e,n);return r===dn?void 0:r},xt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Kt()},xt.prototype.merge=function(){return ne(this,void 0,arguments)},xt.prototype.mergeWith=function(t){var e=un.call(arguments,1);return ne(this,t,e)},xt.prototype.mergeIn=function(t){var e=un.call(arguments,1);return this.updateIn(t,Kt(),function(t){return"function"==typeof t.merge?t.merge.apply(t,e):e[e.length-1]})},xt.prototype.mergeDeep=function(){return ne(this,re(void 0),arguments)},xt.prototype.mergeDeepWith=function(t){var e=un.call(arguments,1);return ne(this,re(t),e)},xt.prototype.mergeDeepIn=function(t){var e=un.call(arguments,1);return this.updateIn(t,Kt(),function(t){return"function"==typeof t.mergeDeep?t.mergeDeep.apply(t,e):e[e.length-1]})},xt.prototype.sort=function(t){return Oe(It(this,t))},xt.prototype.sortBy=function(t,e){return Oe(It(this,e,t))},xt.prototype.withMutations=function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},xt.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new r)},xt.prototype.asImmutable=function(){return this.__ensureOwner()},xt.prototype.wasAltered=function(){return this.__altered},xt.prototype.__iterator=function(t,e){return new Ft(this,t,e)},xt.prototype.__iterate=function(t,e){var n=this,r=0;return this._root&&this._root.iterate(function(e){return r++,t(e[1],e[0],n)},e),r},xt.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?qt(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},xt.isMap=Ht;var Hn="@@__IMMUTABLE_MAP__@@",Yn=xt.prototype;Yn[Hn]=!0,Yn[sn]=Yn.remove,Yn.removeIn=Yn.deleteIn,Yt.prototype.get=function(t,e,n,r){for(var i=this.entries,o=0,a=i.length;a>o;o++)if(J(n,i[o][0]))return i[o][1];return r},Yt.prototype.update=function(t,e,r,o,a,u,s){for(var c=a===dn,l=this.entries,f=0,d=l.length;d>f&&!J(o,l[f][0]);f++);var h=d>f;if(h?l[f][1]===a:c)return this;if(n(s),(c||!h)&&n(u),!c||1!==l.length){if(!h&&!c&&l.length>=Un)return Qt(t,l,o,a);var p=t&&t===this.ownerID,_=p?l:i(l);return h?c?f===d-1?_.pop():_[f]=_.pop():_[f]=[o,a]:_.push([o,a]),p?(this.entries=_,this):new Yt(t,_)}},zt.prototype.get=function(t,e,n,r){void 0===e&&(e=et(n));var i=1<<((0===t?e:e>>>t)&fn),o=this.bitmap;return 0===(o&i)?r:this.nodes[ae(o&i-1)].get(t+cn,e,n,r)},zt.prototype.update=function(t,e,n,r,i,o,a){void 0===n&&(n=et(r));var u=(0===e?n:n>>>e)&fn,s=1<=Vn)return ee(t,d,c,u,p);if(l&&!p&&2===d.length&&Zt(d[1^f]))return d[1^f];if(l&&p&&1===d.length&&Zt(p))return p;var _=t&&t===this.ownerID,v=l?p?c:c^s:c|s,y=l?p?ue(d,f,p,_):ce(d,f,_):se(d,f,p,_);return _?(this.bitmap=v,this.nodes=y,this):new zt(t,v,y)},Ut.prototype.get=function(t,e,n,r){void 0===e&&(e=et(n));var i=(0===t?e:e>>>t)&fn,o=this.nodes[i];return o?o.get(t+cn,e,n,r):r},Ut.prototype.update=function(t,e,n,r,i,o,a){void 0===n&&(n=et(r));var u=(0===e?n:n>>>e)&fn,s=i===dn,c=this.nodes,l=c[u];if(s&&!l)return this;var f=$t(l,t,e+cn,n,r,i,o,a);if(f===l)return this;var d=this.count;if(l){if(!f&&(d--,Gn>d))return te(t,c,d,u)}else d++;var h=t&&t===this.ownerID,p=ue(c,u,f,h);return h?(this.count=d,this.nodes=p,this):new Ut(t,d,p)},Vt.prototype.get=function(t,e,n,r){for(var i=this.entries,o=0,a=i.length;a>o;o++)if(J(n,i[o][0]))return i[o][1];return r},Vt.prototype.update=function(t,e,r,o,a,u,s){void 0===r&&(r=et(o));var c=a===dn;if(r!==this.keyHash)return c?this:(n(s),n(u),Xt(this,t,e,r,[o,a]));for(var l=this.entries,f=0,d=l.length;d>f&&!J(o,l[f][0]);f++);var h=d>f;if(h?l[f][1]===a:c)return this;if(n(s),(c||!h)&&n(u),c&&2===d)return new Gt(t,this.keyHash,l[1^f]);var p=t&&t===this.ownerID,_=p?l:i(l);return h?c?f===d-1?_.pop():_[f]=_.pop():_[f]=[o,a]:_.push([o,a]),p?(this.entries=_,this):new Vt(t,this.keyHash,_)},Gt.prototype.get=function(t,e,n,r){return J(n,this.entry[0])?this.entry[1]:r},Gt.prototype.update=function(t,e,r,i,o,a,u){var s=o===dn,c=J(i,this.entry[0]);return(c?o===this.entry[1]:s)?this:(n(u),s?void n(a):c?t&&t===this.ownerID?(this.entry[1]=o,this):new Gt(t,this.keyHash,[i,o]):(n(a),Xt(this,t,e,et(i),[i,o])))},Yt.prototype.iterate=Vt.prototype.iterate=function(t,e){for(var n=this.entries,r=0,i=n.length-1;i>=r;r++)if(t(n[e?i-r:r])===!1)return!1},zt.prototype.iterate=Ut.prototype.iterate=function(t,e){for(var n=this.nodes,r=0,i=n.length-1;i>=r;r++){var o=n[e?i-r:r];if(o&&o.iterate(t,e)===!1)return!1}},Gt.prototype.iterate=function(t,e){return t(this.entry)},t(Ft,S),Ft.prototype.next=function(){for(var t=this._type,e=this._stack;e;){var n,r=e.node,i=e.index++;if(r.entry){if(0===i)return Bt(t,r.entry)}else if(r.entries){if(n=r.entries.length-1,n>=i)return Bt(t,r.entries[this._reverse?n-i:i])}else if(n=r.nodes.length-1,n>=i){var o=r.nodes[this._reverse?n-i:i];if(o){if(o.entry)return Bt(t,o.entry);e=this._stack=Wt(o,e)}continue}e=this._stack=this._stack.__prev}return O()};var zn,Un=ln/4,Vn=ln/2,Gn=ln/4;t(le,q),le.of=function(){return this(arguments)},le.prototype.toString=function(){return this.__toString("List [","]")},le.prototype.get=function(t,e){if(t=a(this,t),t>=0&&t>>e&fn;if(r>=this.array.length)return new de([],t);var i,o=0===r;if(e>0){var a=this.array[r];if(i=a&&a.removeBefore(t,e-cn,n),i===a&&o)return this}if(o&&!i)return this;var u=me(this,t);if(!o)for(var s=0;r>s;s++)u.array[s]=void 0;return i&&(u.array[r]=i),u},de.prototype.removeAfter=function(t,e,n){if(n===(e?1<>>e&fn;if(r>=this.array.length)return this;var i;if(e>0){var o=this.array[r];if(i=o&&o.removeAfter(t,e-cn,n),i===o&&r===this.array.length-1)return this}var a=me(this,t);return a.array.splice(r+1),i&&(a.array[r]=i),a};var Wn,qn={};t(Oe,xt),Oe.of=function(){return this(arguments)},Oe.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Oe.prototype.get=function(t,e){var n=this._map.get(t);return void 0!==n?this._list.get(n)[1]:e},Oe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):Ee()},Oe.prototype.set=function(t,e){return Te(this,t,e)},Oe.prototype.remove=function(t){return Te(this,t,dn)},Oe.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Oe.prototype.__iterate=function(t,e){var n=this;return this._list.__iterate(function(e){return e&&t(e[1],e[0],n)},e)},Oe.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},Oe.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._list.__ensureOwner(t);return t?Ie(e,n,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=n,this)},Oe.isOrderedMap=Me,Oe.prototype[mn]=!0,Oe.prototype[sn]=Oe.prototype.remove;var Kn;t(De,q),De.of=function(){return this(arguments)},De.prototype.toString=function(){return this.__toString("Stack [","]")},De.prototype.get=function(t,e){var n=this._head;for(t=a(this,t);n&&t--;)n=n.next;return n?n.value:e},De.prototype.peek=function(){return this._head&&this._head.value},De.prototype.push=function(){if(0===arguments.length)return this;for(var t=this.size+arguments.length,e=this._head,n=arguments.length-1;n>=0;n--)e={value:arguments[n],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):je(t,e)},De.prototype.pushAll=function(t){if(t=p(t),0===t.size)return this;ut(t.size);var e=this.size,n=this._head;return t.reverse().forEach(function(t){e++,n={value:t,next:n}}),this.__ownerID?(this.size=e,this._head=n,this.__hash=void 0,this.__altered=!0,this):je(e,n)},De.prototype.pop=function(){return this.slice(1)},De.prototype.unshift=function(){return this.push.apply(this,arguments)},De.prototype.unshiftAll=function(t){return this.pushAll(t)},De.prototype.shift=function(){return this.pop.apply(this,arguments)},De.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Pe()},De.prototype.slice=function(t,e){if(s(t,e,this.size))return this;var n=c(t,this.size),r=l(e,this.size);if(r!==this.size)return q.prototype.slice.call(this,t,e);for(var i=this.size-n,o=this._head;n--;)o=o.next;return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):je(i,o)},De.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?je(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},De.prototype.__iterate=function(t,e){if(e)return this.reverse().__iterate(t);for(var n=0,r=this._head;r&&t(r.value,n++,this)!==!1;)r=r.next;return n},De.prototype.__iterator=function(t,e){if(e)return this.reverse().__iterator(t);var n=0,r=this._head;return new S(function(){if(r){var e=r.value;return r=r.next,w(t,n++,e)}return O()})},De.isStack=Ce;var Jn="@@__IMMUTABLE_STACK__@@",$n=De.prototype;$n[Jn]=!0,$n.withMutations=Yn.withMutations,$n.asMutable=Yn.asMutable,$n.asImmutable=Yn.asImmutable,$n.wasAltered=Yn.wasAltered;var Zn;t(Ae,K),Ae.of=function(){return this(arguments)},Ae.fromKeys=function(t){return this(h(t).keySeq())},Ae.prototype.toString=function(){return this.__toString("Set {","}")},Ae.prototype.has=function(t){return this._map.has(t)},Ae.prototype.add=function(t){return Le(this,this._map.set(t,!0))},Ae.prototype.remove=function(t){return Le(this,this._map.remove(t))},Ae.prototype.clear=function(){return Le(this,this._map.clear())},Ae.prototype.union=function(){var t=un.call(arguments,0);return t=t.filter(function(t){return 0!==t.size}),0===t.length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations(function(e){for(var n=0;n1?" by "+this._step:"")+" ]"},qe.prototype.get=function(t,e){return this.has(t)?this._start+a(this,t)*this._step:e},qe.prototype.includes=function(t){var e=(t-this._start)/this._step;return e>=0&&e=e?new qe(0,0):new qe(this.get(t,this._end),this.get(e,this._end),this._step))},qe.prototype.indexOf=function(t){var e=t-this._start;if(e%this._step===0){var n=e/this._step;if(n>=0&&n=o;o++){if(t(i,o,this)===!1)return o+1;i+=e?-r:r}return o},qe.prototype.__iterator=function(t,e){var n=this.size-1,r=this._step,i=e?this._start+n*r:this._start,o=0;return new S(function(){var a=i;return i+=e?-r:r,o>n?O():w(t,o++,a)})},qe.prototype.equals=function(t){return t instanceof qe?this._start===t._start&&this._end===t._end&&this._step===t._step:We(this,t)};var ir;t(Ke,P),Ke.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},Ke.prototype.get=function(t,e){return this.has(t)?this._value:e},Ke.prototype.includes=function(t){return J(this._value,t)},Ke.prototype.slice=function(t,e){var n=this.size;return s(t,e,n)?this:new Ke(this._value,l(e,n)-c(t,n))},Ke.prototype.reverse=function(){return this},Ke.prototype.indexOf=function(t){return J(this._value,t)?0:-1},Ke.prototype.lastIndexOf=function(t){return J(this._value,t)?this.size:-1},Ke.prototype.__iterate=function(t,e){for(var n=0;nt?this.count():this.size);var r=this.slice(0,t);return Ct(this,1===n?r:r.concat(i(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var n=this.toKeyedSeq().findLastKey(t,e);return void 0===n?-1:n},first:function(){return this.get(0)},flatten:function(t){return Ct(this,wt(this,t,!1))},get:function(t,e){return t=a(this,t),0>t||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find(function(e,n){return n===t},void 0,e)},has:function(t){return t=a(this,t),t>=0&&(void 0!==this.size?this.size===1/0||t-1&&t%1===0&&t<=Number.MAX_VALUE}var i=Function.prototype.bind;e.isString=function(t){return"string"==typeof t||"[object String]"===n(t)},e.isArray=Array.isArray||function(t){return"[object Array]"===n(t)},"function"!=typeof/./&&"object"!=typeof Int8Array?e.isFunction=function(t){return"function"==typeof t||!1}:e.isFunction=function(t){return"[object Function]"===toString.call(t)},e.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},e.extend=function(t){var e=arguments.length;if(!t||2>e)return t||{};for(var n=1;e>n;n++)for(var r=arguments[n],i=Object.keys(r),o=i.length,a=0;o>a;a++){var u=i[a];t[u]=r[u]}return t},e.clone=function(t){return e.isObject(t)?e.isArray(t)?t.slice():e.extend({},t):t},e.each=function(t,e,n){var i,o,a=t?t.length:0,u=-1;if(n&&(o=e,e=function(t,e,r){return o.call(n,t,e,r)}),r(a))for(;++ur;r++)n[r]=arguments[r];return new(i.apply(t,[null].concat(n)))};return e.__proto__=t,e.prototype=t.prototype,e}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return c["default"].Iterable.isIterable(t)}function o(t){return i(t)||!(0,l.isObject)(t)}function a(t){return i(t)?t.toJS():t}function u(t){return i(t)?t:c["default"].fromJS(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.isImmutable=i,e.isImmutableValue=o,e.toJS=a,e.toImmutable=u;var s=n(3),c=r(s),l=n(4)},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var n=0;n0)){var e=this.reactorState.get("dirtyStores");if(0!==e.size){var n=c["default"].Set().withMutations(function(n){n.union(t.observerState.get("any")),e.forEach(function(e){var r=t.observerState.getIn(["stores",e]);r&&n.union(r)})});n.forEach(function(e){var n=t.observerState.getIn(["observersMap",e]);if(n){var r=n.get("getter"),i=n.get("handler"),o=h.evaluate(t.prevReactorState,r),a=h.evaluate(t.reactorState,r);t.prevReactorState=o.reactorState,t.reactorState=a.reactorState;var u=o.result,s=a.result;c["default"].is(u,s)||i.call(null,s)}});var r=h.resetDirtyStores(this.reactorState);this.prevReactorState=r,this.reactorState=r}}}},{key:"batchStart",value:function(){this.__batchDepth++}},{key:"batchEnd",value:function(){if(this.__batchDepth--,this.__batchDepth<=0){this.__isDispatching=!0;try{this.__notify()}catch(t){throw this.__isDispatching=!1,t}this.__isDispatching=!1}}}]),t}();e["default"]=(0,y.toFactory)(g),t.exports=e["default"]},function(t,e,n){"use strict";function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n={};return(0,o.each)(e,function(e,r){n[r]=t.evaluate(e)}),n}Object.defineProperty(e,"__esModule",{value:!0});var o=n(4);e["default"]=function(t){return{getInitialState:function(){return i(t,this.getDataBindings())},componentDidMount:function(){var e=this;this.__unwatchFns=[],(0,o.each)(this.getDataBindings(),function(n,i){var o=t.observe(n,function(t){e.setState(r({},i,t))});e.__unwatchFns.push(o)})},componentWillUnmount:function(){for(;this.__unwatchFns.length;)this.__unwatchFns.shift()()}}},t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return new A({result:t,reactorState:e})}function o(t,e){return t.withMutations(function(t){(0,P.each)(e,function(e,n){t.getIn(["stores",n])&&console.warn("Store already defined for id = "+n);var r=e.getInitialState();if(void 0===r&&l(t,"throwOnUndefinedStoreReturnValue"))throw new Error("Store getInitialState() must return a value, did you forget a return statement");if(l(t,"throwOnNonImmutableStore")&&!(0,D.isImmutableValue)(r))throw new Error("Store getInitialState() must return an immutable value, did you forget to call toImmutable");t.update("stores",function(t){return t.set(n,e)}).update("state",function(t){return t.set(n,r)}).update("dirtyStores",function(t){return t.add(n)}).update("storeStates",function(t){return O(t,[n])})}),w(t)})}function a(t,e){return t.withMutations(function(t){(0,P.each)(e,function(e,n){t.update("stores",function(t){return t.set(n,e)})})})}function u(t,e,n){if(void 0===e&&l(t,"throwOnUndefinedActionType"))throw new Error("`dispatch` cannot be called with an `undefined` action type.");var r=t.get("state"),i=t.get("dirtyStores"),o=r.withMutations(function(r){T["default"].dispatchStart(t,e,n),t.get("stores").forEach(function(o,a){var u=r.get(a),s=void 0;try{s=o.handle(u,e,n)}catch(c){throw T["default"].dispatchError(t,c.message),c}if(void 0===s&&l(t,"throwOnUndefinedStoreReturnValue")){var f="Store handler must return a value, did you forget a return statement";throw T["default"].dispatchError(t,f),new Error(f)}r.set(a,s),u!==s&&(i=i.add(a))}),T["default"].dispatchEnd(t,r,i)}),a=t.set("state",o).set("dirtyStores",i).update("storeStates",function(t){return O(t,i)});return w(a)}function s(t,e){var n=[],r=(0,D.toImmutable)({}).withMutations(function(r){(0,P.each)(e,function(e,i){var o=t.getIn(["stores",i]);if(o){var a=o.deserialize(e);void 0!==a&&(r.set(i,a),n.push(i))}})}),i=I["default"].Set(n);return t.update("state",function(t){return t.merge(r)}).update("dirtyStores",function(t){return t.union(i)}).update("storeStates",function(t){return O(t,n)})}function c(t,e,n){var r=e;(0,j.isKeyPath)(e)&&(e=(0,C.fromKeyPath)(e));var i=t.get("nextId"),o=(0,C.getStoreDeps)(e),a=I["default"].Map({id:i,storeDeps:o,getterKey:r,getter:e,handler:n}),u=void 0;return u=0===o.size?t.update("any",function(t){return t.add(i)}):t.withMutations(function(t){o.forEach(function(e){var n=["stores",e];t.hasIn(n)||t.setIn(n,I["default"].Set()),t.updateIn(["stores",e],function(t){return t.add(i)})})}),u=u.set("nextId",i+1).setIn(["observersMap",i],a),{observerState:u,entry:a}}function l(t,e){var n=t.getIn(["options",e]);if(void 0===n)throw new Error("Invalid option: "+e);return n}function f(t,e,n){var r=t.get("observersMap").filter(function(t){var r=t.get("getterKey"),i=!n||t.get("handler")===n;return i?(0,j.isKeyPath)(e)&&(0,j.isKeyPath)(r)?(0,j.isEqual)(e,r):e===r:!1});return t.withMutations(function(t){r.forEach(function(e){return d(t,e)})})}function d(t,e){return t.withMutations(function(t){var n=e.get("id"),r=e.get("storeDeps");0===r.size?t.update("any",function(t){return t.remove(n)}):r.forEach(function(e){t.updateIn(["stores",e],function(t){return t?t.remove(n):t})}),t.removeIn(["observersMap",n])})}function h(t){var e=t.get("state");return t.withMutations(function(t){var n=t.get("stores"),r=n.keySeq().toJS();n.forEach(function(n,r){var i=e.get(r),o=n.handleReset(i);if(void 0===o&&l(t,"throwOnUndefinedStoreReturnValue"))throw new Error("Store handleReset() must return a value, did you forget a return statement");if(l(t,"throwOnNonImmutableStore")&&!(0,D.isImmutableValue)(o))throw new Error("Store reset state must be an immutable value, did you forget to call toImmutable");t.setIn(["state",r],o)}),t.update("storeStates",function(t){return O(t,r)}),v(t)})}function p(t,e){var n=t.get("state");if((0,j.isKeyPath)(e))return i(n.getIn(e),t);if(!(0,C.isGetter)(e))throw new Error("evaluate must be passed a keyPath or Getter");if(g(t,e))return i(S(t,e),t);var r=(0,C.getDeps)(e).map(function(e){return p(t,e).result}),o=(0,C.getComputeFn)(e).apply(null,r);return i(o,b(t,e,o))}function _(t){var e={};return t.get("stores").forEach(function(n,r){var i=t.getIn(["state",r]),o=n.serialize(i);void 0!==o&&(e[r]=o)}),e}function v(t){return t.set("dirtyStores",I["default"].Set())}function y(t){return t}function m(t,e){var n=y(e);return t.getIn(["cache",n])}function g(t,e){var n=m(t,e);if(!n)return!1;var r=n.get("storeStates");return 0===r.size?!1:r.every(function(e,n){return t.getIn(["storeStates",n])===e})}function b(t,e,n){var r=y(e),i=t.get("dispatchId"),o=(0,C.getStoreDeps)(e),a=(0,D.toImmutable)({}).withMutations(function(e){o.forEach(function(n){var r=t.getIn(["storeStates",n]);e.set(n,r)})});return t.setIn(["cache",r],I["default"].Map({value:n,storeStates:a,dispatchId:i}))}function S(t,e){var n=y(e);return t.getIn(["cache",n,"value"])}function w(t){return t.update("dispatchId",function(t){return t+1})}function O(t,e){return t.withMutations(function(t){e.forEach(function(e){var n=t.has(e)?t.get(e)+1:1;t.set(e,n)})})}Object.defineProperty(e,"__esModule",{value:!0}),e.registerStores=o,e.replaceStores=a,e.dispatch=u,e.loadState=s,e.addObserver=c,e.getOption=l,e.removeObserver=f,e.removeObserverByEntry=d,e.reset=h,e.evaluate=p,e.serialize=_,e.resetDirtyStores=v;var M=n(3),I=r(M),E=n(9),T=r(E),D=n(5),C=n(10),j=n(11),P=n(4),A=I["default"].Record({result:null,reactorState:null})},function(t,e,n){"use strict";var r=n(8);e.dispatchStart=function(t,e,n){(0,r.getOption)(t,"logDispatches")&&console.group&&(console.groupCollapsed("Dispatch: %s",e),console.group("payload"),console.debug(n),console.groupEnd())},e.dispatchError=function(t,e){(0,r.getOption)(t,"logDispatches")&&console.group&&(console.debug("Dispatch error: "+e),console.groupEnd())},e.dispatchEnd=function(t,e,n){(0,r.getOption)(t,"logDispatches")&&console.group&&((0,r.getOption)(t,"logDirtyStores")&&console.log("Stores updated:",n.toList().toJS()),(0,r.getOption)(t,"logAppState")&&console.debug("Dispatch done, new state: ",e.toJS()),console.groupEnd())}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return(0,d.isArray)(t)&&(0,d.isFunction)(t[t.length-1])}function o(t){return t[t.length-1]}function a(t){return t.slice(0,t.length-1)}function u(t,e){e||(e=f["default"].Set());var n=f["default"].Set().withMutations(function(e){if(!i(t))throw new Error("getFlattenedDeps must be passed a Getter");a(t).forEach(function(t){if((0,h.isKeyPath)(t))e.add((0,l.List)(t));else{if(!i(t))throw new Error("Invalid getter, each dependency must be a KeyPath or Getter");e.union(u(t))}})});return e.union(n)}function s(t){if(!(0,h.isKeyPath)(t))throw new Error("Cannot create Getter from KeyPath: "+t);return[t,p]}function c(t){if(t.hasOwnProperty("__storeDeps"))return t.__storeDeps;var e=u(t).map(function(t){return t.first()}).filter(function(t){return!!t});return Object.defineProperty(t,"__storeDeps",{enumerable:!1,configurable:!1,writable:!1,value:e}),e}Object.defineProperty(e,"__esModule",{value:!0});var l=n(3),f=r(l),d=n(4),h=n(11),p=function(t){return t};e["default"]={isGetter:i,getComputeFn:o,getFlattenedDeps:u,getStoreDeps:c,getDeps:a,fromKeyPath:s},t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return(0,s.isArray)(t)&&!(0,s.isFunction)(t[t.length-1])}function o(t,e){var n=u["default"].List(t),r=u["default"].List(e);return u["default"].is(n,r)}Object.defineProperty(e,"__esModule",{value:!0}),e.isKeyPath=i,e.isEqual=o;var a=n(3),u=r(a),s=n(4)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=(0,r.Map)({logDispatches:!1,logAppState:!1,logDirtyStores:!1,throwOnUndefinedActionType:!1,throwOnUndefinedStoreReturnValue:!1,throwOnNonImmutableStore:!1,throwOnDispatchInDispatch:!1});e.PROD_OPTIONS=i;var o=(0,r.Map)({logDispatches:!0,logAppState:!0,logDirtyStores:!0,throwOnUndefinedActionType:!0,throwOnUndefinedStoreReturnValue:!0,throwOnNonImmutableStore:!0,throwOnDispatchInDispatch:!0});e.DEBUG_OPTIONS=o;var a=(0,r.Record)({dispatchId:0,state:(0,r.Map)(),stores:(0,r.Map)(),cache:(0,r.Map)(),storeStates:(0,r.Map)(),dirtyStores:(0,r.Set)(),debug:!1,options:i});e.ReactorState=a;var u=(0,r.Record)({any:(0,r.Set)(),stores:(0,r.Map)({}),observersMap:(0,r.Map)({}),nextId:1});e.ObserverState=u}])})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(123),u=r(a);e["default"]=(0,u["default"])(o["default"].reactor)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.callApi=void 0;var i=n(127),o=r(i);e.callApi=o["default"]},function(t,e){"use strict";var n=function(t){var e,n={};if(!(t instanceof Object)||Array.isArray(t))throw new Error("keyMirror(...): Argument must be an object.");for(e in t)t.hasOwnProperty(e)&&(n[e]=e);return n};t.exports=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(77),n(37),e["default"]=new o["default"]({is:"state-info",properties:{stateObj:{type:Object}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"partial-base",properties:{narrow:{type:Boolean,value:!1},showMenu:{type:Boolean,value:!1}},computeMenuButtonClass:function(t,e){return!t&&e?"invisible":""},toggleMenu:function(){this.fire("open-menu")}})},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.getters=e.actions=void 0;var o=n(143),a=i(o),u=n(144),s=r(u);e.actions=a["default"],e.getters=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){t.registerStores({restApiCache:l["default"]})}function o(t){return[["restApiCache",t.entity],function(t){return!!t}]}function a(t){return[["restApiCache",t.entity],function(t){return t||(0,s.toImmutable)({})}]}function u(t){return function(e){return["restApiCache",t.entity,e]}}Object.defineProperty(e,"__esModule",{value:!0}),e.createApiActions=void 0,e.register=i,e.createHasDataGetter=o,e.createEntityMapGetter=a,e.createByIdGetter=u;var s=n(3),c=n(169),l=r(c),f=n(168),d=r(f);e.createApiActions=d["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(6),o=r(i);e["default"]=(0,o["default"])({ENTITY_HISTORY_DATE_SELECTED:null,ENTITY_HISTORY_FETCH_START:null,ENTITY_HISTORY_FETCH_ERROR:null,ENTITY_HISTORY_FETCH_SUCCESS:null,RECENT_ENTITY_HISTORY_FETCH_START:null,RECENT_ENTITY_HISTORY_FETCH_ERROR:null,RECENT_ENTITY_HISTORY_FETCH_SUCCESS:null,LOG_OUT:null})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(6),o=r(i);e["default"]=(0,o["default"])({LOGBOOK_DATE_SELECTED:null,LOGBOOK_ENTRIES_FETCH_START:null,LOGBOOK_ENTRIES_FETCH_ERROR:null,LOGBOOK_ENTRIES_FETCH_SUCCESS:null})},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.getters=e.actions=void 0;var o=n(170),a=i(o),u=n(53),s=r(u);e.actions=a["default"],e.getters=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(6),o=r(i);e["default"]=(0,o["default"])({VALIDATING_AUTH_TOKEN:null,VALID_AUTH_TOKEN:null,INVALID_AUTH_TOKEN:null,LOG_OUT:null})},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t){t.registerStores({authAttempt:u["default"],authCurrent:c["default"],rememberAuth:f["default"]})}Object.defineProperty(e,"__esModule",{value:!0}),e.getters=e.actions=void 0,e.register=o;var a=n(130),u=i(a),s=n(131),c=i(s),l=n(132),f=i(l),d=n(128),h=r(d),p=n(129),_=r(p);e.actions=h,e.getters=_},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=function(){function t(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(s){i=!0,o=s}finally{try{!r&&u["return"]&&u["return"]()}finally{if(i)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function(){function t(t,e){for(var n=0;n4?"value big":"value"}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"loading-box"})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(124),u=r(a);n(115),n(39),n(116),n(117),n(119),n(118),n(120),n(121),n(122),e["default"]=new o["default"]({is:"state-card-content",properties:{stateObj:{type:Object,observer:"stateObjChanged"}},stateObjChanged:function(t,e){var n=o["default"].dom(this);if(!t)return void(n.lastChild&&n.removeChild(n.lastChild));var r=(0,u["default"])(t);if(e&&(0,u["default"])(e)===r)n.lastChild.stateObj=t;else{n.lastChild&&n.removeChild(n.lastChild);var i=document.createElement("state-card-"+r);i.stateObj=t,n.appendChild(i)}}})},function(t,e){"use strict";function n(t,e){return t?e.map(function(e){return e in t.attributes?"has-"+e:""}).join(" "):""}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return u.evaluate(s.canToggleEntity(t))}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var o=n(2),a=r(o),u=a["default"].reactor,s=a["default"].serviceGetters},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){switch(t){case"alarm_control_panel":return e&&"disarmed"===e?"mdi:bell-outline":"mdi:bell";case"automation":return"mdi:playlist-play";case"binary_sensor":return e&&"off"===e?"mdi:radiobox-blank":"mdi:checkbox-marked-circle";case"camera":return"mdi:video";case"configurator":return"mdi:settings";case"conversation":return"mdi:text-to-speech";case"device_tracker":return"mdi:account";case"group":return"mdi:google-circles-communities";case"homeassistant":return"mdi:home";case"input_boolean":return"mdi:drawing";case"light":return"mdi:lightbulb";case"lock":return e&&"unlocked"===e?"mdi:lock-open":"mdi:lock";case"media_player":var n="mdi:cast";return e&&"off"!==e&&"idle"!==e&&(n+="-connected"),n;case"notify":return"mdi:comment-alert";case"rollershutter":return e&&"open"===e?"mdi:window-open":"mdi:window-closed";case"scene":return"mdi:google-pages";case"script":return"mdi:file-document";case"sensor":return"mdi:eye";case"simple_alarm":return"mdi:bell";case"sun":return"mdi:white-balance-sunny";case"switch":return"mdi:flash";case"thermostat":return"mdi:nest-thermostat";case"updater":return"mdi:cloud-upload";case"weblink":return"mdi:open-in-new";default:return console.warn("Unable to find icon for domain "+t+" ("+e+")"),a["default"]}}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var o=n(40),a=r(o)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(6),o=r(i);e["default"]=(0,o["default"])({SERVER_CONFIG_LOADED:null,COMPONENT_LOADED:null,LOG_OUT:null})},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t){t.registerStores({serverComponent:u["default"],serverConfig:c["default"]})}Object.defineProperty(e,"__esModule",{value:!0}),e.getters=e.actions=void 0,e.register=o;var a=n(135),u=i(a),s=n(136),c=i(s),l=n(133),f=r(l),d=n(134),h=r(d);e.actions=f,e.getters=h},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.getters=e.actions=void 0;var o=n(147),a=i(o),u=n(148),s=r(u);e.actions=a["default"],e.getters=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(6),o=r(i);e["default"]=(0,o["default"])({NAVIGATE:null,SHOW_SIDEBAR:null,LOG_OUT:null})},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t){t.registerStores({notifications:u["default"]})}Object.defineProperty(e,"__esModule",{value:!0}),e.getters=e.actions=void 0,e.register=o;var a=n(165),u=i(a),s=n(163),c=r(s),l=n(164),f=r(l);e.actions=c,e.getters=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(6),o=r(i);e["default"]=(0,o["default"])({API_FETCH_SUCCESS:null,API_FETCH_START:null,API_FETCH_FAIL:null,API_SAVE_SUCCESS:null,API_SAVE_START:null,API_SAVE_FAIL:null,API_DELETE_SUCCESS:null,API_DELETE_START:null,API_DELETE_FAIL:null,LOG_OUT:null})},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t){t.registerStores({streamStatus:u["default"]})}Object.defineProperty(e,"__esModule",{value:!0}),e.getters=e.actions=void 0,e.register=o;var a=n(177),u=i(a),s=n(173),c=r(s),l=n(174),f=r(l);e.actions=c,e.getters=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(6),o=r(i);e["default"]=(0,o["default"])({API_FETCH_ALL_START:null,API_FETCH_ALL_SUCCESS:null,API_FETCH_ALL_FAIL:null,SYNC_SCHEDULED:null,SYNC_SCHEDULE_CANCELLED:null})},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t){t.registerStores({isFetchingData:u["default"],isSyncScheduled:c["default"]})}Object.defineProperty(e,"__esModule",{value:!0}),e.getters=e.actions=void 0,e.register=o;var a=n(179),u=i(a),s=n(180),c=i(s),l=n(178),f=r(l),d=n(56),h=r(d);e.actions=f,e.getters=h},function(t,e){"use strict";function n(t){return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e){"use strict";function n(t){var e=t.split(" "),n=r(e,2),i=n[0],o=n[1],a=i.split(":"),u=r(a,3),s=u[0],c=u[1],l=u[2],f=o.split("-"),d=r(f,3),h=d[0],p=d[1],_=d[2];return new Date(Date.UTC(_,parseInt(p,10)-1,h,s,c,l))}var r=function(){function t(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(s){i=!0,o=s}finally{try{!r&&u["return"]&&u["return"]()}finally{if(i)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(22),u=r(a);e["default"]=new o["default"]({is:"domain-icon",properties:{domain:{type:String,value:""},state:{type:String,value:""}},computeIcon:function(t,e){return(0,u["default"])(t,e)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=o["default"].serviceActions;e["default"]=new u["default"]({is:"ha-entity-toggle",properties:{stateObj:{type:Object,observer:"stateObjChanged"},toggleChecked:{type:Boolean,value:!1}},ready:function(){this.forceStateChange()},toggleChanged:function(t){var e=t.target.checked,n=this._checkToggle(this.stateObj);e&&!n?this._call_service(!0):!e&&n&&this._call_service(!1)},stateObjChanged:function(t){t&&this.updateToggle(t)},updateToggle:function(t){this.toggleChecked=this._checkToggle(t)},forceStateChange:function(){var t=this._checkToggle(this.stateObj);this.toggleChecked===t&&(this.toggleChecked=!this.toggleChecked),this.toggleChecked=t},_checkToggle:function(t){return t&&"off"!==t.state&&"unlocked"!==t.state},_call_service:function(t){var e=this,n=void 0,r=void 0;"lock"===this.stateObj.domain?(n="lock",r=t?"lock":"unlock"):(n="homeassistant",r=t?"turn_on":"turn_off"),s.callService(n,r,{entity_id:this.stateObj.entityId}).then(function(){return e.forceStateChange()})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"ha-card",properties:{header:{type:String},elevation:{type:Number,value:1,reflectToAttribute:!0}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(66),o=r(i),a=n(2),u=r(a),s=n(1),c=r(s),l=6e4,f=u["default"].util.parseDateTime;e["default"]=new c["default"]({is:"relative-ha-datetime",properties:{datetime:{type:String,observer:"datetimeChanged"},datetimeObj:{type:Object,observer:"datetimeObjChanged"},parsedDateTime:{type:Object},relativeTime:{type:String,value:"not set"}},created:function(){this.updateRelative=this.updateRelative.bind(this)},attached:function(){this._interval=setInterval(this.updateRelative,l)},detached:function(){clearInterval(this._interval)},datetimeChanged:function(t){this.parsedDateTime=t?f(t):null,this.updateRelative()},datetimeObjChanged:function(t){this.parsedDateTime=t,this.updateRelative()},updateRelative:function(){this.relativeTime=this.parsedDateTime?(0,o["default"])(this.parsedDateTime).fromNow():""}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(18),n(87),n(86),e["default"]=new o["default"]({is:"state-history-charts",properties:{stateHistory:{type:Object},isLoadingData:{type:Boolean,value:!1},apiLoaded:{type:Boolean,value:!1},isLoading:{type:Boolean,computed:"computeIsLoading(isLoadingData, apiLoaded)"},groupedStateHistory:{type:Object,computed:"computeGroupedStateHistory(isLoading, stateHistory)"},isSingleDevice:{type:Boolean,computed:"computeIsSingleDevice(stateHistory)"}},computeIsSingleDevice:function(t){return t&&1===t.size},computeGroupedStateHistory:function(t,e){if(t||!e)return{line:[],timeline:[]};var n={},r=[];e.forEach(function(t){if(t&&0!==t.size){var e=t.find(function(t){return"unit_of_measurement"in t.attributes}),i=e?e.attributes.unit_of_measurement:!1;i?i in n?n[i].push(t.toArray()):n[i]=[t.toArray()]:r.push(t.toArray())}}),r=r.length>0&&r;var i=Object.keys(n).map(function(t){return[t,n[t]]});return{line:i,timeline:r}},googleApiLoaded:function(){var t=this;window.google.load("visualization","1",{packages:["timeline","corechart"],callback:function(){return t.apiLoaded=!0}})},computeContentClasses:function(t){return t?"loading":""},computeIsLoading:function(t,e){return t||!e},computeIsEmpty:function(t){return t&&0===t.size},extractUnit:function(t){return t[0]},extractData:function(t){return t[1]}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7),e["default"]=new o["default"]({is:"state-card-display",properties:{stateObj:{type:Object}}})},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]="bookmark"},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return(0,a["default"])(t).format("LT")}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var o=n(66),a=r(o)},function(t,e){"use strict";function n(){var t=document.getElementById("ha-init-skeleton");t&&t.parentElement.removeChild(t)}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=function(t,e){a.validate(t,{rememberAuth:e,useStreaming:u.useStreaming})};var i=n(2),o=r(i),a=o["default"].authActions,u=o["default"].localStoragePreferences},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.recentEntityHistoryUpdatedMap=e.recentEntityHistoryMap=e.hasDataForCurrentDate=e.entityHistoryForCurrentDate=e.entityHistoryMap=e.currentDate=e.isLoadingEntityHistory=void 0;var r=n(3),i=(e.isLoadingEntityHistory=["isLoadingEntityHistory"],e.currentDate=["currentEntityHistoryDate"]),o=e.entityHistoryMap=["entityHistory"];e.entityHistoryForCurrentDate=[i,o,function(t,e){return e.get(t)||(0,r.toImmutable)({})}],e.hasDataForCurrentDate=[i,o,function(t,e){return!!e.get(t)}],e.recentEntityHistoryMap=["recentEntityHistory"],e.recentEntityHistoryUpdatedMap=["recentEntityHistory"]},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t){ t.registerStores({currentEntityHistoryDate:u["default"],entityHistory:c["default"],isLoadingEntityHistory:f["default"],recentEntityHistory:h["default"],recentEntityHistoryUpdated:_["default"]})}Object.defineProperty(e,"__esModule",{value:!0}),e.getters=e.actions=void 0,e.register=o;var a=n(138),u=i(a),s=n(139),c=i(s),l=n(140),f=i(l),d=n(141),h=i(d),p=n(142),_=i(p),v=n(137),y=r(v),m=n(44),g=r(m);e.actions=y,e.getters=g},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=function(){function t(t,e){for(var n=0;n6e4}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){function r(t,e,n){function r(){y&&clearTimeout(y),h&&clearTimeout(h),g=0,h=y=m=void 0}function s(e,n){n&&clearTimeout(n),h=y=m=void 0,e&&(g=o(),p=t.apply(v,d),y||h||(d=v=void 0))}function c(){var t=e-(o()-_);0>=t||t>e?s(m,h):y=setTimeout(c,t)}function l(){s(S,y)}function f(){if(d=arguments,_=o(),v=this,m=S&&(y||!w),b===!1)var n=w&&!y;else{h||w||(g=_);var r=b-(_-g),i=0>=r||r>b;i?(h&&(h=clearTimeout(h)),g=_,p=t.apply(v,d)):h||(h=setTimeout(l,r))}return i&&y?y=clearTimeout(y):y||e===b||(y=setTimeout(c,e)),n&&(i=!0,p=t.apply(v,d)),!i||y||h||(d=v=void 0),p}var d,h,p,_,v,y,m,g=0,b=!1,S=!0;if("function"!=typeof t)throw new TypeError(a);if(e=0>e?0:+e||0,n===!0){var w=!0;S=!1}else i(n)&&(w=!!n.leading,b="maxWait"in n&&u(+n.maxWait||0,e),S="trailing"in n?!!n.trailing:S);return f.cancel=r,f}var i=n(65),o=n(197),a="Expected a function",u=Math.max;t.exports=r},function(t,e,n){function r(t,e){var n=null==t?void 0:t[e];return i(n)?n:void 0}var i=n(200);t.exports=r},function(t,e){function n(t){return!!t&&"object"==typeof t}t.exports=n},function(t,e,n){function r(t){return i(t)&&u.call(t)==o}var i=n(65),o="[object Function]",a=Object.prototype,u=a.toString;t.exports=r},function(t,e){function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=n},function(t,e,n){(function(t){!function(e,n){t.exports=n()}(this,function(){"use strict";function e(){return Kn.apply(null,arguments)}function n(t){Kn=t}function r(t){return"[object Array]"===Object.prototype.toString.call(t)}function i(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function o(t,e){var n,r=[];for(n=0;n0)for(n in $n)r=$n[n],i=e[r],h(i)||(t[r]=i);return t}function _(t){p(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),Zn===!1&&(Zn=!0,e.updateOffset(this),Zn=!1)}function v(t){return t instanceof _||null!=t&&null!=t._isAMomentObject}function y(t){return 0>t?Math.ceil(t):Math.floor(t)}function m(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=y(e)),n}function g(t,e,n){var r,i=Math.min(t.length,e.length),o=Math.abs(t.length-e.length),a=0;for(r=0;i>r;r++)(n&&t[r]!==e[r]||!n&&m(t[r])!==m(e[r]))&&a++;return a+o}function b(){}function S(t){return t?t.toLowerCase().replace("_","-"):t}function w(t){for(var e,n,r,i,o=0;o0;){if(r=O(i.slice(0,e).join("-")))return r;if(n&&n.length>=e&&g(i,n,!0)>=e-1)break;e--}o++}return null}function O(e){var n=null;if(!Xn[e]&&"undefined"!=typeof t&&t&&t.exports)try{n=Jn._abbr,!function(){var t=new Error('Cannot find module "./locale"');throw t.code="MODULE_NOT_FOUND",t}(),M(n)}catch(r){}return Xn[e]}function M(t,e){var n;return t&&(n=h(e)?E(t):I(t,e),n&&(Jn=n)),Jn._abbr}function I(t,e){return null!==e?(e.abbr=t,Xn[t]=Xn[t]||new b,Xn[t].set(e),M(t),Xn[t]):(delete Xn[t],null)}function E(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return Jn;if(!r(t)){if(e=O(t))return e;t=[t]}return w(t)}function T(t,e){var n=t.toLowerCase();Qn[n]=Qn[n+"s"]=Qn[e]=t}function D(t){return"string"==typeof t?Qn[t]||Qn[t.toLowerCase()]:void 0}function C(t){var e,n,r={};for(n in t)a(t,n)&&(e=D(n),e&&(r[e]=t[n]));return r}function j(t){return t instanceof Function||"[object Function]"===Object.prototype.toString.call(t)}function P(t,n){return function(r){return null!=r?(k(this,t,r),e.updateOffset(this,n),this):A(this,t)}}function A(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function k(t,e,n){t.isValid()&&t._d["set"+(t._isUTC?"UTC":"")+e](n)}function L(t,e){var n;if("object"==typeof t)for(n in t)this.set(n,t[n]);else if(t=D(t),j(this[t]))return this[t](e);return this}function N(t,e,n){var r=""+Math.abs(t),i=e-r.length,o=t>=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}function R(t,e,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),t&&(rr[t]=i),e&&(rr[e[0]]=function(){return N(i.apply(this,arguments),e[1],e[2])}),n&&(rr[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function x(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function H(t){var e,n,r=t.match(tr);for(e=0,n=r.length;n>e;e++)rr[r[e]]?r[e]=rr[r[e]]:r[e]=x(r[e]);return function(i){var o="";for(e=0;n>e;e++)o+=r[e]instanceof Function?r[e].call(i,t):r[e];return o}}function Y(t,e){return t.isValid()?(e=z(e,t.localeData()),nr[e]=nr[e]||H(e),nr[e](t)):t.localeData().invalidDate()}function z(t,e){function n(t){return e.longDateFormat(t)||t}var r=5;for(er.lastIndex=0;r>=0&&er.test(t);)t=t.replace(er,n),er.lastIndex=0,r-=1;return t}function U(t,e,n){Sr[t]=j(e)?e:function(t,r){return t&&n?n:e}}function V(t,e){return a(Sr,t)?Sr[t](e._strict,e._locale):new RegExp(G(t))}function G(t){return F(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,r,i){return e||n||r||i}))}function F(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function B(t,e){var n,r=e;for("string"==typeof t&&(t=[t]),"number"==typeof e&&(r=function(t,n){n[e]=m(t)}),n=0;nr;r++){if(i=s([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===e&&this._longMonthsParse[r].test(t))return r;if(n&&"MMM"===e&&this._shortMonthsParse[r].test(t))return r;if(!n&&this._monthsParse[r].test(t))return r}}function X(t,e){var n;return t.isValid()?"string"==typeof e&&(e=t.localeData().monthsParse(e),"number"!=typeof e)?t:(n=Math.min(t.date(),K(t.year(),e)),t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,n),t):t}function Q(t){return null!=t?(X(this,t),e.updateOffset(this,!0),this):A(this,"Month")}function tt(){return K(this.year(),this.month())}function et(t){return this._monthsParseExact?(a(this,"_monthsRegex")||rt.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex}function nt(t){return this._monthsParseExact?(a(this,"_monthsRegex")||rt.call(this),t?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex}function rt(){function t(t,e){return e.length-t.length}var e,n,r=[],i=[],o=[];for(e=0;12>e;e++)n=s([2e3,e]),r.push(this.monthsShort(n,"")),i.push(this.months(n,"")),o.push(this.months(n,"")),o.push(this.monthsShort(n,""));for(r.sort(t),i.sort(t),o.sort(t),e=0;12>e;e++)r[e]=F(r[e]),i[e]=F(i[e]),o[e]=F(o[e]);this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")$","i"),this._monthsShortStrictRegex=new RegExp("^("+r.join("|")+")$","i")}function it(t){var e,n=t._a;return n&&-2===l(t).overflow&&(e=n[Mr]<0||n[Mr]>11?Mr:n[Ir]<1||n[Ir]>K(n[Or],n[Mr])?Ir:n[Er]<0||n[Er]>24||24===n[Er]&&(0!==n[Tr]||0!==n[Dr]||0!==n[Cr])?Er:n[Tr]<0||n[Tr]>59?Tr:n[Dr]<0||n[Dr]>59?Dr:n[Cr]<0||n[Cr]>999?Cr:-1,l(t)._overflowDayOfYear&&(Or>e||e>Ir)&&(e=Ir),l(t)._overflowWeeks&&-1===e&&(e=jr),l(t)._overflowWeekday&&-1===e&&(e=Pr),l(t).overflow=e),t}function ot(t){e.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function at(t,e){var n=!0;return u(function(){return n&&(ot(t+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),n=!1),e.apply(this,arguments)},e)}function ut(t,e){xr[t]||(ot(e),xr[t]=!0)}function st(t){var e,n,r,i,o,a,u=t._i,s=Hr.exec(u)||Yr.exec(u);if(s){for(l(t).iso=!0,e=0,n=Ur.length;n>e;e++)if(Ur[e][1].exec(s[1])){i=Ur[e][0],r=Ur[e][2]!==!1;break}if(null==i)return void(t._isValid=!1);if(s[3]){for(e=0,n=Vr.length;n>e;e++)if(Vr[e][1].exec(s[3])){o=(s[2]||" ")+Vr[e][0];break}if(null==o)return void(t._isValid=!1)}if(!r&&null!=o)return void(t._isValid=!1);if(s[4]){if(!zr.exec(s[4]))return void(t._isValid=!1);a="Z"}t._f=i+(o||"")+(a||""),Ot(t)}else t._isValid=!1}function ct(t){var n=Gr.exec(t._i);return null!==n?void(t._d=new Date(+n[1])):(st(t),void(t._isValid===!1&&(delete t._isValid,e.createFromInputFallback(t))))}function lt(t,e,n,r,i,o,a){var u=new Date(t,e,n,r,i,o,a);return 100>t&&t>=0&&isFinite(u.getFullYear())&&u.setFullYear(t),u}function ft(t){var e=new Date(Date.UTC.apply(null,arguments));return 100>t&&t>=0&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function dt(t){return ht(t)?366:365}function ht(t){return t%4===0&&t%100!==0||t%400===0}function pt(){return ht(this.year())}function _t(t,e,n){var r=7+e-n,i=(7+ft(t,0,r).getUTCDay()-e)%7;return-i+r-1}function vt(t,e,n,r,i){var o,a,u=(7+n-r)%7,s=_t(t,r,i),c=1+7*(e-1)+u+s;return 0>=c?(o=t-1,a=dt(o)+c):c>dt(t)?(o=t+1,a=c-dt(t)):(o=t,a=c),{year:o,dayOfYear:a}}function yt(t,e,n){var r,i,o=_t(t.year(),e,n),a=Math.floor((t.dayOfYear()-o-1)/7)+1;return 1>a?(i=t.year()-1,r=a+mt(i,e,n)):a>mt(t.year(),e,n)?(r=a-mt(t.year(),e,n),i=t.year()+1):(i=t.year(),r=a),{week:r,year:i}}function mt(t,e,n){var r=_t(t,e,n),i=_t(t+1,e,n);return(dt(t)-r+i)/7}function gt(t,e,n){return null!=t?t:null!=e?e:n}function bt(t){var n=new Date(e.now());return t._useUTC?[n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()]:[n.getFullYear(),n.getMonth(),n.getDate()]}function St(t){var e,n,r,i,o=[];if(!t._d){for(r=bt(t),t._w&&null==t._a[Ir]&&null==t._a[Mr]&&wt(t),t._dayOfYear&&(i=gt(t._a[Or],r[Or]),t._dayOfYear>dt(i)&&(l(t)._overflowDayOfYear=!0),n=ft(i,0,t._dayOfYear),t._a[Mr]=n.getUTCMonth(),t._a[Ir]=n.getUTCDate()),e=0;3>e&&null==t._a[e];++e)t._a[e]=o[e]=r[e];for(;7>e;e++)t._a[e]=o[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[Er]&&0===t._a[Tr]&&0===t._a[Dr]&&0===t._a[Cr]&&(t._nextDay=!0,t._a[Er]=0),t._d=(t._useUTC?ft:lt).apply(null,o),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[Er]=24)}}function wt(t){var e,n,r,i,o,a,u,s;e=t._w,null!=e.GG||null!=e.W||null!=e.E?(o=1,a=4,n=gt(e.GG,t._a[Or],yt(Pt(),1,4).year),r=gt(e.W,1),i=gt(e.E,1),(1>i||i>7)&&(s=!0)):(o=t._locale._week.dow,a=t._locale._week.doy,n=gt(e.gg,t._a[Or],yt(Pt(),o,a).year),r=gt(e.w,1),null!=e.d?(i=e.d,(0>i||i>6)&&(s=!0)):null!=e.e?(i=e.e+o,(e.e<0||e.e>6)&&(s=!0)):i=o),1>r||r>mt(n,o,a)?l(t)._overflowWeeks=!0:null!=s?l(t)._overflowWeekday=!0:(u=vt(n,r,i,o,a),t._a[Or]=u.year,t._dayOfYear=u.dayOfYear)}function Ot(t){if(t._f===e.ISO_8601)return void st(t);t._a=[],l(t).empty=!0;var n,r,i,o,a,u=""+t._i,s=u.length,c=0;for(i=z(t._f,t._locale).match(tr)||[],n=0;n0&&l(t).unusedInput.push(a),u=u.slice(u.indexOf(r)+r.length),c+=r.length),rr[o]?(r?l(t).empty=!1:l(t).unusedTokens.push(o),q(o,r,t)):t._strict&&!r&&l(t).unusedTokens.push(o);l(t).charsLeftOver=s-c,u.length>0&&l(t).unusedInput.push(u),l(t).bigHour===!0&&t._a[Er]<=12&&t._a[Er]>0&&(l(t).bigHour=void 0),t._a[Er]=Mt(t._locale,t._a[Er],t._meridiem),St(t),it(t)}function Mt(t,e,n){var r;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?(r=t.isPM(n),r&&12>e&&(e+=12),r||12!==e||(e=0),e):e}function It(t){var e,n,r,i,o;if(0===t._f.length)return l(t).invalidFormat=!0,void(t._d=new Date(NaN));for(i=0;io)&&(r=o,n=e));u(t,n||e)}function Et(t){if(!t._d){var e=C(t._i);t._a=o([e.year,e.month,e.day||e.date,e.hour,e.minute,e.second,e.millisecond],function(t){return t&&parseInt(t,10)}),St(t)}}function Tt(t){var e=new _(it(Dt(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function Dt(t){var e=t._i,n=t._f;return t._locale=t._locale||E(t._l),null===e||void 0===n&&""===e?d({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),v(e)?new _(it(e)):(r(n)?It(t):n?Ot(t):i(e)?t._d=e:Ct(t),f(t)||(t._d=null),t))}function Ct(t){var n=t._i;void 0===n?t._d=new Date(e.now()):i(n)?t._d=new Date(+n):"string"==typeof n?ct(t):r(n)?(t._a=o(n.slice(0),function(t){return parseInt(t,10)}),St(t)):"object"==typeof n?Et(t):"number"==typeof n?t._d=new Date(n):e.createFromInputFallback(t)}function jt(t,e,n,r,i){var o={};return"boolean"==typeof n&&(r=n,n=void 0),o._isAMomentObject=!0,o._useUTC=o._isUTC=i,o._l=n,o._i=t,o._f=e,o._strict=r,Tt(o)}function Pt(t,e,n,r){return jt(t,e,n,r,!1)}function At(t,e){var n,i;if(1===e.length&&r(e[0])&&(e=e[0]),!e.length)return Pt();for(n=e[0],i=1;it&&(t=-t,n="-"),n+N(~~(t/60),2)+e+N(~~t%60,2)})}function Ht(t,e){var n=(e||"").match(t)||[],r=n[n.length-1]||[],i=(r+"").match(Kr)||["-",0,0],o=+(60*i[1])+m(i[2]);return"+"===i[0]?o:-o}function Yt(t,n){var r,o;return n._isUTC?(r=n.clone(),o=(v(t)||i(t)?+t:+Pt(t))-+r,r._d.setTime(+r._d+o),e.updateOffset(r,!1),r):Pt(t).local()}function zt(t){return 15*-Math.round(t._d.getTimezoneOffset()/15)}function Ut(t,n){var r,i=this._offset||0;return this.isValid()?null!=t?("string"==typeof t?t=Ht(mr,t):Math.abs(t)<16&&(t=60*t),!this._isUTC&&n&&(r=zt(this)),this._offset=t,this._isUTC=!0,null!=r&&this.add(r,"m"),i!==t&&(!n||this._changeInProgress?re(this,Xt(t-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?i:zt(this):null!=t?this:NaN}function Vt(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}function Gt(t){return this.utcOffset(0,t)}function Ft(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(zt(this),"m")),this}function Bt(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ht(yr,this._i)),this}function Wt(t){return this.isValid()?(t=t?Pt(t).utcOffset():0,(this.utcOffset()-t)%60===0):!1}function qt(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Kt(){if(!h(this._isDSTShifted))return this._isDSTShifted;var t={};if(p(t,this),t=Dt(t),t._a){var e=t._isUTC?s(t._a):Pt(t._a);this._isDSTShifted=this.isValid()&&g(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Jt(){return this.isValid()?!this._isUTC:!1}function $t(){return this.isValid()?this._isUTC:!1}function Zt(){return this.isValid()?this._isUTC&&0===this._offset:!1}function Xt(t,e){var n,r,i,o=t,u=null;return Rt(t)?o={ms:t._milliseconds,d:t._days,M:t._months}:"number"==typeof t?(o={},e?o[e]=t:o.milliseconds=t):(u=Jr.exec(t))?(n="-"===u[1]?-1:1,o={y:0,d:m(u[Ir])*n,h:m(u[Er])*n,m:m(u[Tr])*n,s:m(u[Dr])*n,ms:m(u[Cr])*n}):(u=$r.exec(t))?(n="-"===u[1]?-1:1,o={y:Qt(u[2],n),M:Qt(u[3],n),d:Qt(u[4],n),h:Qt(u[5],n),m:Qt(u[6],n),s:Qt(u[7],n),w:Qt(u[8],n)}):null==o?o={}:"object"==typeof o&&("from"in o||"to"in o)&&(i=ee(Pt(o.from),Pt(o.to)),o={},o.ms=i.milliseconds,o.M=i.months),r=new Nt(o),Rt(t)&&a(t,"_locale")&&(r._locale=t._locale),r}function Qt(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function te(t,e){var n={milliseconds:0,months:0};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function ee(t,e){var n;return t.isValid()&&e.isValid()?(e=Yt(e,t),t.isBefore(e)?n=te(t,e):(n=te(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function ne(t,e){return function(n,r){var i,o;return null===r||isNaN(+r)||(ut(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period)."),o=n,n=r,r=o),n="string"==typeof n?+n:n,i=Xt(n,r),re(this,i,t),this}}function re(t,n,r,i){var o=n._milliseconds,a=n._days,u=n._months;t.isValid()&&(i=null==i?!0:i,o&&t._d.setTime(+t._d+o*r),a&&k(t,"Date",A(t,"Date")+a*r),u&&X(t,A(t,"Month")+u*r),i&&e.updateOffset(t,a||u))}function ie(t,e){var n=t||Pt(),r=Yt(n,this).startOf("day"),i=this.diff(r,"days",!0),o=-6>i?"sameElse":-1>i?"lastWeek":0>i?"lastDay":1>i?"sameDay":2>i?"nextDay":7>i?"nextWeek":"sameElse",a=e&&(j(e[o])?e[o]():e[o]);return this.format(a||this.localeData().calendar(o,this,Pt(n)))}function oe(){return new _(this)}function ae(t,e){var n=v(t)?t:Pt(t);return this.isValid()&&n.isValid()?(e=D(h(e)?"millisecond":e),"millisecond"===e?+this>+n:+n<+this.clone().startOf(e)):!1}function ue(t,e){var n=v(t)?t:Pt(t);return this.isValid()&&n.isValid()?(e=D(h(e)?"millisecond":e),"millisecond"===e?+n>+this:+this.clone().endOf(e)<+n):!1}function se(t,e,n){return this.isAfter(t,n)&&this.isBefore(e,n)}function ce(t,e){var n,r=v(t)?t:Pt(t);return this.isValid()&&r.isValid()?(e=D(e||"millisecond"),"millisecond"===e?+this===+r:(n=+r,+this.clone().startOf(e)<=n&&n<=+this.clone().endOf(e))):!1}function le(t,e){return this.isSame(t,e)||this.isAfter(t,e)}function fe(t,e){return this.isSame(t,e)||this.isBefore(t,e)}function de(t,e,n){var r,i,o,a;return this.isValid()?(r=Yt(t,this),r.isValid()?(i=6e4*(r.utcOffset()-this.utcOffset()),e=D(e),"year"===e||"month"===e||"quarter"===e?(a=he(this,r),"quarter"===e?a/=3:"year"===e&&(a/=12)):(o=this-r,a="second"===e?o/1e3:"minute"===e?o/6e4:"hour"===e?o/36e5:"day"===e?(o-i)/864e5:"week"===e?(o-i)/6048e5:o),n?a:y(a)):NaN):NaN}function he(t,e){var n,r,i=12*(e.year()-t.year())+(e.month()-t.month()),o=t.clone().add(i,"months");return 0>e-o?(n=t.clone().add(i-1,"months"),r=(e-o)/(o-n)):(n=t.clone().add(i+1,"months"),r=(e-o)/(n-o)),-(i+r)}function pe(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function _e(){var t=this.clone().utc();return 0o&&(e=o),Ue.call(this,t,e,n,r,i))}function Ue(t,e,n,r,i){var o=vt(t,e,n,r,i),a=ft(o.year,0,o.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}function Ve(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}function Ge(t){return yt(t,this._week.dow,this._week.doy).week}function Fe(){return this._week.dow}function Be(){return this._week.doy}function We(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function qe(t){var e=yt(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function Ke(t,e){return"string"!=typeof t?t:isNaN(t)?(t=e.weekdaysParse(t),"number"==typeof t?t:null):parseInt(t,10)}function Je(t,e){return r(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]}function $e(t){return this._weekdaysShort[t.day()]}function Ze(t){return this._weekdaysMin[t.day()]}function Xe(t,e,n){var r,i,o;for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;7>r;r++){if(i=Pt([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".",".?")+"$","i")),this._weekdaysParse[r]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[r].test(t))return r;if(n&&"ddd"===e&&this._shortWeekdaysParse[r].test(t))return r;if(n&&"dd"===e&&this._minWeekdaysParse[r].test(t))return r;if(!n&&this._weekdaysParse[r].test(t))return r}}function Qe(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=Ke(t,this.localeData()),this.add(t-e,"d")):e}function tn(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function en(t){return this.isValid()?null==t?this.day()||7:this.day(this.day()%7?t:t-7):null!=t?this:NaN; -}function nn(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}function rn(){return this.hours()%12||12}function on(t,e){R(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function an(t,e){return e._meridiemParse}function un(t){return"p"===(t+"").toLowerCase().charAt(0)}function sn(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}function cn(t,e){e[Cr]=m(1e3*("0."+t))}function ln(){return this._isUTC?"UTC":""}function fn(){return this._isUTC?"Coordinated Universal Time":""}function dn(t){return Pt(1e3*t)}function hn(){return Pt.apply(null,arguments).parseZone()}function pn(t,e,n){var r=this._calendar[t];return j(r)?r.call(e,n):r}function _n(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t])}function vn(){return this._invalidDate}function yn(t){return this._ordinal.replace("%d",t)}function mn(t){return t}function gn(t,e,n,r){var i=this._relativeTime[n];return j(i)?i(t,e,n,r):i.replace(/%d/i,t)}function bn(t,e){var n=this._relativeTime[t>0?"future":"past"];return j(n)?n(e):n.replace(/%s/i,e)}function Sn(t){var e,n;for(n in t)e=t[n],j(e)?this[n]=e:this["_"+n]=e;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function wn(t,e,n,r){var i=E(),o=s().set(r,e);return i[n](o,t)}function On(t,e,n,r,i){if("number"==typeof t&&(e=t,t=void 0),t=t||"",null!=e)return wn(t,e,n,i);var o,a=[];for(o=0;r>o;o++)a[o]=wn(t,o,n,i);return a}function Mn(t,e){return On(t,e,"months",12,"month")}function In(t,e){return On(t,e,"monthsShort",12,"month")}function En(t,e){return On(t,e,"weekdays",7,"day")}function Tn(t,e){return On(t,e,"weekdaysShort",7,"day")}function Dn(t,e){return On(t,e,"weekdaysMin",7,"day")}function Cn(){var t=this._data;return this._milliseconds=bi(this._milliseconds),this._days=bi(this._days),this._months=bi(this._months),t.milliseconds=bi(t.milliseconds),t.seconds=bi(t.seconds),t.minutes=bi(t.minutes),t.hours=bi(t.hours),t.months=bi(t.months),t.years=bi(t.years),this}function jn(t,e,n,r){var i=Xt(e,n);return t._milliseconds+=r*i._milliseconds,t._days+=r*i._days,t._months+=r*i._months,t._bubble()}function Pn(t,e){return jn(this,t,e,1)}function An(t,e){return jn(this,t,e,-1)}function kn(t){return 0>t?Math.floor(t):Math.ceil(t)}function Ln(){var t,e,n,r,i,o=this._milliseconds,a=this._days,u=this._months,s=this._data;return o>=0&&a>=0&&u>=0||0>=o&&0>=a&&0>=u||(o+=864e5*kn(Rn(u)+a),a=0,u=0),s.milliseconds=o%1e3,t=y(o/1e3),s.seconds=t%60,e=y(t/60),s.minutes=e%60,n=y(e/60),s.hours=n%24,a+=y(n/24),i=y(Nn(a)),u+=i,a-=kn(Rn(i)),r=y(u/12),u%=12,s.days=a,s.months=u,s.years=r,this}function Nn(t){return 4800*t/146097}function Rn(t){return 146097*t/4800}function xn(t){var e,n,r=this._milliseconds;if(t=D(t),"month"===t||"year"===t)return e=this._days+r/864e5,n=this._months+Nn(e),"month"===t?n:n/12;switch(e=this._days+Math.round(Rn(this._months)),t){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return 24*e+r/36e5;case"minute":return 1440*e+r/6e4;case"second":return 86400*e+r/1e3;case"millisecond":return Math.floor(864e5*e)+r;default:throw new Error("Unknown unit "+t)}}function Hn(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*m(this._months/12)}function Yn(t){return function(){return this.as(t)}}function zn(t){return t=D(t),this[t+"s"]()}function Un(t){return function(){return this._data[t]}}function Vn(){return y(this.days()/7)}function Gn(t,e,n,r,i){return i.relativeTime(e||1,!!n,t,r)}function Fn(t,e,n){var r=Xt(t).abs(),i=Ri(r.as("s")),o=Ri(r.as("m")),a=Ri(r.as("h")),u=Ri(r.as("d")),s=Ri(r.as("M")),c=Ri(r.as("y")),l=i=o&&["m"]||o=a&&["h"]||a=u&&["d"]||u=s&&["M"]||s=c&&["y"]||["yy",c];return l[2]=e,l[3]=+t>0,l[4]=n,Gn.apply(null,l)}function Bn(t,e){return void 0===xi[t]?!1:void 0===e?xi[t]:(xi[t]=e,!0)}function Wn(t){var e=this.localeData(),n=Fn(this,!t,e);return t&&(n=e.pastFuture(+this,n)),e.postformat(n)}function qn(){var t,e,n,r=Hi(this._milliseconds)/1e3,i=Hi(this._days),o=Hi(this._months);t=y(r/60),e=y(t/60),r%=60,t%=60,n=y(o/12),o%=12;var a=n,u=o,s=i,c=e,l=t,f=r,d=this.asSeconds();return d?(0>d?"-":"")+"P"+(a?a+"Y":"")+(u?u+"M":"")+(s?s+"D":"")+(c||l||f?"T":"")+(c?c+"H":"")+(l?l+"M":"")+(f?f+"S":""):"P0D"}var Kn,Jn,$n=e.momentProperties=[],Zn=!1,Xn={},Qn={},tr=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,er=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,nr={},rr={},ir=/\d/,or=/\d\d/,ar=/\d{3}/,ur=/\d{4}/,sr=/[+-]?\d{6}/,cr=/\d\d?/,lr=/\d\d\d\d?/,fr=/\d\d\d\d\d\d?/,dr=/\d{1,3}/,hr=/\d{1,4}/,pr=/[+-]?\d{1,6}/,_r=/\d+/,vr=/[+-]?\d+/,yr=/Z|[+-]\d\d:?\d\d/gi,mr=/Z|[+-]\d\d(?::?\d\d)?/gi,gr=/[+-]?\d+(\.\d{1,3})?/,br=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Sr={},wr={},Or=0,Mr=1,Ir=2,Er=3,Tr=4,Dr=5,Cr=6,jr=7,Pr=8;R("M",["MM",2],"Mo",function(){return this.month()+1}),R("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),R("MMMM",0,0,function(t){return this.localeData().months(this,t)}),T("month","M"),U("M",cr),U("MM",cr,or),U("MMM",function(t,e){return e.monthsShortRegex(t)}),U("MMMM",function(t,e){return e.monthsRegex(t)}),B(["M","MM"],function(t,e){e[Mr]=m(t)-1}),B(["MMM","MMMM"],function(t,e,n,r){var i=n._locale.monthsParse(t,r,n._strict);null!=i?e[Mr]=i:l(n).invalidMonth=t});var Ar=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,kr="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Lr="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Nr=br,Rr=br,xr={};e.suppressDeprecationWarnings=!1;var Hr=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,Yr=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,zr=/Z|[+-]\d\d(?::?\d\d)?/,Ur=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Vr=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Gr=/^\/?Date\((\-?\d+)/i;e.createFromInputFallback=at("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),R("Y",0,0,function(){var t=this.year();return 9999>=t?""+t:"+"+t}),R(0,["YY",2],0,function(){return this.year()%100}),R(0,["YYYY",4],0,"year"),R(0,["YYYYY",5],0,"year"),R(0,["YYYYYY",6,!0],0,"year"),T("year","y"),U("Y",vr),U("YY",cr,or),U("YYYY",hr,ur),U("YYYYY",pr,sr),U("YYYYYY",pr,sr),B(["YYYYY","YYYYYY"],Or),B("YYYY",function(t,n){n[Or]=2===t.length?e.parseTwoDigitYear(t):m(t)}),B("YY",function(t,n){n[Or]=e.parseTwoDigitYear(t)}),B("Y",function(t,e){e[Or]=parseInt(t,10)}),e.parseTwoDigitYear=function(t){return m(t)+(m(t)>68?1900:2e3)};var Fr=P("FullYear",!1);e.ISO_8601=function(){};var Br=at("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var t=Pt.apply(null,arguments);return this.isValid()&&t.isValid()?this>t?this:t:d()}),Wr=at("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var t=Pt.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:d()}),qr=function(){return Date.now?Date.now():+new Date};xt("Z",":"),xt("ZZ",""),U("Z",mr),U("ZZ",mr),B(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=Ht(mr,t)});var Kr=/([\+\-]|\d\d)/gi;e.updateOffset=function(){};var Jr=/(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,$r=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Xt.fn=Nt.prototype;var Zr=ne(1,"add"),Xr=ne(-1,"subtract");e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var Qr=at("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});R(0,["gg",2],0,function(){return this.weekYear()%100}),R(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ne("gggg","weekYear"),Ne("ggggg","weekYear"),Ne("GGGG","isoWeekYear"),Ne("GGGGG","isoWeekYear"),T("weekYear","gg"),T("isoWeekYear","GG"),U("G",vr),U("g",vr),U("GG",cr,or),U("gg",cr,or),U("GGGG",hr,ur),U("gggg",hr,ur),U("GGGGG",pr,sr),U("ggggg",pr,sr),W(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,r){e[r.substr(0,2)]=m(t)}),W(["gg","GG"],function(t,n,r,i){n[i]=e.parseTwoDigitYear(t)}),R("Q",0,"Qo","quarter"),T("quarter","Q"),U("Q",ir),B("Q",function(t,e){e[Mr]=3*(m(t)-1)}),R("w",["ww",2],"wo","week"),R("W",["WW",2],"Wo","isoWeek"),T("week","w"),T("isoWeek","W"),U("w",cr),U("ww",cr,or),U("W",cr),U("WW",cr,or),W(["w","ww","W","WW"],function(t,e,n,r){e[r.substr(0,1)]=m(t)});var ti={dow:0,doy:6};R("D",["DD",2],"Do","date"),T("date","D"),U("D",cr),U("DD",cr,or),U("Do",function(t,e){return t?e._ordinalParse:e._ordinalParseLenient}),B(["D","DD"],Ir),B("Do",function(t,e){e[Ir]=m(t.match(cr)[0],10)});var ei=P("Date",!0);R("d",0,"do","day"),R("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),R("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),R("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),R("e",0,0,"weekday"),R("E",0,0,"isoWeekday"),T("day","d"),T("weekday","e"),T("isoWeekday","E"),U("d",cr),U("e",cr),U("E",cr),U("dd",br),U("ddd",br),U("dddd",br),W(["dd","ddd","dddd"],function(t,e,n,r){var i=n._locale.weekdaysParse(t,r,n._strict);null!=i?e.d=i:l(n).invalidWeekday=t}),W(["d","e","E"],function(t,e,n,r){e[r]=m(t)});var ni="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ri="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),ii="Su_Mo_Tu_We_Th_Fr_Sa".split("_");R("DDD",["DDDD",3],"DDDo","dayOfYear"),T("dayOfYear","DDD"),U("DDD",dr),U("DDDD",ar),B(["DDD","DDDD"],function(t,e,n){n._dayOfYear=m(t)}),R("H",["HH",2],0,"hour"),R("h",["hh",2],0,rn),R("hmm",0,0,function(){return""+rn.apply(this)+N(this.minutes(),2)}),R("hmmss",0,0,function(){return""+rn.apply(this)+N(this.minutes(),2)+N(this.seconds(),2)}),R("Hmm",0,0,function(){return""+this.hours()+N(this.minutes(),2)}),R("Hmmss",0,0,function(){return""+this.hours()+N(this.minutes(),2)+N(this.seconds(),2)}),on("a",!0),on("A",!1),T("hour","h"),U("a",an),U("A",an),U("H",cr),U("h",cr),U("HH",cr,or),U("hh",cr,or),U("hmm",lr),U("hmmss",fr),U("Hmm",lr),U("Hmmss",fr),B(["H","HH"],Er),B(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),B(["h","hh"],function(t,e,n){e[Er]=m(t),l(n).bigHour=!0}),B("hmm",function(t,e,n){var r=t.length-2;e[Er]=m(t.substr(0,r)),e[Tr]=m(t.substr(r)),l(n).bigHour=!0}),B("hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[Er]=m(t.substr(0,r)),e[Tr]=m(t.substr(r,2)),e[Dr]=m(t.substr(i)),l(n).bigHour=!0}),B("Hmm",function(t,e,n){var r=t.length-2;e[Er]=m(t.substr(0,r)),e[Tr]=m(t.substr(r))}),B("Hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[Er]=m(t.substr(0,r)),e[Tr]=m(t.substr(r,2)),e[Dr]=m(t.substr(i))});var oi=/[ap]\.?m?\.?/i,ai=P("Hours",!0);R("m",["mm",2],0,"minute"),T("minute","m"),U("m",cr),U("mm",cr,or),B(["m","mm"],Tr);var ui=P("Minutes",!1);R("s",["ss",2],0,"second"),T("second","s"),U("s",cr),U("ss",cr,or),B(["s","ss"],Dr);var si=P("Seconds",!1);R("S",0,0,function(){return~~(this.millisecond()/100)}),R(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),R(0,["SSS",3],0,"millisecond"),R(0,["SSSS",4],0,function(){return 10*this.millisecond()}),R(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),R(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),R(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),R(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),R(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),T("millisecond","ms"),U("S",dr,ir),U("SS",dr,or),U("SSS",dr,ar);var ci;for(ci="SSSS";ci.length<=9;ci+="S")U(ci,_r);for(ci="S";ci.length<=9;ci+="S")B(ci,cn);var li=P("Milliseconds",!1);R("z",0,0,"zoneAbbr"),R("zz",0,0,"zoneName");var fi=_.prototype;fi.add=Zr,fi.calendar=ie,fi.clone=oe,fi.diff=de,fi.endOf=Me,fi.format=ve,fi.from=ye,fi.fromNow=me,fi.to=ge,fi.toNow=be,fi.get=L,fi.invalidAt=ke,fi.isAfter=ae,fi.isBefore=ue,fi.isBetween=se,fi.isSame=ce,fi.isSameOrAfter=le,fi.isSameOrBefore=fe,fi.isValid=Pe,fi.lang=Qr,fi.locale=Se,fi.localeData=we,fi.max=Wr,fi.min=Br,fi.parsingFlags=Ae,fi.set=L,fi.startOf=Oe,fi.subtract=Xr,fi.toArray=De,fi.toObject=Ce,fi.toDate=Te,fi.toISOString=_e,fi.toJSON=je,fi.toString=pe,fi.unix=Ee,fi.valueOf=Ie,fi.creationData=Le,fi.year=Fr,fi.isLeapYear=pt,fi.weekYear=Re,fi.isoWeekYear=xe,fi.quarter=fi.quarters=Ve,fi.month=Q,fi.daysInMonth=tt,fi.week=fi.weeks=We,fi.isoWeek=fi.isoWeeks=qe,fi.weeksInYear=Ye,fi.isoWeeksInYear=He,fi.date=ei,fi.day=fi.days=Qe,fi.weekday=tn,fi.isoWeekday=en,fi.dayOfYear=nn,fi.hour=fi.hours=ai,fi.minute=fi.minutes=ui,fi.second=fi.seconds=si,fi.millisecond=fi.milliseconds=li,fi.utcOffset=Ut,fi.utc=Gt,fi.local=Ft,fi.parseZone=Bt,fi.hasAlignedHourOffset=Wt,fi.isDST=qt,fi.isDSTShifted=Kt,fi.isLocal=Jt,fi.isUtcOffset=$t,fi.isUtc=Zt,fi.isUTC=Zt,fi.zoneAbbr=ln,fi.zoneName=fn,fi.dates=at("dates accessor is deprecated. Use date instead.",ei),fi.months=at("months accessor is deprecated. Use month instead",Q),fi.years=at("years accessor is deprecated. Use year instead",Fr),fi.zone=at("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Vt);var di=fi,hi={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},pi={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},_i="Invalid date",vi="%d",yi=/\d{1,2}/,mi={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},gi=b.prototype;gi._calendar=hi,gi.calendar=pn,gi._longDateFormat=pi,gi.longDateFormat=_n,gi._invalidDate=_i,gi.invalidDate=vn,gi._ordinal=vi,gi.ordinal=yn,gi._ordinalParse=yi,gi.preparse=mn,gi.postformat=mn,gi._relativeTime=mi,gi.relativeTime=gn,gi.pastFuture=bn,gi.set=Sn,gi.months=J,gi._months=kr,gi.monthsShort=$,gi._monthsShort=Lr,gi.monthsParse=Z,gi._monthsRegex=Rr,gi.monthsRegex=nt,gi._monthsShortRegex=Nr,gi.monthsShortRegex=et,gi.week=Ge,gi._week=ti,gi.firstDayOfYear=Be,gi.firstDayOfWeek=Fe,gi.weekdays=Je,gi._weekdays=ni,gi.weekdaysMin=Ze,gi._weekdaysMin=ii,gi.weekdaysShort=$e,gi._weekdaysShort=ri,gi.weekdaysParse=Xe,gi.isPM=un,gi._meridiemParse=oi,gi.meridiem=sn,M("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=1===m(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),e.lang=at("moment.lang is deprecated. Use moment.locale instead.",M),e.langData=at("moment.langData is deprecated. Use moment.localeData instead.",E);var bi=Math.abs,Si=Yn("ms"),wi=Yn("s"),Oi=Yn("m"),Mi=Yn("h"),Ii=Yn("d"),Ei=Yn("w"),Ti=Yn("M"),Di=Yn("y"),Ci=Un("milliseconds"),ji=Un("seconds"),Pi=Un("minutes"),Ai=Un("hours"),ki=Un("days"),Li=Un("months"),Ni=Un("years"),Ri=Math.round,xi={s:45,m:45,h:22,d:26,M:11},Hi=Math.abs,Yi=Nt.prototype;Yi.abs=Cn,Yi.add=Pn,Yi.subtract=An,Yi.as=xn,Yi.asMilliseconds=Si,Yi.asSeconds=wi,Yi.asMinutes=Oi,Yi.asHours=Mi,Yi.asDays=Ii,Yi.asWeeks=Ei,Yi.asMonths=Ti,Yi.asYears=Di,Yi.valueOf=Hn,Yi._bubble=Ln,Yi.get=zn,Yi.milliseconds=Ci,Yi.seconds=ji,Yi.minutes=Pi,Yi.hours=Ai,Yi.days=ki,Yi.weeks=Vn,Yi.months=Li,Yi.years=Ni,Yi.humanize=Wn,Yi.toISOString=qn,Yi.toString=qn,Yi.toJSON=qn,Yi.locale=Se,Yi.localeData=we,Yi.toIsoString=at("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",qn),Yi.lang=Qr,R("X",0,0,"unix"),R("x",0,0,"valueOf"),U("x",vr),U("X",gr),B("X",function(t,e,n){n._d=new Date(1e3*parseFloat(t,10))}),B("x",function(t,e,n){n._d=new Date(m(t))}),e.version="2.11.1",n(Pt),e.fn=di,e.min=kt,e.max=Lt,e.now=qr,e.utc=s,e.unix=dn,e.months=Mn,e.isDate=i,e.locale=M,e.invalid=d,e.duration=Xt,e.isMoment=v,e.weekdays=En,e.parseZone=hn,e.localeData=E,e.isDuration=Rt,e.monthsShort=In,e.weekdaysMin=Dn,e.defineLocale=I,e.weekdaysShort=Tn,e.normalizeUnits=D,e.relativeTimeThreshold=Bn,e.prototype=di;var zi=e;return zi})}).call(e,n(67)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=n(166),u=n(191),s=i(u),c=n(193),l=i(c),f=n(195),d=i(f),h=n(15),p=r(h),_=n(24),v=r(_),y=n(9),m=r(y),g=n(45),b=r(g),S=n(146),w=r(S),O=n(25),M=r(O),I=n(151),E=r(I),T=n(48),D=r(T),C=n(51),j=r(C),P=n(27),A=r(P),k=n(58),L=r(k),N=n(13),R=r(N),x=n(29),H=r(x),Y=n(31),z=r(Y),U=n(182),V=r(U),G=n(188),F=r(G),B=n(10),W=r(B),q=function K(){o(this,K);var t=(0,s["default"])();Object.defineProperties(this,{demo:{value:!1,enumerable:!0},localStoragePreferences:{value:a.localStoragePreferences,enumerable:!0},reactor:{value:t,enumerable:!0},util:{value:d["default"],enumerable:!0},startLocalStoragePreferencesSync:{value:a.localStoragePreferences.startSync.bind(a.localStoragePreferences,t)},startUrlSync:{value:j.urlSync.startSync.bind(null,t)},stopUrlSync:{value:j.urlSync.stopSync.bind(null,t)}}),(0,l["default"])(this,t,{auth:p,config:v,entity:m,entityHistory:b,errorLog:w,event:M,logbook:E,moreInfo:D,navigation:j,notification:A,view:L,service:R,stream:H,sync:z,template:V,voice:F,restApi:W})};e["default"]=q},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(76),e["default"]=new o["default"]({is:"ha-badges-card",properties:{states:{type:Array}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a),s=n(21),c=r(s);n(36),n(35),n(19);var l=u["default"].moreInfoActions;e["default"]=new o["default"]({is:"ha-domain-card",properties:{domain:{type:String},states:{type:Array},groupEntity:{type:Object}},computeDomainTitle:function(t){return t.replace(/_/g," ")},entityTapped:function(t){if(!t.target.classList.contains("paper-toggle-button")&&!t.target.classList.contains("paper-icon-button")){t.stopPropagation();var e=t.model.item.entityId;this.async(function(){return l.selectEntity(e)},1)}},showGroupToggle:function(t,e){return!t||!e||"on"!==t.state&&"off"!==t.state?!1:e.reduce(function(t,e){return t+(0,c["default"])(e.entityId)},0)>1}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(36),e["default"]=new o["default"]({is:"ha-introduction-card",properties:{showInstallInstruction:{type:Boolean,value:!1},showHideInstruction:{type:Boolean,value:!0}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(41),u=r(a);e["default"]=new o["default"]({is:"display-time",properties:{dateObj:{type:Object}},computeTime:function(t){return t?(0,u["default"])(t):""}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s),l=o["default"].entityGetters;e["default"]=new u["default"]({is:"entity-list",behaviors:[c["default"]],properties:{entities:{type:Array,bindNuclear:[l.entityMap,function(t){return t.valueSeq().sortBy(function(t){return t.entityId}).toArray()}]}},entitySelected:function(t){t.preventDefault(),this.fire("entity-selected",{entityId:t.model.entity.entityId})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a);n(17);var s=u["default"].reactor,c=u["default"].entityGetters,l=u["default"].moreInfoActions;e["default"]=new o["default"]({is:"ha-entity-marker",properties:{entityId:{type:String,value:""},state:{type:Object,computed:"computeState(entityId)"},icon:{type:Object,computed:"computeIcon(state)"},image:{type:Object,computed:"computeImage(state)"},value:{type:String,computed:"computeValue(state)"}},listeners:{tap:"badgeTap"},badgeTap:function(t){var e=this;t.stopPropagation(),this.entityId&&this.async(function(){return l.selectEntity(e.entityId)},1)},computeState:function(t){return t&&s.evaluate(c.byId(t))},computeIcon:function(t){return!t&&"home"},computeImage:function(t){return t&&t.attributes.entity_picture},computeValue:function(t){return t&&t.entityDisplay.split(" ").map(function(t){return t.substr(0,1)}).join("")}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(125),u=r(a);e["default"]=new o["default"]({is:"ha-state-icon",properties:{stateObj:{type:Object}},computeIcon:function(t){return(0,u["default"])(t)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a),s=n(22),c=r(s),l=n(21),f=r(l);n(17);var d=u["default"].moreInfoActions,h=u["default"].serviceActions;e["default"]=new o["default"]({is:"ha-state-label-badge",properties:{state:{type:Object,observer:"stateChanged"}},listeners:{tap:"badgeTap"},badgeTap:function(t){var e=this;return t.stopPropagation(),(0,f["default"])(this.state.entityId)?void("scene"===this.state.domain?h.callTurnOn(this.state.entityId):"off"===this.state.state?h.callTurnOn(this.state.entityId):h.callTurnOff(this.state.entityId)):void this.async(function(){return d.selectEntity(e.state.entityId)},1)},computeClasses:function(t){switch(t.domain){case"scene":return"green";case"binary_sensor":case"script":return"on"===t.state?"blue":"grey";case"updater":return"blue";default:return""}},computeValue:function(t){switch(t.domain){case"binary_sensor":case"device_tracker":case"updater":case"sun":case"scene":case"script":case"alarm_control_panel":return;case"sensor":return t.state;default:return t.state}},computeIcon:function(t){switch(t.domain){case"alarm_control_panel":return"pending"===t.state?"mdi:clock-fast":"armed_away"===t.state?"mdi:nature":"armed_home"===t.state?"mdi:home-variant":(0,c["default"])(t.domain,t.state);case"binary_sensor":case"device_tracker":case"scene":case"updater":case"script":return(0,c["default"])(t.domain,t.state);case"sun":return"above_horizon"===t.state?(0,c["default"])(t.domain):"mdi:brightness-3";default:return}},computeImage:function(t){return t.attributes.entity_picture},computeLabel:function(t){switch(t.domain){case"scene":case"script":return t.domain;case"device_tracker":return"not_home"===t.state?"Away":t.state;case"alarm_control_panel":return"pending"===t.state?"pend":"armed_away"===t.state||"armed_home"===t.state?"armed":"disarm";default:return t.attributes.unit_of_measurement}},computeDescription:function(t){return t.entityDisplay},stateChanged:function(){this.updateStyles()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(75),e["default"]=new o["default"]({is:"state-badge",properties:{stateObj:{type:Object,observer:"updateIconColor"}},updateIconColor:function(t){"light"===t.domain&&"on"===t.state&&t.attributes.rgb_color&&t.attributes.rgb_color.reduce(function(t,e){return t+e},0)<730?this.$.icon.style.color="rgb("+t.attributes.rgb_color.join(",")+")":this.$.icon.style.color=null}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s),l=o["default"].eventGetters;e["default"]=new u["default"]({is:"events-list",behaviors:[c["default"]],properties:{events:{type:Array,bindNuclear:[l.entityMap,function(t){return t.valueSeq().sortBy(function(t){return t.event}).toArray()}]}},eventSelected:function(t){t.preventDefault(),this.fire("event-selected",{eventType:t.model.event.event})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return t in f?f[t]:30}function o(t){return"group"===t.domain?t.attributes.order:t.entityDisplay.toLowerCase()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(1),u=r(a),s=n(2),c=r(s);n(81),n(69),n(70),n(71);var l=c["default"].util,f={configurator:-20,group:-10,a:-1,updater:0,sun:1,device_tracker:2,alarm_control_panel:3,camera:4,sensor:5,binary_sensor:6,scene:7,script:8};e["default"]=new u["default"]({is:"ha-cards",properties:{showIntroduction:{type:Boolean,value:!1},columns:{type:Number,value:2},states:{type:Object},cards:{type:Object,computed:"computeCards(columns, states, showIntroduction)"}},computeCards:function(t,e,n){function r(t){return t.filter(function(t){return!(t.entityId in c)})}function a(){var e=h;return h=(h+1)%t,e}function u(t,e){var n=arguments.length<=2||void 0===arguments[2]?!1:arguments[2];0!==e.length&&(f._columns[a()].push(t),f[t]={entities:e,groupEntity:n})}for(var s=e.groupBy(function(t){return t.domain}),c={},f={_demo:!1,_badges:[],_columns:[]},d=0;t>d;d++)f._columns[d]=[];var h=0;return n&&a(),s.keySeq().sortBy(function(t){return i(t)}).forEach(function(t){if("a"===t)return void(f._demo=!0);var n=i(t);n>=0&&10>n?f._badges.push.apply(f._badges,r(s.get(t)).sortBy(o).toArray()):"group"===t?s.get(t).sortBy(o).forEach(function(t){var n=l.expandGroup(t,e);n.forEach(function(t){return c[t.entityId]=!0}),u(t.entityDisplay,n.toArray(),t)}):u(t,r(s.get(t)).sortBy(o).toArray())}),f},computeShouldRenderColumn:function(t,e){return 0===t||e.length},computeShowIntroduction:function(t,e,n){return 0===t&&(e||n._demo)},computeShowHideInstruction:function(t,e){return t.size>0&&!0&&!e._demo},computeGroupEntityOfCard:function(t,e){return e in t&&t[e].groupEntity},computeStatesOfCard:function(t,e){return e in t&&t[e].entities}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"ha-color-picker",properties:{color:{type:Object},width:{type:Number},height:{type:Number}},listeners:{mousedown:"onMouseDown",mouseup:"onMouseUp",touchstart:"onTouchStart",touchend:"onTouchEnd"},onMouseDown:function(t){this.onMouseMove(t),this.addEventListener("mousemove",this.onMouseMove)},onMouseUp:function(){this.removeEventListener("mousemove",this.onMouseMove)},onTouchStart:function(t){this.onTouchMove(t),this.addEventListener("touchmove",this.onTouchMove)},onTouchEnd:function(){this.removeEventListener("touchmove",this.onTouchMove)},onTouchMove:function(t){var e=this;this.mouseMoveIsThrottled&&(this.mouseMoveIsThrottled=!1,this.processColorSelect(t.touches[0]),this.async(function(){return e.mouseMoveIsThrottled=!0},100))},onMouseMove:function(t){var e=this;this.mouseMoveIsThrottled&&(this.mouseMoveIsThrottled=!1,this.processColorSelect(t),this.async(function(){return e.mouseMoveIsThrottled=!0},100))},processColorSelect:function(t){var e=this.canvas.getBoundingClientRect();t.clientX=e.left+e.width||t.clientY=e.top+e.height||this.onColorSelect(t.clientX-e.left,t.clientY-e.top)},onColorSelect:function(t,e){var n=this.context.getImageData(t,e,1,1).data;this.setColor({r:n[0],g:n[1],b:n[2]})},setColor:function(t){this.color=t,this.fire("colorselected",{rgb:this.color})},ready:function(){var t=this;this.setColor=this.setColor.bind(this),this.mouseMoveIsThrottled=!0,this.canvas=this.children[0],this.context=this.canvas.getContext("2d"),this.debounce("drawGradient",function(){var e=getComputedStyle(t),n=parseInt(e.width,10),r=parseInt(e.height,10);t.width=n,t.height=r;var i=t.context.createLinearGradient(0,0,n,0);i.addColorStop(0,"rgb(255,0,0)"),i.addColorStop(.16,"rgb(255,0,255)"),i.addColorStop(.32,"rgb(0,0,255)"),i.addColorStop(.48,"rgb(0,255,255)"),i.addColorStop(.64,"rgb(0,255,0)"),i.addColorStop(.8,"rgb(255,255,0)"),i.addColorStop(1,"rgb(255,0,0)"),t.context.fillStyle=i,t.context.fillRect(0,0,n,r);var o=t.context.createLinearGradient(0,0,0,r);o.addColorStop(0,"rgba(255,255,255,1)"),o.addColorStop(.5,"rgba(255,255,255,0)"),o.addColorStop(.5,"rgba(0,0,0,0)"),o.addColorStop(1,"rgba(0,0,0,1)"),t.context.fillStyle=o,t.context.fillRect(0,0,n,r)},100)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(17),e["default"]=new o["default"]({is:"ha-demo-badge"})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(84),e["default"]=new o["default"]({is:"ha-logbook",properties:{entries:{type:Object,value:[]}},noEntries:function(t){return!t.length}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(88);var l=o["default"].configGetters,f=o["default"].navigationGetters,d=o["default"].authActions,h=o["default"].navigationActions;e["default"]=new u["default"]({is:"ha-sidebar",behaviors:[c["default"]],properties:{menuShown:{type:Boolean},menuSelected:{type:String},selected:{type:String,bindNuclear:f.activePane,observer:"selectedChanged"},hasHistoryComponent:{type:Boolean,bindNuclear:l.isComponentLoaded("history")},hasLogbookComponent:{type:Boolean,bindNuclear:l.isComponentLoaded("logbook")}},selectedChanged:function(t){for(var e=this.querySelectorAll(".menu [data-panel]"),n=0;n11?n?"pm":"PM":n?"am":"AM"}function cn(t,e){e[Cr]=m(1e3*("0."+t))}function ln(){return this._isUTC?"UTC":""}function fn(){return this._isUTC?"Coordinated Universal Time":""}function dn(t){return Pt(1e3*t)}function hn(){return Pt.apply(null,arguments).parseZone()}function pn(t,e,n){var r=this._calendar[t];return j(r)?r.call(e,n):r}function _n(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t])}function vn(){return this._invalidDate}function yn(t){return this._ordinal.replace("%d",t)}function mn(t){return t}function gn(t,e,n,r){var i=this._relativeTime[n];return j(i)?i(t,e,n,r):i.replace(/%d/i,t)}function bn(t,e){var n=this._relativeTime[t>0?"future":"past"];return j(n)?n(e):n.replace(/%s/i,e)}function Sn(t){var e,n;for(n in t)e=t[n],j(e)?this[n]=e:this["_"+n]=e;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function wn(t,e,n,r){var i=E(),o=s().set(r,e);return i[n](o,t)}function On(t,e,n,r,i){if("number"==typeof t&&(e=t,t=void 0),t=t||"",null!=e)return wn(t,e,n,i);var o,a=[];for(o=0;r>o;o++)a[o]=wn(t,o,n,i);return a}function Mn(t,e){return On(t,e,"months",12,"month")}function In(t,e){return On(t,e,"monthsShort",12,"month")}function En(t,e){return On(t,e,"weekdays",7,"day")}function Tn(t,e){return On(t,e,"weekdaysShort",7,"day")}function Dn(t,e){return On(t,e,"weekdaysMin",7,"day")}function Cn(){var t=this._data;return this._milliseconds=bi(this._milliseconds),this._days=bi(this._days),this._months=bi(this._months),t.milliseconds=bi(t.milliseconds),t.seconds=bi(t.seconds),t.minutes=bi(t.minutes),t.hours=bi(t.hours),t.months=bi(t.months),t.years=bi(t.years),this}function jn(t,e,n,r){var i=Xt(e,n);return t._milliseconds+=r*i._milliseconds,t._days+=r*i._days,t._months+=r*i._months,t._bubble()}function Pn(t,e){return jn(this,t,e,1)}function An(t,e){return jn(this,t,e,-1)}function kn(t){return 0>t?Math.floor(t):Math.ceil(t)}function Ln(){var t,e,n,r,i,o=this._milliseconds,a=this._days,u=this._months,s=this._data;return o>=0&&a>=0&&u>=0||0>=o&&0>=a&&0>=u||(o+=864e5*kn(Rn(u)+a),a=0,u=0),s.milliseconds=o%1e3,t=y(o/1e3),s.seconds=t%60,e=y(t/60),s.minutes=e%60,n=y(e/60),s.hours=n%24,a+=y(n/24),i=y(Nn(a)),u+=i,a-=kn(Rn(i)),r=y(u/12),u%=12,s.days=a,s.months=u,s.years=r,this}function Nn(t){return 4800*t/146097}function Rn(t){return 146097*t/4800}function xn(t){var e,n,r=this._milliseconds;if(t=D(t),"month"===t||"year"===t)return e=this._days+r/864e5,n=this._months+Nn(e),"month"===t?n:n/12;switch(e=this._days+Math.round(Rn(this._months)),t){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return 24*e+r/36e5;case"minute":return 1440*e+r/6e4;case"second":return 86400*e+r/1e3;case"millisecond":return Math.floor(864e5*e)+r;default:throw new Error("Unknown unit "+t)}}function Hn(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*m(this._months/12)}function Yn(t){return function(){return this.as(t)}}function zn(t){return t=D(t),this[t+"s"]()}function Un(t){return function(){return this._data[t]}}function Vn(){return y(this.days()/7)}function Gn(t,e,n,r,i){return i.relativeTime(e||1,!!n,t,r)}function Fn(t,e,n){var r=Xt(t).abs(),i=Ri(r.as("s")),o=Ri(r.as("m")),a=Ri(r.as("h")),u=Ri(r.as("d")),s=Ri(r.as("M")),c=Ri(r.as("y")),l=i=o&&["m"]||o=a&&["h"]||a=u&&["d"]||u=s&&["M"]||s=c&&["y"]||["yy",c];return l[2]=e,l[3]=+t>0,l[4]=n,Gn.apply(null,l)}function Bn(t,e){return void 0===xi[t]?!1:void 0===e?xi[t]:(xi[t]=e,!0)}function Wn(t){var e=this.localeData(),n=Fn(this,!t,e);return t&&(n=e.pastFuture(+this,n)),e.postformat(n)}function qn(){var t,e,n,r=Hi(this._milliseconds)/1e3,i=Hi(this._days),o=Hi(this._months);t=y(r/60),e=y(t/60),r%=60,t%=60,n=y(o/12),o%=12;var a=n,u=o,s=i,c=e,l=t,f=r,d=this.asSeconds();return d?(0>d?"-":"")+"P"+(a?a+"Y":"")+(u?u+"M":"")+(s?s+"D":"")+(c||l||f?"T":"")+(c?c+"H":"")+(l?l+"M":"")+(f?f+"S":""):"P0D"}var Kn,Jn,$n=e.momentProperties=[],Zn=!1,Xn={},Qn={},tr=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,er=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,nr={},rr={},ir=/\d/,or=/\d\d/,ar=/\d{3}/,ur=/\d{4}/,sr=/[+-]?\d{6}/,cr=/\d\d?/,lr=/\d\d\d\d?/,fr=/\d\d\d\d\d\d?/,dr=/\d{1,3}/,hr=/\d{1,4}/,pr=/[+-]?\d{1,6}/,_r=/\d+/,vr=/[+-]?\d+/,yr=/Z|[+-]\d\d:?\d\d/gi,mr=/Z|[+-]\d\d(?::?\d\d)?/gi,gr=/[+-]?\d+(\.\d{1,3})?/,br=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Sr={},wr={},Or=0,Mr=1,Ir=2,Er=3,Tr=4,Dr=5,Cr=6,jr=7,Pr=8;R("M",["MM",2],"Mo",function(){return this.month()+1}),R("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),R("MMMM",0,0,function(t){return this.localeData().months(this,t)}),T("month","M"),U("M",cr),U("MM",cr,or),U("MMM",function(t,e){return e.monthsShortRegex(t)}),U("MMMM",function(t,e){return e.monthsRegex(t)}),B(["M","MM"],function(t,e){e[Mr]=m(t)-1}),B(["MMM","MMMM"],function(t,e,n,r){var i=n._locale.monthsParse(t,r,n._strict);null!=i?e[Mr]=i:l(n).invalidMonth=t});var Ar=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,kr="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Lr="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Nr=br,Rr=br,xr={};e.suppressDeprecationWarnings=!1;var Hr=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,Yr=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,zr=/Z|[+-]\d\d(?::?\d\d)?/,Ur=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Vr=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Gr=/^\/?Date\((\-?\d+)/i;e.createFromInputFallback=at("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),R("Y",0,0,function(){var t=this.year();return 9999>=t?""+t:"+"+t}),R(0,["YY",2],0,function(){return this.year()%100}),R(0,["YYYY",4],0,"year"),R(0,["YYYYY",5],0,"year"),R(0,["YYYYYY",6,!0],0,"year"),T("year","y"),U("Y",vr),U("YY",cr,or),U("YYYY",hr,ur),U("YYYYY",pr,sr),U("YYYYYY",pr,sr),B(["YYYYY","YYYYYY"],Or),B("YYYY",function(t,n){n[Or]=2===t.length?e.parseTwoDigitYear(t):m(t)}),B("YY",function(t,n){n[Or]=e.parseTwoDigitYear(t)}),B("Y",function(t,e){e[Or]=parseInt(t,10)}),e.parseTwoDigitYear=function(t){return m(t)+(m(t)>68?1900:2e3)};var Fr=P("FullYear",!1);e.ISO_8601=function(){};var Br=at("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var t=Pt.apply(null,arguments);return this.isValid()&&t.isValid()?this>t?this:t:d()}),Wr=at("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var t=Pt.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:d()}),qr=function(){return Date.now?Date.now():+new Date};xt("Z",":"),xt("ZZ",""),U("Z",mr),U("ZZ",mr),B(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=Ht(mr,t)});var Kr=/([\+\-]|\d\d)/gi;e.updateOffset=function(){};var Jr=/(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,$r=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Xt.fn=Nt.prototype;var Zr=ne(1,"add"),Xr=ne(-1,"subtract");e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var Qr=at("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});R(0,["gg",2],0,function(){return this.weekYear()%100}),R(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ne("gggg","weekYear"),Ne("ggggg","weekYear"),Ne("GGGG","isoWeekYear"),Ne("GGGGG","isoWeekYear"),T("weekYear","gg"),T("isoWeekYear","GG"),U("G",vr),U("g",vr),U("GG",cr,or),U("gg",cr,or),U("GGGG",hr,ur),U("gggg",hr,ur),U("GGGGG",pr,sr),U("ggggg",pr,sr),W(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,r){e[r.substr(0,2)]=m(t)}),W(["gg","GG"],function(t,n,r,i){n[i]=e.parseTwoDigitYear(t)}),R("Q",0,"Qo","quarter"),T("quarter","Q"),U("Q",ir),B("Q",function(t,e){e[Mr]=3*(m(t)-1)}),R("w",["ww",2],"wo","week"),R("W",["WW",2],"Wo","isoWeek"),T("week","w"),T("isoWeek","W"),U("w",cr),U("ww",cr,or),U("W",cr),U("WW",cr,or),W(["w","ww","W","WW"],function(t,e,n,r){e[r.substr(0,1)]=m(t)});var ti={dow:0,doy:6};R("D",["DD",2],"Do","date"),T("date","D"),U("D",cr),U("DD",cr,or),U("Do",function(t,e){return t?e._ordinalParse:e._ordinalParseLenient}),B(["D","DD"],Ir),B("Do",function(t,e){e[Ir]=m(t.match(cr)[0],10)});var ei=P("Date",!0);R("d",0,"do","day"),R("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),R("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),R("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),R("e",0,0,"weekday"),R("E",0,0,"isoWeekday"),T("day","d"),T("weekday","e"),T("isoWeekday","E"),U("d",cr),U("e",cr),U("E",cr),U("dd",br),U("ddd",br),U("dddd",br),W(["dd","ddd","dddd"],function(t,e,n,r){var i=n._locale.weekdaysParse(t,r,n._strict);null!=i?e.d=i:l(n).invalidWeekday=t}),W(["d","e","E"],function(t,e,n,r){e[r]=m(t)});var ni="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ri="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),ii="Su_Mo_Tu_We_Th_Fr_Sa".split("_");R("DDD",["DDDD",3],"DDDo","dayOfYear"),T("dayOfYear","DDD"),U("DDD",dr),U("DDDD",ar),B(["DDD","DDDD"],function(t,e,n){n._dayOfYear=m(t)}),R("H",["HH",2],0,"hour"),R("h",["hh",2],0,rn),R("hmm",0,0,function(){return""+rn.apply(this)+N(this.minutes(),2)}),R("hmmss",0,0,function(){return""+rn.apply(this)+N(this.minutes(),2)+N(this.seconds(),2)}),R("Hmm",0,0,function(){return""+this.hours()+N(this.minutes(),2)}),R("Hmmss",0,0,function(){return""+this.hours()+N(this.minutes(),2)+N(this.seconds(),2)}),on("a",!0),on("A",!1),T("hour","h"),U("a",an),U("A",an),U("H",cr),U("h",cr),U("HH",cr,or),U("hh",cr,or),U("hmm",lr),U("hmmss",fr),U("Hmm",lr),U("Hmmss",fr),B(["H","HH"],Er),B(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),B(["h","hh"],function(t,e,n){e[Er]=m(t),l(n).bigHour=!0}),B("hmm",function(t,e,n){var r=t.length-2;e[Er]=m(t.substr(0,r)),e[Tr]=m(t.substr(r)),l(n).bigHour=!0}),B("hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[Er]=m(t.substr(0,r)),e[Tr]=m(t.substr(r,2)),e[Dr]=m(t.substr(i)),l(n).bigHour=!0}),B("Hmm",function(t,e,n){var r=t.length-2;e[Er]=m(t.substr(0,r)),e[Tr]=m(t.substr(r))}),B("Hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[Er]=m(t.substr(0,r)),e[Tr]=m(t.substr(r,2)),e[Dr]=m(t.substr(i))});var oi=/[ap]\.?m?\.?/i,ai=P("Hours",!0);R("m",["mm",2],0,"minute"),T("minute","m"),U("m",cr),U("mm",cr,or),B(["m","mm"],Tr);var ui=P("Minutes",!1);R("s",["ss",2],0,"second"),T("second","s"),U("s",cr),U("ss",cr,or),B(["s","ss"],Dr);var si=P("Seconds",!1);R("S",0,0,function(){return~~(this.millisecond()/100)}),R(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),R(0,["SSS",3],0,"millisecond"),R(0,["SSSS",4],0,function(){return 10*this.millisecond()}),R(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),R(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),R(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),R(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),R(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),T("millisecond","ms"),U("S",dr,ir),U("SS",dr,or),U("SSS",dr,ar);var ci;for(ci="SSSS";ci.length<=9;ci+="S")U(ci,_r);for(ci="S";ci.length<=9;ci+="S")B(ci,cn);var li=P("Milliseconds",!1);R("z",0,0,"zoneAbbr"),R("zz",0,0,"zoneName");var fi=_.prototype;fi.add=Zr,fi.calendar=ie,fi.clone=oe,fi.diff=de,fi.endOf=Me,fi.format=ve,fi.from=ye,fi.fromNow=me,fi.to=ge,fi.toNow=be,fi.get=L,fi.invalidAt=ke,fi.isAfter=ae,fi.isBefore=ue,fi.isBetween=se,fi.isSame=ce,fi.isSameOrAfter=le,fi.isSameOrBefore=fe,fi.isValid=Pe,fi.lang=Qr,fi.locale=Se,fi.localeData=we,fi.max=Wr,fi.min=Br,fi.parsingFlags=Ae,fi.set=L,fi.startOf=Oe,fi.subtract=Xr,fi.toArray=De,fi.toObject=Ce,fi.toDate=Te,fi.toISOString=_e,fi.toJSON=je,fi.toString=pe,fi.unix=Ee,fi.valueOf=Ie,fi.creationData=Le,fi.year=Fr,fi.isLeapYear=pt,fi.weekYear=Re,fi.isoWeekYear=xe,fi.quarter=fi.quarters=Ve,fi.month=Q,fi.daysInMonth=tt,fi.week=fi.weeks=We,fi.isoWeek=fi.isoWeeks=qe,fi.weeksInYear=Ye,fi.isoWeeksInYear=He,fi.date=ei,fi.day=fi.days=Qe,fi.weekday=tn,fi.isoWeekday=en,fi.dayOfYear=nn,fi.hour=fi.hours=ai,fi.minute=fi.minutes=ui,fi.second=fi.seconds=si,fi.millisecond=fi.milliseconds=li,fi.utcOffset=Ut,fi.utc=Gt,fi.local=Ft,fi.parseZone=Bt,fi.hasAlignedHourOffset=Wt,fi.isDST=qt,fi.isDSTShifted=Kt,fi.isLocal=Jt,fi.isUtcOffset=$t,fi.isUtc=Zt,fi.isUTC=Zt,fi.zoneAbbr=ln,fi.zoneName=fn,fi.dates=at("dates accessor is deprecated. Use date instead.",ei),fi.months=at("months accessor is deprecated. Use month instead",Q),fi.years=at("years accessor is deprecated. Use year instead",Fr),fi.zone=at("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Vt);var di=fi,hi={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},pi={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},_i="Invalid date",vi="%d",yi=/\d{1,2}/,mi={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},gi=b.prototype;gi._calendar=hi,gi.calendar=pn,gi._longDateFormat=pi,gi.longDateFormat=_n,gi._invalidDate=_i,gi.invalidDate=vn,gi._ordinal=vi,gi.ordinal=yn,gi._ordinalParse=yi,gi.preparse=mn,gi.postformat=mn,gi._relativeTime=mi,gi.relativeTime=gn,gi.pastFuture=bn,gi.set=Sn,gi.months=J,gi._months=kr,gi.monthsShort=$,gi._monthsShort=Lr,gi.monthsParse=Z,gi._monthsRegex=Rr,gi.monthsRegex=nt,gi._monthsShortRegex=Nr,gi.monthsShortRegex=et,gi.week=Ge,gi._week=ti,gi.firstDayOfYear=Be,gi.firstDayOfWeek=Fe,gi.weekdays=Je,gi._weekdays=ni,gi.weekdaysMin=Ze,gi._weekdaysMin=ii,gi.weekdaysShort=$e,gi._weekdaysShort=ri,gi.weekdaysParse=Xe,gi.isPM=un,gi._meridiemParse=oi,gi.meridiem=sn,M("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=1===m(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),e.lang=at("moment.lang is deprecated. Use moment.locale instead.",M),e.langData=at("moment.langData is deprecated. Use moment.localeData instead.",E);var bi=Math.abs,Si=Yn("ms"),wi=Yn("s"),Oi=Yn("m"),Mi=Yn("h"),Ii=Yn("d"),Ei=Yn("w"),Ti=Yn("M"),Di=Yn("y"),Ci=Un("milliseconds"),ji=Un("seconds"),Pi=Un("minutes"),Ai=Un("hours"),ki=Un("days"),Li=Un("months"),Ni=Un("years"),Ri=Math.round,xi={s:45,m:45,h:22,d:26,M:11},Hi=Math.abs,Yi=Nt.prototype;Yi.abs=Cn,Yi.add=Pn,Yi.subtract=An,Yi.as=xn,Yi.asMilliseconds=Si,Yi.asSeconds=wi,Yi.asMinutes=Oi,Yi.asHours=Mi,Yi.asDays=Ii,Yi.asWeeks=Ei,Yi.asMonths=Ti,Yi.asYears=Di,Yi.valueOf=Hn,Yi._bubble=Ln,Yi.get=zn,Yi.milliseconds=Ci,Yi.seconds=ji,Yi.minutes=Pi,Yi.hours=Ai,Yi.days=ki,Yi.weeks=Vn,Yi.months=Li,Yi.years=Ni,Yi.humanize=Wn,Yi.toISOString=qn,Yi.toString=qn,Yi.toJSON=qn,Yi.locale=Se,Yi.localeData=we,Yi.toIsoString=at("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",qn),Yi.lang=Qr,R("X",0,0,"unix"),R("x",0,0,"valueOf"),U("x",vr),U("X",gr),B("X",function(t,e,n){n._d=new Date(1e3*parseFloat(t,10))}),B("x",function(t,e,n){n._d=new Date(m(t))}),e.version="2.11.1",n(Pt),e.fn=di,e.min=kt,e.max=Lt,e.now=qr,e.utc=s,e.unix=dn,e.months=Mn,e.isDate=i,e.locale=M,e.invalid=d,e.duration=Xt,e.isMoment=v,e.weekdays=En,e.parseZone=hn,e.localeData=E,e.isDuration=Rt,e.monthsShort=In,e.weekdaysMin=Dn,e.defineLocale=I,e.weekdaysShort=Tn,e.normalizeUnits=D,e.relativeTimeThreshold=Bn,e.prototype=di;var zi=e;return zi})}).call(e,n(67)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=n(166),u=n(191),s=i(u),c=n(193),l=i(c),f=n(195),d=i(f),h=n(15),p=r(h),_=n(24),v=r(_),y=n(9),m=r(y),g=n(45),b=r(g),S=n(146),w=r(S),O=n(25),M=r(O),I=n(151),E=r(I),T=n(48),D=r(T),C=n(51),j=r(C),P=n(27),A=r(P),k=n(58),L=r(k),N=n(13),R=r(N),x=n(29),H=r(x),Y=n(31),z=r(Y),U=n(182),V=r(U),G=n(188),F=r(G),B=n(10),W=r(B),q=function K(){o(this,K);var t=(0,s["default"])();Object.defineProperties(this,{demo:{value:!1,enumerable:!0},localStoragePreferences:{value:a.localStoragePreferences,enumerable:!0},reactor:{value:t,enumerable:!0},util:{value:d["default"],enumerable:!0},startLocalStoragePreferencesSync:{value:a.localStoragePreferences.startSync.bind(a.localStoragePreferences,t)},startUrlSync:{value:j.urlSync.startSync.bind(null,t)},stopUrlSync:{value:j.urlSync.stopSync.bind(null,t)}}),(0,l["default"])(this,t,{auth:p,config:v,entity:m,entityHistory:b,errorLog:w,event:M,logbook:E,moreInfo:D,navigation:j,notification:A,view:L,service:R,stream:H,sync:z,template:V,voice:F,restApi:W})};e["default"]=q},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(76),e["default"]=new o["default"]({is:"ha-badges-card",properties:{states:{type:Array}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a),s=n(21),c=r(s);n(36),n(35),n(19);var l=u["default"].moreInfoActions;e["default"]=new o["default"]({is:"ha-domain-card",properties:{domain:{type:String},states:{type:Array},groupEntity:{type:Object}},computeDomainTitle:function(t){return t.replace(/_/g," ")},entityTapped:function(t){if(!t.target.classList.contains("paper-toggle-button")&&!t.target.classList.contains("paper-icon-button")){t.stopPropagation();var e=t.model.item.entityId;this.async(function(){return l.selectEntity(e)},1)}},showGroupToggle:function(t,e){return!t||!e||"on"!==t.state&&"off"!==t.state?!1:e.reduce(function(t,e){return t+(0,c["default"])(e.entityId)},0)>1}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(36),e["default"]=new o["default"]({is:"ha-introduction-card",properties:{showInstallInstruction:{type:Boolean,value:!1},showHideInstruction:{type:Boolean,value:!0}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(41),u=r(a);e["default"]=new o["default"]({is:"display-time",properties:{dateObj:{type:Object}},computeTime:function(t){return t?(0,u["default"])(t):""}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s),l=o["default"].entityGetters;e["default"]=new u["default"]({is:"entity-list",behaviors:[c["default"]],properties:{entities:{type:Array,bindNuclear:[l.entityMap,function(t){return t.valueSeq().sortBy(function(t){return t.entityId}).toArray()}]}},entitySelected:function(t){t.preventDefault(),this.fire("entity-selected",{entityId:t.model.entity.entityId})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a);n(17);var s=u["default"].reactor,c=u["default"].entityGetters,l=u["default"].moreInfoActions;e["default"]=new o["default"]({is:"ha-entity-marker",properties:{entityId:{type:String,value:""},state:{type:Object,computed:"computeState(entityId)"},icon:{type:Object,computed:"computeIcon(state)"},image:{type:Object,computed:"computeImage(state)"},value:{type:String,computed:"computeValue(state)"}},listeners:{tap:"badgeTap"},badgeTap:function(t){var e=this;t.stopPropagation(),this.entityId&&this.async(function(){return l.selectEntity(e.entityId)},1)},computeState:function(t){return t&&s.evaluate(c.byId(t))},computeIcon:function(t){return!t&&"home"},computeImage:function(t){return t&&t.attributes.entity_picture},computeValue:function(t){return t&&t.entityDisplay.split(" ").map(function(t){return t.substr(0,1)}).join("")}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(125),u=r(a);e["default"]=new o["default"]({is:"ha-state-icon",properties:{stateObj:{type:Object}},computeIcon:function(t){return(0,u["default"])(t)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a),s=n(22),c=r(s),l=n(21),f=r(l);n(17);var d=u["default"].moreInfoActions,h=u["default"].serviceActions;e["default"]=new o["default"]({is:"ha-state-label-badge",properties:{state:{type:Object,observer:"stateChanged"}},listeners:{tap:"badgeTap"},badgeTap:function(t){var e=this;return t.stopPropagation(),(0,f["default"])(this.state.entityId)?void("scene"===this.state.domain?h.callTurnOn(this.state.entityId):"off"===this.state.state?h.callTurnOn(this.state.entityId):h.callTurnOff(this.state.entityId)):void this.async(function(){return d.selectEntity(e.state.entityId)},1)},computeClasses:function(t){switch(t.domain){case"scene":return"green";case"binary_sensor":case"script":return"on"===t.state?"blue":"grey";case"updater":return"blue";default:return""}},computeValue:function(t){switch(t.domain){case"binary_sensor":case"device_tracker":case"updater":case"sun":case"scene":case"script":case"alarm_control_panel":return;case"sensor":default:return"unknown"===t.state?"-":t.state}},computeIcon:function(t){switch(t.domain){case"alarm_control_panel":return"pending"===t.state?"mdi:clock-fast":"armed_away"===t.state?"mdi:nature":"armed_home"===t.state?"mdi:home-variant":(0,c["default"])(t.domain,t.state);case"binary_sensor":case"device_tracker":case"scene":case"updater":case"script":return(0,c["default"])(t.domain,t.state);case"sun":return"above_horizon"===t.state?(0,c["default"])(t.domain):"mdi:brightness-3";default:return}},computeImage:function(t){return t.attributes.entity_picture},computeLabel:function(t){switch(t.domain){case"scene":case"script":return t.domain;case"device_tracker":return"not_home"===t.state?"Away":t.state;case"alarm_control_panel":return"pending"===t.state?"pend":"armed_away"===t.state||"armed_home"===t.state?"armed":"disarm";default:return t.attributes.unit_of_measurement}},computeDescription:function(t){return t.entityDisplay},stateChanged:function(){this.updateStyles()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(75),e["default"]=new o["default"]({is:"state-badge",properties:{stateObj:{type:Object,observer:"updateIconColor"}},updateIconColor:function(t){"light"===t.domain&&"on"===t.state&&t.attributes.rgb_color&&t.attributes.rgb_color.reduce(function(t,e){return t+e},0)<730?this.$.icon.style.color="rgb("+t.attributes.rgb_color.join(",")+")":this.$.icon.style.color=null}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s),l=o["default"].eventGetters;e["default"]=new u["default"]({is:"events-list",behaviors:[c["default"]],properties:{events:{type:Array,bindNuclear:[l.entityMap,function(t){return t.valueSeq().sortBy(function(t){return t.event}).toArray()}]}},eventSelected:function(t){t.preventDefault(),this.fire("event-selected",{eventType:t.model.event.event})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return t in f?f[t]:30}function o(t){return"group"===t.domain?t.attributes.order:t.entityDisplay.toLowerCase()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(1),u=r(a),s=n(2),c=r(s);n(81),n(69),n(70),n(71);var l=c["default"].util,f={configurator:-20,group:-10,a:-1,updater:0,sun:1,device_tracker:2,alarm_control_panel:3,camera:4,sensor:5,binary_sensor:6,scene:7,script:8};e["default"]=new u["default"]({is:"ha-cards",properties:{showIntroduction:{type:Boolean,value:!1},columns:{type:Number,value:2},states:{type:Object},cards:{type:Object,computed:"computeCards(columns, states, showIntroduction)"}},computeCards:function(t,e,n){function r(t){return t.filter(function(t){return!(t.entityId in c)})}function a(){var e=h;return h=(h+1)%t,e}function u(t,e){var n=arguments.length<=2||void 0===arguments[2]?!1:arguments[2];0!==e.length&&(f._columns[a()].push(t),f[t]={entities:e,groupEntity:n})}for(var s=e.groupBy(function(t){return t.domain}),c={},f={_demo:!1,_badges:[],_columns:[]},d=0;t>d;d++)f._columns[d]=[];var h=0;return n&&a(),s.keySeq().sortBy(function(t){return i(t)}).forEach(function(t){if("a"===t)return void(f._demo=!0);var n=i(t);n>=0&&10>n?f._badges.push.apply(f._badges,r(s.get(t)).sortBy(o).toArray()):"group"===t?s.get(t).sortBy(o).forEach(function(t){var n=l.expandGroup(t,e);n.forEach(function(t){return c[t.entityId]=!0}),u(t.entityDisplay,n.toArray(),t)}):u(t,r(s.get(t)).sortBy(o).toArray())}),f},computeShouldRenderColumn:function(t,e){return 0===t||e.length},computeShowIntroduction:function(t,e,n){return 0===t&&(e||n._demo)},computeShowHideInstruction:function(t,e){return t.size>0&&!0&&!e._demo},computeGroupEntityOfCard:function(t,e){return e in t&&t[e].groupEntity},computeStatesOfCard:function(t,e){return e in t&&t[e].entities}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"ha-color-picker",properties:{color:{type:Object},width:{type:Number},height:{type:Number}},listeners:{mousedown:"onMouseDown",mouseup:"onMouseUp",touchstart:"onTouchStart",touchend:"onTouchEnd"},onMouseDown:function(t){this.onMouseMove(t),this.addEventListener("mousemove",this.onMouseMove)},onMouseUp:function(){this.removeEventListener("mousemove",this.onMouseMove)},onTouchStart:function(t){this.onTouchMove(t),this.addEventListener("touchmove",this.onTouchMove)},onTouchEnd:function(){this.removeEventListener("touchmove",this.onTouchMove)},onTouchMove:function(t){var e=this;this.mouseMoveIsThrottled&&(this.mouseMoveIsThrottled=!1,this.processColorSelect(t.touches[0]),this.async(function(){return e.mouseMoveIsThrottled=!0},100))},onMouseMove:function(t){var e=this;this.mouseMoveIsThrottled&&(this.mouseMoveIsThrottled=!1,this.processColorSelect(t),this.async(function(){return e.mouseMoveIsThrottled=!0},100))},processColorSelect:function(t){var e=this.canvas.getBoundingClientRect();t.clientX=e.left+e.width||t.clientY=e.top+e.height||this.onColorSelect(t.clientX-e.left,t.clientY-e.top)},onColorSelect:function(t,e){var n=this.context.getImageData(t,e,1,1).data;this.setColor({r:n[0],g:n[1],b:n[2]})},setColor:function(t){this.color=t,this.fire("colorselected",{rgb:this.color})},ready:function(){var t=this;this.setColor=this.setColor.bind(this),this.mouseMoveIsThrottled=!0,this.canvas=this.children[0],this.context=this.canvas.getContext("2d"),this.debounce("drawGradient",function(){var e=getComputedStyle(t),n=parseInt(e.width,10),r=parseInt(e.height,10);t.width=n,t.height=r;var i=t.context.createLinearGradient(0,0,n,0);i.addColorStop(0,"rgb(255,0,0)"),i.addColorStop(.16,"rgb(255,0,255)"),i.addColorStop(.32,"rgb(0,0,255)"),i.addColorStop(.48,"rgb(0,255,255)"),i.addColorStop(.64,"rgb(0,255,0)"),i.addColorStop(.8,"rgb(255,255,0)"),i.addColorStop(1,"rgb(255,0,0)"),t.context.fillStyle=i,t.context.fillRect(0,0,n,r);var o=t.context.createLinearGradient(0,0,0,r);o.addColorStop(0,"rgba(255,255,255,1)"),o.addColorStop(.5,"rgba(255,255,255,0)"),o.addColorStop(.5,"rgba(0,0,0,0)"),o.addColorStop(1,"rgba(0,0,0,1)"),t.context.fillStyle=o,t.context.fillRect(0,0,n,r)},100)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(17),e["default"]=new o["default"]({is:"ha-demo-badge"})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(84),e["default"]=new o["default"]({is:"ha-logbook",properties:{entries:{type:Object,value:[]}},noEntries:function(t){return!t.length}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(88);var l=o["default"].configGetters,f=o["default"].navigationGetters,d=o["default"].authActions,h=o["default"].navigationActions;e["default"]=new u["default"]({is:"ha-sidebar",behaviors:[c["default"]],properties:{menuShown:{type:Boolean},menuSelected:{type:String},selected:{type:String,bindNuclear:f.activePane,observer:"selectedChanged"},hasHistoryComponent:{type:Boolean,bindNuclear:l.isComponentLoaded("history")},hasLogbookComponent:{type:Boolean,bindNuclear:l.isComponentLoaded("logbook")}},selectedChanged:function(t){for(var e=this.querySelectorAll(".menu [data-panel]"),n=0;nnew Date&&(o=new Date);var u=e.map(function(t){function e(t,e){c&&e&&s.push([t[0]].concat(c.slice(1).map(function(t,n){return e[n]?t:null}))),s.push(t),c=t}var n=t[t.length-1],r=n.domain,a=n.entityDisplay,u=new window.google.visualization.DataTable;u.addColumn({type:"datetime",id:"Time"});var s=[],c=void 0;if("thermostat"===r){var l=t.reduce(function(t,e){return t||e.attributes.target_temp_high!==e.attributes.target_temp_low},!1);u.addColumn("number",a+" current temperature");var f=void 0;l?!function(){u.addColumn("number",a+" target temperature high"),u.addColumn("number",a+" target temperature low");var t=[!1,!0,!0];f=function(n){var r=i(n.attributes.current_temperature),o=i(n.attributes.target_temp_high),a=i(n.attributes.target_temp_low);e([n.lastUpdatedAsDate,r,o,a],t)}}():!function(){u.addColumn("number",a+" target temperature");var t=[!1,!0];f=function(n){var r=i(n.attributes.current_temperature),o=i(n.attributes.temperature);e([n.lastUpdatedAsDate,r,o],t)}}(),t.forEach(f)}else!function(){u.addColumn("number",a);var n="sensor"!==r&&[!0];t.forEach(function(t){var r=i(t.state);e([t.lastChangedAsDate,r],n)})}();return e([o].concat(c.slice(1)),!1),u.addRows(s),u}),s=void 0;s=1===u.length?u[0]:u.slice(1).reduce(function(t,e){return window.google.visualization.data.join(t,e,"full",[[0,0]],(0,a["default"])(1,t.getNumberOfColumns()),(0,a["default"])(1,e.getNumberOfColumns()))},u[0]),this.chartEngine.draw(s,n)}}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"state-history-chart-timeline",properties:{data:{type:Object,observer:"dataChanged"},isAttached:{type:Boolean,value:!1,observer:"dataChanged"}},attached:function(){this.isAttached=!0},dataChanged:function(){this.drawChart()},drawChart:function(){function t(t,e,n,r){var o=e.replace(/_/g," ");i.addRow([t,o,n,r])}if(this.isAttached){for(var e=o["default"].dom(this),n=this.data;e.node.lastChild;)e.node.removeChild(e.node.lastChild);if(n&&0!==n.length){var r=new window.google.visualization.Timeline(this),i=new window.google.visualization.DataTable;i.addColumn({type:"string",id:"Entity"}),i.addColumn({type:"string",id:"State"}),i.addColumn({type:"date",id:"Start"}),i.addColumn({type:"date",id:"End"});var a=new Date(n.reduce(function(t,e){return Math.min(t,e[0].lastChangedAsDate)},new Date)),u=new Date(a);u.setDate(u.getDate()+1),u>new Date&&(u=new Date);var s=0;n.forEach(function(e){if(0!==e.length){var n=e[0].entityDisplay,r=void 0,i=null,o=null;e.forEach(function(e){null!==i&&e.state!==i?(r=e.lastChangedAsDate,t(n,i,o,r),i=e.state,o=r):null===i&&(i=e.state,o=e.lastChangedAsDate)}),t(n,i,o,u),s++}}),r.draw(i,{height:55+42*s,timeline:{showRowLabels:n.length>1},hAxis:{format:"H:mm"}})}}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s),l=o["default"].streamGetters,f=o["default"].streamActions;e["default"]=new u["default"]({is:"stream-status",behaviors:[c["default"]],properties:{isStreaming:{type:Boolean,bindNuclear:l.isStreamingEvents},hasError:{type:Boolean,bindNuclear:l.hasStreamingEventsError}},toggleChanged:function(){this.isStreaming?f.stop():f.start()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s),l=o["default"].voiceActions,f=o["default"].voiceGetters;e["default"]=new u["default"]({is:"ha-voice-command-dialog",behaviors:[c["default"]],properties:{dialogOpen:{type:Boolean,value:!1,observer:"dialogOpenChanged"},finalTranscript:{type:String,bindNuclear:f.finalTranscript},interimTranscript:{type:String,bindNuclear:f.extraInterimTranscript},isTransmitting:{type:Boolean,bindNuclear:f.isTransmitting},isListening:{type:Boolean,bindNuclear:f.isListening},showListenInterface:{type:Boolean,computed:"computeShowListenInterface(isListening, isTransmitting)",observer:"showListenInterfaceChanged"}},computeShowListenInterface:function(t,e){return t||e},dialogOpenChanged:function(t){!t&&this.isListening&&l.stop()},showListenInterfaceChanged:function(t){!t&&this.dialogOpen?this.dialogOpen=!1:t&&(this.dialogOpen=!0)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(19),n(38),n(106);var l=o["default"].configGetters,f=o["default"].entityHistoryGetters,d=o["default"].entityHistoryActions,h=o["default"].moreInfoGetters,p=o["default"].moreInfoActions,_=["camera","configurator","scene"];e["default"]=new u["default"]({is:"more-info-dialog",behaviors:[c["default"]],properties:{stateObj:{type:Object,bindNuclear:h.currentEntity,observer:"stateObjChanged"},stateHistory:{type:Object,bindNuclear:[h.currentEntityHistory,function(t){return t?[t]:!1}]},isLoadingHistoryData:{type:Boolean,computed:"computeIsLoadingHistoryData(_delayedDialogOpen, _isLoadingHistoryData)"},_isLoadingHistoryData:{type:Boolean,bindNuclear:f.isLoadingEntityHistory},hasHistoryComponent:{type:Boolean,bindNuclear:l.isComponentLoaded("history"),observer:"fetchHistoryData"},shouldFetchHistory:{type:Boolean,bindNuclear:h.isCurrentEntityHistoryStale,observer:"fetchHistoryData"},showHistoryComponent:{type:Boolean,value:!1},dialogOpen:{type:Boolean,value:!1,observer:"dialogOpenChanged"},_delayedDialogOpen:{type:Boolean,value:!1}},computeIsLoadingHistoryData:function(t,e){return!t||e},fetchHistoryData:function(){this.stateObj&&this.hasHistoryComponent&&this.shouldFetchHistory&&d.fetchRecent(this.stateObj.entityId)},stateObjChanged:function(t){var e=this;return t?(this.showHistoryComponent=this.hasHistoryComponent&&-1===_.indexOf(this.stateObj.domain),void this.async(function(){e.fetchHistoryData(),e.dialogOpen=!0},10)):void(this.dialogOpen=!1)},dialogOpenChanged:function(t){var e=this;t?this.async(function(){return e._delayedDialogOpen=!0},10):!t&&this.stateObj&&(p.deselectEntity(),this._delayedDialogOpen=!1)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a),s=n(4),c=r(s),l=n(42),f=r(l);n(83),n(93),n(100),n(99),n(101),n(94),n(95),n(97),n(98),n(96),n(102),n(90),n(89);var d=u["default"].navigationActions,h=u["default"].navigationGetters,p=u["default"].startUrlSync,_=u["default"].stopUrlSync;e["default"]=new o["default"]({is:"home-assistant-main",behaviors:[c["default"]],properties:{narrow:{type:Boolean,value:!1},activePane:{type:String,bindNuclear:h.activePane,observer:"activePaneChanged"},isSelectedStates:{type:Boolean,bindNuclear:h.isActivePane("states")},isSelectedHistory:{type:Boolean,bindNuclear:h.isActivePane("history")},isSelectedMap:{type:Boolean,bindNuclear:h.isActivePane("map")},isSelectedLogbook:{type:Boolean,bindNuclear:h.isActivePane("logbook")},isSelectedDevEvent:{type:Boolean,bindNuclear:h.isActivePane("devEvent")},isSelectedDevState:{type:Boolean,bindNuclear:h.isActivePane("devState")},isSelectedDevTemplate:{type:Boolean,bindNuclear:h.isActivePane("devTemplate")},isSelectedDevService:{type:Boolean,bindNuclear:h.isActivePane("devService")},isSelectedDevInfo:{type:Boolean,bindNuclear:h.isActivePane("devInfo")},showSidebar:{type:Boolean,bindNuclear:h.showSidebar}},listeners:{"open-menu":"openMenu","close-menu":"closeMenu"},openMenu:function(){this.narrow?this.$.drawer.openDrawer():d.showSidebar(!0)},closeMenu:function(){this.$.drawer.closeDrawer(),this.showSidebar&&d.showSidebar(!1)},activePaneChanged:function(){this.narrow&&this.$.drawer.closeDrawer()},attached:function(){(0,f["default"])(),p()},computeForceNarrow:function(t,e){return t||!e},detached:function(){_()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a),s=n(4),c=r(s),l=n(43),f=r(l),d=n(42),h=r(d),p=u["default"].authGetters;e["default"]=new o["default"]({is:"login-form",behaviors:[c["default"]],properties:{errorMessage:{type:String,bindNuclear:p.attemptErrorMessage},isInvalid:{type:Boolean,bindNuclear:p.isInvalidAttempt},isValidating:{type:Boolean,observer:"isValidatingChanged",bindNuclear:p.isValidating},loadingResources:{type:Boolean,value:!1},forceShowLoading:{type:Boolean,value:!1},showLoading:{type:Boolean,computed:"computeShowSpinner(forceShowLoading, isValidating)"}},listeners:{keydown:"passwordKeyDown","loginButton.tap":"validatePassword"},observers:["validatingChanged(isValidating, isInvalid)"],attached:function(){(0,h["default"])()},computeShowSpinner:function(t,e){return t||e},validatingChanged:function(t,e){t||e||(this.$.passwordInput.value="")},isValidatingChanged:function(t){var e=this;t||this.async(function(){return e.$.passwordInput.focus()},10)},passwordKeyDown:function(t){13===t.keyCode?(this.validatePassword(),t.preventDefault()):this.isInvalid&&(this.isInvalid=!1)},validatePassword:function(){this.$.hideKeyboardOnFocus.focus(),(0,f["default"])(this.$.passwordInput.value,this.$.rememberLogin.checked)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(8),n(79);var l=o["default"].configGetters,f=o["default"].viewActions,d=o["default"].viewGetters,h=o["default"].voiceGetters,p=o["default"].streamGetters,_=o["default"].syncGetters,v=o["default"].syncActions,y=o["default"].voiceActions;e["default"]=new u["default"]({is:"partial-cards",behaviors:[c["default"]],properties:{narrow:{type:Boolean,value:!1},isFetching:{type:Boolean,bindNuclear:_.isFetching},isStreaming:{type:Boolean,bindNuclear:p.isStreamingEvents},canListen:{type:Boolean,bindNuclear:[h.isVoiceSupported,l.isComponentLoaded("conversation"),function(t,e){return t&&e}]},introductionLoaded:{type:Boolean,bindNuclear:l.isComponentLoaded("introduction")},locationName:{type:String,bindNuclear:l.locationName},showMenu:{type:Boolean,value:!1,observer:"windowChange"},currentView:{type:String,bindNuclear:[d.currentView,function(t){return t||""}]},views:{type:Array,bindNuclear:[d.views,function(t){return t.valueSeq().sortBy(function(t){return t.attributes.order}).toArray()}]},hasViews:{type:Boolean,computed:"computeHasViews(views)"},states:{type:Object,bindNuclear:d.currentViewEntities},columns:{type:Number,value:1}},created:function(){var t=this;this.windowChange=this.windowChange.bind(this);for(var e=[],n=0;5>n;n++)e.push(300+300*n);this.mqls=e.map(function(e){var n=window.matchMedia("(min-width: "+e+"px)");return n.addListener(t.windowChange),n})},detached:function(){var t=this;this.mqls.forEach(function(e){return e.removeListener(t.windowChange)})},windowChange:function(){var t=this.mqls.reduce(function(t,e){return t+e.matches},0);this.columns=Math.max(1,t-this.showMenu)},handleRefresh:function(){v.fetchAll()},handleListenClick:function(){y.listen()},computeMenuButtonClass:function(t,e){return!t&&e?"invisible":""},computeRefreshButtonClass:function(t){return t?"ha-spin":void 0},computeShowIntroduction:function(t,e,n){return""===t&&(e||0===n.size)},computeHasViews:function(t){return t.length>0},toggleMenu:function(){this.fire("open-menu")},viewSelected:function(t){var e=t.detail.item.getAttribute("data-entity")||null,n=this.currentView||null;e!==n&&this.async(function(){return f.selectView(e)},0)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a);n(8),n(85);var s=o["default"].reactor,c=o["default"].serviceActions,l=o["default"].serviceGetters;e["default"]=new u["default"]({is:"partial-dev-call-service",properties:{narrow:{type:Boolean,value:!1},showMenu:{type:Boolean,value:!1},domain:{type:String,value:""},service:{type:String,value:""},serviceData:{type:String,value:""},description:{type:String,computed:"computeDescription(domain, service)"}},computeDescription:function(t,e){return s.evaluate([l.entityMap,function(n){return n.has(t)&&n.get(t).get("services").has(e)?JSON.stringify(n.get(t).get("services").get(e).toJS(),null,2):"No description available"}])},serviceSelected:function(t){this.domain=t.detail.domain,this.service=t.detail.service},callService:function(){var t=void 0;try{t=this.serviceData?JSON.parse(this.serviceData):{}}catch(e){return void alert("Error parsing JSON: "+e)}c.callService(this.domain,this.service,t)},computeFormClasses:function(t){return"layout "+(t?"vertical":"horizontal")}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a);n(8),n(78);var s=o["default"].eventActions;e["default"]=new u["default"]({is:"partial-dev-fire-event",properties:{narrow:{type:Boolean,value:!1},showMenu:{type:Boolean,value:!1},eventType:{type:String,value:""},eventData:{type:String,value:""}},eventSelected:function(t){this.eventType=t.detail.eventType},fireEvent:function(){var t=void 0;try{t=this.eventData?JSON.parse(this.eventData):{}}catch(e){return void alert("Error parsing JSON: "+e)}s.fireEvent(this.eventType,t)},computeFormClasses:function(t){return"layout "+(t?"vertical":"horizontal")}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(8);var l=o["default"].configGetters,f=o["default"].errorLogActions;e["default"]=new u["default"]({is:"partial-dev-info",behaviors:[c["default"]],properties:{narrow:{type:Boolean,value:!1},showMenu:{type:Boolean,value:!1},hassVersion:{type:String,bindNuclear:l.serverVersion},polymerVersion:{type:String,value:u["default"].version},nuclearVersion:{type:String,value:"1.3.0"},errorLog:{type:String,value:""}},attached:function(){this.refreshErrorLog()},refreshErrorLog:function(t){var e=this;t&&t.preventDefault(),this.errorLog="Loading error log…",f.fetchErrorLog().then(function(t){return e.errorLog=t||"No errors have been reported."})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a);n(8),n(73);var s=o["default"].reactor,c=o["default"].entityGetters,l=o["default"].entityActions;e["default"]=new u["default"]({is:"partial-dev-set-state",properties:{narrow:{type:Boolean,value:!1},showMenu:{type:Boolean,value:!1},entityId:{type:String,value:""},state:{type:String,value:""},stateAttributes:{type:String,value:""}},setStateData:function(t){var e=t?JSON.stringify(t,null," "):"";this.$.inputData.value=e,this.$.inputDataWrapper.update(this.$.inputData)},entitySelected:function(t){var e=s.evaluate(c.byId(t.detail.entityId));this.entityId=e.entityId,this.state=e.state,this.stateAttributes=JSON.stringify(e.attributes,null," ")},handleSetState:function(){var t=void 0;try{t=this.stateAttributes?JSON.parse(this.stateAttributes):{}}catch(e){return void alert("Error parsing JSON: "+e)}l.save({entityId:this.entityId,state:this.state,attributes:t})},computeFormClasses:function(t){return"layout "+(t?"vertical":"horizontal")}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(8);var l=o["default"].templateActions;e["default"]=new u["default"]({is:"partial-dev-template",behaviors:[c["default"]],properties:{narrow:{type:Boolean,value:!1},showMenu:{type:Boolean,value:!1},error:{type:Boolean,value:!1},rendering:{type:Boolean,value:!1},template:{type:String,value:'{%- if is_state("device_tracker.paulus", "home") and \n is_state("device_tracker.anne_therese", "home") -%}\n\n You are both home, you silly\n\n{%- else -%}\n\n Anne Therese is at {{ states("device_tracker.anne_therese") }} and Paulus is at {{ states("device_tracker.paulus") }}\n\n{%- endif %}\n\nFor loop example:\n\n{% for state in states.sensor -%}\n {%- if loop.first %}The {% elif loop.last %} and the {% else %}, the {% endif -%}\n {{ state.name | lower }} is {{state.state}} {{- state.attributes.unit_of_measurement}}\n{%- endfor -%}.',observer:"templateChanged"},processed:{type:String,value:""}},computeFormClasses:function(t){return"content fit layout "+(t?"vertical":"horizontal")},computeRenderedClasses:function(t){return t?"error rendered":"rendered"},templateChanged:function(){this.error&&(this.error=!1),this.debounce("render-template",this.renderTemplate,500)},renderTemplate:function(){var t=this;this.rendering=!0,l.render(this.template).then(function(e){t.processed=e,t.rendering=!1},function(e){t.processed=e.message,t.error=!0,t.rendering=!1})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(8),n(38);var l=o["default"].entityHistoryGetters,f=o["default"].entityHistoryActions;e["default"]=new u["default"]({is:"partial-history",behaviors:[c["default"]],properties:{narrow:{type:Boolean},showMenu:{type:Boolean,value:!1},isDataLoaded:{type:Boolean,bindNuclear:l.hasDataForCurrentDate,observer:"isDataLoadedChanged"},stateHistory:{type:Object,bindNuclear:l.entityHistoryForCurrentDate},isLoadingData:{type:Boolean,bindNuclear:l.isLoadingEntityHistory},selectedDate:{type:String,value:null,bindNuclear:l.currentDate}},isDataLoadedChanged:function(t){t||this.async(function(){return f.fetchSelectedDate()},1)},handleRefreshClick:function(){f.fetchSelectedDate()},datepickerFocus:function(){this.datePicker.adjustPosition()},attached:function(){this.datePicker=new window.Pikaday({field:this.$.datePicker.inputElement,onSelect:f.changeCurrentDate})},detached:function(){this.datePicker.destroy()},computeContentClasses:function(t){return"flex content "+(t?"narrow":"wide")}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(8),n(82),n(18);var l=o["default"].logbookGetters,f=o["default"].logbookActions;e["default"]=new u["default"]({is:"partial-logbook",behaviors:[c["default"]],properties:{narrow:{type:Boolean,value:!1},showMenu:{type:Boolean,value:!1},selectedDate:{type:String,bindNuclear:l.currentDate},isLoading:{type:Boolean,bindNuclear:l.isLoadingEntries},isStale:{type:Boolean,bindNuclear:l.isCurrentStale,observer:"isStaleChanged"},entries:{type:Array,bindNuclear:[l.currentEntries,function(t){return t.reverse().toArray()}]},datePicker:{type:Object}},isStaleChanged:function(t){var e=this;t&&this.async(function(){return f.fetchDate(e.selectedDate)},1)},handleRefresh:function(){f.fetchDate(this.selectedDate)},datepickerFocus:function(){this.datePicker.adjustPosition()},attached:function(){this.datePicker=new window.Pikaday({field:this.$.datePicker.inputElement,onSelect:f.changeCurrentDate})},detached:function(){this.datePicker.destroy()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(74);var l=o["default"].configGetters,f=o["default"].entityGetters;window.L.Icon.Default.imagePath="/static/images/leaflet",e["default"]=new u["default"]({is:"partial-map",behaviors:[c["default"]],properties:{locationGPS:{type:Number,bindNuclear:l.locationGPS},locationName:{type:String,bindNuclear:l.locationName},locationEntities:{type:Array,bindNuclear:[f.visibleEntityMap,function(t){return t.valueSeq().filter(function(t){return t.attributes.latitude&&"home"!==t.state}).toArray()}]},zoneEntities:{type:Array,bindNuclear:[f.entityMap,function(t){return t.valueSeq().filter(function(t){return"zone"===t.domain&&!t.attributes.passive}).toArray()}]},narrow:{type:Boolean},showMenu:{type:Boolean,value:!1}},attached:function(){var t=this;window.L.Browser.mobileWebkit&&this.async(function(){var e=t.$.map,n=e.style.display;e.style.display="none",t.async(function(){e.style.display=n},1)},1)},computeMenuButtonClass:function(t,e){return!t&&e?"invisible":""},toggleMenu:function(){this.fire("open-menu")}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s),l=o["default"].notificationGetters;e["default"]=new u["default"]({is:"notification-manager",behaviors:[c["default"]],properties:{text:{type:String,bindNuclear:l.lastNotificationMessage,observer:"showNotification"}},showNotification:function(t){t&&this.$.toast.show()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=o["default"].serviceActions;e["default"]=new u["default"]({is:"more-info-alarm_control_panel",handleDisarmTap:function(){this.callService("alarm_disarm",{code:this.enteredCode})},handleHomeTap:function(){this.callService("alarm_arm_home",{code:this.enteredCode})},handleAwayTap:function(){this.callService("alarm_arm_away",{code:this.enteredCode})},properties:{stateObj:{type:Object,observer:"stateObjChanged"},enteredCode:{type:String,value:""},disarmButtonVisible:{type:Boolean,value:!1},armHomeButtonVisible:{type:Boolean,value:!1},armAwayButtonVisible:{type:Boolean,value:!1},codeInputVisible:{type:Boolean,value:!1},codeInputEnabled:{type:Boolean,value:!1},codeFormat:{type:String,value:""},codeValid:{type:Boolean,computed:"validateCode(enteredCode, codeFormat)"}},validateCode:function(t,e){var n=new RegExp(e);return null===e?!0:n.test(t)},stateObjChanged:function(t){var e=this;t&&(this.codeFormat=t.attributes.code_format,this.codeInputVisible=null!==this.codeFormat,this.codeInputEnabled="armed_home"===t.state||"armed_away"===t.state||"disarmed"===t.state||"pending"===t.state||"triggered"===t.state,this.disarmButtonVisible="armed_home"===t.state||"armed_away"===t.state||"pending"===t.state||"triggered"===t.state,this.armHomeButtonVisible="disarmed"===t.state,this.armAwayButtonVisible="disarmed"===t.state),this.async(function(){return e.fire("iron-resize")},500)},callService:function(t,e){var n=e||{};n.entity_id=this.stateObj.entityId,s.callService("alarm_control_panel",t,n)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"more-info-camera",properties:{stateObj:{type:Object},dialogOpen:{type:Boolean}},imageLoaded:function(){this.fire("iron-resize")},computeCameraImageUrl:function(t){return t?"/api/camera_proxy_stream/"+this.stateObj.entityId:"data:image/gif;base64,R0lGODlhAQABAAAAACw="}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(18);var l=o["default"].streamGetters,f=o["default"].syncActions,d=o["default"].serviceActions;e["default"]=new u["default"]({is:"more-info-configurator",behaviors:[c["default"]],properties:{stateObj:{type:Object},action:{type:String,value:"display"},isStreaming:{type:Boolean,bindNuclear:l.isStreamingEvents},isConfigurable:{type:Boolean,computed:"computeIsConfigurable(stateObj)"},isConfiguring:{type:Boolean,value:!1},submitCaption:{type:String,computed:"computeSubmitCaption(stateObj)"},fieldInput:{type:Object,value:{}}},computeIsConfigurable:function(t){return"configure"===t.state},computeSubmitCaption:function(t){return t.attributes.submit_caption||"Set configuration"},fieldChanged:function(t){var e=t.target;this.fieldInput[e.id]=e.value},submitClicked:function(){var t=this;this.isConfiguring=!0;var e={configure_id:this.stateObj.attributes.configure_id,fields:this.fieldInput};d.callService("configurator","configure",e).then(function(){t.isConfiguring=!1,t.isStreaming||f.fetchAll()},function(){t.isConfiguring=!1})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(126),u=r(a);n(107),n(108),n(112),n(105),n(113),n(111),n(109),n(110),n(104),n(114),n(103),e["default"]=new o["default"]({is:"more-info-content",properties:{stateObj:{type:Object,observer:"stateObjChanged"},dialogOpen:{type:Boolean,value:!1,observer:"dialogOpenChanged"}},dialogOpenChanged:function(t){var e=o["default"].dom(this);e.lastChild&&(e.lastChild.dialogOpen=t)},stateObjChanged:function(t,e){var n=o["default"].dom(this);if(!t)return void(n.lastChild&&n.removeChild(n.lastChild));var r=(0,u["default"])(t);if(e&&(0,u["default"])(e)===r)n.lastChild.dialogOpen=this.dialogOpen,n.lastChild.stateObj=t;else{n.lastChild&&n.removeChild(n.lastChild);var i=document.createElement("more-info-"+r);i.stateObj=t,i.dialogOpen=this.dialogOpen,n.appendChild(i)}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=["entity_picture","friendly_name","icon","unit_of_measurement"];e["default"]=new o["default"]({is:"more-info-default",properties:{stateObj:{type:Object}},computeDisplayAttributes:function(t){return t?Object.keys(t.attributes).filter(function(t){return-1===a.indexOf(t)}):[]},getAttributeValue:function(t,e){var n=t.attributes[e];return Array.isArray(n)?n.join(", "):n}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(4),c=r(s);n(19);var l=o["default"].entityGetters,f=o["default"].moreInfoGetters;e["default"]=new u["default"]({is:"more-info-group",behaviors:[c["default"]],properties:{stateObj:{type:Object},states:{type:Array,bindNuclear:[f.currentEntity,l.entityMap,function(t,e){return t?t.attributes.entity_id.map(e.get.bind(e)):[]}]}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){f.callService("light","turn_on",{entity_id:t,rgb_color:[e.r,e.g,e.b]})}Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),a=r(o),u=n(1),s=r(u),c=n(20),l=r(c);n(80);var f=a["default"].serviceActions,d=["brightness","rgb_color","color_temp"];e["default"]=new s["default"]({is:"more-info-light",properties:{stateObj:{type:Object,observer:"stateObjChanged"},brightnessSliderValue:{type:Number,value:0},ctSliderValue:{type:Number,value:0}},stateObjChanged:function(t){var e=this;t&&"on"===t.state&&(this.brightnessSliderValue=t.attributes.brightness,this.ctSliderValue=t.attributes.color_temp),this.async(function(){return e.fire("iron-resize")},500)},computeClassNames:function(t){return(0,l["default"])(t,d)},brightnessSliderChanged:function(t){var e=parseInt(t.target.value,10);isNaN(e)||(0===e?f.callTurnOff(this.stateObj.entityId):f.callService("light","turn_on",{entity_id:this.stateObj.entityId,brightness:e}))},ctSliderChanged:function(t){var e=parseInt(t.target.value,10);isNaN(e)||f.callService("light","turn_on",{entity_id:this.stateObj.entityId,color_temp:e})},colorPicked:function(t){var e=this;return this.skipColorPicked?void(this.colorChanged=!0):(this.color=t.detail.rgb,i(this.stateObj.entityId,this.color),this.colorChanged=!1,this.skipColorPicked=!0,void(this.colorDebounce=setTimeout(function(){e.colorChanged&&i(e.stateObj.entityId,e.color),e.skipColorPicked=!1},500)))}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(20),c=r(s),l=o["default"].serviceActions,f=["volume_level"];e["default"]=new u["default"]({is:"more-info-media_player",properties:{stateObj:{type:Object,observer:"stateObjChanged"},isOff:{type:Boolean,value:!1},isPlaying:{type:Boolean,value:!1},isMuted:{type:Boolean,value:!1},volumeSliderValue:{type:Number,value:0},supportsPause:{type:Boolean,value:!1},supportsVolumeSet:{type:Boolean,value:!1},supportsVolumeMute:{type:Boolean,value:!1},supportsPreviousTrack:{type:Boolean,value:!1},supportsNextTrack:{type:Boolean,value:!1},supportsTurnOn:{type:Boolean,value:!1},supportsTurnOff:{type:Boolean,value:!1},supportsVolumeButtons:{type:Boolean,value:!1},hasMediaControl:{type:Boolean,value:!1}},stateObjChanged:function(t){var e=this;if(t){var n=["playing","paused","unknown"];this.isOff="off"===t.state,this.isPlaying="playing"===t.state,this.hasMediaControl=-1!==n.indexOf(t.state),this.volumeSliderValue=100*t.attributes.volume_level,this.isMuted=t.attributes.is_volume_muted,this.supportsPause=0!==(1&t.attributes.supported_media_commands),this.supportsVolumeSet=0!==(4&t.attributes.supported_media_commands),this.supportsVolumeMute=0!==(8&t.attributes.supported_media_commands),this.supportsPreviousTrack=0!==(16&t.attributes.supported_media_commands),this.supportsNextTrack=0!==(32&t.attributes.supported_media_commands),this.supportsTurnOn=0!==(128&t.attributes.supported_media_commands),this.supportsTurnOff=0!==(256&t.attributes.supported_media_commands),this.supportsVolumeButtons=0!==(1024&t.attributes.supported_media_commands)}this.async(function(){return e.fire("iron-resize")},500)},computeClassNames:function(t){return(0,c["default"])(t,f)},computeIsOff:function(t){return"off"===t.state},computeMuteVolumeIcon:function(t){return t?"mdi:volume-off":"mdi:volume-high"},computeHideVolumeButtons:function(t,e){return!e||t},computeShowPlaybackControls:function(t,e){return!t&&e},computePlaybackControlIcon:function(){return this.isPlaying?this.supportsPause?"mdi:pause":"mdi:stop":"mdi:play"},computeHidePowerButton:function(t,e,n){return t?!e:!n},handleTogglePower:function(){this.callService(this.isOff?"turn_on":"turn_off")},handlePrevious:function(){this.callService("media_previous_track")},handlePlaybackControl:function(){this.callService("media_play_pause")},handleNext:function(){this.callService("media_next_track")},handleVolumeTap:function(){this.supportsVolumeMute&&this.callService("volume_mute",{is_volume_muted:!this.isMuted})},handleVolumeUp:function(){var t=this.$.volumeUp;this.handleVolumeWorker("volume_up",t,!0); },handleVolumeDown:function(){var t=this.$.volumeDown;this.handleVolumeWorker("volume_down",t,!0)},handleVolumeWorker:function(t,e,n){var r=this;(n||void 0!==e&&e.pointerDown)&&(this.callService(t),this.async(function(){return r.handleVolumeWorker(t,e,!1)},500))},volumeSliderChanged:function(t){var e=parseFloat(t.target.value),n=e>0?e/100:0;this.callService("volume_set",{volume_level:n})},callService:function(t,e){var n=e||{};n.entity_id=this.stateObj.entityId,l.callService("media_player",t,n)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"more-info-script",properties:{stateObj:{type:Object}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a),s=n(41),c=r(s),l=u["default"].util.parseDateTime;e["default"]=new o["default"]({is:"more-info-sun",properties:{stateObj:{type:Object},risingDate:{type:Object,computed:"computeRising(stateObj)"},settingDate:{type:Object,computed:"computeSetting(stateObj)"}},computeRising:function(t){return l(t.attributes.next_rising)},computeSetting:function(t){return l(t.attributes.next_setting)},computeOrder:function(t,e){return t>e?["set","ris"]:["ris","set"]},itemCaption:function(t){return"ris"===t?"Rising ":"Setting "},itemDate:function(t){return"ris"===t?this.risingDate:this.settingDate},itemValue:function(t){return(0,c["default"])(this.itemDate(t))}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a),s=n(20),c=r(s),l=o["default"].serviceActions,f=["away_mode"];e["default"]=new u["default"]({is:"more-info-thermostat",properties:{stateObj:{type:Object,observer:"stateObjChanged"},tempMin:{type:Number},tempMax:{type:Number},targetTemperatureSliderValue:{type:Number},awayToggleChecked:{type:Boolean}},stateObjChanged:function(t){this.targetTemperatureSliderValue=t.attributes.temperature,this.awayToggleChecked="on"===t.attributes.away_mode,this.tempMin=t.attributes.min_temp,this.tempMax=t.attributes.max_temp},computeClassNames:function(t){return(0,c["default"])(t,f)},targetTemperatureSliderChanged:function(t){l.callService("thermostat","set_temperature",{entity_id:this.stateObj.entityId,temperature:t.target.value})},toggleChanged:function(t){var e=t.target.checked;e&&"off"===this.stateObj.attributes.away_mode?this.service_set_away(!0):e||"on"!==this.stateObj.attributes.away_mode||this.service_set_away(!1)},service_set_away:function(t){var e=this;l.callService("thermostat","set_away_mode",{away_mode:t,entity_id:this.stateObj.entityId}).then(function(){return e.stateObjChanged(e.stateObj)})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);e["default"]=new o["default"]({is:"more-info-updater",properties:{}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7),n(39),e["default"]=new o["default"]({is:"state-card-configurator",properties:{stateObj:{type:Object}}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a);n(7);var s=o["default"].serviceActions;e["default"]=new u["default"]({is:"state-card-input_select",properties:{stateObj:{type:Object},selectedOption:{type:String,observer:"selectedOptionChanged"}},computeSelected:function(t){return t.attributes.options.indexOf(t.state)},selectedOptionChanged:function(t){""!==t&&t!==this.stateObj.state&&s.callService("input_select","select_option",{option:t,entity_id:this.stateObj.entityId})},stopPropagation:function(t){t.stopPropagation()}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7);var a=["playing","paused"];e["default"]=new o["default"]({is:"state-card-media_player",properties:{stateObj:{type:Object},isPlaying:{type:Boolean,computed:"computeIsPlaying(stateObj)"}},computeIsPlaying:function(t){return-1!==a.indexOf(t.state)},computePrimaryText:function(t,e){return e?t.attributes.media_title:t.stateDisplay},computeSecondaryText:function(t){var e=void 0;return"music"===t.attributes.media_content_type?t.attributes.media_artist:"tvshow"===t.attributes.media_content_type?(e=t.attributes.media_series_title,t.attributes.media_season&&t.attributes.media_episode&&(e+=" S"+t.attributes.media_season+"E"+t.attributes.media_episode),e):t.attributes.app_name?t.attributes.app_name:""}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),o=r(i),a=n(1),u=r(a);n(7);var s=o["default"].serviceActions;e["default"]=new u["default"]({is:"state-card-rollershutter",properties:{stateObj:{type:Object}},computeIsFullyOpen:function(t){return 100===t.attributes.current_position},computeIsFullyClosed:function(t){return 0===t.attributes.current_position},onMoveUpTap:function(){s.callService("rollershutter","move_up",{entity_id:this.stateObj.entityId})},onMoveDownTap:function(){s.callService("rollershutter","move_down",{entity_id:this.stateObj.entityId})},onStopTap:function(){s.callService("rollershutter","stop",{entity_id:this.stateObj.entityId})}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),u=r(a);n(7);var s=u["default"].serviceActions;e["default"]=new o["default"]({is:"state-card-scene",properties:{stateObj:{type:Object}},activateScene:function(){s.callTurnOn(this.stateObj.entityId)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7),e["default"]=new o["default"]({is:"state-card-thermostat",properties:{stateObj:{type:Object}},computeTargetTemperature:function(t){return t.attributes.temperature+" "+t.attributes.unit_of_measurement}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7),n(35),e["default"]=new o["default"]({is:"state-card-toggle"})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i);n(7),e["default"]=new o["default"]({is:"state-card-weblink",properties:{stateObj:{type:Object}},listeners:{tap:"onTap"},onTap:function(t){t.stopPropagation(),window.open(this.stateObj.state,"_blank")}})},function(t,e){"use strict";function n(t){return{attached:function(){var e=this;this.__unwatchFns=Object.keys(this.properties).reduce(function(n,r){if(!("bindNuclear"in e.properties[r]))return n;var i=e.properties[r].bindNuclear;if(!i)throw new Error("Undefined getter specified for key "+r);return e[r]=t.evaluate(i),n.concat(t.observe(i,function(t){e[r]=t}))},[])},detached:function(){for(;this.__unwatchFns.length;)this.__unwatchFns.shift()()}}}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return-1!==u.indexOf(t.domain)?t.domain:(0,a["default"])(t.entityId)?"toggle":"display"}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var o=n(21),a=r(o),u=["configurator","input_select","media_player","rollershutter","scene","thermostat","weblink"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if(!t)return a["default"];if(t.attributes.icon)return t.attributes.icon;var e=t.attributes.unit_of_measurement;return!e||"sensor"!==t.domain||e!==f.UNIT_TEMP_C&&e!==f.UNIT_TEMP_F?(0,s["default"])(t.domain,t.state):"mdi:thermometer"}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var o=n(40),a=r(o),u=n(22),s=r(u),c=n(2),l=r(c),f=l["default"].util.temperatureUnits},function(t,e){"use strict";function n(t){return-1!==r.indexOf(t.domain)?t.domain:"default"}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n;var r=["light","group","sun","configurator","thermostat","script","media_player","camera","updater","alarm_control_panel"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(196),i=n(15),o=function(t,e,n){var o=arguments.length<=3||void 0===arguments[3]?null:arguments[3],a=t.evaluate(i.getters.authInfo),u=a.host+"/api/"+n;return new r.Promise(function(t,n){var r=new XMLHttpRequest;r.open(e,u,!0),r.setRequestHeader("X-HA-access",a.authToken),r.onload=function(){var e=void 0;try{e="application/json"===r.getResponseHeader("content-type")?JSON.parse(r.responseText):r.responseText}catch(i){e=r.responseText}r.status>199&&r.status<300?t(e):n(e)},r.onerror=function(){return n({})},o?r.send(JSON.stringify(o)):r.send()})};e["default"]=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],r=n.useStreaming,i=void 0===r?t.evaluate(c.getters.isSupported):r,o=n.rememberAuth,a=void 0===o?!1:o,s=n.host,d=void 0===s?"":s;t.dispatch(u["default"].VALIDATING_AUTH_TOKEN,{authToken:e,host:d}),l.actions.fetchAll(t).then(function(){t.dispatch(u["default"].VALID_AUTH_TOKEN,{authToken:e,host:d,rememberAuth:a}),i?c.actions.start(t,{syncOnInitialConnect:!1}):l.actions.start(t,{skipInitialSync:!0})},function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=e.message,r=void 0===n?f:n;t.dispatch(u["default"].INVALID_AUTH_TOKEN,{errorMessage:r})})}function o(t){(0,s.callApi)(t,"POST","log_out"),t.dispatch(u["default"].LOG_OUT,{})}Object.defineProperty(e,"__esModule",{value:!0}),e.validate=i,e.logOut=o;var a=n(14),u=r(a),s=n(5),c=n(29),l=n(31),f="Unexpected result from API"},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=e.isValidating=["authAttempt","isValidating"],r=(e.isInvalidAttempt=["authAttempt","isInvalid"],e.attemptErrorMessage=["authAttempt","errorMessage"],e.rememberAuth=["rememberAuth"],e.attemptAuthInfo=[["authAttempt","authToken"],["authAttempt","host"],function(t,e){return{authToken:t,host:e}}]),i=e.currentAuthToken=["authCurrent","authToken"],o=e.currentAuthInfo=[i,["authCurrent","host"],function(t,e){return{authToken:t,host:e}}];e.authToken=[n,["authAttempt","authToken"],["authCurrent","authToken"],function(t,e,n){return t?e:n}],e.authInfo=[n,r,o,function(t,e,n){return t?e:n}]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if(null==t)throw new TypeError("Cannot destructure undefined")}function o(t,e){var n=e.authToken,r=e.host;return(0,s.toImmutable)({authToken:n,host:r,isValidating:!0,isInvalid:!1,errorMessage:""})}function a(t,e){return i(e),f.getInitialState()}function u(t,e){var n=e.errorMessage;return t.withMutations(function(t){return t.set("isValidating",!1).set("isInvalid",!0).set("errorMessage",n)})}Object.defineProperty(e,"__esModule",{value:!0});var s=n(3),c=n(14),l=r(c),f=new s.Store({getInitialState:function(){return(0,s.toImmutable)({isValidating:!1,authToken:!1,host:null,isInvalid:!1,errorMessage:""})},initialize:function(){this.on(l["default"].VALIDATING_AUTH_TOKEN,o),this.on(l["default"].VALID_AUTH_TOKEN,a),this.on(l["default"].INVALID_AUTH_TOKEN,u)}});e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.authToken,r=e.host;return(0,a.toImmutable)({authToken:n,host:r})}function o(){return c.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(14),s=r(u),c=new a.Store({getInitialState:function(){return(0,a.toImmutable)({authToken:null,host:""})},initialize:function(){this.on(s["default"].VALID_AUTH_TOKEN,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.rememberAuth;return n}Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(14),u=r(a),s=new o.Store({getInitialState:function(){return!0},initialize:function(){this.on(u["default"].VALID_AUTH_TOKEN,i)}});e["default"]=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){t.dispatch(c["default"].SERVER_CONFIG_LOADED,e)}function o(t){(0,u.callApi)(t,"GET","config").then(function(e){return i(t,e)})}function a(t,e){t.dispatch(c["default"].COMPONENT_LOADED,{component:e})}Object.defineProperty(e,"__esModule",{value:!0}),e.configLoaded=i,e.fetchAll=o,e.componentLoaded=a;var u=n(5),s=n(23),c=r(s)},function(t,e){"use strict";function n(t){return[["serverComponent"],function(e){return e.contains(t)}]}Object.defineProperty(e,"__esModule",{value:!0}),e.isComponentLoaded=n,e.locationGPS=[["serverConfig","latitude"],["serverConfig","longitude"],function(t,e){return{latitude:t,longitude:e}}],e.locationName=["serverConfig","location_name"],e.serverVersion=["serverConfig","serverVersion"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.component;return t.push(n)}function o(t,e){var n=e.components;return(0,u.toImmutable)(n)}function a(){return l.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var u=n(3),s=n(23),c=r(s),l=new u.Store({getInitialState:function(){return(0,u.toImmutable)([])},initialize:function(){this.on(c["default"].COMPONENT_LOADED,i),this.on(c["default"].SERVER_CONFIG_LOADED,o),this.on(c["default"].LOG_OUT,a)}});e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.latitude,r=e.longitude,i=e.location_name,o=e.temperature_unit,u=e.time_zone,s=e.version;return(0,a.toImmutable)({latitude:n,longitude:r,location_name:i,temperature_unit:o,time_zone:u,serverVersion:s})}function o(){return c.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(23),s=r(u),c=new a.Store({getInitialState:function(){return(0,a.toImmutable)({latitude:null,longitude:null,location_name:"Home",temperature_unit:"°C",time_zone:"UTC",serverVersion:"unknown"})},initialize:function(){this.on(s["default"].SERVER_CONFIG_LOADED,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=c},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){t.dispatch(f["default"].ENTITY_HISTORY_DATE_SELECTED,{date:e})}function a(t){var e=arguments.length<=1||void 0===arguments[1]?null:arguments[1];t.dispatch(f["default"].RECENT_ENTITY_HISTORY_FETCH_START,{});var n="history/period";return null!==e&&(n+="?filter_entity_id="+e),(0,c.callApi)(t,"GET",n).then(function(e){return t.dispatch(f["default"].RECENT_ENTITY_HISTORY_FETCH_SUCCESS,{stateHistory:e})},function(){return t.dispatch(f["default"].RECENT_ENTITY_HISTORY_FETCH_ERROR,{})})}function u(t,e){return t.dispatch(f["default"].ENTITY_HISTORY_FETCH_START,{date:e}),(0,c.callApi)(t,"GET","history/period/"+e).then(function(n){return t.dispatch(f["default"].ENTITY_HISTORY_FETCH_SUCCESS,{date:e,stateHistory:n})},function(){return t.dispatch(f["default"].ENTITY_HISTORY_FETCH_ERROR,{})})}function s(t){var e=t.evaluate(h.currentDate);return u(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.changeCurrentDate=o,e.fetchRecent=a,e.fetchDate=u,e.fetchSelectedDate=s;var c=n(5),l=n(11),f=i(l),d=n(44),h=r(d)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.date;return(0,s["default"])(n)}function o(){return f.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(32),s=r(u),c=n(11),l=r(c),f=new a.Store({getInitialState:function(){var t=new Date;return t.setDate(t.getDate()-1),(0,s["default"])(t)},initialize:function(){this.on(l["default"].ENTITY_HISTORY_DATE_SELECTED,i),this.on(l["default"].LOG_OUT,o)}});e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.date,r=e.stateHistory;return 0===r.length?t.set(n,(0,a.toImmutable)({})):t.withMutations(function(t){r.forEach(function(e){return t.setIn([n,e[0].entity_id],(0,a.toImmutable)(e.map(l["default"].fromJSON)))})})}function o(){return f.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(11),s=r(u),c=n(16),l=r(c),f=new a.Store({getInitialState:function(){return(0,a.toImmutable)({})},initialize:function(){this.on(s["default"].ENTITY_HISTORY_FETCH_SUCCESS,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(3),o=n(11),a=r(o),u=new i.Store({getInitialState:function(){return!1},initialize:function(){this.on(a["default"].ENTITY_HISTORY_FETCH_START,function(){return!0}),this.on(a["default"].ENTITY_HISTORY_FETCH_SUCCESS,function(){return!1}),this.on(a["default"].ENTITY_HISTORY_FETCH_ERROR,function(){return!1}),this.on(a["default"].RECENT_ENTITY_HISTORY_FETCH_START,function(){return!0}),this.on(a["default"].RECENT_ENTITY_HISTORY_FETCH_SUCCESS,function(){return!1}),this.on(a["default"].RECENT_ENTITY_HISTORY_FETCH_ERROR,function(){return!1}),this.on(a["default"].LOG_OUT,function(){return!1})}});e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.stateHistory;return t.withMutations(function(t){n.forEach(function(e){return t.set(e[0].entity_id,(0,a.toImmutable)(e.map(l["default"].fromJSON)))})})}function o(){return f.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(11),s=r(u),c=n(16),l=r(c),f=new a.Store({getInitialState:function(){return(0,a.toImmutable)({})},initialize:function(){this.on(s["default"].RECENT_ENTITY_HISTORY_FETCH_SUCCESS,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n=e.stateHistory,r=(new Date).getTime();return t.withMutations(function(t){n.forEach(function(e){return t.set(e[0].entity_id,r)}),history.length>1&&t.set(c,r)})}function o(){return l.getInitialState()}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=n(11),s=r(u),c="ALL_ENTRY_FETCH",l=new a.Store({getInitialState:function(){return(0,a.toImmutable)({})},initialize:function(){this.on(s["default"].RECENT_ENTITY_HISTORY_FETCH_SUCCESS,i),this.on(s["default"].LOG_OUT,o)}});e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(10),o=n(16),a=r(o),u=(0,i.createApiActions)(a["default"]);e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.visibleEntityMap=e.byId=e.entityMap=e.hasData=void 0;var i=n(10),o=n(16),a=r(o),u=(e.hasData=(0,i.createHasDataGetter)(a["default"]),e.entityMap=(0,i.createEntityMapGetter)(a["default"]));e.byId=(0,i.createByIdGetter)(a["default"]),e.visibleEntityMap=[u,function(t){return t.filter(function(t){return!t.attributes.hidden})}]},function(t,e,n){"use strict";function r(t){return(0,i.callApi)(t,"GET","error_log")}Object.defineProperty(e,"__esModule",{value:!0}),e.fetchErrorLog=r;var i=n(5)},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}Object.defineProperty(e,"__esModule",{value:!0}),e.actions=void 0;var i=n(145),o=r(i);e.actions=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(5),o=n(10),a=n(27),u=n(46),s=r(u),c=(0,o.createApiActions)(s["default"]);c.fireEvent=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return(0,i.callApi)(t,"POST","events/"+e,n).then(function(){a.actions.createNotification(t,"Event "+e+" successful fired!")})},e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.byId=e.entityMap=e.hasData=void 0;var i=n(10),o=n(46),a=r(o);e.hasData=(0,i.createHasDataGetter)(a["default"]),e.entityMap=(0,i.createEntityMapGetter)(a["default"]),e.byId=(0,i.createByIdGetter)(a["default"])},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){t.dispatch(s["default"].LOGBOOK_DATE_SELECTED,{date:e})}function o(t,e){t.dispatch(s["default"].LOGBOOK_ENTRIES_FETCH_START,{date:e}),(0,a.callApi)(t,"GET","logbook/"+e).then(function(n){return t.dispatch(s["default"].LOGBOOK_ENTRIES_FETCH_SUCCESS,{date:e,entries:n})},function(){return t.dispatch(s["default"].LOGBOOK_ENTRIES_FETCH_ERROR,{})})}Object.defineProperty(e,"__esModule",{value:!0}),e.changeCurrentDate=i,e.fetchDate=o;var a=n(5),u=n(12),s=r(u)},function(t,e,n){"use strict";function r(t){return!t||(new Date).getTime()-t>o}Object.defineProperty(e,"__esModule",{value:!0}),e.isLoadingEntries=e.currentEntries=e.isCurrentStale=e.currentDate=void 0;var i=n(3),o=6e4,a=e.currentDate=["currentLogbookDate"];e.isCurrentStale=[a,["logbookEntriesUpdated"],function(t,e){return r(e.get(t))}],e.currentEntries=[a,["logbookEntries"],function(t,e){return e.get(t)||(0,i.toImmutable)([])}],e.isLoadingEntries=["isLoadingLogbookEntries"]},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t){t.registerStores({currentLogbookDate:u["default"],isLoadingLogbookEntries:c["default"],logbookEntries:f["default"],logbookEntriesUpdated:h["default"]})}Object.defineProperty(e,"__esModule",{value:!0}),e.getters=e.actions=void 0,e.register=o;var a=n(153),u=i(a),s=n(154),c=i(s),l=n(155),f=i(l),d=n(156),h=i(d),p=n(149),_=r(p),v=n(150),y=r(v);e.actions=_,e.getters=y},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=function(){function t(t,e){for(var n=0;nt;t+=2){var e=rt[t],n=rt[t+1];e(n),rt[t]=void 0,rt[t+1]=void 0}$=0}function y(){try{var t=n(212);return W=t.runOnLoop||t.runOnContext,d()}catch(e){return _()}}function m(){}function g(){return new TypeError("You cannot resolve a promise with itself")}function b(){return new TypeError("A promises callback cannot return that same promise.")}function S(t){try{return t.then}catch(e){return ut.error=e,ut}}function w(t,e,n,r){try{t.call(e,n,r)}catch(i){return i}}function O(t,e,n){Z(function(t){var r=!1,i=w(n,e,function(n){r||(r=!0,e!==n?E(t,n):D(t,n))},function(e){r||(r=!0,C(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&i&&(r=!0,C(t,i))},t)}function M(t,e){e._state===ot?D(t,e._result):e._state===at?C(t,e._result):j(e,void 0,function(e){E(t,e)},function(e){C(t,e)})}function I(t,e){if(e.constructor===t.constructor)M(t,e);else{var n=S(e);n===ut?C(t,ut.error):void 0===n?D(t,e):u(n)?O(t,e,n):D(t,e)}}function E(t,e){t===e?C(t,g()):a(e)?I(t,e):D(t,e)}function T(t){t._onerror&&t._onerror(t._result),P(t)}function D(t,e){t._state===it&&(t._result=e,t._state=ot,0!==t._subscribers.length&&Z(P,t))}function C(t,e){t._state===it&&(t._state=at,t._result=e,Z(T,t))}function j(t,e,n,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+ot]=n,i[o+at]=r,0===o&&t._state&&Z(P,t)}function P(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,i,o=t._result,a=0;aa;a++)j(r.resolve(t[a]),void 0,e,n);return i}function Y(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(m);return E(n,t),n}function z(t){var e=this,n=new e(m);return C(n,t),n}function U(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function V(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function G(t){this._id=pt++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==t&&(u(t)||U(),this instanceof G||V(),N(this,t))}function F(){var t;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(t.Promise=_t)}var B;B=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var W,q,K,J=B,$=0,Z=({}.toString,function(t,e){rt[$]=t,rt[$+1]=e,$+=2,2===$&&(q?q(v):K())}),X="undefined"!=typeof window?window:void 0,Q=X||{},tt=Q.MutationObserver||Q.WebKitMutationObserver,et="undefined"!=typeof t&&"[object process]"==={}.toString.call(t),nt="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,rt=new Array(1e3);K=et?f():tt?h():nt?p():void 0===X?y():_();var it=void 0,ot=1,at=2,ut=new A,st=new A;R.prototype._validateInput=function(t){return J(t)},R.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},R.prototype._init=function(){this._result=new Array(this.length)};var ct=R;R.prototype._enumerate=function(){for(var t=this,e=t.length,n=t.promise,r=t._input,i=0;n._state===it&&e>i;i++)t._eachEntry(r[i],i)},R.prototype._eachEntry=function(t,e){var n=this,r=n._instanceConstructor;s(t)?t.constructor===r&&t._state!==it?(t._onerror=null,n._settledAt(t._state,e,t._result)):n._willSettleAt(r.resolve(t),e):(n._remaining--,n._result[e]=t)},R.prototype._settledAt=function(t,e,n){var r=this,i=r.promise;i._state===it&&(r._remaining--,t===at?C(i,n):r._result[e]=n),0===r._remaining&&D(i,r._result)},R.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,function(t){n._settledAt(ot,e,t)},function(t){n._settledAt(at,e,t)})};var lt=x,ft=H,dt=Y,ht=z,pt=0,_t=G;G.all=lt,G.race=ft,G.resolve=dt,G.reject=ht,G._setScheduler=c,G._setAsap=l,G._asap=Z,G.prototype={constructor:G,then:function(t,e){var n=this,r=n._state;if(r===ot&&!t||r===at&&!e)return this;var i=new this.constructor(m),o=n._result;if(r){var a=arguments[r-1];Z(function(){L(r,i,a,o)})}else j(n,i,t,e);return i},"catch":function(t){return this.then(null,t)}};var vt=F,yt={Promise:_t,polyfill:vt};n(210).amd?(r=function(){return yt}.call(e,n,e,o),!(void 0!==r&&(o.exports=r))):"undefined"!=typeof o&&o.exports?o.exports=yt:"undefined"!=typeof this&&(this.ES6Promise=yt),vt()}).call(this)}).call(e,n(211),function(){return this}(),n(67)(t))},function(t,e,n){var r=n(62),i=r(Date,"now"),o=i||function(){return(new Date).getTime()};t.exports=o},function(t,e){function n(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=9007199254740991;t.exports=n},function(t,e,n){var r=n(62),i=n(198),o=n(63),a="[object Array]",u=Object.prototype,s=u.toString,c=r(Array,"isArray"),l=c||function(t){return o(t)&&i(t.length)&&s.call(t)==a};t.exports=l},function(t,e,n){function r(t){return null==t?!1:i(t)?l.test(s.call(t)):o(t)&&a.test(t)}var i=n(64),o=n(63),a=/^\[object .+?Constructor\]$/,u=Object.prototype,s=Function.prototype.toString,c=u.hasOwnProperty,l=RegExp("^"+s.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=r},function(t,e){function n(t){return function(e){return null==e?void 0:e[t]}}t.exports=n},function(t,e,n){var r=n(201),i=r("length");t.exports=i},function(t,e,n){function r(t){return null!=t&&o(i(t))}var i=n(202),o=n(206);t.exports=r},function(t,e){function n(t,e){return t="number"==typeof t||r.test(t)?+t:-1,e=null==e?i:e,t>-1&&t%1==0&&e>t}var r=/^\d+$/,i=9007199254740991;t.exports=n},function(t,e,n){function r(t,e,n){if(!a(n))return!1;var r=typeof e;if("number"==r?i(n)&&o(e,n.length):"string"==r&&e in n){var u=n[e];return t===t?t===u:u!==u}return!1}var i=n(203),o=n(204),a=n(207);t.exports=r},function(t,e){function n(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=9007199254740991;t.exports=n},function(t,e){function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=n},function(t,e,n){function r(t,e,n){n&&i(t,e,n)&&(e=n=void 0),t=+t||0,n=null==n?1:+n||0,null==e?(e=t,t=0):e=+e||0;for(var r=-1,u=a(o((e-t)/(n||1)),0),s=Array(u);++r1)for(var n=1;n \ No newline at end of file +Object.defineProperty(c,t,{get:function(){try{return JSON.parse(u[t])}catch(e){return s[t].defaultValue}}})}),c.startSync=function(t){Object.keys(s).forEach(function(e){var n=s[e].getter,r=function(t){u[e]=JSON.stringify(t)};t.observe(n,r),r(t.evaluate(n))})},e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){var e={};return e.incrementData=function(e,n){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];o(e,t,r,n)},e.replaceData=function(e,n){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];o(e,t,f({},r,{replace:!0}),n)},t.fetch&&(e.fetch=function(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return e.dispatch(h["default"].API_FETCH_START,{model:t,params:n,method:"fetch"}),t.fetch(e,n).then(o.bind(null,e,t,n),a.bind(null,e,t,n))}),e.fetchAll=function(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return e.dispatch(h["default"].API_FETCH_START,{model:t,params:n,method:"fetchAll"}),t.fetchAll(e,n).then(o.bind(null,e,t,f({},n,{replace:!0})),a.bind(null,e,t,n))},t.save&&(e.save=function(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return e.dispatch(h["default"].API_SAVE_START,{params:n}),t.save(e,n).then(u.bind(null,e,t,n),s.bind(null,e,t,n))}),t["delete"]&&(e["delete"]=function(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return e.dispatch(h["default"].API_DELETE_START,{params:n}),t["delete"](e,n).then(c.bind(null,e,t,n),l.bind(null,e,t,n))}),e}function o(t,e,n,r){return t.dispatch(h["default"].API_FETCH_SUCCESS,{model:e,params:n,result:r}),r}function a(t,e,n,r){return t.dispatch(h["default"].API_FETCH_FAIL,{model:e,params:n,reason:r}),Promise.reject(r)}function u(t,e,n,r){return t.dispatch(h["default"].API_SAVE_SUCCESS,{model:e,params:n,result:r}),r}function s(t,e,n,r){return t.dispatch(h["default"].API_SAVE_FAIL,{model:e,params:n,reason:r}),Promise.reject(r)}function c(t,e,n,r){return t.dispatch(h["default"].API_DELETE_SUCCESS,{model:e,params:n,result:r}),r}function l(t,e,n,r){return t.dispatch(h["default"].API_DELETE_FAIL,{model:e,params:n,reason:r}),Promise.reject(r)}var f=Object.assign||function(t){for(var e=1;et;t+=2){var e=rt[t],n=rt[t+1];e(n),rt[t]=void 0,rt[t+1]=void 0}$=0}function y(){try{var t=n(212);return W=t.runOnLoop||t.runOnContext,d()}catch(e){return _()}}function m(){}function g(){return new TypeError("You cannot resolve a promise with itself")}function b(){return new TypeError("A promises callback cannot return that same promise.")}function S(t){try{return t.then}catch(e){return ut.error=e,ut}}function w(t,e,n,r){try{t.call(e,n,r)}catch(i){return i}}function O(t,e,n){Z(function(t){var r=!1,i=w(n,e,function(n){r||(r=!0,e!==n?E(t,n):D(t,n))},function(e){r||(r=!0,C(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&i&&(r=!0,C(t,i))},t)}function M(t,e){e._state===ot?D(t,e._result):e._state===at?C(t,e._result):j(e,void 0,function(e){E(t,e)},function(e){C(t,e)})}function I(t,e){if(e.constructor===t.constructor)M(t,e);else{var n=S(e);n===ut?C(t,ut.error):void 0===n?D(t,e):u(n)?O(t,e,n):D(t,e)}}function E(t,e){t===e?C(t,g()):a(e)?I(t,e):D(t,e)}function T(t){t._onerror&&t._onerror(t._result),P(t)}function D(t,e){t._state===it&&(t._result=e,t._state=ot,0!==t._subscribers.length&&Z(P,t))}function C(t,e){t._state===it&&(t._state=at,t._result=e,Z(T,t))}function j(t,e,n,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+ot]=n,i[o+at]=r,0===o&&t._state&&Z(P,t)}function P(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,i,o=t._result,a=0;aa;a++)j(r.resolve(t[a]),void 0,e,n);return i}function Y(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(m);return E(n,t),n}function z(t){var e=this,n=new e(m);return C(n,t),n}function U(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function V(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function G(t){this._id=pt++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==t&&(u(t)||U(),this instanceof G||V(),N(this,t))}function F(){var t;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(t.Promise=_t)}var B;B=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var W,q,K,J=B,$=0,Z=({}.toString,function(t,e){rt[$]=t,rt[$+1]=e,$+=2,2===$&&(q?q(v):K())}),X="undefined"!=typeof window?window:void 0,Q=X||{},tt=Q.MutationObserver||Q.WebKitMutationObserver,et="undefined"!=typeof t&&"[object process]"==={}.toString.call(t),nt="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,rt=new Array(1e3);K=et?f():tt?h():nt?p():void 0===X?y():_();var it=void 0,ot=1,at=2,ut=new A,st=new A;R.prototype._validateInput=function(t){return J(t)},R.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},R.prototype._init=function(){this._result=new Array(this.length)};var ct=R;R.prototype._enumerate=function(){for(var t=this,e=t.length,n=t.promise,r=t._input,i=0;n._state===it&&e>i;i++)t._eachEntry(r[i],i)},R.prototype._eachEntry=function(t,e){var n=this,r=n._instanceConstructor;s(t)?t.constructor===r&&t._state!==it?(t._onerror=null,n._settledAt(t._state,e,t._result)):n._willSettleAt(r.resolve(t),e):(n._remaining--,n._result[e]=t)},R.prototype._settledAt=function(t,e,n){var r=this,i=r.promise;i._state===it&&(r._remaining--,t===at?C(i,n):r._result[e]=n),0===r._remaining&&D(i,r._result)},R.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,function(t){n._settledAt(ot,e,t)},function(t){n._settledAt(at,e,t)})};var lt=x,ft=H,dt=Y,ht=z,pt=0,_t=G;G.all=lt,G.race=ft,G.resolve=dt,G.reject=ht,G._setScheduler=c,G._setAsap=l,G._asap=Z,G.prototype={constructor:G,then:function(t,e){var n=this,r=n._state;if(r===ot&&!t||r===at&&!e)return this;var i=new this.constructor(m),o=n._result;if(r){var a=arguments[r-1];Z(function(){L(r,i,a,o)})}else j(n,i,t,e);return i},"catch":function(t){return this.then(null,t)}};var vt=F,yt={Promise:_t,polyfill:vt};n(210).amd?(r=function(){return yt}.call(e,n,e,o),!(void 0!==r&&(o.exports=r))):"undefined"!=typeof o&&o.exports?o.exports=yt:"undefined"!=typeof this&&(this.ES6Promise=yt),vt()}).call(this)}).call(e,n(211),function(){return this}(),n(67)(t))},function(t,e,n){var r=n(62),i=r(Date,"now"),o=i||function(){return(new Date).getTime()};t.exports=o},function(t,e){function n(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=9007199254740991;t.exports=n},function(t,e,n){var r=n(62),i=n(198),o=n(63),a="[object Array]",u=Object.prototype,s=u.toString,c=r(Array,"isArray"),l=c||function(t){return o(t)&&i(t.length)&&s.call(t)==a};t.exports=l},function(t,e,n){function r(t){return null==t?!1:i(t)?l.test(s.call(t)):o(t)&&a.test(t)}var i=n(64),o=n(63),a=/^\[object .+?Constructor\]$/,u=Object.prototype,s=Function.prototype.toString,c=u.hasOwnProperty,l=RegExp("^"+s.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=r},function(t,e){function n(t){return function(e){return null==e?void 0:e[t]}}t.exports=n},function(t,e,n){var r=n(201),i=r("length");t.exports=i},function(t,e,n){function r(t){return null!=t&&o(i(t))}var i=n(202),o=n(206);t.exports=r},function(t,e){function n(t,e){return t="number"==typeof t||r.test(t)?+t:-1,e=null==e?i:e,t>-1&&t%1==0&&e>t}var r=/^\d+$/,i=9007199254740991;t.exports=n},function(t,e,n){function r(t,e,n){if(!a(n))return!1;var r=typeof e;if("number"==r?i(n)&&o(e,n.length):"string"==r&&e in n){var u=n[e];return t===t?t===u:u!==u}return!1}var i=n(203),o=n(204),a=n(207);t.exports=r},function(t,e){function n(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=9007199254740991;t.exports=n},function(t,e){function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=n},function(t,e,n){function r(t,e,n){n&&i(t,e,n)&&(e=n=void 0),t=+t||0,n=null==n?1:+n||0,null==e?(e=t,t=0):e=+e||0;for(var r=-1,u=a(o((e-t)/(n||1)),0),s=Array(u);++r1)for(var n=1;n \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/home-assistant-polymer b/homeassistant/components/frontend/www_static/home-assistant-polymer index 700d6d37385..d70dd0b2d0e 160000 --- a/homeassistant/components/frontend/www_static/home-assistant-polymer +++ b/homeassistant/components/frontend/www_static/home-assistant-polymer @@ -1 +1 @@ -Subproject commit 700d6d37385886852a07b4075787ec219f836158 +Subproject commit d70dd0b2d0e226f19878aac5bda2de92b253f6ad From fb6aded2e14252b8f3cb7cfa618cccae3c532831 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 7 Feb 2016 00:15:09 -0800 Subject: [PATCH 30/85] Update frontend with new dependencies --- homeassistant/components/frontend/version.py | 2 +- .../frontend/www_static/frontend.html | 2134 +++++++++-------- .../www_static/home-assistant-polymer | 2 +- .../frontend/www_static/service_worker.js | 2 +- 4 files changed, 1083 insertions(+), 1057 deletions(-) diff --git a/homeassistant/components/frontend/version.py b/homeassistant/components/frontend/version.py index edaefc6f16d..b9ea5bcf906 100644 --- a/homeassistant/components/frontend/version.py +++ b/homeassistant/components/frontend/version.py @@ -1,2 +1,2 @@ """ DO NOT MODIFY. Auto-generated by build_frontend script """ -VERSION = "9dc5577716628052687a43f8c1fb24d8" +VERSION = "2c829379205f875c699cdd9db9544d51" diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index eba9325185f..c986406a9d4 100644 --- a/homeassistant/components/frontend/www_static/frontend.html +++ b/homeassistant/components/frontend/www_static/frontend.html @@ -1,6 +1,7 @@ -