forked from andrey-git/home-assistant-custom-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts-es5.js.map
1 lines (1 loc) · 264 KB
/
scripts-es5.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:///./src/utils/version.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:///./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__","_defineProperty","obj","key","writable","applyThemesOnElement","element","themes","localTheme","updateMeta","arguments","length","_themes","themeName","default_theme","styles","theme","keys","forEach","prefixedKey","updateStyles","window","ShadyCSS","styleSubtree","meta","document","querySelector","hasAttribute","setAttribute","getAttribute","themeColor","computeDomain","entityId","substr","indexOf","computeStateDomain","stateObj","entity_id","dynamicContentUpdater","root","newElementTag","attributes","customEl","rootEl","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","concat","String","Math","random","slice","nodeMarker","markerRegex","RegExp","Template","result","_this","this","parts","index","partIndex","nodesToRemove","_prepareTemplate","template","content","walker","createTreeWalker","lastPartIndex","nextNode","currentNode","nodeType","hasAttributes","count","stringForPart","strings","lastAttributeNameRegex","exec","attributeLookupName","split","push","type","removeAttribute","data","parent","_strings","lastIndex","_i","insertBefore","createMarker","createTextNode","_parent","previousSibling","_i2","_i3","isTemplatePartActive","part","createComment","_defineProperties","target","props","descriptor","template_instance_TemplateInstance","TemplateInstance","processor","options","_parts","Constructor","values","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_step","_iterator","Symbol","iterator","next","done","setValue","err","return","_iteratorNormalCompletion2","_didIteratorError2","_iteratorError2","_step2","_iterator2","_part","commit","fragment","cloneNode","importNode","nodeIndex","_prepareInstance","_part2","handleTextExpression","insertAfterNode","_this$_parts","apply","arr","Array","isArray","arr2","handleAttributeExpressions","iter","toString","from","TypeError","nodeName","adoptNode","upgrade","template_result_defineProperties","template_result_TemplateResult","TemplateResult","instance","template_result_classCallCheck","protoProps","endIndex","html","match","innerHTML","getHTML","staticProps","parts_possibleConstructorReturn","self","parts_typeof","ReferenceError","parts_get","receiver","Reflect","base","parts_getPrototypeOf","desc","getOwnPropertyDescriptor","setPrototypeOf","getPrototypeOf","__proto__","parts_inherits","subClass","superClass","create","constructor","parts_classCallCheck","parts_defineProperties","parts_createClass","isPrimitive","AttributeCommitter","dirty","_createPart","parts_AttributePart","text","v","t","_getValue","AttributePart","comitter","committer","directive","parts_NodePart","NodePart","_pendingValue","ref","_insert","_commitText","_commitTemplateResult","Node","_commitNode","_commitIterable","clear","templateFactory","update","_clone","itemPart","itemParts","item","appendIntoPart","insertAfterPart","parts_BooleanAttributePart","BooleanAttributePart","Error","PropertyCommitter","_AttributeCommitter","single","PropertyPart","_AttributePart","eventOptionsSupported","parts_options","capture","addEventListener","removeEventListener","_e","parts_EventPart","EventPart","eventName","eventContext","_this2","_boundHandleEvent","e","handleEvent","newListener","oldListener","shouldRemoveListener","once","passive","shouldAddListener","_options","getOptions","event","defaultTemplateProcessor","DefaultTemplateProcessor","prefix","templateCache","templateCaches","stringsArray","keyString","Map","set","join","getTemplateElement","render_parts","litHtmlVersions","walkerNodeFilter","removeNodesFromTemplate","modify_template_nextActiveIndexInTemplateParts","removeCount","nodesToRemoveInTemplate","currentRemovingNode","countNodes","getTemplateCacheKey","scopeName","compatibleShadyCSSVersion","prepareTemplateDom","console","warn","TEMPLATE_TYPES","shadyRenderSet","JSCompiler_renameProperty","prop","_obj","defaultConverter","toAttribute","Boolean","JSON","stringify","fromAttribute","Number","parse","notEqual","old","defaultPropertyDeclaration","attribute","converter","reflect","hasChanged","microtaskPromise","Promise","resolve","UpdatingElement","_HTMLElement","updating_element_getPrototypeOf","_updateState","_instanceProperties","_updatePromise","_hasConnectedResolver","_changedProperties","_reflectingProperties","initialize","fn","_enqueueUpdate2","updating_element_setPrototypeOf","_wrapNativeSuper","HTMLElement","_this6","_classProperties","superProperties","k","_ensureClassProperties","noAccessor","updating_element_typeof","oldValue","_requestUpdate","finalized","superCtor","finalize","_attributeToPropertyMap","properties","propKeys","updating_element_toConsumableArray","getOwnPropertyNames","getOwnPropertySymbols","createProperty","_this7","attr","_attributeNameForProperty","_saveInstanceProperties","_v","_this3","_attributeToProperty","ctor","attrValue","_propertyValueToAttribute","propName","_propertyValueFromAttribute","shouldRequestUpdate","_valueHasChanged","_hasRequestedUpdate","_enqueueUpdate","updateComplete","regeneratorRuntime","mark","_callee","reject","previousUpdatePromise","_this4","wrap","_context","prev","res","rej","t0","catch","_hasConnected","performUpdate","t1","stop","args","gen","_next","asyncGeneratorStep","_throw","_applyInstanceProperties","shouldUpdate","changedProperties","_markUpdated","firstUpdated","updated","_this5","size","_propertyToAttribute","supportsAdoptingStyleSheets","Document","CSSStyleSheet","litElementVersions","lit_element_LitElement","_UpdatingElement","LitElement","lit_element_getPrototypeOf","lit_element_setPrototypeOf","lit_element_get","_styles","_getUniqueStyles","userStyles","flat","Infinity","arrayFlat","flattenStyles","reduceRight","add","unshift","renderRoot","createRenderRoot","ShadowRoot","adoptStyles","attachShadow","mode","nativeShadow","adoptedStyleSheets","map","styleSheet","_needsShimAdoptedStyleSheets","ScopingShim","prepareAdoptedCssText","cssText","localName","hasUpdated","styleElement","templateResult","render","style","textContent","lit_element_defineProperties","ha_config_custom_ui_typeof","_templateObject","raw","freeze","defineProperties","ha_config_custom_ui_defineProperties","ha_config_custom_ui_get","ha_config_custom_ui_getPrototypeOf","ha_config_custom_ui_setPrototypeOf","hasRendered","needsScoping","firstScopeRender","renderContainer","createDocumentFragment","firstChild","assign","appendInto","cacheKey","delete","renderedDOM","querySelectorAll","condensedStyle","templates","refNode","insertCount","walkerIndex","prepareTemplateStyles","_style","removes","shady_render_prepareTemplateStyles","host","ha_config_custom_ui_HaConfigCustomUi","isWide","observer","_len","_key","_backHandler","oldval","newval","nameChanged","HaConfigCustomUi","customUI","getName","setName","history","back","CustomEvent","dispatchEvent","define","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","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","init","UNKNOWN_TYPE","domHost","elem","getRootNode","DocumentFragment","lightOrShadow","selector","shadowRoot","getElementHierarchy","hierarchy","shift","getContext","groupEntity","states","reverse","findMatch","find","option","maybeChangeObjectByDevice","applyAttributes","maybeChangeObjectByGroup","context","_setKeep","_cui_keep","maybeApplyTemplateAttributes","hass","newAttributes","hasGlobal","hasChanges","computeTemplate","untemplated_attributes","untemplated_state","untemplated_stateDisplay","maybeApplyTemplates","newResult","checkAttributes","last_changed","maybeChangeObject","inDialog","allowHidden","fixGroupTitles","homeAssistantMain","haCards","$","main","card","setTimeout","controlColumns","columns","partialCards","f","handleWindowChange","_updateColumns","mqls","mql","removeListener","width","matchMedia","addListener","bind","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","initDone","runHooks","log","CUSTOM_UI_LIST","version","url","localStorage","getItem","setItem","functionBody","Function","SyntaxError","message","LiteralString","html_tag_html","reduce","acc","idx","HTMLTemplateElement","literalValue","cui_base_element","_superClass","CuiBaseElement","cui_base_element_getPrototypeOf","cui_base_element_setPrototypeOf","controlElement","extra","computed","extras","cui_base_element_defineProperties","dynamic_element_typeof","dynamic_element_defineProperties","dynamic_element_getPrototypeOf","dynamic_element_setPrototypeOf","loadCustomUI","DynamicElement","_Polymer$Element","Polymer","Element","toUpperCase","ha_themed_slider_loadCustomUI","HaThemedSlider","ha_themed_slider_getPrototypeOf","ha_themed_slider_setPrototypeOf","ha_themed_slider_templateObject","min","max","pin","isOn","disableOffWhenMin","notify","disableReportWhenNotChanged","_themedMin","ha_themed_slider_get","_computeAttribute","computeEnabledThemedReportWhenNotChanged","slider","_keyBindings","_enabledThemedReportWhenNotChanged","def","themedMin","ev","stopPropagation","state_card_with_slider_loadCustomUI","StateCardWithSlider","_CuiBaseElement","state_card_with_slider_getPrototypeOf","state_card_with_slider_setPrototypeOf","state_card_with_slider_templateObject","serviceMin","serviceMax","valueName","setValueName","nameOn","sliderValue","stretchSlider","breakSlider","hideSlider","lineTooLong","minLineBreak","maxLineBreak","showSlider","state_card_with_slider_get","_onIronResize","_isConnected","_waitForLayout","_setMode","_frameId","readyToCompute","requestAnimationFrame","prevBreakSlider","prevHideSlider","containerWidth","clientWidth","containerHeight","clientHeight","stateHeight","parseInt","param","isNaN","path","_slicedToArray","composedPath","callService","state_card_without_slider_loadCustomUI","StateCardWithoutSlider","state_card_without_slider_getPrototypeOf","state_card_without_slider_setPrototypeOf","state_card_without_slider_templateObject","state_card_without_slider_defineProperties","state_card_custom_ui_loadCustomUI","SHOW_LAST_CHANGED_BLACKLISTED_CARDS","DOMAIN_TO_SLIDER_SUPPORT","TYPE_TO_CONTROL","toggle","StateCardCustomUi","state_card_custom_ui_getPrototypeOf","state_card_custom_ui_setPrototypeOf","state_card_custom_ui_get","classList","contains","_container","setProperty","_isAttached","inputChanged","margin","padding","params","text-align","fontSize","modifiedObj","themeTarget","maybeHideEntity","applyThemes","regularMode_","badgeMode","cleanBadgeStyle","customStateCardType","originalStateCardType","services","control","stateCardType","secondaryStateCardType","sliderEligible_","min_temp","max_temp","DynamicWithExtra","_customElements$get","dynamic_with_extra_getPrototypeOf","dynamic_with_extra_setPrototypeOf","dynamic_with_extra_templateObject","extraObj","_attached","extraObjVisible","dynamic_with_extra_get","attached","extraBadges","extraBadge","unit","blacklist","blacklist_states","test","_entityDisplay","haLocalize","pointerEvents","lock","opacity"],"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,WA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AM4a,cAAgB,OAC1D,IAAMC,EAAOpxB,KAAK7C,KAAKb,cAAc,SACjC80B,IACFA,EAAKlX,KAAO,wBACZkX,EAAK7a,MAAM8a,QAAU,OAEvBp1B,OAAOgkB,WAAW,WAChBjV,EAAK7N,KAAKb,cAAc,YAAYia,MAAM4a,cAAgB,GACtDC,IACFA,EAAKlX,KAAO,mBACZkX,EAAK7a,MAAM8a,QAAU,KAEtB,KACHnmB,EAAE2f,qBAjMoD9vB,IAAA,cAAAb,MAAA,SAoM5C0kB,EAAM1jB,EAAS8B,GACzB,IAAMvB,EAAYuB,EAASK,WAAWzB,OAAS,UAC/CX,EACEC,EAAS0jB,EAAKzjB,SAAYO,cAAe,UAAWP,WAAcM,MAvMdV,IAAA,kBAAAb,MAAA,WA0MtC,IAAAmX,EAAArR,KAChBA,KAAK7C,KAAK2a,iBAAiB,wBACxBhc,QAAQ,SAACuhB,GACRhM,EAAK+d,YAAY/d,EAAKuN,KAAMvB,EAAMA,EAAKtB,2CA7MWkU,EAAA,GAiN1DvxB,eAAegb,OAAO,qBAAsBuW,KPlF1C7G,SAAWA,QAAQC,SAAW3qB,eAAe1E,IAAI,kBACnDuvB,KAEA7qB,eAAe0kB,YAAY,kBAAkBC,KAAK,kBAAMkG,OCiKtDH,SAAWA,QAAQC,SAAW3qB,eAAe1E,IAAI,kBACnD8wB,KAEApsB,eAAe0kB,YAAY,kBAAkBC,KAAK,kBAAMyH,OCnQtD1B,SAAWA,QAAQC,SAAW3qB,eAAe1E,IAAI,kBACnDuzB,KAEA7uB,eAAe0kB,YAAY,kBAAkBC,KAAK,kBAAMkK,OCmNtDnE,SAAWA,QAAQC,SAAW3qB,eAAe1E,IAAI,kBACnD6zB,KAEAnvB,eAAe0kB,YAAY,kBAAkBC,KAAK,kBAAMwK,sBKxP1D5xB,OAAOwR,0BAA4B,SAASC,GAAQ,OAAOA","file":"scripts-es5.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/webcomponentsjs@2.0.2 and` +\n `@webcomponents/shadycss@1.3.1.`);\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","export default '20190518';\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","/**\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":""}