@webtides/element-js 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -14,10 +14,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
14
14
  <!-- ### Changed -->
15
15
  <!-- ### Removed -->
16
16
  <!-- ### Fixed -->
17
- ## [0.6.1] - 2022-11-18
17
+ ## [0.6.2] - 2022-11-18
18
18
 
19
19
  ### FIXED
20
- * Store always switching to singleProperty Mode if constructed without any arguments.
20
+ * Store always switching to singleProperty Mode if constructed without any arguments.
21
+
22
+ ## [0.6.1] - 2022-11-18
21
23
 
22
24
  ### ADDED
23
25
  * Store watch() map to control internal store state scope
package/dist/index.js CHANGED
@@ -79,7 +79,7 @@ var Store = class {
79
79
  __publicField(this, "_observer", new Set());
80
80
  __publicField(this, "_singlePropertyMode", false);
81
81
  __publicField(this, "_state", {});
82
- this._singlePropertyMode = !isObjectLike(value);
82
+ this._singlePropertyMode = arguments.length > 0 && !isObjectLike(value);
83
83
  const specificValues = this._singlePropertyMode ? {value} : value;
84
84
  this._state = {...!this._singlePropertyMode && this.properties(), ...specificValues};
85
85
  Object.entries(this._state).map(([key, value2]) => {
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/util/AttributeParser.js", "../src/util/DOMHelper.js", "../src/util/Store.js", "../src/util/defineElement.js", "../src/util/toString.js", "../src/BaseElement.js", "../src/util/i18n.js", "../src/StyledElement.js", "../node_modules/lit-html/src/lib/directive.ts", "../node_modules/lit-html/src/lib/dom.ts", "../node_modules/lit-html/src/lib/part.ts", "../node_modules/lit-html/src/lib/template.ts", "../node_modules/lit-html/src/lib/template-instance.ts", "../node_modules/lit-html/src/lib/template-result.ts", "../node_modules/lit-html/src/lib/parts.ts", "../node_modules/lit-html/src/lib/default-template-processor.ts", "../node_modules/lit-html/src/lib/template-factory.ts", "../node_modules/lit-html/src/lib/render.ts", "../node_modules/lit-html/src/lit-html.ts", "../node_modules/lit-html/src/lib/modify-template.ts", "../node_modules/lit-html/src/lib/shady-render.ts", "../src/TemplateElement.js"],
4
- "sourcesContent": ["export function isObjectLike(value) {\n\treturn typeof value == 'object' && value !== null;\n}\n\nexport function isJSON(str) {\n\ttry {\n\t\treturn JSON.parse(str) && !!str;\n\t} catch (e) {\n\t\treturn false;\n\t}\n}\n\nexport function isBoolean(value) {\n\treturn value === 'true' || value === 'false';\n}\n\nexport function parseBoolean(value) {\n\treturn value === 'true';\n}\n\nexport function isString(value) {\n\treturn (\n\t\ttypeof value === 'string' ||\n\t\t(!!value && typeof value === 'object' && Object.prototype.toString.call(value) === '[object String]')\n\t);\n}\n\nexport function isNumber(value) {\n\treturn new RegExp('^-?(0|0\\\\.\\\\d+|[1-9]\\\\d*(\\\\.\\\\d+)?)$').test(value);\n}\n\nexport function isNaN(value) {\n\treturn Number.isNaN(value);\n}\n\nexport function parseAttribute(value, options = {}) {\n\tif (options.parse === false || !isString(value)) {\n\t\t// no-op\n\t\treturn value;\n\t}\n\tif (typeof options.parse === 'function') {\n\t\t// custom parse fn\n\t\treturn options.parse(value);\n\t}\n\n\t// default parse\n\tlet parsedValue = value;\n\n\tif (isJSON(value)) parsedValue = JSON.parse(value);\n\telse if (isBoolean(value)) parsedValue = parseBoolean(value);\n\telse if (isNumber(value)) parsedValue = parseFloat(value);\n\n\treturn parsedValue;\n}\n\n/**\n * Replaces dashed-expression (i.e. some-value) to a camel-cased expression (i.e. someValue)\n * @returns string\n */\nexport function dashToCamel(string) {\n\tif (string.indexOf('-') === -1) return string;\n\n\treturn string.replace(/-[a-z]/g, (matches) => matches[1].toUpperCase());\n}\n\n/**\n * Replaces camel-cased expression (i.e. someValue) to a dashed-expression (i.e. some-value)\n * @returns string\n */\nexport function camelToDash(string) {\n\treturn string.replace(/([A-Z])/g, '-$1').toLowerCase();\n}\n\n/**\n * Decodes an attribute. Can only be encoded with the `encodeAttribute` method which\n * is exported from this file.\n *\n * @param attribute\n * @returns {string}\n */\nexport function decodeAttribute(attribute) {\n\treturn `${attribute}`\n\t\t.replace(/\\$lt;/g, '<')\n\t\t.replace(/\\$gt;/g, '>')\n\t\t.replace(/\\$quot;/g, '\"')\n\t\t.replace(/\\$apos;/g, \"'\");\n}\n\n/**\n * Encodes an attribute. Can only be decoded with the `decodeAttribute` method which\n * is exported from this file.\n *\n * This does not use the standard way to encode an attribute, as the dom parser\n * that renders the html would understand and automatically decode it. Which results\n * in non sanitized html output.\n *\n * @param attribute\n * @returns {string}\n */\nexport function encodeAttribute(attribute) {\n\treturn `${attribute}`\n\t\t.replace(/'/g, '$apos;')\n\t\t.replace(/\"/g, '$quot;')\n\t\t.replace(/</g, '$lt;')\n\t\t.replace(/>/g, '$gt;')\n\t\t.replace(/\\r\\n/g, '\\n')\n\t\t.replace(/[\\r\\n]/g, '\\n');\n}\n", "export function getAllParentNodes(domNode) {\n\tlet node = domNode.parentElement;\n\tlet parents = [];\n\twhile (node) {\n\t\tparents.unshift(node); // adds node to the beginning of parents\n\t\tnode = node.parentElement;\n\t}\n\n\treturn parents;\n}\n\n// https://stackoverflow.com/questions/27453617/how-can-i-tell-if-an-element-is-in-a-shadow-dom\nexport function getShadowParentOrBody(element) {\n\tif (element instanceof ShadowRoot) {\n\t\treturn element;\n\t}\n\n\twhile (element.parentNode && (element = element.parentNode)) {\n\t\tif (element instanceof ShadowRoot) {\n\t\t\treturn element;\n\t\t}\n\t}\n\treturn document.body;\n}\n\n// TODO: add function for getClosestParentOfNodeType('custom-element')\n\nexport function getClosestParentCustomElementNode(domNode) {\n\tconst customElementParents = getAllParentNodes(domNode).filter((node) => {\n\t\treturn node.localName && node.localName.indexOf('-') !== -1;\n\t});\n\n\treturn customElementParents.pop();\n}\n\nexport function isOfSameNodeType(nodeA, nodeB) {\n\tif (!nodeA && !nodeA.localName) return false;\n\tif (!nodeB && !nodeB.localName) return false;\n\treturn nodeA.localName === nodeB.localName;\n}\n\nexport const supportsAdoptingStyleSheets = () =>\n\t'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype;\n\n// for IE11 we are using the ShadyDOM Polyfill. With the polyfill we cannot append stylesheets to the shadowRoot\nexport const supportsAppendingStyleSheets = !window.ShadyDOM;\n", "import { isObjectLike } from './AttributeParser';\n\nexport class Store {\n\t_observer = new Set();\n\t_singlePropertyMode = false;\n\t_state = {};\n\n\tconstructor(value) {\n\t\t// wrap primitives with a generic \"value\" field to generate getter and setter\n\t\tthis._singlePropertyMode = !isObjectLike(value);\n\t\tconst specificValues = this._singlePropertyMode ? { value } : value;\n\t\tthis._state = { ...(!this._singlePropertyMode && this.properties()), ...specificValues };\n\n\t\tObject.entries(this._state).map(([key, value]) => {\n\t\t\tObject.defineProperty(this, key, {\n\t\t\t\tget: () => {\n\t\t\t\t\treturn this._state[key];\n\t\t\t\t},\n\t\t\t\tset: (newValue) => {\n\t\t\t\t\tconst oldValue = this._state[key];\n\t\t\t\t\tthis._state[key] = newValue;\n\t\t\t\t\tconst watch = this.watch();\n\t\t\t\t\tif (watch.hasOwnProperty(key) && typeof watch[key] === 'function') {\n\t\t\t\t\t\twatch[key](newValue, oldValue);\n\t\t\t\t\t}\n\t\t\t\t\tthis.requestUpdate();\n\t\t\t\t},\n\t\t\t});\n\t\t});\n\t}\n\n\tproperties() {\n\t\treturn {};\n\t}\n\n\t/**\n\t * When a property as the key was changed in the store, the callback function defined as value\n\t * will be called with `newValue` and `oldValue`\n\t * eg. { property: (oldValue, newValue) => { console.log('property changed!, oldValue, newValue); } }\n\t * @return {{}}\n\t */\n\twatch() {\n\t\treturn {};\n\t}\n\n\tvalueOf() {\n\t\treturn this._singlePropertyMode ? this._state.value : this._state;\n\t}\n\n\ttoString() {\n\t\treturn `${this._singlePropertyMode ? this._state.value : this._state}`;\n\t}\n\n\t/**\n\t * @param {BaseElement|Function} observer\n\t */\n\tsubscribe(observer) {\n\t\tthis._observer.add(observer);\n\t}\n\t/**\n\t * @param {BaseElement|Function} observer\n\t */\n\tunsubscribe(observer) {\n\t\tthis._observer.delete(observer);\n\t}\n\n\trequestUpdate() {\n\t\tthis._observer.forEach((observer) =>\n\t\t\ttypeof observer.requestUpdate === 'function' ? observer.requestUpdate() : observer(),\n\t\t);\n\t}\n}\n", "/**\n * Wrapper for defining custom elements so that registering an element multiple times won't crash\n * @param name for the tag\n * @param constructor for the custom element\n */\nexport function defineElement(name, constructor) {\n\ttry {\n\t\tcustomElements.define(name, constructor);\n\t} catch (e) {\n\t\t// console.log('error defining custom element', e);\n\t}\n}\n", "/**\n * Little wrapper function for JSON.stringify() to easily convert objects and arrays to strings\n * to be able to set them as attributes on custom elements\n * @param value to be stringified\n * @return String of the stringified value\n */\nexport function toString(value) {\n\ttry {\n\t\treturn JSON.stringify(value);\n\t} catch (e) {\n\t\treturn '';\n\t}\n}\n", "import { parseAttribute, isNaN, dashToCamel, camelToDash, isObjectLike } from './util/AttributeParser.js';\nimport { getClosestParentCustomElementNode, isOfSameNodeType } from './util/DOMHelper.js';\nimport { Store } from './util/Store.js';\n\nexport { defineElement } from './util/defineElement';\nexport { toString } from './util/toString';\n\nclass BaseElement extends HTMLElement {\n\tconstructor(options = {}) {\n\t\tsuper();\n\t\tthis.$refs = {};\n\t\tthis._state = {};\n\t\tthis._mutationObserver = null;\n\t\tthis._registeredEvents = [];\n\t\tthis._batchUpdate = null;\n\t\tthis._requestedUpdates = [];\n\t\tthis._options = {\n\t\t\tautoUpdate: true,\n\t\t\tdeferUpdate: true,\n\t\t\tmutationObserverOptions: {\n\t\t\t\tattributes: true,\n\t\t\t\tchildList: true,\n\t\t\t\tsubtree: false,\n\t\t\t\t...options.mutationObserverOptions,\n\t\t\t},\n\t\t\tpropertyOptions: {},\n\t\t\t...options,\n\t\t};\n\n\t\tif (options.childListUpdate !== undefined && options.childListUpdate !== null) {\n\t\t\tthis._options.mutationObserverOptions.childList = options.childListUpdate;\n\t\t\tconsole.warn(\n\t\t\t\t`[${this.localName}] Using the \"childListUpdate\" option is deprecated and will be removed before 1.0! Please use the \"mutationObserverOptions\" dictionary instead. See the docs for more info`,\n\t\t\t);\n\t\t}\n\t}\n\n\tconnectedCallback() {\n\t\t// define all attributes to \"this\" as properties\n\t\tthis.defineAttributesAsProperties();\n\n\t\t// define all properties to \"this\"\n\t\tthis.defineProperties();\n\n\t\t// define all computed properties to \"this\"\n\t\tthis.defineComputedProperties();\n\n\t\t// define everything that should be observed\n\t\tthis.defineObserver();\n\n\t\tif (this.hasAttribute('defer-update') || this._options.deferUpdate) {\n\t\t\t// don't updates/render, but register refs and events\n\t\t\tthis.registerEventsAndRefs();\n\n\t\t\tthis.triggerHook('connected');\n\t\t} else {\n\t\t\tthis.requestUpdate({ notify: false }).then(() => {\n\t\t\t\tthis.triggerHook('connected');\n\t\t\t});\n\t\t}\n\t}\n\n\tdefineObserver() {\n\t\t// see: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver#Example_usage\n\t\tthis._mutationObserver = new MutationObserver((mutations) => {\n\t\t\tmutations.forEach((mutation) => {\n\t\t\t\tif (\n\t\t\t\t\tmutation.type === 'attributes' &&\n\t\t\t\t\tmutation.target === this &&\n\t\t\t\t\tthis._state.hasOwnProperty(dashToCamel(mutation.attributeName))\n\t\t\t\t) {\n\t\t\t\t\t// update property by invoking the setter\n\t\t\t\t\tthis[dashToCamel(mutation.attributeName)] = parseAttribute(\n\t\t\t\t\t\tthis.getAttribute(mutation.attributeName),\n\t\t\t\t\t\tthis._options.propertyOptions[dashToCamel(mutation.attributeName)],\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (mutation.type === 'attributes' && mutation.target !== this) {\n\t\t\t\t\tthis.requestUpdate();\n\t\t\t\t}\n\t\t\t\tif (mutation.type === 'childList') {\n\t\t\t\t\tthis.requestUpdate();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tthis._mutationObserver.observe(this, {\n\t\t\tattributes: true,\n\t\t\tchildList: true,\n\t\t\tsubtree: false,\n\t\t\t...this._options.mutationObserverOptions,\n\t\t});\n\t}\n\n\tdisconnectedCallback() {\n\t\t// remove events for elements in the component\n\t\tthis.removeEvents();\n\n\t\t// remove observers\n\t\tif (this._mutationObserver) this._mutationObserver.disconnect();\n\n\t\t// unsubscribe from stores\n\t\tObject.values(this.properties()).forEach((property) => {\n\t\t\tif (property instanceof Store) {\n\t\t\t\tproperty.unsubscribe(this);\n\t\t\t}\n\t\t});\n\n\t\tthis.triggerHook('disconnected');\n\t}\n\n\trequestUpdate(options = { notify: true }) {\n\t\tif (options.notify === true) {\n\t\t\tthis.triggerHook('beforeUpdate');\n\t\t}\n\n\t\tif (this._batchUpdate) {\n\t\t\tcancelAnimationFrame(this._batchUpdate);\n\t\t\tthis._batchUpdate = false;\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis._requestedUpdates.push({ resolve, reject });\n\t\t\tthis._batchUpdate = requestAnimationFrame(() => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.update(options);\n\t\t\t\t\tthis._requestedUpdates.forEach(({ resolve, reject }) => resolve());\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// console.error('Update error', e)\n\t\t\t\t\tthis._requestedUpdates.forEach(({ resolve, reject }) => reject(e));\n\t\t\t\t}\n\t\t\t\tthis._requestedUpdates = [];\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * This should be called by the template component AFTER adding the template to\n\t * the DOM.\n\t * Here we will register the events and the refs for the element.\n\t */\n\tupdate(options = { notify: true }) {\n\t\tthis.registerEventsAndRefs();\n\t\tif (options.notify === true) {\n\t\t\tthis.triggerHook('afterUpdate');\n\t\t}\n\t}\n\n\t/**\n\t * Register events and refs for the component\n\t */\n\tregisterEventsAndRefs() {\n\t\t// register events for elements in the component\n\t\tthis.registerEvents();\n\n\t\t// register $refs\n\t\tthis.registerRefs();\n\t}\n\n\t/**\n\t * Defines all attributes assigned in the HTML for the element as properties on the element\n\t * If the value for an attribute can be parsed to an object or array, it will do so\n\t */\n\tdefineAttributesAsProperties() {\n\t\tconst ignoreAttributes = ['class', 'style'];\n\t\tArray.from(this.attributes)\n\t\t\t.filter((attribute) => {\n\t\t\t\treturn !ignoreAttributes.includes(attribute.name);\n\t\t\t})\n\t\t\t.forEach((attribute) => {\n\t\t\t\tconst name = dashToCamel(attribute.name);\n\t\t\t\tconst parseOptions = this._options.propertyOptions[name];\n\t\t\t\tthis.defineProperty(name, parseAttribute(attribute.value, parseOptions), true);\n\t\t\t});\n\t}\n\n\t/**\n\t * Properties to be defined and assigned on the element. Should be overwritten in child components\n\t * Properties defined here will also trigger a update() when changed.\n\t * eg. { stringProperty: 'value', numberProperty: 13, booleanProperty: true } }\n\t * @return {{}}\n\t */\n\tproperties() {\n\t\treturn {};\n\t}\n\n\t/**\n\t * Defines properties on the element based on keys from this.properties()\n\t * Will trigger update() when a property was changed\n\t */\n\tdefineProperties() {\n\t\tObject.keys(this.properties()).forEach((prop) => {\n\t\t\t// when mixing shadow dom elements with light dom elements and nesting custom elements\n\t\t\t// it might occur that properties where set on an element before it was\n\t\t\t// registered or connected. To avoid such timing issues we check\n\t\t\t// if a value was set for that specific property on the\n\t\t\t// prototype before assigning a default value\n\t\t\tconst value = this[prop] || this.properties()[prop];\n\t\t\tthis.defineProperty(prop, value);\n\t\t});\n\t}\n\n\t/**\n\t * Define a property on the element\n\t * Will trigger watch() function when a property was changed\n\t * Will trigger update() when a property was changed\n\t */\n\tdefineProperty(property, value, reflectAttribute = false) {\n\t\tif (value instanceof Store) {\n\t\t\tvalue.subscribe(this);\n\t\t}\n\n\t\tif (this._state.hasOwnProperty(property)) {\n\t\t\t// property has already been defined as an attribute nothing to do here\n\t\t\treturn;\n\t\t}\n\n\t\t// if property did not come from an attribute but has the option to reflect // enabled or custom fn\n\t\tif (!reflectAttribute && this._options.propertyOptions[property]?.reflect) {\n\t\t\tthis.reflectProperty({ property: property, newValue: value });\n\t\t}\n\n\t\t// remove attribute if reflect is set to false explicitly in options\n\t\tif (this._options.propertyOptions[property]?.reflect === false) {\n\t\t\tthis.removeAttribute(camelToDash(property));\n\t\t}\n\n\t\tthis._state[property] = value;\n\n\t\tObject.defineProperty(this, property, {\n\t\t\tget: () => {\n\t\t\t\treturn this._state[property];\n\t\t\t},\n\t\t\tset: (newValue) => {\n\t\t\t\tconst oldValue = this._state[property];\n\t\t\t\tconst newValueString = JSON.stringify(newValue);\n\n\t\t\t\tif (JSON.stringify(oldValue) !== newValueString) {\n\t\t\t\t\tthis._state[property] = newValue;\n\n\t\t\t\t\tif (reflectAttribute || this._options.propertyOptions[property]?.reflect) {\n\t\t\t\t\t\tthis.reflectProperty({ property, newValue, newValueString });\n\t\t\t\t\t}\n\n\t\t\t\t\tconst informWatchedPropertiesAndDispatchChangeEvent = () => {\n\t\t\t\t\t\t// notify watched properties (after update())\n\t\t\t\t\t\tif (property in this.watch()) {\n\t\t\t\t\t\t\tthis.watch()[property](newValue, oldValue);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// dispatch change event\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tproperty in this._options['propertyOptions'] &&\n\t\t\t\t\t\t\tthis._options['propertyOptions'][property]['notify'] === true\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthis.dispatch(`${camelToDash(property)}-changed`, newValue, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tif (this._options.autoUpdate) {\n\t\t\t\t\t\tthis.requestUpdate({\n\t\t\t\t\t\t\tnotify: true,\n\t\t\t\t\t\t\tproperty: property,\n\t\t\t\t\t\t\tnewValue: newValue,\n\t\t\t\t\t\t\tnewValueString: newValueString,\n\t\t\t\t\t\t\toldValue: oldValue,\n\t\t\t\t\t\t}).finally(() => {\n\t\t\t\t\t\t\tinformWatchedPropertiesAndDispatchChangeEvent();\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinformWatchedPropertiesAndDispatchChangeEvent();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn this;\n\t\t\t},\n\t\t});\n\t}\n\n\treflectProperty(options) {\n\t\tconst { property, newValue } = options;\n\t\tconst newValueString = options.newValueString || JSON.stringify(newValue);\n\n\t\tif (newValue === undefined || newValue === null || isNaN(newValue)) {\n\t\t\t// these would be reflected as strings: \"undefined\" || \"null\" || \"NaN\"\n\t\t\t// which is not the desired behaviour. Therefore we reflect them as empty strings\n\t\t\tthis.setAttribute(camelToDash(property), '');\n\t\t} else {\n\t\t\tlet attributeValue = isObjectLike(newValue) ? newValueString : newValue;\n\t\t\tif (typeof this._options.propertyOptions[property]?.reflect === 'function') {\n\t\t\t\tattributeValue = this._options.propertyOptions[property].reflect(newValue);\n\t\t\t}\n\t\t\tthis.setAttribute(camelToDash(property), attributeValue);\n\t\t}\n\t}\n\n\t// Deprecated\n\thooks() {\n\t\treturn {};\n\t}\n\n\t// Connected lifecycle hook\n\tconnected() {}\n\n\t// BeforeUpdate lifecycle hook\n\tbeforeUpdate() {}\n\n\t// AfterUpdate lifecycle hook\n\tafterUpdate() {}\n\n\t// Disconnected lifecycle hook\n\tdisconnected() {}\n\n\t// Triggers a lifecycle hook based on the name\n\ttriggerHook(name) {\n\t\tif (this.hooks && name in this.hooks()) {\n\t\t\tconsole.warn(\n\t\t\t\t`[${this.localName}] Using the hooks() map for lifecycle hooks is deprecated! Please overwrite the existing lifecycle hook functions. See the docs for more info`,\n\t\t\t);\n\t\t\tthis.hooks()[name]();\n\t\t\treturn;\n\t\t}\n\n\t\tif (name in this) {\n\t\t\tthis[name]();\n\t\t}\n\t}\n\n\t/**\n\t * Watched attributes & properties to be notified to the element when changed. Should be overwritten in child components\n\t * When an attribute or property as the key was changed on the element, the callback function defined as value\n\t * will be called with `newValue` and `oldValue`\n\t * eg. { property: (oldValue, newValue) => { console.log('property changed!, oldValue, newValue); } }\n\t * @return {{}}\n\t */\n\twatch() {\n\t\treturn {};\n\t}\n\n\t// Deprecated\n\tcomputed() {\n\t\treturn {};\n\t}\n\n\t// Deprecated\n\tdefineComputedProperties() {\n\t\tObject.keys(this.computed()).forEach((prop) => {\n\t\t\tif (!this.hasOwnProperty(prop)) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[${this.localName}] Using the computed() map for computed properties is deprecated! Please use regular JS getters and return the computed value. See the docs for more info`,\n\t\t\t\t);\n\t\t\t\tObject.defineProperty(this, prop, {\n\t\t\t\t\tget: () => this.computed()[prop](),\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Return a map of events that should be registered on the element.\n\t * eg. { '.link': {\n\t * 'click': (e) => {console.log('MyElement.link - clicked', e)},\n\t * 'mouseover': (e) => {console.log('MyElement.link - mouseover()', e)},\n\t * }\n\t * }\n\t */\n\tevents() {\n\t\treturn {};\n\t}\n\n\t/**\n\t * Registers events on the element based on events().\n\t * Removes all previously registered events before adding them.\n\t */\n\tregisterEvents() {\n\t\t// remove all previously registered events to prevent duplicate triggers\n\t\tthis.removeEvents();\n\n\t\t// register events\n\t\tconst eventDefinitions = this.events();\n\t\tObject.keys(eventDefinitions).forEach((elementSelector) => {\n\t\t\tconst events = eventDefinitions[elementSelector];\n\t\t\tconst selectorWhiteList = { window, document, this: this.getRoot() };\n\t\t\tconst whiteListElement = selectorWhiteList[elementSelector];\n\t\t\tconst eventTargets = whiteListElement\n\t\t\t\t? [whiteListElement]\n\t\t\t\t: this.getRoot().querySelectorAll(elementSelector);\n\n\t\t\teventTargets.forEach((eventTarget) => {\n\t\t\t\tObject.keys(events).forEach((eventName) => {\n\t\t\t\t\tconst notation = events[eventName];\n\t\t\t\t\tif (typeof notation === 'function') {\n\t\t\t\t\t\tconst callback = notation.bind(this);\n\t\t\t\t\t\teventTarget.addEventListener(eventName, callback);\n\t\t\t\t\t\tthis._registeredEvents.push({ eventTarget, eventName, callback });\n\t\t\t\t\t} else if (typeof notation === 'object' && typeof notation.listener === 'function') {\n\t\t\t\t\t\tconst callback = notation.listener.bind(this);\n\t\t\t\t\t\teventTarget.addEventListener(eventName, callback, notation.options ?? {});\n\t\t\t\t\t\tthis._registeredEvents.push({ eventTarget, eventName, callback });\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Removes all events from the element that where previously registered from the events() map.\n\t */\n\tremoveEvents() {\n\t\tthis._registeredEvents.forEach(({ eventTarget, eventName, callback }) => {\n\t\t\tif (eventTarget === window || eventTarget === document || this.getRoot().contains(eventTarget)) {\n\t\t\t\teventTarget.removeEventListener(eventName, callback);\n\t\t\t}\n\t\t});\n\t\tthis._registeredEvents = [];\n\t}\n\n\t/**\n\t * Stores an object that references child elements & DOM nodes that have a ref attribute defined.\n\t * References will be accessible on the element under this.$refs\n\t */\n\tregisterRefs() {\n\t\tconst refsNodeList = this.getRoot().querySelectorAll('[ref]');\n\t\tconst refsArray = Array.from(refsNodeList);\n\t\tconst refsMap = {};\n\n\t\trefsArray.forEach((refNode) => {\n\t\t\tconst refKey = refNode.getAttribute('ref');\n\t\t\tconst isListKey = refKey.endsWith('[]');\n\t\t\tconst cleanKey = isListKey ? refKey.slice(0, -2) : refKey;\n\t\t\tconst hasListRef = Array.isArray(refsMap[cleanKey]);\n\n\t\t\tif (isListKey) {\n\t\t\t\tif (!refsMap[cleanKey] || !hasListRef) {\n\t\t\t\t\t// create or overwrite previously registered single ref\n\t\t\t\t\trefsMap[cleanKey] = [];\n\t\t\t\t}\n\t\t\t\trefsMap[cleanKey].push(refNode);\n\t\t\t} else if (!hasListRef) {\n\t\t\t\trefsMap[refKey] = refNode;\n\t\t\t} else {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`Did not register singular ref ${refKey}, ${refNode} as a ref list is already registered under the same name.`,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\tthis.$refs = refsMap;\n\t}\n\n\t// Helper function for dispatching custom events\n\tdispatch(name, data, bubble = false, cancelable = false, composed = false) {\n\t\tconst event = new CustomEvent(name, {\n\t\t\tbubbles: bubble,\n\t\t\tcancelable: cancelable,\n\t\t\tcomposed: composed,\n\t\t\tdetail: data,\n\t\t});\n\t\tthis.dispatchEvent(event);\n\t}\n\n\t// Get the root element\n\tgetRoot() {\n\t\treturn this;\n\t}\n}\n\nexport { BaseElement, getClosestParentCustomElementNode, isOfSameNodeType };\n", "/**\n * Retrieves a translated key from a dictionary on the window object\n * Example: ${i18n('CustomElement.buttonLabel', 'Label')}\n * @param key to be translated\n * @param fallback to be used if key is not defined\n * @return String of the translated key or fallback or original key\n */\nexport function i18n(key, fallback) {\n\ttry {\n\t\tconst translations = window.elementjs.i18n();\n\t\tif (translations[key] === undefined) {\n\t\t\tthrow 'Translation Missing';\n\t\t}\n\n\t\treturn translations[key];\n\t} catch (err) {\n\t\tif (fallback) return fallback;\n\t\telse return key;\n\t}\n}\n", "import { BaseElement } from './BaseElement';\nimport { supportsAdoptingStyleSheets, getShadowParentOrBody } from './util/DOMHelper';\nexport { i18n } from './util/i18n';\n\nclass StyledElement extends BaseElement {\n\tstatic globalStyles = null;\n\n\tstatic updateGlobalStyles() {\n\t\t// this is a runtime dependency so that every shadow dom can make use of global css\n\t\t// we assume these styles to be inlined into the document\n\t\tStyledElement.globalStyles = document.getElementById('globalStyles');\n\n\t\tif (StyledElement.globalStyles && StyledElement['globalStyleSheet']) {\n\t\t\t//updates already adopted global styles\n\t\t\tStyledElement['globalStyleSheet'].replaceSync(StyledElement.globalStyles.textContent);\n\t\t}\n\t}\n\n\tconstructor(options) {\n\t\tsuper({\n\t\t\tdeferUpdate: false,\n\t\t\tshadowRender: false,\n\t\t\tstyles: [],\n\t\t\tadoptGlobalStyles: true,\n\t\t\t...options,\n\t\t});\n\t\tthis._styles = [...this._options.styles, ...this.styles()];\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\n\t\tif (supportsAdoptingStyleSheets() && this._options.shadowRender) {\n\t\t\t// adopting does only make sense in shadow dom. Fall back to append for light elements\n\t\t\tthis.adoptStyleSheets();\n\t\t} else if (this._options.shadowRender && window.ShadyCSS !== undefined) {\n\t\t\t// if shadowRoot is polyfilled we use ShadyCSS to copy scoped styles to <head>\n\t\t\twindow.ShadyCSS.ScopingShim.prepareAdoptedCssText(this._styles, this.localName);\n\t\t}\n\n\t\t// if shadowRoot is polyfilled - scope element template\n\t\tif (window.ShadyCSS !== undefined) {\n\t\t\twindow.ShadyCSS.styleElement(this);\n\t\t}\n\t}\n\n\tstyles() {\n\t\treturn [];\n\t}\n\n\tupdate(options) {\n\t\tif (!supportsAdoptingStyleSheets() || this._options.shadowRender === false) {\n\t\t\t// append stylesheets to template if not already adopted\n\t\t\tconst appendableStyles = [...this._styles];\n\t\t\tif (this._options.shadowRender && this._options.adoptGlobalStyles && !window.ShadyCSS) {\n\t\t\t\tappendableStyles.unshift(StyledElement.globalStyles?.textContent ?? '');\n\t\t\t}\n\t\t\tthis.appendStyleSheets(appendableStyles);\n\t\t}\n\t\tsuper.update(options);\n\t}\n\n\tadoptStyleSheets() {\n\t\tif (!this.constructor['cssStyleSheets']) {\n\t\t\tthis.constructor['cssStyleSheets'] = this._styles.map((style) => {\n\t\t\t\tconst sheet = new CSSStyleSheet();\n\t\t\t\tif (sheet && sheet.cssRules.length === 0) {\n\t\t\t\t\tsheet.replaceSync(style);\n\t\t\t\t}\n\t\t\t\treturn sheet;\n\t\t\t});\n\t\t}\n\n\t\tif (StyledElement.globalStyles && !StyledElement['globalStyleSheet']) {\n\t\t\tStyledElement['globalStyleSheet'] = new CSSStyleSheet();\n\t\t\tStyledElement['globalStyleSheet'].replaceSync(StyledElement.globalStyles.textContent);\n\t\t}\n\n\t\t// adopt styles\n\t\t// uses proposed solution for constructable stylesheets\n\t\t// see: https://wicg.github.io/construct-stylesheets/#proposed-solution\n\t\tthis.getRoot().adoptedStyleSheets = [\n\t\t\t...(this._options.shadowRender && this._options.adoptGlobalStyles && StyledElement['globalStyleSheet']\n\t\t\t\t? [StyledElement['globalStyleSheet']]\n\t\t\t\t: []),\n\t\t\t...this.constructor['cssStyleSheets'],\n\t\t];\n\t}\n\n\t// custom polyfill for constructable stylesheets by appending styles to the end of an element\n\tappendStyleSheets(styles) {\n\t\tconst parentDocument = getShadowParentOrBody(this.getRoot());\n\t\tstyles.forEach((style, index) => {\n\t\t\tconst identifier = this.tagName + index;\n\n\t\t\t// only append stylesheet if not already appended to shadowRoot or document\n\t\t\tif (!parentDocument.querySelector(`#${identifier}`)) {\n\t\t\t\tconst styleElement = document.createElement('style');\n\t\t\t\tstyleElement.id = identifier;\n\t\t\t\tstyleElement.style.display = 'none';\n\t\t\t\tstyleElement.textContent = style;\n\t\t\t\tparentDocument.appendChild(styleElement);\n\t\t\t}\n\t\t});\n\t}\n}\n\nStyledElement.updateGlobalStyles();\n\nexport { StyledElement };\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// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DirectiveFactory = (...args: any[]) => object;\n\nexport type DirectiveFn = (part: Part) => void;\n\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\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 * 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 */\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 readonly polyfillWrapFlushCallback?: object;\n}\n\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n (window.customElements as MaybePolyfilledCe).polyfillWrapFlushCallback !==\n undefined;\n\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes =\n (container: Node,\n start: Node|null,\n end: Node|null = null,\n before: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.insertBefore(start!, before);\n start = n;\n }\n };\n\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes =\n (container: Node, start: Node|null, end: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.removeChild(start!);\n start = 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 readonly 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, causing it to actually be written to the\n * DOM.\n *\n * Directives are run at the start of `commit`, so that if they call\n * `part.setValue(...)` synchronously that value will be used in the current\n * commit, and there's no need to call `part.commit()` within the directive.\n * If directives set a part value asynchronously, then they must call\n * `part.commit()` manually.\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 = {};\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 updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n readonly parts: TemplatePart[] = [];\n readonly element: HTMLTemplateElement;\n\n constructor(result: TemplateResult, element: HTMLTemplateElement) {\n this.element = element;\n\n const nodesToRemove: Node[] = [];\n const stack: Node[] = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n element.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 let index = -1;\n let partIndex = 0;\n const {strings, values: {length}} = result;\n while (partIndex < length) {\n const node = walker.nextNode() as Element | Comment | Text | null;\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n continue;\n }\n index++;\n\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if ((node as Element).hasAttributes()) {\n const attributes = (node as Element).attributes;\n const {length} = 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 correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\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 = 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 (node as Element).removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({type: 'attribute', index, name, strings: statics});\n partIndex += statics.length - 1;\n }\n }\n if ((node as Element).tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = (node as HTMLTemplateElement).content;\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 let insert: Node;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n } else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, 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)) !== -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 partIndex++;\n }\n }\n }\n }\n\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\nconst endsWith = (str: string, suffix: string): boolean => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\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 readonly type: 'node'; index: number;\n}|{\n readonly type: 'attribute';\n index: number;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n};\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#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\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 // eslint-disable-next-line no-control-regex\n /([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\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, TemplatePart} 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 private readonly __parts: Array<Part|undefined> = [];\n readonly processor: TemplateProcessor;\n readonly options: RenderOptions;\n readonly 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: readonly 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 // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) as DocumentFragment :\n document.importNode(this.template.element.content, true);\n\n const stack: Node[] = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n fragment,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part: TemplatePart;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node!.nodeName === 'TEMPLATE') {\n stack.push(node!);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n node = walker.nextNode();\n }\n }\n\n // We've arrived at our part's node.\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 }\n\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\nconst commentMarker = ` ${marker} `;\n\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n readonly strings: TemplateStringsArray;\n readonly values: readonly unknown[];\n readonly type: string;\n readonly processor: TemplateProcessor;\n\n constructor(\n strings: TemplateStringsArray, values: readonly 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 l = this.strings.length - 1;\n let html = '';\n let isCommentBinding = false;\n\n for (let i = 0; i < l; i++) {\n const s = this.strings[i];\n // For each binding we want to determine the kind of marker to insert\n // into the template source before it's parsed by the browser's HTML\n // parser. The marker type is based on whether the expression is in an\n // attribute, text, or comment position.\n // * For node-position bindings we insert a comment with the marker\n // sentinel as its text content, like <!--{{lit-guid}}-->.\n // * For attribute bindings we insert just the marker sentinel for the\n // first binding, so that we support unquoted attribute bindings.\n // Subsequent bindings can use a comment marker because multi-binding\n // attributes must be quoted.\n // * For comment bindings we insert just the marker sentinel so we don't\n // close the comment.\n //\n // The following code scans the template source, but is *not* an HTML\n // parser. We don't need to track the tree structure of the HTML, only\n // whether a binding is inside a comment, and if not, if it appears to be\n // the first binding in an attribute.\n const commentOpen = s.lastIndexOf('<!--');\n // We're in comment position if we have a comment open with no following\n // comment close. Because <-- can appear in an attribute value there can\n // be false positives.\n isCommentBinding = (commentOpen > -1 || isCommentBinding) &&\n s.indexOf('-->', commentOpen + 1) === -1;\n // Check to see if we have an attribute-like sequence preceding the\n // expression. This can match \"name=value\" like structures in text,\n // comments, and attribute values, so there can be false-positives.\n const attributeMatch = lastAttributeNameRegex.exec(s);\n if (attributeMatch === null) {\n // We're only in this branch if we don't have a attribute-like\n // preceding sequence. For comments, this guards against unusual\n // attribute values like <div foo=\"<!--${'bar'}\">. Cases like\n // <!-- foo=${'bar'}--> are handled correctly in the attribute branch\n // below.\n html += s + (isCommentBinding ? commentMarker : nodeMarker);\n } else {\n // For attributes we use just a marker sentinel, and also append a\n // $lit$ suffix to the name to opt-out of attribute-specific parsing\n // that IE and Edge do for style and certain SVG attributes.\n html += s.substr(0, attributeMatch.index) + attributeMatch[1] +\n attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] +\n marker;\n }\n }\n html += this.strings[l];\n return html;\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};\nexport const isIterable = (value: unknown): value is Iterable<unknown> => {\n return Array.isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n !!(value && (value as any)[Symbol.iterator]);\n};\n\n/**\n * Writes attribute values to the DOM for a group of AttributeParts bound to a\n * single attribute. The value is only set once even if there are multiple parts\n * for an attribute.\n */\nexport class AttributeCommitter {\n readonly element: Element;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n readonly parts: ReadonlyArray<AttributePart>;\n dirty = true;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<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 as AttributePart[])[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 (isPrimitive(v) || !isIterable(v)) {\n text += typeof v === 'string' ? v : String(v);\n } else {\n for (const t of v) {\n text += typeof t === 'string' ? t : String(t);\n }\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\n/**\n * A Part that controls all or part of an attribute value.\n */\nexport class AttributePart implements Part {\n readonly committer: AttributeCommitter;\n value: unknown = undefined;\n\n constructor(committer: AttributeCommitter) {\n this.committer = committer;\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\n/**\n * A Part that controls a location within a Node tree. Like a Range, NodePart\n * has start and end locations and can set and update the Nodes between those\n * locations.\n *\n * NodeParts support several value types: primitives, Nodes, TemplateResults,\n * as well as arrays and iterables of those types.\n */\nexport class NodePart implements Part {\n readonly options: RenderOptions;\n startNode!: Node;\n endNode!: Node;\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(options: RenderOptions) {\n this.options = options;\n }\n\n /**\n * Appends 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 after the `ref` node (between `ref` and `ref`'s next\n * sibling). Both `ref` and its next sibling must be static, unchanging nodes\n * such as those that appear 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 * Inserts this part after the `ref` part.\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 if (this.startNode.parentNode === null) {\n return;\n }\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 (isIterable(value)) {\n this.__commitIterable(value);\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 `value` isn't already a string, we explicitly convert it here in case\n // it can't be implicitly converted - i.e. it's a symbol.\n const valueAsString: string =\n typeof value === 'string' ? value : String(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 = valueAsString;\n } else {\n this.__commitNode(document.createTextNode(valueAsString));\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 readonly element: Element;\n readonly name: string;\n readonly strings: readonly string[];\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(element: Element, name: string, strings: readonly 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 this.value = value;\n }\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 readonly single: boolean;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<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 protected _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 // eslint-disable-next-line @typescript-eslint/no-explicit-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 third\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\n// Wrap into an IIFE because MS Edge <= v41 does not support having try/catch\n// blocks right into the body of a module\n(() => {\n try {\n const options = {\n get capture() {\n eventOptionsSupported = true;\n return false;\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.addEventListener('test', options as any, options);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.removeEventListener('test', options as any, options);\n } catch (_e) {\n // event options not supported\n }\n})();\n\ntype EventHandlerWithOptions =\n EventListenerOrEventListenerObject&Partial<AddEventListenerOptions>;\nexport class EventPart implements Part {\n readonly element: Element;\n readonly eventName: string;\n readonly eventContext?: EventTarget;\n value: undefined|EventHandlerWithOptions = undefined;\n private __options?: AddEventListenerOptions;\n private __pendingValue: undefined|EventHandlerWithOptions = undefined;\n private readonly __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): ReadonlyArray<Part> {\n const prefix = name[0];\n if (prefix === '.') {\n const committer = new PropertyCommitter(element, name.slice(1), strings);\n return committer.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 committer = new AttributeCommitter(element, name, strings);\n return committer.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 behavior, 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 interface TemplateCache {\n readonly stringsArray: WeakMap<TemplateStringsArray, Template>;\n readonly 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';\n\nexport const parts = new WeakMap<Node, NodePart>();\n\n/**\n * Renders a template result or other value 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 Any value renderable by NodePart - typically a TemplateResult\n * created by evaluating a template tag like `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: unknown,\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, isIterable, 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\nif (typeof window !== 'undefined') {\n (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.2.1');\n}\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 = -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 (scopeName: string, renderedDOM: DocumentFragment, template?: Template) => {\n shadyRenderSet.add(scopeName);\n // If `renderedDOM` is stamped from a Template, then we need to edit that\n // Template's underlying template element. Otherwise, we create one here\n // to give to ShadyCSS, which still requires one while scoping.\n const templateElement =\n !!template ? template.element : document.createElement('template');\n // Move styles out of rendered DOM and store.\n const styles = renderedDOM.querySelectorAll('style');\n const {length} = styles;\n // If there are no styles, skip unnecessary work\n if (length === 0) {\n // Ensure prepareTemplateStyles is called to support adding\n // styles via `prepareAdoptedCssText` since that requires that\n // `prepareTemplateStyles` is called.\n //\n // ShadyCSS will only update styles containing @apply in the template\n // given to `prepareTemplateStyles`. If no lit Template was given,\n // ShadyCSS will not be able to update uses of @apply in any relevant\n // template. However, this is not a problem because we only create the\n // template for the purpose of supporting `prepareAdoptedCssText`,\n // which doesn't support @apply at all.\n window.ShadyCSS!.prepareTemplateStyles(templateElement, 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 < 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 const content = templateElement.content;\n if (!!template) {\n insertNodeIntoTemplate(template, condensedStyle, content.firstChild);\n } else {\n content.insertBefore(condensedStyle, content.firstChild);\n }\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(templateElement, scopeName);\n const style = content.querySelector('style');\n if (window.ShadyCSS!.nativeShadow && style !== null) {\n // When in native Shadow DOM, ensure the style created by ShadyCSS is\n // included in initially rendered output (`renderedDOM`).\n renderedDOM.insertBefore(style.cloneNode(true), renderedDOM.firstChild);\n } else if (!!template) {\n // When no style is left in the template, 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 // There can be no style in the template in 2 cases (1) when Shady DOM\n // is in use, ShadyCSS removes all styles, (2) when native Shadow DOM\n // is in use ShadyCSS removes the style if it contains no content.\n // NOTE, ShadyCSS creates its own style so we can safely add/remove\n // `condensedStyle` here.\n content.insertBefore(condensedStyle, content.firstChild);\n const removes = new Set<Node>();\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: unknown,\n container: Element|DocumentFragment|ShadowRoot,\n options: ShadyRenderOptions) => {\n if (!options || typeof options !== 'object' || !options.scopeName) {\n throw new Error('The `scopeName` option is required.');\n }\n const scopeName = options.scopeName;\n const hasRendered = parts.has(container);\n const needsScoping = compatibleShadyCSSVersion &&\n container.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */ &&\n !!(container as ShadowRoot).host;\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 // ShadyCSS might have style sheets (e.g. from `prepareAdoptedCssText`)\n // that should apply to `renderContainer` even if the rendered value is\n // not a TemplateInstance. However, it will only insert scoped styles\n // into the document if `prepareTemplateStyles` has already been called\n // for the given scope name.\n const template = part.value instanceof TemplateInstance ?\n part.value.template :\n undefined;\n prepareTemplateStyles(\n scopeName, renderContainer as DocumentFragment, template);\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 `ShadyCSS.styleElement`\n // for dynamic changes.\n if (!hasRendered && needsScoping) {\n window.ShadyCSS!.styleElement((container as ShadowRoot).host);\n }\n };\n", "import { StyledElement } from './StyledElement';\nimport { html } from 'lit-html';\nimport { render } from 'lit-html/lib/shady-render.js';\nexport { i18n } from './util/i18n';\n\nclass TemplateElement extends StyledElement {\n\tconstructor(options) {\n\t\tsuper({\n\t\t\tdeferUpdate: false,\n\t\t\tshadowRender: false,\n\t\t\tstyles: [],\n\t\t\tadoptGlobalStyles: true,\n\t\t\tmutationObserverOptions: {\n\t\t\t\tchildList: false,\n\t\t\t},\n\t\t\t...options,\n\t\t});\n\t\tthis._template = this._options.template;\n\n\t\tif (this._options.shadowRender) this.attachShadow({ mode: 'open' });\n\t}\n\n\ttemplate() {\n\t\treturn html``;\n\t}\n\n\tupdate(options) {\n\t\tthis.renderTemplate();\n\t\tsuper.update(options);\n\t}\n\n\trenderTemplate() {\n\t\tconst template = this._template || this.template();\n\t\tif (typeof template === 'string') {\n\t\t\t// just a plain string literal. no lit-html required\n\t\t\tthis.getRoot().innerHTML = `${template}`;\n\t\t} else {\n\t\t\t// render via lit-html\n\t\t\trender(html` ${template} `, this.getRoot(), {\n\t\t\t\tscopeName: this.localName,\n\t\t\t\teventContext: this,\n\t\t\t});\n\t\t}\n\t}\n\n\tgetRoot() {\n\t\treturn this.shadowRoot !== null ? this.shadowRoot : this;\n\t}\n}\n\nexport { TemplateElement, html, render };\n"],
5
- "mappings": ";;;;;;;;;;AAAO,sBAAsB,OAAO;AACnC,SAAO,OAAO,SAAS,YAAY,UAAU;AAAA;AAGvC,gBAAgB,KAAK;AAC3B,MAAI;AACH,WAAO,KAAK,MAAM,QAAQ,CAAC,CAAC;AAAA,WACpB,GAAP;AACD,WAAO;AAAA;AAAA;AAIF,mBAAmB,OAAO;AAChC,SAAO,UAAU,UAAU,UAAU;AAAA;AAG/B,sBAAsB,OAAO;AACnC,SAAO,UAAU;AAAA;AAGX,kBAAkB,OAAO;AAC/B,SACC,OAAO,UAAU,YAChB,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,OAAO,UAAU,SAAS,KAAK,WAAW;AAAA;AAI9E,kBAAkB,OAAO;AAC/B,SAAO,IAAI,OAAO,wCAAwC,KAAK;AAAA;AAGzD,eAAe,OAAO;AAC5B,SAAO,OAAO,MAAM;AAAA;AAGd,wBAAwB,OAAO,UAAU,IAAI;AACnD,MAAI,QAAQ,UAAU,SAAS,CAAC,SAAS,QAAQ;AAEhD,WAAO;AAAA;AAER,MAAI,OAAO,QAAQ,UAAU,YAAY;AAExC,WAAO,QAAQ,MAAM;AAAA;AAItB,MAAI,cAAc;AAElB,MAAI,OAAO;AAAQ,kBAAc,KAAK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AU,aAAa,MACvB,CAAC,CAAE,UAAyB;AAEhC,QAAM,mBAAmB,gBAAgB,CAAC,eAAe,IAAI;AAG7D,QAAM,kBACF,mBAAmB,SAAS,2BAA2B;AAC3D,SACI,QACA,iBACA,OAAA,OAAA,CAAC,iBAAiB,qBAAqB,aAAe;AAW1D,MAAI,kBAAkB;AACpB,UAAM,OAAO,MAAM,IAAI;AACvB,UAAM,OAAO;AAMb,UAAM,WAAW,KAAK,iBAAiB,mBACnC,KAAK,MAAM,WACX;AACJ,0BACI,WAAW,iBAAqC;AACpD,gBAAY,WAAW,UAAU;AACjC,cAAU,YAAY;AACtB,UAAM,IAAI,WAAW;;AAQvB,MAAI,CAAC,eAAe,cAAc;AAChC,WAAO,SAAU,aAAc,UAAyB;;;;;ACrThE,oCAA8B,cAAc;AAAA,EAC3C,YAAY,SAAS;AACpB,UAAM;AAAA,MACL,aAAa;AAAA,MACb,cAAc;AAAA,MACd,QAAQ;AAAA,MACR,mBAAmB;AAAA,MACnB,yBAAyB;AAAA,QACxB,WAAW;AAAA;AAAA,SAET;AAAA;AAEJ,SAAK,YAAY,KAAK,SAAS;AAE/B,QAAI,KAAK,SAAS;AAAc,WAAK,aAAa,CAAE,MAAM;AAAA;AAAA,EAG3D,WAAW;AACV,WAAO;AAAA;AAAA,EAGR,OAAO,SAAS;AACf,SAAK;AACL,UAAM,OAAO;AAAA;AAAA,EAGd,iBAAiB;AAChB,UAAM,WAAW,KAAK,aAAa,KAAK;AACxC,QAAI,OAAO,aAAa,UAAU;AAEjC,WAAK,UAAU,YAAY,GAAG;AAAA,WACxB;AAEN,cAAO,QAAQ,aAAa,KAAK,WAAW;AAAA,QAC3C,WAAW,KAAK;AAAA,QAChB,cAAc;AAAA;AAAA;AAAA;AAAA,EAKjB,UAAU;AACT,WAAO,KAAK,eAAe,OAAO,KAAK,aAAa;AAAA;AAAA;",
4
+ "sourcesContent": ["export function isObjectLike(value) {\n\treturn typeof value == 'object' && value !== null;\n}\n\nexport function isJSON(str) {\n\ttry {\n\t\treturn JSON.parse(str) && !!str;\n\t} catch (e) {\n\t\treturn false;\n\t}\n}\n\nexport function isBoolean(value) {\n\treturn value === 'true' || value === 'false';\n}\n\nexport function parseBoolean(value) {\n\treturn value === 'true';\n}\n\nexport function isString(value) {\n\treturn (\n\t\ttypeof value === 'string' ||\n\t\t(!!value && typeof value === 'object' && Object.prototype.toString.call(value) === '[object String]')\n\t);\n}\n\nexport function isNumber(value) {\n\treturn new RegExp('^-?(0|0\\\\.\\\\d+|[1-9]\\\\d*(\\\\.\\\\d+)?)$').test(value);\n}\n\nexport function isNaN(value) {\n\treturn Number.isNaN(value);\n}\n\nexport function parseAttribute(value, options = {}) {\n\tif (options.parse === false || !isString(value)) {\n\t\t// no-op\n\t\treturn value;\n\t}\n\tif (typeof options.parse === 'function') {\n\t\t// custom parse fn\n\t\treturn options.parse(value);\n\t}\n\n\t// default parse\n\tlet parsedValue = value;\n\n\tif (isJSON(value)) parsedValue = JSON.parse(value);\n\telse if (isBoolean(value)) parsedValue = parseBoolean(value);\n\telse if (isNumber(value)) parsedValue = parseFloat(value);\n\n\treturn parsedValue;\n}\n\n/**\n * Replaces dashed-expression (i.e. some-value) to a camel-cased expression (i.e. someValue)\n * @returns string\n */\nexport function dashToCamel(string) {\n\tif (string.indexOf('-') === -1) return string;\n\n\treturn string.replace(/-[a-z]/g, (matches) => matches[1].toUpperCase());\n}\n\n/**\n * Replaces camel-cased expression (i.e. someValue) to a dashed-expression (i.e. some-value)\n * @returns string\n */\nexport function camelToDash(string) {\n\treturn string.replace(/([A-Z])/g, '-$1').toLowerCase();\n}\n\n/**\n * Decodes an attribute. Can only be encoded with the `encodeAttribute` method which\n * is exported from this file.\n *\n * @param attribute\n * @returns {string}\n */\nexport function decodeAttribute(attribute) {\n\treturn `${attribute}`\n\t\t.replace(/\\$lt;/g, '<')\n\t\t.replace(/\\$gt;/g, '>')\n\t\t.replace(/\\$quot;/g, '\"')\n\t\t.replace(/\\$apos;/g, \"'\");\n}\n\n/**\n * Encodes an attribute. Can only be decoded with the `decodeAttribute` method which\n * is exported from this file.\n *\n * This does not use the standard way to encode an attribute, as the dom parser\n * that renders the html would understand and automatically decode it. Which results\n * in non sanitized html output.\n *\n * @param attribute\n * @returns {string}\n */\nexport function encodeAttribute(attribute) {\n\treturn `${attribute}`\n\t\t.replace(/'/g, '$apos;')\n\t\t.replace(/\"/g, '$quot;')\n\t\t.replace(/</g, '$lt;')\n\t\t.replace(/>/g, '$gt;')\n\t\t.replace(/\\r\\n/g, '\\n')\n\t\t.replace(/[\\r\\n]/g, '\\n');\n}\n", "export function getAllParentNodes(domNode) {\n\tlet node = domNode.parentElement;\n\tlet parents = [];\n\twhile (node) {\n\t\tparents.unshift(node); // adds node to the beginning of parents\n\t\tnode = node.parentElement;\n\t}\n\n\treturn parents;\n}\n\n// https://stackoverflow.com/questions/27453617/how-can-i-tell-if-an-element-is-in-a-shadow-dom\nexport function getShadowParentOrBody(element) {\n\tif (element instanceof ShadowRoot) {\n\t\treturn element;\n\t}\n\n\twhile (element.parentNode && (element = element.parentNode)) {\n\t\tif (element instanceof ShadowRoot) {\n\t\t\treturn element;\n\t\t}\n\t}\n\treturn document.body;\n}\n\n// TODO: add function for getClosestParentOfNodeType('custom-element')\n\nexport function getClosestParentCustomElementNode(domNode) {\n\tconst customElementParents = getAllParentNodes(domNode).filter((node) => {\n\t\treturn node.localName && node.localName.indexOf('-') !== -1;\n\t});\n\n\treturn customElementParents.pop();\n}\n\nexport function isOfSameNodeType(nodeA, nodeB) {\n\tif (!nodeA && !nodeA.localName) return false;\n\tif (!nodeB && !nodeB.localName) return false;\n\treturn nodeA.localName === nodeB.localName;\n}\n\nexport const supportsAdoptingStyleSheets = () =>\n\t'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype;\n\n// for IE11 we are using the ShadyDOM Polyfill. With the polyfill we cannot append stylesheets to the shadowRoot\nexport const supportsAppendingStyleSheets = !window.ShadyDOM;\n", "import { isObjectLike } from './AttributeParser';\n\nexport class Store {\n\t_observer = new Set();\n\t_singlePropertyMode = false;\n\t_state = {};\n\n\tconstructor(value) {\n\t\t// wrap primitives with a generic \"value\" field to generate getter and setter\n\t\tthis._singlePropertyMode = arguments.length > 0 && !isObjectLike(value);\n\t\tconst specificValues = this._singlePropertyMode ? { value } : value;\n\t\tthis._state = { ...(!this._singlePropertyMode && this.properties()), ...specificValues };\n\n\t\tObject.entries(this._state).map(([key, value]) => {\n\t\t\tObject.defineProperty(this, key, {\n\t\t\t\tget: () => {\n\t\t\t\t\treturn this._state[key];\n\t\t\t\t},\n\t\t\t\tset: (newValue) => {\n\t\t\t\t\tconst oldValue = this._state[key];\n\t\t\t\t\tthis._state[key] = newValue;\n\t\t\t\t\tconst watch = this.watch();\n\t\t\t\t\tif (watch.hasOwnProperty(key) && typeof watch[key] === 'function') {\n\t\t\t\t\t\twatch[key](newValue, oldValue);\n\t\t\t\t\t}\n\t\t\t\t\tthis.requestUpdate();\n\t\t\t\t},\n\t\t\t});\n\t\t});\n\t}\n\n\tproperties() {\n\t\treturn {};\n\t}\n\n\t/**\n\t * When a property as the key was changed in the store, the callback function defined as value\n\t * will be called with `newValue` and `oldValue`\n\t * eg. { property: (oldValue, newValue) => { console.log('property changed!, oldValue, newValue); } }\n\t * @return {{}}\n\t */\n\twatch() {\n\t\treturn {};\n\t}\n\n\tvalueOf() {\n\t\treturn this._singlePropertyMode ? this._state.value : this._state;\n\t}\n\n\ttoString() {\n\t\treturn `${this._singlePropertyMode ? this._state.value : this._state}`;\n\t}\n\n\t/**\n\t * @param {BaseElement|Function} observer\n\t */\n\tsubscribe(observer) {\n\t\tthis._observer.add(observer);\n\t}\n\t/**\n\t * @param {BaseElement|Function} observer\n\t */\n\tunsubscribe(observer) {\n\t\tthis._observer.delete(observer);\n\t}\n\n\trequestUpdate() {\n\t\tthis._observer.forEach((observer) =>\n\t\t\ttypeof observer.requestUpdate === 'function' ? observer.requestUpdate() : observer(),\n\t\t);\n\t}\n}\n", "/**\n * Wrapper for defining custom elements so that registering an element multiple times won't crash\n * @param name for the tag\n * @param constructor for the custom element\n */\nexport function defineElement(name, constructor) {\n\ttry {\n\t\tcustomElements.define(name, constructor);\n\t} catch (e) {\n\t\t// console.log('error defining custom element', e);\n\t}\n}\n", "/**\n * Little wrapper function for JSON.stringify() to easily convert objects and arrays to strings\n * to be able to set them as attributes on custom elements\n * @param value to be stringified\n * @return String of the stringified value\n */\nexport function toString(value) {\n\ttry {\n\t\treturn JSON.stringify(value);\n\t} catch (e) {\n\t\treturn '';\n\t}\n}\n", "import { parseAttribute, isNaN, dashToCamel, camelToDash, isObjectLike } from './util/AttributeParser.js';\nimport { getClosestParentCustomElementNode, isOfSameNodeType } from './util/DOMHelper.js';\nimport { Store } from './util/Store.js';\n\nexport { defineElement } from './util/defineElement';\nexport { toString } from './util/toString';\n\nclass BaseElement extends HTMLElement {\n\tconstructor(options = {}) {\n\t\tsuper();\n\t\tthis.$refs = {};\n\t\tthis._state = {};\n\t\tthis._mutationObserver = null;\n\t\tthis._registeredEvents = [];\n\t\tthis._batchUpdate = null;\n\t\tthis._requestedUpdates = [];\n\t\tthis._options = {\n\t\t\tautoUpdate: true,\n\t\t\tdeferUpdate: true,\n\t\t\tmutationObserverOptions: {\n\t\t\t\tattributes: true,\n\t\t\t\tchildList: true,\n\t\t\t\tsubtree: false,\n\t\t\t\t...options.mutationObserverOptions,\n\t\t\t},\n\t\t\tpropertyOptions: {},\n\t\t\t...options,\n\t\t};\n\n\t\tif (options.childListUpdate !== undefined && options.childListUpdate !== null) {\n\t\t\tthis._options.mutationObserverOptions.childList = options.childListUpdate;\n\t\t\tconsole.warn(\n\t\t\t\t`[${this.localName}] Using the \"childListUpdate\" option is deprecated and will be removed before 1.0! Please use the \"mutationObserverOptions\" dictionary instead. See the docs for more info`,\n\t\t\t);\n\t\t}\n\t}\n\n\tconnectedCallback() {\n\t\t// define all attributes to \"this\" as properties\n\t\tthis.defineAttributesAsProperties();\n\n\t\t// define all properties to \"this\"\n\t\tthis.defineProperties();\n\n\t\t// define all computed properties to \"this\"\n\t\tthis.defineComputedProperties();\n\n\t\t// define everything that should be observed\n\t\tthis.defineObserver();\n\n\t\tif (this.hasAttribute('defer-update') || this._options.deferUpdate) {\n\t\t\t// don't updates/render, but register refs and events\n\t\t\tthis.registerEventsAndRefs();\n\n\t\t\tthis.triggerHook('connected');\n\t\t} else {\n\t\t\tthis.requestUpdate({ notify: false }).then(() => {\n\t\t\t\tthis.triggerHook('connected');\n\t\t\t});\n\t\t}\n\t}\n\n\tdefineObserver() {\n\t\t// see: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver#Example_usage\n\t\tthis._mutationObserver = new MutationObserver((mutations) => {\n\t\t\tmutations.forEach((mutation) => {\n\t\t\t\tif (\n\t\t\t\t\tmutation.type === 'attributes' &&\n\t\t\t\t\tmutation.target === this &&\n\t\t\t\t\tthis._state.hasOwnProperty(dashToCamel(mutation.attributeName))\n\t\t\t\t) {\n\t\t\t\t\t// update property by invoking the setter\n\t\t\t\t\tthis[dashToCamel(mutation.attributeName)] = parseAttribute(\n\t\t\t\t\t\tthis.getAttribute(mutation.attributeName),\n\t\t\t\t\t\tthis._options.propertyOptions[dashToCamel(mutation.attributeName)],\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (mutation.type === 'attributes' && mutation.target !== this) {\n\t\t\t\t\tthis.requestUpdate();\n\t\t\t\t}\n\t\t\t\tif (mutation.type === 'childList') {\n\t\t\t\t\tthis.requestUpdate();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tthis._mutationObserver.observe(this, {\n\t\t\tattributes: true,\n\t\t\tchildList: true,\n\t\t\tsubtree: false,\n\t\t\t...this._options.mutationObserverOptions,\n\t\t});\n\t}\n\n\tdisconnectedCallback() {\n\t\t// remove events for elements in the component\n\t\tthis.removeEvents();\n\n\t\t// remove observers\n\t\tif (this._mutationObserver) this._mutationObserver.disconnect();\n\n\t\t// unsubscribe from stores\n\t\tObject.values(this.properties()).forEach((property) => {\n\t\t\tif (property instanceof Store) {\n\t\t\t\tproperty.unsubscribe(this);\n\t\t\t}\n\t\t});\n\n\t\tthis.triggerHook('disconnected');\n\t}\n\n\trequestUpdate(options = { notify: true }) {\n\t\tif (options.notify === true) {\n\t\t\tthis.triggerHook('beforeUpdate');\n\t\t}\n\n\t\tif (this._batchUpdate) {\n\t\t\tcancelAnimationFrame(this._batchUpdate);\n\t\t\tthis._batchUpdate = false;\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis._requestedUpdates.push({ resolve, reject });\n\t\t\tthis._batchUpdate = requestAnimationFrame(() => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.update(options);\n\t\t\t\t\tthis._requestedUpdates.forEach(({ resolve, reject }) => resolve());\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// console.error('Update error', e)\n\t\t\t\t\tthis._requestedUpdates.forEach(({ resolve, reject }) => reject(e));\n\t\t\t\t}\n\t\t\t\tthis._requestedUpdates = [];\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * This should be called by the template component AFTER adding the template to\n\t * the DOM.\n\t * Here we will register the events and the refs for the element.\n\t */\n\tupdate(options = { notify: true }) {\n\t\tthis.registerEventsAndRefs();\n\t\tif (options.notify === true) {\n\t\t\tthis.triggerHook('afterUpdate');\n\t\t}\n\t}\n\n\t/**\n\t * Register events and refs for the component\n\t */\n\tregisterEventsAndRefs() {\n\t\t// register events for elements in the component\n\t\tthis.registerEvents();\n\n\t\t// register $refs\n\t\tthis.registerRefs();\n\t}\n\n\t/**\n\t * Defines all attributes assigned in the HTML for the element as properties on the element\n\t * If the value for an attribute can be parsed to an object or array, it will do so\n\t */\n\tdefineAttributesAsProperties() {\n\t\tconst ignoreAttributes = ['class', 'style'];\n\t\tArray.from(this.attributes)\n\t\t\t.filter((attribute) => {\n\t\t\t\treturn !ignoreAttributes.includes(attribute.name);\n\t\t\t})\n\t\t\t.forEach((attribute) => {\n\t\t\t\tconst name = dashToCamel(attribute.name);\n\t\t\t\tconst parseOptions = this._options.propertyOptions[name];\n\t\t\t\tthis.defineProperty(name, parseAttribute(attribute.value, parseOptions), true);\n\t\t\t});\n\t}\n\n\t/**\n\t * Properties to be defined and assigned on the element. Should be overwritten in child components\n\t * Properties defined here will also trigger a update() when changed.\n\t * eg. { stringProperty: 'value', numberProperty: 13, booleanProperty: true } }\n\t * @return {{}}\n\t */\n\tproperties() {\n\t\treturn {};\n\t}\n\n\t/**\n\t * Defines properties on the element based on keys from this.properties()\n\t * Will trigger update() when a property was changed\n\t */\n\tdefineProperties() {\n\t\tObject.keys(this.properties()).forEach((prop) => {\n\t\t\t// when mixing shadow dom elements with light dom elements and nesting custom elements\n\t\t\t// it might occur that properties where set on an element before it was\n\t\t\t// registered or connected. To avoid such timing issues we check\n\t\t\t// if a value was set for that specific property on the\n\t\t\t// prototype before assigning a default value\n\t\t\tconst value = this[prop] || this.properties()[prop];\n\t\t\tthis.defineProperty(prop, value);\n\t\t});\n\t}\n\n\t/**\n\t * Define a property on the element\n\t * Will trigger watch() function when a property was changed\n\t * Will trigger update() when a property was changed\n\t */\n\tdefineProperty(property, value, reflectAttribute = false) {\n\t\tif (value instanceof Store) {\n\t\t\tvalue.subscribe(this);\n\t\t}\n\n\t\tif (this._state.hasOwnProperty(property)) {\n\t\t\t// property has already been defined as an attribute nothing to do here\n\t\t\treturn;\n\t\t}\n\n\t\t// if property did not come from an attribute but has the option to reflect // enabled or custom fn\n\t\tif (!reflectAttribute && this._options.propertyOptions[property]?.reflect) {\n\t\t\tthis.reflectProperty({ property: property, newValue: value });\n\t\t}\n\n\t\t// remove attribute if reflect is set to false explicitly in options\n\t\tif (this._options.propertyOptions[property]?.reflect === false) {\n\t\t\tthis.removeAttribute(camelToDash(property));\n\t\t}\n\n\t\tthis._state[property] = value;\n\n\t\tObject.defineProperty(this, property, {\n\t\t\tget: () => {\n\t\t\t\treturn this._state[property];\n\t\t\t},\n\t\t\tset: (newValue) => {\n\t\t\t\tconst oldValue = this._state[property];\n\t\t\t\tconst newValueString = JSON.stringify(newValue);\n\n\t\t\t\tif (JSON.stringify(oldValue) !== newValueString) {\n\t\t\t\t\tthis._state[property] = newValue;\n\n\t\t\t\t\tif (reflectAttribute || this._options.propertyOptions[property]?.reflect) {\n\t\t\t\t\t\tthis.reflectProperty({ property, newValue, newValueString });\n\t\t\t\t\t}\n\n\t\t\t\t\tconst informWatchedPropertiesAndDispatchChangeEvent = () => {\n\t\t\t\t\t\t// notify watched properties (after update())\n\t\t\t\t\t\tif (property in this.watch()) {\n\t\t\t\t\t\t\tthis.watch()[property](newValue, oldValue);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// dispatch change event\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tproperty in this._options['propertyOptions'] &&\n\t\t\t\t\t\t\tthis._options['propertyOptions'][property]['notify'] === true\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthis.dispatch(`${camelToDash(property)}-changed`, newValue, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tif (this._options.autoUpdate) {\n\t\t\t\t\t\tthis.requestUpdate({\n\t\t\t\t\t\t\tnotify: true,\n\t\t\t\t\t\t\tproperty: property,\n\t\t\t\t\t\t\tnewValue: newValue,\n\t\t\t\t\t\t\tnewValueString: newValueString,\n\t\t\t\t\t\t\toldValue: oldValue,\n\t\t\t\t\t\t}).finally(() => {\n\t\t\t\t\t\t\tinformWatchedPropertiesAndDispatchChangeEvent();\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinformWatchedPropertiesAndDispatchChangeEvent();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn this;\n\t\t\t},\n\t\t});\n\t}\n\n\treflectProperty(options) {\n\t\tconst { property, newValue } = options;\n\t\tconst newValueString = options.newValueString || JSON.stringify(newValue);\n\n\t\tif (newValue === undefined || newValue === null || isNaN(newValue)) {\n\t\t\t// these would be reflected as strings: \"undefined\" || \"null\" || \"NaN\"\n\t\t\t// which is not the desired behaviour. Therefore we reflect them as empty strings\n\t\t\tthis.setAttribute(camelToDash(property), '');\n\t\t} else {\n\t\t\tlet attributeValue = isObjectLike(newValue) ? newValueString : newValue;\n\t\t\tif (typeof this._options.propertyOptions[property]?.reflect === 'function') {\n\t\t\t\tattributeValue = this._options.propertyOptions[property].reflect(newValue);\n\t\t\t}\n\t\t\tthis.setAttribute(camelToDash(property), attributeValue);\n\t\t}\n\t}\n\n\t// Deprecated\n\thooks() {\n\t\treturn {};\n\t}\n\n\t// Connected lifecycle hook\n\tconnected() {}\n\n\t// BeforeUpdate lifecycle hook\n\tbeforeUpdate() {}\n\n\t// AfterUpdate lifecycle hook\n\tafterUpdate() {}\n\n\t// Disconnected lifecycle hook\n\tdisconnected() {}\n\n\t// Triggers a lifecycle hook based on the name\n\ttriggerHook(name) {\n\t\tif (this.hooks && name in this.hooks()) {\n\t\t\tconsole.warn(\n\t\t\t\t`[${this.localName}] Using the hooks() map for lifecycle hooks is deprecated! Please overwrite the existing lifecycle hook functions. See the docs for more info`,\n\t\t\t);\n\t\t\tthis.hooks()[name]();\n\t\t\treturn;\n\t\t}\n\n\t\tif (name in this) {\n\t\t\tthis[name]();\n\t\t}\n\t}\n\n\t/**\n\t * Watched attributes & properties to be notified to the element when changed. Should be overwritten in child components\n\t * When an attribute or property as the key was changed on the element, the callback function defined as value\n\t * will be called with `newValue` and `oldValue`\n\t * eg. { property: (oldValue, newValue) => { console.log('property changed!, oldValue, newValue); } }\n\t * @return {{}}\n\t */\n\twatch() {\n\t\treturn {};\n\t}\n\n\t// Deprecated\n\tcomputed() {\n\t\treturn {};\n\t}\n\n\t// Deprecated\n\tdefineComputedProperties() {\n\t\tObject.keys(this.computed()).forEach((prop) => {\n\t\t\tif (!this.hasOwnProperty(prop)) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[${this.localName}] Using the computed() map for computed properties is deprecated! Please use regular JS getters and return the computed value. See the docs for more info`,\n\t\t\t\t);\n\t\t\t\tObject.defineProperty(this, prop, {\n\t\t\t\t\tget: () => this.computed()[prop](),\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Return a map of events that should be registered on the element.\n\t * eg. { '.link': {\n\t * 'click': (e) => {console.log('MyElement.link - clicked', e)},\n\t * 'mouseover': (e) => {console.log('MyElement.link - mouseover()', e)},\n\t * }\n\t * }\n\t */\n\tevents() {\n\t\treturn {};\n\t}\n\n\t/**\n\t * Registers events on the element based on events().\n\t * Removes all previously registered events before adding them.\n\t */\n\tregisterEvents() {\n\t\t// remove all previously registered events to prevent duplicate triggers\n\t\tthis.removeEvents();\n\n\t\t// register events\n\t\tconst eventDefinitions = this.events();\n\t\tObject.keys(eventDefinitions).forEach((elementSelector) => {\n\t\t\tconst events = eventDefinitions[elementSelector];\n\t\t\tconst selectorWhiteList = { window, document, this: this.getRoot() };\n\t\t\tconst whiteListElement = selectorWhiteList[elementSelector];\n\t\t\tconst eventTargets = whiteListElement\n\t\t\t\t? [whiteListElement]\n\t\t\t\t: this.getRoot().querySelectorAll(elementSelector);\n\n\t\t\teventTargets.forEach((eventTarget) => {\n\t\t\t\tObject.keys(events).forEach((eventName) => {\n\t\t\t\t\tconst notation = events[eventName];\n\t\t\t\t\tif (typeof notation === 'function') {\n\t\t\t\t\t\tconst callback = notation.bind(this);\n\t\t\t\t\t\teventTarget.addEventListener(eventName, callback);\n\t\t\t\t\t\tthis._registeredEvents.push({ eventTarget, eventName, callback });\n\t\t\t\t\t} else if (typeof notation === 'object' && typeof notation.listener === 'function') {\n\t\t\t\t\t\tconst callback = notation.listener.bind(this);\n\t\t\t\t\t\teventTarget.addEventListener(eventName, callback, notation.options ?? {});\n\t\t\t\t\t\tthis._registeredEvents.push({ eventTarget, eventName, callback });\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Removes all events from the element that where previously registered from the events() map.\n\t */\n\tremoveEvents() {\n\t\tthis._registeredEvents.forEach(({ eventTarget, eventName, callback }) => {\n\t\t\tif (eventTarget === window || eventTarget === document || this.getRoot().contains(eventTarget)) {\n\t\t\t\teventTarget.removeEventListener(eventName, callback);\n\t\t\t}\n\t\t});\n\t\tthis._registeredEvents = [];\n\t}\n\n\t/**\n\t * Stores an object that references child elements & DOM nodes that have a ref attribute defined.\n\t * References will be accessible on the element under this.$refs\n\t */\n\tregisterRefs() {\n\t\tconst refsNodeList = this.getRoot().querySelectorAll('[ref]');\n\t\tconst refsArray = Array.from(refsNodeList);\n\t\tconst refsMap = {};\n\n\t\trefsArray.forEach((refNode) => {\n\t\t\tconst refKey = refNode.getAttribute('ref');\n\t\t\tconst isListKey = refKey.endsWith('[]');\n\t\t\tconst cleanKey = isListKey ? refKey.slice(0, -2) : refKey;\n\t\t\tconst hasListRef = Array.isArray(refsMap[cleanKey]);\n\n\t\t\tif (isListKey) {\n\t\t\t\tif (!refsMap[cleanKey] || !hasListRef) {\n\t\t\t\t\t// create or overwrite previously registered single ref\n\t\t\t\t\trefsMap[cleanKey] = [];\n\t\t\t\t}\n\t\t\t\trefsMap[cleanKey].push(refNode);\n\t\t\t} else if (!hasListRef) {\n\t\t\t\trefsMap[refKey] = refNode;\n\t\t\t} else {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`Did not register singular ref ${refKey}, ${refNode} as a ref list is already registered under the same name.`,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\tthis.$refs = refsMap;\n\t}\n\n\t// Helper function for dispatching custom events\n\tdispatch(name, data, bubble = false, cancelable = false, composed = false) {\n\t\tconst event = new CustomEvent(name, {\n\t\t\tbubbles: bubble,\n\t\t\tcancelable: cancelable,\n\t\t\tcomposed: composed,\n\t\t\tdetail: data,\n\t\t});\n\t\tthis.dispatchEvent(event);\n\t}\n\n\t// Get the root element\n\tgetRoot() {\n\t\treturn this;\n\t}\n}\n\nexport { BaseElement, getClosestParentCustomElementNode, isOfSameNodeType };\n", "/**\n * Retrieves a translated key from a dictionary on the window object\n * Example: ${i18n('CustomElement.buttonLabel', 'Label')}\n * @param key to be translated\n * @param fallback to be used if key is not defined\n * @return String of the translated key or fallback or original key\n */\nexport function i18n(key, fallback) {\n\ttry {\n\t\tconst translations = window.elementjs.i18n();\n\t\tif (translations[key] === undefined) {\n\t\t\tthrow 'Translation Missing';\n\t\t}\n\n\t\treturn translations[key];\n\t} catch (err) {\n\t\tif (fallback) return fallback;\n\t\telse return key;\n\t}\n}\n", "import { BaseElement } from './BaseElement';\nimport { supportsAdoptingStyleSheets, getShadowParentOrBody } from './util/DOMHelper';\nexport { i18n } from './util/i18n';\n\nclass StyledElement extends BaseElement {\n\tstatic globalStyles = null;\n\n\tstatic updateGlobalStyles() {\n\t\t// this is a runtime dependency so that every shadow dom can make use of global css\n\t\t// we assume these styles to be inlined into the document\n\t\tStyledElement.globalStyles = document.getElementById('globalStyles');\n\n\t\tif (StyledElement.globalStyles && StyledElement['globalStyleSheet']) {\n\t\t\t//updates already adopted global styles\n\t\t\tStyledElement['globalStyleSheet'].replaceSync(StyledElement.globalStyles.textContent);\n\t\t}\n\t}\n\n\tconstructor(options) {\n\t\tsuper({\n\t\t\tdeferUpdate: false,\n\t\t\tshadowRender: false,\n\t\t\tstyles: [],\n\t\t\tadoptGlobalStyles: true,\n\t\t\t...options,\n\t\t});\n\t\tthis._styles = [...this._options.styles, ...this.styles()];\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\n\t\tif (supportsAdoptingStyleSheets() && this._options.shadowRender) {\n\t\t\t// adopting does only make sense in shadow dom. Fall back to append for light elements\n\t\t\tthis.adoptStyleSheets();\n\t\t} else if (this._options.shadowRender && window.ShadyCSS !== undefined) {\n\t\t\t// if shadowRoot is polyfilled we use ShadyCSS to copy scoped styles to <head>\n\t\t\twindow.ShadyCSS.ScopingShim.prepareAdoptedCssText(this._styles, this.localName);\n\t\t}\n\n\t\t// if shadowRoot is polyfilled - scope element template\n\t\tif (window.ShadyCSS !== undefined) {\n\t\t\twindow.ShadyCSS.styleElement(this);\n\t\t}\n\t}\n\n\tstyles() {\n\t\treturn [];\n\t}\n\n\tupdate(options) {\n\t\tif (!supportsAdoptingStyleSheets() || this._options.shadowRender === false) {\n\t\t\t// append stylesheets to template if not already adopted\n\t\t\tconst appendableStyles = [...this._styles];\n\t\t\tif (this._options.shadowRender && this._options.adoptGlobalStyles && !window.ShadyCSS) {\n\t\t\t\tappendableStyles.unshift(StyledElement.globalStyles?.textContent ?? '');\n\t\t\t}\n\t\t\tthis.appendStyleSheets(appendableStyles);\n\t\t}\n\t\tsuper.update(options);\n\t}\n\n\tadoptStyleSheets() {\n\t\tif (!this.constructor['cssStyleSheets']) {\n\t\t\tthis.constructor['cssStyleSheets'] = this._styles.map((style) => {\n\t\t\t\tconst sheet = new CSSStyleSheet();\n\t\t\t\tif (sheet && sheet.cssRules.length === 0) {\n\t\t\t\t\tsheet.replaceSync(style);\n\t\t\t\t}\n\t\t\t\treturn sheet;\n\t\t\t});\n\t\t}\n\n\t\tif (StyledElement.globalStyles && !StyledElement['globalStyleSheet']) {\n\t\t\tStyledElement['globalStyleSheet'] = new CSSStyleSheet();\n\t\t\tStyledElement['globalStyleSheet'].replaceSync(StyledElement.globalStyles.textContent);\n\t\t}\n\n\t\t// adopt styles\n\t\t// uses proposed solution for constructable stylesheets\n\t\t// see: https://wicg.github.io/construct-stylesheets/#proposed-solution\n\t\tthis.getRoot().adoptedStyleSheets = [\n\t\t\t...(this._options.shadowRender && this._options.adoptGlobalStyles && StyledElement['globalStyleSheet']\n\t\t\t\t? [StyledElement['globalStyleSheet']]\n\t\t\t\t: []),\n\t\t\t...this.constructor['cssStyleSheets'],\n\t\t];\n\t}\n\n\t// custom polyfill for constructable stylesheets by appending styles to the end of an element\n\tappendStyleSheets(styles) {\n\t\tconst parentDocument = getShadowParentOrBody(this.getRoot());\n\t\tstyles.forEach((style, index) => {\n\t\t\tconst identifier = this.tagName + index;\n\n\t\t\t// only append stylesheet if not already appended to shadowRoot or document\n\t\t\tif (!parentDocument.querySelector(`#${identifier}`)) {\n\t\t\t\tconst styleElement = document.createElement('style');\n\t\t\t\tstyleElement.id = identifier;\n\t\t\t\tstyleElement.style.display = 'none';\n\t\t\t\tstyleElement.textContent = style;\n\t\t\t\tparentDocument.appendChild(styleElement);\n\t\t\t}\n\t\t});\n\t}\n}\n\nStyledElement.updateGlobalStyles();\n\nexport { StyledElement };\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// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DirectiveFactory = (...args: any[]) => object;\n\nexport type DirectiveFn = (part: Part) => void;\n\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\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 * 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 */\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 readonly polyfillWrapFlushCallback?: object;\n}\n\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n (window.customElements as MaybePolyfilledCe).polyfillWrapFlushCallback !==\n undefined;\n\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes =\n (container: Node,\n start: Node|null,\n end: Node|null = null,\n before: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.insertBefore(start!, before);\n start = n;\n }\n };\n\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes =\n (container: Node, start: Node|null, end: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.removeChild(start!);\n start = 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 readonly 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, causing it to actually be written to the\n * DOM.\n *\n * Directives are run at the start of `commit`, so that if they call\n * `part.setValue(...)` synchronously that value will be used in the current\n * commit, and there's no need to call `part.commit()` within the directive.\n * If directives set a part value asynchronously, then they must call\n * `part.commit()` manually.\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 = {};\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 updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n readonly parts: TemplatePart[] = [];\n readonly element: HTMLTemplateElement;\n\n constructor(result: TemplateResult, element: HTMLTemplateElement) {\n this.element = element;\n\n const nodesToRemove: Node[] = [];\n const stack: Node[] = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n element.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 let index = -1;\n let partIndex = 0;\n const {strings, values: {length}} = result;\n while (partIndex < length) {\n const node = walker.nextNode() as Element | Comment | Text | null;\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n continue;\n }\n index++;\n\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if ((node as Element).hasAttributes()) {\n const attributes = (node as Element).attributes;\n const {length} = 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 correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\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 = 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 (node as Element).removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({type: 'attribute', index, name, strings: statics});\n partIndex += statics.length - 1;\n }\n }\n if ((node as Element).tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = (node as HTMLTemplateElement).content;\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 let insert: Node;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n } else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, 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)) !== -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 partIndex++;\n }\n }\n }\n }\n\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\nconst endsWith = (str: string, suffix: string): boolean => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\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 readonly type: 'node'; index: number;\n}|{\n readonly type: 'attribute';\n index: number;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n};\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#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\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 // eslint-disable-next-line no-control-regex\n /([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\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, TemplatePart} 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 private readonly __parts: Array<Part|undefined> = [];\n readonly processor: TemplateProcessor;\n readonly options: RenderOptions;\n readonly 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: readonly 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 // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) as DocumentFragment :\n document.importNode(this.template.element.content, true);\n\n const stack: Node[] = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n fragment,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part: TemplatePart;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node!.nodeName === 'TEMPLATE') {\n stack.push(node!);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n node = walker.nextNode();\n }\n }\n\n // We've arrived at our part's node.\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 }\n\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\nconst commentMarker = ` ${marker} `;\n\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n readonly strings: TemplateStringsArray;\n readonly values: readonly unknown[];\n readonly type: string;\n readonly processor: TemplateProcessor;\n\n constructor(\n strings: TemplateStringsArray, values: readonly 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 l = this.strings.length - 1;\n let html = '';\n let isCommentBinding = false;\n\n for (let i = 0; i < l; i++) {\n const s = this.strings[i];\n // For each binding we want to determine the kind of marker to insert\n // into the template source before it's parsed by the browser's HTML\n // parser. The marker type is based on whether the expression is in an\n // attribute, text, or comment position.\n // * For node-position bindings we insert a comment with the marker\n // sentinel as its text content, like <!--{{lit-guid}}-->.\n // * For attribute bindings we insert just the marker sentinel for the\n // first binding, so that we support unquoted attribute bindings.\n // Subsequent bindings can use a comment marker because multi-binding\n // attributes must be quoted.\n // * For comment bindings we insert just the marker sentinel so we don't\n // close the comment.\n //\n // The following code scans the template source, but is *not* an HTML\n // parser. We don't need to track the tree structure of the HTML, only\n // whether a binding is inside a comment, and if not, if it appears to be\n // the first binding in an attribute.\n const commentOpen = s.lastIndexOf('<!--');\n // We're in comment position if we have a comment open with no following\n // comment close. Because <-- can appear in an attribute value there can\n // be false positives.\n isCommentBinding = (commentOpen > -1 || isCommentBinding) &&\n s.indexOf('-->', commentOpen + 1) === -1;\n // Check to see if we have an attribute-like sequence preceding the\n // expression. This can match \"name=value\" like structures in text,\n // comments, and attribute values, so there can be false-positives.\n const attributeMatch = lastAttributeNameRegex.exec(s);\n if (attributeMatch === null) {\n // We're only in this branch if we don't have a attribute-like\n // preceding sequence. For comments, this guards against unusual\n // attribute values like <div foo=\"<!--${'bar'}\">. Cases like\n // <!-- foo=${'bar'}--> are handled correctly in the attribute branch\n // below.\n html += s + (isCommentBinding ? commentMarker : nodeMarker);\n } else {\n // For attributes we use just a marker sentinel, and also append a\n // $lit$ suffix to the name to opt-out of attribute-specific parsing\n // that IE and Edge do for style and certain SVG attributes.\n html += s.substr(0, attributeMatch.index) + attributeMatch[1] +\n attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] +\n marker;\n }\n }\n html += this.strings[l];\n return html;\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};\nexport const isIterable = (value: unknown): value is Iterable<unknown> => {\n return Array.isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n !!(value && (value as any)[Symbol.iterator]);\n};\n\n/**\n * Writes attribute values to the DOM for a group of AttributeParts bound to a\n * single attribute. The value is only set once even if there are multiple parts\n * for an attribute.\n */\nexport class AttributeCommitter {\n readonly element: Element;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n readonly parts: ReadonlyArray<AttributePart>;\n dirty = true;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<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 as AttributePart[])[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 (isPrimitive(v) || !isIterable(v)) {\n text += typeof v === 'string' ? v : String(v);\n } else {\n for (const t of v) {\n text += typeof t === 'string' ? t : String(t);\n }\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\n/**\n * A Part that controls all or part of an attribute value.\n */\nexport class AttributePart implements Part {\n readonly committer: AttributeCommitter;\n value: unknown = undefined;\n\n constructor(committer: AttributeCommitter) {\n this.committer = committer;\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\n/**\n * A Part that controls a location within a Node tree. Like a Range, NodePart\n * has start and end locations and can set and update the Nodes between those\n * locations.\n *\n * NodeParts support several value types: primitives, Nodes, TemplateResults,\n * as well as arrays and iterables of those types.\n */\nexport class NodePart implements Part {\n readonly options: RenderOptions;\n startNode!: Node;\n endNode!: Node;\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(options: RenderOptions) {\n this.options = options;\n }\n\n /**\n * Appends 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 after the `ref` node (between `ref` and `ref`'s next\n * sibling). Both `ref` and its next sibling must be static, unchanging nodes\n * such as those that appear 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 * Inserts this part after the `ref` part.\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 if (this.startNode.parentNode === null) {\n return;\n }\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 (isIterable(value)) {\n this.__commitIterable(value);\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 `value` isn't already a string, we explicitly convert it here in case\n // it can't be implicitly converted - i.e. it's a symbol.\n const valueAsString: string =\n typeof value === 'string' ? value : String(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 = valueAsString;\n } else {\n this.__commitNode(document.createTextNode(valueAsString));\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 readonly element: Element;\n readonly name: string;\n readonly strings: readonly string[];\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(element: Element, name: string, strings: readonly 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 this.value = value;\n }\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 readonly single: boolean;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<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 protected _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 // eslint-disable-next-line @typescript-eslint/no-explicit-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 third\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\n// Wrap into an IIFE because MS Edge <= v41 does not support having try/catch\n// blocks right into the body of a module\n(() => {\n try {\n const options = {\n get capture() {\n eventOptionsSupported = true;\n return false;\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.addEventListener('test', options as any, options);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.removeEventListener('test', options as any, options);\n } catch (_e) {\n // event options not supported\n }\n})();\n\ntype EventHandlerWithOptions =\n EventListenerOrEventListenerObject&Partial<AddEventListenerOptions>;\nexport class EventPart implements Part {\n readonly element: Element;\n readonly eventName: string;\n readonly eventContext?: EventTarget;\n value: undefined|EventHandlerWithOptions = undefined;\n private __options?: AddEventListenerOptions;\n private __pendingValue: undefined|EventHandlerWithOptions = undefined;\n private readonly __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): ReadonlyArray<Part> {\n const prefix = name[0];\n if (prefix === '.') {\n const committer = new PropertyCommitter(element, name.slice(1), strings);\n return committer.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 committer = new AttributeCommitter(element, name, strings);\n return committer.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 behavior, 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 interface TemplateCache {\n readonly stringsArray: WeakMap<TemplateStringsArray, Template>;\n readonly 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';\n\nexport const parts = new WeakMap<Node, NodePart>();\n\n/**\n * Renders a template result or other value 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 Any value renderable by NodePart - typically a TemplateResult\n * created by evaluating a template tag like `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: unknown,\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, isIterable, 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\nif (typeof window !== 'undefined') {\n (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.2.1');\n}\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 = -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 (scopeName: string, renderedDOM: DocumentFragment, template?: Template) => {\n shadyRenderSet.add(scopeName);\n // If `renderedDOM` is stamped from a Template, then we need to edit that\n // Template's underlying template element. Otherwise, we create one here\n // to give to ShadyCSS, which still requires one while scoping.\n const templateElement =\n !!template ? template.element : document.createElement('template');\n // Move styles out of rendered DOM and store.\n const styles = renderedDOM.querySelectorAll('style');\n const {length} = styles;\n // If there are no styles, skip unnecessary work\n if (length === 0) {\n // Ensure prepareTemplateStyles is called to support adding\n // styles via `prepareAdoptedCssText` since that requires that\n // `prepareTemplateStyles` is called.\n //\n // ShadyCSS will only update styles containing @apply in the template\n // given to `prepareTemplateStyles`. If no lit Template was given,\n // ShadyCSS will not be able to update uses of @apply in any relevant\n // template. However, this is not a problem because we only create the\n // template for the purpose of supporting `prepareAdoptedCssText`,\n // which doesn't support @apply at all.\n window.ShadyCSS!.prepareTemplateStyles(templateElement, 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 < 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 const content = templateElement.content;\n if (!!template) {\n insertNodeIntoTemplate(template, condensedStyle, content.firstChild);\n } else {\n content.insertBefore(condensedStyle, content.firstChild);\n }\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(templateElement, scopeName);\n const style = content.querySelector('style');\n if (window.ShadyCSS!.nativeShadow && style !== null) {\n // When in native Shadow DOM, ensure the style created by ShadyCSS is\n // included in initially rendered output (`renderedDOM`).\n renderedDOM.insertBefore(style.cloneNode(true), renderedDOM.firstChild);\n } else if (!!template) {\n // When no style is left in the template, 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 // There can be no style in the template in 2 cases (1) when Shady DOM\n // is in use, ShadyCSS removes all styles, (2) when native Shadow DOM\n // is in use ShadyCSS removes the style if it contains no content.\n // NOTE, ShadyCSS creates its own style so we can safely add/remove\n // `condensedStyle` here.\n content.insertBefore(condensedStyle, content.firstChild);\n const removes = new Set<Node>();\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: unknown,\n container: Element|DocumentFragment|ShadowRoot,\n options: ShadyRenderOptions) => {\n if (!options || typeof options !== 'object' || !options.scopeName) {\n throw new Error('The `scopeName` option is required.');\n }\n const scopeName = options.scopeName;\n const hasRendered = parts.has(container);\n const needsScoping = compatibleShadyCSSVersion &&\n container.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */ &&\n !!(container as ShadowRoot).host;\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 // ShadyCSS might have style sheets (e.g. from `prepareAdoptedCssText`)\n // that should apply to `renderContainer` even if the rendered value is\n // not a TemplateInstance. However, it will only insert scoped styles\n // into the document if `prepareTemplateStyles` has already been called\n // for the given scope name.\n const template = part.value instanceof TemplateInstance ?\n part.value.template :\n undefined;\n prepareTemplateStyles(\n scopeName, renderContainer as DocumentFragment, template);\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 `ShadyCSS.styleElement`\n // for dynamic changes.\n if (!hasRendered && needsScoping) {\n window.ShadyCSS!.styleElement((container as ShadowRoot).host);\n }\n };\n", "import { StyledElement } from './StyledElement';\nimport { html } from 'lit-html';\nimport { render } from 'lit-html/lib/shady-render.js';\nexport { i18n } from './util/i18n';\n\nclass TemplateElement extends StyledElement {\n\tconstructor(options) {\n\t\tsuper({\n\t\t\tdeferUpdate: false,\n\t\t\tshadowRender: false,\n\t\t\tstyles: [],\n\t\t\tadoptGlobalStyles: true,\n\t\t\tmutationObserverOptions: {\n\t\t\t\tchildList: false,\n\t\t\t},\n\t\t\t...options,\n\t\t});\n\t\tthis._template = this._options.template;\n\n\t\tif (this._options.shadowRender) this.attachShadow({ mode: 'open' });\n\t}\n\n\ttemplate() {\n\t\treturn html``;\n\t}\n\n\tupdate(options) {\n\t\tthis.renderTemplate();\n\t\tsuper.update(options);\n\t}\n\n\trenderTemplate() {\n\t\tconst template = this._template || this.template();\n\t\tif (typeof template === 'string') {\n\t\t\t// just a plain string literal. no lit-html required\n\t\t\tthis.getRoot().innerHTML = `${template}`;\n\t\t} else {\n\t\t\t// render via lit-html\n\t\t\trender(html` ${template} `, this.getRoot(), {\n\t\t\t\tscopeName: this.localName,\n\t\t\t\teventContext: this,\n\t\t\t});\n\t\t}\n\t}\n\n\tgetRoot() {\n\t\treturn this.shadowRoot !== null ? this.shadowRoot : this;\n\t}\n}\n\nexport { TemplateElement, html, render };\n"],
5
+ "mappings": ";;;;;;;;;;AAAO,sBAAsB,OAAO;AACnC,SAAO,OAAO,SAAS,YAAY,UAAU;AAAA;AAGvC,gBAAgB,KAAK;AAC3B,MAAI;AACH,WAAO,KAAK,MAAM,QAAQ,CAAC,CAAC;AAAA,WACpB,GAAP;AACD,WAAO;AAAA;AAAA;AAIF,mBAAmB,OAAO;AAChC,SAAO,UAAU,UAAU,UAAU;AAAA;AAG/B,sBAAsB,OAAO;AACnC,SAAO,UAAU;AAAA;AAGX,kBAAkB,OAAO;AAC/B,SACC,OAAO,UAAU,YAChB,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,OAAO,UAAU,SAAS,KAAK,WAAW;AAAA;AAI9E,kBAAkB,OAAO;AAC/B,SAAO,IAAI,OAAO,wCAAwC,KAAK;AAAA;AAGzD,eAAe,OAAO;AAC5B,SAAO,OAAO,MAAM;AAAA;AAGd,wBAAwB,OAAO,UAAU,IAAI;AACnD,MAAI,QAAQ,UAAU,SAAS,CAAC,SAAS,QAAQ;AAEhD,WAAO;AAAA;AAER,MAAI,OAAO,QAAQ,UAAU,YAAY;AAExC,WAAO,QAAQ,MAAM;AAAA;AAItB,MAAI,cAAc;AAElB,MAAI,OAAO;AAAQ,kBAAc,KAAK,MAAM;AAAA,WACnC,UAAU;AAAQ,kBAAc,aAAa;AAAA,WAC7C,SAAS;AAAQ,kBAAc,WAAW;AAEnD,SAAO;AAAA;AAOD,qBAAqB,QAAQ;AACnC,MAAI,OAAO,QAAQ,SAAS;AAAI,WAAO;AAEvC,SAAO,OAAO,QAAQ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AAqB,aAAe;AAW1D,MAAI,kBAAkB;AACpB,UAAM,OAAO,MAAM,IAAI;AACvB,UAAM,OAAO;AAMb,UAAM,WAAW,KAAK,iBAAiB,mBACnC,KAAK,MAAM,WACX;AACJ,0BACI,WAAW,iBAAqC;AACpD,gBAAY,WAAW,UAAU;AACjC,cAAU,YAAY;AACtB,UAAM,IAAI,WAAW;;AAQvB,MAAI,CAAC,eAAe,cAAc;AAChC,WAAO,SAAU,aAAc,UAAyB;;;;;ACrThE,oCAA8B,cAAc;AAAA,EAC3C,YAAY,SAAS;AACpB,UAAM;AAAA,MACL,aAAa;AAAA,MACb,cAAc;AAAA,MACd,QAAQ;AAAA,MACR,mBAAmB;AAAA,MACnB,yBAAyB;AAAA,QACxB,WAAW;AAAA;AAAA,SAET;AAAA;AAEJ,SAAK,YAAY,KAAK,SAAS;AAE/B,QAAI,KAAK,SAAS;AAAc,WAAK,aAAa,CAAE,MAAM;AAAA;AAAA,EAG3D,WAAW;AACV,WAAO;AAAA;AAAA,EAGR,OAAO,SAAS;AACf,SAAK;AACL,UAAM,OAAO;AAAA;AAAA,EAGd,iBAAiB;AAChB,UAAM,WAAW,KAAK,aAAa,KAAK;AACxC,QAAI,OAAO,aAAa,UAAU;AAEjC,WAAK,UAAU,YAAY,GAAG;AAAA,WACxB;AAEN,cAAO,QAAQ,aAAa,KAAK,WAAW;AAAA,QAC3C,WAAW,KAAK;AAAA,QAChB,cAAc;AAAA;AAAA;AAAA;AAAA,EAKjB,UAAU;AACT,WAAO,KAAK,eAAe,OAAO,KAAK,aAAa;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtides/element-js",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "module": "index.js",
5
5
  "main": "dist/index.js",
6
6
  "files": [
package/src/util/Store.js CHANGED
@@ -7,7 +7,7 @@ export class Store {
7
7
 
8
8
  constructor(value) {
9
9
  // wrap primitives with a generic "value" field to generate getter and setter
10
- this._singlePropertyMode = !isObjectLike(value);
10
+ this._singlePropertyMode = arguments.length > 0 && !isObjectLike(value);
11
11
  const specificValues = this._singlePropertyMode ? { value } : value;
12
12
  this._state = { ...(!this._singlePropertyMode && this.properties()), ...specificValues };
13
13