diff --git a/passbook/static/static/passbook/passbook.js b/passbook/static/static/passbook/passbook.js
index e470337a6..b31ae7c1c 100644
--- a/passbook/static/static/passbook/passbook.js
+++ b/passbook/static/static/passbook/passbook.js
@@ -91,7 +91,7 @@ class y{constructor(e,t,s){this.__parts=[],this.template=e,this.processor=t,this
      * Code distributed by Google as part of the polymer project is also
      * subject to an additional IP rights grant found at
      * http://polymer.github.io/PATENTS.txt
-     */const O=new
+     */const M=new
 /**
      * @license
      * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -118,7 +118,7 @@ class{handleAttributeExpressions(e,t,s,n){const r=t[0];if("."===r){return new N(
      * Code distributed by Google as part of the polymer project is also
      * subject to an additional IP rights grant found at
      * http://polymer.github.io/PATENTS.txt
-     */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");const M=(e,...t)=>new w(e,t,"html",O)
+     */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");const O=(e,...t)=>new w(e,t,"html",M)
 /**
      * @license
      * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -131,7 +131,7 @@ class{handleAttributeExpressions(e,t,s,n){const r=t[0];if("."===r){return new N(
      * Code distributed by Google as part of the polymer project is also
      * subject to an additional IP rights grant found at
      * http://polymer.github.io/PATENTS.txt
-     */,B=(e,t)=>`${e}--${t}`;let F=!0;void 0===window.ShadyCSS?F=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),F=!1);const j=e=>t=>{const n=B(t.type,e);let r=V.get(n);void 0===r&&(r={stringsArray:new WeakMap,keyString:new Map},V.set(n,r));let i=r.stringsArray.get(t.strings);if(void 0!==i)return i;const a=t.strings.join(s);if(i=r.keyString.get(a),void 0===i){const s=t.getTemplateElement();F&&window.ShadyCSS.prepareTemplateDom(s,e),i=new o(t,s),r.keyString.set(a,i)}return r.stringsArray.set(t.strings,i),i},I=["html","svg"],H=new Set,$=(e,t,s)=>{H.add(e);const n=s?s.element:document.createElement("template"),r=t.querySelectorAll("style"),{length:i}=r;if(0===i)return void window.ShadyCSS.prepareTemplateStyles(n,e);const o=document.createElement("style");for(let e=0;e<i;e++){const t=r[e];t.parentNode.removeChild(t),o.textContent+=t.textContent}(e=>{I.forEach((t=>{const s=V.get(B(t,e));void 0!==s&&s.keyString.forEach((e=>{const{element:{content:t}}=e,s=new Set;Array.from(t.querySelectorAll("style")).forEach((e=>{s.add(e)})),h(e,s)}))}))})(e);const a=n.content;s?function(e,t,s=null){const{element:{content:n},parts:r}=e;if(null==s)return void n.appendChild(t);const i=document.createTreeWalker(n,133,null,!1);let o=u(r),a=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===s&&(a=p(t),s.parentNode.insertBefore(t,s));-1!==o&&r[o].index===l;){if(a>0){for(;-1!==o;)r[o].index+=a,o=u(r,o);return}o=u(r,o)}}(s,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(n,e);const l=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(s){a.insertBefore(o,a.firstChild);const e=new Set;e.add(o),h(s,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const z={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},D=(e,t)=>t!==e&&(t==t||e==e),W={attribute:!0,type:String,converter:z,reflect:!1,hasChanged:D},J="finalized";class K extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach(((t,s)=>{const n=this._attributeNameForProperty(s,t);void 0!==n&&(this._attributeToPropertyMap.set(n,s),e.push(n))})),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach(((e,t)=>this._classProperties.set(t,e)))}}static createProperty(e,t=W){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const s="symbol"==typeof e?Symbol():"__"+e,n=this.getPropertyDescriptor(e,s,t);void 0!==n&&Object.defineProperty(this.prototype,e,n)}static getPropertyDescriptor(e,t,s){return{get(){return this[t]},set(n){const r=this[e];this[t]=n,this.requestUpdateInternal(e,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||W}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(J)||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const s of t)this.createProperty(s,e[s])}}static _attributeNameForProperty(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,s=D){return s(e,t)}static _propertyValueFromAttribute(e,t){const s=t.type,n=t.converter||z,r="function"==typeof n?n:n.fromAttribute;return r?r(e,s):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const s=t.type,n=t.converter;return(n&&n.toAttribute||z.toAttribute)(e,s)}initialize(){this._updateState=0,this._updatePromise=new Promise((e=>this._enableUpdatingResolver=e)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((e,t)=>this[t]=e)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,s){t!==s&&this._attributeToProperty(e,s)}_propertyToAttribute(e,t,s=W){const n=this.constructor,r=n._attributeNameForProperty(e,s);if(void 0!==r){const e=n._propertyValueToAttribute(t,s);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(r):this.setAttribute(r,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const s=this.constructor,n=s._attributeToPropertyMap.get(e);if(void 0!==n){const e=s.getPropertyOptions(n);this._updateState=16|this._updateState,this[n]=s._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,s){let n=!0;if(void 0!==e){const r=this.constructor;s=s||r.getPropertyOptions(e),r._valueHasChanged(this[e],t,s.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==s.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,s))):n=!1}!this._hasRequestedUpdate&&n&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((e,t)=>this._propertyToAttribute(t,this[t],e))),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}K.finalized=!0;
+     */,B=(e,t)=>`${e}--${t}`;let F=!0;void 0===window.ShadyCSS?F=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),F=!1);const I=e=>t=>{const n=B(t.type,e);let r=V.get(n);void 0===r&&(r={stringsArray:new WeakMap,keyString:new Map},V.set(n,r));let i=r.stringsArray.get(t.strings);if(void 0!==i)return i;const a=t.strings.join(s);if(i=r.keyString.get(a),void 0===i){const s=t.getTemplateElement();F&&window.ShadyCSS.prepareTemplateDom(s,e),i=new o(t,s),r.keyString.set(a,i)}return r.stringsArray.set(t.strings,i),i},j=["html","svg"],H=new Set,$=(e,t,s)=>{H.add(e);const n=s?s.element:document.createElement("template"),r=t.querySelectorAll("style"),{length:i}=r;if(0===i)return void window.ShadyCSS.prepareTemplateStyles(n,e);const o=document.createElement("style");for(let e=0;e<i;e++){const t=r[e];t.parentNode.removeChild(t),o.textContent+=t.textContent}(e=>{j.forEach((t=>{const s=V.get(B(t,e));void 0!==s&&s.keyString.forEach((e=>{const{element:{content:t}}=e,s=new Set;Array.from(t.querySelectorAll("style")).forEach((e=>{s.add(e)})),h(e,s)}))}))})(e);const a=n.content;s?function(e,t,s=null){const{element:{content:n},parts:r}=e;if(null==s)return void n.appendChild(t);const i=document.createTreeWalker(n,133,null,!1);let o=u(r),a=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===s&&(a=p(t),s.parentNode.insertBefore(t,s));-1!==o&&r[o].index===l;){if(a>0){for(;-1!==o;)r[o].index+=a,o=u(r,o);return}o=u(r,o)}}(s,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(n,e);const l=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(s){a.insertBefore(o,a.firstChild);const e=new Set;e.add(o),h(s,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const z={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},D=(e,t)=>t!==e&&(t==t||e==e),W={attribute:!0,type:String,converter:z,reflect:!1,hasChanged:D},J="finalized";class K extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach(((t,s)=>{const n=this._attributeNameForProperty(s,t);void 0!==n&&(this._attributeToPropertyMap.set(n,s),e.push(n))})),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach(((e,t)=>this._classProperties.set(t,e)))}}static createProperty(e,t=W){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const s="symbol"==typeof e?Symbol():"__"+e,n=this.getPropertyDescriptor(e,s,t);void 0!==n&&Object.defineProperty(this.prototype,e,n)}static getPropertyDescriptor(e,t,s){return{get(){return this[t]},set(n){const r=this[e];this[t]=n,this.requestUpdateInternal(e,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||W}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(J)||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const s of t)this.createProperty(s,e[s])}}static _attributeNameForProperty(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,s=D){return s(e,t)}static _propertyValueFromAttribute(e,t){const s=t.type,n=t.converter||z,r="function"==typeof n?n:n.fromAttribute;return r?r(e,s):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const s=t.type,n=t.converter;return(n&&n.toAttribute||z.toAttribute)(e,s)}initialize(){this._updateState=0,this._updatePromise=new Promise((e=>this._enableUpdatingResolver=e)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((e,t)=>this[t]=e)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,s){t!==s&&this._attributeToProperty(e,s)}_propertyToAttribute(e,t,s=W){const n=this.constructor,r=n._attributeNameForProperty(e,s);if(void 0!==r){const e=n._propertyValueToAttribute(t,s);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(r):this.setAttribute(r,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const s=this.constructor,n=s._attributeToPropertyMap.get(e);if(void 0!==n){const e=s.getPropertyOptions(n);this._updateState=16|this._updateState,this[n]=s._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,s){let n=!0;if(void 0!==e){const r=this.constructor;s=s||r.getPropertyOptions(e),r._valueHasChanged(this[e],t,s.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==s.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,s))):n=!1}!this._hasRequestedUpdate&&n&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((e,t)=>this._propertyToAttribute(t,this[t],e))),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}K.finalized=!0;
 /**
     @license
     Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
@@ -156,5 +156,5 @@ const X=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
      * subject to an additional IP rights grant found at
      * http://polymer.github.io/PATENTS.txt
      */
-(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const Y={};class Z extends K{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,s)=>e.reduceRight(((e,s)=>Array.isArray(s)?t(s,e):(e.add(s),e)),s),s=t(e,new Set),n=[];s.forEach((e=>n.unshift(e))),this._styles=n}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map((e=>{if(e instanceof CSSStyleSheet&&!X){const t=Array.prototype.slice.call(e.cssRules).reduce(((e,t)=>e+t.cssText),"");return new Q(String(t),G)}return e}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?X?this.renderRoot.adoptedStyleSheets=e.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map((e=>e.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==Y&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)})))}render(){return Y}}Z.finalized=!0,Z.render=(e,s,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const r=n.scopeName,i=R.has(s),o=F&&11===s.nodeType&&!!s.host,a=o&&!H.has(r),l=a?document.createDocumentFragment():s;if(((e,s,n)=>{let r=R.get(s);void 0===r&&(t(s,s.firstChild),R.set(s,r=new A(Object.assign({templateFactory:L},n))),r.appendInto(s)),r.setValue(e),r.commit()})(e,l,Object.assign({templateFactory:j(r)},n)),a){const e=R.get(l);R.delete(l);const n=e.value instanceof y?e.value.template:void 0;$(r,l,n),t(s,s.firstChild),s.appendChild(l),R.set(s,e)}!i&&o&&window.ShadyCSS.styleElement(s.host)};customElements.define("fetch-fill-slot",class extends Z{static get properties(){return{url:{type:String},key:{type:String},value:{type:Number}}}comparison(e){var t={"<":function(e,t){return e<t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<=":function(e,t){return e<=t},"==":function(e,t){return e==t},"!=":function(e,t){return e!=t},"===":function(e,t){return e===t},"!==":function(e,t){return e!==t}};const s=e.split(" ");if(s.length<3)throw new Error("nah");let n=s[0];n="value"===n?this.value:parseInt(n,10);let r=s[2];r="value"===r?this.value:parseInt(r,10);const i=s[1];if(!(i in t))throw new Error("Invalid comparison");return t[i](n,r)}firstUpdated(){fetch(this.url).then((e=>e.json())).then((e=>e[this.key])).then((e=>this.value=e))}render(){if(void 0===this.value)return M`<slot></slot>`;let e="";return this.querySelectorAll("[slot]").forEach((t=>{const s=t.getAttribute("slot");this.comparison(s)&&(e=s)})),this.querySelectorAll("[data-value]").forEach((e=>{e.textContent=this.value})),M`<slot name="${e}"></slot>`}});const ee={error:"fas fa-exclamation-circle",warning:"fas fa-exclamation-triangle",success:"fas fa-check-circle",info:"fas fa-info"};function te(){document.querySelector("pb-messages").setAttribute("touch",Date.now())}customElements.define("pb-messages",class extends Z{static get properties(){return{url:{type:String},messages:{type:Array},touch:{type:Object}}}set touch(e){this.firstUpdated()}createRenderRoot(){return this}firstUpdated(){return fetch(this.url).then((e=>e.json())).then((e=>this.messages=e)).then((e=>{const t=this.querySelector(".pf-c-alert-group");e.forEach((e=>{const s=this.renderMessage(e);t.appendChild(s)}))}))}renderMessage(e){const t="pb-message"+Math.random().toString(36).substr(2,9);const s=document.createElement("template");return s.innerHTML=`<li id=${t} class="pf-c-alert-group__item">\n            <div class="pf-c-alert pf-m-${e.level_tag} ${"error"===e.level_tag?"pf-m-danger":""}">\n                <div class="pf-c-alert__icon">\n                    <i class="${ee[e.level_tag]}"></i>\n                </div>\n                <p class="pf-c-alert__title">\n                    ${e.message}\n                </p>\n            </div>\n        </li>`,setTimeout((()=>{this.querySelector("#"+t).remove()}),1500),s.content.firstChild}render(){return M`<ul class="pf-c-alert-group pf-m-toast"></ul>`}});const se="pf-m-primary",ne=["pf-m-progress","pf-m-in-progress"];class re extends HTMLButtonElement{constructor(){super(),this.addEventListener("click",(e=>this.callAction()))}isRunning=!1;oldBody="";setLoading(){this.classList.add(...ne),this.oldBody=this.innerText,this.innerHTML='<span class="pf-c-button__progress">\n            <span class="pf-c-spinner pf-m-md" role="progressbar" aria-valuetext="Loading...">\n                <span class="pf-c-spinner__clipper"></span>\n                <span class="pf-c-spinner__lead-ball"></span>\n                <span class="pf-c-spinner__tail-ball"></span>\n            </span>\n        </span>'+this.oldBody}setDone(e){this.isRunning=!1,this.classList.remove(...ne),this.innerText=this.oldBody,this.classList.replace(se,e),te(),setTimeout((()=>{this.classList.replace(e,se)}),1e3)}callAction(){if(!0===this.isRunning)return;this.setLoading();const e=function(e){let t=null;if(document.cookie&&""!==document.cookie){const s=document.cookie.split(";");for(let n=0;n<s.length;n++){const r=s[n].trim();if(r.substring(0,e.length+1)===e+"="){t=decodeURIComponent(r.substring(e.length+1));break}}}return t}("passbook_csrf"),t=new Request(this.attributes.url.value,{headers:{"X-CSRFToken":e}});fetch(t,{method:"POST",mode:"same-origin"}).then((e=>e.json())).then((e=>{this.setDone("pf-m-success")})).catch((()=>{this.setDone("pf-m-danger")}))}}customElements.define("action-button",re,{extends:"button"});customElements.define("flow-shell-card",class extends Z{static get properties(){return{flowBodyUrl:{type:String},flowBody:{type:String}}}createRenderRoot(){return this}firstUpdated(){fetch(this.flowBodyUrl).then((e=>e.json())).then((e=>this.updateCard(e)))}async updateCard(e){switch(e.type){case"redirect":window.location=e.to;break;case"template":this.flowBody=e.body,await this.requestUpdate(),this.checkAutofocus(),te(),this.loadFormCode(),this.setFormSubmitHandlers()}}loadFormCode(){this.querySelectorAll("script").forEach((e=>{let t=document.createElement("script");t.src=e.src,document.head.appendChild(t)}))}checkAutofocus(){const e=this.querySelector("[autofocus]");null!==e&&e.focus()}updateFormAction(e){for(let t=0;t<e.elements.length;t++){if(e.elements[t].value===e.action)return console.log("pb-flow: Found Form action URL in form elements, not changing form action."),!1}return e.action=this.flowBodyUrl,console.log("pb-flow: updated form.action "+this.flowBodyUrl),!0}checkAutosubmit(e){if("autosubmit"in e.attributes)return e.submit()}setFormSubmitHandlers(){this.querySelectorAll("form").forEach((e=>{console.log("pb-flow: Checking for autosubmit attribute "+e),this.checkAutosubmit(e),console.log("pb-flow: Setting action for form "+e),this.updateFormAction(e),console.log("pb-flow: Adding handler for form "+e),e.addEventListener("submit",(t=>{t.preventDefault();let s=new FormData(e);this.flowBody=void 0,fetch(this.flowBodyUrl,{method:"post",body:s}).then((e=>e.json())).then((e=>{this.updateCard(e)}))})),e.classList.add("pb-flow-wrapped")}))}loading(){return M`<div class="pf-c-login__main-body pb-loading"><span class="pf-c-spinner" role="progressbar" aria-valuetext="Loading..."><span class="pf-c-spinner__clipper"></span> <span class="pf-c-spinner__lead-ball"></span> <span class="pf-c-spinner__tail-ball"></span></span></div>`}render(){return void 0!==this.flowBody?M([this.flowBody]):this.loading()}}),document.querySelectorAll("button.pf-c-dropdown__toggle").forEach((e=>{e.addEventListener("click",(e=>{const t=e.target.closest(".pf-c-dropdown").querySelector(".pf-c-dropdown__menu");t.hidden=!t.hidden}))})),document.querySelectorAll("input[type=search]").forEach((e=>{e.addEventListener("search",(t=>{""===e.value&&e.parentElement.submit()}))})),document.querySelectorAll("[data-pb-fetch-fill]").forEach((e=>{const t=e.dataset.pbFetchFill,s=e.dataset.pbFetchKey;fetch(t).then((e=>e.json())).then((t=>{e.textContent=t[s],e.value=t[s]}))})),document.querySelectorAll("[data-target='modal']").forEach((e=>{e.addEventListener("click",(e=>{const t=e.target.closest('[data-target="modal"]').attributes["data-modal"].value;document.querySelector("#"+t).removeAttribute("hidden")}))})),document.querySelectorAll(".pf-c-modal-box [data-modal-close]").forEach((e=>{e.addEventListener("click",(e=>{e.target.closest(".pf-c-backdrop").setAttribute("hidden",!0)}))})),document.querySelectorAll(".pf-c-check__label").forEach((e=>{e.addEventListener("click",(e=>{const t=e.target.parentElement.querySelector("input[type=checkbox]");t.checked=!t.checked}))})),document.querySelectorAll(".codemirror").forEach((e=>{let t="xml";"data-cm-mode"in e.attributes&&(t=e.attributes["data-cm-mode"].value),e.removeAttribute("required"),CodeMirror.fromTextArea(e,{mode:t,theme:"monokai",lineNumbers:!1,readOnly:e.readOnly,autoRefresh:!0})}));document.querySelectorAll("input[name=name]").forEach((e=>{e.addEventListener("input",(e=>{const t=e.target.closest("form");if(null===t)return;t.querySelector("input[name=slug]").value=e.target.value.toLowerCase().replace(/ /g,"-").replace(/[^\w-]+/g,"")}))})),document.querySelectorAll(".pf-c-page__header-brand-toggle>button").forEach((e=>{e.addEventListener("click",(e=>{const t=document.querySelector(".pf-c-page__sidebar");t.classList.contains("pf-m-expanded")?(t.classList.remove("pf-m-expanded"),t.style.zIndex=0):(t.classList.add("pf-m-expanded"),t.style.zIndex=200)}))})),document.querySelectorAll(".pf-m-expandable>.pf-c-nav__link").forEach((e=>{e.addEventListener("click",(t=>{t.preventDefault(),e.parentElement.classList.toggle("pf-m-expanded")}))}))}();
+(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const Y={};class Z extends K{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,s)=>e.reduceRight(((e,s)=>Array.isArray(s)?t(s,e):(e.add(s),e)),s),s=t(e,new Set),n=[];s.forEach((e=>n.unshift(e))),this._styles=n}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map((e=>{if(e instanceof CSSStyleSheet&&!X){const t=Array.prototype.slice.call(e.cssRules).reduce(((e,t)=>e+t.cssText),"");return new Q(String(t),G)}return e}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?X?this.renderRoot.adoptedStyleSheets=e.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map((e=>e.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==Y&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)})))}render(){return Y}}Z.finalized=!0,Z.render=(e,s,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const r=n.scopeName,i=R.has(s),o=F&&11===s.nodeType&&!!s.host,a=o&&!H.has(r),l=a?document.createDocumentFragment():s;if(((e,s,n)=>{let r=R.get(s);void 0===r&&(t(s,s.firstChild),R.set(s,r=new A(Object.assign({templateFactory:L},n))),r.appendInto(s)),r.setValue(e),r.commit()})(e,l,Object.assign({templateFactory:I(r)},n)),a){const e=R.get(l);R.delete(l);const n=e.value instanceof y?e.value.template:void 0;$(r,l,n),t(s,s.firstChild),s.appendChild(l),R.set(s,e)}!i&&o&&window.ShadyCSS.styleElement(s.host)};customElements.define("fetch-fill-slot",class extends Z{static get properties(){return{url:{type:String},key:{type:String},value:{type:Number}}}comparison(e){var t={"<":function(e,t){return e<t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<=":function(e,t){return e<=t},"==":function(e,t){return e==t},"!=":function(e,t){return e!=t},"===":function(e,t){return e===t},"!==":function(e,t){return e!==t}};const s=e.split(" ");if(s.length<3)throw new Error("nah");let n=s[0];n="value"===n?this.value:parseInt(n,10);let r=s[2];r="value"===r?this.value:parseInt(r,10);const i=s[1];if(!(i in t))throw new Error("Invalid comparison");return t[i](n,r)}firstUpdated(){fetch(this.url).then((e=>e.json())).then((e=>e[this.key])).then((e=>this.value=e))}render(){if(void 0===this.value)return O`<slot></slot>`;let e="";return this.querySelectorAll("[slot]").forEach((t=>{const s=t.getAttribute("slot");this.comparison(s)&&(e=s)})),this.querySelectorAll("[data-value]").forEach((e=>{e.textContent=this.value})),O`<slot name="${e}"></slot>`}});const ee={error:"fas fa-exclamation-circle",warning:"fas fa-exclamation-triangle",success:"fas fa-check-circle",info:"fas fa-info"};function te(){document.querySelector("pb-messages").fetchMessages()}customElements.define("pb-messages",class extends Z{static get properties(){return{url:{type:String},messages:{type:Array}}}createRenderRoot(){return this}firstUpdated(){this.fetchMessages()}fetchMessages(){return fetch(this.url).then((e=>e.json())).then((e=>this.messages=e)).then((e=>{const t=this.querySelector(".pf-c-alert-group");e.forEach((e=>{const s=this.renderMessage(e);t.appendChild(s)}))}))}renderMessage(e){const t="pb-message"+Math.random().toString(36).substr(2,9);const s=document.createElement("template");return s.innerHTML=`<li id=${t} class="pf-c-alert-group__item">\n            <div class="pf-c-alert pf-m-${e.level_tag} ${"error"===e.level_tag?"pf-m-danger":""}">\n                <div class="pf-c-alert__icon">\n                    <i class="${ee[e.level_tag]}"></i>\n                </div>\n                <p class="pf-c-alert__title">\n                    ${e.message}\n                </p>\n            </div>\n        </li>`,setTimeout((()=>{this.querySelector("#"+t).remove()}),1500),s.content.firstChild}render(){return O`<ul class="pf-c-alert-group pf-m-toast"></ul>`}});const se="pf-m-primary",ne=["pf-m-progress","pf-m-in-progress"];class re extends HTMLButtonElement{constructor(){super(),this.addEventListener("click",(e=>this.callAction()))}isRunning=!1;oldBody="";setLoading(){this.classList.add(...ne),this.oldBody=this.innerText,this.innerHTML='<span class="pf-c-button__progress">\n            <span class="pf-c-spinner pf-m-md" role="progressbar" aria-valuetext="Loading...">\n                <span class="pf-c-spinner__clipper"></span>\n                <span class="pf-c-spinner__lead-ball"></span>\n                <span class="pf-c-spinner__tail-ball"></span>\n            </span>\n        </span>'+this.oldBody}setDone(e){this.isRunning=!1,this.classList.remove(...ne),this.innerText=this.oldBody,this.classList.replace(se,e),te(),setTimeout((()=>{this.classList.replace(e,se)}),1e3)}callAction(){if(!0===this.isRunning)return;this.setLoading();const e=function(e){let t=null;if(document.cookie&&""!==document.cookie){const s=document.cookie.split(";");for(let n=0;n<s.length;n++){const r=s[n].trim();if(r.substring(0,e.length+1)===e+"="){t=decodeURIComponent(r.substring(e.length+1));break}}}return t}("passbook_csrf"),t=new Request(this.attributes.url.value,{headers:{"X-CSRFToken":e}});fetch(t,{method:"POST",mode:"same-origin"}).then((e=>e.json())).then((e=>{this.setDone("pf-m-success")})).catch((()=>{this.setDone("pf-m-danger")}))}}customElements.define("action-button",re,{extends:"button"});customElements.define("flow-shell-card",class extends Z{static get properties(){return{flowBodyUrl:{type:String},flowBody:{type:String}}}createRenderRoot(){return this}firstUpdated(){fetch(this.flowBodyUrl).then((e=>e.json())).then((e=>this.updateCard(e)))}async updateCard(e){switch(e.type){case"redirect":window.location=e.to;break;case"template":this.flowBody=e.body,await this.requestUpdate(),this.checkAutofocus(),te(),this.loadFormCode(),this.setFormSubmitHandlers()}}loadFormCode(){this.querySelectorAll("script").forEach((e=>{let t=document.createElement("script");t.src=e.src,document.head.appendChild(t)}))}checkAutofocus(){const e=this.querySelector("[autofocus]");null!==e&&e.focus()}updateFormAction(e){for(let t=0;t<e.elements.length;t++){if(e.elements[t].value===e.action)return console.log("pb-flow: Found Form action URL in form elements, not changing form action."),!1}return e.action=this.flowBodyUrl,console.log("pb-flow: updated form.action "+this.flowBodyUrl),!0}checkAutosubmit(e){if("autosubmit"in e.attributes)return e.submit()}setFormSubmitHandlers(){this.querySelectorAll("form").forEach((e=>{console.log("pb-flow: Checking for autosubmit attribute "+e),this.checkAutosubmit(e),console.log("pb-flow: Setting action for form "+e),this.updateFormAction(e),console.log("pb-flow: Adding handler for form "+e),e.addEventListener("submit",(t=>{t.preventDefault();let s=new FormData(e);this.flowBody=void 0,fetch(this.flowBodyUrl,{method:"post",body:s}).then((e=>e.json())).then((e=>{this.updateCard(e)}))})),e.classList.add("pb-flow-wrapped")}))}loading(){return O`<div class="pf-c-login__main-body pb-loading"><span class="pf-c-spinner" role="progressbar" aria-valuetext="Loading..."><span class="pf-c-spinner__clipper"></span> <span class="pf-c-spinner__lead-ball"></span> <span class="pf-c-spinner__tail-ball"></span></span></div>`}render(){return void 0!==this.flowBody?O([this.flowBody]):this.loading()}}),document.querySelectorAll("button.pf-c-dropdown__toggle").forEach((e=>{e.addEventListener("click",(e=>{const t=e.target.closest(".pf-c-dropdown").querySelector(".pf-c-dropdown__menu");t.hidden=!t.hidden}))})),document.querySelectorAll("input[type=search]").forEach((e=>{e.addEventListener("search",(t=>{""===e.value&&e.parentElement.submit()}))})),document.querySelectorAll("[data-pb-fetch-fill]").forEach((e=>{const t=e.dataset.pbFetchFill,s=e.dataset.pbFetchKey;fetch(t).then((e=>e.json())).then((t=>{e.textContent=t[s],e.value=t[s]}))})),document.querySelectorAll("[data-target='modal']").forEach((e=>{e.addEventListener("click",(e=>{const t=e.target.closest('[data-target="modal"]').attributes["data-modal"].value;document.querySelector("#"+t).removeAttribute("hidden")}))})),document.querySelectorAll(".pf-c-modal-box [data-modal-close]").forEach((e=>{e.addEventListener("click",(e=>{e.target.closest(".pf-c-backdrop").setAttribute("hidden",!0)}))})),document.querySelectorAll(".pf-c-check__label").forEach((e=>{e.addEventListener("click",(e=>{const t=e.target.parentElement.querySelector("input[type=checkbox]");t.checked=!t.checked}))})),document.querySelectorAll(".codemirror").forEach((e=>{let t="xml";"data-cm-mode"in e.attributes&&(t=e.attributes["data-cm-mode"].value),e.removeAttribute("required"),CodeMirror.fromTextArea(e,{mode:t,theme:"monokai",lineNumbers:!1,readOnly:e.readOnly,autoRefresh:!0})}));document.querySelectorAll("input[name=name]").forEach((e=>{e.addEventListener("input",(e=>{const t=e.target.closest("form");if(null===t)return;t.querySelector("input[name=slug]").value=e.target.value.toLowerCase().replace(/ /g,"-").replace(/[^\w-]+/g,"")}))})),document.querySelectorAll(".pf-c-page__header-brand-toggle>button").forEach((e=>{e.addEventListener("click",(e=>{const t=document.querySelector(".pf-c-page__sidebar");t.classList.contains("pf-m-expanded")?(t.classList.remove("pf-m-expanded"),t.style.zIndex=0):(t.classList.add("pf-m-expanded"),t.style.zIndex=200)}))})),document.querySelectorAll(".pf-m-expandable>.pf-c-nav__link").forEach((e=>{e.addEventListener("click",(t=>{t.preventDefault(),e.parentElement.classList.toggle("pf-m-expanded")}))}))}();
 //# sourceMappingURL=passbook.js.map
diff --git a/passbook/static/static/passbook/passbook.js.map b/passbook/static/static/passbook/passbook.js.map
index ddedac440..5f1ee3c82 100644
--- a/passbook/static/static/passbook/passbook.js.map
+++ b/passbook/static/static/passbook/passbook.js.map
@@ -1 +1 @@
-{"version":3,"file":"passbook.js","sources":["../node_modules/lit-html/src/lib/dom.ts","../node_modules/lit-html/src/lib/template.ts","../node_modules/lit-html/src/lib/modify-template.ts","../node_modules/lit-html/src/lib/directive.ts","../node_modules/lit-html/src/lib/part.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/template-factory.ts","../node_modules/lit-html/src/lib/render.ts","../node_modules/lit-html/src/lib/default-template-processor.ts","../node_modules/lit-html/src/lit-html.ts","../node_modules/lit-html/src/lib/shady-render.ts","../node_modules/lit-element/src/lib/updating-element.ts","../node_modules/lit-element/src/lib/css-tag.ts","../node_modules/lit-element/src/lit-element.ts","../src/FetchFillSlot.js","../src/Messages.js","../src/ActionButton.js","../src/utils.js","../src/FlowShellCard.js","../src/passbook.js"],"sourcesContent":["/**\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\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) 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\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\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\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) 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 * 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\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\ndeclare const trustedTypes: typeof window.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n    trustedTypes!.createPolicy('lit-html', {createHTML: (s) => s});\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    let value = this.getHTML();\n    if (policy !== undefined) {\n      // this is secure because `this.strings` is a TemplateStringsArray.\n      // TODO: validate this when\n      // https://github.com/tc39/proposal-array-is-template-object is\n      // implemented.\n      value = policy.createHTML(value) as unknown as string;\n    }\n    template.innerHTML = value;\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\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    const parts = this.parts;\n\n    // If we're assigning an attribute via syntax like:\n    //    attr=\"${foo}\"  or  attr=${foo}\n    // but not\n    //    attr=\"${foo} ${bar}\" or attr=\"${foo} baz\"\n    // then we don't want to coerce the attribute value into one long\n    // string. Instead we want to just return the value itself directly,\n    // so that sanitizeDOMValue can get the actual value rather than\n    // String(value)\n    // The exception is if v is an array, in which case we do want to smash\n    // it together into a string without calling String() on the array.\n    //\n    // This also allows trusted values (when using TrustedTypes) being\n    // assigned to DOM sinks without being stringified in the process.\n    if (l === 1 && strings[0] === '' && strings[1] === '') {\n      const v = parts[0].value;\n      if (typeof v === 'symbol') {\n        return String(v);\n      }\n      if (typeof v === 'string' || !isIterable(v)) {\n        return v;\n      }\n    }\n    let text = '';\n\n    for (let i = 0; i < l; i++) {\n      text += strings[i];\n      const part = 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\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\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\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 *\n * Main lit-html module.\n *\n * Main exports:\n *\n * -  [[html]]\n * -  [[svg]]\n * -  [[render]]\n *\n * @packageDocumentation\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.3.0');\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 to add shady DOM/shady CSS polyfill support to lit-html template\n * rendering. See the [[render]] method for details.\n *\n * @packageDocumentation\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 */\nexport const 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","/**\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 * Use this module if you want to create your own base class extending\n * [[UpdatingElement]].\n * @packageDocumentation\n */\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\nwindow.JSCompiler_renameProperty =\n    <P extends PropertyKey>(prop: P, _obj: unknown): P => prop;\n\ndeclare global {\n  var JSCompiler_renameProperty: <P extends PropertyKey>(\n      prop: P, _obj: unknown) => P;\n\n  interface Window {\n    JSCompiler_renameProperty: typeof JSCompiler_renameProperty;\n  }\n}\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n  /**\n   * Function called to convert an attribute value to a property\n   * value.\n   */\n  fromAttribute?(value: string|null, type?: TypeHint): Type;\n\n  /**\n   * Function called to convert a property value to an attribute\n   * value.\n   *\n   * It returns unknown instead of string, to be compatible with\n   * https://github.com/WICG/trusted-types (and similar efforts).\n   */\n  toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n    ComplexAttributeConverter<Type>|\n    ((value: string|null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n  /**\n   * Indicates how and whether the property becomes an observed attribute.\n   * If the value is `false`, the property is not added to `observedAttributes`.\n   * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n   * becomes `foobar`). If a string, the string value is observed (e.g\n   * `attribute: 'foo-bar'`).\n   */\n  readonly attribute?: boolean|string;\n\n  /**\n   * Indicates the type of the property. This is used only as a hint for the\n   * `converter` to determine how to convert the attribute\n   * to/from a property.\n   */\n  readonly type?: TypeHint;\n\n  /**\n   * Indicates how to convert the attribute to/from a property. If this value\n   * is a function, it is used to convert the attribute value a the property\n   * value. If it's an object, it can have keys for `fromAttribute` and\n   * `toAttribute`. If no `toAttribute` function is provided and\n   * `reflect` is set to `true`, the property value is set directly to the\n   * attribute. A default `converter` is used if none is provided; it supports\n   * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n   * when a property changes and the converter is used to update the attribute,\n   * the property is never updated again as a result of the attribute changing,\n   * and vice versa.\n   */\n  readonly converter?: AttributeConverter<Type, TypeHint>;\n\n  /**\n   * Indicates if the property should reflect to an attribute.\n   * If `true`, when the property is set, the attribute is set using the\n   * attribute name determined according to the rules for the `attribute`\n   * property option and the value of the property converted using the rules\n   * from the `converter` property option.\n   */\n  readonly reflect?: boolean;\n\n  /**\n   * A function that indicates if a property should be considered changed when\n   * it is set. The function should take the `newValue` and `oldValue` and\n   * return `true` if an update should be requested.\n   */\n  hasChanged?(value: Type, oldValue: Type): boolean;\n\n  /**\n   * Indicates whether an accessor will be created for this property. By\n   * default, an accessor will be generated for this property that requests an\n   * update when set. If this flag is `true`, no accessor will be created, and\n   * it will be the user's responsibility to call\n   * `this.requestUpdate(propertyName, oldValue)` to request an update when\n   * the property changes.\n   */\n  readonly noAccessor?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n  readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\n/**\n * Map of changed properties with old values. Takes an optional generic\n * interface corresponding to the declared element properties.\n */\n// tslint:disable-next-line:no-any\nexport type PropertyValues<T = any> =\n    keyof T extends PropertyKey ? Map<keyof T, unknown>: never;\n\nexport const defaultConverter: ComplexAttributeConverter = {\n\n  toAttribute(value: unknown, type?: unknown): unknown {\n    switch (type) {\n      case Boolean:\n        return value ? '' : null;\n      case Object:\n      case Array:\n        // if the value is `null` or `undefined` pass this through\n        // to allow removing/no change behavior.\n        return value == null ? value : JSON.stringify(value);\n    }\n    return value;\n  },\n\n  fromAttribute(value: string|null, type?: unknown) {\n    switch (type) {\n      case Boolean:\n        return value !== null;\n      case Number:\n        return value === null ? null : Number(value);\n      case Object:\n      case Array:\n        return JSON.parse(value!);\n    }\n    return value;\n  }\n\n};\n\nexport interface HasChanged {\n  (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean => {\n  // This ensures (old==NaN, value==NaN) always returns false\n  return old !== value && (old === old || value === value);\n};\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n  attribute: true,\n  type: String,\n  converter: defaultConverter,\n  reflect: false,\n  hasChanged: notEqual\n};\n\nconst STATE_HAS_UPDATED = 1;\nconst STATE_UPDATE_REQUESTED = 1 << 2;\nconst STATE_IS_REFLECTING_TO_ATTRIBUTE = 1 << 3;\nconst STATE_IS_REFLECTING_TO_PROPERTY = 1 << 4;\ntype UpdateState = typeof STATE_HAS_UPDATED|typeof STATE_UPDATE_REQUESTED|\n    typeof STATE_IS_REFLECTING_TO_ATTRIBUTE|\n    typeof STATE_IS_REFLECTING_TO_PROPERTY;\n\n/**\n * The Closure JS Compiler doesn't currently have good support for static\n * property semantics where \"this\" is dynamic (e.g.\n * https://github.com/google/closure-compiler/issues/3177 and others) so we use\n * this hack to bypass any rewriting by the compiler.\n */\nconst finalized = 'finalized';\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclassers to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class UpdatingElement extends HTMLElement {\n  /*\n   * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n   * all static methods and properties with initializers.  Reference:\n   * - https://github.com/google/closure-compiler/issues/1776\n   */\n\n  /**\n   * Maps attribute names to properties; for example `foobar` attribute to\n   * `fooBar` property. Created lazily on user subclasses when finalizing the\n   * class.\n   */\n  private static _attributeToPropertyMap: AttributeMap;\n\n  /**\n   * Marks class as having finished creating properties.\n   */\n  protected static[finalized] = true;\n\n  /**\n   * Memoized list of all class properties, including any superclass properties.\n   * Created lazily on user subclasses when finalizing the class.\n   */\n  private static _classProperties?: PropertyDeclarationMap;\n\n  /**\n   * User-supplied object that maps property names to `PropertyDeclaration`\n   * objects containing options for configuring the property.\n   */\n  static properties: PropertyDeclarations;\n\n  /**\n   * Returns a list of attributes corresponding to the registered properties.\n   * @nocollapse\n   */\n  static get observedAttributes() {\n    // note: piggy backing on this to ensure we're finalized.\n    this.finalize();\n    const attributes: string[] = [];\n    // Use forEach so this works even if for/of loops are compiled to for loops\n    // expecting arrays\n    this._classProperties!.forEach((v, p) => {\n      const attr = this._attributeNameForProperty(p, v);\n      if (attr !== undefined) {\n        this._attributeToPropertyMap.set(attr, p);\n        attributes.push(attr);\n      }\n    });\n    return attributes;\n  }\n\n  /**\n   * Ensures the private `_classProperties` property metadata is created.\n   * In addition to `finalize` this is also called in `createProperty` to\n   * ensure the `@property` decorator can add property metadata.\n   */\n  /** @nocollapse */\n  private static _ensureClassProperties() {\n    // ensure private storage for property declarations.\n    if (!this.hasOwnProperty(\n            JSCompiler_renameProperty('_classProperties', this))) {\n      this._classProperties = new Map();\n      // NOTE: Workaround IE11 not supporting Map constructor argument.\n      const superProperties: PropertyDeclarationMap =\n          Object.getPrototypeOf(this)._classProperties;\n      if (superProperties !== undefined) {\n        superProperties.forEach(\n            (v: PropertyDeclaration, k: PropertyKey) =>\n                this._classProperties!.set(k, v));\n      }\n    }\n  }\n\n  /**\n   * Creates a property accessor on the element prototype if one does not exist\n   * and stores a PropertyDeclaration for the property with the given options.\n   * The property setter calls the property's `hasChanged` property option\n   * or uses a strict identity check to determine whether or not to request\n   * an update.\n   *\n   * This method may be overridden to customize properties; however,\n   * when doing so, it's important to call `super.createProperty` to ensure\n   * the property is setup correctly. This method calls\n   * `getPropertyDescriptor` internally to get a descriptor to install.\n   * To customize what properties do when they are get or set, override\n   * `getPropertyDescriptor`. To customize the options for a property,\n   * implement `createProperty` like this:\n   *\n   * static createProperty(name, options) {\n   *   options = Object.assign(options, {myOption: true});\n   *   super.createProperty(name, options);\n   * }\n   *\n   * @nocollapse\n   */\n  static createProperty(\n      name: PropertyKey,\n      options: PropertyDeclaration = defaultPropertyDeclaration) {\n    // Note, since this can be called by the `@property` decorator which\n    // is called before `finalize`, we ensure storage exists for property\n    // metadata.\n    this._ensureClassProperties();\n    this._classProperties!.set(name, options);\n    // Do not generate an accessor if the prototype already has one, since\n    // it would be lost otherwise and that would never be the user's intention;\n    // Instead, we expect users to call `requestUpdate` themselves from\n    // user-defined accessors. Note that if the super has an accessor we will\n    // still overwrite it\n    if (options.noAccessor || this.prototype.hasOwnProperty(name)) {\n      return;\n    }\n    const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n    const descriptor = this.getPropertyDescriptor(name, key, options);\n    if (descriptor !== undefined) {\n      Object.defineProperty(this.prototype, name, descriptor);\n    }\n  }\n\n  /**\n   * Returns a property descriptor to be defined on the given named property.\n   * If no descriptor is returned, the property will not become an accessor.\n   * For example,\n   *\n   *   class MyElement extends LitElement {\n   *     static getPropertyDescriptor(name, key, options) {\n   *       const defaultDescriptor =\n   *           super.getPropertyDescriptor(name, key, options);\n   *       const setter = defaultDescriptor.set;\n   *       return {\n   *         get: defaultDescriptor.get,\n   *         set(value) {\n   *           setter.call(this, value);\n   *           // custom action.\n   *         },\n   *         configurable: true,\n   *         enumerable: true\n   *       }\n   *     }\n   *   }\n   *\n   * @nocollapse\n   */\n  protected static getPropertyDescriptor(\n      name: PropertyKey, key: string|symbol, options: PropertyDeclaration) {\n    return {\n      // tslint:disable-next-line:no-any no symbol in index\n      get(): any {\n        return (this as {[key: string]: unknown})[key as string];\n      },\n      set(this: UpdatingElement, value: unknown) {\n        const oldValue =\n            (this as {} as {[key: string]: unknown})[name as string];\n        (this as {} as {[key: string]: unknown})[key as string] = value;\n        (this as unknown as UpdatingElement)\n            .requestUpdateInternal(name, oldValue, options);\n      },\n      configurable: true,\n      enumerable: true\n    };\n  }\n\n  /**\n   * Returns the property options associated with the given property.\n   * These options are defined with a PropertyDeclaration via the `properties`\n   * object or the `@property` decorator and are registered in\n   * `createProperty(...)`.\n   *\n   * Note, this method should be considered \"final\" and not overridden. To\n   * customize the options for a given property, override `createProperty`.\n   *\n   * @nocollapse\n   * @final\n   */\n  protected static getPropertyOptions(name: PropertyKey) {\n    return this._classProperties && this._classProperties.get(name) ||\n        defaultPropertyDeclaration;\n  }\n\n  /**\n   * Creates property accessors for registered properties and ensures\n   * any superclasses are also finalized.\n   * @nocollapse\n   */\n  protected static finalize() {\n    // finalize any superclasses\n    const superCtor = Object.getPrototypeOf(this);\n    if (!superCtor.hasOwnProperty(finalized)) {\n      superCtor.finalize();\n    }\n    this[finalized] = true;\n    this._ensureClassProperties();\n    // initialize Map populated in observedAttributes\n    this._attributeToPropertyMap = new Map();\n    // make any properties\n    // Note, only process \"own\" properties since this element will inherit\n    // any properties defined on the superClass, and finalization ensures\n    // the entire prototype chain is finalized.\n    if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n      const props = this.properties;\n      // support symbols in properties (IE11 does not support this)\n      const propKeys = [\n        ...Object.getOwnPropertyNames(props),\n        ...(typeof Object.getOwnPropertySymbols === 'function') ?\n            Object.getOwnPropertySymbols(props) :\n            []\n      ];\n      // This for/of is ok because propKeys is an array\n      for (const p of propKeys) {\n        // note, use of `any` is due to TypeSript lack of support for symbol in\n        // index types\n        // tslint:disable-next-line:no-any no symbol in index\n        this.createProperty(p, (props as any)[p]);\n      }\n    }\n  }\n\n  /**\n   * Returns the property name for the given attribute `name`.\n   * @nocollapse\n   */\n  private static _attributeNameForProperty(\n      name: PropertyKey, options: PropertyDeclaration) {\n    const attribute = options.attribute;\n    return attribute === false ?\n        undefined :\n        (typeof attribute === 'string' ?\n             attribute :\n             (typeof name === 'string' ? name.toLowerCase() : undefined));\n  }\n\n  /**\n   * Returns true if a property should request an update.\n   * Called when a property value is set and uses the `hasChanged`\n   * option for the property if present or a strict identity check.\n   * @nocollapse\n   */\n  private static _valueHasChanged(\n      value: unknown, old: unknown, hasChanged: HasChanged = notEqual) {\n    return hasChanged(value, old);\n  }\n\n  /**\n   * Returns the property value for the given attribute value.\n   * Called via the `attributeChangedCallback` and uses the property's\n   * `converter` or `converter.fromAttribute` property option.\n   * @nocollapse\n   */\n  private static _propertyValueFromAttribute(\n      value: string|null, options: PropertyDeclaration) {\n    const type = options.type;\n    const converter = options.converter || defaultConverter;\n    const fromAttribute =\n        (typeof converter === 'function' ? converter : converter.fromAttribute);\n    return fromAttribute ? fromAttribute(value, type) : value;\n  }\n\n  /**\n   * Returns the attribute value for the given property value. If this\n   * returns undefined, the property will *not* be reflected to an attribute.\n   * If this returns null, the attribute will be removed, otherwise the\n   * attribute will be set to the value.\n   * This uses the property's `reflect` and `type.toAttribute` property options.\n   * @nocollapse\n   */\n  private static _propertyValueToAttribute(\n      value: unknown, options: PropertyDeclaration) {\n    if (options.reflect === undefined) {\n      return;\n    }\n    const type = options.type;\n    const converter = options.converter;\n    const toAttribute =\n        converter && (converter as ComplexAttributeConverter).toAttribute ||\n        defaultConverter.toAttribute;\n    return toAttribute!(value, type);\n  }\n\n  private _updateState!: UpdateState;\n  private _instanceProperties?: PropertyValues;\n  // Initialize to an unresolved Promise so we can make sure the element has\n  // connected before first update.\n  private _updatePromise!: Promise<unknown>;\n  private _enableUpdatingResolver: (() => void)|undefined;\n\n  /**\n   * Map with keys for any properties that have changed since the last\n   * update cycle with previous values.\n   */\n  private _changedProperties!: PropertyValues;\n\n  /**\n   * Map with keys of properties that should be reflected when updated.\n   */\n  private _reflectingProperties?: Map<PropertyKey, PropertyDeclaration>;\n\n  constructor() {\n    super();\n    this.initialize();\n  }\n\n  /**\n   * Performs element initialization. By default captures any pre-set values for\n   * registered properties.\n   */\n  protected initialize() {\n    this._updateState = 0;\n    this._updatePromise =\n        new Promise((res) => this._enableUpdatingResolver = res);\n    this._changedProperties = new Map();\n    this._saveInstanceProperties();\n    // ensures first update will be caught by an early access of\n    // `updateComplete`\n    this.requestUpdateInternal();\n  }\n\n  /**\n   * Fixes any properties set on the instance before upgrade time.\n   * Otherwise these would shadow the accessor and break these properties.\n   * The properties are stored in a Map which is played back after the\n   * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n   * (<=41), properties created for native platform properties like (`id` or\n   * `name`) may not have default values set in the element constructor. On\n   * these browsers native properties appear on instances and therefore their\n   * default value will overwrite any element default (e.g. if the element sets\n   * this.id = 'id' in the constructor, the 'id' will become '' since this is\n   * the native platform default).\n   */\n  private _saveInstanceProperties() {\n    // Use forEach so this works even if for/of loops are compiled to for loops\n    // expecting arrays\n    (this.constructor as typeof UpdatingElement)\n        ._classProperties!.forEach((_v, p) => {\n          if (this.hasOwnProperty(p)) {\n            const value = this[p as keyof this];\n            delete this[p as keyof this];\n            if (!this._instanceProperties) {\n              this._instanceProperties = new Map();\n            }\n            this._instanceProperties.set(p, value);\n          }\n        });\n  }\n\n  /**\n   * Applies previously saved instance properties.\n   */\n  private _applyInstanceProperties() {\n    // Use forEach so this works even if for/of loops are compiled to for loops\n    // expecting arrays\n    // tslint:disable-next-line:no-any\n    this._instanceProperties!.forEach((v, p) => (this as any)[p] = v);\n    this._instanceProperties = undefined;\n  }\n\n  connectedCallback() {\n    // Ensure first connection completes an update. Updates cannot complete\n    // before connection.\n    this.enableUpdating();\n  }\n\n  protected enableUpdating() {\n    if (this._enableUpdatingResolver !== undefined) {\n      this._enableUpdatingResolver();\n      this._enableUpdatingResolver = undefined;\n    }\n  }\n\n  /**\n   * Allows for `super.disconnectedCallback()` in extensions while\n   * reserving the possibility of making non-breaking feature additions\n   * when disconnecting at some point in the future.\n   */\n  disconnectedCallback() {\n  }\n\n  /**\n   * Synchronizes property values when attributes change.\n   */\n  attributeChangedCallback(name: string, old: string|null, value: string|null) {\n    if (old !== value) {\n      this._attributeToProperty(name, value);\n    }\n  }\n\n  private _propertyToAttribute(\n      name: PropertyKey, value: unknown,\n      options: PropertyDeclaration = defaultPropertyDeclaration) {\n    const ctor = (this.constructor as typeof UpdatingElement);\n    const attr = ctor._attributeNameForProperty(name, options);\n    if (attr !== undefined) {\n      const attrValue = ctor._propertyValueToAttribute(value, options);\n      // an undefined value does not change the attribute.\n      if (attrValue === undefined) {\n        return;\n      }\n      // Track if the property is being reflected to avoid\n      // setting the property again via `attributeChangedCallback`. Note:\n      // 1. this takes advantage of the fact that the callback is synchronous.\n      // 2. will behave incorrectly if multiple attributes are in the reaction\n      // stack at time of calling. However, since we process attributes\n      // in `update` this should not be possible (or an extreme corner case\n      // that we'd like to discover).\n      // mark state reflecting\n      this._updateState = this._updateState | STATE_IS_REFLECTING_TO_ATTRIBUTE;\n      if (attrValue == null) {\n        this.removeAttribute(attr);\n      } else {\n        this.setAttribute(attr, attrValue as string);\n      }\n      // mark state not reflecting\n      this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_ATTRIBUTE;\n    }\n  }\n\n  private _attributeToProperty(name: string, value: string|null) {\n    // Use tracking info to avoid deserializing attribute value if it was\n    // just set from a property setter.\n    if (this._updateState & STATE_IS_REFLECTING_TO_ATTRIBUTE) {\n      return;\n    }\n    const ctor = (this.constructor as typeof UpdatingElement);\n    // Note, hint this as an `AttributeMap` so closure clearly understands\n    // the type; it has issues with tracking types through statics\n    // tslint:disable-next-line:no-unnecessary-type-assertion\n    const propName = (ctor._attributeToPropertyMap as AttributeMap).get(name);\n    if (propName !== undefined) {\n      const options = ctor.getPropertyOptions(propName);\n      // mark state reflecting\n      this._updateState = this._updateState | STATE_IS_REFLECTING_TO_PROPERTY;\n      this[propName as keyof this] =\n          // tslint:disable-next-line:no-any\n          ctor._propertyValueFromAttribute(value, options) as any;\n      // mark state not reflecting\n      this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_PROPERTY;\n    }\n  }\n\n  /**\n   * This protected version of `requestUpdate` does not access or return the\n   * `updateComplete` promise. This promise can be overridden and is therefore\n   * not free to access.\n   */\n  protected requestUpdateInternal(\n      name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration) {\n    let shouldRequestUpdate = true;\n    // If we have a property key, perform property update steps.\n    if (name !== undefined) {\n      const ctor = this.constructor as typeof UpdatingElement;\n      options = options || ctor.getPropertyOptions(name);\n      if (ctor._valueHasChanged(\n              this[name as keyof this], oldValue, options.hasChanged)) {\n        if (!this._changedProperties.has(name)) {\n          this._changedProperties.set(name, oldValue);\n        }\n        // Add to reflecting properties set.\n        // Note, it's important that every change has a chance to add the\n        // property to `_reflectingProperties`. This ensures setting\n        // attribute + property reflects correctly.\n        if (options.reflect === true &&\n            !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) {\n          if (this._reflectingProperties === undefined) {\n            this._reflectingProperties = new Map();\n          }\n          this._reflectingProperties.set(name, options);\n        }\n      } else {\n        // Abort the request if the property should not be considered changed.\n        shouldRequestUpdate = false;\n      }\n    }\n    if (!this._hasRequestedUpdate && shouldRequestUpdate) {\n      this._updatePromise = this._enqueueUpdate();\n    }\n  }\n\n  /**\n   * Requests an update which is processed asynchronously. This should\n   * be called when an element should update based on some state not triggered\n   * by setting a property. In this case, pass no arguments. It should also be\n   * called when manually implementing a property setter. In this case, pass the\n   * property `name` and `oldValue` to ensure that any configured property\n   * options are honored. Returns the `updateComplete` Promise which is resolved\n   * when the update completes.\n   *\n   * @param name {PropertyKey} (optional) name of requesting property\n   * @param oldValue {any} (optional) old value of requesting property\n   * @returns {Promise} A Promise that is resolved when the update completes.\n   */\n  requestUpdate(name?: PropertyKey, oldValue?: unknown) {\n    this.requestUpdateInternal(name, oldValue);\n    return this.updateComplete;\n  }\n\n  /**\n   * Sets up the element to asynchronously update.\n   */\n  private async _enqueueUpdate() {\n    this._updateState = this._updateState | STATE_UPDATE_REQUESTED;\n    try {\n      // Ensure any previous update has resolved before updating.\n      // This `await` also ensures that property changes are batched.\n      await this._updatePromise;\n    } catch (e) {\n      // Ignore any previous errors. We only care that the previous cycle is\n      // done. Any error should have been handled in the previous update.\n    }\n    const result = this.performUpdate();\n    // If `performUpdate` returns a Promise, we await it. This is done to\n    // enable coordinating updates with a scheduler. Note, the result is\n    // checked to avoid delaying an additional microtask unless we need to.\n    if (result != null) {\n      await result;\n    }\n    return !this._hasRequestedUpdate;\n  }\n\n  private get _hasRequestedUpdate() {\n    return (this._updateState & STATE_UPDATE_REQUESTED);\n  }\n\n  protected get hasUpdated() {\n    return (this._updateState & STATE_HAS_UPDATED);\n  }\n\n  /**\n   * Performs an element update. Note, if an exception is thrown during the\n   * update, `firstUpdated` and `updated` will not be called.\n   *\n   * You can override this method to change the timing of updates. If this\n   * method is overridden, `super.performUpdate()` must be called.\n   *\n   * For instance, to schedule updates to occur just before the next frame:\n   *\n   * ```\n   * protected async performUpdate(): Promise<unknown> {\n   *   await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n   *   super.performUpdate();\n   * }\n   * ```\n   */\n  protected performUpdate(): void|Promise<unknown> {\n    // Abort any update if one is not pending when this is called.\n    // This can happen if `performUpdate` is called early to \"flush\"\n    // the update.\n    if (!this._hasRequestedUpdate) {\n      return;\n    }\n    // Mixin instance properties once, if they exist.\n    if (this._instanceProperties) {\n      this._applyInstanceProperties();\n    }\n    let shouldUpdate = false;\n    const changedProperties = this._changedProperties;\n    try {\n      shouldUpdate = this.shouldUpdate(changedProperties);\n      if (shouldUpdate) {\n        this.update(changedProperties);\n      } else {\n        this._markUpdated();\n      }\n    } catch (e) {\n      // Prevent `firstUpdated` and `updated` from running when there's an\n      // update exception.\n      shouldUpdate = false;\n      // Ensure element can accept additional updates after an exception.\n      this._markUpdated();\n      throw e;\n    }\n    if (shouldUpdate) {\n      if (!(this._updateState & STATE_HAS_UPDATED)) {\n        this._updateState = this._updateState | STATE_HAS_UPDATED;\n        this.firstUpdated(changedProperties);\n      }\n      this.updated(changedProperties);\n    }\n  }\n\n  private _markUpdated() {\n    this._changedProperties = new Map();\n    this._updateState = this._updateState & ~STATE_UPDATE_REQUESTED;\n  }\n\n  /**\n   * Returns a Promise that resolves when the element has completed updating.\n   * The Promise value is a boolean that is `true` if the element completed the\n   * update without triggering another update. The Promise result is `false` if\n   * a property was set inside `updated()`. If the Promise is rejected, an\n   * exception was thrown during the update.\n   *\n   * To await additional asynchronous work, override the `_getUpdateComplete`\n   * method. For example, it is sometimes useful to await a rendered element\n   * before fulfilling this Promise. To do this, first await\n   * `super._getUpdateComplete()`, then any subsequent state.\n   *\n   * @returns {Promise} The Promise returns a boolean that indicates if the\n   * update resolved without triggering another update.\n   */\n  get updateComplete() {\n    return this._getUpdateComplete();\n  }\n\n  /**\n   * Override point for the `updateComplete` promise.\n   *\n   * It is not safe to override the `updateComplete` getter directly due to a\n   * limitation in TypeScript which means it is not possible to call a\n   * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n   * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n   * This method should be overridden instead. For example:\n   *\n   *   class MyElement extends LitElement {\n   *     async _getUpdateComplete() {\n   *       await super._getUpdateComplete();\n   *       await this._myChild.updateComplete;\n   *     }\n   *   }\n   */\n  protected _getUpdateComplete() {\n    return this._updatePromise;\n  }\n\n  /**\n   * Controls whether or not `update` should be called when the element requests\n   * an update. By default, this method always returns `true`, but this can be\n   * customized to control when to update.\n   *\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n    return true;\n  }\n\n  /**\n   * Updates the element. This method reflects property values to attributes.\n   * It can be overridden to render and keep updated element DOM.\n   * Setting properties inside this method will *not* trigger\n   * another update.\n   *\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected update(_changedProperties: PropertyValues) {\n    if (this._reflectingProperties !== undefined &&\n        this._reflectingProperties.size > 0) {\n      // Use forEach so this works even if for/of loops are compiled to for\n      // loops expecting arrays\n      this._reflectingProperties.forEach(\n          (v, k) => this._propertyToAttribute(k, this[k as keyof this], v));\n      this._reflectingProperties = undefined;\n    }\n    this._markUpdated();\n  }\n\n  /**\n   * Invoked whenever the element is updated. Implement to perform\n   * post-updating tasks via DOM APIs, for example, focusing an element.\n   *\n   * Setting properties inside this method will trigger the element to update\n   * again after this update cycle completes.\n   *\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected updated(_changedProperties: PropertyValues) {\n  }\n\n  /**\n   * Invoked when the element is first updated. Implement to perform one time\n   * work on the element after update.\n   *\n   * Setting properties inside this method will trigger the element to update\n   * again after this update cycle completes.\n   *\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected firstUpdated(_changedProperties: PropertyValues) {\n  }\n}\n","/**\n@license\nCopyright (c) 2019 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at\nhttp://polymer.github.io/LICENSE.txt The complete set of authors may be found at\nhttp://polymer.github.io/AUTHORS.txt The complete set of contributors may be\nfound at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as\npart of the polymer project is also subject to an additional IP rights grant\nfound at http://polymer.github.io/PATENTS.txt\n*/\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets = (window.ShadowRoot) &&\n    (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) &&\n    ('adoptedStyleSheets' in Document.prototype) &&\n    ('replace' in CSSStyleSheet.prototype);\n\nconst constructionToken = Symbol();\n\nexport class CSSResult {\n  _styleSheet?: CSSStyleSheet|null;\n\n  readonly cssText: string;\n\n  constructor(cssText: string, safeToken: symbol) {\n    if (safeToken !== constructionToken) {\n      throw new Error(\n          'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');\n    }\n\n    this.cssText = cssText;\n  }\n\n  // Note, this is a getter so that it's lazy. In practice, this means\n  // stylesheets are not created until the first element instance is made.\n  get styleSheet(): CSSStyleSheet|null {\n    if (this._styleSheet === undefined) {\n      // Note, if `supportsAdoptingStyleSheets` is true then we assume\n      // CSSStyleSheet is constructable.\n      if (supportsAdoptingStyleSheets) {\n        this._styleSheet = new CSSStyleSheet();\n        this._styleSheet.replaceSync(this.cssText);\n      } else {\n        this._styleSheet = null;\n      }\n    }\n    return this._styleSheet;\n  }\n\n  toString(): string {\n    return this.cssText;\n  }\n}\n\n/**\n * Wrap a value for interpolation in a [[`css`]] tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) => {\n  return new CSSResult(String(value), constructionToken);\n};\n\nconst textFromCSSResult = (value: CSSResult|number) => {\n  if (value instanceof CSSResult) {\n    return value.cssText;\n  } else if (typeof value === 'number') {\n    return value;\n  } else {\n    throw new Error(\n        `Value passed to 'css' function must be a 'css' function result: ${\n            value}. Use 'unsafeCSS' to pass non-literal values, but\n            take care to ensure page security.`);\n  }\n};\n\n/**\n * Template tag which which can be used with LitElement's [[LitElement.styles |\n * `styles`]] property to set element styles. For security reasons, only literal\n * string values may be used. To incorporate non-literal values [[`unsafeCSS`]]\n * may be used inside a template string part.\n */\nexport const css =\n    (strings: TemplateStringsArray, ...values: (CSSResult|number)[]) => {\n      const cssText = values.reduce(\n          (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n          strings[0]);\n      return new CSSResult(cssText, constructionToken);\n    };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The main LitElement module, which defines the [[`LitElement`]] base class and\n * related APIs.\n *\n *  LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n *  Import [[`LitElement`]] and [[`html`]] from this module to create a\n * component:\n *\n *  ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n *   // Declare observed properties\n *   static get properties() {\n *     return {\n *       adjective: {}\n *     }\n *   }\n *\n *   constructor() {\n *     this.adjective = 'awesome';\n *   }\n *\n *   // Define the element's template\n *   render() {\n *     return html`<p>your ${adjective} template here</p>`;\n *   }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends [[`UpdatingElement`]] and adds lit-html templating.\n * The `UpdatingElement` class is provided for users that want to build\n * their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\nimport {render, ShadyRenderOptions} from 'lit-html/lib/shady-render.js';\n\nimport {PropertyValues, UpdatingElement} from './lib/updating-element.js';\n\nexport * from './lib/updating-element.js';\nexport * from './lib/decorators.js';\nexport {html, svg, TemplateResult, SVGTemplateResult} from 'lit-html/lit-html.js';\nimport {supportsAdoptingStyleSheets, CSSResult, unsafeCSS} from './lib/css-tag.js';\nexport * from './lib/css-tag.js';\n\ndeclare global {\n  interface Window {\n    litElementVersions: string[];\n  }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n// TODO(justinfagnani): inject version number at build time\n(window['litElementVersions'] || (window['litElementVersions'] = []))\n    .push('2.4.0');\n\nexport type CSSResultOrNative = CSSResult|CSSStyleSheet;\n\nexport interface CSSResultArray extends\n    Array<CSSResultOrNative|CSSResultArray> {}\n\n/**\n * Sentinal value used to avoid calling lit-html's render function when\n * subclasses do not implement `render`\n */\nconst renderNotImplemented = {};\n\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the [[`properties`]] property or the [[`property`]] decorator.\n */\nexport class LitElement extends UpdatingElement {\n  /**\n   * Ensure this class is marked as `finalized` as an optimization ensuring\n   * it will not needlessly try to `finalize`.\n   *\n   * Note this property name is a string to prevent breaking Closure JS Compiler\n   * optimizations. See updating-element.ts for more information.\n   */\n  protected static['finalized'] = true;\n\n  /**\n   * Reference to the underlying library method used to render the element's\n   * DOM. By default, points to the `render` method from lit-html's shady-render\n   * module.\n   *\n   * **Most users will never need to touch this property.**\n   *\n   * This  property should not be confused with the `render` instance method,\n   * which should be overridden to define a template for the element.\n   *\n   * Advanced users creating a new base class based on LitElement can override\n   * this property to point to a custom render method with a signature that\n   * matches [shady-render's `render`\n   * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render).\n   *\n   * @nocollapse\n   */\n  static render:\n      (result: unknown, container: Element|DocumentFragment,\n       options: ShadyRenderOptions) => void = render;\n\n  /**\n   * Array of styles to apply to the element. The styles should be defined\n   * using the [[`css`]] tag function or via constructible stylesheets.\n   */\n  static styles?: CSSResultOrNative|CSSResultArray;\n\n  private static _styles: Array<CSSResultOrNative|CSSResult>|undefined;\n\n  /**\n   * Return the array of styles to apply to the element.\n   * Override this method to integrate into a style management system.\n   *\n   * @nocollapse\n   */\n  static getStyles(): CSSResultOrNative|CSSResultArray|undefined {\n    return this.styles;\n  }\n\n  /** @nocollapse */\n  private static _getUniqueStyles() {\n    // Only gather styles once per class\n    if (this.hasOwnProperty(JSCompiler_renameProperty('_styles', this))) {\n      return;\n    }\n    // Take care not to call `this.getStyles()` multiple times since this\n    // generates new CSSResults each time.\n    // TODO(sorvell): Since we do not cache CSSResults by input, any\n    // shared styles will generate new stylesheet objects, which is wasteful.\n    // This should be addressed when a browser ships constructable\n    // stylesheets.\n    const userStyles = this.getStyles();\n\n    if (Array.isArray(userStyles)) {\n      // De-duplicate styles preserving the _last_ instance in the set.\n      // This is a performance optimization to avoid duplicated styles that can\n      // occur especially when composing via subclassing.\n      // The last item is kept to try to preserve the cascade order with the\n      // assumption that it's most important that last added styles override\n      // previous styles.\n      const addStyles = (styles: CSSResultArray, set: Set<CSSResultOrNative>):\n          Set<CSSResultOrNative> => styles.reduceRight(\n              (set: Set<CSSResultOrNative>, s) =>\n                  // Note: On IE set.add() does not return the set\n              Array.isArray(s) ? addStyles(s, set) : (set.add(s), set),\n              set);\n      // Array.from does not work on Set in IE, otherwise return\n      // Array.from(addStyles(userStyles, new Set<CSSResult>())).reverse()\n      const set = addStyles(userStyles, new Set<CSSResultOrNative>());\n      const styles: CSSResultOrNative[] = [];\n      set.forEach((v) => styles.unshift(v));\n      this._styles = styles;\n    } else {\n      this._styles = userStyles === undefined ? [] : [userStyles];\n    }\n\n    // Ensure that there are no invalid CSSStyleSheet instances here. They are\n    // invalid in two conditions.\n    // (1) the sheet is non-constructible (`sheet` of a HTMLStyleElement), but\n    //     this is impossible to check except via .replaceSync or use\n    // (2) the ShadyCSS polyfill is enabled (:. supportsAdoptingStyleSheets is\n    //     false)\n    this._styles = this._styles.map((s) => {\n      if (s instanceof CSSStyleSheet && !supportsAdoptingStyleSheets) {\n        // Flatten the cssText from the passed constructible stylesheet (or\n        // undetectable non-constructible stylesheet). The user might have\n        // expected to update their stylesheets over time, but the alternative\n        // is a crash.\n        const cssText = Array.prototype.slice.call(s.cssRules)\n                            .reduce((css, rule) => css + rule.cssText, '');\n        return unsafeCSS(cssText);\n      }\n      return s;\n    });\n  }\n\n  private _needsShimAdoptedStyleSheets?: boolean;\n\n  /**\n   * Node or ShadowRoot into which element DOM should be rendered. Defaults\n   * to an open shadowRoot.\n   */\n  readonly renderRoot!: Element|DocumentFragment;\n\n  /**\n   * Performs element initialization. By default this calls\n   * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and\n   * captures any pre-set values for registered properties.\n   */\n  protected initialize() {\n    super.initialize();\n    (this.constructor as typeof LitElement)._getUniqueStyles();\n    (this as {\n      renderRoot: Element|DocumentFragment;\n    }).renderRoot = this.createRenderRoot();\n    // Note, if renderRoot is not a shadowRoot, styles would/could apply to the\n    // element's getRootNode(). While this could be done, we're choosing not to\n    // support this now since it would require different logic around de-duping.\n    if (window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot) {\n      this.adoptStyles();\n    }\n  }\n\n  /**\n   * Returns the node into which the element should render and by default\n   * creates and returns an open shadowRoot. Implement to customize where the\n   * element's DOM is rendered. For example, to render into the element's\n   * childNodes, return `this`.\n   * @returns {Element|DocumentFragment} Returns a node into which to render.\n   */\n  protected createRenderRoot(): Element|ShadowRoot {\n    return this.attachShadow({mode: 'open'});\n  }\n\n  /**\n   * Applies styling to the element shadowRoot using the [[`styles`]]\n   * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where\n   * available and will fallback otherwise. When Shadow DOM is polyfilled,\n   * ShadyCSS scopes styles and adds them to the document. When Shadow DOM\n   * is available but `adoptedStyleSheets` is not, styles are appended to the\n   * end of the `shadowRoot` to [mimic spec\n   * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n   */\n  protected adoptStyles() {\n    const styles = (this.constructor as typeof LitElement)._styles!;\n    if (styles.length === 0) {\n      return;\n    }\n    // There are three separate cases here based on Shadow DOM support.\n    // (1) shadowRoot polyfilled: use ShadyCSS\n    // (2) shadowRoot.adoptedStyleSheets available: use it\n    // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after\n    // rendering\n    if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n      window.ShadyCSS.ScopingShim!.prepareAdoptedCssText(\n          styles.map((s) => s.cssText), this.localName);\n    } else if (supportsAdoptingStyleSheets) {\n      (this.renderRoot as ShadowRoot).adoptedStyleSheets =\n          styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet!);\n    } else {\n      // This must be done after rendering so the actual style insertion is done\n      // in `update`.\n      this._needsShimAdoptedStyleSheets = true;\n    }\n  }\n\n  connectedCallback() {\n    super.connectedCallback();\n    // Note, first update/render handles styleElement so we only call this if\n    // connected after first update.\n    if (this.hasUpdated && window.ShadyCSS !== undefined) {\n      window.ShadyCSS.styleElement(this);\n    }\n  }\n\n  /**\n   * Updates the element. This method reflects property values to attributes\n   * and calls `render` to render DOM via lit-html. Setting properties inside\n   * this method will *not* trigger another update.\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected update(changedProperties: PropertyValues) {\n    // Setting properties in `render` should not trigger an update. Since\n    // updates are allowed after super.update, it's important to call `render`\n    // before that.\n    const templateResult = this.render();\n    super.update(changedProperties);\n    // If render is not implemented by the component, don't call lit-html render\n    if (templateResult !== renderNotImplemented) {\n      (this.constructor as typeof LitElement)\n          .render(\n              templateResult,\n              this.renderRoot,\n              {scopeName: this.localName, eventContext: this});\n    }\n    // When native Shadow DOM is used but adoptedStyles are not supported,\n    // insert styling after rendering to ensure adoptedStyles have highest\n    // priority.\n    if (this._needsShimAdoptedStyleSheets) {\n      this._needsShimAdoptedStyleSheets = false;\n      (this.constructor as typeof LitElement)._styles!.forEach((s) => {\n        const style = document.createElement('style');\n        style.textContent = s.cssText;\n        this.renderRoot.appendChild(style);\n      });\n    }\n  }\n\n  /**\n   * Invoked on each update to perform rendering tasks. This method may return\n   * any value renderable by lit-html's `NodePart` - typically a\n   * `TemplateResult`. Setting properties inside this method will *not* trigger\n   * the element to update.\n   */\n  protected render(): unknown {\n    return renderNotImplemented;\n  }\n}\n","import { LitElement, html } from 'lit-element';\n\nclass FetchFillSlot extends LitElement {\n\n    static get properties() {\n        return {\n            url: { type: String },\n            key: { type: String },\n            value: { type: Number },\n        };\n    }\n\n    comparison(slotName) {\n        var comparisonOperatorsHash = {\n            '<': function (a, b) { return a < b; },\n            '>': function (a, b) { return a > b; },\n            '>=': function (a, b) { return a >= b; },\n            '<=': function (a, b) { return a <= b; },\n            '==': function (a, b) { return a == b; },\n            '!=': function (a, b) { return a != b; },\n            '===': function (a, b) { return a === b; },\n            '!==': function (a, b) { return a !== b; },\n        };\n        const tokens = slotName.split(\" \");\n        if (tokens.length < 3) {\n            throw new Error(\"nah\");\n        }\n        let a = tokens[0];\n        if (a === \"value\") {\n            a = this.value;\n        } else {\n            a = parseInt(a, 10);\n        }\n        let b = tokens[2];\n        if (b === \"value\") {\n            b = this.value;\n        } else {\n            b = parseInt(b, 10);\n        }\n        const comp = tokens[1];\n        if (!(comp in comparisonOperatorsHash)) {\n            throw new Error(\"Invalid comparison\")\n        }\n        return comparisonOperatorsHash[comp](a, b);\n    }\n\n    firstUpdated() {\n        fetch(this.url).then(r => r.json()).then(r => r[this.key]).then(r => this.value = r);\n    }\n\n    render() {\n        if (this.value === undefined) {\n            return html`<slot></slot>`;\n        }\n        let selectedSlot = \"\";\n        this.querySelectorAll(\"[slot]\").forEach(slot => {\n            const comp = slot.getAttribute(\"slot\");\n            if (this.comparison(comp)) {\n                selectedSlot = comp;\n            }\n        });\n        this.querySelectorAll(\"[data-value]\").forEach(dv => {\n            dv.textContent = this.value;\n        });\n        return html`<slot name=${selectedSlot}></slot>`;\n    }\n}\n\ncustomElements.define('fetch-fill-slot', FetchFillSlot);\n","import { LitElement, html } from 'lit-element';\n\nconst LEVEL_ICON_MAP = {\n    \"error\": \"fas fa-exclamation-circle\",\n    \"warning\": \"fas fa-exclamation-triangle\",\n    \"success\": \"fas fa-check-circle\",\n    \"info\": \"fas fa-info\",\n};\n\nlet ID = function (prefix) {\n    return prefix + Math.random().toString(36).substr(2, 9);\n};\n\nexport function updateMessages() {\n    document.querySelector(\"pb-messages\").setAttribute(\"touch\", Date.now());\n}\n\nclass Messages extends LitElement {\n\n    static get properties() {\n        return {\n            url: { type: String },\n            messages: { type: Array },\n            touch: { type: Object },\n        };\n    }\n\n    set touch(value) {\n        this.firstUpdated();\n    }\n\n    createRenderRoot() {\n        return this;\n    }\n\n    firstUpdated() {\n        return fetch(this.url).then(r => r.json()).then(r => this.messages = r).then((r) => {\n            const container = this.querySelector(\".pf-c-alert-group\");\n            r.forEach(message => {\n                const messageElement = this.renderMessage(message);\n                container.appendChild(messageElement);\n            });\n        });\n    }\n\n    renderMessage(message) {\n        const id = ID(\"pb-message\");\n        const el = document.createElement(\"template\");\n        el.innerHTML = `<li id=${id} class=\"pf-c-alert-group__item\">\n            <div class=\"pf-c-alert pf-m-${message.level_tag} ${message.level_tag === 'error' ? 'pf-m-danger': ''}\">\n                <div class=\"pf-c-alert__icon\">\n                    <i class=\"${LEVEL_ICON_MAP[message.level_tag]}\"></i>\n                </div>\n                <p class=\"pf-c-alert__title\">\n                    ${message.message}\n                </p>\n            </div>\n        </li>`;\n        setTimeout(() => {\n            this.querySelector(`#${id}`).remove();\n        }, 1500);\n        return el.content.firstChild;\n    }\n\n    render() {\n        return html`<ul class=\"pf-c-alert-group pf-m-toast\"></ul>`;\n    }\n}\n\ncustomElements.define('pb-messages', Messages);\n","import { getCookie } from \"./utils.js\";\nimport { updateMessages } from \"./Messages.js\";\n\nconst PRIMARY_CLASS = \"pf-m-primary\";\nconst SUCCESS_CLASS = \"pf-m-success\";\nconst ERROR_CLASS = \"pf-m-danger\";\nconst PROGRESS_CLASSES = [\"pf-m-progress\", \"pf-m-in-progress\"];\n\nclass ActionButton extends HTMLButtonElement {\n\n    constructor() {\n        super();\n        this.addEventListener('click', e => this.callAction());\n    }\n\n    isRunning = false;\n    oldBody = \"\";\n\n    setLoading() {\n        this.classList.add(...PROGRESS_CLASSES);\n        this.oldBody = this.innerText;\n        this.innerHTML = `<span class=\"pf-c-button__progress\">\n            <span class=\"pf-c-spinner pf-m-md\" role=\"progressbar\" aria-valuetext=\"Loading...\">\n                <span class=\"pf-c-spinner__clipper\"></span>\n                <span class=\"pf-c-spinner__lead-ball\"></span>\n                <span class=\"pf-c-spinner__tail-ball\"></span>\n            </span>\n        </span>${this.oldBody}`;\n    }\n\n    setDone(statusClass) {\n        this.isRunning = false;\n        this.classList.remove(...PROGRESS_CLASSES);\n        this.innerText = this.oldBody;\n        this.classList.replace(PRIMARY_CLASS, statusClass);\n        // Trigger messages to update\n        updateMessages();\n        setTimeout(() => {\n            this.classList.replace(statusClass, PRIMARY_CLASS);\n        }, 1000);\n    }\n\n    callAction() {\n        if (this.isRunning === true) {\n            return;\n        }\n        this.setLoading();\n        const csrftoken = getCookie('passbook_csrf');\n        const request = new Request(\n            this.attributes[\"url\"].value,\n            { headers: { 'X-CSRFToken': csrftoken } }\n        );\n        fetch(request, {\n            method: \"POST\",\n            mode: 'same-origin',\n        }).then(r => r.json()).then(r => {\n            this.setDone(SUCCESS_CLASS);\n        }).catch(() => {\n            this.setDone(ERROR_CLASS);\n        });\n    }\n\n}\n\ncustomElements.define('action-button', ActionButton, { extends: 'button' });\n","export function getCookie(name) {\n    let cookieValue = null;\n    if (document.cookie && document.cookie !== '') {\n        const cookies = document.cookie.split(';');\n        for (let i = 0; i < cookies.length; i++) {\n            const cookie = cookies[i].trim();\n            // Does this cookie string begin with the name we want?\n            if (cookie.substring(0, name.length + 1) === (name + '=')) {\n                cookieValue = decodeURIComponent(cookie.substring(name.length + 1));\n                break;\n            }\n        }\n    }\n    return cookieValue;\n}\n","import { LitElement, html } from 'lit-element';\nimport { updateMessages } from \"./Messages.js\";\n\nclass FetchFillSlot extends LitElement {\n\n    static get properties() {\n        return {\n            flowBodyUrl: { type: String },\n            flowBody: { type: String },\n        };\n    }\n\n    createRenderRoot() {\n        return this;\n    }\n\n    firstUpdated() {\n        fetch(this.flowBodyUrl).then(r => r.json()).then(r => this.updateCard(r));\n    }\n\n    async updateCard(data) {\n        switch (data.type) {\n            case \"redirect\":\n                window.location = data.to\n                break;\n            case \"template\":\n                this.flowBody = data.body;\n                await this.requestUpdate();\n                this.checkAutofocus();\n                updateMessages();\n                this.loadFormCode();\n                this.setFormSubmitHandlers();\n            default:\n                break;\n        }\n    };\n\n    loadFormCode() {\n        this.querySelectorAll(\"script\").forEach(script => {\n            let newScript = document.createElement(\"script\");\n            newScript.src = script.src;\n            document.head.appendChild(newScript);\n        });\n    }\n\n    checkAutofocus() {\n        const autofocusElement = this.querySelector(\"[autofocus]\");\n        if (autofocusElement !== null) {\n            autofocusElement.focus();\n        }\n    }\n\n    updateFormAction(form) {\n        for (let index = 0; index < form.elements.length; index++) {\n            const element = form.elements[index];\n            if (element.value === form.action) {\n                console.log(\"pb-flow: Found Form action URL in form elements, not changing form action.\");\n                return false;\n            }\n        }\n        form.action = this.flowBodyUrl;\n        console.log(`pb-flow: updated form.action ${this.flowBodyUrl}`);\n        return true;\n    }\n\n    checkAutosubmit(form) {\n        if (\"autosubmit\" in form.attributes) {\n            return form.submit();\n        }\n    }\n\n    setFormSubmitHandlers() {\n        this.querySelectorAll(\"form\").forEach(form => {\n            console.log(`pb-flow: Checking for autosubmit attribute ${form}`);\n            this.checkAutosubmit(form);\n            console.log(`pb-flow: Setting action for form ${form}`);\n            this.updateFormAction(form);\n            console.log(`pb-flow: Adding handler for form ${form}`);\n            form.addEventListener('submit', (e) => {\n                e.preventDefault();\n                let formData = new FormData(form);\n                this.flowBody = undefined;\n                fetch(this.flowBodyUrl, {\n                    method: 'post',\n                    body: formData,\n                }).then(response => response.json()).then(data => {\n                    this.updateCard(data);\n                });\n            });\n            form.classList.add(\"pb-flow-wrapped\");\n        });\n    }\n\n    loading() {\n        return html`\n            <div class=\"pf-c-login__main-body pb-loading\">\n                <span class=\"pf-c-spinner\" role=\"progressbar\" aria-valuetext=\"Loading...\">\n                    <span class=\"pf-c-spinner__clipper\"></span>\n                    <span class=\"pf-c-spinner__lead-ball\"></span>\n                    <span class=\"pf-c-spinner__tail-ball\"></span>\n                </span>\n            </div>`;\n    }\n\n    render() {\n        if (this.flowBody !== undefined) {\n            return html([this.flowBody]);\n        }\n        return this.loading();\n    }\n}\n\ncustomElements.define('flow-shell-card', FetchFillSlot);\n","import './FetchFillSlot.js';\nimport './ActionButton.js';\nimport './Messages.js';\nimport './FlowShellCard.js';\n\n// Button Dropdowns\ndocument.querySelectorAll(\"button.pf-c-dropdown__toggle\").forEach((b) => {\n    b.addEventListener('click', (e) => {\n        const parent = e.target.closest('.pf-c-dropdown');\n        const menu = parent.querySelector('.pf-c-dropdown__menu');\n        menu.hidden = !menu.hidden;\n    });\n});\n\n// Search clearing\ndocument.querySelectorAll(\"input[type=search]\").forEach((si) => {\n    si.addEventListener(\"search\", (e) => {\n        if (si.value === \"\") {\n            si.parentElement.submit();\n        }\n    });\n});\n\n// Fetch from data-attributes\ndocument.querySelectorAll(\"[data-pb-fetch-fill]\").forEach((el) => {\n    const url = el.dataset.pbFetchFill;\n    const key = el.dataset.pbFetchKey;\n    fetch(url).then(r => r.json()).then(r => {\n        el.textContent = r[key];\n        el.value = r[key];\n    });\n});\n\n// Modal\ndocument.querySelectorAll(\"[data-target='modal']\").forEach((m) => {\n    m.addEventListener(\"click\", (e) => {\n        const parentContainer = e.target.closest('[data-target=\"modal\"]');\n        const modalId = parentContainer.attributes['data-modal'].value;\n        document.querySelector(`#${modalId}`).removeAttribute(\"hidden\");\n    });\n});\ndocument.querySelectorAll(\".pf-c-modal-box [data-modal-close]\").forEach((b) => {\n    b.addEventListener(\"click\", (e) => {\n        const parentContainer = e.target.closest('.pf-c-backdrop');\n        parentContainer.setAttribute(\"hidden\", true);\n    });\n});\n\n// Make Checkbox label click trigger checkbox toggle\ndocument.querySelectorAll(\".pf-c-check__label\").forEach((checkLabel) => {\n    checkLabel.addEventListener(\"click\", (e) => {\n        const checkbox = e.target.parentElement.querySelector(\"input[type=checkbox]\");\n        checkbox.checked = !checkbox.checked;\n    });\n});\n\n// CodeMirror\ndocument.querySelectorAll(\".codemirror\").forEach((cm) => {\n    let cmMode = 'xml';\n    if ('data-cm-mode' in cm.attributes) {\n        cmMode = cm.attributes['data-cm-mode'].value;\n    }\n    // https://github.com/codemirror/CodeMirror/issues/5092\n    cm.removeAttribute(\"required\");\n    CodeMirror.fromTextArea(cm, {\n        mode: cmMode,\n        theme: 'monokai',\n        lineNumbers: false,\n        readOnly: cm.readOnly,\n        autoRefresh: true,\n    });\n});\n\n// Automatic slug fields\nconst convertToSlug = (text) => {\n    return text\n        .toLowerCase()\n        .replace(/ /g, '-')\n        .replace(/[^\\w-]+/g, '');\n};\n\ndocument.querySelectorAll(\"input[name=name]\").forEach((input) => {\n    input.addEventListener(\"input\", (e) => {\n        const form = e.target.closest(\"form\");\n        if (form === null) {\n            return;\n        }\n        const slugField = form.querySelector(\"input[name=slug]\");\n        slugField.value = convertToSlug(e.target.value);\n    });\n});\n\n// Hamburger Menu\ndocument.querySelectorAll(\".pf-c-page__header-brand-toggle>button\").forEach((toggle) => {\n    toggle.addEventListener(\"click\", (e) => {\n        const sidebar = document.querySelector(\".pf-c-page__sidebar\");\n        if (sidebar.classList.contains(\"pf-m-expanded\")) {\n            // Sidebar already expanded\n            sidebar.classList.remove(\"pf-m-expanded\");\n            sidebar.style.zIndex = 0;\n        } else {\n            // Sidebar not expanded yet\n            sidebar.classList.add(\"pf-m-expanded\");\n            sidebar.style.zIndex = 200;\n        }\n    });\n});\n\n// Collapsable Menus in Sidebar\ndocument.querySelectorAll(\".pf-m-expandable>.pf-c-nav__link\").forEach((menu) => {\n    menu.addEventListener(\"click\", (e) => {\n        e.preventDefault();\n        menu.parentElement.classList.toggle(\"pf-m-expanded\");\n    });\n});\n"],"names":["isCEPolyfill","window","customElements","undefined","polyfillWrapFlushCallback","removeNodes","container","start","end","n","nextSibling","removeChild","marker","String","Math","random","slice","nodeMarker","markerRegex","RegExp","boundAttributeSuffix","Template","[object Object]","result","element","this","nodesToRemove","stack","walker","document","createTreeWalker","content","lastPartIndex","index","partIndex","strings","values","length","node","nextNode","nodeType","hasAttributes","attributes","count","i","endsWith","name","stringForPart","lastAttributeNameRegex","exec","attributeLookupName","toLowerCase","attributeValue","getAttribute","removeAttribute","statics","split","parts","push","type","tagName","currentNode","data","indexOf","parent","parentNode","lastIndex","insert","s","createMarker","match","createTextNode","insertBefore","previousSibling","pop","str","suffix","isTemplatePartActive","part","createComment","removeNodesFromTemplate","template","nextActiveIndexInTemplateParts","nodeIndex","removeCount","nodesToRemoveInTemplate","currentRemovingNode","has","forEach","countNodes","startIndex","directives","WeakMap","isDirective","o","noChange","nothing","TemplateInstance","processor","options","__parts","setValue","commit","fragment","cloneNode","importNode","nodeName","handleTextExpression","insertAfterNode","handleAttributeExpressions","adoptNode","upgrade","policy","trustedTypes","createPolicy","createHTML","commentMarker","TemplateResult","l","html","isCommentBinding","commentOpen","lastIndexOf","attributeMatch","substr","createElement","value","getHTML","innerHTML","isPrimitive","isIterable","Array","isArray","Symbol","iterator","AttributeCommitter","_createPart","AttributePart","v","text","t","dirty","setAttribute","_getValue","committer","directive","NodePart","startNode","appendChild","endNode","ref","__insert","__pendingValue","__commitText","__commitTemplateResult","Node","__commitNode","__commitIterable","clear","valueAsString","templateFactory","update","instance","_clone","itemParts","itemPart","item","appendIntoPart","insertAfterPart","BooleanAttributePart","Error","PropertyCommitter","super","single","PropertyPart","eventOptionsSupported","capture","addEventListener","removeEventListener","_e","EventPart","eventName","eventContext","__boundHandleEvent","e","handleEvent","newListener","oldListener","shouldRemoveListener","once","passive","shouldAddListener","__options","getOptions","event","call","templateCache","templateCaches","get","stringsArray","keyString","Map","set","key","join","getTemplateElement","defaultTemplateProcessor","prefix","getTemplateCacheKey","scopeName","compatibleShadyCSSVersion","ShadyCSS","prepareTemplateDom","console","warn","shadyTemplateFactory","cacheKey","TEMPLATE_TYPES","shadyRenderSet","Set","prepareTemplateStyles","renderedDOM","add","templateElement","styles","querySelectorAll","condensedStyle","style","textContent","templates","from","removeStylesFromLitTemplates","refNode","insertCount","walkerIndex","insertNodeIntoTemplate","firstChild","querySelector","nativeShadow","removes","JSCompiler_renameProperty","prop","_obj","defaultConverter","Boolean","Object","JSON","stringify","Number","parse","notEqual","old","defaultPropertyDeclaration","attribute","converter","reflect","hasChanged","finalized","UpdatingElement","HTMLElement","initialize","observedAttributes","finalize","_classProperties","p","attr","_attributeNameForProperty","_attributeToPropertyMap","hasOwnProperty","superProperties","getPrototypeOf","k","_ensureClassProperties","noAccessor","prototype","descriptor","getPropertyDescriptor","defineProperty","oldValue","requestUpdateInternal","configurable","enumerable","superCtor","props","properties","propKeys","getOwnPropertyNames","getOwnPropertySymbols","createProperty","fromAttribute","toAttribute","_updateState","_updatePromise","Promise","res","_enableUpdatingResolver","_changedProperties","_saveInstanceProperties","constructor","_v","_instanceProperties","enableUpdating","_attributeToProperty","ctor","attrValue","_propertyValueToAttribute","propName","getPropertyOptions","_propertyValueFromAttribute","shouldRequestUpdate","_valueHasChanged","_reflectingProperties","_hasRequestedUpdate","_enqueueUpdate","updateComplete","performUpdate","hasUpdated","_applyInstanceProperties","shouldUpdate","changedProperties","_markUpdated","firstUpdated","updated","_getUpdateComplete","size","_propertyToAttribute","supportsAdoptingStyleSheets","Document","CSSStyleSheet","constructionToken","CSSResult","cssText","safeToken","styleSheet","_styleSheet","replaceSync","renderNotImplemented","LitElement","userStyles","getStyles","addStyles","reduceRight","unshift","_styles","map","cssRules","reduce","css","rule","_getUniqueStyles","renderRoot","createRenderRoot","ShadowRoot","adoptStyles","attachShadow","mode","adoptedStyleSheets","_needsShimAdoptedStyleSheets","ScopingShim","prepareAdoptedCssText","localName","connectedCallback","styleElement","templateResult","render","hasRendered","needsScoping","host","firstScopeRender","renderContainer","createDocumentFragment","appendInto","litRender","delete","define","url","slotName","comparisonOperatorsHash","<","a","b",">",">=","<=","==","!=","===","!==","tokens","parseInt","comp","fetch","then","r","json","selectedSlot","slot","comparison","dv","LEVEL_ICON_MAP","error","warning","success","info","updateMessages","Date","now","messages","touch","message","messageElement","renderMessage","id","toString","el","level_tag","setTimeout","remove","PRIMARY_CLASS","PROGRESS_CLASSES","ActionButton","HTMLButtonElement","callAction","classList","oldBody","innerText","statusClass","isRunning","replace","setLoading","csrftoken","cookieValue","cookie","cookies","trim","substring","decodeURIComponent","getCookie","request","Request","headers","X-CSRFToken","method","setDone","catch","extends","flowBodyUrl","flowBody","updateCard","location","to","body","requestUpdate","checkAutofocus","loadFormCode","setFormSubmitHandlers","script","newScript","src","head","autofocusElement","focus","form","elements","action","log","submit","checkAutosubmit","updateFormAction","preventDefault","formData","FormData","response","loading","menu","target","closest","hidden","si","parentElement","dataset","pbFetchFill","pbFetchKey","m","modalId","checkLabel","checkbox","checked","cm","cmMode","CodeMirror","fromTextArea","theme","lineNumbers","readOnly","autoRefresh","input","toggle","sidebar","contains","zIndex"],"mappings":";;;;;;;;;;;;;OAqBO,MAAMA,EAAiC,oBAAXC,QACN,MAAzBA,O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,EAAQ3E,UAAUzM,IAAI,iBACtBoR,EAAQ/Q,MAAMiR,OAAS,WAMnCvd,SAASoM,iBAAiB,oCAAoCzI,SAASkY,IACnEA,EAAKzS,iBAAiB,SAAUO,IAC5BA,EAAE6R,iBACFK,EAAKK,cAAcxD,UAAU0E,OAAO"}
\ No newline at end of file
+{"version":3,"file":"passbook.js","sources":["../node_modules/lit-html/src/lib/dom.ts","../node_modules/lit-html/src/lib/template.ts","../node_modules/lit-html/src/lib/modify-template.ts","../node_modules/lit-html/src/lib/directive.ts","../node_modules/lit-html/src/lib/part.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/template-factory.ts","../node_modules/lit-html/src/lib/render.ts","../node_modules/lit-html/src/lib/default-template-processor.ts","../node_modules/lit-html/src/lit-html.ts","../node_modules/lit-html/src/lib/shady-render.ts","../node_modules/lit-element/src/lib/updating-element.ts","../node_modules/lit-element/src/lib/css-tag.ts","../node_modules/lit-element/src/lit-element.ts","../src/FetchFillSlot.js","../src/Messages.js","../src/ActionButton.js","../src/utils.js","../src/FlowShellCard.js","../src/passbook.js"],"sourcesContent":["/**\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\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) 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\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\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\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) 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 * 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\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\ndeclare const trustedTypes: typeof window.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n    trustedTypes!.createPolicy('lit-html', {createHTML: (s) => s});\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    let value = this.getHTML();\n    if (policy !== undefined) {\n      // this is secure because `this.strings` is a TemplateStringsArray.\n      // TODO: validate this when\n      // https://github.com/tc39/proposal-array-is-template-object is\n      // implemented.\n      value = policy.createHTML(value) as unknown as string;\n    }\n    template.innerHTML = value;\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\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    const parts = this.parts;\n\n    // If we're assigning an attribute via syntax like:\n    //    attr=\"${foo}\"  or  attr=${foo}\n    // but not\n    //    attr=\"${foo} ${bar}\" or attr=\"${foo} baz\"\n    // then we don't want to coerce the attribute value into one long\n    // string. Instead we want to just return the value itself directly,\n    // so that sanitizeDOMValue can get the actual value rather than\n    // String(value)\n    // The exception is if v is an array, in which case we do want to smash\n    // it together into a string without calling String() on the array.\n    //\n    // This also allows trusted values (when using TrustedTypes) being\n    // assigned to DOM sinks without being stringified in the process.\n    if (l === 1 && strings[0] === '' && strings[1] === '') {\n      const v = parts[0].value;\n      if (typeof v === 'symbol') {\n        return String(v);\n      }\n      if (typeof v === 'string' || !isIterable(v)) {\n        return v;\n      }\n    }\n    let text = '';\n\n    for (let i = 0; i < l; i++) {\n      text += strings[i];\n      const part = 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\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\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\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 *\n * Main lit-html module.\n *\n * Main exports:\n *\n * -  [[html]]\n * -  [[svg]]\n * -  [[render]]\n *\n * @packageDocumentation\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.3.0');\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 to add shady DOM/shady CSS polyfill support to lit-html template\n * rendering. See the [[render]] method for details.\n *\n * @packageDocumentation\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 */\nexport const 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","/**\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 * Use this module if you want to create your own base class extending\n * [[UpdatingElement]].\n * @packageDocumentation\n */\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\nwindow.JSCompiler_renameProperty =\n    <P extends PropertyKey>(prop: P, _obj: unknown): P => prop;\n\ndeclare global {\n  var JSCompiler_renameProperty: <P extends PropertyKey>(\n      prop: P, _obj: unknown) => P;\n\n  interface Window {\n    JSCompiler_renameProperty: typeof JSCompiler_renameProperty;\n  }\n}\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n  /**\n   * Function called to convert an attribute value to a property\n   * value.\n   */\n  fromAttribute?(value: string|null, type?: TypeHint): Type;\n\n  /**\n   * Function called to convert a property value to an attribute\n   * value.\n   *\n   * It returns unknown instead of string, to be compatible with\n   * https://github.com/WICG/trusted-types (and similar efforts).\n   */\n  toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n    ComplexAttributeConverter<Type>|\n    ((value: string|null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n  /**\n   * Indicates how and whether the property becomes an observed attribute.\n   * If the value is `false`, the property is not added to `observedAttributes`.\n   * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n   * becomes `foobar`). If a string, the string value is observed (e.g\n   * `attribute: 'foo-bar'`).\n   */\n  readonly attribute?: boolean|string;\n\n  /**\n   * Indicates the type of the property. This is used only as a hint for the\n   * `converter` to determine how to convert the attribute\n   * to/from a property.\n   */\n  readonly type?: TypeHint;\n\n  /**\n   * Indicates how to convert the attribute to/from a property. If this value\n   * is a function, it is used to convert the attribute value a the property\n   * value. If it's an object, it can have keys for `fromAttribute` and\n   * `toAttribute`. If no `toAttribute` function is provided and\n   * `reflect` is set to `true`, the property value is set directly to the\n   * attribute. A default `converter` is used if none is provided; it supports\n   * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n   * when a property changes and the converter is used to update the attribute,\n   * the property is never updated again as a result of the attribute changing,\n   * and vice versa.\n   */\n  readonly converter?: AttributeConverter<Type, TypeHint>;\n\n  /**\n   * Indicates if the property should reflect to an attribute.\n   * If `true`, when the property is set, the attribute is set using the\n   * attribute name determined according to the rules for the `attribute`\n   * property option and the value of the property converted using the rules\n   * from the `converter` property option.\n   */\n  readonly reflect?: boolean;\n\n  /**\n   * A function that indicates if a property should be considered changed when\n   * it is set. The function should take the `newValue` and `oldValue` and\n   * return `true` if an update should be requested.\n   */\n  hasChanged?(value: Type, oldValue: Type): boolean;\n\n  /**\n   * Indicates whether an accessor will be created for this property. By\n   * default, an accessor will be generated for this property that requests an\n   * update when set. If this flag is `true`, no accessor will be created, and\n   * it will be the user's responsibility to call\n   * `this.requestUpdate(propertyName, oldValue)` to request an update when\n   * the property changes.\n   */\n  readonly noAccessor?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n  readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\n/**\n * Map of changed properties with old values. Takes an optional generic\n * interface corresponding to the declared element properties.\n */\n// tslint:disable-next-line:no-any\nexport type PropertyValues<T = any> =\n    keyof T extends PropertyKey ? Map<keyof T, unknown>: never;\n\nexport const defaultConverter: ComplexAttributeConverter = {\n\n  toAttribute(value: unknown, type?: unknown): unknown {\n    switch (type) {\n      case Boolean:\n        return value ? '' : null;\n      case Object:\n      case Array:\n        // if the value is `null` or `undefined` pass this through\n        // to allow removing/no change behavior.\n        return value == null ? value : JSON.stringify(value);\n    }\n    return value;\n  },\n\n  fromAttribute(value: string|null, type?: unknown) {\n    switch (type) {\n      case Boolean:\n        return value !== null;\n      case Number:\n        return value === null ? null : Number(value);\n      case Object:\n      case Array:\n        return JSON.parse(value!);\n    }\n    return value;\n  }\n\n};\n\nexport interface HasChanged {\n  (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean => {\n  // This ensures (old==NaN, value==NaN) always returns false\n  return old !== value && (old === old || value === value);\n};\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n  attribute: true,\n  type: String,\n  converter: defaultConverter,\n  reflect: false,\n  hasChanged: notEqual\n};\n\nconst STATE_HAS_UPDATED = 1;\nconst STATE_UPDATE_REQUESTED = 1 << 2;\nconst STATE_IS_REFLECTING_TO_ATTRIBUTE = 1 << 3;\nconst STATE_IS_REFLECTING_TO_PROPERTY = 1 << 4;\ntype UpdateState = typeof STATE_HAS_UPDATED|typeof STATE_UPDATE_REQUESTED|\n    typeof STATE_IS_REFLECTING_TO_ATTRIBUTE|\n    typeof STATE_IS_REFLECTING_TO_PROPERTY;\n\n/**\n * The Closure JS Compiler doesn't currently have good support for static\n * property semantics where \"this\" is dynamic (e.g.\n * https://github.com/google/closure-compiler/issues/3177 and others) so we use\n * this hack to bypass any rewriting by the compiler.\n */\nconst finalized = 'finalized';\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclassers to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class UpdatingElement extends HTMLElement {\n  /*\n   * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n   * all static methods and properties with initializers.  Reference:\n   * - https://github.com/google/closure-compiler/issues/1776\n   */\n\n  /**\n   * Maps attribute names to properties; for example `foobar` attribute to\n   * `fooBar` property. Created lazily on user subclasses when finalizing the\n   * class.\n   */\n  private static _attributeToPropertyMap: AttributeMap;\n\n  /**\n   * Marks class as having finished creating properties.\n   */\n  protected static[finalized] = true;\n\n  /**\n   * Memoized list of all class properties, including any superclass properties.\n   * Created lazily on user subclasses when finalizing the class.\n   */\n  private static _classProperties?: PropertyDeclarationMap;\n\n  /**\n   * User-supplied object that maps property names to `PropertyDeclaration`\n   * objects containing options for configuring the property.\n   */\n  static properties: PropertyDeclarations;\n\n  /**\n   * Returns a list of attributes corresponding to the registered properties.\n   * @nocollapse\n   */\n  static get observedAttributes() {\n    // note: piggy backing on this to ensure we're finalized.\n    this.finalize();\n    const attributes: string[] = [];\n    // Use forEach so this works even if for/of loops are compiled to for loops\n    // expecting arrays\n    this._classProperties!.forEach((v, p) => {\n      const attr = this._attributeNameForProperty(p, v);\n      if (attr !== undefined) {\n        this._attributeToPropertyMap.set(attr, p);\n        attributes.push(attr);\n      }\n    });\n    return attributes;\n  }\n\n  /**\n   * Ensures the private `_classProperties` property metadata is created.\n   * In addition to `finalize` this is also called in `createProperty` to\n   * ensure the `@property` decorator can add property metadata.\n   */\n  /** @nocollapse */\n  private static _ensureClassProperties() {\n    // ensure private storage for property declarations.\n    if (!this.hasOwnProperty(\n            JSCompiler_renameProperty('_classProperties', this))) {\n      this._classProperties = new Map();\n      // NOTE: Workaround IE11 not supporting Map constructor argument.\n      const superProperties: PropertyDeclarationMap =\n          Object.getPrototypeOf(this)._classProperties;\n      if (superProperties !== undefined) {\n        superProperties.forEach(\n            (v: PropertyDeclaration, k: PropertyKey) =>\n                this._classProperties!.set(k, v));\n      }\n    }\n  }\n\n  /**\n   * Creates a property accessor on the element prototype if one does not exist\n   * and stores a PropertyDeclaration for the property with the given options.\n   * The property setter calls the property's `hasChanged` property option\n   * or uses a strict identity check to determine whether or not to request\n   * an update.\n   *\n   * This method may be overridden to customize properties; however,\n   * when doing so, it's important to call `super.createProperty` to ensure\n   * the property is setup correctly. This method calls\n   * `getPropertyDescriptor` internally to get a descriptor to install.\n   * To customize what properties do when they are get or set, override\n   * `getPropertyDescriptor`. To customize the options for a property,\n   * implement `createProperty` like this:\n   *\n   * static createProperty(name, options) {\n   *   options = Object.assign(options, {myOption: true});\n   *   super.createProperty(name, options);\n   * }\n   *\n   * @nocollapse\n   */\n  static createProperty(\n      name: PropertyKey,\n      options: PropertyDeclaration = defaultPropertyDeclaration) {\n    // Note, since this can be called by the `@property` decorator which\n    // is called before `finalize`, we ensure storage exists for property\n    // metadata.\n    this._ensureClassProperties();\n    this._classProperties!.set(name, options);\n    // Do not generate an accessor if the prototype already has one, since\n    // it would be lost otherwise and that would never be the user's intention;\n    // Instead, we expect users to call `requestUpdate` themselves from\n    // user-defined accessors. Note that if the super has an accessor we will\n    // still overwrite it\n    if (options.noAccessor || this.prototype.hasOwnProperty(name)) {\n      return;\n    }\n    const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n    const descriptor = this.getPropertyDescriptor(name, key, options);\n    if (descriptor !== undefined) {\n      Object.defineProperty(this.prototype, name, descriptor);\n    }\n  }\n\n  /**\n   * Returns a property descriptor to be defined on the given named property.\n   * If no descriptor is returned, the property will not become an accessor.\n   * For example,\n   *\n   *   class MyElement extends LitElement {\n   *     static getPropertyDescriptor(name, key, options) {\n   *       const defaultDescriptor =\n   *           super.getPropertyDescriptor(name, key, options);\n   *       const setter = defaultDescriptor.set;\n   *       return {\n   *         get: defaultDescriptor.get,\n   *         set(value) {\n   *           setter.call(this, value);\n   *           // custom action.\n   *         },\n   *         configurable: true,\n   *         enumerable: true\n   *       }\n   *     }\n   *   }\n   *\n   * @nocollapse\n   */\n  protected static getPropertyDescriptor(\n      name: PropertyKey, key: string|symbol, options: PropertyDeclaration) {\n    return {\n      // tslint:disable-next-line:no-any no symbol in index\n      get(): any {\n        return (this as {[key: string]: unknown})[key as string];\n      },\n      set(this: UpdatingElement, value: unknown) {\n        const oldValue =\n            (this as {} as {[key: string]: unknown})[name as string];\n        (this as {} as {[key: string]: unknown})[key as string] = value;\n        (this as unknown as UpdatingElement)\n            .requestUpdateInternal(name, oldValue, options);\n      },\n      configurable: true,\n      enumerable: true\n    };\n  }\n\n  /**\n   * Returns the property options associated with the given property.\n   * These options are defined with a PropertyDeclaration via the `properties`\n   * object or the `@property` decorator and are registered in\n   * `createProperty(...)`.\n   *\n   * Note, this method should be considered \"final\" and not overridden. To\n   * customize the options for a given property, override `createProperty`.\n   *\n   * @nocollapse\n   * @final\n   */\n  protected static getPropertyOptions(name: PropertyKey) {\n    return this._classProperties && this._classProperties.get(name) ||\n        defaultPropertyDeclaration;\n  }\n\n  /**\n   * Creates property accessors for registered properties and ensures\n   * any superclasses are also finalized.\n   * @nocollapse\n   */\n  protected static finalize() {\n    // finalize any superclasses\n    const superCtor = Object.getPrototypeOf(this);\n    if (!superCtor.hasOwnProperty(finalized)) {\n      superCtor.finalize();\n    }\n    this[finalized] = true;\n    this._ensureClassProperties();\n    // initialize Map populated in observedAttributes\n    this._attributeToPropertyMap = new Map();\n    // make any properties\n    // Note, only process \"own\" properties since this element will inherit\n    // any properties defined on the superClass, and finalization ensures\n    // the entire prototype chain is finalized.\n    if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n      const props = this.properties;\n      // support symbols in properties (IE11 does not support this)\n      const propKeys = [\n        ...Object.getOwnPropertyNames(props),\n        ...(typeof Object.getOwnPropertySymbols === 'function') ?\n            Object.getOwnPropertySymbols(props) :\n            []\n      ];\n      // This for/of is ok because propKeys is an array\n      for (const p of propKeys) {\n        // note, use of `any` is due to TypeSript lack of support for symbol in\n        // index types\n        // tslint:disable-next-line:no-any no symbol in index\n        this.createProperty(p, (props as any)[p]);\n      }\n    }\n  }\n\n  /**\n   * Returns the property name for the given attribute `name`.\n   * @nocollapse\n   */\n  private static _attributeNameForProperty(\n      name: PropertyKey, options: PropertyDeclaration) {\n    const attribute = options.attribute;\n    return attribute === false ?\n        undefined :\n        (typeof attribute === 'string' ?\n             attribute :\n             (typeof name === 'string' ? name.toLowerCase() : undefined));\n  }\n\n  /**\n   * Returns true if a property should request an update.\n   * Called when a property value is set and uses the `hasChanged`\n   * option for the property if present or a strict identity check.\n   * @nocollapse\n   */\n  private static _valueHasChanged(\n      value: unknown, old: unknown, hasChanged: HasChanged = notEqual) {\n    return hasChanged(value, old);\n  }\n\n  /**\n   * Returns the property value for the given attribute value.\n   * Called via the `attributeChangedCallback` and uses the property's\n   * `converter` or `converter.fromAttribute` property option.\n   * @nocollapse\n   */\n  private static _propertyValueFromAttribute(\n      value: string|null, options: PropertyDeclaration) {\n    const type = options.type;\n    const converter = options.converter || defaultConverter;\n    const fromAttribute =\n        (typeof converter === 'function' ? converter : converter.fromAttribute);\n    return fromAttribute ? fromAttribute(value, type) : value;\n  }\n\n  /**\n   * Returns the attribute value for the given property value. If this\n   * returns undefined, the property will *not* be reflected to an attribute.\n   * If this returns null, the attribute will be removed, otherwise the\n   * attribute will be set to the value.\n   * This uses the property's `reflect` and `type.toAttribute` property options.\n   * @nocollapse\n   */\n  private static _propertyValueToAttribute(\n      value: unknown, options: PropertyDeclaration) {\n    if (options.reflect === undefined) {\n      return;\n    }\n    const type = options.type;\n    const converter = options.converter;\n    const toAttribute =\n        converter && (converter as ComplexAttributeConverter).toAttribute ||\n        defaultConverter.toAttribute;\n    return toAttribute!(value, type);\n  }\n\n  private _updateState!: UpdateState;\n  private _instanceProperties?: PropertyValues;\n  // Initialize to an unresolved Promise so we can make sure the element has\n  // connected before first update.\n  private _updatePromise!: Promise<unknown>;\n  private _enableUpdatingResolver: (() => void)|undefined;\n\n  /**\n   * Map with keys for any properties that have changed since the last\n   * update cycle with previous values.\n   */\n  private _changedProperties!: PropertyValues;\n\n  /**\n   * Map with keys of properties that should be reflected when updated.\n   */\n  private _reflectingProperties?: Map<PropertyKey, PropertyDeclaration>;\n\n  constructor() {\n    super();\n    this.initialize();\n  }\n\n  /**\n   * Performs element initialization. By default captures any pre-set values for\n   * registered properties.\n   */\n  protected initialize() {\n    this._updateState = 0;\n    this._updatePromise =\n        new Promise((res) => this._enableUpdatingResolver = res);\n    this._changedProperties = new Map();\n    this._saveInstanceProperties();\n    // ensures first update will be caught by an early access of\n    // `updateComplete`\n    this.requestUpdateInternal();\n  }\n\n  /**\n   * Fixes any properties set on the instance before upgrade time.\n   * Otherwise these would shadow the accessor and break these properties.\n   * The properties are stored in a Map which is played back after the\n   * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n   * (<=41), properties created for native platform properties like (`id` or\n   * `name`) may not have default values set in the element constructor. On\n   * these browsers native properties appear on instances and therefore their\n   * default value will overwrite any element default (e.g. if the element sets\n   * this.id = 'id' in the constructor, the 'id' will become '' since this is\n   * the native platform default).\n   */\n  private _saveInstanceProperties() {\n    // Use forEach so this works even if for/of loops are compiled to for loops\n    // expecting arrays\n    (this.constructor as typeof UpdatingElement)\n        ._classProperties!.forEach((_v, p) => {\n          if (this.hasOwnProperty(p)) {\n            const value = this[p as keyof this];\n            delete this[p as keyof this];\n            if (!this._instanceProperties) {\n              this._instanceProperties = new Map();\n            }\n            this._instanceProperties.set(p, value);\n          }\n        });\n  }\n\n  /**\n   * Applies previously saved instance properties.\n   */\n  private _applyInstanceProperties() {\n    // Use forEach so this works even if for/of loops are compiled to for loops\n    // expecting arrays\n    // tslint:disable-next-line:no-any\n    this._instanceProperties!.forEach((v, p) => (this as any)[p] = v);\n    this._instanceProperties = undefined;\n  }\n\n  connectedCallback() {\n    // Ensure first connection completes an update. Updates cannot complete\n    // before connection.\n    this.enableUpdating();\n  }\n\n  protected enableUpdating() {\n    if (this._enableUpdatingResolver !== undefined) {\n      this._enableUpdatingResolver();\n      this._enableUpdatingResolver = undefined;\n    }\n  }\n\n  /**\n   * Allows for `super.disconnectedCallback()` in extensions while\n   * reserving the possibility of making non-breaking feature additions\n   * when disconnecting at some point in the future.\n   */\n  disconnectedCallback() {\n  }\n\n  /**\n   * Synchronizes property values when attributes change.\n   */\n  attributeChangedCallback(name: string, old: string|null, value: string|null) {\n    if (old !== value) {\n      this._attributeToProperty(name, value);\n    }\n  }\n\n  private _propertyToAttribute(\n      name: PropertyKey, value: unknown,\n      options: PropertyDeclaration = defaultPropertyDeclaration) {\n    const ctor = (this.constructor as typeof UpdatingElement);\n    const attr = ctor._attributeNameForProperty(name, options);\n    if (attr !== undefined) {\n      const attrValue = ctor._propertyValueToAttribute(value, options);\n      // an undefined value does not change the attribute.\n      if (attrValue === undefined) {\n        return;\n      }\n      // Track if the property is being reflected to avoid\n      // setting the property again via `attributeChangedCallback`. Note:\n      // 1. this takes advantage of the fact that the callback is synchronous.\n      // 2. will behave incorrectly if multiple attributes are in the reaction\n      // stack at time of calling. However, since we process attributes\n      // in `update` this should not be possible (or an extreme corner case\n      // that we'd like to discover).\n      // mark state reflecting\n      this._updateState = this._updateState | STATE_IS_REFLECTING_TO_ATTRIBUTE;\n      if (attrValue == null) {\n        this.removeAttribute(attr);\n      } else {\n        this.setAttribute(attr, attrValue as string);\n      }\n      // mark state not reflecting\n      this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_ATTRIBUTE;\n    }\n  }\n\n  private _attributeToProperty(name: string, value: string|null) {\n    // Use tracking info to avoid deserializing attribute value if it was\n    // just set from a property setter.\n    if (this._updateState & STATE_IS_REFLECTING_TO_ATTRIBUTE) {\n      return;\n    }\n    const ctor = (this.constructor as typeof UpdatingElement);\n    // Note, hint this as an `AttributeMap` so closure clearly understands\n    // the type; it has issues with tracking types through statics\n    // tslint:disable-next-line:no-unnecessary-type-assertion\n    const propName = (ctor._attributeToPropertyMap as AttributeMap).get(name);\n    if (propName !== undefined) {\n      const options = ctor.getPropertyOptions(propName);\n      // mark state reflecting\n      this._updateState = this._updateState | STATE_IS_REFLECTING_TO_PROPERTY;\n      this[propName as keyof this] =\n          // tslint:disable-next-line:no-any\n          ctor._propertyValueFromAttribute(value, options) as any;\n      // mark state not reflecting\n      this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_PROPERTY;\n    }\n  }\n\n  /**\n   * This protected version of `requestUpdate` does not access or return the\n   * `updateComplete` promise. This promise can be overridden and is therefore\n   * not free to access.\n   */\n  protected requestUpdateInternal(\n      name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration) {\n    let shouldRequestUpdate = true;\n    // If we have a property key, perform property update steps.\n    if (name !== undefined) {\n      const ctor = this.constructor as typeof UpdatingElement;\n      options = options || ctor.getPropertyOptions(name);\n      if (ctor._valueHasChanged(\n              this[name as keyof this], oldValue, options.hasChanged)) {\n        if (!this._changedProperties.has(name)) {\n          this._changedProperties.set(name, oldValue);\n        }\n        // Add to reflecting properties set.\n        // Note, it's important that every change has a chance to add the\n        // property to `_reflectingProperties`. This ensures setting\n        // attribute + property reflects correctly.\n        if (options.reflect === true &&\n            !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) {\n          if (this._reflectingProperties === undefined) {\n            this._reflectingProperties = new Map();\n          }\n          this._reflectingProperties.set(name, options);\n        }\n      } else {\n        // Abort the request if the property should not be considered changed.\n        shouldRequestUpdate = false;\n      }\n    }\n    if (!this._hasRequestedUpdate && shouldRequestUpdate) {\n      this._updatePromise = this._enqueueUpdate();\n    }\n  }\n\n  /**\n   * Requests an update which is processed asynchronously. This should\n   * be called when an element should update based on some state not triggered\n   * by setting a property. In this case, pass no arguments. It should also be\n   * called when manually implementing a property setter. In this case, pass the\n   * property `name` and `oldValue` to ensure that any configured property\n   * options are honored. Returns the `updateComplete` Promise which is resolved\n   * when the update completes.\n   *\n   * @param name {PropertyKey} (optional) name of requesting property\n   * @param oldValue {any} (optional) old value of requesting property\n   * @returns {Promise} A Promise that is resolved when the update completes.\n   */\n  requestUpdate(name?: PropertyKey, oldValue?: unknown) {\n    this.requestUpdateInternal(name, oldValue);\n    return this.updateComplete;\n  }\n\n  /**\n   * Sets up the element to asynchronously update.\n   */\n  private async _enqueueUpdate() {\n    this._updateState = this._updateState | STATE_UPDATE_REQUESTED;\n    try {\n      // Ensure any previous update has resolved before updating.\n      // This `await` also ensures that property changes are batched.\n      await this._updatePromise;\n    } catch (e) {\n      // Ignore any previous errors. We only care that the previous cycle is\n      // done. Any error should have been handled in the previous update.\n    }\n    const result = this.performUpdate();\n    // If `performUpdate` returns a Promise, we await it. This is done to\n    // enable coordinating updates with a scheduler. Note, the result is\n    // checked to avoid delaying an additional microtask unless we need to.\n    if (result != null) {\n      await result;\n    }\n    return !this._hasRequestedUpdate;\n  }\n\n  private get _hasRequestedUpdate() {\n    return (this._updateState & STATE_UPDATE_REQUESTED);\n  }\n\n  protected get hasUpdated() {\n    return (this._updateState & STATE_HAS_UPDATED);\n  }\n\n  /**\n   * Performs an element update. Note, if an exception is thrown during the\n   * update, `firstUpdated` and `updated` will not be called.\n   *\n   * You can override this method to change the timing of updates. If this\n   * method is overridden, `super.performUpdate()` must be called.\n   *\n   * For instance, to schedule updates to occur just before the next frame:\n   *\n   * ```\n   * protected async performUpdate(): Promise<unknown> {\n   *   await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n   *   super.performUpdate();\n   * }\n   * ```\n   */\n  protected performUpdate(): void|Promise<unknown> {\n    // Abort any update if one is not pending when this is called.\n    // This can happen if `performUpdate` is called early to \"flush\"\n    // the update.\n    if (!this._hasRequestedUpdate) {\n      return;\n    }\n    // Mixin instance properties once, if they exist.\n    if (this._instanceProperties) {\n      this._applyInstanceProperties();\n    }\n    let shouldUpdate = false;\n    const changedProperties = this._changedProperties;\n    try {\n      shouldUpdate = this.shouldUpdate(changedProperties);\n      if (shouldUpdate) {\n        this.update(changedProperties);\n      } else {\n        this._markUpdated();\n      }\n    } catch (e) {\n      // Prevent `firstUpdated` and `updated` from running when there's an\n      // update exception.\n      shouldUpdate = false;\n      // Ensure element can accept additional updates after an exception.\n      this._markUpdated();\n      throw e;\n    }\n    if (shouldUpdate) {\n      if (!(this._updateState & STATE_HAS_UPDATED)) {\n        this._updateState = this._updateState | STATE_HAS_UPDATED;\n        this.firstUpdated(changedProperties);\n      }\n      this.updated(changedProperties);\n    }\n  }\n\n  private _markUpdated() {\n    this._changedProperties = new Map();\n    this._updateState = this._updateState & ~STATE_UPDATE_REQUESTED;\n  }\n\n  /**\n   * Returns a Promise that resolves when the element has completed updating.\n   * The Promise value is a boolean that is `true` if the element completed the\n   * update without triggering another update. The Promise result is `false` if\n   * a property was set inside `updated()`. If the Promise is rejected, an\n   * exception was thrown during the update.\n   *\n   * To await additional asynchronous work, override the `_getUpdateComplete`\n   * method. For example, it is sometimes useful to await a rendered element\n   * before fulfilling this Promise. To do this, first await\n   * `super._getUpdateComplete()`, then any subsequent state.\n   *\n   * @returns {Promise} The Promise returns a boolean that indicates if the\n   * update resolved without triggering another update.\n   */\n  get updateComplete() {\n    return this._getUpdateComplete();\n  }\n\n  /**\n   * Override point for the `updateComplete` promise.\n   *\n   * It is not safe to override the `updateComplete` getter directly due to a\n   * limitation in TypeScript which means it is not possible to call a\n   * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n   * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n   * This method should be overridden instead. For example:\n   *\n   *   class MyElement extends LitElement {\n   *     async _getUpdateComplete() {\n   *       await super._getUpdateComplete();\n   *       await this._myChild.updateComplete;\n   *     }\n   *   }\n   */\n  protected _getUpdateComplete() {\n    return this._updatePromise;\n  }\n\n  /**\n   * Controls whether or not `update` should be called when the element requests\n   * an update. By default, this method always returns `true`, but this can be\n   * customized to control when to update.\n   *\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n    return true;\n  }\n\n  /**\n   * Updates the element. This method reflects property values to attributes.\n   * It can be overridden to render and keep updated element DOM.\n   * Setting properties inside this method will *not* trigger\n   * another update.\n   *\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected update(_changedProperties: PropertyValues) {\n    if (this._reflectingProperties !== undefined &&\n        this._reflectingProperties.size > 0) {\n      // Use forEach so this works even if for/of loops are compiled to for\n      // loops expecting arrays\n      this._reflectingProperties.forEach(\n          (v, k) => this._propertyToAttribute(k, this[k as keyof this], v));\n      this._reflectingProperties = undefined;\n    }\n    this._markUpdated();\n  }\n\n  /**\n   * Invoked whenever the element is updated. Implement to perform\n   * post-updating tasks via DOM APIs, for example, focusing an element.\n   *\n   * Setting properties inside this method will trigger the element to update\n   * again after this update cycle completes.\n   *\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected updated(_changedProperties: PropertyValues) {\n  }\n\n  /**\n   * Invoked when the element is first updated. Implement to perform one time\n   * work on the element after update.\n   *\n   * Setting properties inside this method will trigger the element to update\n   * again after this update cycle completes.\n   *\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected firstUpdated(_changedProperties: PropertyValues) {\n  }\n}\n","/**\n@license\nCopyright (c) 2019 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at\nhttp://polymer.github.io/LICENSE.txt The complete set of authors may be found at\nhttp://polymer.github.io/AUTHORS.txt The complete set of contributors may be\nfound at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as\npart of the polymer project is also subject to an additional IP rights grant\nfound at http://polymer.github.io/PATENTS.txt\n*/\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets = (window.ShadowRoot) &&\n    (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) &&\n    ('adoptedStyleSheets' in Document.prototype) &&\n    ('replace' in CSSStyleSheet.prototype);\n\nconst constructionToken = Symbol();\n\nexport class CSSResult {\n  _styleSheet?: CSSStyleSheet|null;\n\n  readonly cssText: string;\n\n  constructor(cssText: string, safeToken: symbol) {\n    if (safeToken !== constructionToken) {\n      throw new Error(\n          'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');\n    }\n\n    this.cssText = cssText;\n  }\n\n  // Note, this is a getter so that it's lazy. In practice, this means\n  // stylesheets are not created until the first element instance is made.\n  get styleSheet(): CSSStyleSheet|null {\n    if (this._styleSheet === undefined) {\n      // Note, if `supportsAdoptingStyleSheets` is true then we assume\n      // CSSStyleSheet is constructable.\n      if (supportsAdoptingStyleSheets) {\n        this._styleSheet = new CSSStyleSheet();\n        this._styleSheet.replaceSync(this.cssText);\n      } else {\n        this._styleSheet = null;\n      }\n    }\n    return this._styleSheet;\n  }\n\n  toString(): string {\n    return this.cssText;\n  }\n}\n\n/**\n * Wrap a value for interpolation in a [[`css`]] tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) => {\n  return new CSSResult(String(value), constructionToken);\n};\n\nconst textFromCSSResult = (value: CSSResult|number) => {\n  if (value instanceof CSSResult) {\n    return value.cssText;\n  } else if (typeof value === 'number') {\n    return value;\n  } else {\n    throw new Error(\n        `Value passed to 'css' function must be a 'css' function result: ${\n            value}. Use 'unsafeCSS' to pass non-literal values, but\n            take care to ensure page security.`);\n  }\n};\n\n/**\n * Template tag which which can be used with LitElement's [[LitElement.styles |\n * `styles`]] property to set element styles. For security reasons, only literal\n * string values may be used. To incorporate non-literal values [[`unsafeCSS`]]\n * may be used inside a template string part.\n */\nexport const css =\n    (strings: TemplateStringsArray, ...values: (CSSResult|number)[]) => {\n      const cssText = values.reduce(\n          (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n          strings[0]);\n      return new CSSResult(cssText, constructionToken);\n    };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The main LitElement module, which defines the [[`LitElement`]] base class and\n * related APIs.\n *\n *  LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n *  Import [[`LitElement`]] and [[`html`]] from this module to create a\n * component:\n *\n *  ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n *   // Declare observed properties\n *   static get properties() {\n *     return {\n *       adjective: {}\n *     }\n *   }\n *\n *   constructor() {\n *     this.adjective = 'awesome';\n *   }\n *\n *   // Define the element's template\n *   render() {\n *     return html`<p>your ${adjective} template here</p>`;\n *   }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends [[`UpdatingElement`]] and adds lit-html templating.\n * The `UpdatingElement` class is provided for users that want to build\n * their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\nimport {render, ShadyRenderOptions} from 'lit-html/lib/shady-render.js';\n\nimport {PropertyValues, UpdatingElement} from './lib/updating-element.js';\n\nexport * from './lib/updating-element.js';\nexport * from './lib/decorators.js';\nexport {html, svg, TemplateResult, SVGTemplateResult} from 'lit-html/lit-html.js';\nimport {supportsAdoptingStyleSheets, CSSResult, unsafeCSS} from './lib/css-tag.js';\nexport * from './lib/css-tag.js';\n\ndeclare global {\n  interface Window {\n    litElementVersions: string[];\n  }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n// TODO(justinfagnani): inject version number at build time\n(window['litElementVersions'] || (window['litElementVersions'] = []))\n    .push('2.4.0');\n\nexport type CSSResultOrNative = CSSResult|CSSStyleSheet;\n\nexport interface CSSResultArray extends\n    Array<CSSResultOrNative|CSSResultArray> {}\n\n/**\n * Sentinal value used to avoid calling lit-html's render function when\n * subclasses do not implement `render`\n */\nconst renderNotImplemented = {};\n\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the [[`properties`]] property or the [[`property`]] decorator.\n */\nexport class LitElement extends UpdatingElement {\n  /**\n   * Ensure this class is marked as `finalized` as an optimization ensuring\n   * it will not needlessly try to `finalize`.\n   *\n   * Note this property name is a string to prevent breaking Closure JS Compiler\n   * optimizations. See updating-element.ts for more information.\n   */\n  protected static['finalized'] = true;\n\n  /**\n   * Reference to the underlying library method used to render the element's\n   * DOM. By default, points to the `render` method from lit-html's shady-render\n   * module.\n   *\n   * **Most users will never need to touch this property.**\n   *\n   * This  property should not be confused with the `render` instance method,\n   * which should be overridden to define a template for the element.\n   *\n   * Advanced users creating a new base class based on LitElement can override\n   * this property to point to a custom render method with a signature that\n   * matches [shady-render's `render`\n   * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render).\n   *\n   * @nocollapse\n   */\n  static render:\n      (result: unknown, container: Element|DocumentFragment,\n       options: ShadyRenderOptions) => void = render;\n\n  /**\n   * Array of styles to apply to the element. The styles should be defined\n   * using the [[`css`]] tag function or via constructible stylesheets.\n   */\n  static styles?: CSSResultOrNative|CSSResultArray;\n\n  private static _styles: Array<CSSResultOrNative|CSSResult>|undefined;\n\n  /**\n   * Return the array of styles to apply to the element.\n   * Override this method to integrate into a style management system.\n   *\n   * @nocollapse\n   */\n  static getStyles(): CSSResultOrNative|CSSResultArray|undefined {\n    return this.styles;\n  }\n\n  /** @nocollapse */\n  private static _getUniqueStyles() {\n    // Only gather styles once per class\n    if (this.hasOwnProperty(JSCompiler_renameProperty('_styles', this))) {\n      return;\n    }\n    // Take care not to call `this.getStyles()` multiple times since this\n    // generates new CSSResults each time.\n    // TODO(sorvell): Since we do not cache CSSResults by input, any\n    // shared styles will generate new stylesheet objects, which is wasteful.\n    // This should be addressed when a browser ships constructable\n    // stylesheets.\n    const userStyles = this.getStyles();\n\n    if (Array.isArray(userStyles)) {\n      // De-duplicate styles preserving the _last_ instance in the set.\n      // This is a performance optimization to avoid duplicated styles that can\n      // occur especially when composing via subclassing.\n      // The last item is kept to try to preserve the cascade order with the\n      // assumption that it's most important that last added styles override\n      // previous styles.\n      const addStyles = (styles: CSSResultArray, set: Set<CSSResultOrNative>):\n          Set<CSSResultOrNative> => styles.reduceRight(\n              (set: Set<CSSResultOrNative>, s) =>\n                  // Note: On IE set.add() does not return the set\n              Array.isArray(s) ? addStyles(s, set) : (set.add(s), set),\n              set);\n      // Array.from does not work on Set in IE, otherwise return\n      // Array.from(addStyles(userStyles, new Set<CSSResult>())).reverse()\n      const set = addStyles(userStyles, new Set<CSSResultOrNative>());\n      const styles: CSSResultOrNative[] = [];\n      set.forEach((v) => styles.unshift(v));\n      this._styles = styles;\n    } else {\n      this._styles = userStyles === undefined ? [] : [userStyles];\n    }\n\n    // Ensure that there are no invalid CSSStyleSheet instances here. They are\n    // invalid in two conditions.\n    // (1) the sheet is non-constructible (`sheet` of a HTMLStyleElement), but\n    //     this is impossible to check except via .replaceSync or use\n    // (2) the ShadyCSS polyfill is enabled (:. supportsAdoptingStyleSheets is\n    //     false)\n    this._styles = this._styles.map((s) => {\n      if (s instanceof CSSStyleSheet && !supportsAdoptingStyleSheets) {\n        // Flatten the cssText from the passed constructible stylesheet (or\n        // undetectable non-constructible stylesheet). The user might have\n        // expected to update their stylesheets over time, but the alternative\n        // is a crash.\n        const cssText = Array.prototype.slice.call(s.cssRules)\n                            .reduce((css, rule) => css + rule.cssText, '');\n        return unsafeCSS(cssText);\n      }\n      return s;\n    });\n  }\n\n  private _needsShimAdoptedStyleSheets?: boolean;\n\n  /**\n   * Node or ShadowRoot into which element DOM should be rendered. Defaults\n   * to an open shadowRoot.\n   */\n  readonly renderRoot!: Element|DocumentFragment;\n\n  /**\n   * Performs element initialization. By default this calls\n   * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and\n   * captures any pre-set values for registered properties.\n   */\n  protected initialize() {\n    super.initialize();\n    (this.constructor as typeof LitElement)._getUniqueStyles();\n    (this as {\n      renderRoot: Element|DocumentFragment;\n    }).renderRoot = this.createRenderRoot();\n    // Note, if renderRoot is not a shadowRoot, styles would/could apply to the\n    // element's getRootNode(). While this could be done, we're choosing not to\n    // support this now since it would require different logic around de-duping.\n    if (window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot) {\n      this.adoptStyles();\n    }\n  }\n\n  /**\n   * Returns the node into which the element should render and by default\n   * creates and returns an open shadowRoot. Implement to customize where the\n   * element's DOM is rendered. For example, to render into the element's\n   * childNodes, return `this`.\n   * @returns {Element|DocumentFragment} Returns a node into which to render.\n   */\n  protected createRenderRoot(): Element|ShadowRoot {\n    return this.attachShadow({mode: 'open'});\n  }\n\n  /**\n   * Applies styling to the element shadowRoot using the [[`styles`]]\n   * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where\n   * available and will fallback otherwise. When Shadow DOM is polyfilled,\n   * ShadyCSS scopes styles and adds them to the document. When Shadow DOM\n   * is available but `adoptedStyleSheets` is not, styles are appended to the\n   * end of the `shadowRoot` to [mimic spec\n   * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n   */\n  protected adoptStyles() {\n    const styles = (this.constructor as typeof LitElement)._styles!;\n    if (styles.length === 0) {\n      return;\n    }\n    // There are three separate cases here based on Shadow DOM support.\n    // (1) shadowRoot polyfilled: use ShadyCSS\n    // (2) shadowRoot.adoptedStyleSheets available: use it\n    // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after\n    // rendering\n    if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n      window.ShadyCSS.ScopingShim!.prepareAdoptedCssText(\n          styles.map((s) => s.cssText), this.localName);\n    } else if (supportsAdoptingStyleSheets) {\n      (this.renderRoot as ShadowRoot).adoptedStyleSheets =\n          styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet!);\n    } else {\n      // This must be done after rendering so the actual style insertion is done\n      // in `update`.\n      this._needsShimAdoptedStyleSheets = true;\n    }\n  }\n\n  connectedCallback() {\n    super.connectedCallback();\n    // Note, first update/render handles styleElement so we only call this if\n    // connected after first update.\n    if (this.hasUpdated && window.ShadyCSS !== undefined) {\n      window.ShadyCSS.styleElement(this);\n    }\n  }\n\n  /**\n   * Updates the element. This method reflects property values to attributes\n   * and calls `render` to render DOM via lit-html. Setting properties inside\n   * this method will *not* trigger another update.\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected update(changedProperties: PropertyValues) {\n    // Setting properties in `render` should not trigger an update. Since\n    // updates are allowed after super.update, it's important to call `render`\n    // before that.\n    const templateResult = this.render();\n    super.update(changedProperties);\n    // If render is not implemented by the component, don't call lit-html render\n    if (templateResult !== renderNotImplemented) {\n      (this.constructor as typeof LitElement)\n          .render(\n              templateResult,\n              this.renderRoot,\n              {scopeName: this.localName, eventContext: this});\n    }\n    // When native Shadow DOM is used but adoptedStyles are not supported,\n    // insert styling after rendering to ensure adoptedStyles have highest\n    // priority.\n    if (this._needsShimAdoptedStyleSheets) {\n      this._needsShimAdoptedStyleSheets = false;\n      (this.constructor as typeof LitElement)._styles!.forEach((s) => {\n        const style = document.createElement('style');\n        style.textContent = s.cssText;\n        this.renderRoot.appendChild(style);\n      });\n    }\n  }\n\n  /**\n   * Invoked on each update to perform rendering tasks. This method may return\n   * any value renderable by lit-html's `NodePart` - typically a\n   * `TemplateResult`. Setting properties inside this method will *not* trigger\n   * the element to update.\n   */\n  protected render(): unknown {\n    return renderNotImplemented;\n  }\n}\n","import { LitElement, html } from 'lit-element';\n\nclass FetchFillSlot extends LitElement {\n\n    static get properties() {\n        return {\n            url: { type: String },\n            key: { type: String },\n            value: { type: Number },\n        };\n    }\n\n    comparison(slotName) {\n        var comparisonOperatorsHash = {\n            '<': function (a, b) { return a < b; },\n            '>': function (a, b) { return a > b; },\n            '>=': function (a, b) { return a >= b; },\n            '<=': function (a, b) { return a <= b; },\n            '==': function (a, b) { return a == b; },\n            '!=': function (a, b) { return a != b; },\n            '===': function (a, b) { return a === b; },\n            '!==': function (a, b) { return a !== b; },\n        };\n        const tokens = slotName.split(\" \");\n        if (tokens.length < 3) {\n            throw new Error(\"nah\");\n        }\n        let a = tokens[0];\n        if (a === \"value\") {\n            a = this.value;\n        } else {\n            a = parseInt(a, 10);\n        }\n        let b = tokens[2];\n        if (b === \"value\") {\n            b = this.value;\n        } else {\n            b = parseInt(b, 10);\n        }\n        const comp = tokens[1];\n        if (!(comp in comparisonOperatorsHash)) {\n            throw new Error(\"Invalid comparison\")\n        }\n        return comparisonOperatorsHash[comp](a, b);\n    }\n\n    firstUpdated() {\n        fetch(this.url).then(r => r.json()).then(r => r[this.key]).then(r => this.value = r);\n    }\n\n    render() {\n        if (this.value === undefined) {\n            return html`<slot></slot>`;\n        }\n        let selectedSlot = \"\";\n        this.querySelectorAll(\"[slot]\").forEach(slot => {\n            const comp = slot.getAttribute(\"slot\");\n            if (this.comparison(comp)) {\n                selectedSlot = comp;\n            }\n        });\n        this.querySelectorAll(\"[data-value]\").forEach(dv => {\n            dv.textContent = this.value;\n        });\n        return html`<slot name=${selectedSlot}></slot>`;\n    }\n}\n\ncustomElements.define('fetch-fill-slot', FetchFillSlot);\n","import { LitElement, html } from 'lit-element';\n\nconst LEVEL_ICON_MAP = {\n    \"error\": \"fas fa-exclamation-circle\",\n    \"warning\": \"fas fa-exclamation-triangle\",\n    \"success\": \"fas fa-check-circle\",\n    \"info\": \"fas fa-info\",\n};\n\nlet ID = function (prefix) {\n    return prefix + Math.random().toString(36).substr(2, 9);\n};\n\nexport function updateMessages() {\n    document.querySelector(\"pb-messages\").fetchMessages();\n}\n\nclass Messages extends LitElement {\n\n    static get properties() {\n        return {\n            url: { type: String },\n            messages: { type: Array },\n        };\n    }\n\n    createRenderRoot() {\n        return this;\n    }\n\n    firstUpdated() {\n        this.fetchMessages();\n    }\n\n    fetchMessages() {\n        return fetch(this.url).then(r => r.json()).then(r => this.messages = r).then((r) => {\n            const container = this.querySelector(\".pf-c-alert-group\");\n            r.forEach(message => {\n                const messageElement = this.renderMessage(message);\n                container.appendChild(messageElement);\n            });\n        });\n    }\n\n    renderMessage(message) {\n        const id = ID(\"pb-message\");\n        const el = document.createElement(\"template\");\n        el.innerHTML = `<li id=${id} class=\"pf-c-alert-group__item\">\n            <div class=\"pf-c-alert pf-m-${message.level_tag} ${message.level_tag === 'error' ? 'pf-m-danger': ''}\">\n                <div class=\"pf-c-alert__icon\">\n                    <i class=\"${LEVEL_ICON_MAP[message.level_tag]}\"></i>\n                </div>\n                <p class=\"pf-c-alert__title\">\n                    ${message.message}\n                </p>\n            </div>\n        </li>`;\n        setTimeout(() => {\n            this.querySelector(`#${id}`).remove();\n        }, 1500);\n        return el.content.firstChild;\n    }\n\n    render() {\n        return html`<ul class=\"pf-c-alert-group pf-m-toast\"></ul>`;\n    }\n}\n\ncustomElements.define('pb-messages', Messages);\n","import { getCookie } from \"./utils.js\";\nimport { updateMessages } from \"./Messages.js\";\n\nconst PRIMARY_CLASS = \"pf-m-primary\";\nconst SUCCESS_CLASS = \"pf-m-success\";\nconst ERROR_CLASS = \"pf-m-danger\";\nconst PROGRESS_CLASSES = [\"pf-m-progress\", \"pf-m-in-progress\"];\n\nclass ActionButton extends HTMLButtonElement {\n\n    constructor() {\n        super();\n        this.addEventListener('click', e => this.callAction());\n    }\n\n    isRunning = false;\n    oldBody = \"\";\n\n    setLoading() {\n        this.classList.add(...PROGRESS_CLASSES);\n        this.oldBody = this.innerText;\n        this.innerHTML = `<span class=\"pf-c-button__progress\">\n            <span class=\"pf-c-spinner pf-m-md\" role=\"progressbar\" aria-valuetext=\"Loading...\">\n                <span class=\"pf-c-spinner__clipper\"></span>\n                <span class=\"pf-c-spinner__lead-ball\"></span>\n                <span class=\"pf-c-spinner__tail-ball\"></span>\n            </span>\n        </span>${this.oldBody}`;\n    }\n\n    setDone(statusClass) {\n        this.isRunning = false;\n        this.classList.remove(...PROGRESS_CLASSES);\n        this.innerText = this.oldBody;\n        this.classList.replace(PRIMARY_CLASS, statusClass);\n        // Trigger messages to update\n        updateMessages();\n        setTimeout(() => {\n            this.classList.replace(statusClass, PRIMARY_CLASS);\n        }, 1000);\n    }\n\n    callAction() {\n        if (this.isRunning === true) {\n            return;\n        }\n        this.setLoading();\n        const csrftoken = getCookie('passbook_csrf');\n        const request = new Request(\n            this.attributes[\"url\"].value,\n            { headers: { 'X-CSRFToken': csrftoken } }\n        );\n        fetch(request, {\n            method: \"POST\",\n            mode: 'same-origin',\n        }).then(r => r.json()).then(r => {\n            this.setDone(SUCCESS_CLASS);\n        }).catch(() => {\n            this.setDone(ERROR_CLASS);\n        });\n    }\n\n}\n\ncustomElements.define('action-button', ActionButton, { extends: 'button' });\n","export function getCookie(name) {\n    let cookieValue = null;\n    if (document.cookie && document.cookie !== '') {\n        const cookies = document.cookie.split(';');\n        for (let i = 0; i < cookies.length; i++) {\n            const cookie = cookies[i].trim();\n            // Does this cookie string begin with the name we want?\n            if (cookie.substring(0, name.length + 1) === (name + '=')) {\n                cookieValue = decodeURIComponent(cookie.substring(name.length + 1));\n                break;\n            }\n        }\n    }\n    return cookieValue;\n}\n","import { LitElement, html } from 'lit-element';\nimport { updateMessages } from \"./Messages.js\";\n\nclass FetchFillSlot extends LitElement {\n\n    static get properties() {\n        return {\n            flowBodyUrl: { type: String },\n            flowBody: { type: String },\n        };\n    }\n\n    createRenderRoot() {\n        return this;\n    }\n\n    firstUpdated() {\n        fetch(this.flowBodyUrl).then(r => r.json()).then(r => this.updateCard(r));\n    }\n\n    async updateCard(data) {\n        switch (data.type) {\n            case \"redirect\":\n                window.location = data.to\n                break;\n            case \"template\":\n                this.flowBody = data.body;\n                await this.requestUpdate();\n                this.checkAutofocus();\n                updateMessages();\n                this.loadFormCode();\n                this.setFormSubmitHandlers();\n            default:\n                break;\n        }\n    };\n\n    loadFormCode() {\n        this.querySelectorAll(\"script\").forEach(script => {\n            let newScript = document.createElement(\"script\");\n            newScript.src = script.src;\n            document.head.appendChild(newScript);\n        });\n    }\n\n    checkAutofocus() {\n        const autofocusElement = this.querySelector(\"[autofocus]\");\n        if (autofocusElement !== null) {\n            autofocusElement.focus();\n        }\n    }\n\n    updateFormAction(form) {\n        for (let index = 0; index < form.elements.length; index++) {\n            const element = form.elements[index];\n            if (element.value === form.action) {\n                console.log(\"pb-flow: Found Form action URL in form elements, not changing form action.\");\n                return false;\n            }\n        }\n        form.action = this.flowBodyUrl;\n        console.log(`pb-flow: updated form.action ${this.flowBodyUrl}`);\n        return true;\n    }\n\n    checkAutosubmit(form) {\n        if (\"autosubmit\" in form.attributes) {\n            return form.submit();\n        }\n    }\n\n    setFormSubmitHandlers() {\n        this.querySelectorAll(\"form\").forEach(form => {\n            console.log(`pb-flow: Checking for autosubmit attribute ${form}`);\n            this.checkAutosubmit(form);\n            console.log(`pb-flow: Setting action for form ${form}`);\n            this.updateFormAction(form);\n            console.log(`pb-flow: Adding handler for form ${form}`);\n            form.addEventListener('submit', (e) => {\n                e.preventDefault();\n                let formData = new FormData(form);\n                this.flowBody = undefined;\n                fetch(this.flowBodyUrl, {\n                    method: 'post',\n                    body: formData,\n                }).then(response => response.json()).then(data => {\n                    this.updateCard(data);\n                });\n            });\n            form.classList.add(\"pb-flow-wrapped\");\n        });\n    }\n\n    loading() {\n        return html`\n            <div class=\"pf-c-login__main-body pb-loading\">\n                <span class=\"pf-c-spinner\" role=\"progressbar\" aria-valuetext=\"Loading...\">\n                    <span class=\"pf-c-spinner__clipper\"></span>\n                    <span class=\"pf-c-spinner__lead-ball\"></span>\n                    <span class=\"pf-c-spinner__tail-ball\"></span>\n                </span>\n            </div>`;\n    }\n\n    render() {\n        if (this.flowBody !== undefined) {\n            return html([this.flowBody]);\n        }\n        return this.loading();\n    }\n}\n\ncustomElements.define('flow-shell-card', FetchFillSlot);\n","import './FetchFillSlot.js';\nimport './ActionButton.js';\nimport './Messages.js';\nimport './FlowShellCard.js';\n\n// Button Dropdowns\ndocument.querySelectorAll(\"button.pf-c-dropdown__toggle\").forEach((b) => {\n    b.addEventListener('click', (e) => {\n        const parent = e.target.closest('.pf-c-dropdown');\n        const menu = parent.querySelector('.pf-c-dropdown__menu');\n        menu.hidden = !menu.hidden;\n    });\n});\n\n// Search clearing\ndocument.querySelectorAll(\"input[type=search]\").forEach((si) => {\n    si.addEventListener(\"search\", (e) => {\n        if (si.value === \"\") {\n            si.parentElement.submit();\n        }\n    });\n});\n\n// Fetch from data-attributes\ndocument.querySelectorAll(\"[data-pb-fetch-fill]\").forEach((el) => {\n    const url = el.dataset.pbFetchFill;\n    const key = el.dataset.pbFetchKey;\n    fetch(url).then(r => r.json()).then(r => {\n        el.textContent = r[key];\n        el.value = r[key];\n    });\n});\n\n// Modal\ndocument.querySelectorAll(\"[data-target='modal']\").forEach((m) => {\n    m.addEventListener(\"click\", (e) => {\n        const parentContainer = e.target.closest('[data-target=\"modal\"]');\n        const modalId = parentContainer.attributes['data-modal'].value;\n        document.querySelector(`#${modalId}`).removeAttribute(\"hidden\");\n    });\n});\ndocument.querySelectorAll(\".pf-c-modal-box [data-modal-close]\").forEach((b) => {\n    b.addEventListener(\"click\", (e) => {\n        const parentContainer = e.target.closest('.pf-c-backdrop');\n        parentContainer.setAttribute(\"hidden\", true);\n    });\n});\n\n// Make Checkbox label click trigger checkbox toggle\ndocument.querySelectorAll(\".pf-c-check__label\").forEach((checkLabel) => {\n    checkLabel.addEventListener(\"click\", (e) => {\n        const checkbox = e.target.parentElement.querySelector(\"input[type=checkbox]\");\n        checkbox.checked = !checkbox.checked;\n    });\n});\n\n// CodeMirror\ndocument.querySelectorAll(\".codemirror\").forEach((cm) => {\n    let cmMode = 'xml';\n    if ('data-cm-mode' in cm.attributes) {\n        cmMode = cm.attributes['data-cm-mode'].value;\n    }\n    // https://github.com/codemirror/CodeMirror/issues/5092\n    cm.removeAttribute(\"required\");\n    CodeMirror.fromTextArea(cm, {\n        mode: cmMode,\n        theme: 'monokai',\n        lineNumbers: false,\n        readOnly: cm.readOnly,\n        autoRefresh: true,\n    });\n});\n\n// Automatic slug fields\nconst convertToSlug = (text) => {\n    return text\n        .toLowerCase()\n        .replace(/ /g, '-')\n        .replace(/[^\\w-]+/g, '');\n};\n\ndocument.querySelectorAll(\"input[name=name]\").forEach((input) => {\n    input.addEventListener(\"input\", (e) => {\n        const form = e.target.closest(\"form\");\n        if (form === null) {\n            return;\n        }\n        const slugField = form.querySelector(\"input[name=slug]\");\n        slugField.value = convertToSlug(e.target.value);\n    });\n});\n\n// Hamburger Menu\ndocument.querySelectorAll(\".pf-c-page__header-brand-toggle>button\").forEach((toggle) => {\n    toggle.addEventListener(\"click\", (e) => {\n        const sidebar = document.querySelector(\".pf-c-page__sidebar\");\n        if (sidebar.classList.contains(\"pf-m-expanded\")) {\n            // Sidebar already expanded\n            sidebar.classList.remove(\"pf-m-expanded\");\n            sidebar.style.zIndex = 0;\n        } else {\n            // Sidebar not expanded yet\n            sidebar.classList.add(\"pf-m-expanded\");\n            sidebar.style.zIndex = 200;\n        }\n    });\n});\n\n// Collapsable Menus in Sidebar\ndocument.querySelectorAll(\".pf-m-expandable>.pf-c-nav__link\").forEach((menu) => {\n    menu.addEventListener(\"click\", (e) => {\n        e.preventDefault();\n        menu.parentElement.classList.toggle(\"pf-m-expanded\");\n    });\n});\n"],"names":["isCEPolyfill","window","customElements","undefined","polyfillWrapFlushCallback","removeNodes","container","start","end","n","nextSibling","removeChild","marker","String","Math","random","slice","nodeMarker","markerRegex","RegExp","boundAttributeSuffix","Template","[object Object]","result","element","this","nodesToRemove","stack","walker","document","createTreeWalker","content","lastPartIndex","index","partIndex","strings","values","length","node","nextNode","nodeType","hasAttributes","attributes","count","i","endsWith","name","stringForPart","lastAttributeNameRegex","exec","attributeLookupName","toLowerCase","attributeValue","getAttribute","removeAttribute","statics","split","parts","push","type","tagName","currentNode","data","indexOf","parent","parentNode","lastIndex","insert","s","createMarker","match","createTextNode","insertBefore","previousSibling","pop","str","suffix","isTemplatePartActive","part","createComment","removeNodesFromTemplate","template","nextActiveIndexInTemplateParts","nodeIndex","removeCount","nodesToRemoveInTemplate","currentRemovingNode","has","forEach","countNodes","startIndex","directives","WeakMap","isDirective","o","noChange","nothing","TemplateInstance","processor","options","__parts","setValue","commit","fragment","cloneNode","importNode","nodeName","handleTextExpression","insertAfterNode","handleAttributeExpressions","adoptNode","upgrade","policy","trustedTypes","createPolicy","createHTML","commentMarker","TemplateResult","l","html","isCommentBinding","commentOpen","lastIndexOf","attributeMatch","substr","createElement","value","getHTML","innerHTML","isPrimitive","isIterable","Array","isArray","Symbol","iterator","AttributeCommitter","_createPart","AttributePart","v","text","t","dirty","setAttribute","_getValue","committer","directive","NodePart","startNode","appendChild","endNode","ref","__insert","__pendingValue","__commitText","__commitTemplateResult","Node","__commitNode","__commitIterable","clear","valueAsString","templateFactory","update","instance","_clone","itemParts","itemPart","item","appendIntoPart","insertAfterPart","BooleanAttributePart","Error","PropertyCommitter","super","single","PropertyPart","eventOptionsSupported","capture","addEventListener","removeEventListener","_e","EventPart","eventName","eventContext","__boundHandleEvent","e","handleEvent","newListener","oldListener","shouldRemoveListener","once","passive","shouldAddListener","__options","getOptions","event","call","templateCache","templateCaches","get","stringsArray","keyString","Map","set","key","join","getTemplateElement","defaultTemplateProcessor","prefix","getTemplateCacheKey","scopeName","compatibleShadyCSSVersion","ShadyCSS","prepareTemplateDom","console","warn","shadyTemplateFactory","cacheKey","TEMPLATE_TYPES","shadyRenderSet","Set","prepareTemplateStyles","renderedDOM","add","templateElement","styles","querySelectorAll","condensedStyle","style","textContent","templates","from","removeStylesFromLitTemplates","refNode","insertCount","walkerIndex","insertNodeIntoTemplate","firstChild","querySelector","nativeShadow","removes","JSCompiler_renameProperty","prop","_obj","defaultConverter","Boolean","Object","JSON","stringify","Number","parse","notEqual","old","defaultPropertyDeclaration","attribute","converter","reflect","hasChanged","finalized","UpdatingElement","HTMLElement","initialize","observedAttributes","finalize","_classProperties","p","attr","_attributeNameForProperty","_attributeToPropertyMap","hasOwnProperty","superProperties","getPrototypeOf","k","_ensureClassProperties","noAccessor","prototype","descriptor","getPropertyDescriptor","defineProperty","oldValue","requestUpdateInternal","configurable","enumerable","superCtor","props","properties","propKeys","getOwnPropertyNames","getOwnPropertySymbols","createProperty","fromAttribute","toAttribute","_updateState","_updatePromise","Promise","res","_enableUpdatingResolver","_changedProperties","_saveInstanceProperties","constructor","_v","_instanceProperties","enableUpdating","_attributeToProperty","ctor","attrValue","_propertyValueToAttribute","propName","getPropertyOptions","_propertyValueFromAttribute","shouldRequestUpdate","_valueHasChanged","_reflectingProperties","_hasRequestedUpdate","_enqueueUpdate","updateComplete","performUpdate","hasUpdated","_applyInstanceProperties","shouldUpdate","changedProperties","_markUpdated","firstUpdated","updated","_getUpdateComplete","size","_propertyToAttribute","supportsAdoptingStyleSheets","Document","CSSStyleSheet","constructionToken","CSSResult","cssText","safeToken","styleSheet","_styleSheet","replaceSync","renderNotImplemented","LitElement","userStyles","getStyles","addStyles","reduceRight","unshift","_styles","map","cssRules","reduce","css","rule","_getUniqueStyles","renderRoot","createRenderRoot","ShadowRoot","adoptStyles","attachShadow","mode","adoptedStyleSheets","_needsShimAdoptedStyleSheets","ScopingShim","prepareAdoptedCssText","localName","connectedCallback","styleElement","templateResult","render","hasRendered","needsScoping","host","firstScopeRender","renderContainer","createDocumentFragment","appendInto","litRender","delete","define","url","slotName","comparisonOperatorsHash","<","a","b",">",">=","<=","==","!=","===","!==","tokens","parseInt","comp","fetch","then","r","json","selectedSlot","slot","comparison","dv","LEVEL_ICON_MAP","error","warning","success","info","updateMessages","fetchMessages","messages","message","messageElement","renderMessage","id","toString","el","level_tag","setTimeout","remove","PRIMARY_CLASS","PROGRESS_CLASSES","ActionButton","HTMLButtonElement","callAction","classList","oldBody","innerText","statusClass","isRunning","replace","setLoading","csrftoken","cookieValue","cookie","cookies","trim","substring","decodeURIComponent","getCookie","request","Request","headers","X-CSRFToken","method","setDone","catch","extends","flowBodyUrl","flowBody","updateCard","location","to","body","requestUpdate","checkAutofocus","loadFormCode","setFormSubmitHandlers","script","newScript","src","head","autofocusElement","focus","form","elements","action","log","submit","checkAutosubmit","updateFormAction","preventDefault","formData","FormData","response","loading","menu","target","closest","hidden","si","parentElement","dataset","pbFetchFill","pbFetchKey","m","modalId","checkLabel","checkbox","checked","cm","cmMode","CodeMirror","fromTextArea","theme","lineNumbers","readOnly","autoRefresh","input","toggle","sidebar","contains","zIndex"],"mappings":";;;;;;;;;;;;;OAqBO,MAAMA,EAAiC,oBAAXC,QACN,MAAzBA,OAAOC,qBAEHC,IADHF,OAAOC,eAAqCE,0BAwBpCC,EACT,CAACC,EAAiBC,EAAkBC,EAAiB,QACnD,KAAOD,IAAUC,GAAK,CACpB,MAAMC,EAAIF,EAAOG,YACjBJ,EAAUK,YAAYJ,GACtBA,EAAQE,IChCHG,EAAS,SAASC,OAAOC,KAAKC,UAAUC,MAAM,OAM9CC,EAAa,UAAOL,UAEpBM,EAAc,IAAIC,OAAO,GAAGP,KAAUK,KAKtCG,EAAuB,cAKvBC,EAIXC,YAAYC,EAAwBC,G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iBAAiB,SAAUO,IAClC,MAAM4S,EAAW5S,EAAEiS,OAAOI,cAAchP,cAAc,wBACtDuP,EAASC,SAAWD,EAASC,cAKrCxc,SAASoM,iBAAiB,eAAezI,SAAS8Y,IAC9C,IAAIC,EAAS,MACT,iBAAkBD,EAAG5b,aACrB6b,EAASD,EAAG5b,WAAW,gBAAgBoF,OAG3CwW,EAAGhb,gBAAgB,YACnBkb,WAAWC,aAAaH,EAAI,CACxBnI,KAAMoI,EACNG,MAAO,UACPC,aAAa,EACbC,SAAUN,EAAGM,SACbC,aAAa,OAYrBhd,SAASoM,iBAAiB,oBAAoBzI,SAASsZ,IACnDA,EAAM7T,iBAAiB,SAAUO,IAC7B,MAAMoR,EAAOpR,EAAEiS,OAAOC,QAAQ,QAC9B,GAAa,OAATd,EACA,OAEcA,EAAK/N,cAAc,oBAC3B/G,MAAsB0D,EAAEiS,OAAO3V,MAZxC3E,cACAuX,QAAQ,KAAM,KACdA,QAAQ,WAAY,UAe7B7Y,SAASoM,iBAAiB,0CAA0CzI,SAASuZ,IACzEA,EAAO9T,iBAAiB,SAAUO,IAC9B,MAAMwT,EAAUnd,SAASgN,cAAc,uBACnCmQ,EAAQ3E,UAAU4E,SAAS,kBAE3BD,EAAQ3E,UAAUN,OAAO,iBACzBiF,EAAQ7Q,MAAM+Q,OAAS,IAGvBF,EAAQ3E,UAAUvM,IAAI,iBACtBkR,EAAQ7Q,MAAM+Q,OAAS,WAMnCrd,SAASoM,iBAAiB,oCAAoCzI,SAASgY,IACnEA,EAAKvS,iBAAiB,SAAUO,IAC5BA,EAAE2R,iBACFK,EAAKK,cAAcxD,UAAU0E,OAAO"}
\ No newline at end of file
diff --git a/passbook/static/static/src/Messages.js b/passbook/static/static/src/Messages.js
index 9f05d8c8a..1a25c9861 100644
--- a/passbook/static/static/src/Messages.js
+++ b/passbook/static/static/src/Messages.js
@@ -12,7 +12,7 @@ let ID = function (prefix) {
 };
 
 export function updateMessages() {
-    document.querySelector("pb-messages").setAttribute("touch", Date.now());
+    document.querySelector("pb-messages").fetchMessages();
 }
 
 class Messages extends LitElement {
@@ -21,19 +21,18 @@ class Messages extends LitElement {
         return {
             url: { type: String },
             messages: { type: Array },
-            touch: { type: Object },
         };
     }
 
-    set touch(value) {
-        this.firstUpdated();
-    }
-
     createRenderRoot() {
         return this;
     }
 
     firstUpdated() {
+        this.fetchMessages();
+    }
+
+    fetchMessages() {
         return fetch(this.url).then(r => r.json()).then(r => this.messages = r).then((r) => {
             const container = this.querySelector(".pf-c-alert-group");
             r.forEach(message => {