{"version":3,"file":"vaadin.min.js","sources":["../../node_modules/@vaadin/router/dist/vaadin-router.js","../../node_modules/@vaadin/vaadin-material-styles/version.js","../../node_modules/@vaadin/vaadin-material-styles/color.js","../../node_modules/@vaadin/vaadin-material-styles/shadow.js","../../node_modules/@vaadin/vaadin-material-styles/font-roboto.js","../../node_modules/@vaadin/vaadin-material-styles/typography.js","../../node_modules/@vaadin/vaadin-checkbox/theme/material/vaadin-checkbox-styles.js","../../node_modules/@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js","../../node_modules/@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js","../../node_modules/@vaadin/vaadin-control-state-mixin/vaadin-control-state-mixin.js","../../node_modules/@vaadin/vaadin-element-mixin/vaadin-dir-helper.js","../../node_modules/@vaadin/vaadin-element-mixin/vaadin-dir-mixin.js","../../node_modules/@vaadin/vaadin-development-mode-detector/vaadin-development-mode-detector.js","../../node_modules/@vaadin/vaadin-usage-statistics/vaadin-usage-statistics-collect.js","../../node_modules/@vaadin/vaadin-element-mixin/vaadin-element-mixin.js","../../node_modules/@vaadin/vaadin-checkbox/src/vaadin-checkbox.js","../../node_modules/@vaadin/vaadin-progress-bar/theme/material/vaadin-progress-bar-styles.js","../../node_modules/@vaadin/vaadin-progress-bar/src/vaadin-progress-mixin.js","../../node_modules/@vaadin/vaadin-progress-bar/src/vaadin-progress-bar.js","../../node_modules/@vaadin/vaadin-material-styles/mixins/required-field.js","../../node_modules/@vaadin/vaadin-material-styles/font-icons.js","../../node_modules/@vaadin/vaadin-material-styles/mixins/field-button.js","../../node_modules/@vaadin/vaadin-text-field/theme/material/vaadin-text-field-styles.js","../../node_modules/@vaadin/vaadin-text-field/src/vaadin-text-field-mixin.js","../../node_modules/@vaadin/vaadin-text-field/src/vaadin-text-field.js","../../node_modules/@vaadin/vaadin-text-field/theme/material/vaadin-password-field-styles.js","../../node_modules/@vaadin/vaadin-text-field/src/vaadin-password-field.js","../../node_modules/@vaadin/vaadin-form-layout/theme/material/vaadin-form-item-styles.js","../../node_modules/@vaadin/vaadin-form-layout/theme/material/vaadin-form-layout-styles.js","../../node_modules/@vaadin/vaadin-form-layout/src/vaadin-form-layout.js","../../node_modules/@vaadin/vaadin-button/theme/material/vaadin-button-styles.js","../../node_modules/@vaadin/vaadin-button/src/vaadin-button.js","../../node_modules/@vaadin/vaadin-tabs/theme/material/vaadin-tab-styles.js","../../node_modules/@vaadin/vaadin-item/src/vaadin-item-mixin.js","../../node_modules/@vaadin/vaadin-tabs/src/vaadin-tab.js","../../node_modules/@vaadin/vaadin-tabs/theme/material/vaadin-tabs-styles.js","../../node_modules/@vaadin/vaadin-list-mixin/vaadin-list-mixin.js","../../node_modules/@vaadin/vaadin-tabs/src/vaadin-tabs.js","../../node_modules/@vaadin/vaadin-notification/theme/material/vaadin-notification-styles.js","../../node_modules/@vaadin/vaadin-notification/src/vaadin-notification.js","../../node_modules/@vaadin/vaadin-overlay/src/vaadin-focusables-helper.js","../../node_modules/@vaadin/vaadin-overlay/src/vaadin-overlay.js","../../node_modules/@vaadin/vaadin-date-picker/src/vaadin-date-picker-overlay.js","../../node_modules/@vaadin/vaadin-date-picker/src/vaadin-date-picker-helper.js","../../node_modules/@vaadin/vaadin-date-picker/src/vaadin-month-calendar.js","../../node_modules/@vaadin/vaadin-date-picker/src/vaadin-infinite-scroller.js","../../node_modules/@vaadin/vaadin-date-picker/src/vaadin-date-picker-styles.js","../../node_modules/@vaadin/vaadin-date-picker/src/vaadin-date-picker-overlay-content.js","../../node_modules/@vaadin/vaadin-date-picker/src/vaadin-date-picker-mixin.js","../../node_modules/@vaadin/vaadin-date-picker/src/vaadin-date-picker.js","../../node_modules/@vaadin/vaadin-item/theme/material/vaadin-item-styles.js","../../node_modules/@vaadin/vaadin-item/src/vaadin-item.js","../../node_modules/@vaadin/vaadin-list-box/theme/material/vaadin-list-box-styles.js","../../node_modules/@vaadin/vaadin-list-mixin/vaadin-multi-select-list-mixin.js","../../node_modules/@vaadin/vaadin-list-box/src/vaadin-list-box.js","../../node_modules/@vaadin/vaadin-material-styles/mixins/overlay.js","../../node_modules/@vaadin/vaadin-material-styles/mixins/menu-overlay.js","../../node_modules/@vaadin/vaadin-select/theme/material/vaadin-select-styles.js","../../node_modules/@vaadin/vaadin-select/src/vaadin-select-overlay.js","../../node_modules/@vaadin/vaadin-select/src/vaadin-select-text-field.js","../../node_modules/@vaadin/vaadin-select/src/vaadin-select.js","../../node_modules/@vaadin/vaadin-grid/theme/material/vaadin-grid-styles.js","../../node_modules/@vaadin/vaadin-grid/src/iron-list.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-scroller.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-a11y-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-active-item-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-array-data-provider-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-column-resizing-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-data-provider-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-dynamic-columns-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-event-context-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-filter-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-templatizer.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-row-details-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-scroll-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-selection-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-sort-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-styling-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-drag-and-drop-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-keyboard-navigation-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-column-reordering-mixin.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-column.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-outer-scroller.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-styles.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid.js","../../node_modules/@vaadin/vaadin-grid/theme/material/vaadin-grid-sorter-styles.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-sorter.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-sort-column.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-selection-column.js","../../node_modules/@vaadin/vaadin-text-field/theme/material/vaadin-number-field-styles.js","../../node_modules/@vaadin/vaadin-text-field/src/vaadin-number-field.js","../../node_modules/@vaadin/vaadin-dropdown-menu/theme/material/vaadin-dropdown-menu-styles.js","../../node_modules/@vaadin/vaadin-dropdown-menu/src/vaadin-dropdown-menu-overlay.js","../../node_modules/@vaadin/vaadin-dropdown-menu/src/vaadin-dropdown-menu-text-field.js","../../node_modules/@vaadin/vaadin-dropdown-menu/src/vaadin-dropdown-menu.js","../../node_modules/@vaadin/vaadin-date-picker/theme/material/vaadin-date-picker-overlay-styles.js","../../node_modules/@vaadin/vaadin-date-picker/theme/material/vaadin-date-picker-overlay-content-styles.js","../../node_modules/@vaadin/vaadin-date-picker/theme/material/vaadin-month-calendar-styles.js","../../node_modules/@vaadin/vaadin-date-picker/theme/material/vaadin-date-picker-styles.js","../../node_modules/@vaadin/vaadin-text-field/theme/material/vaadin-text-area-styles.js","../../node_modules/@vaadin/vaadin-text-field/src/vaadin-text-area.js","../../node_modules/@vaadin/vaadin-checkbox/theme/material/vaadin-checkbox-group-styles.js","../../node_modules/@vaadin/vaadin-checkbox/src/vaadin-checkbox-group.js","../../node_modules/@vaadin/vaadin-combo-box/theme/material/vaadin-combo-box-dropdown-styles.js","../../node_modules/@vaadin/vaadin-combo-box/theme/material/vaadin-combo-box-item-styles.js","../../node_modules/@vaadin/vaadin-combo-box/src/vaadin-combo-box-placeholder.js","../../node_modules/@vaadin/vaadin-combo-box/src/vaadin-combo-box-mixin.js","../../node_modules/@vaadin/vaadin-combo-box/src/vaadin-combo-box-data-provider-mixin.js","../../node_modules/@vaadin/vaadin-combo-box/src/vaadin-combo-box-item.js","../../node_modules/@vaadin/vaadin-combo-box/src/vaadin-combo-box-dropdown.js","../../node_modules/@vaadin/vaadin-combo-box/src/vaadin-combo-box-dropdown-wrapper.js","../../node_modules/@vaadin/vaadin-combo-box/src/vaadin-combo-box-light.js","../../node_modules/@vaadin/vaadin-radio-button/theme/material/vaadin-radio-button-styles.js","../../node_modules/@vaadin/vaadin-radio-button/src/vaadin-radio-button.js","../../node_modules/@vaadin/vaadin-upload/theme/material/vaadin-upload-styles.js","../../node_modules/@vaadin/vaadin-upload/src/vaadin-upload-icons.js","../../node_modules/@vaadin/vaadin-upload/src/vaadin-upload-file.js","../../node_modules/@vaadin/vaadin-upload/src/vaadin-upload.js","../../node_modules/@vaadin/vaadin-text-field/src/vaadin-email-field.js","../../node_modules/@vaadin/vaadin-combo-box/theme/material/vaadin-combo-box-styles.js","../../node_modules/@vaadin/vaadin-combo-box/src/vaadin-combo-box.js","../../node_modules/@vaadin/vaadin-context-menu/theme/material/vaadin-context-menu-styles.js","../../node_modules/@vaadin/vaadin-context-menu/src/vaadin-contextmenu-event.js","../../node_modules/@vaadin/vaadin-context-menu/src/vaadin-device-detector.js","../../node_modules/@vaadin/vaadin-context-menu/src/vaadin-contextmenu-items-mixin.js","../../node_modules/@vaadin/vaadin-context-menu/src/vaadin-context-menu-overlay.js","../../node_modules/@vaadin/vaadin-context-menu/src/vaadin-context-menu.js","../../node_modules/@vaadin/vaadin-grid/theme/material/vaadin-grid-tree-toggle-styles.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-tree-toggle.js","../../node_modules/@vaadin/vaadin-radio-button/src/vaadin-radio-group.js","../../node_modules/@vaadin/vaadin-grid/src/vaadin-grid-tree-column.js"],"sourcesContent":["function toArray(objectOrArray) {\n objectOrArray = objectOrArray || [];\n return Array.isArray(objectOrArray) ? objectOrArray : [objectOrArray];\n}\n\nfunction log(msg) {\n return `[Vaadin.Router] ${msg}`;\n}\n\nfunction logValue(value) {\n if (typeof value !== 'object') {\n return String(value);\n }\n\n const stringType = Object.prototype.toString.call(value).match(/ (.*)\\]$/)[1];\n if (stringType === 'Object' || stringType === 'Array') {\n return `${stringType} ${JSON.stringify(value)}`;\n } else {\n return stringType;\n }\n}\n\nconst MODULE = 'module';\nconst NOMODULE = 'nomodule';\nconst bundleKeys = [MODULE, NOMODULE];\n\nfunction ensureBundle(src) {\n if (!src.match(/.+\\.[m]?js$/)) {\n throw new Error(\n log(`Unsupported type for bundle \"${src}\": .js or .mjs expected.`)\n );\n }\n}\n\nfunction ensureRoute(route) {\n if (!route || !isString(route.path)) {\n throw new Error(\n log(`Expected route config to be an object with a \"path\" string property, or an array of such objects`)\n );\n }\n\n const bundle = route.bundle;\n\n const stringKeys = ['component', 'redirect', 'bundle'];\n if (\n !isFunction(route.action) &&\n !Array.isArray(route.children) &&\n !isFunction(route.children) &&\n !isObject(bundle) &&\n !stringKeys.some(key => isString(route[key]))\n ) {\n throw new Error(\n log(\n `Expected route config \"${route.path}\" to include either \"${stringKeys.join('\", \"')}\" ` +\n `or \"action\" function but none found.`\n )\n );\n }\n\n if (bundle) {\n if (isString(bundle)) {\n ensureBundle(bundle);\n } else if (!bundleKeys.some(key => key in bundle)) {\n throw new Error(\n log('Expected route bundle to include either \"' + NOMODULE + '\" or \"' + MODULE + '\" keys, or both')\n );\n } else {\n bundleKeys.forEach(key => key in bundle && ensureBundle(bundle[key]));\n }\n }\n\n if (route.redirect) {\n ['bundle', 'component'].forEach(overriddenProp => {\n if (overriddenProp in route) {\n console.warn(\n log(\n `Route config \"${route.path}\" has both \"redirect\" and \"${overriddenProp}\" properties, ` +\n `and \"redirect\" will always override the latter. Did you mean to only use \"${overriddenProp}\"?`\n )\n );\n }\n });\n }\n}\n\nfunction ensureRoutes(routes) {\n toArray(routes).forEach(route => ensureRoute(route));\n}\n\nfunction loadScript(src, key) {\n let script = document.head.querySelector('script[src=\"' + src + '\"][async]');\n if (!script) {\n script = document.createElement('script');\n script.setAttribute('src', src);\n if (key === MODULE) {\n script.setAttribute('type', MODULE);\n } else if (key === NOMODULE) {\n script.setAttribute(NOMODULE, '');\n }\n script.async = true;\n }\n return new Promise((resolve, reject) => {\n script.onreadystatechange = script.onload = e => {\n script.__dynamicImportLoaded = true;\n resolve(e);\n };\n script.onerror = e => {\n if (script.parentNode) {\n script.parentNode.removeChild(script);\n }\n reject(e);\n };\n if (script.parentNode === null) {\n document.head.appendChild(script);\n } else if (script.__dynamicImportLoaded) {\n resolve();\n }\n });\n}\n\nfunction loadBundle(bundle) {\n if (isString(bundle)) {\n return loadScript(bundle);\n } else {\n return Promise.race(\n bundleKeys\n .filter(key => key in bundle)\n .map(key => loadScript(bundle[key], key))\n );\n }\n}\n\nfunction fireRouterEvent(type, detail) {\n return !window.dispatchEvent(new CustomEvent(\n `vaadin-router-${type}`,\n {cancelable: type === 'go', detail}\n ));\n}\n\nfunction isObject(o) {\n // guard against null passing the typeof check\n return typeof o === 'object' && !!o;\n}\n\nfunction isFunction(f) {\n return typeof f === 'function';\n}\n\nfunction isString(s) {\n return typeof s === 'string';\n}\n\nfunction getNotFoundError(context) {\n const error = new Error(log(`Page not found (${context.pathname})`));\n error.context = context;\n error.code = 404;\n return error;\n}\n\nconst notFoundResult = new (class NotFoundResult {})();\n\n/* istanbul ignore next: coverage is calculated in Chrome, this code is for IE */\nfunction getAnchorOrigin(anchor) {\n // IE11: on HTTP and HTTPS the default port is not included into\n // window.location.origin, so won't include it here either.\n const port = anchor.port;\n const protocol = anchor.protocol;\n const defaultHttp = protocol === 'http:' && port === '80';\n const defaultHttps = protocol === 'https:' && port === '443';\n const host = (defaultHttp || defaultHttps)\n ? anchor.hostname // does not include the port number (e.g. www.example.org)\n : anchor.host; // does include the port number (e.g. www.example.org:80)\n return `${protocol}//${host}`;\n}\n\n// The list of checks is not complete:\n// - SVG support is missing\n// - the 'rel' attribute is not considered\nfunction vaadinRouterGlobalClickHandler(event) {\n // ignore the click if the default action is prevented\n if (event.defaultPrevented) {\n return;\n }\n\n // ignore the click if not with the primary mouse button\n if (event.button !== 0) {\n return;\n }\n\n // ignore the click if a modifier key is pressed\n if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey) {\n return;\n }\n\n // find the element that the click is at (or within)\n let anchor = event.target;\n const path = event.composedPath\n ? event.composedPath()\n : (event.path || []);\n\n // FIXME(web-padawan): `Symbol.iterator` used by webcomponentsjs is broken for arrays\n // example to check: `for...of` loop here throws the \"Not yet implemented\" error\n for (let i = 0; i < path.length; i++) {\n const target = path[i];\n if (target.nodeName && target.nodeName.toLowerCase() === 'a') {\n anchor = target;\n break;\n }\n }\n\n while (anchor && anchor.nodeName.toLowerCase() !== 'a') {\n anchor = anchor.parentNode;\n }\n\n // ignore the click if not at an element\n if (!anchor || anchor.nodeName.toLowerCase() !== 'a') {\n return;\n }\n\n // ignore the click if the element has a non-default target\n if (anchor.target && anchor.target.toLowerCase() !== '_self') {\n return;\n }\n\n // ignore the click if the element has the 'download' attribute\n if (anchor.hasAttribute('download')) {\n return;\n }\n\n // ignore the click if the element has the 'router-ignore' attribute\n if (anchor.hasAttribute('router-ignore')) {\n return;\n }\n\n // ignore the click if the target URL is a fragment on the current page\n if (anchor.pathname === window.location.pathname && anchor.hash !== '') {\n return;\n }\n\n // ignore the click if the target is external to the app\n // In IE11 HTMLAnchorElement does not have the `origin` property\n const origin = anchor.origin || getAnchorOrigin(anchor);\n if (origin !== window.location.origin) {\n return;\n }\n\n // if none of the above, convert the click into a navigation event\n const {pathname, search, hash} = anchor;\n if (fireRouterEvent('go', {pathname, search, hash})) {\n event.preventDefault();\n }\n}\n\n/**\n * A navigation trigger for Vaadin Router that translated clicks on `` links\n * into Vaadin Router navigation events.\n *\n * Only regular clicks on in-app links are translated (primary mouse button, no\n * modifier keys, the target href is within the app's URL space).\n *\n * @memberOf Router.NavigationTrigger\n * @type {NavigationTrigger}\n */\nconst CLICK = {\n activate() {\n window.document.addEventListener('click', vaadinRouterGlobalClickHandler);\n },\n\n inactivate() {\n window.document.removeEventListener('click', vaadinRouterGlobalClickHandler);\n }\n};\n\n// PopStateEvent constructor shim\nconst isIE = /Trident/.test(navigator.userAgent);\n\n/* istanbul ignore next: coverage is calculated in Chrome, this code is for IE */\nif (isIE && !isFunction(window.PopStateEvent)) {\n window.PopStateEvent = function(inType, params) {\n params = params || {};\n var e = document.createEvent('Event');\n e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));\n e.state = params.state || null;\n return e;\n };\n window.PopStateEvent.prototype = window.Event.prototype;\n}\n\nfunction vaadinRouterGlobalPopstateHandler(event) {\n if (event.state === 'vaadin-router-ignore') {\n return;\n }\n const {pathname, search, hash} = window.location;\n fireRouterEvent('go', {pathname, search, hash});\n}\n\n/**\n * A navigation trigger for Vaadin Router that translates popstate events into\n * Vaadin Router navigation events.\n *\n * @memberOf Router.NavigationTrigger\n * @type {NavigationTrigger}\n */\nconst POPSTATE = {\n activate() {\n window.addEventListener('popstate', vaadinRouterGlobalPopstateHandler);\n },\n\n inactivate() {\n window.removeEventListener('popstate', vaadinRouterGlobalPopstateHandler);\n }\n};\n\n/**\n * Expose `pathToRegexp`.\n */\nvar pathToRegexp_1 = pathToRegexp;\nvar parse_1 = parse;\nvar compile_1 = compile;\nvar tokensToFunction_1 = tokensToFunction;\nvar tokensToRegExp_1 = tokensToRegExp;\n\n/**\n * Default configs.\n */\nvar DEFAULT_DELIMITER = '/';\nvar DEFAULT_DELIMITERS = './';\n\n/**\n * The main path matching regexp utility.\n *\n * @type {RegExp}\n */\nvar PATH_REGEXP = new RegExp([\n // Match escaped characters that would otherwise appear in future matches.\n // This allows the user to escape special characters that won't transform.\n '(\\\\\\\\.)',\n // Match Express-style parameters and un-named parameters with a prefix\n // and optional suffixes. Matches appear as:\n //\n // \":test(\\\\d+)?\" => [\"test\", \"\\d+\", undefined, \"?\"]\n // \"(\\\\d+)\" => [undefined, undefined, \"\\d+\", undefined]\n '(?:\\\\:(\\\\w+)(?:\\\\(((?:\\\\\\\\.|[^\\\\\\\\()])+)\\\\))?|\\\\(((?:\\\\\\\\.|[^\\\\\\\\()])+)\\\\))([+*?])?'\n].join('|'), 'g');\n\n/**\n * Parse a string for the raw tokens.\n *\n * @param {string} str\n * @param {Object=} options\n * @return {!Array}\n */\nfunction parse (str, options) {\n var tokens = [];\n var key = 0;\n var index = 0;\n var path = '';\n var defaultDelimiter = (options && options.delimiter) || DEFAULT_DELIMITER;\n var delimiters = (options && options.delimiters) || DEFAULT_DELIMITERS;\n var pathEscaped = false;\n var res;\n\n while ((res = PATH_REGEXP.exec(str)) !== null) {\n var m = res[0];\n var escaped = res[1];\n var offset = res.index;\n path += str.slice(index, offset);\n index = offset + m.length;\n\n // Ignore already escaped sequences.\n if (escaped) {\n path += escaped[1];\n pathEscaped = true;\n continue\n }\n\n var prev = '';\n var next = str[index];\n var name = res[2];\n var capture = res[3];\n var group = res[4];\n var modifier = res[5];\n\n if (!pathEscaped && path.length) {\n var k = path.length - 1;\n\n if (delimiters.indexOf(path[k]) > -1) {\n prev = path[k];\n path = path.slice(0, k);\n }\n }\n\n // Push the current path onto the tokens.\n if (path) {\n tokens.push(path);\n path = '';\n pathEscaped = false;\n }\n\n var partial = prev !== '' && next !== undefined && next !== prev;\n var repeat = modifier === '+' || modifier === '*';\n var optional = modifier === '?' || modifier === '*';\n var delimiter = prev || defaultDelimiter;\n var pattern = capture || group;\n\n tokens.push({\n name: name || key++,\n prefix: prev,\n delimiter: delimiter,\n optional: optional,\n repeat: repeat,\n partial: partial,\n pattern: pattern ? escapeGroup(pattern) : '[^' + escapeString(delimiter) + ']+?'\n });\n }\n\n // Push any remaining characters.\n if (path || index < str.length) {\n tokens.push(path + str.substr(index));\n }\n\n return tokens\n}\n\n/**\n * Compile a string to a template function for the path.\n *\n * @param {string} str\n * @param {Object=} options\n * @return {!function(Object=, Object=)}\n */\nfunction compile (str, options) {\n return tokensToFunction(parse(str, options))\n}\n\n/**\n * Expose a method for transforming tokens into the path function.\n */\nfunction tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (data, options) {\n var path = '';\n var encode = (options && options.encode) || encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n continue\n }\n\n var value = data ? data[token.name] : undefined;\n var segment;\n\n if (Array.isArray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but got array')\n }\n\n if (value.length === 0) {\n if (token.optional) continue\n\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j], token);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\"')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n segment = encode(String(value), token);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but got \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n continue\n }\n\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) path += token.prefix;\n\n continue\n }\n\n throw new TypeError('Expected \"' + token.name + '\" to be ' + (token.repeat ? 'an array' : 'a string'))\n }\n\n return path\n }\n}\n\n/**\n * Escape a regular expression string.\n *\n * @param {string} str\n * @return {string}\n */\nfunction escapeString (str) {\n return str.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, '\\\\$1')\n}\n\n/**\n * Escape the capturing group by escaping special characters and meaning.\n *\n * @param {string} group\n * @return {string}\n */\nfunction escapeGroup (group) {\n return group.replace(/([=!:$/()])/g, '\\\\$1')\n}\n\n/**\n * Get the flags for a regexp from the options.\n *\n * @param {Object} options\n * @return {string}\n */\nfunction flags (options) {\n return options && options.sensitive ? '' : 'i'\n}\n\n/**\n * Pull out keys from a regexp.\n *\n * @param {!RegExp} path\n * @param {Array=} keys\n * @return {!RegExp}\n */\nfunction regexpToRegexp (path, keys) {\n if (!keys) return path\n\n // Use a negative lookahead to match only capturing groups.\n var groups = path.source.match(/\\((?!\\?)/g);\n\n if (groups) {\n for (var i = 0; i < groups.length; i++) {\n keys.push({\n name: i,\n prefix: null,\n delimiter: null,\n optional: false,\n repeat: false,\n partial: false,\n pattern: null\n });\n }\n }\n\n return path\n}\n\n/**\n * Transform an array into a regexp.\n *\n * @param {!Array} path\n * @param {Array=} keys\n * @param {Object=} options\n * @return {!RegExp}\n */\nfunction arrayToRegexp (path, keys, options) {\n var parts = [];\n\n for (var i = 0; i < path.length; i++) {\n parts.push(pathToRegexp(path[i], keys, options).source);\n }\n\n return new RegExp('(?:' + parts.join('|') + ')', flags(options))\n}\n\n/**\n * Create a path regexp from string input.\n *\n * @param {string} path\n * @param {Array=} keys\n * @param {Object=} options\n * @return {!RegExp}\n */\nfunction stringToRegexp (path, keys, options) {\n return tokensToRegExp(parse(path, options), keys, options)\n}\n\n/**\n * Expose a function for taking tokens and returning a RegExp.\n *\n * @param {!Array} tokens\n * @param {Array=} keys\n * @param {Object=} options\n * @return {!RegExp}\n */\nfunction tokensToRegExp (tokens, keys, options) {\n options = options || {};\n\n var strict = options.strict;\n var start = options.start !== false;\n var end = options.end !== false;\n var delimiter = escapeString(options.delimiter || DEFAULT_DELIMITER);\n var delimiters = options.delimiters || DEFAULT_DELIMITERS;\n var endsWith = [].concat(options.endsWith || []).map(escapeString).concat('$').join('|');\n var route = start ? '^' : '';\n var isEndDelimited = tokens.length === 0;\n\n // Iterate over the tokens and create our regexp string.\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n route += escapeString(token);\n isEndDelimited = i === tokens.length - 1 && delimiters.indexOf(token[token.length - 1]) > -1;\n } else {\n var capture = token.repeat\n ? '(?:' + token.pattern + ')(?:' + escapeString(token.delimiter) + '(?:' + token.pattern + '))*'\n : token.pattern;\n\n if (keys) keys.push(token);\n\n if (token.optional) {\n if (token.partial) {\n route += escapeString(token.prefix) + '(' + capture + ')?';\n } else {\n route += '(?:' + escapeString(token.prefix) + '(' + capture + '))?';\n }\n } else {\n route += escapeString(token.prefix) + '(' + capture + ')';\n }\n }\n }\n\n if (end) {\n if (!strict) route += '(?:' + delimiter + ')?';\n\n route += endsWith === '$' ? '$' : '(?=' + endsWith + ')';\n } else {\n if (!strict) route += '(?:' + delimiter + '(?=' + endsWith + '))?';\n if (!isEndDelimited) route += '(?=' + delimiter + '|' + endsWith + ')';\n }\n\n return new RegExp(route, flags(options))\n}\n\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n *\n * @param {(string|RegExp|Array)} path\n * @param {Array=} keys\n * @param {Object=} options\n * @return {!RegExp}\n */\nfunction pathToRegexp (path, keys, options) {\n if (path instanceof RegExp) {\n return regexpToRegexp(path, keys)\n }\n\n if (Array.isArray(path)) {\n return arrayToRegexp(/** @type {!Array} */ (path), keys, options)\n }\n\n return stringToRegexp(/** @type {string} */ (path), keys, options)\n}\npathToRegexp_1.parse = parse_1;\npathToRegexp_1.compile = compile_1;\npathToRegexp_1.tokensToFunction = tokensToFunction_1;\npathToRegexp_1.tokensToRegExp = tokensToRegExp_1;\n\n/**\n * Universal Router (https://www.kriasoft.com/universal-router/)\n *\n * Copyright (c) 2015-present Kriasoft.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nconst {hasOwnProperty} = Object.prototype;\nconst cache = new Map();\n// see https://github.com/pillarjs/path-to-regexp/issues/148\ncache.set('|false', {\n keys: [],\n pattern: /(?:)/\n});\n\nfunction decodeParam(val) {\n try {\n return decodeURIComponent(val);\n } catch (err) {\n return val;\n }\n}\n\nfunction matchPath(routepath, path, exact, parentKeys, parentParams) {\n exact = !!exact;\n const cacheKey = `${routepath}|${exact}`;\n let regexp = cache.get(cacheKey);\n\n if (!regexp) {\n const keys = [];\n regexp = {\n keys,\n pattern: pathToRegexp_1(routepath, keys, {\n end: exact,\n strict: routepath === ''\n }),\n };\n cache.set(cacheKey, regexp);\n }\n\n const m = regexp.pattern.exec(path);\n if (!m) {\n return null;\n }\n\n const params = Object.assign({}, parentParams);\n\n for (let i = 1; i < m.length; i++) {\n const key = regexp.keys[i - 1];\n const prop = key.name;\n const value = m[i];\n if (value !== undefined || !hasOwnProperty.call(params, prop)) {\n if (key.repeat) {\n params[prop] = value ? value.split(key.delimiter).map(decodeParam) : [];\n } else {\n params[prop] = value ? decodeParam(value) : value;\n }\n }\n }\n\n return {\n path: m[0],\n keys: (parentKeys || []).concat(regexp.keys),\n params,\n };\n}\n\n/**\n * Universal Router (https://www.kriasoft.com/universal-router/)\n *\n * Copyright (c) 2015-present Kriasoft.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\n/**\n * Traverses the routes tree and matches its nodes to the given pathname from\n * the root down to the leaves. Each match consumes a part of the pathname and\n * the matching process continues for as long as there is a matching child\n * route for the remaining part of the pathname.\n *\n * The returned value is a lazily evaluated iterator.\n *\n * The leading \"/\" in a route path matters only for the root of the routes\n * tree (or if all parent routes are \"\"). In all other cases a leading \"/\" in\n * a child route path has no significance.\n *\n * The trailing \"/\" in a _route path_ matters only for the leaves of the\n * routes tree. A leaf route with a trailing \"/\" matches only a pathname that\n * also has a trailing \"/\".\n *\n * The trailing \"/\" in a route path does not affect matching of child routes\n * in any way.\n *\n * The trailing \"/\" in a _pathname_ generally does not matter (except for\n * the case of leaf nodes described above).\n *\n * The \"\" and \"/\" routes have special treatment:\n * 1. as a single route\n * the \"\" and \"/\" routes match only the \"\" and \"/\" pathnames respectively\n * 2. as a parent in the routes tree\n * the \"\" route matches any pathname without consuming any part of it\n * the \"/\" route matches any absolute pathname consuming its leading \"/\"\n * 3. as a leaf in the routes tree\n * the \"\" and \"/\" routes match only if the entire pathname is consumed by\n * the parent routes chain. In this case \"\" and \"/\" are equivalent.\n * 4. several directly nested \"\" or \"/\" routes\n * - directly nested \"\" or \"/\" routes are 'squashed' (i.e. nesting two\n * \"/\" routes does not require a double \"/\" in the pathname to match)\n * - if there are only \"\" in the parent routes chain, no part of the\n * pathname is consumed, and the leading \"/\" in the child routes' paths\n * remains significant\n *\n * Side effect:\n * - the routes tree { path: '' } matches only the '' pathname\n * - the routes tree { path: '', children: [ { path: '' } ] } matches any\n * pathname (for the tree root)\n *\n * Prefix matching can be enabled also by `children: true`.\n */\nfunction matchRoute(route, pathname, ignoreLeadingSlash, parentKeys, parentParams) {\n let match;\n let childMatches;\n let childIndex = 0;\n let routepath = route.path || '';\n if (routepath.charAt(0) === '/') {\n if (ignoreLeadingSlash) {\n routepath = routepath.substr(1);\n }\n ignoreLeadingSlash = true;\n }\n\n return {\n next(routeToSkip) {\n if (route === routeToSkip) {\n return {done: true};\n }\n\n const children = route.__children = route.__children || route.children;\n\n if (!match) {\n match = matchPath(routepath, pathname, !children, parentKeys, parentParams);\n\n if (match) {\n return {\n done: false,\n value: {\n route,\n keys: match.keys,\n params: match.params,\n path: match.path\n },\n };\n }\n }\n\n if (match && children) {\n while (childIndex < children.length) {\n if (!childMatches) {\n const childRoute = children[childIndex];\n childRoute.parent = route;\n\n let matchedLength = match.path.length;\n if (matchedLength > 0 && pathname.charAt(matchedLength) === '/') {\n matchedLength += 1;\n }\n\n childMatches = matchRoute(\n childRoute,\n pathname.substr(matchedLength),\n ignoreLeadingSlash,\n match.keys,\n match.params\n );\n }\n\n const childMatch = childMatches.next(routeToSkip);\n if (!childMatch.done) {\n return {\n done: false,\n value: childMatch.value,\n };\n }\n\n childMatches = null;\n childIndex++;\n }\n }\n\n return {done: true};\n },\n };\n}\n\n/**\n * Universal Router (https://www.kriasoft.com/universal-router/)\n *\n * Copyright (c) 2015-present Kriasoft.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nfunction resolveRoute(context) {\n if (isFunction(context.route.action)) {\n return context.route.action(context);\n }\n return undefined;\n}\n\n/**\n * Universal Router (https://www.kriasoft.com/universal-router/)\n *\n * Copyright (c) 2015-present Kriasoft.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nfunction isChildRoute(parentRoute, childRoute) {\n let route = childRoute;\n while (route) {\n route = route.parent;\n if (route === parentRoute) {\n return true;\n }\n }\n return false;\n}\n\nfunction generateErrorMessage(currentContext) {\n let errorMessage = `Path '${currentContext.pathname}' is not properly resolved due to an error.`;\n const routePath = (currentContext.route || {}).path;\n if (routePath) {\n errorMessage += ` Resolution had failed on route: '${routePath}'`;\n }\n return errorMessage;\n}\n\nfunction updateChainForRoute(context, match) {\n const {route, path} = match;\n\n if (route && !route.__synthetic) {\n const item = {path, route};\n if (!context.chain) {\n context.chain = [];\n } else {\n // Discard old items\n if (route.parent) {\n let i = context.chain.length;\n while (i-- && context.chain[i].route && context.chain[i].route !== route.parent) {\n context.chain.pop();\n }\n }\n }\n context.chain.push(item);\n }\n}\n\n/**\n */\nclass Resolver {\n constructor(routes, options = {}) {\n if (Object(routes) !== routes) {\n throw new TypeError('Invalid routes');\n }\n\n this.baseUrl = options.baseUrl || '';\n this.errorHandler = options.errorHandler;\n this.resolveRoute = options.resolveRoute || resolveRoute;\n this.context = Object.assign({resolver: this}, options.context);\n this.root = Array.isArray(routes) ? {path: '', __children: routes, parent: null, __synthetic: true} : routes;\n this.root.parent = null;\n }\n\n /**\n * Returns the current list of routes (as a shallow copy). Adding / removing\n * routes to / from the returned array does not affect the routing config,\n * but modifying the route objects does.\n *\n * @return {!Array}\n */\n getRoutes() {\n return [...this.root.__children];\n }\n\n /**\n * Sets the routing config (replacing the existing one).\n *\n * @param {!Array|!Router.Route} routes a single route or an array of those\n * (the array is shallow copied)\n */\n setRoutes(routes) {\n ensureRoutes(routes);\n const newRoutes = [...toArray(routes)];\n this.root.__children = newRoutes;\n }\n\n /**\n * Appends one or several routes to the routing config and returns the\n * effective routing config after the operation.\n *\n * @param {!Array|!Router.Route} routes a single route or an array of those\n * (the array is shallow copied)\n * @return {!Array}\n * @protected\n */\n addRoutes(routes) {\n ensureRoutes(routes);\n this.root.__children.push(...toArray(routes));\n return this.getRoutes();\n }\n\n /**\n * Removes all existing routes from the routing config.\n */\n removeRoutes() {\n this.setRoutes([]);\n }\n\n /**\n * Asynchronously resolves the given pathname, i.e. finds all routes matching\n * the pathname and tries resolving them one after another in the order they\n * are listed in the routes config until the first non-null result.\n *\n * Returns a promise that is fulfilled with the return value of an object that consists of the first\n * route handler result that returns something other than `null` or `undefined` and context used to get this result.\n *\n * If no route handlers return a non-null result, or if no route matches the\n * given pathname the returned promise is rejected with a 'page not found'\n * `Error`.\n *\n * @param {!string|!{pathname: !string}} pathnameOrContext the pathname to\n * resolve or a context object with a `pathname` property and other\n * properties to pass to the route resolver functions.\n * @return {!Promise}\n */\n resolve(pathnameOrContext) {\n const context = Object.assign(\n {},\n this.context,\n isString(pathnameOrContext) ? {pathname: pathnameOrContext} : pathnameOrContext\n );\n const match = matchRoute(\n this.root,\n this.__normalizePathname(context.pathname),\n this.baseUrl\n );\n const resolve = this.resolveRoute;\n let matches = null;\n let nextMatches = null;\n let currentContext = context;\n\n function next(resume, parent = matches.value.route, prevResult) {\n const routeToSkip = prevResult === null && matches.value.route;\n matches = nextMatches || match.next(routeToSkip);\n nextMatches = null;\n\n if (!resume) {\n if (matches.done || !isChildRoute(parent, matches.value.route)) {\n nextMatches = matches;\n return Promise.resolve(notFoundResult);\n }\n }\n\n if (matches.done) {\n return Promise.reject(getNotFoundError(context));\n }\n\n currentContext = Object.assign(\n currentContext\n ? {chain: (currentContext.chain ? currentContext.chain.slice(0) : [])}\n : {},\n context,\n matches.value\n );\n updateChainForRoute(currentContext, matches.value);\n\n return Promise.resolve(resolve(currentContext)).then(resolution => {\n if (resolution !== null && resolution !== undefined && resolution !== notFoundResult) {\n currentContext.result = resolution.result || resolution;\n return currentContext;\n }\n return next(resume, parent, resolution);\n });\n }\n\n context.next = next;\n\n return Promise.resolve()\n .then(() => next(true, this.root))\n .catch((error) => {\n const errorMessage = generateErrorMessage(currentContext);\n if (!error) {\n error = new Error(errorMessage);\n } else {\n console.warn(errorMessage);\n }\n error.context = error.context || currentContext;\n // DOMException has its own code which is read-only\n if (!(error instanceof DOMException)) {\n error.code = error.code || 500;\n }\n if (this.errorHandler) {\n currentContext.result = this.errorHandler(error);\n return currentContext;\n }\n throw error;\n });\n }\n\n /**\n * URL constructor polyfill hook. Creates and returns an URL instance.\n */\n static __createUrl(url, base) {\n return new URL(url, base);\n }\n\n /**\n * If the baseUrl property is set, transforms the baseUrl and returns the full\n * actual `base` string for using in the `new URL(path, base);` and for\n * prepernding the paths with. The returned base ends with a trailing slash.\n *\n * Otherwise, returns empty string.\n */\n get __effectiveBaseUrl() {\n return this.baseUrl\n ? this.constructor.__createUrl(\n this.baseUrl,\n document.baseURI || document.URL\n ).href.replace(/[^\\/]*$/, '')\n : '';\n }\n\n /**\n * If the baseUrl is set, matches the pathname with the router’s baseUrl,\n * and returns the local pathname with the baseUrl stripped out.\n *\n * If the pathname does not match the baseUrl, returns undefined.\n *\n * If the `baseUrl` is not set, returns the unmodified pathname argument.\n */\n __normalizePathname(pathname) {\n if (!this.baseUrl) {\n // No base URL, no need to transform the pathname.\n return pathname;\n }\n\n const base = this.__effectiveBaseUrl;\n const normalizedUrl = this.constructor.__createUrl(pathname, base).href;\n if (normalizedUrl.slice(0, base.length) === base) {\n return normalizedUrl.slice(base.length);\n }\n }\n}\n\nResolver.pathToRegexp = pathToRegexp_1;\n\n/**\n * Universal Router (https://www.kriasoft.com/universal-router/)\n *\n * Copyright (c) 2015-present Kriasoft.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nconst {pathToRegexp: pathToRegexp$1} = Resolver;\nconst cache$1 = new Map();\n\nfunction cacheRoutes(routesByName, route, routes) {\n const name = route.name || route.component;\n if (name) {\n if (routesByName.has(name)) {\n routesByName.get(name).push(route);\n } else {\n routesByName.set(name, [route]);\n }\n }\n\n if (Array.isArray(routes)) {\n for (let i = 0; i < routes.length; i++) {\n const childRoute = routes[i];\n childRoute.parent = route;\n cacheRoutes(routesByName, childRoute, childRoute.__children || childRoute.children);\n }\n }\n}\n\nfunction getRouteByName(routesByName, routeName) {\n const routes = routesByName.get(routeName);\n if (routes && routes.length > 1) {\n throw new Error(\n `Duplicate route with name \"${routeName}\".`\n + ` Try seting unique 'name' route properties.`\n );\n }\n return routes && routes[0];\n}\n\nfunction getRoutePath(route) {\n let path = route.path;\n path = Array.isArray(path) ? path[0] : path;\n return path !== undefined ? path : '';\n}\n\nfunction generateUrls(router, options = {}) {\n if (!(router instanceof Resolver)) {\n throw new TypeError('An instance of Resolver is expected');\n }\n\n const routesByName = new Map();\n\n return (routeName, params) => {\n let route = getRouteByName(routesByName, routeName);\n if (!route) {\n routesByName.clear(); // clear cache\n cacheRoutes(routesByName, router.root, router.root.__children);\n\n route = getRouteByName(routesByName, routeName);\n if (!route) {\n throw new Error(`Route \"${routeName}\" not found`);\n }\n }\n\n let regexp = cache$1.get(route.fullPath);\n if (!regexp) {\n let fullPath = getRoutePath(route);\n let rt = route.parent;\n while (rt) {\n const path = getRoutePath(rt);\n if (path) {\n fullPath = path.replace(/\\/$/, '') + '/' + fullPath.replace(/^\\//, '');\n }\n rt = rt.parent;\n }\n const tokens = pathToRegexp$1.parse(fullPath);\n const toPath = pathToRegexp$1.tokensToFunction(tokens);\n const keys = Object.create(null);\n for (let i = 0; i < tokens.length; i++) {\n if (!isString(tokens[i])) {\n keys[tokens[i].name] = true;\n }\n }\n regexp = {toPath, keys};\n cache$1.set(fullPath, regexp);\n route.fullPath = fullPath;\n }\n\n let url = regexp.toPath(params, options) || '/';\n\n if (options.stringifyQueryParams && params) {\n const queryParams = {};\n const keys = Object.keys(params);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (!regexp.keys[key]) {\n queryParams[key] = params[key];\n }\n }\n const query = options.stringifyQueryParams(queryParams);\n if (query) {\n url += query.charAt(0) === '?' ? query : `?${query}`;\n }\n }\n\n return url;\n };\n}\n\n/**\n * @typedef NavigationTrigger\n * @type {object}\n * @property {function()} activate\n * @property {function()} inactivate\n */\n\n/** @type {Array} */\nlet triggers = [];\n\nfunction setNavigationTriggers(newTriggers) {\n triggers.forEach(trigger => trigger.inactivate());\n\n newTriggers.forEach(trigger => trigger.activate());\n\n triggers = newTriggers;\n}\n\nconst willAnimate = elem => {\n const name = getComputedStyle(elem).getPropertyValue('animation-name');\n return name && name !== 'none';\n};\n\nconst waitForAnimation = (elem, cb) => {\n const listener = () => {\n elem.removeEventListener('animationend', listener);\n cb();\n };\n elem.addEventListener('animationend', listener);\n};\n\nfunction animate(elem, className) {\n elem.classList.add(className);\n\n return new Promise(resolve => {\n if (willAnimate(elem)) {\n const rect = elem.getBoundingClientRect();\n const size = `height: ${rect.bottom - rect.top}px; width: ${rect.right - rect.left}px`;\n elem.setAttribute('style', `position: absolute; ${size}`);\n waitForAnimation(elem, () => {\n elem.classList.remove(className);\n elem.removeAttribute('style');\n resolve();\n });\n } else {\n elem.classList.remove(className);\n resolve();\n }\n });\n}\n\nconst MAX_REDIRECT_COUNT = 256;\n\nfunction isResultNotEmpty(result) {\n return result !== null && result !== undefined;\n}\n\nfunction copyContextWithoutNext(context) {\n const copy = Object.assign({}, context);\n delete copy.next;\n return copy;\n}\n\nfunction createLocation({pathname = '', search = '', hash = '', chain = [], params = {}, redirectFrom, resolver}, route) {\n const routes = chain.map(item => item.route);\n return {\n baseUrl: resolver && resolver.baseUrl || '',\n pathname,\n search,\n hash,\n routes,\n route: route || routes.length && routes[routes.length - 1] || null,\n params,\n redirectFrom,\n getUrl: (userParams = {}) => getPathnameForRouter(\n Router.pathToRegexp.compile(\n getMatchedPath(routes)\n )(Object.assign({}, params, userParams)),\n resolver\n )\n };\n}\n\nfunction createRedirect(context, pathname) {\n const params = Object.assign({}, context.params);\n return {\n redirect: {\n pathname,\n from: context.pathname,\n params\n }\n };\n}\n\nfunction renderElement(context, element) {\n element.location = createLocation(context);\n const index = context.chain.map(item => item.route).indexOf(context.route);\n context.chain[index].element = element;\n return element;\n}\n\nfunction runCallbackIfPossible(callback, args, thisArg) {\n if (isFunction(callback)) {\n return callback.apply(thisArg, args);\n }\n}\n\nfunction amend(amendmentFunction, args, element) {\n return amendmentResult => {\n if (amendmentResult && (amendmentResult.cancel || amendmentResult.redirect)) {\n return amendmentResult;\n }\n\n if (element) {\n return runCallbackIfPossible(element[amendmentFunction], args, element);\n }\n };\n}\n\nfunction processNewChildren(newChildren, route) {\n if (!Array.isArray(newChildren) && !isObject(newChildren)) {\n throw new Error(\n log(\n `Incorrect \"children\" value for the route ${route.path}: expected array or object, but got ${newChildren}`\n )\n );\n }\n\n route.__children = [];\n const childRoutes = toArray(newChildren);\n for (let i = 0; i < childRoutes.length; i++) {\n ensureRoute(childRoutes[i]);\n route.__children.push(childRoutes[i]);\n }\n}\n\nfunction removeDomNodes(nodes) {\n if (nodes && nodes.length) {\n const parent = nodes[0].parentNode;\n for (let i = 0; i < nodes.length; i++) {\n parent.removeChild(nodes[i]);\n }\n }\n}\n\nfunction getPathnameForRouter(pathname, router) {\n const base = router.__effectiveBaseUrl;\n return base\n ? router.constructor.__createUrl(pathname.replace(/^\\//, ''), base).pathname\n : pathname;\n}\n\nfunction getMatchedPath(chain) {\n return chain.map(item => item.path).reduce((a, b) => {\n if (b.length) {\n return a.replace(/\\/$/, '') + '/' + b.replace(/^\\//, '');\n }\n return a;\n }, '');\n}\n\n/**\n * A simple client-side router for single-page applications. It uses\n * express-style middleware and has a first-class support for Web Components and\n * lazy-loading. Works great in Polymer and non-Polymer apps.\n *\n * Use `new Router(outlet, options)` to create a new Router instance.\n *\n * * The `outlet` parameter is a reference to the DOM node to render\n * the content into.\n *\n * * The `options` parameter is an optional object with options. The following\n * keys are supported:\n * * `baseUrl` — the initial value for [\n * the `baseUrl` property\n * ](#/classes/Router#property-baseUrl)\n *\n * The Router instance is automatically subscribed to navigation events\n * on `window`.\n *\n * See [Live Examples](#/classes/Router/demos/demo/index.html) for the detailed usage demo and code snippets.\n *\n * See also detailed API docs for the following methods, for the advanced usage:\n *\n * * [setOutlet](#/classes/Router#method-setOutlet) – should be used to configure the outlet.\n * * [setTriggers](#/classes/Router#method-setTriggers) – should be used to configure the navigation events.\n * * [setRoutes](#/classes/Router#method-setRoutes) – should be used to configure the routes.\n *\n * Only `setRoutes` has to be called manually, others are automatically invoked when creating a new instance.\n *\n * @extends Resolver\n * @demo demo/index.html\n * @summary JavaScript class that renders different DOM content depending on\n * a given path. It can re-render when triggered or automatically on\n * 'popstate' and / or 'click' events.\n */\nclass Router extends Resolver {\n\n /**\n * Creates a new Router instance with a given outlet, and\n * automatically subscribes it to navigation events on the `window`.\n * Using a constructor argument or a setter for outlet is equivalent:\n *\n * ```\n * const router = new Router();\n * router.setOutlet(outlet);\n * ```\n * @param {?Node=} outlet\n * @param {?RouterOptions=} options\n */\n constructor(outlet, options) {\n const baseElement = document.head.querySelector('base');\n const baseHref = baseElement && baseElement.getAttribute('href');\n super([], Object.assign({\n // Default options\n baseUrl: baseHref && Resolver.__createUrl(baseHref, document.URL).pathname.replace(/[^\\/]*$/, '')\n }, options));\n\n this.resolveRoute = context => this.__resolveRoute(context);\n\n const triggers = Router.NavigationTrigger;\n Router.setTriggers.apply(Router, Object.keys(triggers).map(key => triggers[key]));\n\n /**\n * The base URL for all routes in the router instance. By default,\n * if the base element exists in the ``, vaadin-router\n * takes the `` attribute value, resolves against current `document.URL`\n * and gets the `pathname` from the result.\n *\n * @public\n * @type {string}\n */\n this.baseUrl;\n\n /**\n * A promise that is settled after the current render cycle completes. If\n * there is no render cycle in progress the promise is immediately settled\n * with the last render cycle result.\n *\n * @public\n * @type {!Promise}\n */\n this.ready;\n this.ready = Promise.resolve(outlet);\n\n /**\n * Contains read-only information about the current router location:\n * pathname, active routes, parameters. See the\n * [Location type declaration](#/classes/RouterLocation)\n * for more details.\n *\n * @public\n * @type {!RouterLocation}\n */\n this.location;\n this.location = createLocation({resolver: this});\n\n this.__lastStartedRenderId = 0;\n this.__navigationEventHandler = this.__onNavigationEvent.bind(this);\n this.setOutlet(outlet);\n this.subscribe();\n // Using WeakMap instead of WeakSet because WeakSet is not supported by IE11\n this.__createdByRouter = new WeakMap();\n this.__addedByRouter = new WeakMap();\n }\n\n __resolveRoute(context) {\n const route = context.route;\n\n let callbacks = Promise.resolve();\n\n if (isFunction(route.children)) {\n callbacks = callbacks\n .then(() => route.children(copyContextWithoutNext(context)))\n .then(children => {\n // The route.children() callback might have re-written the\n // route.children property instead of returning a value\n if (!isResultNotEmpty(children) && !isFunction(route.children)) {\n children = route.children;\n }\n processNewChildren(children, route);\n });\n }\n\n const commands = {\n redirect: path => createRedirect(context, path),\n component: (component) => {\n const element = document.createElement(component);\n this.__createdByRouter.set(element, true);\n return element;\n }\n };\n\n return callbacks\n .then(() => {\n if (this.__isLatestRender(context)) {\n return runCallbackIfPossible(route.action, [context, commands], route);\n }\n })\n .then(result => {\n if (isResultNotEmpty(result)) {\n // Actions like `() => import('my-view.js')` are not expected to\n // end the resolution, despite the result is not empty. Checking\n // the result with a whitelist of values that end the resolution.\n if (result instanceof HTMLElement ||\n result.redirect ||\n result === notFoundResult) {\n return result;\n }\n }\n\n if (isString(route.redirect)) {\n return commands.redirect(route.redirect);\n }\n\n if (route.bundle) {\n return loadBundle(route.bundle)\n .then(() => {}, () => {\n throw new Error(log(`Bundle not found: ${route.bundle}. Check if the file name is correct`));\n });\n }\n })\n .then(result => {\n if (isResultNotEmpty(result)) {\n return result;\n }\n if (isString(route.component)) {\n return commands.component(route.component);\n }\n });\n }\n\n /**\n * Sets the router outlet (the DOM node where the content for the current\n * route is inserted). Any content pre-existing in the router outlet is\n * removed at the end of each render pass.\n *\n * NOTE: this method is automatically invoked first time when creating a new Router instance.\n *\n * @param {?Node} outlet the DOM node where the content for the current route\n * is inserted.\n */\n setOutlet(outlet) {\n if (outlet) {\n this.__ensureOutlet(outlet);\n }\n this.__outlet = outlet;\n }\n\n /**\n * Returns the current router outlet. The initial value is `undefined`.\n *\n * @return {?Node} the current router outlet (or `undefined`)\n */\n getOutlet() {\n return this.__outlet;\n }\n\n /**\n * Sets the routing config (replacing the existing one) and triggers a\n * navigation event so that the router outlet is refreshed according to the\n * current `window.location` and the new routing config.\n *\n * Each route object may have the following properties, listed here in the processing order:\n * * `path` – the route path (relative to the parent route if any) in the\n * [express.js syntax](https://expressjs.com/en/guide/routing.html#route-paths\").\n *\n * * `children` – an array of nested routes or a function that provides this\n * array at the render time. The function can be synchronous or asynchronous:\n * in the latter case the render is delayed until the returned promise is\n * resolved. The `children` function is executed every time when this route is\n * being rendered. This allows for dynamic route structures (e.g. backend-defined),\n * but it might have a performance impact as well. In order to avoid calling\n * the function on subsequent renders, you can override the `children` property\n * of the route object and save the calculated array there\n * (via `context.route.children = [ route1, route2, ...];`).\n * Parent routes are fully resolved before resolving the children. Children\n * 'path' values are relative to the parent ones.\n *\n * * `action` – the action that is executed before the route is resolved.\n * The value for this property should be a function, accepting `context`\n * and `commands` parameters described below. If present, this function is\n * always invoked first, disregarding of the other properties' presence.\n * The action can return a result directly or within a `Promise`, which\n * resolves to the result. If the action result is an `HTMLElement` instance,\n * a `commands.component(name)` result, a `commands.redirect(path)` result,\n * or a `context.next()` result, the current route resolution is finished,\n * and other route config properties are ignored.\n * See also **Route Actions** section in [Live Examples](#/classes/Router/demos/demo/index.html).\n *\n * * `redirect` – other route's path to redirect to. Passes all route parameters to the redirect target.\n * The target route should also be defined.\n * See also **Redirects** section in [Live Examples](#/classes/Router/demos/demo/index.html).\n *\n * * `bundle` – string containing the path to `.js` or `.mjs` bundle to load before resolving the route,\n * or the object with \"module\" and \"nomodule\" keys referring to different bundles.\n * Each bundle is only loaded once. If \"module\" and \"nomodule\" are set, only one bundle is loaded,\n * depending on whether the browser supports ES modules or not.\n * The property is ignored when either an `action` returns the result or `redirect` property is present.\n * Any error, e.g. 404 while loading bundle will cause route resolution to throw.\n * See also **Code Splitting** section in [Live Examples](#/classes/Router/demos/demo/index.html).\n *\n * * `component` – the tag name of the Web Component to resolve the route to.\n * The property is ignored when either an `action` returns the result or `redirect` property is present.\n * If route contains the `component` property (or an action that return a component)\n * and its child route also contains the `component` property, child route's component\n * will be rendered as a light dom child of a parent component.\n *\n * * `name` – the string name of the route to use in the\n * [`router.urlForName(name, params)`](#/classes/Router#method-urlForName)\n * navigation helper method.\n *\n * For any route function (`action`, `children`) defined, the corresponding `route` object is available inside the callback\n * through the `this` reference. If you need to access it, make sure you define the callback as a non-arrow function\n * because arrow functions do not have their own `this` reference.\n *\n * `context` object that is passed to `action` function holds the following properties:\n * * `context.pathname` – string with the pathname being resolved\n *\n * * `context.search` – search query string\n *\n * * `context.hash` – hash string\n *\n * * `context.params` – object with route parameters\n *\n * * `context.route` – object that holds the route that is currently being rendered.\n *\n * * `context.next()` – function for asynchronously getting the next route\n * contents from the resolution chain (if any)\n *\n * `commands` object that is passed to `action` function has\n * the following methods:\n *\n * * `commands.redirect(path)` – function that creates a redirect data\n * for the path specified.\n *\n * * `commands.component(component)` – function that creates a new HTMLElement\n * with current context. Note: the component created by this function is reused if visiting the same path twice in row.\n *\n *\n * @param {!Array|!Route} routes a single route or an array of those\n * @param {?boolean} skipRender configure the router but skip rendering the\n * route corresponding to the current `window.location` values\n *\n * @return {!Promise}\n */\n setRoutes(routes, skipRender = false) {\n this.__previousContext = undefined;\n this.__urlForName = undefined;\n super.setRoutes(routes);\n if (!skipRender) {\n this.__onNavigationEvent();\n }\n return this.ready;\n }\n\n /**\n * Asynchronously resolves the given pathname and renders the resolved route\n * component into the router outlet. If no router outlet is set at the time of\n * calling this method, or at the time when the route resolution is completed,\n * a `TypeError` is thrown.\n *\n * Returns a promise that is fulfilled with the router outlet DOM Node after\n * the route component is created and inserted into the router outlet, or\n * rejected if no route matches the given path.\n *\n * If another render pass is started before the previous one is completed, the\n * result of the previous render pass is ignored.\n *\n * @param {!string|!{pathname: !string, search: ?string, hash: ?string}} pathnameOrContext\n * the pathname to render or a context object with a `pathname` property,\n * optional `search` and `hash` properties, and other properties\n * to pass to the resolver.\n * @param {boolean=} shouldUpdateHistory\n * update browser history with the rendered location\n * @return {!Promise}\n */\n render(pathnameOrContext, shouldUpdateHistory) {\n const renderId = ++this.__lastStartedRenderId;\n const context = Object.assign(\n {\n search: '',\n hash: ''\n },\n isString(pathnameOrContext)\n ? {pathname: pathnameOrContext}\n : pathnameOrContext,\n {\n __renderId: renderId\n }\n );\n\n // Find the first route that resolves to a non-empty result\n this.ready = this.resolve(context)\n\n // Process the result of this.resolve() and handle all special commands:\n // (redirect / prevent / component). If the result is a 'component',\n // then go deeper and build the entire chain of nested components matching\n // the pathname. Also call all 'on before' callbacks along the way.\n .then(context => this.__fullyResolveChain(context))\n\n .then(context => {\n if (this.__isLatestRender(context)) {\n const previousContext = this.__previousContext;\n\n // Check if the render was prevented and make an early return in that case\n if (context === previousContext) {\n // Replace the history with the previous context\n // to make sure the URL stays the same.\n this.__updateBrowserHistory(previousContext, true);\n return this.location;\n }\n\n this.location = createLocation(context);\n\n if (shouldUpdateHistory) {\n // Replace only if first render redirects, so that we don’t leave\n // the redirecting record in the history\n this.__updateBrowserHistory(context, renderId === 1);\n }\n\n fireRouterEvent('location-changed', {router: this, location: this.location});\n\n // Skip detaching/re-attaching there are no render changes\n if (context.__skipAttach) {\n this.__copyUnchangedElements(context, previousContext);\n this.__previousContext = context;\n return this.location;\n }\n\n this.__addAppearingContent(context, previousContext);\n const animationDone = this.__animateIfNeeded(context);\n\n this.__runOnAfterEnterCallbacks(context);\n this.__runOnAfterLeaveCallbacks(context, previousContext);\n\n return animationDone.then(() => {\n if (this.__isLatestRender(context)) {\n // If there is another render pass started after this one,\n // the 'disappearing content' would be removed when the other\n // render pass calls `this.__addAppearingContent()`\n this.__removeDisappearingContent();\n\n this.__previousContext = context;\n return this.location;\n }\n });\n }\n })\n .catch(error => {\n if (renderId === this.__lastStartedRenderId) {\n if (shouldUpdateHistory) {\n this.__updateBrowserHistory(context);\n }\n removeDomNodes(this.__outlet && this.__outlet.children);\n this.location = createLocation(Object.assign(context, {resolver: this}));\n fireRouterEvent('error', Object.assign({router: this, error}, context));\n throw error;\n }\n });\n return this.ready;\n }\n\n // `topOfTheChainContextBeforeRedirects` is a context coming from Resolver.resolve().\n // It would contain a 'redirect' route or the first 'component' route that\n // matched the pathname. There might be more child 'component' routes to be\n // resolved and added into the chain. This method would find and add them.\n // `contextBeforeRedirects` is the context containing such a child component\n // route. It's only necessary when this method is called recursively (otherwise\n // it's the same as the 'top of the chain' context).\n //\n // Apart from building the chain of child components, this method would also\n // handle 'redirect' routes, call 'onBefore' callbacks and handle 'prevent'\n // and 'redirect' callback results.\n __fullyResolveChain(topOfTheChainContextBeforeRedirects,\n contextBeforeRedirects = topOfTheChainContextBeforeRedirects) {\n return this.__findComponentContextAfterAllRedirects(contextBeforeRedirects)\n // `contextAfterRedirects` is always a context with an `HTMLElement` result\n // In other cases the promise gets rejected and .then() is not called\n .then(contextAfterRedirects => {\n const redirectsHappened = contextAfterRedirects !== contextBeforeRedirects;\n const topOfTheChainContextAfterRedirects =\n redirectsHappened ? contextAfterRedirects : topOfTheChainContextBeforeRedirects;\n\n const matchedPath = getPathnameForRouter(\n getMatchedPath(contextAfterRedirects.chain),\n contextAfterRedirects.resolver\n );\n const isFound = (matchedPath === contextAfterRedirects.pathname);\n\n // Recursive method to try matching more child and sibling routes\n const findNextContextIfAny = (context, parent = context.route, prevResult) => {\n return context.next(undefined, parent, prevResult).then(nextContext => {\n if (nextContext === null || nextContext === notFoundResult) {\n // Next context is not found in children, ...\n if (isFound) {\n // ...but original context is already fully matching - use it\n return context;\n } else if (parent.parent !== null) {\n // ...and there is no full match yet - step up to check siblings\n return findNextContextIfAny(context, parent.parent, nextContext);\n } else {\n return nextContext;\n }\n }\n\n return nextContext;\n });\n };\n\n return findNextContextIfAny(contextAfterRedirects).then(nextContext => {\n if (nextContext === null || nextContext === notFoundResult) {\n throw getNotFoundError(topOfTheChainContextAfterRedirects);\n }\n\n return nextContext\n && nextContext !== notFoundResult\n && nextContext !== contextAfterRedirects\n ? this.__fullyResolveChain(topOfTheChainContextAfterRedirects, nextContext)\n : this.__amendWithOnBeforeCallbacks(contextAfterRedirects);\n });\n });\n }\n\n __findComponentContextAfterAllRedirects(context) {\n const result = context.result;\n if (result instanceof HTMLElement) {\n renderElement(context, result);\n return Promise.resolve(context);\n } else if (result.redirect) {\n return this.__redirect(result.redirect, context.__redirectCount, context.__renderId)\n .then(context => this.__findComponentContextAfterAllRedirects(context));\n } else if (result instanceof Error) {\n return Promise.reject(result);\n } else {\n return Promise.reject(\n new Error(\n log(\n `Invalid route resolution result for path \"${context.pathname}\". ` +\n `Expected redirect object or HTML element, but got: \"${logValue(result)}\". ` +\n `Double check the action return value for the route.`\n )\n ));\n }\n }\n\n __amendWithOnBeforeCallbacks(contextWithFullChain) {\n return this.__runOnBeforeCallbacks(contextWithFullChain).then(amendedContext => {\n if (amendedContext === this.__previousContext || amendedContext === contextWithFullChain) {\n return amendedContext;\n }\n return this.__fullyResolveChain(amendedContext);\n });\n }\n\n __runOnBeforeCallbacks(newContext) {\n const previousContext = this.__previousContext || {};\n const previousChain = previousContext.chain || [];\n const newChain = newContext.chain;\n\n let callbacks = Promise.resolve();\n const prevent = () => ({cancel: true});\n const redirect = (pathname) => createRedirect(newContext, pathname);\n\n newContext.__divergedChainIndex = 0;\n newContext.__skipAttach = false;\n if (previousChain.length) {\n for (let i = 0; i < Math.min(previousChain.length, newChain.length); i = ++newContext.__divergedChainIndex) {\n if (previousChain[i].route !== newChain[i].route\n || previousChain[i].path !== newChain[i].path && previousChain[i].element !== newChain[i].element\n || !this.__isReusableElement(previousChain[i].element, newChain[i].element)) {\n break;\n }\n }\n\n // Skip re-attaching and notifications if element and chain do not change\n newContext.__skipAttach =\n // Same route chain\n newChain.length === previousChain.length && newContext.__divergedChainIndex == newChain.length &&\n // Same element\n this.__isReusableElement(newContext.result, previousContext.result);\n\n if (newContext.__skipAttach) {\n // execute onBeforeLeave for changed segment element when skipping attach\n for (let i = newChain.length - 1; i >= 0; i--) {\n callbacks = this.__runOnBeforeLeaveCallbacks(callbacks, newContext, {prevent}, previousChain[i]);\n }\n // execute onBeforeEnter for changed segment element when skipping attach\n for (let i = 0; i < newChain.length; i++) {\n callbacks = this.__runOnBeforeEnterCallbacks(callbacks, newContext, {prevent, redirect}, newChain[i]);\n previousChain[i].element.location = createLocation(newContext, previousChain[i].route);\n }\n\n } else {\n // execute onBeforeLeave when NOT skipping attach\n for (let i = previousChain.length - 1; i >= newContext.__divergedChainIndex; i--) {\n callbacks = this.__runOnBeforeLeaveCallbacks(callbacks, newContext, {prevent}, previousChain[i]);\n }\n }\n }\n // execute onBeforeEnter when NOT skipping attach\n if (!newContext.__skipAttach) {\n for (let i = 0; i < newChain.length; i++) {\n if (i < newContext.__divergedChainIndex) {\n if (i < previousChain.length && previousChain[i].element) {\n previousChain[i].element.location = createLocation(newContext, previousChain[i].route);\n }\n } else {\n callbacks = this.__runOnBeforeEnterCallbacks(callbacks, newContext, {prevent, redirect}, newChain[i]);\n if (newChain[i].element) {\n newChain[i].element.location = createLocation(newContext, newChain[i].route);\n }\n }\n }\n }\n return callbacks.then(amendmentResult => {\n if (amendmentResult) {\n if (amendmentResult.cancel) {\n this.__previousContext.__renderId = newContext.__renderId;\n return this.__previousContext;\n }\n if (amendmentResult.redirect) {\n return this.__redirect(amendmentResult.redirect, newContext.__redirectCount, newContext.__renderId);\n }\n }\n return newContext;\n });\n }\n\n __runOnBeforeLeaveCallbacks(callbacks, newContext, commands, chainElement) {\n const location = createLocation(newContext);\n return callbacks.then(result => {\n if (this.__isLatestRender(newContext)) {\n const afterLeaveFunction = amend('onBeforeLeave', [location, commands, this], chainElement.element);\n return afterLeaveFunction(result);\n }\n }).then(result => {\n if (!(result || {}).redirect) {\n return result;\n }\n });\n }\n\n __runOnBeforeEnterCallbacks(callbacks, newContext, commands, chainElement) {\n const location = createLocation(newContext, chainElement.route);\n return callbacks.then(result => {\n if (this.__isLatestRender(newContext)) {\n const beforeEnterFunction = amend('onBeforeEnter', [location, commands, this], chainElement.element);\n return beforeEnterFunction(result);\n }\n });\n }\n\n __isReusableElement(element, otherElement) {\n if (element && otherElement) {\n return this.__createdByRouter.get(element) && this.__createdByRouter.get(otherElement)\n ? element.localName === otherElement.localName\n : element === otherElement;\n }\n return false;\n }\n\n __isLatestRender(context) {\n return context.__renderId === this.__lastStartedRenderId;\n }\n\n __redirect(redirectData, counter, renderId) {\n if (counter > MAX_REDIRECT_COUNT) {\n throw new Error(log(`Too many redirects when rendering ${redirectData.from}`));\n }\n\n return this.resolve({\n pathname: this.urlForPath(\n redirectData.pathname,\n redirectData.params\n ),\n redirectFrom: redirectData.from,\n __redirectCount: (counter || 0) + 1,\n __renderId: renderId\n });\n }\n\n __ensureOutlet(outlet = this.__outlet) {\n if (!(outlet instanceof Node)) {\n throw new TypeError(log(`Expected router outlet to be a valid DOM Node (but got ${outlet})`));\n }\n }\n\n __updateBrowserHistory({pathname, search = '', hash = ''}, replace) {\n if (window.location.pathname !== pathname\n || window.location.search !== search\n || window.location.hash !== hash\n ) {\n const changeState = replace ? 'replaceState' : 'pushState';\n window.history[changeState](null, document.title, pathname + search + hash);\n window.dispatchEvent(new PopStateEvent('popstate', {state: 'vaadin-router-ignore'}));\n }\n }\n\n __copyUnchangedElements(context, previousContext) {\n // Find the deepest common parent between the last and the new component\n // chains. Update references for the unchanged elements in the new chain\n let deepestCommonParent = this.__outlet;\n for (let i = 0; i < context.__divergedChainIndex; i++) {\n const unchangedElement = previousContext && previousContext.chain[i].element;\n if (unchangedElement) {\n if (unchangedElement.parentNode === deepestCommonParent) {\n context.chain[i].element = unchangedElement;\n deepestCommonParent = unchangedElement;\n } else {\n break;\n }\n }\n }\n return deepestCommonParent;\n }\n\n __addAppearingContent(context, previousContext) {\n this.__ensureOutlet();\n\n // If the previous 'entering' animation has not completed yet,\n // stop it and remove that content from the DOM before adding new one.\n this.__removeAppearingContent();\n\n // Copy reusable elements from the previousContext to current\n const deepestCommonParent = this.__copyUnchangedElements(context, previousContext);\n\n // Keep two lists of DOM elements:\n // - those that should be removed once the transition animation is over\n // - and those that should remain\n this.__appearingContent = [];\n this.__disappearingContent = Array\n .from(deepestCommonParent.children)\n .filter(\n // Only remove layout content that was added by router\n e => this.__addedByRouter.get(e) &&\n // Do not remove the result element to avoid flickering\n e !== context.result);\n\n // Add new elements (starting after the deepest common parent) to the DOM.\n // That way only the components that are actually different between the two\n // locations are added to the DOM (and those that are common remain in the\n // DOM without first removing and then adding them again).\n let parentElement = deepestCommonParent;\n for (let i = context.__divergedChainIndex; i < context.chain.length; i++) {\n const elementToAdd = context.chain[i].element;\n if (elementToAdd) {\n parentElement.appendChild(elementToAdd);\n this.__addedByRouter.set(elementToAdd, true);\n if (parentElement === deepestCommonParent) {\n this.__appearingContent.push(elementToAdd);\n }\n parentElement = elementToAdd;\n }\n }\n }\n\n __removeDisappearingContent() {\n if (this.__disappearingContent) {\n removeDomNodes(this.__disappearingContent);\n }\n this.__disappearingContent = null;\n this.__appearingContent = null;\n }\n\n __removeAppearingContent() {\n if (this.__disappearingContent && this.__appearingContent) {\n removeDomNodes(this.__appearingContent);\n this.__disappearingContent = null;\n this.__appearingContent = null;\n }\n }\n\n __runOnAfterLeaveCallbacks(currentContext, targetContext) {\n if (!targetContext) {\n return;\n }\n\n // REVERSE iteration: from Z to A\n for (let i = targetContext.chain.length - 1; i >= currentContext.__divergedChainIndex; i--) {\n if (!this.__isLatestRender(currentContext)) {\n break;\n }\n const currentComponent = targetContext.chain[i].element;\n if (!currentComponent) {\n continue;\n }\n try {\n const location = createLocation(currentContext);\n runCallbackIfPossible(\n currentComponent.onAfterLeave,\n [location, {}, targetContext.resolver],\n currentComponent);\n } finally {\n if (this.__disappearingContent.indexOf(currentComponent) > -1) {\n removeDomNodes(currentComponent.children);\n }\n }\n }\n }\n\n __runOnAfterEnterCallbacks(currentContext) {\n // forward iteration: from A to Z\n for (let i = currentContext.__divergedChainIndex; i < currentContext.chain.length; i++) {\n if (!this.__isLatestRender(currentContext)) {\n break;\n }\n const currentComponent = currentContext.chain[i].element || {};\n const location = createLocation(currentContext, currentContext.chain[i].route);\n runCallbackIfPossible(\n currentComponent.onAfterEnter,\n [location, {}, currentContext.resolver],\n currentComponent);\n }\n }\n\n __animateIfNeeded(context) {\n const from = (this.__disappearingContent || [])[0];\n const to = (this.__appearingContent || [])[0];\n const promises = [];\n\n const chain = context.chain;\n let config;\n for (let i = chain.length; i > 0; i--) {\n if (chain[i - 1].route.animate) {\n config = chain[i - 1].route.animate;\n break;\n }\n }\n\n if (from && to && config) {\n const leave = isObject(config) && config.leave || 'leaving';\n const enter = isObject(config) && config.enter || 'entering';\n promises.push(animate(from, leave));\n promises.push(animate(to, enter));\n }\n\n return Promise.all(promises).then(() => context);\n }\n\n /**\n * Subscribes this instance to navigation events on the `window`.\n *\n * NOTE: beware of resource leaks. For as long as a router instance is\n * subscribed to navigation events, it won't be garbage collected.\n */\n subscribe() {\n window.addEventListener('vaadin-router-go', this.__navigationEventHandler);\n }\n\n /**\n * Removes the subscription to navigation events created in the `subscribe()`\n * method.\n */\n unsubscribe() {\n window.removeEventListener('vaadin-router-go', this.__navigationEventHandler);\n }\n\n __onNavigationEvent(event) {\n const {pathname, search, hash} = event ? event.detail : window.location;\n if (isString(this.__normalizePathname(pathname))) {\n if (event && event.preventDefault) {\n event.preventDefault();\n }\n this.render({pathname, search, hash}, true);\n }\n }\n\n /**\n * Configures what triggers Router navigation events:\n * - `POPSTATE`: popstate events on the current `window`\n * - `CLICK`: click events on `` links leading to the current page\n *\n * This method is invoked with the pre-configured values when creating a new Router instance.\n * By default, both `POPSTATE` and `CLICK` are enabled. This setup is expected to cover most of the use cases.\n *\n * See the `router-config.js` for the default navigation triggers config. Based on it, you can\n * create the own one and only import the triggers you need, instead of pulling in all the code,\n * e.g. if you want to handle `click` differently.\n *\n * See also **Navigation Triggers** section in [Live Examples](#/classes/Router/demos/demo/index.html).\n *\n * @param {...NavigationTrigger} triggers\n */\n static setTriggers(...triggers) {\n setNavigationTriggers(triggers);\n }\n\n /**\n * Generates a URL for the route with the given name, optionally performing\n * substitution of parameters.\n *\n * The route is searched in all the Router instances subscribed to\n * navigation events.\n *\n * **Note:** For child route names, only array children are considered.\n * It is not possible to generate URLs using a name for routes set with\n * a children function.\n *\n * @function urlForName\n * @param {!string} name the route name or the route’s `component` name.\n * @param {Params=} params Optional object with route path parameters.\n * Named parameters are passed by name (`params[name] = value`), unnamed\n * parameters are passed by index (`params[index] = value`).\n *\n * @return {string}\n */\n urlForName(name, params) {\n if (!this.__urlForName) {\n this.__urlForName = generateUrls(this);\n }\n return getPathnameForRouter(\n this.__urlForName(name, params),\n this\n );\n }\n\n /**\n * Generates a URL for the given route path, optionally performing\n * substitution of parameters.\n *\n * @param {!string} path string route path declared in [express.js syntax](https://expressjs.com/en/guide/routing.html#route-paths\").\n * @param {Params=} params Optional object with route path parameters.\n * Named parameters are passed by name (`params[name] = value`), unnamed\n * parameters are passed by index (`params[index] = value`).\n *\n * @return {string}\n */\n urlForPath(path, params) {\n return getPathnameForRouter(\n Router.pathToRegexp.compile(path)(params),\n this\n );\n }\n\n /**\n * Triggers navigation to a new path. Returns a boolean without waiting until\n * the navigation is complete. Returns `true` if at least one `Router`\n * has handled the navigation (was subscribed and had `baseUrl` matching\n * the `path` argument), otherwise returns `false`.\n *\n * @param {!string|!{pathname: !string, search: (string|undefined), hash: (string|undefined)}} path\n * a new in-app path string, or an URL-like object with `pathname`\n * string property, and optional `search` and `hash` string properties.\n * @return {boolean}\n */\n static go(path) {\n const {pathname, search, hash} = isString(path)\n ? this.__createUrl(path, 'http://a') // some base to omit origin\n : path;\n return fireRouterEvent('go', {pathname, search, hash});\n }\n}\n\nconst DEV_MODE_CODE_REGEXP =\n /\\/\\*\\*\\s+vaadin-dev-mode:start([\\s\\S]*)vaadin-dev-mode:end\\s+\\*\\*\\//i;\n\nconst FlowClients = window.Vaadin && window.Vaadin.Flow && window.Vaadin.Flow.clients;\n\nfunction isMinified() {\n function test() {\n /** vaadin-dev-mode:start\n return false;\n vaadin-dev-mode:end **/\n return true;\n }\n return uncommentAndRun(test);\n}\n\nfunction isDevelopmentMode() {\n try {\n if (isForcedDevelopmentMode()) {\n return true;\n }\n\n if (!isLocalhost()) {\n return false;\n }\n\n if (FlowClients) {\n return !isFlowProductionMode();\n }\n\n return !isMinified();\n } catch (e) {\n // Some error in this code, assume production so no further actions will be taken\n return false;\n }\n}\n\nfunction isForcedDevelopmentMode() {\n return localStorage.getItem(\"vaadin.developmentmode.force\");\n}\n\nfunction isLocalhost() {\n return ([\"localhost\",\"127.0.0.1\"].indexOf(window.location.hostname) >= 0);\n}\n\nfunction isFlowProductionMode() {\n if (FlowClients) {\n const productionModeApps = Object.keys(FlowClients)\n .map(key => FlowClients[key])\n .filter(client => client.productionMode);\n if (productionModeApps.length > 0) {\n return true;\n }\n }\n return false;\n}\n\nfunction uncommentAndRun(callback, args) {\n if (typeof callback !== 'function') {\n return;\n }\n\n const match = DEV_MODE_CODE_REGEXP.exec(callback.toString());\n if (match) {\n try {\n // requires CSP: script-src 'unsafe-eval'\n callback = new Function(match[1]);\n } catch (e) {\n // eat the exception\n console.log('vaadin-development-mode-detector: uncommentAndRun() failed', e);\n }\n }\n\n return callback(args);\n}\n\n// A guard against polymer-modulizer removing the window.Vaadin\n// initialization above.\nwindow['Vaadin'] = window['Vaadin'] || {};\n\n/**\n * Inspects the source code of the given `callback` function for\n * specially-marked _commented_ code. If such commented code is found in the\n * callback source, uncomments and runs that code instead of the callback\n * itself. Otherwise runs the callback as is.\n *\n * The optional arguments are passed into the callback / uncommented code,\n * the result is returned.\n *\n * See the `isMinified()` function source code in this file for an example.\n *\n */\nconst runIfDevelopmentMode = function(callback, args) {\n if (window.Vaadin.developmentMode) {\n return uncommentAndRun(callback, args);\n }\n};\n\nif (window.Vaadin.developmentMode === undefined) {\n window.Vaadin.developmentMode = isDevelopmentMode();\n}\n\n/* This file is autogenerated from src/vaadin-usage-statistics.tpl.html */\n\nfunction maybeGatherAndSendStats() {\n /** vaadin-dev-mode:start\n (function () {\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n} : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n};\n\nvar classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\nvar createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\nvar getPolymerVersion = function getPolymerVersion() {\n return window.Polymer && window.Polymer.version;\n};\n\nvar StatisticsGatherer = function () {\n function StatisticsGatherer(logger) {\n classCallCheck(this, StatisticsGatherer);\n\n this.now = new Date().getTime();\n this.logger = logger;\n }\n\n createClass(StatisticsGatherer, [{\n key: 'frameworkVersionDetectors',\n value: function frameworkVersionDetectors() {\n return {\n 'Flow': function Flow() {\n if (window.Vaadin && window.Vaadin.Flow && window.Vaadin.Flow.clients) {\n var flowVersions = Object.keys(window.Vaadin.Flow.clients).map(function (key) {\n return window.Vaadin.Flow.clients[key];\n }).filter(function (client) {\n return client.getVersionInfo;\n }).map(function (client) {\n return client.getVersionInfo().flow;\n });\n if (flowVersions.length > 0) {\n return flowVersions[0];\n }\n }\n },\n 'Vaadin Framework': function VaadinFramework() {\n if (window.vaadin && window.vaadin.clients) {\n var frameworkVersions = Object.values(window.vaadin.clients).filter(function (client) {\n return client.getVersionInfo;\n }).map(function (client) {\n return client.getVersionInfo().vaadinVersion;\n });\n if (frameworkVersions.length > 0) {\n return frameworkVersions[0];\n }\n }\n },\n 'AngularJs': function AngularJs() {\n if (window.angular && window.angular.version && window.angular.version) {\n return window.angular.version.full;\n }\n },\n 'Angular': function Angular() {\n if (window.ng) {\n var tags = document.querySelectorAll(\"[ng-version]\");\n if (tags.length > 0) {\n return tags[0].getAttribute(\"ng-version\");\n }\n return \"Unknown\";\n }\n },\n 'Backbone.js': function BackboneJs() {\n if (window.Backbone) {\n return window.Backbone.VERSION;\n }\n },\n 'React': function React() {\n var reactSelector = '[data-reactroot], [data-reactid]';\n if (!!document.querySelector(reactSelector)) {\n // React does not publish the version by default\n return \"unknown\";\n }\n },\n 'Ember': function Ember() {\n if (window.Em && window.Em.VERSION) {\n return window.Em.VERSION;\n } else if (window.Ember && window.Ember.VERSION) {\n return window.Ember.VERSION;\n }\n },\n 'jQuery': function (_jQuery) {\n function jQuery() {\n return _jQuery.apply(this, arguments);\n }\n\n jQuery.toString = function () {\n return _jQuery.toString();\n };\n\n return jQuery;\n }(function () {\n if (typeof jQuery === 'function' && jQuery.prototype.jquery !== undefined) {\n return jQuery.prototype.jquery;\n }\n }),\n 'Polymer': function Polymer() {\n var version = getPolymerVersion();\n if (version) {\n return version;\n }\n },\n 'LitElement': function LitElement() {\n var version = window.litElementVersions && window.litElementVersions[0];\n if (version) {\n return version;\n }\n },\n 'LitHtml': function LitHtml() {\n var version = window.litHtmlVersions && window.litHtmlVersions[0];\n if (version) {\n return version;\n }\n },\n 'Vue.js': function VueJs() {\n if (window.Vue) {\n return window.Vue.version;\n }\n }\n };\n }\n }, {\n key: 'getUsedVaadinElements',\n value: function getUsedVaadinElements(elements) {\n var version = getPolymerVersion();\n var elementClasses = void 0;\n // NOTE: In case you edit the code here, YOU MUST UPDATE any statistics reporting code in Flow.\n // Check all locations calling the method getEntries() in\n // https://github.com/vaadin/flow/blob/master/flow-server/src/main/java/com/vaadin/flow/internal/UsageStatistics.java#L106\n // Currently it is only used by BootstrapHandler.\n if (version && version.indexOf('2') === 0) {\n // Polymer 2: components classes are stored in window.Vaadin\n elementClasses = Object.keys(window.Vaadin).map(function (c) {\n return window.Vaadin[c];\n }).filter(function (c) {\n return c.is;\n });\n } else {\n // Polymer 3: components classes are stored in window.Vaadin.registrations\n elementClasses = window.Vaadin.registrations || [];\n }\n elementClasses.forEach(function (klass) {\n var version = klass.version ? klass.version : \"0.0.0\";\n elements[klass.is] = { version: version };\n });\n }\n }, {\n key: 'getUsedVaadinThemes',\n value: function getUsedVaadinThemes(themes) {\n ['Lumo', 'Material'].forEach(function (themeName) {\n var theme;\n var version = getPolymerVersion();\n if (version && version.indexOf('2') === 0) {\n // Polymer 2: themes are stored in window.Vaadin\n theme = window.Vaadin[themeName];\n } else {\n // Polymer 3: themes are stored in custom element registry\n theme = customElements.get('vaadin-' + themeName.toLowerCase() + '-styles');\n }\n if (theme && theme.version) {\n themes[themeName] = { version: theme.version };\n }\n });\n }\n }, {\n key: 'getFrameworks',\n value: function getFrameworks(frameworks) {\n var detectors = this.frameworkVersionDetectors();\n Object.keys(detectors).forEach(function (framework) {\n var detector = detectors[framework];\n try {\n var version = detector();\n if (version) {\n frameworks[framework] = { version: version };\n }\n } catch (e) {}\n });\n }\n }, {\n key: 'gather',\n value: function gather(storage) {\n var storedStats = storage.read();\n var gatheredStats = {};\n var types = [\"elements\", \"frameworks\", \"themes\"];\n\n types.forEach(function (type) {\n gatheredStats[type] = {};\n if (!storedStats[type]) {\n storedStats[type] = {};\n }\n });\n\n var previousStats = JSON.stringify(storedStats);\n\n this.getUsedVaadinElements(gatheredStats.elements);\n this.getFrameworks(gatheredStats.frameworks);\n this.getUsedVaadinThemes(gatheredStats.themes);\n\n var now = this.now;\n types.forEach(function (type) {\n var keys = Object.keys(gatheredStats[type]);\n keys.forEach(function (key) {\n if (!storedStats[type][key] || _typeof(storedStats[type][key]) != _typeof({})) {\n storedStats[type][key] = { firstUsed: now };\n }\n // Discards any previously logged version number\n storedStats[type][key].version = gatheredStats[type][key].version;\n storedStats[type][key].lastUsed = now;\n });\n });\n\n var newStats = JSON.stringify(storedStats);\n storage.write(newStats);\n if (newStats != previousStats && Object.keys(storedStats).length > 0) {\n this.logger.debug(\"New stats: \" + newStats);\n }\n }\n }]);\n return StatisticsGatherer;\n}();\n\nvar StatisticsStorage = function () {\n function StatisticsStorage(key) {\n classCallCheck(this, StatisticsStorage);\n\n this.key = key;\n }\n\n createClass(StatisticsStorage, [{\n key: 'read',\n value: function read() {\n var localStorageStatsString = localStorage.getItem(this.key);\n try {\n return JSON.parse(localStorageStatsString ? localStorageStatsString : '{}');\n } catch (e) {\n return {};\n }\n }\n }, {\n key: 'write',\n value: function write(data) {\n localStorage.setItem(this.key, data);\n }\n }, {\n key: 'clear',\n value: function clear() {\n localStorage.removeItem(this.key);\n }\n }, {\n key: 'isEmpty',\n value: function isEmpty() {\n var storedStats = this.read();\n var empty = true;\n Object.keys(storedStats).forEach(function (key) {\n if (Object.keys(storedStats[key]).length > 0) {\n empty = false;\n }\n });\n\n return empty;\n }\n }]);\n return StatisticsStorage;\n}();\n\nvar StatisticsSender = function () {\n function StatisticsSender(url, logger) {\n classCallCheck(this, StatisticsSender);\n\n this.url = url;\n this.logger = logger;\n }\n\n createClass(StatisticsSender, [{\n key: 'send',\n value: function send(data, errorHandler) {\n var logger = this.logger;\n\n if (navigator.onLine === false) {\n logger.debug(\"Offline, can't send\");\n errorHandler();\n return;\n }\n logger.debug(\"Sending data to \" + this.url);\n\n var req = new XMLHttpRequest();\n req.withCredentials = true;\n req.addEventListener(\"load\", function () {\n // Stats sent, nothing more to do\n logger.debug(\"Response: \" + req.responseText);\n });\n req.addEventListener(\"error\", function () {\n logger.debug(\"Send failed\");\n errorHandler();\n });\n req.addEventListener(\"abort\", function () {\n logger.debug(\"Send aborted\");\n errorHandler();\n });\n req.open(\"POST\", this.url);\n req.setRequestHeader(\"Content-Type\", \"application/json\");\n req.send(data);\n }\n }]);\n return StatisticsSender;\n}();\n\nvar StatisticsLogger = function () {\n function StatisticsLogger(id) {\n classCallCheck(this, StatisticsLogger);\n\n this.id = id;\n }\n\n createClass(StatisticsLogger, [{\n key: '_isDebug',\n value: function _isDebug() {\n return localStorage.getItem(\"vaadin.\" + this.id + \".debug\");\n }\n }, {\n key: 'debug',\n value: function debug(msg) {\n if (this._isDebug()) {\n console.info(this.id + \": \" + msg);\n }\n }\n }]);\n return StatisticsLogger;\n}();\n\nvar UsageStatistics = function () {\n function UsageStatistics() {\n classCallCheck(this, UsageStatistics);\n\n this.now = new Date();\n this.timeNow = this.now.getTime();\n this.gatherDelay = 10; // Delay between loading this file and gathering stats\n this.initialDelay = 24 * 60 * 60;\n\n this.logger = new StatisticsLogger(\"statistics\");\n this.storage = new StatisticsStorage(\"vaadin.statistics.basket\");\n this.gatherer = new StatisticsGatherer(this.logger);\n this.sender = new StatisticsSender(\"https://tools.vaadin.com/usage-stats/submit\", this.logger);\n }\n\n createClass(UsageStatistics, [{\n key: 'maybeGatherAndSend',\n value: function maybeGatherAndSend() {\n var _this = this;\n\n if (localStorage.getItem(UsageStatistics.optOutKey)) {\n return;\n }\n this.gatherer.gather(this.storage);\n setTimeout(function () {\n _this.maybeSend();\n }, this.gatherDelay * 1000);\n }\n }, {\n key: 'lottery',\n value: function lottery() {\n return true;\n }\n }, {\n key: 'currentMonth',\n value: function currentMonth() {\n return this.now.getYear() * 12 + this.now.getMonth();\n }\n }, {\n key: 'maybeSend',\n value: function maybeSend() {\n var firstUse = Number(localStorage.getItem(UsageStatistics.firstUseKey));\n var monthProcessed = Number(localStorage.getItem(UsageStatistics.monthProcessedKey));\n\n if (!firstUse) {\n // Use a grace period to avoid interfering with tests, incognito mode etc\n firstUse = this.timeNow;\n localStorage.setItem(UsageStatistics.firstUseKey, firstUse);\n }\n\n if (this.timeNow < firstUse + this.initialDelay * 1000) {\n this.logger.debug(\"No statistics will be sent until the initial delay of \" + this.initialDelay + \"s has passed\");\n return;\n }\n if (this.currentMonth() <= monthProcessed) {\n this.logger.debug(\"This month has already been processed\");\n return;\n }\n localStorage.setItem(UsageStatistics.monthProcessedKey, this.currentMonth());\n // Use random sampling\n if (this.lottery()) {\n this.logger.debug(\"Congratulations, we have a winner!\");\n } else {\n this.logger.debug(\"Sorry, no stats from you this time\");\n return;\n }\n\n this.send();\n }\n }, {\n key: 'send',\n value: function send() {\n // Ensure we have the latest data\n this.gatherer.gather(this.storage);\n\n // Read, send and clean up\n var data = this.storage.read();\n data[\"firstUse\"] = Number(localStorage.getItem(UsageStatistics.firstUseKey));\n data[\"usageStatisticsVersion\"] = UsageStatistics.version;\n var info = 'This request contains usage statistics gathered from the application running in development mode. \\n\\nStatistics gathering is automatically disabled and excluded from production builds.\\n\\nFor details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.\\n\\n\\n\\n';\n var self = this;\n this.sender.send(info + JSON.stringify(data), function () {\n // Revert the 'month processed' flag\n localStorage.setItem(UsageStatistics.monthProcessedKey, self.currentMonth() - 1);\n });\n }\n }], [{\n key: 'version',\n get: function get$1() {\n return '2.1.0';\n }\n }, {\n key: 'firstUseKey',\n get: function get$1() {\n return 'vaadin.statistics.firstuse';\n }\n }, {\n key: 'monthProcessedKey',\n get: function get$1() {\n return 'vaadin.statistics.monthProcessed';\n }\n }, {\n key: 'optOutKey',\n get: function get$1() {\n return 'vaadin.statistics.optout';\n }\n }]);\n return UsageStatistics;\n}();\n\ntry {\n window.Vaadin = window.Vaadin || {};\n window.Vaadin.usageStatsChecker = window.Vaadin.usageStatsChecker || new UsageStatistics();\n window.Vaadin.usageStatsChecker.maybeGatherAndSend();\n} catch (e) {\n // Intentionally ignored as this is not a problem in the app being developed\n}\n\n}());\n\n vaadin-dev-mode:end **/\n}\n\nconst usageStatistics = function() {\n if (typeof runIfDevelopmentMode === 'function') {\n return runIfDevelopmentMode(maybeGatherAndSendStats);\n }\n};\n\nwindow.Vaadin = window.Vaadin || {};\nwindow.Vaadin.registrations = window.Vaadin.registrations || [];\n\nwindow.Vaadin.registrations.push({\n is: '@vaadin/router',\n version: '1.7.2',\n});\n\nusageStatistics();\n\nRouter.NavigationTrigger = {POPSTATE, CLICK};\n\nexport { Resolver, Router };\n//# sourceMappingURL=vaadin-router.js.map\n","class Material extends HTMLElement {\n static get version() {\n return '1.2.3';\n }\n}\n\ncustomElements.define('vaadin-material-styles', Material);\n\nexport { Material };\n","import './version.js';\nimport '@polymer/polymer/lib/elements/custom-style.js';\nimport '@polymer/polymer/lib/elements/dom-module.js';\nconst $_documentContainer = document.createElement('template');\n\n$_documentContainer.innerHTML = `\n \n\n \n\n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\n","import './version.js';\nimport '@polymer/polymer/lib/elements/custom-style.js';\nconst $_documentContainer = document.createElement('template');\n\n$_documentContainer.innerHTML = `\n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\n","const font = 'https://fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,300,300italic,400italic,500,500italic,700,700italic';\nconst link = document.createElement('link');\nlink.rel = 'stylesheet';\nlink.type = 'text/css';\nlink.crossOrigin = 'anonymous';\nlink.href = font;\ndocument.head.appendChild(link);\n","import './version.js';\nimport '@polymer/polymer/lib/elements/custom-style.js';\nimport '@polymer/polymer/lib/elements/dom-module.js';\nimport { html } from '@polymer/polymer/lib/utils/html-tag.js';\n\nconst $_documentContainer = html`\n \n\n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\n\nimport './font-roboto.js';\n","import '@vaadin/vaadin-material-styles/color.js';\nimport { html } from '@polymer/polymer/lib/utils/html-tag.js';\n\nconst $_documentContainer = html`\n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\n","/**\n * @polymerMixin\n */\nexport const ThemePropertyMixin = superClass => class VaadinThemePropertyMixin extends superClass {\n static get properties() {\n return {\n /**\n * Helper property with theme attribute value facilitating propagation\n * in shadow DOM.\n *\n * Enables the component implementation to propagate the `theme`\n * attribute value to the subcomponents in Shadow DOM by binding\n * the subcomponent’s \"theme\" attribute to the `theme` property of\n * the host.\n *\n * **NOTE:** Extending the mixin only provides the property for binding,\n * and does not make the propagation alone.\n *\n * See [Theme Attribute and Subcomponents](https://github.com/vaadin/vaadin-themable-mixin/wiki/5.-Theme-Attribute-and-Subcomponents).\n * page for more information.\n *\n * @protected\n */\n theme: {\n type: String,\n readOnly: true\n }\n };\n }\n\n /** @protected */\n attributeChangedCallback(name, oldValue, newValue) {\n super.attributeChangedCallback(name, oldValue, newValue);\n\n if (name === 'theme') {\n this._setTheme(newValue);\n }\n }\n};\n","import { DomModule } from '@polymer/polymer/lib/elements/dom-module.js';\nimport { ThemePropertyMixin } from './vaadin-theme-property-mixin.js';\n\n/**\n * @polymerMixin\n * @mixes ThemePropertyMixin\n */\nexport const ThemableMixin = superClass => class VaadinThemableMixin extends ThemePropertyMixin(superClass) {\n\n /** @protected */\n static finalize() {\n super.finalize();\n\n const template = this.prototype._template;\n\n const hasOwnTemplate = this.template && this.template.parentElement && this.template.parentElement.id === this.is;\n const inheritedTemplate = Object.getPrototypeOf(this.prototype)._template;\n if (inheritedTemplate && !hasOwnTemplate) {\n // The element doesn't define its own template -> include the theme modules from the inherited template\n Array.from(inheritedTemplate.content.querySelectorAll('style[include]')).forEach(s => {\n this._includeStyle(s.getAttribute('include'), template);\n });\n }\n\n this._includeMatchingThemes(template);\n }\n\n /** @private */\n static _includeMatchingThemes(template) {\n const domModule = DomModule;\n const modules = domModule.prototype.modules;\n\n let hasThemes = false;\n const defaultModuleName = this.is + '-default-theme';\n\n Object.keys(modules)\n .sort((moduleNameA, moduleNameB) => {\n const vaadinA = moduleNameA.indexOf('vaadin-') === 0;\n const vaadinB = moduleNameB.indexOf('vaadin-') === 0;\n\n const vaadinThemePrefixes = ['lumo-', 'material-'];\n const vaadinThemeA = vaadinThemePrefixes.filter(prefix => moduleNameA.indexOf(prefix) === 0).length > 0;\n const vaadinThemeB = vaadinThemePrefixes.filter(prefix => moduleNameB.indexOf(prefix) === 0).length > 0;\n\n if (vaadinA !== vaadinB) {\n // Include vaadin core styles first\n return vaadinA ? -1 : 1;\n } else if (vaadinThemeA !== vaadinThemeB) {\n // Include vaadin theme styles after that\n return vaadinThemeA ? -1 : 1;\n } else {\n // Lastly include custom styles so they override all vaadin styles\n return 0;\n }\n })\n .forEach(moduleName => {\n if (moduleName !== defaultModuleName) {\n const themeFor = modules[moduleName].getAttribute('theme-for');\n if (themeFor) {\n themeFor.split(' ').forEach(themeForToken => {\n if (new RegExp('^' + themeForToken.split('*').join('.*') + '$').test(this.is)) {\n hasThemes = true;\n this._includeStyle(moduleName, template);\n }\n });\n }\n }\n });\n\n if (!hasThemes && modules[defaultModuleName]) {\n // No theme modules found, include the default module if it exists\n this._includeStyle(defaultModuleName, template);\n }\n }\n\n /** @private */\n static _includeStyle(moduleName, template) {\n if (template && !template.content.querySelector(`style[include=\"${moduleName}\"]`)) {\n const styleEl = document.createElement('style');\n styleEl.setAttribute('include', moduleName);\n template.content.appendChild(styleEl);\n }\n }\n\n};\n","/**\n@license\nCopyright (c) 2017 Vaadin Ltd.\nThis program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n*/\n// We consider the keyboard to be active if the window has received a keydown\n// event since the last mousedown event.\nlet keyboardActive = false;\n\n// Listen for top-level keydown and mousedown events.\n// Use capture phase so we detect events even if they're handled.\nwindow.addEventListener(\n 'keydown',\n () => {\n keyboardActive = true;\n },\n {capture: true}\n);\n\nwindow.addEventListener(\n 'mousedown',\n () => {\n keyboardActive = false;\n },\n {capture: true}\n);\n\n/**\n * A private mixin to avoid problems with dynamic properties and Polymer Analyzer.\n * No need to expose these properties in the API docs.\n * @polymerMixin\n * @private\n */\nconst TabIndexMixin = superClass => class VaadinTabIndexMixin extends superClass {\n static get properties() {\n var properties = {\n /**\n * Internal property needed to listen to `tabindex` attribute changes.\n *\n * For changing the tabindex of this component use the native `tabIndex` property.\n * @private\n */\n tabindex: {\n type: Number,\n value: 0,\n reflectToAttribute: true,\n observer: '_tabindexChanged'\n }\n };\n\n if (window.ShadyDOM) {\n // ShadyDOM browsers need the `tabIndex` in order to notify when the user changes it programmatically.\n properties['tabIndex'] = properties.tabindex;\n }\n\n return properties;\n }\n};\n\n/**\n * Polymer.IronControlState is not a proper 2.0 class, also, its tabindex\n * implementation fails in the shadow dom, so we have this for vaadin elements.\n * @polymerMixin\n */\nexport const ControlStateMixin = superClass => class VaadinControlStateMixin extends TabIndexMixin(superClass) {\n static get properties() {\n return {\n /**\n * Specify that this control should have input focus when the page loads.\n */\n autofocus: {\n type: Boolean\n },\n\n /**\n * Stores the previous value of tabindex attribute of the disabled element\n * @private\n */\n _previousTabIndex: {\n type: Number\n },\n\n /**\n * If true, the user cannot interact with this element.\n */\n disabled: {\n type: Boolean,\n observer: '_disabledChanged',\n reflectToAttribute: true\n },\n\n /**\n * @private\n */\n _isShiftTabbing: {\n type: Boolean\n }\n };\n }\n\n /**\n * @protected\n * @return {boolean}\n */\n get _keyboardActive() {\n return keyboardActive;\n }\n\n /**\n * @protected\n */\n ready() {\n this.addEventListener('focusin', e => {\n if (e.composedPath()[0] === this) {\n // Only focus if the focus is received from somewhere outside\n if (!this.contains(e.relatedTarget)) {\n this._focus();\n }\n } else if (e.composedPath().indexOf(this.focusElement) !== -1 && !this.disabled) {\n this._setFocused(true);\n }\n });\n this.addEventListener('focusout', e => this._setFocused(false));\n\n // In super.ready() other 'focusin' and 'focusout' listeners might be\n // added, so we call it after our own ones to ensure they execute first.\n // Issue to watch out: when incorrect, refocuses the\n // input field on iOS after “Done” is pressed.\n super.ready();\n\n // This fixes the bug in Firefox 61 (https://bugzilla.mozilla.org/show_bug.cgi?id=1472887)\n // where focusout event does not go out of shady DOM because composed property in the event is not true\n const ensureEventComposed = e => {\n if (!e.composed) {\n e.target.dispatchEvent(new CustomEvent(e.type, {\n bubbles: true,\n composed: true,\n cancelable: false\n }));\n }\n };\n this.shadowRoot.addEventListener('focusin', ensureEventComposed);\n this.shadowRoot.addEventListener('focusout', ensureEventComposed);\n\n this.addEventListener('keydown', e => {\n if (!e.defaultPrevented && e.keyCode === 9) {\n if (e.shiftKey) {\n // Flag is checked in _focus event handler.\n this._isShiftTabbing = true;\n HTMLElement.prototype.focus.apply(this);\n this._setFocused(false);\n // Event handling in IE is asynchronous and the flag is removed asynchronously as well\n setTimeout(() => this._isShiftTabbing = false, 0);\n } else {\n // Workaround for FF63-65 bug that causes the focus to get lost when\n // blurring a slotted component with focusable shadow root content\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1528686\n // TODO: Remove when safe\n const firefox = window.navigator.userAgent.match(/Firefox\\/(\\d\\d\\.\\d)/);\n if (firefox\n && parseFloat(firefox[1]) >= 63\n && parseFloat(firefox[1]) < 66\n && this.parentNode\n && this.nextSibling) {\n const fakeTarget = document.createElement('input');\n fakeTarget.style.position = 'absolute';\n fakeTarget.style.opacity = '0';\n fakeTarget.tabIndex = this.tabIndex;\n\n this.parentNode.insertBefore(fakeTarget, this.nextSibling);\n fakeTarget.focus();\n fakeTarget.addEventListener('focusout', () => this.parentNode.removeChild(fakeTarget));\n }\n }\n\n }\n });\n\n if (this.autofocus && !this.disabled) {\n window.requestAnimationFrame(() => {\n this._focus();\n this._setFocused(true);\n this.setAttribute('focus-ring', '');\n });\n }\n }\n\n /**\n * @protected\n */\n disconnectedCallback() {\n super.disconnectedCallback();\n\n // in non-Chrome browsers, blur does not fire on the element when it is disconnected.\n // reproducible in `` when closing on `Cancel` or `Today` click.\n if (this.hasAttribute('focused')) {\n this._setFocused(false);\n }\n }\n\n /**\n * @param {boolean} focused\n * @protected\n */\n _setFocused(focused) {\n if (focused) {\n this.setAttribute('focused', '');\n } else {\n this.removeAttribute('focused');\n }\n\n // focus-ring is true when the element was focused from the keyboard.\n // Focus Ring [A11ycasts]: https://youtu.be/ilj2P5-5CjI\n if (focused && keyboardActive) {\n this.setAttribute('focus-ring', '');\n } else {\n this.removeAttribute('focus-ring');\n }\n }\n\n /**\n * Any element extending this mixin is required to implement this getter.\n * It returns the actual focusable element in the component.\n * @return {Element | null | undefined}\n */\n get focusElement() {\n window.console.warn(`Please implement the 'focusElement' property in <${this.localName}>`);\n return this;\n }\n\n /**\n * @protected\n */\n _focus() {\n if (!this.focusElement || this._isShiftTabbing) {\n return;\n }\n\n this.focusElement.focus();\n this._setFocused(true);\n }\n\n /**\n * Moving the focus from the host element causes firing of the blur event what leads to problems in IE.\n * @private\n */\n focus() {\n if (!this.focusElement || this.disabled) {\n return;\n }\n\n this.focusElement.focus();\n this._setFocused(true);\n }\n\n /**\n * Native bluring in the host element does nothing because it does not have the focus.\n * In chrome it works, but not in FF.\n * @private\n */\n blur() {\n if (!this.focusElement) {\n return;\n }\n this.focusElement.blur();\n this._setFocused(false);\n }\n\n /**\n * @param {boolean} disabled\n * @private\n */\n _disabledChanged(disabled) {\n this.focusElement.disabled = disabled;\n if (disabled) {\n this.blur();\n this._previousTabIndex = this.tabindex;\n this.tabindex = -1;\n this.setAttribute('aria-disabled', 'true');\n } else {\n if (typeof this._previousTabIndex !== 'undefined') {\n this.tabindex = this._previousTabIndex;\n }\n this.removeAttribute('aria-disabled');\n }\n }\n\n /**\n * @param {number | null | undefined} tabindex\n * @private\n */\n _tabindexChanged(tabindex) {\n if (tabindex !== undefined) {\n this.focusElement.tabIndex = tabindex;\n }\n\n if (this.disabled && this.tabindex) {\n // If tabindex attribute was changed while checkbox was disabled\n if (this.tabindex !== -1) {\n this._previousTabIndex = this.tabindex;\n }\n this.tabindex = tabindex = undefined;\n }\n\n if (window.ShadyDOM) {\n this.setProperties({tabIndex: tabindex, tabindex: tabindex});\n }\n }\n\n /**\n * @protected\n */\n click() {\n if (!this.disabled) {\n super.click();\n }\n }\n};\n","/**\n@license\nCopyright (c) 2020 Vaadin Ltd.\nThis program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n*/\n/**\n * Helper that provides a set of functions for RTL.\n */\nclass DirHelper {\n /**\n * Get the scroll type in the current browser view.\n *\n * @return {string} the scroll type. Possible values are `default|reverse|negative`\n */\n static detectScrollType() {\n const dummy = document.createElement('div');\n dummy.textContent = 'ABCD';\n dummy.dir = 'rtl';\n dummy.style.fontSize = '14px';\n dummy.style.width = '4px';\n dummy.style.height = '1px';\n dummy.style.position = 'absolute';\n dummy.style.top = '-1000px';\n dummy.style.overflow = 'scroll';\n document.body.appendChild(dummy);\n\n let cachedType = 'reverse';\n if (dummy.scrollLeft > 0) {\n cachedType = 'default';\n } else {\n dummy.scrollLeft = 2;\n if (dummy.scrollLeft < 2) {\n cachedType = 'negative';\n }\n }\n document.body.removeChild(dummy);\n return cachedType;\n }\n\n /**\n * Get the scrollLeft value of the element relative to the direction\n *\n * @param {string} scrollType type of the scroll detected with `detectScrollType`\n * @param {string} direction current direction of the element\n * @param {Element} element\n * @return {number} the scrollLeft value.\n */\n static getNormalizedScrollLeft(scrollType, direction, element) {\n const {scrollLeft} = element;\n if (direction !== 'rtl' || !scrollType) {\n return scrollLeft;\n }\n\n switch (scrollType) {\n case 'negative':\n return element.scrollWidth - element.clientWidth + scrollLeft;\n case 'reverse':\n return element.scrollWidth - element.clientWidth - scrollLeft;\n }\n return scrollLeft;\n }\n\n /**\n * Set the scrollLeft value of the element relative to the direction\n *\n * @param {string} scrollType type of the scroll detected with `detectScrollType`\n * @param {string} direction current direction of the element\n * @param {Element} element\n * @param {number} scrollLeft the scrollLeft value to be set\n */\n static setNormalizedScrollLeft(scrollType, direction, element, scrollLeft) {\n if (direction !== 'rtl' || !scrollType) {\n element.scrollLeft = scrollLeft;\n return;\n }\n\n switch (scrollType) {\n case 'negative':\n element.scrollLeft = element.clientWidth - element.scrollWidth + scrollLeft;\n break;\n case 'reverse':\n element.scrollLeft = element.scrollWidth - element.clientWidth - scrollLeft;\n break;\n default:\n element.scrollLeft = scrollLeft;\n break;\n }\n }\n}\n\nexport { DirHelper };\n","import { DirHelper } from './vaadin-dir-helper.js';\n/**\n * Array of Vaadin custom element classes that have been subscribed to the dir changes.\n */\nconst directionSubscribers = [];\nconst directionUpdater = function() {\n const documentDir = getDocumentDir();\n directionSubscribers.forEach(element => {\n alignDirs(element, documentDir);\n });\n};\n\nlet scrollType;\n\nconst directionObserver = new MutationObserver(directionUpdater);\ndirectionObserver.observe(document.documentElement, {attributes: true, attributeFilter: ['dir']});\n\nconst alignDirs = function(element, documentDir) {\n if (documentDir) {\n element.setAttribute('dir', documentDir);\n } else {\n element.removeAttribute('dir');\n }\n};\n\nconst getDocumentDir = function() {\n return document.documentElement.getAttribute('dir');\n};\n\n/**\n * @polymerMixin\n */\nexport const DirMixin = superClass => class VaadinDirMixin extends superClass {\n static get properties() {\n return {\n /**\n * @protected\n */\n dir: {\n type: String,\n readOnly: true\n }\n };\n }\n\n /** @protected */\n static finalize() {\n super.finalize();\n\n if (!scrollType) {\n scrollType = DirHelper.detectScrollType();\n }\n }\n\n /** @protected */\n connectedCallback() {\n super.connectedCallback();\n\n if (!this.hasAttribute('dir')) {\n this.__subscribe();\n alignDirs(this, getDocumentDir());\n }\n }\n\n /** @protected */\n attributeChangedCallback(name, oldValue, newValue) {\n super.attributeChangedCallback(name, oldValue, newValue);\n if (name !== 'dir') {\n return;\n }\n\n // New value equals to the document direction and the element is not subscribed to the changes\n const newValueEqlDocDir = newValue === getDocumentDir() && directionSubscribers.indexOf(this) === -1;\n // Value was emptied and the element is not subscribed to the changes\n const newValueEmptied = !newValue && oldValue && directionSubscribers.indexOf(this) === -1;\n // New value is different and the old equals to document direction and the element is not subscribed to the changes\n const newDiffValue = newValue !== getDocumentDir() && oldValue === getDocumentDir();\n\n if (newValueEqlDocDir || newValueEmptied) {\n this.__subscribe();\n alignDirs(this, getDocumentDir());\n } else if (newDiffValue) {\n this.__subscribe(false);\n }\n }\n\n /** @protected */\n disconnectedCallback() {\n super.disconnectedCallback();\n this.__subscribe(false);\n this.removeAttribute('dir');\n }\n\n /** @private */\n __subscribe(push = true) {\n if (push) {\n directionSubscribers.indexOf(this) === -1 &&\n directionSubscribers.push(this);\n } else {\n directionSubscribers.indexOf(this) > -1 &&\n directionSubscribers.splice(directionSubscribers.indexOf(this), 1);\n }\n }\n\n /**\n * @param {Element} element\n * @return {number}\n * @protected\n */\n __getNormalizedScrollLeft(element) {\n return DirHelper.getNormalizedScrollLeft(scrollType, this.getAttribute('dir') || 'ltr', element);\n }\n\n /**\n * @param {Element} element\n * @param {number} scrollLeft\n * @protected\n */\n __setNormalizedScrollLeft(element, scrollLeft) {\n return DirHelper.setNormalizedScrollLeft(scrollType, this.getAttribute('dir') || 'ltr', element, scrollLeft);\n }\n};\n","const DEV_MODE_CODE_REGEXP =\n /\\/\\*[\\*!]\\s+vaadin-dev-mode:start([\\s\\S]*)vaadin-dev-mode:end\\s+\\*\\*\\//i;\n\nconst FlowClients = window.Vaadin && window.Vaadin.Flow && window.Vaadin.Flow.clients;\n\nfunction isMinified() {\n function test() {\n /** vaadin-dev-mode:start\n return false;\n vaadin-dev-mode:end **/\n return true;\n }\n return uncommentAndRun(test);\n}\n\nfunction isDevelopmentMode() {\n try {\n if (isForcedDevelopmentMode()) {\n return true;\n }\n\n if (!isLocalhost()) {\n return false;\n }\n\n if (FlowClients) {\n return !isFlowProductionMode();\n }\n\n return !isMinified();\n } catch (e) {\n // Some error in this code, assume production so no further actions will be taken\n return false;\n }\n}\n\nfunction isForcedDevelopmentMode() {\n return localStorage.getItem(\"vaadin.developmentmode.force\");\n}\n\nfunction isLocalhost() {\n return ([\"localhost\",\"127.0.0.1\"].indexOf(window.location.hostname) >= 0);\n}\n\nfunction isFlowProductionMode() {\n if (FlowClients) {\n const productionModeApps = Object.keys(FlowClients)\n .map(key => FlowClients[key])\n .filter(client => client.productionMode);\n if (productionModeApps.length > 0) {\n return true;\n }\n }\n return false;\n}\n\nfunction uncommentAndRun(callback, args) {\n if (typeof callback !== 'function') {\n return;\n }\n\n const match = DEV_MODE_CODE_REGEXP.exec(callback.toString());\n if (match) {\n try {\n // requires CSP: script-src 'unsafe-eval'\n callback = new Function(match[1]);\n } catch (e) {\n // eat the exception\n console.log('vaadin-development-mode-detector: uncommentAndRun() failed', e)\n }\n }\n\n return callback(args);\n}\n\n// A guard against polymer-modulizer removing the window.Vaadin\n// initialization above.\nwindow['Vaadin'] = window['Vaadin'] || {};\n\n/**\n * Inspects the source code of the given `callback` function for\n * specially-marked _commented_ code. If such commented code is found in the\n * callback source, uncomments and runs that code instead of the callback\n * itself. Otherwise runs the callback as is.\n *\n * The optional arguments are passed into the callback / uncommented code,\n * the result is returned.\n *\n * See the `isMinified()` function source code in this file for an example.\n *\n */\nexport const runIfDevelopmentMode = function(callback, args) {\n if (window.Vaadin.developmentMode) {\n return uncommentAndRun(callback, args);\n }\n};\n\nif (window.Vaadin.developmentMode === undefined) {\n window.Vaadin.developmentMode = isDevelopmentMode();\n}\n","/* This file is autogenerated from src/vaadin-usage-statistics.tpl.html */\n/*\n\nThis script gathers usage statistics from the application running in development mode.\n\nStatistics gathering is automatically disabled and excluded from production builds.\n\nFor details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.\n\n*/\n/*\n FIXME(polymer-modulizer): the above comments were extracted\n from HTML and may be out of place here. Review them and\n then delete this comment!\n*/\nimport { runIfDevelopmentMode } from '@vaadin/vaadin-development-mode-detector/vaadin-development-mode-detector.js';\n\nfunction maybeGatherAndSendStats() {\n /*! vaadin-dev-mode:start\n (function () {\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n} : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n};\n\nvar classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\nvar createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\nvar getPolymerVersion = function getPolymerVersion() {\n return window.Polymer && window.Polymer.version;\n};\n\nvar StatisticsGatherer = function () {\n function StatisticsGatherer(logger) {\n classCallCheck(this, StatisticsGatherer);\n\n this.now = new Date().getTime();\n this.logger = logger;\n }\n\n createClass(StatisticsGatherer, [{\n key: 'frameworkVersionDetectors',\n value: function frameworkVersionDetectors() {\n return {\n 'Flow': function Flow() {\n if (window.Vaadin && window.Vaadin.Flow && window.Vaadin.Flow.clients) {\n var flowVersions = Object.keys(window.Vaadin.Flow.clients).map(function (key) {\n return window.Vaadin.Flow.clients[key];\n }).filter(function (client) {\n return client.getVersionInfo;\n }).map(function (client) {\n return client.getVersionInfo().flow;\n });\n if (flowVersions.length > 0) {\n return flowVersions[0];\n }\n }\n },\n 'Vaadin Framework': function VaadinFramework() {\n if (window.vaadin && window.vaadin.clients) {\n var frameworkVersions = Object.values(window.vaadin.clients).filter(function (client) {\n return client.getVersionInfo;\n }).map(function (client) {\n return client.getVersionInfo().vaadinVersion;\n });\n if (frameworkVersions.length > 0) {\n return frameworkVersions[0];\n }\n }\n },\n 'AngularJs': function AngularJs() {\n if (window.angular && window.angular.version && window.angular.version) {\n return window.angular.version.full;\n }\n },\n 'Angular': function Angular() {\n if (window.ng) {\n var tags = document.querySelectorAll(\"[ng-version]\");\n if (tags.length > 0) {\n return tags[0].getAttribute(\"ng-version\");\n }\n return \"Unknown\";\n }\n },\n 'Backbone.js': function BackboneJs() {\n if (window.Backbone) {\n return window.Backbone.VERSION;\n }\n },\n 'React': function React() {\n var reactSelector = '[data-reactroot], [data-reactid]';\n if (!!document.querySelector(reactSelector)) {\n // React does not publish the version by default\n return \"unknown\";\n }\n },\n 'Ember': function Ember() {\n if (window.Em && window.Em.VERSION) {\n return window.Em.VERSION;\n } else if (window.Ember && window.Ember.VERSION) {\n return window.Ember.VERSION;\n }\n },\n 'jQuery': function (_jQuery) {\n function jQuery() {\n return _jQuery.apply(this, arguments);\n }\n\n jQuery.toString = function () {\n return _jQuery.toString();\n };\n\n return jQuery;\n }(function () {\n if (typeof jQuery === 'function' && jQuery.prototype.jquery !== undefined) {\n return jQuery.prototype.jquery;\n }\n }),\n 'Polymer': function Polymer() {\n var version = getPolymerVersion();\n if (version) {\n return version;\n }\n },\n 'LitElement': function LitElement() {\n var version = window.litElementVersions && window.litElementVersions[0];\n if (version) {\n return version;\n }\n },\n 'LitHtml': function LitHtml() {\n var version = window.litHtmlVersions && window.litHtmlVersions[0];\n if (version) {\n return version;\n }\n },\n 'Vue.js': function VueJs() {\n if (window.Vue) {\n return window.Vue.version;\n }\n }\n };\n }\n }, {\n key: 'getUsedVaadinElements',\n value: function getUsedVaadinElements(elements) {\n var version = getPolymerVersion();\n var elementClasses = void 0;\n // NOTE: In case you edit the code here, YOU MUST UPDATE any statistics reporting code in Flow.\n // Check all locations calling the method getEntries() in\n // https://github.com/vaadin/flow/blob/master/flow-server/src/main/java/com/vaadin/flow/internal/UsageStatistics.java#L106\n // Currently it is only used by BootstrapHandler.\n if (version && version.indexOf('2') === 0) {\n // Polymer 2: components classes are stored in window.Vaadin\n elementClasses = Object.keys(window.Vaadin).map(function (c) {\n return window.Vaadin[c];\n }).filter(function (c) {\n return c.is;\n });\n } else {\n // Polymer 3: components classes are stored in window.Vaadin.registrations\n elementClasses = window.Vaadin.registrations || [];\n }\n elementClasses.forEach(function (klass) {\n var version = klass.version ? klass.version : \"0.0.0\";\n elements[klass.is] = { version: version };\n });\n }\n }, {\n key: 'getUsedVaadinThemes',\n value: function getUsedVaadinThemes(themes) {\n ['Lumo', 'Material'].forEach(function (themeName) {\n var theme;\n var version = getPolymerVersion();\n if (version && version.indexOf('2') === 0) {\n // Polymer 2: themes are stored in window.Vaadin\n theme = window.Vaadin[themeName];\n } else {\n // Polymer 3: themes are stored in custom element registry\n theme = customElements.get('vaadin-' + themeName.toLowerCase() + '-styles');\n }\n if (theme && theme.version) {\n themes[themeName] = { version: theme.version };\n }\n });\n }\n }, {\n key: 'getFrameworks',\n value: function getFrameworks(frameworks) {\n var detectors = this.frameworkVersionDetectors();\n Object.keys(detectors).forEach(function (framework) {\n var detector = detectors[framework];\n try {\n var version = detector();\n if (version) {\n frameworks[framework] = { version: version };\n }\n } catch (e) {}\n });\n }\n }, {\n key: 'gather',\n value: function gather(storage) {\n var storedStats = storage.read();\n var gatheredStats = {};\n var types = [\"elements\", \"frameworks\", \"themes\"];\n\n types.forEach(function (type) {\n gatheredStats[type] = {};\n if (!storedStats[type]) {\n storedStats[type] = {};\n }\n });\n\n var previousStats = JSON.stringify(storedStats);\n\n this.getUsedVaadinElements(gatheredStats.elements);\n this.getFrameworks(gatheredStats.frameworks);\n this.getUsedVaadinThemes(gatheredStats.themes);\n\n var now = this.now;\n types.forEach(function (type) {\n var keys = Object.keys(gatheredStats[type]);\n keys.forEach(function (key) {\n if (!storedStats[type][key] || _typeof(storedStats[type][key]) != _typeof({})) {\n storedStats[type][key] = { firstUsed: now };\n }\n // Discards any previously logged version number\n storedStats[type][key].version = gatheredStats[type][key].version;\n storedStats[type][key].lastUsed = now;\n });\n });\n\n var newStats = JSON.stringify(storedStats);\n storage.write(newStats);\n if (newStats != previousStats && Object.keys(storedStats).length > 0) {\n this.logger.debug(\"New stats: \" + newStats);\n }\n }\n }]);\n return StatisticsGatherer;\n}();\n\nvar StatisticsStorage = function () {\n function StatisticsStorage(key) {\n classCallCheck(this, StatisticsStorage);\n\n this.key = key;\n }\n\n createClass(StatisticsStorage, [{\n key: 'read',\n value: function read() {\n var localStorageStatsString = localStorage.getItem(this.key);\n try {\n return JSON.parse(localStorageStatsString ? localStorageStatsString : '{}');\n } catch (e) {\n return {};\n }\n }\n }, {\n key: 'write',\n value: function write(data) {\n localStorage.setItem(this.key, data);\n }\n }, {\n key: 'clear',\n value: function clear() {\n localStorage.removeItem(this.key);\n }\n }, {\n key: 'isEmpty',\n value: function isEmpty() {\n var storedStats = this.read();\n var empty = true;\n Object.keys(storedStats).forEach(function (key) {\n if (Object.keys(storedStats[key]).length > 0) {\n empty = false;\n }\n });\n\n return empty;\n }\n }]);\n return StatisticsStorage;\n}();\n\nvar StatisticsSender = function () {\n function StatisticsSender(url, logger) {\n classCallCheck(this, StatisticsSender);\n\n this.url = url;\n this.logger = logger;\n }\n\n createClass(StatisticsSender, [{\n key: 'send',\n value: function send(data, errorHandler) {\n var logger = this.logger;\n\n if (navigator.onLine === false) {\n logger.debug(\"Offline, can't send\");\n errorHandler();\n return;\n }\n logger.debug(\"Sending data to \" + this.url);\n\n var req = new XMLHttpRequest();\n req.withCredentials = true;\n req.addEventListener(\"load\", function () {\n // Stats sent, nothing more to do\n logger.debug(\"Response: \" + req.responseText);\n });\n req.addEventListener(\"error\", function () {\n logger.debug(\"Send failed\");\n errorHandler();\n });\n req.addEventListener(\"abort\", function () {\n logger.debug(\"Send aborted\");\n errorHandler();\n });\n req.open(\"POST\", this.url);\n req.setRequestHeader(\"Content-Type\", \"application/json\");\n req.send(data);\n }\n }]);\n return StatisticsSender;\n}();\n\nvar StatisticsLogger = function () {\n function StatisticsLogger(id) {\n classCallCheck(this, StatisticsLogger);\n\n this.id = id;\n }\n\n createClass(StatisticsLogger, [{\n key: '_isDebug',\n value: function _isDebug() {\n return localStorage.getItem(\"vaadin.\" + this.id + \".debug\");\n }\n }, {\n key: 'debug',\n value: function debug(msg) {\n if (this._isDebug()) {\n console.info(this.id + \": \" + msg);\n }\n }\n }]);\n return StatisticsLogger;\n}();\n\nvar UsageStatistics = function () {\n function UsageStatistics() {\n classCallCheck(this, UsageStatistics);\n\n this.now = new Date();\n this.timeNow = this.now.getTime();\n this.gatherDelay = 10; // Delay between loading this file and gathering stats\n this.initialDelay = 24 * 60 * 60;\n\n this.logger = new StatisticsLogger(\"statistics\");\n this.storage = new StatisticsStorage(\"vaadin.statistics.basket\");\n this.gatherer = new StatisticsGatherer(this.logger);\n this.sender = new StatisticsSender(\"https://tools.vaadin.com/usage-stats/submit\", this.logger);\n }\n\n createClass(UsageStatistics, [{\n key: 'maybeGatherAndSend',\n value: function maybeGatherAndSend() {\n var _this = this;\n\n if (localStorage.getItem(UsageStatistics.optOutKey)) {\n return;\n }\n this.gatherer.gather(this.storage);\n setTimeout(function () {\n _this.maybeSend();\n }, this.gatherDelay * 1000);\n }\n }, {\n key: 'lottery',\n value: function lottery() {\n return true;\n }\n }, {\n key: 'currentMonth',\n value: function currentMonth() {\n return this.now.getYear() * 12 + this.now.getMonth();\n }\n }, {\n key: 'maybeSend',\n value: function maybeSend() {\n var firstUse = Number(localStorage.getItem(UsageStatistics.firstUseKey));\n var monthProcessed = Number(localStorage.getItem(UsageStatistics.monthProcessedKey));\n\n if (!firstUse) {\n // Use a grace period to avoid interfering with tests, incognito mode etc\n firstUse = this.timeNow;\n localStorage.setItem(UsageStatistics.firstUseKey, firstUse);\n }\n\n if (this.timeNow < firstUse + this.initialDelay * 1000) {\n this.logger.debug(\"No statistics will be sent until the initial delay of \" + this.initialDelay + \"s has passed\");\n return;\n }\n if (this.currentMonth() <= monthProcessed) {\n this.logger.debug(\"This month has already been processed\");\n return;\n }\n localStorage.setItem(UsageStatistics.monthProcessedKey, this.currentMonth());\n // Use random sampling\n if (this.lottery()) {\n this.logger.debug(\"Congratulations, we have a winner!\");\n } else {\n this.logger.debug(\"Sorry, no stats from you this time\");\n return;\n }\n\n this.send();\n }\n }, {\n key: 'send',\n value: function send() {\n // Ensure we have the latest data\n this.gatherer.gather(this.storage);\n\n // Read, send and clean up\n var data = this.storage.read();\n data[\"firstUse\"] = Number(localStorage.getItem(UsageStatistics.firstUseKey));\n data[\"usageStatisticsVersion\"] = UsageStatistics.version;\n var info = 'This request contains usage statistics gathered from the application running in development mode. \\n\\nStatistics gathering is automatically disabled and excluded from production builds.\\n\\nFor details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.\\n\\n\\n\\n';\n var self = this;\n this.sender.send(info + JSON.stringify(data), function () {\n // Revert the 'month processed' flag\n localStorage.setItem(UsageStatistics.monthProcessedKey, self.currentMonth() - 1);\n });\n }\n }], [{\n key: 'version',\n get: function get$1() {\n return '2.1.2';\n }\n }, {\n key: 'firstUseKey',\n get: function get$1() {\n return 'vaadin.statistics.firstuse';\n }\n }, {\n key: 'monthProcessedKey',\n get: function get$1() {\n return 'vaadin.statistics.monthProcessed';\n }\n }, {\n key: 'optOutKey',\n get: function get$1() {\n return 'vaadin.statistics.optout';\n }\n }]);\n return UsageStatistics;\n}();\n\ntry {\n window.Vaadin = window.Vaadin || {};\n window.Vaadin.usageStatsChecker = window.Vaadin.usageStatsChecker || new UsageStatistics();\n window.Vaadin.usageStatsChecker.maybeGatherAndSend();\n} catch (e) {\n // Intentionally ignored as this is not a problem in the app being developed\n}\n\n}());\n\n vaadin-dev-mode:end **/\n}\n\nexport const usageStatistics = function() {\n if (typeof runIfDevelopmentMode === 'function') {\n return runIfDevelopmentMode(maybeGatherAndSendStats);\n }\n};\n","import { idlePeriod } from '@polymer/polymer/lib/utils/async.js';\nimport { Debouncer } from '@polymer/polymer/lib/utils/debounce.js';\nimport { enqueueDebouncer } from '@polymer/polymer/lib/utils/flush.js';\n\nimport { DirMixin } from './vaadin-dir-mixin.js';\nimport { usageStatistics } from '@vaadin/vaadin-usage-statistics/vaadin-usage-statistics.js';\nif (!window.Vaadin) {\n window['Vaadin'] = {};\n}\n\n/**\n * Array of Vaadin custom element classes that have been finalized.\n */\nwindow['Vaadin'].registrations = window.Vaadin.registrations || [];\n\n// Use the hack to prevent polymer-modulizer from converting to exports\nwindow['Vaadin'].developmentModeCallback = window.Vaadin.developmentModeCallback || {};\nwindow['Vaadin'].developmentModeCallback['vaadin-usage-statistics'] = function() {\n if (usageStatistics) {\n usageStatistics();\n }\n};\n\nlet statsJob;\n\nconst registered = new Set();\n\n/**\n * @polymerMixin\n * @mixes DirMixin\n */\nexport const ElementMixin = superClass => class VaadinElementMixin extends DirMixin(superClass) {\n /** @protected */\n static finalize() {\n super.finalize();\n\n const {is} = this;\n\n // Registers a class prototype for telemetry purposes.\n if (is && !registered.has(is)) {\n window.Vaadin.registrations.push(this);\n registered.add(is);\n\n if (window.Vaadin.developmentModeCallback) {\n statsJob = Debouncer.debounce(statsJob,\n idlePeriod, () => {\n window.Vaadin.developmentModeCallback['vaadin-usage-statistics']();\n }\n );\n enqueueDebouncer(statsJob);\n }\n }\n }\n\n constructor() {\n super();\n if (document.doctype === null) {\n console.warn(\n 'Vaadin components require the \"standards mode\" declaration. Please add to the HTML document.'\n );\n }\n }\n};\n","/**\n@license\nCopyright (c) 2017 Vaadin Ltd.\nThis program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n*/\nimport { PolymerElement } from '@polymer/polymer/polymer-element.js';\n\nimport { GestureEventListeners } from '@polymer/polymer/lib/mixins/gesture-event-listeners.js';\nimport { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';\nimport { ControlStateMixin } from '@vaadin/vaadin-control-state-mixin/vaadin-control-state-mixin.js';\nimport { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';\nimport { html } from '@polymer/polymer/lib/utils/html-tag.js';\n/**\n * `` is a Web Component for customized checkboxes.\n *\n * ```html\n * \n * Make my profile visible\n * \n * ```\n *\n * ### Styling\n *\n * The following shadow DOM parts are available for styling:\n *\n * Part name | Description\n * ------------------|----------------\n * `checkbox` | The checkbox element\n * `label` | The label content element\n *\n * The following state attributes are available for styling:\n *\n * Attribute | Description | Part name\n * -------------|-------------|--------------\n * `active` | Set when the checkbox is pressed down, either with mouse, touch or the keyboard. | `:host`\n * `disabled` | Set when the checkbox is disabled. | `:host`\n * `focus-ring` | Set when the checkbox is focused using the keyboard. | `:host`\n * `focused` | Set when the checkbox is focused. | `:host`\n * `indeterminate` | Set when the checkbox is in indeterminate mode. | `:host`\n * `checked` | Set when the checkbox is checked. | `:host`\n * `empty` | Set when there is no label provided. | `label`\n *\n * See [ThemableMixin – how to apply styles for shadow parts](https://github.com/vaadin/vaadin-themable-mixin/wiki)\n *\n * @memberof Vaadin\n * @mixes Vaadin.ElementMixin\n * @mixes Vaadin.ControlStateMixin\n * @mixes Vaadin.ThemableMixin\n * @mixes Polymer.GestureEventListeners\n * @demo demo/index.html\n */\nclass CheckboxElement extends\n ElementMixin(\n ControlStateMixin(\n ThemableMixin(\n GestureEventListeners(PolymerElement)))) {\n static get template() {\n return html`\n \n\n \n`;\n }\n\n static get is() {\n return 'vaadin-checkbox';\n }\n\n static get version() {\n return '2.2.10';\n }\n\n static get properties() {\n return {\n /**\n * True if the checkbox is checked.\n */\n checked: {\n type: Boolean,\n value: false,\n notify: true,\n observer: '_checkedChanged',\n reflectToAttribute: true\n },\n\n /**\n * Indeterminate state of the checkbox when it's neither checked nor unchecked, but undetermined.\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#Indeterminate_state_checkboxes\n */\n indeterminate: {\n type: Boolean,\n notify: true,\n observer: '_indeterminateChanged',\n reflectToAttribute: true,\n value: false\n },\n\n /**\n * The value given to the data submitted with the checkbox's name to the server when the control is inside a form.\n */\n value: {\n type: String,\n value: 'on'\n },\n\n _nativeCheckbox: {\n type: Object\n }\n };\n }\n\n constructor() {\n super();\n /**\n * @type {string}\n * Name of the element.\n */\n this.name;\n }\n\n get name() {\n return this.checked ? this._storedName : '';\n }\n\n set name(name) {\n this._storedName = name;\n }\n\n ready() {\n super.ready();\n\n this.setAttribute('role', 'checkbox');\n\n this._nativeCheckbox = this.shadowRoot.querySelector('input[type=\"checkbox\"]');\n\n this.addEventListener('click', this._handleClick.bind(this));\n\n this._addActiveListeners();\n\n const attrName = this.getAttribute('name');\n if (attrName) {\n this.name = attrName;\n }\n\n this.shadowRoot.querySelector('[part~=\"label\"]').querySelector('slot')\n .addEventListener('slotchange', this._updateLabelAttribute.bind(this));\n\n this._updateLabelAttribute();\n }\n\n _updateLabelAttribute() {\n const label = this.shadowRoot.querySelector('[part~=\"label\"]');\n const assignedNodes = label.firstElementChild.assignedNodes();\n if (this._isAssignedNodesEmpty(assignedNodes)) {\n label.setAttribute('empty', '');\n } else {\n label.removeAttribute('empty');\n }\n }\n\n _isAssignedNodesEmpty(nodes) {\n // The assigned nodes considered to be empty if there is no slotted content or only one empty text node\n return nodes.length === 0 ||\n (nodes.length == 1\n && nodes[0].nodeType == Node.TEXT_NODE\n && nodes[0].textContent.trim() === '');\n }\n\n _checkedChanged(checked) {\n if (this.indeterminate) {\n this.setAttribute('aria-checked', 'mixed');\n } else {\n this.setAttribute('aria-checked', checked);\n }\n }\n\n _indeterminateChanged(indeterminate) {\n if (indeterminate) {\n this.setAttribute('aria-checked', 'mixed');\n } else {\n this.setAttribute('aria-checked', this.checked);\n }\n }\n\n _addActiveListeners() {\n // DOWN\n this._addEventListenerToNode(this, 'down', (e) => {\n if (this.__interactionsAllowed(e)) {\n this.setAttribute('active', '');\n }\n });\n\n // UP\n this._addEventListenerToNode(this, 'up', () => this.removeAttribute('active'));\n\n // KEYDOWN\n this.addEventListener('keydown', e => {\n if (this.__interactionsAllowed(e) && e.keyCode === 32) {\n e.preventDefault();\n this.setAttribute('active', '');\n }\n });\n\n // KEYUP\n this.addEventListener('keyup', e => {\n if (this.__interactionsAllowed(e) && e.keyCode === 32) {\n e.preventDefault();\n this._toggleChecked();\n this.removeAttribute('active');\n\n if (this.indeterminate) {\n this.indeterminate = false;\n }\n }\n });\n }\n\n /** @protected */\n get focusElement() {\n return this.shadowRoot.querySelector('input');\n }\n\n /**\n * True if users' interactions (mouse or keyboard)\n * should toggle the checkbox\n */\n __interactionsAllowed(e) {\n if (this.disabled) {\n return false;\n }\n\n // https://github.com/vaadin/vaadin-checkbox/issues/63\n if (e.target.localName === 'a') {\n return false;\n }\n\n return true;\n }\n\n _handleClick(e) {\n if (this.__interactionsAllowed(e)) {\n if (!this.indeterminate) {\n if (e.composedPath()[0] !== this._nativeCheckbox) {\n e.preventDefault();\n this._toggleChecked();\n }\n } else {\n /*\n * Required for IE 11 and Edge.\n * See issue here: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7344418/\n */\n this.indeterminate = false;\n e.preventDefault();\n this._toggleChecked();\n }\n }\n }\n\n _toggleChecked() {\n this.checked = !this.checked;\n this.dispatchEvent(new CustomEvent('change', {composed: false, bubbles: true}));\n }\n\n /**\n * Fired when the user commits a value change.\n *\n * @event change\n */\n}\n\ncustomElements.define(CheckboxElement.is, CheckboxElement);\n\nexport { CheckboxElement };\n","import '@vaadin/vaadin-material-styles/color.js';\nimport { html } from '@polymer/polymer/lib/utils/html-tag.js';\n\nconst $_documentContainer = html`\n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\n","/**\n@license\nCopyright (c) 2017 Vaadin Ltd.\nThis program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n*/\n/**\n * @polymerMixin\n */\nexport const ProgressMixin = superClass =>\n class VaadinProgressMixin extends superClass {\n static get properties() {\n return {\n /**\n * Current progress value.\n */\n value: {\n type: Number,\n observer: '_valueChanged'\n },\n /**\n * Minimum bound of the progress bar.\n */\n min: {\n type: Number,\n value: 0,\n observer: '_minChanged'\n },\n /**\n * Maximum bound of the progress bar.\n */\n max: {\n type: Number,\n value: 1,\n observer: '_maxChanged'\n },\n /**\n * Indeterminate state of the progress bar.\n * This property takes precedence over other state properties (min, max, value).\n */\n indeterminate: {\n type: Boolean,\n value: false,\n reflectToAttribute: true\n }\n };\n }\n\n static get observers() {\n return [\n '_normalizedValueChanged(value, min, max)'\n ];\n }\n\n ready() {\n super.ready();\n\n this.setAttribute('role', 'progressbar');\n }\n\n _normalizedValueChanged(value, min, max) {\n const newNormalizedValue = this._normalizeValue(value, min, max);\n\n this.style.setProperty('--vaadin-progress-value', newNormalizedValue);\n\n this.updateStyles({\n '--vaadin-progress-value': String(newNormalizedValue)\n });\n }\n\n _valueChanged(newV, oldV) {\n this.setAttribute('aria-valuenow', newV);\n }\n\n _minChanged(newV, oldV) {\n this.setAttribute('aria-valuemin', newV);\n }\n\n _maxChanged(newV, oldV) {\n this.setAttribute('aria-valuemax', newV);\n }\n\n /**\n * Percent of current progress relative to whole progress bar (max - min)\n */\n _normalizeValue(value, min, max) {\n let nV;\n\n if (!value && value != 0) {\n nV = 0;\n } else if (min >= max) {\n nV = 1;\n } else {\n nV = (value - min) / (max - min);\n\n nV = Math.min(Math.max(nV, 0), 1);\n }\n\n return nV;\n }\n };\n","/**\n@license\nCopyright (c) 2017 Vaadin Ltd.\nThis program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n*/\nimport { PolymerElement } from '@polymer/polymer/polymer-element.js';\n\nimport { ProgressMixin } from './vaadin-progress-mixin.js';\nimport { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';\nimport { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';\nimport { html } from '@polymer/polymer/lib/utils/html-tag.js';\n/**\n * `` is a Web Component for progress bars.\n *\n * ```html\n * \n * \n * ```\n *\n * ### Styling\n *\n * The following shadow DOM parts are available for styling:\n *\n * Part name | Description\n * ----------------|----------------\n * `bar` | Progress-bar's background\n * `value` | Progress-bar's foreground\n *\n * See [ThemableMixin – how to apply styles for shadow parts](https://github.com/vaadin/vaadin-themable-mixin/wiki)\n *\n * The following custom properties are available:\n *\n * Custom property | Description | Default\n * ----------------|-------------|-------------\n * `--vaadin-progress-value` | current progress value (between 0 and 1) | 0\n *\n * The following state attributes are available for styling:\n *\n * Attribute | Description | Part name\n * ----------------|-------------|------------\n * `indeterminate` | Set to an indeterminate progress bar | :host\n *\n * @memberof Vaadin\n * @mixes Vaadin.ProgressMixin\n * @mixes Vaadin.ThemableMixin\n * @demo demo/index.html\n */\nclass ProgressBarElement extends ElementMixin(ThemableMixin(ProgressMixin(PolymerElement))) {\n static get template() {\n return html`\n \n\n
\n
\n
\n`;\n }\n\n static get is() {\n return 'vaadin-progress-bar';\n }\n\n static get version() {\n return '1.1.2';\n }\n}\n\ncustomElements.define(ProgressBarElement.is, ProgressBarElement);\n\nexport { ProgressBarElement };\n","import '../color.js';\nconst $_documentContainer = document.createElement('template');\n\n$_documentContainer.innerHTML = `\n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\n","import '@polymer/polymer/lib/elements/custom-style.js';\nimport './version.js';\nconst $_documentContainer = document.createElement('template');\n\n$_documentContainer.innerHTML = `\n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\n\n/* NOTICE: Generated with 'gulp icons' */\n/*\n FIXME(polymer-modulizer): the above comments were extracted\n from HTML and may be out of place here. Review them and\n then delete this comment!\n*/\n;\n","import '../font-icons.js';\nconst $_documentContainer = document.createElement('template');\n\n$_documentContainer.innerHTML = `\n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\n","import '@vaadin/vaadin-material-styles/color.js';\nimport '@vaadin/vaadin-material-styles/typography.js';\nimport '@vaadin/vaadin-material-styles/mixins/required-field.js';\nimport '@vaadin/vaadin-material-styles/font-icons.js';\nimport '@vaadin/vaadin-material-styles/mixins/field-button.js';\nimport { html } from '@polymer/polymer/lib/utils/html-tag.js';\n\nconst $_documentContainer = html`\n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\n","/**\n@license\nCopyright (c) 2017 Vaadin Ltd.\nThis program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n*/\nimport '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';\n\nimport { ControlStateMixin } from '@vaadin/vaadin-control-state-mixin/vaadin-control-state-mixin.js';\nimport { timeOut } from '@polymer/polymer/lib/utils/async.js';\nimport { Debouncer } from '@polymer/polymer/lib/utils/debounce.js';\nconst $_documentContainer = document.createElement('template');\n\n$_documentContainer.innerHTML = `\n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\n\nconst HOST_PROPS = {\n default: ['list', 'autofocus', 'pattern', 'autocapitalize', 'autocorrect', 'maxlength',\n 'minlength', 'name', 'placeholder', 'autocomplete', 'title'],\n accessible: ['disabled', 'readonly', 'required', 'invalid']\n};\n\nconst PROP_TYPE = {\n DEFAULT: 'default',\n ACCESSIBLE: 'accessible'\n};\n\n\n/**\n * @polymerMixin\n * @mixes Vaadin.ControlStateMixin\n */\nexport const TextFieldMixin = subclass => class VaadinTextFieldMixin extends ControlStateMixin(subclass) {\n static get properties() {\n return {\n /**\n * Whether the value of the control can be automatically completed by the browser.\n * List of available options at:\n * https://developer.mozilla.org/en/docs/Web/HTML/Element/input#attr-autocomplete\n */\n autocomplete: {\n type: String\n },\n\n /**\n * This is a property supported by Safari that is used to control whether\n * autocorrection should be enabled when the user is entering/editing the text.\n * Possible values are:\n * on: Enable autocorrection.\n * off: Disable autocorrection.\n */\n autocorrect: {\n type: String\n },\n\n /**\n * This is a property supported by Safari and Chrome that is used to control whether\n * autocapitalization should be enabled when the user is entering/editing the text.\n * Possible values are:\n * characters: Characters capitalization.\n * words: Words capitalization.\n * sentences: Sentences capitalization.\n * none: No capitalization.\n */\n autocapitalize: {\n type: String\n },\n\n /**\n * Specify that the value should be automatically selected when the field gains focus.\n */\n autoselect: {\n type: Boolean,\n value: false\n },\n\n /**\n * Set to true to display the clear icon which clears the input.\n */\n clearButtonVisible: {\n type: Boolean,\n value: false\n },\n\n /**\n * Error to show when the input value is invalid.\n */\n errorMessage: {\n type: String,\n value: ''\n },\n\n /**\n * Object with translated strings used for localization. Has\n * the following structure and default values:\n *\n * ```\n * {\n * // Translation of the clear icon button accessible label\n * clear: 'Clear'\n * }\n * ```\n */\n i18n: {\n type: Object,\n value: () => {\n return {\n clear: 'Clear'\n };\n }\n },\n\n /**\n * String used for the label element.\n */\n label: {\n type: String,\n value: '',\n observer: '_labelChanged'\n },\n\n /**\n * Maximum number of characters (in Unicode code points) that the user can enter.\n */\n maxlength: {\n type: Number\n },\n\n /**\n * Minimum number of characters (in Unicode code points) that the user can enter.\n */\n minlength: {\n type: Number\n },\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n name: {\n type: String\n },\n\n /**\n * A hint to the user of what can be entered in the control.\n */\n placeholder: {\n type: String\n },\n\n /**\n * This attribute indicates that the user cannot modify the value of the control.\n */\n readonly: {\n type: Boolean,\n reflectToAttribute: true\n },\n\n /**\n * Specifies that the user must fill in a value.\n */\n required: {\n type: Boolean,\n reflectToAttribute: true\n },\n\n\n /**\n * The initial value of the control.\n * It can be used for two-way data binding.\n */\n value: {\n type: String,\n value: '',\n observer: '_valueChanged',\n notify: true\n },\n\n /**\n * This property is set to true when the control value is invalid.\n */\n invalid: {\n type: Boolean,\n reflectToAttribute: true,\n notify: true,\n value: false\n },\n\n /**\n * Specifies that the text field has value.\n */\n hasValue: {\n type: Boolean,\n reflectToAttribute: true\n },\n\n /**\n * When set to true, user is prevented from typing a value that\n * conflicts with the given `pattern`.\n */\n preventInvalidInput: {\n type: Boolean\n },\n\n _labelId: {\n type: String\n },\n\n _errorId: {\n type: String\n }\n };\n }\n\n static get observers() {\n return ['_stateChanged(disabled, readonly, clearButtonVisible, hasValue)',\n '_hostPropsChanged(' + HOST_PROPS.default.join(', ') + ')',\n '_hostAccessiblePropsChanged(' + HOST_PROPS.accessible.join(', ') + ')',\n '_getActiveErrorId(invalid, errorMessage, _errorId)',\n '_getActiveLabelId(label, _labelId)',\n '__observeOffsetHeight(errorMessage, invalid, label)'\n ];\n }\n\n get focusElement() {\n if (!this.shadowRoot) {\n return;\n }\n const slotted = this.querySelector(`${this._slottedTagName}[slot=\"${this._slottedTagName}\"]`);\n if (slotted) {\n return slotted;\n }\n return this.shadowRoot.querySelector('[part=\"value\"]');\n }\n\n /**\n * @private\n */\n get inputElement() {\n return this.focusElement;\n }\n\n get _slottedTagName() {\n return 'input';\n }\n\n _onInput(e) {\n if (this.__preventInput) {\n e.stopImmediatePropagation();\n this.__preventInput = false;\n return;\n }\n\n if (this.preventInvalidInput) {\n const input = this.inputElement;\n if (input.value.length > 0 && !this.checkValidity()) {\n input.value = this.value || '';\n // add input-prevented attribute for 200ms\n this.setAttribute('input-prevented', '');\n this._inputDebouncer = Debouncer.debounce(\n this._inputDebouncer,\n timeOut.after(200), () => {\n this.removeAttribute('input-prevented');\n });\n return;\n }\n }\n\n if (!e.__fromClearButton) {\n this.__userInput = true;\n }\n this.value = e.target.value;\n }\n\n // NOTE(yuriy): Workaround needed for IE11 and Edge for proper displaying\n // of the clear button instead of setting display property for it depending on state.\n _stateChanged(disabled, readonly, clearButtonVisible, hasValue) {\n if (!disabled &&\n !readonly &&\n clearButtonVisible &&\n hasValue\n ) {\n this.$.clearButton.removeAttribute('hidden');\n } else {\n this.$.clearButton.setAttribute('hidden', true);\n }\n }\n\n _onChange(e) {\n if (this._valueClearing) {\n return;\n }\n\n // In the Shadow DOM, the `change` event is not leaked into the\n // ancestor tree, so we must do this manually.\n const changeEvent = new CustomEvent('change', {\n detail: {\n sourceEvent: e\n },\n bubbles: e.bubbles,\n cancelable: e.cancelable,\n });\n this.dispatchEvent(changeEvent);\n }\n\n _valueChanged(newVal, oldVal) {\n // setting initial value to empty string, skip validation\n if (newVal === '' && oldVal === undefined) {\n return;\n }\n\n if (newVal !== '' && newVal != null) {\n this.hasValue = true;\n } else {\n this.hasValue = false;\n }\n\n if (this.__userInput) {\n this.__userInput = false;\n return;\n } else if (newVal !== undefined) {\n this.inputElement.value = newVal;\n } else {\n this.value = this.inputElement.value = '';\n }\n\n if (this.invalid) {\n this.validate();\n }\n }\n\n _labelChanged(label) {\n if (label !== '' && label != null) {\n this.setAttribute('has-label', '');\n } else {\n this.removeAttribute('has-label');\n }\n }\n\n _onSlotChange() {\n const slotted = this.querySelector(`${this._slottedTagName}[slot=\"${this._slottedTagName}\"]`);\n\n if (this.value) {\n this.inputElement.value = this.value;\n this.validate();\n }\n\n if (slotted && !this._slottedInput) {\n this._validateSlottedValue(slotted);\n this._addInputListeners(slotted);\n this._addIEListeners(slotted);\n this._slottedInput = slotted;\n } else if (!slotted && this._slottedInput) {\n this._removeInputListeners(this._slottedInput);\n this._removeIEListeners(this._slottedInput);\n this._slottedInput = undefined;\n }\n\n Object.keys(PROP_TYPE).map(key => PROP_TYPE[key]).forEach(type =>\n this._propagateHostAttributes(HOST_PROPS[type].map(attr => this[attr]), type));\n }\n\n _hostPropsChanged(...attributesValues) {\n this._propagateHostAttributes(attributesValues, PROP_TYPE.DEFAULT);\n }\n\n _hostAccessiblePropsChanged(...attributesValues) {\n this._propagateHostAttributes(attributesValues, PROP_TYPE.ACCESSIBLE);\n }\n\n _validateSlottedValue(slotted) {\n if (slotted.value !== this.value) {\n console.warn('Please define value on the vaadin-text-field component!');\n slotted.value = '';\n }\n }\n\n _propagateHostAttributes(attributesValues, type) {\n const input = this.inputElement;\n const attributeNames = HOST_PROPS[type];\n\n if (type === 'accessible') {\n attributeNames.forEach((attr, index) => {\n this._setOrToggleAttribute(attr, attributesValues[index], input);\n this._setOrToggleAttribute(`aria-${attr}`, attributesValues[index], input);\n });\n } else {\n attributeNames.forEach((attr, index) => {\n this._setOrToggleAttribute(attr, attributesValues[index], input);\n });\n }\n }\n\n _setOrToggleAttribute(name, value, node) {\n if (!name || !node) {\n return;\n }\n\n if (value) {\n node.setAttribute(name, (typeof value === 'boolean') ? '' : value);\n } else {\n node.removeAttribute(name);\n }\n }\n\n /**\n * Returns true if the current input value satisfies all constraints (if any)\n * @returns {boolean}\n */\n checkValidity() {\n if (this.required || this.pattern || this.maxlength || this.minlength) {\n return this.inputElement.checkValidity();\n } else {\n return !this.invalid;\n }\n }\n\n _addInputListeners(node) {\n node.addEventListener('input', this._boundOnInput);\n node.addEventListener('change', this._boundOnChange);\n node.addEventListener('blur', this._boundOnBlur);\n node.addEventListener('focus', this._boundOnFocus);\n }\n\n _removeInputListeners(node) {\n node.removeEventListener('input', this._boundOnInput);\n node.removeEventListener('change', this._boundOnChange);\n node.removeEventListener('blur', this._boundOnBlur);\n node.removeEventListener('focus', this._boundOnFocus);\n }\n\n ready() {\n super.ready();\n\n this._boundOnInput = this._onInput.bind(this);\n this._boundOnChange = this._onChange.bind(this);\n this._boundOnBlur = this._onBlur.bind(this);\n this._boundOnFocus = this._onFocus.bind(this);\n\n const defaultInput = this.shadowRoot.querySelector('[part=\"value\"]');\n this._slottedInput = this.querySelector(`${this._slottedTagName}[slot=\"${this._slottedTagName}\"]`);\n this._addInputListeners(defaultInput);\n this._addIEListeners(defaultInput);\n if (this._slottedInput) {\n this._addIEListeners(this._slottedInput);\n this._addInputListeners(this._slottedInput);\n }\n\n this.shadowRoot.querySelector('[name=\"input\"], [name=\"textarea\"]')\n .addEventListener('slotchange', this._onSlotChange.bind(this));\n\n if (!(window.ShadyCSS && window.ShadyCSS.nativeCss)) {\n this.updateStyles();\n }\n\n this.$.clearButton.addEventListener('mousedown', () => this._valueClearing = true);\n this.$.clearButton.addEventListener('mouseleave', () => this._valueClearing = false);\n this.$.clearButton.addEventListener('click', this._onClearButtonClick.bind(this));\n this.addEventListener('keydown', this._onKeyDown.bind(this));\n\n var uniqueId = TextFieldMixin._uniqueId = 1 + TextFieldMixin._uniqueId || 0;\n this._errorId = `${this.constructor.is}-error-${uniqueId}`;\n this._labelId = `${this.constructor.is}-label-${uniqueId}`;\n\n // Lumo theme defines a max-height transition for the \"error-message\"\n // part on invalid state change.\n this.shadowRoot.querySelector('[part=\"error-message\"]')\n .addEventListener('transitionend', () => {\n this.__observeOffsetHeight();\n });\n }\n\n /**\n * Returns true if `value` is valid.\n * `` uses this to check the validity or all its elements.\n *\n * @return {boolean} True if the value is valid.\n */\n validate() {\n return !(this.invalid = !this.checkValidity());\n }\n\n clear() {\n this.value = '';\n }\n\n _onBlur() {\n this.validate();\n }\n\n _onFocus() {\n if (this.autoselect) {\n this.inputElement.select();\n // iOS 9 workaround: https://stackoverflow.com/a/7436574\n setTimeout(() => {\n this.inputElement.setSelectionRange(0, 9999);\n });\n }\n }\n\n _onClearButtonClick(e) {\n e.preventDefault();\n // NOTE(yuriy): This line won't affect focus on the host. Cannot be properly tested.\n this.inputElement.focus();\n this.clear();\n this._valueClearing = false;\n if (navigator.userAgent.match(/Trident/)) {\n // Disable IE input\" event prevention here, we want the input event from\n // below to propagate normally.\n this.__preventInput = false;\n }\n const inputEvent = new Event('input', {bubbles: true, composed: true});\n inputEvent.__fromClearButton = true;\n const changeEvent = new Event('change', {bubbles: !this._slottedInput});\n changeEvent.__fromClearButton = true;\n this.inputElement.dispatchEvent(inputEvent);\n this.inputElement.dispatchEvent(changeEvent);\n }\n\n _onKeyDown(e) {\n if (e.keyCode === 27 && this.clearButtonVisible) {\n const dispatchChange = !!this.value;\n this.clear();\n dispatchChange && this.inputElement.dispatchEvent(new Event('change', {bubbles: !this._slottedInput}));\n }\n }\n\n _addIEListeners(node) {\n /* istanbul ignore if */\n if (navigator.userAgent.match(/Trident/)) {\n // IE11 dispatches `input` event in following cases:\n // - focus or blur, when placeholder attribute is set\n // - placeholder attribute value changed\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/101220/\n this._shouldPreventInput = () => {\n this.__preventInput = true;\n requestAnimationFrame(() => {\n this.__preventInput = false;\n });\n };\n node.addEventListener('focusin', this._shouldPreventInput);\n node.addEventListener('focusout', this._shouldPreventInput);\n this._createPropertyObserver('placeholder', this._shouldPreventInput);\n }\n }\n\n _removeIEListeners(node) {\n /* istanbul ignore if */\n if (navigator.userAgent.match(/Trident/)) {\n node.removeEventListener('focusin', this._shouldPreventInput);\n node.removeEventListener('focusout', this._shouldPreventInput);\n }\n }\n\n _getActiveErrorId(invalid, errorMessage, errorId) {\n this._setOrToggleAttribute('aria-describedby',\n (errorMessage && invalid ? errorId : undefined),\n this.inputElement);\n }\n\n _getActiveLabelId(label, labelId) {\n this._setOrToggleAttribute('aria-labelledby',\n (label ? labelId : undefined),\n this.inputElement);\n }\n\n _getErrorMessageAriaHidden(invalid, errorMessage, errorId) {\n return (!(errorMessage && invalid ? errorId : undefined)).toString();\n }\n\n _dispatchIronResizeEventIfNeeded(sizePropertyName, value) {\n const previousSizePropertyName = '__previous' + sizePropertyName;\n if (this[previousSizePropertyName] !== undefined\n && this[previousSizePropertyName] !== value) {\n this.dispatchEvent(\n new CustomEvent('iron-resize', {bubbles: true})\n );\n }\n\n this[previousSizePropertyName] = value;\n }\n\n __observeOffsetHeight() {\n this._dispatchIronResizeEventIfNeeded('Height', this.offsetHeight);\n }\n\n /**\n * @protected\n */\n attributeChangedCallback(prop, oldVal, newVal) {\n super.attributeChangedCallback(prop, oldVal, newVal);\n // Needed until Edge has CSS Custom Properties (present in Edge Preview)\n /* istanbul ignore if */\n if (!(window.ShadyCSS && window.ShadyCSS.nativeCss) &&\n /^(focused|focus-ring|invalid|disabled|placeholder|has-value)$/.test(prop)) {\n this.updateStyles();\n }\n\n // Safari has an issue with repainting shadow root element styles when a host attribute changes.\n // Need this workaround (toggle any inline css property on and off) until the issue gets fixed.\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n /* istanbul ignore if */\n if (isSafari && this.root) {\n const WEBKIT_PROPERTY = '-webkit-backface-visibility';\n this.root.querySelectorAll('*').forEach(el => {\n el.style[WEBKIT_PROPERTY] = 'visible';\n el.style[WEBKIT_PROPERTY] = '';\n });\n }\n }\n\n /**\n * Fired when the user commits a value change.\n *\n * @event change\n */\n\n /**\n * Fired when the value is changed by the user: on every typing keystroke,\n * and the value is cleared using the clear button.\n *\n * @event input\n */\n\n /**\n * Fired when the size of the element changes.\n *\n * @event iron-resize\n */\n};\n","/**\n@license\nCopyright (c) 2017 Vaadin Ltd.\nThis program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n*/\nimport { PolymerElement } from '@polymer/polymer/polymer-element.js';\n\nimport { TextFieldMixin } from './vaadin-text-field-mixin.js';\nimport { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';\nimport { html } from '@polymer/polymer/lib/utils/html-tag.js';\nimport { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';\n/**\n * `` is a Web Component for text field control in forms.\n *\n * ```html\n * \n * \n * ```\n *\n * ### Prefixes and suffixes\n *\n * These are child elements of a `` that are displayed\n * inline with the input, before or after.\n * In order for an element to be considered as a prefix, it must have the slot\n * attribute set to `prefix` (and similarly for `suffix`).\n *\n * ```html\n * \n *
Sent to:
\n *
@vaadin.com
\n * \n * ```\n *\n * ### Styling\n *\n * The following custom properties are available for styling:\n *\n * Custom property | Description | Default\n * ----------------|-------------|-------------\n * `--vaadin-text-field-default-width` | Set the default width of the input field | `12em`\n *\n * The following shadow DOM parts are available for styling:\n *\n * Part name | Description\n * ----------------|----------------\n * `label` | The label element\n * `input-field` | The element that wraps prefix, value and suffix\n * `value` | The text value element inside the `input-field` element\n * `error-message` | The error message element\n *\n * The following state attributes are available for styling:\n *\n * Attribute | Description | Part name\n * -------------|-------------|------------\n * `disabled` | Set to a disabled text field | :host\n * `has-value` | Set when the element has a value | :host\n * `has-label` | Set when the element has a label | :host\n * `invalid` | Set when the element is invalid | :host\n * `input-prevented` | Temporarily set when invalid input is prevented | :host\n * `focused` | Set when the element is focused | :host\n * `focus-ring` | Set when the element is keyboard focused | :host\n * `readonly` | Set to a readonly text field | :host\n *\n * See [ThemableMixin – how to apply styles for shadow parts](https://github.com/vaadin/vaadin-themable-mixin/wiki)\n *\n * @memberof Vaadin\n * @mixes Vaadin.TextFieldMixin\n * @mixes Vaadin.ThemableMixin\n * @demo demo/index.html\n */\nclass TextFieldElement extends ElementMixin(TextFieldMixin(ThemableMixin(PolymerElement))) {\n static get template() {\n return html`\n \n\n
\n\n \n\n
\n\n \n\n \n \n \n\n
\n \n\n
\n\n
[[errorMessage]]
\n\n
\n`;\n }\n\n static get is() {\n return 'vaadin-text-field';\n }\n\n static get version() {\n return '2.4.6';\n }\n\n static get properties() {\n return {\n /**\n * Identifies a list of pre-defined options to suggest to the user.\n * The value must be the id of a element in the same document.\n */\n list: {\n type: String\n },\n\n /**\n * A regular expression that the value is checked against.\n * The pattern must match the entire value, not just some subset.\n */\n pattern: {\n type: String\n },\n\n /**\n * Message to show to the user when validation fails.\n */\n title: {\n type: String\n }\n };\n }\n}\n\ncustomElements.define(TextFieldElement.is, TextFieldElement);\n\nexport { TextFieldElement };\n","import './vaadin-text-field-styles.js';\nimport '@vaadin/vaadin-material-styles/font-icons.js';\nimport { html } from '@polymer/polymer/lib/utils/html-tag.js';\n\nconst $_documentContainer = html`\n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\n","/**\n@license\nCopyright (c) 2017 Vaadin Ltd.\nThis program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n*/\nimport '@polymer/polymer/polymer-element.js';\n\nimport '@polymer/polymer/lib/elements/custom-style.js';\nimport { TextFieldElement } from './vaadin-text-field.js';\nimport { DomModule } from '@polymer/polymer/lib/elements/dom-module.js';\nconst $_documentContainer = document.createElement('template');\n\n$_documentContainer.innerHTML = `\n \n\n \n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\nlet memoizedTemplate;\n\n/**\n * `` is a Web Component for password field control in forms.\n *\n * ```html\n * \n * \n * ```\n *\n * ### Styling\n *\n * See vaadin-text-field.html for the styling documentation\n *\n * In addition to vaadin-text-field parts, here's the list of vaadin-password-field specific parts\n *\n * Part name | Description\n * ----------------|----------------------------------------------------\n * `reveal-button` | The eye icon which toggles the password visibility\n *\n * In addition to vaadin-text-field state attributes, here's the list of vaadin-password-field specific attributes\n *\n * Attribute | Description | Part name\n * -------------|-------------|------------\n * `password-visible` | Set when the password is visible | :host\n *\n * See [ThemableMixin – how to apply styles for shadow parts](https://github.com/vaadin/vaadin-themable-mixin/wiki)\n *\n * @memberof Vaadin\n * @extends Vaadin.TextFieldElement\n * @demo demo/index.html\n */\nclass PasswordFieldElement extends TextFieldElement {\n static get is() {\n return 'vaadin-password-field';\n }\n\n static get version() {\n return '2.4.6';\n }\n\n static get properties() {\n return {\n /**\n * Set to true to hide the eye icon which toggles the password visibility.\n */\n revealButtonHidden: {\n type: Boolean,\n value: false\n },\n\n /**\n * True if the password is visible ([type=text]).\n */\n passwordVisible: {\n type: Boolean,\n value: false,\n reflectToAttribute: true,\n observer: '_passwordVisibleChange',\n readOnly: true\n }\n };\n }\n\n static get template() {\n if (!memoizedTemplate) {\n // Clone the superclass template\n memoizedTemplate = super.template.cloneNode(true);\n\n // Retrieve this element's dom-module template\n const thisTemplate = DomModule.import(this.is + '-template', 'template');\n const revealButton = thisTemplate.content.querySelector('[part=\"reveal-button\"]');\n const styles = thisTemplate.content.querySelector('style');\n\n // Append reveal-button and styles to the text-field template\n const inputField = memoizedTemplate.content.querySelector('[part=\"input-field\"]');\n inputField.appendChild(revealButton);\n memoizedTemplate.content.appendChild(styles);\n }\n\n return memoizedTemplate;\n }\n\n ready() {\n super.ready();\n this.inputElement.type = 'password';\n this.inputElement.autocapitalize = 'off';\n\n this.addEventListener('focusout', () => {\n if (!this._passwordVisibilityChanging) {\n this._setPasswordVisible(false);\n if (this._cachedChangeEvent) {\n this._onChange(this._cachedChangeEvent);\n }\n }\n });\n }\n\n _onChange(e) {\n const slotted = this.querySelector(`${this._slottedTagName}[slot=\"${this._slottedTagName}\"]`);\n if (slotted) {\n e.stopPropagation();\n }\n if (this._passwordVisibilityChanging) {\n this._cachedChangeEvent = e;\n } else {\n this._cachedChangeEvent = null;\n super._onChange(e);\n }\n }\n\n _revealButtonMouseDown(e) {\n if (this.hasAttribute('focused')) {\n e.preventDefault();\n }\n }\n\n _togglePasswordVisibilityTouchend(e) {\n // Cancel the following click event\n e.preventDefault();\n this._togglePasswordVisibility();\n this.inputElement.focus();\n }\n\n _togglePasswordVisibility() {\n this._passwordVisibilityChanging = true;\n this.inputElement.blur();\n this._setPasswordVisible(!this.passwordVisible);\n this.inputElement.focus();\n this._passwordVisibilityChanging = false;\n }\n\n _passwordVisibleChange(passwordVisible) {\n this.inputElement.type = passwordVisible ? 'text' : 'password';\n }\n}\n\ncustomElements.define(PasswordFieldElement.is, PasswordFieldElement);\n\nexport { PasswordFieldElement };\n","import '@vaadin/vaadin-material-styles/color.js';\nimport '@vaadin/vaadin-material-styles/typography.js';\nimport { html } from '@polymer/polymer/lib/utils/html-tag.js';\n\nconst $_documentContainer = html`\n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\n","import './vaadin-form-item-styles.js';\nimport { html } from '@polymer/polymer/lib/utils/html-tag.js';\n\nconst $_documentContainer = html`\n \n`;\n\ndocument.head.appendChild($_documentContainer.content);\n","/**\n@license\nCopyright (c) 2017 Vaadin Ltd.\nThis program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n*/\nimport { PolymerElement } from '@polymer/polymer/polymer-element.js';\n\nimport { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';\nimport { IronResizableBehavior } from '@polymer/iron-resizable-behavior/iron-resizable-behavior.js';\nimport { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';\nimport { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';\nimport { html } from '@polymer/polymer/lib/utils/html-tag.js';\nimport { beforeNextRender } from '@polymer/polymer/lib/utils/render-status.js';\nimport { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';\n/**\n * `` is a Web Component providing configurable responsive\n * layout for form elements.\n *\n * ```html\n * \n *\n * \n * \n * \n * \n *\n * \n * \n * \n * \n *\n * \n * \n * \n * \n *\n * \n * ```\n *\n * It supports any child elements as layout items.\n *\n * By default, it makes a layout of two columns if the element width is equal or\n * wider than 40em, and a single column layout otherwise.\n *\n * The number of columns and the responsive behavior are customizable with\n * the `responsiveSteps` property.\n *\n * ### Spanning Items on Multiple Columns\n *\n * You can use `colspan` attribute on the items.\n * In the example below, the first text field spans on two columns:\n *\n * ```html\n * \n *\n * \n * \n * \n * \n *\n * \n * \n * \n * \n *\n * \n * \n * \n * \n *\n * \n * ```\n *\n * ### Explicit New Row\n *\n * Use the `
` line break element to wrap the items on a new row:\n *\n * ```html\n * \n *\n * \n * \n * \n * \n *\n *
\n *\n * \n * \n * \n * \n *\n *
\n * ```\n *\n * ### CSS Properties Reference\n *\n * The following custom CSS properties are available on the ``\n * element:\n *\n * Custom CSS property | Description | Default\n * ---|---|---\n * `--vaadin-form-layout-column-spacing` | Length of the spacing between columns | `2em`\n *\n * @memberof Vaadin\n * @mixes Vaadin.ElementMixin\n * @mixes Vaadin.ThemableMixin\n * @demo demo/index.html\n */\nclass FormLayoutElement extends\n ElementMixin(\n ThemableMixin(\n mixinBehaviors([IronResizableBehavior], PolymerElement))) {\n static get template() {\n return html`\n \n
\n \n
\n`;\n }\n\n static get is() {\n return 'vaadin-form-layout';\n }\n\n static get version() {\n return '2.1.4';\n }\n\n static get properties() {\n return {\n /**\n * @typedef ResponsiveStep\n * @type {object}\n * @property {string} minWidth - The threshold value for this step in CSS length units.\n * @property {number} columns - Number of columns. Only natural numbers are valid.\n * @property {string} labelsPosition - Labels position option, valid values: `\"aside\"` (default), `\"top\"`.\n */\n\n /**\n * Allows specifying a responsive behavior with the number of columns\n * and the label position depending on the layout width.\n *\n * Format: array of objects, each object defines one responsive step\n * with `minWidth` CSS length, `columns` number, and optional\n * `labelsPosition` string of `\"aside\"` or `\"top\"`. At least one item is required.\n *\n * #### Examples\n *\n * ```javascript\n * formLayout.responsiveSteps = [{columns: 1}];\n * // The layout is always a single column, labels aside.\n * ```\n *\n * ```javascript\n * formLayout.responsiveSteps = [\n * {minWidth: 0, columns: 1},\n * {minWidth: '40em', columns: 2}\n * ];\n * // Sets two responsive steps:\n * // 1. When the layout width is < 40em, one column, labels aside.\n * // 2. Width >= 40em, two columns, labels aside.\n * ```\n *\n * ```javascript\n * formLayout.responsiveSteps = [\n * {minWidth: 0, columns: 1, labelsPosition: 'top'},\n * {minWidth: '20em', columns: 1},\n * {minWidth: '40em', columns: 2}\n * ];\n * // Default value. Three responsive steps:\n * // 1. Width < 20em, one column, labels on top.\n * // 2. 20em <= width < 40em, one column, labels aside.\n * // 3. Width >= 40em, two columns, labels aside.\n * ```\n *\n * @type {ResponsiveStep[]}\n */\n responsiveSteps: {\n type: Array,\n value: function() {\n return [\n {minWidth: 0, columns: 1, labelsPosition: 'top'},\n {minWidth: '20em', columns: 1},\n {minWidth: '40em', columns: 2}\n ];\n },\n observer: '_responsiveStepsChanged'\n },\n\n /**\n * Current number of columns in the layout\n */\n _columnCount: {\n type: Number\n },\n\n /**\n * Indicates that labels are on top\n */\n _labelsOnTop: {\n type: Boolean\n }\n };\n }\n\n static get observers() {\n return [\n '_invokeUpdateStyles(_columnCount, _labelsOnTop)'\n ];\n }\n\n ready() {\n // Here we create and attach a style element that we use for validating\n // CSS values in `responsiveSteps`. We can’t add this to the `