forked from andrey-git/home-assistant-custom-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.js.map
1 lines (1 loc) · 112 KB
/
scripts.js.map
1
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../home-assistant-polymer/src/common/dom/apply_themes_on_element.js","webpack:///../home-assistant-polymer/src/common/entity/compute_domain.ts","webpack:///../home-assistant-polymer/src/common/entity/compute_state_domain.ts","webpack:///../home-assistant-polymer/src/common/dom/dynamic_content_updater.js","webpack:///../home-assistant-polymer/src/common/entity/supports-feature.ts","webpack:///../home-assistant-polymer/src/common/const.ts","webpack:///../home-assistant-polymer/src/common/entity/state_card_type.ts","webpack:///./node_modules/@polymer/polymer/lib/utils/html-tag.js","webpack:///./src/mixins/events-mixin.js","webpack:///./src/elements/ha-config-custom-ui.js","webpack:///../home-assistant-polymer/src/util/hass-attributes-util.js","webpack:///./src/utils/hass-attribute-util.js","webpack:///./src/utils/hooks.js","webpack:///../home-assistant-polymer/src/common/entity/get_view_entities.ts","webpack:///../home-assistant-polymer/src/common/entity/get_group_entities.ts","webpack:///./src/utils/version.js","webpack:///./src/elements/cui-base-element.js","webpack:///./src/elements/dynamic-element.js","webpack:///./src/elements/dynamic-with-extra.js","webpack:///./src/elements/ha-themed-slider.js","webpack:///./src/elements/state-card-with-slider.js","webpack:///./src/elements/state-card-without-slider.js","webpack:///./src/elements/state-card-custom-ui.js","webpack:///../home-assistant-polymer/src/common/entity/can_toggle_state.ts","webpack:///../home-assistant-polymer/src/common/entity/can_toggle_domain.ts","webpack:///./node_modules/@polymer/polymer/lib/utils/boot.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","r","value","n","__esModule","default","object","property","prototype","hasOwnProperty","p","s","__webpack_exports__","applyThemesOnElement","element","themes","localTheme","updateMeta","_themes","themeName","default_theme","styles","assign","theme","keys","forEach","key","prefixedKey","updateStyles","window","ShadyCSS","styleSubtree","meta","document","querySelector","hasAttribute","setAttribute","getAttribute","themeColor","computeDomain","entityId","substr","indexOf","computeStateDomain","stateObj","entity_id","dynamicContentUpdater","root","newElementTag","attributes","rootEl","customEl","lastChild","tagName","removeChild","createElement","toLowerCase","setProperties","parentNode","appendChild","supportsFeature","feature","supported_features","DOMAINS_WITH_CARD","Set","LiteralString","constructor","string","this","toString","html","strings","values","template","innerHTML","reduce","acc","v","idx","HTMLTemplateElement","Error","literalValue","events_mixin","superClass","fire","type","detail","options","event","Event","bubbles","cancelable","Boolean","composed","node","dispatchEvent","customElements","define","Polymer","Element","properties","isWide","String","observer","ready","super","customUI","getName","nameChanged","setName","_backHandler","history","back","hassAttributeUtil","binary_sensor","cover","sensor","json","icon","boolean","array","key-value","LOGIC_STATE_ATTRIBUTES","entity_picture","friendly_name","description","emulated_hue","domains","emulated_hue_name","haaska_hidden","haaska_name","homebridge_hidden","homebridge_name","attribution","custom_ui_more_info","custom_ui_state_card","device_class","DOMAIN_DEVICE_CLASS","hidden","assumed_state","initial_state","unit_of_measurement","hass_attributes_util","SUPPORTED_SLIDER_MODES","customUiAttributes","group","device","templates","state","_stateDisplay","control_element","state_card_mode","light","concat","climate","*","state_card_custom_ui_secondary","badges_list","show_last_changed","hide_control","extra_data_template","extra_badge","stretch_slider","slider_theme","confirm_controls","confirm_controls_show_lock","hide_in_default_view","icon_color","UNKNOWN_TYPE","domHost","elem","getRootNode","DocumentFragment","host","lightOrShadow","selector","shadowRoot","getElementHierarchy","hierarchy","shift","getContext","_context","groupEntity","push","states","length","reverse","findMatch","find","option","match","maybeChangeObjectByDevice","applyAttributes","maybeChangeObjectByGroup","context","_setKeep","obj","_cui_keep","maybeApplyTemplateAttributes","hass","newAttributes","hasGlobal","hasChanges","computeTemplate","untemplated_attributes","untemplated_state","result","untemplated_stateDisplay","maybeApplyTemplates","newResult","checkAttributes","last_changed","maybeChangeObject","inDialog","allowHidden","fixGroupTitles","homeAssistantMain","setTimeout","haCards","$","main","querySelectorAll","card","textContent","controlColumns","columns","partialCards","bind","f","handleWindowChange","_updateColumns","mqls","mql","removeListener","map","width","matchMedia","addListener","useCustomizer","customizer","hide_attributes","attr","updateConfigPanel","location","pathname","startsWith","haPanelConfig","haConfigNavigation","localize","cuiPatch","_originalComputeLoaded","_computeLoaded","_originalComputeCaption","_computeCaption","_originalComputeDescription","_computeDescription","page","pages","some","conf","domain","caption","loaded","getHaConfigCustomUi","haConfigCustomUi","ironPages","lastElementChild","addEventListener","select","visible","style","display","routerOptions","routes","customui","tag","load","Promise","resolve","update","Map","installStatesHook","whenDefined","then","homeAssistant","_updateHass","originalUpdate","entity","newEntity","_themeWaiters","waiter","stateChanged","installPartialCards","_defaultViewFilter","excludes","excludeEntityId","view","viewEntities","entities","groupEntities","grEntityId","grEntity","filter","id","installActionName","elementName","klass","action_name","__data","set","installHaStateLabelBadge","haStateLabelBadge","startInterval","installStateBadge","stateBadge","_updateIconAppearance","originalUpdateIconAppearance","backgroundImage","color","updated","originalUpdated","changedProps","has","_icon","installHaAttributes","haAttributes","computeFiltersArray","extraFilters","split","installHaFormCustomize","haFormCustomize","haFormCustomizeInitDone","_computeSingleAttribute","secondary","config","_initOpenObject","JSON","stringify","getNewAttributesOptions","localAttributes","globalAttributes","existingAttributes","includes","filterFromAttributes","sort","installClassHooks","classInitDone","init","initDone","runHooks","console","log","CUSTOM_UI_LIST","version","url","localStorage","getItem","setItem","attribute","functionBody","Function","e","SyntaxError","ReferenceError","warn","message","cui_base_element","controlElement","extra","Array","computed","computeExtra","extras","isArray","showLastChanged","hasExtra","observers","observerFunc","toUpperCase","extraObj","_attached","extraObjVisible","connectedCallback","disconnectedCallback","_isAttached","attached","extraBadges","extraBadge","unit","blacklist","blacklist_states","RegExp","test","_entityDisplay","computeExtraVisible","extraClass","_showControl","computeStateDisplay","haLocalize","isConfirmControls","clickHandler","pointerEvents","lock","opacity","stopPropagation","applyThemes","extraDomChanged","disableOffWhenMin","_computeAttribute","computeEnabledThemedReportWhenNotChanged","disableReportWhenNotChanged","min","Number","max","pin","isOn","notify","_themedMin","_enabledThemedReportWhenNotChanged","def","computeClass","themedMin","valueChanged","ev","target","serviceMin","serviceMax","valueName","setValueName","nameOn","sliderValue","mode","stretchSlider","breakSlider","hideSlider","lineTooLong","minLineBreak","maxLineBreak","showSlider","_onIronResize","_isConnected","_waitForLayout","removeEventListener","_setMode","_frameId","readyToCompute","requestAnimationFrame","prevBreakSlider","prevHideSlider","container","containerWidth","clientWidth","containerHeight","clientHeight","stateHeight","_computeWrapClass","_showSlider","sliderChanged","parseInt","param","isNaN","path","composedPath","callService","stateObjChanged","SHOW_LAST_CHANGED_BLACKLISTED_CARDS","DOMAIN_TO_SLIDER_SUPPORT","TYPE_TO_CONTROL","toggle","classList","contains","_container","setProperty","inputChanged","margin","padding","badgeMode","params","text-align","fontSize","cleanBadgeStyle","modifiedObj","themeTarget","maybeHideEntity","sliderEligible_","regularMode_","originalStateCardType","services","control","stateCardType","customStateCardType","secondaryStateCardType","min_temp","max_temp","JSCompiler_renameProperty","prop"],"mappings":";aACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAG,EAAAH,EACAI,KACAH,YAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,KAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,GACAK,gBACAC,cACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAjB,GACAY,OAAAC,eAAAb,EAAA,cAAiDkB,YAIjDpB,EAAAqB,EAAA,SAAAlB,GACA,IAAAS,EAAAT,KAAAmB,WACA,WAA2B,OAAAnB,EAAAoB,SAC3B,WAAiC,OAAApB,GAEjC,OADAH,EA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CxG,EACEsB,MACCua,GAA0BD,iBAAqCJ,KAAyB5G,cACzFmG,qBG/ONhc,OAAOid,0BAA4B,SAASC,GAAQ,OAAOA","file":"scripts.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/**\n * Apply a theme to an element by setting the CSS variables on it.\n *\n * element: Element to apply theme on.\n * themes: HASS Theme information\n * localTheme: selected theme.\n * updateMeta: boolean if we should update the theme-color meta element.\n */\nexport default function applyThemesOnElement(\n element,\n themes,\n localTheme,\n updateMeta = false\n) {\n if (!element._themes) {\n element._themes = {};\n }\n let themeName = themes.default_theme;\n if (localTheme === \"default\" || (localTheme && themes.themes[localTheme])) {\n themeName = localTheme;\n }\n const styles = Object.assign({}, element._themes);\n if (themeName !== \"default\") {\n var theme = themes.themes[themeName];\n Object.keys(theme).forEach((key) => {\n var prefixedKey = \"--\" + key;\n element._themes[prefixedKey] = \"\";\n styles[prefixedKey] = theme[key];\n });\n }\n if (element.updateStyles) {\n element.updateStyles(styles);\n } else if (window.ShadyCSS) {\n // implement updateStyles() method of Polemer elements\n window.ShadyCSS.styleSubtree(/** @type {!HTMLElement} */ (element), styles);\n }\n\n if (!updateMeta) return;\n\n const meta = document.querySelector(\"meta[name=theme-color]\");\n if (meta) {\n if (!meta.hasAttribute(\"default-content\")) {\n meta.setAttribute(\"default-content\", meta.getAttribute(\"content\"));\n }\n const themeColor =\n styles[\"--primary-color\"] || meta.getAttribute(\"default-content\");\n meta.setAttribute(\"content\", themeColor);\n }\n}\n","export default function computeDomain(entityId: string): string {\n return entityId.substr(0, entityId.indexOf(\".\"));\n}\n","import { HassEntity } from \"home-assistant-js-websocket\";\nimport computeDomain from \"./compute_domain\";\n\nexport default function computeStateDomain(stateObj: HassEntity) {\n return computeDomain(stateObj.entity_id);\n}\n","/**\n * Update root's child element to be newElementTag replacing another existing child if any.\n * Copy attributes into the child element.\n */\nexport default function dynamicContentUpdater(root, newElementTag, attributes) {\n const rootEl = root;\n let customEl;\n\n if (rootEl.lastChild && rootEl.lastChild.tagName === newElementTag) {\n customEl = rootEl.lastChild;\n } else {\n if (rootEl.lastChild) {\n rootEl.removeChild(rootEl.lastChild);\n }\n // Creating an element with upper case works fine in Chrome, but in FF it doesn't immediately\n // become a defined Custom Element. Polymer does that in some later pass.\n customEl = document.createElement(newElementTag.toLowerCase());\n }\n\n if (customEl.setProperties) {\n customEl.setProperties(attributes);\n } else {\n // If custom element definition wasn't loaded yet - setProperties would be\n // missing, but no harm in setting attributes one-by-one then.\n Object.keys(attributes).forEach((key) => {\n customEl[key] = attributes[key];\n });\n }\n\n if (customEl.parentNode === null) {\n rootEl.appendChild(customEl);\n }\n}\n","import { HassEntity } from \"home-assistant-js-websocket\";\n\nexport const supportsFeature = (\n stateObj: HassEntity,\n feature: number\n): boolean => {\n // tslint:disable-next-line:no-bitwise\n return (stateObj.attributes.supported_features! & feature) !== 0;\n};\n","/** Constants to be used in the frontend. */\n\n// Constants should be alphabetically sorted by name.\n// Arrays with values should be alphabetically sorted if order doesn't matter.\n// Each constant should have a description what it is supposed to be used for.\n\n/** Icon to use when no icon specified for domain. */\nexport const DEFAULT_DOMAIN_ICON = \"hass:bookmark\";\n\n/** Panel to show when no panel is picked. */\nexport const DEFAULT_PANEL = \"states\";\n\n/** Domains that have a state card. */\nexport const DOMAINS_WITH_CARD = [\n \"climate\",\n \"cover\",\n \"configurator\",\n \"input_select\",\n \"input_number\",\n \"input_text\",\n \"lock\",\n \"media_player\",\n \"scene\",\n \"script\",\n \"timer\",\n \"vacuum\",\n \"water_heater\",\n \"weblink\",\n];\n\n/** Domains with separate more info dialog. */\nexport const DOMAINS_WITH_MORE_INFO = [\n \"alarm_control_panel\",\n \"automation\",\n \"camera\",\n \"climate\",\n \"configurator\",\n \"cover\",\n \"fan\",\n \"group\",\n \"history_graph\",\n \"input_datetime\",\n \"light\",\n \"lock\",\n \"media_player\",\n \"script\",\n \"sun\",\n \"updater\",\n \"vacuum\",\n \"water_heater\",\n \"weather\",\n];\n\n/** Domains that show no more info dialog. */\nexport const DOMAINS_HIDE_MORE_INFO = [\n \"input_number\",\n \"input_select\",\n \"input_text\",\n \"scene\",\n \"weblink\",\n];\n\n/** Domains that should have the history hidden in the more info dialog. */\nexport const DOMAINS_MORE_INFO_NO_HISTORY = [\n \"camera\",\n \"configurator\",\n \"history_graph\",\n \"scene\",\n];\n\n/** States that we consider \"off\". */\nexport const STATES_OFF = [\"closed\", \"locked\", \"off\"];\n\n/** Domains where we allow toggle in Lovelace. */\nexport const DOMAINS_TOGGLE = new Set([\n \"fan\",\n \"input_boolean\",\n \"light\",\n \"switch\",\n]);\n\n/** Temperature units. */\nexport const UNIT_C = \"°C\";\nexport const UNIT_F = \"°F\";\n\n/** Entity ID of the default view. */\nexport const DEFAULT_VIEW_ENTITY_ID = \"group.default_view\";\n","import { HassEntity } from \"home-assistant-js-websocket\";\nimport canToggleState from \"./can_toggle_state\";\nimport computeStateDomain from \"./compute_state_domain\";\nimport { DOMAINS_WITH_CARD } from \"../const\";\nimport { HomeAssistant } from \"../../types\";\n\nexport default function stateCardType(\n hass: HomeAssistant,\n stateObj: HassEntity\n) {\n if (stateObj.state === \"unavailable\") {\n return \"display\";\n }\n\n const domain = computeStateDomain(stateObj);\n\n if (DOMAINS_WITH_CARD.includes(domain)) {\n return domain;\n }\n if (\n canToggleState(hass, stateObj) &&\n stateObj.attributes.control !== \"hidden\"\n ) {\n return \"toggle\";\n }\n return \"display\";\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\nimport './boot.js';\n\n/**\n * Class representing a static string value which can be used to filter\n * strings by asseting that they have been created via this class. The\n * `value` property returns the string passed to the constructor.\n */\nclass LiteralString {\n constructor(string) {\n /** @type {string} */\n this.value = string.toString();\n }\n /**\n * @return {string} LiteralString string value\n */\n toString() {\n return this.value;\n }\n}\n\n/**\n * @param {*} value Object to stringify into HTML\n * @return {string} HTML stringified form of `obj`\n */\nfunction literalValue(value) {\n if (value instanceof LiteralString) {\n return /** @type {!LiteralString} */(value).value;\n } else {\n throw new Error(\n `non-literal value passed to Polymer's htmlLiteral function: ${value}`\n );\n }\n}\n\n/**\n * @param {*} value Object to stringify into HTML\n * @return {string} HTML stringified form of `obj`\n */\nfunction htmlValue(value) {\n if (value instanceof HTMLTemplateElement) {\n return /** @type {!HTMLTemplateElement } */(value).innerHTML;\n } else if (value instanceof LiteralString) {\n return literalValue(value);\n } else {\n throw new Error(\n `non-template value passed to Polymer's html function: ${value}`);\n }\n}\n\n/**\n * A template literal tag that creates an HTML <template> element from the\n * contents of the string.\n *\n * This allows you to write a Polymer Template in JavaScript.\n *\n * Templates can be composed by interpolating `HTMLTemplateElement`s in\n * expressions in the JavaScript template literal. The nested template's\n * `innerHTML` is included in the containing template. The only other\n * values allowed in expressions are those returned from `htmlLiteral`\n * which ensures only literal values from JS source ever reach the HTML, to\n * guard against XSS risks.\n *\n * All other values are disallowed in expressions to help prevent XSS\n * attacks; however, `htmlLiteral` can be used to compose static\n * string values into templates. This is useful to compose strings into\n * places that do not accept html, like the css text of a `style`\n * element.\n *\n * Example:\n *\n * static get template() {\n * return html`\n * <style>:host{ content:\"...\" }</style>\n * <div class=\"shadowed\">${this.partialTemplate}</div>\n * ${super.template}\n * `;\n * }\n * static get partialTemplate() { return html`<span>Partial!</span>`; }\n *\n * @param {!ITemplateArray} strings Constant parts of tagged template literal\n * @param {...*} values Variable parts of tagged template literal\n * @return {!HTMLTemplateElement} Constructed HTMLTemplateElement\n */\nexport const html = function html(strings, ...values) {\n const template = /** @type {!HTMLTemplateElement} */(document.createElement('template'));\n template.innerHTML = values.reduce((acc, v, idx) =>\n acc + htmlValue(v) + strings[idx + 1], strings[0]);\n return template;\n};\n\n/**\n * An html literal tag that can be used with `html` to compose.\n * a literal string.\n *\n * Example:\n *\n * static get template() {\n * return html`\n * <style>\n * :host { display: block; }\n * ${this.styleTemplate()}\n * </style>\n * <div class=\"shadowed\">${staticValue}</div>\n * ${super.template}\n * `;\n * }\n * static get styleTemplate() {\n * return htmlLiteral`.shadowed { background: gray; }`;\n * }\n *\n * @param {!ITemplateArray} strings Constant parts of tagged template literal\n * @param {...*} values Variable parts of tagged template literal\n * @return {!LiteralString} Constructed literal string\n */\nexport const htmlLiteral = function(strings, ...values) {\n return new LiteralString(values.reduce((acc, v, idx) =>\n acc + literalValue(v) + strings[idx + 1], strings[0]));\n};\n","// Polymer legacy event helpers used courtesy of the Polymer project.\n//\n// Copyright (c) 2017 The Polymer Authors. All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n// * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n// * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nexport default (superClass) => {\n /**\n * @extends HTMLElement\n */\n class EventsMixin extends superClass {\n /**\n * Dispatches a custom event with an optional detail value.\n *\n * @param {string} type Name of event type.\n * @param {*=} detail Detail value containing event-specific\n * payload.\n * @param {{ bubbles: (boolean|undefined),\n cancelable: (boolean|undefined),\n composed: (boolean|undefined) }=}\n * options Object specifying options. These may include:\n * `bubbles` (boolean, defaults to `true`),\n * `cancelable` (boolean, defaults to false), and\n * `node` on which to fire the event (HTMLElement, defaults to `this`).\n * @return {Event} The new event that was fired.\n */\n fire(type, detail = {}, options = {}) {\n const event = new Event(type, {\n bubbles: options.bubbles === undefined ? true : options.bubbles,\n cancelable: Boolean(options.cancelable),\n composed: options.composed === undefined ? true : options.composed,\n });\n event.detail = detail;\n const node = options.node || this;\n node.dispatchEvent(event);\n return event;\n }\n }\n return EventsMixin;\n};\n","import { html } from '@polymer/polymer/lib/utils/html-tag.js';\nimport EventsMixin from '../mixins/events-mixin.js';\nimport '../utils/hooks.js';\n\n/**\n * @extends HTMLElement\n */\nclass HaConfigCustomUi extends EventsMixin(Polymer.Element) {\n static get template() {\n return html`\n <style include=\"ha-style\"></style>\n <app-header-layout has-scrolling-region>\n <app-header slot=\"header\" fixed>\n <app-toolbar>\n <paper-icon-button\n icon='hass:arrow-left'\n on-click='_backHandler'\n ></paper-icon-button>\n <div main-title>Custom UI settings</div>\n </app-toolbar>\n </app-header>\n\n <ha-config-section is-wide='[[isWide]]'>\n <paper-card heading='Device name'>\n <div class='card-content'>\n Set device name so that you can reference it in per-device settings\n <paper-input\n label='Name'\n value='{{name}}'\n ></paper-input>\n </div>\n </paper-card>\n </ha-config-section>\n </app-header-layout>\n `;\n }\n\n static get properties() {\n return {\n isWide: Boolean,\n\n name: {\n type: String,\n observer: 'nameChanged',\n },\n };\n }\n\n ready() {\n super.ready();\n this.name = window.customUI.getName();\n }\n\n nameChanged(name) {\n window.customUI.setName(name);\n }\n\n _backHandler() {\n window.history.back();\n this.fire('location-changed');\n }\n}\ncustomElements.define('ha-config-custom-ui', HaConfigCustomUi);\n","const hassAttributeUtil = {};\n\nhassAttributeUtil.DOMAIN_DEVICE_CLASS = {\n binary_sensor: [\n \"battery\",\n \"cold\",\n \"connectivity\",\n \"door\",\n \"garage_door\",\n \"gas\",\n \"heat\",\n \"light\",\n \"lock\",\n \"moisture\",\n \"motion\",\n \"moving\",\n \"occupancy\",\n \"opening\",\n \"plug\",\n \"power\",\n \"presence\",\n \"problem\",\n \"safety\",\n \"smoke\",\n \"sound\",\n \"vibration\",\n \"window\",\n ],\n cover: [\"garage\"],\n sensor: [\"battery\", \"humidity\", \"illuminance\", \"temperature\", \"pressure\"],\n};\n\nhassAttributeUtil.UNKNOWN_TYPE = \"json\";\nhassAttributeUtil.ADD_TYPE = \"key-value\";\n\nhassAttributeUtil.TYPE_TO_TAG = {\n string: \"ha-customize-string\",\n json: \"ha-customize-string\",\n icon: \"ha-customize-icon\",\n boolean: \"ha-customize-boolean\",\n array: \"ha-customize-array\",\n \"key-value\": \"ha-customize-key-value\",\n};\n\n// Attributes here serve dual purpose:\n// 1) Any key of this object won't be shown in more-info window.\n// 2) Any key which has value other than undefined will appear in customization\n// config according to its value.\nhassAttributeUtil.LOGIC_STATE_ATTRIBUTES = hassAttributeUtil.LOGIC_STATE_ATTRIBUTES || {\n entity_picture: undefined,\n friendly_name: { type: \"string\", description: \"Name\" },\n icon: { type: \"icon\" },\n emulated_hue: {\n type: \"boolean\",\n domains: [\"emulated_hue\"],\n },\n emulated_hue_name: {\n type: \"string\",\n domains: [\"emulated_hue\"],\n },\n haaska_hidden: undefined,\n haaska_name: undefined,\n homebridge_hidden: { type: \"boolean\" },\n homebridge_name: { type: \"string\" },\n supported_features: undefined,\n attribution: undefined,\n custom_ui_more_info: { type: \"string\" },\n custom_ui_state_card: { type: \"string\" },\n device_class: {\n type: \"array\",\n options: hassAttributeUtil.DOMAIN_DEVICE_CLASS,\n description: \"Device class\",\n domains: [\"binary_sensor\", \"cover\", \"sensor\"],\n },\n hidden: { type: \"boolean\", description: \"Hide from UI\" },\n assumed_state: {\n type: \"boolean\",\n domains: [\n \"switch\",\n \"light\",\n \"cover\",\n \"climate\",\n \"fan\",\n \"group\",\n \"water_heater\",\n ],\n },\n initial_state: {\n type: \"string\",\n domains: [\"automation\"],\n },\n unit_of_measurement: { type: \"string\" },\n};\n\nexport default hassAttributeUtil;\n","import hassAttributesUtil from '../../home-assistant-polymer/src/util/hass-attributes-util.js';\n\nwindow.hassAttributeUtil = window.hassAttributeUtil || {};\nconst SUPPORTED_SLIDER_MODES = [\n 'single-line', 'break-slider', 'break-slider-toggle', 'hide-slider', 'no-slider',\n];\n\nconst customUiAttributes = {\n group: undefined,\n device: undefined,\n templates: undefined,\n state: undefined,\n _stateDisplay: undefined,\n control_element: { type: 'string' },\n state_card_mode: {\n type: 'array',\n options: {\n light: SUPPORTED_SLIDER_MODES.concat('badges'),\n cover: SUPPORTED_SLIDER_MODES.concat('badges'),\n climate: SUPPORTED_SLIDER_MODES.concat('badges'),\n '*': ['badges'],\n },\n },\n state_card_custom_ui_secondary: { type: 'string' },\n badges_list: { type: 'json' },\n show_last_changed: { type: 'boolean' },\n hide_control: { type: 'boolean' },\n extra_data_template: { type: 'string' },\n extra_badge: { type: 'json' },\n stretch_slider: { type: 'boolean' },\n slider_theme: { type: 'json' },\n theme: { type: 'string' },\n confirm_controls: { type: 'boolean' },\n confirm_controls_show_lock: { type: 'boolean' },\n hide_in_default_view: { type: 'boolean' },\n icon_color: { type: 'string' },\n};\nwindow.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES = hassAttributesUtil.LOGIC_STATE_ATTRIBUTES;\nwindow.hassAttributeUtil.UNKNOWN_TYPE = hassAttributesUtil.UNKNOWN_TYPE;\nObject.assign(window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES, customUiAttributes);\n","import applyThemesOnElement from '../../home-assistant-polymer/src/common/dom/apply_themes_on_element.js';\nimport computeStateDomain from '../../home-assistant-polymer/src/common/entity/compute_state_domain.ts';\nimport getViewEntities from '../../home-assistant-polymer/src/common/entity/get_view_entities.ts';\n\nimport '../elements/ha-config-custom-ui.js';\nimport VERSION from './version.js';\nimport './hass-attribute-util.js';\n\nwindow.customUI = window.customUI || {\n SUPPORTED_SLIDER_MODES: [\n 'single-line', 'break-slider', 'break-slider-toggle', 'hide-slider', 'no-slider',\n ],\n\n domHost(elem) {\n if (elem === document) return null;\n const root = elem.getRootNode();\n return (root instanceof DocumentFragment) ? /** @type {ShadowRoot} */ (root).host : root;\n },\n\n lightOrShadow(elem, selector) {\n return elem.shadowRoot ?\n elem.shadowRoot.querySelector(selector) :\n elem.querySelector(selector);\n },\n\n getElementHierarchy(root, hierarchy) {\n if (root === null) return null;\n const elem = hierarchy.shift();\n if (elem) {\n return window.customUI.getElementHierarchy(\n window.customUI.lightOrShadow(root, elem), hierarchy);\n }\n return root;\n },\n\n getContext(elem) {\n if (elem._context === undefined) {\n elem._context = [];\n for (let element = (elem.tagName === 'HA-ENTITIES-CARD' ? window.customUI.domHost(elem) : elem);\n element; element = window.customUI.domHost(element)) {\n switch (element.tagName) {\n case 'HA-ENTITIES-CARD':\n if (element.groupEntity) {\n elem._context.push(element.groupEntity.entity_id);\n } else if (element.groupEntity === false && element.states && element.states.length) {\n elem._context.push(`group.${computeStateDomain(element.states[0])}`);\n }\n break;\n case 'MORE-INFO-GROUP':\n case 'STATE-CARD-CONTENT':\n if (element.stateObj) {\n elem._context.push(element.stateObj.entity_id);\n }\n break;\n case 'HA-CARDS':\n elem._context.push(element.getAttribute('data-view') || 'default_view');\n break;\n // no default\n }\n }\n elem._context.reverse();\n }\n return elem._context;\n },\n\n findMatch(key, options) {\n if (!options) return null;\n if (options[key]) return key;\n return Object.keys(options).find(option => key.match(`^${option}$`));\n },\n\n maybeChangeObjectByDevice(stateObj) {\n const name = window.customUI.getName();\n if (!name) return stateObj;\n const match = this.findMatch(name, stateObj.attributes.device);\n if (!match) return stateObj;\n const attributes = Object.assign({}, stateObj.attributes.device[match]);\n\n if (!Object.keys(attributes).length) return stateObj;\n return window.customUI.applyAttributes(stateObj, attributes);\n },\n\n maybeChangeObjectByGroup(elem, stateObj) {\n const context = window.customUI.getContext(elem);\n if (!context) return stateObj;\n\n if (!stateObj.attributes.group) {\n return stateObj;\n }\n const attributes = {};\n context.forEach((c) => {\n const match = this.findMatch(c, stateObj.attributes.group);\n if (stateObj.attributes.group[match]) {\n Object.assign(attributes, stateObj.attributes.group[match]);\n }\n });\n\n if (!Object.keys(attributes).length) return stateObj;\n\n return window.customUI.applyAttributes(stateObj, attributes);\n },\n\n _setKeep(obj, value) {\n if (obj._cui_keep === undefined) {\n obj._cui_keep = value;\n } else {\n obj._cui_keep = obj._cui_keep && value;\n }\n },\n\n maybeApplyTemplateAttributes(hass, states, stateObj, attributes) {\n if (!attributes.templates) {\n window.customUI._setKeep(stateObj, true);\n return stateObj;\n }\n const newAttributes = {};\n let hasGlobal = false;\n let hasChanges = false;\n Object.keys(attributes.templates).forEach((key) => {\n const template = attributes.templates[key];\n if (template.match(/\\b(entities|hass)\\b/)) {\n hasGlobal = true;\n }\n const value = window.customUI.computeTemplate(\n template, hass, states, stateObj, attributes,\n (stateObj.untemplated_attributes && stateObj.untemplated_attributes[key]) ||\n attributes[key],\n stateObj.untemplated_state || stateObj.state);\n // In case of null don't set the value.\n if (value === null) return;\n newAttributes[key] = value;\n if (key === 'state') {\n if (value !== stateObj.state) {\n hasChanges = true;\n }\n } else if (key === '_stateDisplay') {\n if (value !== stateObj._stateDisplay) {\n hasChanges = true;\n }\n } else if (value !== attributes[key]) {\n hasChanges = true;\n }\n });\n window.customUI._setKeep(stateObj, !hasGlobal);\n if (!hasChanges) {\n return stateObj;\n }\n if (stateObj.attributes === attributes) {\n // We are operating on real attributes. Replace them.\n const result = window.customUI.applyAttributes(stateObj, newAttributes);\n if (Object.prototype.hasOwnProperty.call(newAttributes, 'state')) {\n if (newAttributes.state !== null) {\n result.state = String(newAttributes.state);\n result.untemplated_state = stateObj.state;\n }\n }\n if (Object.prototype.hasOwnProperty.call(newAttributes, '_stateDisplay')) {\n result._stateDisplay = newAttributes._stateDisplay;\n result.untemplated_stateDisplay = stateObj._stateDisplay;\n }\n window.customUI._setKeep(result, !hasGlobal);\n return result;\n }\n // Operating on context-aware attributes. Return shallow copy of object.\n return Object.assign({}, stateObj);\n },\n\n maybeApplyTemplates(hass, states, stateObj) {\n const newResult = window.customUI.maybeApplyTemplateAttributes(\n hass, states, stateObj, stateObj.attributes);\n let hasChanges = (newResult !== stateObj);\n\n function checkAttributes(obj) {\n if (!obj) return;\n Object.values(obj).forEach((attributes) => {\n const result = window.customUI.maybeApplyTemplateAttributes(\n hass, states, newResult, attributes);\n hasChanges |= (result !== newResult);\n });\n checkAttributes(obj.device);\n checkAttributes(obj.group);\n }\n\n checkAttributes(stateObj.attributes.device);\n checkAttributes(stateObj.attributes.group);\n if (newResult !== stateObj) return newResult;\n if (hasChanges) {\n return Object.assign({}, stateObj);\n }\n return stateObj;\n },\n\n applyAttributes(stateObj, attributes) {\n return {\n entity_id: stateObj.entity_id,\n state: stateObj.state,\n attributes: Object.assign({}, stateObj.attributes, attributes),\n untemplated_attributes: stateObj.attributes,\n last_changed: stateObj.last_changed,\n };\n },\n\n maybeChangeObject(elem, stateObj, inDialog, allowHidden) {\n if (inDialog) return stateObj;\n let obj = window.customUI.maybeChangeObjectByDevice(stateObj);\n obj = window.customUI.maybeChangeObjectByGroup(elem, obj);\n obj = window.customUI.maybeApplyTemplateAttributes(\n elem.hass, elem.hass.states, obj, obj.attributes);\n\n if (obj !== stateObj && obj.attributes.hidden && allowHidden) {\n return null;\n }\n return obj;\n },\n\n fixGroupTitles() {\n const homeAssistantMain = window.customUI.getElementHierarchy(document, [\n 'home-assistant',\n 'home-assistant-main']);\n if (homeAssistantMain === null) {\n // DOM not ready. Wait 1 second.\n window.setTimeout(window.customUI.fixGroupTitles, 1000);\n return;\n }\n\n const haCards = window.customUI.getElementHierarchy(homeAssistantMain, [\n 'partial-cards',\n 'ha-cards[view-visible]']);\n if (haCards === null) return;\n const main = window.customUI.lightOrShadow(haCards, '.main') || haCards.$.main;\n const cards = main.querySelectorAll('ha-entities-card');\n cards.forEach((card) => {\n if (card.groupEntity) {\n const obj = window.customUI.maybeChangeObject(\n card,\n card.groupEntity,\n false /* inDialog */,\n false /* allowHidden */);\n if (obj !== card.groupEntity && obj.attributes.friendly_name) {\n const nameElem = window.customUI.lightOrShadow(card, '.name');\n nameElem.textContent = obj.attributes.friendly_name;\n }\n }\n });\n },\n\n controlColumns(columns) {\n const partialCards = window.customUI.getElementHierarchy(document, [\n 'home-assistant',\n 'home-assistant-main',\n 'partial-cards']);\n if (partialCards === null) {\n // DOM not ready. Wait 1 second.\n window.setTimeout(\n window.customUI.controlColumns.bind(null, columns),\n 1000);\n return;\n }\n // Function renamed from handleWindowChange to _updateColumns on 3.7.18\n const f = partialCards.handleWindowChange || partialCards._updateColumns;\n partialCards.mqls.forEach((mql) => {\n mql.removeListener(f);\n });\n partialCards.mqls = columns.map((width) => {\n const mql = window.matchMedia(`(min-width: ${width}px)`);\n mql.addListener(f);\n return mql;\n });\n f();\n },\n\n useCustomizer() {\n const main = window.customUI.lightOrShadow(document, 'home-assistant');\n const customizer = main.hass.states['customizer.customizer'];\n if (!customizer) return;\n if (customizer.attributes.columns) {\n window.customUI.controlColumns(customizer.attributes.columns);\n }\n if (customizer.attributes.hide_attributes) {\n if (window.hassAttributeUtil && window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES) {\n customizer.attributes.hide_attributes.forEach((attr) => {\n if (!Object.prototype.hasOwnProperty.call(\n window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES, attr)) {\n window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES[attr] = undefined;\n }\n });\n }\n }\n },\n\n updateConfigPanel() {\n if (!window.location.pathname.startsWith('/config')) return;\n const haPanelConfig = window.customUI.getElementHierarchy(document, [\n 'home-assistant',\n 'home-assistant-main',\n 'partial-panel-resolver',\n 'ha-panel-config']);\n if (!haPanelConfig) {\n // DOM not ready. Wait 100ms.\n window.setTimeout(window.customUI.updateConfigPanel, 100);\n return;\n }\n const haConfigNavigation = window.customUI.getElementHierarchy(haPanelConfig, [\n 'ha-config-dashboard',\n 'ha-config-navigation']);\n if (haConfigNavigation) {\n // HaConfigNavigation started using localize on 21.01.2018\n if (haConfigNavigation.localize && !haConfigNavigation.cuiPatch) {\n haConfigNavigation.cuiPatch = true;\n haConfigNavigation._originalComputeLoaded = haConfigNavigation._computeLoaded;\n haConfigNavigation._originalComputeCaption = haConfigNavigation._computeCaption;\n haConfigNavigation._originalComputeDescription = haConfigNavigation._computeDescription;\n haConfigNavigation._computeLoaded = (hass, page) =>\n page === 'customui' || haConfigNavigation._originalComputeLoaded(hass, page);\n haConfigNavigation._computeCaption = (page, localize) =>\n (page === 'customui' ? 'Custom UI' : haConfigNavigation._originalComputeCaption(page, localize));\n haConfigNavigation._computeDescription = (page, localize) =>\n (page === 'customui' ? 'SetUI tweaks' : haConfigNavigation._originalComputeDescription(page, localize));\n }\n if (!haConfigNavigation.pages.some(conf => conf === 'customui' || conf.domain === 'customui')) {\n haConfigNavigation.push('pages', haConfigNavigation.localize ? 'customui' : {\n domain: 'customui',\n caption: 'Custom UI',\n description: 'Set UI tweaks.',\n loaded: true,\n });\n }\n }\n const getHaConfigCustomUi = () => {\n const haConfigCustomUi = document.createElement('ha-config-custom-ui');\n haConfigCustomUi.isWide = haPanelConfig.isWide;\n haConfigCustomUi.setAttribute('page-name', 'customui');\n return haConfigCustomUi;\n };\n\n const ironPages = window.customUI.lightOrShadow(haPanelConfig, 'iron-pages');\n if (ironPages) {\n if (ironPages.lastElementChild.tagName !== 'HA-CONFIG-CUSTOM-UI') {\n const haConfigCustomUi = getHaConfigCustomUi();\n ironPages.appendChild(haConfigCustomUi);\n ironPages.addEventListener('iron-items-changed', () => {\n if (window.location.pathname.startsWith('/config/customui')) {\n ironPages.select('customui');\n }\n });\n }\n } else if (haPanelConfig.shadowRoot) {\n const root = haPanelConfig.shadowRoot || haPanelConfig;\n if (root.lastElementChild.tagName !== 'HA-CONFIG-CUSTOM-UI') {\n const haConfigCustomUi = getHaConfigCustomUi();\n root.appendChild(haConfigCustomUi);\n }\n const visible = window.location.pathname.startsWith('/config/customui');\n root.lastElementChild.style.display = visible ? '' : 'none';\n } else if (haPanelConfig.routerOptions && haPanelConfig.routerOptions.routes) {\n if (!haPanelConfig.routerOptions.routes.customui) {\n haPanelConfig.routerOptions.routes.customui = {\n tag: 'ha-config-custom-ui',\n load: () => Promise.resolve(),\n };\n // CustomUI panel is the entrypoint, so we need to reload the page.\n if (window.location.pathname.startsWith('/config/customui')) {\n haPanelConfig.update(new Map([['route', undefined]]));\n }\n }\n }\n },\n\n installStatesHook() {\n customElements.whenDefined('home-assistant').then(() => {\n const homeAssistant = customElements.get('home-assistant');\n if (!homeAssistant || !homeAssistant.prototype._updateHass) return;\n const originalUpdate = homeAssistant.prototype._updateHass;\n homeAssistant.prototype._updateHass = function update(obj) {\n // Use named function to preserve 'this'.\n const { hass } = this;\n if (obj.states) {\n Object.keys(obj.states).forEach((key) => {\n const entity = obj.states[key];\n if (entity._cui_keep) return;\n const newEntity = window.customUI.maybeApplyTemplates(hass, obj.states, entity);\n if (hass.states && entity !== hass.states[key]) {\n // New state arrived. Put modified state in.\n obj.states[key] = newEntity;\n } else if (entity !== newEntity) {\n // It's the same state but contents changed due to other state changes.\n obj.states[key] = newEntity;\n }\n });\n }\n originalUpdate.call(this, obj);\n if (obj.themes && hass._themeWaiters) {\n hass._themeWaiters.forEach(waiter => waiter.stateChanged(waiter.state));\n hass._themeWaiters = undefined;\n }\n };\n const main = window.customUI.lightOrShadow(document, 'home-assistant');\n if (main.hass && main.hass.states) {\n main._updateHass({ states: main.hass.states });\n }\n });\n },\n\n installPartialCards() {\n customElements.whenDefined('partial-cards').then(() => {\n const partialCards = customElements.get('partial-cards');\n if (!partialCards || !partialCards.prototype._defaultViewFilter) return;\n partialCards.prototype._defaultViewFilter = (hass, entityId) => {\n if (hass.states[entityId].attributes.hidden) return false;\n const excludes = {};\n Object.values(hass.states).forEach((entity) => {\n if (entity.attributes && entity.attributes.hide_in_default_view) {\n const excludeEntityId = entity.entity_id;\n if (excludes[excludeEntityId]) return;\n excludes[excludeEntityId] = entity;\n if (entity.attributes.view) {\n const viewEntities = getViewEntities(hass.states, entity);\n Object.keys(viewEntities)\n .filter(\n id => viewEntities[id].attributes.hide_in_default_view !== false)\n .forEach((id) => {\n excludes[id] = viewEntities[id];\n });\n }\n }\n });\n return !excludes[entityId];\n };\n });\n },\n\n // Allows changing the 'Execute' / 'Activate' text on script/scene cards.\n installActionName(elementName) {\n customElements.whenDefined(elementName).then(() => {\n const klass = customElements.get(elementName);\n if (!klass || !klass.prototype) return;\n Object.defineProperty(klass.prototype, 'localize', {\n get() {\n function customLocalize(v) {\n if (this.stateObj && this.stateObj.attributes &&\n this.stateObj.attributes.action_name) {\n return this.stateObj.attributes.action_name;\n }\n return this.__data.localize(v);\n }\n return customLocalize;\n },\n set() {},\n });\n });\n },\n\n // Allows theming \"regular\" top badges.\n installHaStateLabelBadge() {\n customElements.whenDefined('ha-state-label-badge').then(() => {\n const haStateLabelBadge = customElements.get('ha-state-label-badge');\n if (!haStateLabelBadge || !haStateLabelBadge.prototype.stateChanged) return;\n // Use named function to preserve 'this'.\n haStateLabelBadge.prototype.stateChanged = function update(stateObj) {\n // TODO: Call window.customUI.maybeChangeObject\n if (stateObj.attributes.theme) {\n if (this.hass.themes === null) {\n this.hass._themeWaiters = this.hass._themeWaiters || [];\n this.hass._themeWaiters.push(this);\n } else {\n applyThemesOnElement(\n this,\n this.hass.themes || { default_theme: 'default', themes: {} },\n stateObj.attributes.theme || 'default');\n }\n }\n this.updateStyles();\n if (this.startInterval) {\n // Added on 19.1.2018\n this.startInterval(stateObj);\n }\n };\n });\n },\n\n installStateBadge() {\n customElements.whenDefined('state-badge').then(() => {\n const stateBadge = customElements.get('state-badge');\n if (!stateBadge) return;\n if (stateBadge.prototype._updateIconAppearance) {\n const originalUpdateIconAppearance = stateBadge.prototype._updateIconAppearance;\n // Use named function to preserve 'this'.\n stateBadge.prototype._updateIconAppearance = function customUpdateIconAppearance(stateObj) {\n if (stateObj.attributes.icon_color && !stateObj.attributes.entity_picture) {\n this.style.backgroundImage = '';\n Object.assign(this.$.icon.style, {\n color: stateObj.attributes.icon_color,\n filter: '',\n });\n } else {\n originalUpdateIconAppearance.call(this, stateObj);\n }\n };\n } else if (stateBadge.prototype.updated) {\n const originalUpdated = stateBadge.prototype.updated;\n // Use named function to preserve 'this'.\n stateBadge.prototype.updated = function customUpdated(changedProps) {\n if (!changedProps.has('stateObj')) return;\n const { stateObj } = this;\n if (stateObj.attributes.icon_color && !stateObj.attributes.entity_picture) {\n this.style.backgroundImage = '';\n Object.assign(this._icon.style, {\n color: stateObj.attributes.icon_color,\n filter: '',\n });\n } else {\n originalUpdated.call(this, changedProps);\n }\n };\n }\n });\n },\n\n installHaAttributes() {\n customElements.whenDefined('ha-attributes').then(() => {\n const haAttributes = customElements.get('ha-attributes');\n if (!haAttributes || !haAttributes.prototype.computeFiltersArray ||\n !window.hassAttributeUtil) return;\n // Use named function to preserve 'this'.\n haAttributes.prototype.computeFiltersArray =\n function customComputeFiltersArray(extraFilters) {\n return Object.keys(window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES).concat(\n extraFilters ? extraFilters.split(',') : []);\n };\n });\n },\n\n installHaFormCustomize() {\n if (!window.location.pathname.startsWith('/config')) return;\n customElements.whenDefined('ha-form-customize').then(() => {\n const haFormCustomize = customElements.get('ha-form-customize');\n if (!haFormCustomize) {\n // DOM not ready. Wait 100ms.\n window.setTimeout(window.customUI.installHaFormCustomize, 100);\n return;\n }\n if (window.customUI.haFormCustomizeInitDone) return;\n window.customUI.haFormCustomizeInitDone = true;\n\n if (!window.hassAttributeUtil) return;\n if (haFormCustomize.prototype._computeSingleAttribute) {\n // Use named function to preserve 'this'.\n haFormCustomize.prototype._computeSingleAttribute =\n function customComputeSingleAttribute(key, value, secondary) {\n const config = window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES[key]\n || { type: window.hassAttributeUtil.UNKNOWN_TYPE };\n return this._initOpenObject(key, config.type === 'json' ? JSON.stringify(value) : value, secondary, config);\n };\n }\n if (haFormCustomize.prototype.getNewAttributesOptions) {\n // Use named function to preserve 'this'.\n haFormCustomize.prototype.getNewAttributesOptions =\n function customgetNewAttributesOptions(\n localAttributes, globalAttributes, existingAttributes, newAttributes) {\n const knownKeys =\n Object.keys(window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES)\n .filter((key) => {\n const conf = window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES[key];\n return conf && (!conf.domains || !this.entity ||\n conf.domains.includes(computeStateDomain(this.entity)));\n })\n .filter(this.filterFromAttributes(localAttributes))\n .filter(this.filterFromAttributes(globalAttributes))\n .filter(this.filterFromAttributes(existingAttributes))\n .filter(this.filterFromAttributes(newAttributes));\n return knownKeys.sort().concat('Other');\n };\n }\n });\n },\n\n installClassHooks() {\n if (window.customUI.classInitDone) return;\n window.customUI.classInitDone = true;\n window.customUI.installPartialCards();\n window.customUI.installStatesHook();\n window.customUI.installHaStateLabelBadge();\n window.customUI.installStateBadge();\n window.customUI.installHaAttributes();\n window.customUI.installActionName('state-card-scene');\n window.customUI.installActionName('state-card-script');\n },\n\n init() {\n if (window.customUI.initDone) return;\n window.customUI.installClassHooks();\n const main = window.customUI.lightOrShadow(document, 'home-assistant');\n if (!main.hass || !main.hass.states) {\n // Connection wasn't made yet. Try in 1 second.\n window.setTimeout(window.customUI.init, 1000);\n return;\n }\n window.customUI.initDone = true;\n\n window.customUI.useCustomizer();\n\n window.customUI.runHooks();\n window.addEventListener('location-changed', window.setTimeout.bind(null, window.customUI.runHooks, 100));\n /* eslint-disable no-console */\n console.log(`Loaded CustomUI ${VERSION}`);\n /* eslint-enable no-console */\n if (!window.CUSTOM_UI_LIST) {\n window.CUSTOM_UI_LIST = [];\n }\n window.CUSTOM_UI_LIST.push({\n name: 'CustomUI',\n version: VERSION,\n url: 'https://github.com/andrey-git/home-assistant-custom-ui',\n });\n },\n\n runHooks() {\n window.customUI.fixGroupTitles();\n window.customUI.updateConfigPanel();\n window.customUI.installHaFormCustomize();\n },\n\n getName() {\n return window.localStorage.getItem('ha-device-name') || '';\n },\n\n setName(name) {\n window.localStorage.setItem('ha-device-name', name || '');\n },\n\n computeTemplate(template, hass, entities, entity, attributes, attribute, state) {\n const functionBody = (template.indexOf('return') >= 0) ? template : `return \\`${template}\\`;`;\n try {\n /* eslint-disable no-new-func */\n const func = new Function(\n 'hass', 'entities', 'entity', 'attributes', 'attribute', 'state', functionBody);\n /* eslint-enable no-new-func */\n return func(hass, entities, entity, attributes, attribute, state);\n } catch (e) {\n /* eslint-disable no-console */\n if ((e instanceof SyntaxError) || e instanceof ReferenceError) {\n console.warn(`${e.name}: ${e.message} in template ${functionBody}`);\n return null;\n }\n /* eslint-enable no-console */\n throw e;\n }\n },\n};\nwindow.customUI.init();\n","import { HassEntities } from \"home-assistant-js-websocket\";\nimport computeDomain from \"./compute_domain\";\nimport getGroupEntities from \"./get_group_entities\";\nimport { GroupEntity } from \"../../types\";\n\n// Return an object containing all entities that the view will show\n// including embedded groups.\nexport default function getViewEntities(\n entities: HassEntities,\n view: GroupEntity\n): HassEntities {\n const viewEntities = {};\n\n view.attributes.entity_id.forEach((entityId) => {\n const entity = entities[entityId];\n\n if (entity && !entity.attributes.hidden) {\n viewEntities[entity.entity_id] = entity;\n\n if (computeDomain(entity.entity_id) === \"group\") {\n const groupEntities = getGroupEntities(entities, entity as GroupEntity);\n\n Object.keys(groupEntities).forEach((grEntityId) => {\n const grEntity = groupEntities[grEntityId];\n\n if (!grEntity.attributes.hidden) {\n viewEntities[grEntityId] = grEntity;\n }\n });\n }\n }\n });\n\n return viewEntities;\n}\n","import { HassEntities } from \"home-assistant-js-websocket\";\nimport { GroupEntity } from \"../../types\";\n\nexport default function getGroupEntities(\n entities: HassEntities,\n group: GroupEntity\n) {\n const result = {};\n\n group.attributes.entity_id.forEach((entityId) => {\n const entity = entities[entityId];\n\n if (entity) {\n result[entity.entity_id] = entity;\n }\n });\n\n return result;\n}\n","export default '20190324';\n","import '../utils/hooks.js';\n\n/**\n * @extends HTMLElement\n */\nclass CuiBaseElement extends Polymer.Element {\n static get properties() {\n return {\n hass: Object,\n inDialog: {\n type: Boolean,\n value: false,\n },\n stateObj: Object,\n controlElement: String,\n extra: {\n type: Array,\n computed: 'computeExtra(hass, stateObj)',\n },\n };\n }\n\n computeExtra(hass, stateObj) {\n let extras = stateObj.attributes.extra_data_template;\n if (extras) {\n if (!Array.isArray(extras)) {\n extras = [extras];\n }\n return extras.map(extra => window.customUI.computeTemplate(\n extra,\n hass,\n hass.states,\n stateObj,\n stateObj.attributes,\n /* attribute= */ undefined,\n stateObj.state,\n )).filter(result => result !== null);\n }\n return [];\n }\n\n showLastChanged(stateObj, inDialog, extra) {\n if (inDialog) return true;\n if (extra.length) return false;\n return !!stateObj.attributes.show_last_changed;\n }\n\n hasExtra(extra) {\n return extra.length > 0;\n }\n}\nexport default CuiBaseElement;\n","import dynamicContentUpdater from '../../home-assistant-polymer/src/common/dom/dynamic_content_updater.js';\n\n/**\n * @extends HTMLElement\n */\nclass DynamicElement extends Polymer.Element {\n static get properties() {\n return {\n hass: Object,\n stateObj: Object,\n elementName: String,\n\n inDialog: {\n type: Boolean,\n value: false,\n },\n };\n }\n\n static get observers() {\n return [\n 'observerFunc(hass, stateObj, elementName, inDialog)',\n ];\n }\n\n observerFunc(hass, stateObj, elementName, inDialog) {\n dynamicContentUpdater(\n this,\n elementName ? elementName.toUpperCase() : 'DIV',\n { hass, stateObj, inDialog });\n }\n}\ncustomElements.define('dynamic-element', DynamicElement);\n","import { html } from '@polymer/polymer/lib/utils/html-tag.js';\nimport applyThemesOnElement from '../../home-assistant-polymer/src/common/dom/apply_themes_on_element.js';\n\nimport './dynamic-element.js';\nimport '../utils/hooks.js';\n\ncustomElements.whenDefined('state-card-display').then(() => {\n /**\n * @extends HTMLElement\n */\n class DynamicWithExtra extends customElements.get('state-card-display') {\n static get template() {\n return html`\n <style is=\"custom-style\" include=\"iron-flex iron-flex-alignment iron-flex-factors\"></style>\n <style>\n :host {\n display: inline-block;\n }\n .control-wrapper {\n margin: -4px -16px -4px 0;\n padding: 4px 16px;\n }\n ha-state-label-badge {\n margin-left: 8px;\n }\n dynamic-element {\n display: block;\n text-align: right;\n }\n #overlay {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n text-align: right;\n z-index: 1;\n }\n #lock {\n margin-top: 8px;\n opacity: 0.3;\n margin-right: 7px;\n }\n #lock.ha-cover-controls {\n margin-right: 52px;\n background-color: white;\n }\n .extra {\n margin-bottom: -16px;\n --ha-label-badge-size: 36px;\n --ha-label-badge-font-size: 1.2em;\n }\n .state {\n @apply --paper-font-body1;\n color: var(--primary-text-color);\n margin-left: 16px;\n text-align: right;\n line-height: 40px;\n }\n </style>\n <div class$='[[extraClass(extraObjVisible)]] horizontal layout'>\n <template is='dom-if' if='[[extraObjVisible]]'>\n <template is='dom-repeat'\n items='[[extraObj]]'\n on-dom-change='extraDomChanged'>\n <ha-state-label-badge hass='[[hass]]' state='[[item]]'></ha-state-label-badge>\n </template>\n </template>\n <template is='dom-if' if='[[_showControl(inDialog, stateObj)]]'>\n <template is='dom-if' if='[[controlElement]]'>\n <div class=\"control-wrapper\">\n <dynamic-element\n class='flex'\n state-obj=\"[[stateObj]]\"\n hass='[[hass]]'\n element-name='[[controlElement]]'>\n </dynamic-element>\n <template is='dom-if' if='[[isConfirmControls(stateObj)]]'>\n <div id=\"overlay\" on-click='clickHandler'>\n <template is='dom-if' if='[[stateObj.attributes.confirm_controls_show_lock]]'>\n <iron-icon id=\"lock\" class$=\"[[controlElement]]\" icon=\"mdi:lock-outline\"></iron-icon>\n </template>\n </div>\n </template>\n </div>\n </template>\n <template is='dom-if' if='[[!controlElement]]'>\n <div class='state'>[[computeStateDisplay(stateObj)]]</div>\n </template>\n </template>\n </div>\n `;\n }\n\n static get properties() {\n return {\n hass: Object,\n inDialog: {\n type: Boolean,\n value: false,\n },\n stateObj: Object,\n controlElement: String,\n extraObj: {\n type: Array,\n computed: 'computeExtra(hass, stateObj, _attached)',\n },\n _attached: Boolean,\n extraObjVisible: {\n type: Boolean,\n computed: 'computeExtraVisible(extraObj, inDialog)',\n },\n };\n }\n\n connectedCallback() {\n super.connectedCallback();\n this._attached = true;\n }\n\n disconnectedCallback() {\n this._isAttached = false;\n super.disconnectedCallback();\n }\n\n computeExtra(hass, stateObj, attached) {\n if (!stateObj.attributes.extra_badge || !attached) return [];\n let extraBadges = stateObj.attributes.extra_badge;\n if (!Array.isArray(extraBadges)) {\n extraBadges = [extraBadges];\n }\n return extraBadges.map((extraBadge) => {\n let result = null;\n if (extraBadge.entity_id && hass.states[extraBadge.entity_id]) {\n result = Object.assign({}, window.customUI.maybeChangeObject(\n this, hass.states[extraBadge.entity_id], this.inDialog,\n /* allowHidden= */false));\n } else if (extraBadge.attribute &&\n stateObj.attributes[extraBadge.attribute] !== undefined) {\n result = {\n state: String(stateObj.attributes[extraBadge.attribute]),\n entity_id: 'none.none',\n attributes: { unit_of_measurement: extraBadge.unit },\n };\n }\n if (!result) return null;\n let blacklist = extraBadge.blacklist_states;\n if (blacklist !== undefined) {\n if (!Array.isArray(blacklist)) {\n blacklist = [blacklist];\n }\n if (blacklist.some(v => RegExp(v).test(result.state.toString()))) {\n return null;\n }\n }\n result._entityDisplay = '';\n result.attributes = Object.assign({}, { friendly_name: '' });\n return result;\n }).filter(extraBadge => extraBadge != null);\n }\n\n computeExtraVisible(extraObj, inDialog) {\n if (inDialog || !extraObj) return false;\n return extraObj.length !== 0;\n }\n\n extraClass(extraObjVisible) {\n return extraObjVisible ? 'extra' : '';\n }\n\n _showControl(inDialog, stateObj) {\n if (inDialog) return true;\n return !stateObj.attributes.hide_control;\n }\n\n computeStateDisplay(stateObj) {\n // haLocalize removed in 0.61\n return super.computeStateDisplay(this.haLocalize || this.localize, stateObj);\n }\n\n isConfirmControls(stateObj) {\n return stateObj.attributes.confirm_controls ||\n stateObj.attributes.confirm_controls_show_lock;\n }\n\n clickHandler(e) {\n this.root.querySelector('#overlay').style.pointerEvents = 'none';\n const lock = this.root.querySelector('#lock');\n if (lock) {\n lock.icon = 'mdi:lock-open-outline';\n lock.style.opacity = '0.1';\n }\n window.setTimeout(() => {\n this.root.querySelector('#overlay').style.pointerEvents = '';\n if (lock) {\n lock.icon = 'mdi:lock-outline';\n lock.style.opacity = '';\n }\n }, 5000);\n e.stopPropagation();\n }\n\n applyThemes(hass, element, stateObj) {\n const themeName = stateObj.attributes.theme || 'default';\n applyThemesOnElement(\n element, hass.themes || { default_theme: 'default', themes: {} }, themeName);\n }\n\n extraDomChanged() {\n this.root.querySelectorAll('ha-state-label-badge')\n .forEach((elem) => {\n this.applyThemes(this.hass, elem, elem.state);\n });\n }\n }\n customElements.define('dynamic-with-extra', DynamicWithExtra);\n});\n","import { html } from '@polymer/polymer/lib/utils/html-tag.js';\n\n/**\n * @extends HTMLElement\n */\nclass HaThemedSlider extends Polymer.Element {\n static get template() {\n return html`\n <style>\n :host {\n margin: var(--ha-themed-slider-margin, initial);\n }\n .disable-off-when-min {\n --paper-slider-pin-start-color: var(--paper-slider-pin-color);\n }\n\n .disable-off-when-min.is-on {\n --paper-slider-knob-start-color: var(--paper-slider-knob-color);\n --paper-slider-knob-start-border-color: var(--paper-slider-knob-color);\n }\n paper-slider {\n margin: 4px 0;\n max-width: 100%;\n min-width: 100px;\n width: var(--ha-paper-slider-width, 200px);\n }\n </style>\n\n <paper-slider\n min='[[_themedMin]]'\n max='[[_computeAttribute(theme, \"max\", max)]]'\n pin='[[_computeAttribute(theme, \"pin\", pin)]]'\n class$='[[computeClass(theme, isOn, _themedMin)]]' value='[[value]]'\n on-change='valueChanged'>\n </paper-slider>\n `;\n }\n\n ready() {\n super.ready();\n this.disableOffWhenMin = !this._computeAttribute(this.theme, 'off_when_min', !this.disableOffWhenMin);\n this.computeEnabledThemedReportWhenNotChanged(this.theme, this.disableReportWhenNotChanged);\n }\n\n static get properties() {\n return {\n min: {\n type: Number,\n value: 0,\n },\n max: {\n type: Number,\n value: 100,\n },\n pin: {\n type: Boolean,\n value: false,\n },\n isOn: {\n type: Boolean,\n value: false,\n },\n disableOffWhenMin: {\n type: Boolean,\n value: false,\n notify: true,\n },\n disableReportWhenNotChanged: {\n type: Boolean,\n value: false,\n },\n\n theme: Object,\n value: {\n type: Number,\n notify: true,\n },\n _themedMin: {\n type: Number,\n computed: '_computeAttribute(theme, \"min\", min)',\n },\n };\n }\n\n static get observers() {\n return [\n 'computeEnabledThemedReportWhenNotChanged(theme, disableReportWhenNotChanged)',\n ];\n }\n\n computeEnabledThemedReportWhenNotChanged(theme, disableReportWhenNotChanged) {\n this._enabledThemedReportWhenNotChanged = this._computeAttribute(\n theme, 'report_when_not_changed', !disableReportWhenNotChanged);\n }\n\n _computeAttribute(theme, attr, def) {\n if (theme) {\n if (attr in theme) {\n return theme[attr];\n }\n }\n return def;\n }\n\n computeClass(theme, isOn, themedMin) {\n let result = '';\n if (isOn) {\n result += 'is-on ';\n }\n if (this._computeAttribute(theme, 'off_when_min', !this.disableOffWhenMin) || themedMin === 0) {\n // If offWhenMin is enabled don't customize.\n return '';\n }\n return `${result}disable-off-when-min`;\n }\n\n valueChanged(ev) {\n if (!this._enabledThemedReportWhenNotChanged && this.value === ev.target.value) {\n ev.stopPropagation();\n return;\n }\n this.value = ev.target.value;\n }\n}\ncustomElements.define('ha-themed-slider', HaThemedSlider);\n","import { html } from '@polymer/polymer/lib/utils/html-tag.js';\nimport CuiBaseElement from './cui-base-element.js';\nimport './dynamic-with-extra.js';\nimport './ha-themed-slider.js';\n\n/**\n * @extends HTMLElement\n */\nclass StateCardWithSlider extends CuiBaseElement {\n static get template() {\n return html`\n <style is=\"custom-style\" include=\"iron-flex iron-flex-alignment iron-flex-factors\"></style>\n <style>\n #container {\n position: relative;\n }\n .second-line, .state-and-toggle, .state-info {\n max-width: 100%;\n }\n .nowrap .state-and-toggle {\n overflow: hidden;\n flex-grow: 0;\n }\n .nowrap .second-line {\n overflow: hidden;\n }\n\n .second-line {\n padding-top: 20px;\n padding-bottom: 16px;\n margin-top: -20px;\n margin-bottom: -16px;\n }\n .stretch .second-line, .stretch ha-themed-slider {\n width: 100%;\n --ha-paper-slider-width: 100%;\n }\n .nowrap .state-info {\n min-width: initial;\n }\n ha-themed-slider, .top-wrapper {\n min-width: 100px;\n max-width: 100%;\n }\n .top-wrapper.stretch {\n display: block;\n }\n\n .hidden {\n display: none;\n }\n </style>\n\n <div id='container' class$='horizontal layout flex top-wrapper [[_computeWrapClass(mode, stretchSlider, lineTooLong, inDialog)]]'>\n <div class='horizontal layout justified flex-auto state-and-toggle'>\n <state-info\n class='state-info flex-auto'\n hass='[[hass]]'\n state-obj='[[stateObj]]'\n in-dialog='[[showLastChanged(stateObj, inDialog, extra)]]'\n secondary-line$='[[hasExtra(extra)]]'\n >\n <template is='dom-repeat' items='[[extra]]'>\n <div>[[item]]</div>\n </template>\n </state-info>\n <template is='dom-if' if='[[breakSlider]]' class='hidden'>\n <dynamic-with-extra hass='[[hass]]' state-obj='[[stateObj]]' control-element='[[controlElement]]' in-dialog='[[inDialog]]'></dynamic-with-extra>\n </template>\n </div>\n <template is='dom-if' if='[[showSlider]]' restamp>\n <div class='horizontal layout flex-auto end-justified second-line'>\n <ha-themed-slider\n id='slider'\n max=[[max]]\n min=[[min]]\n theme='[[stateObj.attributes.slider_theme]]'\n is-on='[[isOn(stateObj, nameOn)]]'\n value='{{sliderValue}}'\n disable-off-when-min='{{disableOffWhenMin}}'\n on-change='sliderChanged'\n on-click='stopPropagation'>\n </ha-themed-slider>\n <template is='dom-if' if='[[!breakSlider]]'>\n <dynamic-with-extra hass='[[hass]]' state-obj='[[stateObj]]' control-element='[[controlElement]]' in-dialog='[[inDialog]]'></dynamic-with-extra>\n </template>\n </div>\n </template>\n </div>\n `;\n }\n\n static get properties() {\n return {\n domain: String,\n serviceMin: String,\n serviceMax: String,\n valueName: String,\n setValueName: String,\n nameOn: { type: String, value: 'on' },\n min: { type: Number, value: 0 },\n max: { type: Number, value: 255 },\n\n sliderValue: {\n type: Number,\n value: 0,\n },\n disableOffWhenMin: Boolean,\n mode: String,\n stretchSlider: {\n type: Boolean,\n value: false,\n },\n breakSlider: {\n type: Boolean,\n value: false,\n },\n hideSlider: {\n type: Boolean,\n value: false,\n },\n lineTooLong: {\n type: Boolean,\n value: false,\n },\n minLineBreak: Number,\n maxLineBreak: Number,\n showSlider: {\n type: Number,\n computed: '_showSlider(inDialog, stateObj, hideSlider)',\n },\n };\n }\n\n ready() {\n super.ready();\n this._onIronResize = this._onIronResize.bind(this);\n }\n\n connectedCallback() {\n super.connectedCallback();\n this._isConnected = true;\n window.addEventListener('resize', this._onIronResize);\n this._waitForLayout();\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this._onIronResize);\n this._isConnected = false;\n super.disconnectedCallback();\n }\n\n static get observers() {\n return [\n 'stateObjChanged(stateObj, nameOn, valueName)',\n ];\n }\n\n _waitForLayout() {\n if (!this._isConnected) return;\n this._setMode();\n if (this._frameId) return;\n this.readyToCompute = false;\n this._frameId = window.requestAnimationFrame(() => {\n this._frameId = null;\n this.readyToCompute = true;\n this._onIronResize();\n });\n }\n\n _setMode() {\n const obj = {\n hideSlider: this.mode === 'hide-slider' && this.lineTooLong,\n breakSlider:\n (this.mode === 'break-slider' || this.mode === 'hide-slider') &&\n this.lineTooLong,\n };\n if (!this.showSlider) {\n obj.breakSlider = true;\n }\n this.setProperties(obj);\n }\n\n _onIronResize() {\n if (!this.readyToCompute) return;\n if (this.mode === 'no-slider') {\n this.setProperties({\n hideSlider: true,\n breakSlider: true,\n });\n return;\n }\n const prevBreakSlider = this.breakSlider;\n const prevHideSlider = this.hideSlider;\n this.setProperties({\n lineTooLong: false,\n hideSlider: false,\n breakSlider: false,\n });\n const { container } = this.$;\n const containerWidth = container.clientWidth;\n if (containerWidth === 0) return;\n if (containerWidth <= this.minLineBreak) {\n this.lineTooLong = true;\n } else if (containerWidth >= this.maxLineBreak) {\n this.lineTooLong = false;\n } else {\n if (prevHideSlider && this.mode === 'hide-slider') {\n // We need to unhide the slider in order to recalculate height.\n this._waitForLayout();\n return;\n }\n const containerHeight = container.clientHeight;\n const stateHeight = this.root.querySelector('.state-info').clientHeight;\n this.lineTooLong = containerHeight > stateHeight * 1.5;\n if (this.lineTooLong) {\n this.minLineBreak = containerWidth;\n } else if (!prevBreakSlider) {\n this.maxLineBreak = containerWidth;\n }\n }\n this._setMode();\n }\n\n _computeWrapClass(mode, stretchSlider, lineTooLong, inDialog) {\n if (inDialog) {\n return '';\n }\n if (mode === 'single-line') {\n return 'nowrap';\n }\n if (stretchSlider && lineTooLong) {\n return 'stretch wrap';\n }\n return 'wrap';\n }\n\n _showSlider(inDialog, stateObj, hideSlider) {\n if (inDialog || hideSlider) {\n return false;\n }\n return true;\n }\n\n sliderChanged(ev) {\n const value = parseInt(ev.target.value, 10);\n const param = { entity_id: this.stateObj.entity_id };\n if (Number.isNaN(value)) return;\n let target = this.root.querySelector('#slider');\n if (ev.target !== target) {\n // No Shadow DOM - we have access to original target.\n ({ target } = ev);\n } else if (ev.path) {\n [target] = ev.path;\n } else if (ev.composedPath) {\n [target] = ev.composedPath();\n }\n if (value === 0 || (value <= target.min && !this.disableOffWhenMin)) {\n this.hass.callService(this.domain, this.serviceMin, param);\n } else {\n param[this.setValueName || this.valueName] = value;\n this.hass.callService(this.domain, this.serviceMax, param);\n }\n }\n\n stateObjChanged(stateObj, nameOn, valueName) {\n const obj = {\n sliderValue: this.isOn(stateObj, nameOn) ? stateObj.attributes[valueName] : 0,\n };\n if (stateObj) {\n Object.assign(obj, {\n minLineBreak: 0,\n maxLineBreak: 999,\n hideSlider: false,\n breakSlider: false,\n lineTooLong: false,\n mode: stateObj.attributes.state_card_mode,\n stretchSlider: !!stateObj.attributes.stretch_slider,\n });\n }\n this.setProperties(obj);\n if (stateObj) {\n this._waitForLayout();\n }\n }\n\n isOn(stateObj, nameOn) {\n return stateObj && (!nameOn || stateObj.state === nameOn);\n }\n\n stopPropagation(ev) {\n ev.stopPropagation();\n }\n}\ncustomElements.define('state-card-with-slider', StateCardWithSlider);\n","import { html } from '@polymer/polymer/lib/utils/html-tag.js';\nimport CuiBaseElement from './cui-base-element.js';\nimport './dynamic-with-extra.js';\n\n/**\n * @extends HTMLElement\n */\nclass StateCardWithoutSlider extends CuiBaseElement {\n static get template() {\n return html`\n <style is=\"custom-style\" include=\"iron-flex iron-flex-alignment\"></style>\n <style>\n #container {\n position: relative;\n }\n </style>\n\n <div id='container' class='horizontal layout justified'>\n <state-info\n hass='[[hass]]'\n class='state-info'\n state-obj='[[stateObj]]'\n in-dialog='[[showLastChanged(stateObj, inDialog, extra)]]'\n secondary-line$='[[hasExtra(extra)]]'>\n <template is='dom-repeat' items='[[extra]]'>\n <div>[[item]]</div>\n </template>\n </state-info>\n <dynamic-with-extra\n hass='[[hass]]'\n state-obj='[[stateObj]]'\n control-element='[[controlElement]]'\n in-dialog='[[inDialog]]'>\n </dynamic-with-extra>\n </div>\n `;\n }\n}\ncustomElements.define('state-card-without-slider', StateCardWithoutSlider);\n","import applyThemesOnElement from '../../home-assistant-polymer/src/common/dom/apply_themes_on_element.js';\nimport computeStateDomain from '../../home-assistant-polymer/src/common/entity/compute_state_domain.ts';\nimport dynamicContentUpdater from '../../home-assistant-polymer/src/common/dom/dynamic_content_updater.js';\nimport stateCardType from '../../home-assistant-polymer/src/common/entity/state_card_type.ts';\n\nimport '../utils/hooks.js';\nimport './state-card-with-slider.js';\nimport './state-card-without-slider.js';\n\nconst SHOW_LAST_CHANGED_BLACKLISTED_CARDS = ['configurator'];\nconst DOMAIN_TO_SLIDER_SUPPORT = {\n light: 1, // SUPPORT_BRIGHTNESS\n cover: 4, // SUPPORT_SET_POSITION\n climate: 1, // SUPPORT_TARGET_TEMPERATURE\n};\nconst TYPE_TO_CONTROL = {\n toggle: 'ha-entity-toggle',\n display: '',\n cover: 'ha-cover-controls',\n};\n\n/**\n * @extends HTMLElement\n */\nclass StateCardCustomUi extends Polymer.Element {\n static get properties() {\n return {\n hass: Object,\n\n inDialog: {\n type: Boolean,\n value: false,\n },\n\n stateObj: Object,\n };\n }\n\n static get observers() {\n return [\n 'inputChanged(hass, inDialog, stateObj)',\n ];\n }\n\n connectedCallback() {\n super.connectedCallback();\n const container = this.parentNode.parentNode;\n if (container.tagName === 'DIV' &&\n (container.classList.contains('state') || container.classList.contains('child-card'))) {\n this._container = container;\n\n // Since this doesn't actually change the background - no need to clear it.\n container.style.setProperty(\n 'background-color', 'var(--paper-card-background-color, inherit)');\n\n // Polyfill 'updateStyles'.\n if (!container.updateStyles) {\n container.updateStyles = (styles) => {\n Object.keys(styles).forEach((key) => {\n container.style.setProperty(key, styles[key]);\n });\n };\n }\n }\n this._isAttached = true;\n this.inputChanged(this.hass, this.inDialog, this.stateObj);\n }\n\n disconnectedCallback() {\n this._isAttached = false;\n if (this._container) {\n this._container.updateStyles({ display: '', margin: '', padding: '' });\n applyThemesOnElement(\n this._container, this.hass.themes || { default_theme: 'default', themes: {} }, 'default');\n this._container = null;\n }\n super.disconnectedCallback();\n }\n\n badgeMode(hass, stateObj, domain) {\n const states = [];\n if (domain === 'group') {\n stateObj.attributes.entity_id.forEach((id) => {\n const state = hass.states[id];\n if (!state) {\n /* eslint-disable no-console */\n console.warn(`Unknown ID ${id} in group ${stateObj.entity_id}`);\n /* eslint-enable no-console */\n return;\n }\n if (!stateObj.attributes.badges_list ||\n stateObj.attributes.badges_list.includes(state.entity_id)) {\n states.push(window.customUI.maybeChangeObject(\n this, state, false /* inDialog */, false /* allowHidden */));\n }\n });\n } else {\n states.push(stateObj);\n if (this._container) {\n this._container.style.display = 'inline-block';\n const params = { display: 'inline-block' };\n if (this._container.classList.contains('state')) {\n params.margin = 'var(--ha-badges-card-margin, 0)';\n }\n this.updateStyles(params);\n }\n }\n dynamicContentUpdater(\n this,\n 'HA-BADGES-CARD',\n { hass, states });\n if (this._container) {\n this._container.updateStyles({\n width: 'var(--ha-badges-card-width, initial)',\n 'text-align': 'var(--ha-badges-card-text-align, initial)',\n });\n }\n this.lastChild.style.fontSize = '85%';\n\n // Since this variable only affects badges mode - no need to clean it up.\n this.style.setProperty('--ha-state-label-badge-margin-bottom', '0');\n }\n\n cleanBadgeStyle() {\n if (this._container) {\n this._container.updateStyles({\n display: '',\n width: '',\n 'text-align': '',\n });\n }\n this.updateStyles({ display: '', margin: '' });\n }\n\n applyThemes(hass, modifiedObj) {\n let themeTarget = this;\n let themeName = 'default';\n if (this._container) {\n themeTarget = this._container;\n }\n if (modifiedObj.attributes.theme) {\n themeName = modifiedObj.attributes.theme;\n }\n applyThemesOnElement(\n themeTarget, hass.themes || { default_theme: 'default', themes: {} }, themeName);\n }\n\n maybeHideEntity(modifiedObj) {\n if (!modifiedObj) {\n if (this.lastChild) {\n this.removeChild(this.lastChild);\n }\n if (this._container) {\n this._container.updateStyles({ margin: '0', padding: '0' });\n }\n return true;\n }\n if (this._container) {\n this._container.updateStyles({ margin: '', padding: '' });\n }\n return false;\n }\n\n sliderEligible_(domain, obj, inDialog) {\n if (inDialog) return false;\n return DOMAIN_TO_SLIDER_SUPPORT[domain] &&\n (DOMAIN_TO_SLIDER_SUPPORT[domain] & obj.attributes.supported_features) &&\n obj.attributes.state_card_mode && obj.attributes.state_card_mode !== 'no-slider';\n }\n\n inputChanged(hass, inDialog, stateObj) {\n if (!stateObj || !hass || !this._isAttached) return;\n const domain = computeStateDomain(stateObj);\n const modifiedObj = window.customUI.maybeChangeObject(\n this, stateObj, inDialog, true /* allowHidden */);\n\n if (this.maybeHideEntity(modifiedObj)) return;\n\n this.applyThemes(hass, modifiedObj);\n\n if (!inDialog && modifiedObj.attributes.state_card_mode === 'badges') {\n this.badgeMode(hass, modifiedObj, domain);\n } else {\n this.regularMode_(hass, inDialog, modifiedObj, domain);\n }\n }\n\n regularMode_(hass, inDialog, stateObj, domain) {\n this.cleanBadgeStyle();\n\n const params = {\n hass,\n stateObj,\n inDialog,\n };\n const originalStateCardType = stateCardType(hass, stateObj);\n let customStateCardType;\n const secondaryStateCardType = stateObj.attributes.state_card_custom_ui_secondary;\n\n if (domain === 'light' && this.sliderEligible_(domain, stateObj, inDialog)) {\n Object.assign(params, {\n controlElement: 'ha-entity-toggle',\n serviceMin: 'turn_off',\n serviceMax: 'turn_on',\n valueName: 'brightness',\n domain,\n });\n customStateCardType = 'state-card-with-slider';\n } else if (domain === 'cover' && this.sliderEligible_(domain, stateObj, inDialog)) {\n Object.assign(params, {\n controlElement: 'ha-cover-controls',\n max: 100,\n serviceMin: 'close_cover',\n serviceMax: 'set_cover_position',\n setValueName: 'position',\n valueName: 'current_position',\n nameOn: 'open',\n domain,\n });\n customStateCardType = 'state-card-with-slider';\n } else if (domain === 'climate' && this.sliderEligible_(domain, stateObj, inDialog)) {\n Object.assign(params, {\n controlElement: 'ha-climate-state',\n min: stateObj.attributes.min_temp || -100,\n max: stateObj.attributes.max_temp || 200,\n serviceMin: 'set_temperature',\n serviceMax: 'set_temperature',\n valueName: 'temperature',\n nameOn: '',\n domain,\n });\n customStateCardType = 'state-card-with-slider';\n } else if (TYPE_TO_CONTROL[originalStateCardType] !== undefined) {\n params.controlElement = TYPE_TO_CONTROL[originalStateCardType];\n customStateCardType = 'state-card-without-slider';\n } else if (stateObj.attributes.show_last_changed &&\n !SHOW_LAST_CHANGED_BLACKLISTED_CARDS.includes(originalStateCardType)) {\n params.inDialog = true;\n }\n if (stateObj.state === 'unavailable') {\n params.controlElement = '';\n }\n if (stateObj.attributes.control_element !== undefined) {\n params.controlElement = stateObj.attributes.control_element;\n }\n\n dynamicContentUpdater(\n this,\n (secondaryStateCardType || customStateCardType || `STATE-CARD-${originalStateCardType}`).toUpperCase(),\n params);\n }\n}\ncustomElements.define('state-card-custom-ui', StateCardCustomUi);\n","import { HassEntity } from \"home-assistant-js-websocket\";\nimport canToggleDomain from \"./can_toggle_domain\";\nimport computeStateDomain from \"./compute_state_domain\";\nimport { HomeAssistant } from \"../../types\";\nimport { supportsFeature } from \"./supports-feature\";\n\nexport default function canToggleState(\n hass: HomeAssistant,\n stateObj: HassEntity\n) {\n const domain = computeStateDomain(stateObj);\n if (domain === \"group\") {\n return stateObj.state === \"on\" || stateObj.state === \"off\";\n }\n if (domain === \"climate\") {\n return supportsFeature(stateObj, 4096);\n }\n\n return canToggleDomain(hass, domain);\n}\n","import { HomeAssistant } from \"../../types\";\n\nexport default function canToggleDomain(hass: HomeAssistant, domain: string) {\n const services = hass.services[domain];\n if (!services) {\n return false;\n }\n\n if (domain === \"lock\") {\n return \"lock\" in services;\n }\n if (domain === \"cover\") {\n return \"open_cover\" in services;\n }\n return \"turn_on\" in services;\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nwindow.JSCompiler_renameProperty = function(prop) { return prop; };\n"],"sourceRoot":""}