apprun 3.28.3 → 3.28.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +5 -2
  2. package/README.md +21 -8
  3. package/WHATSNEW.md +7 -5
  4. package/apprun-cli.js +93 -29
  5. package/cli-templates/_build.js +27 -0
  6. package/cli-templates/_eslintrc.js +40 -0
  7. package/cli-templates/index.html +1 -1
  8. package/cli-templates/spa_index.html +1 -1
  9. package/cli-templates/webpack.config.js +3 -2
  10. package/dist/apprun-dev-tools.js +1 -2
  11. package/dist/apprun-dev-tools.js.map +1 -1
  12. package/dist/apprun-html.esm.js +10 -112
  13. package/dist/apprun-html.esm.js.map +1 -1
  14. package/dist/apprun-html.js +1 -1
  15. package/dist/apprun-html.js.LICENSE.txt +2 -24
  16. package/dist/apprun-html.js.map +1 -1
  17. package/dist/apprun-play.js +2 -0
  18. package/dist/apprun-play.js.map +1 -0
  19. package/dist/apprun.esm.js +1 -1
  20. package/dist/apprun.esm.js.map +1 -1
  21. package/dist/apprun.js +1 -1
  22. package/dist/apprun.js.map +1 -1
  23. package/error.log +0 -0
  24. package/esm/app.js +1 -1
  25. package/esm/apprun-dev-tools.js +2 -1
  26. package/esm/apprun-dev-tools.js.map +1 -1
  27. package/esm/apprun-play.js +209 -0
  28. package/esm/apprun-play.js.map +1 -0
  29. package/esm/apprun.js +1 -1
  30. package/esm/apprun.js.map +1 -1
  31. package/esm/component.js +1 -1
  32. package/esm/component.js.map +1 -1
  33. package/esm/vdom-html.js +2 -0
  34. package/esm/vdom-html.js.map +1 -1
  35. package/esm/vdom-lit-html.js +40 -21
  36. package/esm/vdom-lit-html.js.map +1 -1
  37. package/esm/vdom-to-html.js +1 -2
  38. package/esm/vdom-to-html.js.map +1 -1
  39. package/index-apprun-play.html +46 -0
  40. package/index.html +2 -2
  41. package/package.json +18 -16
  42. package/react.js +13 -0
  43. package/src/app.ts +1 -1
  44. package/src/apprun-play.tsx +212 -0
  45. package/src/apprun.ts +1 -1
  46. package/src/component.ts +1 -1
  47. package/src/vdom-html.ts_ +1 -0
  48. package/src/vdom-lit-html.ts +42 -20
  49. package/src/vdom-to-html.tsx +2 -2
  50. package/webpack.config.js +3 -1
  51. package/index-wc.html +0 -36
@@ -1 +1 @@
1
- {"version":3,"file":"apprun-html.esm.js","sources":["../src/app.ts","../src/vdom-my.ts","../src/web-component.ts","../src/decorator.ts","../src/directive.ts","../src/component.ts","../src/router.ts","../src/apprun.ts","../src/vdom.ts","../node_modules/lit-html/src/lib/directive.ts","../node_modules/lit-html/src/lib/dom.ts","../node_modules/lit-html/src/lib/part.ts","../node_modules/lit-html/src/lib/template.ts","../node_modules/lit-html/src/lib/template-instance.ts","../node_modules/lit-html/src/lib/template-result.ts","../node_modules/lit-html/src/lib/parts.ts","../node_modules/lit-html/src/lib/default-template-processor.ts","../node_modules/lit-html/src/lib/template-factory.ts","../node_modules/lit-html/src/lib/render.ts","../node_modules/lit-html/src/lit-html.ts","../node_modules/lit-html/src/directives/unsafe-html.ts","../src/vdom-lit-html.ts","../src/apprun-html.ts"],"sourcesContent":["import { EventOptions} from './types'\nexport class App {\n\n private _events: Object;\n\n public start;\n public h;\n public createElement;\n public render;\n public Fragment;\n public webComponent;\n\n constructor() {\n this._events = {};\n }\n\n on(name: string, fn: (...args) => void, options: EventOptions = {}): void {\n this._events[name] = this._events[name] || [];\n this._events[name].push({ fn, options });\n }\n\n off(name: string, fn: (...args) => void): void {\n const subscribers = this._events[name] || [];\n\n this._events[name] = subscribers.filter((sub) => sub.fn !== fn);\n }\n\n find(name: string): any {\n return this._events[name];\n }\n\n run(name: string, ...args): number {\n const subscribers = this.getSubscribers(name, this._events);\n console.assert(subscribers && subscribers.length > 0, 'No subscriber for event: ' + name);\n subscribers.forEach((sub) => {\n const { fn, options } = sub;\n if (options.delay) {\n this.delay(name, fn, args, options);\n } else {\n Object.keys(options).length > 0 ? fn.apply(this, [...args, options]) : fn.apply(this, args);\n }\n return !sub.options.once;\n });\n\n return subscribers.length;\n }\n\n once(name: string, fn, options: EventOptions = {}): void {\n this.on(name, fn, { ...options, once: true });\n }\n\n private delay(name, fn, args, options): void {\n if (options._t) clearTimeout(options._t);\n options._t = setTimeout(() => {\n clearTimeout(options._t);\n Object.keys(options).length > 0 ? fn.apply(this, [...args, options]) : fn.apply(this, args);\n }, options.delay);\n }\n\n query(name: string, ...args): Promise<any[]> {\n const subscribers = this.getSubscribers(name, this._events);\n console.assert(subscribers && subscribers.length > 0, 'No subscriber for event: ' + name);\n const promises = subscribers.map(sub => {\n const { fn, options } = sub;\n return Object.keys(options).length > 0 ? fn.apply(this, [...args, options]) : fn.apply(this, args);\n });\n return Promise.all(promises);\n }\n\n private getSubscribers(name: string, events) {\n const subscribers = events[name] || [];\n\n // Update the list of subscribers by pulling out those which will run once.\n // We must do this update prior to running any of the events in case they\n // cause additional events to be turned off or on.\n events[name] = subscribers.filter((sub) => {\n return !sub.options.once;\n });\n Object.keys(events).filter(evt => evt.endsWith('*') && name.startsWith(evt.replace('*', '')))\n .sort((a, b) => b.length - a.length)\n .forEach(evt => subscribers.push(...events[evt].map(sub => ({\n ...sub,\n options: { ...sub.options, event: name }\n }))));\n return subscribers;\n }\n}\n\nconst AppRunVersions = 'AppRun-2';\nlet app: App;\nconst root = (typeof self === 'object' && self.self === self && self) ||\n (typeof global === 'object' && global.global === global && global)\nif (root['app'] && root['_AppRunVersions']) {\n app = root['app'];\n} else {\n app = new App();\n root['app'] = app;\n root['_AppRunVersions'] = AppRunVersions;\n}\nexport default app;\n","import { VDOM, VNode } from './types';\nexport type Element = any; //HTMLElement | SVGSVGElement | SVGElement;\n\nexport function Fragment(props, ...children): any[] {\n return collect(children);\n}\n\nconst ATTR_PROPS = '_props';\n\nfunction collect(children) {\n const ch = [];\n const push = (c) => {\n if (c !== null && c !== undefined && c !== '' && c !== false) {\n ch.push((typeof c === 'function' || typeof c === 'object') ? c : `${c}`);\n }\n }\n children && children.forEach(c => {\n if (Array.isArray(c)) {\n c.forEach(i => push(i));\n } else {\n push(c);\n }\n });\n return ch;\n}\n\nexport function createElement(tag: string | Function | [], props?: {}, ...children) {\n const ch = collect(children);\n if (typeof tag === 'string') return { tag, props, children: ch };\n else if (Array.isArray(tag)) return tag; // JSX fragments - babel\n else if (tag === undefined && children) return ch; // JSX fragments - typescript\n else if (Object.getPrototypeOf(tag).__isAppRunComponent) return { tag, props, children: ch } // createComponent(tag, { ...props, children });\n else if (typeof tag === 'function') return tag(props, ch);\n else throw new Error(`Unknown tag in vdom ${tag}`);\n};\n\nconst keyCache = new WeakMap();\n\nexport const updateElement = render;\n\nexport function render(element: Element, nodes: VDOM, parent = {}) {\n // console.log('render', element, node);\n // tslint:disable-next-line\n if (nodes == null || nodes === false) return;\n\n nodes = createComponent(nodes, parent);\n\n const isSvg = element?.nodeName === \"SVG\";\n\n if (!element) return;\n if (Array.isArray(nodes)) {\n updateChildren(element, nodes, isSvg);\n } else {\n updateChildren(element, [nodes], isSvg);\n }\n}\n\nfunction same(el: Element, node: VNode) {\n // if (!el || !node) return false;\n const key1 = el.nodeName;\n const key2 = `${node.tag || ''}`;\n return key1.toUpperCase() === key2.toUpperCase();\n}\n\nfunction update(element: Element, node: VNode, isSvg: boolean) {\n if (node['_op'] === 3) return;\n // console.assert(!!element);\n isSvg = isSvg || node.tag === \"svg\";\n if (!same(element, node)) {\n element.parentNode.replaceChild(create(node, isSvg), element);\n return;\n }\n !(node['_op'] & 2) && updateChildren(element, node.children, isSvg);\n !(node['_op'] & 1) && updateProps(element, node.props, isSvg);\n}\n\nfunction updateChildren(element, children, isSvg: boolean) {\n const old_len = element.childNodes?.length || 0;\n const new_len = children?.length || 0;\n const len = Math.min(old_len, new_len);\n for (let i = 0; i < len; i++) {\n const child = children[i];\n if (child['_op'] === 3) continue;\n const el = element.childNodes[i];\n if (typeof child === 'string') {\n if (el.textContent !== child) {\n if (el.nodeType === 3) {\n el.nodeValue = child\n } else {\n element.replaceChild(createText(child), el);\n }\n }\n } else if (child instanceof HTMLElement || child instanceof SVGElement) {\n element.insertBefore(child, el);\n } else {\n const key = child.props && child.props['key'];\n if (key) {\n if (el.key === key) {\n update(element.childNodes[i], child, isSvg);\n } else {\n // console.log(el.key, key);\n const old = keyCache[key];\n if (old) {\n const temp = old.nextSibling;\n element.insertBefore(old, el);\n temp ? element.insertBefore(el, temp) : element.appendChild(el);\n update(element.childNodes[i], child, isSvg);\n } else {\n element.replaceChild(create(child, isSvg), el);\n }\n }\n } else {\n update(element.childNodes[i], child, isSvg);\n }\n }\n }\n\n let n = element.childNodes.length;\n while (n > len) {\n element.removeChild(element.lastChild);\n n--;\n }\n\n if (new_len > len) {\n const d = document.createDocumentFragment();\n for (let i = len; i < children.length; i++) {\n d.appendChild(create(children[i], isSvg));\n }\n element.appendChild(d);\n }\n}\n\nfunction createText(node) {\n if (node?.indexOf('_html:') === 0) { // ?\n const div = document.createElement('div');\n div.insertAdjacentHTML('afterbegin', node.substring(6))\n return div;\n } else {\n return document.createTextNode(node??'');\n }\n}\n\nfunction create(node: VNode | string | HTMLElement | SVGElement, isSvg: boolean): Element {\n // console.assert(node !== null && node !== undefined);\n if ((node instanceof HTMLElement) || (node instanceof SVGElement)) return node;\n if (typeof node === \"string\") return createText(node);\n if (!node.tag || (typeof node.tag === 'function')) return createText(JSON.stringify(node));\n isSvg = isSvg || node.tag === \"svg\";\n const element = isSvg\n ? document.createElementNS(\"http://www.w3.org/2000/svg\", node.tag)\n : document.createElement(node.tag);\n\n updateProps(element, node.props, isSvg);\n if (node.children) node.children.forEach(child => element.appendChild(create(child, isSvg)));\n return element\n}\n\nfunction mergeProps(oldProps: {}, newProps: {}): {} {\n newProps['class'] = newProps['class'] || newProps['className'];\n delete newProps['className'];\n const props = {};\n if (oldProps) Object.keys(oldProps).forEach(p => props[p] = null);\n if (newProps) Object.keys(newProps).forEach(p => props[p] = newProps[p]);\n return props;\n}\n\nexport function updateProps(element: Element, props: {}, isSvg) {\n // console.assert(!!element);\n const cached = element[ATTR_PROPS] || {};\n props = mergeProps(cached, props || {});\n element[ATTR_PROPS] = props;\n\n for (const name in props) {\n const value = props[name];\n // if (cached[name] === value) continue;\n // console.log('updateProps', name, value);\n if (name.startsWith('data-')) {\n const dname = name.substring(5);\n const cname = dname.replace(/-(\\w)/g, (match) => match[1].toUpperCase());\n if (element.dataset[cname] !== value) {\n if (value || value === \"\") element.dataset[cname] = value;\n else delete element.dataset[cname];\n }\n } else if (name === 'style') {\n if (element.style.cssText) element.style.cssText = '';\n if (typeof value === 'string') element.style.cssText = value;\n else {\n for (const s in value) {\n if (element.style[s] !== value[s]) element.style[s] = value[s];\n }\n }\n } else if (name.startsWith('xlink')) {\n const xname = name.replace('xlink', '').toLowerCase();\n if (value == null || value === false) {\n element.removeAttributeNS('http://www.w3.org/1999/xlink', xname);\n } else {\n element.setAttributeNS('http://www.w3.org/1999/xlink', xname, value);\n }\n } else if (name.startsWith('on')) {\n if (!value || typeof value === 'function') {\n element[name] = value;\n } else if (typeof value === 'string') {\n if (value) element.setAttribute(name, value);\n else element.removeAttribute(name);\n }\n } else if (/^id$|^class$|^list$|^readonly$|^contenteditable$|^role|-/g.test(name) || isSvg) {\n if (element.getAttribute(name) !== value) {\n if (value) element.setAttribute(name, value);\n else element.removeAttribute(name);\n }\n } else if (element[name] !== value) {\n element[name] = value;\n }\n if (name === 'key' && value) keyCache[value] = element;\n }\n if (props && typeof props['ref'] === 'function') {\n window.requestAnimationFrame(() => props['ref'](element));\n }\n}\n\nfunction render_component(node, parent, idx) {\n const { tag, props, children } = node;\n let key = `_${idx}`;\n let id = props && props['id'];\n if (!id) id = `_${idx}${Date.now()}`;\n else key = id;\n let asTag = 'section';\n if (props && props['as']) {\n asTag = props['as'];\n delete props['as'];\n }\n if (!parent.__componentCache) parent.__componentCache = {};\n let component = parent.__componentCache[key];\n if (!component || !(component instanceof tag) || !component.element) {\n const element = document.createElement(asTag);\n component = parent.__componentCache[key] = new tag({ ...props, children }).start(element);\n }\n if (component.mounted) {\n const new_state = component.mounted(props, children, component.state);\n (typeof new_state !== 'undefined') && component.setState(new_state);\n }\n updateProps(component.element, props, false);\n return component.element;\n}\n\nfunction createComponent(node, parent, idx = 0) {\n if (typeof node === 'string') return node;\n if (Array.isArray(node)) return node.map(child => createComponent(child, parent, idx++));\n let vdom = node;\n if (node && typeof node.tag === 'function' && Object.getPrototypeOf(node.tag).__isAppRunComponent) {\n vdom = render_component(node, parent, idx);\n }\n if (vdom && Array.isArray(vdom.children)) {\n const new_parent = vdom.props?._component;\n if (new_parent) {\n let i = 0;\n vdom.children = vdom.children.map(child => createComponent(child, new_parent, i++));\n } else {\n vdom.children = vdom.children.map(child => createComponent(child, parent, idx++));\n }\n }\n return vdom;\n}\n","declare var customElements;\n\nexport type CustomElementOptions = {\n render?: boolean;\n shadow?: boolean;\n history?: boolean;\n global_event?: boolean;\n observedAttributes?: string[];\n};\n\nexport const customElement = (componentClass, options: CustomElementOptions = {}) => class CustomElement extends HTMLElement {\n private _shadowRoot;\n private _component;\n private _attrMap: (arg0: string) => string;\n public on;\n public run;\n constructor() {\n super();\n }\n get component() { return this._component; }\n get state() { return this._component.state; }\n\n static get observedAttributes() {\n // attributes need to be set to lowercase in order to get observed\n return (options.observedAttributes || []).map(attr => attr.toLowerCase());\n }\n\n connectedCallback() {\n if (this.isConnected && !this._component) {\n const opts = options || {};\n this._shadowRoot = opts.shadow ? this.attachShadow({ mode: 'open' }) : this;\n const observedAttributes = (opts.observedAttributes || [])\n\n const attrMap = observedAttributes.reduce((map, name) => {\n const lc = name.toLowerCase()\n if (lc !== name) {\n map[lc] = name\n }\n return map\n }, {})\n this._attrMap = (name: string) : string => attrMap[name] || name\n\n const props = {};\n Array.from(this.attributes).forEach(item => props[this._attrMap(item.name)] = item.value);\n\n // add getters/ setters to allow observation on observedAttributes\n observedAttributes.forEach(name => {\n if (this[name] !== undefined) props[name] = this[name];\n Object.defineProperty(this, name, {\n get(): any {\n return props[name];\n },\n set(this: CustomElement, value: unknown) {\n // trigger change event\n this.attributeChangedCallback(name, props[name], value)\n },\n configurable: true,\n enumerable: true\n });\n })\n\n const children = this.children ? Array.from(this.children) : [];\n children.forEach(el => el.parentElement.removeChild(el));\n this._component = new componentClass({ ...props, children }).mount(this._shadowRoot, opts);\n // attach props to component\n this._component._props = props;\n // expose dispatchEvent\n this._component.dispatchEvent = this.dispatchEvent.bind(this)\n if (this._component.mounted) {\n const new_state = this._component.mounted(props, children, this._component.state);\n if (typeof new_state !== 'undefined') this._component.state = new_state;\n }\n this.on = this._component.on.bind(this._component);\n this.run = this._component.run.bind(this._component);\n if (!(opts.render===false)) this._component.run('.');\n }\n }\n\n disconnectedCallback() {\n this._component?.unload?.();\n this._component?.unmount?.();\n this._component = null;\n }\n\n attributeChangedCallback(name: string, oldValue: unknown, value: unknown) {\n if (this._component) {\n // camelCase attributes arrive only in lowercase\n const mappedName = this._attrMap(name);\n // store the new property/ attribute\n this._component._props[mappedName] = value;\n this._component.run('attributeChanged', mappedName, oldValue, value);\n\n if (value !== oldValue && !(options.render === false)) {\n window.requestAnimationFrame(() => {\n // re-render state with new combined props on next animation frame\n this._component.run('.')\n })\n }\n }\n }\n}\n\nexport default (name: string, componentClass, options?: CustomElementOptions) => {\n (typeof customElements !== 'undefined') && customElements.define(name, customElement(componentClass, options))\n}\n","import webComponent, { CustomElementOptions } from './web-component';\n\n// tslint:disable:no-invalid-this\nexport const Reflect = {\n\n meta: new WeakMap(),\n\n defineMetadata(metadataKey, metadataValue, target) {\n if (!this.meta.has(target)) this.meta.set(target, {});\n this.meta.get(target)[metadataKey] = metadataValue;\n },\n\n getMetadataKeys(target) {\n target = Object.getPrototypeOf(target);\n return this.meta.get(target) ? Object.keys(this.meta.get(target)) : [];\n },\n\n getMetadata(metadataKey, target) {\n target = Object.getPrototypeOf(target);\n return this.meta.get(target) ? this.meta.get(target)[metadataKey] : null;\n }\n}\n\nexport function update<E=string>(events?: E, options: any = {}) {\n return (target: any, key: string, descriptor: any) => {\n const name = events ? events.toString() : key;\n Reflect.defineMetadata(`apprun-update:${name}`,\n { name, key, options }, target);\n return descriptor;\n }\n}\n\nexport function on<E = string>(events?: E, options: any = {}) {\n return function (target: any, key: string) {\n const name = events ? events.toString() : key;\n Reflect.defineMetadata(`apprun-update:${name}`,\n { name, key, options }, target)\n }\n}\n\nexport function customElement(name: string, options?: CustomElementOptions) {\n return function _customElement<T extends { new(...args: any[]): {} }>(constructor: T) {\n webComponent(name, constructor, options);\n return constructor;\n }\n}\n\n","import app from './app';\n\nconst getStateValue = (component, name) => {\n return (name ? component['state'][name] : component['state']) || '';\n}\n\nconst setStateValue = (component, name, value) => {\n if (name) {\n const state = component['state'] || {};\n state[name] = value;\n component.setState(state);\n } else {\n component.setState(value);\n }\n}\n\nconst apply_directive = (key: string, props: {}, tag, component) => {\n if (key.startsWith('$on')) {\n const event = props[key];\n key = key.substring(1)\n if (typeof event === 'boolean') {\n props[key] = e => component.run(key, e);\n } else if (typeof event === 'string') {\n props[key] = e => component.run(event, e);\n } else if (typeof event === 'function') {\n props[key] = e => component.setState(event(component.state, e));\n } else if (Array.isArray(event)) {\n const [handler, ...p] = event;\n if (typeof handler === 'string') {\n props[key] = e => component.run(handler, ...p, e);\n } else if (typeof handler === 'function') {\n props[key] = e => component.setState(handler(component.state, ...p, e));\n }\n }\n\n } else if (key === '$bind') {\n const type = props['type'] || 'text';\n const name = typeof props[key] === 'string' ? props[key] : props['name'];\n if (tag === 'input') {\n switch (type) {\n case 'checkbox':\n props['checked'] = getStateValue(component, name);\n props['onclick'] = e => setStateValue(component, name || e.target.name, e.target.checked);\n break;\n case 'radio':\n props['checked'] = getStateValue(component, name) === props['value'];\n props['onclick'] = e => setStateValue(component, name || e.target.name, e.target.value);\n break;\n case 'number':\n case 'range':\n props['value'] = getStateValue(component, name);\n props['oninput'] = e => setStateValue(component, name || e.target.name, Number(e.target.value));\n break;\n default:\n props['value'] = getStateValue(component, name);\n props['oninput'] = e => setStateValue(component, name || e.target.name, e.target.value);\n }\n } else if (tag === 'select') {\n props['value'] = getStateValue(component, name);\n props['onchange'] = e => {\n if (!e.target.multiple) { // multiple selection use $bind on option\n setStateValue(component, name || e.target.name, e.target.value);\n }\n }\n } else if (tag === 'option') {\n props['selected'] = getStateValue(component, name);\n props['onclick'] = e => setStateValue(component, name || e.target.name, e.target.selected);\n } else if (tag === 'textarea') {\n props['innerHTML'] = getStateValue(component, name);\n props['oninput'] = e => setStateValue(component, name || e.target.name, e.target.value);\n }\n } else {\n app.run('$', { key, tag, props, component });\n }\n}\n\nconst directive = (vdom, component) => {\n if (Array.isArray(vdom)) {\n return vdom.map(element => directive(element, component));\n } else {\n let { tag, props, children } = vdom;\n if (tag) {\n if (props) Object.keys(props).forEach(key => {\n if (key.startsWith('$')) {\n apply_directive(key, props, tag, component);\n delete props[key];\n }\n });\n if (children) children = directive(children, component);\n return { tag, props, children };\n } else {\n return vdom;\n }\n }\n}\n\nexport default directive;","\r\nimport app, { App } from './app';\r\nimport { Reflect } from './decorator'\r\nimport { View, Update, ActionDef, ActionOptions, MountOptions } from './types';\r\nimport directive from './directive';\r\n\r\nconst componentCache = new Map();\r\napp.on('get-components', o => o.components = componentCache);\r\n\r\nconst REFRESH = state => state;\r\n\r\nexport class Component<T = any, E = any> {\r\n static __isAppRunComponent = true;\r\n private _app = new App();\r\n private _actions = [];\r\n private _global_events = [];\r\n private _state;\r\n private _history = [];\r\n private _history_idx = -1;\r\n private enable_history;\r\n private global_event;\r\n public element;\r\n public rendered;\r\n public mounted;\r\n public unload;\r\n private tracking_id;\r\n private observer;\r\n\r\n\r\n private renderState(state: T, vdom = null) {\r\n if (!this.view) return;\r\n let html = vdom || this.view(state);\r\n app['debug'] && app.run('debug', {\r\n component: this,\r\n _: html ? '.' : '-',\r\n state,\r\n vdom: html,\r\n el: this.element\r\n });\r\n\r\n if (typeof document !== 'object') return;\r\n\r\n const el = (typeof this.element === 'string') ?\r\n document.getElementById(this.element) : this.element;\r\n\r\n if (el) {\r\n const tracking_attr = '_c';\r\n if (!this.unload) {\r\n el.removeAttribute && el.removeAttribute(tracking_attr);\r\n } else if (el['_component'] !== this || el.getAttribute(tracking_attr) !== this.tracking_id) {\r\n this.tracking_id = new Date().valueOf().toString();\r\n el.setAttribute(tracking_attr, this.tracking_id);\r\n if (typeof MutationObserver !== 'undefined') {\r\n if (!this.observer) this.observer = new MutationObserver(changes => {\r\n if (changes[0].oldValue === this.tracking_id || !document.body.contains(el)) {\r\n this.unload(this.state);\r\n this.observer.disconnect();\r\n this.observer = null;\r\n }\r\n });\r\n this.observer.observe(document.body, {\r\n childList: true, subtree: true,\r\n attributes: true, attributeOldValue: true, attributeFilter: [tracking_attr]\r\n });\r\n }\r\n }\r\n el['_component'] = this;\r\n }\r\n if (!vdom && html) {\r\n html = directive(html, this);\r\n app.render(el, html, this);\r\n }\r\n this.rendered && this.rendered(this.state);\r\n }\r\n\r\n public setState(state: T, options: ActionOptions\r\n = { render: true, history: false }) {\r\n if (state instanceof Promise) {\r\n // Promise will not be saved or rendered\r\n // state will be saved and rendered when promise is resolved\r\n // Wait for previous promise to complete first\r\n Promise.all([state, this._state]).then(v => {\r\n if (v[0]) this.setState(v[0]);\r\n }).catch(err => {\r\n console.error(err);\r\n throw err;\r\n });\r\n this._state = state;\r\n } else {\r\n this._state = state;\r\n if (state == null) return;\r\n this.state = state;\r\n if (options.render !== false) this.renderState(state);\r\n if (options.history !== false && this.enable_history) {\r\n this._history = [...this._history, state];\r\n this._history_idx = this._history.length - 1;\r\n }\r\n if (typeof options.callback === 'function') options.callback(this.state);\r\n }\r\n }\r\n\r\n private _history_prev = () => {\r\n this._history_idx--;\r\n if (this._history_idx >= 0) {\r\n this.setState(this._history[this._history_idx], { render: true, history: false });\r\n }\r\n else {\r\n this._history_idx = 0;\r\n }\r\n };\r\n\r\n private _history_next = () => {\r\n this._history_idx++;\r\n if (this._history_idx < this._history.length) {\r\n this.setState(this._history[this._history_idx], { render: true, history: false });\r\n }\r\n else {\r\n this._history_idx = this._history.length - 1;\r\n }\r\n };\r\n\r\n constructor(\r\n protected state?: T,\r\n protected view?: View<T>,\r\n protected update?: Update<T, E>,\r\n protected options?) {\r\n }\r\n\r\n start = (element = null, options?: MountOptions): Component<T, E> => {\r\n return this.mount(element, { ...options, render: true });\r\n }\r\n\r\n public mount(element = null, options?: MountOptions): Component<T, E> {\r\n console.assert(!this.element, 'Component already mounted.')\r\n this.options = options = { ...this.options, ...options };\r\n this.element = element;\r\n this.global_event = options.global_event;\r\n this.enable_history = !!options.history;\r\n\r\n if (this.enable_history) {\r\n this.on(options.history.prev || 'history-prev', this._history_prev);\r\n this.on(options.history.next || 'history-next', this._history_next);\r\n }\r\n\r\n if (options.route) {\r\n this.update = this.update || {};\r\n this.update[options.route] = REFRESH;\r\n }\r\n\r\n this.add_actions();\r\n this.state = this.state ?? this['model'] ?? {};\r\n if (typeof this.state === 'function') this.state = this.state();\r\n if (options.render) {\r\n this.setState(this.state, { render: true, history: true });\r\n } else {\r\n this.setState(this.state, { render: false, history: true });\r\n }\r\n if (app['debug']) {\r\n if (componentCache.get(element)) { componentCache.get(element).push(this) }\r\n else { componentCache.set(element, [this])}\r\n }\r\n return this;\r\n }\r\n\r\n is_global_event(name: string): boolean {\r\n return name && (\r\n this.global_event ||\r\n this._global_events.indexOf(name) >= 0 ||\r\n name.startsWith('#') || name.startsWith('/') || name.startsWith('@'));\r\n }\r\n\r\n add_action(name: string, action, options: ActionOptions = {}) {\r\n if (!action || typeof action !== 'function') return;\r\n if (options.global) this._global_events.push(name);\r\n this.on(name as any, (...p) => {\r\n\r\n app['debug'] && app.run('debug', {\r\n component: this,\r\n _: '>',\r\n event: name, p,\r\n current_state: this.state,\r\n options\r\n });\r\n\r\n const newState = action(this.state, ...p);\r\n\r\n app['debug'] && app.run('debug', {\r\n component: this,\r\n _: '<',\r\n event: name, p,\r\n newState,\r\n state: this.state,\r\n options\r\n });\r\n\r\n this.setState(newState, options)\r\n }, options);\r\n }\r\n\r\n add_actions() {\r\n const actions = this.update || {};\r\n Reflect.getMetadataKeys(this).forEach(key => {\r\n if (key.startsWith('apprun-update:')) {\r\n const meta = Reflect.getMetadata(key, this)\r\n actions[meta.name] = [this[meta.key].bind(this), meta.options];\r\n }\r\n })\r\n\r\n const all = {};\r\n if (Array.isArray(actions)) {\r\n actions.forEach(act => {\r\n const [name, action, opts] = act as ActionDef<T, E>;\r\n const names = name.toString();\r\n names.split(',').forEach(n => all[n.trim()] = [action, opts])\r\n })\r\n } else {\r\n Object.keys(actions).forEach(name => {\r\n const action = actions[name];\r\n if (typeof action === 'function' || Array.isArray(action)) {\r\n name.split(',').forEach(n => all[n.trim()] = action)\r\n }\r\n })\r\n }\r\n\r\n if (!all['.']) all['.'] = REFRESH;\r\n Object.keys(all).forEach(name => {\r\n const action = all[name];\r\n if (typeof action === 'function') {\r\n this.add_action(name, action);\r\n } else if (Array.isArray(action)) {\r\n this.add_action(name, action[0], action[1]);\r\n }\r\n });\r\n }\r\n\r\n public run(event: E, ...args) {\r\n const name = event.toString();\r\n return this.is_global_event(name) ?\r\n app.run(name, ...args) :\r\n this._app.run(name, ...args);\r\n }\r\n\r\n public on(event: E, fn: (...args) => void, options?: any) {\r\n const name = event.toString();\r\n this._actions.push({ name, fn });\r\n return this.is_global_event(name) ?\r\n app.on(name, fn, options) :\r\n this._app.on(name, fn, options);\r\n }\r\n\r\n public unmount() {\r\n this.observer?.disconnect();\r\n this._actions.forEach(action => {\r\n const { name, fn } = action;\r\n this.is_global_event(name) ?\r\n app.off(name, fn) :\r\n this._app.off(name, fn);\r\n });\r\n }\r\n}\r\n","import app from './app';\n\nexport type Route = (url: string, ...args: any[]) => any;\n\nexport const ROUTER_EVENT: string = '//';\nexport const ROUTER_404_EVENT: string = '///';\n\nexport const route: Route = (url: string) => {\n if (!url) url = '#';\n if (url.startsWith('#')) {\n const [name, ...rest] = url.split('/');\n app.run(name, ...rest) || app.run(ROUTER_404_EVENT, name, ...rest);\n app.run(ROUTER_EVENT, name, ...rest);\n } else if (url.startsWith('/')) {\n const [_, name, ...rest] = url.split('/');\n app.run('/' + name, ...rest) || app.run(ROUTER_404_EVENT, '/' + name, ...rest);\n app.run(ROUTER_EVENT, '/' + name, ...rest);\n } else {\n app.run(url) || app.run(ROUTER_404_EVENT, url);\n app.run(ROUTER_EVENT, url);\n }\n}\nexport default route;","import app from './app';\nimport { createElement, render, Fragment } from './vdom';\nimport { Component } from './component';\nimport { VNode, View, Action, Update, EventOptions, ActionOptions, MountOptions, AppStartOptions } from './types';\nimport { on, update, customElement } from './decorator';\nimport webComponent, { CustomElementOptions } from './web-component';\nimport { Route, route, ROUTER_EVENT, ROUTER_404_EVENT } from './router';\n\nexport interface IApp {\n start<T, E = any>(element?: Element | string, model?: T, view?: View<T>, update?: Update<T, E>,\n options?: AppStartOptions<T>): Component<T, E>;\n on(name: string, fn: (...args: any[]) => void, options?: any): void;\n off(name: string, fn: (...args: any[]) => void): void;\n run(name: string, ...args: any[]): number;\n h(tag: string | Function, props, ...children): VNode | VNode[];\n createElement(tag: string | Function, props, ...children): VNode | VNode[];\n render(element: HTMLElement, node: VNode): void;\n Fragment(props, ...children): any[];\n route?: Route;\n webComponent(name: string, componentClass, options?: CustomElementOptions): void;\n}\n\napp.h = app.createElement = createElement;\napp.render = render;\napp.Fragment = Fragment;\napp.webComponent = webComponent;\n\napp.start = <T, E = any>(element?: Element, model?: T, view?: View<T>, update?: Update<T, E>,\n options?: AppStartOptions<T>): Component<T, E> => {\n const opts = { ...options, render: true, global_event: true };\n const component = new Component<T, E>(model, view, update);\n if (options && options.rendered) component.rendered = options.rendered;\n component.mount(element, opts);\n return component;\n};\n\nconst NOOP = _ => {/* Intentionally empty */ }\napp.on('$', NOOP);\napp.on('debug', _ => NOOP);\napp.on(ROUTER_EVENT, NOOP);\napp.on('#', NOOP);\napp['route'] = route;\napp.on('route', url => app['route'] && app['route'](url));\n\nif (typeof document === 'object') {\n document.addEventListener(\"DOMContentLoaded\", () => {\n if (app['route'] === route) {\n window.onpopstate = () => route(location.hash);\n if (!document.body.hasAttribute('apprun-no-init')) route(location.hash);\n }\n });\n}\n\nexport type StatelessComponent<T = {}> = (args: T) => string | VNode | void;\nexport { app, Component, View, Action, Update, on, update, EventOptions, ActionOptions, MountOptions, Fragment }\nexport { update as event };\nexport { ROUTER_EVENT, ROUTER_404_EVENT };\nexport { customElement, CustomElementOptions, AppStartOptions };\nexport default app as IApp;\n\nif (typeof window === 'object') {\n window['Component'] = Component;\n window['React'] = app;\n window['on'] = on;\n window['customElement'] = customElement;\n}\n\n\n","import { createElement, updateElement, Fragment } from './vdom-my';\nexport function render(element, html, parent?) {\n updateElement(element, html, parent);\n}\nexport { createElement, 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\nimport {Part} from './part.js';\n\nconst directives = new WeakMap<object, true>();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DirectiveFactory = (...args: any[]) => object;\n\nexport type DirectiveFn = (part: Part) => void;\n\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = <F extends DirectiveFactory>(f: F): F =>\n ((...args: unknown[]) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n }) as F;\n\nexport const isDirective = (o: unknown): o is DirectiveFn => {\n return typeof o === 'function' && directives.has(o);\n};\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\ninterface MaybePolyfilledCe extends CustomElementRegistry {\n readonly polyfillWrapFlushCallback?: object;\n}\n\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n (window.customElements as MaybePolyfilledCe).polyfillWrapFlushCallback !==\n undefined;\n\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes =\n (container: Node,\n start: Node|null,\n end: Node|null = null,\n before: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.insertBefore(start!, before);\n start = n;\n }\n };\n\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes =\n (container: Node, start: Node|null, end: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.removeChild(start!);\n start = n;\n }\n };\n","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * 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 {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 {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 {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\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\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.4.1');\n}\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n */\nexport const html = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new TemplateResult(strings, values, 'html', defaultTemplateProcessor);\n\n/**\n * Interprets a template literal as an SVG template that can efficiently\n * render to and update a container.\n */\nexport const svg = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new SVGTemplateResult(strings, values, 'svg', defaultTemplateProcessor);\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isPrimitive} from '../lib/parts.js';\nimport {directive, NodePart, Part} from '../lit-html.js';\n\ninterface PreviousValue {\n readonly value: unknown;\n readonly fragment: DocumentFragment;\n}\n\n// For each part, remember the value that was last rendered to the part by the\n// unsafeHTML directive, and the DocumentFragment that was last set as a value.\n// The DocumentFragment is used as a unique key to check if the last value\n// rendered to the part was with unsafeHTML. If not, we'll always re-render the\n// value passed to unsafeHTML.\nconst previousValues = new WeakMap<NodePart, PreviousValue>();\n\n/**\n * Renders the result as HTML, rather than text.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeHTML = directive((value: unknown) => (part: Part): void => {\n if (!(part instanceof NodePart)) {\n throw new Error('unsafeHTML can only be used in text bindings');\n }\n\n const previousValue = previousValues.get(part);\n\n if (previousValue !== undefined && isPrimitive(value) &&\n value === previousValue.value && part.value === previousValue.fragment) {\n return;\n }\n\n const template = document.createElement('template');\n template.innerHTML = value as string; // innerHTML casts to string internally\n const fragment = document.importNode(template.content, true);\n part.setValue(fragment);\n previousValues.set(part, {value, fragment});\n});\n","import { createElement, updateElement, Fragment } from './vdom-my';\nimport { html, render, TemplateResult, svg, directive, EventPart, parts } from 'lit-html';\nimport { unsafeHTML } from \"lit-html/directives/unsafe-html\";\n\nfunction _render(element, vdom, parent?) {\n if (typeof vdom === 'string') {\n render(html`${unsafeHTML(vdom)}`, element);\n } else if (vdom instanceof TemplateResult) {\n render(vdom, element);\n } else {\n updateElement(element, vdom, parent);\n parts.delete(element);\n }\n}\n\nconst run = directive((event, ...args) => (part) => {\n if (!(part instanceof EventPart)) {\n throw new Error('${run} can only be used in event handlers');\n }\n let { element, eventName } = part;\n const getComponent = () => {\n let component = element['_component'];\n while (!component && element) {\n element = element.parentElement;\n component = element && element['_component'];\n }\n console.assert(!!component, 'Component not found.');\n return component;\n }\n if (typeof event === 'string') {\n element[`on${eventName}`] = e => getComponent().run(event, ...args, e);\n } else if (typeof event === 'function') {\n element[`on${eventName}`] = e => getComponent().setState(event(getComponent().state, ...args, e));\n }\n});\n\nexport { createElement, Fragment, html, svg, _render as render, run };\n\n","import app from './apprun'\nexport {\n app, Component, View, Action, Update, on, update, event, EventOptions,\n customElement, CustomElementOptions,\n ROUTER_404_EVENT, ROUTER_EVENT\n} from './apprun'\nimport { createElement, render, Fragment, html, svg, run } from './vdom-lit-html';\nexport { html, svg, render, run }\n\napp.createElement = createElement;\napp.render = render;\napp.Fragment = Fragment;\n\nexport default app;\n\nif (typeof window === 'object') {\n window['html'] = html;\n window['svg'] = svg;\n window['run'] = run;\n}\n"],"names":["App","[object Object]","this","_events","name","fn","options","push","subscribers","filter","sub","args","getSubscribers","console","assert","length","forEach","delay","Object","keys","apply","once","on","_t","clearTimeout","setTimeout","promises","map","Promise","all","events","evt","endsWith","startsWith","replace","sort","a","b","event","app","root","self","global","Fragment","props","children","collect","ch","c","Array","isArray","i","createElement","tag","undefined","getPrototypeOf","__isAppRunComponent","Error","keyCache","WeakMap","updateElement","element","nodes","parent","createComponent","isSvg","nodeName","updateChildren","update","node","el","key1","key2","toUpperCase","same","parentNode","replaceChild","create","updateProps","old_len","childNodes","new_len","len","Math","min","child","textContent","nodeType","nodeValue","createText","HTMLElement","SVGElement","insertBefore","key","old","temp","nextSibling","appendChild","n","removeChild","lastChild","d","document","createDocumentFragment","indexOf","div","insertAdjacentHTML","substring","createTextNode","JSON","stringify","createElementNS","cached","oldProps","newProps","p","mergeProps","value","cname","match","dataset","style","cssText","s","xname","toLowerCase","removeAttributeNS","setAttributeNS","setAttribute","removeAttribute","test","getAttribute","window","requestAnimationFrame","idx","vdom","id","Date","now","asTag","__componentCache","component","start","mounted","new_state","state","setState","render_component","new_parent","_component","customElement","componentClass","super","observedAttributes","attr","isConnected","opts","_shadowRoot","shadow","attachShadow","mode","attrMap","reduce","lc","_attrMap","from","attributes","item","defineProperty","get","attributeChangedCallback","configurable","enumerable","parentElement","mount","_props","dispatchEvent","bind","run","render","unload","unmount","oldValue","mappedName","customElements","define","Reflect","meta","metadataKey","metadataValue","target","has","set","descriptor","toString","defineMetadata","constructor","webComponent","getStateValue","setStateValue","directive","e","handler","type","checked","Number","multiple","selected","apply_directive","componentCache","Map","o","components","REFRESH","Component","view","_history_idx","_history","history","html","_","getElementById","tracking_attr","tracking_id","valueOf","MutationObserver","observer","changes","body","contains","disconnect","observe","childList","subtree","attributeOldValue","attributeFilter","rendered","_state","then","v","catch","err","error","renderState","enable_history","callback","global_event","prev","_history_prev","next","_history_next","route","add_actions","_global_events","action","current_state","newState","actions","getMetadataKeys","getMetadata","act","split","trim","add_action","is_global_event","_app","_actions","off","ROUTER_EVENT","ROUTER_404_EVENT","url","rest","h","model","NOOP","addEventListener","onpopstate","location","hash","hasAttribute","directives","f","isDirective","isCEPolyfill","polyfillWrapFlushCallback","removeNodes","container","end","noChange","nothing","marker","String","random","slice","nodeMarker","markerRegex","RegExp","Template","result","nodesToRemove","stack","walker","createTreeWalker","content","lastPartIndex","index","partIndex","strings","values","nextNode","hasAttributes","count","stringForPart","lastAttributeNameRegex","exec","attributeLookupName","attributeValue","statics","parts","tagName","currentNode","data","lastIndex","insert","createMarker","previousSibling","pop","str","suffix","isTemplatePartActive","part","createComment","TemplateInstance","template","processor","__parts","setValue","commit","fragment","cloneNode","importNode","nodeIndex","handleTextExpression","insertAfterNode","handleAttributeExpressions","adoptNode","upgrade","policy","trustedTypes","createPolicy","createHTML","commentMarker","TemplateResult","l","isCommentBinding","commentOpen","lastIndexOf","attributeMatch","substr","getHTML","innerHTML","SVGTemplateResult","getTemplateElement","svgElement","firstChild","before","reparentNodes","isPrimitive","isIterable","Symbol","iterator","AttributeCommitter","_createPart","AttributePart","text","t","dirty","_getValue","committer","NodePart","startNode","endNode","ref","__insert","__pendingValue","__commitText","__commitTemplateResult","Node","__commitNode","__commitIterable","clear","valueAsString","templateFactory","instance","_clone","itemParts","itemPart","appendIntoPart","insertAfterPart","BooleanAttributePart","PropertyCommitter","single","PropertyPart","eventOptionsSupported","capture","removeEventListener","_e","EventPart","eventName","eventContext","__boundHandleEvent","handleEvent","newListener","oldListener","shouldRemoveListener","passive","shouldAddListener","__options","getOptions","call","defaultTemplateProcessor","prefix","templateCache","templateCaches","stringsArray","keyString","join","appendInto","svg","previousValues","unsafeHTML","previousValue","_render","delete","getComponent"],"mappings":"MACaA,EAWXC,cACEC,KAAKC,QAAU,GAGjBF,GAAGG,EAAcC,EAAuBC,EAAwB,IAC9DJ,KAAKC,QAAQC,GAAQF,KAAKC,QAAQC,IAAS,GAC3CF,KAAKC,QAAQC,GAAMG,KAAK,CAAEF,GAAAA,EAAIC,QAAAA,IAGhCL,IAAIG,EAAcC,GAChB,MAAMG,EAAcN,KAAKC,QAAQC,IAAS,GAE1CF,KAAKC,QAAQC,GAAQI,EAAYC,QAAQC,GAAQA,EAAIL,KAAOA,IAG9DJ,KAAKG,GACH,OAAOF,KAAKC,QAAQC,GAGtBH,IAAIG,KAAiBO,GACnB,MAAMH,EAAcN,KAAKU,eAAeR,EAAMF,KAAKC,SAYnD,OAXAU,QAAQC,OAAON,GAAeA,EAAYO,OAAS,EAAG,4BAA8BX,GACpFI,EAAYQ,SAASN,IACnB,MAAML,GAAEA,EAAEC,QAAEA,GAAYI,EAMxB,OALIJ,EAAQW,MACVf,KAAKe,MAAMb,EAAMC,EAAIM,EAAML,GAE3BY,OAAOC,KAAKb,GAASS,OAAS,EAAIV,EAAGe,MAAMlB,KAAM,IAAIS,EAAML,IAAYD,EAAGe,MAAM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,EAAYhF,EAAoB,WACpC,MAAQgF,GAAahF,GACnBA,EAAUA,EAAQgH,cAClBhC,EAAYhF,GAAWA,EAAoB,WAG7C,OADAhD,QAAQC,SAAS+H,EAAW,wBACrBA,GAEY,iBAAVvG,EACTuB,EAAQ,KAAK2V,KAAe/M,GAAKyO,IAAehQ,IAAI5I,KAAU3B,EAAM8L,GAC1C,mBAAVnK,IAChBuB,EAAQ,KAAK2V,KAAe/M,GAAKyO,IAAehS,SAAS5G,EAAM4Y,IAAejS,SAAUtI,EAAM8L,QCvBlGlK,EAAIa,cAAgBA,EACpBb,EAAI4I,OAASA,GACb5I,EAAII,SAAWA,EAIO,iBAAXyF,SACTA,OAAa,KAAIuF,GACjBvF,OAAY,IAAIwS,GAChBxS,OAAY,IAAI8C"}
1
+ {"version":3,"file":"apprun-html.esm.js","sources":["../src/app.ts","../src/vdom-my.ts","../src/web-component.ts","../src/decorator.ts","../src/directive.ts","../src/component.ts","../src/router.ts","../src/apprun.ts","../src/vdom.ts","../node_modules/lit-html/src/lit-html.ts","../node_modules/lit-html/src/directive.ts","../node_modules/lit-html/src/directives/unsafe-html.ts","../src/vdom-lit-html.ts","../src/apprun-html.ts"],"sourcesContent":["import { EventOptions} from './types'\nexport class App {\n\n private _events: Object;\n\n public start;\n public h;\n public createElement;\n public render;\n public Fragment;\n public webComponent;\n\n constructor() {\n this._events = {};\n }\n\n on(name: string, fn: (...args) => void, options: EventOptions = {}): void {\n this._events[name] = this._events[name] || [];\n this._events[name].push({ fn, options });\n }\n\n off(name: string, fn: (...args) => void): void {\n const subscribers = this._events[name] || [];\n\n this._events[name] = subscribers.filter((sub) => sub.fn !== fn);\n }\n\n find(name: string): any {\n return this._events[name];\n }\n\n run(name: string, ...args): number {\n const subscribers = this.getSubscribers(name, this._events);\n console.assert(subscribers && subscribers.length > 0, 'No subscriber for event: ' + name);\n subscribers.forEach((sub) => {\n const { fn, options } = sub;\n if (options.delay) {\n this.delay(name, fn, args, options);\n } else {\n Object.keys(options).length > 0 ? fn.apply(this, [...args, options]) : fn.apply(this, args);\n }\n return !sub.options.once;\n });\n\n return subscribers.length;\n }\n\n once(name: string, fn, options: EventOptions = {}): void {\n this.on(name, fn, { ...options, once: true });\n }\n\n private delay(name, fn, args, options): void {\n if (options._t) clearTimeout(options._t);\n options._t = setTimeout(() => {\n clearTimeout(options._t);\n Object.keys(options).length > 0 ? fn.apply(this, [...args, options]) : fn.apply(this, args);\n }, options.delay);\n }\n\n query(name: string, ...args): Promise<any[]> {\n const subscribers = this.getSubscribers(name, this._events);\n console.assert(subscribers && subscribers.length > 0, 'No subscriber for event: ' + name);\n const promises = subscribers.map(sub => {\n const { fn, options } = sub;\n return Object.keys(options).length > 0 ? fn.apply(this, [...args, options]) : fn.apply(this, args);\n });\n return Promise.all(promises);\n }\n\n private getSubscribers(name: string, events) {\n const subscribers = events[name] || [];\n\n // Update the list of subscribers by pulling out those which will run once.\n // We must do this update prior to running any of the events in case they\n // cause additional events to be turned off or on.\n events[name] = subscribers.filter((sub) => {\n return !sub.options.once;\n });\n Object.keys(events).filter(evt => evt.endsWith('*') && name.startsWith(evt.replace('*', '')))\n .sort((a, b) => b.length - a.length)\n .forEach(evt => subscribers.push(...events[evt].map(sub => ({\n ...sub,\n options: { ...sub.options, event: name }\n }))));\n return subscribers;\n }\n}\n\nconst AppRunVersions = 'AppRun-3';\nlet app: App;\nconst root = (typeof self === 'object' && self.self === self && self) ||\n (typeof global === 'object' && global.global === global && global)\nif (root['app'] && root['_AppRunVersions']) {\n app = root['app'];\n} else {\n app = new App();\n root['app'] = app;\n root['_AppRunVersions'] = AppRunVersions;\n}\nexport default app;\n","import { VDOM, VNode } from './types';\nexport type Element = any; //HTMLElement | SVGSVGElement | SVGElement;\n\nexport function Fragment(props, ...children): any[] {\n return collect(children);\n}\n\nconst ATTR_PROPS = '_props';\n\nfunction collect(children) {\n const ch = [];\n const push = (c) => {\n if (c !== null && c !== undefined && c !== '' && c !== false) {\n ch.push((typeof c === 'function' || typeof c === 'object') ? c : `${c}`);\n }\n }\n children && children.forEach(c => {\n if (Array.isArray(c)) {\n c.forEach(i => push(i));\n } else {\n push(c);\n }\n });\n return ch;\n}\n\nexport function createElement(tag: string | Function | [], props?: {}, ...children) {\n const ch = collect(children);\n if (typeof tag === 'string') return { tag, props, children: ch };\n else if (Array.isArray(tag)) return tag; // JSX fragments - babel\n else if (tag === undefined && children) return ch; // JSX fragments - typescript\n else if (Object.getPrototypeOf(tag).__isAppRunComponent) return { tag, props, children: ch } // createComponent(tag, { ...props, children });\n else if (typeof tag === 'function') return tag(props, ch);\n else throw new Error(`Unknown tag in vdom ${tag}`);\n};\n\nconst keyCache = new WeakMap();\n\nexport const updateElement = render;\n\nexport function render(element: Element, nodes: VDOM, parent = {}) {\n // console.log('render', element, node);\n // tslint:disable-next-line\n if (nodes == null || nodes === false) return;\n\n nodes = createComponent(nodes, parent);\n\n const isSvg = element?.nodeName === \"SVG\";\n\n if (!element) return;\n if (Array.isArray(nodes)) {\n updateChildren(element, nodes, isSvg);\n } else {\n updateChildren(element, [nodes], isSvg);\n }\n}\n\nfunction same(el: Element, node: VNode) {\n // if (!el || !node) return false;\n const key1 = el.nodeName;\n const key2 = `${node.tag || ''}`;\n return key1.toUpperCase() === key2.toUpperCase();\n}\n\nfunction update(element: Element, node: VNode, isSvg: boolean) {\n if (node['_op'] === 3) return;\n // console.assert(!!element);\n isSvg = isSvg || node.tag === \"svg\";\n if (!same(element, node)) {\n element.parentNode.replaceChild(create(node, isSvg), element);\n return;\n }\n !(node['_op'] & 2) && updateChildren(element, node.children, isSvg);\n !(node['_op'] & 1) && updateProps(element, node.props, isSvg);\n}\n\nfunction updateChildren(element, children, isSvg: boolean) {\n const old_len = element.childNodes?.length || 0;\n const new_len = children?.length || 0;\n const len = Math.min(old_len, new_len);\n for (let i = 0; i < len; i++) {\n const child = children[i];\n if (child['_op'] === 3) continue;\n const el = element.childNodes[i];\n if (typeof child === 'string') {\n if (el.textContent !== child) {\n if (el.nodeType === 3) {\n el.nodeValue = child\n } else {\n element.replaceChild(createText(child), el);\n }\n }\n } else if (child instanceof HTMLElement || child instanceof SVGElement) {\n element.insertBefore(child, el);\n } else {\n const key = child.props && child.props['key'];\n if (key) {\n if (el.key === key) {\n update(element.childNodes[i], child, isSvg);\n } else {\n // console.log(el.key, key);\n const old = keyCache[key];\n if (old) {\n const temp = old.nextSibling;\n element.insertBefore(old, el);\n temp ? element.insertBefore(el, temp) : element.appendChild(el);\n update(element.childNodes[i], child, isSvg);\n } else {\n element.replaceChild(create(child, isSvg), el);\n }\n }\n } else {\n update(element.childNodes[i], child, isSvg);\n }\n }\n }\n\n let n = element.childNodes.length;\n while (n > len) {\n element.removeChild(element.lastChild);\n n--;\n }\n\n if (new_len > len) {\n const d = document.createDocumentFragment();\n for (let i = len; i < children.length; i++) {\n d.appendChild(create(children[i], isSvg));\n }\n element.appendChild(d);\n }\n}\n\nfunction createText(node) {\n if (node?.indexOf('_html:') === 0) { // ?\n const div = document.createElement('div');\n div.insertAdjacentHTML('afterbegin', node.substring(6))\n return div;\n } else {\n return document.createTextNode(node??'');\n }\n}\n\nfunction create(node: VNode | string | HTMLElement | SVGElement, isSvg: boolean): Element {\n // console.assert(node !== null && node !== undefined);\n if ((node instanceof HTMLElement) || (node instanceof SVGElement)) return node;\n if (typeof node === \"string\") return createText(node);\n if (!node.tag || (typeof node.tag === 'function')) return createText(JSON.stringify(node));\n isSvg = isSvg || node.tag === \"svg\";\n const element = isSvg\n ? document.createElementNS(\"http://www.w3.org/2000/svg\", node.tag)\n : document.createElement(node.tag);\n\n updateProps(element, node.props, isSvg);\n if (node.children) node.children.forEach(child => element.appendChild(create(child, isSvg)));\n return element\n}\n\nfunction mergeProps(oldProps: {}, newProps: {}): {} {\n newProps['class'] = newProps['class'] || newProps['className'];\n delete newProps['className'];\n const props = {};\n if (oldProps) Object.keys(oldProps).forEach(p => props[p] = null);\n if (newProps) Object.keys(newProps).forEach(p => props[p] = newProps[p]);\n return props;\n}\n\nexport function updateProps(element: Element, props: {}, isSvg) {\n // console.assert(!!element);\n const cached = element[ATTR_PROPS] || {};\n props = mergeProps(cached, props || {});\n element[ATTR_PROPS] = props;\n\n for (const name in props) {\n const value = props[name];\n // if (cached[name] === value) continue;\n // console.log('updateProps', name, value);\n if (name.startsWith('data-')) {\n const dname = name.substring(5);\n const cname = dname.replace(/-(\\w)/g, (match) => match[1].toUpperCase());\n if (element.dataset[cname] !== value) {\n if (value || value === \"\") element.dataset[cname] = value;\n else delete element.dataset[cname];\n }\n } else if (name === 'style') {\n if (element.style.cssText) element.style.cssText = '';\n if (typeof value === 'string') element.style.cssText = value;\n else {\n for (const s in value) {\n if (element.style[s] !== value[s]) element.style[s] = value[s];\n }\n }\n } else if (name.startsWith('xlink')) {\n const xname = name.replace('xlink', '').toLowerCase();\n if (value == null || value === false) {\n element.removeAttributeNS('http://www.w3.org/1999/xlink', xname);\n } else {\n element.setAttributeNS('http://www.w3.org/1999/xlink', xname, value);\n }\n } else if (name.startsWith('on')) {\n if (!value || typeof value === 'function') {\n element[name] = value;\n } else if (typeof value === 'string') {\n if (value) element.setAttribute(name, value);\n else element.removeAttribute(name);\n }\n } else if (/^id$|^class$|^list$|^readonly$|^contenteditable$|^role|-/g.test(name) || isSvg) {\n if (element.getAttribute(name) !== value) {\n if (value) element.setAttribute(name, value);\n else element.removeAttribute(name);\n }\n } else if (element[name] !== value) {\n element[name] = value;\n }\n if (name === 'key' && value) keyCache[value] = element;\n }\n if (props && typeof props['ref'] === 'function') {\n window.requestAnimationFrame(() => props['ref'](element));\n }\n}\n\nfunction render_component(node, parent, idx) {\n const { tag, props, children } = node;\n let key = `_${idx}`;\n let id = props && props['id'];\n if (!id) id = `_${idx}${Date.now()}`;\n else key = id;\n let asTag = 'section';\n if (props && props['as']) {\n asTag = props['as'];\n delete props['as'];\n }\n if (!parent.__componentCache) parent.__componentCache = {};\n let component = parent.__componentCache[key];\n if (!component || !(component instanceof tag) || !component.element) {\n const element = document.createElement(asTag);\n component = parent.__componentCache[key] = new tag({ ...props, children }).start(element);\n }\n if (component.mounted) {\n const new_state = component.mounted(props, children, component.state);\n (typeof new_state !== 'undefined') && component.setState(new_state);\n }\n updateProps(component.element, props, false);\n return component.element;\n}\n\nfunction createComponent(node, parent, idx = 0) {\n if (typeof node === 'string') return node;\n if (Array.isArray(node)) return node.map(child => createComponent(child, parent, idx++));\n let vdom = node;\n if (node && typeof node.tag === 'function' && Object.getPrototypeOf(node.tag).__isAppRunComponent) {\n vdom = render_component(node, parent, idx);\n }\n if (vdom && Array.isArray(vdom.children)) {\n const new_parent = vdom.props?._component;\n if (new_parent) {\n let i = 0;\n vdom.children = vdom.children.map(child => createComponent(child, new_parent, i++));\n } else {\n vdom.children = vdom.children.map(child => createComponent(child, parent, idx++));\n }\n }\n return vdom;\n}\n","declare var customElements;\n\nexport type CustomElementOptions = {\n render?: boolean;\n shadow?: boolean;\n history?: boolean;\n global_event?: boolean;\n observedAttributes?: string[];\n};\n\nexport const customElement = (componentClass, options: CustomElementOptions = {}) => class CustomElement extends HTMLElement {\n private _shadowRoot;\n private _component;\n private _attrMap: (arg0: string) => string;\n public on;\n public run;\n constructor() {\n super();\n }\n get component() { return this._component; }\n get state() { return this._component.state; }\n\n static get observedAttributes() {\n // attributes need to be set to lowercase in order to get observed\n return (options.observedAttributes || []).map(attr => attr.toLowerCase());\n }\n\n connectedCallback() {\n if (this.isConnected && !this._component) {\n const opts = options || {};\n this._shadowRoot = opts.shadow ? this.attachShadow({ mode: 'open' }) : this;\n const observedAttributes = (opts.observedAttributes || [])\n\n const attrMap = observedAttributes.reduce((map, name) => {\n const lc = name.toLowerCase()\n if (lc !== name) {\n map[lc] = name\n }\n return map\n }, {})\n this._attrMap = (name: string) : string => attrMap[name] || name\n\n const props = {};\n Array.from(this.attributes).forEach(item => props[this._attrMap(item.name)] = item.value);\n\n // add getters/ setters to allow observation on observedAttributes\n observedAttributes.forEach(name => {\n if (this[name] !== undefined) props[name] = this[name];\n Object.defineProperty(this, name, {\n get(): any {\n return props[name];\n },\n set(this: CustomElement, value: unknown) {\n // trigger change event\n this.attributeChangedCallback(name, props[name], value)\n },\n configurable: true,\n enumerable: true\n });\n })\n\n const children = this.children ? Array.from(this.children) : [];\n children.forEach(el => el.parentElement.removeChild(el));\n this._component = new componentClass({ ...props, children }).mount(this._shadowRoot, opts);\n // attach props to component\n this._component._props = props;\n // expose dispatchEvent\n this._component.dispatchEvent = this.dispatchEvent.bind(this)\n if (this._component.mounted) {\n const new_state = this._component.mounted(props, children, this._component.state);\n if (typeof new_state !== 'undefined') this._component.state = new_state;\n }\n this.on = this._component.on.bind(this._component);\n this.run = this._component.run.bind(this._component);\n if (!(opts.render===false)) this._component.run('.');\n }\n }\n\n disconnectedCallback() {\n this._component?.unload?.();\n this._component?.unmount?.();\n this._component = null;\n }\n\n attributeChangedCallback(name: string, oldValue: unknown, value: unknown) {\n if (this._component) {\n // camelCase attributes arrive only in lowercase\n const mappedName = this._attrMap(name);\n // store the new property/ attribute\n this._component._props[mappedName] = value;\n this._component.run('attributeChanged', mappedName, oldValue, value);\n\n if (value !== oldValue && !(options.render === false)) {\n window.requestAnimationFrame(() => {\n // re-render state with new combined props on next animation frame\n this._component.run('.')\n })\n }\n }\n }\n}\n\nexport default (name: string, componentClass, options?: CustomElementOptions) => {\n (typeof customElements !== 'undefined') && customElements.define(name, customElement(componentClass, options))\n}\n","import webComponent, { CustomElementOptions } from './web-component';\n\n// tslint:disable:no-invalid-this\nexport const Reflect = {\n\n meta: new WeakMap(),\n\n defineMetadata(metadataKey, metadataValue, target) {\n if (!this.meta.has(target)) this.meta.set(target, {});\n this.meta.get(target)[metadataKey] = metadataValue;\n },\n\n getMetadataKeys(target) {\n target = Object.getPrototypeOf(target);\n return this.meta.get(target) ? Object.keys(this.meta.get(target)) : [];\n },\n\n getMetadata(metadataKey, target) {\n target = Object.getPrototypeOf(target);\n return this.meta.get(target) ? this.meta.get(target)[metadataKey] : null;\n }\n}\n\nexport function update<E=string>(events?: E, options: any = {}) {\n return (target: any, key: string, descriptor: any) => {\n const name = events ? events.toString() : key;\n Reflect.defineMetadata(`apprun-update:${name}`,\n { name, key, options }, target);\n return descriptor;\n }\n}\n\nexport function on<E = string>(events?: E, options: any = {}) {\n return function (target: any, key: string) {\n const name = events ? events.toString() : key;\n Reflect.defineMetadata(`apprun-update:${name}`,\n { name, key, options }, target)\n }\n}\n\nexport function customElement(name: string, options?: CustomElementOptions) {\n return function _customElement<T extends { new(...args: any[]): {} }>(constructor: T) {\n webComponent(name, constructor, options);\n return constructor;\n }\n}\n\n","import app from './app';\n\nconst getStateValue = (component, name) => {\n return (name ? component['state'][name] : component['state']) || '';\n}\n\nconst setStateValue = (component, name, value) => {\n if (name) {\n const state = component['state'] || {};\n state[name] = value;\n component.setState(state);\n } else {\n component.setState(value);\n }\n}\n\nconst apply_directive = (key: string, props: {}, tag, component) => {\n if (key.startsWith('$on')) {\n const event = props[key];\n key = key.substring(1)\n if (typeof event === 'boolean') {\n props[key] = e => component.run(key, e);\n } else if (typeof event === 'string') {\n props[key] = e => component.run(event, e);\n } else if (typeof event === 'function') {\n props[key] = e => component.setState(event(component.state, e));\n } else if (Array.isArray(event)) {\n const [handler, ...p] = event;\n if (typeof handler === 'string') {\n props[key] = e => component.run(handler, ...p, e);\n } else if (typeof handler === 'function') {\n props[key] = e => component.setState(handler(component.state, ...p, e));\n }\n }\n\n } else if (key === '$bind') {\n const type = props['type'] || 'text';\n const name = typeof props[key] === 'string' ? props[key] : props['name'];\n if (tag === 'input') {\n switch (type) {\n case 'checkbox':\n props['checked'] = getStateValue(component, name);\n props['onclick'] = e => setStateValue(component, name || e.target.name, e.target.checked);\n break;\n case 'radio':\n props['checked'] = getStateValue(component, name) === props['value'];\n props['onclick'] = e => setStateValue(component, name || e.target.name, e.target.value);\n break;\n case 'number':\n case 'range':\n props['value'] = getStateValue(component, name);\n props['oninput'] = e => setStateValue(component, name || e.target.name, Number(e.target.value));\n break;\n default:\n props['value'] = getStateValue(component, name);\n props['oninput'] = e => setStateValue(component, name || e.target.name, e.target.value);\n }\n } else if (tag === 'select') {\n props['value'] = getStateValue(component, name);\n props['onchange'] = e => {\n if (!e.target.multiple) { // multiple selection use $bind on option\n setStateValue(component, name || e.target.name, e.target.value);\n }\n }\n } else if (tag === 'option') {\n props['selected'] = getStateValue(component, name);\n props['onclick'] = e => setStateValue(component, name || e.target.name, e.target.selected);\n } else if (tag === 'textarea') {\n props['innerHTML'] = getStateValue(component, name);\n props['oninput'] = e => setStateValue(component, name || e.target.name, e.target.value);\n }\n } else {\n app.run('$', { key, tag, props, component });\n }\n}\n\nconst directive = (vdom, component) => {\n if (Array.isArray(vdom)) {\n return vdom.map(element => directive(element, component));\n } else {\n let { tag, props, children } = vdom;\n if (tag) {\n if (props) Object.keys(props).forEach(key => {\n if (key.startsWith('$')) {\n apply_directive(key, props, tag, component);\n delete props[key];\n }\n });\n if (children) children = directive(children, component);\n return { tag, props, children };\n } else {\n return vdom;\n }\n }\n}\n\nexport default directive;","\r\nimport app, { App } from './app';\r\nimport { Reflect } from './decorator'\r\nimport { View, Update, ActionDef, ActionOptions, MountOptions } from './types';\r\nimport directive from './directive';\r\n\r\nconst componentCache = new Map();\r\napp.on('get-components', o => o.components = componentCache);\r\n\r\nconst REFRESH = state => state;\r\n\r\nexport class Component<T = any, E = any> {\r\n static __isAppRunComponent = true;\r\n private _app = new App();\r\n private _actions = [];\r\n private _global_events = [];\r\n private _state;\r\n private _history = [];\r\n private _history_idx = -1;\r\n private enable_history;\r\n private global_event;\r\n public element;\r\n public rendered;\r\n public mounted;\r\n public unload;\r\n private tracking_id;\r\n private observer;\r\n\r\n\r\n private renderState(state: T, vdom = null) {\r\n if (!this.view) return;\r\n let html = vdom || this.view(state);\r\n app['debug'] && app.run('debug', {\r\n component: this,\r\n _: html ? '.' : '-',\r\n state,\r\n vdom: html,\r\n el: this.element\r\n });\r\n\r\n if (typeof document !== 'object') return;\r\n\r\n const el = (typeof this.element === 'string') ?\r\n document.getElementById(this.element) : this.element;\r\n\r\n if (el) {\r\n const tracking_attr = '_c';\r\n if (!this.unload) {\r\n el.removeAttribute && el.removeAttribute(tracking_attr);\r\n } else if (el['_component'] !== this || el.getAttribute(tracking_attr) !== this.tracking_id) {\r\n this.tracking_id = new Date().valueOf().toString();\r\n el.setAttribute(tracking_attr, this.tracking_id);\r\n if (typeof MutationObserver !== 'undefined') {\r\n if (!this.observer) this.observer = new MutationObserver(changes => {\r\n if (changes[0].oldValue === this.tracking_id || !document.body.contains(el)) {\r\n this.unload(this.state);\r\n this.observer.disconnect();\r\n this.observer = null;\r\n }\r\n });\r\n this.observer.observe(document.body, {\r\n childList: true, subtree: true,\r\n attributes: true, attributeOldValue: true, attributeFilter: [tracking_attr]\r\n });\r\n }\r\n }\r\n el['_component'] = this;\r\n }\r\n if (!vdom && html) {\r\n html = directive(html, this);\r\n app.render(el, html, this);\r\n }\r\n this.rendered && this.rendered(this.state);\r\n }\r\n\r\n public setState(state: T, options: ActionOptions\r\n = { render: true, history: false }) {\r\n if (state instanceof Promise) {\r\n // Promise will not be saved or rendered\r\n // state will be saved and rendered when promise is resolved\r\n // Wait for previous promise to complete first\r\n Promise.all([state, this._state]).then(v => {\r\n if (v[0]) this.setState(v[0]);\r\n }).catch(err => {\r\n console.error(err);\r\n throw err;\r\n });\r\n this._state = state;\r\n } else {\r\n this._state = state;\r\n if (state == null) return;\r\n this.state = state;\r\n if (options.render !== false) this.renderState(state);\r\n if (options.history !== false && this.enable_history) {\r\n this._history = [...this._history, state];\r\n this._history_idx = this._history.length - 1;\r\n }\r\n if (typeof options.callback === 'function') options.callback(this.state);\r\n }\r\n }\r\n\r\n private _history_prev = () => {\r\n this._history_idx--;\r\n if (this._history_idx >= 0) {\r\n this.setState(this._history[this._history_idx], { render: true, history: false });\r\n }\r\n else {\r\n this._history_idx = 0;\r\n }\r\n };\r\n\r\n private _history_next = () => {\r\n this._history_idx++;\r\n if (this._history_idx < this._history.length) {\r\n this.setState(this._history[this._history_idx], { render: true, history: false });\r\n }\r\n else {\r\n this._history_idx = this._history.length - 1;\r\n }\r\n };\r\n\r\n constructor(\r\n protected state?: T,\r\n protected view?: View<T>,\r\n protected update?: Update<T, E>,\r\n protected options?) {\r\n }\r\n\r\n start = (element = null, options?: MountOptions): Component<T, E> => {\r\n return this.mount(element, { render: true, ...options });\r\n }\r\n\r\n public mount(element = null, options?: MountOptions): Component<T, E> {\r\n console.assert(!this.element, 'Component already mounted.')\r\n this.options = options = { ...this.options, ...options };\r\n this.element = element;\r\n this.global_event = options.global_event;\r\n this.enable_history = !!options.history;\r\n\r\n if (this.enable_history) {\r\n this.on(options.history.prev || 'history-prev', this._history_prev);\r\n this.on(options.history.next || 'history-next', this._history_next);\r\n }\r\n\r\n if (options.route) {\r\n this.update = this.update || {};\r\n this.update[options.route] = REFRESH;\r\n }\r\n\r\n this.add_actions();\r\n this.state = this.state ?? this['model'] ?? {};\r\n if (typeof this.state === 'function') this.state = this.state();\r\n if (options.render) {\r\n this.setState(this.state, { render: true, history: true });\r\n } else {\r\n this.setState(this.state, { render: false, history: true });\r\n }\r\n if (app['debug']) {\r\n if (componentCache.get(element)) { componentCache.get(element).push(this) }\r\n else { componentCache.set(element, [this])}\r\n }\r\n return this;\r\n }\r\n\r\n is_global_event(name: string): boolean {\r\n return name && (\r\n this.global_event ||\r\n this._global_events.indexOf(name) >= 0 ||\r\n name.startsWith('#') || name.startsWith('/') || name.startsWith('@'));\r\n }\r\n\r\n add_action(name: string, action, options: ActionOptions = {}) {\r\n if (!action || typeof action !== 'function') return;\r\n if (options.global) this._global_events.push(name);\r\n this.on(name as any, (...p) => {\r\n\r\n app['debug'] && app.run('debug', {\r\n component: this,\r\n _: '>',\r\n event: name, p,\r\n current_state: this.state,\r\n options\r\n });\r\n\r\n const newState = action(this.state, ...p);\r\n\r\n app['debug'] && app.run('debug', {\r\n component: this,\r\n _: '<',\r\n event: name, p,\r\n newState,\r\n state: this.state,\r\n options\r\n });\r\n\r\n this.setState(newState, options)\r\n }, options);\r\n }\r\n\r\n add_actions() {\r\n const actions = this.update || {};\r\n Reflect.getMetadataKeys(this).forEach(key => {\r\n if (key.startsWith('apprun-update:')) {\r\n const meta = Reflect.getMetadata(key, this)\r\n actions[meta.name] = [this[meta.key].bind(this), meta.options];\r\n }\r\n })\r\n\r\n const all = {};\r\n if (Array.isArray(actions)) {\r\n actions.forEach(act => {\r\n const [name, action, opts] = act as ActionDef<T, E>;\r\n const names = name.toString();\r\n names.split(',').forEach(n => all[n.trim()] = [action, opts])\r\n })\r\n } else {\r\n Object.keys(actions).forEach(name => {\r\n const action = actions[name];\r\n if (typeof action === 'function' || Array.isArray(action)) {\r\n name.split(',').forEach(n => all[n.trim()] = action)\r\n }\r\n })\r\n }\r\n\r\n if (!all['.']) all['.'] = REFRESH;\r\n Object.keys(all).forEach(name => {\r\n const action = all[name];\r\n if (typeof action === 'function') {\r\n this.add_action(name, action);\r\n } else if (Array.isArray(action)) {\r\n this.add_action(name, action[0], action[1]);\r\n }\r\n });\r\n }\r\n\r\n public run(event: E, ...args) {\r\n const name = event.toString();\r\n return this.is_global_event(name) ?\r\n app.run(name, ...args) :\r\n this._app.run(name, ...args);\r\n }\r\n\r\n public on(event: E, fn: (...args) => void, options?: any) {\r\n const name = event.toString();\r\n this._actions.push({ name, fn });\r\n return this.is_global_event(name) ?\r\n app.on(name, fn, options) :\r\n this._app.on(name, fn, options);\r\n }\r\n\r\n public unmount() {\r\n this.observer?.disconnect();\r\n this._actions.forEach(action => {\r\n const { name, fn } = action;\r\n this.is_global_event(name) ?\r\n app.off(name, fn) :\r\n this._app.off(name, fn);\r\n });\r\n }\r\n}\r\n","import app from './app';\n\nexport type Route = (url: string, ...args: any[]) => any;\n\nexport const ROUTER_EVENT: string = '//';\nexport const ROUTER_404_EVENT: string = '///';\n\nexport const route: Route = (url: string) => {\n if (!url) url = '#';\n if (url.startsWith('#')) {\n const [name, ...rest] = url.split('/');\n app.run(name, ...rest) || app.run(ROUTER_404_EVENT, name, ...rest);\n app.run(ROUTER_EVENT, name, ...rest);\n } else if (url.startsWith('/')) {\n const [_, name, ...rest] = url.split('/');\n app.run('/' + name, ...rest) || app.run(ROUTER_404_EVENT, '/' + name, ...rest);\n app.run(ROUTER_EVENT, '/' + name, ...rest);\n } else {\n app.run(url) || app.run(ROUTER_404_EVENT, url);\n app.run(ROUTER_EVENT, url);\n }\n}\nexport default route;","import app from './app';\nimport { createElement, render, Fragment } from './vdom';\nimport { Component } from './component';\nimport { VNode, View, Action, Update, EventOptions, ActionOptions, MountOptions, AppStartOptions } from './types';\nimport { on, update, customElement } from './decorator';\nimport webComponent, { CustomElementOptions } from './web-component';\nimport { Route, route, ROUTER_EVENT, ROUTER_404_EVENT } from './router';\n\nexport interface IApp {\n start<T, E = any>(element?: Element | string, model?: T, view?: View<T>, update?: Update<T, E>,\n options?: AppStartOptions<T>): Component<T, E>;\n on(name: string, fn: (...args: any[]) => void, options?: any): void;\n off(name: string, fn: (...args: any[]) => void): void;\n run(name: string, ...args: any[]): number;\n h(tag: string | Function, props, ...children): VNode | VNode[];\n createElement(tag: string | Function, props, ...children): VNode | VNode[];\n render(element: HTMLElement, node: VNode): void;\n Fragment(props, ...children): any[];\n route?: Route;\n webComponent(name: string, componentClass, options?: CustomElementOptions): void;\n}\n\napp.h = app.createElement = createElement;\napp.render = render;\napp.Fragment = Fragment;\napp.webComponent = webComponent;\n\napp.start = <T, E = any>(element?: Element, model?: T, view?: View<T>, update?: Update<T, E>,\n options?: AppStartOptions<T>): Component<T, E> => {\n const opts = { render: true, global_event: true, ...options };\n const component = new Component<T, E>(model, view, update);\n if (options && options.rendered) component.rendered = options.rendered;\n component.mount(element, opts);\n return component;\n};\n\nconst NOOP = _ => {/* Intentionally empty */ }\napp.on('$', NOOP);\napp.on('debug', _ => NOOP);\napp.on(ROUTER_EVENT, NOOP);\napp.on('#', NOOP);\napp['route'] = route;\napp.on('route', url => app['route'] && app['route'](url));\n\nif (typeof document === 'object') {\n document.addEventListener(\"DOMContentLoaded\", () => {\n if (app['route'] === route) {\n window.onpopstate = () => route(location.hash);\n if (!document.body.hasAttribute('apprun-no-init')) route(location.hash);\n }\n });\n}\n\nexport type StatelessComponent<T = {}> = (args: T) => string | VNode | void;\nexport { app, Component, View, Action, Update, on, update, EventOptions, ActionOptions, MountOptions, Fragment }\nexport { update as event };\nexport { ROUTER_EVENT, ROUTER_404_EVENT };\nexport { customElement, CustomElementOptions, AppStartOptions };\nexport default app as IApp;\n\nif (typeof window === 'object') {\n window['Component'] = Component;\n window['React'] = app;\n window['on'] = on;\n window['customElement'] = customElement;\n}\n\n\n","import { createElement, updateElement, Fragment } from './vdom-my';\nexport function render(element, html, parent?) {\n updateElement(element, html, parent);\n}\nexport { createElement, Fragment };\n\n\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// IMPORTANT: these imports must be type-only\nimport type {Directive, DirectiveResult, PartInfo} from './directive.js';\n\nconst DEV_MODE = true;\nconst ENABLE_EXTRA_SECURITY_HOOKS = true;\nconst ENABLE_SHADYDOM_NOPATCH = true;\n\n/**\n * `true` if we're building for google3 with temporary back-compat helpers.\n * This export is not present in prod builds.\n * @internal\n */\nexport const INTERNAL = true;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n globalThis.litIssuedWarnings ??= new Set();\n\n // Issue a warning, if we haven't already.\n issueWarning = (code: string, warning: string) => {\n warning += code\n ? ` See https://lit.dev/msg/${code} for more information.`\n : '';\n if (!globalThis.litIssuedWarnings!.has(warning)) {\n console.warn(warning);\n globalThis.litIssuedWarnings!.add(warning);\n }\n };\n\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n}\n\nconst wrap =\n ENABLE_SHADYDOM_NOPATCH &&\n window.ShadyDOM?.inUse &&\n window.ShadyDOM?.noPatch === true\n ? window.ShadyDOM!.wrap\n : (node: Node) => node;\n\nconst trustedTypes = (globalThis as unknown as Partial<Window>).trustedTypes;\n\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 = trustedTypes\n ? trustedTypes.createPolicy('lit-html', {\n createHTML: (s) => s,\n })\n : undefined;\n\n/**\n * Used to sanitize any value before it is written into the DOM. This can be\n * used to implement a security policy of allowed and disallowed values in\n * order to prevent XSS attacks.\n *\n * One way of using this callback would be to check attributes and properties\n * against a list of high risk fields, and require that values written to such\n * fields be instances of a class which is safe by construction. Closure's Safe\n * HTML Types is one implementation of this technique (\n * https://github.com/google/safe-html-types/blob/master/doc/safehtml-types.md).\n * The TrustedTypes polyfill in API-only mode could also be used as a basis\n * for this technique (https://github.com/WICG/trusted-types).\n *\n * @param node The HTML node (usually either a #text node or an Element) that\n * is being written to. Note that this is just an exemplar node, the write\n * may take place against another instance of the same class of node.\n * @param name The name of an attribute or property (for example, 'href').\n * @param type Indicates whether the write that's about to be performed will\n * be to a property or a node.\n * @return A function that will sanitize this class of writes.\n */\nexport type SanitizerFactory = (\n node: Node,\n name: string,\n type: 'property' | 'attribute'\n) => ValueSanitizer;\n\n/**\n * A function which can sanitize values that will be written to a specific kind\n * of DOM sink.\n *\n * See SanitizerFactory.\n *\n * @param value The value to sanitize. Will be the actual value passed into\n * the lit-html template literal, so this could be of any type.\n * @return The value to write to the DOM. Usually the same as the input value,\n * unless sanitization is needed.\n */\nexport type ValueSanitizer = (value: unknown) => unknown;\n\nconst identityFunction: ValueSanitizer = (value: unknown) => value;\nconst noopSanitizer: SanitizerFactory = (\n _node: Node,\n _name: string,\n _type: 'property' | 'attribute'\n) => identityFunction;\n\n/** Sets the global sanitizer factory. */\nconst setSanitizer = (newSanitizer: SanitizerFactory) => {\n if (!ENABLE_EXTRA_SECURITY_HOOKS) {\n return;\n }\n if (sanitizerFactoryInternal !== noopSanitizer) {\n throw new Error(\n `Attempted to overwrite existing lit-html security policy.` +\n ` setSanitizeDOMValueFactory should be called at most once.`\n );\n }\n sanitizerFactoryInternal = newSanitizer;\n};\n\n/**\n * Only used in internal tests, not a part of the public API.\n */\nconst _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {\n sanitizerFactoryInternal = noopSanitizer;\n};\n\nconst createSanitizer: SanitizerFactory = (node, name, type) => {\n return sanitizerFactoryInternal(node, name, type);\n};\n\n// Added to an attribute name to mark the attribute as bound so we can find\n// it easily.\nconst boundAttributeSuffix = '$lit$';\n\n// This marker is used in many syntactic positions in HTML, so it must be\n// a valid element name and attribute name. We don't support dynamic names (yet)\n// but this at least ensures that the parse tree is closer to the template\n// intention.\nconst marker = `lit$${String(Math.random()).slice(9)}$`;\n\n// String used to tell if a comment is a marker comment\nconst markerMatch = '?' + marker;\n\n// Text used to insert a comment marker node. We use processing instruction\n// syntax because it's slightly smaller, but parses as a comment node.\nconst nodeMarker = `<${markerMatch}>`;\n\nconst d = document;\n\n// Creates a dynamic marker. We never have to search for these in the DOM.\nconst createMarker = (v = '') => d.createComment(v);\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\ntype Primitive = null | undefined | boolean | number | string | symbol | bigint;\nconst isPrimitive = (value: unknown): value is Primitive =>\n value === null || (typeof value != 'object' && typeof value != 'function');\nconst isArray = Array.isArray;\nconst isIterable = (value: unknown): value is Iterable<unknown> =>\n isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n typeof (value as any)?.[Symbol.iterator] === 'function';\n\nconst SPACE_CHAR = `[ \\t\\n\\f\\r]`;\nconst ATTR_VALUE_CHAR = `[^ \\t\\n\\f\\r\"'\\`<>=]`;\nconst NAME_CHAR = `[^\\\\s\"'>=/]`;\n\n// These regexes represent the five parsing states that we care about in the\n// Template's HTML scanner. They match the *end* of the state they're named\n// after.\n// Depending on the match, we transition to a new state. If there's no match,\n// we stay in the same state.\n// Note that the regexes are stateful. We utilize lastIndex and sync it\n// across the multiple regexes used. In addition to the five regexes below\n// we also dynamically create a regex to find the matching end tags for raw\n// text elements.\n\n/**\n * End of text is: `<` followed by:\n * (comment start) or (tag) or (dynamic tag binding)\n */\nconst textEndRegex = /<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\nconst COMMENT_START = 1;\nconst TAG_NAME = 2;\nconst DYNAMIC_TAG_NAME = 3;\n\nconst commentEndRegex = /-->/g;\n/**\n * Comments not started with <!--, like </{, can be ended by a single `>`\n */\nconst comment2EndRegex = />/g;\n\n/**\n * The tagEnd regex matches the end of the \"inside an opening\" tag syntax\n * position. It either matches a `>`, an attribute-like sequence, or the end\n * of the string after a space (attribute-name position ending).\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\t\\n\\f\\r\" are HTML space characters:\n * https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * So an attribute is:\n * * The name: any character except a whitespace character, (\"), ('), \">\",\n * \"=\", or \"/\". Note: this is different from the HTML spec which also excludes control characters.\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 */\nconst tagEndRegex = new RegExp(\n `>|${SPACE_CHAR}(?:(${NAME_CHAR}+)(${SPACE_CHAR}*=${SPACE_CHAR}*(?:${ATTR_VALUE_CHAR}|(\"|')|))|$)`,\n 'g'\n);\nconst ENTIRE_MATCH = 0;\nconst ATTRIBUTE_NAME = 1;\nconst SPACES_AND_EQUALS = 2;\nconst QUOTE_CHAR = 3;\n\nconst singleQuoteAttrEndRegex = /'/g;\nconst doubleQuoteAttrEndRegex = /\"/g;\n/**\n * Matches the raw text elements.\n *\n * Comments are not parsed within raw text elements, so we need to search their\n * text content for marker strings.\n */\nconst rawTextElement = /^(?:script|style|textarea|title)$/i;\n\n/** TemplateResult types */\nconst HTML_RESULT = 1;\nconst SVG_RESULT = 2;\n\ntype ResultType = typeof HTML_RESULT | typeof SVG_RESULT;\n\n// TemplatePart types\n// IMPORTANT: these must match the values in PartType\nconst ATTRIBUTE_PART = 1;\nconst CHILD_PART = 2;\nconst PROPERTY_PART = 3;\nconst BOOLEAN_ATTRIBUTE_PART = 4;\nconst EVENT_PART = 5;\nconst ELEMENT_PART = 6;\nconst COMMENT_PART = 7;\n\n/**\n * The return type of the template tag functions.\n */\nexport type TemplateResult<T extends ResultType = ResultType> = {\n // This property needs to remain unminified.\n ['_$litType$']: T;\n strings: TemplateStringsArray;\n values: unknown[];\n};\n\nexport type HTMLTemplateResult = TemplateResult<typeof HTML_RESULT>;\n\nexport type SVGTemplateResult = TemplateResult<typeof SVG_RESULT>;\n\nexport interface CompiledTemplateResult {\n // This is a factory in order to make template initialization lazy\n // and allow ShadyRenderOptions scope to be passed in.\n // This property needs to remain unminified.\n ['_$litType$']: CompiledTemplate;\n values: unknown[];\n}\n\nexport interface CompiledTemplate extends Omit<Template, 'el'> {\n // el is overridden to be optional. We initialize it on first render\n el?: HTMLTemplateElement;\n\n // The prepared HTML string to create a template element from.\n h: TrustedHTML;\n}\n\n/**\n * Generates a template literal tag function that returns a TemplateResult with\n * the given result type.\n */\nconst tag =\n <T extends ResultType>(type: T) =>\n (strings: TemplateStringsArray, ...values: unknown[]): TemplateResult<T> => {\n // Warn against templates octal escape sequences\n // We do this here rather than in render so that the warning is closer to the\n // template definition.\n if (DEV_MODE && strings.some((s) => s === undefined)) {\n console.warn(\n 'Some template strings are undefined.\\n' +\n 'This is probably caused by illegal octal escape sequences.'\n );\n }\n return {\n // This property needs to remain unminified.\n ['_$litType$']: type,\n strings,\n values,\n };\n };\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n *\n * ```ts\n * const header = (title: string) => html`<h1>${title}</h1>`;\n * ```\n *\n * The `html` tag returns a description of the DOM to render as a value. It is\n * lazy, meaning no work is done until the template is rendered. When rendering,\n * if a template comes from the same expression as a previously rendered result,\n * it's efficiently updated instead of replaced.\n */\nexport const html = tag(HTML_RESULT);\n\n/**\n * Interprets a template literal as an SVG fragment that can efficiently\n * render to and update a container.\n *\n * ```ts\n * const rect = svg`<rect width=\"10\" height=\"10\"></rect>`;\n *\n * const myImage = html`\n * <svg viewBox=\"0 0 10 10\" xmlns=\"http://www.w3.org/2000/svg\">\n * ${rect}\n * </svg>`;\n * ```\n *\n * The `svg` *tag function* should only be used for SVG fragments, or elements\n * that would be contained **inside** an `<svg>` HTML element. A common error is\n * placing an `<svg>` *element* in a template tagged with the `svg` tag\n * function. The `<svg>` element is an HTML element and should be used within a\n * template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an SVG fragment from the\n * `render()` method, as the SVG fragment will be contained within the element's\n * shadow root and thus cannot be used within an `<svg>` HTML element.\n */\nexport const svg = tag(SVG_RESULT);\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 = Symbol.for('lit-noChange');\n\n/**\n * A sentinel value that signals a ChildPart to fully clear its content.\n *\n * ```ts\n * const button = html`${\n * user.isAdmin\n * ? html`<button>DELETE</button>`\n * : nothing\n * }`;\n * ```\n *\n * Prefer using `nothing` over other falsy values as it provides a consistent\n * behavior between various expression binding contexts.\n *\n * In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the\n * same and render no nodes. In attribute expressions, `nothing` _removes_ the\n * attribute, while `undefined` and `null` will render an empty string. In\n * property expressions `nothing` becomes `undefined`.\n */\nexport const nothing = Symbol.for('lit-nothing');\n\n/**\n * The cache of prepared templates, keyed by the tagged TemplateStringsArray\n * and _not_ accounting for the specific template tag used. This means that\n * template tags cannot be dynamic - the must statically be one of html, svg,\n * or attr. This restriction simplifies the cache lookup, which is on the hot\n * path for rendering.\n */\nconst templateCache = new WeakMap<TemplateStringsArray, Template>();\n\n/**\n * Object specifying options for controlling lit-html rendering. Note that\n * while `render` may be called multiple times on the same `container` (and\n * `renderBefore` reference node) to efficiently update the rendered content,\n * only the options passed in during the first render are respected during\n * the lifetime of renders to that unique `container` + `renderBefore`\n * combination.\n */\nexport interface RenderOptions {\n /**\n * An object to use as the `this` value for event listeners. It's often\n * useful to set this to the host component rendering a template.\n */\n host?: object;\n /**\n * A DOM node before which to render content in the container.\n */\n renderBefore?: ChildNode | null;\n /**\n * Node used for cloning the template (`importNode` will be called on this\n * node). This controls the `ownerDocument` of the rendered DOM, along with\n * any inherited context. Defaults to the global `document`.\n */\n creationScope?: {importNode(node: Node, deep?: boolean): Node};\n /**\n * The initial connected state for the top-level part being rendered. If no\n * `isConnected` option is set, `AsyncDirective`s will be connected by\n * default. Set to `false` if the initial render occurs in a disconnected tree\n * and `AsyncDirective`s should see `isConnected === false` for their initial\n * render. The `part.setConnected()` method must be used subsequent to initial\n * render to change the connected state of the part.\n */\n isConnected?: boolean;\n}\n\n/**\n * Internally we can export this interface and change the type of\n * render()'s options.\n */\ninterface InternalRenderOptions extends RenderOptions {\n /**\n * An internal-only migration flag\n * @internal\n */\n clearContainerForLit2MigrationOnly?: boolean;\n}\n\n/**\n * Renders a value, usually a lit-html TemplateResult, to the container.\n * @param value\n * @param container\n * @param options\n */\nexport const render = (\n value: unknown,\n container: HTMLElement | DocumentFragment,\n options?: RenderOptions\n): RootPart => {\n const partOwnerNode = options?.renderBefore ?? container;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let part: ChildPart = (partOwnerNode as any)['_$litPart$'];\n if (part === undefined) {\n const endNode = options?.renderBefore ?? null;\n // Internal modification: don't clear container to match lit-html 2.0\n if (\n INTERNAL &&\n (options as InternalRenderOptions)?.clearContainerForLit2MigrationOnly ===\n true\n ) {\n let n = container.firstChild;\n // Clear only up to the `endNode` aka `renderBefore` node.\n while (n && n !== endNode) {\n const next = n.nextSibling;\n n.remove();\n n = next;\n }\n }\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (partOwnerNode as any)['_$litPart$'] = part = new ChildPart(\n container.insertBefore(createMarker(), endNode),\n endNode,\n undefined,\n options ?? {}\n );\n }\n part._$setValue(value);\n return part as RootPart;\n};\n\nif (ENABLE_EXTRA_SECURITY_HOOKS) {\n render.setSanitizer = setSanitizer;\n render.createSanitizer = createSanitizer;\n if (DEV_MODE) {\n render._testOnlyClearSanitizerFactoryDoNotCallOrElse =\n _testOnlyClearSanitizerFactoryDoNotCallOrElse;\n }\n}\n\nconst walker = d.createTreeWalker(\n d,\n 129 /* NodeFilter.SHOW_{ELEMENT|COMMENT} */,\n null,\n false\n);\n\nlet sanitizerFactoryInternal: SanitizerFactory = noopSanitizer;\n\n//\n// Classes only below here, const variable declarations only above here...\n//\n// Keeping variable declarations and classes together improves minification.\n// Interfaces and type aliases can be interleaved freely.\n//\n\n// Type for classes that have a `_directive` or `_directives[]` field, used by\n// `resolveDirective`\nexport interface DirectiveParent {\n _$parent?: DirectiveParent;\n _$isConnected: boolean;\n __directive?: Directive;\n __directives?: Array<Directive | undefined>;\n}\n\n/**\n * Returns an HTML string for the given TemplateStringsArray and result type\n * (HTML or SVG), along with the case-sensitive bound attribute names in\n * template order. The HTML contains comment comment markers denoting the\n * `ChildPart`s and suffixes on bound attributes denoting the `AttributeParts`.\n *\n * @param strings template strings array\n * @param type HTML or SVG\n * @return Array containing `[html, attrNames]` (array returned for terseness,\n * to avoid object fields since this code is shared with non-minified SSR\n * code)\n */\nconst getTemplateHtml = (\n strings: TemplateStringsArray,\n type: ResultType\n): [TrustedHTML, Array<string | undefined>] => {\n // Insert makers into the template HTML to represent the position of\n // bindings. The following code scans the template strings to determine the\n // syntactic position of the bindings. They can be in text position, where\n // we insert an HTML comment, attribute value position, where we insert a\n // sentinel string and re-write the attribute name, or inside a tag where\n // we insert the sentinel string.\n const l = strings.length - 1;\n // Stores the case-sensitive bound attribute names in the order of their\n // parts. ElementParts are also reflected in this array as undefined\n // rather than a string, to disambiguate from attribute bindings.\n const attrNames: Array<string | undefined> = [];\n let html = type === SVG_RESULT ? '<svg>' : '';\n\n // When we're inside a raw text tag (not it's text content), the regex\n // will still be tagRegex so we can find attributes, but will switch to\n // this regex when the tag ends.\n let rawTextEndRegex: RegExp | undefined;\n\n // The current parsing state, represented as a reference to one of the\n // regexes\n let regex = textEndRegex;\n\n for (let i = 0; i < l; i++) {\n const s = strings[i];\n // The index of the end of the last attribute name. When this is\n // positive at end of a string, it means we're in an attribute value\n // position and need to rewrite the attribute name.\n // We also use a special value of -2 to indicate that we encountered\n // the end of a string in attribute name position.\n let attrNameEndIndex = -1;\n let attrName: string | undefined;\n let lastIndex = 0;\n let match!: RegExpExecArray | null;\n\n // The conditions in this loop handle the current parse state, and the\n // assignments to the `regex` variable are the state transitions.\n while (lastIndex < s.length) {\n // Make sure we start searching from where we previously left off\n regex.lastIndex = lastIndex;\n match = regex.exec(s);\n if (match === null) {\n break;\n }\n lastIndex = regex.lastIndex;\n if (regex === textEndRegex) {\n if (match[COMMENT_START] === '!--') {\n regex = commentEndRegex;\n } else if (match[COMMENT_START] !== undefined) {\n // We started a weird comment, like </{\n regex = comment2EndRegex;\n } else if (match[TAG_NAME] !== undefined) {\n if (rawTextElement.test(match[TAG_NAME])) {\n // Record if we encounter a raw-text element. We'll switch to\n // this regex at the end of the tag.\n rawTextEndRegex = new RegExp(`</${match[TAG_NAME]}`, 'g');\n }\n regex = tagEndRegex;\n } else if (match[DYNAMIC_TAG_NAME] !== undefined) {\n if (DEV_MODE) {\n throw new Error(\n 'Bindings in tag names are not supported. Please use static templates instead. ' +\n 'See https://lit.dev/docs/templates/expressions/#static-expressions'\n );\n }\n regex = tagEndRegex;\n }\n } else if (regex === tagEndRegex) {\n if (match[ENTIRE_MATCH] === '>') {\n // End of a tag. If we had started a raw-text element, use that\n // regex\n regex = rawTextEndRegex ?? textEndRegex;\n // We may be ending an unquoted attribute value, so make sure we\n // clear any pending attrNameEndIndex\n attrNameEndIndex = -1;\n } else if (match[ATTRIBUTE_NAME] === undefined) {\n // Attribute name position\n attrNameEndIndex = -2;\n } else {\n attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS].length;\n attrName = match[ATTRIBUTE_NAME];\n regex =\n match[QUOTE_CHAR] === undefined\n ? tagEndRegex\n : match[QUOTE_CHAR] === '\"'\n ? doubleQuoteAttrEndRegex\n : singleQuoteAttrEndRegex;\n }\n } else if (\n regex === doubleQuoteAttrEndRegex ||\n regex === singleQuoteAttrEndRegex\n ) {\n regex = tagEndRegex;\n } else if (regex === commentEndRegex || regex === comment2EndRegex) {\n regex = textEndRegex;\n } else {\n // Not one of the five state regexes, so it must be the dynamically\n // created raw text regex and we're at the close of that element.\n regex = tagEndRegex;\n rawTextEndRegex = undefined;\n }\n }\n\n if (DEV_MODE) {\n // If we have a attrNameEndIndex, which indicates that we should\n // rewrite the attribute name, assert that we're in a valid attribute\n // position - either in a tag, or a quoted attribute value.\n console.assert(\n attrNameEndIndex === -1 ||\n regex === tagEndRegex ||\n regex === singleQuoteAttrEndRegex ||\n regex === doubleQuoteAttrEndRegex,\n 'unexpected parse state B'\n );\n }\n\n // We have four cases:\n // 1. We're in text position, and not in a raw text element\n // (regex === textEndRegex): insert a comment marker.\n // 2. We have a non-negative attrNameEndIndex which means we need to\n // rewrite the attribute name to add a bound attribute suffix.\n // 3. We're at the non-first binding in a multi-binding attribute, use a\n // plain marker.\n // 4. We're somewhere else inside the tag. If we're in attribute name\n // position (attrNameEndIndex === -2), add a sequential suffix to\n // generate a unique attribute name.\n\n // Detect a binding next to self-closing tag end and insert a space to\n // separate the marker from the tag end:\n const end =\n regex === tagEndRegex && strings[i + 1].startsWith('/>') ? ' ' : '';\n html +=\n regex === textEndRegex\n ? s + nodeMarker\n : attrNameEndIndex >= 0\n ? (attrNames.push(attrName!),\n s.slice(0, attrNameEndIndex) +\n boundAttributeSuffix +\n s.slice(attrNameEndIndex)) +\n marker +\n end\n : s +\n marker +\n (attrNameEndIndex === -2 ? (attrNames.push(undefined), i) : end);\n }\n\n const htmlResult: string | TrustedHTML =\n html + (strings[l] || '<?>') + (type === SVG_RESULT ? '</svg>' : '');\n\n // A security check to prevent spoofing of Lit template results.\n // In the future, we may be able to replace this with Array.isTemplateObject,\n // though we might need to make that check inside of the html and svg\n // functions, because precompiled templates don't come in as\n // TemplateStringArray objects.\n if (!Array.isArray(strings) || !strings.hasOwnProperty('raw')) {\n let message = 'invalid template strings array';\n if (DEV_MODE) {\n message =\n `Internal Error: expected template strings to be an array ` +\n `with a 'raw' field. Please file a bug at ` +\n `https://github.com/lit/lit/issues/new?template=bug_report.md ` +\n `and include information about your build tooling, if any.`;\n }\n throw new Error(message);\n }\n // Returned as an array for terseness\n return [\n policy !== undefined\n ? policy.createHTML(htmlResult)\n : (htmlResult as unknown as TrustedHTML),\n attrNames,\n ];\n};\n\n/** @internal */\nexport type {Template};\nclass Template {\n /** @internal */\n el!: HTMLTemplateElement;\n /** @internal */\n parts: Array<TemplatePart> = [];\n\n constructor(\n // This property needs to remain unminified.\n {strings, ['_$litType$']: type}: TemplateResult,\n options?: RenderOptions\n ) {\n let node: Node | null;\n let nodeIndex = 0;\n let attrNameIndex = 0;\n const partCount = strings.length - 1;\n const parts = this.parts;\n\n // Create template element\n const [html, attrNames] = getTemplateHtml(strings, type);\n this.el = Template.createElement(html, options);\n walker.currentNode = this.el.content;\n\n // Reparent SVG nodes into template root\n if (type === SVG_RESULT) {\n const content = this.el.content;\n const svgElement = content.firstChild!;\n svgElement.remove();\n content.append(...svgElement.childNodes);\n }\n\n // Walk the template to find binding markers and create TemplateParts\n while ((node = walker.nextNode()) !== null && parts.length < partCount) {\n if (node.nodeType === 1) {\n if (DEV_MODE) {\n const tag = (node as Element).localName;\n // Warn if `textarea` includes an expression and throw if `template`\n // does since these are not supported. We do this by checking\n // innerHTML for anything that looks like a marker. This catches\n // cases like bindings in textarea there markers turn into text nodes.\n if (\n /^(?:textarea|template)$/i!.test(tag) &&\n (node as Element).innerHTML.includes(marker)\n ) {\n const m =\n `Expressions are not supported inside \\`${tag}\\` ` +\n `elements. See https://lit.dev/msg/expression-in-${tag} for more ` +\n `information.`;\n if (tag === 'template') {\n throw new Error(m);\n } else issueWarning('', m);\n }\n }\n // TODO (justinfagnani): for attempted dynamic tag names, we don't\n // increment the bindingIndex, and it'll be off by 1 in the element\n // and off by two after it.\n if ((node as Element).hasAttributes()) {\n // We defer removing bound attributes because on IE we might not be\n // iterating attributes in their template order, and would sometimes\n // remove an attribute that we still need to create a part for.\n const attrsToRemove = [];\n for (const name of (node as Element).getAttributeNames()) {\n // `name` is the name of the attribute we're iterating over, but not\n // _neccessarily_ the name of the attribute we will create a part\n // for. They can be different in browsers that don't iterate on\n // attributes in source order. In that case the attrNames array\n // contains the attribute name we'll process next. We only need the\n // attribute name here to know if we should process a bound attribute\n // on this element.\n if (\n name.endsWith(boundAttributeSuffix) ||\n name.startsWith(marker)\n ) {\n const realName = attrNames[attrNameIndex++];\n attrsToRemove.push(name);\n if (realName !== undefined) {\n // Lowercase for case-sensitive SVG attributes like viewBox\n const value = (node as Element).getAttribute(\n realName.toLowerCase() + boundAttributeSuffix\n )!;\n const statics = value.split(marker);\n const m = /([.?@])?(.*)/.exec(realName)!;\n parts.push({\n type: ATTRIBUTE_PART,\n index: nodeIndex,\n name: m[2],\n strings: statics,\n ctor:\n m[1] === '.'\n ? PropertyPart\n : m[1] === '?'\n ? BooleanAttributePart\n : m[1] === '@'\n ? EventPart\n : AttributePart,\n });\n } else {\n parts.push({\n type: ELEMENT_PART,\n index: nodeIndex,\n });\n }\n }\n }\n for (const name of attrsToRemove) {\n (node as Element).removeAttribute(name);\n }\n }\n // TODO (justinfagnani): benchmark the regex against testing for each\n // of the 3 raw text element names.\n if (rawTextElement.test((node as Element).tagName)) {\n // For raw text elements we need to split the text content on\n // markers, create a Text node for each segment, and create\n // a TemplatePart for each marker.\n const strings = (node as Element).textContent!.split(marker);\n const lastIndex = strings.length - 1;\n if (lastIndex > 0) {\n (node as Element).textContent = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n // We can't use empty text nodes as markers because they're\n // normalized when cloning in IE (could simplify when\n // IE is no longer supported)\n for (let i = 0; i < lastIndex; i++) {\n (node as Element).append(strings[i], createMarker());\n // Walk past the marker node we just added\n walker.nextNode();\n parts.push({type: CHILD_PART, index: ++nodeIndex});\n }\n // Note because this marker is added after the walker's current\n // node, it will be walked to in the outer loop (and ignored), so\n // we don't need to adjust nodeIndex here\n (node as Element).append(strings[lastIndex], createMarker());\n }\n }\n } else if (node.nodeType === 8) {\n const data = (node as Comment).data;\n if (data === markerMatch) {\n parts.push({type: CHILD_PART, index: nodeIndex});\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 parts.push({type: COMMENT_PART, index: nodeIndex});\n // Move to the end of the match\n i += marker.length - 1;\n }\n }\n }\n nodeIndex++;\n }\n }\n\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @nocollapse */\n static createElement(html: TrustedHTML, _options?: RenderOptions) {\n const el = d.createElement('template');\n el.innerHTML = html as unknown as string;\n return el;\n }\n}\n\nexport interface Disconnectable {\n _$parent?: Disconnectable;\n _$disconnectableChildren?: Set<Disconnectable>;\n // Rather than hold connection state on instances, Disconnectables recursively\n // fetch the connection state from the RootPart they are connected in via\n // getters up the Disconnectable tree via _$parent references. This pushes the\n // cost of tracking the isConnected state to `AsyncDirectives`, and avoids\n // needing to pass all Disconnectables (parts, template instances, and\n // directives) their connection state each time it changes, which would be\n // costly for trees that have no AsyncDirectives.\n _$isConnected: boolean;\n}\n\nfunction resolveDirective(\n part: ChildPart | AttributePart | ElementPart,\n value: unknown,\n parent: DirectiveParent = part,\n attributeIndex?: number\n): unknown {\n // Bail early if the value is explicitly noChange. Note, this means any\n // nested directive is still attached and is not run.\n if (value === noChange) {\n return value;\n }\n let currentDirective =\n attributeIndex !== undefined\n ? (parent as AttributePart).__directives?.[attributeIndex]\n : (parent as ChildPart | ElementPart | Directive).__directive;\n const nextDirectiveConstructor = isPrimitive(value)\n ? undefined\n : // This property needs to remain unminified.\n (value as DirectiveResult)['_$litDirective$'];\n if (currentDirective?.constructor !== nextDirectiveConstructor) {\n // This property needs to remain unminified.\n currentDirective?.['_$notifyDirectiveConnectionChanged']?.(false);\n if (nextDirectiveConstructor === undefined) {\n currentDirective = undefined;\n } else {\n currentDirective = new nextDirectiveConstructor(part as PartInfo);\n currentDirective._$initialize(part, parent, attributeIndex);\n }\n if (attributeIndex !== undefined) {\n ((parent as AttributePart).__directives ??= [])[attributeIndex] =\n currentDirective;\n } else {\n (parent as ChildPart | Directive).__directive = currentDirective;\n }\n }\n if (currentDirective !== undefined) {\n value = resolveDirective(\n part,\n currentDirective._$resolve(part, (value as DirectiveResult).values),\n currentDirective,\n attributeIndex\n );\n }\n return value;\n}\n\n/**\n * An updateable instance of a Template. Holds references to the Parts used to\n * update the template instance.\n */\nclass TemplateInstance implements Disconnectable {\n /** @internal */\n _$template: Template;\n /** @internal */\n _parts: Array<Part | undefined> = [];\n\n /** @internal */\n _$parent: ChildPart;\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n constructor(template: Template, parent: ChildPart) {\n this._$template = template;\n this._$parent = parent;\n }\n\n // Called by ChildPart parentNode getter\n get parentNode() {\n return this._$parent.parentNode;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n // This method is separate from the constructor because we need to return a\n // DocumentFragment and we don't want to hold onto it with an instance field.\n _clone(options: RenderOptions | undefined) {\n const {\n el: {content},\n parts: parts,\n } = this._$template;\n const fragment = (options?.creationScope ?? d).importNode(content, true);\n walker.currentNode = fragment;\n\n let node = walker.nextNode()!;\n let nodeIndex = 0;\n let partIndex = 0;\n let templatePart = parts[0];\n\n while (templatePart !== undefined) {\n if (nodeIndex === templatePart.index) {\n let part: Part | undefined;\n if (templatePart.type === CHILD_PART) {\n part = new ChildPart(\n node as HTMLElement,\n node.nextSibling,\n this,\n options\n );\n } else if (templatePart.type === ATTRIBUTE_PART) {\n part = new templatePart.ctor(\n node as HTMLElement,\n templatePart.name,\n templatePart.strings,\n this,\n options\n );\n } else if (templatePart.type === ELEMENT_PART) {\n part = new ElementPart(node as HTMLElement, this, options);\n }\n this._parts.push(part);\n templatePart = parts[++partIndex];\n }\n if (nodeIndex !== templatePart?.index) {\n node = walker.nextNode()!;\n nodeIndex++;\n }\n }\n return fragment;\n }\n\n _update(values: Array<unknown>) {\n let i = 0;\n for (const part of this._parts) {\n if (part !== undefined) {\n if ((part as AttributePart).strings !== undefined) {\n (part as AttributePart)._$setValue(values, part as AttributePart, i);\n // The number of values the part consumes is part.strings.length - 1\n // since values are in between template spans. We increment i by 1\n // later in the loop, so increment it by part.strings.length - 2 here\n i += (part as AttributePart).strings!.length - 2;\n } else {\n part._$setValue(values[i]);\n }\n }\n i++;\n }\n }\n}\n\n/*\n * Parts\n */\ntype AttributeTemplatePart = {\n readonly type: typeof ATTRIBUTE_PART;\n readonly index: number;\n readonly name: string;\n /** @internal */\n readonly ctor: typeof AttributePart;\n /** @internal */\n readonly strings: ReadonlyArray<string>;\n};\ntype NodeTemplatePart = {\n readonly type: typeof CHILD_PART;\n readonly index: number;\n};\ntype ElementTemplatePart = {\n readonly type: typeof ELEMENT_PART;\n readonly index: number;\n};\ntype CommentTemplatePart = {\n readonly type: typeof COMMENT_PART;\n readonly index: number;\n};\n\n/**\n * A TemplatePart represents a dynamic part in a template, before the template\n * is instantiated. When a template is instantiated Parts are created from\n * TemplateParts.\n */\ntype TemplatePart =\n | NodeTemplatePart\n | AttributeTemplatePart\n | ElementTemplatePart\n | CommentTemplatePart;\n\nexport type Part =\n | ChildPart\n | AttributePart\n | PropertyPart\n | BooleanAttributePart\n | ElementPart\n | EventPart;\n\nexport type {ChildPart};\nclass ChildPart implements Disconnectable {\n readonly type = CHILD_PART;\n readonly options: RenderOptions | undefined;\n _$committedValue: unknown = nothing;\n /** @internal */\n __directive?: Directive;\n /** @internal */\n _$startNode: ChildNode;\n /** @internal */\n _$endNode: ChildNode | null;\n private _textSanitizer: ValueSanitizer | undefined;\n /** @internal */\n _$parent: Disconnectable | undefined;\n /**\n * Connection state for RootParts only (i.e. ChildPart without _$parent\n * returned from top-level `render`). This field is unsed otherwise. The\n * intention would clearer if we made `RootPart` a subclass of `ChildPart`\n * with this field (and a different _$isConnected getter), but the subclass\n * caused a perf regression, possibly due to making call sites polymorphic.\n * @internal\n */\n __isConnected: boolean;\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n // ChildParts that are not at the root should always be created with a\n // parent; only RootChildNode's won't, so they return the local isConnected\n // state\n return this._$parent?._$isConnected ?? this.__isConnected;\n }\n\n // The following fields will be patched onto ChildParts when required by\n // AsyncDirective\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n /** @internal */\n _$notifyConnectionChanged?(\n isConnected: boolean,\n removeFromParent?: boolean,\n from?: number\n ): void;\n /** @internal */\n _$reparentDisconnectables?(parent: Disconnectable): void;\n\n constructor(\n startNode: ChildNode,\n endNode: ChildNode | null,\n parent: TemplateInstance | ChildPart | undefined,\n options: RenderOptions | undefined\n ) {\n this._$startNode = startNode;\n this._$endNode = endNode;\n this._$parent = parent;\n this.options = options;\n // Note __isConnected is only ever accessed on RootParts (i.e. when there is\n // no _$parent); the value on a non-root-part is \"don't care\", but checking\n // for parent would be more code\n this.__isConnected = options?.isConnected ?? true;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n // Explicitly initialize for consistent class shape.\n this._textSanitizer = undefined;\n }\n }\n\n /**\n * The parent node into which the part renders its content.\n *\n * A ChildPart's content consists of a range of adjacent child nodes of\n * `.parentNode`, possibly bordered by 'marker nodes' (`.startNode` and\n * `.endNode`).\n *\n * - If both `.startNode` and `.endNode` are non-null, then the part's content\n * consists of all siblings between `.startNode` and `.endNode`, exclusively.\n *\n * - If `.startNode` is non-null but `.endNode` is null, then the part's\n * content consists of all siblings following `.startNode`, up to and\n * including the last child of `.parentNode`. If `.endNode` is non-null, then\n * `.startNode` will always be non-null.\n *\n * - If both `.endNode` and `.startNode` are null, then the part's content\n * consists of all child nodes of `.parentNode`.\n */\n get parentNode(): Node {\n let parentNode: Node = wrap(this._$startNode).parentNode!;\n const parent = this._$parent;\n if (\n parent !== undefined &&\n parentNode.nodeType === 11 /* Node.DOCUMENT_FRAGMENT */\n ) {\n // If the parentNode is a DocumentFragment, it may be because the DOM is\n // still in the cloned fragment during initial render; if so, get the real\n // parentNode the part will be committed into by asking the parent.\n parentNode = (parent as ChildPart | TemplateInstance).parentNode;\n }\n return parentNode;\n }\n\n /**\n * The part's leading marker node, if any. See `.parentNode` for more\n * information.\n */\n get startNode(): Node | null {\n return this._$startNode;\n }\n\n /**\n * The part's trailing marker node, if any. See `.parentNode` for more\n * information.\n */\n get endNode(): Node | null {\n return this._$endNode;\n }\n\n _$setValue(value: unknown, directiveParent: DirectiveParent = this): void {\n if (DEV_MODE && this.parentNode === null) {\n throw new Error(\n `This \\`ChildPart\\` has no \\`parentNode\\` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's \\`innerHTML\\` or \\`textContent\\` can do this.`\n );\n }\n value = resolveDirective(this, value, directiveParent);\n if (isPrimitive(value)) {\n // Non-rendering child values. It's important that these do not render\n // empty text nodes to avoid issues with preventing default <slot>\n // fallback content.\n if (value === nothing || value == null || value === '') {\n if (this._$committedValue !== nothing) {\n this._$clear();\n }\n this._$committedValue = nothing;\n } else if (value !== this._$committedValue && value !== noChange) {\n this._commitText(value);\n }\n // This property needs to remain unminified.\n } else if ((value as TemplateResult)['_$litType$'] !== undefined) {\n this._commitTemplateResult(value as TemplateResult);\n } else if ((value as Node).nodeType !== undefined) {\n this._commitNode(value as Node);\n } else if (isIterable(value)) {\n this._commitIterable(value);\n } else {\n // Fallback, will render the string representation\n this._commitText(value);\n }\n }\n\n private _insert<T extends Node>(node: T, ref = this._$endNode) {\n return wrap(wrap(this._$startNode).parentNode!).insertBefore(node, ref);\n }\n\n private _commitNode(value: Node): void {\n if (this._$committedValue !== value) {\n this._$clear();\n if (\n ENABLE_EXTRA_SECURITY_HOOKS &&\n sanitizerFactoryInternal !== noopSanitizer\n ) {\n const parentNodeName = this._$startNode.parentNode?.nodeName;\n if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {\n let message = 'Forbidden';\n if (DEV_MODE) {\n if (parentNodeName === 'STYLE') {\n message =\n `Lit does not support binding inside style nodes. ` +\n `This is a security risk, as style injection attacks can ` +\n `exfiltrate data and spoof UIs. ` +\n `Consider instead using css\\`...\\` literals ` +\n `to compose styles, and make do dynamic styling with ` +\n `css custom properties, ::parts, <slot>s, ` +\n `and by mutating the DOM rather than stylesheets.`;\n } else {\n message =\n `Lit does not support binding inside script nodes. ` +\n `This is a security risk, as it could allow arbitrary ` +\n `code execution.`;\n }\n }\n throw new Error(message);\n }\n }\n this._$committedValue = this._insert(value);\n }\n }\n\n private _commitText(value: unknown): void {\n // If the committed value is a primitive it means we called _commitText on\n // the previous render, and we know that this._$startNode.nextSibling is a\n // Text node. We can now just replace the text content (.data) of the node.\n if (\n this._$committedValue !== nothing &&\n isPrimitive(this._$committedValue)\n ) {\n const node = wrap(this._$startNode).nextSibling as Text;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(node, 'data', 'property');\n }\n value = this._textSanitizer(value);\n }\n (node as Text).data = value as string;\n } else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n const textNode = document.createTextNode('');\n this._commitNode(textNode);\n // When setting text content, for security purposes it matters a lot\n // what the parent is. For example, <style> and <script> need to be\n // handled with care, while <span> does not. So first we need to put a\n // text node into the document, then we can sanitize its contentx.\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(textNode, 'data', 'property');\n }\n value = this._textSanitizer(value);\n textNode.data = value as string;\n } else {\n this._commitNode(d.createTextNode(value as string));\n }\n }\n this._$committedValue = value;\n }\n\n private _commitTemplateResult(\n result: TemplateResult | CompiledTemplateResult\n ): void {\n // This property needs to remain unminified.\n const {values, ['_$litType$']: type} = result;\n // If $litType$ is a number, result is a plain TemplateResult and we get\n // the template from the template cache. If not, result is a\n // CompiledTemplateResult and _$litType$ is a CompiledTemplate and we need\n // to create the <template> element the first time we see it.\n const template: Template | CompiledTemplate =\n typeof type === 'number'\n ? this._$getTemplate(result as TemplateResult)\n : (type.el === undefined &&\n (type.el = Template.createElement(type.h, this.options)),\n type);\n\n if ((this._$committedValue as TemplateInstance)?._$template === template) {\n (this._$committedValue as TemplateInstance)._update(values);\n } else {\n const instance = new TemplateInstance(template as Template, this);\n const fragment = instance._clone(this.options);\n instance._update(values);\n this._commitNode(fragment);\n this._$committedValue = instance;\n }\n }\n\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @internal */\n _$getTemplate(result: TemplateResult) {\n let template = templateCache.get(result.strings);\n if (template === undefined) {\n templateCache.set(result.strings, (template = new Template(result)));\n }\n return template;\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 ChildParts from the previous\n // render. If value is not an array, clear this part and make a new\n // array for ChildParts.\n if (!isArray(this._$committedValue)) {\n this._$committedValue = [];\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._$committedValue as ChildPart[];\n let partIndex = 0;\n let itemPart: ChildPart | undefined;\n\n for (const item of value) {\n if (partIndex === itemParts.length) {\n // If no existing part, create a new one\n // TODO (justinfagnani): test perf impact of always creating two parts\n // instead of sharing parts between nodes\n // https://github.com/lit/lit/issues/1266\n itemParts.push(\n (itemPart = new ChildPart(\n this._insert(createMarker()),\n this._insert(createMarker()),\n this,\n this.options\n ))\n );\n } else {\n // Reuse an existing part\n itemPart = itemParts[partIndex];\n }\n itemPart._$setValue(item);\n partIndex++;\n }\n\n if (partIndex < itemParts.length) {\n // itemParts always have end nodes\n this._$clear(\n itemPart && wrap(itemPart._$endNode!).nextSibling,\n partIndex\n );\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n }\n }\n\n /**\n * Removes the nodes contained within this Part from the DOM.\n *\n * @param start Start node to clear from, for clearing a subset of the part's\n * DOM (used when truncating iterables)\n * @param from When `start` is specified, the index within the iterable from\n * which ChildParts are being removed, used for disconnecting directives in\n * those Parts.\n *\n * @internal\n */\n _$clear(\n start: ChildNode | null = wrap(this._$startNode).nextSibling,\n from?: number\n ) {\n this._$notifyConnectionChanged?.(false, true, from);\n while (start && start !== this._$endNode) {\n const n = wrap(start!).nextSibling;\n (wrap(start!) as Element).remove();\n start = n;\n }\n }\n /**\n * Implementation of RootPart's `isConnected`. Note that this metod\n * should only be called on `RootPart`s (the `ChildPart` returned from a\n * top-level `render()` call). It has no effect on non-root ChildParts.\n * @param isConnected Whether to set\n * @internal\n */\n setConnected(isConnected: boolean) {\n if (this._$parent === undefined) {\n this.__isConnected = isConnected;\n this._$notifyConnectionChanged?.(isConnected);\n } else if (DEV_MODE) {\n throw new Error(\n 'part.setConnected() may only be called on a ' +\n 'RootPart returned from render().'\n );\n }\n }\n}\n\n/**\n * A top-level `ChildPart` returned from `render` that manages the connected\n * state of `AsyncDirective`s created throughout the tree below it.\n */\nexport interface RootPart extends ChildPart {\n /**\n * Sets the connection state for `AsyncDirective`s contained within this root\n * ChildPart.\n *\n * lit-html does not automatically monitor the connectedness of DOM rendered;\n * as such, it is the responsibility of the caller to `render` to ensure that\n * `part.setConnected(false)` is called before the part object is potentially\n * discarded, to ensure that `AsyncDirective`s have a chance to dispose of\n * any resources being held. If a `RootPart` that was prevously\n * disconnected is subsequently re-connected (and its `AsyncDirective`s should\n * re-connect), `setConnected(true)` should be called.\n *\n * @param isConnected Whether directives within this tree should be connected\n * or not\n */\n setConnected(isConnected: boolean): void;\n}\n\nexport type {AttributePart};\nclass AttributePart implements Disconnectable {\n readonly type = ATTRIBUTE_PART as\n | typeof ATTRIBUTE_PART\n | typeof PROPERTY_PART\n | typeof BOOLEAN_ATTRIBUTE_PART\n | typeof EVENT_PART;\n readonly element: HTMLElement;\n readonly name: string;\n readonly options: RenderOptions | undefined;\n\n /**\n * If this attribute part represents an interpolation, this contains the\n * static strings of the interpolation. For single-value, complete bindings,\n * this is undefined.\n */\n readonly strings?: ReadonlyArray<string>;\n /** @internal */\n _$committedValue: unknown | Array<unknown> = nothing;\n /** @internal */\n __directives?: Array<Directive | undefined>;\n /** @internal */\n _$parent: Disconnectable;\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n protected _sanitizer: ValueSanitizer | undefined;\n\n get tagName() {\n return this.element.tagName;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n constructor(\n element: HTMLElement,\n name: string,\n strings: ReadonlyArray<string>,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n this.element = element;\n this.name = name;\n this._$parent = parent;\n this.options = options;\n if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {\n this._$committedValue = new Array(strings.length - 1).fill(new String());\n this.strings = strings;\n } else {\n this._$committedValue = nothing;\n }\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n this._sanitizer = undefined;\n }\n }\n\n /**\n * Sets the value of this part by resolving the value from possibly multiple\n * values and static strings and committing it to the DOM.\n * If this part is single-valued, `this._strings` will be undefined, and the\n * method will be called with a single value argument. If this part is\n * multi-value, `this._strings` will be defined, and the method is called\n * with the value array of the part's owning TemplateInstance, and an offset\n * into the value array from which the values should be read.\n * This method is overloaded this way to eliminate short-lived array slices\n * of the template instance values, and allow a fast-path for single-valued\n * parts.\n *\n * @param value The part value, or an array of values for multi-valued parts\n * @param valueIndex the index to start reading values from. `undefined` for\n * single-valued parts\n * @param noCommit causes the part to not commit its value to the DOM. Used\n * in hydration to prime attribute parts with their first-rendered value,\n * but not set the attribute, and in SSR to no-op the DOM operation and\n * capture the value for serialization.\n *\n * @internal\n */\n _$setValue(\n value: unknown | Array<unknown>,\n directiveParent: DirectiveParent = this,\n valueIndex?: number,\n noCommit?: boolean\n ) {\n const strings = this.strings;\n\n // Whether any of the values has changed, for dirty-checking\n let change = false;\n\n if (strings === undefined) {\n // Single-value binding case\n value = resolveDirective(this, value, directiveParent, 0);\n change =\n !isPrimitive(value) ||\n (value !== this._$committedValue && value !== noChange);\n if (change) {\n this._$committedValue = value;\n }\n } else {\n // Interpolation case\n const values = value as Array<unknown>;\n value = strings[0];\n\n let i, v;\n for (i = 0; i < strings.length - 1; i++) {\n v = resolveDirective(this, values[valueIndex! + i], directiveParent, i);\n\n if (v === noChange) {\n // If the user-provided value is `noChange`, use the previous value\n v = (this._$committedValue as Array<unknown>)[i];\n }\n change ||=\n !isPrimitive(v) || v !== (this._$committedValue as Array<unknown>)[i];\n if (v === nothing) {\n value = nothing;\n } else if (value !== nothing) {\n value += (v ?? '') + strings[i + 1];\n }\n // We always record each value, even if one is `nothing`, for future\n // change detection.\n (this._$committedValue as Array<unknown>)[i] = v;\n }\n }\n if (change && !noCommit) {\n this._commitValue(value);\n }\n }\n\n /** @internal */\n _commitValue(value: unknown) {\n if (value === nothing) {\n (wrap(this.element) as Element).removeAttribute(this.name);\n } else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(\n this.element,\n this.name,\n 'attribute'\n );\n }\n value = this._sanitizer(value ?? '');\n }\n (wrap(this.element) as Element).setAttribute(\n this.name,\n (value ?? '') as string\n );\n }\n }\n}\n\nexport type {PropertyPart};\nclass PropertyPart extends AttributePart {\n override readonly type = PROPERTY_PART;\n\n /** @internal */\n override _commitValue(value: unknown) {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(\n this.element,\n this.name,\n 'property'\n );\n }\n value = this._sanitizer(value);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this.element as any)[this.name] = value === nothing ? undefined : value;\n }\n}\n\n// Temporary workaround for https://crbug.com/993268\n// Currently, any attribute starting with \"on\" is considered to be a\n// TrustedScript source. Such boolean attributes must be set to the equivalent\n// trusted emptyScript value.\nconst emptyStringForBooleanAttribute = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n\nexport type {BooleanAttributePart};\nclass BooleanAttributePart extends AttributePart {\n override readonly type = BOOLEAN_ATTRIBUTE_PART;\n\n /** @internal */\n override _commitValue(value: unknown) {\n if (value && value !== nothing) {\n (wrap(this.element) as Element).setAttribute(\n this.name,\n emptyStringForBooleanAttribute\n );\n } else {\n (wrap(this.element) as Element).removeAttribute(this.name);\n }\n }\n}\n\ntype EventListenerWithOptions = EventListenerOrEventListenerObject &\n Partial<AddEventListenerOptions>;\n\n/**\n * An AttributePart that manages an event listener via add/removeEventListener.\n *\n * This part works by adding itself as the event listener on an element, then\n * delegating to the value passed to it. This reduces the number of calls to\n * add/removeEventListener if the listener changes frequently, such as when an\n * inline function is used as a listener.\n *\n * Because event options are passed when adding listeners, we must take case\n * to add and remove the part as a listener when the event options change.\n */\nexport type {EventPart};\nclass EventPart extends AttributePart {\n override readonly type = EVENT_PART;\n\n constructor(\n element: HTMLElement,\n name: string,\n strings: ReadonlyArray<string>,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n super(element, name, strings, parent, options);\n\n if (DEV_MODE && this.strings !== undefined) {\n throw new Error(\n `A \\`<${element.localName}>\\` has a \\`@${name}=...\\` listener with ` +\n 'invalid content. Event listeners in templates must have exactly ' +\n 'one expression and no surrounding text.'\n );\n }\n }\n\n // EventPart does not use the base _$setValue/_resolveValue implementation\n // since the dirty checking is more complex\n /** @internal */\n override _$setValue(\n newListener: unknown,\n directiveParent: DirectiveParent = this\n ) {\n newListener =\n resolveDirective(this, newListener, directiveParent, 0) ?? nothing;\n if (newListener === noChange) {\n return;\n }\n const oldListener = this._$committedValue;\n\n // If the new value is nothing or any options change we have to remove the\n // part as a listener.\n const shouldRemoveListener =\n (newListener === nothing && oldListener !== nothing) ||\n (newListener as EventListenerWithOptions).capture !==\n (oldListener as EventListenerWithOptions).capture ||\n (newListener as EventListenerWithOptions).once !==\n (oldListener as EventListenerWithOptions).once ||\n (newListener as EventListenerWithOptions).passive !==\n (oldListener as EventListenerWithOptions).passive;\n\n // If the new value is not nothing and we removed the listener, we have\n // to add the part as a listener.\n const shouldAddListener =\n newListener !== nothing &&\n (oldListener === nothing || shouldRemoveListener);\n\n if (shouldRemoveListener) {\n this.element.removeEventListener(\n this.name,\n this,\n oldListener as EventListenerWithOptions\n );\n }\n if (shouldAddListener) {\n // Beware: IE11 and Chrome 41 don't like using the listener as the\n // options object. Figure out how to deal w/ this in IE11 - maybe\n // patch addEventListener?\n this.element.addEventListener(\n this.name,\n this,\n newListener as EventListenerWithOptions\n );\n }\n this._$committedValue = newListener;\n }\n\n handleEvent(event: Event) {\n if (typeof this._$committedValue === 'function') {\n this._$committedValue.call(this.options?.host ?? this.element, event);\n } else {\n (this._$committedValue as EventListenerObject).handleEvent(event);\n }\n }\n}\n\nexport type {ElementPart};\nclass ElementPart implements Disconnectable {\n readonly type = ELEMENT_PART;\n\n /** @internal */\n __directive?: Directive;\n\n // This is to ensure that every Part has a _$committedValue\n _$committedValue: undefined;\n\n /** @internal */\n _$parent!: Disconnectable;\n\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n options: RenderOptions | undefined;\n\n constructor(\n public element: Element,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n this._$parent = parent;\n this.options = options;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n _$setValue(value: unknown): void {\n resolveDirective(this, value);\n }\n}\n\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LH object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-element, which re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LH = {\n // Used in lit-ssr\n _boundAttributeSuffix: boundAttributeSuffix,\n _marker: marker,\n _markerMatch: markerMatch,\n _HTML_RESULT: HTML_RESULT,\n _getTemplateHtml: getTemplateHtml,\n // Used in hydrate\n _TemplateInstance: TemplateInstance,\n _isIterable: isIterable,\n _resolveDirective: resolveDirective,\n // Used in tests and private-ssr-support\n _ChildPart: ChildPart,\n _AttributePart: AttributePart,\n _BooleanAttributePart: BooleanAttributePart,\n _EventPart: EventPart,\n _PropertyPart: PropertyPart,\n _ElementPart: ElementPart,\n};\n\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? window.litHtmlPolyfillSupportDevMode\n : window.litHtmlPolyfillSupport;\npolyfillSupport?.(Template, ChildPart);\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(globalThis.litHtmlVersions ??= []).push('2.1.3');\nif (DEV_MODE && globalThis.litHtmlVersions.length > 1) {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. ` +\n `Loading multiple versions is not recommended.`\n );\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {Disconnectable, Part} from './lit-html';\n\nexport {\n AttributePart,\n BooleanAttributePart,\n ChildPart,\n ElementPart,\n EventPart,\n Part,\n PropertyPart,\n} from './lit-html';\n\nexport interface DirectiveClass {\n new (part: PartInfo): Directive;\n}\n\n/**\n * This utility type extracts the signature of a directive class's render()\n * method so we can use it for the type of the generated directive function.\n */\nexport type DirectiveParameters<C extends Directive> = Parameters<C['render']>;\n\n/**\n * A generated directive function doesn't evaluate the directive, but just\n * returns a DirectiveResult object that captures the arguments.\n */\nexport interface DirectiveResult<C extends DirectiveClass = DirectiveClass> {\n /**\n * This property needs to remain unminified.\n * @internal */\n ['_$litDirective$']: C;\n /** @internal */\n values: DirectiveParameters<InstanceType<C>>;\n}\n\nexport const PartType = {\n ATTRIBUTE: 1,\n CHILD: 2,\n PROPERTY: 3,\n BOOLEAN_ATTRIBUTE: 4,\n EVENT: 5,\n ELEMENT: 6,\n} as const;\n\nexport type PartType = typeof PartType[keyof typeof PartType];\n\nexport interface ChildPartInfo {\n readonly type: typeof PartType.CHILD;\n}\n\nexport interface AttributePartInfo {\n readonly type:\n | typeof PartType.ATTRIBUTE\n | typeof PartType.PROPERTY\n | typeof PartType.BOOLEAN_ATTRIBUTE\n | typeof PartType.EVENT;\n readonly strings?: ReadonlyArray<string>;\n readonly name: string;\n readonly tagName: string;\n}\n\nexport interface ElementPartInfo {\n readonly type: typeof PartType.ELEMENT;\n}\n\n/**\n * Information about the part a directive is bound to.\n *\n * This is useful for checking that a directive is attached to a valid part,\n * such as with directive that can only be used on attribute bindings.\n */\nexport type PartInfo = ChildPartInfo | AttributePartInfo | ElementPartInfo;\n\n/**\n * Creates a user-facing directive function from a Directive class. This\n * function has the same parameters as the directive's render() method.\n */\nexport const directive =\n <C extends DirectiveClass>(c: C) =>\n (...values: DirectiveParameters<InstanceType<C>>): DirectiveResult<C> => ({\n // This property needs to remain unminified.\n ['_$litDirective$']: c,\n values,\n });\n\n/**\n * Base class for creating custom directives. Users should extend this class,\n * implement `render` and/or `update`, and then pass their subclass to\n * `directive`.\n */\nexport abstract class Directive implements Disconnectable {\n //@internal\n __part!: Part;\n //@internal\n __attributeIndex: number | undefined;\n //@internal\n __directive?: Directive;\n\n //@internal\n _$parent!: Disconnectable;\n\n // These will only exist on the AsyncDirective subclass\n //@internal\n _$disconnectableChildren?: Set<Disconnectable>;\n // This property needs to remain unminified.\n //@internal\n ['_$notifyDirectiveConnectionChanged']?(isConnected: boolean): void;\n\n constructor(_partInfo: PartInfo) {}\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n /** @internal */\n _$initialize(\n part: Part,\n parent: Disconnectable,\n attributeIndex: number | undefined\n ) {\n this.__part = part;\n this._$parent = parent;\n this.__attributeIndex = attributeIndex;\n }\n /** @internal */\n _$resolve(part: Part, props: Array<unknown>): unknown {\n return this.update(part, props);\n }\n\n abstract render(...props: Array<unknown>): unknown;\n\n update(_part: Part, props: Array<unknown>): unknown {\n return this.render(...props);\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing, TemplateResult, noChange} from '../lit-html.js';\nimport {directive, Directive, PartInfo, PartType} from '../directive.js';\n\nconst HTML_RESULT = 1;\n\nexport class UnsafeHTMLDirective extends Directive {\n static directiveName = 'unsafeHTML';\n static resultType = HTML_RESULT;\n\n private _value: unknown = nothing;\n private _templateResult?: TemplateResult;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() can only be used in child bindings`\n );\n }\n }\n\n render(value: string | typeof nothing | typeof noChange | undefined | null) {\n if (value === nothing || value == null) {\n this._templateResult = undefined;\n return (this._value = value);\n }\n if (value === noChange) {\n return value;\n }\n if (typeof value != 'string') {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() called with a non-string value`\n );\n }\n if (value === this._value) {\n return this._templateResult;\n }\n this._value = value;\n const strings = [value] as unknown as TemplateStringsArray;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (strings as any).raw = strings;\n // WARNING: impersonating a TemplateResult like this is extremely\n // dangerous. Third-party directives should not do this.\n return (this._templateResult = {\n // Cast to a known set of integers that satisfy ResultType so that we\n // don't have to export ResultType and possibly encourage this pattern.\n // This property needs to remain unminified.\n ['_$litType$']: (this.constructor as typeof UnsafeHTMLDirective)\n .resultType as 1 | 2,\n strings,\n values: [],\n });\n }\n}\n\n/**\n * Renders the result as HTML, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeHTML = directive(UnsafeHTMLDirective);\n","import { createElement, updateElement, Fragment } from './vdom-my';\n\n\nimport { render, svg, html, noChange, nothing } from 'lit-html';\nimport { directive, Directive, Part, PartInfo, PartType, EventPart } from 'lit-html/directive.js';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\n\nfunction _render(element, vdom, parent?) {\n if (!vdom) return;\n if (typeof vdom === 'string') {\n render(html`${unsafeHTML(vdom)}`, element);\n } else if ('_$litType$' in vdom) {\n if (!element['_$litPart$']) element.replaceChildren();\n render(vdom, element);\n } else {\n updateElement(element, vdom, parent);\n element['_$litPart$'] = undefined;\n }\n}\n\nexport class RunDirective extends Directive {\n // State stored in class field\n value: number | undefined;\n constructor(partInfo: PartInfo) {\n super(partInfo);\n // When necessary, validate part in constructor using `part.type`\n if (partInfo.type !== PartType.EVENT) {\n throw new Error('${run} can only be used in event handlers');\n }\n }\n // Optional: override update to perform any direct DOM manipulation\n update(part: Part, params) {\n /* Any imperative updates to DOM/parts would go here */\n\n let { element, name } = part as EventPart;\n const getComponent = () => {\n let component = element['_component'];\n while (!component && element) {\n element = element.parentElement;\n component = element && element['_component'];\n }\n console.assert(!!component, 'Component not found.');\n return component;\n }\n const [event, ...args] = params;\n if (typeof event === 'string') {\n element[`on${name}`] = e => getComponent().run(event, ...args, e);\n } else if (typeof event === 'function') {\n element[`on${name}`] = e => getComponent().setState(event(getComponent().state, ...args, e));\n }\n return this.render();\n }\n render() {\n return noChange;\n }\n}\n\nconst run = directive(RunDirective) as any;\nexport { createElement, Fragment, html, svg, _render as render, run };\n\n","import app from './apprun'\nexport {\n app, Component, View, Action, Update, on, update, event, EventOptions,\n customElement, CustomElementOptions,\n ROUTER_404_EVENT, ROUTER_EVENT\n} from './apprun'\nimport { createElement, render, Fragment, html, svg, run } from './vdom-lit-html';\nexport { html, svg, render, run }\n\napp.createElement = createElement;\napp.render = render;\napp.Fragment = Fragment;\n\nexport default app;\n\nif (typeof window === 'object') {\n window['html'] = html;\n window['svg'] = svg;\n window['run'] = run;\n}\n"],"names":["App","[object Object]","this","_events","name","fn","options","push","subscribers","filter","sub","args","getSubscribers","console","assert","length","forEach","delay","Object","keys","apply","once","on","_t","clearTimeout","setTimeout","promises","map","Promise","all","events","evt","endsWith","startsWith","replace","sort","a","b","event","app","root","self","global","Fragment","props","children","collect","ch","c","Array","isArray","i","createElement","tag","undefined","getPrototypeOf","__isAppRunComponent","Error","keyCache","WeakMap","updateElement","element","nodes","parent","createComponent","isSvg","nodeName","updateChildren","update","node","el","key1","key2","toUpperCase","same","parentNode","replaceChild","create","updateProps","old_len","childNodes","new_len","len","Math","min","child","textContent","nodeType","nodeValue","createText","HTMLElement","SVGElement","insertBefore","key","old","temp","nextSibling","appendChild","n","removeChild","lastChild","d","document","createDocumentFragment","indexOf","div","insertAdjacentHTML","substring","createTextNode","JSON","stringify","createElementNS","cached","oldProps","newProps","p","mergeProps","value","cname","match","dataset","style","cssText","s","xname","toLowerCase","removeAttributeNS","setAttributeNS","setAttribute","removeAttribute","test","getAttribute","window","requestAnimationFrame","idx","vdom","id","Date","now","asTag","__componentCache","component","start","mounted","new_state","state","setState","render_component","new_parent","_component","customElement","componentClass","super","observedAttributes","attr","isConnected","opts","_shadowRoot","shadow","attachShadow","mode","attrMap","reduce","lc","_attrMap","from","attributes","item","defineProperty","get","attributeChangedCallback","configurable","enumerable","parentElement","mount","_props","dispatchEvent","bind","run","render","unload","unmount","oldValue","mappedName","customElements","define","Reflect","meta","metadataKey","metadataValue","target","has","set","descriptor","toString","defineMetadata","constructor","webComponent","getStateValue","setStateValue","directive","e","handler","type","checked","Number","multiple","selected","apply_directive","componentCache","Map","o","components","REFRESH","Component","view","_history_idx","_history","history","html","_","getElementById","tracking_attr","tracking_id","valueOf","MutationObserver","observer","changes","body","contains","disconnect","observe","childList","subtree","attributeOldValue","attributeFilter","rendered","_state","then","v","catch","err","error","renderState","enable_history","callback","global_event","prev","_history_prev","next","_history_next","route","add_actions","_global_events","action","current_state","newState","actions","getMetadataKeys","getMetadata","act","split","trim","add_action","is_global_event","_app","_actions","off","ROUTER_EVENT","ROUTER_404_EVENT","url","rest","h","model","NOOP","addEventListener","onpopstate","location","hash","hasAttribute","trustedTypes","globalThis","policy","createPolicy","createHTML","marker","random","String","slice","markerMatch","nodeMarker","createMarker","createComment","isPrimitive","textEndRegex","commentEndRegex","comment2EndRegex","tagEndRegex","singleQuoteAttrEndRegex","doubleQuoteAttrEndRegex","rawTextElement","strings","values","_$litType$","svg","noChange","Symbol","for","nothing","templateCache","container","partOwnerNode","renderBefore","part","_$litPart$","endNode","ChildPart","_$setValue","walker","createTreeWalker","getTemplateHtml","l","attrNames","rawTextEndRegex","regex","attrName","attrNameEndIndex","lastIndex","exec","RegExp","end","htmlResult","hasOwnProperty","Template","nodeIndex","attrNameIndex","partCount","parts","currentNode","content","svgElement","firstChild","remove","append","nextNode","hasAttributes","attrsToRemove","getAttributeNames","realName","statics","m","index","ctor","PropertyPart","BooleanAttributePart","EventPart","AttributePart","tagName","emptyScript","data","static","_options","innerHTML","resolveDirective","attributeIndex","currentDirective","__directives","__directive","nextDirectiveConstructor","_$litDirective$","_$AO","_$initialize","_$resolve","TemplateInstance","template","_$template","_$parent","_$isConnected","_clone","fragment","creationScope","importNode","partIndex","templatePart","ElementPart","_parts","_update","startNode","_$startNode","_$endNode","__isConnected","directiveParent","_$committedValue","_$clear","_commitText","_commitTemplateResult","_commitNode","iterator","isIterable","_commitIterable","_insert","ref","result","_$getTemplate","instance","itemParts","itemPart","_$notifyConnectionChanged","setConnected","fill","valueIndex","noCommit","change","_commitValue","emptyStringForBooleanAttribute","newListener","oldListener","shouldRemoveListener","capture","passive","shouldAddListener","removeEventListener","handleEvent","call","host","polyfillSupport","litHtmlPolyfillSupport","litHtmlVersions","PartType","Directive","_partInfo","__part","__attributeIndex","_part","UnsafeHTMLDirective","partInfo","directiveName","_templateResult","_value","raw","resultType","unsafeHTML","_render","replaceChildren","params","getComponent"],"mappings":"MACaA,EAWXC,cACEC,KAAKC,QAAU,GAGjBF,GAAGG,EAAcC,EAAuBC,EAAwB,IAC9DJ,KAAKC,QAAQC,GAAQF,KAAKC,QAAQC,IAAS,GAC3CF,KAAKC,QAAQC,GAAMG,KAAK,CAAEF,GAAAA,EAAIC,QAAAA,IAGhCL,IAAIG,EAAcC,GAChB,MAAMG,EAAcN,KAAKC,QAAQC,IAAS,GAE1CF,KAAKC,QAAQC,GAAQI,EAAYC,QAAQC,GAAQA,EAAIL,KAAOA,IAG9DJ,KAAKG,GACH,OAAOF,KAAKC,QAAQC,GAGtBH,IAAIG,KAAiBO,GACnB,MAAMH,EAAcN,KAAKU,eAAeR,EAAMF,KAAKC,SAYnD,OAXAU,QAAQC,OAAON,GAAeA,EAAYO,OAAS,EAAG,4BAA8BX,GACpFI,EAAYQ,SAASN,IACnB,MAAML,GAAEA,EAAEC,QAAEA,GAAYI,EAMxB,OALIJ,EAAQW,MACVf,KAAKe,MAAMb,EAAMC,EAAIM,EAAML,GAE3BY,OAAOC,KAAKb,GAASS,OAAS,EAAIV,EAAGe,MAAMlB,KAAM,IAAIS,EAAML,IAAYD,EAAGe,MAAMlB,KAAMS,IAEhFD,EAAIJ,QAAQe,QAGfb,EAAYO,OAG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