-
Notifications
You must be signed in to change notification settings - Fork 97
/
scripts.js.map
1 lines (1 loc) · 246 KB
/
scripts.js.map
1
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../home-assistant-polymer/src/common/dom/apply_themes_on_element.ts","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.ts","webpack:///../home-assistant-polymer/src/common/entity/supports-feature.ts","webpack:///../home-assistant-polymer/src/common/const.ts","webpack:///../src/lib/directive.ts","webpack:///../src/lib/dom.ts","webpack:///../src/lib/part.ts","webpack:///../src/lib/template.ts","webpack:///../src/lib/template-instance.ts","webpack:///../src/lib/template-result.ts","webpack:///../src/lib/parts.ts","webpack:///../src/lib/default-template-processor.ts","webpack:///../src/lib/template-factory.ts","webpack:///../src/lib/render.ts","webpack:///src/lit-html.ts","webpack:///../src/lib/modify-template.ts","webpack:///../src/lib/shady-render.ts","webpack:///../src/lib/updating-element.ts","webpack:///../src/lib/css-tag.ts","webpack:///src/lit-element.ts","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:///./node_modules/@polymer/polymer/lib/utils/html-tag.js","webpack:///./src/elements/cui-base-element.js","webpack:///./src/elements/dynamic-element.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/state_card_type.ts","webpack:///../home-assistant-polymer/src/common/entity/can_toggle_state.ts","webpack:///../home-assistant-polymer/src/common/entity/can_toggle_domain.ts","webpack:///./src/elements/dynamic-with-extra.js","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","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","directives","WeakMap","isDirective","has","isCEPolyfill","customElements","polyfillWrapFlushCallback","removeNodes","container","startNode","endNode","node","nextSibling","noChange","nothing","marker","String","Math","random","slice","nodeMarker","markerRegex","RegExp","boundAttributeSuffix","Template","[object Object]","result","this","parts","index","partIndex","nodesToRemove","_prepareTemplate","template","content","walker","createTreeWalker","lastPartIndex","nextNode","currentNode","nodeType","hasAttributes","count","length","stringForPart","strings","lastAttributeNameRegex","exec","attributeLookupName","split","push","type","removeAttribute","data","parent","lastIndex","insertBefore","createMarker","createTextNode","previousSibling","isTemplatePartActive","part","createComment","template_instance_TemplateInstance","processor","options","_parts","values","setValue","commit","fragment","cloneNode","importNode","nodeIndex","_prepareInstance","handleTextExpression","insertAfterNode","handleAttributeExpressions","nodeName","adoptNode","upgrade","template_result_TemplateResult","endIndex","html","match","innerHTML","getHTML","isPrimitive","AttributeCommitter","dirty","_createPart","parts_AttributePart","text","v","Array","isArray","Symbol","iterator","t","_getValue","comitter","committer","directive","parts_NodePart","_pendingValue","ref","_insert","_commitText","_commitTemplateResult","Node","_commitNode","_commitIterable","clear","templateFactory","update","instance","_clone","itemParts","itemPart","item","appendIntoPart","insertAfterPart","PropertyPart","eventOptionsSupported","capture","addEventListener","removeEventListener","_e","getOptions","passive","once","defaultTemplateProcessor","prefix","super","single","eventName","eventContext","_boundHandleEvent","e","handleEvent","newListener","oldListener","shouldRemoveListener","shouldAddListener","_options","event","Error","templateCache","templateCaches","stringsArray","keyString","Map","set","join","getTemplateElement","render_parts","litHtmlVersions","lit_html_html","walkerNodeFilter","removeNodesFromTemplate","nextActiveIndexInTemplateParts","removeCount","nodesToRemoveInTemplate","currentRemovingNode","countNodes","startIndex","getTemplateCacheKey","scopeName","compatibleShadyCSSVersion","prepareTemplateDom","console","warn","TEMPLATE_TYPES","shadyRenderSet","JSCompiler_renameProperty","prop","_obj","defaultConverter","Boolean","JSON","stringify","Number","parse","notEqual","old","defaultPropertyDeclaration","attribute","converter","reflect","hasChanged","microtaskPromise","Promise","resolve","STATE_HAS_UPDATED","STATE_UPDATE_REQUESTED","STATE_IS_REFLECTING_TO_ATTRIBUTE","STATE_IS_REFLECTING_TO_PROPERTY","STATE_HAS_CONNECTED","UpdatingElement","HTMLElement","_updateState","_instanceProperties","_updatePromise","_hasConnectedResolver","_changedProperties","_reflectingProperties","initialize","observedAttributes","finalize","_classProperties","attr","_attributeNameForProperty","_attributeToPropertyMap","superProperties","getPrototypeOf","k","_ensureClassProperties","noAccessor","oldValue","_requestUpdate","finalized","superCtor","props","properties","propKeys","getOwnPropertyNames","getOwnPropertySymbols","createProperty","fromAttribute","toAttribute","_saveInstanceProperties","constructor","_v","_attributeToProperty","ctor","attrValue","_propertyValueToAttribute","propName","_propertyValueFromAttribute","shouldRequestUpdate","_valueHasChanged","_hasRequestedUpdate","_enqueueUpdate","updateComplete","reject","previousUpdatePromise","res","rej","_hasConnected","performUpdate","hasUpdated","_applyInstanceProperties","shouldUpdate","changedProperties","_markUpdated","firstUpdated","updated","size","_propertyToAttribute","supportsAdoptingStyleSheets","Document","CSSStyleSheet","litElementVersions","flattenStyles","flat","Infinity","arrayFlat","lit_element_LitElement","_styles","_getUniqueStyles","userStyles","reduceRight","add","unshift","renderRoot","createRenderRoot","ShadowRoot","adoptStyles","attachShadow","mode","nativeShadow","adoptedStyleSheets","map","styleSheet","_needsShimAdoptedStyleSheets","ScopingShim","prepareAdoptedCssText","cssText","localName","connectedCallback","styleElement","templateResult","render","style","textContent","hasRendered","needsScoping","firstScopeRender","renderContainer","createDocumentFragment","firstChild","assign","appendInto","cacheKey","delete","renderedDOM","querySelectorAll","prepareTemplateStyles","condensedStyle","templates","from","refNode","insertCount","walkerIndex","removes","host","define","_backHandler","isWide","observer","attributeChangedCallback","oldval","newval","nameChanged","customUI","getName","setName","history","back","CustomEvent","dispatchEvent","hassAttributeUtil","binary_sensor","cover","sensor","switch","string","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","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","lightOrShadow","selector","shadowRoot","getElementHierarchy","hierarchy","shift","getContext","_context","groupEntity","states","reverse","findMatch","find","option","maybeChangeObjectByDevice","applyAttributes","maybeChangeObjectByGroup","context","_setKeep","obj","_cui_keep","maybeApplyTemplateAttributes","hass","newAttributes","hasGlobal","hasChanges","computeTemplate","untemplated_attributes","untemplated_state","untemplated_stateDisplay","maybeApplyTemplates","newResult","checkAttributes","last_changed","maybeChangeObject","inDialog","allowHidden","fixGroupTitles","homeAssistantMain","setTimeout","haCards","$","main","card","controlColumns","columns","partialCards","bind","f","handleWindowChange","_updateColumns","mqls","mql","removeListener","width","matchMedia","addListener","useCustomizer","customizer","hide_attributes","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","select","visible","display","routerOptions","routes","customui","tag","load","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","installHaStateLabelBadge","haStateLabelBadge","startInterval","installStateBadge","stateBadge","_updateIconAppearance","originalUpdateIconAppearance","backgroundImage","color","originalUpdated","changedProps","_icon","installHaAttributes","haAttributes","computeFiltersArray","extraFilters","installHaFormCustomize","haFormCustomize","haFormCustomizeInitDone","_computeSingleAttribute","secondary","config","_initOpenObject","getNewAttributesOptions","localAttributes","globalAttributes","existingAttributes","includes","filterFromAttributes","sort","installClassHooks","classInitDone","init","initDone","runHooks","log","CUSTOM_UI_LIST","version","url","localStorage","getItem","setItem","functionBody","Function","SyntaxError","ReferenceError","message","LiteralString","toString","html_tag_html","reduce","acc","idx","HTMLTemplateElement","literalValue","cui_base_element","superClass","controlElement","extra","computed","computeExtra","extras","showLastChanged","hasExtra","loadCustomUI","Polymer","Element","observers","observerFunc","toUpperCase","ha_themed_slider_loadCustomUI","ready","disableOffWhenMin","_computeAttribute","computeEnabledThemedReportWhenNotChanged","disableReportWhenNotChanged","slider","_keyBindings","min","max","pin","isOn","notify","_themedMin","_enabledThemedReportWhenNotChanged","def","computeClass","themedMin","valueChanged","ev","target","stopPropagation","state_card_with_slider_loadCustomUI","serviceMin","serviceMax","valueName","setValueName","nameOn","sliderValue","stretchSlider","breakSlider","hideSlider","lineTooLong","minLineBreak","maxLineBreak","showSlider","_onIronResize","_isConnected","_waitForLayout","disconnectedCallback","_setMode","_frameId","readyToCompute","requestAnimationFrame","prevBreakSlider","prevHideSlider","containerWidth","clientWidth","containerHeight","clientHeight","stateHeight","_computeWrapClass","_showSlider","sliderChanged","parseInt","param","isNaN","path","composedPath","callService","stateObjChanged","state_card_without_slider_loadCustomUI","state_card_custom_ui_loadCustomUI","SHOW_LAST_CHANGED_BLACKLISTED_CARDS","DOMAIN_TO_SLIDER_SUPPORT","TYPE_TO_CONTROL","toggle","classList","contains","_container","setProperty","_isAttached","inputChanged","margin","padding","badgeMode","params","text-align","fontSize","cleanBadgeStyle","applyThemes","modifiedObj","themeTarget","maybeHideEntity","sliderEligible_","regularMode_","originalStateCardType","services","control","stateCardType","customStateCardType","secondaryStateCardType","min_temp","max_temp","extraObj","_attached","extraObjVisible","attached","extraBadges","extraBadge","unit","blacklist","blacklist_states","test","_entityDisplay","computeExtraVisible","extraClass","_showControl","computeStateDisplay","haLocalize","isConfirmControls","clickHandler","pointerEvents","lock","opacity","extraDomChanged"],"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,EAA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AW9jB,eAAerE,IAAI,kBACnDosB,KAEA/nB,eAAeie,YAAY,kBAAkBC,KAAK,IAAM6J,MCmNtDlE,SAAWA,QAAQC,SAAW9jB,eAAerE,IAAI,kBACnDqsB,KAEAhoB,eAAeie,YAAY,kBAAkBC,KAAK,IAAM8J,qBKxP1DzqB,OAAOkN,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 = { ...element._themes };\n if (themeName !== \"default\") {\n const theme = themes.themes[themeName];\n Object.keys(theme).forEach((key) => {\n const 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) {\n return;\n }\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 = \"lovelace\";\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 \"group\",\n \"automation\",\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","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {Part} from './part.js';\n\nconst directives = new WeakMap<object, true>();\n\n// tslint:disable-next-line:no-any\nexport type DirectiveFactory = (...args: any[]) => object;\n\nexport type DirectiveFn = (part: Part) => void;\n\n/**\n * Brands a function as a directive so that lit-html will call the function\n * during template rendering, rather than passing as a value.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object\n *\n * @example\n *\n * ```\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n * ```\n */\n// tslint:disable-next-line:no-any\nexport const directive = <F extends DirectiveFactory>(f: F): F =>\n ((...args: unknown[]) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n }) as F;\n\nexport const isDirective = (o: unknown): o is DirectiveFn => {\n return typeof o === 'function' && directives.has(o);\n};\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\ninterface MaybePolyfilledCe extends CustomElementRegistry {\n polyfillWrapFlushCallback?: object;\n}\n\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = window.customElements !== undefined &&\n (window.customElements as MaybePolyfilledCe).polyfillWrapFlushCallback !==\n undefined;\n\n/**\n * Reparents nodes, starting from `startNode` (inclusive) to `endNode`\n * (exclusive), into another container (could be the same container), before\n * `beforeNode`. If `beforeNode` is null, it appends the nodes to the\n * container.\n */\nexport const reparentNodes =\n (container: Node,\n start: Node|null,\n end: Node|null = null,\n before: Node|null = null): void => {\n let node = start;\n while (node !== end) {\n const n = node!.nextSibling;\n container.insertBefore(node!, before as Node);\n node = n;\n }\n };\n\n/**\n * Removes nodes, starting from `startNode` (inclusive) to `endNode`\n * (exclusive), from `container`.\n */\nexport const removeNodes =\n (container: Node, startNode: Node|null, endNode: Node|null = null):\n void => {\n let node = startNode;\n while (node !== endNode) {\n const n = node!.nextSibling;\n container.removeChild(node!);\n node = n;\n }\n };\n","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\n/**\n * The Part interface represents a dynamic part of a template instance rendered\n * by lit-html.\n */\nexport interface Part {\n value: unknown;\n\n /**\n * Sets the current part value, but does not write it to the DOM.\n * @param value The value that will be committed.\n */\n setValue(value: unknown): void;\n\n /**\n * Commits the current part value, cause it to actually be written to the DOM.\n */\n commit(): void;\n}\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange: object = {};\n\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {TemplateResult} from './template-result.js';\n\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = `<!--${marker}-->`;\n\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n\n/**\n * An updateable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n parts: TemplatePart[] = [];\n element: HTMLTemplateElement;\n\n constructor(result: TemplateResult, element: HTMLTemplateElement) {\n this.element = element;\n let index = -1;\n let partIndex = 0;\n const nodesToRemove: Node[] = [];\n const _prepareTemplate = (template: HTMLTemplateElement) => {\n const content = template.content;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be\n // null\n const walker = document.createTreeWalker(\n content,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n while (walker.nextNode()) {\n index++;\n const node = walker.currentNode as Element | Comment | Text;\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if ((node as Element).hasAttributes()) {\n const attributes = (node as Element).attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondance between part index and attribute index.\n let count = 0;\n for (let i = 0; i < attributes.length; i++) {\n if (attributes[i].value.indexOf(marker) >= 0) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = result.strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)![2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName =\n name.toLowerCase() + boundAttributeSuffix;\n const attributeValue =\n (node as Element).getAttribute(attributeLookupName)!;\n const strings = attributeValue.split(markerRegex);\n this.parts.push({type: 'attribute', index, name, strings});\n (node as Element).removeAttribute(attributeLookupName);\n partIndex += strings.length - 1;\n }\n }\n if ((node as Element).tagName === 'TEMPLATE') {\n _prepareTemplate(node as HTMLTemplateElement);\n }\n } else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = (node as Text).data!;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode!;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n parent.insertBefore(\n (strings[i] === '') ? createMarker() :\n document.createTextNode(strings[i]),\n node);\n this.parts.push({type: 'node', index: ++index});\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n } else {\n (node as Text).data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n } else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if ((node as Comment).data === marker) {\n const parent = node.parentNode!;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({type: 'node', index});\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n (node as Comment).data = '';\n } else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n } else {\n let i = -1;\n while ((i = (node as Comment).data!.indexOf(marker, i + 1)) !==\n -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({type: 'node', index: -1});\n }\n }\n }\n }\n };\n _prepareTemplate(element);\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode!.removeChild(n);\n }\n }\n}\n\n/**\n * A placeholder for a dynamic expression in an HTML template.\n *\n * There are two built-in part types: AttributePart and NodePart. NodeParts\n * always represent a single dynamic expression, while AttributeParts may\n * represent as many expressions are contained in the attribute.\n *\n * A Template's parts are mutable, so parts can be replaced or modified\n * (possibly to implement different template semantics). The contract is that\n * parts can only be replaced, not removed, added or reordered, and parts must\n * always consume the correct number of values in their `update()` method.\n *\n * TODO(justinfagnani): That requirement is a little fragile. A\n * TemplateInstance could instead be more careful about which values it gives\n * to Part.update().\n */\nexport type TemplatePart = {\n type: 'node',\n index: number\n}|{type: 'attribute', index: number, name: string, strings: string[]};\n\nexport const isTemplatePartActive = (part: TemplatePart) => part.index !== -1;\n\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#attributes-0\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-character\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex =\n /([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \\x09\\x0a\\x0c\\x0d\"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {isCEPolyfill} from './dom.js';\nimport {Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {isTemplatePartActive, Template} from './template.js';\n\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n _parts: Array<Part|undefined> = [];\n processor: TemplateProcessor;\n options: RenderOptions;\n template: Template;\n\n constructor(\n template: Template, processor: TemplateProcessor,\n options: RenderOptions) {\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n\n update(values: unknown[]) {\n let i = 0;\n for (const part of this._parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this._parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n\n _clone(): DocumentFragment {\n // When using the Custom Elements polyfill, clone the node, rather than\n // importing it, to keep the fragment in the template's document. This\n // leaves the fragment inert so custom elements won't upgrade and\n // potentially modify their contents by creating a polyfilled ShadowRoot\n // while we traverse the tree.\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) as DocumentFragment :\n document.importNode(this.template.element.content, true);\n\n const parts = this.template.parts;\n let partIndex = 0;\n let nodeIndex = 0;\n const _prepareInstance = (fragment: DocumentFragment) => {\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be\n // null\n const walker = document.createTreeWalker(\n fragment,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length && node !== null) {\n const part = parts[partIndex];\n // Consecutive Parts may have the same node index, in the case of\n // multiple bound attributes on an element. So each iteration we either\n // increment the nodeIndex, if we aren't on a node with a part, or the\n // partIndex if we are. By not incrementing the nodeIndex when we find a\n // part, we allow for the next part to be associated with the current\n // node if neccessasry.\n if (!isTemplatePartActive(part)) {\n this._parts.push(undefined);\n partIndex++;\n } else if (nodeIndex === part.index) {\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node.previousSibling!);\n this._parts.push(part);\n } else {\n this._parts.push(...this.processor.handleAttributeExpressions(\n node as Element, part.name, part.strings, this.options));\n }\n partIndex++;\n } else {\n nodeIndex++;\n if (node.nodeName === 'TEMPLATE') {\n _prepareInstance((node as HTMLTemplateElement).content);\n }\n node = walker.nextNode();\n }\n }\n };\n _prepareInstance(fragment);\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {reparentNodes} from './dom.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker} from './template.js';\n\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n strings: TemplateStringsArray;\n values: unknown[];\n type: string;\n processor: TemplateProcessor;\n\n constructor(\n strings: TemplateStringsArray, values: unknown[], type: string,\n processor: TemplateProcessor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n\n /**\n * Returns a string of HTML used to create a `<template>` element.\n */\n getHTML(): string {\n const endIndex = this.strings.length - 1;\n let html = '';\n for (let i = 0; i < endIndex; i++) {\n const s = this.strings[i];\n // This exec() call does two things:\n // 1) Appends a suffix to the bound attribute name to opt out of special\n // attribute value parsing that IE11 and Edge do, like for style and\n // many SVG attributes. The Template class also appends the same suffix\n // when looking up attributes to create Parts.\n // 2) Adds an unquoted-attribute-safe marker for the first expression in\n // an attribute. Subsequent attribute expressions will use node markers,\n // and this is safe since attributes with multiple expressions are\n // guaranteed to be quoted.\n const match = lastAttributeNameRegex.exec(s);\n if (match) {\n // We're starting a new bound attribute.\n // Add the safe attribute suffix, and use unquoted-attribute-safe\n // marker.\n html += s.substr(0, match.index) + match[1] + match[2] +\n boundAttributeSuffix + match[3] + marker;\n } else {\n // We're either in a bound node, or trailing bound attribute.\n // Either way, nodeMarker is safe to use.\n html += s + nodeMarker;\n }\n }\n return html + this.strings[endIndex];\n }\n\n getTemplateElement(): HTMLTemplateElement {\n const template = document.createElement('template');\n template.innerHTML = this.getHTML();\n return template;\n }\n}\n\n/**\n * A TemplateResult for SVG fragments.\n *\n * This class wraps HTMl in an `<svg>` tag in order to parse its contents in the\n * SVG namespace, then modifies the template to remove the `<svg>` tag so that\n * clones only container the original fragment.\n */\nexport class SVGTemplateResult extends TemplateResult {\n getHTML(): string {\n return `<svg>${super.getHTML()}</svg>`;\n }\n\n getTemplateElement(): HTMLTemplateElement {\n const template = super.getTemplateElement();\n const content = template.content;\n const svgElement = content.firstChild!;\n content.removeChild(svgElement);\n reparentNodes(content, svgElement.firstChild);\n return template;\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {isDirective} from './directive.js';\nimport {removeNodes} from './dom.js';\nimport {noChange, nothing, Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {createMarker} from './template.js';\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\nexport type Primitive = null|undefined|boolean|number|string|Symbol|bigint;\nexport const isPrimitive = (value: unknown): value is Primitive => {\n return (\n value === null ||\n !(typeof value === 'object' || typeof value === 'function'));\n};\n\n/**\n * Sets attribute values for AttributeParts, so that the value is only set once\n * even if there are multiple parts for an attribute.\n */\nexport class AttributeCommitter {\n element: Element;\n name: string;\n strings: string[];\n parts: AttributePart[];\n dirty = true;\n\n constructor(element: Element, name: string, strings: string[]) {\n this.element = element;\n this.name = name;\n this.strings = strings;\n this.parts = [];\n for (let i = 0; i < strings.length - 1; i++) {\n this.parts[i] = this._createPart();\n }\n }\n\n /**\n * Creates a single part. Override this to create a differnt type of part.\n */\n protected _createPart(): AttributePart {\n return new AttributePart(this);\n }\n\n protected _getValue(): unknown {\n const strings = this.strings;\n const l = strings.length - 1;\n let text = '';\n\n for (let i = 0; i < l; i++) {\n text += strings[i];\n const part = this.parts[i];\n if (part !== undefined) {\n const v = part.value;\n if (v != null &&\n (Array.isArray(v) ||\n // tslint:disable-next-line:no-any\n typeof v !== 'string' && (v as any)[Symbol.iterator])) {\n for (const t of v as Iterable<unknown>) {\n text += typeof t === 'string' ? t : String(t);\n }\n } else {\n text += typeof v === 'string' ? v : String(v);\n }\n }\n }\n\n text += strings[l];\n return text;\n }\n\n commit(): void {\n if (this.dirty) {\n this.dirty = false;\n this.element.setAttribute(this.name, this._getValue() as string);\n }\n }\n}\n\nexport class AttributePart implements Part {\n committer: AttributeCommitter;\n value: unknown = undefined;\n\n constructor(comitter: AttributeCommitter) {\n this.committer = comitter;\n }\n\n setValue(value: unknown): void {\n if (value !== noChange && (!isPrimitive(value) || value !== this.value)) {\n this.value = value;\n // If the value is a not a directive, dirty the committer so that it'll\n // call setAttribute. If the value is a directive, it'll dirty the\n // committer if it calls setValue().\n if (!isDirective(value)) {\n this.committer.dirty = true;\n }\n }\n }\n\n commit() {\n while (isDirective(this.value)) {\n const directive = this.value;\n this.value = noChange;\n directive(this);\n }\n if (this.value === noChange) {\n return;\n }\n this.committer.commit();\n }\n}\n\nexport class NodePart implements Part {\n options: RenderOptions;\n startNode!: Node;\n endNode!: Node;\n value: unknown = undefined;\n _pendingValue: unknown = undefined;\n\n constructor(options: RenderOptions) {\n this.options = options;\n }\n\n /**\n * Inserts this part into a container.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendInto(container: Node) {\n this.startNode = container.appendChild(createMarker());\n this.endNode = container.appendChild(createMarker());\n }\n\n /**\n * Inserts this part between `ref` and `ref`'s next sibling. Both `ref` and\n * its next sibling must be static, unchanging nodes such as those that appear\n * in a literal section of a template.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterNode(ref: Node) {\n this.startNode = ref;\n this.endNode = ref.nextSibling!;\n }\n\n /**\n * Appends this part into a parent part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendIntoPart(part: NodePart) {\n part._insert(this.startNode = createMarker());\n part._insert(this.endNode = createMarker());\n }\n\n /**\n * Appends this part after `ref`\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterPart(ref: NodePart) {\n ref._insert(this.startNode = createMarker());\n this.endNode = ref.endNode;\n ref.endNode = this.startNode;\n }\n\n setValue(value: unknown): void {\n this._pendingValue = value;\n }\n\n commit() {\n while (isDirective(this._pendingValue)) {\n const directive = this._pendingValue;\n this._pendingValue = noChange;\n directive(this);\n }\n const value = this._pendingValue;\n if (value === noChange) {\n return;\n }\n if (isPrimitive(value)) {\n if (value !== this.value) {\n this._commitText(value);\n }\n } else if (value instanceof TemplateResult) {\n this._commitTemplateResult(value);\n } else if (value instanceof Node) {\n this._commitNode(value);\n } else if (\n Array.isArray(value) ||\n // tslint:disable-next-line:no-any\n (value as any)[Symbol.iterator]) {\n this._commitIterable(value as Iterable<unknown>);\n } else if (value === nothing) {\n this.value = nothing;\n this.clear();\n } else {\n // Fallback, will render the string representation\n this._commitText(value);\n }\n }\n\n private _insert(node: Node) {\n this.endNode.parentNode!.insertBefore(node, this.endNode);\n }\n\n private _commitNode(value: Node): void {\n if (this.value === value) {\n return;\n }\n this.clear();\n this._insert(value);\n this.value = value;\n }\n\n private _commitText(value: unknown): void {\n const node = this.startNode.nextSibling!;\n value = value == null ? '' : value;\n if (node === this.endNode.previousSibling &&\n node.nodeType === 3 /* Node.TEXT_NODE */) {\n // If we only have a single text node between the markers, we can just\n // set its value, rather than replacing it.\n // TODO(justinfagnani): Can we just check if this.value is primitive?\n (node as Text).data = value as string;\n } else {\n this._commitNode(document.createTextNode(\n typeof value === 'string' ? value : String(value)));\n }\n this.value = value;\n }\n\n private _commitTemplateResult(value: TemplateResult): void {\n const template = this.options.templateFactory(value);\n if (this.value instanceof TemplateInstance &&\n this.value.template === template) {\n this.value.update(value.values);\n } else {\n // Make sure we propagate the template processor from the TemplateResult\n // so that we use its syntax extension, etc. The template factory comes\n // from the render function options so that it can control template\n // caching and preprocessing.\n const instance =\n new TemplateInstance(template, value.processor, this.options);\n const fragment = instance._clone();\n instance.update(value.values);\n this._commitNode(fragment);\n this.value = instance;\n }\n }\n\n private _commitIterable(value: Iterable<unknown>): void {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n\n // If _value is an array, then the previous render was of an\n // iterable and _value will contain the NodeParts from the previous\n // render. If _value is not an array, clear this part and make a new\n // array for NodeParts.\n if (!Array.isArray(this.value)) {\n this.value = [];\n this.clear();\n }\n\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this.value as NodePart[];\n let partIndex = 0;\n let itemPart: NodePart|undefined;\n\n for (const item of value) {\n // Try to reuse an existing part\n itemPart = itemParts[partIndex];\n\n // If no existing part, create a new one\n if (itemPart === undefined) {\n itemPart = new NodePart(this.options);\n itemParts.push(itemPart);\n if (partIndex === 0) {\n itemPart.appendIntoPart(this);\n } else {\n itemPart.insertAfterPart(itemParts[partIndex - 1]);\n }\n }\n itemPart.setValue(item);\n itemPart.commit();\n partIndex++;\n }\n\n if (partIndex < itemParts.length) {\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n this.clear(itemPart && itemPart!.endNode);\n }\n }\n\n clear(startNode: Node = this.startNode) {\n removeNodes(\n this.startNode.parentNode!, startNode.nextSibling!, this.endNode);\n }\n}\n\n/**\n * Implements a boolean attribute, roughly as defined in the HTML\n * specification.\n *\n * If the value is truthy, then the attribute is present with a value of\n * ''. If the value is falsey, the attribute is removed.\n */\nexport class BooleanAttributePart implements Part {\n element: Element;\n name: string;\n strings: string[];\n value: unknown = undefined;\n _pendingValue: unknown = undefined;\n\n constructor(element: Element, name: string, strings: string[]) {\n if (strings.length !== 2 || strings[0] !== '' || strings[1] !== '') {\n throw new Error(\n 'Boolean attributes can only contain a single expression');\n }\n this.element = element;\n this.name = name;\n this.strings = strings;\n }\n\n setValue(value: unknown): void {\n this._pendingValue = value;\n }\n\n commit() {\n while (isDirective(this._pendingValue)) {\n const directive = this._pendingValue;\n this._pendingValue = noChange;\n directive(this);\n }\n if (this._pendingValue === noChange) {\n return;\n }\n const value = !!this._pendingValue;\n if (this.value !== value) {\n if (value) {\n this.element.setAttribute(this.name, '');\n } else {\n this.element.removeAttribute(this.name);\n }\n }\n this.value = value;\n this._pendingValue = noChange;\n }\n}\n\n/**\n * Sets attribute values for PropertyParts, so that the value is only set once\n * even if there are multiple parts for a property.\n *\n * If an expression controls the whole property value, then the value is simply\n * assigned to the property under control. If there are string literals or\n * multiple expressions, then the strings are expressions are interpolated into\n * a string first.\n */\nexport class PropertyCommitter extends AttributeCommitter {\n single: boolean;\n\n constructor(element: Element, name: string, strings: string[]) {\n super(element, name, strings);\n this.single =\n (strings.length === 2 && strings[0] === '' && strings[1] === '');\n }\n\n protected _createPart(): PropertyPart {\n return new PropertyPart(this);\n }\n\n _getValue() {\n if (this.single) {\n return this.parts[0].value;\n }\n return super._getValue();\n }\n\n commit(): void {\n if (this.dirty) {\n this.dirty = false;\n // tslint:disable-next-line:no-any\n (this.element as any)[this.name] = this._getValue();\n }\n }\n}\n\nexport class PropertyPart extends AttributePart {}\n\n// Detect event listener options support. If the `capture` property is read\n// from the options object, then options are supported. If not, then the thrid\n// argument to add/removeEventListener is interpreted as the boolean capture\n// value so we should only pass the `capture` property.\nlet eventOptionsSupported = false;\n\ntry {\n const options = {\n get capture() {\n eventOptionsSupported = true;\n return false;\n }\n };\n // tslint:disable-next-line:no-any\n window.addEventListener('test', options as any, options);\n // tslint:disable-next-line:no-any\n window.removeEventListener('test', options as any, options);\n} catch (_e) {\n}\n\n\ntype EventHandlerWithOptions =\n EventListenerOrEventListenerObject&Partial<AddEventListenerOptions>;\nexport class EventPart implements Part {\n element: Element;\n eventName: string;\n eventContext?: EventTarget;\n value: undefined|EventHandlerWithOptions = undefined;\n _options?: AddEventListenerOptions;\n _pendingValue: undefined|EventHandlerWithOptions = undefined;\n _boundHandleEvent: (event: Event) => void;\n\n constructor(element: Element, eventName: string, eventContext?: EventTarget) {\n this.element = element;\n this.eventName = eventName;\n this.eventContext = eventContext;\n this._boundHandleEvent = (e) => this.handleEvent(e);\n }\n\n setValue(value: undefined|EventHandlerWithOptions): void {\n this._pendingValue = value;\n }\n\n commit() {\n while (isDirective(this._pendingValue)) {\n const directive = this._pendingValue;\n this._pendingValue = noChange as EventHandlerWithOptions;\n directive(this);\n }\n if (this._pendingValue === noChange) {\n return;\n }\n\n const newListener = this._pendingValue;\n const oldListener = this.value;\n const shouldRemoveListener = newListener == null ||\n oldListener != null &&\n (newListener.capture !== oldListener.capture ||\n newListener.once !== oldListener.once ||\n newListener.passive !== oldListener.passive);\n const shouldAddListener =\n newListener != null && (oldListener == null || shouldRemoveListener);\n\n if (shouldRemoveListener) {\n this.element.removeEventListener(\n this.eventName, this._boundHandleEvent, this._options);\n }\n if (shouldAddListener) {\n this._options = getOptions(newListener);\n this.element.addEventListener(\n this.eventName, this._boundHandleEvent, this._options);\n }\n this.value = newListener;\n this._pendingValue = noChange as EventHandlerWithOptions;\n }\n\n handleEvent(event: Event) {\n if (typeof this.value === 'function') {\n this.value.call(this.eventContext || this.element, event);\n } else {\n (this.value as EventListenerObject).handleEvent(event);\n }\n }\n}\n\n// We copy options because of the inconsistent behavior of browsers when reading\n// the third argument of add/removeEventListener. IE11 doesn't support options\n// at all. Chrome 41 only reads `capture` if the argument is an object.\nconst getOptions = (o: AddEventListenerOptions|undefined) => o &&\n (eventOptionsSupported ?\n {capture: o.capture, passive: o.passive, once: o.once} :\n o.capture as AddEventListenerOptions);\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {Part} from './part.js';\nimport {AttributeCommitter, BooleanAttributePart, EventPart, NodePart, PropertyCommitter} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\n\n/**\n * Creates Parts when a template is instantiated.\n */\nexport class DefaultTemplateProcessor implements TemplateProcessor {\n /**\n * Create parts for an attribute-position binding, given the event, attribute\n * name, and string literals.\n *\n * @param element The element containing the binding\n * @param name The attribute name\n * @param strings The string literals. There are always at least two strings,\n * event for fully-controlled bindings with a single expression.\n */\n handleAttributeExpressions(\n element: Element, name: string, strings: string[],\n options: RenderOptions): Part[] {\n const prefix = name[0];\n if (prefix === '.') {\n const comitter = new PropertyCommitter(element, name.slice(1), strings);\n return comitter.parts;\n }\n if (prefix === '@') {\n return [new EventPart(element, name.slice(1), options.eventContext)];\n }\n if (prefix === '?') {\n return [new BooleanAttributePart(element, name.slice(1), strings)];\n }\n const comitter = new AttributeCommitter(element, name, strings);\n return comitter.parts;\n }\n /**\n * Create parts for a text-position binding.\n * @param templateFactory\n */\n handleTextExpression(options: RenderOptions) {\n return new NodePart(options);\n }\n}\n\nexport const defaultTemplateProcessor = new DefaultTemplateProcessor();\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\n/**\n * A function type that creates a Template from a TemplateResult.\n *\n * This is a hook into the template-creation process for rendering that\n * requires some modification of templates before they're used, like ShadyCSS,\n * which must add classes to elements and remove styles.\n *\n * Templates should be cached as aggressively as possible, so that many\n * TemplateResults produced from the same expression only do the work of\n * creating the Template the first time.\n *\n * Templates are usually cached by TemplateResult.strings and\n * TemplateResult.type, but may be cached by other keys if this function\n * modifies the template.\n *\n * Note that currently TemplateFactories must not add, remove, or reorder\n * expressions, because there is no way to describe such a modification\n * to render() so that values are interpolated to the correct place in the\n * template instances.\n */\nexport type TemplateFactory = (result: TemplateResult) => Template;\n\n/**\n * The default TemplateFactory which caches Templates keyed on\n * result.type and result.strings.\n */\nexport function templateFactory(result: TemplateResult) {\n let templateCache = templateCaches.get(result.type);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n keyString: new Map<string, Template>()\n };\n templateCaches.set(result.type, templateCache);\n }\n\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n\n // If the TemplateStringsArray is new, generate a key from the strings\n // This key is shared between all templates with identical content\n const key = result.strings.join(marker);\n\n // Check if we already have a Template for this key\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n // If we have not seen this key before, create a new Template\n template = new Template(result, result.getTemplateElement());\n // Cache the Template for this key\n templateCache.keyString.set(key, template);\n }\n\n // Cache all future queries for this TemplateStringsArray\n templateCache.stringsArray.set(result.strings, template);\n return template;\n}\n\n/**\n * The first argument to JS template tags retain identity across multiple\n * calls to a tag for the same literal, so we can cache work done per literal\n * in a Map.\n *\n * Safari currently has a bug which occasionally breaks this behaviour, so we\n * need to cache the Template at two levels. We first cache the\n * TemplateStringsArray, and if that fails, we cache a key constructed by\n * joining the strings array.\n */\nexport type templateCache = {\n stringsArray: WeakMap<TemplateStringsArray, Template>;\n keyString: Map<string, Template>;\n};\n\nexport const templateCaches = new Map<string, templateCache>();\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {removeNodes} from './dom.js';\nimport {NodePart} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {templateFactory} from './template-factory.js';\nimport {TemplateResult} from './template-result.js';\n\nexport const parts = new WeakMap<Node, NodePart>();\n\n/**\n * Renders a template to a container.\n *\n * To update a container with new values, reevaluate the template literal and\n * call `render` with the new result.\n *\n * @param result a TemplateResult created by evaluating a template tag like\n * `html` or `svg`.\n * @param container A DOM parent to render to. The entire contents are either\n * replaced, or efficiently updated if the same result type was previous\n * rendered there.\n * @param options RenderOptions for the entire render tree rendered to this\n * container. Render options must *not* change between renders to the same\n * container, as those changes will not effect previously rendered DOM.\n */\nexport const render =\n (result: TemplateResult,\n container: Element|DocumentFragment,\n options?: Partial<RenderOptions>) => {\n let part = parts.get(container);\n if (part === undefined) {\n removeNodes(container, container.firstChild);\n parts.set(container, part = new NodePart({\n templateFactory,\n ...options,\n }));\n part.appendInto(container);\n }\n part.setValue(result);\n part.commit();\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n *\n * Main lit-html module.\n *\n * Main exports:\n *\n * - [[html]]\n * - [[svg]]\n * - [[render]]\n *\n * @module lit-html\n * @preferred\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {defaultTemplateProcessor} from './lib/default-template-processor.js';\nimport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\n\nexport {DefaultTemplateProcessor, defaultTemplateProcessor} from './lib/default-template-processor.js';\nexport {directive, DirectiveFn, isDirective} from './lib/directive.js';\n// TODO(justinfagnani): remove line when we get NodePart moving methods\nexport {removeNodes, reparentNodes} from './lib/dom.js';\nexport {noChange, nothing, Part} from './lib/part.js';\nexport {AttributeCommitter, AttributePart, BooleanAttributePart, EventPart, isPrimitive, NodePart, PropertyCommitter, PropertyPart} from './lib/parts.js';\nexport {RenderOptions} from './lib/render-options.js';\nexport {parts, render} from './lib/render.js';\nexport {templateCaches, templateFactory} from './lib/template-factory.js';\nexport {TemplateInstance} from './lib/template-instance.js';\nexport {TemplateProcessor} from './lib/template-processor.js';\nexport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\nexport {createMarker, isTemplatePartActive, Template} from './lib/template.js';\n\ndeclare global {\n interface Window {\n litHtmlVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n// TODO(justinfagnani): inject version number at build time\n(window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.0.0');\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n */\nexport const html = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new TemplateResult(strings, values, 'html', defaultTemplateProcessor);\n\n/**\n * Interprets a template literal as an SVG template that can efficiently\n * render to and update a container.\n */\nexport const svg = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new SVGTemplateResult(strings, values, 'svg', defaultTemplateProcessor);\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module shady-render\n */\n\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\nconst walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */;\n\n/**\n * Removes the list of nodes from a Template safely. In addition to removing\n * nodes from the Template, the Template part indices are updated to match\n * the mutated Template DOM.\n *\n * As the template is walked the removal state is tracked and\n * part indices are adjusted as needed.\n *\n * div\n * div#1 (remove) <-- start removing (removing node is div#1)\n * div\n * div#2 (remove) <-- continue removing (removing node is still div#1)\n * div\n * div <-- stop removing since previous sibling is the removing node (div#1,\n * removed 4 nodes)\n */\nexport function removeNodesFromTemplate(\n template: Template, nodesToRemove: Set<Node>) {\n const {element: {content}, parts} = template;\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let part = parts[partIndex];\n let nodeIndex = -1;\n let removeCount = 0;\n const nodesToRemoveInTemplate = [];\n let currentRemovingNode: Node|null = null;\n while (walker.nextNode()) {\n nodeIndex++;\n const node = walker.currentNode as Element;\n // End removal if stepped past the removing node\n if (node.previousSibling === currentRemovingNode) {\n currentRemovingNode = null;\n }\n // A node to remove was found in the template\n if (nodesToRemove.has(node)) {\n nodesToRemoveInTemplate.push(node);\n // Track node we're removing\n if (currentRemovingNode === null) {\n currentRemovingNode = node;\n }\n }\n // When removing, increment count by which to adjust subsequent part indices\n if (currentRemovingNode !== null) {\n removeCount++;\n }\n while (part !== undefined && part.index === nodeIndex) {\n // If part is in a removed node deactivate it by setting index to -1 or\n // adjust the index as needed.\n part.index = currentRemovingNode !== null ? -1 : part.index - removeCount;\n // go to the next active part.\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n part = parts[partIndex];\n }\n }\n nodesToRemoveInTemplate.forEach((n) => n.parentNode!.removeChild(n));\n}\n\nconst countNodes = (node: Node) => {\n let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1;\n const walker = document.createTreeWalker(node, walkerNodeFilter, null, false);\n while (walker.nextNode()) {\n count++;\n }\n return count;\n};\n\nconst nextActiveIndexInTemplateParts =\n (parts: TemplatePart[], startIndex: number = -1) => {\n for (let i = startIndex + 1; i < parts.length; i++) {\n const part = parts[i];\n if (isTemplatePartActive(part)) {\n return i;\n }\n }\n return -1;\n };\n\n/**\n * Inserts the given node into the Template, optionally before the given\n * refNode. In addition to inserting the node into the Template, the Template\n * part indices are updated to match the mutated Template DOM.\n */\nexport function insertNodeIntoTemplate(\n template: Template, node: Node, refNode: Node|null = null) {\n const {element: {content}, parts} = template;\n // If there's no refNode, then put node at end of template.\n // No part indices need to be shifted in this case.\n if (refNode === null || refNode === undefined) {\n content.appendChild(node);\n return;\n }\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let insertCount = 0;\n let walkerIndex = -1;\n while (walker.nextNode()) {\n walkerIndex++;\n const walkerNode = walker.currentNode as Element;\n if (walkerNode === refNode) {\n insertCount = countNodes(node);\n refNode.parentNode!.insertBefore(node, refNode);\n }\n while (partIndex !== -1 && parts[partIndex].index === walkerIndex) {\n // If we've inserted the node, simply adjust all subsequent parts\n if (insertCount > 0) {\n while (partIndex !== -1) {\n parts[partIndex].index += insertCount;\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n return;\n }\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Module to add shady DOM/shady CSS polyfill support to lit-html template\n * rendering. See the [[render]] method for details.\n *\n * @module shady-render\n * @preferred\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {removeNodes} from './dom.js';\nimport {insertNodeIntoTemplate, removeNodesFromTemplate} from './modify-template.js';\nimport {RenderOptions} from './render-options.js';\nimport {parts, render as litRender} from './render.js';\nimport {templateCaches} from './template-factory.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\nexport {html, svg, TemplateResult} from '../lit-html.js';\n\n// Get a key to lookup in `templateCaches`.\nconst getTemplateCacheKey = (type: string, scopeName: string) =>\n `${type}--${scopeName}`;\n\nlet compatibleShadyCSSVersion = true;\n\nif (typeof window.ShadyCSS === 'undefined') {\n compatibleShadyCSSVersion = false;\n} else if (typeof window.ShadyCSS.prepareTemplateDom === 'undefined') {\n console.warn(\n `Incompatible ShadyCSS version detected.` +\n `Please update to at least @webcomponents/[email protected] and` +\n `@webcomponents/[email protected].`);\n compatibleShadyCSSVersion = false;\n}\n\n/**\n * Template factory which scopes template DOM using ShadyCSS.\n * @param scopeName {string}\n */\nconst shadyTemplateFactory = (scopeName: string) =>\n (result: TemplateResult) => {\n const cacheKey = getTemplateCacheKey(result.type, scopeName);\n let templateCache = templateCaches.get(cacheKey);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n keyString: new Map<string, Template>()\n };\n templateCaches.set(cacheKey, templateCache);\n }\n\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n\n const key = result.strings.join(marker);\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n const element = result.getTemplateElement();\n if (compatibleShadyCSSVersion) {\n window.ShadyCSS!.prepareTemplateDom(element, scopeName);\n }\n template = new Template(result, element);\n templateCache.keyString.set(key, template);\n }\n templateCache.stringsArray.set(result.strings, template);\n return template;\n };\n\nconst TEMPLATE_TYPES = ['html', 'svg'];\n\n/**\n * Removes all style elements from Templates for the given scopeName.\n */\nconst removeStylesFromLitTemplates = (scopeName: string) => {\n TEMPLATE_TYPES.forEach((type) => {\n const templates = templateCaches.get(getTemplateCacheKey(type, scopeName));\n if (templates !== undefined) {\n templates.keyString.forEach((template) => {\n const {element: {content}} = template;\n // IE 11 doesn't support the iterable param Set constructor\n const styles = new Set<Element>();\n Array.from(content.querySelectorAll('style')).forEach((s: Element) => {\n styles.add(s);\n });\n removeNodesFromTemplate(template, styles);\n });\n }\n });\n};\n\nconst shadyRenderSet = new Set<string>();\n\n/**\n * For the given scope name, ensures that ShadyCSS style scoping is performed.\n * This is done just once per scope name so the fragment and template cannot\n * be modified.\n * (1) extracts styles from the rendered fragment and hands them to ShadyCSS\n * to be scoped and appended to the document\n * (2) removes style elements from all lit-html Templates for this scope name.\n *\n * Note, <style> elements can only be placed into templates for the\n * initial rendering of the scope. If <style> elements are included in templates\n * dynamically rendered to the scope (after the first scope render), they will\n * not be scoped and the <style> will be left in the template and rendered\n * output.\n */\nconst prepareTemplateStyles =\n (renderedDOM: DocumentFragment, template: Template, scopeName: string) => {\n shadyRenderSet.add(scopeName);\n // Move styles out of rendered DOM and store.\n const styles = renderedDOM.querySelectorAll('style');\n // If there are no styles, skip unnecessary work\n if (styles.length === 0) {\n // Ensure prepareTemplateStyles is called to support adding\n // styles via `prepareAdoptedCssText` since that requires that\n // `prepareTemplateStyles` is called.\n window.ShadyCSS!.prepareTemplateStyles(template.element, scopeName);\n return;\n }\n const condensedStyle = document.createElement('style');\n // Collect styles into a single style. This helps us make sure ShadyCSS\n // manipulations will not prevent us from being able to fix up template\n // part indices.\n // NOTE: collecting styles is inefficient for browsers but ShadyCSS\n // currently does this anyway. When it does not, this should be changed.\n for (let i = 0; i < styles.length; i++) {\n const style = styles[i];\n style.parentNode!.removeChild(style);\n condensedStyle.textContent! += style.textContent;\n }\n // Remove styles from nested templates in this scope.\n removeStylesFromLitTemplates(scopeName);\n // And then put the condensed style into the \"root\" template passed in as\n // `template`.\n insertNodeIntoTemplate(\n template, condensedStyle, template.element.content.firstChild);\n // Note, it's important that ShadyCSS gets the template that `lit-html`\n // will actually render so that it can update the style inside when\n // needed (e.g. @apply native Shadow DOM case).\n window.ShadyCSS!.prepareTemplateStyles(template.element, scopeName);\n if (window.ShadyCSS!.nativeShadow) {\n // When in native Shadow DOM, re-add styling to rendered content using\n // the style ShadyCSS produced.\n const style = template.element.content.querySelector('style')!;\n renderedDOM.insertBefore(style.cloneNode(true), renderedDOM.firstChild);\n } else {\n // When not in native Shadow DOM, at this point ShadyCSS will have\n // removed the style from the lit template and parts will be broken as a\n // result. To fix this, we put back the style node ShadyCSS removed\n // and then tell lit to remove that node from the template.\n // NOTE, ShadyCSS creates its own style so we can safely add/remove\n // `condensedStyle` here.\n template.element.content.insertBefore(\n condensedStyle, template.element.content.firstChild);\n const removes = new Set();\n removes.add(condensedStyle);\n removeNodesFromTemplate(template, removes);\n }\n };\n\nexport interface ShadyRenderOptions extends Partial<RenderOptions> {\n scopeName: string;\n}\n\n/**\n * Extension to the standard `render` method which supports rendering\n * to ShadowRoots when the ShadyDOM (https://github.com/webcomponents/shadydom)\n * and ShadyCSS (https://github.com/webcomponents/shadycss) polyfills are used\n * or when the webcomponentsjs\n * (https://github.com/webcomponents/webcomponentsjs) polyfill is used.\n *\n * Adds a `scopeName` option which is used to scope element DOM and stylesheets\n * when native ShadowDOM is unavailable. The `scopeName` will be added to\n * the class attribute of all rendered DOM. In addition, any style elements will\n * be automatically re-written with this `scopeName` selector and moved out\n * of the rendered DOM and into the document `<head>`.\n *\n * It is common to use this render method in conjunction with a custom element\n * which renders a shadowRoot. When this is done, typically the element's\n * `localName` should be used as the `scopeName`.\n *\n * In addition to DOM scoping, ShadyCSS also supports a basic shim for css\n * custom properties (needed only on older browsers like IE11) and a shim for\n * a deprecated feature called `@apply` that supports applying a set of css\n * custom properties to a given location.\n *\n * Usage considerations:\n *\n * * Part values in `<style>` elements are only applied the first time a given\n * `scopeName` renders. Subsequent changes to parts in style elements will have\n * no effect. Because of this, parts in style elements should only be used for\n * values that will never change, for example parts that set scope-wide theme\n * values or parts which render shared style elements.\n *\n * * Note, due to a limitation of the ShadyDOM polyfill, rendering in a\n * custom element's `constructor` is not supported. Instead rendering should\n * either done asynchronously, for example at microtask timing (for example\n * `Promise.resolve()`), or be deferred until the first time the element's\n * `connectedCallback` runs.\n *\n * Usage considerations when using shimmed custom properties or `@apply`:\n *\n * * Whenever any dynamic changes are made which affect\n * css custom properties, `ShadyCSS.styleElement(element)` must be called\n * to update the element. There are two cases when this is needed:\n * (1) the element is connected to a new parent, (2) a class is added to the\n * element that causes it to match different custom properties.\n * To address the first case when rendering a custom element, `styleElement`\n * should be called in the element's `connectedCallback`.\n *\n * * Shimmed custom properties may only be defined either for an entire\n * shadowRoot (for example, in a `:host` rule) or via a rule that directly\n * matches an element with a shadowRoot. In other words, instead of flowing from\n * parent to child as do native css custom properties, shimmed custom properties\n * flow only from shadowRoots to nested shadowRoots.\n *\n * * When using `@apply` mixing css shorthand property names with\n * non-shorthand names (for example `border` and `border-width`) is not\n * supported.\n */\nexport const render =\n (result: TemplateResult,\n container: Element|DocumentFragment,\n options: ShadyRenderOptions) => {\n const scopeName = options.scopeName;\n const hasRendered = parts.has(container);\n const needsScoping = container instanceof ShadowRoot &&\n compatibleShadyCSSVersion && result instanceof TemplateResult;\n // Handle first render to a scope specially...\n const firstScopeRender = needsScoping && !shadyRenderSet.has(scopeName);\n // On first scope render, render into a fragment; this cannot be a single\n // fragment that is reused since nested renders can occur synchronously.\n const renderContainer =\n firstScopeRender ? document.createDocumentFragment() : container;\n litRender(\n result,\n renderContainer,\n {templateFactory: shadyTemplateFactory(scopeName), ...options} as\n RenderOptions);\n // When performing first scope render,\n // (1) We've rendered into a fragment so that there's a chance to\n // `prepareTemplateStyles` before sub-elements hit the DOM\n // (which might cause them to render based on a common pattern of\n // rendering in a custom element's `connectedCallback`);\n // (2) Scope the template with ShadyCSS one time only for this scope.\n // (3) Render the fragment into the container and make sure the\n // container knows its `part` is the one we just rendered. This ensures\n // DOM will be re-used on subsequent renders.\n if (firstScopeRender) {\n const part = parts.get(renderContainer)!;\n parts.delete(renderContainer);\n if (part.value instanceof TemplateInstance) {\n prepareTemplateStyles(\n renderContainer as DocumentFragment,\n part.value.template,\n scopeName);\n }\n removeNodes(container, container.firstChild);\n container.appendChild(renderContainer);\n parts.set(container, part);\n }\n // After elements have hit the DOM, update styling if this is the\n // initial render to this container.\n // This is needed whenever dynamic changes are made so it would be\n // safest to do every render; however, this would regress performance\n // so we leave it up to the user to call `ShadyCSSS.styleElement`\n // for dynamic changes.\n if (!hasRendered && needsScoping) {\n window.ShadyCSS!.styleElement((container as ShadowRoot).host);\n }\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\nwindow.JSCompiler_renameProperty =\n <P extends PropertyKey>(prop: P, _obj: unknown): P => prop;\n\ndeclare global {\n var JSCompiler_renameProperty: <P extends PropertyKey>(\n prop: P, _obj: unknown) => P;\n\n interface Window {\n JSCompiler_renameProperty: typeof JSCompiler_renameProperty;\n }\n}\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n /**\n * Function called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string|null, type?: TypeHint): Type;\n\n /**\n * Function called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n ComplexAttributeConverter<Type>|((value: string, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean|string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter<Type, TypeHint>;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\nexport type PropertyValues = Map<PropertyKey, unknown>;\n\nexport const defaultConverter: ComplexAttributeConverter = {\n\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n return value ? '' : null;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n return value == null ? value : JSON.stringify(value);\n }\n return value;\n },\n\n fromAttribute(value: string|null, type?: unknown) {\n switch (type) {\n case Boolean:\n return value !== null;\n case Number:\n return value === null ? null : Number(value);\n case Object:\n case Array:\n return JSON.parse(value!);\n }\n return value;\n }\n\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean => {\n // This ensures (old==NaN, value==NaN) always returns false\n return old !== value && (old === old || value === value);\n};\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n hasChanged: notEqual\n};\n\nconst microtaskPromise = Promise.resolve(true);\n\nconst STATE_HAS_UPDATED = 1;\nconst STATE_UPDATE_REQUESTED = 1 << 2;\nconst STATE_IS_REFLECTING_TO_ATTRIBUTE = 1 << 3;\nconst STATE_IS_REFLECTING_TO_PROPERTY = 1 << 4;\nconst STATE_HAS_CONNECTED = 1 << 5;\ntype UpdateState = typeof STATE_HAS_UPDATED|typeof STATE_UPDATE_REQUESTED|\n typeof STATE_IS_REFLECTING_TO_ATTRIBUTE|\n typeof STATE_IS_REFLECTING_TO_PROPERTY|typeof STATE_HAS_CONNECTED;\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclassers to render updates as desired.\n */\nexport abstract class UpdatingElement extends HTMLElement {\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n */\n private static _attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having finished creating properties.\n */\n protected static finalized = true;\n\n /**\n * Memoized list of all class properties, including any superclass properties.\n * Created lazily on user subclasses when finalizing the class.\n */\n private static _classProperties?: PropertyDeclarationMap;\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring the property.\n */\n static properties: PropertyDeclarations;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n */\n static get observedAttributes() {\n // note: piggy backing on this to ensure we're finalized.\n this.finalize();\n const attributes: string[] = [];\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n this._classProperties!.forEach((v, p) => {\n const attr = this._attributeNameForProperty(p, v);\n if (attr !== undefined) {\n this._attributeToPropertyMap.set(attr, p);\n attributes.push(attr);\n }\n });\n return attributes;\n }\n\n /**\n * Ensures the private `_classProperties` property metadata is created.\n * In addition to `finalize` this is also called in `createProperty` to\n * ensure the `@property` decorator can add property metadata.\n */\n /** @nocollapse */\n private static _ensureClassProperties() {\n // ensure private storage for property declarations.\n if (!this.hasOwnProperty(\n JSCompiler_renameProperty('_classProperties', this))) {\n this._classProperties = new Map();\n // NOTE: Workaround IE11 not supporting Map constructor argument.\n const superProperties: PropertyDeclarationMap =\n Object.getPrototypeOf(this)._classProperties;\n if (superProperties !== undefined) {\n superProperties.forEach(\n (v: PropertyDeclaration, k: PropertyKey) =>\n this._classProperties!.set(k, v));\n }\n }\n }\n\n /**\n * Creates a property accessor on the element prototype if one does not exist.\n * The property setter calls the property's `hasChanged` property option\n * or uses a strict identity check to determine whether or not to request\n * an update.\n * @nocollapse\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n // Note, since this can be called by the `@property` decorator which\n // is called before `finalize`, we ensure storage exists for property\n // metadata.\n this._ensureClassProperties();\n this._classProperties!.set(name, options);\n // Do not generate an accessor if the prototype already has one, since\n // it would be lost otherwise and that would never be the user's intention;\n // Instead, we expect users to call `requestUpdate` themselves from\n // user-defined accessors. Note that if the super has an accessor we will\n // still overwrite it\n if (options.noAccessor || this.prototype.hasOwnProperty(name)) {\n return;\n }\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n Object.defineProperty(this.prototype, name, {\n // tslint:disable-next-line:no-any no symbol in index\n get(): any {\n return this[key];\n },\n set(this: UpdatingElement, value: unknown) {\n // tslint:disable-next-line:no-any no symbol in index\n const oldValue = (this as any)[name];\n // tslint:disable-next-line:no-any no symbol in index\n (this as any)[key] = value;\n this._requestUpdate(name, oldValue);\n },\n configurable: true,\n enumerable: true\n });\n }\n\n /**\n * Creates property accessors for registered properties and ensures\n * any superclasses are also finalized.\n * @nocollapse\n */\n protected static finalize() {\n if (this.hasOwnProperty(JSCompiler_renameProperty('finalized', this)) &&\n this.finalized) {\n return;\n }\n // finalize any superclasses\n const superCtor = Object.getPrototypeOf(this);\n if (typeof superCtor.finalize === 'function') {\n superCtor.finalize();\n }\n this.finalized = true;\n this._ensureClassProperties();\n // initialize Map populated in observedAttributes\n this._attributeToPropertyMap = new Map();\n // make any properties\n // Note, only process \"own\" properties since this element will inherit\n // any properties defined on the superClass, and finalization ensures\n // the entire prototype chain is finalized.\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n // support symbols in properties (IE11 does not support this)\n const propKeys = [\n ...Object.getOwnPropertyNames(props),\n ...(typeof Object.getOwnPropertySymbols === 'function') ?\n Object.getOwnPropertySymbols(props) :\n []\n ];\n // This for/of is ok because propKeys is an array\n for (const p of propKeys) {\n // note, use of `any` is due to TypeSript lack of support for symbol in\n // index types\n // tslint:disable-next-line:no-any no symbol in index\n this.createProperty(p, (props as any)[p]);\n }\n }\n }\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static _attributeNameForProperty(\n name: PropertyKey, options: PropertyDeclaration) {\n const attribute = options.attribute;\n return attribute === false ?\n undefined :\n (typeof attribute === 'string' ?\n attribute :\n (typeof name === 'string' ? name.toLowerCase() : undefined));\n }\n\n /**\n * Returns true if a property should request an update.\n * Called when a property value is set and uses the `hasChanged`\n * option for the property if present or a strict identity check.\n * @nocollapse\n */\n private static _valueHasChanged(\n value: unknown, old: unknown, hasChanged: HasChanged = notEqual) {\n return hasChanged(value, old);\n }\n\n /**\n * Returns the property value for the given attribute value.\n * Called via the `attributeChangedCallback` and uses the property's\n * `converter` or `converter.fromAttribute` property option.\n * @nocollapse\n */\n private static _propertyValueFromAttribute(\n value: string|null, options: PropertyDeclaration) {\n const type = options.type;\n const converter = options.converter || defaultConverter;\n const fromAttribute =\n (typeof converter === 'function' ? converter : converter.fromAttribute);\n return fromAttribute ? fromAttribute(value, type) : value;\n }\n\n /**\n * Returns the attribute value for the given property value. If this\n * returns undefined, the property will *not* be reflected to an attribute.\n * If this returns null, the attribute will be removed, otherwise the\n * attribute will be set to the value.\n * This uses the property's `reflect` and `type.toAttribute` property options.\n * @nocollapse\n */\n private static _propertyValueToAttribute(\n value: unknown, options: PropertyDeclaration) {\n if (options.reflect === undefined) {\n return;\n }\n const type = options.type;\n const converter = options.converter;\n const toAttribute =\n converter && (converter as ComplexAttributeConverter).toAttribute ||\n defaultConverter.toAttribute;\n return toAttribute!(value, type);\n }\n\n private _updateState: UpdateState = 0;\n private _instanceProperties: PropertyValues|undefined = undefined;\n private _updatePromise: Promise<unknown> = microtaskPromise;\n private _hasConnectedResolver: (() => void)|undefined = undefined;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n */\n private _changedProperties: PropertyValues = new Map();\n\n /**\n * Map with keys of properties that should be reflected when updated.\n */\n private _reflectingProperties: Map<PropertyKey, PropertyDeclaration>|\n undefined = undefined;\n\n constructor() {\n super();\n this.initialize();\n }\n\n /**\n * Performs element initialization. By default captures any pre-set values for\n * registered properties.\n */\n protected initialize() {\n this._saveInstanceProperties();\n // ensures first update will be caught by an early access of `updateComplete`\n this._requestUpdate();\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n * (<=41), properties created for native platform properties like (`id` or\n * `name`) may not have default values set in the element constructor. On\n * these browsers native properties appear on instances and therefore their\n * default value will overwrite any element default (e.g. if the element sets\n * this.id = 'id' in the constructor, the 'id' will become '' since this is\n * the native platform default).\n */\n private _saveInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n (this.constructor as typeof UpdatingElement)\n ._classProperties!.forEach((_v, p) => {\n if (this.hasOwnProperty(p)) {\n const value = this[p as keyof this];\n delete this[p as keyof this];\n if (!this._instanceProperties) {\n this._instanceProperties = new Map();\n }\n this._instanceProperties.set(p, value);\n }\n });\n }\n\n /**\n * Applies previously saved instance properties.\n */\n private _applyInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // tslint:disable-next-line:no-any\n this._instanceProperties!.forEach((v, p) => (this as any)[p] = v);\n this._instanceProperties = undefined;\n }\n\n connectedCallback() {\n this._updateState = this._updateState | STATE_HAS_CONNECTED;\n // Ensure first connection completes an update. Updates cannot complete before\n // connection and if one is pending connection the `_hasConnectionResolver`\n // will exist. If so, resolve it to complete the update, otherwise\n // requestUpdate.\n if (this._hasConnectedResolver) {\n this._hasConnectedResolver();\n this._hasConnectedResolver = undefined;\n }\n }\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n */\n disconnectedCallback() {\n }\n\n /**\n * Synchronizes property values when attributes change.\n */\n attributeChangedCallback(name: string, old: string|null, value: string|null) {\n if (old !== value) {\n this._attributeToProperty(name, value);\n }\n }\n\n private _propertyToAttribute(\n name: PropertyKey, value: unknown,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n const ctor = (this.constructor as typeof UpdatingElement);\n const attr = ctor._attributeNameForProperty(name, options);\n if (attr !== undefined) {\n const attrValue = ctor._propertyValueToAttribute(value, options);\n // an undefined value does not change the attribute.\n if (attrValue === undefined) {\n return;\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_ATTRIBUTE;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_ATTRIBUTE;\n }\n }\n\n private _attributeToProperty(name: string, value: string|null) {\n // Use tracking info to avoid deserializing attribute value if it was\n // just set from a property setter.\n if (this._updateState & STATE_IS_REFLECTING_TO_ATTRIBUTE) {\n return;\n }\n const ctor = (this.constructor as typeof UpdatingElement);\n const propName = ctor._attributeToPropertyMap.get(name);\n if (propName !== undefined) {\n const options =\n ctor._classProperties!.get(propName) || defaultPropertyDeclaration;\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_PROPERTY;\n this[propName as keyof this] =\n // tslint:disable-next-line:no-any\n ctor._propertyValueFromAttribute(value, options) as any;\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_PROPERTY;\n }\n }\n\n /**\n * This private version of `requestUpdate` does not access or return the\n * `updateComplete` promise. This promise can be overridden and is therefore\n * not free to access.\n */\n private _requestUpdate(name?: PropertyKey, oldValue?: unknown) {\n let shouldRequestUpdate = true;\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n const ctor = this.constructor as typeof UpdatingElement;\n const options =\n ctor._classProperties!.get(name) || defaultPropertyDeclaration;\n if (ctor._valueHasChanged(\n this[name as keyof this], oldValue, options.hasChanged)) {\n if (!this._changedProperties.has(name)) {\n this._changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `_reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (options.reflect === true &&\n !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) {\n if (this._reflectingProperties === undefined) {\n this._reflectingProperties = new Map();\n }\n this._reflectingProperties.set(name, options);\n }\n } else {\n // Abort the request if the property should not be considered changed.\n shouldRequestUpdate = false;\n }\n }\n if (!this._hasRequestedUpdate && shouldRequestUpdate) {\n this._enqueueUpdate();\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should\n * be called when an element should update based on some state not triggered\n * by setting a property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored. Returns the `updateComplete` Promise which is resolved\n * when the update completes.\n *\n * @param name {PropertyKey} (optional) name of requesting property\n * @param oldValue {any} (optional) old value of requesting property\n * @returns {Promise} A Promise that is resolved when the update completes.\n */\n requestUpdate(name?: PropertyKey, oldValue?: unknown) {\n this._requestUpdate(name, oldValue);\n return this.updateComplete;\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async _enqueueUpdate() {\n // Mark state updating...\n this._updateState = this._updateState | STATE_UPDATE_REQUESTED;\n let resolve!: (r: boolean) => void;\n let reject!: (e: Error) => void;\n const previousUpdatePromise = this._updatePromise;\n this._updatePromise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await previousUpdatePromise;\n } catch (e) {\n // Ignore any previous errors. We only care that the previous cycle is\n // done. Any error should have been handled in the previous update.\n }\n // Make sure the element has connected before updating.\n if (!this._hasConnected) {\n await new Promise((res) => this._hasConnectedResolver = res);\n }\n try {\n const result = this.performUpdate();\n // If `performUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n } catch (e) {\n reject(e);\n }\n resolve(!this._hasRequestedUpdate);\n }\n\n private get _hasConnected() {\n return (this._updateState & STATE_HAS_CONNECTED);\n }\n\n private get _hasRequestedUpdate() {\n return (this._updateState & STATE_UPDATE_REQUESTED);\n }\n\n protected get hasUpdated() {\n return (this._updateState & STATE_HAS_UPDATED);\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * You can override this method to change the timing of updates. If this\n * method is overridden, `super.performUpdate()` must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```\n * protected async performUpdate(): Promise<unknown> {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.performUpdate();\n * }\n * ```\n */\n protected performUpdate(): void|Promise<unknown> {\n // Mixin instance properties once, if they exist.\n if (this._instanceProperties) {\n this._applyInstanceProperties();\n }\n let shouldUpdate = false;\n const changedProperties = this._changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.update(changedProperties);\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n throw e;\n } finally {\n // Ensure element can accept additional updates after an exception.\n this._markUpdated();\n }\n if (shouldUpdate) {\n if (!(this._updateState & STATE_HAS_UPDATED)) {\n this._updateState = this._updateState | STATE_HAS_UPDATED;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n }\n }\n\n private _markUpdated() {\n this._changedProperties = new Map();\n this._updateState = this._updateState & ~STATE_UPDATE_REQUESTED;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update. This getter can be implemented to\n * await additional state. For example, it is sometimes useful to await a\n * rendered element before fulfilling this Promise. To do this, first await\n * `super.updateComplete` then any subsequent state.\n *\n * @returns {Promise} The Promise returns a boolean that indicates if the\n * update resolved without triggering another update.\n */\n get updateComplete() {\n return this._updatePromise;\n }\n\n /**\n * Controls whether or not `update` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * * @param _changedProperties Map of changed properties with old values\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * * @param _changedProperties Map of changed properties with old values\n */\n protected update(_changedProperties: PropertyValues) {\n if (this._reflectingProperties !== undefined &&\n this._reflectingProperties.size > 0) {\n // Use forEach so this works even if for/of loops are compiled to for\n // loops expecting arrays\n this._reflectingProperties.forEach(\n (v, k) => this._propertyToAttribute(k, this[k as keyof this], v));\n this._reflectingProperties = undefined;\n }\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * * @param _changedProperties Map of changed properties with old values\n */\n protected updated(_changedProperties: PropertyValues) {\n }\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * * @param _changedProperties Map of changed properties with old values\n */\n protected firstUpdated(_changedProperties: PropertyValues) {\n }\n}\n","/**\n@license\nCopyright (c) 2019 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at\nhttp://polymer.github.io/LICENSE.txt The complete set of authors may be found at\nhttp://polymer.github.io/AUTHORS.txt The complete set of contributors may be\nfound at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as\npart of the polymer project is also subject to an additional IP rights grant\nfound at http://polymer.github.io/PATENTS.txt\n*/\n\nexport const supportsAdoptingStyleSheets =\n ('adoptedStyleSheets' in Document.prototype) &&\n ('replace' in CSSStyleSheet.prototype);\n\nconst constructionToken = Symbol();\n\nexport class CSSResult {\n _styleSheet?: CSSStyleSheet|null;\n\n readonly cssText: string;\n\n constructor(cssText: string, safeToken: symbol) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');\n }\n this.cssText = cssText;\n }\n\n // Note, this is a getter so that it's lazy. In practice, this means\n // stylesheets are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet|null {\n if (this._styleSheet === undefined) {\n // Note, if `adoptedStyleSheets` is supported then we assume CSSStyleSheet\n // is constructable.\n if (supportsAdoptingStyleSheets) {\n this._styleSheet = new CSSStyleSheet();\n this._styleSheet.replaceSync(this.cssText);\n } else {\n this._styleSheet = null;\n }\n }\n return this._styleSheet;\n }\n\n toString(): string {\n return this.cssText;\n }\n}\n\n/**\n * Wrap a value for interpolation in a css tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) => {\n return new CSSResult(String(value), constructionToken);\n};\n\nconst textFromCSSResult = (value: CSSResult) => {\n if (value instanceof CSSResult) {\n return value.cssText;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ${\n value}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`);\n }\n};\n\n/**\n * Template tag which which can be used with LitElement's `style` property to\n * set element styles. For security reasons, only literal string values may be\n * used. To incorporate non-literal values `unsafeCSS` may be used inside a\n * template string part.\n */\nexport const css = (strings: TemplateStringsArray, ...values: CSSResult[]) => {\n const cssText = values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]);\n return new CSSResult(cssText, constructionToken);\n};\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport {TemplateResult} from 'lit-html';\nimport {render} from 'lit-html/lib/shady-render.js';\n\nimport {PropertyValues, UpdatingElement} from './lib/updating-element.js';\n\nexport * from './lib/updating-element.js';\nexport * from './lib/decorators.js';\nexport {html, svg, TemplateResult, SVGTemplateResult} from 'lit-html/lit-html.js';\nimport {supportsAdoptingStyleSheets, CSSResult} from './lib/css-tag.js';\nexport * from './lib/css-tag.js';\n\ndeclare global {\n interface Window {\n litElementVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n// TODO(justinfagnani): inject version number at build time\n(window['litElementVersions'] || (window['litElementVersions'] = []))\n .push('2.0.1');\n\nexport interface CSSResultArray extends Array<CSSResult|CSSResultArray> {}\n\n/**\n * Minimal implementation of Array.prototype.flat\n * @param arr the array to flatten\n * @param result the accumlated result\n */\nfunction arrayFlat(\n styles: CSSResultArray, result: CSSResult[] = []): CSSResult[] {\n for (let i = 0, length = styles.length; i < length; i++) {\n const value = styles[i];\n if (Array.isArray(value)) {\n arrayFlat(value, result);\n } else {\n result.push(value);\n }\n }\n return result;\n}\n\n/** Deeply flattens styles array. Uses native flat if available. */\nconst flattenStyles = (styles: CSSResultArray): CSSResult[] =>\n styles.flat ? styles.flat(Infinity) : arrayFlat(styles);\n\nexport class LitElement extends UpdatingElement {\n /**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n */\n protected static finalized = true;\n\n /**\n * Render method used to render the lit-html TemplateResult to the element's\n * DOM.\n * @param {TemplateResult} Template to render.\n * @param {Element|DocumentFragment} Node into which to render.\n * @param {String} Element name.\n * @nocollapse\n */\n static render = render;\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the `css` tag function.\n */\n static styles?: CSSResult|CSSResultArray;\n\n private static _styles: CSSResult[]|undefined;\n\n /** @nocollapse */\n protected static finalize() {\n super.finalize();\n // Prepare styling that is stamped at first render time. Styling\n // is built from user provided `styles` or is inherited from the superclass.\n this._styles =\n this.hasOwnProperty(JSCompiler_renameProperty('styles', this)) ?\n this._getUniqueStyles() :\n this._styles || [];\n }\n\n /** @nocollapse */\n private static _getUniqueStyles(): CSSResult[] {\n // Take care not to call `this.styles` multiple times since this generates\n // new CSSResults each time.\n // TODO(sorvell): Since we do not cache CSSResults by input, any\n // shared styles will generate new stylesheet objects, which is wasteful.\n // This should be addressed when a browser ships constructable\n // stylesheets.\n const userStyles = this.styles;\n const styles: CSSResult[] = [];\n if (Array.isArray(userStyles)) {\n const flatStyles = flattenStyles(userStyles);\n // As a performance optimization to avoid duplicated styling that can\n // occur especially when composing via subclassing, de-duplicate styles\n // preserving the last item in the list. The last item is kept to\n // try to preserve cascade order with the assumption that it's most\n // important that last added styles override previous styles.\n const styleSet = flatStyles.reduceRight((set, s) => {\n set.add(s);\n // on IE set.add does not return the set.\n return set;\n }, new Set<CSSResult>());\n // Array.from does not work on Set in IE\n styleSet.forEach((v) => styles.unshift(v));\n } else if (userStyles) {\n styles.push(userStyles);\n }\n return styles;\n }\n\n private _needsShimAdoptedStyleSheets?: boolean;\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n */\n readonly renderRoot!: Element|DocumentFragment;\n\n /**\n * Performs element initialization. By default this calls `createRenderRoot`\n * to create the element `renderRoot` node and captures any pre-set values for\n * registered properties.\n */\n protected initialize() {\n super.initialize();\n (this as {renderRoot: Element | DocumentFragment}).renderRoot =\n this.createRenderRoot();\n // Note, if renderRoot is not a shadowRoot, styles would/could apply to the\n // element's getRootNode(). While this could be done, we're choosing not to\n // support this now since it would require different logic around de-duping.\n if (window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot) {\n this.adoptStyles();\n }\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n * @returns {Element|DocumentFragment} Returns a node into which to render.\n */\n protected createRenderRoot(): Element|ShadowRoot {\n return this.attachShadow({mode: 'open'});\n }\n\n /**\n * Applies styling to the element shadowRoot using the `static get styles`\n * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where\n * available and will fallback otherwise. When Shadow DOM is polyfilled,\n * ShadyCSS scopes styles and adds them to the document. When Shadow DOM\n * is available but `adoptedStyleSheets` is not, styles are appended to the\n * end of the `shadowRoot` to [mimic spec\n * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n */\n protected adoptStyles() {\n const styles = (this.constructor as typeof LitElement)._styles!;\n if (styles.length === 0) {\n return;\n }\n // There are three separate cases here based on Shadow DOM support.\n // (1) shadowRoot polyfilled: use ShadyCSS\n // (2) shadowRoot.adoptedStyleSheets available: use it.\n // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after\n // rendering\n if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n window.ShadyCSS.ScopingShim.prepareAdoptedCssText(\n styles.map((s) => s.cssText), this.localName);\n } else if (supportsAdoptingStyleSheets) {\n (this.renderRoot as ShadowRoot).adoptedStyleSheets =\n styles.map((s) => s.styleSheet!);\n } else {\n // This must be done after rendering so the actual style insertion is done\n // in `update`.\n this._needsShimAdoptedStyleSheets = true;\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n // Note, first update/render handles styleElement so we only call this if\n // connected after first update.\n if (this.hasUpdated && window.ShadyCSS !== undefined) {\n window.ShadyCSS.styleElement(this);\n }\n }\n\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * * @param _changedProperties Map of changed properties with old values\n */\n protected update(changedProperties: PropertyValues) {\n super.update(changedProperties);\n const templateResult = this.render() as unknown;\n if (templateResult instanceof TemplateResult) {\n (this.constructor as typeof LitElement)\n .render(\n templateResult,\n this.renderRoot,\n {scopeName: this.localName, eventContext: this});\n }\n // When native Shadow DOM is used but adoptedStyles are not supported,\n // insert styling after rendering to ensure adoptedStyles have highest\n // priority.\n if (this._needsShimAdoptedStyleSheets) {\n this._needsShimAdoptedStyleSheets = false;\n (this.constructor as typeof LitElement)._styles!.forEach((s) => {\n const style = document.createElement('style');\n style.textContent = s.cssText;\n this.renderRoot.appendChild(style);\n });\n }\n }\n\n /**\n * Invoked on each update to perform rendering tasks. This method must return\n * a lit-html TemplateResult. Setting properties inside this method will *not*\n * trigger the element to update.\n */\n protected render(): TemplateResult|void {\n }\n}\n","import { LitElement, html } from 'lit-element';\nimport '../utils/hooks.js';\n\n/**\n * @extends HTMLElement\n */\nclass HaConfigCustomUi extends LitElement {\n render() {\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 @click=\"${this._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=\"${this.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=\"@{this.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: {\n type: Boolean,\n attribute: 'is-wide',\n },\n\n name: {\n type: String,\n reflect: true,\n observer: 'nameChanged',\n },\n };\n }\n\n attributeChangedCallback(name, oldval, newval) {\n if (name === 'name') {\n this.nameChanged(newval);\n }\n super.attributeChangedCallback(name, oldval, newval);\n }\n\n connectedCallback() {\n super.connectedCallback();\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 const event = new CustomEvent('location-changed');\n this.dispatchEvent(event);\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: [\n \"awning\",\n \"blind\",\n \"curtain\",\n \"damper\",\n \"door\",\n \"garage\",\n \"shade\",\n \"shutter\",\n \"window\",\n ],\n sensor: [\n \"battery\",\n \"humidity\",\n \"illuminance\",\n \"temperature\",\n \"pressure\",\n \"power\",\n \"signal_strength\",\n ],\n switch: [\"switch\", \"outlet\"],\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\", \"switch\"],\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.ts';\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 '20190518';\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","import '../utils/hooks.js';\n\nexport default (superClass) => {\n /**\n * @extends HTMLElement\n */\n class CuiBaseElement extends superClass {\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 }\n return CuiBaseElement;\n};\n","import dynamicContentUpdater from '../../home-assistant-polymer/src/common/dom/dynamic_content_updater.ts';\n\nfunction loadCustomUI() {\n /**\n * @extends HTMLElement\n */\n class 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 }\n customElements.define('dynamic-element', DynamicElement);\n}\nif (Polymer && Polymer.Element && customElements.get('home-assistant')) {\n loadCustomUI();\n} else {\n customElements.whenDefined('home-assistant').then(() => loadCustomUI());\n}\n","import { html } from '@polymer/polymer/lib/utils/html-tag.js';\n\nfunction loadCustomUI() {\n /**\n * @extends HTMLElement\n */\n class 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 id='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 connectedCallback() {\n super.connectedCallback();\n this.$.slider._keyBindings = this.$.slider._keyBindings || {};\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 }\n customElements.define('ha-themed-slider', HaThemedSlider);\n}\nif (Polymer && Polymer.Element && customElements.get('home-assistant')) {\n loadCustomUI();\n} else {\n customElements.whenDefined('home-assistant').then(() => loadCustomUI());\n}\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\nfunction loadCustomUI() {\n /**\n * @extends HTMLElement\n */\n class StateCardWithSlider extends CuiBaseElement(Polymer.Element) {\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 }\n customElements.define('state-card-with-slider', StateCardWithSlider);\n}\nif (Polymer && Polymer.Element && customElements.get('home-assistant')) {\n loadCustomUI();\n} else {\n customElements.whenDefined('home-assistant').then(() => loadCustomUI());\n}\n","import { html } from '@polymer/polymer/lib/utils/html-tag.js';\nimport CuiBaseElement from './cui-base-element.js';\nimport './dynamic-with-extra.js';\n\nfunction loadCustomUI() {\n /**\n * @extends HTMLElement\n */\n class StateCardWithoutSlider extends CuiBaseElement(Polymer.Element) {\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 }\n customElements.define('state-card-without-slider', StateCardWithoutSlider);\n}\nif (Polymer && Polymer.Element && customElements.get('home-assistant')) {\n loadCustomUI();\n} else {\n customElements.whenDefined('home-assistant').then(() => loadCustomUI());\n}\n","import applyThemesOnElement from '../../home-assistant-polymer/src/common/dom/apply_themes_on_element.ts';\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.ts';\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\nfunction loadCustomUI() {\n const SHOW_LAST_CHANGED_BLACKLISTED_CARDS = ['configurator'];\n const DOMAIN_TO_SLIDER_SUPPORT = {\n light: 1, // SUPPORT_BRIGHTNESS\n cover: 4, // SUPPORT_SET_POSITION\n climate: 1, // SUPPORT_TARGET_TEMPERATURE\n };\n const TYPE_TO_CONTROL = {\n toggle: 'ha-entity-toggle',\n display: '',\n cover: 'ha-cover-controls',\n };\n\n /**\n * @extends HTMLElement\n */\n class 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 }\n customElements.define('state-card-custom-ui', StateCardCustomUi);\n}\nif (Polymer && Polymer.Element && customElements.get('home-assistant')) {\n loadCustomUI();\n} else {\n customElements.whenDefined('home-assistant').then(() => loadCustomUI());\n}\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","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","import { html } from '@polymer/polymer/lib/utils/html-tag.js';\nimport applyThemesOnElement from '../../home-assistant-polymer/src/common/dom/apply_themes_on_element.ts';\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","/**\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":""}